@sia.soul/sia-react-ui 0.1.147 → 0.1.149
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 +209 -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.css +5 -0
- package/dist/game.js +1 -1
- package/dist/index.cjs +2550 -2096
- package/dist/index.css +209 -0
- package/dist/index.d.cts +69 -4
- package/dist/index.d.ts +69 -4
- package/dist/index.js +888 -471
- 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";
|
|
@@ -309,7 +309,7 @@ function FloatingPanel({ open, title, children, placement = "bottomRight" }) {
|
|
|
309
309
|
children
|
|
310
310
|
] }), document.body);
|
|
311
311
|
}
|
|
312
|
-
function SortableList({ items, renderItem, onOrderChange, direction = "horizontal", disabled = false, handlePlacement = "before", handleContent }) {
|
|
312
|
+
function SortableList({ items, renderItem, onOrderChange, direction = "horizontal", wrap = false, disabled = false, handlePlacement = "before", handleContent }) {
|
|
313
313
|
const rootRef = useRef2(null);
|
|
314
314
|
const placeholderRef = useRef2(null);
|
|
315
315
|
const latest = useRef2({ items, onOrderChange });
|
|
@@ -321,6 +321,7 @@ function SortableList({ items, renderItem, onOrderChange, direction = "horizonta
|
|
|
321
321
|
const root = rootRef.current;
|
|
322
322
|
if (!root) return;
|
|
323
323
|
const horizontal = direction === "horizontal";
|
|
324
|
+
const wrapping = horizontal && wrap;
|
|
324
325
|
let session = null;
|
|
325
326
|
let frame = 0;
|
|
326
327
|
let settling = null;
|
|
@@ -356,6 +357,30 @@ function SortableList({ items, renderItem, onOrderChange, direction = "horizonta
|
|
|
356
357
|
return offsets;
|
|
357
358
|
};
|
|
358
359
|
const transform = (offset) => horizontal ? `translate3d(${offset}px, 0, 0)` : `translate3d(0, ${offset}px, 0)`;
|
|
360
|
+
const wrappedOffsets = (s) => {
|
|
361
|
+
const indices = s.keys.map((_, index) => index);
|
|
362
|
+
indices.splice(s.from, 1);
|
|
363
|
+
indices.splice(s.to, 0, s.from);
|
|
364
|
+
const style = getComputedStyle(root);
|
|
365
|
+
const gapX = parseFloat(style.columnGap) || 0, gapY = parseFloat(style.rowGap) || 0;
|
|
366
|
+
const width = root.clientWidth - (parseFloat(style.paddingLeft) || 0) - (parseFloat(style.paddingRight) || 0);
|
|
367
|
+
const first = s.rects[0];
|
|
368
|
+
let x = 0, y = 0, height = 0;
|
|
369
|
+
const offsets = s.rects.map(() => ({ x: 0, y: 0 }));
|
|
370
|
+
indices.forEach((index) => {
|
|
371
|
+
const rect = s.rects[index];
|
|
372
|
+
if (x > 0 && x + rect.width > width + 0.5) {
|
|
373
|
+
x = 0;
|
|
374
|
+
y += height + gapY;
|
|
375
|
+
height = 0;
|
|
376
|
+
}
|
|
377
|
+
offsets[index] = { x: first.left + x - rect.left, y: first.top + y - rect.top };
|
|
378
|
+
x += rect.width + gapX;
|
|
379
|
+
height = Math.max(height, rect.height);
|
|
380
|
+
});
|
|
381
|
+
return offsets;
|
|
382
|
+
};
|
|
383
|
+
const vectorTransform = (point) => `translate3d(${point.x}px, ${point.y}px, 0)`;
|
|
359
384
|
const paint = () => {
|
|
360
385
|
const s = session;
|
|
361
386
|
if (!s || !s.active || settling) return;
|
|
@@ -363,6 +388,32 @@ function SortableList({ items, renderItem, onOrderChange, direction = "horizonta
|
|
|
363
388
|
const coordinate = horizontal ? s.clientX : s.clientY;
|
|
364
389
|
const scroll = horizontal ? root.scrollLeft : root.scrollTop;
|
|
365
390
|
const origin = s.rects[s.from];
|
|
391
|
+
if (wrapping) {
|
|
392
|
+
const dx = Math.max(Math.min(...s.rects.map((r) => r.left)) - origin.left, Math.min(Math.max(...s.rects.map((r) => r.right)) - origin.right, s.clientX - s.startX + root.scrollLeft - s.scrollX));
|
|
393
|
+
const dy = Math.max(Math.min(...s.rects.map((r) => r.top)) - origin.top, Math.min(Math.max(...s.rects.map((r) => r.bottom)) - origin.bottom, s.clientY - s.startY + root.scrollTop - s.scrollY));
|
|
394
|
+
const cx = origin.left + origin.width / 2 + dx, cy = origin.top + origin.height / 2 + dy;
|
|
395
|
+
let distance = Infinity;
|
|
396
|
+
s.rects.forEach((rect, index) => {
|
|
397
|
+
const next = Math.pow(cx - rect.left - rect.width / 2, 2) + Math.pow(cy - rect.top - rect.height / 2, 2);
|
|
398
|
+
if (next < distance) {
|
|
399
|
+
distance = next;
|
|
400
|
+
s.to = index;
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
const offsets2 = wrappedOffsets(s);
|
|
404
|
+
s.nodes.forEach((node, index) => {
|
|
405
|
+
node.style.transform = vectorTransform(index === s.from ? { x: dx, y: dy } : offsets2[index]);
|
|
406
|
+
});
|
|
407
|
+
const preview2 = placeholderRef.current;
|
|
408
|
+
if (preview2) {
|
|
409
|
+
preview2.hidden = false;
|
|
410
|
+
preview2.style.width = `${origin.width}px`;
|
|
411
|
+
preview2.style.height = `${origin.height}px`;
|
|
412
|
+
preview2.style.left = `${origin.left - bounds.left + s.scrollX + offsets2[s.from].x}px`;
|
|
413
|
+
preview2.style.top = `${origin.top - bounds.top + s.scrollY + offsets2[s.from].y}px`;
|
|
414
|
+
}
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
366
417
|
const first = s.rects[0];
|
|
367
418
|
const last = s.rects[s.rects.length - 1];
|
|
368
419
|
const minimum = horizontal ? first.left - origin.left : first.top - origin.top;
|
|
@@ -388,15 +439,16 @@ function SortableList({ items, renderItem, onOrderChange, direction = "horizonta
|
|
|
388
439
|
const s = session;
|
|
389
440
|
if (!s || !s.active || settling) return;
|
|
390
441
|
const bounds = root.getBoundingClientRect();
|
|
391
|
-
const
|
|
392
|
-
const
|
|
393
|
-
const
|
|
394
|
-
const
|
|
442
|
+
const scrollHorizontal = horizontal && !wrapping;
|
|
443
|
+
const point = scrollHorizontal ? s.clientX : s.clientY;
|
|
444
|
+
const start = scrollHorizontal ? bounds.left : bounds.top;
|
|
445
|
+
const end = scrollHorizontal ? bounds.right : bounds.bottom;
|
|
446
|
+
const crossInside = scrollHorizontal ? s.clientY >= bounds.top && s.clientY <= bounds.bottom : s.clientX >= bounds.left && s.clientX <= bounds.right;
|
|
395
447
|
const edge = 44;
|
|
396
448
|
const speed = !crossInside || point < start || point > end ? 0 : point < start + edge ? -Math.min(1, (start + edge - point) / edge) : point > end - edge ? Math.min(1, (point - end + edge) / edge) : 0;
|
|
397
449
|
const distance = speed * Math.min(32, time - (lastTime || time)) * 0.65;
|
|
398
450
|
lastTime = time;
|
|
399
|
-
if (
|
|
451
|
+
if (scrollHorizontal) root.scrollLeft += distance;
|
|
400
452
|
else root.scrollTop += distance;
|
|
401
453
|
paint();
|
|
402
454
|
frame = requestAnimationFrame(tick);
|
|
@@ -419,6 +471,10 @@ function SortableList({ items, renderItem, onOrderChange, direction = "horizonta
|
|
|
419
471
|
start: horizontal ? event.clientX : event.clientY,
|
|
420
472
|
clientX: event.clientX,
|
|
421
473
|
clientY: event.clientY,
|
|
474
|
+
startX: event.clientX,
|
|
475
|
+
startY: event.clientY,
|
|
476
|
+
scrollX: root.scrollLeft,
|
|
477
|
+
scrollY: root.scrollTop,
|
|
422
478
|
scroll: horizontal ? root.scrollLeft : root.scrollTop,
|
|
423
479
|
active: false
|
|
424
480
|
};
|
|
@@ -429,7 +485,7 @@ function SortableList({ items, renderItem, onOrderChange, direction = "horizonta
|
|
|
429
485
|
if (!s || settling || event.pointerId !== s.pointer) return;
|
|
430
486
|
s.clientX = event.clientX;
|
|
431
487
|
s.clientY = event.clientY;
|
|
432
|
-
if (!s.active && Math.abs((horizontal ? event.clientX : event.clientY) - s.start) >= 4) {
|
|
488
|
+
if (!s.active && (wrapping ? Math.hypot(event.clientX - s.startX, event.clientY - s.startY) : Math.abs((horizontal ? event.clientX : event.clientY) - s.start)) >= 4) {
|
|
433
489
|
s.active = true;
|
|
434
490
|
root.classList.add("is-sorting");
|
|
435
491
|
s.nodes[s.from].classList.add("is-dragging");
|
|
@@ -470,7 +526,7 @@ function SortableList({ items, renderItem, onOrderChange, direction = "horizonta
|
|
|
470
526
|
return;
|
|
471
527
|
}
|
|
472
528
|
const node = s.nodes[s.from];
|
|
473
|
-
settling = node.animate([{ transform: node.style.transform }, { transform: transform(displacement(s)[s.from]) }], { duration: 160, easing: "cubic-bezier(.2,.8,.2,1)", fill: "forwards" });
|
|
529
|
+
settling = node.animate([{ transform: node.style.transform }, { transform: wrapping ? vectorTransform(wrappedOffsets(s)[s.from]) : transform(displacement(s)[s.from]) }], { duration: 160, easing: "cubic-bezier(.2,.8,.2,1)", fill: "forwards" });
|
|
474
530
|
settling.finished.then(finish, () => {
|
|
475
531
|
});
|
|
476
532
|
};
|
|
@@ -511,8 +567,8 @@ function SortableList({ items, renderItem, onOrderChange, direction = "horizonta
|
|
|
511
567
|
root.removeEventListener("lostpointercapture", cancelPointer);
|
|
512
568
|
root.removeEventListener("click", cancelClick, true);
|
|
513
569
|
};
|
|
514
|
-
}, [disabled, direction, signature]);
|
|
515
|
-
return /* @__PURE__ */ jsxs2("div", { ref: rootRef, className: `sia-sortable-list sia-sortable-list--${direction}`, role: "list", children: [
|
|
570
|
+
}, [disabled, direction, wrap, signature]);
|
|
571
|
+
return /* @__PURE__ */ jsxs2("div", { ref: rootRef, className: `sia-sortable-list sia-sortable-list--${direction}${wrap && direction === "horizontal" ? " sia-sortable-list--wrap" : ""}`, role: "list", children: [
|
|
516
572
|
/* @__PURE__ */ jsx2("div", { ref: placeholderRef, className: "sia-sortable-list__placeholder", "aria-hidden": "true", hidden: true }),
|
|
517
573
|
items.map((key, index) => {
|
|
518
574
|
const handle = /* @__PURE__ */ jsx2(
|
|
@@ -3718,8 +3774,366 @@ function buildFlatTree(items, options = {}) {
|
|
|
3718
3774
|
return roots;
|
|
3719
3775
|
}
|
|
3720
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
|
+
|
|
3721
4135
|
// src/components/Editor.tsx
|
|
3722
|
-
import { useEffect as
|
|
4136
|
+
import { useEffect as useEffect11, useId as useId6, useRef as useRef16, useState as useState16 } from "react";
|
|
3723
4137
|
import EditorWorker from "monaco-editor/editor/editor.worker.js?worker";
|
|
3724
4138
|
|
|
3725
4139
|
// src/components/jsonLanguage.ts
|
|
@@ -4300,7 +4714,7 @@ function registerSqlLanguages(monaco) {
|
|
|
4300
4714
|
}
|
|
4301
4715
|
|
|
4302
4716
|
// src/components/Editor.tsx
|
|
4303
|
-
import { jsx as
|
|
4717
|
+
import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4304
4718
|
var EDITOR_COMMAND_SHORTCUTS = {
|
|
4305
4719
|
cut: "Ctrl+X",
|
|
4306
4720
|
copy: "Ctrl+C",
|
|
@@ -4395,29 +4809,29 @@ function Editor({
|
|
|
4395
4809
|
loadingText = "\u6B63\u5728\u52A0\u8F7D\u7F16\u8F91\u5668\u2026"
|
|
4396
4810
|
}) {
|
|
4397
4811
|
const generatedId = useId6();
|
|
4398
|
-
const containerRef =
|
|
4399
|
-
const rangeHighlightRef =
|
|
4400
|
-
const editorRef =
|
|
4401
|
-
const modelRef =
|
|
4402
|
-
const apiRef =
|
|
4403
|
-
const applyingControlledValueRef =
|
|
4404
|
-
const updateHighlightRef =
|
|
4405
|
-
const changeHandlerRef =
|
|
4406
|
-
const readyHandlerRef =
|
|
4407
|
-
const selectionHandlerRef =
|
|
4408
|
-
const keyDownHandlerRef =
|
|
4409
|
-
const highlightRangeRef =
|
|
4410
|
-
const markersRef =
|
|
4411
|
-
const contextMenuItemsRef =
|
|
4412
|
-
const completionProviderRef =
|
|
4413
|
-
const refreshSuggestionOnSpaceRef =
|
|
4414
|
-
const initialValueRef =
|
|
4415
|
-
const initialLanguageRef =
|
|
4416
|
-
const initialPathRef =
|
|
4417
|
-
const initialThemeRef =
|
|
4418
|
-
const initialOptionsRef =
|
|
4419
|
-
const [loading, setLoading] =
|
|
4420
|
-
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);
|
|
4421
4835
|
initialValueRef.current = value;
|
|
4422
4836
|
initialLanguageRef.current = language;
|
|
4423
4837
|
initialPathRef.current = path;
|
|
@@ -4432,7 +4846,7 @@ function Editor({
|
|
|
4432
4846
|
contextMenuItemsRef.current = contextMenuItems;
|
|
4433
4847
|
completionProviderRef.current = completionProvider;
|
|
4434
4848
|
refreshSuggestionOnSpaceRef.current = refreshSuggestionOnSpace;
|
|
4435
|
-
|
|
4849
|
+
useEffect11(() => {
|
|
4436
4850
|
let disposed = false;
|
|
4437
4851
|
const subscriptions = [];
|
|
4438
4852
|
async function mountEditor() {
|
|
@@ -4776,7 +5190,7 @@ function Editor({
|
|
|
4776
5190
|
updateHighlightRef.current = () => void 0;
|
|
4777
5191
|
};
|
|
4778
5192
|
}, [generatedId]);
|
|
4779
|
-
|
|
5193
|
+
useEffect11(() => {
|
|
4780
5194
|
const model = modelRef.current;
|
|
4781
5195
|
if (!model || model.getValue() === value) return;
|
|
4782
5196
|
applyingControlledValueRef.current = true;
|
|
@@ -4786,7 +5200,7 @@ function Editor({
|
|
|
4786
5200
|
applyingControlledValueRef.current = false;
|
|
4787
5201
|
}
|
|
4788
5202
|
}, [loading, value]);
|
|
4789
|
-
|
|
5203
|
+
useEffect11(() => {
|
|
4790
5204
|
if (loading) return;
|
|
4791
5205
|
void loadMonaco().then((monaco) => {
|
|
4792
5206
|
const model = modelRef.current;
|
|
@@ -4795,7 +5209,7 @@ function Editor({
|
|
|
4795
5209
|
}, [language, loading]);
|
|
4796
5210
|
const completionEnabled = Boolean(completionProvider);
|
|
4797
5211
|
const completionTriggerKey = completionTriggerCharacters.join("\0");
|
|
4798
|
-
|
|
5212
|
+
useEffect11(() => {
|
|
4799
5213
|
if (loading || !completionEnabled) return void 0;
|
|
4800
5214
|
let disposed = false;
|
|
4801
5215
|
let subscription;
|
|
@@ -4869,23 +5283,23 @@ function Editor({
|
|
|
4869
5283
|
subscription?.dispose();
|
|
4870
5284
|
};
|
|
4871
5285
|
}, [completionEnabled, completionTriggerKey, language, loading]);
|
|
4872
|
-
|
|
5286
|
+
useEffect11(() => {
|
|
4873
5287
|
if (loading) return;
|
|
4874
5288
|
void loadMonaco().then((monaco) => {
|
|
4875
5289
|
if (editorRef.current) monaco.editor.setTheme(theme === "dark" ? "vs-dark" : "vs");
|
|
4876
5290
|
});
|
|
4877
5291
|
}, [loading, theme]);
|
|
4878
|
-
|
|
5292
|
+
useEffect11(() => {
|
|
4879
5293
|
if (loading) return;
|
|
4880
5294
|
editorRef.current?.updateOptions({
|
|
4881
5295
|
...options ?? {},
|
|
4882
5296
|
contextmenu: contextMenuItems.length === 0 ? options?.contextmenu ?? true : false
|
|
4883
5297
|
});
|
|
4884
5298
|
}, [contextMenuItems.length, loading, options]);
|
|
4885
|
-
|
|
5299
|
+
useEffect11(() => {
|
|
4886
5300
|
updateHighlightRef.current();
|
|
4887
5301
|
}, [highlightRange]);
|
|
4888
|
-
|
|
5302
|
+
useEffect11(() => {
|
|
4889
5303
|
if (loading) return;
|
|
4890
5304
|
void loadMonaco().then((monaco) => {
|
|
4891
5305
|
const model = modelRef.current;
|
|
@@ -4903,11 +5317,11 @@ function Editor({
|
|
|
4903
5317
|
})));
|
|
4904
5318
|
});
|
|
4905
5319
|
}, [generatedId, loading, markers]);
|
|
4906
|
-
const editorNode = /* @__PURE__ */
|
|
4907
|
-
/* @__PURE__ */
|
|
4908
|
-
/* @__PURE__ */
|
|
4909
|
-
loading ? /* @__PURE__ */
|
|
4910
|
-
/* @__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", {}),
|
|
4911
5325
|
loadingText
|
|
4912
5326
|
] }) : null
|
|
4913
5327
|
] });
|
|
@@ -4936,7 +5350,7 @@ function Editor({
|
|
|
4936
5350
|
item.onClick?.(api);
|
|
4937
5351
|
}
|
|
4938
5352
|
}
|
|
4939
|
-
return /* @__PURE__ */
|
|
5353
|
+
return /* @__PURE__ */ jsx20(
|
|
4940
5354
|
Dropdown,
|
|
4941
5355
|
{
|
|
4942
5356
|
className: "sia-editor-control__context-menu",
|
|
@@ -4953,19 +5367,19 @@ function Editor({
|
|
|
4953
5367
|
}
|
|
4954
5368
|
|
|
4955
5369
|
// src/components/Markdown.tsx
|
|
4956
|
-
import { useEffect as
|
|
5370
|
+
import { useEffect as useEffect12, useMemo as useMemo8, useRef as useRef17, useState as useState17 } from "react";
|
|
4957
5371
|
import DOMPurify from "dompurify";
|
|
4958
5372
|
import { marked } from "marked";
|
|
4959
|
-
import { Fragment as Fragment6, jsx as
|
|
5373
|
+
import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4960
5374
|
function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", resolveImageSrc, imagePreview = true, className = "", onClick, onKeyDown, ...props }) {
|
|
4961
|
-
const rootRef =
|
|
4962
|
-
const [previewImage, setPreviewImage] =
|
|
4963
|
-
const html =
|
|
5375
|
+
const rootRef = useRef17(null);
|
|
5376
|
+
const [previewImage, setPreviewImage] = useState17(null);
|
|
5377
|
+
const html = useMemo8(() => {
|
|
4964
5378
|
const rendered = marked.parse(content, { breaks: true, gfm: true });
|
|
4965
5379
|
const sanitized = DOMPurify.sanitize(rendered, { USE_PROFILES: { html: true } });
|
|
4966
5380
|
return sanitized.replace(/<img\b/giu, '<img loading="lazy" decoding="async" referrerpolicy="no-referrer"');
|
|
4967
5381
|
}, [content]);
|
|
4968
|
-
|
|
5382
|
+
useEffect12(() => {
|
|
4969
5383
|
const root = rootRef.current;
|
|
4970
5384
|
if (!root) return void 0;
|
|
4971
5385
|
let cancelled = false;
|
|
@@ -5022,19 +5436,19 @@ function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", r
|
|
|
5022
5436
|
onKeyDown?.(event);
|
|
5023
5437
|
}
|
|
5024
5438
|
if (!content.trim()) {
|
|
5025
|
-
return /* @__PURE__ */
|
|
5439
|
+
return /* @__PURE__ */ jsx21("div", { className: `sia-markdown sia-markdown--empty ${className}`.trim(), children: emptyText });
|
|
5026
5440
|
}
|
|
5027
|
-
return /* @__PURE__ */
|
|
5028
|
-
/* @__PURE__ */
|
|
5029
|
-
/* @__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) => {
|
|
5030
5444
|
if (!open) setPreviewImage(null);
|
|
5031
5445
|
} })
|
|
5032
5446
|
] });
|
|
5033
5447
|
}
|
|
5034
5448
|
|
|
5035
5449
|
// src/components/InputNumber.tsx
|
|
5036
|
-
import { forwardRef as forwardRef5, useEffect as
|
|
5037
|
-
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";
|
|
5038
5452
|
function formatValue(value, precision) {
|
|
5039
5453
|
if (value === null || !Number.isFinite(value)) return "";
|
|
5040
5454
|
return precision === void 0 ? String(value) : value.toFixed(precision);
|
|
@@ -5067,14 +5481,14 @@ var InputNumber = forwardRef5(function InputNumber2({
|
|
|
5067
5481
|
const size = useControlSize(sizeProp);
|
|
5068
5482
|
const fallbackId = useId7();
|
|
5069
5483
|
const inputId = id ?? fallbackId;
|
|
5070
|
-
const localRef =
|
|
5484
|
+
const localRef = useRef18(null);
|
|
5071
5485
|
const [currentValue, setCurrentValue] = useControllableState({ value, defaultValue, onChange });
|
|
5072
5486
|
const displayValue = (next) => {
|
|
5073
5487
|
const plain = formatValue(next, precision);
|
|
5074
5488
|
return plain && formatter ? formatter(plain) : plain;
|
|
5075
5489
|
};
|
|
5076
|
-
const [text, setText] =
|
|
5077
|
-
|
|
5490
|
+
const [text, setText] = useState18(() => displayValue(currentValue));
|
|
5491
|
+
useEffect13(() => {
|
|
5078
5492
|
setText(displayValue(currentValue));
|
|
5079
5493
|
}, [currentValue, precision, formatter]);
|
|
5080
5494
|
function setRef(node) {
|
|
@@ -5143,7 +5557,7 @@ var InputNumber = forwardRef5(function InputNumber2({
|
|
|
5143
5557
|
const increaseDisabled = disabled || readOnly || max !== void 0 && currentValue !== null && currentValue >= max;
|
|
5144
5558
|
const decreaseDisabled = disabled || readOnly || min !== void 0 && currentValue !== null && currentValue <= min;
|
|
5145
5559
|
const floatingPlaceholder = usePlaceholderMode(placeholderMode) === "floating" && Boolean(placeholder);
|
|
5146
|
-
const input = /* @__PURE__ */
|
|
5560
|
+
const input = /* @__PURE__ */ jsx22(
|
|
5147
5561
|
"input",
|
|
5148
5562
|
{
|
|
5149
5563
|
...withTitleTooltip(props),
|
|
@@ -5165,26 +5579,26 @@ var InputNumber = forwardRef5(function InputNumber2({
|
|
|
5165
5579
|
onKeyDown: handleKeyDown
|
|
5166
5580
|
}
|
|
5167
5581
|
);
|
|
5168
|
-
return /* @__PURE__ */
|
|
5169
|
-
prefix ? /* @__PURE__ */
|
|
5170
|
-
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: [
|
|
5171
5585
|
input,
|
|
5172
|
-
/* @__PURE__ */
|
|
5586
|
+
/* @__PURE__ */ jsx22("span", { className: "sia-input-number__floating-placeholder", "aria-hidden": "true", children: placeholder })
|
|
5173
5587
|
] }) : input,
|
|
5174
|
-
suffix ? /* @__PURE__ */
|
|
5175
|
-
controls ? /* @__PURE__ */
|
|
5176
|
-
/* @__PURE__ */
|
|
5177
|
-
/* @__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 }) })
|
|
5178
5592
|
] }) : null
|
|
5179
5593
|
] });
|
|
5180
5594
|
});
|
|
5181
5595
|
|
|
5182
5596
|
// src/components/SelectModal.tsx
|
|
5183
|
-
import { useState as
|
|
5184
|
-
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";
|
|
5185
5599
|
function SelectModalBody({ config, values, disabled, onChange }) {
|
|
5186
|
-
const [query, setQuery] =
|
|
5187
|
-
const [selectedOnly, setSelectedOnly] =
|
|
5600
|
+
const [query, setQuery] = useState19("");
|
|
5601
|
+
const [selectedOnly, setSelectedOnly] = useState19(false);
|
|
5188
5602
|
const multiple = config.mode === "multiple";
|
|
5189
5603
|
const search = query.trim();
|
|
5190
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()))));
|
|
@@ -5198,23 +5612,23 @@ function SelectModalBody({ config, values, disabled, onChange }) {
|
|
|
5198
5612
|
});
|
|
5199
5613
|
onChange([...next]);
|
|
5200
5614
|
};
|
|
5201
|
-
return /* @__PURE__ */
|
|
5202
|
-
config.headerExtra != null && config.headerExtra !== false ? /* @__PURE__ */
|
|
5203
|
-
/* @__PURE__ */
|
|
5204
|
-
/* @__PURE__ */
|
|
5205
|
-
/* @__PURE__ */
|
|
5206
|
-
/* @__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: [
|
|
5207
5621
|
"\u5DF2\u9009\u9879(",
|
|
5208
5622
|
values.length,
|
|
5209
5623
|
")"
|
|
5210
5624
|
] })
|
|
5211
5625
|
] }),
|
|
5212
|
-
/* @__PURE__ */
|
|
5626
|
+
/* @__PURE__ */ jsx23(
|
|
5213
5627
|
Input,
|
|
5214
5628
|
{
|
|
5215
5629
|
"aria-label": config.searchPlaceholder ?? "\u641C\u7D22\u9009\u9879",
|
|
5216
5630
|
placeholder: config.searchPlaceholder ?? "\u641C\u7D22\u9009\u9879",
|
|
5217
|
-
prefix: /* @__PURE__ */
|
|
5631
|
+
prefix: /* @__PURE__ */ jsx23(Icon, { name: "search", size: 14 }),
|
|
5218
5632
|
value: query,
|
|
5219
5633
|
allowClear: true,
|
|
5220
5634
|
disabled,
|
|
@@ -5225,8 +5639,8 @@ function SelectModalBody({ config, values, disabled, onChange }) {
|
|
|
5225
5639
|
}
|
|
5226
5640
|
)
|
|
5227
5641
|
] }),
|
|
5228
|
-
multiple ? /* @__PURE__ */
|
|
5229
|
-
/* @__PURE__ */
|
|
5642
|
+
multiple ? /* @__PURE__ */ jsxs22("div", { className: "sia-select-modal__actions", children: [
|
|
5643
|
+
/* @__PURE__ */ jsx23(
|
|
5230
5644
|
Checkbox,
|
|
5231
5645
|
{
|
|
5232
5646
|
checked: all,
|
|
@@ -5236,10 +5650,10 @@ function SelectModalBody({ config, values, disabled, onChange }) {
|
|
|
5236
5650
|
children: "\u5168\u9009"
|
|
5237
5651
|
}
|
|
5238
5652
|
),
|
|
5239
|
-
/* @__PURE__ */
|
|
5240
|
-
/* @__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" })
|
|
5241
5655
|
] }) : null,
|
|
5242
|
-
/* @__PURE__ */
|
|
5656
|
+
/* @__PURE__ */ jsx23(
|
|
5243
5657
|
SelectionPanel,
|
|
5244
5658
|
{
|
|
5245
5659
|
options: filtered,
|
|
@@ -5266,7 +5680,7 @@ function openSelectModal(config) {
|
|
|
5266
5680
|
if (config.mode !== "multiple") values = values.slice(0, 1);
|
|
5267
5681
|
let submitting = false;
|
|
5268
5682
|
function body() {
|
|
5269
|
-
return /* @__PURE__ */
|
|
5683
|
+
return /* @__PURE__ */ jsx23(SelectModalBody, { config: current, values, disabled: submitting || Boolean(current.confirmLoading), onChange: (next) => {
|
|
5270
5684
|
values = next;
|
|
5271
5685
|
handle.update({ children: body() });
|
|
5272
5686
|
} });
|
|
@@ -5309,8 +5723,8 @@ function openSelectModal(config) {
|
|
|
5309
5723
|
}
|
|
5310
5724
|
|
|
5311
5725
|
// src/components/Treemap.tsx
|
|
5312
|
-
import { useEffect as
|
|
5313
|
-
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";
|
|
5314
5728
|
import { createElement } from "react";
|
|
5315
5729
|
function positiveValue(value) {
|
|
5316
5730
|
return Number.isFinite(value) && value > 0 ? value : 1;
|
|
@@ -5682,19 +6096,19 @@ function Treemap({
|
|
|
5682
6096
|
style,
|
|
5683
6097
|
...props
|
|
5684
6098
|
}) {
|
|
5685
|
-
const containerRef =
|
|
5686
|
-
const [size, setSize] =
|
|
5687
|
-
const [internalExpandedKeys, setInternalExpandedKeys] =
|
|
5688
|
-
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);
|
|
5689
6103
|
const currentExpandedKeys = expandedKeys ?? internalExpandedKeys;
|
|
5690
6104
|
const currentFocusedKey = focusedKey === void 0 ? internalFocusedKey : focusedKey;
|
|
5691
|
-
const expandedSet =
|
|
5692
|
-
const focusedNode =
|
|
6105
|
+
const expandedSet = useMemo9(() => new Set(currentExpandedKeys), [currentExpandedKeys]);
|
|
6106
|
+
const focusedNode = useMemo9(
|
|
5693
6107
|
() => currentFocusedKey ? findNode(data, currentFocusedKey) : null,
|
|
5694
6108
|
[currentFocusedKey, data]
|
|
5695
6109
|
);
|
|
5696
6110
|
const effectiveFocusedNode = focusedNode && expandedSet.has(focusedNode.key) && Boolean(focusedNode.children?.length) ? focusedNode : null;
|
|
5697
|
-
const positions =
|
|
6111
|
+
const positions = useMemo9(
|
|
5698
6112
|
() => collectPositions(
|
|
5699
6113
|
effectiveFocusedNode ? [effectiveFocusedNode] : data,
|
|
5700
6114
|
{ x: 0, y: 0, ...size },
|
|
@@ -5710,7 +6124,7 @@ function Treemap({
|
|
|
5710
6124
|
),
|
|
5711
6125
|
[activeKey, aggregateOverflow, data, effectiveFocusedNode, expandedSet, gap, headerHeight, maxVisibleNodes, minTileHeight, minTileWidth, overflowLabel, size]
|
|
5712
6126
|
);
|
|
5713
|
-
|
|
6127
|
+
useEffect14(() => {
|
|
5714
6128
|
const element = containerRef.current;
|
|
5715
6129
|
if (!element) return void 0;
|
|
5716
6130
|
const updateSize = () => {
|
|
@@ -5722,7 +6136,7 @@ function Treemap({
|
|
|
5722
6136
|
observer.observe(element);
|
|
5723
6137
|
return () => observer.disconnect();
|
|
5724
6138
|
}, []);
|
|
5725
|
-
|
|
6139
|
+
useEffect14(() => {
|
|
5726
6140
|
if (!currentFocusedKey || effectiveFocusedNode) return;
|
|
5727
6141
|
if (focusedKey === void 0) setInternalFocusedKey(null);
|
|
5728
6142
|
onFocusedChange?.(null);
|
|
@@ -5742,7 +6156,7 @@ function Treemap({
|
|
|
5742
6156
|
}
|
|
5743
6157
|
onNodeClick?.({ node, expanded: isExpanded, nativeEvent });
|
|
5744
6158
|
}
|
|
5745
|
-
return /* @__PURE__ */
|
|
6159
|
+
return /* @__PURE__ */ jsxs23(
|
|
5746
6160
|
"div",
|
|
5747
6161
|
{
|
|
5748
6162
|
...withTitleTooltip(props),
|
|
@@ -5751,7 +6165,7 @@ function Treemap({
|
|
|
5751
6165
|
style,
|
|
5752
6166
|
role: "tree",
|
|
5753
6167
|
children: [
|
|
5754
|
-
data.length === 0 ? /* @__PURE__ */
|
|
6168
|
+
data.length === 0 ? /* @__PURE__ */ jsx24("div", { className: "sia-treemap__empty", children: emptyContent }) : null,
|
|
5755
6169
|
positions.map(({ node, rectangle, depth, expanded }) => {
|
|
5756
6170
|
const active = node.key === activeKey || Boolean(node.__active);
|
|
5757
6171
|
const fontSize = tileFontSize(rectangle);
|
|
@@ -5781,8 +6195,8 @@ function Treemap({
|
|
|
5781
6195
|
"data-treemap-key": node.key,
|
|
5782
6196
|
key: node.key
|
|
5783
6197
|
},
|
|
5784
|
-
/* @__PURE__ */
|
|
5785
|
-
/* @__PURE__ */
|
|
6198
|
+
/* @__PURE__ */ jsxs23("div", { className: "sia-treemap__header", children: [
|
|
6199
|
+
/* @__PURE__ */ jsxs23(
|
|
5786
6200
|
"button",
|
|
5787
6201
|
{
|
|
5788
6202
|
type: "button",
|
|
@@ -5790,12 +6204,12 @@ function Treemap({
|
|
|
5790
6204
|
disabled: node.disabled,
|
|
5791
6205
|
onClick: (event) => handleNodeClick(node, event),
|
|
5792
6206
|
children: [
|
|
5793
|
-
/* @__PURE__ */
|
|
5794
|
-
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
|
|
5795
6209
|
]
|
|
5796
6210
|
}
|
|
5797
6211
|
),
|
|
5798
|
-
/* @__PURE__ */
|
|
6212
|
+
/* @__PURE__ */ jsx24(
|
|
5799
6213
|
"button",
|
|
5800
6214
|
{
|
|
5801
6215
|
type: "button",
|
|
@@ -5803,7 +6217,7 @@ function Treemap({
|
|
|
5803
6217
|
"aria-label": effectiveFocusedNode?.key === node.key ? `\u8FD8\u539F ${node.label}` : `\u805A\u7126\u5C55\u5F00 ${node.label}`,
|
|
5804
6218
|
...withTitleTooltip({ title: effectiveFocusedNode?.key === node.key ? "\u8FD8\u539F\u539F\u6709\u89C6\u56FE" : "\u5C55\u5F00\u5230\u6574\u4E2A\u533A\u57DF" }),
|
|
5805
6219
|
onClick: () => updateFocusedKey(effectiveFocusedNode?.key === node.key ? null : node.key),
|
|
5806
|
-
children: /* @__PURE__ */
|
|
6220
|
+
children: /* @__PURE__ */ jsx24(Icon, { name: effectiveFocusedNode?.key === node.key ? "fullscreen-exit" : "fullscreen", size: 14 })
|
|
5807
6221
|
}
|
|
5808
6222
|
)
|
|
5809
6223
|
] })
|
|
@@ -5823,9 +6237,9 @@ function Treemap({
|
|
|
5823
6237
|
onClick: (event) => handleNodeClick(node, event),
|
|
5824
6238
|
key: node.key
|
|
5825
6239
|
},
|
|
5826
|
-
showLabel ? /* @__PURE__ */
|
|
5827
|
-
/* @__PURE__ */
|
|
5828
|
-
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
|
|
5829
6243
|
] }) : null
|
|
5830
6244
|
);
|
|
5831
6245
|
})
|
|
@@ -5835,8 +6249,8 @@ function Treemap({
|
|
|
5835
6249
|
}
|
|
5836
6250
|
|
|
5837
6251
|
// src/components/Table/TableCellContent.tsx
|
|
5838
|
-
import { useLayoutEffect as useLayoutEffect5, useRef as
|
|
5839
|
-
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";
|
|
5840
6254
|
var pendingLayouts = /* @__PURE__ */ new Map();
|
|
5841
6255
|
var layoutFrame;
|
|
5842
6256
|
function scheduleLayout(element, task) {
|
|
@@ -5854,8 +6268,8 @@ function scheduleLayout(element, task) {
|
|
|
5854
6268
|
});
|
|
5855
6269
|
}
|
|
5856
6270
|
function TableCellContent({ children, ellipsis, title }) {
|
|
5857
|
-
const ref =
|
|
5858
|
-
const [overflowing, setOverflowing] =
|
|
6271
|
+
const ref = useRef20(null);
|
|
6272
|
+
const [overflowing, setOverflowing] = useState21(false);
|
|
5859
6273
|
const customContent = typeof children !== "string" && typeof children !== "number" && children != null;
|
|
5860
6274
|
useLayoutEffect5(() => {
|
|
5861
6275
|
const element = ref.current;
|
|
@@ -5889,13 +6303,13 @@ function TableCellContent({ children, ellipsis, title }) {
|
|
|
5889
6303
|
pendingLayouts.delete(element);
|
|
5890
6304
|
};
|
|
5891
6305
|
}, [children, ellipsis, customContent]);
|
|
5892
|
-
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 });
|
|
5893
6307
|
}
|
|
5894
6308
|
|
|
5895
6309
|
// src/components/Table/useRemainingHeight.ts
|
|
5896
|
-
import { useLayoutEffect as useLayoutEffect6, useState as
|
|
6310
|
+
import { useLayoutEffect as useLayoutEffect6, useState as useState22 } from "react";
|
|
5897
6311
|
function useRemainingHeight(rootRef, options) {
|
|
5898
|
-
const [height, setHeight] =
|
|
6312
|
+
const [height, setHeight] = useState22();
|
|
5899
6313
|
const enabled = !!options;
|
|
5900
6314
|
const container = typeof options === "object" ? options.container : void 0;
|
|
5901
6315
|
const bottomOffset = typeof options === "object" ? options.bottomOffset ?? 0 : 0;
|
|
@@ -5971,7 +6385,7 @@ function useRemainingHeight(rootRef, options) {
|
|
|
5971
6385
|
}
|
|
5972
6386
|
|
|
5973
6387
|
// src/components/Table/TableCanvasLayer.tsx
|
|
5974
|
-
import { useLayoutEffect as useLayoutEffect7, useRef as
|
|
6388
|
+
import { useLayoutEffect as useLayoutEffect7, useRef as useRef21 } from "react";
|
|
5975
6389
|
|
|
5976
6390
|
// src/components/Table/utils.ts
|
|
5977
6391
|
var AUTO_WIDTH_COLUMN_KEYS = /* @__PURE__ */ new Set(["action", "actions", "operation", "operations"]);
|
|
@@ -6024,9 +6438,9 @@ function toTablePageParams(current, pageSize) {
|
|
|
6024
6438
|
}
|
|
6025
6439
|
|
|
6026
6440
|
// src/components/Table/TableCanvasLayer.tsx
|
|
6027
|
-
import { jsx as
|
|
6441
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
6028
6442
|
function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHeight }) {
|
|
6029
|
-
const canvasRef =
|
|
6443
|
+
const canvasRef = useRef21(null);
|
|
6030
6444
|
useLayoutEffect7(() => {
|
|
6031
6445
|
const canvas = canvasRef.current;
|
|
6032
6446
|
const scroller = viewport.current;
|
|
@@ -6150,7 +6564,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
6150
6564
|
window.removeEventListener("resize", schedule);
|
|
6151
6565
|
};
|
|
6152
6566
|
}, [viewport, rows, columns, widths, rowHeight, headerHeight]);
|
|
6153
|
-
return /* @__PURE__ */
|
|
6567
|
+
return /* @__PURE__ */ jsx26("canvas", { ref: canvasRef, "aria-hidden": "true", className: "sia-table__canvas-layer" });
|
|
6154
6568
|
}
|
|
6155
6569
|
|
|
6156
6570
|
// src/components/Table/rowIdentity.ts
|
|
@@ -6212,10 +6626,10 @@ function playCellFocusGlow(cell, isVisible, onFinish, options) {
|
|
|
6212
6626
|
}
|
|
6213
6627
|
|
|
6214
6628
|
// src/components/Table/Table.tsx
|
|
6215
|
-
import { Fragment as Fragment9, forwardRef as forwardRef6, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as
|
|
6629
|
+
import { Fragment as Fragment9, forwardRef as forwardRef6, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as useEffect16, useImperativeHandle, useMemo as useMemo10, useRef as useRef23, useState as useState24 } from "react";
|
|
6216
6630
|
|
|
6217
6631
|
// src/components/Table/plugins.tsx
|
|
6218
|
-
import { isValidElement as isValidElement3, useEffect as
|
|
6632
|
+
import { isValidElement as isValidElement3, useEffect as useEffect15, useRef as useRef22, useState as useState23 } from "react";
|
|
6219
6633
|
|
|
6220
6634
|
// src/components/Table/columnSettings.ts
|
|
6221
6635
|
function reconcileColumnSettings(columns, defaults, saved) {
|
|
@@ -6302,7 +6716,7 @@ function saveSettingsPatch(adapter, scope, patch) {
|
|
|
6302
6716
|
}
|
|
6303
6717
|
|
|
6304
6718
|
// src/components/Table/plugins.tsx
|
|
6305
|
-
import { Fragment as Fragment8, jsx as
|
|
6719
|
+
import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6306
6720
|
function TableCheckbox({
|
|
6307
6721
|
checked,
|
|
6308
6722
|
indeterminate,
|
|
@@ -6310,7 +6724,7 @@ function TableCheckbox({
|
|
|
6310
6724
|
label,
|
|
6311
6725
|
onChange
|
|
6312
6726
|
}) {
|
|
6313
|
-
return /* @__PURE__ */
|
|
6727
|
+
return /* @__PURE__ */ jsx27(
|
|
6314
6728
|
Checkbox,
|
|
6315
6729
|
{
|
|
6316
6730
|
className: "sia-table__checkbox",
|
|
@@ -6928,20 +7342,20 @@ function TableSelectedItemsPanel({
|
|
|
6928
7342
|
onRemove,
|
|
6929
7343
|
onClear
|
|
6930
7344
|
}) {
|
|
6931
|
-
const [showAll, setShowAll] =
|
|
7345
|
+
const [showAll, setShowAll] = useState23(false);
|
|
6932
7346
|
const visibleEntries = showAll ? entries : entries.slice(0, maxCount);
|
|
6933
7347
|
const hiddenCount = Math.max(0, entries.length - visibleEntries.length);
|
|
6934
7348
|
const baseColumnMap = new Map(
|
|
6935
7349
|
flattenTableColumns(baseColumns).map((column) => [column.key, column])
|
|
6936
7350
|
);
|
|
6937
|
-
return /* @__PURE__ */
|
|
6938
|
-
/* @__PURE__ */
|
|
6939
|
-
/* @__PURE__ */
|
|
7351
|
+
return /* @__PURE__ */ jsxs24("div", { className: "sia-table-selection-panel", children: [
|
|
7352
|
+
/* @__PURE__ */ jsxs24("div", { className: "sia-table-selection-panel__header", children: [
|
|
7353
|
+
/* @__PURE__ */ jsxs24("strong", { children: [
|
|
6940
7354
|
"\u5DF2\u9009 ",
|
|
6941
|
-
/* @__PURE__ */
|
|
7355
|
+
/* @__PURE__ */ jsx27("span", { children: entries.length }),
|
|
6942
7356
|
" \u9879"
|
|
6943
7357
|
] }),
|
|
6944
|
-
/* @__PURE__ */
|
|
7358
|
+
/* @__PURE__ */ jsx27(
|
|
6945
7359
|
Button,
|
|
6946
7360
|
{
|
|
6947
7361
|
size: "small",
|
|
@@ -6952,15 +7366,15 @@ function TableSelectedItemsPanel({
|
|
|
6952
7366
|
}
|
|
6953
7367
|
)
|
|
6954
7368
|
] }),
|
|
6955
|
-
/* @__PURE__ */
|
|
6956
|
-
/* @__PURE__ */
|
|
6957
|
-
columns.map((column) => /* @__PURE__ */
|
|
6958
|
-
/* @__PURE__ */
|
|
7369
|
+
/* @__PURE__ */ jsx27("div", { className: "sia-table-selection-panel__body", children: /* @__PURE__ */ jsxs24("table", { children: [
|
|
7370
|
+
/* @__PURE__ */ jsx27("thead", { children: /* @__PURE__ */ jsxs24("tr", { children: [
|
|
7371
|
+
columns.map((column) => /* @__PURE__ */ jsx27("th", { children: getColumnLabel(column) }, column.key)),
|
|
7372
|
+
/* @__PURE__ */ jsx27("th", { "aria-label": "\u64CD\u4F5C" })
|
|
6959
7373
|
] }) }),
|
|
6960
|
-
/* @__PURE__ */
|
|
7374
|
+
/* @__PURE__ */ jsx27("tbody", { children: visibleEntries.map((entry, selectedIndex) => /* @__PURE__ */ jsxs24("tr", { children: [
|
|
6961
7375
|
columns.map((column) => {
|
|
6962
7376
|
if (column.meta?.plugin === "index")
|
|
6963
|
-
return /* @__PURE__ */
|
|
7377
|
+
return /* @__PURE__ */ jsx27("td", { children: entry.sourceIndex + 1 }, column.key);
|
|
6964
7378
|
const baseColumn = baseColumnMap.get(column.key) ?? column;
|
|
6965
7379
|
const value = getTableValue(
|
|
6966
7380
|
entry.record,
|
|
@@ -6980,9 +7394,9 @@ function TableSelectedItemsPanel({
|
|
|
6980
7394
|
entry.sourceIndex,
|
|
6981
7395
|
{ row, rowIndex: entry.sourceIndex, column: baseColumn }
|
|
6982
7396
|
) ?? value;
|
|
6983
|
-
return /* @__PURE__ */
|
|
7397
|
+
return /* @__PURE__ */ jsx27("td", { children: content }, column.key);
|
|
6984
7398
|
}),
|
|
6985
|
-
/* @__PURE__ */
|
|
7399
|
+
/* @__PURE__ */ jsx27("td", { children: /* @__PURE__ */ jsx27(
|
|
6986
7400
|
Button,
|
|
6987
7401
|
{
|
|
6988
7402
|
size: "small",
|
|
@@ -6993,11 +7407,11 @@ function TableSelectedItemsPanel({
|
|
|
6993
7407
|
) })
|
|
6994
7408
|
] }, entry.key)) })
|
|
6995
7409
|
] }) }),
|
|
6996
|
-
hiddenCount > 0 ? /* @__PURE__ */
|
|
7410
|
+
hiddenCount > 0 ? /* @__PURE__ */ jsxs24("div", { className: "sia-table-selection-panel__more", children: [
|
|
6997
7411
|
"\u8FD8\u6709 ",
|
|
6998
7412
|
hiddenCount,
|
|
6999
7413
|
" \u9879\u672A\u5C55\u793A",
|
|
7000
|
-
/* @__PURE__ */
|
|
7414
|
+
/* @__PURE__ */ jsx27(Button, { size: "small", variant: "link", onClick: () => setShowAll(true), children: "\u5C55\u793A\u5168\u90E8" })
|
|
7001
7415
|
] }) : null
|
|
7002
7416
|
] });
|
|
7003
7417
|
}
|
|
@@ -7118,7 +7532,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7118
7532
|
const keys = selected(context);
|
|
7119
7533
|
const allChecked = enabledRows.length > 0 && enabledRows.every((row) => keys.includes(row.key));
|
|
7120
7534
|
const someChecked = enabledRows.some((row) => keys.includes(row.key));
|
|
7121
|
-
return /* @__PURE__ */
|
|
7535
|
+
return /* @__PURE__ */ jsx27(
|
|
7122
7536
|
TableCheckbox,
|
|
7123
7537
|
{
|
|
7124
7538
|
label: "\u9009\u62E9\u5F53\u524D\u9875\u5168\u90E8\u884C",
|
|
@@ -7134,7 +7548,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7134
7548
|
}
|
|
7135
7549
|
);
|
|
7136
7550
|
},
|
|
7137
|
-
render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */
|
|
7551
|
+
render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */ jsx27(
|
|
7138
7552
|
Radio2,
|
|
7139
7553
|
{
|
|
7140
7554
|
className: "sia-table__checkbox",
|
|
@@ -7145,7 +7559,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7145
7559
|
onClick: (event) => event.stopPropagation(),
|
|
7146
7560
|
onChange: () => toggle(info.row.key, record, context)
|
|
7147
7561
|
}
|
|
7148
|
-
) : /* @__PURE__ */
|
|
7562
|
+
) : /* @__PURE__ */ jsx27(
|
|
7149
7563
|
TableCheckbox,
|
|
7150
7564
|
{
|
|
7151
7565
|
label: `\u9009\u62E9\u7B2C ${info.rowIndex + 1} \u884C`,
|
|
@@ -7185,8 +7599,8 @@ function createSelectionPlugin(options = {}) {
|
|
|
7185
7599
|
const columns = flattenTableColumns(context.columns).filter(
|
|
7186
7600
|
(column) => !column.hidden && column.meta?.plugin !== "selection"
|
|
7187
7601
|
).slice(0, Math.max(1, options.selectionPanelColumnCount ?? 4));
|
|
7188
|
-
return /* @__PURE__ */
|
|
7189
|
-
/* @__PURE__ */
|
|
7602
|
+
return /* @__PURE__ */ jsxs24("span", { className: "sia-table__selection-footer", children: [
|
|
7603
|
+
/* @__PURE__ */ jsx27(
|
|
7190
7604
|
Popover,
|
|
7191
7605
|
{
|
|
7192
7606
|
placement: "top-start",
|
|
@@ -7194,7 +7608,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7194
7608
|
open: context.state.panelOpen && entries.length > 0,
|
|
7195
7609
|
onOpenChange: (panelOpen) => context.setState((state) => ({ ...state, panelOpen })),
|
|
7196
7610
|
overlayClassName: "sia-table-selection-popover",
|
|
7197
|
-
content: /* @__PURE__ */
|
|
7611
|
+
content: /* @__PURE__ */ jsx27(
|
|
7198
7612
|
TableSelectedItemsPanel,
|
|
7199
7613
|
{
|
|
7200
7614
|
entries,
|
|
@@ -7210,7 +7624,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7210
7624
|
onClear: () => setKeys([], context)
|
|
7211
7625
|
}
|
|
7212
7626
|
),
|
|
7213
|
-
children: /* @__PURE__ */
|
|
7627
|
+
children: /* @__PURE__ */ jsxs24(
|
|
7214
7628
|
Button,
|
|
7215
7629
|
{
|
|
7216
7630
|
className: "sia-table__selected-trigger",
|
|
@@ -7226,7 +7640,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7226
7640
|
)
|
|
7227
7641
|
}
|
|
7228
7642
|
),
|
|
7229
|
-
mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */
|
|
7643
|
+
mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */ jsx27(
|
|
7230
7644
|
Checkbox,
|
|
7231
7645
|
{
|
|
7232
7646
|
checked: preserving(context),
|
|
@@ -7283,9 +7697,9 @@ function createSortPlugin(options = {}) {
|
|
|
7283
7697
|
const info = current(context);
|
|
7284
7698
|
const order = info?.field === field ? info.order : null;
|
|
7285
7699
|
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"}`;
|
|
7286
|
-
return /* @__PURE__ */
|
|
7287
|
-
/* @__PURE__ */
|
|
7288
|
-
/* @__PURE__ */
|
|
7700
|
+
return /* @__PURE__ */ jsxs24("span", { className: "sia-table__sortable-header", children: [
|
|
7701
|
+
/* @__PURE__ */ jsx27("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
|
|
7702
|
+
/* @__PURE__ */ jsx27(
|
|
7289
7703
|
"button",
|
|
7290
7704
|
{
|
|
7291
7705
|
type: "button",
|
|
@@ -7297,9 +7711,9 @@ function createSortPlugin(options = {}) {
|
|
|
7297
7711
|
event.stopPropagation();
|
|
7298
7712
|
cycle(field, context);
|
|
7299
7713
|
},
|
|
7300
|
-
children: order ? /* @__PURE__ */
|
|
7301
|
-
/* @__PURE__ */
|
|
7302
|
-
/* @__PURE__ */
|
|
7714
|
+
children: order ? /* @__PURE__ */ jsx27(Icon, { name: order === "ascend" ? "chevron-up" : "chevron-down", size: 18 }) : /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
7715
|
+
/* @__PURE__ */ jsx27(Icon, { name: "chevron-up", size: 11 }),
|
|
7716
|
+
/* @__PURE__ */ jsx27(Icon, { name: "chevron-down", size: 11 })
|
|
7303
7717
|
] })
|
|
7304
7718
|
}
|
|
7305
7719
|
)
|
|
@@ -7334,27 +7748,27 @@ function TableFilterControl({
|
|
|
7334
7748
|
placeholder,
|
|
7335
7749
|
onApply
|
|
7336
7750
|
}) {
|
|
7337
|
-
const [open, setOpen] =
|
|
7338
|
-
const [draft, setDraft] =
|
|
7751
|
+
const [open, setOpen] = useState23(false);
|
|
7752
|
+
const [draft, setDraft] = useState23(value);
|
|
7339
7753
|
const label = getColumnLabel(column);
|
|
7340
|
-
|
|
7754
|
+
useEffect15(() => {
|
|
7341
7755
|
if (open) setDraft(value);
|
|
7342
7756
|
}, [open, value]);
|
|
7343
7757
|
const apply = (nextValue) => {
|
|
7344
7758
|
onApply(nextValue.trim());
|
|
7345
7759
|
setOpen(false);
|
|
7346
7760
|
};
|
|
7347
|
-
return /* @__PURE__ */
|
|
7348
|
-
/* @__PURE__ */
|
|
7349
|
-
/* @__PURE__ */
|
|
7761
|
+
return /* @__PURE__ */ jsxs24("span", { className: "sia-table__filter-header", children: [
|
|
7762
|
+
/* @__PURE__ */ jsx27("span", { children: column.title ?? column.name ?? column.key }),
|
|
7763
|
+
/* @__PURE__ */ jsx27(
|
|
7350
7764
|
Popover,
|
|
7351
7765
|
{
|
|
7352
7766
|
open,
|
|
7353
7767
|
onOpenChange: setOpen,
|
|
7354
7768
|
placement: "bottom-end",
|
|
7355
7769
|
overlayClassName: "sia-table-filter-popover",
|
|
7356
|
-
content: /* @__PURE__ */
|
|
7357
|
-
/* @__PURE__ */
|
|
7770
|
+
content: /* @__PURE__ */ jsxs24("div", { className: "sia-table-filter-panel", children: [
|
|
7771
|
+
/* @__PURE__ */ jsx27(
|
|
7358
7772
|
Input,
|
|
7359
7773
|
{
|
|
7360
7774
|
size: "small",
|
|
@@ -7368,8 +7782,8 @@ function TableFilterControl({
|
|
|
7368
7782
|
}
|
|
7369
7783
|
}
|
|
7370
7784
|
),
|
|
7371
|
-
/* @__PURE__ */
|
|
7372
|
-
/* @__PURE__ */
|
|
7785
|
+
/* @__PURE__ */ jsxs24("div", { className: "sia-table-filter-panel__actions", children: [
|
|
7786
|
+
/* @__PURE__ */ jsx27(
|
|
7373
7787
|
Button,
|
|
7374
7788
|
{
|
|
7375
7789
|
size: "small",
|
|
@@ -7381,7 +7795,7 @@ function TableFilterControl({
|
|
|
7381
7795
|
children: "\u6E05\u9664"
|
|
7382
7796
|
}
|
|
7383
7797
|
),
|
|
7384
|
-
/* @__PURE__ */
|
|
7798
|
+
/* @__PURE__ */ jsx27(
|
|
7385
7799
|
Button,
|
|
7386
7800
|
{
|
|
7387
7801
|
size: "small",
|
|
@@ -7392,7 +7806,7 @@ function TableFilterControl({
|
|
|
7392
7806
|
)
|
|
7393
7807
|
] })
|
|
7394
7808
|
] }),
|
|
7395
|
-
children: /* @__PURE__ */
|
|
7809
|
+
children: /* @__PURE__ */ jsx27(
|
|
7396
7810
|
"button",
|
|
7397
7811
|
{
|
|
7398
7812
|
type: "button",
|
|
@@ -7400,7 +7814,7 @@ function TableFilterControl({
|
|
|
7400
7814
|
"aria-label": `\u7B5B\u9009${label}`,
|
|
7401
7815
|
"aria-pressed": Boolean(value),
|
|
7402
7816
|
onClick: (event) => event.stopPropagation(),
|
|
7403
|
-
children: /* @__PURE__ */
|
|
7817
|
+
children: /* @__PURE__ */ jsx27(Icon, { name: "search", size: 13 })
|
|
7404
7818
|
}
|
|
7405
7819
|
)
|
|
7406
7820
|
}
|
|
@@ -7462,7 +7876,7 @@ function createFilterPlugin(options = {}) {
|
|
|
7462
7876
|
title: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title
|
|
7463
7877
|
};
|
|
7464
7878
|
const placeholder = typeof options.placeholder === "function" ? options.placeholder(currentColumn) : options.placeholder ?? `\u8F93\u5165${getColumnLabel(currentColumn)}\u7B5B\u9009`;
|
|
7465
|
-
return /* @__PURE__ */
|
|
7879
|
+
return /* @__PURE__ */ jsx27(
|
|
7466
7880
|
TableFilterControl,
|
|
7467
7881
|
{
|
|
7468
7882
|
column: renderedColumn,
|
|
@@ -7551,7 +7965,7 @@ function createPaginationPlugin(options = {}) {
|
|
|
7551
7965
|
const page = currentPage(context);
|
|
7552
7966
|
const filteredCount = context.getPluginApi("filter")?.getFilteredRows().length;
|
|
7553
7967
|
const totalRecords = options.totalCount ?? filteredCount ?? context.sourceData.length;
|
|
7554
|
-
return /* @__PURE__ */
|
|
7968
|
+
return /* @__PURE__ */ jsx27(
|
|
7555
7969
|
Pagination,
|
|
7556
7970
|
{
|
|
7557
7971
|
className: "sia-table__pagination",
|
|
@@ -7689,19 +8103,19 @@ function createTreePlugin(options = {}) {
|
|
|
7689
8103
|
return {
|
|
7690
8104
|
...column,
|
|
7691
8105
|
...options.showLine ? { ellipsis: false, meta: { ...column.meta, treeLines: true } } : {},
|
|
7692
|
-
render: (value, record, index, info) => /* @__PURE__ */
|
|
8106
|
+
render: (value, record, index, info) => /* @__PURE__ */ jsxs24(
|
|
7693
8107
|
"span",
|
|
7694
8108
|
{
|
|
7695
8109
|
className: `sia-table__tree-cell${options.showLine ? " sia-table__tree-cell--lines" : ""}`,
|
|
7696
8110
|
style: options.showLine ? void 0 : { paddingLeft: info.row.depth * 18 },
|
|
7697
8111
|
children: [
|
|
7698
|
-
options.showLine && info.row.depth > 0 && /* @__PURE__ */
|
|
7699
|
-
info.row.meta.treeGuides.map((continued, level) => /* @__PURE__ */
|
|
7700
|
-
/* @__PURE__ */
|
|
8112
|
+
options.showLine && info.row.depth > 0 && /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
8113
|
+
info.row.meta.treeGuides.map((continued, level) => /* @__PURE__ */ jsx27("span", { "aria-hidden": "true", className: `sia-table__tree-guide${continued ? " sia-table__tree-guide--continued" : ""}` }, level)),
|
|
8114
|
+
/* @__PURE__ */ jsx27("span", { "aria-hidden": "true", className: `sia-table__tree-guide sia-table__tree-guide--branch${info.row.meta.treeHasNextSibling ? " sia-table__tree-guide--continued" : ""}` })
|
|
7701
8115
|
] }),
|
|
7702
|
-
/* @__PURE__ */
|
|
7703
|
-
options.showLine && !!info.row.meta.treeHasChildren && current(context).includes(info.row.key) && /* @__PURE__ */
|
|
7704
|
-
info.row.meta.treeHasChildren ? /* @__PURE__ */
|
|
8116
|
+
/* @__PURE__ */ jsxs24("span", { className: options.showLine ? "sia-table__tree-node" : void 0, style: options.showLine ? void 0 : { display: "contents" }, children: [
|
|
8117
|
+
options.showLine && !!info.row.meta.treeHasChildren && current(context).includes(info.row.key) && /* @__PURE__ */ jsx27("span", { "aria-hidden": "true", className: "sia-table__tree-stem" }),
|
|
8118
|
+
info.row.meta.treeHasChildren ? /* @__PURE__ */ jsx27(
|
|
7705
8119
|
"button",
|
|
7706
8120
|
{
|
|
7707
8121
|
type: "button",
|
|
@@ -7712,7 +8126,7 @@ function createTreePlugin(options = {}) {
|
|
|
7712
8126
|
event.stopPropagation();
|
|
7713
8127
|
toggle(info.row.key, context);
|
|
7714
8128
|
},
|
|
7715
|
-
children: /* @__PURE__ */
|
|
8129
|
+
children: /* @__PURE__ */ jsx27(
|
|
7716
8130
|
Icon,
|
|
7717
8131
|
{
|
|
7718
8132
|
name: current(context).includes(info.row.key) ? "chevron-down" : "chevron-right",
|
|
@@ -7720,7 +8134,7 @@ function createTreePlugin(options = {}) {
|
|
|
7720
8134
|
}
|
|
7721
8135
|
)
|
|
7722
8136
|
}
|
|
7723
|
-
) : /* @__PURE__ */
|
|
8137
|
+
) : /* @__PURE__ */ jsx27("span", { className: "sia-table__tree-placeholder" })
|
|
7724
8138
|
] }),
|
|
7725
8139
|
previousRender ? previousRender(value, record, index, info) : value
|
|
7726
8140
|
]
|
|
@@ -7776,17 +8190,17 @@ function EditableTableCell({
|
|
|
7776
8190
|
showEditIcon
|
|
7777
8191
|
}) {
|
|
7778
8192
|
const config = typeof editable === "object" ? editable : { type: "input" };
|
|
7779
|
-
const [editValue, setEditValue] =
|
|
7780
|
-
const [saving, setSaving] =
|
|
7781
|
-
const inputRef =
|
|
7782
|
-
const editorRef =
|
|
7783
|
-
const editValueRef =
|
|
7784
|
-
const savingRef =
|
|
7785
|
-
const saveRef =
|
|
8193
|
+
const [editValue, setEditValue] = useState23(value);
|
|
8194
|
+
const [saving, setSaving] = useState23(false);
|
|
8195
|
+
const inputRef = useRef22(null);
|
|
8196
|
+
const editorRef = useRef22(null);
|
|
8197
|
+
const editValueRef = useRef22(value);
|
|
8198
|
+
const savingRef = useRef22(false);
|
|
8199
|
+
const saveRef = useRef22(
|
|
7786
8200
|
async () => {
|
|
7787
8201
|
}
|
|
7788
8202
|
);
|
|
7789
|
-
|
|
8203
|
+
useEffect15(() => {
|
|
7790
8204
|
if (!active) return;
|
|
7791
8205
|
editValueRef.current = value;
|
|
7792
8206
|
setEditValue(value);
|
|
@@ -7817,7 +8231,7 @@ function EditableTableCell({
|
|
|
7817
8231
|
}
|
|
7818
8232
|
}
|
|
7819
8233
|
saveRef.current = save;
|
|
7820
|
-
|
|
8234
|
+
useEffect15(() => {
|
|
7821
8235
|
if (!active || config.type === "select" || config.type === "custom") return;
|
|
7822
8236
|
const handleOutsidePointerDown = (event) => {
|
|
7823
8237
|
const target = event.target;
|
|
@@ -7833,15 +8247,15 @@ function EditableTableCell({
|
|
|
7833
8247
|
);
|
|
7834
8248
|
}, [active, config.type]);
|
|
7835
8249
|
if (!active)
|
|
7836
|
-
return /* @__PURE__ */
|
|
8250
|
+
return /* @__PURE__ */ jsxs24(
|
|
7837
8251
|
"div",
|
|
7838
8252
|
{
|
|
7839
8253
|
className: "sia-table__editable-display",
|
|
7840
8254
|
onClick: trigger === "click" ? onStart : void 0,
|
|
7841
8255
|
onDoubleClick: trigger === "doubleClick" ? onStart : void 0,
|
|
7842
8256
|
children: [
|
|
7843
|
-
/* @__PURE__ */
|
|
7844
|
-
showEditIcon && /* @__PURE__ */
|
|
8257
|
+
/* @__PURE__ */ jsx27("span", { children: content }),
|
|
8258
|
+
showEditIcon && /* @__PURE__ */ jsx27(Icon, { name: "edit", size: 13 })
|
|
7845
8259
|
]
|
|
7846
8260
|
}
|
|
7847
8261
|
);
|
|
@@ -7849,7 +8263,7 @@ function EditableTableCell({
|
|
|
7849
8263
|
if (config.type === "custom" && config.editRender) {
|
|
7850
8264
|
editor = config.editRender(record, (next) => void save(next), onCancel);
|
|
7851
8265
|
} else if (config.type === "inputNumber") {
|
|
7852
|
-
editor = /* @__PURE__ */
|
|
8266
|
+
editor = /* @__PURE__ */ jsx27(
|
|
7853
8267
|
InputNumber,
|
|
7854
8268
|
{
|
|
7855
8269
|
ref: inputRef,
|
|
@@ -7870,7 +8284,7 @@ function EditableTableCell({
|
|
|
7870
8284
|
}
|
|
7871
8285
|
);
|
|
7872
8286
|
} else if (config.type === "select") {
|
|
7873
|
-
editor = /* @__PURE__ */
|
|
8287
|
+
editor = /* @__PURE__ */ jsx27(
|
|
7874
8288
|
Select,
|
|
7875
8289
|
{
|
|
7876
8290
|
size: "small",
|
|
@@ -7884,14 +8298,14 @@ function EditableTableCell({
|
|
|
7884
8298
|
}
|
|
7885
8299
|
);
|
|
7886
8300
|
} else {
|
|
7887
|
-
editor = /* @__PURE__ */
|
|
8301
|
+
editor = /* @__PURE__ */ jsx27(
|
|
7888
8302
|
Input,
|
|
7889
8303
|
{
|
|
7890
8304
|
ref: inputRef,
|
|
7891
8305
|
size: "small",
|
|
7892
8306
|
value: String(editValue ?? ""),
|
|
7893
8307
|
disabled: saving,
|
|
7894
|
-
suffix: saving ? /* @__PURE__ */
|
|
8308
|
+
suffix: saving ? /* @__PURE__ */ jsx27(Icon, { name: "loader", size: 13, spin: true }) : null,
|
|
7895
8309
|
onChange: (event) => updateEditValue(event.target.value),
|
|
7896
8310
|
onBlur: () => void save(),
|
|
7897
8311
|
onKeyDown: (event) => {
|
|
@@ -7901,7 +8315,7 @@ function EditableTableCell({
|
|
|
7901
8315
|
}
|
|
7902
8316
|
);
|
|
7903
8317
|
}
|
|
7904
|
-
return /* @__PURE__ */
|
|
8318
|
+
return /* @__PURE__ */ jsx27("div", { ref: editorRef, className: "sia-table__editor", children: editor });
|
|
7905
8319
|
}
|
|
7906
8320
|
function createEditablePlugin(options = {}) {
|
|
7907
8321
|
const trigger = options.trigger ?? "click";
|
|
@@ -7921,7 +8335,7 @@ function createEditablePlugin(options = {}) {
|
|
|
7921
8335
|
const active = canEdit && context.state.editing?.rowKey === info.row.key && context.state.editing.columnKey === column.key;
|
|
7922
8336
|
const content = previousRender ? previousRender(value, record, index, info) : value;
|
|
7923
8337
|
if (!canEdit) return content;
|
|
7924
|
-
return /* @__PURE__ */
|
|
8338
|
+
return /* @__PURE__ */ jsx27(
|
|
7925
8339
|
EditableTableCell,
|
|
7926
8340
|
{
|
|
7927
8341
|
active,
|
|
@@ -7985,9 +8399,9 @@ function createResizePlugin(options = {}) {
|
|
|
7985
8399
|
...column,
|
|
7986
8400
|
autoWidth,
|
|
7987
8401
|
width,
|
|
7988
|
-
renderHeader: (currentColumn, coreContext) => /* @__PURE__ */
|
|
7989
|
-
/* @__PURE__ */
|
|
7990
|
-
/* @__PURE__ */
|
|
8402
|
+
renderHeader: (currentColumn, coreContext) => /* @__PURE__ */ jsxs24("span", { className: "sia-table__resizable-header", children: [
|
|
8403
|
+
/* @__PURE__ */ jsx27("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
|
|
8404
|
+
/* @__PURE__ */ jsx27(
|
|
7991
8405
|
"span",
|
|
7992
8406
|
{
|
|
7993
8407
|
className: "sia-table__resize-handle",
|
|
@@ -8123,12 +8537,12 @@ function ColumnSettingPanel({
|
|
|
8123
8537
|
onClose,
|
|
8124
8538
|
onApply
|
|
8125
8539
|
}) {
|
|
8126
|
-
const [draft, setDraft] =
|
|
8127
|
-
const listRef =
|
|
8128
|
-
const cancelDrag =
|
|
8129
|
-
const [preview, setPreview] =
|
|
8130
|
-
const syncedDraft =
|
|
8131
|
-
|
|
8540
|
+
const [draft, setDraft] = useState23(items);
|
|
8541
|
+
const listRef = useRef22(null);
|
|
8542
|
+
const cancelDrag = useRef22(null);
|
|
8543
|
+
const [preview, setPreview] = useState23(null);
|
|
8544
|
+
const syncedDraft = useRef22({ open: false, signature: "" });
|
|
8545
|
+
useEffect15(() => {
|
|
8132
8546
|
const signature = JSON.stringify(items);
|
|
8133
8547
|
const changed = signature !== syncedDraft.current.signature;
|
|
8134
8548
|
if (open !== syncedDraft.current.open || changed) cancelDrag.current?.();
|
|
@@ -8137,7 +8551,7 @@ function ColumnSettingPanel({
|
|
|
8137
8551
|
}
|
|
8138
8552
|
syncedDraft.current = { open, signature };
|
|
8139
8553
|
}, [items, open]);
|
|
8140
|
-
|
|
8554
|
+
useEffect15(() => () => cancelDrag.current?.(), []);
|
|
8141
8555
|
const labels = new Map(
|
|
8142
8556
|
flattenTableColumns(columns).map((column) => [
|
|
8143
8557
|
column.key,
|
|
@@ -8264,7 +8678,7 @@ function ColumnSettingPanel({
|
|
|
8264
8678
|
window.addEventListener("blur", cancel);
|
|
8265
8679
|
frame = requestAnimationFrame(tick);
|
|
8266
8680
|
}
|
|
8267
|
-
return /* @__PURE__ */
|
|
8681
|
+
return /* @__PURE__ */ jsxs24(
|
|
8268
8682
|
Drawer2,
|
|
8269
8683
|
{
|
|
8270
8684
|
open,
|
|
@@ -8273,9 +8687,9 @@ function ColumnSettingPanel({
|
|
|
8273
8687
|
onOpenChange: (next) => {
|
|
8274
8688
|
if (!next) onClose();
|
|
8275
8689
|
},
|
|
8276
|
-
footer: /* @__PURE__ */
|
|
8277
|
-
/* @__PURE__ */
|
|
8278
|
-
/* @__PURE__ */
|
|
8690
|
+
footer: /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
8691
|
+
/* @__PURE__ */ jsx27(Button, { onClick: onClose, children: "\u53D6\u6D88" }),
|
|
8692
|
+
/* @__PURE__ */ jsx27(
|
|
8279
8693
|
Button,
|
|
8280
8694
|
{
|
|
8281
8695
|
variant: "primary",
|
|
@@ -8286,19 +8700,19 @@ function ColumnSettingPanel({
|
|
|
8286
8700
|
)
|
|
8287
8701
|
] }),
|
|
8288
8702
|
children: [
|
|
8289
|
-
loadError ? /* @__PURE__ */
|
|
8703
|
+
loadError ? /* @__PURE__ */ jsxs24("p", { role: "alert", children: [
|
|
8290
8704
|
"\u8BFB\u53D6\u5217\u914D\u7F6E\u5931\u8D25\u3002",
|
|
8291
|
-
/* @__PURE__ */
|
|
8705
|
+
/* @__PURE__ */ jsx27(Button, { variant: "link", onClick: onRetry, children: "\u91CD\u8BD5" })
|
|
8292
8706
|
] }) : null,
|
|
8293
|
-
/* @__PURE__ */
|
|
8707
|
+
/* @__PURE__ */ jsx27(Spin, { spinning: Boolean(loading), className: "sia-table-settings__loading", "aria-label": loading ? "\u6B63\u5728\u8BFB\u53D6\u5217\u914D\u7F6E" : void 0, children: /* @__PURE__ */ jsxs24(
|
|
8294
8708
|
"fieldset",
|
|
8295
8709
|
{
|
|
8296
8710
|
disabled: loading || loadError,
|
|
8297
8711
|
style: { border: 0, padding: 0, margin: 0, minWidth: 0 },
|
|
8298
8712
|
"aria-busy": loading,
|
|
8299
8713
|
children: [
|
|
8300
|
-
/* @__PURE__ */
|
|
8301
|
-
/* @__PURE__ */
|
|
8714
|
+
/* @__PURE__ */ jsxs24("label", { className: "sia-table-settings__all", children: [
|
|
8715
|
+
/* @__PURE__ */ jsx27(
|
|
8302
8716
|
TableCheckbox,
|
|
8303
8717
|
{
|
|
8304
8718
|
label: "\u5168\u9009\u5217",
|
|
@@ -8309,7 +8723,7 @@ function ColumnSettingPanel({
|
|
|
8309
8723
|
)
|
|
8310
8724
|
}
|
|
8311
8725
|
),
|
|
8312
|
-
/* @__PURE__ */
|
|
8726
|
+
/* @__PURE__ */ jsxs24("span", { children: [
|
|
8313
8727
|
"\u5168\u9009\uFF08",
|
|
8314
8728
|
visibleCount,
|
|
8315
8729
|
"/",
|
|
@@ -8317,12 +8731,12 @@ function ColumnSettingPanel({
|
|
|
8317
8731
|
"\uFF09"
|
|
8318
8732
|
] })
|
|
8319
8733
|
] }),
|
|
8320
|
-
/* @__PURE__ */
|
|
8734
|
+
/* @__PURE__ */ jsx27(
|
|
8321
8735
|
"div",
|
|
8322
8736
|
{
|
|
8323
8737
|
ref: listRef,
|
|
8324
8738
|
className: `sia-table-settings__list${preview ? " is-sorting" : ""}`,
|
|
8325
|
-
children: draft.map((item) => /* @__PURE__ */
|
|
8739
|
+
children: draft.map((item) => /* @__PURE__ */ jsxs24(
|
|
8326
8740
|
"div",
|
|
8327
8741
|
{
|
|
8328
8742
|
"data-column-key": item.key,
|
|
@@ -8332,8 +8746,8 @@ function ColumnSettingPanel({
|
|
|
8332
8746
|
} : void 0,
|
|
8333
8747
|
onPointerDown: (event) => startSort(event, item.key),
|
|
8334
8748
|
children: [
|
|
8335
|
-
/* @__PURE__ */
|
|
8336
|
-
/* @__PURE__ */
|
|
8749
|
+
/* @__PURE__ */ jsx27(Icon, { name: "menu", size: 15 }),
|
|
8750
|
+
/* @__PURE__ */ jsx27(
|
|
8337
8751
|
TableCheckbox,
|
|
8338
8752
|
{
|
|
8339
8753
|
label: `\u663E\u793A${labels.get(item.key) ?? item.key}\u5217`,
|
|
@@ -8345,15 +8759,15 @@ function ColumnSettingPanel({
|
|
|
8345
8759
|
)
|
|
8346
8760
|
}
|
|
8347
8761
|
),
|
|
8348
|
-
/* @__PURE__ */
|
|
8762
|
+
/* @__PURE__ */ jsx27(
|
|
8349
8763
|
"span",
|
|
8350
8764
|
{
|
|
8351
8765
|
className: "sia-table-settings__name",
|
|
8352
8766
|
children: labels.get(item.key) ?? item.key
|
|
8353
8767
|
}
|
|
8354
8768
|
),
|
|
8355
|
-
/* @__PURE__ */
|
|
8356
|
-
/* @__PURE__ */
|
|
8769
|
+
/* @__PURE__ */ jsxs24("div", { className: "sia-table-settings__actions", children: [
|
|
8770
|
+
/* @__PURE__ */ jsx27(
|
|
8357
8771
|
Button,
|
|
8358
8772
|
{
|
|
8359
8773
|
size: "small",
|
|
@@ -8366,7 +8780,7 @@ function ColumnSettingPanel({
|
|
|
8366
8780
|
children: "\u5DE6"
|
|
8367
8781
|
}
|
|
8368
8782
|
),
|
|
8369
|
-
/* @__PURE__ */
|
|
8783
|
+
/* @__PURE__ */ jsx27(
|
|
8370
8784
|
Button,
|
|
8371
8785
|
{
|
|
8372
8786
|
size: "small",
|
|
@@ -8516,7 +8930,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8516
8930
|
{
|
|
8517
8931
|
key: "builtin:export",
|
|
8518
8932
|
label: "\u8868\u683C\u5BFC\u51FA",
|
|
8519
|
-
icon: /* @__PURE__ */
|
|
8933
|
+
icon: /* @__PURE__ */ jsx27(Icon, { name: "download", size: 18 }),
|
|
8520
8934
|
disabled: exportApi().getRows().length === 0
|
|
8521
8935
|
},
|
|
8522
8936
|
{ key: "builtin:divider", type: "divider" }
|
|
@@ -8524,7 +8938,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8524
8938
|
{
|
|
8525
8939
|
key: "builtin:columns",
|
|
8526
8940
|
label: "\u5217\u8BBE\u7F6E",
|
|
8527
|
-
icon: /* @__PURE__ */
|
|
8941
|
+
icon: /* @__PURE__ */ jsx27(Icon, { name: "settings", size: 18 })
|
|
8528
8942
|
},
|
|
8529
8943
|
...customItems.map((item) => ({
|
|
8530
8944
|
key: "custom:" + item.key,
|
|
@@ -8536,7 +8950,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8536
8950
|
disabled: item.disabled === true || typeof item.disabled === "function" && item.disabled(context)
|
|
8537
8951
|
}))
|
|
8538
8952
|
];
|
|
8539
|
-
return /* @__PURE__ */
|
|
8953
|
+
return /* @__PURE__ */ jsx27(
|
|
8540
8954
|
Dropdown,
|
|
8541
8955
|
{
|
|
8542
8956
|
disabled: options.buttonProps?.disabled || options.buttonProps?.loading,
|
|
@@ -8553,12 +8967,12 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8553
8967
|
void customItems.find((item) => "custom:" + item.key === key)?.onClick?.(context);
|
|
8554
8968
|
}
|
|
8555
8969
|
},
|
|
8556
|
-
children: /* @__PURE__ */
|
|
8970
|
+
children: /* @__PURE__ */ jsx27(
|
|
8557
8971
|
Button,
|
|
8558
8972
|
{
|
|
8559
8973
|
size: "small",
|
|
8560
8974
|
variant: "text",
|
|
8561
|
-
icon: /* @__PURE__ */
|
|
8975
|
+
icon: /* @__PURE__ */ jsx27(Icon, { name: "settings", size: 16 }),
|
|
8562
8976
|
"aria-label": "\u8868\u683C\u8BBE\u7F6E",
|
|
8563
8977
|
...options.buttonProps,
|
|
8564
8978
|
className: `sia-table__settings-button${options.buttonProps?.children == null ? " sia-table__toolbar-icon" : ""} ${options.buttonProps?.className ?? ""}`.trim()
|
|
@@ -8567,7 +8981,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8567
8981
|
}
|
|
8568
8982
|
);
|
|
8569
8983
|
},
|
|
8570
|
-
renderOverlay: (context) => /* @__PURE__ */
|
|
8984
|
+
renderOverlay: (context) => /* @__PURE__ */ jsx27(
|
|
8571
8985
|
ColumnSettingPanel,
|
|
8572
8986
|
{
|
|
8573
8987
|
open: context.state.open,
|
|
@@ -8617,11 +9031,11 @@ function ToolbarItems({
|
|
|
8617
9031
|
items,
|
|
8618
9032
|
context
|
|
8619
9033
|
}) {
|
|
8620
|
-
return /* @__PURE__ */
|
|
9034
|
+
return /* @__PURE__ */ jsx27(Fragment8, { children: items.map((item) => {
|
|
8621
9035
|
if (item.hidden === true || typeof item.hidden === "function" && item.hidden(context))
|
|
8622
9036
|
return null;
|
|
8623
9037
|
const disabled = item.disabled === true || typeof item.disabled === "function" && item.disabled(context);
|
|
8624
|
-
return /* @__PURE__ */
|
|
9038
|
+
return /* @__PURE__ */ jsx27(
|
|
8625
9039
|
Button,
|
|
8626
9040
|
{
|
|
8627
9041
|
size: "small",
|
|
@@ -8644,16 +9058,16 @@ function createToolbarPlugin(options) {
|
|
|
8644
9058
|
return {
|
|
8645
9059
|
id: "toolbar",
|
|
8646
9060
|
order: 5,
|
|
8647
|
-
renderToolbarStart: (context) => /* @__PURE__ */
|
|
9061
|
+
renderToolbarStart: (context) => /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
8648
9062
|
options.start,
|
|
8649
|
-
/* @__PURE__ */
|
|
9063
|
+
/* @__PURE__ */ jsx27(ToolbarItems, { items: items("start"), context })
|
|
8650
9064
|
] }),
|
|
8651
|
-
renderToolbarEnd: (context) => /* @__PURE__ */
|
|
9065
|
+
renderToolbarEnd: (context) => /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
8652
9066
|
options.end,
|
|
8653
|
-
/* @__PURE__ */
|
|
8654
|
-
items("end", true).length > 0 ? /* @__PURE__ */
|
|
8655
|
-
/* @__PURE__ */
|
|
8656
|
-
/* @__PURE__ */
|
|
9067
|
+
/* @__PURE__ */ jsx27(ToolbarItems, { items: items("end"), context }),
|
|
9068
|
+
items("end", true).length > 0 ? /* @__PURE__ */ jsxs24("details", { className: "sia-table__toolbar-menu", children: [
|
|
9069
|
+
/* @__PURE__ */ jsx27("summary", { "aria-label": "\u66F4\u591A\u8868\u683C\u64CD\u4F5C", children: /* @__PURE__ */ jsx27(Icon, { name: "more-horizontal", size: 16 }) }),
|
|
9070
|
+
/* @__PURE__ */ jsx27("div", { children: /* @__PURE__ */ jsx27(ToolbarItems, { items: items("end", true), context }) })
|
|
8657
9071
|
] }) : null
|
|
8658
9072
|
] })
|
|
8659
9073
|
};
|
|
@@ -8735,11 +9149,11 @@ function createExportPlugin(options = {}) {
|
|
|
8735
9149
|
return {
|
|
8736
9150
|
id: "export",
|
|
8737
9151
|
order: 95,
|
|
8738
|
-
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */
|
|
9152
|
+
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */ jsx27(
|
|
8739
9153
|
Button,
|
|
8740
9154
|
{
|
|
8741
9155
|
size: "small",
|
|
8742
|
-
icon: /* @__PURE__ */
|
|
9156
|
+
icon: /* @__PURE__ */ jsx27(Icon, { name: "download", size: 14 }),
|
|
8743
9157
|
disabled: getRows(context).length === 0,
|
|
8744
9158
|
onClick: () => void download(context),
|
|
8745
9159
|
children: options.buttonLabel ?? "\u5BFC\u51FA"
|
|
@@ -8754,7 +9168,7 @@ function createExportPlugin(options = {}) {
|
|
|
8754
9168
|
}
|
|
8755
9169
|
|
|
8756
9170
|
// src/components/Table/Table.tsx
|
|
8757
|
-
import { jsx as
|
|
9171
|
+
import { jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
8758
9172
|
var EMPTY_DATA = [];
|
|
8759
9173
|
var EMPTY_COLUMNS = [];
|
|
8760
9174
|
var EMPTY_PLUGINS = [];
|
|
@@ -8868,7 +9282,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8868
9282
|
onCellPointerDown,
|
|
8869
9283
|
onCellPointerMove
|
|
8870
9284
|
}) {
|
|
8871
|
-
return /* @__PURE__ */
|
|
9285
|
+
return /* @__PURE__ */ jsx28(
|
|
8872
9286
|
"tr",
|
|
8873
9287
|
{
|
|
8874
9288
|
"data-row-key": String(row.key),
|
|
@@ -8884,7 +9298,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8884
9298
|
if (columnIndex > 0 && !visibleColumns.has(columns[columnIndex - 1].key)) return null;
|
|
8885
9299
|
let count = 1;
|
|
8886
9300
|
while (columnIndex + count < columns.length && !visibleColumns.has(columns[columnIndex + count].key)) count++;
|
|
8887
|
-
return /* @__PURE__ */
|
|
9301
|
+
return /* @__PURE__ */ jsx28("td", { colSpan: count, "aria-hidden": "true", style: { padding: 0 } }, `spacer-${column.key}`);
|
|
8888
9302
|
}
|
|
8889
9303
|
const pluginCellProps = getCellProps(column);
|
|
8890
9304
|
if (pluginCellProps.hidden) return null;
|
|
@@ -8895,7 +9309,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8895
9309
|
const fixedStyle = fixed === "left" ? { left: leftOffsets.get(column.key) } : fixed === "right" ? { right: rightOffsets.get(column.key) } : void 0;
|
|
8896
9310
|
const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
8897
9311
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
8898
|
-
return /* @__PURE__ */
|
|
9312
|
+
return /* @__PURE__ */ jsx28(
|
|
8899
9313
|
"td",
|
|
8900
9314
|
{
|
|
8901
9315
|
"data-column-key": column.key,
|
|
@@ -8912,7 +9326,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8912
9326
|
onContextMenu: (event) => onCellContextMenu(column, event),
|
|
8913
9327
|
onPointerDown: (event) => onCellPointerDown(column, event),
|
|
8914
9328
|
onPointerMove: (event) => onCellPointerMove(column, event),
|
|
8915
|
-
children: !canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? /* @__PURE__ */
|
|
9329
|
+
children: !canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? /* @__PURE__ */ jsx28(
|
|
8916
9330
|
TableCellContent,
|
|
8917
9331
|
{
|
|
8918
9332
|
ellipsis: column.ellipsis !== false,
|
|
@@ -8964,31 +9378,31 @@ function TableInner(props, ref) {
|
|
|
8964
9378
|
style,
|
|
8965
9379
|
...htmlProps
|
|
8966
9380
|
} = props;
|
|
8967
|
-
const rootRef =
|
|
9381
|
+
const rootRef = useRef23(null);
|
|
8968
9382
|
const remainingHeight = useRemainingHeight(rootRef, height == null && tableHeight == null ? fillRemaining : false);
|
|
8969
|
-
const scrollRef =
|
|
8970
|
-
const cellFocusRequest =
|
|
8971
|
-
const cellGlow =
|
|
8972
|
-
|
|
9383
|
+
const scrollRef = useRef23(null);
|
|
9384
|
+
const cellFocusRequest = useRef23(0);
|
|
9385
|
+
const cellGlow = useRef23(null);
|
|
9386
|
+
useEffect16(() => () => {
|
|
8973
9387
|
cellFocusRequest.current++;
|
|
8974
9388
|
cellGlow.current?.();
|
|
8975
9389
|
}, []);
|
|
8976
|
-
const tableRef =
|
|
9390
|
+
const tableRef = useRef23(null);
|
|
8977
9391
|
useScrollbarProximity();
|
|
8978
|
-
const scrollbarDragRef =
|
|
8979
|
-
const [internalLoading, setInternalLoading] =
|
|
8980
|
-
const [scrollTop, setScrollTop] =
|
|
8981
|
-
const [scrollLeft, setScrollLeft] =
|
|
8982
|
-
const [viewportHeight, setViewportHeight] =
|
|
8983
|
-
const [viewportWidth, setViewportWidth] =
|
|
8984
|
-
const [autoColumnWidths, setAutoColumnWidths] =
|
|
8985
|
-
const [resolveRowIdentity] =
|
|
9392
|
+
const scrollbarDragRef = useRef23(null);
|
|
9393
|
+
const [internalLoading, setInternalLoading] = useState24(false);
|
|
9394
|
+
const [scrollTop, setScrollTop] = useState24(0);
|
|
9395
|
+
const [scrollLeft, setScrollLeft] = useState24(0);
|
|
9396
|
+
const [viewportHeight, setViewportHeight] = useState24(420);
|
|
9397
|
+
const [viewportWidth, setViewportWidth] = useState24(0);
|
|
9398
|
+
const [autoColumnWidths, setAutoColumnWidths] = useState24({});
|
|
9399
|
+
const [resolveRowIdentity] = useState24(createRowIdentity);
|
|
8986
9400
|
const getRowKey = useCallback2((record, index) => resolveRowIdentity(record, index, typeof rowKey === "function" ? rowKey : rowKey == null ? void 0 : String(rowKey)), [rowKey, resolveRowIdentity]);
|
|
8987
|
-
const builtInResizePlugin =
|
|
8988
|
-
const builtInHighlightPlugin =
|
|
8989
|
-
const builtInCellSelectionPlugin =
|
|
8990
|
-
const builtInIndexPlugin =
|
|
8991
|
-
const activePlugins =
|
|
9401
|
+
const builtInResizePlugin = useMemo10(() => createResizePlugin(), []);
|
|
9402
|
+
const builtInHighlightPlugin = useMemo10(() => createHighlightPlugin(), []);
|
|
9403
|
+
const builtInCellSelectionPlugin = useMemo10(() => createCellSelectionPlugin(), []);
|
|
9404
|
+
const builtInIndexPlugin = useMemo10(() => createIndexPlugin(), []);
|
|
9405
|
+
const activePlugins = useMemo10(() => {
|
|
8992
9406
|
const plugins = providedPlugins.filter((plugin) => (resizable || plugin.id !== "resize") && (cellSelection || plugin.id !== "cellSelection") && (showIndex || plugin.id !== "index"));
|
|
8993
9407
|
if (!plugins.some((plugin) => plugin.id === "highlight")) plugins.push(builtInHighlightPlugin);
|
|
8994
9408
|
if (resizable && !plugins.some((plugin) => plugin.id === "resize")) plugins.push(builtInResizePlugin);
|
|
@@ -8996,15 +9410,15 @@ function TableInner(props, ref) {
|
|
|
8996
9410
|
if (showIndex && !plugins.some((plugin) => plugin.id === "index")) plugins.push(builtInIndexPlugin);
|
|
8997
9411
|
return plugins;
|
|
8998
9412
|
}, [builtInHighlightPlugin, builtInResizePlugin, builtInCellSelectionPlugin, builtInIndexPlugin, providedPlugins, resizable, cellSelection, showIndex]);
|
|
8999
|
-
const sortedPlugins =
|
|
9000
|
-
const pluginsByIdRef =
|
|
9413
|
+
const sortedPlugins = useMemo10(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
|
|
9414
|
+
const pluginsByIdRef = useRef23(/* @__PURE__ */ new Map());
|
|
9001
9415
|
pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
9002
|
-
const [pluginStates, setPluginStates] =
|
|
9416
|
+
const [pluginStates, setPluginStates] = useState24(() => Object.fromEntries(
|
|
9003
9417
|
sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
|
|
9004
9418
|
));
|
|
9005
|
-
const pluginApisRef =
|
|
9006
|
-
const contextsRef =
|
|
9007
|
-
const mountedPluginsRef =
|
|
9419
|
+
const pluginApisRef = useRef23({});
|
|
9420
|
+
const contextsRef = useRef23(/* @__PURE__ */ new Map());
|
|
9421
|
+
const mountedPluginsRef = useRef23(/* @__PURE__ */ new Map());
|
|
9008
9422
|
const pipeline = { columns: baseColumns, rows: createTableRows(dataSource, getRowKey) };
|
|
9009
9423
|
const nextApis = {};
|
|
9010
9424
|
const contexts = /* @__PURE__ */ new Map();
|
|
@@ -9061,7 +9475,7 @@ function TableInner(props, ref) {
|
|
|
9061
9475
|
});
|
|
9062
9476
|
pluginApisRef.current = nextApis;
|
|
9063
9477
|
contextsRef.current = contexts;
|
|
9064
|
-
|
|
9478
|
+
useEffect16(() => {
|
|
9065
9479
|
const activePlugins2 = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
9066
9480
|
for (const [pluginId, mounted] of mountedPluginsRef.current) {
|
|
9067
9481
|
if (activePlugins2.get(pluginId) === mounted.plugin) continue;
|
|
@@ -9073,7 +9487,7 @@ function TableInner(props, ref) {
|
|
|
9073
9487
|
mountedPluginsRef.current.set(plugin.id, { plugin, cleanup: plugin.onMount(contextsRef.current.get(plugin.id)) });
|
|
9074
9488
|
}
|
|
9075
9489
|
}, [sortedPlugins]);
|
|
9076
|
-
|
|
9490
|
+
useEffect16(() => () => {
|
|
9077
9491
|
for (const mounted of mountedPluginsRef.current.values()) mounted.cleanup?.();
|
|
9078
9492
|
mountedPluginsRef.current.clear();
|
|
9079
9493
|
}, []);
|
|
@@ -9117,7 +9531,7 @@ function TableInner(props, ref) {
|
|
|
9117
9531
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-size", `${verticalThumb}px`);
|
|
9118
9532
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-position", `${verticalPosition}px`);
|
|
9119
9533
|
}, []);
|
|
9120
|
-
|
|
9534
|
+
useEffect16(() => {
|
|
9121
9535
|
const element = scrollRef.current;
|
|
9122
9536
|
if (!element || typeof ResizeObserver === "undefined") return;
|
|
9123
9537
|
const observer = new ResizeObserver(() => {
|
|
@@ -9130,19 +9544,19 @@ function TableInner(props, ref) {
|
|
|
9130
9544
|
updateScrollMetrics();
|
|
9131
9545
|
return () => observer.disconnect();
|
|
9132
9546
|
}, [updateScrollMetrics]);
|
|
9133
|
-
|
|
9547
|
+
useEffect16(() => {
|
|
9134
9548
|
updateScrollMetrics();
|
|
9135
9549
|
});
|
|
9136
|
-
const orderedColumns =
|
|
9137
|
-
const leafColumns =
|
|
9138
|
-
const headerRows =
|
|
9139
|
-
const measuredCells =
|
|
9550
|
+
const orderedColumns = useMemo10(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
|
|
9551
|
+
const leafColumns = useMemo10(() => flattenTableColumns(orderedColumns), [orderedColumns]);
|
|
9552
|
+
const headerRows = useMemo10(() => buildHeaderRows(orderedColumns), [orderedColumns]);
|
|
9553
|
+
const measuredCells = useRef23(/* @__PURE__ */ new WeakSet());
|
|
9140
9554
|
const autoWidthSignature = leafColumns.map((column) => `${column.key}:${column.autoWidth}:${resizedWidths[column.key] ?? ""}`).join("|");
|
|
9141
|
-
|
|
9555
|
+
useEffect16(() => {
|
|
9142
9556
|
measuredCells.current = /* @__PURE__ */ new WeakSet();
|
|
9143
9557
|
setAutoColumnWidths({});
|
|
9144
9558
|
}, [dataSource, baseColumns, size, autoWidthSignature]);
|
|
9145
|
-
|
|
9559
|
+
useEffect16(() => {
|
|
9146
9560
|
const autoWidthColumns = leafColumns.filter((column) => column.autoWidth && resizedWidths[column.key] === void 0);
|
|
9147
9561
|
const root = rootRef.current;
|
|
9148
9562
|
if (!root || autoWidthColumns.length === 0) return;
|
|
@@ -9227,7 +9641,7 @@ function TableInner(props, ref) {
|
|
|
9227
9641
|
}
|
|
9228
9642
|
const topSpacer = shouldVirtualize ? startIndex * rowHeight : 0;
|
|
9229
9643
|
const bottomSpacer = shouldVirtualize ? Math.max(0, (pipeline.rows.length - endIndex) * rowHeight) : 0;
|
|
9230
|
-
const rowElements =
|
|
9644
|
+
const rowElements = useMemo10(() => /* @__PURE__ */ new Map(), [
|
|
9231
9645
|
dataSource,
|
|
9232
9646
|
baseColumns,
|
|
9233
9647
|
sortedPlugins,
|
|
@@ -9247,20 +9661,20 @@ function TableInner(props, ref) {
|
|
|
9247
9661
|
]);
|
|
9248
9662
|
const toolbarStart = sortedPlugins.map((plugin) => {
|
|
9249
9663
|
const content = plugin.renderToolbarStart?.(getContext(plugin));
|
|
9250
|
-
return content ? /* @__PURE__ */
|
|
9664
|
+
return content ? /* @__PURE__ */ jsx28(Fragment9, { children: content }, `toolbar-start-${plugin.id}`) : null;
|
|
9251
9665
|
}).filter(Boolean);
|
|
9252
9666
|
const toolbarEnd = sortedPlugins.map((plugin) => {
|
|
9253
9667
|
const content = plugin.renderToolbarEnd?.(getContext(plugin));
|
|
9254
|
-
return content ? /* @__PURE__ */
|
|
9668
|
+
return content ? /* @__PURE__ */ jsx28(Fragment9, { children: content }, `toolbar-end-${plugin.id}`) : null;
|
|
9255
9669
|
}).filter(Boolean);
|
|
9256
9670
|
const summaries = sortedPlugins.flatMap((plugin) => plugin.renderSummary?.(getContext(plugin)) ?? []);
|
|
9257
9671
|
const footers = sortedPlugins.map((plugin) => {
|
|
9258
9672
|
const content = plugin.renderFooter?.(getContext(plugin));
|
|
9259
|
-
return content ? /* @__PURE__ */
|
|
9673
|
+
return content ? /* @__PURE__ */ jsx28(Fragment9, { children: content }, `footer-${plugin.id}`) : null;
|
|
9260
9674
|
}).filter(Boolean);
|
|
9261
9675
|
const overlays = sortedPlugins.map((plugin) => {
|
|
9262
9676
|
const content = plugin.renderOverlay?.(getContext(plugin));
|
|
9263
|
-
return content ? /* @__PURE__ */
|
|
9677
|
+
return content ? /* @__PURE__ */ jsx28(Fragment9, { children: content }, `overlay-${plugin.id}`) : null;
|
|
9264
9678
|
}).filter(Boolean);
|
|
9265
9679
|
const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
|
|
9266
9680
|
const effectiveHeight = height ?? tableHeight ?? remainingHeight ?? (shouldVirtualize && maxBodyHeight == null ? 420 : void 0);
|
|
@@ -9437,10 +9851,10 @@ function TableInner(props, ref) {
|
|
|
9437
9851
|
}
|
|
9438
9852
|
function renderHeaderContent(column, content) {
|
|
9439
9853
|
const title = getHeaderTitleText(column.title ?? column.name) || column.name || column.key;
|
|
9440
|
-
return /* @__PURE__ */
|
|
9441
|
-
column.required && /* @__PURE__ */
|
|
9442
|
-
/* @__PURE__ */
|
|
9443
|
-
column.description != null && /* @__PURE__ */
|
|
9854
|
+
return /* @__PURE__ */ jsxs25("span", { className: `sia-table__header-label${column.required ? " sia-table__header-label--required" : ""}`, children: [
|
|
9855
|
+
column.required && /* @__PURE__ */ jsx28("span", { className: "sia-table__required-mark", "aria-hidden": "true", children: "*" }),
|
|
9856
|
+
/* @__PURE__ */ jsx28("span", { className: "sia-table__header-label-content", "data-sia-title-overflow-only": true, ...withTitleTooltip({ title }), children: content }),
|
|
9857
|
+
column.description != null && /* @__PURE__ */ jsx28(Tooltip, { title: column.description, placement: "top", trigger: ["hover", "focus"], children: /* @__PURE__ */ jsx28("button", { type: "button", className: "sia-table__header-description", "aria-label": `${column.name ?? column.key}\u5217\u8BF4\u660E`, onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx28(Icon, { name: "info", size: 14 }) }) })
|
|
9444
9858
|
] });
|
|
9445
9859
|
}
|
|
9446
9860
|
function getPluginCellProps(row, column) {
|
|
@@ -9480,17 +9894,17 @@ function TableInner(props, ref) {
|
|
|
9480
9894
|
}
|
|
9481
9895
|
function renderSummaryRow(summary) {
|
|
9482
9896
|
let labelRendered = false;
|
|
9483
|
-
return /* @__PURE__ */
|
|
9897
|
+
return /* @__PURE__ */ jsx28("tr", { className: `sia-table__summary-row ${summary.className ?? ""}`.trim(), children: leafColumns.map((column) => {
|
|
9484
9898
|
const value = summary.values[column.key];
|
|
9485
9899
|
const isLabel = value === void 0 && !labelRendered && summary.label !== void 0;
|
|
9486
9900
|
const content = value !== void 0 ? value : isLabel ? (labelRendered = true, summary.label) : null;
|
|
9487
9901
|
const fixed = normalizeFixed(column.fixed);
|
|
9488
9902
|
const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
9489
9903
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
9490
|
-
return /* @__PURE__ */
|
|
9904
|
+
return /* @__PURE__ */ jsx28("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__ */ jsx28("span", { className: "sia-table__summary-label", children: content }) : content }, column.key);
|
|
9491
9905
|
}) }, summary.key);
|
|
9492
9906
|
}
|
|
9493
|
-
return /* @__PURE__ */
|
|
9907
|
+
return /* @__PURE__ */ jsxs25(
|
|
9494
9908
|
"div",
|
|
9495
9909
|
{
|
|
9496
9910
|
ref: rootRef,
|
|
@@ -9541,19 +9955,19 @@ function TableInner(props, ref) {
|
|
|
9541
9955
|
htmlProps.onDoubleClickCapture?.(event);
|
|
9542
9956
|
},
|
|
9543
9957
|
children: [
|
|
9544
|
-
hasToolbar ? /* @__PURE__ */
|
|
9545
|
-
/* @__PURE__ */
|
|
9546
|
-
/* @__PURE__ */
|
|
9958
|
+
hasToolbar ? /* @__PURE__ */ jsxs25("div", { className: "sia-table__toolbar", children: [
|
|
9959
|
+
/* @__PURE__ */ jsx28("div", { children: toolbarStart }),
|
|
9960
|
+
/* @__PURE__ */ jsx28("div", { children: toolbarEnd })
|
|
9547
9961
|
] }) : null,
|
|
9548
|
-
/* @__PURE__ */
|
|
9549
|
-
/* @__PURE__ */
|
|
9550
|
-
/* @__PURE__ */
|
|
9551
|
-
/* @__PURE__ */
|
|
9962
|
+
/* @__PURE__ */ jsxs25("div", { className: "sia-table__viewport-wrap", style: viewportStyle, children: [
|
|
9963
|
+
/* @__PURE__ */ jsx28("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: [
|
|
9964
|
+
/* @__PURE__ */ jsx28("colgroup", { children: leafColumns.map((column) => /* @__PURE__ */ jsx28("col", { "data-column-key": column.key, style: { width: columnWidths.get(column.key) ?? DEFAULT_WIDTH } }, column.key)) }),
|
|
9965
|
+
/* @__PURE__ */ jsx28("thead", { className: stickyHeader ? "sia-table__head sia-table__head--sticky" : "sia-table__head", children: headerRows.map((headerRow, depth) => /* @__PURE__ */ jsx28("tr", { children: headerRow.map((cell) => {
|
|
9552
9966
|
const fixed = cell.fixed;
|
|
9553
9967
|
const pluginHeaderProps = getPluginHeaderCellProps(cell.column);
|
|
9554
9968
|
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" : "";
|
|
9555
9969
|
const autoWidthClass = cell.column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
9556
|
-
return /* @__PURE__ */
|
|
9970
|
+
return /* @__PURE__ */ jsx28(
|
|
9557
9971
|
"th",
|
|
9558
9972
|
{
|
|
9559
9973
|
"data-column-key": cell.column.key,
|
|
@@ -9574,10 +9988,10 @@ function TableInner(props, ref) {
|
|
|
9574
9988
|
`${cell.column.key}-${depth}-${cell.firstLeafKey}`
|
|
9575
9989
|
);
|
|
9576
9990
|
}) }, depth)) }),
|
|
9577
|
-
/* @__PURE__ */
|
|
9578
|
-
maxBodyHeight != null && pipeline.rows.length === 0 ? /* @__PURE__ */
|
|
9579
|
-
pipeline.rows.length === 0 && summaries.length > 0 ? /* @__PURE__ */
|
|
9580
|
-
topSpacer > 0 ? /* @__PURE__ */
|
|
9991
|
+
/* @__PURE__ */ jsxs25("tbody", { children: [
|
|
9992
|
+
maxBodyHeight != null && pipeline.rows.length === 0 ? /* @__PURE__ */ jsx28("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx28("td", { colSpan: leafColumns.length, style: { height: 120, padding: 0, border: 0 } }) }) : null,
|
|
9993
|
+
pipeline.rows.length === 0 && summaries.length > 0 ? /* @__PURE__ */ jsx28("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx28("td", { colSpan: leafColumns.length, style: { height: Math.max(0, viewportHeight - (headerRows.length + summaries.length) * rowHeight), padding: 0, border: 0 } }) }) : null,
|
|
9994
|
+
topSpacer > 0 ? /* @__PURE__ */ jsx28("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx28("td", { colSpan: leafColumns.length, style: { height: topSpacer, padding: 0, border: 0 } }) }) : null,
|
|
9581
9995
|
renderedRows.map((row, offset) => {
|
|
9582
9996
|
const cached = rowElements.get(row.key);
|
|
9583
9997
|
if (cached) return cached;
|
|
@@ -9586,7 +10000,7 @@ function TableInner(props, ref) {
|
|
|
9586
10000
|
const status = typeof rowStatus === "function" ? rowStatus(row.record, row.sourceIndex) : rowStatus;
|
|
9587
10001
|
const statusClass = status ? `sia-table__row--${status}` : "";
|
|
9588
10002
|
const customClass = typeof rowClassName === "function" ? rowClassName(row.record, row.sourceIndex) : rowClassName ?? "";
|
|
9589
|
-
const element = /* @__PURE__ */
|
|
10003
|
+
const element = /* @__PURE__ */ jsx28(
|
|
9590
10004
|
TableBodyRow,
|
|
9591
10005
|
{
|
|
9592
10006
|
canvas,
|
|
@@ -9637,13 +10051,13 @@ function TableInner(props, ref) {
|
|
|
9637
10051
|
rowElements.set(row.key, element);
|
|
9638
10052
|
return element;
|
|
9639
10053
|
}),
|
|
9640
|
-
bottomSpacer > 0 ? /* @__PURE__ */
|
|
10054
|
+
bottomSpacer > 0 ? /* @__PURE__ */ jsx28("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx28("td", { colSpan: leafColumns.length, style: { height: bottomSpacer, padding: 0, border: 0 } }) }) : null
|
|
9641
10055
|
] }),
|
|
9642
|
-
summaries.length > 0 ? /* @__PURE__ */
|
|
10056
|
+
summaries.length > 0 ? /* @__PURE__ */ jsx28("tfoot", { className: "sia-table__summary", children: summaries.map(renderSummaryRow) }) : null
|
|
9643
10057
|
] }) }),
|
|
9644
|
-
pipeline.rows.length === 0 ? /* @__PURE__ */
|
|
9645
|
-
canvas ? /* @__PURE__ */
|
|
9646
|
-
/* @__PURE__ */
|
|
10058
|
+
pipeline.rows.length === 0 ? /* @__PURE__ */ jsx28("div", { className: "sia-table__empty", role: "status", children: emptyText }) : null,
|
|
10059
|
+
canvas ? /* @__PURE__ */ jsx28(TableCanvasLayer, { viewport: scrollRef, rows: pipeline.rows, columns: leafColumns, widths: columnWidths, rowHeight, headerHeight: headerRows.length * rowHeight }) : null,
|
|
10060
|
+
/* @__PURE__ */ jsx28(
|
|
9647
10061
|
"div",
|
|
9648
10062
|
{
|
|
9649
10063
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--horizontal",
|
|
@@ -9654,10 +10068,10 @@ function TableInner(props, ref) {
|
|
|
9654
10068
|
onPointerMove: handleScrollbarPointerMove,
|
|
9655
10069
|
onPointerUp: handleScrollbarPointerEnd,
|
|
9656
10070
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
9657
|
-
children: /* @__PURE__ */
|
|
10071
|
+
children: /* @__PURE__ */ jsx28("div", { className: "sia-table__scrollbar-thumb" })
|
|
9658
10072
|
}
|
|
9659
10073
|
),
|
|
9660
|
-
/* @__PURE__ */
|
|
10074
|
+
/* @__PURE__ */ jsx28(
|
|
9661
10075
|
"div",
|
|
9662
10076
|
{
|
|
9663
10077
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--vertical",
|
|
@@ -9668,14 +10082,14 @@ function TableInner(props, ref) {
|
|
|
9668
10082
|
onPointerMove: handleScrollbarPointerMove,
|
|
9669
10083
|
onPointerUp: handleScrollbarPointerEnd,
|
|
9670
10084
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
9671
|
-
children: /* @__PURE__ */
|
|
10085
|
+
children: /* @__PURE__ */ jsx28("div", { className: "sia-table__scrollbar-thumb" })
|
|
9672
10086
|
}
|
|
9673
10087
|
)
|
|
9674
10088
|
] }),
|
|
9675
|
-
footers.length > 0 ? /* @__PURE__ */
|
|
9676
|
-
loading || internalLoading ? /* @__PURE__ */
|
|
9677
|
-
/* @__PURE__ */
|
|
9678
|
-
/* @__PURE__ */
|
|
10089
|
+
footers.length > 0 ? /* @__PURE__ */ jsx28("div", { className: "sia-table__footer", children: footers }) : null,
|
|
10090
|
+
loading || internalLoading ? /* @__PURE__ */ jsxs25("div", { className: "sia-table__loading", role: "status", children: [
|
|
10091
|
+
/* @__PURE__ */ jsx28(Icon, { name: "loader", size: 22, spin: true }),
|
|
10092
|
+
/* @__PURE__ */ jsx28("span", { children: "\u52A0\u8F7D\u4E2D" })
|
|
9679
10093
|
] }) : null,
|
|
9680
10094
|
overlays
|
|
9681
10095
|
]
|
|
@@ -9748,7 +10162,7 @@ function incrementWorksheetValue(value, offset) {
|
|
|
9748
10162
|
}
|
|
9749
10163
|
|
|
9750
10164
|
// src/components/Table/worksheet.tsx
|
|
9751
|
-
import { Fragment as Fragment10, jsx as
|
|
10165
|
+
import { Fragment as Fragment10, jsx as jsx29, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
9752
10166
|
var isEmpty2 = (value) => value == null || value === "";
|
|
9753
10167
|
var editorKind = (column) => !column.editable ? "readonly" : typeof column.editable === "object" ? column.editable.type ?? "input" : "input";
|
|
9754
10168
|
var nativeEditor = (target) => target instanceof Element && Boolean(
|
|
@@ -10156,9 +10570,9 @@ function createWorksheetPlugin(options) {
|
|
|
10156
10570
|
const area = bounds(), cols = columns();
|
|
10157
10571
|
const handle = area && context.rows[area.bottom]?.key === info.row.key && cols[area.right]?.key === column.key && // 填充入口与编辑权限一致,避免只读格或保存锁定后仍暗示可以拖拽修改。
|
|
10158
10572
|
editable(record, column) && (suppressEditing || !context.state.editing);
|
|
10159
|
-
return /* @__PURE__ */
|
|
10573
|
+
return /* @__PURE__ */ jsxs26(Fragment10, { children: [
|
|
10160
10574
|
render ? render(value, record, index, info) : value,
|
|
10161
|
-
handle && /* @__PURE__ */
|
|
10575
|
+
handle && /* @__PURE__ */ jsx29(
|
|
10162
10576
|
"button",
|
|
10163
10577
|
{
|
|
10164
10578
|
type: "button",
|
|
@@ -10204,25 +10618,25 @@ function createWorksheetPlugin(options) {
|
|
|
10204
10618
|
},
|
|
10205
10619
|
renderToolbarStart(current) {
|
|
10206
10620
|
remember(current);
|
|
10207
|
-
return options.toolbar === false ? null : /* @__PURE__ */
|
|
10208
|
-
/* @__PURE__ */
|
|
10621
|
+
return options.toolbar === false ? null : /* @__PURE__ */ jsxs26("span", { className: "sia-table__worksheet-tools", children: [
|
|
10622
|
+
/* @__PURE__ */ jsx29(
|
|
10209
10623
|
Button,
|
|
10210
10624
|
{
|
|
10211
10625
|
variant: "text",
|
|
10212
10626
|
size: "small",
|
|
10213
|
-
icon: /* @__PURE__ */
|
|
10627
|
+
icon: /* @__PURE__ */ jsx29(Icon, { name: "undo" }),
|
|
10214
10628
|
disabled: !undoStack.length,
|
|
10215
10629
|
title: "\u64A4\u9500\uFF08Ctrl/Cmd + Z\uFF09",
|
|
10216
10630
|
onClick: api.undo,
|
|
10217
10631
|
children: "\u64A4\u9500"
|
|
10218
10632
|
}
|
|
10219
10633
|
),
|
|
10220
|
-
/* @__PURE__ */
|
|
10634
|
+
/* @__PURE__ */ jsx29(
|
|
10221
10635
|
Button,
|
|
10222
10636
|
{
|
|
10223
10637
|
variant: "text",
|
|
10224
10638
|
size: "small",
|
|
10225
|
-
icon: /* @__PURE__ */
|
|
10639
|
+
icon: /* @__PURE__ */ jsx29(Icon, { name: "redo" }),
|
|
10226
10640
|
disabled: !redoStack.length,
|
|
10227
10641
|
title: "\u6062\u590D\uFF08Ctrl/Cmd + Shift + Z \u6216 Ctrl/Cmd + Y\uFF09",
|
|
10228
10642
|
onClick: api.redo,
|
|
@@ -10233,7 +10647,7 @@ function createWorksheetPlugin(options) {
|
|
|
10233
10647
|
},
|
|
10234
10648
|
renderOverlay(current) {
|
|
10235
10649
|
remember(current);
|
|
10236
|
-
return /* @__PURE__ */
|
|
10650
|
+
return /* @__PURE__ */ jsx29(
|
|
10237
10651
|
"span",
|
|
10238
10652
|
{
|
|
10239
10653
|
hidden: true,
|
|
@@ -10321,14 +10735,14 @@ function createWorksheetPlugin(options) {
|
|
|
10321
10735
|
|
|
10322
10736
|
// src/components/Video.tsx
|
|
10323
10737
|
import { forwardRef as forwardRef7 } from "react";
|
|
10324
|
-
import { jsx as
|
|
10738
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
10325
10739
|
var Video = forwardRef7(function Video2({ controls = true, muted = false, playsInline = true, className = "", ...props }, ref) {
|
|
10326
|
-
return /* @__PURE__ */
|
|
10740
|
+
return /* @__PURE__ */ jsx30("video", { ...props, ref, controls, muted, playsInline, className: `sia-video ${className}`.trim() });
|
|
10327
10741
|
});
|
|
10328
10742
|
|
|
10329
10743
|
// src/components/InputSelect.tsx
|
|
10330
|
-
import { forwardRef as forwardRef8, useEffect as
|
|
10331
|
-
import { jsx as
|
|
10744
|
+
import { forwardRef as forwardRef8, useEffect as useEffect17, useRef as useRef24, useState as useState25 } from "react";
|
|
10745
|
+
import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
10332
10746
|
var InputSelect = forwardRef8(function InputSelect2({
|
|
10333
10747
|
options,
|
|
10334
10748
|
value,
|
|
@@ -10355,22 +10769,22 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10355
10769
|
...inputProps
|
|
10356
10770
|
}, forwardedRef) {
|
|
10357
10771
|
const size = useControlSize(sizeProp);
|
|
10358
|
-
const [internal, setInternal] =
|
|
10772
|
+
const [internal, setInternal] = useState25(defaultValue);
|
|
10359
10773
|
const current = value !== void 0 ? value : internal;
|
|
10360
10774
|
const values = normalizeSelectionValues(current == null ? [] : Array.isArray(current) ? current : [current], options);
|
|
10361
10775
|
const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
|
|
10362
|
-
const [draft, setDraft] =
|
|
10363
|
-
|
|
10776
|
+
const [draft, setDraft] = useState25(text);
|
|
10777
|
+
useEffect17(() => {
|
|
10364
10778
|
setDraft(text);
|
|
10365
10779
|
}, [text, current]);
|
|
10366
|
-
const [open, setOpen] =
|
|
10367
|
-
const [search, setSearch] =
|
|
10368
|
-
const [modalOpen, setModalOpen] =
|
|
10369
|
-
const [modalValues, setModalValues] =
|
|
10370
|
-
const [selectedOnly, setSelectedOnly] =
|
|
10371
|
-
const rootRef =
|
|
10372
|
-
const popupRef =
|
|
10373
|
-
const inputRef =
|
|
10780
|
+
const [open, setOpen] = useState25(false);
|
|
10781
|
+
const [search, setSearch] = useState25("");
|
|
10782
|
+
const [modalOpen, setModalOpen] = useState25(false);
|
|
10783
|
+
const [modalValues, setModalValues] = useState25([]);
|
|
10784
|
+
const [selectedOnly, setSelectedOnly] = useState25(false);
|
|
10785
|
+
const rootRef = useRef24(null);
|
|
10786
|
+
const popupRef = useRef24(null);
|
|
10787
|
+
const inputRef = useRef24(null);
|
|
10374
10788
|
const config = typeof enableModal === "object" ? enableModal : {};
|
|
10375
10789
|
function changeOpen(next) {
|
|
10376
10790
|
if (next && (disabled || loading)) return;
|
|
@@ -10390,7 +10804,7 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10390
10804
|
inputRef.current?.focus();
|
|
10391
10805
|
}
|
|
10392
10806
|
}
|
|
10393
|
-
|
|
10807
|
+
useEffect17(() => {
|
|
10394
10808
|
if (!open) return;
|
|
10395
10809
|
const outside = (event) => {
|
|
10396
10810
|
if (!rootRef.current?.contains(event.target) && !popupRef.current?.contains(event.target)) changeOpen(false);
|
|
@@ -10398,7 +10812,7 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10398
10812
|
document.addEventListener("pointerdown", outside);
|
|
10399
10813
|
return () => document.removeEventListener("pointerdown", outside);
|
|
10400
10814
|
}, [open, onOpenChange]);
|
|
10401
|
-
|
|
10815
|
+
useEffect17(() => {
|
|
10402
10816
|
if (disabled || loading) {
|
|
10403
10817
|
changeOpen(false);
|
|
10404
10818
|
setModalOpen(false);
|
|
@@ -10411,14 +10825,14 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10411
10825
|
setSelectedOnly(false);
|
|
10412
10826
|
setModalOpen(true);
|
|
10413
10827
|
}
|
|
10414
|
-
return /* @__PURE__ */
|
|
10828
|
+
return /* @__PURE__ */ jsxs27("div", { ref: rootRef, style, className: `sia-input-select${open || modalOpen ? " is-open" : ""} ${className}`, onKeyDown: (event) => {
|
|
10415
10829
|
if (event.key === "Escape" && open) {
|
|
10416
10830
|
event.stopPropagation();
|
|
10417
10831
|
changeOpen(false);
|
|
10418
10832
|
inputRef.current?.focus();
|
|
10419
10833
|
}
|
|
10420
10834
|
}, children: [
|
|
10421
|
-
/* @__PURE__ */
|
|
10835
|
+
/* @__PURE__ */ jsx31(
|
|
10422
10836
|
Input,
|
|
10423
10837
|
{
|
|
10424
10838
|
...inputProps,
|
|
@@ -10455,26 +10869,26 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10455
10869
|
emit(parseInput ? parseInput(next) : multiple ? next.split(",").map((item) => item.trim()).filter(Boolean) : next);
|
|
10456
10870
|
changeOpen(true);
|
|
10457
10871
|
},
|
|
10458
|
-
suffix: /* @__PURE__ */
|
|
10459
|
-
allowClear && draft && !disabled && /* @__PURE__ */
|
|
10872
|
+
suffix: /* @__PURE__ */ jsxs27("span", { className: "sia-input-select__suffix", children: [
|
|
10873
|
+
allowClear && draft && !disabled && /* @__PURE__ */ jsx31(Button, { className: "sia-input-select__clear", variant: "text", size: "small", disabled: loading, "aria-label": "\u6E05\u9664\u8F93\u5165\u9009\u62E9", onClick: (event) => {
|
|
10460
10874
|
event.stopPropagation();
|
|
10461
10875
|
setDraft("");
|
|
10462
10876
|
emit(multiple ? [] : void 0);
|
|
10463
10877
|
inputRef.current?.focus();
|
|
10464
10878
|
}, children: "\xD7" }),
|
|
10465
10879
|
suffix,
|
|
10466
|
-
enableModal && /* @__PURE__ */
|
|
10880
|
+
enableModal && /* @__PURE__ */ jsx31(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
|
|
10467
10881
|
event.stopPropagation();
|
|
10468
10882
|
openModal();
|
|
10469
10883
|
}, children: "\u2026" }),
|
|
10470
|
-
/* @__PURE__ */
|
|
10884
|
+
/* @__PURE__ */ jsx31(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
|
|
10471
10885
|
event.stopPropagation();
|
|
10472
10886
|
changeOpen(!open);
|
|
10473
|
-
}, children: /* @__PURE__ */
|
|
10887
|
+
}, children: /* @__PURE__ */ jsx31(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
|
|
10474
10888
|
] })
|
|
10475
10889
|
}
|
|
10476
10890
|
),
|
|
10477
|
-
/* @__PURE__ */
|
|
10891
|
+
/* @__PURE__ */ jsx31(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx31(
|
|
10478
10892
|
SelectionPanel,
|
|
10479
10893
|
{
|
|
10480
10894
|
options,
|
|
@@ -10489,7 +10903,7 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10489
10903
|
onSearch: setSearch
|
|
10490
10904
|
}
|
|
10491
10905
|
) }),
|
|
10492
|
-
enableModal && /* @__PURE__ */
|
|
10906
|
+
enableModal && /* @__PURE__ */ jsxs27(
|
|
10493
10907
|
Modal,
|
|
10494
10908
|
{
|
|
10495
10909
|
open: modalOpen,
|
|
@@ -10502,15 +10916,15 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10502
10916
|
setModalOpen(false);
|
|
10503
10917
|
},
|
|
10504
10918
|
children: [
|
|
10505
|
-
/* @__PURE__ */
|
|
10506
|
-
/* @__PURE__ */
|
|
10507
|
-
/* @__PURE__ */
|
|
10919
|
+
/* @__PURE__ */ jsxs27("div", { className: "sia-selection-panel__actions", role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
10920
|
+
/* @__PURE__ */ jsx31(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
10921
|
+
/* @__PURE__ */ jsxs27(Button, { role: "tab", "aria-selected": selectedOnly, variant: selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(true), children: [
|
|
10508
10922
|
"\u5DF2\u9009\u9879(",
|
|
10509
10923
|
modalValues.length,
|
|
10510
10924
|
")"
|
|
10511
10925
|
] })
|
|
10512
10926
|
] }),
|
|
10513
|
-
modalOpen && /* @__PURE__ */
|
|
10927
|
+
modalOpen && /* @__PURE__ */ jsx31(
|
|
10514
10928
|
SelectionPanel,
|
|
10515
10929
|
{
|
|
10516
10930
|
options,
|
|
@@ -10531,10 +10945,10 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10531
10945
|
});
|
|
10532
10946
|
|
|
10533
10947
|
// src/components/QueryForm.tsx
|
|
10534
|
-
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect9, useRef as
|
|
10948
|
+
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect9, useRef as useRef28, useState as useState28 } from "react";
|
|
10535
10949
|
|
|
10536
10950
|
// src/components/useQueryFormMotion.ts
|
|
10537
|
-
import { useLayoutEffect as useLayoutEffect8, useRef as
|
|
10951
|
+
import { useLayoutEffect as useLayoutEffect8, useRef as useRef25 } from "react";
|
|
10538
10952
|
function readLayout(row) {
|
|
10539
10953
|
const root = row.getBoundingClientRect();
|
|
10540
10954
|
const scaleX = root.width / row.offsetWidth || 1, scaleY = root.height / row.offsetHeight || 1;
|
|
@@ -10547,9 +10961,9 @@ function readLayout(row) {
|
|
|
10547
10961
|
return { height: row.offsetHeight, boxes };
|
|
10548
10962
|
}
|
|
10549
10963
|
function useQueryFormMotion(ref, layoutKey) {
|
|
10550
|
-
const previous =
|
|
10551
|
-
const stop =
|
|
10552
|
-
const snapshot =
|
|
10964
|
+
const previous = useRef25();
|
|
10965
|
+
const stop = useRef25();
|
|
10966
|
+
const snapshot = useRef25();
|
|
10553
10967
|
useLayoutEffect8(() => {
|
|
10554
10968
|
const row = ref.current;
|
|
10555
10969
|
if (!row) return;
|
|
@@ -10658,10 +11072,10 @@ function useQueryFormMotion(ref, layoutKey) {
|
|
|
10658
11072
|
}
|
|
10659
11073
|
|
|
10660
11074
|
// src/components/QueryFormSettings.tsx
|
|
10661
|
-
import { useEffect as
|
|
11075
|
+
import { useEffect as useEffect19, useRef as useRef27, useState as useState27 } from "react";
|
|
10662
11076
|
|
|
10663
11077
|
// src/components/useQueryFieldSort.ts
|
|
10664
|
-
import { useEffect as
|
|
11078
|
+
import { useEffect as useEffect18, useRef as useRef26, useState as useState26 } from "react";
|
|
10665
11079
|
function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
10666
11080
|
const center = rects[from].top + rects[from].height / 2 + dy;
|
|
10667
11081
|
const rest = keys.map((_, index) => index).filter((index) => index !== from);
|
|
@@ -10680,13 +11094,13 @@ function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
|
10680
11094
|
return { ordered, offsets };
|
|
10681
11095
|
}
|
|
10682
11096
|
function useQueryFieldSort(keys, enabled, onCommit) {
|
|
10683
|
-
const listRef =
|
|
10684
|
-
const cancelRef =
|
|
10685
|
-
const commitRef =
|
|
11097
|
+
const listRef = useRef26(null);
|
|
11098
|
+
const cancelRef = useRef26();
|
|
11099
|
+
const commitRef = useRef26(onCommit);
|
|
10686
11100
|
commitRef.current = onCommit;
|
|
10687
|
-
const [preview, setPreview] =
|
|
11101
|
+
const [preview, setPreview] = useState26();
|
|
10688
11102
|
const signature = JSON.stringify(keys);
|
|
10689
|
-
|
|
11103
|
+
useEffect18(() => {
|
|
10690
11104
|
cancelRef.current?.();
|
|
10691
11105
|
return () => cancelRef.current?.();
|
|
10692
11106
|
}, [enabled, signature]);
|
|
@@ -10809,18 +11223,18 @@ function countQueryFieldRows(centers) {
|
|
|
10809
11223
|
}
|
|
10810
11224
|
|
|
10811
11225
|
// src/components/QueryFormSettings.tsx
|
|
10812
|
-
import { Fragment as Fragment11, jsx as
|
|
11226
|
+
import { Fragment as Fragment11, jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
10813
11227
|
function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed, disabled) {
|
|
10814
|
-
const [snapshot, setSnapshot] =
|
|
10815
|
-
const [draft, setDraft] =
|
|
10816
|
-
const [open, setOpen] =
|
|
10817
|
-
const [loading, setLoading] =
|
|
10818
|
-
const [saving, setSaving] =
|
|
10819
|
-
const [error, setError] =
|
|
10820
|
-
const [loadFailed, setLoadFailed] =
|
|
10821
|
-
const token =
|
|
10822
|
-
const saveLock =
|
|
10823
|
-
const latest =
|
|
11228
|
+
const [snapshot, setSnapshot] = useState27();
|
|
11229
|
+
const [draft, setDraft] = useState27({ fields: [], defaultCollapsed: defaultCollapsed ?? false });
|
|
11230
|
+
const [open, setOpen] = useState27(false);
|
|
11231
|
+
const [loading, setLoading] = useState27(false);
|
|
11232
|
+
const [saving, setSaving] = useState27(false);
|
|
11233
|
+
const [error, setError] = useState27("");
|
|
11234
|
+
const [loadFailed, setLoadFailed] = useState27(false);
|
|
11235
|
+
const token = useRef27(0);
|
|
11236
|
+
const saveLock = useRef27(false);
|
|
11237
|
+
const latest = useRef27({ config, fields, defaultCollapsed, applyCollapsed });
|
|
10824
11238
|
latest.current = { config, fields, defaultCollapsed, applyCollapsed };
|
|
10825
11239
|
const moduleName = config?.scope.moduleName;
|
|
10826
11240
|
const businessKey = config?.scope.businessKey;
|
|
@@ -10848,7 +11262,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10848
11262
|
if (request === token.current) setLoading(false);
|
|
10849
11263
|
}
|
|
10850
11264
|
}
|
|
10851
|
-
|
|
11265
|
+
useEffect19(() => {
|
|
10852
11266
|
setSnapshot(void 0);
|
|
10853
11267
|
setOpen(false);
|
|
10854
11268
|
setError("");
|
|
@@ -10904,7 +11318,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10904
11318
|
const items = new Map(visibleDraft.map((item) => [item.key, item]));
|
|
10905
11319
|
setDraft((current) => ({ ...current, fields: keys.map((key, order) => ({ ...items.get(key), order })) }));
|
|
10906
11320
|
});
|
|
10907
|
-
const control = config ? /* @__PURE__ */
|
|
11321
|
+
const control = config ? /* @__PURE__ */ jsx32(
|
|
10908
11322
|
Button,
|
|
10909
11323
|
{
|
|
10910
11324
|
type: "button",
|
|
@@ -10913,16 +11327,16 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10913
11327
|
"aria-label": "\u67E5\u8BE2\u8BBE\u7F6E",
|
|
10914
11328
|
disabled: disabled || saving,
|
|
10915
11329
|
loading: loading && !open,
|
|
10916
|
-
icon: /* @__PURE__ */
|
|
11330
|
+
icon: /* @__PURE__ */ jsx32(Icon, { name: "more-vertical" }),
|
|
10917
11331
|
onClick: () => {
|
|
10918
11332
|
setOpen(true);
|
|
10919
11333
|
void load(true);
|
|
10920
11334
|
}
|
|
10921
11335
|
}
|
|
10922
11336
|
) : null;
|
|
10923
|
-
const panel = config ? /* @__PURE__ */
|
|
10924
|
-
!open && error ? /* @__PURE__ */
|
|
10925
|
-
/* @__PURE__ */
|
|
11337
|
+
const panel = config ? /* @__PURE__ */ jsxs28(Fragment11, { children: [
|
|
11338
|
+
!open && error ? /* @__PURE__ */ jsx32("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,
|
|
11339
|
+
/* @__PURE__ */ jsx32(
|
|
10926
11340
|
Modal,
|
|
10927
11341
|
{
|
|
10928
11342
|
title: "\u67E5\u8BE2\u8BBE\u7F6E",
|
|
@@ -10935,15 +11349,15 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10935
11349
|
onOpenChange: (next) => {
|
|
10936
11350
|
if (!saveLock.current) setOpen(next);
|
|
10937
11351
|
},
|
|
10938
|
-
children: /* @__PURE__ */
|
|
10939
|
-
loading ? /* @__PURE__ */
|
|
10940
|
-
error ? /* @__PURE__ */
|
|
11352
|
+
children: /* @__PURE__ */ jsxs28("div", { className: "sia-query-settings", children: [
|
|
11353
|
+
loading ? /* @__PURE__ */ jsx32("p", { role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u67E5\u8BE2\u8BBE\u7F6E\u2026" }) : null,
|
|
11354
|
+
error ? /* @__PURE__ */ jsxs28("div", { role: "alert", className: "sia-query-form__error", children: [
|
|
10941
11355
|
error,
|
|
10942
|
-
loadFailed ? /* @__PURE__ */
|
|
11356
|
+
loadFailed ? /* @__PURE__ */ jsx32(Button, { type: "button", variant: "link", onClick: () => void load(true), children: "\u91CD\u8BD5" }) : null
|
|
10943
11357
|
] }) : null,
|
|
10944
|
-
/* @__PURE__ */
|
|
10945
|
-
/* @__PURE__ */
|
|
10946
|
-
/* @__PURE__ */
|
|
11358
|
+
/* @__PURE__ */ jsx32(Checkbox, { checked: draft.defaultCollapsed, disabled: locked, onChange: (checked) => setDraft((current) => ({ ...current, defaultCollapsed: checked })), children: "\u9ED8\u8BA4\u6536\u8D77\u67E5\u8BE2\u6761\u4EF6" }),
|
|
11359
|
+
/* @__PURE__ */ jsx32("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" }),
|
|
11360
|
+
/* @__PURE__ */ jsx32("div", { ref: sort.listRef, className: `sia-query-settings__list${sort.preview ? " is-sorting" : ""}`, children: visibleDraft.map((item, index) => /* @__PURE__ */ jsxs28(
|
|
10947
11361
|
"div",
|
|
10948
11362
|
{
|
|
10949
11363
|
"data-query-field-key": item.key,
|
|
@@ -10951,18 +11365,18 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10951
11365
|
style: sort.preview ? { transform: `translateY(${sort.preview.offsets[item.key] ?? 0}px)` } : void 0,
|
|
10952
11366
|
onPointerDown: (event) => sort.start(event, item.key),
|
|
10953
11367
|
children: [
|
|
10954
|
-
/* @__PURE__ */
|
|
10955
|
-
/* @__PURE__ */
|
|
10956
|
-
/* @__PURE__ */
|
|
10957
|
-
/* @__PURE__ */
|
|
10958
|
-
/* @__PURE__ */
|
|
10959
|
-
/* @__PURE__ */
|
|
11368
|
+
/* @__PURE__ */ jsx32(Icon, { name: "menu", size: 15 }),
|
|
11369
|
+
/* @__PURE__ */ jsx32(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) })) }),
|
|
11370
|
+
/* @__PURE__ */ jsx32("span", { className: "sia-query-settings__name", children: labels.get(item.key) ?? item.key }),
|
|
11371
|
+
/* @__PURE__ */ jsxs28("div", { className: "sia-query-settings__order", children: [
|
|
11372
|
+
/* @__PURE__ */ jsx32(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0A\u79FB ${item.key}`, disabled: locked || index === 0, icon: /* @__PURE__ */ jsx32(Icon, { name: "chevron-up" }), onClick: () => move(index, index - 1) }),
|
|
11373
|
+
/* @__PURE__ */ jsx32(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0B\u79FB ${item.key}`, disabled: locked || index === visibleDraft.length - 1, icon: /* @__PURE__ */ jsx32(Icon, { name: "chevron-down" }), onClick: () => move(index, index + 1) })
|
|
10960
11374
|
] })
|
|
10961
11375
|
]
|
|
10962
11376
|
},
|
|
10963
11377
|
item.key
|
|
10964
11378
|
)) }),
|
|
10965
|
-
/* @__PURE__ */
|
|
11379
|
+
/* @__PURE__ */ jsx32(Button, { type: "button", disabled: locked, onClick: () => setDraft({ fields: reconcileQueryFields(fields.map((field) => field.key)), defaultCollapsed: defaultCollapsed ?? false }), children: "\u6062\u590D\u9ED8\u8BA4" })
|
|
10966
11380
|
] })
|
|
10967
11381
|
}
|
|
10968
11382
|
)
|
|
@@ -10971,7 +11385,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10971
11385
|
}
|
|
10972
11386
|
|
|
10973
11387
|
// src/components/QueryForm.tsx
|
|
10974
|
-
import { jsx as
|
|
11388
|
+
import { jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
10975
11389
|
function QueryForm({
|
|
10976
11390
|
fields,
|
|
10977
11391
|
settings,
|
|
@@ -11006,23 +11420,23 @@ function QueryForm({
|
|
|
11006
11420
|
...formProps
|
|
11007
11421
|
}) {
|
|
11008
11422
|
const [form] = useForm(providedForm);
|
|
11009
|
-
const [internalCollapsed, setInternalCollapsed] =
|
|
11010
|
-
const [expandedRows, setExpandedRows] =
|
|
11011
|
-
const [needsCollapse, setNeedsCollapse] =
|
|
11423
|
+
const [internalCollapsed, setInternalCollapsed] = useState28(defaultCollapsed);
|
|
11424
|
+
const [expandedRows, setExpandedRows] = useState28(0);
|
|
11425
|
+
const [needsCollapse, setNeedsCollapse] = useState28(false);
|
|
11012
11426
|
const collapsed = collapsible && needsCollapse && (controlledCollapsed ?? internalCollapsed ?? expandedRows >= 3);
|
|
11013
|
-
const [searching, setSearching] =
|
|
11014
|
-
const [saving, setSaving] =
|
|
11015
|
-
const [removing, setRemoving] =
|
|
11016
|
-
const [saveOpen, setSaveOpen] =
|
|
11017
|
-
const [saveName, setSaveName] =
|
|
11018
|
-
const [saveError, setSaveError] =
|
|
11019
|
-
const [error, setError] =
|
|
11020
|
-
const [activeShortcut, setActiveShortcut] =
|
|
11021
|
-
const source =
|
|
11022
|
-
const searchLock =
|
|
11023
|
-
const saveLock =
|
|
11024
|
-
const removeLock =
|
|
11025
|
-
const snapshot =
|
|
11427
|
+
const [searching, setSearching] = useState28(false);
|
|
11428
|
+
const [saving, setSaving] = useState28(false);
|
|
11429
|
+
const [removing, setRemoving] = useState28(false);
|
|
11430
|
+
const [saveOpen, setSaveOpen] = useState28(false);
|
|
11431
|
+
const [saveName, setSaveName] = useState28("");
|
|
11432
|
+
const [saveError, setSaveError] = useState28("");
|
|
11433
|
+
const [error, setError] = useState28("");
|
|
11434
|
+
const [activeShortcut, setActiveShortcut] = useState28("");
|
|
11435
|
+
const source = useRef28({ source: "submit" });
|
|
11436
|
+
const searchLock = useRef28(false);
|
|
11437
|
+
const saveLock = useRef28(false);
|
|
11438
|
+
const removeLock = useRef28(false);
|
|
11439
|
+
const snapshot = useRef28();
|
|
11026
11440
|
const busy = disabled || loading || searching;
|
|
11027
11441
|
const shortcutBusy = busy || shortcutsLoading || saving || removing;
|
|
11028
11442
|
const fieldLabel = (content) => {
|
|
@@ -11034,7 +11448,7 @@ function QueryForm({
|
|
|
11034
11448
|
width,
|
|
11035
11449
|
hideDisabled: settingsHideDisabled,
|
|
11036
11450
|
label: settingsLabel ?? item.label ?? (typeof item.children === "function" ? void 0 : fieldLabel(item.children)) ?? key,
|
|
11037
|
-
content: /* @__PURE__ */
|
|
11451
|
+
content: /* @__PURE__ */ jsx33(Form.Item, { noStyle: true, ...item })
|
|
11038
11452
|
})) : Children4.toArray(children).map((content, index) => ({
|
|
11039
11453
|
key: isValidElement5(content) && content.key != null ? String(content.key) : String(index),
|
|
11040
11454
|
width: void 0,
|
|
@@ -11049,11 +11463,11 @@ function QueryForm({
|
|
|
11049
11463
|
const entries = configured.map((item) => ({ ...entriesByKey.get(item.key), visible: item.visible, visibleIndex: item.visible ? visibleIndex++ : -1 }));
|
|
11050
11464
|
const layoutKey = JSON.stringify(configured);
|
|
11051
11465
|
const limit = Math.max(1, Math.floor(collapsedCount));
|
|
11052
|
-
const rowRef =
|
|
11053
|
-
const actionsRef =
|
|
11054
|
-
const toggleRef =
|
|
11055
|
-
const [fittingCount, setFittingCount] =
|
|
11056
|
-
const [settingsRows, setSettingsRows] =
|
|
11466
|
+
const rowRef = useRef28(null);
|
|
11467
|
+
const actionsRef = useRef28(null);
|
|
11468
|
+
const toggleRef = useRef28(null);
|
|
11469
|
+
const [fittingCount, setFittingCount] = useState28(limit);
|
|
11470
|
+
const [settingsRows, setSettingsRows] = useState28(0);
|
|
11057
11471
|
useLayoutEffect9(() => {
|
|
11058
11472
|
const row = rowRef.current;
|
|
11059
11473
|
const actions = actionsRef.current;
|
|
@@ -11217,8 +11631,8 @@ function QueryForm({
|
|
|
11217
11631
|
setRemoving(false);
|
|
11218
11632
|
}
|
|
11219
11633
|
}
|
|
11220
|
-
return /* @__PURE__ */
|
|
11221
|
-
/* @__PURE__ */
|
|
11634
|
+
return /* @__PURE__ */ jsxs29("div", { className: `sia-query-form ${className}`.trim(), children: [
|
|
11635
|
+
/* @__PURE__ */ jsxs29(
|
|
11222
11636
|
Form,
|
|
11223
11637
|
{
|
|
11224
11638
|
...formProps,
|
|
@@ -11237,8 +11651,8 @@ function QueryForm({
|
|
|
11237
11651
|
onValuesChange?.(changed, values);
|
|
11238
11652
|
},
|
|
11239
11653
|
children: [
|
|
11240
|
-
quickQueries.length ? /* @__PURE__ */
|
|
11241
|
-
quickQueries.map((query) => /* @__PURE__ */
|
|
11654
|
+
quickQueries.length ? /* @__PURE__ */ jsxs29("div", { className: "sia-query-form__quick", "aria-label": "\u9884\u8BBE\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
11655
|
+
quickQueries.map((query) => /* @__PURE__ */ jsx33(
|
|
11242
11656
|
Badge,
|
|
11243
11657
|
{
|
|
11244
11658
|
className: "sia-query-form__quick-badge",
|
|
@@ -11247,7 +11661,7 @@ function QueryForm({
|
|
|
11247
11661
|
title: query.count === void 0 ? void 0 : `\u5171 ${query.count} \u6761`,
|
|
11248
11662
|
...query.badgeProps,
|
|
11249
11663
|
count: query.count,
|
|
11250
|
-
children: /* @__PURE__ */
|
|
11664
|
+
children: /* @__PURE__ */ jsx33(
|
|
11251
11665
|
Button,
|
|
11252
11666
|
{
|
|
11253
11667
|
size: query.size ?? quickQuerySize,
|
|
@@ -11263,7 +11677,7 @@ function QueryForm({
|
|
|
11263
11677
|
)),
|
|
11264
11678
|
" "
|
|
11265
11679
|
] }) : null,
|
|
11266
|
-
/* @__PURE__ */
|
|
11680
|
+
/* @__PURE__ */ jsx33("div", { className: "sia-query-form__motion", children: /* @__PURE__ */ jsxs29(
|
|
11267
11681
|
"div",
|
|
11268
11682
|
{
|
|
11269
11683
|
ref: rowRef,
|
|
@@ -11272,7 +11686,7 @@ function QueryForm({
|
|
|
11272
11686
|
"--sia-query-field-width": typeof fieldWidth === "number" ? `${fieldWidth}px` : fieldWidth
|
|
11273
11687
|
},
|
|
11274
11688
|
children: [
|
|
11275
|
-
entries.map((entry) => /* @__PURE__ */
|
|
11689
|
+
entries.map((entry) => /* @__PURE__ */ jsx33(
|
|
11276
11690
|
"div",
|
|
11277
11691
|
{
|
|
11278
11692
|
className: "sia-query-form__field",
|
|
@@ -11286,9 +11700,9 @@ function QueryForm({
|
|
|
11286
11700
|
},
|
|
11287
11701
|
entry.key
|
|
11288
11702
|
)),
|
|
11289
|
-
/* @__PURE__ */
|
|
11290
|
-
/* @__PURE__ */
|
|
11291
|
-
/* @__PURE__ */
|
|
11703
|
+
/* @__PURE__ */ jsxs29("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
|
|
11704
|
+
/* @__PURE__ */ jsxs29(Space.Compact, { children: [
|
|
11705
|
+
/* @__PURE__ */ jsx33(
|
|
11292
11706
|
Button,
|
|
11293
11707
|
{
|
|
11294
11708
|
type: "submit",
|
|
@@ -11298,8 +11712,8 @@ function QueryForm({
|
|
|
11298
11712
|
children: searchText
|
|
11299
11713
|
}
|
|
11300
11714
|
),
|
|
11301
|
-
/* @__PURE__ */
|
|
11302
|
-
onSaveQuery ? /* @__PURE__ */
|
|
11715
|
+
/* @__PURE__ */ jsx33(Button, { disabled: busy, onClick: reset, children: resetText }),
|
|
11716
|
+
onSaveQuery ? /* @__PURE__ */ jsx33(
|
|
11303
11717
|
Button,
|
|
11304
11718
|
{
|
|
11305
11719
|
disabled: shortcutBusy,
|
|
@@ -11314,12 +11728,12 @@ function QueryForm({
|
|
|
11314
11728
|
) : null,
|
|
11315
11729
|
showSettings ?? settingsRows > 2 ? cloudSettings.control : null
|
|
11316
11730
|
] }),
|
|
11317
|
-
collapsible && entries.length > 0 ? /* @__PURE__ */
|
|
11731
|
+
collapsible && entries.length > 0 ? /* @__PURE__ */ jsx33("span", { ref: toggleRef, hidden: !needsCollapse, children: /* @__PURE__ */ jsx33(
|
|
11318
11732
|
Button,
|
|
11319
11733
|
{
|
|
11320
11734
|
variant: "link",
|
|
11321
11735
|
"aria-expanded": !collapsed,
|
|
11322
|
-
icon: /* @__PURE__ */
|
|
11736
|
+
icon: /* @__PURE__ */ jsx33(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
|
|
11323
11737
|
iconPosition: "end",
|
|
11324
11738
|
onClick: () => {
|
|
11325
11739
|
setInternalCollapsed(!collapsed);
|
|
@@ -11334,8 +11748,8 @@ function QueryForm({
|
|
|
11334
11748
|
]
|
|
11335
11749
|
}
|
|
11336
11750
|
) }),
|
|
11337
|
-
savedQueries.length ? /* @__PURE__ */
|
|
11338
|
-
savedQueries.map((query, index) => /* @__PURE__ */
|
|
11751
|
+
savedQueries.length ? /* @__PURE__ */ jsxs29("div", { className: "sia-query-form__saved", "aria-label": "\u5DF2\u4FDD\u5B58\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
11752
|
+
savedQueries.map((query, index) => /* @__PURE__ */ jsx33(
|
|
11339
11753
|
Tag,
|
|
11340
11754
|
{
|
|
11341
11755
|
status: query.status ?? ["processing", "success", "warning", "error"][index % 4],
|
|
@@ -11361,11 +11775,11 @@ function QueryForm({
|
|
|
11361
11775
|
)),
|
|
11362
11776
|
" "
|
|
11363
11777
|
] }) : null,
|
|
11364
|
-
error ? /* @__PURE__ */
|
|
11778
|
+
error ? /* @__PURE__ */ jsx33("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
|
|
11365
11779
|
]
|
|
11366
11780
|
}
|
|
11367
11781
|
),
|
|
11368
|
-
/* @__PURE__ */
|
|
11782
|
+
/* @__PURE__ */ jsxs29(
|
|
11369
11783
|
Modal,
|
|
11370
11784
|
{
|
|
11371
11785
|
open: saveOpen,
|
|
@@ -11377,7 +11791,7 @@ function QueryForm({
|
|
|
11377
11791
|
if (!saveLock.current) setSaveOpen(next);
|
|
11378
11792
|
},
|
|
11379
11793
|
children: [
|
|
11380
|
-
/* @__PURE__ */
|
|
11794
|
+
/* @__PURE__ */ jsx33(
|
|
11381
11795
|
Input,
|
|
11382
11796
|
{
|
|
11383
11797
|
autoFocus: true,
|
|
@@ -11396,7 +11810,7 @@ function QueryForm({
|
|
|
11396
11810
|
}
|
|
11397
11811
|
}
|
|
11398
11812
|
),
|
|
11399
|
-
saveError ? /* @__PURE__ */
|
|
11813
|
+
saveError ? /* @__PURE__ */ jsx33("p", { className: "sia-query-form__error", role: "alert", children: saveError }) : null
|
|
11400
11814
|
]
|
|
11401
11815
|
}
|
|
11402
11816
|
)
|
|
@@ -11405,7 +11819,7 @@ function QueryForm({
|
|
|
11405
11819
|
|
|
11406
11820
|
// src/components/NumberRange.tsx
|
|
11407
11821
|
import { forwardRef as forwardRef9 } from "react";
|
|
11408
|
-
import { jsx as
|
|
11822
|
+
import { jsx as jsx34, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
11409
11823
|
var NumberRange = forwardRef9(function NumberRange2({
|
|
11410
11824
|
value,
|
|
11411
11825
|
defaultValue = [null, null],
|
|
@@ -11434,7 +11848,7 @@ var NumberRange = forwardRef9(function NumberRange2({
|
|
|
11434
11848
|
setValue2(index === 0 ? [next, range[1]] : [range[0], next]);
|
|
11435
11849
|
}
|
|
11436
11850
|
const inputProps = { min, max, step, precision, size, status, disabled, readOnly, placeholderMode, controls: false };
|
|
11437
|
-
return /* @__PURE__ */
|
|
11851
|
+
return /* @__PURE__ */ jsxs30(
|
|
11438
11852
|
"span",
|
|
11439
11853
|
{
|
|
11440
11854
|
...props,
|
|
@@ -11443,7 +11857,7 @@ var NumberRange = forwardRef9(function NumberRange2({
|
|
|
11443
11857
|
"aria-disabled": disabled || void 0,
|
|
11444
11858
|
className: `sia-number-range sia-number-range--${size} sia-number-range--${status}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
11445
11859
|
children: [
|
|
11446
|
-
/* @__PURE__ */
|
|
11860
|
+
/* @__PURE__ */ jsx34(
|
|
11447
11861
|
InputNumber,
|
|
11448
11862
|
{
|
|
11449
11863
|
...inputProps,
|
|
@@ -11455,8 +11869,8 @@ var NumberRange = forwardRef9(function NumberRange2({
|
|
|
11455
11869
|
onChange: (next) => change(0, next)
|
|
11456
11870
|
}
|
|
11457
11871
|
),
|
|
11458
|
-
/* @__PURE__ */
|
|
11459
|
-
/* @__PURE__ */
|
|
11872
|
+
/* @__PURE__ */ jsx34(Icon, { className: "sia-number-range__separator", name: "tilde", size: 12, strokeWidth: 1.5, "aria-hidden": "true" }),
|
|
11873
|
+
/* @__PURE__ */ jsx34(
|
|
11460
11874
|
InputNumber,
|
|
11461
11875
|
{
|
|
11462
11876
|
...inputProps,
|
|
@@ -11468,15 +11882,15 @@ var NumberRange = forwardRef9(function NumberRange2({
|
|
|
11468
11882
|
onChange: (next) => change(1, next)
|
|
11469
11883
|
}
|
|
11470
11884
|
),
|
|
11471
|
-
allowClear && !disabled && !readOnly && range.some((item) => item !== null) ? /* @__PURE__ */
|
|
11885
|
+
allowClear && !disabled && !readOnly && range.some((item) => item !== null) ? /* @__PURE__ */ jsx34("button", { type: "button", className: "sia-number-range__clear", "aria-label": "\u6E05\u9664\u6570\u5B57\u533A\u95F4", onClick: () => setValue2([null, null]), children: /* @__PURE__ */ jsx34(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null
|
|
11472
11886
|
]
|
|
11473
11887
|
}
|
|
11474
11888
|
);
|
|
11475
11889
|
});
|
|
11476
11890
|
|
|
11477
11891
|
// src/components/VirtualGrid.tsx
|
|
11478
|
-
import { useEffect as
|
|
11479
|
-
import { jsx as
|
|
11892
|
+
import { useEffect as useEffect20, useLayoutEffect as useLayoutEffect10, useRef as useRef29, useState as useState29 } from "react";
|
|
11893
|
+
import { jsx as jsx35, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
11480
11894
|
function VirtualGrid({
|
|
11481
11895
|
items,
|
|
11482
11896
|
itemKey,
|
|
@@ -11495,11 +11909,11 @@ function VirtualGrid({
|
|
|
11495
11909
|
tabIndex = 0,
|
|
11496
11910
|
...props
|
|
11497
11911
|
}) {
|
|
11498
|
-
const viewport =
|
|
11499
|
-
const [size, setSize] =
|
|
11500
|
-
const [scrollTop, setScrollTop] =
|
|
11501
|
-
const frame =
|
|
11502
|
-
const requestedLength =
|
|
11912
|
+
const viewport = useRef29(null);
|
|
11913
|
+
const [size, setSize] = useState29({ width: 0, height: 0 });
|
|
11914
|
+
const [scrollTop, setScrollTop] = useState29(0);
|
|
11915
|
+
const frame = useRef29();
|
|
11916
|
+
const requestedLength = useRef29();
|
|
11503
11917
|
const height = Math.max(1, rowHeight);
|
|
11504
11918
|
const spacing = Math.max(0, gap);
|
|
11505
11919
|
const columns = Math.max(1, Math.floor((size.width + spacing) / (Math.max(1, minColumnWidth) + spacing)));
|
|
@@ -11528,14 +11942,14 @@ function VirtualGrid({
|
|
|
11528
11942
|
if (el.scrollTop !== next) el.scrollTop = next;
|
|
11529
11943
|
setScrollTop(next);
|
|
11530
11944
|
}, [totalHeight, size.height]);
|
|
11531
|
-
|
|
11945
|
+
useEffect20(() => {
|
|
11532
11946
|
if (!onLoadMore || !hasMore || loading || size.height <= 0) return;
|
|
11533
11947
|
if (totalHeight - scrollTop - size.height > Math.max(0, loadMoreThreshold)) return;
|
|
11534
11948
|
if (requestedLength.current === items.length) return;
|
|
11535
11949
|
requestedLength.current = items.length;
|
|
11536
11950
|
onLoadMore();
|
|
11537
11951
|
}, [items.length, hasMore, loading, size.height, scrollTop, totalHeight, loadMoreThreshold, onLoadMore]);
|
|
11538
|
-
return /* @__PURE__ */
|
|
11952
|
+
return /* @__PURE__ */ jsxs31(
|
|
11539
11953
|
"div",
|
|
11540
11954
|
{
|
|
11541
11955
|
...props,
|
|
@@ -11553,16 +11967,16 @@ function VirtualGrid({
|
|
|
11553
11967
|
});
|
|
11554
11968
|
},
|
|
11555
11969
|
children: [
|
|
11556
|
-
/* @__PURE__ */
|
|
11970
|
+
/* @__PURE__ */ jsx35("div", { className: "sia-virtual-grid__spacer", style: { height: totalHeight }, children: Array.from({ length: Math.max(0, endRow - startRow) }, (_, offset) => {
|
|
11557
11971
|
const row = startRow + offset;
|
|
11558
|
-
return /* @__PURE__ */
|
|
11972
|
+
return /* @__PURE__ */ jsx35("div", { className: "sia-virtual-grid__row", role: "presentation", style: {
|
|
11559
11973
|
top: row * stride,
|
|
11560
11974
|
height,
|
|
11561
11975
|
columnGap: spacing,
|
|
11562
11976
|
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`
|
|
11563
11977
|
}, children: items.slice(row * columns, (row + 1) * columns).map((item, column) => {
|
|
11564
11978
|
const index = row * columns + column;
|
|
11565
|
-
return /* @__PURE__ */
|
|
11979
|
+
return /* @__PURE__ */ jsx35("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));
|
|
11566
11980
|
}) }, row);
|
|
11567
11981
|
}) }),
|
|
11568
11982
|
!items.length && !loading ? empty : null
|
|
@@ -11602,6 +12016,7 @@ export {
|
|
|
11602
12016
|
ChartVisualMap,
|
|
11603
12017
|
ChartWhirlingLoading,
|
|
11604
12018
|
Checkbox,
|
|
12019
|
+
ChooseBox,
|
|
11605
12020
|
ChordChart,
|
|
11606
12021
|
Col,
|
|
11607
12022
|
Collapse,
|
|
@@ -11707,6 +12122,7 @@ export {
|
|
|
11707
12122
|
chartColor,
|
|
11708
12123
|
chartTicks,
|
|
11709
12124
|
createBaiduMapHost,
|
|
12125
|
+
createBrowserChooseBoxSource,
|
|
11710
12126
|
createCellSelectionPlugin,
|
|
11711
12127
|
createColumnSettingPlugin,
|
|
11712
12128
|
createColumnTransformPlugin,
|
|
@@ -11722,6 +12138,7 @@ export {
|
|
|
11722
12138
|
createSelectionPlugin,
|
|
11723
12139
|
createSortPlugin,
|
|
11724
12140
|
createSummaryPlugin,
|
|
12141
|
+
createTauriChooseBoxSource,
|
|
11725
12142
|
createToolbarPlugin,
|
|
11726
12143
|
createTreePlugin,
|
|
11727
12144
|
createWorksheetPlugin,
|