@arim-aisdc/public-components 2.3.31 → 2.3.32
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 |
|
|
20
|
+
text: string | JSX.Element | Element;
|
|
21
21
|
units?: string;
|
|
22
22
|
width?: string;
|
|
23
23
|
labelWidth?: string;
|
|
@@ -324,7 +324,86 @@ var Row = function Row(_ref) {
|
|
|
324
324
|
}, []);
|
|
325
325
|
|
|
326
326
|
// 优化:将行渲染逻辑提取为useMemo
|
|
327
|
-
|
|
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
407
|
var renderCell = function renderCell(cell) {
|
|
329
408
|
var _cellClassName;
|
|
330
409
|
var _cell$column$columnDe = cell.column.columnDef,
|
|
@@ -389,7 +468,7 @@ var Row = function Row(_ref) {
|
|
|
389
468
|
className: rowClassNames,
|
|
390
469
|
children: row.getVisibleCells().map(renderCell)
|
|
391
470
|
});
|
|
392
|
-
}
|
|
471
|
+
};
|
|
393
472
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
394
473
|
children: [!!getRowHoverTipConfig ? /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({}, tooltipConfig), {}, {
|
|
395
474
|
onOpenChange: onOpenChange,
|
|
@@ -400,8 +479,8 @@ var Row = function Row(_ref) {
|
|
|
400
479
|
getPopupContainer: function getPopupContainer() {
|
|
401
480
|
return tableBodyRef.current || document.body;
|
|
402
481
|
},
|
|
403
|
-
children: rowCom
|
|
404
|
-
})) : rowCom, row.getIsExpanded() && /*#__PURE__*/_jsx("tr", {
|
|
482
|
+
children: rowCom()
|
|
483
|
+
})) : rowCom(), row.getIsExpanded() && /*#__PURE__*/_jsx("tr", {
|
|
405
484
|
className: "tbody-tr-subrow",
|
|
406
485
|
children: /*#__PURE__*/_jsx("td", {
|
|
407
486
|
colSpan: row.getVisibleCells().length,
|
|
@@ -456,7 +456,6 @@ var TableMax = function TableMax(_ref) {
|
|
|
456
456
|
onExpandedChange: setExpanded,
|
|
457
457
|
sortDescFirst: true // 首次排序为递减排序,不加这个属性的话,有些列的排序会有问题
|
|
458
458
|
});
|
|
459
|
-
console.log(table, 'table');
|
|
460
459
|
|
|
461
460
|
// 暴露给外部的api
|
|
462
461
|
useImperativeHandle(refInstance, function () {
|
|
@@ -497,7 +496,6 @@ var TableMax = function TableMax(_ref) {
|
|
|
497
496
|
var setColumnInfoFromCache = function setColumnInfoFromCache(tableColumns) {
|
|
498
497
|
var _localStorage$getItem, _tableMaxConfig$cache;
|
|
499
498
|
var cache = JSON.parse((_localStorage$getItem = localStorage.getItem(tableKey)) !== null && _localStorage$getItem !== void 0 ? _localStorage$getItem : '{}');
|
|
500
|
-
console.log(+cache.editTime, 'cache.editTime');
|
|
501
499
|
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)) {
|
|
502
500
|
return;
|
|
503
501
|
}
|
|
@@ -602,7 +600,6 @@ var TableMax = function TableMax(_ref) {
|
|
|
602
600
|
cell: function cell(_ref5) {
|
|
603
601
|
var row = _ref5.row,
|
|
604
602
|
table = _ref5.table;
|
|
605
|
-
console.log("cell-check", row, table);
|
|
606
603
|
return /*#__PURE__*/_jsx(Checkbox, {
|
|
607
604
|
checked: row.getIsSelected(),
|
|
608
605
|
disabled: !row.getCanSelect(),
|
|
@@ -737,7 +734,6 @@ var TableMax = function TableMax(_ref) {
|
|
|
737
734
|
/**缓存table数据 */
|
|
738
735
|
useUpdateEffect(function () {
|
|
739
736
|
var tableState = table.getState();
|
|
740
|
-
console.log(new Date(), 'new Date()');
|
|
741
737
|
localStorage.setItem(tableKey, JSON.stringify({
|
|
742
738
|
enableFilters: enableFilters,
|
|
743
739
|
headerRowNum: headerRowNum,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { TableMaxColumnType } from "../../type";
|
|
2
|
-
export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
3
|
-
export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
4
|
-
export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
5
|
-
export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
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) =>
|
|
8
|
-
stringSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
9
|
-
timeSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
10
|
-
numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
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;
|