@jc-times/business-ui 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/THIRD_PARTY_NOTICES.md +5 -0
  3. package/assets/pdf-fonts/NotoSans-Bold.ttf +0 -0
  4. package/assets/pdf-fonts/NotoSans-BoldItalic.ttf +0 -0
  5. package/assets/pdf-fonts/NotoSans-Italic.ttf +0 -0
  6. package/assets/pdf-fonts/NotoSans-Regular.ttf +0 -0
  7. package/assets/pdf-fonts/NotoSansHans-Regular.otf +0 -0
  8. package/assets/pdf-fonts/OFL-CJK.txt +92 -0
  9. package/assets/pdf-fonts/OFL-Latin.txt +94 -0
  10. package/assets/pdf-fonts/README.md +11 -0
  11. package/dist/Alert.js +5 -1
  12. package/dist/Button.js +1 -1
  13. package/dist/Cascader.js +19 -19
  14. package/dist/Combobox.js +38 -38
  15. package/dist/DataTableIcons.js +25 -25
  16. package/dist/DateInput.js +67 -67
  17. package/dist/DropdownMenu.js +35 -35
  18. package/dist/EmptyState.js +8 -8
  19. package/dist/ExplainableButton.js +11 -11
  20. package/dist/FloatingControls.js +31 -31
  21. package/dist/ModalShell.js +32 -32
  22. package/dist/MultiSelect.js +37 -37
  23. package/dist/Pagination.js +27 -27
  24. package/dist/RecoverableAsyncState.js +8 -8
  25. package/dist/Select.js +17 -17
  26. package/dist/SortableList.js +18 -18
  27. package/dist/Toast.js +30 -30
  28. package/dist/TreeSelect.js +107 -107
  29. package/dist/data-table.js +71 -71
  30. package/dist/document-viewer/PdfToolbar.js +12 -12
  31. package/dist/document-viewer/PdfWorkspace.js +15 -15
  32. package/dist/document-viewer-v2/DocumentViewerV2.js +49 -48
  33. package/dist/document-viewer-v2/HeadlessPdfViewer.js +128 -124
  34. package/dist/document-viewer-v2/pdf-font-fallback.js +35 -0
  35. package/dist/types/document-viewer-v2/pdf-font-fallback.d.ts +2 -0
  36. package/dist/vendor/embedpdf-zoom-react.js +3 -186
  37. package/dist/vendor/embedpdf-zoom-react10.js +6 -0
  38. package/dist/vendor/embedpdf-zoom-react11.js +30 -0
  39. package/dist/vendor/embedpdf-zoom-react12.js +16 -0
  40. package/dist/vendor/embedpdf-zoom-react13.js +15 -0
  41. package/dist/vendor/embedpdf-zoom-react14.js +33 -0
  42. package/dist/vendor/embedpdf-zoom-react15.js +20 -0
  43. package/dist/vendor/embedpdf-zoom-react16.js +26 -0
  44. package/dist/vendor/embedpdf-zoom-react17.js +25 -0
  45. package/dist/vendor/embedpdf-zoom-react18.js +17 -0
  46. package/dist/vendor/embedpdf-zoom-react19.js +187 -0
  47. package/dist/vendor/embedpdf-zoom-react2.js +13 -0
  48. package/dist/vendor/embedpdf-zoom-react3.js +14 -0
  49. package/dist/vendor/embedpdf-zoom-react4.js +8 -0
  50. package/dist/vendor/embedpdf-zoom-react5.js +4 -0
  51. package/dist/vendor/embedpdf-zoom-react6.js +14 -0
  52. package/dist/vendor/embedpdf-zoom-react7.js +40 -0
  53. package/dist/vendor/embedpdf-zoom-react8.js +17 -0
  54. package/dist/vendor/embedpdf-zoom-react9.js +7 -0
  55. package/docs/agent-guide.md +2 -0
  56. package/docs/document-viewer-v2.md +2 -2
  57. package/package.json +7 -3
package/dist/Toast.js CHANGED
@@ -1,21 +1,21 @@
1
1
  import { Button as e } from "./Button.js";
2
2
  import { useOverlayContainer as t } from "./OverlayContainer.js";
3
- import { AlertCircle as n, CheckCircle2 as r, Info as i, TriangleAlert as a, X as o } from "lucide-react";
4
- import { createContext as s, useCallback as c, useContext as l, useMemo as u, useRef as d, useState as f } from "react";
5
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
3
+ import { createContext as n, useCallback as r, useContext as i, useMemo as a, useRef as o, useState as s } from "react";
4
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
5
+ import { AlertCircle as u, CheckCircle2 as d, Info as f, TriangleAlert as p, X as m } from "lucide-react";
6
6
  import { createPortal as h } from "react-dom";
