@sia.soul/sia-react-ui 0.1.102 → 0.1.104
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-FOLNXKBD.js → chunk-D456SSL3.js} +1 -1
- package/dist/{chunk-KKU35MWK.js → chunk-EYB55TC5.js} +2 -2
- package/dist/{chunk-6KWMZ7JJ.js → chunk-X4OLHWC3.js} +1 -1
- package/dist/{core-BTmyjw4F.d.cts → core-DF7gei-P.d.cts} +3 -1
- package/dist/{core-Bn1emNZn.d.ts → core-_1K1jLyH.d.ts} +3 -1
- package/dist/core.css +140 -0
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +2 -2
- package/dist/index.cjs +3653 -3541
- package/dist/index.css +140 -0
- package/dist/index.d.cts +50 -5
- package/dist/index.d.ts +50 -5
- package/dist/index.js +818 -711
- package/dist/select-date-range.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
Watermark,
|
|
82
82
|
message,
|
|
83
83
|
notification
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-X4OLHWC3.js";
|
|
85
85
|
import {
|
|
86
86
|
MarkdownEditor
|
|
87
87
|
} from "./chunk-TUXNOSCT.js";
|
|
@@ -93,7 +93,7 @@ import {
|
|
|
93
93
|
DatePicker,
|
|
94
94
|
SelectDateRange,
|
|
95
95
|
TimePanel
|
|
96
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-D456SSL3.js";
|
|
97
97
|
import {
|
|
98
98
|
Checkbox,
|
|
99
99
|
FloatingScrollbarProvider,
|
|
@@ -105,7 +105,7 @@ import {
|
|
|
105
105
|
Tooltip,
|
|
106
106
|
Tree,
|
|
107
107
|
useScrollbarProximity
|
|
108
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-EYB55TC5.js";
|
|
109
109
|
import {
|
|
110
110
|
Dropdown,
|
|
111
111
|
FILLED_ICON_NAMES,
|
|
@@ -134,14 +134,118 @@ import {
|
|
|
134
134
|
withTitleTooltip
|
|
135
135
|
} from "./chunk-PUZWLIIJ.js";
|
|
136
136
|
|
|
137
|
-
// src/components/
|
|
138
|
-
import { useState } from "react";
|
|
137
|
+
// src/components/UtilityLayout.tsx
|
|
138
|
+
import { useEffect, useRef, useState } from "react";
|
|
139
|
+
import { createPortal } from "react-dom";
|
|
139
140
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
141
|
+
function AutoSizer({ children }) {
|
|
142
|
+
const ref = useRef(null);
|
|
143
|
+
const [size, setSize] = useState({ width: 0, height: 0 });
|
|
144
|
+
useEffect(() => {
|
|
145
|
+
const element = ref.current;
|
|
146
|
+
if (!element) return;
|
|
147
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
148
|
+
const { width, height } = entry.contentRect;
|
|
149
|
+
setSize((previous) => previous.width === width && previous.height === height ? previous : { width, height });
|
|
150
|
+
});
|
|
151
|
+
observer.observe(element);
|
|
152
|
+
return () => observer.disconnect();
|
|
153
|
+
}, []);
|
|
154
|
+
return /* @__PURE__ */ jsx("div", { className: "sia-auto-sizer", ref, children: /* @__PURE__ */ jsx("div", { className: "sia-auto-sizer__content", children: size.width > 0 && size.height > 0 ? children(size) : null }) });
|
|
155
|
+
}
|
|
156
|
+
function FloatingPanel({ open, title, children, placement = "bottomRight" }) {
|
|
157
|
+
if (!open || typeof document === "undefined") return null;
|
|
158
|
+
return createPortal(/* @__PURE__ */ jsxs("section", { className: `sia-floating-panel sia-floating-panel--${placement}`, "aria-label": title, role: "status", children: [
|
|
159
|
+
/* @__PURE__ */ jsx("strong", { className: "sia-floating-panel__title", children: title }),
|
|
160
|
+
children
|
|
161
|
+
] }), document.body);
|
|
162
|
+
}
|
|
163
|
+
function SortableList({ items, renderItem, onOrderChange, direction = "horizontal", disabled = false }) {
|
|
164
|
+
const [dragging, setDragging] = useState(null);
|
|
165
|
+
const [target, setTarget] = useState(null);
|
|
166
|
+
const clear = () => {
|
|
167
|
+
setDragging(null);
|
|
168
|
+
setTarget(null);
|
|
169
|
+
};
|
|
170
|
+
const move = (key, insertion) => {
|
|
171
|
+
const from = items.indexOf(key);
|
|
172
|
+
if (disabled || from < 0) return;
|
|
173
|
+
const to = Math.max(0, Math.min(items.length - 1, insertion > from ? insertion - 1 : insertion));
|
|
174
|
+
if (to === from) return;
|
|
175
|
+
const next = [...items];
|
|
176
|
+
next.splice(from, 1);
|
|
177
|
+
next.splice(to, 0, key);
|
|
178
|
+
onOrderChange(next);
|
|
179
|
+
};
|
|
180
|
+
useEffect(() => {
|
|
181
|
+
if (disabled || dragging !== null && !items.includes(dragging)) clear();
|
|
182
|
+
}, [disabled, dragging, items]);
|
|
183
|
+
return /* @__PURE__ */ jsx("div", { className: `sia-sortable-list sia-sortable-list--${direction}`, role: "list", onDragLeave: (event) => {
|
|
184
|
+
if (!event.currentTarget.contains(event.relatedTarget)) setTarget(null);
|
|
185
|
+
}, children: items.map((key, index) => /* @__PURE__ */ jsxs(
|
|
186
|
+
"div",
|
|
187
|
+
{
|
|
188
|
+
role: "listitem",
|
|
189
|
+
className: `sia-sortable-list__item${dragging === key ? " is-dragging" : ""}${target === index ? " is-drop-before" : ""}${target === items.length && index === items.length - 1 ? " is-drop-after" : ""}`,
|
|
190
|
+
onDragOver: (event) => {
|
|
191
|
+
if (disabled || dragging === null) return;
|
|
192
|
+
event.preventDefault();
|
|
193
|
+
event.dataTransfer.dropEffect = "move";
|
|
194
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
195
|
+
setTarget(index + (direction === "horizontal" ? Number(event.clientX > rect.left + rect.width / 2) : Number(event.clientY > rect.top + rect.height / 2)));
|
|
196
|
+
},
|
|
197
|
+
onDrop: (event) => {
|
|
198
|
+
if (dragging === null || disabled) return;
|
|
199
|
+
event.preventDefault();
|
|
200
|
+
if (target !== null) move(dragging, target);
|
|
201
|
+
clear();
|
|
202
|
+
},
|
|
203
|
+
children: [
|
|
204
|
+
/* @__PURE__ */ jsx(
|
|
205
|
+
"button",
|
|
206
|
+
{
|
|
207
|
+
type: "button",
|
|
208
|
+
className: "sia-sortable-list__handle",
|
|
209
|
+
draggable: !disabled,
|
|
210
|
+
disabled,
|
|
211
|
+
"aria-label": `\u8C03\u6574\u7B2C ${index + 1} \u9879\u987A\u5E8F`,
|
|
212
|
+
title: "\u62D6\u52A8\u6392\u5E8F\uFF0C\u6216\u4F7F\u7528\u65B9\u5411\u952E\u79FB\u52A8",
|
|
213
|
+
onDragStart: (event) => {
|
|
214
|
+
if (disabled) {
|
|
215
|
+
event.preventDefault();
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
setDragging(key);
|
|
219
|
+
event.dataTransfer.effectAllowed = "move";
|
|
220
|
+
event.dataTransfer.setData("text/plain", String(key));
|
|
221
|
+
},
|
|
222
|
+
onDragEnd: clear,
|
|
223
|
+
onKeyDown: (event) => {
|
|
224
|
+
const previous = direction === "horizontal" ? "ArrowLeft" : "ArrowUp";
|
|
225
|
+
const next = direction === "horizontal" ? "ArrowRight" : "ArrowDown";
|
|
226
|
+
if (event.key === previous || event.key === next) {
|
|
227
|
+
event.preventDefault();
|
|
228
|
+
move(key, event.key === previous ? index - 1 : index + 2);
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "menu", size: 16 })
|
|
232
|
+
}
|
|
233
|
+
),
|
|
234
|
+
renderItem(key, index)
|
|
235
|
+
]
|
|
236
|
+
},
|
|
237
|
+
key
|
|
238
|
+
)) });
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// src/components/Alert.tsx
|
|
242
|
+
import { useState as useState2 } from "react";
|
|
243
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
140
244
|
var alertIcons = {
|
|
141
|
-
info: /* @__PURE__ */
|
|
142
|
-
success: /* @__PURE__ */
|
|
143
|
-
warning: /* @__PURE__ */
|
|
144
|
-
error: /* @__PURE__ */
|
|
245
|
+
info: /* @__PURE__ */ jsx2(Icon, { name: "info", size: 20 }),
|
|
246
|
+
success: /* @__PURE__ */ jsx2(Icon, { name: "circle-check", size: 20 }),
|
|
247
|
+
warning: /* @__PURE__ */ jsx2(Icon, { name: "warning", size: 20 }),
|
|
248
|
+
error: /* @__PURE__ */ jsx2(Icon, { name: "circle-close", size: 20 })
|
|
145
249
|
};
|
|
146
250
|
function Alert({
|
|
147
251
|
status,
|
|
@@ -159,29 +263,29 @@ function Alert({
|
|
|
159
263
|
className = "",
|
|
160
264
|
...props
|
|
161
265
|
}) {
|
|
162
|
-
const [visible, setVisible] =
|
|
266
|
+
const [visible, setVisible] = useState2(true);
|
|
163
267
|
const resolvedStatus = status ?? type ?? (banner ? "warning" : "info");
|
|
164
268
|
const heading = message2 ?? title;
|
|
165
269
|
const hasHeading = heading != null && heading !== "" && typeof heading !== "boolean";
|
|
166
270
|
if (!visible) return null;
|
|
167
|
-
return /* @__PURE__ */
|
|
168
|
-
showIcon || banner ? /* @__PURE__ */
|
|
169
|
-
/* @__PURE__ */
|
|
170
|
-
hasHeading ? /* @__PURE__ */
|
|
171
|
-
description ? /* @__PURE__ */
|
|
271
|
+
return /* @__PURE__ */ jsxs2("div", { className: `sia-alert sia-alert--${resolvedStatus}${banner ? " sia-alert--banner" : ""}${description ? " sia-alert--with-description" : ""} ${className}`.trim(), role: "alert", ...withTitleTooltip(props), children: [
|
|
272
|
+
showIcon || banner ? /* @__PURE__ */ jsx2("span", { className: "sia-alert__icon", "aria-hidden": "true", children: alertIcons[resolvedStatus] }) : null,
|
|
273
|
+
/* @__PURE__ */ jsxs2("div", { className: "sia-alert__content", children: [
|
|
274
|
+
hasHeading ? /* @__PURE__ */ jsx2("strong", { children: heading }) : null,
|
|
275
|
+
description ? /* @__PURE__ */ jsx2("span", { children: description }) : null
|
|
172
276
|
] }),
|
|
173
|
-
action ? /* @__PURE__ */
|
|
174
|
-
closable ? /* @__PURE__ */
|
|
277
|
+
action ? /* @__PURE__ */ jsx2("div", { className: "sia-alert__action", children: action }) : null,
|
|
278
|
+
closable ? /* @__PURE__ */ jsx2("button", { type: "button", className: "sia-alert__close", "aria-label": "\u5173\u95ED\u63D0\u793A", onClick: (event) => {
|
|
175
279
|
onClose?.(event);
|
|
176
280
|
setVisible(false);
|
|
177
281
|
window.setTimeout(() => afterClose?.(), 0);
|
|
178
|
-
}, children: closeIcon ?? /* @__PURE__ */
|
|
282
|
+
}, children: closeIcon ?? /* @__PURE__ */ jsx2(Icon, { name: "close", size: 14 }) }) : null
|
|
179
283
|
] });
|
|
180
284
|
}
|
|
181
285
|
|
|
182
286
|
// src/components/Pagination.tsx
|
|
183
|
-
import { useState as
|
|
184
|
-
import { jsx as
|
|
287
|
+
import { useState as useState3 } from "react";
|
|
288
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
185
289
|
var DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50, 100, 200, 500, 1e3, 2e3, 5e3];
|
|
186
290
|
function Pagination({
|
|
187
291
|
size: sizeProp,
|
|
@@ -206,7 +310,7 @@ function Pagination({
|
|
|
206
310
|
const controlSize = useControlSize(sizeProp);
|
|
207
311
|
const [size, setSize] = useControllableState({ value: pageSize, defaultValue: Math.max(1, defaultPageSize) });
|
|
208
312
|
const [page, setPage] = useControllableState({ value: current, defaultValue: Math.max(1, defaultCurrent) });
|
|
209
|
-
const [internalRefreshing, setInternalRefreshing] =
|
|
313
|
+
const [internalRefreshing, setInternalRefreshing] = useState3(false);
|
|
210
314
|
const safeTotal = Math.max(0, total);
|
|
211
315
|
const totalPages = Math.max(1, Math.ceil(safeTotal / size));
|
|
212
316
|
const safePage = Math.max(1, Math.min(page, totalPages));
|
|
@@ -236,15 +340,15 @@ function Pagination({
|
|
|
236
340
|
if (refreshing === void 0) setInternalRefreshing(false);
|
|
237
341
|
}
|
|
238
342
|
}
|
|
239
|
-
return /* @__PURE__ */
|
|
240
|
-
/* @__PURE__ */
|
|
343
|
+
return /* @__PURE__ */ jsxs3("nav", { className: `sia-pagination sia-pagination--${controlSize} ${className}`.trim(), "aria-label": "\u5206\u9875", ...withTitleTooltip(props), children: [
|
|
344
|
+
/* @__PURE__ */ jsxs3("span", { className: "sia-pagination__current-count", "aria-live": "polite", children: [
|
|
241
345
|
"\u5F53\u524D\u9875 ",
|
|
242
346
|
pageCount,
|
|
243
347
|
" \u6761"
|
|
244
348
|
] }),
|
|
245
|
-
showSizeChanger ? /* @__PURE__ */
|
|
246
|
-
/* @__PURE__ */
|
|
247
|
-
/* @__PURE__ */
|
|
349
|
+
showSizeChanger ? /* @__PURE__ */ jsxs3("div", { className: "sia-pagination__size", children: [
|
|
350
|
+
/* @__PURE__ */ jsx3("span", { children: "\u6BCF\u9875\u663E\u793A" }),
|
|
351
|
+
/* @__PURE__ */ jsx3(
|
|
248
352
|
Select,
|
|
249
353
|
{
|
|
250
354
|
className: "sia-pagination__size-select",
|
|
@@ -260,7 +364,7 @@ function Pagination({
|
|
|
260
364
|
}
|
|
261
365
|
)
|
|
262
366
|
] }) : null,
|
|
263
|
-
showTotal ? typeof showTotal === "function" ? /* @__PURE__ */
|
|
367
|
+
showTotal ? typeof showTotal === "function" ? /* @__PURE__ */ jsx3("span", { className: "sia-pagination__total", children: showTotal(safeTotal, range) }) : /* @__PURE__ */ jsxs3(
|
|
264
368
|
Button,
|
|
265
369
|
{
|
|
266
370
|
variant: "text",
|
|
@@ -270,31 +374,31 @@ function Pagination({
|
|
|
270
374
|
title: onRefreshTotal ? "\u70B9\u51FB\u5237\u65B0\u603B\u8BB0\u5F55\u6570" : void 0,
|
|
271
375
|
onClick: () => void refreshTotal(),
|
|
272
376
|
children: [
|
|
273
|
-
loading ? /* @__PURE__ */
|
|
377
|
+
loading ? /* @__PURE__ */ jsx3(Icon, { name: "loader", size: 13, spin: true }) : null,
|
|
274
378
|
"\u5171 ",
|
|
275
379
|
safeTotal,
|
|
276
380
|
" \u6761",
|
|
277
|
-
onRefreshTotal && !loading ? /* @__PURE__ */
|
|
381
|
+
onRefreshTotal && !loading ? /* @__PURE__ */ jsx3(Icon, { name: "refresh", size: 13 }) : null
|
|
278
382
|
]
|
|
279
383
|
}
|
|
280
384
|
) : null,
|
|
281
|
-
/* @__PURE__ */
|
|
282
|
-
/* @__PURE__ */
|
|
283
|
-
/* @__PURE__ */
|
|
284
|
-
/* @__PURE__ */
|
|
385
|
+
/* @__PURE__ */ jsxs3("div", { className: "sia-pagination__buttons", children: [
|
|
386
|
+
/* @__PURE__ */ jsx3(Button, { size: controlSize, variant: "text", "aria-label": "\u7B2C\u4E00\u9875", disabled: disabled || safePage <= 1, onClick: () => change(1), children: /* @__PURE__ */ jsx3(Icon, { name: "double-left", size: 15 }) }),
|
|
387
|
+
/* @__PURE__ */ jsx3(Button, { size: controlSize, variant: "text", "aria-label": "\u4E0A\u4E00\u9875", disabled: disabled || safePage <= 1, onClick: () => change(safePage - 1), children: /* @__PURE__ */ jsx3(Icon, { name: "chevron-left", size: 15 }) }),
|
|
388
|
+
/* @__PURE__ */ jsxs3("span", { "aria-live": "polite", children: [
|
|
285
389
|
safePage,
|
|
286
390
|
" / ",
|
|
287
391
|
totalPages
|
|
288
392
|
] }),
|
|
289
|
-
/* @__PURE__ */
|
|
290
|
-
/* @__PURE__ */
|
|
393
|
+
/* @__PURE__ */ jsx3(Button, { size: controlSize, variant: "text", "aria-label": "\u4E0B\u4E00\u9875", disabled: disabled || safePage >= totalPages, onClick: () => change(safePage + 1), children: /* @__PURE__ */ jsx3(Icon, { name: "chevron-right", size: 15 }) }),
|
|
394
|
+
/* @__PURE__ */ jsx3(Button, { size: controlSize, variant: "text", "aria-label": "\u6700\u540E\u4E00\u9875", disabled: disabled || safePage >= totalPages, onClick: () => change(totalPages), children: /* @__PURE__ */ jsx3(Icon, { name: "double-right", size: 15 }) })
|
|
291
395
|
] })
|
|
292
396
|
] });
|
|
293
397
|
}
|
|
294
398
|
|
|
295
399
|
// src/components/Cascader.tsx
|
|
296
|
-
import { useEffect, useMemo, useRef, useState as
|
|
297
|
-
import { jsx as
|
|
400
|
+
import { useEffect as useEffect2, useMemo, useRef as useRef2, useState as useState4 } from "react";
|
|
401
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
298
402
|
function optionValue(option, fields) {
|
|
299
403
|
return option[fields.value];
|
|
300
404
|
}
|
|
@@ -350,21 +454,21 @@ function Cascader({
|
|
|
350
454
|
}) {
|
|
351
455
|
const size = useControlSize(sizeProp);
|
|
352
456
|
const fields = useMemo(() => ({ label: fieldNames?.label ?? "label", value: fieldNames?.value ?? "value", children: fieldNames?.children ?? "children" }), [fieldNames]);
|
|
353
|
-
const rootRef =
|
|
354
|
-
const popupRef =
|
|
457
|
+
const rootRef = useRef2(null);
|
|
458
|
+
const popupRef = useRef2(null);
|
|
355
459
|
const [current, setCurrent] = useControllableState({
|
|
356
460
|
value,
|
|
357
461
|
defaultValue: defaultValue ?? (multiple ? [] : void 0)
|
|
358
462
|
});
|
|
359
|
-
const [open, setOpen] =
|
|
360
|
-
const [active, setActive] =
|
|
361
|
-
const [search, setSearch] =
|
|
362
|
-
const [loadingKey, setLoadingKey] =
|
|
463
|
+
const [open, setOpen] = useState4(false);
|
|
464
|
+
const [active, setActive] = useState4([]);
|
|
465
|
+
const [search, setSearch] = useState4("");
|
|
466
|
+
const [loadingKey, setLoadingKey] = useState4("");
|
|
363
467
|
const selectedPaths = multiple ? Array.isArray(current) ? current : [] : current?.length && !Array.isArray(current[0]) ? [current] : [];
|
|
364
468
|
const selectedKeys = new Set(selectedPaths.map(pathKey));
|
|
365
469
|
const selectedPathSignature = selectedPaths.map(pathKey).join("");
|
|
366
470
|
const searchPaths = useMemo(() => search ? leafPaths(options, fields).filter((path) => path.some((option) => String(optionLabel(option, fields)).toLowerCase().includes(search.toLowerCase()))) : [], [fields, options, search]);
|
|
367
|
-
|
|
471
|
+
useEffect2(() => {
|
|
368
472
|
if (!open) return;
|
|
369
473
|
const close = (event) => {
|
|
370
474
|
const target = event.target;
|
|
@@ -373,13 +477,13 @@ function Cascader({
|
|
|
373
477
|
document.addEventListener("pointerdown", close);
|
|
374
478
|
return () => document.removeEventListener("pointerdown", close);
|
|
375
479
|
}, [open]);
|
|
376
|
-
|
|
480
|
+
useEffect2(() => {
|
|
377
481
|
if (selectedPaths.length) return;
|
|
378
482
|
setActive([]);
|
|
379
483
|
setSearch("");
|
|
380
484
|
setLoadingKey("");
|
|
381
485
|
}, [selectedPaths.length]);
|
|
382
|
-
|
|
486
|
+
useEffect2(() => {
|
|
383
487
|
if (!open || !selectedPaths.length) return;
|
|
384
488
|
setActive(findPath(options, selectedPaths[0], fields));
|
|
385
489
|
}, [fields, open, options, selectedPathSignature]);
|
|
@@ -437,26 +541,26 @@ function Cascader({
|
|
|
437
541
|
if (children?.length) columns.push(children);
|
|
438
542
|
});
|
|
439
543
|
const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: selectedPaths.length > 0, active: open });
|
|
440
|
-
return /* @__PURE__ */
|
|
441
|
-
/* @__PURE__ */
|
|
442
|
-
/* @__PURE__ */
|
|
443
|
-
allowClear && selectedPaths.length && !disabled ? /* @__PURE__ */
|
|
544
|
+
return /* @__PURE__ */ jsxs4("div", { ref: rootRef, className: `sia-cascader sia-cascader--${size}${open ? " is-open" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), ...withTitleTooltip(props), children: [
|
|
545
|
+
/* @__PURE__ */ jsxs4("button", { type: "button", className: `sia-cascader__trigger${floating.className}`, disabled, "aria-haspopup": "listbox", "aria-expanded": open, onClick: toggleOpen, children: [
|
|
546
|
+
/* @__PURE__ */ jsx4("span", { className: "sia-cascader__value", children: display ? multiple && Array.isArray(display) ? display.map((label, index) => /* @__PURE__ */ jsx4("span", { className: "sia-cascader__tag", children: label }, pathKey(selectedPaths[index] ?? []))) : display : /* @__PURE__ */ jsx4("span", { className: "sia-cascader__placeholder", children: placeholder }) }),
|
|
547
|
+
allowClear && selectedPaths.length && !disabled ? /* @__PURE__ */ jsx4("span", { className: "sia-cascader__clear", role: "button", "aria-label": "\u6E05\u9664\u9009\u62E9", onClick: (event) => {
|
|
444
548
|
event.stopPropagation();
|
|
445
549
|
clearSelection();
|
|
446
|
-
}, children: /* @__PURE__ */
|
|
550
|
+
}, children: /* @__PURE__ */ jsx4(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
|
|
447
551
|
floating.label,
|
|
448
|
-
/* @__PURE__ */
|
|
552
|
+
/* @__PURE__ */ jsx4(Icon, { name: open ? "chevron-up" : "chevron-down", size: 14 })
|
|
449
553
|
] }),
|
|
450
|
-
/* @__PURE__ */
|
|
451
|
-
showSearch ? /* @__PURE__ */
|
|
452
|
-
/* @__PURE__ */
|
|
453
|
-
/* @__PURE__ */
|
|
554
|
+
/* @__PURE__ */ jsxs4(PopupPortal, { ref: popupRef, anchorRef: rootRef, open, className: "sia-cascader__popup", children: [
|
|
555
|
+
showSearch ? /* @__PURE__ */ jsxs4("label", { className: "sia-cascader__search", children: [
|
|
556
|
+
/* @__PURE__ */ jsx4(Icon, { name: "search", size: 15 }),
|
|
557
|
+
/* @__PURE__ */ jsx4("input", { autoFocus: true, value: search, placeholder: "\u641C\u7D22\u9009\u9879", onChange: (event) => setSearch(event.currentTarget.value) })
|
|
454
558
|
] }) : null,
|
|
455
|
-
search ? /* @__PURE__ */
|
|
559
|
+
search ? /* @__PURE__ */ jsxs4("div", { className: "sia-cascader__results", children: [
|
|
456
560
|
searchPaths.map((path) => {
|
|
457
561
|
const values = path.map((item) => optionValue(item, fields));
|
|
458
562
|
const checked = selectedKeys.has(pathKey(values));
|
|
459
|
-
return /* @__PURE__ */
|
|
563
|
+
return /* @__PURE__ */ jsxs4("button", { type: "button", onClick: () => {
|
|
460
564
|
setActive(path);
|
|
461
565
|
if (multiple) emit(checked ? selectedPaths.filter((item) => pathKey(item) !== pathKey(values)) : [...selectedPaths, values]);
|
|
462
566
|
else {
|
|
@@ -464,19 +568,19 @@ function Cascader({
|
|
|
464
568
|
setOpen(false);
|
|
465
569
|
}
|
|
466
570
|
}, children: [
|
|
467
|
-
multiple ? /* @__PURE__ */
|
|
468
|
-
/* @__PURE__ */
|
|
571
|
+
multiple ? /* @__PURE__ */ jsx4(Checkbox, { checked, tabIndex: -1 }) : null,
|
|
572
|
+
/* @__PURE__ */ jsx4("span", { children: path.map((item) => optionLabel(item, fields)).join(" / ") })
|
|
469
573
|
] }, pathKey(values));
|
|
470
574
|
}),
|
|
471
|
-
!searchPaths.length ? /* @__PURE__ */
|
|
472
|
-
] }) : /* @__PURE__ */
|
|
575
|
+
!searchPaths.length ? /* @__PURE__ */ jsx4("div", { className: "sia-cascader__empty", children: "\u6682\u65E0\u5339\u914D\u9009\u9879" }) : null
|
|
576
|
+
] }) : /* @__PURE__ */ jsx4("div", { className: "sia-cascader__menus", children: columns.map((column, depth) => /* @__PURE__ */ jsx4("div", { className: "sia-cascader__menu", role: "listbox", children: column.map((option) => {
|
|
473
577
|
const nextPath = [...active.slice(0, depth), option];
|
|
474
578
|
const values = nextPath.map((item) => optionValue(item, fields));
|
|
475
579
|
const children = optionChildren(option, fields);
|
|
476
580
|
const selected = active[depth] === option;
|
|
477
581
|
const checked = selectedKeys.has(pathKey(values));
|
|
478
582
|
const loading = loadingKey === pathKey(values);
|
|
479
|
-
return /* @__PURE__ */
|
|
583
|
+
return /* @__PURE__ */ jsxs4(
|
|
480
584
|
"button",
|
|
481
585
|
{
|
|
482
586
|
type: "button",
|
|
@@ -487,9 +591,9 @@ function Cascader({
|
|
|
487
591
|
onMouseEnter: expandTrigger === "hover" ? () => void activate(option, depth) : void 0,
|
|
488
592
|
onClick: () => void activate(option, depth),
|
|
489
593
|
children: [
|
|
490
|
-
multiple && !children?.length ? /* @__PURE__ */
|
|
491
|
-
/* @__PURE__ */
|
|
492
|
-
loading ? /* @__PURE__ */
|
|
594
|
+
multiple && !children?.length ? /* @__PURE__ */ jsx4(Checkbox, { checked, tabIndex: -1 }) : null,
|
|
595
|
+
/* @__PURE__ */ jsx4("span", { children: optionLabel(option, fields) }),
|
|
596
|
+
loading ? /* @__PURE__ */ jsx4(Icon, { name: "loader", className: "sia-spin-icon", size: 14 }) : children?.length || option.isLeaf === false ? /* @__PURE__ */ jsx4(Icon, { name: "chevron-right", size: 13 }) : null
|
|
493
597
|
]
|
|
494
598
|
},
|
|
495
599
|
optionValue(option, fields)
|
|
@@ -501,7 +605,7 @@ function Cascader({
|
|
|
501
605
|
|
|
502
606
|
// src/components/Layout.tsx
|
|
503
607
|
import { Children } from "react";
|
|
504
|
-
import { jsx as
|
|
608
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
505
609
|
var gaps = { small: 8, medium: 12, large: 16 };
|
|
506
610
|
function resolveGap(gap) {
|
|
507
611
|
return typeof gap === "string" && gap in gaps ? gaps[gap] : gap;
|
|
@@ -542,10 +646,10 @@ function Flex({
|
|
|
542
646
|
flex,
|
|
543
647
|
...style
|
|
544
648
|
};
|
|
545
|
-
return /* @__PURE__ */
|
|
649
|
+
return /* @__PURE__ */ jsx5(Component, { className: `sia-flex${isVertical ? " sia-flex--vertical" : ""} ${className}`.trim(), style: mergedStyle, ...withTitleTooltip(props) });
|
|
546
650
|
}
|
|
547
651
|
function SpaceCompact({ direction = "horizontal", block = false, className = "", ...props }) {
|
|
548
|
-
return /* @__PURE__ */
|
|
652
|
+
return /* @__PURE__ */ jsx5("div", { className: `sia-space-compact sia-space-compact--${direction}${block ? " sia-space-compact--block" : ""} ${className}`.trim(), ...withTitleTooltip(props) });
|
|
549
653
|
}
|
|
550
654
|
function SpaceRoot({
|
|
551
655
|
direction = "horizontal",
|
|
@@ -567,9 +671,9 @@ function SpaceRoot({
|
|
|
567
671
|
alignItems: resolveAlign(align),
|
|
568
672
|
...style
|
|
569
673
|
};
|
|
570
|
-
return /* @__PURE__ */
|
|
674
|
+
return /* @__PURE__ */ jsx5("div", { className: `sia-space sia-space--${direction} ${className}`.trim(), style: mergedStyle, ...withTitleTooltip(props), children: items.map((item, index) => /* @__PURE__ */ jsxs5("span", { className: "sia-space__item", children: [
|
|
571
675
|
item,
|
|
572
|
-
split !== void 0 && index < items.length - 1 ? /* @__PURE__ */
|
|
676
|
+
split !== void 0 && index < items.length - 1 ? /* @__PURE__ */ jsx5("span", { className: "sia-space__split", children: split }) : null
|
|
573
677
|
] }, index)) });
|
|
574
678
|
}
|
|
575
679
|
var Space = Object.assign(SpaceRoot, {
|
|
@@ -585,14 +689,14 @@ function Divider({
|
|
|
585
689
|
className = "",
|
|
586
690
|
...props
|
|
587
691
|
}) {
|
|
588
|
-
return /* @__PURE__ */
|
|
692
|
+
return /* @__PURE__ */ jsx5(
|
|
589
693
|
"div",
|
|
590
694
|
{
|
|
591
695
|
className: `sia-divider sia-divider--${orientation} sia-divider--${variant} sia-divider--text-${textAlign}${children ? " sia-divider--with-text" : ""}${plain ? " sia-divider--plain" : ""} ${className}`.trim(),
|
|
592
696
|
role: "separator",
|
|
593
697
|
"aria-orientation": orientation,
|
|
594
698
|
...withTitleTooltip(props),
|
|
595
|
-
children: children ? /* @__PURE__ */
|
|
699
|
+
children: children ? /* @__PURE__ */ jsx5("span", { className: "sia-divider__text", children }) : null
|
|
596
700
|
}
|
|
597
701
|
);
|
|
598
702
|
}
|
|
@@ -612,7 +716,7 @@ function Row({ gutter = 0, align, justify, wrap = true, className = "", style, .
|
|
|
612
716
|
flexWrap: wrap ? "wrap" : "nowrap",
|
|
613
717
|
...style
|
|
614
718
|
};
|
|
615
|
-
return /* @__PURE__ */
|
|
719
|
+
return /* @__PURE__ */ jsx5("div", { className: `sia-row ${className}`.trim(), style: mergedStyle, ...withTitleTooltip(props) });
|
|
616
720
|
}
|
|
617
721
|
function setColVariables(style, prefix, value) {
|
|
618
722
|
if (value === void 0) return;
|
|
@@ -652,12 +756,12 @@ function Col({
|
|
|
652
756
|
setColVariables(mergedStyle, "lg-", lg);
|
|
653
757
|
setColVariables(mergedStyle, "xl-", xl);
|
|
654
758
|
setColVariables(mergedStyle, "xxl-", xxl);
|
|
655
|
-
return /* @__PURE__ */
|
|
759
|
+
return /* @__PURE__ */ jsx5("div", { className: `sia-col ${className}`.trim(), style: mergedStyle, ...withTitleTooltip(props) });
|
|
656
760
|
}
|
|
657
761
|
|
|
658
762
|
// src/components/Splitter.tsx
|
|
659
|
-
import { Children as Children2, cloneElement, isValidElement, useMemo as useMemo2, useRef as
|
|
660
|
-
import { Fragment, jsx as
|
|
763
|
+
import { Children as Children2, cloneElement, isValidElement, useMemo as useMemo2, useRef as useRef3, useState as useState5 } from "react";
|
|
764
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
661
765
|
function SplitterPanel({
|
|
662
766
|
defaultSize: _defaultSize,
|
|
663
767
|
defaultCollapsed: _defaultCollapsed,
|
|
@@ -671,7 +775,7 @@ function SplitterPanel({
|
|
|
671
775
|
className = "",
|
|
672
776
|
...props
|
|
673
777
|
}) {
|
|
674
|
-
return /* @__PURE__ */
|
|
778
|
+
return /* @__PURE__ */ jsx6("div", { className: `sia-splitter__panel ${className}`.trim(), ...withTitleTooltip(props) });
|
|
675
779
|
}
|
|
676
780
|
function normalizeExpandedSizes(panels) {
|
|
677
781
|
const specified = panels.map((panel) => panel.props.defaultSize);
|
|
@@ -706,10 +810,10 @@ function SplitterRoot({
|
|
|
706
810
|
children,
|
|
707
811
|
...props
|
|
708
812
|
}) {
|
|
709
|
-
const rootRef =
|
|
813
|
+
const rootRef = useRef3(null);
|
|
710
814
|
const panels = useMemo2(() => Children2.toArray(children).filter(isValidElement), [children]);
|
|
711
|
-
const [sizes, setSizes] =
|
|
712
|
-
const expandedSizesRef =
|
|
815
|
+
const [sizes, setSizes] = useState5(() => normalizeSizes(panels));
|
|
816
|
+
const expandedSizesRef = useRef3(normalizeExpandedSizes(panels));
|
|
713
817
|
function resizePair(index, deltaPercent, complete = false) {
|
|
714
818
|
setSizes((current) => {
|
|
715
819
|
const next = [...current];
|
|
@@ -787,7 +891,7 @@ function SplitterRoot({
|
|
|
787
891
|
onResize?.(next);
|
|
788
892
|
onResizeEnd?.(next);
|
|
789
893
|
}
|
|
790
|
-
return /* @__PURE__ */
|
|
894
|
+
return /* @__PURE__ */ jsx6("div", { ref: rootRef, className: `sia-splitter sia-splitter--${orientation} ${className}`.trim(), ...withTitleTooltip(props), children: panels.flatMap((panel, index) => {
|
|
791
895
|
const panelCollapsed = Boolean(panel.props.collapsible) && (sizes[index] ?? 0) <= collapsedSize(panel) + 0.01;
|
|
792
896
|
const collapsedContent = panel.props.collapsedContent;
|
|
793
897
|
const expandFromCollapsedContent = () => {
|
|
@@ -799,9 +903,9 @@ function SplitterRoot({
|
|
|
799
903
|
...panel.props.style,
|
|
800
904
|
flexBasis: `${sizes[index] ?? 0}%`
|
|
801
905
|
},
|
|
802
|
-
children: /* @__PURE__ */
|
|
803
|
-
/* @__PURE__ */
|
|
804
|
-
collapsedContent !== void 0 ? /* @__PURE__ */
|
|
906
|
+
children: /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
907
|
+
/* @__PURE__ */ jsx6("div", { className: `sia-splitter__panel-content${panelCollapsed ? " is-collapsed" : ""}`, "aria-hidden": panelCollapsed, children: panel.props.children }),
|
|
908
|
+
collapsedContent !== void 0 ? /* @__PURE__ */ jsx6(
|
|
805
909
|
"button",
|
|
806
910
|
{
|
|
807
911
|
type: "button",
|
|
@@ -822,7 +926,7 @@ function SplitterRoot({
|
|
|
822
926
|
const afterCollapsed = (sizes[index + 1] ?? 0) <= collapsedSize(panels[index + 1]) + 0.01;
|
|
823
927
|
const beforeUsesRail = beforeCollapsed && panels[index]?.props.collapsedContent !== void 0;
|
|
824
928
|
const afterUsesRail = afterCollapsed && panels[index + 1]?.props.collapsedContent !== void 0;
|
|
825
|
-
return [panelNode, /* @__PURE__ */
|
|
929
|
+
return [panelNode, /* @__PURE__ */ jsxs6(
|
|
826
930
|
"div",
|
|
827
931
|
{
|
|
828
932
|
className: `sia-splitter__handle${beforeCollapsed && !beforeUsesRail ? " sia-splitter__handle--before-collapsed" : ""}${afterCollapsed && !afterUsesRail ? " sia-splitter__handle--after-collapsed" : ""}`,
|
|
@@ -833,15 +937,15 @@ function SplitterRoot({
|
|
|
833
937
|
onMouseDown: (event) => startResize(index, event),
|
|
834
938
|
onKeyDown: (event) => handleKey(index, event),
|
|
835
939
|
children: [
|
|
836
|
-
beforeCollapsible && !beforeUsesRail ? /* @__PURE__ */
|
|
940
|
+
beforeCollapsible && !beforeUsesRail ? /* @__PURE__ */ jsx6("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) => {
|
|
837
941
|
event.stopPropagation();
|
|
838
942
|
togglePanel(index, "before");
|
|
839
|
-
}, children: /* @__PURE__ */
|
|
840
|
-
/* @__PURE__ */
|
|
841
|
-
afterCollapsible && !afterUsesRail ? /* @__PURE__ */
|
|
943
|
+
}, children: /* @__PURE__ */ jsx6(Icon, { name: orientation === "horizontal" ? beforeCollapsed ? "chevron-right" : "chevron-left" : beforeCollapsed ? "chevron-down" : "chevron-up", size: 11 }) }) : null,
|
|
944
|
+
/* @__PURE__ */ jsx6("span", {}),
|
|
945
|
+
afterCollapsible && !afterUsesRail ? /* @__PURE__ */ jsx6("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) => {
|
|
842
946
|
event.stopPropagation();
|
|
843
947
|
togglePanel(index, "after");
|
|
844
|
-
}, children: /* @__PURE__ */
|
|
948
|
+
}, children: /* @__PURE__ */ jsx6(Icon, { name: orientation === "horizontal" ? afterCollapsed ? "chevron-left" : "chevron-right" : afterCollapsed ? "chevron-up" : "chevron-down", size: 11 }) }) : null
|
|
845
949
|
]
|
|
846
950
|
},
|
|
847
951
|
`handle-${index}`
|
|
@@ -854,8 +958,8 @@ var Splitter = Object.assign(SplitterRoot, {
|
|
|
854
958
|
});
|
|
855
959
|
|
|
856
960
|
// src/components/ToolPanel.tsx
|
|
857
|
-
import { useId, useLayoutEffect, useRef as
|
|
858
|
-
import { Fragment as Fragment2, jsx as
|
|
961
|
+
import { useId, useLayoutEffect, useRef as useRef4, useState as useState6 } from "react";
|
|
962
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
859
963
|
function clamp2(value, min, max) {
|
|
860
964
|
return Math.min(max, Math.max(min, value));
|
|
861
965
|
}
|
|
@@ -881,15 +985,15 @@ function ToolPanel({
|
|
|
881
985
|
...props
|
|
882
986
|
}) {
|
|
883
987
|
const panelId = useId();
|
|
884
|
-
const [internalActiveKey, setInternalActiveKey] =
|
|
885
|
-
const [internalOpen, setInternalOpen] =
|
|
886
|
-
const [size, setSize] =
|
|
988
|
+
const [internalActiveKey, setInternalActiveKey] = useState6(defaultActiveKey);
|
|
989
|
+
const [internalOpen, setInternalOpen] = useState6(defaultOpen);
|
|
990
|
+
const [size, setSize] = useState6(() => clamp2(defaultSize, minSize, maxSize));
|
|
887
991
|
const panels = items ?? [{ key: "single", title, icon, children }];
|
|
888
992
|
const requestedKey = activeKey ?? internalActiveKey;
|
|
889
993
|
const activePanel = panels.find((item) => item.key === requestedKey && !item.disabled) ?? panels.find((item) => !item.disabled);
|
|
890
994
|
const isOpen = (open ?? internalOpen) && Boolean(activePanel);
|
|
891
|
-
const railRef =
|
|
892
|
-
const indicatorRef =
|
|
995
|
+
const railRef = useRef4(null);
|
|
996
|
+
const indicatorRef = useRef4(null);
|
|
893
997
|
useLayoutEffect(() => {
|
|
894
998
|
const rail2 = railRef.current;
|
|
895
999
|
const indicator = indicatorRef.current;
|
|
@@ -969,12 +1073,12 @@ function ToolPanel({
|
|
|
969
1073
|
resize(size + (placement === "left" ? direction : -direction) * 12, true);
|
|
970
1074
|
}
|
|
971
1075
|
const titleText = typeof activePanel?.title === "string" ? activePanel.title : "\u5DE5\u5177";
|
|
972
|
-
const rail = /* @__PURE__ */
|
|
973
|
-
/* @__PURE__ */
|
|
1076
|
+
const rail = /* @__PURE__ */ jsxs7("div", { ref: railRef, className: "sia-tool-panel__rail", children: [
|
|
1077
|
+
/* @__PURE__ */ jsx7("span", { ref: indicatorRef, className: "sia-tool-panel__indicator", "aria-hidden": "true" }),
|
|
974
1078
|
panels.map((item, index) => {
|
|
975
1079
|
const expanded = isOpen && item.key === activePanel?.key;
|
|
976
1080
|
const label = typeof item.title === "string" ? item.title : "\u5DE5\u5177";
|
|
977
|
-
return /* @__PURE__ */
|
|
1081
|
+
return /* @__PURE__ */ jsxs7(
|
|
978
1082
|
"button",
|
|
979
1083
|
{
|
|
980
1084
|
id: `${panelId}-activity-${index}`,
|
|
@@ -987,15 +1091,15 @@ function ToolPanel({
|
|
|
987
1091
|
disabled: item.disabled,
|
|
988
1092
|
onClick: () => activatePanel(item),
|
|
989
1093
|
children: [
|
|
990
|
-
item.icon ? /* @__PURE__ */
|
|
991
|
-
/* @__PURE__ */
|
|
1094
|
+
item.icon ? /* @__PURE__ */ jsx7("span", { className: "sia-tool-panel__activity-icon", children: item.icon }) : null,
|
|
1095
|
+
/* @__PURE__ */ jsx7("span", { className: "sia-tool-panel__activity-label", children: item.title })
|
|
992
1096
|
]
|
|
993
1097
|
},
|
|
994
1098
|
item.key
|
|
995
1099
|
);
|
|
996
1100
|
})
|
|
997
1101
|
] });
|
|
998
|
-
const content = /* @__PURE__ */
|
|
1102
|
+
const content = /* @__PURE__ */ jsx7("div", { className: "sia-tool-panel__content", hidden: !isOpen, "aria-hidden": !isOpen, children: panels.map((item, index) => /* @__PURE__ */ jsx7(
|
|
999
1103
|
"div",
|
|
1000
1104
|
{
|
|
1001
1105
|
id: `${panelId}-content-${index}`,
|
|
@@ -1007,7 +1111,7 @@ function ToolPanel({
|
|
|
1007
1111
|
},
|
|
1008
1112
|
item.key
|
|
1009
1113
|
)) });
|
|
1010
|
-
const resizeHandle = /* @__PURE__ */
|
|
1114
|
+
const resizeHandle = /* @__PURE__ */ jsx7(
|
|
1011
1115
|
"div",
|
|
1012
1116
|
{
|
|
1013
1117
|
className: "sia-tool-panel__resize-handle",
|
|
@@ -1027,18 +1131,18 @@ function ToolPanel({
|
|
|
1027
1131
|
...style,
|
|
1028
1132
|
"--sia-tool-panel-size": `${size}px`
|
|
1029
1133
|
};
|
|
1030
|
-
return /* @__PURE__ */
|
|
1134
|
+
return /* @__PURE__ */ jsx7(
|
|
1031
1135
|
"div",
|
|
1032
1136
|
{
|
|
1033
1137
|
className: `sia-tool-panel sia-tool-panel--${placement}${isOpen ? " is-open" : ""} ${className}`.trim(),
|
|
1034
1138
|
style: panelStyle,
|
|
1035
1139
|
"data-placement": placement,
|
|
1036
1140
|
...withTitleTooltip(props),
|
|
1037
|
-
children: placement === "left" ? /* @__PURE__ */
|
|
1141
|
+
children: placement === "left" ? /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
1038
1142
|
rail,
|
|
1039
1143
|
content,
|
|
1040
1144
|
resizeHandle
|
|
1041
|
-
] }) : /* @__PURE__ */
|
|
1145
|
+
] }) : /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
1042
1146
|
resizeHandle,
|
|
1043
1147
|
content,
|
|
1044
1148
|
rail
|
|
@@ -1048,7 +1152,7 @@ function ToolPanel({
|
|
|
1048
1152
|
}
|
|
1049
1153
|
|
|
1050
1154
|
// src/components/WindowFrame.tsx
|
|
1051
|
-
import { jsx as
|
|
1155
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1052
1156
|
var DEFAULT_LABELS = {
|
|
1053
1157
|
minimize: "\u6700\u5C0F\u5316",
|
|
1054
1158
|
maximize: "\u6700\u5927\u5316",
|
|
@@ -1077,7 +1181,7 @@ function WindowFrame({
|
|
|
1077
1181
|
children,
|
|
1078
1182
|
...props
|
|
1079
1183
|
}) {
|
|
1080
|
-
return /* @__PURE__ */
|
|
1184
|
+
return /* @__PURE__ */ jsxs8(
|
|
1081
1185
|
"div",
|
|
1082
1186
|
{
|
|
1083
1187
|
className: `sia-window-frame ${className}`.trim(),
|
|
@@ -1106,7 +1210,7 @@ function WindowControls({
|
|
|
1106
1210
|
function runAction(action) {
|
|
1107
1211
|
void onAction?.(action);
|
|
1108
1212
|
}
|
|
1109
|
-
return /* @__PURE__ */
|
|
1213
|
+
return /* @__PURE__ */ jsxs8(
|
|
1110
1214
|
"div",
|
|
1111
1215
|
{
|
|
1112
1216
|
className: `sia-window-controls ${className}`.trim(),
|
|
@@ -1114,7 +1218,7 @@ function WindowControls({
|
|
|
1114
1218
|
"aria-label": "\u7A97\u53E3\u63A7\u5236",
|
|
1115
1219
|
...withTitleTooltip(props),
|
|
1116
1220
|
children: [
|
|
1117
|
-
showMinimize ? /* @__PURE__ */
|
|
1221
|
+
showMinimize ? /* @__PURE__ */ jsx8(
|
|
1118
1222
|
"button",
|
|
1119
1223
|
{
|
|
1120
1224
|
type: "button",
|
|
@@ -1123,10 +1227,10 @@ function WindowControls({
|
|
|
1123
1227
|
...withTitleTooltip({ title: mergedLabels.minimize }),
|
|
1124
1228
|
disabled: isDisabled("minimize"),
|
|
1125
1229
|
onClick: () => runAction("minimize"),
|
|
1126
|
-
children: /* @__PURE__ */
|
|
1230
|
+
children: /* @__PURE__ */ jsx8(Icon, { name: "minus", size: 14 })
|
|
1127
1231
|
}
|
|
1128
1232
|
) : null,
|
|
1129
|
-
showMaximize ? /* @__PURE__ */
|
|
1233
|
+
showMaximize ? /* @__PURE__ */ jsx8(
|
|
1130
1234
|
"button",
|
|
1131
1235
|
{
|
|
1132
1236
|
type: "button",
|
|
@@ -1135,10 +1239,10 @@ function WindowControls({
|
|
|
1135
1239
|
...withTitleTooltip({ title: maximized ? mergedLabels.restore : mergedLabels.maximize }),
|
|
1136
1240
|
disabled: isDisabled("toggle-maximize"),
|
|
1137
1241
|
onClick: () => runAction("toggle-maximize"),
|
|
1138
|
-
children: /* @__PURE__ */
|
|
1242
|
+
children: /* @__PURE__ */ jsx8(Icon, { name: maximized ? "fullscreen-exit" : "fullscreen", size: 13 })
|
|
1139
1243
|
}
|
|
1140
1244
|
) : null,
|
|
1141
|
-
showClose ? /* @__PURE__ */
|
|
1245
|
+
showClose ? /* @__PURE__ */ jsx8(
|
|
1142
1246
|
"button",
|
|
1143
1247
|
{
|
|
1144
1248
|
type: "button",
|
|
@@ -1147,7 +1251,7 @@ function WindowControls({
|
|
|
1147
1251
|
...withTitleTooltip({ title: mergedLabels.close }),
|
|
1148
1252
|
disabled: isDisabled("close"),
|
|
1149
1253
|
onClick: () => runAction("close"),
|
|
1150
|
-
children: /* @__PURE__ */
|
|
1254
|
+
children: /* @__PURE__ */ jsx8(Icon, { name: "close", size: 14 })
|
|
1151
1255
|
}
|
|
1152
1256
|
) : null
|
|
1153
1257
|
]
|
|
@@ -1177,7 +1281,7 @@ function WindowTitleBar({
|
|
|
1177
1281
|
event.preventDefault();
|
|
1178
1282
|
void onWindowAction(event.detail > 1 ? "toggle-maximize" : "start-dragging");
|
|
1179
1283
|
}
|
|
1180
|
-
const renderedControls = controls === true ? /* @__PURE__ */
|
|
1284
|
+
const renderedControls = controls === true ? /* @__PURE__ */ jsx8(
|
|
1181
1285
|
WindowControls,
|
|
1182
1286
|
{
|
|
1183
1287
|
maximized,
|
|
@@ -1186,8 +1290,8 @@ function WindowTitleBar({
|
|
|
1186
1290
|
onAction: onWindowAction
|
|
1187
1291
|
}
|
|
1188
1292
|
) : controls || null;
|
|
1189
|
-
const renderedActions = actions ? /* @__PURE__ */
|
|
1190
|
-
return /* @__PURE__ */
|
|
1293
|
+
const renderedActions = actions ? /* @__PURE__ */ jsx8("div", { className: "sia-window-titlebar__actions", "data-sia-window-no-drag": "", children: actions }) : null;
|
|
1294
|
+
return /* @__PURE__ */ jsxs8(
|
|
1191
1295
|
"header",
|
|
1192
1296
|
{
|
|
1193
1297
|
className: `sia-window-titlebar ${className}`.trim(),
|
|
@@ -1195,10 +1299,10 @@ function WindowTitleBar({
|
|
|
1195
1299
|
onMouseDown: handleMouseDown,
|
|
1196
1300
|
...withTitleTooltip(props),
|
|
1197
1301
|
children: [
|
|
1198
|
-
leading ? /* @__PURE__ */
|
|
1302
|
+
leading ? /* @__PURE__ */ jsx8("div", { className: "sia-window-titlebar__leading", children: leading }) : null,
|
|
1199
1303
|
actionsAlign === "left" ? renderedActions : null,
|
|
1200
1304
|
children,
|
|
1201
|
-
/* @__PURE__ */
|
|
1305
|
+
/* @__PURE__ */ jsx8("div", { className: "sia-window-titlebar__drag-region", "aria-hidden": "true" }),
|
|
1202
1306
|
actionsAlign === "right" ? renderedActions : null,
|
|
1203
1307
|
renderedControls
|
|
1204
1308
|
]
|
|
@@ -1207,9 +1311,9 @@ function WindowTitleBar({
|
|
|
1207
1311
|
}
|
|
1208
1312
|
|
|
1209
1313
|
// src/components/Drawer.tsx
|
|
1210
|
-
import { createContext, forwardRef, useCallback, useContext, useEffect as
|
|
1314
|
+
import { createContext, forwardRef, useCallback, useContext, useEffect as useEffect3, useId as useId2, useMemo as useMemo3, useRef as useRef5, useState as useState7 } from "react";
|
|
1211
1315
|
import { createRoot } from "react-dom/client";
|
|
1212
|
-
import { jsx as
|
|
1316
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1213
1317
|
var drawerHandles = /* @__PURE__ */ new Set();
|
|
1214
1318
|
var DRAWER_MOTION_DURATION = 400;
|
|
1215
1319
|
var DEFAULT_DRAWER_PUSH_DISTANCE = 180;
|
|
@@ -1243,18 +1347,18 @@ var DrawerRoot = forwardRef(function Drawer({
|
|
|
1243
1347
|
style,
|
|
1244
1348
|
...props
|
|
1245
1349
|
}, forwardedRef) {
|
|
1246
|
-
const localRef =
|
|
1247
|
-
const bodyRef =
|
|
1350
|
+
const localRef = useRef5(null);
|
|
1351
|
+
const bodyRef = useRef5(null);
|
|
1248
1352
|
const titleId = useId2();
|
|
1249
1353
|
const drawerId = useId2();
|
|
1250
1354
|
const parentStack = useContext(DrawerStackContext);
|
|
1251
|
-
const afterOpenRef =
|
|
1252
|
-
const afterCloseRef =
|
|
1355
|
+
const afterOpenRef = useRef5(afterOpen);
|
|
1356
|
+
const afterCloseRef = useRef5(afterClose);
|
|
1253
1357
|
afterOpenRef.current = afterOpen;
|
|
1254
1358
|
afterCloseRef.current = afterClose;
|
|
1255
|
-
const [rendered, setRendered] =
|
|
1256
|
-
const [closing, setClosing] =
|
|
1257
|
-
const [openChildIds, setOpenChildIds] =
|
|
1359
|
+
const [rendered, setRendered] = useState7(open);
|
|
1360
|
+
const [closing, setClosing] = useState7(false);
|
|
1361
|
+
const [openChildIds, setOpenChildIds] = useState7(() => /* @__PURE__ */ new Set());
|
|
1258
1362
|
const setChildOpen = useCallback((id, childOpen) => {
|
|
1259
1363
|
setOpenChildIds((current) => {
|
|
1260
1364
|
const hasId = current.has(id);
|
|
@@ -1266,7 +1370,7 @@ var DrawerRoot = forwardRef(function Drawer({
|
|
|
1266
1370
|
});
|
|
1267
1371
|
}, []);
|
|
1268
1372
|
const stackContextValue = useMemo3(() => ({ setChildOpen }), [setChildOpen]);
|
|
1269
|
-
|
|
1373
|
+
useEffect3(() => {
|
|
1270
1374
|
if (open) {
|
|
1271
1375
|
setRendered(true);
|
|
1272
1376
|
setClosing(false);
|
|
@@ -1281,12 +1385,12 @@ var DrawerRoot = forwardRef(function Drawer({
|
|
|
1281
1385
|
}, DRAWER_MOTION_DURATION);
|
|
1282
1386
|
return () => window.clearTimeout(timer);
|
|
1283
1387
|
}, [open, rendered]);
|
|
1284
|
-
|
|
1388
|
+
useEffect3(() => {
|
|
1285
1389
|
if (!open || !rendered) return void 0;
|
|
1286
1390
|
const timer = window.setTimeout(() => afterOpenRef.current?.(), DRAWER_MOTION_DURATION);
|
|
1287
1391
|
return () => window.clearTimeout(timer);
|
|
1288
1392
|
}, [open, rendered]);
|
|
1289
|
-
|
|
1393
|
+
useEffect3(() => {
|
|
1290
1394
|
if (!parentStack) return void 0;
|
|
1291
1395
|
parentStack.setChildOpen(drawerId, open);
|
|
1292
1396
|
return () => parentStack.setChildOpen(drawerId, false);
|
|
@@ -1316,9 +1420,9 @@ var DrawerRoot = forwardRef(function Drawer({
|
|
|
1316
1420
|
"--sia-drawer-push-x": horizontalPush ? pushOffset : "0px",
|
|
1317
1421
|
"--sia-drawer-push-y": horizontalPush ? "0px" : pushOffset
|
|
1318
1422
|
};
|
|
1319
|
-
return /* @__PURE__ */
|
|
1320
|
-
/* @__PURE__ */
|
|
1321
|
-
/* @__PURE__ */
|
|
1423
|
+
return /* @__PURE__ */ jsx9(DrawerStackContext.Provider, { value: stackContextValue, children: /* @__PURE__ */ jsx9(OverlayPortal, { container: getContainer, children: /* @__PURE__ */ jsxs9("div", { className: "sia-drawer-root", "data-state": closing ? "closing" : "open", style: { zIndex }, children: [
|
|
1424
|
+
/* @__PURE__ */ jsx9("button", { className: "sia-drawer__mask", type: "button", "aria-label": "\u5173\u95ED\u62BD\u5C49", onClick: () => maskClosable && requestClose() }),
|
|
1425
|
+
/* @__PURE__ */ jsxs9(
|
|
1322
1426
|
"div",
|
|
1323
1427
|
{
|
|
1324
1428
|
ref: setRef,
|
|
@@ -1331,16 +1435,16 @@ var DrawerRoot = forwardRef(function Drawer({
|
|
|
1331
1435
|
tabIndex: -1,
|
|
1332
1436
|
...withTitleTooltip(props),
|
|
1333
1437
|
children: [
|
|
1334
|
-
/* @__PURE__ */
|
|
1335
|
-
/* @__PURE__ */
|
|
1336
|
-
closable ? /* @__PURE__ */
|
|
1337
|
-
title ? /* @__PURE__ */
|
|
1438
|
+
/* @__PURE__ */ jsxs9("div", { className: "sia-drawer__header", children: [
|
|
1439
|
+
/* @__PURE__ */ jsxs9("div", { className: "sia-drawer__heading", children: [
|
|
1440
|
+
closable ? /* @__PURE__ */ jsx9("button", { type: "button", className: "sia-drawer__close", "aria-label": "\u5173\u95ED\u62BD\u5C49", onClick: requestClose, children: /* @__PURE__ */ jsx9(Icon, { name: "close", size: 17 }) }) : null,
|
|
1441
|
+
title ? /* @__PURE__ */ jsx9("strong", { id: titleId, children: title }) : null
|
|
1338
1442
|
] }),
|
|
1339
|
-
extra ? /* @__PURE__ */
|
|
1443
|
+
extra ? /* @__PURE__ */ jsx9("div", { className: "sia-drawer__extra", children: extra }) : null
|
|
1340
1444
|
] }),
|
|
1341
|
-
/* @__PURE__ */
|
|
1342
|
-
/* @__PURE__ */
|
|
1343
|
-
footer ? /* @__PURE__ */
|
|
1445
|
+
/* @__PURE__ */ jsx9("div", { ref: bodyRef, className: "sia-drawer__body", children }),
|
|
1446
|
+
/* @__PURE__ */ jsx9(FloatingScrollbarProvider, { targetRef: bodyRef }),
|
|
1447
|
+
footer ? /* @__PURE__ */ jsx9("div", { className: "sia-drawer__footer", children: footer }) : null
|
|
1344
1448
|
]
|
|
1345
1449
|
}
|
|
1346
1450
|
)
|
|
@@ -1373,7 +1477,7 @@ function openDrawer(config) {
|
|
|
1373
1477
|
cleanupTimer = window.setTimeout(cleanup, DRAWER_MOTION_DURATION + 100);
|
|
1374
1478
|
}
|
|
1375
1479
|
function render() {
|
|
1376
|
-
root.render(/* @__PURE__ */
|
|
1480
|
+
root.render(/* @__PURE__ */ jsx9(
|
|
1377
1481
|
DrawerRoot,
|
|
1378
1482
|
{
|
|
1379
1483
|
...currentConfig,
|
|
@@ -1412,8 +1516,8 @@ var Drawer2 = Object.assign(DrawerRoot, {
|
|
|
1412
1516
|
});
|
|
1413
1517
|
|
|
1414
1518
|
// src/components/Form.tsx
|
|
1415
|
-
import { Children as Children3, cloneElement as cloneElement2, createContext as createContext2, forwardRef as forwardRef2, isValidElement as isValidElement2, useContext as useContext2, useEffect as
|
|
1416
|
-
import { Fragment as Fragment3, jsx as
|
|
1519
|
+
import { Children as Children3, cloneElement as cloneElement2, createContext as createContext2, forwardRef as forwardRef2, isValidElement as isValidElement2, useContext as useContext2, useEffect as useEffect4, useId as useId3, useLayoutEffect as useLayoutEffect2, useMemo as useMemo4, useRef as useRef6, useSyncExternalStore } from "react";
|
|
1520
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1417
1521
|
var Switch = forwardRef2(function Switch2({
|
|
1418
1522
|
label,
|
|
1419
1523
|
variant = "standard",
|
|
@@ -1433,26 +1537,26 @@ var Switch = forwardRef2(function Switch2({
|
|
|
1433
1537
|
onCheckedChange?.(event.currentTarget.checked);
|
|
1434
1538
|
onChange?.(event);
|
|
1435
1539
|
};
|
|
1436
|
-
return /* @__PURE__ */
|
|
1437
|
-
/* @__PURE__ */
|
|
1438
|
-
/* @__PURE__ */
|
|
1540
|
+
return /* @__PURE__ */ jsxs10("label", { className: `sia-switch-wrap sia-switch-wrap--${size} ${className}`.trim(), children: [
|
|
1541
|
+
/* @__PURE__ */ jsx10("input", { ref, type: "checkbox", role: "switch", className: "sia-switch-input", onChange: handleChange, ...withTitleTooltip(props) }),
|
|
1542
|
+
/* @__PURE__ */ jsxs10(
|
|
1439
1543
|
"span",
|
|
1440
1544
|
{
|
|
1441
1545
|
className: `sia-switch sia-switch--${variant}${variant === "standard" && hasContent ? " sia-switch--with-content" : ""}`,
|
|
1442
1546
|
"aria-hidden": "true",
|
|
1443
1547
|
children: [
|
|
1444
|
-
/* @__PURE__ */
|
|
1445
|
-
variant === "segmented" ? /* @__PURE__ */
|
|
1446
|
-
/* @__PURE__ */
|
|
1447
|
-
/* @__PURE__ */
|
|
1448
|
-
] }) : hasContent ? /* @__PURE__ */
|
|
1449
|
-
/* @__PURE__ */
|
|
1450
|
-
/* @__PURE__ */
|
|
1548
|
+
/* @__PURE__ */ jsx10("span", { className: "sia-switch__thumb" }),
|
|
1549
|
+
variant === "segmented" ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
1550
|
+
/* @__PURE__ */ jsx10("span", { className: "sia-switch__segment sia-switch__segment--unchecked", children: uncheckedVisual }),
|
|
1551
|
+
/* @__PURE__ */ jsx10("span", { className: "sia-switch__segment sia-switch__segment--checked", children: checkedVisual })
|
|
1552
|
+
] }) : hasContent ? /* @__PURE__ */ jsxs10("span", { className: "sia-switch__content", children: [
|
|
1553
|
+
/* @__PURE__ */ jsx10("span", { className: "sia-switch__content-item sia-switch__content-item--unchecked", children: uncheckedVisual }),
|
|
1554
|
+
/* @__PURE__ */ jsx10("span", { className: "sia-switch__content-item sia-switch__content-item--checked", children: checkedVisual })
|
|
1451
1555
|
] }) : null
|
|
1452
1556
|
]
|
|
1453
1557
|
}
|
|
1454
1558
|
),
|
|
1455
|
-
label ? /* @__PURE__ */
|
|
1559
|
+
label ? /* @__PURE__ */ jsx10("span", { className: "sia-switch__label", children: label }) : null
|
|
1456
1560
|
] });
|
|
1457
1561
|
});
|
|
1458
1562
|
function pathArray(name) {
|
|
@@ -1635,7 +1739,7 @@ var FormStore = class {
|
|
|
1635
1739
|
};
|
|
1636
1740
|
var FormContext = createContext2(null);
|
|
1637
1741
|
function useForm(form) {
|
|
1638
|
-
const ref =
|
|
1742
|
+
const ref = useRef6(form ?? new FormStore());
|
|
1639
1743
|
return [ref.current];
|
|
1640
1744
|
}
|
|
1641
1745
|
function FormRoot({
|
|
@@ -1659,7 +1763,7 @@ function FormRoot({
|
|
|
1659
1763
|
const instance = internalForm;
|
|
1660
1764
|
instance.configure(initialValues, { onFinish, onFinishFailed, onValuesChange });
|
|
1661
1765
|
const context = useMemo4(() => instance, [instance]);
|
|
1662
|
-
const formRef =
|
|
1766
|
+
const formRef = useRef6(null);
|
|
1663
1767
|
useLayoutEffect2(() => {
|
|
1664
1768
|
const root = formRef.current;
|
|
1665
1769
|
if (!root) return;
|
|
@@ -1700,7 +1804,7 @@ function FormRoot({
|
|
|
1700
1804
|
if (frame) cancelAnimationFrame(frame);
|
|
1701
1805
|
};
|
|
1702
1806
|
}, []);
|
|
1703
|
-
return /* @__PURE__ */
|
|
1807
|
+
return /* @__PURE__ */ jsx10(FormContext.Provider, { value: context, children: /* @__PURE__ */ jsx10(PlaceholderModeContext.Provider, { value: resolvedPlaceholderMode, children: /* @__PURE__ */ jsx10(ControlSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx10(
|
|
1704
1808
|
"form",
|
|
1705
1809
|
{
|
|
1706
1810
|
ref: formRef,
|
|
@@ -1712,7 +1816,7 @@ function FormRoot({
|
|
|
1712
1816
|
event.stopPropagation();
|
|
1713
1817
|
instance.submit();
|
|
1714
1818
|
},
|
|
1715
|
-
children: /* @__PURE__ */
|
|
1819
|
+
children: /* @__PURE__ */ jsx10("fieldset", { disabled, children })
|
|
1716
1820
|
}
|
|
1717
1821
|
) }) }) });
|
|
1718
1822
|
}
|
|
@@ -1739,7 +1843,7 @@ function FormItem({
|
|
|
1739
1843
|
}) {
|
|
1740
1844
|
const form = useContext2(FormContext);
|
|
1741
1845
|
const id = useId3();
|
|
1742
|
-
const itemRef =
|
|
1846
|
+
const itemRef = useRef6(null);
|
|
1743
1847
|
if (!form) throw new Error("Form.Item \u5FC5\u987B\u5728 Form \u5185\u4F7F\u7528");
|
|
1744
1848
|
useSyncExternalStore(form.subscribe, form.getSnapshot, form.getSnapshot);
|
|
1745
1849
|
const path = name === void 0 ? void 0 : pathArray(name);
|
|
@@ -1750,7 +1854,7 @@ function FormItem({
|
|
|
1750
1854
|
const helpContent = help ?? errors[0];
|
|
1751
1855
|
const labelId = label && !noStyle ? `${id}-label` : void 0;
|
|
1752
1856
|
const errorId = `${id}-error`;
|
|
1753
|
-
|
|
1857
|
+
useEffect4(() => {
|
|
1754
1858
|
if (!path) return void 0;
|
|
1755
1859
|
return form.registerField({
|
|
1756
1860
|
name: path,
|
|
@@ -1793,21 +1897,21 @@ function FormItem({
|
|
|
1793
1897
|
content = children;
|
|
1794
1898
|
}
|
|
1795
1899
|
}
|
|
1796
|
-
if (noStyle) return /* @__PURE__ */
|
|
1797
|
-
const inputWrap = /* @__PURE__ */
|
|
1900
|
+
if (noStyle) return /* @__PURE__ */ jsx10(Fragment3, { children: content });
|
|
1901
|
+
const inputWrap = /* @__PURE__ */ jsx10("div", { className: "sia-form-item__input-wrap", children: content });
|
|
1798
1902
|
const hasError = status === "error" && Boolean(helpContent);
|
|
1799
|
-
return /* @__PURE__ */
|
|
1800
|
-
label ? /* @__PURE__ */
|
|
1801
|
-
ruleRequired ? /* @__PURE__ */
|
|
1903
|
+
return /* @__PURE__ */ jsxs10("div", { ref: itemRef, className: `sia-form-item${status ? ` sia-form-item--${status}` : ""} ${className}`.trim(), "data-sia-form-field": key || void 0, children: [
|
|
1904
|
+
label ? /* @__PURE__ */ jsx10("div", { id: labelId, className: "sia-form-item__label", children: /* @__PURE__ */ jsxs10("span", { className: "sia-form-item__label-content", children: [
|
|
1905
|
+
ruleRequired ? /* @__PURE__ */ jsx10("span", { className: "sia-form-item__required-mark", "aria-hidden": "true", children: "*" }) : null,
|
|
1802
1906
|
label
|
|
1803
1907
|
] }) }) : null,
|
|
1804
|
-
/* @__PURE__ */
|
|
1805
|
-
/* @__PURE__ */
|
|
1908
|
+
/* @__PURE__ */ jsxs10("div", { className: "sia-form-item__control", children: [
|
|
1909
|
+
/* @__PURE__ */ jsx10(
|
|
1806
1910
|
Tooltip,
|
|
1807
1911
|
{
|
|
1808
|
-
title: hasError ? /* @__PURE__ */
|
|
1809
|
-
/* @__PURE__ */
|
|
1810
|
-
/* @__PURE__ */
|
|
1912
|
+
title: hasError ? /* @__PURE__ */ jsxs10("span", { id: errorId, className: "sia-form-item__error-content", children: [
|
|
1913
|
+
/* @__PURE__ */ jsx10(Icon, { className: "sia-form-item__error-icon", name: "circle-close", variant: "filled", size: 16, "aria-hidden": "true" }),
|
|
1914
|
+
/* @__PURE__ */ jsx10("span", { children: helpContent })
|
|
1811
1915
|
] }) : null,
|
|
1812
1916
|
placement: "bottom-start",
|
|
1813
1917
|
trigger: [],
|
|
@@ -1818,8 +1922,8 @@ function FormItem({
|
|
|
1818
1922
|
children: inputWrap
|
|
1819
1923
|
}
|
|
1820
1924
|
),
|
|
1821
|
-
status !== "error" && helpContent ? /* @__PURE__ */
|
|
1822
|
-
extra ? /* @__PURE__ */
|
|
1925
|
+
status !== "error" && helpContent ? /* @__PURE__ */ jsx10("div", { className: "sia-form-item__help", children: helpContent }) : null,
|
|
1926
|
+
extra ? /* @__PURE__ */ jsx10("div", { className: "sia-form-item__extra", children: extra }) : null
|
|
1823
1927
|
] })
|
|
1824
1928
|
] });
|
|
1825
1929
|
}
|
|
@@ -1849,7 +1953,7 @@ function FormList({ name, children }) {
|
|
|
1849
1953
|
return children(values.map((_, index) => ({ key: index, name: index })), operations);
|
|
1850
1954
|
}
|
|
1851
1955
|
function FormErrorList({ errors = [] }) {
|
|
1852
|
-
return errors.length ? /* @__PURE__ */
|
|
1956
|
+
return errors.length ? /* @__PURE__ */ jsx10("div", { className: "sia-form-error-list", children: errors.map((error, index) => /* @__PURE__ */ jsx10("div", { children: error }, index)) }) : null;
|
|
1853
1957
|
}
|
|
1854
1958
|
var Form = Object.assign(FormRoot, {
|
|
1855
1959
|
/** 表单字段,负责字段值绑定、校验和标签布局。 */
|
|
@@ -1864,7 +1968,7 @@ var Form = Object.assign(FormRoot, {
|
|
|
1864
1968
|
|
|
1865
1969
|
// src/components/Radio.tsx
|
|
1866
1970
|
import { createContext as createContext3, forwardRef as forwardRef3, useContext as useContext3, useId as useId4, useMemo as useMemo5 } from "react";
|
|
1867
|
-
import { jsx as
|
|
1971
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1868
1972
|
var RadioContext = createContext3(null);
|
|
1869
1973
|
var RadioRoot = forwardRef3(function Radio({ value, size: sizeProp, children, disabled, checked, defaultChecked, button = false, className = "", onChange, ...props }, ref) {
|
|
1870
1974
|
const size = useControlSize(sizeProp);
|
|
@@ -1872,8 +1976,8 @@ var RadioRoot = forwardRef3(function Radio({ value, size: sizeProp, children, di
|
|
|
1872
1976
|
const fallbackId = useId4();
|
|
1873
1977
|
const grouped = group !== null;
|
|
1874
1978
|
const currentChecked = grouped ? group.value === value : checked;
|
|
1875
|
-
return /* @__PURE__ */
|
|
1876
|
-
/* @__PURE__ */
|
|
1979
|
+
return /* @__PURE__ */ jsxs11("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: [
|
|
1980
|
+
/* @__PURE__ */ jsx11(
|
|
1877
1981
|
"input",
|
|
1878
1982
|
{
|
|
1879
1983
|
...withTitleTooltip(props),
|
|
@@ -1892,12 +1996,12 @@ var RadioRoot = forwardRef3(function Radio({ value, size: sizeProp, children, di
|
|
|
1892
1996
|
}
|
|
1893
1997
|
}
|
|
1894
1998
|
),
|
|
1895
|
-
button ? null : /* @__PURE__ */
|
|
1896
|
-
children !== void 0 ? /* @__PURE__ */
|
|
1999
|
+
button ? null : /* @__PURE__ */ jsx11("span", { className: "sia-radio__control", "aria-hidden": "true", children: /* @__PURE__ */ jsx11("span", {}) }),
|
|
2000
|
+
children !== void 0 ? /* @__PURE__ */ jsx11("span", { className: "sia-radio__label", children }) : null
|
|
1897
2001
|
] });
|
|
1898
2002
|
});
|
|
1899
2003
|
function RadioButton(props) {
|
|
1900
|
-
return /* @__PURE__ */
|
|
2004
|
+
return /* @__PURE__ */ jsx11(RadioRoot, { ...props, button: true });
|
|
1901
2005
|
}
|
|
1902
2006
|
function RadioGroup({
|
|
1903
2007
|
size: sizeProp,
|
|
@@ -1929,10 +2033,10 @@ function RadioGroup({
|
|
|
1929
2033
|
setValue: setValue2
|
|
1930
2034
|
}), [buttonStyle, currentValue, disabled, fallbackName, name, setValue2]);
|
|
1931
2035
|
const Component = optionType === "button" ? RadioButton : RadioRoot;
|
|
1932
|
-
return /* @__PURE__ */
|
|
2036
|
+
return /* @__PURE__ */ jsx11(ControlSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx11(RadioContext.Provider, { value: context, children: /* @__PURE__ */ jsxs11("div", { className: `sia-radio-group${optionType === "button" ? " sia-radio-group--button" : ""} ${className}`.trim(), role: "radiogroup", children: [
|
|
1933
2037
|
options?.map((option) => {
|
|
1934
2038
|
const normalized = typeof option === "object" ? option : { label: String(option), value: option };
|
|
1935
|
-
return /* @__PURE__ */
|
|
2039
|
+
return /* @__PURE__ */ jsx11(Component, { value: normalized.value, disabled: normalized.disabled, children: normalized.label }, normalized.value);
|
|
1936
2040
|
}),
|
|
1937
2041
|
children
|
|
1938
2042
|
] }) }) });
|
|
@@ -1945,8 +2049,8 @@ var Radio2 = Object.assign(RadioRoot, {
|
|
|
1945
2049
|
});
|
|
1946
2050
|
|
|
1947
2051
|
// src/components/Slider.tsx
|
|
1948
|
-
import { useState as
|
|
1949
|
-
import { jsx as
|
|
2052
|
+
import { useState as useState8 } from "react";
|
|
2053
|
+
import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1950
2054
|
function percent(value, min, max) {
|
|
1951
2055
|
return (value - min) / (max - min) * 100;
|
|
1952
2056
|
}
|
|
@@ -1969,7 +2073,7 @@ function Slider({
|
|
|
1969
2073
|
}) {
|
|
1970
2074
|
const fallback = defaultValue ?? (range ? [min, max] : min);
|
|
1971
2075
|
const [currentValue, setValue2] = useControllableState({ value, defaultValue: fallback, onChange });
|
|
1972
|
-
const [activeThumb, setActiveThumb] =
|
|
2076
|
+
const [activeThumb, setActiveThumb] = useState8(null);
|
|
1973
2077
|
const values = Array.isArray(currentValue) ? [...currentValue] : [currentValue];
|
|
1974
2078
|
const start = range ? percent(Math.min(values[0], values[1]), min, max) : 0;
|
|
1975
2079
|
const end = percent(range ? Math.max(values[0], values[1]) : values[0], min, max);
|
|
@@ -1991,16 +2095,16 @@ function Slider({
|
|
|
1991
2095
|
onChangeComplete?.(currentValue);
|
|
1992
2096
|
setActiveThumb(null);
|
|
1993
2097
|
}
|
|
1994
|
-
return /* @__PURE__ */
|
|
2098
|
+
return /* @__PURE__ */ jsxs12(
|
|
1995
2099
|
"div",
|
|
1996
2100
|
{
|
|
1997
2101
|
className: `sia-slider${range ? " sia-slider--range" : ""}${vertical ? " sia-slider--vertical" : ""}${reverse ? " sia-slider--reverse" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
1998
2102
|
style,
|
|
1999
2103
|
...withTitleTooltip(props),
|
|
2000
2104
|
children: [
|
|
2001
|
-
/* @__PURE__ */
|
|
2002
|
-
values.map((item, index) => /* @__PURE__ */
|
|
2003
|
-
/* @__PURE__ */
|
|
2105
|
+
/* @__PURE__ */ jsx12("div", { className: "sia-slider__rail", children: /* @__PURE__ */ jsx12("span", { className: "sia-slider__track" }) }),
|
|
2106
|
+
values.map((item, index) => /* @__PURE__ */ jsxs12("div", { className: "sia-slider__thumb-wrap", children: [
|
|
2107
|
+
/* @__PURE__ */ jsx12(
|
|
2004
2108
|
"input",
|
|
2005
2109
|
{
|
|
2006
2110
|
className: "sia-slider__input",
|
|
@@ -2019,12 +2123,12 @@ function Slider({
|
|
|
2019
2123
|
onTouchEnd: finish
|
|
2020
2124
|
}
|
|
2021
2125
|
),
|
|
2022
|
-
tooltip?.open || activeThumb === index ? /* @__PURE__ */
|
|
2126
|
+
tooltip?.open || activeThumb === index ? /* @__PURE__ */ jsx12(
|
|
2023
2127
|
"span",
|
|
2024
2128
|
{
|
|
2025
2129
|
className: "sia-slider__tooltip-anchor",
|
|
2026
2130
|
style: { "--sia-slider-value": `${percent(item, min, max)}%` },
|
|
2027
|
-
children: /* @__PURE__ */
|
|
2131
|
+
children: /* @__PURE__ */ jsx12(
|
|
2028
2132
|
Tooltip,
|
|
2029
2133
|
{
|
|
2030
2134
|
title: tooltip?.formatter ? tooltip.formatter(item) : item,
|
|
@@ -2032,16 +2136,16 @@ function Slider({
|
|
|
2032
2136
|
trigger: [],
|
|
2033
2137
|
open: true,
|
|
2034
2138
|
overlayClassName: "sia-slider__tooltip",
|
|
2035
|
-
children: /* @__PURE__ */
|
|
2139
|
+
children: /* @__PURE__ */ jsx12("span", { className: "sia-slider__tooltip-target" })
|
|
2036
2140
|
}
|
|
2037
2141
|
)
|
|
2038
2142
|
}
|
|
2039
2143
|
) : null
|
|
2040
2144
|
] }, index)),
|
|
2041
|
-
marks ? /* @__PURE__ */
|
|
2145
|
+
marks ? /* @__PURE__ */ jsx12("div", { className: "sia-slider__marks", children: Object.entries(marks).map(([rawValue, mark]) => {
|
|
2042
2146
|
const numericValue = Number(rawValue);
|
|
2043
2147
|
const normalized = typeof mark === "object" && mark !== null && "label" in mark ? mark : { label: mark };
|
|
2044
|
-
return /* @__PURE__ */
|
|
2148
|
+
return /* @__PURE__ */ jsxs12(
|
|
2045
2149
|
"button",
|
|
2046
2150
|
{
|
|
2047
2151
|
type: "button",
|
|
@@ -2050,7 +2154,7 @@ function Slider({
|
|
|
2050
2154
|
disabled,
|
|
2051
2155
|
onClick: () => setValue2(range ? [values[0], numericValue].sort((a, b) => a - b) : numericValue),
|
|
2052
2156
|
children: [
|
|
2053
|
-
/* @__PURE__ */
|
|
2157
|
+
/* @__PURE__ */ jsx12("span", {}),
|
|
2054
2158
|
normalized.label
|
|
2055
2159
|
]
|
|
2056
2160
|
},
|
|
@@ -2063,8 +2167,8 @@ function Slider({
|
|
|
2063
2167
|
}
|
|
2064
2168
|
|
|
2065
2169
|
// src/components/ColorPicker.tsx
|
|
2066
|
-
import { useEffect as
|
|
2067
|
-
import { jsx as
|
|
2170
|
+
import { useEffect as useEffect5, useRef as useRef7, useState as useState9 } from "react";
|
|
2171
|
+
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2068
2172
|
var DEFAULT_MODES = ["solid", "gradient"];
|
|
2069
2173
|
var gradientStopSeed = 0;
|
|
2070
2174
|
function clamp3(value, min, max) {
|
|
@@ -2154,12 +2258,12 @@ function ColorPicker({
|
|
|
2154
2258
|
...props
|
|
2155
2259
|
}) {
|
|
2156
2260
|
const size = useControlSize(sizeProp);
|
|
2157
|
-
const rootRef =
|
|
2158
|
-
const popupRef =
|
|
2159
|
-
const lastEmittedValue =
|
|
2261
|
+
const rootRef = useRef7(null);
|
|
2262
|
+
const popupRef = useRef7(null);
|
|
2263
|
+
const lastEmittedValue = useRef7();
|
|
2160
2264
|
const initialGradient = parseGradient(value ?? defaultValue);
|
|
2161
2265
|
const initialSolid = initialGradient?.stops[0]?.color ?? normalizeHex(value || defaultValue);
|
|
2162
|
-
const [open, setOpen] =
|
|
2266
|
+
const [open, setOpen] = useState9(false);
|
|
2163
2267
|
const [color, setColor] = useControllableState({
|
|
2164
2268
|
value,
|
|
2165
2269
|
defaultValue: initialGradient ? formatGradient(initialGradient.angle, initialGradient.stops.map((stop, index) => ({ id: index, ...stop }))) : normalizeHex(defaultValue),
|
|
@@ -2170,17 +2274,17 @@ function ColorPicker({
|
|
|
2170
2274
|
defaultValue: initialGradient ? "gradient" : defaultMode,
|
|
2171
2275
|
onChange: onModeChange
|
|
2172
2276
|
});
|
|
2173
|
-
const [solidColor, setSolidColor] =
|
|
2174
|
-
const [gradientAngle, setGradientAngle] =
|
|
2175
|
-
const [gradientStops, setGradientStops] =
|
|
2176
|
-
const [activeStopId, setActiveStopId] =
|
|
2277
|
+
const [solidColor, setSolidColor] = useState9(initialSolid);
|
|
2278
|
+
const [gradientAngle, setGradientAngle] = useState9(initialGradient?.angle ?? 90);
|
|
2279
|
+
const [gradientStops, setGradientStops] = useState9(() => initialGradient ? initialGradient.stops.map((stop) => createStop(stop.color, stop.position)) : createDefaultStops(initialSolid));
|
|
2280
|
+
const [activeStopId, setActiveStopId] = useState9(() => gradientStops[0]?.id ?? 0);
|
|
2177
2281
|
const activeStop = gradientStops.find((stop) => stop.id === activeStopId) ?? gradientStops[0];
|
|
2178
2282
|
const editingColor = currentMode === "gradient" ? activeStop?.color ?? solidColor : solidColor;
|
|
2179
2283
|
const rgba = parseHex(editingColor) ?? parseHex("#1677FF");
|
|
2180
2284
|
const hsv = rgbToHsv(rgba);
|
|
2181
|
-
const [hexDraft, setHexDraft] =
|
|
2285
|
+
const [hexDraft, setHexDraft] = useState9(editingColor);
|
|
2182
2286
|
const gradientValue = formatGradient(gradientAngle, gradientStops);
|
|
2183
|
-
|
|
2287
|
+
useEffect5(() => {
|
|
2184
2288
|
if (!open) return void 0;
|
|
2185
2289
|
const close = (event) => {
|
|
2186
2290
|
const target = event.target;
|
|
@@ -2189,10 +2293,10 @@ function ColorPicker({
|
|
|
2189
2293
|
document.addEventListener("pointerdown", close);
|
|
2190
2294
|
return () => document.removeEventListener("pointerdown", close);
|
|
2191
2295
|
}, [open]);
|
|
2192
|
-
|
|
2296
|
+
useEffect5(() => {
|
|
2193
2297
|
setHexDraft(editingColor);
|
|
2194
2298
|
}, [editingColor]);
|
|
2195
|
-
|
|
2299
|
+
useEffect5(() => {
|
|
2196
2300
|
if (value === void 0 || value === lastEmittedValue.current) return;
|
|
2197
2301
|
const parsed = parseGradient(value);
|
|
2198
2302
|
if (parsed) {
|
|
@@ -2254,8 +2358,8 @@ function ColorPicker({
|
|
|
2254
2358
|
const triggerBackground = color || "transparent";
|
|
2255
2359
|
const triggerText = color || "\u65E0\u8272";
|
|
2256
2360
|
const opaqueColor = rgbaToHex({ ...rgba, a: 100 }, false);
|
|
2257
|
-
return /* @__PURE__ */
|
|
2258
|
-
/* @__PURE__ */
|
|
2361
|
+
return /* @__PURE__ */ jsxs13("div", { ref: rootRef, className: `sia-color-picker sia-color-picker--${size}${disabled ? " is-disabled" : ""} ${className}`.trim(), ...withTitleTooltip(props), children: [
|
|
2362
|
+
/* @__PURE__ */ jsxs13(
|
|
2259
2363
|
"button",
|
|
2260
2364
|
{
|
|
2261
2365
|
type: "button",
|
|
@@ -2265,19 +2369,19 @@ function ColorPicker({
|
|
|
2265
2369
|
"aria-expanded": open,
|
|
2266
2370
|
onClick: () => setOpen((current) => !current),
|
|
2267
2371
|
children: [
|
|
2268
|
-
/* @__PURE__ */
|
|
2269
|
-
showText ? /* @__PURE__ */
|
|
2270
|
-
/* @__PURE__ */
|
|
2372
|
+
/* @__PURE__ */ jsx13("span", { className: `sia-color-picker__swatch${color ? "" : " is-empty"}`, style: color ? { background: triggerBackground } : void 0 }),
|
|
2373
|
+
showText ? /* @__PURE__ */ jsx13("span", { className: "sia-color-picker__trigger-text", children: typeof showText === "function" ? showText(color) : triggerText }) : null,
|
|
2374
|
+
/* @__PURE__ */ jsx13(Icon, { name: "chevron-down", size: 14 })
|
|
2271
2375
|
]
|
|
2272
2376
|
}
|
|
2273
2377
|
),
|
|
2274
|
-
/* @__PURE__ */
|
|
2275
|
-
/* @__PURE__ */
|
|
2276
|
-
modes.length > 1 ? /* @__PURE__ */
|
|
2277
|
-
allowClear ? /* @__PURE__ */
|
|
2378
|
+
/* @__PURE__ */ jsxs13(PopupPortal, { ref: popupRef, anchorRef: rootRef, open, className: "sia-color-picker__popup", role: "dialog", "aria-label": "\u989C\u8272\u9009\u62E9\u5668", children: [
|
|
2379
|
+
/* @__PURE__ */ jsxs13("div", { className: "sia-color-picker__mode-row", children: [
|
|
2380
|
+
modes.length > 1 ? /* @__PURE__ */ jsx13("div", { className: "sia-color-picker__modes", role: "tablist", "aria-label": "\u989C\u8272\u6A21\u5F0F", children: modes.map((item) => /* @__PURE__ */ jsx13("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__ */ jsx13("strong", { children: currentMode === "solid" ? "\u5355\u8272" : "\u6E10\u53D8\u8272" }),
|
|
2381
|
+
allowClear ? /* @__PURE__ */ jsx13("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__ */ jsx13("span", {}) }) : null
|
|
2278
2382
|
] }),
|
|
2279
|
-
currentMode === "gradient" ? /* @__PURE__ */
|
|
2280
|
-
/* @__PURE__ */
|
|
2383
|
+
currentMode === "gradient" ? /* @__PURE__ */ jsxs13("div", { className: "sia-color-picker__gradient-editor", children: [
|
|
2384
|
+
/* @__PURE__ */ jsx13("div", { className: "sia-color-picker__gradient-preview", style: { background: gradientValue }, onPointerDown: addGradientStop, children: gradientStops.map((stop) => /* @__PURE__ */ jsx13(
|
|
2281
2385
|
"button",
|
|
2282
2386
|
{
|
|
2283
2387
|
type: "button",
|
|
@@ -2289,40 +2393,40 @@ function ColorPicker({
|
|
|
2289
2393
|
},
|
|
2290
2394
|
stop.id
|
|
2291
2395
|
)) }),
|
|
2292
|
-
/* @__PURE__ */
|
|
2293
|
-
/* @__PURE__ */
|
|
2396
|
+
/* @__PURE__ */ jsxs13("div", { className: "sia-color-picker__gradient-controls", children: [
|
|
2397
|
+
/* @__PURE__ */ jsxs13("label", { children: [
|
|
2294
2398
|
"\u65B9\u5411 ",
|
|
2295
|
-
/* @__PURE__ */
|
|
2399
|
+
/* @__PURE__ */ jsx13("input", { type: "number", min: 0, max: 360, value: Math.round(gradientAngle), onChange: (event) => {
|
|
2296
2400
|
const nextAngle = clamp3(Number(event.currentTarget.value), 0, 360);
|
|
2297
2401
|
setGradientAngle(nextAngle);
|
|
2298
2402
|
emit(formatGradient(nextAngle, gradientStops));
|
|
2299
2403
|
}, onBlur: () => onChangeComplete?.(formatGradient(gradientAngle, gradientStops)) }),
|
|
2300
|
-
/* @__PURE__ */
|
|
2404
|
+
/* @__PURE__ */ jsx13("span", { children: "\xB0" })
|
|
2301
2405
|
] }),
|
|
2302
|
-
/* @__PURE__ */
|
|
2406
|
+
/* @__PURE__ */ jsxs13("label", { children: [
|
|
2303
2407
|
"\u4F4D\u7F6E ",
|
|
2304
|
-
/* @__PURE__ */
|
|
2408
|
+
/* @__PURE__ */ jsx13("input", { type: "range", min: 0, max: 100, value: activeStop?.position ?? 0, onChange: (event) => {
|
|
2305
2409
|
if (!activeStop) return;
|
|
2306
2410
|
emitGradient(gradientStops.map((stop) => stop.id === activeStop.id ? { ...stop, position: Number(event.currentTarget.value) } : stop));
|
|
2307
2411
|
}, onPointerUp: () => onChangeComplete?.(formatGradient(gradientAngle, gradientStops)) }),
|
|
2308
|
-
/* @__PURE__ */
|
|
2412
|
+
/* @__PURE__ */ jsxs13("span", { children: [
|
|
2309
2413
|
Math.round(activeStop?.position ?? 0),
|
|
2310
2414
|
"%"
|
|
2311
2415
|
] })
|
|
2312
2416
|
] }),
|
|
2313
|
-
/* @__PURE__ */
|
|
2417
|
+
/* @__PURE__ */ jsxs13("button", { type: "button", disabled: gradientStops.length <= 2, onClick: () => {
|
|
2314
2418
|
if (!activeStop || gradientStops.length <= 2) return;
|
|
2315
2419
|
const index = gradientStops.findIndex((stop) => stop.id === activeStop.id);
|
|
2316
2420
|
const nextStops = gradientStops.filter((stop) => stop.id !== activeStop.id);
|
|
2317
2421
|
setActiveStopId(nextStops[Math.max(0, index - 1)]?.id ?? nextStops[0]?.id ?? 0);
|
|
2318
2422
|
emitGradient(nextStops, gradientAngle, true);
|
|
2319
2423
|
}, children: [
|
|
2320
|
-
/* @__PURE__ */
|
|
2424
|
+
/* @__PURE__ */ jsx13(Icon, { name: "minus", size: 14 }),
|
|
2321
2425
|
" \u5220\u9664\u8272\u6807"
|
|
2322
2426
|
] })
|
|
2323
2427
|
] })
|
|
2324
2428
|
] }) : null,
|
|
2325
|
-
/* @__PURE__ */
|
|
2429
|
+
/* @__PURE__ */ jsx13(
|
|
2326
2430
|
"div",
|
|
2327
2431
|
{
|
|
2328
2432
|
className: "sia-color-picker__saturation",
|
|
@@ -2338,28 +2442,28 @@ function ColorPicker({
|
|
|
2338
2442
|
updateSaturation(event, true);
|
|
2339
2443
|
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
2340
2444
|
},
|
|
2341
|
-
children: /* @__PURE__ */
|
|
2445
|
+
children: /* @__PURE__ */ jsx13("span", { style: { left: `${hsv.s}%`, top: `${100 - hsv.v}%` } })
|
|
2342
2446
|
}
|
|
2343
2447
|
),
|
|
2344
|
-
/* @__PURE__ */
|
|
2345
|
-
/* @__PURE__ */
|
|
2346
|
-
/* @__PURE__ */
|
|
2448
|
+
/* @__PURE__ */ jsxs13("label", { className: "sia-color-picker__hue", children: [
|
|
2449
|
+
/* @__PURE__ */ jsx13("span", { className: "sia-color-picker__field-label", children: "\u8272\u76F8" }),
|
|
2450
|
+
/* @__PURE__ */ jsx13("input", { type: "range", min: 0, max: 360, value: Math.round(hsv.h), onChange: (event) => {
|
|
2347
2451
|
updateEditingColor(rgbaToHex(hsvToRgba(Number(event.currentTarget.value), hsv.s, hsv.v, rgba.a), showAlpha));
|
|
2348
2452
|
}, onPointerUp: () => onChangeComplete?.(currentMode === "gradient" ? gradientValue : solidColor) })
|
|
2349
2453
|
] }),
|
|
2350
|
-
showAlpha ? /* @__PURE__ */
|
|
2351
|
-
/* @__PURE__ */
|
|
2352
|
-
/* @__PURE__ */
|
|
2454
|
+
showAlpha ? /* @__PURE__ */ jsxs13("label", { className: "sia-color-picker__alpha", style: { "--sia-alpha-color": opaqueColor }, children: [
|
|
2455
|
+
/* @__PURE__ */ jsx13("span", { className: "sia-color-picker__field-label", children: "\u900F\u660E\u5EA6" }),
|
|
2456
|
+
/* @__PURE__ */ jsx13("input", { type: "range", min: 0, max: 100, value: rgba.a, onChange: (event) => {
|
|
2353
2457
|
updateEditingColor(rgbaToHex({ ...rgba, a: Number(event.currentTarget.value) }, true));
|
|
2354
2458
|
}, onPointerUp: () => onChangeComplete?.(currentMode === "gradient" ? gradientValue : solidColor) }),
|
|
2355
|
-
/* @__PURE__ */
|
|
2459
|
+
/* @__PURE__ */ jsxs13("span", { children: [
|
|
2356
2460
|
rgba.a,
|
|
2357
2461
|
"%"
|
|
2358
2462
|
] })
|
|
2359
2463
|
] }) : null,
|
|
2360
|
-
/* @__PURE__ */
|
|
2361
|
-
/* @__PURE__ */
|
|
2362
|
-
/* @__PURE__ */
|
|
2464
|
+
/* @__PURE__ */ jsxs13("div", { className: "sia-color-picker__value-row", children: [
|
|
2465
|
+
/* @__PURE__ */ jsx13("span", { children: "HEX" }),
|
|
2466
|
+
/* @__PURE__ */ jsx13("input", { "aria-label": "HEX", value: hexDraft, onChange: (event) => {
|
|
2363
2467
|
const next = event.currentTarget.value;
|
|
2364
2468
|
setHexDraft(next);
|
|
2365
2469
|
if (/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(next)) updateEditingColor(next);
|
|
@@ -2368,19 +2472,19 @@ function ColorPicker({
|
|
|
2368
2472
|
setHexDraft(normalized);
|
|
2369
2473
|
updateEditingColor(normalized, true);
|
|
2370
2474
|
} }),
|
|
2371
|
-
/* @__PURE__ */
|
|
2475
|
+
/* @__PURE__ */ jsx13("span", { className: `sia-color-picker__value-swatch${color ? "" : " is-empty"}`, style: color ? { background: editingColor } : void 0 })
|
|
2372
2476
|
] }),
|
|
2373
|
-
presets?.map((preset, index) => /* @__PURE__ */
|
|
2374
|
-
preset.label ? /* @__PURE__ */
|
|
2375
|
-
/* @__PURE__ */
|
|
2477
|
+
presets?.map((preset, index) => /* @__PURE__ */ jsxs13("div", { className: "sia-color-picker__preset", children: [
|
|
2478
|
+
preset.label ? /* @__PURE__ */ jsx13("strong", { children: preset.label }) : null,
|
|
2479
|
+
/* @__PURE__ */ jsx13("div", { children: preset.colors.map((presetColor) => /* @__PURE__ */ jsx13("button", { type: "button", "aria-label": `\u9009\u62E9\u989C\u8272 ${presetColor}`, style: { background: presetColor }, onClick: () => updateEditingColor(presetColor, true) }, presetColor)) })
|
|
2376
2480
|
] }, index))
|
|
2377
2481
|
] })
|
|
2378
2482
|
] });
|
|
2379
2483
|
}
|
|
2380
2484
|
|
|
2381
2485
|
// src/components/TimePicker.tsx
|
|
2382
|
-
import { useEffect as
|
|
2383
|
-
import { jsx as
|
|
2486
|
+
import { useEffect as useEffect6, useId as useId5, useRef as useRef8, useState as useState10 } from "react";
|
|
2487
|
+
import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2384
2488
|
function seconds(value) {
|
|
2385
2489
|
const [h = 0, m = 0, s = 0] = value.split(":").map(Number);
|
|
2386
2490
|
return h * 3600 + m * 60 + s;
|
|
@@ -2410,13 +2514,13 @@ function TimePicker({
|
|
|
2410
2514
|
}) {
|
|
2411
2515
|
const size = useControlSize(sizeProp);
|
|
2412
2516
|
const id = useId5();
|
|
2413
|
-
const rootRef =
|
|
2414
|
-
const inputRef =
|
|
2415
|
-
const popupRef =
|
|
2416
|
-
const focusPanel =
|
|
2517
|
+
const rootRef = useRef8(null);
|
|
2518
|
+
const inputRef = useRef8(null);
|
|
2519
|
+
const popupRef = useRef8(null);
|
|
2520
|
+
const focusPanel = useRef8(false);
|
|
2417
2521
|
const [currentValue, setValue2] = useControllableState({ value, defaultValue, onChange });
|
|
2418
|
-
const [open, setOpen] =
|
|
2419
|
-
const [draft, setDraft] =
|
|
2522
|
+
const [open, setOpen] = useState10(false);
|
|
2523
|
+
const [draft, setDraft] = useState10("00:00:00");
|
|
2420
2524
|
const normalize = (time) => showSecond ? (time + ":00").slice(0, 8) : time.slice(0, 5);
|
|
2421
2525
|
const unavailable = (time) => {
|
|
2422
2526
|
const normalized = normalize(time);
|
|
@@ -2434,7 +2538,7 @@ function TimePicker({
|
|
|
2434
2538
|
setOpen(next);
|
|
2435
2539
|
onOpenChange?.(next);
|
|
2436
2540
|
}
|
|
2437
|
-
|
|
2541
|
+
useEffect6(() => {
|
|
2438
2542
|
if (!open) return;
|
|
2439
2543
|
if (focusPanel.current) {
|
|
2440
2544
|
popupRef.current?.querySelector('[aria-selected="true"]')?.focus();
|
|
@@ -2459,8 +2563,8 @@ function TimePicker({
|
|
|
2459
2563
|
inputRef.current?.focus();
|
|
2460
2564
|
}
|
|
2461
2565
|
const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: Boolean(display), active: open });
|
|
2462
|
-
return /* @__PURE__ */
|
|
2463
|
-
/* @__PURE__ */
|
|
2566
|
+
return /* @__PURE__ */ jsxs14("span", { ref: rootRef, style, className: `sia-picker sia-time-picker${floating.className} sia-picker--${size} sia-picker--${status}${disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
2567
|
+
/* @__PURE__ */ jsx14(
|
|
2464
2568
|
"input",
|
|
2465
2569
|
{
|
|
2466
2570
|
...withTitleTooltip(props),
|
|
@@ -2497,12 +2601,12 @@ function TimePicker({
|
|
|
2497
2601
|
}
|
|
2498
2602
|
),
|
|
2499
2603
|
floating.label,
|
|
2500
|
-
allowClear && currentValue && !disabled && !readOnly ? /* @__PURE__ */
|
|
2604
|
+
allowClear && currentValue && !disabled && !readOnly ? /* @__PURE__ */ jsx14("button", { type: "button", className: "sia-picker__clear", "aria-label": "\u6E05\u9664\u65F6\u95F4", onMouseDown: (event) => event.preventDefault(), onClick: () => {
|
|
2501
2605
|
setValue2("");
|
|
2502
2606
|
changeOpen(false);
|
|
2503
|
-
}, children: /* @__PURE__ */
|
|
2504
|
-
/* @__PURE__ */
|
|
2505
|
-
/* @__PURE__ */
|
|
2607
|
+
}, children: /* @__PURE__ */ jsx14(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
|
|
2608
|
+
/* @__PURE__ */ jsx14("span", { className: "sia-picker__icon", "aria-hidden": "true", children: suffixIcon ?? /* @__PURE__ */ jsx14(Icon, { name: "clock", size: 16 }) }),
|
|
2609
|
+
/* @__PURE__ */ jsxs14(
|
|
2506
2610
|
PopupPortal,
|
|
2507
2611
|
{
|
|
2508
2612
|
ref: popupRef,
|
|
@@ -2520,14 +2624,14 @@ function TimePicker({
|
|
|
2520
2624
|
}
|
|
2521
2625
|
},
|
|
2522
2626
|
children: [
|
|
2523
|
-
/* @__PURE__ */
|
|
2524
|
-
unavailable(draft) ? /* @__PURE__ */
|
|
2525
|
-
/* @__PURE__ */
|
|
2526
|
-
/* @__PURE__ */
|
|
2627
|
+
/* @__PURE__ */ jsx14(TimePanel, { value: draft, showSecond, use12Hours, onChange: setDraft }),
|
|
2628
|
+
unavailable(draft) ? /* @__PURE__ */ jsx14("div", { className: "sia-time-panel__error", role: "status", children: "\u8BE5\u65F6\u95F4\u4E0D\u53EF\u9009" }) : null,
|
|
2629
|
+
/* @__PURE__ */ jsxs14("footer", { className: "sia-time-panel__footer", children: [
|
|
2630
|
+
/* @__PURE__ */ jsx14(Button, { variant: "text", size: "small", onClick: () => {
|
|
2527
2631
|
const now = /* @__PURE__ */ new Date();
|
|
2528
2632
|
setDraft([now.getHours(), now.getMinutes(), showSecond ? now.getSeconds() : 0].map((part) => String(part).padStart(2, "0")).join(":"));
|
|
2529
2633
|
}, children: "\u6B64\u523B" }),
|
|
2530
|
-
/* @__PURE__ */
|
|
2634
|
+
/* @__PURE__ */ jsx14(Button, { variant: "primary", size: "small", disabled: unavailable(draft), onClick: confirm, children: "\u786E\u5B9A" })
|
|
2531
2635
|
] })
|
|
2532
2636
|
]
|
|
2533
2637
|
}
|
|
@@ -2542,10 +2646,10 @@ function TimeRangePicker({ value, defaultValue = ["", ""], placeholder = ["\u5F0
|
|
|
2542
2646
|
pair[index] = next;
|
|
2543
2647
|
setValue2(pair);
|
|
2544
2648
|
}
|
|
2545
|
-
return /* @__PURE__ */
|
|
2546
|
-
/* @__PURE__ */
|
|
2547
|
-
/* @__PURE__ */
|
|
2548
|
-
/* @__PURE__ */
|
|
2649
|
+
return /* @__PURE__ */ jsxs14("span", { style, className: `sia-time-range sia-picker--${size} sia-picker--${props.status ?? "default"}${props.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
2650
|
+
/* @__PURE__ */ jsx14(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) }),
|
|
2651
|
+
/* @__PURE__ */ jsx14("span", { className: "sia-time-range__separator", children: separator }),
|
|
2652
|
+
/* @__PURE__ */ jsx14(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) })
|
|
2549
2653
|
] });
|
|
2550
2654
|
}
|
|
2551
2655
|
((TimePicker2) => {
|
|
@@ -2553,8 +2657,8 @@ function TimeRangePicker({ value, defaultValue = ["", ""], placeholder = ["\u5F0
|
|
|
2553
2657
|
})(TimePicker || (TimePicker = {}));
|
|
2554
2658
|
|
|
2555
2659
|
// src/components/TreeSelect.tsx
|
|
2556
|
-
import { useEffect as
|
|
2557
|
-
import { Fragment as Fragment4, jsx as
|
|
2660
|
+
import { useEffect as useEffect7, useMemo as useMemo6, useRef as useRef9, useState as useState11 } from "react";
|
|
2661
|
+
import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2558
2662
|
function flattenTree(nodes, expanded, search, filter, depth = 0, parents = [], ancestorMatched = false) {
|
|
2559
2663
|
const result = [];
|
|
2560
2664
|
for (const node of nodes) {
|
|
@@ -2616,8 +2720,8 @@ function TreeSelect({
|
|
|
2616
2720
|
...props
|
|
2617
2721
|
}) {
|
|
2618
2722
|
const size = useControlSize(sizeProp);
|
|
2619
|
-
const rootRef =
|
|
2620
|
-
const popupRef =
|
|
2723
|
+
const rootRef = useRef9(null);
|
|
2724
|
+
const popupRef = useRef9(null);
|
|
2621
2725
|
const nodeIndex = useMemo6(() => {
|
|
2622
2726
|
const index = /* @__PURE__ */ new Map();
|
|
2623
2727
|
const visit = (nodes) => nodes.forEach((node) => {
|
|
@@ -2637,7 +2741,7 @@ function TreeSelect({
|
|
|
2637
2741
|
});
|
|
2638
2742
|
const [open, setOpen] = useControllableState({ value: controlledOpen, defaultValue: defaultOpen, onChange: onDropdownVisibleChange });
|
|
2639
2743
|
const [search, setSearch] = useControllableState({ value: searchValue, defaultValue: "", onChange: onSearch });
|
|
2640
|
-
const [expanded, setExpanded] =
|
|
2744
|
+
const [expanded, setExpanded] = useState11(() => {
|
|
2641
2745
|
if (!treeDefaultExpandAll) return new Set(treeDefaultExpandedKeys);
|
|
2642
2746
|
const values = [];
|
|
2643
2747
|
const collect = (nodes) => nodes.forEach((node) => {
|
|
@@ -2653,7 +2757,7 @@ function TreeSelect({
|
|
|
2653
2757
|
const expandedSet = treeExpandedKeys ? new Set(treeExpandedKeys) : expanded;
|
|
2654
2758
|
const selectedNodes = resolveNodes(selectedValues);
|
|
2655
2759
|
const visibleNodes = flattenTree(treeData, expandedSet, search, filterTreeNode);
|
|
2656
|
-
|
|
2760
|
+
useEffect7(() => {
|
|
2657
2761
|
if (!open || treeExpandedKeys) return;
|
|
2658
2762
|
const keys = new Set(expanded);
|
|
2659
2763
|
const walk = (nodes, parents) => nodes.forEach((node) => {
|
|
@@ -2713,7 +2817,7 @@ function TreeSelect({
|
|
|
2713
2817
|
setCurrentValue(multi ? [] : void 0);
|
|
2714
2818
|
onClear?.();
|
|
2715
2819
|
}
|
|
2716
|
-
|
|
2820
|
+
useEffect7(() => {
|
|
2717
2821
|
if (!open) return void 0;
|
|
2718
2822
|
const close = (event) => {
|
|
2719
2823
|
const target = event.target;
|
|
@@ -2765,7 +2869,7 @@ function TreeSelect({
|
|
|
2765
2869
|
}
|
|
2766
2870
|
}
|
|
2767
2871
|
const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: selectedNodes.length > 0, active: open });
|
|
2768
|
-
return /* @__PURE__ */
|
|
2872
|
+
return /* @__PURE__ */ jsxs15(
|
|
2769
2873
|
"div",
|
|
2770
2874
|
{
|
|
2771
2875
|
ref: rootRef,
|
|
@@ -2779,8 +2883,8 @@ function TreeSelect({
|
|
|
2779
2883
|
}
|
|
2780
2884
|
},
|
|
2781
2885
|
children: [
|
|
2782
|
-
renderTrigger ? renderTrigger({ open, toggle: () => changeOpen(!open), clear }) : /* @__PURE__ */
|
|
2783
|
-
/* @__PURE__ */
|
|
2886
|
+
renderTrigger ? renderTrigger({ open, toggle: () => changeOpen(!open), clear }) : /* @__PURE__ */ jsxs15(Fragment4, { children: [
|
|
2887
|
+
/* @__PURE__ */ jsxs15(
|
|
2784
2888
|
"button",
|
|
2785
2889
|
{
|
|
2786
2890
|
type: "button",
|
|
@@ -2798,24 +2902,24 @@ function TreeSelect({
|
|
|
2798
2902
|
if (event.key === "Escape") changeOpen(false);
|
|
2799
2903
|
},
|
|
2800
2904
|
children: [
|
|
2801
|
-
/* @__PURE__ */
|
|
2905
|
+
/* @__PURE__ */ jsx15("span", { className: "sia-tree-select__value", children: selectedNodes.length ? displayRender ? displayRender(selectedNodes) : multi ? /* @__PURE__ */ jsx15(OverflowTags, { tagClassName: "sia-tree-select__tag", maxCount: maxTagCount, items: selectedNodes.map((node) => ({ key: node.value, label: node.title })) }) : selectedNodes[0]?.title : /* @__PURE__ */ jsx15("span", { className: "sia-tree-select__placeholder", children: placeholder }) }),
|
|
2802
2906
|
floating.label,
|
|
2803
|
-
/* @__PURE__ */
|
|
2907
|
+
/* @__PURE__ */ jsx15(Icon, { name: open ? "chevron-up" : "chevron-down", size: 14 })
|
|
2804
2908
|
]
|
|
2805
2909
|
}
|
|
2806
2910
|
),
|
|
2807
|
-
allowClear && selectedValues.length > 0 && !disabled ? /* @__PURE__ */
|
|
2911
|
+
allowClear && selectedValues.length > 0 && !disabled ? /* @__PURE__ */ jsx15("button", { type: "button", className: "sia-tree-select__clear", "aria-label": "\u6E05\u9664\u9009\u62E9", onClick: clear, children: /* @__PURE__ */ jsx15(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null
|
|
2808
2912
|
] }),
|
|
2809
|
-
/* @__PURE__ */
|
|
2810
|
-
showSearch ? /* @__PURE__ */
|
|
2811
|
-
/* @__PURE__ */
|
|
2812
|
-
/* @__PURE__ */
|
|
2913
|
+
/* @__PURE__ */ jsxs15(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled, className: `sia-tree-select__dropdown ${popupClassName}`, style: popupStyle, children: [
|
|
2914
|
+
showSearch ? /* @__PURE__ */ jsxs15("label", { className: "sia-tree-select__search", children: [
|
|
2915
|
+
/* @__PURE__ */ jsx15(Icon, { name: "search", size: 15 }),
|
|
2916
|
+
/* @__PURE__ */ jsx15("input", { "aria-label": searchPlaceholder, autoFocus: true, value: search, placeholder: searchPlaceholder, onChange: (event) => setSearch(event.currentTarget.value) })
|
|
2813
2917
|
] }) : null,
|
|
2814
|
-
/* @__PURE__ */
|
|
2918
|
+
/* @__PURE__ */ jsx15("div", { className: "sia-tree-select__tree", role: "tree", "aria-multiselectable": multi || void 0, style: { maxHeight: listHeight }, children: loading ? /* @__PURE__ */ jsx15("div", { role: "status", className: "sia-tree-select__empty", children: "\u52A0\u8F7D\u4E2D\u2026" }) : visibleNodes.length ? visibleNodes.map((node) => {
|
|
2815
2919
|
const hasChildren = Boolean(node.children?.length);
|
|
2816
2920
|
const selected = checked.has(node.value);
|
|
2817
2921
|
const partial = cascade && !selected && affected(node).some((value2) => checked.has(value2));
|
|
2818
|
-
return /* @__PURE__ */
|
|
2922
|
+
return /* @__PURE__ */ jsxs15(
|
|
2819
2923
|
"div",
|
|
2820
2924
|
{
|
|
2821
2925
|
className: `sia-tree-select__node${selected ? " is-selected" : ""}${node.disabled ? " is-disabled" : ""}`,
|
|
@@ -2827,14 +2931,14 @@ function TreeSelect({
|
|
|
2827
2931
|
"aria-expanded": hasChildren ? !!search || expandedSet.has(node.key ?? node.value) : void 0,
|
|
2828
2932
|
"aria-checked": treeCheckable ? partial ? "mixed" : selected : void 0,
|
|
2829
2933
|
children: [
|
|
2830
|
-
hasChildren ? /* @__PURE__ */
|
|
2831
|
-
treeCheckable && node.checkable !== false ? /* @__PURE__ */
|
|
2832
|
-
/* @__PURE__ */
|
|
2934
|
+
hasChildren ? /* @__PURE__ */ jsx15("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__ */ jsx15(Icon, { name: expandedSet.has(node.key ?? node.value) ? "chevron-down" : "chevron-right", size: 13 }) }) : /* @__PURE__ */ jsx15("span", { className: "sia-tree-select__indent" }),
|
|
2935
|
+
treeCheckable && node.checkable !== false ? /* @__PURE__ */ jsx15(Checkbox, { "aria-label": typeof node.title === "string" ? node.title : void 0, checked: selected, indeterminate: partial, disabled: node.disabled || node.disableCheckbox, onChange: () => select(node) }) : null,
|
|
2936
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: "sia-tree-select__title", disabled: node.disabled, onClick: () => select(node), children: node.title })
|
|
2833
2937
|
]
|
|
2834
2938
|
},
|
|
2835
2939
|
node.key ?? node.value
|
|
2836
2940
|
);
|
|
2837
|
-
}) : /* @__PURE__ */
|
|
2941
|
+
}) : /* @__PURE__ */ jsx15("div", { className: "sia-tree-select__empty", children: "\u6682\u65E0\u5339\u914D\u8282\u70B9" }) }),
|
|
2838
2942
|
dropdownFooter
|
|
2839
2943
|
] })
|
|
2840
2944
|
]
|
|
@@ -2872,7 +2976,7 @@ function buildFlatTree(items, options = {}) {
|
|
|
2872
2976
|
}
|
|
2873
2977
|
|
|
2874
2978
|
// src/components/Editor.tsx
|
|
2875
|
-
import { useEffect as
|
|
2979
|
+
import { useEffect as useEffect8, useId as useId6, useRef as useRef10, useState as useState12 } from "react";
|
|
2876
2980
|
import EditorWorker from "monaco-editor/editor/editor.worker.js?worker";
|
|
2877
2981
|
|
|
2878
2982
|
// src/components/jsonLanguage.ts
|
|
@@ -3453,7 +3557,7 @@ function registerSqlLanguages(monaco) {
|
|
|
3453
3557
|
}
|
|
3454
3558
|
|
|
3455
3559
|
// src/components/Editor.tsx
|
|
3456
|
-
import { jsx as
|
|
3560
|
+
import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3457
3561
|
var EDITOR_COMMAND_SHORTCUTS = {
|
|
3458
3562
|
cut: "Ctrl+X",
|
|
3459
3563
|
copy: "Ctrl+C",
|
|
@@ -3548,29 +3652,29 @@ function Editor({
|
|
|
3548
3652
|
loadingText = "\u6B63\u5728\u52A0\u8F7D\u7F16\u8F91\u5668\u2026"
|
|
3549
3653
|
}) {
|
|
3550
3654
|
const generatedId = useId6();
|
|
3551
|
-
const containerRef =
|
|
3552
|
-
const rangeHighlightRef =
|
|
3553
|
-
const editorRef =
|
|
3554
|
-
const modelRef =
|
|
3555
|
-
const apiRef =
|
|
3556
|
-
const applyingControlledValueRef =
|
|
3557
|
-
const updateHighlightRef =
|
|
3558
|
-
const changeHandlerRef =
|
|
3559
|
-
const readyHandlerRef =
|
|
3560
|
-
const selectionHandlerRef =
|
|
3561
|
-
const keyDownHandlerRef =
|
|
3562
|
-
const highlightRangeRef =
|
|
3563
|
-
const markersRef =
|
|
3564
|
-
const contextMenuItemsRef =
|
|
3565
|
-
const completionProviderRef =
|
|
3566
|
-
const refreshSuggestionOnSpaceRef =
|
|
3567
|
-
const initialValueRef =
|
|
3568
|
-
const initialLanguageRef =
|
|
3569
|
-
const initialPathRef =
|
|
3570
|
-
const initialThemeRef =
|
|
3571
|
-
const initialOptionsRef =
|
|
3572
|
-
const [loading, setLoading] =
|
|
3573
|
-
const [, setSelectionVersion] =
|
|
3655
|
+
const containerRef = useRef10(null);
|
|
3656
|
+
const rangeHighlightRef = useRef10(null);
|
|
3657
|
+
const editorRef = useRef10(null);
|
|
3658
|
+
const modelRef = useRef10(null);
|
|
3659
|
+
const apiRef = useRef10(null);
|
|
3660
|
+
const applyingControlledValueRef = useRef10(false);
|
|
3661
|
+
const updateHighlightRef = useRef10(() => void 0);
|
|
3662
|
+
const changeHandlerRef = useRef10(onChange);
|
|
3663
|
+
const readyHandlerRef = useRef10(onReady);
|
|
3664
|
+
const selectionHandlerRef = useRef10(onSelectionChange);
|
|
3665
|
+
const keyDownHandlerRef = useRef10(onKeyDown);
|
|
3666
|
+
const highlightRangeRef = useRef10(highlightRange);
|
|
3667
|
+
const markersRef = useRef10(markers);
|
|
3668
|
+
const contextMenuItemsRef = useRef10(contextMenuItems);
|
|
3669
|
+
const completionProviderRef = useRef10(completionProvider);
|
|
3670
|
+
const refreshSuggestionOnSpaceRef = useRef10(refreshSuggestionOnSpace);
|
|
3671
|
+
const initialValueRef = useRef10(value);
|
|
3672
|
+
const initialLanguageRef = useRef10(language);
|
|
3673
|
+
const initialPathRef = useRef10(path);
|
|
3674
|
+
const initialThemeRef = useRef10(theme);
|
|
3675
|
+
const initialOptionsRef = useRef10(options);
|
|
3676
|
+
const [loading, setLoading] = useState12(true);
|
|
3677
|
+
const [, setSelectionVersion] = useState12(0);
|
|
3574
3678
|
initialValueRef.current = value;
|
|
3575
3679
|
initialLanguageRef.current = language;
|
|
3576
3680
|
initialPathRef.current = path;
|
|
@@ -3585,7 +3689,7 @@ function Editor({
|
|
|
3585
3689
|
contextMenuItemsRef.current = contextMenuItems;
|
|
3586
3690
|
completionProviderRef.current = completionProvider;
|
|
3587
3691
|
refreshSuggestionOnSpaceRef.current = refreshSuggestionOnSpace;
|
|
3588
|
-
|
|
3692
|
+
useEffect8(() => {
|
|
3589
3693
|
let disposed = false;
|
|
3590
3694
|
const subscriptions = [];
|
|
3591
3695
|
async function mountEditor() {
|
|
@@ -3929,7 +4033,7 @@ function Editor({
|
|
|
3929
4033
|
updateHighlightRef.current = () => void 0;
|
|
3930
4034
|
};
|
|
3931
4035
|
}, [generatedId]);
|
|
3932
|
-
|
|
4036
|
+
useEffect8(() => {
|
|
3933
4037
|
const model = modelRef.current;
|
|
3934
4038
|
if (!model || model.getValue() === value) return;
|
|
3935
4039
|
applyingControlledValueRef.current = true;
|
|
@@ -3939,7 +4043,7 @@ function Editor({
|
|
|
3939
4043
|
applyingControlledValueRef.current = false;
|
|
3940
4044
|
}
|
|
3941
4045
|
}, [loading, value]);
|
|
3942
|
-
|
|
4046
|
+
useEffect8(() => {
|
|
3943
4047
|
if (loading) return;
|
|
3944
4048
|
void loadMonaco().then((monaco) => {
|
|
3945
4049
|
const model = modelRef.current;
|
|
@@ -3948,7 +4052,7 @@ function Editor({
|
|
|
3948
4052
|
}, [language, loading]);
|
|
3949
4053
|
const completionEnabled = Boolean(completionProvider);
|
|
3950
4054
|
const completionTriggerKey = completionTriggerCharacters.join("\0");
|
|
3951
|
-
|
|
4055
|
+
useEffect8(() => {
|
|
3952
4056
|
if (loading || !completionEnabled) return void 0;
|
|
3953
4057
|
let disposed = false;
|
|
3954
4058
|
let subscription;
|
|
@@ -4022,23 +4126,23 @@ function Editor({
|
|
|
4022
4126
|
subscription?.dispose();
|
|
4023
4127
|
};
|
|
4024
4128
|
}, [completionEnabled, completionTriggerKey, language, loading]);
|
|
4025
|
-
|
|
4129
|
+
useEffect8(() => {
|
|
4026
4130
|
if (loading) return;
|
|
4027
4131
|
void loadMonaco().then((monaco) => {
|
|
4028
4132
|
if (editorRef.current) monaco.editor.setTheme(theme === "dark" ? "vs-dark" : "vs");
|
|
4029
4133
|
});
|
|
4030
4134
|
}, [loading, theme]);
|
|
4031
|
-
|
|
4135
|
+
useEffect8(() => {
|
|
4032
4136
|
if (loading) return;
|
|
4033
4137
|
editorRef.current?.updateOptions({
|
|
4034
4138
|
...options ?? {},
|
|
4035
4139
|
contextmenu: contextMenuItems.length === 0 ? options?.contextmenu ?? true : false
|
|
4036
4140
|
});
|
|
4037
4141
|
}, [contextMenuItems.length, loading, options]);
|
|
4038
|
-
|
|
4142
|
+
useEffect8(() => {
|
|
4039
4143
|
updateHighlightRef.current();
|
|
4040
4144
|
}, [highlightRange]);
|
|
4041
|
-
|
|
4145
|
+
useEffect8(() => {
|
|
4042
4146
|
if (loading) return;
|
|
4043
4147
|
void loadMonaco().then((monaco) => {
|
|
4044
4148
|
const model = modelRef.current;
|
|
@@ -4056,11 +4160,11 @@ function Editor({
|
|
|
4056
4160
|
})));
|
|
4057
4161
|
});
|
|
4058
4162
|
}, [generatedId, loading, markers]);
|
|
4059
|
-
const editorNode = /* @__PURE__ */
|
|
4060
|
-
/* @__PURE__ */
|
|
4061
|
-
/* @__PURE__ */
|
|
4062
|
-
loading ? /* @__PURE__ */
|
|
4063
|
-
/* @__PURE__ */
|
|
4163
|
+
const editorNode = /* @__PURE__ */ jsxs16("div", { className: `sia-editor-control ${className}`.trim(), "data-loading": loading || void 0, children: [
|
|
4164
|
+
/* @__PURE__ */ jsx16("div", { className: "sia-editor-control__surface", ref: containerRef, "aria-label": ariaLabel }),
|
|
4165
|
+
/* @__PURE__ */ jsx16("div", { ref: rangeHighlightRef, className: "sia-editor-control__range-highlight", "aria-hidden": "true" }),
|
|
4166
|
+
loading ? /* @__PURE__ */ jsxs16("div", { className: "sia-editor-control__loading", role: "status", children: [
|
|
4167
|
+
/* @__PURE__ */ jsx16("span", {}),
|
|
4064
4168
|
loadingText
|
|
4065
4169
|
] }) : null
|
|
4066
4170
|
] });
|
|
@@ -4089,7 +4193,7 @@ function Editor({
|
|
|
4089
4193
|
item.onClick?.(api);
|
|
4090
4194
|
}
|
|
4091
4195
|
}
|
|
4092
|
-
return /* @__PURE__ */
|
|
4196
|
+
return /* @__PURE__ */ jsx16(
|
|
4093
4197
|
Dropdown,
|
|
4094
4198
|
{
|
|
4095
4199
|
className: "sia-editor-control__context-menu",
|
|
@@ -4106,19 +4210,19 @@ function Editor({
|
|
|
4106
4210
|
}
|
|
4107
4211
|
|
|
4108
4212
|
// src/components/Markdown.tsx
|
|
4109
|
-
import { useEffect as
|
|
4213
|
+
import { useEffect as useEffect9, useMemo as useMemo7, useRef as useRef11, useState as useState13 } from "react";
|
|
4110
4214
|
import DOMPurify from "dompurify";
|
|
4111
4215
|
import { marked } from "marked";
|
|
4112
|
-
import { Fragment as Fragment5, jsx as
|
|
4216
|
+
import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4113
4217
|
function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", resolveImageSrc, imagePreview = true, className = "", onClick, onKeyDown, ...props }) {
|
|
4114
|
-
const rootRef =
|
|
4115
|
-
const [previewImage, setPreviewImage] =
|
|
4218
|
+
const rootRef = useRef11(null);
|
|
4219
|
+
const [previewImage, setPreviewImage] = useState13(null);
|
|
4116
4220
|
const html = useMemo7(() => {
|
|
4117
4221
|
const rendered = marked.parse(content, { breaks: true, gfm: true });
|
|
4118
4222
|
const sanitized = DOMPurify.sanitize(rendered, { USE_PROFILES: { html: true } });
|
|
4119
4223
|
return sanitized.replace(/<img\b/giu, '<img loading="lazy" decoding="async" referrerpolicy="no-referrer"');
|
|
4120
4224
|
}, [content]);
|
|
4121
|
-
|
|
4225
|
+
useEffect9(() => {
|
|
4122
4226
|
const root = rootRef.current;
|
|
4123
4227
|
if (!root) return void 0;
|
|
4124
4228
|
let cancelled = false;
|
|
@@ -4175,19 +4279,19 @@ function Markdown({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", r
|
|
|
4175
4279
|
onKeyDown?.(event);
|
|
4176
4280
|
}
|
|
4177
4281
|
if (!content.trim()) {
|
|
4178
|
-
return /* @__PURE__ */
|
|
4282
|
+
return /* @__PURE__ */ jsx17("div", { className: `sia-markdown sia-markdown--empty ${className}`.trim(), children: emptyText });
|
|
4179
4283
|
}
|
|
4180
|
-
return /* @__PURE__ */
|
|
4181
|
-
/* @__PURE__ */
|
|
4182
|
-
/* @__PURE__ */
|
|
4284
|
+
return /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
4285
|
+
/* @__PURE__ */ jsx17("article", { ...withTitleTooltip(props), ref: rootRef, className: `sia-markdown ${className}`.trim(), onClick: handleClick, onKeyDown: handleKeyDown, dangerouslySetInnerHTML: { __html: html } }),
|
|
4286
|
+
/* @__PURE__ */ jsx17(ImagePreview, { open: Boolean(previewImage), src: previewImage?.src, alt: previewImage?.alt, onOpenChange: (open) => {
|
|
4183
4287
|
if (!open) setPreviewImage(null);
|
|
4184
4288
|
} })
|
|
4185
4289
|
] });
|
|
4186
4290
|
}
|
|
4187
4291
|
|
|
4188
4292
|
// src/components/InputNumber.tsx
|
|
4189
|
-
import { forwardRef as forwardRef4, useEffect as
|
|
4190
|
-
import { jsx as
|
|
4293
|
+
import { forwardRef as forwardRef4, useEffect as useEffect10, useId as useId7, useRef as useRef12, useState as useState14 } from "react";
|
|
4294
|
+
import { jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4191
4295
|
function formatValue(value, precision) {
|
|
4192
4296
|
if (value === null || !Number.isFinite(value)) return "";
|
|
4193
4297
|
return precision === void 0 ? String(value) : value.toFixed(precision);
|
|
@@ -4220,14 +4324,14 @@ var InputNumber = forwardRef4(function InputNumber2({
|
|
|
4220
4324
|
const size = useControlSize(sizeProp);
|
|
4221
4325
|
const fallbackId = useId7();
|
|
4222
4326
|
const inputId = id ?? fallbackId;
|
|
4223
|
-
const localRef =
|
|
4327
|
+
const localRef = useRef12(null);
|
|
4224
4328
|
const [currentValue, setCurrentValue] = useControllableState({ value, defaultValue, onChange });
|
|
4225
4329
|
const displayValue = (next) => {
|
|
4226
4330
|
const plain = formatValue(next, precision);
|
|
4227
4331
|
return plain && formatter ? formatter(plain) : plain;
|
|
4228
4332
|
};
|
|
4229
|
-
const [text, setText] =
|
|
4230
|
-
|
|
4333
|
+
const [text, setText] = useState14(() => displayValue(currentValue));
|
|
4334
|
+
useEffect10(() => {
|
|
4231
4335
|
setText(displayValue(currentValue));
|
|
4232
4336
|
}, [currentValue, precision, formatter]);
|
|
4233
4337
|
function setRef(node) {
|
|
@@ -4296,7 +4400,7 @@ var InputNumber = forwardRef4(function InputNumber2({
|
|
|
4296
4400
|
const increaseDisabled = disabled || readOnly || max !== void 0 && currentValue !== null && currentValue >= max;
|
|
4297
4401
|
const decreaseDisabled = disabled || readOnly || min !== void 0 && currentValue !== null && currentValue <= min;
|
|
4298
4402
|
const floatingPlaceholder = usePlaceholderMode(placeholderMode) === "floating" && Boolean(placeholder);
|
|
4299
|
-
const input = /* @__PURE__ */
|
|
4403
|
+
const input = /* @__PURE__ */ jsx18(
|
|
4300
4404
|
"input",
|
|
4301
4405
|
{
|
|
4302
4406
|
...withTitleTooltip(props),
|
|
@@ -4318,26 +4422,26 @@ var InputNumber = forwardRef4(function InputNumber2({
|
|
|
4318
4422
|
onKeyDown: handleKeyDown
|
|
4319
4423
|
}
|
|
4320
4424
|
);
|
|
4321
|
-
return /* @__PURE__ */
|
|
4322
|
-
prefix ? /* @__PURE__ */
|
|
4323
|
-
floatingPlaceholder ? /* @__PURE__ */
|
|
4425
|
+
return /* @__PURE__ */ jsxs18("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: [
|
|
4426
|
+
prefix ? /* @__PURE__ */ jsx18("span", { className: "sia-input-number__affix", children: prefix }) : null,
|
|
4427
|
+
floatingPlaceholder ? /* @__PURE__ */ jsxs18("span", { className: "sia-input-number__input-wrap", children: [
|
|
4324
4428
|
input,
|
|
4325
|
-
/* @__PURE__ */
|
|
4429
|
+
/* @__PURE__ */ jsx18("span", { className: "sia-input-number__floating-placeholder", "aria-hidden": "true", children: placeholder })
|
|
4326
4430
|
] }) : input,
|
|
4327
|
-
suffix ? /* @__PURE__ */
|
|
4328
|
-
controls ? /* @__PURE__ */
|
|
4329
|
-
/* @__PURE__ */
|
|
4330
|
-
/* @__PURE__ */
|
|
4431
|
+
suffix ? /* @__PURE__ */ jsx18("span", { className: "sia-input-number__affix", children: suffix }) : null,
|
|
4432
|
+
controls ? /* @__PURE__ */ jsxs18("span", { className: "sia-input-number__controls", children: [
|
|
4433
|
+
/* @__PURE__ */ jsx18("button", { type: "button", tabIndex: -1, "aria-label": "\u589E\u52A0\u6570\u503C", disabled: increaseDisabled, onClick: () => changeBy(1), children: /* @__PURE__ */ jsx18(Icon, { name: "chevron-up", size: 12 }) }),
|
|
4434
|
+
/* @__PURE__ */ jsx18("button", { type: "button", tabIndex: -1, "aria-label": "\u51CF\u5C11\u6570\u503C", disabled: decreaseDisabled, onClick: () => changeBy(-1), children: /* @__PURE__ */ jsx18(Icon, { name: "chevron-down", size: 12 }) })
|
|
4331
4435
|
] }) : null
|
|
4332
4436
|
] });
|
|
4333
4437
|
});
|
|
4334
4438
|
|
|
4335
4439
|
// src/components/SelectModal.tsx
|
|
4336
|
-
import { useState as
|
|
4337
|
-
import { Fragment as Fragment6, jsx as
|
|
4440
|
+
import { useState as useState15 } from "react";
|
|
4441
|
+
import { Fragment as Fragment6, jsx as jsx19, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4338
4442
|
function SelectModalBody({ config, values, disabled, onChange }) {
|
|
4339
|
-
const [query, setQuery] =
|
|
4340
|
-
const [selectedOnly, setSelectedOnly] =
|
|
4443
|
+
const [query, setQuery] = useState15("");
|
|
4444
|
+
const [selectedOnly, setSelectedOnly] = useState15(false);
|
|
4341
4445
|
const multiple = config.mode === "multiple";
|
|
4342
4446
|
const search = query.trim();
|
|
4343
4447
|
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()))));
|
|
@@ -4351,23 +4455,23 @@ function SelectModalBody({ config, values, disabled, onChange }) {
|
|
|
4351
4455
|
});
|
|
4352
4456
|
onChange([...next]);
|
|
4353
4457
|
};
|
|
4354
|
-
return /* @__PURE__ */
|
|
4355
|
-
config.headerExtra != null && config.headerExtra !== false ? /* @__PURE__ */
|
|
4356
|
-
/* @__PURE__ */
|
|
4357
|
-
/* @__PURE__ */
|
|
4358
|
-
/* @__PURE__ */
|
|
4359
|
-
/* @__PURE__ */
|
|
4458
|
+
return /* @__PURE__ */ jsxs19(Fragment6, { children: [
|
|
4459
|
+
config.headerExtra != null && config.headerExtra !== false ? /* @__PURE__ */ jsx19("div", { className: "sia-select-modal__header-extra", children: config.headerExtra }) : null,
|
|
4460
|
+
/* @__PURE__ */ jsxs19("div", { className: "sia-select-modal__heading", children: [
|
|
4461
|
+
/* @__PURE__ */ jsxs19("div", { role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
4462
|
+
/* @__PURE__ */ jsx19(Button, { role: "tab", "aria-selected": !selectedOnly, variant: "link", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
4463
|
+
/* @__PURE__ */ jsxs19(Button, { role: "tab", "aria-selected": selectedOnly, variant: "link", onClick: () => setSelectedOnly(true), children: [
|
|
4360
4464
|
"\u5DF2\u9009\u9879(",
|
|
4361
4465
|
values.length,
|
|
4362
4466
|
")"
|
|
4363
4467
|
] })
|
|
4364
4468
|
] }),
|
|
4365
|
-
/* @__PURE__ */
|
|
4469
|
+
/* @__PURE__ */ jsx19(
|
|
4366
4470
|
Input,
|
|
4367
4471
|
{
|
|
4368
4472
|
"aria-label": config.searchPlaceholder ?? "\u641C\u7D22\u9009\u9879",
|
|
4369
4473
|
placeholder: config.searchPlaceholder ?? "\u641C\u7D22\u9009\u9879",
|
|
4370
|
-
prefix: /* @__PURE__ */
|
|
4474
|
+
prefix: /* @__PURE__ */ jsx19(Icon, { name: "search", size: 14 }),
|
|
4371
4475
|
value: query,
|
|
4372
4476
|
allowClear: true,
|
|
4373
4477
|
disabled,
|
|
@@ -4378,8 +4482,8 @@ function SelectModalBody({ config, values, disabled, onChange }) {
|
|
|
4378
4482
|
}
|
|
4379
4483
|
)
|
|
4380
4484
|
] }),
|
|
4381
|
-
multiple ? /* @__PURE__ */
|
|
4382
|
-
/* @__PURE__ */
|
|
4485
|
+
multiple ? /* @__PURE__ */ jsxs19("div", { className: "sia-select-modal__actions", children: [
|
|
4486
|
+
/* @__PURE__ */ jsx19(
|
|
4383
4487
|
Checkbox,
|
|
4384
4488
|
{
|
|
4385
4489
|
checked: all,
|
|
@@ -4389,10 +4493,10 @@ function SelectModalBody({ config, values, disabled, onChange }) {
|
|
|
4389
4493
|
children: "\u5168\u9009"
|
|
4390
4494
|
}
|
|
4391
4495
|
),
|
|
4392
|
-
/* @__PURE__ */
|
|
4393
|
-
/* @__PURE__ */
|
|
4496
|
+
/* @__PURE__ */ jsx19(Button, { variant: "link", size: "small", disabled: disabled || !enabled.length, onClick: () => batch("invert"), children: "\u53CD\u9009" }),
|
|
4497
|
+
/* @__PURE__ */ jsx19(Button, { variant: "link", size: "small", danger: true, disabled: disabled || !values.length, onClick: () => onChange([]), children: "\u6E05\u7A7A" })
|
|
4394
4498
|
] }) : null,
|
|
4395
|
-
/* @__PURE__ */
|
|
4499
|
+
/* @__PURE__ */ jsx19(
|
|
4396
4500
|
SelectionPanel,
|
|
4397
4501
|
{
|
|
4398
4502
|
options: filtered,
|
|
@@ -4419,7 +4523,7 @@ function openSelectModal(config) {
|
|
|
4419
4523
|
if (config.mode !== "multiple") values = values.slice(0, 1);
|
|
4420
4524
|
let submitting = false;
|
|
4421
4525
|
function body() {
|
|
4422
|
-
return /* @__PURE__ */
|
|
4526
|
+
return /* @__PURE__ */ jsx19(SelectModalBody, { config: current, values, disabled: submitting || Boolean(current.confirmLoading), onChange: (next) => {
|
|
4423
4527
|
values = next;
|
|
4424
4528
|
handle.update({ children: body() });
|
|
4425
4529
|
} });
|
|
@@ -4462,8 +4566,8 @@ function openSelectModal(config) {
|
|
|
4462
4566
|
}
|
|
4463
4567
|
|
|
4464
4568
|
// src/components/Treemap.tsx
|
|
4465
|
-
import { useEffect as
|
|
4466
|
-
import { jsx as
|
|
4569
|
+
import { useEffect as useEffect11, useMemo as useMemo8, useRef as useRef13, useState as useState16 } from "react";
|
|
4570
|
+
import { jsx as jsx20, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4467
4571
|
import { createElement } from "react";
|
|
4468
4572
|
function positiveValue(value) {
|
|
4469
4573
|
return Number.isFinite(value) && value > 0 ? value : 1;
|
|
@@ -4835,10 +4939,10 @@ function Treemap({
|
|
|
4835
4939
|
style,
|
|
4836
4940
|
...props
|
|
4837
4941
|
}) {
|
|
4838
|
-
const containerRef =
|
|
4839
|
-
const [size, setSize] =
|
|
4840
|
-
const [internalExpandedKeys, setInternalExpandedKeys] =
|
|
4841
|
-
const [internalFocusedKey, setInternalFocusedKey] =
|
|
4942
|
+
const containerRef = useRef13(null);
|
|
4943
|
+
const [size, setSize] = useState16({ width: 0, height: 0 });
|
|
4944
|
+
const [internalExpandedKeys, setInternalExpandedKeys] = useState16(() => [...defaultExpandedKeys]);
|
|
4945
|
+
const [internalFocusedKey, setInternalFocusedKey] = useState16(defaultFocusedKey);
|
|
4842
4946
|
const currentExpandedKeys = expandedKeys ?? internalExpandedKeys;
|
|
4843
4947
|
const currentFocusedKey = focusedKey === void 0 ? internalFocusedKey : focusedKey;
|
|
4844
4948
|
const expandedSet = useMemo8(() => new Set(currentExpandedKeys), [currentExpandedKeys]);
|
|
@@ -4863,7 +4967,7 @@ function Treemap({
|
|
|
4863
4967
|
),
|
|
4864
4968
|
[activeKey, aggregateOverflow, data, effectiveFocusedNode, expandedSet, gap, headerHeight, maxVisibleNodes, minTileHeight, minTileWidth, overflowLabel, size]
|
|
4865
4969
|
);
|
|
4866
|
-
|
|
4970
|
+
useEffect11(() => {
|
|
4867
4971
|
const element = containerRef.current;
|
|
4868
4972
|
if (!element) return void 0;
|
|
4869
4973
|
const updateSize = () => {
|
|
@@ -4875,7 +4979,7 @@ function Treemap({
|
|
|
4875
4979
|
observer.observe(element);
|
|
4876
4980
|
return () => observer.disconnect();
|
|
4877
4981
|
}, []);
|
|
4878
|
-
|
|
4982
|
+
useEffect11(() => {
|
|
4879
4983
|
if (!currentFocusedKey || effectiveFocusedNode) return;
|
|
4880
4984
|
if (focusedKey === void 0) setInternalFocusedKey(null);
|
|
4881
4985
|
onFocusedChange?.(null);
|
|
@@ -4895,7 +4999,7 @@ function Treemap({
|
|
|
4895
4999
|
}
|
|
4896
5000
|
onNodeClick?.({ node, expanded: isExpanded, nativeEvent });
|
|
4897
5001
|
}
|
|
4898
|
-
return /* @__PURE__ */
|
|
5002
|
+
return /* @__PURE__ */ jsxs20(
|
|
4899
5003
|
"div",
|
|
4900
5004
|
{
|
|
4901
5005
|
...withTitleTooltip(props),
|
|
@@ -4904,7 +5008,7 @@ function Treemap({
|
|
|
4904
5008
|
style,
|
|
4905
5009
|
role: "tree",
|
|
4906
5010
|
children: [
|
|
4907
|
-
data.length === 0 ? /* @__PURE__ */
|
|
5011
|
+
data.length === 0 ? /* @__PURE__ */ jsx20("div", { className: "sia-treemap__empty", children: emptyContent }) : null,
|
|
4908
5012
|
positions.map(({ node, rectangle, depth, expanded }) => {
|
|
4909
5013
|
const active = node.key === activeKey || Boolean(node.__active);
|
|
4910
5014
|
const fontSize = tileFontSize(rectangle);
|
|
@@ -4934,8 +5038,8 @@ function Treemap({
|
|
|
4934
5038
|
"data-treemap-key": node.key,
|
|
4935
5039
|
key: node.key
|
|
4936
5040
|
},
|
|
4937
|
-
/* @__PURE__ */
|
|
4938
|
-
/* @__PURE__ */
|
|
5041
|
+
/* @__PURE__ */ jsxs20("div", { className: "sia-treemap__header", children: [
|
|
5042
|
+
/* @__PURE__ */ jsxs20(
|
|
4939
5043
|
"button",
|
|
4940
5044
|
{
|
|
4941
5045
|
type: "button",
|
|
@@ -4943,12 +5047,12 @@ function Treemap({
|
|
|
4943
5047
|
disabled: node.disabled,
|
|
4944
5048
|
onClick: (event) => handleNodeClick(node, event),
|
|
4945
5049
|
children: [
|
|
4946
|
-
/* @__PURE__ */
|
|
4947
|
-
showValue ? /* @__PURE__ */
|
|
5050
|
+
/* @__PURE__ */ jsx20("span", { className: "sia-treemap__label", children: node.label }),
|
|
5051
|
+
showValue ? /* @__PURE__ */ jsx20("span", { className: "sia-treemap__value", children: valueFormatter(node.value, node) }) : null
|
|
4948
5052
|
]
|
|
4949
5053
|
}
|
|
4950
5054
|
),
|
|
4951
|
-
/* @__PURE__ */
|
|
5055
|
+
/* @__PURE__ */ jsx20(
|
|
4952
5056
|
"button",
|
|
4953
5057
|
{
|
|
4954
5058
|
type: "button",
|
|
@@ -4956,7 +5060,7 @@ function Treemap({
|
|
|
4956
5060
|
"aria-label": effectiveFocusedNode?.key === node.key ? `\u8FD8\u539F ${node.label}` : `\u805A\u7126\u5C55\u5F00 ${node.label}`,
|
|
4957
5061
|
...withTitleTooltip({ title: effectiveFocusedNode?.key === node.key ? "\u8FD8\u539F\u539F\u6709\u89C6\u56FE" : "\u5C55\u5F00\u5230\u6574\u4E2A\u533A\u57DF" }),
|
|
4958
5062
|
onClick: () => updateFocusedKey(effectiveFocusedNode?.key === node.key ? null : node.key),
|
|
4959
|
-
children: /* @__PURE__ */
|
|
5063
|
+
children: /* @__PURE__ */ jsx20(Icon, { name: effectiveFocusedNode?.key === node.key ? "fullscreen-exit" : "fullscreen", size: 14 })
|
|
4960
5064
|
}
|
|
4961
5065
|
)
|
|
4962
5066
|
] })
|
|
@@ -4976,9 +5080,9 @@ function Treemap({
|
|
|
4976
5080
|
onClick: (event) => handleNodeClick(node, event),
|
|
4977
5081
|
key: node.key
|
|
4978
5082
|
},
|
|
4979
|
-
showLabel ? /* @__PURE__ */
|
|
4980
|
-
/* @__PURE__ */
|
|
4981
|
-
showValue ? /* @__PURE__ */
|
|
5083
|
+
showLabel ? /* @__PURE__ */ jsxs20("span", { className: "sia-treemap__content", children: [
|
|
5084
|
+
/* @__PURE__ */ jsx20("span", { className: "sia-treemap__label", children: node.label }),
|
|
5085
|
+
showValue ? /* @__PURE__ */ jsx20("span", { className: "sia-treemap__value", children: valueFormatter(node.value, node) }) : null
|
|
4982
5086
|
] }) : null
|
|
4983
5087
|
);
|
|
4984
5088
|
})
|
|
@@ -4988,8 +5092,8 @@ function Treemap({
|
|
|
4988
5092
|
}
|
|
4989
5093
|
|
|
4990
5094
|
// src/components/Table/TableCellContent.tsx
|
|
4991
|
-
import { useLayoutEffect as useLayoutEffect3, useRef as
|
|
4992
|
-
import { jsx as
|
|
5095
|
+
import { useLayoutEffect as useLayoutEffect3, useRef as useRef14, useState as useState17 } from "react";
|
|
5096
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
4993
5097
|
var pendingLayouts = /* @__PURE__ */ new Map();
|
|
4994
5098
|
var layoutFrame;
|
|
4995
5099
|
function scheduleLayout(element, task) {
|
|
@@ -5007,8 +5111,8 @@ function scheduleLayout(element, task) {
|
|
|
5007
5111
|
});
|
|
5008
5112
|
}
|
|
5009
5113
|
function TableCellContent({ children, ellipsis, title }) {
|
|
5010
|
-
const ref =
|
|
5011
|
-
const [overflowing, setOverflowing] =
|
|
5114
|
+
const ref = useRef14(null);
|
|
5115
|
+
const [overflowing, setOverflowing] = useState17(false);
|
|
5012
5116
|
const customContent = typeof children !== "string" && typeof children !== "number" && children != null;
|
|
5013
5117
|
useLayoutEffect3(() => {
|
|
5014
5118
|
const element = ref.current;
|
|
@@ -5042,13 +5146,13 @@ function TableCellContent({ children, ellipsis, title }) {
|
|
|
5042
5146
|
pendingLayouts.delete(element);
|
|
5043
5147
|
};
|
|
5044
5148
|
}, [children, ellipsis, customContent]);
|
|
5045
|
-
return /* @__PURE__ */
|
|
5149
|
+
return /* @__PURE__ */ jsx21("div", { ref, className: "sia-table__cell-content", "data-custom-content": customContent || void 0, "data-content-overflow": ellipsis && customContent && overflowing || void 0, children: title ? /* @__PURE__ */ jsx21(Tooltip, { title, className: "sia-table__cell-tooltip", children: /* @__PURE__ */ jsx21("span", { children }) }) : children });
|
|
5046
5150
|
}
|
|
5047
5151
|
|
|
5048
5152
|
// src/components/Table/useRemainingHeight.ts
|
|
5049
|
-
import { useLayoutEffect as useLayoutEffect4, useState as
|
|
5153
|
+
import { useLayoutEffect as useLayoutEffect4, useState as useState18 } from "react";
|
|
5050
5154
|
function useRemainingHeight(rootRef, options) {
|
|
5051
|
-
const [height, setHeight] =
|
|
5155
|
+
const [height, setHeight] = useState18();
|
|
5052
5156
|
const enabled = !!options;
|
|
5053
5157
|
const container = typeof options === "object" ? options.container : void 0;
|
|
5054
5158
|
const bottomOffset = typeof options === "object" ? options.bottomOffset ?? 0 : 0;
|
|
@@ -5124,7 +5228,7 @@ function useRemainingHeight(rootRef, options) {
|
|
|
5124
5228
|
}
|
|
5125
5229
|
|
|
5126
5230
|
// src/components/Table/TableCanvasLayer.tsx
|
|
5127
|
-
import { useLayoutEffect as useLayoutEffect5, useRef as
|
|
5231
|
+
import { useLayoutEffect as useLayoutEffect5, useRef as useRef15 } from "react";
|
|
5128
5232
|
|
|
5129
5233
|
// src/components/Table/utils.ts
|
|
5130
5234
|
var AUTO_WIDTH_COLUMN_KEYS = /* @__PURE__ */ new Set(["action", "actions", "operation", "operations"]);
|
|
@@ -5177,9 +5281,9 @@ function toTablePageParams(current, pageSize) {
|
|
|
5177
5281
|
}
|
|
5178
5282
|
|
|
5179
5283
|
// src/components/Table/TableCanvasLayer.tsx
|
|
5180
|
-
import { jsx as
|
|
5284
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
5181
5285
|
function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHeight }) {
|
|
5182
|
-
const canvasRef =
|
|
5286
|
+
const canvasRef = useRef15(null);
|
|
5183
5287
|
useLayoutEffect5(() => {
|
|
5184
5288
|
const canvas = canvasRef.current;
|
|
5185
5289
|
const scroller = viewport.current;
|
|
@@ -5303,7 +5407,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
5303
5407
|
window.removeEventListener("resize", schedule);
|
|
5304
5408
|
};
|
|
5305
5409
|
}, [viewport, rows, columns, widths, rowHeight, headerHeight]);
|
|
5306
|
-
return /* @__PURE__ */
|
|
5410
|
+
return /* @__PURE__ */ jsx22("canvas", { ref: canvasRef, "aria-hidden": "true", className: "sia-table__canvas-layer" });
|
|
5307
5411
|
}
|
|
5308
5412
|
|
|
5309
5413
|
// src/components/Table/rowIdentity.ts
|
|
@@ -5323,10 +5427,10 @@ function createRowIdentity() {
|
|
|
5323
5427
|
}
|
|
5324
5428
|
|
|
5325
5429
|
// src/components/Table/Table.tsx
|
|
5326
|
-
import { Fragment as Fragment8, forwardRef as forwardRef5, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as
|
|
5430
|
+
import { Fragment as Fragment8, forwardRef as forwardRef5, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as useEffect13, useImperativeHandle, useMemo as useMemo9, useRef as useRef17, useState as useState20 } from "react";
|
|
5327
5431
|
|
|
5328
5432
|
// src/components/Table/plugins.tsx
|
|
5329
|
-
import { isValidElement as isValidElement3, useEffect as
|
|
5433
|
+
import { isValidElement as isValidElement3, useEffect as useEffect12, useRef as useRef16, useState as useState19 } from "react";
|
|
5330
5434
|
|
|
5331
5435
|
// src/components/Table/columnSettings.ts
|
|
5332
5436
|
function reconcileColumnSettings(columns, defaults, saved) {
|
|
@@ -5413,7 +5517,7 @@ function saveSettingsPatch(adapter, scope, patch) {
|
|
|
5413
5517
|
}
|
|
5414
5518
|
|
|
5415
5519
|
// src/components/Table/plugins.tsx
|
|
5416
|
-
import { Fragment as Fragment7, jsx as
|
|
5520
|
+
import { Fragment as Fragment7, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5417
5521
|
function TableCheckbox({
|
|
5418
5522
|
checked,
|
|
5419
5523
|
indeterminate,
|
|
@@ -5421,7 +5525,7 @@ function TableCheckbox({
|
|
|
5421
5525
|
label,
|
|
5422
5526
|
onChange
|
|
5423
5527
|
}) {
|
|
5424
|
-
return /* @__PURE__ */
|
|
5528
|
+
return /* @__PURE__ */ jsx23(
|
|
5425
5529
|
Checkbox,
|
|
5426
5530
|
{
|
|
5427
5531
|
className: "sia-table__checkbox",
|
|
@@ -6039,20 +6143,20 @@ function TableSelectedItemsPanel({
|
|
|
6039
6143
|
onRemove,
|
|
6040
6144
|
onClear
|
|
6041
6145
|
}) {
|
|
6042
|
-
const [showAll, setShowAll] =
|
|
6146
|
+
const [showAll, setShowAll] = useState19(false);
|
|
6043
6147
|
const visibleEntries = showAll ? entries : entries.slice(0, maxCount);
|
|
6044
6148
|
const hiddenCount = Math.max(0, entries.length - visibleEntries.length);
|
|
6045
6149
|
const baseColumnMap = new Map(
|
|
6046
6150
|
flattenTableColumns(baseColumns).map((column) => [column.key, column])
|
|
6047
6151
|
);
|
|
6048
|
-
return /* @__PURE__ */
|
|
6049
|
-
/* @__PURE__ */
|
|
6050
|
-
/* @__PURE__ */
|
|
6152
|
+
return /* @__PURE__ */ jsxs21("div", { className: "sia-table-selection-panel", children: [
|
|
6153
|
+
/* @__PURE__ */ jsxs21("div", { className: "sia-table-selection-panel__header", children: [
|
|
6154
|
+
/* @__PURE__ */ jsxs21("strong", { children: [
|
|
6051
6155
|
"\u5DF2\u9009 ",
|
|
6052
|
-
/* @__PURE__ */
|
|
6156
|
+
/* @__PURE__ */ jsx23("span", { children: entries.length }),
|
|
6053
6157
|
" \u9879"
|
|
6054
6158
|
] }),
|
|
6055
|
-
/* @__PURE__ */
|
|
6159
|
+
/* @__PURE__ */ jsx23(
|
|
6056
6160
|
Button,
|
|
6057
6161
|
{
|
|
6058
6162
|
size: "small",
|
|
@@ -6063,15 +6167,15 @@ function TableSelectedItemsPanel({
|
|
|
6063
6167
|
}
|
|
6064
6168
|
)
|
|
6065
6169
|
] }),
|
|
6066
|
-
/* @__PURE__ */
|
|
6067
|
-
/* @__PURE__ */
|
|
6068
|
-
columns.map((column) => /* @__PURE__ */
|
|
6069
|
-
/* @__PURE__ */
|
|
6170
|
+
/* @__PURE__ */ jsx23("div", { className: "sia-table-selection-panel__body", children: /* @__PURE__ */ jsxs21("table", { children: [
|
|
6171
|
+
/* @__PURE__ */ jsx23("thead", { children: /* @__PURE__ */ jsxs21("tr", { children: [
|
|
6172
|
+
columns.map((column) => /* @__PURE__ */ jsx23("th", { children: getColumnLabel(column) }, column.key)),
|
|
6173
|
+
/* @__PURE__ */ jsx23("th", { "aria-label": "\u64CD\u4F5C" })
|
|
6070
6174
|
] }) }),
|
|
6071
|
-
/* @__PURE__ */
|
|
6175
|
+
/* @__PURE__ */ jsx23("tbody", { children: visibleEntries.map((entry, selectedIndex) => /* @__PURE__ */ jsxs21("tr", { children: [
|
|
6072
6176
|
columns.map((column) => {
|
|
6073
6177
|
if (column.meta?.plugin === "index")
|
|
6074
|
-
return /* @__PURE__ */
|
|
6178
|
+
return /* @__PURE__ */ jsx23("td", { children: entry.sourceIndex + 1 }, column.key);
|
|
6075
6179
|
const baseColumn = baseColumnMap.get(column.key) ?? column;
|
|
6076
6180
|
const value = getTableValue(
|
|
6077
6181
|
entry.record,
|
|
@@ -6091,9 +6195,9 @@ function TableSelectedItemsPanel({
|
|
|
6091
6195
|
entry.sourceIndex,
|
|
6092
6196
|
{ row, rowIndex: entry.sourceIndex, column: baseColumn }
|
|
6093
6197
|
) ?? value;
|
|
6094
|
-
return /* @__PURE__ */
|
|
6198
|
+
return /* @__PURE__ */ jsx23("td", { children: content }, column.key);
|
|
6095
6199
|
}),
|
|
6096
|
-
/* @__PURE__ */
|
|
6200
|
+
/* @__PURE__ */ jsx23("td", { children: /* @__PURE__ */ jsx23(
|
|
6097
6201
|
Button,
|
|
6098
6202
|
{
|
|
6099
6203
|
size: "small",
|
|
@@ -6104,11 +6208,11 @@ function TableSelectedItemsPanel({
|
|
|
6104
6208
|
) })
|
|
6105
6209
|
] }, entry.key)) })
|
|
6106
6210
|
] }) }),
|
|
6107
|
-
hiddenCount > 0 ? /* @__PURE__ */
|
|
6211
|
+
hiddenCount > 0 ? /* @__PURE__ */ jsxs21("div", { className: "sia-table-selection-panel__more", children: [
|
|
6108
6212
|
"\u8FD8\u6709 ",
|
|
6109
6213
|
hiddenCount,
|
|
6110
6214
|
" \u9879\u672A\u5C55\u793A",
|
|
6111
|
-
/* @__PURE__ */
|
|
6215
|
+
/* @__PURE__ */ jsx23(Button, { size: "small", variant: "link", onClick: () => setShowAll(true), children: "\u5C55\u793A\u5168\u90E8" })
|
|
6112
6216
|
] }) : null
|
|
6113
6217
|
] });
|
|
6114
6218
|
}
|
|
@@ -6229,7 +6333,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
6229
6333
|
const keys = selected(context);
|
|
6230
6334
|
const allChecked = enabledRows.length > 0 && enabledRows.every((row) => keys.includes(row.key));
|
|
6231
6335
|
const someChecked = enabledRows.some((row) => keys.includes(row.key));
|
|
6232
|
-
return /* @__PURE__ */
|
|
6336
|
+
return /* @__PURE__ */ jsx23(
|
|
6233
6337
|
TableCheckbox,
|
|
6234
6338
|
{
|
|
6235
6339
|
label: "\u9009\u62E9\u5F53\u524D\u9875\u5168\u90E8\u884C",
|
|
@@ -6245,7 +6349,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
6245
6349
|
}
|
|
6246
6350
|
);
|
|
6247
6351
|
},
|
|
6248
|
-
render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */
|
|
6352
|
+
render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */ jsx23(
|
|
6249
6353
|
Radio2,
|
|
6250
6354
|
{
|
|
6251
6355
|
className: "sia-table__checkbox",
|
|
@@ -6256,7 +6360,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
6256
6360
|
onClick: (event) => event.stopPropagation(),
|
|
6257
6361
|
onChange: () => toggle(info.row.key, record, context)
|
|
6258
6362
|
}
|
|
6259
|
-
) : /* @__PURE__ */
|
|
6363
|
+
) : /* @__PURE__ */ jsx23(
|
|
6260
6364
|
TableCheckbox,
|
|
6261
6365
|
{
|
|
6262
6366
|
label: `\u9009\u62E9\u7B2C ${info.rowIndex + 1} \u884C`,
|
|
@@ -6296,8 +6400,8 @@ function createSelectionPlugin(options = {}) {
|
|
|
6296
6400
|
const columns = flattenTableColumns(context.columns).filter(
|
|
6297
6401
|
(column) => !column.hidden && column.meta?.plugin !== "selection"
|
|
6298
6402
|
).slice(0, Math.max(1, options.selectionPanelColumnCount ?? 4));
|
|
6299
|
-
return /* @__PURE__ */
|
|
6300
|
-
/* @__PURE__ */
|
|
6403
|
+
return /* @__PURE__ */ jsxs21("span", { className: "sia-table__selection-footer", children: [
|
|
6404
|
+
/* @__PURE__ */ jsx23(
|
|
6301
6405
|
Popover,
|
|
6302
6406
|
{
|
|
6303
6407
|
placement: "top-start",
|
|
@@ -6305,7 +6409,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
6305
6409
|
open: context.state.panelOpen && entries.length > 0,
|
|
6306
6410
|
onOpenChange: (panelOpen) => context.setState((state) => ({ ...state, panelOpen })),
|
|
6307
6411
|
overlayClassName: "sia-table-selection-popover",
|
|
6308
|
-
content: /* @__PURE__ */
|
|
6412
|
+
content: /* @__PURE__ */ jsx23(
|
|
6309
6413
|
TableSelectedItemsPanel,
|
|
6310
6414
|
{
|
|
6311
6415
|
entries,
|
|
@@ -6321,7 +6425,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
6321
6425
|
onClear: () => setKeys([], context)
|
|
6322
6426
|
}
|
|
6323
6427
|
),
|
|
6324
|
-
children: /* @__PURE__ */
|
|
6428
|
+
children: /* @__PURE__ */ jsxs21(
|
|
6325
6429
|
Button,
|
|
6326
6430
|
{
|
|
6327
6431
|
className: "sia-table__selected-trigger",
|
|
@@ -6337,7 +6441,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
6337
6441
|
)
|
|
6338
6442
|
}
|
|
6339
6443
|
),
|
|
6340
|
-
mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */
|
|
6444
|
+
mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */ jsx23(
|
|
6341
6445
|
Checkbox,
|
|
6342
6446
|
{
|
|
6343
6447
|
checked: preserving(context),
|
|
@@ -6394,9 +6498,9 @@ function createSortPlugin(options = {}) {
|
|
|
6394
6498
|
const info = current(context);
|
|
6395
6499
|
const order = info?.field === field ? info.order : null;
|
|
6396
6500
|
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"}`;
|
|
6397
|
-
return /* @__PURE__ */
|
|
6398
|
-
/* @__PURE__ */
|
|
6399
|
-
/* @__PURE__ */
|
|
6501
|
+
return /* @__PURE__ */ jsxs21("span", { className: "sia-table__sortable-header", children: [
|
|
6502
|
+
/* @__PURE__ */ jsx23("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
|
|
6503
|
+
/* @__PURE__ */ jsx23(
|
|
6400
6504
|
"button",
|
|
6401
6505
|
{
|
|
6402
6506
|
type: "button",
|
|
@@ -6408,9 +6512,9 @@ function createSortPlugin(options = {}) {
|
|
|
6408
6512
|
event.stopPropagation();
|
|
6409
6513
|
cycle(field, context);
|
|
6410
6514
|
},
|
|
6411
|
-
children: order ? /* @__PURE__ */
|
|
6412
|
-
/* @__PURE__ */
|
|
6413
|
-
/* @__PURE__ */
|
|
6515
|
+
children: order ? /* @__PURE__ */ jsx23(Icon, { name: order === "ascend" ? "chevron-up" : "chevron-down", size: 18 }) : /* @__PURE__ */ jsxs21(Fragment7, { children: [
|
|
6516
|
+
/* @__PURE__ */ jsx23(Icon, { name: "chevron-up", size: 11 }),
|
|
6517
|
+
/* @__PURE__ */ jsx23(Icon, { name: "chevron-down", size: 11 })
|
|
6414
6518
|
] })
|
|
6415
6519
|
}
|
|
6416
6520
|
)
|
|
@@ -6445,27 +6549,27 @@ function TableFilterControl({
|
|
|
6445
6549
|
placeholder,
|
|
6446
6550
|
onApply
|
|
6447
6551
|
}) {
|
|
6448
|
-
const [open, setOpen] =
|
|
6449
|
-
const [draft, setDraft] =
|
|
6552
|
+
const [open, setOpen] = useState19(false);
|
|
6553
|
+
const [draft, setDraft] = useState19(value);
|
|
6450
6554
|
const label = getColumnLabel(column);
|
|
6451
|
-
|
|
6555
|
+
useEffect12(() => {
|
|
6452
6556
|
if (open) setDraft(value);
|
|
6453
6557
|
}, [open, value]);
|
|
6454
6558
|
const apply = (nextValue) => {
|
|
6455
6559
|
onApply(nextValue.trim());
|
|
6456
6560
|
setOpen(false);
|
|
6457
6561
|
};
|
|
6458
|
-
return /* @__PURE__ */
|
|
6459
|
-
/* @__PURE__ */
|
|
6460
|
-
/* @__PURE__ */
|
|
6562
|
+
return /* @__PURE__ */ jsxs21("span", { className: "sia-table__filter-header", children: [
|
|
6563
|
+
/* @__PURE__ */ jsx23("span", { children: column.title ?? column.name ?? column.key }),
|
|
6564
|
+
/* @__PURE__ */ jsx23(
|
|
6461
6565
|
Popover,
|
|
6462
6566
|
{
|
|
6463
6567
|
open,
|
|
6464
6568
|
onOpenChange: setOpen,
|
|
6465
6569
|
placement: "bottom-end",
|
|
6466
6570
|
overlayClassName: "sia-table-filter-popover",
|
|
6467
|
-
content: /* @__PURE__ */
|
|
6468
|
-
/* @__PURE__ */
|
|
6571
|
+
content: /* @__PURE__ */ jsxs21("div", { className: "sia-table-filter-panel", children: [
|
|
6572
|
+
/* @__PURE__ */ jsx23(
|
|
6469
6573
|
Input,
|
|
6470
6574
|
{
|
|
6471
6575
|
size: "small",
|
|
@@ -6479,8 +6583,8 @@ function TableFilterControl({
|
|
|
6479
6583
|
}
|
|
6480
6584
|
}
|
|
6481
6585
|
),
|
|
6482
|
-
/* @__PURE__ */
|
|
6483
|
-
/* @__PURE__ */
|
|
6586
|
+
/* @__PURE__ */ jsxs21("div", { className: "sia-table-filter-panel__actions", children: [
|
|
6587
|
+
/* @__PURE__ */ jsx23(
|
|
6484
6588
|
Button,
|
|
6485
6589
|
{
|
|
6486
6590
|
size: "small",
|
|
@@ -6492,7 +6596,7 @@ function TableFilterControl({
|
|
|
6492
6596
|
children: "\u6E05\u9664"
|
|
6493
6597
|
}
|
|
6494
6598
|
),
|
|
6495
|
-
/* @__PURE__ */
|
|
6599
|
+
/* @__PURE__ */ jsx23(
|
|
6496
6600
|
Button,
|
|
6497
6601
|
{
|
|
6498
6602
|
size: "small",
|
|
@@ -6503,7 +6607,7 @@ function TableFilterControl({
|
|
|
6503
6607
|
)
|
|
6504
6608
|
] })
|
|
6505
6609
|
] }),
|
|
6506
|
-
children: /* @__PURE__ */
|
|
6610
|
+
children: /* @__PURE__ */ jsx23(
|
|
6507
6611
|
"button",
|
|
6508
6612
|
{
|
|
6509
6613
|
type: "button",
|
|
@@ -6511,7 +6615,7 @@ function TableFilterControl({
|
|
|
6511
6615
|
"aria-label": `\u7B5B\u9009${label}`,
|
|
6512
6616
|
"aria-pressed": Boolean(value),
|
|
6513
6617
|
onClick: (event) => event.stopPropagation(),
|
|
6514
|
-
children: /* @__PURE__ */
|
|
6618
|
+
children: /* @__PURE__ */ jsx23(Icon, { name: "search", size: 13 })
|
|
6515
6619
|
}
|
|
6516
6620
|
)
|
|
6517
6621
|
}
|
|
@@ -6573,7 +6677,7 @@ function createFilterPlugin(options = {}) {
|
|
|
6573
6677
|
title: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title
|
|
6574
6678
|
};
|
|
6575
6679
|
const placeholder = typeof options.placeholder === "function" ? options.placeholder(currentColumn) : options.placeholder ?? `\u8F93\u5165${getColumnLabel(currentColumn)}\u7B5B\u9009`;
|
|
6576
|
-
return /* @__PURE__ */
|
|
6680
|
+
return /* @__PURE__ */ jsx23(
|
|
6577
6681
|
TableFilterControl,
|
|
6578
6682
|
{
|
|
6579
6683
|
column: renderedColumn,
|
|
@@ -6662,7 +6766,7 @@ function createPaginationPlugin(options = {}) {
|
|
|
6662
6766
|
const page = currentPage(context);
|
|
6663
6767
|
const filteredCount = context.getPluginApi("filter")?.getFilteredRows().length;
|
|
6664
6768
|
const totalRecords = options.totalCount ?? filteredCount ?? context.sourceData.length;
|
|
6665
|
-
return /* @__PURE__ */
|
|
6769
|
+
return /* @__PURE__ */ jsx23(
|
|
6666
6770
|
Pagination,
|
|
6667
6771
|
{
|
|
6668
6772
|
className: "sia-table__pagination",
|
|
@@ -6800,19 +6904,19 @@ function createTreePlugin(options = {}) {
|
|
|
6800
6904
|
return {
|
|
6801
6905
|
...column,
|
|
6802
6906
|
...options.showLine ? { ellipsis: false, meta: { ...column.meta, treeLines: true } } : {},
|
|
6803
|
-
render: (value, record, index, info) => /* @__PURE__ */
|
|
6907
|
+
render: (value, record, index, info) => /* @__PURE__ */ jsxs21(
|
|
6804
6908
|
"span",
|
|
6805
6909
|
{
|
|
6806
6910
|
className: `sia-table__tree-cell${options.showLine ? " sia-table__tree-cell--lines" : ""}`,
|
|
6807
6911
|
style: options.showLine ? void 0 : { paddingLeft: info.row.depth * 18 },
|
|
6808
6912
|
children: [
|
|
6809
|
-
options.showLine && info.row.depth > 0 && /* @__PURE__ */
|
|
6810
|
-
info.row.meta.treeGuides.map((continued, level) => /* @__PURE__ */
|
|
6811
|
-
/* @__PURE__ */
|
|
6913
|
+
options.showLine && info.row.depth > 0 && /* @__PURE__ */ jsxs21(Fragment7, { children: [
|
|
6914
|
+
info.row.meta.treeGuides.map((continued, level) => /* @__PURE__ */ jsx23("span", { "aria-hidden": "true", className: `sia-table__tree-guide${continued ? " sia-table__tree-guide--continued" : ""}` }, level)),
|
|
6915
|
+
/* @__PURE__ */ jsx23("span", { "aria-hidden": "true", className: `sia-table__tree-guide sia-table__tree-guide--branch${info.row.meta.treeHasNextSibling ? " sia-table__tree-guide--continued" : ""}` })
|
|
6812
6916
|
] }),
|
|
6813
|
-
/* @__PURE__ */
|
|
6814
|
-
options.showLine && !!info.row.meta.treeHasChildren && current(context).includes(info.row.key) && /* @__PURE__ */
|
|
6815
|
-
info.row.meta.treeHasChildren ? /* @__PURE__ */
|
|
6917
|
+
/* @__PURE__ */ jsxs21("span", { className: options.showLine ? "sia-table__tree-node" : void 0, style: options.showLine ? void 0 : { display: "contents" }, children: [
|
|
6918
|
+
options.showLine && !!info.row.meta.treeHasChildren && current(context).includes(info.row.key) && /* @__PURE__ */ jsx23("span", { "aria-hidden": "true", className: "sia-table__tree-stem" }),
|
|
6919
|
+
info.row.meta.treeHasChildren ? /* @__PURE__ */ jsx23(
|
|
6816
6920
|
"button",
|
|
6817
6921
|
{
|
|
6818
6922
|
type: "button",
|
|
@@ -6823,7 +6927,7 @@ function createTreePlugin(options = {}) {
|
|
|
6823
6927
|
event.stopPropagation();
|
|
6824
6928
|
toggle(info.row.key, context);
|
|
6825
6929
|
},
|
|
6826
|
-
children: /* @__PURE__ */
|
|
6930
|
+
children: /* @__PURE__ */ jsx23(
|
|
6827
6931
|
Icon,
|
|
6828
6932
|
{
|
|
6829
6933
|
name: current(context).includes(info.row.key) ? "chevron-down" : "chevron-right",
|
|
@@ -6831,7 +6935,7 @@ function createTreePlugin(options = {}) {
|
|
|
6831
6935
|
}
|
|
6832
6936
|
)
|
|
6833
6937
|
}
|
|
6834
|
-
) : /* @__PURE__ */
|
|
6938
|
+
) : /* @__PURE__ */ jsx23("span", { className: "sia-table__tree-placeholder" })
|
|
6835
6939
|
] }),
|
|
6836
6940
|
previousRender ? previousRender(value, record, index, info) : value
|
|
6837
6941
|
]
|
|
@@ -6886,17 +6990,17 @@ function EditableTableCell({
|
|
|
6886
6990
|
trigger
|
|
6887
6991
|
}) {
|
|
6888
6992
|
const config = typeof editable === "object" ? editable : { type: "input" };
|
|
6889
|
-
const [editValue, setEditValue] =
|
|
6890
|
-
const [saving, setSaving] =
|
|
6891
|
-
const inputRef =
|
|
6892
|
-
const editorRef =
|
|
6893
|
-
const editValueRef =
|
|
6894
|
-
const savingRef =
|
|
6895
|
-
const saveRef =
|
|
6993
|
+
const [editValue, setEditValue] = useState19(value);
|
|
6994
|
+
const [saving, setSaving] = useState19(false);
|
|
6995
|
+
const inputRef = useRef16(null);
|
|
6996
|
+
const editorRef = useRef16(null);
|
|
6997
|
+
const editValueRef = useRef16(value);
|
|
6998
|
+
const savingRef = useRef16(false);
|
|
6999
|
+
const saveRef = useRef16(
|
|
6896
7000
|
async () => {
|
|
6897
7001
|
}
|
|
6898
7002
|
);
|
|
6899
|
-
|
|
7003
|
+
useEffect12(() => {
|
|
6900
7004
|
if (!active) return;
|
|
6901
7005
|
editValueRef.current = value;
|
|
6902
7006
|
setEditValue(value);
|
|
@@ -6927,7 +7031,7 @@ function EditableTableCell({
|
|
|
6927
7031
|
}
|
|
6928
7032
|
}
|
|
6929
7033
|
saveRef.current = save;
|
|
6930
|
-
|
|
7034
|
+
useEffect12(() => {
|
|
6931
7035
|
if (!active || config.type === "select" || config.type === "custom") return;
|
|
6932
7036
|
const handleOutsidePointerDown = (event) => {
|
|
6933
7037
|
const target = event.target;
|
|
@@ -6943,15 +7047,15 @@ function EditableTableCell({
|
|
|
6943
7047
|
);
|
|
6944
7048
|
}, [active, config.type]);
|
|
6945
7049
|
if (!active)
|
|
6946
|
-
return /* @__PURE__ */
|
|
7050
|
+
return /* @__PURE__ */ jsxs21(
|
|
6947
7051
|
"div",
|
|
6948
7052
|
{
|
|
6949
7053
|
className: "sia-table__editable-display",
|
|
6950
7054
|
onClick: trigger === "click" ? onStart : void 0,
|
|
6951
7055
|
onDoubleClick: trigger === "doubleClick" ? onStart : void 0,
|
|
6952
7056
|
children: [
|
|
6953
|
-
/* @__PURE__ */
|
|
6954
|
-
/* @__PURE__ */
|
|
7057
|
+
/* @__PURE__ */ jsx23("span", { children: content }),
|
|
7058
|
+
/* @__PURE__ */ jsx23(Icon, { name: "edit", size: 13 })
|
|
6955
7059
|
]
|
|
6956
7060
|
}
|
|
6957
7061
|
);
|
|
@@ -6959,7 +7063,7 @@ function EditableTableCell({
|
|
|
6959
7063
|
if (config.type === "custom" && config.editRender) {
|
|
6960
7064
|
editor = config.editRender(record, (next) => void save(next), onCancel);
|
|
6961
7065
|
} else if (config.type === "inputNumber") {
|
|
6962
|
-
editor = /* @__PURE__ */
|
|
7066
|
+
editor = /* @__PURE__ */ jsx23(
|
|
6963
7067
|
InputNumber,
|
|
6964
7068
|
{
|
|
6965
7069
|
ref: inputRef,
|
|
@@ -6980,7 +7084,7 @@ function EditableTableCell({
|
|
|
6980
7084
|
}
|
|
6981
7085
|
);
|
|
6982
7086
|
} else if (config.type === "select") {
|
|
6983
|
-
editor = /* @__PURE__ */
|
|
7087
|
+
editor = /* @__PURE__ */ jsx23(
|
|
6984
7088
|
Select,
|
|
6985
7089
|
{
|
|
6986
7090
|
size: "small",
|
|
@@ -6994,14 +7098,14 @@ function EditableTableCell({
|
|
|
6994
7098
|
}
|
|
6995
7099
|
);
|
|
6996
7100
|
} else {
|
|
6997
|
-
editor = /* @__PURE__ */
|
|
7101
|
+
editor = /* @__PURE__ */ jsx23(
|
|
6998
7102
|
Input,
|
|
6999
7103
|
{
|
|
7000
7104
|
ref: inputRef,
|
|
7001
7105
|
size: "small",
|
|
7002
7106
|
value: String(editValue ?? ""),
|
|
7003
7107
|
disabled: saving,
|
|
7004
|
-
suffix: saving ? /* @__PURE__ */
|
|
7108
|
+
suffix: saving ? /* @__PURE__ */ jsx23(Icon, { name: "loader", size: 13, spin: true }) : null,
|
|
7005
7109
|
onChange: (event) => updateEditValue(event.target.value),
|
|
7006
7110
|
onBlur: () => void save(),
|
|
7007
7111
|
onKeyDown: (event) => {
|
|
@@ -7011,7 +7115,7 @@ function EditableTableCell({
|
|
|
7011
7115
|
}
|
|
7012
7116
|
);
|
|
7013
7117
|
}
|
|
7014
|
-
return /* @__PURE__ */
|
|
7118
|
+
return /* @__PURE__ */ jsx23("div", { ref: editorRef, className: "sia-table__editor", children: editor });
|
|
7015
7119
|
}
|
|
7016
7120
|
function createEditablePlugin(options = {}) {
|
|
7017
7121
|
const trigger = options.trigger ?? "click";
|
|
@@ -7031,7 +7135,7 @@ function createEditablePlugin(options = {}) {
|
|
|
7031
7135
|
const active = canEdit && context.state.editing?.rowKey === info.row.key && context.state.editing.columnKey === column.key;
|
|
7032
7136
|
const content = previousRender ? previousRender(value, record, index, info) : value;
|
|
7033
7137
|
if (!canEdit) return content;
|
|
7034
|
-
return /* @__PURE__ */
|
|
7138
|
+
return /* @__PURE__ */ jsx23(
|
|
7035
7139
|
EditableTableCell,
|
|
7036
7140
|
{
|
|
7037
7141
|
active,
|
|
@@ -7094,9 +7198,9 @@ function createResizePlugin(options = {}) {
|
|
|
7094
7198
|
...column,
|
|
7095
7199
|
autoWidth,
|
|
7096
7200
|
width,
|
|
7097
|
-
renderHeader: (currentColumn, coreContext) => /* @__PURE__ */
|
|
7098
|
-
/* @__PURE__ */
|
|
7099
|
-
/* @__PURE__ */
|
|
7201
|
+
renderHeader: (currentColumn, coreContext) => /* @__PURE__ */ jsxs21("span", { className: "sia-table__resizable-header", children: [
|
|
7202
|
+
/* @__PURE__ */ jsx23("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
|
|
7203
|
+
/* @__PURE__ */ jsx23(
|
|
7100
7204
|
"span",
|
|
7101
7205
|
{
|
|
7102
7206
|
className: "sia-table__resize-handle",
|
|
@@ -7232,15 +7336,15 @@ function ColumnSettingPanel({
|
|
|
7232
7336
|
onClose,
|
|
7233
7337
|
onApply
|
|
7234
7338
|
}) {
|
|
7235
|
-
const [draft, setDraft] =
|
|
7236
|
-
const listRef =
|
|
7237
|
-
const cancelDrag =
|
|
7238
|
-
const [preview, setPreview] =
|
|
7239
|
-
|
|
7339
|
+
const [draft, setDraft] = useState19(items);
|
|
7340
|
+
const listRef = useRef16(null);
|
|
7341
|
+
const cancelDrag = useRef16(null);
|
|
7342
|
+
const [preview, setPreview] = useState19(null);
|
|
7343
|
+
useEffect12(() => {
|
|
7240
7344
|
cancelDrag.current?.();
|
|
7241
7345
|
if (open) setDraft(orderColumnSettings(items));
|
|
7242
7346
|
}, [items, open]);
|
|
7243
|
-
|
|
7347
|
+
useEffect12(() => () => cancelDrag.current?.(), []);
|
|
7244
7348
|
const labels = new Map(
|
|
7245
7349
|
flattenTableColumns(columns).map((column) => [
|
|
7246
7350
|
column.key,
|
|
@@ -7367,7 +7471,7 @@ function ColumnSettingPanel({
|
|
|
7367
7471
|
window.addEventListener("blur", cancel);
|
|
7368
7472
|
frame = requestAnimationFrame(tick);
|
|
7369
7473
|
}
|
|
7370
|
-
return /* @__PURE__ */
|
|
7474
|
+
return /* @__PURE__ */ jsxs21(
|
|
7371
7475
|
Drawer2,
|
|
7372
7476
|
{
|
|
7373
7477
|
open,
|
|
@@ -7376,9 +7480,9 @@ function ColumnSettingPanel({
|
|
|
7376
7480
|
onOpenChange: (next) => {
|
|
7377
7481
|
if (!next) onClose();
|
|
7378
7482
|
},
|
|
7379
|
-
footer: /* @__PURE__ */
|
|
7380
|
-
/* @__PURE__ */
|
|
7381
|
-
/* @__PURE__ */
|
|
7483
|
+
footer: /* @__PURE__ */ jsxs21(Fragment7, { children: [
|
|
7484
|
+
/* @__PURE__ */ jsx23(Button, { onClick: onClose, children: "\u53D6\u6D88" }),
|
|
7485
|
+
/* @__PURE__ */ jsx23(
|
|
7382
7486
|
Button,
|
|
7383
7487
|
{
|
|
7384
7488
|
variant: "primary",
|
|
@@ -7389,19 +7493,19 @@ function ColumnSettingPanel({
|
|
|
7389
7493
|
)
|
|
7390
7494
|
] }),
|
|
7391
7495
|
children: [
|
|
7392
|
-
loadError ? /* @__PURE__ */
|
|
7496
|
+
loadError ? /* @__PURE__ */ jsxs21("p", { role: "alert", children: [
|
|
7393
7497
|
"\u8BFB\u53D6\u5217\u914D\u7F6E\u5931\u8D25\u3002",
|
|
7394
|
-
/* @__PURE__ */
|
|
7498
|
+
/* @__PURE__ */ jsx23(Button, { variant: "link", onClick: onRetry, children: "\u91CD\u8BD5" })
|
|
7395
7499
|
] }) : null,
|
|
7396
|
-
/* @__PURE__ */
|
|
7500
|
+
/* @__PURE__ */ jsx23(Spin, { spinning: Boolean(loading), className: "sia-table-settings__loading", "aria-label": loading ? "\u6B63\u5728\u8BFB\u53D6\u5217\u914D\u7F6E" : void 0, children: /* @__PURE__ */ jsxs21(
|
|
7397
7501
|
"fieldset",
|
|
7398
7502
|
{
|
|
7399
7503
|
disabled: loading || loadError,
|
|
7400
7504
|
style: { border: 0, padding: 0, margin: 0, minWidth: 0 },
|
|
7401
7505
|
"aria-busy": loading,
|
|
7402
7506
|
children: [
|
|
7403
|
-
/* @__PURE__ */
|
|
7404
|
-
/* @__PURE__ */
|
|
7507
|
+
/* @__PURE__ */ jsxs21("label", { className: "sia-table-settings__all", children: [
|
|
7508
|
+
/* @__PURE__ */ jsx23(
|
|
7405
7509
|
TableCheckbox,
|
|
7406
7510
|
{
|
|
7407
7511
|
label: "\u5168\u9009\u5217",
|
|
@@ -7412,7 +7516,7 @@ function ColumnSettingPanel({
|
|
|
7412
7516
|
)
|
|
7413
7517
|
}
|
|
7414
7518
|
),
|
|
7415
|
-
/* @__PURE__ */
|
|
7519
|
+
/* @__PURE__ */ jsxs21("span", { children: [
|
|
7416
7520
|
"\u5168\u9009\uFF08",
|
|
7417
7521
|
visibleCount,
|
|
7418
7522
|
"/",
|
|
@@ -7420,12 +7524,12 @@ function ColumnSettingPanel({
|
|
|
7420
7524
|
"\uFF09"
|
|
7421
7525
|
] })
|
|
7422
7526
|
] }),
|
|
7423
|
-
/* @__PURE__ */
|
|
7527
|
+
/* @__PURE__ */ jsx23(
|
|
7424
7528
|
"div",
|
|
7425
7529
|
{
|
|
7426
7530
|
ref: listRef,
|
|
7427
7531
|
className: `sia-table-settings__list${preview ? " is-sorting" : ""}`,
|
|
7428
|
-
children: draft.map((item) => /* @__PURE__ */
|
|
7532
|
+
children: draft.map((item) => /* @__PURE__ */ jsxs21(
|
|
7429
7533
|
"div",
|
|
7430
7534
|
{
|
|
7431
7535
|
"data-column-key": item.key,
|
|
@@ -7435,8 +7539,8 @@ function ColumnSettingPanel({
|
|
|
7435
7539
|
} : void 0,
|
|
7436
7540
|
onPointerDown: (event) => startSort(event, item.key),
|
|
7437
7541
|
children: [
|
|
7438
|
-
/* @__PURE__ */
|
|
7439
|
-
/* @__PURE__ */
|
|
7542
|
+
/* @__PURE__ */ jsx23(Icon, { name: "menu", size: 15 }),
|
|
7543
|
+
/* @__PURE__ */ jsx23(
|
|
7440
7544
|
TableCheckbox,
|
|
7441
7545
|
{
|
|
7442
7546
|
label: `\u663E\u793A${labels.get(item.key) ?? item.key}\u5217`,
|
|
@@ -7448,15 +7552,15 @@ function ColumnSettingPanel({
|
|
|
7448
7552
|
)
|
|
7449
7553
|
}
|
|
7450
7554
|
),
|
|
7451
|
-
/* @__PURE__ */
|
|
7555
|
+
/* @__PURE__ */ jsx23(
|
|
7452
7556
|
"span",
|
|
7453
7557
|
{
|
|
7454
7558
|
className: "sia-table-settings__name",
|
|
7455
7559
|
children: labels.get(item.key) ?? item.key
|
|
7456
7560
|
}
|
|
7457
7561
|
),
|
|
7458
|
-
/* @__PURE__ */
|
|
7459
|
-
/* @__PURE__ */
|
|
7562
|
+
/* @__PURE__ */ jsxs21("div", { className: "sia-table-settings__actions", children: [
|
|
7563
|
+
/* @__PURE__ */ jsx23(
|
|
7460
7564
|
Button,
|
|
7461
7565
|
{
|
|
7462
7566
|
size: "small",
|
|
@@ -7469,7 +7573,7 @@ function ColumnSettingPanel({
|
|
|
7469
7573
|
children: "\u5DE6"
|
|
7470
7574
|
}
|
|
7471
7575
|
),
|
|
7472
|
-
/* @__PURE__ */
|
|
7576
|
+
/* @__PURE__ */ jsx23(
|
|
7473
7577
|
Button,
|
|
7474
7578
|
{
|
|
7475
7579
|
size: "small",
|
|
@@ -7619,7 +7723,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
7619
7723
|
{
|
|
7620
7724
|
key: "builtin:export",
|
|
7621
7725
|
label: "\u8868\u683C\u5BFC\u51FA",
|
|
7622
|
-
icon: /* @__PURE__ */
|
|
7726
|
+
icon: /* @__PURE__ */ jsx23(Icon, { name: "download", size: 18 }),
|
|
7623
7727
|
disabled: exportApi().getRows().length === 0
|
|
7624
7728
|
},
|
|
7625
7729
|
{ key: "builtin:divider", type: "divider" }
|
|
@@ -7627,7 +7731,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
7627
7731
|
{
|
|
7628
7732
|
key: "builtin:columns",
|
|
7629
7733
|
label: "\u5217\u8BBE\u7F6E",
|
|
7630
|
-
icon: /* @__PURE__ */
|
|
7734
|
+
icon: /* @__PURE__ */ jsx23(Icon, { name: "settings", size: 18 })
|
|
7631
7735
|
},
|
|
7632
7736
|
...customItems.map((item) => ({
|
|
7633
7737
|
key: "custom:" + item.key,
|
|
@@ -7639,7 +7743,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
7639
7743
|
disabled: item.disabled === true || typeof item.disabled === "function" && item.disabled(context)
|
|
7640
7744
|
}))
|
|
7641
7745
|
];
|
|
7642
|
-
return /* @__PURE__ */
|
|
7746
|
+
return /* @__PURE__ */ jsx23(
|
|
7643
7747
|
Dropdown,
|
|
7644
7748
|
{
|
|
7645
7749
|
disabled: options.buttonProps?.disabled || options.buttonProps?.loading,
|
|
@@ -7656,12 +7760,12 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
7656
7760
|
void customItems.find((item) => "custom:" + item.key === key)?.onClick?.(context);
|
|
7657
7761
|
}
|
|
7658
7762
|
},
|
|
7659
|
-
children: /* @__PURE__ */
|
|
7763
|
+
children: /* @__PURE__ */ jsx23(
|
|
7660
7764
|
Button,
|
|
7661
7765
|
{
|
|
7662
7766
|
size: "small",
|
|
7663
7767
|
variant: "text",
|
|
7664
|
-
icon: /* @__PURE__ */
|
|
7768
|
+
icon: /* @__PURE__ */ jsx23(Icon, { name: "settings", size: 16 }),
|
|
7665
7769
|
"aria-label": "\u8868\u683C\u8BBE\u7F6E",
|
|
7666
7770
|
...options.buttonProps,
|
|
7667
7771
|
className: `sia-table__settings-button${options.buttonProps?.children == null ? " sia-table__toolbar-icon" : ""} ${options.buttonProps?.className ?? ""}`.trim()
|
|
@@ -7670,7 +7774,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
7670
7774
|
}
|
|
7671
7775
|
);
|
|
7672
7776
|
},
|
|
7673
|
-
renderOverlay: (context) => /* @__PURE__ */
|
|
7777
|
+
renderOverlay: (context) => /* @__PURE__ */ jsx23(
|
|
7674
7778
|
ColumnSettingPanel,
|
|
7675
7779
|
{
|
|
7676
7780
|
open: context.state.open,
|
|
@@ -7720,11 +7824,11 @@ function ToolbarItems({
|
|
|
7720
7824
|
items,
|
|
7721
7825
|
context
|
|
7722
7826
|
}) {
|
|
7723
|
-
return /* @__PURE__ */
|
|
7827
|
+
return /* @__PURE__ */ jsx23(Fragment7, { children: items.map((item) => {
|
|
7724
7828
|
if (item.hidden === true || typeof item.hidden === "function" && item.hidden(context))
|
|
7725
7829
|
return null;
|
|
7726
7830
|
const disabled = item.disabled === true || typeof item.disabled === "function" && item.disabled(context);
|
|
7727
|
-
return /* @__PURE__ */
|
|
7831
|
+
return /* @__PURE__ */ jsx23(
|
|
7728
7832
|
Button,
|
|
7729
7833
|
{
|
|
7730
7834
|
size: "small",
|
|
@@ -7747,16 +7851,16 @@ function createToolbarPlugin(options) {
|
|
|
7747
7851
|
return {
|
|
7748
7852
|
id: "toolbar",
|
|
7749
7853
|
order: 5,
|
|
7750
|
-
renderToolbarStart: (context) => /* @__PURE__ */
|
|
7854
|
+
renderToolbarStart: (context) => /* @__PURE__ */ jsxs21(Fragment7, { children: [
|
|
7751
7855
|
options.start,
|
|
7752
|
-
/* @__PURE__ */
|
|
7856
|
+
/* @__PURE__ */ jsx23(ToolbarItems, { items: items("start"), context })
|
|
7753
7857
|
] }),
|
|
7754
|
-
renderToolbarEnd: (context) => /* @__PURE__ */
|
|
7858
|
+
renderToolbarEnd: (context) => /* @__PURE__ */ jsxs21(Fragment7, { children: [
|
|
7755
7859
|
options.end,
|
|
7756
|
-
/* @__PURE__ */
|
|
7757
|
-
items("end", true).length > 0 ? /* @__PURE__ */
|
|
7758
|
-
/* @__PURE__ */
|
|
7759
|
-
/* @__PURE__ */
|
|
7860
|
+
/* @__PURE__ */ jsx23(ToolbarItems, { items: items("end"), context }),
|
|
7861
|
+
items("end", true).length > 0 ? /* @__PURE__ */ jsxs21("details", { className: "sia-table__toolbar-menu", children: [
|
|
7862
|
+
/* @__PURE__ */ jsx23("summary", { "aria-label": "\u66F4\u591A\u8868\u683C\u64CD\u4F5C", children: /* @__PURE__ */ jsx23(Icon, { name: "more-horizontal", size: 16 }) }),
|
|
7863
|
+
/* @__PURE__ */ jsx23("div", { children: /* @__PURE__ */ jsx23(ToolbarItems, { items: items("end", true), context }) })
|
|
7760
7864
|
] }) : null
|
|
7761
7865
|
] })
|
|
7762
7866
|
};
|
|
@@ -7838,11 +7942,11 @@ function createExportPlugin(options = {}) {
|
|
|
7838
7942
|
return {
|
|
7839
7943
|
id: "export",
|
|
7840
7944
|
order: 95,
|
|
7841
|
-
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */
|
|
7945
|
+
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */ jsx23(
|
|
7842
7946
|
Button,
|
|
7843
7947
|
{
|
|
7844
7948
|
size: "small",
|
|
7845
|
-
icon: /* @__PURE__ */
|
|
7949
|
+
icon: /* @__PURE__ */ jsx23(Icon, { name: "download", size: 14 }),
|
|
7846
7950
|
disabled: getRows(context).length === 0,
|
|
7847
7951
|
onClick: () => void download(context),
|
|
7848
7952
|
children: options.buttonLabel ?? "\u5BFC\u51FA"
|
|
@@ -7857,7 +7961,7 @@ function createExportPlugin(options = {}) {
|
|
|
7857
7961
|
}
|
|
7858
7962
|
|
|
7859
7963
|
// src/components/Table/Table.tsx
|
|
7860
|
-
import { jsx as
|
|
7964
|
+
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
7861
7965
|
var EMPTY_DATA = [];
|
|
7862
7966
|
var EMPTY_COLUMNS = [];
|
|
7863
7967
|
var EMPTY_PLUGINS = [];
|
|
@@ -7971,7 +8075,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
7971
8075
|
onCellPointerDown,
|
|
7972
8076
|
onCellPointerMove
|
|
7973
8077
|
}) {
|
|
7974
|
-
return /* @__PURE__ */
|
|
8078
|
+
return /* @__PURE__ */ jsx24(
|
|
7975
8079
|
"tr",
|
|
7976
8080
|
{
|
|
7977
8081
|
"data-canvas-row-index": canvas ? rowIndex : void 0,
|
|
@@ -7986,7 +8090,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
7986
8090
|
if (columnIndex > 0 && !visibleColumns.has(columns[columnIndex - 1].key)) return null;
|
|
7987
8091
|
let count = 1;
|
|
7988
8092
|
while (columnIndex + count < columns.length && !visibleColumns.has(columns[columnIndex + count].key)) count++;
|
|
7989
|
-
return /* @__PURE__ */
|
|
8093
|
+
return /* @__PURE__ */ jsx24("td", { colSpan: count, "aria-hidden": "true", style: { padding: 0 } }, `spacer-${column.key}`);
|
|
7990
8094
|
}
|
|
7991
8095
|
const pluginCellProps = getCellProps(column);
|
|
7992
8096
|
if (pluginCellProps.hidden) return null;
|
|
@@ -7996,7 +8100,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
7996
8100
|
const fixedStyle = fixed === "left" ? { left: leftOffsets.get(column.key) } : fixed === "right" ? { right: rightOffsets.get(column.key) } : void 0;
|
|
7997
8101
|
const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
7998
8102
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
7999
|
-
return /* @__PURE__ */
|
|
8103
|
+
return /* @__PURE__ */ jsx24(
|
|
8000
8104
|
"td",
|
|
8001
8105
|
{
|
|
8002
8106
|
"data-column-key": column.key,
|
|
@@ -8012,7 +8116,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8012
8116
|
onContextMenu: (event) => onCellContextMenu(column, event),
|
|
8013
8117
|
onPointerDown: (event) => onCellPointerDown(column, event),
|
|
8014
8118
|
onPointerMove: (event) => onCellPointerMove(column, event),
|
|
8015
|
-
children: !canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? /* @__PURE__ */
|
|
8119
|
+
children: !canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? /* @__PURE__ */ jsx24(
|
|
8016
8120
|
TableCellContent,
|
|
8017
8121
|
{
|
|
8018
8122
|
ellipsis: column.ellipsis !== false,
|
|
@@ -8062,19 +8166,19 @@ function TableInner(props, ref) {
|
|
|
8062
8166
|
style,
|
|
8063
8167
|
...htmlProps
|
|
8064
8168
|
} = props;
|
|
8065
|
-
const rootRef =
|
|
8169
|
+
const rootRef = useRef17(null);
|
|
8066
8170
|
const remainingHeight = useRemainingHeight(rootRef, height == null && tableHeight == null ? fillRemaining : false);
|
|
8067
|
-
const scrollRef =
|
|
8068
|
-
const tableRef =
|
|
8171
|
+
const scrollRef = useRef17(null);
|
|
8172
|
+
const tableRef = useRef17(null);
|
|
8069
8173
|
useScrollbarProximity();
|
|
8070
|
-
const scrollbarDragRef =
|
|
8071
|
-
const [internalLoading, setInternalLoading] =
|
|
8072
|
-
const [scrollTop, setScrollTop] =
|
|
8073
|
-
const [scrollLeft, setScrollLeft] =
|
|
8074
|
-
const [viewportHeight, setViewportHeight] =
|
|
8075
|
-
const [viewportWidth, setViewportWidth] =
|
|
8076
|
-
const [autoColumnWidths, setAutoColumnWidths] =
|
|
8077
|
-
const [resolveRowIdentity] =
|
|
8174
|
+
const scrollbarDragRef = useRef17(null);
|
|
8175
|
+
const [internalLoading, setInternalLoading] = useState20(false);
|
|
8176
|
+
const [scrollTop, setScrollTop] = useState20(0);
|
|
8177
|
+
const [scrollLeft, setScrollLeft] = useState20(0);
|
|
8178
|
+
const [viewportHeight, setViewportHeight] = useState20(420);
|
|
8179
|
+
const [viewportWidth, setViewportWidth] = useState20(0);
|
|
8180
|
+
const [autoColumnWidths, setAutoColumnWidths] = useState20({});
|
|
8181
|
+
const [resolveRowIdentity] = useState20(createRowIdentity);
|
|
8078
8182
|
const getRowKey = useCallback2((record, index) => resolveRowIdentity(record, index, typeof rowKey === "function" ? rowKey : rowKey == null ? void 0 : String(rowKey)), [rowKey, resolveRowIdentity]);
|
|
8079
8183
|
const builtInResizePlugin = useMemo9(() => createResizePlugin(), []);
|
|
8080
8184
|
const builtInHighlightPlugin = useMemo9(() => createHighlightPlugin(), []);
|
|
@@ -8089,14 +8193,14 @@ function TableInner(props, ref) {
|
|
|
8089
8193
|
return plugins;
|
|
8090
8194
|
}, [builtInHighlightPlugin, builtInResizePlugin, builtInCellSelectionPlugin, builtInIndexPlugin, providedPlugins, resizable, cellSelection, showIndex]);
|
|
8091
8195
|
const sortedPlugins = useMemo9(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
|
|
8092
|
-
const pluginsByIdRef =
|
|
8196
|
+
const pluginsByIdRef = useRef17(/* @__PURE__ */ new Map());
|
|
8093
8197
|
pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
8094
|
-
const [pluginStates, setPluginStates] =
|
|
8198
|
+
const [pluginStates, setPluginStates] = useState20(() => Object.fromEntries(
|
|
8095
8199
|
sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
|
|
8096
8200
|
));
|
|
8097
|
-
const pluginApisRef =
|
|
8098
|
-
const contextsRef =
|
|
8099
|
-
const mountedPluginsRef =
|
|
8201
|
+
const pluginApisRef = useRef17({});
|
|
8202
|
+
const contextsRef = useRef17(/* @__PURE__ */ new Map());
|
|
8203
|
+
const mountedPluginsRef = useRef17(/* @__PURE__ */ new Map());
|
|
8100
8204
|
const pipeline = { columns: baseColumns, rows: createTableRows(dataSource, getRowKey) };
|
|
8101
8205
|
const nextApis = {};
|
|
8102
8206
|
const contexts = /* @__PURE__ */ new Map();
|
|
@@ -8153,7 +8257,7 @@ function TableInner(props, ref) {
|
|
|
8153
8257
|
});
|
|
8154
8258
|
pluginApisRef.current = nextApis;
|
|
8155
8259
|
contextsRef.current = contexts;
|
|
8156
|
-
|
|
8260
|
+
useEffect13(() => {
|
|
8157
8261
|
const activePlugins2 = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
8158
8262
|
for (const [pluginId, mounted] of mountedPluginsRef.current) {
|
|
8159
8263
|
if (activePlugins2.get(pluginId) === mounted.plugin) continue;
|
|
@@ -8165,7 +8269,7 @@ function TableInner(props, ref) {
|
|
|
8165
8269
|
mountedPluginsRef.current.set(plugin.id, { plugin, cleanup: plugin.onMount(contextsRef.current.get(plugin.id)) });
|
|
8166
8270
|
}
|
|
8167
8271
|
}, [sortedPlugins]);
|
|
8168
|
-
|
|
8272
|
+
useEffect13(() => () => {
|
|
8169
8273
|
for (const mounted of mountedPluginsRef.current.values()) mounted.cleanup?.();
|
|
8170
8274
|
mountedPluginsRef.current.clear();
|
|
8171
8275
|
}, []);
|
|
@@ -8209,7 +8313,7 @@ function TableInner(props, ref) {
|
|
|
8209
8313
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-size", `${verticalThumb}px`);
|
|
8210
8314
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-position", `${verticalPosition}px`);
|
|
8211
8315
|
}, []);
|
|
8212
|
-
|
|
8316
|
+
useEffect13(() => {
|
|
8213
8317
|
const element = scrollRef.current;
|
|
8214
8318
|
if (!element || typeof ResizeObserver === "undefined") return;
|
|
8215
8319
|
const observer = new ResizeObserver(() => {
|
|
@@ -8222,19 +8326,19 @@ function TableInner(props, ref) {
|
|
|
8222
8326
|
updateScrollMetrics();
|
|
8223
8327
|
return () => observer.disconnect();
|
|
8224
8328
|
}, [updateScrollMetrics]);
|
|
8225
|
-
|
|
8329
|
+
useEffect13(() => {
|
|
8226
8330
|
updateScrollMetrics();
|
|
8227
8331
|
});
|
|
8228
8332
|
const orderedColumns = useMemo9(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
|
|
8229
8333
|
const leafColumns = useMemo9(() => flattenTableColumns(orderedColumns), [orderedColumns]);
|
|
8230
8334
|
const headerRows = useMemo9(() => buildHeaderRows(orderedColumns), [orderedColumns]);
|
|
8231
|
-
const measuredCells =
|
|
8335
|
+
const measuredCells = useRef17(/* @__PURE__ */ new WeakSet());
|
|
8232
8336
|
const autoWidthSignature = leafColumns.map((column) => `${column.key}:${column.autoWidth}:${resizedWidths[column.key] ?? ""}`).join("|");
|
|
8233
|
-
|
|
8337
|
+
useEffect13(() => {
|
|
8234
8338
|
measuredCells.current = /* @__PURE__ */ new WeakSet();
|
|
8235
8339
|
setAutoColumnWidths({});
|
|
8236
8340
|
}, [dataSource, baseColumns, size, autoWidthSignature]);
|
|
8237
|
-
|
|
8341
|
+
useEffect13(() => {
|
|
8238
8342
|
const autoWidthColumns = leafColumns.filter((column) => column.autoWidth && resizedWidths[column.key] === void 0);
|
|
8239
8343
|
const root = rootRef.current;
|
|
8240
8344
|
if (!root || autoWidthColumns.length === 0) return;
|
|
@@ -8337,20 +8441,20 @@ function TableInner(props, ref) {
|
|
|
8337
8441
|
]);
|
|
8338
8442
|
const toolbarStart = sortedPlugins.map((plugin) => {
|
|
8339
8443
|
const content = plugin.renderToolbarStart?.(getContext(plugin));
|
|
8340
|
-
return content ? /* @__PURE__ */
|
|
8444
|
+
return content ? /* @__PURE__ */ jsx24(Fragment8, { children: content }, `toolbar-start-${plugin.id}`) : null;
|
|
8341
8445
|
}).filter(Boolean);
|
|
8342
8446
|
const toolbarEnd = sortedPlugins.map((plugin) => {
|
|
8343
8447
|
const content = plugin.renderToolbarEnd?.(getContext(plugin));
|
|
8344
|
-
return content ? /* @__PURE__ */
|
|
8448
|
+
return content ? /* @__PURE__ */ jsx24(Fragment8, { children: content }, `toolbar-end-${plugin.id}`) : null;
|
|
8345
8449
|
}).filter(Boolean);
|
|
8346
8450
|
const summaries = sortedPlugins.flatMap((plugin) => plugin.renderSummary?.(getContext(plugin)) ?? []);
|
|
8347
8451
|
const footers = sortedPlugins.map((plugin) => {
|
|
8348
8452
|
const content = plugin.renderFooter?.(getContext(plugin));
|
|
8349
|
-
return content ? /* @__PURE__ */
|
|
8453
|
+
return content ? /* @__PURE__ */ jsx24(Fragment8, { children: content }, `footer-${plugin.id}`) : null;
|
|
8350
8454
|
}).filter(Boolean);
|
|
8351
8455
|
const overlays = sortedPlugins.map((plugin) => {
|
|
8352
8456
|
const content = plugin.renderOverlay?.(getContext(plugin));
|
|
8353
|
-
return content ? /* @__PURE__ */
|
|
8457
|
+
return content ? /* @__PURE__ */ jsx24(Fragment8, { children: content }, `overlay-${plugin.id}`) : null;
|
|
8354
8458
|
}).filter(Boolean);
|
|
8355
8459
|
const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
|
|
8356
8460
|
const effectiveHeight = height ?? tableHeight ?? remainingHeight ?? (shouldVirtualize ? 420 : void 0);
|
|
@@ -8449,9 +8553,9 @@ function TableInner(props, ref) {
|
|
|
8449
8553
|
}
|
|
8450
8554
|
function renderHeaderContent(column, content) {
|
|
8451
8555
|
const title = getHeaderTitleText(column.title ?? column.name) || column.name || column.key;
|
|
8452
|
-
return /* @__PURE__ */
|
|
8453
|
-
/* @__PURE__ */
|
|
8454
|
-
column.description != null && /* @__PURE__ */
|
|
8556
|
+
return /* @__PURE__ */ jsxs22("span", { className: "sia-table__header-label", children: [
|
|
8557
|
+
/* @__PURE__ */ jsx24("span", { className: "sia-table__header-label-content", "data-sia-title-overflow-only": true, ...withTitleTooltip({ title }), children: content }),
|
|
8558
|
+
column.description != null && /* @__PURE__ */ jsx24(Tooltip, { title: column.description, placement: "top", trigger: ["hover", "focus"], children: /* @__PURE__ */ jsx24("button", { type: "button", className: "sia-table__header-description", "aria-label": `${column.name ?? column.key}\u5217\u8BF4\u660E`, onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx24(Icon, { name: "info", size: 14 }) }) })
|
|
8455
8559
|
] });
|
|
8456
8560
|
}
|
|
8457
8561
|
function getPluginCellProps(row, column) {
|
|
@@ -8491,17 +8595,17 @@ function TableInner(props, ref) {
|
|
|
8491
8595
|
}
|
|
8492
8596
|
function renderSummaryRow(summary) {
|
|
8493
8597
|
let labelRendered = false;
|
|
8494
|
-
return /* @__PURE__ */
|
|
8598
|
+
return /* @__PURE__ */ jsx24("tr", { className: `sia-table__summary-row ${summary.className ?? ""}`.trim(), children: leafColumns.map((column) => {
|
|
8495
8599
|
const value = summary.values[column.key];
|
|
8496
8600
|
const isLabel = value === void 0 && !labelRendered && summary.label !== void 0;
|
|
8497
8601
|
const content = value !== void 0 ? value : isLabel ? (labelRendered = true, summary.label) : null;
|
|
8498
8602
|
const fixed = normalizeFixed(column.fixed);
|
|
8499
8603
|
const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
8500
8604
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
8501
|
-
return /* @__PURE__ */
|
|
8605
|
+
return /* @__PURE__ */ jsx24("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__ */ jsx24("span", { className: "sia-table__summary-label", children: content }) : content }, column.key);
|
|
8502
8606
|
}) }, summary.key);
|
|
8503
8607
|
}
|
|
8504
|
-
return /* @__PURE__ */
|
|
8608
|
+
return /* @__PURE__ */ jsxs22(
|
|
8505
8609
|
"div",
|
|
8506
8610
|
{
|
|
8507
8611
|
ref: rootRef,
|
|
@@ -8552,19 +8656,19 @@ function TableInner(props, ref) {
|
|
|
8552
8656
|
htmlProps.onDoubleClickCapture?.(event);
|
|
8553
8657
|
},
|
|
8554
8658
|
children: [
|
|
8555
|
-
hasToolbar ? /* @__PURE__ */
|
|
8556
|
-
/* @__PURE__ */
|
|
8557
|
-
/* @__PURE__ */
|
|
8659
|
+
hasToolbar ? /* @__PURE__ */ jsxs22("div", { className: "sia-table__toolbar", children: [
|
|
8660
|
+
/* @__PURE__ */ jsx24("div", { children: toolbarStart }),
|
|
8661
|
+
/* @__PURE__ */ jsx24("div", { children: toolbarEnd })
|
|
8558
8662
|
] }) : null,
|
|
8559
|
-
/* @__PURE__ */
|
|
8560
|
-
/* @__PURE__ */
|
|
8561
|
-
/* @__PURE__ */
|
|
8562
|
-
/* @__PURE__ */
|
|
8663
|
+
/* @__PURE__ */ jsxs22("div", { className: "sia-table__viewport-wrap", children: [
|
|
8664
|
+
/* @__PURE__ */ jsx24("div", { className: "sia-table__viewport", ref: scrollRef, onScroll: handleScroll, children: /* @__PURE__ */ jsxs22("table", { ref: tableRef, className: "sia-table__element", style: { width: Math.max(totalWidth, 1), ...manualColumnLayout ? { minWidth: 0 } : {}, ...tableStyle }, children: [
|
|
8665
|
+
/* @__PURE__ */ jsx24("colgroup", { children: leafColumns.map((column) => /* @__PURE__ */ jsx24("col", { "data-column-key": column.key, style: { width: columnWidths.get(column.key) ?? DEFAULT_WIDTH } }, column.key)) }),
|
|
8666
|
+
/* @__PURE__ */ jsx24("thead", { className: stickyHeader ? "sia-table__head sia-table__head--sticky" : "sia-table__head", children: headerRows.map((headerRow, depth) => /* @__PURE__ */ jsx24("tr", { children: headerRow.map((cell) => {
|
|
8563
8667
|
const fixed = cell.fixed;
|
|
8564
8668
|
const pluginHeaderProps = getPluginHeaderCellProps(cell.column);
|
|
8565
8669
|
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" : "";
|
|
8566
8670
|
const autoWidthClass = cell.column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
8567
|
-
return /* @__PURE__ */
|
|
8671
|
+
return /* @__PURE__ */ jsx24(
|
|
8568
8672
|
"th",
|
|
8569
8673
|
{
|
|
8570
8674
|
"data-column-key": cell.column.key,
|
|
@@ -8585,16 +8689,16 @@ function TableInner(props, ref) {
|
|
|
8585
8689
|
`${cell.column.key}-${depth}-${cell.firstLeafKey}`
|
|
8586
8690
|
);
|
|
8587
8691
|
}) }, depth)) }),
|
|
8588
|
-
/* @__PURE__ */
|
|
8589
|
-
pipeline.rows.length === 0 && summaries.length > 0 ? /* @__PURE__ */
|
|
8590
|
-
topSpacer > 0 ? /* @__PURE__ */
|
|
8692
|
+
/* @__PURE__ */ jsxs22("tbody", { children: [
|
|
8693
|
+
pipeline.rows.length === 0 && summaries.length > 0 ? /* @__PURE__ */ jsx24("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx24("td", { colSpan: leafColumns.length, style: { height: Math.max(0, viewportHeight - (headerRows.length + summaries.length) * rowHeight), padding: 0, border: 0 } }) }) : null,
|
|
8694
|
+
topSpacer > 0 ? /* @__PURE__ */ jsx24("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx24("td", { colSpan: leafColumns.length, style: { height: topSpacer, padding: 0, border: 0 } }) }) : null,
|
|
8591
8695
|
renderedRows.map((row, offset) => {
|
|
8592
8696
|
const cached = rowElements.get(row.key);
|
|
8593
8697
|
if (cached) return cached;
|
|
8594
8698
|
const rowIndex = startIndex + offset;
|
|
8595
8699
|
const pluginClasses = sortedPlugins.map((plugin) => plugin.getRowClassName?.(row, getContext(plugin))).filter(Boolean).join(" ");
|
|
8596
8700
|
const customClass = typeof rowClassName === "function" ? rowClassName(row.record, row.sourceIndex) : rowClassName ?? "";
|
|
8597
|
-
const element = /* @__PURE__ */
|
|
8701
|
+
const element = /* @__PURE__ */ jsx24(
|
|
8598
8702
|
TableBodyRow,
|
|
8599
8703
|
{
|
|
8600
8704
|
canvas,
|
|
@@ -8645,13 +8749,13 @@ function TableInner(props, ref) {
|
|
|
8645
8749
|
rowElements.set(row.key, element);
|
|
8646
8750
|
return element;
|
|
8647
8751
|
}),
|
|
8648
|
-
bottomSpacer > 0 ? /* @__PURE__ */
|
|
8752
|
+
bottomSpacer > 0 ? /* @__PURE__ */ jsx24("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx24("td", { colSpan: leafColumns.length, style: { height: bottomSpacer, padding: 0, border: 0 } }) }) : null
|
|
8649
8753
|
] }),
|
|
8650
|
-
summaries.length > 0 ? /* @__PURE__ */
|
|
8754
|
+
summaries.length > 0 ? /* @__PURE__ */ jsx24("tfoot", { className: "sia-table__summary", children: summaries.map(renderSummaryRow) }) : null
|
|
8651
8755
|
] }) }),
|
|
8652
|
-
pipeline.rows.length === 0 ? /* @__PURE__ */
|
|
8653
|
-
canvas ? /* @__PURE__ */
|
|
8654
|
-
/* @__PURE__ */
|
|
8756
|
+
pipeline.rows.length === 0 ? /* @__PURE__ */ jsx24("div", { className: "sia-table__empty", role: "status", children: emptyText }) : null,
|
|
8757
|
+
canvas ? /* @__PURE__ */ jsx24(TableCanvasLayer, { viewport: scrollRef, rows: pipeline.rows, columns: leafColumns, widths: columnWidths, rowHeight, headerHeight: headerRows.length * rowHeight }) : null,
|
|
8758
|
+
/* @__PURE__ */ jsx24(
|
|
8655
8759
|
"div",
|
|
8656
8760
|
{
|
|
8657
8761
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--horizontal",
|
|
@@ -8662,10 +8766,10 @@ function TableInner(props, ref) {
|
|
|
8662
8766
|
onPointerMove: handleScrollbarPointerMove,
|
|
8663
8767
|
onPointerUp: handleScrollbarPointerEnd,
|
|
8664
8768
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
8665
|
-
children: /* @__PURE__ */
|
|
8769
|
+
children: /* @__PURE__ */ jsx24("div", { className: "sia-table__scrollbar-thumb" })
|
|
8666
8770
|
}
|
|
8667
8771
|
),
|
|
8668
|
-
/* @__PURE__ */
|
|
8772
|
+
/* @__PURE__ */ jsx24(
|
|
8669
8773
|
"div",
|
|
8670
8774
|
{
|
|
8671
8775
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--vertical",
|
|
@@ -8676,14 +8780,14 @@ function TableInner(props, ref) {
|
|
|
8676
8780
|
onPointerMove: handleScrollbarPointerMove,
|
|
8677
8781
|
onPointerUp: handleScrollbarPointerEnd,
|
|
8678
8782
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
8679
|
-
children: /* @__PURE__ */
|
|
8783
|
+
children: /* @__PURE__ */ jsx24("div", { className: "sia-table__scrollbar-thumb" })
|
|
8680
8784
|
}
|
|
8681
8785
|
)
|
|
8682
8786
|
] }),
|
|
8683
|
-
footers.length > 0 ? /* @__PURE__ */
|
|
8684
|
-
loading || internalLoading ? /* @__PURE__ */
|
|
8685
|
-
/* @__PURE__ */
|
|
8686
|
-
/* @__PURE__ */
|
|
8787
|
+
footers.length > 0 ? /* @__PURE__ */ jsx24("div", { className: "sia-table__footer", children: footers }) : null,
|
|
8788
|
+
loading || internalLoading ? /* @__PURE__ */ jsxs22("div", { className: "sia-table__loading", role: "status", children: [
|
|
8789
|
+
/* @__PURE__ */ jsx24(Icon, { name: "loader", size: 22, spin: true }),
|
|
8790
|
+
/* @__PURE__ */ jsx24("span", { children: "\u52A0\u8F7D\u4E2D" })
|
|
8687
8791
|
] }) : null,
|
|
8688
8792
|
overlays
|
|
8689
8793
|
]
|
|
@@ -8694,7 +8798,7 @@ var Table = forwardRef5(TableInner);
|
|
|
8694
8798
|
|
|
8695
8799
|
// src/components/ThemeSwitch.tsx
|
|
8696
8800
|
import { forwardRef as forwardRef6 } from "react";
|
|
8697
|
-
import { jsx as
|
|
8801
|
+
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
8698
8802
|
var ThemeSwitch = forwardRef6(function ThemeSwitch2({
|
|
8699
8803
|
checked,
|
|
8700
8804
|
onCheckedChange,
|
|
@@ -8708,7 +8812,7 @@ var ThemeSwitch = forwardRef6(function ThemeSwitch2({
|
|
|
8708
8812
|
onCheckedChange?.(!checked);
|
|
8709
8813
|
onClick?.(event);
|
|
8710
8814
|
}
|
|
8711
|
-
return /* @__PURE__ */
|
|
8815
|
+
return /* @__PURE__ */ jsxs23(
|
|
8712
8816
|
"button",
|
|
8713
8817
|
{
|
|
8714
8818
|
ref,
|
|
@@ -8720,12 +8824,12 @@ var ThemeSwitch = forwardRef6(function ThemeSwitch2({
|
|
|
8720
8824
|
onClick: handleClick,
|
|
8721
8825
|
...withTitleTooltip(props),
|
|
8722
8826
|
children: [
|
|
8723
|
-
/* @__PURE__ */
|
|
8724
|
-
/* @__PURE__ */
|
|
8725
|
-
/* @__PURE__ */
|
|
8726
|
-
/* @__PURE__ */
|
|
8827
|
+
/* @__PURE__ */ jsx25("span", { className: "sia-theme-switch__selection", "aria-hidden": "true" }),
|
|
8828
|
+
/* @__PURE__ */ jsx25("span", { className: `sia-theme-switch__icon${checked ? "" : " is-active"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxs23("svg", { viewBox: "0 0 24 24", children: [
|
|
8829
|
+
/* @__PURE__ */ jsx25("circle", { cx: "12", cy: "12", r: "3.5" }),
|
|
8830
|
+
/* @__PURE__ */ jsx25("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" })
|
|
8727
8831
|
] }) }),
|
|
8728
|
-
/* @__PURE__ */
|
|
8832
|
+
/* @__PURE__ */ jsx25("span", { className: `sia-theme-switch__icon${checked ? " is-active" : ""}`, "aria-hidden": "true", children: /* @__PURE__ */ jsx25("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx25("path", { d: "M20 15.2A8 8 0 0 1 8.8 4 8.5 8.5 0 1 0 20 15.2Z" }) }) })
|
|
8729
8833
|
]
|
|
8730
8834
|
}
|
|
8731
8835
|
);
|
|
@@ -8768,8 +8872,8 @@ function applySiaTheme(mode, target = document.documentElement) {
|
|
|
8768
8872
|
}
|
|
8769
8873
|
|
|
8770
8874
|
// src/components/InputSelect.tsx
|
|
8771
|
-
import { forwardRef as forwardRef7, useEffect as
|
|
8772
|
-
import { jsx as
|
|
8875
|
+
import { forwardRef as forwardRef7, useEffect as useEffect14, useRef as useRef18, useState as useState21 } from "react";
|
|
8876
|
+
import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
8773
8877
|
var InputSelect = forwardRef7(function InputSelect2({
|
|
8774
8878
|
options,
|
|
8775
8879
|
value,
|
|
@@ -8796,22 +8900,22 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8796
8900
|
...inputProps
|
|
8797
8901
|
}, forwardedRef) {
|
|
8798
8902
|
const size = useControlSize(sizeProp);
|
|
8799
|
-
const [internal, setInternal] =
|
|
8903
|
+
const [internal, setInternal] = useState21(defaultValue);
|
|
8800
8904
|
const current = value !== void 0 ? value : internal;
|
|
8801
8905
|
const values = current == null ? [] : Array.isArray(current) ? current : [current];
|
|
8802
8906
|
const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
|
|
8803
|
-
const [draft, setDraft] =
|
|
8804
|
-
|
|
8907
|
+
const [draft, setDraft] = useState21(text);
|
|
8908
|
+
useEffect14(() => {
|
|
8805
8909
|
setDraft(text);
|
|
8806
8910
|
}, [text, current]);
|
|
8807
|
-
const [open, setOpen] =
|
|
8808
|
-
const [search, setSearch] =
|
|
8809
|
-
const [modalOpen, setModalOpen] =
|
|
8810
|
-
const [modalValues, setModalValues] =
|
|
8811
|
-
const [selectedOnly, setSelectedOnly] =
|
|
8812
|
-
const rootRef =
|
|
8813
|
-
const popupRef =
|
|
8814
|
-
const inputRef =
|
|
8911
|
+
const [open, setOpen] = useState21(false);
|
|
8912
|
+
const [search, setSearch] = useState21("");
|
|
8913
|
+
const [modalOpen, setModalOpen] = useState21(false);
|
|
8914
|
+
const [modalValues, setModalValues] = useState21([]);
|
|
8915
|
+
const [selectedOnly, setSelectedOnly] = useState21(false);
|
|
8916
|
+
const rootRef = useRef18(null);
|
|
8917
|
+
const popupRef = useRef18(null);
|
|
8918
|
+
const inputRef = useRef18(null);
|
|
8815
8919
|
const config = typeof enableModal === "object" ? enableModal : {};
|
|
8816
8920
|
function changeOpen(next) {
|
|
8817
8921
|
if (next && (disabled || loading)) return;
|
|
@@ -8831,7 +8935,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8831
8935
|
inputRef.current?.focus();
|
|
8832
8936
|
}
|
|
8833
8937
|
}
|
|
8834
|
-
|
|
8938
|
+
useEffect14(() => {
|
|
8835
8939
|
if (!open) return;
|
|
8836
8940
|
const outside = (event) => {
|
|
8837
8941
|
if (!rootRef.current?.contains(event.target) && !popupRef.current?.contains(event.target)) changeOpen(false);
|
|
@@ -8839,7 +8943,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8839
8943
|
document.addEventListener("pointerdown", outside);
|
|
8840
8944
|
return () => document.removeEventListener("pointerdown", outside);
|
|
8841
8945
|
}, [open, onOpenChange]);
|
|
8842
|
-
|
|
8946
|
+
useEffect14(() => {
|
|
8843
8947
|
if (disabled || loading) {
|
|
8844
8948
|
changeOpen(false);
|
|
8845
8949
|
setModalOpen(false);
|
|
@@ -8852,14 +8956,14 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8852
8956
|
setSelectedOnly(false);
|
|
8853
8957
|
setModalOpen(true);
|
|
8854
8958
|
}
|
|
8855
|
-
return /* @__PURE__ */
|
|
8959
|
+
return /* @__PURE__ */ jsxs24("div", { ref: rootRef, style, className: `sia-input-select${open || modalOpen ? " is-open" : ""} ${className}`, onKeyDown: (event) => {
|
|
8856
8960
|
if (event.key === "Escape" && open) {
|
|
8857
8961
|
event.stopPropagation();
|
|
8858
8962
|
changeOpen(false);
|
|
8859
8963
|
inputRef.current?.focus();
|
|
8860
8964
|
}
|
|
8861
8965
|
}, children: [
|
|
8862
|
-
/* @__PURE__ */
|
|
8966
|
+
/* @__PURE__ */ jsx26(
|
|
8863
8967
|
Input,
|
|
8864
8968
|
{
|
|
8865
8969
|
...inputProps,
|
|
@@ -8896,26 +9000,26 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8896
9000
|
emit(parseInput ? parseInput(next) : multiple ? next.split(",").map((item) => item.trim()).filter(Boolean) : next);
|
|
8897
9001
|
changeOpen(true);
|
|
8898
9002
|
},
|
|
8899
|
-
suffix: /* @__PURE__ */
|
|
8900
|
-
allowClear && draft && !disabled && /* @__PURE__ */
|
|
9003
|
+
suffix: /* @__PURE__ */ jsxs24("span", { className: "sia-input-select__suffix", children: [
|
|
9004
|
+
allowClear && draft && !disabled && /* @__PURE__ */ jsx26(Button, { className: "sia-input-select__clear", variant: "text", size: "small", disabled: loading, "aria-label": "\u6E05\u9664\u8F93\u5165\u9009\u62E9", onClick: (event) => {
|
|
8901
9005
|
event.stopPropagation();
|
|
8902
9006
|
setDraft("");
|
|
8903
9007
|
emit(multiple ? [] : void 0);
|
|
8904
9008
|
inputRef.current?.focus();
|
|
8905
9009
|
}, children: "\xD7" }),
|
|
8906
9010
|
suffix,
|
|
8907
|
-
enableModal && /* @__PURE__ */
|
|
9011
|
+
enableModal && /* @__PURE__ */ jsx26(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
|
|
8908
9012
|
event.stopPropagation();
|
|
8909
9013
|
openModal();
|
|
8910
9014
|
}, children: "\u2026" }),
|
|
8911
|
-
/* @__PURE__ */
|
|
9015
|
+
/* @__PURE__ */ jsx26(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
|
|
8912
9016
|
event.stopPropagation();
|
|
8913
9017
|
changeOpen(!open);
|
|
8914
|
-
}, children: /* @__PURE__ */
|
|
9018
|
+
}, children: /* @__PURE__ */ jsx26(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
|
|
8915
9019
|
] })
|
|
8916
9020
|
}
|
|
8917
9021
|
),
|
|
8918
|
-
/* @__PURE__ */
|
|
9022
|
+
/* @__PURE__ */ jsx26(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx26(
|
|
8919
9023
|
SelectionPanel,
|
|
8920
9024
|
{
|
|
8921
9025
|
options,
|
|
@@ -8930,7 +9034,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8930
9034
|
onSearch: setSearch
|
|
8931
9035
|
}
|
|
8932
9036
|
) }),
|
|
8933
|
-
enableModal && /* @__PURE__ */
|
|
9037
|
+
enableModal && /* @__PURE__ */ jsxs24(
|
|
8934
9038
|
Modal,
|
|
8935
9039
|
{
|
|
8936
9040
|
open: modalOpen,
|
|
@@ -8943,15 +9047,15 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8943
9047
|
setModalOpen(false);
|
|
8944
9048
|
},
|
|
8945
9049
|
children: [
|
|
8946
|
-
/* @__PURE__ */
|
|
8947
|
-
/* @__PURE__ */
|
|
8948
|
-
/* @__PURE__ */
|
|
9050
|
+
/* @__PURE__ */ jsxs24("div", { className: "sia-selection-panel__actions", role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
9051
|
+
/* @__PURE__ */ jsx26(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
9052
|
+
/* @__PURE__ */ jsxs24(Button, { role: "tab", "aria-selected": selectedOnly, variant: selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(true), children: [
|
|
8949
9053
|
"\u5DF2\u9009\u9879(",
|
|
8950
9054
|
modalValues.length,
|
|
8951
9055
|
")"
|
|
8952
9056
|
] })
|
|
8953
9057
|
] }),
|
|
8954
|
-
modalOpen && /* @__PURE__ */
|
|
9058
|
+
modalOpen && /* @__PURE__ */ jsx26(
|
|
8955
9059
|
SelectionPanel,
|
|
8956
9060
|
{
|
|
8957
9061
|
options,
|
|
@@ -8972,13 +9076,13 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8972
9076
|
});
|
|
8973
9077
|
|
|
8974
9078
|
// src/components/QueryForm.tsx
|
|
8975
|
-
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect6, useRef as
|
|
9079
|
+
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect6, useRef as useRef21, useState as useState24 } from "react";
|
|
8976
9080
|
|
|
8977
9081
|
// src/components/QueryFormSettings.tsx
|
|
8978
|
-
import { useEffect as
|
|
9082
|
+
import { useEffect as useEffect16, useRef as useRef20, useState as useState23 } from "react";
|
|
8979
9083
|
|
|
8980
9084
|
// src/components/useQueryFieldSort.ts
|
|
8981
|
-
import { useEffect as
|
|
9085
|
+
import { useEffect as useEffect15, useRef as useRef19, useState as useState22 } from "react";
|
|
8982
9086
|
function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
8983
9087
|
const center = rects[from].top + rects[from].height / 2 + dy;
|
|
8984
9088
|
const rest = keys.map((_, index) => index).filter((index) => index !== from);
|
|
@@ -8997,13 +9101,13 @@ function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
|
8997
9101
|
return { ordered, offsets };
|
|
8998
9102
|
}
|
|
8999
9103
|
function useQueryFieldSort(keys, enabled, onCommit) {
|
|
9000
|
-
const listRef =
|
|
9001
|
-
const cancelRef =
|
|
9002
|
-
const commitRef =
|
|
9104
|
+
const listRef = useRef19(null);
|
|
9105
|
+
const cancelRef = useRef19();
|
|
9106
|
+
const commitRef = useRef19(onCommit);
|
|
9003
9107
|
commitRef.current = onCommit;
|
|
9004
|
-
const [preview, setPreview] =
|
|
9108
|
+
const [preview, setPreview] = useState22();
|
|
9005
9109
|
const signature = JSON.stringify(keys);
|
|
9006
|
-
|
|
9110
|
+
useEffect15(() => {
|
|
9007
9111
|
cancelRef.current?.();
|
|
9008
9112
|
return () => cancelRef.current?.();
|
|
9009
9113
|
}, [enabled, signature]);
|
|
@@ -9126,18 +9230,18 @@ function countQueryFieldRows(centers) {
|
|
|
9126
9230
|
}
|
|
9127
9231
|
|
|
9128
9232
|
// src/components/QueryFormSettings.tsx
|
|
9129
|
-
import { Fragment as Fragment9, jsx as
|
|
9233
|
+
import { Fragment as Fragment9, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
9130
9234
|
function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed, disabled) {
|
|
9131
|
-
const [snapshot, setSnapshot] =
|
|
9132
|
-
const [draft, setDraft] =
|
|
9133
|
-
const [open, setOpen] =
|
|
9134
|
-
const [loading, setLoading] =
|
|
9135
|
-
const [saving, setSaving] =
|
|
9136
|
-
const [error, setError] =
|
|
9137
|
-
const [loadFailed, setLoadFailed] =
|
|
9138
|
-
const token =
|
|
9139
|
-
const saveLock =
|
|
9140
|
-
const latest =
|
|
9235
|
+
const [snapshot, setSnapshot] = useState23();
|
|
9236
|
+
const [draft, setDraft] = useState23({ fields: [], defaultCollapsed: defaultCollapsed ?? false });
|
|
9237
|
+
const [open, setOpen] = useState23(false);
|
|
9238
|
+
const [loading, setLoading] = useState23(false);
|
|
9239
|
+
const [saving, setSaving] = useState23(false);
|
|
9240
|
+
const [error, setError] = useState23("");
|
|
9241
|
+
const [loadFailed, setLoadFailed] = useState23(false);
|
|
9242
|
+
const token = useRef20(0);
|
|
9243
|
+
const saveLock = useRef20(false);
|
|
9244
|
+
const latest = useRef20({ config, fields, defaultCollapsed, applyCollapsed });
|
|
9141
9245
|
latest.current = { config, fields, defaultCollapsed, applyCollapsed };
|
|
9142
9246
|
const moduleName = config?.scope.moduleName;
|
|
9143
9247
|
const businessKey = config?.scope.businessKey;
|
|
@@ -9165,7 +9269,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
9165
9269
|
if (request === token.current) setLoading(false);
|
|
9166
9270
|
}
|
|
9167
9271
|
}
|
|
9168
|
-
|
|
9272
|
+
useEffect16(() => {
|
|
9169
9273
|
setSnapshot(void 0);
|
|
9170
9274
|
setOpen(false);
|
|
9171
9275
|
setError("");
|
|
@@ -9220,7 +9324,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
9220
9324
|
const items = new Map(visibleDraft.map((item) => [item.key, item]));
|
|
9221
9325
|
setDraft((current) => ({ ...current, fields: keys.map((key, order) => ({ ...items.get(key), order })) }));
|
|
9222
9326
|
});
|
|
9223
|
-
const control = config ? /* @__PURE__ */
|
|
9327
|
+
const control = config ? /* @__PURE__ */ jsx27(
|
|
9224
9328
|
Button,
|
|
9225
9329
|
{
|
|
9226
9330
|
type: "button",
|
|
@@ -9229,16 +9333,16 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
9229
9333
|
"aria-label": "\u67E5\u8BE2\u8BBE\u7F6E",
|
|
9230
9334
|
disabled: disabled || saving,
|
|
9231
9335
|
loading: loading && !open,
|
|
9232
|
-
icon: /* @__PURE__ */
|
|
9336
|
+
icon: /* @__PURE__ */ jsx27(Icon, { name: "more-vertical" }),
|
|
9233
9337
|
onClick: () => {
|
|
9234
9338
|
setOpen(true);
|
|
9235
9339
|
void load(true);
|
|
9236
9340
|
}
|
|
9237
9341
|
}
|
|
9238
9342
|
) : null;
|
|
9239
|
-
const panel = config ? /* @__PURE__ */
|
|
9240
|
-
!open && error ? /* @__PURE__ */
|
|
9241
|
-
/* @__PURE__ */
|
|
9343
|
+
const panel = config ? /* @__PURE__ */ jsxs25(Fragment9, { children: [
|
|
9344
|
+
!open && error ? /* @__PURE__ */ jsx27("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,
|
|
9345
|
+
/* @__PURE__ */ jsx27(
|
|
9242
9346
|
Modal,
|
|
9243
9347
|
{
|
|
9244
9348
|
title: "\u67E5\u8BE2\u8BBE\u7F6E",
|
|
@@ -9251,15 +9355,15 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
9251
9355
|
onOpenChange: (next) => {
|
|
9252
9356
|
if (!saveLock.current) setOpen(next);
|
|
9253
9357
|
},
|
|
9254
|
-
children: /* @__PURE__ */
|
|
9255
|
-
loading ? /* @__PURE__ */
|
|
9256
|
-
error ? /* @__PURE__ */
|
|
9358
|
+
children: /* @__PURE__ */ jsxs25("div", { className: "sia-query-settings", children: [
|
|
9359
|
+
loading ? /* @__PURE__ */ jsx27("p", { role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u67E5\u8BE2\u8BBE\u7F6E\u2026" }) : null,
|
|
9360
|
+
error ? /* @__PURE__ */ jsxs25("div", { role: "alert", className: "sia-query-form__error", children: [
|
|
9257
9361
|
error,
|
|
9258
|
-
loadFailed ? /* @__PURE__ */
|
|
9362
|
+
loadFailed ? /* @__PURE__ */ jsx27(Button, { type: "button", variant: "link", onClick: () => void load(true), children: "\u91CD\u8BD5" }) : null
|
|
9259
9363
|
] }) : null,
|
|
9260
|
-
/* @__PURE__ */
|
|
9261
|
-
/* @__PURE__ */
|
|
9262
|
-
/* @__PURE__ */
|
|
9364
|
+
/* @__PURE__ */ jsx27(Checkbox, { checked: draft.defaultCollapsed, disabled: locked, onChange: (checked) => setDraft((current) => ({ ...current, defaultCollapsed: checked })), children: "\u9ED8\u8BA4\u6536\u8D77\u67E5\u8BE2\u6761\u4EF6" }),
|
|
9365
|
+
/* @__PURE__ */ jsx27("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" }),
|
|
9366
|
+
/* @__PURE__ */ jsx27("div", { ref: sort.listRef, className: `sia-query-settings__list${sort.preview ? " is-sorting" : ""}`, children: visibleDraft.map((item, index) => /* @__PURE__ */ jsxs25(
|
|
9263
9367
|
"div",
|
|
9264
9368
|
{
|
|
9265
9369
|
"data-query-field-key": item.key,
|
|
@@ -9267,18 +9371,18 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
9267
9371
|
style: sort.preview ? { transform: `translateY(${sort.preview.offsets[item.key] ?? 0}px)` } : void 0,
|
|
9268
9372
|
onPointerDown: (event) => sort.start(event, item.key),
|
|
9269
9373
|
children: [
|
|
9270
|
-
/* @__PURE__ */
|
|
9271
|
-
/* @__PURE__ */
|
|
9272
|
-
/* @__PURE__ */
|
|
9273
|
-
/* @__PURE__ */
|
|
9274
|
-
/* @__PURE__ */
|
|
9275
|
-
/* @__PURE__ */
|
|
9374
|
+
/* @__PURE__ */ jsx27(Icon, { name: "menu", size: 15 }),
|
|
9375
|
+
/* @__PURE__ */ jsx27(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) })) }),
|
|
9376
|
+
/* @__PURE__ */ jsx27("span", { className: "sia-query-settings__name", children: labels.get(item.key) ?? item.key }),
|
|
9377
|
+
/* @__PURE__ */ jsxs25("div", { className: "sia-query-settings__order", children: [
|
|
9378
|
+
/* @__PURE__ */ jsx27(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0A\u79FB ${item.key}`, disabled: locked || index === 0, icon: /* @__PURE__ */ jsx27(Icon, { name: "chevron-up" }), onClick: () => move(index, index - 1) }),
|
|
9379
|
+
/* @__PURE__ */ jsx27(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0B\u79FB ${item.key}`, disabled: locked || index === visibleDraft.length - 1, icon: /* @__PURE__ */ jsx27(Icon, { name: "chevron-down" }), onClick: () => move(index, index + 1) })
|
|
9276
9380
|
] })
|
|
9277
9381
|
]
|
|
9278
9382
|
},
|
|
9279
9383
|
item.key
|
|
9280
9384
|
)) }),
|
|
9281
|
-
/* @__PURE__ */
|
|
9385
|
+
/* @__PURE__ */ jsx27(Button, { type: "button", disabled: locked, onClick: () => setDraft({ fields: reconcileQueryFields(fields.map((field) => field.key)), defaultCollapsed: defaultCollapsed ?? false }), children: "\u6062\u590D\u9ED8\u8BA4" })
|
|
9282
9386
|
] })
|
|
9283
9387
|
}
|
|
9284
9388
|
)
|
|
@@ -9287,7 +9391,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
9287
9391
|
}
|
|
9288
9392
|
|
|
9289
9393
|
// src/components/QueryForm.tsx
|
|
9290
|
-
import { jsx as
|
|
9394
|
+
import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
9291
9395
|
function QueryForm({
|
|
9292
9396
|
fields,
|
|
9293
9397
|
settings,
|
|
@@ -9322,23 +9426,23 @@ function QueryForm({
|
|
|
9322
9426
|
...formProps
|
|
9323
9427
|
}) {
|
|
9324
9428
|
const [form] = useForm(providedForm);
|
|
9325
|
-
const [internalCollapsed, setInternalCollapsed] =
|
|
9326
|
-
const [expandedRows, setExpandedRows] =
|
|
9327
|
-
const [needsCollapse, setNeedsCollapse] =
|
|
9429
|
+
const [internalCollapsed, setInternalCollapsed] = useState24(defaultCollapsed);
|
|
9430
|
+
const [expandedRows, setExpandedRows] = useState24(0);
|
|
9431
|
+
const [needsCollapse, setNeedsCollapse] = useState24(false);
|
|
9328
9432
|
const collapsed = collapsible && needsCollapse && (controlledCollapsed ?? internalCollapsed ?? expandedRows >= 3);
|
|
9329
|
-
const [searching, setSearching] =
|
|
9330
|
-
const [saving, setSaving] =
|
|
9331
|
-
const [removing, setRemoving] =
|
|
9332
|
-
const [saveOpen, setSaveOpen] =
|
|
9333
|
-
const [saveName, setSaveName] =
|
|
9334
|
-
const [saveError, setSaveError] =
|
|
9335
|
-
const [error, setError] =
|
|
9336
|
-
const [activeShortcut, setActiveShortcut] =
|
|
9337
|
-
const source =
|
|
9338
|
-
const searchLock =
|
|
9339
|
-
const saveLock =
|
|
9340
|
-
const removeLock =
|
|
9341
|
-
const snapshot =
|
|
9433
|
+
const [searching, setSearching] = useState24(false);
|
|
9434
|
+
const [saving, setSaving] = useState24(false);
|
|
9435
|
+
const [removing, setRemoving] = useState24(false);
|
|
9436
|
+
const [saveOpen, setSaveOpen] = useState24(false);
|
|
9437
|
+
const [saveName, setSaveName] = useState24("");
|
|
9438
|
+
const [saveError, setSaveError] = useState24("");
|
|
9439
|
+
const [error, setError] = useState24("");
|
|
9440
|
+
const [activeShortcut, setActiveShortcut] = useState24("");
|
|
9441
|
+
const source = useRef21({ source: "submit" });
|
|
9442
|
+
const searchLock = useRef21(false);
|
|
9443
|
+
const saveLock = useRef21(false);
|
|
9444
|
+
const removeLock = useRef21(false);
|
|
9445
|
+
const snapshot = useRef21();
|
|
9342
9446
|
const busy = disabled || loading || searching;
|
|
9343
9447
|
const shortcutBusy = busy || shortcutsLoading || saving || removing;
|
|
9344
9448
|
const fieldLabel = (content) => {
|
|
@@ -9349,7 +9453,7 @@ function QueryForm({
|
|
|
9349
9453
|
key,
|
|
9350
9454
|
width,
|
|
9351
9455
|
label: settingsLabel ?? item.label ?? (typeof item.children === "function" ? void 0 : fieldLabel(item.children)) ?? key,
|
|
9352
|
-
content: /* @__PURE__ */
|
|
9456
|
+
content: /* @__PURE__ */ jsx28(Form.Item, { noStyle: true, ...item })
|
|
9353
9457
|
})) : Children4.toArray(children).map((content, index) => ({
|
|
9354
9458
|
key: isValidElement5(content) && content.key != null ? String(content.key) : String(index),
|
|
9355
9459
|
width: void 0,
|
|
@@ -9363,11 +9467,11 @@ function QueryForm({
|
|
|
9363
9467
|
const entries = configured.map((item) => ({ ...entriesByKey.get(item.key), visible: item.visible, visibleIndex: item.visible ? visibleIndex++ : -1 }));
|
|
9364
9468
|
const layoutKey = JSON.stringify(configured);
|
|
9365
9469
|
const limit = Math.max(1, Math.floor(collapsedCount));
|
|
9366
|
-
const rowRef =
|
|
9367
|
-
const actionsRef =
|
|
9368
|
-
const toggleRef =
|
|
9369
|
-
const [fittingCount, setFittingCount] =
|
|
9370
|
-
const [settingsRows, setSettingsRows] =
|
|
9470
|
+
const rowRef = useRef21(null);
|
|
9471
|
+
const actionsRef = useRef21(null);
|
|
9472
|
+
const toggleRef = useRef21(null);
|
|
9473
|
+
const [fittingCount, setFittingCount] = useState24(limit);
|
|
9474
|
+
const [settingsRows, setSettingsRows] = useState24(0);
|
|
9371
9475
|
useLayoutEffect6(() => {
|
|
9372
9476
|
const row = rowRef.current;
|
|
9373
9477
|
const actions = actionsRef.current;
|
|
@@ -9526,8 +9630,8 @@ function QueryForm({
|
|
|
9526
9630
|
setRemoving(false);
|
|
9527
9631
|
}
|
|
9528
9632
|
}
|
|
9529
|
-
return /* @__PURE__ */
|
|
9530
|
-
/* @__PURE__ */
|
|
9633
|
+
return /* @__PURE__ */ jsxs26("div", { className: `sia-query-form ${className}`.trim(), children: [
|
|
9634
|
+
/* @__PURE__ */ jsxs26(
|
|
9531
9635
|
Form,
|
|
9532
9636
|
{
|
|
9533
9637
|
...formProps,
|
|
@@ -9546,8 +9650,8 @@ function QueryForm({
|
|
|
9546
9650
|
onValuesChange?.(changed, values);
|
|
9547
9651
|
},
|
|
9548
9652
|
children: [
|
|
9549
|
-
quickQueries.length ? /* @__PURE__ */
|
|
9550
|
-
quickQueries.map((query) => /* @__PURE__ */
|
|
9653
|
+
quickQueries.length ? /* @__PURE__ */ jsxs26("div", { className: "sia-query-form__quick", "aria-label": "\u9884\u8BBE\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
9654
|
+
quickQueries.map((query) => /* @__PURE__ */ jsx28(
|
|
9551
9655
|
Badge,
|
|
9552
9656
|
{
|
|
9553
9657
|
className: "sia-query-form__quick-badge",
|
|
@@ -9556,7 +9660,7 @@ function QueryForm({
|
|
|
9556
9660
|
title: query.count === void 0 ? void 0 : `\u5171 ${query.count} \u6761`,
|
|
9557
9661
|
...query.badgeProps,
|
|
9558
9662
|
count: query.count,
|
|
9559
|
-
children: /* @__PURE__ */
|
|
9663
|
+
children: /* @__PURE__ */ jsx28(
|
|
9560
9664
|
Button,
|
|
9561
9665
|
{
|
|
9562
9666
|
size: query.size ?? quickQuerySize,
|
|
@@ -9572,7 +9676,7 @@ function QueryForm({
|
|
|
9572
9676
|
)),
|
|
9573
9677
|
" "
|
|
9574
9678
|
] }) : null,
|
|
9575
|
-
/* @__PURE__ */
|
|
9679
|
+
/* @__PURE__ */ jsxs26(
|
|
9576
9680
|
"div",
|
|
9577
9681
|
{
|
|
9578
9682
|
ref: rowRef,
|
|
@@ -9581,7 +9685,7 @@ function QueryForm({
|
|
|
9581
9685
|
"--sia-query-field-width": typeof fieldWidth === "number" ? `${fieldWidth}px` : fieldWidth
|
|
9582
9686
|
},
|
|
9583
9687
|
children: [
|
|
9584
|
-
entries.map((entry) => /* @__PURE__ */
|
|
9688
|
+
entries.map((entry) => /* @__PURE__ */ jsx28(
|
|
9585
9689
|
"div",
|
|
9586
9690
|
{
|
|
9587
9691
|
className: "sia-query-form__field",
|
|
@@ -9594,9 +9698,9 @@ function QueryForm({
|
|
|
9594
9698
|
},
|
|
9595
9699
|
entry.key
|
|
9596
9700
|
)),
|
|
9597
|
-
/* @__PURE__ */
|
|
9598
|
-
/* @__PURE__ */
|
|
9599
|
-
/* @__PURE__ */
|
|
9701
|
+
/* @__PURE__ */ jsxs26("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
|
|
9702
|
+
/* @__PURE__ */ jsxs26(Space.Compact, { children: [
|
|
9703
|
+
/* @__PURE__ */ jsx28(
|
|
9600
9704
|
Button,
|
|
9601
9705
|
{
|
|
9602
9706
|
type: "submit",
|
|
@@ -9606,8 +9710,8 @@ function QueryForm({
|
|
|
9606
9710
|
children: searchText
|
|
9607
9711
|
}
|
|
9608
9712
|
),
|
|
9609
|
-
/* @__PURE__ */
|
|
9610
|
-
onSaveQuery ? /* @__PURE__ */
|
|
9713
|
+
/* @__PURE__ */ jsx28(Button, { disabled: busy, onClick: reset, children: resetText }),
|
|
9714
|
+
onSaveQuery ? /* @__PURE__ */ jsx28(
|
|
9611
9715
|
Button,
|
|
9612
9716
|
{
|
|
9613
9717
|
disabled: shortcutBusy,
|
|
@@ -9622,12 +9726,12 @@ function QueryForm({
|
|
|
9622
9726
|
) : null,
|
|
9623
9727
|
showSettings ?? settingsRows > 2 ? cloudSettings.control : null
|
|
9624
9728
|
] }),
|
|
9625
|
-
collapsible && entries.length > 0 ? /* @__PURE__ */
|
|
9729
|
+
collapsible && entries.length > 0 ? /* @__PURE__ */ jsx28("span", { ref: toggleRef, hidden: !needsCollapse, children: /* @__PURE__ */ jsx28(
|
|
9626
9730
|
Button,
|
|
9627
9731
|
{
|
|
9628
9732
|
variant: "link",
|
|
9629
9733
|
"aria-expanded": !collapsed,
|
|
9630
|
-
icon: /* @__PURE__ */
|
|
9734
|
+
icon: /* @__PURE__ */ jsx28(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
|
|
9631
9735
|
iconPosition: "end",
|
|
9632
9736
|
onClick: () => {
|
|
9633
9737
|
setInternalCollapsed(!collapsed);
|
|
@@ -9642,8 +9746,8 @@ function QueryForm({
|
|
|
9642
9746
|
]
|
|
9643
9747
|
}
|
|
9644
9748
|
),
|
|
9645
|
-
savedQueries.length ? /* @__PURE__ */
|
|
9646
|
-
savedQueries.map((query, index) => /* @__PURE__ */
|
|
9749
|
+
savedQueries.length ? /* @__PURE__ */ jsxs26("div", { className: "sia-query-form__saved", "aria-label": "\u5DF2\u4FDD\u5B58\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
9750
|
+
savedQueries.map((query, index) => /* @__PURE__ */ jsx28(
|
|
9647
9751
|
Tag,
|
|
9648
9752
|
{
|
|
9649
9753
|
status: query.status ?? ["processing", "success", "warning", "error"][index % 4],
|
|
@@ -9669,11 +9773,11 @@ function QueryForm({
|
|
|
9669
9773
|
)),
|
|
9670
9774
|
" "
|
|
9671
9775
|
] }) : null,
|
|
9672
|
-
error ? /* @__PURE__ */
|
|
9776
|
+
error ? /* @__PURE__ */ jsx28("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
|
|
9673
9777
|
]
|
|
9674
9778
|
}
|
|
9675
9779
|
),
|
|
9676
|
-
/* @__PURE__ */
|
|
9780
|
+
/* @__PURE__ */ jsxs26(
|
|
9677
9781
|
Modal,
|
|
9678
9782
|
{
|
|
9679
9783
|
open: saveOpen,
|
|
@@ -9685,7 +9789,7 @@ function QueryForm({
|
|
|
9685
9789
|
if (!saveLock.current) setSaveOpen(next);
|
|
9686
9790
|
},
|
|
9687
9791
|
children: [
|
|
9688
|
-
/* @__PURE__ */
|
|
9792
|
+
/* @__PURE__ */ jsx28(
|
|
9689
9793
|
Input,
|
|
9690
9794
|
{
|
|
9691
9795
|
autoFocus: true,
|
|
@@ -9704,7 +9808,7 @@ function QueryForm({
|
|
|
9704
9808
|
}
|
|
9705
9809
|
}
|
|
9706
9810
|
),
|
|
9707
|
-
saveError ? /* @__PURE__ */
|
|
9811
|
+
saveError ? /* @__PURE__ */ jsx28("p", { className: "sia-query-form__error", role: "alert", children: saveError }) : null
|
|
9708
9812
|
]
|
|
9709
9813
|
}
|
|
9710
9814
|
)
|
|
@@ -9713,7 +9817,7 @@ function QueryForm({
|
|
|
9713
9817
|
|
|
9714
9818
|
// src/components/NumberRange.tsx
|
|
9715
9819
|
import { forwardRef as forwardRef8 } from "react";
|
|
9716
|
-
import { jsx as
|
|
9820
|
+
import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
9717
9821
|
var NumberRange = forwardRef8(function NumberRange2({
|
|
9718
9822
|
value,
|
|
9719
9823
|
defaultValue = [null, null],
|
|
@@ -9742,7 +9846,7 @@ var NumberRange = forwardRef8(function NumberRange2({
|
|
|
9742
9846
|
setValue2(index === 0 ? [next, range[1]] : [range[0], next]);
|
|
9743
9847
|
}
|
|
9744
9848
|
const inputProps = { min, max, step, precision, size, status, disabled, readOnly, placeholderMode, controls: false };
|
|
9745
|
-
return /* @__PURE__ */
|
|
9849
|
+
return /* @__PURE__ */ jsxs27(
|
|
9746
9850
|
"span",
|
|
9747
9851
|
{
|
|
9748
9852
|
...props,
|
|
@@ -9751,7 +9855,7 @@ var NumberRange = forwardRef8(function NumberRange2({
|
|
|
9751
9855
|
"aria-disabled": disabled || void 0,
|
|
9752
9856
|
className: `sia-number-range sia-number-range--${size} sia-number-range--${status}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
9753
9857
|
children: [
|
|
9754
|
-
/* @__PURE__ */
|
|
9858
|
+
/* @__PURE__ */ jsx29(
|
|
9755
9859
|
InputNumber,
|
|
9756
9860
|
{
|
|
9757
9861
|
...inputProps,
|
|
@@ -9763,8 +9867,8 @@ var NumberRange = forwardRef8(function NumberRange2({
|
|
|
9763
9867
|
onChange: (next) => change(0, next)
|
|
9764
9868
|
}
|
|
9765
9869
|
),
|
|
9766
|
-
/* @__PURE__ */
|
|
9767
|
-
/* @__PURE__ */
|
|
9870
|
+
/* @__PURE__ */ jsx29(Icon, { className: "sia-number-range__separator", name: "tilde", size: 12, strokeWidth: 1.5, "aria-hidden": "true" }),
|
|
9871
|
+
/* @__PURE__ */ jsx29(
|
|
9768
9872
|
InputNumber,
|
|
9769
9873
|
{
|
|
9770
9874
|
...inputProps,
|
|
@@ -9776,13 +9880,14 @@ var NumberRange = forwardRef8(function NumberRange2({
|
|
|
9776
9880
|
onChange: (next) => change(1, next)
|
|
9777
9881
|
}
|
|
9778
9882
|
),
|
|
9779
|
-
allowClear && !disabled && !readOnly && range.some((item) => item !== null) ? /* @__PURE__ */
|
|
9883
|
+
allowClear && !disabled && !readOnly && range.some((item) => item !== null) ? /* @__PURE__ */ jsx29("button", { type: "button", className: "sia-number-range__clear", "aria-label": "\u6E05\u9664\u6570\u5B57\u533A\u95F4", onClick: () => setValue2([null, null]), children: /* @__PURE__ */ jsx29(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null
|
|
9780
9884
|
]
|
|
9781
9885
|
}
|
|
9782
9886
|
);
|
|
9783
9887
|
});
|
|
9784
9888
|
export {
|
|
9785
9889
|
Alert,
|
|
9890
|
+
AutoSizer,
|
|
9786
9891
|
Badge,
|
|
9787
9892
|
BarChart,
|
|
9788
9893
|
Breadcrumb,
|
|
@@ -9824,6 +9929,7 @@ export {
|
|
|
9824
9929
|
FILLED_ICON_NAMES,
|
|
9825
9930
|
Flex,
|
|
9826
9931
|
FloatButton,
|
|
9932
|
+
FloatingPanel,
|
|
9827
9933
|
FloatingScrollbarProvider,
|
|
9828
9934
|
ForceChart,
|
|
9829
9935
|
ForceGraphChart,
|
|
@@ -9870,6 +9976,7 @@ export {
|
|
|
9870
9976
|
SelectionPanel,
|
|
9871
9977
|
SiaChart,
|
|
9872
9978
|
Slider,
|
|
9979
|
+
SortableList,
|
|
9873
9980
|
Space,
|
|
9874
9981
|
Spin,
|
|
9875
9982
|
Splitter,
|