@arim-aisdc/public-components 2.3.25 → 2.3.27

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.
@@ -194,7 +194,7 @@ var CenterModal = function CenterModal(_ref) {
194
194
  onCancel: handleCancel,
195
195
  okText: okText,
196
196
  footer: hasfooter ? footer : null,
197
- centered: false,
197
+ centered: true,
198
198
  closeIcon: /*#__PURE__*/_jsx("i", {
199
199
  className: "iconfont-other icon-other-close",
200
200
  children: " "
@@ -25,6 +25,11 @@ export interface ConfigConsumerProps {
25
25
  locale?: Locale;
26
26
  /**tablemax dateFormat */
27
27
  dateFormat?: string;
28
+ /**tablemax pageSizeOptions */
29
+ tableMax?: {
30
+ pageSizeOptions?: number[];
31
+ cacheMaxAge?: number;
32
+ };
28
33
  }
29
34
  export declare const DEFAULT_CONTEXT: {
30
35
  theme: string;
@@ -60,5 +60,5 @@ type IRowProps = {
60
60
  dropSide: DropSide;
61
61
  onEditValueChange?: (field: string, value: any, extra?: any) => void;
62
62
  };
63
- 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, }: IRowProps) => import("react/jsx-runtime").JSX.Element;
64
- export default Row;
63
+ declare const _default: React.MemoExoticComponent<({ 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, }: IRowProps) => import("react/jsx-runtime").JSX.Element>;
64
+ export default _default;
@@ -413,7 +413,7 @@ var Row = function Row(_ref) {
413
413
  })]
414
414
  });
415
415
  };
416
- export default Row;
416
+ export default /*#__PURE__*/React.memo(Row);
417
417
  function formatDate(dateValue) {
418
418
  var pattern = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "YYYY-MM-DD HH:mm";
419
419
  if (!dateValue) return '';
@@ -1,6 +1,6 @@
1
1
  import { Table } from '@tanstack/react-table';
2
2
  import { IMenuOptionsType, OnSelectChangeType } from "../type";
3
- import { Dispatch, MutableRefObject, ReactNode, SetStateAction } from 'react';
3
+ import React, { Dispatch, MutableRefObject, ReactNode, SetStateAction } from 'react';
4
4
  import './index.less';
5
5
  type TableBodyPropsType = {
6
6
  tableBodyRef: MutableRefObject<HTMLDivElement> | null;
@@ -74,6 +74,5 @@ type TableBodyPropsType = {
74
74
  hasTotalRow?: boolean;
75
75
  totalDatas?: any[];
76
76
  };
77
- 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 }: TableBodyPropsType) => import("react/jsx-runtime").JSX.Element;
78
- export default TableBody;
79
- 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 }: TableBodyPropsType) => import("react/jsx-runtime").JSX.Element;
77
+ declare const _default: React.MemoExoticComponent<({ 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 }: TableBodyPropsType) => import("react/jsx-runtime").JSX.Element>;
78
+ export default _default;
@@ -154,7 +154,7 @@ var TableBody = function TableBody(_ref) {
154
154
  }, [hoverRowIndex, dropSide]);
155
155
 
156
156
  // cell右键菜单
157
- var handleCellContextMenu = function handleCellContextMenu(e, cell) {
157
+ var handleCellContextMenu = useCallback(function (e, cell) {
158
158
  // console.log('cell :>> ', cell);
159
159
  if (getContextMenu) {
160
160
  var options = getContextMenu({
@@ -171,7 +171,7 @@ var TableBody = function TableBody(_ref) {
171
171
  });
172
172
  e.preventDefault();
173
173
  }
174
- };
174
+ }, [getContextMenu]);
175
175
 
176
176
  // 关闭菜单
177
177
  var closeContextMenu = useCallback(function () {
@@ -431,7 +431,9 @@ var TableBody = function TableBody(_ref) {
431
431
  })
432
432
  );
433
433
  };
434
- export default TableBody;
435
- export var MemoizedTableBody = /*#__PURE__*/React.memo(TableBody, function (prev, next) {
436
- return prev.table.options.data === next.table.options.data;
437
- });
434
+ export default /*#__PURE__*/React.memo(TableBody);
435
+
436
+ // export const MemoizedTableBody = React.memo(
437
+ // TableBody,
438
+ // (prev, next) => prev.table.options.data === next.table.options.data
439
+ // ) as typeof TableBody
@@ -1,12 +1,6 @@
1
- import { RowData } from '@tanstack/react-table';
2
1
  import React from 'react';
