@arim-aisdc/public-components 2.3.37 → 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.
@@ -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 | Element | JSX.Element;
20
+ text: string | JSX.Element | Element;
21
21
  units?: string;
22
22
  width?: string;
23
23
  labelWidth?: string;
@@ -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
- var rowComMemo = useCallback(function (row) {
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,25 +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
- }, [rowEditing, tableId, editting, canRowDrag, disableDragRowIds, isDragging, selectedRowDragging, rowStyle, handleRowClick, rowMouseEnter, rowMouseLeave, rowClassNames, leftLastColumnId, rightFirstColumnId, cellClassName, theme, rowHeight, table, handleCellRightClick, getCellProps, tableTooltip, onEditValueChange, dateFormat
396
- // row, row.getVisibleCells(), row.getIsSelected(), row.getValue(), row.renderValue()
397
- ]);
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()]);
398
419
  var rowCom = function rowCom() {
399
420
  var renderCell = function renderCell(cell) {
400
421
  var _cellClassName2;
@@ -471,8 +492,8 @@ var Row = function Row(_ref) {
471
492
  getPopupContainer: function getPopupContainer() {
472
493
  return tableBodyRef.current || document.body;
473
494
  },
474
- children: openMemo ? rowComMemo(row) : rowCom()
475
- })) : openMemo ? rowComMemo(row) : rowCom(), row.getIsExpanded() && /*#__PURE__*/_jsx("tr", {
495
+ children: openMemo ? rowComMemo : rowCom()
496
+ })) : openMemo ? rowComMemo : rowCom(), row.getIsExpanded() && /*#__PURE__*/_jsx("tr", {
476
497
  className: "tbody-tr-subrow",
477
498
  children: /*#__PURE__*/_jsx("td", {
478
499
  colSpan: row.getVisibleCells().length,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arim-aisdc/public-components",
3
- "version": "2.3.37",
3
+ "version": "2.3.38",
4
4
  "description": "前端组件库",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",