@eox/itemfilter 1.17.5 → 1.19.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/dist/eox-itemfilter.js +2289 -2024
- package/dist/eox-itemfilter.umd.cjs +153 -120
- package/package.json +8 -8
- package/src/components/chips.js +3 -3
- package/src/components/expand-container.js +27 -4
- package/src/components/filters/range.js +8 -5
- package/src/components/filters/selector.js +10 -10
- package/src/components/filters/spatial.js +8 -8
- package/src/components/filters/text.js +18 -5
- package/src/components/itemfilter-container.js +70 -12
- package/src/components/results.js +5 -5
- package/src/enums/config.js +6 -0
- package/src/enums/index.js +6 -1
- package/src/helpers/chip-items.js +2 -2
- package/src/helpers/filter-client.js +6 -6
- package/src/helpers/filter-external.js +4 -4
- package/src/helpers/get-value.js +1 -1
- package/src/helpers/highlighting.js +2 -2
- package/src/helpers/is-date.js +1 -1
- package/src/helpers/is-filters-dirty.js +1 -1
- package/src/helpers/map-layers.js +2 -2
- package/src/helpers/merge-highlight-indices.js +1 -1
- package/src/helpers/reset-filter.js +2 -2
- package/src/helpers/spatial.js +4 -4
- package/src/helpers/toggle-accordion.js +1 -1
- package/src/main.js +57 -42
- package/src/methods/chips/handler.js +4 -7
- package/src/methods/container/handler.js +21 -5
- package/src/methods/container/index.js +6 -0
- package/src/methods/container/init-popver.js +2 -2
- package/src/methods/container/inline-search.js +54 -0
- package/src/methods/container/reset-filter.js +5 -2
- package/src/methods/container/reset-search.js +7 -4
- package/src/methods/container/search-filter.js +10 -1
- package/src/methods/filters/index.js +5 -1
- package/src/methods/filters/range.js +2 -2
- package/src/methods/filters/selector.js +26 -18
- package/src/methods/filters/spatial.js +5 -5
- package/src/methods/filters/text.js +15 -2
- package/src/methods/itemfilter/create-filter.js +6 -6
- package/src/methods/itemfilter/create-reset.js +3 -3
- package/src/methods/itemfilter/filter-apply.js +10 -3
- package/src/methods/itemfilter/reset-filter.js +4 -3
- package/src/methods/itemfilter/search.js +3 -3
- package/src/methods/itemfilter/sort-results.js +4 -4
- package/src/methods/results/aggregate-results.js +3 -3
- package/src/methods/results/create.js +2 -2
- package/types/components/chips.d.ts +3 -3
- package/types/components/expand-container.d.ts +3 -3
- package/types/components/expand-container.d.ts.map +1 -1
- package/types/components/filters/range.d.ts +3 -3
- package/types/components/filters/range.d.ts.map +1 -1
- package/types/components/filters/selector.d.ts +9 -9
- package/types/components/filters/spatial.d.ts +7 -7
- package/types/components/filters/spatial.d.ts.map +1 -1
- package/types/components/filters/text.d.ts +10 -4
- package/types/components/filters/text.d.ts.map +1 -1
- package/types/components/itemfilter-container.d.ts +14 -5
- package/types/components/itemfilter-container.d.ts.map +1 -1
- package/types/components/results.d.ts +5 -5
- package/types/enums/config.d.ts +5 -0
- package/types/enums/config.d.ts.map +1 -1
- package/types/enums/index.d.ts +1 -1
- package/types/helpers/chip-items.d.ts +3 -3
- package/types/helpers/chip-items.d.ts.map +1 -1
- package/types/helpers/filter-client.d.ts +2 -2
- package/types/helpers/filter-client.d.ts.map +1 -1
- package/types/helpers/filter-external.d.ts +5 -5
- package/types/helpers/filter-external.d.ts.map +1 -1
- package/types/helpers/get-value.d.ts +2 -2
- package/types/helpers/get-value.d.ts.map +1 -1
- package/types/helpers/highlighting.d.ts +3 -3
- package/types/helpers/highlighting.d.ts.map +1 -1
- package/types/helpers/is-date.d.ts +2 -2
- package/types/helpers/is-date.d.ts.map +1 -1
- package/types/helpers/is-filters-dirty.d.ts +2 -2
- package/types/helpers/is-filters-dirty.d.ts.map +1 -1
- package/types/helpers/map-layers.d.ts +3 -3
- package/types/helpers/map-layers.d.ts.map +1 -1
- package/types/helpers/merge-highlight-indices.d.ts +1 -1
- package/types/helpers/reset-filter.d.ts +3 -3
- package/types/helpers/reset-filter.d.ts.map +1 -1
- package/types/helpers/spatial.d.ts +2 -2
- package/types/helpers/spatial.d.ts.map +1 -1
- package/types/helpers/toggle-accordion.d.ts +2 -2
- package/types/helpers/toggle-accordion.d.ts.map +1 -1
- package/types/main.d.ts +17 -12
- package/types/main.d.ts.map +1 -1
- package/types/methods/chips/handler.d.ts +6 -6
- package/types/methods/chips/handler.d.ts.map +1 -1
- package/types/methods/container/handler.d.ts +18 -10
- package/types/methods/container/handler.d.ts.map +1 -1
- package/types/methods/container/index.d.ts +2 -1
- package/types/methods/container/init-popver.d.ts +3 -3
- package/types/methods/container/init-popver.d.ts.map +1 -1
- package/types/methods/container/inline-search.d.ts +22 -0
- package/types/methods/container/inline-search.d.ts.map +1 -0
- package/types/methods/container/reset-filter.d.ts +2 -2
- package/types/methods/container/reset-filter.d.ts.map +1 -1
- package/types/methods/container/reset-search.d.ts +2 -2
- package/types/methods/container/reset-search.d.ts.map +1 -1
- package/types/methods/container/search-filter.d.ts +2 -2
- package/types/methods/container/search-filter.d.ts.map +1 -1
- package/types/methods/filters/index.d.ts +1 -1
- package/types/methods/filters/range.d.ts +4 -4
- package/types/methods/filters/range.d.ts.map +1 -1
- package/types/methods/filters/selector.d.ts +15 -14
- package/types/methods/filters/selector.d.ts.map +1 -1
- package/types/methods/filters/spatial.d.ts +8 -8
- package/types/methods/filters/spatial.d.ts.map +1 -1
- package/types/methods/filters/text.d.ts +11 -4
- package/types/methods/filters/text.d.ts.map +1 -1
- package/types/methods/itemfilter/create-filter.d.ts +3 -3
- package/types/methods/itemfilter/create-filter.d.ts.map +1 -1
- package/types/methods/itemfilter/create-reset.d.ts +3 -3
- package/types/methods/itemfilter/create-reset.d.ts.map +1 -1
- package/types/methods/itemfilter/filter-apply.d.ts +4 -4
- package/types/methods/itemfilter/filter-apply.d.ts.map +1 -1
- package/types/methods/itemfilter/reset-filter.d.ts +3 -2
- package/types/methods/itemfilter/reset-filter.d.ts.map +1 -1
- package/types/methods/itemfilter/search.d.ts +4 -4
- package/types/methods/itemfilter/search.d.ts.map +1 -1
- package/types/methods/itemfilter/sort-results.d.ts +6 -6
- package/types/methods/itemfilter/sort-results.d.ts.map +1 -1
- package/types/methods/results/aggregate-results.d.ts +4 -4
- package/types/methods/results/aggregate-results.d.ts.map +1 -1
- package/types/methods/results/create.d.ts +4 -4
- package/types/methods/results/create.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eox/itemfilter",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"devDependencies": {
|
|
10
10
|
"@types/geojson": "^7946.0.14",
|
|
11
11
|
"@types/lodash.debounce": "^4.0.7",
|
|
12
|
-
"vite": "^8.
|
|
12
|
+
"vite": "^8.3.5"
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
15
15
|
"npm": ">=8.0.0",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"watch": "vite build --watch"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@eox/elements-utils": "^1.
|
|
42
|
+
"@eox/elements-utils": "^1.3.0",
|
|
43
43
|
"@eox/ui": "^1.1.0",
|
|
44
|
-
"@floating-ui/dom": "^1.
|
|
45
|
-
"@turf/boolean-intersects": "^7.
|
|
46
|
-
"@turf/boolean-within": "^7.
|
|
47
|
-
"dayjs": "^1.11.
|
|
48
|
-
"fuse.js": "^7.
|
|
44
|
+
"@floating-ui/dom": "^1.8.0",
|
|
45
|
+
"@turf/boolean-intersects": "^7.4.0",
|
|
46
|
+
"@turf/boolean-within": "^7.4.0",
|
|
47
|
+
"dayjs": "^1.11.23",
|
|
48
|
+
"fuse.js": "^7.5.0",
|
|
49
49
|
"lit": "^3.3.3",
|
|
50
50
|
"lodash.debounce": "^4.0.8",
|
|
51
51
|
"lodash.flatmap": "^4.5.0",
|
package/src/components/chips.js
CHANGED
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
* close events, and keyboard events.
|
|
12
12
|
*
|
|
13
13
|
* @module EOxItemFilterChips
|
|
14
|
-
* @
|
|
15
|
-
* @property {
|
|
16
|
-
* @property {
|
|
14
|
+
* @augments LitElement
|
|
15
|
+
* @property {object} items - The items to be displayed as chips.
|
|
16
|
+
* @property {object} controller - The controller object to manage chip actions.
|
|
17
17
|
*/
|
|
18
18
|
export class EOxItemFilterChipsV2 extends LitElement {
|
|
19
19
|
// Define properties with defaults and types
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LitElement, html, nothing } from "lit";
|
|
2
|
+
import { emitActivity, findHost } from "@eox/elements-utils";
|
|
2
3
|
import { styleEOX } from "../style.eox";
|
|
3
4
|
import { when } from "lit/directives/when.js";
|
|
4
5
|
|
|
@@ -7,9 +8,9 @@ import { when } from "lit/directives/when.js";
|
|
|
7
8
|
* The component supports a featured view and an expandable details view.
|
|
8
9
|
*
|
|
9
10
|
* @module EOxItemFilterExpandContainer
|
|
10
|
-
* @
|
|
11
|
-
* @property {
|
|
12
|
-
* @property {
|
|
11
|
+
* @augments LitElement
|
|
12
|
+
* @property {object} filterObject - The filter object containing state and properties such as title and expanded state.
|
|
13
|
+
* @property {boolean} unstyled - Flag to determine if default styles should be applied.
|
|
13
14
|
*/
|
|
14
15
|
export class EOxItemFilterExpandContainer extends LitElement {
|
|
15
16
|
// Define properties with defaults and types
|
|
@@ -34,6 +35,8 @@ export class EOxItemFilterExpandContainer extends LitElement {
|
|
|
34
35
|
this.unstyled = false;
|
|
35
36
|
}
|
|
36
37
|
|
|
38
|
+
#userClickedSummary = false;
|
|
39
|
+
|
|
37
40
|
/**
|
|
38
41
|
* Handles the toggle event for the details element.
|
|
39
42
|
* Dispatches a custom event "details-toggled" with the event details.
|
|
@@ -48,6 +51,21 @@ export class EOxItemFilterExpandContainer extends LitElement {
|
|
|
48
51
|
composed: true,
|
|
49
52
|
}),
|
|
50
53
|
);
|
|
54
|
+
if (this.#userClickedSummary) {
|
|
55
|
+
this.#userClickedSummary = false;
|
|
56
|
+
const root = findHost(this, "eox-itemfilter");
|
|
57
|
+
if (root) {
|
|
58
|
+
emitActivity(
|
|
59
|
+
root,
|
|
60
|
+
"details-toggled",
|
|
61
|
+
{
|
|
62
|
+
key: this.filterObject?.key,
|
|
63
|
+
title: this.filterObject?.title,
|
|
64
|
+
},
|
|
65
|
+
event,
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
51
69
|
}
|
|
52
70
|
|
|
53
71
|
/**
|
|
@@ -68,7 +86,12 @@ export class EOxItemFilterExpandContainer extends LitElement {
|
|
|
68
86
|
class="details-filter max-width"
|
|
69
87
|
?open=${this.filterObject.expanded || nothing}
|
|
70
88
|
>
|
|
71
|
-
<summary
|
|
89
|
+
<summary
|
|
90
|
+
class="square"
|
|
91
|
+
@click=${() => {
|
|
92
|
+
this.#userClickedSummary = true;
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
72
95
|
<nav class="responsive tiny-space">
|
|
73
96
|
<i class="small">
|
|
74
97
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
@@ -17,10 +17,10 @@ import { isDate } from "../../helpers/index.js";
|
|
|
17
17
|
* generating labels, and resetting the range filter.
|
|
18
18
|
*
|
|
19
19
|
* @module EOxItemFilterRange
|
|
20
|
-
* @
|
|
21
|
-
* @property {
|
|
20
|
+
* @augments LitElement
|
|
21
|
+
* @property {object} filterObject - The filter object containing state and range limits.
|
|
22
22
|
* @property {Array} suggestions - The list of suggestions for the selector.
|
|
23
|
-
* @property {
|
|
23
|
+
* @property {number} tabIndex - The tab index for the input elements.
|
|
24
24
|
*/
|
|
25
25
|
export class EOxItemFilterRange extends LitElement {
|
|
26
26
|
// Define properties with defaults and types
|
|
@@ -135,7 +135,8 @@ export class EOxItemFilterRange extends LitElement {
|
|
|
135
135
|
this.filterObject.state.max || this.filterObject.max,
|
|
136
136
|
).format(),
|
|
137
137
|
]}
|
|
138
|
-
@select=${(e) =>
|
|
138
|
+
@select=${(e) => {
|
|
139
|
+
e.stopPropagation();
|
|
139
140
|
rangeInputHandlerMethod(
|
|
140
141
|
new CustomEvent("values", {
|
|
141
142
|
detail: {
|
|
@@ -146,7 +147,9 @@ export class EOxItemFilterRange extends LitElement {
|
|
|
146
147
|
},
|
|
147
148
|
}),
|
|
148
149
|
this,
|
|
149
|
-
)
|
|
150
|
+
);
|
|
151
|
+
}}
|
|
152
|
+
@eox:activity=${(e) => e.stopPropagation()}
|
|
150
153
|
>
|
|
151
154
|
<eox-timecontrol-date
|
|
152
155
|
.format=${DATE_TIME_FORMAT}
|
|
@@ -16,18 +16,18 @@ import { capitalize } from "../../helpers";
|
|
|
16
16
|
* key events, and selection updates.
|
|
17
17
|
*
|
|
18
18
|
* @module EOxSelector
|
|
19
|
-
* @
|
|
20
|
-
* @property {
|
|
19
|
+
* @augments LitElement
|
|
20
|
+
* @property {object} filterObject - The filter object containing state and placeholder.
|
|
21
21
|
* @property {Array} suggestions - The list of suggestions for the selector.
|
|
22
22
|
* @property {Array} selectedItems - The list of currently selected items.
|
|
23
|
-
* @property {
|
|
24
|
-
* @property {
|
|
25
|
-
* @property {
|
|
23
|
+
* @property {string} query - The current input query for autocomplete.
|
|
24
|
+
* @property {boolean} showSuggestions - Flag to control the display of suggestions in autocomplete mode.
|
|
25
|
+
* @property {number} highlightedIndex - The index of the currently highlighted suggestion.
|
|
26
26
|
* @property {Array} filteredSuggestions - The list of suggestions filtered based on the query.
|
|
27
|
-
* @property {
|
|
28
|
-
* @property {
|
|
29
|
-
* @property {
|
|
30
|
-
* @property {
|
|
27
|
+
* @property {string} type - The type of selector ("select", "multi-select", etc.).
|
|
28
|
+
* @property {boolean} unstyled - Flag to determine if default styles should be applied.
|
|
29
|
+
* @property {number} tabIndex - The tab index for the input elements.
|
|
30
|
+
* @property {boolean} inlineMode - State whether to enable or disable inline mode
|
|
31
31
|
*/
|
|
32
32
|
export class EOxSelector extends LitElement {
|
|
33
33
|
// Define properties with defaults and types
|
|
@@ -139,7 +139,7 @@ export class EOxSelector extends LitElement {
|
|
|
139
139
|
/**
|
|
140
140
|
* Toggles the selection of an item.
|
|
141
141
|
*
|
|
142
|
-
* @param {
|
|
142
|
+
* @param {object} item - The item to toggle.
|
|
143
143
|
*/
|
|
144
144
|
#toggleItem(item) {
|
|
145
145
|
toggleItemSelectorMethod(item, this);
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
/**
|
|
13
13
|
* Determines if one geometry is within another using Turf.js booleanWithin function.
|
|
14
14
|
*
|
|
15
|
-
* @param {
|
|
16
|
-
* @param {
|
|
15
|
+
* @param {object} itemGeometry - The geometry of the item.
|
|
16
|
+
* @param {object} filterGeometry - The geometry of the filter.
|
|
17
17
|
* @returns {boolean} - True if itemGeometry is within filterGeometry, otherwise false.
|
|
18
18
|
*/
|
|
19
19
|
export const within = (itemGeometry, filterGeometry) => {
|
|
@@ -28,9 +28,9 @@ export const within = (itemGeometry, filterGeometry) => {
|
|
|
28
28
|
* The component allows users to select a spatial filter mode (intersects or within) and apply it to a map.
|
|
29
29
|
*
|
|
30
30
|
* @module EOxItemFilterSpatial
|
|
31
|
-
* @
|
|
32
|
-
* @property {
|
|
33
|
-
* @property {
|
|
31
|
+
* @augments LitElement
|
|
32
|
+
* @property {object} filterObject - The filter object containing the state and geometry.
|
|
33
|
+
* @property {number} tabIndex - The tab index for the input elements.
|
|
34
34
|
*/
|
|
35
35
|
class EOxItemFilterSpatial extends LitElement {
|
|
36
36
|
// Define properties with defaults and types
|
|
@@ -132,9 +132,9 @@ customElements.define("eox-itemfilter-spatial", EOxItemFilterSpatial);
|
|
|
132
132
|
* It uses the LitElement base class and integrates with external methods for setup and reset functionalities.
|
|
133
133
|
*
|
|
134
134
|
* @module SpatialFilter
|
|
135
|
-
* @
|
|
136
|
-
* @property {
|
|
137
|
-
* @property {
|
|
135
|
+
* @augments LitElement
|
|
136
|
+
* @property {object} geometry - The geometry object used for the spatial filter.
|
|
137
|
+
* @property {object} eoxMap - The map object used to display and interact with the spatial filter.
|
|
138
138
|
*/
|
|
139
139
|
class SpatialFilter extends LitElement {
|
|
140
140
|
// Define properties with defaults and types
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { LitElement, html } from "lit";
|
|
2
2
|
import _debounce from "lodash.debounce";
|
|
3
3
|
import { when } from "lit/directives/when.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
resetTextMethod,
|
|
6
|
+
appendTextMethod,
|
|
7
|
+
textInputHandlerMethod,
|
|
8
|
+
} from "../../methods/filters";
|
|
5
9
|
|
|
6
10
|
/**
|
|
7
11
|
* EOxItemFilterText is a custom web component that provides a text input field for filtering items.
|
|
8
12
|
*
|
|
9
13
|
* @module EOxItemFilterText
|
|
10
|
-
* @
|
|
11
|
-
* @property {
|
|
12
|
-
* @property {
|
|
13
|
-
* @property {
|
|
14
|
+
* @augments LitElement
|
|
15
|
+
* @property {object} filterObject - The filter object containing the state and placeholder.
|
|
16
|
+
* @property {number} tabIndex - The tab index for the input element.
|
|
17
|
+
* @property {boolean} unstyled - Flag to determine if default styles should be applied.
|
|
14
18
|
*/
|
|
15
19
|
export class EOxItemFilterText extends LitElement {
|
|
16
20
|
// Define properties with defaults and types
|
|
@@ -89,6 +93,15 @@ export class EOxItemFilterText extends LitElement {
|
|
|
89
93
|
resetTextMethod(this);
|
|
90
94
|
}
|
|
91
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Appends text to the input and applies it by calling the appendTextMethod with the current context.
|
|
98
|
+
*
|
|
99
|
+
* @param {string} text - The text to append.
|
|
100
|
+
*/
|
|
101
|
+
appendText(text) {
|
|
102
|
+
appendTextMethod(text, this);
|
|
103
|
+
}
|
|
104
|
+
|
|
92
105
|
/**
|
|
93
106
|
* Debounced version of the input handler to improve performance by limiting the rate at which the input handler is called.
|
|
94
107
|
*/
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { LitElement, html } from "lit";
|
|
1
|
+
import { LitElement, html, nothing } from "lit";
|
|
2
2
|
import { when } from "lit/directives/when.js";
|
|
3
3
|
import { styleEOX } from "../style.eox";
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
getInlineSearchFilters,
|
|
6
|
+
applyInlineSearchMethod,
|
|
7
|
+
handleInlineSearchKeyDownMethod,
|
|
6
8
|
resetFilterMethod,
|
|
7
9
|
handleFormClickMethod,
|
|
8
10
|
handleShowDropdownOnFocusMethod,
|
|
11
|
+
handleSearchInputMethod,
|
|
9
12
|
handleToggleDropdownMethod,
|
|
10
13
|
handleKeyDownMethod,
|
|
11
14
|
handleClickOutsideMethod,
|
|
@@ -17,11 +20,12 @@ import { getChipItems, isFiltersDirty } from "../helpers";
|
|
|
17
20
|
* EOxItemFilterContainer is a custom web component that provides a container for item filters.
|
|
18
21
|
*
|
|
19
22
|
* @module EOxItemFilterContainer
|
|
20
|
-
* @
|
|
21
|
-
* @property {
|
|
22
|
-
* @property {
|
|
23
|
-
* @property {
|
|
24
|
-
* @property {
|
|
23
|
+
* @augments LitElement
|
|
24
|
+
* @property {object} filterProperties - The properties for the filter.
|
|
25
|
+
* @property {boolean} inlineMode - Flag to determine if the component should operate in inline mode.
|
|
26
|
+
* @property {boolean} unstyled - Flag to determine if default styles should be applied.
|
|
27
|
+
* @property {object} filters - The filters applied in the container.
|
|
28
|
+
* @property {string} inlineSearchText - The text in the inline search box, offered as an inline search.
|
|
25
29
|
*/
|
|
26
30
|
export class EOxItemFilterContainer extends LitElement {
|
|
27
31
|
// Define properties with defaults and types
|
|
@@ -31,6 +35,7 @@ export class EOxItemFilterContainer extends LitElement {
|
|
|
31
35
|
inlineMode: { attribute: "inline-mode", type: Boolean },
|
|
32
36
|
unstyled: { type: Boolean },
|
|
33
37
|
filters: { state: true, type: Object },
|
|
38
|
+
inlineSearchText: { state: true, type: String },
|
|
34
39
|
};
|
|
35
40
|
}
|
|
36
41
|
|
|
@@ -57,6 +62,11 @@ export class EOxItemFilterContainer extends LitElement {
|
|
|
57
62
|
*/
|
|
58
63
|
this.filters = {};
|
|
59
64
|
|
|
65
|
+
/**
|
|
66
|
+
* @type String
|
|
67
|
+
*/
|
|
68
|
+
this.inlineSearchText = "";
|
|
69
|
+
|
|
60
70
|
/**
|
|
61
71
|
* @type {(this: Document, ev: MouseEvent|FocusEvent) => any}
|
|
62
72
|
*/
|
|
@@ -186,12 +196,28 @@ export class EOxItemFilterContainer extends LitElement {
|
|
|
186
196
|
}
|
|
187
197
|
|
|
188
198
|
/**
|
|
189
|
-
*
|
|
199
|
+
* Handles typing in the inline search box.
|
|
200
|
+
*
|
|
201
|
+
* @param {Event} event - The input event.
|
|
202
|
+
*/
|
|
203
|
+
#handleSearchInput(event) {
|
|
204
|
+
handleSearchInputMethod(event, this);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Handles keydown events of the inline search box.
|
|
190
209
|
*
|
|
191
|
-
* @param {
|
|
210
|
+
* @param {KeyboardEvent} event - The keydown event.
|
|
211
|
+
*/
|
|
212
|
+
#handleInlineSearchKeyDown(event) {
|
|
213
|
+
handleInlineSearchKeyDownMethod(event, this);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Applies the inline search box text to the inline search filters.
|
|
192
218
|
*/
|
|
193
|
-
#
|
|
194
|
-
|
|
219
|
+
#applyInlineSearch() {
|
|
220
|
+
applyInlineSearchMethod(this);
|
|
195
221
|
}
|
|
196
222
|
|
|
197
223
|
/**
|
|
@@ -275,7 +301,8 @@ export class EOxItemFilterContainer extends LitElement {
|
|
|
275
301
|
type="text"
|
|
276
302
|
@click="${this.#handleToggleDropdown}"
|
|
277
303
|
@focus="${this.#handleShowDropdownOnFocus}"
|
|
278
|
-
@input="${this.#
|
|
304
|
+
@input="${this.#handleSearchInput}"
|
|
305
|
+
@keydown="${this.#handleInlineSearchKeyDown}"
|
|
279
306
|
placeholder="Search and add filter"
|
|
280
307
|
aria-haspopup="true"
|
|
281
308
|
aria-expanded="${this.showDropdown}"
|
|
@@ -293,6 +320,37 @@ export class EOxItemFilterContainer extends LitElement {
|
|
|
293
320
|
@click="${this.#handleFormClick}"
|
|
294
321
|
@focus="${this.#handleFormClick}"
|
|
295
322
|
>
|
|
323
|
+
${when(
|
|
324
|
+
this.inlineSearchText &&
|
|
325
|
+
getInlineSearchFilters(this).length,
|
|
326
|
+
() => html`
|
|
327
|
+
<button
|
|
328
|
+
type="button"
|
|
329
|
+
class="transparent responsive left-align no-margin"
|
|
330
|
+
data-cy="inline-search-action"
|
|
331
|
+
@click=${this.#applyInlineSearch}
|
|
332
|
+
>
|
|
333
|
+
${this.unstyled
|
|
334
|
+
? nothing
|
|
335
|
+
: html`
|
|
336
|
+
<i class="small">
|
|
337
|
+
<svg
|
|
338
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
339
|
+
viewBox="0 0 24 24"
|
|
340
|
+
>
|
|
341
|
+
<title>search</title>
|
|
342
|
+
<path
|
|
343
|
+
d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z"
|
|
344
|
+
/>
|
|
345
|
+
</svg>
|
|
346
|
+
</i>
|
|
347
|
+
`}
|
|
348
|
+
<span class="truncate"
|
|
349
|
+
>Search for "${this.inlineSearchText}"</span
|
|
350
|
+
>
|
|
351
|
+
</button>
|
|
352
|
+
`,
|
|
353
|
+
)}
|
|
296
354
|
<slot name="section"></slot>
|
|
297
355
|
</div>
|
|
298
356
|
</div>
|
|
@@ -14,12 +14,12 @@ import { toggleAccordion } from "../helpers";
|
|
|
14
14
|
* and creating item details and lists.
|
|
15
15
|
*
|
|
16
16
|
* @module EOxItemFilterResults
|
|
17
|
-
* @
|
|
18
|
-
* @property {
|
|
19
|
-
* @property {
|
|
20
|
-
* @property {
|
|
17
|
+
* @augments LitElement
|
|
18
|
+
* @property {object} config - The configuration object for the results display.
|
|
19
|
+
* @property {object} results - The state object containing the filter results.
|
|
20
|
+
* @property {object} filters - The state object containing the applied filters.
|
|
21
21
|
* @property {Array} resultAggregation - The array of properties used for result aggregation.
|
|
22
|
-
* @property {
|
|
22
|
+
* @property {object} selectedResult - Property with pre-selected result
|
|
23
23
|
*/
|
|
24
24
|
export class EOxItemFilterResults extends LitElement {
|
|
25
25
|
// Define properties with defaults and types
|
package/src/enums/config.js
CHANGED
|
@@ -119,3 +119,9 @@ export const ELEMENT_PROPERTIES = [
|
|
|
119
119
|
];
|
|
120
120
|
|
|
121
121
|
export const DATE_TIME_FORMAT = "YYYY-MM-DD";
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Fuzzy matching threshold for filter titles in the inline search box when an
|
|
125
|
+
* `inlineSearch` filter exists, so search terms do not match unrelated filter titles.
|
|
126
|
+
*/
|
|
127
|
+
export const INLINE_SEARCH_TITLE_THRESHOLD = 0.3;
|
package/src/enums/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import { html } from "lit";
|
|
|
3
3
|
/**
|
|
4
4
|
* Generates an array of chip items from the given filters.
|
|
5
5
|
*
|
|
6
|
-
* @param {
|
|
7
|
-
* @returns {Array<
|
|
6
|
+
* @param {object} filters - An object containing filter data.
|
|
7
|
+
* @returns {Array<object>} An array of chip item objects.
|
|
8
8
|
*/
|
|
9
9
|
function getChipItems(filters) {
|
|
10
10
|
return Object.keys(filters)
|
|
@@ -7,8 +7,8 @@ let _fuse;
|
|
|
7
7
|
/**
|
|
8
8
|
* Indexes the given items using Fuse.js with the provided configuration.
|
|
9
9
|
*
|
|
10
|
-
* @param {Array<
|
|
11
|
-
* @param {
|
|
10
|
+
* @param {Array<object>} items - The items to be indexed.
|
|
11
|
+
* @param {object} fuseConfig - Configuration object for Fuse.js.
|
|
12
12
|
*/
|
|
13
13
|
export const indexItems = (items, fuseConfig) => {
|
|
14
14
|
_fuse = new Fuse(items, {
|
|
@@ -24,10 +24,10 @@ export const indexItems = (items, fuseConfig) => {
|
|
|
24
24
|
/**
|
|
25
25
|
* Filters the given items based on the provided filters and configuration.
|
|
26
26
|
*
|
|
27
|
-
* @param {Array<
|
|
28
|
-
* @param {
|
|
29
|
-
* @param {
|
|
30
|
-
* @returns {Promise<Array<
|
|
27
|
+
* @param {Array<object>} items - The items to be filtered.
|
|
28
|
+
* @param {object} filters - The filters to be applied.
|
|
29
|
+
* @param {object} config - Configuration for filtering behavior.
|
|
30
|
+
* @returns {Promise<Array<object>>} The filtered items.
|
|
31
31
|
*/
|
|
32
32
|
export const filter = async (items, filters, config) => {
|
|
33
33
|
// Parse text, select, and multiselect filters
|
|
@@ -2,10 +2,10 @@ import { getValue } from "./";
|
|
|
2
2
|
/**
|
|
3
3
|
* Fetches and filters items based on the provided filters and configuration using an external API.
|
|
4
4
|
*
|
|
5
|
-
* @param {Array<
|
|
6
|
-
* @param {
|
|
7
|
-
* @param {
|
|
8
|
-
* @returns {Promise<Array<
|
|
5
|
+
* @param {Array<object>} items - The items to be filtered.
|
|
6
|
+
* @param {object} filters - The filters to be applied.
|
|
7
|
+
* @param {object} config - Configuration for filtering behavior.
|
|
8
|
+
* @returns {Promise<Array<object>>} The filtered items from the external API.
|
|
9
9
|
*/
|
|
10
10
|
async function filterExternal(items, filters, config) {
|
|
11
11
|
const functionResult = config.externalFilter(items, filters);
|
package/src/helpers/get-value.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Get value based on nested key or individual key
|
|
3
3
|
*
|
|
4
4
|
* @param {string|Function} key - Key to identify the value
|
|
5
|
-
* @param {
|
|
5
|
+
* @param {object} items - Items contain list of key & it's value
|
|
6
6
|
* @returns {any}
|
|
7
7
|
*/
|
|
8
8
|
export default function getValue(key, items) {
|
|
@@ -3,10 +3,10 @@ import { capitalize, mergeHighlightIndices } from "./";
|
|
|
3
3
|
/**
|
|
4
4
|
* Highlights matched text in the Fuse.js search results.
|
|
5
5
|
*
|
|
6
|
-
* @param {Array<
|
|
6
|
+
* @param {Array<object>} fuseSearchResult - The search results from Fuse.js.
|
|
7
7
|
* @param {string} [highlightClassName="highlight"] - The CSS class name to be used for highlighting.
|
|
8
8
|
* @param {string} [matchKey="title"] - The key of the object where matches should be highlighted.
|
|
9
|
-
* @returns {Array<
|
|
9
|
+
* @returns {Array<object>} The search results with highlighted matches.
|
|
10
10
|
*/
|
|
11
11
|
function highlight(
|
|
12
12
|
fuseSearchResult,
|
package/src/helpers/is-date.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Checks if the filterObject format is date-like.
|
|
3
3
|
*
|
|
4
|
-
* @param {
|
|
4
|
+
* @param {object} filterObject - The filter object.
|
|
5
5
|
* @returns {boolean} True if it is a date, otherwise false.
|
|
6
6
|
*/
|
|
7
7
|
export default function isDate(filterObject) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Checks if any of the filters are dirty.
|
|
3
3
|
*
|
|
4
|
-
* @param {
|
|
4
|
+
* @param {object} filters - An object containing filter data.
|
|
5
5
|
* @returns {boolean} True if any filter is dirty, otherwise false.
|
|
6
6
|
*/
|
|
7
7
|
export default function isFiltersDirty(filters) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generates an array of map layer configurations.
|
|
3
3
|
*
|
|
4
|
-
* @param {
|
|
4
|
+
* @param {object} [geometry] - Optional geometry data to include in the Vector source.
|
|
5
5
|
* @param {string} [url] - Optional URL for the GeoJSON data source.
|
|
6
|
-
* @returns {Array<
|
|
6
|
+
* @returns {Array<object>} An array of map layer configurations.
|
|
7
7
|
*/
|
|
8
8
|
export default function getMapLayers(geometry, url) {
|
|
9
9
|
return [
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Merge highlight indices which are overlapping with existing indices and sort the range in ascending order
|
|
3
3
|
*
|
|
4
4
|
* @param {number[][]} indices
|
|
5
|
-
* @param {
|
|
5
|
+
* @param {object} [opts]
|
|
6
6
|
* @param {boolean} [opts.mergeAdjacent=false]
|
|
7
7
|
* @returns {number[][]}
|
|
8
8
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Resets the given filter object to its default state.
|
|
3
3
|
*
|
|
4
|
-
* @param {
|
|
5
|
-
* @returns {
|
|
4
|
+
* @param {object} filterObject - The filter object to reset.
|
|
5
|
+
* @returns {object | null} The reset filter object or null if the filter was not dirty.
|
|
6
6
|
*/
|
|
7
7
|
export default function resetFilter(filterObject) {
|
|
8
8
|
// Return null if the filter is not dirty
|
package/src/helpers/spatial.js
CHANGED
|
@@ -4,8 +4,8 @@ import booleanWithin from "@turf/boolean-within";
|
|
|
4
4
|
/**
|
|
5
5
|
* Checks if the item geometry intersects with the filter geometry.
|
|
6
6
|
*
|
|
7
|
-
* @param {
|
|
8
|
-
* @param {
|
|
7
|
+
* @param {object} itemGeometry - The geometry of the item to check.
|
|
8
|
+
* @param {object} filterGeometry - The geometry of the filter to check against.
|
|
9
9
|
* @returns {boolean} True if the item geometry intersects with the filter geometry, otherwise false.
|
|
10
10
|
*/
|
|
11
11
|
export const intersects = (itemGeometry, filterGeometry) => {
|
|
@@ -20,8 +20,8 @@ export const intersects = (itemGeometry, filterGeometry) => {
|
|
|
20
20
|
/**
|
|
21
21
|
* Checks if the item geometry is within the filter geometry.
|
|
22
22
|
*
|
|
23
|
-
* @param {
|
|
24
|
-
* @param {
|
|
23
|
+
* @param {object} itemGeometry - The geometry of the item to check.
|
|
24
|
+
* @param {object} filterGeometry - The geometry of the filter to check against.
|
|
25
25
|
* @returns {boolean} True if the item geometry is within the filter geometry, otherwise false.
|
|
26
26
|
*/
|
|
27
27
|
export const within = (itemGeometry, filterGeometry) => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Handles the toggle event for the accordion.
|
|
3
3
|
*
|
|
4
4
|
* @param {CustomEvent} event - The toggle event.
|
|
5
|
-
* @param {
|
|
5
|
+
* @param {object} config - The configuration object for item-filter.
|
|
6
6
|
* @param {Element} that
|
|
7
7
|
*/
|
|
8
8
|
function toggleAccordion(event, config, that) {
|