@sia.soul/sia-react-ui 0.1.44 → 0.1.45

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
@@ -4707,11 +4707,8 @@ function TableCellContent({ children, ellipsis, title }) {
4707
4707
  return /* @__PURE__ */ jsx20("div", { ref, className: "sia-table__cell-content", "data-custom-content": customContent || void 0, "data-content-overflow": ellipsis && customContent && overflowing || void 0, children: title ? /* @__PURE__ */ jsx20(Tooltip, { title, className: "sia-table__cell-tooltip", children: /* @__PURE__ */ jsx20("span", { children }) }) : children });
4708
4708
  }
4709
4709
 
4710
- // src/components/Table/Table.tsx
4711
- import { Fragment as Fragment8, forwardRef as forwardRef5, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as useEffect12, useImperativeHandle, useMemo as useMemo9, useRef as useRef15, useState as useState18 } from "react";
4712
-
4713
- // src/components/Table/plugins.tsx
4714
- import { isValidElement as isValidElement3, useEffect as useEffect11, useRef as useRef14, useState as useState17 } from "react";
4710
+ // src/components/Table/TableCanvasLayer.tsx
4711
+ import { useLayoutEffect as useLayoutEffect3, useRef as useRef14 } from "react";
4715
4712
 
4716
4713
  // src/components/Table/utils.ts
4717
4714
  var AUTO_WIDTH_COLUMN_KEYS = /* @__PURE__ */ new Set(["action", "actions", "operation", "operations"]);
@@ -4763,8 +4760,115 @@ function toTablePageParams(current, pageSize) {
4763
4760
  return { current, pageIndex: current, pageSize, skipCount: Math.max(0, current - 1) * pageSize, maxResultCount: pageSize };
4764
4761
  }
4765
4762
 
4763
+ // src/components/Table/TableCanvasLayer.tsx
4764
+ import { jsx as jsx21 } from "react/jsx-runtime";
4765
+ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHeight }) {
4766
+ const canvasRef = useRef14(null);
4767
+ useLayoutEffect3(() => {
4768
+ const canvas = canvasRef.current;
4769
+ const scroller = viewport.current;
4770
+ if (!canvas || !scroller) return;
4771
+ const ctx = canvas.getContext("2d");
4772
+ if (!ctx) return;
4773
+ let frame = 0;
4774
+ const draw = () => {
4775
+ frame = 0;
4776
+ const width = scroller.clientWidth, height = scroller.clientHeight;
4777
+ const ratio = window.devicePixelRatio || 1;
4778
+ if (canvas.width !== Math.round(width * ratio) || canvas.height !== Math.round(height * ratio)) {
4779
+ canvas.width = Math.round(width * ratio);
4780
+ canvas.height = Math.round(height * ratio);
4781
+ }
4782
+ canvas.style.width = `${width}px`;
4783
+ canvas.style.height = `${height}px`;
4784
+ ctx.setTransform(ratio, 0, 0, ratio, 0, 0);
4785
+ ctx.clearRect(0, 0, width, height);
4786
+ const style = getComputedStyle(scroller);
4787
+ const foreground = style.color;
4788
+ ctx.font = `${style.fontSize} ${style.fontFamily}`;
4789
+ ctx.textBaseline = "middle";
4790
+ const leftWidth = columns.reduce((n, c) => n + (normalizeFixed(c.fixed) === "left" ? widths.get(c.key) ?? 160 : 0), 0);
4791
+ const rightWidth = columns.reduce((n, c) => n + (normalizeFixed(c.fixed) === "right" ? widths.get(c.key) ?? 160 : 0), 0);
4792
+ let offset = 0, fixedLeft = 0, fixedRight = rightWidth;
4793
+ const geometry = columns.map((column) => {
4794
+ const cellWidth = widths.get(column.key) ?? 160;
4795
+ const fixed = normalizeFixed(column.fixed);
4796
+ const x = fixed === "left" ? fixedLeft : fixed === "right" ? width - fixedRight : offset - scroller.scrollLeft;
4797
+ offset += cellWidth;
4798
+ if (fixed === "left") fixedLeft += cellWidth;
4799
+ if (fixed === "right") fixedRight -= cellWidth;
4800
+ return { column, x, cellWidth, fixed };
4801
+ });
4802
+ const first = Math.max(0, Math.floor(scroller.scrollTop / rowHeight));
4803
+ const last = Math.min(rows.length, Math.ceil((scroller.scrollTop + height) / rowHeight));
4804
+ for (const { column, x, cellWidth, fixed } of geometry) {
4805
+ if (x + cellWidth <= 0 || x >= width || !column.canvasRender && column.render) continue;
4806
+ const clipLeft = Math.max(x, fixed ? 0 : leftWidth);
4807
+ const clipRight = Math.min(x + cellWidth, fixed ? width : width - rightWidth);
4808
+ if (clipRight <= clipLeft) continue;
4809
+ ctx.save();
4810
+ ctx.beginPath();
4811
+ ctx.rect(clipLeft, headerHeight, clipRight - clipLeft, height - headerHeight);
4812
+ ctx.clip();
4813
+ for (let index = first; index < last; index++) {
4814
+ const row = rows[index];
4815
+ const value = getTableValue(row.record, column.dataIndex, column.code ?? column.key);
4816
+ const content = column.canvasRender ? column.canvasRender(value, row.record, row.sourceIndex, { row, rowIndex: index, column }) : { text: value == null ? "" : String(value) };
4817
+ if (!content?.text) continue;
4818
+ const y = headerHeight + index * rowHeight - scroller.scrollTop + rowHeight / 2;
4819
+ const available = Math.max(0, cellWidth - (content.background ? 32 : 16));
4820
+ let text = content.text;
4821
+ if (ctx.measureText(text).width > available) {
4822
+ let lo = 0, hi = text.length;
4823
+ while (lo < hi) {
4824
+ const mid = Math.ceil((lo + hi) / 2);
4825
+ if (ctx.measureText(text.slice(0, mid) + "\u2026").width <= available) lo = mid;
4826
+ else hi = mid - 1;
4827
+ }
4828
+ text = text.slice(0, lo) + "\u2026";
4829
+ }
4830
+ const textWidth = ctx.measureText(text).width;
4831
+ const total = textWidth + (content.background ? 16 : 0);
4832
+ const tx = column.align === "right" ? x + cellWidth - total - 8 : column.align === "center" ? x + (cellWidth - total) / 2 : x + 8;
4833
+ if (content.background) {
4834
+ ctx.fillStyle = content.background;
4835
+ ctx.beginPath();
4836
+ ctx.roundRect(tx, y - 12, total, 24, 4);
4837
+ ctx.fill();
4838
+ }
4839
+ ctx.fillStyle = content.color ?? foreground;
4840
+ ctx.fillText(text, tx + (content.background ? 8 : 0), y);
4841
+ }
4842
+ ctx.restore();
4843
+ }
4844
+ };
4845
+ const schedule = () => {
4846
+ if (!frame) frame = requestAnimationFrame(draw);
4847
+ };
4848
+ scroller.addEventListener("scroll", schedule, { passive: true });
4849
+ const resize = new ResizeObserver(schedule);
4850
+ resize.observe(scroller);
4851
+ const theme = new MutationObserver(schedule);
4852
+ theme.observe(document.documentElement, { attributes: true });
4853
+ window.addEventListener("resize", schedule);
4854
+ draw();
4855
+ return () => {
4856
+ cancelAnimationFrame(frame);
4857
+ resize.disconnect();
4858
+ theme.disconnect();
4859
+ scroller.removeEventListener("scroll", schedule);
4860
+ window.removeEventListener("resize", schedule);
4861
+ };
4862
+ }, [viewport, rows, columns, widths, rowHeight, headerHeight]);
4863
+ return /* @__PURE__ */ jsx21("canvas", { ref: canvasRef, "aria-hidden": "true", className: "sia-table__canvas-layer" });
4864
+ }
4865
+
4866
+ // src/components/Table/Table.tsx
4867
+ import { Fragment as Fragment8, forwardRef as forwardRef5, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as useEffect12, useImperativeHandle, useMemo as useMemo9, useRef as useRef16, useState as useState18 } from "react";
4868
+
4766
4869
  // src/components/Table/plugins.tsx
