@sia.soul/sia-react-ui 0.1.113 → 0.1.115
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/{Select-Cf0xz1Tg.d.cts → Select-BAFXKVZB.d.cts} +1 -1
- package/dist/{Select-BddM4uXC.d.ts → Select-vjX7B63I.d.ts} +1 -1
- package/dist/{chunk-74LRPSE7.js → chunk-6XQ2LDGT.js} +2 -2
- package/dist/{chunk-KJWE5H3S.js → chunk-GNOZYUIH.js} +8 -5
- package/dist/{chunk-TENCZ54M.js → chunk-KPOK4HIQ.js} +11 -4
- package/dist/{chunk-SVAC7ZJP.js → chunk-MDU5EONC.js} +2 -2
- package/dist/{chunk-NOBJVU2S.js → chunk-SPIQSYWQ.js} +5 -2
- package/dist/{chunk-VFGQLRS6.js → chunk-XY7CXJS6.js} +42 -26
- package/dist/{core-CEaTbhWd.d.cts → core-O6oDXbkG.d.cts} +10 -6
- package/dist/{core-C6muCCSS.d.ts → core-uVaNwjTO.d.ts} +10 -6
- package/dist/core.cjs +55 -29
- package/dist/core.css +45 -8
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +4 -4
- package/dist/game.cjs +42 -26
- package/dist/game.js +1 -1
- package/dist/index.cjs +109 -42
- package/dist/index.css +76 -8
- package/dist/index.d.cts +9 -14
- package/dist/index.d.ts +9 -14
- package/dist/index.js +166 -128
- package/dist/rich-text-editor.cjs +46 -27
- package/dist/rich-text-editor.js +3 -3
- package/dist/{select-date-range-yGDEA1RP.d.ts → select-date-range-C9jlUrCX.d.ts} +1 -1
- package/dist/{select-date-range-Cm5o2xPp.d.cts → select-date-range-CIiI0F5o.d.cts} +1 -1
- package/dist/select-date-range.cjs +51 -28
- package/dist/select-date-range.d.cts +2 -2
- package/dist/select-date-range.d.ts +2 -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-GNOZYUIH.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-MDU5EONC.js";
|
|
93
93
|
import {
|
|
94
94
|
DatePicker,
|
|
95
95
|
SelectDateRange,
|
|
96
96
|
TimePanel
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-6XQ2LDGT.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-KPOK4HIQ.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-SPIQSYWQ.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-XY7CXJS6.js";
|
|
128
128
|
import {
|
|
129
129
|
Button
|
|
130
130
|
} from "./chunk-CZ2ITBRW.js";
|
|
@@ -142,15 +142,27 @@ import {
|
|
|
142
142
|
} from "./chunk-NZMUW5XI.js";
|
|
143
143
|
|
|
144
144
|
// src/components/CursorPreview.tsx
|
|
145
|
-
import { useEffect, useState } from "react";
|
|
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, height = 180, empty = "\u6682\u65E0\u6307\u9488\u9884\u89C8", alt = "\u9F20\u6807\u6307\u9488\u9884\u89C8", className = "", style, children, onPointerMove, onPointerLeave, ...props }) {
|
|
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 }) {
|
|
148
|
+
const rootRef = useRef(null);
|
|
149
|
+
const [bounds, setBounds] = useState({ width: 0, height: 0 });
|
|
150
|
+
const [hovered, setHovered] = useState(false);
|
|
148
151
|
const [index, setIndex] = useState(0);
|
|
149
152
|
const [point, setPoint] = useState(null);
|
|
150
153
|
const [reduced, setReduced] = useState(false);
|
|
151
154
|
const [failed, setFailed] = useState(false);
|
|
152
155
|
const safeSize = Math.max(8, Number.isFinite(size) ? size : 48);
|
|
153
156
|
const frame = frames[playing && !reduced ? index % Math.max(1, frames.length) : 0];
|
|
157
|
+
useLayoutEffect(() => {
|
|
158
|
+
const root = rootRef.current;
|
|
159
|
+
if (!showHotspot || !root) return;
|
|
160
|
+
const measure = () => setBounds({ width: root.clientWidth, height: root.clientHeight });
|
|
161
|
+
measure();
|
|
162
|
+
const observer = new ResizeObserver(measure);
|
|
163
|
+
observer.observe(root);
|
|
164
|
+
return () => observer.disconnect();
|
|
165
|
+
}, [showHotspot]);
|
|
154
166
|
useEffect(() => {
|
|
155
167
|
setIndex(0);
|
|
156
168
|
}, [frames]);
|
|
@@ -169,26 +181,54 @@ function CursorPreview({ frames, size = 48, playing = true, followPointer = true
|
|
|
169
181
|
}, [playing, reduced, frames, index, frame]);
|
|
170
182
|
function move(event) {
|
|
171
183
|
const rect = event.currentTarget.getBoundingClientRect();
|
|
184
|
+
if (event.pointerType !== "touch") setHovered(true);
|
|
172
185
|
if (followPointer && event.pointerType !== "touch") setPoint({ x: event.clientX - rect.left, y: event.clientY - rect.top });
|
|
173
186
|
onPointerMove?.(event);
|
|
174
187
|
}
|
|
175
188
|
const following = !!point && followPointer && !!frame && !failed;
|
|
176
189
|
const offset = (value) => Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * safeSize;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
190
|
+
const hotspotX = (bounds.width - safeSize) / 2 + offset(frame?.hotspotX);
|
|
191
|
+
const hotspotY = (bounds.height - safeSize) / 2 + offset(frame?.hotspotY);
|
|
192
|
+
const direction = bounds.width - hotspotX >= 130 ? 1 : -1;
|
|
193
|
+
const lineY = Math.max(18, hotspotY - 42);
|
|
194
|
+
const elbowX = hotspotX + direction * 28;
|
|
195
|
+
const endX = direction === 1 ? Math.min(bounds.width - 58, hotspotX + 82) : Math.max(58, hotspotX - 82);
|
|
196
|
+
return /* @__PURE__ */ jsxs(
|
|
197
|
+
"div",
|
|
198
|
+
{
|
|
199
|
+
...props,
|
|
200
|
+
ref: rootRef,
|
|
201
|
+
className: `sia-cursor-preview${following ? " is-following" : ""} ${className}`.trim(),
|
|
202
|
+
style: { height, ...style },
|
|
203
|
+
onPointerEnter: (event) => {
|
|
204
|
+
if (event.pointerType !== "touch") setHovered(true);
|
|
205
|
+
onPointerEnter?.(event);
|
|
206
|
+
},
|
|
207
|
+
onPointerMove: move,
|
|
208
|
+
onPointerLeave: (event) => {
|
|
209
|
+
setHovered(false);
|
|
210
|
+
setPoint(null);
|
|
211
|
+
onPointerLeave?.(event);
|
|
212
|
+
},
|
|
213
|
+
children: [
|
|
214
|
+
frame ? /* @__PURE__ */ jsx("span", { className: "sia-cursor-preview__bitmap", style: { width: safeSize, height: safeSize, left: following ? point.x - offset(frame.hotspotX) : "50%", top: following ? point.y - offset(frame.hotspotY) : "50%", transform: 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
|
+
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
|
+
/* @__PURE__ */ jsx("polyline", { points: `${hotspotX},${hotspotY} ${elbowX},${lineY} ${endX},${lineY}` }),
|
|
217
|
+
/* @__PURE__ */ jsx("circle", { cx: hotspotX, cy: hotspotY, r: 2.5 }),
|
|
218
|
+
/* @__PURE__ */ jsx("text", { x: endX + direction * 8, y: lineY, textAnchor: direction === 1 ? "start" : "end", dominantBaseline: "central", children: "\u6307\u9488\u70B9" })
|
|
219
|
+
] }) : null,
|
|
220
|
+
children ? /* @__PURE__ */ jsx("div", { className: "sia-cursor-preview__caption", children }) : null
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
);
|
|
184
224
|
}
|
|
185
225
|
|
|
186
226
|
// src/components/UtilityLayout.tsx
|
|
187
|
-
import { useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
227
|
+
import { useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
188
228
|
import { createPortal } from "react-dom";
|
|
189
229
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
190
230
|
function AutoSizer({ children }) {
|
|
191
|
-
const ref =
|
|
231
|
+
const ref = useRef2(null);
|
|
192
232
|
const [size, setSize] = useState2({ width: 0, height: 0 });
|
|
193
233
|
useEffect2(() => {
|
|
194
234
|
const element = ref.current;
|
|
@@ -449,7 +489,7 @@ function Pagination({
|
|
|
449
489
|
}
|
|
450
490
|
|
|
451
491
|
// src/components/Cascader.tsx
|
|
452
|
-
import { useEffect as useEffect3, useMemo, useRef as
|
|
492
|
+
import { useEffect as useEffect3, useMemo, useRef as useRef3, useState as useState5 } from "react";
|
|
453
493
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
454
494
|
function optionValue(option, fields) {
|
|
455
495
|
return option[fields.value];
|
|
@@ -506,8 +546,8 @@ function Cascader({
|
|
|
506
546
|
}) {
|
|
507
547
|
const size = useControlSize(sizeProp);
|
|
508
548
|
const fields = useMemo(() => ({ label: fieldNames?.label ?? "label", value: fieldNames?.value ?? "value", children: fieldNames?.children ?? "children" }), [fieldNames]);
|
|
509
|
-
const rootRef =
|
|
510
|
-
const popupRef =
|
|
549
|
+
const rootRef = useRef3(null);
|
|
550
|
+
const popupRef = useRef3(null);
|
|
511
551
|
const [current, setCurrent] = useControllableState({
|
|
512
552
|
value,
|
|
513
553
|
defaultValue: defaultValue ?? (multiple ? [] : void 0)
|
|
@@ -812,7 +852,7 @@ function Col({
|
|
|
812
852
|
}
|
|
813
853
|
|
|
814
854
|
// src/components/Splitter.tsx
|
|
815
|
-
import { Children as Children2, cloneElement, isValidElement, useMemo as useMemo2, useRef as
|
|
855
|
+
import { Children as Children2, cloneElement, isValidElement, useMemo as useMemo2, useRef as useRef4, useState as useState6 } from "react";
|
|
816
856
|
import { Fragment, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
817
857
|
function SplitterPanel({
|
|
818
858
|
defaultSize: _defaultSize,
|
|
@@ -862,10 +902,10 @@ function SplitterRoot({
|
|
|
862
902
|
children,
|
|
863
903
|
...props
|
|
864
904
|
}) {
|
|
865
|
-
const rootRef =
|
|
905
|
+
const rootRef = useRef4(null);
|
|
866
906
|
const panels = useMemo2(() => Children2.toArray(children).filter(isValidElement), [children]);
|
|
867
907
|
const [sizes, setSizes] = useState6(() => normalizeSizes(panels));
|
|
868
|
-
const expandedSizesRef =
|
|
908
|
+
const expandedSizesRef = useRef4(normalizeExpandedSizes(panels));
|
|
869
909
|
function resizePair(index, deltaPercent, complete = false) {
|
|
870
910
|
setSizes((current) => {
|
|
871
911
|
const next = [...current];
|
|
@@ -1010,7 +1050,7 @@ var Splitter = Object.assign(SplitterRoot, {
|
|
|
1010
1050
|
});
|
|
1011
1051
|
|
|
1012
1052
|
// src/components/ToolPanel.tsx
|
|
1013
|
-
import { useId, useLayoutEffect, useRef as
|
|
1053
|
+
import { useId, useLayoutEffect as useLayoutEffect2, useRef as useRef5, useState as useState7 } from "react";
|
|
1014
1054
|
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1015
1055
|
function clamp2(value, min, max) {
|
|
1016
1056
|
return Math.min(max, Math.max(min, value));
|
|
@@ -1044,9 +1084,9 @@ function ToolPanel({
|
|
|
1044
1084
|
const requestedKey = activeKey ?? internalActiveKey;
|
|
1045
1085
|
const activePanel = panels.find((item) => item.key === requestedKey && !item.disabled) ?? panels.find((item) => !item.disabled);
|
|
1046
1086
|
const isOpen = (open ?? internalOpen) && Boolean(activePanel);
|
|
1047
|
-
const railRef =
|
|
1048
|
-
const indicatorRef =
|
|
1049
|
-
|
|
1087
|
+
const railRef = useRef5(null);
|
|
1088
|
+
const indicatorRef = useRef5(null);
|
|
1089
|
+
useLayoutEffect2(() => {
|
|
1050
1090
|
const rail2 = railRef.current;
|
|
1051
1091
|
const indicator = indicatorRef.current;
|
|
1052
1092
|
if (!rail2 || !indicator) return;
|
|
@@ -1319,7 +1359,6 @@ function WindowTitleBar({
|
|
|
1319
1359
|
controls = true,
|
|
1320
1360
|
maximized = false,
|
|
1321
1361
|
draggable = true,
|
|
1322
|
-
dragMode = "callback",
|
|
1323
1362
|
disabledActions,
|
|
1324
1363
|
controlLabels,
|
|
1325
1364
|
onWindowAction,
|
|
@@ -1330,7 +1369,7 @@ function WindowTitleBar({
|
|
|
1330
1369
|
}) {
|
|
1331
1370
|
function handleMouseDown(event) {
|
|
1332
1371
|
onMouseDown?.(event);
|
|
1333
|
-
if (event.defaultPrevented || !draggable ||
|
|
1372
|
+
if (event.defaultPrevented || !draggable || !onWindowAction || event.button !== 0) return;
|
|
1334
1373
|
const target = event.target;
|
|
1335
1374
|
if (!(target instanceof Element) || target.closest(NON_DRAG_SELECTOR)) return;
|
|
1336
1375
|
event.preventDefault();
|
|
@@ -1351,7 +1390,6 @@ function WindowTitleBar({
|
|
|
1351
1390
|
{
|
|
1352
1391
|
className: `sia-window-titlebar ${className}`.trim(),
|
|
1353
1392
|
"data-actions-align": actionsAlign,
|
|
1354
|
-
"data-drag-mode": draggable ? dragMode : void 0,
|
|
1355
1393
|
onMouseDown: handleMouseDown,
|
|
1356
1394
|
...withTitleTooltip(props),
|
|
1357
1395
|
children: [
|
|
@@ -1367,7 +1405,7 @@ function WindowTitleBar({
|
|
|
1367
1405
|
}
|
|
1368
1406
|
|
|
1369
1407
|
// src/components/Drawer.tsx
|
|
1370
|
-
import { createContext, forwardRef, useCallback, useContext, useEffect as useEffect4, useId as useId2, useMemo as useMemo3, useRef as
|
|
1408
|
+
import { createContext, forwardRef, useCallback, useContext, useEffect as useEffect4, useId as useId2, useMemo as useMemo3, useRef as useRef6, useState as useState8 } from "react";
|
|
1371
1409
|
import { createRoot } from "react-dom/client";
|
|
1372
1410
|
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1373
1411
|
var drawerHandles = /* @__PURE__ */ new Set();
|
|
@@ -1403,13 +1441,13 @@ var DrawerRoot = forwardRef(function Drawer({
|
|
|
1403
1441
|
style,
|
|
1404
1442
|
...props
|
|
1405
1443
|
}, forwardedRef) {
|
|
1406
|
-
const localRef =
|
|
1407
|
-
const bodyRef =
|
|
1444
|
+
const localRef = useRef6(null);
|
|
1445
|
+
const bodyRef = useRef6(null);
|
|
1408
1446
|
const titleId = useId2();
|
|
1409
1447
|
const drawerId = useId2();
|
|
1410
1448
|
const parentStack = useContext(DrawerStackContext);
|
|
1411
|
-
const afterOpenRef =
|
|
1412
|
-
const afterCloseRef =
|
|
1449
|
+
const afterOpenRef = useRef6(afterOpen);
|
|
1450
|
+
const afterCloseRef = useRef6(afterClose);
|
|
1413
1451
|
afterOpenRef.current = afterOpen;
|
|
1414
1452
|
afterCloseRef.current = afterClose;
|
|
1415
1453
|
const [rendered, setRendered] = useState8(open);
|
|
@@ -1572,7 +1610,7 @@ var Drawer2 = Object.assign(DrawerRoot, {
|
|
|
1572
1610
|
});
|
|
1573
1611
|
|
|
1574
1612
|
// src/components/Form.tsx
|
|
1575
|
-
import { Children as Children3, cloneElement as cloneElement2, createContext as createContext2, forwardRef as forwardRef2, isValidElement as isValidElement2, useContext as useContext2, useEffect as useEffect5, useId as useId3, useLayoutEffect as
|
|
1613
|
+
import { Children as Children3, cloneElement as cloneElement2, createContext as createContext2, forwardRef as forwardRef2, isValidElement as isValidElement2, useContext as useContext2, useEffect as useEffect5, useId as useId3, useLayoutEffect as useLayoutEffect3, useMemo as useMemo4, useRef as useRef7, useSyncExternalStore } from "react";
|
|
1576
1614
|
import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1577
1615
|
var Switch = forwardRef2(function Switch2({
|
|
1578
1616
|
label,
|
|
@@ -1805,7 +1843,7 @@ var FormStore = class {
|
|
|
1805
1843
|
};
|
|
1806
1844
|
var FormContext = createContext2(null);
|
|
1807
1845
|
function useForm(form) {
|
|
1808
|
-
const ref =
|
|
1846
|
+
const ref = useRef7(form ?? new FormStore());
|
|
1809
1847
|
return [ref.current];
|
|
1810
1848
|
}
|
|
1811
1849
|
function FormRoot({
|
|
@@ -1829,8 +1867,8 @@ function FormRoot({
|
|
|
1829
1867
|
const instance = internalForm;
|
|
1830
1868
|
instance.configure(initialValues, { onFinish, onFinishFailed, onValuesChange });
|
|
1831
1869
|
const context = useMemo4(() => instance, [instance]);
|
|
1832
|
-
const formRef =
|
|
1833
|
-
|
|
1870
|
+
const formRef = useRef7(null);
|
|
1871
|
+
useLayoutEffect3(() => {
|
|
1834
1872
|
const root = formRef.current;
|
|
1835
1873
|
if (!root) return;
|
|
1836
1874
|
let frame = 0;
|
|
@@ -1909,7 +1947,7 @@ function FormItem({
|
|
|
1909
1947
|
}) {
|
|
1910
1948
|
const form = useContext2(FormContext);
|
|
1911
1949
|
const id = useId3();
|
|
1912
|
-
const itemRef =
|
|
1950
|
+
const itemRef = useRef7(null);
|
|
1913
1951
|
if (!form) throw new Error("Form.Item \u5FC5\u987B\u5728 Form \u5185\u4F7F\u7528");
|
|
1914
1952
|
useSyncExternalStore(form.subscribe, form.getSnapshot, form.getSnapshot);
|
|
1915
1953
|
const path = name === void 0 ? void 0 : pathArray(name);
|
|
@@ -2236,7 +2274,7 @@ function Slider({
|
|
|
2236
2274
|
}
|
|
2237
2275
|
|
|
2238
2276
|
// src/components/ColorPicker.tsx
|
|
2239
|
-
import { useEffect as useEffect6, useRef as
|
|
2277
|
+
import { useEffect as useEffect6, useRef as useRef8, useState as useState10 } from "react";
|
|
2240
2278
|
import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2241
2279
|
var DEFAULT_MODES = ["solid", "gradient"];
|
|
2242
2280
|
var gradientStopSeed = 0;
|
|
@@ -2327,9 +2365,9 @@ function ColorPicker({
|
|
|
2327
2365
|
...props
|
|
2328
2366
|
}) {
|
|
2329
2367
|
const size = useControlSize(sizeProp);
|
|
2330
|
-
const rootRef =
|
|
2331
|
-
const popupRef =
|
|
2332
|
-
const lastEmittedValue =
|
|
2368
|
+
const rootRef = useRef8(null);
|
|
2369
|
+
const popupRef = useRef8(null);
|
|
2370
|
+
const lastEmittedValue = useRef8();
|
|
2333
2371
|
const initialGradient = parseGradient(value ?? defaultValue);
|
|
2334
2372
|
const initialSolid = initialGradient?.stops[0]?.color ?? normalizeHex(value || defaultValue);
|
|
2335
2373
|
const [open, setOpen] = useState10(false);
|
|
@@ -2552,7 +2590,7 @@ function ColorPicker({
|
|
|
2552
2590
|
}
|
|
2553
2591
|
|
|
2554
2592
|
// src/components/TimePicker.tsx
|
|
2555
|
-
import { useEffect as useEffect7, useId as useId5, useRef as
|
|
2593
|
+
import { useEffect as useEffect7, useId as useId5, useRef as useRef9, useState as useState11 } from "react";
|
|
2556
2594
|
import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2557
2595
|
function seconds(value) {
|
|
2558
2596
|
const [h = 0, m = 0, s = 0] = value.split(":").map(Number);
|
|
@@ -2583,10 +2621,10 @@ function TimePicker({
|
|
|
2583
2621
|
}) {
|
|
2584
2622
|
const size = useControlSize(sizeProp);
|
|
2585
2623
|
const id = useId5();
|
|
2586
|
-
const rootRef =
|
|
2587
|
-
const inputRef =
|
|
2588
|
-
const popupRef =
|
|
2589
|
-
const focusPanel =
|
|
2624
|
+
const rootRef = useRef9(null);
|
|
2625
|
+
const inputRef = useRef9(null);
|
|
2626
|
+
const popupRef = useRef9(null);
|
|
2627
|
+
const focusPanel = useRef9(false);
|
|
2590
2628
|
const [currentValue, setValue2] = useControllableState({ value, defaultValue, onChange });
|
|
2591
2629
|
const [open, setOpen] = useState11(false);
|
|
2592
2630
|
const [draft, setDraft] = useState11("00:00:00");
|
|
@@ -2726,7 +2764,7 @@ function TimeRangePicker({ value, defaultValue = ["", ""], placeholder = ["\u5F0
|
|
|
2726
2764
|
})(TimePicker || (TimePicker = {}));
|
|
2727
2765
|
|
|
2728
2766
|
// src/components/TreeSelect.tsx
|
|
2729
|
-
import { useEffect as useEffect8, useMemo as useMemo6, useRef as
|
|
2767
|
+
import { useEffect as useEffect8, useMemo as useMemo6, useRef as useRef10, useState as useState12 } from "react";
|
|
2730
2768
|
import { Fragment as Fragment4, jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2731
2769
|
function flattenTree(nodes, expanded, search, filter, depth = 0, parents = [], ancestorMatched = false) {
|
|
2732
2770
|
const result = [];
|
|
@@ -2789,8 +2827,8 @@ function TreeSelect({
|
|
|
2789
2827
|
...props
|
|
2790
2828
|
}) {
|
|
2791
2829
|
const size = useControlSize(sizeProp);
|
|
2792
|
-
const rootRef =
|
|
2793
|
-
const popupRef =
|
|
2830
|
+
const rootRef = useRef10(null);
|
|
2831
|
+
const popupRef = useRef10(null);
|
|
2794
2832
|
const nodeIndex = useMemo6(() => {
|
|
2795
2833
|
const index = /* @__PURE__ */ new Map();
|
|
2796
2834
|
const visit = (nodes) => nodes.forEach((node) => {
|
|
@@ -3045,7 +3083,7 @@ function buildFlatTree(items, options = {}) {
|
|
|
3045
3083
|
}
|
|
3046
3084
|
|
|
3047
3085
|
// src/components/Editor.tsx
|
|
3048
|
-
import { useEffect as useEffect9, useId as useId6, useRef as
|
|
3086
|
+
import { useEffect as useEffect9, useId as useId6, useRef as useRef11, useState as useState13 } from "react";
|
|
3049
3087
|
import EditorWorker from "monaco-editor/editor/editor.worker.js?worker";
|
|
3050
3088
|
|
|
3051
3089
|
// src/components/jsonLanguage.ts
|
|
@@ -3721,27 +3759,27 @@ function Editor({
|
|
|
3721
3759
|
loadingText = "\u6B63\u5728\u52A0\u8F7D\u7F16\u8F91\u5668\u2026"
|
|
3722
3760
|
}) {
|
|
3723
3761
|
const generatedId = useId6();
|
|
3724
|
-
const containerRef =
|
|
3725
|
-
const rangeHighlightRef =
|
|
3726
|
-
const editorRef =
|
|
3727
|
-
const modelRef =
|
|
3728
|
-
const apiRef =
|
|
3729
|
-
const applyingControlledValueRef =
|
|
3730
|
-
const updateHighlightRef =
|
|
3731
|
-
const changeHandlerRef =
|
|
3732
|
-
const readyHandlerRef =
|
|
3733
|
-
const selectionHandlerRef =
|
|
3734
|
-
const keyDownHandlerRef =
|
|
3735
|
-
const highlightRangeRef =
|
|
3736
|
-
const markersRef =
|
|
3737
|
-
const contextMenuItemsRef =
|
|
3738
|
-
const completionProviderRef =
|
|
3739
|
-
const refreshSuggestionOnSpaceRef =
|
|
3740
|
-
const initialValueRef =
|
|
3741
|
-
const initialLanguageRef =
|
|
3742
|
-
const initialPathRef =
|
|
3743
|
-
const initialThemeRef =
|
|
3744
|
-
const initialOptionsRef =
|
|
3762
|
+
const containerRef = useRef11(null);
|
|
3763
|
+
const rangeHighlightRef = useRef11(null);
|
|
3764
|
+
const editorRef = useRef11(null);
|
|
3765
|
+
const modelRef = useRef11(null);
|
|
3766
|
+
const apiRef = useRef11(null);
|
|
3767
|
+
const applyingControlledValueRef = useRef11(false);
|
|
3768
|
+
const updateHighlightRef = useRef11(() => void 0);
|
|
3769
|
+
const changeHandlerRef = useRef11(onChange);
|
|
3770
|
+
const readyHandlerRef = useRef11(onReady);
|
|
3771
|
+
const selectionHandlerRef = useRef11(onSelectionChange);
|
|
3772
|
+
const keyDownHandlerRef = useRef11(onKeyDown);
|
|
3773
|
+
const highlightRangeRef = useRef11(highlightRange);
|
|
3774
|
+
const markersRef = useRef11(markers);
|
|
3775
|
+
const contextMenuItemsRef = useRef11(contextMenuItems);
|
|
3776
|
+
const completionProviderRef = useRef11(completionProvider);
|
|
3777
|
+
const refreshSuggestionOnSpaceRef = useRef11(refreshSuggestionOnSpace);
|
|
3778
|
+
const initialValueRef = useRef11(value);
|
|
3779
|
+
const initialLanguageRef = useRef11(language);
|
|
3780
|
+
const initialPathRef = useRef11(path);
|
|
3781
|
+
const initialThemeRef = useRef11(theme);
|
|
3782
|
+
const initialOptionsRef = useRef11(options);
|
|
3745
3783
|
const [loading, setLoading] = useState13(true);
|
|
3746
3784
|
const [, setSelectionVersion] = useState13(0);
|
|
3747
3785
|
initialValueRef.current = value;
|
|
@@ -4279,12 +4317,12 @@ function Editor({
|
|
|
4279
4317
|
}
|
|
4280
4318
|
|
|
4281
4319
|
// src/components/Markdown.tsx
|
|
4282
|
-
import { useEffect as useEffect10, useMemo as useMemo7, useRef as
|
|
4320
|
+
import { useEffect as useEffect10, useMemo as useMemo7, useRef as useRef12, useState as useState14 } from "react";
|
|
4283
4321
|
import DOMPurify from "dompurify";
|
|
4284
4322
|
import { marked } from "marked";
|
|
4285
4323
|
import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4286
4324
|
function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", resolveImageSrc, imagePreview = true, className = "", onClick, onKeyDown, ...props }) {
|
|
4287
|
-
const rootRef =
|
|
4325
|
+
const rootRef = useRef12(null);
|
|
4288
4326
|
const [previewImage, setPreviewImage] = useState14(null);
|
|
4289
4327
|
const html = useMemo7(() => {
|
|
4290
4328
|
const rendered = marked.parse(content, { breaks: true, gfm: true });
|
|
@@ -4359,7 +4397,7 @@ function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", r
|
|
|
4359
4397
|
}
|
|
4360
4398
|
|
|
4361
4399
|
// src/components/InputNumber.tsx
|
|
4362
|
-
import { forwardRef as forwardRef4, useEffect as useEffect11, useId as useId7, useRef as
|
|
4400
|
+
import { forwardRef as forwardRef4, useEffect as useEffect11, useId as useId7, useRef as useRef13, useState as useState15 } from "react";
|
|
4363
4401
|
import { jsx as jsx19, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4364
4402
|
function formatValue(value, precision) {
|
|
4365
4403
|
if (value === null || !Number.isFinite(value)) return "";
|
|
@@ -4393,7 +4431,7 @@ var InputNumber = forwardRef4(function InputNumber2({
|
|
|
4393
4431
|
const size = useControlSize(sizeProp);
|
|
4394
4432
|
const fallbackId = useId7();
|
|
4395
4433
|
const inputId = id ?? fallbackId;
|
|
4396
|
-
const localRef =
|
|
4434
|
+
const localRef = useRef13(null);
|
|
4397
4435
|
const [currentValue, setCurrentValue] = useControllableState({ value, defaultValue, onChange });
|
|
4398
4436
|
const displayValue = (next) => {
|
|
4399
4437
|
const plain = formatValue(next, precision);
|
|
@@ -4635,7 +4673,7 @@ function openSelectModal(config) {
|
|
|
4635
4673
|
}
|
|
4636
4674
|
|
|
4637
4675
|
// src/components/Treemap.tsx
|
|
4638
|
-
import { useEffect as useEffect12, useMemo as useMemo8, useRef as
|
|
4676
|
+
import { useEffect as useEffect12, useMemo as useMemo8, useRef as useRef14, useState as useState17 } from "react";
|
|
4639
4677
|
import { jsx as jsx21, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4640
4678
|
import { createElement } from "react";
|
|
4641
4679
|
function positiveValue(value) {
|
|
@@ -5008,7 +5046,7 @@ function Treemap({
|
|
|
5008
5046
|
style,
|
|
5009
5047
|
...props
|
|
5010
5048
|
}) {
|
|
5011
|
-
const containerRef =
|
|
5049
|
+
const containerRef = useRef14(null);
|
|
5012
5050
|
const [size, setSize] = useState17({ width: 0, height: 0 });
|
|
5013
5051
|
const [internalExpandedKeys, setInternalExpandedKeys] = useState17(() => [...defaultExpandedKeys]);
|
|
5014
5052
|
const [internalFocusedKey, setInternalFocusedKey] = useState17(defaultFocusedKey);
|
|
@@ -5161,7 +5199,7 @@ function Treemap({
|
|
|
5161
5199
|
}
|
|
5162
5200
|
|
|
5163
5201
|
// src/components/Table/TableCellContent.tsx
|
|
5164
|
-
import { useLayoutEffect as
|
|
5202
|
+
import { useLayoutEffect as useLayoutEffect4, useRef as useRef15, useState as useState18 } from "react";
|
|
5165
5203
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
5166
5204
|
var pendingLayouts = /* @__PURE__ */ new Map();
|
|
5167
5205
|
var layoutFrame;
|
|
@@ -5180,10 +5218,10 @@ function scheduleLayout(element, task) {
|
|
|
5180
5218
|
});
|
|
5181
5219
|
}
|
|
5182
5220
|
function TableCellContent({ children, ellipsis, title }) {
|
|
5183
|
-
const ref =
|
|
5221
|
+
const ref = useRef15(null);
|
|
5184
5222
|
const [overflowing, setOverflowing] = useState18(false);
|
|
5185
5223
|
const customContent = typeof children !== "string" && typeof children !== "number" && children != null;
|
|
5186
|
-
|
|
5224
|
+
useLayoutEffect4(() => {
|
|
5187
5225
|
const element = ref.current;
|
|
5188
5226
|
if (!element || !ellipsis || !customContent) return;
|
|
5189
5227
|
const normalizeLayouts = (parent, layouts) => {
|
|
@@ -5219,14 +5257,14 @@ function TableCellContent({ children, ellipsis, title }) {
|
|
|
5219
5257
|
}
|
|
5220
5258
|
|
|
5221
5259
|
// src/components/Table/useRemainingHeight.ts
|
|
5222
|
-
import { useLayoutEffect as
|
|
5260
|
+
import { useLayoutEffect as useLayoutEffect5, useState as useState19 } from "react";
|
|
5223
5261
|
function useRemainingHeight(rootRef, options) {
|
|
5224
5262
|
const [height, setHeight] = useState19();
|
|
5225
5263
|
const enabled = !!options;
|
|
5226
5264
|
const container = typeof options === "object" ? options.container : void 0;
|
|
5227
5265
|
const bottomOffset = typeof options === "object" ? options.bottomOffset ?? 0 : 0;
|
|
5228
5266
|
const minHeight = typeof options === "object" ? options.minHeight ?? 0 : 0;
|
|
5229
|
-
|
|
5267
|
+
useLayoutEffect5(() => {
|
|
5230
5268
|
const root = rootRef.current;
|
|
5231
5269
|
if (!enabled || !root) return;
|
|
5232
5270
|
const win = root.ownerDocument.defaultView;
|
|
@@ -5297,7 +5335,7 @@ function useRemainingHeight(rootRef, options) {
|
|
|
5297
5335
|
}
|
|
5298
5336
|
|
|
5299
5337
|
// src/components/Table/TableCanvasLayer.tsx
|
|
5300
|
-
import { useLayoutEffect as
|
|
5338
|
+
import { useLayoutEffect as useLayoutEffect6, useRef as useRef16 } from "react";
|
|
5301
5339
|
|
|
5302
5340
|
// src/components/Table/utils.ts
|
|
5303
5341
|
var AUTO_WIDTH_COLUMN_KEYS = /* @__PURE__ */ new Set(["action", "actions", "operation", "operations"]);
|
|
@@ -5352,8 +5390,8 @@ function toTablePageParams(current, pageSize) {
|
|
|
5352
5390
|
// src/components/Table/TableCanvasLayer.tsx
|
|
5353
5391
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
5354
5392
|
function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHeight }) {
|
|
5355
|
-
const canvasRef =
|
|
5356
|
-
|
|
5393
|
+
const canvasRef = useRef16(null);
|
|
5394
|
+
useLayoutEffect6(() => {
|
|
5357
5395
|
const canvas = canvasRef.current;
|
|
5358
5396
|
const scroller = viewport.current;
|
|
5359
5397
|
if (!canvas || !scroller) return;
|
|
@@ -5496,10 +5534,10 @@ function createRowIdentity() {
|
|
|
5496
5534
|
}
|
|
5497
5535
|
|
|
5498
5536
|
// src/components/Table/Table.tsx
|
|
5499
|
-
import { Fragment as Fragment8, forwardRef as forwardRef5, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as useEffect14, useImperativeHandle, useMemo as useMemo9, useRef as
|
|
5537
|
+
import { Fragment as Fragment8, forwardRef as forwardRef5, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as useEffect14, useImperativeHandle, useMemo as useMemo9, useRef as useRef18, useState as useState21 } from "react";
|
|
5500
5538
|
|
|
5501
5539
|
// src/components/Table/plugins.tsx
|
|
5502
|
-
import { isValidElement as isValidElement3, useEffect as useEffect13, useRef as
|
|
5540
|
+
import { isValidElement as isValidElement3, useEffect as useEffect13, useRef as useRef17, useState as useState20 } from "react";
|
|
5503
5541
|
|
|
5504
5542
|
// src/components/Table/columnSettings.ts
|
|
5505
5543
|
function reconcileColumnSettings(columns, defaults, saved) {
|
|
@@ -7061,11 +7099,11 @@ function EditableTableCell({
|
|
|
7061
7099
|
const config = typeof editable === "object" ? editable : { type: "input" };
|
|
7062
7100
|
const [editValue, setEditValue] = useState20(value);
|
|
7063
7101
|
const [saving, setSaving] = useState20(false);
|
|
7064
|
-
const inputRef =
|
|
7065
|
-
const editorRef =
|
|
7066
|
-
const editValueRef =
|
|
7067
|
-
const savingRef =
|
|
7068
|
-
const saveRef =
|
|
7102
|
+
const inputRef = useRef17(null);
|
|
7103
|
+
const editorRef = useRef17(null);
|
|
7104
|
+
const editValueRef = useRef17(value);
|
|
7105
|
+
const savingRef = useRef17(false);
|
|
7106
|
+
const saveRef = useRef17(
|
|
7069
7107
|
async () => {
|
|
7070
7108
|
}
|
|
7071
7109
|
);
|
|
@@ -7406,8 +7444,8 @@ function ColumnSettingPanel({
|
|
|
7406
7444
|
onApply
|
|
7407
7445
|
}) {
|
|
7408
7446
|
const [draft, setDraft] = useState20(items);
|
|
7409
|
-
const listRef =
|
|
7410
|
-
const cancelDrag =
|
|
7447
|
+
const listRef = useRef17(null);
|
|
7448
|
+
const cancelDrag = useRef17(null);
|
|
7411
7449
|
const [preview, setPreview] = useState20(null);
|
|
7412
7450
|
useEffect13(() => {
|
|
7413
7451
|
cancelDrag.current?.();
|
|
@@ -8236,12 +8274,12 @@ function TableInner(props, ref) {
|
|
|
8236
8274
|
style,
|
|
8237
8275
|
...htmlProps
|
|
8238
8276
|
} = props;
|
|
8239
|
-
const rootRef =
|
|
8277
|
+
const rootRef = useRef18(null);
|
|
8240
8278
|
const remainingHeight = useRemainingHeight(rootRef, height == null && tableHeight == null ? fillRemaining : false);
|
|
8241
|
-
const scrollRef =
|
|
8242
|
-
const tableRef =
|
|
8279
|
+
const scrollRef = useRef18(null);
|
|
8280
|
+
const tableRef = useRef18(null);
|
|
8243
8281
|
useScrollbarProximity();
|
|
8244
|
-
const scrollbarDragRef =
|
|
8282
|
+
const scrollbarDragRef = useRef18(null);
|
|
8245
8283
|
const [internalLoading, setInternalLoading] = useState21(false);
|
|
8246
8284
|
const [scrollTop, setScrollTop] = useState21(0);
|
|
8247
8285
|
const [scrollLeft, setScrollLeft] = useState21(0);
|
|
@@ -8263,14 +8301,14 @@ function TableInner(props, ref) {
|
|
|
8263
8301
|
return plugins;
|
|
8264
8302
|
}, [builtInHighlightPlugin, builtInResizePlugin, builtInCellSelectionPlugin, builtInIndexPlugin, providedPlugins, resizable, cellSelection, showIndex]);
|
|
8265
8303
|
const sortedPlugins = useMemo9(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
|
|
8266
|
-
const pluginsByIdRef =
|
|
8304
|
+
const pluginsByIdRef = useRef18(/* @__PURE__ */ new Map());
|
|
8267
8305
|
pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
8268
8306
|
const [pluginStates, setPluginStates] = useState21(() => Object.fromEntries(
|
|
8269
8307
|
sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
|
|
8270
8308
|
));
|
|
8271
|
-
const pluginApisRef =
|
|
8272
|
-
const contextsRef =
|
|
8273
|
-
const mountedPluginsRef =
|
|
8309
|
+
const pluginApisRef = useRef18({});
|
|
8310
|
+
const contextsRef = useRef18(/* @__PURE__ */ new Map());
|
|
8311
|
+
const mountedPluginsRef = useRef18(/* @__PURE__ */ new Map());
|
|
8274
8312
|
const pipeline = { columns: baseColumns, rows: createTableRows(dataSource, getRowKey) };
|
|
8275
8313
|
const nextApis = {};
|
|
8276
8314
|
const contexts = /* @__PURE__ */ new Map();
|
|
@@ -8402,7 +8440,7 @@ function TableInner(props, ref) {
|
|
|
8402
8440
|
const orderedColumns = useMemo9(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
|
|
8403
8441
|
const leafColumns = useMemo9(() => flattenTableColumns(orderedColumns), [orderedColumns]);
|
|
8404
8442
|
const headerRows = useMemo9(() => buildHeaderRows(orderedColumns), [orderedColumns]);
|
|
8405
|
-
const measuredCells =
|
|
8443
|
+
const measuredCells = useRef18(/* @__PURE__ */ new WeakSet());
|
|
8406
8444
|
const autoWidthSignature = leafColumns.map((column) => `${column.key}:${column.autoWidth}:${resizedWidths[column.key] ?? ""}`).join("|");
|
|
8407
8445
|
useEffect14(() => {
|
|
8408
8446
|
measuredCells.current = /* @__PURE__ */ new WeakSet();
|
|
@@ -8945,7 +8983,7 @@ function applySiaTheme(mode, target = document.documentElement) {
|
|
|
8945
8983
|
}
|
|
8946
8984
|
|
|
8947
8985
|
// src/components/InputSelect.tsx
|
|
8948
|
-
import { forwardRef as forwardRef7, useEffect as useEffect15, useRef as
|
|
8986
|
+
import { forwardRef as forwardRef7, useEffect as useEffect15, useRef as useRef19, useState as useState22 } from "react";
|
|
8949
8987
|
import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
8950
8988
|
var InputSelect = forwardRef7(function InputSelect2({
|
|
8951
8989
|
options,
|
|
@@ -8986,9 +9024,9 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8986
9024
|
const [modalOpen, setModalOpen] = useState22(false);
|
|
8987
9025
|
const [modalValues, setModalValues] = useState22([]);
|
|
8988
9026
|
const [selectedOnly, setSelectedOnly] = useState22(false);
|
|
8989
|
-
const rootRef =
|
|
8990
|
-
const popupRef =
|
|
8991
|
-
const inputRef =
|
|
9027
|
+
const rootRef = useRef19(null);
|
|
9028
|
+
const popupRef = useRef19(null);
|
|
9029
|
+
const inputRef = useRef19(null);
|
|
8992
9030
|
const config = typeof enableModal === "object" ? enableModal : {};
|
|
8993
9031
|
function changeOpen(next) {
|
|
8994
9032
|
if (next && (disabled || loading)) return;
|
|
@@ -9149,13 +9187,13 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
9149
9187
|
});
|
|
9150
9188
|
|
|
9151
9189
|
// src/components/QueryForm.tsx
|
|
9152
|
-
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as
|
|
9190
|
+
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect7, useRef as useRef22, useState as useState25 } from "react";
|
|
9153
9191
|
|
|
9154
9192
|
// src/components/QueryFormSettings.tsx
|
|
9155
|
-
import { useEffect as useEffect17, useRef as
|
|
9193
|
+
import { useEffect as useEffect17, useRef as useRef21, useState as useState24 } from "react";
|
|
9156
9194
|
|
|
9157
9195
|
// src/components/useQueryFieldSort.ts
|
|
9158
|
-
import { useEffect as useEffect16, useRef as
|
|
9196
|
+
import { useEffect as useEffect16, useRef as useRef20, useState as useState23 } from "react";
|
|
9159
9197
|
function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
9160
9198
|
const center = rects[from].top + rects[from].height / 2 + dy;
|
|
9161
9199
|
const rest = keys.map((_, index) => index).filter((index) => index !== from);
|
|
@@ -9174,9 +9212,9 @@ function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
|
9174
9212
|
return { ordered, offsets };
|
|
9175
9213
|
}
|
|
9176
9214
|
function useQueryFieldSort(keys, enabled, onCommit) {
|
|
9177
|
-
const listRef =
|
|
9178
|
-
const cancelRef =
|
|
9179
|
-
const commitRef =
|
|
9215
|
+
const listRef = useRef20(null);
|
|
9216
|
+
const cancelRef = useRef20();
|
|
9217
|
+
const commitRef = useRef20(onCommit);
|
|
9180
9218
|
commitRef.current = onCommit;
|
|
9181
9219
|
const [preview, setPreview] = useState23();
|
|
9182
9220
|
const signature = JSON.stringify(keys);
|
|
@@ -9312,9 +9350,9 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
9312
9350
|
const [saving, setSaving] = useState24(false);
|
|
9313
9351
|
const [error, setError] = useState24("");
|
|
9314
9352
|
const [loadFailed, setLoadFailed] = useState24(false);
|
|
9315
|
-
const token =
|
|
9316
|
-
const saveLock =
|
|
9317
|
-
const latest =
|
|
9353
|
+
const token = useRef21(0);
|
|
9354
|
+
const saveLock = useRef21(false);
|
|
9355
|
+
const latest = useRef21({ config, fields, defaultCollapsed, applyCollapsed });
|
|
9318
9356
|
latest.current = { config, fields, defaultCollapsed, applyCollapsed };
|
|
9319
9357
|
const moduleName = config?.scope.moduleName;
|
|
9320
9358
|
const businessKey = config?.scope.businessKey;
|
|
@@ -9512,11 +9550,11 @@ function QueryForm({
|
|
|
9512
9550
|
const [saveError, setSaveError] = useState25("");
|
|
9513
9551
|
const [error, setError] = useState25("");
|
|
9514
9552
|
const [activeShortcut, setActiveShortcut] = useState25("");
|
|
9515
|
-
const source =
|
|
9516
|
-
const searchLock =
|
|
9517
|
-
const saveLock =
|
|
9518
|
-
const removeLock =
|
|
9519
|
-
const snapshot =
|
|
9553
|
+
const source = useRef22({ source: "submit" });
|
|
9554
|
+
const searchLock = useRef22(false);
|
|
9555
|
+
const saveLock = useRef22(false);
|
|
9556
|
+
const removeLock = useRef22(false);
|
|
9557
|
+
const snapshot = useRef22();
|
|
9520
9558
|
const busy = disabled || loading || searching;
|
|
9521
9559
|
const shortcutBusy = busy || shortcutsLoading || saving || removing;
|
|
9522
9560
|
const fieldLabel = (content) => {
|
|
@@ -9543,12 +9581,12 @@ function QueryForm({
|
|
|
9543
9581
|
const entries = configured.map((item) => ({ ...entriesByKey.get(item.key), visible: item.visible, visibleIndex: item.visible ? visibleIndex++ : -1 }));
|
|
9544
9582
|
const layoutKey = JSON.stringify(configured);
|
|
9545
9583
|
const limit = Math.max(1, Math.floor(collapsedCount));
|
|
9546
|
-
const rowRef =
|
|
9547
|
-
const actionsRef =
|
|
9548
|
-
const toggleRef =
|
|
9584
|
+
const rowRef = useRef22(null);
|
|
9585
|
+
const actionsRef = useRef22(null);
|
|
9586
|
+
const toggleRef = useRef22(null);
|
|
9549
9587
|
const [fittingCount, setFittingCount] = useState25(limit);
|
|
9550
9588
|
const [settingsRows, setSettingsRows] = useState25(0);
|
|
9551
|
-
|
|
9589
|
+
useLayoutEffect7(() => {
|
|
9552
9590
|
const row = rowRef.current;
|
|
9553
9591
|
const actions = actionsRef.current;
|
|
9554
9592
|
if (!row || !actions) return;
|