@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.
Files changed (34) hide show
  1. package/dist/_snowpack/pkg/import-map.json +2 -0
  2. package/dist/_snowpack/pkg/leaflet.js +14066 -0
  3. package/dist/_snowpack/pkg/leaflet.js.map +1 -0
  4. package/dist/_snowpack/pkg/leaflet.js.map.proxy.js +1 -0
  5. package/dist/_snowpack/pkg/leaflet.markercluster.js +2697 -0
  6. package/dist/_snowpack/pkg/leaflet.markercluster.js.map +1 -0
  7. package/dist/_snowpack/pkg/leaflet.markercluster.js.map.proxy.js +1 -0
  8. package/dist/components/solid-ac-checker.js +10 -3
  9. package/dist/components/solid-ac-checker.js.map +1 -1
  10. package/dist/components/solid-display.js +1 -1
  11. package/dist/components/solid-display.js.map +1 -1
  12. package/dist/components/solid-form-search.js.map +1 -1
  13. package/dist/components/solid-map.js +2 -2
  14. package/dist/components/solid-map.js.map +1 -1
  15. package/dist/libs/interfaces.js.map +1 -1
  16. package/dist/libs/store/store.js +10 -70
  17. package/dist/libs/store/store.js.map +1 -1
  18. package/dist/mixins/filterMixin.js +61 -2
  19. package/dist/mixins/filterMixin.js.map +1 -1
  20. package/dist/mixins/widgetMixin.js +2 -2
  21. package/dist/mixins/widgetMixin.js.map +1 -1
  22. package/dist/new-widgets/templates/defaultTemplatesDirectory.js +3 -4
  23. package/dist/new-widgets/templates/defaultTemplatesDirectory.js.map +1 -1
  24. package/dist/new-widgets/templates/displayTemplatesDirectory.js +3 -4
  25. package/dist/new-widgets/templates/displayTemplatesDirectory.js.map +1 -1
  26. package/dist/new-widgets/templates/formTemplatesDirectory.js +3 -3
  27. package/dist/new-widgets/templates/formTemplatesDirectory.js.map +1 -1
  28. package/dist/new-widgets/templatesDependencies/multipleFormMixin.js +0 -18
  29. package/dist/new-widgets/templatesDependencies/multipleFormMixin.js.map +1 -1
  30. package/package.json +2 -2
  31. package/dist/libs/filter.js +0 -214
  32. package/dist/libs/filter.js.map +0 -1
  33. package/dist/new-widgets/templatesDependencies/linkTextMixin.js +0 -14
  34. package/dist/new-widgets/templatesDependencies/linkTextMixin.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["multipleFormMixin.ts"],"names":["StoreMixin","MultipleFormMixin","name","use","attributes","widget","type","String","default","addLabel","callback","value","listAttributes","planRender","removeLabel","range","addClass","undefined","removeClass","created","listValueTransformations","push","setDataSrc","bind","insertWidget","index","element","querySelector","remove","dispatchEvent","Event","bubbles","dataSrc","nextProcessor","shift","populate","resource","document","createElement","Object","keys","toggleAttribute","setAttribute","empty","getValue","dataHolder","Array","from","map","getValueFromElement","multiple"],"mappings":"AAAA,SAASA,UAAT,QAA2B,yBAA3B;AAEA,MAAMC,iBAAiB,GAAG;AACxBC,EAAAA,IAAI,EAAE,qBADkB;AAExBC,EAAAA,GAAG,EAAE,CAAEH,UAAF,CAFmB;AAGxBI,EAAAA,UAAU,EAAE;AACVC,IAAAA,MAAM,EAAE;AACNC,MAAAA,IAAI,EAAEC,MADA;AAENC,MAAAA,OAAO,EAAE;AAFH,KADE;AAKVC,IAAAA,QAAQ,EAAE;AACRH,MAAAA,IAAI,EAAEC,MADE;AAERC,MAAAA,OAAO,EAAE,GAFD;AAGRE,MAAAA,QAAQ,EAAE,UAASC,KAAT,EAAgB;AACxB,YAAIA,KAAK,KAAK,KAAKC,cAAL,CAAoB,UAApB,CAAd,EAA+C,KAAKA,cAAL,CAAoB,UAApB,IAAkCD,KAAlC;AAC/C,aAAKE,UAAL;AACD;AANO,KALA;AAaVC,IAAAA,WAAW,EAAE;AACXR,MAAAA,IAAI,EAAEC,MADK;AAEXC,MAAAA,OAAO,EAAE,GAFE;AAGXE,MAAAA,QAAQ,EAAE,UAASC,KAAT,EAAgB;AACxB,YAAIA,KAAK,KAAK,KAAKC,cAAL,CAAoB,aAApB,CAAd,EAAkD,KAAKA,cAAL,CAAoB,aAApB,IAAqCD,KAArC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P,CAAYpC,UAAZ,CAAjB,EAA0C;AACxC,UAAI,OAAOA,UAAU,CAACF,IAAD,CAAjB,KAA4B,SAAhC,EAA2CG,MAAM,CAACoC,eAAP,CAAuBvC,IAAvB,EAA6BE,UAAU,CAACF,IAAD,CAAvC,EAA3C,KACKG,MAAM,CAACqC,YAAP,CAAoBxC,IAApB,EAA0BE,UAAU,CAACF,IAAD,CAApC;AACN;;AACD,SAAKU,cAAL,CAAoB,UAApB,EAAgCS,IAAhC,CAAqChB,MAArC;AACD,GA7FuB;;AA8FxBsC,EAAAA,KAAK,GAAG;AACN,SAAK/B,cAAL,CAAoB,UAApB,IAAkC,EAAlC;AACA,SAAKC,UAAL;AACD,GAjGuB;;AAkGxB+B,EAAAA,QAAQ,GAAG;AACT,QAAI,CAAC,KAAKC,UAAV,EAAsB,OAAO,EAAP;AACtB,WAAOC,KAAK,CAACC,IAAN,CAAW,KAAKF,UAAhB,EAA4BG,GAA5B,CAAiCtB,OAAD,IAAkB,KAAKuB,mBAAL,CAAyBvB,OAAzB,CAAlD,CAAP;AACD,GArGuB;;AAsGxB,MAAIpB,IAAJ,GAAW;AACT,WAAO,UAAP;AACD,GAxGuB;;AAyGxB,MAAI4C,QAAJ,GAAe;AACb,WAAO,IAAP;AACD;;AA3GuB,CAA1B;AA+GA,SACEjD,iBADF","sourcesContent":["import { StoreMixin } from '../../mixins/storeMixin';\n\nconst MultipleFormMixin = {\n name: 'multiple-form-mixin',\n use: [ StoreMixin ],\n attributes: {\n widget: {\n type: String,\n default: 'solid-form-text'\n },\n addLabel: {\n type: String,\n default: '+',\n callback: function(value) {\n if (value !== this.listAttributes['addLabel']) this.listAttributes['addLabel'] = value;\n this.planRender();\n }\n },\n removeLabel: {\n type: String,\n default: '×',\n callback: function(value) {\n if (value !== this.listAttributes['removeLabel']) this.listAttributes['removeLabel'] = value;\n this.planRender();\n }\n },\n range: {\n type: String,\n default: '',\n \n },\n addClass: {\n type: String,\n default: undefined,\n callback: function(value) {\n if (value !== this.listAttributes['addClass']) this.listAttributes['addClass'] = value;\n this.planRender();\n }\n },\n removeClass: {\n type: String,\n default: undefined,\n callback: function(value) {\n if (value !== this.listAttributes['removeClass']) this.listAttributes['removeClass'] = value;\n this.planRender();\n }\n }\n },\n created() {\n this.listValueTransformations.push(this.setDataSrc.bind(this));\n\n this.listAttributes['children'] = [];\n this.listAttributes['addLabel'] = this.addLabel;\n this.listAttributes['removeLabel'] = this.removeLabel;\n this.listAttributes['addClass'] = this.addClass;\n this.listAttributes['removeClass'] = this.removeClass;\n this.listAttributes['addItem'] = () => {\n this.insertWidget();\n this.planRender();\n };\n this.listAttributes['removeItem'] = (index) => {\n this.element.querySelector(`[data-index=\"${this.name + index}\"]`).remove();\n this.element.dispatchEvent(new Event('change', {bubbles: true}));\n };\n },\n setDataSrc(value: string, listValueTransformations: Function[]) {\n if (value && value !== this.dataSrc) this.dataSrc = value;\n const nextProcessor = listValueTransformations.shift();\n if(nextProcessor) nextProcessor(value, listValueTransformations);\n },\n populate() {\n if (!this.resource || !this.resource['ldp:contains']) return;\n\n this.listAttributes['children'] = []; // reset list\n\n // set value in form\n for (let resource of this.resource['ldp:contains']) { // for each resource\n this.insertWidget(resource['@id']); // create a widget\n }\n this.planRender();\n },\n insertWidget(value: string = '') {\n if (!this.widget) return;\n const widget = document.createElement(this.widget);\n const attributes = {\n 'data-holder': true,\n 'name': this.name,\n 'value': value,\n 'range': this.range\n };\n for (let name of Object.keys(attributes)) {\n if (typeof attributes[name] === \"boolean\") widget.toggleAttribute(name, attributes[name]);\n else widget.setAttribute(name, attributes[name]);\n }\n this.listAttributes['children'].push(widget);\n },\n empty() {\n this.listAttributes['children'] = [];\n this.planRender();\n },\n getValue() {\n if (!this.dataHolder) return [];\n return Array.from(this.dataHolder).map((element: any) => this.getValueFromElement(element));\n },\n get type() {\n return 'resource';\n },\n get multiple() {\n return true;\n }\n\n}\n\nexport {\n MultipleFormMixin\n}"]}
