@sia.soul/sia-react-ui 0.1.141 → 0.1.143
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/{Button-BiL3Wjsd.d.ts → Button-C8W8ZHWV.d.ts} +1 -1
- package/dist/{Button-O_pNB3SQ.d.cts → Button-CxKBjLda.d.cts} +1 -1
- package/dist/{Select-DeD4O8FL.d.ts → Select-CTSd8zum.d.ts} +14 -10
- package/dist/{Select-Y0e9kaxE.d.cts → Select-bKLket9n.d.cts} +14 -10
- package/dist/chart.cjs +1051 -335
- package/dist/chart.js +5 -5
- package/dist/chunk-4OHS7RXE.js +1004 -0
- package/dist/{chunk-WIRIEIRO.js → chunk-4TYHSAR3.js} +5 -5
- package/dist/{chunk-L2S7IPSM.js → chunk-566S64IP.js} +5 -5
- package/dist/{chunk-CZ2ITBRW.js → chunk-7SEGBB6V.js} +34 -5
- package/dist/{chunk-KY6A5IJH.js → chunk-ETQJ2DQ2.js} +1 -1
- package/dist/{chunk-WD56MJO2.js → chunk-F52O2MOV.js} +7 -3
- package/dist/{chunk-PQBCD54U.js → chunk-JRXYM5YH.js} +167 -64
- package/dist/{chunk-SCEHVGKV.js → chunk-LKLPCYEP.js} +2 -2
- package/dist/{chunk-DIRPOUVX.js → chunk-MD4CGSOR.js} +105 -61
- package/dist/{chunk-436QH6XH.js → chunk-ORSQAJ22.js} +160 -497
- package/dist/{chunk-SO7IJZIR.js → chunk-PD3K5U5Y.js} +2 -2
- package/dist/{chunk-UVHC6OEX.js → chunk-WCYVBO2N.js} +342 -123
- package/dist/{core-DYo5C4Si.d.cts → core-COaZfusa.d.cts} +51 -24
- package/dist/{core-sWwvVAmP.d.ts → core-CvfsQGuT.d.ts} +51 -24
- package/dist/core.cjs +2000 -1251
- package/dist/core.css +416 -344
- package/dist/core.d.cts +3 -3
- package/dist/core.d.ts +3 -3
- package/dist/core.js +18 -9
- package/dist/game.cjs +1984 -1169
- package/dist/game.css +182 -177
- package/dist/game.d.cts +1 -1
- package/dist/game.d.ts +1 -1
- package/dist/game.js +8 -3
- package/dist/index.cjs +4658 -3542
- package/dist/index.css +416 -344
- package/dist/index.d.cts +84 -81
- package/dist/index.d.ts +84 -81
- package/dist/index.js +1075 -713
- package/dist/markdown-editor.cjs +727 -40
- package/dist/markdown-editor.js +8 -3
- package/dist/rich-text-editor.cjs +1265 -308
- package/dist/rich-text-editor.js +12 -7
- package/dist/{select-date-range-X6a9Y-Te.d.ts → select-date-range-C8cacfmb.d.ts} +1 -1
- package/dist/{select-date-range-DiBQQ0Rn.d.cts → select-date-range-Dad0IdD4.d.cts} +1 -1
- package/dist/select-date-range.cjs +1281 -807
- package/dist/select-date-range.d.cts +3 -3
- package/dist/select-date-range.d.ts +3 -3
- package/dist/select-date-range.js +13 -8
- package/package.json +9 -2
- package/dist/chunk-NZMUW5XI.js +0 -292
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-F52O2MOV.js";
|
|
60
60
|
import {
|
|
61
61
|
Badge,
|
|
62
62
|
Breadcrumb,
|
|
@@ -82,23 +82,22 @@ import {
|
|
|
82
82
|
Watermark,
|
|
83
83
|
message,
|
|
84
84
|
notification
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-MD4CGSOR.js";
|
|
86
86
|
import "./chunk-RX242MUO.js";
|
|
87
87
|
import {
|
|
88
88
|
MarkdownEditor
|
|
89
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-PD3K5U5Y.js";
|
|
90
90
|
import {
|
|
91
91
|
RichTextContent,
|
|
92
92
|
RichTextEditor
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-4TYHSAR3.js";
|
|
94
94
|
import {
|
|
95
95
|
DatePicker,
|
|
96
96
|
SelectDateRange,
|
|
97
97
|
TimePanel
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-566S64IP.js";
|
|
99
99
|
import {
|
|
100
100
|
Checkbox,
|
|
101
|
-
FloatingScrollbarProvider,
|
|
102
101
|
OverflowTags,
|
|
103
102
|
Popover,
|
|
104
103
|
Select,
|
|
@@ -106,41 +105,49 @@ import {
|
|
|
106
105
|
Timeline,
|
|
107
106
|
Tooltip,
|
|
108
107
|
Tree,
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
normalizeSelectionValues,
|
|
109
|
+
usePressFeedback
|
|
110
|
+
} from "./chunk-ORSQAJ22.js";
|
|
111
111
|
import {
|
|
112
112
|
Dropdown,
|
|
113
113
|
Input,
|
|
114
114
|
Menu,
|
|
115
115
|
Segmented,
|
|
116
116
|
Steps
|
|
117
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-WCYVBO2N.js";
|
|
118
118
|
import {
|
|
119
119
|
TextArea
|
|
120
|
-
} from "./chunk-
|
|
120
|
+
} from "./chunk-LKLPCYEP.js";
|
|
121
121
|
import {
|
|
122
122
|
FILLED_ICON_NAMES,
|
|
123
123
|
ICON_NAMES,
|
|
124
124
|
Icon,
|
|
125
125
|
Modal,
|
|
126
|
+
OverlayContentSkeleton,
|
|
126
127
|
OverlayPortal,
|
|
128
|
+
Skeleton,
|
|
129
|
+
useOverlayExitPlaceholder,
|
|
127
130
|
useOverlayLifecycle
|
|
128
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-JRXYM5YH.js";
|
|
129
132
|
import {
|
|
130
133
|
Button
|
|
131
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-7SEGBB6V.js";
|
|
132
135
|
import {
|
|
133
136
|
useFloatingPlaceholder
|
|
134
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-ETQJ2DQ2.js";
|
|
135
138
|
import {
|
|
136
139
|
ControlSizeContext,
|
|
140
|
+
FloatingScrollbarProvider,
|
|
137
141
|
PlaceholderModeContext,
|
|
138
142
|
PopupPortal,
|
|
143
|
+
initializeDefaultScrollbars,
|
|
139
144
|
useControlSize,
|
|
140
145
|
useControllableState,
|
|
146
|
+
useOverlayMotion,
|
|
141
147
|
usePlaceholderMode,
|
|
148
|
+
useScrollbarProximity,
|
|
142
149
|
withTitleTooltip
|
|
143
|
-
} from "./chunk-
|
|
150
|
+
} from "./chunk-4OHS7RXE.js";
|
|
144
151
|
|
|
145
152
|
// src/components/CursorPreview.tsx
|
|
146
153
|
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
@@ -294,8 +301,10 @@ function AutoSizer({ children }) {
|
|
|
294
301
|
return /* @__PURE__ */ jsx2("div", { className: "sia-auto-sizer", ref, children: /* @__PURE__ */ jsx2("div", { className: "sia-auto-sizer__content", children: size.width > 0 && size.height > 0 ? children(size) : null }) });
|
|
295
302
|
}
|
|
296
303
|
function FloatingPanel({ open, title, children, placement = "bottomRight" }) {
|
|
297
|
-
|
|
298
|
-
|
|
304
|
+
const ref = useRef2(null);
|
|
305
|
+
const motion = useOverlayMotion(open, ref, "fade");
|
|
306
|
+
if (!motion.present || typeof document === "undefined") return null;
|
|
307
|
+
return createPortal(/* @__PURE__ */ jsxs2("section", { ref, className: `sia-floating-panel sia-floating-panel--${placement}`, "aria-label": title, role: "status", ...!open ? { inert: "" } : {}, children: [
|
|
299
308
|
/* @__PURE__ */ jsx2("strong", { className: "sia-floating-panel__title", children: title }),
|
|
300
309
|
children
|
|
301
310
|
] }), document.body);
|
|
@@ -382,7 +391,7 @@ function SortableList({ items, renderItem, onOrderChange, direction = "horizonta
|
|
|
382
391
|
}
|
|
383
392
|
|
|
384
393
|
// src/components/Alert.tsx
|
|
385
|
-
import { useState as useState3 } from "react";
|
|
394
|
+
import { useRef as useRef3, useState as useState3 } from "react";
|
|
386
395
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
387
396
|
var alertIcons = {
|
|
388
397
|
info: /* @__PURE__ */ jsx3(Icon, { name: "info", size: 20, variant: "filled" }),
|
|
@@ -407,11 +416,15 @@ function Alert({
|
|
|
407
416
|
...props
|
|
408
417
|
}) {
|
|
409
418
|
const [visible, setVisible] = useState3(true);
|
|
419
|
+
const rootRef = useRef3(null);
|
|
420
|
+
const motion = useOverlayMotion(visible, rootRef, "fade", "bottom", true, (opened) => {
|
|
421
|
+
if (!opened) afterClose?.();
|
|
422
|
+
});
|
|
410
423
|
const resolvedStatus = status ?? type ?? (banner ? "warning" : "info");
|
|
411
424
|
const heading = message2 ?? title;
|
|
412
425
|
const hasHeading = heading != null && heading !== "" && typeof heading !== "boolean";
|
|
413
|
-
if (!
|
|
414
|
-
return /* @__PURE__ */ jsxs3("div", { className: `sia-alert sia-alert--${resolvedStatus}${banner ? " sia-alert--banner" : ""}${description ? " sia-alert--with-description" : ""} ${className}`.trim(), role: "alert", ...withTitleTooltip(props), children: [
|
|
426
|
+
if (!motion.present) return null;
|
|
427
|
+
return /* @__PURE__ */ jsxs3("div", { ref: rootRef, className: `sia-alert sia-alert--${resolvedStatus}${banner ? " sia-alert--banner" : ""}${description ? " sia-alert--with-description" : ""} ${className}`.trim(), role: "alert", ...withTitleTooltip(props), ...!visible ? { inert: "" } : {}, children: [
|
|
415
428
|
showIcon || banner ? /* @__PURE__ */ jsx3("span", { className: "sia-alert__icon", "aria-hidden": "true", children: alertIcons[resolvedStatus] }) : null,
|
|
416
429
|
/* @__PURE__ */ jsxs3("div", { className: "sia-alert__content", children: [
|
|
417
430
|
hasHeading ? /* @__PURE__ */ jsx3("strong", { children: heading }) : null,
|
|
@@ -421,7 +434,6 @@ function Alert({
|
|
|
421
434
|
closable ? /* @__PURE__ */ jsx3("button", { type: "button", className: "sia-alert__close", "aria-label": "\u5173\u95ED\u63D0\u793A", onClick: (event) => {
|
|
422
435
|
onClose?.(event);
|
|
423
436
|
setVisible(false);
|
|
424
|
-
window.setTimeout(() => afterClose?.(), 0);
|
|
425
437
|
}, children: closeIcon ?? /* @__PURE__ */ jsx3(Icon, { name: "close", size: 14 }) }) : null
|
|
426
438
|
] });
|
|
427
439
|
}
|
|
@@ -540,7 +552,7 @@ function Pagination({
|
|
|
540
552
|
}
|
|
541
553
|
|
|
542
554
|
// src/components/Cascader.tsx
|
|
543
|
-
import { useEffect as useEffect3, useMemo, useRef as
|
|
555
|
+
import { useEffect as useEffect3, useMemo, useRef as useRef4, useState as useState5 } from "react";
|
|
544
556
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
545
557
|
function optionValue(option, fields) {
|
|
546
558
|
return option[fields.value];
|
|
@@ -597,8 +609,8 @@ function Cascader({
|
|
|
597
609
|
}) {
|
|
598
610
|
const size = useControlSize(sizeProp);
|
|
599
611
|
const fields = useMemo(() => ({ label: fieldNames?.label ?? "label", value: fieldNames?.value ?? "value", children: fieldNames?.children ?? "children" }), [fieldNames]);
|
|
600
|
-
const rootRef =
|
|
601
|
-
const popupRef =
|
|
612
|
+
const rootRef = useRef4(null);
|
|
613
|
+
const popupRef = useRef4(null);
|
|
602
614
|
const [current, setCurrent] = useControllableState({
|
|
603
615
|
value,
|
|
604
616
|
defaultValue: defaultValue ?? (multiple ? [] : void 0)
|
|
@@ -903,7 +915,7 @@ function Col({
|
|
|
903
915
|
}
|
|
904
916
|
|
|
905
917
|
// src/components/Splitter.tsx
|
|
906
|
-
import { Children as Children2, cloneElement, isValidElement, useMemo as useMemo2, useRef as
|
|
918
|
+
import { Children as Children2, cloneElement, isValidElement, useMemo as useMemo2, useRef as useRef5, useState as useState6 } from "react";
|
|
907
919
|
import { Fragment, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
908
920
|
function SplitterPanel({
|
|
909
921
|
defaultSize: _defaultSize,
|
|
@@ -953,10 +965,10 @@ function SplitterRoot({
|
|
|
953
965
|
children,
|
|
954
966
|
...props
|
|
955
967
|
}) {
|
|
956
|
-
const rootRef =
|
|
968
|
+
const rootRef = useRef5(null);
|
|
957
969
|
const panels = useMemo2(() => Children2.toArray(children).filter(isValidElement), [children]);
|
|
958
970
|
const [sizes, setSizes] = useState6(() => normalizeSizes(panels));
|
|
959
|
-
const expandedSizesRef =
|
|
971
|
+
const expandedSizesRef = useRef5(normalizeExpandedSizes(panels));
|
|
960
972
|
function resizePair(index, deltaPercent, complete = false) {
|
|
961
973
|
setSizes((current) => {
|
|
962
974
|
const next = [...current];
|
|
@@ -1101,7 +1113,7 @@ var Splitter = Object.assign(SplitterRoot, {
|
|
|
1101
1113
|
});
|
|
1102
1114
|
|
|
1103
1115
|
// src/components/ToolPanel.tsx
|
|
1104
|
-
import { useId, useLayoutEffect as useLayoutEffect2, useRef as
|
|
1116
|
+
import { useId, useLayoutEffect as useLayoutEffect2, useRef as useRef6, useState as useState7 } from "react";
|
|
1105
1117
|
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1106
1118
|
function clamp2(value, min, max) {
|
|
1107
1119
|
return Math.min(max, Math.max(min, value));
|
|
@@ -1135,8 +1147,8 @@ function ToolPanel({
|
|
|
1135
1147
|
const requestedKey = activeKey ?? internalActiveKey;
|
|
1136
1148
|
const activePanel = panels.find((item) => item.key === requestedKey && !item.disabled) ?? panels.find((item) => !item.disabled);
|
|
1137
1149
|
const isOpen = (open ?? internalOpen) && Boolean(activePanel);
|
|
1138
|
-
const railRef =
|
|
1139
|
-
const indicatorRef =
|
|
1150
|
+
const railRef = useRef6(null);
|
|
1151
|
+
const indicatorRef = useRef6(null);
|
|
1140
1152
|
useLayoutEffect2(() => {
|
|
1141
1153
|
const rail2 = railRef.current;
|
|
1142
1154
|
const indicator = indicatorRef.current;
|
|
@@ -1146,6 +1158,7 @@ function ToolPanel({
|
|
|
1146
1158
|
const active = rail2.querySelector(".sia-tool-panel__activity.is-active");
|
|
1147
1159
|
if (!active) {
|
|
1148
1160
|
indicator.style.visibility = "hidden";
|
|
1161
|
+
indicator.style.transform = "none";
|
|
1149
1162
|
delete indicator.dataset.ready;
|
|
1150
1163
|
return;
|
|
1151
1164
|
}
|
|
@@ -1295,8 +1308,85 @@ function ToolPanel({
|
|
|
1295
1308
|
}
|
|
1296
1309
|
|
|
1297
1310
|
// src/components/WindowFrame.tsx
|
|
1298
|
-
import { useEffect as useEffect4, useRef as
|
|
1299
|
-
|
|
1311
|
+
import { useEffect as useEffect4, useRef as useRef7, useState as useState8 } from "react";
|
|
1312
|
+
|
|
1313
|
+
// src/components/ThemeSwitch.tsx
|
|
1314
|
+
import { forwardRef } from "react";
|
|
1315
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1316
|
+
var ThemeSwitch = forwardRef(function ThemeSwitch2({
|
|
1317
|
+
checked,
|
|
1318
|
+
onCheckedChange,
|
|
1319
|
+
lightLabel = "\u4EAE\u8272\u6A21\u5F0F",
|
|
1320
|
+
darkLabel = "\u6697\u8272\u6A21\u5F0F",
|
|
1321
|
+
className = "",
|
|
1322
|
+
onClick,
|
|
1323
|
+
...props
|
|
1324
|
+
}, ref) {
|
|
1325
|
+
function handleClick(event) {
|
|
1326
|
+
onCheckedChange?.(!checked);
|
|
1327
|
+
onClick?.(event);
|
|
1328
|
+
}
|
|
1329
|
+
return /* @__PURE__ */ jsxs9(
|
|
1330
|
+
"button",
|
|
1331
|
+
{
|
|
1332
|
+
ref,
|
|
1333
|
+
type: "button",
|
|
1334
|
+
role: "switch",
|
|
1335
|
+
"aria-checked": checked,
|
|
1336
|
+
"aria-label": checked ? darkLabel : lightLabel,
|
|
1337
|
+
className: `sia-theme-switch${checked ? " sia-theme-switch--dark" : ""} ${className}`.trim(),
|
|
1338
|
+
onClick: handleClick,
|
|
1339
|
+
...withTitleTooltip(props),
|
|
1340
|
+
children: [
|
|
1341
|
+
/* @__PURE__ */ jsx9("span", { className: "sia-theme-switch__selection", "aria-hidden": "true" }),
|
|
1342
|
+
/* @__PURE__ */ jsx9("span", { className: `sia-theme-switch__icon${checked ? "" : " is-active"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxs9("svg", { viewBox: "0 0 24 24", children: [
|
|
1343
|
+
/* @__PURE__ */ jsx9("circle", { cx: "12", cy: "12", r: "3.5" }),
|
|
1344
|
+
/* @__PURE__ */ jsx9("path", { d: "M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M18.7 5.3l-1.4 1.4M6.7 17.3l-1.4 1.4" })
|
|
1345
|
+
] }) }),
|
|
1346
|
+
/* @__PURE__ */ jsx9("span", { className: `sia-theme-switch__icon${checked ? " is-active" : ""}`, "aria-hidden": "true", children: /* @__PURE__ */ jsx9("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx9("path", { d: "M20 15.2A8 8 0 0 1 8.8 4 8.5 8.5 0 1 0 20 15.2Z" }) }) })
|
|
1347
|
+
]
|
|
1348
|
+
}
|
|
1349
|
+
);
|
|
1350
|
+
});
|
|
1351
|
+
|
|
1352
|
+
// src/theme.ts
|
|
1353
|
+
var SIA_THEME = {
|
|
1354
|
+
/** 主色。 */
|
|
1355
|
+
colorPrimary: "#1677ff",
|
|
1356
|
+
/** 主色的悬停色。 */
|
|
1357
|
+
colorPrimaryHover: "#4096ff",
|
|
1358
|
+
/** 主色的按下色。 */
|
|
1359
|
+
colorPrimaryActive: "#0958d9",
|
|
1360
|
+
/** 主要文本颜色。 */
|
|
1361
|
+
colorText: "#1f1f1f",
|
|
1362
|
+
/** 次要文本颜色。 */
|
|
1363
|
+
colorTextSecondary: "#666666",
|
|
1364
|
+
/** 页面背景颜色。 */
|
|
1365
|
+
colorBackground: "#f5f7fa",
|
|
1366
|
+
/** 组件表面颜色。 */
|
|
1367
|
+
colorSurface: "#ffffff",
|
|
1368
|
+
/** 默认边框颜色。 */
|
|
1369
|
+
colorBorder: "#d9d9d9",
|
|
1370
|
+
/** 默认圆角半径,单位为像素。 */
|
|
1371
|
+
borderRadius: 6,
|
|
1372
|
+
/** 默认控件高度,单位为像素。 */
|
|
1373
|
+
controlHeight: 32,
|
|
1374
|
+
/** 默认布局间距为 8 像素,对应 --sia-spacing;业务可通过容器或组件上的同名 CSS 变量覆盖。 */
|
|
1375
|
+
spacing: 8,
|
|
1376
|
+
/** 默认基础字号为 13 像素,对应 --sia-font-size;业务可通过 CSS 变量覆盖。 */
|
|
1377
|
+
fontSize: 13,
|
|
1378
|
+
/** 默认小号文字尺寸为 13 像素,对应 --sia-font-size-small;业务可通过 CSS 变量覆盖。 */
|
|
1379
|
+
fontSizeSmall: 13,
|
|
1380
|
+
/** 大号文字尺寸,单位为像素。 */
|
|
1381
|
+
fontSizeLarge: 18
|
|
1382
|
+
};
|
|
1383
|
+
function applySiaTheme(mode, target = document.documentElement) {
|
|
1384
|
+
target.dataset.siaTheme = mode;
|
|
1385
|
+
target.style.colorScheme = mode;
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
// src/components/WindowFrame.tsx
|
|
1389
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1300
1390
|
var DEFAULT_LABELS = {
|
|
1301
1391
|
minimize: "\u6700\u5C0F\u5316",
|
|
1302
1392
|
maximize: "\u6700\u5927\u5316",
|
|
@@ -1326,7 +1416,7 @@ function WindowFrame({
|
|
|
1326
1416
|
children,
|
|
1327
1417
|
...props
|
|
1328
1418
|
}) {
|
|
1329
|
-
return /* @__PURE__ */
|
|
1419
|
+
return /* @__PURE__ */ jsxs10(
|
|
1330
1420
|
"div",
|
|
1331
1421
|
{
|
|
1332
1422
|
className: `sia-window-frame ${className}`.trim(),
|
|
@@ -1341,10 +1431,10 @@ function WindowFrame({
|
|
|
1341
1431
|
);
|
|
1342
1432
|
}
|
|
1343
1433
|
function renderWindowControlGlyph(action, maximized) {
|
|
1344
|
-
return /* @__PURE__ */
|
|
1345
|
-
/* @__PURE__ */
|
|
1346
|
-
/* @__PURE__ */
|
|
1347
|
-
] }) : /* @__PURE__ */
|
|
1434
|
+
return /* @__PURE__ */ jsx10("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1", "aria-hidden": "true", focusable: "false", children: action === "minimize" ? /* @__PURE__ */ jsx10("path", { d: "M1 6.5h10" }) : action === "close" ? /* @__PURE__ */ jsx10("path", { d: "m1.5 1.5 9 9m0-9-9 9" }) : maximized ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
1435
|
+
/* @__PURE__ */ jsx10("path", { d: "M3.5 3.5v-2h7v7h-2" }),
|
|
1436
|
+
/* @__PURE__ */ jsx10("rect", { x: "1.5", y: "3.5", width: "7", height: "7" })
|
|
1437
|
+
] }) : /* @__PURE__ */ jsx10("rect", { x: "1.5", y: "1.5", width: "9", height: "9" }) });
|
|
1348
1438
|
}
|
|
1349
1439
|
function WindowControls({
|
|
1350
1440
|
maximized = false,
|
|
@@ -1362,7 +1452,7 @@ function WindowControls({
|
|
|
1362
1452
|
function runAction(action) {
|
|
1363
1453
|
void onAction?.(action);
|
|
1364
1454
|
}
|
|
1365
|
-
return /* @__PURE__ */
|
|
1455
|
+
return /* @__PURE__ */ jsxs10(
|
|
1366
1456
|
"div",
|
|
1367
1457
|
{
|
|
1368
1458
|
className: `sia-window-controls ${className}`.trim(),
|
|
@@ -1370,7 +1460,7 @@ function WindowControls({
|
|
|
1370
1460
|
"aria-label": "\u7A97\u53E3\u63A7\u5236",
|
|
1371
1461
|
...withTitleTooltip(props),
|
|
1372
1462
|
children: [
|
|
1373
|
-
showMinimize ? /* @__PURE__ */
|
|
1463
|
+
showMinimize ? /* @__PURE__ */ jsx10(
|
|
1374
1464
|
"button",
|
|
1375
1465
|
{
|
|
1376
1466
|
type: "button",
|
|
@@ -1382,7 +1472,7 @@ function WindowControls({
|
|
|
1382
1472
|
children: renderWindowControlGlyph("minimize", maximized)
|
|
1383
1473
|
}
|
|
1384
1474
|
) : null,
|
|
1385
|
-
showMaximize ? /* @__PURE__ */
|
|
1475
|
+
showMaximize ? /* @__PURE__ */ jsx10(
|
|
1386
1476
|
"button",
|
|
1387
1477
|
{
|
|
1388
1478
|
type: "button",
|
|
@@ -1394,7 +1484,7 @@ function WindowControls({
|
|
|
1394
1484
|
children: renderWindowControlGlyph("toggle-maximize", maximized)
|
|
1395
1485
|
}
|
|
1396
1486
|
) : null,
|
|
1397
|
-
showClose ? /* @__PURE__ */
|
|
1487
|
+
showClose ? /* @__PURE__ */ jsx10(
|
|
1398
1488
|
"button",
|
|
1399
1489
|
{
|
|
1400
1490
|
type: "button",
|
|
@@ -1411,6 +1501,9 @@ function WindowControls({
|
|
|
1411
1501
|
);
|
|
1412
1502
|
}
|
|
1413
1503
|
function WindowTitleBar({
|
|
1504
|
+
showThemeSwitch = true,
|
|
1505
|
+
theme,
|
|
1506
|
+
onThemeChange,
|
|
1414
1507
|
leading,
|
|
1415
1508
|
actions,
|
|
1416
1509
|
actionsAlign = "right",
|
|
@@ -1425,7 +1518,28 @@ function WindowTitleBar({
|
|
|
1425
1518
|
onMouseDown,
|
|
1426
1519
|
...props
|
|
1427
1520
|
}) {
|
|
1428
|
-
const
|
|
1521
|
+
const [documentTheme, setDocumentTheme] = useState8("light");
|
|
1522
|
+
const titleBarRef = useRef7(null);
|
|
1523
|
+
useEffect4(() => {
|
|
1524
|
+
if (theme !== void 0 || !showThemeSwitch) return;
|
|
1525
|
+
const root = titleBarRef.current?.ownerDocument.documentElement;
|
|
1526
|
+
if (!root) return;
|
|
1527
|
+
const syncTheme = () => setDocumentTheme(root.dataset.siaTheme === "dark" ? "dark" : "light");
|
|
1528
|
+
syncTheme();
|
|
1529
|
+
const observer = new MutationObserver(syncTheme);
|
|
1530
|
+
observer.observe(root, { attributes: true, attributeFilter: ["data-sia-theme"] });
|
|
1531
|
+
return () => observer.disconnect();
|
|
1532
|
+
}, [theme, showThemeSwitch]);
|
|
1533
|
+
function changeTheme(checked) {
|
|
1534
|
+
const nextTheme = checked ? "dark" : "light";
|
|
1535
|
+
if (theme === void 0) {
|
|
1536
|
+
const root = titleBarRef.current?.ownerDocument.documentElement;
|
|
1537
|
+
if (root) applySiaTheme(nextTheme, root);
|
|
1538
|
+
setDocumentTheme(nextTheme);
|
|
1539
|
+
}
|
|
1540
|
+
onThemeChange?.(nextTheme);
|
|
1541
|
+
}
|
|
1542
|
+
const cancelDrag = useRef7(null);
|
|
1429
1543
|
useEffect4(() => () => cancelDrag.current?.(), [draggable]);
|
|
1430
1544
|
function handleMouseDown(event) {
|
|
1431
1545
|
cancelDrag.current?.();
|
|
@@ -1460,7 +1574,7 @@ function WindowTitleBar({
|
|
|
1460
1574
|
document.addEventListener("mouseup", cancel, true);
|
|
1461
1575
|
window.addEventListener("blur", cancel);
|
|
1462
1576
|
}
|
|
1463
|
-
const renderedControls = controls === true ? /* @__PURE__ */
|
|
1577
|
+
const renderedControls = controls === true ? /* @__PURE__ */ jsx10(
|
|
1464
1578
|
WindowControls,
|
|
1465
1579
|
{
|
|
1466
1580
|
maximized,
|
|
@@ -1469,20 +1583,22 @@ function WindowTitleBar({
|
|
|
1469
1583
|
onAction: onWindowAction
|
|
1470
1584
|
}
|
|
1471
1585
|
) : controls || null;
|
|
1472
|
-
const renderedActions = actions ? /* @__PURE__ */
|
|
1473
|
-
return /* @__PURE__ */
|
|
1586
|
+
const renderedActions = actions ? /* @__PURE__ */ jsx10("div", { className: "sia-window-titlebar__actions", "data-sia-window-no-drag": "", children: actions }) : null;
|
|
1587
|
+
return /* @__PURE__ */ jsxs10(
|
|
1474
1588
|
"header",
|
|
1475
1589
|
{
|
|
1590
|
+
ref: titleBarRef,
|
|
1476
1591
|
className: `sia-window-titlebar ${className}`.trim(),
|
|
1477
1592
|
"data-actions-align": actionsAlign,
|
|
1478
1593
|
onMouseDown: handleMouseDown,
|
|
1479
1594
|
...withTitleTooltip(props),
|
|
1480
1595
|
children: [
|
|
1481
|
-
leading ? /* @__PURE__ */
|
|
1596
|
+
leading ? /* @__PURE__ */ jsx10("div", { className: "sia-window-titlebar__leading", children: leading }) : null,
|
|
1482
1597
|
actionsAlign === "left" ? renderedActions : null,
|
|
1483
1598
|
children,
|
|
1484
|
-
/* @__PURE__ */
|
|
1599
|
+
/* @__PURE__ */ jsx10("div", { className: "sia-window-titlebar__drag-region", "aria-hidden": "true" }),
|
|
1485
1600
|
actionsAlign === "right" ? renderedActions : null,
|
|
1601
|
+
showThemeSwitch ? /* @__PURE__ */ jsx10("div", { className: "sia-window-titlebar__theme", "data-sia-window-no-drag": "", children: /* @__PURE__ */ jsx10(ThemeSwitch, { checked: (theme ?? documentTheme) === "dark", onCheckedChange: changeTheme, lightLabel: "\u5207\u6362\u5230\u6DF1\u8272\u4E3B\u9898", darkLabel: "\u5207\u6362\u5230\u6D45\u8272\u4E3B\u9898" }) }) : null,
|
|
1486
1602
|
renderedControls
|
|
1487
1603
|
]
|
|
1488
1604
|
}
|
|
@@ -1490,11 +1606,10 @@ function WindowTitleBar({
|
|
|
1490
1606
|
}
|
|
1491
1607
|
|
|
1492
1608
|
// src/components/Drawer.tsx
|
|
1493
|
-
import { createContext, forwardRef, useCallback, useContext, useEffect as useEffect5, useId as useId2, useMemo as useMemo3, useRef as
|
|
1609
|
+
import { createContext, forwardRef as forwardRef2, useCallback, useContext, useEffect as useEffect5, useId as useId2, useMemo as useMemo3, useRef as useRef8, useState as useState9 } from "react";
|
|
1494
1610
|
import { createRoot } from "react-dom/client";
|
|
1495
|
-
import { jsx as
|
|
1611
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1496
1612
|
var drawerHandles = /* @__PURE__ */ new Set();
|
|
1497
|
-
var DRAWER_MOTION_DURATION = 400;
|
|
1498
1613
|
var DEFAULT_DRAWER_PUSH_DISTANCE = 180;
|
|
1499
1614
|
var DrawerStackContext = createContext(null);
|
|
1500
1615
|
function createPushOffset(distance, depth, negative) {
|
|
@@ -1503,8 +1618,10 @@ function createPushOffset(distance, depth, negative) {
|
|
|
1503
1618
|
const operator = negative ? " - " : " + ";
|
|
1504
1619
|
return `calc(0px${operator}${Array.from({ length: depth }, () => distance).join(operator)})`;
|
|
1505
1620
|
}
|
|
1506
|
-
var DrawerRoot =
|
|
1621
|
+
var DrawerRoot = forwardRef2(function Drawer({
|
|
1507
1622
|
open,
|
|
1623
|
+
deferContent = false,
|
|
1624
|
+
loadingFallback,
|
|
1508
1625
|
title,
|
|
1509
1626
|
children,
|
|
1510
1627
|
extra,
|
|
@@ -1526,18 +1643,16 @@ var DrawerRoot = forwardRef(function Drawer({
|
|
|
1526
1643
|
style,
|
|
1527
1644
|
...props
|
|
1528
1645
|
}, forwardedRef) {
|
|
1529
|
-
const localRef =
|
|
1530
|
-
const bodyRef =
|
|
1646
|
+
const localRef = useRef8(null);
|
|
1647
|
+
const bodyRef = useRef8(null);
|
|
1531
1648
|
const titleId = useId2();
|
|
1532
1649
|
const drawerId = useId2();
|
|
1533
1650
|
const parentStack = useContext(DrawerStackContext);
|
|
1534
|
-
const
|
|
1535
|
-
const
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
const [
|
|
1539
|
-
const [closing, setClosing] = useState8(false);
|
|
1540
|
-
const [openChildIds, setOpenChildIds] = useState8(() => /* @__PURE__ */ new Set());
|
|
1651
|
+
const motion = useOverlayMotion(open, localRef, "drawer", placement, true, (value) => value ? afterOpen?.() : afterClose?.());
|
|
1652
|
+
const { present: rendered, closing } = motion;
|
|
1653
|
+
const bodyReady = !closing && (!deferContent || motion.settled);
|
|
1654
|
+
const exitPlaceholder = useOverlayExitPlaceholder(open, rendered, localRef, bodyRef, bodyReady && loadingFallback === void 0);
|
|
1655
|
+
const [openChildIds, setOpenChildIds] = useState9(() => /* @__PURE__ */ new Set());
|
|
1541
1656
|
const setChildOpen = useCallback((id, childOpen) => {
|
|
1542
1657
|
setOpenChildIds((current) => {
|
|
1543
1658
|
const hasId = current.has(id);
|
|
@@ -1549,26 +1664,6 @@ var DrawerRoot = forwardRef(function Drawer({
|
|
|
1549
1664
|
});
|
|
1550
1665
|
}, []);
|
|
1551
1666
|
const stackContextValue = useMemo3(() => ({ setChildOpen }), [setChildOpen]);
|
|
1552
|
-
useEffect5(() => {
|
|
1553
|
-
if (open) {
|
|
1554
|
-
setRendered(true);
|
|
1555
|
-
setClosing(false);
|
|
1556
|
-
return void 0;
|
|
1557
|
-
}
|
|
1558
|
-
if (!rendered) return void 0;
|
|
1559
|
-
setClosing(true);
|
|
1560
|
-
const timer = window.setTimeout(() => {
|
|
1561
|
-
setRendered(false);
|
|
1562
|
-
setClosing(false);
|
|
1563
|
-
afterCloseRef.current?.();
|
|
1564
|
-
}, DRAWER_MOTION_DURATION);
|
|
1565
|
-
return () => window.clearTimeout(timer);
|
|
1566
|
-
}, [open, rendered]);
|
|
1567
|
-
useEffect5(() => {
|
|
1568
|
-
if (!open || !rendered) return void 0;
|
|
1569
|
-
const timer = window.setTimeout(() => afterOpenRef.current?.(), DRAWER_MOTION_DURATION);
|
|
1570
|
-
return () => window.clearTimeout(timer);
|
|
1571
|
-
}, [open, rendered]);
|
|
1572
1667
|
useEffect5(() => {
|
|
1573
1668
|
if (!parentStack) return void 0;
|
|
1574
1669
|
parentStack.setChildOpen(drawerId, open);
|
|
@@ -1599,14 +1694,14 @@ var DrawerRoot = forwardRef(function Drawer({
|
|
|
1599
1694
|
"--sia-drawer-push-x": horizontalPush ? pushOffset : "0px",
|
|
1600
1695
|
"--sia-drawer-push-y": horizontalPush ? "0px" : pushOffset
|
|
1601
1696
|
};
|
|
1602
|
-
return /* @__PURE__ */
|
|
1603
|
-
/* @__PURE__ */
|
|
1604
|
-
/* @__PURE__ */
|
|
1697
|
+
return /* @__PURE__ */ jsx11(DrawerStackContext.Provider, { value: stackContextValue, children: /* @__PURE__ */ jsx11(OverlayPortal, { container: getContainer, children: /* @__PURE__ */ jsxs11("div", { className: "sia-drawer-root", "data-state": closing ? "closing" : "open", style: { zIndex }, children: [
|
|
1698
|
+
/* @__PURE__ */ jsx11("button", { className: "sia-drawer__mask", type: "button", "aria-label": "\u5173\u95ED\u62BD\u5C49", onClick: () => maskClosable && requestClose() }),
|
|
1699
|
+
/* @__PURE__ */ jsxs11(
|
|
1605
1700
|
"div",
|
|
1606
1701
|
{
|
|
1607
1702
|
ref: setRef,
|
|
1608
1703
|
className: `sia-drawer sia-drawer--${placement} ${className}`.trim(),
|
|
1609
|
-
style: mergedStyle,
|
|
1704
|
+
style: { ...mergedStyle, ...exitPlaceholder.panelStyle, animation: "none", transformOrigin: placement === "left" ? "left center" : placement === "right" ? "right center" : placement === "top" ? "center top" : "center bottom" },
|
|
1610
1705
|
"data-push-depth": effectivePushDepth,
|
|
1611
1706
|
role: "dialog",
|
|
1612
1707
|
"aria-modal": "true",
|
|
@@ -1614,16 +1709,16 @@ var DrawerRoot = forwardRef(function Drawer({
|
|
|
1614
1709
|
tabIndex: -1,
|
|
1615
1710
|
...withTitleTooltip(props),
|
|
1616
1711
|
children: [
|
|
1617
|
-
/* @__PURE__ */
|
|
1618
|
-
/* @__PURE__ */
|
|
1619
|
-
closable ? /* @__PURE__ */
|
|
1620
|
-
title ? /* @__PURE__ */
|
|
1712
|
+
/* @__PURE__ */ jsxs11("div", { className: "sia-drawer__header", children: [
|
|
1713
|
+
/* @__PURE__ */ jsxs11("div", { className: "sia-drawer__heading", children: [
|
|
1714
|
+
closable ? /* @__PURE__ */ jsx11("button", { type: "button", className: "sia-drawer__close", "aria-label": "\u5173\u95ED\u62BD\u5C49", onClick: requestClose, children: /* @__PURE__ */ jsx11(Icon, { name: "close", size: 17 }) }) : null,
|
|
1715
|
+
title ? /* @__PURE__ */ jsx11("strong", { id: titleId, children: title }) : null
|
|
1621
1716
|
] }),
|
|
1622
|
-
extra ? /* @__PURE__ */
|
|
1717
|
+
extra ? /* @__PURE__ */ jsx11("div", { className: "sia-drawer__extra", children: extra }) : null
|
|
1623
1718
|
] }),
|
|
1624
|
-
/* @__PURE__ */
|
|
1625
|
-
/* @__PURE__ */
|
|
1626
|
-
footer ? /* @__PURE__ */
|
|
1719
|
+
/* @__PURE__ */ jsx11("div", { ref: bodyRef, className: `sia-drawer__body${deferContent && bodyReady ? " sia-overlay-body--ready" : ""}`, "aria-busy": !bodyReady, style: exitPlaceholder.bodyStyle, children: bodyReady ? children : loadingFallback !== void 0 ? loadingFallback : closing && exitPlaceholder.layout ? /* @__PURE__ */ jsx11(OverlayContentSkeleton, { layout: exitPlaceholder.layout }) : /* @__PURE__ */ jsx11(Skeleton, {}) }),
|
|
1720
|
+
/* @__PURE__ */ jsx11(FloatingScrollbarProvider, { targetRef: bodyRef, disabled: !bodyReady }),
|
|
1721
|
+
footer && (bodyReady || closing && motion.entered) ? /* @__PURE__ */ jsx11("div", { className: "sia-drawer__footer", children: footer }) : null
|
|
1627
1722
|
]
|
|
1628
1723
|
}
|
|
1629
1724
|
)
|
|
@@ -1640,11 +1735,10 @@ function openDrawer(config) {
|
|
|
1640
1735
|
let currentConfig = config;
|
|
1641
1736
|
let currentOpen = true;
|
|
1642
1737
|
let destroyed = false;
|
|
1643
|
-
let
|
|
1738
|
+
let mounted = false;
|
|
1644
1739
|
function cleanup() {
|
|
1645
1740
|
if (destroyed) return;
|
|
1646
1741
|
destroyed = true;
|
|
1647
|
-
if (cleanupTimer !== void 0) window.clearTimeout(cleanupTimer);
|
|
1648
1742
|
root.unmount();
|
|
1649
1743
|
container.remove();
|
|
1650
1744
|
drawerHandles.delete(handle);
|
|
@@ -1653,25 +1747,34 @@ function openDrawer(config) {
|
|
|
1653
1747
|
if (destroyed || !currentOpen) return;
|
|
1654
1748
|
currentOpen = false;
|
|
1655
1749
|
render();
|
|
1656
|
-
cleanupTimer = window.setTimeout(cleanup, DRAWER_MOTION_DURATION + 100);
|
|
1657
1750
|
}
|
|
1658
|
-
function
|
|
1659
|
-
|
|
1751
|
+
function DrawerInstance() {
|
|
1752
|
+
useEffect5(() => {
|
|
1753
|
+
mounted = true;
|
|
1754
|
+
if (!currentOpen) render();
|
|
1755
|
+
}, []);
|
|
1756
|
+
return /* @__PURE__ */ jsx11(
|
|
1660
1757
|
DrawerRoot,
|
|
1661
1758
|
{
|
|
1662
1759
|
...currentConfig,
|
|
1663
|
-
open: currentOpen,
|
|
1760
|
+
open: !mounted || currentOpen,
|
|
1664
1761
|
onOpenChange: (nextOpen) => {
|
|
1665
1762
|
currentConfig.onOpenChange?.(nextOpen);
|
|
1666
1763
|
if (!nextOpen) closeWithMotion();
|
|
1667
1764
|
},
|
|
1668
1765
|
afterOpen: () => currentConfig.afterOpen?.(),
|
|
1669
1766
|
afterClose: () => {
|
|
1670
|
-
|
|
1671
|
-
|
|
1767
|
+
try {
|
|
1768
|
+
currentConfig.afterClose?.();
|
|
1769
|
+
} finally {
|
|
1770
|
+
queueMicrotask(cleanup);
|
|
1771
|
+
}
|
|
1672
1772
|
}
|
|
1673
1773
|
}
|
|
1674
|
-
)
|
|
1774
|
+
);
|
|
1775
|
+
}
|
|
1776
|
+
function render() {
|
|
1777
|
+
root.render(/* @__PURE__ */ jsx11(DrawerInstance, {}));
|
|
1675
1778
|
}
|
|
1676
1779
|
const handle = {
|
|
1677
1780
|
destroy: closeWithMotion,
|
|
@@ -1695,9 +1798,9 @@ var Drawer2 = Object.assign(DrawerRoot, {
|
|
|
1695
1798
|
});
|
|
1696
1799
|
|
|
1697
1800
|
// src/components/Form.tsx
|
|
1698
|
-
import { Children as Children3, cloneElement as cloneElement2, createContext as createContext2, forwardRef as
|
|
1699
|
-
import { Fragment as Fragment4, jsx as
|
|
1700
|
-
var Switch =
|
|
1801
|
+
import { Children as Children3, cloneElement as cloneElement2, createContext as createContext2, forwardRef as forwardRef3, 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";
|
|
1802
|
+
import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1803
|
+
var Switch = forwardRef3(function Switch2({
|
|
1701
1804
|
label,
|
|
1702
1805
|
variant = "standard",
|
|
1703
1806
|
size: sizeProp,
|
|
@@ -1708,6 +1811,22 @@ var Switch = forwardRef2(function Switch2({
|
|
|
1708
1811
|
className = "",
|
|
1709
1812
|
...props
|
|
1710
1813
|
}, ref) {
|
|
1814
|
+
const trackRef = useRef9(null);
|
|
1815
|
+
useLayoutEffect3(() => {
|
|
1816
|
+
const track = trackRef.current;
|
|
1817
|
+
if (!track) return;
|
|
1818
|
+
const updateTravel = () => {
|
|
1819
|
+
const thumb = track.querySelector(".sia-switch__thumb");
|
|
1820
|
+
if (!thumb) return;
|
|
1821
|
+
const travel = variant === "segmented" ? track.clientWidth / 2 - 3 : track.clientWidth - thumb.offsetWidth - 4;
|
|
1822
|
+
const value = `${Math.max(0, travel)}px`;
|
|
1823
|
+
if (track.style.getPropertyValue("--sia-switch-travel") !== value) track.style.setProperty("--sia-switch-travel", value);
|
|
1824
|
+
};
|
|
1825
|
+
updateTravel();
|
|
1826
|
+
const observer = new ResizeObserver(updateTravel);
|
|
1827
|
+
observer.observe(track);
|
|
1828
|
+
return () => observer.disconnect();
|
|
1829
|
+
}, [variant, sizeProp]);
|
|
1711
1830
|
const size = useControlSize(sizeProp);
|
|
1712
1831
|
const hasContent = checkedContent !== void 0 || uncheckedContent !== void 0;
|
|
1713
1832
|
const checkedVisual = checkedContent ?? (variant === "segmented" ? "\u5F00" : null);
|
|
@@ -1716,26 +1835,27 @@ var Switch = forwardRef2(function Switch2({
|
|
|
1716
1835
|
onCheckedChange?.(event.currentTarget.checked);
|
|
1717
1836
|
onChange?.(event);
|
|
1718
1837
|
};
|
|
1719
|
-
return /* @__PURE__ */
|
|
1720
|
-
/* @__PURE__ */
|
|
1721
|
-
/* @__PURE__ */
|
|
1838
|
+
return /* @__PURE__ */ jsxs12("label", { className: `sia-switch-wrap sia-switch-wrap--${size} ${className}`.trim(), children: [
|
|
1839
|
+
/* @__PURE__ */ jsx12("input", { ref, type: "checkbox", role: "switch", className: "sia-switch-input", onChange: handleChange, ...withTitleTooltip(props) }),
|
|
1840
|
+
/* @__PURE__ */ jsxs12(
|
|
1722
1841
|
"span",
|
|
1723
1842
|
{
|
|
1843
|
+
ref: trackRef,
|
|
1724
1844
|
className: `sia-switch sia-switch--${variant}${variant === "standard" && hasContent ? " sia-switch--with-content" : ""}`,
|
|
1725
1845
|
"aria-hidden": "true",
|
|
1726
1846
|
children: [
|
|
1727
|
-
/* @__PURE__ */
|
|
1728
|
-
variant === "segmented" ? /* @__PURE__ */
|
|
1729
|
-
/* @__PURE__ */
|
|
1730
|
-
/* @__PURE__ */
|
|
1731
|
-
] }) : hasContent ? /* @__PURE__ */
|
|
1732
|
-
/* @__PURE__ */
|
|
1733
|
-
/* @__PURE__ */
|
|
1847
|
+
/* @__PURE__ */ jsx12("span", { className: "sia-switch__thumb" }),
|
|
1848
|
+
variant === "segmented" ? /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
1849
|
+
/* @__PURE__ */ jsx12("span", { className: "sia-switch__segment sia-switch__segment--unchecked", children: uncheckedVisual }),
|
|
1850
|
+
/* @__PURE__ */ jsx12("span", { className: "sia-switch__segment sia-switch__segment--checked", children: checkedVisual })
|
|
1851
|
+
] }) : hasContent ? /* @__PURE__ */ jsxs12("span", { className: "sia-switch__content", children: [
|
|
1852
|
+
/* @__PURE__ */ jsx12("span", { className: "sia-switch__content-item sia-switch__content-item--unchecked", children: uncheckedVisual }),
|
|
1853
|
+
/* @__PURE__ */ jsx12("span", { className: "sia-switch__content-item sia-switch__content-item--checked", children: checkedVisual })
|
|
1734
1854
|
] }) : null
|
|
1735
1855
|
]
|
|
1736
1856
|
}
|
|
1737
1857
|
),
|
|
1738
|
-
label ? /* @__PURE__ */
|
|
1858
|
+
label ? /* @__PURE__ */ jsx12("span", { className: "sia-switch__label", children: label }) : null
|
|
1739
1859
|
] });
|
|
1740
1860
|
});
|
|
1741
1861
|
function pathArray(name) {
|
|
@@ -1952,7 +2072,7 @@ var FormStore = class {
|
|
|
1952
2072
|
};
|
|
1953
2073
|
var FormContext = createContext2(null);
|
|
1954
2074
|
function useForm(form) {
|
|
1955
|
-
const ref =
|
|
2075
|
+
const ref = useRef9(form ?? new FormStore());
|
|
1956
2076
|
return [ref.current];
|
|
1957
2077
|
}
|
|
1958
2078
|
function FormRoot({
|
|
@@ -1977,7 +2097,7 @@ function FormRoot({
|
|
|
1977
2097
|
const instance = internalForm;
|
|
1978
2098
|
instance.configure(initialValues, { onFinish, onFinishFailed, onValuesChange });
|
|
1979
2099
|
const context = useMemo4(() => instance, [instance]);
|
|
1980
|
-
const formRef =
|
|
2100
|
+
const formRef = useRef9(null);
|
|
1981
2101
|
useLayoutEffect3(() => {
|
|
1982
2102
|
const root = formRef.current;
|
|
1983
2103
|
if (!root) return;
|
|
@@ -2018,7 +2138,7 @@ function FormRoot({
|
|
|
2018
2138
|
if (frame) cancelAnimationFrame(frame);
|
|
2019
2139
|
};
|
|
2020
2140
|
}, []);
|
|
2021
|
-
return /* @__PURE__ */
|
|
2141
|
+
return /* @__PURE__ */ jsx12(FormContext.Provider, { value: context, children: /* @__PURE__ */ jsx12(PlaceholderModeContext.Provider, { value: resolvedPlaceholderMode, children: /* @__PURE__ */ jsx12(ControlSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx12(
|
|
2022
2142
|
"form",
|
|
2023
2143
|
{
|
|
2024
2144
|
ref: formRef,
|
|
@@ -2030,7 +2150,7 @@ function FormRoot({
|
|
|
2030
2150
|
event.stopPropagation();
|
|
2031
2151
|
instance.submit();
|
|
2032
2152
|
},
|
|
2033
|
-
children: /* @__PURE__ */
|
|
2153
|
+
children: /* @__PURE__ */ jsx12("fieldset", { disabled, children })
|
|
2034
2154
|
}
|
|
2035
2155
|
) }) }) });
|
|
2036
2156
|
}
|
|
@@ -2058,11 +2178,11 @@ function FormItem({
|
|
|
2058
2178
|
}) {
|
|
2059
2179
|
const form = useContext2(FormContext);
|
|
2060
2180
|
const id = useId3();
|
|
2061
|
-
const itemRef =
|
|
2062
|
-
const errorContentRef =
|
|
2063
|
-
const [errorObscured, setErrorObscured] =
|
|
2064
|
-
const [errorPreview, setErrorPreview] =
|
|
2065
|
-
const [errorHovered, setErrorHovered] =
|
|
2181
|
+
const itemRef = useRef9(null);
|
|
2182
|
+
const errorContentRef = useRef9(null);
|
|
2183
|
+
const [errorObscured, setErrorObscured] = useState10(false);
|
|
2184
|
+
const [errorPreview, setErrorPreview] = useState10(false);
|
|
2185
|
+
const [errorHovered, setErrorHovered] = useState10(false);
|
|
2066
2186
|
if (!form) throw new Error("Form.Item \u5FC5\u987B\u5728 Form \u5185\u4F7F\u7528");
|
|
2067
2187
|
useSyncExternalStore(form.subscribe, form.getSnapshot, form.getSnapshot);
|
|
2068
2188
|
const path = name === void 0 ? void 0 : pathArray(name);
|
|
@@ -2176,20 +2296,20 @@ function FormItem({
|
|
|
2176
2296
|
content = children;
|
|
2177
2297
|
}
|
|
2178
2298
|
}
|
|
2179
|
-
if (noStyle) return /* @__PURE__ */
|
|
2180
|
-
const inputWrap = /* @__PURE__ */
|
|
2181
|
-
return /* @__PURE__ */
|
|
2182
|
-
label ? /* @__PURE__ */
|
|
2183
|
-
ruleRequired ? /* @__PURE__ */
|
|
2299
|
+
if (noStyle) return /* @__PURE__ */ jsx12(Fragment4, { children: content });
|
|
2300
|
+
const inputWrap = /* @__PURE__ */ jsx12("div", { className: "sia-form-item__input-wrap", onMouseEnter: () => setErrorHovered(true), onMouseLeave: () => setErrorHovered(false), children: content });
|
|
2301
|
+
return /* @__PURE__ */ jsxs12("div", { ref: itemRef, className: `sia-form-item${align === "center" ? " sia-form-item--align-center" : ""}${status ? ` sia-form-item--${status}` : ""} ${className}`.trim(), "data-sia-form-field": key || void 0, children: [
|
|
2302
|
+
label ? /* @__PURE__ */ jsx12("div", { id: labelId, className: "sia-form-item__label", children: /* @__PURE__ */ jsxs12("span", { className: "sia-form-item__label-content", children: [
|
|
2303
|
+
ruleRequired ? /* @__PURE__ */ jsx12("span", { className: "sia-form-item__required-mark", "aria-hidden": "true", children: "*" }) : null,
|
|
2184
2304
|
label
|
|
2185
2305
|
] }) }) : null,
|
|
2186
|
-
/* @__PURE__ */
|
|
2187
|
-
/* @__PURE__ */
|
|
2306
|
+
/* @__PURE__ */ jsxs12("div", { className: "sia-form-item__control", children: [
|
|
2307
|
+
/* @__PURE__ */ jsx12(
|
|
2188
2308
|
Tooltip,
|
|
2189
2309
|
{
|
|
2190
|
-
title: hasError ? /* @__PURE__ */
|
|
2191
|
-
/* @__PURE__ */
|
|
2192
|
-
/* @__PURE__ */
|
|
2310
|
+
title: hasError ? /* @__PURE__ */ jsxs12("span", { ref: errorContentRef, id: errorId, className: "sia-form-item__error-content", children: [
|
|
2311
|
+
/* @__PURE__ */ jsx12(Icon, { className: "sia-form-item__error-icon", name: "circle-close", variant: "filled", size: 16, "aria-hidden": "true" }),
|
|
2312
|
+
/* @__PURE__ */ jsx12("span", { children: helpContent })
|
|
2193
2313
|
] }) : null,
|
|
2194
2314
|
placement: "bottom-start",
|
|
2195
2315
|
trigger: [],
|
|
@@ -2200,8 +2320,8 @@ function FormItem({
|
|
|
2200
2320
|
children: inputWrap
|
|
2201
2321
|
}
|
|
2202
2322
|
),
|
|
2203
|
-
status !== "error" && helpContent ? /* @__PURE__ */
|
|
2204
|
-
extra ? /* @__PURE__ */
|
|
2323
|
+
status !== "error" && helpContent ? /* @__PURE__ */ jsx12("div", { className: "sia-form-item__help", children: helpContent }) : null,
|
|
2324
|
+
extra ? /* @__PURE__ */ jsx12("div", { className: "sia-form-item__extra", children: extra }) : null
|
|
2205
2325
|
] })
|
|
2206
2326
|
] });
|
|
2207
2327
|
}
|
|
@@ -2231,7 +2351,7 @@ function FormList({ name, children }) {
|
|
|
2231
2351
|
return children(values.map((_, index) => ({ key: index, name: index })), operations);
|
|
2232
2352
|
}
|
|
2233
2353
|
function FormErrorList({ errors = [] }) {
|
|
2234
|
-
return errors.length ? /* @__PURE__ */
|
|
2354
|
+
return errors.length ? /* @__PURE__ */ jsx12("div", { className: "sia-form-error-list", children: errors.map((error, index) => /* @__PURE__ */ jsx12("div", { children: error }, index)) }) : null;
|
|
2235
2355
|
}
|
|
2236
2356
|
var Form = Object.assign(FormRoot, {
|
|
2237
2357
|
/** 表单字段,负责字段值绑定、校验和标签布局。 */
|
|
@@ -2244,18 +2364,195 @@ var Form = Object.assign(FormRoot, {
|
|
|
2244
2364
|
useForm
|
|
2245
2365
|
});
|
|
2246
2366
|
|
|
2367
|
+
// src/components/RadioSelectionMotion.tsx
|
|
2368
|
+
import { useLayoutEffect as useLayoutEffect4, useRef as useRef10 } from "react";
|
|
2369
|
+
|
|
2370
|
+
// src/components/radioFluidMotion.ts
|
|
2371
|
+
function radioFluidShape(from, to, progress) {
|
|
2372
|
+
const mix = (a, b) => a + (b - a) * progress;
|
|
2373
|
+
const flow = Math.sin(Math.PI * progress);
|
|
2374
|
+
const stretch = flow * Math.min(Math.abs(to.x - from.x) * 0.35, Math.min(from.width, to.width) * 0.4);
|
|
2375
|
+
const left = Math.max(Math.min(from.x, to.x), mix(from.x, to.x) - stretch);
|
|
2376
|
+
const right = Math.min(Math.max(from.x + from.width, to.x + to.width), mix(from.x + from.width, to.x + to.width) + stretch);
|
|
2377
|
+
const centerY = mix(from.y + from.height / 2, to.y + to.height / 2);
|
|
2378
|
+
const height = mix(from.height, to.height) * (1 - 0.18 * flow);
|
|
2379
|
+
const top = centerY - height / 2, bottom = centerY + height / 2, width = right - left;
|
|
2380
|
+
const junction = (from.x + from.width / 2 + to.x + to.width / 2) / 2;
|
|
2381
|
+
const neckX = Math.max(left + width * 0.24, Math.min(right - width * 0.24, junction)), neckHeight = height * (1 - 0.86 * flow * flow);
|
|
2382
|
+
const nt = centerY - neckHeight / 2, nb = centerY + neckHeight / 2;
|
|
2383
|
+
const shoulderL = left + (neckX - left) * 0.28, shoulderR = right - (right - neckX) * 0.28;
|
|
2384
|
+
const curveL = (neckX - shoulderL) * 0.48, curveR = (shoulderR - neckX) * 0.48;
|
|
2385
|
+
const [tl, tr, br, bl] = from.radii.map((r, i) => Math.min(height / 2, width * 0.15, mix(r, to.radii[i]) + flow * 5));
|
|
2386
|
+
return [
|
|
2387
|
+
[left + tl, top],
|
|
2388
|
+
[shoulderL, top],
|
|
2389
|
+
[neckX - curveL, top],
|
|
2390
|
+
[neckX - curveL, nt],
|
|
2391
|
+
[neckX, nt],
|
|
2392
|
+
[neckX + curveR, nt],
|
|
2393
|
+
[neckX + curveR, top],
|
|
2394
|
+
[shoulderR, top],
|
|
2395
|
+
[right - tr, top],
|
|
2396
|
+
[right, top],
|
|
2397
|
+
[right, top + tr],
|
|
2398
|
+
[right, bottom - br],
|
|
2399
|
+
[right, bottom],
|
|
2400
|
+
[right - br, bottom],
|
|
2401
|
+
[shoulderR, bottom],
|
|
2402
|
+
[neckX + curveR, bottom],
|
|
2403
|
+
[neckX + curveR, nb],
|
|
2404
|
+
[neckX, nb],
|
|
2405
|
+
[neckX - curveL, nb],
|
|
2406
|
+
[neckX - curveL, bottom],
|
|
2407
|
+
[shoulderL, bottom],
|
|
2408
|
+
[left + bl, bottom],
|
|
2409
|
+
[left, bottom],
|
|
2410
|
+
[left, bottom - bl],
|
|
2411
|
+
[left, top + tl],
|
|
2412
|
+
[left, top]
|
|
2413
|
+
];
|
|
2414
|
+
}
|
|
2415
|
+
function radioFluidPath(points, origin) {
|
|
2416
|
+
const p = points.map(([x, y]) => `${(x - origin.x).toFixed(3)} ${(y - origin.y).toFixed(3)}`);
|
|
2417
|
+
return `path("M ${p[0]} L ${p[1]} C ${p[2]} ${p[3]} ${p[4]} C ${p[5]} ${p[6]} ${p[7]} L ${p[8]} Q ${p[9]} ${p[10]} L ${p[11]} Q ${p[12]} ${p[13]} L ${p[14]} C ${p[15]} ${p[16]} ${p[17]} C ${p[18]} ${p[19]} ${p[20]} L ${p[21]} Q ${p[22]} ${p[23]} L ${p[24]} Q ${p[25]} ${p[0]} Z")`;
|
|
2418
|
+
}
|
|
2419
|
+
|
|
2420
|
+
// src/components/RadioSelectionMotion.tsx
|
|
2421
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2422
|
+
function RadioSelectionMotion({ rootRef }) {
|
|
2423
|
+
const indicatorRef = useRef10(null);
|
|
2424
|
+
const previous = useRef10();
|
|
2425
|
+
const animation = useRef10();
|
|
2426
|
+
const flowing = useRef10();
|
|
2427
|
+
useLayoutEffect4(() => {
|
|
2428
|
+
const indicator = indicatorRef.current;
|
|
2429
|
+
const root = rootRef.current ?? indicator?.parentElement;
|
|
2430
|
+
if (!root || !indicator) return;
|
|
2431
|
+
let frame = 0;
|
|
2432
|
+
const media = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
2433
|
+
const update = () => {
|
|
2434
|
+
const labels = [...root.querySelectorAll(":scope > .sia-radio--button.sia-radio--solid")];
|
|
2435
|
+
const target = labels.find((label) => label.querySelector("input")?.checked && label.getClientRects().length);
|
|
2436
|
+
if (!target || !root.offsetWidth) {
|
|
2437
|
+
animation.current?.cancel();
|
|
2438
|
+
previous.current = void 0;
|
|
2439
|
+
indicator.style.display = "none";
|
|
2440
|
+
delete root.dataset.siaRadioMotion;
|
|
2441
|
+
delete root.dataset.siaRadioMoving;
|
|
2442
|
+
return;
|
|
2443
|
+
}
|
|
2444
|
+
const bounds = root.getBoundingClientRect();
|
|
2445
|
+
const scaleX = bounds.width / root.offsetWidth || 1, scaleY = bounds.height / root.offsetHeight || 1;
|
|
2446
|
+
const box = (node) => {
|
|
2447
|
+
const rect = node.getBoundingClientRect();
|
|
2448
|
+
return { x: (rect.left - bounds.left) / scaleX + root.scrollLeft - root.clientLeft, y: (rect.top - bounds.top) / scaleY + root.scrollTop - root.clientTop, width: rect.width / scaleX, height: rect.height / scaleY };
|
|
2449
|
+
};
|
|
2450
|
+
const targetStyle = getComputedStyle(target);
|
|
2451
|
+
const next = { ...box(target), target, radii: [targetStyle.borderTopLeftRadius, targetStyle.borderTopRightRadius, targetStyle.borderBottomRightRadius, targetStyle.borderBottomLeftRadius].map((value) => parseFloat(value) || 0) };
|
|
2452
|
+
root.dataset.siaRadioMotion = "";
|
|
2453
|
+
indicator.style.opacity = target.querySelector("input")?.disabled ? ".58" : "1";
|
|
2454
|
+
const last = previous.current;
|
|
2455
|
+
if (last?.target === target && Math.abs(last.x - next.x) < 0.5 && Math.abs(last.y - next.y) < 0.5 && Math.abs(last.width - next.width) < 0.5 && Math.abs(last.height - next.height) < 0.5) return;
|
|
2456
|
+
let initialShape;
|
|
2457
|
+
const current = flowing.current;
|
|
2458
|
+
if (current && ["running", "paused"].includes(current.animation.playState)) {
|
|
2459
|
+
const position = Number(current.animation.effect?.getComputedTiming().progress ?? 0) * (current.shapes.length - 1);
|
|
2460
|
+
const index = Math.min(current.shapes.length - 2, Math.floor(position)), fraction = position - index;
|
|
2461
|
+
initialShape = current.shapes[index].map(([x, y], i) => [x + (current.shapes[index + 1][i][0] - x) * fraction, y + (current.shapes[index + 1][i][1] - y) * fraction]);
|
|
2462
|
+
}
|
|
2463
|
+
const xs = initialShape?.map((p) => p[0]), ys = initialShape?.map((p) => p[1]);
|
|
2464
|
+
const from = initialShape && xs && ys ? { x: Math.min(...xs), y: Math.min(...ys), width: Math.max(...xs) - Math.min(...xs), height: Math.max(...ys) - Math.min(...ys), radii: next.radii } : last;
|
|
2465
|
+
animation.current?.cancel();
|
|
2466
|
+
delete root.dataset.siaRadioMoving;
|
|
2467
|
+
flowing.current = void 0;
|
|
2468
|
+
indicator.style.display = "block";
|
|
2469
|
+
indicator.style.width = `${next.width}px`;
|
|
2470
|
+
indicator.style.height = `${next.height}px`;
|
|
2471
|
+
indicator.style.borderRadius = getComputedStyle(target).borderRadius;
|
|
2472
|
+
indicator.style.clipPath = "none";
|
|
2473
|
+
const transform = (rect) => `translate(${rect.x}px,${rect.y}px) scale(${rect.width / next.width},${rect.height / next.height})`;
|
|
2474
|
+
indicator.style.transform = transform(next);
|
|
2475
|
+
previous.current = next;
|
|
2476
|
+
if (!from || last?.target === target || media.matches || !indicator.animate || target.querySelector("input")?.disabled) return;
|
|
2477
|
+
const shapes = Array.from({ length: 33 }, (_, index) => {
|
|
2478
|
+
const p = index / 32, progress = p * p * (3 - 2 * p), shape = radioFluidShape(from, next, progress);
|
|
2479
|
+
const blend = Math.min(1, p / 0.25);
|
|
2480
|
+
return initialShape ? shape.map(([x, y], i) => [initialShape[i][0] + (x - initialShape[i][0]) * blend, initialShape[i][1] + (y - initialShape[i][1]) * blend]) : shape;
|
|
2481
|
+
});
|
|
2482
|
+
const points = shapes.flat(), origin = { x: Math.min(...points.map((p) => p[0])), y: Math.min(...points.map((p) => p[1])) };
|
|
2483
|
+
indicator.style.width = `${Math.max(...points.map((p) => p[0])) - origin.x}px`;
|
|
2484
|
+
indicator.style.height = `${Math.max(...points.map((p) => p[1])) - origin.y}px`;
|
|
2485
|
+
indicator.style.transform = `translate(${origin.x}px,${origin.y}px)`;
|
|
2486
|
+
indicator.style.borderRadius = "0";
|
|
2487
|
+
root.dataset.siaRadioMoving = "";
|
|
2488
|
+
const running = indicator.animate(shapes.map((shape, index) => ({ clipPath: radioFluidPath(shape, origin), offset: index / 32 })), { duration: 280, easing: "linear", fill: "both" });
|
|
2489
|
+
animation.current = running;
|
|
2490
|
+
flowing.current = { animation: running, shapes };
|
|
2491
|
+
running.finished.then(() => {
|
|
2492
|
+
if (animation.current !== running) return;
|
|
2493
|
+
indicator.style.width = `${next.width}px`;
|
|
2494
|
+
indicator.style.height = `${next.height}px`;
|
|
2495
|
+
indicator.style.transform = transform(next);
|
|
2496
|
+
indicator.style.borderRadius = getComputedStyle(target).borderRadius;
|
|
2497
|
+
running.cancel();
|
|
2498
|
+
animation.current = void 0;
|
|
2499
|
+
flowing.current = void 0;
|
|
2500
|
+
delete root.dataset.siaRadioMoving;
|
|
2501
|
+
}, () => {
|
|
2502
|
+
});
|
|
2503
|
+
};
|
|
2504
|
+
const schedule = () => {
|
|
2505
|
+
if (!frame) frame = requestAnimationFrame(() => {
|
|
2506
|
+
frame = 0;
|
|
2507
|
+
update();
|
|
2508
|
+
});
|
|
2509
|
+
};
|
|
2510
|
+
const reduce = () => {
|
|
2511
|
+
animation.current?.cancel();
|
|
2512
|
+
flowing.current = void 0;
|
|
2513
|
+
previous.current = void 0;
|
|
2514
|
+
delete root.dataset.siaRadioMoving;
|
|
2515
|
+
update();
|
|
2516
|
+
};
|
|
2517
|
+
update();
|
|
2518
|
+
const observer = new ResizeObserver(schedule);
|
|
2519
|
+
observer.observe(root);
|
|
2520
|
+
root.querySelectorAll(":scope > .sia-radio").forEach((label) => observer.observe(label));
|
|
2521
|
+
media.addEventListener("change", reduce);
|
|
2522
|
+
return () => {
|
|
2523
|
+
observer.disconnect();
|
|
2524
|
+
cancelAnimationFrame(frame);
|
|
2525
|
+
media.removeEventListener("change", reduce);
|
|
2526
|
+
};
|
|
2527
|
+
});
|
|
2528
|
+
useLayoutEffect4(() => {
|
|
2529
|
+
const root = rootRef.current ?? indicatorRef.current?.parentElement;
|
|
2530
|
+
return () => {
|
|
2531
|
+
animation.current?.cancel();
|
|
2532
|
+
if (root) {
|
|
2533
|
+
delete root.dataset.siaRadioMotion;
|
|
2534
|
+
delete root.dataset.siaRadioMoving;
|
|
2535
|
+
}
|
|
2536
|
+
};
|
|
2537
|
+
}, [rootRef]);
|
|
2538
|
+
return /* @__PURE__ */ jsx13("span", { ref: indicatorRef, className: "sia-radio-group__selection", "aria-hidden": "true" });
|
|
2539
|
+
}
|
|
2540
|
+
|
|
2247
2541
|
// src/components/Radio.tsx
|
|
2248
|
-
import { createContext as createContext3, forwardRef as
|
|
2249
|
-
import { jsx as
|
|
2542
|
+
import { createContext as createContext3, forwardRef as forwardRef4, useContext as useContext3, useId as useId4, useMemo as useMemo5, useRef as useRef11 } from "react";
|
|
2543
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2250
2544
|
var RadioContext = createContext3(null);
|
|
2251
|
-
var RadioRoot =
|
|
2545
|
+
var RadioRoot = forwardRef4(function Radio({ value, size: sizeProp, children, disabled, checked, defaultChecked, button = false, className = "", onChange, ...props }, ref) {
|
|
2252
2546
|
const size = useControlSize(sizeProp);
|
|
2253
2547
|
const group = useContext3(RadioContext);
|
|
2254
2548
|
const fallbackId = useId4();
|
|
2255
2549
|
const grouped = group !== null;
|
|
2256
2550
|
const currentChecked = grouped ? group.value === value : checked;
|
|
2257
|
-
|
|
2258
|
-
|
|
2551
|
+
const labelRef = useRef11(null);
|
|
2552
|
+
const controlRef = useRef11(null);
|
|
2553
|
+
const press = usePressFeedback();
|
|
2554
|
+
return /* @__PURE__ */ jsxs13("label", { ref: labelRef, className: `sia-radio sia-radio--${size}${button ? " sia-radio--button" : ""}${button && group?.buttonStyle === "solid" ? " sia-radio--solid" : ""}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
2555
|
+
/* @__PURE__ */ jsx14(
|
|
2259
2556
|
"input",
|
|
2260
2557
|
{
|
|
2261
2558
|
...withTitleTooltip(props),
|
|
@@ -2268,18 +2565,22 @@ var RadioRoot = forwardRef3(function Radio({ value, size: sizeProp, children, di
|
|
|
2268
2565
|
disabled: disabled || group?.disabled,
|
|
2269
2566
|
checked: currentChecked,
|
|
2270
2567
|
defaultChecked: grouped ? void 0 : defaultChecked,
|
|
2568
|
+
onClick: (event) => {
|
|
2569
|
+
props.onClick?.(event);
|
|
2570
|
+
if (!event.defaultPrevented && !event.currentTarget.disabled && !(button && group?.buttonStyle === "solid")) press(button ? labelRef.current : controlRef.current, !button);
|
|
2571
|
+
},
|
|
2271
2572
|
onChange: (event) => {
|
|
2272
2573
|
if (event.currentTarget.checked) group?.setValue(value);
|
|
2273
2574
|
onChange?.(event.currentTarget.checked, event);
|
|
2274
2575
|
}
|
|
2275
2576
|
}
|
|
2276
2577
|
),
|
|
2277
|
-
button ? null : /* @__PURE__ */
|
|
2278
|
-
children !== void 0 ? /* @__PURE__ */
|
|
2578
|
+
button ? null : /* @__PURE__ */ jsx14("span", { ref: controlRef, className: "sia-radio__control", "aria-hidden": "true", children: /* @__PURE__ */ jsx14("span", {}) }),
|
|
2579
|
+
children !== void 0 ? /* @__PURE__ */ jsx14("span", { className: "sia-radio__label", children }) : null
|
|
2279
2580
|
] });
|
|
2280
2581
|
});
|
|
2281
2582
|
function RadioButton(props) {
|
|
2282
|
-
return /* @__PURE__ */
|
|
2583
|
+
return /* @__PURE__ */ jsx14(RadioRoot, { ...props, button: true });
|
|
2283
2584
|
}
|
|
2284
2585
|
function RadioGroup({
|
|
2285
2586
|
size: sizeProp,
|
|
@@ -2296,6 +2597,7 @@ function RadioGroup({
|
|
|
2296
2597
|
}) {
|
|
2297
2598
|
const size = useControlSize(sizeProp);
|
|
2298
2599
|
const fallbackName = useId4();
|
|
2600
|
+
const rootRef = useRef11(null);
|
|
2299
2601
|
const [currentValue, setValue2] = useControllableState({
|
|
2300
2602
|
value,
|
|
2301
2603
|
defaultValue,
|
|
@@ -2311,24 +2613,25 @@ function RadioGroup({
|
|
|
2311
2613
|
setValue: setValue2
|
|
2312
2614
|
}), [buttonStyle, currentValue, disabled, fallbackName, name, setValue2]);
|
|
2313
2615
|
const Component = optionType === "button" ? RadioButton : RadioRoot;
|
|
2314
|
-
return /* @__PURE__ */
|
|
2616
|
+
return /* @__PURE__ */ jsx14(ControlSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx14(RadioContext.Provider, { value: context, children: /* @__PURE__ */ jsxs13("div", { ref: rootRef, className: `sia-radio-group${optionType === "button" ? " sia-radio-group--button" : ""} ${className}`.trim(), role: "radiogroup", children: [
|
|
2315
2617
|
options?.map((option) => {
|
|
2316
2618
|
const normalized = typeof option === "object" ? option : { label: String(option), value: option };
|
|
2317
|
-
return /* @__PURE__ */
|
|
2619
|
+
return /* @__PURE__ */ jsx14(Component, { value: normalized.value, disabled: normalized.disabled, children: normalized.label }, normalized.value);
|
|
2318
2620
|
}),
|
|
2319
|
-
children
|
|
2621
|
+
children,
|
|
2622
|
+
buttonStyle === "solid" && /* @__PURE__ */ jsx14(RadioSelectionMotion, { rootRef })
|
|
2320
2623
|
] }) }) });
|
|
2321
2624
|
}
|
|
2322
2625
|
var Radio2 = Object.assign(RadioRoot, {
|
|
2323
|
-
/**
|
|
2626
|
+
/** 按钮形态单选项;放在 Radio.Group 内共享值与 buttonStyle,实心样式切换时由分组背景完成 280ms 液体沙漏形变。 */
|
|
2324
2627
|
Button: RadioButton,
|
|
2325
2628
|
/** 组合多个子项并统一管理布局或选择状态。 */
|
|
2326
2629
|
Group: RadioGroup
|
|
2327
2630
|
});
|
|
2328
2631
|
|
|
2329
2632
|
// src/components/Slider.tsx
|
|
2330
|
-
import { useState as
|
|
2331
|
-
import { jsx as
|
|
2633
|
+
import { useState as useState11 } from "react";
|
|
2634
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2332
2635
|
function percent(value, min, max) {
|
|
2333
2636
|
return (value - min) / (max - min) * 100;
|
|
2334
2637
|
}
|
|
@@ -2351,7 +2654,7 @@ function Slider({
|
|
|
2351
2654
|
}) {
|
|
2352
2655
|
const fallback = defaultValue ?? (range ? [min, max] : min);
|
|
2353
2656
|
const [currentValue, setValue2] = useControllableState({ value, defaultValue: fallback, onChange });
|
|
2354
|
-
const [activeThumb, setActiveThumb] =
|
|
2657
|
+
const [activeThumb, setActiveThumb] = useState11(null);
|
|
2355
2658
|
const values = Array.isArray(currentValue) ? [...currentValue] : [currentValue];
|
|
2356
2659
|
const start = range ? percent(Math.min(values[0], values[1]), min, max) : 0;
|
|
2357
2660
|
const end = percent(range ? Math.max(values[0], values[1]) : values[0], min, max);
|
|
@@ -2373,16 +2676,16 @@ function Slider({
|
|
|
2373
2676
|
onChangeComplete?.(currentValue);
|
|
2374
2677
|
setActiveThumb(null);
|
|
2375
2678
|
}
|
|
2376
|
-
return /* @__PURE__ */
|
|
2679
|
+
return /* @__PURE__ */ jsxs14(
|
|
2377
2680
|
"div",
|
|
2378
2681
|
{
|
|
2379
2682
|
className: `sia-slider${range ? " sia-slider--range" : ""}${vertical ? " sia-slider--vertical" : ""}${reverse ? " sia-slider--reverse" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
2380
2683
|
style,
|
|
2381
2684
|
...withTitleTooltip(props),
|
|
2382
2685
|
children: [
|
|
2383
|
-
/* @__PURE__ */
|
|
2384
|
-
values.map((item, index) => /* @__PURE__ */
|
|
2385
|
-
/* @__PURE__ */
|
|
2686
|
+
/* @__PURE__ */ jsx15("div", { className: "sia-slider__rail", children: /* @__PURE__ */ jsx15("span", { className: "sia-slider__track" }) }),
|
|
2687
|
+
values.map((item, index) => /* @__PURE__ */ jsxs14("div", { className: "sia-slider__thumb-wrap", children: [
|
|
2688
|
+
/* @__PURE__ */ jsx15(
|
|
2386
2689
|
"input",
|
|
2387
2690
|
{
|
|
2388
2691
|
className: "sia-slider__input",
|
|
@@ -2404,12 +2707,12 @@ function Slider({
|
|
|
2404
2707
|
}
|
|
2405
2708
|
}
|
|
2406
2709
|
),
|
|
2407
|
-
tooltip?.open || activeThumb === index ? /* @__PURE__ */
|
|
2710
|
+
tooltip?.open || activeThumb === index ? /* @__PURE__ */ jsx15(
|
|
2408
2711
|
"span",
|
|
2409
2712
|
{
|
|
2410
2713
|
className: "sia-slider__tooltip-anchor",
|
|
2411
2714
|
style: { "--sia-slider-value": `${percent(item, min, max)}%` },
|
|
2412
|
-
children: /* @__PURE__ */
|
|
2715
|
+
children: /* @__PURE__ */ jsx15(
|
|
2413
2716
|
Tooltip,
|
|
2414
2717
|
{
|
|
2415
2718
|
title: tooltip?.formatter ? tooltip.formatter(item) : item,
|
|
@@ -2417,16 +2720,16 @@ function Slider({
|
|
|
2417
2720
|
trigger: [],
|
|
2418
2721
|
open: true,
|
|
2419
2722
|
overlayClassName: "sia-slider__tooltip",
|
|
2420
|
-
children: /* @__PURE__ */
|
|
2723
|
+
children: /* @__PURE__ */ jsx15("span", { className: "sia-slider__tooltip-target" })
|
|
2421
2724
|
}
|
|
2422
2725
|
)
|
|
2423
2726
|
}
|
|
2424
2727
|
) : null
|
|
2425
2728
|
] }, index)),
|
|
2426
|
-
marks ? /* @__PURE__ */
|
|
2729
|
+
marks ? /* @__PURE__ */ jsx15("div", { className: "sia-slider__marks", children: Object.entries(marks).map(([rawValue, mark]) => {
|
|
2427
2730
|
const numericValue = Number(rawValue);
|
|
2428
2731
|
const normalized = typeof mark === "object" && mark !== null && "label" in mark ? mark : { label: mark };
|
|
2429
|
-
return /* @__PURE__ */
|
|
2732
|
+
return /* @__PURE__ */ jsxs14(
|
|
2430
2733
|
"button",
|
|
2431
2734
|
{
|
|
2432
2735
|
type: "button",
|
|
@@ -2435,7 +2738,7 @@ function Slider({
|
|
|
2435
2738
|
disabled,
|
|
2436
2739
|
onClick: () => setValue2(range ? [values[0], numericValue].sort((a, b) => a - b) : numericValue),
|
|
2437
2740
|
children: [
|
|
2438
|
-
/* @__PURE__ */
|
|
2741
|
+
/* @__PURE__ */ jsx15("span", {}),
|
|
2439
2742
|
normalized.label
|
|
2440
2743
|
]
|
|
2441
2744
|
},
|
|
@@ -2448,8 +2751,8 @@ function Slider({
|
|
|
2448
2751
|
}
|
|
2449
2752
|
|
|
2450
2753
|
// src/components/ColorPicker.tsx
|
|
2451
|
-
import { useEffect as useEffect7, useRef as
|
|
2452
|
-
import { jsx as
|
|
2754
|
+
import { useEffect as useEffect7, useRef as useRef12, useState as useState12 } from "react";
|
|
2755
|
+
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2453
2756
|
var DEFAULT_MODES = ["solid", "gradient"];
|
|
2454
2757
|
var gradientStopSeed = 0;
|
|
2455
2758
|
function clamp3(value, min, max) {
|
|
@@ -2539,12 +2842,12 @@ function ColorPicker({
|
|
|
2539
2842
|
...props
|
|
2540
2843
|
}) {
|
|
2541
2844
|
const size = useControlSize(sizeProp);
|
|
2542
|
-
const rootRef =
|
|
2543
|
-
const popupRef =
|
|
2544
|
-
const lastEmittedValue =
|
|
2845
|
+
const rootRef = useRef12(null);
|
|
2846
|
+
const popupRef = useRef12(null);
|
|
2847
|
+
const lastEmittedValue = useRef12();
|
|
2545
2848
|
const initialGradient = parseGradient(value ?? defaultValue);
|
|
2546
2849
|
const initialSolid = initialGradient?.stops[0]?.color ?? normalizeHex(value || defaultValue);
|
|
2547
|
-
const [open, setOpen] =
|
|
2850
|
+
const [open, setOpen] = useState12(false);
|
|
2548
2851
|
const [color, setColor] = useControllableState({
|
|
2549
2852
|
value,
|
|
2550
2853
|
defaultValue: initialGradient ? formatGradient(initialGradient.angle, initialGradient.stops.map((stop, index) => ({ id: index, ...stop }))) : normalizeHex(defaultValue),
|
|
@@ -2555,15 +2858,15 @@ function ColorPicker({
|
|
|
2555
2858
|
defaultValue: initialGradient ? "gradient" : defaultMode,
|
|
2556
2859
|
onChange: onModeChange
|
|
2557
2860
|
});
|
|
2558
|
-
const [solidColor, setSolidColor] =
|
|
2559
|
-
const [gradientAngle, setGradientAngle] =
|
|
2560
|
-
const [gradientStops, setGradientStops] =
|
|
2561
|
-
const [activeStopId, setActiveStopId] =
|
|
2861
|
+
const [solidColor, setSolidColor] = useState12(initialSolid);
|
|
2862
|
+
const [gradientAngle, setGradientAngle] = useState12(initialGradient?.angle ?? 90);
|
|
2863
|
+
const [gradientStops, setGradientStops] = useState12(() => initialGradient ? initialGradient.stops.map((stop) => createStop(stop.color, stop.position)) : createDefaultStops(initialSolid));
|
|
2864
|
+
const [activeStopId, setActiveStopId] = useState12(() => gradientStops[0]?.id ?? 0);
|
|
2562
2865
|
const activeStop = gradientStops.find((stop) => stop.id === activeStopId) ?? gradientStops[0];
|
|
2563
2866
|
const editingColor = currentMode === "gradient" ? activeStop?.color ?? solidColor : solidColor;
|
|
2564
2867
|
const rgba = parseHex(editingColor) ?? parseHex("#1677FF");
|
|
2565
2868
|
const hsv = rgbToHsv(rgba);
|
|
2566
|
-
const [hexDraft, setHexDraft] =
|
|
2869
|
+
const [hexDraft, setHexDraft] = useState12(editingColor);
|
|
2567
2870
|
const gradientValue = formatGradient(gradientAngle, gradientStops);
|
|
2568
2871
|
useEffect7(() => {
|
|
2569
2872
|
if (!open) return void 0;
|
|
@@ -2639,8 +2942,8 @@ function ColorPicker({
|
|
|
2639
2942
|
const triggerBackground = color || "transparent";
|
|
2640
2943
|
const triggerText = color || "\u65E0\u8272";
|
|
2641
2944
|
const opaqueColor = rgbaToHex({ ...rgba, a: 100 }, false);
|
|
2642
|
-
return /* @__PURE__ */
|
|
2643
|
-
/* @__PURE__ */
|
|
2945
|
+
return /* @__PURE__ */ jsxs15("div", { ref: rootRef, className: `sia-color-picker sia-color-picker--${size}${disabled ? " is-disabled" : ""} ${className}`.trim(), ...withTitleTooltip(props), children: [
|
|
2946
|
+
/* @__PURE__ */ jsxs15(
|
|
2644
2947
|
"button",
|
|
2645
2948
|
{
|
|
2646
2949
|
type: "button",
|
|
@@ -2650,19 +2953,19 @@ function ColorPicker({
|
|
|
2650
2953
|
"aria-expanded": open,
|
|
2651
2954
|
onClick: () => setOpen((current) => !current),
|
|
2652
2955
|
children: [
|
|
2653
|
-
/* @__PURE__ */
|
|
2654
|
-
showText ? /* @__PURE__ */
|
|
2655
|
-
/* @__PURE__ */
|
|
2956
|
+
/* @__PURE__ */ jsx16("span", { className: `sia-color-picker__swatch${color ? "" : " is-empty"}`, style: color ? { background: triggerBackground } : void 0 }),
|
|
2957
|
+
showText ? /* @__PURE__ */ jsx16("span", { className: "sia-color-picker__trigger-text", children: typeof showText === "function" ? showText(color) : triggerText }) : null,
|
|
2958
|
+
/* @__PURE__ */ jsx16(Icon, { name: "chevron-down", size: 14 })
|
|
2656
2959
|
]
|
|
2657
2960
|
}
|
|
2658
2961
|
),
|
|
2659
|
-
/* @__PURE__ */
|
|
2660
|
-
/* @__PURE__ */
|
|
2661
|
-
modes.length > 1 ? /* @__PURE__ */
|
|
2662
|
-
allowClear ? /* @__PURE__ */
|
|
2962
|
+
/* @__PURE__ */ jsxs15(PopupPortal, { ref: popupRef, anchorRef: rootRef, open, className: "sia-color-picker__popup", role: "dialog", "aria-label": "\u989C\u8272\u9009\u62E9\u5668", children: [
|
|
2963
|
+
/* @__PURE__ */ jsxs15("div", { className: "sia-color-picker__mode-row", children: [
|
|
2964
|
+
modes.length > 1 ? /* @__PURE__ */ jsx16("div", { className: "sia-color-picker__modes", role: "tablist", "aria-label": "\u989C\u8272\u6A21\u5F0F", children: modes.map((item) => /* @__PURE__ */ jsx16("button", { type: "button", role: "tab", "aria-selected": currentMode === item, className: currentMode === item ? "is-active" : "", onClick: () => switchMode(item), children: item === "solid" ? "\u5355\u8272" : "\u6E10\u53D8\u8272" }, item)) }) : /* @__PURE__ */ jsx16("strong", { children: currentMode === "solid" ? "\u5355\u8272" : "\u6E10\u53D8\u8272" }),
|
|
2965
|
+
allowClear ? /* @__PURE__ */ jsx16("button", { type: "button", className: `sia-color-picker__none${color ? "" : " is-active"}`, "aria-label": "\u9009\u62E9\u65E0\u8272", ...withTitleTooltip({ title: "\u65E0\u8272" }), onClick: selectNoColor, children: /* @__PURE__ */ jsx16("span", {}) }) : null
|
|
2663
2966
|
] }),
|
|
2664
|
-
currentMode === "gradient" ? /* @__PURE__ */
|
|
2665
|
-
/* @__PURE__ */
|
|
2967
|
+
currentMode === "gradient" ? /* @__PURE__ */ jsxs15("div", { className: "sia-color-picker__gradient-editor", children: [
|
|
2968
|
+
/* @__PURE__ */ jsx16("div", { className: "sia-color-picker__gradient-preview", style: { background: gradientValue }, onPointerDown: addGradientStop, children: gradientStops.map((stop) => /* @__PURE__ */ jsx16(
|
|
2666
2969
|
"button",
|
|
2667
2970
|
{
|
|
2668
2971
|
type: "button",
|
|
@@ -2674,40 +2977,40 @@ function ColorPicker({
|
|
|
2674
2977
|
},
|
|
2675
2978
|
stop.id
|
|
2676
2979
|
)) }),
|
|
2677
|
-
/* @__PURE__ */
|
|
2678
|
-
/* @__PURE__ */
|
|
2980
|
+
/* @__PURE__ */ jsxs15("div", { className: "sia-color-picker__gradient-controls", children: [
|
|
2981
|
+
/* @__PURE__ */ jsxs15("label", { children: [
|
|
2679
2982
|
"\u65B9\u5411 ",
|
|
2680
|
-
/* @__PURE__ */
|
|
2983
|
+
/* @__PURE__ */ jsx16("input", { type: "number", min: 0, max: 360, value: Math.round(gradientAngle), onChange: (event) => {
|
|
2681
2984
|
const nextAngle = clamp3(Number(event.currentTarget.value), 0, 360);
|
|
2682
2985
|
setGradientAngle(nextAngle);
|
|
2683
2986
|
emit(formatGradient(nextAngle, gradientStops));
|
|
2684
2987
|
}, onBlur: () => onChangeComplete?.(formatGradient(gradientAngle, gradientStops)) }),
|
|
2685
|
-
/* @__PURE__ */
|
|
2988
|
+
/* @__PURE__ */ jsx16("span", { children: "\xB0" })
|
|
2686
2989
|
] }),
|
|
2687
|
-
/* @__PURE__ */
|
|
2990
|
+
/* @__PURE__ */ jsxs15("label", { children: [
|
|
2688
2991
|
"\u4F4D\u7F6E ",
|
|
2689
|
-
/* @__PURE__ */
|
|
2992
|
+
/* @__PURE__ */ jsx16("input", { type: "range", min: 0, max: 100, value: activeStop?.position ?? 0, onChange: (event) => {
|
|
2690
2993
|
if (!activeStop) return;
|
|
2691
2994
|
emitGradient(gradientStops.map((stop) => stop.id === activeStop.id ? { ...stop, position: Number(event.currentTarget.value) } : stop));
|
|
2692
2995
|
}, onPointerUp: () => onChangeComplete?.(formatGradient(gradientAngle, gradientStops)) }),
|
|
2693
|
-
/* @__PURE__ */
|
|
2996
|
+
/* @__PURE__ */ jsxs15("span", { children: [
|
|
2694
2997
|
Math.round(activeStop?.position ?? 0),
|
|
2695
2998
|
"%"
|
|
2696
2999
|
] })
|
|
2697
3000
|
] }),
|
|
2698
|
-
/* @__PURE__ */
|
|
3001
|
+
/* @__PURE__ */ jsxs15("button", { type: "button", disabled: gradientStops.length <= 2, onClick: () => {
|
|
2699
3002
|
if (!activeStop || gradientStops.length <= 2) return;
|
|
2700
3003
|
const index = gradientStops.findIndex((stop) => stop.id === activeStop.id);
|
|
2701
3004
|
const nextStops = gradientStops.filter((stop) => stop.id !== activeStop.id);
|
|
2702
3005
|
setActiveStopId(nextStops[Math.max(0, index - 1)]?.id ?? nextStops[0]?.id ?? 0);
|
|
2703
3006
|
emitGradient(nextStops, gradientAngle, true);
|
|
2704
3007
|
}, children: [
|
|
2705
|
-
/* @__PURE__ */
|
|
3008
|
+
/* @__PURE__ */ jsx16(Icon, { name: "minus", size: 14 }),
|
|
2706
3009
|
" \u5220\u9664\u8272\u6807"
|
|
2707
3010
|
] })
|
|
2708
3011
|
] })
|
|
2709
3012
|
] }) : null,
|
|
2710
|
-
/* @__PURE__ */
|
|
3013
|
+
/* @__PURE__ */ jsx16(
|
|
2711
3014
|
"div",
|
|
2712
3015
|
{
|
|
2713
3016
|
className: "sia-color-picker__saturation",
|
|
@@ -2723,28 +3026,28 @@ function ColorPicker({
|
|
|
2723
3026
|
updateSaturation(event, true);
|
|
2724
3027
|
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
2725
3028
|
},
|
|
2726
|
-
children: /* @__PURE__ */
|
|
3029
|
+
children: /* @__PURE__ */ jsx16("span", { style: { left: `${hsv.s}%`, top: `${100 - hsv.v}%` } })
|
|
2727
3030
|
}
|
|
2728
3031
|
),
|
|
2729
|
-
/* @__PURE__ */
|
|
2730
|
-
/* @__PURE__ */
|
|
2731
|
-
/* @__PURE__ */
|
|
3032
|
+
/* @__PURE__ */ jsxs15("label", { className: "sia-color-picker__hue", children: [
|
|
3033
|
+
/* @__PURE__ */ jsx16("span", { className: "sia-color-picker__field-label", children: "\u8272\u76F8" }),
|
|
3034
|
+
/* @__PURE__ */ jsx16("input", { type: "range", min: 0, max: 360, value: Math.round(hsv.h), onChange: (event) => {
|
|
2732
3035
|
updateEditingColor(rgbaToHex(hsvToRgba(Number(event.currentTarget.value), hsv.s, hsv.v, rgba.a), showAlpha));
|
|
2733
3036
|
}, onPointerUp: () => onChangeComplete?.(currentMode === "gradient" ? gradientValue : solidColor) })
|
|
2734
3037
|
] }),
|
|
2735
|
-
showAlpha ? /* @__PURE__ */
|
|
2736
|
-
/* @__PURE__ */
|
|
2737
|
-
/* @__PURE__ */
|
|
3038
|
+
showAlpha ? /* @__PURE__ */ jsxs15("label", { className: "sia-color-picker__alpha", style: { "--sia-alpha-color": opaqueColor }, children: [
|
|
3039
|
+
/* @__PURE__ */ jsx16("span", { className: "sia-color-picker__field-label", children: "\u900F\u660E\u5EA6" }),
|
|
3040
|
+
/* @__PURE__ */ jsx16("input", { type: "range", min: 0, max: 100, value: rgba.a, onChange: (event) => {
|
|
2738
3041
|
updateEditingColor(rgbaToHex({ ...rgba, a: Number(event.currentTarget.value) }, true));
|
|
2739
3042
|
}, onPointerUp: () => onChangeComplete?.(currentMode === "gradient" ? gradientValue : solidColor) }),
|
|
2740
|
-
/* @__PURE__ */
|
|
3043
|
+
/* @__PURE__ */ jsxs15("span", { children: [
|
|
2741
3044
|
rgba.a,
|
|
2742
3045
|
"%"
|
|
2743
3046
|
] })
|
|
2744
3047
|
] }) : null,
|
|
2745
|
-
/* @__PURE__ */
|
|
2746
|
-
/* @__PURE__ */
|
|
2747
|
-
/* @__PURE__ */
|
|
3048
|
+
/* @__PURE__ */ jsxs15("div", { className: "sia-color-picker__value-row", children: [
|
|
3049
|
+
/* @__PURE__ */ jsx16("span", { children: "HEX" }),
|
|
3050
|
+
/* @__PURE__ */ jsx16("input", { "aria-label": "HEX", value: hexDraft, onChange: (event) => {
|
|
2748
3051
|
const next = event.currentTarget.value;
|
|
2749
3052
|
setHexDraft(next);
|
|
2750
3053
|
if (/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(next)) updateEditingColor(next);
|
|
@@ -2753,19 +3056,19 @@ function ColorPicker({
|
|
|
2753
3056
|
setHexDraft(normalized);
|
|
2754
3057
|
updateEditingColor(normalized, true);
|
|
2755
3058
|
} }),
|
|
2756
|
-
/* @__PURE__ */
|
|
3059
|
+
/* @__PURE__ */ jsx16("span", { className: `sia-color-picker__value-swatch${color ? "" : " is-empty"}`, style: color ? { background: editingColor } : void 0 })
|
|
2757
3060
|
] }),
|
|
2758
|
-
presets?.map((preset, index) => /* @__PURE__ */
|
|
2759
|
-
preset.label ? /* @__PURE__ */
|
|
2760
|
-
/* @__PURE__ */
|
|
3061
|
+
presets?.map((preset, index) => /* @__PURE__ */ jsxs15("div", { className: "sia-color-picker__preset", children: [
|
|
3062
|
+
preset.label ? /* @__PURE__ */ jsx16("strong", { children: preset.label }) : null,
|
|
3063
|
+
/* @__PURE__ */ jsx16("div", { children: preset.colors.map((presetColor) => /* @__PURE__ */ jsx16("button", { type: "button", "aria-label": `\u9009\u62E9\u989C\u8272 ${presetColor}`, style: { background: presetColor }, onClick: () => updateEditingColor(presetColor, true) }, presetColor)) })
|
|
2761
3064
|
] }, index))
|
|
2762
3065
|
] })
|
|
2763
3066
|
] });
|
|
2764
3067
|
}
|
|
2765
3068
|
|
|
2766
3069
|
// src/components/TimePicker.tsx
|
|
2767
|
-
import { useEffect as useEffect8, useId as useId5, useRef as
|
|
2768
|
-
import { jsx as
|
|
3070
|
+
import { useEffect as useEffect8, useId as useId5, useRef as useRef13, useState as useState13 } from "react";
|
|
3071
|
+
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2769
3072
|
function seconds(value) {
|
|
2770
3073
|
const [h = 0, m = 0, s = 0] = value.split(":").map(Number);
|
|
2771
3074
|
return h * 3600 + m * 60 + s;
|
|
@@ -2795,13 +3098,13 @@ function TimePicker({
|
|
|
2795
3098
|
}) {
|
|
2796
3099
|
const size = useControlSize(sizeProp);
|
|
2797
3100
|
const id = useId5();
|
|
2798
|
-
const rootRef =
|
|
2799
|
-
const inputRef =
|
|
2800
|
-
const popupRef =
|
|
2801
|
-
const focusPanel =
|
|
3101
|
+
const rootRef = useRef13(null);
|
|
3102
|
+
const inputRef = useRef13(null);
|
|
3103
|
+
const popupRef = useRef13(null);
|
|
3104
|
+
const focusPanel = useRef13(false);
|
|
2802
3105
|
const [currentValue, setValue2] = useControllableState({ value, defaultValue, onChange });
|
|
2803
|
-
const [open, setOpen] =
|
|
2804
|
-
const [draft, setDraft] =
|
|
3106
|
+
const [open, setOpen] = useState13(false);
|
|
3107
|
+
const [draft, setDraft] = useState13("00:00:00");
|
|
2805
3108
|
const normalize = (time) => showSecond ? (time + ":00").slice(0, 8) : time.slice(0, 5);
|
|
2806
3109
|
const unavailable = (time) => {
|
|
2807
3110
|
const normalized = normalize(time);
|
|
@@ -2844,8 +3147,8 @@ function TimePicker({
|
|
|
2844
3147
|
inputRef.current?.focus();
|
|
2845
3148
|
}
|
|
2846
3149
|
const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: Boolean(display), active: open });
|
|
2847
|
-
return /* @__PURE__ */
|
|
2848
|
-
/* @__PURE__ */
|
|
3150
|
+
return /* @__PURE__ */ jsxs16("span", { ref: rootRef, style, className: `sia-picker sia-time-picker${floating.className} sia-picker--${size} sia-picker--${status}${disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
3151
|
+
/* @__PURE__ */ jsx17(
|
|
2849
3152
|
"input",
|
|
2850
3153
|
{
|
|
2851
3154
|
...withTitleTooltip(props),
|
|
@@ -2882,12 +3185,12 @@ function TimePicker({
|
|
|
2882
3185
|
}
|
|
2883
3186
|
),
|
|
2884
3187
|
floating.label,
|
|
2885
|
-
allowClear && currentValue && !disabled && !readOnly ? /* @__PURE__ */
|
|
3188
|
+
allowClear && currentValue && !disabled && !readOnly ? /* @__PURE__ */ jsx17("button", { type: "button", className: "sia-picker__clear", "aria-label": "\u6E05\u9664\u65F6\u95F4", onMouseDown: (event) => event.preventDefault(), onClick: () => {
|
|
2886
3189
|
setValue2("");
|
|
2887
3190
|
changeOpen(false);
|
|
2888
|
-
}, children: /* @__PURE__ */
|
|
2889
|
-
/* @__PURE__ */
|
|
2890
|
-
/* @__PURE__ */
|
|
3191
|
+
}, children: /* @__PURE__ */ jsx17(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
|
|
3192
|
+
/* @__PURE__ */ jsx17("span", { className: "sia-picker__icon", "aria-hidden": "true", children: suffixIcon ?? /* @__PURE__ */ jsx17(Icon, { name: "clock", size: 16 }) }),
|
|
3193
|
+
/* @__PURE__ */ jsxs16(
|
|
2891
3194
|
PopupPortal,
|
|
2892
3195
|
{
|
|
2893
3196
|
ref: popupRef,
|
|
@@ -2905,14 +3208,14 @@ function TimePicker({
|
|
|
2905
3208
|
}
|
|
2906
3209
|
},
|
|
2907
3210
|
children: [
|
|
2908
|
-
/* @__PURE__ */
|
|
2909
|
-
unavailable(draft) ? /* @__PURE__ */
|
|
2910
|
-
/* @__PURE__ */
|
|
2911
|
-
/* @__PURE__ */
|
|
3211
|
+
/* @__PURE__ */ jsx17(TimePanel, { value: draft, showSecond, use12Hours, onChange: setDraft }),
|
|
3212
|
+
unavailable(draft) ? /* @__PURE__ */ jsx17("div", { className: "sia-time-panel__error", role: "status", children: "\u8BE5\u65F6\u95F4\u4E0D\u53EF\u9009" }) : null,
|
|
3213
|
+
/* @__PURE__ */ jsxs16("footer", { className: "sia-time-panel__footer", children: [
|
|
3214
|
+
/* @__PURE__ */ jsx17(Button, { variant: "text", size: "small", onClick: () => {
|
|
2912
3215
|
const now = /* @__PURE__ */ new Date();
|
|
2913
3216
|
setDraft([now.getHours(), now.getMinutes(), showSecond ? now.getSeconds() : 0].map((part) => String(part).padStart(2, "0")).join(":"));
|
|
2914
3217
|
}, children: "\u6B64\u523B" }),
|
|
2915
|
-
/* @__PURE__ */
|
|
3218
|
+
/* @__PURE__ */ jsx17(Button, { variant: "primary", size: "small", disabled: unavailable(draft), onClick: confirm, children: "\u786E\u5B9A" })
|
|
2916
3219
|
] })
|
|
2917
3220
|
]
|
|
2918
3221
|
}
|
|
@@ -2927,10 +3230,10 @@ function TimeRangePicker({ value, defaultValue = ["", ""], placeholder = ["\u5F0
|
|
|
2927
3230
|
pair[index] = next;
|
|
2928
3231
|
setValue2(pair);
|
|
2929
3232
|
}
|
|
2930
|
-
return /* @__PURE__ */
|
|
2931
|
-
/* @__PURE__ */
|
|
2932
|
-
/* @__PURE__ */
|
|
2933
|
-
/* @__PURE__ */
|
|
3233
|
+
return /* @__PURE__ */ jsxs16("span", { style, className: `sia-time-range sia-picker--${size} sia-picker--${props.status ?? "default"}${props.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
3234
|
+
/* @__PURE__ */ jsx17(TimePicker, { ...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) }),
|
|
3235
|
+
/* @__PURE__ */ jsx17("span", { className: "sia-time-range__separator", children: separator }),
|
|
3236
|
+
/* @__PURE__ */ jsx17(TimePicker, { ...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) })
|
|
2934
3237
|
] });
|
|
2935
3238
|
}
|
|
2936
3239
|
((TimePicker2) => {
|
|
@@ -2938,8 +3241,8 @@ function TimeRangePicker({ value, defaultValue = ["", ""], placeholder = ["\u5F0
|
|
|
2938
3241
|
})(TimePicker || (TimePicker = {}));
|
|
2939
3242
|
|
|
2940
3243
|
// src/components/TreeSelect.tsx
|
|
2941
|
-
import { useEffect as useEffect9, useMemo as useMemo6, useRef as
|
|
2942
|
-
import { Fragment as Fragment5, jsx as
|
|
3244
|
+
import { useEffect as useEffect9, useMemo as useMemo6, useRef as useRef14, useState as useState14 } from "react";
|
|
3245
|
+
import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2943
3246
|
function flattenTree(nodes, expanded, search, filter, depth = 0, parents = [], ancestorMatched = false) {
|
|
2944
3247
|
const result = [];
|
|
2945
3248
|
for (const node of nodes) {
|
|
@@ -3001,8 +3304,8 @@ function TreeSelect({
|
|
|
3001
3304
|
...props
|
|
3002
3305
|
}) {
|
|
3003
3306
|
const size = useControlSize(sizeProp);
|
|
3004
|
-
const rootRef =
|
|
3005
|
-
const popupRef =
|
|
3307
|
+
const rootRef = useRef14(null);
|
|
3308
|
+
const popupRef = useRef14(null);
|
|
3006
3309
|
const nodeIndex = useMemo6(() => {
|
|
3007
3310
|
const index = /* @__PURE__ */ new Map();
|
|
3008
3311
|
const visit = (nodes) => nodes.forEach((node) => {
|
|
@@ -3022,7 +3325,7 @@ function TreeSelect({
|
|
|
3022
3325
|
});
|
|
3023
3326
|
const [open, setOpen] = useControllableState({ value: controlledOpen, defaultValue: defaultOpen, onChange: onDropdownVisibleChange });
|
|
3024
3327
|
const [search, setSearch] = useControllableState({ value: searchValue, defaultValue: "", onChange: onSearch });
|
|
3025
|
-
const [expanded, setExpanded] =
|
|
3328
|
+
const [expanded, setExpanded] = useState14(() => {
|
|
3026
3329
|
if (!treeDefaultExpandAll) return new Set(treeDefaultExpandedKeys);
|
|
3027
3330
|
const values = [];
|
|
3028
3331
|
const collect = (nodes) => nodes.forEach((node) => {
|
|
@@ -3150,7 +3453,7 @@ function TreeSelect({
|
|
|
3150
3453
|
}
|
|
3151
3454
|
}
|
|
3152
3455
|
const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: selectedNodes.length > 0, active: open });
|
|
3153
|
-
return /* @__PURE__ */
|
|
3456
|
+
return /* @__PURE__ */ jsxs17(
|
|
3154
3457
|
"div",
|
|
3155
3458
|
{
|
|
3156
3459
|
ref: rootRef,
|
|
@@ -3164,8 +3467,8 @@ function TreeSelect({
|
|
|
3164
3467
|
}
|
|
3165
3468
|
},
|
|
3166
3469
|
children: [
|
|
3167
|
-
renderTrigger ? renderTrigger({ open, toggle: () => changeOpen(!open), clear }) : /* @__PURE__ */
|
|
3168
|
-
/* @__PURE__ */
|
|
3470
|
+
renderTrigger ? renderTrigger({ open, toggle: () => changeOpen(!open), clear }) : /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
3471
|
+
/* @__PURE__ */ jsxs17(
|
|
3169
3472
|
"button",
|
|
3170
3473
|
{
|
|
3171
3474
|
type: "button",
|
|
@@ -3183,24 +3486,24 @@ function TreeSelect({
|
|
|
3183
3486
|
if (event.key === "Escape") changeOpen(false);
|
|
3184
3487
|
},
|
|
3185
3488
|
children: [
|
|
3186
|
-
/* @__PURE__ */
|
|
3489
|
+
/* @__PURE__ */ jsx18("span", { className: "sia-tree-select__value", children: selectedNodes.length ? displayRender ? displayRender(selectedNodes) : multi ? /* @__PURE__ */ jsx18(OverflowTags, { tagClassName: "sia-tree-select__tag", maxCount: maxTagCount, items: selectedNodes.map((node) => ({ key: node.value, label: node.title })) }) : selectedNodes[0]?.title : /* @__PURE__ */ jsx18("span", { className: "sia-tree-select__placeholder", children: placeholder }) }),
|
|
3187
3490
|
floating.label,
|
|
3188
|
-
/* @__PURE__ */
|
|
3491
|
+
/* @__PURE__ */ jsx18(Icon, { name: open ? "chevron-up" : "chevron-down", size: 14 })
|
|
3189
3492
|
]
|
|
3190
3493
|
}
|
|
3191
3494
|
),
|
|
3192
|
-
allowClear && selectedValues.length > 0 && !disabled ? /* @__PURE__ */
|
|
3495
|
+
allowClear && selectedValues.length > 0 && !disabled ? /* @__PURE__ */ jsx18("button", { type: "button", className: "sia-tree-select__clear", "aria-label": "\u6E05\u9664\u9009\u62E9", onClick: clear, children: /* @__PURE__ */ jsx18(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null
|
|
3193
3496
|
] }),
|
|
3194
|
-
/* @__PURE__ */
|
|
3195
|
-
showSearch ? /* @__PURE__ */
|
|
3196
|
-
/* @__PURE__ */
|
|
3197
|
-
/* @__PURE__ */
|
|
3497
|
+
/* @__PURE__ */ jsxs17(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled, className: `sia-tree-select__dropdown ${popupClassName}`, style: popupStyle, children: [
|
|
3498
|
+
showSearch ? /* @__PURE__ */ jsxs17("label", { className: "sia-tree-select__search", children: [
|
|
3499
|
+
/* @__PURE__ */ jsx18(Icon, { name: "search", size: 15 }),
|
|
3500
|
+
/* @__PURE__ */ jsx18("input", { "aria-label": searchPlaceholder, autoFocus: true, value: search, placeholder: searchPlaceholder, onChange: (event) => setSearch(event.currentTarget.value) })
|
|
3198
3501
|
] }) : null,
|
|
3199
|
-
/* @__PURE__ */
|
|
3502
|
+
/* @__PURE__ */ jsx18("div", { className: "sia-tree-select__tree", role: "tree", "aria-multiselectable": multi || void 0, style: { maxHeight: listHeight }, children: loading ? /* @__PURE__ */ jsx18("div", { role: "status", className: "sia-tree-select__empty", children: "\u52A0\u8F7D\u4E2D\u2026" }) : visibleNodes.length ? visibleNodes.map((node) => {
|
|
3200
3503
|
const hasChildren = Boolean(node.children?.length);
|
|
3201
3504
|
const selected = checked.has(node.value);
|
|
3202
3505
|
const partial = cascade && !selected && affected(node).some((value2) => checked.has(value2));
|
|
3203
|
-
return /* @__PURE__ */
|
|
3506
|
+
return /* @__PURE__ */ jsxs17(
|
|
3204
3507
|
"div",
|
|
3205
3508
|
{
|
|
3206
3509
|
className: `sia-tree-select__node${selected ? " is-selected" : ""}${node.disabled ? " is-disabled" : ""}`,
|
|
@@ -3212,14 +3515,14 @@ function TreeSelect({
|
|
|
3212
3515
|
"aria-expanded": hasChildren ? !!search || expandedSet.has(node.key ?? node.value) : void 0,
|
|
3213
3516
|
"aria-checked": treeCheckable ? partial ? "mixed" : selected : void 0,
|
|
3214
3517
|
children: [
|
|
3215
|
-
hasChildren ? /* @__PURE__ */
|
|
3216
|
-
treeCheckable && node.checkable !== false ? /* @__PURE__ */
|
|
3217
|
-
/* @__PURE__ */
|
|
3518
|
+
hasChildren ? /* @__PURE__ */ jsx18("button", { type: "button", className: "sia-tree-select__expand", "aria-label": expandedSet.has(node.key ?? node.value) ? "\u6536\u8D77\u8282\u70B9" : "\u5C55\u5F00\u8282\u70B9", disabled: node.disabled, onClick: () => toggleNode(node), children: /* @__PURE__ */ jsx18(Icon, { name: expandedSet.has(node.key ?? node.value) ? "chevron-down" : "chevron-right", size: 13 }) }) : /* @__PURE__ */ jsx18("span", { className: "sia-tree-select__indent" }),
|
|
3519
|
+
treeCheckable && node.checkable !== false ? /* @__PURE__ */ jsx18(Checkbox, { "aria-label": typeof node.title === "string" ? node.title : void 0, checked: selected, indeterminate: partial, disabled: node.disabled || node.disableCheckbox, onChange: () => select(node) }) : null,
|
|
3520
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: "sia-tree-select__title", disabled: node.disabled, onClick: () => select(node), children: node.title })
|
|
3218
3521
|
]
|
|
3219
3522
|
},
|
|
3220
3523
|
node.key ?? node.value
|
|
3221
3524
|
);
|
|
3222
|
-
}) : /* @__PURE__ */
|
|
3525
|
+
}) : /* @__PURE__ */ jsx18("div", { className: "sia-tree-select__empty", children: "\u6682\u65E0\u5339\u914D\u8282\u70B9" }) }),
|
|
3223
3526
|
dropdownFooter
|
|
3224
3527
|
] })
|
|
3225
3528
|
]
|
|
@@ -3257,7 +3560,7 @@ function buildFlatTree(items, options = {}) {
|
|
|
3257
3560
|
}
|
|
3258
3561
|
|
|
3259
3562
|
// src/components/Editor.tsx
|
|
3260
|
-
import { useEffect as useEffect10, useId as useId6, useRef as
|
|
3563
|
+
import { useEffect as useEffect10, useId as useId6, useRef as useRef15, useState as useState15 } from "react";
|
|
3261
3564
|
import EditorWorker from "monaco-editor/editor/editor.worker.js?worker";
|
|
3262
3565
|
|
|
3263
3566
|
// src/components/jsonLanguage.ts
|
|
@@ -3838,7 +4141,7 @@ function registerSqlLanguages(monaco) {
|
|
|
3838
4141
|
}
|
|
3839
4142
|
|
|
3840
4143
|
// src/components/Editor.tsx
|
|
3841
|
-
import { jsx as
|
|
4144
|
+
import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3842
4145
|
var EDITOR_COMMAND_SHORTCUTS = {
|
|
3843
4146
|
cut: "Ctrl+X",
|
|
3844
4147
|
copy: "Ctrl+C",
|
|
@@ -3933,29 +4236,29 @@ function Editor({
|
|
|
3933
4236
|
loadingText = "\u6B63\u5728\u52A0\u8F7D\u7F16\u8F91\u5668\u2026"
|
|
3934
4237
|
}) {
|
|
3935
4238
|
const generatedId = useId6();
|
|
3936
|
-
const containerRef =
|
|
3937
|
-
const rangeHighlightRef =
|
|
3938
|
-
const editorRef =
|
|
3939
|
-
const modelRef =
|
|
3940
|
-
const apiRef =
|
|
3941
|
-
const applyingControlledValueRef =
|
|
3942
|
-
const updateHighlightRef =
|
|
3943
|
-
const changeHandlerRef =
|
|
3944
|
-
const readyHandlerRef =
|
|
3945
|
-
const selectionHandlerRef =
|
|
3946
|
-
const keyDownHandlerRef =
|
|
3947
|
-
const highlightRangeRef =
|
|
3948
|
-
const markersRef =
|
|
3949
|
-
const contextMenuItemsRef =
|
|
3950
|
-
const completionProviderRef =
|
|
3951
|
-
const refreshSuggestionOnSpaceRef =
|
|
3952
|
-
const initialValueRef =
|
|
3953
|
-
const initialLanguageRef =
|
|
3954
|
-
const initialPathRef =
|
|
3955
|
-
const initialThemeRef =
|
|
3956
|
-
const initialOptionsRef =
|
|
3957
|
-
const [loading, setLoading] =
|
|
3958
|
-
const [, setSelectionVersion] =
|
|
4239
|
+
const containerRef = useRef15(null);
|
|
4240
|
+
const rangeHighlightRef = useRef15(null);
|
|
4241
|
+
const editorRef = useRef15(null);
|
|
4242
|
+
const modelRef = useRef15(null);
|
|
4243
|
+
const apiRef = useRef15(null);
|
|
4244
|
+
const applyingControlledValueRef = useRef15(false);
|
|
4245
|
+
const updateHighlightRef = useRef15(() => void 0);
|
|
4246
|
+
const changeHandlerRef = useRef15(onChange);
|
|
4247
|
+
const readyHandlerRef = useRef15(onReady);
|
|
4248
|
+
const selectionHandlerRef = useRef15(onSelectionChange);
|
|
4249
|
+
const keyDownHandlerRef = useRef15(onKeyDown);
|
|
4250
|
+
const highlightRangeRef = useRef15(highlightRange);
|
|
4251
|
+
const markersRef = useRef15(markers);
|
|
4252
|
+
const contextMenuItemsRef = useRef15(contextMenuItems);
|
|
4253
|
+
const completionProviderRef = useRef15(completionProvider);
|
|
4254
|
+
const refreshSuggestionOnSpaceRef = useRef15(refreshSuggestionOnSpace);
|
|
4255
|
+
const initialValueRef = useRef15(value);
|
|
4256
|
+
const initialLanguageRef = useRef15(language);
|
|
4257
|
+
const initialPathRef = useRef15(path);
|
|
4258
|
+
const initialThemeRef = useRef15(theme);
|
|
4259
|
+
const initialOptionsRef = useRef15(options);
|
|
4260
|
+
const [loading, setLoading] = useState15(true);
|
|
4261
|
+
const [, setSelectionVersion] = useState15(0);
|
|
3959
4262
|
initialValueRef.current = value;
|
|
3960
4263
|
initialLanguageRef.current = language;
|
|
3961
4264
|
initialPathRef.current = path;
|
|
@@ -4441,11 +4744,11 @@ function Editor({
|
|
|
4441
4744
|
})));
|
|
4442
4745
|
});
|
|
4443
4746
|
}, [generatedId, loading, markers]);
|
|
4444
|
-
const editorNode = /* @__PURE__ */
|
|
4445
|
-
/* @__PURE__ */
|
|
4446
|
-
/* @__PURE__ */
|
|
4447
|
-
loading ? /* @__PURE__ */
|
|
4448
|
-
/* @__PURE__ */
|
|
4747
|
+
const editorNode = /* @__PURE__ */ jsxs18("div", { className: `sia-editor-control ${className}`.trim(), "data-loading": loading || void 0, children: [
|
|
4748
|
+
/* @__PURE__ */ jsx19("div", { className: "sia-editor-control__surface", ref: containerRef, "aria-label": ariaLabel }),
|
|
4749
|
+
/* @__PURE__ */ jsx19("div", { ref: rangeHighlightRef, className: "sia-editor-control__range-highlight", "aria-hidden": "true" }),
|
|
4750
|
+
loading ? /* @__PURE__ */ jsxs18("div", { className: "sia-editor-control__loading", role: "status", children: [
|
|
4751
|
+
/* @__PURE__ */ jsx19("span", {}),
|
|
4449
4752
|
loadingText
|
|
4450
4753
|
] }) : null
|
|
4451
4754
|
] });
|
|
@@ -4474,7 +4777,7 @@ function Editor({
|
|
|
4474
4777
|
item.onClick?.(api);
|
|
4475
4778
|
}
|
|
4476
4779
|
}
|
|
4477
|
-
return /* @__PURE__ */
|
|
4780
|
+
return /* @__PURE__ */ jsx19(
|
|
4478
4781
|
Dropdown,
|
|
4479
4782
|
{
|
|
4480
4783
|
className: "sia-editor-control__context-menu",
|
|
@@ -4491,13 +4794,13 @@ function Editor({
|
|
|
4491
4794
|
}
|
|
4492
4795
|
|
|
4493
4796
|
// src/components/Markdown.tsx
|
|
4494
|
-
import { useEffect as useEffect11, useMemo as useMemo7, useRef as
|
|
4797
|
+
import { useEffect as useEffect11, useMemo as useMemo7, useRef as useRef16, useState as useState16 } from "react";
|
|
4495
4798
|
import DOMPurify from "dompurify";
|
|
4496
4799
|
import { marked } from "marked";
|
|
4497
|
-
import { Fragment as Fragment6, jsx as
|
|
4800
|
+
import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4498
4801
|
function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", resolveImageSrc, imagePreview = true, className = "", onClick, onKeyDown, ...props }) {
|
|
4499
|
-
const rootRef =
|
|
4500
|
-
const [previewImage, setPreviewImage] =
|
|
4802
|
+
const rootRef = useRef16(null);
|
|
4803
|
+
const [previewImage, setPreviewImage] = useState16(null);
|
|
4501
4804
|
const html = useMemo7(() => {
|
|
4502
4805
|
const rendered = marked.parse(content, { breaks: true, gfm: true });
|
|
4503
4806
|
const sanitized = DOMPurify.sanitize(rendered, { USE_PROFILES: { html: true } });
|
|
@@ -4560,24 +4863,24 @@ function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", r
|
|
|
4560
4863
|
onKeyDown?.(event);
|
|
4561
4864
|
}
|
|
4562
4865
|
if (!content.trim()) {
|
|
4563
|
-
return /* @__PURE__ */
|
|
4866
|
+
return /* @__PURE__ */ jsx20("div", { className: `sia-markdown sia-markdown--empty ${className}`.trim(), children: emptyText });
|
|
4564
4867
|
}
|
|
4565
|
-
return /* @__PURE__ */
|
|
4566
|
-
/* @__PURE__ */
|
|
4567
|
-
/* @__PURE__ */
|
|
4868
|
+
return /* @__PURE__ */ jsxs19(Fragment6, { children: [
|
|
4869
|
+
/* @__PURE__ */ jsx20("article", { ...withTitleTooltip(props), ref: rootRef, className: `sia-markdown ${className}`.trim(), onClick: handleClick, onKeyDown: handleKeyDown, dangerouslySetInnerHTML: { __html: html } }),
|
|
4870
|
+
/* @__PURE__ */ jsx20(ImagePreview, { open: Boolean(previewImage), src: previewImage?.src, alt: previewImage?.alt, onOpenChange: (open) => {
|
|
4568
4871
|
if (!open) setPreviewImage(null);
|
|
4569
4872
|
} })
|
|
4570
4873
|
] });
|
|
4571
4874
|
}
|
|
4572
4875
|
|
|
4573
4876
|
// src/components/InputNumber.tsx
|
|
4574
|
-
import { forwardRef as
|
|
4575
|
-
import { jsx as
|
|
4877
|
+
import { forwardRef as forwardRef5, useEffect as useEffect12, useId as useId7, useRef as useRef17, useState as useState17 } from "react";
|
|
4878
|
+
import { jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4576
4879
|
function formatValue(value, precision) {
|
|
4577
4880
|
if (value === null || !Number.isFinite(value)) return "";
|
|
4578
4881
|
return precision === void 0 ? String(value) : value.toFixed(precision);
|
|
4579
4882
|
}
|
|
4580
|
-
var InputNumber =
|
|
4883
|
+
var InputNumber = forwardRef5(function InputNumber2({
|
|
4581
4884
|
value,
|
|
4582
4885
|
defaultValue = null,
|
|
4583
4886
|
onChange,
|
|
@@ -4605,13 +4908,13 @@ var InputNumber = forwardRef4(function InputNumber2({
|
|
|
4605
4908
|
const size = useControlSize(sizeProp);
|
|
4606
4909
|
const fallbackId = useId7();
|
|
4607
4910
|
const inputId = id ?? fallbackId;
|
|
4608
|
-
const localRef =
|
|
4911
|
+
const localRef = useRef17(null);
|
|
4609
4912
|
const [currentValue, setCurrentValue] = useControllableState({ value, defaultValue, onChange });
|
|
4610
4913
|
const displayValue = (next) => {
|
|
4611
4914
|
const plain = formatValue(next, precision);
|
|
4612
4915
|
return plain && formatter ? formatter(plain) : plain;
|
|
4613
4916
|
};
|
|
4614
|
-
const [text, setText] =
|
|
4917
|
+
const [text, setText] = useState17(() => displayValue(currentValue));
|
|
4615
4918
|
useEffect12(() => {
|
|
4616
4919
|
setText(displayValue(currentValue));
|
|
4617
4920
|
}, [currentValue, precision, formatter]);
|
|
@@ -4681,7 +4984,7 @@ var InputNumber = forwardRef4(function InputNumber2({
|
|
|
4681
4984
|
const increaseDisabled = disabled || readOnly || max !== void 0 && currentValue !== null && currentValue >= max;
|
|
4682
4985
|
const decreaseDisabled = disabled || readOnly || min !== void 0 && currentValue !== null && currentValue <= min;
|
|
4683
4986
|
const floatingPlaceholder = usePlaceholderMode(placeholderMode) === "floating" && Boolean(placeholder);
|
|
4684
|
-
const input = /* @__PURE__ */
|
|
4987
|
+
const input = /* @__PURE__ */ jsx21(
|
|
4685
4988
|
"input",
|
|
4686
4989
|
{
|
|
4687
4990
|
...withTitleTooltip(props),
|
|
@@ -4703,26 +5006,26 @@ var InputNumber = forwardRef4(function InputNumber2({
|
|
|
4703
5006
|
onKeyDown: handleKeyDown
|
|
4704
5007
|
}
|
|
4705
5008
|
);
|
|
4706
|
-
return /* @__PURE__ */
|
|
4707
|
-
prefix ? /* @__PURE__ */
|
|
4708
|
-
floatingPlaceholder ? /* @__PURE__ */
|
|
5009
|
+
return /* @__PURE__ */ jsxs20("span", { className: `sia-input-number sia-input-number--${size} sia-input-number--${status}${floatingPlaceholder ? " sia-input-number--floating" : ""}${floatingPlaceholder && text.length > 0 ? " is-filled" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
5010
|
+
prefix ? /* @__PURE__ */ jsx21("span", { className: "sia-input-number__affix", children: prefix }) : null,
|
|
5011
|
+
floatingPlaceholder ? /* @__PURE__ */ jsxs20("span", { className: "sia-input-number__input-wrap", children: [
|
|
4709
5012
|
input,
|
|
4710
|
-
/* @__PURE__ */
|
|
5013
|
+
/* @__PURE__ */ jsx21("span", { className: "sia-input-number__floating-placeholder", "aria-hidden": "true", children: placeholder })
|
|
4711
5014
|
] }) : input,
|
|
4712
|
-
suffix ? /* @__PURE__ */
|
|
4713
|
-
controls ? /* @__PURE__ */
|
|
4714
|
-
/* @__PURE__ */
|
|
4715
|
-
/* @__PURE__ */
|
|
5015
|
+
suffix ? /* @__PURE__ */ jsx21("span", { className: "sia-input-number__affix", children: suffix }) : null,
|
|
5016
|
+
controls ? /* @__PURE__ */ jsxs20("span", { className: "sia-input-number__controls", children: [
|
|
5017
|
+
/* @__PURE__ */ jsx21("button", { type: "button", tabIndex: -1, "aria-label": "\u589E\u52A0\u6570\u503C", disabled: increaseDisabled, onClick: () => changeBy(1), children: /* @__PURE__ */ jsx21(Icon, { name: "chevron-up", size: 12 }) }),
|
|
5018
|
+
/* @__PURE__ */ jsx21("button", { type: "button", tabIndex: -1, "aria-label": "\u51CF\u5C11\u6570\u503C", disabled: decreaseDisabled, onClick: () => changeBy(-1), children: /* @__PURE__ */ jsx21(Icon, { name: "chevron-down", size: 12 }) })
|
|
4716
5019
|
] }) : null
|
|
4717
5020
|
] });
|
|
4718
5021
|
});
|
|
4719
5022
|
|
|
4720
5023
|
// src/components/SelectModal.tsx
|
|
4721
|
-
import { useState as
|
|
4722
|
-
import { Fragment as Fragment7, jsx as
|
|
5024
|
+
import { useState as useState18 } from "react";
|
|
5025
|
+
import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4723
5026
|
function SelectModalBody({ config, values, disabled, onChange }) {
|
|
4724
|
-
const [query, setQuery] =
|
|
4725
|
-
const [selectedOnly, setSelectedOnly] =
|
|
5027
|
+
const [query, setQuery] = useState18("");
|
|
5028
|
+
const [selectedOnly, setSelectedOnly] = useState18(false);
|
|
4726
5029
|
const multiple = config.mode === "multiple";
|
|
4727
5030
|
const search = query.trim();
|
|
4728
5031
|
const filtered = config.options.filter((option) => !search || (config.filterOption ? config.filterOption(search, option) : [option.label, option.value].some((text) => String(text ?? "").toLowerCase().includes(search.toLowerCase()))));
|
|
@@ -4736,23 +5039,23 @@ function SelectModalBody({ config, values, disabled, onChange }) {
|
|
|
4736
5039
|
});
|
|
4737
5040
|
onChange([...next]);
|
|
4738
5041
|
};
|
|
4739
|
-
return /* @__PURE__ */
|
|
4740
|
-
config.headerExtra != null && config.headerExtra !== false ? /* @__PURE__ */
|
|
4741
|
-
/* @__PURE__ */
|
|
4742
|
-
/* @__PURE__ */
|
|
4743
|
-
/* @__PURE__ */
|
|
4744
|
-
/* @__PURE__ */
|
|
5042
|
+
return /* @__PURE__ */ jsxs21(Fragment7, { children: [
|
|
5043
|
+
config.headerExtra != null && config.headerExtra !== false ? /* @__PURE__ */ jsx22("div", { className: "sia-select-modal__header-extra", children: config.headerExtra }) : null,
|
|
5044
|
+
/* @__PURE__ */ jsxs21("div", { className: "sia-select-modal__heading", children: [
|
|
5045
|
+
/* @__PURE__ */ jsxs21("div", { role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
5046
|
+
/* @__PURE__ */ jsx22(Button, { role: "tab", "aria-selected": !selectedOnly, variant: "link", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
5047
|
+
/* @__PURE__ */ jsxs21(Button, { role: "tab", "aria-selected": selectedOnly, variant: "link", onClick: () => setSelectedOnly(true), children: [
|
|
4745
5048
|
"\u5DF2\u9009\u9879(",
|
|
4746
5049
|
values.length,
|
|
4747
5050
|
")"
|
|
4748
5051
|
] })
|
|
4749
5052
|
] }),
|
|
4750
|
-
/* @__PURE__ */
|
|
5053
|
+
/* @__PURE__ */ jsx22(
|
|
4751
5054
|
Input,
|
|
4752
5055
|
{
|
|
4753
5056
|
"aria-label": config.searchPlaceholder ?? "\u641C\u7D22\u9009\u9879",
|
|
4754
5057
|
placeholder: config.searchPlaceholder ?? "\u641C\u7D22\u9009\u9879",
|
|
4755
|
-
prefix: /* @__PURE__ */
|
|
5058
|
+
prefix: /* @__PURE__ */ jsx22(Icon, { name: "search", size: 14 }),
|
|
4756
5059
|
value: query,
|
|
4757
5060
|
allowClear: true,
|
|
4758
5061
|
disabled,
|
|
@@ -4763,8 +5066,8 @@ function SelectModalBody({ config, values, disabled, onChange }) {
|
|
|
4763
5066
|
}
|
|
4764
5067
|
)
|
|
4765
5068
|
] }),
|
|
4766
|
-
multiple ? /* @__PURE__ */
|
|
4767
|
-
/* @__PURE__ */
|
|
5069
|
+
multiple ? /* @__PURE__ */ jsxs21("div", { className: "sia-select-modal__actions", children: [
|
|
5070
|
+
/* @__PURE__ */ jsx22(
|
|
4768
5071
|
Checkbox,
|
|
4769
5072
|
{
|
|
4770
5073
|
checked: all,
|
|
@@ -4774,10 +5077,10 @@ function SelectModalBody({ config, values, disabled, onChange }) {
|
|
|
4774
5077
|
children: "\u5168\u9009"
|
|
4775
5078
|
}
|
|
4776
5079
|
),
|
|
4777
|
-
/* @__PURE__ */
|
|
4778
|
-
/* @__PURE__ */
|
|
5080
|
+
/* @__PURE__ */ jsx22(Button, { variant: "link", size: "small", disabled: disabled || !enabled.length, onClick: () => batch("invert"), children: "\u53CD\u9009" }),
|
|
5081
|
+
/* @__PURE__ */ jsx22(Button, { variant: "link", size: "small", danger: true, disabled: disabled || !values.length, onClick: () => onChange([]), children: "\u6E05\u7A7A" })
|
|
4779
5082
|
] }) : null,
|
|
4780
|
-
/* @__PURE__ */
|
|
5083
|
+
/* @__PURE__ */ jsx22(
|
|
4781
5084
|
SelectionPanel,
|
|
4782
5085
|
{
|
|
4783
5086
|
options: filtered,
|
|
@@ -4804,7 +5107,7 @@ function openSelectModal(config) {
|
|
|
4804
5107
|
if (config.mode !== "multiple") values = values.slice(0, 1);
|
|
4805
5108
|
let submitting = false;
|
|
4806
5109
|
function body() {
|
|
4807
|
-
return /* @__PURE__ */
|
|
5110
|
+
return /* @__PURE__ */ jsx22(SelectModalBody, { config: current, values, disabled: submitting || Boolean(current.confirmLoading), onChange: (next) => {
|
|
4808
5111
|
values = next;
|
|
4809
5112
|
handle.update({ children: body() });
|
|
4810
5113
|
} });
|
|
@@ -4847,8 +5150,8 @@ function openSelectModal(config) {
|
|
|
4847
5150
|
}
|
|
4848
5151
|
|
|
4849
5152
|
// src/components/Treemap.tsx
|
|
4850
|
-
import { useEffect as useEffect13, useMemo as useMemo8, useRef as
|
|
4851
|
-
import { jsx as
|
|
5153
|
+
import { useEffect as useEffect13, useMemo as useMemo8, useRef as useRef18, useState as useState19 } from "react";
|
|
5154
|
+
import { jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4852
5155
|
import { createElement } from "react";
|
|
4853
5156
|
function positiveValue(value) {
|
|
4854
5157
|
return Number.isFinite(value) && value > 0 ? value : 1;
|
|
@@ -5220,10 +5523,10 @@ function Treemap({
|
|
|
5220
5523
|
style,
|
|
5221
5524
|
...props
|
|
5222
5525
|
}) {
|
|
5223
|
-
const containerRef =
|
|
5224
|
-
const [size, setSize] =
|
|
5225
|
-
const [internalExpandedKeys, setInternalExpandedKeys] =
|
|
5226
|
-
const [internalFocusedKey, setInternalFocusedKey] =
|
|
5526
|
+
const containerRef = useRef18(null);
|
|
5527
|
+
const [size, setSize] = useState19({ width: 0, height: 0 });
|
|
5528
|
+
const [internalExpandedKeys, setInternalExpandedKeys] = useState19(() => [...defaultExpandedKeys]);
|
|
5529
|
+
const [internalFocusedKey, setInternalFocusedKey] = useState19(defaultFocusedKey);
|
|
5227
5530
|
const currentExpandedKeys = expandedKeys ?? internalExpandedKeys;
|
|
5228
5531
|
const currentFocusedKey = focusedKey === void 0 ? internalFocusedKey : focusedKey;
|
|
5229
5532
|
const expandedSet = useMemo8(() => new Set(currentExpandedKeys), [currentExpandedKeys]);
|
|
@@ -5280,7 +5583,7 @@ function Treemap({
|
|
|
5280
5583
|
}
|
|
5281
5584
|
onNodeClick?.({ node, expanded: isExpanded, nativeEvent });
|
|
5282
5585
|
}
|
|
5283
|
-
return /* @__PURE__ */
|
|
5586
|
+
return /* @__PURE__ */ jsxs22(
|
|
5284
5587
|
"div",
|
|
5285
5588
|
{
|
|
5286
5589
|
...withTitleTooltip(props),
|
|
@@ -5289,7 +5592,7 @@ function Treemap({
|
|
|
5289
5592
|
style,
|
|
5290
5593
|
role: "tree",
|
|
5291
5594
|
children: [
|
|
5292
|
-
data.length === 0 ? /* @__PURE__ */
|
|
5595
|
+
data.length === 0 ? /* @__PURE__ */ jsx23("div", { className: "sia-treemap__empty", children: emptyContent }) : null,
|
|
5293
5596
|
positions.map(({ node, rectangle, depth, expanded }) => {
|
|
5294
5597
|
const active = node.key === activeKey || Boolean(node.__active);
|
|
5295
5598
|
const fontSize = tileFontSize(rectangle);
|
|
@@ -5319,8 +5622,8 @@ function Treemap({
|
|
|
5319
5622
|
"data-treemap-key": node.key,
|
|
5320
5623
|
key: node.key
|
|
5321
5624
|
},
|
|
5322
|
-
/* @__PURE__ */
|
|
5323
|
-
/* @__PURE__ */
|
|
5625
|
+
/* @__PURE__ */ jsxs22("div", { className: "sia-treemap__header", children: [
|
|
5626
|
+
/* @__PURE__ */ jsxs22(
|
|
5324
5627
|
"button",
|
|
5325
5628
|
{
|
|
5326
5629
|
type: "button",
|
|
@@ -5328,12 +5631,12 @@ function Treemap({
|
|
|
5328
5631
|
disabled: node.disabled,
|
|
5329
5632
|
onClick: (event) => handleNodeClick(node, event),
|
|
5330
5633
|
children: [
|
|
5331
|
-
/* @__PURE__ */
|
|
5332
|
-
showValue ? /* @__PURE__ */
|
|
5634
|
+
/* @__PURE__ */ jsx23("span", { className: "sia-treemap__label", children: node.label }),
|
|
5635
|
+
showValue ? /* @__PURE__ */ jsx23("span", { className: "sia-treemap__value", children: valueFormatter(node.value, node) }) : null
|
|
5333
5636
|
]
|
|
5334
5637
|
}
|
|
5335
5638
|
),
|
|
5336
|
-
/* @__PURE__ */
|
|
5639
|
+
/* @__PURE__ */ jsx23(
|
|
5337
5640
|
"button",
|
|
5338
5641
|
{
|
|
5339
5642
|
type: "button",
|
|
@@ -5341,7 +5644,7 @@ function Treemap({
|
|
|
5341
5644
|
"aria-label": effectiveFocusedNode?.key === node.key ? `\u8FD8\u539F ${node.label}` : `\u805A\u7126\u5C55\u5F00 ${node.label}`,
|
|
5342
5645
|
...withTitleTooltip({ title: effectiveFocusedNode?.key === node.key ? "\u8FD8\u539F\u539F\u6709\u89C6\u56FE" : "\u5C55\u5F00\u5230\u6574\u4E2A\u533A\u57DF" }),
|
|
5343
5646
|
onClick: () => updateFocusedKey(effectiveFocusedNode?.key === node.key ? null : node.key),
|
|
5344
|
-
children: /* @__PURE__ */
|
|
5647
|
+
children: /* @__PURE__ */ jsx23(Icon, { name: effectiveFocusedNode?.key === node.key ? "fullscreen-exit" : "fullscreen", size: 14 })
|
|
5345
5648
|
}
|
|
5346
5649
|
)
|
|
5347
5650
|
] })
|
|
@@ -5361,9 +5664,9 @@ function Treemap({
|
|
|
5361
5664
|
onClick: (event) => handleNodeClick(node, event),
|
|
5362
5665
|
key: node.key
|
|
5363
5666
|
},
|
|
5364
|
-
showLabel ? /* @__PURE__ */
|
|
5365
|
-
/* @__PURE__ */
|
|
5366
|
-
showValue ? /* @__PURE__ */
|
|
5667
|
+
showLabel ? /* @__PURE__ */ jsxs22("span", { className: "sia-treemap__content", children: [
|
|
5668
|
+
/* @__PURE__ */ jsx23("span", { className: "sia-treemap__label", children: node.label }),
|
|
5669
|
+
showValue ? /* @__PURE__ */ jsx23("span", { className: "sia-treemap__value", children: valueFormatter(node.value, node) }) : null
|
|
5367
5670
|
] }) : null
|
|
5368
5671
|
);
|
|
5369
5672
|
})
|
|
@@ -5373,8 +5676,8 @@ function Treemap({
|
|
|
5373
5676
|
}
|
|
5374
5677
|
|
|
5375
5678
|
// src/components/Table/TableCellContent.tsx
|
|
5376
|
-
import { useLayoutEffect as
|
|
5377
|
-
import { jsx as
|
|
5679
|
+
import { useLayoutEffect as useLayoutEffect5, useRef as useRef19, useState as useState20 } from "react";
|
|
5680
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
5378
5681
|
var pendingLayouts = /* @__PURE__ */ new Map();
|
|
5379
5682
|
var layoutFrame;
|
|
5380
5683
|
function scheduleLayout(element, task) {
|
|
@@ -5392,10 +5695,10 @@ function scheduleLayout(element, task) {
|
|
|
5392
5695
|
});
|
|
5393
5696
|
}
|
|
5394
5697
|
function TableCellContent({ children, ellipsis, title }) {
|
|
5395
|
-
const ref =
|
|
5396
|
-
const [overflowing, setOverflowing] =
|
|
5698
|
+
const ref = useRef19(null);
|
|
5699
|
+
const [overflowing, setOverflowing] = useState20(false);
|
|
5397
5700
|
const customContent = typeof children !== "string" && typeof children !== "number" && children != null;
|
|
5398
|
-
|
|
5701
|
+
useLayoutEffect5(() => {
|
|
5399
5702
|
const element = ref.current;
|
|
5400
5703
|
if (!element || !ellipsis || !customContent) return;
|
|
5401
5704
|
const normalizeLayouts = (parent, layouts) => {
|
|
@@ -5427,18 +5730,18 @@ function TableCellContent({ children, ellipsis, title }) {
|
|
|
5427
5730
|
pendingLayouts.delete(element);
|
|
5428
5731
|
};
|
|
5429
5732
|
}, [children, ellipsis, customContent]);
|
|
5430
|
-
return /* @__PURE__ */
|
|
5733
|
+
return /* @__PURE__ */ jsx24("div", { ref, className: "sia-table__cell-content", "data-custom-content": customContent || void 0, "data-content-overflow": ellipsis && customContent && overflowing || void 0, children: title ? /* @__PURE__ */ jsx24(Tooltip, { title, className: "sia-table__cell-tooltip", children: /* @__PURE__ */ jsx24("span", { children }) }) : children });
|
|
5431
5734
|
}
|
|
5432
5735
|
|
|
5433
5736
|
// src/components/Table/useRemainingHeight.ts
|
|
5434
|
-
import { useLayoutEffect as
|
|
5737
|
+
import { useLayoutEffect as useLayoutEffect6, useState as useState21 } from "react";
|
|
5435
5738
|
function useRemainingHeight(rootRef, options) {
|
|
5436
|
-
const [height, setHeight] =
|
|
5739
|
+
const [height, setHeight] = useState21();
|
|
5437
5740
|
const enabled = !!options;
|
|
5438
5741
|
const container = typeof options === "object" ? options.container : void 0;
|
|
5439
5742
|
const bottomOffset = typeof options === "object" ? options.bottomOffset ?? 0 : 0;
|
|
5440
5743
|
const minHeight = typeof options === "object" ? options.minHeight ?? 0 : 0;
|
|
5441
|
-
|
|
5744
|
+
useLayoutEffect6(() => {
|
|
5442
5745
|
const root = rootRef.current;
|
|
5443
5746
|
if (!enabled || !root) return;
|
|
5444
5747
|
const win = root.ownerDocument.defaultView;
|
|
@@ -5509,7 +5812,7 @@ function useRemainingHeight(rootRef, options) {
|
|
|
5509
5812
|
}
|
|
5510
5813
|
|
|
5511
5814
|
// src/components/Table/TableCanvasLayer.tsx
|
|
5512
|
-
import { useLayoutEffect as
|
|
5815
|
+
import { useLayoutEffect as useLayoutEffect7, useRef as useRef20 } from "react";
|
|
5513
5816
|
|
|
5514
5817
|
// src/components/Table/utils.ts
|
|
5515
5818
|
var AUTO_WIDTH_COLUMN_KEYS = /* @__PURE__ */ new Set(["action", "actions", "operation", "operations"]);
|
|
@@ -5562,10 +5865,10 @@ function toTablePageParams(current, pageSize) {
|
|
|
5562
5865
|
}
|
|
5563
5866
|
|
|
5564
5867
|
// src/components/Table/TableCanvasLayer.tsx
|
|
5565
|
-
import { jsx as
|
|
5868
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
5566
5869
|
function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHeight }) {
|
|
5567
|
-
const canvasRef =
|
|
5568
|
-
|
|
5870
|
+
const canvasRef = useRef20(null);
|
|
5871
|
+
useLayoutEffect7(() => {
|
|
5569
5872
|
const canvas = canvasRef.current;
|
|
5570
5873
|
const scroller = viewport.current;
|
|
5571
5874
|
if (!canvas || !scroller) return;
|
|
@@ -5688,7 +5991,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
5688
5991
|
window.removeEventListener("resize", schedule);
|
|
5689
5992
|
};
|
|
5690
5993
|
}, [viewport, rows, columns, widths, rowHeight, headerHeight]);
|
|
5691
|
-
return /* @__PURE__ */
|
|
5994
|
+
return /* @__PURE__ */ jsx25("canvas", { ref: canvasRef, "aria-hidden": "true", className: "sia-table__canvas-layer" });
|
|
5692
5995
|
}
|
|
5693
5996
|
|
|
5694
5997
|
// src/components/Table/rowIdentity.ts
|
|
@@ -5750,10 +6053,10 @@ function playCellFocusGlow(cell, isVisible, onFinish, options) {
|
|
|
5750
6053
|
}
|
|
5751
6054
|
|
|
5752
6055
|
// src/components/Table/Table.tsx
|
|
5753
|
-
import { Fragment as Fragment9, forwardRef as
|
|
6056
|
+
import { Fragment as Fragment9, forwardRef as forwardRef6, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as useEffect15, useImperativeHandle, useMemo as useMemo9, useRef as useRef22, useState as useState23 } from "react";
|
|
5754
6057
|
|
|
5755
6058
|
// src/components/Table/plugins.tsx
|
|
5756
|
-
import { isValidElement as isValidElement3, useEffect as useEffect14, useRef as
|
|
6059
|
+
import { isValidElement as isValidElement3, useEffect as useEffect14, useRef as useRef21, useState as useState22 } from "react";
|
|
5757
6060
|
|
|
5758
6061
|
// src/components/Table/columnSettings.ts
|
|
5759
6062
|
function reconcileColumnSettings(columns, defaults, saved) {
|
|
@@ -5840,7 +6143,7 @@ function saveSettingsPatch(adapter, scope, patch) {
|
|
|
5840
6143
|
}
|
|
5841
6144
|
|
|
5842
6145
|
// src/components/Table/plugins.tsx
|
|
5843
|
-
import { Fragment as Fragment8, jsx as
|
|
6146
|
+
import { Fragment as Fragment8, jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5844
6147
|
function TableCheckbox({
|
|
5845
6148
|
checked,
|
|
5846
6149
|
indeterminate,
|
|
@@ -5848,7 +6151,7 @@ function TableCheckbox({
|
|
|
5848
6151
|
label,
|
|
5849
6152
|
onChange
|
|
5850
6153
|
}) {
|
|
5851
|
-
return /* @__PURE__ */
|
|
6154
|
+
return /* @__PURE__ */ jsx26(
|
|
5852
6155
|
Checkbox,
|
|
5853
6156
|
{
|
|
5854
6157
|
className: "sia-table__checkbox",
|
|
@@ -6466,20 +6769,20 @@ function TableSelectedItemsPanel({
|
|
|
6466
6769
|
onRemove,
|
|
6467
6770
|
onClear
|
|
6468
6771
|
}) {
|
|
6469
|
-
const [showAll, setShowAll] =
|
|
6772
|
+
const [showAll, setShowAll] = useState22(false);
|
|
6470
6773
|
const visibleEntries = showAll ? entries : entries.slice(0, maxCount);
|
|
6471
6774
|
const hiddenCount = Math.max(0, entries.length - visibleEntries.length);
|
|
6472
6775
|
const baseColumnMap = new Map(
|
|
6473
6776
|
flattenTableColumns(baseColumns).map((column) => [column.key, column])
|
|
6474
6777
|
);
|
|
6475
|
-
return /* @__PURE__ */
|
|
6476
|
-
/* @__PURE__ */
|
|
6477
|
-
/* @__PURE__ */
|
|
6778
|
+
return /* @__PURE__ */ jsxs23("div", { className: "sia-table-selection-panel", children: [
|
|
6779
|
+
/* @__PURE__ */ jsxs23("div", { className: "sia-table-selection-panel__header", children: [
|
|
6780
|
+
/* @__PURE__ */ jsxs23("strong", { children: [
|
|
6478
6781
|
"\u5DF2\u9009 ",
|
|
6479
|
-
/* @__PURE__ */
|
|
6782
|
+
/* @__PURE__ */ jsx26("span", { children: entries.length }),
|
|
6480
6783
|
" \u9879"
|
|
6481
6784
|
] }),
|
|
6482
|
-
/* @__PURE__ */
|
|
6785
|
+
/* @__PURE__ */ jsx26(
|
|
6483
6786
|
Button,
|
|
6484
6787
|
{
|
|
6485
6788
|
size: "small",
|
|
@@ -6490,15 +6793,15 @@ function TableSelectedItemsPanel({
|
|
|
6490
6793
|
}
|
|
6491
6794
|
)
|
|
6492
6795
|
] }),
|
|
6493
|
-
/* @__PURE__ */
|
|
6494
|
-
/* @__PURE__ */
|
|
6495
|
-
columns.map((column) => /* @__PURE__ */
|
|
6496
|
-
/* @__PURE__ */
|
|
6796
|
+
/* @__PURE__ */ jsx26("div", { className: "sia-table-selection-panel__body", children: /* @__PURE__ */ jsxs23("table", { children: [
|
|
6797
|
+
/* @__PURE__ */ jsx26("thead", { children: /* @__PURE__ */ jsxs23("tr", { children: [
|
|
6798
|
+
columns.map((column) => /* @__PURE__ */ jsx26("th", { children: getColumnLabel(column) }, column.key)),
|
|
6799
|
+
/* @__PURE__ */ jsx26("th", { "aria-label": "\u64CD\u4F5C" })
|
|
6497
6800
|
] }) }),
|
|
6498
|
-
/* @__PURE__ */
|
|
6801
|
+
/* @__PURE__ */ jsx26("tbody", { children: visibleEntries.map((entry, selectedIndex) => /* @__PURE__ */ jsxs23("tr", { children: [
|
|
6499
6802
|
columns.map((column) => {
|
|
6500
6803
|
if (column.meta?.plugin === "index")
|
|
6501
|
-
return /* @__PURE__ */
|
|
6804
|
+
return /* @__PURE__ */ jsx26("td", { children: entry.sourceIndex + 1 }, column.key);
|
|
6502
6805
|
const baseColumn = baseColumnMap.get(column.key) ?? column;
|
|
6503
6806
|
const value = getTableValue(
|
|
6504
6807
|
entry.record,
|
|
@@ -6518,9 +6821,9 @@ function TableSelectedItemsPanel({
|
|
|
6518
6821
|
entry.sourceIndex,
|
|
6519
6822
|
{ row, rowIndex: entry.sourceIndex, column: baseColumn }
|
|
6520
6823
|
) ?? value;
|
|
6521
|
-
return /* @__PURE__ */
|
|
6824
|
+
return /* @__PURE__ */ jsx26("td", { children: content }, column.key);
|
|
6522
6825
|
}),
|
|
6523
|
-
/* @__PURE__ */
|
|
6826
|
+
/* @__PURE__ */ jsx26("td", { children: /* @__PURE__ */ jsx26(
|
|
6524
6827
|
Button,
|
|
6525
6828
|
{
|
|
6526
6829
|
size: "small",
|
|
@@ -6531,11 +6834,11 @@ function TableSelectedItemsPanel({
|
|
|
6531
6834
|
) })
|
|
6532
6835
|
] }, entry.key)) })
|
|
6533
6836
|
] }) }),
|
|
6534
|
-
hiddenCount > 0 ? /* @__PURE__ */
|
|
6837
|
+
hiddenCount > 0 ? /* @__PURE__ */ jsxs23("div", { className: "sia-table-selection-panel__more", children: [
|
|
6535
6838
|
"\u8FD8\u6709 ",
|
|
6536
6839
|
hiddenCount,
|
|
6537
6840
|
" \u9879\u672A\u5C55\u793A",
|
|
6538
|
-
/* @__PURE__ */
|
|
6841
|
+
/* @__PURE__ */ jsx26(Button, { size: "small", variant: "link", onClick: () => setShowAll(true), children: "\u5C55\u793A\u5168\u90E8" })
|
|
6539
6842
|
] }) : null
|
|
6540
6843
|
] });
|
|
6541
6844
|
}
|
|
@@ -6656,7 +6959,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
6656
6959
|
const keys = selected(context);
|
|
6657
6960
|
const allChecked = enabledRows.length > 0 && enabledRows.every((row) => keys.includes(row.key));
|
|
6658
6961
|
const someChecked = enabledRows.some((row) => keys.includes(row.key));
|
|
6659
|
-
return /* @__PURE__ */
|
|
6962
|
+
return /* @__PURE__ */ jsx26(
|
|
6660
6963
|
TableCheckbox,
|
|
6661
6964
|
{
|
|
6662
6965
|
label: "\u9009\u62E9\u5F53\u524D\u9875\u5168\u90E8\u884C",
|
|
@@ -6672,7 +6975,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
6672
6975
|
}
|
|
6673
6976
|
);
|
|
6674
6977
|
},
|
|
6675
|
-
render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */
|
|
6978
|
+
render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */ jsx26(
|
|
6676
6979
|
Radio2,
|
|
6677
6980
|
{
|
|
6678
6981
|
className: "sia-table__checkbox",
|
|
@@ -6683,7 +6986,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
6683
6986
|
onClick: (event) => event.stopPropagation(),
|
|
6684
6987
|
onChange: () => toggle(info.row.key, record, context)
|
|
6685
6988
|
}
|
|
6686
|
-
) : /* @__PURE__ */
|
|
6989
|
+
) : /* @__PURE__ */ jsx26(
|
|
6687
6990
|
TableCheckbox,
|
|
6688
6991
|
{
|
|
6689
6992
|
label: `\u9009\u62E9\u7B2C ${info.rowIndex + 1} \u884C`,
|
|
@@ -6723,8 +7026,8 @@ function createSelectionPlugin(options = {}) {
|
|
|
6723
7026
|
const columns = flattenTableColumns(context.columns).filter(
|
|
6724
7027
|
(column) => !column.hidden && column.meta?.plugin !== "selection"
|
|
6725
7028
|
).slice(0, Math.max(1, options.selectionPanelColumnCount ?? 4));
|
|
6726
|
-
return /* @__PURE__ */
|
|
6727
|
-
/* @__PURE__ */
|
|
7029
|
+
return /* @__PURE__ */ jsxs23("span", { className: "sia-table__selection-footer", children: [
|
|
7030
|
+
/* @__PURE__ */ jsx26(
|
|
6728
7031
|
Popover,
|
|
6729
7032
|
{
|
|
6730
7033
|
placement: "top-start",
|
|
@@ -6732,7 +7035,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
6732
7035
|
open: context.state.panelOpen && entries.length > 0,
|
|
6733
7036
|
onOpenChange: (panelOpen) => context.setState((state) => ({ ...state, panelOpen })),
|
|
6734
7037
|
overlayClassName: "sia-table-selection-popover",
|
|
6735
|
-
content: /* @__PURE__ */
|
|
7038
|
+
content: /* @__PURE__ */ jsx26(
|
|
6736
7039
|
TableSelectedItemsPanel,
|
|
6737
7040
|
{
|
|
6738
7041
|
entries,
|
|
@@ -6748,7 +7051,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
6748
7051
|
onClear: () => setKeys([], context)
|
|
6749
7052
|
}
|
|
6750
7053
|
),
|
|
6751
|
-
children: /* @__PURE__ */
|
|
7054
|
+
children: /* @__PURE__ */ jsxs23(
|
|
6752
7055
|
Button,
|
|
6753
7056
|
{
|
|
6754
7057
|
className: "sia-table__selected-trigger",
|
|
@@ -6764,7 +7067,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
6764
7067
|
)
|
|
6765
7068
|
}
|
|
6766
7069
|
),
|
|
6767
|
-
mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */
|
|
7070
|
+
mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */ jsx26(
|
|
6768
7071
|
Checkbox,
|
|
6769
7072
|
{
|
|
6770
7073
|
checked: preserving(context),
|
|
@@ -6821,9 +7124,9 @@ function createSortPlugin(options = {}) {
|
|
|
6821
7124
|
const info = current(context);
|
|
6822
7125
|
const order = info?.field === field ? info.order : null;
|
|
6823
7126
|
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"}`;
|
|
6824
|
-
return /* @__PURE__ */
|
|
6825
|
-
/* @__PURE__ */
|
|
6826
|
-
/* @__PURE__ */
|
|
7127
|
+
return /* @__PURE__ */ jsxs23("span", { className: "sia-table__sortable-header", children: [
|
|
7128
|
+
/* @__PURE__ */ jsx26("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
|
|
7129
|
+
/* @__PURE__ */ jsx26(
|
|
6827
7130
|
"button",
|
|
6828
7131
|
{
|
|
6829
7132
|
type: "button",
|
|
@@ -6835,9 +7138,9 @@ function createSortPlugin(options = {}) {
|
|
|
6835
7138
|
event.stopPropagation();
|
|
6836
7139
|
cycle(field, context);
|
|
6837
7140
|
},
|
|
6838
|
-
children: order ? /* @__PURE__ */
|
|
6839
|
-
/* @__PURE__ */
|
|
6840
|
-
/* @__PURE__ */
|
|
7141
|
+
children: order ? /* @__PURE__ */ jsx26(Icon, { name: order === "ascend" ? "chevron-up" : "chevron-down", size: 18 }) : /* @__PURE__ */ jsxs23(Fragment8, { children: [
|
|
7142
|
+
/* @__PURE__ */ jsx26(Icon, { name: "chevron-up", size: 11 }),
|
|
7143
|
+
/* @__PURE__ */ jsx26(Icon, { name: "chevron-down", size: 11 })
|
|
6841
7144
|
] })
|
|
6842
7145
|
}
|
|
6843
7146
|
)
|
|
@@ -6872,8 +7175,8 @@ function TableFilterControl({
|
|
|
6872
7175
|
placeholder,
|
|
6873
7176
|
onApply
|
|
6874
7177
|
}) {
|
|
6875
|
-
const [open, setOpen] =
|
|
6876
|
-
const [draft, setDraft] =
|
|
7178
|
+
const [open, setOpen] = useState22(false);
|
|
7179
|
+
const [draft, setDraft] = useState22(value);
|
|
6877
7180
|
const label = getColumnLabel(column);
|
|
6878
7181
|
useEffect14(() => {
|
|
6879
7182
|
if (open) setDraft(value);
|
|
@@ -6882,17 +7185,17 @@ function TableFilterControl({
|
|
|
6882
7185
|
onApply(nextValue.trim());
|
|
6883
7186
|
setOpen(false);
|
|
6884
7187
|
};
|
|
6885
|
-
return /* @__PURE__ */
|
|
6886
|
-
/* @__PURE__ */
|
|
6887
|
-
/* @__PURE__ */
|
|
7188
|
+
return /* @__PURE__ */ jsxs23("span", { className: "sia-table__filter-header", children: [
|
|
7189
|
+
/* @__PURE__ */ jsx26("span", { children: column.title ?? column.name ?? column.key }),
|
|
7190
|
+
/* @__PURE__ */ jsx26(
|
|
6888
7191
|
Popover,
|
|
6889
7192
|
{
|
|
6890
7193
|
open,
|
|
6891
7194
|
onOpenChange: setOpen,
|
|
6892
7195
|
placement: "bottom-end",
|
|
6893
7196
|
overlayClassName: "sia-table-filter-popover",
|
|
6894
|
-
content: /* @__PURE__ */
|
|
6895
|
-
/* @__PURE__ */
|
|
7197
|
+
content: /* @__PURE__ */ jsxs23("div", { className: "sia-table-filter-panel", children: [
|
|
7198
|
+
/* @__PURE__ */ jsx26(
|
|
6896
7199
|
Input,
|
|
6897
7200
|
{
|
|
6898
7201
|
size: "small",
|
|
@@ -6906,8 +7209,8 @@ function TableFilterControl({
|
|
|
6906
7209
|
}
|
|
6907
7210
|
}
|
|
6908
7211
|
),
|
|
6909
|
-
/* @__PURE__ */
|
|
6910
|
-
/* @__PURE__ */
|
|
7212
|
+
/* @__PURE__ */ jsxs23("div", { className: "sia-table-filter-panel__actions", children: [
|
|
7213
|
+
/* @__PURE__ */ jsx26(
|
|
6911
7214
|
Button,
|
|
6912
7215
|
{
|
|
6913
7216
|
size: "small",
|
|
@@ -6919,7 +7222,7 @@ function TableFilterControl({
|
|
|
6919
7222
|
children: "\u6E05\u9664"
|
|
6920
7223
|
}
|
|
6921
7224
|
),
|
|
6922
|
-
/* @__PURE__ */
|
|
7225
|
+
/* @__PURE__ */ jsx26(
|
|
6923
7226
|
Button,
|
|
6924
7227
|
{
|
|
6925
7228
|
size: "small",
|
|
@@ -6930,7 +7233,7 @@ function TableFilterControl({
|
|
|
6930
7233
|
)
|
|
6931
7234
|
] })
|
|
6932
7235
|
] }),
|
|
6933
|
-
children: /* @__PURE__ */
|
|
7236
|
+
children: /* @__PURE__ */ jsx26(
|
|
6934
7237
|
"button",
|
|
6935
7238
|
{
|
|
6936
7239
|
type: "button",
|
|
@@ -6938,7 +7241,7 @@ function TableFilterControl({
|
|
|
6938
7241
|
"aria-label": `\u7B5B\u9009${label}`,
|
|
6939
7242
|
"aria-pressed": Boolean(value),
|
|
6940
7243
|
onClick: (event) => event.stopPropagation(),
|
|
6941
|
-
children: /* @__PURE__ */
|
|
7244
|
+
children: /* @__PURE__ */ jsx26(Icon, { name: "search", size: 13 })
|
|
6942
7245
|
}
|
|
6943
7246
|
)
|
|
6944
7247
|
}
|
|
@@ -7000,7 +7303,7 @@ function createFilterPlugin(options = {}) {
|
|
|
7000
7303
|
title: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title
|
|
7001
7304
|
};
|
|
7002
7305
|
const placeholder = typeof options.placeholder === "function" ? options.placeholder(currentColumn) : options.placeholder ?? `\u8F93\u5165${getColumnLabel(currentColumn)}\u7B5B\u9009`;
|
|
7003
|
-
return /* @__PURE__ */
|
|
7306
|
+
return /* @__PURE__ */ jsx26(
|
|
7004
7307
|
TableFilterControl,
|
|
7005
7308
|
{
|
|
7006
7309
|
column: renderedColumn,
|
|
@@ -7089,7 +7392,7 @@ function createPaginationPlugin(options = {}) {
|
|
|
7089
7392
|
const page = currentPage(context);
|
|
7090
7393
|
const filteredCount = context.getPluginApi("filter")?.getFilteredRows().length;
|
|
7091
7394
|
const totalRecords = options.totalCount ?? filteredCount ?? context.sourceData.length;
|
|
7092
|
-
return /* @__PURE__ */
|
|
7395
|
+
return /* @__PURE__ */ jsx26(
|
|
7093
7396
|
Pagination,
|
|
7094
7397
|
{
|
|
7095
7398
|
className: "sia-table__pagination",
|
|
@@ -7227,19 +7530,19 @@ function createTreePlugin(options = {}) {
|
|
|
7227
7530
|
return {
|
|
7228
7531
|
...column,
|
|
7229
7532
|
...options.showLine ? { ellipsis: false, meta: { ...column.meta, treeLines: true } } : {},
|
|
7230
|
-
render: (value, record, index, info) => /* @__PURE__ */
|
|
7533
|
+
render: (value, record, index, info) => /* @__PURE__ */ jsxs23(
|
|
7231
7534
|
"span",
|
|
7232
7535
|
{
|
|
7233
7536
|
className: `sia-table__tree-cell${options.showLine ? " sia-table__tree-cell--lines" : ""}`,
|
|
7234
7537
|
style: options.showLine ? void 0 : { paddingLeft: info.row.depth * 18 },
|
|
7235
7538
|
children: [
|
|
7236
|
-
options.showLine && info.row.depth > 0 && /* @__PURE__ */
|
|
7237
|
-
info.row.meta.treeGuides.map((continued, level) => /* @__PURE__ */
|
|
7238
|
-
/* @__PURE__ */
|
|
7539
|
+
options.showLine && info.row.depth > 0 && /* @__PURE__ */ jsxs23(Fragment8, { children: [
|
|
7540
|
+
info.row.meta.treeGuides.map((continued, level) => /* @__PURE__ */ jsx26("span", { "aria-hidden": "true", className: `sia-table__tree-guide${continued ? " sia-table__tree-guide--continued" : ""}` }, level)),
|
|
7541
|
+
/* @__PURE__ */ jsx26("span", { "aria-hidden": "true", className: `sia-table__tree-guide sia-table__tree-guide--branch${info.row.meta.treeHasNextSibling ? " sia-table__tree-guide--continued" : ""}` })
|
|
7239
7542
|
] }),
|
|
7240
|
-
/* @__PURE__ */
|
|
7241
|
-
options.showLine && !!info.row.meta.treeHasChildren && current(context).includes(info.row.key) && /* @__PURE__ */
|
|
7242
|
-
info.row.meta.treeHasChildren ? /* @__PURE__ */
|
|
7543
|
+
/* @__PURE__ */ jsxs23("span", { className: options.showLine ? "sia-table__tree-node" : void 0, style: options.showLine ? void 0 : { display: "contents" }, children: [
|
|
7544
|
+
options.showLine && !!info.row.meta.treeHasChildren && current(context).includes(info.row.key) && /* @__PURE__ */ jsx26("span", { "aria-hidden": "true", className: "sia-table__tree-stem" }),
|
|
7545
|
+
info.row.meta.treeHasChildren ? /* @__PURE__ */ jsx26(
|
|
7243
7546
|
"button",
|
|
7244
7547
|
{
|
|
7245
7548
|
type: "button",
|
|
@@ -7250,7 +7553,7 @@ function createTreePlugin(options = {}) {
|
|
|
7250
7553
|
event.stopPropagation();
|
|
7251
7554
|
toggle(info.row.key, context);
|
|
7252
7555
|
},
|
|
7253
|
-
children: /* @__PURE__ */
|
|
7556
|
+
children: /* @__PURE__ */ jsx26(
|
|
7254
7557
|
Icon,
|
|
7255
7558
|
{
|
|
7256
7559
|
name: current(context).includes(info.row.key) ? "chevron-down" : "chevron-right",
|
|
@@ -7258,7 +7561,7 @@ function createTreePlugin(options = {}) {
|
|
|
7258
7561
|
}
|
|
7259
7562
|
)
|
|
7260
7563
|
}
|
|
7261
|
-
) : /* @__PURE__ */
|
|
7564
|
+
) : /* @__PURE__ */ jsx26("span", { className: "sia-table__tree-placeholder" })
|
|
7262
7565
|
] }),
|
|
7263
7566
|
previousRender ? previousRender(value, record, index, info) : value
|
|
7264
7567
|
]
|
|
@@ -7314,13 +7617,13 @@ function EditableTableCell({
|
|
|
7314
7617
|
showEditIcon
|
|
7315
7618
|
}) {
|
|
7316
7619
|
const config = typeof editable === "object" ? editable : { type: "input" };
|
|
7317
|
-
const [editValue, setEditValue] =
|
|
7318
|
-
const [saving, setSaving] =
|
|
7319
|
-
const inputRef =
|
|
7320
|
-
const editorRef =
|
|
7321
|
-
const editValueRef =
|
|
7322
|
-
const savingRef =
|
|
7323
|
-
const saveRef =
|
|
7620
|
+
const [editValue, setEditValue] = useState22(value);
|
|
7621
|
+
const [saving, setSaving] = useState22(false);
|
|
7622
|
+
const inputRef = useRef21(null);
|
|
7623
|
+
const editorRef = useRef21(null);
|
|
7624
|
+
const editValueRef = useRef21(value);
|
|
7625
|
+
const savingRef = useRef21(false);
|
|
7626
|
+
const saveRef = useRef21(
|
|
7324
7627
|
async () => {
|
|
7325
7628
|
}
|
|
7326
7629
|
);
|
|
@@ -7371,15 +7674,15 @@ function EditableTableCell({
|
|
|
7371
7674
|
);
|
|
7372
7675
|
}, [active, config.type]);
|
|
7373
7676
|
if (!active)
|
|
7374
|
-
return /* @__PURE__ */
|
|
7677
|
+
return /* @__PURE__ */ jsxs23(
|
|
7375
7678
|
"div",
|
|
7376
7679
|
{
|
|
7377
7680
|
className: "sia-table__editable-display",
|
|
7378
7681
|
onClick: trigger === "click" ? onStart : void 0,
|
|
7379
7682
|
onDoubleClick: trigger === "doubleClick" ? onStart : void 0,
|
|
7380
7683
|
children: [
|
|
7381
|
-
/* @__PURE__ */
|
|
7382
|
-
showEditIcon && /* @__PURE__ */
|
|
7684
|
+
/* @__PURE__ */ jsx26("span", { children: content }),
|
|
7685
|
+
showEditIcon && /* @__PURE__ */ jsx26(Icon, { name: "edit", size: 13 })
|
|
7383
7686
|
]
|
|
7384
7687
|
}
|
|
7385
7688
|
);
|
|
@@ -7387,7 +7690,7 @@ function EditableTableCell({
|
|
|
7387
7690
|
if (config.type === "custom" && config.editRender) {
|
|
7388
7691
|
editor = config.editRender(record, (next) => void save(next), onCancel);
|
|
7389
7692
|
} else if (config.type === "inputNumber") {
|
|
7390
|
-
editor = /* @__PURE__ */
|
|
7693
|
+
editor = /* @__PURE__ */ jsx26(
|
|
7391
7694
|
InputNumber,
|
|
7392
7695
|
{
|
|
7393
7696
|
ref: inputRef,
|
|
@@ -7408,7 +7711,7 @@ function EditableTableCell({
|
|
|
7408
7711
|
}
|
|
7409
7712
|
);
|
|
7410
7713
|
} else if (config.type === "select") {
|
|
7411
|
-
editor = /* @__PURE__ */
|
|
7714
|
+
editor = /* @__PURE__ */ jsx26(
|
|
7412
7715
|
Select,
|
|
7413
7716
|
{
|
|
7414
7717
|
size: "small",
|
|
@@ -7422,14 +7725,14 @@ function EditableTableCell({
|
|
|
7422
7725
|
}
|
|
7423
7726
|
);
|
|
7424
7727
|
} else {
|
|
7425
|
-
editor = /* @__PURE__ */
|
|
7728
|
+
editor = /* @__PURE__ */ jsx26(
|
|
7426
7729
|
Input,
|
|
7427
7730
|
{
|
|
7428
7731
|
ref: inputRef,
|
|
7429
7732
|
size: "small",
|
|
7430
7733
|
value: String(editValue ?? ""),
|
|
7431
7734
|
disabled: saving,
|
|
7432
|
-
suffix: saving ? /* @__PURE__ */
|
|
7735
|
+
suffix: saving ? /* @__PURE__ */ jsx26(Icon, { name: "loader", size: 13, spin: true }) : null,
|
|
7433
7736
|
onChange: (event) => updateEditValue(event.target.value),
|
|
7434
7737
|
onBlur: () => void save(),
|
|
7435
7738
|
onKeyDown: (event) => {
|
|
@@ -7439,7 +7742,7 @@ function EditableTableCell({
|
|
|
7439
7742
|
}
|
|
7440
7743
|
);
|
|
7441
7744
|
}
|
|
7442
|
-
return /* @__PURE__ */
|
|
7745
|
+
return /* @__PURE__ */ jsx26("div", { ref: editorRef, className: "sia-table__editor", children: editor });
|
|
7443
7746
|
}
|
|
7444
7747
|
function createEditablePlugin(options = {}) {
|
|
7445
7748
|
const trigger = options.trigger ?? "click";
|
|
@@ -7459,7 +7762,7 @@ function createEditablePlugin(options = {}) {
|
|
|
7459
7762
|
const active = canEdit && context.state.editing?.rowKey === info.row.key && context.state.editing.columnKey === column.key;
|
|
7460
7763
|
const content = previousRender ? previousRender(value, record, index, info) : value;
|
|
7461
7764
|
if (!canEdit) return content;
|
|
7462
|
-
return /* @__PURE__ */
|
|
7765
|
+
return /* @__PURE__ */ jsx26(
|
|
7463
7766
|
EditableTableCell,
|
|
7464
7767
|
{
|
|
7465
7768
|
active,
|
|
@@ -7523,9 +7826,9 @@ function createResizePlugin(options = {}) {
|
|
|
7523
7826
|
...column,
|
|
7524
7827
|
autoWidth,
|
|
7525
7828
|
width,
|
|
7526
|
-
renderHeader: (currentColumn, coreContext) => /* @__PURE__ */
|
|
7527
|
-
/* @__PURE__ */
|
|
7528
|
-
/* @__PURE__ */
|
|
7829
|
+
renderHeader: (currentColumn, coreContext) => /* @__PURE__ */ jsxs23("span", { className: "sia-table__resizable-header", children: [
|
|
7830
|
+
/* @__PURE__ */ jsx26("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
|
|
7831
|
+
/* @__PURE__ */ jsx26(
|
|
7529
7832
|
"span",
|
|
7530
7833
|
{
|
|
7531
7834
|
className: "sia-table__resize-handle",
|
|
@@ -7661,10 +7964,10 @@ function ColumnSettingPanel({
|
|
|
7661
7964
|
onClose,
|
|
7662
7965
|
onApply
|
|
7663
7966
|
}) {
|
|
7664
|
-
const [draft, setDraft] =
|
|
7665
|
-
const listRef =
|
|
7666
|
-
const cancelDrag =
|
|
7667
|
-
const [preview, setPreview] =
|
|
7967
|
+
const [draft, setDraft] = useState22(items);
|
|
7968
|
+
const listRef = useRef21(null);
|
|
7969
|
+
const cancelDrag = useRef21(null);
|
|
7970
|
+
const [preview, setPreview] = useState22(null);
|
|
7668
7971
|
useEffect14(() => {
|
|
7669
7972
|
cancelDrag.current?.();
|
|
7670
7973
|
if (open) setDraft(orderColumnSettings(items));
|
|
@@ -7796,7 +8099,7 @@ function ColumnSettingPanel({
|
|
|
7796
8099
|
window.addEventListener("blur", cancel);
|
|
7797
8100
|
frame = requestAnimationFrame(tick);
|
|
7798
8101
|
}
|
|
7799
|
-
return /* @__PURE__ */
|
|
8102
|
+
return /* @__PURE__ */ jsxs23(
|
|
7800
8103
|
Drawer2,
|
|
7801
8104
|
{
|
|
7802
8105
|
open,
|
|
@@ -7805,9 +8108,9 @@ function ColumnSettingPanel({
|
|
|
7805
8108
|
onOpenChange: (next) => {
|
|
7806
8109
|
if (!next) onClose();
|
|
7807
8110
|
},
|
|
7808
|
-
footer: /* @__PURE__ */
|
|
7809
|
-
/* @__PURE__ */
|
|
7810
|
-
/* @__PURE__ */
|
|
8111
|
+
footer: /* @__PURE__ */ jsxs23(Fragment8, { children: [
|
|
8112
|
+
/* @__PURE__ */ jsx26(Button, { onClick: onClose, children: "\u53D6\u6D88" }),
|
|
8113
|
+
/* @__PURE__ */ jsx26(
|
|
7811
8114
|
Button,
|
|
7812
8115
|
{
|
|
7813
8116
|
variant: "primary",
|
|
@@ -7818,19 +8121,19 @@ function ColumnSettingPanel({
|
|
|
7818
8121
|
)
|
|
7819
8122
|
] }),
|
|
7820
8123
|
children: [
|
|
7821
|
-
loadError ? /* @__PURE__ */
|
|
8124
|
+
loadError ? /* @__PURE__ */ jsxs23("p", { role: "alert", children: [
|
|
7822
8125
|
"\u8BFB\u53D6\u5217\u914D\u7F6E\u5931\u8D25\u3002",
|
|
7823
|
-
/* @__PURE__ */
|
|
8126
|
+
/* @__PURE__ */ jsx26(Button, { variant: "link", onClick: onRetry, children: "\u91CD\u8BD5" })
|
|
7824
8127
|
] }) : null,
|
|
7825
|
-
/* @__PURE__ */
|
|
8128
|
+
/* @__PURE__ */ jsx26(Spin, { spinning: Boolean(loading), className: "sia-table-settings__loading", "aria-label": loading ? "\u6B63\u5728\u8BFB\u53D6\u5217\u914D\u7F6E" : void 0, children: /* @__PURE__ */ jsxs23(
|
|
7826
8129
|
"fieldset",
|
|
7827
8130
|
{
|
|
7828
8131
|
disabled: loading || loadError,
|
|
7829
8132
|
style: { border: 0, padding: 0, margin: 0, minWidth: 0 },
|
|
7830
8133
|
"aria-busy": loading,
|
|
7831
8134
|
children: [
|
|
7832
|
-
/* @__PURE__ */
|
|
7833
|
-
/* @__PURE__ */
|
|
8135
|
+
/* @__PURE__ */ jsxs23("label", { className: "sia-table-settings__all", children: [
|
|
8136
|
+
/* @__PURE__ */ jsx26(
|
|
7834
8137
|
TableCheckbox,
|
|
7835
8138
|
{
|
|
7836
8139
|
label: "\u5168\u9009\u5217",
|
|
@@ -7841,7 +8144,7 @@ function ColumnSettingPanel({
|
|
|
7841
8144
|
)
|
|
7842
8145
|
}
|
|
7843
8146
|
),
|
|
7844
|
-
/* @__PURE__ */
|
|
8147
|
+
/* @__PURE__ */ jsxs23("span", { children: [
|
|
7845
8148
|
"\u5168\u9009\uFF08",
|
|
7846
8149
|
visibleCount,
|
|
7847
8150
|
"/",
|
|
@@ -7849,12 +8152,12 @@ function ColumnSettingPanel({
|
|
|
7849
8152
|
"\uFF09"
|
|
7850
8153
|
] })
|
|
7851
8154
|
] }),
|
|
7852
|
-
/* @__PURE__ */
|
|
8155
|
+
/* @__PURE__ */ jsx26(
|
|
7853
8156
|
"div",
|
|
7854
8157
|
{
|
|
7855
8158
|
ref: listRef,
|
|
7856
8159
|
className: `sia-table-settings__list${preview ? " is-sorting" : ""}`,
|
|
7857
|
-
children: draft.map((item) => /* @__PURE__ */
|
|
8160
|
+
children: draft.map((item) => /* @__PURE__ */ jsxs23(
|
|
7858
8161
|
"div",
|
|
7859
8162
|
{
|
|
7860
8163
|
"data-column-key": item.key,
|
|
@@ -7864,8 +8167,8 @@ function ColumnSettingPanel({
|
|
|
7864
8167
|
} : void 0,
|
|
7865
8168
|
onPointerDown: (event) => startSort(event, item.key),
|
|
7866
8169
|
children: [
|
|
7867
|
-
/* @__PURE__ */
|
|
7868
|
-
/* @__PURE__ */
|
|
8170
|
+
/* @__PURE__ */ jsx26(Icon, { name: "menu", size: 15 }),
|
|
8171
|
+
/* @__PURE__ */ jsx26(
|
|
7869
8172
|
TableCheckbox,
|
|
7870
8173
|
{
|
|
7871
8174
|
label: `\u663E\u793A${labels.get(item.key) ?? item.key}\u5217`,
|
|
@@ -7877,15 +8180,15 @@ function ColumnSettingPanel({
|
|
|
7877
8180
|
)
|
|
7878
8181
|
}
|
|
7879
8182
|
),
|
|
7880
|
-
/* @__PURE__ */
|
|
8183
|
+
/* @__PURE__ */ jsx26(
|
|
7881
8184
|
"span",
|
|
7882
8185
|
{
|
|
7883
8186
|
className: "sia-table-settings__name",
|
|
7884
8187
|
children: labels.get(item.key) ?? item.key
|
|
7885
8188
|
}
|
|
7886
8189
|
),
|
|
7887
|
-
/* @__PURE__ */
|
|
7888
|
-
/* @__PURE__ */
|
|
8190
|
+
/* @__PURE__ */ jsxs23("div", { className: "sia-table-settings__actions", children: [
|
|
8191
|
+
/* @__PURE__ */ jsx26(
|
|
7889
8192
|
Button,
|
|
7890
8193
|
{
|
|
7891
8194
|
size: "small",
|
|
@@ -7898,7 +8201,7 @@ function ColumnSettingPanel({
|
|
|
7898
8201
|
children: "\u5DE6"
|
|
7899
8202
|
}
|
|
7900
8203
|
),
|
|
7901
|
-
/* @__PURE__ */
|
|
8204
|
+
/* @__PURE__ */ jsx26(
|
|
7902
8205
|
Button,
|
|
7903
8206
|
{
|
|
7904
8207
|
size: "small",
|
|
@@ -8048,7 +8351,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8048
8351
|
{
|
|
8049
8352
|
key: "builtin:export",
|
|
8050
8353
|
label: "\u8868\u683C\u5BFC\u51FA",
|
|
8051
|
-
icon: /* @__PURE__ */
|
|
8354
|
+
icon: /* @__PURE__ */ jsx26(Icon, { name: "download", size: 18 }),
|
|
8052
8355
|
disabled: exportApi().getRows().length === 0
|
|
8053
8356
|
},
|
|
8054
8357
|
{ key: "builtin:divider", type: "divider" }
|
|
@@ -8056,7 +8359,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8056
8359
|
{
|
|
8057
8360
|
key: "builtin:columns",
|
|
8058
8361
|
label: "\u5217\u8BBE\u7F6E",
|
|
8059
|
-
icon: /* @__PURE__ */
|
|
8362
|
+
icon: /* @__PURE__ */ jsx26(Icon, { name: "settings", size: 18 })
|
|
8060
8363
|
},
|
|
8061
8364
|
...customItems.map((item) => ({
|
|
8062
8365
|
key: "custom:" + item.key,
|
|
@@ -8068,7 +8371,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8068
8371
|
disabled: item.disabled === true || typeof item.disabled === "function" && item.disabled(context)
|
|
8069
8372
|
}))
|
|
8070
8373
|
];
|
|
8071
|
-
return /* @__PURE__ */
|
|
8374
|
+
return /* @__PURE__ */ jsx26(
|
|
8072
8375
|
Dropdown,
|
|
8073
8376
|
{
|
|
8074
8377
|
disabled: options.buttonProps?.disabled || options.buttonProps?.loading,
|
|
@@ -8085,12 +8388,12 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8085
8388
|
void customItems.find((item) => "custom:" + item.key === key)?.onClick?.(context);
|
|
8086
8389
|
}
|
|
8087
8390
|
},
|
|
8088
|
-
children: /* @__PURE__ */
|
|
8391
|
+
children: /* @__PURE__ */ jsx26(
|
|
8089
8392
|
Button,
|
|
8090
8393
|
{
|
|
8091
8394
|
size: "small",
|
|
8092
8395
|
variant: "text",
|
|
8093
|
-
icon: /* @__PURE__ */
|
|
8396
|
+
icon: /* @__PURE__ */ jsx26(Icon, { name: "settings", size: 16 }),
|
|
8094
8397
|
"aria-label": "\u8868\u683C\u8BBE\u7F6E",
|
|
8095
8398
|
...options.buttonProps,
|
|
8096
8399
|
className: `sia-table__settings-button${options.buttonProps?.children == null ? " sia-table__toolbar-icon" : ""} ${options.buttonProps?.className ?? ""}`.trim()
|
|
@@ -8099,7 +8402,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8099
8402
|
}
|
|
8100
8403
|
);
|
|
8101
8404
|
},
|
|
8102
|
-
renderOverlay: (context) => /* @__PURE__ */
|
|
8405
|
+
renderOverlay: (context) => /* @__PURE__ */ jsx26(
|
|
8103
8406
|
ColumnSettingPanel,
|
|
8104
8407
|
{
|
|
8105
8408
|
open: context.state.open,
|
|
@@ -8149,11 +8452,11 @@ function ToolbarItems({
|
|
|
8149
8452
|
items,
|
|
8150
8453
|
context
|
|
8151
8454
|
}) {
|
|
8152
|
-
return /* @__PURE__ */
|
|
8455
|
+
return /* @__PURE__ */ jsx26(Fragment8, { children: items.map((item) => {
|
|
8153
8456
|
if (item.hidden === true || typeof item.hidden === "function" && item.hidden(context))
|
|
8154
8457
|
return null;
|
|
8155
8458
|
const disabled = item.disabled === true || typeof item.disabled === "function" && item.disabled(context);
|
|
8156
|
-
return /* @__PURE__ */
|
|
8459
|
+
return /* @__PURE__ */ jsx26(
|
|
8157
8460
|
Button,
|
|
8158
8461
|
{
|
|
8159
8462
|
size: "small",
|
|
@@ -8176,16 +8479,16 @@ function createToolbarPlugin(options) {
|
|
|
8176
8479
|
return {
|
|
8177
8480
|
id: "toolbar",
|
|
8178
8481
|
order: 5,
|
|
8179
|
-
renderToolbarStart: (context) => /* @__PURE__ */
|
|
8482
|
+
renderToolbarStart: (context) => /* @__PURE__ */ jsxs23(Fragment8, { children: [
|
|
8180
8483
|
options.start,
|
|
8181
|
-
/* @__PURE__ */
|
|
8484
|
+
/* @__PURE__ */ jsx26(ToolbarItems, { items: items("start"), context })
|
|
8182
8485
|
] }),
|
|
8183
|
-
renderToolbarEnd: (context) => /* @__PURE__ */
|
|
8486
|
+
renderToolbarEnd: (context) => /* @__PURE__ */ jsxs23(Fragment8, { children: [
|
|
8184
8487
|
options.end,
|
|
8185
|
-
/* @__PURE__ */
|
|
8186
|
-
items("end", true).length > 0 ? /* @__PURE__ */
|
|
8187
|
-
/* @__PURE__ */
|
|
8188
|
-
/* @__PURE__ */
|
|
8488
|
+
/* @__PURE__ */ jsx26(ToolbarItems, { items: items("end"), context }),
|
|
8489
|
+
items("end", true).length > 0 ? /* @__PURE__ */ jsxs23("details", { className: "sia-table__toolbar-menu", children: [
|
|
8490
|
+
/* @__PURE__ */ jsx26("summary", { "aria-label": "\u66F4\u591A\u8868\u683C\u64CD\u4F5C", children: /* @__PURE__ */ jsx26(Icon, { name: "more-horizontal", size: 16 }) }),
|
|
8491
|
+
/* @__PURE__ */ jsx26("div", { children: /* @__PURE__ */ jsx26(ToolbarItems, { items: items("end", true), context }) })
|
|
8189
8492
|
] }) : null
|
|
8190
8493
|
] })
|
|
8191
8494
|
};
|
|
@@ -8267,11 +8570,11 @@ function createExportPlugin(options = {}) {
|
|
|
8267
8570
|
return {
|
|
8268
8571
|
id: "export",
|
|
8269
8572
|
order: 95,
|
|
8270
|
-
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */
|
|
8573
|
+
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */ jsx26(
|
|
8271
8574
|
Button,
|
|
8272
8575
|
{
|
|
8273
8576
|
size: "small",
|
|
8274
|
-
icon: /* @__PURE__ */
|
|
8577
|
+
icon: /* @__PURE__ */ jsx26(Icon, { name: "download", size: 14 }),
|
|
8275
8578
|
disabled: getRows(context).length === 0,
|
|
8276
8579
|
onClick: () => void download(context),
|
|
8277
8580
|
children: options.buttonLabel ?? "\u5BFC\u51FA"
|
|
@@ -8286,7 +8589,7 @@ function createExportPlugin(options = {}) {
|
|
|
8286
8589
|
}
|
|
8287
8590
|
|
|
8288
8591
|
// src/components/Table/Table.tsx
|
|
8289
|
-
import { jsx as
|
|
8592
|
+
import { jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
8290
8593
|
var EMPTY_DATA = [];
|
|
8291
8594
|
var EMPTY_COLUMNS = [];
|
|
8292
8595
|
var EMPTY_PLUGINS = [];
|
|
@@ -8400,7 +8703,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8400
8703
|
onCellPointerDown,
|
|
8401
8704
|
onCellPointerMove
|
|
8402
8705
|
}) {
|
|
8403
|
-
return /* @__PURE__ */
|
|
8706
|
+
return /* @__PURE__ */ jsx27(
|
|
8404
8707
|
"tr",
|
|
8405
8708
|
{
|
|
8406
8709
|
"data-row-key": String(row.key),
|
|
@@ -8416,7 +8719,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8416
8719
|
if (columnIndex > 0 && !visibleColumns.has(columns[columnIndex - 1].key)) return null;
|
|
8417
8720
|
let count = 1;
|
|
8418
8721
|
while (columnIndex + count < columns.length && !visibleColumns.has(columns[columnIndex + count].key)) count++;
|
|
8419
|
-
return /* @__PURE__ */
|
|
8722
|
+
return /* @__PURE__ */ jsx27("td", { colSpan: count, "aria-hidden": "true", style: { padding: 0 } }, `spacer-${column.key}`);
|
|
8420
8723
|
}
|
|
8421
8724
|
const pluginCellProps = getCellProps(column);
|
|
8422
8725
|
if (pluginCellProps.hidden) return null;
|
|
@@ -8427,7 +8730,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8427
8730
|
const fixedStyle = fixed === "left" ? { left: leftOffsets.get(column.key) } : fixed === "right" ? { right: rightOffsets.get(column.key) } : void 0;
|
|
8428
8731
|
const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
8429
8732
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
8430
|
-
return /* @__PURE__ */
|
|
8733
|
+
return /* @__PURE__ */ jsx27(
|
|
8431
8734
|
"td",
|
|
8432
8735
|
{
|
|
8433
8736
|
"data-column-key": column.key,
|
|
@@ -8444,7 +8747,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8444
8747
|
onContextMenu: (event) => onCellContextMenu(column, event),
|
|
8445
8748
|
onPointerDown: (event) => onCellPointerDown(column, event),
|
|
8446
8749
|
onPointerMove: (event) => onCellPointerMove(column, event),
|
|
8447
|
-
children: !canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? /* @__PURE__ */
|
|
8750
|
+
children: !canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? /* @__PURE__ */ jsx27(
|
|
8448
8751
|
TableCellContent,
|
|
8449
8752
|
{
|
|
8450
8753
|
ellipsis: column.ellipsis !== false,
|
|
@@ -8496,25 +8799,25 @@ function TableInner(props, ref) {
|
|
|
8496
8799
|
style,
|
|
8497
8800
|
...htmlProps
|
|
8498
8801
|
} = props;
|
|
8499
|
-
const rootRef =
|
|
8802
|
+
const rootRef = useRef22(null);
|
|
8500
8803
|
const remainingHeight = useRemainingHeight(rootRef, height == null && tableHeight == null ? fillRemaining : false);
|
|
8501
|
-
const scrollRef =
|
|
8502
|
-
const cellFocusRequest =
|
|
8503
|
-
const cellGlow =
|
|
8804
|
+
const scrollRef = useRef22(null);
|
|
8805
|
+
const cellFocusRequest = useRef22(0);
|
|
8806
|
+
const cellGlow = useRef22(null);
|
|
8504
8807
|
useEffect15(() => () => {
|
|
8505
8808
|
cellFocusRequest.current++;
|
|
8506
8809
|
cellGlow.current?.();
|
|
8507
8810
|
}, []);
|
|
8508
|
-
const tableRef =
|
|
8811
|
+
const tableRef = useRef22(null);
|
|
8509
8812
|
useScrollbarProximity();
|
|
8510
|
-
const scrollbarDragRef =
|
|
8511
|
-
const [internalLoading, setInternalLoading] =
|
|
8512
|
-
const [scrollTop, setScrollTop] =
|
|
8513
|
-
const [scrollLeft, setScrollLeft] =
|
|
8514
|
-
const [viewportHeight, setViewportHeight] =
|
|
8515
|
-
const [viewportWidth, setViewportWidth] =
|
|
8516
|
-
const [autoColumnWidths, setAutoColumnWidths] =
|
|
8517
|
-
const [resolveRowIdentity] =
|
|
8813
|
+
const scrollbarDragRef = useRef22(null);
|
|
8814
|
+
const [internalLoading, setInternalLoading] = useState23(false);
|
|
8815
|
+
const [scrollTop, setScrollTop] = useState23(0);
|
|
8816
|
+
const [scrollLeft, setScrollLeft] = useState23(0);
|
|
8817
|
+
const [viewportHeight, setViewportHeight] = useState23(420);
|
|
8818
|
+
const [viewportWidth, setViewportWidth] = useState23(0);
|
|
8819
|
+
const [autoColumnWidths, setAutoColumnWidths] = useState23({});
|
|
8820
|
+
const [resolveRowIdentity] = useState23(createRowIdentity);
|
|
8518
8821
|
const getRowKey = useCallback2((record, index) => resolveRowIdentity(record, index, typeof rowKey === "function" ? rowKey : rowKey == null ? void 0 : String(rowKey)), [rowKey, resolveRowIdentity]);
|
|
8519
8822
|
const builtInResizePlugin = useMemo9(() => createResizePlugin(), []);
|
|
8520
8823
|
const builtInHighlightPlugin = useMemo9(() => createHighlightPlugin(), []);
|
|
@@ -8529,14 +8832,14 @@ function TableInner(props, ref) {
|
|
|
8529
8832
|
return plugins;
|
|
8530
8833
|
}, [builtInHighlightPlugin, builtInResizePlugin, builtInCellSelectionPlugin, builtInIndexPlugin, providedPlugins, resizable, cellSelection, showIndex]);
|
|
8531
8834
|
const sortedPlugins = useMemo9(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
|
|
8532
|
-
const pluginsByIdRef =
|
|
8835
|
+
const pluginsByIdRef = useRef22(/* @__PURE__ */ new Map());
|
|
8533
8836
|
pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
8534
|
-
const [pluginStates, setPluginStates] =
|
|
8837
|
+
const [pluginStates, setPluginStates] = useState23(() => Object.fromEntries(
|
|
8535
8838
|
sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
|
|
8536
8839
|
));
|
|
8537
|
-
const pluginApisRef =
|
|
8538
|
-
const contextsRef =
|
|
8539
|
-
const mountedPluginsRef =
|
|
8840
|
+
const pluginApisRef = useRef22({});
|
|
8841
|
+
const contextsRef = useRef22(/* @__PURE__ */ new Map());
|
|
8842
|
+
const mountedPluginsRef = useRef22(/* @__PURE__ */ new Map());
|
|
8540
8843
|
const pipeline = { columns: baseColumns, rows: createTableRows(dataSource, getRowKey) };
|
|
8541
8844
|
const nextApis = {};
|
|
8542
8845
|
const contexts = /* @__PURE__ */ new Map();
|
|
@@ -8668,7 +8971,7 @@ function TableInner(props, ref) {
|
|
|
8668
8971
|
const orderedColumns = useMemo9(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
|
|
8669
8972
|
const leafColumns = useMemo9(() => flattenTableColumns(orderedColumns), [orderedColumns]);
|
|
8670
8973
|
const headerRows = useMemo9(() => buildHeaderRows(orderedColumns), [orderedColumns]);
|
|
8671
|
-
const measuredCells =
|
|
8974
|
+
const measuredCells = useRef22(/* @__PURE__ */ new WeakSet());
|
|
8672
8975
|
const autoWidthSignature = leafColumns.map((column) => `${column.key}:${column.autoWidth}:${resizedWidths[column.key] ?? ""}`).join("|");
|
|
8673
8976
|
useEffect15(() => {
|
|
8674
8977
|
measuredCells.current = /* @__PURE__ */ new WeakSet();
|
|
@@ -8779,20 +9082,20 @@ function TableInner(props, ref) {
|
|
|
8779
9082
|
]);
|
|
8780
9083
|
const toolbarStart = sortedPlugins.map((plugin) => {
|
|
8781
9084
|
const content = plugin.renderToolbarStart?.(getContext(plugin));
|
|
8782
|
-
return content ? /* @__PURE__ */
|
|
9085
|
+
return content ? /* @__PURE__ */ jsx27(Fragment9, { children: content }, `toolbar-start-${plugin.id}`) : null;
|
|
8783
9086
|
}).filter(Boolean);
|
|
8784
9087
|
const toolbarEnd = sortedPlugins.map((plugin) => {
|
|
8785
9088
|
const content = plugin.renderToolbarEnd?.(getContext(plugin));
|
|
8786
|
-
return content ? /* @__PURE__ */
|
|
9089
|
+
return content ? /* @__PURE__ */ jsx27(Fragment9, { children: content }, `toolbar-end-${plugin.id}`) : null;
|
|
8787
9090
|
}).filter(Boolean);
|
|
8788
9091
|
const summaries = sortedPlugins.flatMap((plugin) => plugin.renderSummary?.(getContext(plugin)) ?? []);
|
|
8789
9092
|
const footers = sortedPlugins.map((plugin) => {
|
|
8790
9093
|
const content = plugin.renderFooter?.(getContext(plugin));
|
|
8791
|
-
return content ? /* @__PURE__ */
|
|
9094
|
+
return content ? /* @__PURE__ */ jsx27(Fragment9, { children: content }, `footer-${plugin.id}`) : null;
|
|
8792
9095
|
}).filter(Boolean);
|
|
8793
9096
|
const overlays = sortedPlugins.map((plugin) => {
|
|
8794
9097
|
const content = plugin.renderOverlay?.(getContext(plugin));
|
|
8795
|
-
return content ? /* @__PURE__ */
|
|
9098
|
+
return content ? /* @__PURE__ */ jsx27(Fragment9, { children: content }, `overlay-${plugin.id}`) : null;
|
|
8796
9099
|
}).filter(Boolean);
|
|
8797
9100
|
const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
|
|
8798
9101
|
const effectiveHeight = height ?? tableHeight ?? remainingHeight ?? (shouldVirtualize && maxBodyHeight == null ? 420 : void 0);
|
|
@@ -8969,10 +9272,10 @@ function TableInner(props, ref) {
|
|
|
8969
9272
|
}
|
|
8970
9273
|
function renderHeaderContent(column, content) {
|
|
8971
9274
|
const title = getHeaderTitleText(column.title ?? column.name) || column.name || column.key;
|
|
8972
|
-
return /* @__PURE__ */
|
|
8973
|
-
column.required && /* @__PURE__ */
|
|
8974
|
-
/* @__PURE__ */
|
|
8975
|
-
column.description != null && /* @__PURE__ */
|
|
9275
|
+
return /* @__PURE__ */ jsxs24("span", { className: `sia-table__header-label${column.required ? " sia-table__header-label--required" : ""}`, children: [
|
|
9276
|
+
column.required && /* @__PURE__ */ jsx27("span", { className: "sia-table__required-mark", "aria-hidden": "true", children: "*" }),
|
|
9277
|
+
/* @__PURE__ */ jsx27("span", { className: "sia-table__header-label-content", "data-sia-title-overflow-only": true, ...withTitleTooltip({ title }), children: content }),
|
|
9278
|
+
column.description != null && /* @__PURE__ */ jsx27(Tooltip, { title: column.description, placement: "top", trigger: ["hover", "focus"], children: /* @__PURE__ */ jsx27("button", { type: "button", className: "sia-table__header-description", "aria-label": `${column.name ?? column.key}\u5217\u8BF4\u660E`, onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx27(Icon, { name: "info", size: 14 }) }) })
|
|
8976
9279
|
] });
|
|
8977
9280
|
}
|
|
8978
9281
|
function getPluginCellProps(row, column) {
|
|
@@ -9012,17 +9315,17 @@ function TableInner(props, ref) {
|
|
|
9012
9315
|
}
|
|
9013
9316
|
function renderSummaryRow(summary) {
|
|
9014
9317
|
let labelRendered = false;
|
|
9015
|
-
return /* @__PURE__ */
|
|
9318
|
+
return /* @__PURE__ */ jsx27("tr", { className: `sia-table__summary-row ${summary.className ?? ""}`.trim(), children: leafColumns.map((column) => {
|
|
9016
9319
|
const value = summary.values[column.key];
|
|
9017
9320
|
const isLabel = value === void 0 && !labelRendered && summary.label !== void 0;
|
|
9018
9321
|
const content = value !== void 0 ? value : isLabel ? (labelRendered = true, summary.label) : null;
|
|
9019
9322
|
const fixed = normalizeFixed(column.fixed);
|
|
9020
9323
|
const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
9021
9324
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
9022
|
-
return /* @__PURE__ */
|
|
9325
|
+
return /* @__PURE__ */ jsx27("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__ */ jsx27("span", { className: "sia-table__summary-label", children: content }) : content }, column.key);
|
|
9023
9326
|
}) }, summary.key);
|
|
9024
9327
|
}
|
|
9025
|
-
return /* @__PURE__ */
|
|
9328
|
+
return /* @__PURE__ */ jsxs24(
|
|
9026
9329
|
"div",
|
|
9027
9330
|
{
|
|
9028
9331
|
ref: rootRef,
|
|
@@ -9073,19 +9376,19 @@ function TableInner(props, ref) {
|
|
|
9073
9376
|
htmlProps.onDoubleClickCapture?.(event);
|
|
9074
9377
|
},
|
|
9075
9378
|
children: [
|
|
9076
|
-
hasToolbar ? /* @__PURE__ */
|
|
9077
|
-
/* @__PURE__ */
|
|
9078
|
-
/* @__PURE__ */
|
|
9379
|
+
hasToolbar ? /* @__PURE__ */ jsxs24("div", { className: "sia-table__toolbar", children: [
|
|
9380
|
+
/* @__PURE__ */ jsx27("div", { children: toolbarStart }),
|
|
9381
|
+
/* @__PURE__ */ jsx27("div", { children: toolbarEnd })
|
|
9079
9382
|
] }) : null,
|
|
9080
|
-
/* @__PURE__ */
|
|
9081
|
-
/* @__PURE__ */
|
|
9082
|
-
/* @__PURE__ */
|
|
9083
|
-
/* @__PURE__ */
|
|
9383
|
+
/* @__PURE__ */ jsxs24("div", { className: "sia-table__viewport-wrap", style: viewportStyle, children: [
|
|
9384
|
+
/* @__PURE__ */ jsx27("div", { className: "sia-table__viewport", ref: scrollRef, onScroll: handleScroll, children: /* @__PURE__ */ jsxs24("table", { ref: tableRef, className: "sia-table__element", style: { width: Math.max(totalWidth, 1), ...manualColumnLayout ? { minWidth: 0 } : {}, ...tableStyle }, children: [
|
|
9385
|
+
/* @__PURE__ */ jsx27("colgroup", { children: leafColumns.map((column) => /* @__PURE__ */ jsx27("col", { "data-column-key": column.key, style: { width: columnWidths.get(column.key) ?? DEFAULT_WIDTH } }, column.key)) }),
|
|
9386
|
+
/* @__PURE__ */ jsx27("thead", { className: stickyHeader ? "sia-table__head sia-table__head--sticky" : "sia-table__head", children: headerRows.map((headerRow, depth) => /* @__PURE__ */ jsx27("tr", { children: headerRow.map((cell) => {
|
|
9084
9387
|
const fixed = cell.fixed;
|
|
9085
9388
|
const pluginHeaderProps = getPluginHeaderCellProps(cell.column);
|
|
9086
9389
|
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" : "";
|
|
9087
9390
|
const autoWidthClass = cell.column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
9088
|
-
return /* @__PURE__ */
|
|
9391
|
+
return /* @__PURE__ */ jsx27(
|
|
9089
9392
|
"th",
|
|
9090
9393
|
{
|
|
9091
9394
|
"data-column-key": cell.column.key,
|
|
@@ -9106,10 +9409,10 @@ function TableInner(props, ref) {
|
|
|
9106
9409
|
`${cell.column.key}-${depth}-${cell.firstLeafKey}`
|
|
9107
9410
|
);
|
|
9108
9411
|
}) }, depth)) }),
|
|
9109
|
-
/* @__PURE__ */
|
|
9110
|
-
maxBodyHeight != null && pipeline.rows.length === 0 ? /* @__PURE__ */
|
|
9111
|
-
pipeline.rows.length === 0 && summaries.length > 0 ? /* @__PURE__ */
|
|
9112
|
-
topSpacer > 0 ? /* @__PURE__ */
|
|
9412
|
+
/* @__PURE__ */ jsxs24("tbody", { children: [
|
|
9413
|
+
maxBodyHeight != null && pipeline.rows.length === 0 ? /* @__PURE__ */ jsx27("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx27("td", { colSpan: leafColumns.length, style: { height: 120, padding: 0, border: 0 } }) }) : null,
|
|
9414
|
+
pipeline.rows.length === 0 && summaries.length > 0 ? /* @__PURE__ */ jsx27("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx27("td", { colSpan: leafColumns.length, style: { height: Math.max(0, viewportHeight - (headerRows.length + summaries.length) * rowHeight), padding: 0, border: 0 } }) }) : null,
|
|
9415
|
+
topSpacer > 0 ? /* @__PURE__ */ jsx27("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx27("td", { colSpan: leafColumns.length, style: { height: topSpacer, padding: 0, border: 0 } }) }) : null,
|
|
9113
9416
|
renderedRows.map((row, offset) => {
|
|
9114
9417
|
const cached = rowElements.get(row.key);
|
|
9115
9418
|
if (cached) return cached;
|
|
@@ -9118,7 +9421,7 @@ function TableInner(props, ref) {
|
|
|
9118
9421
|
const status = typeof rowStatus === "function" ? rowStatus(row.record, row.sourceIndex) : rowStatus;
|
|
9119
9422
|
const statusClass = status ? `sia-table__row--${status}` : "";
|
|
9120
9423
|
const customClass = typeof rowClassName === "function" ? rowClassName(row.record, row.sourceIndex) : rowClassName ?? "";
|
|
9121
|
-
const element = /* @__PURE__ */
|
|
9424
|
+
const element = /* @__PURE__ */ jsx27(
|
|
9122
9425
|
TableBodyRow,
|
|
9123
9426
|
{
|
|
9124
9427
|
canvas,
|
|
@@ -9169,13 +9472,13 @@ function TableInner(props, ref) {
|
|
|
9169
9472
|
rowElements.set(row.key, element);
|
|
9170
9473
|
return element;
|
|
9171
9474
|
}),
|
|
9172
|
-
bottomSpacer > 0 ? /* @__PURE__ */
|
|
9475
|
+
bottomSpacer > 0 ? /* @__PURE__ */ jsx27("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx27("td", { colSpan: leafColumns.length, style: { height: bottomSpacer, padding: 0, border: 0 } }) }) : null
|
|
9173
9476
|
] }),
|
|
9174
|
-
summaries.length > 0 ? /* @__PURE__ */
|
|
9477
|
+
summaries.length > 0 ? /* @__PURE__ */ jsx27("tfoot", { className: "sia-table__summary", children: summaries.map(renderSummaryRow) }) : null
|
|
9175
9478
|
] }) }),
|
|
9176
|
-
pipeline.rows.length === 0 ? /* @__PURE__ */
|
|
9177
|
-
canvas ? /* @__PURE__ */
|
|
9178
|
-
/* @__PURE__ */
|
|
9479
|
+
pipeline.rows.length === 0 ? /* @__PURE__ */ jsx27("div", { className: "sia-table__empty", role: "status", children: emptyText }) : null,
|
|
9480
|
+
canvas ? /* @__PURE__ */ jsx27(TableCanvasLayer, { viewport: scrollRef, rows: pipeline.rows, columns: leafColumns, widths: columnWidths, rowHeight, headerHeight: headerRows.length * rowHeight }) : null,
|
|
9481
|
+
/* @__PURE__ */ jsx27(
|
|
9179
9482
|
"div",
|
|
9180
9483
|
{
|
|
9181
9484
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--horizontal",
|
|
@@ -9186,10 +9489,10 @@ function TableInner(props, ref) {
|
|
|
9186
9489
|
onPointerMove: handleScrollbarPointerMove,
|
|
9187
9490
|
onPointerUp: handleScrollbarPointerEnd,
|
|
9188
9491
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
9189
|
-
children: /* @__PURE__ */
|
|
9492
|
+
children: /* @__PURE__ */ jsx27("div", { className: "sia-table__scrollbar-thumb" })
|
|
9190
9493
|
}
|
|
9191
9494
|
),
|
|
9192
|
-
/* @__PURE__ */
|
|
9495
|
+
/* @__PURE__ */ jsx27(
|
|
9193
9496
|
"div",
|
|
9194
9497
|
{
|
|
9195
9498
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--vertical",
|
|
@@ -9200,21 +9503,21 @@ function TableInner(props, ref) {
|
|
|
9200
9503
|
onPointerMove: handleScrollbarPointerMove,
|
|
9201
9504
|
onPointerUp: handleScrollbarPointerEnd,
|
|
9202
9505
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
9203
|
-
children: /* @__PURE__ */
|
|
9506
|
+
children: /* @__PURE__ */ jsx27("div", { className: "sia-table__scrollbar-thumb" })
|
|
9204
9507
|
}
|
|
9205
9508
|
)
|
|
9206
9509
|
] }),
|
|
9207
|
-
footers.length > 0 ? /* @__PURE__ */
|
|
9208
|
-
loading || internalLoading ? /* @__PURE__ */
|
|
9209
|
-
/* @__PURE__ */
|
|
9210
|
-
/* @__PURE__ */
|
|
9510
|
+
footers.length > 0 ? /* @__PURE__ */ jsx27("div", { className: "sia-table__footer", children: footers }) : null,
|
|
9511
|
+
loading || internalLoading ? /* @__PURE__ */ jsxs24("div", { className: "sia-table__loading", role: "status", children: [
|
|
9512
|
+
/* @__PURE__ */ jsx27(Icon, { name: "loader", size: 22, spin: true }),
|
|
9513
|
+
/* @__PURE__ */ jsx27("span", { children: "\u52A0\u8F7D\u4E2D" })
|
|
9211
9514
|
] }) : null,
|
|
9212
9515
|
overlays
|
|
9213
9516
|
]
|
|
9214
9517
|
}
|
|
9215
9518
|
);
|
|
9216
9519
|
}
|
|
9217
|
-
var Table =
|
|
9520
|
+
var Table = forwardRef6(TableInner);
|
|
9218
9521
|
|
|
9219
9522
|
// src/components/Table/worksheetModel.ts
|
|
9220
9523
|
function parseWorksheetText(text) {
|
|
@@ -9280,7 +9583,7 @@ function incrementWorksheetValue(value, offset) {
|
|
|
9280
9583
|
}
|
|
9281
9584
|
|
|
9282
9585
|
// src/components/Table/worksheet.tsx
|
|
9283
|
-
import { Fragment as Fragment10, jsx as
|
|
9586
|
+
import { Fragment as Fragment10, jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
9284
9587
|
var isEmpty2 = (value) => value == null || value === "";
|
|
9285
9588
|
var editorKind = (column) => !column.editable ? "readonly" : typeof column.editable === "object" ? column.editable.type ?? "input" : "input";
|
|
9286
9589
|
var nativeEditor = (target) => target instanceof Element && Boolean(
|
|
@@ -9688,9 +9991,9 @@ function createWorksheetPlugin(options) {
|
|
|
9688
9991
|
const area = bounds(), cols = columns();
|
|
9689
9992
|
const handle = area && context.rows[area.bottom]?.key === info.row.key && cols[area.right]?.key === column.key && // 填充入口与编辑权限一致,避免只读格或保存锁定后仍暗示可以拖拽修改。
|
|
9690
9993
|
editable(record, column) && (suppressEditing || !context.state.editing);
|
|
9691
|
-
return /* @__PURE__ */
|
|
9994
|
+
return /* @__PURE__ */ jsxs25(Fragment10, { children: [
|
|
9692
9995
|
render ? render(value, record, index, info) : value,
|
|
9693
|
-
handle && /* @__PURE__ */
|
|
9996
|
+
handle && /* @__PURE__ */ jsx28(
|
|
9694
9997
|
"button",
|
|
9695
9998
|
{
|
|
9696
9999
|
type: "button",
|
|
@@ -9736,25 +10039,25 @@ function createWorksheetPlugin(options) {
|
|
|
9736
10039
|
},
|
|
9737
10040
|
renderToolbarStart(current) {
|
|
9738
10041
|
remember(current);
|
|
9739
|
-
return options.toolbar === false ? null : /* @__PURE__ */
|
|
9740
|
-
/* @__PURE__ */
|
|
10042
|
+
return options.toolbar === false ? null : /* @__PURE__ */ jsxs25("span", { className: "sia-table__worksheet-tools", children: [
|
|
10043
|
+
/* @__PURE__ */ jsx28(
|
|
9741
10044
|
Button,
|
|
9742
10045
|
{
|
|
9743
10046
|
variant: "text",
|
|
9744
10047
|
size: "small",
|
|
9745
|
-
icon: /* @__PURE__ */
|
|
10048
|
+
icon: /* @__PURE__ */ jsx28(Icon, { name: "undo" }),
|
|
9746
10049
|
disabled: !undoStack.length,
|
|
9747
10050
|
title: "\u64A4\u9500\uFF08Ctrl/Cmd + Z\uFF09",
|
|
9748
10051
|
onClick: api.undo,
|
|
9749
10052
|
children: "\u64A4\u9500"
|
|
9750
10053
|
}
|
|
9751
10054
|
),
|
|
9752
|
-
/* @__PURE__ */
|
|
10055
|
+
/* @__PURE__ */ jsx28(
|
|
9753
10056
|
Button,
|
|
9754
10057
|
{
|
|
9755
10058
|
variant: "text",
|
|
9756
10059
|
size: "small",
|
|
9757
|
-
icon: /* @__PURE__ */
|
|
10060
|
+
icon: /* @__PURE__ */ jsx28(Icon, { name: "redo" }),
|
|
9758
10061
|
disabled: !redoStack.length,
|
|
9759
10062
|
title: "\u6062\u590D\uFF08Ctrl/Cmd + Shift + Z \u6216 Ctrl/Cmd + Y\uFF09",
|
|
9760
10063
|
onClick: api.redo,
|
|
@@ -9765,7 +10068,7 @@ function createWorksheetPlugin(options) {
|
|
|
9765
10068
|
},
|
|
9766
10069
|
renderOverlay(current) {
|
|
9767
10070
|
remember(current);
|
|
9768
|
-
return /* @__PURE__ */
|
|
10071
|
+
return /* @__PURE__ */ jsx28(
|
|
9769
10072
|
"span",
|
|
9770
10073
|
{
|
|
9771
10074
|
hidden: true,
|
|
@@ -9851,84 +10154,9 @@ function createWorksheetPlugin(options) {
|
|
|
9851
10154
|
};
|
|
9852
10155
|
}
|
|
9853
10156
|
|
|
9854
|
-
// src/components/ThemeSwitch.tsx
|
|
9855
|
-
import { forwardRef as forwardRef6 } from "react";
|
|
9856
|
-
import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
9857
|
-
var ThemeSwitch = forwardRef6(function ThemeSwitch2({
|
|
9858
|
-
checked,
|
|
9859
|
-
onCheckedChange,
|
|
9860
|
-
lightLabel = "\u4EAE\u8272\u6A21\u5F0F",
|
|
9861
|
-
darkLabel = "\u6697\u8272\u6A21\u5F0F",
|
|
9862
|
-
className = "",
|
|
9863
|
-
onClick,
|
|
9864
|
-
...props
|
|
9865
|
-
}, ref) {
|
|
9866
|
-
function handleClick(event) {
|
|
9867
|
-
onCheckedChange?.(!checked);
|
|
9868
|
-
onClick?.(event);
|
|
9869
|
-
}
|
|
9870
|
-
return /* @__PURE__ */ jsxs25(
|
|
9871
|
-
"button",
|
|
9872
|
-
{
|
|
9873
|
-
ref,
|
|
9874
|
-
type: "button",
|
|
9875
|
-
role: "switch",
|
|
9876
|
-
"aria-checked": checked,
|
|
9877
|
-
"aria-label": checked ? darkLabel : lightLabel,
|
|
9878
|
-
className: `sia-theme-switch${checked ? " sia-theme-switch--dark" : ""} ${className}`.trim(),
|
|
9879
|
-
onClick: handleClick,
|
|
9880
|
-
...withTitleTooltip(props),
|
|
9881
|
-
children: [
|
|
9882
|
-
/* @__PURE__ */ jsx27("span", { className: "sia-theme-switch__selection", "aria-hidden": "true" }),
|
|
9883
|
-
/* @__PURE__ */ jsx27("span", { className: `sia-theme-switch__icon${checked ? "" : " is-active"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxs25("svg", { viewBox: "0 0 24 24", children: [
|
|
9884
|
-
/* @__PURE__ */ jsx27("circle", { cx: "12", cy: "12", r: "3.5" }),
|
|
9885
|
-
/* @__PURE__ */ jsx27("path", { d: "M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M18.7 5.3l-1.4 1.4M6.7 17.3l-1.4 1.4" })
|
|
9886
|
-
] }) }),
|
|
9887
|
-
/* @__PURE__ */ jsx27("span", { className: `sia-theme-switch__icon${checked ? " is-active" : ""}`, "aria-hidden": "true", children: /* @__PURE__ */ jsx27("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx27("path", { d: "M20 15.2A8 8 0 0 1 8.8 4 8.5 8.5 0 1 0 20 15.2Z" }) }) })
|
|
9888
|
-
]
|
|
9889
|
-
}
|
|
9890
|
-
);
|
|
9891
|
-
});
|
|
9892
|
-
|
|
9893
|
-
// src/theme.ts
|
|
9894
|
-
var SIA_THEME = {
|
|
9895
|
-
/** 主色。 */
|
|
9896
|
-
colorPrimary: "#1677ff",
|
|
9897
|
-
/** 主色的悬停色。 */
|
|
9898
|
-
colorPrimaryHover: "#4096ff",
|
|
9899
|
-
/** 主色的按下色。 */
|
|
9900
|
-
colorPrimaryActive: "#0958d9",
|
|
9901
|
-
/** 主要文本颜色。 */
|
|
9902
|
-
colorText: "#1f1f1f",
|
|
9903
|
-
/** 次要文本颜色。 */
|
|
9904
|
-
colorTextSecondary: "#666666",
|
|
9905
|
-
/** 页面背景颜色。 */
|
|
9906
|
-
colorBackground: "#f5f7fa",
|
|
9907
|
-
/** 组件表面颜色。 */
|
|
9908
|
-
colorSurface: "#ffffff",
|
|
9909
|
-
/** 默认边框颜色。 */
|
|
9910
|
-
colorBorder: "#d9d9d9",
|
|
9911
|
-
/** 默认圆角半径,单位为像素。 */
|
|
9912
|
-
borderRadius: 6,
|
|
9913
|
-
/** 默认控件高度,单位为像素。 */
|
|
9914
|
-
controlHeight: 32,
|
|
9915
|
-
/** 默认布局间距为 8 像素,对应 --sia-spacing;业务可通过容器或组件上的同名 CSS 变量覆盖。 */
|
|
9916
|
-
spacing: 8,
|
|
9917
|
-
/** 默认基础字号为 13 像素,对应 --sia-font-size;业务可通过 CSS 变量覆盖。 */
|
|
9918
|
-
fontSize: 13,
|
|
9919
|
-
/** 默认小号文字尺寸为 13 像素,对应 --sia-font-size-small;业务可通过 CSS 变量覆盖。 */
|
|
9920
|
-
fontSizeSmall: 13,
|
|
9921
|
-
/** 大号文字尺寸,单位为像素。 */
|
|
9922
|
-
fontSizeLarge: 18
|
|
9923
|
-
};
|
|
9924
|
-
function applySiaTheme(mode, target = document.documentElement) {
|
|
9925
|
-
target.dataset.siaTheme = mode;
|
|
9926
|
-
target.style.colorScheme = mode;
|
|
9927
|
-
}
|
|
9928
|
-
|
|
9929
10157
|
// src/components/InputSelect.tsx
|
|
9930
|
-
import { forwardRef as forwardRef7, useEffect as useEffect16, useRef as
|
|
9931
|
-
import { jsx as
|
|
10158
|
+
import { forwardRef as forwardRef7, useEffect as useEffect16, useRef as useRef23, useState as useState24 } from "react";
|
|
10159
|
+
import { jsx as jsx29, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
9932
10160
|
var InputSelect = forwardRef7(function InputSelect2({
|
|
9933
10161
|
options,
|
|
9934
10162
|
value,
|
|
@@ -9955,22 +10183,22 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
9955
10183
|
...inputProps
|
|
9956
10184
|
}, forwardedRef) {
|
|
9957
10185
|
const size = useControlSize(sizeProp);
|
|
9958
|
-
const [internal, setInternal] =
|
|
10186
|
+
const [internal, setInternal] = useState24(defaultValue);
|
|
9959
10187
|
const current = value !== void 0 ? value : internal;
|
|
9960
|
-
const values = current == null ? [] : Array.isArray(current) ? current : [current];
|
|
10188
|
+
const values = normalizeSelectionValues(current == null ? [] : Array.isArray(current) ? current : [current], options);
|
|
9961
10189
|
const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
|
|
9962
|
-
const [draft, setDraft] =
|
|
10190
|
+
const [draft, setDraft] = useState24(text);
|
|
9963
10191
|
useEffect16(() => {
|
|
9964
10192
|
setDraft(text);
|
|
9965
10193
|
}, [text, current]);
|
|
9966
|
-
const [open, setOpen] =
|
|
9967
|
-
const [search, setSearch] =
|
|
9968
|
-
const [modalOpen, setModalOpen] =
|
|
9969
|
-
const [modalValues, setModalValues] =
|
|
9970
|
-
const [selectedOnly, setSelectedOnly] =
|
|
9971
|
-
const rootRef =
|
|
9972
|
-
const popupRef =
|
|
9973
|
-
const inputRef =
|
|
10194
|
+
const [open, setOpen] = useState24(false);
|
|
10195
|
+
const [search, setSearch] = useState24("");
|
|
10196
|
+
const [modalOpen, setModalOpen] = useState24(false);
|
|
10197
|
+
const [modalValues, setModalValues] = useState24([]);
|
|
10198
|
+
const [selectedOnly, setSelectedOnly] = useState24(false);
|
|
10199
|
+
const rootRef = useRef23(null);
|
|
10200
|
+
const popupRef = useRef23(null);
|
|
10201
|
+
const inputRef = useRef23(null);
|
|
9974
10202
|
const config = typeof enableModal === "object" ? enableModal : {};
|
|
9975
10203
|
function changeOpen(next) {
|
|
9976
10204
|
if (next && (disabled || loading)) return;
|
|
@@ -10018,7 +10246,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
10018
10246
|
inputRef.current?.focus();
|
|
10019
10247
|
}
|
|
10020
10248
|
}, children: [
|
|
10021
|
-
/* @__PURE__ */
|
|
10249
|
+
/* @__PURE__ */ jsx29(
|
|
10022
10250
|
Input,
|
|
10023
10251
|
{
|
|
10024
10252
|
...inputProps,
|
|
@@ -10056,25 +10284,25 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
10056
10284
|
changeOpen(true);
|
|
10057
10285
|
},
|
|
10058
10286
|
suffix: /* @__PURE__ */ jsxs26("span", { className: "sia-input-select__suffix", children: [
|
|
10059
|
-
allowClear && draft && !disabled && /* @__PURE__ */
|
|
10287
|
+
allowClear && draft && !disabled && /* @__PURE__ */ jsx29(Button, { className: "sia-input-select__clear", variant: "text", size: "small", disabled: loading, "aria-label": "\u6E05\u9664\u8F93\u5165\u9009\u62E9", onClick: (event) => {
|
|
10060
10288
|
event.stopPropagation();
|
|
10061
10289
|
setDraft("");
|
|
10062
10290
|
emit(multiple ? [] : void 0);
|
|
10063
10291
|
inputRef.current?.focus();
|
|
10064
10292
|
}, children: "\xD7" }),
|
|
10065
10293
|
suffix,
|
|
10066
|
-
enableModal && /* @__PURE__ */
|
|
10294
|
+
enableModal && /* @__PURE__ */ jsx29(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
|
|
10067
10295
|
event.stopPropagation();
|
|
10068
10296
|
openModal();
|
|
10069
10297
|
}, children: "\u2026" }),
|
|
10070
|
-
/* @__PURE__ */
|
|
10298
|
+
/* @__PURE__ */ jsx29(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
|
|
10071
10299
|
event.stopPropagation();
|
|
10072
10300
|
changeOpen(!open);
|
|
10073
|
-
}, children: /* @__PURE__ */
|
|
10301
|
+
}, children: /* @__PURE__ */ jsx29(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
|
|
10074
10302
|
] })
|
|
10075
10303
|
}
|
|
10076
10304
|
),
|
|
10077
|
-
/* @__PURE__ */
|
|
10305
|
+
/* @__PURE__ */ jsx29(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx29(
|
|
10078
10306
|
SelectionPanel,
|
|
10079
10307
|
{
|
|
10080
10308
|
options,
|
|
@@ -10103,14 +10331,14 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
10103
10331
|
},
|
|
10104
10332
|
children: [
|
|
10105
10333
|
/* @__PURE__ */ jsxs26("div", { className: "sia-selection-panel__actions", role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
10106
|
-
/* @__PURE__ */
|
|
10334
|
+
/* @__PURE__ */ jsx29(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
10107
10335
|
/* @__PURE__ */ jsxs26(Button, { role: "tab", "aria-selected": selectedOnly, variant: selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(true), children: [
|
|
10108
10336
|
"\u5DF2\u9009\u9879(",
|
|
10109
10337
|
modalValues.length,
|
|
10110
10338
|
")"
|
|
10111
10339
|
] })
|
|
10112
10340
|
] }),
|
|
10113
|
-
modalOpen && /* @__PURE__ */
|
|
10341
|
+
modalOpen && /* @__PURE__ */ jsx29(
|
|
10114
10342
|
SelectionPanel,
|
|
10115
10343
|
{
|
|
10116
10344
|
options,
|
|
@@ -10131,13 +10359,137 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
10131
10359
|
});
|
|
10132
10360
|
|
|
10133
10361
|
// src/components/QueryForm.tsx
|
|
10134
|
-
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as
|
|
10362
|
+
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect9, useRef as useRef27, useState as useState27 } from "react";
|
|
10363
|
+
|
|
10364
|
+
// src/components/useQueryFormMotion.ts
|
|
10365
|
+
import { useLayoutEffect as useLayoutEffect8, useRef as useRef24 } from "react";
|
|
10366
|
+
function readLayout(row) {
|
|
10367
|
+
const root = row.getBoundingClientRect();
|
|
10368
|
+
const scaleX = root.width / row.offsetWidth || 1, scaleY = root.height / row.offsetHeight || 1;
|
|
10369
|
+
const boxes = /* @__PURE__ */ new Map();
|
|
10370
|
+
for (const node of [...row.children]) {
|
|
10371
|
+
if (node.hidden) continue;
|
|
10372
|
+
const rect = node.getBoundingClientRect();
|
|
10373
|
+
boxes.set(node, { x: (rect.left - root.left) / scaleX + row.scrollLeft, y: (rect.top - root.top) / scaleY + row.scrollTop, width: rect.width / scaleX, height: rect.height / scaleY });
|
|
10374
|
+
}
|
|
10375
|
+
return { height: row.offsetHeight, boxes };
|
|
10376
|
+
}
|
|
10377
|
+
function useQueryFormMotion(ref, layoutKey) {
|
|
10378
|
+
const previous = useRef24();
|
|
10379
|
+
const stop = useRef24();
|
|
10380
|
+
const snapshot = useRef24();
|
|
10381
|
+
useLayoutEffect8(() => {
|
|
10382
|
+
const row = ref.current;
|
|
10383
|
+
if (!row) return;
|
|
10384
|
+
if (!previous.current) {
|
|
10385
|
+
previous.current = readLayout(row);
|
|
10386
|
+
return;
|
|
10387
|
+
}
|
|
10388
|
+
let cancelled = false;
|
|
10389
|
+
queueMicrotask(() => {
|
|
10390
|
+
if (cancelled) return;
|
|
10391
|
+
const shell = row.parentElement;
|
|
10392
|
+
const before = snapshot.current?.() ?? previous.current;
|
|
10393
|
+
const startHeight = stop.current ? shell.offsetHeight : before?.height;
|
|
10394
|
+
stop.current?.();
|
|
10395
|
+
const after = readLayout(row);
|
|
10396
|
+
previous.current = after;
|
|
10397
|
+
const media = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
10398
|
+
if (!before || startHeight === void 0 || media.matches || !row.animate) return;
|
|
10399
|
+
const animations = [];
|
|
10400
|
+
const restores = [];
|
|
10401
|
+
const options = { duration: 240, easing: "cubic-bezier(.4,0,.6,1)", fill: "both" };
|
|
10402
|
+
const overflow = shell.style.overflow;
|
|
10403
|
+
const rowOverflow = row.style.overflow;
|
|
10404
|
+
row.dataset.queryMotion = "true";
|
|
10405
|
+
shell.style.overflow = "hidden";
|
|
10406
|
+
row.style.overflow = "visible";
|
|
10407
|
+
animations.push(shell.animate([{ height: `${startHeight}px` }, { height: `${after.height}px` }], options));
|
|
10408
|
+
const candidates = [.../* @__PURE__ */ new Set([...before.boxes.keys(), ...after.boxes.keys()])];
|
|
10409
|
+
const moving = candidates.filter((node, index) => index < 24 || node.classList.contains("sia-query-form__actions"));
|
|
10410
|
+
const nodeAnimations = /* @__PURE__ */ new Map();
|
|
10411
|
+
for (const node of moving) {
|
|
10412
|
+
const from = before.boxes.get(node), to = after.boxes.get(node);
|
|
10413
|
+
if (from && !to && node.isConnected) {
|
|
10414
|
+
const keys = ["position", "left", "top", "width", "height", "pointerEvents"];
|
|
10415
|
+
const saved = keys.map((key) => node.style[key]);
|
|
10416
|
+
const inert = node.hasAttribute("inert");
|
|
10417
|
+
node.hidden = false;
|
|
10418
|
+
Object.assign(node.style, { position: "absolute", left: `${from.x}px`, top: `${from.y}px`, width: `${from.width}px`, height: `${from.height}px`, pointerEvents: "none" });
|
|
10419
|
+
node.setAttribute("inert", "");
|
|
10420
|
+
restores.push(() => {
|
|
10421
|
+
keys.forEach((key, index) => {
|
|
10422
|
+
node.style[key] = saved[index];
|
|
10423
|
+
});
|
|
10424
|
+
if (!inert) node.removeAttribute("inert");
|
|
10425
|
+
node.hidden = node.dataset.queryHidden === "true";
|
|
10426
|
+
});
|
|
10427
|
+
animations.push(node.animate([{ opacity: from.opacity ?? 1, transform: "translateY(0)" }, { opacity: 0, transform: "translateY(-6px)" }], options));
|
|
10428
|
+
} else if (to && !from) {
|
|
10429
|
+
animations.push(node.animate([{ opacity: 0, transform: "translateY(-6px)" }, { opacity: 1, transform: "translateY(0)" }], options));
|
|
10430
|
+
} else if (from && to && (Math.abs(from.x - to.x) > 0.5 || Math.abs(from.y - to.y) > 0.5 || (from.opacity ?? 1) < 0.999)) {
|
|
10431
|
+
animations.push(node.animate([{ opacity: from.opacity ?? 1, transform: `translate(${from.x - to.x}px, ${from.y - to.y}px)` }, { opacity: 1, transform: "translate(0,0)" }], options));
|
|
10432
|
+
}
|
|
10433
|
+
const animation = animations[animations.length - 1];
|
|
10434
|
+
if (animation.effect.target === node) nodeAnimations.set(node, animation);
|
|
10435
|
+
}
|
|
10436
|
+
snapshot.current = () => ({ height: shell.offsetHeight, boxes: new Map(candidates.filter((node) => node.isConnected).map((node) => {
|
|
10437
|
+
const base = after.boxes.get(node) ?? before.boxes.get(node);
|
|
10438
|
+
const style = getComputedStyle(node);
|
|
10439
|
+
const effect = nodeAnimations.get(node)?.effect;
|
|
10440
|
+
const frames = effect?.getKeyframes();
|
|
10441
|
+
const progress = Number(effect?.getComputedTiming().progress ?? 0);
|
|
10442
|
+
const from = frames ? new DOMMatrixReadOnly(String(frames[0].transform)) : new DOMMatrixReadOnly();
|
|
10443
|
+
const to = frames ? new DOMMatrixReadOnly(String(frames[frames.length - 1].transform)) : from;
|
|
10444
|
+
return [node, { ...base, x: base.x + from.m41 + (to.m41 - from.m41) * progress, y: base.y + from.m42 + (to.m42 - from.m42) * progress, opacity: Number(style.opacity) }];
|
|
10445
|
+
})) });
|
|
10446
|
+
let ended = false;
|
|
10447
|
+
const cleanup = () => {
|
|
10448
|
+
if (ended) return;
|
|
10449
|
+
ended = true;
|
|
10450
|
+
animations.forEach((animation) => animation.cancel());
|
|
10451
|
+
restores.forEach((restore) => restore());
|
|
10452
|
+
shell.style.overflow = overflow;
|
|
10453
|
+
row.style.overflow = rowOverflow;
|
|
10454
|
+
delete row.dataset.queryMotion;
|
|
10455
|
+
media.removeEventListener("change", finish);
|
|
10456
|
+
stop.current = void 0;
|
|
10457
|
+
snapshot.current = void 0;
|
|
10458
|
+
};
|
|
10459
|
+
const finish = () => {
|
|
10460
|
+
if (ended) return;
|
|
10461
|
+
cleanup();
|
|
10462
|
+
previous.current = readLayout(row);
|
|
10463
|
+
row.dispatchEvent(new Event("sia-query-motion-end"));
|
|
10464
|
+
};
|
|
10465
|
+
stop.current = cleanup;
|
|
10466
|
+
media.addEventListener("change", finish, { once: true });
|
|
10467
|
+
animations[0].finished.then(finish, () => {
|
|
10468
|
+
});
|
|
10469
|
+
});
|
|
10470
|
+
return () => {
|
|
10471
|
+
cancelled = true;
|
|
10472
|
+
};
|
|
10473
|
+
}, [ref, layoutKey]);
|
|
10474
|
+
useLayoutEffect8(() => {
|
|
10475
|
+
const row = ref.current;
|
|
10476
|
+
if (!row) return;
|
|
10477
|
+
const observer = new ResizeObserver(() => {
|
|
10478
|
+
if (!stop.current) previous.current = readLayout(row);
|
|
10479
|
+
});
|
|
10480
|
+
observer.observe(row);
|
|
10481
|
+
return () => {
|
|
10482
|
+
observer.disconnect();
|
|
10483
|
+
stop.current?.();
|
|
10484
|
+
};
|
|
10485
|
+
}, [ref]);
|
|
10486
|
+
}
|
|
10135
10487
|
|
|
10136
10488
|
// src/components/QueryFormSettings.tsx
|
|
10137
|
-
import { useEffect as useEffect18, useRef as
|
|
10489
|
+
import { useEffect as useEffect18, useRef as useRef26, useState as useState26 } from "react";
|
|
10138
10490
|
|
|
10139
10491
|
// src/components/useQueryFieldSort.ts
|
|
10140
|
-
import { useEffect as useEffect17, useRef as
|
|
10492
|
+
import { useEffect as useEffect17, useRef as useRef25, useState as useState25 } from "react";
|
|
10141
10493
|
function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
10142
10494
|
const center = rects[from].top + rects[from].height / 2 + dy;
|
|
10143
10495
|
const rest = keys.map((_, index) => index).filter((index) => index !== from);
|
|
@@ -10156,11 +10508,11 @@ function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
|
10156
10508
|
return { ordered, offsets };
|
|
10157
10509
|
}
|
|
10158
10510
|
function useQueryFieldSort(keys, enabled, onCommit) {
|
|
10159
|
-
const listRef =
|
|
10160
|
-
const cancelRef =
|
|
10161
|
-
const commitRef =
|
|
10511
|
+
const listRef = useRef25(null);
|
|
10512
|
+
const cancelRef = useRef25();
|
|
10513
|
+
const commitRef = useRef25(onCommit);
|
|
10162
10514
|
commitRef.current = onCommit;
|
|
10163
|
-
const [preview, setPreview] =
|
|
10515
|
+
const [preview, setPreview] = useState25();
|
|
10164
10516
|
const signature = JSON.stringify(keys);
|
|
10165
10517
|
useEffect17(() => {
|
|
10166
10518
|
cancelRef.current?.();
|
|
@@ -10285,18 +10637,18 @@ function countQueryFieldRows(centers) {
|
|
|
10285
10637
|
}
|
|
10286
10638
|
|
|
10287
10639
|
// src/components/QueryFormSettings.tsx
|
|
10288
|
-
import { Fragment as Fragment11, jsx as
|
|
10640
|
+
import { Fragment as Fragment11, jsx as jsx30, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
10289
10641
|
function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed, disabled) {
|
|
10290
|
-
const [snapshot, setSnapshot] =
|
|
10291
|
-
const [draft, setDraft] =
|
|
10292
|
-
const [open, setOpen] =
|
|
10293
|
-
const [loading, setLoading] =
|
|
10294
|
-
const [saving, setSaving] =
|
|
10295
|
-
const [error, setError] =
|
|
10296
|
-
const [loadFailed, setLoadFailed] =
|
|
10297
|
-
const token =
|
|
10298
|
-
const saveLock =
|
|
10299
|
-
const latest =
|
|
10642
|
+
const [snapshot, setSnapshot] = useState26();
|
|
10643
|
+
const [draft, setDraft] = useState26({ fields: [], defaultCollapsed: defaultCollapsed ?? false });
|
|
10644
|
+
const [open, setOpen] = useState26(false);
|
|
10645
|
+
const [loading, setLoading] = useState26(false);
|
|
10646
|
+
const [saving, setSaving] = useState26(false);
|
|
10647
|
+
const [error, setError] = useState26("");
|
|
10648
|
+
const [loadFailed, setLoadFailed] = useState26(false);
|
|
10649
|
+
const token = useRef26(0);
|
|
10650
|
+
const saveLock = useRef26(false);
|
|
10651
|
+
const latest = useRef26({ config, fields, defaultCollapsed, applyCollapsed });
|
|
10300
10652
|
latest.current = { config, fields, defaultCollapsed, applyCollapsed };
|
|
10301
10653
|
const moduleName = config?.scope.moduleName;
|
|
10302
10654
|
const businessKey = config?.scope.businessKey;
|
|
@@ -10380,7 +10732,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10380
10732
|
const items = new Map(visibleDraft.map((item) => [item.key, item]));
|
|
10381
10733
|
setDraft((current) => ({ ...current, fields: keys.map((key, order) => ({ ...items.get(key), order })) }));
|
|
10382
10734
|
});
|
|
10383
|
-
const control = config ? /* @__PURE__ */
|
|
10735
|
+
const control = config ? /* @__PURE__ */ jsx30(
|
|
10384
10736
|
Button,
|
|
10385
10737
|
{
|
|
10386
10738
|
type: "button",
|
|
@@ -10389,7 +10741,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10389
10741
|
"aria-label": "\u67E5\u8BE2\u8BBE\u7F6E",
|
|
10390
10742
|
disabled: disabled || saving,
|
|
10391
10743
|
loading: loading && !open,
|
|
10392
|
-
icon: /* @__PURE__ */
|
|
10744
|
+
icon: /* @__PURE__ */ jsx30(Icon, { name: "more-vertical" }),
|
|
10393
10745
|
onClick: () => {
|
|
10394
10746
|
setOpen(true);
|
|
10395
10747
|
void load(true);
|
|
@@ -10397,8 +10749,8 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10397
10749
|
}
|
|
10398
10750
|
) : null;
|
|
10399
10751
|
const panel = config ? /* @__PURE__ */ jsxs27(Fragment11, { children: [
|
|
10400
|
-
!open && error ? /* @__PURE__ */
|
|
10401
|
-
/* @__PURE__ */
|
|
10752
|
+
!open && error ? /* @__PURE__ */ jsx30("span", { className: "sia-query-form__error", role: "alert", children: "\u67E5\u8BE2\u8BBE\u7F6E\u8BFB\u53D6\u5931\u8D25\uFF0C\u8BF7\u6253\u5F00\u8BBE\u7F6E\u91CD\u8BD5" }) : null,
|
|
10753
|
+
/* @__PURE__ */ jsx30(
|
|
10402
10754
|
Modal,
|
|
10403
10755
|
{
|
|
10404
10756
|
title: "\u67E5\u8BE2\u8BBE\u7F6E",
|
|
@@ -10412,14 +10764,14 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10412
10764
|
if (!saveLock.current) setOpen(next);
|
|
10413
10765
|
},
|
|
10414
10766
|
children: /* @__PURE__ */ jsxs27("div", { className: "sia-query-settings", children: [
|
|
10415
|
-
loading ? /* @__PURE__ */
|
|
10767
|
+
loading ? /* @__PURE__ */ jsx30("p", { role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u67E5\u8BE2\u8BBE\u7F6E\u2026" }) : null,
|
|
10416
10768
|
error ? /* @__PURE__ */ jsxs27("div", { role: "alert", className: "sia-query-form__error", children: [
|
|
10417
10769
|
error,
|
|
10418
|
-
loadFailed ? /* @__PURE__ */
|
|
10770
|
+
loadFailed ? /* @__PURE__ */ jsx30(Button, { type: "button", variant: "link", onClick: () => void load(true), children: "\u91CD\u8BD5" }) : null
|
|
10419
10771
|
] }) : null,
|
|
10420
|
-
/* @__PURE__ */
|
|
10421
|
-
/* @__PURE__ */
|
|
10422
|
-
/* @__PURE__ */
|
|
10772
|
+
/* @__PURE__ */ jsx30(Checkbox, { checked: draft.defaultCollapsed, disabled: locked, onChange: (checked) => setDraft((current) => ({ ...current, defaultCollapsed: checked })), children: "\u9ED8\u8BA4\u6536\u8D77\u67E5\u8BE2\u6761\u4EF6" }),
|
|
10773
|
+
/* @__PURE__ */ jsx30("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" }),
|
|
10774
|
+
/* @__PURE__ */ jsx30("div", { ref: sort.listRef, className: `sia-query-settings__list${sort.preview ? " is-sorting" : ""}`, children: visibleDraft.map((item, index) => /* @__PURE__ */ jsxs27(
|
|
10423
10775
|
"div",
|
|
10424
10776
|
{
|
|
10425
10777
|
"data-query-field-key": item.key,
|
|
@@ -10427,18 +10779,18 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10427
10779
|
style: sort.preview ? { transform: `translateY(${sort.preview.offsets[item.key] ?? 0}px)` } : void 0,
|
|
10428
10780
|
onPointerDown: (event) => sort.start(event, item.key),
|
|
10429
10781
|
children: [
|
|
10430
|
-
/* @__PURE__ */
|
|
10431
|
-
/* @__PURE__ */
|
|
10432
|
-
/* @__PURE__ */
|
|
10782
|
+
/* @__PURE__ */ jsx30(Icon, { name: "menu", size: 15 }),
|
|
10783
|
+
/* @__PURE__ */ jsx30(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) })) }),
|
|
10784
|
+
/* @__PURE__ */ jsx30("span", { className: "sia-query-settings__name", children: labels.get(item.key) ?? item.key }),
|
|
10433
10785
|
/* @__PURE__ */ jsxs27("div", { className: "sia-query-settings__order", children: [
|
|
10434
|
-
/* @__PURE__ */
|
|
10435
|
-
/* @__PURE__ */
|
|
10786
|
+
/* @__PURE__ */ jsx30(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0A\u79FB ${item.key}`, disabled: locked || index === 0, icon: /* @__PURE__ */ jsx30(Icon, { name: "chevron-up" }), onClick: () => move(index, index - 1) }),
|
|
10787
|
+
/* @__PURE__ */ jsx30(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0B\u79FB ${item.key}`, disabled: locked || index === visibleDraft.length - 1, icon: /* @__PURE__ */ jsx30(Icon, { name: "chevron-down" }), onClick: () => move(index, index + 1) })
|
|
10436
10788
|
] })
|
|
10437
10789
|
]
|
|
10438
10790
|
},
|
|
10439
10791
|
item.key
|
|
10440
10792
|
)) }),
|
|
10441
|
-
/* @__PURE__ */
|
|
10793
|
+
/* @__PURE__ */ jsx30(Button, { type: "button", disabled: locked, onClick: () => setDraft({ fields: reconcileQueryFields(fields.map((field) => field.key)), defaultCollapsed: defaultCollapsed ?? false }), children: "\u6062\u590D\u9ED8\u8BA4" })
|
|
10442
10794
|
] })
|
|
10443
10795
|
}
|
|
10444
10796
|
)
|
|
@@ -10447,7 +10799,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
10447
10799
|
}
|
|
10448
10800
|
|
|
10449
10801
|
// src/components/QueryForm.tsx
|
|
10450
|
-
import { jsx as
|
|
10802
|
+
import { jsx as jsx31, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
10451
10803
|
function QueryForm({
|
|
10452
10804
|
fields,
|
|
10453
10805
|
settings,
|
|
@@ -10482,23 +10834,23 @@ function QueryForm({
|
|
|
10482
10834
|
...formProps
|
|
10483
10835
|
}) {
|
|
10484
10836
|
const [form] = useForm(providedForm);
|
|
10485
|
-
const [internalCollapsed, setInternalCollapsed] =
|
|
10486
|
-
const [expandedRows, setExpandedRows] =
|
|
10487
|
-
const [needsCollapse, setNeedsCollapse] =
|
|
10837
|
+
const [internalCollapsed, setInternalCollapsed] = useState27(defaultCollapsed);
|
|
10838
|
+
const [expandedRows, setExpandedRows] = useState27(0);
|
|
10839
|
+
const [needsCollapse, setNeedsCollapse] = useState27(false);
|
|
10488
10840
|
const collapsed = collapsible && needsCollapse && (controlledCollapsed ?? internalCollapsed ?? expandedRows >= 3);
|
|
10489
|
-
const [searching, setSearching] =
|
|
10490
|
-
const [saving, setSaving] =
|
|
10491
|
-
const [removing, setRemoving] =
|
|
10492
|
-
const [saveOpen, setSaveOpen] =
|
|
10493
|
-
const [saveName, setSaveName] =
|
|
10494
|
-
const [saveError, setSaveError] =
|
|
10495
|
-
const [error, setError] =
|
|
10496
|
-
const [activeShortcut, setActiveShortcut] =
|
|
10497
|
-
const source =
|
|
10498
|
-
const searchLock =
|
|
10499
|
-
const saveLock =
|
|
10500
|
-
const removeLock =
|
|
10501
|
-
const snapshot =
|
|
10841
|
+
const [searching, setSearching] = useState27(false);
|
|
10842
|
+
const [saving, setSaving] = useState27(false);
|
|
10843
|
+
const [removing, setRemoving] = useState27(false);
|
|
10844
|
+
const [saveOpen, setSaveOpen] = useState27(false);
|
|
10845
|
+
const [saveName, setSaveName] = useState27("");
|
|
10846
|
+
const [saveError, setSaveError] = useState27("");
|
|
10847
|
+
const [error, setError] = useState27("");
|
|
10848
|
+
const [activeShortcut, setActiveShortcut] = useState27("");
|
|
10849
|
+
const source = useRef27({ source: "submit" });
|
|
10850
|
+
const searchLock = useRef27(false);
|
|
10851
|
+
const saveLock = useRef27(false);
|
|
10852
|
+
const removeLock = useRef27(false);
|
|
10853
|
+
const snapshot = useRef27();
|
|
10502
10854
|
const busy = disabled || loading || searching;
|
|
10503
10855
|
const shortcutBusy = busy || shortcutsLoading || saving || removing;
|
|
10504
10856
|
const fieldLabel = (content) => {
|
|
@@ -10510,7 +10862,7 @@ function QueryForm({
|
|
|
10510
10862
|
width,
|
|
10511
10863
|
hideDisabled: settingsHideDisabled,
|
|
10512
10864
|
label: settingsLabel ?? item.label ?? (typeof item.children === "function" ? void 0 : fieldLabel(item.children)) ?? key,
|
|
10513
|
-
content: /* @__PURE__ */
|
|
10865
|
+
content: /* @__PURE__ */ jsx31(Form.Item, { noStyle: true, ...item })
|
|
10514
10866
|
})) : Children4.toArray(children).map((content, index) => ({
|
|
10515
10867
|
key: isValidElement5(content) && content.key != null ? String(content.key) : String(index),
|
|
10516
10868
|
width: void 0,
|
|
@@ -10525,17 +10877,17 @@ function QueryForm({
|
|
|
10525
10877
|
const entries = configured.map((item) => ({ ...entriesByKey.get(item.key), visible: item.visible, visibleIndex: item.visible ? visibleIndex++ : -1 }));
|
|
10526
10878
|
const layoutKey = JSON.stringify(configured);
|
|
10527
10879
|
const limit = Math.max(1, Math.floor(collapsedCount));
|
|
10528
|
-
const rowRef =
|
|
10529
|
-
const actionsRef =
|
|
10530
|
-
const toggleRef =
|
|
10531
|
-
const [fittingCount, setFittingCount] =
|
|
10532
|
-
const [settingsRows, setSettingsRows] =
|
|
10533
|
-
|
|
10880
|
+
const rowRef = useRef27(null);
|
|
10881
|
+
const actionsRef = useRef27(null);
|
|
10882
|
+
const toggleRef = useRef27(null);
|
|
10883
|
+
const [fittingCount, setFittingCount] = useState27(limit);
|
|
10884
|
+
const [settingsRows, setSettingsRows] = useState27(0);
|
|
10885
|
+
useLayoutEffect9(() => {
|
|
10534
10886
|
const row = rowRef.current;
|
|
10535
10887
|
const actions = actionsRef.current;
|
|
10536
10888
|
if (!row || !actions) return;
|
|
10537
10889
|
function measure() {
|
|
10538
|
-
if (!row || !actions) return;
|
|
10890
|
+
if (!row || !actions || row.dataset.queryMotion === "true") return;
|
|
10539
10891
|
const gap = parseFloat(getComputedStyle(row).columnGap) || 0;
|
|
10540
10892
|
const sourceFields = Array.from(row.querySelectorAll(":scope > .sia-query-form__field"));
|
|
10541
10893
|
const sourceHidden = sourceFields.map((field) => field.hidden);
|
|
@@ -10596,7 +10948,11 @@ function QueryForm({
|
|
|
10596
10948
|
observer.observe(row);
|
|
10597
10949
|
observer.observe(actions);
|
|
10598
10950
|
row.querySelectorAll(":scope > .sia-query-form__field").forEach((field) => observer.observe(field));
|
|
10599
|
-
|
|
10951
|
+
row.addEventListener("sia-query-motion-end", measure);
|
|
10952
|
+
return () => {
|
|
10953
|
+
observer.disconnect();
|
|
10954
|
+
row.removeEventListener("sia-query-motion-end", measure);
|
|
10955
|
+
};
|
|
10600
10956
|
}, [
|
|
10601
10957
|
collapsed,
|
|
10602
10958
|
layoutKey,
|
|
@@ -10612,6 +10968,7 @@ function QueryForm({
|
|
|
10612
10968
|
resetText,
|
|
10613
10969
|
saveText
|
|
10614
10970
|
]);
|
|
10971
|
+
useQueryFormMotion(rowRef, `${collapsed}|${fittingCount}|${layoutKey}`);
|
|
10615
10972
|
async function search(values) {
|
|
10616
10973
|
const info = source.current;
|
|
10617
10974
|
source.current = { source: "submit" };
|
|
@@ -10709,7 +11066,7 @@ function QueryForm({
|
|
|
10709
11066
|
},
|
|
10710
11067
|
children: [
|
|
10711
11068
|
quickQueries.length ? /* @__PURE__ */ jsxs28("div", { className: "sia-query-form__quick", "aria-label": "\u9884\u8BBE\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
10712
|
-
quickQueries.map((query) => /* @__PURE__ */
|
|
11069
|
+
quickQueries.map((query) => /* @__PURE__ */ jsx31(
|
|
10713
11070
|
Badge,
|
|
10714
11071
|
{
|
|
10715
11072
|
className: "sia-query-form__quick-badge",
|
|
@@ -10718,7 +11075,7 @@ function QueryForm({
|
|
|
10718
11075
|
title: query.count === void 0 ? void 0 : `\u5171 ${query.count} \u6761`,
|
|
10719
11076
|
...query.badgeProps,
|
|
10720
11077
|
count: query.count,
|
|
10721
|
-
children: /* @__PURE__ */
|
|
11078
|
+
children: /* @__PURE__ */ jsx31(
|
|
10722
11079
|
Button,
|
|
10723
11080
|
{
|
|
10724
11081
|
size: query.size ?? quickQuerySize,
|
|
@@ -10734,7 +11091,7 @@ function QueryForm({
|
|
|
10734
11091
|
)),
|
|
10735
11092
|
" "
|
|
10736
11093
|
] }) : null,
|
|
10737
|
-
/* @__PURE__ */ jsxs28(
|
|
11094
|
+
/* @__PURE__ */ jsx31("div", { className: "sia-query-form__motion", children: /* @__PURE__ */ jsxs28(
|
|
10738
11095
|
"div",
|
|
10739
11096
|
{
|
|
10740
11097
|
ref: rowRef,
|
|
@@ -10743,11 +11100,12 @@ function QueryForm({
|
|
|
10743
11100
|
"--sia-query-field-width": typeof fieldWidth === "number" ? `${fieldWidth}px` : fieldWidth
|
|
10744
11101
|
},
|
|
10745
11102
|
children: [
|
|
10746
|
-
entries.map((entry) => /* @__PURE__ */
|
|
11103
|
+
entries.map((entry) => /* @__PURE__ */ jsx31(
|
|
10747
11104
|
"div",
|
|
10748
11105
|
{
|
|
10749
11106
|
className: "sia-query-form__field",
|
|
10750
11107
|
"data-settings-hidden": !entry.visible || void 0,
|
|
11108
|
+
"data-query-hidden": !entry.visible || collapsed && entry.visibleIndex >= Math.min(limit, fittingCount) || void 0,
|
|
10751
11109
|
hidden: !entry.visible || collapsed && entry.visibleIndex >= Math.min(limit, fittingCount),
|
|
10752
11110
|
style: entry.width !== void 0 ? {
|
|
10753
11111
|
"--sia-query-item-width": typeof entry.width === "number" ? `${entry.width}px` : entry.width
|
|
@@ -10758,7 +11116,7 @@ function QueryForm({
|
|
|
10758
11116
|
)),
|
|
10759
11117
|
/* @__PURE__ */ jsxs28("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
|
|
10760
11118
|
/* @__PURE__ */ jsxs28(Space.Compact, { children: [
|
|
10761
|
-
/* @__PURE__ */
|
|
11119
|
+
/* @__PURE__ */ jsx31(
|
|
10762
11120
|
Button,
|
|
10763
11121
|
{
|
|
10764
11122
|
type: "submit",
|
|
@@ -10768,8 +11126,8 @@ function QueryForm({
|
|
|
10768
11126
|
children: searchText
|
|
10769
11127
|
}
|
|
10770
11128
|
),
|
|
10771
|
-
/* @__PURE__ */
|
|
10772
|
-
onSaveQuery ? /* @__PURE__ */
|
|
11129
|
+
/* @__PURE__ */ jsx31(Button, { disabled: busy, onClick: reset, children: resetText }),
|
|
11130
|
+
onSaveQuery ? /* @__PURE__ */ jsx31(
|
|
10773
11131
|
Button,
|
|
10774
11132
|
{
|
|
10775
11133
|
disabled: shortcutBusy,
|
|
@@ -10784,12 +11142,12 @@ function QueryForm({
|
|
|
10784
11142
|
) : null,
|
|
10785
11143
|
showSettings ?? settingsRows > 2 ? cloudSettings.control : null
|
|
10786
11144
|
] }),
|
|
10787
|
-
collapsible && entries.length > 0 ? /* @__PURE__ */
|
|
11145
|
+
collapsible && entries.length > 0 ? /* @__PURE__ */ jsx31("span", { ref: toggleRef, hidden: !needsCollapse, children: /* @__PURE__ */ jsx31(
|
|
10788
11146
|
Button,
|
|
10789
11147
|
{
|
|
10790
11148
|
variant: "link",
|
|
10791
11149
|
"aria-expanded": !collapsed,
|
|
10792
|
-
icon: /* @__PURE__ */
|
|
11150
|
+
icon: /* @__PURE__ */ jsx31(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
|
|
10793
11151
|
iconPosition: "end",
|
|
10794
11152
|
onClick: () => {
|
|
10795
11153
|
setInternalCollapsed(!collapsed);
|
|
@@ -10803,9 +11161,9 @@ function QueryForm({
|
|
|
10803
11161
|
] })
|
|
10804
11162
|
]
|
|
10805
11163
|
}
|
|
10806
|
-
),
|
|
11164
|
+
) }),
|
|
10807
11165
|
savedQueries.length ? /* @__PURE__ */ jsxs28("div", { className: "sia-query-form__saved", "aria-label": "\u5DF2\u4FDD\u5B58\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
10808
|
-
savedQueries.map((query, index) => /* @__PURE__ */
|
|
11166
|
+
savedQueries.map((query, index) => /* @__PURE__ */ jsx31(
|
|
10809
11167
|
Tag,
|
|
10810
11168
|
{
|
|
10811
11169
|
status: query.status ?? ["processing", "success", "warning", "error"][index % 4],
|
|
@@ -10831,7 +11189,7 @@ function QueryForm({
|
|
|
10831
11189
|
)),
|
|
10832
11190
|
" "
|
|
10833
11191
|
] }) : null,
|
|
10834
|
-
error ? /* @__PURE__ */
|
|
11192
|
+
error ? /* @__PURE__ */ jsx31("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
|
|
10835
11193
|
]
|
|
10836
11194
|
}
|
|
10837
11195
|
),
|
|
@@ -10847,7 +11205,7 @@ function QueryForm({
|
|
|
10847
11205
|
if (!saveLock.current) setSaveOpen(next);
|
|
10848
11206
|
},
|
|
10849
11207
|
children: [
|
|
10850
|
-
/* @__PURE__ */
|
|
11208
|
+
/* @__PURE__ */ jsx31(
|
|
10851
11209
|
Input,
|
|
10852
11210
|
{
|
|
10853
11211
|
autoFocus: true,
|
|
@@ -10866,7 +11224,7 @@ function QueryForm({
|
|
|
10866
11224
|
}
|
|
10867
11225
|
}
|
|
10868
11226
|
),
|
|
10869
|
-
saveError ? /* @__PURE__ */
|
|
11227
|
+
saveError ? /* @__PURE__ */ jsx31("p", { className: "sia-query-form__error", role: "alert", children: saveError }) : null
|
|
10870
11228
|
]
|
|
10871
11229
|
}
|
|
10872
11230
|
)
|
|
@@ -10875,7 +11233,7 @@ function QueryForm({
|
|
|
10875
11233
|
|
|
10876
11234
|
// src/components/NumberRange.tsx
|
|
10877
11235
|
import { forwardRef as forwardRef8 } from "react";
|
|
10878
|
-
import { jsx as
|
|
11236
|
+
import { jsx as jsx32, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
10879
11237
|
var NumberRange = forwardRef8(function NumberRange2({
|
|
10880
11238
|
value,
|
|
10881
11239
|
defaultValue = [null, null],
|
|
@@ -10913,7 +11271,7 @@ var NumberRange = forwardRef8(function NumberRange2({
|
|
|
10913
11271
|
"aria-disabled": disabled || void 0,
|
|
10914
11272
|
className: `sia-number-range sia-number-range--${size} sia-number-range--${status}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
10915
11273
|
children: [
|
|
10916
|
-
/* @__PURE__ */
|
|
11274
|
+
/* @__PURE__ */ jsx32(
|
|
10917
11275
|
InputNumber,
|
|
10918
11276
|
{
|
|
10919
11277
|
...inputProps,
|
|
@@ -10925,8 +11283,8 @@ var NumberRange = forwardRef8(function NumberRange2({
|
|
|
10925
11283
|
onChange: (next) => change(0, next)
|
|
10926
11284
|
}
|
|
10927
11285
|
),
|
|
10928
|
-
/* @__PURE__ */
|
|
10929
|
-
/* @__PURE__ */
|
|
11286
|
+
/* @__PURE__ */ jsx32(Icon, { className: "sia-number-range__separator", name: "tilde", size: 12, strokeWidth: 1.5, "aria-hidden": "true" }),
|
|
11287
|
+
/* @__PURE__ */ jsx32(
|
|
10930
11288
|
InputNumber,
|
|
10931
11289
|
{
|
|
10932
11290
|
...inputProps,
|
|
@@ -10938,11 +11296,14 @@ var NumberRange = forwardRef8(function NumberRange2({
|
|
|
10938
11296
|
onChange: (next) => change(1, next)
|
|
10939
11297
|
}
|
|
10940
11298
|
),
|
|
10941
|
-
allowClear && !disabled && !readOnly && range.some((item) => item !== null) ? /* @__PURE__ */
|
|
11299
|
+
allowClear && !disabled && !readOnly && range.some((item) => item !== null) ? /* @__PURE__ */ jsx32("button", { type: "button", className: "sia-number-range__clear", "aria-label": "\u6E05\u9664\u6570\u5B57\u533A\u95F4", onClick: () => setValue2([null, null]), children: /* @__PURE__ */ jsx32(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null
|
|
10942
11300
|
]
|
|
10943
11301
|
}
|
|
10944
11302
|
);
|
|
10945
11303
|
});
|
|
11304
|
+
|
|
11305
|
+
// src/index.ts
|
|
11306
|
+
initializeDefaultScrollbars();
|
|
10946
11307
|
export {
|
|
10947
11308
|
Alert,
|
|
10948
11309
|
AutoSizer,
|
|
@@ -11035,6 +11396,7 @@ export {
|
|
|
11035
11396
|
SelectDateRange,
|
|
11036
11397
|
SelectionPanel,
|
|
11037
11398
|
SiaChart,
|
|
11399
|
+
Skeleton,
|
|
11038
11400
|
Slider,
|
|
11039
11401
|
SortableList,
|
|
11040
11402
|
Space,
|