@arim-aisdc/public-components 2.3.36 → 2.3.38

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.
@@ -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 = ["open", "title", "okText", "hasfooter", "footer", "width", "height", "size", "renderContent", "handleConfirm", "handleCancel", "confirmLoading", "maskClosable", "bodyStyle", "afterClose", "enableResizing", "enableDragging", "minResizeWidth", "minResizeHeight", "maxResizeWidth", "maxResizeHeight"];
2
+ var _excluded = ["open", "title", "okText", "hasfooter", "footer", "width", "height", "size", "renderContent", "handleConfirm", "handleCancel", "confirmLoading", "maskClosable", "bodyStyle", "afterClose", "enableResizing", "enableDragging", "minResizeWidth", "minResizeHeight", "maxResizeWidth", "maxResizeHeight", "className"];
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; }
@@ -13,14 +13,14 @@ import { Rnd } from 'react-rnd';
13
13
  import "./index.less";
14
14
  import { jsx as _jsx } from "react/jsx-runtime";
15
15
  var resizeHandleClasses = {
16
- bottom: "resizeHandleBottom",
17
- bottomLeft: "resizeHandleBottomLeft",
18
- bottomRight: "resizeHandleBottomRight",
19
- left: "resizeHandleLeft",
20
- right: "resizeHandleRight",
21
- top: "resizeHandleTop",
22
- topLeft: "resizeHandleTopLeft",
23
- topRight: "resizeHandleTopRight"
16
+ bottom: 'resizeHandleBottom',
17
+ bottomLeft: 'resizeHandleBottomLeft',
18
+ bottomRight: 'resizeHandleBottomRight',
19
+ left: 'resizeHandleLeft',
20
+ right: 'resizeHandleRight',
21
+ top: 'resizeHandleTop',
22
+ topLeft: 'resizeHandleTopLeft',
23
+ topRight: 'resizeHandleTopRight'
24
24
  };
