@startinblox/core 0.17.21-beta.8 → 0.17.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_snowpack/pkg/import-map.json +2 -0
- package/dist/_snowpack/pkg/leaflet.js +14066 -0
- package/dist/_snowpack/pkg/leaflet.js.map +1 -0
- package/dist/_snowpack/pkg/leaflet.js.map.proxy.js +1 -0
- package/dist/_snowpack/pkg/leaflet.markercluster.js +2697 -0
- package/dist/_snowpack/pkg/leaflet.markercluster.js.map +1 -0
- package/dist/_snowpack/pkg/leaflet.markercluster.js.map.proxy.js +1 -0
- package/dist/components/solid-ac-checker.js +10 -3
- package/dist/components/solid-ac-checker.js.map +1 -1
- package/dist/components/solid-display.js +1 -1
- package/dist/components/solid-display.js.map +1 -1
- package/dist/components/solid-form-search.js.map +1 -1
- package/dist/components/solid-map.js +2 -2
- package/dist/components/solid-map.js.map +1 -1
- package/dist/libs/interfaces.js.map +1 -1
- package/dist/libs/store/store.js +10 -70
- package/dist/libs/store/store.js.map +1 -1
- package/dist/mixins/filterMixin.js +61 -2
- package/dist/mixins/filterMixin.js.map +1 -1
- package/dist/mixins/widgetMixin.js +2 -2
- package/dist/mixins/widgetMixin.js.map +1 -1
- package/dist/new-widgets/templates/defaultTemplatesDirectory.js +3 -4
- package/dist/new-widgets/templates/defaultTemplatesDirectory.js.map +1 -1
- package/dist/new-widgets/templates/displayTemplatesDirectory.js +3 -4
- package/dist/new-widgets/templates/displayTemplatesDirectory.js.map +1 -1
- package/dist/new-widgets/templates/formTemplatesDirectory.js +3 -3
- package/dist/new-widgets/templates/formTemplatesDirectory.js.map +1 -1
- package/dist/new-widgets/templatesDependencies/multipleFormMixin.js +0 -18
- package/dist/new-widgets/templatesDependencies/multipleFormMixin.js.map +1 -1
- package/package.json +2 -2
- package/dist/libs/filter.js +0 -214
- package/dist/libs/filter.js.map +0 -1
- package/dist/new-widgets/templatesDependencies/linkTextMixin.js +0 -14
- package/dist/new-widgets/templatesDependencies/linkTextMixin.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { compare, parseFieldsString } from '../libs/helpers.js';
|
|
2
2
|
const FilterMixin = {
|
|
3
3
|
name: 'filter-mixin',
|
|
4
4
|
use: [],
|
|
@@ -55,7 +55,7 @@ const FilterMixin = {
|
|
|
55
55
|
if (this.filteredBy || this.searchFields) {
|
|
56
56
|
if (!this.searchCount.has(context)) this.searchCount.set(context, 1);
|
|
57
57
|
if (!this.searchForm) await this.createFilter(context);
|
|
58
|
-
const filteredResources = await
|
|
58
|
+
const filteredResources = await Promise.all(resources.map(this.matchFilters.bind(this)));
|
|
59
59
|
resources = resources.filter((_v, index) => filteredResources[index]);
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -70,6 +70,56 @@ const FilterMixin = {
|
|
|
70
70
|
await this.populate();
|
|
71
71
|
},
|
|
72
72
|
|
|
73
|
+
async matchValue(subject, query) {
|
|
74
|
+
var _subject$isContainer;
|
|
75
|
+
|
|
76
|
+
if (subject == null && query.value === '') return true; // filter not set and subject not existing -> ignore filter
|
|
77
|
+
|
|
78
|
+
if (subject == null) return false; // property does not exist on resource
|
|
79
|
+
// Filter on a container
|
|
80
|
+
|
|
81
|
+
if (query.list) {
|
|
82
|
+
if (query.value.length === 0) return true;
|
|
83
|
+
|
|
84
|
+
for (const v of query.value) {
|
|
85
|
+
const q = {
|
|
86
|
+
type: query.type,
|
|
87
|
+
value: v
|
|
88
|
+
};
|
|
89
|
+
if (await this.matchValue(subject, q)) return true;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if ((_subject$isContainer = subject.isContainer) !== null && _subject$isContainer !== void 0 && _subject$isContainer.call(subject)) {
|
|
96
|
+
let ret = Promise.resolve(query.value === ''); // if no query, return a match
|
|
97
|
+
|
|
98
|
+
for (const value of subject['ldp:contains']) {
|
|
99
|
+
ret = (await ret) || (await this.matchValue(value, query));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return ret;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return compare[query.type](subject, query.value);
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
async matchFilter(resource, filter, query) {
|
|
109
|
+
let fields = [];
|
|
110
|
+
if (this.isSet(filter)) fields = this.getSet(filter);else if (this.isSearchField(filter)) fields = this.getSearchField(filter); // search on 1 field
|
|
111
|
+
|
|
112
|
+
if (fields.length == 0) return this.matchValue(await resource[filter], query); // search on multiple fields
|
|
113
|
+
|
|
114
|
+
return fields.reduce( // return true if it matches at least one of the fields
|
|
115
|
+
async (initial, field) => (await initial) || (await this.matchFilter(resource, field, query)), Promise.resolve(false));
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
async matchFilters(resource) {
|
|
119
|
+
//return true if all filters values are contained in the corresponding field of the resource
|
|
120
|
+
return Object.keys(this.filters).reduce(async (initial, filter) => (await initial) && (await this.matchFilter(resource, filter, this.filters[filter])), Promise.resolve(true));
|
|
121
|
+
},
|
|
122
|
+
|
|
73
123
|
async getValuesOfField(field) {
|
|
74
124
|
const arrayOfDataObjects = this.resource['ldp:contains'];
|
|
75
125
|
const arrayOfDataIds = [];
|
|
@@ -129,6 +179,15 @@ const FilterMixin = {
|
|
|
129
179
|
});
|
|
130
180
|
this.element.insertBefore(this.searchForm, this.element.firstChild);
|
|
131
181
|
await this.searchForm.component.populate();
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
// Search fields
|
|
185
|
+
isSearchField(field) {
|
|
186
|
+
return this.searchForm.hasAttribute('search-' + field);
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
getSearchField(field) {
|
|
190
|
+
return parseFieldsString(this.searchForm.getAttribute('search-' + field));
|
|
132
191
|
}
|
|
133
192
|
|
|
134
193
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["filterMixin.ts"],"names":["searchInResources","FilterMixin","name","use","initialState","searchCount","attributes","searchFields","type","String","default","filteredBy","callback","newValue","searchForm","getAttribute","component","detach","populate","created","Map","element","addEventListener","window","document","contains","updateAutoRanges","attached","listPostProcessors","push","filterCallback","bind","filters","value","filterList","resources","div","context","has","set","createFilter","filteredResources","fields","filter","_v","index","nextProcessor","shift","get","resource","empty","getValuesOfField","field","arrayOfDataObjects","arrayOfDataIds","obj","nextArrayOfObjects","console","warn","nextArrayOfIds","getElementById","createElement","attach","toggleAttribute","searchAttributes","Array","from","attr","startsWith","map","replace","forEach","setAttribute","insertBefore","firstChild"],"mappings":"AACA,SAASA,iBAAT,QAAkC,gBAAlC;AAEA,MAAMC,WAAW,GAAG;AAClBC,EAAAA,IAAI,EAAE,cADY;AAElBC,EAAAA,GAAG,EAAE,EAFa;AAGlBC,EAAAA,YAAY,EAAE;AACZC,IAAAA,WAAW,EAAE;AADD,GAHI;AAMlBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,YAAY,EAAE;AACZC,MAAAA,IAAI,EAAEC,MADM;AAEZC,MAAAA,OAAO,EAAE;AAFG,KADJ;AAKVC,IAAAA,UAAU,EAAE;AACVH,MAAAA,IAAI,EAAEC,MADI;AAEVC,MAAAA,OAAO,EAAE,IAFC;;AAGVE,MAAAA,QAAQ,CAACC,QAAD,EAAmB;AACzB;AACA,YAAIA,QAAQ,IAAI,KAAKC,UAAjB,IAA+BD,QAAQ,KAAK,KAAKC,UAAL,CAAgBC,YAAhB,CAA6B,IAA7B,CAAhD,EAAoF;AAClF,eAAKD,UAAL,CAAgBE,SAAhB,CAA0BC,MAA1B,CAAiC,IAAjC;AACA,eAAKH,UAAL,GAAkB,IAAlB;AACA,eAAKI,QAAL;AACD;AACF;;AAVS;AALF,GANM;;AAwBlBC,EAAAA,OAAO,GAAG;AACR,SAAKd,WAAL,GAAmB,IAAIe,GAAJ,EAAnB;AACA,SAAKC,OAAL,CAAaC,gBAAb,CAA8B,UAA9B,EAA0C,MAAM;AAAA;;AAC9C,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AaoD,YAAb,CAA0B,KAAK3D,UAA/B,EAA2C,KAAKO,OAAL,CAAaqD,UAAxD;AACA,UAAM,KAAK5D,UAAL,CAAgBE,SAAhB,CAA0BE,QAA1B,EAAN;AACD;;AAtHiB,CAApB;AAyHA,SACEjB,WADF","sourcesContent":["import type { SearchQuery } from '../libs/interfaces';\nimport { searchInResources } from '../libs/filter';\n\nconst FilterMixin = {\n name: 'filter-mixin',\n use: [],\n initialState: {\n searchCount: null,\n },\n attributes: {\n searchFields: {\n type: String,\n default: null\n },\n filteredBy: {\n type: String,\n default: null,\n callback(newValue: string) {\n // if we change search form, re-populate\n if (newValue && this.searchForm && newValue !== this.searchForm.getAttribute('id')) {\n this.searchForm.component.detach(this);\n this.searchForm = null;\n this.populate();\n }\n }\n }\n },\n created() {\n this.searchCount = new Map();\n this.element.addEventListener('populate', () => {\n if (!window.document.contains(this.element)) return;\n this.searchForm?.component.updateAutoRanges();\n })\n },\n attached(): void {\n this.listPostProcessors.push(this.filterCallback.bind(this));\n },\n get filters(): SearchQuery {\n return this.searchForm?.component.value ?? {};\n },\n set filters(filters) {\n this.searchForm.component.value = filters;\n this.filterList();\n },\n async filterCallback(resources: object[], listPostProcessors: Function[], div: HTMLElement, context: string): Promise<void> {\n if (this.filteredBy || this.searchFields) {\n if (!this.searchCount.has(context)) this.searchCount.set(context, 1);\n if (!this.searchForm) await this.createFilter(context);\n const filteredResources = await searchInResources(\n resources,\n this.filters,\n this.fields,\n this.searchForm\n );\n resources =\tresources.filter((_v, index) => filteredResources[index]);\n }\n\n const nextProcessor = listPostProcessors.shift();\n if(nextProcessor) await nextProcessor(resources, listPostProcessors, div, context + (this.searchCount.get(context) || ''));\n },\n async filterList(context: string): Promise<void> {\n this.searchCount.set(context, this.searchCount.get(context) + 1);\n if (!this.resource) return;\n this.empty();\n await this.populate();\n },\n async getValuesOfField(field: string) {\n const arrayOfDataObjects = this.resource['ldp:contains'];\n const arrayOfDataIds: string[] = [];\n for (const obj of arrayOfDataObjects) {\n // for each element, if it's an object, catch all elements in 'ldp:contains' key\n const nextArrayOfObjects = await obj[field];\n if (!nextArrayOfObjects) continue;\n\n if (typeof nextArrayOfObjects !== \"object\") {\n console.warn(`The format value of ${field} is not suitable with auto-range-[field] attribute`);\n continue;\n }\n\n const nextArrayOfIds = nextArrayOfObjects['ldp:contains'];\n for (const obj of nextArrayOfIds) {\n // catch each element id\n arrayOfDataIds.push(obj['@id']);\n }\n if (nextArrayOfObjects['@type'] !== 'ldp:Container') {\n // if no element in 'ldp:contains', catch object id\n arrayOfDataIds.push(nextArrayOfObjects['@id']);\n }\n }\n return arrayOfDataIds;\n },\n async createFilter(context: string): Promise<void> {\n const filteredBy = this.filteredBy;\n if (filteredBy != null) {\n this.searchForm = document.getElementById(filteredBy)\n if (!this.searchForm) throw `#${filteredBy} is not in DOM`;\n } else {\n this.searchForm = document.createElement(`solid-form-search`);\n }\n this.searchForm.component.attach(this);\n this.searchForm.addEventListener('formChange', () => {\n this.filterList(context);\n });\n this.searchForm.toggleAttribute('naked', true);\n\n if (filteredBy) return;\n\n //pass attributes to search form\n const searchAttributes = Array.from((this.element as Element).attributes)\n .filter(attr => attr['name'].startsWith('search-'))\n .map(attr => ({\n name: attr['name'].replace('search-', ''),\n value: attr['value'],\n }));\n\n searchAttributes.forEach(({name, value}) => {\n this.searchForm.setAttribute(name, value);\n });\n\n this.element.insertBefore(this.searchForm, this.element.firstChild);\n await this.searchForm.component.populate();\n },\n}\n\nexport {\n FilterMixin\n}"]}
|
|
1
|
+
{"version":3,"sources":["filterMixin.ts"],"names":["compare","parseFieldsString","FilterMixin","name","use","initialState","searchCount","attributes","searchFields","type","String","default","filteredBy","callback","newValue","searchForm","getAttribute","component","detach","populate","created","Map","element","addEventListener","window","document","contains","updateAutoRanges","attached","listPostProcessors","push","filterCallback","bind","filters","value","filterList","resources","div","context","has","set","createFilter","filteredResources","Promise","all","map","matchFilters","filter","_v","index","nextProcessor","shift","get","resource","empty","matchValue","subject","query","list","length","v","q","isContainer","ret","resolve","matchFilter","fields","isSet","getSet","isSearchField","getSearchField","reduce","initial","field","Object","keys","getValuesOfField","arrayOfDataObjects","arrayOfDataIds","obj","nextArrayOfObjects","console","warn","nextArrayOfIds","getElementById","createElement","attach","toggleAttribute","searchAttributes","Array","from","attr","startsWith","replace","forEach","setAttribute","insertBefore","firstChild","hasAttribute"],"mappings":"AAAA,SAASA,OAAT,EAAkBC,iBAAlB,QAA2C,iBAA3C;AAEA,MAAMC,WAAW,GAAG;AAClBC,EAAAA,IAAI,EAAE,cADY;AAElBC,EAAAA,GAAG,EAAE,EAFa;AAGlBC,EAAAA,YAAY,EAAE;AACZC,IAAAA,WAAW,EAAE;AADD,GAHI;AAMlBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,YAAY,EAAE;AACZC,MAAAA,IAAI,EAAEC,MADM;AAEZC,MAAAA,OAAO,EAAE;AAFG,KADJ;AAKVC,IAAAA,UAAU,EAAE;AACVH,MAAAA,IAAI,EAAEC,MADI;AAEVC,MAAAA,OAAO,EAAE,IAFC;;AAGVE,MAAAA,QAAQ,CAACC,QAAD,EAAmB;AACzB;AACA,YAAIA,QAAQ,IAAI,KAAKC,UAAjB,IAA+BD,QAAQ,KAAK,KAAKC,UAAL,CAAgBC,YAAhB,CAA6B,IAA7B,CAAhD,EAAoF;AAClF,eAAKD,UAAL,CAAgBE,SAAhB,CAA0BC,MAA1B,CAAiC,IAAjC;AACA,eAAKH,UAAL,GAAkB,IAAlB;AACA,eAAKI,QAAL;AACD;AACF;;AAVS;AALF,GANM;;AAwBlBC,EAAAA,OAAO,GAAG;AACR,SAAKd,WAAL,GAAmB,IAAIe,GAAJ,EAAnB;AACA,SAAKC,OAAL,CAAaC,gBAAb,CAA8B,UAA9B,EAA0C,MAAM;AAAA;;AAC9C,UAAI,CAACC,MAAM,CAACC,QAAP,CAAgBC,QAAhB,CAAyB,KAAKJ,OAA9B,CAAL,EAA6C;AAC7C,+BAAKP,UAAL,sEAAiBE,SAAjB,C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,EAA0B;AACtC,WAAOxE,iBAAiB,CAAC,KAAKc,UAAL,CAAgBC,YAAhB,CAA6B,YAAYyD,KAAzC,CAAD,CAAxB;AACD;;AAvKiB,CAApB;AA0KA,SACEvE,WADF","sourcesContent":["import { compare, parseFieldsString } from '../libs/helpers';\n\nconst FilterMixin = {\n name: 'filter-mixin',\n use: [],\n initialState: {\n searchCount: null,\n },\n attributes: {\n searchFields: {\n type: String,\n default: null\n },\n filteredBy: {\n type: String,\n default: null,\n callback(newValue: string) {\n // if we change search form, re-populate\n if (newValue && this.searchForm && newValue !== this.searchForm.getAttribute('id')) {\n this.searchForm.component.detach(this);\n this.searchForm = null;\n this.populate();\n }\n }\n }\n },\n created() {\n this.searchCount = new Map();\n this.element.addEventListener('populate', () => {\n if (!window.document.contains(this.element)) return;\n this.searchForm?.component.updateAutoRanges();\n })\n },\n attached(): void {\n this.listPostProcessors.push(this.filterCallback.bind(this));\n },\n get filters(): object {\n return this.searchForm?.component.value ?? {};\n },\n set filters(filters) {\n this.searchForm.component.value = filters;\n this.filterList();\n },\n async filterCallback(resources: object[], listPostProcessors: Function[], div: HTMLElement, context: string): Promise<void> {\n if (this.filteredBy || this.searchFields) {\n if (!this.searchCount.has(context)) this.searchCount.set(context, 1);\n if (!this.searchForm) await this.createFilter(context);\n const filteredResources = await Promise.all(resources.map(this.matchFilters.bind(this)));\n resources =\tresources.filter((_v, index) => filteredResources[index]);\n }\n\n const nextProcessor = listPostProcessors.shift();\n if(nextProcessor) await nextProcessor(resources, listPostProcessors, div, context + (this.searchCount.get(context) || ''));\n },\n async filterList(context: string): Promise<void> {\n this.searchCount.set(context, this.searchCount.get(context) + 1);\n if (!this.resource) return;\n this.empty();\n await this.populate();\n },\n async matchValue(subject, query): Promise<boolean> {\n if (subject == null && query.value === '') return true; // filter not set and subject not existing -> ignore filter\n if (subject == null) return false; // property does not exist on resource\n // Filter on a container\n if (query.list) {\n if(query.value.length === 0) return true;\n for(const v of query.value) {\n const q = {\n type: query.type,\n value: v,\n }\n if(await this.matchValue(subject, q)) return true;\n }\n return false;\n }\n if (subject.isContainer?.()) {\n let ret = Promise.resolve(query.value === ''); // if no query, return a match\n for (const value of subject['ldp:contains']) {\n ret = await ret || await this.matchValue(value, query)\n }\n return ret;\n }\n return compare[query.type](subject, query.value);\n },\n async matchFilter(resource: object, filter: string, query: any): Promise<boolean> {\n let fields: string[] = [];\n if (this.isSet(filter)) fields = this.getSet(filter);\n else if (this.isSearchField(filter)) fields = this.getSearchField(filter);\n\n // search on 1 field\n if (fields.length == 0)\n return this.matchValue(await resource[filter], query);\n\n // search on multiple fields\n return fields.reduce( // return true if it matches at least one of the fields\n async (initial, field) => await initial || await this.matchFilter(resource, field, query),\n Promise.resolve(false),\n );\n },\n async matchFilters(resource: object): Promise<boolean> {\n //return true if all filters values are contained in the corresponding field of the resource\n return Object.keys(this.filters).reduce(\n async (initial, filter) =>\n await initial && await this.matchFilter(resource, filter, this.filters[filter]),\n Promise.resolve(true)\n );\n },\n async getValuesOfField(field: string) {\n const arrayOfDataObjects = this.resource['ldp:contains'];\n const arrayOfDataIds: string[] = [];\n for (const obj of arrayOfDataObjects) {\n // for each element, if it's an object, catch all elements in 'ldp:contains' key\n const nextArrayOfObjects = await obj[field];\n if (!nextArrayOfObjects) continue;\n\n if (typeof nextArrayOfObjects !== \"object\") {\n console.warn(`The format value of ${field} is not suitable with auto-range-[field] attribute`);\n continue;\n }\n\n const nextArrayOfIds = nextArrayOfObjects['ldp:contains'];\n for (const obj of nextArrayOfIds) {\n // catch each element id\n arrayOfDataIds.push(obj['@id']);\n }\n if (nextArrayOfObjects['@type'] !== 'ldp:Container') {\n // if no element in 'ldp:contains', catch object id\n arrayOfDataIds.push(nextArrayOfObjects['@id']);\n }\n }\n return arrayOfDataIds;\n },\n async createFilter(context: string): Promise<void> {\n const filteredBy = this.filteredBy;\n if (filteredBy != null) {\n this.searchForm = document.getElementById(filteredBy)\n if (!this.searchForm) throw `#${filteredBy} is not in DOM`;\n } else {\n this.searchForm = document.createElement(`solid-form-search`);\n }\n this.searchForm.component.attach(this);\n this.searchForm.addEventListener('formChange', () => {\n this.filterList(context);\n });\n this.searchForm.toggleAttribute('naked', true);\n\n if (filteredBy) return;\n\n //pass attributes to search form\n const searchAttributes = Array.from((this.element as Element).attributes)\n .filter(attr => attr['name'].startsWith('search-'))\n .map(attr => ({\n name: attr['name'].replace('search-', ''),\n value: attr['value'],\n }));\n\n searchAttributes.forEach(({name, value}) => {\n this.searchForm.setAttribute(name, value);\n });\n\n this.element.insertBefore(this.searchForm, this.element.firstChild);\n await this.searchForm.component.populate();\n },\n // Search fields\n isSearchField(field: string) {\n return this.searchForm.hasAttribute('search-' + field);\n },\n getSearchField(field: string): string[] {\n return parseFieldsString(this.searchForm.getAttribute('search-' + field));\n },\n}\n\nexport {\n FilterMixin\n}"]}
|
|
@@ -286,7 +286,7 @@ const WidgetMixin = {
|
|
|
286
286
|
};
|
|
287
287
|
const escapedField = this.getEscapedField(field); // transfer all multiple-[field]-[attr] attributes as [attr] for multiple widget [field]
|
|
288
288
|
|
|
289
|
-
const multipleAttributes = ['fields', 'label', 'widget', 'add-label', 'remove-label', 'next', 'empty-widget'
|
|
289
|
+
const multipleAttributes = ['fields', 'label', 'widget', 'add-label', 'remove-label', 'next', 'empty-widget'];
|
|
290
290
|
|
|
291
291
|
for (let attr of multipleAttributes) this.addToAttributes("multiple-".concat(escapedField, "-").concat(attr), attr, attrs); // transfer all [attr]-[field] attributes as [attr] attribute for widget [field]
|
|
292
292
|
|
|
@@ -294,7 +294,7 @@ const WidgetMixin = {
|
|
|
294
294
|
const defaultAttributes = ['range', 'enum', 'label', 'placeholder', 'class',,
|
|
295
295
|
/* 'widget', */
|
|
296
296
|
'required', 'editable', 'autocomplete', 'upload-url', 'option-label', 'option-value', 'order-by', // deprecated. Remove in 0.15
|
|
297
|
-
'each-label', 'order-asc', 'order-desc', 'min', 'max', 'pattern', 'title', 'start-value', 'end-value', 'alt', 'step', 'maxlength', 'minlength', 'search-text', 'search-placeholder'
|
|
297
|
+
'each-label', 'order-asc', 'order-desc', 'min', 'max', 'pattern', 'title', 'start-value', 'end-value', 'alt', 'step', 'maxlength', 'minlength', 'search-text', 'search-placeholder'];
|
|
298
298
|
|
|
299
299
|
for (let attr of defaultAttributes) this.addToAttributes("".concat(attr, "-").concat(escapedField), attr, attrs);
|
|
300
300
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["widgetMixin.ts"],"names":["spread","preHTML","parseFieldsString","findClosingBracketMatchIndex","newWidgetFactory","WidgetType","html","render","ifDefined","WidgetMixin","name","use","attributes","fields","type","String","default","undefined","initialState","nameWidgets","_div","created","attached","dataSrc","resource","noRender","populate","parentElement","div","document","createElement","element","appendChild","value","widgets","map","querySelector","getFields","attr","isContainer","res","console","error","Error","prop","properties","startsWith","push","getAction","field","action","getAttribute","editable","hasAttribute","getSetRegexp","RegExp","getSet","setString","match","firstSetBracket","indexOf","length","lastSetBracket","set","substring","isSet","foundSets","isString","fetchValue","getValue","escapedField","getEscapedField","resourceValue","empty","widgetFromTagName","tagName","CUSTOM","USER","customElements","get","NATIVE","getWidget","widget","defaultWidget","defaultSetWidget","multiple","attribute","defaultMultipleWidget","addToAttributes","lookForAttr","setAttrKey","widgetAttributes","attrs","multipleAttributes","defaultAttributes","addableAttributes","Array","from","filter","a","replace","resourceId","createWidgetTemplate","transformAttributes","createString","createSet","currentResource","widgetMeta","widgetTemplate","class","defineAttribute","setAttribute","setWidget","setAttributes","initializing","Object","keys","component","setFields","hasOnlyEmpty","valueSet","widgetsTemplate","Promise","all","template","slice"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,MAAT,EAAiBC,OAAjB,QAAgC,qBAAhC;AACA,SAASC,iBAAT,EAA4BC,4BAA5B,QAAgE,iBAAhE;AACA,SAASC,gBAAT,QAAiC,mCAAjC;AACA,SAA0BC,UAA1B,QA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'../libs/lit-helpers';\nimport { parseFieldsString, findClosingBracketMatchIndex } from '../libs/helpers';\nimport { newWidgetFactory } from '../new-widgets/new-widget-factory';\nimport { WidgetInterface, WidgetType, Resource } from './interfaces';\nimport { html, render, TemplateResult } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nconst WidgetMixin = {\n name: 'widget-mixin',\n use: [],\n attributes: {\n fields: {\n type: String,\n default: undefined,\n }\n },\n initialState: {\n nameWidgets: null,\n _div: null\n },\n created(): void {\n this.nameWidgets = [];\n },\n attached(): void {\n if (!this.dataSrc && !this.resource && this.noRender === null) this.populate();\n },\n get parentElement(): string {\n return 'div';\n },\n get div(): HTMLElement {\n if (this._div) return this._div;\n this._div = document.createElement(this.parentElement);\n this.element.appendChild(this._div);\n return this._div;\n },\n set div(value) {\n this._div = value\n },\n get widgets() {\n return this.nameWidgets.map((name: string) => this.element.querySelector(`[name=\"${name}\"]`));\n },\n /**\n * Return field list of the component\n */\n async getFields(): Promise<string[]>{ // TODO : improve code\n const attr = this.fields;\n if (attr === '') return [];\n if (attr) return parseFieldsString(attr);\n\n let resource = this.resource as Resource;\n if (resource && resource.isContainer()) { // If container, keep the 1rst resource\n for (let res of resource['ldp:contains']) {\n resource = res;\n break;\n }\n }\n\n if (!this.dataSrc) console.error(new Error('You must provide a \"fields\" attribute'));\n if(!resource) return [];\n\n let fields: string[] = [];\n for (const prop of resource.properties) {\n if ((!prop.startsWith('@') && !(prop === \"permissions\")) && await resource[prop]) fields.push(prop);\n }\n return fields;\n },\n /**\n * return attribute if \"field\" is an action\n * @param field - string\n */\n getAction(field: string): string {\n const action = this.element.getAttribute('action-' + field);\n return action;\n },\n /**\n * return true if \"field\" is editable\n * @param field - string\n */\n editable(field: string): string {\n return this.element.hasAttribute('editable-' + field);\n },\n /**\n * Return regexp to check if \"field\" is a set\n * @param field - string\n */\n getSetRegexp(field: string) {\n return new RegExp(`(^|\\\\,|\\\\(|\\\\s)\\\\s*${field}\\\\s*\\\\(`, 'g')\n },\n /**\n * Return fields contained in set \"field\"\n * @param field - string\n */\n getSet(field: string): string[] {\n const setString = this.fields.match(this.getSetRegexp(field));\n if (!setString) return [];\n const firstSetBracket = this.fields.indexOf(setString[0]) + (setString[0].length) - 1;\n const lastSetBracket = findClosingBracketMatchIndex(this.fields, firstSetBracket);\n const set = this.fields.substring(firstSetBracket + 1, lastSetBracket);\n return parseFieldsString(set);\n },\n /**\n * Return true if \"field\" is a set\n * @param field - string\n */\n isSet(field: string): boolean {\n if (!this.fields) return false;\n let foundSets = this.fields.match(this.getSetRegexp(field));\n return foundSets ? foundSets.length > 0 : false;\n },\n isString(field: string): boolean {\n return field.startsWith('\\'') || field.startsWith('\\\"');\n },\n /**\n * Return the value of \"resource\" for predicate \"field\"\n * @param field - string\n * @param resource - Resource\n */\n async fetchValue(field: string, resource: Resource) {\n return resource && !resource.isContainer() ? await resource[field] : undefined;\n },\n /**\n * Return the value of the field\n * @param field - field\n */\n async getValue(field: string, resource: Resource) {\n const escapedField = this.getEscapedField(field);\n if (this.getAction(escapedField)) {\n return this.getAction(escapedField);\n }\n if (this.element.hasAttribute('value-' + field)) {\n return this.element.getAttribute('value-' + field);\n }\n let resourceValue = await this.fetchValue(field, resource);\n\n // Empty value\n if (resourceValue === undefined || resourceValue === '' || resourceValue === null) // If null or empty, return field default value\n return this.element.hasAttribute('default-' + field) ?\n this.element.getAttribute('default-' + field) : '';\n\n return resourceValue;\n },\n empty(): void {},\n /**\n * Return a widget from a tagName, and create it if necessary\n * @param tagName - string\n */\n widgetFromTagName(tagName: string) {\n let type = tagName.startsWith('solid') ? WidgetType.CUSTOM : WidgetType.USER;\n if (!customElements.get(tagName)) { // component does not exist\n if (tagName.startsWith('solid')) newWidgetFactory(tagName); // solid- -> create it\n else type = WidgetType.NATIVE; // or use a native tag\n }\n return { tagName, type }; // return tagName\n },\n /**\n * Return widget for field \"field\"\n * @param field - string\n * @param isSet - boolean\n */\n getWidget(field: string, isSet: boolean = false): WidgetInterface {\n const widget = this.element.getAttribute('widget-' + field);\n\n if (widget) return this.widgetFromTagName(widget);\n if (this.getAction(field)) return this.widgetFromTagName('solid-action');\n\n return !isSet ? this.widgetFromTagName(this.defaultWidget) : this.widgetFromTagName(this.defaultSetWidget);\n },\n /**\n * Return multiple widget if \"field\" is a multiple, false if it's not\n * @param field - string\n */\n multiple(field: string): WidgetInterface|null {\n const attribute = 'multiple-' + field;\n if (!this.element.hasAttribute(attribute)) return null;\n const widget = this.element.getAttribute(attribute) || this.defaultMultipleWidget;\n return this.widgetFromTagName(widget);\n },\n /**\n * If attribute \"lookForAttr\" is set on element, add \"attrKey\" to the \"attributes\" list\n * @param lookForAttr - string\n * @param setAttrKey - string\n * @param attributes - object\n */\n addToAttributes(lookForAttr: string, setAttrKey: string, attributes: object) {\n const attribute = this.element.getAttribute(lookForAttr);\n if (attribute == null) return;\n attributes[setAttrKey] = attribute;\n },\n /**\n * Return all the attributes of widget \"field\"\n * @param field - string\n * @param resource - Resource\n */\n widgetAttributes(field: string, resource: Resource): object {\n const attrs = { name: field };\n const escapedField = this.getEscapedField(field);\n\n // transfer all multiple-[field]-[attr] attributes as [attr] for multiple widget [field]\n const multipleAttributes = [\n 'fields',\n 'label',\n 'widget',\n 'add-label',\n 'remove-label',\n 'next', \n 'empty-widget',\n 'add-class',\n 'remove-class'\n ];\n for (let attr of multipleAttributes) this.addToAttributes(`multiple-${escapedField}-${attr}`, attr, attrs)\n\n // transfer all [attr]-[field] attributes as [attr] attribute for widget [field]\n const defaultAttributes = [\n 'range',\n 'enum',\n 'label',\n 'placeholder',\n 'class',\n /* 'widget', */,\n 'required',\n 'editable',\n 'autocomplete',\n 'upload-url',\n 'option-label',\n 'option-value',\n 'order-by', // deprecated. Remove in 0.15\n 'each-label',\n 'order-asc',\n 'order-desc',\n 'min',\n 'max',\n 'pattern',\n 'title',\n 'start-value',\n 'end-value',\n 'alt',\n 'step',\n 'maxlength',\n 'minlength',\n 'search-text',\n 'search-placeholder',\n 'link-text',\n ];\n for (let attr of defaultAttributes) this.addToAttributes(`${attr}-${escapedField}`, attr, attrs)\n\n const addableAttributes: Attr[] = (Array.from(this.element.attributes) as Attr[]).filter((a: Attr) => a.name.startsWith(`addable-${escapedField}`));\n for (let attr of addableAttributes) this.addToAttributes(attr.name, attr.name.replace(`addable-${escapedField}`, 'addable'), attrs)\n\n const resourceId = resource ? resource!['@id'] : null;\n if (this.multiple(escapedField)) attrs['widget'] = this.getWidget(escapedField).tagName;\n if (this.getAction(escapedField) && resourceId) attrs['src'] = this.element.getAttribute('src-' + escapedField) || resourceId;\n if (this.editable(escapedField) && resourceId) attrs['value-id'] = resourceId;\n\n return attrs;\n },\n /**\n * Creates and return a widget for field + add it to the widget list\n * @param field - string\n */\n async createWidgetTemplate(field: string, resource = null, transformAttributes = false): Promise<TemplateResult> {\n if (this.isString(field)) return this.createString(field); // field is a static string\n if (this.isSet(field)) return await this.createSet(field);\n\n const currentResource = resource || this.resource;\n let attributes = this.widgetAttributes(field, currentResource);\n const escapedField = this.getEscapedField(field);\n const widgetMeta = this.multiple(escapedField) || this.getWidget(escapedField);\n let tagName = widgetMeta.tagName;\n let widgetTemplate = html``;\n\n // Set attributes\n let value = await this.getValue(field, currentResource);\n if (widgetMeta.type === WidgetType.NATIVE) { // native widget (ie: h1)\n widgetTemplate = preHTML`\n <${tagName}\n name=\"${ifDefined(attributes.name)}\"\n class=\"${ifDefined(attributes.class)}\"\n >${value}</${tagName}>\n `;\n } else { // custom widget (ie: solid-display-value)\n // Check if value is defined, and if the default widget is needed\n if ((value === null || value === '') && this.element.hasAttribute('default-widget-' + field)) {\n tagName = this.element.getAttribute('default-widget-' + field);\n }\n // Set attributes to the widget\n // setAttribute set a string. Make sure null values are empty\n if (value === null || value === undefined) attributes.value = '';\n if (widgetMeta.type === WidgetType.USER && value['@id']) { // if value is a resource and solid-widget used, set data-src\n attributes['data-src'] = value['@id'];\n } else { // otherwise, set value attribute\n attributes['value'] = value;\n }\n\n // Subscribe widgets if they show a resource\n if (value && value['@id']) attributes['auto-subscribe'] = value['@id'];\n\n // Transform store://XXX attributes\n if (transformAttributes) attributes = await this.transformAttributes(attributes, currentResource);\n\n widgetTemplate = preHTML`<${tagName} ...=${spread(attributes)}></${tagName}>`;\n }\n\n this.nameWidgets.push(field);\n return widgetTemplate;\n },\n defineAttribute(widget: HTMLElement, attribute: string, value: any) {\n if (widget.getAttribute(attribute) !== value) { // if attribute is different than previous one\n widget.setAttribute(attribute, value); // set it\n }\n },\n /**\n * Create a set and add fields to it\n * @param field - string\n */\n async createSet(field: string): Promise<TemplateResult> {\n const setWidget = this.getWidget(field, true);\n\n // Get set attributes\n const attrs = { name: field };\n const setAttributes = [\n 'class',\n 'label'\n ];\n for (let attr of setAttributes) this.addToAttributes(`${attr}-${field}`, attr, attrs);\n\n // Create widget if not already existing\n let widget = this.element.querySelector(`${setWidget.tagName}[name=\"${field}\"]`);\n let initializing = false; // used to render widget only first time\n if (!widget) {\n widget = document.createElement(setWidget.tagName);\n initializing = true;\n }\n for (let name of Object.keys(attrs)) {\n this.defineAttribute(widget, name, attrs[name], setWidget.type);\n }\n if (widget.component && initializing) widget.component.render();\n let setFields = this.getSet(field);\n // Catch widget for the set if all these fields are empty\n if (this.element.hasAttribute('empty-' + field)) {\n let hasOnlyEmpty = true;\n for(let field of setFields) {\n let value: string = await this.getValue(field, this.resource);\n if (value !== '') { // if one not empty\n hasOnlyEmpty = false;\n continue; // break loop\n }\n };\n if(hasOnlyEmpty) { // if only empty values, return empty-widget\n const attributes = this.widgetAttributes(field, this.resource);\n const tagName = this.element.getAttribute(`empty-${field}`);\n const valueSet = this.element.getAttribute(`empty-${field}-value`);\n if (valueSet) attributes.value = valueSet;\n return preHTML`<${tagName} ...=${spread(attributes)}></${tagName}>`;\n };\n }\n\n // Render template\n const widgetsTemplate = await Promise.all(setFields.map((field: string) => this.createWidgetTemplate(field)));\n const template = html`${widgetsTemplate}`;\n render(template, widget.querySelector('[data-content]') || widget);\n return widget;\n },\n createString(value: string): TemplateResult {\n return html`\n <span>${value.slice(1, -1).replace(/\\\\(['\"])/g, '$1')}</span>\n `;\n },\n /**\n * Returns field name without starting \"@\"\n * @param field\n */\n getEscapedField(field: string): string {\n return field.startsWith('@') ? field.slice(1, field.length) : field;\n }\n}\n\nexport {\n WidgetMixin\n}"]}
|
|
1
|
+
{"version":3,"sources":["widgetMixin.ts"],"names":["spread","preHTML","parseFieldsString","findClosingBracketMatchIndex","newWidgetFactory","WidgetType","html","render","ifDefined","WidgetMixin","name","use","attributes","fields","type","String","default","undefined","initialState","nameWidgets","_div","created","attached","dataSrc","resource","noRender","populate","parentElement","div","document","createElement","element","appendChild","value","widgets","map","querySelector","getFields","attr","isContainer","res","console","error","Error","prop","properties","startsWith","push","getAction","field","action","getAttribute","editable","hasAttribute","getSetRegexp","RegExp","getSet","setString","match","firstSetBracket","indexOf","length","lastSetBracket","set","substring","isSet","foundSets","isString","fetchValue","getValue","escapedField","getEscapedField","resourceValue","empty","widgetFromTagName","tagName","CUSTOM","USER","customElements","get","NATIVE","getWidget","widget","defaultWidget","defaultSetWidget","multiple","attribute","defaultMultipleWidget","addToAttributes","lookForAttr","setAttrKey","widgetAttributes","attrs","multipleAttributes","defaultAttributes","addableAttributes","Array","from","filter","a","replace","resourceId","createWidgetTemplate","transformAttributes","createString","createSet","currentResource","widgetMeta","widgetTemplate","class","defineAttribute","setAttribute","setWidget","setAttributes","initializing","Object","keys","component","setFields","hasOnlyEmpty","valueSet","widgetsTemplate","Promise","all","template","slice"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,MAAT,EAAiBC,OAAjB,QAAgC,qBAAhC;AACA,SAASC,iBAAT,EAA4BC,4BAA5B,QAAgE,iBAAhE;AACA,SAASC,gBAAT,QAAiC,mCAAjC;AACA,SAA0BC,UAA1B,QAAsD,cAAtD;AACA,SAASC,IAAT,EAAeC,MAAf,QAA6C,UAA7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D,OAAO,GAAG,KAAK5C,OAAL,CAAaoB,YAAb,iBAAmCF,KAAnC,EAAhB;AACA,cAAMuE,QAAQ,GAAG,KAAKzF,OAAL,CAAaoB,YAAb,iBAAmCF,KAAnC,YAAjB;AACA,YAAIuE,QAAJ,EAAc5G,UAAU,CAACqB,KAAX,GAAmBuF,QAAnB;AACd,eAAOvH,OAAP,qBAAkB0E,OAAlB,EAAiC3E,MAAM,CAACY,UAAD,CAAvC,EAAyD+D,OAAzD;AACD;;AAAA;AACF,KAxCqD,CA0CtD;;;AACA,UAAM8C,eAAe,GAAG,MAAMC,OAAO,CAACC,GAAR,CAAYL,SAAS,CAACnF,GAAV,CAAec,KAAD,IAAmB,KAAKqD,oBAAL,CAA0BrD,KAA1B,CAAjC,CAAZ,CAA9B;AACA,UAAM2E,QAAQ,GAAGtH,IAAH,qBAAUmH,eAAV,CAAd;AACAlH,IAAAA,MAAM,CAACqH,QAAD,EAAW1C,MAAM,CAAC9C,aAAP,CAAqB,gBAArB,KAA0C8C,MAArD,CAAN;AACA,WAAOA,MAAP;AACD,GA/ViB;;AAgWlBsB,EAAAA,YAAY,CAACvE,KAAD,EAAgC;AAC1C,WAAO3B,IAAP,qBACU2B,KAAK,CAAC4F,KAAN,CAAY,CAAZ,EAAe,CAAC,CAAhB,EAAmBzB,OAAnB,CAA2B,WAA3B,EAAwC,IAAxC,CADV;AAGD,GApWiB;;AAqWlB;AACF;AACA;AACA;AACE7B,EAAAA,eAAe,CAACtB,KAAD,EAAwB;AACrC,WAAOA,KAAK,CAACH,UAAN,CAAiB,GAAjB,IAAwBG,KAAK,CAAC4E,KAAN,CAAY,CAAZ,EAAe5E,KAAK,CAACY,MAArB,CAAxB,GAAuDZ,KAA9D;AACD;;AA3WiB,CAApB;AA8WA,SACExC,WADF","sourcesContent":["import { spread, preHTML } from '../libs/lit-helpers';\nimport { parseFieldsString, findClosingBracketMatchIndex } from '../libs/helpers';\nimport { newWidgetFactory } from '../new-widgets/new-widget-factory';\nimport { WidgetInterface, WidgetType, Resource } from './interfaces';\nimport { html, render, TemplateResult } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nconst WidgetMixin = {\n name: 'widget-mixin',\n use: [],\n attributes: {\n fields: {\n type: String,\n default: undefined,\n }\n },\n initialState: {\n nameWidgets: null,\n _div: null\n },\n created(): void {\n this.nameWidgets = [];\n },\n attached(): void {\n if (!this.dataSrc && !this.resource && this.noRender === null) this.populate();\n },\n get parentElement(): string {\n return 'div';\n },\n get div(): HTMLElement {\n if (this._div) return this._div;\n this._div = document.createElement(this.parentElement);\n this.element.appendChild(this._div);\n return this._div;\n },\n set div(value) {\n this._div = value\n },\n get widgets() {\n return this.nameWidgets.map((name: string) => this.element.querySelector(`[name=\"${name}\"]`));\n },\n /**\n * Return field list of the component\n */\n async getFields(): Promise<string[]>{ // TODO : improve code\n const attr = this.fields;\n if (attr === '') return [];\n if (attr) return parseFieldsString(attr);\n\n let resource = this.resource as Resource;\n if (resource && resource.isContainer()) { // If container, keep the 1rst resource\n for (let res of resource['ldp:contains']) {\n resource = res;\n break;\n }\n }\n\n if (!this.dataSrc) console.error(new Error('You must provide a \"fields\" attribute'));\n if(!resource) return [];\n\n let fields: string[] = [];\n for (const prop of resource.properties) {\n if ((!prop.startsWith('@') && !(prop === \"permissions\")) && await resource[prop]) fields.push(prop);\n }\n return fields;\n },\n /**\n * return attribute if \"field\" is an action\n * @param field - string\n */\n getAction(field: string): string {\n const action = this.element.getAttribute('action-' + field);\n return action;\n },\n /**\n * return true if \"field\" is editable\n * @param field - string\n */\n editable(field: string): string {\n return this.element.hasAttribute('editable-' + field);\n },\n /**\n * Return regexp to check if \"field\" is a set\n * @param field - string\n */\n getSetRegexp(field: string) {\n return new RegExp(`(^|\\\\,|\\\\(|\\\\s)\\\\s*${field}\\\\s*\\\\(`, 'g')\n },\n /**\n * Return fields contained in set \"field\"\n * @param field - string\n */\n getSet(field: string): string[] {\n const setString = this.fields.match(this.getSetRegexp(field));\n if (!setString) return [];\n const firstSetBracket = this.fields.indexOf(setString[0]) + (setString[0].length) - 1;\n const lastSetBracket = findClosingBracketMatchIndex(this.fields, firstSetBracket);\n const set = this.fields.substring(firstSetBracket + 1, lastSetBracket);\n return parseFieldsString(set);\n },\n /**\n * Return true if \"field\" is a set\n * @param field - string\n */\n isSet(field: string): boolean {\n if (!this.fields) return false;\n let foundSets = this.fields.match(this.getSetRegexp(field));\n return foundSets ? foundSets.length > 0 : false;\n },\n isString(field: string): boolean {\n return field.startsWith('\\'') || field.startsWith('\\\"');\n },\n /**\n * Return the value of \"resource\" for predicate \"field\"\n * @param field - string\n * @param resource - Resource\n */\n async fetchValue(field: string, resource: Resource) {\n return resource && !resource.isContainer() ? await resource[field] : undefined;\n },\n /**\n * Return the value of the field\n * @param field - field\n */\n async getValue(field: string, resource: Resource) {\n const escapedField = this.getEscapedField(field);\n if (this.getAction(escapedField)) {\n return this.getAction(escapedField);\n }\n if (this.element.hasAttribute('value-' + field)) {\n return this.element.getAttribute('value-' + field);\n }\n let resourceValue = await this.fetchValue(field, resource);\n\n // Empty value\n if (resourceValue === undefined || resourceValue === '' || resourceValue === null) // If null or empty, return field default value\n return this.element.hasAttribute('default-' + field) ?\n this.element.getAttribute('default-' + field) : '';\n\n return resourceValue;\n },\n empty(): void {},\n /**\n * Return a widget from a tagName, and create it if necessary\n * @param tagName - string\n */\n widgetFromTagName(tagName: string) {\n let type = tagName.startsWith('solid') ? WidgetType.CUSTOM : WidgetType.USER;\n if (!customElements.get(tagName)) { // component does not exist\n if (tagName.startsWith('solid')) newWidgetFactory(tagName); // solid- -> create it\n else type = WidgetType.NATIVE; // or use a native tag\n }\n return { tagName, type }; // return tagName\n },\n /**\n * Return widget for field \"field\"\n * @param field - string\n * @param isSet - boolean\n */\n getWidget(field: string, isSet: boolean = false): WidgetInterface {\n const widget = this.element.getAttribute('widget-' + field);\n\n if (widget) return this.widgetFromTagName(widget);\n if (this.getAction(field)) return this.widgetFromTagName('solid-action');\n\n return !isSet ? this.widgetFromTagName(this.defaultWidget) : this.widgetFromTagName(this.defaultSetWidget);\n },\n /**\n * Return multiple widget if \"field\" is a multiple, false if it's not\n * @param field - string\n */\n multiple(field: string): WidgetInterface|null {\n const attribute = 'multiple-' + field;\n if (!this.element.hasAttribute(attribute)) return null;\n const widget = this.element.getAttribute(attribute) || this.defaultMultipleWidget;\n return this.widgetFromTagName(widget);\n },\n /**\n * If attribute \"lookForAttr\" is set on element, add \"attrKey\" to the \"attributes\" list\n * @param lookForAttr - string\n * @param setAttrKey - string\n * @param attributes - object\n */\n addToAttributes(lookForAttr: string, setAttrKey: string, attributes: object) {\n const attribute = this.element.getAttribute(lookForAttr);\n if (attribute == null) return;\n attributes[setAttrKey] = attribute;\n },\n /**\n * Return all the attributes of widget \"field\"\n * @param field - string\n * @param resource - Resource\n */\n widgetAttributes(field: string, resource: Resource): object {\n const attrs = { name: field };\n const escapedField = this.getEscapedField(field);\n\n // transfer all multiple-[field]-[attr] attributes as [attr] for multiple widget [field]\n const multipleAttributes = [\n 'fields',\n 'label',\n 'widget',\n 'add-label',\n 'remove-label',\n 'next', \n 'empty-widget'\n ];\n for (let attr of multipleAttributes) this.addToAttributes(`multiple-${escapedField}-${attr}`, attr, attrs)\n\n // transfer all [attr]-[field] attributes as [attr] attribute for widget [field]\n const defaultAttributes = [\n 'range',\n 'enum',\n 'label',\n 'placeholder',\n 'class',\n /* 'widget', */,\n 'required',\n 'editable',\n 'autocomplete',\n 'upload-url',\n 'option-label',\n 'option-value',\n 'order-by', // deprecated. Remove in 0.15\n 'each-label',\n 'order-asc',\n 'order-desc',\n 'min',\n 'max',\n 'pattern',\n 'title',\n 'start-value',\n 'end-value',\n 'alt',\n 'step',\n 'maxlength',\n 'minlength',\n 'search-text',\n 'search-placeholder',\n ];\n for (let attr of defaultAttributes) this.addToAttributes(`${attr}-${escapedField}`, attr, attrs)\n\n const addableAttributes: Attr[] = (Array.from(this.element.attributes) as Attr[]).filter((a: Attr) => a.name.startsWith(`addable-${escapedField}`));\n for (let attr of addableAttributes) this.addToAttributes(attr.name, attr.name.replace(`addable-${escapedField}`, 'addable'), attrs)\n\n const resourceId = resource ? resource!['@id'] : null;\n if (this.multiple(escapedField)) attrs['widget'] = this.getWidget(escapedField).tagName;\n if (this.getAction(escapedField) && resourceId) attrs['src'] = this.element.getAttribute('src-' + escapedField) || resourceId;\n if (this.editable(escapedField) && resourceId) attrs['value-id'] = resourceId;\n\n return attrs;\n },\n /**\n * Creates and return a widget for field + add it to the widget list\n * @param field - string\n */\n async createWidgetTemplate(field: string, resource = null, transformAttributes = false): Promise<TemplateResult> {\n if (this.isString(field)) return this.createString(field); // field is a static string\n if (this.isSet(field)) return await this.createSet(field);\n\n const currentResource = resource || this.resource;\n let attributes = this.widgetAttributes(field, currentResource);\n const escapedField = this.getEscapedField(field);\n const widgetMeta = this.multiple(escapedField) || this.getWidget(escapedField);\n let tagName = widgetMeta.tagName;\n let widgetTemplate = html``;\n\n // Set attributes\n let value = await this.getValue(field, currentResource);\n if (widgetMeta.type === WidgetType.NATIVE) { // native widget (ie: h1)\n widgetTemplate = preHTML`\n <${tagName}\n name=\"${ifDefined(attributes.name)}\"\n class=\"${ifDefined(attributes.class)}\"\n >${value}</${tagName}>\n `;\n } else { // custom widget (ie: solid-display-value)\n // Check if value is defined, and if the default widget is needed\n if ((value === null || value === '') && this.element.hasAttribute('default-widget-' + field)) {\n tagName = this.element.getAttribute('default-widget-' + field);\n }\n // Set attributes to the widget\n // setAttribute set a string. Make sure null values are empty\n if (value === null || value === undefined) attributes.value = '';\n if (widgetMeta.type === WidgetType.USER && value['@id']) { // if value is a resource and solid-widget used, set data-src\n attributes['data-src'] = value['@id'];\n } else { // otherwise, set value attribute\n attributes['value'] = value;\n }\n\n // Subscribe widgets if they show a resource\n if (value && value['@id']) attributes['auto-subscribe'] = value['@id'];\n\n // Transform store://XXX attributes\n if (transformAttributes) attributes = await this.transformAttributes(attributes, currentResource);\n\n widgetTemplate = preHTML`<${tagName} ...=${spread(attributes)}></${tagName}>`;\n }\n\n this.nameWidgets.push(field);\n return widgetTemplate;\n },\n defineAttribute(widget: HTMLElement, attribute: string, value: any) {\n if (widget.getAttribute(attribute) !== value) { // if attribute is different than previous one\n widget.setAttribute(attribute, value); // set it\n }\n },\n /**\n * Create a set and add fields to it\n * @param field - string\n */\n async createSet(field: string): Promise<TemplateResult> {\n const setWidget = this.getWidget(field, true);\n\n // Get set attributes\n const attrs = { name: field };\n const setAttributes = [\n 'class',\n 'label'\n ];\n for (let attr of setAttributes) this.addToAttributes(`${attr}-${field}`, attr, attrs);\n\n // Create widget if not already existing\n let widget = this.element.querySelector(`${setWidget.tagName}[name=\"${field}\"]`);\n let initializing = false; // used to render widget only first time\n if (!widget) {\n widget = document.createElement(setWidget.tagName);\n initializing = true;\n }\n for (let name of Object.keys(attrs)) {\n this.defineAttribute(widget, name, attrs[name], setWidget.type);\n }\n if (widget.component && initializing) widget.component.render();\n let setFields = this.getSet(field);\n // Catch widget for the set if all these fields are empty\n if (this.element.hasAttribute('empty-' + field)) {\n let hasOnlyEmpty = true;\n for(let field of setFields) {\n let value: string = await this.getValue(field, this.resource);\n if (value !== '') { // if one not empty\n hasOnlyEmpty = false;\n continue; // break loop\n }\n };\n if(hasOnlyEmpty) { // if only empty values, return empty-widget\n const attributes = this.widgetAttributes(field, this.resource);\n const tagName = this.element.getAttribute(`empty-${field}`);\n const valueSet = this.element.getAttribute(`empty-${field}-value`);\n if (valueSet) attributes.value = valueSet;\n return preHTML`<${tagName} ...=${spread(attributes)}></${tagName}>`;\n };\n }\n\n // Render template\n const widgetsTemplate = await Promise.all(setFields.map((field: string) => this.createWidgetTemplate(field)));\n const template = html`${widgetsTemplate}`;\n render(template, widget.querySelector('[data-content]') || widget);\n return widget;\n },\n createString(value: string): TemplateResult {\n return html`\n <span>${value.slice(1, -1).replace(/\\\\(['\"])/g, '$1')}</span>\n `;\n },\n /**\n * Returns field name without starting \"@\"\n * @param field\n */\n getEscapedField(field: string): string {\n return field.startsWith('@') ? field.slice(1, field.length) : field;\n }\n}\n\nexport {\n WidgetMixin\n}"]}
|
|
@@ -9,7 +9,7 @@ function _templateObject2() {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
function _templateObject() {
|
|
12
|
-
const data = _taggedTemplateLiteral(["\n <solid-link\n data-src=", "\n next=", "\n
|
|
12
|
+
const data = _taggedTemplateLiteral(["\n <solid-link\n data-src=", "\n next=", "\n >\n ", "\n </solid-link>\n "]);
|
|
13
13
|
|
|
14
14
|
_templateObject = function () {
|
|
15
15
|
return data;
|
|
@@ -22,11 +22,10 @@ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(
|
|
|
22
22
|
|
|
23
23
|
import { html } from '../../_snowpack/pkg/lit-html.js';
|
|
24
24
|
import { ifDefined } from '../../_snowpack/pkg/lit-html/directives/if-defined.js';
|
|
25
|
-
import { LinkTextMixin } from '../templatesDependencies/linkTextMixin.js';
|
|
26
25
|
export const defaultTemplates = {
|
|
27
26
|
action: {
|
|
28
|
-
template: (value, attributes) => html(_templateObject(), ifDefined(attributes.src), ifDefined(value),
|
|
29
|
-
dependencies: [
|
|
27
|
+
template: (value, attributes) => html(_templateObject(), ifDefined(attributes.src), ifDefined(value), attributes.label == null ? attributes.name || '' : attributes.label),
|
|
28
|
+
dependencies: []
|
|
30
29
|
},
|
|
31
30
|
multiple: {
|
|
32
31
|
template: (value, attributes) => html(_templateObject2(), value || '', ifDefined(attributes.fields), ifDefined(attributes.next), ifDefined(attributes.emptyWidget)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["defaultTemplatesDirectory.ts"],"names":["html","ifDefined","
|
|
1
|
+
{"version":3,"sources":["defaultTemplatesDirectory.ts"],"names":["html","ifDefined","defaultTemplates","action","template","value","attributes","src","label","name","dependencies","multiple","fields","next","emptyWidget"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,IAAT,QAAqB,UAArB;AACA,SAASC,SAAT,QAA0B,gCAA1B;AAEA,OAAO,MAAMC,gBAAgB,GAAG;AAC9BC,EAAAA,MAAM,EAAE;AACNC,IAAAA,QAAQ,EAAE,CAACC,KAAD,EAAgBC,UAAhB,KAAoCN,IAApC,oBAEKC,SAAS,CAACK,UAAU,CAACC,GAAZ,CAFd,EAGCN,SAAS,CAACI,KAAD,CAHV,EAKHC,UAAU,CAACE,KAAX,IAAoB,IAApB,GAA4BF,UAAU,CAACG,IAAX,IAAmB,EAA/C,GAAqDH,UAAU,CAACE,KAL7D,CADJ;AASNE,IAAAA,YAAY,EAAE;AATR,GADsB;AAY9BC,EAAAA,QAAQ,EAAE;AACRP,IAAAA,QAAQ,EAAE,CAACC,KAAD,EAAgBC,UAAhB,KAAoCN,IAApC,qBAEKK,KAAK,IAAI,EAFd,EAGGJ,SAAS,CAACK,UAAU,CAACM,MAAZ,CAHZ,EAICX,SAAS,CAACK,UAAU,CAACO,IAAZ,CAJV,EAKSZ,SAAS,CAACK,UAAU,CAACQ,WAAZ,CALlB,CADF;AASRJ,IAAAA,YAAY,EAAE;AATN;AAZoB,CAAzB","sourcesContent":["import { html } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nexport const defaultTemplates = {\n action: {\n template: (value: string, attributes: any) => html`\n <solid-link\n data-src=${ifDefined(attributes.src)}\n next=${ifDefined(value)}\n >\n ${(attributes.label == null ? (attributes.name || '') : attributes.label)}\n </solid-link>\n `,\n dependencies: []\n },\n multiple: {\n template: (value: string, attributes: any) => html`\n <solid-display\n data-src=${value || ''}\n fields=${ifDefined(attributes.fields)}\n next=${ifDefined(attributes.next)}\n empty-widget=${ifDefined(attributes.emptyWidget)}\n ></solid-display>\n `,\n dependencies: []\n },\n}\n"]}
|
|
@@ -29,7 +29,7 @@ function _templateObject4() {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
function _templateObject3() {
|
|
32
|
-
const data = _taggedTemplateLiteral(["\n <a\n name=", "\n href=", "\n target=", "\n ?data-editable=", "\n
|
|
32
|
+
const data = _taggedTemplateLiteral(["\n <a\n name=", "\n href=", "\n target=", "\n ?data-editable=", "\n >\n ", "\n </a>\n "]);
|
|
33
33
|
|
|
34
34
|
_templateObject3 = function () {
|
|
35
35
|
return data;
|
|
@@ -62,7 +62,6 @@ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(
|
|
|
62
62
|
|
|
63
63
|
import { EditableMixin } from '../templatesDependencies/editableMixin.js';
|
|
64
64
|
import { AltMixin } from '../templatesDependencies/altMixin.js';
|
|
65
|
-
import { LinkTextMixin } from '../templatesDependencies/linkTextMixin.js';
|
|
66
65
|
import { html } from '../../_snowpack/pkg/lit-html.js';
|
|
67
66
|
import { ifDefined } from '../../_snowpack/pkg/lit-html/directives/if-defined.js';
|
|
68
67
|
export const displayTemplates = {
|
|
@@ -75,8 +74,8 @@ export const displayTemplates = {
|
|
|
75
74
|
dependencies: [EditableMixin]
|
|
76
75
|
},
|
|
77
76
|
link: {
|
|
78
|
-
template: (value, attributes) => html(_templateObject3(), ifDefined(attributes.name), (attributes.mailto || attributes.tel || '') + (value || '#'), ifDefined(attributes.target), attributes.editable,
|
|
79
|
-
dependencies: [EditableMixin
|
|
77
|
+
template: (value, attributes) => html(_templateObject3(), ifDefined(attributes.name), (attributes.mailto || attributes.tel || '') + (value || '#'), ifDefined(attributes.target), attributes.editable, attributes.label || value || ''),
|
|
78
|
+
dependencies: [EditableMixin]
|
|
80
79
|
},
|
|
81
80
|
img: {
|
|
82
81
|
template: (value, attributes) => html(_templateObject4(), ifDefined(attributes.name), ifDefined(value), ifDefined(attributes.alt)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["displayTemplatesDirectory.ts"],"names":["EditableMixin","AltMixin","
|
|
1
|
+
{"version":3,"sources":["displayTemplatesDirectory.ts"],"names":["EditableMixin","AltMixin","html","ifDefined","displayTemplates","value","template","dependencies","div","attributes","name","editable","link","mailto","tel","target","label","img","alt","boolean"],"mapp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AACM,UAAU,CAACS,GAAZ,CAJT,CADP;AASHX,IAAAA,YAAY,EAAE,CAACN,QAAD;AATX,GA7ByB;AAwC9BkB,EAAAA,OAAO,EAAE;AACPb,IAAAA,QAAQ,EAAE,CAACD,KAAD,EAAgBI,UAAhB,KAAoCP,IAApC,qBACNG,KAAK,KAAK,MAAV,GAAmBH,IAAnB,qBAAiCO,UAAU,CAACO,KAAX,IAAoBP,UAAU,CAACC,IAA/B,IAAuC,EAAxE,IAAuF,EADjF,CADH;AAIPH,IAAAA,YAAY,EAAE;AAJP;AAxCqB,CAAzB","sourcesContent":["import { EditableMixin } from '../templatesDependencies/editableMixin';\nimport { AltMixin } from '../templatesDependencies/altMixin';\n\nimport { html } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nexport const displayTemplates = {\n value: {\n template: (value: string) => html`${value}`,\n dependencies: []\n },\n div: {\n template: (value: string, attributes: any) => html`\n <div\n name=${ifDefined(attributes.name)}\n ?data-editable=${attributes.editable}\n >\n ${value}\n </div>\n `,\n dependencies: [ EditableMixin ]\n },\n link: {\n template: (value: string, attributes: any) => html`\n <a\n name=${ifDefined(attributes.name)}\n href=${(attributes.mailto || attributes.tel || '')+(value || '#')}\n target=${ifDefined(attributes.target)}\n ?data-editable=${attributes.editable}\n >\n ${attributes.label || value || ''}\n </a>\n `,\n dependencies: [ EditableMixin ]\n },\n img: {\n template: (value: string, attributes: any) => html`\n <img\n name=${ifDefined(attributes.name)}\n src=${ifDefined(value)}\n alt=${ifDefined(attributes.alt)}\n style=\"max-width: 100%; max-height: 100%;\"\n />\n `,\n dependencies: [AltMixin]\n },\n boolean: {\n template: (value: string, attributes: any) => html`\n ${value === 'true' ? html`<label>${attributes.label || attributes.name || ''}</label>` : ''}\n `,\n dependencies: []\n },\n}\n"]}
|
|
@@ -79,7 +79,7 @@ function _templateObject22() {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
function _templateObject21() {
|
|
82
|
-
const data = _taggedTemplateLiteral(["\n <div data-index=", ">\n ", "\n <button type=\"button\"
|
|
82
|
+
const data = _taggedTemplateLiteral(["\n <div data-index=", ">\n ", "\n <button type=\"button\" @click=", ">", "</button>\n </div>\n "]);
|
|
83
83
|
|
|
84
84
|
_templateObject21 = function () {
|
|
85
85
|
return data;
|
|
@@ -89,7 +89,7 @@ function _templateObject21() {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
function _templateObject20() {
|
|
92
|
-
const data = _taggedTemplateLiteral(["\n ", "\n <button type=\"button\"
|
|
92
|
+
const data = _taggedTemplateLiteral(["\n ", "\n <button type=\"button\" @click=", ">", "</button>\n "]);
|
|
93
93
|
|
|
94
94
|
_templateObject20 = function () {
|
|
95
95
|
return data;
|
|
@@ -358,7 +358,7 @@ export const formTemplates = {
|
|
|
358
358
|
dependencies: [MultipleselectFormMixin, FormMixin]
|
|
359
359
|
},
|
|
360
360
|
multiple: {
|
|
361
|
-
template: (_value, attributes) => html(_templateObject20(), (attributes.children || []).map((child, index) => html(_templateObject21(), attributes.name + index, child,
|
|
361
|
+
template: (_value, attributes) => html(_templateObject20(), (attributes.children || []).map((child, index) => html(_templateObject21(), attributes.name + index, child, () => attributes.removeItem(index), attributes.removeLabel)), attributes.addItem, attributes.addLabel),
|
|
362
362
|
dependencies: [MultipleFormMixin, FormMixin]
|
|
363
363
|
},
|
|
364
364
|
multipleselect: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["formTemplatesDirectory.ts"],"names":["FormMixin","FormCheckboxMixin","FormMinMaxMixin","FormNumberMixin","FormDropdownMixin","FormCheckboxesMixin","FormRadioMixin","FormFileMixin","MultipleFormMixin","MultipleselectFormMixin","RangeMixin","FilterRangeFormMixin","ValueRichtextMixin","PatternMixin","FormStepMixin","FormLengthMixin","html","ifDefined","formTemplates","text","template","value","attributes","placeholder","name","id","pattern","title","required","autocomplete","maxlength","minlength","onChange","dependencies","textarea","checkbox","label","date","_value","originalValue","rangedate","startValue","endValue","number","min","max","step","rangenumber","hidden","dropdown","multiple","range","map","el","selectedValue","values","includes","Object","entries","enum","key","val","radio","multicheckbox","checkboxes","orderAsc","orderDesc","children","child","index","removeClass","removeItem","removeLabel","addClass","addItem","addLabel","multipleselect","file","fileValue","selectFile","resetButtonHidden","resetFile","output","image","richtext","color","email","password","time"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,SAAT,QAA0B,oCAA1B;AACA,SAASC,iBAAT,QAAkC,4CAAlC;AACA,SAASC,eAAT,QAAgC,0CAAhC;AACA,SAASC,eAAT,QAAgC,0CAAhC;AACA,SAASC,iBAAT,QAAkC,4CAAlC;AACA,SAASC,mBAAT,QAAoC,8CAApC;AACA,SAASC,cAAT,QAA+B,yCAA/B;AACA,SAASC,aAAT,QAA8B,wCAA9B;AACA,SAASC,iBAAT,QAAkC,4CAAlC;AACA,SAASC,uBAAT,QAAwC,kDAAxC;AACA,SAASC,UAAT,QAA2B,qCAA3B;AACA,SAASC,oBAAT,QAAqC,+CAArC;AACA,SAASC,kBAAT,QAAmC,6CAAnC;AACA,SAASC,YAAT,QAA6B,uCAA7B;AACA,SAASC,aAAT,QAA8B,wCAA9B;AACA,SAASC,eAAT,QAAgC,0CAAhC;AAEA,SAASC,IAAT,QAAqB,UAArB;AACA,SAASC,SAAT,QAA0B,gCAA1B;AAEA,OAAO,MAAMC,aAAa,GAAG;AAC3BC,EAAAA,IAAI,EAAE;AACJC,IAAAA,QAAQ,EA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,EAAE,CAACC,KAAD,EAAgBC,UAAhB,KAAoCN,IAApC,sBAGQC,SAAS,CAACK,UAAU,CAACC,WAAZ,CAHjB,EAIDN,SAAS,CAACK,UAAU,CAACG,EAAZ,CAJR,EAKCR,SAAS,CAACK,UAAU,CAACE,IAAZ,CALV,EAMEH,KAAK,IAAI,EANX,EAOMC,UAAU,CAACM,QAPjB,EAQIX,SAAS,CAACK,UAAU,CAACI,OAAZ,CARb,EASET,SAAS,CAACK,UAAU,CAACK,KAAZ,CATX,EAWMV,SAAS,CAACK,UAAU,CAACQ,SAAZ,CAXf,EAYMb,SAAS,CAACK,UAAU,CAACS,SAAZ,CAZf,EAaIT,UAAU,CAACU,QAbf,CADF;AAiBRC,IAAAA,YAAY,EAAE,CAAEjC,SAAF,EAAaa,YAAb,EAA2BE,eAA3B;AAjBN,GAhXiB;AAmY3ByE,EAAAA,IAAI,EAAE;AACJpE,IAAAA,QAAQ,EAAE,CAACC,KAAD,EAAgBC,UAAhB,KAAoCN,IAApC,sBAGQC,SAAS,CAACK,UAAU,CAACC,WAAZ,CAHjB,EAICN,SAAS,CAACK,UAAU,CAACE,IAAZ,CAJV,EAKDP,SAAS,CAACK,UAAU,CAACG,EAAZ,CALR,EAMEJ,KAAK,IAAI,EANX,EAOAJ,SAAS,CAACK,UAAU,CAACsB,GAAZ,CAPT,EAQA3B,SAAS,CAACK,UAAU,CAACuB,GAAZ,CART,EASC5B,SAAS,CAACK,UAAU,CAACwB,IAAZ,CATV,EAUMxB,UAAU,CAACM,QAVjB,EAYIN,UAAU,CAACU,QAZf,CADN;AAgBJC,IAAAA,YAAY,EAAE,CAAEjC,SAAF,EAAaE,eAAb,EAA8BY,aAA9B;AAhBV;AAnYqB,CAAtB","sourcesContent":["import { FormMixin } from '../templatesDependencies/formMixin';\nimport { FormCheckboxMixin } from '../templatesDependencies/formCheckboxMixin';\nimport { FormMinMaxMixin } from '../templatesDependencies/formMinMaxMixin';\nimport { FormNumberMixin } from '../templatesDependencies/formNumberMixin';\nimport { FormDropdownMixin } from '../templatesDependencies/formDropdownMixin';\nimport { FormCheckboxesMixin } from '../templatesDependencies/formCheckboxesMixin';\nimport { FormRadioMixin } from '../templatesDependencies/formRadioMixin';\nimport { FormFileMixin } from '../templatesDependencies/formFileMixin';\nimport { MultipleFormMixin } from '../templatesDependencies/multipleFormMixin';\nimport { MultipleselectFormMixin } from '../templatesDependencies/multipleselectFormMixin';\nimport { RangeMixin } from '../templatesDependencies/rangeMixin';\nimport { FilterRangeFormMixin } from '../templatesDependencies/filterRangeFormMixin';\nimport { ValueRichtextMixin } from '../templatesDependencies/valueRichtextMixin';\nimport { PatternMixin } from '../templatesDependencies/patternMixin';\nimport { FormStepMixin } from '../templatesDependencies/formStepMixin';\nimport { FormLengthMixin } from '../templatesDependencies/formLengthMixin';\n\nimport { html } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nexport const formTemplates = {\n text: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"text\"\n placeholder=${ifDefined(attributes.placeholder)}\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n value=${value || ''}\n pattern=${ifDefined(attributes.pattern)}\n title=${ifDefined(attributes.title)}\n ?required=${attributes.required}\n autocomplete=${ifDefined(attributes.autocomplete)}\n data-holder\n maxlength=${ifDefined(attributes.maxlength)}\n minlength=${ifDefined(attributes.minlength)}\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin, PatternMixin, FormLengthMixin ]\n },\n textarea: {\n template: (value: string, attributes: any) => html`\n <textarea\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n placeholder=${ifDefined(attributes.placeholder)}\n data-holder\n ?required=${attributes.required}\n autocomplete=${ifDefined(attributes.autocomplete)}\n maxlength=${ifDefined(attributes.maxlength)}\n minlength=${ifDefined(attributes.minlength)}\n @change=${attributes.onChange}\n >${value}</textarea>\n `,\n dependencies: [ FormMixin, FormLengthMixin ]\n },\n checkbox: {\n template: (value: string, attributes: any) => html`\n <label>\n <input\n data-holder\n type=\"checkbox\"\n name=${ifDefined(attributes.name)}\n ?required=${attributes.required}\n ?checked=${value === 'true'}\n @change=${attributes.onChange}\n >\n <div>${attributes.label || attributes.name}</div>\n </label>\n `,\n dependencies: [ FormCheckboxMixin, FormMixin ]\n },\n date: {\n template: (_value: string, attributes: any) => html`\n <input\n type=\"date\"\n placeholder=${ifDefined(attributes.placeholder)}\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n ?required=${attributes.required}\n value=${ifDefined(attributes.originalValue)}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin ]\n },\n rangedate: {\n template: (_value: string, attributes: any) => html`\n <input\n data-holder\n type=\"date\"\n name=\"${attributes.name || ''}-start\"\n @change=${attributes.onChange}\n value=${ifDefined(attributes.startValue)}\n />\n <input\n data-holder\n type=\"date\"\n name=\"${attributes.name || ''}-end\"\n @change=${attributes.onChange}\n value=${ifDefined(attributes.endValue)}\n />\n `,\n dependencies: [ FilterRangeFormMixin, FormMixin ]\n },\n number: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"number\"\n placeholder=${ifDefined(attributes.placeholder)}\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n value=${value}\n min=${ifDefined(attributes.min)}\n max=${ifDefined(attributes.max)}\n step=${ifDefined(attributes.step)}\n ?required=${attributes.required}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormNumberMixin, FormMinMaxMixin, FormMixin, FormStepMixin ]\n },\n rangenumber: {\n template: (_value: string, attributes: any) => html`\n <input\n data-holder\n type=\"number\"\n name=\"${attributes.name || ''}-start\"\n @change=${attributes.onChange}\n value=${ifDefined(attributes.startValue)}\n />\n <input\n data-holder\n type=\"number\"\n name=\"${attributes.name || ''}-end\"\n @change=${attributes.onChange}\n value=${ifDefined(attributes.endValue)}\n />\n `,\n dependencies: [ FilterRangeFormMixin, FormNumberMixin, FormMixin ]\n },\n hidden: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"hidden\"\n name=${ifDefined(attributes.name)}\n value=${value}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin ]\n },\n dropdown: {\n template: (value: string, attributes: any) => html`\n <select\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n data-holder\n ?required=${attributes.required}\n ?multiple=${attributes.multiple}\n autocomplete=${ifDefined(attributes.autocomplete)}\n @change=${attributes.onChange}\n >\n ${!(attributes.multiple || attributes.autocomplete) ? html`\n <option value=\"\" ?selected=${value === \"\"}>\n ${attributes.placeholder || '-'}\n </option>\n ` : ''}\n ${(attributes.range || []).map(el => html`\n <option\n value=${el.value}\n ?selected=${!attributes.multiple ? value === el.selectedValue : attributes.values.includes(el.selectedValue)}\n >\n ${el.label}\n </option>\n `)}\n ${Object.entries(attributes.enum || []).map(([key, val]) => html`\n <option\n value=\"${key}\"\n ?selected=${!attributes.multiple ? value === key : attributes.values.includes(key)}\n >\n ${val}\n </option>\n `)}\n </select>\n `,\n dependencies: [ FormDropdownMixin, FormMixin, RangeMixin ]\n },\n radio: {\n template: (value: string, attributes: any) => html`\n <div\n name=${ifDefined(attributes.name)}\n >\n ${(attributes.range || []).map(el => html`\n <label>\n <input\n type=\"radio\"\n name=${ifDefined(attributes.id)}\n value=${el.value}\n ?required=${attributes.required}\n ?checked=${value === el.selectedValue}\n > <span>${el.label}</span>\n </label>\n `)}\n ${Object.entries(attributes.enum || []).map(([key, val]) => html`\n <label>\n <input\n type=\"radio\"\n value=\"${key}\"\n name=${ifDefined(attributes.id)}\n ?required=${attributes.required}\n ?checked=${value === key}\n > <span>${val}</span>\n </label>\n `)}\n `,\n dependencies: [ FormRadioMixin, FormMixin, RangeMixin ]\n },\n multicheckbox: {\n template: (_value: string, attributes: any) => html`\n <div\n name=${ifDefined(attributes.name)}\n >\n ${(attributes.range || []).map(el => html`\n <label>\n <input\n type=\"checkbox\"\n value=${el.value}\n ?checked=${attributes.values.includes(el.selectedValue)}\n /> <span>${el.label}</span>\n </label>\n `)}\n ${Object.entries(attributes.enum || [])\n .map(([key, val]) => html`\n <label>\n <input type=\"checkbox\"\n value=\"${key}\"\n /> <span>${val}</span>\n </label>\n `)}\n </select>\n `,\n dependencies: [ FormCheckboxesMixin, FormMixin, RangeMixin ]\n },\n checkboxes: {\n template: (_value: string, attributes: any) => html`\n <solid-form-multicheckbox\n data-holder\n name=${ifDefined(attributes.name)}\n range=${ifDefined(attributes.range)}\n enum=${ifDefined(attributes.enum)}\n values=${ifDefined(attributes.values)}\n order-asc=${ifDefined(attributes.orderAsc)}\n order-desc=${ifDefined(attributes.orderDesc)}\n ?required=${attributes.required}\n ></solid-form-multicheckbox>\n `,\n dependencies: [ MultipleselectFormMixin, FormMixin ]\n },\n multiple: {\n template: (_value: string, attributes: any) => html`\n ${(attributes.children || []).map((child, index) => html`\n <div data-index=${attributes.name + index}>\n ${child}\n <button type=\"button\" class=${ifDefined(attributes.removeClass)} @click=${() => attributes.removeItem(index)}>${attributes.removeLabel}</button>\n </div>\n `)}\n <button type=\"button\" class=${ifDefined(attributes.addClass)} @click=${attributes.addItem}>${attributes.addLabel}</button>\n `,\n dependencies: [ MultipleFormMixin, FormMixin ]\n },\n multipleselect: {\n template: (_value: string, attributes: any) => html`\n <solid-form-dropdown\n data-holder\n name=${ifDefined(attributes.name)}\n data-id=${ifDefined(attributes.id)}\n range=${ifDefined(attributes.range)}\n values=${ifDefined(attributes.values)}\n order-asc=${ifDefined(attributes.orderAsc)}\n order-desc=${ifDefined(attributes.orderDesc)}\n ?required=${attributes.required}\n multiple\n ></solid-form-dropdown>\n `,\n dependencies: [ MultipleselectFormMixin, FormMixin ]\n },\n file: {\n template: (value: string, attributes: any) => html`\n <div>\n <input\n data-holder\n type=\"text\"\n ?required=${attributes.required}\n name=${ifDefined(attributes.name)}\n value=${value || ''}\n >\n <input\n type=\"file\"\n id=${ifDefined(attributes.id)}\n value=${ifDefined(attributes.fileValue)}\n @change=${attributes.selectFile}\n />\n <button\n ?hidden=${attributes.resetButtonHidden}\n @click=${attributes.resetFile}\n >×</button>\n <span>${attributes.output}</span>\n </div>\n `,\n dependencies: [ FormFileMixin, FormMixin ]\n },\n image: {\n template: (value: string, attributes: any) => html`\n <div>\n <input\n data-holder\n type=\"text\"\n name=${ifDefined(attributes.name)}\n value=${value || ''}\n ?required=${attributes.required}\n >\n <input\n type=\"file\"\n accept=\"image/*\"\n id=${ifDefined(attributes.id)}\n value=${ifDefined(attributes.fileValue)}\n @change=${attributes.selectFile}\n />\n <img\n src=${value || ''}\n ?hidden=${value === ''}\n />\n <button\n ?hidden=${attributes.resetButtonHidden}\n @click=${attributes.resetFile}\n >×</button>\n <span>${attributes.output}</span>\n </div>\n `,\n dependencies: [ FormFileMixin, FormMixin ]\n },\n richtext: {\n template: (_value: string, attributes: any) => html`\n <div \n data-richtext\n name=${ifDefined(attributes.name)}\n data-holder\n ></div>\n `,\n dependencies: [ ValueRichtextMixin, FormMixin ]\n },\n color: {\n template: (_value: string, attributes: any) => html`\n <input\n type=\"color\"\n placeholder=${ifDefined(attributes.placeholder)}\n id=${ifDefined(attributes.id)}\n name=${ifDefined(attributes.name)}\n ?required=${attributes.required}\n value=${ifDefined(attributes.originalValue)}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin ]\n },\n email: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"email\"\n placeholder=${ifDefined(attributes.placeholder)}\n id=${ifDefined(attributes.id)}\n name=${ifDefined(attributes.name)}\n value=${value || ''}\n ?required=${attributes.required}\n data-holder\n maxlength=${ifDefined(attributes.maxlength)}\n minlength=${ifDefined(attributes.minlength)}\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin, FormLengthMixin ]\n },\n password: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"password\"\n placeholder=${ifDefined(attributes.placeholder)}\n id=${ifDefined(attributes.id)}\n name=${ifDefined(attributes.name)}\n value=${value || ''}\n ?required=${attributes.required}\n pattern=${ifDefined(attributes.pattern)}\n title=${ifDefined(attributes.title)}\n data-holder\n maxlength=${ifDefined(attributes.maxlength)}\n minlength=${ifDefined(attributes.minlength)}\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin, PatternMixin, FormLengthMixin ]\n },\n time: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"time\"\n placeholder=${ifDefined(attributes.placeholder)}\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n value=${value || ''}\n min=${ifDefined(attributes.min)}\n max=${ifDefined(attributes.max)}\n step=${ifDefined(attributes.step)}\n ?required=${attributes.required}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin, FormMinMaxMixin, FormStepMixin ]\n },\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["formTemplatesDirectory.ts"],"names":["FormMixin","FormCheckboxMixin","FormMinMaxMixin","FormNumberMixin","FormDropdownMixin","FormCheckboxesMixin","FormRadioMixin","FormFileMixin","MultipleFormMixin","MultipleselectFormMixin","RangeMixin","FilterRangeFormMixin","ValueRichtextMixin","PatternMixin","FormStepMixin","FormLengthMixin","html","ifDefined","formTemplates","text","template","value","attributes","placeholder","name","id","pattern","title","required","autocomplete","maxlength","minlength","onChange","dependencies","textarea","checkbox","label","date","_value","originalValue","rangedate","startValue","endValue","number","min","max","step","rangenumber","hidden","dropdown","multiple","range","map","el","selectedValue","values","includes","Object","entries","enum","key","val","radio","multicheckbox","checkboxes","orderAsc","orderDesc","children","child","index","removeItem","removeLabel","addItem","addLabel","multipleselect","file","fileValue","selectFile","resetButtonHidden","resetFile","output","image","richtext","color","email","password","time"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AjBN,GAhXiB;AAmY3BuE,EAAAA,IAAI,EAAE;AACJlE,IAAAA,QAAQ,EAAE,CAACC,KAAD,EAAgBC,UAAhB,KAAoCN,IAApC,sBAGQC,SAAS,CAACK,UAAU,CAACC,WAAZ,CAHjB,EAICN,SAAS,CAACK,UAAU,CAACE,IAAZ,CAJV,EAKDP,SAAS,CAACK,UAAU,CAACG,EAAZ,CALR,EAMEJ,KAAK,IAAI,EANX,EAOAJ,SAAS,CAACK,UAAU,CAACsB,GAAZ,CAPT,EAQA3B,SAAS,CAACK,UAAU,CAACuB,GAAZ,CART,EASC5B,SAAS,CAACK,UAAU,CAACwB,IAAZ,CATV,EAUMxB,UAAU,CAACM,QAVjB,EAYIN,UAAU,CAACU,QAZf,CADN;AAgBJC,IAAAA,YAAY,EAAE,CAAEjC,SAAF,EAAaE,eAAb,EAA8BY,aAA9B;AAhBV;AAnYqB,CAAtB","sourcesContent":["import { FormMixin } from '../templatesDependencies/formMixin';\nimport { FormCheckboxMixin } from '../templatesDependencies/formCheckboxMixin';\nimport { FormMinMaxMixin } from '../templatesDependencies/formMinMaxMixin';\nimport { FormNumberMixin } from '../templatesDependencies/formNumberMixin';\nimport { FormDropdownMixin } from '../templatesDependencies/formDropdownMixin';\nimport { FormCheckboxesMixin } from '../templatesDependencies/formCheckboxesMixin';\nimport { FormRadioMixin } from '../templatesDependencies/formRadioMixin';\nimport { FormFileMixin } from '../templatesDependencies/formFileMixin';\nimport { MultipleFormMixin } from '../templatesDependencies/multipleFormMixin';\nimport { MultipleselectFormMixin } from '../templatesDependencies/multipleselectFormMixin';\nimport { RangeMixin } from '../templatesDependencies/rangeMixin';\nimport { FilterRangeFormMixin } from '../templatesDependencies/filterRangeFormMixin';\nimport { ValueRichtextMixin } from '../templatesDependencies/valueRichtextMixin';\nimport { PatternMixin } from '../templatesDependencies/patternMixin';\nimport { FormStepMixin } from '../templatesDependencies/formStepMixin';\nimport { FormLengthMixin } from '../templatesDependencies/formLengthMixin';\n\nimport { html } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nexport const formTemplates = {\n text: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"text\"\n placeholder=${ifDefined(attributes.placeholder)}\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n value=${value || ''}\n pattern=${ifDefined(attributes.pattern)}\n title=${ifDefined(attributes.title)}\n ?required=${attributes.required}\n autocomplete=${ifDefined(attributes.autocomplete)}\n data-holder\n maxlength=${ifDefined(attributes.maxlength)}\n minlength=${ifDefined(attributes.minlength)}\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin, PatternMixin, FormLengthMixin ]\n },\n textarea: {\n template: (value: string, attributes: any) => html`\n <textarea\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n placeholder=${ifDefined(attributes.placeholder)}\n data-holder\n ?required=${attributes.required}\n autocomplete=${ifDefined(attributes.autocomplete)}\n maxlength=${ifDefined(attributes.maxlength)}\n minlength=${ifDefined(attributes.minlength)}\n @change=${attributes.onChange}\n >${value}</textarea>\n `,\n dependencies: [ FormMixin, FormLengthMixin ]\n },\n checkbox: {\n template: (value: string, attributes: any) => html`\n <label>\n <input\n data-holder\n type=\"checkbox\"\n name=${ifDefined(attributes.name)}\n ?required=${attributes.required}\n ?checked=${value === 'true'}\n @change=${attributes.onChange}\n >\n <div>${attributes.label || attributes.name}</div>\n </label>\n `,\n dependencies: [ FormCheckboxMixin, FormMixin ]\n },\n date: {\n template: (_value: string, attributes: any) => html`\n <input\n type=\"date\"\n placeholder=${ifDefined(attributes.placeholder)}\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n ?required=${attributes.required}\n value=${ifDefined(attributes.originalValue)}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin ]\n },\n rangedate: {\n template: (_value: string, attributes: any) => html`\n <input\n data-holder\n type=\"date\"\n name=\"${attributes.name || ''}-start\"\n @change=${attributes.onChange}\n value=${ifDefined(attributes.startValue)}\n />\n <input\n data-holder\n type=\"date\"\n name=\"${attributes.name || ''}-end\"\n @change=${attributes.onChange}\n value=${ifDefined(attributes.endValue)}\n />\n `,\n dependencies: [ FilterRangeFormMixin, FormMixin ]\n },\n number: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"number\"\n placeholder=${ifDefined(attributes.placeholder)}\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n value=${value}\n min=${ifDefined(attributes.min)}\n max=${ifDefined(attributes.max)}\n step=${ifDefined(attributes.step)}\n ?required=${attributes.required}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormNumberMixin, FormMinMaxMixin, FormMixin, FormStepMixin ]\n },\n rangenumber: {\n template: (_value: string, attributes: any) => html`\n <input\n data-holder\n type=\"number\"\n name=\"${attributes.name || ''}-start\"\n @change=${attributes.onChange}\n value=${ifDefined(attributes.startValue)}\n />\n <input\n data-holder\n type=\"number\"\n name=\"${attributes.name || ''}-end\"\n @change=${attributes.onChange}\n value=${ifDefined(attributes.endValue)}\n />\n `,\n dependencies: [ FilterRangeFormMixin, FormNumberMixin, FormMixin ]\n },\n hidden: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"hidden\"\n name=${ifDefined(attributes.name)}\n value=${value}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin ]\n },\n dropdown: {\n template: (value: string, attributes: any) => html`\n <select\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n data-holder\n ?required=${attributes.required}\n ?multiple=${attributes.multiple}\n autocomplete=${ifDefined(attributes.autocomplete)}\n @change=${attributes.onChange}\n >\n ${!(attributes.multiple || attributes.autocomplete) ? html`\n <option value=\"\" ?selected=${value === \"\"}>\n ${attributes.placeholder || '-'}\n </option>\n ` : ''}\n ${(attributes.range || []).map(el => html`\n <option\n value=${el.value}\n ?selected=${!attributes.multiple ? value === el.selectedValue : attributes.values.includes(el.selectedValue)}\n >\n ${el.label}\n </option>\n `)}\n ${Object.entries(attributes.enum || []).map(([key, val]) => html`\n <option\n value=\"${key}\"\n ?selected=${!attributes.multiple ? value === key : attributes.values.includes(key)}\n >\n ${val}\n </option>\n `)}\n </select>\n `,\n dependencies: [ FormDropdownMixin, FormMixin, RangeMixin ]\n },\n radio: {\n template: (value: string, attributes: any) => html`\n <div\n name=${ifDefined(attributes.name)}\n >\n ${(attributes.range || []).map(el => html`\n <label>\n <input\n type=\"radio\"\n name=${ifDefined(attributes.id)}\n value=${el.value}\n ?required=${attributes.required}\n ?checked=${value === el.selectedValue}\n > <span>${el.label}</span>\n </label>\n `)}\n ${Object.entries(attributes.enum || []).map(([key, val]) => html`\n <label>\n <input\n type=\"radio\"\n value=\"${key}\"\n name=${ifDefined(attributes.id)}\n ?required=${attributes.required}\n ?checked=${value === key}\n > <span>${val}</span>\n </label>\n `)}\n `,\n dependencies: [ FormRadioMixin, FormMixin, RangeMixin ]\n },\n multicheckbox: {\n template: (_value: string, attributes: any) => html`\n <div\n name=${ifDefined(attributes.name)}\n >\n ${(attributes.range || []).map(el => html`\n <label>\n <input\n type=\"checkbox\"\n value=${el.value}\n ?checked=${attributes.values.includes(el.selectedValue)}\n /> <span>${el.label}</span>\n </label>\n `)}\n ${Object.entries(attributes.enum || [])\n .map(([key, val]) => html`\n <label>\n <input type=\"checkbox\"\n value=\"${key}\"\n /> <span>${val}</span>\n </label>\n `)}\n </select>\n `,\n dependencies: [ FormCheckboxesMixin, FormMixin, RangeMixin ]\n },\n checkboxes: {\n template: (_value: string, attributes: any) => html`\n <solid-form-multicheckbox\n data-holder\n name=${ifDefined(attributes.name)}\n range=${ifDefined(attributes.range)}\n enum=${ifDefined(attributes.enum)}\n values=${ifDefined(attributes.values)}\n order-asc=${ifDefined(attributes.orderAsc)}\n order-desc=${ifDefined(attributes.orderDesc)}\n ?required=${attributes.required}\n ></solid-form-multicheckbox>\n `,\n dependencies: [ MultipleselectFormMixin, FormMixin ]\n },\n multiple: {\n template: (_value: string, attributes: any) => html`\n ${(attributes.children || []).map((child, index) => html`\n <div data-index=${attributes.name + index}>\n ${child}\n <button type=\"button\" @click=${() => attributes.removeItem(index)}>${attributes.removeLabel}</button>\n </div>\n `)}\n <button type=\"button\" @click=${attributes.addItem}>${attributes.addLabel}</button>\n `,\n dependencies: [ MultipleFormMixin, FormMixin ]\n },\n multipleselect: {\n template: (_value: string, attributes: any) => html`\n <solid-form-dropdown\n data-holder\n name=${ifDefined(attributes.name)}\n data-id=${ifDefined(attributes.id)}\n range=${ifDefined(attributes.range)}\n values=${ifDefined(attributes.values)}\n order-asc=${ifDefined(attributes.orderAsc)}\n order-desc=${ifDefined(attributes.orderDesc)}\n ?required=${attributes.required}\n multiple\n ></solid-form-dropdown>\n `,\n dependencies: [ MultipleselectFormMixin, FormMixin ]\n },\n file: {\n template: (value: string, attributes: any) => html`\n <div>\n <input\n data-holder\n type=\"text\"\n ?required=${attributes.required}\n name=${ifDefined(attributes.name)}\n value=${value || ''}\n >\n <input\n type=\"file\"\n id=${ifDefined(attributes.id)}\n value=${ifDefined(attributes.fileValue)}\n @change=${attributes.selectFile}\n />\n <button\n ?hidden=${attributes.resetButtonHidden}\n @click=${attributes.resetFile}\n >×</button>\n <span>${attributes.output}</span>\n </div>\n `,\n dependencies: [ FormFileMixin, FormMixin ]\n },\n image: {\n template: (value: string, attributes: any) => html`\n <div>\n <input\n data-holder\n type=\"text\"\n name=${ifDefined(attributes.name)}\n value=${value || ''}\n ?required=${attributes.required}\n >\n <input\n type=\"file\"\n accept=\"image/*\"\n id=${ifDefined(attributes.id)}\n value=${ifDefined(attributes.fileValue)}\n @change=${attributes.selectFile}\n />\n <img\n src=${value || ''}\n ?hidden=${value === ''}\n />\n <button\n ?hidden=${attributes.resetButtonHidden}\n @click=${attributes.resetFile}\n >×</button>\n <span>${attributes.output}</span>\n </div>\n `,\n dependencies: [ FormFileMixin, FormMixin ]\n },\n richtext: {\n template: (_value: string, attributes: any) => html`\n <div \n data-richtext\n name=${ifDefined(attributes.name)}\n data-holder\n ></div>\n `,\n dependencies: [ ValueRichtextMixin, FormMixin ]\n },\n color: {\n template: (_value: string, attributes: any) => html`\n <input\n type=\"color\"\n placeholder=${ifDefined(attributes.placeholder)}\n id=${ifDefined(attributes.id)}\n name=${ifDefined(attributes.name)}\n ?required=${attributes.required}\n value=${ifDefined(attributes.originalValue)}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin ]\n },\n email: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"email\"\n placeholder=${ifDefined(attributes.placeholder)}\n id=${ifDefined(attributes.id)}\n name=${ifDefined(attributes.name)}\n value=${value || ''}\n ?required=${attributes.required}\n data-holder\n maxlength=${ifDefined(attributes.maxlength)}\n minlength=${ifDefined(attributes.minlength)}\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin, FormLengthMixin ]\n },\n password: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"password\"\n placeholder=${ifDefined(attributes.placeholder)}\n id=${ifDefined(attributes.id)}\n name=${ifDefined(attributes.name)}\n value=${value || ''}\n ?required=${attributes.required}\n pattern=${ifDefined(attributes.pattern)}\n title=${ifDefined(attributes.title)}\n data-holder\n maxlength=${ifDefined(attributes.maxlength)}\n minlength=${ifDefined(attributes.minlength)}\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin, PatternMixin, FormLengthMixin ]\n },\n time: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"time\"\n placeholder=${ifDefined(attributes.placeholder)}\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n value=${value || ''}\n min=${ifDefined(attributes.min)}\n max=${ifDefined(attributes.max)}\n step=${ifDefined(attributes.step)}\n ?required=${attributes.required}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin, FormMinMaxMixin, FormStepMixin ]\n },\n}\n"]}
|
|
@@ -26,22 +26,6 @@ const MultipleFormMixin = {
|
|
|
26
26
|
range: {
|
|
27
27
|
type: String,
|
|
28
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
29
|
}
|
|
46
30
|
},
|
|
47
31
|
|
|
@@ -50,8 +34,6 @@ const MultipleFormMixin = {
|
|
|
50
34
|
this.listAttributes['children'] = [];
|
|
51
35
|
this.listAttributes['addLabel'] = this.addLabel;
|
|
52
36
|
this.listAttributes['removeLabel'] = this.removeLabel;
|
|
53
|
-
this.listAttributes['addClass'] = this.addClass;
|
|
54
|
-
this.listAttributes['removeClass'] = this.removeClass;
|
|
55
37
|
|
|
56
38
|
this.listAttributes['addItem'] = () => {
|
|
57
39
|
this.insertWidget();
|