@startinblox/core 0.17.31 → 0.18.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_snowpack/pkg/autolinker.js +3515 -3367
- package/dist/_snowpack/pkg/autolinker.js.map +1 -1
- package/dist/_snowpack/pkg/common/{_baseUnary-217dffb2.js → _baseUnary-c1edb653.js} +16 -40
- package/dist/_snowpack/pkg/common/{_baseUnary-217dffb2.js.map → _baseUnary-c1edb653.js.map} +1 -1
- package/dist/_snowpack/pkg/common/{_commonjsHelpers-8c19dec8.js → _commonjsHelpers-37fa8da4.js} +6 -2
- package/dist/_snowpack/pkg/common/_commonjsHelpers-37fa8da4.js.map +1 -0
- package/dist/_snowpack/pkg/common/{decode-a4c334cf.js → decode-26fbf385.js} +38 -69
- package/dist/_snowpack/pkg/common/decode-26fbf385.js.map +1 -0
- package/dist/_snowpack/pkg/common/lit-html-3647afce.js +1104 -0
- package/dist/_snowpack/pkg/common/lit-html-3647afce.js.map +1 -0
- package/dist/_snowpack/pkg/delta-markdown-for-quill.js +4767 -4246
- package/dist/_snowpack/pkg/delta-markdown-for-quill.js.map +1 -1
- package/dist/_snowpack/pkg/dialog-polyfill.js +107 -139
- package/dist/_snowpack/pkg/dialog-polyfill.js.map +1 -1
- package/dist/_snowpack/pkg/fusejs.js +411 -601
- package/dist/_snowpack/pkg/fusejs.js.map +1 -1
- package/dist/_snowpack/pkg/jsonld-context-parser.js +718 -686
- package/dist/_snowpack/pkg/jsonld-context-parser.js.map +1 -1
- package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css +59 -59
- package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css.proxy.js +1 -1
- package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css +14 -14
- package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css.proxy.js +1 -1
- package/dist/_snowpack/pkg/lit-html/directives/if-defined.js +13 -14
- package/dist/_snowpack/pkg/lit-html/directives/if-defined.js.map +1 -1
- package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js +17 -15
- package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js.map +1 -1
- package/dist/_snowpack/pkg/lit-html/directives/until.js +45 -46
- package/dist/_snowpack/pkg/lit-html/directives/until.js.map +1 -1
- package/dist/_snowpack/pkg/lit-html.js +37 -35
- package/dist/_snowpack/pkg/lit-html.js.map +1 -1
- package/dist/_snowpack/pkg/markdown-it-link-attributes.js +1 -20
- package/dist/_snowpack/pkg/markdown-it-link-attributes.js.map +1 -1
- package/dist/_snowpack/pkg/markdown-it.js +1731 -2284
- package/dist/_snowpack/pkg/markdown-it.js.map +1 -1
- package/dist/_snowpack/pkg/quill-delta-to-markdown.js +236 -294
- package/dist/_snowpack/pkg/quill-delta-to-markdown.js.map +1 -1
- package/dist/_snowpack/pkg/quill.js +12077 -11017
- package/dist/_snowpack/pkg/quill.js.map +1 -1
- package/dist/_snowpack/pkg/slim-select.js +711 -1
- package/dist/_snowpack/pkg/slim-select.js.map +1 -1
- package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css +1 -16
- package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css.proxy.js +1 -1
- package/dist/_snowpack/pkg/tui-calendar.js +44297 -40075
- package/dist/_snowpack/pkg/tui-calendar.js.map +1 -1
- package/dist/components/solid-ac-checker.js +4 -17
- package/dist/components/solid-calendar.js +5 -26
- package/dist/components/solid-delete.js +9 -24
- package/dist/components/solid-display.js +15 -59
- package/dist/components/solid-form-search.js +27 -79
- package/dist/components/solid-form.js +48 -143
- package/dist/components/solid-lang.js +8 -19
- package/dist/components/solid-map.js +26 -64
- package/dist/components/solid-table.js +51 -133
- package/dist/components/solid-widget.js +2 -24
- package/dist/index.js +17 -11
- package/dist/libs/Component.js +4 -10
- package/dist/libs/ComponentFactory.js +6 -34
- package/dist/libs/Compositor.js +8 -15
- package/dist/libs/Sib.js +7 -21
- package/dist/libs/filter.js +184 -0
- package/dist/libs/helpers.js +19 -47
- package/dist/libs/interfaces.js +1 -1
- package/dist/libs/lit-helpers.js +7 -34
- package/dist/libs/polyfills.js +7 -10
- package/dist/libs/store/server-pagination.js +22 -0
- package/dist/libs/store/server-search.js +35 -0
- package/dist/libs/store/store.js +243 -234
- package/dist/mixins/attributeBinderMixin.js +17 -25
- package/dist/mixins/contextMixin.js +5 -7
- package/dist/mixins/counterMixin.js +2 -23
- package/dist/mixins/federationMixin.js +2 -14
- package/dist/mixins/filterMixin.js +60 -100
- package/dist/mixins/grouperMixin.js +11 -18
- package/dist/mixins/highlighterMixin.js +2 -8
- package/dist/mixins/interfaces.js +3 -5
- package/dist/mixins/listMixin.js +12 -43
- package/dist/mixins/nextMixin.js +1 -4
- package/dist/mixins/paginateMixin.js +17 -30
- package/dist/mixins/requiredMixin.js +1 -9
- package/dist/mixins/serverPaginationMixin.js +122 -0
- package/dist/mixins/sorterMixin.js +26 -44
- package/dist/mixins/storeMixin.js +28 -21
- package/dist/mixins/translationMixin.js +2 -12
- package/dist/mixins/validationMixin.js +28 -46
- package/dist/mixins/widgetMixin.js +58 -154
- package/dist/new-widgets/attributeMixins/actionMixin.js +1 -2
- package/dist/new-widgets/attributeMixins/blankMixin.js +1 -4
- package/dist/new-widgets/attributeMixins/booleanMixin.js +1 -4
- package/dist/new-widgets/attributeMixins/index.js +1 -2
- package/dist/new-widgets/attributeMixins/mailtoMixin.js +1 -4
- package/dist/new-widgets/attributeMixins/multipleMixin.js +1 -2
- package/dist/new-widgets/attributeMixins/numberMixin.js +1 -4
- package/dist/new-widgets/attributeMixins/placeholderMixin.js +1 -4
- package/dist/new-widgets/attributeMixins/telMixin.js +1 -4
- package/dist/new-widgets/baseWidgetMixin.js +5 -18
- package/dist/new-widgets/callbackMixins/autocompletionMixin.js +3 -11
- package/dist/new-widgets/callbackMixins/index.js +1 -2
- package/dist/new-widgets/callbackMixins/richtextMixin.js +1 -6
- package/dist/new-widgets/interfaces.js +1 -0
- package/dist/new-widgets/new-widget-factory.js +14 -19
- package/dist/new-widgets/templateAdditionMixins/addableMixin.js +6 -21
- package/dist/new-widgets/templateAdditionMixins/index.js +2 -3
- package/dist/new-widgets/templateAdditionMixins/labelLastMixin.js +5 -18
- package/dist/new-widgets/templateAdditionMixins/labelMixin.js +5 -18
- package/dist/new-widgets/templates/defaultTemplatesDirectory.js +21 -27
- package/dist/new-widgets/templates/displayTemplatesDirectory.js +35 -70
- package/dist/new-widgets/templates/formTemplatesDirectory.js +350 -315
- package/dist/new-widgets/templates/groupTemplatesDirectory.js +5 -15
- package/dist/new-widgets/templates/index.js +1 -2
- package/dist/new-widgets/templates/setTemplatesDirectory.js +4 -37
- package/dist/new-widgets/templatesDependencies/altMixin.js +1 -2
- package/dist/new-widgets/templatesDependencies/editableMixin.js +9 -26
- package/dist/new-widgets/templatesDependencies/filterRangeFormMixin.js +3 -7
- package/dist/new-widgets/templatesDependencies/formCheckboxMixin.js +1 -5
- package/dist/new-widgets/templatesDependencies/formCheckboxesMixin.js +1 -11
- package/dist/new-widgets/templatesDependencies/formDropdownMixin.js +3 -13
- package/dist/new-widgets/templatesDependencies/formFileMixin.js +1 -13
- package/dist/new-widgets/templatesDependencies/formLengthMixin.js +1 -2
- package/dist/new-widgets/templatesDependencies/formMinMaxMixin.js +1 -2
- package/dist/new-widgets/templatesDependencies/formMixin.js +4 -14
- package/dist/new-widgets/templatesDependencies/formNumberMixin.js +1 -5
- package/dist/new-widgets/templatesDependencies/formRadioMixin.js +1 -5
- package/dist/new-widgets/templatesDependencies/formStepMixin.js +1 -2
- package/dist/new-widgets/templatesDependencies/linkTextMixin.js +13 -0
- package/dist/new-widgets/templatesDependencies/multipleFormMixin.js +23 -18
- package/dist/new-widgets/templatesDependencies/multipleselectFormMixin.js +1 -10
- package/dist/new-widgets/templatesDependencies/patternMixin.js +1 -2
- package/dist/new-widgets/templatesDependencies/rangeMixin.js +5 -15
- package/dist/new-widgets/templatesDependencies/setMixin.js +1 -4
- package/dist/new-widgets/templatesDependencies/valueRichtextMixin.js +1 -4
- package/dist/new-widgets/valueTransformationMixins/autolinkMixin.js +1 -5
- package/dist/new-widgets/valueTransformationMixins/dateMixin.js +5 -11
- package/dist/new-widgets/valueTransformationMixins/dateTimeMixin.js +1 -5
- package/dist/new-widgets/valueTransformationMixins/index.js +1 -2
- package/dist/new-widgets/valueTransformationMixins/markdownMixin.js +1 -7
- package/dist/new-widgets/valueTransformationMixins/multilineMixin.js +1 -5
- package/dist/new-widgets/valueTransformationMixins/oembedMixin.js +1 -7
- package/dist/solid-template-element.js +24 -44
- package/dist/widgets/baseWidget.js +21 -85
- package/dist/widgets/widget-factory.js +4 -6
- package/package.json +8 -6
- package/dist/_snowpack/env.js +0 -3
- package/dist/_snowpack/pkg/autolinker.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/common/_baseUnary-217dffb2.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/common/_commonjsHelpers-8c19dec8.js.map +0 -1
- package/dist/_snowpack/pkg/common/_commonjsHelpers-8c19dec8.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/common/decode-a4c334cf.js.map +0 -1
- package/dist/_snowpack/pkg/common/decode-a4c334cf.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/common/lit-html-babd44cd.js +0 -1119
- package/dist/_snowpack/pkg/common/lit-html-babd44cd.js.map +0 -1
- package/dist/_snowpack/pkg/common/lit-html-babd44cd.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/delta-markdown-for-quill.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/dialog-polyfill.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/fusejs.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/jsonld-context-parser.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/lit-html/directives/if-defined.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/lit-html/directives/until.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/lit-html.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/markdown-it-link-attributes.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/markdown-it.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/quill-delta-to-markdown.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/quill.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/slim-select.js.map.proxy.js +0 -1
- package/dist/_snowpack/pkg/tui-calendar.js.map.proxy.js +0 -1
- package/dist/components/solid-ac-checker.js.map +0 -1
- package/dist/components/solid-calendar.js.map +0 -1
- package/dist/components/solid-delete.js.map +0 -1
- package/dist/components/solid-display.js.map +0 -1
- package/dist/components/solid-form-search.js.map +0 -1
- package/dist/components/solid-form.js.map +0 -1
- package/dist/components/solid-lang.js.map +0 -1
- package/dist/components/solid-map.js.map +0 -1
- package/dist/components/solid-table.js.map +0 -1
- package/dist/components/solid-widget.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/libs/Component.js.map +0 -1
- package/dist/libs/ComponentFactory.js.map +0 -1
- package/dist/libs/Compositor.js.map +0 -1
- package/dist/libs/Sib.js.map +0 -1
- package/dist/libs/helpers.js.map +0 -1
- package/dist/libs/interfaces.js.map +0 -1
- package/dist/libs/lit-helpers.js.map +0 -1
- package/dist/libs/polyfills.js.map +0 -1
- package/dist/libs/store/store.js.map +0 -1
- package/dist/mixins/attributeBinderMixin.js.map +0 -1
- package/dist/mixins/contextMixin.js.map +0 -1
- package/dist/mixins/counterMixin.js.map +0 -1
- package/dist/mixins/federationMixin.js.map +0 -1
- package/dist/mixins/filterMixin.js.map +0 -1
- package/dist/mixins/grouperMixin.js.map +0 -1
- package/dist/mixins/highlighterMixin.js.map +0 -1
- package/dist/mixins/interfaces.js.map +0 -1
- package/dist/mixins/listMixin.js.map +0 -1
- package/dist/mixins/nextMixin.js.map +0 -1
- package/dist/mixins/paginateMixin.js.map +0 -1
- package/dist/mixins/requiredMixin.js.map +0 -1
- package/dist/mixins/sorterMixin.js.map +0 -1
- package/dist/mixins/storeMixin.js.map +0 -1
- package/dist/mixins/translationMixin.js.map +0 -1
- package/dist/mixins/validationMixin.js.map +0 -1
- package/dist/mixins/widgetMixin.js.map +0 -1
- package/dist/new-widgets/attributeMixins/actionMixin.js.map +0 -1
- package/dist/new-widgets/attributeMixins/blankMixin.js.map +0 -1
- package/dist/new-widgets/attributeMixins/booleanMixin.js.map +0 -1
- package/dist/new-widgets/attributeMixins/index.js.map +0 -1
- package/dist/new-widgets/attributeMixins/mailtoMixin.js.map +0 -1
- package/dist/new-widgets/attributeMixins/multipleMixin.js.map +0 -1
- package/dist/new-widgets/attributeMixins/numberMixin.js.map +0 -1
- package/dist/new-widgets/attributeMixins/placeholderMixin.js.map +0 -1
- package/dist/new-widgets/attributeMixins/telMixin.js.map +0 -1
- package/dist/new-widgets/baseWidgetMixin.js.map +0 -1
- package/dist/new-widgets/callbackMixins/autocompletionMixin.js.map +0 -1
- package/dist/new-widgets/callbackMixins/index.js.map +0 -1
- package/dist/new-widgets/callbackMixins/richtextMixin.js.map +0 -1
- package/dist/new-widgets/new-widget-factory.js.map +0 -1
- package/dist/new-widgets/templateAdditionMixins/addableMixin.js.map +0 -1
- package/dist/new-widgets/templateAdditionMixins/index.js.map +0 -1
- package/dist/new-widgets/templateAdditionMixins/labelLastMixin.js.map +0 -1
- package/dist/new-widgets/templateAdditionMixins/labelMixin.js.map +0 -1
- package/dist/new-widgets/templates/defaultTemplatesDirectory.js.map +0 -1
- package/dist/new-widgets/templates/displayTemplatesDirectory.js.map +0 -1
- package/dist/new-widgets/templates/formTemplatesDirectory.js.map +0 -1
- package/dist/new-widgets/templates/groupTemplatesDirectory.js.map +0 -1
- package/dist/new-widgets/templates/index.js.map +0 -1
- package/dist/new-widgets/templates/setTemplatesDirectory.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/altMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/editableMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/filterRangeFormMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formCheckboxMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formCheckboxesMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formDropdownMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formFileMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formLengthMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formMinMaxMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formNumberMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formRadioMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/formStepMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/multipleFormMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/multipleselectFormMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/patternMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/rangeMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/setMixin.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/valueRichtextMixin.js.map +0 -1
- package/dist/new-widgets/valueTransformationMixins/autolinkMixin.js.map +0 -1
- package/dist/new-widgets/valueTransformationMixins/dateMixin.js.map +0 -1
- package/dist/new-widgets/valueTransformationMixins/dateTimeMixin.js.map +0 -1
- package/dist/new-widgets/valueTransformationMixins/index.js.map +0 -1
- package/dist/new-widgets/valueTransformationMixins/markdownMixin.js.map +0 -1
- package/dist/new-widgets/valueTransformationMixins/multilineMixin.js.map +0 -1
- package/dist/new-widgets/valueTransformationMixins/oembedMixin.js.map +0 -1
- package/dist/solid-template-element.js.map +0 -1
- package/dist/widgets/baseWidget.js.map +0 -1
- package/dist/widgets/widget-factory.js.map +0 -1
|
@@ -5,11 +5,9 @@ const AttributeBinderMixin = {
|
|
|
5
5
|
initialState: {
|
|
6
6
|
bindedAttributes: null
|
|
7
7
|
},
|
|
8
|
-
|
|
9
8
|
created() {
|
|
10
9
|
this.bindedAttributes = {};
|
|
11
10
|
},
|
|
12
|
-
|
|
13
11
|
/**
|
|
14
12
|
* Reset attributes values
|
|
15
13
|
*/
|
|
@@ -18,36 +16,37 @@ const AttributeBinderMixin = {
|
|
|
18
16
|
this.element.setAttribute(attr, this.bindedAttributes[attr]);
|
|
19
17
|
}
|
|
20
18
|
},
|
|
21
|
-
|
|
22
19
|
/**
|
|
23
20
|
* Replace store://XXX attributes by corresponding data
|
|
24
21
|
* @param reset - set to false if no need to reset data
|
|
25
22
|
*/
|
|
26
|
-
async replaceAttributesData(
|
|
23
|
+
async replaceAttributesData() {
|
|
24
|
+
let reset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
27
25
|
if (reset) this.resetAttributesData();
|
|
28
26
|
const oldAttributes = Array.from(this.element.attributes) // transform NamedNodeMap in object
|
|
29
27
|
.reduce((obj, attr) => {
|
|
30
28
|
// Keep only attributes starting with `store://...`
|
|
31
|
-
if (!attr.value.match(/^store:\/\/(resource|container|user)/)) return {
|
|
32
|
-
|
|
29
|
+
if (!attr.value.match(/^store:\/\/(resource|container|user)/)) return {
|
|
30
|
+
...obj
|
|
31
|
+
};
|
|
33
32
|
|
|
33
|
+
// Save attr for reset later
|
|
34
34
|
if (!this.bindedAttributes[attr.name]) this.bindedAttributes[attr.name] = attr.value;
|
|
35
|
-
return {
|
|
35
|
+
return {
|
|
36
|
+
...obj,
|
|
36
37
|
[attr.name]: attr.value // add "key: value"
|
|
37
|
-
|
|
38
38
|
};
|
|
39
39
|
}, {});
|
|
40
|
-
const newAttributes = await this.transformAttributes({
|
|
40
|
+
const newAttributes = await this.transformAttributes({
|
|
41
|
+
...oldAttributes
|
|
41
42
|
}, this.resource); // generate new attributes
|
|
42
43
|
|
|
43
44
|
for (let attr of Object.keys(newAttributes)) {
|
|
44
45
|
// set attributes on element
|
|
45
46
|
if (oldAttributes[attr] == newAttributes[attr]) continue; // only if it changed
|
|
46
|
-
|
|
47
47
|
this.element.setAttribute(attr, newAttributes[attr]);
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
|
-
|
|
51
50
|
/**
|
|
52
51
|
* Transform attributes from `store://...` to their actual value
|
|
53
52
|
* @param attributes - object representing attributes of an element
|
|
@@ -55,11 +54,10 @@ const AttributeBinderMixin = {
|
|
|
55
54
|
* @returns - object representing attributes of an element with resolved values
|
|
56
55
|
*/
|
|
57
56
|
async transformAttributes(attributes, resource) {
|
|
58
|
-
const isContainer = resource && resource.isContainer();
|
|
59
|
-
|
|
57
|
+
const isContainer = resource && resource.isContainer?.();
|
|
60
58
|
for (let attr of Object.keys(attributes)) {
|
|
61
|
-
const value = attributes[attr];
|
|
62
|
-
|
|
59
|
+
const value = attributes[attr];
|
|
60
|
+
// Avoid error if value is a number
|
|
63
61
|
if (typeof value === 'string') {
|
|
64
62
|
// Replace attribute value
|
|
65
63
|
if (!isContainer && resource && value.startsWith('store://resource')) {
|
|
@@ -73,23 +71,18 @@ const AttributeBinderMixin = {
|
|
|
73
71
|
} else if (value.startsWith('store://user')) {
|
|
74
72
|
// USER
|
|
75
73
|
const userId = await this.retry(this.getUser.bind(this)); // retry until sibAuth is defined
|
|
76
|
-
|
|
77
74
|
const user = userId && userId['@id'] ? await store.getData(userId['@id'], this.context || base_context) : null;
|
|
78
|
-
|
|
79
75
|
if (!user) {
|
|
80
76
|
attributes[attr] = '';
|
|
81
77
|
continue;
|
|
82
78
|
}
|
|
83
|
-
|
|
84
79
|
let path = value.replace('store://user.', '');
|
|
85
80
|
attributes[attr] = user ? await user[path] : '';
|
|
86
81
|
}
|
|
87
82
|
}
|
|
88
83
|
}
|
|
89
|
-
|
|
90
84
|
return attributes;
|
|
91
85
|
},
|
|
92
|
-
|
|
93
86
|
/**
|
|
94
87
|
* Returns logged in user from sib-auth
|
|
95
88
|
* @returns userId
|
|
@@ -98,7 +91,6 @@ const AttributeBinderMixin = {
|
|
|
98
91
|
const sibAuth = document.querySelector('sib-auth');
|
|
99
92
|
return sibAuth.getUser();
|
|
100
93
|
},
|
|
101
|
-
|
|
102
94
|
/**
|
|
103
95
|
* Retry [fn] for [maxRetries] times every [ms]
|
|
104
96
|
* @param fn
|
|
@@ -106,7 +98,9 @@ const AttributeBinderMixin = {
|
|
|
106
98
|
* @param maxRetries
|
|
107
99
|
* @returns
|
|
108
100
|
*/
|
|
109
|
-
async retry(fn
|
|
101
|
+
async retry(fn) {
|
|
102
|
+
let ms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
|
|
103
|
+
let maxRetries = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
|
|
110
104
|
return new Promise((resolve, reject) => {
|
|
111
105
|
let retries = 0;
|
|
112
106
|
fn().then(resolve).catch(() => {
|
|
@@ -118,7 +112,5 @@ const AttributeBinderMixin = {
|
|
|
118
112
|
});
|
|
119
113
|
});
|
|
120
114
|
}
|
|
121
|
-
|
|
122
115
|
};
|
|
123
|
-
export { AttributeBinderMixin };
|
|
124
|
-
//# sourceMappingURL=attributeBinderMixin.js.map
|
|
116
|
+
export { AttributeBinderMixin };
|
|
@@ -8,21 +8,19 @@ const ContextMixin = {
|
|
|
8
8
|
default: null
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
|
-
|
|
12
11
|
get context() {
|
|
13
|
-
return {
|
|
12
|
+
return {
|
|
13
|
+
...base_context,
|
|
14
14
|
...this.extra_context
|
|
15
15
|
};
|
|
16
16
|
},
|
|
17
|
-
|
|
18
17
|
get extra_context() {
|
|
19
|
-
let extraContextElement = this.extraContext ? document.getElementById(this.extraContext) :
|
|
18
|
+
let extraContextElement = this.extraContext ? document.getElementById(this.extraContext) :
|
|
19
|
+
// take element extra context first
|
|
20
20
|
document.querySelector('[data-default-context]'); // ... or look for a default extra context
|
|
21
21
|
|
|
22
22
|
if (extraContextElement) return JSON.parse(extraContextElement.textContent || "{}");
|
|
23
23
|
return {};
|
|
24
24
|
}
|
|
25
|
-
|
|
26
25
|
};
|
|
27
|
-
export { ContextMixin };
|
|
28
|
-
//# sourceMappingURL=contextMixin.js.map
|
|
26
|
+
export { ContextMixin };
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
function _templateObject() {
|
|
2
|
-
const data = _taggedTemplateLiteral(["", ""]);
|
|
3
|
-
|
|
4
|
-
_templateObject = function () {
|
|
5
|
-
return data;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
return data;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
12
|
-
|
|
13
1
|
import { html } from '../_snowpack/pkg/lit-html.js';
|
|
14
2
|
import { unsafeHTML } from '../_snowpack/pkg/lit-html/directives/unsafe-html.js';
|
|
15
3
|
import { evalTemplateString } from '../libs/helpers.js';
|
|
@@ -26,11 +14,9 @@ const CounterMixin = {
|
|
|
26
14
|
counter: null,
|
|
27
15
|
parentCounterDiv: null
|
|
28
16
|
},
|
|
29
|
-
|
|
30
17
|
attached() {
|
|
31
18
|
this.listPostProcessors.push(this.countResources.bind(this));
|
|
32
19
|
},
|
|
33
|
-
|
|
34
20
|
async countResources(resources, listPostProcessors, div, context) {
|
|
35
21
|
if (this.counterTemplate) {
|
|
36
22
|
this.initParentCounterDiv(div);
|
|
@@ -40,11 +26,9 @@ const CounterMixin = {
|
|
|
40
26
|
parent: this.parentCounterDiv
|
|
41
27
|
});
|
|
42
28
|
}
|
|
43
|
-
|
|
44
29
|
const nextProcessor = listPostProcessors.shift();
|
|
45
30
|
if (nextProcessor) await nextProcessor(resources, listPostProcessors, div, context);
|
|
46
31
|
},
|
|
47
|
-
|
|
48
32
|
/**
|
|
49
33
|
* Create the parent div of the counter in the component.
|
|
50
34
|
* @param div: parent div where to insert the counter div
|
|
@@ -54,10 +38,8 @@ const CounterMixin = {
|
|
|
54
38
|
this.parentCounterDiv = document.createElement('div');
|
|
55
39
|
this.element.insertBefore(this.parentCounterDiv, div);
|
|
56
40
|
},
|
|
57
|
-
|
|
58
41
|
async renderCounter(resourceNumber) {
|
|
59
42
|
let htmlCounter;
|
|
60
|
-
|
|
61
43
|
try {
|
|
62
44
|
htmlCounter = await evalTemplateString(this.counterTemplate, {
|
|
63
45
|
counter: resourceNumber
|
|
@@ -66,10 +48,7 @@ const CounterMixin = {
|
|
|
66
48
|
console.error(new Error('error in counter-template'), e);
|
|
67
49
|
throw e;
|
|
68
50
|
}
|
|
69
|
-
|
|
70
|
-
return html(_templateObject(), unsafeHTML(htmlCounter));
|
|
51
|
+
return html`${unsafeHTML(htmlCounter)}`;
|
|
71
52
|
}
|
|
72
|
-
|
|
73
53
|
};
|
|
74
|
-
export { CounterMixin };
|
|
75
|
-
//# sourceMappingURL=counterMixin.js.map
|
|
54
|
+
export { CounterMixin };
|
|
@@ -5,11 +5,9 @@ const FederationMixin = {
|
|
|
5
5
|
initialState: {
|
|
6
6
|
containerFetched: null
|
|
7
7
|
},
|
|
8
|
-
|
|
9
8
|
attached() {
|
|
10
9
|
this.listPostProcessors.push(this.fetchSources.bind(this));
|
|
11
10
|
},
|
|
12
|
-
|
|
13
11
|
async fetchSources(resources, listPostProcessors, div, context) {
|
|
14
12
|
this.containerFetched = [];
|
|
15
13
|
let newResources = await this.getResources(resources);
|
|
@@ -18,22 +16,17 @@ const FederationMixin = {
|
|
|
18
16
|
const nextProcessor = listPostProcessors.shift();
|
|
19
17
|
if (nextProcessor) await nextProcessor(newResources, listPostProcessors, div, context);
|
|
20
18
|
},
|
|
21
|
-
|
|
22
19
|
async getResources(resources) {
|
|
23
20
|
const newResources = [];
|
|
24
|
-
|
|
25
21
|
const getChildResources = async res => {
|
|
26
22
|
if (!res) return;
|
|
27
|
-
|
|
28
|
-
if (res.isContainer()) {
|
|
23
|
+
if (res.isContainer?.()) {
|
|
29
24
|
// if this is a container
|
|
30
25
|
const containerId = res['@id'];
|
|
31
|
-
|
|
32
26
|
if (!this.containerFetched.includes(containerId)) {
|
|
33
27
|
// prevent from including twice the same source
|
|
34
28
|
this.containerFetched.push(containerId);
|
|
35
29
|
const resourcesFetched = await this.fetchSource(containerId); // fetch the resources of this container
|
|
36
|
-
|
|
37
30
|
if (resourcesFetched) newResources.push(...(await this.getResources(resourcesFetched))); // Add content of source to array...
|
|
38
31
|
}
|
|
39
32
|
} else {
|
|
@@ -44,20 +37,15 @@ const FederationMixin = {
|
|
|
44
37
|
await Promise.all(resources.map(res => getChildResources(res)));
|
|
45
38
|
return newResources;
|
|
46
39
|
},
|
|
47
|
-
|
|
48
40
|
async fetchSource(containerId) {
|
|
49
41
|
const cachedContainer = store.get(containerId); // find container in cache
|
|
50
|
-
|
|
51
42
|
if (!cachedContainer || cachedContainer['ldp:contains'] === null) {
|
|
52
43
|
// if container not fetched
|
|
53
44
|
store.clearCache(containerId); // empty cache
|
|
54
45
|
}
|
|
55
46
|
|
|
56
47
|
const container = await store.getData(containerId, this.context); // and fetch it
|
|
57
|
-
|
|
58
48
|
return container ? container['ldp:contains'] : null;
|
|
59
49
|
}
|
|
60
|
-
|
|
61
50
|
};
|
|
62
|
-
export { FederationMixin };
|
|
63
|
-
//# sourceMappingURL=federationMixin.js.map
|
|
51
|
+
export { FederationMixin };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { searchInResources } from '../libs/filter.js';
|
|
2
2
|
const FilterMixin = {
|
|
3
3
|
name: 'filter-mixin',
|
|
4
4
|
use: [],
|
|
@@ -13,7 +13,6 @@ const FilterMixin = {
|
|
|
13
13
|
filteredBy: {
|
|
14
14
|
type: String,
|
|
15
15
|
default: null,
|
|
16
|
-
|
|
17
16
|
callback(newValue) {
|
|
18
17
|
// if we change search form, re-populate
|
|
19
18
|
if (newValue && this.searchForm && newValue !== this.searchForm.getAttribute('id')) {
|
|
@@ -22,174 +21,135 @@ const FilterMixin = {
|
|
|
22
21
|
this.populate();
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
|
-
|
|
24
|
+
},
|
|
25
|
+
filteredOn: {
|
|
26
|
+
type: String,
|
|
27
|
+
// 'server' | 'client'
|
|
28
|
+
default: 'client'
|
|
26
29
|
}
|
|
27
30
|
},
|
|
28
|
-
|
|
29
31
|
created() {
|
|
30
32
|
this.searchCount = new Map();
|
|
31
33
|
this.element.addEventListener('populate', () => {
|
|
32
|
-
var _this$searchForm;
|
|
33
|
-
|
|
34
34
|
if (!window.document.contains(this.element)) return;
|
|
35
|
-
|
|
35
|
+
this.searchForm?.component.updateAutoRanges();
|
|
36
36
|
});
|
|
37
37
|
},
|
|
38
|
-
|
|
39
38
|
attached() {
|
|
40
|
-
this.
|
|
39
|
+
const filteredBy = this.filteredBy;
|
|
40
|
+
if (this.isFilteredOnServer() && filteredBy) {
|
|
41
|
+
this.searchForm = document.getElementById(filteredBy);
|
|
42
|
+
if (!this.searchForm) throw `#${filteredBy} is not in DOM`;
|
|
43
|
+
// this.searchForm.component.attach(this); // is it necessary?
|
|
44
|
+
this.searchForm.addEventListener('formChange', () => this.onServerSearchChange());
|
|
45
|
+
} else {
|
|
46
|
+
this.listPostProcessors.push(this.filterCallback.bind(this));
|
|
47
|
+
}
|
|
41
48
|
},
|
|
42
|
-
|
|
43
49
|
get filters() {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return (_this$searchForm$comp = (_this$searchForm2 = this.searchForm) === null || _this$searchForm2 === void 0 ? void 0 : _this$searchForm2.component.value) !== null && _this$searchForm$comp !== void 0 ? _this$searchForm$comp : {};
|
|
50
|
+
return this.searchForm?.component?.value ?? {};
|
|
47
51
|
},
|
|
48
|
-
|
|
49
52
|
set filters(filters) {
|
|
50
|
-
this.searchForm
|
|
51
|
-
|
|
53
|
+
if (this.searchForm?.component?.value) {
|
|
54
|
+
this.searchForm.component.value = filters;
|
|
55
|
+
this.filterList();
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
isFilteredOnServer() {
|
|
59
|
+
return this.filteredOn === 'server' && !!this.fetchData;
|
|
60
|
+
},
|
|
61
|
+
async onServerSearchChange() {
|
|
62
|
+
await this.fetchData(this.dataSrc);
|
|
63
|
+
this.empty();
|
|
64
|
+
await this.populate();
|
|
65
|
+
},
|
|
66
|
+
getDynamicServerSearch() {
|
|
67
|
+
const filters = this.filters;
|
|
68
|
+
if (this.isFilteredOnServer() && filters) {
|
|
69
|
+
const fields = Object.keys(filters);
|
|
70
|
+
const value = Object.values(filters).map(_ref => {
|
|
71
|
+
let {
|
|
72
|
+
value
|
|
73
|
+
} = _ref;
|
|
74
|
+
return value;
|
|
75
|
+
}).filter(value => !!value).join(' ').trim();
|
|
76
|
+
if (fields.length > 0 && value) {
|
|
77
|
+
return {
|
|
78
|
+
fields,
|
|
79
|
+
value
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return;
|
|
52
84
|
},
|
|
53
|
-
|
|
54
85
|
async filterCallback(resources, listPostProcessors, div, context) {
|
|
55
86
|
if (this.filteredBy || this.searchFields) {
|
|
56
87
|
if (!this.searchCount.has(context)) this.searchCount.set(context, 1);
|
|
57
88
|
if (!this.searchForm) await this.createFilter(context);
|
|
58
|
-
const filteredResources = await
|
|
89
|
+
const filteredResources = await searchInResources(resources, this.filters, this.fields, this.searchForm);
|
|
59
90
|
resources = resources.filter((_v, index) => filteredResources[index]);
|
|
60
91
|
}
|
|
61
|
-
|
|
62
92
|
const nextProcessor = listPostProcessors.shift();
|
|
63
93
|
if (nextProcessor) await nextProcessor(resources, listPostProcessors, div, context + (this.searchCount.get(context) || ''));
|
|
64
94
|
},
|
|
65
|
-
|
|
66
95
|
async filterList(context) {
|
|
67
96
|
this.searchCount.set(context, this.searchCount.get(context) + 1);
|
|
68
97
|
if (!this.resource) return;
|
|
69
98
|
this.empty();
|
|
70
99
|
await this.populate();
|
|
71
100
|
},
|
|
72
|
-
|
|
73
|
-
async matchValue(subject, query) {
|
|
74
|
-
var _subject$isContainer;
|
|
75
|
-
|
|
76
|
-
if (subject == null && query.value === '') return true; // filter not set and subject not existing -> ignore filter
|
|
77
|
-
|
|
78
|
-
if (subject == null) return false; // property does not exist on resource
|
|
79
|
-
// Filter on a container
|
|
80
|
-
|
|
81
|
-
if (query.list) {
|
|
82
|
-
if (query.value.length === 0) return true;
|
|
83
|
-
|
|
84
|
-
for (const v of query.value) {
|
|
85
|
-
const q = {
|
|
86
|
-
type: query.type,
|
|
87
|
-
value: v
|
|
88
|
-
};
|
|
89
|
-
if (await this.matchValue(subject, q)) return true;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if ((_subject$isContainer = subject.isContainer) !== null && _subject$isContainer !== void 0 && _subject$isContainer.call(subject)) {
|
|
96
|
-
let ret = Promise.resolve(query.value === ''); // if no query, return a match
|
|
97
|
-
|
|
98
|
-
for (const value of subject['ldp:contains']) {
|
|
99
|
-
ret = (await ret) || (await this.matchValue(value, query));
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return ret;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return compare[query.type](subject, query.value);
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
async matchFilter(resource, filter, query) {
|
|
109
|
-
let fields = [];
|
|
110
|
-
if (this.isSet(filter)) fields = this.getSet(filter);else if (this.isSearchField(filter)) fields = this.getSearchField(filter); // search on 1 field
|
|
111
|
-
|
|
112
|
-
if (fields.length == 0) return this.matchValue(await resource[filter], query); // search on multiple fields
|
|
113
|
-
|
|
114
|
-
return fields.reduce( // return true if it matches at least one of the fields
|
|
115
|
-
async (initial, field) => (await initial) || (await this.matchFilter(resource, field, query)), Promise.resolve(false));
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
async matchFilters(resource) {
|
|
119
|
-
//return true if all filters values are contained in the corresponding field of the resource
|
|
120
|
-
return Object.keys(this.filters).reduce(async (initial, filter) => (await initial) && (await this.matchFilter(resource, filter, this.filters[filter])), Promise.resolve(true));
|
|
121
|
-
},
|
|
122
|
-
|
|
123
101
|
async getValuesOfField(field) {
|
|
124
102
|
const arrayOfDataObjects = this.resource['ldp:contains'];
|
|
125
103
|
const arrayOfDataIds = [];
|
|
126
|
-
|
|
127
104
|
for (const obj of arrayOfDataObjects) {
|
|
128
105
|
// for each element, if it's an object, catch all elements in 'ldp:contains' key
|
|
129
106
|
const nextArrayOfObjects = await obj[field];
|
|
130
107
|
if (!nextArrayOfObjects) continue;
|
|
131
|
-
|
|
132
108
|
if (typeof nextArrayOfObjects !== "object") {
|
|
133
|
-
console.warn(
|
|
109
|
+
console.warn(`The format value of ${field} is not suitable with auto-range-[field] attribute`);
|
|
134
110
|
continue;
|
|
135
111
|
}
|
|
136
|
-
|
|
137
112
|
const nextArrayOfIds = nextArrayOfObjects['ldp:contains'];
|
|
138
|
-
|
|
139
113
|
for (const obj of nextArrayOfIds) {
|
|
140
114
|
// catch each element id
|
|
141
115
|
arrayOfDataIds.push(obj['@id']);
|
|
142
116
|
}
|
|
143
|
-
|
|
144
117
|
if (nextArrayOfObjects['@type'] !== 'ldp:Container') {
|
|
145
118
|
// if no element in 'ldp:contains', catch object id
|
|
146
119
|
arrayOfDataIds.push(nextArrayOfObjects['@id']);
|
|
147
120
|
}
|
|
148
121
|
}
|
|
149
|
-
|
|
150
122
|
return arrayOfDataIds;
|
|
151
123
|
},
|
|
152
|
-
|
|
153
124
|
async createFilter(context) {
|
|
154
125
|
const filteredBy = this.filteredBy;
|
|
155
|
-
|
|
156
126
|
if (filteredBy != null) {
|
|
157
127
|
this.searchForm = document.getElementById(filteredBy);
|
|
158
|
-
if (!this.searchForm) throw
|
|
128
|
+
if (!this.searchForm) throw `#${filteredBy} is not in DOM`;
|
|
159
129
|
} else {
|
|
160
|
-
this.searchForm = document.createElement(
|
|
130
|
+
this.searchForm = document.createElement(`solid-form-search`);
|
|
161
131
|
}
|
|
162
|
-
|
|
163
132
|
this.searchForm.component.attach(this);
|
|
164
133
|
this.searchForm.addEventListener('formChange', () => {
|
|
165
134
|
this.filterList(context);
|
|
166
135
|
});
|
|
167
136
|
this.searchForm.toggleAttribute('naked', true);
|
|
168
|
-
if (filteredBy) return;
|
|
137
|
+
if (filteredBy) return;
|
|
169
138
|
|
|
139
|
+
//pass attributes to search form
|
|
170
140
|
const searchAttributes = Array.from(this.element.attributes).filter(attr => attr['name'].startsWith('search-')).map(attr => ({
|
|
171
141
|
name: attr['name'].replace('search-', ''),
|
|
172
142
|
value: attr['value']
|
|
173
143
|
}));
|
|
174
|
-
searchAttributes.forEach(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
144
|
+
searchAttributes.forEach(_ref2 => {
|
|
145
|
+
let {
|
|
146
|
+
name,
|
|
147
|
+
value
|
|
148
|
+
} = _ref2;
|
|
178
149
|
this.searchForm.setAttribute(name, value);
|
|
179
150
|
});
|
|
180
151
|
this.element.insertBefore(this.searchForm, this.element.firstChild);
|
|
181
152
|
await this.searchForm.component.populate();
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
// Search fields
|
|
185
|
-
isSearchField(field) {
|
|
186
|
-
return this.searchForm.hasAttribute('search-' + field);
|
|
187
|
-
},
|
|
188
|
-
|
|
189
|
-
getSearchField(field) {
|
|
190
|
-
return parseFieldsString(this.searchForm.getAttribute('search-' + field));
|
|
191
153
|
}
|
|
192
|
-
|
|
193
154
|
};
|
|
194
|
-
export { FilterMixin };
|
|
195
|
-
//# sourceMappingURL=filterMixin.js.map
|
|
155
|
+
export { FilterMixin };
|
|
@@ -15,66 +15,59 @@ const GrouperMixin = {
|
|
|
15
15
|
default: ''
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
-
|
|
19
18
|
attached() {
|
|
20
19
|
this.listPostProcessors.push(this.groupResources.bind(this));
|
|
21
20
|
},
|
|
22
|
-
|
|
23
21
|
async groupResources(resources, listPostProcessors, div, context) {
|
|
24
22
|
const nextProcessor = listPostProcessors.shift();
|
|
25
|
-
|
|
26
23
|
if (this.groupBy) {
|
|
27
24
|
let groups = {};
|
|
28
|
-
|
|
29
25
|
for (let resource of resources) {
|
|
30
26
|
const valueGroup = await resource[this.groupBy];
|
|
31
27
|
if (valueGroup == null) continue;
|
|
32
28
|
if (!groups[valueGroup]) groups[valueGroup] = {
|
|
33
29
|
resources: []
|
|
34
30
|
}; // if no group yet, we create one...
|
|
35
|
-
|
|
36
31
|
groups[valueGroup].resources.push(resource); // ...and push corresponding resource into it
|
|
37
|
-
}
|
|
38
|
-
|
|
32
|
+
}
|
|
39
33
|
|
|
34
|
+
// For each group, get group widget and call next processors
|
|
40
35
|
const parents = Object.keys(groups).map(g => ({
|
|
41
36
|
group: g,
|
|
42
37
|
parent: this.renderGroup(g, div)
|
|
43
38
|
}));
|
|
44
|
-
|
|
45
39
|
for (let {
|
|
46
40
|
group,
|
|
47
41
|
parent
|
|
48
42
|
} of parents) {
|
|
49
|
-
if (nextProcessor) await nextProcessor(groups[group].resources,
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
if (nextProcessor) await nextProcessor(groups[group].resources,
|
|
44
|
+
// give only resources from group
|
|
45
|
+
[...listPostProcessors],
|
|
46
|
+
// copy post processors
|
|
47
|
+
parent,
|
|
48
|
+
// parent is group widget
|
|
52
49
|
context + "_" + group);
|
|
53
50
|
}
|
|
54
51
|
} else {
|
|
55
52
|
if (nextProcessor) await nextProcessor(resources, listPostProcessors, div, context);
|
|
56
53
|
}
|
|
57
54
|
},
|
|
58
|
-
|
|
59
55
|
/**
|
|
60
56
|
* Create a group widget or find if it already exists
|
|
61
57
|
* @param groupName
|
|
62
58
|
*/
|
|
63
59
|
renderGroup(groupName, div) {
|
|
64
|
-
let groupElt = this.element.querySelector(
|
|
65
|
-
|
|
60
|
+
let groupElt = this.element.querySelector(`${this.groupWidget}[value="${groupName}"]`);
|
|
66
61
|
if (!groupElt) {
|
|
67
62
|
groupElt = document.createElement(this.groupWidget);
|
|
68
63
|
groupElt.setAttribute('value', groupName);
|
|
69
64
|
if (this.groupClass) groupElt.setAttribute('class', this.groupClass);
|
|
70
65
|
if (groupElt.component) groupElt.component.render(); // Force the rendering of the widget
|
|
71
|
-
|
|
72
66
|
div.appendChild(groupElt); // and append it to the parent div
|
|
73
67
|
}
|
|
74
68
|
|
|
75
69
|
return groupElt.querySelector('[data-content]') || groupElt; // return the node where to insert content
|
|
76
70
|
}
|
|
77
|
-
|
|
78
71
|
};
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
|
|
73
|
+
export { GrouperMixin };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
const HighlighterMixin = {
|
|
2
2
|
name: 'highlighter-mixin',
|
|
3
3
|
use: [],
|
|
4
|
-
|
|
5
4
|
attached() {
|
|
6
5
|
this.listPostProcessors.push(this.hightlightCallback.bind(this));
|
|
7
6
|
},
|
|
8
|
-
|
|
9
7
|
async hightlightCallback(resources, listPostProcessors, div, context) {
|
|
10
8
|
for (let attr of this.element.attributes) {
|
|
11
9
|
if (attr.name.startsWith('highlight-')) {
|
|
@@ -14,10 +12,9 @@ const HighlighterMixin = {
|
|
|
14
12
|
sortingKey: await resource[field],
|
|
15
13
|
// fetch sorting value
|
|
16
14
|
proxy: resource // and keep proxy
|
|
17
|
-
|
|
18
15
|
})));
|
|
19
|
-
resources = this.sortHighlighted(resources, "sortingKey", attr.value); // highlight element
|
|
20
16
|
|
|
17
|
+
resources = this.sortHighlighted(resources, "sortingKey", attr.value); // highlight element
|
|
21
18
|
resources = resources.map(resource => resource.proxy); // and re-transform in arra of resources
|
|
22
19
|
}
|
|
23
20
|
}
|
|
@@ -25,7 +22,6 @@ const HighlighterMixin = {
|
|
|
25
22
|
const nextProcessor = listPostProcessors.shift();
|
|
26
23
|
if (nextProcessor) await nextProcessor(resources, listPostProcessors, div, context);
|
|
27
24
|
},
|
|
28
|
-
|
|
29
25
|
sortHighlighted(resources, field, value) {
|
|
30
26
|
for (let [index, res] of resources.entries()) {
|
|
31
27
|
if (res[field] && res[field] == value) {
|
|
@@ -36,7 +32,5 @@ const HighlighterMixin = {
|
|
|
36
32
|
|
|
37
33
|
return resources;
|
|
38
34
|
}
|
|
39
|
-
|
|
40
35
|
};
|
|
41
|
-
export { HighlighterMixin };
|
|
42
|
-
//# sourceMappingURL=highlighterMixin.js.map
|
|
36
|
+
export { HighlighterMixin };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
export let WidgetType
|
|
2
|
-
|
|
3
|
-
(function (WidgetType) {
|
|
1
|
+
export let WidgetType = /*#__PURE__*/function (WidgetType) {
|
|
4
2
|
WidgetType["CUSTOM"] = "custom";
|
|
5
3
|
WidgetType["USER"] = "user";
|
|
6
4
|
WidgetType["NATIVE"] = "native";
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
return WidgetType;
|
|
6
|
+
}({});
|