@startinblox/core 0.19.0-beta.2 → 0.19.0-beta.21

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.
Files changed (166) hide show
  1. package/dist/{_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css → assets/MarkerCluster-614dea0a.css} +0 -0
  2. package/dist/{_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css → assets/MarkerCluster.Default-61258232.css} +0 -0
  3. package/dist/assets/en-e53105c5.js +14 -0
  4. package/dist/assets/en-e53105c5.js.map +1 -0
  5. package/dist/assets/fr-a7fcdb64.js +14 -0
  6. package/dist/assets/fr-a7fcdb64.js.map +1 -0
  7. package/dist/{_snowpack/pkg/fusejs.js → assets/helpers-411e08e4.js} +499 -454
  8. package/dist/assets/helpers-411e08e4.js.map +1 -0
  9. package/dist/{_snowpack/pkg/leaflet/dist/leaflet.css → assets/leaflet-3c081932.css} +3 -3
  10. package/dist/helpers.js +22 -0
  11. package/dist/helpers.js.map +1 -0
  12. package/dist/index.js +54873 -48
  13. package/dist/index.js.map +1 -0
  14. package/package.json +7 -22
  15. package/dist/_snowpack/pkg/autolinker.js +0 -4429
  16. package/dist/_snowpack/pkg/autolinker.js.map +0 -1
  17. package/dist/_snowpack/pkg/common/_baseUnary-d2677655.js +0 -353
  18. package/dist/_snowpack/pkg/common/_baseUnary-d2677655.js.map +0 -1
  19. package/dist/_snowpack/pkg/common/_commonjsHelpers-0597c316.js +0 -26
  20. package/dist/_snowpack/pkg/common/_commonjsHelpers-0597c316.js.map +0 -1
  21. package/dist/_snowpack/pkg/common/decode-26fbf385.js +0 -185
  22. package/dist/_snowpack/pkg/common/decode-26fbf385.js.map +0 -1
  23. package/dist/_snowpack/pkg/common/lit-html-3647afce.js +0 -1104
  24. package/dist/_snowpack/pkg/common/lit-html-3647afce.js.map +0 -1
  25. package/dist/_snowpack/pkg/delta-markdown-for-quill.js +0 -26198
  26. package/dist/_snowpack/pkg/delta-markdown-for-quill.js.map +0 -1
  27. package/dist/_snowpack/pkg/dialog-polyfill.js +0 -826
  28. package/dist/_snowpack/pkg/dialog-polyfill.js.map +0 -1
  29. package/dist/_snowpack/pkg/fusejs.js.map +0 -1
  30. package/dist/_snowpack/pkg/import-map.json +0 -25
  31. package/dist/_snowpack/pkg/jsonld-context-parser.js +0 -836
  32. package/dist/_snowpack/pkg/jsonld-context-parser.js.map +0 -1
  33. package/dist/_snowpack/pkg/jsonld.js +0 -11760
  34. package/dist/_snowpack/pkg/jsonld.js.map +0 -1
  35. package/dist/_snowpack/pkg/leaflet/dist/leaflet.css.proxy.js +0 -10
  36. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css.proxy.js +0 -10
  37. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css.proxy.js +0 -10
  38. package/dist/_snowpack/pkg/lit-html/directives/if-defined.js +0 -39
  39. package/dist/_snowpack/pkg/lit-html/directives/if-defined.js.map +0 -1
  40. package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js +0 -48
  41. package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js.map +0 -1
  42. package/dist/_snowpack/pkg/lit-html/directives/until.js +0 -87
  43. package/dist/_snowpack/pkg/lit-html/directives/until.js.map +0 -1
  44. package/dist/_snowpack/pkg/lit-html.js +0 -94
  45. package/dist/_snowpack/pkg/lit-html.js.map +0 -1
  46. package/dist/_snowpack/pkg/markdown-it-link-attributes.js +0 -68
  47. package/dist/_snowpack/pkg/markdown-it-link-attributes.js.map +0 -1
  48. package/dist/_snowpack/pkg/markdown-it.js +0 -11307
  49. package/dist/_snowpack/pkg/markdown-it.js.map +0 -1
  50. package/dist/_snowpack/pkg/quill/dist/quill.snow.css.proxy.js +0 -10
  51. package/dist/_snowpack/pkg/quill-delta-to-markdown.js +0 -971
  52. package/dist/_snowpack/pkg/quill-delta-to-markdown.js.map +0 -1
  53. package/dist/_snowpack/pkg/quill.js +0 -14441
  54. package/dist/_snowpack/pkg/quill.js.map +0 -1
  55. package/dist/_snowpack/pkg/slim-select.js +0 -714
  56. package/dist/_snowpack/pkg/slim-select.js.map +0 -1
  57. package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css +0 -1149
  58. package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css.proxy.js +0 -10
  59. package/dist/_snowpack/pkg/tui-calendar.js +0 -46503
  60. package/dist/_snowpack/pkg/tui-calendar.js.map +0 -1
  61. package/dist/components/solid-ac-checker.js +0 -45
  62. package/dist/components/solid-calendar.js +0 -66
  63. package/dist/components/solid-delete.js +0 -96
  64. package/dist/components/solid-display.js +0 -150
  65. package/dist/components/solid-form-search.js +0 -173
  66. package/dist/components/solid-form.js +0 -257
  67. package/dist/components/solid-lang.js +0 -35
  68. package/dist/components/solid-map.js +0 -204
  69. package/dist/components/solid-table.js +0 -181
  70. package/dist/components/solid-widget.js +0 -72
  71. package/dist/import.css +0 -4
  72. package/dist/libs/Component.js +0 -13
  73. package/dist/libs/ComponentFactory.js +0 -165
  74. package/dist/libs/Compositor.js +0 -96
  75. package/dist/libs/Sib.js +0 -44
  76. package/dist/libs/filter.js +0 -184
  77. package/dist/libs/helpers.js +0 -185
  78. package/dist/libs/interfaces.js +0 -6
  79. package/dist/libs/lit-helpers.js +0 -139
  80. package/dist/libs/polyfills.js +0 -35
  81. package/dist/libs/store/custom-getter.js +0 -313
  82. package/dist/libs/store/server-pagination.js +0 -19
  83. package/dist/libs/store/server-search.js +0 -32
  84. package/dist/libs/store/store.js +0 -560
  85. package/dist/locales/en.json +0 -10
  86. package/dist/locales/en.json.proxy.js +0 -2
  87. package/dist/locales/fr.json +0 -10
  88. package/dist/locales/fr.json.proxy.js +0 -2
  89. package/dist/mixins/attributeBinderMixin.js +0 -113
  90. package/dist/mixins/contextMixin.js +0 -26
  91. package/dist/mixins/counterMixin.js +0 -54
  92. package/dist/mixins/federationMixin.js +0 -57
  93. package/dist/mixins/filterMixin.js +0 -152
  94. package/dist/mixins/grouperMixin.js +0 -73
  95. package/dist/mixins/highlighterMixin.js +0 -36
  96. package/dist/mixins/interfaces.js +0 -6
  97. package/dist/mixins/listMixin.js +0 -116
  98. package/dist/mixins/nextMixin.js +0 -23
  99. package/dist/mixins/paginateMixin.js +0 -97
  100. package/dist/mixins/requiredMixin.js +0 -38
  101. package/dist/mixins/serverPaginationMixin.js +0 -122
  102. package/dist/mixins/sorterMixin.js +0 -131
  103. package/dist/mixins/storeMixin.js +0 -139
  104. package/dist/mixins/translationMixin.js +0 -58
  105. package/dist/mixins/validationMixin.js +0 -95
  106. package/dist/mixins/widgetMixin.js +0 -364
  107. package/dist/new-widgets/attributeMixins/actionMixin.js +0 -13
  108. package/dist/new-widgets/attributeMixins/blankMixin.js +0 -7
  109. package/dist/new-widgets/attributeMixins/booleanMixin.js +0 -7
  110. package/dist/new-widgets/attributeMixins/index.js +0 -19
  111. package/dist/new-widgets/attributeMixins/mailtoMixin.js +0 -7
  112. package/dist/new-widgets/attributeMixins/multipleMixin.js +0 -27
  113. package/dist/new-widgets/attributeMixins/numberMixin.js +0 -7
  114. package/dist/new-widgets/attributeMixins/placeholderMixin.js +0 -16
  115. package/dist/new-widgets/attributeMixins/telMixin.js +0 -7
  116. package/dist/new-widgets/baseWidgetMixin.js +0 -109
  117. package/dist/new-widgets/callbackMixins/autocompletionMixin.js +0 -96
  118. package/dist/new-widgets/callbackMixins/index.js +0 -7
  119. package/dist/new-widgets/callbackMixins/richtextMixin.js +0 -37
  120. package/dist/new-widgets/callbackMixins/slimselect.css.proxy.js +0 -10
  121. package/dist/new-widgets/interfaces.js +0 -1
  122. package/dist/new-widgets/new-widget-factory.js +0 -91
  123. package/dist/new-widgets/templateAdditionMixins/addableMixin.js +0 -26
  124. package/dist/new-widgets/templateAdditionMixins/index.js +0 -13
  125. package/dist/new-widgets/templateAdditionMixins/labelLastMixin.js +0 -16
  126. package/dist/new-widgets/templateAdditionMixins/labelMixin.js +0 -18
  127. package/dist/new-widgets/templates/defaultTemplatesDirectory.js +0 -29
  128. package/dist/new-widgets/templates/displayTemplatesDirectory.js +0 -54
  129. package/dist/new-widgets/templates/formTemplatesDirectory.js +0 -423
  130. package/dist/new-widgets/templates/groupTemplatesDirectory.js +0 -11
  131. package/dist/new-widgets/templates/index.js +0 -6
  132. package/dist/new-widgets/templates/setTemplatesDirectory.js +0 -16
  133. package/dist/new-widgets/templatesDependencies/altMixin.js +0 -12
  134. package/dist/new-widgets/templatesDependencies/editableMixin.js +0 -60
  135. package/dist/new-widgets/templatesDependencies/filterRangeFormMixin.js +0 -34
  136. package/dist/new-widgets/templatesDependencies/formCheckboxMixin.js +0 -10
  137. package/dist/new-widgets/templatesDependencies/formCheckboxesMixin.js +0 -41
  138. package/dist/new-widgets/templatesDependencies/formDropdownMixin.js +0 -59
  139. package/dist/new-widgets/templatesDependencies/formFileMixin.js +0 -82
  140. package/dist/new-widgets/templatesDependencies/formLengthMixin.js +0 -18
  141. package/dist/new-widgets/templatesDependencies/formMinMaxMixin.js +0 -18
  142. package/dist/new-widgets/templatesDependencies/formMixin.js +0 -56
  143. package/dist/new-widgets/templatesDependencies/formNumberMixin.js +0 -10
  144. package/dist/new-widgets/templatesDependencies/formRadioMixin.js +0 -12
  145. package/dist/new-widgets/templatesDependencies/formStepMixin.js +0 -12
  146. package/dist/new-widgets/templatesDependencies/linkTextMixin.js +0 -13
  147. package/dist/new-widgets/templatesDependencies/multipleFormMixin.js +0 -125
  148. package/dist/new-widgets/templatesDependencies/multipleselectFormMixin.js +0 -74
  149. package/dist/new-widgets/templatesDependencies/patternMixin.js +0 -18
  150. package/dist/new-widgets/templatesDependencies/rangeMixin.js +0 -100
  151. package/dist/new-widgets/templatesDependencies/setMixin.js +0 -9
  152. package/dist/new-widgets/templatesDependencies/valueRichtextMixin.js +0 -9
  153. package/dist/new-widgets/valueTransformationMixins/autolinkMixin.js +0 -14
  154. package/dist/new-widgets/valueTransformationMixins/dateMixin.js +0 -29
  155. package/dist/new-widgets/valueTransformationMixins/dateTimeMixin.js +0 -12
  156. package/dist/new-widgets/valueTransformationMixins/index.js +0 -15
  157. package/dist/new-widgets/valueTransformationMixins/markdownMixin.js +0 -30
  158. package/dist/new-widgets/valueTransformationMixins/multilineMixin.js +0 -13
  159. package/dist/new-widgets/valueTransformationMixins/oembedMixin.js +0 -21
  160. package/dist/solid-template-element.js +0 -144
  161. package/dist/style/default-theme.css.proxy.js +0 -10
  162. package/dist/widgets/baseWidget.js +0 -267
  163. package/dist/widgets/widget-factory.js +0 -20
  164. /package/dist/{style/default-theme.css → assets/default-theme-d0f20a8a.css} +0 -0
  165. /package/dist/{_snowpack/pkg/quill/dist/quill.snow.css → assets/quill.snow-8f222e44.css} +0 -0
  166. /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,10 +0,0 @@
