@sia.soul/sia-react-ui 0.1.149 → 0.1.150
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1744 -1604
- package/dist/index.css +27 -0
- package/dist/index.d.cts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +400 -260
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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
|
]
|
|
@@ -8192,15 +8287,15 @@ function EditableTableCell({
|
|
|
8192
8287
|
const config = typeof editable === "object" ? editable : { type: "input" };
|
|
8193
8288
|
const [editValue, setEditValue] = useState23(value);
|
|
8194
8289
|
const [saving, setSaving] = useState23(false);
|
|
8195
|
-
const inputRef =
|
|
8196
|
-
const editorRef =
|
|
8197
|
-
const editValueRef =
|
|
8198
|
-
const savingRef =
|
|
8199
|
-
const saveRef =
|
|
8290
|
+
const inputRef = useRef23(null);
|
|
8291
|
+
const editorRef = useRef23(null);
|
|
8292
|
+
const editValueRef = useRef23(value);
|
|
8293
|
+
const savingRef = useRef23(false);
|
|
8294
|
+
const saveRef = useRef23(
|
|
8200
8295
|
async () => {
|
|
8201
8296
|
}
|
|
8202
8297
|
);
|
|
8203
|
-
|
|
8298
|
+
useEffect16(() => {
|
|
8204
8299
|
if (!active) return;
|
|
8205
8300
|
editValueRef.current = value;
|
|
8206
8301
|
setEditValue(value);
|
|
@@ -8231,7 +8326,7 @@ function EditableTableCell({
|
|
|
8231
8326
|
}
|
|
8232
8327
|
}
|
|
8233
8328
|
saveRef.current = save;
|
|
8234
|
-
|
|
8329
|
+
useEffect16(() => {
|
|
8235
8330
|
if (!active || config.type === "select" || config.type === "custom") return;
|
|
8236
8331
|
const handleOutsidePointerDown = (event) => {
|
|
8237
8332
|
const target = event.target;
|
|
@@ -8254,8 +8349,8 @@ function EditableTableCell({
|
|
|
8254
8349
|
onClick: trigger === "click" ? onStart : void 0,
|
|
8255
8350
|
onDoubleClick: trigger === "doubleClick" ? onStart : void 0,
|
|
8256
8351
|
children: [
|
|
8257
|
-
/* @__PURE__ */
|
|
8258
|
-
showEditIcon && /* @__PURE__ */
|
|
8352
|
+
/* @__PURE__ */ jsx28("span", { children: content }),
|
|
8353
|
+
showEditIcon && /* @__PURE__ */ jsx28(Icon, { name: "edit", size: 13 })
|
|
8259
8354
|
]
|
|
8260
8355
|
}
|
|
8261
8356
|
);
|
|
@@ -8263,7 +8358,7 @@ function EditableTableCell({
|
|
|
8263
8358
|
if (config.type === "custom" && config.editRender) {
|
|
8264
8359
|
editor = config.editRender(record, (next) => void save(next), onCancel);
|
|
8265
8360
|
} else if (config.type === "inputNumber") {
|
|
8266
|
-
editor = /* @__PURE__ */
|
|
8361
|
+
editor = /* @__PURE__ */ jsx28(
|
|
8267
8362
|
InputNumber,
|
|
8268
8363
|
{
|
|
8269
8364
|
ref: inputRef,
|
|
@@ -8284,7 +8379,7 @@ function EditableTableCell({
|
|
|
8284
8379
|
}
|
|
8285
8380
|
);
|
|
8286
8381
|
} else if (config.type === "select") {
|
|
8287
|
-
editor = /* @__PURE__ */
|
|
8382
|
+
editor = /* @__PURE__ */ jsx28(
|
|
8288
8383
|
Select,
|
|
8289
8384
|
{
|
|
8290
8385
|
size: "small",
|
|
@@ -8298,14 +8393,14 @@ function EditableTableCell({
|
|
|
8298
8393
|
}
|
|
8299
8394
|
);
|
|
8300
8395
|
} else {
|
|
8301
|
-
editor = /* @__PURE__ */
|
|
8396
|
+
editor = /* @__PURE__ */ jsx28(
|
|
8302
8397
|
Input,
|
|
8303
8398
|
{
|
|
8304
8399
|
ref: inputRef,
|
|
8305
8400
|
size: "small",
|
|
8306
8401
|
value: String(editValue ?? ""),
|
|
8307
8402
|
disabled: saving,
|
|
8308
|
-
suffix: saving ? /* @__PURE__ */
|
|
8403
|
+
suffix: saving ? /* @__PURE__ */ jsx28(Icon, { name: "loader", size: 13, spin: true }) : null,
|
|
8309
8404
|
onChange: (event) => updateEditValue(event.target.value),
|
|
8310
8405
|
onBlur: () => void save(),
|
|
8311
8406
|
onKeyDown: (event) => {
|
|
@@ -8315,7 +8410,7 @@ function EditableTableCell({
|
|
|
8315
8410
|
}
|
|
8316
8411
|
);
|
|
8317
8412
|
}
|
|
8318
|
-
return /* @__PURE__ */
|
|
8413
|
+
return /* @__PURE__ */ jsx28("div", { ref: editorRef, className: "sia-table__editor", children: editor });
|
|
8319
8414
|
}
|
|
8320
8415
|
function createEditablePlugin(options = {}) {
|
|
8321
8416
|
const trigger = options.trigger ?? "click";
|
|
@@ -8335,7 +8430,7 @@ function createEditablePlugin(options = {}) {
|
|
|
8335
8430
|
const active = canEdit && context.state.editing?.rowKey === info.row.key && context.state.editing.columnKey === column.key;
|
|
8336
8431
|
const content = previousRender ? previousRender(value, record, index, info) : value;
|
|
8337
8432
|
if (!canEdit) return content;
|
|
8338
|
-
return /* @__PURE__ */
|
|
8433
|
+
return /* @__PURE__ */ jsx28(
|
|
8339
8434
|
EditableTableCell,
|
|
8340
8435
|
{
|
|
8341
8436
|
active,
|
|
@@ -8400,8 +8495,8 @@ function createResizePlugin(options = {}) {
|
|
|
8400
8495
|
autoWidth,
|
|
8401
8496
|
width,
|
|
8402
8497
|
renderHeader: (currentColumn, coreContext) => /* @__PURE__ */ jsxs24("span", { className: "sia-table__resizable-header", children: [
|
|
8403
|
-
/* @__PURE__ */
|
|
8404
|
-
/* @__PURE__ */
|
|
8498
|
+
/* @__PURE__ */ jsx28("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
|
|
8499
|
+
/* @__PURE__ */ jsx28(
|
|
8405
8500
|
"span",
|
|
8406
8501
|
{
|
|
8407
8502
|
className: "sia-table__resize-handle",
|
|
@@ -8538,11 +8633,11 @@ function ColumnSettingPanel({
|
|
|
8538
8633
|
onApply
|
|
8539
8634
|
}) {
|
|
8540
8635
|
const [draft, setDraft] = useState23(items);
|
|
8541
|
-
const listRef =
|
|
8542
|
-
const cancelDrag =
|
|
8636
|
+
const listRef = useRef23(null);
|
|
8637
|
+
const cancelDrag = useRef23(null);
|
|
8543
8638
|
const [preview, setPreview] = useState23(null);
|
|
8544
|
-
const syncedDraft =
|
|
8545
|
-
|
|
8639
|
+
const syncedDraft = useRef23({ open: false, signature: "" });
|
|
8640
|
+
useEffect16(() => {
|
|
8546
8641
|
const signature = JSON.stringify(items);
|
|
8547
8642
|
const changed = signature !== syncedDraft.current.signature;
|
|
8548
8643
|
if (open !== syncedDraft.current.open || changed) cancelDrag.current?.();
|
|
@@ -8551,7 +8646,7 @@ function ColumnSettingPanel({
|
|
|
8551
8646
|
}
|
|
8552
8647
|
syncedDraft.current = { open, signature };
|
|
8553
8648
|
}, [items, open]);
|
|
8554
|
-
|
|
8649
|
+
useEffect16(() => () => cancelDrag.current?.(), []);
|
|
8555
8650
|
const labels = new Map(
|
|
8556
8651
|
flattenTableColumns(columns).map((column) => [
|
|
8557
8652
|
column.key,
|
|
@@ -8688,8 +8783,8 @@ function ColumnSettingPanel({
|
|
|
8688
8783
|
if (!next) onClose();
|
|
8689
8784
|
},
|
|
8690
8785
|
footer: /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
8691
|
-
/* @__PURE__ */
|
|
8692
|
-
/* @__PURE__ */
|
|
8786
|
+
/* @__PURE__ */ jsx28(Button, { onClick: onClose, children: "\u53D6\u6D88" }),
|
|
8787
|
+
/* @__PURE__ */ jsx28(
|
|
8693
8788
|
Button,
|
|
8694
8789
|
{
|
|
8695
8790
|
variant: "primary",
|
|
@@ -8702,9 +8797,9 @@ function ColumnSettingPanel({
|
|
|
8702
8797
|
children: [
|
|
8703
8798
|
loadError ? /* @__PURE__ */ jsxs24("p", { role: "alert", children: [
|
|
8704
8799
|
"\u8BFB\u53D6\u5217\u914D\u7F6E\u5931\u8D25\u3002",
|
|
8705
|
-
/* @__PURE__ */
|
|
8800
|
+
/* @__PURE__ */ jsx28(Button, { variant: "link", onClick: onRetry, children: "\u91CD\u8BD5" })
|
|
8706
8801
|
] }) : null,
|
|
8707
|
-
/* @__PURE__ */
|
|
8802
|
+
/* @__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
8803
|
"fieldset",
|
|
8709
8804
|
{
|
|
8710
8805
|
disabled: loading || loadError,
|
|
@@ -8712,7 +8807,7 @@ function ColumnSettingPanel({
|
|
|
8712
8807
|
"aria-busy": loading,
|
|
8713
8808
|
children: [
|
|
8714
8809
|
/* @__PURE__ */ jsxs24("label", { className: "sia-table-settings__all", children: [
|
|
8715
|
-
/* @__PURE__ */
|
|
8810
|
+
/* @__PURE__ */ jsx28(
|
|
8716
8811
|
TableCheckbox,
|
|
8717
8812
|
{
|
|
8718
8813
|
label: "\u5168\u9009\u5217",
|
|
@@ -8731,7 +8826,7 @@ function ColumnSettingPanel({
|
|
|
8731
8826
|
"\uFF09"
|
|
8732
8827
|
] })
|
|
8733
8828
|
] }),
|
|
8734
|
-
/* @__PURE__ */
|
|
8829
|
+
/* @__PURE__ */ jsx28(
|
|
8735
8830
|
"div",
|
|
8736
8831
|
{
|
|
8737
8832
|
ref: listRef,
|
|
@@ -8746,8 +8841,8 @@ function ColumnSettingPanel({
|
|
|
8746
8841
|
} : void 0,
|
|
8747
8842
|
onPointerDown: (event) => startSort(event, item.key),
|
|
8748
8843
|
children: [
|
|
8749
|
-
/* @__PURE__ */
|
|
8750
|
-
/* @__PURE__ */
|
|
8844
|
+
/* @__PURE__ */ jsx28(Icon, { name: "menu", size: 15 }),
|
|
8845
|
+
/* @__PURE__ */ jsx28(
|
|
8751
8846
|
TableCheckbox,
|
|
8752
8847
|
{
|
|
8753
8848
|
label: `\u663E\u793A${labels.get(item.key) ?? item.key}\u5217`,
|
|
@@ -8759,7 +8854,7 @@ function ColumnSettingPanel({
|
|
|
8759
8854
|
)
|
|
8760
8855
|
}
|
|
8761
8856
|
),
|
|
8762
|
-
/* @__PURE__ */
|
|
8857
|
+
/* @__PURE__ */ jsx28(
|
|
8763
8858
|
"span",
|
|
8764
8859
|
{
|
|
8765
8860
|
className: "sia-table-settings__name",
|
|
@@ -8767,7 +8862,7 @@ function ColumnSettingPanel({
|
|
|
8767
8862
|
}
|
|
8768
8863
|
),
|
|
8769
8864
|
/* @__PURE__ */ jsxs24("div", { className: "sia-table-settings__actions", children: [
|
|
8770
|
-
/* @__PURE__ */
|
|
8865
|
+
/* @__PURE__ */ jsx28(
|
|
8771
8866
|
Button,
|
|
8772
8867
|
{
|
|
8773
8868
|
size: "small",
|
|
@@ -8780,7 +8875,7 @@ function ColumnSettingPanel({
|
|
|
8780
8875
|
children: "\u5DE6"
|
|
8781
8876
|
}
|
|
8782
8877
|
),
|
|
8783
|
-
/* @__PURE__ */
|
|
8878
|
+
/* @__PURE__ */ jsx28(
|
|
8784
8879
|
Button,
|
|
8785
8880
|
{
|
|
8786
8881
|
size: "small",
|
|
@@ -8930,7 +9025,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8930
9025
|
{
|
|
8931
9026
|
key: "builtin:export",
|
|
8932
9027
|
label: "\u8868\u683C\u5BFC\u51FA",
|
|
8933
|
-
icon: /* @__PURE__ */
|
|
9028
|
+
icon: /* @__PURE__ */ jsx28(Icon, { name: "download", size: 18 }),
|
|
8934
9029
|
disabled: exportApi().getRows().length === 0
|
|
8935
9030
|
},
|
|
8936
9031
|
{ key: "builtin:divider", type: "divider" }
|
|
@@ -8938,7 +9033,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8938
9033
|
{
|
|
8939
9034
|
key: "builtin:columns",
|
|
8940
9035
|
label: "\u5217\u8BBE\u7F6E",
|
|
8941
|
-
icon: /* @__PURE__ */
|
|
9036
|
+
icon: /* @__PURE__ */ jsx28(Icon, { name: "settings", size: 18 })
|
|
8942
9037
|
},
|
|
8943
9038
|
...customItems.map((item) => ({
|
|
8944
9039
|
key: "custom:" + item.key,
|
|
@@ -8950,7 +9045,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8950
9045
|
disabled: item.disabled === true || typeof item.disabled === "function" && item.disabled(context)
|
|
8951
9046
|
}))
|
|
8952
9047
|
];
|
|
8953
|
-
return /* @__PURE__ */
|
|
9048
|
+
return /* @__PURE__ */ jsx28(
|
|
8954
9049
|
Dropdown,
|
|
8955
9050
|
{
|
|
8956
9051
|
disabled: options.buttonProps?.disabled || options.buttonProps?.loading,
|
|
@@ -8967,12 +9062,12 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8967
9062
|
void customItems.find((item) => "custom:" + item.key === key)?.onClick?.(context);
|
|
8968
9063
|
}
|
|
8969
9064
|
},
|
|
8970
|
-
children: /* @__PURE__ */
|
|
9065
|
+
children: /* @__PURE__ */ jsx28(
|
|
8971
9066
|
Button,
|
|
8972
9067
|
{
|
|
8973
9068
|
size: "small",
|
|
8974
9069
|
variant: "text",
|
|
8975
|
-
icon: /* @__PURE__ */
|
|
9070
|
+
icon: /* @__PURE__ */ jsx28(Icon, { name: "settings", size: 16 }),
|
|
8976
9071
|
"aria-label": "\u8868\u683C\u8BBE\u7F6E",
|
|
8977
9072
|
...options.buttonProps,
|
|
8978
9073
|
className: `sia-table__settings-button${options.buttonProps?.children == null ? " sia-table__toolbar-icon" : ""} ${options.buttonProps?.className ?? ""}`.trim()
|
|
@@ -8981,7 +9076,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
8981
9076
|
}
|
|
8982
9077
|
);
|
|
8983
9078
|
},
|
|
8984
|
-
renderOverlay: (context) => /* @__PURE__ */
|
|
9079
|
+
renderOverlay: (context) => /* @__PURE__ */ jsx28(
|
|
8985
9080
|
ColumnSettingPanel,
|
|
8986
9081
|
{
|
|
8987
9082
|
open: context.state.open,
|
|
@@ -9031,11 +9126,11 @@ function ToolbarItems({
|
|
|
9031
9126
|
items,
|
|
9032
9127
|
context
|
|
9033
9128
|
}) {
|
|
9034
|
-
return /* @__PURE__ */
|
|
9129
|
+
return /* @__PURE__ */ jsx28(Fragment8, { children: items.map((item) => {
|
|
9035
9130
|
if (item.hidden === true || typeof item.hidden === "function" && item.hidden(context))
|
|
9036
9131
|
return null;
|
|
9037
9132
|
const disabled = item.disabled === true || typeof item.disabled === "function" && item.disabled(context);
|
|
9038
|
-
return /* @__PURE__ */
|
|
9133
|
+
return /* @__PURE__ */ jsx28(
|
|
9039
9134
|
Button,
|
|
9040
9135
|
{
|
|
9041
9136
|
size: "small",
|
|
@@ -9060,14 +9155,14 @@ function createToolbarPlugin(options) {
|
|
|
9060
9155
|
order: 5,
|
|
9061
9156
|
renderToolbarStart: (context) => /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
9062
9157
|
options.start,
|
|
9063
|
-
/* @__PURE__ */
|
|
9158
|
+
/* @__PURE__ */ jsx28(ToolbarItems, { items: items("start"), context })
|
|
9064
9159
|
] }),
|
|
9065
9160
|
renderToolbarEnd: (context) => /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
9066
9161
|
options.end,
|
|
9067
|
-
/* @__PURE__ */
|
|
9162
|
+
/* @__PURE__ */ jsx28(ToolbarItems, { items: items("end"), context }),
|
|
9068
9163
|
items("end", true).length > 0 ? /* @__PURE__ */ jsxs24("details", { className: "sia-table__toolbar-menu", children: [
|
|
9069
|
-
/* @__PURE__ */
|
|
9070
|
-
/* @__PURE__ */
|
|
9164
|
+
/* @__PURE__ */ jsx28("summary", { "aria-label": "\u66F4\u591A\u8868\u683C\u64CD\u4F5C", children: /* @__PURE__ */ jsx28(Icon, { name: "more-horizontal", size: 16 }) }),
|
|
9165
|
+
/* @__PURE__ */ jsx28("div", { children: /* @__PURE__ */ jsx28(ToolbarItems, { items: items("end", true), context }) })
|
|
9071
9166
|
] }) : null
|
|
9072
9167
|
] })
|
|
9073
9168
|
};
|
|
@@ -9149,11 +9244,11 @@ function createExportPlugin(options = {}) {
|
|
|
9149
9244
|
return {
|
|
9150
9245
|
id: "export",
|
|
9151
9246
|
order: 95,
|
|
9152
|
-
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */
|
|
9247
|
+
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */ jsx28(
|
|
9153
9248
|
Button,
|
|
9154
9249
|
{
|
|
9155
9250
|
size: "small",
|
|
9156
|
-
icon: /* @__PURE__ */
|
|
9251
|
+
icon: /* @__PURE__ */ jsx28(Icon, { name: "download", size: 14 }),
|
|
9157
9252
|
disabled: getRows(context).length === 0,
|
|
9158
9253
|
onClick: () => void download(context),
|
|
9159
9254
|
children: options.buttonLabel ?? "\u5BFC\u51FA"
|
|
@@ -9168,7 +9263,7 @@ function createExportPlugin(options = {}) {
|
|
|
9168
9263
|
}
|
|
9169
9264
|
|
|
9170
9265
|
// src/components/Table/Table.tsx
|
|
9171
|
-
import { jsx as
|
|
9266
|
+
import { jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
9172
9267
|
var EMPTY_DATA = [];
|
|
9173
9268
|
var EMPTY_COLUMNS = [];
|
|
9174
9269
|
var EMPTY_PLUGINS = [];
|
|
@@ -9269,6 +9364,8 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
9269
9364
|
rightFixedEdgeKey,
|
|
9270
9365
|
striped,
|
|
9271
9366
|
rowHeight,
|
|
9367
|
+
managedHeight,
|
|
9368
|
+
resize,
|
|
9272
9369
|
className,
|
|
9273
9370
|
onClick,
|
|
9274
9371
|
onDoubleClick,
|
|
@@ -9282,13 +9379,14 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
9282
9379
|
onCellPointerDown,
|
|
9283
9380
|
onCellPointerMove
|
|
9284
9381
|
}) {
|
|
9285
|
-
|
|
9382
|
+
const resizeColumnKey = resize ? columns.find((column) => !getCellProps(column).hidden)?.key : void 0;
|
|
9383
|
+
return /* @__PURE__ */ jsx29(
|
|
9286
9384
|
"tr",
|
|
9287
9385
|
{
|
|
9288
9386
|
"data-row-key": String(row.key),
|
|
9289
9387
|
"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 },
|
|
9388
|
+
className: `sia-table__row${managedHeight ? " sia-table__row--height-managed" : ""}${striped && rowIndex % 2 === 1 ? " sia-table__row--striped" : ""} ${className}`.trim(),
|
|
9389
|
+
style: { height: rowHeight, "--sia-table-row-height": `${rowHeight}px` },
|
|
9292
9390
|
onClick,
|
|
9293
9391
|
onDoubleClick,
|
|
9294
9392
|
onMouseEnter,
|
|
@@ -9298,7 +9396,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
9298
9396
|
if (columnIndex > 0 && !visibleColumns.has(columns[columnIndex - 1].key)) return null;
|
|
9299
9397
|
let count = 1;
|
|
9300
9398
|
while (columnIndex + count < columns.length && !visibleColumns.has(columns[columnIndex + count].key)) count++;
|
|
9301
|
-
return /* @__PURE__ */
|
|
9399
|
+
return /* @__PURE__ */ jsx29("td", { colSpan: count, "aria-hidden": "true", style: { padding: 0 } }, `spacer-${column.key}`);
|
|
9302
9400
|
}
|
|
9303
9401
|
const pluginCellProps = getCellProps(column);
|
|
9304
9402
|
if (pluginCellProps.hidden) return null;
|
|
@@ -9309,7 +9407,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
9309
9407
|
const fixedStyle = fixed === "left" ? { left: leftOffsets.get(column.key) } : fixed === "right" ? { right: rightOffsets.get(column.key) } : void 0;
|
|
9310
9408
|
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
9409
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
9312
|
-
return /* @__PURE__ */
|
|
9410
|
+
return /* @__PURE__ */ jsxs25(
|
|
9313
9411
|
"td",
|
|
9314
9412
|
{
|
|
9315
9413
|
"data-column-key": column.key,
|
|
@@ -9326,14 +9424,17 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
9326
9424
|
onContextMenu: (event) => onCellContextMenu(column, event),
|
|
9327
9425
|
onPointerDown: (event) => onCellPointerDown(column, event),
|
|
9328
9426
|
onPointerMove: (event) => onCellPointerMove(column, event),
|
|
9329
|
-
children:
|
|
9330
|
-
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9427
|
+
children: [
|
|
9428
|
+
!canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? /* @__PURE__ */ jsx29(
|
|
9429
|
+
TableCellContent,
|
|
9430
|
+
{
|
|
9431
|
+
ellipsis: column.ellipsis !== false,
|
|
9432
|
+
title: column.showTitle === true && column.ellipsis !== false && typeof value === "string" ? value : void 0,
|
|
9433
|
+
children: pluginCellProps.content !== void 0 ? pluginCellProps.content : column.render ? column.render(value, row.record, row.sourceIndex, { row, rowIndex, column }) : value
|
|
9434
|
+
}
|
|
9435
|
+
) : null,
|
|
9436
|
+
resize && column.key === resizeColumnKey ? /* @__PURE__ */ jsx29(RowResizeHandle, { height: rowHeight, ...resize }) : null
|
|
9437
|
+
]
|
|
9337
9438
|
},
|
|
9338
9439
|
column.key
|
|
9339
9440
|
);
|
|
@@ -9363,6 +9464,11 @@ function TableInner(props, ref) {
|
|
|
9363
9464
|
renderMode = "dom",
|
|
9364
9465
|
virtualThreshold = 100,
|
|
9365
9466
|
rowHeight = SIZE_ROW_HEIGHT[size],
|
|
9467
|
+
rowHeights,
|
|
9468
|
+
rowResizable = false,
|
|
9469
|
+
minRowHeight,
|
|
9470
|
+
maxRowHeight,
|
|
9471
|
+
onRowHeightChange,
|
|
9366
9472
|
overscan = 6,
|
|
9367
9473
|
stickyHeader = true,
|
|
9368
9474
|
resizable = true,
|
|
@@ -9378,18 +9484,29 @@ function TableInner(props, ref) {
|
|
|
9378
9484
|
style,
|
|
9379
9485
|
...htmlProps
|
|
9380
9486
|
} = props;
|
|
9381
|
-
const
|
|
9487
|
+
const [localRowHeights, setLocalRowHeights] = useState24({});
|
|
9488
|
+
const [rowHeightPreview, setRowHeightPreview] = useState24(null);
|
|
9489
|
+
const configuredRowHeights = rowHeights ?? localRowHeights;
|
|
9490
|
+
const effectiveRowHeights = useMemo10(() => rowHeightPreview ? { ...configuredRowHeights, [rowHeightPreview.key]: rowHeightPreview.height } : configuredRowHeights, [configuredRowHeights, rowHeightPreview]);
|
|
9491
|
+
const resizeMin = Math.max(SIZE_ROW_HEIGHT[size], Number.isFinite(minRowHeight) ? minRowHeight : SIZE_ROW_HEIGHT[size]);
|
|
9492
|
+
const resizeMax = Math.max(resizeMin, Number.isFinite(maxRowHeight) ? maxRowHeight : 480);
|
|
9493
|
+
const managedRowHeights = rowHeights !== void 0 || rowResizable || Object.keys(localRowHeights).length > 0;
|
|
9494
|
+
const commitRowHeight = useCallback2((row, height2) => {
|
|
9495
|
+
if (rowHeights === void 0) setLocalRowHeights((previous) => ({ ...previous, [String(row.key)]: height2 }));
|
|
9496
|
+
onRowHeightChange?.(row.record, height2, row.sourceIndex);
|
|
9497
|
+
}, [rowHeights, onRowHeightChange]);
|
|
9498
|
+
const rootRef = useRef24(null);
|
|
9382
9499
|
const remainingHeight = useRemainingHeight(rootRef, height == null && tableHeight == null ? fillRemaining : false);
|
|
9383
|
-
const scrollRef =
|
|
9384
|
-
const cellFocusRequest =
|
|
9385
|
-
const cellGlow =
|
|
9386
|
-
|
|
9500
|
+
const scrollRef = useRef24(null);
|
|
9501
|
+
const cellFocusRequest = useRef24(0);
|
|
9502
|
+
const cellGlow = useRef24(null);
|
|
9503
|
+
useEffect17(() => () => {
|
|
9387
9504
|
cellFocusRequest.current++;
|
|
9388
9505
|
cellGlow.current?.();
|
|
9389
9506
|
}, []);
|
|
9390
|
-
const tableRef =
|
|
9507
|
+
const tableRef = useRef24(null);
|
|
9391
9508
|
useScrollbarProximity();
|
|
9392
|
-
const scrollbarDragRef =
|
|
9509
|
+
const scrollbarDragRef = useRef24(null);
|
|
9393
9510
|
const [internalLoading, setInternalLoading] = useState24(false);
|
|
9394
9511
|
const [scrollTop, setScrollTop] = useState24(0);
|
|
9395
9512
|
const [scrollLeft, setScrollLeft] = useState24(0);
|
|
@@ -9411,14 +9528,14 @@ function TableInner(props, ref) {
|
|
|
9411
9528
|
return plugins;
|
|
9412
9529
|
}, [builtInHighlightPlugin, builtInResizePlugin, builtInCellSelectionPlugin, builtInIndexPlugin, providedPlugins, resizable, cellSelection, showIndex]);
|
|
9413
9530
|
const sortedPlugins = useMemo10(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
|
|
9414
|
-
const pluginsByIdRef =
|
|
9531
|
+
const pluginsByIdRef = useRef24(/* @__PURE__ */ new Map());
|
|
9415
9532
|
pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
9416
9533
|
const [pluginStates, setPluginStates] = useState24(() => Object.fromEntries(
|
|
9417
9534
|
sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
|
|
9418
9535
|
));
|
|
9419
|
-
const pluginApisRef =
|
|
9420
|
-
const contextsRef =
|
|
9421
|
-
const mountedPluginsRef =
|
|
9536
|
+
const pluginApisRef = useRef24({});
|
|
9537
|
+
const contextsRef = useRef24(/* @__PURE__ */ new Map());
|
|
9538
|
+
const mountedPluginsRef = useRef24(/* @__PURE__ */ new Map());
|
|
9422
9539
|
const pipeline = { columns: baseColumns, rows: createTableRows(dataSource, getRowKey) };
|
|
9423
9540
|
const nextApis = {};
|
|
9424
9541
|
const contexts = /* @__PURE__ */ new Map();
|
|
@@ -9475,7 +9592,7 @@ function TableInner(props, ref) {
|
|
|
9475
9592
|
});
|
|
9476
9593
|
pluginApisRef.current = nextApis;
|
|
9477
9594
|
contextsRef.current = contexts;
|
|
9478
|
-
|
|
9595
|
+
useEffect17(() => {
|
|
9479
9596
|
const activePlugins2 = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
9480
9597
|
for (const [pluginId, mounted] of mountedPluginsRef.current) {
|
|
9481
9598
|
if (activePlugins2.get(pluginId) === mounted.plugin) continue;
|
|
@@ -9487,7 +9604,7 @@ function TableInner(props, ref) {
|
|
|
9487
9604
|
mountedPluginsRef.current.set(plugin.id, { plugin, cleanup: plugin.onMount(contextsRef.current.get(plugin.id)) });
|
|
9488
9605
|
}
|
|
9489
9606
|
}, [sortedPlugins]);
|
|
9490
|
-
|
|
9607
|
+
useEffect17(() => () => {
|
|
9491
9608
|
for (const mounted of mountedPluginsRef.current.values()) mounted.cleanup?.();
|
|
9492
9609
|
mountedPluginsRef.current.clear();
|
|
9493
9610
|
}, []);
|
|
@@ -9531,7 +9648,7 @@ function TableInner(props, ref) {
|
|
|
9531
9648
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-size", `${verticalThumb}px`);
|
|
9532
9649
|
verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-position", `${verticalPosition}px`);
|
|
9533
9650
|
}, []);
|
|
9534
|
-
|
|
9651
|
+
useEffect17(() => {
|
|
9535
9652
|
const element = scrollRef.current;
|
|
9536
9653
|
if (!element || typeof ResizeObserver === "undefined") return;
|
|
9537
9654
|
const observer = new ResizeObserver(() => {
|
|
@@ -9544,19 +9661,19 @@ function TableInner(props, ref) {
|
|
|
9544
9661
|
updateScrollMetrics();
|
|
9545
9662
|
return () => observer.disconnect();
|
|
9546
9663
|
}, [updateScrollMetrics]);
|
|
9547
|
-
|
|
9664
|
+
useEffect17(() => {
|
|
9548
9665
|
updateScrollMetrics();
|
|
9549
9666
|
});
|
|
9550
9667
|
const orderedColumns = useMemo10(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
|
|
9551
9668
|
const leafColumns = useMemo10(() => flattenTableColumns(orderedColumns), [orderedColumns]);
|
|
9552
9669
|
const headerRows = useMemo10(() => buildHeaderRows(orderedColumns), [orderedColumns]);
|
|
9553
|
-
const measuredCells =
|
|
9670
|
+
const measuredCells = useRef24(/* @__PURE__ */ new WeakSet());
|
|
9554
9671
|
const autoWidthSignature = leafColumns.map((column) => `${column.key}:${column.autoWidth}:${resizedWidths[column.key] ?? ""}`).join("|");
|
|
9555
|
-
|
|
9672
|
+
useEffect17(() => {
|
|
9556
9673
|
measuredCells.current = /* @__PURE__ */ new WeakSet();
|
|
9557
9674
|
setAutoColumnWidths({});
|
|
9558
9675
|
}, [dataSource, baseColumns, size, autoWidthSignature]);
|
|
9559
|
-
|
|
9676
|
+
useEffect17(() => {
|
|
9560
9677
|
const autoWidthColumns = leafColumns.filter((column) => column.autoWidth && resizedWidths[column.key] === void 0);
|
|
9561
9678
|
const root = rootRef.current;
|
|
9562
9679
|
if (!root || autoWidthColumns.length === 0) return;
|
|
@@ -9625,12 +9742,13 @@ function TableInner(props, ref) {
|
|
|
9625
9742
|
}
|
|
9626
9743
|
const leftFixedEdgeKey = [...leafColumns].reverse().find((column) => normalizeFixed(column.fixed) === "left")?.key;
|
|
9627
9744
|
const rightFixedEdgeKey = leafColumns.find((column) => normalizeFixed(column.fixed) === "right")?.key;
|
|
9628
|
-
const canvas = renderMode === "canvas" && !sortedPlugins.some((plugin) => plugin.disableVirtual);
|
|
9745
|
+
const canvas = renderMode === "canvas" && !managedRowHeights && !sortedPlugins.some((plugin) => plugin.disableVirtual);
|
|
9629
9746
|
const shouldVirtualize = canvas || pipeline.rows.length > 100 || (virtual ?? pipeline.rows.length >= virtualThreshold) && !sortedPlugins.some((plugin) => plugin.disableVirtual);
|
|
9630
|
-
const
|
|
9747
|
+
const rowLayout = createRowHeightLayout(pipeline.rows, rowHeight, effectiveRowHeights, SIZE_ROW_HEIGHT[size]);
|
|
9748
|
+
const windowTop = Math.min(scrollTop, Math.max(0, rowLayout.total - viewportHeight));
|
|
9749
|
+
const firstVisibleIndex = rowLayout.indexAt(windowTop);
|
|
9631
9750
|
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;
|
|
9751
|
+
const endIndex = shouldVirtualize ? Math.min(pipeline.rows.length, rowLayout.indexAt(windowTop + viewportHeight) + overscan + 1) : pipeline.rows.length;
|
|
9634
9752
|
const renderedRows = pipeline.rows.slice(startIndex, endIndex);
|
|
9635
9753
|
const visibleColumns = /* @__PURE__ */ new Set();
|
|
9636
9754
|
let columnLeft = 0;
|
|
@@ -9639,8 +9757,8 @@ function TableInner(props, ref) {
|
|
|
9639
9757
|
if (normalizeFixed(column.fixed) || columnLeft + width >= scrollLeft && columnLeft <= scrollLeft + viewportWidth) visibleColumns.add(column.key);
|
|
9640
9758
|
columnLeft += width;
|
|
9641
9759
|
}
|
|
9642
|
-
const topSpacer = shouldVirtualize ? startIndex
|
|
9643
|
-
const bottomSpacer = shouldVirtualize ?
|
|
9760
|
+
const topSpacer = shouldVirtualize ? rowLayout.offsets[startIndex] : 0;
|
|
9761
|
+
const bottomSpacer = shouldVirtualize ? rowLayout.total - rowLayout.offsets[endIndex] : 0;
|
|
9644
9762
|
const rowElements = useMemo10(() => /* @__PURE__ */ new Map(), [
|
|
9645
9763
|
dataSource,
|
|
9646
9764
|
baseColumns,
|
|
@@ -9653,6 +9771,12 @@ function TableInner(props, ref) {
|
|
|
9653
9771
|
rowClassName,
|
|
9654
9772
|
rowStatus,
|
|
9655
9773
|
getRowKey,
|
|
9774
|
+
effectiveRowHeights,
|
|
9775
|
+
managedRowHeights,
|
|
9776
|
+
rowResizable,
|
|
9777
|
+
resizeMin,
|
|
9778
|
+
resizeMax,
|
|
9779
|
+
commitRowHeight,
|
|
9656
9780
|
canvas,
|
|
9657
9781
|
scrollLeft,
|
|
9658
9782
|
onRowClick,
|
|
@@ -9661,20 +9785,20 @@ function TableInner(props, ref) {
|
|
|
9661
9785
|
]);
|
|
9662
9786
|
const toolbarStart = sortedPlugins.map((plugin) => {
|
|
9663
9787
|
const content = plugin.renderToolbarStart?.(getContext(plugin));
|
|
9664
|
-
return content ? /* @__PURE__ */
|
|
9788
|
+
return content ? /* @__PURE__ */ jsx29(Fragment9, { children: content }, `toolbar-start-${plugin.id}`) : null;
|
|
9665
9789
|
}).filter(Boolean);
|
|
9666
9790
|
const toolbarEnd = sortedPlugins.map((plugin) => {
|
|
9667
9791
|
const content = plugin.renderToolbarEnd?.(getContext(plugin));
|
|
9668
|
-
return content ? /* @__PURE__ */
|
|
9792
|
+
return content ? /* @__PURE__ */ jsx29(Fragment9, { children: content }, `toolbar-end-${plugin.id}`) : null;
|
|
9669
9793
|
}).filter(Boolean);
|
|
9670
9794
|
const summaries = sortedPlugins.flatMap((plugin) => plugin.renderSummary?.(getContext(plugin)) ?? []);
|
|
9671
9795
|
const footers = sortedPlugins.map((plugin) => {
|
|
9672
9796
|
const content = plugin.renderFooter?.(getContext(plugin));
|
|
9673
|
-
return content ? /* @__PURE__ */
|
|
9797
|
+
return content ? /* @__PURE__ */ jsx29(Fragment9, { children: content }, `footer-${plugin.id}`) : null;
|
|
9674
9798
|
}).filter(Boolean);
|
|
9675
9799
|
const overlays = sortedPlugins.map((plugin) => {
|
|
9676
9800
|
const content = plugin.renderOverlay?.(getContext(plugin));
|
|
9677
|
-
return content ? /* @__PURE__ */
|
|
9801
|
+
return content ? /* @__PURE__ */ jsx29(Fragment9, { children: content }, `overlay-${plugin.id}`) : null;
|
|
9678
9802
|
}).filter(Boolean);
|
|
9679
9803
|
const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
|
|
9680
9804
|
const effectiveHeight = height ?? tableHeight ?? remainingHeight ?? (shouldVirtualize && maxBodyHeight == null ? 420 : void 0);
|
|
@@ -9690,10 +9814,10 @@ function TableInner(props, ref) {
|
|
|
9690
9814
|
};
|
|
9691
9815
|
const handleScroll = useCallback2((event) => {
|
|
9692
9816
|
const element = event.currentTarget;
|
|
9693
|
-
if (shouldVirtualize) setScrollTop((previous) => Math.floor(previous / rowHeight)
|
|
9817
|
+
if (shouldVirtualize) setScrollTop((previous) => managedRowHeights || Math.floor(previous / rowHeight) !== Math.floor(element.scrollTop / rowHeight) ? element.scrollTop : previous);
|
|
9694
9818
|
if (canvas) setScrollLeft(element.scrollLeft);
|
|
9695
9819
|
updateScrollMetrics();
|
|
9696
|
-
}, [canvas, shouldVirtualize, rowHeight, updateScrollMetrics]);
|
|
9820
|
+
}, [canvas, shouldVirtualize, rowHeight, managedRowHeights, updateScrollMetrics]);
|
|
9697
9821
|
const handleScrollbarPointerDown = useCallback2((axis, event, track = event.currentTarget) => {
|
|
9698
9822
|
const element = scrollRef.current;
|
|
9699
9823
|
const thumb = track.firstElementChild;
|
|
@@ -9750,8 +9874,8 @@ function TableInner(props, ref) {
|
|
|
9750
9874
|
if (!viewport || !table || !viewport.clientHeight || index < 0) return false;
|
|
9751
9875
|
const row = Array.from(table.tBodies[0]?.rows ?? []).find((element) => element.dataset.rowKey === String(key));
|
|
9752
9876
|
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 ??
|
|
9877
|
+
const top = row ? row.getBoundingClientRect().top - viewport.getBoundingClientRect().top - viewport.clientTop + viewport.scrollTop : headerHeight + rowLayout.offsets[index];
|
|
9878
|
+
const height2 = row?.offsetHeight ?? rowLayout.sizes[index];
|
|
9755
9879
|
const headerInset = stickyHeader ? headerHeight : 0;
|
|
9756
9880
|
const footerInset = table.tFoot?.offsetHeight ?? 0;
|
|
9757
9881
|
const visibleTop = viewport.scrollTop + headerInset;
|
|
@@ -9830,7 +9954,7 @@ function TableInner(props, ref) {
|
|
|
9830
9954
|
}
|
|
9831
9955
|
};
|
|
9832
9956
|
return api;
|
|
9833
|
-
}, [dataSource.length, pipeline.columns, pipeline.rows, headerRows.length, rowHeight, stickyHeader, shouldVirtualize, updateScrollMetrics, leafColumns, columnWidths, left, right, canvas]);
|
|
9957
|
+
}, [dataSource.length, pipeline.columns, pipeline.rows, headerRows.length, rowHeight, rowLayout, stickyHeader, shouldVirtualize, updateScrollMetrics, leafColumns, columnWidths, left, right, canvas]);
|
|
9834
9958
|
const coreContext = {
|
|
9835
9959
|
pluginId: "core",
|
|
9836
9960
|
sourceData: dataSource,
|
|
@@ -9852,9 +9976,9 @@ function TableInner(props, ref) {
|
|
|
9852
9976
|
function renderHeaderContent(column, content) {
|
|
9853
9977
|
const title = getHeaderTitleText(column.title ?? column.name) || column.name || column.key;
|
|
9854
9978
|
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__ */
|
|
9979
|
+
column.required && /* @__PURE__ */ jsx29("span", { className: "sia-table__required-mark", "aria-hidden": "true", children: "*" }),
|
|
9980
|
+
/* @__PURE__ */ jsx29("span", { className: "sia-table__header-label-content", "data-sia-title-overflow-only": true, ...withTitleTooltip({ title }), children: content }),
|
|
9981
|
+
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
9982
|
] });
|
|
9859
9983
|
}
|
|
9860
9984
|
function getPluginCellProps(row, column) {
|
|
@@ -9894,14 +10018,14 @@ function TableInner(props, ref) {
|
|
|
9894
10018
|
}
|
|
9895
10019
|
function renderSummaryRow(summary) {
|
|
9896
10020
|
let labelRendered = false;
|
|
9897
|
-
return /* @__PURE__ */
|
|
10021
|
+
return /* @__PURE__ */ jsx29("tr", { className: `sia-table__summary-row ${summary.className ?? ""}`.trim(), children: leafColumns.map((column) => {
|
|
9898
10022
|
const value = summary.values[column.key];
|
|
9899
10023
|
const isLabel = value === void 0 && !labelRendered && summary.label !== void 0;
|
|
9900
10024
|
const content = value !== void 0 ? value : isLabel ? (labelRendered = true, summary.label) : null;
|
|
9901
10025
|
const fixed = normalizeFixed(column.fixed);
|
|
9902
10026
|
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
10027
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
9904
|
-
return /* @__PURE__ */
|
|
10028
|
+
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
10029
|
}) }, summary.key);
|
|
9906
10030
|
}
|
|
9907
10031
|
return /* @__PURE__ */ jsxs25(
|
|
@@ -9956,18 +10080,18 @@ function TableInner(props, ref) {
|
|
|
9956
10080
|
},
|
|
9957
10081
|
children: [
|
|
9958
10082
|
hasToolbar ? /* @__PURE__ */ jsxs25("div", { className: "sia-table__toolbar", children: [
|
|
9959
|
-
/* @__PURE__ */
|
|
9960
|
-
/* @__PURE__ */
|
|
10083
|
+
/* @__PURE__ */ jsx29("div", { children: toolbarStart }),
|
|
10084
|
+
/* @__PURE__ */ jsx29("div", { children: toolbarEnd })
|
|
9961
10085
|
] }) : null,
|
|
9962
10086
|
/* @__PURE__ */ jsxs25("div", { className: "sia-table__viewport-wrap", style: viewportStyle, children: [
|
|
9963
|
-
/* @__PURE__ */
|
|
9964
|
-
/* @__PURE__ */
|
|
9965
|
-
/* @__PURE__ */
|
|
10087
|
+
/* @__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: [
|
|
10088
|
+
/* @__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)) }),
|
|
10089
|
+
/* @__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
10090
|
const fixed = cell.fixed;
|
|
9967
10091
|
const pluginHeaderProps = getPluginHeaderCellProps(cell.column);
|
|
9968
10092
|
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
10093
|
const autoWidthClass = cell.column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
9970
|
-
return /* @__PURE__ */
|
|
10094
|
+
return /* @__PURE__ */ jsx29(
|
|
9971
10095
|
"th",
|
|
9972
10096
|
{
|
|
9973
10097
|
"data-column-key": cell.column.key,
|
|
@@ -9989,9 +10113,9 @@ function TableInner(props, ref) {
|
|
|
9989
10113
|
);
|
|
9990
10114
|
}) }, depth)) }),
|
|
9991
10115
|
/* @__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__ */
|
|
10116
|
+
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,
|
|
10117
|
+
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,
|
|
10118
|
+
topSpacer > 0 ? /* @__PURE__ */ jsx29("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx29("td", { colSpan: leafColumns.length, style: { height: topSpacer, padding: 0, border: 0 } }) }) : null,
|
|
9995
10119
|
renderedRows.map((row, offset) => {
|
|
9996
10120
|
const cached = rowElements.get(row.key);
|
|
9997
10121
|
if (cached) return cached;
|
|
@@ -10000,7 +10124,7 @@ function TableInner(props, ref) {
|
|
|
10000
10124
|
const status = typeof rowStatus === "function" ? rowStatus(row.record, row.sourceIndex) : rowStatus;
|
|
10001
10125
|
const statusClass = status ? `sia-table__row--${status}` : "";
|
|
10002
10126
|
const customClass = typeof rowClassName === "function" ? rowClassName(row.record, row.sourceIndex) : rowClassName ?? "";
|
|
10003
|
-
const element = /* @__PURE__ */
|
|
10127
|
+
const element = /* @__PURE__ */ jsx29(
|
|
10004
10128
|
TableBodyRow,
|
|
10005
10129
|
{
|
|
10006
10130
|
canvas,
|
|
@@ -10013,7 +10137,14 @@ function TableInner(props, ref) {
|
|
|
10013
10137
|
leftFixedEdgeKey,
|
|
10014
10138
|
rightFixedEdgeKey,
|
|
10015
10139
|
striped,
|
|
10016
|
-
rowHeight,
|
|
10140
|
+
rowHeight: rowLayout.sizes[rowIndex],
|
|
10141
|
+
managedHeight: managedRowHeights,
|
|
10142
|
+
resize: rowResizable ? {
|
|
10143
|
+
min: resizeMin,
|
|
10144
|
+
max: resizeMax,
|
|
10145
|
+
onPreview: (height2) => setRowHeightPreview(height2 === null ? null : { key: String(row.key), height: height2 }),
|
|
10146
|
+
onCommit: (height2) => commitRowHeight(row, height2)
|
|
10147
|
+
} : void 0,
|
|
10017
10148
|
className: `${statusClass} ${pluginClasses} ${customClass}`.trim(),
|
|
10018
10149
|
onClick: () => {
|
|
10019
10150
|
for (const plugin of sortedPlugins) plugin.onRowClick?.(row, getContext(plugin));
|
|
@@ -10051,13 +10182,13 @@ function TableInner(props, ref) {
|
|
|
10051
10182
|
rowElements.set(row.key, element);
|
|
10052
10183
|
return element;
|
|
10053
10184
|
}),
|
|
10054
|
-
bottomSpacer > 0 ? /* @__PURE__ */
|
|
10185
|
+
bottomSpacer > 0 ? /* @__PURE__ */ jsx29("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx29("td", { colSpan: leafColumns.length, style: { height: bottomSpacer, padding: 0, border: 0 } }) }) : null
|
|
10055
10186
|
] }),
|
|
10056
|
-
summaries.length > 0 ? /* @__PURE__ */
|
|
10187
|
+
summaries.length > 0 ? /* @__PURE__ */ jsx29("tfoot", { className: "sia-table__summary", children: summaries.map(renderSummaryRow) }) : null
|
|
10057
10188
|
] }) }),
|
|
10058
|
-
pipeline.rows.length === 0 ? /* @__PURE__ */
|
|
10059
|
-
canvas ? /* @__PURE__ */
|
|
10060
|
-
/* @__PURE__ */
|
|
10189
|
+
pipeline.rows.length === 0 ? /* @__PURE__ */ jsx29("div", { className: "sia-table__empty", role: "status", children: emptyText }) : null,
|
|
10190
|
+
canvas ? /* @__PURE__ */ jsx29(TableCanvasLayer, { viewport: scrollRef, rows: pipeline.rows, columns: leafColumns, widths: columnWidths, rowHeight, headerHeight: headerRows.length * rowHeight }) : null,
|
|
10191
|
+
/* @__PURE__ */ jsx29(
|
|
10061
10192
|
"div",
|
|
10062
10193
|
{
|
|
10063
10194
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--horizontal",
|
|
@@ -10068,10 +10199,10 @@ function TableInner(props, ref) {
|
|
|
10068
10199
|
onPointerMove: handleScrollbarPointerMove,
|
|
10069
10200
|
onPointerUp: handleScrollbarPointerEnd,
|
|
10070
10201
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
10071
|
-
children: /* @__PURE__ */
|
|
10202
|
+
children: /* @__PURE__ */ jsx29("div", { className: "sia-table__scrollbar-thumb" })
|
|
10072
10203
|
}
|
|
10073
10204
|
),
|
|
10074
|
-
/* @__PURE__ */
|
|
10205
|
+
/* @__PURE__ */ jsx29(
|
|
10075
10206
|
"div",
|
|
10076
10207
|
{
|
|
10077
10208
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--vertical",
|
|
@@ -10082,14 +10213,14 @@ function TableInner(props, ref) {
|
|
|
10082
10213
|
onPointerMove: handleScrollbarPointerMove,
|
|
10083
10214
|
onPointerUp: handleScrollbarPointerEnd,
|
|
10084
10215
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
10085
|
-
children: /* @__PURE__ */
|
|
10216
|
+
children: /* @__PURE__ */ jsx29("div", { className: "sia-table__scrollbar-thumb" })
|
|
10086
10217
|
}
|
|
10087
10218
|
)
|
|
10088
10219
|
] }),
|
|
10089
|
-
footers.length > 0 ? /* @__PURE__ */
|
|
10220
|
+
footers.length > 0 ? /* @__PURE__ */ jsx29("div", { className: "sia-table__footer", children: footers }) : null,
|
|
10090
10221
|
loading || internalLoading ? /* @__PURE__ */ jsxs25("div", { className: "sia-table__loading", role: "status", children: [
|
|
10091
|
-
/* @__PURE__ */
|
|
10092
|
-
/* @__PURE__ */
|
|
10222
|
+
/* @__PURE__ */ jsx29(Icon, { name: "loader", size: 22, spin: true }),
|
|
10223
|
+
/* @__PURE__ */ jsx29("span", { children: "\u52A0\u8F7D\u4E2D" })
|
|
10093
10224
|
] }) : null,
|
|
10094
10225
|
overlays
|
|
10095
10226
|
]
|
|
@@ -10162,7 +10293,7 @@ function incrementWorksheetValue(value, offset) {
|
|
|
10162
10293
|
}
|
|
10163
10294
|
|
|
10164
10295
|
// src/components/Table/worksheet.tsx
|
|
10165
|
-
import { Fragment as Fragment10, jsx as
|
|
10296
|
+
import { Fragment as Fragment10, jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
10166
10297
|
var isEmpty2 = (value) => value == null || value === "";
|
|
10167
10298
|
var editorKind = (column) => !column.editable ? "readonly" : typeof column.editable === "object" ? column.editable.type ?? "input" : "input";
|
|
10168
10299
|
var nativeEditor = (target) => target instanceof Element && Boolean(
|
|
@@ -10462,25 +10593,34 @@ function createWorksheetPlugin(options) {
|
|
|
10462
10593
|
area && target >= 0 && fill(area, target, sourceCells(area), increment)
|
|
10463
10594
|
);
|
|
10464
10595
|
}
|
|
10465
|
-
function
|
|
10596
|
+
function fillDownValues() {
|
|
10466
10597
|
const area = bounds();
|
|
10467
10598
|
if (!area) return false;
|
|
10468
10599
|
const cells = sourceCells(area);
|
|
10600
|
+
const empty = options.isEmpty ?? isEmpty2;
|
|
10601
|
+
const cols = columns().slice(area.left, area.right + 1);
|
|
10469
10602
|
if (!cells.some(
|
|
10470
|
-
(row) => row.some((cell) => cell.kind !== "readonly" && !
|
|
10603
|
+
(row, index) => row.some((cell, columnIndex) => cell.kind !== "readonly" && !empty(cell.value, context.rows[area.top + index].record, cols[columnIndex]))
|
|
10471
10604
|
))
|
|
10472
10605
|
return false;
|
|
10473
|
-
const cols = columns().slice(area.left, area.right + 1);
|
|
10474
10606
|
let target = area.bottom;
|
|
10475
10607
|
for (let r = area.bottom + 1; r < context.rows.length; r++) {
|
|
10476
10608
|
if (cols.some(
|
|
10477
|
-
(column) => editable(context.rows[r].record, column) && !
|
|
10609
|
+
(column) => editable(context.rows[r].record, column) && !empty(valueAt(r, column), context.rows[r].record, column)
|
|
10478
10610
|
))
|
|
10479
10611
|
break;
|
|
10480
10612
|
target = r;
|
|
10481
10613
|
}
|
|
10482
10614
|
return fill(area, target, cells);
|
|
10483
10615
|
}
|
|
10616
|
+
function fillDown() {
|
|
10617
|
+
try {
|
|
10618
|
+
return fillDownValues();
|
|
10619
|
+
} catch (error) {
|
|
10620
|
+
options.onError?.(error);
|
|
10621
|
+
return false;
|
|
10622
|
+
}
|
|
10623
|
+
}
|
|
10484
10624
|
function pointTarget() {
|
|
10485
10625
|
if (!drag || !root) return;
|
|
10486
10626
|
const td = document.elementFromPoint(pointerX, pointerY)?.closest("td[data-column-key]");
|
|
@@ -10572,7 +10712,7 @@ function createWorksheetPlugin(options) {
|
|
|
10572
10712
|
editable(record, column) && (suppressEditing || !context.state.editing);
|
|
10573
10713
|
return /* @__PURE__ */ jsxs26(Fragment10, { children: [
|
|
10574
10714
|
render ? render(value, record, index, info) : value,
|
|
10575
|
-
handle && /* @__PURE__ */
|
|
10715
|
+
handle && /* @__PURE__ */ jsx30(
|
|
10576
10716
|
"button",
|
|
10577
10717
|
{
|
|
10578
10718
|
type: "button",
|
|
@@ -10619,24 +10759,24 @@ function createWorksheetPlugin(options) {
|
|
|
10619
10759
|
renderToolbarStart(current) {
|
|
10620
10760
|
remember(current);
|
|
10621
10761
|
return options.toolbar === false ? null : /* @__PURE__ */ jsxs26("span", { className: "sia-table__worksheet-tools", children: [
|
|
10622
|
-
/* @__PURE__ */
|
|
10762
|
+
/* @__PURE__ */ jsx30(
|
|
10623
10763
|
Button,
|
|
10624
10764
|
{
|
|
10625
10765
|
variant: "text",
|
|
10626
10766
|
size: "small",
|
|
10627
|
-
icon: /* @__PURE__ */
|
|
10767
|
+
icon: /* @__PURE__ */ jsx30(Icon, { name: "undo" }),
|
|
10628
10768
|
disabled: !undoStack.length,
|
|
10629
10769
|
title: "\u64A4\u9500\uFF08Ctrl/Cmd + Z\uFF09",
|
|
10630
10770
|
onClick: api.undo,
|
|
10631
10771
|
children: "\u64A4\u9500"
|
|
10632
10772
|
}
|
|
10633
10773
|
),
|
|
10634
|
-
/* @__PURE__ */
|
|
10774
|
+
/* @__PURE__ */ jsx30(
|
|
10635
10775
|
Button,
|
|
10636
10776
|
{
|
|
10637
10777
|
variant: "text",
|
|
10638
10778
|
size: "small",
|
|
10639
|
-
icon: /* @__PURE__ */
|
|
10779
|
+
icon: /* @__PURE__ */ jsx30(Icon, { name: "redo" }),
|
|
10640
10780
|
disabled: !redoStack.length,
|
|
10641
10781
|
title: "\u6062\u590D\uFF08Ctrl/Cmd + Shift + Z \u6216 Ctrl/Cmd + Y\uFF09",
|
|
10642
10782
|
onClick: api.redo,
|
|
@@ -10647,7 +10787,7 @@ function createWorksheetPlugin(options) {
|
|
|
10647
10787
|
},
|
|
10648
10788
|
renderOverlay(current) {
|
|
10649
10789
|
remember(current);
|
|
10650
|
-
return /* @__PURE__ */
|
|
10790
|
+
return /* @__PURE__ */ jsx30(
|
|
10651
10791
|
"span",
|
|
10652
10792
|
{
|
|
10653
10793
|
hidden: true,
|
|
@@ -10735,14 +10875,14 @@ function createWorksheetPlugin(options) {
|
|
|
10735
10875
|
|
|
10736
10876
|
// src/components/Video.tsx
|
|
10737
10877
|
import { forwardRef as forwardRef7 } from "react";
|
|
10738
|
-
import { jsx as
|
|
10878
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
10739
10879
|
var Video = forwardRef7(function Video2({ controls = true, muted = false, playsInline = true, className = "", ...props }, ref) {
|
|
10740
|
-
return /* @__PURE__ */
|
|
10880
|
+
return /* @__PURE__ */ jsx31("video", { ...props, ref, controls, muted, playsInline, className: `sia-video ${className}`.trim() });
|
|
10741
10881
|
});
|
|
10742
10882
|
|
|
10743
10883
|
// src/components/InputSelect.tsx
|
|
10744
|
-
import { forwardRef as forwardRef8, useEffect as
|
|
10745
|
-
import { jsx as
|
|
10884
|
+
import { forwardRef as forwardRef8, useEffect as useEffect18, useRef as useRef25, useState as useState25 } from "react";
|
|
10885
|
+
import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
10746
10886
|
var InputSelect = forwardRef8(function InputSelect2({
|
|
10747
10887
|
options,
|
|
10748
10888
|
value,
|
|
@@ -10774,7 +10914,7 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10774
10914
|
const values = normalizeSelectionValues(current == null ? [] : Array.isArray(current) ? current : [current], options);
|
|
10775
10915
|
const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
|
|
10776
10916
|
const [draft, setDraft] = useState25(text);
|
|
10777
|
-
|
|
10917
|
+
useEffect18(() => {
|
|
10778
10918
|
setDraft(text);
|
|
10779
10919
|
}, [text, current]);
|
|
10780
10920
|
const [open, setOpen] = useState25(false);
|
|
@@ -10782,9 +10922,9 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10782
10922
|
const [modalOpen, setModalOpen] = useState25(false);
|
|
10783
10923
|
const [modalValues, setModalValues] = useState25([]);
|
|
10784
10924
|
const [selectedOnly, setSelectedOnly] = useState25(false);
|
|
10785
|
-
const rootRef =
|
|
10786
|
-
const popupRef =
|
|
10787
|
-
const inputRef =
|
|
10925
|
+
const rootRef = useRef25(null);
|
|
10926
|
+
const popupRef = useRef25(null);
|
|
10927
|
+
const inputRef = useRef25(null);
|
|
10788
10928
|
const config = typeof enableModal === "object" ? enableModal : {};
|
|
10789
10929
|
function changeOpen(next) {
|
|
10790
10930
|
if (next && (disabled || loading)) return;
|
|
@@ -10804,7 +10944,7 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10804
10944
|
inputRef.current?.focus();
|
|
10805
10945
|
}
|
|
10806
10946
|
}
|
|
10807
|
-
|
|
10947
|
+
useEffect18(() => {
|
|
10808
10948
|
if (!open) return;
|
|
10809
10949
|
const outside = (event) => {
|
|
10810
10950
|
if (!rootRef.current?.contains(event.target) && !popupRef.current?.contains(event.target)) changeOpen(false);
|
|
@@ -10812,7 +10952,7 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10812
10952
|
document.addEventListener("pointerdown", outside);
|
|
10813
10953
|
return () => document.removeEventListener("pointerdown", outside);
|
|
10814
10954
|
}, [open, onOpenChange]);
|
|
10815
|
-
|
|
10955
|
+
useEffect18(() => {
|
|
10816
10956
|
if (disabled || loading) {
|
|
10817
10957
|
changeOpen(false);
|
|
10818
10958
|
setModalOpen(false);
|
|
@@ -10832,7 +10972,7 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10832
10972
|
inputRef.current?.focus();
|
|
10833
10973
|
}
|
|
10834
10974
|
}, children: [
|
|
10835
|
-
/* @__PURE__ */
|
|
10975
|
+
/* @__PURE__ */ jsx32(
|
|
10836
10976
|
Input,
|
|
10837
10977
|
{
|
|
10838
10978
|
...inputProps,
|
|
@@ -10870,25 +11010,25 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10870
11010
|
changeOpen(true);
|
|
10871
11011
|
},
|
|
10872
11012
|
suffix: /* @__PURE__ */ jsxs27("span", { className: "sia-input-select__suffix", children: [
|
|
10873
|
-
allowClear && draft && !disabled && /* @__PURE__ */
|
|
11013
|
+
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
11014
|
event.stopPropagation();
|
|
10875
11015
|
setDraft("");
|
|
10876
11016
|
emit(multiple ? [] : void 0);
|
|
10877
11017
|
inputRef.current?.focus();
|
|
10878
11018
|
}, children: "\xD7" }),
|
|
10879
11019
|
suffix,
|
|
10880
|
-
enableModal && /* @__PURE__ */
|
|
11020
|
+
enableModal && /* @__PURE__ */ jsx32(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
|
|
10881
11021
|
event.stopPropagation();
|
|
10882
11022
|
openModal();
|
|
10883
11023
|
}, children: "\u2026" }),
|
|
10884
|
-
/* @__PURE__ */
|
|
11024
|
+
/* @__PURE__ */ jsx32(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
|
|
10885
11025
|
event.stopPropagation();
|
|
10886
11026
|
changeOpen(!open);
|
|
10887
|
-
}, children: /* @__PURE__ */
|
|
11027
|
+
}, children: /* @__PURE__ */ jsx32(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
|
|
10888
11028
|
] })
|
|
10889
11029
|
}
|
|
10890
11030
|
),
|
|
10891
|
-
/* @__PURE__ */
|
|
11031
|
+
/* @__PURE__ */ jsx32(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx32(
|
|
10892
11032
|
SelectionPanel,
|
|
10893
11033
|
{
|
|
10894
11034
|
options,
|
|
@@ -10917,14 +11057,14 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10917
11057
|
},
|
|
10918
11058
|
children: [
|
|
10919
11059
|
/* @__PURE__ */ jsxs27("div", { className: "sia-selection-panel__actions", role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
10920
|
-
/* @__PURE__ */
|
|
11060
|
+
/* @__PURE__ */ jsx32(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
10921
11061
|
/* @__PURE__ */ jsxs27(Button, { role: "tab", "aria-selected": selectedOnly, variant: selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(true), children: [
|
|
10922
11062
|
"\u5DF2\u9009\u9879(",
|
|
10923
11063
|
modalValues.length,
|
|
10924
11064
|
")"
|
|
10925
11065
|
] })
|
|
10926
11066
|
] }),
|
|
10927
|
-
modalOpen && /* @__PURE__ */
|
|
11067
|
+
modalOpen && /* @__PURE__ */ jsx32(
|
|
10928
11068
|
SelectionPanel,
|
|
10929
11069
|
{
|
|
10930
11070
|
options,
|
|
@@ -10945,10 +11085,10 @@ var InputSelect = forwardRef8(function InputSelect2({
|
|
|
10945
11085
|
});
|
|
10946
11086
|
|
|
10947
11087
|
// src/components/QueryForm.tsx
|
|
10948
|
-
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect9, useRef as
|
|
11088
|
+
import { Children as Children4, isValidElement as isValidElement5, useLayoutEffect as useLayoutEffect9, useRef as useRef29, useState as useState28 } from "react";
|
|
10949
11089
|
|
|
10950
11090
|
// src/components/useQueryFormMotion.ts
|
|
10951
|
-
import { useLayoutEffect as useLayoutEffect8, useRef as
|
|
11091
|
+
import { useLayoutEffect as useLayoutEffect8, useRef as useRef26 } from "react";
|
|
10952
11092
|
function readLayout(row) {
|
|
10953
11093
|
const root = row.getBoundingClientRect();
|
|
10954
11094
|
const scaleX = root.width / row.offsetWidth || 1, scaleY = root.height / row.offsetHeight || 1;
|
|
@@ -10961,9 +11101,9 @@ function readLayout(row) {
|
|
|
10961
11101
|
return { height: row.offsetHeight, boxes };
|
|
10962
11102
|
}
|
|
10963
11103
|
function useQueryFormMotion(ref, layoutKey) {
|
|
10964
|
-
const previous =
|
|
10965
|
-
const stop =
|
|
10966
|
-
const snapshot =
|
|
11104
|
+
const previous = useRef26();
|
|
11105
|
+
const stop = useRef26();
|
|
11106
|
+
const snapshot = useRef26();
|
|
10967
11107
|
useLayoutEffect8(() => {
|
|
10968
11108
|
const row = ref.current;
|
|
10969
11109
|
if (!row) return;
|
|
@@ -11072,10 +11212,10 @@ function useQueryFormMotion(ref, layoutKey) {
|
|
|
11072
11212
|
}
|
|
11073
11213
|
|
|
11074
11214
|
// src/components/QueryFormSettings.tsx
|
|
11075
|
-
import { useEffect as
|
|
11215
|
+
import { useEffect as useEffect20, useRef as useRef28, useState as useState27 } from "react";
|
|
11076
11216
|
|
|
11077
11217
|
// src/components/useQueryFieldSort.ts
|
|
11078
|
-
import { useEffect as
|
|
11218
|
+
import { useEffect as useEffect19, useRef as useRef27, useState as useState26 } from "react";
|
|
11079
11219
|
function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
11080
11220
|
const center = rects[from].top + rects[from].height / 2 + dy;
|
|
11081
11221
|
const rest = keys.map((_, index) => index).filter((index) => index !== from);
|
|
@@ -11094,13 +11234,13 @@ function getQuerySortPreview(keys, rects, from, dy, gap) {
|
|
|
11094
11234
|
return { ordered, offsets };
|
|
11095
11235
|
}
|
|
11096
11236
|
function useQueryFieldSort(keys, enabled, onCommit) {
|
|
11097
|
-
const listRef =
|
|
11098
|
-
const cancelRef =
|
|
11099
|
-
const commitRef =
|
|
11237
|
+
const listRef = useRef27(null);
|
|
11238
|
+
const cancelRef = useRef27();
|
|
11239
|
+
const commitRef = useRef27(onCommit);
|
|
11100
11240
|
commitRef.current = onCommit;
|
|
11101
11241
|
const [preview, setPreview] = useState26();
|
|
11102
11242
|
const signature = JSON.stringify(keys);
|
|
11103
|
-
|
|
11243
|
+
useEffect19(() => {
|
|
11104
11244
|
cancelRef.current?.();
|
|
11105
11245
|
return () => cancelRef.current?.();
|
|
11106
11246
|
}, [enabled, signature]);
|
|
@@ -11223,7 +11363,7 @@ function countQueryFieldRows(centers) {
|
|
|
11223
11363
|
}
|
|
11224
11364
|
|
|
11225
11365
|
// src/components/QueryFormSettings.tsx
|
|
11226
|
-
import { Fragment as Fragment11, jsx as
|
|
11366
|
+
import { Fragment as Fragment11, jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
11227
11367
|
function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed, disabled) {
|
|
11228
11368
|
const [snapshot, setSnapshot] = useState27();
|
|
11229
11369
|
const [draft, setDraft] = useState27({ fields: [], defaultCollapsed: defaultCollapsed ?? false });
|
|
@@ -11232,9 +11372,9 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11232
11372
|
const [saving, setSaving] = useState27(false);
|
|
11233
11373
|
const [error, setError] = useState27("");
|
|
11234
11374
|
const [loadFailed, setLoadFailed] = useState27(false);
|
|
11235
|
-
const token =
|
|
11236
|
-
const saveLock =
|
|
11237
|
-
const latest =
|
|
11375
|
+
const token = useRef28(0);
|
|
11376
|
+
const saveLock = useRef28(false);
|
|
11377
|
+
const latest = useRef28({ config, fields, defaultCollapsed, applyCollapsed });
|
|
11238
11378
|
latest.current = { config, fields, defaultCollapsed, applyCollapsed };
|
|
11239
11379
|
const moduleName = config?.scope.moduleName;
|
|
11240
11380
|
const businessKey = config?.scope.businessKey;
|
|
@@ -11262,7 +11402,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11262
11402
|
if (request === token.current) setLoading(false);
|
|
11263
11403
|
}
|
|
11264
11404
|
}
|
|
11265
|
-
|
|
11405
|
+
useEffect20(() => {
|
|
11266
11406
|
setSnapshot(void 0);
|
|
11267
11407
|
setOpen(false);
|
|
11268
11408
|
setError("");
|
|
@@ -11318,7 +11458,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11318
11458
|
const items = new Map(visibleDraft.map((item) => [item.key, item]));
|
|
11319
11459
|
setDraft((current) => ({ ...current, fields: keys.map((key, order) => ({ ...items.get(key), order })) }));
|
|
11320
11460
|
});
|
|
11321
|
-
const control = config ? /* @__PURE__ */
|
|
11461
|
+
const control = config ? /* @__PURE__ */ jsx33(
|
|
11322
11462
|
Button,
|
|
11323
11463
|
{
|
|
11324
11464
|
type: "button",
|
|
@@ -11327,7 +11467,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11327
11467
|
"aria-label": "\u67E5\u8BE2\u8BBE\u7F6E",
|
|
11328
11468
|
disabled: disabled || saving,
|
|
11329
11469
|
loading: loading && !open,
|
|
11330
|
-
icon: /* @__PURE__ */
|
|
11470
|
+
icon: /* @__PURE__ */ jsx33(Icon, { name: "more-vertical" }),
|
|
11331
11471
|
onClick: () => {
|
|
11332
11472
|
setOpen(true);
|
|
11333
11473
|
void load(true);
|
|
@@ -11335,8 +11475,8 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11335
11475
|
}
|
|
11336
11476
|
) : null;
|
|
11337
11477
|
const panel = config ? /* @__PURE__ */ jsxs28(Fragment11, { children: [
|
|
11338
|
-
!open && error ? /* @__PURE__ */
|
|
11339
|
-
/* @__PURE__ */
|
|
11478
|
+
!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,
|
|
11479
|
+
/* @__PURE__ */ jsx33(
|
|
11340
11480
|
Modal,
|
|
11341
11481
|
{
|
|
11342
11482
|
title: "\u67E5\u8BE2\u8BBE\u7F6E",
|
|
@@ -11350,14 +11490,14 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11350
11490
|
if (!saveLock.current) setOpen(next);
|
|
11351
11491
|
},
|
|
11352
11492
|
children: /* @__PURE__ */ jsxs28("div", { className: "sia-query-settings", children: [
|
|
11353
|
-
loading ? /* @__PURE__ */
|
|
11493
|
+
loading ? /* @__PURE__ */ jsx33("p", { role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u67E5\u8BE2\u8BBE\u7F6E\u2026" }) : null,
|
|
11354
11494
|
error ? /* @__PURE__ */ jsxs28("div", { role: "alert", className: "sia-query-form__error", children: [
|
|
11355
11495
|
error,
|
|
11356
|
-
loadFailed ? /* @__PURE__ */
|
|
11496
|
+
loadFailed ? /* @__PURE__ */ jsx33(Button, { type: "button", variant: "link", onClick: () => void load(true), children: "\u91CD\u8BD5" }) : null
|
|
11357
11497
|
] }) : null,
|
|
11358
|
-
/* @__PURE__ */
|
|
11359
|
-
/* @__PURE__ */
|
|
11360
|
-
/* @__PURE__ */
|
|
11498
|
+
/* @__PURE__ */ jsx33(Checkbox, { checked: draft.defaultCollapsed, disabled: locked, onChange: (checked) => setDraft((current) => ({ ...current, defaultCollapsed: checked })), children: "\u9ED8\u8BA4\u6536\u8D77\u67E5\u8BE2\u6761\u4EF6" }),
|
|
11499
|
+
/* @__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" }),
|
|
11500
|
+
/* @__PURE__ */ jsx33("div", { ref: sort.listRef, className: `sia-query-settings__list${sort.preview ? " is-sorting" : ""}`, children: visibleDraft.map((item, index) => /* @__PURE__ */ jsxs28(
|
|
11361
11501
|
"div",
|
|
11362
11502
|
{
|
|
11363
11503
|
"data-query-field-key": item.key,
|
|
@@ -11365,18 +11505,18 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11365
11505
|
style: sort.preview ? { transform: `translateY(${sort.preview.offsets[item.key] ?? 0}px)` } : void 0,
|
|
11366
11506
|
onPointerDown: (event) => sort.start(event, item.key),
|
|
11367
11507
|
children: [
|
|
11368
|
-
/* @__PURE__ */
|
|
11369
|
-
/* @__PURE__ */
|
|
11370
|
-
/* @__PURE__ */
|
|
11508
|
+
/* @__PURE__ */ jsx33(Icon, { name: "menu", size: 15 }),
|
|
11509
|
+
/* @__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) })) }),
|
|
11510
|
+
/* @__PURE__ */ jsx33("span", { className: "sia-query-settings__name", children: labels.get(item.key) ?? item.key }),
|
|
11371
11511
|
/* @__PURE__ */ jsxs28("div", { className: "sia-query-settings__order", children: [
|
|
11372
|
-
/* @__PURE__ */
|
|
11373
|
-
/* @__PURE__ */
|
|
11512
|
+
/* @__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) }),
|
|
11513
|
+
/* @__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
11514
|
] })
|
|
11375
11515
|
]
|
|
11376
11516
|
},
|
|
11377
11517
|
item.key
|
|
11378
11518
|
)) }),
|
|
11379
|
-
/* @__PURE__ */
|
|
11519
|
+
/* @__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
11520
|
] })
|
|
11381
11521
|
}
|
|
11382
11522
|
)
|
|
@@ -11385,7 +11525,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
|
|
|
11385
11525
|
}
|
|
11386
11526
|
|
|
11387
11527
|
// src/components/QueryForm.tsx
|
|
11388
|
-
import { jsx as
|
|
11528
|
+
import { jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
11389
11529
|
function QueryForm({
|
|
11390
11530
|
fields,
|
|
11391
11531
|
settings,
|
|
@@ -11432,11 +11572,11 @@ function QueryForm({
|
|
|
11432
11572
|
const [saveError, setSaveError] = useState28("");
|
|
11433
11573
|
const [error, setError] = useState28("");
|
|
11434
11574
|
const [activeShortcut, setActiveShortcut] = useState28("");
|
|
11435
|
-
const source =
|
|
11436
|
-
const searchLock =
|
|
11437
|
-
const saveLock =
|
|
11438
|
-
const removeLock =
|
|
11439
|
-
const snapshot =
|
|
11575
|
+
const source = useRef29({ source: "submit" });
|
|
11576
|
+
const searchLock = useRef29(false);
|
|
11577
|
+
const saveLock = useRef29(false);
|
|
11578
|
+
const removeLock = useRef29(false);
|
|
11579
|
+
const snapshot = useRef29();
|
|
11440
11580
|
const busy = disabled || loading || searching;
|
|
11441
11581
|
const shortcutBusy = busy || shortcutsLoading || saving || removing;
|
|
11442
11582
|
const fieldLabel = (content) => {
|
|
@@ -11448,7 +11588,7 @@ function QueryForm({
|
|
|
11448
11588
|
width,
|
|
11449
11589
|
hideDisabled: settingsHideDisabled,
|
|
11450
11590
|
label: settingsLabel ?? item.label ?? (typeof item.children === "function" ? void 0 : fieldLabel(item.children)) ?? key,
|
|
11451
|
-
content: /* @__PURE__ */
|
|
11591
|
+
content: /* @__PURE__ */ jsx34(Form.Item, { noStyle: true, ...item })
|
|
11452
11592
|
})) : Children4.toArray(children).map((content, index) => ({
|
|
11453
11593
|
key: isValidElement5(content) && content.key != null ? String(content.key) : String(index),
|
|
11454
11594
|
width: void 0,
|
|
@@ -11463,9 +11603,9 @@ function QueryForm({
|
|
|
11463
11603
|
const entries = configured.map((item) => ({ ...entriesByKey.get(item.key), visible: item.visible, visibleIndex: item.visible ? visibleIndex++ : -1 }));
|
|
11464
11604
|
const layoutKey = JSON.stringify(configured);
|
|
11465
11605
|
const limit = Math.max(1, Math.floor(collapsedCount));
|
|
11466
|
-
const rowRef =
|
|
11467
|
-
const actionsRef =
|
|
11468
|
-
const toggleRef =
|
|
11606
|
+
const rowRef = useRef29(null);
|
|
11607
|
+
const actionsRef = useRef29(null);
|
|
11608
|
+
const toggleRef = useRef29(null);
|
|
11469
11609
|
const [fittingCount, setFittingCount] = useState28(limit);
|
|
11470
11610
|
const [settingsRows, setSettingsRows] = useState28(0);
|
|
11471
11611
|
useLayoutEffect9(() => {
|
|
@@ -11652,7 +11792,7 @@ function QueryForm({
|
|
|
11652
11792
|
},
|
|
11653
11793
|
children: [
|
|
11654
11794
|
quickQueries.length ? /* @__PURE__ */ jsxs29("div", { className: "sia-query-form__quick", "aria-label": "\u9884\u8BBE\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
11655
|
-
quickQueries.map((query) => /* @__PURE__ */
|
|
11795
|
+
quickQueries.map((query) => /* @__PURE__ */ jsx34(
|
|
11656
11796
|
Badge,
|
|
11657
11797
|
{
|
|
11658
11798
|
className: "sia-query-form__quick-badge",
|
|
@@ -11661,7 +11801,7 @@ function QueryForm({
|
|
|
11661
11801
|
title: query.count === void 0 ? void 0 : `\u5171 ${query.count} \u6761`,
|
|
11662
11802
|
...query.badgeProps,
|
|
11663
11803
|
count: query.count,
|
|
11664
|
-
children: /* @__PURE__ */
|
|
11804
|
+
children: /* @__PURE__ */ jsx34(
|
|
11665
11805
|
Button,
|
|
11666
11806
|
{
|
|
11667
11807
|
size: query.size ?? quickQuerySize,
|
|
@@ -11677,7 +11817,7 @@ function QueryForm({
|
|
|
11677
11817
|
)),
|
|
11678
11818
|
" "
|
|
11679
11819
|
] }) : null,
|
|
11680
|
-
/* @__PURE__ */
|
|
11820
|
+
/* @__PURE__ */ jsx34("div", { className: "sia-query-form__motion", children: /* @__PURE__ */ jsxs29(
|
|
11681
11821
|
"div",
|
|
11682
11822
|
{
|
|
11683
11823
|
ref: rowRef,
|
|
@@ -11686,7 +11826,7 @@ function QueryForm({
|
|
|
11686
11826
|
"--sia-query-field-width": typeof fieldWidth === "number" ? `${fieldWidth}px` : fieldWidth
|
|
11687
11827
|
},
|
|
11688
11828
|
children: [
|
|
11689
|
-
entries.map((entry) => /* @__PURE__ */
|
|
11829
|
+
entries.map((entry) => /* @__PURE__ */ jsx34(
|
|
11690
11830
|
"div",
|
|
11691
11831
|
{
|
|
11692
11832
|
className: "sia-query-form__field",
|
|
@@ -11702,7 +11842,7 @@ function QueryForm({
|
|
|
11702
11842
|
)),
|
|
11703
11843
|
/* @__PURE__ */ jsxs29("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
|
|
11704
11844
|
/* @__PURE__ */ jsxs29(Space.Compact, { children: [
|
|
11705
|
-
/* @__PURE__ */
|
|
11845
|
+
/* @__PURE__ */ jsx34(
|
|
11706
11846
|
Button,
|
|
11707
11847
|
{
|
|
11708
11848
|
type: "submit",
|
|
@@ -11712,8 +11852,8 @@ function QueryForm({
|
|
|
11712
11852
|
children: searchText
|
|
11713
11853
|
}
|
|
11714
11854
|
),
|
|
11715
|
-
/* @__PURE__ */
|
|
11716
|
-
onSaveQuery ? /* @__PURE__ */
|
|
11855
|
+
/* @__PURE__ */ jsx34(Button, { disabled: busy, onClick: reset, children: resetText }),
|
|
11856
|
+
onSaveQuery ? /* @__PURE__ */ jsx34(
|
|
11717
11857
|
Button,
|
|
11718
11858
|
{
|
|
11719
11859
|
disabled: shortcutBusy,
|
|
@@ -11728,12 +11868,12 @@ function QueryForm({
|
|
|
11728
11868
|
) : null,
|
|
11729
11869
|
showSettings ?? settingsRows > 2 ? cloudSettings.control : null
|
|
11730
11870
|
] }),
|
|
11731
|
-
collapsible && entries.length > 0 ? /* @__PURE__ */
|
|
11871
|
+
collapsible && entries.length > 0 ? /* @__PURE__ */ jsx34("span", { ref: toggleRef, hidden: !needsCollapse, children: /* @__PURE__ */ jsx34(
|
|
11732
11872
|
Button,
|
|
11733
11873
|
{
|
|
11734
11874
|
variant: "link",
|
|
11735
11875
|
"aria-expanded": !collapsed,
|
|
11736
|
-
icon: /* @__PURE__ */
|
|
11876
|
+
icon: /* @__PURE__ */ jsx34(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
|
|
11737
11877
|
iconPosition: "end",
|
|
11738
11878
|
onClick: () => {
|
|
11739
11879
|
setInternalCollapsed(!collapsed);
|
|
@@ -11749,7 +11889,7 @@ function QueryForm({
|
|
|
11749
11889
|
}
|
|
11750
11890
|
) }),
|
|
11751
11891
|
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__ */
|
|
11892
|
+
savedQueries.map((query, index) => /* @__PURE__ */ jsx34(
|
|
11753
11893
|
Tag,
|
|
11754
11894
|
{
|
|
11755
11895
|
status: query.status ?? ["processing", "success", "warning", "error"][index % 4],
|
|
@@ -11775,7 +11915,7 @@ function QueryForm({
|
|
|
11775
11915
|
)),
|
|
11776
11916
|
" "
|
|
11777
11917
|
] }) : null,
|
|
11778
|
-
error ? /* @__PURE__ */
|
|
11918
|
+
error ? /* @__PURE__ */ jsx34("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
|
|
11779
11919
|
]
|
|
11780
11920
|
}
|
|
11781
11921
|
),
|
|
@@ -11791,7 +11931,7 @@ function QueryForm({
|
|
|
11791
11931
|
if (!saveLock.current) setSaveOpen(next);
|
|
11792
11932
|
},
|
|
11793
11933
|
children: [
|
|
11794
|
-
/* @__PURE__ */
|
|
11934
|
+
/* @__PURE__ */ jsx34(
|
|
11795
11935
|
Input,
|
|
11796
11936
|
{
|
|
11797
11937
|
autoFocus: true,
|
|
@@ -11810,7 +11950,7 @@ function QueryForm({
|
|
|
11810
11950
|
}
|
|
11811
11951
|
}
|
|
11812
11952
|
),
|
|
11813
|
-
saveError ? /* @__PURE__ */
|
|
11953
|
+
saveError ? /* @__PURE__ */ jsx34("p", { className: "sia-query-form__error", role: "alert", children: saveError }) : null
|
|
11814
11954
|
]
|
|
11815
11955
|
}
|
|
11816
11956
|
)
|
|
@@ -11819,7 +11959,7 @@ function QueryForm({
|
|
|
11819
11959
|
|
|
11820
11960
|
// src/components/NumberRange.tsx
|
|
11821
11961
|
import { forwardRef as forwardRef9 } from "react";
|
|
11822
|
-
import { jsx as
|
|
11962
|
+
import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
11823
11963
|
var NumberRange = forwardRef9(function NumberRange2({
|
|
11824
11964
|
value,
|
|
11825
11965
|
defaultValue = [null, null],
|
|
@@ -11857,7 +11997,7 @@ var NumberRange = forwardRef9(function NumberRange2({
|
|
|
11857
11997
|
"aria-disabled": disabled || void 0,
|
|
11858
11998
|
className: `sia-number-range sia-number-range--${size} sia-number-range--${status}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
11859
11999
|
children: [
|
|
11860
|
-
/* @__PURE__ */
|
|
12000
|
+
/* @__PURE__ */ jsx35(
|
|
11861
12001
|
InputNumber,
|
|
11862
12002
|
{
|
|
11863
12003
|
...inputProps,
|
|
@@ -11869,8 +12009,8 @@ var NumberRange = forwardRef9(function NumberRange2({
|
|
|
11869
12009
|
onChange: (next) => change(0, next)
|
|
11870
12010
|
}
|
|
11871
12011
|
),
|
|
11872
|
-
/* @__PURE__ */
|
|
11873
|
-
/* @__PURE__ */
|
|
12012
|
+
/* @__PURE__ */ jsx35(Icon, { className: "sia-number-range__separator", name: "tilde", size: 12, strokeWidth: 1.5, "aria-hidden": "true" }),
|
|
12013
|
+
/* @__PURE__ */ jsx35(
|
|
11874
12014
|
InputNumber,
|
|
11875
12015
|
{
|
|
11876
12016
|
...inputProps,
|
|
@@ -11882,15 +12022,15 @@ var NumberRange = forwardRef9(function NumberRange2({
|
|
|
11882
12022
|
onChange: (next) => change(1, next)
|
|
11883
12023
|
}
|
|
11884
12024
|
),
|
|
11885
|
-
allowClear && !disabled && !readOnly && range.some((item) => item !== null) ? /* @__PURE__ */
|
|
12025
|
+
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
12026
|
]
|
|
11887
12027
|
}
|
|
11888
12028
|
);
|
|
11889
12029
|
});
|
|
11890
12030
|
|
|
11891
12031
|
// src/components/VirtualGrid.tsx
|
|
11892
|
-
import { useEffect as
|
|
11893
|
-
import { jsx as
|
|
12032
|
+
import { useEffect as useEffect21, useLayoutEffect as useLayoutEffect10, useRef as useRef30, useState as useState29 } from "react";
|
|
12033
|
+
import { jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
11894
12034
|
function VirtualGrid({
|
|
11895
12035
|
items,
|
|
11896
12036
|
itemKey,
|
|
@@ -11909,11 +12049,11 @@ function VirtualGrid({
|
|
|
11909
12049
|
tabIndex = 0,
|
|
11910
12050
|
...props
|
|
11911
12051
|
}) {
|
|
11912
|
-
const viewport =
|
|
12052
|
+
const viewport = useRef30(null);
|
|
11913
12053
|
const [size, setSize] = useState29({ width: 0, height: 0 });
|
|
11914
12054
|
const [scrollTop, setScrollTop] = useState29(0);
|
|
11915
|
-
const frame =
|
|
11916
|
-
const requestedLength =
|
|
12055
|
+
const frame = useRef30();
|
|
12056
|
+
const requestedLength = useRef30();
|
|
11917
12057
|
const height = Math.max(1, rowHeight);
|
|
11918
12058
|
const spacing = Math.max(0, gap);
|
|
11919
12059
|
const columns = Math.max(1, Math.floor((size.width + spacing) / (Math.max(1, minColumnWidth) + spacing)));
|
|
@@ -11942,7 +12082,7 @@ function VirtualGrid({
|
|
|
11942
12082
|
if (el.scrollTop !== next) el.scrollTop = next;
|
|
11943
12083
|
setScrollTop(next);
|
|
11944
12084
|
}, [totalHeight, size.height]);
|
|
11945
|
-
|
|
12085
|
+
useEffect21(() => {
|
|
11946
12086
|
if (!onLoadMore || !hasMore || loading || size.height <= 0) return;
|
|
11947
12087
|
if (totalHeight - scrollTop - size.height > Math.max(0, loadMoreThreshold)) return;
|
|
11948
12088
|
if (requestedLength.current === items.length) return;
|
|
@@ -11967,16 +12107,16 @@ function VirtualGrid({
|
|
|
11967
12107
|
});
|
|
11968
12108
|
},
|
|
11969
12109
|
children: [
|
|
11970
|
-
/* @__PURE__ */
|
|
12110
|
+
/* @__PURE__ */ jsx36("div", { className: "sia-virtual-grid__spacer", style: { height: totalHeight }, children: Array.from({ length: Math.max(0, endRow - startRow) }, (_, offset) => {
|
|
11971
12111
|
const row = startRow + offset;
|
|
11972
|
-
return /* @__PURE__ */
|
|
12112
|
+
return /* @__PURE__ */ jsx36("div", { className: "sia-virtual-grid__row", role: "presentation", style: {
|
|
11973
12113
|
top: row * stride,
|
|
11974
12114
|
height,
|
|
11975
12115
|
columnGap: spacing,
|
|
11976
12116
|
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`
|
|
11977
12117
|
}, children: items.slice(row * columns, (row + 1) * columns).map((item, column) => {
|
|
11978
12118
|
const index = row * columns + column;
|
|
11979
|
-
return /* @__PURE__ */
|
|
12119
|
+
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
12120
|
}) }, row);
|
|
11981
12121
|
}) }),
|
|
11982
12122
|
!items.length && !loading ? empty : null
|