@easyv/biz-components 2.1.0 → 2.1.1
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/lib/_virtual/index.es2.js +2 -2
- package/dist/lib/_virtual/index.es3.js +2 -2
- package/dist/lib/components/easyv-reactgrid/constants.es.js +9 -0
- package/dist/lib/components/easyv-reactgrid/constants.es.js.map +1 -0
- package/dist/lib/components/easyv-reactgrid/easyv-react-grid.es.js +293 -0
- package/dist/lib/components/easyv-reactgrid/easyv-react-grid.es.js.map +1 -0
- package/dist/lib/components/easyv-reactgrid/easyv-react-grid.module.less.es.js +7 -0
- package/dist/lib/components/easyv-reactgrid/easyv-react-grid.module.less.es.js.map +1 -0
- package/dist/lib/components/easyv-reactgrid/utils.es.js +13 -0
- package/dist/lib/components/easyv-reactgrid/utils.es.js.map +1 -0
- package/dist/lib/easyv-biz-components/src/components/easyv-reactgrid/constants.d.ts +5 -0
- package/dist/lib/easyv-biz-components/src/components/easyv-reactgrid/easyv-react-grid.d.ts +15 -0
- package/dist/lib/easyv-biz-components/src/components/easyv-reactgrid/index.d.ts +1 -0
- package/dist/lib/easyv-biz-components/src/components/easyv-reactgrid/test/easyv-react-grid.cy.d.ts +1 -0
- package/dist/lib/easyv-biz-components/src/components/easyv-reactgrid/utils.d.ts +1 -0
- package/dist/lib/easyv-biz-components/src/components/index.d.ts +1 -0
- package/dist/lib/index.es.js +2 -0
- package/dist/lib/index.es.js.map +1 -1
- package/dist/lib/node_modules/.pnpm/co-web-worker@1.0.1/node_modules/co-web-worker/index.es.js +1 -1
- package/dist/lib/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.es.js +1 -1
- package/dist/lib/stats.html +1 -1
- package/dist/lib/style.pkg.css +1 -1
- package/dist/tailwindcss.pkg.css +8 -0
- package/package.json +3 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.es.js","sources":["../../../../src/components/easyv-reactgrid/constants.ts"],"sourcesContent":["export const menuLabelMap = {\n copy: \"复制\",\n cut: \"剪切\",\n paste: \"粘贴\",\n};\n"],"names":[],"mappings":"AAAO,MAAM,eAAe;AAAA,EAC1B,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AACT;"}
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { j as jsxRuntimeExports } from "../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
|
|
2
|
+
import { useState, useMemo } from "react";
|
|
3
|
+
import { ReactGrid } from "@silevis/reactgrid";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import classNames from "../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.es.js";
|
|
6
|
+
import { produce } from "../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/dist/immer.es.js";
|
|
7
|
+
import { menuLabelMap } from "./constants.es.js";
|
|
8
|
+
import styles from "./easyv-react-grid.module.less.es.js";
|
|
9
|
+
import { getColumnLabel } from "./utils.es.js";
|
|
10
|
+
const EasyvReactGrid = (props) => {
|
|
11
|
+
const {
|
|
12
|
+
wrapClassName = "",
|
|
13
|
+
wrapStyle,
|
|
14
|
+
data,
|
|
15
|
+
onDataChange,
|
|
16
|
+
columns: propsColumns,
|
|
17
|
+
rows: propsRows,
|
|
18
|
+
expandMinGrid = true,
|
|
19
|
+
disableVirtualScrolling = true,
|
|
20
|
+
...restProps
|
|
21
|
+
} = props;
|
|
22
|
+
const [columnWidths, setColumnWidths] = useState({});
|
|
23
|
+
const [rowHeights, setRowHeights] = useState({});
|
|
24
|
+
const [selectedCellKeys, setSelectedCellKeys] = useState(/* @__PURE__ */ new Set());
|
|
25
|
+
const dataProps = useMemo(() => {
|
|
26
|
+
var _a;
|
|
27
|
+
if (!data) return null;
|
|
28
|
+
const colsCount = ((_a = data[0]) == null ? void 0 : _a.length) || 0;
|
|
29
|
+
const rowsCount = data.length || 0;
|
|
30
|
+
const minRows = props.minRows ?? 50;
|
|
31
|
+
const minCols = props.minCols ?? 26;
|
|
32
|
+
const displayRowsCount = expandMinGrid ? Math.max(rowsCount, minRows) : rowsCount;
|
|
33
|
+
const displayColsCount = expandMinGrid ? Math.max(colsCount, minCols) : colsCount;
|
|
34
|
+
const columns = [
|
|
35
|
+
{ columnId: "header-col", width: columnWidths["header-col"] ?? 75, resizable: true },
|
|
36
|
+
// 行头列
|
|
37
|
+
...Array.from({ length: displayColsCount }).map((_, idx) => ({
|
|
38
|
+
columnId: String(idx),
|
|
39
|
+
width: columnWidths[String(idx)] ?? 100,
|
|
40
|
+
resizable: true
|
|
41
|
+
}))
|
|
42
|
+
];
|
|
43
|
+
const headerRowStyle = {
|
|
44
|
+
background: "#252830",
|
|
45
|
+
color: "#c9cbd3"
|
|
46
|
+
};
|
|
47
|
+
const headerRow = {
|
|
48
|
+
rowId: "header-row",
|
|
49
|
+
height: rowHeights["header-row"] ?? 32,
|
|
50
|
+
cells: [
|
|
51
|
+
{
|
|
52
|
+
type: "header",
|
|
53
|
+
text: "",
|
|
54
|
+
style: { ...headerRowStyle }
|
|
55
|
+
},
|
|
56
|
+
...Array.from({ length: displayColsCount }).map(
|
|
57
|
+
(_, idx) => ({
|
|
58
|
+
type: "header",
|
|
59
|
+
text: getColumnLabel(idx),
|
|
60
|
+
style: { ...headerRowStyle }
|
|
61
|
+
})
|
|
62
|
+
)
|
|
63
|
+
],
|
|
64
|
+
resizable: true
|
|
65
|
+
};
|
|
66
|
+
const dataRows = Array.from({ length: displayRowsCount }).map((_, rowIndex) => {
|
|
67
|
+
const rowArr = rowIndex < rowsCount ? data[rowIndex] : [];
|
|
68
|
+
const cells = [
|
|
69
|
+
{
|
|
70
|
+
type: "header",
|
|
71
|
+
text: String(rowIndex + 1),
|
|
72
|
+
style: {
|
|
73
|
+
background: "#252830",
|
|
74
|
+
borderColor: "#292c34",
|
|
75
|
+
color: "#c9cbd3",
|
|
76
|
+
borderRightColor: "#50535e"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
...Array.from({ length: displayColsCount }).map((_2, colIndex) => {
|
|
80
|
+
const cellKey = `${rowIndex}:${colIndex}`;
|
|
81
|
+
const isSelected = selectedCellKeys.has(cellKey);
|
|
82
|
+
const baseStyle = isSelected ? { background: "#1c2338", borderColor: "#337efe" } : void 0;
|
|
83
|
+
const hasValue = colIndex < colsCount && rowIndex < rowsCount;
|
|
84
|
+
const cellValue = hasValue ? rowArr[colIndex] : "";
|
|
85
|
+
return { type: "text", text: String(cellValue), style: baseStyle };
|
|
86
|
+
})
|
|
87
|
+
];
|
|
88
|
+
return {
|
|
89
|
+
rowId: String(rowIndex),
|
|
90
|
+
height: rowHeights[String(rowIndex)] ?? 32,
|
|
91
|
+
cells,
|
|
92
|
+
resizable: true
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
const rows = [headerRow, ...dataRows];
|
|
96
|
+
return { columns, rows };
|
|
97
|
+
}, [
|
|
98
|
+
data,
|
|
99
|
+
props.minRows,
|
|
100
|
+
props.minCols,
|
|
101
|
+
expandMinGrid,
|
|
102
|
+
columnWidths,
|
|
103
|
+
rowHeights,
|
|
104
|
+
selectedCellKeys
|
|
105
|
+
]);
|
|
106
|
+
const finalColumns = dataProps ? dataProps.columns : propsColumns;
|
|
107
|
+
const finalRows = dataProps ? dataProps.rows : propsRows;
|
|
108
|
+
const handleCellsChanged = (changes) => {
|
|
109
|
+
var _a;
|
|
110
|
+
if (!data || !onDataChange) {
|
|
111
|
+
(_a = restProps.onCellsChanged) == null ? void 0 : _a.call(restProps, changes);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const newData = produce(data, (draft) => {
|
|
115
|
+
changes.forEach((change) => {
|
|
116
|
+
var _a2, _b, _c;
|
|
117
|
+
const rowIndex = Number(change.rowId);
|
|
118
|
+
const colIndex = Number(change.columnId);
|
|
119
|
+
if (change.rowId === "header-row" || change.columnId === "header-col") return;
|
|
120
|
+
if (!Number.isNaN(rowIndex) && !Number.isNaN(colIndex)) {
|
|
121
|
+
const currentRows = draft.length;
|
|
122
|
+
const currentCols = ((_a2 = draft[0]) == null ? void 0 : _a2.length) || 0;
|
|
123
|
+
const requiredCols = Math.max(currentCols, colIndex + 1);
|
|
124
|
+
if (rowIndex >= currentRows) {
|
|
125
|
+
const toAdd = rowIndex + 1 - currentRows;
|
|
126
|
+
for (let i = 0; i < toAdd; i++) {
|
|
127
|
+
draft.push(new Array(requiredCols).fill(""));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (requiredCols > currentCols) {
|
|
131
|
+
for (let r = 0; r < draft.length; r++) {
|
|
132
|
+
while ((((_b = draft[r]) == null ? void 0 : _b.length) || 0) < requiredCols) {
|
|
133
|
+
draft[r].push("");
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (change.newCell.type === "number") {
|
|
138
|
+
draft[rowIndex][colIndex] = change.newCell.value;
|
|
139
|
+
} else if (change.newCell.type === "text") {
|
|
140
|
+
draft[rowIndex][colIndex] = change.newCell.text;
|
|
141
|
+
} else {
|
|
142
|
+
draft[rowIndex][colIndex] = ((_c = change.newCell) == null ? void 0 : _c.text) ?? "";
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
onDataChange(newData);
|
|
148
|
+
};
|
|
149
|
+
const insertRow = (targetIndex, position) => {
|
|
150
|
+
if (!data || !onDataChange) return;
|
|
151
|
+
const newData = produce(data, (draft) => {
|
|
152
|
+
var _a;
|
|
153
|
+
const insertIdx = position === "above" ? targetIndex : targetIndex + 1;
|
|
154
|
+
const colsCount = ((_a = draft[0]) == null ? void 0 : _a.length) || 0;
|
|
155
|
+
const newRow = new Array(colsCount).fill("");
|
|
156
|
+
draft.splice(insertIdx, 0, newRow);
|
|
157
|
+
});
|
|
158
|
+
onDataChange(newData);
|
|
159
|
+
};
|
|
160
|
+
const insertColumn = (targetIndex, position) => {
|
|
161
|
+
if (!data || !onDataChange) return;
|
|
162
|
+
const newData = produce(data, (draft) => {
|
|
163
|
+
const insertIdx = position === "left" ? targetIndex : targetIndex + 1;
|
|
164
|
+
draft.forEach((row) => {
|
|
165
|
+
row.splice(insertIdx, 0, "");
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
onDataChange(newData);
|
|
169
|
+
};
|
|
170
|
+
const handleContextMenu = (selectedRowIds, selectedColIds, _selectionMode, menuOptions) => {
|
|
171
|
+
var _a;
|
|
172
|
+
const immediateHideMenu = () => {
|
|
173
|
+
const menu2 = document.querySelector(".rg-context-menu");
|
|
174
|
+
if (menu2) {
|
|
175
|
+
menu2.style.opacity = "0";
|
|
176
|
+
menu2.style.pointerEvents = "none";
|
|
177
|
+
setTimeout(() => {
|
|
178
|
+
if (menu2) {
|
|
179
|
+
menu2.style.opacity = "";
|
|
180
|
+
menu2.style.pointerEvents = "";
|
|
181
|
+
}
|
|
182
|
+
}, 300);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
const menu = document.querySelector(".rg-context-menu");
|
|
186
|
+
if (((_a = menu == null ? void 0 : menu.style) == null ? void 0 : _a.visibility) === "visible") {
|
|
187
|
+
immediateHideMenu();
|
|
188
|
+
}
|
|
189
|
+
const rowIndices = selectedRowIds.map((id) => Number(id)).filter((idx) => !Number.isNaN(idx) && idx >= 0).sort((a, b) => a - b);
|
|
190
|
+
const colIndices = selectedColIds.map((id) => Number(id)).filter((idx) => !Number.isNaN(idx) && idx >= 0).sort((a, b) => a - b);
|
|
191
|
+
const options = [];
|
|
192
|
+
if (rowIndices.length > 0) {
|
|
193
|
+
options.push(
|
|
194
|
+
{
|
|
195
|
+
id: "insertRowAbove",
|
|
196
|
+
label: "向上插入一行",
|
|
197
|
+
handler: () => () => insertRow(rowIndices[0], "above")
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
id: "insertRowBelow",
|
|
201
|
+
label: "向下插入一行",
|
|
202
|
+
handler: () => () => insertRow(rowIndices[rowIndices.length - 1], "below")
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
if (colIndices.length > 0) {
|
|
207
|
+
options.push(
|
|
208
|
+
{
|
|
209
|
+
id: "insertColumnLeft",
|
|
210
|
+
label: "向左插入一列",
|
|
211
|
+
handler: () => () => insertColumn(colIndices[0], "left")
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
id: "insertColumnRight",
|
|
215
|
+
label: "向右插入一列",
|
|
216
|
+
handler: () => () => insertColumn(colIndices[colIndices.length - 1], "right")
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
const originMenuOptions = menuOptions.map((item) => ({
|
|
221
|
+
...item,
|
|
222
|
+
label: menuLabelMap[item.id] || item.label
|
|
223
|
+
}));
|
|
224
|
+
return [...originMenuOptions, ...options];
|
|
225
|
+
};
|
|
226
|
+
const handleColumnResized = (columnId, width, _selectedColIds) => {
|
|
227
|
+
setColumnWidths((prev) => ({
|
|
228
|
+
...prev,
|
|
229
|
+
[String(columnId)]: width
|
|
230
|
+
}));
|
|
231
|
+
};
|
|
232
|
+
const handleRowResized = (rowId, height, _selectedRowIds) => {
|
|
233
|
+
setRowHeights((prev) => ({
|
|
234
|
+
...prev,
|
|
235
|
+
[String(rowId)]: height
|
|
236
|
+
}));
|
|
237
|
+
};
|
|
238
|
+
const handleSelectionChanged = (selectedRanges) => {
|
|
239
|
+
const keys = /* @__PURE__ */ new Set();
|
|
240
|
+
(selectedRanges || []).forEach((range) => {
|
|
241
|
+
if (Array.isArray(range)) {
|
|
242
|
+
range.forEach((loc) => {
|
|
243
|
+
if (loc && loc.rowId !== void 0 && loc.columnId !== void 0) {
|
|
244
|
+
keys.add(`${String(loc.rowId)}:${String(loc.columnId)}`);
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
} else if (range && Array.isArray(range.rowIds) && Array.isArray(range.columnIds)) {
|
|
248
|
+
range.rowIds.forEach((r) => {
|
|
249
|
+
range.columnIds.forEach((c) => {
|
|
250
|
+
keys.add(`${String(r)}:${String(c)}`);
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
setSelectedCellKeys(keys);
|
|
256
|
+
};
|
|
257
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
258
|
+
"div",
|
|
259
|
+
{
|
|
260
|
+
className: classNames(
|
|
261
|
+
styles["easyv-react-grid"],
|
|
262
|
+
"easyv-react-grid",
|
|
263
|
+
"biz-w-full biz-h-full biz-min-h-[100px] biz-min-w-[200px]",
|
|
264
|
+
wrapClassName
|
|
265
|
+
),
|
|
266
|
+
style: wrapStyle,
|
|
267
|
+
children: finalColumns && finalRows ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
268
|
+
ReactGrid,
|
|
269
|
+
{
|
|
270
|
+
columns: finalColumns,
|
|
271
|
+
rows: finalRows,
|
|
272
|
+
stickyTopRows: 1,
|
|
273
|
+
stickyLeftColumns: 1,
|
|
274
|
+
enableRangeSelection: true,
|
|
275
|
+
enableFillHandle: true,
|
|
276
|
+
enableRowSelection: true,
|
|
277
|
+
enableColumnSelection: true,
|
|
278
|
+
onSelectionChanged: handleSelectionChanged,
|
|
279
|
+
disableVirtualScrolling,
|
|
280
|
+
...restProps,
|
|
281
|
+
onCellsChanged: handleCellsChanged,
|
|
282
|
+
onContextMenu: handleContextMenu,
|
|
283
|
+
onColumnResized: handleColumnResized,
|
|
284
|
+
onRowResized: handleRowResized
|
|
285
|
+
}
|
|
286
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "biz-flex-center biz-w-full biz-h-full biz-text-text-3", children: "No data provided" })
|
|
287
|
+
}
|
|
288
|
+
);
|
|
289
|
+
};
|
|
290
|
+
export {
|
|
291
|
+
EasyvReactGrid
|
|
292
|
+
};
|
|
293
|
+
//# sourceMappingURL=easyv-react-grid.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"easyv-react-grid.es.js","sources":["../../../../src/components/easyv-reactgrid/easyv-react-grid.tsx"],"sourcesContent":["import React, { useMemo, useState } from \"react\";\nimport {\n CellChange,\n Column,\n Id,\n MenuOption,\n Range,\n ReactGrid,\n ReactGridProps,\n Row,\n SelectionMode,\n} from \"@silevis/reactgrid\";\nimport \"@silevis/reactgrid/styles.css\";\nimport classNames from \"classnames\";\nimport { produce } from \"immer\";\nimport { menuLabelMap } from \"./constants\";\nimport styles from \"./easyv-react-grid.module.less\";\nimport { getColumnLabel } from \"./utils\";\n\nexport interface EasyvReactGridProps extends Omit<ReactGridProps, \"columns\" | \"rows\"> {\n columns?: ReactGridProps[\"columns\"];\n rows?: ReactGridProps[\"rows\"];\n wrapClassName?: string;\n wrapStyle?: React.CSSProperties;\n data?: (string | number)[][];\n onDataChange?: (data: (string | number)[][]) => void;\n expandMinGrid?: boolean;\n minRows?: number;\n minCols?: number;\n}\n\nexport const EasyvReactGrid = (props: EasyvReactGridProps) => {\n const {\n wrapClassName = \"\",\n wrapStyle,\n data,\n onDataChange,\n columns: propsColumns,\n rows: propsRows,\n expandMinGrid = true,\n disableVirtualScrolling = true,\n ...restProps\n } = props;\n\n const [columnWidths, setColumnWidths] = useState<Record<string, number>>({});\n const [rowHeights, setRowHeights] = useState<Record<string, number>>({});\n const [selectedCellKeys, setSelectedCellKeys] = useState<Set<string>>(new Set());\n\n const dataProps = useMemo(() => {\n if (!data) return null;\n const colsCount = data[0]?.length || 0;\n const rowsCount = data.length || 0;\n const minRows = props.minRows ?? 50;\n const minCols = props.minCols ?? 26;\n const displayRowsCount = expandMinGrid ? Math.max(rowsCount, minRows) : rowsCount;\n const displayColsCount = expandMinGrid ? Math.max(colsCount, minCols) : colsCount;\n\n // 添加 Header Column (Row Index)\n const columns: Column[] = [\n { columnId: \"header-col\", width: columnWidths[\"header-col\"] ?? 75, resizable: true }, // 行头列\n ...Array.from({ length: displayColsCount }).map((_, idx) => ({\n columnId: String(idx),\n width: columnWidths[String(idx)] ?? 100,\n resizable: true,\n })),\n ];\n\n // 添加 Header Row (Column Headers)\n const headerRowStyle: React.CSSProperties = {\n background: \"#252830\",\n color: \"#c9cbd3\",\n };\n const headerRow: Row = {\n rowId: \"header-row\",\n height: rowHeights[\"header-row\"] ?? 32,\n cells: [\n {\n type: \"header\",\n text: \"\",\n style: { ...headerRowStyle },\n },\n ...Array.from({ length: displayColsCount }).map(\n (_, idx) =>\n ({\n type: \"header\",\n text: getColumnLabel(idx),\n style: { ...headerRowStyle },\n }) as any,\n ),\n ],\n resizable: true,\n };\n\n const dataRows: Row[] = Array.from({ length: displayRowsCount }).map((_, rowIndex) => {\n const rowArr = rowIndex < rowsCount ? data[rowIndex] : [];\n const cells = [\n {\n type: \"header\",\n text: String(rowIndex + 1),\n style: {\n background: \"#252830\",\n borderColor: \"#292c34\",\n color: \"#c9cbd3\",\n borderRightColor: \"#50535e\",\n },\n } as any,\n ...Array.from({ length: displayColsCount }).map((_, colIndex) => {\n const cellKey = `${rowIndex}:${colIndex}`;\n const isSelected = selectedCellKeys.has(cellKey);\n const baseStyle = isSelected\n ? { background: \"#1c2338\", borderColor: \"#337efe\" }\n : undefined;\n const hasValue = colIndex < colsCount && rowIndex < rowsCount;\n const cellValue = hasValue ? rowArr[colIndex] : \"\";\n return { type: \"text\", text: String(cellValue), style: baseStyle } as any;\n }),\n ];\n return {\n rowId: String(rowIndex),\n height: rowHeights[String(rowIndex)] ?? 32,\n cells,\n resizable: true,\n };\n });\n\n const rows = [headerRow, ...dataRows];\n\n return { columns, rows };\n }, [\n data,\n props.minRows,\n props.minCols,\n expandMinGrid,\n columnWidths,\n rowHeights,\n selectedCellKeys,\n ]);\n\n const finalColumns = dataProps ? dataProps.columns : propsColumns;\n const finalRows = dataProps ? dataProps.rows : propsRows;\n\n const handleCellsChanged = (changes: CellChange<any>[]) => {\n if (!data || !onDataChange) {\n restProps.onCellsChanged?.(changes);\n return;\n }\n\n const newData = produce(data, (draft) => {\n changes.forEach((change) => {\n const rowIndex = Number(change.rowId);\n const colIndex = Number(change.columnId);\n\n // 过滤掉 header-row 和 header-col 的变更(虽然它们通常不可编辑)\n if (change.rowId === \"header-row\" || change.columnId === \"header-col\") return;\n\n if (!Number.isNaN(rowIndex) && !Number.isNaN(colIndex)) {\n const currentRows = draft.length;\n const currentCols = draft[0]?.length || 0;\n const requiredCols = Math.max(currentCols, colIndex + 1);\n\n if (rowIndex >= currentRows) {\n const toAdd = rowIndex + 1 - currentRows;\n for (let i = 0; i < toAdd; i++) {\n draft.push(new Array(requiredCols).fill(\"\"));\n }\n }\n\n if (requiredCols > currentCols) {\n for (let r = 0; r < draft.length; r++) {\n while ((draft[r]?.length || 0) < requiredCols) {\n draft[r].push(\"\");\n }\n }\n }\n\n if (change.newCell.type === \"number\") {\n draft[rowIndex][colIndex] = change.newCell.value;\n } else if (change.newCell.type === \"text\") {\n draft[rowIndex][colIndex] = change.newCell.text;\n } else {\n draft[rowIndex][colIndex] = (change as any).newCell?.text ?? \"\";\n }\n }\n });\n });\n\n onDataChange(newData);\n };\n\n const insertRow = (targetIndex: number, position: \"above\" | \"below\") => {\n if (!data || !onDataChange) return;\n const newData = produce(data, (draft) => {\n const insertIdx = position === \"above\" ? targetIndex : targetIndex + 1;\n const colsCount = draft[0]?.length || 0;\n const newRow = new Array(colsCount).fill(\"\");\n draft.splice(insertIdx, 0, newRow);\n });\n onDataChange(newData);\n };\n\n const insertColumn = (targetIndex: number, position: \"left\" | \"right\") => {\n if (!data || !onDataChange) return;\n const newData = produce(data, (draft) => {\n const insertIdx = position === \"left\" ? targetIndex : targetIndex + 1;\n draft.forEach((row) => {\n row.splice(insertIdx, 0, \"\");\n });\n });\n onDataChange(newData);\n };\n\n const handleContextMenu = (\n selectedRowIds: Id[],\n selectedColIds: Id[],\n _selectionMode: SelectionMode,\n menuOptions: MenuOption[],\n ): MenuOption[] => {\n const immediateHideMenu = () => {\n // 尝试强制隐藏菜单,避免闪烁\n const menu = document.querySelector(\".rg-context-menu\") as HTMLElement;\n if (menu) {\n menu.style.opacity = \"0\";\n menu.style.pointerEvents = \"none\";\n // 500ms 后恢复样式,确保下次打开时菜单可见\n setTimeout(() => {\n if (menu) {\n menu.style.opacity = \"\";\n menu.style.pointerEvents = \"\";\n }\n }, 300);\n }\n };\n const menu = document.querySelector(\".rg-context-menu\") as HTMLElement;\n if (menu?.style?.visibility === \"visible\") {\n immediateHideMenu();\n }\n const rowIndices = selectedRowIds\n .map((id) => Number(id))\n .filter((idx) => !Number.isNaN(idx) && idx >= 0)\n .sort((a, b) => a - b);\n\n const colIndices = selectedColIds\n .map((id) => Number(id))\n .filter((idx) => !Number.isNaN(idx) && idx >= 0)\n .sort((a, b) => a - b);\n\n const options: MenuOption[] = [];\n\n if (rowIndices.length > 0) {\n options.push(\n {\n id: \"insertRowAbove\",\n label: \"向上插入一行\",\n handler: () => () => insertRow(rowIndices[0], \"above\"),\n },\n {\n id: \"insertRowBelow\",\n label: \"向下插入一行\",\n handler: () => () => insertRow(rowIndices[rowIndices.length - 1], \"below\"),\n },\n );\n }\n\n if (colIndices.length > 0) {\n options.push(\n {\n id: \"insertColumnLeft\",\n label: \"向左插入一列\",\n handler: () => () => insertColumn(colIndices[0], \"left\"),\n },\n {\n id: \"insertColumnRight\",\n label: \"向右插入一列\",\n handler: () => () => insertColumn(colIndices[colIndices.length - 1], \"right\"),\n },\n );\n }\n\n const originMenuOptions = menuOptions.map((item) => ({\n ...item,\n label: menuLabelMap[item.id as keyof typeof menuLabelMap] || item.label,\n }));\n return [...originMenuOptions, ...options];\n };\n\n const handleColumnResized = (columnId: Id, width: number, _selectedColIds: Id[]) => {\n setColumnWidths((prev) => ({\n ...prev,\n [String(columnId)]: width,\n }));\n };\n\n const handleRowResized = (rowId: Id, height: number, _selectedRowIds: Id[]) => {\n setRowHeights((prev) => ({\n ...prev,\n [String(rowId)]: height,\n }));\n };\n\n const handleSelectionChanged = (selectedRanges: Range[]) => {\n const keys = new Set<string>();\n (selectedRanges || []).forEach((range: any) => {\n if (Array.isArray(range)) {\n range.forEach((loc: any) => {\n if (loc && loc.rowId !== undefined && loc.columnId !== undefined) {\n keys.add(`${String(loc.rowId)}:${String(loc.columnId)}`);\n }\n });\n } else if (range && Array.isArray(range.rowIds) && Array.isArray(range.columnIds)) {\n range.rowIds.forEach((r: any) => {\n range.columnIds.forEach((c: any) => {\n keys.add(`${String(r)}:${String(c)}`);\n });\n });\n }\n });\n setSelectedCellKeys(keys);\n };\n\n return (\n <div\n className={classNames(\n styles[\"easyv-react-grid\"],\n \"easyv-react-grid\",\n \"biz-w-full biz-h-full biz-min-h-[100px] biz-min-w-[200px]\",\n wrapClassName,\n )}\n style={wrapStyle}\n >\n {finalColumns && finalRows ? (\n <ReactGrid\n columns={finalColumns}\n rows={finalRows}\n stickyTopRows={1}\n stickyLeftColumns={1}\n enableRangeSelection\n enableFillHandle\n enableRowSelection\n enableColumnSelection\n onSelectionChanged={handleSelectionChanged}\n disableVirtualScrolling={disableVirtualScrolling}\n {...restProps}\n onCellsChanged={handleCellsChanged}\n onContextMenu={handleContextMenu}\n onColumnResized={handleColumnResized}\n onRowResized={handleRowResized}\n />\n ) : (\n <div className=\"biz-flex-center biz-w-full biz-h-full biz-text-text-3\">\n No data provided\n </div>\n )}\n </div>\n );\n};\n"],"names":["_","_a","menu","jsx"],"mappings":";;;;;;;;;AA+Ba,MAAA,iBAAiB,CAAC,UAA+B;AACtD,QAAA;AAAA,IACJ,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,MAAM;AAAA,IACN,gBAAgB;AAAA,IAChB,0BAA0B;AAAA,IAC1B,GAAG;AAAA,EAAA,IACD;AAEJ,QAAM,CAAC,cAAc,eAAe,IAAI,SAAiC,CAAA,CAAE;AAC3E,QAAM,CAAC,YAAY,aAAa,IAAI,SAAiC,CAAA,CAAE;AACvE,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAsB,oBAAI,KAAK;AAEzE,QAAA,YAAY,QAAQ,MAAM;;AAC1B,QA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DAAwD,UAEvE,mBAAA,CAAA;AAAA,IAAA;AAAA,EAEJ;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"easyv-react-grid.module.less.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const getColumnLabel = (index) => {
|
|
2
|
+
let label = "";
|
|
3
|
+
let i = index;
|
|
4
|
+
while (i >= 0) {
|
|
5
|
+
label = String.fromCharCode(65 + i % 26) + label;
|
|
6
|
+
i = Math.floor(i / 26) - 1;
|
|
7
|
+
}
|
|
8
|
+
return label;
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
getColumnLabel
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=utils.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.es.js","sources":["../../../../src/components/easyv-reactgrid/utils.ts"],"sourcesContent":["// 辅助函数:将数字索引转换为 Excel 列头 (e.g. 0 -> A, 26 -> AA)\nexport const getColumnLabel = (index: number): string => {\n let label = \"\";\n let i = index;\n while (i >= 0) {\n label = String.fromCharCode(65 + (i % 26)) + label;\n i = Math.floor(i / 26) - 1;\n }\n return label;\n};\n"],"names":[],"mappings":"AACa,MAAA,iBAAiB,CAAC,UAA0B;AACvD,MAAI,QAAQ;AACZ,MAAI,IAAI;AACR,SAAO,KAAK,GAAG;AACb,YAAQ,OAAO,aAAa,KAAM,IAAI,EAAG,IAAI;AAC7C,QAAI,KAAK,MAAM,IAAI,EAAE,IAAI;AAAA,EAAA;AAEpB,SAAA;AACT;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ReactGridProps } from '@silevis/reactgrid';
|
|
3
|
+
|
|
4
|
+
export interface EasyvReactGridProps extends Omit<ReactGridProps, "columns" | "rows"> {
|
|
5
|
+
columns?: ReactGridProps["columns"];
|
|
6
|
+
rows?: ReactGridProps["rows"];
|
|
7
|
+
wrapClassName?: string;
|
|
8
|
+
wrapStyle?: React.CSSProperties;
|
|
9
|
+
data?: (string | number)[][];
|
|
10
|
+
onDataChange?: (data: (string | number)[][]) => void;
|
|
11
|
+
expandMinGrid?: boolean;
|
|
12
|
+
minRows?: number;
|
|
13
|
+
minCols?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare const EasyvReactGrid: (props: EasyvReactGridProps) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EasyvReactGrid } from './easyv-react-grid';
|
package/dist/lib/easyv-biz-components/src/components/easyv-reactgrid/test/easyv-react-grid.cy.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getColumnLabel: (index: number) => string;
|
package/dist/lib/index.es.js
CHANGED
|
@@ -11,6 +11,7 @@ import { ErrorBoundary } from "./components/error-boundary/error-boundary.es.js"
|
|
|
11
11
|
import { AiModelSelectPanel } from "./components/ai-model-select/ai-model-select-panel.es.js";
|
|
12
12
|
import { MobileVoiceInput } from "./components/ai-components/mobile-voice-input/mobile-voice-input.es.js";
|
|
13
13
|
import { CircleLoading } from "./components/circle-loading/circle-loading.es.js";
|
|
14
|
+
import { EasyvReactGrid } from "./components/easyv-reactgrid/easyv-react-grid.es.js";
|
|
14
15
|
import { useDivAutoScroll } from "./hooks/use-div-auto-scroll.es.js";
|
|
15
16
|
import { useInitialized } from "./hooks/use-initialized.es.js";
|
|
16
17
|
import { useWatchValue } from "./hooks/use-watch-value/use-watch-value.es.js";
|
|
@@ -62,6 +63,7 @@ export {
|
|
|
62
63
|
EXPLICIT_DISCONNECT_REASON,
|
|
63
64
|
EasyvGUIType,
|
|
64
65
|
EasyvMonacoEditor,
|
|
66
|
+
EasyvReactGrid,
|
|
65
67
|
EchartsRender,
|
|
66
68
|
ErrorBoundary,
|
|
67
69
|
FunASRManager,
|
package/dist/lib/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/lib/node_modules/.pnpm/co-web-worker@1.0.1/node_modules/co-web-worker/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDefaultExportFromCjs } from "../../../../../_virtual/_commonjsHelpers.es.js";
|
|
2
|
-
import { __module as coWebWorker } from "../../../../../_virtual/index.
|
|
2
|
+
import { __module as coWebWorker } from "../../../../../_virtual/index.es3.js";
|
|
3
3
|
class CrossOriginWorker extends Worker {
|
|
4
4
|
constructor(scriptUrl) {
|
|
5
5
|
const b = new Blob([`importScripts('${new URL(scriptUrl).toString()}')`], { type: "application/javascript" });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDefaultExportFromCjs } from "../../../../../_virtual/_commonjsHelpers.es.js";
|
|
2
|
-
import { __module as propTypes } from "../../../../../_virtual/index.
|
|
2
|
+
import { __module as propTypes } from "../../../../../_virtual/index.es2.js";
|
|
3
3
|
import { __require as requireReactIs } from "../../../react-is@16.13.1/node_modules/react-is/index.es.js";
|
|
4
4
|
import { __require as requireFactoryWithTypeCheckers } from "./factoryWithTypeCheckers.es.js";
|
|
5
5
|
import { __require as requireFactoryWithThrowingShims } from "./factoryWithThrowingShims.es.js";
|