7
7
  import * as g from "@radix-ui/react-toast";
8
8
  //#region src/Toast.tsx
9
- var _ = s(null), v = {
10
- info: i,
11
- success: r,
12
- warning: a,
13
- danger: n
9
+ var _ = n(null), v = {
10
+ info: f,
11
+ success: d,
12
+ warning: p,
13
+ danger: u
14
14
  };
15
15
  function y({ children: e, maxVisible: n = 4 }) {
16
- let r = t(), [i, a] = f([]), o = d(0), s = Number.isFinite(n) ? Math.max(1, Math.floor(n)) : 4, l = c((e) => a((t) => t.filter((t) => t.id !== e)), []), v = c(() => a([]), []), y = c((e) => {
17
- let t = ++o.current, n = e.id ?? `ui-toast-${t}`, r = e.tone ?? "info", i = e.duration ?? (r === "danger" ? 0 : r === "warning" ? 6e3 : 4e3);
18
- return a((a) => {
16
+ let i = t(), [u, d] = s([]), f = o(0), p = Number.isFinite(n) ? Math.max(1, Math.floor(n)) : 4, m = r((e) => d((t) => t.filter((t) => t.id !== e)), []), v = r(() => d([]), []), y = r((e) => {
17
+ let t = ++f.current, n = e.id ?? `ui-toast-${t}`, r = e.tone ?? "info", i = e.duration ?? (r === "danger" ? 0 : r === "warning" ? 6e3 : 4e3);
18
+ return d((a) => {
19
19
  let o = {
20
20
  ...e,
21
21
  id: n,
@@ -25,41 +25,41 @@ function y({ children: e, maxVisible: n = 4 }) {
25
25
  };
26
26
  return a.some((e) => e.id === n) ? a.map((e) => e.id === n ? o : e) : [...a, o];
27
27
  }), n;
28
- }, []), b = u(() => ({
28
+ }, []), b = a(() => ({
29
29
  toast: y,
30
- dismiss: l,
30
+ dismiss: m,
31
31
  dismissAll: v
32
32
  }), [
33
33
  y,
34
- l,
34
+ m,
35
35
  v
36
36
  ]);
37
- return /* @__PURE__ */ p(_.Provider, {
37
+ return /* @__PURE__ */ c(_.Provider, {
38
38
  value: b,
39
- children: /* @__PURE__ */ m(g.Provider, {
39
+ children: /* @__PURE__ */ l(g.Provider, {
40
40
  label: "通知",
41
41
  children: [
42
42
  e,
43
- i.slice(0, s).map((e) => /* @__PURE__ */ p(x, {
43
+ u.slice(0, p).map((e) => /* @__PURE__ */ c(x, {
44
44
  item: e,
45
- dismiss: l
45
+ dismiss: m
46
46
  }, `${e.id}-${e.revision}`)),
47
- typeof document > "u" ? null : h(/* @__PURE__ */ p(g.Viewport, {
47
+ typeof document > "u" ? null : h(/* @__PURE__ */ c(g.Viewport, {
48
48
  className: "ui-toast-viewport",
49
49
  label: "通知(F8)"
50
- }), r ?? document.body)
50
+ }), i ?? document.body)
51
51
  ]
52
52
  })
53
53
  });
54
54
  }
55
55
  function b() {
56
- let e = l(_);
56
+ let e = i(_);
57
57
  if (!e) throw Error("useToast 必须在 ToastProvider 内使用");
58
58
  return e;
59
59
  }
60
60
  function x({ item: t, dismiss: n }) {
61
61
  let r = v[t.tone];
62
- return /* @__PURE__ */ m(g.Root, {
62
+ return /* @__PURE__ */ l(g.Root, {
63
63
  className: `ui-toast ui-toast-${t.tone}`,
64
64
  duration: t.duration <= 0 ? Infinity : t.duration,
65
65
  type: t.tone === "danger" ? "foreground" : "background",
@@ -68,19 +68,19 @@ function x({ item: t, dismiss: n }) {
68
68
  e || n(t.id);
69
69
  },
70
70
  children: [
71
- /* @__PURE__ */ p(r, {
71
+ /* @__PURE__ */ c(r, {
72
72
  className: "ui-toast-icon",
73
73
  size: 19,
74
74
  "aria-hidden": "true"
75
75
  }),
76
- /* @__PURE__ */ m("div", {
76
+ /* @__PURE__ */ l("div", {
77
77
  className: "ui-toast-content",
78
- children: [/* @__PURE__ */ p(g.Title, {
78
+ children: [/* @__PURE__ */ c(g.Title, {
79
79
  asChild: !0,
80
- children: /* @__PURE__ */ p("strong", { children: t.title })
81
- }), t.description === void 0 ? null : /* @__PURE__ */ p(g.Description, { children: t.description })]
80
+ children: /* @__PURE__ */ c("strong", { children: t.title })
81
+ }), t.description === void 0 ? null : /* @__PURE__ */ c(g.Description, { children: t.description })]
82
82
  }),
83
- t.actionLabel === void 0 ? null : /* @__PURE__ */ p(e, {
83
+ t.actionLabel === void 0 ? null : /* @__PURE__ */ c(e, {
84
84
  size: "compact",
85
85
  variant: "ghost",
86
86
  onClick: () => {
@@ -88,10 +88,10 @@ function x({ item: t, dismiss: n }) {
88
88
  },
89
89
  children: t.actionLabel
90
90
  }),
91
- /* @__PURE__ */ p(g.Close, {
91
+ /* @__PURE__ */ c(g.Close, {
92
92
  className: "ui-toast-close",
93
93
  "aria-label": "关闭通知",
94
- children: /* @__PURE__ */ p(o, { size: 16 })
94
+ children: /* @__PURE__ */ c(m, { size: 16 })
95
95
  })
96
96
  ]
97
97
  });
@@ -1,33 +1,33 @@
1
1
  import { useOverlayContainer as e } from "./OverlayContainer.js";
2
2
  import { FormField as t } from "./FormField.js";
3
- import { Check as n, ChevronDown as r, ChevronRight as i, LoaderCircle as a, X as o } from "lucide-react";
4
- import { memo as s, useCallback as c, useEffect as l, useId as ee, useMemo as u, useRef as d, useState as f } from "react";
5
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
6
- import * as h from "@radix-ui/react-popover";
3
+ import { memo as n, useCallback as r, useEffect as i, useId as a, useMemo as o, useRef as s, useState as c } from "react";
4
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
5
+ import { Check as ee, ChevronDown as te, ChevronRight as d, LoaderCircle as ne, X as re } from "lucide-react";
6
+ import * as f from "@radix-ui/react-popover";
7
7
  //#region src/TreeSelect.tsx
8
- var g = "\0tree-select-all";
9
- function te({ items: i, value: s, defaultValue: te = null, onValueChange: v, open: y, defaultOpen: b = !1, onOpenChange: x, selectionMode: ue = "single", values: S, defaultValues: de = [], onValuesChange: fe, query: C, defaultQuery: pe = "", onQueryChange: w, expandedIds: T, defaultExpandedIds: me, onExpandedIdsChange: he, label: ge, placeholder: _e = "请选择", searchPlaceholder: ve = "输入关键词搜索", clearLabel: ye = "清除选择", allLabel: be = "全部", emptyText: xe = "没有匹配项", loading: E = !1, loadingText: Se = "正在加载…", loadError: Ce, disabled: D = !1, required: O = !1, helpText: we, error: k, id: Te, name: Ee, formValueMode: De = "id", className: Oe = "", popoverClassName: ke = "", inputRef: A, inputProps: j }) {
10
- let Ae = e(), M = d(!1), je = ee().replaceAll(":", ""), N = Te ?? `ui-tree-select-${je}`, Me = `${N}-tree`, P = d(null), Ne = d(null), F = u(() => re(i), [i]), I = u(() => new Map(ie(F).map((e) => [e.id, e])), [F]), [Pe, Fe] = f(te), [Ie, Le] = f(de), L = ue === "multiple", R = S ?? Ie, Re = u(() => new Set(R), [R]), [ze, Be] = f(b), [Ve, He] = f(pe), [Ue, We] = f(() => new Set(me ?? ae(F))), [z, B] = f(null), V = s === void 0 ? Pe : s, H = !D && (y === void 0 ? ze : y), U = C === void 0 ? Ve : C, W = T ?? Ue, G = u(() => U.trim() ? _(F, U) : F, [F, U]), K = !!U.trim(), q = u(() => oe(G, W, K), [
8
+ var p = "\0tree-select-all";
9
+ function ie({ items: n, value: d, defaultValue: ie = null, onValueChange: h, open: g, defaultOpen: _ = !1, onOpenChange: y, selectionMode: fe = "single", values: b, defaultValues: pe = [], onValuesChange: me, query: x, defaultQuery: he = "", onQueryChange: S, expandedIds: C, defaultExpandedIds: ge, onExpandedIdsChange: _e, label: w, placeholder: ve = "请选择", searchPlaceholder: ye = "输入关键词搜索", clearLabel: T = "清除选择", allLabel: be = "全部", emptyText: xe = "没有匹配项", loading: E = !1, loadingText: Se = "正在加载…", loadError: Ce, disabled: D = !1, required: O = !1, helpText: we, error: k, id: Te, name: Ee, formValueMode: De = "id", className: Oe = "", popoverClassName: ke = "", inputRef: A, inputProps: j }) {
10
+ let Ae = e(), M = s(!1), je = a().replaceAll(":", ""), N = Te ?? `ui-tree-select-${je}`, Me = `${N}-tree`, P = s(null), Ne = s(null), F = o(() => oe(n), [n]), I = o(() => new Map(se(F).map((e) => [e.id, e])), [F]), [Pe, Fe] = c(ie), [Ie, Le] = c(pe), L = fe === "multiple", R = b ?? Ie, Re = o(() => new Set(R), [R]), [ze, Be] = c(_), [Ve, He] = c(he), [Ue, We] = c(() => new Set(ge ?? ce(F))), [z, B] = c(null), V = d === void 0 ? Pe : d, H = !D && (g === void 0 ? ze : g), U = x === void 0 ? Ve : x, W = C ?? Ue, G = o(() => U.trim() ? m(F, U) : F, [F, U]), K = !!U.trim(), q = o(() => le(G, W, K), [
11
11
  G,
12
12
  W,
13
13
  K
14
- ]), J = u(() => [{
15
- key: g,
14
+ ]), J = o(() => [{
15
+ key: p,
16
16
  disabled: !1
17
17
  }, ...q.map(({ node: e }) => ({
18
18
  key: e.id,
19
19
  disabled: !!e.disabled
20
- }))], [q]), Ge = V === null ? void 0 : I.get(V), Y = z === null ? void 0 : se(N, z), Ke = H ? U : L ? R.map((e) => I.get(e)?.label ?? e).join("、") : Ge?.label ?? "", qe = le(j?.["aria-describedby"], we === void 0 ? void 0 : `${N}-help`, k === void 0 || k === "" ? void 0 : `${N}-error`);
21
- l(() => {
20
+ }))], [q]), Ge = V === null ? void 0 : I.get(V), Y = z === null ? void 0 : v(N, z), Ke = H ? U : L ? R.map((e) => I.get(e)?.label ?? e).join("、") : Ge?.label ?? "", qe = de(j?.["aria-describedby"], we === void 0 ? void 0 : `${N}-help`, k === void 0 || k === "" ? void 0 : `${N}-error`);
21
+ i(() => {
22
22
  H && (z !== null && J.some((e) => e.key === z && !e.disabled) || B(V && J.some((e) => e.key === V && !e.disabled) ? V : J.find((e) => !e.disabled)?.key ?? null));
23
23
  }, [
24
24
  z,
25
25
  H,
26
26
  J,
27
27
  V
28
- ]), l(() => {
28
+ ]), i(() => {
29
29
  H && Y !== void 0 && document.getElementById(Y)?.scrollIntoView?.({ block: "nearest" });
30
- }, [Y, H]), l(() => {
30
+ }, [Y, H]), i(() => {
31
31
  P.current?.setCustomValidity(O && !(L ? R.length : V) ? "请选择选项" : "");
32
32
  }, [
33
33
  O,
@@ -36,42 +36,42 @@ function te({ items: i, value: s, defaultValue: te = null, onValueChange: v, ope
36
36
  R
37
37
  ]);
38
38
  function X(e) {
39
- y === void 0 && Be(e), x?.(e), e || (Z(""), B(null));
39
+ g === void 0 && Be(e), y?.(e), e || (Z(""), B(null));
40
40
  }
41
41
  function Z(e) {
42
- C === void 0 && He(e), w?.(e);
42
+ x === void 0 && He(e), S?.(e);
43
43
  }
44
44
  function Je(e) {
45
- s === void 0 && Fe(e), v?.(e);
45
+ d === void 0 && Fe(e), h?.(e);
46
46
  }
47
47
  function Q() {
48
48
  D || H || (Z(""), X(!0));
49
49
  }
50
- let $ = c((e) => {
50
+ let $ = r((e) => {
51
51
  if (L) {
52
52
  let t = e === null ? [] : R.includes(e) ? R.filter((t) => t !== e) : [...R, e];
53
- S === void 0 && Le(t), fe?.(t);
53
+ b === void 0 && Le(t), me?.(t);
54
54
  return;
55
55
  }
56
- s === void 0 && Fe(e), v?.(e), y === void 0 && Be(!1), x?.(!1), C === void 0 && He(""), w?.(""), B(null);
56
+ d === void 0 && Fe(e), h?.(e), g === void 0 && Be(!1), y?.(!1), x === void 0 && He(""), S?.(""), B(null);
57
57
  }, [
58
- s,
59
- v,
58
+ d,
59
+ h,
60
+ g,
60
61
  y,
61
62
  x,
62
- C,
63
- w,
63
+ S,
64
64
  L,
65
65
  R,
66
- S,
67
- fe
68
- ]), Ye = c((e) => {
66
+ b,
67
+ me
68
+ ]), Ye = r((e) => {
69
69
  let t = new Set(W);
70
- t.has(e) ? t.delete(e) : t.add(e), T === void 0 && We(t), he?.(t);
70
+ t.has(e) ? t.delete(e) : t.add(e), C === void 0 && We(t), _e?.(t);
71
71
  }, [
72
72
  W,
73
- T,
74
- he
73
+ C,
74
+ _e
75
75
  ]);
76
76
  function Xe(e, t) {
77
77
  let n = J.filter((e) => !e.disabled);
@@ -110,38 +110,38 @@ function te({ items: i, value: s, defaultValue: te = null, onValueChange: v, ope
110
110
  e.preventDefault(), t.node.children.length && W.has(t.node.id) && !K ? Ye(t.node.id) : t.parentId && B(t.parentId);
111
111
  return;
112
112
  }
113
- e.key === "Enter" && H && z !== null && (e.preventDefault(), z === g ? $(null) : t && !t.node.disabled && $(z));
113
+ e.key === "Enter" && H && z !== null && (e.preventDefault(), z === p ? $(null) : t && !t.node.disabled && $(z));
114
114
  }
115
115
  function Qe(e) {
116
116
  P.current = e, typeof A == "function" ? A(e) : A && (A.current = e);
117
117
  }
118
- return /* @__PURE__ */ m(t, {
118
+ return /* @__PURE__ */ u(t, {
119
119
  controlId: N,
120
- label: ge,
120
+ label: w,
121
121
  required: O,
122
122
  helpText: we,
123
123
  error: k,
124
124
  containerClassName: `ui-tree-select ${Oe}`.trim(),
125
- children: [/* @__PURE__ */ p(h.Root, {
125
+ children: [/* @__PURE__ */ l(f.Root, {
126
126
  open: H,
127
127
  onOpenChange: X,
128
- children: /* @__PURE__ */ m("div", {
128
+ children: /* @__PURE__ */ u("div", {
129
129
  className: "ui-tree-select-root",
130
130
  ref: Ne,
131
131
  children: [
132
- Ee && (L ? R : [V ?? ""]).map((e) => /* @__PURE__ */ p("input", {
132
+ Ee && (L ? R : [V ?? ""]).map((e) => /* @__PURE__ */ l("input", {
133
133
  type: "hidden",
134
134
  name: Ee,
135
135
  value: De === "label" ? I.get(e)?.label ?? "" : e,
136
136
  disabled: D,
137
137
  form: j?.form
138
138
  }, e)),
139
- /* @__PURE__ */ p(h.Anchor, {
139
+ /* @__PURE__ */ l(f.Anchor, {
140
140
  asChild: !0,
141
- children: /* @__PURE__ */ m("div", {
141
+ children: /* @__PURE__ */ u("div", {
142
142
  className: "ui-tree-select-control",
143
143
  children: [
144
- /* @__PURE__ */ p("input", {
144
+ /* @__PURE__ */ l("input", {
145
145
  ...j,
146
146
  ref: Qe,
147
147
  id: N,
@@ -156,7 +156,7 @@ function te({ items: i, value: s, defaultValue: te = null, onValueChange: v, ope
156
156
  "aria-invalid": k ? !0 : j?.["aria-invalid"],
157
157
  "aria-required": O,
158
158
  disabled: D,
159
- placeholder: H ? ve : _e,
159
+ placeholder: H ? ye : ve,
160
160
  value: Ke,
161
161
  onCompositionStart: (e) => {
162
162
  M.current = !0, j?.onCompositionStart?.(e);
@@ -173,21 +173,21 @@ function te({ items: i, value: s, defaultValue: te = null, onValueChange: v, ope
173
173
  },
174
174
  onKeyDown: Ze
175
175
  }),
176
- Ge && !L && !D && /* @__PURE__ */ p("button", {
176
+ Ge && !L && !D && /* @__PURE__ */ l("button", {
177
177
  type: "button",
178
178
  tabIndex: -1,
179
179
  className: "ui-tree-select-clear",
180
- "aria-label": ye,
180
+ "aria-label": T,
181
181
  onMouseDown: (e) => e.preventDefault(),
182
182
  onClick: () => {
183
183
  Je(null), Z(""), P.current?.focus();
184
184
  },
185
- children: /* @__PURE__ */ p(o, {
185
+ children: /* @__PURE__ */ l(re, {
186
186
  size: 15,
187
187
  "aria-hidden": "true"
188
188
  })
189
189
  }),
190
- /* @__PURE__ */ p("button", {
190
+ /* @__PURE__ */ l("button", {
191
191
  type: "button",
192
192
  tabIndex: -1,
193
193
  className: "ui-tree-select-trigger",
@@ -195,11 +195,11 @@ function te({ items: i, value: s, defaultValue: te = null, onValueChange: v, ope
195
195
  disabled: D,
196
196
  onMouseDown: (e) => e.preventDefault(),
197
197
  onClick: () => H ? X(!1) : Q(),
198
- children: E ? /* @__PURE__ */ p(a, {
198
+ children: E ? /* @__PURE__ */ l(ne, {
199
199
  className: "spin",
200
200
  size: 16,
201
201
  "aria-hidden": "true"
202
- }) : /* @__PURE__ */ p(r, {
202
+ }) : /* @__PURE__ */ l(te, {
203
203
  size: 16,
204
204
  "aria-hidden": "true"
205
205
  })
@@ -207,9 +207,9 @@ function te({ items: i, value: s, defaultValue: te = null, onValueChange: v, ope
207
207
  ]
208
208
  })
209
209
  }),
210
- /* @__PURE__ */ p(h.Portal, {
210
+ /* @__PURE__ */ l(f.Portal, {
211
211
  container: Ae,
212
- children: /* @__PURE__ */ p(h.Content, {
212
+ children: /* @__PURE__ */ l(f.Content, {
213
213
  className: `ui-tree-select-popover ${ke}`.trim(),
214
214
  sideOffset: 6,
215
215
  collisionPadding: 12,
@@ -218,42 +218,42 @@ function te({ items: i, value: s, defaultValue: te = null, onValueChange: v, ope
218
218
  onInteractOutside: (e) => {
219
219
  Ne.current?.contains(e.target) && e.preventDefault();
220
220
  },
221
- children: /* @__PURE__ */ m("div", {
221
+ children: /* @__PURE__ */ u("div", {
222
222
  id: Me,
223
223
  className: "ui-tree-select-tree",
224
224
  role: "tree",
225
- "aria-label": typeof ge == "string" ? ge : "树形选项",
225
+ "aria-label": typeof w == "string" ? w : "树形选项",
226
226
  "aria-busy": E || void 0,
227
227
  "aria-multiselectable": L || void 0,
228
- children: [/* @__PURE__ */ m("div", {
229
- id: se(N, g),
228
+ children: [/* @__PURE__ */ u("div", {
229
+ id: v(N, p),
230
230
  role: "treeitem",
231
231
  "aria-level": 1,
232
232
  "aria-posinset": 1,
233
233
  "aria-setsize": G.length + 1,
234
234
  "aria-selected": L ? !R.length : V === null,
235
- className: ce(z === g, L ? !R.length : V === null, !1),
235
+ className: ue(z === p, L ? !R.length : V === null, !1),
236
236
  onMouseDown: (e) => e.preventDefault(),
237
237
  onClick: () => $(null),
238
238
  children: [
239
- /* @__PURE__ */ p("span", { className: "ui-tree-select-spacer" }),
240
- /* @__PURE__ */ p("span", {
239
+ /* @__PURE__ */ l("span", { className: "ui-tree-select-spacer" }),
240
+ /* @__PURE__ */ l("span", {
241
241
  className: "ui-tree-select-label",
242
- children: L ? ye : be
242
+ children: L ? T : be
243
243
  }),
244
- (L ? !R.length : V === null) && /* @__PURE__ */ p(n, {
244
+ (L ? !R.length : V === null) && /* @__PURE__ */ l(ee, {
245
245
  size: 15,
246
246
  "aria-hidden": "true"
247
247
  })
248
248
  ]
249
- }), E ? /* @__PURE__ */ p("div", {
249
+ }), E ? /* @__PURE__ */ l("div", {
250
250
  className: "ui-tree-select-status",
251
251
  role: "status",
252
252
  children: Se
253
- }) : Ce === void 0 ? G.length ? $e(G, 1) : /* @__PURE__ */ p("div", {
253
+ }) : Ce === void 0 ? G.length ? $e(G, 1) : /* @__PURE__ */ l("div", {
254
254
  className: "ui-tree-select-status",
255
255
  children: xe
256
- }) : /* @__PURE__ */ p("div", {
256
+ }) : /* @__PURE__ */ l("div", {
257
257
  className: "ui-tree-select-status ui-tree-select-error",
258
258
  role: "alert",
259
259
  children: Ce
@@ -263,33 +263,33 @@ function te({ items: i, value: s, defaultValue: te = null, onValueChange: v, ope
263
263
  })
264
264
  ]
265
265
  })
266
- }), L && R.length > 0 && /* @__PURE__ */ m("div", {
266
+ }), L && R.length > 0 && /* @__PURE__ */ u("div", {
267
267
  className: "ui-multi-selection",
268
268
  "aria-label": "已选节点",
269
- children: [R.map((e) => /* @__PURE__ */ m("span", {
269
+ children: [R.map((e) => /* @__PURE__ */ u("span", {
270
270
  className: "ui-selection-tag",
271
- children: [I.get(e)?.label ?? e, /* @__PURE__ */ p("button", {
271
+ children: [I.get(e)?.label ?? e, /* @__PURE__ */ l("button", {
272
272
  type: "button",
273
273
  disabled: D,
274
274
  "aria-label": `移除 ${I.get(e)?.label ?? e}`,
275
275
  onClick: () => $(e),
276
276
  children: "×"
277
277
  })]
278
- }, e)), /* @__PURE__ */ p("button", {
278
+ }, e)), /* @__PURE__ */ l("button", {
279
279
  type: "button",
280
280
  className: "ui-selection-clear",
281
281
  disabled: D,
282
282
  onClick: () => $(null),
283
- children: ye
283
+ children: T
284
284
  })]
285
285
  })]
286
286
  });
287
287
  function $e(e, t) {
288
288
  return e.map((n, r) => {
289
289
  let i = K || W.has(n.id), a = n.children.length > 0, o = L ? Re.has(n.id) : V === n.id;
290
- return /* @__PURE__ */ m("div", {
290
+ return /* @__PURE__ */ u("div", {
291
291
  className: "ui-tree-select-branch",
292
- children: [/* @__PURE__ */ p(ne, {
292
+ children: [/* @__PURE__ */ l(ae, {
293
293
  node: n,
294
294
  controlId: N,
295
295
  level: t,
@@ -301,7 +301,7 @@ function te({ items: i, value: s, defaultValue: te = null, onValueChange: v, ope
301
301
  activate: B,
302
302
  commit: $,
303
303
  toggle: Ye
304
- }), i && a && /* @__PURE__ */ p("div", {
304
+ }), i && a && /* @__PURE__ */ l("div", {
305
305
  role: "group",
306
306
  children: $e(n.children, t + 1)
307
307
  })]
@@ -309,46 +309,46 @@ function te({ items: i, value: s, defaultValue: te = null, onValueChange: v, ope
309
309
  });
310
310
  }
311
311
  }
312
- var ne = s(function({ node: e, controlId: t, level: a, position: o, size: s, expanded: c, selected: l, active: ee, activate: u, commit: d, toggle: f }) {
313
- return /* @__PURE__ */ m("div", {
314
- id: se(t, e.id),
312
+ var ae = n(function({ node: e, controlId: t, level: n, position: r, size: i, expanded: a, selected: o, active: s, activate: c, commit: ne, toggle: re }) {
313
+ return /* @__PURE__ */ u("div", {
314
+ id: v(t, e.id),
315
315
  role: "treeitem",
316
- "aria-level": a,
317
- "aria-posinset": o,
318
- "aria-setsize": s,
319
- "aria-expanded": e.children.length ? c : void 0,
320
- "aria-selected": l,
316
+ "aria-level": n,
317
+ "aria-posinset": r,
318
+ "aria-setsize": i,
319
+ "aria-expanded": e.children.length ? a : void 0,
320
+ "aria-selected": o,
321
321
  "aria-disabled": e.disabled || void 0,
322
- className: ce(ee, l, !!e.disabled),
322
+ className: ue(s, o, !!e.disabled),
323
323
  onMouseDown: (e) => e.preventDefault(),
324
- onMouseEnter: () => !e.disabled && u(e.id),
325
- onClick: () => !e.disabled && d(e.id),
324
+ onMouseEnter: () => !e.disabled && c(e.id),
325
+ onClick: () => !e.disabled && ne(e.id),
326
326
  children: [
327
- e.children.length ? /* @__PURE__ */ p("button", {
327
+ e.children.length ? /* @__PURE__ */ l("button", {
328
328
  type: "button",
329
329
  tabIndex: -1,
330
330
  className: "ui-tree-select-toggle",
331
- "aria-label": `${c ? "收起" : "展开"}${e.label}`,
331
+ "aria-label": `${a ? "收起" : "展开"}${e.label}`,
332
332
  onClick: (t) => {
333
- t.stopPropagation(), f(e.id);
333
+ t.stopPropagation(), re(e.id);
334
334
  },
335
- children: p(c ? r : i, {
335
+ children: l(a ? te : d, {
336
336
  size: 15,
337
337
  "aria-hidden": "true"
338
338
  })
339
- }) : /* @__PURE__ */ p("span", { className: "ui-tree-select-spacer" }),
340
- /* @__PURE__ */ p("span", {
339
+ }) : /* @__PURE__ */ l("span", { className: "ui-tree-select-spacer" }),
340
+ /* @__PURE__ */ l("span", {
341
341
  className: "ui-tree-select-label",
342
342
  children: e.label
343
343
  }),
344
- l && /* @__PURE__ */ p(n, {
344
+ o && /* @__PURE__ */ l(ee, {
345
345
  size: 15,
346
346
  "aria-hidden": "true"
347
347
  })
348
348
  ]
349
349
  });
350
350
  });
351
- function re(e) {
351
+ function oe(e) {
352
352
  let t = /* @__PURE__ */ new Map();
353
353
  for (let n of e) {
354
354
  let e = n.id.trim();
@@ -363,7 +363,7 @@ function re(e) {
363
363
  let r = e.parentId && t.has(e.parentId) && e.parentId !== e.id ? e.parentId : null;
364
364
  n.set(e.id, r);
365
365
  }
366
- let r = v(n), i = new Map([...t].map(([e, t]) => [e, {
366
+ let r = h(n), i = new Map([...t].map(([e, t]) => [e, {
367
367
  ...t,
368
368
  children: []
369
369
  }])), a = [];
@@ -371,20 +371,20 @@ function re(e) {
371
371
  let t = r.has(e.id) ? null : n.get(e.id), o = t ? i.get(t) : void 0;
372
372
  o ? o.children.push(e) : a.push(e);
373
373
  }
374
- return y(a), a;
374
+ return g(a), a;
375
375
  }
376
- function _(e, t) {
376
+ function m(e, t) {
377
377
  let n = t.trim().toLocaleLowerCase("zh-CN");
378
378
  return n ? e.flatMap((e) => {
379
- if (e.label.toLocaleLowerCase("zh-CN").includes(n)) return [b(e)];
380
- let t = _(e.children, n);
379
+ if (e.label.toLocaleLowerCase("zh-CN").includes(n)) return [_(e)];
380
+ let t = m(e.children, n);
381
381
  return t.length ? [{
382
382
  ...e,
383
383
  children: t
384
384
  }] : [];
385
- }) : e.map(b);
385
+ }) : e.map(_);
386
386
  }
387
- function v(e) {
387
+ function h(e) {
388
388
  let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
389
389
  for (let r of e.keys()) {
390
390
  if (t.has(r)) continue;
@@ -401,35 +401,35 @@ function v(e) {
401
401
  }
402
402
  return n;
403
403
  }
404
- function y(e) {
404
+ function g(e) {
405
405
  e.sort((e, t) => (e.order ?? 0) - (t.order ?? 0) || e.label.localeCompare(t.label, "zh-CN") || e.id.localeCompare(t.id));
406
- for (let t of e) y(t.children);
406
+ for (let t of e) g(t.children);
407
407
  }
408
- function b(e) {
408
+ function _(e) {
409
409
  return {
410
410
  ...e,
411
- children: e.children.map(b)
411
+ children: e.children.map(_)
412
412
  };
413
413
  }
414
- function ie(e) {
415
- return e.flatMap((e) => [e, ...ie(e.children)]);
414
+ function se(e) {
415
+ return e.flatMap((e) => [e, ...se(e.children)]);
416
416
  }
417
- function ae(e) {
418
- return ie(e).filter((e) => e.children.length).map((e) => e.id);
417
+ function ce(e) {
418
+ return se(e).filter((e) => e.children.length).map((e) => e.id);
419
419
  }
420
- function oe(e, t, n, r = 1, i = null) {
420
+ function le(e, t, n, r = 1, i = null) {
421
421
  return e.flatMap((a, o) => [{
422
422
  node: a,
423
423
  level: r,
424
424
  parentId: i,
425
425
  posInSet: o + 1,
426
426
  setSize: e.length
427
- }, ...a.children.length && (n || t.has(a.id)) ? oe(a.children, t, n, r + 1, a.id) : []]);
427
+ }, ...a.children.length && (n || t.has(a.id)) ? le(a.children, t, n, r + 1, a.id) : []]);
428
428
  }
429
- function se(e, t) {
429
+ function v(e, t) {
430
430
  return `${e}-item-${encodeURIComponent(t).replaceAll("%", "_")}`;
431
431
  }
432
- function ce(e, t, n) {
432
+ function ue(e, t, n) {
433
433
  return [
434
434
  "ui-tree-select-item",
435
435
  e ? "active" : "",
@@ -437,8 +437,8 @@ function ce(e, t, n) {
437
437
  n ? "disabled" : ""
438
438
  ].filter(Boolean).join(" ");
439
439
  }
440
- function le(...e) {
440
+ function de(...e) {
441
441
  return e.filter(Boolean).join(" ") || void 0;
442
442
  }
443
443
  //#endregion
444
- export { te as TreeSelect, re as buildTreeSelectTree, _ as filterTreeSelectTree };
444
+ export { ie as TreeSelect, oe as buildTreeSelectTree, m as filterTreeSelectTree };