@startinblox/core 0.17.30 → 0.18.0-beta.1
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/import-map.json +1 -0
- 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 +68 -0
- package/dist/_snowpack/pkg/markdown-it-link-attributes.js.map +1 -0
- 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 +212 -227
- 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 +10 -8
- 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 +9 -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.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 TranslationMixin = {
|
|
|
5
5
|
initialState: {
|
|
6
6
|
translationData: {}
|
|
7
7
|
},
|
|
8
|
-
|
|
9
8
|
created() {
|
|
10
9
|
this.getLang();
|
|
11
10
|
},
|
|
12
|
-
|
|
13
11
|
/**
|
|
14
12
|
* Returns the translation module
|
|
15
13
|
* @param langCode - string: language needed in 2 char
|
|
@@ -21,33 +19,27 @@ const TranslationMixin = {
|
|
|
21
19
|
en: () => import("../locales/en.json.proxy.js"),
|
|
22
20
|
fr: () => import("../locales/fr.json.proxy.js")
|
|
23
21
|
};
|
|
24
|
-
|
|
25
22
|
if (!translationsModules[langCode]) {
|
|
26
23
|
// set default to EN if the file does not exist
|
|
27
|
-
console.warn(
|
|
24
|
+
console.warn(`${langCode}.json translation file may not exist, English is setted by default`);
|
|
28
25
|
langCode = 'en';
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
const module = await translationsModules[langCode]();
|
|
32
28
|
return module.default;
|
|
33
29
|
},
|
|
34
|
-
|
|
35
30
|
/**
|
|
36
31
|
* Loads the right translation file and reload the component
|
|
37
32
|
*/
|
|
38
33
|
getLang() {
|
|
39
34
|
const languageStorage = store._getLanguage();
|
|
40
|
-
|
|
41
35
|
if (languageStorage) {
|
|
42
36
|
if (window.fetchTranslationPromise === undefined) {
|
|
43
37
|
// if translation data are not already fetched
|
|
44
38
|
window.fetchTranslationPromise = this.getTranslationModule(languageStorage);
|
|
45
39
|
}
|
|
46
|
-
|
|
47
40
|
window.fetchTranslationPromise.then(res => {
|
|
48
41
|
if (res) {
|
|
49
42
|
this.translationData = res; // stock data in object passed to traduction method below
|
|
50
|
-
|
|
51
43
|
this.update(); // update the rendering in components and widgets
|
|
52
44
|
}
|
|
53
45
|
});
|
|
@@ -62,7 +54,5 @@ const TranslationMixin = {
|
|
|
62
54
|
t(tradKey) {
|
|
63
55
|
return this.translationData[tradKey] || '';
|
|
64
56
|
}
|
|
65
|
-
|
|
66
57
|
};
|
|
67
|
-
export { TranslationMixin };
|
|
68
|
-
//# sourceMappingURL=translationMixin.js.map
|
|
58
|
+
export { TranslationMixin };
|
|
@@ -1,35 +1,3 @@
|
|
|
1
|
-
function _templateObject3() {
|
|
2
|
-
const data = _taggedTemplateLiteral(["\n <p>", "</p>\n "]);
|
|
3
|
-
|
|
4
|
-
_templateObject3 = function () {
|
|
5
|
-
return data;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
return data;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function _templateObject2() {
|
|
12
|
-
const data = _taggedTemplateLiteral(["\n <", " value=", "></", ">\n "]);
|
|
13
|
-
|
|
14
|
-
_templateObject2 = function () {
|
|
15
|
-
return data;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
return data;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function _templateObject() {
|
|
22
|
-
const data = _taggedTemplateLiteral(["\n <dialog id=\"", "\">\n ", "\n <div>\n <button\n @click=", " \n class=", "\n >\n ", "\n </button>\n <button\n @click=", "\n class=", "\n >\n ", "\n </button>\n </div>\n </dialog>\n "]);
|
|
23
|
-
|
|
24
|
-
_templateObject = function () {
|
|
25
|
-
return data;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
return data;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
32
|
-
|
|
33
1
|
import dialogPolyfill from '../_snowpack/pkg/dialog-polyfill.js';
|
|
34
2
|
import { html } from '../_snowpack/pkg/lit-html.js';
|
|
35
3
|
import { ifDefined } from '../_snowpack/pkg/lit-html/directives/if-defined.js';
|
|
@@ -69,28 +37,24 @@ const ValidationMixin = {
|
|
|
69
37
|
default: undefined
|
|
70
38
|
}
|
|
71
39
|
},
|
|
72
|
-
|
|
73
40
|
created() {
|
|
74
41
|
this.dialogID = uniqID();
|
|
75
42
|
},
|
|
76
|
-
|
|
77
43
|
showModal() {
|
|
78
44
|
var dialog = document.getElementById(this.dialogID);
|
|
79
45
|
dialogPolyfill.registerDialog(dialog);
|
|
80
46
|
return dialog.showModal();
|
|
81
47
|
},
|
|
82
|
-
|
|
83
48
|
performAction() {
|
|
84
49
|
// Console warning if conf-type attr not filled AND conf-message filled
|
|
85
|
-
if (this.element.hasAttribute('confirmation-message') && !this.confirmationType) console.warn('confirmation-type attribute is missing.');
|
|
86
|
-
|
|
87
|
-
if (!this.confirmationType || this.confirmationType == "confirm" && confirm(this.confirmationMessage || this.t("validation.message"))) this.validateModal();
|
|
88
|
-
|
|
50
|
+
if (this.element.hasAttribute('confirmation-message') && !this.confirmationType) console.warn('confirmation-type attribute is missing.');
|
|
51
|
+
// Data directly submitted OR confirm dialog modal displayed
|
|
52
|
+
if (!this.confirmationType || this.confirmationType == "confirm" && confirm(this.confirmationMessage || this.t("validation.message"))) this.validateModal();
|
|
53
|
+
// Customisable dialog modal opened
|
|
89
54
|
if (this.confirmationType == "dialog") {
|
|
90
55
|
this.showModal();
|
|
91
56
|
}
|
|
92
57
|
},
|
|
93
|
-
|
|
94
58
|
getModalDialog() {
|
|
95
59
|
if (this.confirmationType == 'dialog') {
|
|
96
60
|
const quitDialog = () => {
|
|
@@ -98,16 +62,34 @@ const ValidationMixin = {
|
|
|
98
62
|
if (dialog == null) return;
|
|
99
63
|
dialog.close();
|
|
100
64
|
};
|
|
101
|
-
|
|
102
65
|
const confirmChoice = () => {
|
|
103
66
|
this.validateModal();
|
|
104
67
|
quitDialog();
|
|
105
68
|
};
|
|
106
|
-
|
|
107
|
-
|
|
69
|
+
return html`
|
|
70
|
+
<dialog id="${this.dialogID}">
|
|
71
|
+
${this.confirmationWidget ? preHTML`
|
|
72
|
+
<${this.confirmationWidget} value=${this.resourceId}></${this.confirmationWidget}>
|
|
73
|
+
` : html`
|
|
74
|
+
<p>${this.confirmationMessage || this.t("validation.message")}</p>
|
|
75
|
+
`}
|
|
76
|
+
<div>
|
|
77
|
+
<button
|
|
78
|
+
@click=${confirmChoice}
|
|
79
|
+
class=${ifDefined(this.confirmationSubmitClass)}
|
|
80
|
+
>
|
|
81
|
+
${this.confirmationSubmitText || this.t("validation.submit-text")}
|
|
82
|
+
</button>
|
|
83
|
+
<button
|
|
84
|
+
@click=${quitDialog}
|
|
85
|
+
class=${ifDefined(this.confirmationCancelClass)}
|
|
86
|
+
>
|
|
87
|
+
${this.confirmationCancelText || this.t("validation.cancel-text")}
|
|
88
|
+
</button>
|
|
89
|
+
</div>
|
|
90
|
+
</dialog>
|
|
91
|
+
`;
|
|
108
92
|
} else return '';
|
|
109
93
|
}
|
|
110
|
-
|
|
111
94
|
};
|
|
112
|
-
export { ValidationMixin };
|
|
113
|
-
//# sourceMappingURL=validationMixin.js.map
|
|
95
|
+
export { ValidationMixin };
|
|
@@ -1,65 +1,3 @@
|
|
|
1
|
-
function _templateObject6() {
|
|
2
|
-
const data = _taggedTemplateLiteral(["\n <span>", "</span>\n "]);
|
|
3
|
-
|
|
4
|
-
_templateObject6 = function () {
|
|
5
|
-
return data;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
return data;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function _templateObject5() {
|
|
12
|
-
const data = _taggedTemplateLiteral(["", ""]);
|
|
13
|
-
|
|
14
|
-
_templateObject5 = function () {
|
|
15
|
-
return data;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
return data;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function _templateObject4() {
|
|
22
|
-
const data = _taggedTemplateLiteral(["<", " ...=", "></", ">"]);
|
|
23
|
-
|
|
24
|
-
_templateObject4 = function () {
|
|
25
|
-
return data;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
return data;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function _templateObject3() {
|
|
32
|
-
const data = _taggedTemplateLiteral(["<", " ...=", "></", ">"]);
|
|
33
|
-
|
|
34
|
-
_templateObject3 = function () {
|
|
35
|
-
return data;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
return data;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function _templateObject2() {
|
|
42
|
-
const data = _taggedTemplateLiteral(["\n <", "\n name=\"", "\"\n class=\"", "\"\n >", "</", ">\n "]);
|
|
43
|
-
|
|
44
|
-
_templateObject2 = function () {
|
|
45
|
-
return data;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
return data;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function _templateObject() {
|
|
52
|
-
const data = _taggedTemplateLiteral([""]);
|
|
53
|
-
|
|
54
|
-
_templateObject = function () {
|
|
55
|
-
return data;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
return data;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
62
|
-
|
|
63
1
|
import { spread, preHTML } from '../libs/lit-helpers.js';
|
|
64
2
|
import { parseFieldsString, findClosingBracketMatchIndex } from '../libs/helpers.js';
|
|
65
3
|
import { newWidgetFactory } from '../new-widgets/new-widget-factory.js';
|
|
@@ -79,34 +17,27 @@ const WidgetMixin = {
|
|
|
79
17
|
nameWidgets: null,
|
|
80
18
|
_div: null
|
|
81
19
|
},
|
|
82
|
-
|
|
83
20
|
created() {
|
|
84
21
|
this.nameWidgets = [];
|
|
85
22
|
},
|
|
86
|
-
|
|
87
23
|
attached() {
|
|
88
24
|
if (!this.dataSrc && !this.resource && this.noRender === null) this.populate();
|
|
89
25
|
},
|
|
90
|
-
|
|
91
26
|
get parentElement() {
|
|
92
27
|
return 'div';
|
|
93
28
|
},
|
|
94
|
-
|
|
95
29
|
get div() {
|
|
96
30
|
if (this._div) return this._div;
|
|
97
31
|
this._div = document.createElement(this.parentElement);
|
|
98
32
|
this.element.appendChild(this._div);
|
|
99
33
|
return this._div;
|
|
100
34
|
},
|
|
101
|
-
|
|
102
35
|
set div(value) {
|
|
103
36
|
this._div = value;
|
|
104
37
|
},
|
|
105
|
-
|
|
106
38
|
get widgets() {
|
|
107
|
-
return this.nameWidgets.map(name => this.element.querySelector(
|
|
39
|
+
return this.nameWidgets.map(name => this.element.querySelector(`[name="${name}"]`));
|
|
108
40
|
},
|
|
109
|
-
|
|
110
41
|
/**
|
|
111
42
|
* Return field list of the component
|
|
112
43
|
*/
|
|
@@ -116,26 +47,21 @@ const WidgetMixin = {
|
|
|
116
47
|
if (attr === '') return [];
|
|
117
48
|
if (attr) return parseFieldsString(attr);
|
|
118
49
|
let resource = this.resource;
|
|
119
|
-
|
|
120
|
-
if (resource && resource.isContainer()) {
|
|
50
|
+
if (resource && resource.isContainer?.()) {
|
|
121
51
|
// If container, keep the 1rst resource
|
|
122
52
|
for (let res of resource['ldp:contains']) {
|
|
123
53
|
resource = res;
|
|
124
54
|
break;
|
|
125
55
|
}
|
|
126
56
|
}
|
|
127
|
-
|
|
128
57
|
if (!this.dataSrc) console.error(new Error('You must provide a "fields" attribute'));
|
|
129
58
|
if (!resource) return [];
|
|
130
59
|
let fields = [];
|
|
131
|
-
|
|
132
60
|
for (const prop of resource.properties) {
|
|
133
61
|
if (!prop.startsWith('@') && !(prop === "permissions") && (await resource[prop])) fields.push(prop);
|
|
134
62
|
}
|
|
135
|
-
|
|
136
63
|
return fields;
|
|
137
64
|
},
|
|
138
|
-
|
|
139
65
|
/**
|
|
140
66
|
* return attribute if "field" is an action
|
|
141
67
|
* @param field - string
|
|
@@ -144,7 +70,6 @@ const WidgetMixin = {
|
|
|
144
70
|
const action = this.element.getAttribute('action-' + field);
|
|
145
71
|
return action;
|
|
146
72
|
},
|
|
147
|
-
|
|
148
73
|
/**
|
|
149
74
|
* return true if "field" is editable
|
|
150
75
|
* @param field - string
|
|
@@ -152,15 +77,13 @@ const WidgetMixin = {
|
|
|
152
77
|
editable(field) {
|
|
153
78
|
return this.element.hasAttribute('editable-' + field);
|
|
154
79
|
},
|
|
155
|
-
|
|
156
80
|
/**
|
|
157
81
|
* Return regexp to check if "field" is a set
|
|
158
82
|
* @param field - string
|
|
159
83
|
*/
|
|
160
84
|
getSetRegexp(field) {
|
|
161
|
-
return new RegExp(
|
|
85
|
+
return new RegExp(`(^|\\,|\\(|\\s)\\s*${field}\\s*\\(`, 'g');
|
|
162
86
|
},
|
|
163
|
-
|
|
164
87
|
/**
|
|
165
88
|
* Return fields contained in set "field"
|
|
166
89
|
* @param field - string
|
|
@@ -173,7 +96,6 @@ const WidgetMixin = {
|
|
|
173
96
|
const set = this.fields.substring(firstSetBracket + 1, lastSetBracket);
|
|
174
97
|
return parseFieldsString(set);
|
|
175
98
|
},
|
|
176
|
-
|
|
177
99
|
/**
|
|
178
100
|
* Return true if "field" is a set
|
|
179
101
|
* @param field - string
|
|
@@ -183,51 +105,44 @@ const WidgetMixin = {
|
|
|
183
105
|
let foundSets = this.fields.match(this.getSetRegexp(field));
|
|
184
106
|
return foundSets ? foundSets.length > 0 : false;
|
|
185
107
|
},
|
|
186
|
-
|
|
187
108
|
isString(field) {
|
|
188
109
|
return field.startsWith('\'') || field.startsWith('\"');
|
|
189
110
|
},
|
|
190
|
-
|
|
191
111
|
/**
|
|
192
112
|
* Return the value of "resource" for predicate "field"
|
|
193
113
|
* @param field - string
|
|
194
114
|
* @param resource - Resource
|
|
195
115
|
*/
|
|
196
116
|
async fetchValue(field, resource) {
|
|
197
|
-
return resource && !resource.isContainer() ? await resource[field] : undefined;
|
|
117
|
+
return resource && !resource.isContainer?.() ? await resource[field] : undefined;
|
|
198
118
|
},
|
|
199
|
-
|
|
200
119
|
/**
|
|
201
120
|
* Return the value of the field
|
|
202
121
|
* @param field - field
|
|
203
122
|
*/
|
|
204
123
|
async getValue(field, resource) {
|
|
205
124
|
const escapedField = this.getEscapedField(field);
|
|
206
|
-
|
|
207
125
|
if (this.getAction(escapedField)) {
|
|
208
126
|
return this.getAction(escapedField);
|
|
209
127
|
}
|
|
210
|
-
|
|
211
128
|
if (this.element.hasAttribute('value-' + field)) {
|
|
212
129
|
return this.element.getAttribute('value-' + field);
|
|
213
130
|
}
|
|
131
|
+
let resourceValue = await this.fetchValue(field, resource);
|
|
214
132
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
133
|
+
// Empty value
|
|
134
|
+
if (resourceValue === undefined || resourceValue === '' || resourceValue === null)
|
|
135
|
+
// If null or empty, return field default value
|
|
218
136
|
return this.element.hasAttribute('default-' + field) ? this.element.getAttribute('default-' + field) : '';
|
|
219
137
|
return resourceValue;
|
|
220
138
|
},
|
|
221
|
-
|
|
222
139
|
empty() {},
|
|
223
|
-
|
|
224
140
|
/**
|
|
225
141
|
* Return a widget from a tagName, and create it if necessary
|
|
226
142
|
* @param tagName - string
|
|
227
143
|
*/
|
|
228
144
|
widgetFromTagName(tagName) {
|
|
229
145
|
let type = tagName.startsWith('solid') ? WidgetType.CUSTOM : WidgetType.USER;
|
|
230
|
-
|
|
231
146
|
if (!customElements.get(tagName)) {
|
|
232
147
|
// component does not exist
|
|
233
148
|
if (tagName.startsWith('solid')) newWidgetFactory(tagName); // solid- -> create it
|
|
@@ -245,13 +160,13 @@ const WidgetMixin = {
|
|
|
245
160
|
* @param field - string
|
|
246
161
|
* @param isSet - boolean
|
|
247
162
|
*/
|
|
248
|
-
getWidget(field
|
|
163
|
+
getWidget(field) {
|
|
164
|
+
let isSet = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
249
165
|
const widget = this.element.getAttribute('widget-' + field);
|
|
250
166
|
if (widget) return this.widgetFromTagName(widget);
|
|
251
167
|
if (this.getAction(field)) return this.widgetFromTagName('solid-action');
|
|
252
168
|
return !isSet ? this.widgetFromTagName(this.defaultWidget) : this.widgetFromTagName(this.defaultSetWidget);
|
|
253
169
|
},
|
|
254
|
-
|
|
255
170
|
/**
|
|
256
171
|
* Return multiple widget if "field" is a multiple, false if it's not
|
|
257
172
|
* @param field - string
|
|
@@ -262,7 +177,6 @@ const WidgetMixin = {
|
|
|
262
177
|
const widget = this.element.getAttribute(attribute) || this.defaultMultipleWidget;
|
|
263
178
|
return this.widgetFromTagName(widget);
|
|
264
179
|
},
|
|
265
|
-
|
|
266
180
|
/**
|
|
267
181
|
* If attribute "lookForAttr" is set on element, add "attrKey" to the "attributes" list
|
|
268
182
|
* @param lookForAttr - string
|
|
@@ -274,7 +188,6 @@ const WidgetMixin = {
|
|
|
274
188
|
if (attribute == null) return;
|
|
275
189
|
attributes[setAttrKey] = attribute;
|
|
276
190
|
},
|
|
277
|
-
|
|
278
191
|
/**
|
|
279
192
|
* Return all the attributes of widget "field"
|
|
280
193
|
* @param field - string
|
|
@@ -284,81 +197,81 @@ const WidgetMixin = {
|
|
|
284
197
|
const attrs = {
|
|
285
198
|
name: field
|
|
286
199
|
};
|
|
287
|
-
const escapedField = this.getEscapedField(field);
|
|
288
|
-
|
|
289
|
-
const multipleAttributes = ['fields', 'label', 'widget', 'add-label', 'remove-label', 'next', 'empty-widget'];
|
|
290
|
-
|
|
291
|
-
for (let attr of multipleAttributes) this.addToAttributes("multiple-".concat(escapedField, "-").concat(attr), attr, attrs); // transfer all [attr]-[field] attributes as [attr] attribute for widget [field]
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
const defaultAttributes = ['range', 'enum', 'label', 'placeholder', 'class',,
|
|
295
|
-
/* 'widget', */
|
|
296
|
-
'required', 'editable', 'autocomplete', 'upload-url', 'option-label', 'option-value', 'order-by', // deprecated. Remove in 0.15
|
|
297
|
-
'each-label', 'order-asc', 'order-desc', 'min', 'max', 'pattern', 'title', 'start-value', 'end-value', 'alt', 'step', 'maxlength', 'minlength', 'search-text', 'search-placeholder'];
|
|
298
|
-
|
|
299
|
-
for (let attr of defaultAttributes) this.addToAttributes("".concat(attr, "-").concat(escapedField), attr, attrs);
|
|
200
|
+
const escapedField = this.getEscapedField(field);
|
|
300
201
|
|
|
301
|
-
|
|
202
|
+
// transfer all multiple-[field]-[attr] attributes as [attr] for multiple widget [field]
|
|
203
|
+
const multipleAttributes = ['fields', 'label', 'widget', 'add-label', 'remove-label', 'next', 'empty-widget', 'add-class', 'remove-class'];
|
|
204
|
+
for (let attr of multipleAttributes) this.addToAttributes(`multiple-${escapedField}-${attr}`, attr, attrs);
|
|
302
205
|
|
|
303
|
-
|
|
206
|
+
// transfer all [attr]-[field] attributes as [attr] attribute for widget [field]
|
|
207
|
+
const defaultAttributes = ['range', 'enum', 'label', 'placeholder', 'class',
|
|
304
208
|
|
|
209
|
+
/* 'widget', */
|
|
210
|
+
, 'required', 'editable', 'autocomplete', 'upload-url', 'option-label', 'option-value', 'order-by',
|
|
211
|
+
// deprecated. Remove in 0.15
|
|
212
|
+
'each-label', 'order-asc', 'order-desc', 'min', 'max', 'pattern', 'title', 'start-value', 'end-value', 'alt', 'step', 'maxlength', 'minlength', 'search-text', 'search-placeholder', 'link-text'];
|
|
213
|
+
for (let attr of defaultAttributes) this.addToAttributes(`${attr}-${escapedField}`, attr, attrs);
|
|
214
|
+
const addableAttributes = Array.from(this.element.attributes).filter(a => a.name.startsWith(`addable-${escapedField}`));
|
|
215
|
+
for (let attr of addableAttributes) this.addToAttributes(attr.name, attr.name.replace(`addable-${escapedField}`, 'addable'), attrs);
|
|
305
216
|
const resourceId = resource ? resource['@id'] : null;
|
|
306
217
|
if (this.multiple(escapedField)) attrs['widget'] = this.getWidget(escapedField).tagName;
|
|
307
218
|
if (this.getAction(escapedField) && resourceId) attrs['src'] = this.element.getAttribute('src-' + escapedField) || resourceId;
|
|
308
219
|
if (this.editable(escapedField) && resourceId) attrs['value-id'] = resourceId;
|
|
309
220
|
return attrs;
|
|
310
221
|
},
|
|
311
|
-
|
|
312
222
|
/**
|
|
313
223
|
* Creates and return a widget for field + add it to the widget list
|
|
314
224
|
* @param field - string
|
|
315
225
|
*/
|
|
316
|
-
async createWidgetTemplate(field
|
|
226
|
+
async createWidgetTemplate(field) {
|
|
227
|
+
let resource = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
228
|
+
let transformAttributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
317
229
|
if (this.isString(field)) return this.createString(field); // field is a static string
|
|
318
|
-
|
|
319
230
|
if (this.isSet(field)) return await this.createSet(field);
|
|
320
231
|
const currentResource = resource || this.resource;
|
|
321
232
|
let attributes = this.widgetAttributes(field, currentResource);
|
|
322
233
|
const escapedField = this.getEscapedField(field);
|
|
323
234
|
const widgetMeta = this.multiple(escapedField) || this.getWidget(escapedField);
|
|
324
235
|
let tagName = widgetMeta.tagName;
|
|
325
|
-
let widgetTemplate = html
|
|
236
|
+
let widgetTemplate = html``;
|
|
326
237
|
|
|
238
|
+
// Set attributes
|
|
327
239
|
let value = await this.getValue(field, currentResource);
|
|
328
|
-
|
|
329
240
|
if (widgetMeta.type === WidgetType.NATIVE) {
|
|
330
241
|
// native widget (ie: h1)
|
|
331
|
-
widgetTemplate = preHTML
|
|
242
|
+
widgetTemplate = preHTML`
|
|
243
|
+
<${tagName}
|
|
244
|
+
name="${ifDefined(attributes.name)}"
|
|
245
|
+
class="${ifDefined(attributes.class)}"
|
|
246
|
+
>${value}</${tagName}>
|
|
247
|
+
`;
|
|
332
248
|
} else {
|
|
333
249
|
// custom widget (ie: solid-display-value)
|
|
334
250
|
// Check if value is defined, and if the default widget is needed
|
|
335
251
|
if ((value === null || value === '') && this.element.hasAttribute('default-widget-' + field)) {
|
|
336
252
|
tagName = this.element.getAttribute('default-widget-' + field);
|
|
337
|
-
}
|
|
253
|
+
}
|
|
254
|
+
// Set attributes to the widget
|
|
338
255
|
// setAttribute set a string. Make sure null values are empty
|
|
339
|
-
|
|
340
|
-
|
|
341
256
|
if (value === null || value === undefined) attributes.value = '';
|
|
342
|
-
|
|
343
257
|
if (widgetMeta.type === WidgetType.USER && value['@id']) {
|
|
344
258
|
// if value is a resource and solid-widget used, set data-src
|
|
345
259
|
attributes['data-src'] = value['@id'];
|
|
346
260
|
} else {
|
|
347
261
|
// otherwise, set value attribute
|
|
348
262
|
attributes['value'] = value;
|
|
349
|
-
}
|
|
350
|
-
|
|
263
|
+
}
|
|
351
264
|
|
|
352
|
-
|
|
265
|
+
// Subscribe widgets if they show a resource
|
|
266
|
+
if (value && value['@id']) attributes['auto-subscribe'] = value['@id'];
|
|
353
267
|
|
|
268
|
+
// Transform store://XXX attributes
|
|
354
269
|
if (transformAttributes) attributes = await this.transformAttributes(attributes, currentResource);
|
|
355
|
-
widgetTemplate = preHTML
|
|
270
|
+
widgetTemplate = preHTML`<${tagName} ...=${spread(attributes)}></${tagName}>`;
|
|
356
271
|
}
|
|
357
|
-
|
|
358
272
|
this.nameWidgets.push(field);
|
|
359
273
|
return widgetTemplate;
|
|
360
274
|
},
|
|
361
|
-
|
|
362
275
|
defineAttribute(widget, attribute, value) {
|
|
363
276
|
if (widget.getAttribute(attribute) !== value) {
|
|
364
277
|
// if attribute is different than previous one
|
|
@@ -371,37 +284,32 @@ const WidgetMixin = {
|
|
|
371
284
|
* @param field - string
|
|
372
285
|
*/
|
|
373
286
|
async createSet(field) {
|
|
374
|
-
const setWidget = this.getWidget(field, true);
|
|
287
|
+
const setWidget = this.getWidget(field, true);
|
|
375
288
|
|
|
289
|
+
// Get set attributes
|
|
376
290
|
const attrs = {
|
|
377
291
|
name: field
|
|
378
292
|
};
|
|
379
293
|
const setAttributes = ['class', 'label'];
|
|
294
|
+
for (let attr of setAttributes) this.addToAttributes(`${attr}-${field}`, attr, attrs);
|
|
380
295
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
let widget = this.element.querySelector("".concat(setWidget.tagName, "[name=\"").concat(field, "\"]"));
|
|
296
|
+
// Create widget if not already existing
|
|
297
|
+
let widget = this.element.querySelector(`${setWidget.tagName}[name="${field}"]`);
|
|
385
298
|
let initializing = false; // used to render widget only first time
|
|
386
|
-
|
|
387
299
|
if (!widget) {
|
|
388
300
|
widget = document.createElement(setWidget.tagName);
|
|
389
301
|
initializing = true;
|
|
390
302
|
}
|
|
391
|
-
|
|
392
303
|
for (let name of Object.keys(attrs)) {
|
|
393
304
|
this.defineAttribute(widget, name, attrs[name], setWidget.type);
|
|
394
305
|
}
|
|
395
|
-
|
|
396
306
|
if (widget.component && initializing) widget.component.render();
|
|
397
|
-
let setFields = this.getSet(field);
|
|
398
|
-
|
|
307
|
+
let setFields = this.getSet(field);
|
|
308
|
+
// Catch widget for the set if all these fields are empty
|
|
399
309
|
if (this.element.hasAttribute('empty-' + field)) {
|
|
400
310
|
let hasOnlyEmpty = true;
|
|
401
|
-
|
|
402
311
|
for (let field of setFields) {
|
|
403
312
|
let value = await this.getValue(field, this.resource);
|
|
404
|
-
|
|
405
313
|
if (value !== '') {
|
|
406
314
|
// if one not empty
|
|
407
315
|
hasOnlyEmpty = false;
|
|
@@ -410,30 +318,28 @@ const WidgetMixin = {
|
|
|
410
318
|
}
|
|
411
319
|
|
|
412
320
|
;
|
|
413
|
-
|
|
414
321
|
if (hasOnlyEmpty) {
|
|
415
322
|
// if only empty values, return empty-widget
|
|
416
323
|
const attributes = this.widgetAttributes(field, this.resource);
|
|
417
|
-
const tagName = this.element.getAttribute(
|
|
418
|
-
const valueSet = this.element.getAttribute(
|
|
324
|
+
const tagName = this.element.getAttribute(`empty-${field}`);
|
|
325
|
+
const valueSet = this.element.getAttribute(`empty-${field}-value`);
|
|
419
326
|
if (valueSet) attributes.value = valueSet;
|
|
420
|
-
return preHTML
|
|
327
|
+
return preHTML`<${tagName} ...=${spread(attributes)}></${tagName}>`;
|
|
421
328
|
}
|
|
422
|
-
|
|
423
329
|
;
|
|
424
|
-
}
|
|
425
|
-
|
|
330
|
+
}
|
|
426
331
|
|
|
332
|
+
// Render template
|
|
427
333
|
const widgetsTemplate = await Promise.all(setFields.map(field => this.createWidgetTemplate(field)));
|
|
428
|
-
const template = html
|
|
334
|
+
const template = html`${widgetsTemplate}`;
|
|
429
335
|
render(template, widget.querySelector('[data-content]') || widget);
|
|
430
336
|
return widget;
|
|
431
337
|
},
|
|
432
|
-
|
|
433
338
|
createString(value) {
|
|
434
|
-
return html
|
|
339
|
+
return html`
|
|
340
|
+
<span>${value.slice(1, -1).replace(/\\(['"])/g, '$1')}</span>
|
|
341
|
+
`;
|
|
435
342
|
},
|
|
436
|
-
|
|
437
343
|
/**
|
|
438
344
|
* Returns field name without starting "@"
|
|
439
345
|
* @param field
|
|
@@ -441,7 +347,5 @@ const WidgetMixin = {
|
|
|
441
347
|
getEscapedField(field) {
|
|
442
348
|
return field.startsWith('@') ? field.slice(1, field.length) : field;
|
|
443
349
|
}
|
|
444
|
-
|
|
445
350
|
};
|
|
446
|
-
export { WidgetMixin };
|
|
447
|
-
//# sourceMappingURL=widgetMixin.js.map
|
|
351
|
+
export { WidgetMixin };
|
|
@@ -16,5 +16,4 @@ const attributeDirectory = {
|
|
|
16
16
|
bool: BooleanMixin,
|
|
17
17
|
num: NumberMixin
|
|
18
18
|
};
|
|
19
|
-
export { attributeDirectory, MultipleMixin, ActionMixin, BlankMixin, MailtoMixin, TelMixin, PlaceholderMixin };
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
19
|
+
export { attributeDirectory, MultipleMixin, ActionMixin, BlankMixin, MailtoMixin, TelMixin, PlaceholderMixin };
|