@eox/itemfilter 1.13.3 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eox/itemfilter",
3
- "version": "1.13.3",
3
+ "version": "1.15.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@eox/elements-utils": "^1.1.0",
43
- "@eox/ui": "^0.5.0",
43
+ "@eox/ui": "^0.6.0",
44
44
  "@floating-ui/dom": "^1.6.8",
45
45
  "@turf/boolean-intersects": "^7.0.0",
46
46
  "@turf/boolean-within": "^7.0.0",
@@ -54,6 +54,6 @@
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@eox/layout": "*",
57
- "@eox/map": ">=2.0.0"
57
+ "@eox/map": ">=2.0.0 || >=2.1.0-dev.1"
58
58
  }
59
59
  }
@@ -70,6 +70,14 @@ export const ELEMENT_CONFIG = Object.freeze({
70
70
  */
71
71
  imageProperty: undefined,
72
72
 
73
+ /**
74
+ * Sorting behavior for the results.
75
+ * Can be undefined (alphabetical auto-detect), false (no sorting),
76
+ * string (property to sort by), function (custom comparator),
77
+ * or object { key: string, order: 'asc'|'desc' }
78
+ */
79
+ resultSorting: undefined,
80
+
73
81
  /**
74
82
  * Allow opening multiple filter accordions in parallel
75
83
  * @default true
@@ -103,6 +111,7 @@ export const ELEMENT_PROPERTIES = [
103
111
  "subTitleProperty",
104
112
  "imageProperty",
105
113
  "idProperty",
114
+ "resultSorting",
106
115
  "expandMultipleFilters",
107
116
  "expandResults",
108
117
  "expandMultipleResults",
@@ -16,9 +16,11 @@ async function filterExternal(items, filters, config) {
16
16
  typeof functionResult === "string" || functionResult instanceof String
17
17
  ? functionResult
18
18
  : functionResult.url;
19
- // Generate the URL for the external API based on the provided items and filters
20
- const response = await fetch(url);
21
- const jsonData = await response.json();
19
+
20
+ const jsonData =
21
+ typeof functionResult === "object" && "fetchFn" in functionResult
22
+ ? await functionResult.fetchFn(url)
23
+ : await fetch(url).then(async (response) => await response.json());
22
24
 
23
25
  // Return the array from the parsed JSON data
24
26
  return functionResult.key ? getValue(functionResult.key, jsonData) : jsonData;
package/src/main.js CHANGED
@@ -41,6 +41,7 @@ import {
41
41
  * - Auto-spreading of single-item aggregations to root level
42
42
  * - Card display mode for results (`result-type="cards"`)
43
43
  * - Secondary result action button with custom icon and event handler (`click:result-action`)
44
+ * - Custom result sorting via `resultSorting` property
44
45
  * - Customizable layout and styling via CSS variables
45
46
  *
46
47
  * Usage examples and visual demos are available in Storybook stories, including scenarios for inline mode, external filtering, nested properties, card display, CSS variable customization, and result actions.
@@ -73,6 +74,7 @@ export class EOxItemFilter extends LitElement {
73
74
  titleProperty: { attribute: "title-property", type: String },
74
75
  subTitleProperty: { attribute: "sub-title-property", type: String },
75
76
  imageProperty: { attribute: "image-property", type: String },
77
+ resultSorting: { attribute: false, type: Object },
76
78
  expandMultipleFilters: {
77
79
  attribute: "enable-multiple-filter",
78
80
  type: Boolean,
@@ -164,9 +166,12 @@ export class EOxItemFilter extends LitElement {
164
166
 
165
167
  /**
166
168
  * Use an external search endpoint instead of fuse search.
167
- * Passed properties: input string, filters object
169
+ * Passed properties: input string, filters object.
170
+ * The function can return a URL string, or an object containing a `url,
171
+ * an optional `fetchFn` to handle the request, or/and an optional `key` to
172
+ * return a specific property from the fetched data.
168
173
  *
169
- * @type Function
174
+ * @type {() => string| (() => {url:string;key?:string;fetchFn?:string})}
170
175
  */
171
176
  this.externalFilter = null;
172
177
 
@@ -229,6 +234,18 @@ export class EOxItemFilter extends LitElement {
229
234
  */
230
235
  this.imageProperty = undefined;
231
236
 
237
+ /**
238
+ * Sorting behavior for the results. Can be:
239
+ * - undefined (default): smart alphabetical sorting (skips if externalFilter or fuseConfig.shouldSort is truthy)
240
+ * - false: no sorting
241
+ * - string: property key to sort by (ascending)
242
+ * - function: custom comparator function (a, b) => number
243
+ * - object: { key: string, order?: 'asc' | 'desc' }
244
+ *
245
+ * @type false|string|Function|{key:string, order?:'asc'|'desc'}
246
+ */
247
+ this.resultSorting = undefined;
248
+
232
249
  /**
233
250
  * Unique id property of items
234
251
  *
@@ -294,6 +311,10 @@ export class EOxItemFilter extends LitElement {
294
311
  * Applies the filters to the items and updates the result aggregation.
295
312
  */
296
313
  apply() {
314
+ this.#config = ELEMENT_PROPERTIES.reduce((acc, property) => {
315
+ acc[property] = this[property];
316
+ return acc;
317
+ }, {});
297
318
  this.#resultAggregation = filterApplyMethod(
298
319
  this.#config,
299
320
  this.#items,
@@ -332,10 +353,12 @@ export class EOxItemFilter extends LitElement {
332
353
  * Sorts the given items based on the current configuration.
333
354
  *
334
355
  * @param {Array<object>} items - The items to be sorted.
356
+ * @param {Object} [options] - Optional sorting parameters.
357
+ * @param {boolean} [options.isExternalResult] - Flag for results from external filter.
335
358
  * @returns {Array<object>} - The sorted items.
336
359
  */
337
- sortResults(items) {
338
- return sortResultsMethod(items, this.#config);
360
+ sortResults(items, options) {
361
+ return sortResultsMethod(items, this.#config, options);
339
362
  }
340
363
 
341
364
  /**
@@ -40,7 +40,7 @@ function createResetMethod(filterObject, tabIndex, EOxItemFilter) {
40
40
  />
41
41
  </svg>
42
42
  </i>
43
- <div class="tooltip left">Reset filter</div>
43
+ <span class="tooltip left">Reset filter</span>
44
44
  `}
45
45
  </button>
46
46
  `,
@@ -17,7 +17,9 @@ async function searchMethod(config, items, EOxItemFilter) {
17
17
  results = await filterClient(items, EOxItemFilter.filters, config);
18
18
  }
19
19
 
20
- EOxItemFilter.results = EOxItemFilter.sortResults(results);
20
+ EOxItemFilter.results = EOxItemFilter.sortResults(results, {
21
+ isExternalResult: !!EOxItemFilter.externalFilter,
22
+ });
21
23
  }
22
24
 
23
25
  export default searchMethod;
@@ -1,19 +1,65 @@
1
1
  import { getValue } from "../../helpers";
2
2
 
3
3
  /**
4
- * Sorts the provided items based on the title property specified in the configuration.
4
+ * Sorts the provided items based on the resultSorting configuration.
5
+ * Supports:
6
+ * - undefined (default): smart alphabetical sorting (skips if externalFilter or fuseConfig.shouldSort is truthy)
7
+ * - false: no sorting
8
+ * - string: property key to sort by (ascending)
9
+ * - function: custom comparator function (a, b) => number
10
+ * - object: { key: string, order?: 'asc' | 'desc' }
5
11
  *
6
12
  * @param {Array<Object>} items - The items to be sorted.
7
13
  * @param {Object} config - The configuration object containing sorting options.
14
+ * @param {Object} [options] - Optional sorting parameters.
15
+ * @param {boolean} [options.isExternalResult] - Flag for results from external filter.
8
16
  * @returns {Array<Object>} The sorted array of items.
9
17
  */
10
- function sortResultsMethod(items, config) {
11
- return [...items].sort((a, b) =>
12
- getValue(config.titleProperty, a)
13
- .toString()
14
- .localeCompare(getValue(config.titleProperty, b))
15
- .toString(),
16
- );
18
+ function sortResultsMethod(items, config, options = {}) {
19
+ const { resultSorting } = config;
20
+
21
+ // 1. Explicitly disabled sorting
22
+ if (resultSorting === false) {
23
+ return items;
24
+ }
25
+
26
+ // 2. Default/Smart sorting (undefined)
27
+ if (resultSorting === undefined) {
28
+ // Skip sorting if results come from an external source (assumed sorted)
29
+ // or if Fuse.js is configured to handle its own sorting by score.
30
+ if (options.isExternalResult || config.fuseConfig?.shouldSort) {
31
+ return items;
32
+ }
33
+ // Backward compatible default: alphabetical by titleProperty
34
+ return [...items].sort((a, b) => {
35
+ const valA = getValue(config.titleProperty, a) || "";
36
+ const valB = getValue(config.titleProperty, b) || "";
37
+ return valA.toString().localeCompare(valB.toString());
38
+ });
39
+ }
40
+
41
+ // 3. Custom comparator function
42
+ if (typeof resultSorting === "function") {
43
+ return [...items].sort(resultSorting);
44
+ }
45
+
46
+ // 4. Sort by property (string or object)
47
+ const sortKey =
48
+ typeof resultSorting === "string" ? resultSorting : resultSorting.key;
49
+ const sortOrder =
50
+ typeof resultSorting === "object" && resultSorting.order === "desc"
51
+ ? -1
52
+ : 1;
53
+
54
+ if (sortKey) {
55
+ return [...items].sort((a, b) => {
56
+ const valA = getValue(sortKey, a) || "";
57
+ const valB = getValue(sortKey, b) || "";
58
+ return valA.toString().localeCompare(valB.toString()) * sortOrder;
59
+ });
60
+ }
61
+
62
+ return items;
17
63
  }
18
64
 
19
65
  export default sortResultsMethod;
package/src/style.eox.js CHANGED
@@ -8,6 +8,9 @@ ${eoxStyle}
8
8
  .field {
9
9
  margin-block-end: 0;
10
10
  }
11
+ .field>:is(input,textarea,select) {
12
+ width: 100%;
13
+ }
11
14
  .field.small>:is(input,textarea,select) {
12
15
  font-size: 0.75rem;
13
16
  }
@@ -124,6 +127,9 @@ details > summary i {
124
127
  details[open] > summary i {
125
128
  transform: rotate(90deg);
126
129
  }
130
+ summary > * {
131
+ pointer-events: all;
132
+ }
127
133
  ul.multiselect.list > li,
128
134
  ul.select.list > li,
129
135
  details > div > ul#results.list > li {
@@ -57,6 +57,13 @@ export const ELEMENT_CONFIG: Readonly<{
57
57
  * The property of the result items used for an image
58
58
  */
59
59
  imageProperty: any;
60
+ /**
61
+ * Sorting behavior for the results.
62
+ * Can be undefined (alphabetical auto-detect), false (no sorting),
63
+ * string (property to sort by), function (custom comparator),
64
+ * or object { key: string, order: 'asc'|'desc' }
65
+ */
66
+ resultSorting: any;
60
67
  /**
61
68
  * Allow opening multiple filter accordions in parallel
62
69
  * @default true
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/enums/config.js"],"names":[],"mappings":"AAAA;IACE;;OAEG;;IAGH;;;OAGG;;IAGH;;OAEG;;IAGH;;;;;OAKG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;OAGG;;GAEF;AAEH,0CAkBE"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/enums/config.js"],"names":[],"mappings":"AAAA;IACE;;OAEG;;IAGH;;;OAGG;;IAGH;;OAEG;;IAGH;;;;;OAKG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;;;;OAKG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;OAGG;;GAEF;AAEH,0CAmBE"}
@@ -1 +1 @@
1
- {"version":3,"file":"filter-external.d.ts","sourceRoot":"","sources":["../../src/helpers/filter-external.js"],"names":[],"mappings":";AACA;;;;;;;GAOG;AACH,uCALW,KAAK,KAAQ,8BAGX,OAAO,CAAC,KAAK,KAAQ,CAAC,CAiBlC"}
1
+ {"version":3,"file":"filter-external.d.ts","sourceRoot":"","sources":["../../src/helpers/filter-external.js"],"names":[],"mappings":";AACA;;;;;;;GAOG;AACH,uCALW,KAAK,KAAQ,8BAGX,OAAO,CAAC,KAAK,KAAQ,CAAC,CAmBlC"}
package/types/main.d.ts CHANGED
@@ -11,6 +11,7 @@
11
11
  * - Auto-spreading of single-item aggregations to root level
12
12
  * - Card display mode for results (`result-type="cards"`)
13
13
  * - Secondary result action button with custom icon and event handler (`click:result-action`)
14
+ * - Custom result sorting via `resultSorting` property
14
15
  * - Customizable layout and styling via CSS variables
15
16
  *
16
17
  * Usage examples and visual demos are available in Storybook stories, including scenarios for inline mode, external filtering, nested properties, card display, CSS variable customization, and result actions.
@@ -91,6 +92,10 @@ export class EOxItemFilter extends LitElement {
91
92
  attribute: string;
92
93
  type: StringConstructor;
93
94
  };
95
+ resultSorting: {
96
+ attribute: boolean;
97
+ type: ObjectConstructor;
98
+ };
94
99
  expandMultipleFilters: {
95
100
  attribute: string;
96
101
  type: BooleanConstructor;
@@ -171,11 +176,18 @@ export class EOxItemFilter extends LitElement {
171
176
  enableHighlighting: boolean;
172
177
  /**
173
178
  * Use an external search endpoint instead of fuse search.
174
- * Passed properties: input string, filters object
179
+ * Passed properties: input string, filters object.
180
+ * The function can return a URL string, or an object containing a `url,
181
+ * an optional `fetchFn` to handle the request, or/and an optional `key` to
182
+ * return a specific property from the fetched data.
175
183
  *
176
- * @type Function
184
+ * @type {() => string| (() => {url:string;key?:string;fetchFn?:string})}
177
185
  */
178
- externalFilter: Function;
186
+ externalFilter: () => string | (() => {
187
+ url: string;
188
+ key?: string;
189
+ fetchFn?: string;
190
+ });
179
191
  /**
180
192
  * The filter properties.
181
193
  * @type Array<{key?: String, keys?: Array<String>, title: String, type: String, placeholder?: String, format?: String, state?: Object}>
@@ -235,6 +247,20 @@ export class EOxItemFilter extends LitElement {
235
247
  * @type String|Function
236
248
  */
237
249
  imageProperty: string | Function;
250
+ /**
251
+ * Sorting behavior for the results. Can be:
252
+ * - undefined (default): smart alphabetical sorting (skips if externalFilter or fuseConfig.shouldSort is truthy)
253
+ * - false: no sorting
254
+ * - string: property key to sort by (ascending)
255
+ * - function: custom comparator function (a, b) => number
256
+ * - object: { key: string, order?: 'asc' | 'desc' }
257
+ *
258
+ * @type false|string|Function|{key:string, order?:'asc'|'desc'}
259
+ */
260
+ resultSorting: false | string | Function | {
261
+ key: string;
262
+ order?: "asc" | "desc";
263
+ };
238
264
  /**
239
265
  * Unique id property of items
240
266
  *
@@ -299,9 +325,13 @@ export class EOxItemFilter extends LitElement {
299
325
  * Sorts the given items based on the current configuration.
300
326
  *
301
327
  * @param {Array<object>} items - The items to be sorted.
328
+ * @param {Object} [options] - Optional sorting parameters.
329
+ * @param {boolean} [options.isExternalResult] - Flag for results from external filter.
302
330
  * @returns {Array<object>} - The sorted items.
303
331
  */
304
- sortResults(items: Array<object>): Array<object>;
332
+ sortResults(items: Array<object>, options?: {
333
+ isExternalResult?: boolean;
334
+ }): Array<object>;
305
335
  /**
306
336
  * Resets all applied filters.
307
337
  */
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.js"],"names":[],"mappings":"AA8BA;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B;IAED;;;;OAIG;IACH,sBAFW;QAAC,MAAM,MAAQ;KAAC,QAa1B;IAED;;;;OAIG;IACH,sBAFW;QAAC,MAAM,MAAQ;KAAC,QAa1B;IAED;;OAEG;IACH,+CAyIC;;CACF;2BAroByC,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/methods/itemfilter/search.js"],"names":[],"mappings":";AAGA;;;;;;;GAOG;AACH,kDAJW,KAAK,KAAQ,uBAEX,OAAO,CAAC,IAAI,CAAC,CAWzB"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/methods/itemfilter/search.js"],"names":[],"mappings":";AAGA;;;;;;;GAOG;AACH,kDAJW,KAAK,KAAQ,uBAEX,OAAO,CAAC,IAAI,CAAC,CAazB"}
@@ -1,10 +1,20 @@
1
1
  export default sortResultsMethod;
2
2
  /**
3
- * Sorts the provided items based on the title property specified in the configuration.
3
+ * Sorts the provided items based on the resultSorting configuration.
4
+ * Supports:
5
+ * - undefined (default): smart alphabetical sorting (skips if externalFilter or fuseConfig.shouldSort is truthy)
6
+ * - false: no sorting
7
+ * - string: property key to sort by (ascending)
8
+ * - function: custom comparator function (a, b) => number
9
+ * - object: { key: string, order?: 'asc' | 'desc' }
4
10
  *
5
11
  * @param {Array<Object>} items - The items to be sorted.
6
12
  * @param {Object} config - The configuration object containing sorting options.
13
+ * @param {Object} [options] - Optional sorting parameters.
14
+ * @param {boolean} [options.isExternalResult] - Flag for results from external filter.
7
15
  * @returns {Array<Object>} The sorted array of items.
8
16
  */
9
- declare function sortResultsMethod(items: Array<any>, config: any): Array<any>;
17
+ declare function sortResultsMethod(items: Array<any>, config: any, options?: {
18
+ isExternalResult?: boolean;
19
+ }): Array<any>;
10
20
  //# sourceMappingURL=sort-results.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sort-results.d.ts","sourceRoot":"","sources":["../../../src/methods/itemfilter/sort-results.js"],"names":[],"mappings":";AAEA;;;;;;GAMG;AACH,0CAJW,KAAK,KAAQ,gBAEX,KAAK,KAAQ,CASzB"}
1
+ {"version":3,"file":"sort-results.d.ts","sourceRoot":"","sources":["../../../src/methods/itemfilter/sort-results.js"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;GAcG;AACH,0CANW,KAAK,KAAQ,yBAGrB;IAA0B,gBAAgB,GAAlC,OAAO;CACf,GAAU,KAAK,KAAQ,CA+CzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"style.eox.d.ts","sourceRoot":"","sources":["../src/style.eox.js"],"names":[],"mappings":"AAKA,8BA6dE"}
1
+ {"version":3,"file":"style.eox.d.ts","sourceRoot":"","sources":["../src/style.eox.js"],"names":[],"mappings":"AAKA,8BAmeE"}