@arim-aisdc/public-components 2.3.32 → 2.3.33

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.
@@ -17,7 +17,7 @@ export declare const foramtBaseInfoField: (data: any, dataField: BaseInfoFieldTy
17
17
  value: any;
18
18
  field: string;
19
19
  label?: string;
20
- text: string | JSX.Element | Element;
20
+ text: string | Element | JSX.Element;
21
21
  units?: string;
22
22
  width?: string;
23
23
  labelWidth?: string;
@@ -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();
@@ -324,86 +325,7 @@ var Row = function Row(_ref) {
324
325
  }, []);
325
326
 
326
327
  // 优化:将行渲染逻辑提取为useMemo
327
- // const rowCom = useMemo(() => {
328
- // const renderCell = (cell: any) => {
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() {
328
+ var rowComMemo = useMemo(function () {
407
329
  var renderCell = function renderCell(cell) {
408
330
  var _cellClassName;
409
331
  var _cell$column$columnDe = cell.column.columnDef,
@@ -468,6 +390,72 @@ var Row = function Row(_ref) {
468
390
  className: rowClassNames,
469
391
  children: row.getVisibleCells().map(renderCell)
470
392
  });
393
+ }, [row, rowEditing, tableId, editting, canRowDrag, disableDragRowIds, isDragging, selectedRowDragging, rowStyle, handleRowClick, rowMouseEnter, rowMouseLeave, rowClassNames, leftLastColumnId, rightFirstColumnId, cellClassName, theme, rowHeight, table, handleCellRightClick, getCellProps, tableTooltip, onEditValueChange, dateFormat]);
394
+ var rowCom = function rowCom() {
395
+ var renderCell = function renderCell(cell) {
396
+ var _cellClassName2;
397
+ var _cell$column$columnDe3 = cell.column.columnDef,
398
+ columnEditable = _cell$column$columnDe3.editable,
399
+ accessorKey = _cell$column$columnDe3.accessorKey,
400
+ header = _cell$column$columnDe3.header,
401
+ columnClassName = _cell$column$columnDe3.columnClassName,
402
+ id = _cell$column$columnDe3.id,
403
+ filterType = _cell$column$columnDe3.filterType;
404
+ var columnEditing = rowEditing && columnEditable;
405
+ var rawValue = cell.getValue();
406
+
407
+ // 创建增强上下文
408
+ var originalContext = cell.getContext();
409
+ var enhancedContext = _objectSpread(_objectSpread({}, originalContext), {}, {
410
+ getValue: function getValue() {
411
+ return rawValue;
412
+ },
413
+ getFormattedValue: function getFormattedValue() {
414
+ var _cell$column$columnDe4;
415
+ 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;
416
+ },
417
+ renderValue: function renderValue() {
418
+ return enhancedContext.getFormattedValue();
419
+ }
420
+ });
421
+ 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) {
422
+ return "".concat(item, "-").concat(theme);
423
+ })) || []), ['tbody-tr-td']).filter(Boolean).join(' ');
424
+ return /*#__PURE__*/_jsx("td", _objectSpread(_objectSpread({
425
+ className: cellClassNames,
426
+ style: _objectSpread({
427
+ height: rowHeight - 1
428
+ }, getPinningStyle(cell, table, false)),
429
+ onContextMenu: function onContextMenu(e) {
430
+ return handleCellRightClick(e, cell);
431
+ }
432
+ }, getCellProps === null || getCellProps === void 0 ? void 0 : getCellProps(cell.getContext())), {}, {
433
+ children: EditableCell(_objectSpread(_objectSpread({}, cell.column.columnDef), {}, {
434
+ tableTooltip: tableTooltip,
435
+ editing: columnEditing,
436
+ dataIndex: accessorKey,
437
+ title: header,
438
+ onEditValueChange: onEditValueChange,
439
+ children: flexRender(cell.column.columnDef.cell, enhancedContext)
440
+ }))
441
+ }), cell.id);
442
+ };
443
+ return /*#__PURE__*/_jsx("tr", {
444
+ id: rowEditing ? "".concat(tableId, "-tbody-tr-editing") : undefined,
445
+ ref: function ref(node) {
446
+ dropRef(node && !editting ? node : null);
447
+ dragRef(node && canRowDrag && !editting && !(disableDragRowIds !== null && disableDragRowIds !== void 0 && disableDragRowIds.includes(row.id)) ? node : null);
448
+ },
449
+ style: _objectSpread({
450
+ opacity: isDragging || selectedRowDragging && row.getIsSelected() ? 0.5 : 1,
451
+ cursor: canRowDrag && !editting && !(disableDragRowIds !== null && disableDragRowIds !== void 0 && disableDragRowIds.includes(row.id)) ? 'move' : 'auto'
452
+ }, rowStyle),
453
+ onClick: handleRowClick,
454
+ onMouseEnter: rowMouseEnter,
455
+ onMouseLeave: rowMouseLeave,
456
+ className: rowClassNames,
457
+ children: row.getVisibleCells().map(renderCell)
458
+ });
471
459
  };
472
460
  return /*#__PURE__*/_jsxs(_Fragment, {
473
461
  children: [!!getRowHoverTipConfig ? /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({}, tooltipConfig), {}, {
@@ -479,8 +467,8 @@ var Row = function Row(_ref) {
479
467
  getPopupContainer: function getPopupContainer() {
480
468
  return tableBodyRef.current || document.body;
481
469
  },
482
- children: rowCom()
483
- })) : rowCom(), row.getIsExpanded() && /*#__PURE__*/_jsx("tr", {
470
+ children: openMemo ? rowComMemo : rowCom()
471
+ })) : openMemo ? rowComMemo : rowCom(), row.getIsExpanded() && /*#__PURE__*/_jsx("tr", {
484
472
  className: "tbody-tr-subrow",
485
473
  children: /*#__PURE__*/_jsx("td", {
486
474
  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
  };
@@ -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);
@@ -1067,7 +1068,8 @@ var TableMax = function TableMax(_ref) {
1067
1068
  onEditValueChange: onEditValueChange,
1068
1069
  hasTotalRow: hasTotalRow,
1069
1070
  totalDatas: totalDatas,
1070
- setRowSelection: setRowSelection
1071
+ setRowSelection: setRowSelection,
1072
+ openMemo: openMemo
1071
1073
  };
1072
1074
  var changeCompactMode = function changeCompactMode() {
1073
1075
  setCompactMode(!compactMode);
@@ -1,13 +1,13 @@
1
1
  import { TableMaxColumnType } from "../../type";
2
- export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
3
- export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
4
- export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
5
- export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
2
+ export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
3
+ export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
4
+ export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
5
+ export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
6
6
  declare const customSortFns: {
7
- numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
8
- stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
9
- timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
10
- numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
7
+ numberSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
8
+ stringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
9
+ timeSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
10
+ numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
11
11
  };
12
12
  export default customSortFns;
13
13
  export type SortFnType = keyof typeof customSortFns | undefined;
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arim-aisdc/public-components",
3
- "version": "2.3.32",
3
+ "version": "2.3.33",
4
4
  "description": "前端组件库",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",