@arim-aisdc/public-components 2.3.32 → 2.3.34
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/components/ConfigProvider/context.d.ts +1 -0
- package/dist/components/TableMax/TableBody/Row.d.ts +2 -1
- package/dist/components/TableMax/TableBody/Row.js +79 -88
- package/dist/components/TableMax/TableBody/index.d.ts +3 -2
- package/dist/components/TableMax/TableBody/index.js +7 -4
- package/dist/components/TableMax/TableMax.js +15 -4
- package/dist/components/TableMax/type.d.ts +3 -0
- package/package.json +1 -1
- /package/dist/components/TableMax/TableBody/{Row copy.d.ts → Row1.d.ts} +0 -0
- /package/dist/components/TableMax/TableBody/{Row copy.js → Row1.js} +0 -0
|
@@ -60,6 +60,7 @@ type IRowProps = {
|
|
|
60
60
|
dropSide: DropSide;
|
|
61
61
|
onEditValueChange?: (field: string, value: any, extra?: any) => void;
|
|
62
62
|
setRowSelection?: Function;
|
|
63
|
+
openMemo?: boolean;
|
|
63
64
|
};
|
|
64
|
-
declare const Row: ({ tableBodyRef, table, tableId, row, rowSelectedId, setRowSelectedId, rowHighLightId, setRowHighLightId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked, reorderRow, canRowDrag, rowClassName, cellClassName, rowStyle, getCellProps, editting, rowEditing, renderSubComponent, selectedRowDragging, setSelectedRowDragging, onRowMouseEnter, onRowMouseLeave, onRowMouseClick, onRowMouseDoubleClick, rowHeight, disableDragRowIds, selectRowWhenClick, handleEditRowWhenDClick, canEditRowWhenDClick, theme, dragBeforeStart, shadowColumnInfo, onCellContextMenu, getRowHoverTipConfig, tableTooltip, changeHoverRow, clearHoverRowIndex, hoverRowIndex, dropSide, onEditValueChange, setRowSelection }: IRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
65
|
+
declare const Row: ({ tableBodyRef, table, tableId, row, rowSelectedId, setRowSelectedId, rowHighLightId, setRowHighLightId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked, reorderRow, canRowDrag, rowClassName, cellClassName, rowStyle, getCellProps, editting, rowEditing, renderSubComponent, selectedRowDragging, setSelectedRowDragging, onRowMouseEnter, onRowMouseLeave, onRowMouseClick, onRowMouseDoubleClick, rowHeight, disableDragRowIds, selectRowWhenClick, handleEditRowWhenDClick, canEditRowWhenDClick, theme, dragBeforeStart, shadowColumnInfo, onCellContextMenu, getRowHoverTipConfig, tableTooltip, changeHoverRow, clearHoverRowIndex, hoverRowIndex, dropSide, onEditValueChange, setRowSelection, openMemo }: IRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
65
66
|
export default Row;
|
|
@@ -75,7 +75,8 @@ var Row = function Row(_ref) {
|
|
|
75
75
|
hoverRowIndex = _ref.hoverRowIndex,
|
|
76
76
|
dropSide = _ref.dropSide,
|
|
77
77
|
onEditValueChange = _ref.onEditValueChange,
|
|
78
|
-
setRowSelection = _ref.setRowSelection
|
|
78
|
+
setRowSelection = _ref.setRowSelection,
|
|
79
|
+
openMemo = _ref.openMemo;
|
|
79
80
|
var _useConfig = useConfig(),
|
|
80
81
|
dateFormat = _useConfig.dateFormat;
|
|
81
82
|
var timerRef = useRef();
|
|
@@ -245,7 +246,7 @@ var Row = function Row(_ref) {
|
|
|
245
246
|
} else if (Object.keys(selectionConfig).length > 1) {
|
|
246
247
|
delete selectionConfig[row.id];
|
|
247
248
|
}
|
|
248
|
-
setRowSelection(
|
|
249
|
+
// setRowSelection({ ...selectionConfig });
|
|
249
250
|
}, [row, table]);
|
|
250
251
|
var handleShiftSelection = useCallback(function () {
|
|
251
252
|
var min = Math.min(initselectedIndex || 0, row.index);
|
|
@@ -256,11 +257,12 @@ var Row = function Row(_ref) {
|
|
|
256
257
|
}).forEach(function (row) {
|
|
257
258
|
selectionConfig[row.id] = true;
|
|
258
259
|
});
|
|
259
|
-
|
|
260
|
+
|
|
261
|
+
// setRowSelection(selectionConfig);
|
|
260
262
|
}, [row, table]);
|
|
261
263
|
var handleSingleRowSelection = useCallback(function () {
|
|
262
264
|
initselectedIndex = row.index;
|
|
263
|
-
setRowSelection(
|
|
265
|
+
// setRowSelection({ [row?.id]: true });
|
|
264
266
|
}, [row, table]);
|
|
265
267
|
var handleShiftSelectionWithCheckbox = useCallback(function () {
|
|
266
268
|
var selectionConfig = _objectSpread({}, table.getState().rowSelection);
|
|
@@ -271,7 +273,8 @@ var Row = function Row(_ref) {
|
|
|
271
273
|
}).forEach(function (row) {
|
|
272
274
|
selectionConfig[row.id] = true;
|
|
273
275
|
});
|
|
274
|
-
|
|
276
|
+
|
|
277
|
+
// setRowSelection(selectionConfig);
|
|
275
278
|
}, [row, table]);
|
|
276
279
|
var handleToggleSelection = useCallback(function () {
|
|
277
280
|
if (!row.getIsSelected()) {
|
|
@@ -279,7 +282,7 @@ var Row = function Row(_ref) {
|
|
|
279
282
|
}
|
|
280
283
|
var selectionConfig = _objectSpread(_objectSpread({}, table.getState().rowSelection), {}, _defineProperty({}, row.id, !row.getIsSelected()));
|
|
281
284
|
if (row.getCanSelect()) {
|
|
282
|
-
setRowSelection(selectionConfig);
|
|
285
|
+
// setRowSelection(selectionConfig);
|
|
283
286
|
}
|
|
284
287
|
}, [row, table]);
|
|
285
288
|
var handleSingleSelection = useCallback(function (evt) {
|
|
@@ -324,86 +327,8 @@ var Row = function Row(_ref) {
|
|
|
324
327
|
}, []);
|
|
325
328
|
|
|
326
329
|
// 优化:将行渲染逻辑提取为useMemo
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
// const { editable: columnEditable, accessorKey, header, columnClassName, id, filterType } = cell.column.columnDef;
|
|
330
|
-
// const columnEditing = rowEditing && columnEditable;
|
|
331
|
-
// const rawValue = cell.getValue();
|
|
332
|
-
|
|
333
|
-
// // 创建增强上下文
|
|
334
|
-
// const originalContext = cell.getContext();
|
|
335
|
-
// const enhancedContext: any = {
|
|
336
|
-
// ...originalContext,
|
|
337
|
-
// getValue: () => rawValue,
|
|
338
|
-
// getFormattedValue: () =>
|
|
339
|
-
// isDateColumn(cell.column.columnDef)
|
|
340
|
-
// ? formatDate(rawValue, cell.column.columnDef?.meta?.dateFormat || dateFormat)
|
|
341
|
-
// : rawValue,
|
|
342
|
-
// renderValue: () => enhancedContext.getFormattedValue()
|
|
343
|
-
// };
|
|
344
|
-
|
|
345
|
-
// const cellClassNames = [
|
|
346
|
-
// columnEditing ? 'tbody-tr-td-editting' : '',
|
|
347
|
-
// id === leftLastColumnId ? 'tbody-tr-td-cell-fix-left-last' : '',
|
|
348
|
-
// id === rightFirstColumnId ? 'tbody-tr-td-cell-fix-right-first' : '',
|
|
349
|
-
// columnClassName ? columnClassName.join(' ') : '',
|
|
350
|
-
// ...(cellClassName?.(cell)?.map((item: any) => `${item}-${theme}`) || []),
|
|
351
|
-
// 'tbody-tr-td'
|
|
352
|
-
// ].filter(Boolean).join(' ');
|
|
353
|
-
|
|
354
|
-
// return (
|
|
355
|
-
// <td
|
|
356
|
-
// className={cellClassNames}
|
|
357
|
-
// key={cell.id}
|
|
358
|
-
// style={{
|
|
359
|
-
// height: rowHeight - 1,
|
|
360
|
-
// ...getPinningStyle(cell, table, false),
|
|
361
|
-
// }}
|
|
362
|
-
// onContextMenu={e => handleCellRightClick(e, cell)}
|
|
363
|
-
// {...getCellProps?.(cell.getContext())}
|
|
364
|
-
// >
|
|
365
|
-
// {EditableCell({
|
|
366
|
-
// ...cell.column.columnDef,
|
|
367
|
-
// tableTooltip: tableTooltip,
|
|
368
|
-
// editing: columnEditing,
|
|
369
|
-
// dataIndex: accessorKey,
|
|
370
|
-
// title: header,
|
|
371
|
-
// onEditValueChange: onEditValueChange,
|
|
372
|
-
// children: flexRender(cell.column.columnDef.cell, enhancedContext)
|
|
373
|
-
// })}
|
|
374
|
-
// </td>
|
|
375
|
-
// );
|
|
376
|
-
// };
|
|
377
|
-
|
|
378
|
-
// return (
|
|
379
|
-
// <tr
|
|
380
|
-
// id={rowEditing ? `${tableId}-tbody-tr-editing` : undefined}
|
|
381
|
-
// ref={node => {
|
|
382
|
-
// dropRef(node && !editting ? node : null);
|
|
383
|
-
// dragRef(node && canRowDrag && !editting && !disableDragRowIds?.includes(row.id) ? node : null);
|
|
384
|
-
// }}
|
|
385
|
-
// style={{
|
|
386
|
-
// opacity: isDragging || (selectedRowDragging && row.getIsSelected()) ? 0.5 : 1,
|
|
387
|
-
// cursor: canRowDrag && !editting && !disableDragRowIds?.includes(row.id) ? 'move' : 'auto',
|
|
388
|
-
// ...rowStyle,
|
|
389
|
-
// }}
|
|
390
|
-
// onClick={handleRowClick}
|
|
391
|
-
// onMouseEnter={rowMouseEnter}
|
|
392
|
-
// onMouseLeave={rowMouseLeave}
|
|
393
|
-
// className={rowClassNames}
|
|
394
|
-
// >
|
|
395
|
-
// {row.getVisibleCells().map(renderCell)}
|
|
396
|
-
// </tr>
|
|
397
|
-
// );
|
|
398
|
-
// }, [
|
|
399
|
-
// row, rowEditing, tableId, editting, canRowDrag, disableDragRowIds, isDragging,
|
|
400
|
-
// selectedRowDragging, rowStyle, handleRowClick, rowMouseEnter, rowMouseLeave,
|
|
401
|
-
// rowClassNames, leftLastColumnId, rightFirstColumnId, cellClassName, theme,
|
|
402
|
-
// rowHeight, table, handleCellRightClick, getCellProps, tableTooltip,
|
|
403
|
-
// onEditValueChange, dateFormat,
|
|
404
|
-
// ]);
|
|
405
|
-
|
|
406
|
-
var rowCom = function rowCom() {
|
|
330
|
+
var rowComMemo = useMemo(function () {
|
|
331
|
+
console.log(row.getIsSelected(), row.renderValue(), 'row.getIsSelected()');
|
|
407
332
|
var renderCell = function renderCell(cell) {
|
|
408
333
|
var _cellClassName;
|
|
409
334
|
var _cell$column$columnDe = cell.column.columnDef,
|
|
@@ -468,6 +393,72 @@ var Row = function Row(_ref) {
|
|
|
468
393
|
className: rowClassNames,
|
|
469
394
|
children: row.getVisibleCells().map(renderCell)
|
|
470
395
|
});
|
|
396
|
+
}, [row, rowEditing, tableId, editting, canRowDrag, disableDragRowIds, isDragging, selectedRowDragging, rowStyle, handleRowClick, rowMouseEnter, rowMouseLeave, rowClassNames, leftLastColumnId, rightFirstColumnId, cellClassName, theme, rowHeight, table, handleCellRightClick, getCellProps, tableTooltip, onEditValueChange, dateFormat, row.getVisibleCells(), row.getIsSelected(), row.getValue(), row.renderValue()]);
|
|
397
|
+
var rowCom = function rowCom() {
|
|
398
|
+
var renderCell = function renderCell(cell) {
|
|
399
|
+
var _cellClassName2;
|
|
400
|
+
var _cell$column$columnDe3 = cell.column.columnDef,
|
|
401
|
+
columnEditable = _cell$column$columnDe3.editable,
|
|
402
|
+
accessorKey = _cell$column$columnDe3.accessorKey,
|
|
403
|
+
header = _cell$column$columnDe3.header,
|
|
404
|
+
columnClassName = _cell$column$columnDe3.columnClassName,
|
|
405
|
+
id = _cell$column$columnDe3.id,
|
|
406
|
+
filterType = _cell$column$columnDe3.filterType;
|
|
407
|
+
var columnEditing = rowEditing && columnEditable;
|
|
408
|
+
var rawValue = cell.getValue();
|
|
409
|
+
|
|
410
|
+
// 创建增强上下文
|
|
411
|
+
var originalContext = cell.getContext();
|
|
412
|
+
var enhancedContext = _objectSpread(_objectSpread({}, originalContext), {}, {
|
|
413
|
+
getValue: function getValue() {
|
|
414
|
+
return rawValue;
|
|
415
|
+
},
|
|
416
|
+
getFormattedValue: function getFormattedValue() {
|
|
417
|
+
var _cell$column$columnDe4;
|
|
418
|
+
return isDateColumn(cell.column.columnDef) ? formatDate(rawValue, ((_cell$column$columnDe4 = cell.column.columnDef) === null || _cell$column$columnDe4 === void 0 || (_cell$column$columnDe4 = _cell$column$columnDe4.meta) === null || _cell$column$columnDe4 === void 0 ? void 0 : _cell$column$columnDe4.dateFormat) || dateFormat) : rawValue;
|
|
419
|
+
},
|
|
420
|
+
renderValue: function renderValue() {
|
|
421
|
+
return enhancedContext.getFormattedValue();
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
var cellClassNames = [columnEditing ? 'tbody-tr-td-editting' : '', id === leftLastColumnId ? 'tbody-tr-td-cell-fix-left-last' : '', id === rightFirstColumnId ? 'tbody-tr-td-cell-fix-right-first' : '', columnClassName ? columnClassName.join(' ') : ''].concat(_toConsumableArray((cellClassName === null || cellClassName === void 0 || (_cellClassName2 = cellClassName(cell)) === null || _cellClassName2 === void 0 ? void 0 : _cellClassName2.map(function (item) {
|
|
425
|
+
return "".concat(item, "-").concat(theme);
|
|
426
|
+
})) || []), ['tbody-tr-td']).filter(Boolean).join(' ');
|
|
427
|
+
return /*#__PURE__*/_jsx("td", _objectSpread(_objectSpread({
|
|
428
|
+
className: cellClassNames,
|
|
429
|
+
style: _objectSpread({
|
|
430
|
+
height: rowHeight - 1
|
|
431
|
+
}, getPinningStyle(cell, table, false)),
|
|
432
|
+
onContextMenu: function onContextMenu(e) {
|
|
433
|
+
return handleCellRightClick(e, cell);
|
|
434
|
+
}
|
|
435
|
+
}, getCellProps === null || getCellProps === void 0 ? void 0 : getCellProps(cell.getContext())), {}, {
|
|
436
|
+
children: EditableCell(_objectSpread(_objectSpread({}, cell.column.columnDef), {}, {
|
|
437
|
+
tableTooltip: tableTooltip,
|
|
438
|
+
editing: columnEditing,
|
|
439
|
+
dataIndex: accessorKey,
|
|
440
|
+
title: header,
|
|
441
|
+
onEditValueChange: onEditValueChange,
|
|
442
|
+
children: flexRender(cell.column.columnDef.cell, enhancedContext)
|
|
443
|
+
}))
|
|
444
|
+
}), cell.id);
|
|
445
|
+
};
|
|
446
|
+
return /*#__PURE__*/_jsx("tr", {
|
|
447
|
+
id: rowEditing ? "".concat(tableId, "-tbody-tr-editing") : undefined,
|
|
448
|
+
ref: function ref(node) {
|
|
449
|
+
dropRef(node && !editting ? node : null);
|
|
450
|
+
dragRef(node && canRowDrag && !editting && !(disableDragRowIds !== null && disableDragRowIds !== void 0 && disableDragRowIds.includes(row.id)) ? node : null);
|
|
451
|
+
},
|
|
452
|
+
style: _objectSpread({
|
|
453
|
+
opacity: isDragging || selectedRowDragging && row.getIsSelected() ? 0.5 : 1,
|
|
454
|
+
cursor: canRowDrag && !editting && !(disableDragRowIds !== null && disableDragRowIds !== void 0 && disableDragRowIds.includes(row.id)) ? 'move' : 'auto'
|
|
455
|
+
}, rowStyle),
|
|
456
|
+
onClick: handleRowClick,
|
|
457
|
+
onMouseEnter: rowMouseEnter,
|
|
458
|
+
onMouseLeave: rowMouseLeave,
|
|
459
|
+
className: rowClassNames,
|
|
460
|
+
children: row.getVisibleCells().map(renderCell)
|
|
461
|
+
});
|
|
471
462
|
};
|
|
472
463
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
473
464
|
children: [!!getRowHoverTipConfig ? /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({}, tooltipConfig), {}, {
|
|
@@ -479,8 +470,8 @@ var Row = function Row(_ref) {
|
|
|
479
470
|
getPopupContainer: function getPopupContainer() {
|
|
480
471
|
return tableBodyRef.current || document.body;
|
|
481
472
|
},
|
|
482
|
-
children: rowCom()
|
|
483
|
-
})) : rowCom(), row.getIsExpanded() && /*#__PURE__*/_jsx("tr", {
|
|
473
|
+
children: openMemo ? rowComMemo : rowCom()
|
|
474
|
+
})) : openMemo ? rowComMemo : rowCom(), row.getIsExpanded() && /*#__PURE__*/_jsx("tr", {
|
|
484
475
|
className: "tbody-tr-subrow",
|
|
485
476
|
children: /*#__PURE__*/_jsx("td", {
|
|
486
477
|
colSpan: row.getVisibleCells().length,
|
|
@@ -74,7 +74,8 @@ type TableBodyPropsType = {
|
|
|
74
74
|
hasTotalRow?: boolean;
|
|
75
75
|
totalDatas?: any[];
|
|
76
76
|
setRowSelection: Function;
|
|
77
|
+
openMemo?: boolean;
|
|
77
78
|
};
|
|
78
|
-
declare const TableBody: ({ tableBodyRef, table, tableId, theme, reorderRow, rowSelectedId, setRowSelectedId, rowHighLightId, setRowHighLightId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked, tableContainerWidth, selectedRowDragging, setSelectedRowDragging, canRowDrag, rowKey, loading, rowClassName, cellClassName, rowStyle, getCellProps, rowHeight, renderSubComponent, onRowMouseEnter, onRowMouseLeave, onRowMouseClick, onRowMouseDoubleClick, disableDragRowIds, selectRowWhenClick, datas, canEditRowWhenDClick, editingRowId, handleEditRowWhenDClick, dragBeforeStart, shadowColumnInfo, getContextMenu, onClickContextMenu, getRowHoverTipConfig, tableTooltip, compactMode, onEditValueChange, hasTotalRow, totalDatas, setRowSelection }: TableBodyPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
79
|
+
declare const TableBody: ({ tableBodyRef, table, tableId, theme, reorderRow, rowSelectedId, setRowSelectedId, rowHighLightId, setRowHighLightId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked, tableContainerWidth, selectedRowDragging, setSelectedRowDragging, canRowDrag, rowKey, loading, rowClassName, cellClassName, rowStyle, getCellProps, rowHeight, renderSubComponent, onRowMouseEnter, onRowMouseLeave, onRowMouseClick, onRowMouseDoubleClick, disableDragRowIds, selectRowWhenClick, datas, canEditRowWhenDClick, editingRowId, handleEditRowWhenDClick, dragBeforeStart, shadowColumnInfo, getContextMenu, onClickContextMenu, getRowHoverTipConfig, tableTooltip, compactMode, onEditValueChange, hasTotalRow, totalDatas, setRowSelection, openMemo }: TableBodyPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
79
80
|
export default TableBody;
|
|
80
|
-
export declare const MemoizedTableBody: ({ tableBodyRef, table, tableId, theme, reorderRow, rowSelectedId, setRowSelectedId, rowHighLightId, setRowHighLightId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked, tableContainerWidth, selectedRowDragging, setSelectedRowDragging, canRowDrag, rowKey, loading, rowClassName, cellClassName, rowStyle, getCellProps, rowHeight, renderSubComponent, onRowMouseEnter, onRowMouseLeave, onRowMouseClick, onRowMouseDoubleClick, disableDragRowIds, selectRowWhenClick, datas, canEditRowWhenDClick, editingRowId, handleEditRowWhenDClick, dragBeforeStart, shadowColumnInfo, getContextMenu, onClickContextMenu, getRowHoverTipConfig, tableTooltip, compactMode, onEditValueChange, hasTotalRow, totalDatas, setRowSelection }: TableBodyPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
81
|
+
export declare const MemoizedTableBody: ({ tableBodyRef, table, tableId, theme, reorderRow, rowSelectedId, setRowSelectedId, rowHighLightId, setRowHighLightId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked, tableContainerWidth, selectedRowDragging, setSelectedRowDragging, canRowDrag, rowKey, loading, rowClassName, cellClassName, rowStyle, getCellProps, rowHeight, renderSubComponent, onRowMouseEnter, onRowMouseLeave, onRowMouseClick, onRowMouseDoubleClick, disableDragRowIds, selectRowWhenClick, datas, canEditRowWhenDClick, editingRowId, handleEditRowWhenDClick, dragBeforeStart, shadowColumnInfo, getContextMenu, onClickContextMenu, getRowHoverTipConfig, tableTooltip, compactMode, onEditValueChange, hasTotalRow, totalDatas, setRowSelection, openMemo }: TableBodyPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -76,7 +76,8 @@ var TableBody = function TableBody(_ref) {
|
|
|
76
76
|
onEditValueChange = _ref.onEditValueChange,
|
|
77
77
|
hasTotalRow = _ref.hasTotalRow,
|
|
78
78
|
totalDatas = _ref.totalDatas,
|
|
79
|
-
setRowSelection = _ref.setRowSelection
|
|
79
|
+
setRowSelection = _ref.setRowSelection,
|
|
80
|
+
openMemo = _ref.openMemo;
|
|
80
81
|
var _useConfig = useConfig(),
|
|
81
82
|
root = _useConfig.root;
|
|
82
83
|
var headerGroups = table.getHeaderGroups();
|
|
@@ -373,7 +374,8 @@ var TableBody = function TableBody(_ref) {
|
|
|
373
374
|
hoverRowIndex: hoverRowIndex,
|
|
374
375
|
dropSide: dropSide,
|
|
375
376
|
onEditValueChange: onEditValueChange,
|
|
376
|
-
setRowSelection: setRowSelection
|
|
377
|
+
setRowSelection: setRowSelection,
|
|
378
|
+
openMemo: openMemo
|
|
377
379
|
}, row.id);
|
|
378
380
|
});
|
|
379
381
|
};
|
|
@@ -387,7 +389,7 @@ var TableBody = function TableBody(_ref) {
|
|
|
387
389
|
// console.log('rowHeight :>>', rowHeight);
|
|
388
390
|
|
|
389
391
|
var TableRow = useMemo(function () {
|
|
390
|
-
console.log(
|
|
392
|
+
console.log(table.getRowModel().rows, 'TableRow');
|
|
391
393
|
return table.getRowModel().rows;
|
|
392
394
|
}, [table, table.getState().rowSelection]);
|
|
393
395
|
return (
|
|
@@ -468,7 +470,8 @@ var TableBody = function TableBody(_ref) {
|
|
|
468
470
|
hoverRowIndex: hoverRowIndex,
|
|
469
471
|
dropSide: dropSide,
|
|
470
472
|
onEditValueChange: onEditValueChange,
|
|
471
|
-
setRowSelection: setRowSelection
|
|
473
|
+
setRowSelection: setRowSelection,
|
|
474
|
+
openMemo: openMemo
|
|
472
475
|
}, row.id);
|
|
473
476
|
})
|
|
474
477
|
// TBodyContent()
|
|
@@ -193,7 +193,8 @@ var TableMax = function TableMax(_ref) {
|
|
|
193
193
|
onEditValueChange = _ref.onEditValueChange,
|
|
194
194
|
hasTotalRow = _ref.hasTotalRow,
|
|
195
195
|
totalDatas = _ref.totalDatas,
|
|
196
|
-
pageSizeOptions = _ref.pageSizeOptions
|
|
196
|
+
pageSizeOptions = _ref.pageSizeOptions,
|
|
197
|
+
openMemo = _ref.openMemo;
|
|
197
198
|
var tableMaxRef = useRef(null);
|
|
198
199
|
// 表格元素
|
|
199
200
|
var tableContentRef = useRef(null);
|
|
@@ -215,10 +216,12 @@ var TableMax = function TableMax(_ref) {
|
|
|
215
216
|
var tableMaxConfig = useMemo(function () {
|
|
216
217
|
var _ref2 = tableMax || {},
|
|
217
218
|
globalPageSizeOptions = _ref2.pageSizeOptions,
|
|
218
|
-
cacheMaxAge = _ref2.cacheMaxAge
|
|
219
|
+
cacheMaxAge = _ref2.cacheMaxAge,
|
|
220
|
+
openMemo = _ref2.openMemo;
|
|
219
221
|
return {
|
|
220
222
|
globalPageSizeOptions: globalPageSizeOptions,
|
|
221
|
-
cacheMaxAge: cacheMaxAge
|
|
223
|
+
cacheMaxAge: cacheMaxAge,
|
|
224
|
+
openMemo: openMemo
|
|
222
225
|
};
|
|
223
226
|
}, [JSON.stringify(tableMax)]);
|
|
224
227
|
|
|
@@ -550,6 +553,10 @@ var TableMax = function TableMax(_ref) {
|
|
|
550
553
|
}
|
|
551
554
|
setColumnOrder(arr);
|
|
552
555
|
};
|
|
556
|
+
var _useState39 = useState(0),
|
|
557
|
+
_useState40 = _slicedToArray(_useState39, 2),
|
|
558
|
+
checkboxRender = _useState40[0],
|
|
559
|
+
setCheckboxRender = _useState40[1];
|
|
553
560
|
var setColumnsByProps = useCallback(function () {
|
|
554
561
|
var extraColumns = [];
|
|
555
562
|
if (getRowCanExpand() && columns.findIndex(function (column) {
|
|
@@ -613,6 +620,9 @@ var TableMax = function TableMax(_ref) {
|
|
|
613
620
|
}
|
|
614
621
|
return item.getIsSelected();
|
|
615
622
|
});
|
|
623
|
+
setCheckboxRender(function (prev) {
|
|
624
|
+
return prev + 1;
|
|
625
|
+
});
|
|
616
626
|
onRowCheckboxClick === null || onRowCheckboxClick === void 0 || onRowCheckboxClick(row, row.original, !row.getIsSelected(), curSelectedRows);
|
|
617
627
|
// 阻止点击事件冒泡,监听行双击事件时,点击这里会有问题
|
|
618
628
|
e.stopPropagation();
|
|
@@ -1067,7 +1077,8 @@ var TableMax = function TableMax(_ref) {
|
|
|
1067
1077
|
onEditValueChange: onEditValueChange,
|
|
1068
1078
|
hasTotalRow: hasTotalRow,
|
|
1069
1079
|
totalDatas: totalDatas,
|
|
1070
|
-
setRowSelection: setRowSelection
|
|
1080
|
+
setRowSelection: setRowSelection,
|
|
1081
|
+
openMemo: openMemo !== null && openMemo !== void 0 ? openMemo : tableMaxConfig === null || tableMaxConfig === void 0 ? void 0 : tableMaxConfig.openMemo
|
|
1071
1082
|
};
|
|
1072
1083
|
var changeCompactMode = function changeCompactMode() {
|
|
1073
1084
|
setCompactMode(!compactMode);
|
|
@@ -318,6 +318,7 @@ export type TableMaxProps = {
|
|
|
318
318
|
totalDatas?: any[];
|
|
319
319
|
/**分页,每页多少条可选值 */
|
|
320
320
|
pageSizeOptions?: number[];
|
|
321
|
+
openMemo?: boolean;
|
|
321
322
|
};
|
|
322
323
|
export interface TableMaxColumnType {
|
|
323
324
|
/**每一列的id是唯一的 */
|
|
@@ -400,6 +401,8 @@ export interface TableMaxColumnType {
|
|
|
400
401
|
/**日期展示格式 */
|
|
401
402
|
dateFormat?: string;
|
|
402
403
|
};
|
|
404
|
+
/** 是否缓存行单元格 */
|
|
405
|
+
openMemo?: boolean;
|
|
403
406
|
}
|
|
404
407
|
export type FormatFilterType = {
|
|
405
408
|
field: string;
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|