1
- const FormNumberMixin = {
2
- name: 'form-number-mixin',
3
- getValueFromElement(element) {
4
- return element.value ? Number(element.value) : '';
5
- },
6
- get type() {
7
- return 'number';
8
- }
9
- };
10
- export { FormNumberMixin };
@@ -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,12 +0,0 @@
1
- const FormStepMixin = {
2
- name: 'form-time-mixin',
3
- attributes: {
4
- step: {
5
- type: Number,
6
- callback: function (newValue) {
7
- this.addToAttributes(newValue, 'step');
8
- }
9
- }
10
- }
11
- };
12
- export { FormStepMixin };
@@ -1,13 +0,0 @@
1
- const LinkTextMixin = {
2
- name: 'link-text-mixin',
3
- attributes: {
4
- linkText: {
5
- type: String,
6
- default: '',
7
- callback: function (newValue) {
8
- this.addToAttributes(newValue, 'linkText');
9
- }
10
- }
11
- }
12
- };
13
- export { LinkTextMixin };
@@ -1,125 +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) {
67
- try {
68
- if (Array.isArray(JSON.parse(value))) {
69
- this.setValue(JSON.parse(value));
70
- }
71
- } catch (ex) {
72
- this.dataSrc = value;
73
- console.log('Not an array', ex);
74
- }
75
- }
76
- const nextProcessor = listValueTransformations.shift();
77
- if (nextProcessor) nextProcessor(value, listValueTransformations);
78
- },
79
- populate() {
80
- if (!this.resource || !this.resource['ldp:contains']) return;
81
- this.listAttributes['children'] = []; // reset list
82
-
83
- // set value in form
84
- for (let resource of this.resource['ldp:contains']) {
85
- // for each resource
86
- this.insertWidget(resource['@id']); // create a widget
87
- }
88
-
89
- this.planRender();
90
- },
91
- insertWidget(value = '') {
92
- if (!this.widget) return;
93
- const widget = document.createElement(this.widget);
94
- const attributes = {
95
- 'data-holder': true,
96
- 'name': this.name,
97
- 'value': value,
98
- 'range': this.range
99
- };
100
- for (let name of Object.keys(attributes)) {
101
- if (typeof attributes[name] === "boolean") widget.toggleAttribute(name, attributes[name]);else widget.setAttribute(name, attributes[name]);
102
- }
103
- this.listAttributes['children'].push(widget);
104
- },
105
- empty() {
106
- this.listAttributes['children'] = [];
107
- this.planRender();
108
- },
109
- getValue() {
110
- if (!this.dataHolder) return [];
111
- // Was returning an array of functions, now returns an array of values.
112
- // Not sure about the tests results in that context
113
- return Array.from(this.dataHolder).map(element => {
114
- let elValue = this.getValueFromElement(element);
115
- return elValue;
116
- });
117
- },
118
- get type() {
119
- return 'resource';
120
- },
121
- get multiple() {
122
- return true;
123
- }
124
- };
125
- 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
- const SetMixin = {
2
- name: 'set-mixin',
3
- /**
4
- * For sets and group widgets, remove auto rendering
5
- * function to allow only manual renders
6
- */
7
- planRender() {}
8
- };
9
- export { SetMixin };
@@ -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 };