@sia.soul/sia-react-ui 0.1.105 → 0.1.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Button-BiL3Wjsd.d.ts +44 -0
- package/dist/Button-O_pNB3SQ.d.cts +44 -0
- package/dist/{Select-DmT9pFRW.d.ts → Select-BddM4uXC.d.ts} +4 -42
- package/dist/{Select-DQpfyK7I.d.cts → Select-Cf0xz1Tg.d.cts} +4 -42
- package/dist/chart.js +5 -3
- package/dist/chunk-4TTHKFJ7.js +706 -0
- package/dist/chunk-CZ2ITBRW.js +65 -0
- package/dist/{chunk-EYB55TC5.js → chunk-D3HXXEEZ.js} +9 -5
- package/dist/{chunk-X4OLHWC3.js → chunk-JEDJQ257.js} +11 -7
- package/dist/chunk-KY6A5IJH.js +18 -0
- package/dist/{chunk-NURPAO7G.js → chunk-MMSYWDTR.js} +9 -5
- package/dist/{chunk-PUZWLIIJ.js → chunk-NZMUW5XI.js} +1 -13
- package/dist/{chunk-D456SSL3.js → chunk-OJ2WDC66.js} +6 -4
- package/dist/{chunk-V6CRVCSB.js → chunk-QV3AP6A2.js} +40 -729
- package/dist/chunk-RX242MUO.js +0 -0
- package/dist/chunk-SCEHVGKV.js +75 -0
- package/dist/{chunk-TUXNOSCT.js → chunk-SO7IJZIR.js} +4 -2
- package/dist/{chunk-T3EGAN7O.js → chunk-WD56MJO2.js} +5 -3
- package/dist/{core-_1K1jLyH.d.ts → core-Bm-1bOjF.d.ts} +8 -1
- package/dist/{core-DF7gei-P.d.cts → core-zpQkbNf_.d.cts} +8 -1
- package/dist/core.cjs +3 -1
- package/dist/core.css +40 -0
- package/dist/core.d.cts +3 -2
- package/dist/core.d.ts +3 -2
- package/dist/core.js +12 -7
- package/dist/game.cjs +2801 -0
- package/dist/game.css +8919 -0
- package/dist/game.d.cts +416 -0
- package/dist/game.d.ts +416 -0
- package/dist/game.js +1020 -0
- package/dist/index.cjs +5523 -5461
- package/dist/index.css +80 -0
- package/dist/index.d.cts +51 -10
- package/dist/index.d.ts +51 -10
- package/dist/index.js +723 -657
- package/dist/markdown-editor.js +3 -2
- package/dist/rich-text-editor.cjs +3 -1
- package/dist/rich-text-editor.js +7 -4
- package/dist/{select-date-range-BT71tp7y.d.cts → select-date-range-Cm5o2xPp.d.cts} +1 -1
- package/dist/{select-date-range-CFGzoyLs.d.ts → select-date-range-yGDEA1RP.d.ts} +1 -1
- package/dist/select-date-range.d.cts +3 -2
- package/dist/select-date-range.d.ts +3 -2
- package/dist/select-date-range.js +8 -5
- package/package.json +9 -3
- package/dist/chunk-SJFT5OSX.js +0 -131
package/dist/index.js
CHANGED
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
smoothSvgPath,
|
|
57
57
|
svgArcPath,
|
|
58
58
|
transferCompositeValue
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-WD56MJO2.js";
|
|
60
60
|
import {
|
|
61
61
|
Badge,
|
|
62
62
|
Breadcrumb,
|
|
@@ -81,19 +81,20 @@ import {
|
|
|
81
81
|
Watermark,
|
|
82
82
|
message,
|
|
83
83
|
notification
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-JEDJQ257.js";
|
|
85
|
+
import "./chunk-RX242MUO.js";
|
|
85
86
|
import {
|
|
86
87
|
MarkdownEditor
|
|
87
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-SO7IJZIR.js";
|
|
88
89
|
import {
|
|
89
90
|
RichTextContent,
|
|
90
91
|
RichTextEditor
|
|
91
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-MMSYWDTR.js";
|
|
92
93
|
import {
|
|
93
94
|
DatePicker,
|
|
94
95
|
SelectDateRange,
|
|
95
96
|
TimePanel
|
|
96
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-OJ2WDC66.js";
|
|
97
98
|
import {
|
|
98
99
|
Checkbox,
|
|
99
100
|
FloatingScrollbarProvider,
|
|
@@ -105,43 +106,91 @@ import {
|
|
|
105
106
|
Tooltip,
|
|
106
107
|
Tree,
|
|
107
108
|
useScrollbarProximity
|
|
108
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-D3HXXEEZ.js";
|
|
109
110
|
import {
|
|
110
111
|
Dropdown,
|
|
112
|
+
Input,
|
|
113
|
+
Menu,
|
|
114
|
+
Segmented,
|
|
115
|
+
Steps
|
|
116
|
+
} from "./chunk-4TTHKFJ7.js";
|
|
117
|
+
import {
|
|
118
|
+
TextArea
|
|
119
|
+
} from "./chunk-SCEHVGKV.js";
|
|
120
|
+
import {
|
|
111
121
|
FILLED_ICON_NAMES,
|
|
112
122
|
ICON_NAMES,
|
|
113
123
|
Icon,
|
|
114
|
-
Input,
|
|
115
|
-
Menu,
|
|
116
124
|
Modal,
|
|
117
125
|
OverlayPortal,
|
|
118
|
-
Segmented,
|
|
119
|
-
Steps,
|
|
120
126
|
useOverlayLifecycle
|
|
121
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-QV3AP6A2.js";
|
|
122
128
|
import {
|
|
123
|
-
Button
|
|
124
|
-
|
|
125
|
-
|
|
129
|
+
Button
|
|
130
|
+
} from "./chunk-CZ2ITBRW.js";
|
|
131
|
+
import {
|
|
132
|
+
useFloatingPlaceholder
|
|
133
|
+
} from "./chunk-KY6A5IJH.js";
|
|
126
134
|
import {
|
|
127
135
|
ControlSizeContext,
|
|
128
136
|
PlaceholderModeContext,
|
|
129
137
|
PopupPortal,
|
|
130
138
|
useControlSize,
|
|
131
139
|
useControllableState,
|
|
132
|
-
useFloatingPlaceholder,
|
|
133
140
|
usePlaceholderMode,
|
|
134
141
|
withTitleTooltip
|
|
135
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-NZMUW5XI.js";
|
|
143
|
+
|
|
144
|
+
// src/components/CursorPreview.tsx
|
|
145
|
+
import { useEffect, useState } from "react";
|
|
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 }) {
|
|
148
|
+
const [index, setIndex] = useState(0);
|
|
149
|
+
const [point, setPoint] = useState(null);
|
|
150
|
+
const [reduced, setReduced] = useState(false);
|
|
151
|
+
const [failed, setFailed] = useState(false);
|
|
152
|
+
const safeSize = Math.max(8, Number.isFinite(size) ? size : 48);
|
|
153
|
+
const frame = frames[playing && !reduced ? index % Math.max(1, frames.length) : 0];
|
|
154
|
+
useEffect(() => {
|
|
155
|
+
setIndex(0);
|
|
156
|
+
}, [frames]);
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
const media = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
159
|
+
const update = () => setReduced(media.matches);
|
|
160
|
+
update();
|
|
161
|
+
media.addEventListener("change", update);
|
|
162
|
+
return () => media.removeEventListener("change", update);
|
|
163
|
+
}, []);
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
if (!playing || reduced || frames.length < 2) return;
|
|
166
|
+
const duration = Number.isFinite(frame?.duration) ? frame.duration : 100;
|
|
167
|
+
const timer = window.setTimeout(() => setIndex((value) => (value + 1) % frames.length), Math.max(16, duration));
|
|
168
|
+
return () => window.clearTimeout(timer);
|
|
169
|
+
}, [playing, reduced, frames, index, frame]);
|
|
170
|
+
function move(event) {
|
|
171
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
172
|
+
if (followPointer && event.pointerType !== "touch") setPoint({ x: event.clientX - rect.left, y: event.clientY - rect.top });
|
|
173
|
+
onPointerMove?.(event);
|
|
174
|
+
}
|
|
175
|
+
const following = !!point && followPointer && !!frame && !failed;
|
|
176
|
+
const offset = (value) => Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * safeSize;
|
|
177
|
+
return /* @__PURE__ */ jsxs("div", { ...props, className: `sia-cursor-preview${following ? " is-following" : ""} ${className}`.trim(), style: { height, ...style }, onPointerMove: move, onPointerLeave: (event) => {
|
|
178
|
+
setPoint(null);
|
|
179
|
+
onPointerLeave?.(event);
|
|
180
|
+
}, children: [
|
|
181
|
+
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 }),
|
|
182
|
+
children ? /* @__PURE__ */ jsx("div", { className: "sia-cursor-preview__caption", children }) : null
|
|
183
|
+
] });
|
|
184
|
+
}
|
|
136
185
|
|
|
137
186
|
// src/components/UtilityLayout.tsx
|
|
138
|
-
import { useEffect, useRef, useState } from "react";
|
|
187
|
+
import { useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
139
188
|
import { createPortal } from "react-dom";
|
|
140
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
189
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
141
190
|
function AutoSizer({ children }) {
|
|
142
191
|
const ref = useRef(null);
|
|
143
|
-
const [size, setSize] =
|
|
144
|
-
|
|
192
|
+
const [size, setSize] = useState2({ width: 0, height: 0 });
|
|
193
|
+
useEffect2(() => {
|
|
145
194
|
const element = ref.current;
|
|
146
195
|
if (!element) return;
|
|
147
196
|
const observer = new ResizeObserver(([entry]) => {
|
|
@@ -151,18 +200,18 @@ function AutoSizer({ children }) {
|
|
|
151
200
|
observer.observe(element);
|
|
152
201
|
return () => observer.disconnect();
|
|
153
202
|
}, []);
|
|
154
|
-
return /* @__PURE__ */
|
|
203
|
+
return /* @__PURE__ */ jsx2("div", { className: "sia-auto-sizer", ref, children: /* @__PURE__ */ jsx2("div", { className: "sia-auto-sizer__content", children: size.width > 0 && size.height > 0 ? children(size) : null }) });
|
|
155
204
|
}
|
|
156
205
|
function FloatingPanel({ open, title, children, placement = "bottomRight" }) {
|
|
157
206
|
if (!open || typeof document === "undefined") return null;
|
|
158
|
-
return createPortal(/* @__PURE__ */
|
|
159
|
-
/* @__PURE__ */
|
|
207
|
+
return createPortal(/* @__PURE__ */ jsxs2("section", { className: `sia-floating-panel sia-floating-panel--${placement}`, "aria-label": title, role: "status", children: [
|
|
208
|
+
/* @__PURE__ */ jsx2("strong", { className: "sia-floating-panel__title", children: title }),
|
|
160
209
|
children
|
|
161
210
|
] }), document.body);
|
|
162
211
|
}
|
|
163
212
|
function SortableList({ items, renderItem, onOrderChange, direction = "horizontal", disabled = false }) {
|
|
164
|
-
const [dragging, setDragging] =
|
|
165
|
-
const [target, setTarget] =
|
|
213
|
+
const [dragging, setDragging] = useState2(null);
|
|
214
|
+
const [target, setTarget] = useState2(null);
|
|
166
215
|
const clear = () => {
|
|
167
216
|
setDragging(null);
|
|
168
217
|
setTarget(null);
|
|
@@ -177,12 +226,12 @@ function SortableList({ items, renderItem, onOrderChange, direction = "horizonta
|
|
|
177
226
|
next.splice(to, 0, key);
|
|
178
227
|
onOrderChange(next);
|
|
179
228
|
};
|
|
180
|
-
|
|
229
|
+
useEffect2(() => {
|
|
181
230
|
if (disabled || dragging !== null && !items.includes(dragging)) clear();
|
|
182
231
|
}, [disabled, dragging, items]);
|
|
183
|
-
return /* @__PURE__ */
|
|
232
|
+
return /* @__PURE__ */ jsx2("div", { className: `sia-sortable-list sia-sortable-list--${direction}`, role: "list", onDragLeave: (event) => {
|
|
184
233
|
if (!event.currentTarget.contains(event.relatedTarget)) setTarget(null);
|
|
185
|
-
}, children: items.map((key, index) => /* @__PURE__ */
|
|
234
|
+
}, children: items.map((key, index) => /* @__PURE__ */ jsxs2(
|
|
186
235
|
"div",
|
|
187
236
|
{
|
|
188
237
|
role: "listitem",
|
|
@@ -201,7 +250,7 @@ function SortableList({ items, renderItem, onOrderChange, direction = "horizonta
|
|
|
201
250
|
clear();
|
|
202
251
|
},
|
|
203
252
|
children: [
|
|
204
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ jsx2(
|
|
205
254
|
"button",
|
|
206
255
|
{
|
|
207
256
|
type: "button",
|
|
@@ -228,7 +277,7 @@ function SortableList({ items, renderItem, onOrderChange, direction = "horizonta
|
|
|
228
277
|
move(key, event.key === previous ? index - 1 : index + 2);
|
|
229
278
|
}
|
|
230
279
|
},
|
|
231
|
-
children: /* @__PURE__ */
|
|
280
|
+
children: /* @__PURE__ */ jsx2(Icon, { name: "menu", size: 16 })
|
|
232
281
|
}
|
|
233
282
|
),
|
|
234
283
|
renderItem(key, index)
|
|
@@ -239,13 +288,13 @@ function SortableList({ items, renderItem, onOrderChange, direction = "horizonta
|
|
|
239
288
|
}
|
|
240
289
|
|
|
241
290
|
// src/components/Alert.tsx
|
|
242
|
-
import { useState as
|
|
243
|
-
import { jsx as
|
|
291
|
+
import { useState as useState3 } from "react";
|
|
292
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
244
293
|
var alertIcons = {
|
|
245
|
-
info: /* @__PURE__ */
|
|
246
|
-
success: /* @__PURE__ */
|
|
247
|
-
warning: /* @__PURE__ */
|
|
248
|
-
error: /* @__PURE__ */
|
|
294
|
+
info: /* @__PURE__ */ jsx3(Icon, { name: "info", size: 20 }),
|
|
295
|
+
success: /* @__PURE__ */ jsx3(Icon, { name: "circle-check", size: 20 }),
|
|
296
|
+
warning: /* @__PURE__ */ jsx3(Icon, { name: "warning", size: 20 }),
|
|
297
|
+
error: /* @__PURE__ */ jsx3(Icon, { name: "circle-close", size: 20 })
|
|
249
298
|
};
|
|
250
299
|
function Alert({
|
|
251
300
|
status,
|
|
@@ -263,29 +312,29 @@ function Alert({
|
|
|
263
312
|
className = "",
|
|
264
313
|
...props
|
|
265
314
|
}) {
|
|
266
|
-
const [visible, setVisible] =
|
|
315
|
+
const [visible, setVisible] = useState3(true);
|
|
267
316
|
const resolvedStatus = status ?? type ?? (banner ? "warning" : "info");
|
|
268
317
|
const heading = message2 ?? title;
|
|
269
318
|
const hasHeading = heading != null && heading !== "" && typeof heading !== "boolean";
|
|
270
319
|
if (!visible) return null;
|
|
271
|
-
return /* @__PURE__ */
|
|
272
|
-
showIcon || banner ? /* @__PURE__ */
|
|
273
|
-
/* @__PURE__ */
|
|
274
|
-
hasHeading ? /* @__PURE__ */
|
|
275
|
-
description ? /* @__PURE__ */
|
|
320
|
+
return /* @__PURE__ */ jsxs3("div", { className: `sia-alert sia-alert--${resolvedStatus}${banner ? " sia-alert--banner" : ""}${description ? " sia-alert--with-description" : ""} ${className}`.trim(), role: "alert", ...withTitleTooltip(props), children: [
|
|
321
|
+
showIcon || banner ? /* @__PURE__ */ jsx3("span", { className: "sia-alert__icon", "aria-hidden": "true", children: alertIcons[resolvedStatus] }) : null,
|
|
322
|
+
/* @__PURE__ */ jsxs3("div", { className: "sia-alert__content", children: [
|
|
323
|
+
hasHeading ? /* @__PURE__ */ jsx3("strong", { children: heading }) : null,
|
|
324
|
+
description ? /* @__PURE__ */ jsx3("span", { children: description }) : null
|
|
276
325
|
] }),
|
|
277
|
-
action ? /* @__PURE__ */
|
|
278
|
-
closable ? /* @__PURE__ */
|
|
326
|
+
action ? /* @__PURE__ */ jsx3("div", { className: "sia-alert__action", children: action }) : null,
|
|
327
|
+
closable ? /* @__PURE__ */ jsx3("button", { type: "button", className: "sia-alert__close", "aria-label": "\u5173\u95ED\u63D0\u793A", onClick: (event) => {
|
|
279
328
|
onClose?.(event);
|
|
280
329
|
setVisible(false);
|
|
281
330
|
window.setTimeout(() => afterClose?.(), 0);
|
|
282
|
-
}, children: closeIcon ?? /* @__PURE__ */
|
|
331
|
+
}, children: closeIcon ?? /* @__PURE__ */ jsx3(Icon, { name: "close", size: 14 }) }) : null
|
|
283
332
|
] });
|
|
284
333
|
}
|
|
285
334
|
|
|
286
335
|
// src/components/Pagination.tsx
|
|
287
|
-
import { useState as
|
|
288
|
-
import { jsx as
|
|
336
|
+
import { useState as useState4 } from "react";
|
|
337
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
289
338
|
var DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50, 100, 200, 500, 1e3, 2e3, 5e3];
|
|
290
339
|
function Pagination({
|
|
291
340
|
size: sizeProp,
|
|
@@ -310,7 +359,7 @@ function Pagination({
|
|
|
310
359
|
const controlSize = useControlSize(sizeProp);
|
|
311
360
|
const [size, setSize] = useControllableState({ value: pageSize, defaultValue: Math.max(1, defaultPageSize) });
|
|
312
361
|
const [page, setPage] = useControllableState({ value: current, defaultValue: Math.max(1, defaultCurrent) });
|
|
313
|
-
const [internalRefreshing, setInternalRefreshing] =
|
|
362
|
+
const [internalRefreshing, setInternalRefreshing] = useState4(false);
|
|
314
363
|
const safeTotal = Math.max(0, total);
|
|
315
364
|
const totalPages = Math.max(1, Math.ceil(safeTotal / size));
|
|
316
365
|
const safePage = Math.max(1, Math.min(page, totalPages));
|
|
@@ -340,15 +389,15 @@ function Pagination({
|
|
|
340
389
|
if (refreshing === void 0) setInternalRefreshing(false);
|
|
341
390
|
}
|
|
342
391
|
}
|
|
343
|
-
return /* @__PURE__ */
|
|
344
|
-
/* @__PURE__ */
|
|
392
|
+
return /* @__PURE__ */ jsxs4("nav", { className: `sia-pagination sia-pagination--${controlSize} ${className}`.trim(), "aria-label": "\u5206\u9875", ...withTitleTooltip(props), children: [
|
|
393
|
+
/* @__PURE__ */ jsxs4("span", { className: "sia-pagination__current-count", "aria-live": "polite", children: [
|
|
345
394
|
"\u5F53\u524D\u9875 ",
|
|
346
395
|
pageCount,
|
|
347
396
|
" \u6761"
|
|
348
397
|
] }),
|
|
349
|
-
showSizeChanger ? /* @__PURE__ */
|
|
350
|
-
/* @__PURE__ */
|
|
351
|
-
/* @__PURE__ */
|
|
398
|
+
showSizeChanger ? /* @__PURE__ */ jsxs4("div", { className: "sia-pagination__size", children: [
|
|
399
|
+
/* @__PURE__ */ jsx4("span", { children: "\u6BCF\u9875\u663E\u793A" }),
|
|
400
|
+
/* @__PURE__ */ jsx4(
|
|
352
401
|
Select,
|
|
353
402
|
{
|
|
354
403
|
className: "sia-pagination__size-select",
|
|
@@ -364,7 +413,7 @@ function Pagination({
|
|
|
364
413
|
}
|
|
365
414
|
)
|
|
366
415
|
] }) : null,
|
|
367
|
-
showTotal ? typeof showTotal === "function" ? /* @__PURE__ */
|
|
416
|
+
showTotal ? typeof showTotal === "function" ? /* @__PURE__ */ jsx4("span", { className: "sia-pagination__total", children: showTotal(safeTotal, range) }) : /* @__PURE__ */ jsxs4(
|
|
368
417
|
Button,
|
|
369
418
|
{
|
|
370
419
|
variant: "text",
|
|
@@ -374,31 +423,31 @@ function Pagination({
|
|
|
374
423
|
title: onRefreshTotal ? "\u70B9\u51FB\u5237\u65B0\u603B\u8BB0\u5F55\u6570" : void 0,
|
|
375
424
|
onClick: () => void refreshTotal(),
|
|
376
425
|
children: [
|
|
377
|
-
loading ? /* @__PURE__ */
|
|
426
|
+
loading ? /* @__PURE__ */ jsx4(Icon, { name: "loader", size: 13, spin: true }) : null,
|
|
378
427
|
"\u5171 ",
|
|
379
428
|
safeTotal,
|
|
380
429
|
" \u6761",
|
|
381
|
-
onRefreshTotal && !loading ? /* @__PURE__ */
|
|
430
|
+
onRefreshTotal && !loading ? /* @__PURE__ */ jsx4(Icon, { name: "refresh", size: 13 }) : null
|
|
382
431
|
]
|
|
383
432
|
}
|
|
384
433
|
) : null,
|
|
385
|
-
/* @__PURE__ */
|
|
386
|
-
/* @__PURE__ */
|
|
387
|
-
/* @__PURE__ */
|
|
388
|
-
/* @__PURE__ */
|
|
434
|
+
/* @__PURE__ */ jsxs4("div", { className: "sia-pagination__buttons", children: [
|
|
435
|
+
/* @__PURE__ */ jsx4(Button, { size: controlSize, variant: "text", "aria-label": "\u7B2C\u4E00\u9875", disabled: disabled || safePage <= 1, onClick: () => change(1), children: /* @__PURE__ */ jsx4(Icon, { name: "double-left", size: 15 }) }),
|
|
436
|
+
/* @__PURE__ */ jsx4(Button, { size: controlSize, variant: "text", "aria-label": "\u4E0A\u4E00\u9875", disabled: disabled || safePage <= 1, onClick: () => change(safePage - 1), children: /* @__PURE__ */ jsx4(Icon, { name: "chevron-left", size: 15 }) }),
|
|
437
|
+
/* @__PURE__ */ jsxs4("span", { "aria-live": "polite", children: [
|
|
389
438
|
safePage,
|
|
390
439
|
" / ",
|
|
391
440
|
totalPages
|
|
392
441
|
] }),
|
|
393
|
-
/* @__PURE__ */
|
|
394
|
-
/* @__PURE__ */
|
|
442
|
+
/* @__PURE__ */ jsx4(Button, { size: controlSize, variant: "text", "aria-label": "\u4E0B\u4E00\u9875", disabled: disabled || safePage >= totalPages, onClick: () => change(safePage + 1), children: /* @__PURE__ */ jsx4(Icon, { name: "chevron-right", size: 15 }) }),
|
|
443
|
+
/* @__PURE__ */ jsx4(Button, { size: controlSize, variant: "text", "aria-label": "\u6700\u540E\u4E00\u9875", disabled: disabled || safePage >= totalPages, onClick: () => change(totalPages), children: /* @__PURE__ */ jsx4(Icon, { name: "double-right", size: 15 }) })
|
|
395
444
|
] })
|
|
396
445
|
] });
|
|
397
446
|
}
|
|
398
447
|
|
|
399
448
|
// src/components/Cascader.tsx
|
|
400
|
-
import { useEffect as
|
|
401
|
-
import { jsx as
|
|
449
|
+
import { useEffect as useEffect3, useMemo, useRef as useRef2, useState as useState5 } from "react";
|
|
450
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
402
451
|
function optionValue(option, fields) {
|
|
403
452
|
return option[fields.value];
|
|
404
453
|
}
|
|
@@ -460,15 +509,15 @@ function Cascader({
|
|
|
460
509
|
value,
|
|
461
510
|
defaultValue: defaultValue ?? (multiple ? [] : void 0)
|
|
462
511
|
});
|
|
463
|
-
const [open, setOpen] =
|
|
464
|
-
const [active, setActive] =
|
|
465
|
-
const [search, setSearch] =
|
|
466
|
-
const [loadingKey, setLoadingKey] =
|
|
512
|
+
const [open, setOpen] = useState5(false);
|
|
513
|
+
const [active, setActive] = useState5([]);
|
|
514
|
+
const [search, setSearch] = useState5("");
|
|
515
|
+
const [loadingKey, setLoadingKey] = useState5("");
|
|
467
516
|
const selectedPaths = multiple ? Array.isArray(current) ? current : [] : current?.length && !Array.isArray(current[0]) ? [current] : [];
|
|
468
517
|
const selectedKeys = new Set(selectedPaths.map(pathKey));
|
|
469
518
|
const selectedPathSignature = selectedPaths.map(pathKey).join("");
|
|
470
519
|
const searchPaths = useMemo(() => search ? leafPaths(options, fields).filter((path) => path.some((option) => String(optionLabel(option, fields)).toLowerCase().includes(search.toLowerCase()))) : [], [fields, options, search]);
|
|
471
|
-
|
|
520
|
+
useEffect3(() => {
|
|
472
521
|
if (!open) return;
|
|
473
522
|
const close = (event) => {
|
|
474
523
|
const target = event.target;
|
|
@@ -477,13 +526,13 @@ function Cascader({
|
|
|
477
526
|
document.addEventListener("pointerdown", close);
|
|
478
527
|
return () => document.removeEventListener("pointerdown", close);
|
|
479
528
|
}, [open]);
|
|
480
|
-
|
|
529
|
+
useEffect3(() => {
|
|
481
530
|
if (selectedPaths.length) return;
|
|
482
531
|
setActive([]);
|
|
483
532
|
setSearch("");
|
|
484
533
|
setLoadingKey("");
|
|
485
534
|
}, [selectedPaths.length]);
|
|
486
|
-
|
|
535
|
+
useEffect3(() => {
|
|
487
536
|
if (!open || !selectedPaths.length) return;
|
|
488
537
|
setActive(findPath(options, selectedPaths[0], fields));
|
|
489
538
|
}, [fields, open, options, selectedPathSignature]);
|
|
@@ -541,26 +590,26 @@ function Cascader({
|
|
|
541
590
|
if (children?.length) columns.push(children);
|
|
542
591
|
});
|
|
543
592
|
const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: selectedPaths.length > 0, active: open });
|
|
544
|
-
return /* @__PURE__ */
|
|
545
|
-
/* @__PURE__ */
|
|
546
|
-
/* @__PURE__ */
|
|
547
|
-
allowClear && selectedPaths.length && !disabled ? /* @__PURE__ */
|
|
593
|
+
return /* @__PURE__ */ jsxs5("div", { ref: rootRef, className: `sia-cascader sia-cascader--${size}${open ? " is-open" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), ...withTitleTooltip(props), children: [
|
|
594
|
+
/* @__PURE__ */ jsxs5("button", { type: "button", className: `sia-cascader__trigger${floating.className}`, disabled, "aria-haspopup": "listbox", "aria-expanded": open, onClick: toggleOpen, children: [
|
|
595
|
+
/* @__PURE__ */ jsx5("span", { className: "sia-cascader__value", children: display ? multiple && Array.isArray(display) ? display.map((label, index) => /* @__PURE__ */ jsx5("span", { className: "sia-cascader__tag", children: label }, pathKey(selectedPaths[index] ?? []))) : display : /* @__PURE__ */ jsx5("span", { className: "sia-cascader__placeholder", children: placeholder }) }),
|
|
596
|
+
allowClear && selectedPaths.length && !disabled ? /* @__PURE__ */ jsx5("span", { className: "sia-cascader__clear", role: "button", "aria-label": "\u6E05\u9664\u9009\u62E9", onClick: (event) => {
|
|
548
597
|
event.stopPropagation();
|
|
549
598
|
clearSelection();
|
|
550
|
-
}, children: /* @__PURE__ */
|
|
599
|
+
}, children: /* @__PURE__ */ jsx5(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
|
|
551
600
|
floating.label,
|
|
552
|
-
/* @__PURE__ */
|
|
601
|
+
/* @__PURE__ */ jsx5(Icon, { name: open ? "chevron-up" : "chevron-down", size: 14 })
|
|
553
602
|
] }),
|
|
554
|
-
/* @__PURE__ */
|
|
555
|
-
showSearch ? /* @__PURE__ */
|
|
556
|
-
/* @__PURE__ */
|
|
557
|
-
/* @__PURE__ */
|
|
603
|
+
/* @__PURE__ */ jsxs5(PopupPortal, { ref: popupRef, anchorRef: rootRef, open, className: "sia-cascader__popup", children: [
|
|
604
|
+
showSearch ? /* @__PURE__ */ jsxs5("label", { className: "sia-cascader__search", children: [
|
|
605
|
+
/* @__PURE__ */ jsx5(Icon, { name: "search", size: 15 }),
|
|
606
|
+
/* @__PURE__ */ jsx5("input", { autoFocus: true, value: search, placeholder: "\u641C\u7D22\u9009\u9879", onChange: (event) => setSearch(event.currentTarget.value) })
|
|
558
607
|
] }) : null,
|
|
559
|
-
search ? /* @__PURE__ */
|
|
608
|
+
search ? /* @__PURE__ */ jsxs5("div", { className: "sia-cascader__results", children: [
|
|
560
609
|
searchPaths.map((path) => {
|
|
561
610
|
const values = path.map((item) => optionValue(item, fields));
|
|
562
611
|
const checked = selectedKeys.has(pathKey(values));
|
|
563
|
-
return /* @__PURE__ */
|
|
612
|
+
return /* @__PURE__ */ jsxs5("button", { type: "button", onClick: () => {
|
|
564
613
|
setActive(path);
|
|
565
614
|
if (multiple) emit(checked ? selectedPaths.filter((item) => pathKey(item) !== pathKey(values)) : [...selectedPaths, values]);
|
|
566
615
|
else {
|
|
@@ -568,19 +617,19 @@ function Cascader({
|
|
|
568
617
|
setOpen(false);
|
|
569
618
|
}
|
|
570
619
|
}, children: [
|
|
571
|
-
multiple ? /* @__PURE__ */
|
|
572
|
-
/* @__PURE__ */
|
|
620
|
+
multiple ? /* @__PURE__ */ jsx5(Checkbox, { checked, tabIndex: -1 }) : null,
|
|
621
|
+
/* @__PURE__ */ jsx5("span", { children: path.map((item) => optionLabel(item, fields)).join(" / ") })
|
|
573
622
|
] }, pathKey(values));
|
|
574
623
|
}),
|
|
575
|
-
!searchPaths.length ? /* @__PURE__ */
|
|
576
|
-
] }) : /* @__PURE__ */
|
|
624
|
+
!searchPaths.length ? /* @__PURE__ */ jsx5("div", { className: "sia-cascader__empty", children: "\u6682\u65E0\u5339\u914D\u9009\u9879" }) : null
|
|
625
|
+
] }) : /* @__PURE__ */ jsx5("div", { className: "sia-cascader__menus", children: columns.map((column, depth) => /* @__PURE__ */ jsx5("div", { className: "sia-cascader__menu", role: "listbox", children: column.map((option) => {
|
|
577
626
|
const nextPath = [...active.slice(0, depth), option];
|
|
578
627
|
const values = nextPath.map((item) => optionValue(item, fields));
|
|
579
628
|
const children = optionChildren(option, fields);
|
|
580
629
|
const selected = active[depth] === option;
|
|
581
630
|
const checked = selectedKeys.has(pathKey(values));
|
|
582
631
|
const loading = loadingKey === pathKey(values);
|
|
583
|
-
return /* @__PURE__ */
|
|
632
|
+
return /* @__PURE__ */ jsxs5(
|
|
584
633
|
"button",
|
|
585
634
|
{
|
|
586
635
|
type: "button",
|
|
@@ -591,9 +640,9 @@ function Cascader({
|
|
|
591
640
|
onMouseEnter: expandTrigger === "hover" ? () => void activate(option, depth) : void 0,
|
|
592
641
|
onClick: () => void activate(option, depth),
|
|
593
642
|
children: [
|
|
594
|
-
multiple && !children?.length ? /* @__PURE__ */
|
|
595
|
-
/* @__PURE__ */
|
|
596
|
-
loading ? /* @__PURE__ */
|
|
643
|
+
multiple && !children?.length ? /* @__PURE__ */ jsx5(Checkbox, { checked, tabIndex: -1 }) : null,
|
|
644
|
+
/* @__PURE__ */ jsx5("span", { children: optionLabel(option, fields) }),
|
|
645
|
+
loading ? /* @__PURE__ */ jsx5(Icon, { name: "loader", className: "sia-spin-icon", size: 14 }) : children?.length || option.isLeaf === false ? /* @__PURE__ */ jsx5(Icon, { name: "chevron-right", size: 13 }) : null
|
|
597
646
|
]
|
|
598
647
|
},
|
|
599
648
|
optionValue(option, fields)
|
|
@@ -605,7 +654,7 @@ function Cascader({
|
|
|
605
654
|
|
|
606
655
|
// src/components/Layout.tsx
|
|
607
656
|
import { Children } from "react";
|
|
608
|
-
import { jsx as
|
|
657
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
609
658
|
var gaps = { small: 8, medium: 12, large: 16 };
|
|
610
659
|
function resolveGap(gap) {
|
|
611
660
|
return typeof gap === "string" && gap in gaps ? gaps[gap] : gap;
|
|
@@ -646,10 +695,10 @@ function Flex({
|
|
|
646
695
|
flex,
|
|
647
696
|
...style
|
|
648
697
|
};
|
|
649
|
-
return /* @__PURE__ */
|
|
698
|
+
return /* @__PURE__ */ jsx6(Component, { className: `sia-flex${isVertical ? " sia-flex--vertical" : ""} ${className}`.trim(), style: mergedStyle, ...withTitleTooltip(props) });
|
|
650
699
|
}
|
|
651
700
|
function SpaceCompact({ direction = "horizontal", block = false, className = "", ...props }) {
|
|
652
|
-
return /* @__PURE__ */
|
|
701
|
+
return /* @__PURE__ */ jsx6("div", { className: `sia-space-compact sia-space-compact--${direction}${block ? " sia-space-compact--block" : ""} ${className}`.trim(), ...withTitleTooltip(props) });
|
|
653
702
|
}
|
|
654
703
|
function SpaceRoot({
|
|
655
704
|
direction = "horizontal",
|
|
@@ -671,9 +720,9 @@ function SpaceRoot({
|
|
|
671
720
|
alignItems: resolveAlign(align),
|
|
672
721
|
...style
|
|
673
722
|
};
|
|
674
|
-
return /* @__PURE__ */
|
|
723
|
+
return /* @__PURE__ */ jsx6("div", { className: `sia-space sia-space--${direction} ${className}`.trim(), style: mergedStyle, ...withTitleTooltip(props), children: items.map((item, index) => /* @__PURE__ */ jsxs6("span", { className: "sia-space__item", children: [
|
|
675
724
|
item,
|
|
676
|
-
split !== void 0 && index < items.length - 1 ? /* @__PURE__ */
|
|
725
|
+
split !== void 0 && index < items.length - 1 ? /* @__PURE__ */ jsx6("span", { className: "sia-space__split", children: split }) : null
|
|
677
726
|
] }, index)) });
|
|
678
727
|
}
|
|
679
728
|
var Space = Object.assign(SpaceRoot, {
|
|
@@ -689,14 +738,14 @@ function Divider({
|
|
|
689
738
|
className = "",
|
|
690
739
|
...props
|
|
691
740
|
}) {
|
|
692
|
-
return /* @__PURE__ */
|
|
741
|
+
return /* @__PURE__ */ jsx6(
|
|
693
742
|
"div",
|
|
694
743
|
{
|
|
695
744
|
className: `sia-divider sia-divider--${orientation} sia-divider--${variant} sia-divider--text-${textAlign}${children ? " sia-divider--with-text" : ""}${plain ? " sia-divider--plain" : ""} ${className}`.trim(),
|
|
696
745
|
role: "separator",
|
|
697
746
|
"aria-orientation": orientation,
|
|
698
747
|
...withTitleTooltip(props),
|
|
699
|
-
children: children ? /* @__PURE__ */
|
|
748
|
+
children: children ? /* @__PURE__ */ jsx6("span", { className: "sia-divider__text", children }) : null
|
|
700
749
|
}
|
|
701
750
|
);
|
|
702
751
|
}
|
|
@@ -716,7 +765,7 @@ function Row({ gutter = 0, align, justify, wrap = true, className = "", style, .
|
|
|
716
765
|
flexWrap: wrap ? "wrap" : "nowrap",
|
|
717
766
|
...style
|
|
718
767
|
};
|
|
719
|
-
return /* @__PURE__ */
|
|
768
|
+
return /* @__PURE__ */ jsx6("div", { className: `sia-row ${className}`.trim(), style: mergedStyle, ...withTitleTooltip(props) });
|
|
720
769
|
}
|
|
721
770
|
function setColVariables(style, prefix, value) {
|
|
722
771
|
if (value === void 0) return;
|
|
@@ -756,12 +805,12 @@ function Col({
|
|
|
756
805
|
setColVariables(mergedStyle, "lg-", lg);
|
|
757
806
|
setColVariables(mergedStyle, "xl-", xl);
|
|
758
807
|
setColVariables(mergedStyle, "xxl-", xxl);
|
|
759
|
-
return /* @__PURE__ */
|
|
808
|
+
return /* @__PURE__ */ jsx6("div", { className: `sia-col ${className}`.trim(), style: mergedStyle, ...withTitleTooltip(props) });
|
|
760
809
|
}
|
|
761
810
|
|
|
762
811
|
// src/components/Splitter.tsx
|
|
763
|
-
import { Children as Children2, cloneElement, isValidElement, useMemo as useMemo2, useRef as useRef3, useState as
|
|
764
|
-
import { Fragment, jsx as
|
|
812
|
+
import { Children as Children2, cloneElement, isValidElement, useMemo as useMemo2, useRef as useRef3, useState as useState6 } from "react";
|
|
813
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
765
814
|
function SplitterPanel({
|
|
766
815
|
defaultSize: _defaultSize,
|
|
767
816
|
defaultCollapsed: _defaultCollapsed,
|
|
@@ -775,7 +824,7 @@ function SplitterPanel({
|
|
|
775
824
|
className = "",
|
|
776
825
|
...props
|
|
777
826
|
}) {
|
|
778
|
-
return /* @__PURE__ */
|
|
827
|
+
return /* @__PURE__ */ jsx7("div", { className: `sia-splitter__panel ${className}`.trim(), ...withTitleTooltip(props) });
|
|
779
828
|
}
|
|
780
829
|
function normalizeExpandedSizes(panels) {
|
|
781
830
|
const specified = panels.map((panel) => panel.props.defaultSize);
|
|
@@ -812,7 +861,7 @@ function SplitterRoot({
|
|
|
812
861
|
}) {
|
|
813
862
|
const rootRef = useRef3(null);
|
|
814
863
|
const panels = useMemo2(() => Children2.toArray(children).filter(isValidElement), [children]);
|
|
815
|
-
const [sizes, setSizes] =
|
|
864
|
+
const [sizes, setSizes] = useState6(() => normalizeSizes(panels));
|
|
816
865
|
const expandedSizesRef = useRef3(normalizeExpandedSizes(panels));
|
|
817
866
|
function resizePair(index, deltaPercent, complete = false) {
|
|
818
867
|
setSizes((current) => {
|
|
@@ -891,7 +940,7 @@ function SplitterRoot({
|
|
|
891
940
|
onResize?.(next);
|
|
892
941
|
onResizeEnd?.(next);
|
|
893
942
|
}
|
|
894
|
-
return /* @__PURE__ */
|
|
943
|
+
return /* @__PURE__ */ jsx7("div", { ref: rootRef, className: `sia-splitter sia-splitter--${orientation} ${className}`.trim(), ...withTitleTooltip(props), children: panels.flatMap((panel, index) => {
|
|
895
944
|
const panelCollapsed = Boolean(panel.props.collapsible) && (sizes[index] ?? 0) <= collapsedSize(panel) + 0.01;
|
|
896
945
|
const collapsedContent = panel.props.collapsedContent;
|
|
897
946
|
const expandFromCollapsedContent = () => {
|
|
@@ -903,9 +952,9 @@ function SplitterRoot({
|
|
|
903
952
|
...panel.props.style,
|
|
904
953
|
flexBasis: `${sizes[index] ?? 0}%`
|
|
905
954
|
},
|
|
906
|
-
children: /* @__PURE__ */
|
|
907
|
-
/* @__PURE__ */
|
|
908
|
-
collapsedContent !== void 0 ? /* @__PURE__ */
|
|
955
|
+
children: /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
956
|
+
/* @__PURE__ */ jsx7("div", { className: `sia-splitter__panel-content${panelCollapsed ? " is-collapsed" : ""}`, "aria-hidden": panelCollapsed, children: panel.props.children }),
|
|
957
|
+
collapsedContent !== void 0 ? /* @__PURE__ */ jsx7(
|
|
909
958
|
"button",
|
|
910
959
|
{
|
|
911
960
|
type: "button",
|
|
@@ -926,7 +975,7 @@ function SplitterRoot({
|
|
|
926
975
|
const afterCollapsed = (sizes[index + 1] ?? 0) <= collapsedSize(panels[index + 1]) + 0.01;
|
|
927
976
|
const beforeUsesRail = beforeCollapsed && panels[index]?.props.collapsedContent !== void 0;
|
|
928
977
|
const afterUsesRail = afterCollapsed && panels[index + 1]?.props.collapsedContent !== void 0;
|
|
929
|
-
return [panelNode, /* @__PURE__ */
|
|
978
|
+
return [panelNode, /* @__PURE__ */ jsxs7(
|
|
930
979
|
"div",
|
|
931
980
|
{
|
|
932
981
|
className: `sia-splitter__handle${beforeCollapsed && !beforeUsesRail ? " sia-splitter__handle--before-collapsed" : ""}${afterCollapsed && !afterUsesRail ? " sia-splitter__handle--after-collapsed" : ""}`,
|
|
@@ -937,15 +986,15 @@ function SplitterRoot({
|
|
|
937
986
|
onMouseDown: (event) => startResize(index, event),
|
|
938
987
|
onKeyDown: (event) => handleKey(index, event),
|
|
939
988
|
children: [
|
|
940
|
-
beforeCollapsible && !beforeUsesRail ? /* @__PURE__ */
|
|
989
|
+
beforeCollapsible && !beforeUsesRail ? /* @__PURE__ */ jsx7("button", { type: "button", className: "sia-splitter__collapse sia-splitter__collapse--before", "aria-label": beforeCollapsed ? "\u5C55\u5F00\u524D\u4E00\u4E2A\u9762\u677F" : "\u6536\u8D77\u524D\u4E00\u4E2A\u9762\u677F", onPointerDown: (event) => event.stopPropagation(), onMouseDown: (event) => event.stopPropagation(), onClick: (event) => {
|
|
941
990
|
event.stopPropagation();
|
|
942
991
|
togglePanel(index, "before");
|
|
943
|
-
}, children: /* @__PURE__ */
|
|
944
|
-
/* @__PURE__ */
|
|
945
|
-
afterCollapsible && !afterUsesRail ? /* @__PURE__ */
|
|
992
|
+
}, children: /* @__PURE__ */ jsx7(Icon, { name: orientation === "horizontal" ? beforeCollapsed ? "chevron-right" : "chevron-left" : beforeCollapsed ? "chevron-down" : "chevron-up", size: 11 }) }) : null,
|
|
993
|
+
/* @__PURE__ */ jsx7("span", {}),
|
|
994
|
+
afterCollapsible && !afterUsesRail ? /* @__PURE__ */ jsx7("button", { type: "button", className: "sia-splitter__collapse sia-splitter__collapse--after", "aria-label": afterCollapsed ? "\u5C55\u5F00\u540E\u4E00\u4E2A\u9762\u677F" : "\u6536\u8D77\u540E\u4E00\u4E2A\u9762\u677F", onPointerDown: (event) => event.stopPropagation(), onMouseDown: (event) => event.stopPropagation(), onClick: (event) => {
|
|
946
995
|
event.stopPropagation();
|
|
947
996
|
togglePanel(index, "after");
|
|
948
|
-
}, children: /* @__PURE__ */
|
|
997
|
+
}, children: /* @__PURE__ */ jsx7(Icon, { name: orientation === "horizontal" ? afterCollapsed ? "chevron-left" : "chevron-right" : afterCollapsed ? "chevron-up" : "chevron-down", size: 11 }) }) : null
|
|
949
998
|
]
|
|
950
999
|
},
|
|
951
1000
|
`handle-${index}`
|
|
@@ -958,8 +1007,8 @@ var Splitter = Object.assign(SplitterRoot, {
|
|
|
958
1007
|
});
|
|
959
1008
|
|
|
960
1009
|
// src/components/ToolPanel.tsx
|
|
961
|
-
import { useId, useLayoutEffect, useRef as useRef4, useState as
|
|
962
|
-
import { Fragment as Fragment2, jsx as
|
|
1010
|
+
import { useId, useLayoutEffect, useRef as useRef4, useState as useState7 } from "react";
|
|
1011
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
963
1012
|
function clamp2(value, min, max) {
|
|
964
1013
|
return Math.min(max, Math.max(min, value));
|
|
965
1014
|
}
|
|
@@ -985,9 +1034,9 @@ function ToolPanel({
|
|
|
985
1034
|
...props
|
|
986
1035
|
}) {
|
|
987
1036
|
const panelId = useId();
|
|
988
|
-
const [internalActiveKey, setInternalActiveKey] =
|
|
989
|
-
const [internalOpen, setInternalOpen] =
|
|
990
|
-
const [size, setSize] =
|
|
1037
|
+
const [internalActiveKey, setInternalActiveKey] = useState7(defaultActiveKey);
|
|
1038
|
+
const [internalOpen, setInternalOpen] = useState7(defaultOpen);
|
|
1039
|
+
const [size, setSize] = useState7(() => clamp2(defaultSize, minSize, maxSize));
|
|
991
1040
|
const panels = items ?? [{ key: "single", title, icon, children }];
|
|
992
1041
|
const requestedKey = activeKey ?? internalActiveKey;
|
|
993
1042
|
const activePanel = panels.find((item) => item.key === requestedKey && !item.disabled) ?? panels.find((item) => !item.disabled);
|
|
@@ -1073,12 +1122,12 @@ function ToolPanel({
|
|
|
1073
1122
|
resize(size + (placement === "left" ? direction : -direction) * 12, true);
|
|
1074
1123
|
}
|
|
1075
1124
|
const titleText = typeof activePanel?.title === "string" ? activePanel.title : "\u5DE5\u5177";
|
|
1076
|
-
const rail = /* @__PURE__ */
|
|
1077
|
-
/* @__PURE__ */
|
|
1125
|
+
const rail = /* @__PURE__ */ jsxs8("div", { ref: railRef, className: "sia-tool-panel__rail", children: [
|
|
1126
|
+
/* @__PURE__ */ jsx8("span", { ref: indicatorRef, className: "sia-tool-panel__indicator", "aria-hidden": "true" }),
|
|
1078
1127
|
panels.map((item, index) => {
|
|
1079
1128
|
const expanded = isOpen && item.key === activePanel?.key;
|
|
1080
1129
|
const label = typeof item.title === "string" ? item.title : "\u5DE5\u5177";
|
|
1081
|
-
return /* @__PURE__ */
|
|
1130
|
+
return /* @__PURE__ */ jsxs8(
|
|
1082
1131
|
"button",
|
|
1083
1132
|
{
|
|
1084
1133
|
id: `${panelId}-activity-${index}`,
|
|
@@ -1091,15 +1140,15 @@ function ToolPanel({
|
|
|
1091
1140
|
disabled: item.disabled,
|
|
1092
1141
|
onClick: () => activatePanel(item),
|
|
1093
1142
|
children: [
|
|
1094
|
-
item.icon ? /* @__PURE__ */
|
|
1095
|
-
/* @__PURE__ */
|
|
1143
|
+
item.icon ? /* @__PURE__ */ jsx8("span", { className: "sia-tool-panel__activity-icon", children: item.icon }) : null,
|
|
1144
|
+
/* @__PURE__ */ jsx8("span", { className: "sia-tool-panel__activity-label", children: item.title })
|
|
1096
1145
|
]
|
|
1097
1146
|
},
|
|
1098
1147
|
item.key
|
|
1099
1148
|
);
|
|
1100
1149
|
})
|
|
1101
1150
|
] });
|
|
1102
|
-
const content = /* @__PURE__ */
|
|
1151
|
+
const content = /* @__PURE__ */ jsx8("div", { className: "sia-tool-panel__content", hidden: !isOpen, "aria-hidden": !isOpen, children: panels.map((item, index) => /* @__PURE__ */ jsx8(
|
|
1103
1152
|
"div",
|
|
1104
1153
|
{
|
|
1105
1154
|
id: `${panelId}-content-${index}`,
|
|
@@ -1111,7 +1160,7 @@ function ToolPanel({
|
|
|
1111
1160
|
},
|
|
1112
1161
|
item.key
|
|
1113
1162
|
)) });
|
|
1114
|
-
const resizeHandle = /* @__PURE__ */
|
|
1163
|
+
const resizeHandle = /* @__PURE__ */ jsx8(
|
|
1115
1164
|
"div",
|
|
1116
1165
|
{
|
|
1117
1166
|
className: "sia-tool-panel__resize-handle",
|
|
@@ -1131,18 +1180,18 @@ function ToolPanel({
|
|
|
1131
1180
|
...style,
|
|
1132
1181
|
"--sia-tool-panel-size": `${size}px`
|
|
1133
1182
|
};
|
|
1134
|
-
return /* @__PURE__ */
|
|
1183
|
+
return /* @__PURE__ */ jsx8(
|
|
1135
1184
|
"div",
|
|
1136
1185
|
{
|
|
1137
1186
|
className: `sia-tool-panel sia-tool-panel--${placement}${isOpen ? " is-open" : ""} ${className}`.trim(),
|
|
1138
1187
|
style: panelStyle,
|
|
1139
1188
|
"data-placement": placement,
|
|
1140
1189
|
...withTitleTooltip(props),
|
|
1141
|
-
children: placement === "left" ? /* @__PURE__ */
|
|
1190
|
+
children: placement === "left" ? /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1142
1191
|
rail,
|
|
1143
1192
|
content,
|
|
1144
1193
|
resizeHandle
|
|
1145
|
-
] }) : /* @__PURE__ */
|
|
1194
|
+
] }) : /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1146
1195
|
resizeHandle,
|
|
1147
1196
|
content,
|
|
1148
1197
|
rail
|
|
@@ -1152,7 +1201,7 @@ function ToolPanel({
|
|
|
1152
1201
|
}
|
|
1153
1202
|
|
|
1154
1203
|
// src/components/WindowFrame.tsx
|
|
1155
|
-
import { jsx as
|
|
1204
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1156
1205
|
var DEFAULT_LABELS = {
|
|
1157
1206
|
minimize: "\u6700\u5C0F\u5316",
|
|
1158
1207
|
maximize: "\u6700\u5927\u5316",
|
|
@@ -1177,15 +1226,17 @@ var NON_DRAG_SELECTOR = [
|
|
|
1177
1226
|
].join(",");
|
|
1178
1227
|
function WindowFrame({
|
|
1179
1228
|
titleBar,
|
|
1229
|
+
textSelectable = true,
|
|
1180
1230
|
className = "",
|
|
1181
1231
|
children,
|
|
1182
1232
|
...props
|
|
1183
1233
|
}) {
|
|
1184
|
-
return /* @__PURE__ */
|
|
1234
|
+
return /* @__PURE__ */ jsxs9(
|
|
1185
1235
|
"div",
|
|
1186
1236
|
{
|
|
1187
1237
|
className: `sia-window-frame ${className}`.trim(),
|
|
1188
1238
|
"data-sia-window-mode": "custom",
|
|
1239
|
+
"data-sia-text-selectable": textSelectable,
|
|
1189
1240
|
...withTitleTooltip(props),
|
|
1190
1241
|
children: [
|
|
1191
1242
|
titleBar,
|
|
@@ -1210,7 +1261,7 @@ function WindowControls({
|
|
|
1210
1261
|
function runAction(action) {
|
|
1211
1262
|
void onAction?.(action);
|
|
1212
1263
|
}
|
|
1213
|
-
return /* @__PURE__ */
|
|
1264
|
+
return /* @__PURE__ */ jsxs9(
|
|
1214
1265
|
"div",
|
|
1215
1266
|
{
|
|
1216
1267
|
className: `sia-window-controls ${className}`.trim(),
|
|
@@ -1218,7 +1269,7 @@ function WindowControls({
|
|
|
1218
1269
|
"aria-label": "\u7A97\u53E3\u63A7\u5236",
|
|
1219
1270
|
...withTitleTooltip(props),
|
|
1220
1271
|
children: [
|
|
1221
|
-
showMinimize ? /* @__PURE__ */
|
|
1272
|
+
showMinimize ? /* @__PURE__ */ jsx9(
|
|
1222
1273
|
"button",
|
|
1223
1274
|
{
|
|
1224
1275
|
type: "button",
|
|
@@ -1227,10 +1278,10 @@ function WindowControls({
|
|
|
1227
1278
|
...withTitleTooltip({ title: mergedLabels.minimize }),
|
|
1228
1279
|
disabled: isDisabled("minimize"),
|
|
1229
1280
|
onClick: () => runAction("minimize"),
|
|
1230
|
-
children: /* @__PURE__ */
|
|
1281
|
+
children: /* @__PURE__ */ jsx9(Icon, { name: "minus", size: 14 })
|
|
1231
1282
|
}
|
|
1232
1283
|
) : null,
|
|
1233
|
-
showMaximize ? /* @__PURE__ */
|
|
1284
|
+
showMaximize ? /* @__PURE__ */ jsx9(
|
|
1234
1285
|
"button",
|
|
1235
1286
|
{
|
|
1236
1287
|
type: "button",
|
|
@@ -1239,10 +1290,10 @@ function WindowControls({
|
|
|
1239
1290
|
...withTitleTooltip({ title: maximized ? mergedLabels.restore : mergedLabels.maximize }),
|
|
1240
1291
|
disabled: isDisabled("toggle-maximize"),
|
|
1241
1292
|
onClick: () => runAction("toggle-maximize"),
|
|
1242
|
-
children: /* @__PURE__ */
|
|
1293
|
+
children: /* @__PURE__ */ jsx9(Icon, { name: maximized ? "fullscreen-exit" : "fullscreen", size: 13 })
|
|
1243
1294
|
}
|
|
1244
1295
|
) : null,
|
|
1245
|
-
showClose ? /* @__PURE__ */
|
|
1296
|
+
showClose ? /* @__PURE__ */ jsx9(
|
|
1246
1297
|
"button",
|
|
1247
1298
|
{
|
|
1248
1299
|
type: "button",
|
|
@@ -1251,7 +1302,7 @@ function WindowControls({
|
|
|
1251
1302
|
...withTitleTooltip({ title: mergedLabels.close }),
|
|
1252
1303
|
disabled: isDisabled("close"),
|
|
1253
1304
|
onClick: () => runAction("close"),
|
|
1254
|
-
children: /* @__PURE__ */
|
|
1305
|
+
children: /* @__PURE__ */ jsx9(Icon, { name: "close", size: 14 })
|
|
1255
1306
|
}
|
|
1256
1307
|
) : null
|
|
1257
1308
|
]
|
|
@@ -1281,7 +1332,7 @@ function WindowTitleBar({
|
|
|
1281
1332
|
event.preventDefault();
|
|
1282
1333
|
void onWindowAction(event.detail > 1 ? "toggle-maximize" : "start-dragging");
|
|
1283
1334
|
}
|
|
1284
|
-
const renderedControls = controls === true ? /* @__PURE__ */
|
|
1335
|
+
const renderedControls = controls === true ? /* @__PURE__ */ jsx9(
|
|
1285
1336
|
WindowControls,
|
|
1286
1337
|
{
|
|
1287
1338
|
maximized,
|
|
@@ -1290,8 +1341,8 @@ function WindowTitleBar({
|
|
|
1290
1341
|
onAction: onWindowAction
|
|
1291
1342
|
}
|
|
1292
1343
|
) : controls || null;
|
|
1293
|
-
const renderedActions = actions ? /* @__PURE__ */
|
|
1294
|
-
return /* @__PURE__ */
|
|
1344
|
+
const renderedActions = actions ? /* @__PURE__ */ jsx9("div", { className: "sia-window-titlebar__actions", "data-sia-window-no-drag": "", children: actions }) : null;
|
|
1345
|
+
return /* @__PURE__ */ jsxs9(
|
|
1295
1346
|
"header",
|
|
1296
1347
|
{
|
|
1297
1348
|
className: `sia-window-titlebar ${className}`.trim(),
|
|
@@ -1299,10 +1350,10 @@ function WindowTitleBar({
|
|
|
1299
1350
|
onMouseDown: handleMouseDown,
|
|
1300
1351
|
...withTitleTooltip(props),
|
|
1301
1352
|
children: [
|
|
1302
|
-
leading ? /* @__PURE__ */
|
|
1353
|
+
leading ? /* @__PURE__ */ jsx9("div", { className: "sia-window-titlebar__leading", children: leading }) : null,
|
|
1303
1354
|
actionsAlign === "left" ? renderedActions : null,
|
|
1304
1355
|
children,
|
|
1305
|
-
/* @__PURE__ */
|
|
1356
|
+
/* @__PURE__ */ jsx9("div", { className: "sia-window-titlebar__drag-region", "aria-hidden": "true" }),
|
|
1306
1357
|
actionsAlign === "right" ? renderedActions : null,
|
|
1307
1358
|
renderedControls
|
|
1308
1359
|
]
|
|
@@ -1311,9 +1362,9 @@ function WindowTitleBar({
|
|
|
1311
1362
|
}
|
|
1312
1363
|
|
|
1313
1364
|
// src/components/Drawer.tsx
|
|
1314
|
-
import { createContext, forwardRef, useCallback, useContext, useEffect as
|
|
1365
|
+
import { createContext, forwardRef, useCallback, useContext, useEffect as useEffect4, useId as useId2, useMemo as useMemo3, useRef as useRef5, useState as useState8 } from "react";
|
|
1315
1366
|
import { createRoot } from "react-dom/client";
|
|
1316
|
-
import { jsx as
|
|
1367
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1317
1368
|
var drawerHandles = /* @__PURE__ */ new Set();
|
|
1318
1369
|
var DRAWER_MOTION_DURATION = 400;
|
|
1319
1370
|
var DEFAULT_DRAWER_PUSH_DISTANCE = 180;
|
|
@@ -1356,9 +1407,9 @@ var DrawerRoot = forwardRef(function Drawer({
|
|
|
1356
1407
|
const afterCloseRef = useRef5(afterClose);
|
|
1357
1408
|
afterOpenRef.current = afterOpen;
|
|
1358
1409
|
afterCloseRef.current = afterClose;
|
|
1359
|
-
const [rendered, setRendered] =
|
|
1360
|
-
const [closing, setClosing] =
|
|
1361
|
-
const [openChildIds, setOpenChildIds] =
|
|
1410
|
+
const [rendered, setRendered] = useState8(open);
|
|
1411
|
+
const [closing, setClosing] = useState8(false);
|
|
1412
|
+
const [openChildIds, setOpenChildIds] = useState8(() => /* @__PURE__ */ new Set());
|
|
1362
1413
|
const setChildOpen = useCallback((id, childOpen) => {
|
|
1363
1414
|
setOpenChildIds((current) => {
|
|
1364
1415
|
const hasId = current.has(id);
|
|
@@ -1370,7 +1421,7 @@ var DrawerRoot = forwardRef(function Drawer({
|
|
|
1370
1421
|
});
|
|
1371
1422
|
}, []);
|
|
1372
1423
|
const stackContextValue = useMemo3(() => ({ setChildOpen }), [setChildOpen]);
|
|
1373
|
-
|
|
1424
|
+
useEffect4(() => {
|
|
1374
1425
|
if (open) {
|
|
1375
1426
|
setRendered(true);
|
|
1376
1427
|
setClosing(false);
|
|
@@ -1385,12 +1436,12 @@ var DrawerRoot = forwardRef(function Drawer({
|
|
|
1385
1436
|
}, DRAWER_MOTION_DURATION);
|
|
1386
1437
|
return () => window.clearTimeout(timer);
|
|
1387
1438
|
}, [open, rendered]);
|
|
1388
|
-
|
|
1439
|
+
useEffect4(() => {
|
|
1389
1440
|
if (!open || !rendered) return void 0;
|
|
1390
1441
|
const timer = window.setTimeout(() => afterOpenRef.current?.(), DRAWER_MOTION_DURATION);
|
|
1391
1442
|
return () => window.clearTimeout(timer);
|
|
1392
1443
|
}, [open, rendered]);
|
|
1393
|
-
|
|
1444
|
+
useEffect4(() => {
|
|
1394
1445
|
if (!parentStack) return void 0;
|
|
1395
1446
|
parentStack.setChildOpen(drawerId, open);
|
|
1396
1447
|
return () => parentStack.setChildOpen(drawerId, false);
|
|
@@ -1420,9 +1471,9 @@ var DrawerRoot = forwardRef(function Drawer({
|
|
|
1420
1471
|
"--sia-drawer-push-x": horizontalPush ? pushOffset : "0px",
|
|
1421
1472
|
"--sia-drawer-push-y": horizontalPush ? "0px" : pushOffset
|
|
1422
1473
|
};
|
|
1423
|
-
return /* @__PURE__ */
|
|
1424
|
-
/* @__PURE__ */
|
|
1425
|
-
/* @__PURE__ */
|
|
1474
|
+
return /* @__PURE__ */ jsx10(DrawerStackContext.Provider, { value: stackContextValue, children: /* @__PURE__ */ jsx10(OverlayPortal, { container: getContainer, children: /* @__PURE__ */ jsxs10("div", { className: "sia-drawer-root", "data-state": closing ? "closing" : "open", style: { zIndex }, children: [
|
|
1475
|
+
/* @__PURE__ */ jsx10("button", { className: "sia-drawer__mask", type: "button", "aria-label": "\u5173\u95ED\u62BD\u5C49", onClick: () => maskClosable && requestClose() }),
|
|
1476
|
+
/* @__PURE__ */ jsxs10(
|
|
1426
1477
|
"div",
|
|
1427
1478
|
{
|
|
1428
1479
|
ref: setRef,
|
|
@@ -1435,16 +1486,16 @@ var DrawerRoot = forwardRef(function Drawer({
|
|
|
1435
1486
|
tabIndex: -1,
|
|
1436
1487
|
...withTitleTooltip(props),
|
|
1437
1488
|
children: [
|
|
1438
|
-
/* @__PURE__ */
|
|
1439
|
-
/* @__PURE__ */
|
|
1440
|
-
closable ? /* @__PURE__ */
|
|
1441
|
-
title ? /* @__PURE__ */
|
|
1489
|
+
/* @__PURE__ */ jsxs10("div", { className: "sia-drawer__header", children: [
|
|
1490
|
+
/* @__PURE__ */ jsxs10("div", { className: "sia-drawer__heading", children: [
|
|
1491
|
+
closable ? /* @__PURE__ */ jsx10("button", { type: "button", className: "sia-drawer__close", "aria-label": "\u5173\u95ED\u62BD\u5C49", onClick: requestClose, children: /* @__PURE__ */ jsx10(Icon, { name: "close", size: 17 }) }) : null,
|
|
1492
|
+
title ? /* @__PURE__ */ jsx10("strong", { id: titleId, children: title }) : null
|
|
1442
1493
|
] }),
|
|
1443
|
-
extra ? /* @__PURE__ */
|
|
1494
|
+
extra ? /* @__PURE__ */ jsx10("div", { className: "sia-drawer__extra", children: extra }) : null
|
|
1444
1495
|
] }),
|
|
1445
|
-
/* @__PURE__ */
|
|
1446
|
-
/* @__PURE__ */
|
|
1447
|
-
footer ? /* @__PURE__ */
|
|
1496
|
+
/* @__PURE__ */ jsx10("div", { ref: bodyRef, className: "sia-drawer__body", children }),
|
|
1497
|
+
/* @__PURE__ */ jsx10(FloatingScrollbarProvider, { targetRef: bodyRef }),
|
|
1498
|
+
footer ? /* @__PURE__ */ jsx10("div", { className: "sia-drawer__footer", children: footer }) : null
|
|
1448
1499
|
]
|
|
1449
1500
|
}
|
|
1450
1501
|
)
|
|
@@ -1477,7 +1528,7 @@ function openDrawer(config) {
|
|
|
1477
1528
|
cleanupTimer = window.setTimeout(cleanup, DRAWER_MOTION_DURATION + 100);
|
|
1478
1529
|
}
|
|
1479
1530
|
function render() {
|
|
1480
|
-
root.render(/* @__PURE__ */
|
|
1531
|
+
root.render(/* @__PURE__ */ jsx10(
|
|
1481
1532
|
DrawerRoot,
|
|
1482
1533
|
{
|
|
1483
1534
|
...currentConfig,
|
|
@@ -1516,8 +1567,8 @@ var Drawer2 = Object.assign(DrawerRoot, {
|
|
|
1516
1567
|
});
|
|
1517
1568
|
|
|
1518
1569
|
// src/components/Form.tsx
|
|
1519
|
-
import { Children as Children3, cloneElement as cloneElement2, createContext as createContext2, forwardRef as forwardRef2, isValidElement as isValidElement2, useContext as useContext2, useEffect as
|
|
1520
|
-
import { Fragment as Fragment3, jsx as
|
|
1570
|
+
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 useLayoutEffect2, useMemo as useMemo4, useRef as useRef6, useSyncExternalStore } from "react";
|
|
1571
|
+
import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1521
1572
|
var Switch = forwardRef2(function Switch2({
|
|
1522
1573
|
label,
|
|
1523
1574
|
variant = "standard",
|
|
@@ -1537,26 +1588,26 @@ var Switch = forwardRef2(function Switch2({
|
|
|
1537
1588
|
onCheckedChange?.(event.currentTarget.checked);
|
|
1538
1589
|
onChange?.(event);
|
|
1539
1590
|
};
|
|
1540
|
-
return /* @__PURE__ */
|
|
1541
|
-
/* @__PURE__ */
|
|
1542
|
-
/* @__PURE__ */
|
|
1591
|
+
return /* @__PURE__ */ jsxs11("label", { className: `sia-switch-wrap sia-switch-wrap--${size} ${className}`.trim(), children: [
|
|
1592
|
+
/* @__PURE__ */ jsx11("input", { ref, type: "checkbox", role: "switch", className: "sia-switch-input", onChange: handleChange, ...withTitleTooltip(props) }),
|
|
1593
|
+
/* @__PURE__ */ jsxs11(
|
|
1543
1594
|
"span",
|
|
1544
1595
|
{
|
|
1545
1596
|
className: `sia-switch sia-switch--${variant}${variant === "standard" && hasContent ? " sia-switch--with-content" : ""}`,
|
|
1546
1597
|
"aria-hidden": "true",
|
|
1547
1598
|
children: [
|
|
1548
|
-
/* @__PURE__ */
|
|
1549
|
-
variant === "segmented" ? /* @__PURE__ */
|
|
1550
|
-
/* @__PURE__ */
|
|
1551
|
-
/* @__PURE__ */
|
|
1552
|
-
] }) : hasContent ? /* @__PURE__ */
|
|
1553
|
-
/* @__PURE__ */
|
|
1554
|
-
/* @__PURE__ */
|
|
1599
|
+
/* @__PURE__ */ jsx11("span", { className: "sia-switch__thumb" }),
|
|
1600
|
+
variant === "segmented" ? /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
1601
|
+
/* @__PURE__ */ jsx11("span", { className: "sia-switch__segment sia-switch__segment--unchecked", children: uncheckedVisual }),
|
|
1602
|
+
/* @__PURE__ */ jsx11("span", { className: "sia-switch__segment sia-switch__segment--checked", children: checkedVisual })
|
|
1603
|
+
] }) : hasContent ? /* @__PURE__ */ jsxs11("span", { className: "sia-switch__content", children: [
|
|
1604
|
+
/* @__PURE__ */ jsx11("span", { className: "sia-switch__content-item sia-switch__content-item--unchecked", children: uncheckedVisual }),
|
|
1605
|
+
/* @__PURE__ */ jsx11("span", { className: "sia-switch__content-item sia-switch__content-item--checked", children: checkedVisual })
|
|
1555
1606
|
] }) : null
|
|
1556
1607
|
]
|
|
1557
1608
|
}
|
|
1558
1609
|
),
|
|
1559
|
-
label ? /* @__PURE__ */
|
|
1610
|
+
label ? /* @__PURE__ */ jsx11("span", { className: "sia-switch__label", children: label }) : null
|
|
1560
1611
|
] });
|
|
1561
1612
|
});
|
|
1562
1613
|
function pathArray(name) {
|
|
@@ -1616,12 +1667,18 @@ var FormStore = class {
|
|
|
1616
1667
|
callbacks = {};
|
|
1617
1668
|
version = 0;
|
|
1618
1669
|
initialized = false;
|
|
1670
|
+
// 延迟挂载的页签可能先收到接口结果,记录写入路径以保留嵌套字段的初始默认值。
|
|
1671
|
+
pendingWrites = [];
|
|
1619
1672
|
configure(initialValues, callbacks) {
|
|
1620
1673
|
this.callbacks = callbacks;
|
|
1621
1674
|
if (!this.initialized) {
|
|
1622
1675
|
this.initialized = true;
|
|
1623
1676
|
this.initialValues = cloneFormValue(initialValues ?? {});
|
|
1624
1677
|
this.values = cloneFormValue(initialValues ?? {});
|
|
1678
|
+
this.pendingWrites.forEach(({ path, value, reset }) => {
|
|
1679
|
+
this.values = setValue(this.values, path, cloneFormValue(reset ? getValue(this.initialValues, path) : value));
|
|
1680
|
+
});
|
|
1681
|
+
this.pendingWrites = [];
|
|
1625
1682
|
}
|
|
1626
1683
|
}
|
|
1627
1684
|
subscribe = (listener) => {
|
|
@@ -1647,6 +1704,7 @@ var FormStore = class {
|
|
|
1647
1704
|
getFieldError = (name) => this.errors.get(pathKey2(name)) ?? [];
|
|
1648
1705
|
setFieldValue = (name, value) => {
|
|
1649
1706
|
const path = pathArray(name);
|
|
1707
|
+
if (!this.initialized) this.pendingWrites.push({ path: [...path], value: cloneFormValue(value) });
|
|
1650
1708
|
this.values = setValue(this.values, path, value);
|
|
1651
1709
|
this.errors.delete(pathKey2(path));
|
|
1652
1710
|
const changed = setValue({}, path, value);
|
|
@@ -1655,17 +1713,20 @@ var FormStore = class {
|
|
|
1655
1713
|
};
|
|
1656
1714
|
setFieldsValue = (values) => {
|
|
1657
1715
|
Object.entries(values).forEach(([key, value]) => {
|
|
1716
|
+
if (!this.initialized) this.pendingWrites.push({ path: [key], value: cloneFormValue(value) });
|
|
1658
1717
|
this.values = setValue(this.values, [key], value);
|
|
1659
1718
|
});
|
|
1660
1719
|
this.notify();
|
|
1661
1720
|
};
|
|
1662
1721
|
resetFields = (names) => {
|
|
1663
1722
|
if (!names) {
|
|
1723
|
+
this.pendingWrites = [];
|
|
1664
1724
|
this.values = cloneFormValue(this.initialValues);
|
|
1665
1725
|
this.errors.clear();
|
|
1666
1726
|
} else {
|
|
1667
1727
|
names.forEach((name) => {
|
|
1668
1728
|
const path = pathArray(name);
|
|
1729
|
+
if (!this.initialized) this.pendingWrites.push({ path: [...path], reset: true });
|
|
1669
1730
|
this.values = setValue(this.values, path, getValue(this.initialValues, path));
|
|
1670
1731
|
this.errors.delete(pathKey2(path));
|
|
1671
1732
|
});
|
|
@@ -1804,7 +1865,7 @@ function FormRoot({
|
|
|
1804
1865
|
if (frame) cancelAnimationFrame(frame);
|
|
1805
1866
|
};
|
|
1806
1867
|
}, []);
|
|
1807
|
-
return /* @__PURE__ */
|
|
1868
|
+
return /* @__PURE__ */ jsx11(FormContext.Provider, { value: context, children: /* @__PURE__ */ jsx11(PlaceholderModeContext.Provider, { value: resolvedPlaceholderMode, children: /* @__PURE__ */ jsx11(ControlSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx11(
|
|
1808
1869
|
"form",
|
|
1809
1870
|
{
|
|
1810
1871
|
ref: formRef,
|
|
@@ -1816,7 +1877,7 @@ function FormRoot({
|
|
|
1816
1877
|
event.stopPropagation();
|
|
1817
1878
|
instance.submit();
|
|
1818
1879
|
},
|
|
1819
|
-
children: /* @__PURE__ */
|
|
1880
|
+
children: /* @__PURE__ */ jsx11("fieldset", { disabled, children })
|
|
1820
1881
|
}
|
|
1821
1882
|
) }) }) });
|
|
1822
1883
|
}
|
|
@@ -1854,7 +1915,7 @@ function FormItem({
|
|
|
1854
1915
|
const helpContent = help ?? errors[0];
|
|
1855
1916
|
const labelId = label && !noStyle ? `${id}-label` : void 0;
|
|
1856
1917
|
const errorId = `${id}-error`;
|
|
1857
|
-
|
|
1918
|
+
useEffect5(() => {
|
|
1858
1919
|
if (!path) return void 0;
|
|
1859
1920
|
return form.registerField({
|
|
1860
1921
|
name: path,
|
|
@@ -1897,21 +1958,21 @@ function FormItem({
|
|
|
1897
1958
|
content = children;
|
|
1898
1959
|
}
|
|
1899
1960
|
}
|
|
1900
|
-
if (noStyle) return /* @__PURE__ */
|
|
1901
|
-
const inputWrap = /* @__PURE__ */
|
|
1961
|
+
if (noStyle) return /* @__PURE__ */ jsx11(Fragment3, { children: content });
|
|
1962
|
+
const inputWrap = /* @__PURE__ */ jsx11("div", { className: "sia-form-item__input-wrap", children: content });
|
|
1902
1963
|
const hasError = status === "error" && Boolean(helpContent);
|
|
1903
|
-
return /* @__PURE__ */
|
|
1904
|
-
label ? /* @__PURE__ */
|
|
1905
|
-
ruleRequired ? /* @__PURE__ */
|
|
1964
|
+
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: [
|
|
1965
|
+
label ? /* @__PURE__ */ jsx11("div", { id: labelId, className: "sia-form-item__label", children: /* @__PURE__ */ jsxs11("span", { className: "sia-form-item__label-content", children: [
|
|
1966
|
+
ruleRequired ? /* @__PURE__ */ jsx11("span", { className: "sia-form-item__required-mark", "aria-hidden": "true", children: "*" }) : null,
|
|
1906
1967
|
label
|
|
1907
1968
|
] }) }) : null,
|
|
1908
|
-
/* @__PURE__ */
|
|
1909
|
-
/* @__PURE__ */
|
|
1969
|
+
/* @__PURE__ */ jsxs11("div", { className: "sia-form-item__control", children: [
|
|
1970
|
+
/* @__PURE__ */ jsx11(
|
|
1910
1971
|
Tooltip,
|
|
1911
1972
|
{
|
|
1912
|
-
title: hasError ? /* @__PURE__ */
|
|
1913
|
-
/* @__PURE__ */
|
|
1914
|
-
/* @__PURE__ */
|
|
1973
|
+
title: hasError ? /* @__PURE__ */ jsxs11("span", { id: errorId, className: "sia-form-item__error-content", children: [
|
|
1974
|
+
/* @__PURE__ */ jsx11(Icon, { className: "sia-form-item__error-icon", name: "circle-close", variant: "filled", size: 16, "aria-hidden": "true" }),
|
|
1975
|
+
/* @__PURE__ */ jsx11("span", { children: helpContent })
|
|
1915
1976
|
] }) : null,
|
|
1916
1977
|
placement: "bottom-start",
|
|
1917
1978
|
trigger: [],
|
|
@@ -1922,8 +1983,8 @@ function FormItem({
|
|
|
1922
1983
|
children: inputWrap
|
|
1923
1984
|
}
|
|
1924
1985
|
),
|
|
1925
|
-
status !== "error" && helpContent ? /* @__PURE__ */
|
|
1926
|
-
extra ? /* @__PURE__ */
|
|
1986
|
+
status !== "error" && helpContent ? /* @__PURE__ */ jsx11("div", { className: "sia-form-item__help", children: helpContent }) : null,
|
|
1987
|
+
extra ? /* @__PURE__ */ jsx11("div", { className: "sia-form-item__extra", children: extra }) : null
|
|
1927
1988
|
] })
|
|
1928
1989
|
] });
|
|
1929
1990
|
}
|
|
@@ -1953,7 +2014,7 @@ function FormList({ name, children }) {
|
|
|
1953
2014
|
return children(values.map((_, index) => ({ key: index, name: index })), operations);
|
|
1954
2015
|
}
|
|
1955
2016
|
function FormErrorList({ errors = [] }) {
|
|
1956
|
-
return errors.length ? /* @__PURE__ */
|
|
2017
|
+
return errors.length ? /* @__PURE__ */ jsx11("div", { className: "sia-form-error-list", children: errors.map((error, index) => /* @__PURE__ */ jsx11("div", { children: error }, index)) }) : null;
|
|
1957
2018
|
}
|
|
1958
2019
|
var Form = Object.assign(FormRoot, {
|
|
1959
2020
|
/** 表单字段,负责字段值绑定、校验和标签布局。 */
|
|
@@ -1968,7 +2029,7 @@ var Form = Object.assign(FormRoot, {
|
|
|
1968
2029
|
|
|
1969
2030
|
// src/components/Radio.tsx
|
|
1970
2031
|
import { createContext as createContext3, forwardRef as forwardRef3, useContext as useContext3, useId as useId4, useMemo as useMemo5 } from "react";
|
|
1971
|
-
import { jsx as
|
|
2032
|
+
import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1972
2033
|
var RadioContext = createContext3(null);
|
|
1973
2034
|
var RadioRoot = forwardRef3(function Radio({ value, size: sizeProp, children, disabled, checked, defaultChecked, button = false, className = "", onChange, ...props }, ref) {
|
|
1974
2035
|
const size = useControlSize(sizeProp);
|
|
@@ -1976,8 +2037,8 @@ var RadioRoot = forwardRef3(function Radio({ value, size: sizeProp, children, di
|
|
|
1976
2037
|
const fallbackId = useId4();
|
|
1977
2038
|
const grouped = group !== null;
|
|
1978
2039
|
const currentChecked = grouped ? group.value === value : checked;
|
|
1979
|
-
return /* @__PURE__ */
|
|
1980
|
-
/* @__PURE__ */
|
|
2040
|
+
return /* @__PURE__ */ jsxs12("label", { className: `sia-radio sia-radio--${size}${button ? " sia-radio--button" : ""}${button && group?.buttonStyle === "solid" ? " sia-radio--solid" : ""}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
2041
|
+
/* @__PURE__ */ jsx12(
|
|
1981
2042
|
"input",
|
|
1982
2043
|
{
|
|
1983
2044
|
...withTitleTooltip(props),
|
|
@@ -1996,12 +2057,12 @@ var RadioRoot = forwardRef3(function Radio({ value, size: sizeProp, children, di
|
|
|
1996
2057
|
}
|
|
1997
2058
|
}
|
|
1998
2059
|
),
|
|
1999
|
-
button ? null : /* @__PURE__ */
|
|
2000
|
-
children !== void 0 ? /* @__PURE__ */
|
|
2060
|
+
button ? null : /* @__PURE__ */ jsx12("span", { className: "sia-radio__control", "aria-hidden": "true", children: /* @__PURE__ */ jsx12("span", {}) }),
|
|
2061
|
+
children !== void 0 ? /* @__PURE__ */ jsx12("span", { className: "sia-radio__label", children }) : null
|
|
2001
2062
|
] });
|
|
2002
2063
|
});
|
|
2003
2064
|
function RadioButton(props) {
|
|
2004
|
-
return /* @__PURE__ */
|
|
2065
|
+
return /* @__PURE__ */ jsx12(RadioRoot, { ...props, button: true });
|
|
2005
2066
|
}
|
|
2006
2067
|
function RadioGroup({
|
|
2007
2068
|
size: sizeProp,
|
|
@@ -2033,10 +2094,10 @@ function RadioGroup({
|
|
|
2033
2094
|
setValue: setValue2
|
|
2034
2095
|
}), [buttonStyle, currentValue, disabled, fallbackName, name, setValue2]);
|
|
2035
2096
|
const Component = optionType === "button" ? RadioButton : RadioRoot;
|
|
2036
|
-
return /* @__PURE__ */
|
|
2097
|
+
return /* @__PURE__ */ jsx12(ControlSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx12(RadioContext.Provider, { value: context, children: /* @__PURE__ */ jsxs12("div", { className: `sia-radio-group${optionType === "button" ? " sia-radio-group--button" : ""} ${className}`.trim(), role: "radiogroup", children: [
|
|
2037
2098
|
options?.map((option) => {
|
|
2038
2099
|
const normalized = typeof option === "object" ? option : { label: String(option), value: option };
|
|
2039
|
-
return /* @__PURE__ */
|
|
2100
|
+
return /* @__PURE__ */ jsx12(Component, { value: normalized.value, disabled: normalized.disabled, children: normalized.label }, normalized.value);
|
|
2040
2101
|
}),
|
|
2041
2102
|
children
|
|
2042
2103
|
] }) }) });
|
|
@@ -2049,8 +2110,8 @@ var Radio2 = Object.assign(RadioRoot, {
|
|
|
2049
2110
|
});
|
|
2050
2111
|
|
|
2051
2112
|
// src/components/Slider.tsx
|
|
2052
|
-
import { useState as
|
|
2053
|
-
import { jsx as
|
|
2113
|
+
import { useState as useState9 } from "react";
|
|
2114
|
+
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2054
2115
|
function percent(value, min, max) {
|
|
2055
2116
|
return (value - min) / (max - min) * 100;
|
|
2056
2117
|
}
|
|
@@ -2073,7 +2134,7 @@ function Slider({
|
|
|
2073
2134
|
}) {
|
|
2074
2135
|
const fallback = defaultValue ?? (range ? [min, max] : min);
|
|
2075
2136
|
const [currentValue, setValue2] = useControllableState({ value, defaultValue: fallback, onChange });
|
|
2076
|
-
const [activeThumb, setActiveThumb] =
|
|
2137
|
+
const [activeThumb, setActiveThumb] = useState9(null);
|
|
2077
2138
|
const values = Array.isArray(currentValue) ? [...currentValue] : [currentValue];
|
|
2078
2139
|
const start = range ? percent(Math.min(values[0], values[1]), min, max) : 0;
|
|
2079
2140
|
const end = percent(range ? Math.max(values[0], values[1]) : values[0], min, max);
|
|
@@ -2095,16 +2156,16 @@ function Slider({
|
|
|
2095
2156
|
onChangeComplete?.(currentValue);
|
|
2096
2157
|
setActiveThumb(null);
|
|
2097
2158
|
}
|
|
2098
|
-
return /* @__PURE__ */
|
|
2159
|
+
return /* @__PURE__ */ jsxs13(
|
|
2099
2160
|
"div",
|
|
2100
2161
|
{
|
|
2101
2162
|
className: `sia-slider${range ? " sia-slider--range" : ""}${vertical ? " sia-slider--vertical" : ""}${reverse ? " sia-slider--reverse" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
2102
2163
|
style,
|
|
2103
2164
|
...withTitleTooltip(props),
|
|
2104
2165
|
children: [
|
|
2105
|
-
/* @__PURE__ */
|
|
2106
|
-
values.map((item, index) => /* @__PURE__ */
|
|
2107
|
-
/* @__PURE__ */
|
|
2166
|
+
/* @__PURE__ */ jsx13("div", { className: "sia-slider__rail", children: /* @__PURE__ */ jsx13("span", { className: "sia-slider__track" }) }),
|
|
2167
|
+
values.map((item, index) => /* @__PURE__ */ jsxs13("div", { className: "sia-slider__thumb-wrap", children: [
|
|
2168
|
+
/* @__PURE__ */ jsx13(
|
|
2108
2169
|
"input",
|
|
2109
2170
|
{
|
|
2110
2171
|
className: "sia-slider__input",
|
|
@@ -2123,12 +2184,12 @@ function Slider({
|
|
|
2123
2184
|
onTouchEnd: finish
|
|
2124
2185
|
}
|
|
2125
2186
|
),
|
|
2126
|
-
tooltip?.open || activeThumb === index ? /* @__PURE__ */
|
|
2187
|
+
tooltip?.open || activeThumb === index ? /* @__PURE__ */ jsx13(
|
|
2127
2188
|
"span",
|
|
2128
2189
|
{
|
|
2129
2190
|
className: "sia-slider__tooltip-anchor",
|
|
2130
2191
|
style: { "--sia-slider-value": `${percent(item, min, max)}%` },
|
|
2131
|
-
children: /* @__PURE__ */
|
|
2192
|
+
children: /* @__PURE__ */ jsx13(
|
|
2132
2193
|
Tooltip,
|
|
2133
2194
|
{
|
|
2134
2195
|
title: tooltip?.formatter ? tooltip.formatter(item) : item,
|
|
@@ -2136,16 +2197,16 @@ function Slider({
|
|
|
2136
2197
|
trigger: [],
|
|
2137
2198
|
open: true,
|
|
2138
2199
|
overlayClassName: "sia-slider__tooltip",
|
|
2139
|
-
children: /* @__PURE__ */
|
|
2200
|
+
children: /* @__PURE__ */ jsx13("span", { className: "sia-slider__tooltip-target" })
|
|
2140
2201
|
}
|
|
2141
2202
|
)
|
|
2142
2203
|
}
|
|
2143
2204
|
) : null
|
|
2144
2205
|
] }, index)),
|
|
2145
|
-
marks ? /* @__PURE__ */
|
|
2206
|
+
marks ? /* @__PURE__ */ jsx13("div", { className: "sia-slider__marks", children: Object.entries(marks).map(([rawValue, mark]) => {
|
|
2146
2207
|
const numericValue = Number(rawValue);
|
|
2147
2208
|
const normalized = typeof mark === "object" && mark !== null && "label" in mark ? mark : { label: mark };
|
|
2148
|
-
return /* @__PURE__ */
|
|
2209
|
+
return /* @__PURE__ */ jsxs13(
|
|
2149
2210
|
"button",
|
|
2150
2211
|
{
|
|
2151
2212
|
type: "button",
|
|
@@ -2154,7 +2215,7 @@ function Slider({
|
|
|
2154
2215
|
disabled,
|
|
2155
2216
|
onClick: () => setValue2(range ? [values[0], numericValue].sort((a, b) => a - b) : numericValue),
|
|
2156
2217
|
children: [
|
|
2157
|
-
/* @__PURE__ */
|
|
2218
|
+
/* @__PURE__ */ jsx13("span", {}),
|
|
2158
2219
|
normalized.label
|
|
2159
2220
|
]
|
|
2160
2221
|
},
|
|
@@ -2167,8 +2228,8 @@ function Slider({
|
|
|
2167
2228
|
}
|
|
2168
2229
|
|
|
2169
2230
|
// src/components/ColorPicker.tsx
|
|
2170
|
-
import { useEffect as
|
|
2171
|
-
import { jsx as
|
|
2231
|
+
import { useEffect as useEffect6, useRef as useRef7, useState as useState10 } from "react";
|
|
2232
|
+
import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2172
2233
|
var DEFAULT_MODES = ["solid", "gradient"];
|
|
2173
2234
|
var gradientStopSeed = 0;
|
|
2174
2235
|
function clamp3(value, min, max) {
|
|
@@ -2263,7 +2324,7 @@ function ColorPicker({
|
|
|
2263
2324
|
const lastEmittedValue = useRef7();
|
|
2264
2325
|
const initialGradient = parseGradient(value ?? defaultValue);
|
|
2265
2326
|
const initialSolid = initialGradient?.stops[0]?.color ?? normalizeHex(value || defaultValue);
|
|
2266
|
-
const [open, setOpen] =
|
|
2327
|
+
const [open, setOpen] = useState10(false);
|
|
2267
2328
|
const [color, setColor] = useControllableState({
|
|
2268
2329
|
value,
|
|
2269
2330
|
defaultValue: initialGradient ? formatGradient(initialGradient.angle, initialGradient.stops.map((stop, index) => ({ id: index, ...stop }))) : normalizeHex(defaultValue),
|
|
@@ -2274,17 +2335,17 @@ function ColorPicker({
|
|
|
2274
2335
|
defaultValue: initialGradient ? "gradient" : defaultMode,
|
|
2275
2336
|
onChange: onModeChange
|
|
2276
2337
|
});
|
|
2277
|
-
const [solidColor, setSolidColor] =
|
|
2278
|
-
const [gradientAngle, setGradientAngle] =
|
|
2279
|
-
const [gradientStops, setGradientStops] =
|
|
2280
|
-
const [activeStopId, setActiveStopId] =
|
|
2338
|
+
const [solidColor, setSolidColor] = useState10(initialSolid);
|
|
2339
|
+
const [gradientAngle, setGradientAngle] = useState10(initialGradient?.angle ?? 90);
|
|
2340
|
+
const [gradientStops, setGradientStops] = useState10(() => initialGradient ? initialGradient.stops.map((stop) => createStop(stop.color, stop.position)) : createDefaultStops(initialSolid));
|
|
2341
|
+
const [activeStopId, setActiveStopId] = useState10(() => gradientStops[0]?.id ?? 0);
|
|
2281
2342
|
const activeStop = gradientStops.find((stop) => stop.id === activeStopId) ?? gradientStops[0];
|
|
2282
2343
|
const editingColor = currentMode === "gradient" ? activeStop?.color ?? solidColor : solidColor;
|
|
2283
2344
|
const rgba = parseHex(editingColor) ?? parseHex("#1677FF");
|
|
2284
2345
|
const hsv = rgbToHsv(rgba);
|
|
2285
|
-
const [hexDraft, setHexDraft] =
|
|
2346
|
+
const [hexDraft, setHexDraft] = useState10(editingColor);
|
|
2286
2347
|
const gradientValue = formatGradient(gradientAngle, gradientStops);
|
|
2287
|
-
|
|
2348
|
+
useEffect6(() => {
|
|
2288
2349
|
if (!open) return void 0;
|
|
2289
2350
|
const close = (event) => {
|
|
2290
2351
|
const target = event.target;
|
|
@@ -2293,10 +2354,10 @@ function ColorPicker({
|
|
|
2293
2354
|
document.addEventListener("pointerdown", close);
|
|
2294
2355
|
return () => document.removeEventListener("pointerdown", close);
|
|
2295
2356
|
}, [open]);
|
|
2296
|
-
|
|
2357
|
+
useEffect6(() => {
|
|
2297
2358
|
setHexDraft(editingColor);
|
|
2298
2359
|
}, [editingColor]);
|
|
2299
|
-
|
|
2360
|
+
useEffect6(() => {
|
|
2300
2361
|
if (value === void 0 || value === lastEmittedValue.current) return;
|
|
2301
2362
|
const parsed = parseGradient(value);
|
|
2302
2363
|
if (parsed) {
|
|
@@ -2358,8 +2419,8 @@ function ColorPicker({
|
|
|
2358
2419
|
const triggerBackground = color || "transparent";
|
|
2359
2420
|
const triggerText = color || "\u65E0\u8272";
|
|
2360
2421
|
const opaqueColor = rgbaToHex({ ...rgba, a: 100 }, false);
|
|
2361
|
-
return /* @__PURE__ */
|
|
2362
|
-
/* @__PURE__ */
|
|
2422
|
+
return /* @__PURE__ */ jsxs14("div", { ref: rootRef, className: `sia-color-picker sia-color-picker--${size}${disabled ? " is-disabled" : ""} ${className}`.trim(), ...withTitleTooltip(props), children: [
|
|
2423
|
+
/* @__PURE__ */ jsxs14(
|
|
2363
2424
|
"button",
|
|
2364
2425
|
{
|
|
2365
2426
|
type: "button",
|
|
@@ -2369,19 +2430,19 @@ function ColorPicker({
|
|
|
2369
2430
|
"aria-expanded": open,
|
|
2370
2431
|
onClick: () => setOpen((current) => !current),
|
|
2371
2432
|
children: [
|
|
2372
|
-
/* @__PURE__ */
|
|
2373
|
-
showText ? /* @__PURE__ */
|
|
2374
|
-
/* @__PURE__ */
|
|
2433
|
+
/* @__PURE__ */ jsx14("span", { className: `sia-color-picker__swatch${color ? "" : " is-empty"}`, style: color ? { background: triggerBackground } : void 0 }),
|
|
2434
|
+
showText ? /* @__PURE__ */ jsx14("span", { className: "sia-color-picker__trigger-text", children: typeof showText === "function" ? showText(color) : triggerText }) : null,
|
|
2435
|
+
/* @__PURE__ */ jsx14(Icon, { name: "chevron-down", size: 14 })
|
|
2375
2436
|
]
|
|
2376
2437
|
}
|
|
2377
2438
|
),
|
|
2378
|
-
/* @__PURE__ */
|
|
2379
|
-
/* @__PURE__ */
|
|
2380
|
-
modes.length > 1 ? /* @__PURE__ */
|
|
2381
|
-
allowClear ? /* @__PURE__ */
|
|
2439
|
+
/* @__PURE__ */ jsxs14(PopupPortal, { ref: popupRef, anchorRef: rootRef, open, className: "sia-color-picker__popup", role: "dialog", "aria-label": "\u989C\u8272\u9009\u62E9\u5668", children: [
|
|
2440
|
+
/* @__PURE__ */ jsxs14("div", { className: "sia-color-picker__mode-row", children: [
|
|
2441
|
+
modes.length > 1 ? /* @__PURE__ */ jsx14("div", { className: "sia-color-picker__modes", role: "tablist", "aria-label": "\u989C\u8272\u6A21\u5F0F", children: modes.map((item) => /* @__PURE__ */ jsx14("button", { type: "button", role: "tab", "aria-selected": currentMode === item, className: currentMode === item ? "is-active" : "", onClick: () => switchMode(item), children: item === "solid" ? "\u5355\u8272" : "\u6E10\u53D8\u8272" }, item)) }) : /* @__PURE__ */ jsx14("strong", { children: currentMode === "solid" ? "\u5355\u8272" : "\u6E10\u53D8\u8272" }),
|
|
2442
|
+
allowClear ? /* @__PURE__ */ jsx14("button", { type: "button", className: `sia-color-picker__none${color ? "" : " is-active"}`, "aria-label": "\u9009\u62E9\u65E0\u8272", ...withTitleTooltip({ title: "\u65E0\u8272" }), onClick: selectNoColor, children: /* @__PURE__ */ jsx14("span", {}) }) : null
|
|
2382
2443
|
] }),
|
|
2383
|
-
currentMode === "gradient" ? /* @__PURE__ */
|
|
2384
|
-
/* @__PURE__ */
|
|
2444
|
+
currentMode === "gradient" ? /* @__PURE__ */ jsxs14("div", { className: "sia-color-picker__gradient-editor", children: [
|
|
2445
|
+
/* @__PURE__ */ jsx14("div", { className: "sia-color-picker__gradient-preview", style: { background: gradientValue }, onPointerDown: addGradientStop, children: gradientStops.map((stop) => /* @__PURE__ */ jsx14(
|
|
2385
2446
|
"button",
|
|
2386
2447
|
{
|
|
2387
2448
|
type: "button",
|
|
@@ -2393,40 +2454,40 @@ function ColorPicker({
|
|
|
2393
2454
|
},
|
|
2394
2455
|
stop.id
|
|
2395
2456
|
)) }),
|
|
2396
|
-
/* @__PURE__ */
|
|
2397
|
-
/* @__PURE__ */
|
|
2457
|
+
/* @__PURE__ */ jsxs14("div", { className: "sia-color-picker__gradient-controls", children: [
|
|
2458
|
+
/* @__PURE__ */ jsxs14("label", { children: [
|
|
2398
2459
|
"\u65B9\u5411 ",
|
|
2399
|
-
/* @__PURE__ */
|
|
2460
|
+
/* @__PURE__ */ jsx14("input", { type: "number", min: 0, max: 360, value: Math.round(gradientAngle), onChange: (event) => {
|
|
2400
2461
|
const nextAngle = clamp3(Number(event.currentTarget.value), 0, 360);
|
|
2401
2462
|
setGradientAngle(nextAngle);
|
|
2402
2463
|
emit(formatGradient(nextAngle, gradientStops));
|
|
2403
2464
|
}, onBlur: () => onChangeComplete?.(formatGradient(gradientAngle, gradientStops)) }),
|
|
2404
|
-
/* @__PURE__ */
|
|
2465
|
+
/* @__PURE__ */ jsx14("span", { children: "\xB0" })
|
|
2405
2466
|
] }),
|
|
2406
|
-
/* @__PURE__ */
|
|
2467
|
+
/* @__PURE__ */ jsxs14("label", { children: [
|
|
2407
2468
|
"\u4F4D\u7F6E ",
|
|
2408
|
-
/* @__PURE__ */
|
|
2469
|
+
/* @__PURE__ */ jsx14("input", { type: "range", min: 0, max: 100, value: activeStop?.position ?? 0, onChange: (event) => {
|
|
2409
2470
|
if (!activeStop) return;
|
|
2410
2471
|
emitGradient(gradientStops.map((stop) => stop.id === activeStop.id ? { ...stop, position: Number(event.currentTarget.value) } : stop));
|
|
2411
2472
|
}, onPointerUp: () => onChangeComplete?.(formatGradient(gradientAngle, gradientStops)) }),
|
|
2412
|
-
/* @__PURE__ */
|
|
2473
|
+
/* @__PURE__ */ jsxs14("span", { children: [
|
|
2413
2474
|
Math.round(activeStop?.position ?? 0),
|
|
2414
2475
|
"%"
|
|
2415
2476
|
] })
|
|
2416
2477
|
] }),
|
|
2417
|
-
/* @__PURE__ */
|
|
2478
|
+
/* @__PURE__ */ jsxs14("button", { type: "button", disabled: gradientStops.length <= 2, onClick: () => {
|
|
2418
2479
|
if (!activeStop || gradientStops.length <= 2) return;
|
|
2419
2480
|
const index = gradientStops.findIndex((stop) => stop.id === activeStop.id);
|
|
2420
2481
|
const nextStops = gradientStops.filter((stop) => stop.id !== activeStop.id);
|
|
2421
2482
|
setActiveStopId(nextStops[Math.max(0, index - 1)]?.id ?? nextStops[0]?.id ?? 0);
|
|
2422
2483
|
emitGradient(nextStops, gradientAngle, true);
|
|
2423
2484
|
}, children: [
|
|
2424
|
-
/* @__PURE__ */
|
|
2485
|
+
/* @__PURE__ */ jsx14(Icon, { name: "minus", size: 14 }),
|
|
2425
2486
|
" \u5220\u9664\u8272\u6807"
|
|
2426
2487
|
] })
|
|
2427
2488
|
] })
|
|
2428
2489
|
] }) : null,
|
|
2429
|
-
/* @__PURE__ */
|
|
2490
|
+
/* @__PURE__ */ jsx14(
|
|
2430
2491
|
"div",
|
|
2431
2492
|
{
|
|
2432
2493
|
className: "sia-color-picker__saturation",
|
|
@@ -2442,28 +2503,28 @@ function ColorPicker({
|
|
|
2442
2503
|
updateSaturation(event, true);
|
|
2443
2504
|
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
2444
2505
|
},
|
|
2445
|
-
children: /* @__PURE__ */
|
|
2506
|
+
children: /* @__PURE__ */ jsx14("span", { style: { left: `${hsv.s}%`, top: `${100 - hsv.v}%` } })
|
|
2446
2507
|
}
|
|
2447
2508
|
),
|
|
2448
|
-
/* @__PURE__ */
|
|
2449
|
-
/* @__PURE__ */
|
|
2450
|
-
/* @__PURE__ */
|
|
2509
|
+
/* @__PURE__ */ jsxs14("label", { className: "sia-color-picker__hue", children: [
|
|
2510
|
+
/* @__PURE__ */ jsx14("span", { className: "sia-color-picker__field-label", children: "\u8272\u76F8" }),
|
|
2511
|
+
/* @__PURE__ */ jsx14("input", { type: "range", min: 0, max: 360, value: Math.round(hsv.h), onChange: (event) => {
|
|
2451
2512
|
updateEditingColor(rgbaToHex(hsvToRgba(Number(event.currentTarget.value), hsv.s, hsv.v, rgba.a), showAlpha));
|
|
2452
2513
|
}, onPointerUp: () => onChangeComplete?.(currentMode === "gradient" ? gradientValue : solidColor) })
|
|
2453
2514
|
] }),
|
|
2454
|
-
showAlpha ? /* @__PURE__ */
|
|
2455
|
-
/* @__PURE__ */
|
|
2456
|
-
/* @__PURE__ */
|
|
2515
|
+
showAlpha ? /* @__PURE__ */ jsxs14("label", { className: "sia-color-picker__alpha", style: { "--sia-alpha-color": opaqueColor }, children: [
|
|
2516
|
+
/* @__PURE__ */ jsx14("span", { className: "sia-color-picker__field-label", children: "\u900F\u660E\u5EA6" }),
|
|
2517
|
+
/* @__PURE__ */ jsx14("input", { type: "range", min: 0, max: 100, value: rgba.a, onChange: (event) => {
|
|
2457
2518
|
updateEditingColor(rgbaToHex({ ...rgba, a: Number(event.currentTarget.value) }, true));
|
|
2458
2519
|
}, onPointerUp: () => onChangeComplete?.(currentMode === "gradient" ? gradientValue : solidColor) }),
|
|
2459
|
-
/* @__PURE__ */
|
|
2520
|
+
/* @__PURE__ */ jsxs14("span", { children: [
|
|
2460
2521
|
rgba.a,
|
|
2461
2522
|
"%"
|
|
2462
2523
|
] })
|
|
2463
2524
|
] }) : null,
|
|
2464
|
-
/* @__PURE__ */
|
|
2465
|
-
/* @__PURE__ */
|
|
2466
|
-
/* @__PURE__ */
|
|
2525
|
+
/* @__PURE__ */ jsxs14("div", { className: "sia-color-picker__value-row", children: [
|
|
2526
|
+
/* @__PURE__ */ jsx14("span", { children: "HEX" }),
|
|
2527
|
+
/* @__PURE__ */ jsx14("input", { "aria-label": "HEX", value: hexDraft, onChange: (event) => {
|
|
2467
2528
|
const next = event.currentTarget.value;
|
|
2468
2529
|
setHexDraft(next);
|
|
2469
2530
|
if (/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(next)) updateEditingColor(next);
|
|
@@ -2472,19 +2533,19 @@ function ColorPicker({
|
|
|
2472
2533
|
setHexDraft(normalized);
|
|
2473
2534
|
updateEditingColor(normalized, true);
|
|
2474
2535
|
} }),
|
|
2475
|
-
/* @__PURE__ */
|
|
2536
|
+
/* @__PURE__ */ jsx14("span", { className: `sia-color-picker__value-swatch${color ? "" : " is-empty"}`, style: color ? { background: editingColor } : void 0 })
|
|
2476
2537
|
] }),
|
|
2477
|
-
presets?.map((preset, index) => /* @__PURE__ */
|
|
2478
|
-
preset.label ? /* @__PURE__ */
|
|
2479
|
-
/* @__PURE__ */
|
|
2538
|
+
presets?.map((preset, index) => /* @__PURE__ */ jsxs14("div", { className: "sia-color-picker__preset", children: [
|
|
2539
|
+
preset.label ? /* @__PURE__ */ jsx14("strong", { children: preset.label }) : null,
|
|
2540
|
+
/* @__PURE__ */ jsx14("div", { children: preset.colors.map((presetColor) => /* @__PURE__ */ jsx14("button", { type: "button", "aria-label": `\u9009\u62E9\u989C\u8272 ${presetColor}`, style: { background: presetColor }, onClick: () => updateEditingColor(presetColor, true) }, presetColor)) })
|
|
2480
2541
|
] }, index))
|
|
2481
2542
|
] })
|
|
2482
2543
|
] });
|
|
2483
2544
|
}
|
|
2484
2545
|
|
|
2485
2546
|
// src/components/TimePicker.tsx
|
|
2486
|
-
import { useEffect as
|
|
2487
|
-
import { jsx as
|
|
2547
|
+
import { useEffect as useEffect7, useId as useId5, useRef as useRef8, useState as useState11 } from "react";
|
|
2548
|
+
import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2488
2549
|
function seconds(value) {
|
|
2489
2550
|
const [h = 0, m = 0, s = 0] = value.split(":").map(Number);
|
|
2490
2551
|
return h * 3600 + m * 60 + s;
|
|
@@ -2519,8 +2580,8 @@ function TimePicker({
|
|
|
2519
2580
|
const popupRef = useRef8(null);
|
|
2520
2581
|
const focusPanel = useRef8(false);
|
|
2521
2582
|
const [currentValue, setValue2] = useControllableState({ value, defaultValue, onChange });
|
|
2522
|
-
const [open, setOpen] =
|
|
2523
|
-
const [draft, setDraft] =
|
|
2583
|
+
const [open, setOpen] = useState11(false);
|
|
2584
|
+
const [draft, setDraft] = useState11("00:00:00");
|
|
2524
2585
|
const normalize = (time) => showSecond ? (time + ":00").slice(0, 8) : time.slice(0, 5);
|
|
2525
2586
|
const unavailable = (time) => {
|
|
2526
2587
|
const normalized = normalize(time);
|
|
@@ -2538,7 +2599,7 @@ function TimePicker({
|
|
|
2538
2599
|
setOpen(next);
|
|
2539
2600
|
onOpenChange?.(next);
|
|
2540
2601
|
}
|
|
2541
|
-
|
|
2602
|
+
useEffect7(() => {
|
|
2542
2603
|
if (!open) return;
|
|
2543
2604
|
if (focusPanel.current) {
|
|
2544
2605
|
popupRef.current?.querySelector('[aria-selected="true"]')?.focus();
|
|
@@ -2563,8 +2624,8 @@ function TimePicker({
|
|
|
2563
2624
|
inputRef.current?.focus();
|
|
2564
2625
|
}
|
|
2565
2626
|
const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: Boolean(display), active: open });
|
|
2566
|
-
return /* @__PURE__ */
|
|
2567
|
-
/* @__PURE__ */
|
|
2627
|
+
return /* @__PURE__ */ jsxs15("span", { ref: rootRef, style, className: `sia-picker sia-time-picker${floating.className} sia-picker--${size} sia-picker--${status}${disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
2628
|
+
/* @__PURE__ */ jsx15(
|
|
2568
2629
|
"input",
|
|
2569
2630
|
{
|
|
2570
2631
|
...withTitleTooltip(props),
|
|
@@ -2601,12 +2662,12 @@ function TimePicker({
|
|
|
2601
2662
|
}
|
|
2602
2663
|
),
|
|
2603
2664
|
floating.label,
|
|
2604
|
-
allowClear && currentValue && !disabled && !readOnly ? /* @__PURE__ */
|
|
2665
|
+
allowClear && currentValue && !disabled && !readOnly ? /* @__PURE__ */ jsx15("button", { type: "button", className: "sia-picker__clear", "aria-label": "\u6E05\u9664\u65F6\u95F4", onMouseDown: (event) => event.preventDefault(), onClick: () => {
|
|
2605
2666
|
setValue2("");
|
|
2606
2667
|
changeOpen(false);
|
|
2607
|
-
}, children: /* @__PURE__ */
|
|
2608
|
-
/* @__PURE__ */
|
|
2609
|
-
/* @__PURE__ */
|
|
2668
|
+
}, children: /* @__PURE__ */ jsx15(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
|
|
2669
|
+
/* @__PURE__ */ jsx15("span", { className: "sia-picker__icon", "aria-hidden": "true", children: suffixIcon ?? /* @__PURE__ */ jsx15(Icon, { name: "clock", size: 16 }) }),
|
|
2670
|
+
/* @__PURE__ */ jsxs15(
|
|
2610
2671
|
PopupPortal,
|
|
2611
2672
|
{
|
|
2612
2673
|
ref: popupRef,
|
|
@@ -2624,14 +2685,14 @@ function TimePicker({
|
|
|
2624
2685
|
}
|
|
2625
2686
|
},
|
|
2626
2687
|
children: [
|
|
2627
|
-
/* @__PURE__ */
|
|
2628
|
-
unavailable(draft) ? /* @__PURE__ */
|
|
2629
|
-
/* @__PURE__ */
|
|
2630
|
-
/* @__PURE__ */
|
|
2688
|
+
/* @__PURE__ */ jsx15(TimePanel, { value: draft, showSecond, use12Hours, onChange: setDraft }),
|
|
2689
|
+
unavailable(draft) ? /* @__PURE__ */ jsx15("div", { className: "sia-time-panel__error", role: "status", children: "\u8BE5\u65F6\u95F4\u4E0D\u53EF\u9009" }) : null,
|
|
2690
|
+
/* @__PURE__ */ jsxs15("footer", { className: "sia-time-panel__footer", children: [
|
|
2691
|
+
/* @__PURE__ */ jsx15(Button, { variant: "text", size: "small", onClick: () => {
|
|
2631
2692
|
const now = /* @__PURE__ */ new Date();
|
|
2632
2693
|
setDraft([now.getHours(), now.getMinutes(), showSecond ? now.getSeconds() : 0].map((part) => String(part).padStart(2, "0")).join(":"));
|
|
2633
2694
|
}, children: "\u6B64\u523B" }),
|
|
2634
|
-
/* @__PURE__ */
|
|
2695
|
+
/* @__PURE__ */ jsx15(Button, { variant: "primary", size: "small", disabled: unavailable(draft), onClick: confirm, children: "\u786E\u5B9A" })
|
|
2635
2696
|
] })
|
|
2636
2697
|
]
|
|
2637
2698
|
}
|
|
@@ -2646,10 +2707,10 @@ function TimeRangePicker({ value, defaultValue = ["", ""], placeholder = ["\u5F0
|
|
|
2646
2707
|
pair[index] = next;
|
|
2647
2708
|
setValue2(pair);
|
|
2648
2709
|
}
|
|
2649
|
-
return /* @__PURE__ */
|
|
2650
|
-
/* @__PURE__ */
|
|
2651
|
-
/* @__PURE__ */
|
|
2652
|
-
/* @__PURE__ */
|
|
2710
|
+
return /* @__PURE__ */ jsxs15("span", { style, className: `sia-time-range sia-picker--${size} sia-picker--${props.status ?? "default"}${props.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
2711
|
+
/* @__PURE__ */ jsx15(TimePicker, { ...props, "aria-label": props["aria-label"] ? props["aria-label"] + "\u5F00\u59CB\u65F6\u95F4" : "\u5F00\u59CB\u65F6\u95F4", value: currentValue[0], placeholder: placeholder[0], max: currentValue[1] && (!props.max || seconds(currentValue[1]) < seconds(String(props.max))) ? currentValue[1] : props.max, onChange: (next) => update(0, next) }),
|
|
2712
|
+
/* @__PURE__ */ jsx15("span", { className: "sia-time-range__separator", children: separator }),
|
|
2713
|
+
/* @__PURE__ */ jsx15(TimePicker, { ...props, id: props.id ? props.id + "-end" : void 0, "aria-label": props["aria-label"] ? props["aria-label"] + "\u7ED3\u675F\u65F6\u95F4" : "\u7ED3\u675F\u65F6\u95F4", value: currentValue[1], placeholder: placeholder[1], min: currentValue[0] && (!props.min || seconds(currentValue[0]) > seconds(String(props.min))) ? currentValue[0] : props.min, onChange: (next) => update(1, next) })
|
|
2653
2714
|
] });
|
|
2654
2715
|
}
|
|
2655
2716
|
((TimePicker2) => {
|
|
@@ -2657,8 +2718,8 @@ function TimeRangePicker({ value, defaultValue = ["", ""], placeholder = ["\u5F0
|
|
|
2657
2718
|
})(TimePicker || (TimePicker = {}));
|
|
2658
2719
|
|
|
2659
2720
|
// src/components/TreeSelect.tsx
|
|
2660
|
-
import { useEffect as
|
|
2661
|
-
import { Fragment as Fragment4, jsx as
|
|
2721
|
+
import { useEffect as useEffect8, useMemo as useMemo6, useRef as useRef9, useState as useState12 } from "react";
|
|
2722
|
+
import { Fragment as Fragment4, jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2662
2723
|
function flattenTree(nodes, expanded, search, filter, depth = 0, parents = [], ancestorMatched = false) {
|
|
2663
2724
|
const result = [];
|
|
2664
2725
|
for (const node of nodes) {
|
|
@@ -2741,7 +2802,7 @@ function TreeSelect({
|
|
|
2741
2802
|
});
|
|
2742
2803
|
const [open, setOpen] = useControllableState({ value: controlledOpen, defaultValue: defaultOpen, onChange: onDropdownVisibleChange });
|
|
2743
2804
|
const [search, setSearch] = useControllableState({ value: searchValue, defaultValue: "", onChange: onSearch });
|
|
2744
|
-
const [expanded, setExpanded] =
|
|
2805
|
+
const [expanded, setExpanded] = useState12(() => {
|
|
2745
2806
|
if (!treeDefaultExpandAll) return new Set(treeDefaultExpandedKeys);
|
|
2746
2807
|
const values = [];
|
|
2747
2808
|
const collect = (nodes) => nodes.forEach((node) => {
|
|
@@ -2757,7 +2818,7 @@ function TreeSelect({
|
|
|
2757
2818
|
const expandedSet = treeExpandedKeys ? new Set(treeExpandedKeys) : expanded;
|
|
2758
2819
|
const selectedNodes = resolveNodes(selectedValues);
|
|
2759
2820
|
const visibleNodes = flattenTree(treeData, expandedSet, search, filterTreeNode);
|
|
2760
|
-
|
|
2821
|
+
useEffect8(() => {
|
|
2761
2822
|
if (!open || treeExpandedKeys) return;
|
|
2762
2823
|
const keys = new Set(expanded);
|
|
2763
2824
|
const walk = (nodes, parents) => nodes.forEach((node) => {
|
|
@@ -2817,7 +2878,7 @@ function TreeSelect({
|
|
|
2817
2878
|
setCurrentValue(multi ? [] : void 0);
|
|
2818
2879
|
onClear?.();
|
|
2819
2880
|
}
|
|
2820
|
-
|
|
2881
|
+
useEffect8(() => {
|
|
2821
2882
|
if (!open) return void 0;
|
|
2822
2883
|
const close = (event) => {
|
|
2823
2884
|
const target = event.target;
|
|
@@ -2869,7 +2930,7 @@ function TreeSelect({
|
|
|
2869
2930
|
}
|
|
2870
2931
|
}
|
|
2871
2932
|
const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: selectedNodes.length > 0, active: open });
|
|
2872
|
-
return /* @__PURE__ */
|
|
2933
|
+
return /* @__PURE__ */ jsxs16(
|
|
2873
2934
|
"div",
|
|
2874
2935
|
{
|
|
2875
2936
|
ref: rootRef,
|
|
@@ -2883,8 +2944,8 @@ function TreeSelect({
|
|
|
2883
2944
|
}
|
|
2884
2945
|
},
|
|
2885
2946
|
children: [
|
|
2886
|
-
renderTrigger ? renderTrigger({ open, toggle: () => changeOpen(!open), clear }) : /* @__PURE__ */
|
|
2887
|
-
/* @__PURE__ */
|
|
2947
|
+
renderTrigger ? renderTrigger({ open, toggle: () => changeOpen(!open), clear }) : /* @__PURE__ */ jsxs16(Fragment4, { children: [
|
|
2948
|
+
/* @__PURE__ */ jsxs16(
|
|
2888
2949
|
"button",
|
|
2889
2950
|
{
|
|
2890
2951
|
type: "button",
|
|
@@ -2902,24 +2963,24 @@ function TreeSelect({
|
|
|
2902
2963
|
if (event.key === "Escape") changeOpen(false);
|
|
2903
2964
|
},
|
|
2904
2965
|
children: [
|
|
2905
|
-
/* @__PURE__ */
|
|
2966
|
+
/* @__PURE__ */ jsx16("span", { className: "sia-tree-select__value", children: selectedNodes.length ? displayRender ? displayRender(selectedNodes) : multi ? /* @__PURE__ */ jsx16(OverflowTags, { tagClassName: "sia-tree-select__tag", maxCount: maxTagCount, items: selectedNodes.map((node) => ({ key: node.value, label: node.title })) }) : selectedNodes[0]?.title : /* @__PURE__ */ jsx16("span", { className: "sia-tree-select__placeholder", children: placeholder }) }),
|
|
2906
2967
|
floating.label,
|
|
2907
|
-
/* @__PURE__ */
|
|
2968
|
+
/* @__PURE__ */ jsx16(Icon, { name: open ? "chevron-up" : "chevron-down", size: 14 })
|
|
2908
2969
|
]
|
|
2909
2970
|
}
|
|
2910
2971
|
),
|
|
2911
|
-
allowClear && selectedValues.length > 0 && !disabled ? /* @__PURE__ */
|
|
2972
|
+
allowClear && selectedValues.length > 0 && !disabled ? /* @__PURE__ */ jsx16("button", { type: "button", className: "sia-tree-select__clear", "aria-label": "\u6E05\u9664\u9009\u62E9", onClick: clear, children: /* @__PURE__ */ jsx16(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null
|
|
2912
2973
|
] }),
|
|
2913
|
-
/* @__PURE__ */
|
|
2914
|
-
showSearch ? /* @__PURE__ */
|
|
2915
|
-
/* @__PURE__ */
|
|
2916
|
-
/* @__PURE__ */
|
|
2974
|
+
/* @__PURE__ */ jsxs16(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled, className: `sia-tree-select__dropdown ${popupClassName}`, style: popupStyle, children: [
|
|
2975
|
+
showSearch ? /* @__PURE__ */ jsxs16("label", { className: "sia-tree-select__search", children: [
|
|
2976
|
+
/* @__PURE__ */ jsx16(Icon, { name: "search", size: 15 }),
|
|
2977
|
+
/* @__PURE__ */ jsx16("input", { "aria-label": searchPlaceholder, autoFocus: true, value: search, placeholder: searchPlaceholder, onChange: (event) => setSearch(event.currentTarget.value) })
|
|
2917
2978
|
] }) : null,
|
|
2918
|
-
/* @__PURE__ */
|
|
2979
|
+
/* @__PURE__ */ jsx16("div", { className: "sia-tree-select__tree", role: "tree", "aria-multiselectable": multi || void 0, style: { maxHeight: listHeight }, children: loading ? /* @__PURE__ */ jsx16("div", { role: "status", className: "sia-tree-select__empty", children: "\u52A0\u8F7D\u4E2D\u2026" }) : visibleNodes.length ? visibleNodes.map((node) => {
|
|
2919
2980
|
const hasChildren = Boolean(node.children?.length);
|
|
2920
2981
|
const selected = checked.has(node.value);
|
|
2921
2982
|
const partial = cascade && !selected && affected(node).some((value2) => checked.has(value2));
|
|
2922
|
-
return /* @__PURE__ */
|
|
2983
|
+
return /* @__PURE__ */ jsxs16(
|
|
2923
2984
|
"div",
|
|
2924
2985
|
{
|
|
2925
2986
|
className: `sia-tree-select__node${selected ? " is-selected" : ""}${node.disabled ? " is-disabled" : ""}`,
|
|
@@ -2931,14 +2992,14 @@ function TreeSelect({
|
|
|
2931
2992
|
"aria-expanded": hasChildren ? !!search || expandedSet.has(node.key ?? node.value) : void 0,
|
|
2932
2993
|
"aria-checked": treeCheckable ? partial ? "mixed" : selected : void 0,
|
|
2933
2994
|
children: [
|
|
2934
|
-
hasChildren ? /* @__PURE__ */
|
|
2935
|
-
treeCheckable && node.checkable !== false ? /* @__PURE__ */
|
|
2936
|
-
/* @__PURE__ */
|
|
2995
|
+
hasChildren ? /* @__PURE__ */ jsx16("button", { type: "button", className: "sia-tree-select__expand", "aria-label": expandedSet.has(node.key ?? node.value) ? "\u6536\u8D77\u8282\u70B9" : "\u5C55\u5F00\u8282\u70B9", disabled: node.disabled, onClick: () => toggleNode(node), children: /* @__PURE__ */ jsx16(Icon, { name: expandedSet.has(node.key ?? node.value) ? "chevron-down" : "chevron-right", size: 13 }) }) : /* @__PURE__ */ jsx16("span", { className: "sia-tree-select__indent" }),
|
|
2996
|
+
treeCheckable && node.checkable !== false ? /* @__PURE__ */ jsx16(Checkbox, { "aria-label": typeof node.title === "string" ? node.title : void 0, checked: selected, indeterminate: partial, disabled: node.disabled || node.disableCheckbox, onChange: () => select(node) }) : null,
|
|
2997
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: "sia-tree-select__title", disabled: node.disabled, onClick: () => select(node), children: node.title })
|
|
2937
2998
|
]
|
|
2938
2999
|
},
|
|
2939
3000
|
node.key ?? node.value
|
|
2940
3001
|
);
|
|
2941
|
-
}) : /* @__PURE__ */
|
|
3002
|
+
}) : /* @__PURE__ */ jsx16("div", { className: "sia-tree-select__empty", children: "\u6682\u65E0\u5339\u914D\u8282\u70B9" }) }),
|
|
2942
3003
|
dropdownFooter
|
|
2943
3004
|
] })
|
|
2944
3005
|
]
|
|
@@ -2976,7 +3037,7 @@ function buildFlatTree(items, options = {}) {
|
|
|
2976
3037
|
}
|
|
2977
3038
|
|
|
2978
3039
|
// src/components/Editor.tsx
|
|
2979
|
-
import { useEffect as
|
|
3040
|
+
import { useEffect as useEffect9, useId as useId6, useRef as useRef10, useState as useState13 } from "react";
|
|
2980
3041
|
import EditorWorker from "monaco-editor/editor/editor.worker.js?worker";
|
|
2981
3042
|
|
|
2982
3043
|
// src/components/jsonLanguage.ts
|
|
@@ -3557,7 +3618,7 @@ function registerSqlLanguages(monaco) {
|
|
|
3557
3618
|
}
|
|
3558
3619
|
|
|
3559
3620
|
// src/components/Editor.tsx
|
|
3560
|
-
import { jsx as
|
|
3621
|
+
import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3561
3622
|
var EDITOR_COMMAND_SHORTCUTS = {
|
|
3562
3623
|
cut: "Ctrl+X",
|
|
3563
3624
|
copy: "Ctrl+C",
|
|
@@ -3673,8 +3734,8 @@ function Editor({
|
|
|
3673
3734
|
const initialPathRef = useRef10(path);
|
|
3674
3735
|
const initialThemeRef = useRef10(theme);
|
|
3675
3736
|
const initialOptionsRef = useRef10(options);
|
|
3676
|
-
const [loading, setLoading] =
|
|
3677
|
-
const [, setSelectionVersion] =
|
|
3737
|
+
const [loading, setLoading] = useState13(true);
|
|
3738
|
+
const [, setSelectionVersion] = useState13(0);
|
|
3678
3739
|
initialValueRef.current = value;
|
|
3679
3740
|
initialLanguageRef.current = language;
|
|
3680
3741
|
initialPathRef.current = path;
|
|
@@ -3689,7 +3750,7 @@ function Editor({
|
|
|
3689
3750
|
contextMenuItemsRef.current = contextMenuItems;
|
|
3690
3751
|
completionProviderRef.current = completionProvider;
|
|
3691
3752
|
refreshSuggestionOnSpaceRef.current = refreshSuggestionOnSpace;
|
|
3692
|
-
|
|
3753
|
+
useEffect9(() => {
|
|
3693
3754
|
let disposed = false;
|
|
3694
3755
|
const subscriptions = [];
|
|
3695
3756
|
async function mountEditor() {
|
|
@@ -4033,7 +4094,7 @@ function Editor({
|
|
|
4033
4094
|
updateHighlightRef.current = () => void 0;
|
|
4034
4095
|
};
|
|
4035
4096
|
}, [generatedId]);
|
|
4036
|
-
|
|
4097
|
+
useEffect9(() => {
|
|
4037
4098
|
const model = modelRef.current;
|
|
4038
4099
|
if (!model || model.getValue() === value) return;
|
|
4039
4100
|
applyingControlledValueRef.current = true;
|
|
@@ -4043,7 +4104,7 @@ function Editor({
|
|
|
4043
4104
|
applyingControlledValueRef.current = false;
|
|
4044
4105
|
}
|
|
4045
4106
|
}, [loading, value]);
|
|
4046
|
-
|
|
4107
|
+
useEffect9(() => {
|
|
4047
4108
|
if (loading) return;
|
|
4048
4109
|
void loadMonaco().then((monaco) => {
|
|
4049
4110
|
const model = modelRef.current;
|
|
@@ -4052,7 +4113,7 @@ function Editor({
|
|
|
4052
4113
|
}, [language, loading]);
|
|
4053
4114
|
const completionEnabled = Boolean(completionProvider);
|
|
4054
4115
|
const completionTriggerKey = completionTriggerCharacters.join("\0");
|
|
4055
|
-
|
|
4116
|
+
useEffect9(() => {
|
|
4056
4117
|
if (loading || !completionEnabled) return void 0;
|
|
4057
4118
|
let disposed = false;
|
|
4058
4119
|
let subscription;
|
|
@@ -4126,23 +4187,23 @@ function Editor({
|
|
|
4126
4187
|
subscription?.dispose();
|
|
4127
4188
|
};
|
|
4128
4189
|
}, [completionEnabled, completionTriggerKey, language, loading]);
|
|
4129
|
-
|
|
4190
|
+
useEffect9(() => {
|
|
4130
4191
|
if (loading) return;
|
|
4131
4192
|
void loadMonaco().then((monaco) => {
|
|
4132
4193
|
if (editorRef.current) monaco.editor.setTheme(theme === "dark" ? "vs-dark" : "vs");
|
|
4133
4194
|
});
|
|
4134
4195
|
}, [loading, theme]);
|
|
4135
|
-
|
|
4196
|
+
useEffect9(() => {
|
|
4136
4197
|
if (loading) return;
|
|
4137
4198
|
editorRef.current?.updateOptions({
|
|
4138
4199
|
...options ?? {},
|
|
4139
4200
|
contextmenu: contextMenuItems.length === 0 ? options?.contextmenu ?? true : false
|
|
4140
4201
|
});
|
|
4141
4202
|
}, [contextMenuItems.length, loading, options]);
|
|
4142
|
-
|
|
4203
|
+
useEffect9(() => {
|
|
4143
4204
|
updateHighlightRef.current();
|
|
4144
4205
|
}, [highlightRange]);
|
|
4145
|
-
|
|
4206
|
+
useEffect9(() => {
|
|
4146
4207
|
if (loading) return;
|
|
4147
4208
|
void loadMonaco().then((monaco) => {
|
|
4148
4209
|
const model = modelRef.current;
|
|
@@ -4160,11 +4221,11 @@ function Editor({
|
|
|
4160
4221
|
})));
|
|
4161
4222
|
});
|
|
4162
4223
|
}, [generatedId, loading, markers]);
|
|
4163
|
-
const editorNode = /* @__PURE__ */
|
|
4164
|
-
/* @__PURE__ */
|
|
4165
|
-
/* @__PURE__ */
|
|
4166
|
-
loading ? /* @__PURE__ */
|
|
4167
|
-
/* @__PURE__ */
|
|
4224
|
+
const editorNode = /* @__PURE__ */ jsxs17("div", { className: `sia-editor-control ${className}`.trim(), "data-loading": loading || void 0, children: [
|
|
4225
|
+
/* @__PURE__ */ jsx17("div", { className: "sia-editor-control__surface", ref: containerRef, "aria-label": ariaLabel }),
|
|
4226
|
+
/* @__PURE__ */ jsx17("div", { ref: rangeHighlightRef, className: "sia-editor-control__range-highlight", "aria-hidden": "true" }),
|
|
4227
|
+
loading ? /* @__PURE__ */ jsxs17("div", { className: "sia-editor-control__loading", role: "status", children: [
|
|
4228
|
+
/* @__PURE__ */ jsx17("span", {}),
|
|
4168
4229
|
loadingText
|
|
4169
4230
|
] }) : null
|
|
4170
4231
|
] });
|
|
@@ -4193,7 +4254,7 @@ function Editor({
|
|
|
4193
4254
|
item.onClick?.(api);
|
|
4194
4255
|
}
|
|
4195
4256
|
}
|
|
4196
|
-
return /* @__PURE__ */
|
|
4257
|
+
return /* @__PURE__ */ jsx17(
|
|
4197
4258
|
Dropdown,
|
|
4198
4259
|
{
|
|
4199
4260
|
className: "sia-editor-control__context-menu",
|
|
@@ -4210,19 +4271,19 @@ function Editor({
|
|
|
4210
4271
|
}
|
|
4211
4272
|
|
|
4212
4273
|
// src/components/Markdown.tsx
|
|
4213
|
-
import { useEffect as
|
|
4274
|
+
import { useEffect as useEffect10, useMemo as useMemo7, useRef as useRef11, useState as useState14 } from "react";
|
|
4214
4275
|
import DOMPurify from "dompurify";
|
|
4215
4276
|
import { marked } from "marked";
|
|
4216
|
-
import { Fragment as Fragment5, jsx as
|
|
4277
|
+
import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4217
4278
|
function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", resolveImageSrc, imagePreview = true, className = "", onClick, onKeyDown, ...props }) {
|
|
4218
4279
|
const rootRef = useRef11(null);
|
|
4219
|
-
const [previewImage, setPreviewImage] =
|
|
4280
|
+
const [previewImage, setPreviewImage] = useState14(null);
|
|
4220
4281
|
const html = useMemo7(() => {
|
|
4221
4282
|
const rendered = marked.parse(content, { breaks: true, gfm: true });
|
|
4222
4283
|
const sanitized = DOMPurify.sanitize(rendered, { USE_PROFILES: { html: true } });
|
|
4223
4284
|
return sanitized.replace(/<img\b/giu, '<img loading="lazy" decoding="async" referrerpolicy="no-referrer"');
|
|
4224
4285
|
}, [content]);
|
|
4225
|
-
|
|
4286
|
+
useEffect10(() => {
|
|
4226
4287
|
const root = rootRef.current;
|
|
4227
4288
|
if (!root) return void 0;
|
|
4228
4289
|
let cancelled = false;
|
|
@@ -4279,19 +4340,19 @@ function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", r
|
|
|
4279
4340
|
onKeyDown?.(event);
|
|
4280
4341
|
}
|
|
4281
4342
|
if (!content.trim()) {
|
|
4282
|
-
return /* @__PURE__ */
|
|
4343
|
+
return /* @__PURE__ */ jsx18("div", { className: `sia-markdown sia-markdown--empty ${className}`.trim(), children: emptyText });
|
|
4283
4344
|
}
|
|
4284
|
-
return /* @__PURE__ */
|
|
4285
|
-
/* @__PURE__ */
|
|
4286
|
-
/* @__PURE__ */
|
|
4345
|
+
return /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
4346
|
+
/* @__PURE__ */ jsx18("article", { ...withTitleTooltip(props), ref: rootRef, className: `sia-markdown ${className}`.trim(), onClick: handleClick, onKeyDown: handleKeyDown, dangerouslySetInnerHTML: { __html: html } }),
|
|
4347
|
+
/* @__PURE__ */ jsx18(ImagePreview, { open: Boolean(previewImage), src: previewImage?.src, alt: previewImage?.alt, onOpenChange: (open) => {
|
|
4287
4348
|
if (!open) setPreviewImage(null);
|
|
4288
4349
|
} })
|
|
4289
4350
|
] });
|
|
4290
4351
|
}
|
|
4291
4352
|
|
|
4292
4353
|
// src/components/InputNumber.tsx
|
|
4293
|
-
import { forwardRef as forwardRef4, useEffect as
|
|
4294
|
-
import { jsx as
|
|
4354
|
+
import { forwardRef as forwardRef4, useEffect as useEffect11, useId as useId7, useRef as useRef12, useState as useState15 } from "react";
|
|
4355
|
+
import { jsx as jsx19, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4295
4356
|
function formatValue(value, precision) {
|
|
4296
4357
|
if (value === null || !Number.isFinite(value)) return "";
|
|
4297
4358
|
return precision === void 0 ? String(value) : value.toFixed(precision);
|
|
@@ -4330,8 +4391,8 @@ var InputNumber = forwardRef4(function InputNumber2({
|
|
|
4330
4391
|
const plain = formatValue(next, precision);
|
|
4331
4392
|
return plain && formatter ? formatter(plain) : plain;
|
|
4332
4393
|
};
|
|
4333
|
-
const [text, setText] =
|
|
4334
|
-
|
|
4394
|
+
const [text, setText] = useState15(() => displayValue(currentValue));
|
|
4395
|
+
useEffect11(() => {
|
|
4335
4396
|
setText(displayValue(currentValue));
|
|
4336
4397
|
}, [currentValue, precision, formatter]);
|
|
4337
4398
|
function setRef(node) {
|
|
@@ -4400,7 +4461,7 @@ var InputNumber = forwardRef4(function InputNumber2({
|
|
|
4400
4461
|
const increaseDisabled = disabled || readOnly || max !== void 0 && currentValue !== null && currentValue >= max;
|
|
4401
4462
|
const decreaseDisabled = disabled || readOnly || min !== void 0 && currentValue !== null && currentValue <= min;
|
|
4402
4463
|
const floatingPlaceholder = usePlaceholderMode(placeholderMode) === "floating" && Boolean(placeholder);
|
|
4403
|
-
const input = /* @__PURE__ */
|
|
4464
|
+
const input = /* @__PURE__ */ jsx19(
|
|
4404
4465
|
"input",
|
|
4405
4466
|
{
|
|
4406
4467
|
...withTitleTooltip(props),
|
|
@@ -4422,26 +4483,26 @@ var InputNumber = forwardRef4(function InputNumber2({
|
|
|
4422
4483
|
onKeyDown: handleKeyDown
|
|
4423
4484
|
}
|
|
4424
4485
|
);
|
|
4425
|
-
return /* @__PURE__ */
|
|
4426
|
-
prefix ? /* @__PURE__ */
|
|
4427
|
-
floatingPlaceholder ? /* @__PURE__ */
|
|
4486
|
+
return /* @__PURE__ */ jsxs19("span", { className: `sia-input-number sia-input-number--${size} sia-input-number--${status}${floatingPlaceholder ? " sia-input-number--floating" : ""}${floatingPlaceholder && text.length > 0 ? " is-filled" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
4487
|
+
prefix ? /* @__PURE__ */ jsx19("span", { className: "sia-input-number__affix", children: prefix }) : null,
|
|
4488
|
+
floatingPlaceholder ? /* @__PURE__ */ jsxs19("span", { className: "sia-input-number__input-wrap", children: [
|
|
4428
4489
|
input,
|
|
4429
|
-
/* @__PURE__ */
|
|
4490
|
+
/* @__PURE__ */ jsx19("span", { className: "sia-input-number__floating-placeholder", "aria-hidden": "true", children: placeholder })
|
|
4430
4491
|
] }) : input,
|
|
4431
|
-
suffix ? /* @__PURE__ */
|
|
4432
|
-
controls ? /* @__PURE__ */
|
|
4433
|
-
/* @__PURE__ */
|
|
4434
|
-
/* @__PURE__ */
|
|
4492
|
+
suffix ? /* @__PURE__ */ jsx19("span", { className: "sia-input-number__affix", children: suffix }) : null,
|
|
4493
|
+
controls ? /* @__PURE__ */ jsxs19("span", { className: "sia-input-number__controls", children: [
|
|
4494
|
+
/* @__PURE__ */ jsx19("button", { type: "button", tabIndex: -1, "aria-label": "\u589E\u52A0\u6570\u503C", disabled: increaseDisabled, onClick: () => changeBy(1), children: /* @__PURE__ */ jsx19(Icon, { name: "chevron-up", size: 12 }) }),
|
|
4495
|
+
/* @__PURE__ */ jsx19("button", { type: "button", tabIndex: -1, "aria-label": "\u51CF\u5C11\u6570\u503C", disabled: decreaseDisabled, onClick: () => changeBy(-1), children: /* @__PURE__ */ jsx19(Icon, { name: "chevron-down", size: 12 }) })
|
|
4435
4496
|
] }) : null
|
|
4436
4497
|
] });
|
|
4437
4498
|
});
|
|
4438
4499
|
|
|
4439
4500
|
// src/components/SelectModal.tsx
|
|
4440
|
-
import { useState as
|
|
4441
|
-
import { Fragment as Fragment6, jsx as
|
|
4501
|
+
import { useState as useState16 } from "react";
|
|
4502
|
+
import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4442
4503
|
function SelectModalBody({ config, values, disabled, onChange }) {
|
|
4443
|
-
const [query, setQuery] =
|
|
4444
|
-
const [selectedOnly, setSelectedOnly] =
|
|
4504
|
+
const [query, setQuery] = useState16("");
|
|
4505
|
+
const [selectedOnly, setSelectedOnly] = useState16(false);
|
|
4445
4506
|
const multiple = config.mode === "multiple";
|
|
4446
4507
|
const search = query.trim();
|
|
4447
4508
|
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()))));
|
|
@@ -4455,23 +4516,23 @@ function SelectModalBody({ config, values, disabled, onChange }) {
|
|
|
4455
4516
|
});
|
|
4456
4517
|
onChange([...next]);
|
|
4457
4518
|
};
|
|
4458
|
-
return /* @__PURE__ */
|
|
4459
|
-
config.headerExtra != null && config.headerExtra !== false ? /* @__PURE__ */
|
|
4460
|
-
/* @__PURE__ */
|
|
4461
|
-
/* @__PURE__ */
|
|
4462
|
-
/* @__PURE__ */
|
|
4463
|
-
/* @__PURE__ */
|
|
4519
|
+
return /* @__PURE__ */ jsxs20(Fragment6, { children: [
|
|
4520
|
+
config.headerExtra != null && config.headerExtra !== false ? /* @__PURE__ */ jsx20("div", { className: "sia-select-modal__header-extra", children: config.headerExtra }) : null,
|
|
4521
|
+
/* @__PURE__ */ jsxs20("div", { className: "sia-select-modal__heading", children: [
|
|
4522
|
+
/* @__PURE__ */ jsxs20("div", { role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
4523
|
+
/* @__PURE__ */ jsx20(Button, { role: "tab", "aria-selected": !selectedOnly, variant: "link", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
4524
|
+
/* @__PURE__ */ jsxs20(Button, { role: "tab", "aria-selected": selectedOnly, variant: "link", onClick: () => setSelectedOnly(true), children: [
|
|
4464
4525
|
"\u5DF2\u9009\u9879(",
|
|
4465
4526
|
values.length,
|
|
4466
4527
|
")"
|
|
4467
4528
|
] })
|
|
4468
4529
|
] }),
|
|
4469
|
-
/* @__PURE__ */
|
|
4530
|
+
/* @__PURE__ */ jsx20(
|
|
4470
4531
|
Input,
|
|
4471
4532
|
{
|
|
4472
4533
|
"aria-label": config.searchPlaceholder ?? "\u641C\u7D22\u9009\u9879",
|
|
4473
4534
|
placeholder: config.searchPlaceholder ?? "\u641C\u7D22\u9009\u9879",
|
|
4474
|
-
prefix: /* @__PURE__ */
|
|
4535
|
+
prefix: /* @__PURE__ */ jsx20(Icon, { name: "search", size: 14 }),
|
|
4475
4536
|
value: query,
|
|
4476
4537
|
allowClear: true,
|
|
4477
4538
|
disabled,
|
|
@@ -4482,8 +4543,8 @@ function SelectModalBody({ config, values, disabled, onChange }) {
|
|
|
4482
4543
|
}
|
|
4483
4544
|
)
|
|
4484
4545
|
] }),
|
|
4485
|
-
multiple ? /* @__PURE__ */
|
|
4486
|
-
/* @__PURE__ */
|
|
4546
|
+
multiple ? /* @__PURE__ */ jsxs20("div", { className: "sia-select-modal__actions", children: [
|
|
4547
|
+
/* @__PURE__ */ jsx20(
|
|
4487
4548
|
Checkbox,
|
|
4488
4549
|
{
|
|
4489
4550
|
checked: all,
|
|
@@ -4493,10 +4554,10 @@ function SelectModalBody({ config, values, disabled, onChange }) {
|
|
|
4493
4554
|
children: "\u5168\u9009"
|
|
4494
4555
|
}
|
|
4495
4556
|
),
|
|
4496
|
-
/* @__PURE__ */
|
|
4497
|
-
/* @__PURE__ */
|
|
4557
|
+
/* @__PURE__ */ jsx20(Button, { variant: "link", size: "small", disabled: disabled || !enabled.length, onClick: () => batch("invert"), children: "\u53CD\u9009" }),
|
|
4558
|
+
/* @__PURE__ */ jsx20(Button, { variant: "link", size: "small", danger: true, disabled: disabled || !values.length, onClick: () => onChange([]), children: "\u6E05\u7A7A" })
|
|
4498
4559
|
] }) : null,
|
|
4499
|
-
/* @__PURE__ */
|
|
4560
|
+
/* @__PURE__ */ jsx20(
|
|
4500
4561
|
SelectionPanel,
|
|
4501
4562
|
{
|
|
4502
4563
|
options: filtered,
|
|
@@ -4523,7 +4584,7 @@ function openSelectModal(config) {
|
|
|
4523
4584
|
if (config.mode !== "multiple") values = values.slice(0, 1);
|
|
4524
4585
|
let submitting = false;
|
|
4525
4586
|
function body() {
|
|
4526
|
-
return /* @__PURE__ */
|
|
4587
|
+
return /* @__PURE__ */ jsx20(SelectModalBody, { config: current, values, disabled: submitting || Boolean(current.confirmLoading), onChange: (next) => {
|
|
4527
4588
|
values = next;
|
|
4528
4589
|
handle.update({ children: body() });
|
|
4529
4590
|
} });
|
|
@@ -4566,8 +4627,8 @@ function openSelectModal(config) {
|
|
|
4566
4627
|
}
|
|
4567
4628
|
|
|
4568
4629
|
// src/components/Treemap.tsx
|
|
4569
|
-
import { useEffect as
|
|
4570
|
-
import { jsx as
|
|
4630
|
+
import { useEffect as useEffect12, useMemo as useMemo8, useRef as useRef13, useState as useState17 } from "react";
|
|
4631
|
+
import { jsx as jsx21, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4571
4632
|
import { createElement } from "react";
|
|
4572
4633
|
function positiveValue(value) {
|
|
4573
4634
|
return Number.isFinite(value) && value > 0 ? value : 1;
|
|
@@ -4940,9 +5001,9 @@ function Treemap({
|
|
|
4940
5001
|
...props
|
|
4941
5002
|
}) {
|
|
4942
5003
|
const containerRef = useRef13(null);
|
|
4943
|
-
const [size, setSize] =
|
|
4944
|
-
const [internalExpandedKeys, setInternalExpandedKeys] =
|
|
4945
|
-
const [internalFocusedKey, setInternalFocusedKey] =
|
|
5004
|
+
const [size, setSize] = useState17({ width: 0, height: 0 });
|
|
5005
|
+
const [internalExpandedKeys, setInternalExpandedKeys] = useState17(() => [...defaultExpandedKeys]);
|
|
5006
|
+
const [internalFocusedKey, setInternalFocusedKey] = useState17(defaultFocusedKey);
|
|
4946
5007
|
const currentExpandedKeys = expandedKeys ?? internalExpandedKeys;
|
|
4947
5008
|
const currentFocusedKey = focusedKey === void 0 ? internalFocusedKey : focusedKey;
|
|
4948
5009
|
const expandedSet = useMemo8(() => new Set(currentExpandedKeys), [currentExpandedKeys]);
|
|
@@ -4967,7 +5028,7 @@ function Treemap({
|
|
|
4967
5028
|
),
|
|
4968
5029
|
[activeKey, aggregateOverflow, data, effectiveFocusedNode, expandedSet, gap, headerHeight, maxVisibleNodes, minTileHeight, minTileWidth, overflowLabel, size]
|
|
4969
5030
|
);
|
|
4970
|
-
|
|
5031
|
+
useEffect12(() => {
|
|
4971
5032
|
const element = containerRef.current;
|
|
4972
5033
|
if (!element) return void 0;
|
|
4973
5034
|
const updateSize = () => {
|
|
@@ -4979,7 +5040,7 @@ function Treemap({
|
|
|
4979
5040
|
observer.observe(element);
|
|
4980
5041
|
return () => observer.disconnect();
|
|
4981
5042
|
}, []);
|
|
4982
|
-
|
|
5043
|
+
useEffect12(() => {
|
|
4983
5044
|
if (!currentFocusedKey || effectiveFocusedNode) return;
|
|
4984
5045
|
if (focusedKey === void 0) setInternalFocusedKey(null);
|
|
4985
5046
|
onFocusedChange?.(null);
|
|
@@ -4999,7 +5060,7 @@ function Treemap({
|
|
|
4999
5060
|
}
|
|
5000
5061
|
onNodeClick?.({ node, expanded: isExpanded, nativeEvent });
|
|
5001
5062
|
}
|
|
5002
|
-
return /* @__PURE__ */
|
|
5063
|
+
return /* @__PURE__ */ jsxs21(
|
|
5003
5064
|
"div",
|
|
5004
5065
|
{
|
|
5005
5066
|
...withTitleTooltip(props),
|
|
@@ -5008,7 +5069,7 @@ function Treemap({
|
|
|
5008
5069
|
style,
|
|
5009
5070
|
role: "tree",
|
|
5010
5071
|
children: [
|
|
5011
|
-
data.length === 0 ? /* @__PURE__ */
|
|
5072
|
+
data.length === 0 ? /* @__PURE__ */ jsx21("div", { className: "sia-treemap__empty", children: emptyContent }) : null,
|
|
5012
5073
|
positions.map(({ node, rectangle, depth, expanded }) => {
|
|
5013
5074
|
const active = node.key === activeKey || Boolean(node.__active);
|
|
5014
5075
|
const fontSize = tileFontSize(rectangle);
|
|
@@ -5038,8 +5099,8 @@ function Treemap({
|
|
|
5038
5099
|
"data-treemap-key": node.key,
|
|
5039
5100
|
key: node.key
|
|
5040
5101
|
},
|
|
5041
|
-
/* @__PURE__ */
|
|
5042
|
-
/* @__PURE__ */
|
|
5102
|
+
/* @__PURE__ */ jsxs21("div", { className: "sia-treemap__header", children: [
|
|
5103
|
+
/* @__PURE__ */ jsxs21(
|
|
5043
5104
|
"button",
|
|
5044
5105
|
{
|
|
5045
5106
|
type: "button",
|
|
@@ -5047,12 +5108,12 @@ function Treemap({
|
|
|
5047
5108
|
disabled: node.disabled,
|
|
5048
5109
|
onClick: (event) => handleNodeClick(node, event),
|
|
5049
5110
|
children: [
|
|
5050
|
-
/* @__PURE__ */
|
|
5051
|
-
showValue ? /* @__PURE__ */
|
|
5111
|
+
/* @__PURE__ */ jsx21("span", { className: "sia-treemap__label", children: node.label }),
|
|
5112
|
+
showValue ? /* @__PURE__ */ jsx21("span", { className: "sia-treemap__value", children: valueFormatter(node.value, node) }) : null
|
|
5052
5113
|
]
|
|
5053
5114
|
}
|
|
5054
5115
|
),
|
|
5055
|
-
/* @__PURE__ */
|
|
5116
|
+
/* @__PURE__ */ jsx21(
|
|
5056
5117
|
"button",
|
|
5057
5118
|
{
|
|
5058
5119
|
type: "button",
|
|
@@ -5060,7 +5121,7 @@ function Treemap({
|
|
|
5060
5121
|
"aria-label": effectiveFocusedNode?.key === node.key ? `\u8FD8\u539F ${node.label}` : `\u805A\u7126\u5C55\u5F00 ${node.label}`,
|
|
5061
5122
|
...withTitleTooltip({ title: effectiveFocusedNode?.key === node.key ? "\u8FD8\u539F\u539F\u6709\u89C6\u56FE" : "\u5C55\u5F00\u5230\u6574\u4E2A\u533A\u57DF" }),
|
|
5062
5123
|
onClick: () => updateFocusedKey(effectiveFocusedNode?.key === node.key ? null : node.key),
|
|
5063
|
-
children: /* @__PURE__ */
|
|
5124
|
+
children: /* @__PURE__ */ jsx21(Icon, { name: effectiveFocusedNode?.key === node.key ? "fullscreen-exit" : "fullscreen", size: 14 })
|
|
5064
5125
|
}
|
|
5065
5126
|
)
|
|
5066
5127
|
] })
|
|
@@ -5080,9 +5141,9 @@ function Treemap({
|
|
|
5080
5141
|
onClick: (event) => handleNodeClick(node, event),
|
|
5081
5142
|
key: node.key
|
|
5082
5143
|
},
|
|
5083
|
-
showLabel ? /* @__PURE__ */
|
|
5084
|
-
/* @__PURE__ */
|
|
5085
|
-
showValue ? /* @__PURE__ */
|
|
5144
|
+
showLabel ? /* @__PURE__ */ jsxs21("span", { className: "sia-treemap__content", children: [
|
|
5145
|
+
/* @__PURE__ */ jsx21("span", { className: "sia-treemap__label", children: node.label }),
|
|
5146
|
+
showValue ? /* @__PURE__ */ jsx21("span", { className: "sia-treemap__value", children: valueFormatter(node.value, node) }) : null
|
|
5086
5147
|
] }) : null
|
|
5087
5148
|
);
|
|
5088
5149
|
})
|
|
@@ -5092,8 +5153,8 @@ function Treemap({
|
|
|
5092
5153
|
}
|
|
5093
5154
|
|
|
5094
5155
|
// src/components/Table/TableCellContent.tsx
|
|
5095
|
-
import { useLayoutEffect as useLayoutEffect3, useRef as useRef14, useState as
|
|
5096
|
-
import { jsx as
|
|
5156
|
+
import { useLayoutEffect as useLayoutEffect3, useRef as useRef14, useState as useState18 } from "react";
|
|
5157
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
5097
5158
|
var pendingLayouts = /* @__PURE__ */ new Map();
|
|
5098
5159
|
var layoutFrame;
|
|
5099
5160
|
function scheduleLayout(element, task) {
|
|
@@ -5112,7 +5173,7 @@ function scheduleLayout(element, task) {
|
|
|
5112
5173
|
}
|
|
5113
5174
|
function TableCellContent({ children, ellipsis, title }) {
|
|
5114
5175
|
const ref = useRef14(null);
|
|
5115
|
-
const [overflowing, setOverflowing] =
|
|
5176
|
+
const [overflowing, setOverflowing] = useState18(false);
|
|
5116
5177
|
const customContent = typeof children !== "string" && typeof children !== "number" && children != null;
|
|
5117
5178
|
useLayoutEffect3(() => {
|
|
5118
5179
|
const element = ref.current;
|
|
@@ -5146,13 +5207,13 @@ function TableCellContent({ children, ellipsis, title }) {
|
|
|
5146
5207
|
pendingLayouts.delete(element);
|
|
5147
5208
|
};
|
|
5148
5209
|
}, [children, ellipsis, customContent]);
|
|
5149
|
-
return /* @__PURE__ */
|
|
5210
|
+
return /* @__PURE__ */ jsx22("div", { ref, className: "sia-table__cell-content", "data-custom-content": customContent || void 0, "data-content-overflow": ellipsis && customContent && overflowing || void 0, children: title ? /* @__PURE__ */ jsx22(Tooltip, { title, className: "sia-table__cell-tooltip", children: /* @__PURE__ */ jsx22("span", { children }) }) : children });
|
|
5150
5211
|
}
|
|
5151
5212
|
|
|
5152
5213
|
// src/components/Table/useRemainingHeight.ts
|
|
5153
|
-
import { useLayoutEffect as useLayoutEffect4, useState as
|
|
5214
|
+
import { useLayoutEffect as useLayoutEffect4, useState as useState19 } from "react";
|
|
5154
5215
|
function useRemainingHeight(rootRef, options) {
|
|
5155
|
-
const [height, setHeight] =
|
|
5216
|
+
const [height, setHeight] = useState19();
|
|
5156
5217
|
const enabled = !!options;
|
|
5157
5218
|
const container = typeof options === "object" ? options.container : void 0;
|
|
5158
5219
|
const bottomOffset = typeof options === "object" ? options.bottomOffset ?? 0 : 0;
|
|
@@ -5281,7 +5342,7 @@ function toTablePageParams(current, pageSize) {
|
|
|
5281
5342
|
}
|
|
5282
5343
|
|
|
5283
5344
|
// src/components/Table/TableCanvasLayer.tsx
|
|
5284
|
-
import { jsx as
|
|
5345
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
5285
5346
|
function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHeight }) {
|
|
5286
5347
|
const canvasRef = useRef15(null);
|
|
5287
5348
|
useLayoutEffect5(() => {
|
|
@@ -5407,7 +5468,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
5407
5468
|
window.removeEventListener("resize", schedule);
|
|
5408
5469
|
};
|
|
5409
5470
|
}, [viewport, rows, columns, widths, rowHeight, headerHeight]);
|
|
5410
|
-
return /* @__PURE__ */
|
|
5471
|
+
return /* @__PURE__ */ jsx23("canvas", { ref: canvasRef, "aria-hidden": "true", className: "sia-table__canvas-layer" });
|
|
5411
5472
|
}
|
|
5412
5473
|
|
|
5413
5474
|
// src/components/Table/rowIdentity.ts
|
|
@@ -5427,10 +5488,10 @@ function createRowIdentity() {
|
|
|
5427
5488
|
}
|
|
5428
5489
|
|
|
5429
5490
|
// src/components/Table/Table.tsx
|
|
5430
|
-
import { Fragment as Fragment8, forwardRef as forwardRef5, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as
|
|
5491
|
+
import { Fragment as Fragment8, forwardRef as forwardRef5, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as useEffect14, useImperativeHandle, useMemo as useMemo9, useRef as useRef17, useState as useState21 } from "react";
|
|
5431
5492
|
|
|
5432
5493
|
// src/components/Table/plugins.tsx
|
|
5433
|
-
import { isValidElement as isValidElement3, useEffect as
|
|
5494
|
+
import { isValidElement as isValidElement3, useEffect as useEffect13, useRef as useRef16, useState as useState20 } from "react";
|
|
5434
5495
|
|
|
5435
5496
|
// src/components/Table/columnSettings.ts
|
|
5436
5497
|
function reconcileColumnSettings(columns, defaults, saved) {
|
|
@@ -5517,7 +5578,7 @@ function saveSettingsPatch(adapter, scope, patch) {
|
|
|
5517
5578
|
}
|
|
5518
5579
|
|
|
5519
5580
|
// src/components/Table/plugins.tsx
|
|
5520
|
-
import { Fragment as Fragment7, jsx as
|
|
5581
|
+
import { Fragment as Fragment7, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5521
5582
|
function TableCheckbox({
|
|
5522
5583
|
checked,
|
|
5523
5584
|
indeterminate,
|
|
@@ -5525,7 +5586,7 @@ function TableCheckbox({
|
|
|
5525
5586
|
label,
|
|
5526
5587
|
onChange
|
|
5527
5588
|
}) {
|
|
5528
|
-
return /* @__PURE__ */
|
|
5589
|
+
return /* @__PURE__ */ jsx24(
|
|
5529
5590
|
Checkbox,
|
|
5530
5591
|
{
|
|
5531
5592
|
className: "sia-table__checkbox",
|
|
@@ -6143,20 +6204,20 @@ function TableSelectedItemsPanel({
|
|
|
6143
6204
|
onRemove,
|
|
6144
6205
|
onClear
|
|
6145
6206
|
}) {
|
|
6146
|
-
const [showAll, setShowAll] =
|
|
6207
|
+
const [showAll, setShowAll] = useState20(false);
|
|
6147
6208
|
const visibleEntries = showAll ? entries : entries.slice(0, maxCount);
|
|
6148
6209
|
const hiddenCount = Math.max(0, entries.length - visibleEntries.length);
|
|
6149
6210
|
const baseColumnMap = new Map(
|
|
6150
6211
|
flattenTableColumns(baseColumns).map((column) => [column.key, column])
|
|
6151
6212
|
);
|
|
6152
|
-
return /* @__PURE__ */
|
|
6153
|
-
/* @__PURE__ */
|
|
6154
|
-
/* @__PURE__ */
|
|
6213
|
+
return /* @__PURE__ */ jsxs22("div", { className: "sia-table-selection-panel", children: [
|
|
6214
|
+
/* @__PURE__ */ jsxs22("div", { className: "sia-table-selection-panel__header", children: [
|
|
6215
|
+
/* @__PURE__ */ jsxs22("strong", { children: [
|
|
6155
6216
|
"\u5DF2\u9009 ",
|
|
6156
|
-
/* @__PURE__ */
|
|
6217
|
+
/* @__PURE__ */ jsx24("span", { children: entries.length }),
|
|
6157
6218
|
" \u9879"
|
|
6158
6219
|
] }),
|
|
6159
|
-
/* @__PURE__ */
|
|
6220
|
+
/* @__PURE__ */ jsx24(
|
|
6160
6221
|
Button,
|
|
6161
6222
|
{
|
|
6162
6223
|
size: "small",
|
|
@@ -6167,15 +6228,15 @@ function TableSelectedItemsPanel({
|
|
|
6167
6228
|
}
|
|
6168
6229
|
)
|
|
6169
6230
|
] }),
|
|
6170
|
-
/* @__PURE__ */
|
|
6171
|
-
/* @__PURE__ */
|
|
6172
|
-
columns.map((column) => /* @__PURE__ */
|
|
6173
|
-
/* @__PURE__ */
|
|
6231
|
+
/* @__PURE__ */ jsx24("div", { className: "sia-table-selection-panel__body", children: /* @__PURE__ */ jsxs22("table", { children: [
|
|
6232
|
+
/* @__PURE__ */ jsx24("thead", { children: /* @__PURE__ */ jsxs22("tr", { children: [
|
|
6233
|
+
columns.map((column) => /* @__PURE__ */ jsx24("th", { children: getColumnLabel(column) }, column.key)),
|
|
6234
|
+
/* @__PURE__ */ jsx24("th", { "aria-label": "\u64CD\u4F5C" })
|
|
6174
6235
|
] }) }),
|
|
6175
|
-
/* @__PURE__ */
|
|
6236
|
+
/* @__PURE__ */ jsx24("tbody", { children: visibleEntries.map((entry, selectedIndex) => /* @__PURE__ */ jsxs22("tr", { children: [
|
|
6176
6237
|
columns.map((column) => {
|
|
6177
6238
|
if (column.meta?.plugin === "index")
|
|
6178
|
-
return /* @__PURE__ */
|
|
6239
|
+
return /* @__PURE__ */ jsx24("td", { children: entry.sourceIndex + 1 }, column.key);
|
|
6179
6240
|
const baseColumn = baseColumnMap.get(column.key) ?? column;
|
|
6180
6241
|
const value = getTableValue(
|
|
6181
6242
|
entry.record,
|
|
@@ -6195,9 +6256,9 @@ function TableSelectedItemsPanel({
|
|
|
6195
6256
|
entry.sourceIndex,
|
|
6196
6257
|
{ row, rowIndex: entry.sourceIndex, column: baseColumn }
|
|
6197
6258
|
) ?? value;
|
|
6198
|
-
return /* @__PURE__ */
|
|
6259
|
+
return /* @__PURE__ */ jsx24("td", { children: content }, column.key);
|
|
6199
6260
|
}),
|
|
6200
|
-
/* @__PURE__ */
|
|
6261
|
+
/* @__PURE__ */ jsx24("td", { children: /* @__PURE__ */ jsx24(
|
|
6201
6262
|
Button,
|
|
6202
6263
|
{
|
|
6203
6264
|
size: "small",
|
|
@@ -6208,11 +6269,11 @@ function TableSelectedItemsPanel({
|
|
|
6208
6269
|
) })
|
|
6209
6270
|
] }, entry.key)) })
|
|
6210
6271
|
] }) }),
|
|
6211
|
-
hiddenCount > 0 ? /* @__PURE__ */
|
|
6272
|
+
hiddenCount > 0 ? /* @__PURE__ */ jsxs22("div", { className: "sia-table-selection-panel__more", children: [
|
|
6212
6273
|
"\u8FD8\u6709 ",
|
|
6213
6274
|
hiddenCount,
|
|
6214
6275
|
" \u9879\u672A\u5C55\u793A",
|
|
6215
|
-
/* @__PURE__ */
|
|
6276
|
+
/* @__PURE__ */ jsx24(Button, { size: "small", variant: "link", onClick: () => setShowAll(true), children: "\u5C55\u793A\u5168\u90E8" })
|
|
6216
6277
|
] }) : null
|
|
6217
6278
|
] });
|
|
6218
6279
|
}
|
|
@@ -6333,7 +6394,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
6333
6394
|
const keys = selected(context);
|
|
6334
6395
|
const allChecked = enabledRows.length > 0 && enabledRows.every((row) => keys.includes(row.key));
|
|
6335
6396
|
const someChecked = enabledRows.some((row) => keys.includes(row.key));
|
|
6336
|
-
return /* @__PURE__ */
|
|
6397
|
+
return /* @__PURE__ */ jsx24(
|
|
6337
6398
|
TableCheckbox,
|
|
6338
6399
|
{
|
|
6339
6400
|
label: "\u9009\u62E9\u5F53\u524D\u9875\u5168\u90E8\u884C",
|
|
@@ -6349,7 +6410,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
6349
6410
|
}
|
|
6350
6411
|
);
|
|
6351
6412
|
},
|
|
6352
|
-
render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */
|
|
6413
|
+
render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */ jsx24(
|
|
6353
6414
|
Radio2,
|
|
6354
6415
|
{
|
|
6355
6416
|
className: "sia-table__checkbox",
|
|
@@ -6360,7 +6421,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
6360
6421
|
onClick: (event) => event.stopPropagation(),
|
|
6361
6422
|
onChange: () => toggle(info.row.key, record, context)
|
|
6362
6423
|
}
|
|
6363
|
-
) : /* @__PURE__ */
|
|
6424
|
+
) : /* @__PURE__ */ jsx24(
|
|
6364
6425
|
TableCheckbox,
|
|
6365
6426
|
{
|
|
6366
6427
|
label: `\u9009\u62E9\u7B2C ${info.rowIndex + 1} \u884C`,
|
|
@@ -6400,8 +6461,8 @@ function createSelectionPlugin(options = {}) {
|
|
|
6400
6461
|
const columns = flattenTableColumns(context.columns).filter(
|
|
6401
6462
|
(column) => !column.hidden && column.meta?.plugin !== "selection"
|
|
6402
6463
|
).slice(0, Math.max(1, options.selectionPanelColumnCount ?? 4));
|
|
6403
|
-
return /* @__PURE__ */
|
|
6404
|
-
/* @__PURE__ */
|
|
6464
|
+
return /* @__PURE__ */ jsxs22("span", { className: "sia-table__selection-footer", children: [
|
|
6465
|
+
/* @__PURE__ */ jsx24(
|
|
6405
6466
|
Popover,
|
|
6406
6467
|
{
|
|
6407
6468
|
placement: "top-start",
|
|
@@ -6409,7 +6470,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
6409
6470
|
open: context.state.panelOpen && entries.length > 0,
|
|
6410
6471
|
onOpenChange: (panelOpen) => context.setState((state) => ({ ...state, panelOpen })),
|
|
6411
6472
|
overlayClassName: "sia-table-selection-popover",
|
|
6412
|
-
content: /* @__PURE__ */
|
|
6473
|
+
content: /* @__PURE__ */ jsx24(
|
|
6413
6474
|
TableSelectedItemsPanel,
|
|
6414
6475
|
{
|
|
6415
6476
|
entries,
|
|
@@ -6425,7 +6486,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
6425
6486
|
onClear: () => setKeys([], context)
|
|
6426
6487
|
}
|
|
6427
6488
|
),
|
|
6428
|
-
children: /* @__PURE__ */
|
|
6489
|
+
children: /* @__PURE__ */ jsxs22(
|
|
6429
6490
|
Button,
|
|
6430
6491
|
{
|
|
6431
6492
|
className: "sia-table__selected-trigger",
|
|
@@ -6441,7 +6502,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
6441
6502
|
)
|
|
6442
6503
|
}
|
|
6443
6504
|
),
|
|
6444
|
-
mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */
|
|
6505
|
+
mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */ jsx24(
|
|
6445
6506
|
Checkbox,
|
|
6446
6507
|
{
|
|
6447
6508
|
checked: preserving(context),
|
|
@@ -6498,9 +6559,9 @@ function createSortPlugin(options = {}) {
|
|
|
6498
6559
|
const info = current(context);
|
|
6499
6560
|
const order = info?.field === field ? info.order : null;
|
|
6500
6561
|
const sortHint = `${getColumnLabel(currentColumn)}\uFF1A${order === "ascend" ? "\u5F53\u524D\u5347\u5E8F\uFF0C\u70B9\u51FB\u5207\u6362\u4E3A\u964D\u5E8F" : order === "descend" ? "\u5F53\u524D\u964D\u5E8F\uFF0C\u70B9\u51FB\u53D6\u6D88\u6392\u5E8F" : "\u672A\u6392\u5E8F\uFF0C\u70B9\u51FB\u6309\u5347\u5E8F\u6392\u5E8F"}`;
|
|
6501
|
-
return /* @__PURE__ */
|
|
6502
|
-
/* @__PURE__ */
|
|
6503
|
-
/* @__PURE__ */
|
|
6562
|
+
return /* @__PURE__ */ jsxs22("span", { className: "sia-table__sortable-header", children: [
|
|
6563
|
+
/* @__PURE__ */ jsx24("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
|
|
6564
|
+
/* @__PURE__ */ jsx24(
|
|
6504
6565
|
"button",
|
|
6505
6566
|
{
|
|
6506
6567
|
type: "button",
|
|
@@ -6512,9 +6573,9 @@ function createSortPlugin(options = {}) {
|
|
|
6512
6573
|
event.stopPropagation();
|
|
6513
6574
|
cycle(field, context);
|
|
6514
6575
|
},
|
|
6515
|
-
children: order ? /* @__PURE__ */
|
|
6516
|
-
/* @__PURE__ */
|
|
6517
|
-
/* @__PURE__ */
|
|
6576
|
+
children: order ? /* @__PURE__ */ jsx24(Icon, { name: order === "ascend" ? "chevron-up" : "chevron-down", size: 18 }) : /* @__PURE__ */ jsxs22(Fragment7, { children: [
|
|
6577
|
+
/* @__PURE__ */ jsx24(Icon, { name: "chevron-up", size: 11 }),
|
|
6578
|
+
/* @__PURE__ */ jsx24(Icon, { name: "chevron-down", size: 11 })
|
|
6518
6579
|
] })
|
|
6519
6580
|
}
|
|
6520
6581
|
)
|
|
@@ -6549,27 +6610,27 @@ function TableFilterControl({
|
|
|
6549
6610
|
placeholder,
|
|
6550
6611
|
onApply
|
|
6551
6612
|
}) {
|
|
6552
|
-
const [open, setOpen] =
|
|
6553
|
-
const [draft, setDraft] =
|
|
6613
|
+
const [open, setOpen] = useState20(false);
|
|
6614
|
+
const [draft, setDraft] = useState20(value);
|
|
6554
6615
|
const label = getColumnLabel(column);
|
|
6555
|
-
|
|
6616
|
+
useEffect13(() => {
|
|
6556
6617
|
if (open) setDraft(value);
|
|
6557
6618
|
}, [open, value]);
|
|
6558
6619
|
const apply = (nextValue) => {
|
|
6559
6620
|
onApply(nextValue.trim());
|
|
6560
6621
|
setOpen(false);
|
|
6561
6622
|
};
|
|
6562
|
-
return /* @__PURE__ */
|
|
6563
|
-
/* @__PURE__ */
|
|
6564
|
-
/* @__PURE__ */
|
|
6623
|
+
return /* @__PURE__ */ jsxs22("span", { className: "sia-table__filter-header", children: [
|
|
6624
|
+
/* @__PURE__ */ jsx24("span", { children: column.title ?? column.name ?? column.key }),
|
|
6625
|
+
/* @__PURE__ */ jsx24(
|
|
6565
6626
|
Popover,
|
|
6566
6627
|
{
|
|
6567
6628
|
open,
|
|
6568
6629
|
onOpenChange: setOpen,
|
|
6569
6630
|
placement: "bottom-end",
|
|
6570
6631
|
overlayClassName: "sia-table-filter-popover",
|
|
6571
|
-
content: /* @__PURE__ */
|
|
6572
|
-
/* @__PURE__ */
|
|
6632
|
+
content: /* @__PURE__ */ jsxs22("div", { className: "sia-table-filter-panel", children: [
|
|
6633
|
+
/* @__PURE__ */ jsx24(
|
|
6573
6634
|
Input,
|
|
6574
6635
|
{
|
|
6575
6636
|
size: "small",
|
|
@@ -6583,8 +6644,8 @@ function TableFilterControl({
|
|
|
6583
6644
|
}
|
|
6584
6645
|
}
|
|
6585
6646
|
),
|
|
6586
|
-
/* @__PURE__ */
|
|
6587
|
-
/* @__PURE__ */
|
|
6647
|
+
/* @__PURE__ */ jsxs22("div", { className: "sia-table-filter-panel__actions", children: [
|
|
6648
|
+
/* @__PURE__ */ jsx24(
|
|
6588
6649
|
Button,
|
|
6589
6650
|
{
|
|
6590
6651
|
size: "small",
|
|
@@ -6596,7 +6657,7 @@ function TableFilterControl({
|
|
|
6596
6657
|
children: "\u6E05\u9664"
|
|
6597
6658
|
}
|
|
6598
6659
|
),
|
|
6599
|
-
/* @__PURE__ */
|
|
6660
|
+
/* @__PURE__ */ jsx24(
|
|
6600
6661
|
Button,
|
|
6601
6662
|
{
|
|
6602
6663
|
size: "small",
|
|
@@ -6607,7 +6668,7 @@ function TableFilterControl({
|
|
|
6607
6668
|
)
|
|
6608
6669
|
] })
|
|
6609
6670
|
] }),
|
|
6610
|
-
children: /* @__PURE__ */
|
|
6671
|
+
children: /* @__PURE__ */ jsx24(
|
|
6611
6672
|
"button",
|
|
6612
6673
|
{
|
|
6613
6674
|
type: "button",
|
|
@@ -6615,7 +6676,7 @@ function TableFilterControl({
|
|
|
6615
6676
|
"aria-label": `\u7B5B\u9009${label}`,
|
|
6616
6677
|
"aria-pressed": Boolean(value),
|
|
6617
6678
|
onClick: (event) => event.stopPropagation(),
|
|
6618
|
-
children: /* @__PURE__ */
|
|
6679
|
+
children: /* @__PURE__ */ jsx24(Icon, { name: "search", size: 13 })
|
|
6619
6680
|
}
|
|
6620
6681
|
)
|
|
6621
6682
|
}
|
|
@@ -6677,7 +6738,7 @@ function createFilterPlugin(options = {}) {
|
|
|
6677
6738
|
title: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title
|
|
6678
6739
|
};
|
|
6679
6740
|
const placeholder = typeof options.placeholder === "function" ? options.placeholder(currentColumn) : options.placeholder ?? `\u8F93\u5165${getColumnLabel(currentColumn)}\u7B5B\u9009`;
|
|
6680
|
-
return /* @__PURE__ */
|
|
6741
|
+
return /* @__PURE__ */ jsx24(
|
|
6681
6742
|
TableFilterControl,
|
|
6682
6743
|
{
|
|
6683
6744
|
column: renderedColumn,
|
|
@@ -6766,7 +6827,7 @@ function createPaginationPlugin(options = {}) {
|
|
|
6766
6827
|
const page = currentPage(context);
|
|
6767
6828
|
const filteredCount = context.getPluginApi("filter")?.getFilteredRows().length;
|
|
6768
6829
|
const totalRecords = options.totalCount ?? filteredCount ?? context.sourceData.length;
|
|
6769
|
-
return /* @__PURE__ */
|
|
6830
|
+
return /* @__PURE__ */ jsx24(
|
|
6770
6831
|
Pagination,
|
|
6771
6832
|
{
|
|
6772
6833
|
className: "sia-table__pagination",
|
|
@@ -6904,19 +6965,19 @@ function createTreePlugin(options = {}) {
|
|
|
6904
6965
|
return {
|
|
6905
6966
|
...column,
|
|
6906
6967
|
...options.showLine ? { ellipsis: false, meta: { ...column.meta, treeLines: true } } : {},
|
|
6907
|
-
render: (value, record, index, info) => /* @__PURE__ */
|
|
6968
|
+
render: (value, record, index, info) => /* @__PURE__ */ jsxs22(
|
|
6908
6969
|
"span",
|
|
6909
6970
|
{
|
|
6910
6971
|
className: `sia-table__tree-cell${options.showLine ? " sia-table__tree-cell--lines" : ""}`,
|
|
6911
6972
|
style: options.showLine ? void 0 : { paddingLeft: info.row.depth * 18 },
|
|
6912
6973
|
children: [
|
|
6913
|
-
options.showLine && info.row.depth > 0 && /* @__PURE__ */
|
|
6914
|
-
info.row.meta.treeGuides.map((continued, level) => /* @__PURE__ */
|
|
6915
|
-
/* @__PURE__ */
|
|
6974
|
+
options.showLine && info.row.depth > 0 && /* @__PURE__ */ jsxs22(Fragment7, { children: [
|
|
6975
|
+
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)),
|
|
6976
|
+
/* @__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" : ""}` })
|
|
6916
6977
|
] }),
|
|
6917
|
-
/* @__PURE__ */
|
|
6918
|
-
options.showLine && !!info.row.meta.treeHasChildren && current(context).includes(info.row.key) && /* @__PURE__ */
|
|
6919
|
-
info.row.meta.treeHasChildren ? /* @__PURE__ */
|
|
6978
|
+
/* @__PURE__ */ jsxs22("span", { className: options.showLine ? "sia-table__tree-node" : void 0, style: options.showLine ? void 0 : { display: "contents" }, children: [
|
|
6979
|
+
options.showLine && !!info.row.meta.treeHasChildren && current(context).includes(info.row.key) && /* @__PURE__ */ jsx24("span", { "aria-hidden": "true", className: "sia-table__tree-stem" }),
|
|
6980
|
+
info.row.meta.treeHasChildren ? /* @__PURE__ */ jsx24(
|
|
6920
6981
|
"button",
|
|
6921
6982
|
{
|
|
6922
6983
|
type: "button",
|
|
@@ -6927,7 +6988,7 @@ function createTreePlugin(options = {}) {
|
|
|
6927
6988
|
event.stopPropagation();
|
|
6928
6989
|
toggle(info.row.key, context);
|
|
6929
6990
|
},
|
|
6930
|
-
children: /* @__PURE__ */
|
|
6991
|
+
children: /* @__PURE__ */ jsx24(
|
|
6931
6992
|
Icon,
|
|
6932
6993
|
{
|
|
6933
6994
|
name: current(context).includes(info.row.key) ? "chevron-down" : "chevron-right",
|
|
@@ -6935,7 +6996,7 @@ function createTreePlugin(options = {}) {
|
|
|
6935
6996
|
}
|
|
6936
6997
|
)
|
|
6937
6998
|
}
|
|
6938
|
-
) : /* @__PURE__ */
|
|
6999
|
+
) : /* @__PURE__ */ jsx24("span", { className: "sia-table__tree-placeholder" })
|
|
6939
7000
|
] }),
|
|
6940
7001
|
previousRender ? previousRender(value, record, index, info) : value
|
|
6941
7002
|
]
|
|
@@ -6990,8 +7051,8 @@ function EditableTableCell({
|
|
|
6990
7051
|
trigger
|
|
6991
7052
|
}) {
|
|
6992
7053
|
const config = typeof editable === "object" ? editable : { type: "input" };
|
|
6993
|
-
const [editValue, setEditValue] =
|
|
6994
|
-
const [saving, setSaving] =
|
|
7054
|
+
const [editValue, setEditValue] = useState20(value);
|
|
7055
|
+
const [saving, setSaving] = useState20(false);
|
|
6995
7056
|
const inputRef = useRef16(null);
|
|
6996
7057
|
const editorRef = useRef16(null);
|
|
6997
7058
|
const editValueRef = useRef16(value);
|
|
@@ -7000,7 +7061,7 @@ function EditableTableCell({
|
|
|
7000
7061
|
async () => {
|
|
7001
7062
|
}
|
|
7002
7063
|
);
|
|
7003
|
-
|
|
7064
|
+
useEffect13(() => {
|
|
7004
7065
|
if (!active) return;
|
|
7005
7066
|
editValueRef.current = value;
|
|
7006
7067
|
setEditValue(value);
|
|
@@ -7031,7 +7092,7 @@ function EditableTableCell({
|
|
|
7031
7092
|
}
|
|
7032
7093
|
}
|
|
7033
7094
|
saveRef.current = save;
|
|
7034
|
-
|
|
7095
|
+
useEffect13(() => {
|
|
7035
7096
|
if (!active || config.type === "select" || config.type === "custom") return;
|
|
7036
7097
|
const handleOutsidePointerDown = (event) => {
|
|
7037
7098
|
const target = event.target;
|
|
@@ -7047,15 +7108,15 @@ function EditableTableCell({
|
|
|
7047
7108
|
);
|
|
7048
7109
|
}, [active, config.type]);
|
|
7049
7110
|
if (!active)
|
|
7050
|
-
return /* @__PURE__ */
|
|
7111
|
+
return /* @__PURE__ */ jsxs22(
|
|
7051
7112
|
"div",
|
|
7052
7113
|
{
|
|
7053
7114
|
className: "sia-table__editable-display",
|
|
7054
7115
|
onClick: trigger === "click" ? onStart : void 0,
|
|
7055
7116
|
onDoubleClick: trigger === "doubleClick" ? onStart : void 0,
|
|
7056
7117
|
children: [
|
|
7057
|
-
/* @__PURE__ */
|
|
7058
|
-
/* @__PURE__ */
|
|
7118
|
+
/* @__PURE__ */ jsx24("span", { children: content }),
|
|
7119
|
+
/* @__PURE__ */ jsx24(Icon, { name: "edit", size: 13 })
|
|
7059
7120
|
]
|
|
7060
7121
|
}
|
|
7061
7122
|
);
|
|
@@ -7063,7 +7124,7 @@ function EditableTableCell({
|
|
|
7063
7124
|
if (config.type === "custom" && config.editRender) {
|
|
7064
7125
|
editor = config.editRender(record, (next) => void save(next), onCancel);
|
|
7065
7126
|
} else if (config.type === "inputNumber") {
|
|
7066
|
-
editor = /* @__PURE__ */
|
|
7127
|
+
editor = /* @__PURE__ */ jsx24(
|
|
7067
7128
|
InputNumber,
|
|
7068
7129
|
{
|
|
7069
7130
|
ref: inputRef,
|
|
@@ -7084,7 +7145,7 @@ function EditableTableCell({
|
|
|
7084
7145
|
}
|
|
7085
7146
|
);
|
|
7086
7147
|
} else if (config.type === "select") {
|
|
7087
|
-
editor = /* @__PURE__ */
|
|
7148
|
+
editor = /* @__PURE__ */ jsx24(
|
|
7088
7149
|
Select,
|
|
7089
7150
|
{
|
|
7090
7151
|
size: "small",
|
|
@@ -7098,14 +7159,14 @@ function EditableTableCell({
|
|
|
7098
7159
|
}
|
|
7099
7160
|
);
|
|
7100
7161
|
} else {
|
|
7101
|
-
editor = /* @__PURE__ */
|
|
7162
|
+
editor = /* @__PURE__ */ jsx24(
|
|
7102
7163
|
Input,
|
|
7103
7164
|
{
|
|
7104
7165
|
ref: inputRef,
|
|
7105
7166
|
size: "small",
|
|
7106
7167
|
value: String(editValue ?? ""),
|
|
7107
7168
|
disabled: saving,
|
|
7108
|
-
suffix: saving ? /* @__PURE__ */
|
|
7169
|
+
suffix: saving ? /* @__PURE__ */ jsx24(Icon, { name: "loader", size: 13, spin: true }) : null,
|
|
7109
7170
|
onChange: (event) => updateEditValue(event.target.value),
|
|
7110
7171
|
onBlur: () => void save(),
|
|
7111
7172
|
onKeyDown: (event) => {
|
|
@@ -7115,7 +7176,7 @@ function EditableTableCell({
|
|
|
7115
7176
|
}
|
|
7116
7177
|
);
|
|
7117
7178
|
}
|
|
7118
|
-
return /* @__PURE__ */
|
|
7179
|
+
return /* @__PURE__ */ jsx24("div", { ref: editorRef, className: "sia-table__editor", children: editor });
|
|
7119
7180
|
}
|
|
7120
7181
|
function createEditablePlugin(options = {}) {
|
|
7121
7182
|
const trigger = options.trigger ?? "click";
|
|
@@ -7135,7 +7196,7 @@ function createEditablePlugin(options = {}) {
|
|
|
7135
7196
|
const active = canEdit && context.state.editing?.rowKey === info.row.key && context.state.editing.columnKey === column.key;
|
|
7136
7197
|
const content = previousRender ? previousRender(value, record, index, info) : value;
|
|
7137
7198
|
if (!canEdit) return content;
|
|
7138
|
-
return /* @__PURE__ */
|
|
7199
|
+
return /* @__PURE__ */ jsx24(
|
|
7139
7200
|
EditableTableCell,
|
|
7140
7201
|
{
|
|
7141
7202
|
active,
|
|
@@ -7198,9 +7259,9 @@ function createResizePlugin(options = {}) {
|
|
|
7198
7259
|
...column,
|
|
7199
7260
|
autoWidth,
|
|
7200
7261
|
width,
|
|
7201
|
-
renderHeader: (currentColumn, coreContext) => /* @__PURE__ */
|
|
7202
|
-
/* @__PURE__ */
|
|
7203
|
-
/* @__PURE__ */
|
|
7262
|
+
renderHeader: (currentColumn, coreContext) => /* @__PURE__ */ jsxs22("span", { className: "sia-table__resizable-header", children: [
|
|
7263
|
+
/* @__PURE__ */ jsx24("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
|
|
7264
|
+
/* @__PURE__ */ jsx24(
|
|
7204
7265
|
"span",
|
|
7205
7266
|
{
|
|
7206
7267
|
className: "sia-table__resize-handle",
|
|
@@ -7336,15 +7397,15 @@ function ColumnSettingPanel({
|
|
|
7336
7397
|
onClose,
|
|
7337
7398
|
onApply
|
|
7338
7399
|
}) {
|
|
7339
|
-
const [draft, setDraft] =
|
|
7400
|
+
const [draft, setDraft] = useState20(items);
|
|
7340
7401
|
const listRef = useRef16(null);
|
|
7341
7402
|
const cancelDrag = useRef16(null);
|
|
7342
|
-
const [preview, setPreview] =
|
|
7343
|
-
|
|
7403
|
+
const [preview, setPreview] = useState20(null);
|
|
7404
|
+
useEffect13(() => {
|
|
7344
7405
|
cancelDrag.current?.();
|
|
7345
7406
|
if (open) setDraft(orderColumnSettings(items));
|
|
7346
7407
|
}, [items, open]);
|
|
7347
|
-
|
|
7408
|
+
useEffect13(() => () => cancelDrag.current?.(), []);
|
|
7348
7409
|
const labels = new Map(
|
|
7349
7410
|
flattenTableColumns(columns).map((column) => [
|
|
7350
7411
|
column.key,
|
|
@@ -7471,7 +7532,7 @@ function ColumnSettingPanel({
|
|
|
7471
7532
|
window.addEventListener("blur", cancel);
|
|
7472
7533
|
frame = requestAnimationFrame(tick);
|
|
7473
7534
|
}
|
|
7474
|
-
return /* @__PURE__ */
|
|
7535
|
+
return /* @__PURE__ */ jsxs22(
|
|
7475
7536
|
Drawer2,
|
|
7476
7537
|
{
|
|
7477
7538
|
open,
|
|
@@ -7480,9 +7541,9 @@ function ColumnSettingPanel({
|
|
|
7480
7541
|
onOpenChange: (next) => {
|
|
7481
7542
|
if (!next) onClose();
|
|
7482
7543
|
},
|
|
7483
|
-
footer: /* @__PURE__ */
|
|
7484
|
-
/* @__PURE__ */
|
|
7485
|
-
/* @__PURE__ */
|
|
7544
|
+
footer: /* @__PURE__ */ jsxs22(Fragment7, { children: [
|
|
7545
|
+
/* @__PURE__ */ jsx24(Button, { onClick: onClose, children: "\u53D6\u6D88" }),
|
|
7546
|
+
/* @__PURE__ */ jsx24(
|
|
7486
7547
|
Button,
|
|
7487
7548
|
{
|
|
7488
7549
|
variant: "primary",
|
|
@@ -7493,19 +7554,19 @@ function ColumnSettingPanel({
|
|
|
7493
7554
|
)
|
|
7494
7555
|
] }),
|
|
7495
7556
|
children: [
|
|
7496
|
-
loadError ? /* @__PURE__ */
|
|
7557
|
+
loadError ? /* @__PURE__ */ jsxs22("p", { role: "alert", children: [
|
|
7497
7558
|
"\u8BFB\u53D6\u5217\u914D\u7F6E\u5931\u8D25\u3002",
|
|
7498
|
-
/* @__PURE__ */
|
|
7559
|
+
/* @__PURE__ */ jsx24(Button, { variant: "link", onClick: onRetry, children: "\u91CD\u8BD5" })
|
|
7499
7560
|
] }) : null,
|
|
7500
|
-
/* @__PURE__ */
|
|
7561
|
+
/* @__PURE__ */ jsx24(Spin, { spinning: Boolean(loading), className: "sia-table-settings__loading", "aria-label": loading ? "\u6B63\u5728\u8BFB\u53D6\u5217\u914D\u7F6E" : void 0, children: /* @__PURE__ */ jsxs22(
|
|
7501
7562
|
"fieldset",
|
|
7502
7563
|
{
|
|
7503
7564
|
disabled: loading || loadError,
|
|
7504
7565
|
style: { border: 0, padding: 0, margin: 0, minWidth: 0 },
|
|
7505
7566
|
"aria-busy": loading,
|
|
7506
7567
|
children: [
|
|
7507
|
-
/* @__PURE__ */
|
|
7508
|
-
/* @__PURE__ */
|
|
7568
|
+
/* @__PURE__ */ jsxs22("label", { className: "sia-table-settings__all", children: [
|
|
7569
|
+
/* @__PURE__ */ jsx24(
|
|
7509
7570
|
TableCheckbox,
|
|
7510
7571
|
{
|
|
7511
7572
|
label: "\u5168\u9009\u5217",
|
|
@@ -7516,7 +7577,7 @@ function ColumnSettingPanel({
|
|
|
7516
7577
|
)
|
|
7517
7578
|
}
|
|
7518
7579
|
),
|
|
7519
|
-
/* @__PURE__ */
|
|
7580
|
+
/* @__PURE__ */ jsxs22("span", { children: [
|
|
7520
7581
|
"\u5168\u9009\uFF08",
|
|
7521
7582
|
visibleCount,
|
|
7522
7583
|
"/",
|
|
@@ -7524,12 +7585,12 @@ function ColumnSettingPanel({
|
|
|
7524
7585
|
"\uFF09"
|
|
7525
7586
|
] })
|
|
7526
7587
|
] }),
|
|
7527
|
-
/* @__PURE__ */
|
|
7588
|
+
/* @__PURE__ */ jsx24(
|
|
7528
7589
|
"div",
|
|
7529
7590
|
{
|
|
7530
7591
|
ref: listRef,
|
|
7531
7592
|
className: `sia-table-settings__list${preview ? " is-sorting" : ""}`,
|
|
7532
|
-
children: draft.map((item) => /* @__PURE__ */
|
|
7593
|
+
children: draft.map((item) => /* @__PURE__ */ jsxs22(
|
|
7533
7594
|
"div",
|
|
7534
7595
|
{
|
|
7535
7596
|
"data-column-key": item.key,
|
|
@@ -7539,8 +7600,8 @@ function ColumnSettingPanel({
|
|
|
7539
7600
|
} : void 0,
|
|
7540
7601
|
onPointerDown: (event) => startSort(event, item.key),
|
|
7541
7602
|
children: [
|
|
7542
|
-
/* @__PURE__ */
|
|
7543
|
-
/* @__PURE__ */
|
|
7603
|
+
/* @__PURE__ */ jsx24(Icon, { name: "menu", size: 15 }),
|
|
7604
|
+
/* @__PURE__ */ jsx24(
|
|
7544
7605
|
TableCheckbox,
|
|
7545
7606
|
{
|
|
7546
7607
|
label: `\u663E\u793A${labels.get(item.key) ?? item.key}\u5217`,
|
|
@@ -7552,15 +7613,15 @@ function ColumnSettingPanel({
|
|
|
7552
7613
|
)
|
|
7553
7614
|
}
|
|
7554
7615
|
),
|
|
7555
|
-
/* @__PURE__ */
|
|
7616
|
+
/* @__PURE__ */ jsx24(
|
|
7556
7617
|
"span",
|
|
7557
7618
|
{
|
|
7558
7619
|
className: "sia-table-settings__name",
|
|
7559
7620
|
children: labels.get(item.key) ?? item.key
|
|
7560
7621
|
}
|
|
7561
7622
|
),
|
|
7562
|
-
/* @__PURE__ */
|
|
7563
|
-
/* @__PURE__ */
|
|
7623
|
+
/* @__PURE__ */ jsxs22("div", { className: "sia-table-settings__actions", children: [
|
|
7624
|
+
/* @__PURE__ */ jsx24(
|
|
7564
7625
|
Button,
|
|
7565
7626
|
{
|
|
7566
7627
|
size: "small",
|
|
@@ -7573,7 +7634,7 @@ function ColumnSettingPanel({
|
|
|
7573
7634
|
children: "\u5DE6"
|
|
7574
7635
|
}
|
|
7575
7636
|
),
|
|
7576
|
-
/* @__PURE__ */
|
|
7637
|
+
/* @__PURE__ */ jsx24(
|
|
7577
7638
|
Button,
|
|
7578
7639
|
{
|
|
7579
7640
|
size: "small",
|
|
@@ -7723,7 +7784,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
7723
7784
|
{
|
|
7724
7785
|
key: "builtin:export",
|
|
7725
7786
|
label: "\u8868\u683C\u5BFC\u51FA",
|
|
7726
|
-
icon: /* @__PURE__ */
|
|
7787
|
+
icon: /* @__PURE__ */ jsx24(Icon, { name: "download", size: 18 }),
|
|
7727
7788
|
disabled: exportApi().getRows().length === 0
|
|
7728
7789
|
},
|
|
7729
7790
|
{ key: "builtin:divider", type: "divider" }
|
|
@@ -7731,7 +7792,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
7731
7792
|
{
|
|
7732
7793
|
key: "builtin:columns",
|
|
7733
7794
|
label: "\u5217\u8BBE\u7F6E",
|
|
7734
|
-
icon: /* @__PURE__ */
|
|
7795
|
+
icon: /* @__PURE__ */ jsx24(Icon, { name: "settings", size: 18 })
|
|
7735
7796
|
},
|
|
7736
7797
|
...customItems.map((item) => ({
|
|
7737
7798
|
key: "custom:" + item.key,
|
|
@@ -7743,7 +7804,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
7743
7804
|
disabled: item.disabled === true || typeof item.disabled === "function" && item.disabled(context)
|
|
7744
7805
|
}))
|
|
7745
7806
|
];
|
|
7746
|
-
return /* @__PURE__ */
|
|
7807
|
+
return /* @__PURE__ */ jsx24(
|
|
7747
7808
|
Dropdown,
|
|
7748
7809
|
{
|
|
7749
7810
|
disabled: options.buttonProps?.disabled || options.buttonProps?.loading,
|
|
@@ -7760,12 +7821,12 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
7760
7821
|
void customItems.find((item) => "custom:" + item.key === key)?.onClick?.(context);
|
|
7761
7822
|
}
|
|
7762
7823
|
},
|
|
7763
|
-
children: /* @__PURE__ */
|
|
7824
|
+
children: /* @__PURE__ */ jsx24(
|
|
7764
7825
|
Button,
|
|
7765
7826
|
{
|
|
7766
7827
|
size: "small",
|
|
7767
7828
|
variant: "text",
|
|
7768
|
-
icon: /* @__PURE__ */
|
|
7829
|
+
icon: /* @__PURE__ */ jsx24(Icon, { name: "settings", size: 16 }),
|
|
7769
7830
|
"aria-label": "\u8868\u683C\u8BBE\u7F6E",
|
|
7770
7831
|
...options.buttonProps,
|
|
7771
7832
|
className: `sia-table__settings-button${options.buttonProps?.children == null ? " sia-table__toolbar-icon" : ""} ${options.buttonProps?.className ?? ""}`.trim()
|
|
@@ -7774,7 +7835,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
7774
7835
|
}
|
|
7775
7836
|
);
|
|
7776
7837
|
},
|
|
7777
|
-
renderOverlay: (context) => /* @__PURE__ */
|
|
7838
|
+
renderOverlay: (context) => /* @__PURE__ */ jsx24(
|
|
7778
7839
|
ColumnSettingPanel,
|
|
7779
7840
|
{
|
|
7780
7841
|
open: context.state.open,
|
|
@@ -7824,11 +7885,11 @@ function ToolbarItems({
|
|
|
7824
7885
|
items,
|
|
7825
7886
|
context
|
|
7826
7887
|
}) {
|
|
7827
|
-
return /* @__PURE__ */
|
|
7888
|
+
return /* @__PURE__ */ jsx24(Fragment7, { children: items.map((item) => {
|
|
7828
7889
|
if (item.hidden === true || typeof item.hidden === "function" && item.hidden(context))
|
|
7829
7890
|
return null;
|
|
7830
7891
|
const disabled = item.disabled === true || typeof item.disabled === "function" && item.disabled(context);
|
|
7831
|
-
return /* @__PURE__ */
|
|
7892
|
+
return /* @__PURE__ */ jsx24(
|
|
7832
7893
|
Button,
|
|
7833
7894
|
{
|
|
7834
7895
|
size: "small",
|
|
@@ -7851,16 +7912,16 @@ function createToolbarPlugin(options) {
|
|
|
7851
7912
|
return {
|
|
7852
7913
|
id: "toolbar",
|
|
7853
7914
|
order: 5,
|
|
7854
|
-
renderToolbarStart: (context) => /* @__PURE__ */
|
|
7915
|
+
renderToolbarStart: (context) => /* @__PURE__ */ jsxs22(Fragment7, { children: [
|
|
7855
7916
|
options.start,
|
|
7856
|
-
/* @__PURE__ */
|
|
7917
|
+
/* @__PURE__ */ jsx24(ToolbarItems, { items: items("start"), context })
|
|
7857
7918
|
] }),
|
|
7858
|
-
renderToolbarEnd: (context) => /* @__PURE__ */
|
|
7919
|
+
renderToolbarEnd: (context) => /* @__PURE__ */ jsxs22(Fragment7, { children: [
|
|
7859
7920
|
options.end,
|
|
7860
|
-
/* @__PURE__ */
|
|
7861
|
-
items("end", true).length > 0 ? /* @__PURE__ */
|
|
7862
|
-
/* @__PURE__ */
|
|
7863
|
-
/* @__PURE__ */
|
|
7921
|
+
/* @__PURE__ */ jsx24(ToolbarItems, { items: items("end"), context }),
|
|
7922
|
+
items("end", true).length > 0 ? /* @__PURE__ */ jsxs22("details", { className: "sia-table__toolbar-menu", children: [
|
|
7923
|
+
/* @__PURE__ */ jsx24("summary", { "aria-label": "\u66F4\u591A\u8868\u683C\u64CD\u4F5C", children: /* @__PURE__ */ jsx24(Icon, { name: "more-horizontal", size: 16 }) }),
|
|
7924
|
+
/* @__PURE__ */ jsx24("div", { children: /* @__PURE__ */ jsx24(ToolbarItems, { items: items("end", true), context }) })
|
|
7864
7925
|
] }) : null
|
|
7865
7926
|
] })
|
|
7866
7927
|
};
|
|
@@ -7942,11 +8003,11 @@ function createExportPlugin(options = {}) {
|
|
|
7942
8003
|
return {
|
|
7943
8004
|
id: "export",
|
|
7944
8005
|
order: 95,
|
|
7945
|
-
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */
|
|
8006
|
+
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */ jsx24(
|
|
7946
8007
|
Button,
|
|
7947
8008
|
{
|
|
7948
8009
|
size: "small",
|
|
7949
|
-
icon: /* @__PURE__ */
|
|
8010
|
+
icon: /* @__PURE__ */ jsx24(Icon, { name: "download", size: 14 }),
|
|
7950
8011
|
disabled: getRows(context).length === 0,
|
|
7951
8012
|
onClick: () => void download(context),
|
|
7952
8013
|
children: options.buttonLabel ?? "\u5BFC\u51FA"
|
|
@@ -7961,7 +8022,7 @@ function createExportPlugin(options = {}) {
|
|
|
7961
8022
|
}
|
|
7962
8023
|
|
|
7963
8024
|
// src/components/Table/Table.tsx
|
|
7964
|
-
import { jsx as
|
|
8025
|
+
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7965
8026
|
var EMPTY_DATA = [];
|
|
7966
8027
|
var EMPTY_COLUMNS = [];
|
|
7967
8028
|
var EMPTY_PLUGINS = [];
|
|
@@ -8075,7 +8136,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8075
8136
|
onCellPointerDown,
|
|
8076
8137
|
onCellPointerMove
|
|
8077
8138
|
}) {
|
|
8078
|
-
return /* @__PURE__ */
|
|
8139
|
+
return /* @__PURE__ */ jsx25(
|
|
8079
8140
|
"tr",
|
|
8080
8141
|
{
|
|
8081
8142
|
"data-canvas-row-index": canvas ? rowIndex : void 0,
|
|
@@ -8090,7 +8151,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8090
8151
|
if (columnIndex > 0 && !visibleColumns.has(columns[columnIndex - 1].key)) return null;
|
|
8091
8152
|
let count = 1;
|
|
8092
8153
|
while (columnIndex + count < columns.length && !visibleColumns.has(columns[columnIndex + count].key)) count++;
|
|
8093
|
-
return /* @__PURE__ */
|
|
8154
|
+
return /* @__PURE__ */ jsx25("td", { colSpan: count, "aria-hidden": "true", style: { padding: 0 } }, `spacer-${column.key}`);
|
|
8094
8155
|
}
|
|
8095
8156
|
const pluginCellProps = getCellProps(column);
|
|
8096
8157
|
if (pluginCellProps.hidden) return null;
|
|
@@ -8100,7 +8161,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8100
8161
|
const fixedStyle = fixed === "left" ? { left: leftOffsets.get(column.key) } : fixed === "right" ? { right: rightOffsets.get(column.key) } : void 0;
|
|
8101
8162
|
const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
8102
8163
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
8103
|
-
return /* @__PURE__ */
|
|
8164
|
+
return /* @__PURE__ */ jsx25(
|
|
8104
8165
|
"td",
|
|
8105
8166
|
{
|
|
8106
8167
|
"data-column-key": column.key,
|
|
@@ -8116,7 +8177,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8116
8177
|
onContextMenu: (event) => onCellContextMenu(column, event),
|
|
8117
8178
|
onPointerDown: (event) => onCellPointerDown(column, event),
|
|
8118
8179
|
onPointerMove: (event) => onCellPointerMove(column, event),
|
|
8119
|
-
children: !canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? /* @__PURE__ */
|
|
8180
|
+
children: !canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? /* @__PURE__ */ jsx25(
|
|
8120
8181
|
TableCellContent,
|
|
8121
8182
|
{
|
|
8122
8183
|
ellipsis: column.ellipsis !== false,
|
|
@@ -8161,6 +8222,7 @@ function TableInner(props, ref) {
|
|
|
8161
8222
|
onRowDoubleClick,
|
|
8162
8223
|
onCellContextMenu,
|
|
8163
8224
|
rowClassName,
|
|
8225
|
+
rowStatus,
|
|
8164
8226
|
tableStyle,
|
|
8165
8227
|
className = "",
|
|
8166
8228
|
style,
|
|
@@ -8172,13 +8234,13 @@ function TableInner(props, ref) {
|
|
|
8172
8234
|
const tableRef = useRef17(null);
|
|
8173
8235
|
useScrollbarProximity();
|
|
8174
8236
|
const scrollbarDragRef = useRef17(null);
|
|
8175
|
-
const [internalLoading, setInternalLoading] =
|
|
8176
|
-
const [scrollTop, setScrollTop] =
|
|
8177
|
-
const [scrollLeft, setScrollLeft] =
|
|
8178
|
-
const [viewportHeight, setViewportHeight] =
|
|
8179
|
-
const [viewportWidth, setViewportWidth] =
|
|
8180
|
-
const [autoColumnWidths, setAutoColumnWidths] =
|
|
8181
|
-
const [resolveRowIdentity] =
|
|
8237
|
+
const [internalLoading, setInternalLoading] = useState21(false);
|
|
8238
|
+
const [scrollTop, setScrollTop] = useState21(0);
|
|
8239
|
+
const [scrollLeft, setScrollLeft] = useState21(0);
|
|
8240
|
+
const [viewportHeight, setViewportHeight] = useState21(420);
|
|
8241
|
+
const [viewportWidth, setViewportWidth] = useState21(0);
|
|
8242
|
+
const [autoColumnWidths, setAutoColumnWidths] = useState21({});
|
|
8243
|
+
const [resolveRowIdentity] = useState21(createRowIdentity);
|
|
8182
8244
|
const getRowKey = useCallback2((record, index) => resolveRowIdentity(record, index, typeof rowKey === "function" ? rowKey : rowKey == null ? void 0 : String(rowKey)), [rowKey, resolveRowIdentity]);
|
|
8183
8245
|
const builtInResizePlugin = useMemo9(() => createResizePlugin(), []);
|
|
8184
8246
|
const builtInHighlightPlugin = useMemo9(() => createHighlightPlugin(), []);
|
|
@@ -8195,7 +8257,7 @@ function TableInner(props, ref) {
|
|
|
8195
8257
|
const sortedPlugins = useMemo9(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
|
|
8196
8258
|
const pluginsByIdRef = useRef17(/* @__PURE__ */ new Map());
|
|
8197
8259
|
pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
8198
|
-
const [pluginStates, setPluginStates] =
|
|
8260
|
+
const [pluginStates, setPluginStates] = useState21(() => Object.fromEntries(
|
|
8199
8261
|
sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
|
|
8200
8262
|
));
|
|
8201
8263
|
const pluginApisRef = useRef17({});
|
|
@@ -8257,7 +8319,7 @@ function TableInner(props, ref) {
|
|
|
8257
8319
|
});
|
|
8258
8320
|
pluginApisRef.current = nextApis;
|
|
8259
8321
|
contextsRef.current = contexts;
|
|
8260
|
-
|
|
8322
|
+
useEffect14(() => {
|
|
8261
8323
|
const activePlugins2 = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
8262
8324
|
for (const [pluginId, mounted] of mountedPluginsRef.current) {
|
|
8263
8325
|
if (activePlugins2.get(pluginId) === mounted.plugin) continue;
|
|
@@ -8269,7 +8331,7 @@ function TableInner(props, ref) {
|
|
|
8269
8331
|
mountedPluginsRef.current.set(plugin.id, { plugin, cleanup: plugin.onMount(contextsRef.current.get(plugin.id)) });
|
|
8270
8332
|
}
|
|
8271
8333
|
}, [sortedPlugins]);
|
|
8272
|
-
|
|
8334
|
+
useEffect14(() => () => {
|
|
8273
8335
|
for (const mounted of mountedPluginsRef.current.values()) mounted.cleanup?.();
|
|
8274
8336
|
mountedPluginsRef.current.clear();
|
|
8275
8337
|
}, []);
|
|
@@ -8313,7 +8375,7 @@ function TableInner(props, ref) {
|
|
|
8313
8375
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-size", `${verticalThumb}px`);
|
|
8314
8376
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-position", `${verticalPosition}px`);
|
|
8315
8377
|
}, []);
|
|
8316
|
-
|
|
8378
|
+
useEffect14(() => {
|
|
8317
8379
|
const element = scrollRef.current;
|
|
8318
8380
|
if (!element || typeof ResizeObserver === "undefined") return;
|
|
8319
8381
|
const observer = new ResizeObserver(() => {
|
|
@@ -8326,7 +8388,7 @@ function TableInner(props, ref) {
|
|
|
8326
8388
|
updateScrollMetrics();
|
|
8327
8389
|
return () => observer.disconnect();
|
|
8328
8390
|
}, [updateScrollMetrics]);
|
|
8329
|
-
|
|
8391
|
+
useEffect14(() => {
|
|
8330
8392
|
updateScrollMetrics();
|
|
8331
8393
|
});
|
|
8332
8394
|
const orderedColumns = useMemo9(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
|
|
@@ -8334,11 +8396,11 @@ function TableInner(props, ref) {
|
|
|
8334
8396
|
const headerRows = useMemo9(() => buildHeaderRows(orderedColumns), [orderedColumns]);
|
|
8335
8397
|
const measuredCells = useRef17(/* @__PURE__ */ new WeakSet());
|
|
8336
8398
|
const autoWidthSignature = leafColumns.map((column) => `${column.key}:${column.autoWidth}:${resizedWidths[column.key] ?? ""}`).join("|");
|
|
8337
|
-
|
|
8399
|
+
useEffect14(() => {
|
|
8338
8400
|
measuredCells.current = /* @__PURE__ */ new WeakSet();
|
|
8339
8401
|
setAutoColumnWidths({});
|
|
8340
8402
|
}, [dataSource, baseColumns, size, autoWidthSignature]);
|
|
8341
|
-
|
|
8403
|
+
useEffect14(() => {
|
|
8342
8404
|
const autoWidthColumns = leafColumns.filter((column) => column.autoWidth && resizedWidths[column.key] === void 0);
|
|
8343
8405
|
const root = rootRef.current;
|
|
8344
8406
|
if (!root || autoWidthColumns.length === 0) return;
|
|
@@ -8432,6 +8494,7 @@ function TableInner(props, ref) {
|
|
|
8432
8494
|
rowHeight,
|
|
8433
8495
|
striped,
|
|
8434
8496
|
rowClassName,
|
|
8497
|
+
rowStatus,
|
|
8435
8498
|
getRowKey,
|
|
8436
8499
|
canvas,
|
|
8437
8500
|
scrollLeft,
|
|
@@ -8441,20 +8504,20 @@ function TableInner(props, ref) {
|
|
|
8441
8504
|
]);
|
|
8442
8505
|
const toolbarStart = sortedPlugins.map((plugin) => {
|
|
8443
8506
|
const content = plugin.renderToolbarStart?.(getContext(plugin));
|
|
8444
|
-
return content ? /* @__PURE__ */
|
|
8507
|
+
return content ? /* @__PURE__ */ jsx25(Fragment8, { children: content }, `toolbar-start-${plugin.id}`) : null;
|
|
8445
8508
|
}).filter(Boolean);
|
|
8446
8509
|
const toolbarEnd = sortedPlugins.map((plugin) => {
|
|
8447
8510
|
const content = plugin.renderToolbarEnd?.(getContext(plugin));
|
|
8448
|
-
return content ? /* @__PURE__ */
|
|
8511
|
+
return content ? /* @__PURE__ */ jsx25(Fragment8, { children: content }, `toolbar-end-${plugin.id}`) : null;
|
|
8449
8512
|
}).filter(Boolean);
|
|
8450
8513
|
const summaries = sortedPlugins.flatMap((plugin) => plugin.renderSummary?.(getContext(plugin)) ?? []);
|
|
8451
8514
|
const footers = sortedPlugins.map((plugin) => {
|
|
8452
8515
|
const content = plugin.renderFooter?.(getContext(plugin));
|
|
8453
|
-
return content ? /* @__PURE__ */
|
|
8516
|
+
return content ? /* @__PURE__ */ jsx25(Fragment8, { children: content }, `footer-${plugin.id}`) : null;
|
|
8454
8517
|
}).filter(Boolean);
|
|
8455
8518
|
const overlays = sortedPlugins.map((plugin) => {
|
|
8456
8519
|
const content = plugin.renderOverlay?.(getContext(plugin));
|
|
8457
|
-
return content ? /* @__PURE__ */
|
|
8520
|
+
return content ? /* @__PURE__ */ jsx25(Fragment8, { children: content }, `overlay-${plugin.id}`) : null;
|
|
8458
8521
|
}).filter(Boolean);
|
|
8459
8522
|
const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
|
|
8460
8523
|
const effectiveHeight = height ?? tableHeight ?? remainingHeight ?? (shouldVirtualize ? 420 : void 0);
|
|
@@ -8553,9 +8616,9 @@ function TableInner(props, ref) {
|
|
|
8553
8616
|
}
|
|
8554
8617
|
function renderHeaderContent(column, content) {
|
|
8555
8618
|
const title = getHeaderTitleText(column.title ?? column.name) || column.name || column.key;
|
|
8556
|
-
return /* @__PURE__ */
|
|
8557
|
-
/* @__PURE__ */
|
|
8558
|
-
column.description != null && /* @__PURE__ */
|
|
8619
|
+
return /* @__PURE__ */ jsxs23("span", { className: "sia-table__header-label", children: [
|
|
8620
|
+
/* @__PURE__ */ jsx25("span", { className: "sia-table__header-label-content", "data-sia-title-overflow-only": true, ...withTitleTooltip({ title }), children: content }),
|
|
8621
|
+
column.description != null && /* @__PURE__ */ jsx25(Tooltip, { title: column.description, placement: "top", trigger: ["hover", "focus"], children: /* @__PURE__ */ jsx25("button", { type: "button", className: "sia-table__header-description", "aria-label": `${column.name ?? column.key}\u5217\u8BF4\u660E`, onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx25(Icon, { name: "info", size: 14 }) }) })
|
|
8559
8622
|
] });
|
|
8560
8623
|
}
|
|
8561
8624
|
function getPluginCellProps(row, column) {
|
|
@@ -8595,17 +8658,17 @@ function TableInner(props, ref) {
|
|
|
8595
8658
|
}
|
|
8596
8659
|
function renderSummaryRow(summary) {
|
|
8597
8660
|
let labelRendered = false;
|
|
8598
|
-
return /* @__PURE__ */
|
|
8661
|
+
return /* @__PURE__ */ jsx25("tr", { className: `sia-table__summary-row ${summary.className ?? ""}`.trim(), children: leafColumns.map((column) => {
|
|
8599
8662
|
const value = summary.values[column.key];
|
|
8600
8663
|
const isLabel = value === void 0 && !labelRendered && summary.label !== void 0;
|
|
8601
8664
|
const content = value !== void 0 ? value : isLabel ? (labelRendered = true, summary.label) : null;
|
|
8602
8665
|
const fixed = normalizeFixed(column.fixed);
|
|
8603
8666
|
const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
8604
8667
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
8605
|
-
return /* @__PURE__ */
|
|
8668
|
+
return /* @__PURE__ */ jsx25("td", { "data-column-key": column.key, className: `sia-table__cell sia-table__cell--${column.align ?? "left"} sia-table__summary-cell${isLabel ? " sia-table__summary-cell--label" : ""}${fixed ? ` sia-table__cell--fixed sia-table__cell--fixed-${fixed}` : ""}${fixedEdgeClass}${autoWidthClass}`, style: getFixedStyle(column), children: isLabel ? /* @__PURE__ */ jsx25("span", { className: "sia-table__summary-label", children: content }) : content }, column.key);
|
|
8606
8669
|
}) }, summary.key);
|
|
8607
8670
|
}
|
|
8608
|
-
return /* @__PURE__ */
|
|
8671
|
+
return /* @__PURE__ */ jsxs23(
|
|
8609
8672
|
"div",
|
|
8610
8673
|
{
|
|
8611
8674
|
ref: rootRef,
|
|
@@ -8656,19 +8719,19 @@ function TableInner(props, ref) {
|
|
|
8656
8719
|
htmlProps.onDoubleClickCapture?.(event);
|
|
8657
8720
|
},
|
|
8658
8721
|
children: [
|
|
8659
|
-
hasToolbar ? /* @__PURE__ */
|
|
8660
|
-
/* @__PURE__ */
|
|
8661
|
-
/* @__PURE__ */
|
|
8722
|
+
hasToolbar ? /* @__PURE__ */ jsxs23("div", { className: "sia-table__toolbar", children: [
|
|
8723
|
+
/* @__PURE__ */ jsx25("div", { children: toolbarStart }),
|
|
8724
|
+
/* @__PURE__ */ jsx25("div", { children: toolbarEnd })
|
|
8662
8725
|
] }) : null,
|
|
8663
|
-
/* @__PURE__ */
|
|
8664
|
-
/* @__PURE__ */
|
|
8665
|
-
/* @__PURE__ */
|
|
8666
|
-
/* @__PURE__ */
|
|
8726
|
+
/* @__PURE__ */ jsxs23("div", { className: "sia-table__viewport-wrap", children: [
|
|
8727
|
+
/* @__PURE__ */ jsx25("div", { className: "sia-table__viewport", ref: scrollRef, onScroll: handleScroll, children: /* @__PURE__ */ jsxs23("table", { ref: tableRef, className: "sia-table__element", style: { width: Math.max(totalWidth, 1), ...manualColumnLayout ? { minWidth: 0 } : {}, ...tableStyle }, children: [
|
|
8728
|
+
/* @__PURE__ */ jsx25("colgroup", { children: leafColumns.map((column) => /* @__PURE__ */ jsx25("col", { "data-column-key": column.key, style: { width: columnWidths.get(column.key) ?? DEFAULT_WIDTH } }, column.key)) }),
|
|
8729
|
+
/* @__PURE__ */ jsx25("thead", { className: stickyHeader ? "sia-table__head sia-table__head--sticky" : "sia-table__head", children: headerRows.map((headerRow, depth) => /* @__PURE__ */ jsx25("tr", { children: headerRow.map((cell) => {
|
|
8667
8730
|
const fixed = cell.fixed;
|
|
8668
8731
|
const pluginHeaderProps = getPluginHeaderCellProps(cell.column);
|
|
8669
8732
|
const fixedEdgeClass = fixed === "left" && cell.column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && cell.column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
8670
8733
|
const autoWidthClass = cell.column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
8671
|
-
return /* @__PURE__ */
|
|
8734
|
+
return /* @__PURE__ */ jsx25(
|
|
8672
8735
|
"th",
|
|
8673
8736
|
{
|
|
8674
8737
|
"data-column-key": cell.column.key,
|
|
@@ -8689,16 +8752,18 @@ function TableInner(props, ref) {
|
|
|
8689
8752
|
`${cell.column.key}-${depth}-${cell.firstLeafKey}`
|
|
8690
8753
|
);
|
|
8691
8754
|
}) }, depth)) }),
|
|
8692
|
-
/* @__PURE__ */
|
|
8693
|
-
pipeline.rows.length === 0 && summaries.length > 0 ? /* @__PURE__ */
|
|
8694
|
-
topSpacer > 0 ? /* @__PURE__ */
|
|
8755
|
+
/* @__PURE__ */ jsxs23("tbody", { children: [
|
|
8756
|
+
pipeline.rows.length === 0 && summaries.length > 0 ? /* @__PURE__ */ jsx25("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx25("td", { colSpan: leafColumns.length, style: { height: Math.max(0, viewportHeight - (headerRows.length + summaries.length) * rowHeight), padding: 0, border: 0 } }) }) : null,
|
|
8757
|
+
topSpacer > 0 ? /* @__PURE__ */ jsx25("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx25("td", { colSpan: leafColumns.length, style: { height: topSpacer, padding: 0, border: 0 } }) }) : null,
|
|
8695
8758
|
renderedRows.map((row, offset) => {
|
|
8696
8759
|
const cached = rowElements.get(row.key);
|
|
8697
8760
|
if (cached) return cached;
|
|
8698
8761
|
const rowIndex = startIndex + offset;
|
|
8699
8762
|
const pluginClasses = sortedPlugins.map((plugin) => plugin.getRowClassName?.(row, getContext(plugin))).filter(Boolean).join(" ");
|
|
8763
|
+
const status = typeof rowStatus === "function" ? rowStatus(row.record, row.sourceIndex) : rowStatus;
|
|
8764
|
+
const statusClass = status ? `sia-table__row--${status}` : "";
|
|
8700
8765
|
const customClass = typeof rowClassName === "function" ? rowClassName(row.record, row.sourceIndex) : rowClassName ?? "";
|
|
8701
|
-
const element = /* @__PURE__ */
|
|
8766
|
+
const element = /* @__PURE__ */ jsx25(
|
|
8702
8767
|
TableBodyRow,
|
|
8703
8768
|
{
|
|
8704
8769
|
canvas,
|
|
@@ -8712,7 +8777,7 @@ function TableInner(props, ref) {
|
|
|
8712
8777
|
rightFixedEdgeKey,
|
|
8713
8778
|
striped,
|
|
8714
8779
|
rowHeight,
|
|
8715
|
-
className: `${pluginClasses} ${customClass}`.trim(),
|
|
8780
|
+
className: `${statusClass} ${pluginClasses} ${customClass}`.trim(),
|
|
8716
8781
|
onClick: () => {
|
|
8717
8782
|
for (const plugin of sortedPlugins) plugin.onRowClick?.(row, getContext(plugin));
|
|
8718
8783
|
onRowClick?.(row.record, row.sourceIndex);
|
|
@@ -8749,13 +8814,13 @@ function TableInner(props, ref) {
|
|
|
8749
8814
|
rowElements.set(row.key, element);
|
|
8750
8815
|
return element;
|
|
8751
8816
|
}),
|
|
8752
|
-
bottomSpacer > 0 ? /* @__PURE__ */
|
|
8817
|
+
bottomSpacer > 0 ? /* @__PURE__ */ jsx25("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx25("td", { colSpan: leafColumns.length, style: { height: bottomSpacer, padding: 0, border: 0 } }) }) : null
|
|
8753
8818
|
] }),
|
|
8754
|
-
summaries.length > 0 ? /* @__PURE__ */
|
|
8819
|
+
summaries.length > 0 ? /* @__PURE__ */ jsx25("tfoot", { className: "sia-table__summary", children: summaries.map(renderSummaryRow) }) : null
|
|
8755
8820
|
] }) }),
|
|
8756
|
-
pipeline.rows.length === 0 ? /* @__PURE__ */
|
|
8757
|
-
canvas ? /* @__PURE__ */
|
|
8758
|
-
/* @__PURE__ */
|
|
8821
|
+
pipeline.rows.length === 0 ? /* @__PURE__ */ jsx25("div", { className: "sia-table__empty", role: "status", children: emptyText }) : null,
|
|
8822
|
+
canvas ? /* @__PURE__ */ jsx25(TableCanvasLayer, { viewport: scrollRef, rows: pipeline.rows, columns: leafColumns, widths: columnWidths, rowHeight, headerHeight: headerRows.length * rowHeight }) : null,
|
|
8823
|
+
/* @__PURE__ */ jsx25(
|
|
8759
8824
|
"div",
|
|
8760
8825
|
{
|
|
8761
8826
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--horizontal",
|
|
@@ -8766,10 +8831,10 @@ function TableInner(props, ref) {
|
|
|
8766
8831
|
onPointerMove: handleScrollbarPointerMove,
|
|
8767
8832
|
onPointerUp: handleScrollbarPointerEnd,
|
|
8768
8833
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
8769
|
-
children: /* @__PURE__ */
|
|
8834
|
+
children: /* @__PURE__ */ jsx25("div", { className: "sia-table__scrollbar-thumb" })
|
|
8770
8835
|
}
|
|
8771
8836
|
),
|
|
8772
|
-
/* @__PURE__ */
|
|
8837
|
+
/* @__PURE__ */ jsx25(
|
|
8773
8838
|
"div",
|
|
8774
8839
|
{
|
|
8775
8840
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--vertical",
|
|
@@ -8780,14 +8845,14 @@ function TableInner(props, ref) {
|
|
|
8780
8845
|
onPointerMove: handleScrollbarPointerMove,
|
|
8781
8846
|
onPointerUp: handleScrollbarPointerEnd,
|
|
8782
8847
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
8783
|
-
children: /* @__PURE__ */
|
|
8848
|
+
children: /* @__PURE__ */ jsx25("div", { className: "sia-table__scrollbar-thumb" })
|
|
8784
8849
|
}
|
|
8785
8850
|
)
|
|
8786
8851
|
] }),
|
|
8787
|
-
footers.length > 0 ? /* @__PURE__ */
|
|
8788
|
-
loading || internalLoading ? /* @__PURE__ */
|
|
8789
|
-
/* @__PURE__ */
|
|
8790
|
-
/* @__PURE__ */
|
|
8852
|
+
footers.length > 0 ? /* @__PURE__ */ jsx25("div", { className: "sia-table__footer", children: footers }) : null,
|
|
8853
|
+
loading || internalLoading ? /* @__PURE__ */ jsxs23("div", { className: "sia-table__loading", role: "status", children: [
|
|
8854
|
+
/* @__PURE__ */ jsx25(Icon, { name: "loader", size: 22, spin: true }),
|
|
8855
|
+
/* @__PURE__ */ jsx25("span", { children: "\u52A0\u8F7D\u4E2D" })
|
|
8791
8856
|
] }) : null,
|
|
8792
8857
|
overlays
|
|
8793
8858
|
]
|
|
@@ -8798,7 +8863,7 @@ var Table = forwardRef5(TableInner);
|
|
|
8798
8863
|
|
|
8799
8864
|
// src/components/ThemeSwitch.tsx
|
|
8800
8865
|
import { forwardRef as forwardRef6 } from "react";
|
|
8801
|
-
import { jsx as
|
|
8866
|
+
import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
8802
8867
|
var ThemeSwitch = forwardRef6(function ThemeSwitch2({
|
|
8803
8868
|
checked,
|
|
8804
8869
|
onCheckedChange,
|
|
@@ -8812,7 +8877,7 @@ var ThemeSwitch = forwardRef6(function ThemeSwitch2({
|
|
|
8812
8877
|
onCheckedChange?.(!checked);
|
|
8813
8878
|
onClick?.(event);
|
|
8814
8879
|
}
|
|
8815
|
-
return /* @__PURE__ */
|
|
8880
|
+
return /* @__PURE__ */ jsxs24(
|
|
8816
8881
|
"button",
|
|
8817
8882
|
{
|
|
8818
8883
|
ref,
|
|
@@ -8824,12 +8889,12 @@ var ThemeSwitch = forwardRef6(function ThemeSwitch2({
|
|
|
8824
8889
|
onClick: handleClick,
|
|
8825
8890
|
...withTitleTooltip(props),
|
|
8826
8891
|
children: [
|
|
8827
|
-
/* @__PURE__ */
|
|
8828
|
-
/* @__PURE__ */
|
|
8829
|
-
/* @__PURE__ */
|
|
8830
|
-
/* @__PURE__ */
|
|
8892
|
+
/* @__PURE__ */ jsx26("span", { className: "sia-theme-switch__selection", "aria-hidden": "true" }),
|
|
8893
|
+
/* @__PURE__ */ jsx26("span", { className: `sia-theme-switch__icon${checked ? "" : " is-active"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxs24("svg", { viewBox: "0 0 24 24", children: [
|
|
8894
|
+
/* @__PURE__ */ jsx26("circle", { cx: "12", cy: "12", r: "3.5" }),
|
|
8895
|
+
/* @__PURE__ */ jsx26("path", { d: "M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M18.7 5.3l-1.4 1.4M6.7 17.3l-1.4 1.4" })
|
|
8831
8896
|
] }) }),
|
|
8832
|
-
/* @__PURE__ */
|
|
8897
|
+
/* @__PURE__ */ jsx26("span", { className: `sia-theme-switch__icon${checked ? " is-active" : ""}`, "aria-hidden": "true", children: /* @__PURE__ */ jsx26("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx26("path", { d: "M20 15.2A8 8 0 0 1 8.8 4 8.5 8.5 0 1 0 20 15.2Z" }) }) })
|
|
8833
8898
|
]
|
|
8834
8899
|
}
|
|
8835
8900
|
);
|
|
@@ -8872,8 +8937,8 @@ function applySiaTheme(mode, target = document.documentElement) {
|
|
|
8872
8937
|
}
|
|
8873
8938
|
|
|
8874
8939
|
// src/components/InputSelect.tsx
|
|
8875
|
-
import { forwardRef as forwardRef7, useEffect as
|
|
8876
|
-
import { jsx as
|
|
8940
|
+
import { forwardRef as forwardRef7, useEffect as useEffect15, useRef as useRef18, useState as useState22 } from "react";
|
|
8941
|
+
import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
8877
8942
|
var InputSelect = forwardRef7(function InputSelect2({
|
|
8878
8943
|
options,
|
|
8879
8944
|
value,
|
|
@@ -8900,19 +8965,19 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8900
8965
|
...inputProps
|
|
8901
8966
|
}, forwardedRef) {
|
|
8902
8967
|
const size = useControlSize(sizeProp);
|
|
8903
|
-
const [internal, setInternal] =
|
|
8968
|
+
const [internal, setInternal] = useState22(defaultValue);
|
|
8904
8969
|
const current = value !== void 0 ? value : internal;
|
|
8905
8970
|
const values = current == null ? [] : Array.isArray(current) ? current : [current];
|
|
8906
8971
|
const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
|
|
8907
|
-
const [draft, setDraft] =
|
|
8908
|
-
|
|
8972
|
+
const [draft, setDraft] = useState22(text);
|
|
8973
|
+
useEffect15(() => {
|
|
8909
8974
|
setDraft(text);
|
|
8910
8975
|
}, [text, current]);
|
|
8911
|
-
const [open, setOpen] =
|
|
8912
|
-
const [search, setSearch] =
|
|
8913
|
-
const [modalOpen, setModalOpen] =
|
|
8914
|
-
const [modalValues, setModalValues] =
|
|
8915
|
-
const [selectedOnly, setSelectedOnly] =
|
|
8976
|
+
const [open, setOpen] = useState22(false);
|
|
8977
|
+
const [search, setSearch] = useState22("");
|
|
8978
|
+
const [modalOpen, setModalOpen] = useState22(false);
|
|
8979
|
+
const [modalValues, setModalValues] = useState22([]);
|
|
8980
|
+
const [selectedOnly, setSelectedOnly] = useState22(false);
|
|
8916
8981
|
const rootRef = useRef18(null);
|
|
8917
8982
|
const popupRef = useRef18(null);
|
|
8918
8983
|
const inputRef = useRef18(null);
|
|
@@ -8935,7 +9000,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8935
9000
|
inputRef.current?.focus();
|
|
8936
9001
|
}
|
|
8937
9002
|
}
|
|
8938
|
-
|
|
9003
|
+
useEffect15(() => {
|
|
8939
9004
|
if (!open) return;
|
|
8940
9005
|
const outside = (event) => {
|
|
8941
9006
|
if (!rootRef.current?.contains(event.target) && !popupRef.current?.contains(event.target)) changeOpen(false);
|
|
@@ -8943,7 +9008,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8943
9008
|
document.addEventListener("pointerdown", outside);
|
|
8944
9009
|
return () => document.removeEventListener("pointerdown", outside);
|
|
8945
9010
|
}, [open, onOpenChange]);
|
|
8946
|
-
|
|
9011
|
+
useEffect15(() => {
|
|
8947
9012
|
if (disabled || loading) {
|
|
8948
9013
|
changeOpen(false);
|
|
8949
9014
|
setModalOpen(false);
|
|
@@ -8956,14 +9021,14 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8956
9021
|
setSelectedOnly(false);
|
|
8957
9022
|
setModalOpen(true);
|
|
8958
9023
|
}
|
|
8959
|
-
return /* @__PURE__ */
|
|
9024
|
+
return /* @__PURE__ */ jsxs25("div", { ref: rootRef, style, className: `sia-input-select${open || modalOpen ? " is-open" : ""} ${className}`, onKeyDown: (event) => {
|
|
8960
9025
|
if (event.key === "Escape" && open) {
|
|
8961
9026
|
event.stopPropagation();
|
|
8962
9027
|
changeOpen(false);
|
|
8963
9028
|
inputRef.current?.focus();
|
|
8964
9029
|
}
|
|
8965
9030
|
}, children: [
|
|
8966
|
-
/* @__PURE__ */
|
|
9031
|
+
/* @__PURE__ */ jsx27(
|
|
8967
9032
|
Input,
|
|
8968
9033
|
{
|
|
8969
9034
|
...inputProps,
|
|
@@ -9000,26 +9065,26 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
9000
9065
|
emit(parseInput ? parseInput(next) : multiple ? next.split(",").map((item) => item.trim()).filter(Boolean) : next);
|
|
9001
9066
|
changeOpen(true);
|
|
9002
9067
|
},
|
|
9003
|
-
suffix: /* @__PURE__ */
|
|
9004
|
-
allowClear && draft && !disabled && /* @__PURE__ */
|
|
9068
|
+
suffix: /* @__PURE__ */ jsxs25("span", { className: "sia-input-select__suffix", children: [
|
|
9069
|
+
allowClear && draft && !disabled && /* @__PURE__ */ jsx27(Button, { className: "sia-input-select__clear", variant: "text", size: "small", disabled: loading, "aria-label": "\u6E05\u9664\u8F93\u5165\u9009\u62E9", onClick: (event) => {
|
|
9005
9070
|
event.stopPropagation();
|
|
9006
9071
|
setDraft("");
|
|
9007
9072
|
emit(multiple ? [] : void 0);
|
|
9008
9073
|
inputRef.current?.focus();
|
|
9009
9074
|
}, children: "\xD7" }),
|
|
9010
9075
|
suffix,
|
|
9011
|
-
enableModal && /* @__PURE__ */
|
|
9076
|
+
enableModal && /* @__PURE__ */ jsx27(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
|
|
9012
9077
|
event.stopPropagation();
|
|
9013
9078
|
openModal();
|
|
9014
9079
|
}, children: "\u2026" }),
|
|
9015
|
-
/* @__PURE__ */
|
|
9080
|
+
/* @__PURE__ */ jsx27(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
|
|
9016
9081
|
event.stopPropagation();
|
|
9017
9082
|
changeOpen(!open);
|
|
9018
|
-
}, children: /* @__PURE__ */
|
|
9083
|
+
}, children: /* @__PURE__ */ jsx27(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
|
|
9019
9084
|
] })
|
|
9020
9085
|
}
|
|
9021
9086
|
),
|
|
9022
|
-
/* @__PURE__ */
|
|
9087
|
+
/* @__PURE__ */ jsx27(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx27(
|
|
9023
9088
|
SelectionPanel,
|
|
9024
9089
|
{
|
|
9025
9090
|
options,
|
|
@@ -9034,7 +9099,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
9034
9099
|
onSearch: setSearch
|
|
9035
9100
|
}
|
|
9036
9101
|
) }),
|
|
9037
|
-
enableModal && /* @__PURE__ */
|
|
9102
|
+
enableModal && /* @__PURE__ */ jsxs25(
|
|
9038
9103
|
Modal,
|
|
9039
9104
|
{
|
|
9040
9105
|
open: modalOpen,
|
|
@@ -9047,15 +9112,15 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
9047
9112
|
setModalOpen(false);
|
|
9048
9113
|
},
|
|
9049
9114
|
children: [
|
|
9050
|
-
/* @__PURE__ */
|
|
9051
|
-
/* @__PURE__ */
|
|
9052
|
-
/* @__PURE__ */
|
|
9115
|
+
/* @__PURE__ */ jsxs25("div", { className: "sia-selection-panel__actions", role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
9116
|
+
/* @__PURE__ */ jsx27(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
9117
|
+
/* @__PURE__ */ jsxs25(Button, { role: "tab", "aria-selected": selectedOnly, variant: selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(true), children: [
|
|
9053
9118
|
"\u5DF2\u9009\u9879(",
|
|
9054
9119
|
modalValues.length,
|
|
9055
9120
|
")"
|
|
9056
9121
|
] })
|
|
9057
9122
|
] }),
|
|
9058
|
-
modalOpen && /* @__PURE__ */
|
|
9123
|
+
modalOpen && /* @__PURE__ */ jsx27(
|
|
9059
9124
|
SelectionPanel,
|
|
9060
9125
|
{
|
|
9061
9126
|
options,
|
|
@@ -9076,13 +9141,13 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
9076
9141
|
});
|
|
9077
9142
|
|
|
9078
9143
|
// src/components/QueryForm.tsx
|
|
9079
|
-
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect6, useRef as useRef21, useState as
|
|
9144
|
+
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect6, useRef as useRef21, useState as useState25 } from "react";
|
|
9080
9145
|
|
|
9081
9146
|
// src/components/QueryFormSettings.tsx
|
|
9082
|
-
import { useEffect as
|
|
9147
|
+
import { useEffect as useEffect17, useRef as useRef20, useState as useState24 } from "react";
|
|
9083
9148
|
|
|
9084
9149
|
// src/components/useQueryFieldSort.ts
|
|
9085
|
-
import { useEffect as
|
|
9150
|
+
import { useEffect as useEffect16, useRef as useRef19, useState as useState23 } from "react";
|
|
9086
9151
|
function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
9087
9152
|
const center = rects[from].top + rects[from].height / 2 + dy;
|
|
9088
9153
|
const rest = keys.map((_, index) => index).filter((index) => index !== from);
|
|
@@ -9105,9 +9170,9 @@ function useQueryFieldSort(keys, enabled, onCommit) {
|
|
|
9105
9170
|
const cancelRef = useRef19();
|
|
9106
9171
|
const commitRef = useRef19(onCommit);
|
|
9107
9172
|
commitRef.current = onCommit;
|
|
9108
|
-
const [preview, setPreview] =
|
|
9173
|
+
const [preview, setPreview] = useState23();
|
|
9109
9174
|
const signature = JSON.stringify(keys);
|
|
9110
|
-
|
|
9175
|
+
useEffect16(() => {
|
|
9111
9176
|
cancelRef.current?.();
|
|
9112
9177
|
return () => cancelRef.current?.();
|
|
9113
9178
|
}, [enabled, signature]);
|
|
@@ -9230,15 +9295,15 @@ function countQueryFieldRows(centers) {
|
|
|
9230
9295
|
}
|
|
9231
9296
|
|
|
9232
9297
|
// src/components/QueryFormSettings.tsx
|
|
9233
|
-
import { Fragment as Fragment9, jsx as
|
|
9298
|
+
import { Fragment as Fragment9, jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
9234
9299
|
function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed, disabled) {
|
|
9235
|
-
const [snapshot, setSnapshot] =
|
|
9236
|
-
const [draft, setDraft] =
|
|
9237
|
-
const [open, setOpen] =
|
|
9238
|
-
const [loading, setLoading] =
|
|
9239
|
-
const [saving, setSaving] =
|
|
9240
|
-
const [error, setError] =
|
|
9241
|
-
const [loadFailed, setLoadFailed] =
|
|
9300
|
+
const [snapshot, setSnapshot] = useState24();
|
|
9301
|
+
const [draft, setDraft] = useState24({ fields: [], defaultCollapsed: defaultCollapsed ?? false });
|
|
9302
|
+
const [open, setOpen] = useState24(false);
|
|
9303
|
+
const [loading, setLoading] = useState24(false);
|
|
9304
|
+
const [saving, setSaving] = useState24(false);
|
|
9305
|
+
const [error, setError] = useState24("");
|
|
9306
|
+
const [loadFailed, setLoadFailed] = useState24(false);
|
|
9242
9307
|
const token = useRef20(0);
|
|
9243
9308
|
const saveLock = useRef20(false);
|
|
9244
9309
|
const latest = useRef20({ config, fields, defaultCollapsed, applyCollapsed });
|
|
@@ -9269,7 +9334,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
9269
9334
|
if (request === token.current) setLoading(false);
|
|
9270
9335
|
}
|
|
9271
9336
|
}
|
|
9272
|
-
|
|
9337
|
+
useEffect17(() => {
|
|
9273
9338
|
setSnapshot(void 0);
|
|
9274
9339
|
setOpen(false);
|
|
9275
9340
|
setError("");
|
|
@@ -9324,7 +9389,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
9324
9389
|
const items = new Map(visibleDraft.map((item) => [item.key, item]));
|
|
9325
9390
|
setDraft((current) => ({ ...current, fields: keys.map((key, order) => ({ ...items.get(key), order })) }));
|
|
9326
9391
|
});
|
|
9327
|
-
const control = config ? /* @__PURE__ */
|
|
9392
|
+
const control = config ? /* @__PURE__ */ jsx28(
|
|
9328
9393
|
Button,
|
|
9329
9394
|
{
|
|
9330
9395
|
type: "button",
|
|
@@ -9333,16 +9398,16 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
9333
9398
|
"aria-label": "\u67E5\u8BE2\u8BBE\u7F6E",
|
|
9334
9399
|
disabled: disabled || saving,
|
|
9335
9400
|
loading: loading && !open,
|
|
9336
|
-
icon: /* @__PURE__ */
|
|
9401
|
+
icon: /* @__PURE__ */ jsx28(Icon, { name: "more-vertical" }),
|
|
9337
9402
|
onClick: () => {
|
|
9338
9403
|
setOpen(true);
|
|
9339
9404
|
void load(true);
|
|
9340
9405
|
}
|
|
9341
9406
|
}
|
|
9342
9407
|
) : null;
|
|
9343
|
-
const panel = config ? /* @__PURE__ */
|
|
9344
|
-
!open && error ? /* @__PURE__ */
|
|
9345
|
-
/* @__PURE__ */
|
|
9408
|
+
const panel = config ? /* @__PURE__ */ jsxs26(Fragment9, { children: [
|
|
9409
|
+
!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,
|
|
9410
|
+
/* @__PURE__ */ jsx28(
|
|
9346
9411
|
Modal,
|
|
9347
9412
|
{
|
|
9348
9413
|
title: "\u67E5\u8BE2\u8BBE\u7F6E",
|
|
@@ -9355,15 +9420,15 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
9355
9420
|
onOpenChange: (next) => {
|
|
9356
9421
|
if (!saveLock.current) setOpen(next);
|
|
9357
9422
|
},
|
|
9358
|
-
children: /* @__PURE__ */
|
|
9359
|
-
loading ? /* @__PURE__ */
|
|
9360
|
-
error ? /* @__PURE__ */
|
|
9423
|
+
children: /* @__PURE__ */ jsxs26("div", { className: "sia-query-settings", children: [
|
|
9424
|
+
loading ? /* @__PURE__ */ jsx28("p", { role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u67E5\u8BE2\u8BBE\u7F6E\u2026" }) : null,
|
|
9425
|
+
error ? /* @__PURE__ */ jsxs26("div", { role: "alert", className: "sia-query-form__error", children: [
|
|
9361
9426
|
error,
|
|
9362
|
-
loadFailed ? /* @__PURE__ */
|
|
9427
|
+
loadFailed ? /* @__PURE__ */ jsx28(Button, { type: "button", variant: "link", onClick: () => void load(true), children: "\u91CD\u8BD5" }) : null
|
|
9363
9428
|
] }) : null,
|
|
9364
|
-
/* @__PURE__ */
|
|
9365
|
-
/* @__PURE__ */
|
|
9366
|
-
/* @__PURE__ */
|
|
9429
|
+
/* @__PURE__ */ jsx28(Checkbox, { checked: draft.defaultCollapsed, disabled: locked, onChange: (checked) => setDraft((current) => ({ ...current, defaultCollapsed: checked })), children: "\u9ED8\u8BA4\u6536\u8D77\u67E5\u8BE2\u6761\u4EF6" }),
|
|
9430
|
+
/* @__PURE__ */ jsx28("p", { className: "sia-query-settings__hint", children: "\u52FE\u9009\u9700\u8981\u663E\u793A\u7684\u6761\u4EF6\uFF0C\u62D6\u52A8\u6216\u4F7F\u7528\u4E0A\u4E0B\u6309\u94AE\u8C03\u6574\u987A\u5E8F\u3002" }),
|
|
9431
|
+
/* @__PURE__ */ jsx28("div", { ref: sort.listRef, className: `sia-query-settings__list${sort.preview ? " is-sorting" : ""}`, children: visibleDraft.map((item, index) => /* @__PURE__ */ jsxs26(
|
|
9367
9432
|
"div",
|
|
9368
9433
|
{
|
|
9369
9434
|
"data-query-field-key": item.key,
|
|
@@ -9371,18 +9436,18 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
9371
9436
|
style: sort.preview ? { transform: `translateY(${sort.preview.offsets[item.key] ?? 0}px)` } : void 0,
|
|
9372
9437
|
onPointerDown: (event) => sort.start(event, item.key),
|
|
9373
9438
|
children: [
|
|
9374
|
-
/* @__PURE__ */
|
|
9375
|
-
/* @__PURE__ */
|
|
9376
|
-
/* @__PURE__ */
|
|
9377
|
-
/* @__PURE__ */
|
|
9378
|
-
/* @__PURE__ */
|
|
9379
|
-
/* @__PURE__ */
|
|
9439
|
+
/* @__PURE__ */ jsx28(Icon, { name: "menu", size: 15 }),
|
|
9440
|
+
/* @__PURE__ */ jsx28(Checkbox, { "aria-label": `\u663E\u793A ${item.key}`, checked: item.visible, disabled: locked, onChange: (checked) => setDraft((current) => ({ ...current, fields: visibleDraft.map((field) => field.key === item.key ? { ...field, visible: checked } : field) })) }),
|
|
9441
|
+
/* @__PURE__ */ jsx28("span", { className: "sia-query-settings__name", children: labels.get(item.key) ?? item.key }),
|
|
9442
|
+
/* @__PURE__ */ jsxs26("div", { className: "sia-query-settings__order", children: [
|
|
9443
|
+
/* @__PURE__ */ jsx28(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0A\u79FB ${item.key}`, disabled: locked || index === 0, icon: /* @__PURE__ */ jsx28(Icon, { name: "chevron-up" }), onClick: () => move(index, index - 1) }),
|
|
9444
|
+
/* @__PURE__ */ jsx28(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0B\u79FB ${item.key}`, disabled: locked || index === visibleDraft.length - 1, icon: /* @__PURE__ */ jsx28(Icon, { name: "chevron-down" }), onClick: () => move(index, index + 1) })
|
|
9380
9445
|
] })
|
|
9381
9446
|
]
|
|
9382
9447
|
},
|
|
9383
9448
|
item.key
|
|
9384
9449
|
)) }),
|
|
9385
|
-
/* @__PURE__ */
|
|
9450
|
+
/* @__PURE__ */ jsx28(Button, { type: "button", disabled: locked, onClick: () => setDraft({ fields: reconcileQueryFields(fields.map((field) => field.key)), defaultCollapsed: defaultCollapsed ?? false }), children: "\u6062\u590D\u9ED8\u8BA4" })
|
|
9386
9451
|
] })
|
|
9387
9452
|
}
|
|
9388
9453
|
)
|
|
@@ -9391,7 +9456,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
9391
9456
|
}
|
|
9392
9457
|
|
|
9393
9458
|
// src/components/QueryForm.tsx
|
|
9394
|
-
import { jsx as
|
|
9459
|
+
import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
9395
9460
|
function QueryForm({
|
|
9396
9461
|
fields,
|
|
9397
9462
|
settings,
|
|
@@ -9426,18 +9491,18 @@ function QueryForm({
|
|
|
9426
9491
|
...formProps
|
|
9427
9492
|
}) {
|
|
9428
9493
|
const [form] = useForm(providedForm);
|
|
9429
|
-
const [internalCollapsed, setInternalCollapsed] =
|
|
9430
|
-
const [expandedRows, setExpandedRows] =
|
|
9431
|
-
const [needsCollapse, setNeedsCollapse] =
|
|
9494
|
+
const [internalCollapsed, setInternalCollapsed] = useState25(defaultCollapsed);
|
|
9495
|
+
const [expandedRows, setExpandedRows] = useState25(0);
|
|
9496
|
+
const [needsCollapse, setNeedsCollapse] = useState25(false);
|
|
9432
9497
|
const collapsed = collapsible && needsCollapse && (controlledCollapsed ?? internalCollapsed ?? expandedRows >= 3);
|
|
9433
|
-
const [searching, setSearching] =
|
|
9434
|
-
const [saving, setSaving] =
|
|
9435
|
-
const [removing, setRemoving] =
|
|
9436
|
-
const [saveOpen, setSaveOpen] =
|
|
9437
|
-
const [saveName, setSaveName] =
|
|
9438
|
-
const [saveError, setSaveError] =
|
|
9439
|
-
const [error, setError] =
|
|
9440
|
-
const [activeShortcut, setActiveShortcut] =
|
|
9498
|
+
const [searching, setSearching] = useState25(false);
|
|
9499
|
+
const [saving, setSaving] = useState25(false);
|
|
9500
|
+
const [removing, setRemoving] = useState25(false);
|
|
9501
|
+
const [saveOpen, setSaveOpen] = useState25(false);
|
|
9502
|
+
const [saveName, setSaveName] = useState25("");
|
|
9503
|
+
const [saveError, setSaveError] = useState25("");
|
|
9504
|
+
const [error, setError] = useState25("");
|
|
9505
|
+
const [activeShortcut, setActiveShortcut] = useState25("");
|
|
9441
9506
|
const source = useRef21({ source: "submit" });
|
|
9442
9507
|
const searchLock = useRef21(false);
|
|
9443
9508
|
const saveLock = useRef21(false);
|
|
@@ -9453,7 +9518,7 @@ function QueryForm({
|
|
|
9453
9518
|
key,
|
|
9454
9519
|
width,
|
|
9455
9520
|
label: settingsLabel ?? item.label ?? (typeof item.children === "function" ? void 0 : fieldLabel(item.children)) ?? key,
|
|
9456
|
-
content: /* @__PURE__ */
|
|
9521
|
+
content: /* @__PURE__ */ jsx29(Form.Item, { noStyle: true, ...item })
|
|
9457
9522
|
})) : Children4.toArray(children).map((content, index) => ({
|
|
9458
9523
|
key: isValidElement5(content) && content.key != null ? String(content.key) : String(index),
|
|
9459
9524
|
width: void 0,
|
|
@@ -9470,8 +9535,8 @@ function QueryForm({
|
|
|
9470
9535
|
const rowRef = useRef21(null);
|
|
9471
9536
|
const actionsRef = useRef21(null);
|
|
9472
9537
|
const toggleRef = useRef21(null);
|
|
9473
|
-
const [fittingCount, setFittingCount] =
|
|
9474
|
-
const [settingsRows, setSettingsRows] =
|
|
9538
|
+
const [fittingCount, setFittingCount] = useState25(limit);
|
|
9539
|
+
const [settingsRows, setSettingsRows] = useState25(0);
|
|
9475
9540
|
useLayoutEffect6(() => {
|
|
9476
9541
|
const row = rowRef.current;
|
|
9477
9542
|
const actions = actionsRef.current;
|
|
@@ -9630,8 +9695,8 @@ function QueryForm({
|
|
|
9630
9695
|
setRemoving(false);
|
|
9631
9696
|
}
|
|
9632
9697
|
}
|
|
9633
|
-
return /* @__PURE__ */
|
|
9634
|
-
/* @__PURE__ */
|
|
9698
|
+
return /* @__PURE__ */ jsxs27("div", { className: `sia-query-form ${className}`.trim(), children: [
|
|
9699
|
+
/* @__PURE__ */ jsxs27(
|
|
9635
9700
|
Form,
|
|
9636
9701
|
{
|
|
9637
9702
|
...formProps,
|
|
@@ -9650,8 +9715,8 @@ function QueryForm({
|
|
|
9650
9715
|
onValuesChange?.(changed, values);
|
|
9651
9716
|
},
|
|
9652
9717
|
children: [
|
|
9653
|
-
quickQueries.length ? /* @__PURE__ */
|
|
9654
|
-
quickQueries.map((query) => /* @__PURE__ */
|
|
9718
|
+
quickQueries.length ? /* @__PURE__ */ jsxs27("div", { className: "sia-query-form__quick", "aria-label": "\u9884\u8BBE\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
9719
|
+
quickQueries.map((query) => /* @__PURE__ */ jsx29(
|
|
9655
9720
|
Badge,
|
|
9656
9721
|
{
|
|
9657
9722
|
className: "sia-query-form__quick-badge",
|
|
@@ -9660,7 +9725,7 @@ function QueryForm({
|
|
|
9660
9725
|
title: query.count === void 0 ? void 0 : `\u5171 ${query.count} \u6761`,
|
|
9661
9726
|
...query.badgeProps,
|
|
9662
9727
|
count: query.count,
|
|
9663
|
-
children: /* @__PURE__ */
|
|
9728
|
+
children: /* @__PURE__ */ jsx29(
|
|
9664
9729
|
Button,
|
|
9665
9730
|
{
|
|
9666
9731
|
size: query.size ?? quickQuerySize,
|
|
@@ -9676,7 +9741,7 @@ function QueryForm({
|
|
|
9676
9741
|
)),
|
|
9677
9742
|
" "
|
|
9678
9743
|
] }) : null,
|
|
9679
|
-
/* @__PURE__ */
|
|
9744
|
+
/* @__PURE__ */ jsxs27(
|
|
9680
9745
|
"div",
|
|
9681
9746
|
{
|
|
9682
9747
|
ref: rowRef,
|
|
@@ -9685,7 +9750,7 @@ function QueryForm({
|
|
|
9685
9750
|
"--sia-query-field-width": typeof fieldWidth === "number" ? `${fieldWidth}px` : fieldWidth
|
|
9686
9751
|
},
|
|
9687
9752
|
children: [
|
|
9688
|
-
entries.map((entry) => /* @__PURE__ */
|
|
9753
|
+
entries.map((entry) => /* @__PURE__ */ jsx29(
|
|
9689
9754
|
"div",
|
|
9690
9755
|
{
|
|
9691
9756
|
className: "sia-query-form__field",
|
|
@@ -9698,9 +9763,9 @@ function QueryForm({
|
|
|
9698
9763
|
},
|
|
9699
9764
|
entry.key
|
|
9700
9765
|
)),
|
|
9701
|
-
/* @__PURE__ */
|
|
9702
|
-
/* @__PURE__ */
|
|
9703
|
-
/* @__PURE__ */
|
|
9766
|
+
/* @__PURE__ */ jsxs27("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
|
|
9767
|
+
/* @__PURE__ */ jsxs27(Space.Compact, { children: [
|
|
9768
|
+
/* @__PURE__ */ jsx29(
|
|
9704
9769
|
Button,
|
|
9705
9770
|
{
|
|
9706
9771
|
type: "submit",
|
|
@@ -9710,8 +9775,8 @@ function QueryForm({
|
|
|
9710
9775
|
children: searchText
|
|
9711
9776
|
}
|
|
9712
9777
|
),
|
|
9713
|
-
/* @__PURE__ */
|
|
9714
|
-
onSaveQuery ? /* @__PURE__ */
|
|
9778
|
+
/* @__PURE__ */ jsx29(Button, { disabled: busy, onClick: reset, children: resetText }),
|
|
9779
|
+
onSaveQuery ? /* @__PURE__ */ jsx29(
|
|
9715
9780
|
Button,
|
|
9716
9781
|
{
|
|
9717
9782
|
disabled: shortcutBusy,
|
|
@@ -9726,12 +9791,12 @@ function QueryForm({
|
|
|
9726
9791
|
) : null,
|
|
9727
9792
|
showSettings ?? settingsRows > 2 ? cloudSettings.control : null
|
|
9728
9793
|
] }),
|
|
9729
|
-
collapsible && entries.length > 0 ? /* @__PURE__ */
|
|
9794
|
+
collapsible && entries.length > 0 ? /* @__PURE__ */ jsx29("span", { ref: toggleRef, hidden: !needsCollapse, children: /* @__PURE__ */ jsx29(
|
|
9730
9795
|
Button,
|
|
9731
9796
|
{
|
|
9732
9797
|
variant: "link",
|
|
9733
9798
|
"aria-expanded": !collapsed,
|
|
9734
|
-
icon: /* @__PURE__ */
|
|
9799
|
+
icon: /* @__PURE__ */ jsx29(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
|
|
9735
9800
|
iconPosition: "end",
|
|
9736
9801
|
onClick: () => {
|
|
9737
9802
|
setInternalCollapsed(!collapsed);
|
|
@@ -9746,8 +9811,8 @@ function QueryForm({
|
|
|
9746
9811
|
]
|
|
9747
9812
|
}
|
|
9748
9813
|
),
|
|
9749
|
-
savedQueries.length ? /* @__PURE__ */
|
|
9750
|
-
savedQueries.map((query, index) => /* @__PURE__ */
|
|
9814
|
+
savedQueries.length ? /* @__PURE__ */ jsxs27("div", { className: "sia-query-form__saved", "aria-label": "\u5DF2\u4FDD\u5B58\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
9815
|
+
savedQueries.map((query, index) => /* @__PURE__ */ jsx29(
|
|
9751
9816
|
Tag,
|
|
9752
9817
|
{
|
|
9753
9818
|
status: query.status ?? ["processing", "success", "warning", "error"][index % 4],
|
|
@@ -9773,11 +9838,11 @@ function QueryForm({
|
|
|
9773
9838
|
)),
|
|
9774
9839
|
" "
|
|
9775
9840
|
] }) : null,
|
|
9776
|
-
error ? /* @__PURE__ */
|
|
9841
|
+
error ? /* @__PURE__ */ jsx29("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
|
|
9777
9842
|
]
|
|
9778
9843
|
}
|
|
9779
9844
|
),
|
|
9780
|
-
/* @__PURE__ */
|
|
9845
|
+
/* @__PURE__ */ jsxs27(
|
|
9781
9846
|
Modal,
|
|
9782
9847
|
{
|
|
9783
9848
|
open: saveOpen,
|
|
@@ -9789,7 +9854,7 @@ function QueryForm({
|
|
|
9789
9854
|
if (!saveLock.current) setSaveOpen(next);
|
|
9790
9855
|
},
|
|
9791
9856
|
children: [
|
|
9792
|
-
/* @__PURE__ */
|
|
9857
|
+
/* @__PURE__ */ jsx29(
|
|
9793
9858
|
Input,
|
|
9794
9859
|
{
|
|
9795
9860
|
autoFocus: true,
|
|
@@ -9808,7 +9873,7 @@ function QueryForm({
|
|
|
9808
9873
|
}
|
|
9809
9874
|
}
|
|
9810
9875
|
),
|
|
9811
|
-
saveError ? /* @__PURE__ */
|
|
9876
|
+
saveError ? /* @__PURE__ */ jsx29("p", { className: "sia-query-form__error", role: "alert", children: saveError }) : null
|
|
9812
9877
|
]
|
|
9813
9878
|
}
|
|
9814
9879
|
)
|
|
@@ -9817,7 +9882,7 @@ function QueryForm({
|
|
|
9817
9882
|
|
|
9818
9883
|
// src/components/NumberRange.tsx
|
|
9819
9884
|
import { forwardRef as forwardRef8 } from "react";
|
|
9820
|
-
import { jsx as
|
|
9885
|
+
import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
9821
9886
|
var NumberRange = forwardRef8(function NumberRange2({
|
|
9822
9887
|
value,
|
|
9823
9888
|
defaultValue = [null, null],
|
|
@@ -9846,7 +9911,7 @@ var NumberRange = forwardRef8(function NumberRange2({
|
|
|
9846
9911
|
setValue2(index === 0 ? [next, range[1]] : [range[0], next]);
|
|
9847
9912
|
}
|
|
9848
9913
|
const inputProps = { min, max, step, precision, size, status, disabled, readOnly, placeholderMode, controls: false };
|
|
9849
|
-
return /* @__PURE__ */
|
|
9914
|
+
return /* @__PURE__ */ jsxs28(
|
|
9850
9915
|
"span",
|
|
9851
9916
|
{
|
|
9852
9917
|
...props,
|
|
@@ -9855,7 +9920,7 @@ var NumberRange = forwardRef8(function NumberRange2({
|
|
|
9855
9920
|
"aria-disabled": disabled || void 0,
|
|
9856
9921
|
className: `sia-number-range sia-number-range--${size} sia-number-range--${status}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
9857
9922
|
children: [
|
|
9858
|
-
/* @__PURE__ */
|
|
9923
|
+
/* @__PURE__ */ jsx30(
|
|
9859
9924
|
InputNumber,
|
|
9860
9925
|
{
|
|
9861
9926
|
...inputProps,
|
|
@@ -9867,8 +9932,8 @@ var NumberRange = forwardRef8(function NumberRange2({
|
|
|
9867
9932
|
onChange: (next) => change(0, next)
|
|
9868
9933
|
}
|
|
9869
9934
|
),
|
|
9870
|
-
/* @__PURE__ */
|
|
9871
|
-
/* @__PURE__ */
|
|
9935
|
+
/* @__PURE__ */ jsx30(Icon, { className: "sia-number-range__separator", name: "tilde", size: 12, strokeWidth: 1.5, "aria-hidden": "true" }),
|
|
9936
|
+
/* @__PURE__ */ jsx30(
|
|
9872
9937
|
InputNumber,
|
|
9873
9938
|
{
|
|
9874
9939
|
...inputProps,
|
|
@@ -9880,7 +9945,7 @@ var NumberRange = forwardRef8(function NumberRange2({
|
|
|
9880
9945
|
onChange: (next) => change(1, next)
|
|
9881
9946
|
}
|
|
9882
9947
|
),
|
|
9883
|
-
allowClear && !disabled && !readOnly && range.some((item) => item !== null) ? /* @__PURE__ */
|
|
9948
|
+
allowClear && !disabled && !readOnly && range.some((item) => item !== null) ? /* @__PURE__ */ jsx30("button", { type: "button", className: "sia-number-range__clear", "aria-label": "\u6E05\u9664\u6570\u5B57\u533A\u95F4", onClick: () => setValue2([null, null]), children: /* @__PURE__ */ jsx30(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null
|
|
9884
9949
|
]
|
|
9885
9950
|
}
|
|
9886
9951
|
);
|
|
@@ -9918,6 +9983,7 @@ export {
|
|
|
9918
9983
|
Col,
|
|
9919
9984
|
Collapse,
|
|
9920
9985
|
ColorPicker,
|
|
9986
|
+
CursorPreview,
|
|
9921
9987
|
DEFAULT_CHART_PALETTE,
|
|
9922
9988
|
DEFAULT_PAGE_SIZE_OPTIONS,
|
|
9923
9989
|
DatePicker,
|