3
2
  import './tableMax.less';
4
3
  import { type TableMaxProps } from './type';
5
- declare module '@tanstack/react-table' {
6
- interface TableMeta<TData extends RowData> {
7
- updateData: (rowIndex: number, columnId: string, value: unknown) => void;
8
- }
9
- }
10
4
  export declare enum ColumnType {
11
5
  Selection = "selection-column",
12
6
  Darg = "darg-column",
@@ -15,5 +9,5 @@ export declare enum ColumnType {
15
9
  }
16
10
  export type ColumnSizing = Record<string, number>;
17
11
  export declare const CACHE_MAX_AGE: number;
18
- declare const _default: React.ForwardRefExoticComponent<TableMaxProps & React.RefAttributes<unknown>>;
12
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<TableMaxProps & React.RefAttributes<unknown>>>;
19
13
  export default _default;
@@ -26,7 +26,7 @@ import dayjs from 'dayjs';
26
26
  import { cloneDeep, debounce } from 'lodash';
27
27
  import React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
28
28
  import { useConfig } from "../ConfigProvider";
29
- import TableBody, { MemoizedTableBody } from "./TableBody";
29
+ import TableBody from "./TableBody";
30
30
  import TableHeader from "./TableHeader";
31
31
  import { InputType } from "./components/ColumnEdit";
32
32
  import { setDefaultFilterFn } from "./components/ColumnFilterV2";
@@ -47,29 +47,34 @@ export var ColumnType = /*#__PURE__*/function (ColumnType) {
47
47
  ColumnType["Expander"] = "expander";
48
48
  return ColumnType;
49
49
  }({});
50
- // export const TableContext = createContext<TableContextType>({} as TableContextType);
51
-
52
50
  export var CACHE_MAX_AGE = 1 * 60 * 60 * 1000;
53
51
  var getCurrentRouterName = function getCurrentRouterName() {
54
52
  return window.location.pathname.slice(1);
55
53
  };
54
+
55
+ /**将空默认值提升为组件外部的常量,避免引发不必要的渲染 */
56
+ var defaultData = [];
57
+ var defaultColumnVisibleConfig = {};
58
+ var defaultColumnPinningConfig = {
59
+ left: [],
60
+ right: []
61
+ };
62
+ var initSelectedRowIds = [];
63
+ var initColumnFilters = [];
56
64
  var TableMax = function TableMax(_ref) {
57
65
  var _JSON$parse, _tableContentRef$curr;
58
66
  var tableId = _ref.tableId,
59
67
  originColumns = _ref.columns,
60
68
  _ref$datas = _ref.datas,
61
- datas = _ref$datas === void 0 ? [] : _ref$datas,
69
+ datas = _ref$datas === void 0 ? defaultData : _ref$datas,
62
70
  totalCount = _ref.totalCount,
63
71
  _ref$columnVisibleCon = _ref.columnVisibleConfig,
64
- columnVisibleConfig = _ref$columnVisibleCon === void 0 ? {} : _ref$columnVisibleCon,
72
+ columnVisibleConfig = _ref$columnVisibleCon === void 0 ? defaultColumnVisibleConfig : _ref$columnVisibleCon,
65
73
  _ref$columnPinningCon = _ref.columnPinningConfig,
66
- columnPinningConfig = _ref$columnPinningCon === void 0 ? {
67
- left: [],
68
- right: []
69
- } : _ref$columnPinningCon,
74
+ columnPinningConfig = _ref$columnPinningCon === void 0 ? defaultColumnPinningConfig : _ref$columnPinningCon,
70
75
  defaultSelectedRowId = _ref.defaultSelectedRowId,
71
76
  _ref$defaultSelectedR = _ref.defaultSelectedRowIds,
72
- defaultSelectedRowIds = _ref$defaultSelectedR === void 0 ? [] : _ref$defaultSelectedR,
77
+ defaultSelectedRowIds = _ref$defaultSelectedR === void 0 ? initSelectedRowIds : _ref$defaultSelectedR,
73
78
  selectedRowChange = _ref.selectedRowChange,
74
79
  onSelectChange = _ref.onSelectChange,
75
80
  rowSelectionChange = _ref.rowSelectionChange,
@@ -142,7 +147,7 @@ var TableMax = function TableMax(_ref) {
142
147
  _ref$rowHeight = _ref.rowHeight,
143
148
  rowHeight = _ref$rowHeight === void 0 ? 42 : _ref$rowHeight,
144
149
  _ref$defaultColumnFil = _ref.defaultColumnFilters,
145
- defaultColumnFilters = _ref$defaultColumnFil === void 0 ? [] : _ref$defaultColumnFil,
150
+ defaultColumnFilters = _ref$defaultColumnFil === void 0 ? initColumnFilters : _ref$defaultColumnFil,
146
151
  getColumnFiltersData = _ref.getColumnFiltersData,
147
152
  saveEditing = _ref.saveEditing,
148
153
  _ref$getRowCanExpand = _ref.getRowCanExpand,
@@ -187,7 +192,8 @@ var TableMax = function TableMax(_ref) {
187
192
  request = _ref.request,
188
193
  onEditValueChange = _ref.onEditValueChange,
189
194
  hasTotalRow = _ref.hasTotalRow,
190
- totalDatas = _ref.totalDatas;
195
+ totalDatas = _ref.totalDatas,
196
+ pageSizeOptions = _ref.pageSizeOptions;
191
197
  var tableMaxRef = useRef(null);
192
198
  // 表格元素
193
199
  var tableContentRef = useRef(null);
@@ -204,7 +210,18 @@ var TableMax = function TableMax(_ref) {
204
210
  userId = _useConfig.userId,
205
211
  theme = _useConfig.theme,
206
212
  tableKeyPrefixCls = _useConfig.tableKeyPrefixCls,
207
- tableMaxNewPagination = _useConfig.tableMaxNewPagination;
213
+ tableMaxNewPagination = _useConfig.tableMaxNewPagination,
214
+ tableMax = _useConfig.tableMax;
215
+ var tableMaxConfig = useMemo(function () {
216
+ var _ref2 = tableMax || {},
217
+ globalPageSizeOptions = _ref2.pageSizeOptions,
218
+ cacheMaxAge = _ref2.cacheMaxAge;
219
+ return {
220
+ globalPageSizeOptions: globalPageSizeOptions,
221
+ cacheMaxAge: cacheMaxAge
222
+ };
223
+ }, [JSON.stringify(tableMax)]);
224
+
208
225
  // 多选场景下,点击行时是否选中改行。在不展示多选框(selectionWithoutChecked=true)时,会一直为true
209
226
  var selectRowWhenClick = useMemo(function () {
210
227
  return originSelectRowWhenClick || selectionWithoutChecked;
@@ -293,7 +310,8 @@ var TableMax = function TableMax(_ref) {
293
310
  tableId: tableId,
294
311
  tableKeyPrefixCls: tableKeyPrefixCls,
295
312
  columnVisibleConfig: columnVisibleConfig,
296
- tableKey: tableKey
313
+ tableKey: tableKey,
314
+ cacheMaxAge: tableMaxConfig.cacheMaxAge
297
315
  }),
298
316
  columnSizing = _useColumnWidth.columnSizing,
299
317
  initializeColumnSizing = _useColumnWidth.initializeColumnSizing,
@@ -476,9 +494,10 @@ var TableMax = function TableMax(_ref) {
476
494
 
477
495
  /**根据缓存数据设置一些状态 */
478
496
  var setColumnInfoFromCache = function setColumnInfoFromCache(tableColumns) {
479
- var _localStorage$getItem;
497
+ var _localStorage$getItem, _tableMaxConfig$cache;
480
498
  var cache = JSON.parse((_localStorage$getItem = localStorage.getItem(tableKey)) !== null && _localStorage$getItem !== void 0 ? _localStorage$getItem : '{}');
481
- if (cache && cache !== null && cache !== void 0 && cache.editTime && +new Date() - cache.editTime > CACHE_MAX_AGE) {
499
+ console.log(+cache.editTime, 'cache.editTime');
500
+ if (cache && cache !== null && cache !== void 0 && cache.editTime && +new Date() - cache.editTime > ((_tableMaxConfig$cache = tableMaxConfig.cacheMaxAge) !== null && _tableMaxConfig$cache !== void 0 ? _tableMaxConfig$cache : CACHE_MAX_AGE)) {
482
501
  return;
483
502
  }
484
503
  var cacheColumnVisibility = cache.columnVisibility,
@@ -500,7 +519,7 @@ var TableMax = function TableMax(_ref) {
500
519
  var tableColumnIds = tableColumns === null || tableColumns === void 0 ? void 0 : tableColumns.map(function (column) {
501
520
  return column.id;
502
521
  });
503
- if (cacheColumnFilters) {
522
+ if ((cacheColumnFilters === null || cacheColumnFilters === void 0 ? void 0 : cacheColumnFilters.length) > 0) {
504
523
  var newColumnFilters = (cacheColumnFilters === null || cacheColumnFilters === void 0 ? void 0 : cacheColumnFilters.filter(function (item) {
505
524
  return tableColumnIds.includes(item.id);
506
525
  })) || [];
@@ -545,8 +564,8 @@ var TableMax = function TableMax(_ref) {
545
564
  size: 40,
546
565
  tooltip: false,
547
566
  enableResizing: false,
548
- cell: function cell(_ref2) {
549
- var row = _ref2.row;
567
+ cell: function cell(_ref3) {
568
+ var row = _ref3.row;
550
569
  return row.getCanExpand() ? /*#__PURE__*/_jsx("div", {
551
570
  onClick: function onClick(evt) {
552
571
  evt.stopPropagation();
@@ -567,8 +586,8 @@ var TableMax = function TableMax(_ref) {
567
586
  id: ColumnType.Selection,
568
587
  tooltip: false,
569
588
  enableResizing: false,
570
- header: function header(_ref3) {
571
- var table = _ref3.table;
589
+ header: function header(_ref4) {
590
+ var table = _ref4.table;
572
591
  return /*#__PURE__*/_jsx(Checkbox, {
573
592
  checked: table.getIsAllRowsSelected(),
574
593
  indeterminate: table.getIsSomePageRowsSelected(),
@@ -579,9 +598,9 @@ var TableMax = function TableMax(_ref) {
579
598
  }
580
599
  });
581
600
  },
582
- cell: function cell(_ref4) {
583
- var row = _ref4.row,
584
- table = _ref4.table;
601
+ cell: function cell(_ref5) {
602
+ var row = _ref5.row,
603
+ table = _ref5.table;
585
604
  return /*#__PURE__*/_jsx(Checkbox, {
586
605
  checked: row.getIsSelected(),
587
606
  disabled: !row.getCanSelect(),
@@ -715,6 +734,7 @@ var TableMax = function TableMax(_ref) {
715
734
  /**缓存table数据 */
716
735
  useUpdateEffect(function () {
717
736
  var tableState = table.getState();
737
+ console.log(new Date(), 'new Date()');
718
738
  localStorage.setItem(tableKey, JSON.stringify({
719
739
  enableFilters: enableFilters,
720
740
  headerRowNum: headerRowNum,
@@ -725,7 +745,8 @@ var TableMax = function TableMax(_ref) {
725
745
  columnFilters: tableState.columnFilters,
726
746
  columnSorting: tableState.sorting,
727
747
  columnSizing: columnSizing,
728
- editTime: new Date()
748
+ editTime: +new Date(),
749
+ editTimeCh: dayjs().format('YYYY-MM-DD HH:mm:ss')
729
750
  }));
730
751
  }, [table.getState().columnVisibility, table.getState().columnPinning, table.getState().columnOrder, table.getState().columnFilters, table.getState().sorting, enableFilters, headerRowNum, compactMode, columnSizing]);
731
752
  var reorderRow = useCallback(function (fromDatas, toDatas) {
@@ -872,7 +893,7 @@ var TableMax = function TableMax(_ref) {
872
893
 
873
894
  // 保存编辑内容
874
895
  var save = /*#__PURE__*/function () {
875
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
896
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
876
897
  var _tableRows$find2;
877
898
  var newRow, _table$getRowModel3, tableRows, originRow;
878
899
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -895,7 +916,7 @@ var TableMax = function TableMax(_ref) {
895
916
  }, _callee);
896
917
  }));
897
918
  return function save() {
898
- return _ref5.apply(this, arguments);
919
+ return _ref6.apply(this, arguments);
899
920
  };
900
921
  }();
901
922
  var triggerSave = function triggerSave(e) {
@@ -1198,7 +1219,17 @@ var TableMax = function TableMax(_ref) {
1198
1219
  style: {
1199
1220
  width: "100%"
1200
1221
  },
1201
- children: table.getState().columnSizingInfo.isResizingColumn ? /*#__PURE__*/_jsx(MemoizedTableBody, _objectSpread({}, tableBodyProps)) : /*#__PURE__*/_jsx(TableBody, _objectSpread({}, tableBodyProps))
1222
+ onMouseEnter: function onMouseEnter() {
1223
+ var _tableBodyRef$current2;
1224
+ // 给当前元素添加hover类
1225
+ (_tableBodyRef$current2 = tableBodyRef.current) === null || _tableBodyRef$current2 === void 0 || _tableBodyRef$current2.classList.add('hover-active');
1226
+ },
1227
+ onMouseLeave: function onMouseLeave() {
1228
+ var _tableBodyRef$current3;
1229
+ // 移除当前元素的hover类
1230
+ (_tableBodyRef$current3 = tableBodyRef.current) === null || _tableBodyRef$current3 === void 0 || _tableBodyRef$current3.classList.remove('hover-active');
1231
+ },
1232
+ children: /*#__PURE__*/_jsx(TableBody, _objectSpread({}, tableBodyProps))
1202
1233
  })]
1203
1234
  })
1204
1235
  }), pagination && /*#__PURE__*/_jsx("div", {
@@ -1206,6 +1237,7 @@ var TableMax = function TableMax(_ref) {
1206
1237
  children: tableMaxNewPagination ? /*#__PURE__*/_jsx(PaginationV2, {
1207
1238
  total: totalCount,
1208
1239
  pageSize: pageSize,
1240
+ pageSizeOptions: pageSizeOptions !== null && pageSizeOptions !== void 0 ? pageSizeOptions : tableMaxConfig.globalPageSizeOptions,
1209
1241
  showLessItems: showLessItems,
1210
1242
  showSizeChanger: showSizeChanger,
1211
1243
  curPageDataNum: tableDatas.length,
@@ -1224,6 +1256,7 @@ var TableMax = function TableMax(_ref) {
1224
1256
  }
1225
1257
  }) : /*#__PURE__*/_jsx(Pagination, {
1226
1258
  pageSize: pageSize,
1259
+ pageSizeOptions: pageSizeOptions !== null && pageSizeOptions !== void 0 ? pageSizeOptions : tableMaxConfig.globalPageSizeOptions,
1227
1260
  total: totalCount,
1228
1261
  defaultPageSize: pageSize,
1229
1262
  current: (skipCount || skipCount === 0) && pageSize ? skipCount / pageSize + 1 : 0,
@@ -1249,8 +1282,11 @@ var TableMax = function TableMax(_ref) {
1249
1282
  })
1250
1283
  });
1251
1284
  };
1252
- export default /*#__PURE__*/React.forwardRef(function (props, ref) {
1285
+
1286
+ // export default React.forwardRef((props: TableMaxProps, ref) => <TableMax {...props} refInstance={ref} />);
1287
+
1288
+ export default /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (props, ref) {
1253
1289
  return /*#__PURE__*/_jsx(TableMax, _objectSpread(_objectSpread({}, props), {}, {
1254
1290
  refInstance: ref
1255
1291
  }));
1256
- });
1292
+ }));
@@ -2,9 +2,8 @@ import { DatePicker, Form, Input, InputNumber, Tooltip } from 'antd';
2
2
  import NumberRange from "./components/numberRange";
3
3
  import RemoteSelect from "./components/remoteSelect";
4
4
  import "./index.less";
5
-
6
- // 编辑组件类型
7
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
+ // 编辑组件类型
8
7
  export var InputType = /*#__PURE__*/function (InputType) {
9
8
  InputType["InputNumber"] = "InputNumber";
10
9
  InputType["NumberRange"] = "NumberRange";
@@ -13,6 +12,7 @@ export var InputType = /*#__PURE__*/function (InputType) {
13
12
  InputType["Select"] = "Select";
14
13
  return InputType;
15
14
  }({});
15
+ var defaultEditOptions = [];
16
16
  export var EditableCell = function EditableCell(_ref) {
17
17
  var _ref2;
18
18
  var editing = _ref.editing,
@@ -24,7 +24,7 @@ export var EditableCell = function EditableCell(_ref) {
24
24
  precision = _ref.precision,
25
25
  numberMin = _ref.numberMin,
26
26
  _ref$editOptions = _ref.editOptions,
27
- editOptions = _ref$editOptions === void 0 ? [] : _ref$editOptions,
27
+ editOptions = _ref$editOptions === void 0 ? defaultEditOptions : _ref$editOptions,
28
28
  ellipsis = _ref.ellipsis,
29
29
  columnTooltip = _ref.tooltip,
30
30
  tableTooltip = _ref.tableTooltip,
@@ -10,7 +10,7 @@
10
10
 
11
11
  .filter-panel-wrapper {
12
12
  position: fixed;
13
- // z-index: 9999;
13
+ z-index: 9999;
14
14
  border-radius: 2px;
15
15
  width: fit-content;
16
16
  height: fit-content;
@@ -1,13 +1,13 @@
1
1
  import { TableMaxColumnType } from "../../type";
2
- export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
3
- export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
4
- export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
5
- export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
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;
6
6
  declare const customSortFns: {
7
- numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
8
- stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
9
- timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
10
- numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
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;
11
11
  };
12
12
  export default customSortFns;
13
13
  export type SortFnType = keyof typeof customSortFns | undefined;
@@ -1,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["showSizeChanger", "curPageDataNum"];
2
+ var _excluded = ["showSizeChanger", "curPageDataNum", "pageSizeOptions"];
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -16,26 +16,35 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
16
  import { Pagination, Select } from 'antd';
17
17
  import "./index.less";
18
18
  import { useTranslation } from "../../../../hooks/useTranslation";
19
+ import { useMemo } from 'react';
19
20
  import { jsx as _jsx } from "react/jsx-runtime";
20
21
  import { jsxs as _jsxs } from "react/jsx-runtime";
21
22
  var defaultPageSizeOptions = [10, 20, 50, 100];
22
- var pageSizeOptions = defaultPageSizeOptions.map(function (size) {
23
- return {
24
- value: size,
25
- label: size
26
- };
27
- });
23
+ // const pageSizeOptions = defaultPageSizeOptions.map(size => ({
24
+ // value: size,
25
+ // label: size,
26
+ // }));
27
+
28
28
  var PaginationV2 = function PaginationV2(props) {
29
29
  var _useTranslation = useTranslation(),
30
30
  _useTranslation2 = _slicedToArray(_useTranslation, 1),
31
31
  t = _useTranslation2[0];
32
32
  var showSizeChanger = props.showSizeChanger,
33
33
  curPageDataNum = props.curPageDataNum,
34
+ globalPageSizeOptions = props.pageSizeOptions,
34
35
  rest = _objectWithoutProperties(props, _excluded);
35
36
  var handleChangePageSize = function handleChangePageSize(size) {
36
37
  // console.log('object :>> ', size, rest.current);
37
38
  rest.onChange(rest.current, size);
38
39
  };
40
+ var pageSizeOptions = useMemo(function () {
41
+ return (globalPageSizeOptions !== null && globalPageSizeOptions !== void 0 ? globalPageSizeOptions : defaultPageSizeOptions).map(function (size) {
42
+ return {
43
+ value: size,
44
+ label: size
45
+ };
46
+ });
47
+ }, [globalPageSizeOptions, defaultPageSizeOptions]);
39
48
  return /*#__PURE__*/_jsxs("div", {
40
49
  className: "table-max-pagination-wrapper",
41
50
  children: [/*#__PURE__*/_jsx("div", {
@@ -202,7 +202,7 @@ export var useColumnWidth = function useColumnWidth(_ref) {
202
202
  allCount = _getSizeInfo.allCount,
203
203
  columnSizeMap = _getSizeInfo.columnSizeMap;
204
204
  var cache = JSON.parse((_localStorage$getItem = localStorage.getItem(tableKey)) !== null && _localStorage$getItem !== void 0 ? _localStorage$getItem : '{}');
205
- var now = Date.now();
205
+ var now = +Date.now();
206
206
  setState(produce(function (prevState) {
207
207
  // 初始化列宽映射
208
208
  var initColumnsSizeMap = _objectSpread({}, columnSizeMap);
@@ -89,30 +89,30 @@
89
89
  display: flex;
90
90
  border-radius: @global-table-max-center-border-radius;
91
91
 
92
- &:hover {
93
- .scroll {
94
- overflow: hidden auto;
95
- width: 1rem;
96
- flex-shrink: 0;
97
- scrollbar-width: thin;
98
- position: relative;
99
- background: @globalColor0;
100
- z-index: 1000;
101
- }
102
-
103
- .scroll::-webkit-scrollbar-thumb {
104
- border: 6px solid transparent;
105
- background: @scrollThumb;
106
- border-radius: 10px;
107
- background-clip: padding-box;
108
- }
109
-
110
- .scroll::-webkit-scrollbar-thumb:hover {
111
- border: 4px solid transparent;
112
- background: @scrollThumbHover;
113
- background-clip: padding-box;
114
- }
115
- }
92
+ // &:hover {
93
+ // .scroll {
94
+ // overflow: hidden auto;
95
+ // width: 1rem;
96
+ // flex-shrink: 0;
97
+ // scrollbar-width: thin;
98
+ // position: relative;
99
+ // background: @globalColor0;
100
+ // z-index: 1000;
101
+ // }
102
+
103
+ // .scroll::-webkit-scrollbar-thumb {
104
+ // border: 6px solid transparent;
105
+ // background: @scrollThumb;
106
+ // border-radius: 10px;
107
+ // background-clip: padding-box;
108
+ // }
109
+
110
+ // .scroll::-webkit-scrollbar-thumb:hover {
111
+ // border: 4px solid transparent;
112
+ // background: @scrollThumbHover;
113
+ // background-clip: padding-box;
114
+ // }
115
+ // }
116
116
 
117
117
  .table-center {
118
118
  flex: 1;
@@ -157,36 +157,38 @@
157
157
  width: 10px;
158
158
  height: 10px;
159
159
  }
160
+
161
+ &::-webkit-scrollbar-track, &::-webkit-scrollbar-corner {
162
+ background: @global-table-max-scrollbar-track !important;
163
+ }
160
164
 
161
165
  &::-webkit-scrollbar-thumb {
162
166
  border-radius: 20px;
163
167
  border: 6px solid transparent !important;
164
- background: transparent !important;
168
+ background: @scrollThumb !important;
165
169
  background-clip: padding-box !important;
166
170
  }
167
171
 
168
- &::-webkit-scrollbar-track, &::-webkit-scrollbar-corner {
169
- background: @global-table-max-scrollbar-track !important;
172
+ }
173
+ .table-body.hover-active {
174
+ &::-webkit-scrollbar-thumb {
175
+ border-radius: 20px;
176
+ border: 2px solid transparent !important;
177
+ background: @scrollThumb !important;
178
+ background-clip: padding-box !important;
170
179
  }
171
180
 
172
- &:hover {
173
- &::-webkit-scrollbar-thumb {
174
- border-radius: 20px;
175
- border: 3px solid transparent !important;
176
- background: @scrollThumb !important;
177
- background-clip: padding-box !important;
178
- }
179
-
180
- &::-webkit-scrollbar-thumb:hover {
181
- border-radius: 20px;
182
- border: 1px solid transparent !important;
183
- background: @scrollThumb !important;
184
- background-clip: padding-box !important;
185
- }
181
+ &::-webkit-scrollbar-thumb:hover {
182
+ border-radius: 20px;
183
+ border: 1px solid transparent !important;
184
+ background: @scrollThumb !important;
185
+ background-clip: padding-box !important;
186
186
  }
187
187
  }
188
188
  }
189
189
 
190
+
191
+
190
192
  .table-loading {
191
193
  display: flex;
192
194
  flex-direction: column;
@@ -316,6 +316,8 @@ export type TableMaxProps = {
316
316
  hasTotalRow?: boolean;
317
317
  /**总计行数据 { '列id': '数据' }*/
318
318
  totalDatas?: any[];
319
+ /**分页,每页多少条可选值 */
320
+ pageSizeOptions?: number[];
319
321
  };
320
322
  export interface TableMaxColumnType {
321
323
  /**每一列的id是唯一的 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arim-aisdc/public-components",
3
- "version": "2.3.25",
3
+ "version": "2.3.27",
4
4
  "description": "前端组件库",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -94,7 +94,7 @@
94
94
  "stylelint": "^14.9.1"
95
95
  },
96
96
  "peerDependencies": {
97
- "antd": "^5.21.0",
97
+ "antd": "^5.27.3",
98
98
  "react": ">=17.0.1",
99
99
  "react-dom": ">=17.0.1",
100
100
  "umi-request": "^1.4.0"