@sia.soul/sia-react-ui 0.1.126 → 0.1.127

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/index.js CHANGED
@@ -82,7 +82,7 @@ import {
82
82
  Watermark,
83
83
  message,
84
84
  notification
85
- } from "./chunk-OYBMDSTC.js";
85
+ } from "./chunk-MQ6SYFJW.js";
86
86
  import "./chunk-RX242MUO.js";
87
87
  import {
88
88
  MarkdownEditor
@@ -90,12 +90,12 @@ import {
90
90
  import {
91
91
  RichTextContent,
92
92
  RichTextEditor
93
- } from "./chunk-B333SUKG.js";
93
+ } from "./chunk-RC5MXFLI.js";
94
94
  import {
95
95
  DatePicker,
96
96
  SelectDateRange,
97
97
  TimePanel
98
- } from "./chunk-PUNKAJBB.js";
98
+ } from "./chunk-J3RX7GCZ.js";
99
99
  import {
100
100
  Checkbox,
101
101
  FloatingScrollbarProvider,
@@ -107,14 +107,14 @@ import {
107
107
  Tooltip,
108
108
  Tree,
109
109
  useScrollbarProximity
110
- } from "./chunk-WA3LO3LY.js";
110
+ } from "./chunk-NYU3DJVZ.js";
111
111
  import {
112
112
  Dropdown,
113
113
  Input,
114
114
  Menu,
115
115
  Segmented,
116
116
  Steps
117
- } from "./chunk-D3CROVS2.js";
117
+ } from "./chunk-EWEDQ3VJ.js";
118
118
  import {
119
119
  TextArea
120
120
  } from "./chunk-SCEHVGKV.js";
@@ -125,7 +125,7 @@ import {
125
125
  Modal,
126
126
  OverlayPortal,
127
127
  useOverlayLifecycle
128
- } from "./chunk-33FOEIXI.js";
128
+ } from "./chunk-PQBCD54U.js";
129
129
  import {
130
130
  Button
131
131
  } from "./chunk-CZ2ITBRW.js";
