@eox/itemfilter 1.6.0 → 1.6.2
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/eox-itemfilter.js +3019 -3014
- package/dist/eox-itemfilter.umd.cjs +104 -104
- package/package.json +4 -3
- package/src/components/filters/range.js +4 -4
- package/src/methods/filters/range.js +6 -2
- package/src/methods/itemfilter/filter-apply.js +6 -2
- package/src/methods/results/create.js +17 -17
- package/types/methods/filters/range.d.ts.map +1 -1
- package/types/methods/itemfilter/filter-apply.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eox/itemfilter",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@types/geojson": "^7946.0.14",
|
|
7
7
|
"@types/lodash.debounce": "^4.0.7",
|
|
8
|
-
"vite": "^
|
|
8
|
+
"vite": "^6.0.3"
|
|
9
9
|
},
|
|
10
10
|
"engines": {
|
|
11
11
|
"npm": ">=8.0.0",
|
|
@@ -34,10 +34,11 @@
|
|
|
34
34
|
"watch": "vite build --watch"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@eox/elements-utils": "^0.1.
|
|
37
|
+
"@eox/elements-utils": "^0.1.2",
|
|
38
38
|
"@floating-ui/dom": "^1.6.8",
|
|
39
39
|
"@turf/boolean-intersects": "^7.0.0",
|
|
40
40
|
"@turf/boolean-within": "^7.0.0",
|
|
41
|
+
"dayjs": "^1.11.9",
|
|
41
42
|
"fuse.js": "^7.0.0",
|
|
42
43
|
"lit": "^3.2.0",
|
|
43
44
|
"lodash.debounce": "^4.0.8",
|
|
@@ -46,8 +46,8 @@ export class EOxItemFilterRange extends LitElement {
|
|
|
46
46
|
/**
|
|
47
47
|
* @type Function
|
|
48
48
|
*/
|
|
49
|
-
this.debouncedInputHandler = _debounce(this.inputHandler,
|
|
50
|
-
leading:
|
|
49
|
+
this.debouncedInputHandler = _debounce(this.inputHandler, 500, {
|
|
50
|
+
leading: false,
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -100,8 +100,8 @@ export class EOxItemFilterRange extends LitElement {
|
|
|
100
100
|
<tc-range-slider
|
|
101
101
|
min="${this.filterObject.min}"
|
|
102
102
|
max="${this.filterObject.max}"
|
|
103
|
-
value1="${this.filterObject.min || this.filterObject.
|
|
104
|
-
value2="${this.filterObject.max || this.filterObject.
|
|
103
|
+
value1="${this.filterObject.state.min || this.filterObject.min}"
|
|
104
|
+
value2="${this.filterObject.state.max || this.filterObject.max}"
|
|
105
105
|
step="${this.filterObject.step || 1}"
|
|
106
106
|
@change=${this.debouncedInputHandler}
|
|
107
107
|
></tc-range-slider>
|
|
@@ -2,6 +2,8 @@ import { resetFilter } from "../../helpers/index.js";
|
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
import { html } from "lit";
|
|
4
4
|
|
|
5
|
+
const DATE_TIME_FORMAT = "ddd, D MMM YYYY HH:mm:ss";
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* Resets the range filter to its default state and requests an update.
|
|
7
9
|
*
|
|
@@ -47,7 +49,7 @@ export function rangeInputHandlerMethod(evt, EOxItemFilterRange) {
|
|
|
47
49
|
if (EOxItemFilterRange.filterObject.dirty) {
|
|
48
50
|
EOxItemFilterRange.filterObject.stringifiedState =
|
|
49
51
|
EOxItemFilterRange.filterObject.format === "date"
|
|
50
|
-
? `${dayjs(min)} - ${dayjs(max)}`
|
|
52
|
+
? `${dayjs.unix(min).format(DATE_TIME_FORMAT)} - ${dayjs.unix(max).format(DATE_TIME_FORMAT)}`
|
|
51
53
|
: `${min} - ${max}`;
|
|
52
54
|
}
|
|
53
55
|
|
|
@@ -73,6 +75,8 @@ export function rangeInputHandlerMethod(evt, EOxItemFilterRange) {
|
|
|
73
75
|
export function rangeLabelMethod(val, pos, EOxItemFilterRange) {
|
|
74
76
|
const isDate = Boolean(EOxItemFilterRange.filterObject.format === "date");
|
|
75
77
|
const filteredVal = EOxItemFilterRange.filterObject.state[val];
|
|
76
|
-
const label = isDate
|
|
78
|
+
const label = isDate
|
|
79
|
+
? dayjs.unix(filteredVal).format(DATE_TIME_FORMAT)
|
|
80
|
+
: filteredVal;
|
|
77
81
|
return html`<div class="range-${pos}">${label}</div>`;
|
|
78
82
|
}
|
|
@@ -59,7 +59,9 @@ function filterApplyMethod(config, items, EOxItemFilter) {
|
|
|
59
59
|
});
|
|
60
60
|
} else {
|
|
61
61
|
if (filterProperty.type === "spatial") {
|
|
62
|
-
filterKeys.geometry = undefined;
|
|
62
|
+
filterKeys.geometry = filterProperty?.state?.geometry || undefined;
|
|
63
|
+
if (filterKeys.geometry)
|
|
64
|
+
filterProperty.stringifiedState = filterKeys.geometry.type;
|
|
63
65
|
filterKeys.mode = filterProperty.mode || "intersects";
|
|
64
66
|
} else {
|
|
65
67
|
if (filterProperty.key?.includes(".")) {
|
|
@@ -78,7 +80,9 @@ function filterApplyMethod(config, items, EOxItemFilter) {
|
|
|
78
80
|
EOxItemFilter.filters[filterKey] = Object.assign(
|
|
79
81
|
{
|
|
80
82
|
type: filterProperty.type || "multiselect",
|
|
81
|
-
dirty: filterProperty.state
|
|
83
|
+
dirty: filterProperty.state
|
|
84
|
+
? Object.values(filterProperty.state).some((value) => value)
|
|
85
|
+
: undefined,
|
|
82
86
|
key: filterKey,
|
|
83
87
|
},
|
|
84
88
|
filterProperty.type === "range"
|
|
@@ -69,24 +69,24 @@ export function createItemListMethod(
|
|
|
69
69
|
items,
|
|
70
70
|
(item) => item.id,
|
|
71
71
|
(item) => html`
|
|
72
|
-
<li
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
>
|
|
72
|
+
<li
|
|
73
|
+
class=${className(item)}
|
|
74
|
+
@click=${() => {
|
|
75
|
+
if (EOxItemFilterResults.selectedResult === item) {
|
|
76
|
+
EOxItemFilterResults.selectedResult = null;
|
|
77
|
+
} else {
|
|
78
|
+
EOxItemFilterResults.selectedResult = item;
|
|
79
|
+
}
|
|
80
|
+
EOxItemFilterResults.dispatchEvent(
|
|
81
|
+
new CustomEvent("result", {
|
|
82
|
+
detail: EOxItemFilterResults.selectedResult,
|
|
83
|
+
}),
|
|
84
|
+
);
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
<span id="${item.id}">
|
|
88
88
|
${when(
|
|
89
|
-
config.subTitleProperty,
|
|
89
|
+
config.subTitleProperty || config.imageProperty,
|
|
90
90
|
() => html`
|
|
91
91
|
${getValue(config.imageProperty, item)
|
|
92
92
|
? html`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../../../src/methods/filters/range.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../../../src/methods/filters/range.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,qDAFW,OAAO,mCAAmC,EAAE,kBAAkB,QAexE;AAED;;;;;GAKG;AACH,6CAHW,KAAK,iCAmCf;AAED;;;;;;;GAOG;AACH,sCALW,MAAM,GAAC,MAAM,OACb,MAAM,8CAWhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-apply.d.ts","sourceRoot":"","sources":["../../../src/methods/itemfilter/filter-apply.js"],"names":[],"mappings":";AAKA;;;;;;;GAOG;AACH,uDAJW,UAAa,uBAEX,MAAM,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"filter-apply.d.ts","sourceRoot":"","sources":["../../../src/methods/itemfilter/filter-apply.js"],"names":[],"mappings":";AAKA;;;;;;;GAOG;AACH,uDAJW,UAAa,uBAEX,MAAM,MAAM,CAAC,CAkIzB"}
|