@sia.soul/sia-react-ui 0.1.82 → 0.1.83
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 +19 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -12583,6 +12583,22 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
12583
12583
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("canvas", { ref: canvasRef, "aria-hidden": "true", className: "sia-table__canvas-layer" });
|
|
12584
12584
|
}
|
|
12585
12585
|
|
|
12586
|
+
// src/components/Table/rowIdentity.ts
|
|
12587
|
+
function createRowIdentity() {
|
|
12588
|
+
const keys = /* @__PURE__ */ new WeakMap();
|
|
12589
|
+
let sequence = 0;
|
|
12590
|
+
return (record, index, rowKey) => {
|
|
12591
|
+
const explicit = typeof rowKey === "function" ? rowKey(record, index) : rowKey == null ? void 0 : record[rowKey];
|
|
12592
|
+
if (typeof explicit === "string" || typeof explicit === "bigint" || typeof explicit === "number" && Number.isFinite(explicit)) return explicit;
|
|
12593
|
+
let key = keys.get(record);
|
|
12594
|
+
if (key === void 0) {
|
|
12595
|
+
key = `__sia_internal_row_${++sequence}`;
|
|
12596
|
+
keys.set(record, key);
|
|
12597
|
+
}
|
|
12598
|
+
return key;
|
|
12599
|
+
};
|
|
12600
|
+
}
|
|
12601
|
+
|
|
12586
12602
|
// src/components/Table/Table.tsx
|
|
12587
12603
|
var import_react53 = require("react");
|
|
12588
12604
|
|
|
@@ -15269,7 +15285,7 @@ function TableInner(props, ref) {
|
|
|
15269
15285
|
const {
|
|
15270
15286
|
dataSource = EMPTY_DATA,
|
|
15271
15287
|
columns: baseColumns = EMPTY_COLUMNS,
|
|
15272
|
-
rowKey
|
|
15288
|
+
rowKey,
|
|
15273
15289
|
plugins: providedPlugins = EMPTY_PLUGINS,
|
|
15274
15290
|
loading = false,
|
|
15275
15291
|
emptyText = "\u6682\u65E0\u6570\u636E",
|
|
@@ -15312,7 +15328,8 @@ function TableInner(props, ref) {
|
|
|
15312
15328
|
const [viewportHeight, setViewportHeight] = (0, import_react53.useState)(420);
|
|
15313
15329
|
const [viewportWidth, setViewportWidth] = (0, import_react53.useState)(0);
|
|
15314
15330
|
const [autoColumnWidths, setAutoColumnWidths] = (0, import_react53.useState)({});
|
|
15315
|
-
const
|
|
15331
|
+
const [resolveRowIdentity] = (0, import_react53.useState)(createRowIdentity);
|
|
15332
|
+
const getRowKey = (0, import_react53.useCallback)((record, index) => resolveRowIdentity(record, index, typeof rowKey === "function" ? rowKey : rowKey == null ? void 0 : String(rowKey)), [rowKey, resolveRowIdentity]);
|
|
15316
15333
|
const builtInResizePlugin = (0, import_react53.useMemo)(() => createResizePlugin(), []);
|
|
15317
15334
|
const builtInHighlightPlugin = (0, import_react53.useMemo)(() => createHighlightPlugin(), []);
|
|
15318
15335
|
const builtInCellSelectionPlugin = (0, import_react53.useMemo)(() => createCellSelectionPlugin(), []);
|
package/dist/index.d.cts
CHANGED
|
@@ -2109,7 +2109,7 @@ interface TableProps<T extends Record<string, unknown> = Record<string, unknown>
|
|
|
2109
2109
|
dataSource?: readonly T[];
|
|
2110
2110
|
/** 表格列定义;支持 children 构建分组表头。 */
|
|
2111
2111
|
columns?: readonly TableColumn<T>[];
|
|
2112
|
-
/**
|
|
2112
|
+
/** 行唯一键字段或计算函数,显式提供的值应唯一。未设置、字段不存在或值为 null/undefined 时按数据对象生成内部唯一键,不读取首列或默认 id。同一对象在排序、筛选后保留内部键;重新请求得到的新对象会生成新键,跨请求保留选择须显式设置业务主键。 */
|
|
2113
2113
|
rowKey?: keyof T | string | ((record: T, index: number) => TableKey);
|
|
2114
2114
|
/** 默认启用行悬停高亮;传入 createHighlightPlugin({ row: false }) 可关闭。 */
|
|
2115
2115
|
plugins?: readonly AnyTablePlugin<T>[];
|
package/dist/index.d.ts
CHANGED
|
@@ -2109,7 +2109,7 @@ interface TableProps<T extends Record<string, unknown> = Record<string, unknown>
|
|
|
2109
2109
|
dataSource?: readonly T[];
|
|
2110
2110
|
/** 表格列定义;支持 children 构建分组表头。 */
|
|
2111
2111
|
columns?: readonly TableColumn<T>[];
|
|
2112
|
-
/**
|
|
2112
|
+
/** 行唯一键字段或计算函数,显式提供的值应唯一。未设置、字段不存在或值为 null/undefined 时按数据对象生成内部唯一键,不读取首列或默认 id。同一对象在排序、筛选后保留内部键;重新请求得到的新对象会生成新键,跨请求保留选择须显式设置业务主键。 */
|
|
2113
2113
|
rowKey?: keyof T | string | ((record: T, index: number) => TableKey);
|
|
2114
2114
|
/** 默认启用行悬停高亮;传入 createHighlightPlugin({ row: false }) 可关闭。 */
|
|
2115
2115
|
plugins?: readonly AnyTablePlugin<T>[];
|
package/dist/index.js
CHANGED
|
@@ -5097,6 +5097,22 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
5097
5097
|
return /* @__PURE__ */ jsx21("canvas", { ref: canvasRef, "aria-hidden": "true", className: "sia-table__canvas-layer" });
|
|
5098
5098
|
}
|
|
5099
5099
|
|
|
5100
|
+
// src/components/Table/rowIdentity.ts
|
|
5101
|
+
function createRowIdentity() {
|
|
5102
|
+
const keys = /* @__PURE__ */ new WeakMap();
|
|
5103
|
+
let sequence = 0;
|
|
5104
|
+
return (record, index, rowKey) => {
|
|
5105
|
+
const explicit = typeof rowKey === "function" ? rowKey(record, index) : rowKey == null ? void 0 : record[rowKey];
|
|
5106
|
+
if (typeof explicit === "string" || typeof explicit === "bigint" || typeof explicit === "number" && Number.isFinite(explicit)) return explicit;
|
|
5107
|
+
let key = keys.get(record);
|
|
5108
|
+
if (key === void 0) {
|
|
5109
|
+
key = `__sia_internal_row_${++sequence}`;
|
|
5110
|
+
keys.set(record, key);
|
|
5111
|
+
}
|
|
5112
|
+
return key;
|
|
5113
|
+
};
|
|
5114
|
+
}
|
|
5115
|
+
|
|
5100
5116
|
// src/components/Table/Table.tsx
|
|
5101
5117
|
import { Fragment as Fragment8, forwardRef as forwardRef5, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as useEffect12, useImperativeHandle, useMemo as useMemo9, useRef as useRef16, useState as useState19 } from "react";
|
|
5102
5118
|
|
|
@@ -7783,7 +7799,7 @@ function TableInner(props, ref) {
|
|
|
7783
7799
|
const {
|
|
7784
7800
|
dataSource = EMPTY_DATA,
|
|
7785
7801
|
columns: baseColumns = EMPTY_COLUMNS,
|
|
7786
|
-
rowKey
|
|
7802
|
+
rowKey,
|
|
7787
7803
|
plugins: providedPlugins = EMPTY_PLUGINS,
|
|
7788
7804
|
loading = false,
|
|
7789
7805
|
emptyText = "\u6682\u65E0\u6570\u636E",
|
|
@@ -7826,7 +7842,8 @@ function TableInner(props, ref) {
|
|
|
7826
7842
|
const [viewportHeight, setViewportHeight] = useState19(420);
|
|
7827
7843
|
const [viewportWidth, setViewportWidth] = useState19(0);
|
|
7828
7844
|
const [autoColumnWidths, setAutoColumnWidths] = useState19({});
|
|
7829
|
-
const
|
|
7845
|
+
const [resolveRowIdentity] = useState19(createRowIdentity);
|
|
7846
|
+
const getRowKey = useCallback2((record, index) => resolveRowIdentity(record, index, typeof rowKey === "function" ? rowKey : rowKey == null ? void 0 : String(rowKey)), [rowKey, resolveRowIdentity]);
|
|
7830
7847
|
const builtInResizePlugin = useMemo9(() => createResizePlugin(), []);
|
|
7831
7848
|
const builtInHighlightPlugin = useMemo9(() => createHighlightPlugin(), []);
|
|
7832
7849
|
const builtInCellSelectionPlugin = useMemo9(() => createCellSelectionPlugin(), []);
|