@jc-times/business-ui 0.2.43
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/AGENTS.md +6 -0
- package/CHANGELOG.md +267 -0
- package/README.md +55 -0
- package/THIRD_PARTY_NOTICES.md +29 -0
- package/bin/business-ui-gate.mjs +171 -0
- package/dist/Alert.js +47 -0
- package/dist/AsyncDirectoryPicker.js +134 -0
- package/dist/AsyncSearchPicker.js +155 -0
- package/dist/AutoComplete.js +34 -0
- package/dist/Badge.js +14 -0
- package/dist/Button.js +54 -0
- package/dist/Cascader.js +141 -0
- package/dist/Combobox.js +106 -0
- package/dist/ConfirmDialog.js +48 -0
- package/dist/DataTableHorizontalScrollbar.js +38 -0
- package/dist/DataTableIcons.js +37 -0
- package/dist/DataTableMergedRows.js +45 -0
- package/dist/DataTableTheme.js +135 -0
- package/dist/DateInput.js +223 -0
- package/dist/DropdownMenu.js +130 -0
- package/dist/EmptyState.js +27 -0
- package/dist/ExplainableButton.js +68 -0
- package/dist/FileDropzone.js +70 -0
- package/dist/FilePreparationDialog.js +33 -0
- package/dist/FloatingControls.js +120 -0
- package/dist/FormField.js +143 -0
- package/dist/MetricCard.js +38 -0
- package/dist/ModalShell.js +139 -0
- package/dist/MultiSelect.js +137 -0
- package/dist/NumericInput.js +97 -0
- package/dist/OverlayContainer.js +9 -0
- package/dist/PageHeader.js +36 -0
- package/dist/Pagination.js +115 -0
- package/dist/PreparedFileDropzone.js +30 -0
- package/dist/RecoverableAsyncState.js +35 -0
- package/dist/RovingTabs.js +54 -0
- package/dist/SectionCard.js +35 -0
- package/dist/SegmentedControl.js +46 -0
- package/dist/Select.js +73 -0
- package/dist/Skeleton.js +25 -0
- package/dist/SortableList.js +55 -0
- package/dist/StructuredAddressInput.js +157 -0
- package/dist/Toast.js +100 -0
- package/dist/ToggleSwitch.js +34 -0
- package/dist/TreeSelect.js +444 -0
- package/dist/amount-format.js +20 -0
- package/dist/business-ui.js +44 -0
- package/dist/chinese-address-regions.js +15 -0
- package/dist/classNames.js +6 -0
- package/dist/data-table.js +257 -0
- package/dist/document-render-budget.js +22 -0
- package/dist/document-viewer/ContinuousPdfViewer.js +145 -0
- package/dist/document-viewer/DocumentViewer.js +123 -0
- package/dist/document-viewer/DocumentViewerViewport.js +36 -0
- package/dist/document-viewer/ImagePage.js +39 -0
- package/dist/document-viewer/PdfCanvasPage.js +26 -0
- package/dist/document-viewer/PdfThumbnailRail.js +116 -0
- package/dist/document-viewer/PdfToolbar.js +61 -0
- package/dist/document-viewer/PdfWorkspace.js +42 -0
- package/dist/document-viewer/pdf-render-budget.js +7 -0
- package/dist/document-viewer/usePdfCanvas.js +69 -0
- package/dist/document-viewer/usePdfViewport.js +48 -0
- package/dist/document-viewer-v2/DocumentViewerV2.js +171 -0
- package/dist/document-viewer-v2/HeadlessPdfViewer.js +420 -0
- package/dist/document-viewer-v2/HeadlessSearch.js +66 -0
- package/dist/document-viewer-v2.js +13 -0
- package/dist/document-viewer.js +12 -0
- package/dist/pdfium-viewer.js +18 -0
- package/dist/styles.css +2 -0
- package/dist/types/Alert.d.ts +11 -0
- package/dist/types/AmountFormat.d.ts +15 -0
- package/dist/types/AsyncDirectoryPicker.d.ts +32 -0
- package/dist/types/AsyncSearchPicker.d.ts +26 -0
- package/dist/types/AutoComplete.d.ts +9 -0
- package/dist/types/Badge.d.ts +13 -0
- package/dist/types/Button.d.ts +36 -0
- package/dist/types/Cascader.d.ts +57 -0
- package/dist/types/ChineseAddressRegions.d.ts +4 -0
- package/dist/types/Combobox.d.ts +37 -0
- package/dist/types/ConfirmDialog.d.ts +20 -0
- package/dist/types/DataTable.d.ts +68 -0
- package/dist/types/DataTableHorizontalScrollbar.d.ts +8 -0
- package/dist/types/DataTableIcons.d.ts +19 -0
- package/dist/types/DataTableMergedRows.d.ts +11 -0
- package/dist/types/DataTableTheme.d.ts +4 -0
- package/dist/types/DateInput.d.ts +25 -0
- package/dist/types/DocumentRenderBudget.d.ts +9 -0
- package/dist/types/DocumentViewer.d.ts +11 -0
- package/dist/types/DocumentViewerV2.d.ts +10 -0
- package/dist/types/DropdownMenu.d.ts +73 -0
- package/dist/types/EmptyState.d.ts +9 -0
- package/dist/types/ExplainableButton.d.ts +7 -0
- package/dist/types/FileDropzone.d.ts +20 -0
- package/dist/types/FilePreparationDialog.d.ts +12 -0
- package/dist/types/FloatingControls.d.ts +39 -0
- package/dist/types/FormField.d.ts +35 -0
- package/dist/types/MetricCard.d.ts +17 -0
- package/dist/types/ModalShell.d.ts +33 -0
- package/dist/types/MultiSelect.d.ts +12 -0
- package/dist/types/NumericInput.d.ts +54 -0
- package/dist/types/OverlayContainer.d.ts +2 -0
- package/dist/types/PageHeader.d.ts +23 -0
- package/dist/types/Pagination.d.ts +14 -0
- package/dist/types/PdfiumViewer.d.ts +5 -0
- package/dist/types/PreparedFileDropzone.d.ts +7 -0
- package/dist/types/RecoverableAsyncState.d.ts +11 -0
- package/dist/types/RovingTabs.d.ts +21 -0
- package/dist/types/SectionCard.d.ts +18 -0
- package/dist/types/SegmentedControl.d.ts +26 -0
- package/dist/types/Select.d.ts +31 -0
- package/dist/types/Skeleton.d.ts +11 -0
- package/dist/types/SortableList.d.ts +17 -0
- package/dist/types/StructuredAddressInput.d.ts +57 -0
- package/dist/types/Toast.d.ts +22 -0
- package/dist/types/ToggleSwitch.d.ts +15 -0
- package/dist/types/TreeSelect.d.ts +58 -0
- package/dist/types/classNames.d.ts +1 -0
- package/dist/types/document-viewer/ContinuousPdfViewer.d.ts +16 -0
- package/dist/types/document-viewer/DocumentViewer.d.ts +31 -0
- package/dist/types/document-viewer/DocumentViewerViewport.d.ts +23 -0
- package/dist/types/document-viewer/ImagePage.d.ts +9 -0
- package/dist/types/document-viewer/PdfCanvasPage.d.ts +7 -0
- package/dist/types/document-viewer/PdfThumbnailRail.d.ts +12 -0
- package/dist/types/document-viewer/PdfToolbar.d.ts +13 -0
- package/dist/types/document-viewer/PdfWorkspace.d.ts +5 -0
- package/dist/types/document-viewer/pdf-render-budget.d.ts +2 -0
- package/dist/types/document-viewer/usePdfCanvas.d.ts +22 -0
- package/dist/types/document-viewer/usePdfViewport.d.ts +14 -0
- package/dist/types/document-viewer-v2/DocumentViewerV2.d.ts +50 -0
- package/dist/types/document-viewer-v2/HeadlessPdfViewer.d.ts +39 -0
- package/dist/types/document-viewer-v2/HeadlessSearch.d.ts +9 -0
- package/dist/types/index.d.ts +41 -0
- package/dist/types/useDebouncedValue.d.ts +2 -0
- package/dist/types/useFilePreparation.d.ts +28 -0
- package/dist/types/useModalFocusTrap.d.ts +3 -0
- package/dist/useDebouncedValue.js +16 -0
- package/dist/useFilePreparation.js +51 -0
- package/dist/useModalFocusTrap.js +71 -0
- package/docs/agent-guide.md +145 -0
- package/docs/api.md +220 -0
- package/docs/cascader.md +56 -0
- package/docs/component-strategy.md +94 -0
- package/docs/data-table.md +123 -0
- package/docs/dependencies.md +57 -0
- package/docs/document-viewer-v2.md +259 -0
- package/docs/document-viewer.md +28 -0
- package/docs/file-preparation.md +11 -0
- package/docs/maturity-migration.md +62 -0
- package/docs/modal-shell-migration.md +43 -0
- package/docs/mrt-poc.md +205 -0
- package/docs/release.md +32 -0
- package/docs/viewport-qa.md +99 -0
- package/licenses/rc-cascader-MIT.txt +21 -0
- package/package.json +163 -0
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
import { useOverlayContainer as e } from "./OverlayContainer.js";
|
|
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";
|
|
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), [
|
|
11
|
+
G,
|
|
12
|
+
W,
|
|
13
|
+
K
|
|
14
|
+
]), J = u(() => [{
|
|
15
|
+
key: g,
|
|
16
|
+
disabled: !1
|
|
17
|
+
}, ...q.map(({ node: e }) => ({
|
|
18
|
+
key: e.id,
|
|
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(() => {
|
|
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
|
+
}, [
|
|
24
|
+
z,
|
|
25
|
+
H,
|
|
26
|
+
J,
|
|
27
|
+
V
|
|
28
|
+
]), l(() => {
|
|
29
|
+
H && Y !== void 0 && document.getElementById(Y)?.scrollIntoView?.({ block: "nearest" });
|
|
30
|
+
}, [Y, H]), l(() => {
|
|
31
|
+
P.current?.setCustomValidity(O && !(L ? R.length : V) ? "请选择选项" : "");
|
|
32
|
+
}, [
|
|
33
|
+
O,
|
|
34
|
+
V,
|
|
35
|
+
L,
|
|
36
|
+
R
|
|
37
|
+
]);
|
|
38
|
+
function X(e) {
|
|
39
|
+
y === void 0 && Be(e), x?.(e), e || (Z(""), B(null));
|
|
40
|
+
}
|
|
41
|
+
function Z(e) {
|
|
42
|
+
C === void 0 && He(e), w?.(e);
|
|
43
|
+
}
|
|
44
|
+
function Je(e) {
|
|
45
|
+
s === void 0 && Fe(e), v?.(e);
|
|
46
|
+
}
|
|
47
|
+
function Q() {
|
|
48
|
+
D || H || (Z(""), X(!0));
|
|
49
|
+
}
|
|
50
|
+
let $ = c((e) => {
|
|
51
|
+
if (L) {
|
|
52
|
+
let t = e === null ? [] : R.includes(e) ? R.filter((t) => t !== e) : [...R, e];
|
|
53
|
+
S === void 0 && Le(t), fe?.(t);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
s === void 0 && Fe(e), v?.(e), y === void 0 && Be(!1), x?.(!1), C === void 0 && He(""), w?.(""), B(null);
|
|
57
|
+
}, [
|
|
58
|
+
s,
|
|
59
|
+
v,
|
|
60
|
+
y,
|
|
61
|
+
x,
|
|
62
|
+
C,
|
|
63
|
+
w,
|
|
64
|
+
L,
|
|
65
|
+
R,
|
|
66
|
+
S,
|
|
67
|
+
fe
|
|
68
|
+
]), Ye = c((e) => {
|
|
69
|
+
let t = new Set(W);
|
|
70
|
+
t.has(e) ? t.delete(e) : t.add(e), T === void 0 && We(t), he?.(t);
|
|
71
|
+
}, [
|
|
72
|
+
W,
|
|
73
|
+
T,
|
|
74
|
+
he
|
|
75
|
+
]);
|
|
76
|
+
function Xe(e, t) {
|
|
77
|
+
let n = J.filter((e) => !e.disabled);
|
|
78
|
+
if (!n.length) return;
|
|
79
|
+
if (t) {
|
|
80
|
+
B(n[t === "start" ? 0 : n.length - 1].key);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
let r = n.findIndex((e) => e.key === z);
|
|
84
|
+
B(n[((r < 0 ? e > 0 ? -1 : 0 : r) + e + n.length) % n.length].key);
|
|
85
|
+
}
|
|
86
|
+
function Ze(e) {
|
|
87
|
+
if (j?.onKeyDown?.(e), e.defaultPrevented || M.current || e.nativeEvent.isComposing || e.keyCode === 229) return;
|
|
88
|
+
if (e.key === "Tab") {
|
|
89
|
+
H && X(!1);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (e.key === "Escape" && H) {
|
|
93
|
+
e.preventDefault(), e.stopPropagation(), X(!1);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (e.key === "Backspace" && !H && !L && V !== null) {
|
|
97
|
+
e.preventDefault(), Je(null), Q();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "Home" || e.key === "End") {
|
|
101
|
+
e.preventDefault(), Q(), e.key === "Home" ? Xe(0, "start") : e.key === "End" ? Xe(0, "end") : Xe(e.key === "ArrowDown" ? 1 : -1);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
let t = q.find(({ node: e }) => e.id === z);
|
|
105
|
+
if (e.key === "ArrowRight" && t) {
|
|
106
|
+
e.preventDefault(), Q(), t.node.children.length && !W.has(t.node.id) && !K ? Ye(t.node.id) : t.node.children.length && B(t.node.children[0].id);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (e.key === "ArrowLeft" && t) {
|
|
110
|
+
e.preventDefault(), t.node.children.length && W.has(t.node.id) && !K ? Ye(t.node.id) : t.parentId && B(t.parentId);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
e.key === "Enter" && H && z !== null && (e.preventDefault(), z === g ? $(null) : t && !t.node.disabled && $(z));
|
|
114
|
+
}
|
|
115
|
+
function Qe(e) {
|
|
116
|
+
P.current = e, typeof A == "function" ? A(e) : A && (A.current = e);
|
|
117
|
+
}
|
|
118
|
+
return /* @__PURE__ */ m(t, {
|
|
119
|
+
controlId: N,
|
|
120
|
+
label: ge,
|
|
121
|
+
required: O,
|
|
122
|
+
helpText: we,
|
|
123
|
+
error: k,
|
|
124
|
+
containerClassName: `ui-tree-select ${Oe}`.trim(),
|
|
125
|
+
children: [/* @__PURE__ */ p(h.Root, {
|
|
126
|
+
open: H,
|
|
127
|
+
onOpenChange: X,
|
|
128
|
+
children: /* @__PURE__ */ m("div", {
|
|
129
|
+
className: "ui-tree-select-root",
|
|
130
|
+
ref: Ne,
|
|
131
|
+
children: [
|
|
132
|
+
Ee && (L ? R : [V ?? ""]).map((e) => /* @__PURE__ */ p("input", {
|
|
133
|
+
type: "hidden",
|
|
134
|
+
name: Ee,
|
|
135
|
+
value: De === "label" ? I.get(e)?.label ?? "" : e,
|
|
136
|
+
disabled: D,
|
|
137
|
+
form: j?.form
|
|
138
|
+
}, e)),
|
|
139
|
+
/* @__PURE__ */ p(h.Anchor, {
|
|
140
|
+
asChild: !0,
|
|
141
|
+
children: /* @__PURE__ */ m("div", {
|
|
142
|
+
className: "ui-tree-select-control",
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ p("input", {
|
|
145
|
+
...j,
|
|
146
|
+
ref: Qe,
|
|
147
|
+
id: N,
|
|
148
|
+
className: "ui-input ui-tree-select-input",
|
|
149
|
+
role: "combobox",
|
|
150
|
+
"aria-autocomplete": "list",
|
|
151
|
+
"aria-haspopup": "tree",
|
|
152
|
+
"aria-expanded": H,
|
|
153
|
+
"aria-controls": H ? Me : void 0,
|
|
154
|
+
"aria-activedescendant": H ? Y : void 0,
|
|
155
|
+
"aria-describedby": qe,
|
|
156
|
+
"aria-invalid": k ? !0 : j?.["aria-invalid"],
|
|
157
|
+
"aria-required": O,
|
|
158
|
+
disabled: D,
|
|
159
|
+
placeholder: H ? ve : _e,
|
|
160
|
+
value: Ke,
|
|
161
|
+
onCompositionStart: (e) => {
|
|
162
|
+
M.current = !0, j?.onCompositionStart?.(e);
|
|
163
|
+
},
|
|
164
|
+
onCompositionEnd: (e) => {
|
|
165
|
+
M.current = !1, j?.onCompositionEnd?.(e);
|
|
166
|
+
},
|
|
167
|
+
onFocus: (e) => {
|
|
168
|
+
j?.onFocus?.(e), e.defaultPrevented || Q();
|
|
169
|
+
},
|
|
170
|
+
onClick: Q,
|
|
171
|
+
onChange: (e) => {
|
|
172
|
+
H || X(!0), Z(e.target.value), B(null);
|
|
173
|
+
},
|
|
174
|
+
onKeyDown: Ze
|
|
175
|
+
}),
|
|
176
|
+
Ge && !L && !D && /* @__PURE__ */ p("button", {
|
|
177
|
+
type: "button",
|
|
178
|
+
tabIndex: -1,
|
|
179
|
+
className: "ui-tree-select-clear",
|
|
180
|
+
"aria-label": ye,
|
|
181
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
182
|
+
onClick: () => {
|
|
183
|
+
Je(null), Z(""), P.current?.focus();
|
|
184
|
+
},
|
|
185
|
+
children: /* @__PURE__ */ p(o, {
|
|
186
|
+
size: 15,
|
|
187
|
+
"aria-hidden": "true"
|
|
188
|
+
})
|
|
189
|
+
}),
|
|
190
|
+
/* @__PURE__ */ p("button", {
|
|
191
|
+
type: "button",
|
|
192
|
+
tabIndex: -1,
|
|
193
|
+
className: "ui-tree-select-trigger",
|
|
194
|
+
"aria-label": H ? "收起选项" : "展开选项",
|
|
195
|
+
disabled: D,
|
|
196
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
197
|
+
onClick: () => H ? X(!1) : Q(),
|
|
198
|
+
children: E ? /* @__PURE__ */ p(a, {
|
|
199
|
+
className: "spin",
|
|
200
|
+
size: 16,
|
|
201
|
+
"aria-hidden": "true"
|
|
202
|
+
}) : /* @__PURE__ */ p(r, {
|
|
203
|
+
size: 16,
|
|
204
|
+
"aria-hidden": "true"
|
|
205
|
+
})
|
|
206
|
+
})
|
|
207
|
+
]
|
|
208
|
+
})
|
|
209
|
+
}),
|
|
210
|
+
/* @__PURE__ */ p(h.Portal, {
|
|
211
|
+
container: Ae,
|
|
212
|
+
children: /* @__PURE__ */ p(h.Content, {
|
|
213
|
+
className: `ui-tree-select-popover ${ke}`.trim(),
|
|
214
|
+
sideOffset: 6,
|
|
215
|
+
collisionPadding: 12,
|
|
216
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
217
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
218
|
+
onInteractOutside: (e) => {
|
|
219
|
+
Ne.current?.contains(e.target) && e.preventDefault();
|
|
220
|
+
},
|
|
221
|
+
children: /* @__PURE__ */ m("div", {
|
|
222
|
+
id: Me,
|
|
223
|
+
className: "ui-tree-select-tree",
|
|
224
|
+
role: "tree",
|
|
225
|
+
"aria-label": typeof ge == "string" ? ge : "树形选项",
|
|
226
|
+
"aria-busy": E || void 0,
|
|
227
|
+
"aria-multiselectable": L || void 0,
|
|
228
|
+
children: [/* @__PURE__ */ m("div", {
|
|
229
|
+
id: se(N, g),
|
|
230
|
+
role: "treeitem",
|
|
231
|
+
"aria-level": 1,
|
|
232
|
+
"aria-posinset": 1,
|
|
233
|
+
"aria-setsize": G.length + 1,
|
|
234
|
+
"aria-selected": L ? !R.length : V === null,
|
|
235
|
+
className: ce(z === g, L ? !R.length : V === null, !1),
|
|
236
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
237
|
+
onClick: () => $(null),
|
|
238
|
+
children: [
|
|
239
|
+
/* @__PURE__ */ p("span", { className: "ui-tree-select-spacer" }),
|
|
240
|
+
/* @__PURE__ */ p("span", {
|
|
241
|
+
className: "ui-tree-select-label",
|
|
242
|
+
children: L ? ye : be
|
|
243
|
+
}),
|
|
244
|
+
(L ? !R.length : V === null) && /* @__PURE__ */ p(n, {
|
|
245
|
+
size: 15,
|
|
246
|
+
"aria-hidden": "true"
|
|
247
|
+
})
|
|
248
|
+
]
|
|
249
|
+
}), E ? /* @__PURE__ */ p("div", {
|
|
250
|
+
className: "ui-tree-select-status",
|
|
251
|
+
role: "status",
|
|
252
|
+
children: Se
|
|
253
|
+
}) : Ce === void 0 ? G.length ? $e(G, 1) : /* @__PURE__ */ p("div", {
|
|
254
|
+
className: "ui-tree-select-status",
|
|
255
|
+
children: xe
|
|
256
|
+
}) : /* @__PURE__ */ p("div", {
|
|
257
|
+
className: "ui-tree-select-status ui-tree-select-error",
|
|
258
|
+
role: "alert",
|
|
259
|
+
children: Ce
|
|
260
|
+
})]
|
|
261
|
+
})
|
|
262
|
+
})
|
|
263
|
+
})
|
|
264
|
+
]
|
|
265
|
+
})
|
|
266
|
+
}), L && R.length > 0 && /* @__PURE__ */ m("div", {
|
|
267
|
+
className: "ui-multi-selection",
|
|
268
|
+
"aria-label": "已选节点",
|
|
269
|
+
children: [R.map((e) => /* @__PURE__ */ m("span", {
|
|
270
|
+
className: "ui-selection-tag",
|
|
271
|
+
children: [I.get(e)?.label ?? e, /* @__PURE__ */ p("button", {
|
|
272
|
+
type: "button",
|
|
273
|
+
disabled: D,
|
|
274
|
+
"aria-label": `移除 ${I.get(e)?.label ?? e}`,
|
|
275
|
+
onClick: () => $(e),
|
|
276
|
+
children: "×"
|
|
277
|
+
})]
|
|
278
|
+
}, e)), /* @__PURE__ */ p("button", {
|
|
279
|
+
type: "button",
|
|
280
|
+
className: "ui-selection-clear",
|
|
281
|
+
disabled: D,
|
|
282
|
+
onClick: () => $(null),
|
|
283
|
+
children: ye
|
|
284
|
+
})]
|
|
285
|
+
})]
|
|
286
|
+
});
|
|
287
|
+
function $e(e, t) {
|
|
288
|
+
return e.map((n, r) => {
|
|
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", {
|
|
291
|
+
className: "ui-tree-select-branch",
|
|
292
|
+
children: [/* @__PURE__ */ p(ne, {
|
|
293
|
+
node: n,
|
|
294
|
+
controlId: N,
|
|
295
|
+
level: t,
|
|
296
|
+
position: r + 1 + +(t === 1),
|
|
297
|
+
size: e.length + +(t === 1),
|
|
298
|
+
expanded: i,
|
|
299
|
+
selected: o,
|
|
300
|
+
active: z === n.id,
|
|
301
|
+
activate: B,
|
|
302
|
+
commit: $,
|
|
303
|
+
toggle: Ye
|
|
304
|
+
}), i && a && /* @__PURE__ */ p("div", {
|
|
305
|
+
role: "group",
|
|
306
|
+
children: $e(n.children, t + 1)
|
|
307
|
+
})]
|
|
308
|
+
}, n.id);
|
|
309
|
+
});
|
|
310
|
+
}
|
|
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),
|
|
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,
|
|
321
|
+
"aria-disabled": e.disabled || void 0,
|
|
322
|
+
className: ce(ee, l, !!e.disabled),
|
|
323
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
324
|
+
onMouseEnter: () => !e.disabled && u(e.id),
|
|
325
|
+
onClick: () => !e.disabled && d(e.id),
|
|
326
|
+
children: [
|
|
327
|
+
e.children.length ? /* @__PURE__ */ p("button", {
|
|
328
|
+
type: "button",
|
|
329
|
+
tabIndex: -1,
|
|
330
|
+
className: "ui-tree-select-toggle",
|
|
331
|
+
"aria-label": `${c ? "收起" : "展开"}${e.label}`,
|
|
332
|
+
onClick: (t) => {
|
|
333
|
+
t.stopPropagation(), f(e.id);
|
|
334
|
+
},
|
|
335
|
+
children: p(c ? r : i, {
|
|
336
|
+
size: 15,
|
|
337
|
+
"aria-hidden": "true"
|
|
338
|
+
})
|
|
339
|
+
}) : /* @__PURE__ */ p("span", { className: "ui-tree-select-spacer" }),
|
|
340
|
+
/* @__PURE__ */ p("span", {
|
|
341
|
+
className: "ui-tree-select-label",
|
|
342
|
+
children: e.label
|
|
343
|
+
}),
|
|
344
|
+
l && /* @__PURE__ */ p(n, {
|
|
345
|
+
size: 15,
|
|
346
|
+
"aria-hidden": "true"
|
|
347
|
+
})
|
|
348
|
+
]
|
|
349
|
+
});
|
|
350
|
+
});
|
|
351
|
+
function re(e) {
|
|
352
|
+
let t = /* @__PURE__ */ new Map();
|
|
353
|
+
for (let n of e) {
|
|
354
|
+
let e = n.id.trim();
|
|
355
|
+
e && !t.has(e) && t.set(e, {
|
|
356
|
+
...n,
|
|
357
|
+
id: e,
|
|
358
|
+
parentId: n.parentId?.trim() || null
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
let n = /* @__PURE__ */ new Map();
|
|
362
|
+
for (let e of t.values()) {
|
|
363
|
+
let r = e.parentId && t.has(e.parentId) && e.parentId !== e.id ? e.parentId : null;
|
|
364
|
+
n.set(e.id, r);
|
|
365
|
+
}
|
|
366
|
+
let r = v(n), i = new Map([...t].map(([e, t]) => [e, {
|
|
367
|
+
...t,
|
|
368
|
+
children: []
|
|
369
|
+
}])), a = [];
|
|
370
|
+
for (let e of i.values()) {
|
|
371
|
+
let t = r.has(e.id) ? null : n.get(e.id), o = t ? i.get(t) : void 0;
|
|
372
|
+
o ? o.children.push(e) : a.push(e);
|
|
373
|
+
}
|
|
374
|
+
return y(a), a;
|
|
375
|
+
}
|
|
376
|
+
function _(e, t) {
|
|
377
|
+
let n = t.trim().toLocaleLowerCase("zh-CN");
|
|
378
|
+
return n ? e.flatMap((e) => {
|
|
379
|
+
if (e.label.toLocaleLowerCase("zh-CN").includes(n)) return [b(e)];
|
|
380
|
+
let t = _(e.children, n);
|
|
381
|
+
return t.length ? [{
|
|
382
|
+
...e,
|
|
383
|
+
children: t
|
|
384
|
+
}] : [];
|
|
385
|
+
}) : e.map(b);
|
|
386
|
+
}
|
|
387
|
+
function v(e) {
|
|
388
|
+
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
389
|
+
for (let r of e.keys()) {
|
|
390
|
+
if (t.has(r)) continue;
|
|
391
|
+
let i = [], a = /* @__PURE__ */ new Map(), o = r;
|
|
392
|
+
for (; o && !t.has(o);) {
|
|
393
|
+
let t = a.get(o);
|
|
394
|
+
if (t !== void 0) {
|
|
395
|
+
for (let e of i.slice(t)) n.add(e);
|
|
396
|
+
break;
|
|
397
|
+
}
|
|
398
|
+
a.set(o, i.length), i.push(o), o = e.get(o) ?? null;
|
|
399
|
+
}
|
|
400
|
+
for (let e of i) t.add(e);
|
|
401
|
+
}
|
|
402
|
+
return n;
|
|
403
|
+
}
|
|
404
|
+
function y(e) {
|
|
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);
|
|
407
|
+
}
|
|
408
|
+
function b(e) {
|
|
409
|
+
return {
|
|
410
|
+
...e,
|
|
411
|
+
children: e.children.map(b)
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
function ie(e) {
|
|
415
|
+
return e.flatMap((e) => [e, ...ie(e.children)]);
|
|
416
|
+
}
|
|
417
|
+
function ae(e) {
|
|
418
|
+
return ie(e).filter((e) => e.children.length).map((e) => e.id);
|
|
419
|
+
}
|
|
420
|
+
function oe(e, t, n, r = 1, i = null) {
|
|
421
|
+
return e.flatMap((a, o) => [{
|
|
422
|
+
node: a,
|
|
423
|
+
level: r,
|
|
424
|
+
parentId: i,
|
|
425
|
+
posInSet: o + 1,
|
|
426
|
+
setSize: e.length
|
|
427
|
+
}, ...a.children.length && (n || t.has(a.id)) ? oe(a.children, t, n, r + 1, a.id) : []]);
|
|
428
|
+
}
|
|
429
|
+
function se(e, t) {
|
|
430
|
+
return `${e}-item-${encodeURIComponent(t).replaceAll("%", "_")}`;
|
|
431
|
+
}
|
|
432
|
+
function ce(e, t, n) {
|
|
433
|
+
return [
|
|
434
|
+
"ui-tree-select-item",
|
|
435
|
+
e ? "active" : "",
|
|
436
|
+
t ? "selected" : "",
|
|
437
|
+
n ? "disabled" : ""
|
|
438
|
+
].filter(Boolean).join(" ");
|
|
439
|
+
}
|
|
440
|
+
function le(...e) {
|
|
441
|
+
return e.filter(Boolean).join(" ") || void 0;
|
|
442
|
+
}
|
|
443
|
+
//#endregion
|
|
444
|
+
export { te as TreeSelect, re as buildTreeSelectTree, _ as filterTreeSelectTree };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/AmountFormat.ts
|
|
2
|
+
function e(e, t = {}) {
|
|
3
|
+
if (e === "") return "";
|
|
4
|
+
if (!/^[+-]?\d+(?:\.\d+)?$/.test(e)) throw RangeError("Expected a decimal string");
|
|
5
|
+
let n = t.minimumFractionDigits ?? (t.moneyFormat ? 2 : 0);
|
|
6
|
+
if (!Number.isInteger(n) || n < 0 || n > 100) throw RangeError("Invalid minimumFractionDigits");
|
|
7
|
+
let r = e.startsWith("-"), [i, a = ""] = e.replace(/^[+-]/, "").split("."), o = a.padEnd(n, "0"), s = (t.useGrouping === !1 ? i : i.replace(/\B(?=(\d{3})+(?!\d))/g, ",")) + (o ? `.${o}` : ""), c = t.moneyFormat, l = c?.display ?? "symbol";
|
|
8
|
+
return `${r ? "-" : ""}${c && l === "symbol" ? c.symbol : ""}${s}` + (c && l === "unit" ? c.unit ?? "" : "");
|
|
9
|
+
}
|
|
10
|
+
function t(t, n, r = 100) {
|
|
11
|
+
let i = Math.log10(r);
|
|
12
|
+
if (!Number.isSafeInteger(t) || !Number.isSafeInteger(r) || !Number.isInteger(i) || i < 0) throw RangeError("Expected safe integer value and power-of-ten scale");
|
|
13
|
+
let a = (BigInt(t) < 0n ? -BigInt(t) : BigInt(t)).toString().padStart(i + 1, "0"), o = i ? `${a.slice(0, -i)}.${a.slice(-i)}` : a;
|
|
14
|
+
return e(`${t < 0 ? "-" : ""}${o}`, {
|
|
15
|
+
moneyFormat: n,
|
|
16
|
+
minimumFractionDigits: i
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { e as formatDecimalAmount, t as formatScaledMoney };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
import { Button as e, LinkButton as t, buttonClassName as n } from "./Button.js";
|
|
3
|
+
import { Alert as r } from "./Alert.js";
|
|
4
|
+
import { EmptyState as i } from "./EmptyState.js";
|
|
5
|
+
import { Skeleton as a, SkeletonText as o } from "./Skeleton.js";
|
|
6
|
+
import { Popconfirm as s, Popover as c, Tooltip as l } from "./FloatingControls.js";
|
|
7
|
+
import { Checkbox as u, FormField as d, SelectInput as f, TextArea as p, TextInput as m } from "./FormField.js";
|
|
8
|
+
import { Select as h } from "./Select.js";
|
|
9
|
+
import { Combobox as g } from "./Combobox.js";
|
|
10
|
+
import { AutoComplete as _, Autocomplete as v } from "./AutoComplete.js";
|
|
11
|
+
import { ToastProvider as y, useToast as b } from "./Toast.js";
|
|
12
|
+
import { DataTableTheme as x } from "./DataTableTheme.js";
|
|
13
|
+
import { DataTableMergedRows as S } from "./DataTableMergedRows.js";
|
|
14
|
+
import { DataTable as C, DataTableView as w, sortRows as T, useDataTable as E } from "./data-table.js";
|
|
15
|
+
import { ExplainableButton as D } from "./ExplainableButton.js";
|
|
16
|
+
import { Dialog as O, ModalShell as k } from "./ModalShell.js";
|
|
17
|
+
import { DateInput as A, calendarDays as j, parseDate as M } from "./DateInput.js";
|
|
18
|
+
import { Pagination as N, clampPage as P, pageCount as F, visiblePages as I } from "./Pagination.js";
|
|
19
|
+
import { RovingTabList as L, RovingTabPanel as R, nextRovingTabValue as z } from "./RovingTabs.js";
|
|
20
|
+
import { ToggleSwitch as B } from "./ToggleSwitch.js";
|
|
21
|
+
import { SegmentedControl as V } from "./SegmentedControl.js";
|
|
22
|
+
import { AsyncState as H, RecoverableAsyncState as U } from "./RecoverableAsyncState.js";
|
|
23
|
+
import { useModalFocusTrap as W } from "./useModalFocusTrap.js";
|
|
24
|
+
import { AsyncSearchPicker as G } from "./AsyncSearchPicker.js";
|
|
25
|
+
import { AsyncDirectoryPicker as K } from "./AsyncDirectoryPicker.js";
|
|
26
|
+
import { DropdownMenu as q, Menu as J } from "./DropdownMenu.js";
|
|
27
|
+
import { ConfirmDialog as Y } from "./ConfirmDialog.js";
|
|
28
|
+
import { useDebouncedValue as X } from "./useDebouncedValue.js";
|
|
29
|
+
import { Badge as Z } from "./Badge.js";
|
|
30
|
+
import { MetricCard as Q } from "./MetricCard.js";
|
|
31
|
+
import { PageHeader as $ } from "./PageHeader.js";
|
|
32
|
+
import { SectionCard as ee } from "./SectionCard.js";
|
|
33
|
+
import { SortableList as te, moveSortableItems as ne } from "./SortableList.js";
|
|
34
|
+
import { TreeSelect as re, buildTreeSelectTree as ie, filterTreeSelectTree as ae } from "./TreeSelect.js";
|
|
35
|
+
import { Cascader as oe, buildCascaderOptions as se, indexCascaderPaths as ce } from "./Cascader.js";
|
|
36
|
+
import { StructuredAddressInput as le, findAddressRegionPath as ue, flattenAddressRegions as de, searchAddressRegions as fe } from "./StructuredAddressInput.js";
|
|
37
|
+
import { FileDropzone as pe, acceptsFile as me } from "./FileDropzone.js";
|
|
38
|
+
import { useFilePreparation as he } from "./useFilePreparation.js";
|
|
39
|
+
import { FilePreparationDialog as ge } from "./FilePreparationDialog.js";
|
|
40
|
+
import { PreparedFileDropzone as _e } from "./PreparedFileDropzone.js";
|
|
41
|
+
import { formatDecimalAmount as ve, formatScaledMoney as ye } from "./amount-format.js";
|
|
42
|
+
import { NumericInput as be, ScaledNumericInput as xe } from "./NumericInput.js";
|
|
43
|
+
import { MultiSelect as Se } from "./MultiSelect.js";
|
|
44
|
+
export { r as Alert, K as AsyncDirectoryPicker, G as AsyncSearchPicker, H as AsyncState, _ as AutoComplete, v as Autocomplete, Z as Badge, e as Button, oe as Cascader, u as Checkbox, g as Combobox, Y as ConfirmDialog, C as DataTable, S as DataTableMergedRows, x as DataTableTheme, w as DataTableView, A as DateInput, O as Dialog, q as DropdownMenu, i as EmptyState, D as ExplainableButton, pe as FileDropzone, ge as FilePreparationDialog, d as FormField, t as LinkButton, J as Menu, Q as MetricCard, k as ModalShell, Se as MultiSelect, be as NumericInput, $ as PageHeader, N as Pagination, s as Popconfirm, c as Popover, _e as PreparedFileDropzone, U as RecoverableAsyncState, L as RovingTabList, R as RovingTabPanel, xe as ScaledNumericInput, ee as SectionCard, V as SegmentedControl, h as Select, f as SelectInput, a as Skeleton, o as SkeletonText, te as SortableList, le as StructuredAddressInput, p as TextArea, m as TextInput, y as ToastProvider, B as ToggleSwitch, l as Tooltip, re as TreeSelect, me as acceptsFile, se as buildCascaderOptions, ie as buildTreeSelectTree, n as buttonClassName, j as calendarDays, P as clampPage, ae as filterTreeSelectTree, ue as findAddressRegionPath, de as flattenAddressRegions, ve as formatDecimalAmount, ye as formatScaledMoney, ce as indexCascaderPaths, ne as moveSortableItems, z as nextRovingTabValue, F as pageCount, M as parseDate, fe as searchAddressRegions, T as sortRows, E as useDataTable, X as useDebouncedValue, he as useFilePreparation, W as useModalFocusTrap, b as useToast, I as visiblePages };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getCascaderData as e } from "cn-division/cascader-pca";
|
|
2
|
+
//#region src/ChineseAddressRegions.ts
|
|
3
|
+
var t = "2026.0.0", n = "overseas", r = [...e().map(i), {
|
|
4
|
+
id: n,
|
|
5
|
+
label: "海外"
|
|
6
|
+
}];
|
|
7
|
+
function i(e) {
|
|
8
|
+
return {
|
|
9
|
+
id: e.value,
|
|
10
|
+
label: e.label,
|
|
11
|
+
children: e.children?.map(i)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { t as CHINESE_ADDRESS_DATA_VERSION, n as OVERSEAS_ADDRESS_REGION_ID, r as chineseAddressRegions };
|