@sia.soul/sia-react-ui 0.1.115 → 0.1.117
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-SPIQSYWQ.js → chunk-6DFAX43X.js} +28 -2
- package/dist/{chunk-GNOZYUIH.js → chunk-CKP3SNVH.js} +3 -3
- package/dist/{chunk-MDU5EONC.js → chunk-HHPZOBY3.js} +2 -2
- package/dist/{chunk-XY7CXJS6.js → chunk-KIQSPAAQ.js} +3 -2
- package/dist/{chunk-6XQ2LDGT.js → chunk-RYNEJ6LD.js} +2 -2
- package/dist/{chunk-KPOK4HIQ.js → chunk-SB53UBFV.js} +2 -2
- package/dist/{core-uVaNwjTO.d.ts → core-De9MXbF6.d.ts} +15 -2
- package/dist/{core-O6oDXbkG.d.cts → core-DlngVjmf.d.cts} +15 -2
- package/dist/core.cjs +30 -3
- package/dist/core.css +15 -2
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +4 -4
- package/dist/game.cjs +3 -2
- package/dist/game.css +13 -0
- package/dist/game.js +1 -1
- package/dist/index.cjs +794 -715
- package/dist/index.css +15 -2
- package/dist/index.d.cts +13 -7
- package/dist/index.d.ts +13 -7
- package/dist/index.js +197 -145
- package/dist/rich-text-editor.cjs +30 -3
- package/dist/rich-text-editor.js +3 -3
- package/dist/select-date-range.cjs +3 -2
- package/dist/select-date-range.js +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
Watermark,
|
|
82
82
|
message,
|
|
83
83
|
notification
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-CKP3SNVH.js";
|
|
85
85
|
import "./chunk-RX242MUO.js";
|
|
86
86
|
import {
|
|
87
87
|
MarkdownEditor
|
|
@@ -89,12 +89,12 @@ import {
|
|
|
89
89
|
import {
|
|
90
90
|
RichTextContent,
|
|
91
91
|
RichTextEditor
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-HHPZOBY3.js";
|
|
93
93
|
import {
|
|
94
94
|
DatePicker,
|
|
95
95
|
SelectDateRange,
|
|
96
96
|
TimePanel
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-RYNEJ6LD.js";
|
|
98
98
|
import {
|
|
99
99
|
Checkbox,
|
|
100
100
|
FloatingScrollbarProvider,
|
|
@@ -106,14 +106,14 @@ import {
|
|
|
106
106
|
Tooltip,
|
|
107
107
|
Tree,
|
|
108
108
|
useScrollbarProximity
|
|
109
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-SB53UBFV.js";
|
|
110
110
|
import {
|
|
111
111
|
Dropdown,
|
|
112
112
|
Input,
|
|
113
113
|
Menu,
|
|
114
114
|
Segmented,
|
|
115
115
|
Steps
|
|
116
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-6DFAX43X.js";
|
|
117
117
|
import {
|
|
118
118
|
TextArea
|
|
119
119
|
} from "./chunk-SCEHVGKV.js";
|
|
@@ -124,7 +124,7 @@ import {
|
|
|
124
124
|
Modal,
|
|
125
125
|
OverlayPortal,
|
|
126
126
|
useOverlayLifecycle
|
|
127
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-KIQSPAAQ.js";
|
|
128
128
|
import {
|
|
129
129
|
Button
|
|
130
130
|
} from "./chunk-CZ2ITBRW.js";
|
|
@@ -144,7 +144,7 @@ import {
|
|
|
144
144
|
// src/components/CursorPreview.tsx
|
|
145
145
|
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
146
146
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
147
|
-
function CursorPreview({ frames, size = 48, playing = true, followPointer = true, showHotspot = false, height = 180, empty = "\u6682\u65E0\u6307\u9488\u9884\u89C8", alt = "\u9F20\u6807\u6307\u9488\u9884\u89C8", className = "", style, children, onPointerEnter, onPointerMove, onPointerLeave, ...props }) {
|
|
147
|
+
function CursorPreview({ frames, size = 48, sizeUnit = "css", playing = true, followPointer = true, showHotspot = false, height = 180, empty = "\u6682\u65E0\u6307\u9488\u9884\u89C8", alt = "\u9F20\u6807\u6307\u9488\u9884\u89C8", className = "", style, children, onPointerEnter, onPointerMove, onPointerLeave, ...props }) {
|
|
148
148
|
const rootRef = useRef(null);
|
|
149
149
|
const [bounds, setBounds] = useState({ width: 0, height: 0 });
|
|
150
150
|
const [hovered, setHovered] = useState(false);
|
|
@@ -152,17 +152,36 @@ function CursorPreview({ frames, size = 48, playing = true, followPointer = true
|
|
|
152
152
|
const [point, setPoint] = useState(null);
|
|
153
153
|
const [reduced, setReduced] = useState(false);
|
|
154
154
|
const [failed, setFailed] = useState(false);
|
|
155
|
-
const
|
|
155
|
+
const [density, setDensity] = useState(() => typeof window === "undefined" ? 1 : window.devicePixelRatio || 1);
|
|
156
|
+
const scale = sizeUnit === "device" ? density : 1;
|
|
157
|
+
const safeSize = Math.max(8, Number.isFinite(size) ? size : 48) / scale;
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
if (sizeUnit !== "device") return;
|
|
160
|
+
let media;
|
|
161
|
+
const update = () => {
|
|
162
|
+
media?.removeEventListener("change", update);
|
|
163
|
+
const next = window.devicePixelRatio || 1;
|
|
164
|
+
setDensity(next);
|
|
165
|
+
media = window.matchMedia(`(resolution: ${next}dppx)`);
|
|
166
|
+
media.addEventListener("change", update);
|
|
167
|
+
};
|
|
168
|
+
update();
|
|
169
|
+
window.addEventListener("resize", update);
|
|
170
|
+
return () => {
|
|
171
|
+
media.removeEventListener("change", update);
|
|
172
|
+
window.removeEventListener("resize", update);
|
|
173
|
+
};
|
|
174
|
+
}, [sizeUnit]);
|
|
156
175
|
const frame = frames[playing && !reduced ? index % Math.max(1, frames.length) : 0];
|
|
157
176
|
useLayoutEffect(() => {
|
|
158
177
|
const root = rootRef.current;
|
|
159
|
-
if (!showHotspot || !root) return;
|
|
178
|
+
if (!showHotspot && sizeUnit !== "device" || !root) return;
|
|
160
179
|
const measure = () => setBounds({ width: root.clientWidth, height: root.clientHeight });
|
|
161
180
|
measure();
|
|
162
181
|
const observer = new ResizeObserver(measure);
|
|
163
182
|
observer.observe(root);
|
|
164
183
|
return () => observer.disconnect();
|
|
165
|
-
}, [showHotspot]);
|
|
184
|
+
}, [showHotspot, sizeUnit]);
|
|
166
185
|
useEffect(() => {
|
|
167
186
|
setIndex(0);
|
|
168
187
|
}, [frames]);
|
|
@@ -187,8 +206,12 @@ function CursorPreview({ frames, size = 48, playing = true, followPointer = true
|
|
|
187
206
|
}
|
|
188
207
|
const following = !!point && followPointer && !!frame && !failed;
|
|
189
208
|
const offset = (value) => Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * safeSize;
|
|
190
|
-
const
|
|
191
|
-
const
|
|
209
|
+
const origin = rootRef.current?.getBoundingClientRect();
|
|
210
|
+
const snap = (value, base) => sizeUnit === "device" ? Math.round((value + base) * density) / density - base : value;
|
|
211
|
+
const bitmapX = snap(following ? point.x - offset(frame.hotspotX) : (bounds.width - safeSize) / 2, origin?.left ?? 0);
|
|
212
|
+
const bitmapY = snap(following ? point.y - offset(frame.hotspotY) : (bounds.height - safeSize) / 2, origin?.top ?? 0);
|
|
213
|
+
const hotspotX = bitmapX + offset(frame?.hotspotX);
|
|
214
|
+
const hotspotY = bitmapY + offset(frame?.hotspotY);
|
|
192
215
|
const direction = bounds.width - hotspotX >= 130 ? 1 : -1;
|
|
193
216
|
const lineY = Math.max(18, hotspotY - 42);
|
|
194
217
|
const elbowX = hotspotX + direction * 28;
|
|
@@ -211,7 +234,7 @@ function CursorPreview({ frames, size = 48, playing = true, followPointer = true
|
|
|
211
234
|
onPointerLeave?.(event);
|
|
212
235
|
},
|
|
213
236
|
children: [
|
|
214
|
-
frame ? /* @__PURE__ */ jsx("span", { className: "sia-cursor-preview__bitmap", style: { width: safeSize, height: safeSize, left: following ?
|
|
237
|
+
frame ? /* @__PURE__ */ jsx("span", { className: "sia-cursor-preview__bitmap", style: { width: safeSize, height: safeSize, left: sizeUnit === "device" || following ? bitmapX : "50%", top: sizeUnit === "device" || following ? bitmapY : "50%", transform: sizeUnit === "device" || following ? void 0 : "translate(-50%, -50%)" }, children: /* @__PURE__ */ jsx(Image, { src: frame.src, width: safeSize, height: safeSize, alt, preview: false, draggable: false, onLoad: () => setFailed(false), onError: () => setFailed(true) }) }) : /* @__PURE__ */ jsx("span", { className: "sia-cursor-preview__empty", children: empty }),
|
|
215
238
|
showHotspot && !hovered && frame && !failed && bounds.width > 0 ? /* @__PURE__ */ jsxs("svg", { className: "sia-cursor-preview__hotspot", width: "100%", height: "100%", role: "img", "aria-label": "\u6307\u9488\u70B9\uFF1A\u9F20\u6807\u70B9\u51FB\u7684\u5B9E\u9645\u4F4D\u7F6E", children: [
|
|
216
239
|
/* @__PURE__ */ jsx("polyline", { points: `${hotspotX},${hotspotY} ${elbowX},${lineY} ${endX},${lineY}` }),
|
|
217
240
|
/* @__PURE__ */ jsx("circle", { cx: hotspotX, cy: hotspotY, r: 2.5 }),
|
|
@@ -1244,6 +1267,7 @@ function ToolPanel({
|
|
|
1244
1267
|
}
|
|
1245
1268
|
|
|
1246
1269
|
// src/components/WindowFrame.tsx
|
|
1270
|
+
import { useEffect as useEffect4, useRef as useRef6 } from "react";
|
|
1247
1271
|
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1248
1272
|
var DEFAULT_LABELS = {
|
|
1249
1273
|
minimize: "\u6700\u5C0F\u5316",
|
|
@@ -1367,13 +1391,40 @@ function WindowTitleBar({
|
|
|
1367
1391
|
onMouseDown,
|
|
1368
1392
|
...props
|
|
1369
1393
|
}) {
|
|
1394
|
+
const cancelDrag = useRef6(null);
|
|
1395
|
+
useEffect4(() => () => cancelDrag.current?.(), [draggable]);
|
|
1370
1396
|
function handleMouseDown(event) {
|
|
1397
|
+
cancelDrag.current?.();
|
|
1371
1398
|
onMouseDown?.(event);
|
|
1372
1399
|
if (event.defaultPrevented || !draggable || !onWindowAction || event.button !== 0) return;
|
|
1373
1400
|
const target = event.target;
|
|
1374
1401
|
if (!(target instanceof Element) || target.closest(NON_DRAG_SELECTOR)) return;
|
|
1375
1402
|
event.preventDefault();
|
|
1376
|
-
|
|
1403
|
+
if (event.detail > 1) {
|
|
1404
|
+
void onWindowAction("toggle-maximize");
|
|
1405
|
+
return;
|
|
1406
|
+
}
|
|
1407
|
+
const origin = { x: event.clientX, y: event.clientY };
|
|
1408
|
+
const run = onWindowAction;
|
|
1409
|
+
function cancel() {
|
|
1410
|
+
document.removeEventListener("mousemove", move);
|
|
1411
|
+
document.removeEventListener("mouseup", cancel, true);
|
|
1412
|
+
window.removeEventListener("blur", cancel);
|
|
1413
|
+
cancelDrag.current = null;
|
|
1414
|
+
}
|
|
1415
|
+
function move(next) {
|
|
1416
|
+
if ((next.buttons & 1) === 0) {
|
|
1417
|
+
cancel();
|
|
1418
|
+
return;
|
|
1419
|
+
}
|
|
1420
|
+
if (Math.hypot(next.clientX - origin.x, next.clientY - origin.y) < 2) return;
|
|
1421
|
+
cancel();
|
|
1422
|
+
void run("start-dragging");
|
|
1423
|
+
}
|
|
1424
|
+
cancelDrag.current = cancel;
|
|
1425
|
+
document.addEventListener("mousemove", move);
|
|
1426
|
+
document.addEventListener("mouseup", cancel, true);
|
|
1427
|
+
window.addEventListener("blur", cancel);
|
|
1377
1428
|
}
|
|
1378
1429
|
const renderedControls = controls === true ? /* @__PURE__ */ jsx9(
|
|
1379
1430
|
WindowControls,
|
|
@@ -1405,7 +1456,7 @@ function WindowTitleBar({
|
|
|
1405
1456
|
}
|
|
1406
1457
|
|
|
1407
1458
|
// src/components/Drawer.tsx
|
|
1408
|
-
import { createContext, forwardRef, useCallback, useContext, useEffect as
|
|
1459
|
+
import { createContext, forwardRef, useCallback, useContext, useEffect as useEffect5, useId as useId2, useMemo as useMemo3, useRef as useRef7, useState as useState8 } from "react";
|
|
1409
1460
|
import { createRoot } from "react-dom/client";
|
|
1410
1461
|
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1411
1462
|
var drawerHandles = /* @__PURE__ */ new Set();
|
|
@@ -1441,13 +1492,13 @@ var DrawerRoot = forwardRef(function Drawer({
|
|
|
1441
1492
|
style,
|
|
1442
1493
|
...props
|
|
1443
1494
|
}, forwardedRef) {
|
|
1444
|
-
const localRef =
|
|
1445
|
-
const bodyRef =
|
|
1495
|
+
const localRef = useRef7(null);
|
|
1496
|
+
const bodyRef = useRef7(null);
|
|
1446
1497
|
const titleId = useId2();
|
|
1447
1498
|
const drawerId = useId2();
|
|
1448
1499
|
const parentStack = useContext(DrawerStackContext);
|
|
1449
|
-
const afterOpenRef =
|
|
1450
|
-
const afterCloseRef =
|
|
1500
|
+
const afterOpenRef = useRef7(afterOpen);
|
|
1501
|
+
const afterCloseRef = useRef7(afterClose);
|
|
1451
1502
|
afterOpenRef.current = afterOpen;
|
|
1452
1503
|
afterCloseRef.current = afterClose;
|
|
1453
1504
|
const [rendered, setRendered] = useState8(open);
|
|
@@ -1464,7 +1515,7 @@ var DrawerRoot = forwardRef(function Drawer({
|
|
|
1464
1515
|
});
|
|
1465
1516
|
}, []);
|
|
1466
1517
|
const stackContextValue = useMemo3(() => ({ setChildOpen }), [setChildOpen]);
|
|
1467
|
-
|
|
1518
|
+
useEffect5(() => {
|
|
1468
1519
|
if (open) {
|
|
1469
1520
|
setRendered(true);
|
|
1470
1521
|
setClosing(false);
|
|
@@ -1479,12 +1530,12 @@ var DrawerRoot = forwardRef(function Drawer({
|
|
|
1479
1530
|
}, DRAWER_MOTION_DURATION);
|
|
1480
1531
|
return () => window.clearTimeout(timer);
|
|
1481
1532
|
}, [open, rendered]);
|
|
1482
|
-
|
|
1533
|
+
useEffect5(() => {
|
|
1483
1534
|
if (!open || !rendered) return void 0;
|
|
1484
1535
|
const timer = window.setTimeout(() => afterOpenRef.current?.(), DRAWER_MOTION_DURATION);
|
|
1485
1536
|
return () => window.clearTimeout(timer);
|
|
1486
1537
|
}, [open, rendered]);
|
|
1487
|
-
|
|
1538
|
+
useEffect5(() => {
|
|
1488
1539
|
if (!parentStack) return void 0;
|
|
1489
1540
|
parentStack.setChildOpen(drawerId, open);
|
|
1490
1541
|
return () => parentStack.setChildOpen(drawerId, false);
|
|
@@ -1610,7 +1661,7 @@ var Drawer2 = Object.assign(DrawerRoot, {
|
|
|
1610
1661
|
});
|
|
1611
1662
|
|
|
1612
1663
|
// src/components/Form.tsx
|
|
1613
|
-
import { Children as Children3, cloneElement as cloneElement2, createContext as createContext2, forwardRef as forwardRef2, isValidElement as isValidElement2, useContext as useContext2, useEffect as
|
|
1664
|
+
import { Children as Children3, cloneElement as cloneElement2, createContext as createContext2, forwardRef as forwardRef2, isValidElement as isValidElement2, useContext as useContext2, useEffect as useEffect6, useId as useId3, useLayoutEffect as useLayoutEffect3, useMemo as useMemo4, useRef as useRef8, useSyncExternalStore } from "react";
|
|
1614
1665
|
import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1615
1666
|
var Switch = forwardRef2(function Switch2({
|
|
1616
1667
|
label,
|
|
@@ -1843,7 +1894,7 @@ var FormStore = class {
|
|
|
1843
1894
|
};
|
|
1844
1895
|
var FormContext = createContext2(null);
|
|
1845
1896
|
function useForm(form) {
|
|
1846
|
-
const ref =
|
|
1897
|
+
const ref = useRef8(form ?? new FormStore());
|
|
1847
1898
|
return [ref.current];
|
|
1848
1899
|
}
|
|
1849
1900
|
function FormRoot({
|
|
@@ -1867,7 +1918,7 @@ function FormRoot({
|
|
|
1867
1918
|
const instance = internalForm;
|
|
1868
1919
|
instance.configure(initialValues, { onFinish, onFinishFailed, onValuesChange });
|
|
1869
1920
|
const context = useMemo4(() => instance, [instance]);
|
|
1870
|
-
const formRef =
|
|
1921
|
+
const formRef = useRef8(null);
|
|
1871
1922
|
useLayoutEffect3(() => {
|
|
1872
1923
|
const root = formRef.current;
|
|
1873
1924
|
if (!root) return;
|
|
@@ -1932,6 +1983,7 @@ function defaultEventValue(valuePropName, args) {
|
|
|
1932
1983
|
function FormItem({
|
|
1933
1984
|
name,
|
|
1934
1985
|
label,
|
|
1986
|
+
align = "start",
|
|
1935
1987
|
rules = [],
|
|
1936
1988
|
required,
|
|
1937
1989
|
extra,
|
|
@@ -1947,7 +1999,7 @@ function FormItem({
|
|
|
1947
1999
|
}) {
|
|
1948
2000
|
const form = useContext2(FormContext);
|
|
1949
2001
|
const id = useId3();
|
|
1950
|
-
const itemRef =
|
|
2002
|
+
const itemRef = useRef8(null);
|
|
1951
2003
|
if (!form) throw new Error("Form.Item \u5FC5\u987B\u5728 Form \u5185\u4F7F\u7528");
|
|
1952
2004
|
useSyncExternalStore(form.subscribe, form.getSnapshot, form.getSnapshot);
|
|
1953
2005
|
const path = name === void 0 ? void 0 : pathArray(name);
|
|
@@ -1958,7 +2010,7 @@ function FormItem({
|
|
|
1958
2010
|
const helpContent = help ?? errors[0];
|
|
1959
2011
|
const labelId = label && !noStyle ? `${id}-label` : void 0;
|
|
1960
2012
|
const errorId = `${id}-error`;
|
|
1961
|
-
|
|
2013
|
+
useEffect6(() => {
|
|
1962
2014
|
if (!path) return void 0;
|
|
1963
2015
|
return form.registerField({
|
|
1964
2016
|
name: path,
|
|
@@ -2004,7 +2056,7 @@ function FormItem({
|
|
|
2004
2056
|
if (noStyle) return /* @__PURE__ */ jsx11(Fragment3, { children: content });
|
|
2005
2057
|
const inputWrap = /* @__PURE__ */ jsx11("div", { className: "sia-form-item__input-wrap", children: content });
|
|
2006
2058
|
const hasError = status === "error" && Boolean(helpContent);
|
|
2007
|
-
return /* @__PURE__ */ jsxs11("div", { ref: itemRef, className: `sia-form-item${status ? ` sia-form-item--${status}` : ""} ${className}`.trim(), "data-sia-form-field": key || void 0, children: [
|
|
2059
|
+
return /* @__PURE__ */ jsxs11("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: [
|
|
2008
2060
|
label ? /* @__PURE__ */ jsx11("div", { id: labelId, className: "sia-form-item__label", children: /* @__PURE__ */ jsxs11("span", { className: "sia-form-item__label-content", children: [
|
|
2009
2061
|
ruleRequired ? /* @__PURE__ */ jsx11("span", { className: "sia-form-item__required-mark", "aria-hidden": "true", children: "*" }) : null,
|
|
2010
2062
|
label
|
|
@@ -2274,7 +2326,7 @@ function Slider({
|
|
|
2274
2326
|
}
|
|
2275
2327
|
|
|
2276
2328
|
// src/components/ColorPicker.tsx
|
|
2277
|
-
import { useEffect as
|
|
2329
|
+
import { useEffect as useEffect7, useRef as useRef9, useState as useState10 } from "react";
|
|
2278
2330
|
import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2279
2331
|
var DEFAULT_MODES = ["solid", "gradient"];
|
|
2280
2332
|
var gradientStopSeed = 0;
|
|
@@ -2365,9 +2417,9 @@ function ColorPicker({
|
|
|
2365
2417
|
...props
|
|
2366
2418
|
}) {
|
|
2367
2419
|
const size = useControlSize(sizeProp);
|
|
2368
|
-
const rootRef =
|
|
2369
|
-
const popupRef =
|
|
2370
|
-
const lastEmittedValue =
|
|
2420
|
+
const rootRef = useRef9(null);
|
|
2421
|
+
const popupRef = useRef9(null);
|
|
2422
|
+
const lastEmittedValue = useRef9();
|
|
2371
2423
|
const initialGradient = parseGradient(value ?? defaultValue);
|
|
2372
2424
|
const initialSolid = initialGradient?.stops[0]?.color ?? normalizeHex(value || defaultValue);
|
|
2373
2425
|
const [open, setOpen] = useState10(false);
|
|
@@ -2391,7 +2443,7 @@ function ColorPicker({
|
|
|
2391
2443
|
const hsv = rgbToHsv(rgba);
|
|
2392
2444
|
const [hexDraft, setHexDraft] = useState10(editingColor);
|
|
2393
2445
|
const gradientValue = formatGradient(gradientAngle, gradientStops);
|
|
2394
|
-
|
|
2446
|
+
useEffect7(() => {
|
|
2395
2447
|
if (!open) return void 0;
|
|
2396
2448
|
const close = (event) => {
|
|
2397
2449
|
const target = event.target;
|
|
@@ -2400,10 +2452,10 @@ function ColorPicker({
|
|
|
2400
2452
|
document.addEventListener("pointerdown", close);
|
|
2401
2453
|
return () => document.removeEventListener("pointerdown", close);
|
|
2402
2454
|
}, [open]);
|
|
2403
|
-
|
|
2455
|
+
useEffect7(() => {
|
|
2404
2456
|
setHexDraft(editingColor);
|
|
2405
2457
|
}, [editingColor]);
|
|
2406
|
-
|
|
2458
|
+
useEffect7(() => {
|
|
2407
2459
|
if (value === void 0 || value === lastEmittedValue.current) return;
|
|
2408
2460
|
const parsed = parseGradient(value);
|
|
2409
2461
|
if (parsed) {
|
|
@@ -2590,7 +2642,7 @@ function ColorPicker({
|
|
|
2590
2642
|
}
|
|
2591
2643
|
|
|
2592
2644
|
// src/components/TimePicker.tsx
|
|
2593
|
-
import { useEffect as
|
|
2645
|
+
import { useEffect as useEffect8, useId as useId5, useRef as useRef10, useState as useState11 } from "react";
|
|
2594
2646
|
import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2595
2647
|
function seconds(value) {
|
|
2596
2648
|
const [h = 0, m = 0, s = 0] = value.split(":").map(Number);
|
|
@@ -2621,10 +2673,10 @@ function TimePicker({
|
|
|
2621
2673
|
}) {
|
|
2622
2674
|
const size = useControlSize(sizeProp);
|
|
2623
2675
|
const id = useId5();
|
|
2624
|
-
const rootRef =
|
|
2625
|
-
const inputRef =
|
|
2626
|
-
const popupRef =
|
|
2627
|
-
const focusPanel =
|
|
2676
|
+
const rootRef = useRef10(null);
|
|
2677
|
+
const inputRef = useRef10(null);
|
|
2678
|
+
const popupRef = useRef10(null);
|
|
2679
|
+
const focusPanel = useRef10(false);
|
|
2628
2680
|
const [currentValue, setValue2] = useControllableState({ value, defaultValue, onChange });
|
|
2629
2681
|
const [open, setOpen] = useState11(false);
|
|
2630
2682
|
const [draft, setDraft] = useState11("00:00:00");
|
|
@@ -2645,7 +2697,7 @@ function TimePicker({
|
|
|
2645
2697
|
setOpen(next);
|
|
2646
2698
|
onOpenChange?.(next);
|
|
2647
2699
|
}
|
|
2648
|
-
|
|
2700
|
+
useEffect8(() => {
|
|
2649
2701
|
if (!open) return;
|
|
2650
2702
|
if (focusPanel.current) {
|
|
2651
2703
|
popupRef.current?.querySelector('[aria-selected="true"]')?.focus();
|
|
@@ -2764,7 +2816,7 @@ function TimeRangePicker({ value, defaultValue = ["", ""], placeholder = ["\u5F0
|
|
|
2764
2816
|
})(TimePicker || (TimePicker = {}));
|
|
2765
2817
|
|
|
2766
2818
|
// src/components/TreeSelect.tsx
|
|
2767
|
-
import { useEffect as
|
|
2819
|
+
import { useEffect as useEffect9, useMemo as useMemo6, useRef as useRef11, useState as useState12 } from "react";
|
|
2768
2820
|
import { Fragment as Fragment4, jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2769
2821
|
function flattenTree(nodes, expanded, search, filter, depth = 0, parents = [], ancestorMatched = false) {
|
|
2770
2822
|
const result = [];
|
|
@@ -2827,8 +2879,8 @@ function TreeSelect({
|
|
|
2827
2879
|
...props
|
|
2828
2880
|
}) {
|
|
2829
2881
|
const size = useControlSize(sizeProp);
|
|
2830
|
-
const rootRef =
|
|
2831
|
-
const popupRef =
|
|
2882
|
+
const rootRef = useRef11(null);
|
|
2883
|
+
const popupRef = useRef11(null);
|
|
2832
2884
|
const nodeIndex = useMemo6(() => {
|
|
2833
2885
|
const index = /* @__PURE__ */ new Map();
|
|
2834
2886
|
const visit = (nodes) => nodes.forEach((node) => {
|
|
@@ -2864,7 +2916,7 @@ function TreeSelect({
|
|
|
2864
2916
|
const expandedSet = treeExpandedKeys ? new Set(treeExpandedKeys) : expanded;
|
|
2865
2917
|
const selectedNodes = resolveNodes(selectedValues);
|
|
2866
2918
|
const visibleNodes = flattenTree(treeData, expandedSet, search, filterTreeNode);
|
|
2867
|
-
|
|
2919
|
+
useEffect9(() => {
|
|
2868
2920
|
if (!open || treeExpandedKeys) return;
|
|
2869
2921
|
const keys = new Set(expanded);
|
|
2870
2922
|
const walk = (nodes, parents) => nodes.forEach((node) => {
|
|
@@ -2924,7 +2976,7 @@ function TreeSelect({
|
|
|
2924
2976
|
setCurrentValue(multi ? [] : void 0);
|
|
2925
2977
|
onClear?.();
|
|
2926
2978
|
}
|
|
2927
|
-
|
|
2979
|
+
useEffect9(() => {
|
|
2928
2980
|
if (!open) return void 0;
|
|
2929
2981
|
const close = (event) => {
|
|
2930
2982
|
const target = event.target;
|
|
@@ -3083,7 +3135,7 @@ function buildFlatTree(items, options = {}) {
|
|
|
3083
3135
|
}
|
|
3084
3136
|
|
|
3085
3137
|
// src/components/Editor.tsx
|
|
3086
|
-
import { useEffect as
|
|
3138
|
+
import { useEffect as useEffect10, useId as useId6, useRef as useRef12, useState as useState13 } from "react";
|
|
3087
3139
|
import EditorWorker from "monaco-editor/editor/editor.worker.js?worker";
|
|
3088
3140
|
|
|
3089
3141
|
// src/components/jsonLanguage.ts
|
|
@@ -3759,27 +3811,27 @@ function Editor({
|
|
|
3759
3811
|
loadingText = "\u6B63\u5728\u52A0\u8F7D\u7F16\u8F91\u5668\u2026"
|
|
3760
3812
|
}) {
|
|
3761
3813
|
const generatedId = useId6();
|
|
3762
|
-
const containerRef =
|
|
3763
|
-
const rangeHighlightRef =
|
|
3764
|
-
const editorRef =
|
|
3765
|
-
const modelRef =
|
|
3766
|
-
const apiRef =
|
|
3767
|
-
const applyingControlledValueRef =
|
|
3768
|
-
const updateHighlightRef =
|
|
3769
|
-
const changeHandlerRef =
|
|
3770
|
-
const readyHandlerRef =
|
|
3771
|
-
const selectionHandlerRef =
|
|
3772
|
-
const keyDownHandlerRef =
|
|
3773
|
-
const highlightRangeRef =
|
|
3774
|
-
const markersRef =
|
|
3775
|
-
const contextMenuItemsRef =
|
|
3776
|
-
const completionProviderRef =
|
|
3777
|
-
const refreshSuggestionOnSpaceRef =
|
|
3778
|
-
const initialValueRef =
|
|
3779
|
-
const initialLanguageRef =
|
|
3780
|
-
const initialPathRef =
|
|
3781
|
-
const initialThemeRef =
|
|
3782
|
-
const initialOptionsRef =
|
|
3814
|
+
const containerRef = useRef12(null);
|
|
3815
|
+
const rangeHighlightRef = useRef12(null);
|
|
3816
|
+
const editorRef = useRef12(null);
|
|
3817
|
+
const modelRef = useRef12(null);
|
|
3818
|
+
const apiRef = useRef12(null);
|
|
3819
|
+
const applyingControlledValueRef = useRef12(false);
|
|
3820
|
+
const updateHighlightRef = useRef12(() => void 0);
|
|
3821
|
+
const changeHandlerRef = useRef12(onChange);
|
|
3822
|
+
const readyHandlerRef = useRef12(onReady);
|
|
3823
|
+
const selectionHandlerRef = useRef12(onSelectionChange);
|
|
3824
|
+
const keyDownHandlerRef = useRef12(onKeyDown);
|
|
3825
|
+
const highlightRangeRef = useRef12(highlightRange);
|
|
3826
|
+
const markersRef = useRef12(markers);
|
|
3827
|
+
const contextMenuItemsRef = useRef12(contextMenuItems);
|
|
3828
|
+
const completionProviderRef = useRef12(completionProvider);
|
|
3829
|
+
const refreshSuggestionOnSpaceRef = useRef12(refreshSuggestionOnSpace);
|
|
3830
|
+
const initialValueRef = useRef12(value);
|
|
3831
|
+
const initialLanguageRef = useRef12(language);
|
|
3832
|
+
const initialPathRef = useRef12(path);
|
|
3833
|
+
const initialThemeRef = useRef12(theme);
|
|
3834
|
+
const initialOptionsRef = useRef12(options);
|
|
3783
3835
|
const [loading, setLoading] = useState13(true);
|
|
3784
3836
|
const [, setSelectionVersion] = useState13(0);
|
|
3785
3837
|
initialValueRef.current = value;
|
|
@@ -3796,7 +3848,7 @@ function Editor({
|
|
|
3796
3848
|
contextMenuItemsRef.current = contextMenuItems;
|
|
3797
3849
|
completionProviderRef.current = completionProvider;
|
|
3798
3850
|
refreshSuggestionOnSpaceRef.current = refreshSuggestionOnSpace;
|
|
3799
|
-
|
|
3851
|
+
useEffect10(() => {
|
|
3800
3852
|
let disposed = false;
|
|
3801
3853
|
const subscriptions = [];
|
|
3802
3854
|
async function mountEditor() {
|
|
@@ -4140,7 +4192,7 @@ function Editor({
|
|
|
4140
4192
|
updateHighlightRef.current = () => void 0;
|
|
4141
4193
|
};
|
|
4142
4194
|
}, [generatedId]);
|
|
4143
|
-
|
|
4195
|
+
useEffect10(() => {
|
|
4144
4196
|
const model = modelRef.current;
|
|
4145
4197
|
if (!model || model.getValue() === value) return;
|
|
4146
4198
|
applyingControlledValueRef.current = true;
|
|
@@ -4150,7 +4202,7 @@ function Editor({
|
|
|
4150
4202
|
applyingControlledValueRef.current = false;
|
|
4151
4203
|
}
|
|
4152
4204
|
}, [loading, value]);
|
|
4153
|
-
|
|
4205
|
+
useEffect10(() => {
|
|
4154
4206
|
if (loading) return;
|
|
4155
4207
|
void loadMonaco().then((monaco) => {
|
|
4156
4208
|
const model = modelRef.current;
|
|
@@ -4159,7 +4211,7 @@ function Editor({
|
|
|
4159
4211
|
}, [language, loading]);
|
|
4160
4212
|
const completionEnabled = Boolean(completionProvider);
|
|
4161
4213
|
const completionTriggerKey = completionTriggerCharacters.join("\0");
|
|
4162
|
-
|
|
4214
|
+
useEffect10(() => {
|
|
4163
4215
|
if (loading || !completionEnabled) return void 0;
|
|
4164
4216
|
let disposed = false;
|
|
4165
4217
|
let subscription;
|
|
@@ -4233,23 +4285,23 @@ function Editor({
|
|
|
4233
4285
|
subscription?.dispose();
|
|
4234
4286
|
};
|
|
4235
4287
|
}, [completionEnabled, completionTriggerKey, language, loading]);
|
|
4236
|
-
|
|
4288
|
+
useEffect10(() => {
|
|
4237
4289
|
if (loading) return;
|
|
4238
4290
|
void loadMonaco().then((monaco) => {
|
|
4239
4291
|
if (editorRef.current) monaco.editor.setTheme(theme === "dark" ? "vs-dark" : "vs");
|
|
4240
4292
|
});
|
|
4241
4293
|
}, [loading, theme]);
|
|
4242
|
-
|
|
4294
|
+
useEffect10(() => {
|
|
4243
4295
|
if (loading) return;
|
|
4244
4296
|
editorRef.current?.updateOptions({
|
|
4245
4297
|
...options ?? {},
|
|
4246
4298
|
contextmenu: contextMenuItems.length === 0 ? options?.contextmenu ?? true : false
|
|
4247
4299
|
});
|
|
4248
4300
|
}, [contextMenuItems.length, loading, options]);
|
|
4249
|
-
|
|
4301
|
+
useEffect10(() => {
|
|
4250
4302
|
updateHighlightRef.current();
|
|
4251
4303
|
}, [highlightRange]);
|
|
4252
|
-
|
|
4304
|
+
useEffect10(() => {
|
|
4253
4305
|
if (loading) return;
|
|
4254
4306
|
void loadMonaco().then((monaco) => {
|
|
4255
4307
|
const model = modelRef.current;
|
|
@@ -4317,19 +4369,19 @@ function Editor({
|
|
|
4317
4369
|
}
|
|
4318
4370
|
|
|
4319
4371
|
// src/components/Markdown.tsx
|
|
4320
|
-
import { useEffect as
|
|
4372
|
+
import { useEffect as useEffect11, useMemo as useMemo7, useRef as useRef13, useState as useState14 } from "react";
|
|
4321
4373
|
import DOMPurify from "dompurify";
|
|
4322
4374
|
import { marked } from "marked";
|
|
4323
4375
|
import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4324
4376
|
function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", resolveImageSrc, imagePreview = true, className = "", onClick, onKeyDown, ...props }) {
|
|
4325
|
-
const rootRef =
|
|
4377
|
+
const rootRef = useRef13(null);
|
|
4326
4378
|
const [previewImage, setPreviewImage] = useState14(null);
|
|
4327
4379
|
const html = useMemo7(() => {
|
|
4328
4380
|
const rendered = marked.parse(content, { breaks: true, gfm: true });
|
|
4329
4381
|
const sanitized = DOMPurify.sanitize(rendered, { USE_PROFILES: { html: true } });
|
|
4330
4382
|
return sanitized.replace(/<img\b/giu, '<img loading="lazy" decoding="async" referrerpolicy="no-referrer"');
|
|
4331
4383
|
}, [content]);
|
|
4332
|
-
|
|
4384
|
+
useEffect11(() => {
|
|
4333
4385
|
const root = rootRef.current;
|
|
4334
4386
|
if (!root) return void 0;
|
|
4335
4387
|
let cancelled = false;
|
|
@@ -4397,7 +4449,7 @@ function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", r
|
|
|
4397
4449
|
}
|
|
4398
4450
|
|
|
4399
4451
|
// src/components/InputNumber.tsx
|
|
4400
|
-
import { forwardRef as forwardRef4, useEffect as
|
|
4452
|
+
import { forwardRef as forwardRef4, useEffect as useEffect12, useId as useId7, useRef as useRef14, useState as useState15 } from "react";
|
|
4401
4453
|
import { jsx as jsx19, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4402
4454
|
function formatValue(value, precision) {
|
|
4403
4455
|
if (value === null || !Number.isFinite(value)) return "";
|
|
@@ -4431,14 +4483,14 @@ var InputNumber = forwardRef4(function InputNumber2({
|
|
|
4431
4483
|
const size = useControlSize(sizeProp);
|
|
4432
4484
|
const fallbackId = useId7();
|
|
4433
4485
|
const inputId = id ?? fallbackId;
|
|
4434
|
-
const localRef =
|
|
4486
|
+
const localRef = useRef14(null);
|
|
4435
4487
|
const [currentValue, setCurrentValue] = useControllableState({ value, defaultValue, onChange });
|
|
4436
4488
|
const displayValue = (next) => {
|
|
4437
4489
|
const plain = formatValue(next, precision);
|
|
4438
4490
|
return plain && formatter ? formatter(plain) : plain;
|
|
4439
4491
|
};
|
|
4440
4492
|
const [text, setText] = useState15(() => displayValue(currentValue));
|
|
4441
|
-
|
|
4493
|
+
useEffect12(() => {
|
|
4442
4494
|
setText(displayValue(currentValue));
|
|
4443
4495
|
}, [currentValue, precision, formatter]);
|
|
4444
4496
|
function setRef(node) {
|
|
@@ -4673,7 +4725,7 @@ function openSelectModal(config) {
|
|
|
4673
4725
|
}
|
|
4674
4726
|
|
|
4675
4727
|
// src/components/Treemap.tsx
|
|
4676
|
-
import { useEffect as
|
|
4728
|
+
import { useEffect as useEffect13, useMemo as useMemo8, useRef as useRef15, useState as useState17 } from "react";
|
|
4677
4729
|
import { jsx as jsx21, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4678
4730
|
import { createElement } from "react";
|
|
4679
4731
|
function positiveValue(value) {
|
|
@@ -5046,7 +5098,7 @@ function Treemap({
|
|
|
5046
5098
|
style,
|
|
5047
5099
|
...props
|
|
5048
5100
|
}) {
|
|
5049
|
-
const containerRef =
|
|
5101
|
+
const containerRef = useRef15(null);
|
|
5050
5102
|
const [size, setSize] = useState17({ width: 0, height: 0 });
|
|
5051
5103
|
const [internalExpandedKeys, setInternalExpandedKeys] = useState17(() => [...defaultExpandedKeys]);
|
|
5052
5104
|
const [internalFocusedKey, setInternalFocusedKey] = useState17(defaultFocusedKey);
|
|
@@ -5074,7 +5126,7 @@ function Treemap({
|
|
|
5074
5126
|
),
|
|
5075
5127
|
[activeKey, aggregateOverflow, data, effectiveFocusedNode, expandedSet, gap, headerHeight, maxVisibleNodes, minTileHeight, minTileWidth, overflowLabel, size]
|
|
5076
5128
|
);
|
|
5077
|
-
|
|
5129
|
+
useEffect13(() => {
|
|
5078
5130
|
const element = containerRef.current;
|
|
5079
5131
|
if (!element) return void 0;
|
|
5080
5132
|
const updateSize = () => {
|
|
@@ -5086,7 +5138,7 @@ function Treemap({
|
|
|
5086
5138
|
observer.observe(element);
|
|
5087
5139
|
return () => observer.disconnect();
|
|
5088
5140
|
}, []);
|
|
5089
|
-
|
|
5141
|
+
useEffect13(() => {
|
|
5090
5142
|
if (!currentFocusedKey || effectiveFocusedNode) return;
|
|
5091
5143
|
if (focusedKey === void 0) setInternalFocusedKey(null);
|
|
5092
5144
|
onFocusedChange?.(null);
|
|
@@ -5199,7 +5251,7 @@ function Treemap({
|
|
|
5199
5251
|
}
|
|
5200
5252
|
|
|
5201
5253
|
// src/components/Table/TableCellContent.tsx
|
|
5202
|
-
import { useLayoutEffect as useLayoutEffect4, useRef as
|
|
5254
|
+
import { useLayoutEffect as useLayoutEffect4, useRef as useRef16, useState as useState18 } from "react";
|
|
5203
5255
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
5204
5256
|
var pendingLayouts = /* @__PURE__ */ new Map();
|
|
5205
5257
|
var layoutFrame;
|
|
@@ -5218,7 +5270,7 @@ function scheduleLayout(element, task) {
|
|
|
5218
5270
|
});
|
|
5219
5271
|
}
|
|
5220
5272
|
function TableCellContent({ children, ellipsis, title }) {
|
|
5221
|
-
const ref =
|
|
5273
|
+
const ref = useRef16(null);
|
|
5222
5274
|
const [overflowing, setOverflowing] = useState18(false);
|
|
5223
5275
|
const customContent = typeof children !== "string" && typeof children !== "number" && children != null;
|
|
5224
5276
|
useLayoutEffect4(() => {
|
|
@@ -5335,7 +5387,7 @@ function useRemainingHeight(rootRef, options) {
|
|
|
5335
5387
|
}
|
|
5336
5388
|
|
|
5337
5389
|
// src/components/Table/TableCanvasLayer.tsx
|
|
5338
|
-
import { useLayoutEffect as useLayoutEffect6, useRef as
|
|
5390
|
+
import { useLayoutEffect as useLayoutEffect6, useRef as useRef17 } from "react";
|
|
5339
5391
|
|
|
5340
5392
|
// src/components/Table/utils.ts
|
|
5341
5393
|
var AUTO_WIDTH_COLUMN_KEYS = /* @__PURE__ */ new Set(["action", "actions", "operation", "operations"]);
|
|
@@ -5390,7 +5442,7 @@ function toTablePageParams(current, pageSize) {
|
|
|
5390
5442
|
// src/components/Table/TableCanvasLayer.tsx
|
|
5391
5443
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
5392
5444
|
function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHeight }) {
|
|
5393
|
-
const canvasRef =
|
|
5445
|
+
const canvasRef = useRef17(null);
|
|
5394
5446
|
useLayoutEffect6(() => {
|
|
5395
5447
|
const canvas = canvasRef.current;
|
|
5396
5448
|
const scroller = viewport.current;
|
|
@@ -5534,10 +5586,10 @@ function createRowIdentity() {
|
|
|
5534
5586
|
}
|
|
5535
5587
|
|
|
5536
5588
|
// src/components/Table/Table.tsx
|
|
5537
|
-
import { Fragment as Fragment8, forwardRef as forwardRef5, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as
|
|
5589
|
+
import { Fragment as Fragment8, forwardRef as forwardRef5, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as useEffect15, useImperativeHandle, useMemo as useMemo9, useRef as useRef19, useState as useState21 } from "react";
|
|
5538
5590
|
|
|
5539
5591
|
// src/components/Table/plugins.tsx
|
|
5540
|
-
import { isValidElement as isValidElement3, useEffect as
|
|
5592
|
+
import { isValidElement as isValidElement3, useEffect as useEffect14, useRef as useRef18, useState as useState20 } from "react";
|
|
5541
5593
|
|
|
5542
5594
|
// src/components/Table/columnSettings.ts
|
|
5543
5595
|
function reconcileColumnSettings(columns, defaults, saved) {
|
|
@@ -6659,7 +6711,7 @@ function TableFilterControl({
|
|
|
6659
6711
|
const [open, setOpen] = useState20(false);
|
|
6660
6712
|
const [draft, setDraft] = useState20(value);
|
|
6661
6713
|
const label = getColumnLabel(column);
|
|
6662
|
-
|
|
6714
|
+
useEffect14(() => {
|
|
6663
6715
|
if (open) setDraft(value);
|
|
6664
6716
|
}, [open, value]);
|
|
6665
6717
|
const apply = (nextValue) => {
|
|
@@ -7099,15 +7151,15 @@ function EditableTableCell({
|
|
|
7099
7151
|
const config = typeof editable === "object" ? editable : { type: "input" };
|
|
7100
7152
|
const [editValue, setEditValue] = useState20(value);
|
|
7101
7153
|
const [saving, setSaving] = useState20(false);
|
|
7102
|
-
const inputRef =
|
|
7103
|
-
const editorRef =
|
|
7104
|
-
const editValueRef =
|
|
7105
|
-
const savingRef =
|
|
7106
|
-
const saveRef =
|
|
7154
|
+
const inputRef = useRef18(null);
|
|
7155
|
+
const editorRef = useRef18(null);
|
|
7156
|
+
const editValueRef = useRef18(value);
|
|
7157
|
+
const savingRef = useRef18(false);
|
|
7158
|
+
const saveRef = useRef18(
|
|
7107
7159
|
async () => {
|
|
7108
7160
|
}
|
|
7109
7161
|
);
|
|
7110
|
-
|
|
7162
|
+
useEffect14(() => {
|
|
7111
7163
|
if (!active) return;
|
|
7112
7164
|
editValueRef.current = value;
|
|
7113
7165
|
setEditValue(value);
|
|
@@ -7138,7 +7190,7 @@ function EditableTableCell({
|
|
|
7138
7190
|
}
|
|
7139
7191
|
}
|
|
7140
7192
|
saveRef.current = save;
|
|
7141
|
-
|
|
7193
|
+
useEffect14(() => {
|
|
7142
7194
|
if (!active || config.type === "select" || config.type === "custom") return;
|
|
7143
7195
|
const handleOutsidePointerDown = (event) => {
|
|
7144
7196
|
const target = event.target;
|
|
@@ -7444,14 +7496,14 @@ function ColumnSettingPanel({
|
|
|
7444
7496
|
onApply
|
|
7445
7497
|
}) {
|
|
7446
7498
|
const [draft, setDraft] = useState20(items);
|
|
7447
|
-
const listRef =
|
|
7448
|
-
const cancelDrag =
|
|
7499
|
+
const listRef = useRef18(null);
|
|
7500
|
+
const cancelDrag = useRef18(null);
|
|
7449
7501
|
const [preview, setPreview] = useState20(null);
|
|
7450
|
-
|
|
7502
|
+
useEffect14(() => {
|
|
7451
7503
|
cancelDrag.current?.();
|
|
7452
7504
|
if (open) setDraft(orderColumnSettings(items));
|
|
7453
7505
|
}, [items, open]);
|
|
7454
|
-
|
|
7506
|
+
useEffect14(() => () => cancelDrag.current?.(), []);
|
|
7455
7507
|
const labels = new Map(
|
|
7456
7508
|
flattenTableColumns(columns).map((column) => [
|
|
7457
7509
|
column.key,
|
|
@@ -8274,12 +8326,12 @@ function TableInner(props, ref) {
|
|
|
8274
8326
|
style,
|
|
8275
8327
|
...htmlProps
|
|
8276
8328
|
} = props;
|
|
8277
|
-
const rootRef =
|
|
8329
|
+
const rootRef = useRef19(null);
|
|
8278
8330
|
const remainingHeight = useRemainingHeight(rootRef, height == null && tableHeight == null ? fillRemaining : false);
|
|
8279
|
-
const scrollRef =
|
|
8280
|
-
const tableRef =
|
|
8331
|
+
const scrollRef = useRef19(null);
|
|
8332
|
+
const tableRef = useRef19(null);
|
|
8281
8333
|
useScrollbarProximity();
|
|
8282
|
-
const scrollbarDragRef =
|
|
8334
|
+
const scrollbarDragRef = useRef19(null);
|
|
8283
8335
|
const [internalLoading, setInternalLoading] = useState21(false);
|
|
8284
8336
|
const [scrollTop, setScrollTop] = useState21(0);
|
|
8285
8337
|
const [scrollLeft, setScrollLeft] = useState21(0);
|
|
@@ -8301,14 +8353,14 @@ function TableInner(props, ref) {
|
|
|
8301
8353
|
return plugins;
|
|
8302
8354
|
}, [builtInHighlightPlugin, builtInResizePlugin, builtInCellSelectionPlugin, builtInIndexPlugin, providedPlugins, resizable, cellSelection, showIndex]);
|
|
8303
8355
|
const sortedPlugins = useMemo9(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
|
|
8304
|
-
const pluginsByIdRef =
|
|
8356
|
+
const pluginsByIdRef = useRef19(/* @__PURE__ */ new Map());
|
|
8305
8357
|
pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
8306
8358
|
const [pluginStates, setPluginStates] = useState21(() => Object.fromEntries(
|
|
8307
8359
|
sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
|
|
8308
8360
|
));
|
|
8309
|
-
const pluginApisRef =
|
|
8310
|
-
const contextsRef =
|
|
8311
|
-
const mountedPluginsRef =
|
|
8361
|
+
const pluginApisRef = useRef19({});
|
|
8362
|
+
const contextsRef = useRef19(/* @__PURE__ */ new Map());
|
|
8363
|
+
const mountedPluginsRef = useRef19(/* @__PURE__ */ new Map());
|
|
8312
8364
|
const pipeline = { columns: baseColumns, rows: createTableRows(dataSource, getRowKey) };
|
|
8313
8365
|
const nextApis = {};
|
|
8314
8366
|
const contexts = /* @__PURE__ */ new Map();
|
|
@@ -8365,7 +8417,7 @@ function TableInner(props, ref) {
|
|
|
8365
8417
|
});
|
|
8366
8418
|
pluginApisRef.current = nextApis;
|
|
8367
8419
|
contextsRef.current = contexts;
|
|
8368
|
-
|
|
8420
|
+
useEffect15(() => {
|
|
8369
8421
|
const activePlugins2 = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
8370
8422
|
for (const [pluginId, mounted] of mountedPluginsRef.current) {
|
|
8371
8423
|
if (activePlugins2.get(pluginId) === mounted.plugin) continue;
|
|
@@ -8377,7 +8429,7 @@ function TableInner(props, ref) {
|
|
|
8377
8429
|
mountedPluginsRef.current.set(plugin.id, { plugin, cleanup: plugin.onMount(contextsRef.current.get(plugin.id)) });
|
|
8378
8430
|
}
|
|
8379
8431
|
}, [sortedPlugins]);
|
|
8380
|
-
|
|
8432
|
+
useEffect15(() => () => {
|
|
8381
8433
|
for (const mounted of mountedPluginsRef.current.values()) mounted.cleanup?.();
|
|
8382
8434
|
mountedPluginsRef.current.clear();
|
|
8383
8435
|
}, []);
|
|
@@ -8421,7 +8473,7 @@ function TableInner(props, ref) {
|
|
|
8421
8473
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-size", `${verticalThumb}px`);
|
|
8422
8474
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-position", `${verticalPosition}px`);
|
|
8423
8475
|
}, []);
|
|
8424
|
-
|
|
8476
|
+
useEffect15(() => {
|
|
8425
8477
|
const element = scrollRef.current;
|
|
8426
8478
|
if (!element || typeof ResizeObserver === "undefined") return;
|
|
8427
8479
|
const observer = new ResizeObserver(() => {
|
|
@@ -8434,19 +8486,19 @@ function TableInner(props, ref) {
|
|
|
8434
8486
|
updateScrollMetrics();
|
|
8435
8487
|
return () => observer.disconnect();
|
|
8436
8488
|
}, [updateScrollMetrics]);
|
|
8437
|
-
|
|
8489
|
+
useEffect15(() => {
|
|
8438
8490
|
updateScrollMetrics();
|
|
8439
8491
|
});
|
|
8440
8492
|
const orderedColumns = useMemo9(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
|
|
8441
8493
|
const leafColumns = useMemo9(() => flattenTableColumns(orderedColumns), [orderedColumns]);
|
|
8442
8494
|
const headerRows = useMemo9(() => buildHeaderRows(orderedColumns), [orderedColumns]);
|
|
8443
|
-
const measuredCells =
|
|
8495
|
+
const measuredCells = useRef19(/* @__PURE__ */ new WeakSet());
|
|
8444
8496
|
const autoWidthSignature = leafColumns.map((column) => `${column.key}:${column.autoWidth}:${resizedWidths[column.key] ?? ""}`).join("|");
|
|
8445
|
-
|
|
8497
|
+
useEffect15(() => {
|
|
8446
8498
|
measuredCells.current = /* @__PURE__ */ new WeakSet();
|
|
8447
8499
|
setAutoColumnWidths({});
|
|
8448
8500
|
}, [dataSource, baseColumns, size, autoWidthSignature]);
|
|
8449
|
-
|
|
8501
|
+
useEffect15(() => {
|
|
8450
8502
|
const autoWidthColumns = leafColumns.filter((column) => column.autoWidth && resizedWidths[column.key] === void 0);
|
|
8451
8503
|
const root = rootRef.current;
|
|
8452
8504
|
if (!root || autoWidthColumns.length === 0) return;
|
|
@@ -8983,7 +9035,7 @@ function applySiaTheme(mode, target = document.documentElement) {
|
|
|
8983
9035
|
}
|
|
8984
9036
|
|
|
8985
9037
|
// src/components/InputSelect.tsx
|
|
8986
|
-
import { forwardRef as forwardRef7, useEffect as
|
|
9038
|
+
import { forwardRef as forwardRef7, useEffect as useEffect16, useRef as useRef20, useState as useState22 } from "react";
|
|
8987
9039
|
import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
8988
9040
|
var InputSelect = forwardRef7(function InputSelect2({
|
|
8989
9041
|
options,
|
|
@@ -9016,7 +9068,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
9016
9068
|
const values = current == null ? [] : Array.isArray(current) ? current : [current];
|
|
9017
9069
|
const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
|
|
9018
9070
|
const [draft, setDraft] = useState22(text);
|
|
9019
|
-
|
|
9071
|
+
useEffect16(() => {
|
|
9020
9072
|
setDraft(text);
|
|
9021
9073
|
}, [text, current]);
|
|
9022
9074
|
const [open, setOpen] = useState22(false);
|
|
@@ -9024,9 +9076,9 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
9024
9076
|
const [modalOpen, setModalOpen] = useState22(false);
|
|
9025
9077
|
const [modalValues, setModalValues] = useState22([]);
|
|
9026
9078
|
const [selectedOnly, setSelectedOnly] = useState22(false);
|
|
9027
|
-
const rootRef =
|
|
9028
|
-
const popupRef =
|
|
9029
|
-
const inputRef =
|
|
9079
|
+
const rootRef = useRef20(null);
|
|
9080
|
+
const popupRef = useRef20(null);
|
|
9081
|
+
const inputRef = useRef20(null);
|
|
9030
9082
|
const config = typeof enableModal === "object" ? enableModal : {};
|
|
9031
9083
|
function changeOpen(next) {
|
|
9032
9084
|
if (next && (disabled || loading)) return;
|
|
@@ -9046,7 +9098,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
9046
9098
|
inputRef.current?.focus();
|
|
9047
9099
|
}
|
|
9048
9100
|
}
|
|
9049
|
-
|
|
9101
|
+
useEffect16(() => {
|
|
9050
9102
|
if (!open) return;
|
|
9051
9103
|
const outside = (event) => {
|
|
9052
9104
|
if (!rootRef.current?.contains(event.target) && !popupRef.current?.contains(event.target)) changeOpen(false);
|
|
@@ -9054,7 +9106,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
9054
9106
|
document.addEventListener("pointerdown", outside);
|
|
9055
9107
|
return () => document.removeEventListener("pointerdown", outside);
|
|
9056
9108
|
}, [open, onOpenChange]);
|
|
9057
|
-
|
|
9109
|
+
useEffect16(() => {
|
|
9058
9110
|
if (disabled || loading) {
|
|
9059
9111
|
changeOpen(false);
|
|
9060
9112
|
setModalOpen(false);
|
|
@@ -9187,13 +9239,13 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
9187
9239
|
});
|
|
9188
9240
|
|
|
9189
9241
|
// src/components/QueryForm.tsx
|
|
9190
|
-
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect7, useRef as
|
|
9242
|
+
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect7, useRef as useRef23, useState as useState25 } from "react";
|
|
9191
9243
|
|
|
9192
9244
|
// src/components/QueryFormSettings.tsx
|
|
9193
|
-
import { useEffect as
|
|
9245
|
+
import { useEffect as useEffect18, useRef as useRef22, useState as useState24 } from "react";
|
|
9194
9246
|
|
|
9195
9247
|
// src/components/useQueryFieldSort.ts
|
|
9196
|
-
import { useEffect as
|
|
9248
|
+
import { useEffect as useEffect17, useRef as useRef21, useState as useState23 } from "react";
|
|
9197
9249
|
function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
9198
9250
|
const center = rects[from].top + rects[from].height / 2 + dy;
|
|
9199
9251
|
const rest = keys.map((_, index) => index).filter((index) => index !== from);
|
|
@@ -9212,13 +9264,13 @@ function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
|
9212
9264
|
return { ordered, offsets };
|
|
9213
9265
|
}
|
|
9214
9266
|
function useQueryFieldSort(keys, enabled, onCommit) {
|
|
9215
|
-
const listRef =
|
|
9216
|
-
const cancelRef =
|
|
9217
|
-
const commitRef =
|
|
9267
|
+
const listRef = useRef21(null);
|
|
9268
|
+
const cancelRef = useRef21();
|
|
9269
|
+
const commitRef = useRef21(onCommit);
|
|
9218
9270
|
commitRef.current = onCommit;
|
|
9219
9271
|
const [preview, setPreview] = useState23();
|
|
9220
9272
|
const signature = JSON.stringify(keys);
|
|
9221
|
-
|
|
9273
|
+
useEffect17(() => {
|
|
9222
9274
|
cancelRef.current?.();
|
|
9223
9275
|
return () => cancelRef.current?.();
|
|
9224
9276
|
}, [enabled, signature]);
|
|
@@ -9350,9 +9402,9 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
9350
9402
|
const [saving, setSaving] = useState24(false);
|
|
9351
9403
|
const [error, setError] = useState24("");
|
|
9352
9404
|
const [loadFailed, setLoadFailed] = useState24(false);
|
|
9353
|
-
const token =
|
|
9354
|
-
const saveLock =
|
|
9355
|
-
const latest =
|
|
9405
|
+
const token = useRef22(0);
|
|
9406
|
+
const saveLock = useRef22(false);
|
|
9407
|
+
const latest = useRef22({ config, fields, defaultCollapsed, applyCollapsed });
|
|
9356
9408
|
latest.current = { config, fields, defaultCollapsed, applyCollapsed };
|
|
9357
9409
|
const moduleName = config?.scope.moduleName;
|
|
9358
9410
|
const businessKey = config?.scope.businessKey;
|
|
@@ -9380,7 +9432,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
9380
9432
|
if (request === token.current) setLoading(false);
|
|
9381
9433
|
}
|
|
9382
9434
|
}
|
|
9383
|
-
|
|
9435
|
+
useEffect18(() => {
|
|
9384
9436
|
setSnapshot(void 0);
|
|
9385
9437
|
setOpen(false);
|
|
9386
9438
|
setError("");
|
|
@@ -9550,11 +9602,11 @@ function QueryForm({
|
|
|
9550
9602
|
const [saveError, setSaveError] = useState25("");
|
|
9551
9603
|
const [error, setError] = useState25("");
|
|
9552
9604
|
const [activeShortcut, setActiveShortcut] = useState25("");
|
|
9553
|
-
const source =
|
|
9554
|
-
const searchLock =
|
|
9555
|
-
const saveLock =
|
|
9556
|
-
const removeLock =
|
|
9557
|
-
const snapshot =
|
|
9605
|
+
const source = useRef23({ source: "submit" });
|
|
9606
|
+
const searchLock = useRef23(false);
|
|
9607
|
+
const saveLock = useRef23(false);
|
|
9608
|
+
const removeLock = useRef23(false);
|
|
9609
|
+
const snapshot = useRef23();
|
|
9558
9610
|
const busy = disabled || loading || searching;
|
|
9559
9611
|
const shortcutBusy = busy || shortcutsLoading || saving || removing;
|
|
9560
9612
|
const fieldLabel = (content) => {
|
|
@@ -9581,9 +9633,9 @@ function QueryForm({
|
|
|
9581
9633
|
const entries = configured.map((item) => ({ ...entriesByKey.get(item.key), visible: item.visible, visibleIndex: item.visible ? visibleIndex++ : -1 }));
|
|
9582
9634
|
const layoutKey = JSON.stringify(configured);
|
|
9583
9635
|
const limit = Math.max(1, Math.floor(collapsedCount));
|
|
9584
|
-
const rowRef =
|
|
9585
|
-
const actionsRef =
|
|
9586
|
-
const toggleRef =
|
|
9636
|
+
const rowRef = useRef23(null);
|
|
9637
|
+
const actionsRef = useRef23(null);
|
|
9638
|
+
const toggleRef = useRef23(null);
|
|
9587
9639
|
const [fittingCount, setFittingCount] = useState25(limit);
|
|
9588
9640
|
const [settingsRows, setSettingsRows] = useState25(0);
|
|
9589
9641
|
useLayoutEffect7(() => {
|