twico-ui 1.13.0 → 1.14.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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to Twico UI are documented here (newest first). This file is generated automatically on each release by [semantic-release](https://semantic-release.gitbook.io/) from [Conventional Commits](https://www.conventionalcommits.org/) — do not edit it by hand. The same notes appear on each [GitHub Release](https://github.com/EncryptionL/twico-ui/releases).
4
4
 
5
+ # [1.14.0](https://github.com/EncryptionL/twico-ui/compare/v1.13.0...v1.14.0) (2026-07-13)
6
+
7
+
8
+ ### Features
9
+
10
+ * **datatable:** async/searchable "is any of" filter options via loadValueOptions ([#232](https://github.com/EncryptionL/twico-ui/issues/232)) ([2db2b32](https://github.com/EncryptionL/twico-ui/commit/2db2b3212bcda8cdea9430b6766f02a2b3dd0048)), closes [#208](https://github.com/EncryptionL/twico-ui/issues/208)
11
+
5
12
  # [1.13.0](https://github.com/EncryptionL/twico-ui/compare/v1.12.0...v1.13.0) (2026-07-13)
6
13
 
7
14
 
package/dist/index.cjs CHANGED
@@ -8646,6 +8646,53 @@ function Caret({ pos }) {
8646
8646
  const left = Math.max(12, Math.min(pos.anchorX - pos.left, pos.width - 20));
8647
8647
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "twc-dt__caret", style: { left } });
8648
8648
  }
8649
+ function AsyncFilterValue({ col, value, onChange }) {
8650
+ const [opts, setOpts] = React51__namespace.default.useState([]);
8651
+ const [loading, setLoading] = React51__namespace.default.useState(false);
8652
+ const reqRef = React51__namespace.default.useRef(0);
8653
+ const debRef = React51__namespace.default.useRef();
8654
+ const load = React51__namespace.default.useCallback((query) => {
8655
+ const id = ++reqRef.current;
8656
+ setLoading(true);
8657
+ Promise.resolve(col.loadValueOptions(query)).then(
8658
+ (res) => {
8659
+ if (reqRef.current === id) {
8660
+ setOpts((Array.isArray(res) ? res : []).map((o) => typeof o === "string" ? { value: o, label: o } : o));
8661
+ setLoading(false);
8662
+ }
8663
+ },
8664
+ () => {
8665
+ if (reqRef.current === id) setLoading(false);
8666
+ }
8667
+ );
8668
+ }, [col]);
8669
+ React51__namespace.default.useEffect(() => {
8670
+ load("");
8671
+ return () => clearTimeout(debRef.current);
8672
+ }, [load]);
8673
+ const onInput = React51__namespace.default.useCallback((q) => {
8674
+ clearTimeout(debRef.current);
8675
+ debRef.current = setTimeout(() => load(q), 250);
8676
+ }, [load]);
8677
+ const selected = Array.isArray(value) ? value : [];
8678
+ const merged = React51__namespace.default.useMemo(() => {
8679
+ const seen2 = new Set(opts.map((o) => o.value));
8680
+ return [...selected.filter((v) => !seen2.has(v)).map((v) => ({ value: v, label: String(v) })), ...opts];
8681
+ }, [opts, selected]);
8682
+ return /* @__PURE__ */ jsxRuntime.jsx(
8683
+ MultiSelect,
8684
+ {
8685
+ portal: true,
8686
+ placeholder: "Any of\u2026",
8687
+ value: selected,
8688
+ options: merged,
8689
+ filter: false,
8690
+ loading,
8691
+ onInputChange: onInput,
8692
+ onChange
8693
+ }
8694
+ );
8695
+ }
8649
8696
  function EditCell({ col, value, options, onChange, onCommit, onCommitValue, onCancel, onKeyDown }) {
8650
8697
  const ref = React51__namespace.default.useRef(null);
8651
8698
  const isSelect = col.editType === "select" || options && col.editType !== "text";
@@ -11294,7 +11341,14 @@ function Datatable({
11294
11341
  }))
11295
11342
  }
11296
11343
  ) }),
11297
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-dt__f-val", children: op.noInput ? null : op.multi ? /* @__PURE__ */ jsxRuntime.jsx(
11344
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "twc-dt__f-val", children: op.noInput ? null : op.multi ? col.loadValueOptions ? /* @__PURE__ */ jsxRuntime.jsx(
11345
+ AsyncFilterValue,
11346
+ {
11347
+ col,
11348
+ value: f.value,
11349
+ onChange: (vals) => setFilters((arr) => arr.map((x) => x.id === f.id ? { ...x, value: vals } : x))
11350
+ }
11351
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
11298
11352
  MultiSelect,
11299
11353
  {
11300
11354
  portal: true,