@startinblox/core 0.19.0-beta.1 → 0.19.0-beta.3
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/leaflet.markercluster/dist/MarkerCluster.css → assets/MarkerCluster-614dea0a.css} +0 -0
- package/dist/{_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css → assets/MarkerCluster.Default-61258232.css} +0 -0
- package/dist/assets/en-e53105c5.js +14 -0
- package/dist/assets/en-e53105c5.js.map +1 -0
- package/dist/assets/fr-a7fcdb64.js +14 -0
- package/dist/assets/fr-a7fcdb64.js.map +1 -0
- package/dist/{_snowpack/pkg/fusejs.js → assets/helpers-bf15809c.js} +398 -454
- package/dist/assets/helpers-bf15809c.js.map +1 -0
- package/dist/{_snowpack/pkg/leaflet/dist/leaflet.css → assets/leaflet-3c081932.css} +3 -3
- package/dist/helpers.js +18 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.js +54523 -48
- package/dist/index.js.map +1 -0
- package/package.json +7 -22
- package/dist/_snowpack/pkg/autolinker.js +0 -4429
- package/dist/_snowpack/pkg/autolinker.js.map +0 -1
- package/dist/_snowpack/pkg/common/_baseUnary-d2677655.js +0 -353
- package/dist/_snowpack/pkg/common/_baseUnary-d2677655.js.map +0 -1
- package/dist/_snowpack/pkg/common/_commonjsHelpers-0597c316.js +0 -26
- package/dist/_snowpack/pkg/common/_commonjsHelpers-0597c316.js.map +0 -1
- package/dist/_snowpack/pkg/common/decode-26fbf385.js +0 -185
- package/dist/_snowpack/pkg/common/decode-26fbf385.js.map +0 -1
- package/dist/_snowpack/pkg/common/lit-html-3647afce.js +0 -1104
- package/dist/_snowpack/pkg/common/lit-html-3647afce.js.map +0 -1
- package/dist/_snowpack/pkg/delta-markdown-for-quill.js +0 -26198
- package/dist/_snowpack/pkg/delta-markdown-for-quill.js.map +0 -1
- package/dist/_snowpack/pkg/dialog-polyfill.js +0 -826
- package/dist/_snowpack/pkg/dialog-polyfill.js.map +0 -1
- package/dist/_snowpack/pkg/fusejs.js.map +0 -1
- package/dist/_snowpack/pkg/import-map.json +0 -25
- package/dist/_snowpack/pkg/jsonld-context-parser.js +0 -836
- package/dist/_snowpack/pkg/jsonld-context-parser.js.map +0 -1
- package/dist/_snowpack/pkg/jsonld.js +0 -11760
- package/dist/_snowpack/pkg/jsonld.js.map +0 -1
- package/dist/_snowpack/pkg/leaflet/dist/leaflet.css.proxy.js +0 -10
- package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css.proxy.js +0 -10
- package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css.proxy.js +0 -10
- package/dist/_snowpack/pkg/lit-html/directives/if-defined.js +0 -39
- package/dist/_snowpack/pkg/lit-html/directives/if-defined.js.map +0 -1
- package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js +0 -48
- package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js.map +0 -1
- package/dist/_snowpack/pkg/lit-html/directives/until.js +0 -87
- package/dist/_snowpack/pkg/lit-html/directives/until.js.map +0 -1
- package/dist/_snowpack/pkg/lit-html.js +0 -94
- package/dist/_snowpack/pkg/lit-html.js.map +0 -1
- package/dist/_snowpack/pkg/markdown-it-link-attributes.js +0 -68
- package/dist/_snowpack/pkg/markdown-it-link-attributes.js.map +0 -1
- package/dist/_snowpack/pkg/markdown-it.js +0 -11307
- package/dist/_snowpack/pkg/markdown-it.js.map +0 -1
- package/dist/_snowpack/pkg/quill/dist/quill.snow.css.proxy.js +0 -10
- package/dist/_snowpack/pkg/quill-delta-to-markdown.js +0 -971
- package/dist/_snowpack/pkg/quill-delta-to-markdown.js.map +0 -1
- package/dist/_snowpack/pkg/quill.js +0 -14441
- package/dist/_snowpack/pkg/quill.js.map +0 -1
- package/dist/_snowpack/pkg/slim-select.js +0 -714
- package/dist/_snowpack/pkg/slim-select.js.map +0 -1
- package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css +0 -1149
- package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css.proxy.js +0 -10
- package/dist/_snowpack/pkg/tui-calendar.js +0 -46503
- package/dist/_snowpack/pkg/tui-calendar.js.map +0 -1
- package/dist/components/solid-ac-checker.js +0 -45
- package/dist/components/solid-calendar.js +0 -66
- package/dist/components/solid-delete.js +0 -96
- package/dist/components/solid-display.js +0 -150
- package/dist/components/solid-form-search.js +0 -173
- package/dist/components/solid-form.js +0 -257
- package/dist/components/solid-lang.js +0 -35
- package/dist/components/solid-map.js +0 -204
- package/dist/components/solid-table.js +0 -181
- package/dist/components/solid-widget.js +0 -72
- package/dist/import.css +0 -4
- package/dist/libs/Component.js +0 -13
- package/dist/libs/ComponentFactory.js +0 -165
- package/dist/libs/Compositor.js +0 -96
- package/dist/libs/Sib.js +0 -44
- package/dist/libs/filter.js +0 -184
- package/dist/libs/helpers.js +0 -185
- package/dist/libs/interfaces.js +0 -6
- package/dist/libs/lit-helpers.js +0 -139
- package/dist/libs/polyfills.js +0 -35
- package/dist/libs/store/custom-getter.js +0 -344
- package/dist/libs/store/server-pagination.js +0 -19
- package/dist/libs/store/server-search.js +0 -32
- package/dist/libs/store/store.js +0 -560
- package/dist/locales/en.json +0 -10
- package/dist/locales/en.json.proxy.js +0 -2
- package/dist/locales/fr.json +0 -10
- package/dist/locales/fr.json.proxy.js +0 -2
- package/dist/mixins/attributeBinderMixin.js +0 -113
- package/dist/mixins/contextMixin.js +0 -26
- package/dist/mixins/counterMixin.js +0 -54
- package/dist/mixins/federationMixin.js +0 -57
- package/dist/mixins/filterMixin.js +0 -152
- package/dist/mixins/grouperMixin.js +0 -73
- package/dist/mixins/highlighterMixin.js +0 -36
- package/dist/mixins/interfaces.js +0 -6
- package/dist/mixins/listMixin.js +0 -116
- package/dist/mixins/nextMixin.js +0 -23
- package/dist/mixins/paginateMixin.js +0 -97
- package/dist/mixins/requiredMixin.js +0 -38
- package/dist/mixins/serverPaginationMixin.js +0 -122
- package/dist/mixins/sorterMixin.js +0 -131
- package/dist/mixins/storeMixin.js +0 -139
- package/dist/mixins/translationMixin.js +0 -58
- package/dist/mixins/validationMixin.js +0 -95
- package/dist/mixins/widgetMixin.js +0 -358
- package/dist/new-widgets/attributeMixins/actionMixin.js +0 -13
- package/dist/new-widgets/attributeMixins/blankMixin.js +0 -7
- package/dist/new-widgets/attributeMixins/booleanMixin.js +0 -7
- package/dist/new-widgets/attributeMixins/index.js +0 -19
- package/dist/new-widgets/attributeMixins/mailtoMixin.js +0 -7
- package/dist/new-widgets/attributeMixins/multipleMixin.js +0 -27
- package/dist/new-widgets/attributeMixins/numberMixin.js +0 -7
- package/dist/new-widgets/attributeMixins/placeholderMixin.js +0 -16
- package/dist/new-widgets/attributeMixins/telMixin.js +0 -7
- package/dist/new-widgets/baseWidgetMixin.js +0 -109
- package/dist/new-widgets/callbackMixins/autocompletionMixin.js +0 -96
- package/dist/new-widgets/callbackMixins/index.js +0 -7
- package/dist/new-widgets/callbackMixins/richtextMixin.js +0 -37
- package/dist/new-widgets/callbackMixins/slimselect.css.proxy.js +0 -10
- package/dist/new-widgets/interfaces.js +0 -1
- package/dist/new-widgets/new-widget-factory.js +0 -91
- package/dist/new-widgets/templateAdditionMixins/addableMixin.js +0 -26
- package/dist/new-widgets/templateAdditionMixins/index.js +0 -13
- package/dist/new-widgets/templateAdditionMixins/labelLastMixin.js +0 -16
- package/dist/new-widgets/templateAdditionMixins/labelMixin.js +0 -18
- package/dist/new-widgets/templates/defaultTemplatesDirectory.js +0 -29
- package/dist/new-widgets/templates/displayTemplatesDirectory.js +0 -54
- package/dist/new-widgets/templates/formTemplatesDirectory.js +0 -423
- package/dist/new-widgets/templates/groupTemplatesDirectory.js +0 -11
- package/dist/new-widgets/templates/index.js +0 -6
- package/dist/new-widgets/templates/setTemplatesDirectory.js +0 -16
- package/dist/new-widgets/templatesDependencies/altMixin.js +0 -12
- package/dist/new-widgets/templatesDependencies/editableMixin.js +0 -60
- package/dist/new-widgets/templatesDependencies/filterRangeFormMixin.js +0 -34
- package/dist/new-widgets/templatesDependencies/formCheckboxMixin.js +0 -10
- package/dist/new-widgets/templatesDependencies/formCheckboxesMixin.js +0 -41
- package/dist/new-widgets/templatesDependencies/formDropdownMixin.js +0 -59
- package/dist/new-widgets/templatesDependencies/formFileMixin.js +0 -82
- package/dist/new-widgets/templatesDependencies/formLengthMixin.js +0 -18
- package/dist/new-widgets/templatesDependencies/formMinMaxMixin.js +0 -18
- package/dist/new-widgets/templatesDependencies/formMixin.js +0 -56
- package/dist/new-widgets/templatesDependencies/formNumberMixin.js +0 -10
- package/dist/new-widgets/templatesDependencies/formRadioMixin.js +0 -12
- package/dist/new-widgets/templatesDependencies/formStepMixin.js +0 -12
- package/dist/new-widgets/templatesDependencies/linkTextMixin.js +0 -13
- package/dist/new-widgets/templatesDependencies/multipleFormMixin.js +0 -116
- package/dist/new-widgets/templatesDependencies/multipleselectFormMixin.js +0 -74
- package/dist/new-widgets/templatesDependencies/patternMixin.js +0 -18
- package/dist/new-widgets/templatesDependencies/rangeMixin.js +0 -100
- package/dist/new-widgets/templatesDependencies/setMixin.js +0 -9
- package/dist/new-widgets/templatesDependencies/valueRichtextMixin.js +0 -9
- package/dist/new-widgets/valueTransformationMixins/autolinkMixin.js +0 -14
- package/dist/new-widgets/valueTransformationMixins/dateMixin.js +0 -29
- package/dist/new-widgets/valueTransformationMixins/dateTimeMixin.js +0 -12
- package/dist/new-widgets/valueTransformationMixins/index.js +0 -15
- package/dist/new-widgets/valueTransformationMixins/markdownMixin.js +0 -30
- package/dist/new-widgets/valueTransformationMixins/multilineMixin.js +0 -13
- package/dist/new-widgets/valueTransformationMixins/oembedMixin.js +0 -21
- package/dist/solid-template-element.js +0 -144
- package/dist/style/default-theme.css.proxy.js +0 -10
- package/dist/widgets/baseWidget.js +0 -267
- package/dist/widgets/widget-factory.js +0 -20
- /package/dist/{style/default-theme.css → assets/default-theme-d0f20a8a.css} +0 -0
- /package/dist/{_snowpack/pkg/quill/dist/quill.snow.css → assets/quill.snow-8f222e44.css} +0 -0
- /package/dist/{new-widgets/callbackMixins/slimselect.css → assets/slimselect-43e3ebc8.css} +0 -0
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { store } from "../../libs/store/store.js";
|
|
2
|
-
const FormFileMixin = {
|
|
3
|
-
name: 'form-file-mixin',
|
|
4
|
-
attributes: {
|
|
5
|
-
uploadUrl: {
|
|
6
|
-
type: String,
|
|
7
|
-
default: ''
|
|
8
|
-
}
|
|
9
|
-
},
|
|
10
|
-
initialState: {
|
|
11
|
-
initialValue: ''
|
|
12
|
-
},
|
|
13
|
-
created() {
|
|
14
|
-
this.listAttributes['output'] = '';
|
|
15
|
-
this.listAttributes['resetButtonHidden'] = true;
|
|
16
|
-
this.listAttributes['selectFile'] = this.selectFile.bind(this);
|
|
17
|
-
this.listAttributes['resetFile'] = this.resetFile.bind(this);
|
|
18
|
-
},
|
|
19
|
-
attached() {
|
|
20
|
-
document.addEventListener('reset', e => {
|
|
21
|
-
if (e.target && e.target.contains(this.element)) {
|
|
22
|
-
this.value = this.initialValue;
|
|
23
|
-
this.listAttributes['resetButtonHidden'] = true;
|
|
24
|
-
this.planRender();
|
|
25
|
-
const dataHolder = this.element.querySelector('input[data-holder]');
|
|
26
|
-
dataHolder.value = this.value;
|
|
27
|
-
dataHolder.dispatchEvent(new Event('change'));
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
},
|
|
31
|
-
selectFile() {
|
|
32
|
-
if (this.uploadUrl === null) return;
|
|
33
|
-
if (this.initialValue === '') {
|
|
34
|
-
this.initialValue = this.value;
|
|
35
|
-
}
|
|
36
|
-
const filePicker = this.element.querySelector('input[type="file"]');
|
|
37
|
-
if (filePicker.files.length < 1) return;
|
|
38
|
-
const dataHolder = this.element.querySelector('input[data-holder]');
|
|
39
|
-
this.listAttributes['output'] = '⏳';
|
|
40
|
-
this.planRender();
|
|
41
|
-
const file = filePicker.files[0];
|
|
42
|
-
const formData = new FormData();
|
|
43
|
-
formData.append('file', file);
|
|
44
|
-
store.fetchAuthn(this.uploadUrl, {
|
|
45
|
-
method: 'POST',
|
|
46
|
-
body: formData
|
|
47
|
-
}).then(response => this.updateFile(dataHolder, response)).catch(error => {
|
|
48
|
-
this.listAttributes['fileValue'] = '';
|
|
49
|
-
this.listAttributes['output'] = 'upload error';
|
|
50
|
-
this.planRender();
|
|
51
|
-
console.error(error);
|
|
52
|
-
});
|
|
53
|
-
},
|
|
54
|
-
updateFile(dataHolder, response) {
|
|
55
|
-
const location = response.headers.get('location');
|
|
56
|
-
if (location == null) {
|
|
57
|
-
this.listAttributes['output'] = 'header location not found!';
|
|
58
|
-
} else {
|
|
59
|
-
this.value = location;
|
|
60
|
-
this.listAttributes['output'] = '';
|
|
61
|
-
this.listAttributes['resetButtonHidden'] = false;
|
|
62
|
-
dataHolder.value = location;
|
|
63
|
-
dataHolder.dispatchEvent(new Event('change'));
|
|
64
|
-
this.planRender();
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
resetFile(event) {
|
|
68
|
-
event.preventDefault();
|
|
69
|
-
this.value = '';
|
|
70
|
-
const filePicker = this.element.querySelector('input[type="file"]');
|
|
71
|
-
const dataHolder = this.element.querySelector('input[data-holder]');
|
|
72
|
-
if (filePicker && dataHolder) {
|
|
73
|
-
filePicker.value = dataHolder.value = '';
|
|
74
|
-
}
|
|
75
|
-
this.listAttributes['fileValue'] = '';
|
|
76
|
-
this.listAttributes['output'] = '';
|
|
77
|
-
this.listAttributes['resetButtonHidden'] = true;
|
|
78
|
-
dataHolder.dispatchEvent(new Event('change'));
|
|
79
|
-
this.planRender();
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
export { FormFileMixin };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const FormLengthMixin = {
|
|
2
|
-
name: 'form-length-mixin',
|
|
3
|
-
attributes: {
|
|
4
|
-
maxlength: {
|
|
5
|
-
type: Number,
|
|
6
|
-
callback: function (newValue) {
|
|
7
|
-
this.addToAttributes(newValue, 'maxlength');
|
|
8
|
-
}
|
|
9
|
-
},
|
|
10
|
-
minlength: {
|
|
11
|
-
type: Number,
|
|
12
|
-
callback: function (newValue) {
|
|
13
|
-
this.addToAttributes(newValue, 'minlength');
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
export { FormLengthMixin };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const FormMinMaxMixin = {
|
|
2
|
-
name: 'form-min-max-mixin',
|
|
3
|
-
attributes: {
|
|
4
|
-
min: {
|
|
5
|
-
type: Number,
|
|
6
|
-
callback: function (newValue) {
|
|
7
|
-
this.addToAttributes(newValue, 'min');
|
|
8
|
-
}
|
|
9
|
-
},
|
|
10
|
-
max: {
|
|
11
|
-
type: Number,
|
|
12
|
-
callback: function (newValue) {
|
|
13
|
-
this.addToAttributes(newValue, 'max');
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
export { FormMinMaxMixin };
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
const FormMixin = {
|
|
2
|
-
name: 'form-mixin',
|
|
3
|
-
attributes: {
|
|
4
|
-
required: {
|
|
5
|
-
type: Boolean,
|
|
6
|
-
default: false,
|
|
7
|
-
callback: function () {
|
|
8
|
-
this.listAttributes['required'] = true;
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
autocomplete: {
|
|
12
|
-
type: String,
|
|
13
|
-
default: '',
|
|
14
|
-
callback: function (value) {
|
|
15
|
-
this.addToAttributes(value, "autocomplete");
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
attached() {
|
|
20
|
-
this.listAttributes['onChange'] = this.onChange.bind(this);
|
|
21
|
-
},
|
|
22
|
-
onChange(e) {
|
|
23
|
-
e.preventDefault();
|
|
24
|
-
e.stopPropagation();
|
|
25
|
-
this.element.dispatchEvent(new Event('change', {
|
|
26
|
-
bubbles: true
|
|
27
|
-
}));
|
|
28
|
-
},
|
|
29
|
-
getValue() {
|
|
30
|
-
if (!this.dataHolder || this.dataHolder.length === 0) return this.value;
|
|
31
|
-
if (this.dataHolder.length > 1) this.showDataHolderError(1, this.dataHolder.length);
|
|
32
|
-
return this.getValueFromElement(this.dataHolder[0]);
|
|
33
|
-
},
|
|
34
|
-
get type() {
|
|
35
|
-
return 'string';
|
|
36
|
-
},
|
|
37
|
-
get multiple() {
|
|
38
|
-
return false;
|
|
39
|
-
},
|
|
40
|
-
get dataHolder() {
|
|
41
|
-
const dataHolders = Array.from(this.element.querySelectorAll('[data-holder]'));
|
|
42
|
-
const widgetDataHolders = dataHolders.filter(element => {
|
|
43
|
-
const dataHolderAncestor = element.parentElement ? element.parentElement.closest('[data-holder]') : null;
|
|
44
|
-
// get the dataHolder of the widget only if no dataHolder ancestor in the current widget
|
|
45
|
-
return dataHolderAncestor === this.element || !dataHolderAncestor || !this.element.contains(dataHolderAncestor);
|
|
46
|
-
});
|
|
47
|
-
return widgetDataHolders.length ? widgetDataHolders : null;
|
|
48
|
-
},
|
|
49
|
-
getValueFromElement(element) {
|
|
50
|
-
return element.component ? element.component.getValue() : element.value;
|
|
51
|
-
},
|
|
52
|
-
showDataHolderError(expected, found) {
|
|
53
|
-
console.warn(`Expected ${expected} data-holder element in ${this.element.tagName}. Found ${found}`);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
export { FormMixin };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { uniqID } from '../../libs/helpers.js';
|
|
2
|
-
const FormRadioMixin = {
|
|
3
|
-
name: 'form-radio-mixin',
|
|
4
|
-
created() {
|
|
5
|
-
this.listAttributes['id'] = uniqID();
|
|
6
|
-
},
|
|
7
|
-
getValue() {
|
|
8
|
-
const checkedElement = this.element.querySelector('input[type=radio]:checked');
|
|
9
|
-
return checkedElement ? checkedElement.value : '';
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
export { FormRadioMixin };
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { StoreMixin } from '../../mixins/storeMixin.js';
|
|
2
|
-
const MultipleFormMixin = {
|
|
3
|
-
name: 'multiple-form-mixin',
|
|
4
|
-
use: [StoreMixin],
|
|
5
|
-
attributes: {
|
|
6
|
-
widget: {
|
|
7
|
-
type: String,
|
|
8
|
-
default: 'solid-form-text'
|
|
9
|
-
},
|
|
10
|
-
addLabel: {
|
|
11
|
-
type: String,
|
|
12
|
-
default: '+',
|
|
13
|
-
callback: function (value) {
|
|
14
|
-
if (value !== this.listAttributes['addLabel']) this.listAttributes['addLabel'] = value;
|
|
15
|
-
this.planRender();
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
removeLabel: {
|
|
19
|
-
type: String,
|
|
20
|
-
default: '×',
|
|
21
|
-
callback: function (value) {
|
|
22
|
-
if (value !== this.listAttributes['removeLabel']) this.listAttributes['removeLabel'] = value;
|
|
23
|
-
this.planRender();
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
range: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: ''
|
|
29
|
-
},
|
|
30
|
-
addClass: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: undefined,
|
|
33
|
-
callback: function (value) {
|
|
34
|
-
if (value !== this.listAttributes['addClass']) this.listAttributes['addClass'] = value;
|
|
35
|
-
this.planRender();
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
removeClass: {
|
|
39
|
-
type: String,
|
|
40
|
-
default: undefined,
|
|
41
|
-
callback: function (value) {
|
|
42
|
-
if (value !== this.listAttributes['removeClass']) this.listAttributes['removeClass'] = value;
|
|
43
|
-
this.planRender();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
created() {
|
|
48
|
-
this.listValueTransformations.push(this.setDataSrc.bind(this));
|
|
49
|
-
this.listAttributes['children'] = [];
|
|
50
|
-
this.listAttributes['addLabel'] = this.addLabel;
|
|
51
|
-
this.listAttributes['removeLabel'] = this.removeLabel;
|
|
52
|
-
this.listAttributes['addClass'] = this.addClass;
|
|
53
|
-
this.listAttributes['removeClass'] = this.removeClass;
|
|
54
|
-
this.listAttributes['addItem'] = () => {
|
|
55
|
-
this.insertWidget();
|
|
56
|
-
this.planRender();
|
|
57
|
-
};
|
|
58
|
-
this.listAttributes['removeItem'] = index => {
|
|
59
|
-
this.element.querySelector(`[data-index="${this.name + index}"]`).remove();
|
|
60
|
-
this.element.dispatchEvent(new Event('change', {
|
|
61
|
-
bubbles: true
|
|
62
|
-
}));
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
setDataSrc(value, listValueTransformations) {
|
|
66
|
-
if (value && value !== this.dataSrc) this.dataSrc = value;
|
|
67
|
-
const nextProcessor = listValueTransformations.shift();
|
|
68
|
-
if (nextProcessor) nextProcessor(value, listValueTransformations);
|
|
69
|
-
},
|
|
70
|
-
populate() {
|
|
71
|
-
if (!this.resource || !this.resource['ldp:contains']) return;
|
|
72
|
-
this.listAttributes['children'] = []; // reset list
|
|
73
|
-
|
|
74
|
-
// set value in form
|
|
75
|
-
for (let resource of this.resource['ldp:contains']) {
|
|
76
|
-
// for each resource
|
|
77
|
-
this.insertWidget(resource['@id']); // create a widget
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
this.planRender();
|
|
81
|
-
},
|
|
82
|
-
insertWidget(value = '') {
|
|
83
|
-
if (!this.widget) return;
|
|
84
|
-
const widget = document.createElement(this.widget);
|
|
85
|
-
const attributes = {
|
|
86
|
-
'data-holder': true,
|
|
87
|
-
'name': this.name,
|
|
88
|
-
'value': value,
|
|
89
|
-
'range': this.range
|
|
90
|
-
};
|
|
91
|
-
for (let name of Object.keys(attributes)) {
|
|
92
|
-
if (typeof attributes[name] === "boolean") widget.toggleAttribute(name, attributes[name]);else widget.setAttribute(name, attributes[name]);
|
|
93
|
-
}
|
|
94
|
-
this.listAttributes['children'].push(widget);
|
|
95
|
-
},
|
|
96
|
-
empty() {
|
|
97
|
-
this.listAttributes['children'] = [];
|
|
98
|
-
this.planRender();
|
|
99
|
-
},
|
|
100
|
-
getValue() {
|
|
101
|
-
if (!this.dataHolder) return [];
|
|
102
|
-
// Was returning an array of functions, now returns an array of values.
|
|
103
|
-
// Not sure about the tests results in that context
|
|
104
|
-
return Array.from(this.dataHolder).map(element => {
|
|
105
|
-
let elValue = this.getValueFromElement(element);
|
|
106
|
-
return elValue;
|
|
107
|
-
});
|
|
108
|
-
},
|
|
109
|
-
get type() {
|
|
110
|
-
return 'resource';
|
|
111
|
-
},
|
|
112
|
-
get multiple() {
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
export { MultipleFormMixin };
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { StoreMixin } from '../../mixins/storeMixin.js';
|
|
2
|
-
const MultipleselectFormMixin = {
|
|
3
|
-
name: 'multipleselect-form-mixin',
|
|
4
|
-
use: [StoreMixin],
|
|
5
|
-
attributes: {
|
|
6
|
-
range: {
|
|
7
|
-
// range attribute is passed to the solid-dropdown
|
|
8
|
-
type: String,
|
|
9
|
-
default: '',
|
|
10
|
-
callback: function (value) {
|
|
11
|
-
if (value && value !== this.listAttributes['range']) this.listAttributes['range'] = value;
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
enum: {
|
|
15
|
-
// enum attribute is passed to the solid-dropdown
|
|
16
|
-
type: String,
|
|
17
|
-
default: '',
|
|
18
|
-
callback: function (value) {
|
|
19
|
-
if (value && value !== this.listAttributes['enum']) this.listAttributes['enum'] = value;
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
orderAsc: {
|
|
23
|
-
type: String,
|
|
24
|
-
default: 'name',
|
|
25
|
-
callback: function (newValue) {
|
|
26
|
-
this.addToAttributes(newValue, 'orderAsc');
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
orderDesc: {
|
|
30
|
-
type: String,
|
|
31
|
-
default: 'name',
|
|
32
|
-
callback: function (newValue) {
|
|
33
|
-
this.addToAttributes(newValue, 'orderDesc');
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
created() {
|
|
38
|
-
this.listValueTransformations.push(this.setDataSrc.bind(this));
|
|
39
|
-
},
|
|
40
|
-
setDataSrc(value, listValueTransformations) {
|
|
41
|
-
if (value && value !== this.dataSrc) {
|
|
42
|
-
try {
|
|
43
|
-
if (Array.isArray(JSON.parse(value))) {
|
|
44
|
-
this.setValue(JSON.parse(value));
|
|
45
|
-
}
|
|
46
|
-
} catch (ex) {
|
|
47
|
-
this.dataSrc = value;
|
|
48
|
-
console.log('Not an array', ex);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
const nextProcessor = listValueTransformations.shift();
|
|
52
|
-
if (nextProcessor) nextProcessor(value, listValueTransformations);
|
|
53
|
-
},
|
|
54
|
-
populate() {
|
|
55
|
-
if (!this.resource || !this.resource['ldp:contains'] && !Array.isArray(this.resource)) return;
|
|
56
|
-
this.setValue(this.resource['ldp:contains']);
|
|
57
|
-
this.planRender();
|
|
58
|
-
},
|
|
59
|
-
setValue(values) {
|
|
60
|
-
// set the values to the dropdown
|
|
61
|
-
this.listAttributes['values'] = JSON.stringify(values.map(r => r['@id']));
|
|
62
|
-
},
|
|
63
|
-
empty() {
|
|
64
|
-
this.listAttributes['values'] = [];
|
|
65
|
-
this.planRender();
|
|
66
|
-
},
|
|
67
|
-
get type() {
|
|
68
|
-
return this.enum === '' ? 'resource' : 'string';
|
|
69
|
-
},
|
|
70
|
-
get multiple() {
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
export { MultipleselectFormMixin };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const PatternMixin = {
|
|
2
|
-
name: 'pattern-mixin',
|
|
3
|
-
attributes: {
|
|
4
|
-
pattern: {
|
|
5
|
-
type: String,
|
|
6
|
-
callback: function (newValue) {
|
|
7
|
-
this.addToAttributes(newValue, 'pattern');
|
|
8
|
-
}
|
|
9
|
-
},
|
|
10
|
-
title: {
|
|
11
|
-
type: String,
|
|
12
|
-
callback: function (newValue) {
|
|
13
|
-
this.addToAttributes(newValue, 'title');
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
export { PatternMixin };
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { StoreMixin } from '../../mixins/storeMixin.js';
|
|
2
|
-
import { SorterMixin } from '../../mixins/sorterMixin.js';
|
|
3
|
-
import { FederationMixin } from '../../mixins/federationMixin.js';
|
|
4
|
-
const RangeMixin = {
|
|
5
|
-
name: 'range-mixin',
|
|
6
|
-
use: [StoreMixin, SorterMixin, FederationMixin],
|
|
7
|
-
attributes: {
|
|
8
|
-
range: {
|
|
9
|
-
type: String,
|
|
10
|
-
default: '',
|
|
11
|
-
callback: function (value) {
|
|
12
|
-
if (value !== this.dataSrc) this.dataSrc = value;
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
enum: {
|
|
16
|
-
type: String,
|
|
17
|
-
default: '',
|
|
18
|
-
callback: function (value) {
|
|
19
|
-
if (value !== null) {
|
|
20
|
-
const optional = value.trim().split(",");
|
|
21
|
-
let key;
|
|
22
|
-
let keyValue;
|
|
23
|
-
const list = {};
|
|
24
|
-
optional.forEach(element => {
|
|
25
|
-
if (element.includes("=")) {
|
|
26
|
-
const option = element.trim().split("=");
|
|
27
|
-
key = option[1].trim();
|
|
28
|
-
keyValue = option[0].trim();
|
|
29
|
-
list[key] = keyValue;
|
|
30
|
-
} else {
|
|
31
|
-
const elem = element.trim();
|
|
32
|
-
list[elem] = elem;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
this.addToAttributes(list, 'enum');
|
|
36
|
-
}
|
|
37
|
-
;
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
optionLabel: {
|
|
41
|
-
type: String,
|
|
42
|
-
default: 'name',
|
|
43
|
-
callback: function (newValue) {
|
|
44
|
-
this.addToAttributes(newValue, 'optionLabel');
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
optionValue: {
|
|
48
|
-
type: String,
|
|
49
|
-
default: '@id',
|
|
50
|
-
callback: function (newValue) {
|
|
51
|
-
this.addToAttributes(newValue, 'optionValue');
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
initialState: {
|
|
56
|
-
listPostProcessors: []
|
|
57
|
-
},
|
|
58
|
-
created() {
|
|
59
|
-
this.listPostProcessors = [];
|
|
60
|
-
this.listAttributes['optionLabel'] = this.optionLabel;
|
|
61
|
-
this.listAttributes['optionValue'] = this.optionValue;
|
|
62
|
-
},
|
|
63
|
-
async populate() {
|
|
64
|
-
const resources = this.resource ? this.resource['ldp:contains'] : [];
|
|
65
|
-
const listPostProcessors = [...this.listPostProcessors];
|
|
66
|
-
listPostProcessors.push(this.setRangeAttribute.bind(this));
|
|
67
|
-
const nextProcessor = listPostProcessors.shift();
|
|
68
|
-
await nextProcessor(resources, listPostProcessors, null, this.dataSrc);
|
|
69
|
-
},
|
|
70
|
-
async setRangeAttribute(resources) {
|
|
71
|
-
if (resources) {
|
|
72
|
-
// process resources to create the template
|
|
73
|
-
const getRangeValue = async resource => {
|
|
74
|
-
const selectedValue = await resource[this.optionValue]; // value used for selected options
|
|
75
|
-
const value = this.optionValue.includes('@id') || selectedValue['@id'] ?
|
|
76
|
-
// value of the option
|
|
77
|
-
`{"@id": "${selectedValue}"}` :
|
|
78
|
-
// resource
|
|
79
|
-
selectedValue; // literal
|
|
80
|
-
const label = await resource[this.optionLabel]; // label of the option
|
|
81
|
-
|
|
82
|
-
return {
|
|
83
|
-
value,
|
|
84
|
-
label,
|
|
85
|
-
selectedValue
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
this.listAttributes['range'] = await Promise.all(resources.filter(el => el !== null).map(r => getRangeValue(r)));
|
|
89
|
-
}
|
|
90
|
-
this.planRender();
|
|
91
|
-
},
|
|
92
|
-
empty() {
|
|
93
|
-
this.listAttributes['range'] = [];
|
|
94
|
-
this.planRender();
|
|
95
|
-
},
|
|
96
|
-
get type() {
|
|
97
|
-
return this.enum === '' ? 'resource' : 'string';
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
export { RangeMixin };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import qdtm from '../../_snowpack/pkg/quill-delta-to-markdown.js';
|
|
2
|
-
const ValueRichtextMixin = {
|
|
3
|
-
name: 'valuerichtext-mixin',
|
|
4
|
-
getValue() {
|
|
5
|
-
const markdown = qdtm.deltaToMarkdown(this.quill.getContents().ops);
|
|
6
|
-
return markdown;
|
|
7
|
-
}
|
|
8
|
-
};
|
|
9
|
-
export { ValueRichtextMixin };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Autolinker } from '../../_snowpack/pkg/autolinker.js';
|
|
2
|
-
const AutolinkMixin = {
|
|
3
|
-
name: 'autolink-mixin',
|
|
4
|
-
created() {
|
|
5
|
-
this.listValueTransformations.push(this.transformValue.bind(this));
|
|
6
|
-
},
|
|
7
|
-
transformValue(value, listValueTransformations) {
|
|
8
|
-
const template = document.createElement('template');
|
|
9
|
-
template.innerHTML = Autolinker.link(value);
|
|
10
|
-
const nextProcessor = listValueTransformations.shift();
|
|
11
|
-
if (nextProcessor) nextProcessor(template.content, listValueTransformations);
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
export { AutolinkMixin };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const DateMixin = {
|
|
2
|
-
name: 'date-mixin',
|
|
3
|
-
created() {
|
|
4
|
-
this.listValueTransformations.push(this.transformValue.bind(this));
|
|
5
|
-
},
|
|
6
|
-
transformValue(value, listValueTransformations) {
|
|
7
|
-
try {
|
|
8
|
-
// workaround for giving a specific-formatted value to the form widget
|
|
9
|
-
this.listAttributes['originalValue'] = this.formatDateForInput(value);
|
|
10
|
-
} catch (e) {
|
|
11
|
-
console.warn('Invalid date format for widget', this.name);
|
|
12
|
-
this.listAttributes['originalValue'] = '';
|
|
13
|
-
}
|
|
14
|
-
const newValue = value ? new Date(value).toLocaleDateString() : value;
|
|
15
|
-
const nextProcessor = listValueTransformations.shift();
|
|
16
|
-
if (nextProcessor) nextProcessor(newValue, listValueTransformations);
|
|
17
|
-
},
|
|
18
|
-
formatDateForInput(date) {
|
|
19
|
-
let d = new Date(date);
|
|
20
|
-
if (isNaN(d.getTime())) throw new Error('Invalid date');
|
|
21
|
-
let month = `${d.getMonth() + 1}`;
|
|
22
|
-
let day = `${d.getDate()}`;
|
|
23
|
-
let year = d.getFullYear();
|
|
24
|
-
if (month.length < 2) month = `0${month}`;
|
|
25
|
-
if (day.length < 2) day = `0${day}`;
|
|
26
|
-
return [year, month, day].join('-');
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
export { DateMixin };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const DateTimeMixin = {
|
|
2
|
-
name: 'date-time-mixin',
|
|
3
|
-
created() {
|
|
4
|
-
this.listValueTransformations.push(this.transformValue.bind(this));
|
|
5
|
-
},
|
|
6
|
-
transformValue(value, listValueTransformations) {
|
|
7
|
-
const newValue = value ? new Date(value).toLocaleString() : value;
|
|
8
|
-
const nextProcessor = listValueTransformations.shift();
|
|
9
|
-
if (nextProcessor) nextProcessor(newValue, listValueTransformations);
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
export { DateTimeMixin };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { DateMixin } from './dateMixin.js';
|
|
2
|
-
import { DateTimeMixin } from './dateTimeMixin.js';
|
|
3
|
-
import { MultilineMixin } from './multilineMixin.js';
|
|
4
|
-
import { MarkdownMixin } from './markdownMixin.js';
|
|
5
|
-
import { OembedMixin } from './oembedMixin.js';
|
|
6
|
-
import { AutolinkMixin } from './autolinkMixin.js';
|
|
7
|
-
const valueTransformationDirectory = {
|
|
8
|
-
date: DateMixin,
|
|
9
|
-
datetime: DateTimeMixin,
|
|
10
|
-
multiline: MultilineMixin,
|
|
11
|
-
markdown: MarkdownMixin,
|
|
12
|
-
oembed: OembedMixin,
|
|
13
|
-
autolink: AutolinkMixin
|
|
14
|
-
};
|
|
15
|
-
export { valueTransformationDirectory, DateMixin, DateTimeMixin, MultilineMixin, MarkdownMixin, OembedMixin, AutolinkMixin };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { unsafeHTML } from '../../_snowpack/pkg/lit-html/directives/unsafe-html.js';
|
|
2
|
-
import markdownit from '../../_snowpack/pkg/markdown-it.js';
|
|
3
|
-
import mila from '../../_snowpack/pkg/markdown-it-link-attributes.js';
|
|
4
|
-
const MarkdownMixin = {
|
|
5
|
-
name: 'markdown-mixin',
|
|
6
|
-
created() {
|
|
7
|
-
this.listValueTransformations.push(this.transformValue.bind(this));
|
|
8
|
-
},
|
|
9
|
-
transformValue(value, listValueTransformations) {
|
|
10
|
-
let newValue = '';
|
|
11
|
-
if (value) {
|
|
12
|
-
const md = markdownit({
|
|
13
|
-
breaks: true,
|
|
14
|
-
html: false,
|
|
15
|
-
linkify: true
|
|
16
|
-
});
|
|
17
|
-
md.use(mila, {
|
|
18
|
-
attrs: {
|
|
19
|
-
target: '_blank',
|
|
20
|
-
rel: 'noopener'
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const html = md.render(value);
|
|
24
|
-
newValue = unsafeHTML(html);
|
|
25
|
-
}
|
|
26
|
-
const nextProcessor = listValueTransformations.shift();
|
|
27
|
-
if (nextProcessor) nextProcessor(newValue, listValueTransformations);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
export { MarkdownMixin };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { unsafeHTML } from '../../_snowpack/pkg/lit-html/directives/unsafe-html.js';
|
|
2
|
-
const MultilineMixin = {
|
|
3
|
-
name: 'multiline-mixin',
|
|
4
|
-
created() {
|
|
5
|
-
this.listValueTransformations.push(this.transformValue.bind(this));
|
|
6
|
-
},
|
|
7
|
-
transformValue(value, listValueTransformations) {
|
|
8
|
-
const newValue = value ? unsafeHTML(value.replace(/\n/g, "<br/>")) : value;
|
|
9
|
-
const nextProcessor = listValueTransformations.shift();
|
|
10
|
-
if (nextProcessor) nextProcessor(newValue, listValueTransformations);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
export { MultilineMixin };
|