@sia.soul/sia-react-ui 0.1.148 → 0.1.150
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/{chunk-TH7BNDV4.js → chunk-G5YXOCSY.js} +3 -3
- package/dist/{chunk-4PYHSNRA.js → chunk-HRC6TQTZ.js} +2 -2
- package/dist/{chunk-EZTF5TA2.js → chunk-J4R734AI.js} +1 -1
- package/dist/{chunk-YHVFLSZW.js → chunk-SCVUD2IJ.js} +297 -263
- package/dist/{chunk-QLS2IXU4.js → chunk-TKRCHZB7.js} +2 -2
- package/dist/{chunk-W4HDN7MD.js → chunk-VRUTRTLY.js} +2 -2
- package/dist/{core-BJa8K9R8.d.ts → core-BJ4CiGSl.d.ts} +1 -1
- package/dist/{core-DC4cb_KT.d.cts → core-IKk39Mp9.d.cts} +1 -1
- package/dist/core.cjs +297 -263
- package/dist/core.css +204 -0
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +4 -4
- package/dist/game.cjs +297 -263
- package/dist/game.js +1 -1
- package/dist/index.cjs +2649 -2111
- package/dist/index.css +231 -0
- package/dist/index.d.cts +79 -4
- package/dist/index.d.ts +79 -4
- package/dist/index.js +987 -486
- package/dist/rich-text-editor.cjs +297 -263
- package/dist/rich-text-editor.js +3 -3
- package/dist/select-date-range.cjs +297 -263
- package/dist/select-date-range.js +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
Watermark,
|
|
83
83
|
message,
|
|
84
84
|
notification
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-G5YXOCSY.js";
|
|
86
86
|
import "./chunk-RX242MUO.js";
|
|
87
87
|
import {
|
|
88
88
|
MarkdownEditor
|
|
@@ -90,12 +90,12 @@ import {
|
|
|
90
90
|
import {
|
|
91
91
|
RichTextContent,
|
|
92
92
|
RichTextEditor
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-VRUTRTLY.js";
|
|
94
94
|
import {
|
|
95
95
|
DatePicker,
|
|
96
96
|
SelectDateRange,
|
|
97
97
|
TimePanel
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-TKRCHZB7.js";
|
|
99
99
|
import {
|
|
100
100
|
Checkbox,
|
|
101
101
|
OverflowTags,
|
|
@@ -107,14 +107,14 @@ import {
|
|
|
107
107
|
Tree,
|
|
108
108
|
normalizeSelectionValues,
|
|
109
109
|
usePressFeedback
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-HRC6TQTZ.js";
|
|
111
111
|
import {
|
|
112
112
|
Dropdown,
|
|
113
113
|
Input,
|
|
114
114
|
Menu,
|
|
115
115
|
Segmented,
|
|
116
116
|
Steps
|
|
117
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-J4R734AI.js";
|
|
118
118
|
import {
|
|
119
119
|
TextArea
|
|
120
120
|
} from "./chunk-NRLIOMXY.js";
|
|
@@ -128,7 +128,7 @@ import {
|
|
|
128
128
|
Skeleton,
|
|
129
129
|
useOverlayExitPlaceholder,
|
|
130
130
|
useOverlayLifecycle
|
|
131
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-SCVUD2IJ.js";
|
|
132
132
|
import {
|
|
133
133
|
Button
|
|
134
134
|
} from "./chunk-PU2V3VB5.js";
|
|
@@ -3774,8 +3774,366 @@ function buildFlatTree(items, options = {}) {
|
|
|
3774
3774
|
return roots;
|
|
3775
3775
|
}
|
|
3776
3776
|
|
|
3777
|
+
// src/components/ChooseBox.tsx
|
|
3778
|
+
import { useEffect as useEffect10, useMemo as useMemo7, useRef as useRef15, useState as useState15 } from "react";
|
|
3779
|
+
|
|
3780
|
+
// src/components/chooseBoxSource.ts
|
|
3781
|
+
function createBrowserChooseBoxSource() {
|
|
3782
|
+
const roots = [];
|
|
3783
|
+
const directories = /* @__PURE__ */ new Map();
|
|
3784
|
+
return {
|
|
3785
|
+
getRoots: async () => [...roots],
|
|
3786
|
+
authorize: async () => {
|
|
3787
|
+
const picker = window.showDirectoryPicker;
|
|
3788
|
+
if (!picker) throw new Error("\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u76EE\u5F55\u6388\u6743\uFF0C\u8BF7\u4F7F\u7528 HTTPS \u6216 localhost \u4E0B\u7684 Chrome / Edge\uFF0C\u6216\u63A5\u5165\u684C\u9762\u76EE\u5F55\u6E90\u3002");
|
|
3789
|
+
try {
|
|
3790
|
+
const handle = await picker.call(window, { mode: "read" });
|
|
3791
|
+
for (const root2 of roots) if (await handle.isSameEntry(directories.get(root2.id))) return root2;
|
|
3792
|
+
const root = { id: `browser-root-${roots.length + 1}`, name: handle.name, kind: "directory", path: handle.name, handle };
|
|
3793
|
+
directories.set(root.id, handle);
|
|
3794
|
+
roots.push(root);
|
|
3795
|
+
return root;
|
|
3796
|
+
} catch (error) {
|
|
3797
|
+
if (error instanceof DOMException && error.name === "AbortError") return null;
|
|
3798
|
+
throw error;
|
|
3799
|
+
}
|
|
3800
|
+
},
|
|
3801
|
+
readDirectory: async (directory) => {
|
|
3802
|
+
const handle = directories.get(directory.id);
|
|
3803
|
+
if (!handle) throw new Error("\u76EE\u5F55\u5C1A\u672A\u6388\u6743\uFF0C\u8BF7\u91CD\u65B0\u6DFB\u52A0\u76EE\u5F55\u3002");
|
|
3804
|
+
const result = [];
|
|
3805
|
+
for await (const child of handle.values()) {
|
|
3806
|
+
const id = `${directory.id}/${encodeURIComponent(child.name)}`;
|
|
3807
|
+
if (child.kind === "directory") directories.set(id, child);
|
|
3808
|
+
result.push({
|
|
3809
|
+
id,
|
|
3810
|
+
name: child.name,
|
|
3811
|
+
kind: child.kind,
|
|
3812
|
+
path: `${directory.path}/${child.name}`,
|
|
3813
|
+
handle: child,
|
|
3814
|
+
...child.kind === "file" ? { getFile: () => child.getFile() } : {}
|
|
3815
|
+
});
|
|
3816
|
+
}
|
|
3817
|
+
return result;
|
|
3818
|
+
}
|
|
3819
|
+
};
|
|
3820
|
+
}
|
|
3821
|
+
function createTauriChooseBoxSource(invoke) {
|
|
3822
|
+
return {
|
|
3823
|
+
getRoots: () => invoke("choose_box_roots"),
|
|
3824
|
+
readDirectory: (directory) => invoke("choose_box_read_directory", { path: directory.path })
|
|
3825
|
+
};
|
|
3826
|
+
}
|
|
3827
|
+
|
|
3828
|
+
// src/components/ChooseBox.tsx
|
|
3829
|
+
import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3830
|
+
function ChooseBox({
|
|
3831
|
+
source: suppliedSource,
|
|
3832
|
+
kind = "file",
|
|
3833
|
+
multiple = false,
|
|
3834
|
+
value,
|
|
3835
|
+
defaultValue = [],
|
|
3836
|
+
onChange,
|
|
3837
|
+
disabled = false,
|
|
3838
|
+
placeholder,
|
|
3839
|
+
allowClear = true,
|
|
3840
|
+
accept = "",
|
|
3841
|
+
title,
|
|
3842
|
+
size: sizeProp,
|
|
3843
|
+
onError,
|
|
3844
|
+
className = "",
|
|
3845
|
+
...props
|
|
3846
|
+
}) {
|
|
3847
|
+
const browserSource = useMemo7(createBrowserChooseBoxSource, []);
|
|
3848
|
+
const source = suppliedSource ?? browserSource;
|
|
3849
|
+
const size = useControlSize(sizeProp);
|
|
3850
|
+
const [selected, setSelected] = useControllableState({ value, defaultValue, onChange: (entries) => onChange?.([...entries]) });
|
|
3851
|
+
const [open, setOpen] = useState15(false);
|
|
3852
|
+
const [roots, setRoots] = useState15([]);
|
|
3853
|
+
const [cache, setCache] = useState15({});
|
|
3854
|
+
const [history, setHistory] = useState15([]);
|
|
3855
|
+
const [position, setPosition] = useState15(-1);
|
|
3856
|
+
const current = history[position];
|
|
3857
|
+
const [draft, setDraft] = useState15([]);
|
|
3858
|
+
const [busy, setBusy] = useState15(false);
|
|
3859
|
+
const [authorizing, setAuthorizing] = useState15(false);
|
|
3860
|
+
const [error, setError] = useState15("");
|
|
3861
|
+
const [query, setQuery] = useState15("");
|
|
3862
|
+
const [view, setView] = useState15("grid");
|
|
3863
|
+
const [sort, setSort] = useState15("asc");
|
|
3864
|
+
const [filter, setFilter] = useState15("accepted");
|
|
3865
|
+
const [pathText, setPathText] = useState15("");
|
|
3866
|
+
const session = useRef15(0);
|
|
3867
|
+
const request = useRef15(0);
|
|
3868
|
+
const authorizingLock = useRef15(false);
|
|
3869
|
+
const errorHandler = useRef15(onError);
|
|
3870
|
+
errorHandler.current = onError;
|
|
3871
|
+
const targetName = kind === "file" ? "\u6587\u4EF6" : "\u6587\u4EF6\u5939";
|
|
3872
|
+
const extensions = accept.split(",").map((item) => item.trim().toLowerCase()).filter(Boolean);
|
|
3873
|
+
const allowed = (entry) => entry.kind === kind && (kind === "directory" || !extensions.length || extensions.some((ext) => entry.name.toLowerCase().endsWith(ext)));
|
|
3874
|
+
const normalized = (entries) => {
|
|
3875
|
+
const result = [...new Map(entries.filter(allowed).map((entry) => [entry.id, entry])).values()];
|
|
3876
|
+
return multiple ? result : result.slice(0, 1);
|
|
3877
|
+
};
|
|
3878
|
+
const displayed = normalized(selected);
|
|
3879
|
+
const chosen = normalized(draft);
|
|
3880
|
+
const report = (reason) => {
|
|
3881
|
+
const failure = reason instanceof Error ? reason : new Error(String(reason));
|
|
3882
|
+
setError(failure.message);
|
|
3883
|
+
errorHandler.current?.(failure);
|
|
3884
|
+
};
|
|
3885
|
+
function close() {
|
|
3886
|
+
session.current++;
|
|
3887
|
+
request.current++;
|
|
3888
|
+
setOpen(false);
|
|
3889
|
+
}
|
|
3890
|
+
useEffect10(() => {
|
|
3891
|
+
if (!open) return;
|
|
3892
|
+
const token = ++session.current;
|
|
3893
|
+
setRoots([]);
|
|
3894
|
+
setCache({});
|
|
3895
|
+
setHistory([]);
|
|
3896
|
+
setPosition(-1);
|
|
3897
|
+
setQuery("");
|
|
3898
|
+
setPathText("");
|
|
3899
|
+
setError("");
|
|
3900
|
+
setBusy(true);
|
|
3901
|
+
Promise.resolve().then(() => source.getRoots()).then((entries) => {
|
|
3902
|
+
if (session.current !== token) return;
|
|
3903
|
+
const directories = entries.filter((entry) => entry.kind === "directory");
|
|
3904
|
+
setRoots(directories);
|
|
3905
|
+
if (directories[0]) {
|
|
3906
|
+
setHistory([directories[0]]);
|
|
3907
|
+
setPosition(0);
|
|
3908
|
+
}
|
|
3909
|
+
}).catch((reason) => {
|
|
3910
|
+
if (session.current === token) report(reason);
|
|
3911
|
+
}).finally(() => {
|
|
3912
|
+
if (session.current === token) setBusy(false);
|
|
3913
|
+
});
|
|
3914
|
+
return () => {
|
|
3915
|
+
session.current++;
|
|
3916
|
+
request.current++;
|
|
3917
|
+
};
|
|
3918
|
+
}, [open, source]);
|
|
3919
|
+
useEffect10(() => {
|
|
3920
|
+
if (disabled && open) close();
|
|
3921
|
+
}, [disabled, open]);
|
|
3922
|
+
async function read(directory, token) {
|
|
3923
|
+
const entries = await source.readDirectory(directory);
|
|
3924
|
+
if (session.current === token) setCache((previous) => ({ ...previous, [directory.id]: entries }));
|
|
3925
|
+
return entries;
|
|
3926
|
+
}
|
|
3927
|
+
async function refresh(directory) {
|
|
3928
|
+
const token = session.current, id = ++request.current;
|
|
3929
|
+
setBusy(true);
|
|
3930
|
+
setError("");
|
|
3931
|
+
try {
|
|
3932
|
+
await read(directory, token);
|
|
3933
|
+
} catch (reason) {
|
|
3934
|
+
if (token === session.current && id === request.current) report(reason);
|
|
3935
|
+
} finally {
|
|
3936
|
+
if (token === session.current && id === request.current) setBusy(false);
|
|
3937
|
+
}
|
|
3938
|
+
}
|
|
3939
|
+
useEffect10(() => {
|
|
3940
|
+
if (!open || !current) return;
|
|
3941
|
+
setPathText(current.path);
|
|
3942
|
+
setQuery("");
|
|
3943
|
+
void refresh(current);
|
|
3944
|
+
}, [open, current, source]);
|
|
3945
|
+
function navigate(entry) {
|
|
3946
|
+
if (entry.kind !== "directory" || current?.id === entry.id) return;
|
|
3947
|
+
setHistory((previous) => [...previous.slice(0, position + 1), entry]);
|
|
3948
|
+
setPosition(position + 1);
|
|
3949
|
+
}
|
|
3950
|
+
function toggle(entry) {
|
|
3951
|
+
if (!allowed(entry)) return;
|
|
3952
|
+
setDraft((previous) => multiple ? previous.some((item) => item.id === entry.id) ? previous.filter((item) => item.id !== entry.id) : [...previous, entry] : [entry]);
|
|
3953
|
+
}
|
|
3954
|
+
async function authorize() {
|
|
3955
|
+
if (!source.authorize || authorizingLock.current) return;
|
|
3956
|
+
const token = session.current;
|
|
3957
|
+
authorizingLock.current = true;
|
|
3958
|
+
setAuthorizing(true);
|
|
3959
|
+
setError("");
|
|
3960
|
+
try {
|
|
3961
|
+
const entry = await source.authorize();
|
|
3962
|
+
if (!entry || token !== session.current) return;
|
|
3963
|
+
const entries = await source.getRoots();
|
|
3964
|
+
if (token !== session.current) return;
|
|
3965
|
+
setRoots(entries.filter((item) => item.kind === "directory"));
|
|
3966
|
+
navigate(entry);
|
|
3967
|
+
} catch (reason) {
|
|
3968
|
+
if (token === session.current) report(reason);
|
|
3969
|
+
} finally {
|
|
3970
|
+
authorizingLock.current = false;
|
|
3971
|
+
setAuthorizing(false);
|
|
3972
|
+
}
|
|
3973
|
+
}
|
|
3974
|
+
const allEntries = new Map([...roots, ...Object.values(cache).flat()].map((entry) => [entry.id, entry]));
|
|
3975
|
+
const parent = current ? Object.entries(cache).find(([, entries]) => entries.some((entry) => entry.id === current.id))?.[0] : void 0;
|
|
3976
|
+
function treeNodes(entries, ancestors = /* @__PURE__ */ new Set()) {
|
|
3977
|
+
return entries.filter((entry) => entry.kind === "directory" && !ancestors.has(entry.id)).map((entry) => ({
|
|
3978
|
+
key: entry.id,
|
|
3979
|
+
title: entry.name,
|
|
3980
|
+
icon: /* @__PURE__ */ jsx19(Icon, { name: "folder" }),
|
|
3981
|
+
isLeaf: false,
|
|
3982
|
+
loaded: cache[entry.id] !== void 0,
|
|
3983
|
+
children: cache[entry.id] ? treeNodes(cache[entry.id], /* @__PURE__ */ new Set([...ancestors, entry.id])) : void 0
|
|
3984
|
+
}));
|
|
3985
|
+
}
|
|
3986
|
+
const visible = [...current ? cache[current.id] ?? [] : []].filter((entry) => entry.name.toLowerCase().includes(query.toLowerCase()) && (entry.kind === "directory" || filter === "all" || !extensions.length || extensions.some((ext) => entry.name.toLowerCase().endsWith(ext)))).sort((a, b) => Number(b.kind === "directory") - Number(a.kind === "directory") || a.name.localeCompare(b.name, "zh-CN", { numeric: true }) * (sort === "asc" ? 1 : -1));
|
|
3987
|
+
const selectable = visible.filter(allowed);
|
|
3988
|
+
const allChecked = selectable.length > 0 && selectable.every((entry) => chosen.some((item) => item.id === entry.id));
|
|
3989
|
+
const clearable = allowClear && displayed.length > 0 && !disabled;
|
|
3990
|
+
return /* @__PURE__ */ jsxs18("div", { ...props, className: `sia-choose-box${clearable ? " sia-choose-box--clearable" : ""} ${className}`.trim(), children: [
|
|
3991
|
+
/* @__PURE__ */ jsx19(
|
|
3992
|
+
Button,
|
|
3993
|
+
{
|
|
3994
|
+
className: "sia-choose-box__trigger",
|
|
3995
|
+
size,
|
|
3996
|
+
disabled,
|
|
3997
|
+
"aria-haspopup": "dialog",
|
|
3998
|
+
"aria-expanded": open,
|
|
3999
|
+
icon: /* @__PURE__ */ jsx19(Icon, { name: kind === "directory" ? "folder" : "file", size: 16 }),
|
|
4000
|
+
iconPosition: "end",
|
|
4001
|
+
onClick: () => {
|
|
4002
|
+
setDraft(normalized(selected));
|
|
4003
|
+
setOpen(true);
|
|
4004
|
+
},
|
|
4005
|
+
children: /* @__PURE__ */ jsx19("span", { className: `sia-choose-box__value${displayed.length ? "" : " sia-choose-box__placeholder"}`, children: displayed.length ? displayed.map((entry) => entry.path).join("\uFF1B") : placeholder ?? `\u8BF7\u9009\u62E9${targetName}` })
|
|
4006
|
+
}
|
|
4007
|
+
),
|
|
4008
|
+
clearable && /* @__PURE__ */ jsx19(Button, { className: "sia-choose-box__clear", variant: "text", size, "aria-label": "\u6E05\u7A7A\u9009\u62E9", icon: /* @__PURE__ */ jsx19(Icon, { name: "close", size: 14 }), onClick: () => setSelected([]) }),
|
|
4009
|
+
/* @__PURE__ */ jsxs18(
|
|
4010
|
+
Modal,
|
|
4011
|
+
{
|
|
4012
|
+
open,
|
|
4013
|
+
title: title ?? `\u9009\u62E9${multiple ? "\u591A\u4E2A" : "\u5355\u4E2A"}${targetName}`,
|
|
4014
|
+
width: 960,
|
|
4015
|
+
centered: true,
|
|
4016
|
+
autoFocus: false,
|
|
4017
|
+
className: "sia-choose-box__modal",
|
|
4018
|
+
onCancel: close,
|
|
4019
|
+
okButtonProps: { disabled: busy || authorizing || !chosen.length },
|
|
4020
|
+
onOk: () => {
|
|
4021
|
+
if (disabled || busy || authorizing || !chosen.length) return false;
|
|
4022
|
+
setSelected(chosen);
|
|
4023
|
+
close();
|
|
4024
|
+
},
|
|
4025
|
+
footerExtra: /* @__PURE__ */ jsxs18("span", { role: "status", children: [
|
|
4026
|
+
"\u5DF2\u9009\u62E9 ",
|
|
4027
|
+
chosen.length,
|
|
4028
|
+
" \u4E2A",
|
|
4029
|
+
targetName
|
|
4030
|
+
] }),
|
|
4031
|
+
children: [
|
|
4032
|
+
/* @__PURE__ */ jsxs18("div", { className: "sia-choose-box__toolbar", children: [
|
|
4033
|
+
/* @__PURE__ */ jsx19(Button, { "aria-label": "\u540E\u9000", title: "\u540E\u9000", disabled: position <= 0, icon: /* @__PURE__ */ jsx19(Icon, { name: "arrow-left" }), onClick: () => setPosition(position - 1) }),
|
|
4034
|
+
/* @__PURE__ */ jsx19(Button, { "aria-label": "\u524D\u8FDB", title: "\u524D\u8FDB", disabled: position >= history.length - 1, icon: /* @__PURE__ */ jsx19(Icon, { name: "arrow-right" }), onClick: () => setPosition(position + 1) }),
|
|
4035
|
+
/* @__PURE__ */ jsx19(Button, { "aria-label": "\u4E0A\u4E00\u7EA7", title: "\u4E0A\u4E00\u7EA7", disabled: !parent, icon: /* @__PURE__ */ jsx19(Icon, { name: "arrow-up" }), onClick: () => {
|
|
4036
|
+
if (parent) navigate(allEntries.get(parent));
|
|
4037
|
+
} }),
|
|
4038
|
+
/* @__PURE__ */ jsx19(Button, { "aria-label": "\u5237\u65B0\u76EE\u5F55", title: "\u5237\u65B0\u76EE\u5F55", disabled: !current || busy, icon: /* @__PURE__ */ jsx19(Icon, { name: "refresh" }), onClick: () => current && void refresh(current) }),
|
|
4039
|
+
/* @__PURE__ */ jsx19(Select, { "aria-label": "\u6392\u5E8F", allowClear: false, value: sort, onChange: (value2) => setSort(String(value2)), options: [{ value: "asc", label: "\u540D\u79F0\u5347\u5E8F" }, { value: "desc", label: "\u540D\u79F0\u964D\u5E8F" }] }),
|
|
4040
|
+
/* @__PURE__ */ jsx19(Select, { "aria-label": "\u89C6\u56FE", allowClear: false, value: view, onChange: (value2) => setView(String(value2)), options: [{ value: "grid", label: "\u56FE\u6807\u89C6\u56FE" }, { value: "list", label: "\u5217\u8868\u89C6\u56FE" }] }),
|
|
4041
|
+
source.authorize && /* @__PURE__ */ jsx19(Button, { loading: authorizing, onClick: () => void authorize(), icon: /* @__PURE__ */ jsx19(Icon, { name: "folder-plus" }), children: "\u6DFB\u52A0\u6388\u6743\u76EE\u5F55" })
|
|
4042
|
+
] }),
|
|
4043
|
+
/* @__PURE__ */ jsxs18("div", { className: "sia-choose-box__path", children: [
|
|
4044
|
+
/* @__PURE__ */ jsx19(
|
|
4045
|
+
Input,
|
|
4046
|
+
{
|
|
4047
|
+
"aria-label": "\u76EE\u5F55\u8DEF\u5F84",
|
|
4048
|
+
value: pathText,
|
|
4049
|
+
allowClear: false,
|
|
4050
|
+
onChange: (event) => setPathText(event.target.value),
|
|
4051
|
+
onKeyDown: (event) => {
|
|
4052
|
+
if (event.key === "Enter") {
|
|
4053
|
+
const entry = [...allEntries.values()].find((item) => item.kind === "directory" && item.path === pathText);
|
|
4054
|
+
if (entry) navigate(entry);
|
|
4055
|
+
else setError("\u8BF7\u5148\u5728\u76EE\u5F55\u6811\u4E2D\u5C55\u5F00\u6B64\u8DEF\u5F84\uFF0C\u6216\u6DFB\u52A0\u6388\u6743\u76EE\u5F55\u3002");
|
|
4056
|
+
}
|
|
4057
|
+
}
|
|
4058
|
+
}
|
|
4059
|
+
),
|
|
4060
|
+
/* @__PURE__ */ jsx19(Input, { "aria-label": "\u641C\u7D22\u5F53\u524D\u76EE\u5F55", placeholder: "\u641C\u7D22\u5F53\u524D\u76EE\u5F55", value: query, onChange: (event) => setQuery(event.target.value) })
|
|
4061
|
+
] }),
|
|
4062
|
+
error && /* @__PURE__ */ jsx19("div", { className: "sia-choose-box__error", role: "alert", children: error }),
|
|
4063
|
+
/* @__PURE__ */ jsxs18("div", { className: "sia-choose-box__body", children: [
|
|
4064
|
+
/* @__PURE__ */ jsx19("aside", { className: "sia-choose-box__tree", "aria-label": "\u76EE\u5F55\u6811", children: /* @__PURE__ */ jsx19(
|
|
4065
|
+
Tree,
|
|
4066
|
+
{
|
|
4067
|
+
treeData: treeNodes(roots),
|
|
4068
|
+
showIcon: true,
|
|
4069
|
+
selectedKeys: current ? [current.id] : [],
|
|
4070
|
+
loadData: async (node) => {
|
|
4071
|
+
const token = session.current;
|
|
4072
|
+
try {
|
|
4073
|
+
await read(allEntries.get(String(node.key)), token);
|
|
4074
|
+
} catch (reason) {
|
|
4075
|
+
if (token === session.current) report(reason);
|
|
4076
|
+
throw reason;
|
|
4077
|
+
}
|
|
4078
|
+
},
|
|
4079
|
+
onSelect: (_, info) => {
|
|
4080
|
+
const entry = allEntries.get(String(info.node.key));
|
|
4081
|
+
if (entry) navigate(entry);
|
|
4082
|
+
}
|
|
4083
|
+
}
|
|
4084
|
+
) }),
|
|
4085
|
+
/* @__PURE__ */ jsxs18("section", { className: "sia-choose-box__content", "aria-label": "\u76EE\u5F55\u5185\u5BB9", "aria-busy": busy, children: [
|
|
4086
|
+
/* @__PURE__ */ jsxs18("div", { className: "sia-choose-box__selection-tools", children: [
|
|
4087
|
+
multiple && /* @__PURE__ */ jsx19(Checkbox, { checked: allChecked, disabled: busy || !selectable.length, onChange: (checked) => setDraft((previous) => checked ? [...new Map([...previous, ...selectable].map((entry) => [entry.id, entry])).values()] : previous.filter((entry) => !selectable.some((item) => item.id === entry.id))), children: "\u5168\u9009\u5F53\u524D\u5217\u8868" }),
|
|
4088
|
+
kind === "directory" && /* @__PURE__ */ jsx19(Button, { size: "small", disabled: !current || busy, onClick: () => current && toggle(current), children: "\u9009\u62E9\u5F53\u524D\u6587\u4EF6\u5939" })
|
|
4089
|
+
] }),
|
|
4090
|
+
busy ? /* @__PURE__ */ jsx19("p", { className: "sia-choose-box__empty", role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u76EE\u5F55\u2026" }) : !roots.length ? /* @__PURE__ */ jsx19("p", { className: "sia-choose-box__empty", children: source.authorize ? "\u8BF7\u6DFB\u52A0\u6388\u6743\u76EE\u5F55\u540E\u5F00\u59CB\u9009\u62E9" : "\u6682\u65E0\u53EF\u7528\u76EE\u5F55" }) : !visible.length ? /* @__PURE__ */ jsx19("p", { className: "sia-choose-box__empty", children: query ? "\u6CA1\u6709\u5339\u914D\u9879" : "\u6B64\u6587\u4EF6\u5939\u4E3A\u7A7A" }) : /* @__PURE__ */ jsx19("div", { className: `sia-choose-box__entries sia-choose-box__entries--${view}`, children: visible.map((entry) => /* @__PURE__ */ jsxs18("div", { className: `sia-choose-box__entry${chosen.some((item) => item.id === entry.id) ? " is-selected" : ""}`, children: [
|
|
4091
|
+
multiple && allowed(entry) && /* @__PURE__ */ jsx19(Checkbox, { "aria-label": `\u9009\u62E9 ${entry.name}`, checked: chosen.some((item) => item.id === entry.id), onChange: () => toggle(entry) }),
|
|
4092
|
+
/* @__PURE__ */ jsxs18(
|
|
4093
|
+
Button,
|
|
4094
|
+
{
|
|
4095
|
+
variant: "text",
|
|
4096
|
+
className: "sia-choose-box__item",
|
|
4097
|
+
title: entry.name,
|
|
4098
|
+
"aria-label": entry.name,
|
|
4099
|
+
"aria-pressed": chosen.some((item) => item.id === entry.id),
|
|
4100
|
+
disabled: entry.kind === "file" && !allowed(entry),
|
|
4101
|
+
onClick: () => entry.kind === "directory" && kind === "file" ? navigate(entry) : toggle(entry),
|
|
4102
|
+
onDoubleClick: () => {
|
|
4103
|
+
if (entry.kind === "directory") navigate(entry);
|
|
4104
|
+
},
|
|
4105
|
+
children: [
|
|
4106
|
+
/* @__PURE__ */ jsx19(Icon, { className: entry.kind === "directory" ? "is-directory" : "", name: entry.kind === "directory" ? "folder" : "file", size: view === "grid" ? 38 : 20 }),
|
|
4107
|
+
/* @__PURE__ */ jsx19("span", { children: entry.name })
|
|
4108
|
+
]
|
|
4109
|
+
}
|
|
4110
|
+
),
|
|
4111
|
+
entry.kind === "directory" && kind === "directory" && /* @__PURE__ */ jsx19(Button, { size: "small", variant: "link", "aria-label": `\u6253\u5F00 ${entry.name}`, onClick: () => navigate(entry), children: "\u6253\u5F00" })
|
|
4112
|
+
] }, entry.id)) })
|
|
4113
|
+
] })
|
|
4114
|
+
] }),
|
|
4115
|
+
/* @__PURE__ */ jsxs18("div", { className: "sia-choose-box__bottom", children: [
|
|
4116
|
+
/* @__PURE__ */ jsx19("span", { title: chosen.map((entry) => entry.path).join("\uFF1B"), children: chosen.length ? chosen.map((entry) => entry.name).join("\uFF1B") : "\u5C1A\u672A\u9009\u62E9" }),
|
|
4117
|
+
kind === "file" && extensions.length > 0 && /* @__PURE__ */ jsx19(
|
|
4118
|
+
Select,
|
|
4119
|
+
{
|
|
4120
|
+
"aria-label": "\u6587\u4EF6\u7C7B\u578B",
|
|
4121
|
+
allowClear: false,
|
|
4122
|
+
value: filter,
|
|
4123
|
+
onChange: (value2) => setFilter(String(value2)),
|
|
4124
|
+
options: [{ value: "accepted", label: `\u5141\u8BB8\u7684\u6587\u4EF6 (${accept})` }, { value: "all", label: "\u663E\u793A\u5168\u90E8\u6587\u4EF6" }]
|
|
4125
|
+
}
|
|
4126
|
+
),
|
|
4127
|
+
chosen.length > 0 && /* @__PURE__ */ jsx19(Button, { size: "small", onClick: () => setDraft([]), children: "\u6E05\u7A7A\u5DF2\u9009" })
|
|
4128
|
+
] })
|
|
4129
|
+
]
|
|
4130
|
+
}
|
|
4131
|
+
)
|
|
4132
|
+
] });
|
|
4133
|
+
}
|
|
4134
|
+
|
|
3777
4135
|
// src/components/Editor.tsx
|
|
3778
|
-
import { useEffect as
|
|
4136
|
+
import { useEffect as useEffect11, useId as useId6, useRef as useRef16, useState as useState16 } from "react";
|
|
3779
4137
|
import EditorWorker from "monaco-editor/editor/editor.worker.js?worker";
|
|
3780
4138
|
|
|
3781
4139
|
// src/components/jsonLanguage.ts
|
|
@@ -4356,7 +4714,7 @@ function registerSqlLanguages(monaco) {
|
|
|
4356
4714
|
}
|
|
4357
4715
|
|
|
4358
4716
|
// src/components/Editor.tsx
|
|
4359
|
-
import { jsx as
|
|
4717
|
+
import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4360
4718
|
var EDITOR_COMMAND_SHORTCUTS = {
|
|
4361
4719
|
cut: "Ctrl+X",
|
|
4362
4720
|
copy: "Ctrl+C",
|
|
@@ -4451,29 +4809,29 @@ function Editor({
|
|
|
4451
4809
|
loadingText = "\u6B63\u5728\u52A0\u8F7D\u7F16\u8F91\u5668\u2026"
|
|
4452
4810
|
}) {
|
|
4453
4811
|
const generatedId = useId6();
|
|
4454
|
-
const containerRef =
|
|
4455
|
-
const rangeHighlightRef =
|
|
4456
|
-
const editorRef =
|
|
4457
|
-
const modelRef =
|
|
4458
|
-
const apiRef =
|
|
4459
|
-
const applyingControlledValueRef =
|
|
4460
|
-
const updateHighlightRef =
|
|
4461
|
-
const changeHandlerRef =
|
|
4462
|
-
const readyHandlerRef =
|
|
4463
|
-
const selectionHandlerRef =
|
|
4464
|
-
const keyDownHandlerRef =
|
|
4465
|
-
const highlightRangeRef =
|
|
4466
|
-
const markersRef =
|
|
4467
|
-
const contextMenuItemsRef =
|
|
4468
|
-
const completionProviderRef =
|
|
4469
|
-
const refreshSuggestionOnSpaceRef =
|
|
4470
|
-
const initialValueRef =
|
|
4471
|
-
const initialLanguageRef =
|
|
4472
|
-
const initialPathRef =
|
|
4473
|
-
const initialThemeRef =
|
|
4474
|
-
const initialOptionsRef =
|
|
4475
|
-
const [loading, setLoading] =
|
|
4476
|
-
const [, setSelectionVersion] =
|
|
4812
|
+
const containerRef = useRef16(null);
|
|
4813
|
+
const rangeHighlightRef = useRef16(null);
|
|
4814
|
+
const editorRef = useRef16(null);
|
|
4815
|
+
const modelRef = useRef16(null);
|
|
4816
|
+
const apiRef = useRef16(null);
|
|
4817
|
+
const applyingControlledValueRef = useRef16(false);
|
|
4818
|
+
const updateHighlightRef = useRef16(() => void 0);
|
|
4819
|
+
const changeHandlerRef = useRef16(onChange);
|
|
4820
|
+
const readyHandlerRef = useRef16(onReady);
|
|
4821
|
+
const selectionHandlerRef = useRef16(onSelectionChange);
|
|
4822
|
+
const keyDownHandlerRef = useRef16(onKeyDown);
|
|
4823
|
+
const highlightRangeRef = useRef16(highlightRange);
|
|
4824
|
+
const markersRef = useRef16(markers);
|
|
4825
|
+
const contextMenuItemsRef = useRef16(contextMenuItems);
|
|
4826
|
+
const completionProviderRef = useRef16(completionProvider);
|
|
4827
|
+
const refreshSuggestionOnSpaceRef = useRef16(refreshSuggestionOnSpace);
|
|
4828
|
+
const initialValueRef = useRef16(value);
|
|
4829
|
+
const initialLanguageRef = useRef16(language);
|
|
4830
|
+
const initialPathRef = useRef16(path);
|
|
4831
|
+
const initialThemeRef = useRef16(theme);
|
|
4832
|
+
const initialOptionsRef = useRef16(options);
|
|
4833
|
+
const [loading, setLoading] = useState16(true);
|
|
4834
|
+
const [, setSelectionVersion] = useState16(0);
|
|
4477
4835
|
initialValueRef.current = value;
|
|
4478
4836
|
initialLanguageRef.current = language;
|
|
4479
4837
|
initialPathRef.current = path;
|
|
@@ -4488,7 +4846,7 @@ function Editor({
|
|
|
4488
4846
|
contextMenuItemsRef.current = contextMenuItems;
|
|
4489
4847
|
completionProviderRef.current = completionProvider;
|
|
4490
4848
|
refreshSuggestionOnSpaceRef.current = refreshSuggestionOnSpace;
|
|
4491
|
-
|
|
4849
|
+
useEffect11(() => {
|
|
4492
4850
|
let disposed = false;
|
|
4493
4851
|
const subscriptions = [];
|
|
4494
4852
|
async function mountEditor() {
|
|
@@ -4832,7 +5190,7 @@ function Editor({
|
|
|
4832
5190
|
updateHighlightRef.current = () => void 0;
|
|
4833
5191
|
};
|
|
4834
5192
|
}, [generatedId]);
|
|
4835
|
-
|
|
5193
|
+
useEffect11(() => {
|
|
4836
5194
|
const model = modelRef.current;
|
|
4837
5195
|
if (!model || model.getValue() === value) return;
|
|
4838
5196
|
applyingControlledValueRef.current = true;
|
|
@@ -4842,7 +5200,7 @@ function Editor({
|
|
|
4842
5200
|
applyingControlledValueRef.current = false;
|
|
4843
5201
|
}
|
|
4844
5202
|
}, [loading, value]);
|
|
4845
|
-
|
|
5203
|
+
useEffect11(() => {
|
|
4846
5204
|
if (loading) return;
|
|
4847
5205
|
void loadMonaco().then((monaco) => {
|
|
4848
5206
|
const model = modelRef.current;
|
|
@@ -4851,7 +5209,7 @@ function Editor({
|
|
|
4851
5209
|
}, [language, loading]);
|
|
4852
5210
|
const completionEnabled = Boolean(completionProvider);
|
|
4853
5211
|
const completionTriggerKey = completionTriggerCharacters.join("\0");
|
|
4854
|
-
|
|
5212
|
+
useEffect11(() => {
|
|
4855
5213
|
if (loading || !completionEnabled) return void 0;
|
|
4856
5214
|
let disposed = false;
|
|
4857
5215
|
let subscription;
|
|
@@ -4925,23 +5283,23 @@ function Editor({
|
|
|
4925
5283
|
subscription?.dispose();
|
|
4926
5284
|
};
|
|
4927
5285
|
}, [completionEnabled, completionTriggerKey, language, loading]);
|
|
4928
|
-
|
|
5286
|
+
useEffect11(() => {
|
|
4929
5287
|
if (loading) return;
|
|
4930
5288
|
void loadMonaco().then((monaco) => {
|
|
4931
5289
|
if (editorRef.current) monaco.editor.setTheme(theme === "dark" ? "vs-dark" : "vs");
|
|
4932
5290
|
});
|
|
4933
5291
|
}, [loading, theme]);
|
|
4934
|
-
|
|
5292
|
+
useEffect11(() => {
|
|
4935
5293
|
if (loading) return;
|
|
4936
5294
|
editorRef.current?.updateOptions({
|
|
4937
5295
|
...options ?? {},
|
|
4938
5296
|
contextmenu: contextMenuItems.length === 0 ? options?.contextmenu ?? true : false
|
|
4939
5297
|
});
|
|
4940
5298
|
}, [contextMenuItems.length, loading, options]);
|
|
4941
|
-
|
|
5299
|
+
useEffect11(() => {
|
|
4942
5300
|
updateHighlightRef.current();
|
|
4943
5301
|
}, [highlightRange]);
|
|
4944
|
-
|
|
5302
|
+
useEffect11(() => {
|
|
4945
5303
|
if (loading) return;
|
|
4946
5304
|
void loadMonaco().then((monaco) => {
|
|
4947
5305
|
const model = modelRef.current;
|
|
@@ -4959,11 +5317,11 @@ function Editor({
|
|
|
4959
5317
|
})));
|
|
4960
5318
|
});
|
|
4961
5319
|
}, [generatedId, loading, markers]);
|
|
4962
|
-
const editorNode = /* @__PURE__ */
|
|
4963
|
-
/* @__PURE__ */
|
|
4964
|
-
/* @__PURE__ */
|
|
4965
|
-
loading ? /* @__PURE__ */
|
|
4966
|
-
/* @__PURE__ */
|
|
5320
|
+
const editorNode = /* @__PURE__ */ jsxs19("div", { className: `sia-editor-control ${className}`.trim(), "data-loading": loading || void 0, children: [
|
|
5321
|
+
/* @__PURE__ */ jsx20("div", { className: "sia-editor-control__surface", ref: containerRef, "aria-label": ariaLabel }),
|
|
5322
|
+
/* @__PURE__ */ jsx20("div", { ref: rangeHighlightRef, className: "sia-editor-control__range-highlight", "aria-hidden": "true" }),
|
|
5323
|
+
loading ? /* @__PURE__ */ jsxs19("div", { className: "sia-editor-control__loading", role: "status", children: [
|
|
5324
|
+
/* @__PURE__ */ jsx20("span", {}),
|
|
4967
5325
|
loadingText
|
|
4968
5326
|
] }) : null
|
|
4969
5327
|
] });
|
|
@@ -4992,7 +5350,7 @@ function Editor({
|
|
|
4992
5350
|
item.onClick?.(api);
|
|
4993
5351
|
}
|
|
4994
5352
|
}
|
|
4995
|
-
return /* @__PURE__ */
|
|
5353
|
+
return /* @__PURE__ */ jsx20(
|
|
4996
5354
|
Dropdown,
|
|
4997
5355
|
{
|
|
4998
5356
|
className: "sia-editor-control__context-menu",
|
|
@@ -5009,19 +5367,19 @@ function Editor({
|
|
|
5009
5367
|
}
|
|
5010
5368
|
|
|
5011
5369
|
// src/components/Markdown.tsx
|
|
5012
|
-
import { useEffect as
|
|
5370
|
+
import { useEffect as useEffect12, useMemo as useMemo8, useRef as useRef17, useState as useState17 } from "react";
|
|
5013
5371
|
import DOMPurify from "dompurify";
|
|
5014
5372
|
import { marked } from "marked";
|
|
5015
|
-
import { Fragment as Fragment6, jsx as
|
|
5373
|
+
import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5016
5374
|
function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", resolveImageSrc, imagePreview = true, className = "", onClick, onKeyDown, ...props }) {
|
|
5017
|
-
const rootRef =
|
|
5018
|
-
const [previewImage, setPreviewImage] =
|
|
5019
|
-
const html =
|
|
5375
|
+
const rootRef = useRef17(null);
|
|
5376
|
+
const [previewImage, setPreviewImage] = useState17(null);
|
|
5377
|
+
const html = useMemo8(() => {
|
|
5020
5378
|
const rendered = marked.parse(content, { breaks: true, gfm: true });
|
|
5021
5379
|
const sanitized = DOMPurify.sanitize(rendered, { USE_PROFILES: { html: true } });
|
|
5022
5380
|
return sanitized.replace(/<img\b/giu, '<img loading="lazy" decoding="async" referrerpolicy="no-referrer"');
|
|
5023
5381
|
}, [content]);
|
|
5024
|
-
|
|
5382
|
+
useEffect12(() => {
|
|
5025
5383
|
const root = rootRef.current;
|
|
5026
5384
|
if (!root) return void 0;
|
|
5027
5385
|
let cancelled = false;
|
|
@@ -5078,19 +5436,19 @@ function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", r
|
|
|
5078
5436
|
onKeyDown?.(event);
|
|
5079
5437
|
}
|
|
5080
5438
|
if (!content.trim()) {
|
|
5081
|
-
return /* @__PURE__ */
|
|
5439
|
+
return /* @__PURE__ */ jsx21("div", { className: `sia-markdown sia-markdown--empty ${className}`.trim(), children: emptyText });
|
|
5082
5440
|
}
|
|
5083
|
-
return /* @__PURE__ */
|
|
5084
|
-
/* @__PURE__ */
|
|
5085
|
-
/* @__PURE__ */
|
|
5441
|
+
return /* @__PURE__ */ jsxs20(Fragment6, { children: [
|
|
5442
|
+
/* @__PURE__ */ jsx21("article", { ...withTitleTooltip(props), ref: rootRef, className: `sia-markdown ${className}`.trim(), onClick: handleClick, onKeyDown: handleKeyDown, dangerouslySetInnerHTML: { __html: html } }),
|
|
5443
|
+
/* @__PURE__ */ jsx21(ImagePreview, { open: Boolean(previewImage), src: previewImage?.src, alt: previewImage?.alt, onOpenChange: (open) => {
|
|
5086
5444
|
if (!open) setPreviewImage(null);
|
|
5087
5445
|
} })
|
|
5088
5446
|
] });
|
|
5089
5447
|
}
|
|
5090
5448
|
|
|
5091
5449
|
// src/components/InputNumber.tsx
|
|
5092
|
-
import { forwardRef as forwardRef5, useEffect as
|
|
5093
|
-
import { jsx as
|
|
5450
|
+
import { forwardRef as forwardRef5, useEffect as useEffect13, useId as useId7, useRef as useRef18, useState as useState18 } from "react";
|
|
5451
|
+
import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5094
5452
|
function formatValue(value, precision) {
|
|
5095
5453
|
if (value === null || !Number.isFinite(value)) return "";
|
|
5096
5454
|
return precision === void 0 ? String(value) : value.toFixed(precision);
|
|
@@ -5123,14 +5481,14 @@ var InputNumber = forwardRef5(function InputNumber2({
|
|
|
5123
5481
|
const size = useControlSize(sizeProp);
|
|
5124
5482
|
const fallbackId = useId7();
|
|
5125
5483
|
const inputId = id ?? fallbackId;
|
|
5126
|
-
const localRef =
|
|
5484
|
+
const localRef = useRef18(null);
|
|
5127
5485
|
const [currentValue, setCurrentValue] = useControllableState({ value, defaultValue, onChange });
|
|
5128
5486
|
const displayValue = (next) => {
|
|
5129
5487
|
const plain = formatValue(next, precision);
|
|
5130
5488
|
return plain && formatter ? formatter(plain) : plain;
|
|
5131
5489
|
};
|
|
5132
|
-
const [text, setText] =
|
|
5133
|
-
|
|
5490
|
+
const [text, setText] = useState18(() => displayValue(currentValue));
|
|
5491
|
+
useEffect13(() => {
|
|
5134
5492
|
setText(displayValue(currentValue));
|
|
5135
5493
|
}, [currentValue, precision, formatter]);
|
|
5136
5494
|
function setRef(node) {
|
|
@@ -5199,7 +5557,7 @@ var InputNumber = forwardRef5(function InputNumber2({
|
|
|
5199
5557
|
const increaseDisabled = disabled || readOnly || max !== void 0 && currentValue !== null && currentValue >= max;
|
|
5200
5558
|
const decreaseDisabled = disabled || readOnly || min !== void 0 && currentValue !== null && currentValue <= min;
|
|
5201
5559
|
const floatingPlaceholder = usePlaceholderMode(placeholderMode) === "floating" && Boolean(placeholder);
|
|
5202
|
-
const input = /* @__PURE__ */
|
|
5560
|
+
const input = /* @__PURE__ */ jsx22(
|
|
5203
5561
|
"input",
|
|
5204
5562
|
{
|
|
5205
5563
|
...withTitleTooltip(props),
|
|
@@ -5221,26 +5579,26 @@ var InputNumber = forwardRef5(function InputNumber2({
|
|
|
5221
5579
|
onKeyDown: handleKeyDown
|
|
5222
5580
|
}
|
|
5223
5581
|
);
|
|
5224
|
-
return /* @__PURE__ */
|
|
5225
|
-
prefix ? /* @__PURE__ */
|
|
5226
|
-
floatingPlaceholder ? /* @__PURE__ */
|
|
5582
|
+
return /* @__PURE__ */ jsxs21("span", { className: `sia-input-number sia-input-number--${size} sia-input-number--${status}${floatingPlaceholder ? " sia-input-number--floating" : ""}${floatingPlaceholder && text.length > 0 ? " is-filled" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
5583
|
+
prefix ? /* @__PURE__ */ jsx22("span", { className: "sia-input-number__affix", children: prefix }) : null,
|
|
5584
|
+
floatingPlaceholder ? /* @__PURE__ */ jsxs21("span", { className: "sia-input-number__input-wrap", children: [
|
|
5227
5585
|
input,
|
|
5228
|
-
/* @__PURE__ */
|
|
5586
|
+
/* @__PURE__ */ jsx22("span", { className: "sia-input-number__floating-placeholder", "aria-hidden": "true", children: placeholder })
|
|
5229
5587
|
] }) : input,
|
|
5230
|
-
suffix ? /* @__PURE__ */
|
|
5231
|
-
controls ? /* @__PURE__ */
|
|
5232
|
-
/* @__PURE__ */
|
|
5233
|
-
/* @__PURE__ */
|
|
5588
|
+
suffix ? /* @__PURE__ */ jsx22("span", { className: "sia-input-number__affix", children: suffix }) : null,
|
|
5589
|
+
controls ? /* @__PURE__ */ jsxs21("span", { className: "sia-input-number__controls", children: [
|
|
5590
|
+
/* @__PURE__ */ jsx22("button", { type: "button", tabIndex: -1, "aria-label": "\u589E\u52A0\u6570\u503C", disabled: increaseDisabled, onClick: () => changeBy(1), children: /* @__PURE__ */ jsx22(Icon, { name: "chevron-up", size: 12 }) }),
|
|
5591
|
+
/* @__PURE__ */ jsx22("button", { type: "button", tabIndex: -1, "aria-label": "\u51CF\u5C11\u6570\u503C", disabled: decreaseDisabled, onClick: () => changeBy(-1), children: /* @__PURE__ */ jsx22(Icon, { name: "chevron-down", size: 12 }) })
|
|
5234
5592
|
] }) : null
|
|
5235
5593
|
] });
|
|
5236
5594
|
});
|
|
5237
5595
|
|
|
5238
5596
|
// src/components/SelectModal.tsx
|
|
5239
|
-
import { useState as
|
|
5240
|
-
import { Fragment as Fragment7, jsx as
|
|
5597
|
+
import { useState as useState19 } from "react";
|
|
5598
|
+
import { Fragment as Fragment7, jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5241
5599
|
function SelectModalBody({ config, values, disabled, onChange }) {
|
|
5242
|
-
const [query, setQuery] =
|
|
5243
|
-
const [selectedOnly, setSelectedOnly] =
|
|
5600
|
+
const [query, setQuery] = useState19("");
|
|
5601
|
+
const [selectedOnly, setSelectedOnly] = useState19(false);
|
|
5244
5602
|
const multiple = config.mode === "multiple";
|
|
5245
5603
|
const search = query.trim();
|
|
5246
5604
|
const filtered = config.options.filter((option) => !search || (config.filterOption ? config.filterOption(search, option) : [option.label, option.value].some((text) => String(text ?? "").toLowerCase().includes(search.toLowerCase()))));
|
|
@@ -5254,23 +5612,23 @@ function SelectModalBody({ config, values, disabled, onChange }) {
|
|
|
5254
5612
|
});
|
|
5255
5613
|
onChange([...next]);
|
|
5256
5614
|
};
|
|
5257
|
-
return /* @__PURE__ */
|
|
5258
|
-
config.headerExtra != null && config.headerExtra !== false ? /* @__PURE__ */
|
|
5259
|
-
/* @__PURE__ */
|
|
5260
|
-
/* @__PURE__ */
|
|
5261
|
-
/* @__PURE__ */
|
|
5262
|
-
/* @__PURE__ */
|
|
5615
|
+
return /* @__PURE__ */ jsxs22(Fragment7, { children: [
|
|
5616
|
+
config.headerExtra != null && config.headerExtra !== false ? /* @__PURE__ */ jsx23("div", { className: "sia-select-modal__header-extra", children: config.headerExtra }) : null,
|
|
5617
|
+
/* @__PURE__ */ jsxs22("div", { className: "sia-select-modal__heading", children: [
|
|
5618
|
+
/* @__PURE__ */ jsxs22("div", { role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
5619
|
+
/* @__PURE__ */ jsx23(Button, { role: "tab", "aria-selected": !selectedOnly, variant: "link", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
5620
|
+
/* @__PURE__ */ jsxs22(Button, { role: "tab", "aria-selected": selectedOnly, variant: "link", onClick: () => setSelectedOnly(true), children: [
|
|
5263
5621
|
"\u5DF2\u9009\u9879(",
|
|
5264
5622
|
values.length,
|
|
5265
5623
|
")"
|
|
5266
5624
|
] })
|
|
5267
5625
|
] }),
|
|
5268
|
-
/* @__PURE__ */
|
|
5626
|
+
/* @__PURE__ */ jsx23(
|
|
5269
5627
|
Input,
|
|
5270
5628
|
{
|
|
5271
5629
|
"aria-label": config.searchPlaceholder ?? "\u641C\u7D22\u9009\u9879",
|
|
5272
5630
|
placeholder: config.searchPlaceholder ?? "\u641C\u7D22\u9009\u9879",
|
|
5273
|
-
prefix: /* @__PURE__ */
|
|
5631
|
+
prefix: /* @__PURE__ */ jsx23(Icon, { name: "search", size: 14 }),
|
|
5274
5632
|
value: query,
|
|
5275
5633
|
allowClear: true,
|
|
5276
5634
|
disabled,
|
|
@@ -5281,8 +5639,8 @@ function SelectModalBody({ config, values, disabled, onChange }) {
|
|
|
5281
5639
|
}
|
|
5282
5640
|
)
|
|
5283
5641
|
] }),
|
|
5284
|
-
multiple ? /* @__PURE__ */
|
|
5285
|
-
/* @__PURE__ */
|
|
5642
|
+
multiple ? /* @__PURE__ */ jsxs22("div", { className: "sia-select-modal__actions", children: [
|
|
5643
|
+
/* @__PURE__ */ jsx23(
|
|
5286
5644
|
Checkbox,
|
|
5287
5645
|
{
|
|
5288
5646
|
checked: all,
|
|
@@ -5292,10 +5650,10 @@ function SelectModalBody({ config, values, disabled, onChange }) {
|
|
|
5292
5650
|
children: "\u5168\u9009"
|
|
5293
5651
|
}
|
|
5294
5652
|
),
|
|
5295
|
-
/* @__PURE__ */
|
|
5296
|
-
/* @__PURE__ */
|
|
5653
|
+
/* @__PURE__ */ jsx23(Button, { variant: "link", size: "small", disabled: disabled || !enabled.length, onClick: () => batch("invert"), children: "\u53CD\u9009" }),
|
|
5654
|
+
/* @__PURE__ */ jsx23(Button, { variant: "link", size: "small", danger: true, disabled: disabled || !values.length, onClick: () => onChange([]), children: "\u6E05\u7A7A" })
|
|
5297
5655
|
] }) : null,
|
|
5298
|
-
/* @__PURE__ */
|
|
5656
|
+
/* @__PURE__ */ jsx23(
|
|
5299
5657
|
SelectionPanel,
|
|
5300
5658
|
{
|
|
5301
5659
|
options: filtered,
|
|
@@ -5322,7 +5680,7 @@ function openSelectModal(config) {
|
|
|
5322
5680
|
if (config.mode !== "multiple") values = values.slice(0, 1);
|
|
5323
5681
|
let submitting = false;
|
|
5324
5682
|
function body() {
|
|
5325
|
-
return /* @__PURE__ */
|
|
5683
|
+
return /* @__PURE__ */ jsx23(SelectModalBody, { config: current, values, disabled: submitting || Boolean(current.confirmLoading), onChange: (next) => {
|
|
5326
5684
|
values = next;
|
|
5327
5685
|
handle.update({ children: body() });
|
|
5328
5686
|
} });
|
|
@@ -5365,8 +5723,8 @@ function openSelectModal(config) {
|
|
|
5365
5723
|
}
|
|
5366
5724
|
|
|
5367
5725
|
// src/components/Treemap.tsx
|
|
5368
|
-
import { useEffect as
|
|
5369
|
-
import { jsx as
|
|
5726
|
+
import { useEffect as useEffect14, useMemo as useMemo9, useRef as useRef19, useState as useState20 } from "react";
|
|
5727
|
+
import { jsx as jsx24, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5370
5728
|
import { createElement } from "react";
|
|
5371
5729
|
function positiveValue(value) {
|
|
5372
5730
|
return Number.isFinite(value) && value > 0 ? value : 1;
|
|
@@ -5738,19 +6096,19 @@ function Treemap({
|
|
|
5738
6096
|
style,
|
|
5739
6097
|
...props
|
|
5740
6098
|
}) {
|
|
5741
|
-
const containerRef =
|
|
5742
|
-
const [size, setSize] =
|
|
5743
|
-
const [internalExpandedKeys, setInternalExpandedKeys] =
|
|
5744
|
-
const [internalFocusedKey, setInternalFocusedKey] =
|
|
6099
|
+
const containerRef = useRef19(null);
|
|
6100
|
+
const [size, setSize] = useState20({ width: 0, height: 0 });
|
|
6101
|
+
const [internalExpandedKeys, setInternalExpandedKeys] = useState20(() => [...defaultExpandedKeys]);
|
|
6102
|
+
const [internalFocusedKey, setInternalFocusedKey] = useState20(defaultFocusedKey);
|
|
5745
6103
|
const currentExpandedKeys = expandedKeys ?? internalExpandedKeys;
|
|
5746
6104
|
const currentFocusedKey = focusedKey === void 0 ? internalFocusedKey : focusedKey;
|
|
5747
|
-
const expandedSet =
|
|
5748
|
-
const focusedNode =
|
|
6105
|
+
const expandedSet = useMemo9(() => new Set(currentExpandedKeys), [currentExpandedKeys]);
|
|
6106
|
+
const focusedNode = useMemo9(
|
|
5749
6107
|
() => currentFocusedKey ? findNode(data, currentFocusedKey) : null,
|
|
5750
6108
|
[currentFocusedKey, data]
|
|
5751
6109
|
);
|
|
5752
6110
|
const effectiveFocusedNode = focusedNode && expandedSet.has(focusedNode.key) && Boolean(focusedNode.children?.length) ? focusedNode : null;
|
|
5753
|
-
const positions =
|
|
6111
|
+
const positions = useMemo9(
|
|
5754
6112
|
() => collectPositions(
|
|
5755
6113
|
effectiveFocusedNode ? [effectiveFocusedNode] : data,
|
|
5756
6114
|
{ x: 0, y: 0, ...size },
|
|
@@ -5766,7 +6124,7 @@ function Treemap({
|
|
|
5766
6124
|
),
|
|
5767
6125
|
[activeKey, aggregateOverflow, data, effectiveFocusedNode, expandedSet, gap, headerHeight, maxVisibleNodes, minTileHeight, minTileWidth, overflowLabel, size]
|
|
5768
6126
|
);
|
|
5769
|
-
|
|
6127
|
+
useEffect14(() => {
|
|
5770
6128
|
const element = containerRef.current;
|
|
5771
6129
|
if (!element) return void 0;
|
|
5772
6130
|
const updateSize = () => {
|
|
@@ -5778,7 +6136,7 @@ function Treemap({
|
|
|
5778
6136
|
observer.observe(element);
|
|
5779
6137
|
return () => observer.disconnect();
|
|
5780
6138
|
}, []);
|
|
5781
|
-
|
|
6139
|
+
useEffect14(() => {
|
|
5782
6140
|
if (!currentFocusedKey || effectiveFocusedNode) return;
|
|
5783
6141
|
if (focusedKey === void 0) setInternalFocusedKey(null);
|
|
5784
6142
|
onFocusedChange?.(null);
|
|
@@ -5798,7 +6156,7 @@ function Treemap({
|
|
|
5798
6156
|
}
|
|
5799
6157
|
onNodeClick?.({ node, expanded: isExpanded, nativeEvent });
|
|
5800
6158
|
}
|
|
5801
|
-
return /* @__PURE__ */
|
|
6159
|
+
return /* @__PURE__ */ jsxs23(
|
|
5802
6160
|
"div",
|
|
5803
6161
|
{
|
|
5804
6162
|
...withTitleTooltip(props),
|
|
@@ -5807,7 +6165,7 @@ function Treemap({
|
|
|
5807
6165
|
style,
|
|
5808
6166
|
role: "tree",
|
|
5809
6167
|
children: [
|
|
5810
|
-
data.length === 0 ? /* @__PURE__ */
|
|
6168
|
+
data.length === 0 ? /* @__PURE__ */ jsx24("div", { className: "sia-treemap__empty", children: emptyContent }) : null,
|
|
5811
6169
|
positions.map(({ node, rectangle, depth, expanded }) => {
|
|
5812
6170
|
const active = node.key === activeKey || Boolean(node.__active);
|
|
5813
6171
|
const fontSize = tileFontSize(rectangle);
|
|
@@ -5837,8 +6195,8 @@ function Treemap({
|
|
|
5837
6195
|
"data-treemap-key": node.key,
|
|
5838
6196
|
key: node.key
|
|
5839
6197
|
},
|
|
5840
|
-
/* @__PURE__ */
|
|
5841
|
-
/* @__PURE__ */
|
|
6198
|
+
/* @__PURE__ */ jsxs23("div", { className: "sia-treemap__header", children: [
|
|
6199
|
+
/* @__PURE__ */ jsxs23(
|
|
5842
6200
|
"button",
|
|
5843
6201
|
{
|
|
5844
6202
|
type: "button",
|
|
@@ -5846,12 +6204,12 @@ function Treemap({
|
|
|
5846
6204
|
disabled: node.disabled,
|
|
5847
6205
|
onClick: (event) => handleNodeClick(node, event),
|
|
5848
6206
|
children: [
|
|
5849
|
-
/* @__PURE__ */
|
|
5850
|
-
showValue ? /* @__PURE__ */
|
|
6207
|
+
/* @__PURE__ */ jsx24("span", { className: "sia-treemap__label", children: node.label }),
|
|
6208
|
+
showValue ? /* @__PURE__ */ jsx24("span", { className: "sia-treemap__value", children: valueFormatter(node.value, node) }) : null
|
|
5851
6209
|
]
|
|
5852
6210
|
}
|
|
5853
6211
|
),
|
|
5854
|
-
/* @__PURE__ */
|
|
6212
|
+
/* @__PURE__ */ jsx24(
|
|
5855
6213
|
"button",
|
|
5856
6214
|
{
|
|
5857
6215
|
type: "button",
|
|
@@ -5859,7 +6217,7 @@ function Treemap({
|
|
|
5859
6217
|
"aria-label": effectiveFocusedNode?.key === node.key ? `\u8FD8\u539F ${node.label}` : `\u805A\u7126\u5C55\u5F00 ${node.label}`,
|
|
5860
6218
|
...withTitleTooltip({ title: effectiveFocusedNode?.key === node.key ? "\u8FD8\u539F\u539F\u6709\u89C6\u56FE" : "\u5C55\u5F00\u5230\u6574\u4E2A\u533A\u57DF" }),
|
|
5861
6219
|
onClick: () => updateFocusedKey(effectiveFocusedNode?.key === node.key ? null : node.key),
|
|
5862
|
-
children: /* @__PURE__ */
|
|
6220
|
+
children: /* @__PURE__ */ jsx24(Icon, { name: effectiveFocusedNode?.key === node.key ? "fullscreen-exit" : "fullscreen", size: 14 })
|
|
5863
6221
|
}
|
|
5864
6222
|
)
|
|
5865
6223
|
] })
|
|
@@ -5879,9 +6237,9 @@ function Treemap({
|
|
|
5879
6237
|
onClick: (event) => handleNodeClick(node, event),
|
|
5880
6238
|
key: node.key
|
|
5881
6239
|
},
|
|
5882
|
-
showLabel ? /* @__PURE__ */
|
|
5883
|
-
/* @__PURE__ */
|
|
5884
|
-
showValue ? /* @__PURE__ */
|
|
6240
|
+
showLabel ? /* @__PURE__ */ jsxs23("span", { className: "sia-treemap__content", children: [
|
|
6241
|
+
/* @__PURE__ */ jsx24("span", { className: "sia-treemap__label", children: node.label }),
|
|
6242
|
+
showValue ? /* @__PURE__ */ jsx24("span", { className: "sia-treemap__value", children: valueFormatter(node.value, node) }) : null
|
|
5885
6243
|
] }) : null
|
|
5886
6244
|
);
|
|
5887
6245
|
})
|
|
@@ -5891,8 +6249,8 @@ function Treemap({
|
|
|
5891
6249
|
}
|
|
5892
6250
|
|
|
5893
6251
|
// src/components/Table/TableCellContent.tsx
|
|
5894
|
-
import { useLayoutEffect as useLayoutEffect5, useRef as
|
|
5895
|
-
import { jsx as
|
|
6252
|
+
import { useLayoutEffect as useLayoutEffect5, useRef as useRef20, useState as useState21 } from "react";
|
|
6253
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
5896
6254
|
var pendingLayouts = /* @__PURE__ */ new Map();
|
|
5897
6255
|
var layoutFrame;
|
|
5898
6256
|
function scheduleLayout(element, task) {
|
|
@@ -5910,8 +6268,8 @@ function scheduleLayout(element, task) {
|
|
|
5910
6268
|
});
|
|
5911
6269
|
}
|
|
5912
6270
|
function TableCellContent({ children, ellipsis, title }) {
|
|
5913
|
-
const ref =
|
|
5914
|
-
const [overflowing, setOverflowing] =
|
|
6271
|
+
const ref = useRef20(null);
|
|
6272
|
+
const [overflowing, setOverflowing] = useState21(false);
|
|
5915
6273
|
const customContent = typeof children !== "string" && typeof children !== "number" && children != null;
|
|
5916
6274
|
useLayoutEffect5(() => {
|
|
5917
6275
|
const element = ref.current;
|
|
@@ -5945,13 +6303,13 @@ function TableCellContent({ children, ellipsis, title }) {
|
|
|
5945
6303
|
pendingLayouts.delete(element);
|
|
5946
6304
|
};
|
|
5947
6305
|
}, [children, ellipsis, customContent]);
|
|
5948
|
-
return /* @__PURE__ */
|
|
6306
|
+
return /* @__PURE__ */ jsx25("div", { ref, className: "sia-table__cell-content", "data-custom-content": customContent || void 0, "data-content-overflow": ellipsis && customContent && overflowing || void 0, children: title ? /* @__PURE__ */ jsx25(Tooltip, { title, className: "sia-table__cell-tooltip", children: /* @__PURE__ */ jsx25("span", { children }) }) : children });
|
|
5949
6307
|
}
|
|
5950
6308
|
|
|
5951
6309
|
// src/components/Table/useRemainingHeight.ts
|
|
5952
|
-
import { useLayoutEffect as useLayoutEffect6, useState as
|
|
6310
|
+
import { useLayoutEffect as useLayoutEffect6, useState as useState22 } from "react";
|
|
5953
6311
|
function useRemainingHeight(rootRef, options) {
|
|
5954
|
-
const [height, setHeight] =
|
|
6312
|
+
const [height, setHeight] = useState22();
|
|
5955
6313
|
const enabled = !!options;
|
|
5956
6314
|
const container = typeof options === "object" ? options.container : void 0;
|
|
5957
6315
|
const bottomOffset = typeof options === "object" ? options.bottomOffset ?? 0 : 0;
|
|
@@ -6027,7 +6385,7 @@ function useRemainingHeight(rootRef, options) {
|
|
|
6027
6385
|
}
|
|
6028
6386
|
|
|
6029
6387
|
// src/components/Table/TableCanvasLayer.tsx
|
|
6030
|
-
import { useLayoutEffect as useLayoutEffect7, useRef as
|
|
6388
|
+
import { useLayoutEffect as useLayoutEffect7, useRef as useRef21 } from "react";
|
|
6031
6389
|
|
|
6032
6390
|
// src/components/Table/utils.ts
|
|
6033
6391
|
var AUTO_WIDTH_COLUMN_KEYS = /* @__PURE__ */ new Set(["action", "actions", "operation", "operations"]);
|
|
@@ -6080,9 +6438,9 @@ function toTablePageParams(current, pageSize) {
|
|
|
6080
6438
|
}
|
|
6081
6439
|
|
|
6082
6440
|
// src/components/Table/TableCanvasLayer.tsx
|
|
6083
|
-
import { jsx as
|
|
6441
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
6084
6442
|
function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHeight }) {
|
|
6085
|
-
const canvasRef =
|
|
6443
|
+
const canvasRef = useRef21(null);
|
|
6086
6444
|
useLayoutEffect7(() => {
|
|
6087
6445
|
const canvas = canvasRef.current;
|
|
6088
6446
|
const scroller = viewport.current;
|
|
@@ -6206,7 +6564,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
6206
6564
|
window.removeEventListener("resize", schedule);
|
|
6207
6565
|
};
|
|
6208
6566
|
}, [viewport, rows, columns, widths, rowHeight, headerHeight]);
|
|
6209
|
-
return /* @__PURE__ */
|
|
6567
|
+
return /* @__PURE__ */ jsx26("canvas", { ref: canvasRef, "aria-hidden": "true", className: "sia-table__canvas-layer" });
|
|
6210
6568
|
}
|
|
6211
6569
|
|
|
6212
6570
|
// src/components/Table/rowIdentity.ts
|
|
@@ -6225,6 +6583,101 @@ function createRowIdentity() {
|
|
|
6225
6583
|
};
|
|
6226
6584
|
}
|
|
6227
6585
|
|
|
6586
|
+
// src/components/Table/rowHeights.ts
|
|
6587
|
+
function createRowHeightLayout(rows, baseHeight, heights, minimumHeight = 1) {
|
|
6588
|
+
const offsets = [0];
|
|
6589
|
+
const sizes = rows.map((row) => {
|
|
6590
|
+
const configured = heights[String(row.key)];
|
|
6591
|
+
const size = Number.isFinite(configured) && configured > 0 ? Math.max(minimumHeight, configured) : baseHeight;
|
|
6592
|
+
offsets.push(offsets[offsets.length - 1] + size);
|
|
6593
|
+
return size;
|
|
6594
|
+
});
|
|
6595
|
+
const indexAt = (position) => {
|
|
6596
|
+
let low = 0, high = sizes.length;
|
|
6597
|
+
while (low < high) {
|
|
6598
|
+
const middle = Math.floor((low + high) / 2);
|
|
6599
|
+
if (offsets[middle + 1] <= position) low = middle + 1;
|
|
6600
|
+
else high = middle;
|
|
6601
|
+
}
|
|
6602
|
+
return Math.min(low, Math.max(0, sizes.length - 1));
|
|
6603
|
+
};
|
|
6604
|
+
return { sizes, offsets, total: offsets[offsets.length - 1], indexAt };
|
|
6605
|
+
}
|
|
6606
|
+
|
|
6607
|
+
// src/components/Table/RowResizeHandle.tsx
|
|
6608
|
+
import { useEffect as useEffect15, useRef as useRef22 } from "react";
|
|
6609
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
6610
|
+
function RowResizeHandle({ height, min, max, onPreview, onCommit }) {
|
|
6611
|
+
const drag = useRef22(null);
|
|
6612
|
+
const previewCallback = useRef22(onPreview);
|
|
6613
|
+
previewCallback.current = onPreview;
|
|
6614
|
+
useEffect15(() => {
|
|
6615
|
+
const cancel = () => {
|
|
6616
|
+
if (!drag.current) return;
|
|
6617
|
+
drag.current = null;
|
|
6618
|
+
previewCallback.current(null);
|
|
6619
|
+
};
|
|
6620
|
+
window.addEventListener("blur", cancel);
|
|
6621
|
+
return () => {
|
|
6622
|
+
window.removeEventListener("blur", cancel);
|
|
6623
|
+
cancel();
|
|
6624
|
+
};
|
|
6625
|
+
}, []);
|
|
6626
|
+
const clamp4 = (value) => Math.max(min, Math.min(max, Math.round(value)));
|
|
6627
|
+
const finish = (event, commit) => {
|
|
6628
|
+
const current = drag.current;
|
|
6629
|
+
if (!current || current.id !== event.pointerId) return;
|
|
6630
|
+
drag.current = null;
|
|
6631
|
+
onPreview(null);
|
|
6632
|
+
if (commit && current.next !== current.height) onCommit(current.next);
|
|
6633
|
+
};
|
|
6634
|
+
return /* @__PURE__ */ jsx27(
|
|
6635
|
+
"span",
|
|
6636
|
+
{
|
|
6637
|
+
className: "sia-table__row-resize-handle",
|
|
6638
|
+
role: "separator",
|
|
6639
|
+
"aria-label": "\u8C03\u6574\u884C\u9AD8",
|
|
6640
|
+
"aria-orientation": "horizontal",
|
|
6641
|
+
"aria-valuemin": min,
|
|
6642
|
+
"aria-valuemax": max,
|
|
6643
|
+
"aria-valuenow": height,
|
|
6644
|
+
tabIndex: 0,
|
|
6645
|
+
onClick: (event) => event.stopPropagation(),
|
|
6646
|
+
onDoubleClick: (event) => event.stopPropagation(),
|
|
6647
|
+
onPointerDown: (event) => {
|
|
6648
|
+
if (event.button !== 0) return;
|
|
6649
|
+
event.preventDefault();
|
|
6650
|
+
event.stopPropagation();
|
|
6651
|
+
event.currentTarget.focus({ preventScroll: true });
|
|
6652
|
+
drag.current = { id: event.pointerId, start: event.clientY, height, next: height };
|
|
6653
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
6654
|
+
},
|
|
6655
|
+
onPointerMove: (event) => {
|
|
6656
|
+
const current = drag.current;
|
|
6657
|
+
if (!current || current.id !== event.pointerId) return;
|
|
6658
|
+
event.stopPropagation();
|
|
6659
|
+
current.next = clamp4(current.height + event.clientY - current.start);
|
|
6660
|
+
onPreview(current.next);
|
|
6661
|
+
},
|
|
6662
|
+
onPointerUp: (event) => finish(event, true),
|
|
6663
|
+
onPointerCancel: (event) => finish(event, false),
|
|
6664
|
+
onLostPointerCapture: (event) => finish(event, false),
|
|
6665
|
+
onKeyDown: (event) => {
|
|
6666
|
+
if (event.key === "Escape" && drag.current) {
|
|
6667
|
+
drag.current = null;
|
|
6668
|
+
onPreview(null);
|
|
6669
|
+
event.stopPropagation();
|
|
6670
|
+
}
|
|
6671
|
+
if (event.key !== "ArrowUp" && event.key !== "ArrowDown") return;
|
|
6672
|
+
event.preventDefault();
|
|
6673
|
+
event.stopPropagation();
|
|
6674
|
+
const next = clamp4(height + (event.key === "ArrowUp" ? -10 : 10));
|
|
6675
|
+
if (next !== height) onCommit(next);
|
|
6676
|
+
}
|
|
6677
|
+
}
|
|
6678
|
+
);
|
|
6679
|
+
}
|
|
6680
|
+
|
|
6228
6681
|
// src/components/Table/cellFocus.ts
|
|
6229
6682
|
function playCellFocusGlow(cell, isVisible, onFinish, options) {
|
|
6230
6683
|
const namespace = "http://www.w3.org/2000/svg";
|
|
@@ -6268,10 +6721,10 @@ function playCellFocusGlow(cell, isVisible, onFinish, options) {
|
|
|
6268
6721
|
}
|
|
6269
6722
|
|
|
6270
6723
|
// src/components/Table/Table.tsx
|
|
6271
|
-
import { Fragment as Fragment9, forwardRef as forwardRef6, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as
|
|
6724
|
+
import { Fragment as Fragment9, forwardRef as forwardRef6, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as useEffect17, useImperativeHandle, useMemo as useMemo10, useRef as useRef24, useState as useState24 } from "react";
|
|
6272
6725
|
|
|
6273
6726
|
// src/components/Table/plugins.tsx
|
|
6274
|
-
import { isValidElement as isValidElement3, useEffect as
|
|
6727
|
+
import { isValidElement as isValidElement3, useEffect as useEffect16, useRef as useRef23, useState as useState23 } from "react";
|
|
6275
6728
|
|
|
6276
6729
|
// src/components/Table/columnSettings.ts
|
|
6277
6730
|
function reconcileColumnSettings(columns, defaults, saved) {
|
|
@@ -6358,7 +6811,7 @@ function saveSettingsPatch(adapter, scope, patch) {
|
|
|
6358
6811
|
}
|
|
6359
6812
|
|
|
6360
6813
|
// src/components/Table/plugins.tsx
|
|
6361
|
-
import { Fragment as Fragment8, jsx as
|
|
6814
|
+
import { Fragment as Fragment8, jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6362
6815
|
function TableCheckbox({
|
|
6363
6816
|
checked,
|
|
6364
6817
|
indeterminate,
|
|
@@ -6366,7 +6819,7 @@ function TableCheckbox({
|
|
|
6366
6819
|
label,
|
|
6367
6820
|
onChange
|
|
6368
6821
|
}) {
|
|
6369
|
-
return /* @__PURE__ */
|
|
6822
|
+
return /* @__PURE__ */ jsx28(
|
|
6370
6823
|
Checkbox,
|
|
6371
6824
|
{
|
|
6372
6825
|
className: "sia-table__checkbox",
|
|
@@ -6984,20 +7437,20 @@ function TableSelectedItemsPanel({
|
|
|
6984
7437
|
onRemove,
|
|
6985
7438
|
onClear
|
|
6986
7439
|
}) {
|
|
6987
|
-
const [showAll, setShowAll] =
|
|
7440
|
+
const [showAll, setShowAll] = useState23(false);
|
|
6988
7441
|
const visibleEntries = showAll ? entries : entries.slice(0, maxCount);
|
|
6989
7442
|
const hiddenCount = Math.max(0, entries.length - visibleEntries.length);
|
|
6990
7443
|
const baseColumnMap = new Map(
|
|
6991
7444
|
flattenTableColumns(baseColumns).map((column) => [column.key, column])
|
|
6992
7445
|
);
|
|
6993
|
-
return /* @__PURE__ */
|
|
6994
|
-
/* @__PURE__ */
|
|
6995
|
-
/* @__PURE__ */
|
|
7446
|
+
return /* @__PURE__ */ jsxs24("div", { className: "sia-table-selection-panel", children: [
|
|
7447
|
+
/* @__PURE__ */ jsxs24("div", { className: "sia-table-selection-panel__header", children: [
|
|
7448
|
+
/* @__PURE__ */ jsxs24("strong", { children: [
|
|
6996
7449
|
"\u5DF2\u9009 ",
|
|
6997
|
-
/* @__PURE__ */
|
|
7450
|
+
/* @__PURE__ */ jsx28("span", { children: entries.length }),
|
|
6998
7451
|
" \u9879"
|
|
6999
7452
|
] }),
|
|
7000
|
-
/* @__PURE__ */
|
|
7453
|
+
/* @__PURE__ */ jsx28(
|
|
7001
7454
|
Button,
|
|
7002
7455
|
{
|
|
7003
7456
|
size: "small",
|
|
@@ -7008,15 +7461,15 @@ function TableSelectedItemsPanel({
|
|
|
7008
7461
|
}
|
|
7009
7462
|
)
|
|
7010
7463
|
] }),
|
|
7011
|
-
/* @__PURE__ */
|
|
7012
|
-
/* @__PURE__ */
|
|
7013
|
-
columns.map((column) => /* @__PURE__ */
|
|
7014
|
-
/* @__PURE__ */
|
|
7464
|
+
/* @__PURE__ */ jsx28("div", { className: "sia-table-selection-panel__body", children: /* @__PURE__ */ jsxs24("table", { children: [
|
|
7465
|
+
/* @__PURE__ */ jsx28("thead", { children: /* @__PURE__ */ jsxs24("tr", { children: [
|
|
7466
|
+
columns.map((column) => /* @__PURE__ */ jsx28("th", { children: getColumnLabel(column) }, column.key)),
|
|
7467
|
+
/* @__PURE__ */ jsx28("th", { "aria-label": "\u64CD\u4F5C" })
|
|
7015
7468
|
] }) }),
|
|
7016
|
-
/* @__PURE__ */
|
|
7469
|
+
/* @__PURE__ */ jsx28("tbody", { children: visibleEntries.map((entry, selectedIndex) => /* @__PURE__ */ jsxs24("tr", { children: [
|
|
7017
7470
|
columns.map((column) => {
|
|
7018
7471
|
if (column.meta?.plugin === "index")
|
|
7019
|
-
return /* @__PURE__ */
|
|
7472
|
+
return /* @__PURE__ */ jsx28("td", { children: entry.sourceIndex + 1 }, column.key);
|
|
7020
7473
|
const baseColumn = baseColumnMap.get(column.key) ?? column;
|
|
7021
7474
|
const value = getTableValue(
|
|
7022
7475
|
entry.record,
|
|
@@ -7036,9 +7489,9 @@ function TableSelectedItemsPanel({
|
|
|
7036
7489
|
entry.sourceIndex,
|
|
7037
7490
|
{ row, rowIndex: entry.sourceIndex, column: baseColumn }
|
|
7038
7491
|
) ?? value;
|
|
7039
|
-
return /* @__PURE__ */
|
|
7492
|
+
return /* @__PURE__ */ jsx28("td", { children: content }, column.key);
|
|
7040
7493
|
}),
|
|
7041
|
-
/* @__PURE__ */
|
|
7494
|
+
/* @__PURE__ */ jsx28("td", { children: /* @__PURE__ */ jsx28(
|
|
7042
7495
|
Button,
|
|
7043
7496
|
{
|
|
7044
7497
|
size: "small",
|
|
@@ -7049,11 +7502,11 @@ function TableSelectedItemsPanel({
|
|
|
7049
7502
|
) })
|
|
7050
7503
|
] }, entry.key)) })
|
|
7051
7504
|
] }) }),
|
|
7052
|
-
hiddenCount > 0 ? /* @__PURE__ */
|
|
7505
|
+
hiddenCount > 0 ? /* @__PURE__ */ jsxs24("div", { className: "sia-table-selection-panel__more", children: [
|
|
7053
7506
|
"\u8FD8\u6709 ",
|
|
7054
7507
|
hiddenCount,
|
|
7055
7508
|
" \u9879\u672A\u5C55\u793A",
|
|
7056
|
-
/* @__PURE__ */
|
|
7509
|
+
/* @__PURE__ */ jsx28(Button, { size: "small", variant: "link", onClick: () => setShowAll(true), children: "\u5C55\u793A\u5168\u90E8" })
|
|
7057
7510
|
] }) : null
|
|
7058
7511
|
] });
|
|
7059
7512
|
}
|
|
@@ -7174,7 +7627,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7174
7627
|
const keys = selected(context);
|
|
7175
7628
|
const allChecked = enabledRows.length > 0 && enabledRows.every((row) => keys.includes(row.key));
|
|
7176
7629
|
const someChecked = enabledRows.some((row) => keys.includes(row.key));
|
|
7177
|
-
return /* @__PURE__ */
|
|
7630
|
+
return /* @__PURE__ */ jsx28(
|
|
7178
7631
|
TableCheckbox,
|
|
7179
7632
|
{
|
|
7180
7633
|
label: "\u9009\u62E9\u5F53\u524D\u9875\u5168\u90E8\u884C",
|
|
@@ -7190,7 +7643,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7190
7643
|
}
|
|
7191
7644
|
);
|
|
7192
7645
|
},
|
|
7193
|
-
render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */
|
|
7646
|
+
render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */ jsx28(
|
|
7194
7647
|
Radio2,
|
|
7195
7648
|
{
|
|
7196
7649
|
className: "sia-table__checkbox",
|
|
@@ -7201,7 +7654,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7201
7654
|
onClick: (event) => event.stopPropagation(),
|
|
7202
7655
|
onChange: () => toggle(info.row.key, record, context)
|
|
7203
7656
|
}
|
|
7204
|
-
) : /* @__PURE__ */
|
|
7657
|
+
) : /* @__PURE__ */ jsx28(
|
|
7205
7658
|
TableCheckbox,
|
|
7206
7659
|
{
|
|
7207
7660
|
label: `\u9009\u62E9\u7B2C ${info.rowIndex + 1} \u884C`,
|
|
@@ -7241,8 +7694,8 @@ function createSelectionPlugin(options = {}) {
|
|
|
7241
7694
|
const columns = flattenTableColumns(context.columns).filter(
|
|
7242
7695
|
(column) => !column.hidden && column.meta?.plugin !== "selection"
|
|
7243
7696
|
).slice(0, Math.max(1, options.selectionPanelColumnCount ?? 4));
|
|
7244
|
-
return /* @__PURE__ */
|
|
7245
|
-
/* @__PURE__ */
|
|
7697
|
+
return /* @__PURE__ */ jsxs24("span", { className: "sia-table__selection-footer", children: [
|
|
7698
|
+
/* @__PURE__ */ jsx28(
|
|
7246
7699
|
Popover,
|
|
7247
7700
|
{
|
|
7248
7701
|
placement: "top-start",
|
|
@@ -7250,7 +7703,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7250
7703
|
open: context.state.panelOpen && entries.length > 0,
|
|
7251
7704
|
onOpenChange: (panelOpen) => context.setState((state) => ({ ...state, panelOpen })),
|
|
7252
7705
|
overlayClassName: "sia-table-selection-popover",
|
|
7253
|
-
content: /* @__PURE__ */
|
|
7706
|
+
content: /* @__PURE__ */ jsx28(
|
|
7254
7707
|
TableSelectedItemsPanel,
|
|
7255
7708
|
{
|
|
7256
7709
|
entries,
|
|
@@ -7266,7 +7719,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7266
7719
|
onClear: () => setKeys([], context)
|
|
7267
7720
|
}
|
|
7268
7721
|
),
|
|
7269
|
-
children: /* @__PURE__ */
|
|
7722
|
+
children: /* @__PURE__ */ jsxs24(
|
|
7270
7723
|
Button,
|
|
7271
7724
|
{
|
|
7272
7725
|
className: "sia-table__selected-trigger",
|
|
@@ -7282,7 +7735,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7282
7735
|
)
|
|
7283
7736
|
}
|
|
7284
7737
|
),
|
|
7285
|
-
mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */
|
|
7738
|
+
mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */ jsx28(
|
|
7286
7739
|
Checkbox,
|
|
7287
7740
|
{
|
|
7288
7741
|
checked: preserving(context),
|
|
@@ -7339,9 +7792,9 @@ function createSortPlugin(options = {}) {
|
|
|
7339
7792
|
const info = current(context);
|
|
7340
7793
|
const order = info?.field === field ? info.order : null;
|
|
7341
7794
|
const sortHint = `${getColumnLabel(currentColumn)}\uFF1A${order === "ascend" ? "\u5F53\u524D\u5347\u5E8F\uFF0C\u70B9\u51FB\u5207\u6362\u4E3A\u964D\u5E8F" : order === "descend" ? "\u5F53\u524D\u964D\u5E8F\uFF0C\u70B9\u51FB\u53D6\u6D88\u6392\u5E8F" : "\u672A\u6392\u5E8F\uFF0C\u70B9\u51FB\u6309\u5347\u5E8F\u6392\u5E8F"}`;
|
|
7342
|
-
return /* @__PURE__ */
|
|
7343
|
-
/* @__PURE__ */
|
|
7344
|
-
/* @__PURE__ */
|
|
7795
|
+
return /* @__PURE__ */ jsxs24("span", { className: "sia-table__sortable-header", children: [
|
|
7796
|
+
/* @__PURE__ */ jsx28("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
|
|
7797
|
+
/* @__PURE__ */ jsx28(
|
|
7345
7798
|
"button",
|
|
7346
7799
|
{
|
|
7347
7800
|
type: "button",
|
|
@@ -7353,9 +7806,9 @@ function createSortPlugin(options = {}) {
|
|
|
7353
7806
|
event.stopPropagation();
|
|
7354
7807
|
cycle(field, context);
|
|
7355
7808
|
},
|
|
7356
|
-
children: order ? /* @__PURE__ */
|
|
7357
|
-
/* @__PURE__ */
|
|
7358
|
-
/* @__PURE__ */
|
|
7809
|
+
children: order ? /* @__PURE__ */ jsx28(Icon, { name: order === "ascend" ? "chevron-up" : "chevron-down", size: 18 }) : /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
7810
|
+
/* @__PURE__ */ jsx28(Icon, { name: "chevron-up", size: 11 }),
|
|
7811
|
+
/* @__PURE__ */ jsx28(Icon, { name: "chevron-down", size: 11 })
|
|
7359
7812
|
] })
|
|
7360
7813
|
}
|
|
7361
7814
|
)
|
|
@@ -7390,27 +7843,27 @@ function TableFilterControl({
|
|
|
7390
7843
|
placeholder,
|
|
7391
7844
|
onApply
|
|
7392
7845
|
}) {
|
|
7393
|
-
const [open, setOpen] =
|
|
7394
|
-
const [draft, setDraft] =
|
|
7846
|
+
const [open, setOpen] = useState23(false);
|
|
7847
|
+
const [draft, setDraft] = useState23(value);
|
|
7395
7848
|
const label = getColumnLabel(column);
|
|
7396
|
-
|
|
7849
|
+
useEffect16(() => {
|
|
7397
7850
|
if (open) setDraft(value);
|
|
7398
7851
|
}, [open, value]);
|
|
7399
7852
|
const apply = (nextValue) => {
|
|
7400
7853
|
onApply(nextValue.trim());
|
|
7401
7854
|
setOpen(false);
|
|
7402
7855
|
};
|
|
7403
|
-
return /* @__PURE__ */
|
|
7404
|
-
/* @__PURE__ */
|
|
7405
|
-
/* @__PURE__ */
|
|
7856
|
+
return /* @__PURE__ */ jsxs24("span", { className: "sia-table__filter-header", children: [
|
|
7857
|
+
/* @__PURE__ */ jsx28("span", { children: column.title ?? column.name ?? column.key }),
|
|
7858
|
+
/* @__PURE__ */ jsx28(
|
|
7406
7859
|
Popover,
|
|
7407
7860
|
{
|
|
7408
7861
|
open,
|
|
7409
7862
|
onOpenChange: setOpen,
|
|
7410
7863
|
placement: "bottom-end",
|
|
7411
7864
|
overlayClassName: "sia-table-filter-popover",
|
|
7412
|
-
content: /* @__PURE__ */
|
|
7413
|
-
/* @__PURE__ */
|
|
7865
|
+
content: /* @__PURE__ */ jsxs24("div", { className: "sia-table-filter-panel", children: [
|
|
7866
|
+
/* @__PURE__ */ jsx28(
|
|
7414
7867
|
Input,
|
|
7415
7868
|
{
|
|
7416
7869
|
size: "small",
|
|
@@ -7424,8 +7877,8 @@ function TableFilterControl({
|
|
|
7424
7877
|
}
|
|
7425
7878
|
}
|
|
7426
7879
|
),
|
|
7427
|
-
/* @__PURE__ */
|
|
7428
|
-
/* @__PURE__ */
|
|
7880
|
+
/* @__PURE__ */ jsxs24("div", { className: "sia-table-filter-panel__actions", children: [
|
|
7881
|
+
/* @__PURE__ */ jsx28(
|
|
7429
7882
|
Button,
|
|
7430
7883
|
{
|
|
7431
7884
|
size: "small",
|
|
@@ -7437,7 +7890,7 @@ function TableFilterControl({
|
|
|
7437
7890
|
children: "\u6E05\u9664"
|
|
7438
7891
|
}
|
|
7439
7892
|
),
|
|
7440
|
-
/* @__PURE__ */
|
|
7893
|
+
/* @__PURE__ */ jsx28(
|
|
7441
7894
|
Button,
|
|
7442
7895
|
{
|
|
7443
7896
|
size: "small",
|
|
@@ -7448,7 +7901,7 @@ function TableFilterControl({
|
|
|
7448
7901
|
)
|
|
7449
7902
|
] })
|
|
7450
7903
|
] }),
|
|
7451
|
-
children: /* @__PURE__ */
|
|
7904
|
+
children: /* @__PURE__ */ jsx28(
|
|
7452
7905
|
"button",
|
|
7453
7906
|
{
|
|
7454
7907
|
type: "button",
|
|
@@ -7456,7 +7909,7 @@ function TableFilterControl({
|
|
|
7456
7909
|
"aria-label": `\u7B5B\u9009${label}`,
|
|
7457
7910
|
"aria-pressed": Boolean(value),
|
|
7458
7911
|
onClick: (event) => event.stopPropagation(),
|
|
7459
|
-
children: /* @__PURE__ */
|
|
7912
|
+
children: /* @__PURE__ */ jsx28(Icon, { name: "search", size: 13 })
|
|
7460
7913
|
}
|
|
7461
7914
|
)
|
|
7462
7915
|
}
|
|
@@ -7518,7 +7971,7 @@ function createFilterPlugin(options = {}) {
|
|
|
7518
7971
|
title: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title
|
|
7519
7972
|
};
|
|
7520
7973
|
const placeholder = typeof options.placeholder === "function" ? options.placeholder(currentColumn) : options.placeholder ?? `\u8F93\u5165${getColumnLabel(currentColumn)}\u7B5B\u9009`;
|
|
7521
|
-
return /* @__PURE__ */
|
|
7974
|
+
return /* @__PURE__ */ jsx28(
|
|
7522
7975
|
TableFilterControl,
|
|
7523
7976
|
{
|
|
7524
7977
|
column: renderedColumn,
|
|
@@ -7607,7 +8060,7 @@ function createPaginationPlugin(options = {}) {
|
|
|
7607
8060
|
const page = currentPage(context);
|
|
7608
8061
|
const filteredCount = context.getPluginApi("filter")?.getFilteredRows().length;
|
|
7609
8062
|
const totalRecords = options.totalCount ?? filteredCount ?? context.sourceData.length;
|
|
7610
|
-
return /* @__PURE__ */
|
|
8063
|
+
return /* @__PURE__ */ jsx28(
|
|
7611
8064
|
Pagination,
|
|
7612
8065
|
{
|
|
7613
8066
|
className: "sia-table__pagination",
|
|
@@ -7745,19 +8198,19 @@ function createTreePlugin(options = {}) {
|
|
|
7745
8198
|
return {
|
|
7746
8199
|
...column,
|
|
7747
8200
|
...options.showLine ? { ellipsis: false, meta: { ...column.meta, treeLines: true } } : {},
|
|
7748
|
-
render: (value, record, index, info) => /* @__PURE__ */
|
|
8201
|
+
render: (value, record, index, info) => /* @__PURE__ */ jsxs24(
|
|
7749
8202
|
"span",
|
|
7750
8203
|
{
|
|
7751
8204
|
className: `sia-table__tree-cell${options.showLine ? " sia-table__tree-cell--lines" : ""}`,
|
|
7752
8205
|
style: options.showLine ? void 0 : { paddingLeft: info.row.depth * 18 },
|
|
7753
8206
|
children: [
|
|
7754
|
-
options.showLine && info.row.depth > 0 && /* @__PURE__ */
|
|
7755
|
-
info.row.meta.treeGuides.map((continued, level) => /* @__PURE__ */
|
|
7756
|
-
/* @__PURE__ */
|
|
8207
|
+
options.showLine && info.row.depth > 0 && /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
8208
|
+
info.row.meta.treeGuides.map((continued, level) => /* @__PURE__ */ jsx28("span", { "aria-hidden": "true", className: `sia-table__tree-guide${continued ? " sia-table__tree-guide--continued" : ""}` }, level)),
|
|
8209
|
+
/* @__PURE__ */ jsx28("span", { "aria-hidden": "true", className: `sia-table__tree-guide sia-table__tree-guide--branch${info.row.meta.treeHasNextSibling ? " sia-table__tree-guide--continued" : ""}` })
|
|
7757
8210
|
] }),
|
|
7758
|
-
/* @__PURE__ */
|
|
7759
|
-
options.showLine && !!info.row.meta.treeHasChildren && current(context).includes(info.row.key) && /* @__PURE__ */
|
|
7760
|
-
info.row.meta.treeHasChildren ? /* @__PURE__ */
|
|
8211
|
+
/* @__PURE__ */ jsxs24("span", { className: options.showLine ? "sia-table__tree-node" : void 0, style: options.showLine ? void 0 : { display: "contents" }, children: [
|
|
8212
|
+
options.showLine && !!info.row.meta.treeHasChildren && current(context).includes(info.row.key) && /* @__PURE__ */ jsx28("span", { "aria-hidden": "true", className: "sia-table__tree-stem" }),
|
|
8213
|
+
info.row.meta.treeHasChildren ? /* @__PURE__ */ jsx28(
|
|
7761
8214
|
"button",
|
|
7762
8215
|
{
|
|
7763
8216
|
type: "button",
|
|
@@ -7768,7 +8221,7 @@ function createTreePlugin(options = {}) {
|
|
|
7768
8221
|
event.stopPropagation();
|
|
7769
8222
|
toggle(info.row.key, context);
|
|
7770
8223
|
},
|
|
7771
|
-
children: /* @__PURE__ */
|
|
8224
|
+
children: /* @__PURE__ */ jsx28(
|
|
7772
8225
|
Icon,
|
|
7773
8226
|
{
|
|
7774
8227
|
name: current(context).includes(info.row.key) ? "chevron-down" : "chevron-right",
|
|
@@ -7776,7 +8229,7 @@ function createTreePlugin(options = {}) {
|
|
|
7776
8229
|
}
|
|
7777
8230
|
)
|
|
7778
8231
|
}
|
|
7779
|
-
) : /* @__PURE__ */
|
|
8232
|
+
) : /* @__PURE__ */ jsx28("span", { className: "sia-table__tree-placeholder" })
|
|
7780
8233
|
] }),
|
|
7781
8234
|
previousRender ? previousRender(value, record, index, info) : value
|
|
7782
8235
|
]
|
|
@@ -7832,17 +8285,17 @@ function EditableTableCell({
|
|
|
7832
8285
|
showEditIcon
|
|
7833
8286
|
}) {
|
|
7834
8287
|
const config = typeof editable === "object" ? editable : { type: "input" };
|
|
7835
|
-
const [editValue, setEditValue] =
|
|
7836
|
-
const [saving, setSaving] =
|
|
7837
|
-
const inputRef =
|
|
7838
|
-
const editorRef =
|
|
7839
|
-
const editValueRef =
|
|
7840
|
-
const savingRef =
|
|
7841
|
-
const saveRef =
|
|
8288
|
+
const [editValue, setEditValue] = useState23(value);
|
|
8289
|
+
const [saving, setSaving] = useState23(false);
|
|
8290
|
+
const inputRef = useRef23(null);
|
|
8291
|
+
const editorRef = useRef23(null);
|
|
8292
|
+
const editValueRef = useRef23(value);
|
|
8293
|
+
const savingRef = useRef23(false);
|
|
8294
|
+
const saveRef = useRef23(
|
|
7842
8295
|
async () => {
|
|
7843
8296
|
}
|
|
7844
8297
|
);
|
|
7845
|
-
|
|
8298
|
+
useEffect16(() => {
|
|
7846
8299
|
if (!active) return;
|
|
7847
8300
|
editValueRef.current = value;
|
|
7848
8301
|
setEditValue(value);
|
|
@@ -7873,7 +8326,7 @@ function EditableTableCell({
|
|
|
7873
8326
|
}
|
|
7874
8327
|
}
|
|
7875
8328
|
saveRef.current = save;
|
|
7876
|
-
|
|
8329
|
+
useEffect16(() => {
|
|
7877
8330
|
if (!active || config.type === "select" || config.type === "custom") return;
|
|
7878
8331
|
const handleOutsidePointerDown = (event) => {
|
|
7879
8332
|
const target = event.target;
|
|
@@ -7889,15 +8342,15 @@ function EditableTableCell({
|
|
|
7889
8342
|
);
|
|
7890
8343
|
}, [active, config.type]);
|
|
7891
8344
|
if (!active)
|
|
7892
|
-
return /* @__PURE__ */
|
|
8345
|
+
return /* @__PURE__ */ jsxs24(
|
|
7893
8346
|
"div",
|
|
7894
8347
|
{
|
|
7895
8348
|
className: "sia-table__editable-display",
|
|
7896
8349
|
onClick: trigger === "click" ? onStart : void 0,
|
|
7897
8350
|
onDoubleClick: trigger === "doubleClick" ? onStart : void 0,
|
|
7898
8351
|
children: [
|
|
7899
|
-
/* @__PURE__ */
|
|
7900
|
-
showEditIcon && /* @__PURE__ */
|
|
8352
|
+
/* @__PURE__ */ jsx28("span", { children: content }),
|
|
8353
|
+
showEditIcon && /* @__PURE__ */ jsx28(Icon, { name: "edit", size: 13 })
|
|
7901
8354
|
]
|
|
7902
8355
|
}
|
|
7903
8356
|
);
|
|
@@ -7905,7 +8358,7 @@ function EditableTableCell({
|
|
|
7905
8358
|
if (config.type === "custom" && config.editRender) {
|
|
7906
8359
|
editor = config.editRender(record, (next) => void save(next), onCancel);
|
|
7907
8360
|
} else if (config.type === "inputNumber") {
|
|
7908
|
-
editor = /* @__PURE__ */
|
|
8361
|
+
editor = /* @__PURE__ */ jsx28(
|
|
7909
8362
|
InputNumber,
|
|
7910
8363
|
{
|
|
7911
8364
|
ref: inputRef,
|
|
@@ -7926,7 +8379,7 @@ function EditableTableCell({
|
|
|
7926
8379
|
}
|
|
7927
8380
|
);
|
|
7928
8381
|
} else if (config.type === "select") {
|
|
7929
|
-
editor = /* @__PURE__ */
|
|
8382
|
+
editor = /* @__PURE__ */ jsx28(
|
|
7930
8383
|
Select,
|
|
7931
8384
|
{
|
|
7932
8385
|
size: "small",
|
|
@@ -7940,14 +8393,14 @@ function EditableTableCell({
|
|
|
7940
8393
|
}
|
|
7941
8394
|
);
|
|
7942
8395
|
} else {
|
|
7943
|
-
editor = /* @__PURE__ */
|
|
8396
|
+
editor = /* @__PURE__ */ jsx28(
|
|
7944
8397
|
Input,
|
|
7945
8398
|
{
|
|
7946
8399
|
ref: inputRef,
|
|
7947
8400
|
size: "small",
|
|
7948
8401
|
value: String(editValue ?? ""),
|
|
7949
8402
|
disabled: saving,
|
|
7950
|
-
suffix: saving ? /* @__PURE__ */
|
|
8403
|
+
suffix: saving ? /* @__PURE__ */ jsx28(Icon, { name: "loader", size: 13, spin: true }) : null,
|
|
7951
8404
|
onChange: (event) => updateEditValue(event.target.value),
|
|
7952
8405
|
onBlur: () => void save(),
|
|
7953
8406
|
onKeyDown: (event) => {
|
|
@@ -7957,7 +8410,7 @@ function EditableTableCell({
|
|
|
7957
8410
|
}
|
|
7958
8411
|
);
|
|
7959
8412
|
}
|
|
7960
|
-
return /* @__PURE__ */
|
|
8413
|
+
return /* @__PURE__ */ jsx28("div", { ref: editorRef, className: "sia-table__editor", children: editor });
|
|
7961
8414
|
}
|
|
7962
8415
|
function createEditablePlugin(options = {}) {
|
|
7963
8416
|
const trigger = options.trigger ?? "click";
|
|
@@ -7977,7 +8430,7 @@ function createEditablePlugin(options = {}) {
|
|
|
7977
8430
|
const active = canEdit && context.state.editing?.rowKey === info.row.key && context.state.editing.columnKey === column.key;
|
|
7978
8431
|
const content = previousRender ? previousRender(value, record, index, info) : value;
|
|
7979
8432
|
if (!canEdit) return content;
|
|
7980
|
-
return /* @__PURE__ */
|
|
8433
|
+
return /* @__PURE__ */ jsx28(
|
|
7981
8434
|
EditableTableCell,
|
|
7982
8435
|
{
|
|
7983
8436
|
active,
|
|
@@ -8041,9 +8494,9 @@ function createResizePlugin(options = {}) {
|
|
|
8041
8494
|
...column,
|
|
8042
8495
|
autoWidth,
|
|
8043
8496
|
width,
|
|
8044
|
-
renderHeader: (currentColumn, coreContext) => /* @__PURE__ */
|
|
8045
|
-
/* @__PURE__ */
|
|
8046
|
-
/* @__PURE__ */
|
|
8497
|
+
renderHeader: (currentColumn, coreContext) => /* @__PURE__ */ jsxs24("span", { className: "sia-table__resizable-header", children: [
|
|
8498
|
+
/* @__PURE__ */ jsx28("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
|
|
8499
|
+
/* @__PURE__ */ jsx28(
|
|
8047
8500
|
"span",
|
|
8048
8501
|
{
|
|
8049
8502
|
className: "sia-table__resize-handle",
|
|
@@ -8179,12 +8632,12 @@ function ColumnSettingPanel({
|
|
|
8179
8632
|
onClose,
|
|
8180
8633
|
onApply
|
|
8181
8634
|
}) {
|
|
8182
|
-
const [draft, setDraft] =
|
|
8183
|
-
const listRef =
|
|
8184
|
-
const cancelDrag =
|
|
8185
|
-
const [preview, setPreview] =
|
|
8186
|
-
const syncedDraft =
|
|
8187
|
-
|
|
8635
|
+
const [draft, setDraft] = useState23(items);
|
|
8636
|
+
const listRef = useRef23(null);
|
|
8637
|
+
const cancelDrag = useRef23(null);
|
|
8638
|
+
const [preview, setPreview] = useState23(null);
|
|
8639
|
+
const syncedDraft = useRef23({ open: false, signature: "" });
|
|
8640
|
+
useEffect16(() => {
|
|
8188
8641
|
const signature = JSON.stringify(items);
|
|
8189
8642
|
const changed = signature !== syncedDraft.current.signature;
|
|
8190
8643
|
if (open !== syncedDraft.current.open || changed) cancelDrag.current?.();
|
|
@@ -8193,7 +8646,7 @@ function ColumnSettingPanel({
|
|
|
8193
8646
|
}
|
|
8194
8647
|
syncedDraft.current = { open, signature };
|
|
8195
8648
|
}, [items, open]);
|
|
8196
|
-
|
|
8649
|
+
useEffect16(() => () => cancelDrag.current?.(), []);
|
|
8197
8650
|
const labels = new Map(
|
|
8198
8651
|
flattenTableColumns(columns).map((column) => [
|
|
8199
8652
|
column.key,
|
|
@@ -8320,7 +8773,7 @@ function ColumnSettingPanel({
|
|
|
8320
8773
|
window.addEventListener("blur", cancel);
|
|
8321
8774
|
frame = requestAnimationFrame(tick);
|
|
8322
8775
|
}
|
|
8323
|
-
return /* @__PURE__ */
|
|
8776
|
+
return /* @__PURE__ */ jsxs24(
|
|
8324
8777
|
Drawer2,
|
|
8325
8778
|
{
|
|
8326
8779
|
open,
|
|
@@ -8329,9 +8782,9 @@ function ColumnSettingPanel({
|
|
|
8329
8782
|
onOpenChange: (next) => {
|
|
8330
8783
|
if (!next) onClose();
|
|
8331
8784
|
},
|
|
8332
|
-
footer: /* @__PURE__ */
|
|
8333
|
-
/* @__PURE__ */
|
|
8334
|
-
/* @__PURE__ */
|
|
8785
|
+
footer: /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
8786
|
+
/* @__PURE__ */ jsx28(Button, { onClick: onClose, children: "\u53D6\u6D88" }),
|
|
8787
|
+
/* @__PURE__ */ jsx28(
|
|
8335
8788
|
Button,
|
|
8336
8789
|
{
|
|
8337
8790
|
variant: "primary",
|
|
@@ -8342,19 +8795,19 @@ function ColumnSettingPanel({
|
|
|
8342
8795
|
)
|
|
8343
8796
|
] }),
|
|
8344
8797
|
children: [
|
|
8345
|
-
loadError ? /* @__PURE__ */
|
|
8798
|
+
loadError ? /* @__PURE__ */ jsxs24("p", { role: "alert", children: [
|
|
8346
8799
|
"\u8BFB\u53D6\u5217\u914D\u7F6E\u5931\u8D25\u3002",
|
|
8347
|
-
/* @__PURE__ */
|
|
8800
|
+
/* @__PURE__ */ jsx28(Button, { variant: "link", onClick: onRetry, children: "\u91CD\u8BD5" })
|
|
8348
8801
|
] }) : null,
|
|
8349
|
-
/* @__PURE__ */
|
|
8802
|
+
/* @__PURE__ */ jsx28(Spin, { spinning: Boolean(loading), className: "sia-table-settings__loading", "aria-label": loading ? "\u6B63\u5728\u8BFB\u53D6\u5217\u914D\u7F6E" : void 0, children: /* @__PURE__ */ jsxs24(
|
|
8350
8803
|
"fieldset",
|
|
8351
8804
|
{
|
|
8352
8805
|
disabled: loading || loadError,
|
|
8353
8806
|
style: { border: 0, padding: 0, margin: 0, minWidth: 0 },
|
|
8354
8807
|
"aria-busy": loading,
|
|
8355
8808
|
children: [
|
|
8356
|
-
/* @__PURE__ */
|
|
8357
|
-
/* @__PURE__ */
|
|
8809
|
+
/* @__PURE__ */ jsxs24("label", { className: "sia-table-settings__all", children: [
|
|
8810
|
+
/* @__PURE__ */ jsx28(
|
|
8358
8811
|
TableCheckbox,
|
|
8359
8812
|
{
|
|
8360
8813
|
label: "\u5168\u9009\u5217",
|
|
@@ -8365,7 +8818,7 @@ function ColumnSettingPanel({
|
|
|
8365
8818
|
)
|
|
8366
8819
|
}
|
|
8367
8820
|
),
|
|
8368
|
-
/* @__PURE__ */
|
|
8821
|
+
/* @__PURE__ */ jsxs24("span", { children: [
|
|
8369
8822
|
"\u5168\u9009\uFF08",
|
|
8370
8823
|
visibleCount,
|
|
8371
8824
|
"/",
|
|
@@ -8373,12 +8826,12 @@ function ColumnSettingPanel({
|
|
|
8373
8826
|
"\uFF09"
|
|
8374
8827
|
] })
|
|
8375
8828
|
] }),
|
|
8376
|
-
/* @__PURE__ */
|
|
8829
|
+
/* @__PURE__ */ jsx28(
|
|
8377
8830
|
"div",
|
|
8378
8831
|
{
|
|
8379
8832
|
ref: listRef,
|
|
8380
8833
|
className: `sia-table-settings__list${preview ? " is-sorting" : ""}`,
|
|
8381
|
-
children: draft.map((item) => /* @__PURE__ */
|
|
8834
|
+
children: draft.map((item) => /* @__PURE__ */ jsxs24(
|
|
8382
8835
|
"div",
|
|
8383
8836
|
{
|
|
8384
8837
|
"data-column-key": item.key,
|
|
@@ -8388,8 +8841,8 @@ function ColumnSettingPanel({
|
|
|
8388
8841
|
} : void 0,
|
|
8389
8842
|
onPointerDown: (event) => startSort(event, item.key),
|
|
8390
8843
|
children: [
|
|
8391
|
-
/* @__PURE__ */
|
|
8392
|
-
/* @__PURE__ */
|
|
8844
|
+
/* @__PURE__ */ jsx28(Icon, { name: "menu", size: 15 }),
|
|
8845
|
+
/* @__PURE__ */ jsx28(
|
|
8393
8846
|
TableCheckbox,
|
|
8394
8847
|
{
|
|
8395
8848
|
label: `\u663E\u793A${labels.get(item.key) ?? item.key}\u5217`,
|
|
@@ -8401,15 +8854,15 @@ function ColumnSettingPanel({
|
|
|
8401
8854
|
)
|
|
8402
8855
|
}
|
|
8403
8856
|
),
|
|
8404
|
-
/* @__PURE__ */
|
|
8857
|
+
/* @__PURE__ */ jsx28(
|
|
8405
8858
|
"span",
|
|
8406
8859
|
{
|
|
8407
8860
|
className: "sia-table-settings__name",
|
|
8408
8861
|
children: labels.get(item.key) ?? item.key
|
|
8409
8862
|
}
|
|
8410
8863
|
),
|
|
8411
|
-
/* @__PURE__ */
|
|
8412
|
-
/* @__PURE__ */
|
|
8864
|
+
/* @__PURE__ */ jsxs24("div", { className: "sia-table-settings__actions", children: [
|
|
8865
|
+
/* @__PURE__ */ jsx28(
|
|
8413
8866
|
Button,
|
|
8414
8867
|
{
|
|
8415
8868
|
size: "small",
|
|
@@ -8422,7 +8875,7 @@ function ColumnSettingPanel({
|
|
|
8422
8875
|
children: "\u5DE6"
|
|
8423
8876
|
}
|
|
8424
8877
|
),
|
|
8425
|
-
/* @__PURE__ */
|
|
8878
|
+
/* @__PURE__ */ jsx28(
|
|
8426
8879
|
Button,
|
|
8427
8880
|
{
|
|
8428
8881
|
size: "small",
|
|
@@ -8572,7 +9025,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8572
9025
|
{
|
|
8573
9026
|
key: "builtin:export",
|
|
8574
9027
|
label: "\u8868\u683C\u5BFC\u51FA",
|
|
8575
|
-
icon: /* @__PURE__ */
|
|
9028
|
+
icon: /* @__PURE__ */ jsx28(Icon, { name: "download", size: 18 }),
|
|
8576
9029
|
disabled: exportApi().getRows().length === 0
|
|
8577
9030
|
},
|
|
8578
9031
|
{ key: "builtin:divider", type: "divider" }
|
|
@@ -8580,7 +9033,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8580
9033
|
{
|
|
8581
9034
|
key: "builtin:columns",
|
|
8582
9035
|
label: "\u5217\u8BBE\u7F6E",
|
|
8583
|
-
icon: /* @__PURE__ */
|
|
9036
|
+
icon: /* @__PURE__ */ jsx28(Icon, { name: "settings", size: 18 })
|
|
8584
9037
|
},
|
|
8585
9038
|
...customItems.map((item) => ({
|
|
8586
9039
|
key: "custom:" + item.key,
|
|
@@ -8592,7 +9045,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8592
9045
|
disabled: item.disabled === true || typeof item.disabled === "function" && item.disabled(context)
|
|
8593
9046
|
}))
|
|
8594
9047
|
];
|
|
8595
|
-
return /* @__PURE__ */
|
|
9048
|
+
return /* @__PURE__ */ jsx28(
|
|
8596
9049
|
Dropdown,
|
|
8597
9050
|
{
|
|
8598
9051
|
disabled: options.buttonProps?.disabled || options.buttonProps?.loading,
|
|
@@ -8609,12 +9062,12 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8609
9062
|
void customItems.find((item) => "custom:" + item.key === key)?.onClick?.(context);
|
|
8610
9063
|
}
|
|
8611
9064
|
},
|
|
8612
|
-
children: /* @__PURE__ */
|
|
9065
|
+
children: /* @__PURE__ */ jsx28(
|
|
8613
9066
|
Button,
|
|
8614
9067
|
{
|
|
8615
9068
|
size: "small",
|
|
8616
9069
|
variant: "text",
|
|
8617
|
-
icon: /* @__PURE__ */
|
|
9070
|
+
icon: /* @__PURE__ */ jsx28(Icon, { name: "settings", size: 16 }),
|
|
8618
9071
|
"aria-label": "\u8868\u683C\u8BBE\u7F6E",
|
|
8619
9072
|
...options.buttonProps,
|
|
8620
9073
|
className: `sia-table__settings-button${options.buttonProps?.children == null ? " sia-table__toolbar-icon" : ""} ${options.buttonProps?.className ?? ""}`.trim()
|
|
@@ -8623,7 +9076,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8623
9076
|
}
|
|
8624
9077
|
);
|
|
8625
9078
|
},
|
|
8626
|
-
renderOverlay: (context) => /* @__PURE__ */
|
|
9079
|
+
renderOverlay: (context) => /* @__PURE__ */ jsx28(
|
|
8627
9080
|
ColumnSettingPanel,
|
|
8628
9081
|
{
|
|
8629
9082
|
open: context.state.open,
|
|
@@ -8673,11 +9126,11 @@ function ToolbarItems({
|
|
|
8673
9126
|
items,
|
|
8674
9127
|
context
|
|
8675
9128
|
}) {
|
|
8676
|
-
return /* @__PURE__ */
|
|
9129
|
+
return /* @__PURE__ */ jsx28(Fragment8, { children: items.map((item) => {
|
|
8677
9130
|
if (item.hidden === true || typeof item.hidden === "function" && item.hidden(context))
|
|
8678
9131
|
return null;
|
|
8679
9132
|
const disabled = item.disabled === true || typeof item.disabled === "function" && item.disabled(context);
|
|
8680
|
-
return /* @__PURE__ */
|
|
9133
|
+
return /* @__PURE__ */ jsx28(
|
|
8681
9134
|
Button,
|
|
8682
9135
|
{
|
|
8683
9136
|
size: "small",
|
|
@@ -8700,16 +9153,16 @@ function createToolbarPlugin(options) {
|
|
|
8700
9153
|
return {
|
|
8701
9154
|
id: "toolbar",
|
|
8702
9155
|
order: 5,
|
|
8703
|
-
renderToolbarStart: (context) => /* @__PURE__ */
|
|
9156
|
+
renderToolbarStart: (context) => /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
8704
9157
|
options.start,
|
|
8705
|
-
/* @__PURE__ */
|
|
9158
|
+
/* @__PURE__ */ jsx28(ToolbarItems, { items: items("start"), context })
|
|
8706
9159
|
] }),
|
|
8707
|
-
renderToolbarEnd: (context) => /* @__PURE__ */
|
|
9160
|
+
renderToolbarEnd: (context) => /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
8708
9161
|
options.end,
|
|
8709
|
-
/* @__PURE__ */
|
|
8710
|
-
items("end", true).length > 0 ? /* @__PURE__ */
|
|
8711
|
-
/* @__PURE__ */
|
|
8712
|
-
/* @__PURE__ */
|
|
9162
|
+
/* @__PURE__ */ jsx28(ToolbarItems, { items: items("end"), context }),
|
|
9163
|
+
items("end", true).length > 0 ? /* @__PURE__ */ jsxs24("details", { className: "sia-table__toolbar-menu", children: [
|
|
9164
|
+
/* @__PURE__ */ jsx28("summary", { "aria-label": "\u66F4\u591A\u8868\u683C\u64CD\u4F5C", children: /* @__PURE__ */ jsx28(Icon, { name: "more-horizontal", size: 16 }) }),
|
|
9165
|
+
/* @__PURE__ */ jsx28("div", { children: /* @__PURE__ */ jsx28(ToolbarItems, { items: items("end", true), context }) })
|
|
8713
9166
|
] }) : null
|
|
8714
9167
|
] })
|
|
8715
9168
|
};
|
|
@@ -8791,11 +9244,11 @@ function createExportPlugin(options = {}) {
|
|
|
8791
9244
|
return {
|
|
8792
9245
|
id: "export",
|
|
8793
9246
|
order: 95,
|
|
8794
|
-
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */
|
|
9247
|
+
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */ jsx28(
|
|
8795
9248
|
Button,
|
|
8796
9249
|
{
|
|
8797
9250
|
size: "small",
|
|
8798
|
-
icon: /* @__PURE__ */
|
|
9251
|
+
icon: /* @__PURE__ */ jsx28(Icon, { name: "download", size: 14 }),
|
|
8799
9252
|
disabled: getRows(context).length === 0,
|
|
8800
9253
|
onClick: () => void download(context),
|
|
8801
9254
|
children: options.buttonLabel ?? "\u5BFC\u51FA"
|
|
@@ -8810,7 +9263,7 @@ function createExportPlugin(options = {}) {
|
|
|
8810
9263
|
}
|
|
8811
9264
|
|
|
8812
9265
|
// src/components/Table/Table.tsx
|
|
8813
|
-
import { jsx as
|
|
9266
|
+
import { jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
8814
9267
|
var EMPTY_DATA = [];
|
|
8815
9268
|
var EMPTY_COLUMNS = [];
|
|
8816
9269
|
var EMPTY_PLUGINS = [];
|
|
@@ -8911,6 +9364,8 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8911
9364
|
rightFixedEdgeKey,
|
|
8912
9365
|
striped,
|
|
8913
9366
|
rowHeight,
|
|
9367
|
+
managedHeight,
|
|
9368
|
+
resize,
|
|
8914
9369
|
className,
|
|
8915
9370
|
onClick,
|
|
8916
9371
|
onDoubleClick,
|
|
@@ -8924,13 +9379,14 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8924
9379
|
onCellPointerDown,
|
|
8925
9380
|
onCellPointerMove
|
|
8926
9381
|
}) {
|
|
8927
|
-
|
|
9382
|
+
const resizeColumnKey = resize ? columns.find((column) => !getCellProps(column).hidden)?.key : void 0;
|
|
9383
|
+
return /* @__PURE__ */ jsx29(
|
|
8928
9384
|
"tr",
|
|
8929
9385
|
{
|
|
8930
9386
|
"data-row-key": String(row.key),
|
|
8931
9387
|
"data-canvas-row-index": canvas ? rowIndex : void 0,
|
|
8932
|
-
className: `sia-table__row${striped && rowIndex % 2 === 1 ? " sia-table__row--striped" : ""} ${className}`.trim(),
|
|
8933
|
-
style: { height: rowHeight },
|
|
9388
|
+
className: `sia-table__row${managedHeight ? " sia-table__row--height-managed" : ""}${striped && rowIndex % 2 === 1 ? " sia-table__row--striped" : ""} ${className}`.trim(),
|
|
9389
|
+
style: { height: rowHeight, "--sia-table-row-height": `${rowHeight}px` },
|
|
8934
9390
|
onClick,
|
|
8935
9391
|
onDoubleClick,
|
|
8936
9392
|
onMouseEnter,
|
|
@@ -8940,7 +9396,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8940
9396
|
if (columnIndex > 0 && !visibleColumns.has(columns[columnIndex - 1].key)) return null;
|
|
8941
9397
|
let count = 1;
|
|
8942
9398
|
while (columnIndex + count < columns.length && !visibleColumns.has(columns[columnIndex + count].key)) count++;
|
|
8943
|
-
return /* @__PURE__ */
|
|
9399
|
+
return /* @__PURE__ */ jsx29("td", { colSpan: count, "aria-hidden": "true", style: { padding: 0 } }, `spacer-${column.key}`);
|
|
8944
9400
|
}
|
|
8945
9401
|
const pluginCellProps = getCellProps(column);
|
|
8946
9402
|
if (pluginCellProps.hidden) return null;
|
|
@@ -8951,7 +9407,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8951
9407
|
const fixedStyle = fixed === "left" ? { left: leftOffsets.get(column.key) } : fixed === "right" ? { right: rightOffsets.get(column.key) } : void 0;
|
|
8952
9408
|
const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
8953
9409
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
8954
|
-
return /* @__PURE__ */
|
|
9410
|
+
return /* @__PURE__ */ jsxs25(
|
|
8955
9411
|
"td",
|
|
8956
9412
|
{
|
|
8957
9413
|
"data-column-key": column.key,
|
|
@@ -8968,14 +9424,17 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8968
9424
|
onContextMenu: (event) => onCellContextMenu(column, event),
|
|
8969
9425
|
onPointerDown: (event) => onCellPointerDown(column, event),
|
|
8970
9426
|
onPointerMove: (event) => onCellPointerMove(column, event),
|
|
8971
|
-
children:
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
9427
|
+
children: [
|
|
9428
|
+
!canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? /* @__PURE__ */ jsx29(
|
|
9429
|
+
TableCellContent,
|
|
9430
|
+
{
|
|
9431
|
+
ellipsis: column.ellipsis !== false,
|
|
9432
|
+
title: column.showTitle === true && column.ellipsis !== false && typeof value === "string" ? value : void 0,
|
|
9433
|
+
children: pluginCellProps.content !== void 0 ? pluginCellProps.content : column.render ? column.render(value, row.record, row.sourceIndex, { row, rowIndex, column }) : value
|
|
9434
|
+
}
|
|
9435
|
+
) : null,
|
|
9436
|
+
resize && column.key === resizeColumnKey ? /* @__PURE__ */ jsx29(RowResizeHandle, { height: rowHeight, ...resize }) : null
|
|
9437
|
+
]
|
|
8979
9438
|
},
|
|
8980
9439
|
column.key
|
|
8981
9440
|
);
|
|
@@ -9005,6 +9464,11 @@ function TableInner(props, ref) {
|
|
|
9005
9464
|
renderMode = "dom",
|
|
9006
9465
|
virtualThreshold = 100,
|
|
9007
9466
|
rowHeight = SIZE_ROW_HEIGHT[size],
|
|
9467
|
+
rowHeights,
|
|
9468
|
+
rowResizable = false,
|
|
9469
|
+
minRowHeight,
|
|
9470
|
+
maxRowHeight,
|
|
9471
|
+
onRowHeightChange,
|
|
9008
9472
|
overscan = 6,
|
|
9009
9473
|
stickyHeader = true,
|
|
9010
9474
|
resizable = true,
|
|
@@ -9020,31 +9484,42 @@ function TableInner(props, ref) {
|
|
|
9020
9484
|
style,
|
|
9021
9485
|
...htmlProps
|
|
9022
9486
|
} = props;
|
|
9023
|
-
const
|
|
9487
|
+
const [localRowHeights, setLocalRowHeights] = useState24({});
|
|
9488
|
+
const [rowHeightPreview, setRowHeightPreview] = useState24(null);
|
|
9489
|
+
const configuredRowHeights = rowHeights ?? localRowHeights;
|
|
9490
|
+
const effectiveRowHeights = useMemo10(() => rowHeightPreview ? { ...configuredRowHeights, [rowHeightPreview.key]: rowHeightPreview.height } : configuredRowHeights, [configuredRowHeights, rowHeightPreview]);
|
|
9491
|
+
const resizeMin = Math.max(SIZE_ROW_HEIGHT[size], Number.isFinite(minRowHeight) ? minRowHeight : SIZE_ROW_HEIGHT[size]);
|
|
9492
|
+
const resizeMax = Math.max(resizeMin, Number.isFinite(maxRowHeight) ? maxRowHeight : 480);
|
|
9493
|
+
const managedRowHeights = rowHeights !== void 0 || rowResizable || Object.keys(localRowHeights).length > 0;
|
|
9494
|
+
const commitRowHeight = useCallback2((row, height2) => {
|
|
9495
|
+
if (rowHeights === void 0) setLocalRowHeights((previous) => ({ ...previous, [String(row.key)]: height2 }));
|
|
9496
|
+
onRowHeightChange?.(row.record, height2, row.sourceIndex);
|
|
9497
|
+
}, [rowHeights, onRowHeightChange]);
|
|
9498
|
+
const rootRef = useRef24(null);
|
|
9024
9499
|
const remainingHeight = useRemainingHeight(rootRef, height == null && tableHeight == null ? fillRemaining : false);
|
|
9025
|
-
const scrollRef =
|
|
9026
|
-
const cellFocusRequest =
|
|
9027
|
-
const cellGlow =
|
|
9028
|
-
|
|
9500
|
+
const scrollRef = useRef24(null);
|
|
9501
|
+
const cellFocusRequest = useRef24(0);
|
|
9502
|
+
const cellGlow = useRef24(null);
|
|
9503
|
+
useEffect17(() => () => {
|
|
9029
9504
|
cellFocusRequest.current++;
|
|
9030
9505
|
cellGlow.current?.();
|
|
9031
9506
|
}, []);
|
|
9032
|
-
const tableRef =
|
|
9507
|
+
const tableRef = useRef24(null);
|
|
9033
9508
|
useScrollbarProximity();
|
|
9034
|
-
const scrollbarDragRef =
|
|
9035
|
-
const [internalLoading, setInternalLoading] =
|
|
9036
|
-
const [scrollTop, setScrollTop] =
|
|
9037
|
-
const [scrollLeft, setScrollLeft] =
|
|
9038
|
-
const [viewportHeight, setViewportHeight] =
|
|
9039
|
-
const [viewportWidth, setViewportWidth] =
|
|
9040
|
-
const [autoColumnWidths, setAutoColumnWidths] =
|
|
9041
|
-
const [resolveRowIdentity] =
|
|
9509
|
+
const scrollbarDragRef = useRef24(null);
|
|
9510
|
+
const [internalLoading, setInternalLoading] = useState24(false);
|
|
9511
|
+
const [scrollTop, setScrollTop] = useState24(0);
|
|
9512
|
+
const [scrollLeft, setScrollLeft] = useState24(0);
|
|
9513
|
+
const [viewportHeight, setViewportHeight] = useState24(420);
|
|
9514
|
+
const [viewportWidth, setViewportWidth] = useState24(0);
|
|
9515
|
+
const [autoColumnWidths, setAutoColumnWidths] = useState24({});
|
|
9516
|
+
const [resolveRowIdentity] = useState24(createRowIdentity);
|
|
9042
9517
|
const getRowKey = useCallback2((record, index) => resolveRowIdentity(record, index, typeof rowKey === "function" ? rowKey : rowKey == null ? void 0 : String(rowKey)), [rowKey, resolveRowIdentity]);
|
|
9043
|
-
const builtInResizePlugin =
|
|
9044
|
-
const builtInHighlightPlugin =
|
|
9045
|
-
const builtInCellSelectionPlugin =
|
|
9046
|
-
const builtInIndexPlugin =
|
|
9047
|
-
const activePlugins =
|
|
9518
|
+
const builtInResizePlugin = useMemo10(() => createResizePlugin(), []);
|
|
9519
|
+
const builtInHighlightPlugin = useMemo10(() => createHighlightPlugin(), []);
|
|
9520
|
+
const builtInCellSelectionPlugin = useMemo10(() => createCellSelectionPlugin(), []);
|
|
9521
|
+
const builtInIndexPlugin = useMemo10(() => createIndexPlugin(), []);
|
|
9522
|
+
const activePlugins = useMemo10(() => {
|
|
9048
9523
|
const plugins = providedPlugins.filter((plugin) => (resizable || plugin.id !== "resize") && (cellSelection || plugin.id !== "cellSelection") && (showIndex || plugin.id !== "index"));
|
|
9049
9524
|
if (!plugins.some((plugin) => plugin.id === "highlight")) plugins.push(builtInHighlightPlugin);
|
|
9050
9525
|
if (resizable && !plugins.some((plugin) => plugin.id === "resize")) plugins.push(builtInResizePlugin);
|
|
@@ -9052,15 +9527,15 @@ function TableInner(props, ref) {
|
|
|
9052
9527
|
if (showIndex && !plugins.some((plugin) => plugin.id === "index")) plugins.push(builtInIndexPlugin);
|
|
9053
9528
|
return plugins;
|
|
9054
9529
|
}, [builtInHighlightPlugin, builtInResizePlugin, builtInCellSelectionPlugin, builtInIndexPlugin, providedPlugins, resizable, cellSelection, showIndex]);
|
|
9055
|
-
const sortedPlugins =
|
|
9056
|
-
const pluginsByIdRef =
|
|
9530
|
+
const sortedPlugins = useMemo10(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
|
|
9531
|
+
const pluginsByIdRef = useRef24(/* @__PURE__ */ new Map());
|
|
9057
9532
|
pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
9058
|
-
const [pluginStates, setPluginStates] =
|
|
9533
|
+
const [pluginStates, setPluginStates] = useState24(() => Object.fromEntries(
|
|
9059
9534
|
sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
|
|
9060
9535
|
));
|
|
9061
|
-
const pluginApisRef =
|
|
9062
|
-
const contextsRef =
|
|
9063
|
-
const mountedPluginsRef =
|
|
9536
|
+
const pluginApisRef = useRef24({});
|
|
9537
|
+
const contextsRef = useRef24(/* @__PURE__ */ new Map());
|
|
9538
|
+
const mountedPluginsRef = useRef24(/* @__PURE__ */ new Map());
|
|
9064
9539
|
const pipeline = { columns: baseColumns, rows: createTableRows(dataSource, getRowKey) };
|
|
9065
9540
|
const nextApis = {};
|
|
9066
9541
|
const contexts = /* @__PURE__ */ new Map();
|
|
@@ -9117,7 +9592,7 @@ function TableInner(props, ref) {
|
|
|
9117
9592
|
});
|
|
9118
9593
|
pluginApisRef.current = nextApis;
|
|
9119
9594
|
contextsRef.current = contexts;
|
|
9120
|
-
|
|
9595
|
+
useEffect17(() => {
|
|
9121
9596
|
const activePlugins2 = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
9122
9597
|
for (const [pluginId, mounted] of mountedPluginsRef.current) {
|
|
9123
9598
|
if (activePlugins2.get(pluginId) === mounted.plugin) continue;
|
|
@@ -9129,7 +9604,7 @@ function TableInner(props, ref) {
|
|
|
9129
9604
|
mountedPluginsRef.current.set(plugin.id, { plugin, cleanup: plugin.onMount(contextsRef.current.get(plugin.id)) });
|
|
9130
9605
|
}
|
|
9131
9606
|
}, [sortedPlugins]);
|
|
9132
|
-
|
|
9607
|
+
useEffect17(() => () => {
|
|
9133
9608
|
for (const mounted of mountedPluginsRef.current.values()) mounted.cleanup?.();
|
|
9134
9609
|
mountedPluginsRef.current.clear();
|
|
9135
9610
|
}, []);
|
|
@@ -9173,7 +9648,7 @@ function TableInner(props, ref) {
|
|
|
9173
9648
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-size", `${verticalThumb}px`);
|
|
9174
9649
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-position", `${verticalPosition}px`);
|
|
9175
9650
|
}, []);
|
|
9176
|
-
|
|
9651
|
+
useEffect17(() => {
|
|
9177
9652
|
const element = scrollRef.current;
|
|
9178
9653
|
if (!element || typeof ResizeObserver === "undefined") return;
|
|
9179
9654
|
const observer = new ResizeObserver(() => {
|
|
@@ -9186,19 +9661,19 @@ function TableInner(props, ref) {
|
|
|
9186
9661
|
updateScrollMetrics();
|
|
9187
9662
|
return () => observer.disconnect();
|
|
9188
9663
|
}, [updateScrollMetrics]);
|
|
9189
|
-
|
|
9664
|
+
useEffect17(() => {
|
|
9190
9665
|
updateScrollMetrics();
|
|
9191
9666
|
});
|
|
9192
|
-
const orderedColumns =
|
|
9193
|
-
const leafColumns =
|
|
9194
|
-
const headerRows =
|
|
9195
|
-
const measuredCells =
|
|
9667
|
+
const orderedColumns = useMemo10(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
|
|
9668
|
+
const leafColumns = useMemo10(() => flattenTableColumns(orderedColumns), [orderedColumns]);
|
|
9669
|
+
const headerRows = useMemo10(() => buildHeaderRows(orderedColumns), [orderedColumns]);
|
|
9670
|
+
const measuredCells = useRef24(/* @__PURE__ */ new WeakSet());
|
|
9196
9671
|
const autoWidthSignature = leafColumns.map((column) => `${column.key}:${column.autoWidth}:${resizedWidths[column.key] ?? ""}`).join("|");
|
|
9197
|
-
|
|
9672
|
+
useEffect17(() => {
|
|
9198
9673
|
measuredCells.current = /* @__PURE__ */ new WeakSet();
|
|
9199
9674
|
setAutoColumnWidths({});
|
|
9200
9675
|
}, [dataSource, baseColumns, size, autoWidthSignature]);
|
|
9201
|
-
|
|
9676
|
+
useEffect17(() => {
|
|
9202
9677
|
const autoWidthColumns = leafColumns.filter((column) => column.autoWidth && resizedWidths[column.key] === void 0);
|
|
9203
9678
|
const root = rootRef.current;
|
|
9204
9679
|
if (!root || autoWidthColumns.length === 0) return;
|
|
@@ -9267,12 +9742,13 @@ function TableInner(props, ref) {
|
|
|
9267
9742
|
}
|
|
9268
9743
|
const leftFixedEdgeKey = [...leafColumns].reverse().find((column) => normalizeFixed(column.fixed) === "left")?.key;
|
|
9269
9744
|
const rightFixedEdgeKey = leafColumns.find((column) => normalizeFixed(column.fixed) === "right")?.key;
|
|
9270
|
-
const canvas = renderMode === "canvas" && !sortedPlugins.some((plugin) => plugin.disableVirtual);
|
|
9745
|
+
const canvas = renderMode === "canvas" && !managedRowHeights && !sortedPlugins.some((plugin) => plugin.disableVirtual);
|
|
9271
9746
|
const shouldVirtualize = canvas || pipeline.rows.length > 100 || (virtual ?? pipeline.rows.length >= virtualThreshold) && !sortedPlugins.some((plugin) => plugin.disableVirtual);
|
|
9272
|
-
const
|
|
9747
|
+
const rowLayout = createRowHeightLayout(pipeline.rows, rowHeight, effectiveRowHeights, SIZE_ROW_HEIGHT[size]);
|
|
9748
|
+
const windowTop = Math.min(scrollTop, Math.max(0, rowLayout.total - viewportHeight));
|
|
9749
|
+
const firstVisibleIndex = rowLayout.indexAt(windowTop);
|
|
9273
9750
|
const startIndex = shouldVirtualize ? Math.max(0, firstVisibleIndex - overscan) : 0;
|
|
9274
|
-
const
|
|
9275
|
-
const endIndex = shouldVirtualize ? Math.min(pipeline.rows.length, startIndex + visibleCount) : pipeline.rows.length;
|
|
9751
|
+
const endIndex = shouldVirtualize ? Math.min(pipeline.rows.length, rowLayout.indexAt(windowTop + viewportHeight) + overscan + 1) : pipeline.rows.length;
|
|
9276
9752
|
const renderedRows = pipeline.rows.slice(startIndex, endIndex);
|
|
9277
9753
|
const visibleColumns = /* @__PURE__ */ new Set();
|
|
9278
9754
|
let columnLeft = 0;
|
|
@@ -9281,9 +9757,9 @@ function TableInner(props, ref) {
|
|
|
9281
9757
|
if (normalizeFixed(column.fixed) || columnLeft + width >= scrollLeft && columnLeft <= scrollLeft + viewportWidth) visibleColumns.add(column.key);
|
|
9282
9758
|
columnLeft += width;
|
|
9283
9759
|
}
|
|
9284
|
-
const topSpacer = shouldVirtualize ? startIndex
|
|
9285
|
-
const bottomSpacer = shouldVirtualize ?
|
|
9286
|
-
const rowElements =
|
|
9760
|
+
const topSpacer = shouldVirtualize ? rowLayout.offsets[startIndex] : 0;
|
|
9761
|
+
const bottomSpacer = shouldVirtualize ? rowLayout.total - rowLayout.offsets[endIndex] : 0;
|
|
9762
|
+
const rowElements = useMemo10(() => /* @__PURE__ */ new Map(), [
|
|
9287
9763
|
dataSource,
|
|
9288
9764
|
baseColumns,
|
|
9289
9765
|
sortedPlugins,
|
|
@@ -9295,6 +9771,12 @@ function TableInner(props, ref) {
|
|
|
9295
9771
|
rowClassName,
|
|
9296
9772
|
rowStatus,
|
|
9297
9773
|
getRowKey,
|
|
9774
|
+
effectiveRowHeights,
|
|
9775
|
+
managedRowHeights,
|
|
9776
|
+
rowResizable,
|
|
9777
|
+
resizeMin,
|
|
9778
|
+
resizeMax,
|
|
9779
|
+
commitRowHeight,
|
|
9298
9780
|
canvas,
|
|
9299
9781
|
scrollLeft,
|
|
9300
9782
|
onRowClick,
|
|
@@ -9303,20 +9785,20 @@ function TableInner(props, ref) {
|
|
|
9303
9785
|
]);
|
|
9304
9786
|
const toolbarStart = sortedPlugins.map((plugin) => {
|
|
9305
9787
|
const content = plugin.renderToolbarStart?.(getContext(plugin));
|
|
9306
|
-
return content ? /* @__PURE__ */
|
|
9788
|
+
return content ? /* @__PURE__ */ jsx29(Fragment9, { children: content }, `toolbar-start-${plugin.id}`) : null;
|
|
9307
9789
|
}).filter(Boolean);
|
|
9308
9790
|
const toolbarEnd = sortedPlugins.map((plugin) => {
|
|
9309
9791
|
const content = plugin.renderToolbarEnd?.(getContext(plugin));
|
|
9310
|
-
return content ? /* @__PURE__ */
|
|
9792
|
+
return content ? /* @__PURE__ */ jsx29(Fragment9, { children: content }, `toolbar-end-${plugin.id}`) : null;
|
|
9311
9793
|
}).filter(Boolean);
|
|
9312
9794
|
const summaries = sortedPlugins.flatMap((plugin) => plugin.renderSummary?.(getContext(plugin)) ?? []);
|
|
9313
9795
|
const footers = sortedPlugins.map((plugin) => {
|
|
9314
9796
|
const content = plugin.renderFooter?.(getContext(plugin));
|
|
9315
|
-
return content ? /* @__PURE__ */
|
|
9797
|
+
return content ? /* @__PURE__ */ jsx29(Fragment9, { children: content }, `footer-${plugin.id}`) : null;
|
|
9316
9798
|
}).filter(Boolean);
|
|
9317
9799
|
const overlays = sortedPlugins.map((plugin) => {
|
|
9318
9800
|
const content = plugin.renderOverlay?.(getContext(plugin));
|
|
9319
|
-
return content ? /* @__PURE__ */
|
|
9801
|
+
return content ? /* @__PURE__ */ jsx29(Fragment9, { children: content }, `overlay-${plugin.id}`) : null;
|
|
9320
9802
|
}).filter(Boolean);
|
|
9321
9803
|
const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
|
|
9322
9804
|
const effectiveHeight = height ?? tableHeight ?? remainingHeight ?? (shouldVirtualize && maxBodyHeight == null ? 420 : void 0);
|
|
@@ -9332,10 +9814,10 @@ function TableInner(props, ref) {
|
|
|
9332
9814
|
};
|
|
9333
9815
|
const handleScroll = useCallback2((event) => {
|
|
9334
9816
|
const element = event.currentTarget;
|
|
9335
|
-
if (shouldVirtualize) setScrollTop((previous) => Math.floor(previous / rowHeight)
|
|
9817
|
+
if (shouldVirtualize) setScrollTop((previous) => managedRowHeights || Math.floor(previous / rowHeight) !== Math.floor(element.scrollTop / rowHeight) ? element.scrollTop : previous);
|
|
9336
9818
|
if (canvas) setScrollLeft(element.scrollLeft);
|
|
9337
9819
|
updateScrollMetrics();
|
|
9338
|
-
}, [canvas, shouldVirtualize, rowHeight, updateScrollMetrics]);
|
|
9820
|
+
}, [canvas, shouldVirtualize, rowHeight, managedRowHeights, updateScrollMetrics]);
|
|
9339
9821
|
const handleScrollbarPointerDown = useCallback2((axis, event, track = event.currentTarget) => {
|
|
9340
9822
|
const element = scrollRef.current;
|
|
9341
9823
|
const thumb = track.firstElementChild;
|
|
@@ -9392,8 +9874,8 @@ function TableInner(props, ref) {
|
|
|
9392
9874
|
if (!viewport || !table || !viewport.clientHeight || index < 0) return false;
|
|
9393
9875
|
const row = Array.from(table.tBodies[0]?.rows ?? []).find((element) => element.dataset.rowKey === String(key));
|
|
9394
9876
|
const headerHeight = table.tHead?.offsetHeight ?? headerRows.length * rowHeight;
|
|
9395
|
-
const top = row ? row.getBoundingClientRect().top - viewport.getBoundingClientRect().top - viewport.clientTop + viewport.scrollTop : headerHeight + index
|
|
9396
|
-
const height2 = row?.offsetHeight ??
|
|
9877
|
+
const top = row ? row.getBoundingClientRect().top - viewport.getBoundingClientRect().top - viewport.clientTop + viewport.scrollTop : headerHeight + rowLayout.offsets[index];
|
|
9878
|
+
const height2 = row?.offsetHeight ?? rowLayout.sizes[index];
|
|
9397
9879
|
const headerInset = stickyHeader ? headerHeight : 0;
|
|
9398
9880
|
const footerInset = table.tFoot?.offsetHeight ?? 0;
|
|
9399
9881
|
const visibleTop = viewport.scrollTop + headerInset;
|
|
@@ -9472,7 +9954,7 @@ function TableInner(props, ref) {
|
|
|
9472
9954
|
}
|
|
9473
9955
|
};
|
|
9474
9956
|
return api;
|
|
9475
|
-
}, [dataSource.length, pipeline.columns, pipeline.rows, headerRows.length, rowHeight, stickyHeader, shouldVirtualize, updateScrollMetrics, leafColumns, columnWidths, left, right, canvas]);
|
|
9957
|
+
}, [dataSource.length, pipeline.columns, pipeline.rows, headerRows.length, rowHeight, rowLayout, stickyHeader, shouldVirtualize, updateScrollMetrics, leafColumns, columnWidths, left, right, canvas]);
|
|
9476
9958
|
const coreContext = {
|
|
9477
9959
|
pluginId: "core",
|
|
9478
9960
|
sourceData: dataSource,
|
|
@@ -9493,10 +9975,10 @@ function TableInner(props, ref) {
|
|
|
9493
9975
|
}
|
|
9494
9976
|
function renderHeaderContent(column, content) {
|
|
9495
9977
|
const title = getHeaderTitleText(column.title ?? column.name) || column.name || column.key;
|
|
9496
|
-
return /* @__PURE__ */
|
|
9497
|
-
column.required && /* @__PURE__ */
|
|
9498
|
-
/* @__PURE__ */
|
|
9499
|
-
column.description != null && /* @__PURE__ */
|
|
9978
|
+
return /* @__PURE__ */ jsxs25("span", { className: `sia-table__header-label${column.required ? " sia-table__header-label--required" : ""}`, children: [
|
|
9979
|
+
column.required && /* @__PURE__ */ jsx29("span", { className: "sia-table__required-mark", "aria-hidden": "true", children: "*" }),
|
|
9980
|
+
/* @__PURE__ */ jsx29("span", { className: "sia-table__header-label-content", "data-sia-title-overflow-only": true, ...withTitleTooltip({ title }), children: content }),
|
|
9981
|
+
column.description != null && /* @__PURE__ */ jsx29(Tooltip, { title: column.description, placement: "top", trigger: ["hover", "focus"], children: /* @__PURE__ */ jsx29("button", { type: "button", className: "sia-table__header-description", "aria-label": `${column.name ?? column.key}\u5217\u8BF4\u660E`, onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx29(Icon, { name: "info", size: 14 }) }) })
|
|
9500
9982
|
] });
|
|
9501
9983
|
}
|
|
9502
9984
|
function getPluginCellProps(row, column) {
|
|
@@ -9536,17 +10018,17 @@ function TableInner(props, ref) {
|
|
|
9536
10018
|
}
|
|
9537
10019
|
function renderSummaryRow(summary) {
|
|
9538
10020
|
let labelRendered = false;
|
|
9539
|
-
return /* @__PURE__ */
|
|
10021
|
+
return /* @__PURE__ */ jsx29("tr", { className: `sia-table__summary-row ${summary.className ?? ""}`.trim(), children: leafColumns.map((column) => {
|
|
9540
10022
|
const value = summary.values[column.key];
|
|
9541
10023
|
const isLabel = value === void 0 && !labelRendered && summary.label !== void 0;
|
|
9542
10024
|
const content = value !== void 0 ? value : isLabel ? (labelRendered = true, summary.label) : null;
|
|
9543
10025
|
const fixed = normalizeFixed(column.fixed);
|
|
9544
10026
|
const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
9545
10027
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
9546
|
-
return /* @__PURE__ */
|
|
10028
|
+
return /* @__PURE__ */ jsx29("td", { "data-column-key": column.key, className: `sia-table__cell sia-table__cell--${column.align ?? "left"} sia-table__summary-cell${isLabel ? " sia-table__summary-cell--label" : ""}${fixed ? ` sia-table__cell--fixed sia-table__cell--fixed-${fixed}` : ""}${fixedEdgeClass}${autoWidthClass}`, style: getFixedStyle(column), children: isLabel ? /* @__PURE__ */ jsx29("span", { className: "sia-table__summary-label", children: content }) : content }, column.key);
|
|
9547
10029
|
}) }, summary.key);
|
|
9548
10030
|
}
|
|
9549
|
-
return /* @__PURE__ */
|
|
10031
|
+
return /* @__PURE__ */ jsxs25(
|
|
9550
10032
|
"div",
|
|
9551
10033
|
{
|
|
9552
10034
|
ref: rootRef,
|
|
@@ -9597,19 +10079,19 @@ function TableInner(props, ref) {
|
|
|
9597
10079
|
htmlProps.onDoubleClickCapture?.(event);
|
|
9598
10080
|
},
|
|
9599
10081
|
children: [
|
|
9600
|
-
hasToolbar ? /* @__PURE__ */
|
|
9601
|
-
/* @__PURE__ */
|
|
9602
|
-
/* @__PURE__ */
|
|
10082
|
+
hasToolbar ? /* @__PURE__ */ jsxs25("div", { className: "sia-table__toolbar", children: [
|
|
10083
|
+
/* @__PURE__ */ jsx29("div", { children: toolbarStart }),
|
|
10084
|
+
/* @__PURE__ */ jsx29("div", { children: toolbarEnd })
|
|
9603
10085
|
] }) : null,
|
|
9604
|
-
/* @__PURE__ */
|
|
9605
|
-
/* @__PURE__ */
|
|
9606
|
-
/* @__PURE__ */
|
|
9607
|
-
/* @__PURE__ */
|
|
10086
|
+
/* @__PURE__ */ jsxs25("div", { className: "sia-table__viewport-wrap", style: viewportStyle, children: [
|
|
10087
|
+
/* @__PURE__ */ jsx29("div", { className: "sia-table__viewport", ref: scrollRef, onScroll: handleScroll, children: /* @__PURE__ */ jsxs25("table", { ref: tableRef, className: "sia-table__element", style: { width: Math.max(totalWidth, 1), ...manualColumnLayout ? { minWidth: 0 } : {}, ...tableStyle }, children: [
|
|
10088
|
+
/* @__PURE__ */ jsx29("colgroup", { children: leafColumns.map((column) => /* @__PURE__ */ jsx29("col", { "data-column-key": column.key, style: { width: columnWidths.get(column.key) ?? DEFAULT_WIDTH } }, column.key)) }),
|
|
10089
|
+
/* @__PURE__ */ jsx29("thead", { className: stickyHeader ? "sia-table__head sia-table__head--sticky" : "sia-table__head", children: headerRows.map((headerRow, depth) => /* @__PURE__ */ jsx29("tr", { children: headerRow.map((cell) => {
|
|
9608
10090
|
const fixed = cell.fixed;
|
|
9609
10091
|
const pluginHeaderProps = getPluginHeaderCellProps(cell.column);
|
|
9610
10092
|
const fixedEdgeClass = fixed === "left" && cell.column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && cell.column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
9611
10093
|
const autoWidthClass = cell.column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
9612
|
-
return /* @__PURE__ */
|
|
10094
|
+
return /* @__PURE__ */ jsx29(
|
|
9613
10095
|
"th",
|
|
9614
10096
|
{
|
|
9615
10097
|
"data-column-key": cell.column.key,
|
|
@@ -9630,10 +10112,10 @@ function TableInner(props, ref) {
|
|
|
9630
10112
|
`${cell.column.key}-${depth}-${cell.firstLeafKey}`
|
|
9631
10113
|
);
|
|
9632
10114
|
}) }, depth)) }),
|
|
9633
|
-
/* @__PURE__ */
|
|
9634
|
-
maxBodyHeight != null && pipeline.rows.length === 0 ? /* @__PURE__ */
|
|
9635
|
-
pipeline.rows.length === 0 && summaries.length > 0 ? /* @__PURE__ */
|
|
9636
|
-
topSpacer > 0 ? /* @__PURE__ */
|
|
10115
|
+
/* @__PURE__ */ jsxs25("tbody", { children: [
|
|
10116
|
+
maxBodyHeight != null && pipeline.rows.length === 0 ? /* @__PURE__ */ jsx29("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx29("td", { colSpan: leafColumns.length, style: { height: 120, padding: 0, border: 0 } }) }) : null,
|
|
10117
|
+
pipeline.rows.length === 0 && summaries.length > 0 ? /* @__PURE__ */ jsx29("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx29("td", { colSpan: leafColumns.length, style: { height: Math.max(0, viewportHeight - (headerRows.length + summaries.length) * rowHeight), padding: 0, border: 0 } }) }) : null,
|
|
10118
|
+
topSpacer > 0 ? /* @__PURE__ */ jsx29("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx29("td", { colSpan: leafColumns.length, style: { height: topSpacer, padding: 0, border: 0 } }) }) : null,
|
|
9637
10119
|
renderedRows.map((row, offset) => {
|
|
9638
10120
|
const cached = rowElements.get(row.key);
|
|
9639
10121
|
if (cached) return cached;
|
|
@@ -9642,7 +10124,7 @@ function TableInner(props, ref) {
|
|
|
9642
10124
|
const status = typeof rowStatus === "function" ? rowStatus(row.record, row.sourceIndex) : rowStatus;
|
|
9643
10125
|
const statusClass = status ? `sia-table__row--${status}` : "";
|
|
9644
10126
|
const customClass = typeof rowClassName === "function" ? rowClassName(row.record, row.sourceIndex) : rowClassName ?? "";
|
|
9645
|
-
const element = /* @__PURE__ */
|
|
10127
|
+
const element = /* @__PURE__ */ jsx29(
|
|
9646
10128
|
TableBodyRow,
|
|
9647
10129
|
{
|
|
9648
10130
|
canvas,
|
|
@@ -9655,7 +10137,14 @@ function TableInner(props, ref) {
|
|
|
9655
10137
|
leftFixedEdgeKey,
|
|
9656
10138
|
rightFixedEdgeKey,
|
|
9657
10139
|
striped,
|
|
9658
|
-
rowHeight,
|
|
10140
|
+
rowHeight: rowLayout.sizes[rowIndex],
|
|
10141
|
+
managedHeight: managedRowHeights,
|
|
10142
|
+
resize: rowResizable ? {
|
|
10143
|
+
min: resizeMin,
|
|
10144
|
+
max: resizeMax,
|
|
10145
|
+
onPreview: (height2) => setRowHeightPreview(height2 === null ? null : { key: String(row.key), height: height2 }),
|
|
10146
|
+
onCommit: (height2) => commitRowHeight(row, height2)
|
|
10147
|
+
} : void 0,
|
|
9659
10148
|
className: `${statusClass} ${pluginClasses} ${customClass}`.trim(),
|
|
9660
10149
|
onClick: () => {
|
|
9661
10150
|
for (const plugin of sortedPlugins) plugin.onRowClick?.(row, getContext(plugin));
|
|
@@ -9693,13 +10182,13 @@ function TableInner(props, ref) {
|
|
|
9693
10182
|
rowElements.set(row.key, element);
|
|
9694
10183
|
return element;
|
|
9695
10184
|
}),
|
|
9696
|
-
bottomSpacer > 0 ? /* @__PURE__ */
|
|
10185
|
+
bottomSpacer > 0 ? /* @__PURE__ */ jsx29("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx29("td", { colSpan: leafColumns.length, style: { height: bottomSpacer, padding: 0, border: 0 } }) }) : null
|
|
9697
10186
|
] }),
|
|
9698
|
-
summaries.length > 0 ? /* @__PURE__ */
|
|
10187
|
+
summaries.length > 0 ? /* @__PURE__ */ jsx29("tfoot", { className: "sia-table__summary", children: summaries.map(renderSummaryRow) }) : null
|
|
9699
10188
|
] }) }),
|
|
9700
|
-
pipeline.rows.length === 0 ? /* @__PURE__ */
|
|
9701
|
-
canvas ? /* @__PURE__ */
|
|
9702
|
-
/* @__PURE__ */
|
|
10189
|
+
pipeline.rows.length === 0 ? /* @__PURE__ */ jsx29("div", { className: "sia-table__empty", role: "status", children: emptyText }) : null,
|
|
10190
|
+
canvas ? /* @__PURE__ */ jsx29(TableCanvasLayer, { viewport: scrollRef, rows: pipeline.rows, columns: leafColumns, widths: columnWidths, rowHeight, headerHeight: headerRows.length * rowHeight }) : null,
|
|
10191
|
+
/* @__PURE__ */ jsx29(
|
|
9703
10192
|
"div",
|
|
9704
10193
|
{
|
|
9705
10194
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--horizontal",
|
|
@@ -9710,10 +10199,10 @@ function TableInner(props, ref) {
|
|
|
9710
10199
|
onPointerMove: handleScrollbarPointerMove,
|
|
9711
10200
|
onPointerUp: handleScrollbarPointerEnd,
|
|
9712
10201
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
9713
|
-
children: /* @__PURE__ */
|
|
10202
|
+
children: /* @__PURE__ */ jsx29("div", { className: "sia-table__scrollbar-thumb" })
|
|
9714
10203
|
}
|
|
9715
10204
|
),
|
|
9716
|
-
/* @__PURE__ */
|
|
10205
|
+
/* @__PURE__ */ jsx29(
|
|
9717
10206
|
"div",
|
|
9718
10207
|
{
|
|
9719
10208
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--vertical",
|
|
@@ -9724,14 +10213,14 @@ function TableInner(props, ref) {
|
|
|
9724
10213
|
onPointerMove: handleScrollbarPointerMove,
|
|
9725
10214
|
onPointerUp: handleScrollbarPointerEnd,
|
|
9726
10215
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
9727
|
-
children: /* @__PURE__ */
|
|
10216
|
+
children: /* @__PURE__ */ jsx29("div", { className: "sia-table__scrollbar-thumb" })
|
|
9728
10217
|
}
|
|
9729
10218
|
)
|
|
9730
10219
|
] }),
|
|
9731
|
-
footers.length > 0 ? /* @__PURE__ */
|
|
9732
|
-
loading || internalLoading ? /* @__PURE__ */
|
|
9733
|
-
/* @__PURE__ */
|
|
9734
|
-
/* @__PURE__ */
|
|
10220
|
+
footers.length > 0 ? /* @__PURE__ */ jsx29("div", { className: "sia-table__footer", children: footers }) : null,
|
|
10221
|
+
loading || internalLoading ? /* @__PURE__ */ jsxs25("div", { className: "sia-table__loading", role: "status", children: [
|
|
10222
|
+
/* @__PURE__ */ jsx29(Icon, { name: "loader", size: 22, spin: true }),
|
|
10223
|
+
/* @__PURE__ */ jsx29("span", { children: "\u52A0\u8F7D\u4E2D" })
|
|
9735
10224
|
] }) : null,
|
|
9736
10225
|
overlays
|
|
9737
10226
|
]
|
|
@@ -9804,7 +10293,7 @@ function incrementWorksheetValue(value, offset) {
|
|
|
9804
10293
|
}
|
|
9805
10294
|
|
|
9806
10295
|
// src/components/Table/worksheet.tsx
|
|
9807
|
-
import { Fragment as Fragment10, jsx as
|
|
10296
|
+
import { Fragment as Fragment10, jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
9808
10297
|
var isEmpty2 = (value) => value == null || value === "";
|
|
9809
10298
|
var editorKind = (column) => !column.editable ? "readonly" : typeof column.editable === "object" ? column.editable.type ?? "input" : "input";
|
|
9810
10299
|
var nativeEditor = (target) => target instanceof Element && Boolean(
|
|
@@ -10104,25 +10593,34 @@ function createWorksheetPlugin(options) {
|
|
|
10104
10593
|
area && target >= 0 && fill(area, target, sourceCells(area), increment)
|
|
10105
10594
|
);
|
|
10106
10595
|
}
|
|
10107
|
-
function
|
|
10596
|
+
function fillDownValues() {
|
|
10108
10597
|
const area = bounds();
|
|
10109
10598
|
if (!area) return false;
|
|
10110
10599
|
const cells = sourceCells(area);
|
|
10600
|
+
const empty = options.isEmpty ?? isEmpty2;
|
|
10601
|
+
const cols = columns().slice(area.left, area.right + 1);
|
|
10111
10602
|
if (!cells.some(
|
|
10112
|
-
(row) => row.some((cell) => cell.kind !== "readonly" && !
|
|
10603
|
+
(row, index) => row.some((cell, columnIndex) => cell.kind !== "readonly" && !empty(cell.value, context.rows[area.top + index].record, cols[columnIndex]))
|
|
10113
10604
|
))
|
|
10114
10605
|
return false;
|
|
10115
|
-
const cols = columns().slice(area.left, area.right + 1);
|
|
10116
10606
|
let target = area.bottom;
|
|
10117
10607
|
for (let r = area.bottom + 1; r < context.rows.length; r++) {
|
|
10118
10608
|
if (cols.some(
|
|
10119
|
-
(column) => editable(context.rows[r].record, column) && !
|
|
10609
|
+
(column) => editable(context.rows[r].record, column) && !empty(valueAt(r, column), context.rows[r].record, column)
|
|
10120
10610
|
))
|
|
10121
10611
|
break;
|
|
10122
10612
|
target = r;
|
|
10123
10613
|
}
|
|
10124
10614
|
return fill(area, target, cells);
|
|
10125
10615
|
}
|
|
10616
|
+
function fillDown() {
|
|
10617
|
+
try {
|
|
10618
|
+
return fillDownValues();
|
|
10619
|
+
} catch (error) {
|
|
10620
|
+
options.onError?.(error);
|
|
10621
|
+
return false;
|
|
10622
|
+
}
|
|
10623
|
+
}
|
|
10126
10624
|
function pointTarget() {
|
|
10127
10625
|
if (!drag || !root) return;
|
|
10128
10626
|
const td = document.elementFromPoint(pointerX, pointerY)?.closest("td[data-column-key]");
|
|
@@ -10212,9 +10710,9 @@ function createWorksheetPlugin(options) {
|
|
|
10212
10710
|
const area = bounds(), cols = columns();
|
|
10213
10711
|
const handle = area && context.rows[area.bottom]?.key === info.row.key && cols[area.right]?.key === column.key && // 填充入口与编辑权限一致,避免只读格或保存锁定后仍暗示可以拖拽修改。
|
|
10214
10712
|
editable(record, column) && (suppressEditing || !context.state.editing);
|
|
10215
|
-
return /* @__PURE__ */
|
|
10713
|
+
return /* @__PURE__ */ jsxs26(Fragment10, { children: [
|
|
10216
10714
|
render ? render(value, record, index, info) : value,
|
|
10217
|
-
handle && /* @__PURE__ */
|
|
10715
|
+
handle && /* @__PURE__ */ jsx30(
|
|
10218
10716
|
"button",
|
|
10219
10717
|
{
|
|
10220
10718
|
type: "button",
|
|
@@ -10260,25 +10758,25 @@ function createWorksheetPlugin(options) {
|
|
|
10260
10758
|
},
|
|
10261
10759
|
renderToolbarStart(current) {
|
|
10262
10760
|
remember(current);
|
|
10263
|
-
return options.toolbar === false ? null : /* @__PURE__ */
|
|
10264
|
-
/* @__PURE__ */
|
|
10761
|
+
return options.toolbar === false ? null : /* @__PURE__ */ jsxs26("span", { className: "sia-table__worksheet-tools", children: [
|
|
10762
|
+
/* @__PURE__ */ jsx30(
|
|
10265
10763
|
Button,
|
|
10266
10764
|
{
|
|
10267
10765
|
variant: "text",
|
|
10268
10766
|
size: "small",
|
|
10269
|
-
icon: /* @__PURE__ */
|
|
10767
|
+
icon: /* @__PURE__ */ jsx30(Icon, { name: "undo" }),
|
|
10270
10768
|
disabled: !undoStack.length,
|
|
10271
10769
|
title: "\u64A4\u9500\uFF08Ctrl/Cmd + Z\uFF09",
|
|
10272
10770
|
onClick: api.undo,
|
|
10273
10771
|
children: "\u64A4\u9500"
|
|
10274
10772
|
}
|
|
10275
10773
|
),
|
|
10276
|
-
/* @__PURE__ */
|
|
10774
|
+
/* @__PURE__ */ jsx30(
|
|
10277
10775
|
Button,
|
|
10278
10776
|
{
|
|
10279
10777
|
variant: "text",
|
|
10280
10778
|
size: "small",
|
|
10281
|
-
icon: /* @__PURE__ */
|
|
10779
|
+
icon: /* @__PURE__ */ jsx30(Icon, { name: "redo" }),
|
|
10282
10780
|
disabled: !redoStack.length,
|
|
10283
10781
|
title: "\u6062\u590D\uFF08Ctrl/Cmd + Shift + Z \u6216 Ctrl/Cmd + Y\uFF09",
|
|
10284
10782
|
onClick: api.redo,
|
|
@@ -10289,7 +10787,7 @@ function createWorksheetPlugin(options) {
|
|
|
10289
10787
|
},
|
|
10290
10788
|
renderOverlay(current) {
|
|
10291
10789
|
remember(current);
|
|
10292
|
-
return /* @__PURE__ */
|
|
10790
|
+
return /* @__PURE__ */ jsx30(
|
|
10293
10791
|
"span",
|
|
10294
10792
|
{
|
|
10295
10793
|
hidden: true,
|
|
@@ -10377,14 +10875,14 @@ function createWorksheetPlugin(options) {
|
|
|
10377
10875
|
|
|
10378
10876
|
// src/components/Video.tsx
|
|
10379
10877
|
import { forwardRef as forwardRef7 } from "react";
|
|
10380
|
-
import { jsx as
|
|
10878
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
10381
10879
|
var Video = forwardRef7(function Video2({ controls = true, muted = false, playsInline = true, className = "", ...props }, ref) {
|
|
10382
|
-
return /* @__PURE__ */
|
|
10880
|
+
return /* @__PURE__ */ jsx31("video", { ...props, ref, controls, muted, playsInline, className: `sia-video ${className}`.trim() });
|
|
10383
10881
|
});
|
|
10384
10882
|
|
|
10385
10883
|
// src/components/InputSelect.tsx
|
|
10386
|
-
import { forwardRef as forwardRef8, useEffect as
|
|
10387
|
-
import { jsx as
|
|
10884
|
+
import { forwardRef as forwardRef8, useEffect as useEffect18, useRef as useRef25, useState as useState25 } from "react";
|
|
10885
|
+
import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
10388
10886
|
var InputSelect = forwardRef8(function InputSelect2({
|
|
10389
10887
|
options,
|
|
10390
10888
|
value,
|
|
@@ -10411,22 +10909,22 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10411
10909
|
...inputProps
|
|
10412
10910
|
}, forwardedRef) {
|
|
10413
10911
|
const size = useControlSize(sizeProp);
|
|
10414
|
-
const [internal, setInternal] =
|
|
10912
|
+
const [internal, setInternal] = useState25(defaultValue);
|
|
10415
10913
|
const current = value !== void 0 ? value : internal;
|
|
10416
10914
|
const values = normalizeSelectionValues(current == null ? [] : Array.isArray(current) ? current : [current], options);
|
|
10417
10915
|
const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
|
|
10418
|
-
const [draft, setDraft] =
|
|
10419
|
-
|
|
10916
|
+
const [draft, setDraft] = useState25(text);
|
|
10917
|
+
useEffect18(() => {
|
|
10420
10918
|
setDraft(text);
|
|
10421
10919
|
}, [text, current]);
|
|
10422
|
-
const [open, setOpen] =
|
|
10423
|
-
const [search, setSearch] =
|
|
10424
|
-
const [modalOpen, setModalOpen] =
|
|
10425
|
-
const [modalValues, setModalValues] =
|
|
10426
|
-
const [selectedOnly, setSelectedOnly] =
|
|
10427
|
-
const rootRef =
|
|
10428
|
-
const popupRef =
|
|
10429
|
-
const inputRef =
|
|
10920
|
+
const [open, setOpen] = useState25(false);
|
|
10921
|
+
const [search, setSearch] = useState25("");
|
|
10922
|
+
const [modalOpen, setModalOpen] = useState25(false);
|
|
10923
|
+
const [modalValues, setModalValues] = useState25([]);
|
|
10924
|
+
const [selectedOnly, setSelectedOnly] = useState25(false);
|
|
10925
|
+
const rootRef = useRef25(null);
|
|
10926
|
+
const popupRef = useRef25(null);
|
|
10927
|
+
const inputRef = useRef25(null);
|
|
10430
10928
|
const config = typeof enableModal === "object" ? enableModal : {};
|
|
10431
10929
|
function changeOpen(next) {
|
|
10432
10930
|
if (next && (disabled || loading)) return;
|
|
@@ -10446,7 +10944,7 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10446
10944
|
inputRef.current?.focus();
|
|
10447
10945
|
}
|
|
10448
10946
|
}
|
|
10449
|
-
|
|
10947
|
+
useEffect18(() => {
|
|
10450
10948
|
if (!open) return;
|
|
10451
10949
|
const outside = (event) => {
|
|
10452
10950
|
if (!rootRef.current?.contains(event.target) && !popupRef.current?.contains(event.target)) changeOpen(false);
|
|
@@ -10454,7 +10952,7 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10454
10952
|
document.addEventListener("pointerdown", outside);
|
|
10455
10953
|
return () => document.removeEventListener("pointerdown", outside);
|
|
10456
10954
|
}, [open, onOpenChange]);
|
|
10457
|
-
|
|
10955
|
+
useEffect18(() => {
|
|
10458
10956
|
if (disabled || loading) {
|
|
10459
10957
|
changeOpen(false);
|
|
10460
10958
|
setModalOpen(false);
|
|
@@ -10467,14 +10965,14 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10467
10965
|
setSelectedOnly(false);
|
|
10468
10966
|
setModalOpen(true);
|
|
10469
10967
|
}
|
|
10470
|
-
return /* @__PURE__ */
|
|
10968
|
+
return /* @__PURE__ */ jsxs27("div", { ref: rootRef, style, className: `sia-input-select${open || modalOpen ? " is-open" : ""} ${className}`, onKeyDown: (event) => {
|
|
10471
10969
|
if (event.key === "Escape" && open) {
|
|
10472
10970
|
event.stopPropagation();
|
|
10473
10971
|
changeOpen(false);
|
|
10474
10972
|
inputRef.current?.focus();
|
|
10475
10973
|
}
|
|
10476
10974
|
}, children: [
|
|
10477
|
-
/* @__PURE__ */
|
|
10975
|
+
/* @__PURE__ */ jsx32(
|
|
10478
10976
|
Input,
|
|
10479
10977
|
{
|
|
10480
10978
|
...inputProps,
|
|
@@ -10511,26 +11009,26 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10511
11009
|
emit(parseInput ? parseInput(next) : multiple ? next.split(",").map((item) => item.trim()).filter(Boolean) : next);
|
|
10512
11010
|
changeOpen(true);
|
|
10513
11011
|
},
|
|
10514
|
-
suffix: /* @__PURE__ */
|
|
10515
|
-
allowClear && draft && !disabled && /* @__PURE__ */
|
|
11012
|
+
suffix: /* @__PURE__ */ jsxs27("span", { className: "sia-input-select__suffix", children: [
|
|
11013
|
+
allowClear && draft && !disabled && /* @__PURE__ */ jsx32(Button, { className: "sia-input-select__clear", variant: "text", size: "small", disabled: loading, "aria-label": "\u6E05\u9664\u8F93\u5165\u9009\u62E9", onClick: (event) => {
|
|
10516
11014
|
event.stopPropagation();
|
|
10517
11015
|
setDraft("");
|
|
10518
11016
|
emit(multiple ? [] : void 0);
|
|
10519
11017
|
inputRef.current?.focus();
|
|
10520
11018
|
}, children: "\xD7" }),
|
|
10521
11019
|
suffix,
|
|
10522
|
-
enableModal && /* @__PURE__ */
|
|
11020
|
+
enableModal && /* @__PURE__ */ jsx32(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
|
|
10523
11021
|
event.stopPropagation();
|
|
10524
11022
|
openModal();
|
|
10525
11023
|
}, children: "\u2026" }),
|
|
10526
|
-
/* @__PURE__ */
|
|
11024
|
+
/* @__PURE__ */ jsx32(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
|
|
10527
11025
|
event.stopPropagation();
|
|
10528
11026
|
changeOpen(!open);
|
|
10529
|
-
}, children: /* @__PURE__ */
|
|
11027
|
+
}, children: /* @__PURE__ */ jsx32(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
|
|
10530
11028
|
] })
|
|
10531
11029
|
}
|
|
10532
11030
|
),
|
|
10533
|
-
/* @__PURE__ */
|
|
11031
|
+
/* @__PURE__ */ jsx32(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx32(
|
|
10534
11032
|
SelectionPanel,
|
|
10535
11033
|
{
|
|
10536
11034
|
options,
|
|
@@ -10545,7 +11043,7 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10545
11043
|
onSearch: setSearch
|
|
10546
11044
|
}
|
|
10547
11045
|
) }),
|
|
10548
|
-
enableModal && /* @__PURE__ */
|
|
11046
|
+
enableModal && /* @__PURE__ */ jsxs27(
|
|
10549
11047
|
Modal,
|
|
10550
11048
|
{
|
|
10551
11049
|
open: modalOpen,
|
|
@@ -10558,15 +11056,15 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10558
11056
|
setModalOpen(false);
|
|
10559
11057
|
},
|
|
10560
11058
|
children: [
|
|
10561
|
-
/* @__PURE__ */
|
|
10562
|
-
/* @__PURE__ */
|
|
10563
|
-
/* @__PURE__ */
|
|
11059
|
+
/* @__PURE__ */ jsxs27("div", { className: "sia-selection-panel__actions", role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
11060
|
+
/* @__PURE__ */ jsx32(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
11061
|
+
/* @__PURE__ */ jsxs27(Button, { role: "tab", "aria-selected": selectedOnly, variant: selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(true), children: [
|
|
10564
11062
|
"\u5DF2\u9009\u9879(",
|
|
10565
11063
|
modalValues.length,
|
|
10566
11064
|
")"
|
|
10567
11065
|
] })
|
|
10568
11066
|
] }),
|
|
10569
|
-
modalOpen && /* @__PURE__ */
|
|
11067
|
+
modalOpen && /* @__PURE__ */ jsx32(
|
|
10570
11068
|
SelectionPanel,
|
|
10571
11069
|
{
|
|
10572
11070
|
options,
|
|
@@ -10587,10 +11085,10 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10587
11085
|
});
|
|
10588
11086
|
|
|
10589
11087
|
// src/components/QueryForm.tsx
|
|
10590
|
-
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect9, useRef as
|
|
11088
|
+
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect9, useRef as useRef29, useState as useState28 } from "react";
|
|
10591
11089
|
|
|
10592
11090
|
// src/components/useQueryFormMotion.ts
|
|
10593
|
-
import { useLayoutEffect as useLayoutEffect8, useRef as
|
|
11091
|
+
import { useLayoutEffect as useLayoutEffect8, useRef as useRef26 } from "react";
|
|
10594
11092
|
function readLayout(row) {
|
|
10595
11093
|
const root = row.getBoundingClientRect();
|
|
10596
11094
|
const scaleX = root.width / row.offsetWidth || 1, scaleY = root.height / row.offsetHeight || 1;
|
|
@@ -10603,9 +11101,9 @@ function readLayout(row) {
|
|
|
10603
11101
|
return { height: row.offsetHeight, boxes };
|
|
10604
11102
|
}
|
|
10605
11103
|
function useQueryFormMotion(ref, layoutKey) {
|
|
10606
|
-
const previous =
|
|
10607
|
-
const stop =
|
|
10608
|
-
const snapshot =
|
|
11104
|
+
const previous = useRef26();
|
|
11105
|
+
const stop = useRef26();
|
|
11106
|
+
const snapshot = useRef26();
|
|
10609
11107
|
useLayoutEffect8(() => {
|
|
10610
11108
|
const row = ref.current;
|
|
10611
11109
|
if (!row) return;
|
|
@@ -10714,10 +11212,10 @@ function useQueryFormMotion(ref, layoutKey) {
|
|
|
10714
11212
|
}
|
|
10715
11213
|
|
|
10716
11214
|
// src/components/QueryFormSettings.tsx
|
|
10717
|
-
import { useEffect as
|
|
11215
|
+
import { useEffect as useEffect20, useRef as useRef28, useState as useState27 } from "react";
|
|
10718
11216
|
|
|
10719
11217
|
// src/components/useQueryFieldSort.ts
|
|
10720
|
-
import { useEffect as
|
|
11218
|
+
import { useEffect as useEffect19, useRef as useRef27, useState as useState26 } from "react";
|
|
10721
11219
|
function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
10722
11220
|
const center = rects[from].top + rects[from].height / 2 + dy;
|
|
10723
11221
|
const rest = keys.map((_, index) => index).filter((index) => index !== from);
|
|
@@ -10736,13 +11234,13 @@ function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
|
10736
11234
|
return { ordered, offsets };
|
|
10737
11235
|
}
|
|
10738
11236
|
function useQueryFieldSort(keys, enabled, onCommit) {
|
|
10739
|
-
const listRef =
|
|
10740
|
-
const cancelRef =
|
|
10741
|
-
const commitRef =
|
|
11237
|
+
const listRef = useRef27(null);
|
|
11238
|
+
const cancelRef = useRef27();
|
|
11239
|
+
const commitRef = useRef27(onCommit);
|
|
10742
11240
|
commitRef.current = onCommit;
|
|
10743
|
-
const [preview, setPreview] =
|
|
11241
|
+
const [preview, setPreview] = useState26();
|
|
10744
11242
|
const signature = JSON.stringify(keys);
|
|
10745
|
-
|
|
11243
|
+
useEffect19(() => {
|
|
10746
11244
|
cancelRef.current?.();
|
|
10747
11245
|
return () => cancelRef.current?.();
|
|
10748
11246
|
}, [enabled, signature]);
|
|
@@ -10865,18 +11363,18 @@ function countQueryFieldRows(centers) {
|
|
|
10865
11363
|
}
|
|
10866
11364
|
|
|
10867
11365
|
// src/components/QueryFormSettings.tsx
|
|
10868
|
-
import { Fragment as Fragment11, jsx as
|
|
11366
|
+
import { Fragment as Fragment11, jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
10869
11367
|
function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed, disabled) {
|
|
10870
|
-
const [snapshot, setSnapshot] =
|
|
10871
|
-
const [draft, setDraft] =
|
|
10872
|
-
const [open, setOpen] =
|
|
10873
|
-
const [loading, setLoading] =
|
|
10874
|
-
const [saving, setSaving] =
|
|
10875
|
-
const [error, setError] =
|
|
10876
|
-
const [loadFailed, setLoadFailed] =
|
|
10877
|
-
const token =
|
|
10878
|
-
const saveLock =
|
|
10879
|
-
const latest =
|
|
11368
|
+
const [snapshot, setSnapshot] = useState27();
|
|
11369
|
+
const [draft, setDraft] = useState27({ fields: [], defaultCollapsed: defaultCollapsed ?? false });
|
|
11370
|
+
const [open, setOpen] = useState27(false);
|
|
11371
|
+
const [loading, setLoading] = useState27(false);
|
|
11372
|
+
const [saving, setSaving] = useState27(false);
|
|
11373
|
+
const [error, setError] = useState27("");
|
|
11374
|
+
const [loadFailed, setLoadFailed] = useState27(false);
|
|
11375
|
+
const token = useRef28(0);
|
|
11376
|
+
const saveLock = useRef28(false);
|
|
11377
|
+
const latest = useRef28({ config, fields, defaultCollapsed, applyCollapsed });
|
|
10880
11378
|
latest.current = { config, fields, defaultCollapsed, applyCollapsed };
|
|
10881
11379
|
const moduleName = config?.scope.moduleName;
|
|
10882
11380
|
const businessKey = config?.scope.businessKey;
|
|
@@ -10904,7 +11402,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10904
11402
|
if (request === token.current) setLoading(false);
|
|
10905
11403
|
}
|
|
10906
11404
|
}
|
|
10907
|
-
|
|
11405
|
+
useEffect20(() => {
|
|
10908
11406
|
setSnapshot(void 0);
|
|
10909
11407
|
setOpen(false);
|
|
10910
11408
|
setError("");
|
|
@@ -10960,7 +11458,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10960
11458
|
const items = new Map(visibleDraft.map((item) => [item.key, item]));
|
|
10961
11459
|
setDraft((current) => ({ ...current, fields: keys.map((key, order) => ({ ...items.get(key), order })) }));
|
|
10962
11460
|
});
|
|
10963
|
-
const control = config ? /* @__PURE__ */
|
|
11461
|
+
const control = config ? /* @__PURE__ */ jsx33(
|
|
10964
11462
|
Button,
|
|
10965
11463
|
{
|
|
10966
11464
|
type: "button",
|
|
@@ -10969,16 +11467,16 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10969
11467
|
"aria-label": "\u67E5\u8BE2\u8BBE\u7F6E",
|
|
10970
11468
|
disabled: disabled || saving,
|
|
10971
11469
|
loading: loading && !open,
|
|
10972
|
-
icon: /* @__PURE__ */
|
|
11470
|
+
icon: /* @__PURE__ */ jsx33(Icon, { name: "more-vertical" }),
|
|
10973
11471
|
onClick: () => {
|
|
10974
11472
|
setOpen(true);
|
|
10975
11473
|
void load(true);
|
|
10976
11474
|
}
|
|
10977
11475
|
}
|
|
10978
11476
|
) : null;
|
|
10979
|
-
const panel = config ? /* @__PURE__ */
|
|
10980
|
-
!open && error ? /* @__PURE__ */
|
|
10981
|
-
/* @__PURE__ */
|
|
11477
|
+
const panel = config ? /* @__PURE__ */ jsxs28(Fragment11, { children: [
|
|
11478
|
+
!open && error ? /* @__PURE__ */ jsx33("span", { className: "sia-query-form__error", role: "alert", children: "\u67E5\u8BE2\u8BBE\u7F6E\u8BFB\u53D6\u5931\u8D25\uFF0C\u8BF7\u6253\u5F00\u8BBE\u7F6E\u91CD\u8BD5" }) : null,
|
|
11479
|
+
/* @__PURE__ */ jsx33(
|
|
10982
11480
|
Modal,
|
|
10983
11481
|
{
|
|
10984
11482
|
title: "\u67E5\u8BE2\u8BBE\u7F6E",
|
|
@@ -10991,15 +11489,15 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10991
11489
|
onOpenChange: (next) => {
|
|
10992
11490
|
if (!saveLock.current) setOpen(next);
|
|
10993
11491
|
},
|
|
10994
|
-
children: /* @__PURE__ */
|
|
10995
|
-
loading ? /* @__PURE__ */
|
|
10996
|
-
error ? /* @__PURE__ */
|
|
11492
|
+
children: /* @__PURE__ */ jsxs28("div", { className: "sia-query-settings", children: [
|
|
11493
|
+
loading ? /* @__PURE__ */ jsx33("p", { role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u67E5\u8BE2\u8BBE\u7F6E\u2026" }) : null,
|
|
11494
|
+
error ? /* @__PURE__ */ jsxs28("div", { role: "alert", className: "sia-query-form__error", children: [
|
|
10997
11495
|
error,
|
|
10998
|
-
loadFailed ? /* @__PURE__ */
|
|
11496
|
+
loadFailed ? /* @__PURE__ */ jsx33(Button, { type: "button", variant: "link", onClick: () => void load(true), children: "\u91CD\u8BD5" }) : null
|
|
10999
11497
|
] }) : null,
|
|
11000
|
-
/* @__PURE__ */
|
|
11001
|
-
/* @__PURE__ */
|
|
11002
|
-
/* @__PURE__ */
|
|
11498
|
+
/* @__PURE__ */ jsx33(Checkbox, { checked: draft.defaultCollapsed, disabled: locked, onChange: (checked) => setDraft((current) => ({ ...current, defaultCollapsed: checked })), children: "\u9ED8\u8BA4\u6536\u8D77\u67E5\u8BE2\u6761\u4EF6" }),
|
|
11499
|
+
/* @__PURE__ */ jsx33("p", { className: "sia-query-settings__hint", children: "\u52FE\u9009\u9700\u8981\u663E\u793A\u7684\u6761\u4EF6\uFF0C\u62D6\u52A8\u6216\u4F7F\u7528\u4E0A\u4E0B\u6309\u94AE\u8C03\u6574\u987A\u5E8F\u3002" }),
|
|
11500
|
+
/* @__PURE__ */ jsx33("div", { ref: sort.listRef, className: `sia-query-settings__list${sort.preview ? " is-sorting" : ""}`, children: visibleDraft.map((item, index) => /* @__PURE__ */ jsxs28(
|
|
11003
11501
|
"div",
|
|
11004
11502
|
{
|
|
11005
11503
|
"data-query-field-key": item.key,
|
|
@@ -11007,18 +11505,18 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11007
11505
|
style: sort.preview ? { transform: `translateY(${sort.preview.offsets[item.key] ?? 0}px)` } : void 0,
|
|
11008
11506
|
onPointerDown: (event) => sort.start(event, item.key),
|
|
11009
11507
|
children: [
|
|
11010
|
-
/* @__PURE__ */
|
|
11011
|
-
/* @__PURE__ */
|
|
11012
|
-
/* @__PURE__ */
|
|
11013
|
-
/* @__PURE__ */
|
|
11014
|
-
/* @__PURE__ */
|
|
11015
|
-
/* @__PURE__ */
|
|
11508
|
+
/* @__PURE__ */ jsx33(Icon, { name: "menu", size: 15 }),
|
|
11509
|
+
/* @__PURE__ */ jsx33(Checkbox, { "aria-label": `\u663E\u793A ${item.key}`, checked: item.visible, disabled: locked || hideDisabledKeys.has(item.key), onChange: (checked) => setDraft((current) => ({ ...current, fields: visibleDraft.map((field) => field.key === item.key ? { ...field, visible: checked } : field) })) }),
|
|
11510
|
+
/* @__PURE__ */ jsx33("span", { className: "sia-query-settings__name", children: labels.get(item.key) ?? item.key }),
|
|
11511
|
+
/* @__PURE__ */ jsxs28("div", { className: "sia-query-settings__order", children: [
|
|
11512
|
+
/* @__PURE__ */ jsx33(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0A\u79FB ${item.key}`, disabled: locked || index === 0, icon: /* @__PURE__ */ jsx33(Icon, { name: "chevron-up" }), onClick: () => move(index, index - 1) }),
|
|
11513
|
+
/* @__PURE__ */ jsx33(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0B\u79FB ${item.key}`, disabled: locked || index === visibleDraft.length - 1, icon: /* @__PURE__ */ jsx33(Icon, { name: "chevron-down" }), onClick: () => move(index, index + 1) })
|
|
11016
11514
|
] })
|
|
11017
11515
|
]
|
|
11018
11516
|
},
|
|
11019
11517
|
item.key
|
|
11020
11518
|
)) }),
|
|
11021
|
-
/* @__PURE__ */
|
|
11519
|
+
/* @__PURE__ */ jsx33(Button, { type: "button", disabled: locked, onClick: () => setDraft({ fields: reconcileQueryFields(fields.map((field) => field.key)), defaultCollapsed: defaultCollapsed ?? false }), children: "\u6062\u590D\u9ED8\u8BA4" })
|
|
11022
11520
|
] })
|
|
11023
11521
|
}
|
|
11024
11522
|
)
|
|
@@ -11027,7 +11525,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11027
11525
|
}
|
|
11028
11526
|
|
|
11029
11527
|
// src/components/QueryForm.tsx
|
|
11030
|
-
import { jsx as
|
|
11528
|
+
import { jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
11031
11529
|
function QueryForm({
|
|
11032
11530
|
fields,
|
|
11033
11531
|
settings,
|
|
@@ -11062,23 +11560,23 @@ function QueryForm({
|
|
|
11062
11560
|
...formProps
|
|
11063
11561
|
}) {
|
|
11064
11562
|
const [form] = useForm(providedForm);
|
|
11065
|
-
const [internalCollapsed, setInternalCollapsed] =
|
|
11066
|
-
const [expandedRows, setExpandedRows] =
|
|
11067
|
-
const [needsCollapse, setNeedsCollapse] =
|
|
11563
|
+
const [internalCollapsed, setInternalCollapsed] = useState28(defaultCollapsed);
|
|
11564
|
+
const [expandedRows, setExpandedRows] = useState28(0);
|
|
11565
|
+
const [needsCollapse, setNeedsCollapse] = useState28(false);
|
|
11068
11566
|
const collapsed = collapsible && needsCollapse && (controlledCollapsed ?? internalCollapsed ?? expandedRows >= 3);
|
|
11069
|
-
const [searching, setSearching] =
|
|
11070
|
-
const [saving, setSaving] =
|
|
11071
|
-
const [removing, setRemoving] =
|
|
11072
|
-
const [saveOpen, setSaveOpen] =
|
|
11073
|
-
const [saveName, setSaveName] =
|
|
11074
|
-
const [saveError, setSaveError] =
|
|
11075
|
-
const [error, setError] =
|
|
11076
|
-
const [activeShortcut, setActiveShortcut] =
|
|
11077
|
-
const source =
|
|
11078
|
-
const searchLock =
|
|
11079
|
-
const saveLock =
|
|
11080
|
-
const removeLock =
|
|
11081
|
-
const snapshot =
|
|
11567
|
+
const [searching, setSearching] = useState28(false);
|
|
11568
|
+
const [saving, setSaving] = useState28(false);
|
|
11569
|
+
const [removing, setRemoving] = useState28(false);
|
|
11570
|
+
const [saveOpen, setSaveOpen] = useState28(false);
|
|
11571
|
+
const [saveName, setSaveName] = useState28("");
|
|
11572
|
+
const [saveError, setSaveError] = useState28("");
|
|
11573
|
+
const [error, setError] = useState28("");
|
|
11574
|
+
const [activeShortcut, setActiveShortcut] = useState28("");
|
|
11575
|
+
const source = useRef29({ source: "submit" });
|
|
11576
|
+
const searchLock = useRef29(false);
|
|
11577
|
+
const saveLock = useRef29(false);
|
|
11578
|
+
const removeLock = useRef29(false);
|
|
11579
|
+
const snapshot = useRef29();
|
|
11082
11580
|
const busy = disabled || loading || searching;
|
|
11083
11581
|
const shortcutBusy = busy || shortcutsLoading || saving || removing;
|
|
11084
11582
|
const fieldLabel = (content) => {
|
|
@@ -11090,7 +11588,7 @@ function QueryForm({
|
|
|
11090
11588
|
width,
|
|
11091
11589
|
hideDisabled: settingsHideDisabled,
|
|
11092
11590
|
label: settingsLabel ?? item.label ?? (typeof item.children === "function" ? void 0 : fieldLabel(item.children)) ?? key,
|
|
11093
|
-
content: /* @__PURE__ */
|
|
11591
|
+
content: /* @__PURE__ */ jsx34(Form.Item, { noStyle: true, ...item })
|
|
11094
11592
|
})) : Children4.toArray(children).map((content, index) => ({
|
|
11095
11593
|
key: isValidElement5(content) && content.key != null ? String(content.key) : String(index),
|
|
11096
11594
|
width: void 0,
|
|
@@ -11105,11 +11603,11 @@ function QueryForm({
|
|
|
11105
11603
|
const entries = configured.map((item) => ({ ...entriesByKey.get(item.key), visible: item.visible, visibleIndex: item.visible ? visibleIndex++ : -1 }));
|
|
11106
11604
|
const layoutKey = JSON.stringify(configured);
|
|
11107
11605
|
const limit = Math.max(1, Math.floor(collapsedCount));
|
|
11108
|
-
const rowRef =
|
|
11109
|
-
const actionsRef =
|
|
11110
|
-
const toggleRef =
|
|
11111
|
-
const [fittingCount, setFittingCount] =
|
|
11112
|
-
const [settingsRows, setSettingsRows] =
|
|
11606
|
+
const rowRef = useRef29(null);
|
|
11607
|
+
const actionsRef = useRef29(null);
|
|
11608
|
+
const toggleRef = useRef29(null);
|
|
11609
|
+
const [fittingCount, setFittingCount] = useState28(limit);
|
|
11610
|
+
const [settingsRows, setSettingsRows] = useState28(0);
|
|
11113
11611
|
useLayoutEffect9(() => {
|
|
11114
11612
|
const row = rowRef.current;
|
|
11115
11613
|
const actions = actionsRef.current;
|
|
@@ -11273,8 +11771,8 @@ function QueryForm({
|
|
|
11273
11771
|
setRemoving(false);
|
|
11274
11772
|
}
|
|
11275
11773
|
}
|
|
11276
|
-
return /* @__PURE__ */
|
|
11277
|
-
/* @__PURE__ */
|
|
11774
|
+
return /* @__PURE__ */ jsxs29("div", { className: `sia-query-form ${className}`.trim(), children: [
|
|
11775
|
+
/* @__PURE__ */ jsxs29(
|
|
11278
11776
|
Form,
|
|
11279
11777
|
{
|
|
11280
11778
|
...formProps,
|
|
@@ -11293,8 +11791,8 @@ function QueryForm({
|
|
|
11293
11791
|
onValuesChange?.(changed, values);
|
|
11294
11792
|
},
|
|
11295
11793
|
children: [
|
|
11296
|
-
quickQueries.length ? /* @__PURE__ */
|
|
11297
|
-
quickQueries.map((query) => /* @__PURE__ */
|
|
11794
|
+
quickQueries.length ? /* @__PURE__ */ jsxs29("div", { className: "sia-query-form__quick", "aria-label": "\u9884\u8BBE\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
11795
|
+
quickQueries.map((query) => /* @__PURE__ */ jsx34(
|
|
11298
11796
|
Badge,
|
|
11299
11797
|
{
|
|
11300
11798
|
className: "sia-query-form__quick-badge",
|
|
@@ -11303,7 +11801,7 @@ function QueryForm({
|
|
|
11303
11801
|
title: query.count === void 0 ? void 0 : `\u5171 ${query.count} \u6761`,
|
|
11304
11802
|
...query.badgeProps,
|
|
11305
11803
|
count: query.count,
|
|
11306
|
-
children: /* @__PURE__ */
|
|
11804
|
+
children: /* @__PURE__ */ jsx34(
|
|
11307
11805
|
Button,
|
|
11308
11806
|
{
|
|
11309
11807
|
size: query.size ?? quickQuerySize,
|
|
@@ -11319,7 +11817,7 @@ function QueryForm({
|
|
|
11319
11817
|
)),
|
|
11320
11818
|
" "
|
|
11321
11819
|
] }) : null,
|
|
11322
|
-
/* @__PURE__ */
|
|
11820
|
+
/* @__PURE__ */ jsx34("div", { className: "sia-query-form__motion", children: /* @__PURE__ */ jsxs29(
|
|
11323
11821
|
"div",
|
|
11324
11822
|
{
|
|
11325
11823
|
ref: rowRef,
|
|
@@ -11328,7 +11826,7 @@ function QueryForm({
|
|
|
11328
11826
|
"--sia-query-field-width": typeof fieldWidth === "number" ? `${fieldWidth}px` : fieldWidth
|
|
11329
11827
|
},
|
|
11330
11828
|
children: [
|
|
11331
|
-
entries.map((entry) => /* @__PURE__ */
|
|
11829
|
+
entries.map((entry) => /* @__PURE__ */ jsx34(
|
|
11332
11830
|
"div",
|
|
11333
11831
|
{
|
|
11334
11832
|
className: "sia-query-form__field",
|
|
@@ -11342,9 +11840,9 @@ function QueryForm({
|
|
|
11342
11840
|
},
|
|
11343
11841
|
entry.key
|
|
11344
11842
|
)),
|
|
11345
|
-
/* @__PURE__ */
|
|
11346
|
-
/* @__PURE__ */
|
|
11347
|
-
/* @__PURE__ */
|
|
11843
|
+
/* @__PURE__ */ jsxs29("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
|
|
11844
|
+
/* @__PURE__ */ jsxs29(Space.Compact, { children: [
|
|
11845
|
+
/* @__PURE__ */ jsx34(
|
|
11348
11846
|
Button,
|
|
11349
11847
|
{
|
|
11350
11848
|
type: "submit",
|
|
@@ -11354,8 +11852,8 @@ function QueryForm({
|
|
|
11354
11852
|
children: searchText
|
|
11355
11853
|
}
|
|
11356
11854
|
),
|
|
11357
|
-
/* @__PURE__ */
|
|
11358
|
-
onSaveQuery ? /* @__PURE__ */
|
|
11855
|
+
/* @__PURE__ */ jsx34(Button, { disabled: busy, onClick: reset, children: resetText }),
|
|
11856
|
+
onSaveQuery ? /* @__PURE__ */ jsx34(
|
|
11359
11857
|
Button,
|
|
11360
11858
|
{
|
|
11361
11859
|
disabled: shortcutBusy,
|
|
@@ -11370,12 +11868,12 @@ function QueryForm({
|
|
|
11370
11868
|
) : null,
|
|
11371
11869
|
showSettings ?? settingsRows > 2 ? cloudSettings.control : null
|
|
11372
11870
|
] }),
|
|
11373
|
-
collapsible && entries.length > 0 ? /* @__PURE__ */
|
|
11871
|
+
collapsible && entries.length > 0 ? /* @__PURE__ */ jsx34("span", { ref: toggleRef, hidden: !needsCollapse, children: /* @__PURE__ */ jsx34(
|
|
11374
11872
|
Button,
|
|
11375
11873
|
{
|
|
11376
11874
|
variant: "link",
|
|
11377
11875
|
"aria-expanded": !collapsed,
|
|
11378
|
-
icon: /* @__PURE__ */
|
|
11876
|
+
icon: /* @__PURE__ */ jsx34(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
|
|
11379
11877
|
iconPosition: "end",
|
|
11380
11878
|
onClick: () => {
|
|
11381
11879
|
setInternalCollapsed(!collapsed);
|
|
@@ -11390,8 +11888,8 @@ function QueryForm({
|
|
|
11390
11888
|
]
|
|
11391
11889
|
}
|
|
11392
11890
|
) }),
|
|
11393
|
-
savedQueries.length ? /* @__PURE__ */
|
|
11394
|
-
savedQueries.map((query, index) => /* @__PURE__ */
|
|
11891
|
+
savedQueries.length ? /* @__PURE__ */ jsxs29("div", { className: "sia-query-form__saved", "aria-label": "\u5DF2\u4FDD\u5B58\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
11892
|
+
savedQueries.map((query, index) => /* @__PURE__ */ jsx34(
|
|
11395
11893
|
Tag,
|
|
11396
11894
|
{
|
|
11397
11895
|
status: query.status ?? ["processing", "success", "warning", "error"][index % 4],
|
|
@@ -11417,11 +11915,11 @@ function QueryForm({
|
|
|
11417
11915
|
)),
|
|
11418
11916
|
" "
|
|
11419
11917
|
] }) : null,
|
|
11420
|
-
error ? /* @__PURE__ */
|
|
11918
|
+
error ? /* @__PURE__ */ jsx34("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
|
|
11421
11919
|
]
|
|
11422
11920
|
}
|
|
11423
11921
|
),
|
|
11424
|
-
/* @__PURE__ */
|
|
11922
|
+
/* @__PURE__ */ jsxs29(
|
|
11425
11923
|
Modal,
|
|
11426
11924
|
{
|
|
11427
11925
|
open: saveOpen,
|
|
@@ -11433,7 +11931,7 @@ function QueryForm({
|
|
|
11433
11931
|
if (!saveLock.current) setSaveOpen(next);
|
|
11434
11932
|
},
|
|
11435
11933
|
children: [
|
|
11436
|
-
/* @__PURE__ */
|
|
11934
|
+
/* @__PURE__ */ jsx34(
|
|
11437
11935
|
Input,
|
|
11438
11936
|
{
|
|
11439
11937
|
autoFocus: true,
|
|
@@ -11452,7 +11950,7 @@ function QueryForm({
|
|
|
11452
11950
|
}
|
|
11453
11951
|
}
|
|
11454
11952
|
),
|
|
11455
|
-
saveError ? /* @__PURE__ */
|
|
11953
|
+
saveError ? /* @__PURE__ */ jsx34("p", { className: "sia-query-form__error", role: "alert", children: saveError }) : null
|
|
11456
11954
|
]
|
|
11457
11955
|
}
|
|
11458
11956
|
)
|
|
@@ -11461,7 +11959,7 @@ function QueryForm({
|
|
|
11461
11959
|
|
|
11462
11960
|
// src/components/NumberRange.tsx
|
|
11463
11961
|
import { forwardRef as forwardRef9 } from "react";
|
|
11464
|
-
import { jsx as
|
|
11962
|
+
import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
11465
11963
|
var NumberRange = forwardRef9(function NumberRange2({
|
|
11466
11964
|
value,
|
|
11467
11965
|
defaultValue = [null, null],
|
|
@@ -11490,7 +11988,7 @@ var NumberRange = forwardRef9(function NumberRange2({
|
|
|
11490
11988
|
setValue2(index === 0 ? [next, range[1]] : [range[0], next]);
|
|
11491
11989
|
}
|
|
11492
11990
|
const inputProps = { min, max, step, precision, size, status, disabled, readOnly, placeholderMode, controls: false };
|
|
11493
|
-
return /* @__PURE__ */
|
|
11991
|
+
return /* @__PURE__ */ jsxs30(
|
|
11494
11992
|
"span",
|
|
11495
11993
|
{
|
|
11496
11994
|
...props,
|
|
@@ -11499,7 +11997,7 @@ var NumberRange = forwardRef9(function NumberRange2({
|
|
|
11499
11997
|
"aria-disabled": disabled || void 0,
|
|
11500
11998
|
className: `sia-number-range sia-number-range--${size} sia-number-range--${status}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
11501
11999
|
children: [
|
|
11502
|
-
/* @__PURE__ */
|
|
12000
|
+
/* @__PURE__ */ jsx35(
|
|
11503
12001
|
InputNumber,
|
|
11504
12002
|
{
|
|
11505
12003
|
...inputProps,
|
|
@@ -11511,8 +12009,8 @@ var NumberRange = forwardRef9(function NumberRange2({
|
|
|
11511
12009
|
onChange: (next) => change(0, next)
|
|
11512
12010
|
}
|
|
11513
12011
|
),
|
|
11514
|
-
/* @__PURE__ */
|
|
11515
|
-
/* @__PURE__ */
|
|
12012
|
+
/* @__PURE__ */ jsx35(Icon, { className: "sia-number-range__separator", name: "tilde", size: 12, strokeWidth: 1.5, "aria-hidden": "true" }),
|
|
12013
|
+
/* @__PURE__ */ jsx35(
|
|
11516
12014
|
InputNumber,
|
|
11517
12015
|
{
|
|
11518
12016
|
...inputProps,
|
|
@@ -11524,15 +12022,15 @@ var NumberRange = forwardRef9(function NumberRange2({
|
|
|
11524
12022
|
onChange: (next) => change(1, next)
|
|
11525
12023
|
}
|
|
11526
12024
|
),
|
|
11527
|
-
allowClear && !disabled && !readOnly && range.some((item) => item !== null) ? /* @__PURE__ */
|
|
12025
|
+
allowClear && !disabled && !readOnly && range.some((item) => item !== null) ? /* @__PURE__ */ jsx35("button", { type: "button", className: "sia-number-range__clear", "aria-label": "\u6E05\u9664\u6570\u5B57\u533A\u95F4", onClick: () => setValue2([null, null]), children: /* @__PURE__ */ jsx35(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null
|
|
11528
12026
|
]
|
|
11529
12027
|
}
|
|
11530
12028
|
);
|
|
11531
12029
|
});
|
|
11532
12030
|
|
|
11533
12031
|
// src/components/VirtualGrid.tsx
|
|
11534
|
-
import { useEffect as
|
|
11535
|
-
import { jsx as
|
|
12032
|
+
import { useEffect as useEffect21, useLayoutEffect as useLayoutEffect10, useRef as useRef30, useState as useState29 } from "react";
|
|
12033
|
+
import { jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
11536
12034
|
function VirtualGrid({
|
|
11537
12035
|
items,
|
|
11538
12036
|
itemKey,
|
|
@@ -11551,11 +12049,11 @@ function VirtualGrid({
|
|
|
11551
12049
|
tabIndex = 0,
|
|
11552
12050
|
...props
|
|
11553
12051
|
}) {
|
|
11554
|
-
const viewport =
|
|
11555
|
-
const [size, setSize] =
|
|
11556
|
-
const [scrollTop, setScrollTop] =
|
|
11557
|
-
const frame =
|
|
11558
|
-
const requestedLength =
|
|
12052
|
+
const viewport = useRef30(null);
|
|
12053
|
+
const [size, setSize] = useState29({ width: 0, height: 0 });
|
|
12054
|
+
const [scrollTop, setScrollTop] = useState29(0);
|
|
12055
|
+
const frame = useRef30();
|
|
12056
|
+
const requestedLength = useRef30();
|
|
11559
12057
|
const height = Math.max(1, rowHeight);
|
|
11560
12058
|
const spacing = Math.max(0, gap);
|
|
11561
12059
|
const columns = Math.max(1, Math.floor((size.width + spacing) / (Math.max(1, minColumnWidth) + spacing)));
|
|
@@ -11584,14 +12082,14 @@ function VirtualGrid({
|
|
|
11584
12082
|
if (el.scrollTop !== next) el.scrollTop = next;
|
|
11585
12083
|
setScrollTop(next);
|
|
11586
12084
|
}, [totalHeight, size.height]);
|
|
11587
|
-
|
|
12085
|
+
useEffect21(() => {
|
|
11588
12086
|
if (!onLoadMore || !hasMore || loading || size.height <= 0) return;
|
|
11589
12087
|
if (totalHeight - scrollTop - size.height > Math.max(0, loadMoreThreshold)) return;
|
|
11590
12088
|
if (requestedLength.current === items.length) return;
|
|
11591
12089
|
requestedLength.current = items.length;
|
|
11592
12090
|
onLoadMore();
|
|
11593
12091
|
}, [items.length, hasMore, loading, size.height, scrollTop, totalHeight, loadMoreThreshold, onLoadMore]);
|
|
11594
|
-
return /* @__PURE__ */
|
|
12092
|
+
return /* @__PURE__ */ jsxs31(
|
|
11595
12093
|
"div",
|
|
11596
12094
|
{
|
|
11597
12095
|
...props,
|
|
@@ -11609,16 +12107,16 @@ function VirtualGrid({
|
|
|
11609
12107
|
});
|
|
11610
12108
|
},
|
|
11611
12109
|
children: [
|
|
11612
|
-
/* @__PURE__ */
|
|
12110
|
+
/* @__PURE__ */ jsx36("div", { className: "sia-virtual-grid__spacer", style: { height: totalHeight }, children: Array.from({ length: Math.max(0, endRow - startRow) }, (_, offset) => {
|
|
11613
12111
|
const row = startRow + offset;
|
|
11614
|
-
return /* @__PURE__ */
|
|
12112
|
+
return /* @__PURE__ */ jsx36("div", { className: "sia-virtual-grid__row", role: "presentation", style: {
|
|
11615
12113
|
top: row * stride,
|
|
11616
12114
|
height,
|
|
11617
12115
|
columnGap: spacing,
|
|
11618
12116
|
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`
|
|
11619
12117
|
}, children: items.slice(row * columns, (row + 1) * columns).map((item, column) => {
|
|
11620
12118
|
const index = row * columns + column;
|
|
11621
|
-
return /* @__PURE__ */
|
|
12119
|
+
return /* @__PURE__ */ jsx36("div", { className: "sia-virtual-grid__item", role: "listitem", "aria-posinset": index + 1, "aria-setsize": hasMore ? -1 : items.length, children: renderItem(item, index) }, itemKey(item, index));
|
|
11622
12120
|
}) }, row);
|
|
11623
12121
|
}) }),
|
|
11624
12122
|
!items.length && !loading ? empty : null
|
|
@@ -11658,6 +12156,7 @@ export {
|
|
|
11658
12156
|
ChartVisualMap,
|
|
11659
12157
|
ChartWhirlingLoading,
|
|
11660
12158
|
Checkbox,
|
|
12159
|
+
ChooseBox,
|
|
11661
12160
|
ChordChart,
|
|
11662
12161
|
Col,
|
|
11663
12162
|
Collapse,
|
|
@@ -11763,6 +12262,7 @@ export {
|
|
|
11763
12262
|
chartColor,
|
|
11764
12263
|
chartTicks,
|
|
11765
12264
|
createBaiduMapHost,
|
|
12265
|
+
createBrowserChooseBoxSource,
|
|
11766
12266
|
createCellSelectionPlugin,
|
|
11767
12267
|
createColumnSettingPlugin,
|
|
11768
12268
|
createColumnTransformPlugin,
|
|
@@ -11778,6 +12278,7 @@ export {
|
|
|
11778
12278
|
createSelectionPlugin,
|
|
11779
12279
|
createSortPlugin,
|
|
11780
12280
|
createSummaryPlugin,
|
|
12281
|
+
createTauriChooseBoxSource,
|
|
11781
12282
|
createToolbarPlugin,
|
|
11782
12283
|
createTreePlugin,
|
|
11783
12284
|
createWorksheetPlugin,
|