minor: Implement core 0.10
This commit is contained in:
39
src/components/hubl-reactivity.js
Normal file
39
src/components/hubl-reactivity.js
Normal file
@ -0,0 +1,39 @@
|
||||
import { store } from 'https://unpkg.com/@startinblox/core@0.10';
|
||||
import { Sib } from "https://unpkg.com/@startinblox/core@0.10/dist/libs/Sib.js";
|
||||
import { StoreMixin } from "https://unpkg.com/@startinblox/core@0.10/dist/mixins/storeMixin.js";
|
||||
|
||||
export const HublReactivity = {
|
||||
name: 'hubl-reactivity',
|
||||
use: [StoreMixin],
|
||||
attributes: {
|
||||
targetSrc: {
|
||||
type: String,
|
||||
default: '',
|
||||
callback: function () {
|
||||
this.subscribe();
|
||||
}
|
||||
},
|
||||
dataSrc: {
|
||||
type: String,
|
||||
default: '',
|
||||
callback: async function (value) {
|
||||
this.resourceId = null;
|
||||
if (this.nestedField) {
|
||||
const resource = store.get(value) || await store.getData(value, this.context);
|
||||
const nestedResource = await resource[this.nestedField]
|
||||
this.resourceId = nestedResource ? nestedResource['@id'] : null;
|
||||
} else {
|
||||
this.resourceId = value;
|
||||
}
|
||||
this.subscribe();
|
||||
}
|
||||
},
|
||||
},
|
||||
subscribe() {
|
||||
if (this.resourceId && this.targetSrc) {
|
||||
store.subscribeVirtualContainerTo(this.resourceId, this.targetSrc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Sib.register(HublReactivity);
|
@ -1,4 +1,4 @@
|
||||
import { widgetFactory } from 'https://unpkg.com/@startinblox/core@0.9/dist/widgets/widget-factory.js';
|
||||
import { widgetFactory } from 'https://unpkg.com/@startinblox/core@0.10/dist/widgets/widget-factory.js';
|
||||
|
||||
const HublSearchUsers = widgetFactory(
|
||||
'hubl-search-users',
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { widgetFactory } from 'https://unpkg.com/@startinblox/core@0.9/dist/widgets/widget-factory.js';
|
||||
import { importCSS } from 'https://unpkg.com/@startinblox/core@0.9/dist/libs/helpers.js';
|
||||
import { widgetFactory } from 'https://unpkg.com/@startinblox/core@0.10/dist/widgets/widget-factory.js';
|
||||
import { importCSS } from 'https://unpkg.com/@startinblox/core@0.10/dist/libs/helpers.js';
|
||||
import SlimSelect from 'https://dev.jspm.io/slim-select@1.23';
|
||||
|
||||
const HublStatus = widgetFactory(
|
||||
|
Reference in New Issue
Block a user