@startinblox/core 0.18.1 → 0.19.0-beta.10

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 (163) 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-bf15809c.js} +398 -454
  8. package/dist/assets/helpers-bf15809c.js.map +1 -0
  9. package/dist/{_snowpack/pkg/leaflet/dist/leaflet.css → assets/leaflet-3c081932.css} +3 -3
  10. package/dist/helpers.js +18 -0
  11. package/dist/helpers.js.map +1 -0
  12. package/dist/index.js +54600 -48
  13. package/dist/index.js.map +1 -0
  14. package/package.json +8 -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-c1edb653.js +0 -353
  18. package/dist/_snowpack/pkg/common/_baseUnary-c1edb653.js.map +0 -1
  19. package/dist/_snowpack/pkg/common/_commonjsHelpers-37fa8da4.js +0 -26
  20. package/dist/_snowpack/pkg/common/_commonjsHelpers-37fa8da4.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 -827
  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 -24
  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/leaflet/dist/leaflet.css.proxy.js +0 -10
  34. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css.proxy.js +0 -10
  35. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css.proxy.js +0 -10
  36. package/dist/_snowpack/pkg/lit-html/directives/if-defined.js +0 -39
  37. package/dist/_snowpack/pkg/lit-html/directives/if-defined.js.map +0 -1
  38. package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js +0 -48
  39. package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js.map +0 -1
  40. package/dist/_snowpack/pkg/lit-html/directives/until.js +0 -87
  41. package/dist/_snowpack/pkg/lit-html/directives/until.js.map +0 -1
  42. package/dist/_snowpack/pkg/lit-html.js +0 -94
  43. package/dist/_snowpack/pkg/lit-html.js.map +0 -1
  44. package/dist/_snowpack/pkg/markdown-it-link-attributes.js +0 -68
  45. package/dist/_snowpack/pkg/markdown-it-link-attributes.js.map +0 -1
  46. package/dist/_snowpack/pkg/markdown-it.js +0 -11307
  47. package/dist/_snowpack/pkg/markdown-it.js.map +0 -1
  48. package/dist/_snowpack/pkg/quill/dist/quill.snow.css.proxy.js +0 -10
  49. package/dist/_snowpack/pkg/quill-delta-to-markdown.js +0 -971
  50. package/dist/_snowpack/pkg/quill-delta-to-markdown.js.map +0 -1
  51. package/dist/_snowpack/pkg/quill.js +0 -14442
  52. package/dist/_snowpack/pkg/quill.js.map +0 -1
  53. package/dist/_snowpack/pkg/slim-select.js +0 -714
  54. package/dist/_snowpack/pkg/slim-select.js.map +0 -1
  55. package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css +0 -1149
  56. package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css.proxy.js +0 -10
  57. package/dist/_snowpack/pkg/tui-calendar.js +0 -46507
  58. package/dist/_snowpack/pkg/tui-calendar.js.map +0 -1
  59. package/dist/components/solid-ac-checker.js +0 -45
  60. package/dist/components/solid-calendar.js +0 -66
  61. package/dist/components/solid-delete.js +0 -96
  62. package/dist/components/solid-display.js +0 -150
  63. package/dist/components/solid-form-search.js +0 -174
  64. package/dist/components/solid-form.js +0 -259
  65. package/dist/components/solid-lang.js +0 -35
  66. package/dist/components/solid-map.js +0 -204
  67. package/dist/components/solid-table.js +0 -181
  68. package/dist/components/solid-widget.js +0 -72
  69. package/dist/import.css +0 -4
  70. package/dist/libs/Component.js +0 -13
  71. package/dist/libs/ComponentFactory.js +0 -168
  72. package/dist/libs/Compositor.js +0 -96
  73. package/dist/libs/Sib.js +0 -44
  74. package/dist/libs/filter.js +0 -184
  75. package/dist/libs/helpers.js +0 -191
  76. package/dist/libs/interfaces.js +0 -6
  77. package/dist/libs/lit-helpers.js +0 -142
  78. package/dist/libs/polyfills.js +0 -37
  79. package/dist/libs/store/server-pagination.js +0 -22
  80. package/dist/libs/store/server-search.js +0 -35
  81. package/dist/libs/store/store.js +0 -814
  82. package/dist/locales/en.json +0 -10
  83. package/dist/locales/en.json.proxy.js +0 -2
  84. package/dist/locales/fr.json +0 -10
  85. package/dist/locales/fr.json.proxy.js +0 -2
  86. package/dist/mixins/attributeBinderMixin.js +0 -116
  87. package/dist/mixins/contextMixin.js +0 -26
  88. package/dist/mixins/counterMixin.js +0 -54
  89. package/dist/mixins/federationMixin.js +0 -51
  90. package/dist/mixins/filterMixin.js +0 -155
  91. package/dist/mixins/grouperMixin.js +0 -73
  92. package/dist/mixins/highlighterMixin.js +0 -36
  93. package/dist/mixins/interfaces.js +0 -6
  94. package/dist/mixins/listMixin.js +0 -105
  95. package/dist/mixins/nextMixin.js +0 -23
  96. package/dist/mixins/paginateMixin.js +0 -97
  97. package/dist/mixins/requiredMixin.js +0 -26
  98. package/dist/mixins/serverPaginationMixin.js +0 -122
  99. package/dist/mixins/sorterMixin.js +0 -131
  100. package/dist/mixins/storeMixin.js +0 -109
  101. package/dist/mixins/translationMixin.js +0 -58
  102. package/dist/mixins/validationMixin.js +0 -95
  103. package/dist/mixins/widgetMixin.js +0 -351
  104. package/dist/new-widgets/attributeMixins/actionMixin.js +0 -13
  105. package/dist/new-widgets/attributeMixins/blankMixin.js +0 -7
  106. package/dist/new-widgets/attributeMixins/booleanMixin.js +0 -7
  107. package/dist/new-widgets/attributeMixins/index.js +0 -19
  108. package/dist/new-widgets/attributeMixins/mailtoMixin.js +0 -7
  109. package/dist/new-widgets/attributeMixins/multipleMixin.js +0 -27
  110. package/dist/new-widgets/attributeMixins/numberMixin.js +0 -7
  111. package/dist/new-widgets/attributeMixins/placeholderMixin.js +0 -16
  112. package/dist/new-widgets/attributeMixins/telMixin.js +0 -7
  113. package/dist/new-widgets/baseWidgetMixin.js +0 -109
  114. package/dist/new-widgets/callbackMixins/autocompletionMixin.js +0 -96
  115. package/dist/new-widgets/callbackMixins/index.js +0 -7
  116. package/dist/new-widgets/callbackMixins/richtextMixin.js +0 -37
  117. package/dist/new-widgets/callbackMixins/slimselect.css.proxy.js +0 -10
  118. package/dist/new-widgets/interfaces.js +0 -1
  119. package/dist/new-widgets/new-widget-factory.js +0 -91
  120. package/dist/new-widgets/templateAdditionMixins/addableMixin.js +0 -26
  121. package/dist/new-widgets/templateAdditionMixins/index.js +0 -13
  122. package/dist/new-widgets/templateAdditionMixins/labelLastMixin.js +0 -16
  123. package/dist/new-widgets/templateAdditionMixins/labelMixin.js +0 -18
  124. package/dist/new-widgets/templates/defaultTemplatesDirectory.js +0 -29
  125. package/dist/new-widgets/templates/displayTemplatesDirectory.js +0 -54
  126. package/dist/new-widgets/templates/formTemplatesDirectory.js +0 -432
  127. package/dist/new-widgets/templates/groupTemplatesDirectory.js +0 -11
  128. package/dist/new-widgets/templates/index.js +0 -6
  129. package/dist/new-widgets/templates/setTemplatesDirectory.js +0 -16
  130. package/dist/new-widgets/templatesDependencies/altMixin.js +0 -12
  131. package/dist/new-widgets/templatesDependencies/editableMixin.js +0 -60
  132. package/dist/new-widgets/templatesDependencies/filterRangeFormMixin.js +0 -34
  133. package/dist/new-widgets/templatesDependencies/formCheckboxMixin.js +0 -10
  134. package/dist/new-widgets/templatesDependencies/formCheckboxesMixin.js +0 -41
  135. package/dist/new-widgets/templatesDependencies/formDropdownMixin.js +0 -56
  136. package/dist/new-widgets/templatesDependencies/formFileMixin.js +0 -82
  137. package/dist/new-widgets/templatesDependencies/formLengthMixin.js +0 -18
  138. package/dist/new-widgets/templatesDependencies/formMinMaxMixin.js +0 -18
  139. package/dist/new-widgets/templatesDependencies/formMixin.js +0 -56
  140. package/dist/new-widgets/templatesDependencies/formNumberMixin.js +0 -10
  141. package/dist/new-widgets/templatesDependencies/formRadioMixin.js +0 -12
  142. package/dist/new-widgets/templatesDependencies/formStepMixin.js +0 -12
  143. package/dist/new-widgets/templatesDependencies/linkTextMixin.js +0 -13
  144. package/dist/new-widgets/templatesDependencies/multipleFormMixin.js +0 -112
  145. package/dist/new-widgets/templatesDependencies/multipleselectFormMixin.js +0 -65
  146. package/dist/new-widgets/templatesDependencies/patternMixin.js +0 -18
  147. package/dist/new-widgets/templatesDependencies/rangeMixin.js +0 -100
  148. package/dist/new-widgets/templatesDependencies/setMixin.js +0 -9
  149. package/dist/new-widgets/templatesDependencies/valueRichtextMixin.js +0 -9
  150. package/dist/new-widgets/valueTransformationMixins/autolinkMixin.js +0 -14
  151. package/dist/new-widgets/valueTransformationMixins/dateMixin.js +0 -29
  152. package/dist/new-widgets/valueTransformationMixins/dateTimeMixin.js +0 -12
  153. package/dist/new-widgets/valueTransformationMixins/index.js +0 -15
  154. package/dist/new-widgets/valueTransformationMixins/markdownMixin.js +0 -30
  155. package/dist/new-widgets/valueTransformationMixins/multilineMixin.js +0 -13
  156. package/dist/new-widgets/valueTransformationMixins/oembedMixin.js +0 -21
  157. package/dist/solid-template-element.js +0 -144
  158. package/dist/style/default-theme.css.proxy.js +0 -10
  159. package/dist/widgets/baseWidget.js +0 -268
  160. package/dist/widgets/widget-factory.js +0 -22
  161. /package/dist/{style/default-theme.css → assets/default-theme-d0f20a8a.css} +0 -0
  162. /package/dist/{_snowpack/pkg/quill/dist/quill.snow.css → assets/quill.snow-8f222e44.css} +0 -0
  163. /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,112 +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() {
83
- let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
84
- if (!this.widget) return;
85
- const widget = document.createElement(this.widget);
86
- const attributes = {
87
- 'data-holder': true,
88
- 'name': this.name,
89
- 'value': value,
90
- 'range': this.range
91
- };
92
- for (let name of Object.keys(attributes)) {
93
- if (typeof attributes[name] === "boolean") widget.toggleAttribute(name, attributes[name]);else widget.setAttribute(name, attributes[name]);
94
- }
95
- this.listAttributes['children'].push(widget);
96
- },
97
- empty() {
98
- this.listAttributes['children'] = [];
99
- this.planRender();
100
- },
101
- getValue() {
102
- if (!this.dataHolder) return [];
103
- return Array.from(this.dataHolder).map(element => this.getValueFromElement(element));
104
- },
105
- get type() {
106
- return 'resource';
107
- },
108
- get multiple() {
109
- return true;
110
- }
111
- };
112
- export { MultipleFormMixin };
@@ -1,65 +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) this.dataSrc = value;
42
- const nextProcessor = listValueTransformations.shift();
43
- if (nextProcessor) nextProcessor(value, listValueTransformations);
44
- },
45
- populate() {
46
- if (!this.resource || !this.resource['ldp:contains']) return;
47
- this.setValue(this.resource['ldp:contains']);
48
- this.planRender();
49
- },
50
- setValue(values) {
51
- // set the values to the dropdown
52
- this.listAttributes['values'] = JSON.stringify(values.map(r => r['@id']));
53
- },
54
- empty() {
55
- this.listAttributes['values'] = [];
56
- this.planRender();
57
- },
58
- get type() {
59
- return this.enum === '' ? 'resource' : 'string';
60
- },
61
- get multiple() {
62
- return true;
63
- }
64
- };
65
- 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 };
@@ -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 };