1
+ {"version":3,"sources":["multipleFormMixin.ts"],"names":["StoreMixin","MultipleFormMixin","name","use","attributes","widget","type","String","default","addLabel","callback","value","listAttributes","planRender","removeLabel","range","created","listValueTransformations","push","setDataSrc","bind","insertWidget","index","element","querySelector","remove","dispatchEvent","Event","bubbles","dataSrc","nextProcessor","shift","populate","resource","document","createElement","Object","keys","toggleAttribute","setAttribute","empty","getValue","dataHolder","Array","from","map","getValueFromElement","multiple"],"mappings":"AAAA,SAASA,UAAT,QAA2B,yBAA3B;AAEA,MAAMC,iBAAiB,GAAG;AACxBC,EAAAA,IAAI,EAAE,qBADkB;AAExBC,EAAAA,GAAG,EAAE,CAAEH,UAAF,CAFmB;AAGxBI,EAAAA,UAAU,EAAE;AACVC,IAAAA,MAAM,EAAE;AACNC,MAAAA,IAAI,EAAEC,MADA;AAENC,MAAAA,OAAO,EAAE;AAFH,KADE;AAKVC,IAAAA,QAAQ,EAAE;AACRH,MAAAA,IAAI,EAAEC,MADE;AAERC,MAAAA,OAAO,EAAE,GAFD;AAGRE,MAAAA,QAAQ,EAAE,UAASC,KAAT,EAAgB;AACxB,YAAIA,KAAK,KAAK,KAAKC,cAAL,CAAoB,UAApB,CAAd,EAA+C,KAAKA,cAAL,CAAoB,UAApB,IAAkCD,KAAlC;AAC/C,aAAKE,UAAL;AACD;AANO,KALA;AAaVC,IAAAA,WAAW,EAAE;AACXR,MAAAA,IAAI,EAAEC,MADK;AAEXC,MAAAA,OAAO,EAAE,GAFE;AAGXE,MAAAA,QAAQ,EAAE,UAASC,KAAT,EAAgB;AACxB,YAAIA,KAAK,KAAK,KAAKC,cAAL,CAAoB,aAApB,CAAd,EAAkD,KAAKA,cAAL,CAAoB,aAApB,IAAqCD,KAArC;AAClD,aAAKE,UAAL;AACD;AANU,KAbH;AAqBVE,IAAAA,KAAK,EAAE;AACLT,MAAAA,IAAI,EAAEC,MADD;AAELC,MAAAA,OAAO,EAAE;AAFJ;AArBG,GAHY;;AA6BxBQ,EAAAA,OAAO,GAAG;AACR,SAAKC,wBAAL,CAA8BC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MultipleFormMixin = {\n name: 'multiple-form-mixin',\n use: [ StoreMixin ],\n attributes: {\n widget: {\n type: String,\n default: 'solid-form-text'\n },\n addLabel: {\n type: String,\n default: '+',\n callback: function(value) {\n if (value !== this.listAttributes['addLabel']) this.listAttributes['addLabel'] = value;\n this.planRender();\n }\n },\n removeLabel: {\n type: String,\n default: '×',\n callback: function(value) {\n if (value !== this.listAttributes['removeLabel']) this.listAttributes['removeLabel'] = value;\n this.planRender();\n }\n },\n range: {\n type: String,\n default: '',\n }\n },\n created() {\n this.listValueTransformations.push(this.setDataSrc.bind(this));\n\n this.listAttributes['children'] = [];\n this.listAttributes['addLabel'] = this.addLabel;\n this.listAttributes['removeLabel'] = this.removeLabel;\n this.listAttributes['addItem'] = () => {\n this.insertWidget();\n this.planRender();\n };\n this.listAttributes['removeItem'] = (index) => {\n this.element.querySelector(`[data-index=\"${this.name + index}\"]`).remove();\n this.element.dispatchEvent(new Event('change', {bubbles: true}));\n };\n },\n setDataSrc(value: string, listValueTransformations: Function[]) {\n if (value && value !== this.dataSrc) this.dataSrc = value;\n const nextProcessor = listValueTransformations.shift();\n if(nextProcessor) nextProcessor(value, listValueTransformations);\n },\n populate() {\n if (!this.resource || !this.resource['ldp:contains']) return;\n\n this.listAttributes['children'] = []; // reset list\n\n // set value in form\n for (let resource of this.resource['ldp:contains']) { // for each resource\n this.insertWidget(resource['@id']); // create a widget\n }\n this.planRender();\n },\n insertWidget(value: string = '') {\n if (!this.widget) return;\n const widget = document.createElement(this.widget);\n const attributes = {\n 'data-holder': true,\n 'name': this.name,\n 'value': value,\n 'range': this.range\n };\n for (let name of Object.keys(attributes)) {\n if (typeof attributes[name] === \"boolean\") widget.toggleAttribute(name, attributes[name]);\n else widget.setAttribute(name, attributes[name]);\n }\n this.listAttributes['children'].push(widget);\n },\n empty() {\n this.listAttributes['children'] = [];\n this.planRender();\n },\n getValue() {\n if (!this.dataHolder) return [];\n return Array.from(this.dataHolder).map((element: any) => this.getValueFromElement(element));\n },\n get type() {\n return 'resource';\n },\n get multiple() {\n return true;\n }\n\n}\n\nexport {\n MultipleFormMixin\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startinblox/core",
3
- "version": "0.17.21-beta.8",
3
+ "version": "0.17.23",
4
4
  "description": "This is a series of web component respecting both the web components standards and the Linked Data Platform convention.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -82,7 +82,7 @@
82
82
  "babel-loader": "^8.2.2",
83
83
  "babel-plugin-remove-import-js-extension": "0.0.3",
84
84
  "body-parser": "^1.19.0",
85
- "cypress": "^6.9.1",
85
+ "cypress": "^6.6.0",
86
86
  "cypress-plugin-tab": "^1.0.5",
87
87
  "delta-markdown-for-quill": "0.0.9",
88
88
  "dialog-polyfill": "^0.5.6",
@@ -1,214 +0,0 @@
1
- import { parseFieldsString, findClosingBracketMatchIndex, compare, uniqID } from "./helpers.js";
2
-
3
- /**
4
- * Check if the field is a set
5
- * @param field - field to test
6
- * @param fields - list of fields
7
- * @returns true if the field is a set, false otherwise
8
- */
9
- const isSet = (field, fields) => {
10
- if (!fields) return false;
11
- let foundSets = fields.match(getSetRegexp(field));
12
- return foundSets ? foundSets.length > 0 : false;
13
- };
14
- /**
15
- * Get the list of fields in the set
16
- * @param field - set name to get
17
- * @param fields - list of fields
18
- * @returns a list of fields in the set
19
- */
20
-
21
-
22
- const getSet = (field, fields) => {
23
- const setString = fields.match(getSetRegexp(field));
24
- if (!setString) return [];
25
- const firstSetBracket = fields.indexOf(setString[0]) + setString[0].length - 1;
26
- const lastSetBracket = findClosingBracketMatchIndex(fields, firstSetBracket);
27
- const set = fields.substring(firstSetBracket + 1, lastSetBracket);
28
- return parseFieldsString(set);
29
- };
30
-
31
- const getSetRegexp = field => {
32
- return new RegExp("(^|\\,|\\(|\\s)\\s*".concat(field, "\\s*\\("), 'g');
33
- };
34
- /**
35
- * Check if the field is a special search field
36
- * @param field - field to test
37
- * @param searchForm - current search form
38
- * @returns true if the field is a special search field
39
- */
40
-
41
-
42
- const isSearchField = (field, searchForm) => {
43
- return searchForm.hasAttribute('search-' + field);
44
- };
45
- /**
46
- * Get the fields targetted by a search field
47
- * @param field - search field to get
48
- * @param searchForm - current search form
49
- * @returns a list of fields targetted by the current search field
50
- */
51
-
52
-
53
- const getSearchField = (field, searchForm) => {
54
- return parseFieldsString(searchForm.getAttribute('search-' + field));
55
- };
56
- /**
57
- * Throw or simply return value
58
- * @param throwOn - should throw on True or False
59
- * @param ret - value to return
60
- * @returns
61
- */
62
-
63
-
64
- const orThrow = (throwOn, ret) => {
65
- if (throwOn === true && ret) throw true;
66
- if (throwOn === false && !ret) throw false;
67
- return ret;
68
- };
69
- /**
70
- * Compare a value to the query
71
- * @param val - value to compare
72
- * @param query - object to know how and what value to compare
73
- * @param throwOn - should function throw error on True or False
74
- * @returns true if value matches, throw error otherwise
75
- */
76
-
77
-
78
- const matchValue = async (val, query, throwOn) => {
79
- var _subject$isContainer;
80
-
81
- const subject = await val;
82
- if (subject == null && query.value === '') return orThrow(throwOn, true); // filter not set and subject not existing -> ignore filter
83
-
84
- if (subject == null) return orThrow(throwOn, false); // return false; // property does not exist on resource
85
-
86
- if (query.list) {
87
- // Filter on a container
88
- if (query.value.length === 0) return orThrow(throwOn, true);
89
-
90
- for (const v of query.value) {
91
- if (await matchValue(subject, {
92
- type: query.type,
93
- value: v,
94
- list: false
95
- })) {
96
- // do not throw here, we need the result
97
- return orThrow(throwOn, true);
98
- }
99
- }
100
-
101
- return orThrow(throwOn, false);
102
- }
103
-
104
- if ((_subject$isContainer = subject.isContainer) !== null && _subject$isContainer !== void 0 && _subject$isContainer.call(subject)) {
105
- let ret = Promise.resolve(query.value === ''); // if no query, return a match
106
-
107
- for (const value of subject['ldp:contains']) {
108
- ret = (await ret) || (await matchValue(value, query)); // do not throw here, we need the result
109
-
110
- if (ret) return orThrow(throwOn, true);
111
- }
112
-
113
- return orThrow(throwOn, await ret);
114
- }
115
-
116
- return orThrow(throwOn, compare[query.type](subject, query.value));
117
- };
118
- /**
119
- * Cache properties of a filter to avoid repeated parsing
120
- * @param cacheKey - uniq key
121
- * @param filter - filter to check
122
- * @param fields - fields attribute of the element
123
- * @param searchForm - current search form
124
- */
125
-
126
-
127
- const cacheFieldsProps = (cacheKey, filter, fields, searchForm) => {
128
- if (!window.cachePropsSearchFilter[cacheKey]) {
129
- window.cachePropsSearchFilter[cacheKey] = {
130
- setFields: isSet(filter, fields) ? getSet(filter, fields) : null,
131
- setSearchFields: isSearchField(filter, searchForm) ? getSearchField(filter, searchForm) : null
132
- };
133
- }
134
- };
135
- /**
136
- * Check if one resource match one filter
137
- * @param resource - resource to test
138
- * @param filter - name of the property tested
139
- * @param query - query object to know how to compare values
140
- * @param fields - fields attribute of the element
141
- * @param searchForm - searchForm component
142
- * @param filterId - uniqId used to fill the cache
143
- * @param throwOn - should function throw error on True or False
144
- * @returns return true if the resource matches the filter, throw error otherwise
145
- */
146
-
147
-
148
- const matchFilter = async (resource, filter, query, fieldsAttr, searchForm, filterId, throwOn) => {
149
- let fields = null;
150
- const cacheKey = "".concat(filter, "_").concat(filterId);
151
- cacheFieldsProps(cacheKey, filter, fieldsAttr, searchForm);
152
-
153
- if (window.cachePropsSearchFilter[cacheKey].setFields !== null) {
154
- fields = window.cachePropsSearchFilter[cacheKey].setFields;
155
- } else if (window.cachePropsSearchFilter[cacheKey].setSearchFields !== null) {
156
- fields = window.cachePropsSearchFilter[cacheKey].setSearchFields;
157
- } else {
158
- // search on 1 field
159
- return matchValue(resource[filter], query, throwOn);
160
- } // search on multiple fields
161
-
162
-
163
- try {
164
- await Promise.all((fields || []).map(field => matchFilter(resource, field, query, fieldsAttr, searchForm, filterId, true // stop searching when 1 filter is true (= OR)
165
- )));
166
- } catch (e) {
167
- return true;
168
- }
169
-
170
- throw false;
171
- };
172
- /**
173
- * Check if one resource match all the filters
174
- * @param resource - resource to test
175
- * @param filters - current filters
176
- * @param filterNames - names of the filters
177
- * @param fields - fields attribute of the element
178
- * @param searchForm - searchForm component
179
- * @param filterId - uniqId used to fill the cache
180
- * @returns true if resource match, false otherwise
181
- */
182
-
183
-
184
- const matchFilters = async (resource, filters, filterNames, fields, searchForm, filterId) => {
185
- // return true if all filters values are contained in the corresponding field of the resource
186
- try {
187
- await Promise.all(filterNames.map(filter => matchFilter(resource, filter, filters[filter], fields, searchForm, filterId, false // stop searching when 1 filter is false (= AND)
188
- )));
189
- } catch (e) {
190
- return false;
191
- }
192
-
193
- return true;
194
- };
195
- /**
196
- * Check which resources match the filters
197
- * @param resources - list of resources to filter
198
- * @param filters - current filters
199
- * @param fields - fields attribute of the element
200
- * @param searchForm - searchForm component
201
- * @returns resources filtered
202
- */
203
-
204
-
205
- const searchInResources = async (resources, filters, fields, searchForm) => {
206
- // Optim: use cache to do these things only once
207
- const filterNames = Object.keys(filters);
208
- const filterId = uniqID();
209
- window.cachePropsSearchFilter = {};
210
- return Promise.all(resources.map(resource => matchFilters(resource, filters, filterNames, fields, searchForm, filterId)));
211
- };
212
-
213
- export { searchInResources };
214
- //# sourceMappingURL=filter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["filter.ts"],"names":["parseFieldsString","findClosingBracketMatchIndex","compare","uniqID","isSet","field","fields","foundSets","match","getSetRegexp","length","getSet","setString","firstSetBracket","indexOf","lastSetBracket","set","substring","RegExp","isSearchField","searchForm","hasAttribute","getSearchField","getAttribute","orThrow","throwOn","ret","matchValue","val","query","subject","value","list","v","type","isContainer","Promise","resolve","cacheFieldsProps","cacheKey","filter","window","cachePropsSearchFilter","setFields","setSearchFields","matchFilter","resource","fieldsAttr","filterId","all","map","e","matchFilters","filters","filterNames","searchInResources","resources","Object","keys"],"mappings":"AAAA,SAASA,iBAAT,EAA4BC,4BAA5B,EAA0DC,OAA1D,EAAmEC,MAAnE,QAAiF,WAAjF;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAK,GAAG,CAACC,KAAD,EAAgBC,MAAhB,KAA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JmB,EAKnBc,UALmB,EAMnB4B,QANmB,KAOE;AACrB;AACA,MAAI;AACF,UAAMZ,OAAO,CAACa,GAAR,CAAYK,WAAW,CAACJ,GAAZ,CAAgBV,MAAM,IACtCK,WAAW,CACTC,QADS,EAETN,MAFS,EAGTa,OAAO,CAACb,MAAD,CAHE,EAITlC,MAJS,EAKTc,UALS,EAMT4B,QANS,EAOT,KAPS,CAOH;AAPG,KADK,CAAZ,CAAN;AAWD,GAZD,CAYE,OAAOG,CAAP,EAAU;AAAE,WAAO,KAAP;AAAc;;AAC5B,SAAO,IAAP;AACD,CAvBD;AAyBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMI,iBAAiB,GAAG,OACxBC,SADwB,EAExBH,OAFwB,EAGxB/C,MAHwB,EAIxBc,UAJwB,KAKrB;AACH;AACA,QAAMkC,WAAW,GAAGG,MAAM,CAACC,IAAP,CAAYL,OAAZ,CAApB;AACA,QAAML,QAAQ,GAAG7C,MAAM,EAAvB;AACAsC,EAAAA,MAAM,CAACC,sBAAP,GAAgC,EAAhC;AAEA,SAAON,OAAO,CAACa,GAAR,CAAYO,SAAS,CAACN,GAAV,CAAcJ,QAAQ,IACvCM,YAAY,CACVN,QADU,EAEVO,OAFU,EAGVC,WAHU,EAIVhD,MAJU,EAKVc,UALU,EAMV4B,QANU,CADK,CAAZ,CAAP;AAUD,CArBD;;AAuBA,SACEO,iBADF","sourcesContent":["import { parseFieldsString, findClosingBracketMatchIndex, compare, uniqID } from \"./helpers\";\nimport type { Query, SearchQuery } from \"./interfaces\";\n\n/**\n * Check if the field is a set\n * @param field - field to test\n * @param fields - list of fields\n * @returns true if the field is a set, false otherwise\n */\nconst isSet = (field: string, fields: string): boolean => {\n if (!fields) return false;\n let foundSets = fields.match(getSetRegexp(field));\n return foundSets ? foundSets.length > 0 : false;\n}\n/**\n * Get the list of fields in the set\n * @param field - set name to get\n * @param fields - list of fields\n * @returns a list of fields in the set\n */\nconst getSet = (field: string, fields: string): string[] => {\n const setString = fields.match(getSetRegexp(field));\n if (!setString) return [];\n const firstSetBracket = fields.indexOf(setString[0]) + (setString[0].length) - 1;\n const lastSetBracket = findClosingBracketMatchIndex(fields, firstSetBracket);\n const set = fields.substring(firstSetBracket + 1, lastSetBracket);\n return parseFieldsString(set);\n}\nconst getSetRegexp = (field: string) => {\n return new RegExp(`(^|\\\\,|\\\\(|\\\\s)\\\\s*${field}\\\\s*\\\\(`, 'g')\n}\n/**\n * Check if the field is a special search field\n * @param field - field to test\n * @param searchForm - current search form\n * @returns true if the field is a special search field\n */\nconst isSearchField = (field: string, searchForm: any) => {\n return searchForm.hasAttribute('search-' + field);\n}\n/**\n * Get the fields targetted by a search field\n * @param field - search field to get\n * @param searchForm - current search form\n * @returns a list of fields targetted by the current search field\n */\nconst getSearchField = (field: string, searchForm: any): string[] => {\n return parseFieldsString(searchForm.getAttribute('search-' + field));\n}\n\n/**\n * Throw or simply return value\n * @param throwOn - should throw on True or False\n * @param ret - value to return\n * @returns\n */\nconst orThrow = (throwOn: boolean | undefined, ret: boolean) => {\n if (throwOn === true && ret) throw true;\n if (throwOn === false && !ret) throw false;\n return ret;\n}\n\n/**\n * Compare a value to the query\n * @param val - value to compare\n * @param query - object to know how and what value to compare\n * @param throwOn - should function throw error on True or False\n * @returns true if value matches, throw error otherwise\n */\nconst matchValue = async (val: any, query: Query, throwOn?: boolean): Promise<boolean> => {\n const subject = await val;\n if (subject == null && query.value === '') return orThrow(throwOn, true); // filter not set and subject not existing -> ignore filter\n if (subject == null) return orThrow(throwOn, false); // return false; // property does not exist on resource\n if (query.list) { // Filter on a container\n if(query.value.length === 0) return orThrow(throwOn, true);\n for(const v of query.value) {\n if (await matchValue(subject, { type: query.type, value: v, list: false })) { // do not throw here, we need the result\n return orThrow(throwOn, true);\n }\n }\n return orThrow(throwOn, false);\n }\n if (subject.isContainer?.()) {\n let ret: any = Promise.resolve(query.value === ''); // if no query, return a match\n for (const value of subject['ldp:contains']) {\n ret = await ret || await matchValue(value, query); // do not throw here, we need the result\n if (ret) return orThrow(throwOn, true);\n }\n return orThrow(throwOn, await ret);\n }\n\n return orThrow(throwOn, compare[query.type](subject, query.value));\n}\n\n/**\n * Cache properties of a filter to avoid repeated parsing\n * @param cacheKey - uniq key\n * @param filter - filter to check\n * @param fields - fields attribute of the element\n * @param searchForm - current search form\n */\nconst cacheFieldsProps = (\n cacheKey: string,\n filter: string,\n fields: string,\n searchForm: any\n) => {\n if (!window.cachePropsSearchFilter[cacheKey]) {\n window.cachePropsSearchFilter[cacheKey] = {\n setFields: isSet(filter, fields) ? getSet(filter, fields) : null,\n setSearchFields: isSearchField(filter, searchForm) ? getSearchField(filter, searchForm) : null\n }\n }\n}\n\n/**\n * Check if one resource match one filter\n * @param resource - resource to test\n * @param filter - name of the property tested\n * @param query - query object to know how to compare values\n * @param fields - fields attribute of the element\n * @param searchForm - searchForm component\n * @param filterId - uniqId used to fill the cache\n * @param throwOn - should function throw error on True or False\n * @returns return true if the resource matches the filter, throw error otherwise\n */\nconst matchFilter = async (\n resource: object,\n filter: string,\n query: Query,\n fieldsAttr: string,\n searchForm: any,\n filterId: string,\n throwOn: boolean\n) => {\n let fields: string[] | null = null;\n\n const cacheKey = `${filter}_${filterId}`;\n cacheFieldsProps(cacheKey, filter, fieldsAttr, searchForm);\n\n if (window.cachePropsSearchFilter[cacheKey].setFields !== null) {\n fields = window.cachePropsSearchFilter[cacheKey].setFields;\n } else if (window.cachePropsSearchFilter[cacheKey].setSearchFields !== null) {\n fields = window.cachePropsSearchFilter[cacheKey].setSearchFields;\n } else { // search on 1 field\n return matchValue(resource[filter], query, throwOn);\n }\n\n // search on multiple fields\n try {\n await Promise.all((fields || []).map(field =>\n matchFilter(\n resource,\n field,\n query,\n fieldsAttr,\n searchForm,\n filterId,\n true // stop searching when 1 filter is true (= OR)\n )\n ))\n } catch (e) { return true }\n throw false;\n}\n\n/**\n * Check if one resource match all the filters\n * @param resource - resource to test\n * @param filters - current filters\n * @param filterNames - names of the filters\n * @param fields - fields attribute of the element\n * @param searchForm - searchForm component\n * @param filterId - uniqId used to fill the cache\n * @returns true if resource match, false otherwise\n */\nconst matchFilters = async (\n resource: object,\n filters: SearchQuery,\n filterNames: string[],\n fields: string,\n searchForm: any,\n filterId: string\n): Promise<boolean> => {\n // return true if all filters values are contained in the corresponding field of the resource\n try {\n await Promise.all(filterNames.map(filter =>\n matchFilter(\n resource,\n filter,\n filters[filter],\n fields,\n searchForm,\n filterId,\n false // stop searching when 1 filter is false (= AND)\n )\n ));\n } catch (e) { return false }\n return true;\n}\n\n/**\n * Check which resources match the filters\n * @param resources - list of resources to filter\n * @param filters - current filters\n * @param fields - fields attribute of the element\n * @param searchForm - searchForm component\n * @returns resources filtered\n */\nconst searchInResources = async (\n resources: object[],\n filters: SearchQuery,\n fields: string,\n searchForm: any\n) => {\n // Optim: use cache to do these things only once\n const filterNames = Object.keys(filters);\n const filterId = uniqID();\n window.cachePropsSearchFilter = {};\n\n return Promise.all(resources.map(resource =>\n matchFilters(\n resource,\n filters,\n filterNames,\n fields,\n searchForm,\n filterId\n )\n ));\n}\n\nexport {\n searchInResources\n};\n"]}
@@ -1,14 +0,0 @@
1
- const LinkTextMixin = {
2
- name: 'link-text-mixin',
3
- attributes: {
4
- linkText: {
5
- type: String,
6
- default: '',
7
- callback: function (newValue) {
8
- this.addToAttributes(newValue, 'linkText');
9
- }
10
- }
11
- }
12
- };
13
- export { LinkTextMixin };
14
- //# sourceMappingURL=linkTextMixin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["linkTextMixin.ts"],"names":["LinkTextMixin","name","attributes","linkText","type","String","default","callback","newValue","addToAttributes"],"mappings":"AAAA,MAAMA,aAAa,GAAG;AACpBC,EAAAA,IAAI,EAAE,iBADc;AAEpBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,QAAQ,EAAE;AACRC,MAAAA,IAAI,EAAEC,MADE;AAERC,MAAAA,OAAO,EAAE,EAFD;AAGRC,MAAAA,QAAQ,EAAE,UAAUC,QAAV,EAA4B;AACpC,aAAKC,eAAL,CAAqBD,QAArB,EAA+B,UAA/B;AACD;AALO;AADA;AAFQ,CAAtB;AAaA,SACER,aADF","sourcesContent":["const LinkTextMixin = {\n name: 'link-text-mixin',\n attributes: {\n linkText: {\n type: String,\n default: '',\n callback: function (newValue: string) {\n this.addToAttributes(newValue, 'linkText');\n }\n },\n },\n}\n\nexport {\n LinkTextMixin\n}"]}