@sia.soul/sia-react-ui 0.1.166 → 0.1.167
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/chart.cjs +4553 -4513
- package/dist/chart.d.cts +1850 -1843
- package/dist/chart.d.ts +1850 -1843
- package/dist/chart.js +1 -1
- package/dist/chunk-2FZI7TP6.js +0 -0
- package/dist/{chunk-T2F6X3LA.js → chunk-5CGJVE4C.js} +26 -22
- package/dist/{chunk-2EC653G5.js → chunk-5KTQXNGL.js} +2 -2
- package/dist/{chunk-NHGCGOF2.js → chunk-A7TLMWMM.js} +4754 -4714
- package/dist/{chunk-G5EJJFUI.js → chunk-FSO46WEJ.js} +14 -6
- package/dist/{chunk-SX4LLT3H.js → chunk-KDNOLFDJ.js} +2 -2
- package/dist/{chunk-DKQ5UCN6.js → chunk-S6FA6NN3.js} +519 -220
- package/dist/{chunk-23FQ5ARA.js → chunk-XS7AVCHO.js} +27 -17
- package/dist/{core-Cnt8r6pj.d.cts → core-C7Was4Vc.d.cts} +6 -9
- package/dist/{core-Dy8NWJ1b.d.ts → core-D7C32Rdq.d.ts} +6 -9
- package/dist/core.cjs +83 -61
- package/dist/core.css +3135 -5340
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +4 -4
- package/dist/game.cjs +14 -6
- package/dist/game.css +1666 -3147
- package/dist/game.js +1 -1
- package/dist/index.cjs +6625 -6197
- package/dist/index.css +8733 -8560
- package/dist/index.d.cts +126 -110
- package/dist/index.d.ts +126 -110
- package/dist/index.js +817 -749
- package/dist/markdown-editor.css +461 -0
- package/dist/markdown-editor.js +2 -1
- package/dist/rich-text-editor.cjs +38 -20
- package/dist/rich-text-editor.css +461 -0
- package/dist/rich-text-editor.js +4 -3
- package/dist/{select-date-range-E1N5-oXv.d.ts → select-date-range-AOleKBXc.d.ts} +6 -9
- package/dist/{select-date-range-BnlISSPV.d.cts → select-date-range-BtTkMElI.d.cts} +6 -9
- package/dist/select-date-range.cjs +529 -222
- package/dist/select-date-range.d.cts +1 -1
- package/dist/select-date-range.d.ts +1 -1
- package/dist/select-date-range.js +4 -4
- package/package.json +5 -1
- /package/dist/{chunk-V4I32DPL.js → chunk-GKWSCL5Q.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
smoothSvgPath,
|
|
57
57
|
svgArcPath,
|
|
58
58
|
transferCompositeValue
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-A7TLMWMM.js";
|
|
60
60
|
import {
|
|
61
61
|
Badge,
|
|
62
62
|
Breadcrumb,
|
|
@@ -82,20 +82,21 @@ import {
|
|
|
82
82
|
Watermark,
|
|
83
83
|
message,
|
|
84
84
|
notification
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-5CGJVE4C.js";
|
|
86
86
|
import "./chunk-RX242MUO.js";
|
|
87
87
|
import {
|
|
88
88
|
MarkdownEditor
|
|
89
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-GKWSCL5Q.js";
|
|
90
90
|
import {
|
|
91
91
|
RichTextContent,
|
|
92
92
|
RichTextEditor
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-5KTQXNGL.js";
|
|
94
|
+
import "./chunk-2FZI7TP6.js";
|
|
94
95
|
import {
|
|
95
96
|
DatePicker,
|
|
96
97
|
SelectDateRange,
|
|
97
98
|
TimePanel
|
|
98
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-S6FA6NN3.js";
|
|
99
100
|
import {
|
|
100
101
|
Checkbox,
|
|
101
102
|
OverflowTags,
|
|
@@ -107,14 +108,14 @@ import {
|
|
|
107
108
|
Tree,
|
|
108
109
|
normalizeSelectionValues,
|
|
109
110
|
usePressFeedback
|
|
110
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-KDNOLFDJ.js";
|
|
111
112
|
import {
|
|
112
113
|
Dropdown,
|
|
113
114
|
Input,
|
|
114
115
|
Menu,
|
|
115
116
|
Segmented,
|
|
116
117
|
Steps
|
|
117
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-XS7AVCHO.js";
|
|
118
119
|
import {
|
|
119
120
|
TextArea
|
|
120
121
|
} from "./chunk-J6BPKBEL.js";
|
|
@@ -128,7 +129,7 @@ import {
|
|
|
128
129
|
Skeleton,
|
|
129
130
|
useOverlayExitPlaceholder,
|
|
130
131
|
useOverlayLifecycle
|
|
131
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-FSO46WEJ.js";
|
|
132
133
|
import {
|
|
133
134
|
Button
|
|
134
135
|
} from "./chunk-PAWEP65C.js";
|
|
@@ -606,7 +607,7 @@ function SortableList({ items, renderItem, onOrderChange, direction = "horizonta
|
|
|
606
607
|
}
|
|
607
608
|
|
|
608
609
|
// src/components/Alert.tsx
|
|
609
|
-
import { useRef as useRef3, useState as useState3 } from "react";
|
|
610
|
+
import { forwardRef, useRef as useRef3, useState as useState3 } from "react";
|
|
610
611
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
611
612
|
var alertIcons = {
|
|
612
613
|
info: /* @__PURE__ */ jsx3(Icon, { name: "info", size: 20, variant: "filled" }),
|
|
@@ -614,7 +615,7 @@ var alertIcons = {
|
|
|
614
615
|
warning: /* @__PURE__ */ jsx3(Icon, { name: "warning", size: 20, variant: "filled" }),
|
|
615
616
|
error: /* @__PURE__ */ jsx3(Icon, { name: "circle-close", size: 20, variant: "filled" })
|
|
616
617
|
};
|
|
617
|
-
|
|
618
|
+
var Alert = forwardRef(function Alert2({
|
|
618
619
|
status,
|
|
619
620
|
type,
|
|
620
621
|
title,
|
|
@@ -629,7 +630,7 @@ function Alert({
|
|
|
629
630
|
afterClose,
|
|
630
631
|
className = "",
|
|
631
632
|
...props
|
|
632
|
-
}) {
|
|
633
|
+
}, forwardedRef) {
|
|
633
634
|
const [visible, setVisible] = useState3(true);
|
|
634
635
|
const rootRef = useRef3(null);
|
|
635
636
|
const motion = useOverlayMotion(visible, rootRef, "fade", "bottom", true, (opened) => {
|
|
@@ -638,8 +639,13 @@ function Alert({
|
|
|
638
639
|
const resolvedStatus = status ?? type ?? (banner ? "warning" : "info");
|
|
639
640
|
const heading = message2 ?? title;
|
|
640
641
|
const hasHeading = heading != null && heading !== "" && typeof heading !== "boolean";
|
|
642
|
+
function setRef(node) {
|
|
643
|
+
rootRef.current = node;
|
|
644
|
+
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
645
|
+
else if (forwardedRef) forwardedRef.current = node;
|
|
646
|
+
}
|
|
641
647
|
if (!motion.present) return null;
|
|
642
|
-
return /* @__PURE__ */ jsxs3("div", { ref:
|
|
648
|
+
return /* @__PURE__ */ jsxs3("div", { ref: setRef, className: `sia-alert sia-alert--${resolvedStatus}${banner ? " sia-alert--banner" : ""}${description ? " sia-alert--with-description" : ""} ${className}`.trim(), role: "alert", ...withTitleTooltip(props), ...!visible ? { inert: "" } : {}, children: [
|
|
643
649
|
showIcon || banner ? /* @__PURE__ */ jsx3("span", { className: "sia-alert__icon", "aria-hidden": "true", children: alertIcons[resolvedStatus] }) : null,
|
|
644
650
|
/* @__PURE__ */ jsxs3("div", { className: "sia-alert__content", children: [
|
|
645
651
|
hasHeading ? /* @__PURE__ */ jsx3("strong", { children: heading }) : null,
|
|
@@ -651,13 +657,13 @@ function Alert({
|
|
|
651
657
|
setVisible(false);
|
|
652
658
|
}, children: closeIcon ?? /* @__PURE__ */ jsx3(Icon, { name: "close", size: 14 }) }) : null
|
|
653
659
|
] });
|
|
654
|
-
}
|
|
660
|
+
});
|
|
655
661
|
|
|
656
662
|
// src/components/Pagination.tsx
|
|
657
|
-
import { useState as useState4 } from "react";
|
|
663
|
+
import { forwardRef as forwardRef2, useState as useState4 } from "react";
|
|
658
664
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
659
665
|
var DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50, 100, 200, 500, 1e3, 2e3, 5e3];
|
|
660
|
-
|
|
666
|
+
var Pagination = forwardRef2(function Pagination2({
|
|
661
667
|
size: sizeProp,
|
|
662
668
|
total = 0,
|
|
663
669
|
currentPageCount,
|
|
@@ -676,7 +682,7 @@ function Pagination({
|
|
|
676
682
|
onShowSizeChange,
|
|
677
683
|
className = "",
|
|
678
684
|
...props
|
|
679
|
-
}) {
|
|
685
|
+
}, forwardedRef) {
|
|
680
686
|
const controlSize = useControlSize(sizeProp);
|
|
681
687
|
const [size, setSize] = useControllableState({ value: pageSize, defaultValue: Math.max(1, defaultPageSize) });
|
|
682
688
|
const [page, setPage] = useControllableState({ value: current, defaultValue: Math.max(1, defaultCurrent) });
|
|
@@ -710,7 +716,7 @@ function Pagination({
|
|
|
710
716
|
if (refreshing === void 0) setInternalRefreshing(false);
|
|
711
717
|
}
|
|
712
718
|
}
|
|
713
|
-
return /* @__PURE__ */ jsxs4("nav", { className: `sia-pagination sia-pagination--${controlSize} ${className}`.trim(), "aria-label": "\u5206\u9875", ...withTitleTooltip(props), children: [
|
|
719
|
+
return /* @__PURE__ */ jsxs4("nav", { ref: forwardedRef, className: `sia-pagination sia-pagination--${controlSize} ${className}`.trim(), "aria-label": "\u5206\u9875", ...withTitleTooltip(props), children: [
|
|
714
720
|
/* @__PURE__ */ jsxs4("span", { className: "sia-pagination__current-count", "aria-live": "polite", children: [
|
|
715
721
|
"\u5F53\u524D\u9875 ",
|
|
716
722
|
pageCount,
|
|
@@ -764,10 +770,10 @@ function Pagination({
|
|
|
764
770
|
/* @__PURE__ */ jsx4(Button, { size: controlSize, variant: "text", "aria-label": "\u6700\u540E\u4E00\u9875", disabled: disabled || safePage >= totalPages, onClick: () => change(totalPages), children: /* @__PURE__ */ jsx4(Icon, { name: "double-right", size: 15 }) })
|
|
765
771
|
] })
|
|
766
772
|
] });
|
|
767
|
-
}
|
|
773
|
+
});
|
|
768
774
|
|
|
769
775
|
// src/components/Cascader.tsx
|
|
770
|
-
import { useEffect as useEffect3, useMemo, useRef as useRef4, useState as useState5 } from "react";
|
|
776
|
+
import { forwardRef as forwardRef3, useEffect as useEffect3, useMemo, useRef as useRef4, useState as useState5 } from "react";
|
|
771
777
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
772
778
|
function optionValue(option, fields) {
|
|
773
779
|
return option[fields.value];
|
|
@@ -802,7 +808,7 @@ function leafPaths(options, fields, parents = []) {
|
|
|
802
808
|
}
|
|
803
809
|
return result;
|
|
804
810
|
}
|
|
805
|
-
|
|
811
|
+
var Cascader = forwardRef3(function Cascader2({
|
|
806
812
|
options,
|
|
807
813
|
value,
|
|
808
814
|
defaultValue,
|
|
@@ -821,10 +827,15 @@ function Cascader({
|
|
|
821
827
|
onChange,
|
|
822
828
|
className = "",
|
|
823
829
|
...props
|
|
824
|
-
}) {
|
|
830
|
+
}, forwardedRef) {
|
|
825
831
|
const size = useControlSize(sizeProp);
|
|
826
832
|
const fields = useMemo(() => ({ label: fieldNames?.label ?? "label", value: fieldNames?.value ?? "value", children: fieldNames?.children ?? "children" }), [fieldNames]);
|
|
827
833
|
const rootRef = useRef4(null);
|
|
834
|
+
function setRootRef(node) {
|
|
835
|
+
rootRef.current = node;
|
|
836
|
+
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
837
|
+
else if (forwardedRef) forwardedRef.current = node;
|
|
838
|
+
}
|
|
828
839
|
const popupRef = useRef4(null);
|
|
829
840
|
const [current, setCurrent] = useControllableState({
|
|
830
841
|
value,
|
|
@@ -911,7 +922,7 @@ function Cascader({
|
|
|
911
922
|
if (children?.length) columns.push(children);
|
|
912
923
|
});
|
|
913
924
|
const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: selectedPaths.length > 0, active: open });
|
|
914
|
-
return /* @__PURE__ */ jsxs5("div", { ref:
|
|
925
|
+
return /* @__PURE__ */ jsxs5("div", { ref: setRootRef, className: `sia-cascader sia-cascader--${size}${open ? " is-open" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), ...withTitleTooltip(props), children: [
|
|
915
926
|
/* @__PURE__ */ jsxs5("button", { type: "button", className: `sia-cascader__trigger${floating.className}`, disabled, "aria-haspopup": "listbox", "aria-expanded": open, onClick: toggleOpen, children: [
|
|
916
927
|
/* @__PURE__ */ jsx5("span", { className: "sia-cascader__value", children: display ? multiple && Array.isArray(display) ? display.map((label, index) => /* @__PURE__ */ jsx5("span", { className: "sia-cascader__tag", children: label }, pathKey(selectedPaths[index] ?? []))) : display : /* @__PURE__ */ jsx5("span", { className: "sia-cascader__placeholder", children: placeholder }) }),
|
|
917
928
|
allowClear && selectedPaths.length && !disabled ? /* @__PURE__ */ jsx5("span", { className: "sia-cascader__clear", role: "button", "aria-label": "\u6E05\u9664\u9009\u62E9", onClick: (event) => {
|
|
@@ -971,7 +982,7 @@ function Cascader({
|
|
|
971
982
|
}) }, depth)) })
|
|
972
983
|
] })
|
|
973
984
|
] });
|
|
974
|
-
}
|
|
985
|
+
});
|
|
975
986
|
|
|
976
987
|
// src/components/Layout.tsx
|
|
977
988
|
import { Children } from "react";
|
|
@@ -1526,9 +1537,9 @@ function ToolPanel({
|
|
|
1526
1537
|
import { useEffect as useEffect4, useRef as useRef7, useState as useState8 } from "react";
|
|
1527
1538
|
|
|
1528
1539
|
// src/components/ThemeSwitch.tsx
|
|
1529
|
-
import { forwardRef } from "react";
|
|
1540
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
1530
1541
|
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1531
|
-
var ThemeSwitch =
|
|
1542
|
+
var ThemeSwitch = forwardRef4(function ThemeSwitch2({
|
|
1532
1543
|
checked,
|
|
1533
1544
|
onCheckedChange,
|
|
1534
1545
|
lightLabel = "\u4EAE\u8272\u6A21\u5F0F",
|
|
@@ -1566,38 +1577,50 @@ var ThemeSwitch = forwardRef(function ThemeSwitch2({
|
|
|
1566
1577
|
|
|
1567
1578
|
// src/theme.ts
|
|
1568
1579
|
var SIA_THEME = {
|
|
1569
|
-
/**
|
|
1580
|
+
/** 主色,对应 `--sia-color-primary`。 */
|
|
1570
1581
|
colorPrimary: "#1677ff",
|
|
1571
|
-
/**
|
|
1582
|
+
/** 主色的悬停色,对应 `--sia-color-primary-hover`。 */
|
|
1572
1583
|
colorPrimaryHover: "#4096ff",
|
|
1573
|
-
/**
|
|
1584
|
+
/** 主色的按下色,对应 `--sia-color-primary-active`。 */
|
|
1574
1585
|
colorPrimaryActive: "#0958d9",
|
|
1575
|
-
/**
|
|
1586
|
+
/** 成功语义色,对应 `--sia-color-success`。 */
|
|
1587
|
+
colorSuccess: "#52c41a",
|
|
1588
|
+
/** 警告语义色,对应 `--sia-color-warning`。 */
|
|
1589
|
+
colorWarning: "#faad14",
|
|
1590
|
+
/** 错误语义色,对应 `--sia-color-error`。 */
|
|
1591
|
+
colorError: "#ff4d4f",
|
|
1592
|
+
/** 主要文本颜色,对应 `--sia-color-text`。 */
|
|
1576
1593
|
colorText: "#1f1f1f",
|
|
1577
|
-
/**
|
|
1594
|
+
/** 次要文本颜色,对应 `--sia-color-text-secondary`。 */
|
|
1578
1595
|
colorTextSecondary: "#666666",
|
|
1579
|
-
/**
|
|
1596
|
+
/** 页面背景颜色,对应 `--sia-color-background`。 */
|
|
1580
1597
|
colorBackground: "#f5f7fa",
|
|
1581
|
-
/**
|
|
1598
|
+
/** 组件表面颜色,对应 `--sia-color-surface`。 */
|
|
1582
1599
|
colorSurface: "#ffffff",
|
|
1583
|
-
/**
|
|
1600
|
+
/** 默认边框颜色,对应 `--sia-color-border`。 */
|
|
1584
1601
|
colorBorder: "#d9d9d9",
|
|
1585
|
-
/**
|
|
1602
|
+
/** 默认圆角半径,单位为像素,对应 `--sia-radius`。 */
|
|
1586
1603
|
borderRadius: 6,
|
|
1587
|
-
/**
|
|
1588
|
-
|
|
1589
|
-
/**
|
|
1604
|
+
/** 小号控件高度,单位为像素,对应 `--sia-control-height-small`。 */
|
|
1605
|
+
controlHeightSmall: 22,
|
|
1606
|
+
/** 默认(中号)控件高度,单位为像素,对应 `--sia-control-height` / `--sia-control-height-medium`。 */
|
|
1607
|
+
controlHeight: 30,
|
|
1608
|
+
/** 大号控件高度,单位为像素,对应 `--sia-control-height-large`。 */
|
|
1609
|
+
controlHeightLarge: 38,
|
|
1610
|
+
/** 默认布局间距为 8 像素,对应 `--sia-spacing`;业务可通过容器或组件上的同名 CSS 变量覆盖。 */
|
|
1590
1611
|
spacing: 8,
|
|
1591
|
-
/** 默认基础字号为 13 像素,对应
|
|
1612
|
+
/** 默认基础字号为 13 像素,对应 `--sia-font-size`;业务可通过 CSS 变量覆盖。 */
|
|
1592
1613
|
fontSize: 13,
|
|
1593
|
-
/** 默认小号文字尺寸为 13 像素,对应
|
|
1614
|
+
/** 默认小号文字尺寸为 13 像素,对应 `--sia-font-size-small`;业务可通过 CSS 变量覆盖。 */
|
|
1594
1615
|
fontSizeSmall: 13,
|
|
1595
|
-
/**
|
|
1616
|
+
/** 大号文字尺寸,单位为像素,对应 `--sia-font-size-large`。 */
|
|
1596
1617
|
fontSizeLarge: 18
|
|
1597
1618
|
};
|
|
1598
|
-
function applySiaTheme(mode, target
|
|
1599
|
-
target.
|
|
1600
|
-
|
|
1619
|
+
function applySiaTheme(mode, target) {
|
|
1620
|
+
const element = target ?? (typeof document !== "undefined" ? document.documentElement : null);
|
|
1621
|
+
if (!element) return;
|
|
1622
|
+
element.dataset.siaTheme = mode;
|
|
1623
|
+
element.style.colorScheme = mode;
|
|
1601
1624
|
}
|
|
1602
1625
|
|
|
1603
1626
|
// src/components/WindowFrame.tsx
|
|
@@ -1821,7 +1844,7 @@ function WindowTitleBar({
|
|
|
1821
1844
|
}
|
|
1822
1845
|
|
|
1823
1846
|
// src/components/Drawer.tsx
|
|
1824
|
-
import { createContext, forwardRef as
|
|
1847
|
+
import { createContext, forwardRef as forwardRef5, useCallback, useContext, useEffect as useEffect5, useId as useId2, useMemo as useMemo3, useRef as useRef8, useState as useState9 } from "react";
|
|
1825
1848
|
import { createRoot } from "react-dom/client";
|
|
1826
1849
|
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1827
1850
|
var drawerHandles = /* @__PURE__ */ new Set();
|
|
@@ -1833,7 +1856,7 @@ function createPushOffset(distance, depth, negative) {
|
|
|
1833
1856
|
const operator = negative ? " - " : " + ";
|
|
1834
1857
|
return `calc(0px${operator}${Array.from({ length: depth }, () => distance).join(operator)})`;
|
|
1835
1858
|
}
|
|
1836
|
-
var DrawerRoot =
|
|
1859
|
+
var DrawerRoot = forwardRef5(function Drawer({
|
|
1837
1860
|
open,
|
|
1838
1861
|
deferContent = false,
|
|
1839
1862
|
loadingFallback,
|
|
@@ -2013,9 +2036,9 @@ var Drawer2 = Object.assign(DrawerRoot, {
|
|
|
2013
2036
|
});
|
|
2014
2037
|
|
|
2015
2038
|
// src/components/Form.tsx
|
|
2016
|
-
import { Children as Children3, cloneElement as cloneElement2, createContext as createContext2, forwardRef as
|
|
2039
|
+
import { Children as Children3, cloneElement as cloneElement2, createContext as createContext2, forwardRef as forwardRef6, isValidElement as isValidElement2, useContext as useContext2, useEffect as useEffect6, useId as useId3, useLayoutEffect as useLayoutEffect3, useMemo as useMemo4, useRef as useRef9, useState as useState10, useSyncExternalStore } from "react";
|
|
2017
2040
|
import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2018
|
-
var Switch =
|
|
2041
|
+
var Switch = forwardRef6(function Switch2({
|
|
2019
2042
|
label,
|
|
2020
2043
|
variant = "standard",
|
|
2021
2044
|
size: sizeProp,
|
|
@@ -2756,10 +2779,10 @@ function RadioSelectionMotion({ rootRef }) {
|
|
|
2756
2779
|
}
|
|
2757
2780
|
|
|
2758
2781
|
// src/components/Radio.tsx
|
|
2759
|
-
import { createContext as createContext3, forwardRef as
|
|
2782
|
+
import { createContext as createContext3, forwardRef as forwardRef7, useContext as useContext3, useId as useId4, useMemo as useMemo5, useRef as useRef11 } from "react";
|
|
2760
2783
|
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2761
2784
|
var RadioContext = createContext3(null);
|
|
2762
|
-
var RadioRoot =
|
|
2785
|
+
var RadioRoot = forwardRef7(function Radio({ value, size: sizeProp, children, disabled, checked, defaultChecked, button = false, className = "", onChange, ...props }, ref) {
|
|
2763
2786
|
const size = useControlSize(sizeProp);
|
|
2764
2787
|
const group = useContext3(RadioContext);
|
|
2765
2788
|
const fallbackId = useId4();
|
|
@@ -2847,12 +2870,12 @@ var Radio2 = Object.assign(RadioRoot, {
|
|
|
2847
2870
|
});
|
|
2848
2871
|
|
|
2849
2872
|
// src/components/Slider.tsx
|
|
2850
|
-
import { useState as useState11 } from "react";
|
|
2873
|
+
import { forwardRef as forwardRef8, useState as useState11 } from "react";
|
|
2851
2874
|
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2852
2875
|
function percent(value, min, max) {
|
|
2853
2876
|
return (value - min) / (max - min) * 100;
|
|
2854
2877
|
}
|
|
2855
|
-
|
|
2878
|
+
var Slider = forwardRef8(function Slider2({
|
|
2856
2879
|
value,
|
|
2857
2880
|
defaultValue,
|
|
2858
2881
|
min = 0,
|
|
@@ -2868,7 +2891,7 @@ function Slider({
|
|
|
2868
2891
|
onChange,
|
|
2869
2892
|
onChangeComplete,
|
|
2870
2893
|
...props
|
|
2871
|
-
}) {
|
|
2894
|
+
}, forwardedRef) {
|
|
2872
2895
|
const fallback = defaultValue ?? (range ? [min, max] : min);
|
|
2873
2896
|
const [currentValue, setValue2] = useControllableState({ value, defaultValue: fallback, onChange });
|
|
2874
2897
|
const [activeThumb, setActiveThumb] = useState11(null);
|
|
@@ -2896,6 +2919,7 @@ function Slider({
|
|
|
2896
2919
|
return /* @__PURE__ */ jsxs14(
|
|
2897
2920
|
"div",
|
|
2898
2921
|
{
|
|
2922
|
+
ref: forwardedRef,
|
|
2899
2923
|
className: `sia-slider${range ? " sia-slider--range" : ""}${vertical ? " sia-slider--vertical" : ""}${reverse ? " sia-slider--reverse" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
2900
2924
|
style,
|
|
2901
2925
|
...withTitleTooltip(props),
|
|
@@ -2965,10 +2989,10 @@ function Slider({
|
|
|
2965
2989
|
]
|
|
2966
2990
|
}
|
|
2967
2991
|
);
|
|
2968
|
-
}
|
|
2992
|
+
});
|
|
2969
2993
|
|
|
2970
2994
|
// src/components/ColorPicker.tsx
|
|
2971
|
-
import { useEffect as useEffect7, useRef as useRef12, useState as useState12 } from "react";
|
|
2995
|
+
import { forwardRef as forwardRef9, useEffect as useEffect7, useRef as useRef12, useState as useState12 } from "react";
|
|
2972
2996
|
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2973
2997
|
var DEFAULT_MODES = ["solid", "gradient"];
|
|
2974
2998
|
var gradientStopSeed = 0;
|
|
@@ -3039,7 +3063,7 @@ function createStop(color, position) {
|
|
|
3039
3063
|
function createDefaultStops(color) {
|
|
3040
3064
|
return [createStop(color, 0), createStop("#FFFFFF", 100)];
|
|
3041
3065
|
}
|
|
3042
|
-
|
|
3066
|
+
var ColorPicker = forwardRef9(function ColorPicker2({
|
|
3043
3067
|
size: sizeProp,
|
|
3044
3068
|
value,
|
|
3045
3069
|
defaultValue = "#1677FF",
|
|
@@ -3057,9 +3081,14 @@ function ColorPicker({
|
|
|
3057
3081
|
onModeChange,
|
|
3058
3082
|
onClear,
|
|
3059
3083
|
...props
|
|
3060
|
-
}) {
|
|
3084
|
+
}, forwardedRef) {
|
|
3061
3085
|
const size = useControlSize(sizeProp);
|
|
3062
3086
|
const rootRef = useRef12(null);
|
|
3087
|
+
function setRootRef(node) {
|
|
3088
|
+
rootRef.current = node;
|
|
3089
|
+
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
3090
|
+
else if (forwardedRef) forwardedRef.current = node;
|
|
3091
|
+
}
|
|
3063
3092
|
const popupRef = useRef12(null);
|
|
3064
3093
|
const lastEmittedValue = useRef12();
|
|
3065
3094
|
const initialGradient = parseGradient(value ?? defaultValue);
|
|
@@ -3159,7 +3188,7 @@ function ColorPicker({
|
|
|
3159
3188
|
const triggerBackground = color || "transparent";
|
|
3160
3189
|
const triggerText = color || "\u65E0\u8272";
|
|
3161
3190
|
const opaqueColor = rgbaToHex({ ...rgba, a: 100 }, false);
|
|
3162
|
-
return /* @__PURE__ */ jsxs15("div", { ref:
|
|
3191
|
+
return /* @__PURE__ */ jsxs15("div", { ref: setRootRef, className: `sia-color-picker sia-color-picker--${size}${disabled ? " is-disabled" : ""} ${className}`.trim(), ...withTitleTooltip(props), children: [
|
|
3163
3192
|
/* @__PURE__ */ jsxs15(
|
|
3164
3193
|
"button",
|
|
3165
3194
|
{
|
|
@@ -3281,16 +3310,16 @@ function ColorPicker({
|
|
|
3281
3310
|
] }, index))
|
|
3282
3311
|
] })
|
|
3283
3312
|
] });
|
|
3284
|
-
}
|
|
3313
|
+
});
|
|
3285
3314
|
|
|
3286
3315
|
// src/components/TimePicker.tsx
|
|
3287
|
-
import { useEffect as useEffect8, useId as useId5, useRef as useRef13, useState as useState13 } from "react";
|
|
3316
|
+
import { forwardRef as forwardRef10, useEffect as useEffect8, useId as useId5, useRef as useRef13, useState as useState13 } from "react";
|
|
3288
3317
|
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3289
3318
|
function seconds(value) {
|
|
3290
3319
|
const [h = 0, m = 0, s = 0] = value.split(":").map(Number);
|
|
3291
3320
|
return h * 3600 + m * 60 + s;
|
|
3292
3321
|
}
|
|
3293
|
-
function TimePicker({
|
|
3322
|
+
var TimePickerRoot = forwardRef10(function TimePicker({
|
|
3294
3323
|
value,
|
|
3295
3324
|
defaultValue = "",
|
|
3296
3325
|
size: sizeProp,
|
|
@@ -3312,10 +3341,15 @@ function TimePicker({
|
|
|
3312
3341
|
max,
|
|
3313
3342
|
step,
|
|
3314
3343
|
...props
|
|
3315
|
-
}) {
|
|
3344
|
+
}, forwardedRef) {
|
|
3316
3345
|
const size = useControlSize(sizeProp);
|
|
3317
3346
|
const id = useId5();
|
|
3318
3347
|
const rootRef = useRef13(null);
|
|
3348
|
+
function setRootRef(node) {
|
|
3349
|
+
rootRef.current = node;
|
|
3350
|
+
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
3351
|
+
else if (forwardedRef) forwardedRef.current = node;
|
|
3352
|
+
}
|
|
3319
3353
|
const inputRef = useRef13(null);
|
|
3320
3354
|
const popupRef = useRef13(null);
|
|
3321
3355
|
const focusPanel = useRef13(false);
|
|
@@ -3339,6 +3373,8 @@ function TimePicker({
|
|
|
3339
3373
|
setOpen(next);
|
|
3340
3374
|
onOpenChange?.(next);
|
|
3341
3375
|
}
|
|
3376
|
+
const changeOpenRef = useRef13(changeOpen);
|
|
3377
|
+
changeOpenRef.current = changeOpen;
|
|
3342
3378
|
useEffect8(() => {
|
|
3343
3379
|
if (!open) return;
|
|
3344
3380
|
if (focusPanel.current) {
|
|
@@ -3347,7 +3383,7 @@ function TimePicker({
|
|
|
3347
3383
|
}
|
|
3348
3384
|
const close = (event) => {
|
|
3349
3385
|
const target = event.target;
|
|
3350
|
-
if (!rootRef.current?.contains(target) && !popupRef.current?.contains(target))
|
|
3386
|
+
if (!rootRef.current?.contains(target) && !popupRef.current?.contains(target)) changeOpenRef.current(false);
|
|
3351
3387
|
};
|
|
3352
3388
|
document.addEventListener("pointerdown", close);
|
|
3353
3389
|
document.addEventListener("focusin", close);
|
|
@@ -3355,7 +3391,7 @@ function TimePicker({
|
|
|
3355
3391
|
document.removeEventListener("pointerdown", close);
|
|
3356
3392
|
document.removeEventListener("focusin", close);
|
|
3357
3393
|
};
|
|
3358
|
-
});
|
|
3394
|
+
}, [open]);
|
|
3359
3395
|
const display = !currentValue ? "" : use12Hours ? String(Number(currentValue.slice(0, 2)) % 12 || 12).padStart(2, "0") + normalize(currentValue).slice(2) + (Number(currentValue.slice(0, 2)) < 12 ? " AM" : " PM") : normalize(currentValue);
|
|
3360
3396
|
function confirm() {
|
|
3361
3397
|
if (unavailable(draft)) return;
|
|
@@ -3364,7 +3400,7 @@ function TimePicker({
|
|
|
3364
3400
|
inputRef.current?.focus();
|
|
3365
3401
|
}
|
|
3366
3402
|
const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: Boolean(display), active: open });
|
|
3367
|
-
return /* @__PURE__ */ jsxs16("span", { ref:
|
|
3403
|
+
return /* @__PURE__ */ jsxs16("span", { ref: setRootRef, style, className: `sia-picker sia-time-picker${floating.className} sia-picker--${size} sia-picker--${status}${disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
3368
3404
|
/* @__PURE__ */ jsx17(
|
|
3369
3405
|
"input",
|
|
3370
3406
|
{
|
|
@@ -3438,8 +3474,8 @@ function TimePicker({
|
|
|
3438
3474
|
}
|
|
3439
3475
|
)
|
|
3440
3476
|
] });
|
|
3441
|
-
}
|
|
3442
|
-
|
|
3477
|
+
});
|
|
3478
|
+
var TimeRangePicker = forwardRef10(function TimeRangePicker2({ value, defaultValue = ["", ""], placeholder = ["\u5F00\u59CB\u65F6\u95F4", "\u7ED3\u675F\u65F6\u95F4"], separator = "\u2192", onChange, className = "", style, ...props }, forwardedRef) {
|
|
3443
3479
|
const size = useControlSize(props.size);
|
|
3444
3480
|
const [currentValue, setValue2] = useControllableState({ value: value === void 0 ? void 0 : Array.isArray(value) ? value : ["", ""], defaultValue, onChange });
|
|
3445
3481
|
function update(index, next) {
|
|
@@ -3447,18 +3483,19 @@ function TimeRangePicker({ value, defaultValue = ["", ""], placeholder = ["\u5F0
|
|
|
3447
3483
|
pair[index] = next;
|
|
3448
3484
|
setValue2(pair);
|
|
3449
3485
|
}
|
|
3450
|
-
return /* @__PURE__ */ jsxs16("span", { style, className: `sia-time-range sia-picker--${size} sia-picker--${props.status ?? "default"}${props.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
3451
|
-
/* @__PURE__ */ jsx17(
|
|
3486
|
+
return /* @__PURE__ */ jsxs16("span", { ref: forwardedRef, style, className: `sia-time-range sia-picker--${size} sia-picker--${props.status ?? "default"}${props.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
3487
|
+
/* @__PURE__ */ jsx17(TimePickerRoot, { ...props, "aria-label": props["aria-label"] ? props["aria-label"] + "\u5F00\u59CB\u65F6\u95F4" : "\u5F00\u59CB\u65F6\u95F4", value: currentValue[0], placeholder: placeholder[0], max: currentValue[1] && (!props.max || seconds(currentValue[1]) < seconds(String(props.max))) ? currentValue[1] : props.max, onChange: (next) => update(0, next) }),
|
|
3452
3488
|
/* @__PURE__ */ jsx17("span", { className: "sia-time-range__separator", children: separator }),
|
|
3453
|
-
/* @__PURE__ */ jsx17(
|
|
3489
|
+
/* @__PURE__ */ jsx17(TimePickerRoot, { ...props, id: props.id ? props.id + "-end" : void 0, "aria-label": props["aria-label"] ? props["aria-label"] + "\u7ED3\u675F\u65F6\u95F4" : "\u7ED3\u675F\u65F6\u95F4", value: currentValue[1], placeholder: placeholder[1], min: currentValue[0] && (!props.min || seconds(currentValue[0]) > seconds(String(props.min))) ? currentValue[0] : props.min, onChange: (next) => update(1, next) })
|
|
3454
3490
|
] });
|
|
3455
|
-
}
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3491
|
+
});
|
|
3492
|
+
var TimePicker2 = Object.assign(TimePickerRoot, {
|
|
3493
|
+
/** 时间区间选择器。 */
|
|
3494
|
+
RangePicker: TimeRangePicker
|
|
3495
|
+
});
|
|
3459
3496
|
|
|
3460
3497
|
// src/components/TreeSelect.tsx
|
|
3461
|
-
import { useEffect as useEffect9, useMemo as useMemo6, useRef as useRef14, useState as useState14 } from "react";
|
|
3498
|
+
import { forwardRef as forwardRef11, useEffect as useEffect9, useMemo as useMemo6, useRef as useRef14, useState as useState14 } from "react";
|
|
3462
3499
|
import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3463
3500
|
function flattenTree(nodes, expanded, search, filter, depth = 0, parents = [], ancestorMatched = false) {
|
|
3464
3501
|
const result = [];
|
|
@@ -3479,7 +3516,7 @@ function findNodes(nodes, values, result = []) {
|
|
|
3479
3516
|
}
|
|
3480
3517
|
return result;
|
|
3481
3518
|
}
|
|
3482
|
-
|
|
3519
|
+
var TreeSelect = forwardRef11(function TreeSelect2({
|
|
3483
3520
|
treeData,
|
|
3484
3521
|
value,
|
|
3485
3522
|
defaultValue,
|
|
@@ -3519,9 +3556,14 @@ function TreeSelect({
|
|
|
3519
3556
|
onSelect,
|
|
3520
3557
|
onDeselect,
|
|
3521
3558
|
...props
|
|
3522
|
-
}) {
|
|
3559
|
+
}, forwardedRef) {
|
|
3523
3560
|
const size = useControlSize(sizeProp);
|
|
3524
3561
|
const rootRef = useRef14(null);
|
|
3562
|
+
function setRootRef(node) {
|
|
3563
|
+
rootRef.current = node;
|
|
3564
|
+
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
3565
|
+
else if (forwardedRef) forwardedRef.current = node;
|
|
3566
|
+
}
|
|
3525
3567
|
const popupRef = useRef14(null);
|
|
3526
3568
|
const nodeIndex = useMemo6(() => {
|
|
3527
3569
|
const index = /* @__PURE__ */ new Map();
|
|
@@ -3673,7 +3715,7 @@ function TreeSelect({
|
|
|
3673
3715
|
return /* @__PURE__ */ jsxs17(
|
|
3674
3716
|
"div",
|
|
3675
3717
|
{
|
|
3676
|
-
ref:
|
|
3718
|
+
ref: setRootRef,
|
|
3677
3719
|
className: `sia-tree-select sia-tree-select--${size} sia-tree-select--${status}${open ? " is-open" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
3678
3720
|
...withTitleTooltip(props),
|
|
3679
3721
|
onKeyDown: (event) => {
|
|
@@ -3745,7 +3787,7 @@ function TreeSelect({
|
|
|
3745
3787
|
]
|
|
3746
3788
|
}
|
|
3747
3789
|
);
|
|
3748
|
-
}
|
|
3790
|
+
});
|
|
3749
3791
|
|
|
3750
3792
|
// src/components/flatTree.ts
|
|
3751
3793
|
function buildFlatTree(items, options = {}) {
|
|
@@ -5452,13 +5494,13 @@ function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", r
|
|
|
5452
5494
|
}
|
|
5453
5495
|
|
|
5454
5496
|
// src/components/InputNumber.tsx
|
|
5455
|
-
import { forwardRef as
|
|
5497
|
+
import { forwardRef as forwardRef12, useEffect as useEffect13, useId as useId7, useRef as useRef18, useState as useState18 } from "react";
|
|
5456
5498
|
import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5457
5499
|
function formatValue(value, precision) {
|
|
5458
5500
|
if (value === null || !Number.isFinite(value)) return "";
|
|
5459
5501
|
return precision === void 0 ? String(value) : value.toFixed(precision);
|
|
5460
5502
|
}
|
|
5461
|
-
var InputNumber =
|
|
5503
|
+
var InputNumber = forwardRef12(function InputNumber2({
|
|
5462
5504
|
value,
|
|
5463
5505
|
defaultValue = null,
|
|
5464
5506
|
onChange,
|
|
@@ -6742,130 +6784,10 @@ function playCellFocusGlow(cell, isVisible, onFinish, options) {
|
|
|
6742
6784
|
}
|
|
6743
6785
|
|
|
6744
6786
|
// src/components/Table/Table.tsx
|
|
6745
|
-
import { Fragment as
|
|
6787
|
+
import { Fragment as Fragment12, forwardRef as forwardRef13, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as useEffect19, useImperativeHandle, useMemo as useMemo10, useRef as useRef27, useState as useState27 } from "react";
|
|
6746
6788
|
import { flushSync } from "react-dom";
|
|
6747
6789
|
|
|
6748
|
-
// src/components/Table/plugins.tsx
|
|
6749
|
-
import { isValidElement as isValidElement3, useEffect as useEffect16, useRef as useRef23, useState as useState23 } from "react";
|
|
6750
|
-
|
|
6751
|
-
// src/components/Table/columnSettings.ts
|
|
6752
|
-
function reconcileColumnSettings(columns, defaults, saved) {
|
|
6753
|
-
const stored = new Map(saved.map((item) => [item.key, item]));
|
|
6754
|
-
const base = new Map(defaults.map((item) => [item.key, item]));
|
|
6755
|
-
const result = [];
|
|
6756
|
-
const rank = (column) => {
|
|
6757
|
-
const own = stored.get(column.key)?.order;
|
|
6758
|
-
if (own !== void 0) return own;
|
|
6759
|
-
const children = column.children?.map(rank).filter((value) => value !== void 0);
|
|
6760
|
-
return children?.length ? Math.min(...children) : void 0;
|
|
6761
|
-
};
|
|
6762
|
-
const walk = (source, parent) => {
|
|
6763
|
-
const entries = source.map((column, index) => ({ column, index, rank: rank(column) }));
|
|
6764
|
-
let anchor = -1;
|
|
6765
|
-
for (const entry of entries) {
|
|
6766
|
-
if (entry.rank !== void 0) anchor = entry.rank;
|
|
6767
|
-
else entry.rank = anchor + (entry.index + 1) / (entries.length + 1);
|
|
6768
|
-
}
|
|
6769
|
-
entries.sort((a, b) => a.rank - b.rank || a.index - b.index);
|
|
6770
|
-
for (const { column } of entries) {
|
|
6771
|
-
const own = stored.get(column.key);
|
|
6772
|
-
if (column.children?.length) {
|
|
6773
|
-
walk(column.children, own ?? parent);
|
|
6774
|
-
} else {
|
|
6775
|
-
const fallback = base.get(column.key);
|
|
6776
|
-
if (!fallback) continue;
|
|
6777
|
-
const item = own ?? {
|
|
6778
|
-
...fallback,
|
|
6779
|
-
fixed: parent?.fixed ?? fallback.fixed,
|
|
6780
|
-
visible: fallback.visible && (parent?.visible ?? true)
|
|
6781
|
-
};
|
|
6782
|
-
result.push({ ...item, order: result.length });
|
|
6783
|
-
}
|
|
6784
|
-
}
|
|
6785
|
-
};
|
|
6786
|
-
walk(columns);
|
|
6787
|
-
return result;
|
|
6788
|
-
}
|
|
6789
|
-
function mergeColumnSettings(columns, saved, active) {
|
|
6790
|
-
const merged = new Map(saved.filter((item) => !["__index__", "__selection__"].includes(item.key)).map((item) => [item.key, item]));
|
|
6791
|
-
active.forEach((item) => merged.set(item.key, item));
|
|
6792
|
-
const current = new Map(active.map((item) => [item.key, item]));
|
|
6793
|
-
const walk = (column) => {
|
|
6794
|
-
if (!column.children?.length) return current.has(column.key) ? [current.get(column.key)] : [];
|
|
6795
|
-
const leaves = column.children.flatMap(walk);
|
|
6796
|
-
if (leaves.length) {
|
|
6797
|
-
const old = merged.get(column.key);
|
|
6798
|
-
merged.set(column.key, {
|
|
6799
|
-
key: column.key,
|
|
6800
|
-
width: old?.width ?? column.width,
|
|
6801
|
-
fixed: old?.fixed,
|
|
6802
|
-
visible: leaves.some((item) => item.visible),
|
|
6803
|
-
order: Math.min(...leaves.map((item) => item.order))
|
|
6804
|
-
});
|
|
6805
|
-
}
|
|
6806
|
-
return leaves;
|
|
6807
|
-
};
|
|
6808
|
-
columns.forEach(walk);
|
|
6809
|
-
return [...merged.values()].sort((left, right) => left.order - right.order);
|
|
6810
|
-
}
|
|
6811
|
-
|
|
6812
|
-
// src/components/settingsPersistence.ts
|
|
6813
|
-
var queues = /* @__PURE__ */ new WeakMap();
|
|
6814
|
-
function saveSettingsPatch(adapter, scope, patch) {
|
|
6815
|
-
let scoped = queues.get(adapter);
|
|
6816
|
-
if (!scoped) {
|
|
6817
|
-
scoped = /* @__PURE__ */ new Map();
|
|
6818
|
-
queues.set(adapter, scoped);
|
|
6819
|
-
}
|
|
6820
|
-
const key = JSON.stringify([scope.moduleName, scope.businessKey]);
|
|
6821
|
-
const previous = scoped.get(key) ?? Promise.resolve();
|
|
6822
|
-
const task = previous.catch(() => void 0).then(async () => {
|
|
6823
|
-
const current = await adapter.load(scope);
|
|
6824
|
-
const defined = Object.fromEntries(Object.entries(patch).filter(([, value]) => value !== void 0));
|
|
6825
|
-
await adapter.save(scope, { ...current, ...defined });
|
|
6826
|
-
});
|
|
6827
|
-
scoped.set(key, task);
|
|
6828
|
-
const cleanup = () => {
|
|
6829
|
-
if (scoped.get(key) === task) scoped.delete(key);
|
|
6830
|
-
};
|
|
6831
|
-
void task.then(cleanup, cleanup);
|
|
6832
|
-
return task;
|
|
6833
|
-
}
|
|
6834
|
-
|
|
6835
|
-
// src/components/Table/plugins.tsx
|
|
6836
|
-
import { Fragment as Fragment8, jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6837
|
-
function TableCheckbox({
|
|
6838
|
-
checked,
|
|
6839
|
-
indeterminate,
|
|
6840
|
-
disabled,
|
|
6841
|
-
label,
|
|
6842
|
-
onChange
|
|
6843
|
-
}) {
|
|
6844
|
-
return /* @__PURE__ */ jsx28(
|
|
6845
|
-
Checkbox,
|
|
6846
|
-
{
|
|
6847
|
-
className: "sia-table__checkbox",
|
|
6848
|
-
"aria-label": label,
|
|
6849
|
-
checked,
|
|
6850
|
-
indeterminate,
|
|
6851
|
-
disabled,
|
|
6852
|
-
onClick: (event) => event.stopPropagation(),
|
|
6853
|
-
onChange
|
|
6854
|
-
}
|
|
6855
|
-
);
|
|
6856
|
-
}
|
|
6857
|
-
function flattenRecords(data, childrenColumnName) {
|
|
6858
|
-
const result = [];
|
|
6859
|
-
const walk = (records) => {
|
|
6860
|
-
for (const record of records) {
|
|
6861
|
-
result.push(record);
|
|
6862
|
-
const children = record[childrenColumnName];
|
|
6863
|
-
if (Array.isArray(children)) walk(children);
|
|
6864
|
-
}
|
|
6865
|
-
};
|
|
6866
|
-
walk(data);
|
|
6867
|
-
return result;
|
|
6868
|
-
}
|
|
6790
|
+
// src/components/Table/plugins/layout.tsx
|
|
6869
6791
|
function createColumnTransformPlugin(options) {
|
|
6870
6792
|
return {
|
|
6871
6793
|
id: "columnTransform",
|
|
@@ -6922,18 +6844,154 @@ function createHighlightPlugin(options = { row: true }) {
|
|
|
6922
6844
|
}
|
|
6923
6845
|
};
|
|
6924
6846
|
}
|
|
6925
|
-
|
|
6926
|
-
|
|
6847
|
+
var ROW_SPAN_META_KEY = "__siaTableRowSpan";
|
|
6848
|
+
function getRowSpanGroupValue(column, record, index, records) {
|
|
6849
|
+
const config = column.rowSpan;
|
|
6850
|
+
if (typeof config === "function") return config(record, index, records);
|
|
6851
|
+
const dataIndex = typeof config === "boolean" || config === void 0 ? column.dataIndex : config;
|
|
6852
|
+
return getTableValue(record, dataIndex, column.code ?? column.key);
|
|
6927
6853
|
}
|
|
6928
|
-
function
|
|
6929
|
-
return
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6854
|
+
function createRowSpanPlugin(options = {}) {
|
|
6855
|
+
return {
|
|
6856
|
+
id: "rowSpan",
|
|
6857
|
+
order: 65,
|
|
6858
|
+
disableVirtual: options.disableVirtual ?? true,
|
|
6859
|
+
transformRows(rows, context) {
|
|
6860
|
+
const configured = flattenTableColumns(context.columns).filter(
|
|
6861
|
+
(column) => column.rowSpan && (!options.columns || options.columns.includes(column.key))
|
|
6862
|
+
);
|
|
6863
|
+
if (configured.length === 0 || rows.length === 0) return rows;
|
|
6864
|
+
const records = rows.map((row) => row.record);
|
|
6865
|
+
const nextRows = rows.map((row) => ({
|
|
6866
|
+
...row,
|
|
6867
|
+
meta: { ...row.meta, [ROW_SPAN_META_KEY]: {} }
|
|
6868
|
+
}));
|
|
6869
|
+
for (const column of configured) {
|
|
6870
|
+
let start = 0;
|
|
6871
|
+
while (start < rows.length) {
|
|
6872
|
+
const value = getRowSpanGroupValue(
|
|
6873
|
+
column,
|
|
6874
|
+
rows[start].record,
|
|
6875
|
+
start,
|
|
6876
|
+
records
|
|
6877
|
+
);
|
|
6878
|
+
let end = start + 1;
|
|
6879
|
+
while (end < rows.length) {
|
|
6880
|
+
const nextValue = getRowSpanGroupValue(
|
|
6881
|
+
column,
|
|
6882
|
+
rows[end].record,
|
|
6883
|
+
end,
|
|
6884
|
+
records
|
|
6885
|
+
);
|
|
6886
|
+
const equal = options.equals?.(value, nextValue, column) ?? Object.is(value, nextValue);
|
|
6887
|
+
if (!equal) break;
|
|
6888
|
+
end += 1;
|
|
6889
|
+
}
|
|
6890
|
+
const span = end - start;
|
|
6891
|
+
const firstMeta = nextRows[start].meta[ROW_SPAN_META_KEY];
|
|
6892
|
+
firstMeta[column.key] = { rowSpan: span };
|
|
6893
|
+
for (let index = start + 1; index < end; index += 1) {
|
|
6894
|
+
const meta = nextRows[index].meta[ROW_SPAN_META_KEY];
|
|
6895
|
+
meta[column.key] = { hidden: true };
|
|
6896
|
+
}
|
|
6897
|
+
start = end;
|
|
6898
|
+
}
|
|
6899
|
+
}
|
|
6900
|
+
return nextRows;
|
|
6901
|
+
},
|
|
6902
|
+
getCellProps(row, column, context) {
|
|
6903
|
+
const meta = row.meta[ROW_SPAN_META_KEY];
|
|
6904
|
+
const cell = meta?.[column.key];
|
|
6905
|
+
if (!cell?.rowSpan || cell.rowSpan <= 1) return cell;
|
|
6906
|
+
const sticky = column.mergeSticky;
|
|
6907
|
+
if (!sticky) return { ...cell, className: "sia-table__cell--row-span" };
|
|
6908
|
+
const config = typeof sticky === "object" ? sticky : {};
|
|
6909
|
+
const records = context.rows.map((item) => item.record);
|
|
6910
|
+
return {
|
|
6911
|
+
...cell,
|
|
6912
|
+
className: [
|
|
6913
|
+
"sia-table__cell--row-span",
|
|
6914
|
+
"sia-table__cell--merge-sticky",
|
|
6915
|
+
config.className
|
|
6916
|
+
].filter(Boolean).join(" "),
|
|
6917
|
+
style: {
|
|
6918
|
+
...config.style,
|
|
6919
|
+
textAlign: config.align,
|
|
6920
|
+
"--sia-table-merge-sticky-inset": `${config.inset ?? 0}px`,
|
|
6921
|
+
"--sia-table-merge-sticky-z-index": config.zIndex ?? 3
|
|
6922
|
+
},
|
|
6923
|
+
content: config.getValue?.(row.record, row.sourceIndex, records)
|
|
6924
|
+
};
|
|
6925
|
+
}
|
|
6926
|
+
};
|
|
6934
6927
|
}
|
|
6935
|
-
|
|
6936
|
-
|
|
6928
|
+
|
|
6929
|
+
// src/components/Table/plugins/shared.tsx
|
|
6930
|
+
import { isValidElement as isValidElement3 } from "react";
|
|
6931
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
6932
|
+
function TableCheckbox({
|
|
6933
|
+
checked,
|
|
6934
|
+
indeterminate,
|
|
6935
|
+
disabled,
|
|
6936
|
+
label,
|
|
6937
|
+
onChange
|
|
6938
|
+
}) {
|
|
6939
|
+
return /* @__PURE__ */ jsx28(
|
|
6940
|
+
Checkbox,
|
|
6941
|
+
{
|
|
6942
|
+
className: "sia-table__checkbox",
|
|
6943
|
+
"aria-label": label,
|
|
6944
|
+
checked,
|
|
6945
|
+
indeterminate,
|
|
6946
|
+
disabled,
|
|
6947
|
+
onClick: (event) => event.stopPropagation(),
|
|
6948
|
+
onChange
|
|
6949
|
+
}
|
|
6950
|
+
);
|
|
6951
|
+
}
|
|
6952
|
+
function flattenRecords(data, childrenColumnName) {
|
|
6953
|
+
const result = [];
|
|
6954
|
+
const walk = (records) => {
|
|
6955
|
+
for (const record of records) {
|
|
6956
|
+
result.push(record);
|
|
6957
|
+
const children = record[childrenColumnName];
|
|
6958
|
+
if (Array.isArray(children)) walk(children);
|
|
6959
|
+
}
|
|
6960
|
+
};
|
|
6961
|
+
walk(data);
|
|
6962
|
+
return result;
|
|
6963
|
+
}
|
|
6964
|
+
function tableExportText(node) {
|
|
6965
|
+
if (node === null || node === void 0 || typeof node === "boolean")
|
|
6966
|
+
return "";
|
|
6967
|
+
if (typeof node === "string" || typeof node === "number" || typeof node === "bigint")
|
|
6968
|
+
return String(node);
|
|
6969
|
+
if (Array.isArray(node)) return node.map(tableExportText).join("");
|
|
6970
|
+
if (isValidElement3(node))
|
|
6971
|
+
return tableExportText(node.props.children);
|
|
6972
|
+
return "";
|
|
6973
|
+
}
|
|
6974
|
+
function tableExportCell(value, sanitizeFormula) {
|
|
6975
|
+
const text = value === null || value === void 0 ? "" : typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
6976
|
+
return sanitizeFormula && /^[=+\-@]/.test(text) ? `'${text}` : text;
|
|
6977
|
+
}
|
|
6978
|
+
function tableExportEscape(value, delimiter) {
|
|
6979
|
+
return value.includes(delimiter) || /["\r\n]/.test(value) ? `"${value.replace(/"/g, '""')}"` : value;
|
|
6980
|
+
}
|
|
6981
|
+
|
|
6982
|
+
// src/components/Table/plugins/cellSelection.tsx
|
|
6983
|
+
function sameCellAddress(left, right) {
|
|
6984
|
+
return Object.is(left.rowKey, right.rowKey) && left.columnKey === right.columnKey;
|
|
6985
|
+
}
|
|
6986
|
+
function isInteractiveTableTarget(target) {
|
|
6987
|
+
return target instanceof Element && Boolean(
|
|
6988
|
+
target.closest(
|
|
6989
|
+
"button, input, textarea, select, a, [contenteditable='true'], [role='button'], [role='separator']"
|
|
6990
|
+
)
|
|
6991
|
+
);
|
|
6992
|
+
}
|
|
6993
|
+
function createCellSelectionPlugin(options = {}) {
|
|
6994
|
+
let dragMode = null;
|
|
6937
6995
|
let dragAnchor = null;
|
|
6938
6996
|
let textCell = null;
|
|
6939
6997
|
let headerDragAnchorKey = null;
|
|
@@ -7370,87 +7428,10 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
7370
7428
|
})
|
|
7371
7429
|
};
|
|
7372
7430
|
}
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
const dataIndex = typeof config === "boolean" || config === void 0 ? column.dataIndex : config;
|
|
7378
|
-
return getTableValue(record, dataIndex, column.code ?? column.key);
|
|
7379
|
-
}
|
|
7380
|
-
function createRowSpanPlugin(options = {}) {
|
|
7381
|
-
return {
|
|
7382
|
-
id: "rowSpan",
|
|
7383
|
-
order: 65,
|
|
7384
|
-
disableVirtual: options.disableVirtual ?? true,
|
|
7385
|
-
transformRows(rows, context) {
|
|
7386
|
-
const configured = flattenTableColumns(context.columns).filter(
|
|
7387
|
-
(column) => column.rowSpan && (!options.columns || options.columns.includes(column.key))
|
|
7388
|
-
);
|
|
7389
|
-
if (configured.length === 0 || rows.length === 0) return rows;
|
|
7390
|
-
const records = rows.map((row) => row.record);
|
|
7391
|
-
const nextRows = rows.map((row) => ({
|
|
7392
|
-
...row,
|
|
7393
|
-
meta: { ...row.meta, [ROW_SPAN_META_KEY]: {} }
|
|
7394
|
-
}));
|
|
7395
|
-
for (const column of configured) {
|
|
7396
|
-
let start = 0;
|
|
7397
|
-
while (start < rows.length) {
|
|
7398
|
-
const value = getRowSpanGroupValue(
|
|
7399
|
-
column,
|
|
7400
|
-
rows[start].record,
|
|
7401
|
-
start,
|
|
7402
|
-
records
|
|
7403
|
-
);
|
|
7404
|
-
let end = start + 1;
|
|
7405
|
-
while (end < rows.length) {
|
|
7406
|
-
const nextValue = getRowSpanGroupValue(
|
|
7407
|
-
column,
|
|
7408
|
-
rows[end].record,
|
|
7409
|
-
end,
|
|
7410
|
-
records
|
|
7411
|
-
);
|
|
7412
|
-
const equal = options.equals?.(value, nextValue, column) ?? Object.is(value, nextValue);
|
|
7413
|
-
if (!equal) break;
|
|
7414
|
-
end += 1;
|
|
7415
|
-
}
|
|
7416
|
-
const span = end - start;
|
|
7417
|
-
const firstMeta = nextRows[start].meta[ROW_SPAN_META_KEY];
|
|
7418
|
-
firstMeta[column.key] = { rowSpan: span };
|
|
7419
|
-
for (let index = start + 1; index < end; index += 1) {
|
|
7420
|
-
const meta = nextRows[index].meta[ROW_SPAN_META_KEY];
|
|
7421
|
-
meta[column.key] = { hidden: true };
|
|
7422
|
-
}
|
|
7423
|
-
start = end;
|
|
7424
|
-
}
|
|
7425
|
-
}
|
|
7426
|
-
return nextRows;
|
|
7427
|
-
},
|
|
7428
|
-
getCellProps(row, column, context) {
|
|
7429
|
-
const meta = row.meta[ROW_SPAN_META_KEY];
|
|
7430
|
-
const cell = meta?.[column.key];
|
|
7431
|
-
if (!cell?.rowSpan || cell.rowSpan <= 1) return cell;
|
|
7432
|
-
const sticky = column.mergeSticky;
|
|
7433
|
-
if (!sticky) return { ...cell, className: "sia-table__cell--row-span" };
|
|
7434
|
-
const config = typeof sticky === "object" ? sticky : {};
|
|
7435
|
-
const records = context.rows.map((item) => item.record);
|
|
7436
|
-
return {
|
|
7437
|
-
...cell,
|
|
7438
|
-
className: [
|
|
7439
|
-
"sia-table__cell--row-span",
|
|
7440
|
-
"sia-table__cell--merge-sticky",
|
|
7441
|
-
config.className
|
|
7442
|
-
].filter(Boolean).join(" "),
|
|
7443
|
-
style: {
|
|
7444
|
-
...config.style,
|
|
7445
|
-
textAlign: config.align,
|
|
7446
|
-
"--sia-table-merge-sticky-inset": `${config.inset ?? 0}px`,
|
|
7447
|
-
"--sia-table-merge-sticky-z-index": config.zIndex ?? 3
|
|
7448
|
-
},
|
|
7449
|
-
content: config.getValue?.(row.record, row.sourceIndex, records)
|
|
7450
|
-
};
|
|
7451
|
-
}
|
|
7452
|
-
};
|
|
7453
|
-
}
|
|
7431
|
+
|
|
7432
|
+
// src/components/Table/plugins/selection.tsx
|
|
7433
|
+
import { useState as useState23 } from "react";
|
|
7434
|
+
import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
7454
7435
|
function TableSelectedItemsPanel({
|
|
7455
7436
|
entries,
|
|
7456
7437
|
columns,
|
|
@@ -7469,10 +7450,10 @@ function TableSelectedItemsPanel({
|
|
|
7469
7450
|
/* @__PURE__ */ jsxs24("div", { className: "sia-table-selection-panel__header", children: [
|
|
7470
7451
|
/* @__PURE__ */ jsxs24("strong", { children: [
|
|
7471
7452
|
"\u5DF2\u9009 ",
|
|
7472
|
-
/* @__PURE__ */
|
|
7453
|
+
/* @__PURE__ */ jsx29("span", { children: entries.length }),
|
|
7473
7454
|
" \u9879"
|
|
7474
7455
|
] }),
|
|
7475
|
-
/* @__PURE__ */
|
|
7456
|
+
/* @__PURE__ */ jsx29(
|
|
7476
7457
|
Button,
|
|
7477
7458
|
{
|
|
7478
7459
|
size: "small",
|
|
@@ -7483,15 +7464,15 @@ function TableSelectedItemsPanel({
|
|
|
7483
7464
|
}
|
|
7484
7465
|
)
|
|
7485
7466
|
] }),
|
|
7486
|
-
/* @__PURE__ */
|
|
7487
|
-
/* @__PURE__ */
|
|
7488
|
-
columns.map((column) => /* @__PURE__ */
|
|
7489
|
-
/* @__PURE__ */
|
|
7467
|
+
/* @__PURE__ */ jsx29("div", { className: "sia-table-selection-panel__body", children: /* @__PURE__ */ jsxs24("table", { children: [
|
|
7468
|
+
/* @__PURE__ */ jsx29("thead", { children: /* @__PURE__ */ jsxs24("tr", { children: [
|
|
7469
|
+
columns.map((column) => /* @__PURE__ */ jsx29("th", { children: getColumnLabel(column) }, column.key)),
|
|
7470
|
+
/* @__PURE__ */ jsx29("th", { "aria-label": "\u64CD\u4F5C" })
|
|
7490
7471
|
] }) }),
|
|
7491
|
-
/* @__PURE__ */
|
|
7472
|
+
/* @__PURE__ */ jsx29("tbody", { children: visibleEntries.map((entry, selectedIndex) => /* @__PURE__ */ jsxs24("tr", { children: [
|
|
7492
7473
|
columns.map((column) => {
|
|
7493
7474
|
if (column.meta?.plugin === "index")
|
|
7494
|
-
return /* @__PURE__ */
|
|
7475
|
+
return /* @__PURE__ */ jsx29("td", { children: entry.sourceIndex + 1 }, column.key);
|
|
7495
7476
|
const baseColumn = baseColumnMap.get(column.key) ?? column;
|
|
7496
7477
|
const value = getTableValue(
|
|
7497
7478
|
entry.record,
|
|
@@ -7511,9 +7492,9 @@ function TableSelectedItemsPanel({
|
|
|
7511
7492
|
entry.sourceIndex,
|
|
7512
7493
|
{ row, rowIndex: entry.sourceIndex, column: baseColumn }
|
|
7513
7494
|
) ?? value;
|
|
7514
|
-
return /* @__PURE__ */
|
|
7495
|
+
return /* @__PURE__ */ jsx29("td", { children: content }, column.key);
|
|
7515
7496
|
}),
|
|
7516
|
-
/* @__PURE__ */
|
|
7497
|
+
/* @__PURE__ */ jsx29("td", { children: /* @__PURE__ */ jsx29(
|
|
7517
7498
|
Button,
|
|
7518
7499
|
{
|
|
7519
7500
|
size: "small",
|
|
@@ -7528,7 +7509,7 @@ function TableSelectedItemsPanel({
|
|
|
7528
7509
|
"\u8FD8\u6709 ",
|
|
7529
7510
|
hiddenCount,
|
|
7530
7511
|
" \u9879\u672A\u5C55\u793A",
|
|
7531
|
-
/* @__PURE__ */
|
|
7512
|
+
/* @__PURE__ */ jsx29(Button, { size: "small", variant: "link", onClick: () => setShowAll(true), children: "\u5C55\u793A\u5168\u90E8" })
|
|
7532
7513
|
] }) : null
|
|
7533
7514
|
] });
|
|
7534
7515
|
}
|
|
@@ -7649,7 +7630,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7649
7630
|
const keys = selected(context);
|
|
7650
7631
|
const allChecked = enabledRows.length > 0 && enabledRows.every((row) => keys.includes(row.key));
|
|
7651
7632
|
const someChecked = enabledRows.some((row) => keys.includes(row.key));
|
|
7652
|
-
return /* @__PURE__ */
|
|
7633
|
+
return /* @__PURE__ */ jsx29(
|
|
7653
7634
|
TableCheckbox,
|
|
7654
7635
|
{
|
|
7655
7636
|
label: "\u9009\u62E9\u5F53\u524D\u9875\u5168\u90E8\u884C",
|
|
@@ -7665,7 +7646,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7665
7646
|
}
|
|
7666
7647
|
);
|
|
7667
7648
|
},
|
|
7668
|
-
render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */
|
|
7649
|
+
render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */ jsx29(
|
|
7669
7650
|
Radio2,
|
|
7670
7651
|
{
|
|
7671
7652
|
className: "sia-table__checkbox",
|
|
@@ -7676,7 +7657,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7676
7657
|
onClick: (event) => event.stopPropagation(),
|
|
7677
7658
|
onChange: () => toggle(info.row.key, record, context)
|
|
7678
7659
|
}
|
|
7679
|
-
) : /* @__PURE__ */
|
|
7660
|
+
) : /* @__PURE__ */ jsx29(
|
|
7680
7661
|
TableCheckbox,
|
|
7681
7662
|
{
|
|
7682
7663
|
label: `\u9009\u62E9\u7B2C ${info.rowIndex + 1} \u884C`,
|
|
@@ -7717,7 +7698,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7717
7698
|
(column) => !column.hidden && column.meta?.plugin !== "selection"
|
|
7718
7699
|
).slice(0, Math.max(1, options.selectionPanelColumnCount ?? 4));
|
|
7719
7700
|
return /* @__PURE__ */ jsxs24("span", { className: "sia-table__selection-footer", children: [
|
|
7720
|
-
/* @__PURE__ */
|
|
7701
|
+
/* @__PURE__ */ jsx29(
|
|
7721
7702
|
Popover,
|
|
7722
7703
|
{
|
|
7723
7704
|
placement: "top-start",
|
|
@@ -7725,7 +7706,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7725
7706
|
open: context.state.panelOpen && entries.length > 0,
|
|
7726
7707
|
onOpenChange: (panelOpen) => context.setState((state) => ({ ...state, panelOpen })),
|
|
7727
7708
|
overlayClassName: "sia-table-selection-popover",
|
|
7728
|
-
content: /* @__PURE__ */
|
|
7709
|
+
content: /* @__PURE__ */ jsx29(
|
|
7729
7710
|
TableSelectedItemsPanel,
|
|
7730
7711
|
{
|
|
7731
7712
|
entries,
|
|
@@ -7757,7 +7738,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7757
7738
|
)
|
|
7758
7739
|
}
|
|
7759
7740
|
),
|
|
7760
|
-
mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */
|
|
7741
|
+
mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */ jsx29(
|
|
7761
7742
|
Checkbox,
|
|
7762
7743
|
{
|
|
7763
7744
|
checked: preserving(context),
|
|
@@ -7786,6 +7767,10 @@ function createSelectionPlugin(options = {}) {
|
|
|
7786
7767
|
}
|
|
7787
7768
|
};
|
|
7788
7769
|
}
|
|
7770
|
+
|
|
7771
|
+
// src/components/Table/plugins/query.tsx
|
|
7772
|
+
import { useEffect as useEffect16, useState as useState24 } from "react";
|
|
7773
|
+
import { Fragment as Fragment8, jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
7789
7774
|
function createSortPlugin(options = {}) {
|
|
7790
7775
|
const mode = options.mode ?? "local";
|
|
7791
7776
|
const scope = options.scope ?? "all";
|
|
@@ -7814,9 +7799,9 @@ function createSortPlugin(options = {}) {
|
|
|
7814
7799
|
const info = current(context);
|
|
7815
7800
|
const order = info?.field === field ? info.order : null;
|
|
7816
7801
|
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"}`;
|
|
7817
|
-
return /* @__PURE__ */
|
|
7818
|
-
/* @__PURE__ */
|
|
7819
|
-
/* @__PURE__ */
|
|
7802
|
+
return /* @__PURE__ */ jsxs25("span", { className: "sia-table__sortable-header", children: [
|
|
7803
|
+
/* @__PURE__ */ jsx30("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
|
|
7804
|
+
/* @__PURE__ */ jsx30(
|
|
7820
7805
|
"button",
|
|
7821
7806
|
{
|
|
7822
7807
|
type: "button",
|
|
@@ -7828,9 +7813,9 @@ function createSortPlugin(options = {}) {
|
|
|
7828
7813
|
event.stopPropagation();
|
|
7829
7814
|
cycle(field, context);
|
|
7830
7815
|
},
|
|
7831
|
-
children: order ? /* @__PURE__ */
|
|
7832
|
-
/* @__PURE__ */
|
|
7833
|
-
/* @__PURE__ */
|
|
7816
|
+
children: order ? /* @__PURE__ */ jsx30(Icon, { name: order === "ascend" ? "chevron-up" : "chevron-down", size: 18 }) : /* @__PURE__ */ jsxs25(Fragment8, { children: [
|
|
7817
|
+
/* @__PURE__ */ jsx30(Icon, { name: "chevron-up", size: 11 }),
|
|
7818
|
+
/* @__PURE__ */ jsx30(Icon, { name: "chevron-down", size: 11 })
|
|
7834
7819
|
] })
|
|
7835
7820
|
}
|
|
7836
7821
|
)
|
|
@@ -7865,8 +7850,8 @@ function TableFilterControl({
|
|
|
7865
7850
|
placeholder,
|
|
7866
7851
|
onApply
|
|
7867
7852
|
}) {
|
|
7868
|
-
const [open, setOpen] =
|
|
7869
|
-
const [draft, setDraft] =
|
|
7853
|
+
const [open, setOpen] = useState24(false);
|
|
7854
|
+
const [draft, setDraft] = useState24(value);
|
|
7870
7855
|
const label = getColumnLabel(column);
|
|
7871
7856
|
useEffect16(() => {
|
|
7872
7857
|
if (open) setDraft(value);
|
|
@@ -7875,17 +7860,17 @@ function TableFilterControl({
|
|
|
7875
7860
|
onApply(nextValue.trim());
|
|
7876
7861
|
setOpen(false);
|
|
7877
7862
|
};
|
|
7878
|
-
return /* @__PURE__ */
|
|
7879
|
-
/* @__PURE__ */
|
|
7880
|
-
/* @__PURE__ */
|
|
7863
|
+
return /* @__PURE__ */ jsxs25("span", { className: "sia-table__filter-header", children: [
|
|
7864
|
+
/* @__PURE__ */ jsx30("span", { children: column.title ?? column.name ?? column.key }),
|
|
7865
|
+
/* @__PURE__ */ jsx30(
|
|
7881
7866
|
Popover,
|
|
7882
7867
|
{
|
|
7883
7868
|
open,
|
|
7884
7869
|
onOpenChange: setOpen,
|
|
7885
7870
|
placement: "bottom-end",
|
|
7886
7871
|
overlayClassName: "sia-table-filter-popover",
|
|
7887
|
-
content: /* @__PURE__ */
|
|
7888
|
-
/* @__PURE__ */
|
|
7872
|
+
content: /* @__PURE__ */ jsxs25("div", { className: "sia-table-filter-panel", children: [
|
|
7873
|
+
/* @__PURE__ */ jsx30(
|
|
7889
7874
|
Input,
|
|
7890
7875
|
{
|
|
7891
7876
|
size: "small",
|
|
@@ -7899,8 +7884,8 @@ function TableFilterControl({
|
|
|
7899
7884
|
}
|
|
7900
7885
|
}
|
|
7901
7886
|
),
|
|
7902
|
-
/* @__PURE__ */
|
|
7903
|
-
/* @__PURE__ */
|
|
7887
|
+
/* @__PURE__ */ jsxs25("div", { className: "sia-table-filter-panel__actions", children: [
|
|
7888
|
+
/* @__PURE__ */ jsx30(
|
|
7904
7889
|
Button,
|
|
7905
7890
|
{
|
|
7906
7891
|
size: "small",
|
|
@@ -7912,7 +7897,7 @@ function TableFilterControl({
|
|
|
7912
7897
|
children: "\u6E05\u9664"
|
|
7913
7898
|
}
|
|
7914
7899
|
),
|
|
7915
|
-
/* @__PURE__ */
|
|
7900
|
+
/* @__PURE__ */ jsx30(
|
|
7916
7901
|
Button,
|
|
7917
7902
|
{
|
|
7918
7903
|
size: "small",
|
|
@@ -7923,7 +7908,7 @@ function TableFilterControl({
|
|
|
7923
7908
|
)
|
|
7924
7909
|
] })
|
|
7925
7910
|
] }),
|
|
7926
|
-
children: /* @__PURE__ */
|
|
7911
|
+
children: /* @__PURE__ */ jsx30(
|
|
7927
7912
|
"button",
|
|
7928
7913
|
{
|
|
7929
7914
|
type: "button",
|
|
@@ -7931,7 +7916,7 @@ function TableFilterControl({
|
|
|
7931
7916
|
"aria-label": `\u7B5B\u9009${label}`,
|
|
7932
7917
|
"aria-pressed": Boolean(value),
|
|
7933
7918
|
onClick: (event) => event.stopPropagation(),
|
|
7934
|
-
children: /* @__PURE__ */
|
|
7919
|
+
children: /* @__PURE__ */ jsx30(Icon, { name: "search", size: 13 })
|
|
7935
7920
|
}
|
|
7936
7921
|
)
|
|
7937
7922
|
}
|
|
@@ -7993,7 +7978,7 @@ function createFilterPlugin(options = {}) {
|
|
|
7993
7978
|
title: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title
|
|
7994
7979
|
};
|
|
7995
7980
|
const placeholder = typeof options.placeholder === "function" ? options.placeholder(currentColumn) : options.placeholder ?? `\u8F93\u5165${getColumnLabel(currentColumn)}\u7B5B\u9009`;
|
|
7996
|
-
return /* @__PURE__ */
|
|
7981
|
+
return /* @__PURE__ */ jsx30(
|
|
7997
7982
|
TableFilterControl,
|
|
7998
7983
|
{
|
|
7999
7984
|
column: renderedColumn,
|
|
@@ -8082,7 +8067,7 @@ function createPaginationPlugin(options = {}) {
|
|
|
8082
8067
|
const page = currentPage(context);
|
|
8083
8068
|
const filteredCount = context.getPluginApi("filter")?.getFilteredRows().length;
|
|
8084
8069
|
const totalRecords = options.totalCount ?? filteredCount ?? context.sourceData.length;
|
|
8085
|
-
return /* @__PURE__ */
|
|
8070
|
+
return /* @__PURE__ */ jsx30(
|
|
8086
8071
|
Pagination,
|
|
8087
8072
|
{
|
|
8088
8073
|
className: "sia-table__pagination",
|
|
@@ -8118,6 +8103,9 @@ function createPaginationPlugin(options = {}) {
|
|
|
8118
8103
|
}
|
|
8119
8104
|
};
|
|
8120
8105
|
}
|
|
8106
|
+
|
|
8107
|
+
// src/components/Table/plugins/structure.tsx
|
|
8108
|
+
import { Fragment as Fragment9, jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
8121
8109
|
function createIndexPlugin(options = {}) {
|
|
8122
8110
|
return {
|
|
8123
8111
|
id: "index",
|
|
@@ -8220,19 +8208,19 @@ function createTreePlugin(options = {}) {
|
|
|
8220
8208
|
return {
|
|
8221
8209
|
...column,
|
|
8222
8210
|
...options.showLine ? { ellipsis: false, meta: { ...column.meta, treeLines: true } } : {},
|
|
8223
|
-
render: (value, record, index, info) => /* @__PURE__ */
|
|
8211
|
+
render: (value, record, index, info) => /* @__PURE__ */ jsxs26(
|
|
8224
8212
|
"span",
|
|
8225
8213
|
{
|
|
8226
8214
|
className: `sia-table__tree-cell${options.showLine ? " sia-table__tree-cell--lines" : ""}`,
|
|
8227
8215
|
style: options.showLine ? void 0 : { paddingLeft: info.row.depth * 18 },
|
|
8228
8216
|
children: [
|
|
8229
|
-
options.showLine && info.row.depth > 0 && /* @__PURE__ */
|
|
8230
|
-
info.row.meta.treeGuides.map((continued, level) => /* @__PURE__ */
|
|
8231
|
-
/* @__PURE__ */
|
|
8217
|
+
options.showLine && info.row.depth > 0 && /* @__PURE__ */ jsxs26(Fragment9, { children: [
|
|
8218
|
+
info.row.meta.treeGuides.map((continued, level) => /* @__PURE__ */ jsx31("span", { "aria-hidden": "true", className: `sia-table__tree-guide${continued ? " sia-table__tree-guide--continued" : ""}` }, level)),
|
|
8219
|
+
/* @__PURE__ */ jsx31("span", { "aria-hidden": "true", className: `sia-table__tree-guide sia-table__tree-guide--branch${info.row.meta.treeHasNextSibling ? " sia-table__tree-guide--continued" : ""}` })
|
|
8232
8220
|
] }),
|
|
8233
|
-
/* @__PURE__ */
|
|
8234
|
-
options.showLine && !!info.row.meta.treeHasChildren && current(context).includes(info.row.key) && /* @__PURE__ */
|
|
8235
|
-
info.row.meta.treeHasChildren ? /* @__PURE__ */
|
|
8221
|
+
/* @__PURE__ */ jsxs26("span", { className: options.showLine ? "sia-table__tree-node" : void 0, style: options.showLine ? void 0 : { display: "contents" }, children: [
|
|
8222
|
+
options.showLine && !!info.row.meta.treeHasChildren && current(context).includes(info.row.key) && /* @__PURE__ */ jsx31("span", { "aria-hidden": "true", className: "sia-table__tree-stem" }),
|
|
8223
|
+
info.row.meta.treeHasChildren ? /* @__PURE__ */ jsx31(
|
|
8236
8224
|
"button",
|
|
8237
8225
|
{
|
|
8238
8226
|
type: "button",
|
|
@@ -8243,7 +8231,7 @@ function createTreePlugin(options = {}) {
|
|
|
8243
8231
|
event.stopPropagation();
|
|
8244
8232
|
toggle(info.row.key, context);
|
|
8245
8233
|
},
|
|
8246
|
-
children: /* @__PURE__ */
|
|
8234
|
+
children: /* @__PURE__ */ jsx31(
|
|
8247
8235
|
Icon,
|
|
8248
8236
|
{
|
|
8249
8237
|
name: current(context).includes(info.row.key) ? "chevron-down" : "chevron-right",
|
|
@@ -8251,7 +8239,7 @@ function createTreePlugin(options = {}) {
|
|
|
8251
8239
|
}
|
|
8252
8240
|
)
|
|
8253
8241
|
}
|
|
8254
|
-
) : /* @__PURE__ */
|
|
8242
|
+
) : /* @__PURE__ */ jsx31("span", { className: "sia-table__tree-placeholder" })
|
|
8255
8243
|
] }),
|
|
8256
8244
|
previousRender ? previousRender(value, record, index, info) : value
|
|
8257
8245
|
]
|
|
@@ -8294,6 +8282,10 @@ function createSummaryPlugin(options) {
|
|
|
8294
8282
|
}
|
|
8295
8283
|
};
|
|
8296
8284
|
}
|
|
8285
|
+
|
|
8286
|
+
// src/components/Table/plugins/interaction.tsx
|
|
8287
|
+
import { useEffect as useEffect17, useRef as useRef25, useState as useState25 } from "react";
|
|
8288
|
+
import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
8297
8289
|
function EditableTableCell({
|
|
8298
8290
|
active,
|
|
8299
8291
|
editable,
|
|
@@ -8305,18 +8297,18 @@ function EditableTableCell({
|
|
|
8305
8297
|
showEditIcon
|
|
8306
8298
|
}) {
|
|
8307
8299
|
const config = typeof editable === "object" ? editable : { type: "input" };
|
|
8308
|
-
const [editValue, setEditValue] =
|
|
8309
|
-
const [saving, setSaving] =
|
|
8310
|
-
const inputRef =
|
|
8311
|
-
const editorRef =
|
|
8312
|
-
const ownedEvents =
|
|
8313
|
-
const editValueRef =
|
|
8314
|
-
const savingRef =
|
|
8315
|
-
const saveRef =
|
|
8300
|
+
const [editValue, setEditValue] = useState25(value);
|
|
8301
|
+
const [saving, setSaving] = useState25(false);
|
|
8302
|
+
const inputRef = useRef25(null);
|
|
8303
|
+
const editorRef = useRef25(null);
|
|
8304
|
+
const ownedEvents = useRef25(/* @__PURE__ */ new WeakSet());
|
|
8305
|
+
const editValueRef = useRef25(value);
|
|
8306
|
+
const savingRef = useRef25(false);
|
|
8307
|
+
const saveRef = useRef25(
|
|
8316
8308
|
async () => {
|
|
8317
8309
|
}
|
|
8318
8310
|
);
|
|
8319
|
-
|
|
8311
|
+
useEffect17(() => {
|
|
8320
8312
|
if (!active) return;
|
|
8321
8313
|
editValueRef.current = value;
|
|
8322
8314
|
setEditValue(value);
|
|
@@ -8347,7 +8339,7 @@ function EditableTableCell({
|
|
|
8347
8339
|
}
|
|
8348
8340
|
}
|
|
8349
8341
|
saveRef.current = save;
|
|
8350
|
-
|
|
8342
|
+
useEffect17(() => {
|
|
8351
8343
|
if (!active) return;
|
|
8352
8344
|
const handleOutsidePointerDown = (event) => {
|
|
8353
8345
|
const target = event.target;
|
|
@@ -8363,13 +8355,13 @@ function EditableTableCell({
|
|
|
8363
8355
|
);
|
|
8364
8356
|
}, [active, config.type, onCancel]);
|
|
8365
8357
|
if (!active)
|
|
8366
|
-
return /* @__PURE__ */
|
|
8358
|
+
return /* @__PURE__ */ jsxs27(
|
|
8367
8359
|
"div",
|
|
8368
8360
|
{
|
|
8369
8361
|
className: "sia-table__editable-display",
|
|
8370
8362
|
children: [
|
|
8371
|
-
/* @__PURE__ */
|
|
8372
|
-
showEditIcon && /* @__PURE__ */
|
|
8363
|
+
/* @__PURE__ */ jsx32("span", { children: content }),
|
|
8364
|
+
showEditIcon && /* @__PURE__ */ jsx32(Icon, { name: "edit", size: 13 })
|
|
8373
8365
|
]
|
|
8374
8366
|
}
|
|
8375
8367
|
);
|
|
@@ -8377,7 +8369,7 @@ function EditableTableCell({
|
|
|
8377
8369
|
if (config.type === "custom" && config.editRender) {
|
|
8378
8370
|
editor = config.editRender(record, (next) => void save(next), onCancel);
|
|
8379
8371
|
} else if (config.type === "inputNumber") {
|
|
8380
|
-
editor = /* @__PURE__ */
|
|
8372
|
+
editor = /* @__PURE__ */ jsx32(
|
|
8381
8373
|
InputNumber,
|
|
8382
8374
|
{
|
|
8383
8375
|
ref: inputRef,
|
|
@@ -8398,7 +8390,7 @@ function EditableTableCell({
|
|
|
8398
8390
|
}
|
|
8399
8391
|
);
|
|
8400
8392
|
} else if (config.type === "select") {
|
|
8401
|
-
editor = /* @__PURE__ */
|
|
8393
|
+
editor = /* @__PURE__ */ jsx32(
|
|
8402
8394
|
Select,
|
|
8403
8395
|
{
|
|
8404
8396
|
size: "small",
|
|
@@ -8412,14 +8404,14 @@ function EditableTableCell({
|
|
|
8412
8404
|
}
|
|
8413
8405
|
);
|
|
8414
8406
|
} else {
|
|
8415
|
-
editor = /* @__PURE__ */
|
|
8407
|
+
editor = /* @__PURE__ */ jsx32(
|
|
8416
8408
|
Input,
|
|
8417
8409
|
{
|
|
8418
8410
|
ref: inputRef,
|
|
8419
8411
|
size: "small",
|
|
8420
8412
|
value: String(editValue ?? ""),
|
|
8421
8413
|
disabled: saving,
|
|
8422
|
-
suffix: saving ? /* @__PURE__ */
|
|
8414
|
+
suffix: saving ? /* @__PURE__ */ jsx32(Icon, { name: "loader", size: 13, spin: true }) : null,
|
|
8423
8415
|
onChange: (event) => updateEditValue(event.target.value),
|
|
8424
8416
|
onBlur: () => void save(),
|
|
8425
8417
|
onKeyDown: (event) => {
|
|
@@ -8429,7 +8421,7 @@ function EditableTableCell({
|
|
|
8429
8421
|
}
|
|
8430
8422
|
);
|
|
8431
8423
|
}
|
|
8432
|
-
return /* @__PURE__ */
|
|
8424
|
+
return /* @__PURE__ */ jsx32(
|
|
8433
8425
|
"div",
|
|
8434
8426
|
{
|
|
8435
8427
|
ref: editorRef,
|
|
@@ -8466,7 +8458,7 @@ function createEditablePlugin(options = {}) {
|
|
|
8466
8458
|
const active = canEdit && context.state.editing?.rowKey === info.row.key && context.state.editing.columnKey === column.key;
|
|
8467
8459
|
const content = previousRender ? previousRender(value, record, index, info) : value;
|
|
8468
8460
|
if (!canEdit) return content;
|
|
8469
|
-
return /* @__PURE__ */
|
|
8461
|
+
return /* @__PURE__ */ jsx32(
|
|
8470
8462
|
EditableTableCell,
|
|
8471
8463
|
{
|
|
8472
8464
|
active,
|
|
@@ -8526,9 +8518,9 @@ function createResizePlugin(options = {}) {
|
|
|
8526
8518
|
...column,
|
|
8527
8519
|
autoWidth,
|
|
8528
8520
|
width,
|
|
8529
|
-
renderHeader: (currentColumn, coreContext) => /* @__PURE__ */
|
|
8530
|
-
/* @__PURE__ */
|
|
8531
|
-
/* @__PURE__ */
|
|
8521
|
+
renderHeader: (currentColumn, coreContext) => /* @__PURE__ */ jsxs27("span", { className: "sia-table__resizable-header", children: [
|
|
8522
|
+
/* @__PURE__ */ jsx32("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
|
|
8523
|
+
/* @__PURE__ */ jsx32(
|
|
8532
8524
|
"span",
|
|
8533
8525
|
{
|
|
8534
8526
|
className: "sia-table__resize-handle",
|
|
@@ -8601,11 +8593,226 @@ function createResizePlugin(options = {}) {
|
|
|
8601
8593
|
});
|
|
8602
8594
|
},
|
|
8603
8595
|
getApi: (context) => ({
|
|
8604
|
-
getWidths: () => context.state.widths,
|
|
8605
|
-
setWidth: (columnKey, width) => setWidth(columnKey, width, context, true)
|
|
8596
|
+
getWidths: () => context.state.widths,
|
|
8597
|
+
setWidth: (columnKey, width) => setWidth(columnKey, width, context, true)
|
|
8598
|
+
})
|
|
8599
|
+
};
|
|
8600
|
+
}
|
|
8601
|
+
|
|
8602
|
+
// src/components/Table/plugins/columnSetting.tsx
|
|
8603
|
+
import { useEffect as useEffect18, useRef as useRef26, useState as useState26 } from "react";
|
|
8604
|
+
|
|
8605
|
+
// src/components/Table/columnSettings.ts
|
|
8606
|
+
function reconcileColumnSettings(columns, defaults, saved) {
|
|
8607
|
+
const stored = new Map(saved.map((item) => [item.key, item]));
|
|
8608
|
+
const base = new Map(defaults.map((item) => [item.key, item]));
|
|
8609
|
+
const result = [];
|
|
8610
|
+
const rank = (column) => {
|
|
8611
|
+
const own = stored.get(column.key)?.order;
|
|
8612
|
+
if (own !== void 0) return own;
|
|
8613
|
+
const children = column.children?.map(rank).filter((value) => value !== void 0);
|
|
8614
|
+
return children?.length ? Math.min(...children) : void 0;
|
|
8615
|
+
};
|
|
8616
|
+
const walk = (source, parent) => {
|
|
8617
|
+
const entries = source.map((column, index) => ({ column, index, rank: rank(column) }));
|
|
8618
|
+
let anchor = -1;
|
|
8619
|
+
for (const entry of entries) {
|
|
8620
|
+
if (entry.rank !== void 0) anchor = entry.rank;
|
|
8621
|
+
else entry.rank = anchor + (entry.index + 1) / (entries.length + 1);
|
|
8622
|
+
}
|
|
8623
|
+
entries.sort((a, b) => a.rank - b.rank || a.index - b.index);
|
|
8624
|
+
for (const { column } of entries) {
|
|
8625
|
+
const own = stored.get(column.key);
|
|
8626
|
+
if (column.children?.length) {
|
|
8627
|
+
walk(column.children, own ?? parent);
|
|
8628
|
+
} else {
|
|
8629
|
+
const fallback = base.get(column.key);
|
|
8630
|
+
if (!fallback) continue;
|
|
8631
|
+
const item = own ?? {
|
|
8632
|
+
...fallback,
|
|
8633
|
+
fixed: parent?.fixed ?? fallback.fixed,
|
|
8634
|
+
visible: fallback.visible && (parent?.visible ?? true)
|
|
8635
|
+
};
|
|
8636
|
+
result.push({ ...item, order: result.length });
|
|
8637
|
+
}
|
|
8638
|
+
}
|
|
8639
|
+
};
|
|
8640
|
+
walk(columns);
|
|
8641
|
+
return result;
|
|
8642
|
+
}
|
|
8643
|
+
function mergeColumnSettings(columns, saved, active) {
|
|
8644
|
+
const merged = new Map(saved.filter((item) => !["__index__", "__selection__"].includes(item.key)).map((item) => [item.key, item]));
|
|
8645
|
+
active.forEach((item) => merged.set(item.key, item));
|
|
8646
|
+
const current = new Map(active.map((item) => [item.key, item]));
|
|
8647
|
+
const walk = (column) => {
|
|
8648
|
+
if (!column.children?.length) return current.has(column.key) ? [current.get(column.key)] : [];
|
|
8649
|
+
const leaves = column.children.flatMap(walk);
|
|
8650
|
+
if (leaves.length) {
|
|
8651
|
+
const old = merged.get(column.key);
|
|
8652
|
+
merged.set(column.key, {
|
|
8653
|
+
key: column.key,
|
|
8654
|
+
width: old?.width ?? column.width,
|
|
8655
|
+
fixed: old?.fixed,
|
|
8656
|
+
visible: leaves.some((item) => item.visible),
|
|
8657
|
+
order: Math.min(...leaves.map((item) => item.order))
|
|
8658
|
+
});
|
|
8659
|
+
}
|
|
8660
|
+
return leaves;
|
|
8661
|
+
};
|
|
8662
|
+
columns.forEach(walk);
|
|
8663
|
+
return [...merged.values()].sort((left, right) => left.order - right.order);
|
|
8664
|
+
}
|
|
8665
|
+
|
|
8666
|
+
// src/components/settingsPersistence.ts
|
|
8667
|
+
var queues = /* @__PURE__ */ new WeakMap();
|
|
8668
|
+
function saveSettingsPatch(adapter, scope, patch) {
|
|
8669
|
+
let scoped = queues.get(adapter);
|
|
8670
|
+
if (!scoped) {
|
|
8671
|
+
scoped = /* @__PURE__ */ new Map();
|
|
8672
|
+
queues.set(adapter, scoped);
|
|
8673
|
+
}
|
|
8674
|
+
const key = JSON.stringify([scope.moduleName, scope.businessKey]);
|
|
8675
|
+
const previous = scoped.get(key) ?? Promise.resolve();
|
|
8676
|
+
const task = previous.catch(() => void 0).then(async () => {
|
|
8677
|
+
const current = await adapter.load(scope);
|
|
8678
|
+
const defined = Object.fromEntries(Object.entries(patch).filter(([, value]) => value !== void 0));
|
|
8679
|
+
await adapter.save(scope, { ...current, ...defined });
|
|
8680
|
+
});
|
|
8681
|
+
scoped.set(key, task);
|
|
8682
|
+
const cleanup = () => {
|
|
8683
|
+
if (scoped.get(key) === task) scoped.delete(key);
|
|
8684
|
+
};
|
|
8685
|
+
void task.then(cleanup, cleanup);
|
|
8686
|
+
return task;
|
|
8687
|
+
}
|
|
8688
|
+
|
|
8689
|
+
// src/components/Table/plugins/actions.tsx
|
|
8690
|
+
import { Fragment as Fragment10, jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
8691
|
+
function ToolbarItems({
|
|
8692
|
+
items,
|
|
8693
|
+
context
|
|
8694
|
+
}) {
|
|
8695
|
+
return /* @__PURE__ */ jsx33(Fragment10, { children: items.map((item) => {
|
|
8696
|
+
if (item.hidden === true || typeof item.hidden === "function" && item.hidden(context))
|
|
8697
|
+
return null;
|
|
8698
|
+
const disabled = item.disabled === true || typeof item.disabled === "function" && item.disabled(context);
|
|
8699
|
+
return /* @__PURE__ */ jsx33(
|
|
8700
|
+
Button,
|
|
8701
|
+
{
|
|
8702
|
+
size: "small",
|
|
8703
|
+
danger: item.danger,
|
|
8704
|
+
title: item.title,
|
|
8705
|
+
icon: item.icon,
|
|
8706
|
+
disabled,
|
|
8707
|
+
onClick: () => void item.onClick?.(context),
|
|
8708
|
+
children: item.label
|
|
8709
|
+
},
|
|
8710
|
+
item.key
|
|
8711
|
+
);
|
|
8712
|
+
}) });
|
|
8713
|
+
}
|
|
8714
|
+
function createToolbarPlugin(options) {
|
|
8715
|
+
const allowed = (item) => options.canAccess?.(item) ?? true;
|
|
8716
|
+
const items = (position, inSettings = false) => (options.items ?? []).filter(
|
|
8717
|
+
(item) => allowed(item) && (item.position ?? "start") === position && Boolean(item.inSettings) === inSettings
|
|
8718
|
+
);
|
|
8719
|
+
return {
|
|
8720
|
+
id: "toolbar",
|
|
8721
|
+
order: 5,
|
|
8722
|
+
renderToolbarStart: (context) => /* @__PURE__ */ jsxs28(Fragment10, { children: [
|
|
8723
|
+
options.start,
|
|
8724
|
+
/* @__PURE__ */ jsx33(ToolbarItems, { items: items("start"), context })
|
|
8725
|
+
] }),
|
|
8726
|
+
renderToolbarEnd: (context) => /* @__PURE__ */ jsxs28(Fragment10, { children: [
|
|
8727
|
+
options.end,
|
|
8728
|
+
/* @__PURE__ */ jsx33(ToolbarItems, { items: items("end"), context }),
|
|
8729
|
+
items("end", true).length > 0 ? /* @__PURE__ */ jsxs28("details", { className: "sia-table__toolbar-menu", children: [
|
|
8730
|
+
/* @__PURE__ */ jsx33("summary", { "aria-label": "\u66F4\u591A\u8868\u683C\u64CD\u4F5C", children: /* @__PURE__ */ jsx33(Icon, { name: "more-horizontal", size: 16 }) }),
|
|
8731
|
+
/* @__PURE__ */ jsx33("div", { children: /* @__PURE__ */ jsx33(ToolbarItems, { items: items("end", true), context }) })
|
|
8732
|
+
] }) : null
|
|
8733
|
+
] })
|
|
8734
|
+
};
|
|
8735
|
+
}
|
|
8736
|
+
function createExportPlugin(options = {}) {
|
|
8737
|
+
function getRows(context, scope = options.scope ?? "visible") {
|
|
8738
|
+
if (scope === "all") return context.sourceData;
|
|
8739
|
+
if (scope === "selected")
|
|
8740
|
+
return context.getPluginApi("selection")?.getSelectedRows() ?? [];
|
|
8741
|
+
return context.rows.map((row) => row.record);
|
|
8742
|
+
}
|
|
8743
|
+
function getCsv(context, scope) {
|
|
8744
|
+
const delimiter = options.delimiter ?? ",";
|
|
8745
|
+
const sanitizeFormula = options.sanitizeFormula ?? true;
|
|
8746
|
+
const rows = getRows(context, scope);
|
|
8747
|
+
const columns = flattenTableColumns(context.columns).filter(
|
|
8748
|
+
(column) => column.exportable !== false && (!column.meta?.plugin || column.exportable === true)
|
|
8749
|
+
);
|
|
8750
|
+
const header = columns.map((column) => tableExportEscape(getColumnLabel(column), delimiter)).join(delimiter);
|
|
8751
|
+
const lines = rows.map((record, rowIndex) => {
|
|
8752
|
+
const row = {
|
|
8753
|
+
key: context.getRowKey(record, rowIndex),
|
|
8754
|
+
record,
|
|
8755
|
+
sourceIndex: rowIndex,
|
|
8756
|
+
depth: 0,
|
|
8757
|
+
meta: {}
|
|
8758
|
+
};
|
|
8759
|
+
return columns.map((column) => {
|
|
8760
|
+
const value = getTableValue(
|
|
8761
|
+
record,
|
|
8762
|
+
column.dataIndex,
|
|
8763
|
+
column.code ?? column.key
|
|
8764
|
+
);
|
|
8765
|
+
const rendered = column.exportRender?.(value, record, rowIndex, {
|
|
8766
|
+
row,
|
|
8767
|
+
rowIndex,
|
|
8768
|
+
column
|
|
8769
|
+
});
|
|
8770
|
+
const text = rendered === void 0 ? tableExportCell(value, sanitizeFormula) : tableExportText(rendered);
|
|
8771
|
+
return tableExportEscape(text, delimiter);
|
|
8772
|
+
}).join(delimiter);
|
|
8773
|
+
});
|
|
8774
|
+
return `${options.includeBom === false ? "" : "\uFEFF"}${[header, ...lines].join("\r\n")}`;
|
|
8775
|
+
}
|
|
8776
|
+
async function download(context, scope) {
|
|
8777
|
+
const rows = getRows(context, scope);
|
|
8778
|
+
const csv = getCsv(context, scope);
|
|
8779
|
+
if (options.onExport) {
|
|
8780
|
+
await options.onExport(csv, rows);
|
|
8781
|
+
return;
|
|
8782
|
+
}
|
|
8783
|
+
if (typeof document === "undefined") return;
|
|
8784
|
+
const fileName = typeof options.fileName === "function" ? options.fileName(context) : options.fileName ?? "table.csv";
|
|
8785
|
+
const blob = new Blob([csv], { type: "text/csv;charset=utf-8" });
|
|
8786
|
+
const url = URL.createObjectURL(blob);
|
|
8787
|
+
const anchor = document.createElement("a");
|
|
8788
|
+
anchor.href = url;
|
|
8789
|
+
anchor.download = fileName.endsWith(".csv") ? fileName : `${fileName}.csv`;
|
|
8790
|
+
anchor.click();
|
|
8791
|
+
window.setTimeout(() => URL.revokeObjectURL(url), 0);
|
|
8792
|
+
}
|
|
8793
|
+
return {
|
|
8794
|
+
id: "export",
|
|
8795
|
+
order: 95,
|
|
8796
|
+
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */ jsx33(
|
|
8797
|
+
Button,
|
|
8798
|
+
{
|
|
8799
|
+
size: "small",
|
|
8800
|
+
icon: /* @__PURE__ */ jsx33(Icon, { name: "download", size: 14 }),
|
|
8801
|
+
disabled: getRows(context).length === 0,
|
|
8802
|
+
onClick: () => void download(context),
|
|
8803
|
+
children: options.buttonLabel ?? "\u5BFC\u51FA"
|
|
8804
|
+
}
|
|
8805
|
+
),
|
|
8806
|
+
getApi: (context) => ({
|
|
8807
|
+
getCsv: (scope) => getCsv(context, scope),
|
|
8808
|
+
download: (scope) => download(context, scope),
|
|
8809
|
+
getRows: (scope) => getRows(context, scope)
|
|
8606
8810
|
})
|
|
8607
8811
|
};
|
|
8608
8812
|
}
|
|
8813
|
+
|
|
8814
|
+
// src/components/Table/plugins/columnSetting.tsx
|
|
8815
|
+
import { Fragment as Fragment11, jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
8609
8816
|
function isTableAuxiliaryColumn(column) {
|
|
8610
8817
|
return column.meta?.plugin === "index" || column.meta?.plugin === "selection" || column.key === "__index__" || column.key === "__selection__";
|
|
8611
8818
|
}
|
|
@@ -8664,12 +8871,12 @@ function ColumnSettingPanel({
|
|
|
8664
8871
|
onClose,
|
|
8665
8872
|
onApply
|
|
8666
8873
|
}) {
|
|
8667
|
-
const [draft, setDraft] =
|
|
8668
|
-
const listRef =
|
|
8669
|
-
const cancelDrag =
|
|
8670
|
-
const [preview, setPreview] =
|
|
8671
|
-
const syncedDraft =
|
|
8672
|
-
|
|
8874
|
+
const [draft, setDraft] = useState26(items);
|
|
8875
|
+
const listRef = useRef26(null);
|
|
8876
|
+
const cancelDrag = useRef26(null);
|
|
8877
|
+
const [preview, setPreview] = useState26(null);
|
|
8878
|
+
const syncedDraft = useRef26({ open: false, signature: "" });
|
|
8879
|
+
useEffect18(() => {
|
|
8673
8880
|
const signature = JSON.stringify(items);
|
|
8674
8881
|
const changed = signature !== syncedDraft.current.signature;
|
|
8675
8882
|
if (open !== syncedDraft.current.open || changed) cancelDrag.current?.();
|
|
@@ -8678,7 +8885,7 @@ function ColumnSettingPanel({
|
|
|
8678
8885
|
}
|
|
8679
8886
|
syncedDraft.current = { open, signature };
|
|
8680
8887
|
}, [items, open]);
|
|
8681
|
-
|
|
8888
|
+
useEffect18(() => () => cancelDrag.current?.(), []);
|
|
8682
8889
|
const labels = new Map(
|
|
8683
8890
|
flattenTableColumns(columns).map((column) => [
|
|
8684
8891
|
column.key,
|
|
@@ -8805,7 +9012,7 @@ function ColumnSettingPanel({
|
|
|
8805
9012
|
window.addEventListener("blur", cancel);
|
|
8806
9013
|
frame = requestAnimationFrame(tick);
|
|
8807
9014
|
}
|
|
8808
|
-
return /* @__PURE__ */
|
|
9015
|
+
return /* @__PURE__ */ jsxs29(
|
|
8809
9016
|
Drawer2,
|
|
8810
9017
|
{
|
|
8811
9018
|
open,
|
|
@@ -8814,9 +9021,9 @@ function ColumnSettingPanel({
|
|
|
8814
9021
|
onOpenChange: (next) => {
|
|
8815
9022
|
if (!next) onClose();
|
|
8816
9023
|
},
|
|
8817
|
-
footer: /* @__PURE__ */
|
|
8818
|
-
/* @__PURE__ */
|
|
8819
|
-
/* @__PURE__ */
|
|
9024
|
+
footer: /* @__PURE__ */ jsxs29(Fragment11, { children: [
|
|
9025
|
+
/* @__PURE__ */ jsx34(Button, { onClick: onClose, children: "\u53D6\u6D88" }),
|
|
9026
|
+
/* @__PURE__ */ jsx34(
|
|
8820
9027
|
Button,
|
|
8821
9028
|
{
|
|
8822
9029
|
variant: "primary",
|
|
@@ -8827,19 +9034,19 @@ function ColumnSettingPanel({
|
|
|
8827
9034
|
)
|
|
8828
9035
|
] }),
|
|
8829
9036
|
children: [
|
|
8830
|
-
loadError ? /* @__PURE__ */
|
|
9037
|
+
loadError ? /* @__PURE__ */ jsxs29("p", { role: "alert", children: [
|
|
8831
9038
|
"\u8BFB\u53D6\u5217\u914D\u7F6E\u5931\u8D25\u3002",
|
|
8832
|
-
/* @__PURE__ */
|
|
9039
|
+
/* @__PURE__ */ jsx34(Button, { variant: "link", onClick: onRetry, children: "\u91CD\u8BD5" })
|
|
8833
9040
|
] }) : null,
|
|
8834
|
-
/* @__PURE__ */
|
|
9041
|
+
/* @__PURE__ */ jsx34(Spin, { spinning: Boolean(loading), className: "sia-table-settings__loading", "aria-label": loading ? "\u6B63\u5728\u8BFB\u53D6\u5217\u914D\u7F6E" : void 0, children: /* @__PURE__ */ jsxs29(
|
|
8835
9042
|
"fieldset",
|
|
8836
9043
|
{
|
|
8837
9044
|
disabled: loading || loadError,
|
|
8838
9045
|
style: { border: 0, padding: 0, margin: 0, minWidth: 0 },
|
|
8839
9046
|
"aria-busy": loading,
|
|
8840
9047
|
children: [
|
|
8841
|
-
/* @__PURE__ */
|
|
8842
|
-
/* @__PURE__ */
|
|
9048
|
+
/* @__PURE__ */ jsxs29("label", { className: "sia-table-settings__all", children: [
|
|
9049
|
+
/* @__PURE__ */ jsx34(
|
|
8843
9050
|
TableCheckbox,
|
|
8844
9051
|
{
|
|
8845
9052
|
label: "\u5168\u9009\u5217",
|
|
@@ -8850,7 +9057,7 @@ function ColumnSettingPanel({
|
|
|
8850
9057
|
)
|
|
8851
9058
|
}
|
|
8852
9059
|
),
|
|
8853
|
-
/* @__PURE__ */
|
|
9060
|
+
/* @__PURE__ */ jsxs29("span", { children: [
|
|
8854
9061
|
"\u5168\u9009\uFF08",
|
|
8855
9062
|
visibleCount,
|
|
8856
9063
|
"/",
|
|
@@ -8858,12 +9065,12 @@ function ColumnSettingPanel({
|
|
|
8858
9065
|
"\uFF09"
|
|
8859
9066
|
] })
|
|
8860
9067
|
] }),
|
|
8861
|
-
/* @__PURE__ */
|
|
9068
|
+
/* @__PURE__ */ jsx34(
|
|
8862
9069
|
"div",
|
|
8863
9070
|
{
|
|
8864
9071
|
ref: listRef,
|
|
8865
9072
|
className: `sia-table-settings__list${preview ? " is-sorting" : ""}`,
|
|
8866
|
-
children: draft.map((item) => /* @__PURE__ */
|
|
9073
|
+
children: draft.map((item) => /* @__PURE__ */ jsxs29(
|
|
8867
9074
|
"div",
|
|
8868
9075
|
{
|
|
8869
9076
|
"data-column-key": item.key,
|
|
@@ -8873,8 +9080,8 @@ function ColumnSettingPanel({
|
|
|
8873
9080
|
} : void 0,
|
|
8874
9081
|
onPointerDown: (event) => startSort(event, item.key),
|
|
8875
9082
|
children: [
|
|
8876
|
-
/* @__PURE__ */
|
|
8877
|
-
/* @__PURE__ */
|
|
9083
|
+
/* @__PURE__ */ jsx34(Icon, { name: "menu", size: 15 }),
|
|
9084
|
+
/* @__PURE__ */ jsx34(
|
|
8878
9085
|
TableCheckbox,
|
|
8879
9086
|
{
|
|
8880
9087
|
label: `\u663E\u793A${labels.get(item.key) ?? item.key}\u5217`,
|
|
@@ -8886,15 +9093,15 @@ function ColumnSettingPanel({
|
|
|
8886
9093
|
)
|
|
8887
9094
|
}
|
|
8888
9095
|
),
|
|
8889
|
-
/* @__PURE__ */
|
|
9096
|
+
/* @__PURE__ */ jsx34(
|
|
8890
9097
|
"span",
|
|
8891
9098
|
{
|
|
8892
9099
|
className: "sia-table-settings__name",
|
|
8893
9100
|
children: labels.get(item.key) ?? item.key
|
|
8894
9101
|
}
|
|
8895
9102
|
),
|
|
8896
|
-
/* @__PURE__ */
|
|
8897
|
-
/* @__PURE__ */
|
|
9103
|
+
/* @__PURE__ */ jsxs29("div", { className: "sia-table-settings__actions", children: [
|
|
9104
|
+
/* @__PURE__ */ jsx34(
|
|
8898
9105
|
Button,
|
|
8899
9106
|
{
|
|
8900
9107
|
size: "small",
|
|
@@ -8907,7 +9114,7 @@ function ColumnSettingPanel({
|
|
|
8907
9114
|
children: "\u5DE6"
|
|
8908
9115
|
}
|
|
8909
9116
|
),
|
|
8910
|
-
/* @__PURE__ */
|
|
9117
|
+
/* @__PURE__ */ jsx34(
|
|
8911
9118
|
Button,
|
|
8912
9119
|
{
|
|
8913
9120
|
size: "small",
|
|
@@ -9057,7 +9264,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
9057
9264
|
{
|
|
9058
9265
|
key: "builtin:export",
|
|
9059
9266
|
label: "\u8868\u683C\u5BFC\u51FA",
|
|
9060
|
-
icon: /* @__PURE__ */
|
|
9267
|
+
icon: /* @__PURE__ */ jsx34(Icon, { name: "download", size: 18 }),
|
|
9061
9268
|
disabled: exportApi().getRows().length === 0
|
|
9062
9269
|
},
|
|
9063
9270
|
{ key: "builtin:divider", type: "divider" }
|
|
@@ -9065,7 +9272,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
9065
9272
|
{
|
|
9066
9273
|
key: "builtin:columns",
|
|
9067
9274
|
label: "\u5217\u8BBE\u7F6E",
|
|
9068
|
-
icon: /* @__PURE__ */
|
|
9275
|
+
icon: /* @__PURE__ */ jsx34(Icon, { name: "settings", size: 18 })
|
|
9069
9276
|
},
|
|
9070
9277
|
...customItems.map((item) => ({
|
|
9071
9278
|
key: "custom:" + item.key,
|
|
@@ -9077,7 +9284,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
9077
9284
|
disabled: item.disabled === true || typeof item.disabled === "function" && item.disabled(context)
|
|
9078
9285
|
}))
|
|
9079
9286
|
];
|
|
9080
|
-
return /* @__PURE__ */
|
|
9287
|
+
return /* @__PURE__ */ jsx34(
|
|
9081
9288
|
Dropdown,
|
|
9082
9289
|
{
|
|
9083
9290
|
disabled: options.buttonProps?.disabled || options.buttonProps?.loading,
|
|
@@ -9094,12 +9301,12 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
9094
9301
|
void customItems.find((item) => "custom:" + item.key === key)?.onClick?.(context);
|
|
9095
9302
|
}
|
|
9096
9303
|
},
|
|
9097
|
-
children: /* @__PURE__ */
|
|
9304
|
+
children: /* @__PURE__ */ jsx34(
|
|
9098
9305
|
Button,
|
|
9099
9306
|
{
|
|
9100
9307
|
size: "small",
|
|
9101
9308
|
variant: "text",
|
|
9102
|
-
icon: /* @__PURE__ */
|
|
9309
|
+
icon: /* @__PURE__ */ jsx34(Icon, { name: "settings", size: 16 }),
|
|
9103
9310
|
"aria-label": "\u8868\u683C\u8BBE\u7F6E",
|
|
9104
9311
|
...options.buttonProps,
|
|
9105
9312
|
className: `sia-table__settings-button${options.buttonProps?.children == null ? " sia-table__toolbar-icon" : ""} ${options.buttonProps?.className ?? ""}`.trim()
|
|
@@ -9108,7 +9315,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
9108
9315
|
}
|
|
9109
9316
|
);
|
|
9110
9317
|
},
|
|
9111
|
-
renderOverlay: (context) => /* @__PURE__ */
|
|
9318
|
+
renderOverlay: (context) => /* @__PURE__ */ jsx34(
|
|
9112
9319
|
ColumnSettingPanel,
|
|
9113
9320
|
{
|
|
9114
9321
|
open: context.state.open,
|
|
@@ -9154,148 +9361,9 @@ function createLocalStorageTableSettingsAdapter(prefix = "sia-table") {
|
|
|
9154
9361
|
}
|
|
9155
9362
|
};
|
|
9156
9363
|
}
|
|
9157
|
-
function ToolbarItems({
|
|
9158
|
-
items,
|
|
9159
|
-
context
|
|
9160
|
-
}) {
|
|
9161
|
-
return /* @__PURE__ */ jsx28(Fragment8, { children: items.map((item) => {
|
|
9162
|
-
if (item.hidden === true || typeof item.hidden === "function" && item.hidden(context))
|
|
9163
|
-
return null;
|
|
9164
|
-
const disabled = item.disabled === true || typeof item.disabled === "function" && item.disabled(context);
|
|
9165
|
-
return /* @__PURE__ */ jsx28(
|
|
9166
|
-
Button,
|
|
9167
|
-
{
|
|
9168
|
-
size: "small",
|
|
9169
|
-
danger: item.danger,
|
|
9170
|
-
title: item.title,
|
|
9171
|
-
icon: item.icon,
|
|
9172
|
-
disabled,
|
|
9173
|
-
onClick: () => void item.onClick?.(context),
|
|
9174
|
-
children: item.label
|
|
9175
|
-
},
|
|
9176
|
-
item.key
|
|
9177
|
-
);
|
|
9178
|
-
}) });
|
|
9179
|
-
}
|
|
9180
|
-
function createToolbarPlugin(options) {
|
|
9181
|
-
const allowed = (item) => options.canAccess?.(item) ?? true;
|
|
9182
|
-
const items = (position, inSettings = false) => (options.items ?? []).filter(
|
|
9183
|
-
(item) => allowed(item) && (item.position ?? "start") === position && Boolean(item.inSettings) === inSettings
|
|
9184
|
-
);
|
|
9185
|
-
return {
|
|
9186
|
-
id: "toolbar",
|
|
9187
|
-
order: 5,
|
|
9188
|
-
renderToolbarStart: (context) => /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
9189
|
-
options.start,
|
|
9190
|
-
/* @__PURE__ */ jsx28(ToolbarItems, { items: items("start"), context })
|
|
9191
|
-
] }),
|
|
9192
|
-
renderToolbarEnd: (context) => /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
9193
|
-
options.end,
|
|
9194
|
-
/* @__PURE__ */ jsx28(ToolbarItems, { items: items("end"), context }),
|
|
9195
|
-
items("end", true).length > 0 ? /* @__PURE__ */ jsxs24("details", { className: "sia-table__toolbar-menu", children: [
|
|
9196
|
-
/* @__PURE__ */ jsx28("summary", { "aria-label": "\u66F4\u591A\u8868\u683C\u64CD\u4F5C", children: /* @__PURE__ */ jsx28(Icon, { name: "more-horizontal", size: 16 }) }),
|
|
9197
|
-
/* @__PURE__ */ jsx28("div", { children: /* @__PURE__ */ jsx28(ToolbarItems, { items: items("end", true), context }) })
|
|
9198
|
-
] }) : null
|
|
9199
|
-
] })
|
|
9200
|
-
};
|
|
9201
|
-
}
|
|
9202
|
-
function tableExportText(node) {
|
|
9203
|
-
if (node === null || node === void 0 || typeof node === "boolean")
|
|
9204
|
-
return "";
|
|
9205
|
-
if (typeof node === "string" || typeof node === "number" || typeof node === "bigint")
|
|
9206
|
-
return String(node);
|
|
9207
|
-
if (Array.isArray(node)) return node.map(tableExportText).join("");
|
|
9208
|
-
if (isValidElement3(node))
|
|
9209
|
-
return tableExportText(node.props.children);
|
|
9210
|
-
return "";
|
|
9211
|
-
}
|
|
9212
|
-
function tableExportCell(value, sanitizeFormula) {
|
|
9213
|
-
const text = value === null || value === void 0 ? "" : typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
9214
|
-
return sanitizeFormula && /^[=+\-@]/.test(text) ? `'${text}` : text;
|
|
9215
|
-
}
|
|
9216
|
-
function tableExportEscape(value, delimiter) {
|
|
9217
|
-
return value.includes(delimiter) || /["\r\n]/.test(value) ? `"${value.replace(/"/g, '""')}"` : value;
|
|
9218
|
-
}
|
|
9219
|
-
function createExportPlugin(options = {}) {
|
|
9220
|
-
function getRows(context, scope = options.scope ?? "visible") {
|
|
9221
|
-
if (scope === "all") return context.sourceData;
|
|
9222
|
-
if (scope === "selected")
|
|
9223
|
-
return context.getPluginApi("selection")?.getSelectedRows() ?? [];
|
|
9224
|
-
return context.rows.map((row) => row.record);
|
|
9225
|
-
}
|
|
9226
|
-
function getCsv(context, scope) {
|
|
9227
|
-
const delimiter = options.delimiter ?? ",";
|
|
9228
|
-
const sanitizeFormula = options.sanitizeFormula ?? true;
|
|
9229
|
-
const rows = getRows(context, scope);
|
|
9230
|
-
const columns = flattenTableColumns(context.columns).filter(
|
|
9231
|
-
(column) => column.exportable !== false && (!column.meta?.plugin || column.exportable === true)
|
|
9232
|
-
);
|
|
9233
|
-
const header = columns.map((column) => tableExportEscape(getColumnLabel(column), delimiter)).join(delimiter);
|
|
9234
|
-
const lines = rows.map((record, rowIndex) => {
|
|
9235
|
-
const row = {
|
|
9236
|
-
key: context.getRowKey(record, rowIndex),
|
|
9237
|
-
record,
|
|
9238
|
-
sourceIndex: rowIndex,
|
|
9239
|
-
depth: 0,
|
|
9240
|
-
meta: {}
|
|
9241
|
-
};
|
|
9242
|
-
return columns.map((column) => {
|
|
9243
|
-
const value = getTableValue(
|
|
9244
|
-
record,
|
|
9245
|
-
column.dataIndex,
|
|
9246
|
-
column.code ?? column.key
|
|
9247
|
-
);
|
|
9248
|
-
const rendered = column.exportRender?.(value, record, rowIndex, {
|
|
9249
|
-
row,
|
|
9250
|
-
rowIndex,
|
|
9251
|
-
column
|
|
9252
|
-
});
|
|
9253
|
-
const text = rendered === void 0 ? tableExportCell(value, sanitizeFormula) : tableExportText(rendered);
|
|
9254
|
-
return tableExportEscape(text, delimiter);
|
|
9255
|
-
}).join(delimiter);
|
|
9256
|
-
});
|
|
9257
|
-
return `${options.includeBom === false ? "" : "\uFEFF"}${[header, ...lines].join("\r\n")}`;
|
|
9258
|
-
}
|
|
9259
|
-
async function download(context, scope) {
|
|
9260
|
-
const rows = getRows(context, scope);
|
|
9261
|
-
const csv = getCsv(context, scope);
|
|
9262
|
-
if (options.onExport) {
|
|
9263
|
-
await options.onExport(csv, rows);
|
|
9264
|
-
return;
|
|
9265
|
-
}
|
|
9266
|
-
if (typeof document === "undefined") return;
|
|
9267
|
-
const fileName = typeof options.fileName === "function" ? options.fileName(context) : options.fileName ?? "table.csv";
|
|
9268
|
-
const blob = new Blob([csv], { type: "text/csv;charset=utf-8" });
|
|
9269
|
-
const url = URL.createObjectURL(blob);
|
|
9270
|
-
const anchor = document.createElement("a");
|
|
9271
|
-
anchor.href = url;
|
|
9272
|
-
anchor.download = fileName.endsWith(".csv") ? fileName : `${fileName}.csv`;
|
|
9273
|
-
anchor.click();
|
|
9274
|
-
window.setTimeout(() => URL.revokeObjectURL(url), 0);
|
|
9275
|
-
}
|
|
9276
|
-
return {
|
|
9277
|
-
id: "export",
|
|
9278
|
-
order: 95,
|
|
9279
|
-
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */ jsx28(
|
|
9280
|
-
Button,
|
|
9281
|
-
{
|
|
9282
|
-
size: "small",
|
|
9283
|
-
icon: /* @__PURE__ */ jsx28(Icon, { name: "download", size: 14 }),
|
|
9284
|
-
disabled: getRows(context).length === 0,
|
|
9285
|
-
onClick: () => void download(context),
|
|
9286
|
-
children: options.buttonLabel ?? "\u5BFC\u51FA"
|
|
9287
|
-
}
|
|
9288
|
-
),
|
|
9289
|
-
getApi: (context) => ({
|
|
9290
|
-
getCsv: (scope) => getCsv(context, scope),
|
|
9291
|
-
download: (scope) => download(context, scope),
|
|
9292
|
-
getRows: (scope) => getRows(context, scope)
|
|
9293
|
-
})
|
|
9294
|
-
};
|
|
9295
|
-
}
|
|
9296
9364
|
|
|
9297
9365
|
// src/components/Table/Table.tsx
|
|
9298
|
-
import { jsx as
|
|
9366
|
+
import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
9299
9367
|
var EMPTY_DATA = [];
|
|
9300
9368
|
var EMPTY_COLUMNS = [];
|
|
9301
9369
|
var EMPTY_PLUGINS = [];
|
|
@@ -9412,9 +9480,9 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
9412
9480
|
onCellPointerDown,
|
|
9413
9481
|
onCellPointerMove
|
|
9414
9482
|
}) {
|
|
9415
|
-
const [textColumn, setTextColumn] =
|
|
9483
|
+
const [textColumn, setTextColumn] = useState27();
|
|
9416
9484
|
const resizeColumnKey = resize ? columns.find((column) => !getCellProps(column).hidden)?.key : void 0;
|
|
9417
|
-
return /* @__PURE__ */
|
|
9485
|
+
return /* @__PURE__ */ jsx35(
|
|
9418
9486
|
"tr",
|
|
9419
9487
|
{
|
|
9420
9488
|
"data-row-key": String(row.key),
|
|
@@ -9430,7 +9498,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
9430
9498
|
if (columnIndex > 0 && !visibleColumns.has(columns[columnIndex - 1].key)) return null;
|
|
9431
9499
|
let count = 1;
|
|
9432
9500
|
while (columnIndex + count < columns.length && !visibleColumns.has(columns[columnIndex + count].key)) count++;
|
|
9433
|
-
return /* @__PURE__ */
|
|
9501
|
+
return /* @__PURE__ */ jsx35("td", { colSpan: count, "aria-hidden": "true", style: { padding: 0 } }, `spacer-${column.key}`);
|
|
9434
9502
|
}
|
|
9435
9503
|
const pluginCellProps = getCellProps(column);
|
|
9436
9504
|
if (pluginCellProps.hidden) return null;
|
|
@@ -9441,7 +9509,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
9441
9509
|
const fixedStyle = fixed === "left" ? { left: leftOffsets.get(column.key) } : fixed === "right" ? { right: rightOffsets.get(column.key) } : void 0;
|
|
9442
9510
|
const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
9443
9511
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
9444
|
-
return /* @__PURE__ */
|
|
9512
|
+
return /* @__PURE__ */ jsxs30(
|
|
9445
9513
|
"td",
|
|
9446
9514
|
{
|
|
9447
9515
|
"data-column-key": column.key,
|
|
@@ -9466,7 +9534,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
9466
9534
|
},
|
|
9467
9535
|
onPointerMove: (event) => onCellPointerMove(column, event),
|
|
9468
9536
|
children: [
|
|
9469
|
-
!canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && (column.render || textColumn === column.key)) ? /* @__PURE__ */
|
|
9537
|
+
!canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && (column.render || textColumn === column.key)) ? /* @__PURE__ */ jsx35(
|
|
9470
9538
|
TableCellContent,
|
|
9471
9539
|
{
|
|
9472
9540
|
ellipsis: column.ellipsis !== false,
|
|
@@ -9474,7 +9542,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
9474
9542
|
children: pluginCellProps.content !== void 0 ? pluginCellProps.content : column.render ? column.render(value, row.record, row.sourceIndex, { row, rowIndex, column }) : value
|
|
9475
9543
|
}
|
|
9476
9544
|
) : null,
|
|
9477
|
-
resize && column.key === resizeColumnKey ? /* @__PURE__ */
|
|
9545
|
+
resize && column.key === resizeColumnKey ? /* @__PURE__ */ jsx35(RowResizeHandle, { height: rowHeight, ...resize }) : null
|
|
9478
9546
|
]
|
|
9479
9547
|
},
|
|
9480
9548
|
column.key
|
|
@@ -9525,8 +9593,8 @@ function TableInner(props, ref) {
|
|
|
9525
9593
|
style,
|
|
9526
9594
|
...htmlProps
|
|
9527
9595
|
} = props;
|
|
9528
|
-
const [localRowHeights, setLocalRowHeights] =
|
|
9529
|
-
const [rowHeightPreview, setRowHeightPreview] =
|
|
9596
|
+
const [localRowHeights, setLocalRowHeights] = useState27({});
|
|
9597
|
+
const [rowHeightPreview, setRowHeightPreview] = useState27(null);
|
|
9530
9598
|
const configuredRowHeights = rowHeights ?? localRowHeights;
|
|
9531
9599
|
const effectiveRowHeights = useMemo10(() => rowHeightPreview ? { ...configuredRowHeights, [rowHeightPreview.key]: rowHeightPreview.height } : configuredRowHeights, [configuredRowHeights, rowHeightPreview]);
|
|
9532
9600
|
const resizeMin = Math.max(SIZE_ROW_HEIGHT[size], Number.isFinite(minRowHeight) ? minRowHeight : SIZE_ROW_HEIGHT[size]);
|
|
@@ -9536,25 +9604,25 @@ function TableInner(props, ref) {
|
|
|
9536
9604
|
if (rowHeights === void 0) setLocalRowHeights((previous) => ({ ...previous, [String(row.key)]: height2 }));
|
|
9537
9605
|
onRowHeightChange?.(row.record, height2, row.sourceIndex);
|
|
9538
9606
|
}, [rowHeights, onRowHeightChange]);
|
|
9539
|
-
const rootRef =
|
|
9607
|
+
const rootRef = useRef27(null);
|
|
9540
9608
|
const remainingHeight = useRemainingHeight(rootRef, height == null && tableHeight == null ? fillRemaining : false);
|
|
9541
|
-
const scrollRef =
|
|
9542
|
-
const cellFocusRequest =
|
|
9543
|
-
const cellGlow =
|
|
9544
|
-
|
|
9609
|
+
const scrollRef = useRef27(null);
|
|
9610
|
+
const cellFocusRequest = useRef27(0);
|
|
9611
|
+
const cellGlow = useRef27(null);
|
|
9612
|
+
useEffect19(() => () => {
|
|
9545
9613
|
cellFocusRequest.current++;
|
|
9546
9614
|
cellGlow.current?.();
|
|
9547
9615
|
}, []);
|
|
9548
|
-
const tableRef =
|
|
9616
|
+
const tableRef = useRef27(null);
|
|
9549
9617
|
useScrollbarProximity();
|
|
9550
|
-
const scrollbarDragRef =
|
|
9551
|
-
const [internalLoading, setInternalLoading] =
|
|
9552
|
-
const [scrollTop, setScrollTop] =
|
|
9553
|
-
const [scrollLeft, setScrollLeft] =
|
|
9554
|
-
const [viewportHeight, setViewportHeight] =
|
|
9555
|
-
const [viewportWidth, setViewportWidth] =
|
|
9556
|
-
const [autoColumnWidths, setAutoColumnWidths] =
|
|
9557
|
-
const [resolveRowIdentity] =
|
|
9618
|
+
const scrollbarDragRef = useRef27(null);
|
|
9619
|
+
const [internalLoading, setInternalLoading] = useState27(false);
|
|
9620
|
+
const [scrollTop, setScrollTop] = useState27(0);
|
|
9621
|
+
const [scrollLeft, setScrollLeft] = useState27(0);
|
|
9622
|
+
const [viewportHeight, setViewportHeight] = useState27(420);
|
|
9623
|
+
const [viewportWidth, setViewportWidth] = useState27(0);
|
|
9624
|
+
const [autoColumnWidths, setAutoColumnWidths] = useState27({});
|
|
9625
|
+
const [resolveRowIdentity] = useState27(createRowIdentity);
|
|
9558
9626
|
const getRowKey = useCallback2((record, index) => resolveRowIdentity(record, index, typeof rowKey === "function" ? rowKey : rowKey == null ? void 0 : String(rowKey)), [rowKey, resolveRowIdentity]);
|
|
9559
9627
|
const builtInResizePlugin = useMemo10(() => createResizePlugin(), []);
|
|
9560
9628
|
const builtInHighlightPlugin = useMemo10(() => createHighlightPlugin(), []);
|
|
@@ -9569,14 +9637,14 @@ function TableInner(props, ref) {
|
|
|
9569
9637
|
return plugins;
|
|
9570
9638
|
}, [builtInHighlightPlugin, builtInResizePlugin, builtInCellSelectionPlugin, builtInIndexPlugin, providedPlugins, resizable, cellSelection, showIndex]);
|
|
9571
9639
|
const sortedPlugins = useMemo10(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
|
|
9572
|
-
const pluginsByIdRef =
|
|
9640
|
+
const pluginsByIdRef = useRef27(/* @__PURE__ */ new Map());
|
|
9573
9641
|
pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
9574
|
-
const [pluginStates, setPluginStates] =
|
|
9642
|
+
const [pluginStates, setPluginStates] = useState27(() => Object.fromEntries(
|
|
9575
9643
|
sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
|
|
9576
9644
|
));
|
|
9577
|
-
const pluginApisRef =
|
|
9578
|
-
const contextsRef =
|
|
9579
|
-
const mountedPluginsRef =
|
|
9645
|
+
const pluginApisRef = useRef27({});
|
|
9646
|
+
const contextsRef = useRef27(/* @__PURE__ */ new Map());
|
|
9647
|
+
const mountedPluginsRef = useRef27(/* @__PURE__ */ new Map());
|
|
9580
9648
|
const pipeline = { columns: baseColumns, rows: createTableRows(dataSource, getRowKey) };
|
|
9581
9649
|
const nextApis = {};
|
|
9582
9650
|
const contexts = /* @__PURE__ */ new Map();
|
|
@@ -9633,7 +9701,7 @@ function TableInner(props, ref) {
|
|
|
9633
9701
|
});
|
|
9634
9702
|
pluginApisRef.current = nextApis;
|
|
9635
9703
|
contextsRef.current = contexts;
|
|
9636
|
-
|
|
9704
|
+
useEffect19(() => {
|
|
9637
9705
|
const activePlugins2 = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
9638
9706
|
for (const [pluginId, mounted] of mountedPluginsRef.current) {
|
|
9639
9707
|
if (activePlugins2.get(pluginId) === mounted.plugin) continue;
|
|
@@ -9645,7 +9713,7 @@ function TableInner(props, ref) {
|
|
|
9645
9713
|
mountedPluginsRef.current.set(plugin.id, { plugin, cleanup: plugin.onMount(contextsRef.current.get(plugin.id)) });
|
|
9646
9714
|
}
|
|
9647
9715
|
}, [sortedPlugins]);
|
|
9648
|
-
|
|
9716
|
+
useEffect19(() => () => {
|
|
9649
9717
|
for (const mounted of mountedPluginsRef.current.values()) mounted.cleanup?.();
|
|
9650
9718
|
mountedPluginsRef.current.clear();
|
|
9651
9719
|
}, []);
|
|
@@ -9689,7 +9757,7 @@ function TableInner(props, ref) {
|
|
|
9689
9757
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-size", `${verticalThumb}px`);
|
|
9690
9758
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-position", `${verticalPosition}px`);
|
|
9691
9759
|
}, []);
|
|
9692
|
-
|
|
9760
|
+
useEffect19(() => {
|
|
9693
9761
|
const element = scrollRef.current;
|
|
9694
9762
|
if (!element || typeof ResizeObserver === "undefined") return;
|
|
9695
9763
|
const observer = new ResizeObserver(() => {
|
|
@@ -9702,19 +9770,19 @@ function TableInner(props, ref) {
|
|
|
9702
9770
|
updateScrollMetrics();
|
|
9703
9771
|
return () => observer.disconnect();
|
|
9704
9772
|
}, [updateScrollMetrics]);
|
|
9705
|
-
|
|
9773
|
+
useEffect19(() => {
|
|
9706
9774
|
updateScrollMetrics();
|
|
9707
9775
|
});
|
|
9708
9776
|
const orderedColumns = useMemo10(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
|
|
9709
9777
|
const leafColumns = useMemo10(() => flattenTableColumns(orderedColumns), [orderedColumns]);
|
|
9710
9778
|
const headerRows = useMemo10(() => buildHeaderRows(orderedColumns), [orderedColumns]);
|
|
9711
|
-
const measuredCells =
|
|
9779
|
+
const measuredCells = useRef27(/* @__PURE__ */ new WeakSet());
|
|
9712
9780
|
const autoWidthSignature = leafColumns.map((column) => `${column.key}:${column.autoWidth}:${resizedWidths[column.key] ?? ""}`).join("|");
|
|
9713
|
-
|
|
9781
|
+
useEffect19(() => {
|
|
9714
9782
|
measuredCells.current = /* @__PURE__ */ new WeakSet();
|
|
9715
9783
|
setAutoColumnWidths({});
|
|
9716
9784
|
}, [dataSource, baseColumns, size, autoWidthSignature]);
|
|
9717
|
-
|
|
9785
|
+
useEffect19(() => {
|
|
9718
9786
|
const autoWidthColumns = leafColumns.filter((column) => column.autoWidth && resizedWidths[column.key] === void 0);
|
|
9719
9787
|
const root = rootRef.current;
|
|
9720
9788
|
if (!root || autoWidthColumns.length === 0) return;
|
|
@@ -9826,20 +9894,20 @@ function TableInner(props, ref) {
|
|
|
9826
9894
|
]);
|
|
9827
9895
|
const toolbarStart = sortedPlugins.map((plugin) => {
|
|
9828
9896
|
const content = plugin.renderToolbarStart?.(getContext(plugin));
|
|
9829
|
-
return content ? /* @__PURE__ */
|
|
9897
|
+
return content ? /* @__PURE__ */ jsx35(Fragment12, { children: content }, `toolbar-start-${plugin.id}`) : null;
|
|
9830
9898
|
}).filter(Boolean);
|
|
9831
9899
|
const toolbarEnd = sortedPlugins.map((plugin) => {
|
|
9832
9900
|
const content = plugin.renderToolbarEnd?.(getContext(plugin));
|
|
9833
|
-
return content ? /* @__PURE__ */
|
|
9901
|
+
return content ? /* @__PURE__ */ jsx35(Fragment12, { children: content }, `toolbar-end-${plugin.id}`) : null;
|
|
9834
9902
|
}).filter(Boolean);
|
|
9835
9903
|
const summaries = sortedPlugins.flatMap((plugin) => plugin.renderSummary?.(getContext(plugin)) ?? []);
|
|
9836
9904
|
const footers = sortedPlugins.map((plugin) => {
|
|
9837
9905
|
const content = plugin.renderFooter?.(getContext(plugin));
|
|
9838
|
-
return content ? /* @__PURE__ */
|
|
9906
|
+
return content ? /* @__PURE__ */ jsx35(Fragment12, { children: content }, `footer-${plugin.id}`) : null;
|
|
9839
9907
|
}).filter(Boolean);
|
|
9840
9908
|
const overlays = sortedPlugins.map((plugin) => {
|
|
9841
9909
|
const content = plugin.renderOverlay?.(getContext(plugin));
|
|
9842
|
-
return content ? /* @__PURE__ */
|
|
9910
|
+
return content ? /* @__PURE__ */ jsx35(Fragment12, { children: content }, `overlay-${plugin.id}`) : null;
|
|
9843
9911
|
}).filter(Boolean);
|
|
9844
9912
|
const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
|
|
9845
9913
|
const effectiveHeight = height ?? tableHeight ?? remainingHeight ?? (shouldVirtualize && maxBodyHeight == null ? 420 : void 0);
|
|
@@ -10016,10 +10084,10 @@ function TableInner(props, ref) {
|
|
|
10016
10084
|
}
|
|
10017
10085
|
function renderHeaderContent(column, content) {
|
|
10018
10086
|
const title = getHeaderTitleText(column.title ?? column.name) || column.name || column.key;
|
|
10019
|
-
return /* @__PURE__ */
|
|
10020
|
-
column.required && /* @__PURE__ */
|
|
10021
|
-
/* @__PURE__ */
|
|
10022
|
-
column.description != null && /* @__PURE__ */
|
|
10087
|
+
return /* @__PURE__ */ jsxs30("span", { className: `sia-table__header-label${column.required ? " sia-table__header-label--required" : ""}`, children: [
|
|
10088
|
+
column.required && /* @__PURE__ */ jsx35("span", { className: "sia-table__required-mark", "aria-hidden": "true", children: "*" }),
|
|
10089
|
+
/* @__PURE__ */ jsx35("span", { className: "sia-table__header-label-content", "data-sia-title-overflow-only": true, ...withTitleTooltip({ title }), children: content }),
|
|
10090
|
+
column.description != null && /* @__PURE__ */ jsx35(Tooltip, { title: column.description, placement: "top", trigger: ["hover", "focus"], children: /* @__PURE__ */ jsx35("button", { type: "button", className: "sia-table__header-description", "aria-label": `${column.name ?? column.key}\u5217\u8BF4\u660E`, onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx35(Icon, { name: "info", size: 14 }) }) })
|
|
10023
10091
|
] });
|
|
10024
10092
|
}
|
|
10025
10093
|
function getPluginCellProps(row, column) {
|
|
@@ -10059,17 +10127,17 @@ function TableInner(props, ref) {
|
|
|
10059
10127
|
}
|
|
10060
10128
|
function renderSummaryRow(summary) {
|
|
10061
10129
|
let labelRendered = false;
|
|
10062
|
-
return /* @__PURE__ */
|
|
10130
|
+
return /* @__PURE__ */ jsx35("tr", { className: `sia-table__summary-row ${summary.className ?? ""}`.trim(), children: leafColumns.map((column) => {
|
|
10063
10131
|
const value = summary.values[column.key];
|
|
10064
10132
|
const isLabel = value === void 0 && !labelRendered && summary.label !== void 0;
|
|
10065
10133
|
const content = value !== void 0 ? value : isLabel ? (labelRendered = true, summary.label) : null;
|
|
10066
10134
|
const fixed = normalizeFixed(column.fixed);
|
|
10067
10135
|
const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
10068
10136
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
10069
|
-
return /* @__PURE__ */
|
|
10137
|
+
return /* @__PURE__ */ jsx35("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__ */ jsx35("span", { className: "sia-table__summary-label", children: content }) : content }, column.key);
|
|
10070
10138
|
}) }, summary.key);
|
|
10071
10139
|
}
|
|
10072
|
-
return /* @__PURE__ */
|
|
10140
|
+
return /* @__PURE__ */ jsxs30(
|
|
10073
10141
|
"div",
|
|
10074
10142
|
{
|
|
10075
10143
|
ref: rootRef,
|
|
@@ -10120,19 +10188,19 @@ function TableInner(props, ref) {
|
|
|
10120
10188
|
htmlProps.onDoubleClickCapture?.(event);
|
|
10121
10189
|
},
|
|
10122
10190
|
children: [
|
|
10123
|
-
hasToolbar ? /* @__PURE__ */
|
|
10124
|
-
/* @__PURE__ */
|
|
10125
|
-
/* @__PURE__ */
|
|
10191
|
+
hasToolbar ? /* @__PURE__ */ jsxs30("div", { className: "sia-table__toolbar", children: [
|
|
10192
|
+
/* @__PURE__ */ jsx35("div", { children: toolbarStart }),
|
|
10193
|
+
/* @__PURE__ */ jsx35("div", { children: toolbarEnd })
|
|
10126
10194
|
] }) : null,
|
|
10127
|
-
/* @__PURE__ */
|
|
10128
|
-
/* @__PURE__ */
|
|
10129
|
-
/* @__PURE__ */
|
|
10130
|
-
/* @__PURE__ */
|
|
10195
|
+
/* @__PURE__ */ jsxs30("div", { className: "sia-table__viewport-wrap", style: viewportStyle, children: [
|
|
10196
|
+
/* @__PURE__ */ jsx35("div", { className: "sia-table__viewport", ref: scrollRef, onScroll: handleScroll, children: /* @__PURE__ */ jsxs30("table", { ref: tableRef, className: "sia-table__element", style: { width: Math.max(totalWidth, 1), ...manualColumnLayout ? { minWidth: 0 } : {}, ...tableStyle }, children: [
|
|
10197
|
+
/* @__PURE__ */ jsx35("colgroup", { children: leafColumns.map((column) => /* @__PURE__ */ jsx35("col", { "data-column-key": column.key, style: { width: columnWidths.get(column.key) ?? DEFAULT_WIDTH } }, column.key)) }),
|
|
10198
|
+
/* @__PURE__ */ jsx35("thead", { className: stickyHeader ? "sia-table__head sia-table__head--sticky" : "sia-table__head", children: headerRows.map((headerRow, depth) => /* @__PURE__ */ jsx35("tr", { children: headerRow.map((cell) => {
|
|
10131
10199
|
const fixed = cell.fixed;
|
|
10132
10200
|
const pluginHeaderProps = getPluginHeaderCellProps(cell.column);
|
|
10133
10201
|
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" : "";
|
|
10134
10202
|
const autoWidthClass = cell.column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
10135
|
-
return /* @__PURE__ */
|
|
10203
|
+
return /* @__PURE__ */ jsx35(
|
|
10136
10204
|
"th",
|
|
10137
10205
|
{
|
|
10138
10206
|
"data-column-key": cell.column.key,
|
|
@@ -10153,10 +10221,10 @@ function TableInner(props, ref) {
|
|
|
10153
10221
|
`${cell.column.key}-${depth}-${cell.firstLeafKey}`
|
|
10154
10222
|
);
|
|
10155
10223
|
}) }, depth)) }),
|
|
10156
|
-
/* @__PURE__ */
|
|
10157
|
-
maxBodyHeight != null && pipeline.rows.length === 0 ? /* @__PURE__ */
|
|
10158
|
-
pipeline.rows.length === 0 && summaries.length > 0 ? /* @__PURE__ */
|
|
10159
|
-
topSpacer > 0 ? /* @__PURE__ */
|
|
10224
|
+
/* @__PURE__ */ jsxs30("tbody", { children: [
|
|
10225
|
+
maxBodyHeight != null && pipeline.rows.length === 0 ? /* @__PURE__ */ jsx35("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx35("td", { colSpan: leafColumns.length, style: { height: 120, padding: 0, border: 0 } }) }) : null,
|
|
10226
|
+
pipeline.rows.length === 0 && summaries.length > 0 ? /* @__PURE__ */ jsx35("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx35("td", { colSpan: leafColumns.length, style: { height: Math.max(0, viewportHeight - (headerRows.length + summaries.length) * rowHeight), padding: 0, border: 0 } }) }) : null,
|
|
10227
|
+
topSpacer > 0 ? /* @__PURE__ */ jsx35("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx35("td", { colSpan: leafColumns.length, style: { height: topSpacer, padding: 0, border: 0 } }) }) : null,
|
|
10160
10228
|
renderedRows.map((row, offset) => {
|
|
10161
10229
|
const cached = rowElements.get(row.key);
|
|
10162
10230
|
if (cached) return cached;
|
|
@@ -10165,7 +10233,7 @@ function TableInner(props, ref) {
|
|
|
10165
10233
|
const status = typeof rowStatus === "function" ? rowStatus(row.record, row.sourceIndex) : rowStatus;
|
|
10166
10234
|
const statusClass = status ? `sia-table__row--${status}` : "";
|
|
10167
10235
|
const customClass = typeof rowClassName === "function" ? rowClassName(row.record, row.sourceIndex) : rowClassName ?? "";
|
|
10168
|
-
const element = /* @__PURE__ */
|
|
10236
|
+
const element = /* @__PURE__ */ jsx35(
|
|
10169
10237
|
TableBodyRow,
|
|
10170
10238
|
{
|
|
10171
10239
|
canvas,
|
|
@@ -10226,13 +10294,13 @@ function TableInner(props, ref) {
|
|
|
10226
10294
|
rowElements.set(row.key, element);
|
|
10227
10295
|
return element;
|
|
10228
10296
|
}),
|
|
10229
|
-
bottomSpacer > 0 ? /* @__PURE__ */
|
|
10297
|
+
bottomSpacer > 0 ? /* @__PURE__ */ jsx35("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx35("td", { colSpan: leafColumns.length, style: { height: bottomSpacer, padding: 0, border: 0 } }) }) : null
|
|
10230
10298
|
] }),
|
|
10231
|
-
summaries.length > 0 ? /* @__PURE__ */
|
|
10299
|
+
summaries.length > 0 ? /* @__PURE__ */ jsx35("tfoot", { className: "sia-table__summary", children: summaries.map(renderSummaryRow) }) : null
|
|
10232
10300
|
] }) }),
|
|
10233
|
-
pipeline.rows.length === 0 ? /* @__PURE__ */
|
|
10234
|
-
canvas ? /* @__PURE__ */
|
|
10235
|
-
/* @__PURE__ */
|
|
10301
|
+
pipeline.rows.length === 0 ? /* @__PURE__ */ jsx35("div", { className: "sia-table__empty", role: "status", children: emptyText }) : null,
|
|
10302
|
+
canvas ? /* @__PURE__ */ jsx35(TableCanvasLayer, { viewport: scrollRef, rows: pipeline.rows, columns: leafColumns, widths: columnWidths, rowHeight, headerHeight: headerRows.length * rowHeight }) : null,
|
|
10303
|
+
/* @__PURE__ */ jsx35(
|
|
10236
10304
|
"div",
|
|
10237
10305
|
{
|
|
10238
10306
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--horizontal",
|
|
@@ -10243,10 +10311,10 @@ function TableInner(props, ref) {
|
|
|
10243
10311
|
onPointerMove: handleScrollbarPointerMove,
|
|
10244
10312
|
onPointerUp: handleScrollbarPointerEnd,
|
|
10245
10313
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
10246
|
-
children: /* @__PURE__ */
|
|
10314
|
+
children: /* @__PURE__ */ jsx35("div", { className: "sia-table__scrollbar-thumb" })
|
|
10247
10315
|
}
|
|
10248
10316
|
),
|
|
10249
|
-
/* @__PURE__ */
|
|
10317
|
+
/* @__PURE__ */ jsx35(
|
|
10250
10318
|
"div",
|
|
10251
10319
|
{
|
|
10252
10320
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--vertical",
|
|
@@ -10257,21 +10325,21 @@ function TableInner(props, ref) {
|
|
|
10257
10325
|
onPointerMove: handleScrollbarPointerMove,
|
|
10258
10326
|
onPointerUp: handleScrollbarPointerEnd,
|
|
10259
10327
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
10260
|
-
children: /* @__PURE__ */
|
|
10328
|
+
children: /* @__PURE__ */ jsx35("div", { className: "sia-table__scrollbar-thumb" })
|
|
10261
10329
|
}
|
|
10262
10330
|
)
|
|
10263
10331
|
] }),
|
|
10264
|
-
footers.length > 0 ? /* @__PURE__ */
|
|
10265
|
-
loading || internalLoading ? /* @__PURE__ */
|
|
10266
|
-
/* @__PURE__ */
|
|
10267
|
-
/* @__PURE__ */
|
|
10332
|
+
footers.length > 0 ? /* @__PURE__ */ jsx35("div", { className: "sia-table__footer", children: footers }) : null,
|
|
10333
|
+
loading || internalLoading ? /* @__PURE__ */ jsxs30("div", { className: "sia-table__loading", role: "status", children: [
|
|
10334
|
+
/* @__PURE__ */ jsx35(Icon, { name: "loader", size: 22, spin: true }),
|
|
10335
|
+
/* @__PURE__ */ jsx35("span", { children: "\u52A0\u8F7D\u4E2D" })
|
|
10268
10336
|
] }) : null,
|
|
10269
10337
|
overlays
|
|
10270
10338
|
]
|
|
10271
10339
|
}
|
|
10272
10340
|
);
|
|
10273
10341
|
}
|
|
10274
|
-
var Table =
|
|
10342
|
+
var Table = forwardRef13(TableInner);
|
|
10275
10343
|
|
|
10276
10344
|
// src/components/Table/worksheetModel.ts
|
|
10277
10345
|
function parseWorksheetText(text) {
|
|
@@ -10337,7 +10405,7 @@ function incrementWorksheetValue(value, offset) {
|
|
|
10337
10405
|
}
|
|
10338
10406
|
|
|
10339
10407
|
// src/components/Table/worksheet.tsx
|
|
10340
|
-
import { Fragment as
|
|
10408
|
+
import { Fragment as Fragment13, jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
10341
10409
|
var isEmpty2 = (value) => value == null || value === "";
|
|
10342
10410
|
var editorKind = (column) => !column.editable ? "readonly" : typeof column.editable === "object" ? column.editable.type ?? "input" : "input";
|
|
10343
10411
|
var nativeEditor = (target) => target instanceof Element && Boolean(
|
|
@@ -10765,9 +10833,9 @@ function createWorksheetPlugin(options) {
|
|
|
10765
10833
|
const area = bounds(), cols = columns();
|
|
10766
10834
|
const handle = area && context.rows[area.bottom]?.key === info.row.key && cols[area.right]?.key === column.key && // 填充入口与编辑权限一致,避免只读格或保存锁定后仍暗示可以拖拽修改。
|
|
10767
10835
|
editable(record, column) && (suppressEditing || !context.state.editing);
|
|
10768
|
-
return /* @__PURE__ */
|
|
10836
|
+
return /* @__PURE__ */ jsxs31(Fragment13, { children: [
|
|
10769
10837
|
render ? render(value, record, index, info) : value,
|
|
10770
|
-
handle && /* @__PURE__ */
|
|
10838
|
+
handle && /* @__PURE__ */ jsx36(
|
|
10771
10839
|
"button",
|
|
10772
10840
|
{
|
|
10773
10841
|
type: "button",
|
|
@@ -10813,25 +10881,25 @@ function createWorksheetPlugin(options) {
|
|
|
10813
10881
|
},
|
|
10814
10882
|
renderToolbarStart(current) {
|
|
10815
10883
|
remember(current);
|
|
10816
|
-
return options.toolbar === false ? null : /* @__PURE__ */
|
|
10817
|
-
/* @__PURE__ */
|
|
10884
|
+
return options.toolbar === false ? null : /* @__PURE__ */ jsxs31("span", { className: "sia-table__worksheet-tools", children: [
|
|
10885
|
+
/* @__PURE__ */ jsx36(
|
|
10818
10886
|
Button,
|
|
10819
10887
|
{
|
|
10820
10888
|
variant: "text",
|
|
10821
10889
|
size: "small",
|
|
10822
|
-
icon: /* @__PURE__ */
|
|
10890
|
+
icon: /* @__PURE__ */ jsx36(Icon, { name: "undo" }),
|
|
10823
10891
|
disabled: !undoStack.length,
|
|
10824
10892
|
title: "\u64A4\u9500\uFF08Ctrl/Cmd + Z\uFF09",
|
|
10825
10893
|
onClick: api.undo,
|
|
10826
10894
|
children: "\u64A4\u9500"
|
|
10827
10895
|
}
|
|
10828
10896
|
),
|
|
10829
|
-
/* @__PURE__ */
|
|
10897
|
+
/* @__PURE__ */ jsx36(
|
|
10830
10898
|
Button,
|
|
10831
10899
|
{
|
|
10832
10900
|
variant: "text",
|
|
10833
10901
|
size: "small",
|
|
10834
|
-
icon: /* @__PURE__ */
|
|
10902
|
+
icon: /* @__PURE__ */ jsx36(Icon, { name: "redo" }),
|
|
10835
10903
|
disabled: !redoStack.length,
|
|
10836
10904
|
title: "\u6062\u590D\uFF08Ctrl/Cmd + Shift + Z \u6216 Ctrl/Cmd + Y\uFF09",
|
|
10837
10905
|
onClick: api.redo,
|
|
@@ -10842,7 +10910,7 @@ function createWorksheetPlugin(options) {
|
|
|
10842
10910
|
},
|
|
10843
10911
|
renderOverlay(current) {
|
|
10844
10912
|
remember(current);
|
|
10845
|
-
return /* @__PURE__ */
|
|
10913
|
+
return /* @__PURE__ */ jsx36(
|
|
10846
10914
|
"span",
|
|
10847
10915
|
{
|
|
10848
10916
|
hidden: true,
|
|
@@ -10929,16 +10997,16 @@ function createWorksheetPlugin(options) {
|
|
|
10929
10997
|
}
|
|
10930
10998
|
|
|
10931
10999
|
// src/components/Video.tsx
|
|
10932
|
-
import { forwardRef as
|
|
10933
|
-
import { jsx as
|
|
10934
|
-
var Video =
|
|
10935
|
-
return /* @__PURE__ */
|
|
11000
|
+
import { forwardRef as forwardRef14 } from "react";
|
|
11001
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
11002
|
+
var Video = forwardRef14(function Video2({ controls = true, muted = false, playsInline = true, className = "", ...props }, ref) {
|
|
11003
|
+
return /* @__PURE__ */ jsx37("video", { ...props, ref, controls, muted, playsInline, className: `sia-video ${className}`.trim() });
|
|
10936
11004
|
});
|
|
10937
11005
|
|
|
10938
11006
|
// src/components/InputSelect.tsx
|
|
10939
|
-
import { forwardRef as
|
|
10940
|
-
import { jsx as
|
|
10941
|
-
var InputSelect =
|
|
11007
|
+
import { forwardRef as forwardRef15, useEffect as useEffect20, useRef as useRef28, useState as useState28 } from "react";
|
|
11008
|
+
import { jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
11009
|
+
var InputSelect = forwardRef15(function InputSelect2({
|
|
10942
11010
|
options,
|
|
10943
11011
|
value,
|
|
10944
11012
|
defaultValue,
|
|
@@ -10964,22 +11032,22 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10964
11032
|
...inputProps
|
|
10965
11033
|
}, forwardedRef) {
|
|
10966
11034
|
const size = useControlSize(sizeProp);
|
|
10967
|
-
const [internal, setInternal] =
|
|
11035
|
+
const [internal, setInternal] = useState28(defaultValue);
|
|
10968
11036
|
const current = value !== void 0 ? value : internal;
|
|
10969
11037
|
const values = normalizeSelectionValues(current == null ? [] : Array.isArray(current) ? current : [current], options);
|
|
10970
11038
|
const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
|
|
10971
|
-
const [draft, setDraft] =
|
|
10972
|
-
|
|
11039
|
+
const [draft, setDraft] = useState28(text);
|
|
11040
|
+
useEffect20(() => {
|
|
10973
11041
|
setDraft(text);
|
|
10974
11042
|
}, [text, current]);
|
|
10975
|
-
const [open, setOpen] =
|
|
10976
|
-
const [search, setSearch] =
|
|
10977
|
-
const [modalOpen, setModalOpen] =
|
|
10978
|
-
const [modalValues, setModalValues] =
|
|
10979
|
-
const [selectedOnly, setSelectedOnly] =
|
|
10980
|
-
const rootRef =
|
|
10981
|
-
const popupRef =
|
|
10982
|
-
const inputRef =
|
|
11043
|
+
const [open, setOpen] = useState28(false);
|
|
11044
|
+
const [search, setSearch] = useState28("");
|
|
11045
|
+
const [modalOpen, setModalOpen] = useState28(false);
|
|
11046
|
+
const [modalValues, setModalValues] = useState28([]);
|
|
11047
|
+
const [selectedOnly, setSelectedOnly] = useState28(false);
|
|
11048
|
+
const rootRef = useRef28(null);
|
|
11049
|
+
const popupRef = useRef28(null);
|
|
11050
|
+
const inputRef = useRef28(null);
|
|
10983
11051
|
const config = typeof enableModal === "object" ? enableModal : {};
|
|
10984
11052
|
function changeOpen(next) {
|
|
10985
11053
|
if (next && (disabled || loading)) return;
|
|
@@ -10999,7 +11067,7 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10999
11067
|
inputRef.current?.focus();
|
|
11000
11068
|
}
|
|
11001
11069
|
}
|
|
11002
|
-
|
|
11070
|
+
useEffect20(() => {
|
|
11003
11071
|
if (!open) return;
|
|
11004
11072
|
const outside = (event) => {
|
|
11005
11073
|
if (!rootRef.current?.contains(event.target) && !popupRef.current?.contains(event.target)) changeOpen(false);
|
|
@@ -11007,7 +11075,7 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
11007
11075
|
document.addEventListener("pointerdown", outside);
|
|
11008
11076
|
return () => document.removeEventListener("pointerdown", outside);
|
|
11009
11077
|
}, [open, onOpenChange]);
|
|
11010
|
-
|
|
11078
|
+
useEffect20(() => {
|
|
11011
11079
|
if (disabled || loading) {
|
|
11012
11080
|
changeOpen(false);
|
|
11013
11081
|
setModalOpen(false);
|
|
@@ -11020,14 +11088,14 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
11020
11088
|
setSelectedOnly(false);
|
|
11021
11089
|
setModalOpen(true);
|
|
11022
11090
|
}
|
|
11023
|
-
return /* @__PURE__ */
|
|
11091
|
+
return /* @__PURE__ */ jsxs32("div", { ref: rootRef, style, className: `sia-input-select${open || modalOpen ? " is-open" : ""} ${className}`, onKeyDown: (event) => {
|
|
11024
11092
|
if (event.key === "Escape" && open) {
|
|
11025
11093
|
event.stopPropagation();
|
|
11026
11094
|
changeOpen(false);
|
|
11027
11095
|
inputRef.current?.focus();
|
|
11028
11096
|
}
|
|
11029
11097
|
}, children: [
|
|
11030
|
-
/* @__PURE__ */
|
|
11098
|
+
/* @__PURE__ */ jsx38(
|
|
11031
11099
|
Input,
|
|
11032
11100
|
{
|
|
11033
11101
|
...inputProps,
|
|
@@ -11064,26 +11132,26 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
11064
11132
|
emit(parseInput ? parseInput(next) : multiple ? next.split(",").map((item) => item.trim()).filter(Boolean) : next);
|
|
11065
11133
|
changeOpen(true);
|
|
11066
11134
|
},
|
|
11067
|
-
suffix: /* @__PURE__ */
|
|
11068
|
-
allowClear && draft && !disabled && /* @__PURE__ */
|
|
11135
|
+
suffix: /* @__PURE__ */ jsxs32("span", { className: "sia-input-select__suffix", children: [
|
|
11136
|
+
allowClear && draft && !disabled && /* @__PURE__ */ jsx38(Button, { className: "sia-input-select__clear", variant: "text", size: "small", disabled: loading, "aria-label": "\u6E05\u9664\u8F93\u5165\u9009\u62E9", onClick: (event) => {
|
|
11069
11137
|
event.stopPropagation();
|
|
11070
11138
|
setDraft("");
|
|
11071
11139
|
emit(multiple ? [] : void 0);
|
|
11072
11140
|
inputRef.current?.focus();
|
|
11073
11141
|
}, children: "\xD7" }),
|
|
11074
11142
|
suffix,
|
|
11075
|
-
enableModal && /* @__PURE__ */
|
|
11143
|
+
enableModal && /* @__PURE__ */ jsx38(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
|
|
11076
11144
|
event.stopPropagation();
|
|
11077
11145
|
openModal();
|
|
11078
11146
|
}, children: "\u2026" }),
|
|
11079
|
-
/* @__PURE__ */
|
|
11147
|
+
/* @__PURE__ */ jsx38(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
|
|
11080
11148
|
event.stopPropagation();
|
|
11081
11149
|
changeOpen(!open);
|
|
11082
|
-
}, children: /* @__PURE__ */
|
|
11150
|
+
}, children: /* @__PURE__ */ jsx38(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
|
|
11083
11151
|
] })
|
|
11084
11152
|
}
|
|
11085
11153
|
),
|
|
11086
|
-
/* @__PURE__ */
|
|
11154
|
+
/* @__PURE__ */ jsx38(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx38(
|
|
11087
11155
|
SelectionPanel,
|
|
11088
11156
|
{
|
|
11089
11157
|
options,
|
|
@@ -11098,7 +11166,7 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
11098
11166
|
onSearch: setSearch
|
|
11099
11167
|
}
|
|
11100
11168
|
) }),
|
|
11101
|
-
enableModal && /* @__PURE__ */
|
|
11169
|
+
enableModal && /* @__PURE__ */ jsxs32(
|
|
11102
11170
|
Modal,
|
|
11103
11171
|
{
|
|
11104
11172
|
open: modalOpen,
|
|
@@ -11111,15 +11179,15 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
11111
11179
|
setModalOpen(false);
|
|
11112
11180
|
},
|
|
11113
11181
|
children: [
|
|
11114
|
-
/* @__PURE__ */
|
|
11115
|
-
/* @__PURE__ */
|
|
11116
|
-
/* @__PURE__ */
|
|
11182
|
+
/* @__PURE__ */ jsxs32("div", { className: "sia-selection-panel__actions", role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
11183
|
+
/* @__PURE__ */ jsx38(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
11184
|
+
/* @__PURE__ */ jsxs32(Button, { role: "tab", "aria-selected": selectedOnly, variant: selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(true), children: [
|
|
11117
11185
|
"\u5DF2\u9009\u9879(",
|
|
11118
11186
|
modalValues.length,
|
|
11119
11187
|
")"
|
|
11120
11188
|
] })
|
|
11121
11189
|
] }),
|
|
11122
|
-
modalOpen && /* @__PURE__ */
|
|
11190
|
+
modalOpen && /* @__PURE__ */ jsx38(
|
|
11123
11191
|
SelectionPanel,
|
|
11124
11192
|
{
|
|
11125
11193
|
options,
|
|
@@ -11140,10 +11208,10 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
11140
11208
|
});
|
|
11141
11209
|
|
|
11142
11210
|
// src/components/QueryForm.tsx
|
|
11143
|
-
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect9, useRef as
|
|
11211
|
+
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect9, useRef as useRef32, useState as useState31 } from "react";
|
|
11144
11212
|
|
|
11145
11213
|
// src/components/useQueryFormMotion.ts
|
|
11146
|
-
import { useLayoutEffect as useLayoutEffect8, useRef as
|
|
11214
|
+
import { useLayoutEffect as useLayoutEffect8, useRef as useRef29 } from "react";
|
|
11147
11215
|
function readLayout(row) {
|
|
11148
11216
|
const root = row.getBoundingClientRect();
|
|
11149
11217
|
const scaleX = root.width / row.offsetWidth || 1, scaleY = root.height / row.offsetHeight || 1;
|
|
@@ -11156,9 +11224,9 @@ function readLayout(row) {
|
|
|
11156
11224
|
return { height: row.offsetHeight, boxes };
|
|
11157
11225
|
}
|
|
11158
11226
|
function useQueryFormMotion(ref, layoutKey) {
|
|
11159
|
-
const previous =
|
|
11160
|
-
const stop =
|
|
11161
|
-
const snapshot =
|
|
11227
|
+
const previous = useRef29();
|
|
11228
|
+
const stop = useRef29();
|
|
11229
|
+
const snapshot = useRef29();
|
|
11162
11230
|
useLayoutEffect8(() => {
|
|
11163
11231
|
const row = ref.current;
|
|
11164
11232
|
if (!row) return;
|
|
@@ -11267,10 +11335,10 @@ function useQueryFormMotion(ref, layoutKey) {
|
|
|
11267
11335
|
}
|
|
11268
11336
|
|
|
11269
11337
|
// src/components/QueryFormSettings.tsx
|
|
11270
|
-
import { useEffect as
|
|
11338
|
+
import { useEffect as useEffect22, useRef as useRef31, useState as useState30 } from "react";
|
|
11271
11339
|
|
|
11272
11340
|
// src/components/useQueryFieldSort.ts
|
|
11273
|
-
import { useEffect as
|
|
11341
|
+
import { useEffect as useEffect21, useRef as useRef30, useState as useState29 } from "react";
|
|
11274
11342
|
function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
11275
11343
|
const center = rects[from].top + rects[from].height / 2 + dy;
|
|
11276
11344
|
const rest = keys.map((_, index) => index).filter((index) => index !== from);
|
|
@@ -11289,13 +11357,13 @@ function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
|
11289
11357
|
return { ordered, offsets };
|
|
11290
11358
|
}
|
|
11291
11359
|
function useQueryFieldSort(keys, enabled, onCommit) {
|
|
11292
|
-
const listRef =
|
|
11293
|
-
const cancelRef =
|
|
11294
|
-
const commitRef =
|
|
11360
|
+
const listRef = useRef30(null);
|
|
11361
|
+
const cancelRef = useRef30();
|
|
11362
|
+
const commitRef = useRef30(onCommit);
|
|
11295
11363
|
commitRef.current = onCommit;
|
|
11296
|
-
const [preview, setPreview] =
|
|
11364
|
+
const [preview, setPreview] = useState29();
|
|
11297
11365
|
const signature = JSON.stringify(keys);
|
|
11298
|
-
|
|
11366
|
+
useEffect21(() => {
|
|
11299
11367
|
cancelRef.current?.();
|
|
11300
11368
|
return () => cancelRef.current?.();
|
|
11301
11369
|
}, [enabled, signature]);
|
|
@@ -11418,18 +11486,18 @@ function countQueryFieldRows(centers) {
|
|
|
11418
11486
|
}
|
|
11419
11487
|
|
|
11420
11488
|
// src/components/QueryFormSettings.tsx
|
|
11421
|
-
import { Fragment as
|
|
11489
|
+
import { Fragment as Fragment14, jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
11422
11490
|
function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed, disabled) {
|
|
11423
|
-
const [snapshot, setSnapshot] =
|
|
11424
|
-
const [draft, setDraft] =
|
|
11425
|
-
const [open, setOpen] =
|
|
11426
|
-
const [loading, setLoading] =
|
|
11427
|
-
const [saving, setSaving] =
|
|
11428
|
-
const [error, setError] =
|
|
11429
|
-
const [loadFailed, setLoadFailed] =
|
|
11430
|
-
const token =
|
|
11431
|
-
const saveLock =
|
|
11432
|
-
const latest =
|
|
11491
|
+
const [snapshot, setSnapshot] = useState30();
|
|
11492
|
+
const [draft, setDraft] = useState30({ fields: [], defaultCollapsed: defaultCollapsed ?? false });
|
|
11493
|
+
const [open, setOpen] = useState30(false);
|
|
11494
|
+
const [loading, setLoading] = useState30(false);
|
|
11495
|
+
const [saving, setSaving] = useState30(false);
|
|
11496
|
+
const [error, setError] = useState30("");
|
|
11497
|
+
const [loadFailed, setLoadFailed] = useState30(false);
|
|
11498
|
+
const token = useRef31(0);
|
|
11499
|
+
const saveLock = useRef31(false);
|
|
11500
|
+
const latest = useRef31({ config, fields, defaultCollapsed, applyCollapsed });
|
|
11433
11501
|
latest.current = { config, fields, defaultCollapsed, applyCollapsed };
|
|
11434
11502
|
const moduleName = config?.scope.moduleName;
|
|
11435
11503
|
const businessKey = config?.scope.businessKey;
|
|
@@ -11462,7 +11530,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11462
11530
|
if (request === token.current) setLoading(false);
|
|
11463
11531
|
}
|
|
11464
11532
|
}
|
|
11465
|
-
|
|
11533
|
+
useEffect22(() => {
|
|
11466
11534
|
setSnapshot(void 0);
|
|
11467
11535
|
setOpen(false);
|
|
11468
11536
|
setError("");
|
|
@@ -11518,7 +11586,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11518
11586
|
const items = new Map(visibleDraft.map((item) => [item.key, item]));
|
|
11519
11587
|
setDraft((current) => ({ ...current, fields: keys.map((key, order) => ({ ...items.get(key), order })) }));
|
|
11520
11588
|
});
|
|
11521
|
-
const control = /* @__PURE__ */
|
|
11589
|
+
const control = /* @__PURE__ */ jsx39(
|
|
11522
11590
|
Button,
|
|
11523
11591
|
{
|
|
11524
11592
|
type: "button",
|
|
@@ -11527,14 +11595,14 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11527
11595
|
"aria-label": "\u67E5\u8BE2\u8BBE\u7F6E",
|
|
11528
11596
|
disabled: disabled || saving,
|
|
11529
11597
|
loading: loading && !open,
|
|
11530
|
-
icon: /* @__PURE__ */
|
|
11598
|
+
icon: /* @__PURE__ */ jsx39(Icon, { name: "more-vertical" }),
|
|
11531
11599
|
onClick: () => {
|
|
11532
11600
|
setOpen(true);
|
|
11533
11601
|
void load(true);
|
|
11534
11602
|
}
|
|
11535
11603
|
}
|
|
11536
11604
|
);
|
|
11537
|
-
const panel = /* @__PURE__ */
|
|
11605
|
+
const panel = /* @__PURE__ */ jsx39(Fragment14, { children: /* @__PURE__ */ jsx39(
|
|
11538
11606
|
Modal,
|
|
11539
11607
|
{
|
|
11540
11608
|
title: "\u67E5\u8BE2\u8BBE\u7F6E",
|
|
@@ -11547,15 +11615,15 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11547
11615
|
onOpenChange: (next) => {
|
|
11548
11616
|
if (!saveLock.current) setOpen(next);
|
|
11549
11617
|
},
|
|
11550
|
-
children: /* @__PURE__ */
|
|
11551
|
-
loading ? /* @__PURE__ */
|
|
11552
|
-
error ? /* @__PURE__ */
|
|
11618
|
+
children: /* @__PURE__ */ jsxs33("div", { className: "sia-query-settings", children: [
|
|
11619
|
+
loading ? /* @__PURE__ */ jsx39("p", { role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u67E5\u8BE2\u8BBE\u7F6E\u2026" }) : null,
|
|
11620
|
+
error ? /* @__PURE__ */ jsxs33("div", { role: "alert", className: "sia-query-form__error", children: [
|
|
11553
11621
|
error,
|
|
11554
|
-
loadFailed ? /* @__PURE__ */
|
|
11622
|
+
loadFailed ? /* @__PURE__ */ jsx39(Button, { type: "button", variant: "link", onClick: () => void load(true), children: "\u91CD\u8BD5" }) : null
|
|
11555
11623
|
] }) : null,
|
|
11556
|
-
/* @__PURE__ */
|
|
11557
|
-
/* @__PURE__ */
|
|
11558
|
-
/* @__PURE__ */
|
|
11624
|
+
/* @__PURE__ */ jsx39(Checkbox, { checked: draft.defaultCollapsed, disabled: locked, onChange: (checked) => setDraft((current) => ({ ...current, defaultCollapsed: checked })), children: "\u9ED8\u8BA4\u6536\u8D77\u67E5\u8BE2\u6761\u4EF6" }),
|
|
11625
|
+
/* @__PURE__ */ jsx39("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" }),
|
|
11626
|
+
/* @__PURE__ */ jsx39("div", { ref: sort.listRef, className: `sia-query-settings__list${sort.preview ? " is-sorting" : ""}`, children: visibleDraft.map((item, index) => /* @__PURE__ */ jsxs33(
|
|
11559
11627
|
"div",
|
|
11560
11628
|
{
|
|
11561
11629
|
"data-query-field-key": item.key,
|
|
@@ -11563,18 +11631,18 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11563
11631
|
style: sort.preview ? { transform: `translateY(${sort.preview.offsets[item.key] ?? 0}px)` } : void 0,
|
|
11564
11632
|
onPointerDown: (event) => sort.start(event, item.key),
|
|
11565
11633
|
children: [
|
|
11566
|
-
/* @__PURE__ */
|
|
11567
|
-
/* @__PURE__ */
|
|
11568
|
-
/* @__PURE__ */
|
|
11569
|
-
/* @__PURE__ */
|
|
11570
|
-
/* @__PURE__ */
|
|
11571
|
-
/* @__PURE__ */
|
|
11634
|
+
/* @__PURE__ */ jsx39(Icon, { name: "menu", size: 15 }),
|
|
11635
|
+
/* @__PURE__ */ jsx39(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) })) }),
|
|
11636
|
+
/* @__PURE__ */ jsx39("span", { className: "sia-query-settings__name", children: labels.get(item.key) ?? item.key }),
|
|
11637
|
+
/* @__PURE__ */ jsxs33("div", { className: "sia-query-settings__order", children: [
|
|
11638
|
+
/* @__PURE__ */ jsx39(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0A\u79FB ${item.key}`, disabled: locked || index === 0, icon: /* @__PURE__ */ jsx39(Icon, { name: "chevron-up" }), onClick: () => move(index, index - 1) }),
|
|
11639
|
+
/* @__PURE__ */ jsx39(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0B\u79FB ${item.key}`, disabled: locked || index === visibleDraft.length - 1, icon: /* @__PURE__ */ jsx39(Icon, { name: "chevron-down" }), onClick: () => move(index, index + 1) })
|
|
11572
11640
|
] })
|
|
11573
11641
|
]
|
|
11574
11642
|
},
|
|
11575
11643
|
item.key
|
|
11576
11644
|
)) }),
|
|
11577
|
-
/* @__PURE__ */
|
|
11645
|
+
/* @__PURE__ */ jsx39(Button, { type: "button", disabled: locked, onClick: () => setDraft({ fields: reconcileQueryFields(fields.map((field) => field.key)), defaultCollapsed: defaultCollapsed ?? false }), children: "\u6062\u590D\u9ED8\u8BA4" })
|
|
11578
11646
|
] })
|
|
11579
11647
|
}
|
|
11580
11648
|
) });
|
|
@@ -11582,7 +11650,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11582
11650
|
}
|
|
11583
11651
|
|
|
11584
11652
|
// src/components/QueryForm.tsx
|
|
11585
|
-
import { jsx as
|
|
11653
|
+
import { jsx as jsx40, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
11586
11654
|
function QueryForm({
|
|
11587
11655
|
fields,
|
|
11588
11656
|
settings,
|
|
@@ -11617,22 +11685,22 @@ function QueryForm({
|
|
|
11617
11685
|
...formProps
|
|
11618
11686
|
}) {
|
|
11619
11687
|
const [form] = useForm(providedForm);
|
|
11620
|
-
const [internalCollapsed, setInternalCollapsed] =
|
|
11621
|
-
const [expandedRows, setExpandedRows] =
|
|
11622
|
-
const [needsCollapse, setNeedsCollapse] =
|
|
11688
|
+
const [internalCollapsed, setInternalCollapsed] = useState31(defaultCollapsed);
|
|
11689
|
+
const [expandedRows, setExpandedRows] = useState31(0);
|
|
11690
|
+
const [needsCollapse, setNeedsCollapse] = useState31(false);
|
|
11623
11691
|
const collapsed = collapsible && needsCollapse && (controlledCollapsed ?? internalCollapsed ?? expandedRows >= 3);
|
|
11624
|
-
const [searching, setSearching] =
|
|
11625
|
-
const [saving, setSaving] =
|
|
11626
|
-
const [removing, setRemoving] =
|
|
11627
|
-
const [saveOpen, setSaveOpen] =
|
|
11628
|
-
const [saveName, setSaveName] =
|
|
11629
|
-
const [saveError, setSaveError] =
|
|
11630
|
-
const [activeShortcut, setActiveShortcut] =
|
|
11631
|
-
const source =
|
|
11632
|
-
const searchLock =
|
|
11633
|
-
const saveLock =
|
|
11634
|
-
const removeLock =
|
|
11635
|
-
const snapshot =
|
|
11692
|
+
const [searching, setSearching] = useState31(false);
|
|
11693
|
+
const [saving, setSaving] = useState31(false);
|
|
11694
|
+
const [removing, setRemoving] = useState31(false);
|
|
11695
|
+
const [saveOpen, setSaveOpen] = useState31(false);
|
|
11696
|
+
const [saveName, setSaveName] = useState31("");
|
|
11697
|
+
const [saveError, setSaveError] = useState31("");
|
|
11698
|
+
const [activeShortcut, setActiveShortcut] = useState31("");
|
|
11699
|
+
const source = useRef32({ source: "submit" });
|
|
11700
|
+
const searchLock = useRef32(false);
|
|
11701
|
+
const saveLock = useRef32(false);
|
|
11702
|
+
const removeLock = useRef32(false);
|
|
11703
|
+
const snapshot = useRef32();
|
|
11636
11704
|
const busy = disabled || loading || searching;
|
|
11637
11705
|
const shortcutBusy = busy || shortcutsLoading || saving || removing;
|
|
11638
11706
|
const fieldLabel = (content) => {
|
|
@@ -11644,7 +11712,7 @@ function QueryForm({
|
|
|
11644
11712
|
width,
|
|
11645
11713
|
hideDisabled: settingsHideDisabled,
|
|
11646
11714
|
label: settingsLabel ?? item.label ?? (typeof item.children === "function" ? void 0 : fieldLabel(item.children)) ?? key,
|
|
11647
|
-
content: /* @__PURE__ */
|
|
11715
|
+
content: /* @__PURE__ */ jsx40(Form.Item, { noStyle: true, ...item })
|
|
11648
11716
|
})) : Children4.toArray(children).map((content, index) => ({
|
|
11649
11717
|
key: isValidElement5(content) && content.key != null ? String(content.key) : String(index),
|
|
11650
11718
|
width: void 0,
|
|
@@ -11659,10 +11727,10 @@ function QueryForm({
|
|
|
11659
11727
|
const entries = configured.map((item) => ({ ...entriesByKey.get(item.key), visible: item.visible, visibleIndex: item.visible ? visibleIndex++ : -1 }));
|
|
11660
11728
|
const layoutKey = JSON.stringify(configured);
|
|
11661
11729
|
const limit = Math.max(1, Math.floor(collapsedCount));
|
|
11662
|
-
const rowRef =
|
|
11663
|
-
const actionsRef =
|
|
11664
|
-
const toggleRef =
|
|
11665
|
-
const [fittingCount, setFittingCount] =
|
|
11730
|
+
const rowRef = useRef32(null);
|
|
11731
|
+
const actionsRef = useRef32(null);
|
|
11732
|
+
const toggleRef = useRef32(null);
|
|
11733
|
+
const [fittingCount, setFittingCount] = useState31(limit);
|
|
11666
11734
|
useLayoutEffect9(() => {
|
|
11667
11735
|
const row = rowRef.current;
|
|
11668
11736
|
const actions = actionsRef.current;
|
|
@@ -11803,8 +11871,8 @@ function QueryForm({
|
|
|
11803
11871
|
setRemoving(false);
|
|
11804
11872
|
}
|
|
11805
11873
|
}
|
|
11806
|
-
return /* @__PURE__ */
|
|
11807
|
-
/* @__PURE__ */
|
|
11874
|
+
return /* @__PURE__ */ jsxs34("div", { className: `sia-query-form ${className}`.trim(), children: [
|
|
11875
|
+
/* @__PURE__ */ jsxs34(
|
|
11808
11876
|
Form,
|
|
11809
11877
|
{
|
|
11810
11878
|
...formProps,
|
|
@@ -11823,8 +11891,8 @@ function QueryForm({
|
|
|
11823
11891
|
onValuesChange?.(changed, values);
|
|
11824
11892
|
},
|
|
11825
11893
|
children: [
|
|
11826
|
-
quickQueries.length ? /* @__PURE__ */
|
|
11827
|
-
quickQueries.map((query) => /* @__PURE__ */
|
|
11894
|
+
quickQueries.length ? /* @__PURE__ */ jsxs34("div", { className: "sia-query-form__quick", "aria-label": "\u9884\u8BBE\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
11895
|
+
quickQueries.map((query) => /* @__PURE__ */ jsx40(
|
|
11828
11896
|
Badge,
|
|
11829
11897
|
{
|
|
11830
11898
|
className: "sia-query-form__quick-badge",
|
|
@@ -11833,7 +11901,7 @@ function QueryForm({
|
|
|
11833
11901
|
title: query.count === void 0 ? void 0 : `\u5171 ${query.count} \u6761`,
|
|
11834
11902
|
...query.badgeProps,
|
|
11835
11903
|
count: query.count,
|
|
11836
|
-
children: /* @__PURE__ */
|
|
11904
|
+
children: /* @__PURE__ */ jsx40(
|
|
11837
11905
|
Button,
|
|
11838
11906
|
{
|
|
11839
11907
|
size: query.size ?? quickQuerySize,
|
|
@@ -11849,7 +11917,7 @@ function QueryForm({
|
|
|
11849
11917
|
)),
|
|
11850
11918
|
" "
|
|
11851
11919
|
] }) : null,
|
|
11852
|
-
/* @__PURE__ */
|
|
11920
|
+
/* @__PURE__ */ jsx40("div", { className: "sia-query-form__motion", children: /* @__PURE__ */ jsxs34(
|
|
11853
11921
|
"div",
|
|
11854
11922
|
{
|
|
11855
11923
|
ref: rowRef,
|
|
@@ -11858,7 +11926,7 @@ function QueryForm({
|
|
|
11858
11926
|
"--sia-query-field-width": typeof fieldWidth === "number" ? `${fieldWidth}px` : fieldWidth
|
|
11859
11927
|
},
|
|
11860
11928
|
children: [
|
|
11861
|
-
entries.map((entry) => /* @__PURE__ */
|
|
11929
|
+
entries.map((entry) => /* @__PURE__ */ jsx40(
|
|
11862
11930
|
"div",
|
|
11863
11931
|
{
|
|
11864
11932
|
className: "sia-query-form__field",
|
|
@@ -11872,9 +11940,9 @@ function QueryForm({
|
|
|
11872
11940
|
},
|
|
11873
11941
|
entry.key
|
|
11874
11942
|
)),
|
|
11875
|
-
/* @__PURE__ */
|
|
11876
|
-
/* @__PURE__ */
|
|
11877
|
-
/* @__PURE__ */
|
|
11943
|
+
/* @__PURE__ */ jsxs34("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
|
|
11944
|
+
/* @__PURE__ */ jsxs34(Space.Compact, { children: [
|
|
11945
|
+
/* @__PURE__ */ jsx40(
|
|
11878
11946
|
Button,
|
|
11879
11947
|
{
|
|
11880
11948
|
type: "submit",
|
|
@@ -11884,8 +11952,8 @@ function QueryForm({
|
|
|
11884
11952
|
children: searchText
|
|
11885
11953
|
}
|
|
11886
11954
|
),
|
|
11887
|
-
/* @__PURE__ */
|
|
11888
|
-
onSaveQuery ? /* @__PURE__ */
|
|
11955
|
+
/* @__PURE__ */ jsx40(Button, { disabled: busy, onClick: reset, children: resetText }),
|
|
11956
|
+
onSaveQuery ? /* @__PURE__ */ jsx40(
|
|
11889
11957
|
Button,
|
|
11890
11958
|
{
|
|
11891
11959
|
disabled: shortcutBusy,
|
|
@@ -11900,12 +11968,12 @@ function QueryForm({
|
|
|
11900
11968
|
) : null,
|
|
11901
11969
|
showSettings ? cloudSettings.control : null
|
|
11902
11970
|
] }),
|
|
11903
|
-
collapsible && entries.length > 0 ? /* @__PURE__ */
|
|
11971
|
+
collapsible && entries.length > 0 ? /* @__PURE__ */ jsx40("span", { ref: toggleRef, hidden: !needsCollapse, children: /* @__PURE__ */ jsx40(
|
|
11904
11972
|
Button,
|
|
11905
11973
|
{
|
|
11906
11974
|
variant: "link",
|
|
11907
11975
|
"aria-expanded": !collapsed,
|
|
11908
|
-
icon: /* @__PURE__ */
|
|
11976
|
+
icon: /* @__PURE__ */ jsx40(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
|
|
11909
11977
|
iconPosition: "end",
|
|
11910
11978
|
onClick: () => {
|
|
11911
11979
|
setInternalCollapsed(!collapsed);
|
|
@@ -11920,8 +11988,8 @@ function QueryForm({
|
|
|
11920
11988
|
]
|
|
11921
11989
|
}
|
|
11922
11990
|
) }),
|
|
11923
|
-
savedQueries.length ? /* @__PURE__ */
|
|
11924
|
-
savedQueries.map((query, index) => /* @__PURE__ */
|
|
11991
|
+
savedQueries.length ? /* @__PURE__ */ jsxs34("div", { className: "sia-query-form__saved", "aria-label": "\u5DF2\u4FDD\u5B58\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
11992
|
+
savedQueries.map((query, index) => /* @__PURE__ */ jsx40(
|
|
11925
11993
|
Tag,
|
|
11926
11994
|
{
|
|
11927
11995
|
status: query.status ?? ["processing", "success", "warning", "error"][index % 4],
|
|
@@ -11950,7 +12018,7 @@ function QueryForm({
|
|
|
11950
12018
|
]
|
|
11951
12019
|
}
|
|
11952
12020
|
),
|
|
11953
|
-
/* @__PURE__ */
|
|
12021
|
+
/* @__PURE__ */ jsxs34(
|
|
11954
12022
|
Modal,
|
|
11955
12023
|
{
|
|
11956
12024
|
open: saveOpen,
|
|
@@ -11962,7 +12030,7 @@ function QueryForm({
|
|
|
11962
12030
|
if (!saveLock.current) setSaveOpen(next);
|
|
11963
12031
|
},
|
|
11964
12032
|
children: [
|
|
11965
|
-
/* @__PURE__ */
|
|
12033
|
+
/* @__PURE__ */ jsx40(
|
|
11966
12034
|
Input,
|
|
11967
12035
|
{
|
|
11968
12036
|
autoFocus: true,
|
|
@@ -11981,7 +12049,7 @@ function QueryForm({
|
|
|
11981
12049
|
}
|
|
11982
12050
|
}
|
|
11983
12051
|
),
|
|
11984
|
-
saveError ? /* @__PURE__ */
|
|
12052
|
+
saveError ? /* @__PURE__ */ jsx40("p", { className: "sia-query-form__error", role: "alert", children: saveError }) : null
|
|
11985
12053
|
]
|
|
11986
12054
|
}
|
|
11987
12055
|
)
|
|
@@ -11989,9 +12057,9 @@ function QueryForm({
|
|
|
11989
12057
|
}
|
|
11990
12058
|
|
|
11991
12059
|
// src/components/NumberRange.tsx
|
|
11992
|
-
import { forwardRef as
|
|
11993
|
-
import { jsx as
|
|
11994
|
-
var NumberRange =
|
|
12060
|
+
import { forwardRef as forwardRef16 } from "react";
|
|
12061
|
+
import { jsx as jsx41, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
12062
|
+
var NumberRange = forwardRef16(function NumberRange2({
|
|
11995
12063
|
value,
|
|
11996
12064
|
defaultValue = [null, null],
|
|
11997
12065
|
onChange,
|
|
@@ -12019,7 +12087,7 @@ var NumberRange = forwardRef9(function NumberRange2({
|
|
|
12019
12087
|
setValue2(index === 0 ? [next, range[1]] : [range[0], next]);
|
|
12020
12088
|
}
|
|
12021
12089
|
const inputProps = { min, max, step, precision, size, status, disabled, readOnly, placeholderMode, controls: false };
|
|
12022
|
-
return /* @__PURE__ */
|
|
12090
|
+
return /* @__PURE__ */ jsxs35(
|
|
12023
12091
|
"span",
|
|
12024
12092
|
{
|
|
12025
12093
|
...props,
|
|
@@ -12028,7 +12096,7 @@ var NumberRange = forwardRef9(function NumberRange2({
|
|
|
12028
12096
|
"aria-disabled": disabled || void 0,
|
|
12029
12097
|
className: `sia-number-range sia-number-range--${size} sia-number-range--${status}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
12030
12098
|
children: [
|
|
12031
|
-
/* @__PURE__ */
|
|
12099
|
+
/* @__PURE__ */ jsx41(
|
|
12032
12100
|
InputNumber,
|
|
12033
12101
|
{
|
|
12034
12102
|
...inputProps,
|
|
@@ -12040,8 +12108,8 @@ var NumberRange = forwardRef9(function NumberRange2({
|
|
|
12040
12108
|
onChange: (next) => change(0, next)
|
|
12041
12109
|
}
|
|
12042
12110
|
),
|
|
12043
|
-
/* @__PURE__ */
|
|
12044
|
-
/* @__PURE__ */
|
|
12111
|
+
/* @__PURE__ */ jsx41(Icon, { className: "sia-number-range__separator", name: "tilde", size: 12, strokeWidth: 1.5, "aria-hidden": "true" }),
|
|
12112
|
+
/* @__PURE__ */ jsx41(
|
|
12045
12113
|
InputNumber,
|
|
12046
12114
|
{
|
|
12047
12115
|
...inputProps,
|
|
@@ -12053,15 +12121,15 @@ var NumberRange = forwardRef9(function NumberRange2({
|
|
|
12053
12121
|
onChange: (next) => change(1, next)
|
|
12054
12122
|
}
|
|
12055
12123
|
),
|
|
12056
|
-
allowClear && !disabled && !readOnly && range.some((item) => item !== null) ? /* @__PURE__ */
|
|
12124
|
+
allowClear && !disabled && !readOnly && range.some((item) => item !== null) ? /* @__PURE__ */ jsx41("button", { type: "button", className: "sia-number-range__clear", "aria-label": "\u6E05\u9664\u6570\u5B57\u533A\u95F4", onClick: () => setValue2([null, null]), children: /* @__PURE__ */ jsx41(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null
|
|
12057
12125
|
]
|
|
12058
12126
|
}
|
|
12059
12127
|
);
|
|
12060
12128
|
});
|
|
12061
12129
|
|
|
12062
12130
|
// src/components/VirtualGrid.tsx
|
|
12063
|
-
import { useEffect as
|
|
12064
|
-
import { jsx as
|
|
12131
|
+
import { useEffect as useEffect23, useLayoutEffect as useLayoutEffect10, useRef as useRef33, useState as useState32 } from "react";
|
|
12132
|
+
import { jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
12065
12133
|
function VirtualGrid({
|
|
12066
12134
|
items,
|
|
12067
12135
|
itemKey,
|
|
@@ -12080,11 +12148,11 @@ function VirtualGrid({
|
|
|
12080
12148
|
tabIndex = 0,
|
|
12081
12149
|
...props
|
|
12082
12150
|
}) {
|
|
12083
|
-
const viewport =
|
|
12084
|
-
const [size, setSize] =
|
|
12085
|
-
const [scrollTop, setScrollTop] =
|
|
12086
|
-
const frame =
|
|
12087
|
-
const requestedLength =
|
|
12151
|
+
const viewport = useRef33(null);
|
|
12152
|
+
const [size, setSize] = useState32({ width: 0, height: 0 });
|
|
12153
|
+
const [scrollTop, setScrollTop] = useState32(0);
|
|
12154
|
+
const frame = useRef33();
|
|
12155
|
+
const requestedLength = useRef33();
|
|
12088
12156
|
const height = Math.max(1, rowHeight);
|
|
12089
12157
|
const spacing = Math.max(0, gap);
|
|
12090
12158
|
const columns = Math.max(1, Math.floor((size.width + spacing) / (Math.max(1, minColumnWidth) + spacing)));
|
|
@@ -12113,14 +12181,14 @@ function VirtualGrid({
|
|
|
12113
12181
|
if (el.scrollTop !== next) el.scrollTop = next;
|
|
12114
12182
|
setScrollTop(next);
|
|
12115
12183
|
}, [totalHeight, size.height]);
|
|
12116
|
-
|
|
12184
|
+
useEffect23(() => {
|
|
12117
12185
|
if (!onLoadMore || !hasMore || loading || size.height <= 0) return;
|
|
12118
12186
|
if (totalHeight - scrollTop - size.height > Math.max(0, loadMoreThreshold)) return;
|
|
12119
12187
|
if (requestedLength.current === items.length) return;
|
|
12120
12188
|
requestedLength.current = items.length;
|
|
12121
12189
|
onLoadMore();
|
|
12122
12190
|
}, [items.length, hasMore, loading, size.height, scrollTop, totalHeight, loadMoreThreshold, onLoadMore]);
|
|
12123
|
-
return /* @__PURE__ */
|
|
12191
|
+
return /* @__PURE__ */ jsxs36(
|
|
12124
12192
|
"div",
|
|
12125
12193
|
{
|
|
12126
12194
|
...props,
|
|
@@ -12138,16 +12206,16 @@ function VirtualGrid({
|
|
|
12138
12206
|
});
|
|
12139
12207
|
},
|
|
12140
12208
|
children: [
|
|
12141
|
-
/* @__PURE__ */
|
|
12209
|
+
/* @__PURE__ */ jsx42("div", { className: "sia-virtual-grid__spacer", style: { height: totalHeight }, children: Array.from({ length: Math.max(0, endRow - startRow) }, (_, offset) => {
|
|
12142
12210
|
const row = startRow + offset;
|
|
12143
|
-
return /* @__PURE__ */
|
|
12211
|
+
return /* @__PURE__ */ jsx42("div", { className: "sia-virtual-grid__row", role: "presentation", style: {
|
|
12144
12212
|
top: row * stride,
|
|
12145
12213
|
height,
|
|
12146
12214
|
columnGap: spacing,
|
|
12147
12215
|
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`
|
|
12148
12216
|
}, children: items.slice(row * columns, (row + 1) * columns).map((item, column) => {
|
|
12149
12217
|
const index = row * columns + column;
|
|
12150
|
-
return /* @__PURE__ */
|
|
12218
|
+
return /* @__PURE__ */ jsx42("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));
|
|
12151
12219
|
}) }, row);
|
|
12152
12220
|
}) }),
|
|
12153
12221
|
!items.length && !loading ? empty : null
|
|
@@ -12266,7 +12334,7 @@ export {
|
|
|
12266
12334
|
TextArea,
|
|
12267
12335
|
ThemeRiverChart,
|
|
12268
12336
|
ThemeSwitch,
|
|
12269
|
-
TimePicker,
|
|
12337
|
+
TimePicker2 as TimePicker,
|
|
12270
12338
|
Timeline,
|
|
12271
12339
|
ToolPanel,
|
|
12272
12340
|
Toolbar,
|