@eox/itemfilter 1.17.5 → 1.18.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.
Files changed (40) hide show
  1. package/dist/eox-itemfilter.js +2202 -1957
  2. package/dist/eox-itemfilter.umd.cjs +114 -85
  3. package/package.json +7 -7
  4. package/src/components/filters/text.js +14 -1
  5. package/src/components/itemfilter-container.js +65 -7
  6. package/src/enums/config.js +6 -0
  7. package/src/enums/index.js +6 -1
  8. package/src/main.js +9 -2
  9. package/src/methods/chips/handler.js +0 -3
  10. package/src/methods/container/handler.js +16 -0
  11. package/src/methods/container/index.js +6 -0
  12. package/src/methods/container/inline-search.js +54 -0
  13. package/src/methods/container/reset-filter.js +4 -1
  14. package/src/methods/container/reset-search.js +6 -3
  15. package/src/methods/container/search-filter.js +9 -0
  16. package/src/methods/filters/index.js +5 -1
  17. package/src/methods/filters/text.js +13 -0
  18. package/src/methods/itemfilter/filter-apply.js +7 -0
  19. package/types/components/filters/text.d.ts +6 -0
  20. package/types/components/filters/text.d.ts.map +1 -1
  21. package/types/components/itemfilter-container.d.ts +9 -0
  22. package/types/components/itemfilter-container.d.ts.map +1 -1
  23. package/types/enums/config.d.ts +5 -0
  24. package/types/enums/config.d.ts.map +1 -1
  25. package/types/enums/index.d.ts +1 -1
  26. package/types/main.d.ts +2 -1
  27. package/types/main.d.ts.map +1 -1
  28. package/types/methods/chips/handler.d.ts.map +1 -1
  29. package/types/methods/container/handler.d.ts +8 -0
  30. package/types/methods/container/handler.d.ts.map +1 -1
  31. package/types/methods/container/index.d.ts +2 -1
  32. package/types/methods/container/inline-search.d.ts +22 -0
  33. package/types/methods/container/inline-search.d.ts.map +1 -0
  34. package/types/methods/container/reset-filter.d.ts.map +1 -1
  35. package/types/methods/container/reset-search.d.ts.map +1 -1
  36. package/types/methods/container/search-filter.d.ts.map +1 -1
  37. package/types/methods/filters/index.d.ts +1 -1
  38. package/types/methods/filters/text.d.ts +7 -0
  39. package/types/methods/filters/text.d.ts.map +1 -1
  40. package/types/methods/itemfilter/filter-apply.d.ts.map +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eox/itemfilter",
3
- "version": "1.17.5",
3
+ "version": "1.18.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.1.3"
12
+ "vite": "^8.2.2"
13
13
  },
