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

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";
@@ -7259,7 +7259,8 @@ function EditableTableCell({
7259
7259
  onStart,
7260
7260
  onSave,
7261
7261
  onCancel,
7262
- trigger
7262
+ trigger,
7263
+ showEditIcon
7263
7264
  }) {
7264
7265
  const config = typeof editable === "object" ? editable : { type: "input" };
7265
7266
  const [editValue, setEditValue] = useState21(value);
@@ -7327,7 +7328,7 @@ function EditableTableCell({
7327
7328
  onDoubleClick: trigger === "doubleClick" ? onStart : void 0,
7328
7329
  children: [
7329
7330
  /* @__PURE__ */ jsx24("span", { children: content }),
7330
- /* @__PURE__ */ jsx24(Icon, { name: "edit", size: 13 })
7331
+ showEditIcon && /* @__PURE__ */ jsx24(Icon, { name: "edit", size: 13 })
7331
7332
  ]
7332
7333
  }
7333
7334
  );
@@ -7416,6 +7417,7 @@ function createEditablePlugin(options = {}) {
7416
7417
  record,
7417
7418
  content,
7418
7419
  trigger,
7420
+ showEditIcon: options.showEditIcon ?? true,
7419
7421
  onStart: () => context.setState({
7420
7422
  editing: { rowKey: info.row.key, columnKey: column.key }
7421
7423
  }),
@@ -8350,6 +8352,7 @@ var TableBodyRow = memo(function TableBodyRow2({
8350
8352
  return /* @__PURE__ */ jsx25(
8351
8353
  "tr",
8352
8354
  {
8355
+ "data-row-key": String(row.key),
8353
8356
  "data-canvas-row-index": canvas ? rowIndex : void 0,
8354
8357
  className: `sia-table__row${striped && rowIndex % 2 === 1 ? " sia-table__row--striped" : ""} ${className}`.trim(),
8355
8358
  style: { height: rowHeight },
@@ -9078,9 +9081,643 @@ function TableInner(props, ref) {
9078
9081
  }
9079
9082
  var Table = forwardRef5(TableInner);
9080
9083
 
9084
+ // src/components/Table/worksheetModel.ts
9085
+ function parseWorksheetText(text) {
9086
+ const rows = [[]];
9087
+ let value = "";
9088
+ let quoted = false;
9089
+ for (let i = 0; i < text.length; i++) {
9090
+ const char = text[i];
9091
+ if (char === '"' && (quoted || value === "")) {
9092
+ if (quoted && text[i + 1] === '"') {
9093
+ value += '"';
9094
+ i++;
9095
+ } else quoted = !quoted;
9096
+ } else if (!quoted && (char === " " || char === "\n" || char === "\r")) {
9097
+ rows[rows.length - 1].push(value);
9098
+ value = "";
9099
+ if (char !== " ") {
9100
+ if (char === "\r" && text[i + 1] === "\n") i++;
9101
+ rows.push([]);
9102
+ }
9103
+ } else value += char;
9104
+ }
9105
+ rows[rows.length - 1].push(value);
9106
+ if (/\r?\n$/.test(text) && rows.length > 1 && rows.at(-1)?.length === 1 && rows.at(-1)?.[0] === "")
9107
+ rows.pop();
9108
+ return rows;
9109
+ }
9110
+ function worksheetText(rows) {
9111
+ return rows.map(
9112
+ (row) => row.map((value) => {
9113
+ const text = String(value ?? "");
9114
+ return /[\t\r\n"]/.test(text) ? `"${text.replaceAll('"', '""')}"` : text;
9115
+ }).join(" ")
9116
+ ).join("\n");
9117
+ }
9118
+ function setWorksheetValue(record, column, value) {
9119
+ const path = Array.isArray(column.dataIndex) ? column.dataIndex : String(column.dataIndex ?? column.code ?? column.key).split(".");
9120
+ if (!path.length || path.some((key) => ["__proto__", "prototype", "constructor"].includes(key)))
9121
+ return record;
9122
+ const update = (source, index) => {
9123
+ const copy = Array.isArray(source) ? [...source] : { ...source && typeof source === "object" ? source : {} };
9124
+ copy[path[index]] = index === path.length - 1 ? value : update(copy[path[index]], index + 1);
9125
+ return copy;
9126
+ };
9127
+ return update(record, 0);
9128
+ }
9129
+ function incrementWorksheetValue(value, offset) {
9130
+ if (typeof value === "number")
9131
+ return Number.isFinite(value) ? value + offset : value;
9132
+ if (typeof value !== "string") return value;
9133
+ const match = value.match(/^(.*?)(\d+(?:\.\d+)?)([^\d]*)$/);
9134
+ if (!match) return value;
9135
+ const [, prefix, number, suffix] = match;
9136
+ const [integer, decimal = ""] = number.split(".");
9137
+ const next = Number(number) + offset;
9138
+ if (!Number.isFinite(next)) return value;
9139
+ const result = decimal ? next.toFixed(decimal.length) : String(Math.trunc(next));
9140
+ const [whole, fraction] = result.split(".");
9141
+ const signed = whole.startsWith("-");
9142
+ const digits = signed ? whole.slice(1) : whole;
9143
+ const padded = integer.length > 1 && integer.startsWith("0") ? digits.padStart(integer.length, "0") : digits;
9144
+ return `${prefix}${signed ? "-" : ""}${padded}${fraction === void 0 ? "" : `.${fraction}`}${suffix}`;
9145
+ }
9146
+
9147
+ // src/components/Table/worksheet.tsx
9148
+ import { Fragment as Fragment10, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
9149
+ var isEmpty2 = (value) => value == null || value === "";
9150
+ var editorKind = (column) => !column.editable ? "readonly" : typeof column.editable === "object" ? column.editable.type ?? "input" : "input";
9151
+ var nativeEditor = (target) => target instanceof Element && Boolean(
9152
+ target.closest(
9153
+ 'input,textarea,select,[contenteditable="true"],[role="combobox"]'
9154
+ )
9155
+ );
9156
+ function createWorksheetPlugin(options) {
9157
+ let context;
9158
+ let root = null;
9159
+ let data = [];
9160
+ let observed;
9161
+ let expected;
9162
+ let editEpoch = 0;
9163
+ let suppressEditing = false;
9164
+ const undoStack = [];
9165
+ const redoStack = [];
9166
+ const limit = Number.isFinite(options.historyLimit) ? Math.max(1, Math.floor(options.historyLimit)) : 100;
9167
+ let clipboard;
9168
+ let drag;
9169
+ let frame = 0, pointerY = 0, pointerX = 0;
9170
+ const selection = () => context.getPluginApi("cellSelection");
9171
+ const range = () => selection()?.getRange() ?? null;
9172
+ const redraw = () => context.setState((state) => ({ ...state, revision: state.revision + 1 }));
9173
+ let columnInput;
9174
+ let columnCache = [];
9175
+ let rangeContext;
9176
+ let cachedRange;
9177
+ let cachedBounds;
9178
+ const columns = () => {
9179
+ if (columnInput !== context.columns) {
9180
+ columnInput = context.columns;
9181
+ columnCache = flattenTableColumns(
9182
+ sortTableColumnsByFixed(context.columns)
9183
+ ).filter((column) => !column.meta?.plugin);
9184
+ }
9185
+ return columnCache;
9186
+ };
9187
+ const valueAt = (rowIndex, column) => getTableValue(
9188
+ context.rows[rowIndex].record,
9189
+ column.dataIndex,
9190
+ column.code ?? column.key
9191
+ );
9192
+ const editable = (record, column) => Boolean(column.editable) && (typeof column.editable !== "object" || column.editable.canEdit?.(record) !== false);
9193
+ function bounds() {
9194
+ const selectedRange = range();
9195
+ if (rangeContext === context && cachedRange === selectedRange)
9196
+ return cachedBounds;
9197
+ rangeContext = context;
9198
+ cachedRange = selectedRange;
9199
+ const cols = columns();
9200
+ const rowIndexes = new Map(
9201
+ context.rows.map((row, index) => [row.key, index])
9202
+ );
9203
+ const columnIndexes = new Map(
9204
+ cols.map((column, index) => [column.key, index])
9205
+ );
9206
+ let result;
9207
+ for (const cell of selection()?.getSelectedCells() ?? []) {
9208
+ const col = columnIndexes.get(cell.columnKey), row = rowIndexes.get(cell.rowKey);
9209
+ if (col === void 0 || row === void 0) continue;
9210
+ if (!result) result = { top: row, bottom: row, left: col, right: col };
9211
+ else {
9212
+ result.top = Math.min(result.top, row);
9213
+ result.bottom = Math.max(result.bottom, row);
9214
+ result.left = Math.min(result.left, col);
9215
+ result.right = Math.max(result.right, col);
9216
+ }
9217
+ }
9218
+ return cachedBounds = result;
9219
+ }
9220
+ function sourceCells(area) {
9221
+ return context.rows.slice(area.top, area.bottom + 1).map(
9222
+ (row) => columns().slice(area.left, area.right + 1).map((column) => ({
9223
+ value: getTableValue(
9224
+ row.record,
9225
+ column.dataIndex,
9226
+ column.code ?? column.key
9227
+ ),
9228
+ kind: editable(row.record, column) ? editorKind(column) : "readonly",
9229
+ columnKey: column.key,
9230
+ record: row.record
9231
+ }))
9232
+ );
9233
+ }
9234
+ function stopDrag() {
9235
+ cancelAnimationFrame(frame);
9236
+ frame = 0;
9237
+ const active = Boolean(drag);
9238
+ drag = void 0;
9239
+ if (active) redraw();
9240
+ }
9241
+ function clearHistory() {
9242
+ undoStack.length = 0;
9243
+ redoStack.length = 0;
9244
+ clipboard = void 0;
9245
+ stopDrag();
9246
+ editEpoch++;
9247
+ suppressEditing = true;
9248
+ context.setState((state) => ({
9249
+ ...state,
9250
+ editing: null,
9251
+ revision: state.revision + 1
9252
+ }));
9253
+ }
9254
+ function remember(next) {
9255
+ context = next;
9256
+ if (observed !== next.sourceData) {
9257
+ if (observed && next.sourceData !== expected) {
9258
+ undoStack.length = 0;
9259
+ redoStack.length = 0;
9260
+ clipboard = void 0;
9261
+ drag = void 0;
9262
+ editEpoch++;
9263
+ suppressEditing = true;
9264
+ }
9265
+ observed = next.sourceData;
9266
+ data = next.sourceData;
9267
+ expected = void 0;
9268
+ }
9269
+ }
9270
+ function commit(next, operation, history = true) {
9271
+ if (next === data) return false;
9272
+ const previous = { data, range: range() };
9273
+ try {
9274
+ if (options.onChange(next, operation) === false) return false;
9275
+ } catch (error) {
9276
+ options.onError?.(error);
9277
+ return false;
9278
+ }
9279
+ if (history) {
9280
+ undoStack.push(previous);
9281
+ if (undoStack.length > limit) undoStack.shift();
9282
+ redoStack.length = 0;
9283
+ }
9284
+ data = next;
9285
+ expected = next;
9286
+ redraw();
9287
+ return true;
9288
+ }
9289
+ function apply(updates, reason) {
9290
+ const cols = columns(), next = [...data];
9291
+ const changes = [];
9292
+ let skipped = 0;
9293
+ try {
9294
+ for (const update of updates) {
9295
+ const index = next.findIndex(
9296
+ (record2, i) => context.getRowKey(record2, i) === update.address.rowKey
9297
+ );
9298
+ const column = cols.find(
9299
+ (item) => item.key === update.address.columnKey
9300
+ );
9301
+ if (index < 0 || !column || !editable(next[index], column)) {
9302
+ skipped++;
9303
+ continue;
9304
+ }
9305
+ const kind = editorKind(column);
9306
+ let value = update.value;
9307
+ if (update.source && update.source.kind !== kind) {
9308
+ skipped++;
9309
+ continue;
9310
+ }
9311
+ if (!update.source && reason !== "edit" && (kind === "select" || kind === "custom")) {
9312
+ skipped++;
9313
+ continue;
9314
+ }
9315
+ if (kind === "custom" && reason !== "edit" && update.source?.columnKey !== column.key) {
9316
+ skipped++;
9317
+ continue;
9318
+ }
9319
+ if (kind === "inputNumber") {
9320
+ if (isEmpty2(value)) value = null;
9321
+ else if (!Number.isFinite(Number(value))) {
9322
+ skipped++;
9323
+ continue;
9324
+ } else value = Number(value);
9325
+ }
9326
+ if (kind === "select" && !isEmpty2(value) && typeof column.editable === "object" && !column.editable.options?.some(
9327
+ (option) => Object.is(option.value, value) || String(option.value) === String(value)
9328
+ )) {
9329
+ skipped++;
9330
+ continue;
9331
+ }
9332
+ if (options.canWrite?.({
9333
+ record: next[index],
9334
+ column,
9335
+ value,
9336
+ sourceColumnKey: update.source?.columnKey,
9337
+ sourceRecord: update.source?.record
9338
+ }) === false) {
9339
+ skipped++;
9340
+ continue;
9341
+ }
9342
+ const previousValue = getTableValue(
9343
+ next[index],
9344
+ column.dataIndex,
9345
+ column.code ?? column.key
9346
+ );
9347
+ if (Object.is(previousValue, value)) continue;
9348
+ const record = (options.setValue ?? setWorksheetValue)(
9349
+ next[index],
9350
+ column,
9351
+ value
9352
+ );
9353
+ if (record === next[index]) {
9354
+ skipped++;
9355
+ continue;
9356
+ }
9357
+ next[index] = record;
9358
+ changes.push({ ...update.address, previousValue, value });
9359
+ }
9360
+ } catch (error) {
9361
+ options.onError?.(error);
9362
+ return false;
9363
+ }
9364
+ const operation = { reason, changes, skipped };
9365
+ const changed = changes.length > 0 && commit(next, operation);
9366
+ if (changed || changes.length === 0) options.onOperation?.(operation);
9367
+ return changed;
9368
+ }
9369
+ function restore(from, to, reason) {
9370
+ const snapshot = from.at(-1);
9371
+ if (!snapshot) return false;
9372
+ const previous = { data, range: range() };
9373
+ if (!commit([...snapshot.data], { reason, changes: [], skipped: 0 }, false))
9374
+ return false;
9375
+ from.pop();
9376
+ to.push(previous);
9377
+ editEpoch++;
9378
+ suppressEditing = true;
9379
+ context.setState((state) => ({
9380
+ ...state,
9381
+ editing: null,
9382
+ revision: state.revision + 1
9383
+ }));
9384
+ selection()?.setRange(snapshot.range);
9385
+ return true;
9386
+ }
9387
+ function paste(text) {
9388
+ const area = bounds();
9389
+ if (!area) return false;
9390
+ const matrix = parseWorksheetText(text), metadata = clipboard?.text === text ? clipboard.cells : void 0;
9391
+ const single = matrix.length === 1 && matrix[0].length === 1;
9392
+ const updates = [], cols = columns();
9393
+ const height = single ? area.bottom - area.top + 1 : matrix.length;
9394
+ const width = single ? area.right - area.left + 1 : Math.max(...matrix.map((row) => row.length));
9395
+ for (let r = 0; r < height && area.top + r < context.rows.length; r++) {
9396
+ for (let c = 0; c < width && area.left + c < cols.length; c++) {
9397
+ const value = single ? matrix[0][0] : matrix[r]?.[c];
9398
+ if (value === void 0) continue;
9399
+ const source = single ? metadata?.[0]?.[0] : metadata?.[r]?.[c];
9400
+ updates.push({
9401
+ address: {
9402
+ rowKey: context.rows[area.top + r].key,
9403
+ columnKey: cols[area.left + c].key
9404
+ },
9405
+ value: source ? source.value : value,
9406
+ source
9407
+ });
9408
+ }
9409
+ }
9410
+ return apply(updates, "paste");
9411
+ }
9412
+ function fill(area, target, cells, increment = false) {
9413
+ const cols = columns(), updates = [];
9414
+ const start = target < area.top ? target : area.bottom + 1, end = target < area.top ? area.top - 1 : target;
9415
+ for (let r = start; r <= end; r++) {
9416
+ if (!context.rows[r]) continue;
9417
+ const offset = ((r - area.top) % cells.length + cells.length) % cells.length;
9418
+ cells[offset].forEach((source, c) => {
9419
+ const column = cols[area.left + c];
9420
+ if (!column) return;
9421
+ updates.push({
9422
+ address: { rowKey: context.rows[r].key, columnKey: column.key },
9423
+ source,
9424
+ value: increment ? incrementWorksheetValue(source.value, r - (area.top + offset)) : source.value
9425
+ });
9426
+ });
9427
+ }
9428
+ const changed = apply(updates, "fill");
9429
+ if (changed)
9430
+ selection()?.setRange({
9431
+ anchor: {
9432
+ rowKey: context.rows[Math.min(area.top, target)].key,
9433
+ columnKey: cols[area.left].key
9434
+ },
9435
+ focus: {
9436
+ rowKey: context.rows[Math.max(area.bottom, target)].key,
9437
+ columnKey: cols[area.right].key
9438
+ }
9439
+ });
9440
+ return changed;
9441
+ }
9442
+ function fillTo(rowKey, increment = false) {
9443
+ const area = bounds(), target = context.rows.findIndex((row) => row.key === rowKey);
9444
+ return Boolean(
9445
+ area && target >= 0 && fill(area, target, sourceCells(area), increment)
9446
+ );
9447
+ }
9448
+ function fillDown() {
9449
+ const area = bounds();
9450
+ if (!area) return false;
9451
+ const cells = sourceCells(area);
9452
+ if (!cells.some(
9453
+ (row) => row.some((cell) => cell.kind !== "readonly" && !isEmpty2(cell.value))
9454
+ ))
9455
+ return false;
9456
+ const cols = columns().slice(area.left, area.right + 1);
9457
+ let target = area.bottom;
9458
+ for (let r = area.bottom + 1; r < context.rows.length; r++) {
9459
+ if (cols.some(
9460
+ (column) => editable(context.rows[r].record, column) && !isEmpty2(valueAt(r, column))
9461
+ ))
9462
+ break;
9463
+ target = r;
9464
+ }
9465
+ return fill(area, target, cells);
9466
+ }
9467
+ function pointTarget() {
9468
+ if (!drag || !root) return;
9469
+ const td = document.elementFromPoint(pointerX, pointerY)?.closest("td[data-column-key]");
9470
+ if (td?.closest(".sia-table") !== root) return;
9471
+ const key = td?.closest("tr")?.getAttribute("data-row-key");
9472
+ const target = context.rows.findIndex((row) => String(row.key) === key);
9473
+ if (target >= 0 && target !== drag.target) {
9474
+ drag.target = target;
9475
+ redraw();
9476
+ }
9477
+ }
9478
+ function scrollDrag() {
9479
+ if (!drag || !root) return;
9480
+ const viewport = root.querySelector(".sia-table__viewport");
9481
+ if (viewport) {
9482
+ const rect = viewport.getBoundingClientRect();
9483
+ const delta = pointerY < rect.top + 35 ? -12 : pointerY > rect.bottom - 35 ? 12 : 0;
9484
+ if (delta) viewport.scrollTop += delta;
9485
+ pointTarget();
9486
+ }
9487
+ frame = requestAnimationFrame(scrollDrag);
9488
+ }
9489
+ const api = {
9490
+ undo: () => restore(undoStack, redoStack, "undo"),
9491
+ redo: () => restore(redoStack, undoStack, "redo"),
9492
+ getHistory: () => ({
9493
+ canUndo: undoStack.length > 0,
9494
+ canRedo: redoStack.length > 0
9495
+ }),
9496
+ clearHistory,
9497
+ paste,
9498
+ fillTo,
9499
+ fillDown,
9500
+ editCell: (address, value) => apply([{ address, value }], "edit"),
9501
+ replaceData: (next) => {
9502
+ const changed = commit(next, {
9503
+ reason: "replace",
9504
+ changes: [],
9505
+ skipped: 0
9506
+ });
9507
+ if (changed) {
9508
+ editEpoch++;
9509
+ suppressEditing = true;
9510
+ }
9511
+ return changed;
9512
+ }
9513
+ };
9514
+ return {
9515
+ id: "worksheet",
9516
+ order: 71,
9517
+ initialState: { editing: null, revision: 0 },
9518
+ transformColumns(input, current) {
9519
+ remember(current);
9520
+ const epoch = editEpoch;
9521
+ const editPlugin = createEditablePlugin({
9522
+ trigger: "doubleClick",
9523
+ // 工作表由选区和填充柄提示操作,不额外展示容易被误认作清理按钮的铅笔。
9524
+ showEditIcon: false,
9525
+ onCellChange: (columnKey, record, value) => {
9526
+ if (epoch !== editEpoch) return false;
9527
+ const row = context.rows.find((item) => item.record === record);
9528
+ return Boolean(
9529
+ row && apply(
9530
+ [{ address: { rowKey: row.key, columnKey }, value }],
9531
+ "edit"
9532
+ )
9533
+ );
9534
+ }
9535
+ });
9536
+ const edited = editPlugin.transformColumns(input, {
9537
+ ...current,
9538
+ state: suppressEditing ? { ...current.state, editing: null } : current.state,
9539
+ setState: (next) => {
9540
+ if (epoch !== editEpoch) return;
9541
+ suppressEditing = false;
9542
+ current.setState((previous) => ({
9543
+ ...previous,
9544
+ ...typeof next === "function" ? next(previous) : next
9545
+ }));
9546
+ }
9547
+ });
9548
+ return mapTableLeafColumns(edited, (column) => {
9549
+ const render = column.render;
9550
+ return {
9551
+ ...column,
9552
+ render: (value, record, index, info) => {
9553
+ const area = bounds(), cols = columns();
9554
+ const handle = area && context.rows[area.bottom]?.key === info.row.key && cols[area.right]?.key === column.key && (suppressEditing || !context.state.editing);
9555
+ return /* @__PURE__ */ jsxs24(Fragment10, { children: [
9556
+ render ? render(value, record, index, info) : value,
9557
+ handle && /* @__PURE__ */ jsx26(
9558
+ "button",
9559
+ {
9560
+ type: "button",
9561
+ className: "sia-table__worksheet-handle",
9562
+ "aria-label": "\u62D6\u62FD\u586B\u5145\uFF1B\u53CC\u51FB\u81EA\u52A8\u586B\u5145\u4E0B\u65B9\u8FDE\u7EED\u7A7A\u5355\u5143\u683C",
9563
+ title: "\u62D6\u62FD\u586B\u5145\uFF1BCtrl/Cmd \u62D6\u62FD\u9012\u589E\uFF1B\u53CC\u51FB\u586B\u6EE1\u4E0B\u65B9\u8FDE\u7EED\u7A7A\u683C",
9564
+ onPointerDown: (event) => {
9565
+ if (event.button !== 0) return;
9566
+ event.preventDefault();
9567
+ event.stopPropagation();
9568
+ drag = {
9569
+ bounds: area,
9570
+ target: area.bottom,
9571
+ cells: sourceCells(area),
9572
+ increment: event.ctrlKey || event.metaKey
9573
+ };
9574
+ pointerX = event.clientX;
9575
+ pointerY = event.clientY;
9576
+ frame = requestAnimationFrame(scrollDrag);
9577
+ },
9578
+ onDoubleClick: (event) => {
9579
+ event.preventDefault();
9580
+ event.stopPropagation();
9581
+ stopDrag();
9582
+ fillDown();
9583
+ },
9584
+ onClick: (event) => event.stopPropagation()
9585
+ }
9586
+ )
9587
+ ] });
9588
+ }
9589
+ };
9590
+ });
9591
+ },
9592
+ getCellProps(row, column, current) {
9593
+ remember(current);
9594
+ const r = current.rows.indexOf(row), c = columns().findIndex((item) => item.key === column.key);
9595
+ 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);
9596
+ const readonly = !column.meta?.plugin && !editable(row.record, column);
9597
+ return {
9598
+ className: `sia-table__worksheet-cell${preview ? " sia-table__worksheet-fill-preview" : ""}${readonly ? " sia-table__worksheet-cell--readonly" : ""}`
9599
+ };
9600
+ },
9601
+ renderToolbarStart(current) {
9602
+ remember(current);
9603
+ return options.toolbar === false ? null : /* @__PURE__ */ jsxs24("span", { className: "sia-table__worksheet-tools", children: [
9604
+ /* @__PURE__ */ jsx26(
9605
+ Button,
9606
+ {
9607
+ variant: "text",
9608
+ size: "small",
9609
+ icon: /* @__PURE__ */ jsx26(Icon, { name: "undo" }),
9610
+ disabled: !undoStack.length,
9611
+ title: "\u64A4\u9500\uFF08Ctrl/Cmd + Z\uFF09",
9612
+ onClick: api.undo,
9613
+ children: "\u64A4\u9500"
9614
+ }
9615
+ ),
9616
+ /* @__PURE__ */ jsx26(
9617
+ Button,
9618
+ {
9619
+ variant: "text",
9620
+ size: "small",
9621
+ icon: /* @__PURE__ */ jsx26(Icon, { name: "redo" }),
9622
+ disabled: !redoStack.length,
9623
+ title: "\u6062\u590D\uFF08Ctrl/Cmd + Shift + Z \u6216 Ctrl/Cmd + Y\uFF09",
9624
+ onClick: api.redo,
9625
+ children: "\u6062\u590D"
9626
+ }
9627
+ )
9628
+ ] });
9629
+ },
9630
+ renderOverlay(current) {
9631
+ remember(current);
9632
+ return /* @__PURE__ */ jsx26(
9633
+ "span",
9634
+ {
9635
+ hidden: true,
9636
+ ref: (element) => {
9637
+ root = element?.closest(".sia-table") ?? null;
9638
+ }
9639
+ }
9640
+ );
9641
+ },
9642
+ getApi(current) {
9643
+ remember(current);
9644
+ return api;
9645
+ },
9646
+ onMount() {
9647
+ const active = (event) => Boolean(
9648
+ root && event.target instanceof Element && event.target.closest(".sia-table") === root && !nativeEditor(event.target)
9649
+ );
9650
+ const copy = (event) => {
9651
+ if (!active(event) || !event.clipboardData || window.getSelection()?.toString())
9652
+ return;
9653
+ const area = bounds();
9654
+ if (!area) return;
9655
+ const cells = sourceCells(area), text = worksheetText(
9656
+ cells.map((row) => row.map((cell) => cell.value))
9657
+ );
9658
+ clipboard = { text, cells };
9659
+ event.preventDefault();
9660
+ event.stopImmediatePropagation();
9661
+ event.clipboardData.setData("text/plain", text);
9662
+ };
9663
+ const onPaste = (event) => {
9664
+ if (!active(event) || !bounds() || !event.clipboardData?.types.includes("text/plain"))
9665
+ return;
9666
+ event.preventDefault();
9667
+ event.stopImmediatePropagation();
9668
+ paste(event.clipboardData.getData("text/plain"));
9669
+ };
9670
+ const keydown = (event) => {
9671
+ if (event.key === "Escape" && drag) {
9672
+ stopDrag();
9673
+ return;
9674
+ }
9675
+ if (!active(event) || !(event.ctrlKey || event.metaKey)) return;
9676
+ const key = event.key.toLowerCase();
9677
+ if (key !== "z" && key !== "y") return;
9678
+ event.preventDefault();
9679
+ event.stopImmediatePropagation();
9680
+ if (key === "y" || event.shiftKey) api.redo();
9681
+ else api.undo();
9682
+ };
9683
+ const move = (event) => {
9684
+ if (!drag) return;
9685
+ pointerX = event.clientX;
9686
+ pointerY = event.clientY;
9687
+ drag.increment = event.ctrlKey || event.metaKey;
9688
+ pointTarget();
9689
+ };
9690
+ const up = () => {
9691
+ if (!drag) return;
9692
+ const current = drag;
9693
+ stopDrag();
9694
+ fill(current.bounds, current.target, current.cells, current.increment);
9695
+ };
9696
+ document.addEventListener("copy", copy, true);
9697
+ document.addEventListener("paste", onPaste, true);
9698
+ document.addEventListener("keydown", keydown, true);
9699
+ window.addEventListener("pointermove", move);
9700
+ window.addEventListener("pointerup", up);
9701
+ window.addEventListener("pointercancel", stopDrag);
9702
+ window.addEventListener("blur", stopDrag);
9703
+ return () => {
9704
+ cancelAnimationFrame(frame);
9705
+ drag = void 0;
9706
+ document.removeEventListener("copy", copy, true);
9707
+ document.removeEventListener("paste", onPaste, true);
9708
+ document.removeEventListener("keydown", keydown, true);
9709
+ window.removeEventListener("pointermove", move);
9710
+ window.removeEventListener("pointerup", up);
9711
+ window.removeEventListener("pointercancel", stopDrag);
9712
+ window.removeEventListener("blur", stopDrag);
9713
+ };
9714
+ }
9715
+ };
9716
+ }
9717
+
9081
9718
  // src/components/ThemeSwitch.tsx
9082
9719
  import { forwardRef as forwardRef6 } from "react";
9083
- import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
9720
+ import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
9084
9721
  var ThemeSwitch = forwardRef6(function ThemeSwitch2({
9085
9722
  checked,
9086
9723
  onCheckedChange,
@@ -9094,7 +9731,7 @@ var ThemeSwitch = forwardRef6(function ThemeSwitch2({
9094
9731
  onCheckedChange?.(!checked);
9095
9732
  onClick?.(event);
9096
9733
  }
9097
- return /* @__PURE__ */ jsxs24(
9734
+ return /* @__PURE__ */ jsxs25(
9098
9735
  "button",
9099
9736
  {
9100
9737
  ref,
@@ -9106,12 +9743,12 @@ var ThemeSwitch = forwardRef6(function ThemeSwitch2({
9106
9743
  onClick: handleClick,
9107
9744
  ...withTitleTooltip(props),
9108
9745
  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" })
9746
+ /* @__PURE__ */ jsx27("span", { className: "sia-theme-switch__selection", "aria-hidden": "true" }),
9747
+ /* @__PURE__ */ jsx27("span", { className: `sia-theme-switch__icon${checked ? "" : " is-active"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxs25("svg", { viewBox: "0 0 24 24", children: [
9748
+ /* @__PURE__ */ jsx27("circle", { cx: "12", cy: "12", r: "3.5" }),
9749
+ /* @__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
9750
  ] }) }),
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" }) }) })
9751
+ /* @__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
9752
  ]
9116
9753
  }
9117
9754
  );
@@ -9155,7 +9792,7 @@ function applySiaTheme(mode, target = document.documentElement) {
9155
9792
 
9156
9793
  // src/components/InputSelect.tsx
9157
9794
  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";
9795
+ import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
9159
9796
  var InputSelect = forwardRef7(function InputSelect2({
9160
9797
  options,
9161
9798
  value,
@@ -9238,14 +9875,14 @@ var InputSelect = forwardRef7(function InputSelect2({
9238
9875
  setSelectedOnly(false);
9239
9876
  setModalOpen(true);
9240
9877
  }
9241
- return /* @__PURE__ */ jsxs25("div", { ref: rootRef, style, className: `sia-input-select${open || modalOpen ? " is-open" : ""} ${className}`, onKeyDown: (event) => {
9878
+ return /* @__PURE__ */ jsxs26("div", { ref: rootRef, style, className: `sia-input-select${open || modalOpen ? " is-open" : ""} ${className}`, onKeyDown: (event) => {
9242
9879
  if (event.key === "Escape" && open) {
9243
9880
  event.stopPropagation();
9244
9881
  changeOpen(false);
9245
9882
  inputRef.current?.focus();
9246
9883
  }
9247
9884
  }, children: [
9248
- /* @__PURE__ */ jsx27(
9885
+ /* @__PURE__ */ jsx28(
9249
9886
  Input,
9250
9887
  {
9251
9888
  ...inputProps,
@@ -9282,26 +9919,26 @@ var InputSelect = forwardRef7(function InputSelect2({
9282
9919
  emit(parseInput ? parseInput(next) : multiple ? next.split(",").map((item) => item.trim()).filter(Boolean) : next);
9283
9920
  changeOpen(true);
9284
9921
  },
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) => {
9922
+ suffix: /* @__PURE__ */ jsxs26("span", { className: "sia-input-select__suffix", children: [
9923
+ 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
9924
  event.stopPropagation();
9288
9925
  setDraft("");
9289
9926
  emit(multiple ? [] : void 0);
9290
9927
  inputRef.current?.focus();
9291
9928
  }, children: "\xD7" }),
9292
9929
  suffix,
9293
- enableModal && /* @__PURE__ */ jsx27(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
9930
+ enableModal && /* @__PURE__ */ jsx28(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
9294
9931
  event.stopPropagation();
9295
9932
  openModal();
9296
9933
  }, children: "\u2026" }),
9297
- /* @__PURE__ */ jsx27(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
9934
+ /* @__PURE__ */ jsx28(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
9298
9935
  event.stopPropagation();
9299
9936
  changeOpen(!open);
9300
- }, children: /* @__PURE__ */ jsx27(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
9937
+ }, children: /* @__PURE__ */ jsx28(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
9301
9938
  ] })
9302
9939
  }
9303
9940
  ),
9304
- /* @__PURE__ */ jsx27(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx27(
9941
+ /* @__PURE__ */ jsx28(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx28(
9305
9942
  SelectionPanel,
9306
9943
  {
9307
9944
  options,
@@ -9316,7 +9953,7 @@ var InputSelect = forwardRef7(function InputSelect2({
9316
9953
  onSearch: setSearch
9317
9954
  }
9318
9955
  ) }),
9319
- enableModal && /* @__PURE__ */ jsxs25(
9956
+ enableModal && /* @__PURE__ */ jsxs26(
9320
9957
  Modal,
9321
9958
  {
9322
9959
  open: modalOpen,
@@ -9329,15 +9966,15 @@ var InputSelect = forwardRef7(function InputSelect2({
9329
9966
  setModalOpen(false);
9330
9967
  },
9331
9968
  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: [
9969
+ /* @__PURE__ */ jsxs26("div", { className: "sia-selection-panel__actions", role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
9970
+ /* @__PURE__ */ jsx28(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
9971
+ /* @__PURE__ */ jsxs26(Button, { role: "tab", "aria-selected": selectedOnly, variant: selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(true), children: [
9335
9972
  "\u5DF2\u9009\u9879(",
9336
9973
  modalValues.length,
9337
9974
  ")"
9338
9975
  ] })
9339
9976
  ] }),
9340
- modalOpen && /* @__PURE__ */ jsx27(
9977
+ modalOpen && /* @__PURE__ */ jsx28(
9341
9978
  SelectionPanel,
9342
9979
  {
9343
9980
  options,
@@ -9512,7 +10149,7 @@ function countQueryFieldRows(centers) {
9512
10149
  }
9513
10150
 
9514
10151
  // src/components/QueryFormSettings.tsx
9515
- import { Fragment as Fragment10, jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
10152
+ import { Fragment as Fragment11, jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
9516
10153
  function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed, disabled) {
9517
10154
  const [snapshot, setSnapshot] = useState25();
9518
10155
  const [draft, setDraft] = useState25({ fields: [], defaultCollapsed: defaultCollapsed ?? false });
@@ -9607,7 +10244,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
9607
10244
  const items = new Map(visibleDraft.map((item) => [item.key, item]));
9608
10245
  setDraft((current) => ({ ...current, fields: keys.map((key, order) => ({ ...items.get(key), order })) }));
9609
10246
  });
9610
- const control = config ? /* @__PURE__ */ jsx28(
10247
+ const control = config ? /* @__PURE__ */ jsx29(
9611
10248
  Button,
9612
10249
  {
9613
10250
  type: "button",
@@ -9616,16 +10253,16 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
9616
10253
  "aria-label": "\u67E5\u8BE2\u8BBE\u7F6E",
9617
10254
  disabled: disabled || saving,
9618
10255
  loading: loading && !open,
9619
- icon: /* @__PURE__ */ jsx28(Icon, { name: "more-vertical" }),
10256
+ icon: /* @__PURE__ */ jsx29(Icon, { name: "more-vertical" }),
9620
10257
  onClick: () => {
9621
10258
  setOpen(true);
9622
10259
  void load(true);
9623
10260
  }
9624
10261
  }
9625
10262
  ) : 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(
10263
+ const panel = config ? /* @__PURE__ */ jsxs27(Fragment11, { children: [
10264
+ !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,
10265
+ /* @__PURE__ */ jsx29(
9629
10266
  Modal,
9630
10267
  {
9631
10268
  title: "\u67E5\u8BE2\u8BBE\u7F6E",
@@ -9638,15 +10275,15 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
9638
10275
  onOpenChange: (next) => {
9639
10276
  if (!saveLock.current) setOpen(next);
9640
10277
  },
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: [
10278
+ children: /* @__PURE__ */ jsxs27("div", { className: "sia-query-settings", children: [
10279
+ loading ? /* @__PURE__ */ jsx29("p", { role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u67E5\u8BE2\u8BBE\u7F6E\u2026" }) : null,
10280
+ error ? /* @__PURE__ */ jsxs27("div", { role: "alert", className: "sia-query-form__error", children: [
9644
10281
  error,
9645
- loadFailed ? /* @__PURE__ */ jsx28(Button, { type: "button", variant: "link", onClick: () => void load(true), children: "\u91CD\u8BD5" }) : null
10282
+ loadFailed ? /* @__PURE__ */ jsx29(Button, { type: "button", variant: "link", onClick: () => void load(true), children: "\u91CD\u8BD5" }) : null
9646
10283
  ] }) : 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(
10284
+ /* @__PURE__ */ jsx29(Checkbox, { checked: draft.defaultCollapsed, disabled: locked, onChange: (checked) => setDraft((current) => ({ ...current, defaultCollapsed: checked })), children: "\u9ED8\u8BA4\u6536\u8D77\u67E5\u8BE2\u6761\u4EF6" }),
10285
+ /* @__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" }),
10286
+ /* @__PURE__ */ jsx29("div", { ref: sort.listRef, className: `sia-query-settings__list${sort.preview ? " is-sorting" : ""}`, children: visibleDraft.map((item, index) => /* @__PURE__ */ jsxs27(
9650
10287
  "div",
9651
10288
  {
9652
10289
  "data-query-field-key": item.key,
@@ -9654,18 +10291,18 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
9654
10291
  style: sort.preview ? { transform: `translateY(${sort.preview.offsets[item.key] ?? 0}px)` } : void 0,
9655
10292
  onPointerDown: (event) => sort.start(event, item.key),
9656
10293
  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) })
10294
+ /* @__PURE__ */ jsx29(Icon, { name: "menu", size: 15 }),
10295
+ /* @__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) })) }),
10296
+ /* @__PURE__ */ jsx29("span", { className: "sia-query-settings__name", children: labels.get(item.key) ?? item.key }),
10297
+ /* @__PURE__ */ jsxs27("div", { className: "sia-query-settings__order", children: [
10298
+ /* @__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) }),
10299
+ /* @__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
10300
  ] })
9664
10301
  ]
9665
10302
  },
9666
10303
  item.key
9667
10304
  )) }),
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" })
10305
+ /* @__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
10306
  ] })
9670
10307
  }
9671
10308
  )
@@ -9674,7 +10311,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
9674
10311
  }
9675
10312
 
9676
10313
  // src/components/QueryForm.tsx
9677
- import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
10314
+ import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
9678
10315
  function QueryForm({
9679
10316
  fields,
9680
10317
  settings,
@@ -9737,7 +10374,7 @@ function QueryForm({
9737
10374
  width,
9738
10375
  hideDisabled: settingsHideDisabled,
9739
10376
  label: settingsLabel ?? item.label ?? (typeof item.children === "function" ? void 0 : fieldLabel(item.children)) ?? key,
9740
- content: /* @__PURE__ */ jsx29(Form.Item, { noStyle: true, ...item })
10377
+ content: /* @__PURE__ */ jsx30(Form.Item, { noStyle: true, ...item })
9741
10378
  })) : Children4.toArray(children).map((content, index) => ({
9742
10379
  key: isValidElement5(content) && content.key != null ? String(content.key) : String(index),
9743
10380
  width: void 0,
@@ -9915,8 +10552,8 @@ function QueryForm({
9915
10552
  setRemoving(false);
9916
10553
  }
9917
10554
  }
9918
- return /* @__PURE__ */ jsxs27("div", { className: `sia-query-form ${className}`.trim(), children: [
9919
- /* @__PURE__ */ jsxs27(
10555
+ return /* @__PURE__ */ jsxs28("div", { className: `sia-query-form ${className}`.trim(), children: [
10556
+ /* @__PURE__ */ jsxs28(
9920
10557
  Form,
9921
10558
  {
9922
10559
  ...formProps,
@@ -9935,8 +10572,8 @@ function QueryForm({
9935
10572
  onValuesChange?.(changed, values);
9936
10573
  },
9937
10574
  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(
10575
+ quickQueries.length ? /* @__PURE__ */ jsxs28("div", { className: "sia-query-form__quick", "aria-label": "\u9884\u8BBE\u5FEB\u6377\u67E5\u8BE2", children: [
10576
+ quickQueries.map((query) => /* @__PURE__ */ jsx30(
9940
10577
  Badge,
9941
10578
  {
9942
10579
  className: "sia-query-form__quick-badge",
@@ -9945,7 +10582,7 @@ function QueryForm({
9945
10582
  title: query.count === void 0 ? void 0 : `\u5171 ${query.count} \u6761`,
9946
10583
  ...query.badgeProps,
9947
10584
  count: query.count,
9948
- children: /* @__PURE__ */ jsx29(
10585
+ children: /* @__PURE__ */ jsx30(
9949
10586
  Button,
9950
10587
  {
9951
10588
  size: query.size ?? quickQuerySize,
@@ -9961,7 +10598,7 @@ function QueryForm({
9961
10598
  )),
9962
10599
  " "
9963
10600
  ] }) : null,
9964
- /* @__PURE__ */ jsxs27(
10601
+ /* @__PURE__ */ jsxs28(
9965
10602
  "div",
9966
10603
  {
9967
10604
  ref: rowRef,
@@ -9970,7 +10607,7 @@ function QueryForm({
9970
10607
  "--sia-query-field-width": typeof fieldWidth === "number" ? `${fieldWidth}px` : fieldWidth
9971
10608
  },
9972
10609
  children: [
9973
- entries.map((entry) => /* @__PURE__ */ jsx29(
10610
+ entries.map((entry) => /* @__PURE__ */ jsx30(
9974
10611
  "div",
9975
10612
  {
9976
10613
  className: "sia-query-form__field",
@@ -9983,9 +10620,9 @@ function QueryForm({
9983
10620
  },
9984
10621
  entry.key
9985
10622
  )),
9986
- /* @__PURE__ */ jsxs27("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
9987
- /* @__PURE__ */ jsxs27(Space.Compact, { children: [
9988
- /* @__PURE__ */ jsx29(
10623
+ /* @__PURE__ */ jsxs28("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
10624
+ /* @__PURE__ */ jsxs28(Space.Compact, { children: [
10625
+ /* @__PURE__ */ jsx30(
9989
10626
  Button,
9990
10627
  {
9991
10628
  type: "submit",
@@ -9995,8 +10632,8 @@ function QueryForm({
9995
10632
  children: searchText
9996
10633
  }
9997
10634
  ),
9998
- /* @__PURE__ */ jsx29(Button, { disabled: busy, onClick: reset, children: resetText }),
9999
- onSaveQuery ? /* @__PURE__ */ jsx29(
10635
+ /* @__PURE__ */ jsx30(Button, { disabled: busy, onClick: reset, children: resetText }),
10636
+ onSaveQuery ? /* @__PURE__ */ jsx30(
10000
10637
  Button,
10001
10638
  {
10002
10639
  disabled: shortcutBusy,
@@ -10011,12 +10648,12 @@ function QueryForm({
10011
10648
  ) : null,
10012
10649
  showSettings ?? settingsRows > 2 ? cloudSettings.control : null
10013
10650
  ] }),
10014
- collapsible && entries.length > 0 ? /* @__PURE__ */ jsx29("span", { ref: toggleRef, hidden: !needsCollapse, children: /* @__PURE__ */ jsx29(
10651
+ collapsible && entries.length > 0 ? /* @__PURE__ */ jsx30("span", { ref: toggleRef, hidden: !needsCollapse, children: /* @__PURE__ */ jsx30(
10015
10652
  Button,
10016
10653
  {
10017
10654
  variant: "link",
10018
10655
  "aria-expanded": !collapsed,
10019
- icon: /* @__PURE__ */ jsx29(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
10656
+ icon: /* @__PURE__ */ jsx30(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
10020
10657
  iconPosition: "end",
10021
10658
  onClick: () => {
10022
10659
  setInternalCollapsed(!collapsed);
@@ -10031,8 +10668,8 @@ function QueryForm({
10031
10668
  ]
10032
10669
  }
10033
10670
  ),
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(
10671
+ savedQueries.length ? /* @__PURE__ */ jsxs28("div", { className: "sia-query-form__saved", "aria-label": "\u5DF2\u4FDD\u5B58\u5FEB\u6377\u67E5\u8BE2", children: [
10672
+ savedQueries.map((query, index) => /* @__PURE__ */ jsx30(
10036
10673
  Tag,
10037
10674
  {
10038
10675
  status: query.status ?? ["processing", "success", "warning", "error"][index % 4],
@@ -10058,11 +10695,11 @@ function QueryForm({
10058
10695
  )),
10059
10696
  " "
10060
10697
  ] }) : null,
10061
- error ? /* @__PURE__ */ jsx29("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
10698
+ error ? /* @__PURE__ */ jsx30("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
10062
10699
  ]
10063
10700
  }
10064
10701
  ),
10065
- /* @__PURE__ */ jsxs27(
10702
+ /* @__PURE__ */ jsxs28(
10066
10703
  Modal,
10067
10704
  {
10068
10705
  open: saveOpen,
@@ -10074,7 +10711,7 @@ function QueryForm({
10074
10711
  if (!saveLock.current) setSaveOpen(next);
10075
10712
  },
10076
10713
  children: [
10077
- /* @__PURE__ */ jsx29(
10714
+ /* @__PURE__ */ jsx30(
10078
10715
  Input,
10079
10716
  {
10080
10717
  autoFocus: true,
@@ -10093,7 +10730,7 @@ function QueryForm({
10093
10730
  }
10094
10731
  }
10095
10732
  ),
10096
- saveError ? /* @__PURE__ */ jsx29("p", { className: "sia-query-form__error", role: "alert", children: saveError }) : null
10733
+ saveError ? /* @__PURE__ */ jsx30("p", { className: "sia-query-form__error", role: "alert", children: saveError }) : null
10097
10734
  ]
10098
10735
  }
10099
10736
  )
@@ -10102,7 +10739,7 @@ function QueryForm({
10102
10739
 
10103
10740
  // src/components/NumberRange.tsx
10104
10741
  import { forwardRef as forwardRef8 } from "react";
10105
- import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
10742
+ import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
10106
10743
  var NumberRange = forwardRef8(function NumberRange2({
10107
10744
  value,
10108
10745
  defaultValue = [null, null],
@@ -10131,7 +10768,7 @@ var NumberRange = forwardRef8(function NumberRange2({
10131
10768
  setValue2(index === 0 ? [next, range[1]] : [range[0], next]);
10132
10769
  }
10133
10770
  const inputProps = { min, max, step, precision, size, status, disabled, readOnly, placeholderMode, controls: false };
10134
- return /* @__PURE__ */ jsxs28(
10771
+ return /* @__PURE__ */ jsxs29(
10135
10772
  "span",
10136
10773
  {
10137
10774
  ...props,
@@ -10140,7 +10777,7 @@ var NumberRange = forwardRef8(function NumberRange2({
10140
10777
  "aria-disabled": disabled || void 0,
10141
10778
  className: `sia-number-range sia-number-range--${size} sia-number-range--${status}${disabled ? " is-disabled" : ""} ${className}`.trim(),
10142
10779
  children: [
10143
- /* @__PURE__ */ jsx30(
10780
+ /* @__PURE__ */ jsx31(
10144
10781
  InputNumber,
10145
10782
  {
10146
10783
  ...inputProps,
@@ -10152,8 +10789,8 @@ var NumberRange = forwardRef8(function NumberRange2({
10152
10789
  onChange: (next) => change(0, next)
10153
10790
  }
10154
10791
  ),
10155
- /* @__PURE__ */ jsx30(Icon, { className: "sia-number-range__separator", name: "tilde", size: 12, strokeWidth: 1.5, "aria-hidden": "true" }),
10156
- /* @__PURE__ */ jsx30(
10792
+ /* @__PURE__ */ jsx31(Icon, { className: "sia-number-range__separator", name: "tilde", size: 12, strokeWidth: 1.5, "aria-hidden": "true" }),
10793
+ /* @__PURE__ */ jsx31(
10157
10794
  InputNumber,
10158
10795
  {
10159
10796
  ...inputProps,
@@ -10165,7 +10802,7 @@ var NumberRange = forwardRef8(function NumberRange2({
10165
10802
  onChange: (next) => change(1, next)
10166
10803
  }
10167
10804
  ),
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
10805
+ 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
10806
  ]
10170
10807
  }
10171
10808
  );
@@ -10318,6 +10955,7 @@ export {
10318
10955
  createSummaryPlugin,
10319
10956
  createToolbarPlugin,
10320
10957
  createTreePlugin,
10958
+ createWorksheetPlugin,
10321
10959
  formatChartNumber,
10322
10960
  getChartMap,
10323
10961
  linearScale,