@sia.soul/sia-react-ui 0.1.125 → 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";
@@ -2060,7 +2060,7 @@ function FormItem({
2060
2060
  const id = useId3();
2061
2061
  const itemRef = useRef8(null);
2062
2062
  const errorContentRef = useRef8(null);
2063
- const [errorPlacement, setErrorPlacement] = useState9("bottom-start");
2063
+ const [errorObscured, setErrorObscured] = useState9(false);
2064
2064
  if (!form) throw new Error("Form.Item \u5FC5\u987B\u5728 Form \u5185\u4F7F\u7528");
2065
2065
  useSyncExternalStore(form.subscribe, form.getSnapshot, form.getSnapshot);
2066
2066
  const path = name === void 0 ? void 0 : pathArray(name);
@@ -2073,7 +2073,7 @@ function FormItem({
2073
2073
  const errorId = `${id}-error`;
2074
2074
  const hasError = status === "error" && Boolean(helpContent);
2075
2075
  useEffect6(() => {
2076
- setErrorPlacement("bottom-start");
2076
+ setErrorObscured(false);
2077
2077
  if (!hasError || noStyle) return void 0;
2078
2078
  const doc = itemRef.current?.ownerDocument;
2079
2079
  const view = doc?.defaultView;
@@ -2084,7 +2084,13 @@ function FormItem({
2084
2084
  frame = 0;
2085
2085
  const overlay = errorContentRef.current?.closest(".sia-form-item__error-popover");
2086
2086
  const bounds = overlay?.getBoundingClientRect();
2087
- if (point && bounds && point.x >= bounds.left && point.x <= bounds.right && point.y >= bounds.top && point.y <= bounds.bottom) setErrorPlacement("top-start");
2087
+ if (!bounds) return;
2088
+ const pointerInside = !!point && point.x >= bounds.left - 4 && point.x <= bounds.right + 4 && point.y >= bounds.top - 4 && point.y <= bounds.bottom + 4;
2089
+ const active = doc.activeElement;
2090
+ const otherControl = active?.matches("input, textarea, button, select, [role='combobox'], [contenteditable='true']") && !itemRef.current?.contains(active);
2091
+ const focusedBounds = otherControl ? active?.getBoundingClientRect() : void 0;
2092
+ const coversFocus = !!focusedBounds && focusedBounds.width > 0 && focusedBounds.height > 0 && bounds.left < focusedBounds.right && bounds.right > focusedBounds.left && bounds.top < focusedBounds.bottom && bounds.bottom > focusedBounds.top;
2093
+ setErrorObscured(pointerInside || coversFocus);
2088
2094
  };
2089
2095
  const schedule = () => {
2090
2096
  if (!frame) frame = view.requestAnimationFrame(measure);
@@ -2098,14 +2104,23 @@ function FormItem({
2098
2104
  schedule();
2099
2105
  };
2100
2106
  doc.addEventListener("pointermove", move, { passive: true });
2107
+ doc.addEventListener("pointerdown", move, { passive: true });
2101
2108
  doc.addEventListener("pointerleave", leave);
2102
2109
  doc.addEventListener("scroll", schedule, true);
2110
+ doc.addEventListener("focusin", schedule);
2111
+ doc.addEventListener("focusout", schedule);
2112
+ view.addEventListener("resize", schedule);
2103
2113
  view.addEventListener("blur", leave);
2114
+ schedule();
2104
2115
  return () => {
2105
2116
  view.cancelAnimationFrame(frame);
2106
2117
  doc.removeEventListener("pointermove", move);
2118
+ doc.removeEventListener("pointerdown", move);
2107
2119
  doc.removeEventListener("pointerleave", leave);
2108
2120
  doc.removeEventListener("scroll", schedule, true);
2121
+ doc.removeEventListener("focusin", schedule);
2122
+ doc.removeEventListener("focusout", schedule);
2123
+ view.removeEventListener("resize", schedule);
2109
2124
  view.removeEventListener("blur", leave);
2110
2125
  };
2111
2126
  }, [hasError, noStyle, helpContent]);
@@ -2167,12 +2182,12 @@ function FormItem({
2167
2182
  /* @__PURE__ */ jsx11(Icon, { className: "sia-form-item__error-icon", name: "circle-close", variant: "filled", size: 16, "aria-hidden": "true" }),
2168
2183
  /* @__PURE__ */ jsx11("span", { children: helpContent })
2169
2184
  ] }) : null,
2170
- placement: errorPlacement,
2185
+ placement: "bottom-start",
2171
2186
  trigger: [],
2172
2187
  open: hasError,
2173
2188
  role: "alert",
2174
2189
  color: "var(--sia-color-error)",
2175
- overlayClassName: "sia-form-item__error-popover",
2190
+ overlayClassName: `sia-form-item__error-popover${errorObscured ? " sia-form-item__error-popover--obscured" : ""}`,
2176
2191
  children: inputWrap
2177
2192
  }
2178
2193
  ),
@@ -8335,6 +8350,7 @@ var TableBodyRow = memo(function TableBodyRow2({
8335
8350
  return /* @__PURE__ */ jsx25(
8336
8351
  "tr",
8337
8352
  {
8353
+ "data-row-key": String(row.key),
8338
8354
  "data-canvas-row-index": canvas ? rowIndex : void 0,
8339
8355
  className: `sia-table__row${striped && rowIndex % 2 === 1 ? " sia-table__row--striped" : ""} ${className}`.trim(),
8340
8356
  style: { height: rowHeight },
@@ -9063,9 +9079,640 @@ function TableInner(props, ref) {
9063
9079
  }
9064
9080
  var Table = forwardRef5(TableInner);
9065
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
+
9066
9713
  // src/components/ThemeSwitch.tsx
9067
9714
  import { forwardRef as forwardRef6 } from "react";
9068
- import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
9715
+ import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
9069
9716
  var ThemeSwitch = forwardRef6(function ThemeSwitch2({
9070
9717
  checked,
9071
9718
  onCheckedChange,
@@ -9079,7 +9726,7 @@ var ThemeSwitch = forwardRef6(function ThemeSwitch2({
9079
9726
  onCheckedChange?.(!checked);
9080
9727
  onClick?.(event);
9081
9728
  }
9082
- return /* @__PURE__ */ jsxs24(
9729
+ return /* @__PURE__ */ jsxs25(
9083
9730
  "button",
9084
9731
  {
9085
9732
  ref,
@@ -9091,12 +9738,12 @@ var ThemeSwitch = forwardRef6(function ThemeSwitch2({
9091
9738
  onClick: handleClick,
9092
9739
  ...withTitleTooltip(props),
9093
9740
  children: [
9094
- /* @__PURE__ */ jsx26("span", { className: "sia-theme-switch__selection", "aria-hidden": "true" }),
9095
- /* @__PURE__ */ jsx26("span", { className: `sia-theme-switch__icon${checked ? "" : " is-active"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxs24("svg", { viewBox: "0 0 24 24", children: [
9096
- /* @__PURE__ */ jsx26("circle", { cx: "12", cy: "12", r: "3.5" }),
9097
- /* @__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" })
9098
9745
  ] }) }),
9099
- /* @__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" }) }) })
9100
9747
  ]
9101
9748
  }
9102
9749
  );
@@ -9140,7 +9787,7 @@ function applySiaTheme(mode, target = document.documentElement) {
9140
9787
 
9141
9788
  // src/components/InputSelect.tsx
9142
9789
  import { forwardRef as forwardRef7, useEffect as useEffect16, useRef as useRef20, useState as useState23 } from "react";
9143
- import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
9790
+ import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
9144
9791
  var InputSelect = forwardRef7(function InputSelect2({
9145
9792
  options,
9146
9793
  value,
@@ -9223,14 +9870,14 @@ var InputSelect = forwardRef7(function InputSelect2({
9223
9870
  setSelectedOnly(false);
9224
9871
  setModalOpen(true);
9225
9872
  }
9226
- 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) => {
9227
9874
  if (event.key === "Escape" && open) {
9228
9875
  event.stopPropagation();
9229
9876
  changeOpen(false);
9230
9877
  inputRef.current?.focus();
9231
9878
  }
9232
9879
  }, children: [
9233
- /* @__PURE__ */ jsx27(
9880
+ /* @__PURE__ */ jsx28(
9234
9881
  Input,
9235
9882
  {
9236
9883
  ...inputProps,
@@ -9267,26 +9914,26 @@ var InputSelect = forwardRef7(function InputSelect2({
9267
9914
  emit(parseInput ? parseInput(next) : multiple ? next.split(",").map((item) => item.trim()).filter(Boolean) : next);
9268
9915
  changeOpen(true);
9269
9916
  },
9270
- suffix: /* @__PURE__ */ jsxs25("span", { className: "sia-input-select__suffix", children: [
9271
- 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) => {
9272
9919
  event.stopPropagation();
9273
9920
  setDraft("");
9274
9921
  emit(multiple ? [] : void 0);
9275
9922
  inputRef.current?.focus();
9276
9923
  }, children: "\xD7" }),
9277
9924
  suffix,
9278
- 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) => {
9279
9926
  event.stopPropagation();
9280
9927
  openModal();
9281
9928
  }, children: "\u2026" }),
9282
- /* @__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) => {
9283
9930
  event.stopPropagation();
9284
9931
  changeOpen(!open);
9285
- }, 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 }) })
9286
9933
  ] })
9287
9934
  }
9288
9935
  ),
9289
- /* @__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(
9290
9937
  SelectionPanel,
9291
9938
  {
9292
9939
  options,
@@ -9301,7 +9948,7 @@ var InputSelect = forwardRef7(function InputSelect2({
9301
9948
  onSearch: setSearch
9302
9949
  }
9303
9950
  ) }),
9304
- enableModal && /* @__PURE__ */ jsxs25(
9951
+ enableModal && /* @__PURE__ */ jsxs26(
9305
9952
  Modal,
9306
9953
  {
9307
9954
  open: modalOpen,
@@ -9314,15 +9961,15 @@ var InputSelect = forwardRef7(function InputSelect2({
9314
9961
  setModalOpen(false);
9315
9962
  },
9316
9963
  children: [
9317
- /* @__PURE__ */ jsxs25("div", { className: "sia-selection-panel__actions", role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
9318
- /* @__PURE__ */ jsx27(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
9319
- /* @__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: [
9320
9967
  "\u5DF2\u9009\u9879(",
9321
9968
  modalValues.length,
9322
9969
  ")"
9323
9970
  ] })
9324
9971
  ] }),
9325
- modalOpen && /* @__PURE__ */ jsx27(
9972
+ modalOpen && /* @__PURE__ */ jsx28(
9326
9973
  SelectionPanel,
9327
9974
  {
9328
9975
  options,
@@ -9497,7 +10144,7 @@ function countQueryFieldRows(centers) {
9497
10144
  }
9498
10145
 
9499
10146
  // src/components/QueryFormSettings.tsx
9500
- 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";
9501
10148
  function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed, disabled) {
9502
10149
  const [snapshot, setSnapshot] = useState25();
9503
10150
  const [draft, setDraft] = useState25({ fields: [], defaultCollapsed: defaultCollapsed ?? false });
@@ -9592,7 +10239,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
9592
10239
  const items = new Map(visibleDraft.map((item) => [item.key, item]));
9593
10240
  setDraft((current) => ({ ...current, fields: keys.map((key, order) => ({ ...items.get(key), order })) }));
9594
10241
  });
9595
- const control = config ? /* @__PURE__ */ jsx28(
10242
+ const control = config ? /* @__PURE__ */ jsx29(
9596
10243
  Button,
9597
10244
  {
9598
10245
  type: "button",
@@ -9601,16 +10248,16 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
9601
10248
  "aria-label": "\u67E5\u8BE2\u8BBE\u7F6E",
9602
10249
  disabled: disabled || saving,
9603
10250
  loading: loading && !open,
9604
- icon: /* @__PURE__ */ jsx28(Icon, { name: "more-vertical" }),
10251
+ icon: /* @__PURE__ */ jsx29(Icon, { name: "more-vertical" }),
9605
10252
  onClick: () => {
9606
10253
  setOpen(true);
9607
10254
  void load(true);
9608
10255
  }
9609
10256
  }
9610
10257
  ) : null;
9611
- const panel = config ? /* @__PURE__ */ jsxs26(Fragment10, { children: [
9612
- !open && error ? /* @__PURE__ */ jsx28("span", { className: "sia-query-form__error", role: "alert", children: "\u67E5\u8BE2\u8BBE\u7F6E\u8BFB\u53D6\u5931\u8D25\uFF0C\u8BF7\u6253\u5F00\u8BBE\u7F6E\u91CD\u8BD5" }) : null,
9613
- /* @__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(
9614
10261
  Modal,
9615
10262
  {
9616
10263
  title: "\u67E5\u8BE2\u8BBE\u7F6E",
@@ -9623,15 +10270,15 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
9623
10270
  onOpenChange: (next) => {
9624
10271
  if (!saveLock.current) setOpen(next);
9625
10272
  },
9626
- children: /* @__PURE__ */ jsxs26("div", { className: "sia-query-settings", children: [
9627
- loading ? /* @__PURE__ */ jsx28("p", { role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u67E5\u8BE2\u8BBE\u7F6E\u2026" }) : null,
9628
- 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: [
9629
10276
  error,
9630
- 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
9631
10278
  ] }) : null,
9632
- /* @__PURE__ */ jsx28(Checkbox, { checked: draft.defaultCollapsed, disabled: locked, onChange: (checked) => setDraft((current) => ({ ...current, defaultCollapsed: checked })), children: "\u9ED8\u8BA4\u6536\u8D77\u67E5\u8BE2\u6761\u4EF6" }),
9633
- /* @__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" }),
9634
- /* @__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(
9635
10282
  "div",
9636
10283
  {
9637
10284
  "data-query-field-key": item.key,
@@ -9639,18 +10286,18 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
9639
10286
  style: sort.preview ? { transform: `translateY(${sort.preview.offsets[item.key] ?? 0}px)` } : void 0,
9640
10287
  onPointerDown: (event) => sort.start(event, item.key),
9641
10288
  children: [
9642
- /* @__PURE__ */ jsx28(Icon, { name: "menu", size: 15 }),
9643
- /* @__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) })) }),
9644
- /* @__PURE__ */ jsx28("span", { className: "sia-query-settings__name", children: labels.get(item.key) ?? item.key }),
9645
- /* @__PURE__ */ jsxs26("div", { className: "sia-query-settings__order", children: [
9646
- /* @__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) }),
9647
- /* @__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) })
9648
10295
  ] })
9649
10296
  ]
9650
10297
  },
9651
10298
  item.key
9652
10299
  )) }),
9653
- /* @__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" })
9654
10301
  ] })
9655
10302
  }
9656
10303
  )
@@ -9659,7 +10306,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
9659
10306
  }
9660
10307
 
9661
10308
  // src/components/QueryForm.tsx
9662
- import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
10309
+ import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
9663
10310
  function QueryForm({
9664
10311
  fields,
9665
10312
  settings,
@@ -9722,7 +10369,7 @@ function QueryForm({
9722
10369
  width,
9723
10370
  hideDisabled: settingsHideDisabled,
9724
10371
  label: settingsLabel ?? item.label ?? (typeof item.children === "function" ? void 0 : fieldLabel(item.children)) ?? key,
9725
- content: /* @__PURE__ */ jsx29(Form.Item, { noStyle: true, ...item })
10372
+ content: /* @__PURE__ */ jsx30(Form.Item, { noStyle: true, ...item })
9726
10373
  })) : Children4.toArray(children).map((content, index) => ({
9727
10374
  key: isValidElement5(content) && content.key != null ? String(content.key) : String(index),
9728
10375
  width: void 0,
@@ -9900,8 +10547,8 @@ function QueryForm({
9900
10547
  setRemoving(false);
9901
10548
  }
9902
10549
  }
9903
- return /* @__PURE__ */ jsxs27("div", { className: `sia-query-form ${className}`.trim(), children: [
9904
- /* @__PURE__ */ jsxs27(
10550
+ return /* @__PURE__ */ jsxs28("div", { className: `sia-query-form ${className}`.trim(), children: [
10551
+ /* @__PURE__ */ jsxs28(
9905
10552
  Form,
9906
10553
  {
9907
10554
  ...formProps,
@@ -9920,8 +10567,8 @@ function QueryForm({
9920
10567
  onValuesChange?.(changed, values);
9921
10568
  },
9922
10569
  children: [
9923
- quickQueries.length ? /* @__PURE__ */ jsxs27("div", { className: "sia-query-form__quick", "aria-label": "\u9884\u8BBE\u5FEB\u6377\u67E5\u8BE2", children: [
9924
- 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(
9925
10572
  Badge,
9926
10573
  {
9927
10574
  className: "sia-query-form__quick-badge",
@@ -9930,7 +10577,7 @@ function QueryForm({
9930
10577
  title: query.count === void 0 ? void 0 : `\u5171 ${query.count} \u6761`,
9931
10578
  ...query.badgeProps,
9932
10579
  count: query.count,
9933
- children: /* @__PURE__ */ jsx29(
10580
+ children: /* @__PURE__ */ jsx30(
9934
10581
  Button,
9935
10582
  {
9936
10583
  size: query.size ?? quickQuerySize,
@@ -9946,7 +10593,7 @@ function QueryForm({
9946
10593
  )),
9947
10594
  " "
9948
10595
  ] }) : null,
9949
- /* @__PURE__ */ jsxs27(
10596
+ /* @__PURE__ */ jsxs28(
9950
10597
  "div",
9951
10598
  {
9952
10599
  ref: rowRef,
@@ -9955,7 +10602,7 @@ function QueryForm({
9955
10602
  "--sia-query-field-width": typeof fieldWidth === "number" ? `${fieldWidth}px` : fieldWidth
9956
10603
  },
9957
10604
  children: [
9958
- entries.map((entry) => /* @__PURE__ */ jsx29(
10605
+ entries.map((entry) => /* @__PURE__ */ jsx30(
9959
10606
  "div",
9960
10607
  {
9961
10608
  className: "sia-query-form__field",
@@ -9968,9 +10615,9 @@ function QueryForm({
9968
10615
  },
9969
10616
  entry.key
9970
10617
  )),
9971
- /* @__PURE__ */ jsxs27("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
9972
- /* @__PURE__ */ jsxs27(Space.Compact, { children: [
9973
- /* @__PURE__ */ jsx29(
10618
+ /* @__PURE__ */ jsxs28("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
10619
+ /* @__PURE__ */ jsxs28(Space.Compact, { children: [
10620
+ /* @__PURE__ */ jsx30(
9974
10621
  Button,
9975
10622
  {
9976
10623
  type: "submit",
@@ -9980,8 +10627,8 @@ function QueryForm({
9980
10627
  children: searchText
9981
10628
  }
9982
10629
  ),
9983
- /* @__PURE__ */ jsx29(Button, { disabled: busy, onClick: reset, children: resetText }),
9984
- onSaveQuery ? /* @__PURE__ */ jsx29(
10630
+ /* @__PURE__ */ jsx30(Button, { disabled: busy, onClick: reset, children: resetText }),
10631
+ onSaveQuery ? /* @__PURE__ */ jsx30(
9985
10632
  Button,
9986
10633
  {
9987
10634
  disabled: shortcutBusy,
@@ -9996,12 +10643,12 @@ function QueryForm({
9996
10643
  ) : null,
9997
10644
  showSettings ?? settingsRows > 2 ? cloudSettings.control : null
9998
10645
  ] }),
9999
- 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(
10000
10647
  Button,
10001
10648
  {
10002
10649
  variant: "link",
10003
10650
  "aria-expanded": !collapsed,
10004
- icon: /* @__PURE__ */ jsx29(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
10651
+ icon: /* @__PURE__ */ jsx30(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
10005
10652
  iconPosition: "end",
10006
10653
  onClick: () => {
10007
10654
  setInternalCollapsed(!collapsed);
@@ -10016,8 +10663,8 @@ function QueryForm({
10016
10663
  ]
10017
10664
  }
10018
10665
  ),
10019
- savedQueries.length ? /* @__PURE__ */ jsxs27("div", { className: "sia-query-form__saved", "aria-label": "\u5DF2\u4FDD\u5B58\u5FEB\u6377\u67E5\u8BE2", children: [
10020
- 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(
10021
10668
  Tag,
10022
10669
  {
10023
10670
  status: query.status ?? ["processing", "success", "warning", "error"][index % 4],
@@ -10043,11 +10690,11 @@ function QueryForm({
10043
10690
  )),
10044
10691
  " "
10045
10692
  ] }) : null,
10046
- 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
10047
10694
  ]
10048
10695
  }
10049
10696
  ),
10050
- /* @__PURE__ */ jsxs27(
10697
+ /* @__PURE__ */ jsxs28(
10051
10698
  Modal,
10052
10699
  {
10053
10700
  open: saveOpen,
@@ -10059,7 +10706,7 @@ function QueryForm({
10059
10706
  if (!saveLock.current) setSaveOpen(next);
10060
10707
  },
10061
10708
  children: [
10062
- /* @__PURE__ */ jsx29(
10709
+ /* @__PURE__ */ jsx30(
10063
10710
  Input,
10064
10711
  {
10065
10712
  autoFocus: true,
@@ -10078,7 +10725,7 @@ function QueryForm({
10078
10725
  }
10079
10726
  }
10080
10727
  ),
10081
- 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
10082
10729
  ]
10083
10730
  }
10084
10731
  )
@@ -10087,7 +10734,7 @@ function QueryForm({
10087
10734
 
10088
10735
  // src/components/NumberRange.tsx
10089
10736
  import { forwardRef as forwardRef8 } from "react";
10090
- import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
10737
+ import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
10091
10738
  var NumberRange = forwardRef8(function NumberRange2({
10092
10739
  value,
10093
10740
  defaultValue = [null, null],
@@ -10116,7 +10763,7 @@ var NumberRange = forwardRef8(function NumberRange2({
10116
10763
  setValue2(index === 0 ? [next, range[1]] : [range[0], next]);
10117
10764
  }
10118
10765
  const inputProps = { min, max, step, precision, size, status, disabled, readOnly, placeholderMode, controls: false };
10119
- return /* @__PURE__ */ jsxs28(
10766
+ return /* @__PURE__ */ jsxs29(
10120
10767
  "span",
10121
10768
  {
10122
10769
  ...props,
@@ -10125,7 +10772,7 @@ var NumberRange = forwardRef8(function NumberRange2({
10125
10772
  "aria-disabled": disabled || void 0,
10126
10773
  className: `sia-number-range sia-number-range--${size} sia-number-range--${status}${disabled ? " is-disabled" : ""} ${className}`.trim(),
10127
10774
  children: [
10128
- /* @__PURE__ */ jsx30(
10775
+ /* @__PURE__ */ jsx31(
10129
10776
  InputNumber,
10130
10777
  {
10131
10778
  ...inputProps,
@@ -10137,8 +10784,8 @@ var NumberRange = forwardRef8(function NumberRange2({
10137
10784
  onChange: (next) => change(0, next)
10138
10785
  }
10139
10786
  ),
10140
- /* @__PURE__ */ jsx30(Icon, { className: "sia-number-range__separator", name: "tilde", size: 12, strokeWidth: 1.5, "aria-hidden": "true" }),
10141
- /* @__PURE__ */ jsx30(
10787
+ /* @__PURE__ */ jsx31(Icon, { className: "sia-number-range__separator", name: "tilde", size: 12, strokeWidth: 1.5, "aria-hidden": "true" }),
10788
+ /* @__PURE__ */ jsx31(
10142
10789
  InputNumber,
10143
10790
  {
10144
10791
  ...inputProps,
@@ -10150,7 +10797,7 @@ var NumberRange = forwardRef8(function NumberRange2({
10150
10797
  onChange: (next) => change(1, next)
10151
10798
  }
10152
10799
  ),
10153
- 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
10154
10801
  ]
10155
10802
  }
10156
10803
  );
@@ -10303,6 +10950,7 @@ export {
10303
10950
  createSummaryPlugin,
10304
10951
  createToolbarPlugin,
10305
10952
  createTreePlugin,
10953
+ createWorksheetPlugin,
10306
10954
  formatChartNumber,
10307
10955
  getChartMap,
10308
10956
  linearScale,