@@ -8350,6 +8350,7 @@ var TableBodyRow = memo(function TableBodyRow2({
8350
8350
  return /* @__PURE__ */ jsx25(
8351
8351
  "tr",
8352
8352
  {
8353
+ "data-row-key": String(row.key),
8353
8354
  "data-canvas-row-index": canvas ? rowIndex : void 0,
8354
8355
  className: `sia-table__row${striped && rowIndex % 2 === 1 ? " sia-table__row--striped" : ""} ${className}`.trim(),
8355
8356
  style: { height: rowHeight },
@@ -9078,9 +9079,640 @@ function TableInner(props, ref) {
9078
9079
  }
9079
9080
  var Table = forwardRef5(TableInner);
9080
9081
 
9082
+ // src/components/Table/worksheetModel.ts
9083
+ function parseWorksheetText(text) {
9084
+ const rows = [[]];
9085
+ let value = "";
9086
+ let quoted = false;
9087
+ for (let i = 0; i < text.length; i++) {
9088
+ const char = text[i];
9089
+ if (char === '"' && (quoted || value === "")) {
9090
+ if (quoted && text[i + 1] === '"') {
9091
+ value += '"';
9092
+ i++;
9093
+ } else quoted = !quoted;
9094
+ } else if (!quoted && (char === " " || char === "\n" || char === "\r")) {
9095
+ rows[rows.length - 1].push(value);
9096
+ value = "";
9097
+ if (char !== " ") {
9098
+ if (char === "\r" && text[i + 1] === "\n") i++;
9099
+ rows.push([]);
9100
+ }
9101
+ } else value += char;
9102
+ }
9103
+ rows[rows.length - 1].push(value);
9104
+ if (/\r?\n$/.test(text) && rows.length > 1 && rows.at(-1)?.length === 1 && rows.at(-1)?.[0] === "")
9105
+ rows.pop();
9106
+ return rows;
9107
+ }
9108
+ function worksheetText(rows) {
9109
+ return rows.map(
9110
+ (row) => row.map((value) => {
9111
+ const text = String(value ?? "");
9112
+ return /[\t\r\n"]/.test(text) ? `"${text.replaceAll('"', '""')}"` : text;
9113
+ }).join(" ")
9114
+ ).join("\n");
9115
+ }
9116
+ function setWorksheetValue(record, column, value) {
9117
+ const path = Array.isArray(column.dataIndex) ? column.dataIndex : String(column.dataIndex ?? column.code ?? column.key).split(".");
9118
+ if (!path.length || path.some((key) => ["__proto__", "prototype", "constructor"].includes(key)))
9119
+ return record;
9120
+ const update = (source, index) => {
9121
+ const copy = Array.isArray(source) ? [...source] : { ...source && typeof source === "object" ? source : {} };
9122
+ copy[path[index]] = index === path.length - 1 ? value : update(copy[path[index]], index + 1);
9123
+ return copy;
9124
+ };
9125
+ return update(record, 0);
9126
+ }
9127
+ function incrementWorksheetValue(value, offset) {
9128
+ if (typeof value === "number")
9129
+ return Number.isFinite(value) ? value + offset : value;
9130
+ if (typeof value !== "string") return value;
9131
+ const match = value.match(/^(.*?)(\d+(?:\.\d+)?)([^\d]*)$/);
9132
+ if (!match) return value;
9133
+ const [, prefix, number, suffix] = match;
9134
+ const [integer, decimal = ""] = number.split(".");
9135
+ const next = Number(number) + offset;
9136
+ if (!Number.isFinite(next)) return value;
9137
+ const result = decimal ? next.toFixed(decimal.length) : String(Math.trunc(next));
9138
+ const [whole, fraction] = result.split(".");
9139
+ const signed = whole.startsWith("-");
9140
+ const digits = signed ? whole.slice(1) : whole;
9141
+ const padded = integer.length > 1 && integer.startsWith("0") ? digits.padStart(integer.length, "0") : digits;
9142
+ return `${prefix}${signed ? "-" : ""}${padded}${fraction === void 0 ? "" : `.${fraction}`}${suffix}`;
9143
+ }
9144
+
9145
+ // src/components/Table/worksheet.tsx
9146
+ import { Fragment as Fragment10, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
9147
+ var isEmpty2 = (value) => value == null || value === "";
9148
+ var editorKind = (column) => !column.editable ? "readonly" : typeof column.editable === "object" ? column.editable.type ?? "input" : "input";
9149
+ var nativeEditor = (target) => target instanceof Element && Boolean(
9150
+ target.closest(
9151
+ 'input,textarea,select,[contenteditable="true"],[role="combobox"]'
9152
+ )
9153
+ );
9154
+ function createWorksheetPlugin(options) {
9155
+ let context;
9156
+ let root = null;
9157
+ let data = [];
9158
+ let observed;
9159
+ let expected;
9160
+ let editEpoch = 0;
9161
+ let suppressEditing = false;
9162
+ const undoStack = [];
9163
+ const redoStack = [];
9164
+ const limit = Number.isFinite(options.historyLimit) ? Math.max(1, Math.floor(options.historyLimit)) : 100;
9165
+ let clipboard;
9166
+ let drag;
9167
+ let frame = 0, pointerY = 0, pointerX = 0;
9168
+ const selection = () => context.getPluginApi("cellSelection");
9169
+ const range = () => selection()?.getRange() ?? null;
9170
+ const redraw = () => context.setState((state) => ({ ...state, revision: state.revision + 1 }));
9171
+ let columnInput;
9172
+ let columnCache = [];
9173
+ let rangeContext;
9174
+ let cachedRange;
9175
+ let cachedBounds;
9176
+ const columns = () => {
9177
+ if (columnInput !== context.columns) {
9178
+ columnInput = context.columns;
9179
+ columnCache = flattenTableColumns(
9180
+ sortTableColumnsByFixed(context.columns)
9181
+ ).filter((column) => !column.meta?.plugin);
9182
+ }
9183
+ return columnCache;
9184
+ };
9185
+ const valueAt = (rowIndex, column) => getTableValue(
9186
+ context.rows[rowIndex].record,
9187
+ column.dataIndex,
9188
+ column.code ?? column.key
9189
+ );
9190
+ const editable = (record, column) => Boolean(column.editable) && (typeof column.editable !== "object" || column.editable.canEdit?.(record) !== false);
9191
+ function bounds() {
9192
+ const selectedRange = range();
9193
+ if (rangeContext === context && cachedRange === selectedRange)
9194
+ return cachedBounds;
9195
+ rangeContext = context;
9196
+ cachedRange = selectedRange;
9197
+ const cols = columns();
9198
+ const rowIndexes = new Map(
9199
+ context.rows.map((row, index) => [row.key, index])
9200
+ );
9201
+ const columnIndexes = new Map(
9202
+ cols.map((column, index) => [column.key, index])
9203
+ );
9204
+ let result;
9205
+ for (const cell of selection()?.getSelectedCells() ?? []) {
9206
+ const col = columnIndexes.get(cell.columnKey), row = rowIndexes.get(cell.rowKey);
9207
+ if (col === void 0 || row === void 0) continue;
9208
+ if (!result) result = { top: row, bottom: row, left: col, right: col };
9209
+ else {
9210
+ result.top = Math.min(result.top, row);
9211
+ result.bottom = Math.max(result.bottom, row);
9212
+ result.left = Math.min(result.left, col);
9213
+ result.right = Math.max(result.right, col);
9214
+ }
9215
+ }
9216
+ return cachedBounds = result;
9217
+ }
9218
+ function sourceCells(area) {
9219
+ return context.rows.slice(area.top, area.bottom + 1).map(
9220
+ (row) => columns().slice(area.left, area.right + 1).map((column) => ({
9221
+ value: getTableValue(
9222
+ row.record,
9223
+ column.dataIndex,
9224
+ column.code ?? column.key
9225
+ ),
9226
+ kind: editable(row.record, column) ? editorKind(column) : "readonly",
9227
+ columnKey: column.key,
9228
+ record: row.record
9229
+ }))
9230
+ );
9231
+ }
9232
+ function stopDrag() {
9233
+ cancelAnimationFrame(frame);
9234
+ frame = 0;
9235
+ const active = Boolean(drag);
9236
+ drag = void 0;
9237
+ if (active) redraw();
9238
+ }
9239
+ function clearHistory() {
9240
+ undoStack.length = 0;
9241
+ redoStack.length = 0;
9242
+ clipboard = void 0;
9243
+ stopDrag();
9244
+ editEpoch++;
9245
+ suppressEditing = true;
9246
+ context.setState((state) => ({
9247
+ ...state,
9248
+ editing: null,
9249
+ revision: state.revision + 1
9250
+ }));
9251
+ }
9252
+ function remember(next) {
9253
+ context = next;
9254
+ if (observed !== next.sourceData) {
9255
+ if (observed && next.sourceData !== expected) {
9256
+ undoStack.length = 0;
9257
+ redoStack.length = 0;
9258
+ clipboard = void 0;
9259
+ drag = void 0;
9260
+ editEpoch++;
9261
+ suppressEditing = true;
9262
+ }
9263
+ observed = next.sourceData;
9264
+ data = next.sourceData;
9265
+ expected = void 0;
9266
+ }
9267
+ }
9268
+ function commit(next, operation, history = true) {
9269
+ if (next === data) return false;
9270
+ const previous = { data, range: range() };
9271
+ try {
9272
+ if (options.onChange(next, operation) === false) return false;
9273
+ } catch (error) {
9274
+ options.onError?.(error);
9275
+ return false;
9276
+ }
9277
+ if (history) {
9278
+ undoStack.push(previous);
9279
+ if (undoStack.length > limit) undoStack.shift();
9280
+ redoStack.length = 0;
9281
+ }
9282
+ data = next;
9283
+ expected = next;
9284
+ redraw();
9285
+ return true;
9286
+ }
9287
+ function apply(updates, reason) {
9288
+ const cols = columns(), next = [...data];
9289
+ const changes = [];
9290
+ let skipped = 0;
9291
+ try {
9292
+ for (const update of updates) {
9293
+ const index = next.findIndex(
9294
+ (record2, i) => context.getRowKey(record2, i) === update.address.rowKey
9295
+ );
9296
+ const column = cols.find(
9297
+ (item) => item.key === update.address.columnKey
9298
+ );
9299
+ if (index < 0 || !column || !editable(next[index], column)) {
9300
+ skipped++;
9301
+ continue;
9302
+ }
9303
+ const kind = editorKind(column);
9304
+ let value = update.value;
9305
+ if (update.source && update.source.kind !== kind) {
9306
+ skipped++;
9307
+ continue;
9308
+ }
9309
+ if (!update.source && reason !== "edit" && (kind === "select" || kind === "custom")) {
9310
+ skipped++;
9311
+ continue;
9312
+ }
9313
+ if (kind === "custom" && reason !== "edit" && update.source?.columnKey !== column.key) {
9314
+ skipped++;
9315
+ continue;
9316
+ }
9317
+ if (kind === "inputNumber") {
9318
+ if (isEmpty2(value)) value = null;
9319
+ else if (!Number.isFinite(Number(value))) {
9320
+ skipped++;
9321
+ continue;
9322
+ } else value = Number(value);
9323
+ }
9324
+ if (kind === "select" && !isEmpty2(value) && typeof column.editable === "object" && !column.editable.options?.some(
9325
+ (option) => Object.is(option.value, value) || String(option.value) === String(value)
9326
+ )) {
9327
+ skipped++;
9328
+ continue;
9329
+ }
9330
+ if (options.canWrite?.({
9331
+ record: next[index],
9332
+ column,
9333
+ value,
9334
+ sourceColumnKey: update.source?.columnKey,
9335
+ sourceRecord: update.source?.record
9336
+ }) === false) {
9337
+ skipped++;
9338
+ continue;
9339
+ }
9340
+ const previousValue = getTableValue(
9341
+ next[index],
9342
+ column.dataIndex,
9343
+ column.code ?? column.key
9344
+ );
9345
+ if (Object.is(previousValue, value)) continue;
9346
+ const record = (options.setValue ?? setWorksheetValue)(
9347
+ next[index],
9348
+ column,
9349
+ value
9350
+ );
9351
+ if (record === next[index]) {
9352
+ skipped++;
9353
+ continue;
9354
+ }
9355
+ next[index] = record;
9356
+ changes.push({ ...update.address, previousValue, value });
9357
+ }
9358
+ } catch (error) {
9359
+ options.onError?.(error);
9360
+ return false;
9361
+ }
9362
+ const operation = { reason, changes, skipped };
9363
+ const changed = changes.length > 0 && commit(next, operation);
9364
+ if (changed || changes.length === 0) options.onOperation?.(operation);
9365
+ return changed;
9366
+ }
9367
+ function restore(from, to, reason) {
9368
+ const snapshot = from.at(-1);
9369
+ if (!snapshot) return false;
9370
+ const previous = { data, range: range() };
9371
+ if (!commit([...snapshot.data], { reason, changes: [], skipped: 0 }, false))
9372
+ return false;
9373
+ from.pop();
9374
+ to.push(previous);
9375
+ editEpoch++;
9376
+ suppressEditing = true;
9377
+ context.setState((state) => ({
9378
+ ...state,
9379
+ editing: null,
9380
+ revision: state.revision + 1
9381
+ }));
9382
+ selection()?.setRange(snapshot.range);
9383
+ return true;
9384
+ }
9385
+ function paste(text) {
9386
+ const area = bounds();
9387
+ if (!area) return false;
9388
+ const matrix = parseWorksheetText(text), metadata = clipboard?.text === text ? clipboard.cells : void 0;
9389
+ const single = matrix.length === 1 && matrix[0].length === 1;
9390
+ const updates = [], cols = columns();
9391
+ const height = single ? area.bottom - area.top + 1 : matrix.length;
9392
+ const width = single ? area.right - area.left + 1 : Math.max(...matrix.map((row) => row.length));
9393
+ for (let r = 0; r < height && area.top + r < context.rows.length; r++) {
9394
+ for (let c = 0; c < width && area.left + c < cols.length; c++) {
9395
+ const value = single ? matrix[0][0] : matrix[r]?.[c];
9396
+ if (value === void 0) continue;
9397
+ const source = single ? metadata?.[0]?.[0] : metadata?.[r]?.[c];
9398
+ updates.push({
9399
+ address: {
9400
+ rowKey: context.rows[area.top + r].key,
9401
+ columnKey: cols[area.left + c].key
9402
+ },
9403
+ value: source ? source.value : value,
9404
+ source
9405
+ });
9406
+ }
9407
+ }
9408
+ return apply(updates, "paste");
9409
+ }
9410
+ function fill(area, target, cells, increment = false) {
9411
+ const cols = columns(), updates = [];
9412
+ const start = target < area.top ? target : area.bottom + 1, end = target < area.top ? area.top - 1 : target;
9413
+ for (let r = start; r <= end; r++) {
9414
+ if (!context.rows[r]) continue;
9415
+ const offset = ((r - area.top) % cells.length + cells.length) % cells.length;
9416
+ cells[offset].forEach((source, c) => {
9417
+ const column = cols[area.left + c];
9418
+ if (!column) return;
9419
+ updates.push({
9420
+ address: { rowKey: context.rows[r].key, columnKey: column.key },
9421
+ source,
9422
+ value: increment ? incrementWorksheetValue(source.value, r - (area.top + offset)) : source.value
9423
+ });
9424
+ });
9425
+ }
9426
+ const changed = apply(updates, "fill");
9427
+ if (changed)
9428
+ selection()?.setRange({
9429
+ anchor: {
9430
+ rowKey: context.rows[Math.min(area.top, target)].key,
9431
+ columnKey: cols[area.left].key
9432
+ },
9433
+ focus: {
9434
+ rowKey: context.rows[Math.max(area.bottom, target)].key,
9435
+ columnKey: cols[area.right].key
9436
+ }
9437
+ });
9438
+ return changed;
9439
+ }
9440
+ function fillTo(rowKey, increment = false) {
9441
+ const area = bounds(), target = context.rows.findIndex((row) => row.key === rowKey);
9442
+ return Boolean(
9443
+ area && target >= 0 && fill(area, target, sourceCells(area), increment)
9444
+ );
9445
+ }
9446
+ function fillDown() {
9447
+ const area = bounds();
9448
+ if (!area) return false;
9449
+ const cells = sourceCells(area);
9450
+ if (!cells.some(
9451
+ (row) => row.some((cell) => cell.kind !== "readonly" && !isEmpty2(cell.value))
9452
+ ))
9453
+ return false;
9454
+ const cols = columns().slice(area.left, area.right + 1);
9455
+ let target = area.bottom;
9456
+ for (let r = area.bottom + 1; r < context.rows.length; r++) {
9457
+ if (cols.some(
9458
+ (column) => editable(context.rows[r].record, column) && !isEmpty2(valueAt(r, column))
9459
+ ))
9460
+ break;
9461
+ target = r;
9462
+ }
9463
+ return fill(area, target, cells);
9464
+ }
9465
+ function pointTarget() {
9466
+ if (!drag || !root) return;
9467
+ const td = document.elementFromPoint(pointerX, pointerY)?.closest("td[data-column-key]");
9468
+ if (td?.closest(".sia-table") !== root) return;
9469
+ const key = td?.closest("tr")?.getAttribute("data-row-key");
9470
+ const target = context.rows.findIndex((row) => String(row.key) === key);
9471
+ if (target >= 0 && target !== drag.target) {
9472
+ drag.target = target;
9473
+ redraw();
9474
+ }
9475
+ }
9476
+ function scrollDrag() {
9477
+ if (!drag || !root) return;
9478
+ const viewport = root.querySelector(".sia-table__viewport");
9479
+ if (viewport) {
9480
+ const rect = viewport.getBoundingClientRect();
9481
+ const delta = pointerY < rect.top + 35 ? -12 : pointerY > rect.bottom - 35 ? 12 : 0;
9482
+ if (delta) viewport.scrollTop += delta;
9483
+ pointTarget();
9484
+ }
9485
+ frame = requestAnimationFrame(scrollDrag);
9486
+ }
9487
+ const api = {
9488
+ undo: () => restore(undoStack, redoStack, "undo"),
9489
+ redo: () => restore(redoStack, undoStack, "redo"),
9490
+ getHistory: () => ({
9491
+ canUndo: undoStack.length > 0,
9492
+ canRedo: redoStack.length > 0
9493
+ }),
9494
+ clearHistory,
9495
+ paste,
9496
+ fillTo,
9497
+ fillDown,
9498
+ editCell: (address, value) => apply([{ address, value }], "edit"),
9499
+ replaceData: (next) => {
9500
+ const changed = commit(next, {
9501
+ reason: "replace",
9502
+ changes: [],
9503
+ skipped: 0
9504
+ });
9505
+ if (changed) {
9506
+ editEpoch++;
9507
+ suppressEditing = true;
9508
+ }
9509
+ return changed;
9510
+ }
9511
+ };
9512
+ return {
9513
+ id: "worksheet",
9514
+ order: 71,
9515
+ initialState: { editing: null, revision: 0 },
9516
+ transformColumns(input, current) {
9517
+ remember(current);
9518
+ const epoch = editEpoch;
9519
+ const editPlugin = createEditablePlugin({
9520
+ trigger: "doubleClick",
9521
+ onCellChange: (columnKey, record, value) => {
9522
+ if (epoch !== editEpoch) return false;
9523
+ const row = context.rows.find((item) => item.record === record);
9524
+ return Boolean(
9525
+ row && apply(
9526
+ [{ address: { rowKey: row.key, columnKey }, value }],
9527
+ "edit"
9528
+ )
9529
+ );
9530
+ }
9531
+ });
9532
+ const edited = editPlugin.transformColumns(input, {
9533
+ ...current,
9534
+ state: suppressEditing ? { ...current.state, editing: null } : current.state,
9535
+ setState: (next) => {
9536
+ if (epoch !== editEpoch) return;
9537
+ suppressEditing = false;
9538
+ current.setState((previous) => ({
9539
+ ...previous,
9540
+ ...typeof next === "function" ? next(previous) : next
9541
+ }));
9542
+ }
9543
+ });
9544
+ return mapTableLeafColumns(edited, (column) => {
9545
+ const render = column.render;
9546
+ return {
9547
+ ...column,
9548
+ render: (value, record, index, info) => {
9549
+ const area = bounds(), cols = columns();
9550
+ const handle = area && context.rows[area.bottom]?.key === info.row.key && cols[area.right]?.key === column.key && (suppressEditing || !context.state.editing);
9551
+ return /* @__PURE__ */ jsxs24(Fragment10, { children: [
9552
+ render ? render(value, record, index, info) : value,
9553
+ handle && /* @__PURE__ */ jsx26(
9554
+ "button",
9555
+ {
9556
+ type: "button",
9557
+ className: "sia-table__worksheet-handle",
9558
+ "aria-label": "\u62D6\u62FD\u586B\u5145\uFF1B\u53CC\u51FB\u81EA\u52A8\u586B\u5145\u4E0B\u65B9\u8FDE\u7EED\u7A7A\u5355\u5143\u683C",
9559
+ title: "\u62D6\u62FD\u586B\u5145\uFF1BCtrl/Cmd \u62D6\u62FD\u9012\u589E\uFF1B\u53CC\u51FB\u586B\u6EE1\u4E0B\u65B9\u8FDE\u7EED\u7A7A\u683C",
9560
+ onPointerDown: (event) => {
9561
+ if (event.button !== 0) return;
9562
+ event.preventDefault();
9563
+ event.stopPropagation();
9564
+ drag = {
9565
+ bounds: area,
9566
+ target: area.bottom,
9567
+ cells: sourceCells(area),
9568
+ increment: event.ctrlKey || event.metaKey
9569
+ };
9570
+ pointerX = event.clientX;
9571
+ pointerY = event.clientY;
9572
+ frame = requestAnimationFrame(scrollDrag);
9573
+ },
9574
+ onDoubleClick: (event) => {
9575
+ event.preventDefault();
9576
+ event.stopPropagation();
9577
+ stopDrag();
9578
+ fillDown();
9579
+ },
9580
+ onClick: (event) => event.stopPropagation()
9581
+ }
9582
+ )
9583
+ ] });
9584
+ }
9585
+ };
9586
+ });
9587
+ },
9588
+ getCellProps(row, column, current) {
9589
+ remember(current);
9590
+ const r = current.rows.indexOf(row), c = columns().findIndex((item) => item.key === column.key);
9591
+ const preview = drag && c >= drag.bounds.left && c <= drag.bounds.right && r >= Math.min(drag.target, drag.bounds.top) && r <= Math.max(drag.target, drag.bounds.bottom);
9592
+ return {
9593
+ className: `sia-table__worksheet-cell${preview ? " sia-table__worksheet-fill-preview" : ""}`
9594
+ };
9595
+ },
9596
+ renderToolbarStart(current) {
9597
+ remember(current);
9598
+ return options.toolbar === false ? null : /* @__PURE__ */ jsxs24("span", { className: "sia-table__worksheet-tools", children: [
9599
+ /* @__PURE__ */ jsx26(
9600
+ Button,
9601
+ {
9602
+ variant: "text",
9603
+ size: "small",
9604
+ icon: /* @__PURE__ */ jsx26(Icon, { name: "undo" }),
9605
+ disabled: !undoStack.length,
9606
+ title: "\u64A4\u9500\uFF08Ctrl/Cmd + Z\uFF09",
9607
+ onClick: api.undo,
9608
+ children: "\u64A4\u9500"
9609
+ }
9610
+ ),
9611
+ /* @__PURE__ */ jsx26(
9612
+ Button,
9613
+ {
9614
+ variant: "text",
9615
+ size: "small",
9616
+ icon: /* @__PURE__ */ jsx26(Icon, { name: "redo" }),
9617
+ disabled: !redoStack.length,
9618
+ title: "\u6062\u590D\uFF08Ctrl/Cmd + Shift + Z \u6216 Ctrl/Cmd + Y\uFF09",
9619
+ onClick: api.redo,
9620
+ children: "\u6062\u590D"
9621
+ }
9622
+ )
9623
+ ] });
9624
+ },
9625
+ renderOverlay(current) {
9626
+ remember(current);
9627
+ return /* @__PURE__ */ jsx26(
9628
+ "span",
9629
+ {
9630
+ hidden: true,
9631
+ ref: (element) => {
9632
+ root = element?.closest(".sia-table") ?? null;
9633
+ }
9634
+ }
9635
+ );
9636
+ },
9637
+ getApi(current) {
9638
+ remember(current);
9639
+ return api;
9640
+ },
9641
+ onMount() {
9642
+ const active = (event) => Boolean(
9643
+ root && event.target instanceof Element && event.target.closest(".sia-table") === root && !nativeEditor(event.target)
9644
+ );
9645
+ const copy = (event) => {
9646
+ if (!active(event) || !event.clipboardData || window.getSelection()?.toString())
9647
+ return;
9648
+ const area = bounds();
9649
+ if (!area) return;
9650
+ const cells = sourceCells(area), text = worksheetText(
9651
+ cells.map((row) => row.map((cell) => cell.value))
9652
+ );
9653
+ clipboard = { text, cells };
9654
+ event.preventDefault();
9655
+ event.stopImmediatePropagation();
9656
+ event.clipboardData.setData("text/plain", text);
9657
+ };
9658
+ const onPaste = (event) => {
9659
+ if (!active(event) || !bounds() || !event.clipboardData?.types.includes("text/plain"))
9660
+ return;
9661
+ event.preventDefault();
9662
+ event.stopImmediatePropagation();
9663
+ paste(event.clipboardData.getData("text/plain"));
9664
+ };
9665
+ const keydown = (event) => {
9666
+ if (event.key === "Escape" && drag) {
9667
+ stopDrag();
9668
+ return;
9669
+ }
9670
+ if (!active(event) || !(event.ctrlKey || event.metaKey)) return;
9671
+ const key = event.key.toLowerCase();
9672
+ if (key !== "z" && key !== "y") return;
9673
+ event.preventDefault();
9674
+ event.stopImmediatePropagation();
9675
+ if (key === "y" || event.shiftKey) api.redo();
9676
+ else api.undo();
9677
+ };
9678
+ const move = (event) => {
9679
+ if (!drag) return;
9680
+ pointerX = event.clientX;
9681
+ pointerY = event.clientY;
9682
+ drag.increment = event.ctrlKey || event.metaKey;
9683
+ pointTarget();
9684
+ };
9685
+ const up = () => {
9686
+ if (!drag) return;
9687
+ const current = drag;
9688
+ stopDrag();
9689
+ fill(current.bounds, current.target, current.cells, current.increment);
9690
+ };
9691
+ document.addEventListener("copy", copy, true);
9692
+ document.addEventListener("paste", onPaste, true);
9693
+ document.addEventListener("keydown", keydown, true);
9694
+ window.addEventListener("pointermove", move);
9695
+ window.addEventListener("pointerup", up);
9696
+ window.addEventListener("pointercancel", stopDrag);
9697
+ window.addEventListener("blur", stopDrag);
9698
+ return () => {
9699
+ cancelAnimationFrame(frame);
9700
+ drag = void 0;
9701
+ document.removeEventListener("copy", copy, true);
9702
+ document.removeEventListener("paste", onPaste, true);
9703
+ document.removeEventListener("keydown", keydown, true);
9704
+ window.removeEventListener("pointermove", move);
9705
+ window.removeEventListener("pointerup", up);
9706
+ window.removeEventListener("pointercancel", stopDrag);
9707
+ window.removeEventListener("blur", stopDrag);
9708
+ };
9709
+ }
9710
+ };
9711
+ }
9712
+
9081
9713
  // src/components/ThemeSwitch.tsx
9082
9714
  import { forwardRef as forwardRef6 } from "react";
9083
- import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
9715
+ import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
9084
9716
  var ThemeSwitch = forwardRef6(function ThemeSwitch2({
9085
9717
  checked,
9086
9718
  onCheckedChange,
@@ -9094,7 +9726,7 @@ var ThemeSwitch = forwardRef6(function ThemeSwitch2({
9094
9726
  onCheckedChange?.(!checked);
9095
9727
  onClick?.(event);
9096
9728
  }
9097
- return /* @__PURE__ */ jsxs24(
9729
+ return /* @__PURE__ */ jsxs25(
9098
9730
  "button",
9099
9731
  {
9100
9732
  ref,
@@ -9106,12 +9738,12 @@ var ThemeSwitch = forwardRef6(function ThemeSwitch2({
9106
9738
  onClick: handleClick,
9107
9739
  ...withTitleTooltip(props),
9108
9740
  children: [
9109
- /* @__PURE__ */ jsx26("span", { className: "sia-theme-switch__selection", "aria-hidden": "true" }),
9110
- /* @__PURE__ */ jsx26("span", { className: `sia-theme-switch__icon${checked ? "" : " is-active"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxs24("svg", { viewBox: "0 0 24 24", children: [
9111
- /* @__PURE__ */ jsx26("circle", { cx: "12", cy: "12", r: "3.5" }),
9112
- /* @__PURE__ */ jsx26("path", { d: "M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M18.7 5.3l-1.4 1.4M6.7 17.3l-1.4 1.4" })
9741
+ /* @__PURE__ */ jsx27("span", { className: "sia-theme-switch__selection", "aria-hidden": "true" }),
9742
+ /* @__PURE__ */ jsx27("span", { className: `sia-theme-switch__icon${checked ? "" : " is-active"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxs25("svg", { viewBox: "0 0 24 24", children: [
9743
+ /* @__PURE__ */ jsx27("circle", { cx: "12", cy: "12", r: "3.5" }),
9744
+ /* @__PURE__ */ jsx27("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" })
9113
9745
  ] }) }),
9114
- /* @__PURE__ */ jsx26("span", { className: `sia-theme-switch__icon${checked ? " is-active" : ""}`, "aria-hidden": "true", children: /* @__PURE__ */ jsx26("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx26("path", { d: "M20 15.2A8 8 0 0 1 8.8 4 8.5 8.5 0 1 0 20 15.2Z" }) }) })
9746
+ /* @__PURE__ */ jsx27("span", { className: `sia-theme-switch__icon${checked ? " is-active" : ""}`, "aria-hidden": "true", children: /* @__PURE__ */ jsx27("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx27("path", { d: "M20 15.2A8 8 0 0 1 8.8 4 8.5 8.5 0 1 0 20 15.2Z" }) }) })
9115
9747
  ]
9116
9748
  }
9117
9749
  );
@@ -9155,7 +9787,7 @@ function applySiaTheme(mode, target = document.documentElement) {
9155
9787
 
9156
9788
  // src/components/InputSelect.tsx
9157
9789
  import { forwardRef as forwardRef7, useEffect as useEffect16, useRef as useRef20, useState as useState23 } from "react";
9158
- import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
9790
+ import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
9159
9791
  var InputSelect = forwardRef7(function InputSelect2({
9160
9792
  options,
9161
9793
  value,
@@ -9238,14 +9870,14 @@ var InputSelect = forwardRef7(function InputSelect2({
9238
9870
  setSelectedOnly(false);
9239
9871
  setModalOpen(true);
9240
9872
  }
9241
- return /* @__PURE__ */ jsxs25("div", { ref: rootRef, style, className: `sia-input-select${open || modalOpen ? " is-open" : ""} ${className}`, onKeyDown: (event) => {
9873
+ return /* @__PURE__ */ jsxs26("div", { ref: rootRef, style, className: `sia-input-select${open || modalOpen ? " is-open" : ""} ${className}`, onKeyDown: (event) => {
9242
9874
  if (event.key === "Escape" && open) {
9243
9875
  event.stopPropagation();
9244
9876
  changeOpen(false);
9245
9877
  inputRef.current?.focus();
9246
9878
  }
9247
9879
  }, children: [
9248
- /* @__PURE__ */ jsx27(
9880
+ /* @__PURE__ */ jsx28(
9249
9881
  Input,
9250
9882
  {
9251
9883
  ...inputProps,
@@ -9282,26 +9914,26 @@ var InputSelect = forwardRef7(function InputSelect2({
9282
9914
  emit(parseInput ? parseInput(next) : multiple ? next.split(",").map((item) => item.trim()).filter(Boolean) : next);
9283
9915
  changeOpen(true);
9284
9916
  },
9285
- suffix: /* @__PURE__ */ jsxs25("span", { className: "sia-input-select__suffix", children: [
9286
- allowClear && draft && !disabled && /* @__PURE__ */ jsx27(Button, { className: "sia-input-select__clear", variant: "text", size: "small", disabled: loading, "aria-label": "\u6E05\u9664\u8F93\u5165\u9009\u62E9", onClick: (event) => {
9917
+ suffix: /* @__PURE__ */ jsxs26("span", { className: "sia-input-select__suffix", children: [
9918
+ allowClear && draft && !disabled && /* @__PURE__ */ jsx28(Button, { className: "sia-input-select__clear", variant: "text", size: "small", disabled: loading, "aria-label": "\u6E05\u9664\u8F93\u5165\u9009\u62E9", onClick: (event) => {
9287
9919
  event.stopPropagation();
9288
9920
  setDraft("");
9289
9921
  emit(multiple ? [] : void 0);
9290
9922
  inputRef.current?.focus();
9291
9923
  }, children: "\xD7" }),
9292
9924
  suffix,
9293
- enableModal && /* @__PURE__ */ jsx27(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
9925
+ enableModal && /* @__PURE__ */ jsx28(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
9294
9926
  event.stopPropagation();
9295
9927
  openModal();
9296
9928
  }, children: "\u2026" }),
9297
- /* @__PURE__ */ jsx27(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
9929
+ /* @__PURE__ */ jsx28(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
9298
9930
  event.stopPropagation();
9299
9931
  changeOpen(!open);
9300
- }, children: /* @__PURE__ */ jsx27(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
9932
+ }, children: /* @__PURE__ */ jsx28(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
9301
9933
  ] })
9302
9934
  }
9303
9935
  ),
9304
- /* @__PURE__ */ jsx27(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx27(
9936
+ /* @__PURE__ */ jsx28(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx28(
9305
9937
  SelectionPanel,
9306
9938
  {
9307
9939
  options,
@@ -9316,7 +9948,7 @@ var InputSelect = forwardRef7(function InputSelect2({
9316
9948
  onSearch: setSearch
9317
9949
  }
9318
9950
  ) }),
9319
- enableModal && /* @__PURE__ */ jsxs25(
9951
+ enableModal && /* @__PURE__ */ jsxs26(
9320
9952
  Modal,
9321
9953
  {
9322
9954
  open: modalOpen,
@@ -9329,15 +9961,15 @@ var InputSelect = forwardRef7(function InputSelect2({
9329
9961
  setModalOpen(false);
9330
9962
  },
9331
9963
  children: [
9332
- /* @__PURE__ */ jsxs25("div", { className: "sia-selection-panel__actions", role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
9333
- /* @__PURE__ */ jsx27(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
9334
- /* @__PURE__ */ jsxs25(Button, { role: "tab", "aria-selected": selectedOnly, variant: selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(true), children: [
9964
+ /* @__PURE__ */ jsxs26("div", { className: "sia-selection-panel__actions", role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
9965
+ /* @__PURE__ */ jsx28(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
9966
+ /* @__PURE__ */ jsxs26(Button, { role: "tab", "aria-selected": selectedOnly, variant: selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(true), children: [
9335
9967
  "\u5DF2\u9009\u9879(",
9336
9968
  modalValues.length,
9337
9969
  ")"
9338
9970
  ] })
9339
9971
  ] }),
9340
- modalOpen && /* @__PURE__ */ jsx27(
9972
+ modalOpen && /* @__PURE__ */ jsx28(
9341
9973
  SelectionPanel,
9342
9974
  {
9343
9975
  options,
@@ -9512,7 +10144,7 @@ function countQueryFieldRows(centers) {
9512
10144
  }
9513
10145
 
9514
10146
  // src/components/QueryFormSettings.tsx
9515
- import { Fragment as Fragment10, jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
10147
+ import { Fragment as Fragment11, jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
9516
10148
  function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed, disabled) {
9517
10149
  const [snapshot, setSnapshot] = useState25();
9518
10150
  const [draft, setDraft] = useState25({ fields: [], defaultCollapsed: defaultCollapsed ?? false });
@@ -9607,7 +10239,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
9607
10239
  const items = new Map(visibleDraft.map((item) => [item.key, item]));
9608
10240
  setDraft((current) => ({ ...current, fields: keys.map((key, order) => ({ ...items.get(key), order })) }));
9609
10241
  });
9610
- const control = config ? /* @__PURE__ */ jsx28(
10242
+ const control = config ? /* @__PURE__ */ jsx29(
9611
10243
  Button,
9612
10244
  {
9613
10245
  type: "button",
@@ -9616,16 +10248,16 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
9616
10248
  "aria-label": "\u67E5\u8BE2\u8BBE\u7F6E",
9617
10249
  disabled: disabled || saving,
9618
10250
  loading: loading && !open,
9619
- icon: /* @__PURE__ */ jsx28(Icon, { name: "more-vertical" }),
10251
+ icon: /* @__PURE__ */ jsx29(Icon, { name: "more-vertical" }),
9620
10252
  onClick: () => {
9621
10253
  setOpen(true);
9622
10254
  void load(true);
9623
10255
  }
9624
10256
  }
9625
10257
  ) : null;
9626
- const panel = config ? /* @__PURE__ */ jsxs26(Fragment10, { children: [
9627
- !open && error ? /* @__PURE__ */ jsx28("span", { className: "sia-query-form__error", role: "alert", children: "\u67E5\u8BE2\u8BBE\u7F6E\u8BFB\u53D6\u5931\u8D25\uFF0C\u8BF7\u6253\u5F00\u8BBE\u7F6E\u91CD\u8BD5" }) : null,
9628
- /* @__PURE__ */ jsx28(
10258
+ const panel = config ? /* @__PURE__ */ jsxs27(Fragment11, { children: [
10259
+ !open && error ? /* @__PURE__ */ jsx29("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,
10260
+ /* @__PURE__ */ jsx29(
9629
10261
  Modal,
9630
10262
  {
9631
10263
  title: "\u67E5\u8BE2\u8BBE\u7F6E",
@@ -9638,15 +10270,15 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
9638
10270
  onOpenChange: (next) => {
9639
10271
  if (!saveLock.current) setOpen(next);
9640
10272
  },
9641
- children: /* @__PURE__ */ jsxs26("div", { className: "sia-query-settings", children: [
9642
- loading ? /* @__PURE__ */ jsx28("p", { role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u67E5\u8BE2\u8BBE\u7F6E\u2026" }) : null,
9643
- error ? /* @__PURE__ */ jsxs26("div", { role: "alert", className: "sia-query-form__error", children: [
10273
+ children: /* @__PURE__ */ jsxs27("div", { className: "sia-query-settings", children: [
10274
+ loading ? /* @__PURE__ */ jsx29("p", { role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u67E5\u8BE2\u8BBE\u7F6E\u2026" }) : null,
10275
+ error ? /* @__PURE__ */ jsxs27("div", { role: "alert", className: "sia-query-form__error", children: [
9644
10276
  error,
9645
- loadFailed ? /* @__PURE__ */ jsx28(Button, { type: "button", variant: "link", onClick: () => void load(true), children: "\u91CD\u8BD5" }) : null
10277
+ loadFailed ? /* @__PURE__ */ jsx29(Button, { type: "button", variant: "link", onClick: () => void load(true), children: "\u91CD\u8BD5" }) : null
9646
10278
  ] }) : null,
9647
- /* @__PURE__ */ jsx28(Checkbox, { checked: draft.defaultCollapsed, disabled: locked, onChange: (checked) => setDraft((current) => ({ ...current, defaultCollapsed: checked })), children: "\u9ED8\u8BA4\u6536\u8D77\u67E5\u8BE2\u6761\u4EF6" }),
9648
- /* @__PURE__ */ jsx28("p", { className: "sia-query-settings__hint", children: "\u52FE\u9009\u9700\u8981\u663E\u793A\u7684\u6761\u4EF6\uFF0C\u62D6\u52A8\u6216\u4F7F\u7528\u4E0A\u4E0B\u6309\u94AE\u8C03\u6574\u987A\u5E8F\u3002" }),
9649
- /* @__PURE__ */ jsx28("div", { ref: sort.listRef, className: `sia-query-settings__list${sort.preview ? " is-sorting" : ""}`, children: visibleDraft.map((item, index) => /* @__PURE__ */ jsxs26(
10279
+ /* @__PURE__ */ jsx29(Checkbox, { checked: draft.defaultCollapsed, disabled: locked, onChange: (checked) => setDraft((current) => ({ ...current, defaultCollapsed: checked })), children: "\u9ED8\u8BA4\u6536\u8D77\u67E5\u8BE2\u6761\u4EF6" }),
10280
+ /* @__PURE__ */ jsx29("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" }),
10281
+ /* @__PURE__ */ jsx29("div", { ref: sort.listRef, className: `sia-query-settings__list${sort.preview ? " is-sorting" : ""}`, children: visibleDraft.map((item, index) => /* @__PURE__ */ jsxs27(
9650
10282
  "div",
9651
10283
  {
9652
10284
  "data-query-field-key": item.key,
@@ -9654,18 +10286,18 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
9654
10286
  style: sort.preview ? { transform: `translateY(${sort.preview.offsets[item.key] ?? 0}px)` } : void 0,
9655
10287
  onPointerDown: (event) => sort.start(event, item.key),
9656
10288
  children: [
9657
- /* @__PURE__ */ jsx28(Icon, { name: "menu", size: 15 }),
9658
- /* @__PURE__ */ jsx28(Checkbox, { "aria-label": `\u663E\u793A ${item.key}`, checked: item.visible, disabled: locked || hideDisabledKeys.has(item.key), onChange: (checked) => setDraft((current) => ({ ...current, fields: visibleDraft.map((field) => field.key === item.key ? { ...field, visible: checked } : field) })) }),
9659
- /* @__PURE__ */ jsx28("span", { className: "sia-query-settings__name", children: labels.get(item.key) ?? item.key }),
9660
- /* @__PURE__ */ jsxs26("div", { className: "sia-query-settings__order", children: [
9661
- /* @__PURE__ */ jsx28(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0A\u79FB ${item.key}`, disabled: locked || index === 0, icon: /* @__PURE__ */ jsx28(Icon, { name: "chevron-up" }), onClick: () => move(index, index - 1) }),
9662
- /* @__PURE__ */ jsx28(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0B\u79FB ${item.key}`, disabled: locked || index === visibleDraft.length - 1, icon: /* @__PURE__ */ jsx28(Icon, { name: "chevron-down" }), onClick: () => move(index, index + 1) })
10289
+ /* @__PURE__ */ jsx29(Icon, { name: "menu", size: 15 }),
10290
+ /* @__PURE__ */ jsx29(Checkbox, { "aria-label": `\u663E\u793A ${item.key}`, checked: item.visible, disabled: locked || hideDisabledKeys.has(item.key), onChange: (checked) => setDraft((current) => ({ ...current, fields: visibleDraft.map((field) => field.key === item.key ? { ...field, visible: checked } : field) })) }),
10291
+ /* @__PURE__ */ jsx29("span", { className: "sia-query-settings__name", children: labels.get(item.key) ?? item.key }),
10292
+ /* @__PURE__ */ jsxs27("div", { className: "sia-query-settings__order", children: [
10293
+ /* @__PURE__ */ jsx29(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0A\u79FB ${item.key}`, disabled: locked || index === 0, icon: /* @__PURE__ */ jsx29(Icon, { name: "chevron-up" }), onClick: () => move(index, index - 1) }),
10294
+ /* @__PURE__ */ jsx29(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0B\u79FB ${item.key}`, disabled: locked || index === visibleDraft.length - 1, icon: /* @__PURE__ */ jsx29(Icon, { name: "chevron-down" }), onClick: () => move(index, index + 1) })
9663
10295
  ] })
9664
10296
  ]
9665
10297
  },
9666
10298
  item.key
9667
10299
  )) }),
9668
- /* @__PURE__ */ jsx28(Button, { type: "button", disabled: locked, onClick: () => setDraft({ fields: reconcileQueryFields(fields.map((field) => field.key)), defaultCollapsed: defaultCollapsed ?? false }), children: "\u6062\u590D\u9ED8\u8BA4" })
10300
+ /* @__PURE__ */ jsx29(Button, { type: "button", disabled: locked, onClick: () => setDraft({ fields: reconcileQueryFields(fields.map((field) => field.key)), defaultCollapsed: defaultCollapsed ?? false }), children: "\u6062\u590D\u9ED8\u8BA4" })
9669
10301
  ] })
9670
10302
  }
9671
10303
  )
@@ -9674,7 +10306,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
9674
10306
  }
9675
10307
 
9676
10308
  // src/components/QueryForm.tsx
9677
- import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
10309
+ import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
9678
10310
  function QueryForm({
9679
10311
  fields,
9680
10312
  settings,
@@ -9737,7 +10369,7 @@ function QueryForm({
9737
10369
  width,
9738
10370
  hideDisabled: settingsHideDisabled,
9739
10371
  label: settingsLabel ?? item.label ?? (typeof item.children === "function" ? void 0 : fieldLabel(item.children)) ?? key,
9740
- content: /* @__PURE__ */ jsx29(Form.Item, { noStyle: true, ...item })
10372
+ content: /* @__PURE__ */ jsx30(Form.Item, { noStyle: true, ...item })
9741
10373
  })) : Children4.toArray(children).map((content, index) => ({
9742
10374
  key: isValidElement5(content) && content.key != null ? String(content.key) : String(index),
9743
10375
  width: void 0,
@@ -9915,8 +10547,8 @@ function QueryForm({
9915
10547
  setRemoving(false);
9916
10548
  }
9917
10549
  }
9918
- return /* @__PURE__ */ jsxs27("div", { className: `sia-query-form ${className}`.trim(), children: [
9919
- /* @__PURE__ */ jsxs27(
10550
+ return /* @__PURE__ */ jsxs28("div", { className: `sia-query-form ${className}`.trim(), children: [
10551
+ /* @__PURE__ */ jsxs28(
9920
10552
  Form,
9921
10553
  {
9922
10554
  ...formProps,
@@ -9935,8 +10567,8 @@ function QueryForm({
9935
10567
  onValuesChange?.(changed, values);
9936
10568
  },
9937
10569
  children: [
9938
- quickQueries.length ? /* @__PURE__ */ jsxs27("div", { className: "sia-query-form__quick", "aria-label": "\u9884\u8BBE\u5FEB\u6377\u67E5\u8BE2", children: [
9939
- quickQueries.map((query) => /* @__PURE__ */ jsx29(
10570
+ quickQueries.length ? /* @__PURE__ */ jsxs28("div", { className: "sia-query-form__quick", "aria-label": "\u9884\u8BBE\u5FEB\u6377\u67E5\u8BE2", children: [
10571
+ quickQueries.map((query) => /* @__PURE__ */ jsx30(
9940
10572
  Badge,
9941
10573
  {
9942
10574
  className: "sia-query-form__quick-badge",
@@ -9945,7 +10577,7 @@ function QueryForm({
9945
10577
  title: query.count === void 0 ? void 0 : `\u5171 ${query.count} \u6761`,
9946
10578
  ...query.badgeProps,
9947
10579
  count: query.count,
9948
- children: /* @__PURE__ */ jsx29(
10580
+ children: /* @__PURE__ */ jsx30(
9949
10581
  Button,
9950
10582
  {
9951
10583
  size: query.size ?? quickQuerySize,
@@ -9961,7 +10593,7 @@ function QueryForm({
9961
10593
  )),
9962
10594
  " "
9963
10595
  ] }) : null,
9964
- /* @__PURE__ */ jsxs27(
10596
+ /* @__PURE__ */ jsxs28(
9965
10597
  "div",
9966
10598
  {
9967
10599
  ref: rowRef,
@@ -9970,7 +10602,7 @@ function QueryForm({
9970
10602
  "--sia-query-field-width": typeof fieldWidth === "number" ? `${fieldWidth}px` : fieldWidth
9971
10603
  },
9972
10604
  children: [
9973
- entries.map((entry) => /* @__PURE__ */ jsx29(
10605
+ entries.map((entry) => /* @__PURE__ */ jsx30(
9974
10606
  "div",
9975
10607
  {
9976
10608
  className: "sia-query-form__field",
@@ -9983,9 +10615,9 @@ function QueryForm({
9983
10615
  },
9984
10616
  entry.key
9985
10617
  )),
9986
- /* @__PURE__ */ jsxs27("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
9987
- /* @__PURE__ */ jsxs27(Space.Compact, { children: [
9988
- /* @__PURE__ */ jsx29(
10618
+ /* @__PURE__ */ jsxs28("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
10619
+ /* @__PURE__ */ jsxs28(Space.Compact, { children: [
10620
+ /* @__PURE__ */ jsx30(
9989
10621
  Button,
9990
10622
  {
9991
10623
  type: "submit",
@@ -9995,8 +10627,8 @@ function QueryForm({
9995
10627
  children: searchText
9996
10628
  }
9997
10629
  ),
9998
- /* @__PURE__ */ jsx29(Button, { disabled: busy, onClick: reset, children: resetText }),
9999
- onSaveQuery ? /* @__PURE__ */ jsx29(
10630
+ /* @__PURE__ */ jsx30(Button, { disabled: busy, onClick: reset, children: resetText }),
10631
+ onSaveQuery ? /* @__PURE__ */ jsx30(
10000
10632
  Button,
10001
10633
  {
10002
10634
  disabled: shortcutBusy,
@@ -10011,12 +10643,12 @@ function QueryForm({
10011
10643
  ) : null,
10012
10644
  showSettings ?? settingsRows > 2 ? cloudSettings.control : null
10013
10645
  ] }),
10014
- collapsible && entries.length > 0 ? /* @__PURE__ */ jsx29("span", { ref: toggleRef, hidden: !needsCollapse, children: /* @__PURE__ */ jsx29(
10646
+ collapsible && entries.length > 0 ? /* @__PURE__ */ jsx30("span", { ref: toggleRef, hidden: !needsCollapse, children: /* @__PURE__ */ jsx30(
10015
10647
  Button,
10016
10648
  {
10017
10649
  variant: "link",
10018
10650
  "aria-expanded": !collapsed,
10019
- icon: /* @__PURE__ */ jsx29(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
10651
+ icon: /* @__PURE__ */ jsx30(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
10020
10652
  iconPosition: "end",
10021
10653
  onClick: () => {
10022
10654
  setInternalCollapsed(!collapsed);
@@ -10031,8 +10663,8 @@ function QueryForm({
10031
10663
  ]
10032
10664
  }
10033
10665
  ),
10034
- savedQueries.length ? /* @__PURE__ */ jsxs27("div", { className: "sia-query-form__saved", "aria-label": "\u5DF2\u4FDD\u5B58\u5FEB\u6377\u67E5\u8BE2", children: [
10035
- savedQueries.map((query, index) => /* @__PURE__ */ jsx29(
10666
+ savedQueries.length ? /* @__PURE__ */ jsxs28("div", { className: "sia-query-form__saved", "aria-label": "\u5DF2\u4FDD\u5B58\u5FEB\u6377\u67E5\u8BE2", children: [
10667
+ savedQueries.map((query, index) => /* @__PURE__ */ jsx30(
10036
10668
  Tag,
10037
10669
  {
10038
10670
  status: query.status ?? ["processing", "success", "warning", "error"][index % 4],
@@ -10058,11 +10690,11 @@ function QueryForm({
10058
10690
  )),
10059
10691
  " "
10060
10692
  ] }) : null,
10061
- error ? /* @__PURE__ */ jsx29("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
10693
+ error ? /* @__PURE__ */ jsx30("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
10062
10694
  ]
10063
10695
  }
10064
10696
  ),
10065
- /* @__PURE__ */ jsxs27(
10697
+ /* @__PURE__ */ jsxs28(
10066
10698
  Modal,
10067
10699
  {
10068
10700
  open: saveOpen,
@@ -10074,7 +10706,7 @@ function QueryForm({
10074
10706
  if (!saveLock.current) setSaveOpen(next);
10075
10707
  },
10076
10708
  children: [
10077
- /* @__PURE__ */ jsx29(
10709
+ /* @__PURE__ */ jsx30(
10078
10710
  Input,
10079
10711
  {
10080
10712
  autoFocus: true,
@@ -10093,7 +10725,7 @@ function QueryForm({
10093
10725
  }
10094
10726
  }
10095
10727
  ),
10096
- saveError ? /* @__PURE__ */ jsx29("p", { className: "sia-query-form__error", role: "alert", children: saveError }) : null
10728
+ saveError ? /* @__PURE__ */ jsx30("p", { className: "sia-query-form__error", role: "alert", children: saveError }) : null
10097
10729
  ]
10098
10730
  }
10099
10731
  )
@@ -10102,7 +10734,7 @@ function QueryForm({
10102
10734
 
10103
10735
  // src/components/NumberRange.tsx
10104
10736
  import { forwardRef as forwardRef8 } from "react";
10105
- import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
10737
+ import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
10106
10738
  var NumberRange = forwardRef8(function NumberRange2({
10107
10739
  value,
10108
10740
  defaultValue = [null, null],
@@ -10131,7 +10763,7 @@ var NumberRange = forwardRef8(function NumberRange2({
10131
10763
  setValue2(index === 0 ? [next, range[1]] : [range[0], next]);
10132
10764
  }
10133
10765
  const inputProps = { min, max, step, precision, size, status, disabled, readOnly, placeholderMode, controls: false };
10134
- return /* @__PURE__ */ jsxs28(
10766
+ return /* @__PURE__ */ jsxs29(
10135
10767
  "span",
10136
10768
  {
10137
10769
  ...props,
@@ -10140,7 +10772,7 @@ var NumberRange = forwardRef8(function NumberRange2({
10140
10772
  "aria-disabled": disabled || void 0,
10141
10773
  className: `sia-number-range sia-number-range--${size} sia-number-range--${status}${disabled ? " is-disabled" : ""} ${className}`.trim(),
10142
10774
  children: [
10143
- /* @__PURE__ */ jsx30(
10775
+ /* @__PURE__ */ jsx31(
10144
10776
  InputNumber,
10145
10777
  {
10146
10778
  ...inputProps,
@@ -10152,8 +10784,8 @@ var NumberRange = forwardRef8(function NumberRange2({
10152
10784
  onChange: (next) => change(0, next)
10153
10785
  }
10154
10786
  ),
10155
- /* @__PURE__ */ jsx30(Icon, { className: "sia-number-range__separator", name: "tilde", size: 12, strokeWidth: 1.5, "aria-hidden": "true" }),
10156
- /* @__PURE__ */ jsx30(
10787
+ /* @__PURE__ */ jsx31(Icon, { className: "sia-number-range__separator", name: "tilde", size: 12, strokeWidth: 1.5, "aria-hidden": "true" }),
10788
+ /* @__PURE__ */ jsx31(
10157
10789
  InputNumber,
10158
10790
  {
10159
10791
  ...inputProps,
@@ -10165,7 +10797,7 @@ var NumberRange = forwardRef8(function NumberRange2({
10165
10797
  onChange: (next) => change(1, next)
10166
10798
  }
10167
10799
  ),
10168
- allowClear && !disabled && !readOnly && range.some((item) => item !== null) ? /* @__PURE__ */ jsx30("button", { type: "button", className: "sia-number-range__clear", "aria-label": "\u6E05\u9664\u6570\u5B57\u533A\u95F4", onClick: () => setValue2([null, null]), children: /* @__PURE__ */ jsx30(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null
10800
+ allowClear && !disabled && !readOnly && range.some((item) => item !== null) ? /* @__PURE__ */ jsx31("button", { type: "button", className: "sia-number-range__clear", "aria-label": "\u6E05\u9664\u6570\u5B57\u533A\u95F4", onClick: () => setValue2([null, null]), children: /* @__PURE__ */ jsx31(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null
10169
10801
  ]
10170
10802
  }
10171
10803
  );
@@ -10318,6 +10950,7 @@ export {
10318
10950
  createSummaryPlugin,
10319
10951
  createToolbarPlugin,
10320
10952
  createTreePlugin,
10953
+ createWorksheetPlugin,
10321
10954
  formatChartNumber,
10322
10955
  getChartMap,
10323
10956
  linearScale,