@dragonmastery/zinia-forms-core 0.5.5 → 0.5.6

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/index.d.ts CHANGED
@@ -2064,6 +2064,8 @@ interface ColumnDefinition<TData, TField extends keyof TData> {
2064
2064
  filterAllowCreate?: boolean;
2065
2065
  filterAllOptionText?: string;
2066
2066
  filterShowAllOption?: boolean;
2067
+ filterSearchable?: boolean;
2068
+ filterDefaultOperator?: 'eq' | 'ne' | 'in' | 'notIn';
2067
2069
  sortLabels?: {
2068
2070
  asc: string;
2069
2071
  desc: string;
package/dist/index.js CHANGED
@@ -8555,6 +8555,9 @@ var EnumMultiSelectFilter = (props) => {
8555
8555
  }
8556
8556
  return String(a) === String(b);
8557
8557
  };
8558
+ const sanitizeTestId = (value) => {
8559
+ return String(value).replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/-+/g, "-").replace(/^-|-$/g, "");
8560
+ };
8558
8561
  const selectedOptions = computed(() => {
8559
8562
  return selectedValues.map((val) => {
8560
8563
  const option = props.options.find((opt) => valuesEqual(opt.value, val));
@@ -8562,11 +8565,17 @@ var EnumMultiSelectFilter = (props) => {
8562
8565
  }).filter((opt) => Boolean(opt));
8563
8566
  });
8564
8567
  const filteredOptions = computed(() => {
8568
+ const uniqueOptions = props.options.filter((opt, index, self) => {
8569
+ return index === self.findIndex((o) => valuesEqual(o.value, opt.value));
8570
+ });
8571
+ if (props.searchable === false) {
8572
+ return uniqueOptions;
8573
+ }
8565
8574
  const query = state.searchQuery.trim().toLowerCase();
8566
8575
  if (!query) {
8567
- return props.options;
8576
+ return uniqueOptions;
8568
8577
  }
8569
- return props.options.filter((opt) => opt.label.toLowerCase().includes(query));
8578
+ return uniqueOptions.filter((opt) => opt.label.toLowerCase().includes(query));
8570
8579
  });
8571
8580
  const updateDropdownPosition = () => {
8572
8581
  const container = document.querySelector(`[data-enum-multiselect-container="${props.field}"]`);
@@ -8674,8 +8683,11 @@ var EnumMultiSelectFilter = (props) => {
8674
8683
  if (state.cleanupFns.length > 0) return;
8675
8684
  window.addEventListener("scroll", handleScrollOrResize, true);
8676
8685
  window.addEventListener("resize", handleScrollOrResize);
8677
- document.addEventListener("click", handleClickOutside, true);
8686
+ const clickTimeout = setTimeout(() => {
8687
+ document.addEventListener("click", handleClickOutside, true);
8688
+ }, 0);
8678
8689
  state.cleanupFns.push(() => {
8690
+ clearTimeout(clickTimeout);
8679
8691
  window.removeEventListener("scroll", handleScrollOrResize, true);
8680
8692
  window.removeEventListener("resize", handleScrollOrResize);
8681
8693
  document.removeEventListener("click", handleClickOutside, true);
@@ -8688,6 +8700,10 @@ var EnumMultiSelectFilter = (props) => {
8688
8700
  }
8689
8701
  };
8690
8702
  const handleFocus = () => {
8703
+ if (state.blurTimeoutId) {
8704
+ clearTimeout(state.blurTimeoutId);
8705
+ state.blurTimeoutId = void 0;
8706
+ }
8691
8707
  if (state.pendingValues === void 0) {
8692
8708
  state.pendingValues = Array.isArray(props.value) ? [...props.value] : props.value ? [props.value] : [];
8693
8709
  }
@@ -8696,15 +8712,28 @@ var EnumMultiSelectFilter = (props) => {
8696
8712
  setupEventListeners();
8697
8713
  };
8698
8714
  const handleBlur = (e) => {
8699
- setTimeout(() => {
8700
- const relatedTarget = e.relatedTarget || document.activeElement;
8715
+ if (state.blurTimeoutId) {
8716
+ clearTimeout(state.blurTimeoutId);
8717
+ }
8718
+ state.blurTimeoutId = setTimeout(() => {
8719
+ state.blurTimeoutId = void 0;
8720
+ const activeElement = document.activeElement;
8701
8721
  const container = document.querySelector(
8702
8722
  `[data-enum-multiselect-container="${props.field}"]`
8703
8723
  );
8704
8724
  const dropdown = document.querySelector(`[data-enum-multiselect-dropdown="${props.field}"]`);
8705
- if (container && container.contains(relatedTarget) || dropdown && dropdown.contains(relatedTarget)) {
8725
+ if (container && container.contains(activeElement)) {
8726
+ return;
8727
+ }
8728
+ if (dropdown && dropdown.contains(activeElement)) {
8706
8729
  return;
8707
8730
  }
8731
+ const relatedTarget = e.relatedTarget;
8732
+ if (relatedTarget) {
8733
+ if (container && container.contains(relatedTarget) || dropdown && dropdown.contains(relatedTarget)) {
8734
+ return;
8735
+ }
8736
+ }
8708
8737
  if (state.isOpen) {
8709
8738
  applyPendingFilter();
8710
8739
  state.isOpen = false;
@@ -8712,7 +8741,7 @@ var EnumMultiSelectFilter = (props) => {
8712
8741
  state.selectedIndex = -1;
8713
8742
  cleanupEventListeners();
8714
8743
  }
8715
- }, 100);
8744
+ }, 150);
8716
8745
  };
8717
8746
  const handleKeyDown = (e) => {
8718
8747
  if (e.key === "Escape") {
@@ -8805,7 +8834,7 @@ var EnumMultiSelectFilter = (props) => {
8805
8834
  "div",
8806
8835
  {
8807
8836
  class: "badge badge-primary badge-sm gap-1.5 pr-1 max-w-full",
8808
- "data-testid": `datatable-filter-${props.field}-chip-${option.value}`,
8837
+ "data-testid": `datatable-filter-${props.field}-chip-${sanitizeTestId(option.value)}`,
8809
8838
  children: [
8810
8839
  /* @__PURE__ */ jsx("span", { class: "truncate max-w-[120px] sm:max-w-[200px]", title: option.label, children: option.label }),
8811
8840
  /* @__PURE__ */ jsx(
@@ -8842,42 +8871,83 @@ var EnumMultiSelectFilter = (props) => {
8842
8871
  String(option.value)
8843
8872
  )) }),
8844
8873
  /* @__PURE__ */ jsxs("div", { class: "relative", "data-enum-multiselect-container": props.field, children: [
8845
- /* @__PURE__ */ jsx(
8846
- "input",
8874
+ props.searchable !== false ? /* @__PURE__ */ jsxs(Fragment, { children: [
8875
+ /* @__PURE__ */ jsx(
8876
+ "input",
8877
+ {
8878
+ type: "text",
8879
+ value: state.searchQuery,
8880
+ onInput: (e) => {
8881
+ const value = e.target.value;
8882
+ state.searchQuery = value;
8883
+ state.isOpen = true;
8884
+ state.selectedIndex = -1;
8885
+ updateDropdownPosition();
8886
+ if (!state.cleanupFns || state.cleanupFns.length === 0) {
8887
+ setupEventListeners();
8888
+ }
8889
+ },
8890
+ onFocus: handleFocus,
8891
+ onBlur: handleBlur,
8892
+ onKeydown: handleKeyDown,
8893
+ placeholder: props.isOptionsLoading ? "Loading options..." : selectedOptions.value.length > 0 ? `Search ${props.label}...` : `Select ${props.label}...`,
8894
+ class: "input input-bordered input-sm w-full pr-8",
8895
+ disabled: props.isLoading || props.isOptionsLoading,
8896
+ "data-testid": `datatable-filter-${props.field}-input`
8897
+ }
8898
+ ),
8899
+ /* @__PURE__ */ jsx("div", { class: "absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none", children: /* @__PURE__ */ jsx(
8900
+ "svg",
8901
+ {
8902
+ xmlns: "http://www.w3.org/2000/svg",
8903
+ class: `h-4 w-4 text-base-content/50 transition-transform ${state.isOpen ? "rotate-180" : ""}`,
8904
+ fill: "none",
8905
+ viewBox: "0 0 24 24",
8906
+ stroke: "currentColor",
8907
+ "stroke-width": "2",
8908
+ children: /* @__PURE__ */ jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M19 9l-7 7-7-7" })
8909
+ }
8910
+ ) })
8911
+ ] }) : /* @__PURE__ */ jsxs(
8912
+ "button",
8847
8913
  {
8848
- type: "text",
8849
- value: state.searchQuery,
8850
- onInput: (e) => {
8851
- const value = e.target.value;
8852
- state.searchQuery = value;
8853
- state.isOpen = true;
8854
- state.selectedIndex = -1;
8855
- updateDropdownPosition();
8856
- if (!state.cleanupFns || state.cleanupFns.length === 0) {
8914
+ type: "button",
8915
+ onClick: (e) => {
8916
+ e.preventDefault();
8917
+ e.stopPropagation();
8918
+ if (state.isOpen) {
8919
+ closeDropdown();
8920
+ } else {
8921
+ if (state.pendingValues === void 0) {
8922
+ state.pendingValues = Array.isArray(props.value) ? [...props.value] : props.value ? [props.value] : [];
8923
+ }
8924
+ state.isOpen = true;
8925
+ updateDropdownPosition();
8857
8926
  setupEventListeners();
8858
8927
  }
8859
8928
  },
8860
- onFocus: handleFocus,
8861
8929
  onBlur: handleBlur,
8862
8930
  onKeydown: handleKeyDown,
8863
- placeholder: props.isOptionsLoading ? "Loading options..." : selectedOptions.value.length > 0 ? `Search ${props.label}...` : `Select ${props.label}...`,
8864
- class: "input input-bordered input-sm w-full pr-8",
8931
+ class: "select select-bordered select-sm w-full pr-8 text-left cursor-pointer",
8865
8932
  disabled: props.isLoading || props.isOptionsLoading,
8866
- "data-testid": `datatable-filter-${props.field}-input`
8933
+ "data-testid": `datatable-filter-${props.field}-input`,
8934
+ children: [
8935
+ /* @__PURE__ */ jsx("span", { class: "truncate block", children: props.isOptionsLoading ? "Loading options..." : selectedOptions.value.length > 0 ? `${selectedOptions.value.length} selected` : `Select ${props.label}...` }),
8936
+ /* @__PURE__ */ jsx(
8937
+ "svg",
8938
+ {
8939
+ xmlns: "http://www.w3.org/2000/svg",
8940
+ class: `absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-base-content/50 transition-transform pointer-events-none ${state.isOpen ? "rotate-180" : ""}`,
8941
+ fill: "none",
8942
+ viewBox: "0 0 24 24",
8943
+ stroke: "currentColor",
8944
+ "stroke-width": "2",
8945
+ children: /* @__PURE__ */ jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M19 9l-7 7-7-7" })
8946
+ }
8947
+ )
8948
+ ]
8867
8949
  }
8868
8950
  ),
8869
- /* @__PURE__ */ jsx("div", { class: "absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none", children: /* @__PURE__ */ jsx(
8870
- "svg",
8871
- {
8872
- xmlns: "http://www.w3.org/2000/svg",
8873
- class: `h-4 w-4 text-base-content/50 transition-transform ${state.isOpen ? "rotate-180" : ""}`,
8874
- fill: "none",
8875
- viewBox: "0 0 24 24",
8876
- stroke: "currentColor",
8877
- "stroke-width": "2",
8878
- children: /* @__PURE__ */ jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M19 9l-7 7-7-7" })
8879
- }
8880
- ) }),
8881
8951
  state.isOpen && /* @__PURE__ */ jsx(Teleport, { to: "body", children: /* @__PURE__ */ jsxs(
8882
8952
  "div",
8883
8953
  {
@@ -8949,7 +9019,7 @@ var EnumMultiSelectFilter = (props) => {
8949
9019
  checked: isSelected,
8950
9020
  onChange: () => toggleOption(option),
8951
9021
  class: "checkbox checkbox-sm checkbox-primary",
8952
- "data-testid": `datatable-filter-${props.field}-option-${option.value}`,
9022
+ "data-testid": `datatable-filter-${props.field}-option-${sanitizeTestId(option.value)}`,
8953
9023
  tabindex: -1
8954
9024
  }
8955
9025
  ),
@@ -8969,9 +9039,10 @@ var EnumMultiSelectFilter = (props) => {
8969
9039
  ] });
8970
9040
  };
8971
9041
  var SelectFilter = (props) => {
8972
- const currentOperator = props.operator || OPERATORS.IS_ONE_OF;
9042
+ const defaultOp = props.defaultOperator || OPERATORS.IS_ONE_OF;
9043
+ const currentOperator = props.operator || defaultOp;
8973
9044
  const isArrayOperator = currentOperator === OPERATORS.IS_ONE_OF || currentOperator === OPERATORS.IS_NOT_ONE_OF;
8974
- const isDefaultOperator = currentOperator === OPERATORS.IS_ONE_OF;
9045
+ const isDefaultOperator = currentOperator === defaultOp;
8975
9046
  const showOperatorSelect = !isDefaultOperator;
8976
9047
  const selectedValues = Array.isArray(props.value) ? props.value : props.value ? [props.value] : [];
8977
9048
  const handleValueChange = (value) => {
@@ -9028,6 +9099,7 @@ var SelectFilter = (props) => {
9028
9099
  isLoading: props.isLoading,
9029
9100
  isOptionsLoading: props.isOptionsLoading,
9030
9101
  operator: currentOperator,
9102
+ searchable: props.searchable,
9031
9103
  onFilterChange: props.onFilterChange,
9032
9104
  onClearFilter: props.onClearFilter
9033
9105
  }
@@ -9386,7 +9458,8 @@ var ComboboxFilter = (props) => {
9386
9458
  comboboxState[props.field] = {
9387
9459
  isOpen: false,
9388
9460
  selectedIndex: -1,
9389
- position: { top: 0, left: 0, width: 0, openUpward: false }
9461
+ position: { top: 0, left: 0, width: 0, openUpward: false },
9462
+ isFocused: false
9390
9463
  };
9391
9464
  }
9392
9465
  const state = comboboxState[props.field];
@@ -9590,6 +9663,7 @@ var ComboboxFilter = (props) => {
9590
9663
  }
9591
9664
  };
9592
9665
  const handleFocus = () => {
9666
+ state.isFocused = true;
9593
9667
  state.isOpen = true;
9594
9668
  updateDropdownPosition();
9595
9669
  setupEventListeners();
@@ -9610,6 +9684,19 @@ var ComboboxFilter = (props) => {
9610
9684
  container.scrollTop = elementTop + elementHeight - containerHeight;
9611
9685
  }
9612
9686
  };
9687
+ const handleClear = (e) => {
9688
+ e.preventDefault();
9689
+ e.stopPropagation();
9690
+ props.filterInputValues.value[props.field] = "";
9691
+ state.isOpen = true;
9692
+ updateDropdownPosition();
9693
+ nextTick(() => {
9694
+ const input = document.querySelector(`[data-combobox-input="${props.field}"]`);
9695
+ if (input) {
9696
+ input.focus();
9697
+ }
9698
+ });
9699
+ };
9613
9700
  const handleBlur = (e) => {
9614
9701
  const relatedTarget = e.relatedTarget || document.activeElement;
9615
9702
  const container = document.querySelector(`[data-combobox-container="${props.field}"]`);
@@ -9617,6 +9704,7 @@ var ComboboxFilter = (props) => {
9617
9704
  if (container && container.contains(relatedTarget) || dropdown && dropdown.contains(relatedTarget)) {
9618
9705
  return;
9619
9706
  }
9707
+ state.isFocused = false;
9620
9708
  state.isOpen = false;
9621
9709
  cleanupEventListeners();
9622
9710
  const currentQuery = searchQuery.value.trim();
@@ -9693,7 +9781,7 @@ var ComboboxFilter = (props) => {
9693
9781
  onFocus: handleFocus,
9694
9782
  onBlur: handleBlur,
9695
9783
  placeholder: props.isOptionsLoading ? "Loading options..." : `Search ${props.label}`,
9696
- class: "input input-bordered input-sm w-full",
9784
+ class: "input input-bordered input-sm w-full pr-8",
9697
9785
  disabled: props.isLoading || props.isOptionsLoading,
9698
9786
  "data-testid": `datatable-filter-${props.field}-input`,
9699
9787
  "data-combobox-input": props.field
@@ -9711,117 +9799,152 @@ var ComboboxFilter = (props) => {
9711
9799
  children: /* @__PURE__ */ jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M8 9l4-4 4 4m0 6l-4 4-4-4" })
9712
9800
  }
9713
9801
  ) }),
9714
- state.isOpen && /* @__PURE__ */ jsx(Teleport, { to: "body", children: /* @__PURE__ */ jsx(
9802
+ state.isOpen && /* @__PURE__ */ jsx(Teleport, { to: "body", children: /* @__PURE__ */ jsxs(
9715
9803
  "div",
9716
9804
  {
9717
9805
  "data-combobox-dropdown": props.field,
9718
- class: "bg-base-100 border border-base-300 rounded-box shadow-lg overflow-auto",
9806
+ class: "bg-base-100 border border-base-300 rounded-box shadow-lg overflow-auto flex flex-col",
9719
9807
  style: dropdownStyle.value,
9720
9808
  onMousedown: (e) => {
9721
9809
  e.preventDefault();
9722
9810
  },
9723
- children: /* @__PURE__ */ jsx("ul", { class: "menu w-full", role: "listbox", id: `combobox-listbox-${props.field}`, children: props.isOptionsLoading ? /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("span", { class: "text-sm text-base-content/70 p-2", children: "Loading options..." }) }) : filteredOptions.value.length === 0 && !isNewValue.value && !isInvalidValue.value ? /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("span", { class: "text-sm text-base-content/70 p-2", children: "No options available" }) }) : isInvalidValue.value ? /* @__PURE__ */ jsx("li", { class: "bg-error/10 border-l-4 border-error", children: /* @__PURE__ */ jsx("div", { class: "p-2", children: /* @__PURE__ */ jsxs("div", { class: "flex items-center gap-2", children: [
9724
- /* @__PURE__ */ jsx(
9725
- "svg",
9726
- {
9727
- xmlns: "http://www.w3.org/2000/svg",
9728
- class: "h-4 w-4 text-error flex-shrink-0",
9729
- fill: "none",
9730
- viewBox: "0 0 24 24",
9731
- stroke: "currentColor",
9732
- "stroke-width": "2",
9733
- children: /* @__PURE__ */ jsx(
9734
- "path",
9735
- {
9736
- "stroke-linecap": "round",
9737
- "stroke-linejoin": "round",
9738
- d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
9739
- }
9740
- )
9741
- }
9742
- ),
9743
- /* @__PURE__ */ jsxs("div", { class: "text-sm", children: [
9744
- /* @__PURE__ */ jsx("p", { class: "font-medium text-error", children: "Invalid value" }),
9745
- /* @__PURE__ */ jsxs("p", { class: "text-error/80", children: [
9746
- '"',
9747
- searchQuery.value,
9748
- '" is not a valid option. Please select from the list.'
9811
+ children: [
9812
+ searchQuery.value && /* @__PURE__ */ jsxs("div", { class: "flex items-center justify-between p-2 border-b border-base-300 flex-shrink-0", children: [
9813
+ /* @__PURE__ */ jsx("span", { class: "text-xs font-semibold text-base-content/70", children: props.label }),
9814
+ /* @__PURE__ */ jsx(
9815
+ "button",
9816
+ {
9817
+ type: "button",
9818
+ onClick: (e) => {
9819
+ e.preventDefault();
9820
+ e.stopPropagation();
9821
+ handleClear(e);
9822
+ },
9823
+ onMousedown: (e) => {
9824
+ e.preventDefault();
9825
+ e.stopPropagation();
9826
+ },
9827
+ class: "btn btn-ghost btn-xs p-0 h-5 w-5 min-h-0 rounded hover:bg-base-300",
9828
+ title: "Clear text",
9829
+ "data-testid": `datatable-filter-${props.field}-clear`,
9830
+ children: /* @__PURE__ */ jsx(
9831
+ "svg",
9832
+ {
9833
+ xmlns: "http://www.w3.org/2000/svg",
9834
+ class: "h-4 w-4",
9835
+ fill: "none",
9836
+ viewBox: "0 0 24 24",
9837
+ stroke: "currentColor",
9838
+ "stroke-width": "2",
9839
+ children: /* @__PURE__ */ jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M6 18L18 6M6 6l12 12" })
9840
+ }
9841
+ )
9842
+ }
9843
+ )
9844
+ ] }),
9845
+ /* @__PURE__ */ jsx("ul", { class: "menu w-full flex-1", role: "listbox", id: `combobox-listbox-${props.field}`, children: props.isOptionsLoading ? /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("span", { class: "text-sm text-base-content/70 p-2", children: "Loading options..." }) }) : filteredOptions.value.length === 0 && !isNewValue.value && !isInvalidValue.value ? /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("span", { class: "text-sm text-base-content/70 p-2", children: "No options available" }) }) : isInvalidValue.value ? /* @__PURE__ */ jsx("li", { class: "bg-error/10 border-l-4 border-error", children: /* @__PURE__ */ jsx("div", { class: "p-2", children: /* @__PURE__ */ jsxs("div", { class: "flex items-center gap-2", children: [
9846
+ /* @__PURE__ */ jsx(
9847
+ "svg",
9848
+ {
9849
+ xmlns: "http://www.w3.org/2000/svg",
9850
+ class: "h-4 w-4 text-error flex-shrink-0",
9851
+ fill: "none",
9852
+ viewBox: "0 0 24 24",
9853
+ stroke: "currentColor",
9854
+ "stroke-width": "2",
9855
+ children: /* @__PURE__ */ jsx(
9856
+ "path",
9857
+ {
9858
+ "stroke-linecap": "round",
9859
+ "stroke-linejoin": "round",
9860
+ d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
9861
+ }
9862
+ )
9863
+ }
9864
+ ),
9865
+ /* @__PURE__ */ jsxs("div", { class: "text-sm", children: [
9866
+ /* @__PURE__ */ jsx("p", { class: "font-medium text-error", children: "Invalid value" }),
9867
+ /* @__PURE__ */ jsxs("p", { class: "text-error/80", children: [
9868
+ '"',
9869
+ searchQuery.value,
9870
+ '" is not a valid option. Please select from the list.'
9871
+ ] })
9749
9872
  ] })
9750
- ] })
9751
- ] }) }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
9752
- filteredOptions.value.map((option, index) => /* @__PURE__ */ jsx(
9753
- "li",
9754
- {
9755
- id: `option-${index}`,
9756
- role: "option",
9757
- "aria-selected": index === state.selectedIndex,
9758
- class: index === state.selectedIndex ? "bg-base-200" : "",
9759
- children: /* @__PURE__ */ jsx(
9760
- "a",
9761
- {
9762
- href: "#",
9763
- tabindex: 0,
9764
- onClick: (e) => {
9765
- e.preventDefault();
9766
- e.stopPropagation();
9767
- handleSelectOption(option);
9768
- },
9769
- onMousedown: (e) => {
9770
- e.preventDefault();
9771
- },
9772
- class: "w-full",
9773
- children: option.label
9774
- }
9775
- )
9776
- },
9777
- option.value
9778
- )),
9779
- isNewValue.value && props.allowCreate && /* @__PURE__ */ jsx(
9780
- "li",
9781
- {
9782
- id: "option-new",
9783
- role: "option",
9784
- "aria-selected": state.selectedIndex === filteredOptions.value.length,
9785
- class: state.selectedIndex === filteredOptions.value.length ? "bg-base-200" : "",
9786
- children: /* @__PURE__ */ jsx(
9787
- "a",
9788
- {
9789
- href: "#",
9790
- tabindex: 0,
9791
- onClick: (e) => {
9792
- e.preventDefault();
9793
- e.stopPropagation();
9794
- handleSelectNewValue();
9795
- },
9796
- onMousedown: (e) => {
9797
- e.preventDefault();
9798
- },
9799
- class: "w-full",
9800
- children: /* @__PURE__ */ jsxs("div", { class: "flex items-center gap-2", children: [
9801
- /* @__PURE__ */ jsx(
9802
- "svg",
9803
- {
9804
- xmlns: "http://www.w3.org/2000/svg",
9805
- class: "h-4 w-4 text-success",
9806
- fill: "none",
9807
- viewBox: "0 0 24 24",
9808
- stroke: "currentColor",
9809
- "stroke-width": "2",
9810
- children: /* @__PURE__ */ jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M12 4v16m8-8H4" })
9811
- }
9812
- ),
9813
- /* @__PURE__ */ jsxs("span", { class: "text-sm", children: [
9814
- /* @__PURE__ */ jsx("span", { class: "font-medium text-success", children: "New value:" }),
9815
- ' "',
9816
- searchQuery.value,
9817
- '"'
9873
+ ] }) }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
9874
+ filteredOptions.value.map((option, index) => /* @__PURE__ */ jsx(
9875
+ "li",
9876
+ {
9877
+ id: `option-${index}`,
9878
+ role: "option",
9879
+ "aria-selected": index === state.selectedIndex,
9880
+ class: index === state.selectedIndex ? "bg-base-200" : "",
9881
+ children: /* @__PURE__ */ jsx(
9882
+ "a",
9883
+ {
9884
+ href: "#",
9885
+ tabindex: 0,
9886
+ onClick: (e) => {
9887
+ e.preventDefault();
9888
+ e.stopPropagation();
9889
+ handleSelectOption(option);
9890
+ },
9891
+ onMousedown: (e) => {
9892
+ e.preventDefault();
9893
+ },
9894
+ class: "w-full",
9895
+ children: option.label
9896
+ }
9897
+ )
9898
+ },
9899
+ option.value
9900
+ )),
9901
+ isNewValue.value && props.allowCreate && /* @__PURE__ */ jsx(
9902
+ "li",
9903
+ {
9904
+ id: "option-new",
9905
+ role: "option",
9906
+ "aria-selected": state.selectedIndex === filteredOptions.value.length,
9907
+ class: state.selectedIndex === filteredOptions.value.length ? "bg-base-200" : "",
9908
+ children: /* @__PURE__ */ jsx(
9909
+ "a",
9910
+ {
9911
+ href: "#",
9912
+ tabindex: 0,
9913
+ onClick: (e) => {
9914
+ e.preventDefault();
9915
+ e.stopPropagation();
9916
+ handleSelectNewValue();
9917
+ },
9918
+ onMousedown: (e) => {
9919
+ e.preventDefault();
9920
+ },
9921
+ class: "w-full",
9922
+ children: /* @__PURE__ */ jsxs("div", { class: "flex items-center gap-2", children: [
9923
+ /* @__PURE__ */ jsx(
9924
+ "svg",
9925
+ {
9926
+ xmlns: "http://www.w3.org/2000/svg",
9927
+ class: "h-4 w-4 text-success",
9928
+ fill: "none",
9929
+ viewBox: "0 0 24 24",
9930
+ stroke: "currentColor",
9931
+ "stroke-width": "2",
9932
+ children: /* @__PURE__ */ jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M12 4v16m8-8H4" })
9933
+ }
9934
+ ),
9935
+ /* @__PURE__ */ jsxs("span", { class: "text-sm", children: [
9936
+ /* @__PURE__ */ jsx("span", { class: "font-medium text-success", children: "New value:" }),
9937
+ ' "',
9938
+ searchQuery.value,
9939
+ '"'
9940
+ ] })
9818
9941
  ] })
9819
- ] })
9820
- }
9821
- )
9822
- }
9823
- )
9824
- ] }) })
9942
+ }
9943
+ )
9944
+ }
9945
+ )
9946
+ ] }) })
9947
+ ]
9825
9948
  }
9826
9949
  ) })
9827
9950
  ] });
@@ -10237,6 +10360,8 @@ var FilterDrawer = (props) => {
10237
10360
  isOptionsLoading: filterOptionsLoading?.value?.[field] ?? false,
10238
10361
  allOptionText: column.filterAllOptionText,
10239
10362
  showAllOption: column.filterShowAllOption,
10363
+ searchable: column.filterSearchable,
10364
+ defaultOperator: column.filterDefaultOperator,
10240
10365
  operator: isEnumOperator(currentFilter?.operator) ? currentFilter?.operator : void 0,
10241
10366
  fieldType: convertToDataType(props.fieldsMetadata[field]?.type || "enum"),
10242
10367
  onFilterChange: props.onFilterChange,
@@ -10307,7 +10432,8 @@ var FilterDrawer = (props) => {
10307
10432
  filterOperators: props.filterOperators,
10308
10433
  caseSensitive: props.caseSensitive || { value: {} },
10309
10434
  fieldType: convertToDataType(props.fieldsMetadata[field]?.type || "string"),
10310
- onFilterChange: props.onFilterChange
10435
+ onFilterChange: props.onFilterChange,
10436
+ onClearFilter: props.onClearFilter
10311
10437
  }
10312
10438
  ),
10313
10439
  filterType === "date" && /* @__PURE__ */ jsx(