@sia.soul/sia-react-ui 0.1.123 → 0.1.125
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-ZNUTLBDL.js → chunk-33FOEIXI.js} +4 -2
- package/dist/{chunk-5PC3YO7N.js → chunk-B333SUKG.js} +2 -2
- package/dist/{chunk-2GQG4ASH.js → chunk-D3CROVS2.js} +1 -1
- package/dist/{chunk-HQ3PUJLM.js → chunk-OYBMDSTC.js} +3 -3
- package/dist/{chunk-ZALDJYXM.js → chunk-PUNKAJBB.js} +2 -2
- package/dist/{chunk-Y3PGICI6.js → chunk-WA3LO3LY.js} +2 -2
- package/dist/core.cjs +4 -2
- package/dist/core.js +4 -4
- package/dist/game.cjs +4 -2
- package/dist/game.js +1 -1
- package/dist/index.cjs +67 -11
- package/dist/index.d.cts +11 -9
- package/dist/index.d.ts +11 -9
- package/dist/index.js +174 -120
- package/dist/rich-text-editor.cjs +4 -2
- package/dist/rich-text-editor.js +3 -3
- package/dist/select-date-range.cjs +4 -2
- package/dist/select-date-range.js +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
Watermark,
|
|
83
83
|
message,
|
|
84
84
|
notification
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-OYBMDSTC.js";
|
|
86
86
|
import "./chunk-RX242MUO.js";
|
|
87
87
|
import {
|
|
88
88
|
MarkdownEditor
|
|
@@ -90,12 +90,12 @@ import {
|
|
|
90
90
|
import {
|
|
91
91
|
RichTextContent,
|
|
92
92
|
RichTextEditor
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-B333SUKG.js";
|
|
94
94
|
import {
|
|
95
95
|
DatePicker,
|
|
96
96
|
SelectDateRange,
|
|
97
97
|
TimePanel
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-PUNKAJBB.js";
|
|
99
99
|
import {
|
|
100
100
|
Checkbox,
|
|
101
101
|
FloatingScrollbarProvider,
|
|
@@ -107,14 +107,14 @@ import {
|
|
|
107
107
|
Tooltip,
|
|
108
108
|
Tree,
|
|
109
109
|
useScrollbarProximity
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-WA3LO3LY.js";
|
|
111
111
|
import {
|
|
112
112
|
Dropdown,
|
|
113
113
|
Input,
|
|
114
114
|
Menu,
|
|
115
115
|
Segmented,
|
|
116
116
|
Steps
|
|
117
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-D3CROVS2.js";
|
|
118
118
|
import {
|
|
119
119
|
TextArea
|
|
120
120
|
} from "./chunk-SCEHVGKV.js";
|
|
@@ -125,7 +125,7 @@ import {
|
|
|
125
125
|
Modal,
|
|
126
126
|
OverlayPortal,
|
|
127
127
|
useOverlayLifecycle
|
|
128
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-33FOEIXI.js";
|
|
129
129
|
import {
|
|
130
130
|
Button
|
|
131
131
|
} from "./chunk-CZ2ITBRW.js";
|
|
@@ -1296,7 +1296,7 @@ function ToolPanel({
|
|
|
1296
1296
|
|
|
1297
1297
|
// src/components/WindowFrame.tsx
|
|
1298
1298
|
import { useEffect as useEffect4, useRef as useRef6 } from "react";
|
|
1299
|
-
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1299
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1300
1300
|
var DEFAULT_LABELS = {
|
|
1301
1301
|
minimize: "\u6700\u5C0F\u5316",
|
|
1302
1302
|
maximize: "\u6700\u5927\u5316",
|
|
@@ -1340,6 +1340,12 @@ function WindowFrame({
|
|
|
1340
1340
|
}
|
|
1341
1341
|
);
|
|
1342
1342
|
}
|
|
1343
|
+
function renderWindowControlGlyph(action, maximized) {
|
|
1344
|
+
return /* @__PURE__ */ jsx9("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1", "aria-hidden": "true", focusable: "false", children: action === "minimize" ? /* @__PURE__ */ jsx9("path", { d: "M1 6.5h10" }) : action === "close" ? /* @__PURE__ */ jsx9("path", { d: "m1.5 1.5 9 9m0-9-9 9" }) : maximized ? /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
1345
|
+
/* @__PURE__ */ jsx9("path", { d: "M3.5 3.5v-2h7v7h-2" }),
|
|
1346
|
+
/* @__PURE__ */ jsx9("rect", { x: "1.5", y: "3.5", width: "7", height: "7" })
|
|
1347
|
+
] }) : /* @__PURE__ */ jsx9("rect", { x: "1.5", y: "1.5", width: "9", height: "9" }) });
|
|
1348
|
+
}
|
|
1343
1349
|
function WindowControls({
|
|
1344
1350
|
maximized = false,
|
|
1345
1351
|
showMinimize = true,
|
|
@@ -1373,7 +1379,7 @@ function WindowControls({
|
|
|
1373
1379
|
...withTitleTooltip({ title: mergedLabels.minimize }),
|
|
1374
1380
|
disabled: isDisabled("minimize"),
|
|
1375
1381
|
onClick: () => runAction("minimize"),
|
|
1376
|
-
children:
|
|
1382
|
+
children: renderWindowControlGlyph("minimize", maximized)
|
|
1377
1383
|
}
|
|
1378
1384
|
) : null,
|
|
1379
1385
|
showMaximize ? /* @__PURE__ */ jsx9(
|
|
@@ -1385,7 +1391,7 @@ function WindowControls({
|
|
|
1385
1391
|
...withTitleTooltip({ title: maximized ? mergedLabels.restore : mergedLabels.maximize }),
|
|
1386
1392
|
disabled: isDisabled("toggle-maximize"),
|
|
1387
1393
|
onClick: () => runAction("toggle-maximize"),
|
|
1388
|
-
children:
|
|
1394
|
+
children: renderWindowControlGlyph("toggle-maximize", maximized)
|
|
1389
1395
|
}
|
|
1390
1396
|
) : null,
|
|
1391
1397
|
showClose ? /* @__PURE__ */ jsx9(
|
|
@@ -1397,7 +1403,7 @@ function WindowControls({
|
|
|
1397
1403
|
...withTitleTooltip({ title: mergedLabels.close }),
|
|
1398
1404
|
disabled: isDisabled("close"),
|
|
1399
1405
|
onClick: () => runAction("close"),
|
|
1400
|
-
children:
|
|
1406
|
+
children: renderWindowControlGlyph("close", maximized)
|
|
1401
1407
|
}
|
|
1402
1408
|
) : null
|
|
1403
1409
|
]
|
|
@@ -1689,8 +1695,8 @@ var Drawer2 = Object.assign(DrawerRoot, {
|
|
|
1689
1695
|
});
|
|
1690
1696
|
|
|
1691
1697
|
// src/components/Form.tsx
|
|
1692
|
-
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";
|
|
1693
|
-
import { Fragment as
|
|
1698
|
+
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, useState as useState9, useSyncExternalStore } from "react";
|
|
1699
|
+
import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1694
1700
|
var Switch = forwardRef2(function Switch2({
|
|
1695
1701
|
label,
|
|
1696
1702
|
variant = "standard",
|
|
@@ -1719,7 +1725,7 @@ var Switch = forwardRef2(function Switch2({
|
|
|
1719
1725
|
"aria-hidden": "true",
|
|
1720
1726
|
children: [
|
|
1721
1727
|
/* @__PURE__ */ jsx11("span", { className: "sia-switch__thumb" }),
|
|
1722
|
-
variant === "segmented" ? /* @__PURE__ */ jsxs11(
|
|
1728
|
+
variant === "segmented" ? /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
1723
1729
|
/* @__PURE__ */ jsx11("span", { className: "sia-switch__segment sia-switch__segment--unchecked", children: uncheckedVisual }),
|
|
1724
1730
|
/* @__PURE__ */ jsx11("span", { className: "sia-switch__segment sia-switch__segment--checked", children: checkedVisual })
|
|
1725
1731
|
] }) : hasContent ? /* @__PURE__ */ jsxs11("span", { className: "sia-switch__content", children: [
|
|
@@ -1916,9 +1922,18 @@ var FormStore = class {
|
|
|
1916
1922
|
return values;
|
|
1917
1923
|
};
|
|
1918
1924
|
submit = () => {
|
|
1919
|
-
void this.validateFields().then(
|
|
1920
|
-
|
|
1921
|
-
|
|
1925
|
+
void this.validateFields().then(
|
|
1926
|
+
async (values) => {
|
|
1927
|
+
try {
|
|
1928
|
+
await this.callbacks.onFinish?.(values);
|
|
1929
|
+
} catch {
|
|
1930
|
+
}
|
|
1931
|
+
},
|
|
1932
|
+
(info) => {
|
|
1933
|
+
this.callbacks.onFinishFailed?.(info);
|
|
1934
|
+
if (info.errorFields[0]) this.scrollToField(info.errorFields[0].name);
|
|
1935
|
+
}
|
|
1936
|
+
).catch(() => {
|
|
1922
1937
|
});
|
|
1923
1938
|
};
|
|
1924
1939
|
scrollToField = (name) => {
|
|
@@ -2044,6 +2059,8 @@ function FormItem({
|
|
|
2044
2059
|
const form = useContext2(FormContext);
|
|
2045
2060
|
const id = useId3();
|
|
2046
2061
|
const itemRef = useRef8(null);
|
|
2062
|
+
const errorContentRef = useRef8(null);
|
|
2063
|
+
const [errorPlacement, setErrorPlacement] = useState9("bottom-start");
|
|
2047
2064
|
if (!form) throw new Error("Form.Item \u5FC5\u987B\u5728 Form \u5185\u4F7F\u7528");
|
|
2048
2065
|
useSyncExternalStore(form.subscribe, form.getSnapshot, form.getSnapshot);
|
|
2049
2066
|
const path = name === void 0 ? void 0 : pathArray(name);
|
|
@@ -2054,6 +2071,44 @@ function FormItem({
|
|
|
2054
2071
|
const helpContent = help ?? errors[0];
|
|
2055
2072
|
const labelId = label && !noStyle ? `${id}-label` : void 0;
|
|
2056
2073
|
const errorId = `${id}-error`;
|
|
2074
|
+
const hasError = status === "error" && Boolean(helpContent);
|
|
2075
|
+
useEffect6(() => {
|
|
2076
|
+
setErrorPlacement("bottom-start");
|
|
2077
|
+
if (!hasError || noStyle) return void 0;
|
|
2078
|
+
const doc = itemRef.current?.ownerDocument;
|
|
2079
|
+
const view = doc?.defaultView;
|
|
2080
|
+
if (!doc || !view) return void 0;
|
|
2081
|
+
let frame = 0;
|
|
2082
|
+
let point;
|
|
2083
|
+
const measure = () => {
|
|
2084
|
+
frame = 0;
|
|
2085
|
+
const overlay = errorContentRef.current?.closest(".sia-form-item__error-popover");
|
|
2086
|
+
const bounds = overlay?.getBoundingClientRect();
|
|
2087
|
+
if (point && bounds && point.x >= bounds.left && point.x <= bounds.right && point.y >= bounds.top && point.y <= bounds.bottom) setErrorPlacement("top-start");
|
|
2088
|
+
};
|
|
2089
|
+
const schedule = () => {
|
|
2090
|
+
if (!frame) frame = view.requestAnimationFrame(measure);
|
|
2091
|
+
};
|
|
2092
|
+
const move = (event) => {
|
|
2093
|
+
point = { x: event.clientX, y: event.clientY };
|
|
2094
|
+
schedule();
|
|
2095
|
+
};
|
|
2096
|
+
const leave = () => {
|
|
2097
|
+
point = void 0;
|
|
2098
|
+
schedule();
|
|
2099
|
+
};
|
|
2100
|
+
doc.addEventListener("pointermove", move, { passive: true });
|
|
2101
|
+
doc.addEventListener("pointerleave", leave);
|
|
2102
|
+
doc.addEventListener("scroll", schedule, true);
|
|
2103
|
+
view.addEventListener("blur", leave);
|
|
2104
|
+
return () => {
|
|
2105
|
+
view.cancelAnimationFrame(frame);
|
|
2106
|
+
doc.removeEventListener("pointermove", move);
|
|
2107
|
+
doc.removeEventListener("pointerleave", leave);
|
|
2108
|
+
doc.removeEventListener("scroll", schedule, true);
|
|
2109
|
+
view.removeEventListener("blur", leave);
|
|
2110
|
+
};
|
|
2111
|
+
}, [hasError, noStyle, helpContent]);
|
|
2057
2112
|
useEffect6(() => {
|
|
2058
2113
|
if (!path) return void 0;
|
|
2059
2114
|
return form.registerField({
|
|
@@ -2097,9 +2152,8 @@ function FormItem({
|
|
|
2097
2152
|
content = children;
|
|
2098
2153
|
}
|
|
2099
2154
|
}
|
|
2100
|
-
if (noStyle) return /* @__PURE__ */ jsx11(
|
|
2155
|
+
if (noStyle) return /* @__PURE__ */ jsx11(Fragment4, { children: content });
|
|
2101
2156
|
const inputWrap = /* @__PURE__ */ jsx11("div", { className: "sia-form-item__input-wrap", children: content });
|
|
2102
|
-
const hasError = status === "error" && Boolean(helpContent);
|
|
2103
2157
|
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: [
|
|
2104
2158
|
label ? /* @__PURE__ */ jsx11("div", { id: labelId, className: "sia-form-item__label", children: /* @__PURE__ */ jsxs11("span", { className: "sia-form-item__label-content", children: [
|
|
2105
2159
|
ruleRequired ? /* @__PURE__ */ jsx11("span", { className: "sia-form-item__required-mark", "aria-hidden": "true", children: "*" }) : null,
|
|
@@ -2109,11 +2163,11 @@ function FormItem({
|
|
|
2109
2163
|
/* @__PURE__ */ jsx11(
|
|
2110
2164
|
Tooltip,
|
|
2111
2165
|
{
|
|
2112
|
-
title: hasError ? /* @__PURE__ */ jsxs11("span", { id: errorId, className: "sia-form-item__error-content", children: [
|
|
2166
|
+
title: hasError ? /* @__PURE__ */ jsxs11("span", { ref: errorContentRef, id: errorId, className: "sia-form-item__error-content", children: [
|
|
2113
2167
|
/* @__PURE__ */ jsx11(Icon, { className: "sia-form-item__error-icon", name: "circle-close", variant: "filled", size: 16, "aria-hidden": "true" }),
|
|
2114
2168
|
/* @__PURE__ */ jsx11("span", { children: helpContent })
|
|
2115
2169
|
] }) : null,
|
|
2116
|
-
placement:
|
|
2170
|
+
placement: errorPlacement,
|
|
2117
2171
|
trigger: [],
|
|
2118
2172
|
open: hasError,
|
|
2119
2173
|
role: "alert",
|
|
@@ -2249,7 +2303,7 @@ var Radio2 = Object.assign(RadioRoot, {
|
|
|
2249
2303
|
});
|
|
2250
2304
|
|
|
2251
2305
|
// src/components/Slider.tsx
|
|
2252
|
-
import { useState as
|
|
2306
|
+
import { useState as useState10 } from "react";
|
|
2253
2307
|
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2254
2308
|
function percent(value, min, max) {
|
|
2255
2309
|
return (value - min) / (max - min) * 100;
|
|
@@ -2273,7 +2327,7 @@ function Slider({
|
|
|
2273
2327
|
}) {
|
|
2274
2328
|
const fallback = defaultValue ?? (range ? [min, max] : min);
|
|
2275
2329
|
const [currentValue, setValue2] = useControllableState({ value, defaultValue: fallback, onChange });
|
|
2276
|
-
const [activeThumb, setActiveThumb] =
|
|
2330
|
+
const [activeThumb, setActiveThumb] = useState10(null);
|
|
2277
2331
|
const values = Array.isArray(currentValue) ? [...currentValue] : [currentValue];
|
|
2278
2332
|
const start = range ? percent(Math.min(values[0], values[1]), min, max) : 0;
|
|
2279
2333
|
const end = percent(range ? Math.max(values[0], values[1]) : values[0], min, max);
|
|
@@ -2370,7 +2424,7 @@ function Slider({
|
|
|
2370
2424
|
}
|
|
2371
2425
|
|
|
2372
2426
|
// src/components/ColorPicker.tsx
|
|
2373
|
-
import { useEffect as useEffect7, useRef as useRef9, useState as
|
|
2427
|
+
import { useEffect as useEffect7, useRef as useRef9, useState as useState11 } from "react";
|
|
2374
2428
|
import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2375
2429
|
var DEFAULT_MODES = ["solid", "gradient"];
|
|
2376
2430
|
var gradientStopSeed = 0;
|
|
@@ -2466,7 +2520,7 @@ function ColorPicker({
|
|
|
2466
2520
|
const lastEmittedValue = useRef9();
|
|
2467
2521
|
const initialGradient = parseGradient(value ?? defaultValue);
|
|
2468
2522
|
const initialSolid = initialGradient?.stops[0]?.color ?? normalizeHex(value || defaultValue);
|
|
2469
|
-
const [open, setOpen] =
|
|
2523
|
+
const [open, setOpen] = useState11(false);
|
|
2470
2524
|
const [color, setColor] = useControllableState({
|
|
2471
2525
|
value,
|
|
2472
2526
|
defaultValue: initialGradient ? formatGradient(initialGradient.angle, initialGradient.stops.map((stop, index) => ({ id: index, ...stop }))) : normalizeHex(defaultValue),
|
|
@@ -2477,15 +2531,15 @@ function ColorPicker({
|
|
|
2477
2531
|
defaultValue: initialGradient ? "gradient" : defaultMode,
|
|
2478
2532
|
onChange: onModeChange
|
|
2479
2533
|
});
|
|
2480
|
-
const [solidColor, setSolidColor] =
|
|
2481
|
-
const [gradientAngle, setGradientAngle] =
|
|
2482
|
-
const [gradientStops, setGradientStops] =
|
|
2483
|
-
const [activeStopId, setActiveStopId] =
|
|
2534
|
+
const [solidColor, setSolidColor] = useState11(initialSolid);
|
|
2535
|
+
const [gradientAngle, setGradientAngle] = useState11(initialGradient?.angle ?? 90);
|
|
2536
|
+
const [gradientStops, setGradientStops] = useState11(() => initialGradient ? initialGradient.stops.map((stop) => createStop(stop.color, stop.position)) : createDefaultStops(initialSolid));
|
|
2537
|
+
const [activeStopId, setActiveStopId] = useState11(() => gradientStops[0]?.id ?? 0);
|
|
2484
2538
|
const activeStop = gradientStops.find((stop) => stop.id === activeStopId) ?? gradientStops[0];
|
|
2485
2539
|
const editingColor = currentMode === "gradient" ? activeStop?.color ?? solidColor : solidColor;
|
|
2486
2540
|
const rgba = parseHex(editingColor) ?? parseHex("#1677FF");
|
|
2487
2541
|
const hsv = rgbToHsv(rgba);
|
|
2488
|
-
const [hexDraft, setHexDraft] =
|
|
2542
|
+
const [hexDraft, setHexDraft] = useState11(editingColor);
|
|
2489
2543
|
const gradientValue = formatGradient(gradientAngle, gradientStops);
|
|
2490
2544
|
useEffect7(() => {
|
|
2491
2545
|
if (!open) return void 0;
|
|
@@ -2686,7 +2740,7 @@ function ColorPicker({
|
|
|
2686
2740
|
}
|
|
2687
2741
|
|
|
2688
2742
|
// src/components/TimePicker.tsx
|
|
2689
|
-
import { useEffect as useEffect8, useId as useId5, useRef as useRef10, useState as
|
|
2743
|
+
import { useEffect as useEffect8, useId as useId5, useRef as useRef10, useState as useState12 } from "react";
|
|
2690
2744
|
import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2691
2745
|
function seconds(value) {
|
|
2692
2746
|
const [h = 0, m = 0, s = 0] = value.split(":").map(Number);
|
|
@@ -2722,8 +2776,8 @@ function TimePicker({
|
|
|
2722
2776
|
const popupRef = useRef10(null);
|
|
2723
2777
|
const focusPanel = useRef10(false);
|
|
2724
2778
|
const [currentValue, setValue2] = useControllableState({ value, defaultValue, onChange });
|
|
2725
|
-
const [open, setOpen] =
|
|
2726
|
-
const [draft, setDraft] =
|
|
2779
|
+
const [open, setOpen] = useState12(false);
|
|
2780
|
+
const [draft, setDraft] = useState12("00:00:00");
|
|
2727
2781
|
const normalize = (time) => showSecond ? (time + ":00").slice(0, 8) : time.slice(0, 5);
|
|
2728
2782
|
const unavailable = (time) => {
|
|
2729
2783
|
const normalized = normalize(time);
|
|
@@ -2860,8 +2914,8 @@ function TimeRangePicker({ value, defaultValue = ["", ""], placeholder = ["\u5F0
|
|
|
2860
2914
|
})(TimePicker || (TimePicker = {}));
|
|
2861
2915
|
|
|
2862
2916
|
// src/components/TreeSelect.tsx
|
|
2863
|
-
import { useEffect as useEffect9, useMemo as useMemo6, useRef as useRef11, useState as
|
|
2864
|
-
import { Fragment as
|
|
2917
|
+
import { useEffect as useEffect9, useMemo as useMemo6, useRef as useRef11, useState as useState13 } from "react";
|
|
2918
|
+
import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2865
2919
|
function flattenTree(nodes, expanded, search, filter, depth = 0, parents = [], ancestorMatched = false) {
|
|
2866
2920
|
const result = [];
|
|
2867
2921
|
for (const node of nodes) {
|
|
@@ -2944,7 +2998,7 @@ function TreeSelect({
|
|
|
2944
2998
|
});
|
|
2945
2999
|
const [open, setOpen] = useControllableState({ value: controlledOpen, defaultValue: defaultOpen, onChange: onDropdownVisibleChange });
|
|
2946
3000
|
const [search, setSearch] = useControllableState({ value: searchValue, defaultValue: "", onChange: onSearch });
|
|
2947
|
-
const [expanded, setExpanded] =
|
|
3001
|
+
const [expanded, setExpanded] = useState13(() => {
|
|
2948
3002
|
if (!treeDefaultExpandAll) return new Set(treeDefaultExpandedKeys);
|
|
2949
3003
|
const values = [];
|
|
2950
3004
|
const collect = (nodes) => nodes.forEach((node) => {
|
|
@@ -3086,7 +3140,7 @@ function TreeSelect({
|
|
|
3086
3140
|
}
|
|
3087
3141
|
},
|
|
3088
3142
|
children: [
|
|
3089
|
-
renderTrigger ? renderTrigger({ open, toggle: () => changeOpen(!open), clear }) : /* @__PURE__ */ jsxs16(
|
|
3143
|
+
renderTrigger ? renderTrigger({ open, toggle: () => changeOpen(!open), clear }) : /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
3090
3144
|
/* @__PURE__ */ jsxs16(
|
|
3091
3145
|
"button",
|
|
3092
3146
|
{
|
|
@@ -3179,7 +3233,7 @@ function buildFlatTree(items, options = {}) {
|
|
|
3179
3233
|
}
|
|
3180
3234
|
|
|
3181
3235
|
// src/components/Editor.tsx
|
|
3182
|
-
import { useEffect as useEffect10, useId as useId6, useRef as useRef12, useState as
|
|
3236
|
+
import { useEffect as useEffect10, useId as useId6, useRef as useRef12, useState as useState14 } from "react";
|
|
3183
3237
|
import EditorWorker from "monaco-editor/editor/editor.worker.js?worker";
|
|
3184
3238
|
|
|
3185
3239
|
// src/components/jsonLanguage.ts
|
|
@@ -3876,8 +3930,8 @@ function Editor({
|
|
|
3876
3930
|
const initialPathRef = useRef12(path);
|
|
3877
3931
|
const initialThemeRef = useRef12(theme);
|
|
3878
3932
|
const initialOptionsRef = useRef12(options);
|
|
3879
|
-
const [loading, setLoading] =
|
|
3880
|
-
const [, setSelectionVersion] =
|
|
3933
|
+
const [loading, setLoading] = useState14(true);
|
|
3934
|
+
const [, setSelectionVersion] = useState14(0);
|
|
3881
3935
|
initialValueRef.current = value;
|
|
3882
3936
|
initialLanguageRef.current = language;
|
|
3883
3937
|
initialPathRef.current = path;
|
|
@@ -4413,13 +4467,13 @@ function Editor({
|
|
|
4413
4467
|
}
|
|
4414
4468
|
|
|
4415
4469
|
// src/components/Markdown.tsx
|
|
4416
|
-
import { useEffect as useEffect11, useMemo as useMemo7, useRef as useRef13, useState as
|
|
4470
|
+
import { useEffect as useEffect11, useMemo as useMemo7, useRef as useRef13, useState as useState15 } from "react";
|
|
4417
4471
|
import DOMPurify from "dompurify";
|
|
4418
4472
|
import { marked } from "marked";
|
|
4419
|
-
import { Fragment as
|
|
4473
|
+
import { Fragment as Fragment6, jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4420
4474
|
function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", resolveImageSrc, imagePreview = true, className = "", onClick, onKeyDown, ...props }) {
|
|
4421
4475
|
const rootRef = useRef13(null);
|
|
4422
|
-
const [previewImage, setPreviewImage] =
|
|
4476
|
+
const [previewImage, setPreviewImage] = useState15(null);
|
|
4423
4477
|
const html = useMemo7(() => {
|
|
4424
4478
|
const rendered = marked.parse(content, { breaks: true, gfm: true });
|
|
4425
4479
|
const sanitized = DOMPurify.sanitize(rendered, { USE_PROFILES: { html: true } });
|
|
@@ -4484,7 +4538,7 @@ function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", r
|
|
|
4484
4538
|
if (!content.trim()) {
|
|
4485
4539
|
return /* @__PURE__ */ jsx18("div", { className: `sia-markdown sia-markdown--empty ${className}`.trim(), children: emptyText });
|
|
4486
4540
|
}
|
|
4487
|
-
return /* @__PURE__ */ jsxs18(
|
|
4541
|
+
return /* @__PURE__ */ jsxs18(Fragment6, { children: [
|
|
4488
4542
|
/* @__PURE__ */ jsx18("article", { ...withTitleTooltip(props), ref: rootRef, className: `sia-markdown ${className}`.trim(), onClick: handleClick, onKeyDown: handleKeyDown, dangerouslySetInnerHTML: { __html: html } }),
|
|
4489
4543
|
/* @__PURE__ */ jsx18(ImagePreview, { open: Boolean(previewImage), src: previewImage?.src, alt: previewImage?.alt, onOpenChange: (open) => {
|
|
4490
4544
|
if (!open) setPreviewImage(null);
|
|
@@ -4493,7 +4547,7 @@ function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", r
|
|
|
4493
4547
|
}
|
|
4494
4548
|
|
|
4495
4549
|
// src/components/InputNumber.tsx
|
|
4496
|
-
import { forwardRef as forwardRef4, useEffect as useEffect12, useId as useId7, useRef as useRef14, useState as
|
|
4550
|
+
import { forwardRef as forwardRef4, useEffect as useEffect12, useId as useId7, useRef as useRef14, useState as useState16 } from "react";
|
|
4497
4551
|
import { jsx as jsx19, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4498
4552
|
function formatValue(value, precision) {
|
|
4499
4553
|
if (value === null || !Number.isFinite(value)) return "";
|
|
@@ -4533,7 +4587,7 @@ var InputNumber = forwardRef4(function InputNumber2({
|
|
|
4533
4587
|
const plain = formatValue(next, precision);
|
|
4534
4588
|
return plain && formatter ? formatter(plain) : plain;
|
|
4535
4589
|
};
|
|
4536
|
-
const [text, setText] =
|
|
4590
|
+
const [text, setText] = useState16(() => displayValue(currentValue));
|
|
4537
4591
|
useEffect12(() => {
|
|
4538
4592
|
setText(displayValue(currentValue));
|
|
4539
4593
|
}, [currentValue, precision, formatter]);
|
|
@@ -4640,11 +4694,11 @@ var InputNumber = forwardRef4(function InputNumber2({
|
|
|
4640
4694
|
});
|
|
4641
4695
|
|
|
4642
4696
|
// src/components/SelectModal.tsx
|
|
4643
|
-
import { useState as
|
|
4644
|
-
import { Fragment as
|
|
4697
|
+
import { useState as useState17 } from "react";
|
|
4698
|
+
import { Fragment as Fragment7, jsx as jsx20, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4645
4699
|
function SelectModalBody({ config, values, disabled, onChange }) {
|
|
4646
|
-
const [query, setQuery] =
|
|
4647
|
-
const [selectedOnly, setSelectedOnly] =
|
|
4700
|
+
const [query, setQuery] = useState17("");
|
|
4701
|
+
const [selectedOnly, setSelectedOnly] = useState17(false);
|
|
4648
4702
|
const multiple = config.mode === "multiple";
|
|
4649
4703
|
const search = query.trim();
|
|
4650
4704
|
const filtered = config.options.filter((option) => !search || (config.filterOption ? config.filterOption(search, option) : [option.label, option.value].some((text) => String(text ?? "").toLowerCase().includes(search.toLowerCase()))));
|
|
@@ -4658,7 +4712,7 @@ function SelectModalBody({ config, values, disabled, onChange }) {
|
|
|
4658
4712
|
});
|
|
4659
4713
|
onChange([...next]);
|
|
4660
4714
|
};
|
|
4661
|
-
return /* @__PURE__ */ jsxs20(
|
|
4715
|
+
return /* @__PURE__ */ jsxs20(Fragment7, { children: [
|
|
4662
4716
|
config.headerExtra != null && config.headerExtra !== false ? /* @__PURE__ */ jsx20("div", { className: "sia-select-modal__header-extra", children: config.headerExtra }) : null,
|
|
4663
4717
|
/* @__PURE__ */ jsxs20("div", { className: "sia-select-modal__heading", children: [
|
|
4664
4718
|
/* @__PURE__ */ jsxs20("div", { role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
@@ -4769,7 +4823,7 @@ function openSelectModal(config) {
|
|
|
4769
4823
|
}
|
|
4770
4824
|
|
|
4771
4825
|
// src/components/Treemap.tsx
|
|
4772
|
-
import { useEffect as useEffect13, useMemo as useMemo8, useRef as useRef15, useState as
|
|
4826
|
+
import { useEffect as useEffect13, useMemo as useMemo8, useRef as useRef15, useState as useState18 } from "react";
|
|
4773
4827
|
import { jsx as jsx21, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4774
4828
|
import { createElement } from "react";
|
|
4775
4829
|
function positiveValue(value) {
|
|
@@ -5143,9 +5197,9 @@ function Treemap({
|
|
|
5143
5197
|
...props
|
|
5144
5198
|
}) {
|
|
5145
5199
|
const containerRef = useRef15(null);
|
|
5146
|
-
const [size, setSize] =
|
|
5147
|
-
const [internalExpandedKeys, setInternalExpandedKeys] =
|
|
5148
|
-
const [internalFocusedKey, setInternalFocusedKey] =
|
|
5200
|
+
const [size, setSize] = useState18({ width: 0, height: 0 });
|
|
5201
|
+
const [internalExpandedKeys, setInternalExpandedKeys] = useState18(() => [...defaultExpandedKeys]);
|
|
5202
|
+
const [internalFocusedKey, setInternalFocusedKey] = useState18(defaultFocusedKey);
|
|
5149
5203
|
const currentExpandedKeys = expandedKeys ?? internalExpandedKeys;
|
|
5150
5204
|
const currentFocusedKey = focusedKey === void 0 ? internalFocusedKey : focusedKey;
|
|
5151
5205
|
const expandedSet = useMemo8(() => new Set(currentExpandedKeys), [currentExpandedKeys]);
|
|
@@ -5295,7 +5349,7 @@ function Treemap({
|
|
|
5295
5349
|
}
|
|
5296
5350
|
|
|
5297
5351
|
// src/components/Table/TableCellContent.tsx
|
|
5298
|
-
import { useLayoutEffect as useLayoutEffect4, useRef as useRef16, useState as
|
|
5352
|
+
import { useLayoutEffect as useLayoutEffect4, useRef as useRef16, useState as useState19 } from "react";
|
|
5299
5353
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
5300
5354
|
var pendingLayouts = /* @__PURE__ */ new Map();
|
|
5301
5355
|
var layoutFrame;
|
|
@@ -5315,7 +5369,7 @@ function scheduleLayout(element, task) {
|
|
|
5315
5369
|
}
|
|
5316
5370
|
function TableCellContent({ children, ellipsis, title }) {
|
|
5317
5371
|
const ref = useRef16(null);
|
|
5318
|
-
const [overflowing, setOverflowing] =
|
|
5372
|
+
const [overflowing, setOverflowing] = useState19(false);
|
|
5319
5373
|
const customContent = typeof children !== "string" && typeof children !== "number" && children != null;
|
|
5320
5374
|
useLayoutEffect4(() => {
|
|
5321
5375
|
const element = ref.current;
|
|
@@ -5353,9 +5407,9 @@ function TableCellContent({ children, ellipsis, title }) {
|
|
|
5353
5407
|
}
|
|
5354
5408
|
|
|
5355
5409
|
// src/components/Table/useRemainingHeight.ts
|
|
5356
|
-
import { useLayoutEffect as useLayoutEffect5, useState as
|
|
5410
|
+
import { useLayoutEffect as useLayoutEffect5, useState as useState20 } from "react";
|
|
5357
5411
|
function useRemainingHeight(rootRef, options) {
|
|
5358
|
-
const [height, setHeight] =
|
|
5412
|
+
const [height, setHeight] = useState20();
|
|
5359
5413
|
const enabled = !!options;
|
|
5360
5414
|
const container = typeof options === "object" ? options.container : void 0;
|
|
5361
5415
|
const bottomOffset = typeof options === "object" ? options.bottomOffset ?? 0 : 0;
|
|
@@ -5630,10 +5684,10 @@ function createRowIdentity() {
|
|
|
5630
5684
|
}
|
|
5631
5685
|
|
|
5632
5686
|
// src/components/Table/Table.tsx
|
|
5633
|
-
import { Fragment as
|
|
5687
|
+
import { Fragment as Fragment9, forwardRef as forwardRef5, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as useEffect15, useImperativeHandle, useMemo as useMemo9, useRef as useRef19, useState as useState22 } from "react";
|
|
5634
5688
|
|
|
5635
5689
|
// src/components/Table/plugins.tsx
|
|
5636
|
-
import { isValidElement as isValidElement3, useEffect as useEffect14, useRef as useRef18, useState as
|
|
5690
|
+
import { isValidElement as isValidElement3, useEffect as useEffect14, useRef as useRef18, useState as useState21 } from "react";
|
|
5637
5691
|
|
|
5638
5692
|
// src/components/Table/columnSettings.ts
|
|
5639
5693
|
function reconcileColumnSettings(columns, defaults, saved) {
|
|
@@ -5720,7 +5774,7 @@ function saveSettingsPatch(adapter, scope, patch) {
|
|
|
5720
5774
|
}
|
|
5721
5775
|
|
|
5722
5776
|
// src/components/Table/plugins.tsx
|
|
5723
|
-
import { Fragment as
|
|
5777
|
+
import { Fragment as Fragment8, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5724
5778
|
function TableCheckbox({
|
|
5725
5779
|
checked,
|
|
5726
5780
|
indeterminate,
|
|
@@ -6346,7 +6400,7 @@ function TableSelectedItemsPanel({
|
|
|
6346
6400
|
onRemove,
|
|
6347
6401
|
onClear
|
|
6348
6402
|
}) {
|
|
6349
|
-
const [showAll, setShowAll] =
|
|
6403
|
+
const [showAll, setShowAll] = useState21(false);
|
|
6350
6404
|
const visibleEntries = showAll ? entries : entries.slice(0, maxCount);
|
|
6351
6405
|
const hiddenCount = Math.max(0, entries.length - visibleEntries.length);
|
|
6352
6406
|
const baseColumnMap = new Map(
|
|
@@ -6715,7 +6769,7 @@ function createSortPlugin(options = {}) {
|
|
|
6715
6769
|
event.stopPropagation();
|
|
6716
6770
|
cycle(field, context);
|
|
6717
6771
|
},
|
|
6718
|
-
children: order ? /* @__PURE__ */ jsx24(Icon, { name: order === "ascend" ? "chevron-up" : "chevron-down", size: 18 }) : /* @__PURE__ */ jsxs22(
|
|
6772
|
+
children: order ? /* @__PURE__ */ jsx24(Icon, { name: order === "ascend" ? "chevron-up" : "chevron-down", size: 18 }) : /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
6719
6773
|
/* @__PURE__ */ jsx24(Icon, { name: "chevron-up", size: 11 }),
|
|
6720
6774
|
/* @__PURE__ */ jsx24(Icon, { name: "chevron-down", size: 11 })
|
|
6721
6775
|
] })
|
|
@@ -6752,8 +6806,8 @@ function TableFilterControl({
|
|
|
6752
6806
|
placeholder,
|
|
6753
6807
|
onApply
|
|
6754
6808
|
}) {
|
|
6755
|
-
const [open, setOpen] =
|
|
6756
|
-
const [draft, setDraft] =
|
|
6809
|
+
const [open, setOpen] = useState21(false);
|
|
6810
|
+
const [draft, setDraft] = useState21(value);
|
|
6757
6811
|
const label = getColumnLabel(column);
|
|
6758
6812
|
useEffect14(() => {
|
|
6759
6813
|
if (open) setDraft(value);
|
|
@@ -7113,7 +7167,7 @@ function createTreePlugin(options = {}) {
|
|
|
7113
7167
|
className: `sia-table__tree-cell${options.showLine ? " sia-table__tree-cell--lines" : ""}`,
|
|
7114
7168
|
style: options.showLine ? void 0 : { paddingLeft: info.row.depth * 18 },
|
|
7115
7169
|
children: [
|
|
7116
|
-
options.showLine && info.row.depth > 0 && /* @__PURE__ */ jsxs22(
|
|
7170
|
+
options.showLine && info.row.depth > 0 && /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
7117
7171
|
info.row.meta.treeGuides.map((continued, level) => /* @__PURE__ */ jsx24("span", { "aria-hidden": "true", className: `sia-table__tree-guide${continued ? " sia-table__tree-guide--continued" : ""}` }, level)),
|
|
7118
7172
|
/* @__PURE__ */ jsx24("span", { "aria-hidden": "true", className: `sia-table__tree-guide sia-table__tree-guide--branch${info.row.meta.treeHasNextSibling ? " sia-table__tree-guide--continued" : ""}` })
|
|
7119
7173
|
] }),
|
|
@@ -7193,8 +7247,8 @@ function EditableTableCell({
|
|
|
7193
7247
|
trigger
|
|
7194
7248
|
}) {
|
|
7195
7249
|
const config = typeof editable === "object" ? editable : { type: "input" };
|
|
7196
|
-
const [editValue, setEditValue] =
|
|
7197
|
-
const [saving, setSaving] =
|
|
7250
|
+
const [editValue, setEditValue] = useState21(value);
|
|
7251
|
+
const [saving, setSaving] = useState21(false);
|
|
7198
7252
|
const inputRef = useRef18(null);
|
|
7199
7253
|
const editorRef = useRef18(null);
|
|
7200
7254
|
const editValueRef = useRef18(value);
|
|
@@ -7539,10 +7593,10 @@ function ColumnSettingPanel({
|
|
|
7539
7593
|
onClose,
|
|
7540
7594
|
onApply
|
|
7541
7595
|
}) {
|
|
7542
|
-
const [draft, setDraft] =
|
|
7596
|
+
const [draft, setDraft] = useState21(items);
|
|
7543
7597
|
const listRef = useRef18(null);
|
|
7544
7598
|
const cancelDrag = useRef18(null);
|
|
7545
|
-
const [preview, setPreview] =
|
|
7599
|
+
const [preview, setPreview] = useState21(null);
|
|
7546
7600
|
useEffect14(() => {
|
|
7547
7601
|
cancelDrag.current?.();
|
|
7548
7602
|
if (open) setDraft(orderColumnSettings(items));
|
|
@@ -7683,7 +7737,7 @@ function ColumnSettingPanel({
|
|
|
7683
7737
|
onOpenChange: (next) => {
|
|
7684
7738
|
if (!next) onClose();
|
|
7685
7739
|
},
|
|
7686
|
-
footer: /* @__PURE__ */ jsxs22(
|
|
7740
|
+
footer: /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
7687
7741
|
/* @__PURE__ */ jsx24(Button, { onClick: onClose, children: "\u53D6\u6D88" }),
|
|
7688
7742
|
/* @__PURE__ */ jsx24(
|
|
7689
7743
|
Button,
|
|
@@ -8027,7 +8081,7 @@ function ToolbarItems({
|
|
|
8027
8081
|
items,
|
|
8028
8082
|
context
|
|
8029
8083
|
}) {
|
|
8030
|
-
return /* @__PURE__ */ jsx24(
|
|
8084
|
+
return /* @__PURE__ */ jsx24(Fragment8, { children: items.map((item) => {
|
|
8031
8085
|
if (item.hidden === true || typeof item.hidden === "function" && item.hidden(context))
|
|
8032
8086
|
return null;
|
|
8033
8087
|
const disabled = item.disabled === true || typeof item.disabled === "function" && item.disabled(context);
|
|
@@ -8054,11 +8108,11 @@ function createToolbarPlugin(options) {
|
|
|
8054
8108
|
return {
|
|
8055
8109
|
id: "toolbar",
|
|
8056
8110
|
order: 5,
|
|
8057
|
-
renderToolbarStart: (context) => /* @__PURE__ */ jsxs22(
|
|
8111
|
+
renderToolbarStart: (context) => /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
8058
8112
|
options.start,
|
|
8059
8113
|
/* @__PURE__ */ jsx24(ToolbarItems, { items: items("start"), context })
|
|
8060
8114
|
] }),
|
|
8061
|
-
renderToolbarEnd: (context) => /* @__PURE__ */ jsxs22(
|
|
8115
|
+
renderToolbarEnd: (context) => /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
8062
8116
|
options.end,
|
|
8063
8117
|
/* @__PURE__ */ jsx24(ToolbarItems, { items: items("end"), context }),
|
|
8064
8118
|
items("end", true).length > 0 ? /* @__PURE__ */ jsxs22("details", { className: "sia-table__toolbar-menu", children: [
|
|
@@ -8377,13 +8431,13 @@ function TableInner(props, ref) {
|
|
|
8377
8431
|
const tableRef = useRef19(null);
|
|
8378
8432
|
useScrollbarProximity();
|
|
8379
8433
|
const scrollbarDragRef = useRef19(null);
|
|
8380
|
-
const [internalLoading, setInternalLoading] =
|
|
8381
|
-
const [scrollTop, setScrollTop] =
|
|
8382
|
-
const [scrollLeft, setScrollLeft] =
|
|
8383
|
-
const [viewportHeight, setViewportHeight] =
|
|
8384
|
-
const [viewportWidth, setViewportWidth] =
|
|
8385
|
-
const [autoColumnWidths, setAutoColumnWidths] =
|
|
8386
|
-
const [resolveRowIdentity] =
|
|
8434
|
+
const [internalLoading, setInternalLoading] = useState22(false);
|
|
8435
|
+
const [scrollTop, setScrollTop] = useState22(0);
|
|
8436
|
+
const [scrollLeft, setScrollLeft] = useState22(0);
|
|
8437
|
+
const [viewportHeight, setViewportHeight] = useState22(420);
|
|
8438
|
+
const [viewportWidth, setViewportWidth] = useState22(0);
|
|
8439
|
+
const [autoColumnWidths, setAutoColumnWidths] = useState22({});
|
|
8440
|
+
const [resolveRowIdentity] = useState22(createRowIdentity);
|
|
8387
8441
|
const getRowKey = useCallback2((record, index) => resolveRowIdentity(record, index, typeof rowKey === "function" ? rowKey : rowKey == null ? void 0 : String(rowKey)), [rowKey, resolveRowIdentity]);
|
|
8388
8442
|
const builtInResizePlugin = useMemo9(() => createResizePlugin(), []);
|
|
8389
8443
|
const builtInHighlightPlugin = useMemo9(() => createHighlightPlugin(), []);
|
|
@@ -8400,7 +8454,7 @@ function TableInner(props, ref) {
|
|
|
8400
8454
|
const sortedPlugins = useMemo9(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
|
|
8401
8455
|
const pluginsByIdRef = useRef19(/* @__PURE__ */ new Map());
|
|
8402
8456
|
pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
8403
|
-
const [pluginStates, setPluginStates] =
|
|
8457
|
+
const [pluginStates, setPluginStates] = useState22(() => Object.fromEntries(
|
|
8404
8458
|
sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
|
|
8405
8459
|
));
|
|
8406
8460
|
const pluginApisRef = useRef19({});
|
|
@@ -8648,20 +8702,20 @@ function TableInner(props, ref) {
|
|
|
8648
8702
|
]);
|
|
8649
8703
|
const toolbarStart = sortedPlugins.map((plugin) => {
|
|
8650
8704
|
const content = plugin.renderToolbarStart?.(getContext(plugin));
|
|
8651
|
-
return content ? /* @__PURE__ */ jsx25(
|
|
8705
|
+
return content ? /* @__PURE__ */ jsx25(Fragment9, { children: content }, `toolbar-start-${plugin.id}`) : null;
|
|
8652
8706
|
}).filter(Boolean);
|
|
8653
8707
|
const toolbarEnd = sortedPlugins.map((plugin) => {
|
|
8654
8708
|
const content = plugin.renderToolbarEnd?.(getContext(plugin));
|
|
8655
|
-
return content ? /* @__PURE__ */ jsx25(
|
|
8709
|
+
return content ? /* @__PURE__ */ jsx25(Fragment9, { children: content }, `toolbar-end-${plugin.id}`) : null;
|
|
8656
8710
|
}).filter(Boolean);
|
|
8657
8711
|
const summaries = sortedPlugins.flatMap((plugin) => plugin.renderSummary?.(getContext(plugin)) ?? []);
|
|
8658
8712
|
const footers = sortedPlugins.map((plugin) => {
|
|
8659
8713
|
const content = plugin.renderFooter?.(getContext(plugin));
|
|
8660
|
-
return content ? /* @__PURE__ */ jsx25(
|
|
8714
|
+
return content ? /* @__PURE__ */ jsx25(Fragment9, { children: content }, `footer-${plugin.id}`) : null;
|
|
8661
8715
|
}).filter(Boolean);
|
|
8662
8716
|
const overlays = sortedPlugins.map((plugin) => {
|
|
8663
8717
|
const content = plugin.renderOverlay?.(getContext(plugin));
|
|
8664
|
-
return content ? /* @__PURE__ */ jsx25(
|
|
8718
|
+
return content ? /* @__PURE__ */ jsx25(Fragment9, { children: content }, `overlay-${plugin.id}`) : null;
|
|
8665
8719
|
}).filter(Boolean);
|
|
8666
8720
|
const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
|
|
8667
8721
|
const effectiveHeight = height ?? tableHeight ?? remainingHeight ?? (shouldVirtualize && maxBodyHeight == null ? 420 : void 0);
|
|
@@ -9085,7 +9139,7 @@ function applySiaTheme(mode, target = document.documentElement) {
|
|
|
9085
9139
|
}
|
|
9086
9140
|
|
|
9087
9141
|
// src/components/InputSelect.tsx
|
|
9088
|
-
import { forwardRef as forwardRef7, useEffect as useEffect16, useRef as useRef20, useState as
|
|
9142
|
+
import { forwardRef as forwardRef7, useEffect as useEffect16, useRef as useRef20, useState as useState23 } from "react";
|
|
9089
9143
|
import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
9090
9144
|
var InputSelect = forwardRef7(function InputSelect2({
|
|
9091
9145
|
options,
|
|
@@ -9113,19 +9167,19 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
9113
9167
|
...inputProps
|
|
9114
9168
|
}, forwardedRef) {
|
|
9115
9169
|
const size = useControlSize(sizeProp);
|
|
9116
|
-
const [internal, setInternal] =
|
|
9170
|
+
const [internal, setInternal] = useState23(defaultValue);
|
|
9117
9171
|
const current = value !== void 0 ? value : internal;
|
|
9118
9172
|
const values = current == null ? [] : Array.isArray(current) ? current : [current];
|
|
9119
9173
|
const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
|
|
9120
|
-
const [draft, setDraft] =
|
|
9174
|
+
const [draft, setDraft] = useState23(text);
|
|
9121
9175
|
useEffect16(() => {
|
|
9122
9176
|
setDraft(text);
|
|
9123
9177
|
}, [text, current]);
|
|
9124
|
-
const [open, setOpen] =
|
|
9125
|
-
const [search, setSearch] =
|
|
9126
|
-
const [modalOpen, setModalOpen] =
|
|
9127
|
-
const [modalValues, setModalValues] =
|
|
9128
|
-
const [selectedOnly, setSelectedOnly] =
|
|
9178
|
+
const [open, setOpen] = useState23(false);
|
|
9179
|
+
const [search, setSearch] = useState23("");
|
|
9180
|
+
const [modalOpen, setModalOpen] = useState23(false);
|
|
9181
|
+
const [modalValues, setModalValues] = useState23([]);
|
|
9182
|
+
const [selectedOnly, setSelectedOnly] = useState23(false);
|
|
9129
9183
|
const rootRef = useRef20(null);
|
|
9130
9184
|
const popupRef = useRef20(null);
|
|
9131
9185
|
const inputRef = useRef20(null);
|
|
@@ -9289,13 +9343,13 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
9289
9343
|
});
|
|
9290
9344
|
|
|
9291
9345
|
// src/components/QueryForm.tsx
|
|
9292
|
-
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect7, useRef as useRef23, useState as
|
|
9346
|
+
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect7, useRef as useRef23, useState as useState26 } from "react";
|
|
9293
9347
|
|
|
9294
9348
|
// src/components/QueryFormSettings.tsx
|
|
9295
|
-
import { useEffect as useEffect18, useRef as useRef22, useState as
|
|
9349
|
+
import { useEffect as useEffect18, useRef as useRef22, useState as useState25 } from "react";
|
|
9296
9350
|
|
|
9297
9351
|
// src/components/useQueryFieldSort.ts
|
|
9298
|
-
import { useEffect as useEffect17, useRef as useRef21, useState as
|
|
9352
|
+
import { useEffect as useEffect17, useRef as useRef21, useState as useState24 } from "react";
|
|
9299
9353
|
function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
9300
9354
|
const center = rects[from].top + rects[from].height / 2 + dy;
|
|
9301
9355
|
const rest = keys.map((_, index) => index).filter((index) => index !== from);
|
|
@@ -9318,7 +9372,7 @@ function useQueryFieldSort(keys, enabled, onCommit) {
|
|
|
9318
9372
|
const cancelRef = useRef21();
|
|
9319
9373
|
const commitRef = useRef21(onCommit);
|
|
9320
9374
|
commitRef.current = onCommit;
|
|
9321
|
-
const [preview, setPreview] =
|
|
9375
|
+
const [preview, setPreview] = useState24();
|
|
9322
9376
|
const signature = JSON.stringify(keys);
|
|
9323
9377
|
useEffect17(() => {
|
|
9324
9378
|
cancelRef.current?.();
|
|
@@ -9443,15 +9497,15 @@ function countQueryFieldRows(centers) {
|
|
|
9443
9497
|
}
|
|
9444
9498
|
|
|
9445
9499
|
// src/components/QueryFormSettings.tsx
|
|
9446
|
-
import { Fragment as
|
|
9500
|
+
import { Fragment as Fragment10, jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
9447
9501
|
function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed, disabled) {
|
|
9448
|
-
const [snapshot, setSnapshot] =
|
|
9449
|
-
const [draft, setDraft] =
|
|
9450
|
-
const [open, setOpen] =
|
|
9451
|
-
const [loading, setLoading] =
|
|
9452
|
-
const [saving, setSaving] =
|
|
9453
|
-
const [error, setError] =
|
|
9454
|
-
const [loadFailed, setLoadFailed] =
|
|
9502
|
+
const [snapshot, setSnapshot] = useState25();
|
|
9503
|
+
const [draft, setDraft] = useState25({ fields: [], defaultCollapsed: defaultCollapsed ?? false });
|
|
9504
|
+
const [open, setOpen] = useState25(false);
|
|
9505
|
+
const [loading, setLoading] = useState25(false);
|
|
9506
|
+
const [saving, setSaving] = useState25(false);
|
|
9507
|
+
const [error, setError] = useState25("");
|
|
9508
|
+
const [loadFailed, setLoadFailed] = useState25(false);
|
|
9455
9509
|
const token = useRef22(0);
|
|
9456
9510
|
const saveLock = useRef22(false);
|
|
9457
9511
|
const latest = useRef22({ config, fields, defaultCollapsed, applyCollapsed });
|
|
@@ -9554,7 +9608,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
9554
9608
|
}
|
|
9555
9609
|
}
|
|
9556
9610
|
) : null;
|
|
9557
|
-
const panel = config ? /* @__PURE__ */ jsxs26(
|
|
9611
|
+
const panel = config ? /* @__PURE__ */ jsxs26(Fragment10, { children: [
|
|
9558
9612
|
!open && error ? /* @__PURE__ */ jsx28("span", { className: "sia-query-form__error", role: "alert", children: "\u67E5\u8BE2\u8BBE\u7F6E\u8BFB\u53D6\u5931\u8D25\uFF0C\u8BF7\u6253\u5F00\u8BBE\u7F6E\u91CD\u8BD5" }) : null,
|
|
9559
9613
|
/* @__PURE__ */ jsx28(
|
|
9560
9614
|
Modal,
|
|
@@ -9640,18 +9694,18 @@ function QueryForm({
|
|
|
9640
9694
|
...formProps
|
|
9641
9695
|
}) {
|
|
9642
9696
|
const [form] = useForm(providedForm);
|
|
9643
|
-
const [internalCollapsed, setInternalCollapsed] =
|
|
9644
|
-
const [expandedRows, setExpandedRows] =
|
|
9645
|
-
const [needsCollapse, setNeedsCollapse] =
|
|
9697
|
+
const [internalCollapsed, setInternalCollapsed] = useState26(defaultCollapsed);
|
|
9698
|
+
const [expandedRows, setExpandedRows] = useState26(0);
|
|
9699
|
+
const [needsCollapse, setNeedsCollapse] = useState26(false);
|
|
9646
9700
|
const collapsed = collapsible && needsCollapse && (controlledCollapsed ?? internalCollapsed ?? expandedRows >= 3);
|
|
9647
|
-
const [searching, setSearching] =
|
|
9648
|
-
const [saving, setSaving] =
|
|
9649
|
-
const [removing, setRemoving] =
|
|
9650
|
-
const [saveOpen, setSaveOpen] =
|
|
9651
|
-
const [saveName, setSaveName] =
|
|
9652
|
-
const [saveError, setSaveError] =
|
|
9653
|
-
const [error, setError] =
|
|
9654
|
-
const [activeShortcut, setActiveShortcut] =
|
|
9701
|
+
const [searching, setSearching] = useState26(false);
|
|
9702
|
+
const [saving, setSaving] = useState26(false);
|
|
9703
|
+
const [removing, setRemoving] = useState26(false);
|
|
9704
|
+
const [saveOpen, setSaveOpen] = useState26(false);
|
|
9705
|
+
const [saveName, setSaveName] = useState26("");
|
|
9706
|
+
const [saveError, setSaveError] = useState26("");
|
|
9707
|
+
const [error, setError] = useState26("");
|
|
9708
|
+
const [activeShortcut, setActiveShortcut] = useState26("");
|
|
9655
9709
|
const source = useRef23({ source: "submit" });
|
|
9656
9710
|
const searchLock = useRef23(false);
|
|
9657
9711
|
const saveLock = useRef23(false);
|
|
@@ -9686,8 +9740,8 @@ function QueryForm({
|
|
|
9686
9740
|
const rowRef = useRef23(null);
|
|
9687
9741
|
const actionsRef = useRef23(null);
|
|
9688
9742
|
const toggleRef = useRef23(null);
|
|
9689
|
-
const [fittingCount, setFittingCount] =
|
|
9690
|
-
const [settingsRows, setSettingsRows] =
|
|
9743
|
+
const [fittingCount, setFittingCount] = useState26(limit);
|
|
9744
|
+
const [settingsRows, setSettingsRows] = useState26(0);
|
|
9691
9745
|
useLayoutEffect7(() => {
|
|
9692
9746
|
const row = rowRef.current;
|
|
9693
9747
|
const actions = actionsRef.current;
|