25
25
  var CenterModal = function CenterModal(_ref) {
26
26
  var _ref$open = _ref.open,
@@ -59,6 +59,7 @@ var CenterModal = function CenterModal(_ref) {
59
59
  _ref$maxResizeWidth = _ref.maxResizeWidth,
60
60
  maxResizeWidth = _ref$maxResizeWidth === void 0 ? 1800 : _ref$maxResizeWidth,
61
61
  maxResizeHeight = _ref.maxResizeHeight,
62
+ className = _ref.className,
62
63
  rest = _objectWithoutProperties(_ref, _excluded);
63
64
  var modalBodyRef = useRef(null);
64
65
  var modalBodySizeRef = useRef(null);
@@ -179,7 +180,7 @@ var CenterModal = function CenterModal(_ref) {
179
180
  }
180
181
  };
181
182
  return /*#__PURE__*/_jsx(Modal, _objectSpread(_objectSpread({
182
- className: "centerModalContainer centerModal".concat(size),
183
+ className: "centerModalContainer centerModal".concat(size, " ").concat(className || ''),
183
184
  wrapClassName: 'wrapClassName',
184
185
  title: /*#__PURE__*/_jsx("div", {
185
186
  className: "modal-header ".concat(dragHandleClassName),
@@ -325,22 +325,37 @@ var Row = function Row(_ref) {
325
325
  }
326
326
  };
327
327
  }, []);
328
-
329
- // 优化:将行渲染逻辑提取为useMemo
330
328
  var rowComMemo = useMemo(function () {
329
+ // 添加数据验证
330
+ if (!(row !== null && row !== void 0 && row.getVisibleCells)) {
331
+ console.warn('Row data not ready');
332
+ return null;
333
+ }
331
334
  var renderCell = function renderCell(cell) {
332
- var _cellClassName;
335
+ var _cell$column, _cell$getValue, _cell$getValue2, _cellClassName;
336
+ // 确保 cell.column.columnDef 存在
337
+ if (!(cell !== null && cell !== void 0 && (_cell$column = cell.column) !== null && _cell$column !== void 0 && _cell$column.columnDef)) {
338
+ console.warn('Cell column definition missing', cell);
339
+ return null;
340
+ }
333
341
  var _cell$column$columnDe = cell.column.columnDef,
334
342
  columnEditable = _cell$column$columnDe.editable,
335
343
  accessorKey = _cell$column$columnDe.accessorKey,
336
344
  header = _cell$column$columnDe.header,
337
345
  columnClassName = _cell$column$columnDe.columnClassName,
338
- id = _cell$column$columnDe.id,
346
+ columnId = _cell$column$columnDe.id,
339
347
  filterType = _cell$column$columnDe.filterType;
348
+
349
+ // 多重保障确保列ID不为undefined
350
+ var safeColumnId = columnId || accessorKey || (cell === null || cell === void 0 ? void 0 : cell.id) || "cell-".concat(Math.random().toString(36).slice(2, 9));
340
351
  var columnEditing = rowEditing && columnEditable;
341
- var rawValue = cell.getValue();
352
+ var rawValue = (_cell$getValue = (_cell$getValue2 = cell.getValue) === null || _cell$getValue2 === void 0 ? void 0 : _cell$getValue2.call(cell)) !== null && _cell$getValue !== void 0 ? _cell$getValue : '';
342
353
 
343
- // 创建增强上下文
354
+ // 检查必要的函数是否存在
355
+ if (typeof cell.getContext !== 'function') {
356
+ console.warn('cell.getContext is not a function', cell);
357
+ return null;
358
+ }
344
359
  var originalContext = cell.getContext();
345
360
  var enhancedContext = _objectSpread(_objectSpread({}, originalContext), {}, {
346
361
  getValue: function getValue() {
@@ -354,7 +369,7 @@ var Row = function Row(_ref) {
354
369
  return enhancedContext.getFormattedValue();
355
370
  }
356
371
  });
357
- 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 || (_cellClassName = cellClassName(cell)) === null || _cellClassName === void 0 ? void 0 : _cellClassName.map(function (item) {
372
+ var cellClassNames = [columnEditing ? 'tbody-tr-td-editting' : '', safeColumnId === leftLastColumnId ? 'tbody-tr-td-cell-fix-left-last' : '', safeColumnId === rightFirstColumnId ? 'tbody-tr-td-cell-fix-right-first' : '', columnClassName ? columnClassName.join(' ') : ''].concat(_toConsumableArray((cellClassName === null || cellClassName === void 0 || (_cellClassName = cellClassName(cell)) === null || _cellClassName === void 0 ? void 0 : _cellClassName.map(function (item) {
358
373
  return "".concat(item, "-").concat(theme);
359
374
  })) || []), ['tbody-tr-td']).filter(Boolean).join(' ');
360
375
  return /*#__PURE__*/_jsx("td", _objectSpread(_objectSpread({
@@ -376,23 +391,31 @@ var Row = function Row(_ref) {
376
391
  }))
377
392
  }), cell.id);
378
393
  };
379
- return /*#__PURE__*/_jsx("tr", {
380
- id: rowEditing ? "".concat(tableId, "-tbody-tr-editing") : undefined,
381
- ref: function ref(node) {
382
- dropRef(node && !editting ? node : null);
383
- dragRef(node && canRowDrag && !editting && !(disableDragRowIds !== null && disableDragRowIds !== void 0 && disableDragRowIds.includes(row.id)) ? node : null);
384
- },
385
- style: _objectSpread({
386
- opacity: isDragging || selectedRowDragging && row.getIsSelected() ? 0.5 : 1,
387
- cursor: canRowDrag && !editting && !(disableDragRowIds !== null && disableDragRowIds !== void 0 && disableDragRowIds.includes(row.id)) ? 'move' : 'auto'
388
- }, rowStyle),
389
- onClick: handleRowClick,
390
- onMouseEnter: rowMouseEnter,
391
- onMouseLeave: rowMouseLeave,
392
- className: rowClassNames,
393
- children: row.getVisibleCells().map(renderCell)
394
- });
395
- }, [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()]);
394
+ try {
395
+ var cells = row.getVisibleCells();
396
+ return /*#__PURE__*/_jsx("tr", {
397
+ id: rowEditing ? "".concat(tableId, "-tbody-tr-editing") : undefined,
398
+ ref: function ref(node) {
399
+ dropRef(node && !editting ? node : null);
400
+ dragRef(node && canRowDrag && !editting && !(disableDragRowIds !== null && disableDragRowIds !== void 0 && disableDragRowIds.includes(row.id)) ? node : null);
401
+ },
402
+ style: _objectSpread({
403
+ opacity: isDragging || selectedRowDragging && row.getIsSelected() ? 0.5 : 1,
404
+ cursor: canRowDrag && !editting && !(disableDragRowIds !== null && disableDragRowIds !== void 0 && disableDragRowIds.includes(row.id)) ? 'move' : 'auto'
405
+ }, rowStyle),
406
+ onClick: handleRowClick,
407
+ onMouseEnter: rowMouseEnter,
408
+ onMouseLeave: rowMouseLeave,
409
+ className: rowClassNames,
410
+ children: cells.map(renderCell)
411
+ });
412
+ } catch (error) {
413
+ console.error('Error rendering row:', error);
414
+ return null;
415
+ }
416
+ }, [
417
+ // 依赖项保持不变
418
+ row, row.id, 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()]);
396
419
  var rowCom = function rowCom() {
397
420
  var renderCell = function renderCell(cell) {
398
421
  var _cellClassName2;
@@ -78,4 +78,3 @@ type TableBodyPropsType = {
78
78
  };
79
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;
80
80
  export default TableBody;
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;
@@ -517,6 +517,7 @@ var TableBody = function TableBody(_ref) {
517
517
  export default TableBody;
518
518
  // export default React.memo(TableBody, (prev, next) => prev.table.getState() !== next.table.getState() );
519
519
 
520
- export var MemoizedTableBody = /*#__PURE__*/React.memo(TableBody, function (prev, next) {
521
- return prev.table.options.data === next.table.options.data;
522
- });
520
+ // export const MemoizedTableBody = React.memo(
521
+ // TableBody,
522
+ // (prev, next) => prev.table.options.data === next.table.options.data
523
+ // ) as typeof TableBody
@@ -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) => 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 | -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) => 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arim-aisdc/public-components",
3
- "version": "2.3.36",
3
+ "version": "2.3.38",
4
4
  "description": "前端组件库",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",