4767
- import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
4870
+ import { isValidElement as isValidElement3, useEffect as useEffect11, useRef as useRef15, useState as useState17 } from "react";
4871
+ import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
4768
4872
  function TableCheckbox({
4769
4873
  checked,
4770
4874
  indeterminate,
@@ -4772,7 +4876,7 @@ function TableCheckbox({
4772
4876
  label,
4773
4877
  onChange
4774
4878
  }) {
4775
- return /* @__PURE__ */ jsx21(
4879
+ return /* @__PURE__ */ jsx22(
4776
4880
  Checkbox,
4777
4881
  {
4778
4882
  className: "sia-table__checkbox",
@@ -4997,6 +5101,7 @@ function createCellSelectionPlugin(options = {}) {
4997
5101
  info
4998
5102
  );
4999
5103
  if (exported !== void 0) return tableExportText(exported);
5104
+ if (column.canvasRender) return column.canvasRender(value, row.record, row.sourceIndex, info)?.text ?? "";
5000
5105
  if (column.editable) return tableExportCell(value, true);
5001
5106
  const rendered = column.render?.(value, row.record, row.sourceIndex, info);
5002
5107
  return rendered !== void 0 ? tableExportText(rendered) : tableExportCell(value, true);
@@ -5399,10 +5504,10 @@ function TableSelectedItemsPanel({
5399
5504
  /* @__PURE__ */ jsxs20("div", { className: "sia-table-selection-panel__header", children: [
5400
5505
  /* @__PURE__ */ jsxs20("strong", { children: [
5401
5506
  "\u5DF2\u9009 ",
5402
- /* @__PURE__ */ jsx21("span", { children: entries.length }),
5507
+ /* @__PURE__ */ jsx22("span", { children: entries.length }),
5403
5508
  " \u9879"
5404
5509
  ] }),
5405
- /* @__PURE__ */ jsx21(
5510
+ /* @__PURE__ */ jsx22(
5406
5511
  Button,
5407
5512
  {
5408
5513
  size: "small",
@@ -5413,15 +5518,15 @@ function TableSelectedItemsPanel({
5413
5518
  }
5414
5519
  )
5415
5520
  ] }),
5416
- /* @__PURE__ */ jsx21("div", { className: "sia-table-selection-panel__body", children: /* @__PURE__ */ jsxs20("table", { children: [
5417
- /* @__PURE__ */ jsx21("thead", { children: /* @__PURE__ */ jsxs20("tr", { children: [
5418
- columns.map((column) => /* @__PURE__ */ jsx21("th", { children: getColumnLabel(column) }, column.key)),
5419
- /* @__PURE__ */ jsx21("th", { "aria-label": "\u64CD\u4F5C" })
5521
+ /* @__PURE__ */ jsx22("div", { className: "sia-table-selection-panel__body", children: /* @__PURE__ */ jsxs20("table", { children: [
5522
+ /* @__PURE__ */ jsx22("thead", { children: /* @__PURE__ */ jsxs20("tr", { children: [
5523
+ columns.map((column) => /* @__PURE__ */ jsx22("th", { children: getColumnLabel(column) }, column.key)),
5524
+ /* @__PURE__ */ jsx22("th", { "aria-label": "\u64CD\u4F5C" })
5420
5525
  ] }) }),
5421
- /* @__PURE__ */ jsx21("tbody", { children: visibleEntries.map((entry, selectedIndex) => /* @__PURE__ */ jsxs20("tr", { children: [
5526
+ /* @__PURE__ */ jsx22("tbody", { children: visibleEntries.map((entry, selectedIndex) => /* @__PURE__ */ jsxs20("tr", { children: [
5422
5527
  columns.map((column) => {
5423
5528
  if (column.meta?.plugin === "index")
5424
- return /* @__PURE__ */ jsx21("td", { children: entry.sourceIndex + 1 }, column.key);
5529
+ return /* @__PURE__ */ jsx22("td", { children: entry.sourceIndex + 1 }, column.key);
5425
5530
  const baseColumn = baseColumnMap.get(column.key) ?? column;
5426
5531
  const value = getTableValue(
5427
5532
  entry.record,
@@ -5441,9 +5546,9 @@ function TableSelectedItemsPanel({
5441
5546
  entry.sourceIndex,
5442
5547
  { row, rowIndex: entry.sourceIndex, column: baseColumn }
5443
5548
  ) ?? value;
5444
- return /* @__PURE__ */ jsx21("td", { children: content }, column.key);
5549
+ return /* @__PURE__ */ jsx22("td", { children: content }, column.key);
5445
5550
  }),
5446
- /* @__PURE__ */ jsx21("td", { children: /* @__PURE__ */ jsx21(
5551
+ /* @__PURE__ */ jsx22("td", { children: /* @__PURE__ */ jsx22(
5447
5552
  Button,
5448
5553
  {
5449
5554
  size: "small",
@@ -5458,7 +5563,7 @@ function TableSelectedItemsPanel({
5458
5563
  "\u8FD8\u6709 ",
5459
5564
  hiddenCount,
5460
5565
  " \u9879\u672A\u5C55\u793A",
5461
- /* @__PURE__ */ jsx21(Button, { size: "small", variant: "link", onClick: () => setShowAll(true), children: "\u5C55\u793A\u5168\u90E8" })
5566
+ /* @__PURE__ */ jsx22(Button, { size: "small", variant: "link", onClick: () => setShowAll(true), children: "\u5C55\u793A\u5168\u90E8" })
5462
5567
  ] }) : null
5463
5568
  ] });
5464
5569
  }
@@ -5573,7 +5678,7 @@ function createSelectionPlugin(options = {}) {
5573
5678
  const keys = selected(context);
5574
5679
  const allChecked = enabledRows.length > 0 && enabledRows.every((row) => keys.includes(row.key));
5575
5680
  const someChecked = enabledRows.some((row) => keys.includes(row.key));
5576
- return /* @__PURE__ */ jsx21(
5681
+ return /* @__PURE__ */ jsx22(
5577
5682
  TableCheckbox,
5578
5683
  {
5579
5684
  label: "\u9009\u62E9\u5F53\u524D\u9875\u5168\u90E8\u884C",
@@ -5589,7 +5694,7 @@ function createSelectionPlugin(options = {}) {
5589
5694
  }
5590
5695
  );
5591
5696
  },
5592
- render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */ jsx21(
5697
+ render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */ jsx22(
5593
5698
  Radio2,
5594
5699
  {
5595
5700
  className: "sia-table__checkbox",
@@ -5600,7 +5705,7 @@ function createSelectionPlugin(options = {}) {
5600
5705
  onClick: (event) => event.stopPropagation(),
5601
5706
  onChange: () => toggle(info.row.key, record, context)
5602
5707
  }
5603
- ) : /* @__PURE__ */ jsx21(
5708
+ ) : /* @__PURE__ */ jsx22(
5604
5709
  TableCheckbox,
5605
5710
  {
5606
5711
  label: `\u9009\u62E9\u7B2C ${info.rowIndex + 1} \u884C`,
@@ -5640,7 +5745,7 @@ function createSelectionPlugin(options = {}) {
5640
5745
  (column) => !column.hidden && column.meta?.plugin !== "selection"
5641
5746
  ).slice(0, Math.max(1, options.selectionPanelColumnCount ?? 4));
5642
5747
  return /* @__PURE__ */ jsxs20("span", { className: "sia-table__selection-footer", children: [
5643
- /* @__PURE__ */ jsx21(
5748
+ /* @__PURE__ */ jsx22(
5644
5749
  Popover,
5645
5750
  {
5646
5751
  placement: "top-start",
@@ -5648,7 +5753,7 @@ function createSelectionPlugin(options = {}) {
5648
5753
  open: context.state.panelOpen && entries.length > 0,
5649
5754
  onOpenChange: (panelOpen) => context.setState((state) => ({ ...state, panelOpen })),
5650
5755
  overlayClassName: "sia-table-selection-popover",
5651
- content: /* @__PURE__ */ jsx21(
5756
+ content: /* @__PURE__ */ jsx22(
5652
5757
  TableSelectedItemsPanel,
5653
5758
  {
5654
5759
  entries,
@@ -5680,7 +5785,7 @@ function createSelectionPlugin(options = {}) {
5680
5785
  )
5681
5786
  }
5682
5787
  ),
5683
- mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */ jsx21(
5788
+ mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */ jsx22(
5684
5789
  Checkbox,
5685
5790
  {
5686
5791
  checked: preserving(context),
@@ -5738,8 +5843,8 @@ function createSortPlugin(options = {}) {
5738
5843
  const order = info?.field === field ? info.order : null;
5739
5844
  const sortHint = `${getColumnLabel(currentColumn)}\uFF1A${order === "ascend" ? "\u5F53\u524D\u5347\u5E8F\uFF0C\u70B9\u51FB\u5207\u6362\u4E3A\u964D\u5E8F" : order === "descend" ? "\u5F53\u524D\u964D\u5E8F\uFF0C\u70B9\u51FB\u53D6\u6D88\u6392\u5E8F" : "\u672A\u6392\u5E8F\uFF0C\u70B9\u51FB\u6309\u5347\u5E8F\u6392\u5E8F"}`;
5740
5845
  return /* @__PURE__ */ jsxs20("span", { className: "sia-table__sortable-header", children: [
5741
- /* @__PURE__ */ jsx21("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
5742
- /* @__PURE__ */ jsx21(
5846
+ /* @__PURE__ */ jsx22("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
5847
+ /* @__PURE__ */ jsx22(
5743
5848
  "button",
5744
5849
  {
5745
5850
  type: "button",
@@ -5751,9 +5856,9 @@ function createSortPlugin(options = {}) {
5751
5856
  event.stopPropagation();
5752
5857
  cycle(field, context);
5753
5858
  },
5754
- children: order ? /* @__PURE__ */ jsx21(Icon, { name: order === "ascend" ? "chevron-up" : "chevron-down", size: 18 }) : /* @__PURE__ */ jsxs20(Fragment7, { children: [
5755
- /* @__PURE__ */ jsx21(Icon, { name: "chevron-up", size: 11 }),
5756
- /* @__PURE__ */ jsx21(Icon, { name: "chevron-down", size: 11 })
5859
+ children: order ? /* @__PURE__ */ jsx22(Icon, { name: order === "ascend" ? "chevron-up" : "chevron-down", size: 18 }) : /* @__PURE__ */ jsxs20(Fragment7, { children: [
5860
+ /* @__PURE__ */ jsx22(Icon, { name: "chevron-up", size: 11 }),
5861
+ /* @__PURE__ */ jsx22(Icon, { name: "chevron-down", size: 11 })
5757
5862
  ] })
5758
5863
  }
5759
5864
  )
@@ -5799,8 +5904,8 @@ function TableFilterControl({
5799
5904
  setOpen(false);
5800
5905
  };
5801
5906
  return /* @__PURE__ */ jsxs20("span", { className: "sia-table__filter-header", children: [
5802
- /* @__PURE__ */ jsx21("span", { children: column.title ?? column.name ?? column.key }),
5803
- /* @__PURE__ */ jsx21(
5907
+ /* @__PURE__ */ jsx22("span", { children: column.title ?? column.name ?? column.key }),
5908
+ /* @__PURE__ */ jsx22(
5804
5909
  Popover,
5805
5910
  {
5806
5911
  open,
@@ -5808,7 +5913,7 @@ function TableFilterControl({
5808
5913
  placement: "bottom-end",
5809
5914
  overlayClassName: "sia-table-filter-popover",
5810
5915
  content: /* @__PURE__ */ jsxs20("div", { className: "sia-table-filter-panel", children: [
5811
- /* @__PURE__ */ jsx21(
5916
+ /* @__PURE__ */ jsx22(
5812
5917
  Input,
5813
5918
  {
5814
5919
  size: "small",
@@ -5823,7 +5928,7 @@ function TableFilterControl({
5823
5928
  }
5824
5929
  ),
5825
5930
  /* @__PURE__ */ jsxs20("div", { className: "sia-table-filter-panel__actions", children: [
5826
- /* @__PURE__ */ jsx21(
5931
+ /* @__PURE__ */ jsx22(
5827
5932
  Button,
5828
5933
  {
5829
5934
  size: "small",
@@ -5835,7 +5940,7 @@ function TableFilterControl({
5835
5940
  children: "\u6E05\u9664"
5836
5941
  }
5837
5942
  ),
5838
- /* @__PURE__ */ jsx21(
5943
+ /* @__PURE__ */ jsx22(
5839
5944
  Button,
5840
5945
  {
5841
5946
  size: "small",
@@ -5846,7 +5951,7 @@ function TableFilterControl({
5846
5951
  )
5847
5952
  ] })
5848
5953
  ] }),
5849
- children: /* @__PURE__ */ jsx21(
5954
+ children: /* @__PURE__ */ jsx22(
5850
5955
  "button",
5851
5956
  {
5852
5957
  type: "button",
@@ -5854,7 +5959,7 @@ function TableFilterControl({
5854
5959
  "aria-label": `\u7B5B\u9009${label}`,
5855
5960
  "aria-pressed": Boolean(value),
5856
5961
  onClick: (event) => event.stopPropagation(),
5857
- children: /* @__PURE__ */ jsx21(Icon, { name: "search", size: 13 })
5962
+ children: /* @__PURE__ */ jsx22(Icon, { name: "search", size: 13 })
5858
5963
  }
5859
5964
  )
5860
5965
  }
@@ -5916,7 +6021,7 @@ function createFilterPlugin(options = {}) {
5916
6021
  title: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title
5917
6022
  };
5918
6023
  const placeholder = typeof options.placeholder === "function" ? options.placeholder(currentColumn) : options.placeholder ?? `\u8F93\u5165${getColumnLabel(currentColumn)}\u7B5B\u9009`;
5919
- return /* @__PURE__ */ jsx21(
6024
+ return /* @__PURE__ */ jsx22(
5920
6025
  TableFilterControl,
5921
6026
  {
5922
6027
  column: renderedColumn,
@@ -6005,7 +6110,7 @@ function createPaginationPlugin(options = {}) {
6005
6110
  const page = currentPage(context);
6006
6111
  const filteredCount = context.getPluginApi("filter")?.getFilteredRows().length;
6007
6112
  const totalRecords = options.totalCount ?? filteredCount ?? context.sourceData.length;
6008
- return /* @__PURE__ */ jsx21(
6113
+ return /* @__PURE__ */ jsx22(
6009
6114
  Pagination,
6010
6115
  {
6011
6116
  className: "sia-table__pagination",
@@ -6146,7 +6251,7 @@ function createTreePlugin(options = {}) {
6146
6251
  className: "sia-table__tree-cell",
6147
6252
  style: { paddingLeft: info.row.depth * 18 },
6148
6253
  children: [
6149
- info.row.meta.treeHasChildren ? /* @__PURE__ */ jsx21(
6254
+ info.row.meta.treeHasChildren ? /* @__PURE__ */ jsx22(
6150
6255
  "button",
6151
6256
  {
6152
6257
  type: "button",
@@ -6157,7 +6262,7 @@ function createTreePlugin(options = {}) {
6157
6262
  event.stopPropagation();
6158
6263
  toggle(info.row.key, context);
6159
6264
  },
6160
- children: /* @__PURE__ */ jsx21(
6265
+ children: /* @__PURE__ */ jsx22(
6161
6266
  Icon,
6162
6267
  {
6163
6268
  name: current(context).includes(info.row.key) ? "chevron-down" : "chevron-right",
@@ -6165,7 +6270,7 @@ function createTreePlugin(options = {}) {
6165
6270
  }
6166
6271
  )
6167
6272
  }
6168
- ) : /* @__PURE__ */ jsx21("span", { className: "sia-table__tree-placeholder" }),
6273
+ ) : /* @__PURE__ */ jsx22("span", { className: "sia-table__tree-placeholder" }),
6169
6274
  previousRender ? previousRender(value, record, index, info) : value
6170
6275
  ]
6171
6276
  }
@@ -6218,11 +6323,11 @@ function EditableTableCell({
6218
6323
  const config = typeof editable === "object" ? editable : { type: "input" };
6219
6324
  const [editValue, setEditValue] = useState17(value);
6220
6325
  const [saving, setSaving] = useState17(false);
6221
- const inputRef = useRef14(null);
6222
- const editorRef = useRef14(null);
6223
- const editValueRef = useRef14(value);
6224
- const savingRef = useRef14(false);
6225
- const saveRef = useRef14(
6326
+ const inputRef = useRef15(null);
6327
+ const editorRef = useRef15(null);
6328
+ const editValueRef = useRef15(value);
6329
+ const savingRef = useRef15(false);
6330
+ const saveRef = useRef15(
6226
6331
  async () => {
6227
6332
  }
6228
6333
  );
@@ -6280,8 +6385,8 @@ function EditableTableCell({
6280
6385
  onClick: trigger === "click" ? onStart : void 0,
6281
6386
  onDoubleClick: trigger === "doubleClick" ? onStart : void 0,
6282
6387
  children: [
6283
- /* @__PURE__ */ jsx21("span", { children: content }),
6284
- /* @__PURE__ */ jsx21(Icon, { name: "edit", size: 13 })
6388
+ /* @__PURE__ */ jsx22("span", { children: content }),
6389
+ /* @__PURE__ */ jsx22(Icon, { name: "edit", size: 13 })
6285
6390
  ]
6286
6391
  }
6287
6392
  );
@@ -6289,7 +6394,7 @@ function EditableTableCell({
6289
6394
  if (config.type === "custom" && config.editRender) {
6290
6395
  editor = config.editRender(record, (next) => void save(next), onCancel);
6291
6396
  } else if (config.type === "inputNumber") {
6292
- editor = /* @__PURE__ */ jsx21(
6397
+ editor = /* @__PURE__ */ jsx22(
6293
6398
  InputNumber,
6294
6399
  {
6295
6400
  ref: inputRef,
@@ -6310,7 +6415,7 @@ function EditableTableCell({
6310
6415
  }
6311
6416
  );
6312
6417
  } else if (config.type === "select") {
6313
- editor = /* @__PURE__ */ jsx21(
6418
+ editor = /* @__PURE__ */ jsx22(
6314
6419
  Select,
6315
6420
  {
6316
6421
  size: "small",
@@ -6324,14 +6429,14 @@ function EditableTableCell({
6324
6429
  }
6325
6430
  );
6326
6431
  } else {
6327
- editor = /* @__PURE__ */ jsx21(
6432
+ editor = /* @__PURE__ */ jsx22(
6328
6433
  Input,
6329
6434
  {
6330
6435
  ref: inputRef,
6331
6436
  size: "small",
6332
6437
  value: String(editValue ?? ""),
6333
6438
  disabled: saving,
6334
- suffix: saving ? /* @__PURE__ */ jsx21(Icon, { name: "loader", size: 13, spin: true }) : null,
6439
+ suffix: saving ? /* @__PURE__ */ jsx22(Icon, { name: "loader", size: 13, spin: true }) : null,
6335
6440
  onChange: (event) => updateEditValue(event.target.value),
6336
6441
  onBlur: () => void save(),
6337
6442
  onKeyDown: (event) => {
@@ -6341,7 +6446,7 @@ function EditableTableCell({
6341
6446
  }
6342
6447
  );
6343
6448
  }
6344
- return /* @__PURE__ */ jsx21("div", { ref: editorRef, className: "sia-table__editor", children: editor });
6449
+ return /* @__PURE__ */ jsx22("div", { ref: editorRef, className: "sia-table__editor", children: editor });
6345
6450
  }
6346
6451
  function createEditablePlugin(options = {}) {
6347
6452
  const trigger = options.trigger ?? "click";
@@ -6361,7 +6466,7 @@ function createEditablePlugin(options = {}) {
6361
6466
  const active = canEdit && context.state.editing?.rowKey === info.row.key && context.state.editing.columnKey === column.key;
6362
6467
  const content = previousRender ? previousRender(value, record, index, info) : value;
6363
6468
  if (!canEdit) return content;
6364
- return /* @__PURE__ */ jsx21(
6469
+ return /* @__PURE__ */ jsx22(
6365
6470
  EditableTableCell,
6366
6471
  {
6367
6472
  active,
@@ -6425,8 +6530,8 @@ function createResizePlugin(options = {}) {
6425
6530
  autoWidth,
6426
6531
  width,
6427
6532
  renderHeader: (currentColumn, coreContext) => /* @__PURE__ */ jsxs20("span", { className: "sia-table__resizable-header", children: [
6428
- /* @__PURE__ */ jsx21("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
6429
- /* @__PURE__ */ jsx21(
6533
+ /* @__PURE__ */ jsx22("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
6534
+ /* @__PURE__ */ jsx22(
6430
6535
  "span",
6431
6536
  {
6432
6537
  className: "sia-table__resize-handle",
@@ -6563,8 +6668,8 @@ function ColumnSettingPanel({
6563
6668
  onApply
6564
6669
  }) {
6565
6670
  const [draft, setDraft] = useState17(items);
6566
- const listRef = useRef14(null);
6567
- const cancelDrag = useRef14(null);
6671
+ const listRef = useRef15(null);
6672
+ const cancelDrag = useRef15(null);
6568
6673
  const [preview, setPreview] = useState17(null);
6569
6674
  useEffect11(() => {
6570
6675
  cancelDrag.current?.();
@@ -6707,8 +6812,8 @@ function ColumnSettingPanel({
6707
6812
  if (!next) onClose();
6708
6813
  },
6709
6814
  footer: /* @__PURE__ */ jsxs20(Fragment7, { children: [
6710
- /* @__PURE__ */ jsx21(Button, { onClick: onClose, children: "\u53D6\u6D88" }),
6711
- /* @__PURE__ */ jsx21(
6815
+ /* @__PURE__ */ jsx22(Button, { onClick: onClose, children: "\u53D6\u6D88" }),
6816
+ /* @__PURE__ */ jsx22(
6712
6817
  Button,
6713
6818
  {
6714
6819
  variant: "primary",
@@ -6721,9 +6826,9 @@ function ColumnSettingPanel({
6721
6826
  children: [
6722
6827
  loadError ? /* @__PURE__ */ jsxs20("p", { role: "alert", children: [
6723
6828
  "\u8BFB\u53D6\u5217\u914D\u7F6E\u5931\u8D25\u3002",
6724
- /* @__PURE__ */ jsx21(Button, { variant: "link", onClick: onRetry, children: "\u91CD\u8BD5" })
6829
+ /* @__PURE__ */ jsx22(Button, { variant: "link", onClick: onRetry, children: "\u91CD\u8BD5" })
6725
6830
  ] }) : null,
6726
- /* @__PURE__ */ jsx21(Spin, { spinning: Boolean(loading), className: "sia-table-settings__loading", "aria-label": loading ? "\u6B63\u5728\u8BFB\u53D6\u5217\u914D\u7F6E" : void 0, children: /* @__PURE__ */ jsxs20(
6831
+ /* @__PURE__ */ jsx22(Spin, { spinning: Boolean(loading), className: "sia-table-settings__loading", "aria-label": loading ? "\u6B63\u5728\u8BFB\u53D6\u5217\u914D\u7F6E" : void 0, children: /* @__PURE__ */ jsxs20(
6727
6832
  "fieldset",
6728
6833
  {
6729
6834
  disabled: loading || loadError,
@@ -6731,7 +6836,7 @@ function ColumnSettingPanel({
6731
6836
  "aria-busy": loading,
6732
6837
  children: [
6733
6838
  /* @__PURE__ */ jsxs20("label", { className: "sia-table-settings__all", children: [
6734
- /* @__PURE__ */ jsx21(
6839
+ /* @__PURE__ */ jsx22(
6735
6840
  TableCheckbox,
6736
6841
  {
6737
6842
  label: "\u5168\u9009\u5217",
@@ -6750,7 +6855,7 @@ function ColumnSettingPanel({
6750
6855
  "\uFF09"
6751
6856
  ] })
6752
6857
  ] }),
6753
- /* @__PURE__ */ jsx21(
6858
+ /* @__PURE__ */ jsx22(
6754
6859
  "div",
6755
6860
  {
6756
6861
  ref: listRef,
@@ -6765,8 +6870,8 @@ function ColumnSettingPanel({
6765
6870
  } : void 0,
6766
6871
  onPointerDown: (event) => startSort(event, item.key),
6767
6872
  children: [
6768
- /* @__PURE__ */ jsx21(Icon, { name: "menu", size: 15 }),
6769
- /* @__PURE__ */ jsx21(
6873
+ /* @__PURE__ */ jsx22(Icon, { name: "menu", size: 15 }),
6874
+ /* @__PURE__ */ jsx22(
6770
6875
  TableCheckbox,
6771
6876
  {
6772
6877
  label: `\u663E\u793A${labels.get(item.key) ?? item.key}\u5217`,
@@ -6778,7 +6883,7 @@ function ColumnSettingPanel({
6778
6883
  )
6779
6884
  }
6780
6885
  ),
6781
- /* @__PURE__ */ jsx21(
6886
+ /* @__PURE__ */ jsx22(
6782
6887
  "span",
6783
6888
  {
6784
6889
  className: "sia-table-settings__name",
@@ -6786,7 +6891,7 @@ function ColumnSettingPanel({
6786
6891
  }
6787
6892
  ),
6788
6893
  /* @__PURE__ */ jsxs20("div", { className: "sia-table-settings__actions", children: [
6789
- /* @__PURE__ */ jsx21(
6894
+ /* @__PURE__ */ jsx22(
6790
6895
  Button,
6791
6896
  {
6792
6897
  size: "small",
@@ -6799,7 +6904,7 @@ function ColumnSettingPanel({
6799
6904
  children: "\u5DE6"
6800
6905
  }
6801
6906
  ),
6802
- /* @__PURE__ */ jsx21(
6907
+ /* @__PURE__ */ jsx22(
6803
6908
  Button,
6804
6909
  {
6805
6910
  size: "small",
@@ -6947,7 +7052,7 @@ function createColumnSettingPlugin(options = {}) {
6947
7052
  {
6948
7053
  key: "builtin:export",
6949
7054
  label: "\u8868\u683C\u5BFC\u51FA",
6950
- icon: /* @__PURE__ */ jsx21(Icon, { name: "download", size: 18 }),
7055
+ icon: /* @__PURE__ */ jsx22(Icon, { name: "download", size: 18 }),
6951
7056
  disabled: exportApi().getRows().length === 0
6952
7057
  },
6953
7058
  { key: "builtin:divider", type: "divider" }
@@ -6955,7 +7060,7 @@ function createColumnSettingPlugin(options = {}) {
6955
7060
  {
6956
7061
  key: "builtin:columns",
6957
7062
  label: "\u5217\u8BBE\u7F6E",
6958
- icon: /* @__PURE__ */ jsx21(Icon, { name: "settings", size: 18 })
7063
+ icon: /* @__PURE__ */ jsx22(Icon, { name: "settings", size: 18 })
6959
7064
  },
6960
7065
  ...customItems.map((item) => ({
6961
7066
  key: "custom:" + item.key,
@@ -6965,7 +7070,7 @@ function createColumnSettingPlugin(options = {}) {
6965
7070
  disabled: item.disabled === true || typeof item.disabled === "function" && item.disabled(context)
6966
7071
  }))
6967
7072
  ];
6968
- return /* @__PURE__ */ jsx21(
7073
+ return /* @__PURE__ */ jsx22(
6969
7074
  Dropdown,
6970
7075
  {
6971
7076
  disabled: options.buttonProps?.disabled || options.buttonProps?.loading,
@@ -6982,12 +7087,12 @@ function createColumnSettingPlugin(options = {}) {
6982
7087
  void customItems.find((item) => "custom:" + item.key === key)?.onClick?.(context);
6983
7088
  }
6984
7089
  },
6985
- children: /* @__PURE__ */ jsx21(
7090
+ children: /* @__PURE__ */ jsx22(
6986
7091
  Button,
6987
7092
  {
6988
7093
  size: "small",
6989
7094
  variant: "text",
6990
- icon: /* @__PURE__ */ jsx21(Icon, { name: "settings", size: 16 }),
7095
+ icon: /* @__PURE__ */ jsx22(Icon, { name: "settings", size: 16 }),
6991
7096
  "aria-label": "\u8868\u683C\u8BBE\u7F6E",
6992
7097
  ...options.buttonProps,
6993
7098
  className: `sia-table__settings-button${options.buttonProps?.children == null ? " sia-table__toolbar-icon" : ""} ${options.buttonProps?.className ?? ""}`.trim()
@@ -6996,7 +7101,7 @@ function createColumnSettingPlugin(options = {}) {
6996
7101
  }
6997
7102
  );
6998
7103
  },
6999
- renderOverlay: (context) => /* @__PURE__ */ jsx21(
7104
+ renderOverlay: (context) => /* @__PURE__ */ jsx22(
7000
7105
  ColumnSettingPanel,
7001
7106
  {
7002
7107
  open: context.state.open,
@@ -7046,11 +7151,11 @@ function ToolbarItems({
7046
7151
  items,
7047
7152
  context
7048
7153
  }) {
7049
- return /* @__PURE__ */ jsx21(Fragment7, { children: items.map((item) => {
7154
+ return /* @__PURE__ */ jsx22(Fragment7, { children: items.map((item) => {
7050
7155
  if (item.hidden === true || typeof item.hidden === "function" && item.hidden(context))
7051
7156
  return null;
7052
7157
  const disabled = item.disabled === true || typeof item.disabled === "function" && item.disabled(context);
7053
- return /* @__PURE__ */ jsx21(
7158
+ return /* @__PURE__ */ jsx22(
7054
7159
  Button,
7055
7160
  {
7056
7161
  size: "small",
@@ -7074,14 +7179,14 @@ function createToolbarPlugin(options) {
7074
7179
  order: 5,
7075
7180
  renderToolbarStart: (context) => /* @__PURE__ */ jsxs20(Fragment7, { children: [
7076
7181
  options.start,
7077
- /* @__PURE__ */ jsx21(ToolbarItems, { items: items("start"), context })
7182
+ /* @__PURE__ */ jsx22(ToolbarItems, { items: items("start"), context })
7078
7183
  ] }),
7079
7184
  renderToolbarEnd: (context) => /* @__PURE__ */ jsxs20(Fragment7, { children: [
7080
7185
  options.end,
7081
- /* @__PURE__ */ jsx21(ToolbarItems, { items: items("end"), context }),
7186
+ /* @__PURE__ */ jsx22(ToolbarItems, { items: items("end"), context }),
7082
7187
  items("end", true).length > 0 ? /* @__PURE__ */ jsxs20("details", { className: "sia-table__toolbar-menu", children: [
7083
- /* @__PURE__ */ jsx21("summary", { "aria-label": "\u66F4\u591A\u8868\u683C\u64CD\u4F5C", children: /* @__PURE__ */ jsx21(Icon, { name: "more-horizontal", size: 16 }) }),
7084
- /* @__PURE__ */ jsx21("div", { children: /* @__PURE__ */ jsx21(ToolbarItems, { items: items("end", true), context }) })
7188
+ /* @__PURE__ */ jsx22("summary", { "aria-label": "\u66F4\u591A\u8868\u683C\u64CD\u4F5C", children: /* @__PURE__ */ jsx22(Icon, { name: "more-horizontal", size: 16 }) }),
7189
+ /* @__PURE__ */ jsx22("div", { children: /* @__PURE__ */ jsx22(ToolbarItems, { items: items("end", true), context }) })
7085
7190
  ] }) : null
7086
7191
  ] })
7087
7192
  };
@@ -7163,11 +7268,11 @@ function createExportPlugin(options = {}) {
7163
7268
  return {
7164
7269
  id: "export",
7165
7270
  order: 95,
7166
- renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */ jsx21(
7271
+ renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */ jsx22(
7167
7272
  Button,
7168
7273
  {
7169
7274
  size: "small",
7170
- icon: /* @__PURE__ */ jsx21(Icon, { name: "download", size: 14 }),
7275
+ icon: /* @__PURE__ */ jsx22(Icon, { name: "download", size: 14 }),
7171
7276
  disabled: getRows(context).length === 0,
7172
7277
  onClick: () => void download(context),
7173
7278
  children: options.buttonLabel ?? "\u5BFC\u51FA"
@@ -7182,7 +7287,7 @@ function createExportPlugin(options = {}) {
7182
7287
  }
7183
7288
 
7184
7289
  // src/components/Table/Table.tsx
7185
- import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
7290
+ import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
7186
7291
  var EMPTY_DATA = [];
7187
7292
  var EMPTY_COLUMNS = [];
7188
7293
  var EMPTY_PLUGINS = [];
@@ -7272,6 +7377,8 @@ function getTableHorizontalMetrics(viewport, table) {
7272
7377
  return { contentWidth, maxLeft: Math.max(0, contentWidth - viewport.clientWidth) };
7273
7378
  }
7274
7379
  var TableBodyRow = memo(function TableBodyRow2({
7380
+ canvas,
7381
+ visibleColumns,
7275
7382
  row,
7276
7383
  rowIndex,
7277
7384
  columns,
@@ -7294,7 +7401,7 @@ var TableBodyRow = memo(function TableBodyRow2({
7294
7401
  onCellPointerDown,
7295
7402
  onCellPointerMove
7296
7403
  }) {
7297
- return /* @__PURE__ */ jsx22(
7404
+ return /* @__PURE__ */ jsx23(
7298
7405
  "tr",
7299
7406
  {
7300
7407
  className: `sia-table__row${striped && rowIndex % 2 === 1 ? " sia-table__row--striped" : ""} ${className}`.trim(),
@@ -7303,7 +7410,13 @@ var TableBodyRow = memo(function TableBodyRow2({
7303
7410
  onDoubleClick,
7304
7411
  onMouseEnter,
7305
7412
  onMouseLeave,
7306
- children: columns.map((column) => {
7413
+ children: columns.map((column, columnIndex) => {
7414
+ if (canvas && !visibleColumns.has(column.key)) {
7415
+ if (columnIndex > 0 && !visibleColumns.has(columns[columnIndex - 1].key)) return null;
7416
+ let count = 1;
7417
+ while (columnIndex + count < columns.length && !visibleColumns.has(columns[columnIndex + count].key)) count++;
7418
+ return /* @__PURE__ */ jsx23("td", { colSpan: count, "aria-hidden": "true", style: { padding: 0 } }, `spacer-${column.key}`);
7419
+ }
7307
7420
  const pluginCellProps = getCellProps(column);
7308
7421
  if (pluginCellProps.hidden) return null;
7309
7422
  const value = getTableValue(row.record, column.dataIndex, column.code ?? column.key);
@@ -7312,10 +7425,11 @@ var TableBodyRow = memo(function TableBodyRow2({
7312
7425
  const fixedStyle = fixed === "left" ? { left: leftOffsets.get(column.key) } : fixed === "right" ? { right: rightOffsets.get(column.key) } : void 0;
7313
7426
  const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
7314
7427
  const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
7315
- return /* @__PURE__ */ jsx22(
7428
+ return /* @__PURE__ */ jsx23(
7316
7429
  "td",
7317
7430
  {
7318
7431
  "data-column-key": column.key,
7432
+ "aria-label": canvas ? column.canvasRender?.(value, row.record, row.sourceIndex, { row, rowIndex, column })?.text ?? (value == null ? "" : String(value)) : void 0,
7319
7433
  rowSpan: pluginCellProps.rowSpan,
7320
7434
  colSpan: pluginCellProps.colSpan,
7321
7435
  className: `sia-table__cell sia-table__cell--${column.align ?? "left"}${fixed ? ` sia-table__cell--fixed sia-table__cell--fixed-${fixed}` : ""}${fixedEdgeClass}${autoWidthClass}${column.ellipsis !== false ? " sia-table__cell--ellipsis" : ""} ${cellClass} ${pluginCellProps.className ?? ""}`.trim(),
@@ -7326,14 +7440,14 @@ var TableBodyRow = memo(function TableBodyRow2({
7326
7440
  onContextMenu: (event) => onCellContextMenu(column, event),
7327
7441
  onPointerDown: (event) => onCellPointerDown(column, event),
7328
7442
  onPointerMove: (event) => onCellPointerMove(column, event),
7329
- children: /* @__PURE__ */ jsx22(
7443
+ children: !canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? /* @__PURE__ */ jsx23(
7330
7444
  TableCellContent,
7331
7445
  {
7332
7446
  ellipsis: column.ellipsis !== false,
7333
7447
  title: column.showTitle === true && column.ellipsis !== false && typeof value === "string" ? value : void 0,
7334
7448
  children: pluginCellProps.content !== void 0 ? pluginCellProps.content : column.render ? column.render(value, row.record, row.sourceIndex, { row, rowIndex, column }) : value
7335
7449
  }
7336
- )
7450
+ ) : null
7337
7451
  },
7338
7452
  column.key
7339
7453
  );
@@ -7358,6 +7472,7 @@ function TableInner(props, ref) {
7358
7472
  toolbarBordered = false,
7359
7473
  striped = true,
7360
7474
  virtual,
7475
+ renderMode = "dom",
7361
7476
  virtualThreshold = 100,
7362
7477
  rowHeight = SIZE_ROW_HEIGHT[size],
7363
7478
  overscan = 6,
@@ -7374,13 +7489,14 @@ function TableInner(props, ref) {
7374
7489
  style,
7375
7490
  ...htmlProps
7376
7491
  } = props;
7377
- const rootRef = useRef15(null);
7378
- const scrollRef = useRef15(null);
7379
- const tableRef = useRef15(null);
7492
+ const rootRef = useRef16(null);
7493
+ const scrollRef = useRef16(null);
7494
+ const tableRef = useRef16(null);
7380
7495
  useScrollbarProximity();
7381
- const scrollbarDragRef = useRef15(null);
7496
+ const scrollbarDragRef = useRef16(null);
7382
7497
  const [internalLoading, setInternalLoading] = useState18(false);
7383
7498
  const [scrollTop, setScrollTop] = useState18(0);
7499
+ const [scrollLeft, setScrollLeft] = useState18(0);
7384
7500
  const [viewportHeight, setViewportHeight] = useState18(420);
7385
7501
  const [viewportWidth, setViewportWidth] = useState18(0);
7386
7502
  const [autoColumnWidths, setAutoColumnWidths] = useState18({});
@@ -7398,14 +7514,14 @@ function TableInner(props, ref) {
7398
7514
  return plugins;
7399
7515
  }, [builtInHighlightPlugin, builtInResizePlugin, builtInCellSelectionPlugin, builtInIndexPlugin, providedPlugins, resizable, cellSelection, showIndex]);
7400
7516
  const sortedPlugins = useMemo9(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
7401
- const pluginsByIdRef = useRef15(/* @__PURE__ */ new Map());
7517
+ const pluginsByIdRef = useRef16(/* @__PURE__ */ new Map());
7402
7518
  pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
7403
7519
  const [pluginStates, setPluginStates] = useState18(() => Object.fromEntries(
7404
7520
  sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
7405
7521
  ));
7406
- const pluginApisRef = useRef15({});
7407
- const contextsRef = useRef15(/* @__PURE__ */ new Map());
7408
- const mountedPluginsRef = useRef15(/* @__PURE__ */ new Map());
7522
+ const pluginApisRef = useRef16({});
7523
+ const contextsRef = useRef16(/* @__PURE__ */ new Map());
7524
+ const mountedPluginsRef = useRef16(/* @__PURE__ */ new Map());
7409
7525
  const pipeline = { columns: baseColumns, rows: createTableRows(dataSource, getRowKey) };
7410
7526
  const nextApis = {};
7411
7527
  const contexts = /* @__PURE__ */ new Map();
@@ -7537,7 +7653,7 @@ function TableInner(props, ref) {
7537
7653
  const orderedColumns = useMemo9(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
7538
7654
  const leafColumns = useMemo9(() => flattenTableColumns(orderedColumns), [orderedColumns]);
7539
7655
  const headerRows = useMemo9(() => buildHeaderRows(orderedColumns), [orderedColumns]);
7540
- const measuredCells = useRef15(/* @__PURE__ */ new WeakSet());
7656
+ const measuredCells = useRef16(/* @__PURE__ */ new WeakSet());
7541
7657
  const autoWidthSignature = leafColumns.map((column) => `${column.key}:${column.autoWidth}:${resizedWidths[column.key] ?? ""}`).join("|");
7542
7658
  useEffect12(() => {
7543
7659
  measuredCells.current = /* @__PURE__ */ new WeakSet();
@@ -7612,11 +7728,19 @@ function TableInner(props, ref) {
7612
7728
  }
7613
7729
  const leftFixedEdgeKey = [...leafColumns].reverse().find((column) => normalizeFixed(column.fixed) === "left")?.key;
7614
7730
  const rightFixedEdgeKey = leafColumns.find((column) => normalizeFixed(column.fixed) === "right")?.key;
7615
- const shouldVirtualize = (virtual ?? pipeline.rows.length >= virtualThreshold) && !sortedPlugins.some((plugin) => plugin.disableVirtual);
7731
+ const canvas = renderMode === "canvas" && !sortedPlugins.some((plugin) => plugin.disableVirtual);
7732
+ const shouldVirtualize = canvas || pipeline.rows.length > 100 || (virtual ?? pipeline.rows.length >= virtualThreshold) && !sortedPlugins.some((plugin) => plugin.disableVirtual);
7616
7733
  const startIndex = shouldVirtualize ? Math.max(0, Math.floor(scrollTop / rowHeight) - overscan) : 0;
7617
7734
  const visibleCount = shouldVirtualize ? Math.ceil(viewportHeight / rowHeight) + overscan * 2 : pipeline.rows.length;
7618
7735
  const endIndex = shouldVirtualize ? Math.min(pipeline.rows.length, startIndex + visibleCount) : pipeline.rows.length;
7619
7736
  const renderedRows = pipeline.rows.slice(startIndex, endIndex);
7737
+ const visibleColumns = /* @__PURE__ */ new Set();
7738
+ let columnLeft = 0;
7739
+ for (const column of leafColumns) {
7740
+ const width = columnWidths.get(column.key) ?? DEFAULT_WIDTH;
7741
+ if (normalizeFixed(column.fixed) || columnLeft + width >= scrollLeft && columnLeft <= scrollLeft + viewportWidth) visibleColumns.add(column.key);
7742
+ columnLeft += width;
7743
+ }
7620
7744
  const topSpacer = shouldVirtualize ? startIndex * rowHeight : 0;
7621
7745
  const bottomSpacer = shouldVirtualize ? Math.max(0, (pipeline.rows.length - endIndex) * rowHeight) : 0;
7622
7746
  const rowElements = useMemo9(() => /* @__PURE__ */ new Map(), [
@@ -7630,26 +7754,28 @@ function TableInner(props, ref) {
7630
7754
  striped,
7631
7755
  rowClassName,
7632
7756
  getRowKey,
7757
+ canvas,
7758
+ scrollLeft,
7633
7759
  onRowClick,
7634
7760
  onRowDoubleClick,
7635
7761
  onCellContextMenu
7636
7762
  ]);
7637
7763
  const toolbarStart = sortedPlugins.map((plugin) => {
7638
7764
  const content = plugin.renderToolbarStart?.(getContext(plugin));
7639
- return content ? /* @__PURE__ */ jsx22(Fragment8, { children: content }, `toolbar-start-${plugin.id}`) : null;
7765
+ return content ? /* @__PURE__ */ jsx23(Fragment8, { children: content }, `toolbar-start-${plugin.id}`) : null;
7640
7766
  }).filter(Boolean);
7641
7767
  const toolbarEnd = sortedPlugins.map((plugin) => {
7642
7768
  const content = plugin.renderToolbarEnd?.(getContext(plugin));
7643
- return content ? /* @__PURE__ */ jsx22(Fragment8, { children: content }, `toolbar-end-${plugin.id}`) : null;
7769
+ return content ? /* @__PURE__ */ jsx23(Fragment8, { children: content }, `toolbar-end-${plugin.id}`) : null;
7644
7770
  }).filter(Boolean);
7645
7771
  const summaries = sortedPlugins.flatMap((plugin) => plugin.renderSummary?.(getContext(plugin)) ?? []);
7646
7772
  const footers = sortedPlugins.map((plugin) => {
7647
7773
  const content = plugin.renderFooter?.(getContext(plugin));
7648
- return content ? /* @__PURE__ */ jsx22(Fragment8, { children: content }, `footer-${plugin.id}`) : null;
7774
+ return content ? /* @__PURE__ */ jsx23(Fragment8, { children: content }, `footer-${plugin.id}`) : null;
7649
7775
  }).filter(Boolean);
7650
7776
  const overlays = sortedPlugins.map((plugin) => {
7651
7777
  const content = plugin.renderOverlay?.(getContext(plugin));
7652
- return content ? /* @__PURE__ */ jsx22(Fragment8, { children: content }, `overlay-${plugin.id}`) : null;
7778
+ return content ? /* @__PURE__ */ jsx23(Fragment8, { children: content }, `overlay-${plugin.id}`) : null;
7653
7779
  }).filter(Boolean);
7654
7780
  const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
7655
7781
  const effectiveHeight = height ?? tableHeight ?? (shouldVirtualize ? 420 : void 0);
@@ -7661,8 +7787,9 @@ function TableInner(props, ref) {
7661
7787
  const handleScroll = useCallback2((event) => {
7662
7788
  const element = event.currentTarget;
7663
7789
  if (shouldVirtualize) setScrollTop((previous) => Math.floor(previous / rowHeight) === Math.floor(element.scrollTop / rowHeight) ? previous : element.scrollTop);
7790
+ if (canvas) setScrollLeft(element.scrollLeft);
7664
7791
  updateScrollMetrics();
7665
- }, [shouldVirtualize, rowHeight, updateScrollMetrics]);
7792
+ }, [canvas, shouldVirtualize, rowHeight, updateScrollMetrics]);
7666
7793
  const handleScrollbarPointerDown = useCallback2((axis, event, track = event.currentTarget) => {
7667
7794
  const element = scrollRef.current;
7668
7795
  const thumb = track.firstElementChild;
@@ -7746,8 +7873,8 @@ function TableInner(props, ref) {
7746
7873
  function renderHeaderContent(column, content) {
7747
7874
  const title = getHeaderTitleText(column.title ?? column.name) || column.name || column.key;
7748
7875
  return /* @__PURE__ */ jsxs21("span", { className: "sia-table__header-label", children: [
7749
- /* @__PURE__ */ jsx22("span", { className: "sia-table__header-label-content", ...withTitleTooltip({ title }), children: content }),
7750
- column.description != null && /* @__PURE__ */ jsx22(Tooltip, { title: column.description, placement: "top", trigger: ["hover", "focus"], children: /* @__PURE__ */ jsx22("button", { type: "button", className: "sia-table__header-description", "aria-label": `${column.name ?? column.key}\u5217\u8BF4\u660E`, onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx22(Icon, { name: "info", size: 14 }) }) })
7876
+ /* @__PURE__ */ jsx23("span", { className: "sia-table__header-label-content", ...withTitleTooltip({ title }), children: content }),
7877
+ column.description != null && /* @__PURE__ */ jsx23(Tooltip, { title: column.description, placement: "top", trigger: ["hover", "focus"], children: /* @__PURE__ */ jsx23("button", { type: "button", className: "sia-table__header-description", "aria-label": `${column.name ?? column.key}\u5217\u8BF4\u660E`, onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx23(Icon, { name: "info", size: 14 }) }) })
7751
7878
  ] });
7752
7879
  }
7753
7880
  function getPluginCellProps(row, column) {
@@ -7787,14 +7914,14 @@ function TableInner(props, ref) {
7787
7914
  }
7788
7915
  function renderSummaryRow(summary) {
7789
7916
  let labelRendered = false;
7790
- return /* @__PURE__ */ jsx22("tr", { className: `sia-table__summary-row ${summary.className ?? ""}`.trim(), children: leafColumns.map((column) => {
7917
+ return /* @__PURE__ */ jsx23("tr", { className: `sia-table__summary-row ${summary.className ?? ""}`.trim(), children: leafColumns.map((column) => {
7791
7918
  const value = summary.values[column.key];
7792
7919
  const isLabel = value === void 0 && !labelRendered && summary.label !== void 0;
7793
7920
  const content = value !== void 0 ? value : isLabel ? (labelRendered = true, summary.label) : null;
7794
7921
  const fixed = normalizeFixed(column.fixed);
7795
7922
  const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
7796
7923
  const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
7797
- return /* @__PURE__ */ jsx22("td", { "data-column-key": column.key, className: `sia-table__cell sia-table__cell--${column.align ?? "left"} sia-table__summary-cell${isLabel ? " sia-table__summary-cell--label" : ""}${fixed ? ` sia-table__cell--fixed sia-table__cell--fixed-${fixed}` : ""}${fixedEdgeClass}${autoWidthClass}`, style: getFixedStyle(column), children: isLabel ? /* @__PURE__ */ jsx22("span", { className: "sia-table__summary-label", children: content }) : content }, column.key);
7924
+ return /* @__PURE__ */ jsx23("td", { "data-column-key": column.key, className: `sia-table__cell sia-table__cell--${column.align ?? "left"} sia-table__summary-cell${isLabel ? " sia-table__summary-cell--label" : ""}${fixed ? ` sia-table__cell--fixed sia-table__cell--fixed-${fixed}` : ""}${fixedEdgeClass}${autoWidthClass}`, style: getFixedStyle(column), children: isLabel ? /* @__PURE__ */ jsx23("span", { className: "sia-table__summary-label", children: content }) : content }, column.key);
7798
7925
  }) }, summary.key);
7799
7926
  }
7800
7927
  return /* @__PURE__ */ jsxs21(
@@ -7804,6 +7931,7 @@ function TableInner(props, ref) {
7804
7931
  className: `sia-table sia-table--${size}${bordered ? " sia-table--bordered" : ""}${!rowBordered ? " sia-table--no-row-borders" : ""}${!columnBordered ? " sia-table--no-column-borders" : ""}${hasToolbar && !toolbarBordered ? " sia-table--borderless-toolbar" : ""} ${className}`.trim(),
7805
7932
  style: rootStyle,
7806
7933
  "data-has-fixed-left": left > 0,
7934
+ "data-render-mode": canvas ? "canvas" : "dom",
7807
7935
  "data-has-fixed-right": right > 0,
7808
7936
  "data-scrolled-left": "false",
7809
7937
  "data-scrolled-right": "true",
@@ -7848,18 +7976,18 @@ function TableInner(props, ref) {
7848
7976
  },
7849
7977
  children: [
7850
7978
  hasToolbar ? /* @__PURE__ */ jsxs21("div", { className: "sia-table__toolbar", children: [
7851
- /* @__PURE__ */ jsx22("div", { children: toolbarStart }),
7852
- /* @__PURE__ */ jsx22("div", { children: toolbarEnd })
7979
+ /* @__PURE__ */ jsx23("div", { children: toolbarStart }),
7980
+ /* @__PURE__ */ jsx23("div", { children: toolbarEnd })
7853
7981
  ] }) : null,
7854
7982
  /* @__PURE__ */ jsxs21("div", { className: "sia-table__viewport-wrap", children: [
7855
- /* @__PURE__ */ jsx22("div", { className: "sia-table__viewport", ref: scrollRef, onScroll: handleScroll, children: /* @__PURE__ */ jsxs21("table", { ref: tableRef, className: "sia-table__element", style: { width: Math.max(totalWidth, 1), ...manualColumnLayout ? { minWidth: 0 } : {}, ...tableStyle }, children: [
7856
- /* @__PURE__ */ jsx22("colgroup", { children: leafColumns.map((column) => /* @__PURE__ */ jsx22("col", { "data-column-key": column.key, style: { width: columnWidths.get(column.key) ?? DEFAULT_WIDTH } }, column.key)) }),
7857
- /* @__PURE__ */ jsx22("thead", { className: stickyHeader ? "sia-table__head sia-table__head--sticky" : "sia-table__head", children: headerRows.map((headerRow, depth) => /* @__PURE__ */ jsx22("tr", { children: headerRow.map((cell) => {
7983
+ /* @__PURE__ */ jsx23("div", { className: "sia-table__viewport", ref: scrollRef, onScroll: handleScroll, children: /* @__PURE__ */ jsxs21("table", { ref: tableRef, className: "sia-table__element", style: { width: Math.max(totalWidth, 1), ...manualColumnLayout ? { minWidth: 0 } : {}, ...tableStyle }, children: [
7984
+ /* @__PURE__ */ jsx23("colgroup", { children: leafColumns.map((column) => /* @__PURE__ */ jsx23("col", { "data-column-key": column.key, style: { width: columnWidths.get(column.key) ?? DEFAULT_WIDTH } }, column.key)) }),
7985
+ /* @__PURE__ */ jsx23("thead", { className: stickyHeader ? "sia-table__head sia-table__head--sticky" : "sia-table__head", children: headerRows.map((headerRow, depth) => /* @__PURE__ */ jsx23("tr", { children: headerRow.map((cell) => {
7858
7986
  const fixed = cell.fixed;
7859
7987
  const pluginHeaderProps = getPluginHeaderCellProps(cell.column);
7860
7988
  const fixedEdgeClass = fixed === "left" && cell.column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && cell.column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
7861
7989
  const autoWidthClass = cell.column.autoWidth ? " sia-table__cell--auto-width" : "";
7862
- return /* @__PURE__ */ jsx22(
7990
+ return /* @__PURE__ */ jsx23(
7863
7991
  "th",
7864
7992
  {
7865
7993
  "data-column-key": cell.column.key,
@@ -7881,16 +8009,18 @@ function TableInner(props, ref) {
7881
8009
  );
7882
8010
  }) }, depth)) }),
7883
8011
  /* @__PURE__ */ jsxs21("tbody", { children: [
7884
- topSpacer > 0 ? /* @__PURE__ */ jsx22("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx22("td", { colSpan: leafColumns.length, style: { height: topSpacer, padding: 0, border: 0 } }) }) : null,
8012
+ topSpacer > 0 ? /* @__PURE__ */ jsx23("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx23("td", { colSpan: leafColumns.length, style: { height: topSpacer, padding: 0, border: 0 } }) }) : null,
7885
8013
  renderedRows.map((row, offset) => {
7886
8014
  const cached = rowElements.get(row.key);
7887
8015
  if (cached) return cached;
7888
8016
  const rowIndex = startIndex + offset;
7889
8017
  const pluginClasses = sortedPlugins.map((plugin) => plugin.getRowClassName?.(row, getContext(plugin))).filter(Boolean).join(" ");
7890
8018
  const customClass = typeof rowClassName === "function" ? rowClassName(row.record, row.sourceIndex) : rowClassName ?? "";
7891
- const element = /* @__PURE__ */ jsx22(
8019
+ const element = /* @__PURE__ */ jsx23(
7892
8020
  TableBodyRow,
7893
8021
  {
8022
+ canvas,
8023
+ visibleColumns,
7894
8024
  row,
7895
8025
  rowIndex,
7896
8026
  columns: leafColumns,
@@ -7937,12 +8067,13 @@ function TableInner(props, ref) {
7937
8067
  rowElements.set(row.key, element);
7938
8068
  return element;
7939
8069
  }),
7940
- bottomSpacer > 0 ? /* @__PURE__ */ jsx22("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx22("td", { colSpan: leafColumns.length, style: { height: bottomSpacer, padding: 0, border: 0 } }) }) : null
8070
+ bottomSpacer > 0 ? /* @__PURE__ */ jsx23("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx23("td", { colSpan: leafColumns.length, style: { height: bottomSpacer, padding: 0, border: 0 } }) }) : null
7941
8071
  ] }),
7942
- summaries.length > 0 ? /* @__PURE__ */ jsx22("tfoot", { className: "sia-table__summary", children: summaries.map(renderSummaryRow) }) : null
8072
+ summaries.length > 0 ? /* @__PURE__ */ jsx23("tfoot", { className: "sia-table__summary", children: summaries.map(renderSummaryRow) }) : null
7943
8073
  ] }) }),
7944
- pipeline.rows.length === 0 ? /* @__PURE__ */ jsx22("div", { className: "sia-table__empty", role: "status", children: emptyText }) : null,
7945
- /* @__PURE__ */ jsx22(
8074
+ pipeline.rows.length === 0 ? /* @__PURE__ */ jsx23("div", { className: "sia-table__empty", role: "status", children: emptyText }) : null,
8075
+ canvas ? /* @__PURE__ */ jsx23(TableCanvasLayer, { viewport: scrollRef, rows: pipeline.rows, columns: leafColumns, widths: columnWidths, rowHeight, headerHeight: headerRows.length * rowHeight }) : null,
8076
+ /* @__PURE__ */ jsx23(
7946
8077
  "div",
7947
8078
  {
7948
8079
  className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--horizontal",
@@ -7953,10 +8084,10 @@ function TableInner(props, ref) {
7953
8084
  onPointerMove: handleScrollbarPointerMove,
7954
8085
  onPointerUp: handleScrollbarPointerEnd,
7955
8086
  onPointerCancel: handleScrollbarPointerEnd,
7956
- children: /* @__PURE__ */ jsx22("div", { className: "sia-table__scrollbar-thumb" })
8087
+ children: /* @__PURE__ */ jsx23("div", { className: "sia-table__scrollbar-thumb" })
7957
8088
  }
7958
8089
  ),
7959
- /* @__PURE__ */ jsx22(
8090
+ /* @__PURE__ */ jsx23(
7960
8091
  "div",
7961
8092
  {
7962
8093
  className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--vertical",
@@ -7967,14 +8098,14 @@ function TableInner(props, ref) {
7967
8098
  onPointerMove: handleScrollbarPointerMove,
7968
8099
  onPointerUp: handleScrollbarPointerEnd,
7969
8100
  onPointerCancel: handleScrollbarPointerEnd,
7970
- children: /* @__PURE__ */ jsx22("div", { className: "sia-table__scrollbar-thumb" })
8101
+ children: /* @__PURE__ */ jsx23("div", { className: "sia-table__scrollbar-thumb" })
7971
8102
  }
7972
8103
  )
7973
8104
  ] }),
7974
- footers.length > 0 ? /* @__PURE__ */ jsx22("div", { className: "sia-table__footer", children: footers }) : null,
8105
+ footers.length > 0 ? /* @__PURE__ */ jsx23("div", { className: "sia-table__footer", children: footers }) : null,
7975
8106
  loading || internalLoading ? /* @__PURE__ */ jsxs21("div", { className: "sia-table__loading", role: "status", children: [
7976
- /* @__PURE__ */ jsx22(Icon, { name: "loader", size: 22, spin: true }),
7977
- /* @__PURE__ */ jsx22("span", { children: "\u52A0\u8F7D\u4E2D" })
8107
+ /* @__PURE__ */ jsx23(Icon, { name: "loader", size: 22, spin: true }),
8108
+ /* @__PURE__ */ jsx23("span", { children: "\u52A0\u8F7D\u4E2D" })
7978
8109
  ] }) : null,
7979
8110
  overlays
7980
8111
  ]
@@ -7985,7 +8116,7 @@ var Table = forwardRef5(TableInner);
7985
8116
 
7986
8117
  // src/components/ThemeSwitch.tsx
7987
8118
  import { forwardRef as forwardRef6 } from "react";
7988
- import { jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
8119
+ import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
7989
8120
  var ThemeSwitch = forwardRef6(function ThemeSwitch2({
7990
8121
  checked,
7991
8122
  onCheckedChange,
@@ -8011,12 +8142,12 @@ var ThemeSwitch = forwardRef6(function ThemeSwitch2({
8011
8142
  onClick: handleClick,
8012
8143
  ...withTitleTooltip(props),
8013
8144
  children: [
8014
- /* @__PURE__ */ jsx23("span", { className: "sia-theme-switch__selection", "aria-hidden": "true" }),
8015
- /* @__PURE__ */ jsx23("span", { className: `sia-theme-switch__icon${checked ? "" : " is-active"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxs22("svg", { viewBox: "0 0 24 24", children: [
8016
- /* @__PURE__ */ jsx23("circle", { cx: "12", cy: "12", r: "3.5" }),
8017
- /* @__PURE__ */ jsx23("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" })
8145
+ /* @__PURE__ */ jsx24("span", { className: "sia-theme-switch__selection", "aria-hidden": "true" }),
8146
+ /* @__PURE__ */ jsx24("span", { className: `sia-theme-switch__icon${checked ? "" : " is-active"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxs22("svg", { viewBox: "0 0 24 24", children: [
8147
+ /* @__PURE__ */ jsx24("circle", { cx: "12", cy: "12", r: "3.5" }),
8148
+ /* @__PURE__ */ jsx24("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" })
8018
8149
  ] }) }),
8019
- /* @__PURE__ */ jsx23("span", { className: `sia-theme-switch__icon${checked ? " is-active" : ""}`, "aria-hidden": "true", children: /* @__PURE__ */ jsx23("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx23("path", { d: "M20 15.2A8 8 0 0 1 8.8 4 8.5 8.5 0 1 0 20 15.2Z" }) }) })
8150
+ /* @__PURE__ */ jsx24("span", { className: `sia-theme-switch__icon${checked ? " is-active" : ""}`, "aria-hidden": "true", children: /* @__PURE__ */ jsx24("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx24("path", { d: "M20 15.2A8 8 0 0 1 8.8 4 8.5 8.5 0 1 0 20 15.2Z" }) }) })
8020
8151
  ]
8021
8152
  }
8022
8153
  );
@@ -8059,8 +8190,8 @@ function applySiaTheme(mode, target = document.documentElement) {
8059
8190
  }
8060
8191
 
8061
8192
  // src/components/InputSelect.tsx
8062
- import { forwardRef as forwardRef7, useEffect as useEffect13, useRef as useRef16, useState as useState19 } from "react";
8063
- import { jsx as jsx24, jsxs as jsxs23 } from "react/jsx-runtime";
8193
+ import { forwardRef as forwardRef7, useEffect as useEffect13, useRef as useRef17, useState as useState19 } from "react";
8194
+ import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
8064
8195
  var InputSelect = forwardRef7(function InputSelect2({
8065
8196
  options,
8066
8197
  value,
@@ -8100,9 +8231,9 @@ var InputSelect = forwardRef7(function InputSelect2({
8100
8231
  const [modalOpen, setModalOpen] = useState19(false);
8101
8232
  const [modalValues, setModalValues] = useState19([]);
8102
8233
  const [selectedOnly, setSelectedOnly] = useState19(false);
8103
- const rootRef = useRef16(null);
8104
- const popupRef = useRef16(null);
8105
- const inputRef = useRef16(null);
8234
+ const rootRef = useRef17(null);
8235
+ const popupRef = useRef17(null);
8236
+ const inputRef = useRef17(null);
8106
8237
  const config = typeof enableModal === "object" ? enableModal : {};
8107
8238
  function changeOpen(next) {
8108
8239
  if (next && (disabled || loading)) return;
@@ -8150,7 +8281,7 @@ var InputSelect = forwardRef7(function InputSelect2({
8150
8281
  inputRef.current?.focus();
8151
8282
  }
8152
8283
  }, children: [
8153
- /* @__PURE__ */ jsx24(
8284
+ /* @__PURE__ */ jsx25(
8154
8285
  Input,
8155
8286
  {
8156
8287
  ...inputProps,
@@ -8188,25 +8319,25 @@ var InputSelect = forwardRef7(function InputSelect2({
8188
8319
  changeOpen(true);
8189
8320
  },
8190
8321
  suffix: /* @__PURE__ */ jsxs23("span", { className: "sia-input-select__suffix", children: [
8191
- allowClear && draft && !disabled && /* @__PURE__ */ jsx24(Button, { variant: "text", size: "small", disabled: loading, "aria-label": "\u6E05\u9664\u8F93\u5165\u9009\u62E9", onClick: (event) => {
8322
+ allowClear && draft && !disabled && /* @__PURE__ */ jsx25(Button, { variant: "text", size: "small", disabled: loading, "aria-label": "\u6E05\u9664\u8F93\u5165\u9009\u62E9", onClick: (event) => {
8192
8323
  event.stopPropagation();
8193
8324
  setDraft("");
8194
8325
  emit(multiple ? [] : void 0);
8195
8326
  inputRef.current?.focus();
8196
8327
  }, children: "\xD7" }),
8197
8328
  suffix,
8198
- enableModal && /* @__PURE__ */ jsx24(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
8329
+ enableModal && /* @__PURE__ */ jsx25(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
8199
8330
  event.stopPropagation();
8200
8331
  openModal();
8201
8332
  }, children: "\u2026" }),
8202
- /* @__PURE__ */ jsx24(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
8333
+ /* @__PURE__ */ jsx25(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
8203
8334
  event.stopPropagation();
8204
8335
  changeOpen(!open);
8205
- }, children: /* @__PURE__ */ jsx24(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
8336
+ }, children: /* @__PURE__ */ jsx25(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
8206
8337
  ] })
8207
8338
  }
8208
8339
  ),
8209
- /* @__PURE__ */ jsx24(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx24(
8340
+ /* @__PURE__ */ jsx25(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx25(
8210
8341
  SelectionPanel,
8211
8342
  {
8212
8343
  options,
@@ -8235,14 +8366,14 @@ var InputSelect = forwardRef7(function InputSelect2({
8235
8366
  },
8236
8367
  children: [
8237
8368
  /* @__PURE__ */ jsxs23("div", { className: "sia-selection-panel__actions", role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
8238
- /* @__PURE__ */ jsx24(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
8369
+ /* @__PURE__ */ jsx25(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
8239
8370
  /* @__PURE__ */ jsxs23(Button, { role: "tab", "aria-selected": selectedOnly, variant: selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(true), children: [
8240
8371
  "\u5DF2\u9009\u9879(",
8241
8372
  modalValues.length,
8242
8373
  ")"
8243
8374
  ] })
8244
8375
  ] }),
8245
- modalOpen && /* @__PURE__ */ jsx24(
8376
+ modalOpen && /* @__PURE__ */ jsx25(
8246
8377
  SelectionPanel,
8247
8378
  {
8248
8379
  options,
@@ -8263,8 +8394,8 @@ var InputSelect = forwardRef7(function InputSelect2({
8263
8394
  });
8264
8395
 
8265
8396
  // src/components/QueryForm.tsx
8266
- import { Children as Children4, useLayoutEffect as useLayoutEffect3, useRef as useRef17, useState as useState20 } from "react";
8267
- import { jsx as jsx25, jsxs as jsxs24 } from "react/jsx-runtime";
8397
+ import { Children as Children4, useLayoutEffect as useLayoutEffect4, useRef as useRef18, useState as useState20 } from "react";
8398
+ import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
8268
8399
  function QueryForm({
8269
8400
  fields,
8270
8401
  children,
@@ -8307,19 +8438,19 @@ function QueryForm({
8307
8438
  const [saveError, setSaveError] = useState20("");
8308
8439
  const [error, setError] = useState20("");
8309
8440
  const [activeShortcut, setActiveShortcut] = useState20("");
8310
- const source = useRef17({ source: "submit" });
8311
- const searchLock = useRef17(false);
8312
- const saveLock = useRef17(false);
8313
- const removeLock = useRef17(false);
8314
- const snapshot = useRef17();
8441
+ const source = useRef18({ source: "submit" });
8442
+ const searchLock = useRef18(false);
8443
+ const saveLock = useRef18(false);
8444
+ const removeLock = useRef18(false);
8445
+ const snapshot = useRef18();
8315
8446
  const busy = disabled || loading || searching;
8316
8447
  const shortcutBusy = busy || shortcutsLoading || saving || removing;
8317
- const entries = fields ? fields.map(({ key, width, ...item }) => ({ key, width, content: /* @__PURE__ */ jsx25(Form.Item, { noStyle: true, ...item }) })) : Children4.toArray(children).map((content, index) => ({ key: String(index), width: void 0, content }));
8448
+ const entries = fields ? fields.map(({ key, width, ...item }) => ({ key, width, content: /* @__PURE__ */ jsx26(Form.Item, { noStyle: true, ...item }) })) : Children4.toArray(children).map((content, index) => ({ key: String(index), width: void 0, content }));
8318
8449
  const limit = Math.max(1, Math.floor(collapsedCount));
8319
- const rowRef = useRef17(null);
8320
- const actionsRef = useRef17(null);
8450
+ const rowRef = useRef18(null);
8451
+ const actionsRef = useRef18(null);
8321
8452
  const [fittingCount, setFittingCount] = useState20(limit);
8322
- useLayoutEffect3(() => {
8453
+ useLayoutEffect4(() => {
8323
8454
  if (!collapsed) return;
8324
8455
  const row = rowRef.current;
8325
8456
  const actions = actionsRef.current;
@@ -8439,7 +8570,7 @@ function QueryForm({
8439
8570
  },
8440
8571
  children: [
8441
8572
  quickQueries.length ? /* @__PURE__ */ jsxs24("div", { className: "sia-query-form__quick", "aria-label": "\u9884\u8BBE\u5FEB\u6377\u67E5\u8BE2", children: [
8442
- quickQueries.map((query) => /* @__PURE__ */ jsx25(Badge, { className: "sia-query-form__quick-badge", showZero: true, size: "small", title: query.count === void 0 ? void 0 : `\u5171 ${query.count} \u6761`, ...query.badgeProps, count: query.count, children: /* @__PURE__ */ jsx25(
8573
+ quickQueries.map((query) => /* @__PURE__ */ jsx26(Badge, { className: "sia-query-form__quick-badge", showZero: true, size: "small", title: query.count === void 0 ? void 0 : `\u5171 ${query.count} \u6761`, ...query.badgeProps, count: query.count, children: /* @__PURE__ */ jsx26(
8443
8574
  Button,
8444
8575
  {
8445
8576
  size: query.size ?? quickQuerySize,
@@ -8453,7 +8584,7 @@ function QueryForm({
8453
8584
  " "
8454
8585
  ] }) : null,
8455
8586
  /* @__PURE__ */ jsxs24("div", { ref: rowRef, className: `sia-query-form__fields${collapsed ? " is-collapsed" : ""}`, style: { "--sia-query-field-width": typeof fieldWidth === "number" ? `${fieldWidth}px` : fieldWidth }, children: [
8456
- entries.map((entry, index) => /* @__PURE__ */ jsx25(
8587
+ entries.map((entry, index) => /* @__PURE__ */ jsx26(
8457
8588
  "div",
8458
8589
  {
8459
8590
  className: "sia-query-form__field",
@@ -8465,21 +8596,21 @@ function QueryForm({
8465
8596
  )),
8466
8597
  /* @__PURE__ */ jsxs24("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
8467
8598
  /* @__PURE__ */ jsxs24(Space.Compact, { children: [
8468
- /* @__PURE__ */ jsx25(Button, { type: "submit", variant: "primary", loading: loading || searching, disabled, children: searchText }),
8469
- /* @__PURE__ */ jsx25(Button, { disabled: busy, onClick: reset, children: resetText }),
8470
- onSaveQuery ? /* @__PURE__ */ jsx25(Button, { disabled: shortcutBusy, onClick: () => {
8599
+ /* @__PURE__ */ jsx26(Button, { type: "submit", variant: "primary", loading: loading || searching, disabled, children: searchText }),
8600
+ /* @__PURE__ */ jsx26(Button, { disabled: busy, onClick: reset, children: resetText }),
8601
+ onSaveQuery ? /* @__PURE__ */ jsx26(Button, { disabled: shortcutBusy, onClick: () => {
8471
8602
  snapshot.current = form.getFieldsValue();
8472
8603
  setSaveName("");
8473
8604
  setSaveError("");
8474
8605
  setSaveOpen(true);
8475
8606
  }, children: saveText }) : null
8476
8607
  ] }),
8477
- collapsible && entries.length > 0 ? /* @__PURE__ */ jsx25(
8608
+ collapsible && entries.length > 0 ? /* @__PURE__ */ jsx26(
8478
8609
  Button,
8479
8610
  {
8480
8611
  variant: "link",
8481
8612
  "aria-expanded": !collapsed,
8482
- icon: /* @__PURE__ */ jsx25(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
8613
+ icon: /* @__PURE__ */ jsx26(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
8483
8614
  iconPosition: "end",
8484
8615
  onClick: () => {
8485
8616
  setInternalCollapsed(!collapsed);
@@ -8492,7 +8623,7 @@ function QueryForm({
8492
8623
  ] })
8493
8624
  ] }),
8494
8625
  savedQueries.length && !collapsed ? /* @__PURE__ */ jsxs24("div", { className: "sia-query-form__saved", "aria-label": "\u5DF2\u4FDD\u5B58\u5FEB\u6377\u67E5\u8BE2", children: [
8495
- savedQueries.map((query, index) => /* @__PURE__ */ jsx25(
8626
+ savedQueries.map((query, index) => /* @__PURE__ */ jsx26(
8496
8627
  Tag,
8497
8628
  {
8498
8629
  status: query.status ?? ["processing", "success", "warning", "error"][index % 4],
@@ -8518,14 +8649,14 @@ function QueryForm({
8518
8649
  )),
8519
8650
  " "
8520
8651
  ] }) : null,
8521
- error ? /* @__PURE__ */ jsx25("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
8652
+ error ? /* @__PURE__ */ jsx26("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
8522
8653
  ]
8523
8654
  }
8524
8655
  ),
8525
8656
  /* @__PURE__ */ jsxs24(Modal, { open: saveOpen, title: "\u53E6\u5B58\u4E3A\u5FEB\u6377\u67E5\u8BE2", width: 420, confirmLoading: saving, onOk: save, onOpenChange: (next) => {
8526
8657
  if (!saveLock.current) setSaveOpen(next);
8527
8658
  }, children: [
8528
- /* @__PURE__ */ jsx25(
8659
+ /* @__PURE__ */ jsx26(
8529
8660
  Input,
8530
8661
  {
8531
8662
  autoFocus: true,
@@ -8544,7 +8675,7 @@ function QueryForm({
8544
8675
  }
8545
8676
  }
8546
8677
  ),
8547
- saveError ? /* @__PURE__ */ jsx25("p", { className: "sia-query-form__error", role: "alert", children: saveError }) : null
8678
+ saveError ? /* @__PURE__ */ jsx26("p", { className: "sia-query-form__error", role: "alert", children: saveError }) : null
8548
8679
  ] })
8549
8680
  ] });
8550
8681
  }