@sia.soul/sia-react-ui 0.1.44 → 0.1.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-QIXU7N4X.js → chunk-E4RMSZOC.js} +20 -1
- package/dist/core.css +14 -3
- package/dist/index.cjs +1656 -1481
- package/dist/index.css +26 -3
- package/dist/index.d.cts +19 -6
- package/dist/index.d.ts +19 -6
- package/dist/index.js +324 -168
- package/dist/{select-date-range-Dtj6XF9I.d.ts → select-date-range-B1ZWIHoe.d.ts} +1 -1
- package/dist/{select-date-range-2galnCvZ.d.cts → select-date-range-CyfCT32j.d.cts} +1 -1
- package/dist/select-date-range.cjs +19 -0
- package/dist/select-date-range.d.cts +1 -1
- package/dist/select-date-range.d.ts +1 -1
- package/dist/select-date-range.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
DatePicker,
|
|
96
96
|
SelectDateRange,
|
|
97
97
|
TimePanel
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-E4RMSZOC.js";
|
|
99
99
|
import {
|
|
100
100
|
Checkbox,
|
|
101
101
|
FloatingScrollbarProvider,
|
|
@@ -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/
|
|
4711
|
-
import {
|
|
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,138 @@ 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
|
+
const readyCells = /* @__PURE__ */ new Map();
|
|
4789
|
+
scroller.querySelectorAll("tr[data-canvas-row-index]").forEach((element) => {
|
|
4790
|
+
const keys = /* @__PURE__ */ new Set();
|
|
4791
|
+
element.querySelectorAll('[data-canvas-dom-ready="true"]').forEach((cell) => keys.add(cell.dataset.columnKey));
|
|
4792
|
+
readyCells.set(Number(element.dataset.canvasRowIndex), keys);
|
|
4793
|
+
});
|
|
4794
|
+
ctx.font = `${style.fontSize} ${style.fontFamily}`;
|
|
4795
|
+
ctx.textBaseline = "middle";
|
|
4796
|
+
const leftWidth = columns.reduce((n, c) => n + (normalizeFixed(c.fixed) === "left" ? widths.get(c.key) ?? 160 : 0), 0);
|
|
4797
|
+
const rightWidth = columns.reduce((n, c) => n + (normalizeFixed(c.fixed) === "right" ? widths.get(c.key) ?? 160 : 0), 0);
|
|
4798
|
+
let offset = 0, fixedLeft = 0, fixedRight = rightWidth;
|
|
4799
|
+
const geometry = columns.map((column) => {
|
|
4800
|
+
const cellWidth = widths.get(column.key) ?? 160;
|
|
4801
|
+
const fixed = normalizeFixed(column.fixed);
|
|
4802
|
+
const x = fixed === "left" ? fixedLeft : fixed === "right" ? width - fixedRight : offset - scroller.scrollLeft;
|
|
4803
|
+
offset += cellWidth;
|
|
4804
|
+
if (fixed === "left") fixedLeft += cellWidth;
|
|
4805
|
+
if (fixed === "right") fixedRight -= cellWidth;
|
|
4806
|
+
return { column, x, cellWidth, fixed };
|
|
4807
|
+
});
|
|
4808
|
+
const first = Math.max(0, Math.floor(scroller.scrollTop / rowHeight));
|
|
4809
|
+
const last = Math.min(rows.length, Math.ceil((scroller.scrollTop + height) / rowHeight));
|
|
4810
|
+
for (const { column, x, cellWidth, fixed } of geometry) {
|
|
4811
|
+
if (x + cellWidth <= 0 || x >= width) continue;
|
|
4812
|
+
const clipLeft = Math.max(x, fixed ? 0 : leftWidth);
|
|
4813
|
+
const clipRight = Math.min(x + cellWidth, fixed ? width : width - rightWidth);
|
|
4814
|
+
if (clipRight <= clipLeft) continue;
|
|
4815
|
+
ctx.save();
|
|
4816
|
+
ctx.beginPath();
|
|
4817
|
+
ctx.rect(clipLeft, headerHeight, clipRight - clipLeft, height - headerHeight);
|
|
4818
|
+
ctx.clip();
|
|
4819
|
+
for (let index = first; index < last; index++) {
|
|
4820
|
+
const row = rows[index];
|
|
4821
|
+
const y = headerHeight + index * rowHeight - scroller.scrollTop + rowHeight / 2;
|
|
4822
|
+
if (!column.canvasRender && column.render) {
|
|
4823
|
+
if (!readyCells.get(index)?.has(column.key)) {
|
|
4824
|
+
const skeletonWidth = Math.max(0, Math.min(cellWidth - 24, 120));
|
|
4825
|
+
const skeletonX = column.align === "right" ? x + cellWidth - skeletonWidth - 8 : column.align === "center" ? x + (cellWidth - skeletonWidth) / 2 : x + 8;
|
|
4826
|
+
ctx.save();
|
|
4827
|
+
ctx.fillStyle = foreground;
|
|
4828
|
+
ctx.globalAlpha = 0.12;
|
|
4829
|
+
ctx.beginPath();
|
|
4830
|
+
ctx.roundRect(skeletonX, y - 6, skeletonWidth, 12, 4);
|
|
4831
|
+
ctx.fill();
|
|
4832
|
+
ctx.restore();
|
|
4833
|
+
}
|
|
4834
|
+
continue;
|
|
4835
|
+
}
|
|
4836
|
+
const value = getTableValue(row.record, column.dataIndex, column.code ?? column.key);
|
|
4837
|
+
const content2 = column.canvasRender ? column.canvasRender(value, row.record, row.sourceIndex, { row, rowIndex: index, column }) : { text: value == null ? "" : String(value) };
|
|
4838
|
+
if (!content2?.text) continue;
|
|
4839
|
+
const available = Math.max(0, cellWidth - (content2.background ? 32 : 16));
|
|
4840
|
+
let text = content2.text;
|
|
4841
|
+
if (ctx.measureText(text).width > available) {
|
|
4842
|
+
let lo = 0, hi = text.length;
|
|
4843
|
+
while (lo < hi) {
|
|
4844
|
+
const mid = Math.ceil((lo + hi) / 2);
|
|
4845
|
+
if (ctx.measureText(text.slice(0, mid) + "\u2026").width <= available) lo = mid;
|
|
4846
|
+
else hi = mid - 1;
|
|
4847
|
+
}
|
|
4848
|
+
text = text.slice(0, lo) + "\u2026";
|
|
4849
|
+
}
|
|
4850
|
+
const textWidth = ctx.measureText(text).width;
|
|
4851
|
+
const total = textWidth + (content2.background ? 16 : 0);
|
|
4852
|
+
const tx = column.align === "right" ? x + cellWidth - total - 8 : column.align === "center" ? x + (cellWidth - total) / 2 : x + 8;
|
|
4853
|
+
if (content2.background) {
|
|
4854
|
+
ctx.fillStyle = content2.background;
|
|
4855
|
+
ctx.beginPath();
|
|
4856
|
+
ctx.roundRect(tx, y - 12, total, 24, 4);
|
|
4857
|
+
ctx.fill();
|
|
4858
|
+
}
|
|
4859
|
+
ctx.fillStyle = content2.color ?? foreground;
|
|
4860
|
+
ctx.fillText(text, tx + (content2.background ? 8 : 0), y);
|
|
4861
|
+
}
|
|
4862
|
+
ctx.restore();
|
|
4863
|
+
}
|
|
4864
|
+
};
|
|
4865
|
+
const schedule = () => {
|
|
4866
|
+
if (!frame) frame = requestAnimationFrame(draw);
|
|
4867
|
+
};
|
|
4868
|
+
scroller.addEventListener("scroll", schedule, { passive: true });
|
|
4869
|
+
const resize = new ResizeObserver(schedule);
|
|
4870
|
+
resize.observe(scroller);
|
|
4871
|
+
const content = new MutationObserver(schedule);
|
|
4872
|
+
content.observe(scroller, { childList: true, subtree: true, attributes: true, attributeFilter: ["data-canvas-row-index", "data-canvas-dom-ready", "data-column-key"] });
|
|
4873
|
+
const theme = new MutationObserver(schedule);
|
|
4874
|
+
theme.observe(document.documentElement, { attributes: true });
|
|
4875
|
+
window.addEventListener("resize", schedule);
|
|
4876
|
+
draw();
|
|
4877
|
+
return () => {
|
|
4878
|
+
cancelAnimationFrame(frame);
|
|
4879
|
+
resize.disconnect();
|
|
4880
|
+
content.disconnect();
|
|
4881
|
+
theme.disconnect();
|
|
4882
|
+
scroller.removeEventListener("scroll", schedule);
|
|
4883
|
+
window.removeEventListener("resize", schedule);
|
|
4884
|
+
};
|
|
4885
|
+
}, [viewport, rows, columns, widths, rowHeight, headerHeight]);
|
|
4886
|
+
return /* @__PURE__ */ jsx21("canvas", { ref: canvasRef, "aria-hidden": "true", className: "sia-table__canvas-layer" });
|
|
4887
|
+
}
|
|
4888
|
+
|
|
4889
|
+
// src/components/Table/Table.tsx
|
|
4890
|
+
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";
|
|
4891
|
+
|
|
4766
4892
|
// src/components/Table/plugins.tsx
|
|
4767
|
-
import {
|
|
4893
|
+
import { isValidElement as isValidElement3, useEffect as useEffect11, useRef as useRef15, useState as useState17 } from "react";
|
|
4894
|
+
import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4768
4895
|
function TableCheckbox({
|
|
4769
4896
|
checked,
|
|
4770
4897
|
indeterminate,
|
|
@@ -4772,7 +4899,7 @@ function TableCheckbox({
|
|
|
4772
4899
|
label,
|
|
4773
4900
|
onChange
|
|
4774
4901
|
}) {
|
|
4775
|
-
return /* @__PURE__ */
|
|
4902
|
+
return /* @__PURE__ */ jsx22(
|
|
4776
4903
|
Checkbox,
|
|
4777
4904
|
{
|
|
4778
4905
|
className: "sia-table__checkbox",
|
|
@@ -4997,6 +5124,7 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
4997
5124
|
info
|
|
4998
5125
|
);
|
|
4999
5126
|
if (exported !== void 0) return tableExportText(exported);
|
|
5127
|
+
if (column.canvasRender) return column.canvasRender(value, row.record, row.sourceIndex, info)?.text ?? "";
|
|
5000
5128
|
if (column.editable) return tableExportCell(value, true);
|
|
5001
5129
|
const rendered = column.render?.(value, row.record, row.sourceIndex, info);
|
|
5002
5130
|
return rendered !== void 0 ? tableExportText(rendered) : tableExportCell(value, true);
|
|
@@ -5399,10 +5527,10 @@ function TableSelectedItemsPanel({
|
|
|
5399
5527
|
/* @__PURE__ */ jsxs20("div", { className: "sia-table-selection-panel__header", children: [
|
|
5400
5528
|
/* @__PURE__ */ jsxs20("strong", { children: [
|
|
5401
5529
|
"\u5DF2\u9009 ",
|
|
5402
|
-
/* @__PURE__ */
|
|
5530
|
+
/* @__PURE__ */ jsx22("span", { children: entries.length }),
|
|
5403
5531
|
" \u9879"
|
|
5404
5532
|
] }),
|
|
5405
|
-
/* @__PURE__ */
|
|
5533
|
+
/* @__PURE__ */ jsx22(
|
|
5406
5534
|
Button,
|
|
5407
5535
|
{
|
|
5408
5536
|
size: "small",
|
|
@@ -5413,15 +5541,15 @@ function TableSelectedItemsPanel({
|
|
|
5413
5541
|
}
|
|
5414
5542
|
)
|
|
5415
5543
|
] }),
|
|
5416
|
-
/* @__PURE__ */
|
|
5417
|
-
/* @__PURE__ */
|
|
5418
|
-
columns.map((column) => /* @__PURE__ */
|
|
5419
|
-
/* @__PURE__ */
|
|
5544
|
+
/* @__PURE__ */ jsx22("div", { className: "sia-table-selection-panel__body", children: /* @__PURE__ */ jsxs20("table", { children: [
|
|
5545
|
+
/* @__PURE__ */ jsx22("thead", { children: /* @__PURE__ */ jsxs20("tr", { children: [
|
|
5546
|
+
columns.map((column) => /* @__PURE__ */ jsx22("th", { children: getColumnLabel(column) }, column.key)),
|
|
5547
|
+
/* @__PURE__ */ jsx22("th", { "aria-label": "\u64CD\u4F5C" })
|
|
5420
5548
|
] }) }),
|
|
5421
|
-
/* @__PURE__ */
|
|
5549
|
+
/* @__PURE__ */ jsx22("tbody", { children: visibleEntries.map((entry, selectedIndex) => /* @__PURE__ */ jsxs20("tr", { children: [
|
|
5422
5550
|
columns.map((column) => {
|
|
5423
5551
|
if (column.meta?.plugin === "index")
|
|
5424
|
-
return /* @__PURE__ */
|
|
5552
|
+
return /* @__PURE__ */ jsx22("td", { children: entry.sourceIndex + 1 }, column.key);
|
|
5425
5553
|
const baseColumn = baseColumnMap.get(column.key) ?? column;
|
|
5426
5554
|
const value = getTableValue(
|
|
5427
5555
|
entry.record,
|
|
@@ -5441,9 +5569,9 @@ function TableSelectedItemsPanel({
|
|
|
5441
5569
|
entry.sourceIndex,
|
|
5442
5570
|
{ row, rowIndex: entry.sourceIndex, column: baseColumn }
|
|
5443
5571
|
) ?? value;
|
|
5444
|
-
return /* @__PURE__ */
|
|
5572
|
+
return /* @__PURE__ */ jsx22("td", { children: content }, column.key);
|
|
5445
5573
|
}),
|
|
5446
|
-
/* @__PURE__ */
|
|
5574
|
+
/* @__PURE__ */ jsx22("td", { children: /* @__PURE__ */ jsx22(
|
|
5447
5575
|
Button,
|
|
5448
5576
|
{
|
|
5449
5577
|
size: "small",
|
|
@@ -5458,7 +5586,7 @@ function TableSelectedItemsPanel({
|
|
|
5458
5586
|
"\u8FD8\u6709 ",
|
|
5459
5587
|
hiddenCount,
|
|
5460
5588
|
" \u9879\u672A\u5C55\u793A",
|
|
5461
|
-
/* @__PURE__ */
|
|
5589
|
+
/* @__PURE__ */ jsx22(Button, { size: "small", variant: "link", onClick: () => setShowAll(true), children: "\u5C55\u793A\u5168\u90E8" })
|
|
5462
5590
|
] }) : null
|
|
5463
5591
|
] });
|
|
5464
5592
|
}
|
|
@@ -5573,7 +5701,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
5573
5701
|
const keys = selected(context);
|
|
5574
5702
|
const allChecked = enabledRows.length > 0 && enabledRows.every((row) => keys.includes(row.key));
|
|
5575
5703
|
const someChecked = enabledRows.some((row) => keys.includes(row.key));
|
|
5576
|
-
return /* @__PURE__ */
|
|
5704
|
+
return /* @__PURE__ */ jsx22(
|
|
5577
5705
|
TableCheckbox,
|
|
5578
5706
|
{
|
|
5579
5707
|
label: "\u9009\u62E9\u5F53\u524D\u9875\u5168\u90E8\u884C",
|
|
@@ -5589,7 +5717,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
5589
5717
|
}
|
|
5590
5718
|
);
|
|
5591
5719
|
},
|
|
5592
|
-
render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */
|
|
5720
|
+
render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */ jsx22(
|
|
5593
5721
|
Radio2,
|
|
5594
5722
|
{
|
|
5595
5723
|
className: "sia-table__checkbox",
|
|
@@ -5600,7 +5728,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
5600
5728
|
onClick: (event) => event.stopPropagation(),
|
|
5601
5729
|
onChange: () => toggle(info.row.key, record, context)
|
|
5602
5730
|
}
|
|
5603
|
-
) : /* @__PURE__ */
|
|
5731
|
+
) : /* @__PURE__ */ jsx22(
|
|
5604
5732
|
TableCheckbox,
|
|
5605
5733
|
{
|
|
5606
5734
|
label: `\u9009\u62E9\u7B2C ${info.rowIndex + 1} \u884C`,
|
|
@@ -5640,7 +5768,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
5640
5768
|
(column) => !column.hidden && column.meta?.plugin !== "selection"
|
|
5641
5769
|
).slice(0, Math.max(1, options.selectionPanelColumnCount ?? 4));
|
|
5642
5770
|
return /* @__PURE__ */ jsxs20("span", { className: "sia-table__selection-footer", children: [
|
|
5643
|
-
/* @__PURE__ */
|
|
5771
|
+
/* @__PURE__ */ jsx22(
|
|
5644
5772
|
Popover,
|
|
5645
5773
|
{
|
|
5646
5774
|
placement: "top-start",
|
|
@@ -5648,7 +5776,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
5648
5776
|
open: context.state.panelOpen && entries.length > 0,
|
|
5649
5777
|
onOpenChange: (panelOpen) => context.setState((state) => ({ ...state, panelOpen })),
|
|
5650
5778
|
overlayClassName: "sia-table-selection-popover",
|
|
5651
|
-
content: /* @__PURE__ */
|
|
5779
|
+
content: /* @__PURE__ */ jsx22(
|
|
5652
5780
|
TableSelectedItemsPanel,
|
|
5653
5781
|
{
|
|
5654
5782
|
entries,
|
|
@@ -5680,7 +5808,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
5680
5808
|
)
|
|
5681
5809
|
}
|
|
5682
5810
|
),
|
|
5683
|
-
mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */
|
|
5811
|
+
mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */ jsx22(
|
|
5684
5812
|
Checkbox,
|
|
5685
5813
|
{
|
|
5686
5814
|
checked: preserving(context),
|
|
@@ -5738,8 +5866,8 @@ function createSortPlugin(options = {}) {
|
|
|
5738
5866
|
const order = info?.field === field ? info.order : null;
|
|
5739
5867
|
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
5868
|
return /* @__PURE__ */ jsxs20("span", { className: "sia-table__sortable-header", children: [
|
|
5741
|
-
/* @__PURE__ */
|
|
5742
|
-
/* @__PURE__ */
|
|
5869
|
+
/* @__PURE__ */ jsx22("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
|
|
5870
|
+
/* @__PURE__ */ jsx22(
|
|
5743
5871
|
"button",
|
|
5744
5872
|
{
|
|
5745
5873
|
type: "button",
|
|
@@ -5751,9 +5879,9 @@ function createSortPlugin(options = {}) {
|
|
|
5751
5879
|
event.stopPropagation();
|
|
5752
5880
|
cycle(field, context);
|
|
5753
5881
|
},
|
|
5754
|
-
children: order ? /* @__PURE__ */
|
|
5755
|
-
/* @__PURE__ */
|
|
5756
|
-
/* @__PURE__ */
|
|
5882
|
+
children: order ? /* @__PURE__ */ jsx22(Icon, { name: order === "ascend" ? "chevron-up" : "chevron-down", size: 18 }) : /* @__PURE__ */ jsxs20(Fragment7, { children: [
|
|
5883
|
+
/* @__PURE__ */ jsx22(Icon, { name: "chevron-up", size: 11 }),
|
|
5884
|
+
/* @__PURE__ */ jsx22(Icon, { name: "chevron-down", size: 11 })
|
|
5757
5885
|
] })
|
|
5758
5886
|
}
|
|
5759
5887
|
)
|
|
@@ -5799,8 +5927,8 @@ function TableFilterControl({
|
|
|
5799
5927
|
setOpen(false);
|
|
5800
5928
|
};
|
|
5801
5929
|
return /* @__PURE__ */ jsxs20("span", { className: "sia-table__filter-header", children: [
|
|
5802
|
-
/* @__PURE__ */
|
|
5803
|
-
/* @__PURE__ */
|
|
5930
|
+
/* @__PURE__ */ jsx22("span", { children: column.title ?? column.name ?? column.key }),
|
|
5931
|
+
/* @__PURE__ */ jsx22(
|
|
5804
5932
|
Popover,
|
|
5805
5933
|
{
|
|
5806
5934
|
open,
|
|
@@ -5808,7 +5936,7 @@ function TableFilterControl({
|
|
|
5808
5936
|
placement: "bottom-end",
|
|
5809
5937
|
overlayClassName: "sia-table-filter-popover",
|
|
5810
5938
|
content: /* @__PURE__ */ jsxs20("div", { className: "sia-table-filter-panel", children: [
|
|
5811
|
-
/* @__PURE__ */
|
|
5939
|
+
/* @__PURE__ */ jsx22(
|
|
5812
5940
|
Input,
|
|
5813
5941
|
{
|
|
5814
5942
|
size: "small",
|
|
@@ -5823,7 +5951,7 @@ function TableFilterControl({
|
|
|
5823
5951
|
}
|
|
5824
5952
|
),
|
|
5825
5953
|
/* @__PURE__ */ jsxs20("div", { className: "sia-table-filter-panel__actions", children: [
|
|
5826
|
-
/* @__PURE__ */
|
|
5954
|
+
/* @__PURE__ */ jsx22(
|
|
5827
5955
|
Button,
|
|
5828
5956
|
{
|
|
5829
5957
|
size: "small",
|
|
@@ -5835,7 +5963,7 @@ function TableFilterControl({
|
|
|
5835
5963
|
children: "\u6E05\u9664"
|
|
5836
5964
|
}
|
|
5837
5965
|
),
|
|
5838
|
-
/* @__PURE__ */
|
|
5966
|
+
/* @__PURE__ */ jsx22(
|
|
5839
5967
|
Button,
|
|
5840
5968
|
{
|
|
5841
5969
|
size: "small",
|
|
@@ -5846,7 +5974,7 @@ function TableFilterControl({
|
|
|
5846
5974
|
)
|
|
5847
5975
|
] })
|
|
5848
5976
|
] }),
|
|
5849
|
-
children: /* @__PURE__ */
|
|
5977
|
+
children: /* @__PURE__ */ jsx22(
|
|
5850
5978
|
"button",
|
|
5851
5979
|
{
|
|
5852
5980
|
type: "button",
|
|
@@ -5854,7 +5982,7 @@ function TableFilterControl({
|
|
|
5854
5982
|
"aria-label": `\u7B5B\u9009${label}`,
|
|
5855
5983
|
"aria-pressed": Boolean(value),
|
|
5856
5984
|
onClick: (event) => event.stopPropagation(),
|
|
5857
|
-
children: /* @__PURE__ */
|
|
5985
|
+
children: /* @__PURE__ */ jsx22(Icon, { name: "search", size: 13 })
|
|
5858
5986
|
}
|
|
5859
5987
|
)
|
|
5860
5988
|
}
|
|
@@ -5916,7 +6044,7 @@ function createFilterPlugin(options = {}) {
|
|
|
5916
6044
|
title: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title
|
|
5917
6045
|
};
|
|
5918
6046
|
const placeholder = typeof options.placeholder === "function" ? options.placeholder(currentColumn) : options.placeholder ?? `\u8F93\u5165${getColumnLabel(currentColumn)}\u7B5B\u9009`;
|
|
5919
|
-
return /* @__PURE__ */
|
|
6047
|
+
return /* @__PURE__ */ jsx22(
|
|
5920
6048
|
TableFilterControl,
|
|
5921
6049
|
{
|
|
5922
6050
|
column: renderedColumn,
|
|
@@ -6005,7 +6133,7 @@ function createPaginationPlugin(options = {}) {
|
|
|
6005
6133
|
const page = currentPage(context);
|
|
6006
6134
|
const filteredCount = context.getPluginApi("filter")?.getFilteredRows().length;
|
|
6007
6135
|
const totalRecords = options.totalCount ?? filteredCount ?? context.sourceData.length;
|
|
6008
|
-
return /* @__PURE__ */
|
|
6136
|
+
return /* @__PURE__ */ jsx22(
|
|
6009
6137
|
Pagination,
|
|
6010
6138
|
{
|
|
6011
6139
|
className: "sia-table__pagination",
|
|
@@ -6146,7 +6274,7 @@ function createTreePlugin(options = {}) {
|
|
|
6146
6274
|
className: "sia-table__tree-cell",
|
|
6147
6275
|
style: { paddingLeft: info.row.depth * 18 },
|
|
6148
6276
|
children: [
|
|
6149
|
-
info.row.meta.treeHasChildren ? /* @__PURE__ */
|
|
6277
|
+
info.row.meta.treeHasChildren ? /* @__PURE__ */ jsx22(
|
|
6150
6278
|
"button",
|
|
6151
6279
|
{
|
|
6152
6280
|
type: "button",
|
|
@@ -6157,7 +6285,7 @@ function createTreePlugin(options = {}) {
|
|
|
6157
6285
|
event.stopPropagation();
|
|
6158
6286
|
toggle(info.row.key, context);
|
|
6159
6287
|
},
|
|
6160
|
-
children: /* @__PURE__ */
|
|
6288
|
+
children: /* @__PURE__ */ jsx22(
|
|
6161
6289
|
Icon,
|
|
6162
6290
|
{
|
|
6163
6291
|
name: current(context).includes(info.row.key) ? "chevron-down" : "chevron-right",
|
|
@@ -6165,7 +6293,7 @@ function createTreePlugin(options = {}) {
|
|
|
6165
6293
|
}
|
|
6166
6294
|
)
|
|
6167
6295
|
}
|
|
6168
|
-
) : /* @__PURE__ */
|
|
6296
|
+
) : /* @__PURE__ */ jsx22("span", { className: "sia-table__tree-placeholder" }),
|
|
6169
6297
|
previousRender ? previousRender(value, record, index, info) : value
|
|
6170
6298
|
]
|
|
6171
6299
|
}
|
|
@@ -6218,11 +6346,11 @@ function EditableTableCell({
|
|
|
6218
6346
|
const config = typeof editable === "object" ? editable : { type: "input" };
|
|
6219
6347
|
const [editValue, setEditValue] = useState17(value);
|
|
6220
6348
|
const [saving, setSaving] = useState17(false);
|
|
6221
|
-
const inputRef =
|
|
6222
|
-
const editorRef =
|
|
6223
|
-
const editValueRef =
|
|
6224
|
-
const savingRef =
|
|
6225
|
-
const saveRef =
|
|
6349
|
+
const inputRef = useRef15(null);
|
|
6350
|
+
const editorRef = useRef15(null);
|
|
6351
|
+
const editValueRef = useRef15(value);
|
|
6352
|
+
const savingRef = useRef15(false);
|
|
6353
|
+
const saveRef = useRef15(
|
|
6226
6354
|
async () => {
|
|
6227
6355
|
}
|
|
6228
6356
|
);
|
|
@@ -6280,8 +6408,8 @@ function EditableTableCell({
|
|
|
6280
6408
|
onClick: trigger === "click" ? onStart : void 0,
|
|
6281
6409
|
onDoubleClick: trigger === "doubleClick" ? onStart : void 0,
|
|
6282
6410
|
children: [
|
|
6283
|
-
/* @__PURE__ */
|
|
6284
|
-
/* @__PURE__ */
|
|
6411
|
+
/* @__PURE__ */ jsx22("span", { children: content }),
|
|
6412
|
+
/* @__PURE__ */ jsx22(Icon, { name: "edit", size: 13 })
|
|
6285
6413
|
]
|
|
6286
6414
|
}
|
|
6287
6415
|
);
|
|
@@ -6289,7 +6417,7 @@ function EditableTableCell({
|
|
|
6289
6417
|
if (config.type === "custom" && config.editRender) {
|
|
6290
6418
|
editor = config.editRender(record, (next) => void save(next), onCancel);
|
|
6291
6419
|
} else if (config.type === "inputNumber") {
|
|
6292
|
-
editor = /* @__PURE__ */
|
|
6420
|
+
editor = /* @__PURE__ */ jsx22(
|
|
6293
6421
|
InputNumber,
|
|
6294
6422
|
{
|
|
6295
6423
|
ref: inputRef,
|
|
@@ -6310,7 +6438,7 @@ function EditableTableCell({
|
|
|
6310
6438
|
}
|
|
6311
6439
|
);
|
|
6312
6440
|
} else if (config.type === "select") {
|
|
6313
|
-
editor = /* @__PURE__ */
|
|
6441
|
+
editor = /* @__PURE__ */ jsx22(
|
|
6314
6442
|
Select,
|
|
6315
6443
|
{
|
|
6316
6444
|
size: "small",
|
|
@@ -6324,14 +6452,14 @@ function EditableTableCell({
|
|
|
6324
6452
|
}
|
|
6325
6453
|
);
|
|
6326
6454
|
} else {
|
|
6327
|
-
editor = /* @__PURE__ */
|
|
6455
|
+
editor = /* @__PURE__ */ jsx22(
|
|
6328
6456
|
Input,
|
|
6329
6457
|
{
|
|
6330
6458
|
ref: inputRef,
|
|
6331
6459
|
size: "small",
|
|
6332
6460
|
value: String(editValue ?? ""),
|
|
6333
6461
|
disabled: saving,
|
|
6334
|
-
suffix: saving ? /* @__PURE__ */
|
|
6462
|
+
suffix: saving ? /* @__PURE__ */ jsx22(Icon, { name: "loader", size: 13, spin: true }) : null,
|
|
6335
6463
|
onChange: (event) => updateEditValue(event.target.value),
|
|
6336
6464
|
onBlur: () => void save(),
|
|
6337
6465
|
onKeyDown: (event) => {
|
|
@@ -6341,7 +6469,7 @@ function EditableTableCell({
|
|
|
6341
6469
|
}
|
|
6342
6470
|
);
|
|
6343
6471
|
}
|
|
6344
|
-
return /* @__PURE__ */
|
|
6472
|
+
return /* @__PURE__ */ jsx22("div", { ref: editorRef, className: "sia-table__editor", children: editor });
|
|
6345
6473
|
}
|
|
6346
6474
|
function createEditablePlugin(options = {}) {
|
|
6347
6475
|
const trigger = options.trigger ?? "click";
|
|
@@ -6361,7 +6489,7 @@ function createEditablePlugin(options = {}) {
|
|
|
6361
6489
|
const active = canEdit && context.state.editing?.rowKey === info.row.key && context.state.editing.columnKey === column.key;
|
|
6362
6490
|
const content = previousRender ? previousRender(value, record, index, info) : value;
|
|
6363
6491
|
if (!canEdit) return content;
|
|
6364
|
-
return /* @__PURE__ */
|
|
6492
|
+
return /* @__PURE__ */ jsx22(
|
|
6365
6493
|
EditableTableCell,
|
|
6366
6494
|
{
|
|
6367
6495
|
active,
|
|
@@ -6425,8 +6553,8 @@ function createResizePlugin(options = {}) {
|
|
|
6425
6553
|
autoWidth,
|
|
6426
6554
|
width,
|
|
6427
6555
|
renderHeader: (currentColumn, coreContext) => /* @__PURE__ */ jsxs20("span", { className: "sia-table__resizable-header", children: [
|
|
6428
|
-
/* @__PURE__ */
|
|
6429
|
-
/* @__PURE__ */
|
|
6556
|
+
/* @__PURE__ */ jsx22("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
|
|
6557
|
+
/* @__PURE__ */ jsx22(
|
|
6430
6558
|
"span",
|
|
6431
6559
|
{
|
|
6432
6560
|
className: "sia-table__resize-handle",
|
|
@@ -6563,8 +6691,8 @@ function ColumnSettingPanel({
|
|
|
6563
6691
|
onApply
|
|
6564
6692
|
}) {
|
|
6565
6693
|
const [draft, setDraft] = useState17(items);
|
|
6566
|
-
const listRef =
|
|
6567
|
-
const cancelDrag =
|
|
6694
|
+
const listRef = useRef15(null);
|
|
6695
|
+
const cancelDrag = useRef15(null);
|
|
6568
6696
|
const [preview, setPreview] = useState17(null);
|
|
6569
6697
|
useEffect11(() => {
|
|
6570
6698
|
cancelDrag.current?.();
|
|
@@ -6707,8 +6835,8 @@ function ColumnSettingPanel({
|
|
|
6707
6835
|
if (!next) onClose();
|
|
6708
6836
|
},
|
|
6709
6837
|
footer: /* @__PURE__ */ jsxs20(Fragment7, { children: [
|
|
6710
|
-
/* @__PURE__ */
|
|
6711
|
-
/* @__PURE__ */
|
|
6838
|
+
/* @__PURE__ */ jsx22(Button, { onClick: onClose, children: "\u53D6\u6D88" }),
|
|
6839
|
+
/* @__PURE__ */ jsx22(
|
|
6712
6840
|
Button,
|
|
6713
6841
|
{
|
|
6714
6842
|
variant: "primary",
|
|
@@ -6721,9 +6849,9 @@ function ColumnSettingPanel({
|
|
|
6721
6849
|
children: [
|
|
6722
6850
|
loadError ? /* @__PURE__ */ jsxs20("p", { role: "alert", children: [
|
|
6723
6851
|
"\u8BFB\u53D6\u5217\u914D\u7F6E\u5931\u8D25\u3002",
|
|
6724
|
-
/* @__PURE__ */
|
|
6852
|
+
/* @__PURE__ */ jsx22(Button, { variant: "link", onClick: onRetry, children: "\u91CD\u8BD5" })
|
|
6725
6853
|
] }) : null,
|
|
6726
|
-
/* @__PURE__ */
|
|
6854
|
+
/* @__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
6855
|
"fieldset",
|
|
6728
6856
|
{
|
|
6729
6857
|
disabled: loading || loadError,
|
|
@@ -6731,7 +6859,7 @@ function ColumnSettingPanel({
|
|
|
6731
6859
|
"aria-busy": loading,
|
|
6732
6860
|
children: [
|
|
6733
6861
|
/* @__PURE__ */ jsxs20("label", { className: "sia-table-settings__all", children: [
|
|
6734
|
-
/* @__PURE__ */
|
|
6862
|
+
/* @__PURE__ */ jsx22(
|
|
6735
6863
|
TableCheckbox,
|
|
6736
6864
|
{
|
|
6737
6865
|
label: "\u5168\u9009\u5217",
|
|
@@ -6750,7 +6878,7 @@ function ColumnSettingPanel({
|
|
|
6750
6878
|
"\uFF09"
|
|
6751
6879
|
] })
|
|
6752
6880
|
] }),
|
|
6753
|
-
/* @__PURE__ */
|
|
6881
|
+
/* @__PURE__ */ jsx22(
|
|
6754
6882
|
"div",
|
|
6755
6883
|
{
|
|
6756
6884
|
ref: listRef,
|
|
@@ -6765,8 +6893,8 @@ function ColumnSettingPanel({
|
|
|
6765
6893
|
} : void 0,
|
|
6766
6894
|
onPointerDown: (event) => startSort(event, item.key),
|
|
6767
6895
|
children: [
|
|
6768
|
-
/* @__PURE__ */
|
|
6769
|
-
/* @__PURE__ */
|
|
6896
|
+
/* @__PURE__ */ jsx22(Icon, { name: "menu", size: 15 }),
|
|
6897
|
+
/* @__PURE__ */ jsx22(
|
|
6770
6898
|
TableCheckbox,
|
|
6771
6899
|
{
|
|
6772
6900
|
label: `\u663E\u793A${labels.get(item.key) ?? item.key}\u5217`,
|
|
@@ -6778,7 +6906,7 @@ function ColumnSettingPanel({
|
|
|
6778
6906
|
)
|
|
6779
6907
|
}
|
|
6780
6908
|
),
|
|
6781
|
-
/* @__PURE__ */
|
|
6909
|
+
/* @__PURE__ */ jsx22(
|
|
6782
6910
|
"span",
|
|
6783
6911
|
{
|
|
6784
6912
|
className: "sia-table-settings__name",
|
|
@@ -6786,7 +6914,7 @@ function ColumnSettingPanel({
|
|
|
6786
6914
|
}
|
|
6787
6915
|
),
|
|
6788
6916
|
/* @__PURE__ */ jsxs20("div", { className: "sia-table-settings__actions", children: [
|
|
6789
|
-
/* @__PURE__ */
|
|
6917
|
+
/* @__PURE__ */ jsx22(
|
|
6790
6918
|
Button,
|
|
6791
6919
|
{
|
|
6792
6920
|
size: "small",
|
|
@@ -6799,7 +6927,7 @@ function ColumnSettingPanel({
|
|
|
6799
6927
|
children: "\u5DE6"
|
|
6800
6928
|
}
|
|
6801
6929
|
),
|
|
6802
|
-
/* @__PURE__ */
|
|
6930
|
+
/* @__PURE__ */ jsx22(
|
|
6803
6931
|
Button,
|
|
6804
6932
|
{
|
|
6805
6933
|
size: "small",
|
|
@@ -6947,7 +7075,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
6947
7075
|
{
|
|
6948
7076
|
key: "builtin:export",
|
|
6949
7077
|
label: "\u8868\u683C\u5BFC\u51FA",
|
|
6950
|
-
icon: /* @__PURE__ */
|
|
7078
|
+
icon: /* @__PURE__ */ jsx22(Icon, { name: "download", size: 18 }),
|
|
6951
7079
|
disabled: exportApi().getRows().length === 0
|
|
6952
7080
|
},
|
|
6953
7081
|
{ key: "builtin:divider", type: "divider" }
|
|
@@ -6955,7 +7083,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
6955
7083
|
{
|
|
6956
7084
|
key: "builtin:columns",
|
|
6957
7085
|
label: "\u5217\u8BBE\u7F6E",
|
|
6958
|
-
icon: /* @__PURE__ */
|
|
7086
|
+
icon: /* @__PURE__ */ jsx22(Icon, { name: "settings", size: 18 })
|
|
6959
7087
|
},
|
|
6960
7088
|
...customItems.map((item) => ({
|
|
6961
7089
|
key: "custom:" + item.key,
|
|
@@ -6965,7 +7093,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
6965
7093
|
disabled: item.disabled === true || typeof item.disabled === "function" && item.disabled(context)
|
|
6966
7094
|
}))
|
|
6967
7095
|
];
|
|
6968
|
-
return /* @__PURE__ */
|
|
7096
|
+
return /* @__PURE__ */ jsx22(
|
|
6969
7097
|
Dropdown,
|
|
6970
7098
|
{
|
|
6971
7099
|
disabled: options.buttonProps?.disabled || options.buttonProps?.loading,
|
|
@@ -6982,12 +7110,12 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
6982
7110
|
void customItems.find((item) => "custom:" + item.key === key)?.onClick?.(context);
|
|
6983
7111
|
}
|
|
6984
7112
|
},
|
|
6985
|
-
children: /* @__PURE__ */
|
|
7113
|
+
children: /* @__PURE__ */ jsx22(
|
|
6986
7114
|
Button,
|
|
6987
7115
|
{
|
|
6988
7116
|
size: "small",
|
|
6989
7117
|
variant: "text",
|
|
6990
|
-
icon: /* @__PURE__ */
|
|
7118
|
+
icon: /* @__PURE__ */ jsx22(Icon, { name: "settings", size: 16 }),
|
|
6991
7119
|
"aria-label": "\u8868\u683C\u8BBE\u7F6E",
|
|
6992
7120
|
...options.buttonProps,
|
|
6993
7121
|
className: `sia-table__settings-button${options.buttonProps?.children == null ? " sia-table__toolbar-icon" : ""} ${options.buttonProps?.className ?? ""}`.trim()
|
|
@@ -6996,7 +7124,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
6996
7124
|
}
|
|
6997
7125
|
);
|
|
6998
7126
|
},
|
|
6999
|
-
renderOverlay: (context) => /* @__PURE__ */
|
|
7127
|
+
renderOverlay: (context) => /* @__PURE__ */ jsx22(
|
|
7000
7128
|
ColumnSettingPanel,
|
|
7001
7129
|
{
|
|
7002
7130
|
open: context.state.open,
|
|
@@ -7046,11 +7174,11 @@ function ToolbarItems({
|
|
|
7046
7174
|
items,
|
|
7047
7175
|
context
|
|
7048
7176
|
}) {
|
|
7049
|
-
return /* @__PURE__ */
|
|
7177
|
+
return /* @__PURE__ */ jsx22(Fragment7, { children: items.map((item) => {
|
|
7050
7178
|
if (item.hidden === true || typeof item.hidden === "function" && item.hidden(context))
|
|
7051
7179
|
return null;
|
|
7052
7180
|
const disabled = item.disabled === true || typeof item.disabled === "function" && item.disabled(context);
|
|
7053
|
-
return /* @__PURE__ */
|
|
7181
|
+
return /* @__PURE__ */ jsx22(
|
|
7054
7182
|
Button,
|
|
7055
7183
|
{
|
|
7056
7184
|
size: "small",
|
|
@@ -7074,14 +7202,14 @@ function createToolbarPlugin(options) {
|
|
|
7074
7202
|
order: 5,
|
|
7075
7203
|
renderToolbarStart: (context) => /* @__PURE__ */ jsxs20(Fragment7, { children: [
|
|
7076
7204
|
options.start,
|
|
7077
|
-
/* @__PURE__ */
|
|
7205
|
+
/* @__PURE__ */ jsx22(ToolbarItems, { items: items("start"), context })
|
|
7078
7206
|
] }),
|
|
7079
7207
|
renderToolbarEnd: (context) => /* @__PURE__ */ jsxs20(Fragment7, { children: [
|
|
7080
7208
|
options.end,
|
|
7081
|
-
/* @__PURE__ */
|
|
7209
|
+
/* @__PURE__ */ jsx22(ToolbarItems, { items: items("end"), context }),
|
|
7082
7210
|
items("end", true).length > 0 ? /* @__PURE__ */ jsxs20("details", { className: "sia-table__toolbar-menu", children: [
|
|
7083
|
-
/* @__PURE__ */
|
|
7084
|
-
/* @__PURE__ */
|
|
7211
|
+
/* @__PURE__ */ jsx22("summary", { "aria-label": "\u66F4\u591A\u8868\u683C\u64CD\u4F5C", children: /* @__PURE__ */ jsx22(Icon, { name: "more-horizontal", size: 16 }) }),
|
|
7212
|
+
/* @__PURE__ */ jsx22("div", { children: /* @__PURE__ */ jsx22(ToolbarItems, { items: items("end", true), context }) })
|
|
7085
7213
|
] }) : null
|
|
7086
7214
|
] })
|
|
7087
7215
|
};
|
|
@@ -7163,11 +7291,11 @@ function createExportPlugin(options = {}) {
|
|
|
7163
7291
|
return {
|
|
7164
7292
|
id: "export",
|
|
7165
7293
|
order: 95,
|
|
7166
|
-
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */
|
|
7294
|
+
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */ jsx22(
|
|
7167
7295
|
Button,
|
|
7168
7296
|
{
|
|
7169
7297
|
size: "small",
|
|
7170
|
-
icon: /* @__PURE__ */
|
|
7298
|
+
icon: /* @__PURE__ */ jsx22(Icon, { name: "download", size: 14 }),
|
|
7171
7299
|
disabled: getRows(context).length === 0,
|
|
7172
7300
|
onClick: () => void download(context),
|
|
7173
7301
|
children: options.buttonLabel ?? "\u5BFC\u51FA"
|
|
@@ -7182,7 +7310,7 @@ function createExportPlugin(options = {}) {
|
|
|
7182
7310
|
}
|
|
7183
7311
|
|
|
7184
7312
|
// src/components/Table/Table.tsx
|
|
7185
|
-
import { jsx as
|
|
7313
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
7186
7314
|
var EMPTY_DATA = [];
|
|
7187
7315
|
var EMPTY_COLUMNS = [];
|
|
7188
7316
|
var EMPTY_PLUGINS = [];
|
|
@@ -7272,6 +7400,8 @@ function getTableHorizontalMetrics(viewport, table) {
|
|
|
7272
7400
|
return { contentWidth, maxLeft: Math.max(0, contentWidth - viewport.clientWidth) };
|
|
7273
7401
|
}
|
|
7274
7402
|
var TableBodyRow = memo(function TableBodyRow2({
|
|
7403
|
+
canvas,
|
|
7404
|
+
visibleColumns,
|
|
7275
7405
|
row,
|
|
7276
7406
|
rowIndex,
|
|
7277
7407
|
columns,
|
|
@@ -7294,16 +7424,23 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
7294
7424
|
onCellPointerDown,
|
|
7295
7425
|
onCellPointerMove
|
|
7296
7426
|
}) {
|
|
7297
|
-
return /* @__PURE__ */
|
|
7427
|
+
return /* @__PURE__ */ jsx23(
|
|
7298
7428
|
"tr",
|
|
7299
7429
|
{
|
|
7430
|
+
"data-canvas-row-index": canvas ? rowIndex : void 0,
|
|
7300
7431
|
className: `sia-table__row${striped && rowIndex % 2 === 1 ? " sia-table__row--striped" : ""} ${className}`.trim(),
|
|
7301
7432
|
style: { height: rowHeight },
|
|
7302
7433
|
onClick,
|
|
7303
7434
|
onDoubleClick,
|
|
7304
7435
|
onMouseEnter,
|
|
7305
7436
|
onMouseLeave,
|
|
7306
|
-
children: columns.map((column) => {
|
|
7437
|
+
children: columns.map((column, columnIndex) => {
|
|
7438
|
+
if (canvas && !visibleColumns.has(column.key)) {
|
|
7439
|
+
if (columnIndex > 0 && !visibleColumns.has(columns[columnIndex - 1].key)) return null;
|
|
7440
|
+
let count = 1;
|
|
7441
|
+
while (columnIndex + count < columns.length && !visibleColumns.has(columns[columnIndex + count].key)) count++;
|
|
7442
|
+
return /* @__PURE__ */ jsx23("td", { colSpan: count, "aria-hidden": "true", style: { padding: 0 } }, `spacer-${column.key}`);
|
|
7443
|
+
}
|
|
7307
7444
|
const pluginCellProps = getCellProps(column);
|
|
7308
7445
|
if (pluginCellProps.hidden) return null;
|
|
7309
7446
|
const value = getTableValue(row.record, column.dataIndex, column.code ?? column.key);
|
|
@@ -7312,10 +7449,12 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
7312
7449
|
const fixedStyle = fixed === "left" ? { left: leftOffsets.get(column.key) } : fixed === "right" ? { right: rightOffsets.get(column.key) } : void 0;
|
|
7313
7450
|
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
7451
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
7315
|
-
return /* @__PURE__ */
|
|
7452
|
+
return /* @__PURE__ */ jsx23(
|
|
7316
7453
|
"td",
|
|
7317
7454
|
{
|
|
7318
7455
|
"data-column-key": column.key,
|
|
7456
|
+
"data-canvas-dom-ready": canvas && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? "true" : void 0,
|
|
7457
|
+
"aria-label": canvas ? column.canvasRender?.(value, row.record, row.sourceIndex, { row, rowIndex, column })?.text ?? (value == null ? "" : String(value)) : void 0,
|
|
7319
7458
|
rowSpan: pluginCellProps.rowSpan,
|
|
7320
7459
|
colSpan: pluginCellProps.colSpan,
|
|
7321
7460
|
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 +7465,14 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
7326
7465
|
onContextMenu: (event) => onCellContextMenu(column, event),
|
|
7327
7466
|
onPointerDown: (event) => onCellPointerDown(column, event),
|
|
7328
7467
|
onPointerMove: (event) => onCellPointerMove(column, event),
|
|
7329
|
-
children: /* @__PURE__ */
|
|
7468
|
+
children: !canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? /* @__PURE__ */ jsx23(
|
|
7330
7469
|
TableCellContent,
|
|
7331
7470
|
{
|
|
7332
7471
|
ellipsis: column.ellipsis !== false,
|
|
7333
7472
|
title: column.showTitle === true && column.ellipsis !== false && typeof value === "string" ? value : void 0,
|
|
7334
7473
|
children: pluginCellProps.content !== void 0 ? pluginCellProps.content : column.render ? column.render(value, row.record, row.sourceIndex, { row, rowIndex, column }) : value
|
|
7335
7474
|
}
|
|
7336
|
-
)
|
|
7475
|
+
) : null
|
|
7337
7476
|
},
|
|
7338
7477
|
column.key
|
|
7339
7478
|
);
|
|
@@ -7358,6 +7497,7 @@ function TableInner(props, ref) {
|
|
|
7358
7497
|
toolbarBordered = false,
|
|
7359
7498
|
striped = true,
|
|
7360
7499
|
virtual,
|
|
7500
|
+
renderMode = "dom",
|
|
7361
7501
|
virtualThreshold = 100,
|
|
7362
7502
|
rowHeight = SIZE_ROW_HEIGHT[size],
|
|
7363
7503
|
overscan = 6,
|
|
@@ -7374,13 +7514,14 @@ function TableInner(props, ref) {
|
|
|
7374
7514
|
style,
|
|
7375
7515
|
...htmlProps
|
|
7376
7516
|
} = props;
|
|
7377
|
-
const rootRef =
|
|
7378
|
-
const scrollRef =
|
|
7379
|
-
const tableRef =
|
|
7517
|
+
const rootRef = useRef16(null);
|
|
7518
|
+
const scrollRef = useRef16(null);
|
|
7519
|
+
const tableRef = useRef16(null);
|
|
7380
7520
|
useScrollbarProximity();
|
|
7381
|
-
const scrollbarDragRef =
|
|
7521
|
+
const scrollbarDragRef = useRef16(null);
|
|
7382
7522
|
const [internalLoading, setInternalLoading] = useState18(false);
|
|
7383
7523
|
const [scrollTop, setScrollTop] = useState18(0);
|
|
7524
|
+
const [scrollLeft, setScrollLeft] = useState18(0);
|
|
7384
7525
|
const [viewportHeight, setViewportHeight] = useState18(420);
|
|
7385
7526
|
const [viewportWidth, setViewportWidth] = useState18(0);
|
|
7386
7527
|
const [autoColumnWidths, setAutoColumnWidths] = useState18({});
|
|
@@ -7398,14 +7539,14 @@ function TableInner(props, ref) {
|
|
|
7398
7539
|
return plugins;
|
|
7399
7540
|
}, [builtInHighlightPlugin, builtInResizePlugin, builtInCellSelectionPlugin, builtInIndexPlugin, providedPlugins, resizable, cellSelection, showIndex]);
|
|
7400
7541
|
const sortedPlugins = useMemo9(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
|
|
7401
|
-
const pluginsByIdRef =
|
|
7542
|
+
const pluginsByIdRef = useRef16(/* @__PURE__ */ new Map());
|
|
7402
7543
|
pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
7403
7544
|
const [pluginStates, setPluginStates] = useState18(() => Object.fromEntries(
|
|
7404
7545
|
sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
|
|
7405
7546
|
));
|
|
7406
|
-
const pluginApisRef =
|
|
7407
|
-
const contextsRef =
|
|
7408
|
-
const mountedPluginsRef =
|
|
7547
|
+
const pluginApisRef = useRef16({});
|
|
7548
|
+
const contextsRef = useRef16(/* @__PURE__ */ new Map());
|
|
7549
|
+
const mountedPluginsRef = useRef16(/* @__PURE__ */ new Map());
|
|
7409
7550
|
const pipeline = { columns: baseColumns, rows: createTableRows(dataSource, getRowKey) };
|
|
7410
7551
|
const nextApis = {};
|
|
7411
7552
|
const contexts = /* @__PURE__ */ new Map();
|
|
@@ -7537,7 +7678,7 @@ function TableInner(props, ref) {
|
|
|
7537
7678
|
const orderedColumns = useMemo9(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
|
|
7538
7679
|
const leafColumns = useMemo9(() => flattenTableColumns(orderedColumns), [orderedColumns]);
|
|
7539
7680
|
const headerRows = useMemo9(() => buildHeaderRows(orderedColumns), [orderedColumns]);
|
|
7540
|
-
const measuredCells =
|
|
7681
|
+
const measuredCells = useRef16(/* @__PURE__ */ new WeakSet());
|
|
7541
7682
|
const autoWidthSignature = leafColumns.map((column) => `${column.key}:${column.autoWidth}:${resizedWidths[column.key] ?? ""}`).join("|");
|
|
7542
7683
|
useEffect12(() => {
|
|
7543
7684
|
measuredCells.current = /* @__PURE__ */ new WeakSet();
|
|
@@ -7612,11 +7753,19 @@ function TableInner(props, ref) {
|
|
|
7612
7753
|
}
|
|
7613
7754
|
const leftFixedEdgeKey = [...leafColumns].reverse().find((column) => normalizeFixed(column.fixed) === "left")?.key;
|
|
7614
7755
|
const rightFixedEdgeKey = leafColumns.find((column) => normalizeFixed(column.fixed) === "right")?.key;
|
|
7615
|
-
const
|
|
7756
|
+
const canvas = renderMode === "canvas" && !sortedPlugins.some((plugin) => plugin.disableVirtual);
|
|
7757
|
+
const shouldVirtualize = canvas || pipeline.rows.length > 100 || (virtual ?? pipeline.rows.length >= virtualThreshold) && !sortedPlugins.some((plugin) => plugin.disableVirtual);
|
|
7616
7758
|
const startIndex = shouldVirtualize ? Math.max(0, Math.floor(scrollTop / rowHeight) - overscan) : 0;
|
|
7617
7759
|
const visibleCount = shouldVirtualize ? Math.ceil(viewportHeight / rowHeight) + overscan * 2 : pipeline.rows.length;
|
|
7618
7760
|
const endIndex = shouldVirtualize ? Math.min(pipeline.rows.length, startIndex + visibleCount) : pipeline.rows.length;
|
|
7619
7761
|
const renderedRows = pipeline.rows.slice(startIndex, endIndex);
|
|
7762
|
+
const visibleColumns = /* @__PURE__ */ new Set();
|
|
7763
|
+
let columnLeft = 0;
|
|
7764
|
+
for (const column of leafColumns) {
|
|
7765
|
+
const width = columnWidths.get(column.key) ?? DEFAULT_WIDTH;
|
|
7766
|
+
if (normalizeFixed(column.fixed) || columnLeft + width >= scrollLeft && columnLeft <= scrollLeft + viewportWidth) visibleColumns.add(column.key);
|
|
7767
|
+
columnLeft += width;
|
|
7768
|
+
}
|
|
7620
7769
|
const topSpacer = shouldVirtualize ? startIndex * rowHeight : 0;
|
|
7621
7770
|
const bottomSpacer = shouldVirtualize ? Math.max(0, (pipeline.rows.length - endIndex) * rowHeight) : 0;
|
|
7622
7771
|
const rowElements = useMemo9(() => /* @__PURE__ */ new Map(), [
|
|
@@ -7630,26 +7779,28 @@ function TableInner(props, ref) {
|
|
|
7630
7779
|
striped,
|
|
7631
7780
|
rowClassName,
|
|
7632
7781
|
getRowKey,
|
|
7782
|
+
canvas,
|
|
7783
|
+
scrollLeft,
|
|
7633
7784
|
onRowClick,
|
|
7634
7785
|
onRowDoubleClick,
|
|
7635
7786
|
onCellContextMenu
|
|
7636
7787
|
]);
|
|
7637
7788
|
const toolbarStart = sortedPlugins.map((plugin) => {
|
|
7638
7789
|
const content = plugin.renderToolbarStart?.(getContext(plugin));
|
|
7639
|
-
return content ? /* @__PURE__ */
|
|
7790
|
+
return content ? /* @__PURE__ */ jsx23(Fragment8, { children: content }, `toolbar-start-${plugin.id}`) : null;
|
|
7640
7791
|
}).filter(Boolean);
|
|
7641
7792
|
const toolbarEnd = sortedPlugins.map((plugin) => {
|
|
7642
7793
|
const content = plugin.renderToolbarEnd?.(getContext(plugin));
|
|
7643
|
-
return content ? /* @__PURE__ */
|
|
7794
|
+
return content ? /* @__PURE__ */ jsx23(Fragment8, { children: content }, `toolbar-end-${plugin.id}`) : null;
|
|
7644
7795
|
}).filter(Boolean);
|
|
7645
7796
|
const summaries = sortedPlugins.flatMap((plugin) => plugin.renderSummary?.(getContext(plugin)) ?? []);
|
|
7646
7797
|
const footers = sortedPlugins.map((plugin) => {
|
|
7647
7798
|
const content = plugin.renderFooter?.(getContext(plugin));
|
|
7648
|
-
return content ? /* @__PURE__ */
|
|
7799
|
+
return content ? /* @__PURE__ */ jsx23(Fragment8, { children: content }, `footer-${plugin.id}`) : null;
|
|
7649
7800
|
}).filter(Boolean);
|
|
7650
7801
|
const overlays = sortedPlugins.map((plugin) => {
|
|
7651
7802
|
const content = plugin.renderOverlay?.(getContext(plugin));
|
|
7652
|
-
return content ? /* @__PURE__ */
|
|
7803
|
+
return content ? /* @__PURE__ */ jsx23(Fragment8, { children: content }, `overlay-${plugin.id}`) : null;
|
|
7653
7804
|
}).filter(Boolean);
|
|
7654
7805
|
const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
|
|
7655
7806
|
const effectiveHeight = height ?? tableHeight ?? (shouldVirtualize ? 420 : void 0);
|
|
@@ -7661,8 +7812,9 @@ function TableInner(props, ref) {
|
|
|
7661
7812
|
const handleScroll = useCallback2((event) => {
|
|
7662
7813
|
const element = event.currentTarget;
|
|
7663
7814
|
if (shouldVirtualize) setScrollTop((previous) => Math.floor(previous / rowHeight) === Math.floor(element.scrollTop / rowHeight) ? previous : element.scrollTop);
|
|
7815
|
+
if (canvas) setScrollLeft(element.scrollLeft);
|
|
7664
7816
|
updateScrollMetrics();
|
|
7665
|
-
}, [shouldVirtualize, rowHeight, updateScrollMetrics]);
|
|
7817
|
+
}, [canvas, shouldVirtualize, rowHeight, updateScrollMetrics]);
|
|
7666
7818
|
const handleScrollbarPointerDown = useCallback2((axis, event, track = event.currentTarget) => {
|
|
7667
7819
|
const element = scrollRef.current;
|
|
7668
7820
|
const thumb = track.firstElementChild;
|
|
@@ -7746,8 +7898,8 @@ function TableInner(props, ref) {
|
|
|
7746
7898
|
function renderHeaderContent(column, content) {
|
|
7747
7899
|
const title = getHeaderTitleText(column.title ?? column.name) || column.name || column.key;
|
|
7748
7900
|
return /* @__PURE__ */ jsxs21("span", { className: "sia-table__header-label", children: [
|
|
7749
|
-
/* @__PURE__ */
|
|
7750
|
-
column.description != null && /* @__PURE__ */
|
|
7901
|
+
/* @__PURE__ */ jsx23("span", { className: "sia-table__header-label-content", ...withTitleTooltip({ title }), children: content }),
|
|
7902
|
+
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
7903
|
] });
|
|
7752
7904
|
}
|
|
7753
7905
|
function getPluginCellProps(row, column) {
|
|
@@ -7787,14 +7939,14 @@ function TableInner(props, ref) {
|
|
|
7787
7939
|
}
|
|
7788
7940
|
function renderSummaryRow(summary) {
|
|
7789
7941
|
let labelRendered = false;
|
|
7790
|
-
return /* @__PURE__ */
|
|
7942
|
+
return /* @__PURE__ */ jsx23("tr", { className: `sia-table__summary-row ${summary.className ?? ""}`.trim(), children: leafColumns.map((column) => {
|
|
7791
7943
|
const value = summary.values[column.key];
|
|
7792
7944
|
const isLabel = value === void 0 && !labelRendered && summary.label !== void 0;
|
|
7793
7945
|
const content = value !== void 0 ? value : isLabel ? (labelRendered = true, summary.label) : null;
|
|
7794
7946
|
const fixed = normalizeFixed(column.fixed);
|
|
7795
7947
|
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
7948
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
7797
|
-
return /* @__PURE__ */
|
|
7949
|
+
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
7950
|
}) }, summary.key);
|
|
7799
7951
|
}
|
|
7800
7952
|
return /* @__PURE__ */ jsxs21(
|
|
@@ -7804,6 +7956,7 @@ function TableInner(props, ref) {
|
|
|
7804
7956
|
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
7957
|
style: rootStyle,
|
|
7806
7958
|
"data-has-fixed-left": left > 0,
|
|
7959
|
+
"data-render-mode": canvas ? "canvas" : "dom",
|
|
7807
7960
|
"data-has-fixed-right": right > 0,
|
|
7808
7961
|
"data-scrolled-left": "false",
|
|
7809
7962
|
"data-scrolled-right": "true",
|
|
@@ -7848,18 +8001,18 @@ function TableInner(props, ref) {
|
|
|
7848
8001
|
},
|
|
7849
8002
|
children: [
|
|
7850
8003
|
hasToolbar ? /* @__PURE__ */ jsxs21("div", { className: "sia-table__toolbar", children: [
|
|
7851
|
-
/* @__PURE__ */
|
|
7852
|
-
/* @__PURE__ */
|
|
8004
|
+
/* @__PURE__ */ jsx23("div", { children: toolbarStart }),
|
|
8005
|
+
/* @__PURE__ */ jsx23("div", { children: toolbarEnd })
|
|
7853
8006
|
] }) : null,
|
|
7854
8007
|
/* @__PURE__ */ jsxs21("div", { className: "sia-table__viewport-wrap", children: [
|
|
7855
|
-
/* @__PURE__ */
|
|
7856
|
-
/* @__PURE__ */
|
|
7857
|
-
/* @__PURE__ */
|
|
8008
|
+
/* @__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: [
|
|
8009
|
+
/* @__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)) }),
|
|
8010
|
+
/* @__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
8011
|
const fixed = cell.fixed;
|
|
7859
8012
|
const pluginHeaderProps = getPluginHeaderCellProps(cell.column);
|
|
7860
8013
|
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
8014
|
const autoWidthClass = cell.column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
7862
|
-
return /* @__PURE__ */
|
|
8015
|
+
return /* @__PURE__ */ jsx23(
|
|
7863
8016
|
"th",
|
|
7864
8017
|
{
|
|
7865
8018
|
"data-column-key": cell.column.key,
|
|
@@ -7881,16 +8034,18 @@ function TableInner(props, ref) {
|
|
|
7881
8034
|
);
|
|
7882
8035
|
}) }, depth)) }),
|
|
7883
8036
|
/* @__PURE__ */ jsxs21("tbody", { children: [
|
|
7884
|
-
topSpacer > 0 ? /* @__PURE__ */
|
|
8037
|
+
topSpacer > 0 ? /* @__PURE__ */ jsx23("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx23("td", { colSpan: leafColumns.length, style: { height: topSpacer, padding: 0, border: 0 } }) }) : null,
|
|
7885
8038
|
renderedRows.map((row, offset) => {
|
|
7886
8039
|
const cached = rowElements.get(row.key);
|
|
7887
8040
|
if (cached) return cached;
|
|
7888
8041
|
const rowIndex = startIndex + offset;
|
|
7889
8042
|
const pluginClasses = sortedPlugins.map((plugin) => plugin.getRowClassName?.(row, getContext(plugin))).filter(Boolean).join(" ");
|
|
7890
8043
|
const customClass = typeof rowClassName === "function" ? rowClassName(row.record, row.sourceIndex) : rowClassName ?? "";
|
|
7891
|
-
const element = /* @__PURE__ */
|
|
8044
|
+
const element = /* @__PURE__ */ jsx23(
|
|
7892
8045
|
TableBodyRow,
|
|
7893
8046
|
{
|
|
8047
|
+
canvas,
|
|
8048
|
+
visibleColumns,
|
|
7894
8049
|
row,
|
|
7895
8050
|
rowIndex,
|
|
7896
8051
|
columns: leafColumns,
|
|
@@ -7937,12 +8092,13 @@ function TableInner(props, ref) {
|
|
|
7937
8092
|
rowElements.set(row.key, element);
|
|
7938
8093
|
return element;
|
|
7939
8094
|
}),
|
|
7940
|
-
bottomSpacer > 0 ? /* @__PURE__ */
|
|
8095
|
+
bottomSpacer > 0 ? /* @__PURE__ */ jsx23("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx23("td", { colSpan: leafColumns.length, style: { height: bottomSpacer, padding: 0, border: 0 } }) }) : null
|
|
7941
8096
|
] }),
|
|
7942
|
-
summaries.length > 0 ? /* @__PURE__ */
|
|
8097
|
+
summaries.length > 0 ? /* @__PURE__ */ jsx23("tfoot", { className: "sia-table__summary", children: summaries.map(renderSummaryRow) }) : null
|
|
7943
8098
|
] }) }),
|
|
7944
|
-
pipeline.rows.length === 0 ? /* @__PURE__ */
|
|
7945
|
-
/* @__PURE__ */
|
|
8099
|
+
pipeline.rows.length === 0 ? /* @__PURE__ */ jsx23("div", { className: "sia-table__empty", role: "status", children: emptyText }) : null,
|
|
8100
|
+
canvas ? /* @__PURE__ */ jsx23(TableCanvasLayer, { viewport: scrollRef, rows: pipeline.rows, columns: leafColumns, widths: columnWidths, rowHeight, headerHeight: headerRows.length * rowHeight }) : null,
|
|
8101
|
+
/* @__PURE__ */ jsx23(
|
|
7946
8102
|
"div",
|
|
7947
8103
|
{
|
|
7948
8104
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--horizontal",
|
|
@@ -7953,10 +8109,10 @@ function TableInner(props, ref) {
|
|
|
7953
8109
|
onPointerMove: handleScrollbarPointerMove,
|
|
7954
8110
|
onPointerUp: handleScrollbarPointerEnd,
|
|
7955
8111
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
7956
|
-
children: /* @__PURE__ */
|
|
8112
|
+
children: /* @__PURE__ */ jsx23("div", { className: "sia-table__scrollbar-thumb" })
|
|
7957
8113
|
}
|
|
7958
8114
|
),
|
|
7959
|
-
/* @__PURE__ */
|
|
8115
|
+
/* @__PURE__ */ jsx23(
|
|
7960
8116
|
"div",
|
|
7961
8117
|
{
|
|
7962
8118
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--vertical",
|
|
@@ -7967,14 +8123,14 @@ function TableInner(props, ref) {
|
|
|
7967
8123
|
onPointerMove: handleScrollbarPointerMove,
|
|
7968
8124
|
onPointerUp: handleScrollbarPointerEnd,
|
|
7969
8125
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
7970
|
-
children: /* @__PURE__ */
|
|
8126
|
+
children: /* @__PURE__ */ jsx23("div", { className: "sia-table__scrollbar-thumb" })
|
|
7971
8127
|
}
|
|
7972
8128
|
)
|
|
7973
8129
|
] }),
|
|
7974
|
-
footers.length > 0 ? /* @__PURE__ */
|
|
8130
|
+
footers.length > 0 ? /* @__PURE__ */ jsx23("div", { className: "sia-table__footer", children: footers }) : null,
|
|
7975
8131
|
loading || internalLoading ? /* @__PURE__ */ jsxs21("div", { className: "sia-table__loading", role: "status", children: [
|
|
7976
|
-
/* @__PURE__ */
|
|
7977
|
-
/* @__PURE__ */
|
|
8132
|
+
/* @__PURE__ */ jsx23(Icon, { name: "loader", size: 22, spin: true }),
|
|
8133
|
+
/* @__PURE__ */ jsx23("span", { children: "\u52A0\u8F7D\u4E2D" })
|
|
7978
8134
|
] }) : null,
|
|
7979
8135
|
overlays
|
|
7980
8136
|
]
|
|
@@ -7985,7 +8141,7 @@ var Table = forwardRef5(TableInner);
|
|
|
7985
8141
|
|
|
7986
8142
|
// src/components/ThemeSwitch.tsx
|
|
7987
8143
|
import { forwardRef as forwardRef6 } from "react";
|
|
7988
|
-
import { jsx as
|
|
8144
|
+
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
7989
8145
|
var ThemeSwitch = forwardRef6(function ThemeSwitch2({
|
|
7990
8146
|
checked,
|
|
7991
8147
|
onCheckedChange,
|
|
@@ -8011,12 +8167,12 @@ var ThemeSwitch = forwardRef6(function ThemeSwitch2({
|
|
|
8011
8167
|
onClick: handleClick,
|
|
8012
8168
|
...withTitleTooltip(props),
|
|
8013
8169
|
children: [
|
|
8014
|
-
/* @__PURE__ */
|
|
8015
|
-
/* @__PURE__ */
|
|
8016
|
-
/* @__PURE__ */
|
|
8017
|
-
/* @__PURE__ */
|
|
8170
|
+
/* @__PURE__ */ jsx24("span", { className: "sia-theme-switch__selection", "aria-hidden": "true" }),
|
|
8171
|
+
/* @__PURE__ */ jsx24("span", { className: `sia-theme-switch__icon${checked ? "" : " is-active"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxs22("svg", { viewBox: "0 0 24 24", children: [
|
|
8172
|
+
/* @__PURE__ */ jsx24("circle", { cx: "12", cy: "12", r: "3.5" }),
|
|
8173
|
+
/* @__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
8174
|
] }) }),
|
|
8019
|
-
/* @__PURE__ */
|
|
8175
|
+
/* @__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
8176
|
]
|
|
8021
8177
|
}
|
|
8022
8178
|
);
|
|
@@ -8059,8 +8215,8 @@ function applySiaTheme(mode, target = document.documentElement) {
|
|
|
8059
8215
|
}
|
|
8060
8216
|
|
|
8061
8217
|
// src/components/InputSelect.tsx
|
|
8062
|
-
import { forwardRef as forwardRef7, useEffect as useEffect13, useRef as
|
|
8063
|
-
import { jsx as
|
|
8218
|
+
import { forwardRef as forwardRef7, useEffect as useEffect13, useRef as useRef17, useState as useState19 } from "react";
|
|
8219
|
+
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
8064
8220
|
var InputSelect = forwardRef7(function InputSelect2({
|
|
8065
8221
|
options,
|
|
8066
8222
|
value,
|
|
@@ -8100,9 +8256,9 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8100
8256
|
const [modalOpen, setModalOpen] = useState19(false);
|
|
8101
8257
|
const [modalValues, setModalValues] = useState19([]);
|
|
8102
8258
|
const [selectedOnly, setSelectedOnly] = useState19(false);
|
|
8103
|
-
const rootRef =
|
|
8104
|
-
const popupRef =
|
|
8105
|
-
const inputRef =
|
|
8259
|
+
const rootRef = useRef17(null);
|
|
8260
|
+
const popupRef = useRef17(null);
|
|
8261
|
+
const inputRef = useRef17(null);
|
|
8106
8262
|
const config = typeof enableModal === "object" ? enableModal : {};
|
|
8107
8263
|
function changeOpen(next) {
|
|
8108
8264
|
if (next && (disabled || loading)) return;
|
|
@@ -8150,7 +8306,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8150
8306
|
inputRef.current?.focus();
|
|
8151
8307
|
}
|
|
8152
8308
|
}, children: [
|
|
8153
|
-
/* @__PURE__ */
|
|
8309
|
+
/* @__PURE__ */ jsx25(
|
|
8154
8310
|
Input,
|
|
8155
8311
|
{
|
|
8156
8312
|
...inputProps,
|
|
@@ -8188,25 +8344,25 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8188
8344
|
changeOpen(true);
|
|
8189
8345
|
},
|
|
8190
8346
|
suffix: /* @__PURE__ */ jsxs23("span", { className: "sia-input-select__suffix", children: [
|
|
8191
|
-
allowClear && draft && !disabled && /* @__PURE__ */
|
|
8347
|
+
allowClear && draft && !disabled && /* @__PURE__ */ jsx25(Button, { variant: "text", size: "small", disabled: loading, "aria-label": "\u6E05\u9664\u8F93\u5165\u9009\u62E9", onClick: (event) => {
|
|
8192
8348
|
event.stopPropagation();
|
|
8193
8349
|
setDraft("");
|
|
8194
8350
|
emit(multiple ? [] : void 0);
|
|
8195
8351
|
inputRef.current?.focus();
|
|
8196
8352
|
}, children: "\xD7" }),
|
|
8197
8353
|
suffix,
|
|
8198
|
-
enableModal && /* @__PURE__ */
|
|
8354
|
+
enableModal && /* @__PURE__ */ jsx25(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
|
|
8199
8355
|
event.stopPropagation();
|
|
8200
8356
|
openModal();
|
|
8201
8357
|
}, children: "\u2026" }),
|
|
8202
|
-
/* @__PURE__ */
|
|
8358
|
+
/* @__PURE__ */ jsx25(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
|
|
8203
8359
|
event.stopPropagation();
|
|
8204
8360
|
changeOpen(!open);
|
|
8205
|
-
}, children: /* @__PURE__ */
|
|
8361
|
+
}, children: /* @__PURE__ */ jsx25(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
|
|
8206
8362
|
] })
|
|
8207
8363
|
}
|
|
8208
8364
|
),
|
|
8209
|
-
/* @__PURE__ */
|
|
8365
|
+
/* @__PURE__ */ jsx25(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx25(
|
|
8210
8366
|
SelectionPanel,
|
|
8211
8367
|
{
|
|
8212
8368
|
options,
|
|
@@ -8235,14 +8391,14 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8235
8391
|
},
|
|
8236
8392
|
children: [
|
|
8237
8393
|
/* @__PURE__ */ jsxs23("div", { className: "sia-selection-panel__actions", role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
8238
|
-
/* @__PURE__ */
|
|
8394
|
+
/* @__PURE__ */ jsx25(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
8239
8395
|
/* @__PURE__ */ jsxs23(Button, { role: "tab", "aria-selected": selectedOnly, variant: selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(true), children: [
|
|
8240
8396
|
"\u5DF2\u9009\u9879(",
|
|
8241
8397
|
modalValues.length,
|
|
8242
8398
|
")"
|
|
8243
8399
|
] })
|
|
8244
8400
|
] }),
|
|
8245
|
-
modalOpen && /* @__PURE__ */
|
|
8401
|
+
modalOpen && /* @__PURE__ */ jsx25(
|
|
8246
8402
|
SelectionPanel,
|
|
8247
8403
|
{
|
|
8248
8404
|
options,
|
|
@@ -8263,8 +8419,8 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8263
8419
|
});
|
|
8264
8420
|
|
|
8265
8421
|
// src/components/QueryForm.tsx
|
|
8266
|
-
import { Children as Children4, useLayoutEffect as
|
|
8267
|
-
import { jsx as
|
|
8422
|
+
import { Children as Children4, useLayoutEffect as useLayoutEffect4, useRef as useRef18, useState as useState20 } from "react";
|
|
8423
|
+
import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
8268
8424
|
function QueryForm({
|
|
8269
8425
|
fields,
|
|
8270
8426
|
children,
|
|
@@ -8307,19 +8463,19 @@ function QueryForm({
|
|
|
8307
8463
|
const [saveError, setSaveError] = useState20("");
|
|
8308
8464
|
const [error, setError] = useState20("");
|
|
8309
8465
|
const [activeShortcut, setActiveShortcut] = useState20("");
|
|
8310
|
-
const source =
|
|
8311
|
-
const searchLock =
|
|
8312
|
-
const saveLock =
|
|
8313
|
-
const removeLock =
|
|
8314
|
-
const snapshot =
|
|
8466
|
+
const source = useRef18({ source: "submit" });
|
|
8467
|
+
const searchLock = useRef18(false);
|
|
8468
|
+
const saveLock = useRef18(false);
|
|
8469
|
+
const removeLock = useRef18(false);
|
|
8470
|
+
const snapshot = useRef18();
|
|
8315
8471
|
const busy = disabled || loading || searching;
|
|
8316
8472
|
const shortcutBusy = busy || shortcutsLoading || saving || removing;
|
|
8317
|
-
const entries = fields ? fields.map(({ key, width, ...item }) => ({ key, width, content: /* @__PURE__ */
|
|
8473
|
+
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
8474
|
const limit = Math.max(1, Math.floor(collapsedCount));
|
|
8319
|
-
const rowRef =
|
|
8320
|
-
const actionsRef =
|
|
8475
|
+
const rowRef = useRef18(null);
|
|
8476
|
+
const actionsRef = useRef18(null);
|
|
8321
8477
|
const [fittingCount, setFittingCount] = useState20(limit);
|
|
8322
|
-
|
|
8478
|
+
useLayoutEffect4(() => {
|
|
8323
8479
|
if (!collapsed) return;
|
|
8324
8480
|
const row = rowRef.current;
|
|
8325
8481
|
const actions = actionsRef.current;
|
|
@@ -8439,7 +8595,7 @@ function QueryForm({
|
|
|
8439
8595
|
},
|
|
8440
8596
|
children: [
|
|
8441
8597
|
quickQueries.length ? /* @__PURE__ */ jsxs24("div", { className: "sia-query-form__quick", "aria-label": "\u9884\u8BBE\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
8442
|
-
quickQueries.map((query) => /* @__PURE__ */
|
|
8598
|
+
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
8599
|
Button,
|
|
8444
8600
|
{
|
|
8445
8601
|
size: query.size ?? quickQuerySize,
|
|
@@ -8453,7 +8609,7 @@ function QueryForm({
|
|
|
8453
8609
|
" "
|
|
8454
8610
|
] }) : null,
|
|
8455
8611
|
/* @__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__ */
|
|
8612
|
+
entries.map((entry, index) => /* @__PURE__ */ jsx26(
|
|
8457
8613
|
"div",
|
|
8458
8614
|
{
|
|
8459
8615
|
className: "sia-query-form__field",
|
|
@@ -8465,21 +8621,21 @@ function QueryForm({
|
|
|
8465
8621
|
)),
|
|
8466
8622
|
/* @__PURE__ */ jsxs24("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
|
|
8467
8623
|
/* @__PURE__ */ jsxs24(Space.Compact, { children: [
|
|
8468
|
-
/* @__PURE__ */
|
|
8469
|
-
/* @__PURE__ */
|
|
8470
|
-
onSaveQuery ? /* @__PURE__ */
|
|
8624
|
+
/* @__PURE__ */ jsx26(Button, { type: "submit", variant: "primary", loading: loading || searching, disabled, children: searchText }),
|
|
8625
|
+
/* @__PURE__ */ jsx26(Button, { disabled: busy, onClick: reset, children: resetText }),
|
|
8626
|
+
onSaveQuery ? /* @__PURE__ */ jsx26(Button, { disabled: shortcutBusy, onClick: () => {
|
|
8471
8627
|
snapshot.current = form.getFieldsValue();
|
|
8472
8628
|
setSaveName("");
|
|
8473
8629
|
setSaveError("");
|
|
8474
8630
|
setSaveOpen(true);
|
|
8475
8631
|
}, children: saveText }) : null
|
|
8476
8632
|
] }),
|
|
8477
|
-
collapsible && entries.length > 0 ? /* @__PURE__ */
|
|
8633
|
+
collapsible && entries.length > 0 ? /* @__PURE__ */ jsx26(
|
|
8478
8634
|
Button,
|
|
8479
8635
|
{
|
|
8480
8636
|
variant: "link",
|
|
8481
8637
|
"aria-expanded": !collapsed,
|
|
8482
|
-
icon: /* @__PURE__ */
|
|
8638
|
+
icon: /* @__PURE__ */ jsx26(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
|
|
8483
8639
|
iconPosition: "end",
|
|
8484
8640
|
onClick: () => {
|
|
8485
8641
|
setInternalCollapsed(!collapsed);
|
|
@@ -8492,7 +8648,7 @@ function QueryForm({
|
|
|
8492
8648
|
] })
|
|
8493
8649
|
] }),
|
|
8494
8650
|
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__ */
|
|
8651
|
+
savedQueries.map((query, index) => /* @__PURE__ */ jsx26(
|
|
8496
8652
|
Tag,
|
|
8497
8653
|
{
|
|
8498
8654
|
status: query.status ?? ["processing", "success", "warning", "error"][index % 4],
|
|
@@ -8518,14 +8674,14 @@ function QueryForm({
|
|
|
8518
8674
|
)),
|
|
8519
8675
|
" "
|
|
8520
8676
|
] }) : null,
|
|
8521
|
-
error ? /* @__PURE__ */
|
|
8677
|
+
error ? /* @__PURE__ */ jsx26("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
|
|
8522
8678
|
]
|
|
8523
8679
|
}
|
|
8524
8680
|
),
|
|
8525
8681
|
/* @__PURE__ */ jsxs24(Modal, { open: saveOpen, title: "\u53E6\u5B58\u4E3A\u5FEB\u6377\u67E5\u8BE2", width: 420, confirmLoading: saving, onOk: save, onOpenChange: (next) => {
|
|
8526
8682
|
if (!saveLock.current) setSaveOpen(next);
|
|
8527
8683
|
}, children: [
|
|
8528
|
-
/* @__PURE__ */
|
|
8684
|
+
/* @__PURE__ */ jsx26(
|
|
8529
8685
|
Input,
|
|
8530
8686
|
{
|
|
8531
8687
|
autoFocus: true,
|
|
@@ -8544,7 +8700,7 @@ function QueryForm({
|
|
|
8544
8700
|
}
|
|
8545
8701
|
}
|
|
8546
8702
|
),
|
|
8547
|
-
saveError ? /* @__PURE__ */
|
|
8703
|
+
saveError ? /* @__PURE__ */ jsx26("p", { className: "sia-query-form__error", role: "alert", children: saveError }) : null
|
|
8548
8704
|
] })
|
|
8549
8705
|
] });
|
|
8550
8706
|
}
|