@sia.soul/sia-react-ui 0.1.149 → 0.1.151
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-HRC6TQTZ.js → chunk-5P274RXG.js} +4 -2
- package/dist/{chunk-G5YXOCSY.js → chunk-GA5HA2A4.js} +1 -1
- package/dist/{chunk-TKRCHZB7.js → chunk-PDYEIHUO.js} +1 -1
- package/dist/core.cjs +4 -2
- package/dist/core.css +35 -2
- package/dist/core.js +2 -2
- package/dist/game.css +35 -2
- package/dist/index.cjs +1789 -1621
- package/dist/index.css +63 -2
- package/dist/index.d.cts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +444 -278
- package/dist/select-date-range.cjs +4 -2
- package/dist/select-date-range.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
Watermark,
|
|
83
83
|
message,
|
|
84
84
|
notification
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-GA5HA2A4.js";
|
|
86
86
|
import "./chunk-RX242MUO.js";
|
|
87
87
|
import {
|
|
88
88
|
MarkdownEditor
|
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
DatePicker,
|
|
96
96
|
SelectDateRange,
|
|
97
97
|
TimePanel
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-PDYEIHUO.js";
|
|
99
99
|
import {
|
|
100
100
|
Checkbox,
|
|
101
101
|
OverflowTags,
|
|
@@ -107,7 +107,7 @@ import {
|
|
|
107
107
|
Tree,
|
|
108
108
|
normalizeSelectionValues,
|
|
109
109
|
usePressFeedback
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-5P274RXG.js";
|
|
111
111
|
import {
|
|
112
112
|
Dropdown,
|
|
113
113
|
Input,
|
|
@@ -6583,6 +6583,101 @@ function createRowIdentity() {
|
|
|
6583
6583
|
};
|
|
6584
6584
|
}
|
|
6585
6585
|
|
|
6586
|
+
// src/components/Table/rowHeights.ts
|
|
6587
|
+
function createRowHeightLayout(rows, baseHeight, heights, minimumHeight = 1) {
|
|
6588
|
+
const offsets = [0];
|
|
6589
|
+
const sizes = rows.map((row) => {
|
|
6590
|
+
const configured = heights[String(row.key)];
|
|
6591
|
+
const size = Number.isFinite(configured) && configured > 0 ? Math.max(minimumHeight, configured) : baseHeight;
|
|
6592
|
+
offsets.push(offsets[offsets.length - 1] + size);
|
|
6593
|
+
return size;
|
|
6594
|
+
});
|
|
6595
|
+
const indexAt = (position) => {
|
|
6596
|
+
let low = 0, high = sizes.length;
|
|
6597
|
+
while (low < high) {
|
|
6598
|
+
const middle = Math.floor((low + high) / 2);
|
|
6599
|
+
if (offsets[middle + 1] <= position) low = middle + 1;
|
|
6600
|
+
else high = middle;
|
|
6601
|
+
}
|
|
6602
|
+
return Math.min(low, Math.max(0, sizes.length - 1));
|
|
6603
|
+
};
|
|
6604
|
+
return { sizes, offsets, total: offsets[offsets.length - 1], indexAt };
|
|
6605
|
+
}
|
|
6606
|
+
|
|
6607
|
+
// src/components/Table/RowResizeHandle.tsx
|
|
6608
|
+
import { useEffect as useEffect15, useRef as useRef22 } from "react";
|
|
6609
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
6610
|
+
function RowResizeHandle({ height, min, max, onPreview, onCommit }) {
|
|
6611
|
+
const drag = useRef22(null);
|
|
6612
|
+
const previewCallback = useRef22(onPreview);
|
|
6613
|
+
previewCallback.current = onPreview;
|
|
6614
|
+
useEffect15(() => {
|
|
6615
|
+
const cancel = () => {
|
|
6616
|
+
if (!drag.current) return;
|
|
6617
|
+
drag.current = null;
|
|
6618
|
+
previewCallback.current(null);
|
|
6619
|
+
};
|
|
6620
|
+
window.addEventListener("blur", cancel);
|
|
6621
|
+
return () => {
|
|
6622
|
+
window.removeEventListener("blur", cancel);
|
|
6623
|
+
cancel();
|
|
6624
|
+
};
|
|
6625
|
+
}, []);
|
|
6626
|
+
const clamp4 = (value) => Math.max(min, Math.min(max, Math.round(value)));
|
|
6627
|
+
const finish = (event, commit) => {
|
|
6628
|
+
const current = drag.current;
|
|
6629
|
+
if (!current || current.id !== event.pointerId) return;
|
|
6630
|
+
drag.current = null;
|
|
6631
|
+
onPreview(null);
|
|
6632
|
+
if (commit && current.next !== current.height) onCommit(current.next);
|
|
6633
|
+
};
|
|
6634
|
+
return /* @__PURE__ */ jsx27(
|
|
6635
|
+
"span",
|
|
6636
|
+
{
|
|
6637
|
+
className: "sia-table__row-resize-handle",
|
|
6638
|
+
role: "separator",
|
|
6639
|
+
"aria-label": "\u8C03\u6574\u884C\u9AD8",
|
|
6640
|
+
"aria-orientation": "horizontal",
|
|
6641
|
+
"aria-valuemin": min,
|
|
6642
|
+
"aria-valuemax": max,
|
|
6643
|
+
"aria-valuenow": height,
|
|
6644
|
+
tabIndex: 0,
|
|
6645
|
+
onClick: (event) => event.stopPropagation(),
|
|
6646
|
+
onDoubleClick: (event) => event.stopPropagation(),
|
|
6647
|
+
onPointerDown: (event) => {
|
|
6648
|
+
if (event.button !== 0) return;
|
|
6649
|
+
event.preventDefault();
|
|
6650
|
+
event.stopPropagation();
|
|
6651
|
+
event.currentTarget.focus({ preventScroll: true });
|
|
6652
|
+
drag.current = { id: event.pointerId, start: event.clientY, height, next: height };
|
|
6653
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
6654
|
+
},
|
|
6655
|
+
onPointerMove: (event) => {
|
|
6656
|
+
const current = drag.current;
|
|
6657
|
+
if (!current || current.id !== event.pointerId) return;
|
|
6658
|
+
event.stopPropagation();
|
|
6659
|
+
current.next = clamp4(current.height + event.clientY - current.start);
|
|
6660
|
+
onPreview(current.next);
|
|
6661
|
+
},
|
|
6662
|
+
onPointerUp: (event) => finish(event, true),
|
|
6663
|
+
onPointerCancel: (event) => finish(event, false),
|
|
6664
|
+
onLostPointerCapture: (event) => finish(event, false),
|
|
6665
|
+
onKeyDown: (event) => {
|
|
6666
|
+
if (event.key === "Escape" && drag.current) {
|
|
6667
|
+
drag.current = null;
|
|
6668
|
+
onPreview(null);
|
|
6669
|
+
event.stopPropagation();
|
|
6670
|
+
}
|
|
6671
|
+
if (event.key !== "ArrowUp" && event.key !== "ArrowDown") return;
|
|
6672
|
+
event.preventDefault();
|
|
6673
|
+
event.stopPropagation();
|
|
6674
|
+
const next = clamp4(height + (event.key === "ArrowUp" ? -10 : 10));
|
|
6675
|
+
if (next !== height) onCommit(next);
|
|
6676
|
+
}
|
|
6677
|
+
}
|
|
6678
|
+
);
|
|
6679
|
+
}
|
|
6680
|
+
|
|
6586
6681
|
// src/components/Table/cellFocus.ts
|
|
6587
6682
|
function playCellFocusGlow(cell, isVisible, onFinish, options) {
|
|
6588
6683
|
const namespace = "http://www.w3.org/2000/svg";
|
|
@@ -6626,10 +6721,10 @@ function playCellFocusGlow(cell, isVisible, onFinish, options) {
|
|
|
6626
6721
|
}
|
|
6627
6722
|
|
|
6628
6723
|
// src/components/Table/Table.tsx
|
|
6629
|
-
import { Fragment as Fragment9, forwardRef as forwardRef6, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as
|
|
6724
|
+
import { Fragment as Fragment9, forwardRef as forwardRef6, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as useEffect17, useImperativeHandle, useMemo as useMemo10, useRef as useRef24, useState as useState24 } from "react";
|
|
6630
6725
|
|
|
6631
6726
|
// src/components/Table/plugins.tsx
|
|
6632
|
-
import { isValidElement as isValidElement3, useEffect as
|
|
6727
|
+
import { isValidElement as isValidElement3, useEffect as useEffect16, useRef as useRef23, useState as useState23 } from "react";
|
|
6633
6728
|
|
|
6634
6729
|
// src/components/Table/columnSettings.ts
|
|
6635
6730
|
function reconcileColumnSettings(columns, defaults, saved) {
|
|
@@ -6716,7 +6811,7 @@ function saveSettingsPatch(adapter, scope, patch) {
|
|
|
6716
6811
|
}
|
|
6717
6812
|
|
|
6718
6813
|
// src/components/Table/plugins.tsx
|
|
6719
|
-
import { Fragment as Fragment8, jsx as
|
|
6814
|
+
import { Fragment as Fragment8, jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6720
6815
|
function TableCheckbox({
|
|
6721
6816
|
checked,
|
|
6722
6817
|
indeterminate,
|
|
@@ -6724,7 +6819,7 @@ function TableCheckbox({
|
|
|
6724
6819
|
label,
|
|
6725
6820
|
onChange
|
|
6726
6821
|
}) {
|
|
6727
|
-
return /* @__PURE__ */
|
|
6822
|
+
return /* @__PURE__ */ jsx28(
|
|
6728
6823
|
Checkbox,
|
|
6729
6824
|
{
|
|
6730
6825
|
className: "sia-table__checkbox",
|
|
@@ -7352,10 +7447,10 @@ function TableSelectedItemsPanel({
|
|
|
7352
7447
|
/* @__PURE__ */ jsxs24("div", { className: "sia-table-selection-panel__header", children: [
|
|
7353
7448
|
/* @__PURE__ */ jsxs24("strong", { children: [
|
|
7354
7449
|
"\u5DF2\u9009 ",
|
|
7355
|
-
/* @__PURE__ */
|
|
7450
|
+
/* @__PURE__ */ jsx28("span", { children: entries.length }),
|
|
7356
7451
|
" \u9879"
|
|
7357
7452
|
] }),
|
|
7358
|
-
/* @__PURE__ */
|
|
7453
|
+
/* @__PURE__ */ jsx28(
|
|
7359
7454
|
Button,
|
|
7360
7455
|
{
|
|
7361
7456
|
size: "small",
|
|
@@ -7366,15 +7461,15 @@ function TableSelectedItemsPanel({
|
|
|
7366
7461
|
}
|
|
7367
7462
|
)
|
|
7368
7463
|
] }),
|
|
7369
|
-
/* @__PURE__ */
|
|
7370
|
-
/* @__PURE__ */
|
|
7371
|
-
columns.map((column) => /* @__PURE__ */
|
|
7372
|
-
/* @__PURE__ */
|
|
7464
|
+
/* @__PURE__ */ jsx28("div", { className: "sia-table-selection-panel__body", children: /* @__PURE__ */ jsxs24("table", { children: [
|
|
7465
|
+
/* @__PURE__ */ jsx28("thead", { children: /* @__PURE__ */ jsxs24("tr", { children: [
|
|
7466
|
+
columns.map((column) => /* @__PURE__ */ jsx28("th", { children: getColumnLabel(column) }, column.key)),
|
|
7467
|
+
/* @__PURE__ */ jsx28("th", { "aria-label": "\u64CD\u4F5C" })
|
|
7373
7468
|
] }) }),
|
|
7374
|
-
/* @__PURE__ */
|
|
7469
|
+
/* @__PURE__ */ jsx28("tbody", { children: visibleEntries.map((entry, selectedIndex) => /* @__PURE__ */ jsxs24("tr", { children: [
|
|
7375
7470
|
columns.map((column) => {
|
|
7376
7471
|
if (column.meta?.plugin === "index")
|
|
7377
|
-
return /* @__PURE__ */
|
|
7472
|
+
return /* @__PURE__ */ jsx28("td", { children: entry.sourceIndex + 1 }, column.key);
|
|
7378
7473
|
const baseColumn = baseColumnMap.get(column.key) ?? column;
|
|
7379
7474
|
const value = getTableValue(
|
|
7380
7475
|
entry.record,
|
|
@@ -7394,9 +7489,9 @@ function TableSelectedItemsPanel({
|
|
|
7394
7489
|
entry.sourceIndex,
|
|
7395
7490
|
{ row, rowIndex: entry.sourceIndex, column: baseColumn }
|
|
7396
7491
|
) ?? value;
|
|
7397
|
-
return /* @__PURE__ */
|
|
7492
|
+
return /* @__PURE__ */ jsx28("td", { children: content }, column.key);
|
|
7398
7493
|
}),
|
|
7399
|
-
/* @__PURE__ */
|
|
7494
|
+
/* @__PURE__ */ jsx28("td", { children: /* @__PURE__ */ jsx28(
|
|
7400
7495
|
Button,
|
|
7401
7496
|
{
|
|
7402
7497
|
size: "small",
|
|
@@ -7411,7 +7506,7 @@ function TableSelectedItemsPanel({
|
|
|
7411
7506
|
"\u8FD8\u6709 ",
|
|
7412
7507
|
hiddenCount,
|
|
7413
7508
|
" \u9879\u672A\u5C55\u793A",
|
|
7414
|
-
/* @__PURE__ */
|
|
7509
|
+
/* @__PURE__ */ jsx28(Button, { size: "small", variant: "link", onClick: () => setShowAll(true), children: "\u5C55\u793A\u5168\u90E8" })
|
|
7415
7510
|
] }) : null
|
|
7416
7511
|
] });
|
|
7417
7512
|
}
|
|
@@ -7532,7 +7627,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7532
7627
|
const keys = selected(context);
|
|
7533
7628
|
const allChecked = enabledRows.length > 0 && enabledRows.every((row) => keys.includes(row.key));
|
|
7534
7629
|
const someChecked = enabledRows.some((row) => keys.includes(row.key));
|
|
7535
|
-
return /* @__PURE__ */
|
|
7630
|
+
return /* @__PURE__ */ jsx28(
|
|
7536
7631
|
TableCheckbox,
|
|
7537
7632
|
{
|
|
7538
7633
|
label: "\u9009\u62E9\u5F53\u524D\u9875\u5168\u90E8\u884C",
|
|
@@ -7548,7 +7643,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7548
7643
|
}
|
|
7549
7644
|
);
|
|
7550
7645
|
},
|
|
7551
|
-
render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */
|
|
7646
|
+
render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */ jsx28(
|
|
7552
7647
|
Radio2,
|
|
7553
7648
|
{
|
|
7554
7649
|
className: "sia-table__checkbox",
|
|
@@ -7559,7 +7654,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7559
7654
|
onClick: (event) => event.stopPropagation(),
|
|
7560
7655
|
onChange: () => toggle(info.row.key, record, context)
|
|
7561
7656
|
}
|
|
7562
|
-
) : /* @__PURE__ */
|
|
7657
|
+
) : /* @__PURE__ */ jsx28(
|
|
7563
7658
|
TableCheckbox,
|
|
7564
7659
|
{
|
|
7565
7660
|
label: `\u9009\u62E9\u7B2C ${info.rowIndex + 1} \u884C`,
|
|
@@ -7600,7 +7695,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7600
7695
|
(column) => !column.hidden && column.meta?.plugin !== "selection"
|
|
7601
7696
|
).slice(0, Math.max(1, options.selectionPanelColumnCount ?? 4));
|
|
7602
7697
|
return /* @__PURE__ */ jsxs24("span", { className: "sia-table__selection-footer", children: [
|
|
7603
|
-
/* @__PURE__ */
|
|
7698
|
+
/* @__PURE__ */ jsx28(
|
|
7604
7699
|
Popover,
|
|
7605
7700
|
{
|
|
7606
7701
|
placement: "top-start",
|
|
@@ -7608,7 +7703,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7608
7703
|
open: context.state.panelOpen && entries.length > 0,
|
|
7609
7704
|
onOpenChange: (panelOpen) => context.setState((state) => ({ ...state, panelOpen })),
|
|
7610
7705
|
overlayClassName: "sia-table-selection-popover",
|
|
7611
|
-
content: /* @__PURE__ */
|
|
7706
|
+
content: /* @__PURE__ */ jsx28(
|
|
7612
7707
|
TableSelectedItemsPanel,
|
|
7613
7708
|
{
|
|
7614
7709
|
entries,
|
|
@@ -7640,7 +7735,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
7640
7735
|
)
|
|
7641
7736
|
}
|
|
7642
7737
|
),
|
|
7643
|
-
mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */
|
|
7738
|
+
mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */ jsx28(
|
|
7644
7739
|
Checkbox,
|
|
7645
7740
|
{
|
|
7646
7741
|
checked: preserving(context),
|
|
@@ -7698,8 +7793,8 @@ function createSortPlugin(options = {}) {
|
|
|
7698
7793
|
const order = info?.field === field ? info.order : null;
|
|
7699
7794
|
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"}`;
|
|
7700
7795
|
return /* @__PURE__ */ jsxs24("span", { className: "sia-table__sortable-header", children: [
|
|
7701
|
-
/* @__PURE__ */
|
|
7702
|
-
/* @__PURE__ */
|
|
7796
|
+
/* @__PURE__ */ jsx28("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
|
|
7797
|
+
/* @__PURE__ */ jsx28(
|
|
7703
7798
|
"button",
|
|
7704
7799
|
{
|
|
7705
7800
|
type: "button",
|
|
@@ -7711,9 +7806,9 @@ function createSortPlugin(options = {}) {
|
|
|
7711
7806
|
event.stopPropagation();
|
|
7712
7807
|
cycle(field, context);
|
|
7713
7808
|
},
|
|
7714
|
-
children: order ? /* @__PURE__ */
|
|
7715
|
-
/* @__PURE__ */
|
|
7716
|
-
/* @__PURE__ */
|
|
7809
|
+
children: order ? /* @__PURE__ */ jsx28(Icon, { name: order === "ascend" ? "chevron-up" : "chevron-down", size: 18 }) : /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
7810
|
+
/* @__PURE__ */ jsx28(Icon, { name: "chevron-up", size: 11 }),
|
|
7811
|
+
/* @__PURE__ */ jsx28(Icon, { name: "chevron-down", size: 11 })
|
|
7717
7812
|
] })
|
|
7718
7813
|
}
|
|
7719
7814
|
)
|
|
@@ -7751,7 +7846,7 @@ function TableFilterControl({
|
|
|
7751
7846
|
const [open, setOpen] = useState23(false);
|
|
7752
7847
|
const [draft, setDraft] = useState23(value);
|
|
7753
7848
|
const label = getColumnLabel(column);
|
|
7754
|
-
|
|
7849
|
+
useEffect16(() => {
|
|
7755
7850
|
if (open) setDraft(value);
|
|
7756
7851
|
}, [open, value]);
|
|
7757
7852
|
const apply = (nextValue) => {
|
|
@@ -7759,8 +7854,8 @@ function TableFilterControl({
|
|
|
7759
7854
|
setOpen(false);
|
|
7760
7855
|
};
|
|
7761
7856
|
return /* @__PURE__ */ jsxs24("span", { className: "sia-table__filter-header", children: [
|
|
7762
|
-
/* @__PURE__ */
|
|
7763
|
-
/* @__PURE__ */
|
|
7857
|
+
/* @__PURE__ */ jsx28("span", { children: column.title ?? column.name ?? column.key }),
|
|
7858
|
+
/* @__PURE__ */ jsx28(
|
|
7764
7859
|
Popover,
|
|
7765
7860
|
{
|
|
7766
7861
|
open,
|
|
@@ -7768,7 +7863,7 @@ function TableFilterControl({
|
|
|
7768
7863
|
placement: "bottom-end",
|
|
7769
7864
|
overlayClassName: "sia-table-filter-popover",
|
|
7770
7865
|
content: /* @__PURE__ */ jsxs24("div", { className: "sia-table-filter-panel", children: [
|
|
7771
|
-
/* @__PURE__ */
|
|
7866
|
+
/* @__PURE__ */ jsx28(
|
|
7772
7867
|
Input,
|
|
7773
7868
|
{
|
|
7774
7869
|
size: "small",
|
|
@@ -7783,7 +7878,7 @@ function TableFilterControl({
|
|
|
7783
7878
|
}
|
|
7784
7879
|
),
|
|
7785
7880
|
/* @__PURE__ */ jsxs24("div", { className: "sia-table-filter-panel__actions", children: [
|
|
7786
|
-
/* @__PURE__ */
|
|
7881
|
+
/* @__PURE__ */ jsx28(
|
|
7787
7882
|
Button,
|
|
7788
7883
|
{
|
|
7789
7884
|
size: "small",
|
|
@@ -7795,7 +7890,7 @@ function TableFilterControl({
|
|
|
7795
7890
|
children: "\u6E05\u9664"
|
|
7796
7891
|
}
|
|
7797
7892
|
),
|
|
7798
|
-
/* @__PURE__ */
|
|
7893
|
+
/* @__PURE__ */ jsx28(
|
|
7799
7894
|
Button,
|
|
7800
7895
|
{
|
|
7801
7896
|
size: "small",
|
|
@@ -7806,7 +7901,7 @@ function TableFilterControl({
|
|
|
7806
7901
|
)
|
|
7807
7902
|
] })
|
|
7808
7903
|
] }),
|
|
7809
|
-
children: /* @__PURE__ */
|
|
7904
|
+
children: /* @__PURE__ */ jsx28(
|
|
7810
7905
|
"button",
|
|
7811
7906
|
{
|
|
7812
7907
|
type: "button",
|
|
@@ -7814,7 +7909,7 @@ function TableFilterControl({
|
|
|
7814
7909
|
"aria-label": `\u7B5B\u9009${label}`,
|
|
7815
7910
|
"aria-pressed": Boolean(value),
|
|
7816
7911
|
onClick: (event) => event.stopPropagation(),
|
|
7817
|
-
children: /* @__PURE__ */
|
|
7912
|
+
children: /* @__PURE__ */ jsx28(Icon, { name: "search", size: 13 })
|
|
7818
7913
|
}
|
|
7819
7914
|
)
|
|
7820
7915
|
}
|
|
@@ -7876,7 +7971,7 @@ function createFilterPlugin(options = {}) {
|
|
|
7876
7971
|
title: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title
|
|
7877
7972
|
};
|
|
7878
7973
|
const placeholder = typeof options.placeholder === "function" ? options.placeholder(currentColumn) : options.placeholder ?? `\u8F93\u5165${getColumnLabel(currentColumn)}\u7B5B\u9009`;
|
|
7879
|
-
return /* @__PURE__ */
|
|
7974
|
+
return /* @__PURE__ */ jsx28(
|
|
7880
7975
|
TableFilterControl,
|
|
7881
7976
|
{
|
|
7882
7977
|
column: renderedColumn,
|
|
@@ -7965,7 +8060,7 @@ function createPaginationPlugin(options = {}) {
|
|
|
7965
8060
|
const page = currentPage(context);
|
|
7966
8061
|
const filteredCount = context.getPluginApi("filter")?.getFilteredRows().length;
|
|
7967
8062
|
const totalRecords = options.totalCount ?? filteredCount ?? context.sourceData.length;
|
|
7968
|
-
return /* @__PURE__ */
|
|
8063
|
+
return /* @__PURE__ */ jsx28(
|
|
7969
8064
|
Pagination,
|
|
7970
8065
|
{
|
|
7971
8066
|
className: "sia-table__pagination",
|
|
@@ -8110,12 +8205,12 @@ function createTreePlugin(options = {}) {
|
|
|
8110
8205
|
style: options.showLine ? void 0 : { paddingLeft: info.row.depth * 18 },
|
|
8111
8206
|
children: [
|
|
8112
8207
|
options.showLine && info.row.depth > 0 && /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
8113
|
-
info.row.meta.treeGuides.map((continued, level) => /* @__PURE__ */
|
|
8114
|
-
/* @__PURE__ */
|
|
8208
|
+
info.row.meta.treeGuides.map((continued, level) => /* @__PURE__ */ jsx28("span", { "aria-hidden": "true", className: `sia-table__tree-guide${continued ? " sia-table__tree-guide--continued" : ""}` }, level)),
|
|
8209
|
+
/* @__PURE__ */ jsx28("span", { "aria-hidden": "true", className: `sia-table__tree-guide sia-table__tree-guide--branch${info.row.meta.treeHasNextSibling ? " sia-table__tree-guide--continued" : ""}` })
|
|
8115
8210
|
] }),
|
|
8116
8211
|
/* @__PURE__ */ jsxs24("span", { className: options.showLine ? "sia-table__tree-node" : void 0, style: options.showLine ? void 0 : { display: "contents" }, children: [
|
|
8117
|
-
options.showLine && !!info.row.meta.treeHasChildren && current(context).includes(info.row.key) && /* @__PURE__ */
|
|
8118
|
-
info.row.meta.treeHasChildren ? /* @__PURE__ */
|
|
8212
|
+
options.showLine && !!info.row.meta.treeHasChildren && current(context).includes(info.row.key) && /* @__PURE__ */ jsx28("span", { "aria-hidden": "true", className: "sia-table__tree-stem" }),
|
|
8213
|
+
info.row.meta.treeHasChildren ? /* @__PURE__ */ jsx28(
|
|
8119
8214
|
"button",
|
|
8120
8215
|
{
|
|
8121
8216
|
type: "button",
|
|
@@ -8126,7 +8221,7 @@ function createTreePlugin(options = {}) {
|
|
|
8126
8221
|
event.stopPropagation();
|
|
8127
8222
|
toggle(info.row.key, context);
|
|
8128
8223
|
},
|
|
8129
|
-
children: /* @__PURE__ */
|
|
8224
|
+
children: /* @__PURE__ */ jsx28(
|
|
8130
8225
|
Icon,
|
|
8131
8226
|
{
|
|
8132
8227
|
name: current(context).includes(info.row.key) ? "chevron-down" : "chevron-right",
|
|
@@ -8134,7 +8229,7 @@ function createTreePlugin(options = {}) {
|
|
|
8134
8229
|
}
|
|
8135
8230
|
)
|
|
8136
8231
|
}
|
|
8137
|
-
) : /* @__PURE__ */
|
|
8232
|
+
) : /* @__PURE__ */ jsx28("span", { className: "sia-table__tree-placeholder" })
|
|
8138
8233
|
] }),
|
|
8139
8234
|
previousRender ? previousRender(value, record, index, info) : value
|
|
8140
8235
|
]
|
|
@@ -8183,24 +8278,23 @@ function EditableTableCell({
|
|
|
8183
8278
|
value,
|
|
8184
8279
|
record,
|
|
8185
8280
|
content,
|
|
8186
|
-
onStart,
|
|
8187
8281
|
onSave,
|
|
8188
8282
|
onCancel,
|
|
8189
|
-
trigger,
|
|
8190
8283
|
showEditIcon
|
|
8191
8284
|
}) {
|
|
8192
8285
|
const config = typeof editable === "object" ? editable : { type: "input" };
|
|
8193
8286
|
const [editValue, setEditValue] = useState23(value);
|
|
8194
8287
|
const [saving, setSaving] = useState23(false);
|
|
8195
|
-
const inputRef =
|
|
8196
|
-
const editorRef =
|
|
8197
|
-
const
|
|
8198
|
-
const
|
|
8199
|
-
const
|
|
8288
|
+
const inputRef = useRef23(null);
|
|
8289
|
+
const editorRef = useRef23(null);
|
|
8290
|
+
const ownedEvents = useRef23(/* @__PURE__ */ new WeakSet());
|
|
8291
|
+
const editValueRef = useRef23(value);
|
|
8292
|
+
const savingRef = useRef23(false);
|
|
8293
|
+
const saveRef = useRef23(
|
|
8200
8294
|
async () => {
|
|
8201
8295
|
}
|
|
8202
8296
|
);
|
|
8203
|
-
|
|
8297
|
+
useEffect16(() => {
|
|
8204
8298
|
if (!active) return;
|
|
8205
8299
|
editValueRef.current = value;
|
|
8206
8300
|
setEditValue(value);
|
|
@@ -8231,31 +8325,29 @@ function EditableTableCell({
|
|
|
8231
8325
|
}
|
|
8232
8326
|
}
|
|
8233
8327
|
saveRef.current = save;
|
|
8234
|
-
|
|
8235
|
-
if (!active
|
|
8328
|
+
useEffect16(() => {
|
|
8329
|
+
if (!active) return;
|
|
8236
8330
|
const handleOutsidePointerDown = (event) => {
|
|
8237
8331
|
const target = event.target;
|
|
8238
|
-
if (!(target instanceof Node) || editorRef.current?.contains(target))
|
|
8332
|
+
if (!(target instanceof Node) || ownedEvents.current.has(event) || editorRef.current?.contains(target))
|
|
8239
8333
|
return;
|
|
8240
|
-
|
|
8334
|
+
if (config.type === "custom" || config.type === "select") onCancel();
|
|
8335
|
+
else void saveRef.current();
|
|
8241
8336
|
};
|
|
8242
|
-
document.addEventListener("pointerdown", handleOutsidePointerDown
|
|
8337
|
+
document.addEventListener("pointerdown", handleOutsidePointerDown);
|
|
8243
8338
|
return () => document.removeEventListener(
|
|
8244
8339
|
"pointerdown",
|
|
8245
|
-
handleOutsidePointerDown
|
|
8246
|
-
true
|
|
8340
|
+
handleOutsidePointerDown
|
|
8247
8341
|
);
|
|
8248
|
-
}, [active, config.type]);
|
|
8342
|
+
}, [active, config.type, onCancel]);
|
|
8249
8343
|
if (!active)
|
|
8250
8344
|
return /* @__PURE__ */ jsxs24(
|
|
8251
8345
|
"div",
|
|
8252
8346
|
{
|
|
8253
8347
|
className: "sia-table__editable-display",
|
|
8254
|
-
onClick: trigger === "click" ? onStart : void 0,
|
|
8255
|
-
onDoubleClick: trigger === "doubleClick" ? onStart : void 0,
|
|
8256
8348
|
children: [
|
|
8257
|
-
/* @__PURE__ */
|
|
8258
|
-
showEditIcon && /* @__PURE__ */
|
|
8349
|
+
/* @__PURE__ */ jsx28("span", { children: content }),
|
|
8350
|
+
showEditIcon && /* @__PURE__ */ jsx28(Icon, { name: "edit", size: 13 })
|
|
8259
8351
|
]
|
|
8260
8352
|
}
|
|
8261
8353
|
);
|
|
@@ -8263,7 +8355,7 @@ function EditableTableCell({
|
|
|
8263
8355
|
if (config.type === "custom" && config.editRender) {
|
|
8264
8356
|
editor = config.editRender(record, (next) => void save(next), onCancel);
|
|
8265
8357
|
} else if (config.type === "inputNumber") {
|
|
8266
|
-
editor = /* @__PURE__ */
|
|
8358
|
+
editor = /* @__PURE__ */ jsx28(
|
|
8267
8359
|
InputNumber,
|
|
8268
8360
|
{
|
|
8269
8361
|
ref: inputRef,
|
|
@@ -8284,7 +8376,7 @@ function EditableTableCell({
|
|
|
8284
8376
|
}
|
|
8285
8377
|
);
|
|
8286
8378
|
} else if (config.type === "select") {
|
|
8287
|
-
editor = /* @__PURE__ */
|
|
8379
|
+
editor = /* @__PURE__ */ jsx28(
|
|
8288
8380
|
Select,
|
|
8289
8381
|
{
|
|
8290
8382
|
size: "small",
|
|
@@ -8298,14 +8390,14 @@ function EditableTableCell({
|
|
|
8298
8390
|
}
|
|
8299
8391
|
);
|
|
8300
8392
|
} else {
|
|
8301
|
-
editor = /* @__PURE__ */
|
|
8393
|
+
editor = /* @__PURE__ */ jsx28(
|
|
8302
8394
|
Input,
|
|
8303
8395
|
{
|
|
8304
8396
|
ref: inputRef,
|
|
8305
8397
|
size: "small",
|
|
8306
8398
|
value: String(editValue ?? ""),
|
|
8307
8399
|
disabled: saving,
|
|
8308
|
-
suffix: saving ? /* @__PURE__ */
|
|
8400
|
+
suffix: saving ? /* @__PURE__ */ jsx28(Icon, { name: "loader", size: 13, spin: true }) : null,
|
|
8309
8401
|
onChange: (event) => updateEditValue(event.target.value),
|
|
8310
8402
|
onBlur: () => void save(),
|
|
8311
8403
|
onKeyDown: (event) => {
|
|
@@ -8315,14 +8407,31 @@ function EditableTableCell({
|
|
|
8315
8407
|
}
|
|
8316
8408
|
);
|
|
8317
8409
|
}
|
|
8318
|
-
return /* @__PURE__ */
|
|
8410
|
+
return /* @__PURE__ */ jsx28(
|
|
8411
|
+
"div",
|
|
8412
|
+
{
|
|
8413
|
+
ref: editorRef,
|
|
8414
|
+
className: `sia-table__editor${config.type === "custom" ? " sia-table__editor--custom" : ""}`,
|
|
8415
|
+
onPointerDownCapture: (event) => ownedEvents.current.add(event.nativeEvent),
|
|
8416
|
+
children: editor
|
|
8417
|
+
}
|
|
8418
|
+
);
|
|
8319
8419
|
}
|
|
8320
8420
|
function createEditablePlugin(options = {}) {
|
|
8321
8421
|
const trigger = options.trigger ?? "click";
|
|
8422
|
+
const startCellEdit = (row, column, event, context) => {
|
|
8423
|
+
const config = typeof column.editable === "object" ? column.editable : void 0;
|
|
8424
|
+
if (!column.editable || config?.canEdit?.(row.record) === false) return;
|
|
8425
|
+
if (event.target instanceof Element && event.target.closest("td") !== event.currentTarget) return;
|
|
8426
|
+
if (event.target instanceof Element && event.target.closest('button,a,input,textarea,select,[role="button"],[role="combobox"],.sia-table__editor,.sia-table__worksheet-handle,.sia-table__row-resize-handle')) return;
|
|
8427
|
+
context.setState({ editing: { rowKey: row.key, columnKey: column.key } });
|
|
8428
|
+
};
|
|
8322
8429
|
return {
|
|
8323
8430
|
id: "editable",
|
|
8324
8431
|
order: 70,
|
|
8325
8432
|
initialState: { editing: null },
|
|
8433
|
+
onCellClick: trigger === "click" ? startCellEdit : void 0,
|
|
8434
|
+
onCellDoubleClick: trigger === "doubleClick" ? startCellEdit : void 0,
|
|
8326
8435
|
transformColumns(columns, context) {
|
|
8327
8436
|
return mapTableLeafColumns(columns, (column) => {
|
|
8328
8437
|
if (!column.editable) return column;
|
|
@@ -8335,7 +8444,7 @@ function createEditablePlugin(options = {}) {
|
|
|
8335
8444
|
const active = canEdit && context.state.editing?.rowKey === info.row.key && context.state.editing.columnKey === column.key;
|
|
8336
8445
|
const content = previousRender ? previousRender(value, record, index, info) : value;
|
|
8337
8446
|
if (!canEdit) return content;
|
|
8338
|
-
return /* @__PURE__ */
|
|
8447
|
+
return /* @__PURE__ */ jsx28(
|
|
8339
8448
|
EditableTableCell,
|
|
8340
8449
|
{
|
|
8341
8450
|
active,
|
|
@@ -8343,11 +8452,7 @@ function createEditablePlugin(options = {}) {
|
|
|
8343
8452
|
value,
|
|
8344
8453
|
record,
|
|
8345
8454
|
content,
|
|
8346
|
-
trigger,
|
|
8347
8455
|
showEditIcon: options.showEditIcon ?? true,
|
|
8348
|
-
onStart: () => context.setState({
|
|
8349
|
-
editing: { rowKey: info.row.key, columnKey: column.key }
|
|
8350
|
-
}),
|
|
8351
8456
|
onCancel: () => context.setState(
|
|
8352
8457
|
(state) => state.editing?.rowKey === info.row.key && state.editing.columnKey === column.key ? { editing: null } : state
|
|
8353
8458
|
),
|
|
@@ -8400,8 +8505,8 @@ function createResizePlugin(options = {}) {
|
|
|
8400
8505
|
autoWidth,
|
|
8401
8506
|
width,
|
|
8402
8507
|
renderHeader: (currentColumn, coreContext) => /* @__PURE__ */ jsxs24("span", { className: "sia-table__resizable-header", children: [
|
|
8403
|
-
/* @__PURE__ */
|
|
8404
|
-
/* @__PURE__ */
|
|
8508
|
+
/* @__PURE__ */ jsx28("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
|
|
8509
|
+
/* @__PURE__ */ jsx28(
|
|
8405
8510
|
"span",
|
|
8406
8511
|
{
|
|
8407
8512
|
className: "sia-table__resize-handle",
|
|
@@ -8538,11 +8643,11 @@ function ColumnSettingPanel({
|
|
|
8538
8643
|
onApply
|
|
8539
8644
|
}) {
|
|
8540
8645
|
const [draft, setDraft] = useState23(items);
|
|
8541
|
-
const listRef =
|
|
8542
|
-
const cancelDrag =
|
|
8646
|
+
const listRef = useRef23(null);
|
|
8647
|
+
const cancelDrag = useRef23(null);
|
|
8543
8648
|
const [preview, setPreview] = useState23(null);
|
|
8544
|
-
const syncedDraft =
|
|
8545
|
-
|
|
8649
|
+
const syncedDraft = useRef23({ open: false, signature: "" });
|
|
8650
|
+
useEffect16(() => {
|
|
8546
8651
|
const signature = JSON.stringify(items);
|
|
8547
8652
|
const changed = signature !== syncedDraft.current.signature;
|
|
8548
8653
|
if (open !== syncedDraft.current.open || changed) cancelDrag.current?.();
|
|
@@ -8551,7 +8656,7 @@ function ColumnSettingPanel({
|
|
|
8551
8656
|
}
|
|
8552
8657
|
syncedDraft.current = { open, signature };
|
|
8553
8658
|
}, [items, open]);
|
|
8554
|
-
|
|
8659
|
+
useEffect16(() => () => cancelDrag.current?.(), []);
|
|
8555
8660
|
const labels = new Map(
|
|
8556
8661
|
flattenTableColumns(columns).map((column) => [
|
|
8557
8662
|
column.key,
|
|
@@ -8688,8 +8793,8 @@ function ColumnSettingPanel({
|
|
|
8688
8793
|
if (!next) onClose();
|
|
8689
8794
|
},
|
|
8690
8795
|
footer: /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
8691
|
-
/* @__PURE__ */
|
|
8692
|
-
/* @__PURE__ */
|
|
8796
|
+
/* @__PURE__ */ jsx28(Button, { onClick: onClose, children: "\u53D6\u6D88" }),
|
|
8797
|
+
/* @__PURE__ */ jsx28(
|
|
8693
8798
|
Button,
|
|
8694
8799
|
{
|
|
8695
8800
|
variant: "primary",
|
|
@@ -8702,9 +8807,9 @@ function ColumnSettingPanel({
|
|
|
8702
8807
|
children: [
|
|
8703
8808
|
loadError ? /* @__PURE__ */ jsxs24("p", { role: "alert", children: [
|
|
8704
8809
|
"\u8BFB\u53D6\u5217\u914D\u7F6E\u5931\u8D25\u3002",
|
|
8705
|
-
/* @__PURE__ */
|
|
8810
|
+
/* @__PURE__ */ jsx28(Button, { variant: "link", onClick: onRetry, children: "\u91CD\u8BD5" })
|
|
8706
8811
|
] }) : null,
|
|
8707
|
-
/* @__PURE__ */
|
|
8812
|
+
/* @__PURE__ */ jsx28(Spin, { spinning: Boolean(loading), className: "sia-table-settings__loading", "aria-label": loading ? "\u6B63\u5728\u8BFB\u53D6\u5217\u914D\u7F6E" : void 0, children: /* @__PURE__ */ jsxs24(
|
|
8708
8813
|
"fieldset",
|
|
8709
8814
|
{
|
|
8710
8815
|
disabled: loading || loadError,
|
|
@@ -8712,7 +8817,7 @@ function ColumnSettingPanel({
|
|
|
8712
8817
|
"aria-busy": loading,
|
|
8713
8818
|
children: [
|
|
8714
8819
|
/* @__PURE__ */ jsxs24("label", { className: "sia-table-settings__all", children: [
|
|
8715
|
-
/* @__PURE__ */
|
|
8820
|
+
/* @__PURE__ */ jsx28(
|
|
8716
8821
|
TableCheckbox,
|
|
8717
8822
|
{
|
|
8718
8823
|
label: "\u5168\u9009\u5217",
|
|
@@ -8731,7 +8836,7 @@ function ColumnSettingPanel({
|
|
|
8731
8836
|
"\uFF09"
|
|
8732
8837
|
] })
|
|
8733
8838
|
] }),
|
|
8734
|
-
/* @__PURE__ */
|
|
8839
|
+
/* @__PURE__ */ jsx28(
|
|
8735
8840
|
"div",
|
|
8736
8841
|
{
|
|
8737
8842
|
ref: listRef,
|
|
@@ -8746,8 +8851,8 @@ function ColumnSettingPanel({
|
|
|
8746
8851
|
} : void 0,
|
|
8747
8852
|
onPointerDown: (event) => startSort(event, item.key),
|
|
8748
8853
|
children: [
|
|
8749
|
-
/* @__PURE__ */
|
|
8750
|
-
/* @__PURE__ */
|
|
8854
|
+
/* @__PURE__ */ jsx28(Icon, { name: "menu", size: 15 }),
|
|
8855
|
+
/* @__PURE__ */ jsx28(
|
|
8751
8856
|
TableCheckbox,
|
|
8752
8857
|
{
|
|
8753
8858
|
label: `\u663E\u793A${labels.get(item.key) ?? item.key}\u5217`,
|
|
@@ -8759,7 +8864,7 @@ function ColumnSettingPanel({
|
|
|
8759
8864
|
)
|
|
8760
8865
|
}
|
|
8761
8866
|
),
|
|
8762
|
-
/* @__PURE__ */
|
|
8867
|
+
/* @__PURE__ */ jsx28(
|
|
8763
8868
|
"span",
|
|
8764
8869
|
{
|
|
8765
8870
|
className: "sia-table-settings__name",
|
|
@@ -8767,7 +8872,7 @@ function ColumnSettingPanel({
|
|
|
8767
8872
|
}
|
|
8768
8873
|
),
|
|
8769
8874
|
/* @__PURE__ */ jsxs24("div", { className: "sia-table-settings__actions", children: [
|
|
8770
|
-
/* @__PURE__ */
|
|
8875
|
+
/* @__PURE__ */ jsx28(
|
|
8771
8876
|
Button,
|
|
8772
8877
|
{
|
|
8773
8878
|
size: "small",
|
|
@@ -8780,7 +8885,7 @@ function ColumnSettingPanel({
|
|
|
8780
8885
|
children: "\u5DE6"
|
|
8781
8886
|
}
|
|
8782
8887
|
),
|
|
8783
|
-
/* @__PURE__ */
|
|
8888
|
+
/* @__PURE__ */ jsx28(
|
|
8784
8889
|
Button,
|
|
8785
8890
|
{
|
|
8786
8891
|
size: "small",
|
|
@@ -8930,7 +9035,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8930
9035
|
{
|
|
8931
9036
|
key: "builtin:export",
|
|
8932
9037
|
label: "\u8868\u683C\u5BFC\u51FA",
|
|
8933
|
-
icon: /* @__PURE__ */
|
|
9038
|
+
icon: /* @__PURE__ */ jsx28(Icon, { name: "download", size: 18 }),
|
|
8934
9039
|
disabled: exportApi().getRows().length === 0
|
|
8935
9040
|
},
|
|
8936
9041
|
{ key: "builtin:divider", type: "divider" }
|
|
@@ -8938,7 +9043,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8938
9043
|
{
|
|
8939
9044
|
key: "builtin:columns",
|
|
8940
9045
|
label: "\u5217\u8BBE\u7F6E",
|
|
8941
|
-
icon: /* @__PURE__ */
|
|
9046
|
+
icon: /* @__PURE__ */ jsx28(Icon, { name: "settings", size: 18 })
|
|
8942
9047
|
},
|
|
8943
9048
|
...customItems.map((item) => ({
|
|
8944
9049
|
key: "custom:" + item.key,
|
|
@@ -8950,7 +9055,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8950
9055
|
disabled: item.disabled === true || typeof item.disabled === "function" && item.disabled(context)
|
|
8951
9056
|
}))
|
|
8952
9057
|
];
|
|
8953
|
-
return /* @__PURE__ */
|
|
9058
|
+
return /* @__PURE__ */ jsx28(
|
|
8954
9059
|
Dropdown,
|
|
8955
9060
|
{
|
|
8956
9061
|
disabled: options.buttonProps?.disabled || options.buttonProps?.loading,
|
|
@@ -8967,12 +9072,12 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8967
9072
|
void customItems.find((item) => "custom:" + item.key === key)?.onClick?.(context);
|
|
8968
9073
|
}
|
|
8969
9074
|
},
|
|
8970
|
-
children: /* @__PURE__ */
|
|
9075
|
+
children: /* @__PURE__ */ jsx28(
|
|
8971
9076
|
Button,
|
|
8972
9077
|
{
|
|
8973
9078
|
size: "small",
|
|
8974
9079
|
variant: "text",
|
|
8975
|
-
icon: /* @__PURE__ */
|
|
9080
|
+
icon: /* @__PURE__ */ jsx28(Icon, { name: "settings", size: 16 }),
|
|
8976
9081
|
"aria-label": "\u8868\u683C\u8BBE\u7F6E",
|
|
8977
9082
|
...options.buttonProps,
|
|
8978
9083
|
className: `sia-table__settings-button${options.buttonProps?.children == null ? " sia-table__toolbar-icon" : ""} ${options.buttonProps?.className ?? ""}`.trim()
|
|
@@ -8981,7 +9086,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8981
9086
|
}
|
|
8982
9087
|
);
|
|
8983
9088
|
},
|
|
8984
|
-
renderOverlay: (context) => /* @__PURE__ */
|
|
9089
|
+
renderOverlay: (context) => /* @__PURE__ */ jsx28(
|
|
8985
9090
|
ColumnSettingPanel,
|
|
8986
9091
|
{
|
|
8987
9092
|
open: context.state.open,
|
|
@@ -9031,11 +9136,11 @@ function ToolbarItems({
|
|
|
9031
9136
|
items,
|
|
9032
9137
|
context
|
|
9033
9138
|
}) {
|
|
9034
|
-
return /* @__PURE__ */
|
|
9139
|
+
return /* @__PURE__ */ jsx28(Fragment8, { children: items.map((item) => {
|
|
9035
9140
|
if (item.hidden === true || typeof item.hidden === "function" && item.hidden(context))
|
|
9036
9141
|
return null;
|
|
9037
9142
|
const disabled = item.disabled === true || typeof item.disabled === "function" && item.disabled(context);
|
|
9038
|
-
return /* @__PURE__ */
|
|
9143
|
+
return /* @__PURE__ */ jsx28(
|
|
9039
9144
|
Button,
|
|
9040
9145
|
{
|
|
9041
9146
|
size: "small",
|
|
@@ -9060,14 +9165,14 @@ function createToolbarPlugin(options) {
|
|
|
9060
9165
|
order: 5,
|
|
9061
9166
|
renderToolbarStart: (context) => /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
9062
9167
|
options.start,
|
|
9063
|
-
/* @__PURE__ */
|
|
9168
|
+
/* @__PURE__ */ jsx28(ToolbarItems, { items: items("start"), context })
|
|
9064
9169
|
] }),
|
|
9065
9170
|
renderToolbarEnd: (context) => /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
9066
9171
|
options.end,
|
|
9067
|
-
/* @__PURE__ */
|
|
9172
|
+
/* @__PURE__ */ jsx28(ToolbarItems, { items: items("end"), context }),
|
|
9068
9173
|
items("end", true).length > 0 ? /* @__PURE__ */ jsxs24("details", { className: "sia-table__toolbar-menu", children: [
|
|
9069
|
-
/* @__PURE__ */
|
|
9070
|
-
/* @__PURE__ */
|
|
9174
|
+
/* @__PURE__ */ jsx28("summary", { "aria-label": "\u66F4\u591A\u8868\u683C\u64CD\u4F5C", children: /* @__PURE__ */ jsx28(Icon, { name: "more-horizontal", size: 16 }) }),
|
|
9175
|
+
/* @__PURE__ */ jsx28("div", { children: /* @__PURE__ */ jsx28(ToolbarItems, { items: items("end", true), context }) })
|
|
9071
9176
|
] }) : null
|
|
9072
9177
|
] })
|
|
9073
9178
|
};
|
|
@@ -9149,11 +9254,11 @@ function createExportPlugin(options = {}) {
|
|
|
9149
9254
|
return {
|
|
9150
9255
|
id: "export",
|
|
9151
9256
|
order: 95,
|
|
9152
|
-
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */
|
|
9257
|
+
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */ jsx28(
|
|
9153
9258
|
Button,
|
|
9154
9259
|
{
|
|
9155
9260
|
size: "small",
|
|
9156
|
-
icon: /* @__PURE__ */
|
|
9261
|
+
icon: /* @__PURE__ */ jsx28(Icon, { name: "download", size: 14 }),
|
|
9157
9262
|
disabled: getRows(context).length === 0,
|
|
9158
9263
|
onClick: () => void download(context),
|
|
9159
9264
|
children: options.buttonLabel ?? "\u5BFC\u51FA"
|
|
@@ -9168,7 +9273,7 @@ function createExportPlugin(options = {}) {
|
|
|
9168
9273
|
}
|
|
9169
9274
|
|
|
9170
9275
|
// src/components/Table/Table.tsx
|
|
9171
|
-
import { jsx as
|
|
9276
|
+
import { jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
9172
9277
|
var EMPTY_DATA = [];
|
|
9173
9278
|
var EMPTY_COLUMNS = [];
|
|
9174
9279
|
var EMPTY_PLUGINS = [];
|
|
@@ -9269,6 +9374,8 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
9269
9374
|
rightFixedEdgeKey,
|
|
9270
9375
|
striped,
|
|
9271
9376
|
rowHeight,
|
|
9377
|
+
managedHeight,
|
|
9378
|
+
resize,
|
|
9272
9379
|
className,
|
|
9273
9380
|
onClick,
|
|
9274
9381
|
onDoubleClick,
|
|
@@ -9278,17 +9385,19 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
9278
9385
|
onCellMouseEnter,
|
|
9279
9386
|
onCellMouseLeave,
|
|
9280
9387
|
onCellClick,
|
|
9388
|
+
onCellDoubleClick,
|
|
9281
9389
|
onCellContextMenu,
|
|
9282
9390
|
onCellPointerDown,
|
|
9283
9391
|
onCellPointerMove
|
|
9284
9392
|
}) {
|
|
9285
|
-
|
|
9393
|
+
const resizeColumnKey = resize ? columns.find((column) => !getCellProps(column).hidden)?.key : void 0;
|
|
9394
|
+
return /* @__PURE__ */ jsx29(
|
|
9286
9395
|
"tr",
|
|
9287
9396
|
{
|
|
9288
9397
|
"data-row-key": String(row.key),
|
|
9289
9398
|
"data-canvas-row-index": canvas ? rowIndex : void 0,
|
|
9290
|
-
className: `sia-table__row${striped && rowIndex % 2 === 1 ? " sia-table__row--striped" : ""} ${className}`.trim(),
|
|
9291
|
-
style: { height: rowHeight },
|
|
9399
|
+
className: `sia-table__row${managedHeight ? " sia-table__row--height-managed" : ""}${striped && rowIndex % 2 === 1 ? " sia-table__row--striped" : ""} ${className}`.trim(),
|
|
9400
|
+
style: { height: rowHeight, "--sia-table-row-height": `${rowHeight}px` },
|
|
9292
9401
|
onClick,
|
|
9293
9402
|
onDoubleClick,
|
|
9294
9403
|
onMouseEnter,
|
|
@@ -9298,7 +9407,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
9298
9407
|
if (columnIndex > 0 && !visibleColumns.has(columns[columnIndex - 1].key)) return null;
|
|
9299
9408
|
let count = 1;
|
|
9300
9409
|
while (columnIndex + count < columns.length && !visibleColumns.has(columns[columnIndex + count].key)) count++;
|
|
9301
|
-
return /* @__PURE__ */
|
|
9410
|
+
return /* @__PURE__ */ jsx29("td", { colSpan: count, "aria-hidden": "true", style: { padding: 0 } }, `spacer-${column.key}`);
|
|
9302
9411
|
}
|
|
9303
9412
|
const pluginCellProps = getCellProps(column);
|
|
9304
9413
|
if (pluginCellProps.hidden) return null;
|
|
@@ -9309,7 +9418,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
9309
9418
|
const fixedStyle = fixed === "left" ? { left: leftOffsets.get(column.key) } : fixed === "right" ? { right: rightOffsets.get(column.key) } : void 0;
|
|
9310
9419
|
const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
9311
9420
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
9312
|
-
return /* @__PURE__ */
|
|
9421
|
+
return /* @__PURE__ */ jsxs25(
|
|
9313
9422
|
"td",
|
|
9314
9423
|
{
|
|
9315
9424
|
"data-column-key": column.key,
|
|
@@ -9323,17 +9432,21 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
9323
9432
|
onMouseEnter: () => onCellMouseEnter(column),
|
|
9324
9433
|
onMouseLeave: () => onCellMouseLeave(column),
|
|
9325
9434
|
onClick: (event) => onCellClick(column, event),
|
|
9435
|
+
onDoubleClick: (event) => onCellDoubleClick(column, event),
|
|
9326
9436
|
onContextMenu: (event) => onCellContextMenu(column, event),
|
|
9327
9437
|
onPointerDown: (event) => onCellPointerDown(column, event),
|
|
9328
9438
|
onPointerMove: (event) => onCellPointerMove(column, event),
|
|
9329
|
-
children:
|
|
9330
|
-
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9439
|
+
children: [
|
|
9440
|
+
!canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? /* @__PURE__ */ jsx29(
|
|
9441
|
+
TableCellContent,
|
|
9442
|
+
{
|
|
9443
|
+
ellipsis: column.ellipsis !== false,
|
|
9444
|
+
title: column.showTitle === true && column.ellipsis !== false && typeof value === "string" ? value : void 0,
|
|
9445
|
+
children: pluginCellProps.content !== void 0 ? pluginCellProps.content : column.render ? column.render(value, row.record, row.sourceIndex, { row, rowIndex, column }) : value
|
|
9446
|
+
}
|
|
9447
|
+
) : null,
|
|
9448
|
+
resize && column.key === resizeColumnKey ? /* @__PURE__ */ jsx29(RowResizeHandle, { height: rowHeight, ...resize }) : null
|
|
9449
|
+
]
|
|
9337
9450
|
},
|
|
9338
9451
|
column.key
|
|
9339
9452
|
);
|
|
@@ -9363,6 +9476,11 @@ function TableInner(props, ref) {
|
|
|
9363
9476
|
renderMode = "dom",
|
|
9364
9477
|
virtualThreshold = 100,
|
|
9365
9478
|
rowHeight = SIZE_ROW_HEIGHT[size],
|
|
9479
|
+
rowHeights,
|
|
9480
|
+
rowResizable = false,
|
|
9481
|
+
minRowHeight,
|
|
9482
|
+
maxRowHeight,
|
|
9483
|
+
onRowHeightChange,
|
|
9366
9484
|
overscan = 6,
|
|
9367
9485
|
stickyHeader = true,
|
|
9368
9486
|
resizable = true,
|
|
@@ -9378,18 +9496,29 @@ function TableInner(props, ref) {
|
|
|
9378
9496
|
style,
|
|
9379
9497
|
...htmlProps
|
|
9380
9498
|
} = props;
|
|
9381
|
-
const
|
|
9499
|
+
const [localRowHeights, setLocalRowHeights] = useState24({});
|
|
9500
|
+
const [rowHeightPreview, setRowHeightPreview] = useState24(null);
|
|
9501
|
+
const configuredRowHeights = rowHeights ?? localRowHeights;
|
|
9502
|
+
const effectiveRowHeights = useMemo10(() => rowHeightPreview ? { ...configuredRowHeights, [rowHeightPreview.key]: rowHeightPreview.height } : configuredRowHeights, [configuredRowHeights, rowHeightPreview]);
|
|
9503
|
+
const resizeMin = Math.max(SIZE_ROW_HEIGHT[size], Number.isFinite(minRowHeight) ? minRowHeight : SIZE_ROW_HEIGHT[size]);
|
|
9504
|
+
const resizeMax = Math.max(resizeMin, Number.isFinite(maxRowHeight) ? maxRowHeight : 480);
|
|
9505
|
+
const managedRowHeights = rowHeights !== void 0 || rowResizable || Object.keys(localRowHeights).length > 0;
|
|
9506
|
+
const commitRowHeight = useCallback2((row, height2) => {
|
|
9507
|
+
if (rowHeights === void 0) setLocalRowHeights((previous) => ({ ...previous, [String(row.key)]: height2 }));
|
|
9508
|
+
onRowHeightChange?.(row.record, height2, row.sourceIndex);
|
|
9509
|
+
}, [rowHeights, onRowHeightChange]);
|
|
9510
|
+
const rootRef = useRef24(null);
|
|
9382
9511
|
const remainingHeight = useRemainingHeight(rootRef, height == null && tableHeight == null ? fillRemaining : false);
|
|
9383
|
-
const scrollRef =
|
|
9384
|
-
const cellFocusRequest =
|
|
9385
|
-
const cellGlow =
|
|
9386
|
-
|
|
9512
|
+
const scrollRef = useRef24(null);
|
|
9513
|
+
const cellFocusRequest = useRef24(0);
|
|
9514
|
+
const cellGlow = useRef24(null);
|
|
9515
|
+
useEffect17(() => () => {
|
|
9387
9516
|
cellFocusRequest.current++;
|
|
9388
9517
|
cellGlow.current?.();
|
|
9389
9518
|
}, []);
|
|
9390
|
-
const tableRef =
|
|
9519
|
+
const tableRef = useRef24(null);
|
|
9391
9520
|
useScrollbarProximity();
|
|
9392
|
-
const scrollbarDragRef =
|
|
9521
|
+
const scrollbarDragRef = useRef24(null);
|
|
9393
9522
|
const [internalLoading, setInternalLoading] = useState24(false);
|
|
9394
9523
|
const [scrollTop, setScrollTop] = useState24(0);
|
|
9395
9524
|
const [scrollLeft, setScrollLeft] = useState24(0);
|
|
@@ -9411,14 +9540,14 @@ function TableInner(props, ref) {
|
|
|
9411
9540
|
return plugins;
|
|
9412
9541
|
}, [builtInHighlightPlugin, builtInResizePlugin, builtInCellSelectionPlugin, builtInIndexPlugin, providedPlugins, resizable, cellSelection, showIndex]);
|
|
9413
9542
|
const sortedPlugins = useMemo10(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
|
|
9414
|
-
const pluginsByIdRef =
|
|
9543
|
+
const pluginsByIdRef = useRef24(/* @__PURE__ */ new Map());
|
|
9415
9544
|
pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
9416
9545
|
const [pluginStates, setPluginStates] = useState24(() => Object.fromEntries(
|
|
9417
9546
|
sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
|
|
9418
9547
|
));
|
|
9419
|
-
const pluginApisRef =
|
|
9420
|
-
const contextsRef =
|
|
9421
|
-
const mountedPluginsRef =
|
|
9548
|
+
const pluginApisRef = useRef24({});
|
|
9549
|
+
const contextsRef = useRef24(/* @__PURE__ */ new Map());
|
|
9550
|
+
const mountedPluginsRef = useRef24(/* @__PURE__ */ new Map());
|
|
9422
9551
|
const pipeline = { columns: baseColumns, rows: createTableRows(dataSource, getRowKey) };
|
|
9423
9552
|
const nextApis = {};
|
|
9424
9553
|
const contexts = /* @__PURE__ */ new Map();
|
|
@@ -9475,7 +9604,7 @@ function TableInner(props, ref) {
|
|
|
9475
9604
|
});
|
|
9476
9605
|
pluginApisRef.current = nextApis;
|
|
9477
9606
|
contextsRef.current = contexts;
|
|
9478
|
-
|
|
9607
|
+
useEffect17(() => {
|
|
9479
9608
|
const activePlugins2 = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
9480
9609
|
for (const [pluginId, mounted] of mountedPluginsRef.current) {
|
|
9481
9610
|
if (activePlugins2.get(pluginId) === mounted.plugin) continue;
|
|
@@ -9487,7 +9616,7 @@ function TableInner(props, ref) {
|
|
|
9487
9616
|
mountedPluginsRef.current.set(plugin.id, { plugin, cleanup: plugin.onMount(contextsRef.current.get(plugin.id)) });
|
|
9488
9617
|
}
|
|
9489
9618
|
}, [sortedPlugins]);
|
|
9490
|
-
|
|
9619
|
+
useEffect17(() => () => {
|
|
9491
9620
|
for (const mounted of mountedPluginsRef.current.values()) mounted.cleanup?.();
|
|
9492
9621
|
mountedPluginsRef.current.clear();
|
|
9493
9622
|
}, []);
|
|
@@ -9531,7 +9660,7 @@ function TableInner(props, ref) {
|
|
|
9531
9660
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-size", `${verticalThumb}px`);
|
|
9532
9661
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-position", `${verticalPosition}px`);
|
|
9533
9662
|
}, []);
|
|
9534
|
-
|
|
9663
|
+
useEffect17(() => {
|
|
9535
9664
|
const element = scrollRef.current;
|
|
9536
9665
|
if (!element || typeof ResizeObserver === "undefined") return;
|
|
9537
9666
|
const observer = new ResizeObserver(() => {
|
|
@@ -9544,19 +9673,19 @@ function TableInner(props, ref) {
|
|
|
9544
9673
|
updateScrollMetrics();
|
|
9545
9674
|
return () => observer.disconnect();
|
|
9546
9675
|
}, [updateScrollMetrics]);
|
|
9547
|
-
|
|
9676
|
+
useEffect17(() => {
|
|
9548
9677
|
updateScrollMetrics();
|
|
9549
9678
|
});
|
|
9550
9679
|
const orderedColumns = useMemo10(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
|
|
9551
9680
|
const leafColumns = useMemo10(() => flattenTableColumns(orderedColumns), [orderedColumns]);
|
|
9552
9681
|
const headerRows = useMemo10(() => buildHeaderRows(orderedColumns), [orderedColumns]);
|
|
9553
|
-
const measuredCells =
|
|
9682
|
+
const measuredCells = useRef24(/* @__PURE__ */ new WeakSet());
|
|
9554
9683
|
const autoWidthSignature = leafColumns.map((column) => `${column.key}:${column.autoWidth}:${resizedWidths[column.key] ?? ""}`).join("|");
|
|
9555
|
-
|
|
9684
|
+
useEffect17(() => {
|
|
9556
9685
|
measuredCells.current = /* @__PURE__ */ new WeakSet();
|
|
9557
9686
|
setAutoColumnWidths({});
|
|
9558
9687
|
}, [dataSource, baseColumns, size, autoWidthSignature]);
|
|
9559
|
-
|
|
9688
|
+
useEffect17(() => {
|
|
9560
9689
|
const autoWidthColumns = leafColumns.filter((column) => column.autoWidth && resizedWidths[column.key] === void 0);
|
|
9561
9690
|
const root = rootRef.current;
|
|
9562
9691
|
if (!root || autoWidthColumns.length === 0) return;
|
|
@@ -9625,12 +9754,13 @@ function TableInner(props, ref) {
|
|
|
9625
9754
|
}
|
|
9626
9755
|
const leftFixedEdgeKey = [...leafColumns].reverse().find((column) => normalizeFixed(column.fixed) === "left")?.key;
|
|
9627
9756
|
const rightFixedEdgeKey = leafColumns.find((column) => normalizeFixed(column.fixed) === "right")?.key;
|
|
9628
|
-
const canvas = renderMode === "canvas" && !sortedPlugins.some((plugin) => plugin.disableVirtual);
|
|
9757
|
+
const canvas = renderMode === "canvas" && !managedRowHeights && !sortedPlugins.some((plugin) => plugin.disableVirtual);
|
|
9629
9758
|
const shouldVirtualize = canvas || pipeline.rows.length > 100 || (virtual ?? pipeline.rows.length >= virtualThreshold) && !sortedPlugins.some((plugin) => plugin.disableVirtual);
|
|
9630
|
-
const
|
|
9759
|
+
const rowLayout = createRowHeightLayout(pipeline.rows, rowHeight, effectiveRowHeights, SIZE_ROW_HEIGHT[size]);
|
|
9760
|
+
const windowTop = Math.min(scrollTop, Math.max(0, rowLayout.total - viewportHeight));
|
|
9761
|
+
const firstVisibleIndex = rowLayout.indexAt(windowTop);
|
|
9631
9762
|
const startIndex = shouldVirtualize ? Math.max(0, firstVisibleIndex - overscan) : 0;
|
|
9632
|
-
const
|
|
9633
|
-
const endIndex = shouldVirtualize ? Math.min(pipeline.rows.length, startIndex + visibleCount) : pipeline.rows.length;
|
|
9763
|
+
const endIndex = shouldVirtualize ? Math.min(pipeline.rows.length, rowLayout.indexAt(windowTop + viewportHeight) + overscan + 1) : pipeline.rows.length;
|
|
9634
9764
|
const renderedRows = pipeline.rows.slice(startIndex, endIndex);
|
|
9635
9765
|
const visibleColumns = /* @__PURE__ */ new Set();
|
|
9636
9766
|
let columnLeft = 0;
|
|
@@ -9639,8 +9769,8 @@ function TableInner(props, ref) {
|
|
|
9639
9769
|
if (normalizeFixed(column.fixed) || columnLeft + width >= scrollLeft && columnLeft <= scrollLeft + viewportWidth) visibleColumns.add(column.key);
|
|
9640
9770
|
columnLeft += width;
|
|
9641
9771
|
}
|
|
9642
|
-
const topSpacer = shouldVirtualize ? startIndex
|
|
9643
|
-
const bottomSpacer = shouldVirtualize ?
|
|
9772
|
+
const topSpacer = shouldVirtualize ? rowLayout.offsets[startIndex] : 0;
|
|
9773
|
+
const bottomSpacer = shouldVirtualize ? rowLayout.total - rowLayout.offsets[endIndex] : 0;
|
|
9644
9774
|
const rowElements = useMemo10(() => /* @__PURE__ */ new Map(), [
|
|
9645
9775
|
dataSource,
|
|
9646
9776
|
baseColumns,
|
|
@@ -9653,6 +9783,12 @@ function TableInner(props, ref) {
|
|
|
9653
9783
|
rowClassName,
|
|
9654
9784
|
rowStatus,
|
|
9655
9785
|
getRowKey,
|
|
9786
|
+
effectiveRowHeights,
|
|
9787
|
+
managedRowHeights,
|
|
9788
|
+
rowResizable,
|
|
9789
|
+
resizeMin,
|
|
9790
|
+
resizeMax,
|
|
9791
|
+
commitRowHeight,
|
|
9656
9792
|
canvas,
|
|
9657
9793
|
scrollLeft,
|
|
9658
9794
|
onRowClick,
|
|
@@ -9661,20 +9797,20 @@ function TableInner(props, ref) {
|
|
|
9661
9797
|
]);
|
|
9662
9798
|
const toolbarStart = sortedPlugins.map((plugin) => {
|
|
9663
9799
|
const content = plugin.renderToolbarStart?.(getContext(plugin));
|
|
9664
|
-
return content ? /* @__PURE__ */
|
|
9800
|
+
return content ? /* @__PURE__ */ jsx29(Fragment9, { children: content }, `toolbar-start-${plugin.id}`) : null;
|
|
9665
9801
|
}).filter(Boolean);
|
|
9666
9802
|
const toolbarEnd = sortedPlugins.map((plugin) => {
|
|
9667
9803
|
const content = plugin.renderToolbarEnd?.(getContext(plugin));
|
|
9668
|
-
return content ? /* @__PURE__ */
|
|
9804
|
+
return content ? /* @__PURE__ */ jsx29(Fragment9, { children: content }, `toolbar-end-${plugin.id}`) : null;
|
|
9669
9805
|
}).filter(Boolean);
|
|
9670
9806
|
const summaries = sortedPlugins.flatMap((plugin) => plugin.renderSummary?.(getContext(plugin)) ?? []);
|
|
9671
9807
|
const footers = sortedPlugins.map((plugin) => {
|
|
9672
9808
|
const content = plugin.renderFooter?.(getContext(plugin));
|
|
9673
|
-
return content ? /* @__PURE__ */
|
|
9809
|
+
return content ? /* @__PURE__ */ jsx29(Fragment9, { children: content }, `footer-${plugin.id}`) : null;
|
|
9674
9810
|
}).filter(Boolean);
|
|
9675
9811
|
const overlays = sortedPlugins.map((plugin) => {
|
|
9676
9812
|
const content = plugin.renderOverlay?.(getContext(plugin));
|
|
9677
|
-
return content ? /* @__PURE__ */
|
|
9813
|
+
return content ? /* @__PURE__ */ jsx29(Fragment9, { children: content }, `overlay-${plugin.id}`) : null;
|
|
9678
9814
|
}).filter(Boolean);
|
|
9679
9815
|
const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
|
|
9680
9816
|
const effectiveHeight = height ?? tableHeight ?? remainingHeight ?? (shouldVirtualize && maxBodyHeight == null ? 420 : void 0);
|
|
@@ -9690,10 +9826,10 @@ function TableInner(props, ref) {
|
|
|
9690
9826
|
};
|
|
9691
9827
|
const handleScroll = useCallback2((event) => {
|
|
9692
9828
|
const element = event.currentTarget;
|
|
9693
|
-
if (shouldVirtualize) setScrollTop((previous) => Math.floor(previous / rowHeight)
|
|
9829
|
+
if (shouldVirtualize) setScrollTop((previous) => managedRowHeights || Math.floor(previous / rowHeight) !== Math.floor(element.scrollTop / rowHeight) ? element.scrollTop : previous);
|
|
9694
9830
|
if (canvas) setScrollLeft(element.scrollLeft);
|
|
9695
9831
|
updateScrollMetrics();
|
|
9696
|
-
}, [canvas, shouldVirtualize, rowHeight, updateScrollMetrics]);
|
|
9832
|
+
}, [canvas, shouldVirtualize, rowHeight, managedRowHeights, updateScrollMetrics]);
|
|
9697
9833
|
const handleScrollbarPointerDown = useCallback2((axis, event, track = event.currentTarget) => {
|
|
9698
9834
|
const element = scrollRef.current;
|
|
9699
9835
|
const thumb = track.firstElementChild;
|
|
@@ -9750,8 +9886,8 @@ function TableInner(props, ref) {
|
|
|
9750
9886
|
if (!viewport || !table || !viewport.clientHeight || index < 0) return false;
|
|
9751
9887
|
const row = Array.from(table.tBodies[0]?.rows ?? []).find((element) => element.dataset.rowKey === String(key));
|
|
9752
9888
|
const headerHeight = table.tHead?.offsetHeight ?? headerRows.length * rowHeight;
|
|
9753
|
-
const top = row ? row.getBoundingClientRect().top - viewport.getBoundingClientRect().top - viewport.clientTop + viewport.scrollTop : headerHeight + index
|
|
9754
|
-
const height2 = row?.offsetHeight ??
|
|
9889
|
+
const top = row ? row.getBoundingClientRect().top - viewport.getBoundingClientRect().top - viewport.clientTop + viewport.scrollTop : headerHeight + rowLayout.offsets[index];
|
|
9890
|
+
const height2 = row?.offsetHeight ?? rowLayout.sizes[index];
|
|
9755
9891
|
const headerInset = stickyHeader ? headerHeight : 0;
|
|
9756
9892
|
const footerInset = table.tFoot?.offsetHeight ?? 0;
|
|
9757
9893
|
const visibleTop = viewport.scrollTop + headerInset;
|
|
@@ -9830,7 +9966,7 @@ function TableInner(props, ref) {
|
|
|
9830
9966
|
}
|
|
9831
9967
|
};
|
|
9832
9968
|
return api;
|
|
9833
|
-
}, [dataSource.length, pipeline.columns, pipeline.rows, headerRows.length, rowHeight, stickyHeader, shouldVirtualize, updateScrollMetrics, leafColumns, columnWidths, left, right, canvas]);
|
|
9969
|
+
}, [dataSource.length, pipeline.columns, pipeline.rows, headerRows.length, rowHeight, rowLayout, stickyHeader, shouldVirtualize, updateScrollMetrics, leafColumns, columnWidths, left, right, canvas]);
|
|
9834
9970
|
const coreContext = {
|
|
9835
9971
|
pluginId: "core",
|
|
9836
9972
|
sourceData: dataSource,
|
|
@@ -9852,9 +9988,9 @@ function TableInner(props, ref) {
|
|
|
9852
9988
|
function renderHeaderContent(column, content) {
|
|
9853
9989
|
const title = getHeaderTitleText(column.title ?? column.name) || column.name || column.key;
|
|
9854
9990
|
return /* @__PURE__ */ jsxs25("span", { className: `sia-table__header-label${column.required ? " sia-table__header-label--required" : ""}`, children: [
|
|
9855
|
-
column.required && /* @__PURE__ */
|
|
9856
|
-
/* @__PURE__ */
|
|
9857
|
-
column.description != null && /* @__PURE__ */
|
|
9991
|
+
column.required && /* @__PURE__ */ jsx29("span", { className: "sia-table__required-mark", "aria-hidden": "true", children: "*" }),
|
|
9992
|
+
/* @__PURE__ */ jsx29("span", { className: "sia-table__header-label-content", "data-sia-title-overflow-only": true, ...withTitleTooltip({ title }), children: content }),
|
|
9993
|
+
column.description != null && /* @__PURE__ */ jsx29(Tooltip, { title: column.description, placement: "top", trigger: ["hover", "focus"], children: /* @__PURE__ */ jsx29("button", { type: "button", className: "sia-table__header-description", "aria-label": `${column.name ?? column.key}\u5217\u8BF4\u660E`, onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx29(Icon, { name: "info", size: 14 }) }) })
|
|
9858
9994
|
] });
|
|
9859
9995
|
}
|
|
9860
9996
|
function getPluginCellProps(row, column) {
|
|
@@ -9894,14 +10030,14 @@ function TableInner(props, ref) {
|
|
|
9894
10030
|
}
|
|
9895
10031
|
function renderSummaryRow(summary) {
|
|
9896
10032
|
let labelRendered = false;
|
|
9897
|
-
return /* @__PURE__ */
|
|
10033
|
+
return /* @__PURE__ */ jsx29("tr", { className: `sia-table__summary-row ${summary.className ?? ""}`.trim(), children: leafColumns.map((column) => {
|
|
9898
10034
|
const value = summary.values[column.key];
|
|
9899
10035
|
const isLabel = value === void 0 && !labelRendered && summary.label !== void 0;
|
|
9900
10036
|
const content = value !== void 0 ? value : isLabel ? (labelRendered = true, summary.label) : null;
|
|
9901
10037
|
const fixed = normalizeFixed(column.fixed);
|
|
9902
10038
|
const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
9903
10039
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
9904
|
-
return /* @__PURE__ */
|
|
10040
|
+
return /* @__PURE__ */ jsx29("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__ */ jsx29("span", { className: "sia-table__summary-label", children: content }) : content }, column.key);
|
|
9905
10041
|
}) }, summary.key);
|
|
9906
10042
|
}
|
|
9907
10043
|
return /* @__PURE__ */ jsxs25(
|
|
@@ -9956,18 +10092,18 @@ function TableInner(props, ref) {
|
|
|
9956
10092
|
},
|
|
9957
10093
|
children: [
|
|
9958
10094
|
hasToolbar ? /* @__PURE__ */ jsxs25("div", { className: "sia-table__toolbar", children: [
|
|
9959
|
-
/* @__PURE__ */
|
|
9960
|
-
/* @__PURE__ */
|
|
10095
|
+
/* @__PURE__ */ jsx29("div", { children: toolbarStart }),
|
|
10096
|
+
/* @__PURE__ */ jsx29("div", { children: toolbarEnd })
|
|
9961
10097
|
] }) : null,
|
|
9962
10098
|
/* @__PURE__ */ jsxs25("div", { className: "sia-table__viewport-wrap", style: viewportStyle, children: [
|
|
9963
|
-
/* @__PURE__ */
|
|
9964
|
-
/* @__PURE__ */
|
|
9965
|
-
/* @__PURE__ */
|
|
10099
|
+
/* @__PURE__ */ jsx29("div", { className: "sia-table__viewport", ref: scrollRef, onScroll: handleScroll, children: /* @__PURE__ */ jsxs25("table", { ref: tableRef, className: "sia-table__element", style: { width: Math.max(totalWidth, 1), ...manualColumnLayout ? { minWidth: 0 } : {}, ...tableStyle }, children: [
|
|
10100
|
+
/* @__PURE__ */ jsx29("colgroup", { children: leafColumns.map((column) => /* @__PURE__ */ jsx29("col", { "data-column-key": column.key, style: { width: columnWidths.get(column.key) ?? DEFAULT_WIDTH } }, column.key)) }),
|
|
10101
|
+
/* @__PURE__ */ jsx29("thead", { className: stickyHeader ? "sia-table__head sia-table__head--sticky" : "sia-table__head", children: headerRows.map((headerRow, depth) => /* @__PURE__ */ jsx29("tr", { children: headerRow.map((cell) => {
|
|
9966
10102
|
const fixed = cell.fixed;
|
|
9967
10103
|
const pluginHeaderProps = getPluginHeaderCellProps(cell.column);
|
|
9968
10104
|
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" : "";
|
|
9969
10105
|
const autoWidthClass = cell.column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
9970
|
-
return /* @__PURE__ */
|
|
10106
|
+
return /* @__PURE__ */ jsx29(
|
|
9971
10107
|
"th",
|
|
9972
10108
|
{
|
|
9973
10109
|
"data-column-key": cell.column.key,
|
|
@@ -9989,9 +10125,9 @@ function TableInner(props, ref) {
|
|
|
9989
10125
|
);
|
|
9990
10126
|
}) }, depth)) }),
|
|
9991
10127
|
/* @__PURE__ */ jsxs25("tbody", { children: [
|
|
9992
|
-
maxBodyHeight != null && pipeline.rows.length === 0 ? /* @__PURE__ */
|
|
9993
|
-
pipeline.rows.length === 0 && summaries.length > 0 ? /* @__PURE__ */
|
|
9994
|
-
topSpacer > 0 ? /* @__PURE__ */
|
|
10128
|
+
maxBodyHeight != null && pipeline.rows.length === 0 ? /* @__PURE__ */ jsx29("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx29("td", { colSpan: leafColumns.length, style: { height: 120, padding: 0, border: 0 } }) }) : null,
|
|
10129
|
+
pipeline.rows.length === 0 && summaries.length > 0 ? /* @__PURE__ */ jsx29("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx29("td", { colSpan: leafColumns.length, style: { height: Math.max(0, viewportHeight - (headerRows.length + summaries.length) * rowHeight), padding: 0, border: 0 } }) }) : null,
|
|
10130
|
+
topSpacer > 0 ? /* @__PURE__ */ jsx29("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx29("td", { colSpan: leafColumns.length, style: { height: topSpacer, padding: 0, border: 0 } }) }) : null,
|
|
9995
10131
|
renderedRows.map((row, offset) => {
|
|
9996
10132
|
const cached = rowElements.get(row.key);
|
|
9997
10133
|
if (cached) return cached;
|
|
@@ -10000,7 +10136,7 @@ function TableInner(props, ref) {
|
|
|
10000
10136
|
const status = typeof rowStatus === "function" ? rowStatus(row.record, row.sourceIndex) : rowStatus;
|
|
10001
10137
|
const statusClass = status ? `sia-table__row--${status}` : "";
|
|
10002
10138
|
const customClass = typeof rowClassName === "function" ? rowClassName(row.record, row.sourceIndex) : rowClassName ?? "";
|
|
10003
|
-
const element = /* @__PURE__ */
|
|
10139
|
+
const element = /* @__PURE__ */ jsx29(
|
|
10004
10140
|
TableBodyRow,
|
|
10005
10141
|
{
|
|
10006
10142
|
canvas,
|
|
@@ -10013,7 +10149,14 @@ function TableInner(props, ref) {
|
|
|
10013
10149
|
leftFixedEdgeKey,
|
|
10014
10150
|
rightFixedEdgeKey,
|
|
10015
10151
|
striped,
|
|
10016
|
-
rowHeight,
|
|
10152
|
+
rowHeight: rowLayout.sizes[rowIndex],
|
|
10153
|
+
managedHeight: managedRowHeights,
|
|
10154
|
+
resize: rowResizable ? {
|
|
10155
|
+
min: resizeMin,
|
|
10156
|
+
max: resizeMax,
|
|
10157
|
+
onPreview: (height2) => setRowHeightPreview(height2 === null ? null : { key: String(row.key), height: height2 }),
|
|
10158
|
+
onCommit: (height2) => commitRowHeight(row, height2)
|
|
10159
|
+
} : void 0,
|
|
10017
10160
|
className: `${statusClass} ${pluginClasses} ${customClass}`.trim(),
|
|
10018
10161
|
onClick: () => {
|
|
10019
10162
|
for (const plugin of sortedPlugins) plugin.onRowClick?.(row, getContext(plugin));
|
|
@@ -10036,6 +10179,9 @@ function TableInner(props, ref) {
|
|
|
10036
10179
|
onCellClick: (column, event) => {
|
|
10037
10180
|
for (const plugin of sortedPlugins) plugin.onCellClick?.(row, column, event, getContext(plugin));
|
|
10038
10181
|
},
|
|
10182
|
+
onCellDoubleClick: (column, event) => {
|
|
10183
|
+
for (const plugin of sortedPlugins) plugin.onCellDoubleClick?.(row, column, event, getContext(plugin));
|
|
10184
|
+
},
|
|
10039
10185
|
onCellContextMenu: (column, event) => {
|
|
10040
10186
|
onCellContextMenu?.(row.record, column, row.sourceIndex, event);
|
|
10041
10187
|
},
|
|
@@ -10051,13 +10197,13 @@ function TableInner(props, ref) {
|
|
|
10051
10197
|
rowElements.set(row.key, element);
|
|
10052
10198
|
return element;
|
|
10053
10199
|
}),
|
|
10054
|
-
bottomSpacer > 0 ? /* @__PURE__ */
|
|
10200
|
+
bottomSpacer > 0 ? /* @__PURE__ */ jsx29("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx29("td", { colSpan: leafColumns.length, style: { height: bottomSpacer, padding: 0, border: 0 } }) }) : null
|
|
10055
10201
|
] }),
|
|
10056
|
-
summaries.length > 0 ? /* @__PURE__ */
|
|
10202
|
+
summaries.length > 0 ? /* @__PURE__ */ jsx29("tfoot", { className: "sia-table__summary", children: summaries.map(renderSummaryRow) }) : null
|
|
10057
10203
|
] }) }),
|
|
10058
|
-
pipeline.rows.length === 0 ? /* @__PURE__ */
|
|
10059
|
-
canvas ? /* @__PURE__ */
|
|
10060
|
-
/* @__PURE__ */
|
|
10204
|
+
pipeline.rows.length === 0 ? /* @__PURE__ */ jsx29("div", { className: "sia-table__empty", role: "status", children: emptyText }) : null,
|
|
10205
|
+
canvas ? /* @__PURE__ */ jsx29(TableCanvasLayer, { viewport: scrollRef, rows: pipeline.rows, columns: leafColumns, widths: columnWidths, rowHeight, headerHeight: headerRows.length * rowHeight }) : null,
|
|
10206
|
+
/* @__PURE__ */ jsx29(
|
|
10061
10207
|
"div",
|
|
10062
10208
|
{
|
|
10063
10209
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--horizontal",
|
|
@@ -10068,10 +10214,10 @@ function TableInner(props, ref) {
|
|
|
10068
10214
|
onPointerMove: handleScrollbarPointerMove,
|
|
10069
10215
|
onPointerUp: handleScrollbarPointerEnd,
|
|
10070
10216
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
10071
|
-
children: /* @__PURE__ */
|
|
10217
|
+
children: /* @__PURE__ */ jsx29("div", { className: "sia-table__scrollbar-thumb" })
|
|
10072
10218
|
}
|
|
10073
10219
|
),
|
|
10074
|
-
/* @__PURE__ */
|
|
10220
|
+
/* @__PURE__ */ jsx29(
|
|
10075
10221
|
"div",
|
|
10076
10222
|
{
|
|
10077
10223
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--vertical",
|
|
@@ -10082,14 +10228,14 @@ function TableInner(props, ref) {
|
|
|
10082
10228
|
onPointerMove: handleScrollbarPointerMove,
|
|
10083
10229
|
onPointerUp: handleScrollbarPointerEnd,
|
|
10084
10230
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
10085
|
-
children: /* @__PURE__ */
|
|
10231
|
+
children: /* @__PURE__ */ jsx29("div", { className: "sia-table__scrollbar-thumb" })
|
|
10086
10232
|
}
|
|
10087
10233
|
)
|
|
10088
10234
|
] }),
|
|
10089
|
-
footers.length > 0 ? /* @__PURE__ */
|
|
10235
|
+
footers.length > 0 ? /* @__PURE__ */ jsx29("div", { className: "sia-table__footer", children: footers }) : null,
|
|
10090
10236
|
loading || internalLoading ? /* @__PURE__ */ jsxs25("div", { className: "sia-table__loading", role: "status", children: [
|
|
10091
|
-
/* @__PURE__ */
|
|
10092
|
-
/* @__PURE__ */
|
|
10237
|
+
/* @__PURE__ */ jsx29(Icon, { name: "loader", size: 22, spin: true }),
|
|
10238
|
+
/* @__PURE__ */ jsx29("span", { children: "\u52A0\u8F7D\u4E2D" })
|
|
10093
10239
|
] }) : null,
|
|
10094
10240
|
overlays
|
|
10095
10241
|
]
|
|
@@ -10162,7 +10308,7 @@ function incrementWorksheetValue(value, offset) {
|
|
|
10162
10308
|
}
|
|
10163
10309
|
|
|
10164
10310
|
// src/components/Table/worksheet.tsx
|
|
10165
|
-
import { Fragment as Fragment10, jsx as
|
|
10311
|
+
import { Fragment as Fragment10, jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
10166
10312
|
var isEmpty2 = (value) => value == null || value === "";
|
|
10167
10313
|
var editorKind = (column) => !column.editable ? "readonly" : typeof column.editable === "object" ? column.editable.type ?? "input" : "input";
|
|
10168
10314
|
var nativeEditor = (target) => target instanceof Element && Boolean(
|
|
@@ -10462,25 +10608,34 @@ function createWorksheetPlugin(options) {
|
|
|
10462
10608
|
area && target >= 0 && fill(area, target, sourceCells(area), increment)
|
|
10463
10609
|
);
|
|
10464
10610
|
}
|
|
10465
|
-
function
|
|
10611
|
+
function fillDownValues() {
|
|
10466
10612
|
const area = bounds();
|
|
10467
10613
|
if (!area) return false;
|
|
10468
10614
|
const cells = sourceCells(area);
|
|
10615
|
+
const empty = options.isEmpty ?? isEmpty2;
|
|
10616
|
+
const cols = columns().slice(area.left, area.right + 1);
|
|
10469
10617
|
if (!cells.some(
|
|
10470
|
-
(row) => row.some((cell) => cell.kind !== "readonly" && !
|
|
10618
|
+
(row, index) => row.some((cell, columnIndex) => cell.kind !== "readonly" && !empty(cell.value, context.rows[area.top + index].record, cols[columnIndex]))
|
|
10471
10619
|
))
|
|
10472
10620
|
return false;
|
|
10473
|
-
const cols = columns().slice(area.left, area.right + 1);
|
|
10474
10621
|
let target = area.bottom;
|
|
10475
10622
|
for (let r = area.bottom + 1; r < context.rows.length; r++) {
|
|
10476
10623
|
if (cols.some(
|
|
10477
|
-
(column) => editable(context.rows[r].record, column) && !
|
|
10624
|
+
(column) => editable(context.rows[r].record, column) && !empty(valueAt(r, column), context.rows[r].record, column)
|
|
10478
10625
|
))
|
|
10479
10626
|
break;
|
|
10480
10627
|
target = r;
|
|
10481
10628
|
}
|
|
10482
10629
|
return fill(area, target, cells);
|
|
10483
10630
|
}
|
|
10631
|
+
function fillDown() {
|
|
10632
|
+
try {
|
|
10633
|
+
return fillDownValues();
|
|
10634
|
+
} catch (error) {
|
|
10635
|
+
options.onError?.(error);
|
|
10636
|
+
return false;
|
|
10637
|
+
}
|
|
10638
|
+
}
|
|
10484
10639
|
function pointTarget() {
|
|
10485
10640
|
if (!drag || !root) return;
|
|
10486
10641
|
const td = document.elementFromPoint(pointerX, pointerY)?.closest("td[data-column-key]");
|
|
@@ -10532,6 +10687,17 @@ function createWorksheetPlugin(options) {
|
|
|
10532
10687
|
id: "worksheet",
|
|
10533
10688
|
order: 71,
|
|
10534
10689
|
initialState: { editing: null, revision: 0 },
|
|
10690
|
+
// 工作表复用编辑插件的整格双击命中规则,同时解除撤销/替换数据后的编辑抑制。
|
|
10691
|
+
onCellDoubleClick(row, column, event, current) {
|
|
10692
|
+
remember(current);
|
|
10693
|
+
createEditablePlugin({ trigger: "doubleClick" }).onCellDoubleClick?.(row, column, event, {
|
|
10694
|
+
...current,
|
|
10695
|
+
setState: (next) => {
|
|
10696
|
+
suppressEditing = false;
|
|
10697
|
+
current.setState((previous) => ({ ...previous, ...typeof next === "function" ? next(previous) : next }));
|
|
10698
|
+
}
|
|
10699
|
+
});
|
|
10700
|
+
},
|
|
10535
10701
|
transformColumns(input, current) {
|
|
10536
10702
|
remember(current);
|
|
10537
10703
|
const epoch = editEpoch;
|
|
@@ -10572,7 +10738,7 @@ function createWorksheetPlugin(options) {
|
|
|
10572
10738
|
editable(record, column) && (suppressEditing || !context.state.editing);
|
|
10573
10739
|
return /* @__PURE__ */ jsxs26(Fragment10, { children: [
|
|
10574
10740
|
render ? render(value, record, index, info) : value,
|
|
10575
|
-
handle && /* @__PURE__ */
|
|
10741
|
+
handle && /* @__PURE__ */ jsx30(
|
|
10576
10742
|
"button",
|
|
10577
10743
|
{
|
|
10578
10744
|
type: "button",
|
|
@@ -10619,24 +10785,24 @@ function createWorksheetPlugin(options) {
|
|
|
10619
10785
|
renderToolbarStart(current) {
|
|
10620
10786
|
remember(current);
|
|
10621
10787
|
return options.toolbar === false ? null : /* @__PURE__ */ jsxs26("span", { className: "sia-table__worksheet-tools", children: [
|
|
10622
|
-
/* @__PURE__ */
|
|
10788
|
+
/* @__PURE__ */ jsx30(
|
|
10623
10789
|
Button,
|
|
10624
10790
|
{
|
|
10625
10791
|
variant: "text",
|
|
10626
10792
|
size: "small",
|
|
10627
|
-
icon: /* @__PURE__ */
|
|
10793
|
+
icon: /* @__PURE__ */ jsx30(Icon, { name: "undo" }),
|
|
10628
10794
|
disabled: !undoStack.length,
|
|
10629
10795
|
title: "\u64A4\u9500\uFF08Ctrl/Cmd + Z\uFF09",
|
|
10630
10796
|
onClick: api.undo,
|
|
10631
10797
|
children: "\u64A4\u9500"
|
|
10632
10798
|
}
|
|
10633
10799
|
),
|
|
10634
|
-
/* @__PURE__ */
|
|
10800
|
+
/* @__PURE__ */ jsx30(
|
|
10635
10801
|
Button,
|
|
10636
10802
|
{
|
|
10637
10803
|
variant: "text",
|
|
10638
10804
|
size: "small",
|
|
10639
|
-
icon: /* @__PURE__ */
|
|
10805
|
+
icon: /* @__PURE__ */ jsx30(Icon, { name: "redo" }),
|
|
10640
10806
|
disabled: !redoStack.length,
|
|
10641
10807
|
title: "\u6062\u590D\uFF08Ctrl/Cmd + Shift + Z \u6216 Ctrl/Cmd + Y\uFF09",
|
|
10642
10808
|
onClick: api.redo,
|
|
@@ -10647,7 +10813,7 @@ function createWorksheetPlugin(options) {
|
|
|
10647
10813
|
},
|
|
10648
10814
|
renderOverlay(current) {
|
|
10649
10815
|
remember(current);
|
|
10650
|
-
return /* @__PURE__ */
|
|
10816
|
+
return /* @__PURE__ */ jsx30(
|
|
10651
10817
|
"span",
|
|
10652
10818
|
{
|
|
10653
10819
|
hidden: true,
|
|
@@ -10735,14 +10901,14 @@ function createWorksheetPlugin(options) {
|
|
|
10735
10901
|
|
|
10736
10902
|
// src/components/Video.tsx
|
|
10737
10903
|
import { forwardRef as forwardRef7 } from "react";
|
|
10738
|
-
import { jsx as
|
|
10904
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
10739
10905
|
var Video = forwardRef7(function Video2({ controls = true, muted = false, playsInline = true, className = "", ...props }, ref) {
|
|
10740
|
-
return /* @__PURE__ */
|
|
10906
|
+
return /* @__PURE__ */ jsx31("video", { ...props, ref, controls, muted, playsInline, className: `sia-video ${className}`.trim() });
|
|
10741
10907
|
});
|
|
10742
10908
|
|
|
10743
10909
|
// src/components/InputSelect.tsx
|
|
10744
|
-
import { forwardRef as forwardRef8, useEffect as
|
|
10745
|
-
import { jsx as
|
|
10910
|
+
import { forwardRef as forwardRef8, useEffect as useEffect18, useRef as useRef25, useState as useState25 } from "react";
|
|
10911
|
+
import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
10746
10912
|
var InputSelect = forwardRef8(function InputSelect2({
|
|
10747
10913
|
options,
|
|
10748
10914
|
value,
|
|
@@ -10774,7 +10940,7 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10774
10940
|
const values = normalizeSelectionValues(current == null ? [] : Array.isArray(current) ? current : [current], options);
|
|
10775
10941
|
const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
|
|
10776
10942
|
const [draft, setDraft] = useState25(text);
|
|
10777
|
-
|
|
10943
|
+
useEffect18(() => {
|
|
10778
10944
|
setDraft(text);
|
|
10779
10945
|
}, [text, current]);
|
|
10780
10946
|
const [open, setOpen] = useState25(false);
|
|
@@ -10782,9 +10948,9 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10782
10948
|
const [modalOpen, setModalOpen] = useState25(false);
|
|
10783
10949
|
const [modalValues, setModalValues] = useState25([]);
|
|
10784
10950
|
const [selectedOnly, setSelectedOnly] = useState25(false);
|
|
10785
|
-
const rootRef =
|
|
10786
|
-
const popupRef =
|
|
10787
|
-
const inputRef =
|
|
10951
|
+
const rootRef = useRef25(null);
|
|
10952
|
+
const popupRef = useRef25(null);
|
|
10953
|
+
const inputRef = useRef25(null);
|
|
10788
10954
|
const config = typeof enableModal === "object" ? enableModal : {};
|
|
10789
10955
|
function changeOpen(next) {
|
|
10790
10956
|
if (next && (disabled || loading)) return;
|
|
@@ -10804,7 +10970,7 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10804
10970
|
inputRef.current?.focus();
|
|
10805
10971
|
}
|
|
10806
10972
|
}
|
|
10807
|
-
|
|
10973
|
+
useEffect18(() => {
|
|
10808
10974
|
if (!open) return;
|
|
10809
10975
|
const outside = (event) => {
|
|
10810
10976
|
if (!rootRef.current?.contains(event.target) && !popupRef.current?.contains(event.target)) changeOpen(false);
|
|
@@ -10812,7 +10978,7 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10812
10978
|
document.addEventListener("pointerdown", outside);
|
|
10813
10979
|
return () => document.removeEventListener("pointerdown", outside);
|
|
10814
10980
|
}, [open, onOpenChange]);
|
|
10815
|
-
|
|
10981
|
+
useEffect18(() => {
|
|
10816
10982
|
if (disabled || loading) {
|
|
10817
10983
|
changeOpen(false);
|
|
10818
10984
|
setModalOpen(false);
|
|
@@ -10832,7 +10998,7 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10832
10998
|
inputRef.current?.focus();
|
|
10833
10999
|
}
|
|
10834
11000
|
}, children: [
|
|
10835
|
-
/* @__PURE__ */
|
|
11001
|
+
/* @__PURE__ */ jsx32(
|
|
10836
11002
|
Input,
|
|
10837
11003
|
{
|
|
10838
11004
|
...inputProps,
|
|
@@ -10870,25 +11036,25 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10870
11036
|
changeOpen(true);
|
|
10871
11037
|
},
|
|
10872
11038
|
suffix: /* @__PURE__ */ jsxs27("span", { className: "sia-input-select__suffix", children: [
|
|
10873
|
-
allowClear && draft && !disabled && /* @__PURE__ */
|
|
11039
|
+
allowClear && draft && !disabled && /* @__PURE__ */ jsx32(Button, { className: "sia-input-select__clear", variant: "text", size: "small", disabled: loading, "aria-label": "\u6E05\u9664\u8F93\u5165\u9009\u62E9", onClick: (event) => {
|
|
10874
11040
|
event.stopPropagation();
|
|
10875
11041
|
setDraft("");
|
|
10876
11042
|
emit(multiple ? [] : void 0);
|
|
10877
11043
|
inputRef.current?.focus();
|
|
10878
11044
|
}, children: "\xD7" }),
|
|
10879
11045
|
suffix,
|
|
10880
|
-
enableModal && /* @__PURE__ */
|
|
11046
|
+
enableModal && /* @__PURE__ */ jsx32(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
|
|
10881
11047
|
event.stopPropagation();
|
|
10882
11048
|
openModal();
|
|
10883
11049
|
}, children: "\u2026" }),
|
|
10884
|
-
/* @__PURE__ */
|
|
11050
|
+
/* @__PURE__ */ jsx32(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
|
|
10885
11051
|
event.stopPropagation();
|
|
10886
11052
|
changeOpen(!open);
|
|
10887
|
-
}, children: /* @__PURE__ */
|
|
11053
|
+
}, children: /* @__PURE__ */ jsx32(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
|
|
10888
11054
|
] })
|
|
10889
11055
|
}
|
|
10890
11056
|
),
|
|
10891
|
-
/* @__PURE__ */
|
|
11057
|
+
/* @__PURE__ */ jsx32(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx32(
|
|
10892
11058
|
SelectionPanel,
|
|
10893
11059
|
{
|
|
10894
11060
|
options,
|
|
@@ -10917,14 +11083,14 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10917
11083
|
},
|
|
10918
11084
|
children: [
|
|
10919
11085
|
/* @__PURE__ */ jsxs27("div", { className: "sia-selection-panel__actions", role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
10920
|
-
/* @__PURE__ */
|
|
11086
|
+
/* @__PURE__ */ jsx32(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
10921
11087
|
/* @__PURE__ */ jsxs27(Button, { role: "tab", "aria-selected": selectedOnly, variant: selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(true), children: [
|
|
10922
11088
|
"\u5DF2\u9009\u9879(",
|
|
10923
11089
|
modalValues.length,
|
|
10924
11090
|
")"
|
|
10925
11091
|
] })
|
|
10926
11092
|
] }),
|
|
10927
|
-
modalOpen && /* @__PURE__ */
|
|
11093
|
+
modalOpen && /* @__PURE__ */ jsx32(
|
|
10928
11094
|
SelectionPanel,
|
|
10929
11095
|
{
|
|
10930
11096
|
options,
|
|
@@ -10945,10 +11111,10 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10945
11111
|
});
|
|
10946
11112
|
|
|
10947
11113
|
// src/components/QueryForm.tsx
|
|
10948
|
-
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect9, useRef as
|
|
11114
|
+
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect9, useRef as useRef29, useState as useState28 } from "react";
|
|
10949
11115
|
|
|
10950
11116
|
// src/components/useQueryFormMotion.ts
|
|
10951
|
-
import { useLayoutEffect as useLayoutEffect8, useRef as
|
|
11117
|
+
import { useLayoutEffect as useLayoutEffect8, useRef as useRef26 } from "react";
|
|
10952
11118
|
function readLayout(row) {
|
|
10953
11119
|
const root = row.getBoundingClientRect();
|
|
10954
11120
|
const scaleX = root.width / row.offsetWidth || 1, scaleY = root.height / row.offsetHeight || 1;
|
|
@@ -10961,9 +11127,9 @@ function readLayout(row) {
|
|
|
10961
11127
|
return { height: row.offsetHeight, boxes };
|
|
10962
11128
|
}
|
|
10963
11129
|
function useQueryFormMotion(ref, layoutKey) {
|
|
10964
|
-
const previous =
|
|
10965
|
-
const stop =
|
|
10966
|
-
const snapshot =
|
|
11130
|
+
const previous = useRef26();
|
|
11131
|
+
const stop = useRef26();
|
|
11132
|
+
const snapshot = useRef26();
|
|
10967
11133
|
useLayoutEffect8(() => {
|
|
10968
11134
|
const row = ref.current;
|
|
10969
11135
|
if (!row) return;
|
|
@@ -11072,10 +11238,10 @@ function useQueryFormMotion(ref, layoutKey) {
|
|
|
11072
11238
|
}
|
|
11073
11239
|
|
|
11074
11240
|
// src/components/QueryFormSettings.tsx
|
|
11075
|
-
import { useEffect as
|
|
11241
|
+
import { useEffect as useEffect20, useRef as useRef28, useState as useState27 } from "react";
|
|
11076
11242
|
|
|
11077
11243
|
// src/components/useQueryFieldSort.ts
|
|
11078
|
-
import { useEffect as
|
|
11244
|
+
import { useEffect as useEffect19, useRef as useRef27, useState as useState26 } from "react";
|
|
11079
11245
|
function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
11080
11246
|
const center = rects[from].top + rects[from].height / 2 + dy;
|
|
11081
11247
|
const rest = keys.map((_, index) => index).filter((index) => index !== from);
|
|
@@ -11094,13 +11260,13 @@ function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
|
11094
11260
|
return { ordered, offsets };
|
|
11095
11261
|
}
|
|
11096
11262
|
function useQueryFieldSort(keys, enabled, onCommit) {
|
|
11097
|
-
const listRef =
|
|
11098
|
-
const cancelRef =
|
|
11099
|
-
const commitRef =
|
|
11263
|
+
const listRef = useRef27(null);
|
|
11264
|
+
const cancelRef = useRef27();
|
|
11265
|
+
const commitRef = useRef27(onCommit);
|
|
11100
11266
|
commitRef.current = onCommit;
|
|
11101
11267
|
const [preview, setPreview] = useState26();
|
|
11102
11268
|
const signature = JSON.stringify(keys);
|
|
11103
|
-
|
|
11269
|
+
useEffect19(() => {
|
|
11104
11270
|
cancelRef.current?.();
|
|
11105
11271
|
return () => cancelRef.current?.();
|
|
11106
11272
|
}, [enabled, signature]);
|
|
@@ -11223,7 +11389,7 @@ function countQueryFieldRows(centers) {
|
|
|
11223
11389
|
}
|
|
11224
11390
|
|
|
11225
11391
|
// src/components/QueryFormSettings.tsx
|
|
11226
|
-
import { Fragment as Fragment11, jsx as
|
|
11392
|
+
import { Fragment as Fragment11, jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
11227
11393
|
function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed, disabled) {
|
|
11228
11394
|
const [snapshot, setSnapshot] = useState27();
|
|
11229
11395
|
const [draft, setDraft] = useState27({ fields: [], defaultCollapsed: defaultCollapsed ?? false });
|
|
@@ -11232,9 +11398,9 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11232
11398
|
const [saving, setSaving] = useState27(false);
|
|
11233
11399
|
const [error, setError] = useState27("");
|
|
11234
11400
|
const [loadFailed, setLoadFailed] = useState27(false);
|
|
11235
|
-
const token =
|
|
11236
|
-
const saveLock =
|
|
11237
|
-
const latest =
|
|
11401
|
+
const token = useRef28(0);
|
|
11402
|
+
const saveLock = useRef28(false);
|
|
11403
|
+
const latest = useRef28({ config, fields, defaultCollapsed, applyCollapsed });
|
|
11238
11404
|
latest.current = { config, fields, defaultCollapsed, applyCollapsed };
|
|
11239
11405
|
const moduleName = config?.scope.moduleName;
|
|
11240
11406
|
const businessKey = config?.scope.businessKey;
|
|
@@ -11262,7 +11428,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11262
11428
|
if (request === token.current) setLoading(false);
|
|
11263
11429
|
}
|
|
11264
11430
|
}
|
|
11265
|
-
|
|
11431
|
+
useEffect20(() => {
|
|
11266
11432
|
setSnapshot(void 0);
|
|
11267
11433
|
setOpen(false);
|
|
11268
11434
|
setError("");
|
|
@@ -11318,7 +11484,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11318
11484
|
const items = new Map(visibleDraft.map((item) => [item.key, item]));
|
|
11319
11485
|
setDraft((current) => ({ ...current, fields: keys.map((key, order) => ({ ...items.get(key), order })) }));
|
|
11320
11486
|
});
|
|
11321
|
-
const control = config ? /* @__PURE__ */
|
|
11487
|
+
const control = config ? /* @__PURE__ */ jsx33(
|
|
11322
11488
|
Button,
|
|
11323
11489
|
{
|
|
11324
11490
|
type: "button",
|
|
@@ -11327,7 +11493,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11327
11493
|
"aria-label": "\u67E5\u8BE2\u8BBE\u7F6E",
|
|
11328
11494
|
disabled: disabled || saving,
|
|
11329
11495
|
loading: loading && !open,
|
|
11330
|
-
icon: /* @__PURE__ */
|
|
11496
|
+
icon: /* @__PURE__ */ jsx33(Icon, { name: "more-vertical" }),
|
|
11331
11497
|
onClick: () => {
|
|
11332
11498
|
setOpen(true);
|
|
11333
11499
|
void load(true);
|
|
@@ -11335,8 +11501,8 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11335
11501
|
}
|
|
11336
11502
|
) : null;
|
|
11337
11503
|
const panel = config ? /* @__PURE__ */ jsxs28(Fragment11, { children: [
|
|
11338
|
-
!open && error ? /* @__PURE__ */
|
|
11339
|
-
/* @__PURE__ */
|
|
11504
|
+
!open && error ? /* @__PURE__ */ jsx33("span", { className: "sia-query-form__error", role: "alert", children: "\u67E5\u8BE2\u8BBE\u7F6E\u8BFB\u53D6\u5931\u8D25\uFF0C\u8BF7\u6253\u5F00\u8BBE\u7F6E\u91CD\u8BD5" }) : null,
|
|
11505
|
+
/* @__PURE__ */ jsx33(
|
|
11340
11506
|
Modal,
|
|
11341
11507
|
{
|
|
11342
11508
|
title: "\u67E5\u8BE2\u8BBE\u7F6E",
|
|
@@ -11350,14 +11516,14 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11350
11516
|
if (!saveLock.current) setOpen(next);
|
|
11351
11517
|
},
|
|
11352
11518
|
children: /* @__PURE__ */ jsxs28("div", { className: "sia-query-settings", children: [
|
|
11353
|
-
loading ? /* @__PURE__ */
|
|
11519
|
+
loading ? /* @__PURE__ */ jsx33("p", { role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u67E5\u8BE2\u8BBE\u7F6E\u2026" }) : null,
|
|
11354
11520
|
error ? /* @__PURE__ */ jsxs28("div", { role: "alert", className: "sia-query-form__error", children: [
|
|
11355
11521
|
error,
|
|
11356
|
-
loadFailed ? /* @__PURE__ */
|
|
11522
|
+
loadFailed ? /* @__PURE__ */ jsx33(Button, { type: "button", variant: "link", onClick: () => void load(true), children: "\u91CD\u8BD5" }) : null
|
|
11357
11523
|
] }) : null,
|
|
11358
|
-
/* @__PURE__ */
|
|
11359
|
-
/* @__PURE__ */
|
|
11360
|
-
/* @__PURE__ */
|
|
11524
|
+
/* @__PURE__ */ jsx33(Checkbox, { checked: draft.defaultCollapsed, disabled: locked, onChange: (checked) => setDraft((current) => ({ ...current, defaultCollapsed: checked })), children: "\u9ED8\u8BA4\u6536\u8D77\u67E5\u8BE2\u6761\u4EF6" }),
|
|
11525
|
+
/* @__PURE__ */ jsx33("p", { className: "sia-query-settings__hint", children: "\u52FE\u9009\u9700\u8981\u663E\u793A\u7684\u6761\u4EF6\uFF0C\u62D6\u52A8\u6216\u4F7F\u7528\u4E0A\u4E0B\u6309\u94AE\u8C03\u6574\u987A\u5E8F\u3002" }),
|
|
11526
|
+
/* @__PURE__ */ jsx33("div", { ref: sort.listRef, className: `sia-query-settings__list${sort.preview ? " is-sorting" : ""}`, children: visibleDraft.map((item, index) => /* @__PURE__ */ jsxs28(
|
|
11361
11527
|
"div",
|
|
11362
11528
|
{
|
|
11363
11529
|
"data-query-field-key": item.key,
|
|
@@ -11365,18 +11531,18 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11365
11531
|
style: sort.preview ? { transform: `translateY(${sort.preview.offsets[item.key] ?? 0}px)` } : void 0,
|
|
11366
11532
|
onPointerDown: (event) => sort.start(event, item.key),
|
|
11367
11533
|
children: [
|
|
11368
|
-
/* @__PURE__ */
|
|
11369
|
-
/* @__PURE__ */
|
|
11370
|
-
/* @__PURE__ */
|
|
11534
|
+
/* @__PURE__ */ jsx33(Icon, { name: "menu", size: 15 }),
|
|
11535
|
+
/* @__PURE__ */ jsx33(Checkbox, { "aria-label": `\u663E\u793A ${item.key}`, checked: item.visible, disabled: locked || hideDisabledKeys.has(item.key), onChange: (checked) => setDraft((current) => ({ ...current, fields: visibleDraft.map((field) => field.key === item.key ? { ...field, visible: checked } : field) })) }),
|
|
11536
|
+
/* @__PURE__ */ jsx33("span", { className: "sia-query-settings__name", children: labels.get(item.key) ?? item.key }),
|
|
11371
11537
|
/* @__PURE__ */ jsxs28("div", { className: "sia-query-settings__order", children: [
|
|
11372
|
-
/* @__PURE__ */
|
|
11373
|
-
/* @__PURE__ */
|
|
11538
|
+
/* @__PURE__ */ jsx33(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0A\u79FB ${item.key}`, disabled: locked || index === 0, icon: /* @__PURE__ */ jsx33(Icon, { name: "chevron-up" }), onClick: () => move(index, index - 1) }),
|
|
11539
|
+
/* @__PURE__ */ jsx33(Button, { type: "button", size: "small", variant: "text", "aria-label": `\u4E0B\u79FB ${item.key}`, disabled: locked || index === visibleDraft.length - 1, icon: /* @__PURE__ */ jsx33(Icon, { name: "chevron-down" }), onClick: () => move(index, index + 1) })
|
|
11374
11540
|
] })
|
|
11375
11541
|
]
|
|
11376
11542
|
},
|
|
11377
11543
|
item.key
|
|
11378
11544
|
)) }),
|
|
11379
|
-
/* @__PURE__ */
|
|
11545
|
+
/* @__PURE__ */ jsx33(Button, { type: "button", disabled: locked, onClick: () => setDraft({ fields: reconcileQueryFields(fields.map((field) => field.key)), defaultCollapsed: defaultCollapsed ?? false }), children: "\u6062\u590D\u9ED8\u8BA4" })
|
|
11380
11546
|
] })
|
|
11381
11547
|
}
|
|
11382
11548
|
)
|
|
@@ -11385,7 +11551,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11385
11551
|
}
|
|
11386
11552
|
|
|
11387
11553
|
// src/components/QueryForm.tsx
|
|
11388
|
-
import { jsx as
|
|
11554
|
+
import { jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
11389
11555
|
function QueryForm({
|
|
11390
11556
|
fields,
|
|
11391
11557
|
settings,
|
|
@@ -11432,11 +11598,11 @@ function QueryForm({
|
|
|
11432
11598
|
const [saveError, setSaveError] = useState28("");
|
|
11433
11599
|
const [error, setError] = useState28("");
|
|
11434
11600
|
const [activeShortcut, setActiveShortcut] = useState28("");
|
|
11435
|
-
const source =
|
|
11436
|
-
const searchLock =
|
|
11437
|
-
const saveLock =
|
|
11438
|
-
const removeLock =
|
|
11439
|
-
const snapshot =
|
|
11601
|
+
const source = useRef29({ source: "submit" });
|
|
11602
|
+
const searchLock = useRef29(false);
|
|
11603
|
+
const saveLock = useRef29(false);
|
|
11604
|
+
const removeLock = useRef29(false);
|
|
11605
|
+
const snapshot = useRef29();
|
|
11440
11606
|
const busy = disabled || loading || searching;
|
|
11441
11607
|
const shortcutBusy = busy || shortcutsLoading || saving || removing;
|
|
11442
11608
|
const fieldLabel = (content) => {
|
|
@@ -11448,7 +11614,7 @@ function QueryForm({
|
|
|
11448
11614
|
width,
|
|
11449
11615
|
hideDisabled: settingsHideDisabled,
|
|
11450
11616
|
label: settingsLabel ?? item.label ?? (typeof item.children === "function" ? void 0 : fieldLabel(item.children)) ?? key,
|
|
11451
|
-
content: /* @__PURE__ */
|
|
11617
|
+
content: /* @__PURE__ */ jsx34(Form.Item, { noStyle: true, ...item })
|
|
11452
11618
|
})) : Children4.toArray(children).map((content, index) => ({
|
|
11453
11619
|
key: isValidElement5(content) && content.key != null ? String(content.key) : String(index),
|
|
11454
11620
|
width: void 0,
|
|
@@ -11463,9 +11629,9 @@ function QueryForm({
|
|
|
11463
11629
|
const entries = configured.map((item) => ({ ...entriesByKey.get(item.key), visible: item.visible, visibleIndex: item.visible ? visibleIndex++ : -1 }));
|
|
11464
11630
|
const layoutKey = JSON.stringify(configured);
|
|
11465
11631
|
const limit = Math.max(1, Math.floor(collapsedCount));
|
|
11466
|
-
const rowRef =
|
|
11467
|
-
const actionsRef =
|
|
11468
|
-
const toggleRef =
|
|
11632
|
+
const rowRef = useRef29(null);
|
|
11633
|
+
const actionsRef = useRef29(null);
|
|
11634
|
+
const toggleRef = useRef29(null);
|
|
11469
11635
|
const [fittingCount, setFittingCount] = useState28(limit);
|
|
11470
11636
|
const [settingsRows, setSettingsRows] = useState28(0);
|
|
11471
11637
|
useLayoutEffect9(() => {
|
|
@@ -11652,7 +11818,7 @@ function QueryForm({
|
|
|
11652
11818
|
},
|
|
11653
11819
|
children: [
|
|
11654
11820
|
quickQueries.length ? /* @__PURE__ */ jsxs29("div", { className: "sia-query-form__quick", "aria-label": "\u9884\u8BBE\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
11655
|
-
quickQueries.map((query) => /* @__PURE__ */
|
|
11821
|
+
quickQueries.map((query) => /* @__PURE__ */ jsx34(
|
|
11656
11822
|
Badge,
|
|
11657
11823
|
{
|
|
11658
11824
|
className: "sia-query-form__quick-badge",
|
|
@@ -11661,7 +11827,7 @@ function QueryForm({
|
|
|
11661
11827
|
title: query.count === void 0 ? void 0 : `\u5171 ${query.count} \u6761`,
|
|
11662
11828
|
...query.badgeProps,
|
|
11663
11829
|
count: query.count,
|
|
11664
|
-
children: /* @__PURE__ */
|
|
11830
|
+
children: /* @__PURE__ */ jsx34(
|
|
11665
11831
|
Button,
|
|
11666
11832
|
{
|
|
11667
11833
|
size: query.size ?? quickQuerySize,
|
|
@@ -11677,7 +11843,7 @@ function QueryForm({
|
|
|
11677
11843
|
)),
|
|
11678
11844
|
" "
|
|
11679
11845
|
] }) : null,
|
|
11680
|
-
/* @__PURE__ */
|
|
11846
|
+
/* @__PURE__ */ jsx34("div", { className: "sia-query-form__motion", children: /* @__PURE__ */ jsxs29(
|
|
11681
11847
|
"div",
|
|
11682
11848
|
{
|
|
11683
11849
|
ref: rowRef,
|
|
@@ -11686,7 +11852,7 @@ function QueryForm({
|
|
|
11686
11852
|
"--sia-query-field-width": typeof fieldWidth === "number" ? `${fieldWidth}px` : fieldWidth
|
|
11687
11853
|
},
|
|
11688
11854
|
children: [
|
|
11689
|
-
entries.map((entry) => /* @__PURE__ */
|
|
11855
|
+
entries.map((entry) => /* @__PURE__ */ jsx34(
|
|
11690
11856
|
"div",
|
|
11691
11857
|
{
|
|
11692
11858
|
className: "sia-query-form__field",
|
|
@@ -11702,7 +11868,7 @@ function QueryForm({
|
|
|
11702
11868
|
)),
|
|
11703
11869
|
/* @__PURE__ */ jsxs29("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
|
|
11704
11870
|
/* @__PURE__ */ jsxs29(Space.Compact, { children: [
|
|
11705
|
-
/* @__PURE__ */
|
|
11871
|
+
/* @__PURE__ */ jsx34(
|
|
11706
11872
|
Button,
|
|
11707
11873
|
{
|
|
11708
11874
|
type: "submit",
|
|
@@ -11712,8 +11878,8 @@ function QueryForm({
|
|
|
11712
11878
|
children: searchText
|
|
11713
11879
|
}
|
|
11714
11880
|
),
|
|
11715
|
-
/* @__PURE__ */
|
|
11716
|
-
onSaveQuery ? /* @__PURE__ */
|
|
11881
|
+
/* @__PURE__ */ jsx34(Button, { disabled: busy, onClick: reset, children: resetText }),
|
|
11882
|
+
onSaveQuery ? /* @__PURE__ */ jsx34(
|
|
11717
11883
|
Button,
|
|
11718
11884
|
{
|
|
11719
11885
|
disabled: shortcutBusy,
|
|
@@ -11728,12 +11894,12 @@ function QueryForm({
|
|
|
11728
11894
|
) : null,
|
|
11729
11895
|
showSettings ?? settingsRows > 2 ? cloudSettings.control : null
|
|
11730
11896
|
] }),
|
|
11731
|
-
collapsible && entries.length > 0 ? /* @__PURE__ */
|
|
11897
|
+
collapsible && entries.length > 0 ? /* @__PURE__ */ jsx34("span", { ref: toggleRef, hidden: !needsCollapse, children: /* @__PURE__ */ jsx34(
|
|
11732
11898
|
Button,
|
|
11733
11899
|
{
|
|
11734
11900
|
variant: "link",
|
|
11735
11901
|
"aria-expanded": !collapsed,
|
|
11736
|
-
icon: /* @__PURE__ */
|
|
11902
|
+
icon: /* @__PURE__ */ jsx34(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
|
|
11737
11903
|
iconPosition: "end",
|
|
11738
11904
|
onClick: () => {
|
|
11739
11905
|
setInternalCollapsed(!collapsed);
|
|
@@ -11749,7 +11915,7 @@ function QueryForm({
|
|
|
11749
11915
|
}
|
|
11750
11916
|
) }),
|
|
11751
11917
|
savedQueries.length ? /* @__PURE__ */ jsxs29("div", { className: "sia-query-form__saved", "aria-label": "\u5DF2\u4FDD\u5B58\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
11752
|
-
savedQueries.map((query, index) => /* @__PURE__ */
|
|
11918
|
+
savedQueries.map((query, index) => /* @__PURE__ */ jsx34(
|
|
11753
11919
|
Tag,
|
|
11754
11920
|
{
|
|
11755
11921
|
status: query.status ?? ["processing", "success", "warning", "error"][index % 4],
|
|
@@ -11775,7 +11941,7 @@ function QueryForm({
|
|
|
11775
11941
|
)),
|
|
11776
11942
|
" "
|
|
11777
11943
|
] }) : null,
|
|
11778
|
-
error ? /* @__PURE__ */
|
|
11944
|
+
error ? /* @__PURE__ */ jsx34("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
|
|
11779
11945
|
]
|
|
11780
11946
|
}
|
|
11781
11947
|
),
|
|
@@ -11791,7 +11957,7 @@ function QueryForm({
|
|
|
11791
11957
|
if (!saveLock.current) setSaveOpen(next);
|
|
11792
11958
|
},
|
|
11793
11959
|
children: [
|
|
11794
|
-
/* @__PURE__ */
|
|
11960
|
+
/* @__PURE__ */ jsx34(
|
|
11795
11961
|
Input,
|
|
11796
11962
|
{
|
|
11797
11963
|
autoFocus: true,
|
|
@@ -11810,7 +11976,7 @@ function QueryForm({
|
|
|
11810
11976
|
}
|
|
11811
11977
|
}
|
|
11812
11978
|
),
|
|
11813
|
-
saveError ? /* @__PURE__ */
|
|
11979
|
+
saveError ? /* @__PURE__ */ jsx34("p", { className: "sia-query-form__error", role: "alert", children: saveError }) : null
|
|
11814
11980
|
]
|
|
11815
11981
|
}
|
|
11816
11982
|
)
|
|
@@ -11819,7 +11985,7 @@ function QueryForm({
|
|
|
11819
11985
|
|
|
11820
11986
|
// src/components/NumberRange.tsx
|
|
11821
11987
|
import { forwardRef as forwardRef9 } from "react";
|
|
11822
|
-
import { jsx as
|
|
11988
|
+
import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
11823
11989
|
var NumberRange = forwardRef9(function NumberRange2({
|
|
11824
11990
|
value,
|
|
11825
11991
|
defaultValue = [null, null],
|
|
@@ -11857,7 +12023,7 @@ var NumberRange = forwardRef9(function NumberRange2({
|
|
|
11857
12023
|
"aria-disabled": disabled || void 0,
|
|
11858
12024
|
className: `sia-number-range sia-number-range--${size} sia-number-range--${status}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
11859
12025
|
children: [
|
|
11860
|
-
/* @__PURE__ */
|
|
12026
|
+
/* @__PURE__ */ jsx35(
|
|
11861
12027
|
InputNumber,
|
|
11862
12028
|
{
|
|
11863
12029
|
...inputProps,
|
|
@@ -11869,8 +12035,8 @@ var NumberRange = forwardRef9(function NumberRange2({
|
|
|
11869
12035
|
onChange: (next) => change(0, next)
|
|
11870
12036
|
}
|
|
11871
12037
|
),
|
|
11872
|
-
/* @__PURE__ */
|
|
11873
|
-
/* @__PURE__ */
|
|
12038
|
+
/* @__PURE__ */ jsx35(Icon, { className: "sia-number-range__separator", name: "tilde", size: 12, strokeWidth: 1.5, "aria-hidden": "true" }),
|
|
12039
|
+
/* @__PURE__ */ jsx35(
|
|
11874
12040
|
InputNumber,
|
|
11875
12041
|
{
|
|
11876
12042
|
...inputProps,
|
|
@@ -11882,15 +12048,15 @@ var NumberRange = forwardRef9(function NumberRange2({
|
|
|
11882
12048
|
onChange: (next) => change(1, next)
|
|
11883
12049
|
}
|
|
11884
12050
|
),
|
|
11885
|
-
allowClear && !disabled && !readOnly && range.some((item) => item !== null) ? /* @__PURE__ */
|
|
12051
|
+
allowClear && !disabled && !readOnly && range.some((item) => item !== null) ? /* @__PURE__ */ jsx35("button", { type: "button", className: "sia-number-range__clear", "aria-label": "\u6E05\u9664\u6570\u5B57\u533A\u95F4", onClick: () => setValue2([null, null]), children: /* @__PURE__ */ jsx35(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null
|
|
11886
12052
|
]
|
|
11887
12053
|
}
|
|
11888
12054
|
);
|
|
11889
12055
|
});
|
|
11890
12056
|
|
|
11891
12057
|
// src/components/VirtualGrid.tsx
|
|
11892
|
-
import { useEffect as
|
|
11893
|
-
import { jsx as
|
|
12058
|
+
import { useEffect as useEffect21, useLayoutEffect as useLayoutEffect10, useRef as useRef30, useState as useState29 } from "react";
|
|
12059
|
+
import { jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
11894
12060
|
function VirtualGrid({
|
|
11895
12061
|
items,
|
|
11896
12062
|
itemKey,
|
|
@@ -11909,11 +12075,11 @@ function VirtualGrid({
|
|
|
11909
12075
|
tabIndex = 0,
|
|
11910
12076
|
...props
|
|
11911
12077
|
}) {
|
|
11912
|
-
const viewport =
|
|
12078
|
+
const viewport = useRef30(null);
|
|
11913
12079
|
const [size, setSize] = useState29({ width: 0, height: 0 });
|
|
11914
12080
|
const [scrollTop, setScrollTop] = useState29(0);
|
|
11915
|
-
const frame =
|
|
11916
|
-
const requestedLength =
|
|
12081
|
+
const frame = useRef30();
|
|
12082
|
+
const requestedLength = useRef30();
|
|
11917
12083
|
const height = Math.max(1, rowHeight);
|
|
11918
12084
|
const spacing = Math.max(0, gap);
|
|
11919
12085
|
const columns = Math.max(1, Math.floor((size.width + spacing) / (Math.max(1, minColumnWidth) + spacing)));
|
|
@@ -11942,7 +12108,7 @@ function VirtualGrid({
|
|
|
11942
12108
|
if (el.scrollTop !== next) el.scrollTop = next;
|
|
11943
12109
|
setScrollTop(next);
|
|
11944
12110
|
}, [totalHeight, size.height]);
|
|
11945
|
-
|
|
12111
|
+
useEffect21(() => {
|
|
11946
12112
|
if (!onLoadMore || !hasMore || loading || size.height <= 0) return;
|
|
11947
12113
|
if (totalHeight - scrollTop - size.height > Math.max(0, loadMoreThreshold)) return;
|
|
11948
12114
|
if (requestedLength.current === items.length) return;
|
|
@@ -11967,16 +12133,16 @@ function VirtualGrid({
|
|
|
11967
12133
|
});
|
|
11968
12134
|
},
|
|
11969
12135
|
children: [
|
|
11970
|
-
/* @__PURE__ */
|
|
12136
|
+
/* @__PURE__ */ jsx36("div", { className: "sia-virtual-grid__spacer", style: { height: totalHeight }, children: Array.from({ length: Math.max(0, endRow - startRow) }, (_, offset) => {
|
|
11971
12137
|
const row = startRow + offset;
|
|
11972
|
-
return /* @__PURE__ */
|
|
12138
|
+
return /* @__PURE__ */ jsx36("div", { className: "sia-virtual-grid__row", role: "presentation", style: {
|
|
11973
12139
|
top: row * stride,
|
|
11974
12140
|
height,
|
|
11975
12141
|
columnGap: spacing,
|
|
11976
12142
|
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`
|
|
11977
12143
|
}, children: items.slice(row * columns, (row + 1) * columns).map((item, column) => {
|
|
11978
12144
|
const index = row * columns + column;
|
|
11979
|
-
return /* @__PURE__ */
|
|
12145
|
+
return /* @__PURE__ */ jsx36("div", { className: "sia-virtual-grid__item", role: "listitem", "aria-posinset": index + 1, "aria-setsize": hasMore ? -1 : items.length, children: renderItem(item, index) }, itemKey(item, index));
|
|
11980
12146
|
}) }, row);
|
|
11981
12147
|
}) }),
|
|
11982
12148
|
!items.length && !loading ? empty : null
|