14
14
  "engines": {
15
15
  "npm": ">=8.0.0",
@@ -41,11 +41,11 @@
41
41
  "dependencies": {
42
42
  "@eox/elements-utils": "^1.2.0",
43
43
  "@eox/ui": "^1.1.0",
44
- "@floating-ui/dom": "^1.6.8",
45
- "@turf/boolean-intersects": "^7.3.5",
46
- "@turf/boolean-within": "^7.3.5",
47
- "dayjs": "^1.11.21",
48
- "fuse.js": "^7.4.2",
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",
@@ -1,7 +1,11 @@
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 { resetTextMethod, textInputHandlerMethod } from "../../methods/filters";
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.
@@ -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
- searchFilterMethod,
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,
@@ -22,6 +25,7 @@ import { getChipItems, isFiltersDirty } from "../helpers";
22
25
  * @property {Boolean} inlineMode - Flag to determine if the component should operate in inline mode.
23
26
  * @property {Boolean} unstyled - Flag to determine if default styles should be applied.
24
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
- * Searches the filter using the searchFilterMethod.
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 {Event} event - The search event.
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
- #searchFilter(event) {
194
- searchFilterMethod(event, this);
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.#searchFilter}"
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>
@@ -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;
@@ -1 +1,6 @@
1
- export { ELEMENT_CONFIG, ELEMENT_PROPERTIES, DATE_TIME_FORMAT } from "./config";
1
+ export {
2
+ ELEMENT_CONFIG,
3
+ ELEMENT_PROPERTIES,
4
+ DATE_TIME_FORMAT,
5
+ INLINE_SEARCH_TITLE_THRESHOLD,
6
+ } from "./config";
package/src/main.js CHANGED
@@ -178,7 +178,7 @@ export class EOxItemFilter extends LitElement {
178
178
 
179
179
  /**
180
180
  * The filter properties. Can be passed as a property or stringified JSON attribute.
181
- * @type Array<{key?: String, keys?: Array<String>, title: String, type: String, placeholder?: String, format?: String, state?: Object}>
181
+ * @type Array<{key?: String, keys?: Array<String>, title: String, type: String, placeholder?: String, format?: String, state?: Object, inlineSearch?: Boolean}>
182
182
  */
183
183
  this.filterProperties = [];
184
184
 
@@ -616,7 +616,14 @@ export class EOxItemFilter extends LitElement {
616
616
  ${map(
617
617
  Object.values(this.filters),
618
618
  (filterObject, index) =>
619
- html` <li class="no-padding">
619
+ html` <li
620
+ class="no-padding"
621
+ style=${this.inlineMode &&
622
+ filterObject.inlineSearch &&
623
+ filterObject.type === "text"
624
+ ? "display: none"
625
+ : nothing}
626
+ >
620
627
  <eox-itemfilter-expandcontainer
621
628
  .filterObject=${filterObject}
622
629
  @details-toggled=${(e) =>
@@ -51,9 +51,6 @@ export function keyboardEventListenerMethod(event, EOxItemFilterChips) {
51
51
  )
52
52
  return;
53
53
 
54
- // Prevent default action for the Space key
55
- if (code === "Space") event.preventDefault();
56
-
57
54
  // Stop propagation for keys other than Escape, Space, and Enter
58
55
  if (!["Escape", "Space", "Enter"].includes(code)) event.stopPropagation();
59
56
 
@@ -1,4 +1,5 @@
1
1
  import resetSearchMethod from "./reset-search.js";
2
+ import searchFilterMethod from "./search-filter.js";
2
3
 
3
4
  /**
4
5
  * Handles the click event on the form, stopping propagation if in inline mode.
@@ -21,6 +22,21 @@ export function handleShowDropdownOnFocusMethod(EOxItemFilterContainer) {
21
22
  }
22
23
  }
23
24
 
25
+ /**
26
+ * Handles typing in the inline search box: shows the dropdown, filters the listed filters
27
+ * by title and keeps the text for the inline search action.
28
+ *
29
+ * @param {Event} event - The input event.
30
+ * @param {Object} EOxItemFilterContainer - The EOxItemFilterContainer component instance.
31
+ */
32
+ export function handleSearchInputMethod(event, EOxItemFilterContainer) {
33
+ if (!(event.target instanceof HTMLInputElement)) return;
34
+ // A search closes the dropdown but keeps focus in the box, so typing has to open it again
35
+ EOxItemFilterContainer.showDropdown = true;
36
+ searchFilterMethod(event, EOxItemFilterContainer);
37
+ EOxItemFilterContainer.inlineSearchText = event.target.value.trim();
38
+ }
39
+
24
40
  /**
25
41
  * Toggles the dropdown visibility when an event occurs, stopping propagation if in inline mode.
26
42
  *
@@ -1,9 +1,15 @@
1
1
  export { default as searchFilterMethod } from "./search-filter";
2
+ export {
3
+ getInlineSearchFilters,
4
+ applyInlineSearchMethod,
5
+ handleInlineSearchKeyDownMethod,
6
+ } from "./inline-search";
2
7
  export { default as resetFilterMethod } from "./reset-filter";
3
8
  export { default as initPopoverMethod } from "./init-popver";
4
9
  export {
5
10
  handleFormClickMethod,
6
11
  handleShowDropdownOnFocusMethod,
12
+ handleSearchInputMethod,
7
13
  handleToggleDropdownMethod,
8
14
  handleKeyDownMethod,
9
15
  handleClickOutsideMethod,
@@ -0,0 +1,54 @@
1
+ import resetSearchMethod from "./reset-search.js";
2
+
3
+ /**
4
+ * Adds the inline search box text to every text filter with `inlineSearch` enabled,
5
+ * then clears the box and closes the dropdown.
6
+ *
7
+ * @param {Object} EOxItemFilterContainer - The EOxItemFilterContainer component instance.
8
+ */
9
+ export function applyInlineSearchMethod(EOxItemFilterContainer) {
10
+ const input = EOxItemFilterContainer.renderRoot.querySelector(
11
+ "#eox-itemfilter-input-search",
12
+ );
13
+ const text = input.value.trim();
14
+ const inlineSearchFilters = getInlineSearchFilters(EOxItemFilterContainer);
15
+ if (!text || !inlineSearchFilters.length) {
16
+ return;
17
+ }
18
+
19
+ inlineSearchFilters.forEach((filter) => {
20
+ // Filter ids only replace the first "|" (see create-filter.js), so they must be escaped
21
+ EOxItemFilterContainer.querySelector(
22
+ `#${CSS.escape(`filter-${filter.key}`.replace("|", "-"))}`,
23
+ )?.appendText(text);
24
+ });
25
+
26
+ resetSearchMethod(EOxItemFilterContainer);
27
+ // Focusing the box opens the dropdown, so focus it before closing the dropdown
28
+ input.focus();
29
+ EOxItemFilterContainer.showDropdown = false;
30
+ }
31
+
32
+ /**
33
+ * Handles the keydown event of the inline search box, applying the inline search on Enter.
34
+ *
35
+ * @param {KeyboardEvent} event - The keydown event.
36
+ * @param {Object} EOxItemFilterContainer - The EOxItemFilterContainer component instance.
37
+ */
38
+ export function handleInlineSearchKeyDownMethod(event, EOxItemFilterContainer) {
39
+ // Enter that confirms an IME composition (e.g. Japanese input) is not a search
40
+ if (event.key !== "Enter" || event.isComposing) return;
41
+ applyInlineSearchMethod(EOxItemFilterContainer);
42
+ }
43
+
44
+ /**
45
+ * Returns the text filters that receive the text of the inline search box.
46
+ *
47
+ * @param {Object} EOxItemFilterContainer - The EOxItemFilterContainer component instance.
48
+ * @returns {Array<Object>} The text filters with `inlineSearch` enabled.
49
+ */
50
+ export function getInlineSearchFilters(EOxItemFilterContainer) {
51
+ return Object.values(EOxItemFilterContainer.filters).filter(
52
+ (filter) => filter.inlineSearch && filter.type === "text",
53
+ );
54
+ }
@@ -9,7 +9,10 @@ function resetFilterMethod(event, EOxItemFilterContainer) {
9
9
  return;
10
10
  }
11
11
  const filterKey = event.target.getAttribute("data-close").replace("|", "-");
12
- EOxItemFilterContainer.querySelector(`#filter-${filterKey}`).reset();
12
+ // Filter ids only replace the first "|" (see create-filter.js), so they must be escaped
13
+ EOxItemFilterContainer.querySelector(
14
+ `#${CSS.escape(`filter-${filterKey}`)}`,
15
+ ).reset();
13
16
  EOxItemFilterContainer.dispatchEvent(new CustomEvent("filter"));
14
17
  EOxItemFilterContainer.requestUpdate();
15
18
  }
@@ -6,10 +6,13 @@ import searchFilterMethod from "./search-filter.js";
6
6
  * @param {Object} EOxItemFilterContainer - The EOxItemFilterContainer component instance.
7
7
  */
8
8
  function resetSearchMethod(EOxItemFilterContainer) {
9
- EOxItemFilterContainer.renderRoot.querySelector(
9
+ const input = EOxItemFilterContainer.renderRoot.querySelector(
10
10
  "#eox-itemfilter-input-search",
11
- ).value = "";
12
- const event = { target: { value: "" } };
11
+ );
12
+ input.value = "";
13
+ EOxItemFilterContainer.inlineSearchText = "";
14
+ // searchFilterMethod only accepts events targeting a real input element
15
+ const event = { target: input };
13
16
  searchFilterMethod(
14
17
  /** @type {Event} **/ (/** @type {unknown} **/ (event)),
15
18
  EOxItemFilterContainer,
@@ -1,4 +1,5 @@
1
1
  import Fuse from "fuse.js";
2
+ import { INLINE_SEARCH_TITLE_THRESHOLD } from "../../enums/index.js";
2
3
 
3
4
  /**
4
5
  * Filters the items in the EOxItemFilterContainer based on the search input.
@@ -7,9 +8,15 @@ import Fuse from "fuse.js";
7
8
  * @param {Object} EOxItemFilterContainer - The EOxItemFilterContainer component instance.
8
9
  */
9
10
  function searchFilterMethod(event, EOxItemFilterContainer) {
11
+ const isInlineSearch = (filter) =>
12
+ filter.inlineSearch && filter.type === "text";
10
13
  // Create a Fuse instance for fuzzy searching with the filter properties
11
14
  const fuse = new Fuse(EOxItemFilterContainer.filterProperties, {
12
15
  keys: ["title"],
16
+ // Stricter title matching for inlineSearch
17
+ ...(EOxItemFilterContainer.filterProperties.some(isInlineSearch) && {
18
+ threshold: INLINE_SEARCH_TITLE_THRESHOLD,
19
+ }),
13
20
  });
14
21
  if (!(event.target instanceof HTMLInputElement)) {
15
22
  return;
@@ -20,6 +27,8 @@ function searchFilterMethod(event, EOxItemFilterContainer) {
20
27
 
21
28
  // Update the display of filter elements based on the search results
22
29
  Object.keys(EOxItemFilterContainer.filters).forEach((filter) => {
30
+ // Hidden in inline mode (see main.js), as the inline search box is its input
31
+ if (isInlineSearch(EOxItemFilterContainer.filters[filter])) return;
23
32
  EOxItemFilterContainer.querySelector(
24
33
  `[data-details="${filter}"]`,
25
34
  ).parentElement.style.display =
@@ -1,4 +1,8 @@
1
- export { resetTextMethod, textInputHandlerMethod } from "./text";
1
+ export {
2
+ resetTextMethod,
3
+ appendTextMethod,
4
+ textInputHandlerMethod,
5
+ } from "./text";
2
6
  export {
3
7
  rangeLabelMethod,
4
8
  resetRangeMethod,
@@ -13,6 +13,19 @@ export function resetTextMethod(EOxItemFilterText) {
13
13
  EOxItemFilterText.requestUpdate();
14
14
  }
15
15
 
16
+ /**
17
+ * Appends text to the text filter input and applies it.
18
+ *
19
+ * @param {string} text - The text to append.
20
+ * @param {Object} EOxItemFilterText - The EOxItemFilterText component instance.
21
+ */
22
+ export function appendTextMethod(text, EOxItemFilterText) {
23
+ const searchInput =
24
+ EOxItemFilterText.renderRoot.querySelector("input[type='text']");
25
+ searchInput.value = [searchInput.value, text].filter(Boolean).join(" ");
26
+ EOxItemFilterText.debouncedInputHandler();
27
+ }
28
+
16
29
  /**
17
30
  * Handles input changes for the text filter and updates the filter state accordingly.
18
31
  *
@@ -54,6 +54,8 @@ function filterApplyMethod(config, items, EOxItemFilter) {
54
54
  }
55
55
  return;
56
56
  }
57
+ // Text filters use `keys`, so no state keys come from item values
58
+ if (filterProperty.type === "text") return;
57
59
  if (Array.isArray(item[filterProperty.key])) {
58
60
  item[filterProperty.key].forEach((prop) => {
59
61
  filterKeys[prop] = undefined;
@@ -153,6 +155,11 @@ function filterApplyMethod(config, items, EOxItemFilter) {
153
155
  existingFilter?.state || {},
154
156
  filterProperty.state,
155
157
  );
158
+ if (filterProperty.type === "text") {
159
+ EOxItemFilter.filters[filterKey].stringifiedState = Object.values(
160
+ EOxItemFilter.filters[filterKey].state,
161
+ ).find(Boolean);
162
+ }
156
163
 
157
164
  if (filterProperty.type === "range" && filterProperty.state) {
158
165
  const parseVal = (val) => {
@@ -49,6 +49,12 @@ export class EOxItemFilterText extends LitElement {
49
49
  * Resets the text input by calling the resetTextMethod with the current context.
50
50
  */
51
51
  reset(): void;
52
+ /**
53
+ * Appends text to the input and applies it by calling the appendTextMethod with the current context.
54
+ *
55
+ * @param {string} text - The text to append.
56
+ */
57
+ appendText(text: string): void;
52
58
  /**
53
59
  * Debounced version of the input handler to improve performance by limiting the rate at which the input handler is called.
54
60
  */
@@ -1 +1 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/components/filters/text.js"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH;IAEE;;;;;;;;;;;;;;;;;;;;MAQC;IAKC;;OAEG;IACH,kBAAsB;IAEtB;;OAEG;IACH,eAAmB;IAEnB;;OAEG;IACH,kBAAqB;IAOrB;;OAEG;IACH,iBAAoB;IAgCtB;;OAEG;IACH,cAEC;IAED;;OAEG;IACH,yEAEG;IAEH;;;;OAIG;IACH,oBAFa,IAAI,CAIhB;IAGD,oBAkCC;;CACF;2BA/IgC,KAAK"}
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/components/filters/text.js"],"names":[],"mappings":"AASA;;;;;;;;GAQG;AACH;IAEE;;;;;;;;;;;;;;;;;;;;MAQC;IAKC;;OAEG;IACH,kBAAsB;IAEtB;;OAEG;IACH,eAAmB;IAEnB;;OAEG;IACH,kBAAqB;IAOrB;;OAEG;IACH,iBAAoB;IAgCtB;;OAEG;IACH,cAEC;IAED;;;;OAIG;IACH,iBAFW,MAAM,QAIhB;IAED;;OAEG;IACH,yEAEG;IAEH;;;;OAIG;IACH,oBAFa,IAAI,CAIhB;IAGD,oBAkCC;;CACF;2BA5JgC,KAAK"}
@@ -7,6 +7,7 @@
7
7
  * @property {Boolean} inlineMode - Flag to determine if the component should operate in inline mode.
8
8
  * @property {Boolean} unstyled - Flag to determine if default styles should be applied.
9
9
  * @property {Object} filters - The filters applied in the container.
10
+ * @property {String} inlineSearchText - The text in the inline search box, offered as an inline search.
10
11
  */
11
12
  export class EOxItemFilterContainer extends LitElement {
12
13
  static get properties(): {
@@ -25,6 +26,10 @@ export class EOxItemFilterContainer extends LitElement {
25
26
  state: boolean;
26
27
  type: ObjectConstructor;
27
28
  };
29
+ inlineSearchText: {
30
+ state: boolean;
31
+ type: StringConstructor;
32
+ };
28
33
  };
29
34
  /**
30
35
  * @type Object
@@ -42,6 +47,10 @@ export class EOxItemFilterContainer extends LitElement {
42
47
  * @type Object
43
48
  */
44
49
  filters: any;
50
+ /**
51
+ * @type String
52
+ */
53
+ inlineSearchText: string;
45
54
  /**
46
55
  * @type {(this: Document, ev: MouseEvent|FocusEvent) => any}
47
56
  */
@@ -1 +1 @@
1
- {"version":3,"file":"itemfilter-container.d.ts","sourceRoot":"","sources":["../../src/components/itemfilter-container.js"],"names":[],"mappings":"AAeA;;;;;;;;;GASG;AACH;IAEE;;;;;;;;;;;;;;;;MAOC;IAKC;;OAEG;IACH,sBAA0B;IAE1B;;OAEG;IACH,kBAAqB;IAErB;;OAEG;IACH,oBAAuB;IAEvB;;OAEG;IACH,aAAiB;IAEjB;;OAEG;IACH,qBAFU,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,GAAC,UAAU,KAAK,GAAG,CAEE;IAE9D;;OAEG;IACH,gBAFU,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,aAAa,KAAK,GAAG,CAEA;IAGtD;;OAEG;IACH,gCAIC;IAED,4BAEC;IA6CD;;;;;;OAMG;IACH,wBAAoB;IA+DpB;;;OAGG;IACH,qBAEC;IAED,uCAKC;IAED;;OAEG;IACH,+CAwFC;;CACF;2BA/SgC,KAAK"}
1
+ {"version":3,"file":"itemfilter-container.d.ts","sourceRoot":"","sources":["../../src/components/itemfilter-container.js"],"names":[],"mappings":"AAkBA;;;;;;;;;;GAUG;AACH;IAEE;;;;;;;;;;;;;;;;;;;;MAQC;IAKC;;OAEG;IACH,sBAA0B;IAE1B;;OAEG;IACH,kBAAqB;IAErB;;OAEG;IACH,oBAAuB;IAEvB;;OAEG;IACH,aAAiB;IAEjB;;OAEG;IACH,yBAA0B;IAE1B;;OAEG;IACH,qBAFU,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,GAAC,UAAU,KAAK,GAAG,CAEE;IAE9D;;OAEG;IACH,gBAFU,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,aAAa,KAAK,GAAG,CAEA;IAGtD;;OAEG;IACH,gCAIC;IAED,4BAEC;IA6CD;;;;;;OAMG;IACH,wBAAoB;IA+EpB;;;OAGG;IACH,qBAEC;IAED,uCAKC;IAED;;OAEG;IACH,+CAwHC;;CACF;2BAzWyC,KAAK"}
@@ -82,4 +82,9 @@ export const ELEMENT_CONFIG: Readonly<{
82
82
  }>;
83
83
  export const ELEMENT_PROPERTIES: string[];
84
84
  export const DATE_TIME_FORMAT: "YYYY-MM-DD";
85
+ /**
86
+ * Fuzzy matching threshold for filter titles in the inline search box when an
87
+ * `inlineSearch` filter exists, so search terms do not match unrelated filter titles.
88
+ */
89
+ export const INLINE_SEARCH_TITLE_THRESHOLD: 0.3;
85
90
  //# sourceMappingURL=config.d.ts.map
@@ -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;;;;;OAKG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;OAGG;;GAEF;AAEH,0CAmBE;AAEF,+BAAgC,YAAY,CAAC"}
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;AAEF,+BAAgC,YAAY,CAAC;AAE7C;;;GAGG;AACH,4CAA6C,GAAG,CAAC"}
@@ -1,2 +1,2 @@
1
- export { ELEMENT_CONFIG, ELEMENT_PROPERTIES, DATE_TIME_FORMAT } from "./config";
1
+ export { ELEMENT_CONFIG, ELEMENT_PROPERTIES, DATE_TIME_FORMAT, INLINE_SEARCH_TITLE_THRESHOLD } from "./config";
2
2
  //# sourceMappingURL=index.d.ts.map
package/types/main.d.ts CHANGED
@@ -184,7 +184,7 @@ export class EOxItemFilter extends LitElement {
184
184
  });
185
185
  /**
186
186
  * The filter properties. Can be passed as a property or stringified JSON attribute.
187
- * @type Array<{key?: String, keys?: Array<String>, title: String, type: String, placeholder?: String, format?: String, state?: Object}>
187
+ * @type Array<{key?: String, keys?: Array<String>, title: String, type: String, placeholder?: String, format?: String, state?: Object, inlineSearch?: Boolean}>
188
188
  */
189
189
  filterProperties: Array<{
190
190
  key?: string;
@@ -194,6 +194,7 @@ export class EOxItemFilter extends LitElement {
194
194
  placeholder?: string;
195
195
  format?: string;
196
196
  state?: any;
197
+ inlineSearch?: boolean;
197
198
  }>;
198
199
  /**
199
200
  * Native fuse.js config override
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.js"],"names":[],"mappings":"AA8BA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH;IAEE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAmCC;IAoBC;;OAEG;IACH,OAFS,KAAK,KAAQ,CAEL;IAEjB;;;OAGG;IACH,aAAiB;IAEjB;;;OAGG;IACH,SAFS,KAAK,KAAQ,CAEL;IAEjB;;;OAGG;IACH,oBAA0B;IAE1B;;;OAGG;IACH,eAEE;IAEF;;;;OAIG;IACH,yBAAiC;IAEjC;;;;;OAKG;IACH,0BAA6B;IAE7B;;;;OAIG;IACH,4BAA+B;IAE/B;;;;;;;;;OASG;IACH,gBAFU,MAAM,MAAM,GAAE,CAAC,MAAM;QAAC,GAAG,EAAC,MAAM,CAAC;QAAA,GAAG,CAAC,EAAC,MAAM,CAAC;QAAA,OAAO,CAAC,EAAC,MAAM,CAAA;KAAC,CAAC,CAE9C;IAE1B;;;OAGG;IACH,kBAFS,KAAK,CAAC;QAAC,GAAG,CAAC,SAAS;QAAC,IAAI,CAAC,EAAE,KAAK,QAAQ,CAAC;QAAC,KAAK,SAAS;QAAC,IAAI,SAAS;QAAC,WAAW,CAAC,SAAS;QAAC,MAAM,CAAC,SAAS;QAAC,KAAK,CAAC,MAAQ;KAAC,CAAC,CAE9G;IAE1B;;;;OAIG;IACH,gBAAoB;IAEpB;;;;;OAKG;IACH,oBAAuB;IAEvB;;;;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AAA;KAAC,CAElC;IAE9B;;;;OAIG;IACH,mBAAsB;IAEtB;;;;OAIG;IACH,+BAAiC;IAEjC;;;;OAIG;IACH,uBAAyB;IACzB;;;;OAIG;IACH,+BAAiC;IAEjC;;;;OAIG;IACH,mBAAwB;IAExB;;;;OAIG;IACH,4BAA+B;IAE/B;;;;OAIG;IACH,yBAC65B;IAE75B;;;OAGG;IACH,sBAAuB;IAEvB;;OAEG;IACH,kBAAqB;IAGvB;;OAEG;IACH,cAWC;IAED;;;OAGG;IACH,+BAoBC;IAED;;;;;;;OAOG;IACH,mBALW,KAAK,CAAC,MAAM,CAAC,YAErB;QAA0B,gBAAgB,GAAlC,OAAO;KACf,GAAU,KAAK,CAAC,MAAM,CAAC,CAIzB;IAwBD;;OAEG;IACH,qBAEC;IAED;;;;;OAKG;IACH,sDAcC;IAED;;;;;OAKG;IACH,gDAkCC;IAED;;;;OAIG;IACH,kBAFW;QAAC,MAAM,MAAQ;KAAC,QAe1B;IAED;;;;OAIG;IACH,sBAFW;QAAC,MAAM,MAAQ;KAAC,QAa1B;IAED;;;;OAIG;IACH,sBAFW;QAAC,MAAM,MAAQ;KAAC,QAa1B;IAED;;;;OAIG;IACH,sBAFW;QAAC,MAAM,MAAQ;KAAC,QAa1B;IAED;;OAEG;IACH,+CAgJC;;CACF;2BAvqByC,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/methods/chips/handler.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,2CAHW,KAAK,iCAaf;AAED;;;;;;GAMG;AACH,yCAJW,KAAK,SACL,MAAM,iCAMhB;AAED;;;;;GAKG;AACH,mDAHW,aAAa,iCAiCvB"}
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/methods/chips/handler.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,2CAHW,KAAK,iCAaf;AAED;;;;;;GAMG;AACH,yCAJW,KAAK,SACL,MAAM,iCAMhB;AAED;;;;;GAKG;AACH,mDAHW,aAAa,iCA8BvB"}
@@ -11,6 +11,14 @@ export function handleFormClickMethod(event: Event, EOxItemFilterContainer: any)
11
11
  * @param {Object} EOxItemFilterContainer - The EOxItemFilterContainer component instance.
12
12
  */
13
13
  export function handleShowDropdownOnFocusMethod(EOxItemFilterContainer: any): void;
14
+ /**
15
+ * Handles typing in the inline search box: shows the dropdown, filters the listed filters
16
+ * by title and keeps the text for the inline search action.
17
+ *
18
+ * @param {Event} event - The input event.
19
+ * @param {Object} EOxItemFilterContainer - The EOxItemFilterContainer component instance.
20
+ */
21
+ export function handleSearchInputMethod(event: Event, EOxItemFilterContainer: any): void;
14
22
  /**
15
23
  * Toggles the dropdown visibility when an event occurs, stopping propagation if in inline mode.
16
24
  *
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/methods/container/handler.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,6CAHW,KAAK,qCAKf;AAED;;;;GAIG;AACH,mFAIC;AAED;;;;;GAKG;AACH,kDAHW,KAAK,qCAQf;AAED;;;;;GAKG;AACH,2CAHW,aAAa,qCAYvB;AAED;;;;;GAKG;AACH,gDAHW,KAAK,qCAcf"}
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/methods/container/handler.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,6CAHW,KAAK,qCAKf;AAED;;;;GAIG;AACH,mFAIC;AAED;;;;;;GAMG;AACH,+CAHW,KAAK,qCASf;AAED;;;;;GAKG;AACH,kDAHW,KAAK,qCAQf;AAED;;;;;GAKG;AACH,2CAHW,aAAa,qCAYvB;AAED;;;;;GAKG;AACH,gDAHW,KAAK,qCAcf"}
@@ -1,5 +1,6 @@
1
1
  export { default as searchFilterMethod } from "./search-filter";
2
2
  export { default as resetFilterMethod } from "./reset-filter";
3
3
  export { default as initPopoverMethod } from "./init-popver";
4
- export { handleFormClickMethod, handleShowDropdownOnFocusMethod, handleToggleDropdownMethod, handleKeyDownMethod, handleClickOutsideMethod } from "./handler";
4
+ export { getInlineSearchFilters, applyInlineSearchMethod, handleInlineSearchKeyDownMethod } from "./inline-search";
5
+ export { handleFormClickMethod, handleShowDropdownOnFocusMethod, handleSearchInputMethod, handleToggleDropdownMethod, handleKeyDownMethod, handleClickOutsideMethod } from "./handler";
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Adds the inline search box text to every text filter with `inlineSearch` enabled,
3
+ * then clears the box and closes the dropdown.
4
+ *
5
+ * @param {Object} EOxItemFilterContainer - The EOxItemFilterContainer component instance.
6
+ */
7
+ export function applyInlineSearchMethod(EOxItemFilterContainer: any): void;
8
+ /**
9
+ * Handles the keydown event of the inline search box, applying the inline search on Enter.
10
+ *
11
+ * @param {KeyboardEvent} event - The keydown event.
12
+ * @param {Object} EOxItemFilterContainer - The EOxItemFilterContainer component instance.
13
+ */
14
+ export function handleInlineSearchKeyDownMethod(event: KeyboardEvent, EOxItemFilterContainer: any): void;
15
+ /**
16
+ * Returns the text filters that receive the text of the inline search box.
17
+ *
18
+ * @param {Object} EOxItemFilterContainer - The EOxItemFilterContainer component instance.
19
+ * @returns {Array<Object>} The text filters with `inlineSearch` enabled.
20
+ */
21
+ export function getInlineSearchFilters(EOxItemFilterContainer: any): Array<any>;
22
+ //# sourceMappingURL=inline-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-search.d.ts","sourceRoot":"","sources":["../../../src/methods/container/inline-search.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,2EAqBC;AAED;;;;;GAKG;AACH,uDAHW,aAAa,qCAOvB;AAED;;;;;GAKG;AACH,qEAFa,KAAK,KAAQ,CAMzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"reset-filter.d.ts","sourceRoot":"","sources":["../../../src/methods/container/reset-filter.js"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,0CAHW,KAAK,qCAWf"}
1
+ {"version":3,"file":"reset-filter.d.ts","sourceRoot":"","sources":["../../../src/methods/container/reset-filter.js"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,0CAHW,KAAK,qCAcf"}
@@ -1 +1 @@
1
- {"version":3,"file":"reset-search.d.ts","sourceRoot":"","sources":["../../../src/methods/container/reset-search.js"],"names":[],"mappings":";AAEA;;;;GAIG;AACH,sEASC"}
1
+ {"version":3,"file":"reset-search.d.ts","sourceRoot":"","sources":["../../../src/methods/container/reset-search.js"],"names":[],"mappings":";AAEA;;;;GAIG;AACH,sEAYC"}