@startinblox/core 0.0.0
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/LICENSE +21 -0
- package/README.md +182 -0
- package/dist/_snowpack/pkg/autolinker.js +4429 -0
- package/dist/_snowpack/pkg/autolinker.js.map +1 -0
- package/dist/_snowpack/pkg/common/_baseUnary-c1edb653.js +353 -0
- package/dist/_snowpack/pkg/common/_baseUnary-c1edb653.js.map +1 -0
- package/dist/_snowpack/pkg/common/_commonjsHelpers-37fa8da4.js +26 -0
- package/dist/_snowpack/pkg/common/_commonjsHelpers-37fa8da4.js.map +1 -0
- package/dist/_snowpack/pkg/common/decode-26fbf385.js +185 -0
- package/dist/_snowpack/pkg/common/decode-26fbf385.js.map +1 -0
- package/dist/_snowpack/pkg/common/lit-html-3647afce.js +1104 -0
- package/dist/_snowpack/pkg/common/lit-html-3647afce.js.map +1 -0
- package/dist/_snowpack/pkg/delta-markdown-for-quill.js +26198 -0
- package/dist/_snowpack/pkg/delta-markdown-for-quill.js.map +1 -0
- package/dist/_snowpack/pkg/dialog-polyfill.js +827 -0
- package/dist/_snowpack/pkg/dialog-polyfill.js.map +1 -0
- package/dist/_snowpack/pkg/fusejs.js +1593 -0
- package/dist/_snowpack/pkg/fusejs.js.map +1 -0
- package/dist/_snowpack/pkg/import-map.json +24 -0
- package/dist/_snowpack/pkg/jsonld-context-parser.js +836 -0
- package/dist/_snowpack/pkg/jsonld-context-parser.js.map +1 -0
- package/dist/_snowpack/pkg/leaflet/dist/leaflet.css +640 -0
- package/dist/_snowpack/pkg/leaflet/dist/leaflet.css.proxy.js +10 -0
- package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css +60 -0
- package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css.proxy.js +10 -0
- package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css +14 -0
- package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css.proxy.js +10 -0
- package/dist/_snowpack/pkg/lit-html/directives/if-defined.js +39 -0
- package/dist/_snowpack/pkg/lit-html/directives/if-defined.js.map +1 -0
- package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js +48 -0
- package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js.map +1 -0
- package/dist/_snowpack/pkg/lit-html/directives/until.js +87 -0
- package/dist/_snowpack/pkg/lit-html/directives/until.js.map +1 -0
- package/dist/_snowpack/pkg/lit-html.js +94 -0
- package/dist/_snowpack/pkg/lit-html.js.map +1 -0
- package/dist/_snowpack/pkg/markdown-it-link-attributes.js +68 -0
- package/dist/_snowpack/pkg/markdown-it-link-attributes.js.map +1 -0
- package/dist/_snowpack/pkg/markdown-it.js +11307 -0
- package/dist/_snowpack/pkg/markdown-it.js.map +1 -0
- package/dist/_snowpack/pkg/quill/dist/quill.snow.css +945 -0
- package/dist/_snowpack/pkg/quill/dist/quill.snow.css.proxy.js +10 -0
- package/dist/_snowpack/pkg/quill-delta-to-markdown.js +971 -0
- package/dist/_snowpack/pkg/quill-delta-to-markdown.js.map +1 -0
- package/dist/_snowpack/pkg/quill.js +14442 -0
- package/dist/_snowpack/pkg/quill.js.map +1 -0
- package/dist/_snowpack/pkg/slim-select.js +714 -0
- package/dist/_snowpack/pkg/slim-select.js.map +1 -0
- package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css +1149 -0
- package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css.proxy.js +10 -0
- package/dist/_snowpack/pkg/tui-calendar.js +46507 -0
- package/dist/_snowpack/pkg/tui-calendar.js.map +1 -0
- package/dist/components/solid-ac-checker.js +45 -0
- package/dist/components/solid-calendar.js +66 -0
- package/dist/components/solid-delete.js +96 -0
- package/dist/components/solid-display.js +150 -0
- package/dist/components/solid-form-search.js +177 -0
- package/dist/components/solid-form.js +259 -0
- package/dist/components/solid-lang.js +35 -0
- package/dist/components/solid-map.js +204 -0
- package/dist/components/solid-table.js +181 -0
- package/dist/components/solid-widget.js +72 -0
- package/dist/import.css +4 -0
- package/dist/index.js +49 -0
- package/dist/libs/Component.js +13 -0
- package/dist/libs/ComponentFactory.js +168 -0
- package/dist/libs/Compositor.js +96 -0
- package/dist/libs/Sib.js +44 -0
- package/dist/libs/filter.js +184 -0
- package/dist/libs/helpers.js +194 -0
- package/dist/libs/interfaces.js +6 -0
- package/dist/libs/lit-helpers.js +142 -0
- package/dist/libs/polyfills.js +37 -0
- package/dist/libs/store/server-pagination.js +22 -0
- package/dist/libs/store/server-search.js +35 -0
- package/dist/libs/store/store.js +814 -0
- package/dist/locales/en.json +10 -0
- package/dist/locales/en.json.proxy.js +2 -0
- package/dist/locales/fr.json +10 -0
- package/dist/locales/fr.json.proxy.js +2 -0
- package/dist/mixins/attributeBinderMixin.js +116 -0
- package/dist/mixins/contextMixin.js +26 -0
- package/dist/mixins/counterMixin.js +54 -0
- package/dist/mixins/federationMixin.js +51 -0
- package/dist/mixins/filterMixin.js +155 -0
- package/dist/mixins/grouperMixin.js +73 -0
- package/dist/mixins/highlighterMixin.js +36 -0
- package/dist/mixins/interfaces.js +6 -0
- package/dist/mixins/listMixin.js +105 -0
- package/dist/mixins/nextMixin.js +23 -0
- package/dist/mixins/paginateMixin.js +97 -0
- package/dist/mixins/requiredMixin.js +26 -0
- package/dist/mixins/serverPaginationMixin.js +122 -0
- package/dist/mixins/sorterMixin.js +131 -0
- package/dist/mixins/storeMixin.js +109 -0
- package/dist/mixins/translationMixin.js +58 -0
- package/dist/mixins/validationMixin.js +95 -0
- package/dist/mixins/widgetMixin.js +351 -0
- package/dist/new-widgets/attributeMixins/actionMixin.js +13 -0
- package/dist/new-widgets/attributeMixins/blankMixin.js +7 -0
- package/dist/new-widgets/attributeMixins/booleanMixin.js +7 -0
- package/dist/new-widgets/attributeMixins/index.js +19 -0
- package/dist/new-widgets/attributeMixins/mailtoMixin.js +7 -0
- package/dist/new-widgets/attributeMixins/multipleMixin.js +27 -0
- package/dist/new-widgets/attributeMixins/numberMixin.js +7 -0
- package/dist/new-widgets/attributeMixins/placeholderMixin.js +16 -0
- package/dist/new-widgets/attributeMixins/telMixin.js +7 -0
- package/dist/new-widgets/baseWidgetMixin.js +109 -0
- package/dist/new-widgets/callbackMixins/autocompletionMixin.js +96 -0
- package/dist/new-widgets/callbackMixins/index.js +7 -0
- package/dist/new-widgets/callbackMixins/richtextMixin.js +37 -0
- package/dist/new-widgets/callbackMixins/slimselect.css +2 -0
- package/dist/new-widgets/callbackMixins/slimselect.css.proxy.js +10 -0
- package/dist/new-widgets/interfaces.js +1 -0
- package/dist/new-widgets/new-widget-factory.js +91 -0
- package/dist/new-widgets/templateAdditionMixins/addableMixin.js +26 -0
- package/dist/new-widgets/templateAdditionMixins/index.js +13 -0
- package/dist/new-widgets/templateAdditionMixins/labelLastMixin.js +16 -0
- package/dist/new-widgets/templateAdditionMixins/labelMixin.js +18 -0
- package/dist/new-widgets/templates/defaultTemplatesDirectory.js +29 -0
- package/dist/new-widgets/templates/displayTemplatesDirectory.js +54 -0
- package/dist/new-widgets/templates/formTemplatesDirectory.js +432 -0
- package/dist/new-widgets/templates/groupTemplatesDirectory.js +11 -0
- package/dist/new-widgets/templates/index.js +6 -0
- package/dist/new-widgets/templates/setTemplatesDirectory.js +16 -0
- package/dist/new-widgets/templatesDependencies/altMixin.js +12 -0
- package/dist/new-widgets/templatesDependencies/editableMixin.js +60 -0
- package/dist/new-widgets/templatesDependencies/filterRangeFormMixin.js +34 -0
- package/dist/new-widgets/templatesDependencies/formCheckboxMixin.js +10 -0
- package/dist/new-widgets/templatesDependencies/formCheckboxesMixin.js +41 -0
- package/dist/new-widgets/templatesDependencies/formDropdownMixin.js +56 -0
- package/dist/new-widgets/templatesDependencies/formFileMixin.js +82 -0
- package/dist/new-widgets/templatesDependencies/formLengthMixin.js +18 -0
- package/dist/new-widgets/templatesDependencies/formMinMaxMixin.js +18 -0
- package/dist/new-widgets/templatesDependencies/formMixin.js +56 -0
- package/dist/new-widgets/templatesDependencies/formNumberMixin.js +10 -0
- package/dist/new-widgets/templatesDependencies/formRadioMixin.js +12 -0
- package/dist/new-widgets/templatesDependencies/formStepMixin.js +12 -0
- package/dist/new-widgets/templatesDependencies/linkTextMixin.js +13 -0
- package/dist/new-widgets/templatesDependencies/multipleFormMixin.js +112 -0
- package/dist/new-widgets/templatesDependencies/multipleselectFormMixin.js +65 -0
- package/dist/new-widgets/templatesDependencies/patternMixin.js +18 -0
- package/dist/new-widgets/templatesDependencies/rangeMixin.js +100 -0
- package/dist/new-widgets/templatesDependencies/setMixin.js +9 -0
- package/dist/new-widgets/templatesDependencies/valueRichtextMixin.js +9 -0
- package/dist/new-widgets/valueTransformationMixins/autolinkMixin.js +14 -0
- package/dist/new-widgets/valueTransformationMixins/dateMixin.js +29 -0
- package/dist/new-widgets/valueTransformationMixins/dateTimeMixin.js +12 -0
- package/dist/new-widgets/valueTransformationMixins/index.js +15 -0
- package/dist/new-widgets/valueTransformationMixins/markdownMixin.js +30 -0
- package/dist/new-widgets/valueTransformationMixins/multilineMixin.js +13 -0
- package/dist/new-widgets/valueTransformationMixins/oembedMixin.js +21 -0
- package/dist/solid-template-element.js +144 -0
- package/dist/style/default-theme.css +24 -0
- package/dist/style/default-theme.css.proxy.js +10 -0
- package/dist/widgets/baseWidget.js +268 -0
- package/dist/widgets/widget-factory.js +22 -0
- package/package.json +117 -0
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import { FormMixin } from '../templatesDependencies/formMixin.js';
|
|
2
|
+
import { FormCheckboxMixin } from '../templatesDependencies/formCheckboxMixin.js';
|
|
3
|
+
import { FormMinMaxMixin } from '../templatesDependencies/formMinMaxMixin.js';
|
|
4
|
+
import { FormNumberMixin } from '../templatesDependencies/formNumberMixin.js';
|
|
5
|
+
import { FormDropdownMixin } from '../templatesDependencies/formDropdownMixin.js';
|
|
6
|
+
import { FormCheckboxesMixin } from '../templatesDependencies/formCheckboxesMixin.js';
|
|
7
|
+
import { FormRadioMixin } from '../templatesDependencies/formRadioMixin.js';
|
|
8
|
+
import { FormFileMixin } from '../templatesDependencies/formFileMixin.js';
|
|
9
|
+
import { MultipleFormMixin } from '../templatesDependencies/multipleFormMixin.js';
|
|
10
|
+
import { MultipleselectFormMixin } from '../templatesDependencies/multipleselectFormMixin.js';
|
|
11
|
+
import { RangeMixin } from '../templatesDependencies/rangeMixin.js';
|
|
12
|
+
import { FilterRangeFormMixin } from '../templatesDependencies/filterRangeFormMixin.js';
|
|
13
|
+
import { ValueRichtextMixin } from '../templatesDependencies/valueRichtextMixin.js';
|
|
14
|
+
import { PatternMixin } from '../templatesDependencies/patternMixin.js';
|
|
15
|
+
import { FormStepMixin } from '../templatesDependencies/formStepMixin.js';
|
|
16
|
+
import { FormLengthMixin } from '../templatesDependencies/formLengthMixin.js';
|
|
17
|
+
import { html } from '../../_snowpack/pkg/lit-html.js';
|
|
18
|
+
import { ifDefined } from '../../_snowpack/pkg/lit-html/directives/if-defined.js';
|
|
19
|
+
export const formTemplates = {
|
|
20
|
+
text: {
|
|
21
|
+
template: (value, attributes) => html`
|
|
22
|
+
<input
|
|
23
|
+
type="text"
|
|
24
|
+
placeholder=${ifDefined(attributes.placeholder)}
|
|
25
|
+
name=${ifDefined(attributes.name)}
|
|
26
|
+
id=${ifDefined(attributes.id)}
|
|
27
|
+
value=${value || ''}
|
|
28
|
+
pattern=${ifDefined(attributes.pattern)}
|
|
29
|
+
title=${ifDefined(attributes.title)}
|
|
30
|
+
?required=${attributes.required}
|
|
31
|
+
autocomplete=${ifDefined(attributes.autocomplete)}
|
|
32
|
+
data-holder
|
|
33
|
+
maxlength=${ifDefined(attributes.maxlength)}
|
|
34
|
+
minlength=${ifDefined(attributes.minlength)}
|
|
35
|
+
@change=${attributes.onChange}
|
|
36
|
+
/>
|
|
37
|
+
`,
|
|
38
|
+
dependencies: [FormMixin, PatternMixin, FormLengthMixin]
|
|
39
|
+
},
|
|
40
|
+
textarea: {
|
|
41
|
+
template: (value, attributes) => html`
|
|
42
|
+
<textarea
|
|
43
|
+
name=${ifDefined(attributes.name)}
|
|
44
|
+
id=${ifDefined(attributes.id)}
|
|
45
|
+
placeholder=${ifDefined(attributes.placeholder)}
|
|
46
|
+
data-holder
|
|
47
|
+
?required=${attributes.required}
|
|
48
|
+
autocomplete=${ifDefined(attributes.autocomplete)}
|
|
49
|
+
maxlength=${ifDefined(attributes.maxlength)}
|
|
50
|
+
minlength=${ifDefined(attributes.minlength)}
|
|
51
|
+
@change=${attributes.onChange}
|
|
52
|
+
>${value}</textarea>
|
|
53
|
+
`,
|
|
54
|
+
dependencies: [FormMixin, FormLengthMixin]
|
|
55
|
+
},
|
|
56
|
+
checkbox: {
|
|
57
|
+
template: (value, attributes) => html`
|
|
58
|
+
<label>
|
|
59
|
+
<input
|
|
60
|
+
data-holder
|
|
61
|
+
type="checkbox"
|
|
62
|
+
name=${ifDefined(attributes.name)}
|
|
63
|
+
?required=${attributes.required}
|
|
64
|
+
?checked=${value === 'true'}
|
|
65
|
+
@change=${attributes.onChange}
|
|
66
|
+
>
|
|
67
|
+
<div>${attributes.label || attributes.name}</div>
|
|
68
|
+
</label>
|
|
69
|
+
`,
|
|
70
|
+
dependencies: [FormCheckboxMixin, FormMixin]
|
|
71
|
+
},
|
|
72
|
+
date: {
|
|
73
|
+
template: (_value, attributes) => html`
|
|
74
|
+
<input
|
|
75
|
+
type="date"
|
|
76
|
+
placeholder=${ifDefined(attributes.placeholder)}
|
|
77
|
+
name=${ifDefined(attributes.name)}
|
|
78
|
+
id=${ifDefined(attributes.id)}
|
|
79
|
+
?required=${attributes.required}
|
|
80
|
+
value=${ifDefined(attributes.originalValue)}
|
|
81
|
+
data-holder
|
|
82
|
+
@change=${attributes.onChange}
|
|
83
|
+
/>
|
|
84
|
+
`,
|
|
85
|
+
dependencies: [FormMixin]
|
|
86
|
+
},
|
|
87
|
+
rangedate: {
|
|
88
|
+
template: (_value, attributes) => html`
|
|
89
|
+
<input
|
|
90
|
+
data-holder
|
|
91
|
+
type="date"
|
|
92
|
+
name="${attributes.name || ''}-start"
|
|
93
|
+
@change=${attributes.onChange}
|
|
94
|
+
value=${ifDefined(attributes.startValue)}
|
|
95
|
+
/>
|
|
96
|
+
<input
|
|
97
|
+
data-holder
|
|
98
|
+
type="date"
|
|
99
|
+
name="${attributes.name || ''}-end"
|
|
100
|
+
@change=${attributes.onChange}
|
|
101
|
+
value=${ifDefined(attributes.endValue)}
|
|
102
|
+
/>
|
|
103
|
+
`,
|
|
104
|
+
dependencies: [FilterRangeFormMixin, FormMixin]
|
|
105
|
+
},
|
|
106
|
+
number: {
|
|
107
|
+
template: (value, attributes) => html`
|
|
108
|
+
<input
|
|
109
|
+
type="number"
|
|
110
|
+
placeholder=${ifDefined(attributes.placeholder)}
|
|
111
|
+
name=${ifDefined(attributes.name)}
|
|
112
|
+
id=${ifDefined(attributes.id)}
|
|
113
|
+
value=${value}
|
|
114
|
+
min=${ifDefined(attributes.min)}
|
|
115
|
+
max=${ifDefined(attributes.max)}
|
|
116
|
+
step=${ifDefined(attributes.step)}
|
|
117
|
+
?required=${attributes.required}
|
|
118
|
+
data-holder
|
|
119
|
+
@change=${attributes.onChange}
|
|
120
|
+
/>
|
|
121
|
+
`,
|
|
122
|
+
dependencies: [FormNumberMixin, FormMinMaxMixin, FormMixin, FormStepMixin]
|
|
123
|
+
},
|
|
124
|
+
rangenumber: {
|
|
125
|
+
template: (_value, attributes) => html`
|
|
126
|
+
<input
|
|
127
|
+
data-holder
|
|
128
|
+
type="number"
|
|
129
|
+
name="${attributes.name || ''}-start"
|
|
130
|
+
@change=${attributes.onChange}
|
|
131
|
+
value=${ifDefined(attributes.startValue)}
|
|
132
|
+
/>
|
|
133
|
+
<input
|
|
134
|
+
data-holder
|
|
135
|
+
type="number"
|
|
136
|
+
name="${attributes.name || ''}-end"
|
|
137
|
+
@change=${attributes.onChange}
|
|
138
|
+
value=${ifDefined(attributes.endValue)}
|
|
139
|
+
/>
|
|
140
|
+
`,
|
|
141
|
+
dependencies: [FilterRangeFormMixin, FormNumberMixin, FormMixin]
|
|
142
|
+
},
|
|
143
|
+
hidden: {
|
|
144
|
+
template: (value, attributes) => html`
|
|
145
|
+
<input
|
|
146
|
+
type="hidden"
|
|
147
|
+
name=${ifDefined(attributes.name)}
|
|
148
|
+
value=${value}
|
|
149
|
+
data-holder
|
|
150
|
+
@change=${attributes.onChange}
|
|
151
|
+
/>
|
|
152
|
+
`,
|
|
153
|
+
dependencies: [FormMixin]
|
|
154
|
+
},
|
|
155
|
+
dropdown: {
|
|
156
|
+
template: (value, attributes) => html`
|
|
157
|
+
<select
|
|
158
|
+
name=${ifDefined(attributes.name)}
|
|
159
|
+
id=${ifDefined(attributes.id)}
|
|
160
|
+
data-holder
|
|
161
|
+
?required=${attributes.required}
|
|
162
|
+
?multiple=${attributes.multiple}
|
|
163
|
+
autocomplete=${ifDefined(attributes.autocomplete)}
|
|
164
|
+
@change=${attributes.onChange}
|
|
165
|
+
>
|
|
166
|
+
${!(attributes.multiple || attributes.autocomplete) ? html`
|
|
167
|
+
<option value="" ?selected=${value === ""}>
|
|
168
|
+
${attributes.placeholder || '-'}
|
|
169
|
+
</option>
|
|
170
|
+
` : ''}
|
|
171
|
+
${(attributes.range || []).map(el => html`
|
|
172
|
+
<option
|
|
173
|
+
value=${el.value}
|
|
174
|
+
?selected=${!attributes.multiple ? value === el.selectedValue : attributes.values.includes(el.selectedValue)}
|
|
175
|
+
>
|
|
176
|
+
${el.label}
|
|
177
|
+
</option>
|
|
178
|
+
`)}
|
|
179
|
+
${Object.entries(attributes.enum || []).map(_ref => {
|
|
180
|
+
let [key, val] = _ref;
|
|
181
|
+
return html`
|
|
182
|
+
<option
|
|
183
|
+
value="${key}"
|
|
184
|
+
?selected=${!attributes.multiple ? value === key : attributes.values.includes(key)}
|
|
185
|
+
>
|
|
186
|
+
${val}
|
|
187
|
+
</option>
|
|
188
|
+
`;
|
|
189
|
+
})}
|
|
190
|
+
</select>
|
|
191
|
+
`,
|
|
192
|
+
dependencies: [FormDropdownMixin, FormMixin, RangeMixin]
|
|
193
|
+
},
|
|
194
|
+
radio: {
|
|
195
|
+
template: (value, attributes) => html`
|
|
196
|
+
<div
|
|
197
|
+
name=${ifDefined(attributes.name)}
|
|
198
|
+
>
|
|
199
|
+
${(attributes.range || []).map(el => html`
|
|
200
|
+
<label>
|
|
201
|
+
<input
|
|
202
|
+
type="radio"
|
|
203
|
+
name=${ifDefined(attributes.id)}
|
|
204
|
+
value=${el.value}
|
|
205
|
+
?required=${attributes.required}
|
|
206
|
+
?checked=${value === el.selectedValue}
|
|
207
|
+
> <span>${el.label}</span>
|
|
208
|
+
</label>
|
|
209
|
+
`)}
|
|
210
|
+
${Object.entries(attributes.enum || []).map(_ref2 => {
|
|
211
|
+
let [key, val] = _ref2;
|
|
212
|
+
return html`
|
|
213
|
+
<label>
|
|
214
|
+
<input
|
|
215
|
+
type="radio"
|
|
216
|
+
value="${key}"
|
|
217
|
+
name=${ifDefined(attributes.id)}
|
|
218
|
+
?required=${attributes.required}
|
|
219
|
+
?checked=${value === key}
|
|
220
|
+
> <span>${val}</span>
|
|
221
|
+
</label>
|
|
222
|
+
`;
|
|
223
|
+
})}
|
|
224
|
+
`,
|
|
225
|
+
dependencies: [FormRadioMixin, FormMixin, RangeMixin]
|
|
226
|
+
},
|
|
227
|
+
multicheckbox: {
|
|
228
|
+
template: (_value, attributes) => html`
|
|
229
|
+
<div
|
|
230
|
+
name=${ifDefined(attributes.name)}
|
|
231
|
+
>
|
|
232
|
+
${(attributes.range || []).map(el => html`
|
|
233
|
+
<label>
|
|
234
|
+
<input
|
|
235
|
+
type="checkbox"
|
|
236
|
+
value=${el.value}
|
|
237
|
+
?checked=${attributes.values.includes(el.selectedValue)}
|
|
238
|
+
/> <span>${el.label}</span>
|
|
239
|
+
</label>
|
|
240
|
+
`)}
|
|
241
|
+
${Object.entries(attributes.enum || []).map(_ref3 => {
|
|
242
|
+
let [key, val] = _ref3;
|
|
243
|
+
return html`
|
|
244
|
+
<label>
|
|
245
|
+
<input type="checkbox"
|
|
246
|
+
value="${key}"
|
|
247
|
+
/> <span>${val}</span>
|
|
248
|
+
</label>
|
|
249
|
+
`;
|
|
250
|
+
})}
|
|
251
|
+
</select>
|
|
252
|
+
`,
|
|
253
|
+
dependencies: [FormCheckboxesMixin, FormMixin, RangeMixin]
|
|
254
|
+
},
|
|
255
|
+
checkboxes: {
|
|
256
|
+
template: (_value, attributes) => html`
|
|
257
|
+
<solid-form-multicheckbox
|
|
258
|
+
data-holder
|
|
259
|
+
name=${ifDefined(attributes.name)}
|
|
260
|
+
range=${ifDefined(attributes.range)}
|
|
261
|
+
enum=${ifDefined(attributes.enum)}
|
|
262
|
+
values=${ifDefined(attributes.values)}
|
|
263
|
+
order-asc=${ifDefined(attributes.orderAsc)}
|
|
264
|
+
order-desc=${ifDefined(attributes.orderDesc)}
|
|
265
|
+
?required=${attributes.required}
|
|
266
|
+
></solid-form-multicheckbox>
|
|
267
|
+
`,
|
|
268
|
+
dependencies: [MultipleselectFormMixin, FormMixin]
|
|
269
|
+
},
|
|
270
|
+
multiple: {
|
|
271
|
+
template: (_value, attributes) => html`
|
|
272
|
+
${(attributes.children || []).map((child, index) => html`
|
|
273
|
+
<div data-index=${attributes.name + index}>
|
|
274
|
+
${child}
|
|
275
|
+
<button type="button" class=${ifDefined(attributes.removeClass)} @click=${() => attributes.removeItem(index)}>${attributes.removeLabel}</button>
|
|
276
|
+
</div>
|
|
277
|
+
`)}
|
|
278
|
+
<button type="button" class=${ifDefined(attributes.addClass)} @click=${attributes.addItem}>${attributes.addLabel}</button>
|
|
279
|
+
`,
|
|
280
|
+
dependencies: [MultipleFormMixin, FormMixin]
|
|
281
|
+
},
|
|
282
|
+
multipleselect: {
|
|
283
|
+
template: (_value, attributes) => html`
|
|
284
|
+
<solid-form-dropdown
|
|
285
|
+
data-holder
|
|
286
|
+
name=${ifDefined(attributes.name)}
|
|
287
|
+
data-id=${ifDefined(attributes.id)}
|
|
288
|
+
range=${ifDefined(attributes.range)}
|
|
289
|
+
values=${ifDefined(attributes.values)}
|
|
290
|
+
order-asc=${ifDefined(attributes.orderAsc)}
|
|
291
|
+
order-desc=${ifDefined(attributes.orderDesc)}
|
|
292
|
+
?required=${attributes.required}
|
|
293
|
+
multiple
|
|
294
|
+
></solid-form-dropdown>
|
|
295
|
+
`,
|
|
296
|
+
dependencies: [MultipleselectFormMixin, FormMixin]
|
|
297
|
+
},
|
|
298
|
+
file: {
|
|
299
|
+
template: (value, attributes) => html`
|
|
300
|
+
<div>
|
|
301
|
+
<input
|
|
302
|
+
data-holder
|
|
303
|
+
type="text"
|
|
304
|
+
?required=${attributes.required}
|
|
305
|
+
name=${ifDefined(attributes.name)}
|
|
306
|
+
value=${value || ''}
|
|
307
|
+
>
|
|
308
|
+
<input
|
|
309
|
+
type="file"
|
|
310
|
+
id=${ifDefined(attributes.id)}
|
|
311
|
+
value=${ifDefined(attributes.fileValue)}
|
|
312
|
+
@change=${attributes.selectFile}
|
|
313
|
+
/>
|
|
314
|
+
<button
|
|
315
|
+
?hidden=${attributes.resetButtonHidden}
|
|
316
|
+
@click=${attributes.resetFile}
|
|
317
|
+
>×</button>
|
|
318
|
+
<span>${attributes.output}</span>
|
|
319
|
+
</div>
|
|
320
|
+
`,
|
|
321
|
+
dependencies: [FormFileMixin, FormMixin]
|
|
322
|
+
},
|
|
323
|
+
image: {
|
|
324
|
+
template: (value, attributes) => html`
|
|
325
|
+
<div>
|
|
326
|
+
<input
|
|
327
|
+
data-holder
|
|
328
|
+
type="text"
|
|
329
|
+
name=${ifDefined(attributes.name)}
|
|
330
|
+
value=${value || ''}
|
|
331
|
+
?required=${attributes.required}
|
|
332
|
+
>
|
|
333
|
+
<input
|
|
334
|
+
type="file"
|
|
335
|
+
accept="image/*"
|
|
336
|
+
id=${ifDefined(attributes.id)}
|
|
337
|
+
value=${ifDefined(attributes.fileValue)}
|
|
338
|
+
@change=${attributes.selectFile}
|
|
339
|
+
/>
|
|
340
|
+
<img
|
|
341
|
+
src=${value || ''}
|
|
342
|
+
?hidden=${value === ''}
|
|
343
|
+
/>
|
|
344
|
+
<button
|
|
345
|
+
?hidden=${attributes.resetButtonHidden}
|
|
346
|
+
@click=${attributes.resetFile}
|
|
347
|
+
>×</button>
|
|
348
|
+
<span>${attributes.output}</span>
|
|
349
|
+
</div>
|
|
350
|
+
`,
|
|
351
|
+
dependencies: [FormFileMixin, FormMixin]
|
|
352
|
+
},
|
|
353
|
+
richtext: {
|
|
354
|
+
template: (_value, attributes) => html`
|
|
355
|
+
<div
|
|
356
|
+
data-richtext
|
|
357
|
+
name=${ifDefined(attributes.name)}
|
|
358
|
+
data-holder
|
|
359
|
+
></div>
|
|
360
|
+
`,
|
|
361
|
+
dependencies: [ValueRichtextMixin, FormMixin]
|
|
362
|
+
},
|
|
363
|
+
color: {
|
|
364
|
+
template: (_value, attributes) => html`
|
|
365
|
+
<input
|
|
366
|
+
type="color"
|
|
367
|
+
placeholder=${ifDefined(attributes.placeholder)}
|
|
368
|
+
id=${ifDefined(attributes.id)}
|
|
369
|
+
name=${ifDefined(attributes.name)}
|
|
370
|
+
?required=${attributes.required}
|
|
371
|
+
value=${ifDefined(attributes.originalValue)}
|
|
372
|
+
data-holder
|
|
373
|
+
@change=${attributes.onChange}
|
|
374
|
+
/>
|
|
375
|
+
`,
|
|
376
|
+
dependencies: [FormMixin]
|
|
377
|
+
},
|
|
378
|
+
email: {
|
|
379
|
+
template: (value, attributes) => html`
|
|
380
|
+
<input
|
|
381
|
+
type="email"
|
|
382
|
+
placeholder=${ifDefined(attributes.placeholder)}
|
|
383
|
+
id=${ifDefined(attributes.id)}
|
|
384
|
+
name=${ifDefined(attributes.name)}
|
|
385
|
+
value=${value || ''}
|
|
386
|
+
?required=${attributes.required}
|
|
387
|
+
data-holder
|
|
388
|
+
maxlength=${ifDefined(attributes.maxlength)}
|
|
389
|
+
minlength=${ifDefined(attributes.minlength)}
|
|
390
|
+
@change=${attributes.onChange}
|
|
391
|
+
/>
|
|
392
|
+
`,
|
|
393
|
+
dependencies: [FormMixin, FormLengthMixin]
|
|
394
|
+
},
|
|
395
|
+
password: {
|
|
396
|
+
template: (value, attributes) => html`
|
|
397
|
+
<input
|
|
398
|
+
type="password"
|
|
399
|
+
placeholder=${ifDefined(attributes.placeholder)}
|
|
400
|
+
id=${ifDefined(attributes.id)}
|
|
401
|
+
name=${ifDefined(attributes.name)}
|
|
402
|
+
value=${value || ''}
|
|
403
|
+
?required=${attributes.required}
|
|
404
|
+
pattern=${ifDefined(attributes.pattern)}
|
|
405
|
+
title=${ifDefined(attributes.title)}
|
|
406
|
+
data-holder
|
|
407
|
+
maxlength=${ifDefined(attributes.maxlength)}
|
|
408
|
+
minlength=${ifDefined(attributes.minlength)}
|
|
409
|
+
@change=${attributes.onChange}
|
|
410
|
+
/>
|
|
411
|
+
`,
|
|
412
|
+
dependencies: [FormMixin, PatternMixin, FormLengthMixin]
|
|
413
|
+
},
|
|
414
|
+
time: {
|
|
415
|
+
template: (value, attributes) => html`
|
|
416
|
+
<input
|
|
417
|
+
type="time"
|
|
418
|
+
placeholder=${ifDefined(attributes.placeholder)}
|
|
419
|
+
name=${ifDefined(attributes.name)}
|
|
420
|
+
id=${ifDefined(attributes.id)}
|
|
421
|
+
value=${value || ''}
|
|
422
|
+
min=${ifDefined(attributes.min)}
|
|
423
|
+
max=${ifDefined(attributes.max)}
|
|
424
|
+
step=${ifDefined(attributes.step)}
|
|
425
|
+
?required=${attributes.required}
|
|
426
|
+
data-holder
|
|
427
|
+
@change=${attributes.onChange}
|
|
428
|
+
/>
|
|
429
|
+
`,
|
|
430
|
+
dependencies: [FormMixin, FormMinMaxMixin, FormStepMixin]
|
|
431
|
+
}
|
|
432
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { html } from '../../_snowpack/pkg/lit-html.js';
|
|
2
|
+
import { SetMixin } from '../templatesDependencies/setMixin.js';
|
|
3
|
+
export const groupTemplates = {
|
|
4
|
+
default: {
|
|
5
|
+
template: value => html`
|
|
6
|
+
<span>${value}</span>
|
|
7
|
+
<div data-content></div>
|
|
8
|
+
`,
|
|
9
|
+
dependencies: [SetMixin]
|
|
10
|
+
}
|
|
11
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { defaultTemplates } from './defaultTemplatesDirectory.js';
|
|
2
|
+
import { displayTemplates } from './displayTemplatesDirectory.js';
|
|
3
|
+
import { formTemplates } from './formTemplatesDirectory.js';
|
|
4
|
+
import { setTemplates } from './setTemplatesDirectory.js';
|
|
5
|
+
import { groupTemplates } from './groupTemplatesDirectory.js';
|
|
6
|
+
export { defaultTemplates, displayTemplates, formTemplates, setTemplates, groupTemplates };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { html } from '../../_snowpack/pkg/lit-html.js';
|
|
2
|
+
import { SetMixin } from '../templatesDependencies/setMixin.js';
|
|
3
|
+
export const setTemplates = {
|
|
4
|
+
default: {
|
|
5
|
+
template: () => html``,
|
|
6
|
+
dependencies: [SetMixin]
|
|
7
|
+
},
|
|
8
|
+
div: {
|
|
9
|
+
template: () => html`<div data-content></div>`,
|
|
10
|
+
dependencies: [SetMixin]
|
|
11
|
+
},
|
|
12
|
+
ul: {
|
|
13
|
+
template: () => html`<ul data-content></ul>`,
|
|
14
|
+
dependencies: [SetMixin]
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { StoreMixin } from '../../mixins/storeMixin.js';
|
|
2
|
+
import { store } from '../../libs/store/store.js';
|
|
3
|
+
import { html } from '../../_snowpack/pkg/lit-html.js';
|
|
4
|
+
const EditableMixin = {
|
|
5
|
+
name: 'editable-mixin',
|
|
6
|
+
use: [StoreMixin],
|
|
7
|
+
// used to get context
|
|
8
|
+
attributes: {
|
|
9
|
+
editable: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: null,
|
|
12
|
+
callback: function (newValue) {
|
|
13
|
+
if (newValue !== null) this.listAttributes['editable'] = true;
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
valueId: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: ''
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
created() {
|
|
22
|
+
this.listTemplateAdditions.push(this.addEditButton.bind(this));
|
|
23
|
+
},
|
|
24
|
+
addEditButton(template, listTemplateAdditions) {
|
|
25
|
+
let newTemplate = null;
|
|
26
|
+
if (this.editable !== null) {
|
|
27
|
+
newTemplate = html`
|
|
28
|
+
${template}
|
|
29
|
+
<button @click=${this.activateEditableField.bind(this)}>Modifier</button>
|
|
30
|
+
`;
|
|
31
|
+
}
|
|
32
|
+
const nextProcessor = listTemplateAdditions.shift();
|
|
33
|
+
if (nextProcessor) nextProcessor(newTemplate || template, listTemplateAdditions);
|
|
34
|
+
},
|
|
35
|
+
activateEditableField(e) {
|
|
36
|
+
const editableField = this.element.querySelector('[data-editable]');
|
|
37
|
+
const editButton = e.target;
|
|
38
|
+
|
|
39
|
+
// Set attributes
|
|
40
|
+
editableField.toggleAttribute('contenteditable', true);
|
|
41
|
+
editableField.focus();
|
|
42
|
+
editButton.toggleAttribute('disabled', true);
|
|
43
|
+
|
|
44
|
+
// Save on focusout
|
|
45
|
+
editableField.addEventListener('focusout', () => this.save(editableField, editButton));
|
|
46
|
+
},
|
|
47
|
+
save(editableField, editButton) {
|
|
48
|
+
editableField.toggleAttribute('contenteditable', false);
|
|
49
|
+
editButton.removeAttribute('disabled');
|
|
50
|
+
if (!this.name || !this.valueId) {
|
|
51
|
+
console.warn('Some attributes are missing to perform the update');
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const resource = {};
|
|
55
|
+
resource[this.name] = editableField.innerText;
|
|
56
|
+
resource['@context'] = this.context;
|
|
57
|
+
store.patch(resource, this.valueId);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
export { EditableMixin };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const FilterRangeFormMixin = {
|
|
2
|
+
name: 'filter-range-form-mixin',
|
|
3
|
+
attributes: {
|
|
4
|
+
startValue: {
|
|
5
|
+
type: String,
|
|
6
|
+
default: '',
|
|
7
|
+
callback: function (value) {
|
|
8
|
+
this.addToAttributes(this.getDefaultValue(value), "startValue");
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
endValue: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: '',
|
|
14
|
+
callback: function (value) {
|
|
15
|
+
this.addToAttributes(this.getDefaultValue(value), "endValue");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
getDefaultValue(value) {
|
|
20
|
+
if (value == "today") return new Date().toISOString().split("T")[0];
|
|
21
|
+
return value;
|
|
22
|
+
},
|
|
23
|
+
getValue() {
|
|
24
|
+
if (!this.dataHolder) return [];
|
|
25
|
+
if (this.dataHolder.length !== 2) this.showDataHolderError(2, this.dataHolder.length);
|
|
26
|
+
return [
|
|
27
|
+
// we expect 2 values, one min and one max
|
|
28
|
+
this.getValueFromElement(this.dataHolder[0]), this.getValueFromElement(this.dataHolder[1])];
|
|
29
|
+
},
|
|
30
|
+
get type() {
|
|
31
|
+
return 'range';
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export { FilterRangeFormMixin };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const FormCheckboxesMixin = {
|
|
2
|
+
name: 'form-checkboxes-mixin',
|
|
3
|
+
attributes: {
|
|
4
|
+
values: {
|
|
5
|
+
type: String,
|
|
6
|
+
default: '',
|
|
7
|
+
callback: function (value) {
|
|
8
|
+
if (!value) return;
|
|
9
|
+
try {
|
|
10
|
+
this.listAttributes['values'] = JSON.parse(value);
|
|
11
|
+
} catch (e) {
|
|
12
|
+
console.error(e);
|
|
13
|
+
this.listAttributes['values'] = [];
|
|
14
|
+
}
|
|
15
|
+
this.render();
|
|
16
|
+
this.element.dispatchEvent(new Event('change'));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
created() {
|
|
21
|
+
this.listAttributes['values'] = [];
|
|
22
|
+
},
|
|
23
|
+
getValue() {
|
|
24
|
+
const options = Array.from(this.element.querySelectorAll('input'));
|
|
25
|
+
return options.filter(el => el.checked).map(el => {
|
|
26
|
+
if (!el.value) return null;
|
|
27
|
+
let value = el.value;
|
|
28
|
+
try {
|
|
29
|
+
value = JSON.parse(el.value);
|
|
30
|
+
} catch (e) {}
|
|
31
|
+
return value;
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
get type() {
|
|
35
|
+
return this.enum === '' ? 'resource' : 'string';
|
|
36
|
+
},
|
|
37
|
+
get multiple() {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export { FormCheckboxesMixin };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const FormDropdownMixin = {
|
|
2
|
+
name: 'form-dropdown-mixin',
|
|
3
|
+
attributes: {
|
|
4
|
+
values: {
|
|
5
|
+
// used to set more than 1 value, for multiple select
|
|
6
|
+
type: String,
|
|
7
|
+
default: '',
|
|
8
|
+
callback: function (value) {
|
|
9
|
+
if (value) {
|
|
10
|
+
try {
|
|
11
|
+
this.listAttributes['values'] = JSON.parse(value);
|
|
12
|
+
} catch (e) {
|
|
13
|
+
console.error(e);
|
|
14
|
+
this.listAttributes['values'] = [];
|
|
15
|
+
}
|
|
16
|
+
this.render(); // use render to make sure the dispatch always happen after
|
|
17
|
+
this.dispatchChange();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
dataId: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: '',
|
|
24
|
+
callback: function (newValue) {
|
|
25
|
+
this.addToAttributes(newValue, 'id');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
created() {
|
|
30
|
+
this.listAttributes['values'] = [];
|
|
31
|
+
if (this.multiple) this.listAttributes['multiple'] = true;
|
|
32
|
+
},
|
|
33
|
+
dispatchChange() {
|
|
34
|
+
if (!this.element.querySelector('select')) return;
|
|
35
|
+
this.element.querySelector('select').dispatchEvent(new Event('change'));
|
|
36
|
+
},
|
|
37
|
+
getValue() {
|
|
38
|
+
if (!this.dataHolder) return ''; // no value
|
|
39
|
+
if (!this.multiple) {
|
|
40
|
+
// simple select
|
|
41
|
+
if (this.dataHolder.length > 1) this.showDataHolderError(1, this.dataHolder.length);
|
|
42
|
+
return this.getValueFromElement(this.dataHolder[0]);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// multiple select
|
|
46
|
+
const options = Array.from(this.element.querySelectorAll('option'));
|
|
47
|
+
return options.filter(el => el.selected).map(el => el.value ? JSON.parse(el.value) : null);
|
|
48
|
+
},
|
|
49
|
+
get type() {
|
|
50
|
+
return this.enum === '' ? 'resource' : 'string';
|
|
51
|
+
},
|
|
52
|
+
get multiple() {
|
|
53
|
+
return this.element.hasAttribute('multiple');
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
export { FormDropdownMixin };
|