@arim-aisdc/public-components 2.3.50 → 2.3.52
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.
- package/dist/components/BaseInfo/BaseInfo.d.ts +1 -1
- package/dist/components/TableMax/TableBody/components/Total.js +2 -2
- package/dist/components/TableMax/TableHeader/VirtualTableHeader/ColGroup.js +0 -1
- package/dist/components/TableMax/TableMax.js +6 -9
- package/dist/components/TableMax/components/ColumnEdit/index.js +1 -1
- package/dist/components/TableMax/components/ColumnSort/customSortFns.d.ts +8 -8
- package/dist/components/TableMax/hooks/useColumnWidth.js +24 -2
- package/dist/components/TableMax/hooks/useVirtualCalculations.js +3 -10
- package/dist/components/TableMax/tableMax.less +3 -3
- package/package.json +1 -1
|
@@ -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 |
|
|
20
|
+
text: string | Element | JSX.Element;
|
|
21
21
|
units?: string;
|
|
22
22
|
width?: string;
|
|
23
23
|
labelWidth?: string;
|
|
@@ -50,9 +50,9 @@ export var Total = function Total(_ref2) {
|
|
|
50
50
|
};
|
|
51
51
|
var cellWrapperStyle = {
|
|
52
52
|
boxSizing: 'border-box',
|
|
53
|
+
height: "".concat(rowHeight, "px"),
|
|
53
54
|
borderTop: '1px solid var(--tableColor2)',
|
|
54
|
-
borderBottom: '1px solid var(--tableColor2)'
|
|
55
|
-
height: "100%"
|
|
55
|
+
borderBottom: '1px solid var(--tableColor2)'
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
// 统一的单元格渲染函数
|
|
@@ -18,7 +18,6 @@ export var ColGroup = function ColGroup(_ref) {
|
|
|
18
18
|
};
|
|
19
19
|
var _useVirtualConfig = useVirtualConfig(),
|
|
20
20
|
openVirtualColumns = _useVirtualConfig.openVirtualColumns;
|
|
21
|
-
console.log(scrollableColumns, rightPinnedColumns, virtualColumns, virtualPaddingLeft, virtualPaddingRight, 'leftPinnedColumns');
|
|
22
21
|
return /*#__PURE__*/_jsxs("colgroup", {
|
|
23
22
|
children: [leftPinnedColumns === null || leftPinnedColumns === void 0 ? void 0 : leftPinnedColumns.map(renderColumn), !openVirtualColumns ? scrollableColumns.map(renderColumn) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
24
23
|
children: [Number(virtualPaddingLeft) > 0 && /*#__PURE__*/_jsx("col", {
|
|
@@ -206,7 +206,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
206
206
|
_ref$openVirtualColum = _ref.openVirtualColumns,
|
|
207
207
|
openVirtualColumns = _ref$openVirtualColum === void 0 ? false : _ref$openVirtualColum,
|
|
208
208
|
_ref$openVirtualRows = _ref.openVirtualRows,
|
|
209
|
-
openVirtualRows = _ref$openVirtualRows === void 0 ?
|
|
209
|
+
openVirtualRows = _ref$openVirtualRows === void 0 ? false : _ref$openVirtualRows;
|
|
210
210
|
var tableMaxRef = useRef(null);
|
|
211
211
|
// 表格元素
|
|
212
212
|
var tableContentRef = useRef(null);
|
|
@@ -528,6 +528,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
528
528
|
setheaderRowNum(cacheHeaderRowNum);
|
|
529
529
|
}
|
|
530
530
|
setCompactMode(cacheCompactMode === true);
|
|
531
|
+
setRowHeight(cacheCompactMode === true ? compactModeRowHeight : propsRowHeight);
|
|
531
532
|
var newColumnVisibleConfig = _objectSpread(_objectSpread({}, columnVisibleConfig), cacheColumnVisibility);
|
|
532
533
|
setColumnVisibility(newColumnVisibleConfig);
|
|
533
534
|
|
|
@@ -1114,10 +1115,8 @@ var TableMax = function TableMax(_ref) {
|
|
|
1114
1115
|
};
|
|
1115
1116
|
var changeCompactMode = function changeCompactMode() {
|
|
1116
1117
|
setCompactMode(!compactMode);
|
|
1118
|
+
setRowHeight(!compactMode ? compactModeRowHeight : propsRowHeight);
|
|
1117
1119
|
};
|
|
1118
|
-
useUpdateEffect(function () {
|
|
1119
|
-
setRowHeight(compactMode ? compactModeRowHeight : propsRowHeight);
|
|
1120
|
-
}, [propsRowHeight, compactMode]);
|
|
1121
1120
|
var virtualConfig = useMemo(function () {
|
|
1122
1121
|
return {
|
|
1123
1122
|
openVirtualColumns: openVirtualColumns,
|
|
@@ -1306,15 +1305,13 @@ var TableMax = function TableMax(_ref) {
|
|
|
1306
1305
|
ref: tableContentRef
|
|
1307
1306
|
// style={{ maxHeight: !autoHeight ? defaultScrollY : 'fit-content' }}
|
|
1308
1307
|
,
|
|
1309
|
-
children: [/*#__PURE__*/
|
|
1308
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
1310
1309
|
className: "table-header-wrapper",
|
|
1311
|
-
children:
|
|
1310
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
1312
1311
|
ref: tableHeaderRef,
|
|
1313
1312
|
className: "table-header",
|
|
1314
1313
|
children: /*#__PURE__*/_jsx(TableHeader, _objectSpread({}, tableHeaderProps))
|
|
1315
|
-
})
|
|
1316
|
-
className: "table-header-scroll"
|
|
1317
|
-
})]
|
|
1314
|
+
})
|
|
1318
1315
|
}), /*#__PURE__*/_jsx("div", {
|
|
1319
1316
|
ref: tableBodyRef,
|
|
1320
1317
|
className: "table-body"
|
|
@@ -94,7 +94,7 @@ export var EditableCell = function EditableCell(_ref) {
|
|
|
94
94
|
return /*#__PURE__*/_jsx("div", {
|
|
95
95
|
className: "table-max-cell-wrapper",
|
|
96
96
|
style: {
|
|
97
|
-
width: "".concat(width, "px")
|
|
97
|
+
width: width ? "".concat(width, "px") : 'auto'
|
|
98
98
|
},
|
|
99
99
|
children: editing ? /*#__PURE__*/_jsx(Form.Item, {
|
|
100
100
|
name: dataIndex,
|
|
@@ -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) => 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) =>
|
|
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) => 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;
|
|
@@ -17,9 +17,10 @@ import { getSizeInfo } from "../utils";
|
|
|
17
17
|
|
|
18
18
|
// 可配置的常量
|
|
19
19
|
var DEFAULT_MIN_SIZE = 120;
|
|
20
|
-
var DEFAULT_MAX_SIZE =
|
|
20
|
+
var DEFAULT_MAX_SIZE = 2000;
|
|
21
21
|
var DEFAULT_RESIZE_DEBOUNCE = 200;
|
|
22
|
-
|
|
22
|
+
// const DEFAULT_TABLE_PADDING = 10;
|
|
23
|
+
var DEFAULT_TABLE_PADDING = 0;
|
|
23
24
|
/**
|
|
24
25
|
* 获取表格容器的有效宽度(减去边框)
|
|
25
26
|
*/
|
|
@@ -189,6 +190,18 @@ export var useColumnWidth = function useColumnWidth(_ref) {
|
|
|
189
190
|
result[key] = Math.min(result[key] + averageExtra, DEFAULT_MAX_SIZE);
|
|
190
191
|
});
|
|
191
192
|
}
|
|
193
|
+
|
|
194
|
+
// console.log({
|
|
195
|
+
// currentWidth,
|
|
196
|
+
// columnsSizeMap,
|
|
197
|
+
// adjustableColumns,
|
|
198
|
+
// hasWidthColumns,
|
|
199
|
+
// noWidthColumns,
|
|
200
|
+
// totalWidth,
|
|
201
|
+
// remainWidth,
|
|
202
|
+
// result
|
|
203
|
+
// }, 'hasWidthColumns')
|
|
204
|
+
|
|
192
205
|
return result;
|
|
193
206
|
}, [getAdjustableColumns, getTableWidth, state.tableContainerWidth]);
|
|
194
207
|
|
|
@@ -226,6 +239,15 @@ export var useColumnWidth = function useColumnWidth(_ref) {
|
|
|
226
239
|
});
|
|
227
240
|
}
|
|
228
241
|
|
|
242
|
+
// console.log({
|
|
243
|
+
// prevState,
|
|
244
|
+
// initColumnsSizeMap,
|
|
245
|
+
// visibleColumnsSizeMap,
|
|
246
|
+
// cache,
|
|
247
|
+
// cacheMaxAge
|
|
248
|
+
|
|
249
|
+
// }, 'columnSizeMap123')
|
|
250
|
+
|
|
229
251
|
// 计算可见列数
|
|
230
252
|
var visibleCount = allCount - Object.keys(columnVisibleConfig).filter(function (key) {
|
|
231
253
|
return !columnVisibleConfig[key];
|
|
@@ -16,18 +16,19 @@ export var useVirtualCalculations = function useVirtualCalculations(table, confi
|
|
|
16
16
|
// 列虚拟化配置
|
|
17
17
|
var columnVirtualizerConfig = useMemo(function () {
|
|
18
18
|
if (!config.openVirtualColumns) return null;
|
|
19
|
+
console.log('columnVirtualizerConfig');
|
|
19
20
|
return {
|
|
20
21
|
count: scrollableColumns.length,
|
|
21
22
|
estimateSize: function estimateSize(index) {
|
|
22
23
|
return scrollableColumns[index].getSize();
|
|
23
24
|
},
|
|
24
25
|
getScrollElement: function getScrollElement() {
|
|
25
|
-
return
|
|
26
|
+
return tableHeaderRef.current;
|
|
26
27
|
},
|
|
27
28
|
horizontal: true,
|
|
28
29
|
overscan: config.columnOverscan || 3
|
|
29
30
|
};
|
|
30
|
-
}, [config.openVirtualColumns, scrollableColumns.length, config.columnOverscan,
|
|
31
|
+
}, [config.openVirtualColumns, scrollableColumns.length, config.columnOverscan, tableHeaderRef.current]);
|
|
31
32
|
var columnVirtualizer = columnVirtualizerConfig ? useVirtualizer(columnVirtualizerConfig) : null;
|
|
32
33
|
var virtualColumns = config.openVirtualColumns ? (columnVirtualizer === null || columnVirtualizer === void 0 ? void 0 : columnVirtualizer.getVirtualItems()) || [] : [];
|
|
33
34
|
var _useMemo2 = useMemo(function () {
|
|
@@ -83,14 +84,6 @@ export var useVirtualCalculations = function useVirtualCalculations(table, confi
|
|
|
83
84
|
};
|
|
84
85
|
};
|
|
85
86
|
export var separateColumns = function separateColumns(table, openVirtualColumns) {
|
|
86
|
-
// if (!openVirtualColumns) {
|
|
87
|
-
// return {
|
|
88
|
-
// leftPinnedColumns: [],
|
|
89
|
-
// rightPinnedColumns: [],
|
|
90
|
-
// scrollableColumns: visibleColumns,
|
|
91
|
-
// };
|
|
92
|
-
// }
|
|
93
|
-
|
|
94
87
|
return {
|
|
95
88
|
leftPinnedColumns: table.getLeftVisibleLeafColumns(),
|
|
96
89
|
rightPinnedColumns: table.getRightVisibleLeafColumns(),
|
|
@@ -134,11 +134,11 @@
|
|
|
134
134
|
overflow: hidden;
|
|
135
135
|
box-sizing: border-box;
|
|
136
136
|
height: fit-content;
|
|
137
|
-
width: calc(100% - 10px);
|
|
137
|
+
// width: calc(100% - 10px);
|
|
138
138
|
margin: 0;
|
|
139
139
|
// flex: 1;
|
|
140
140
|
justify-content: space-between;
|
|
141
|
-
|
|
141
|
+
overflow-y: scroll;
|
|
142
142
|
.cell-wapper {
|
|
143
143
|
line-height: @global-table-max-header-cell-wapper-line-height;
|
|
144
144
|
}
|
|
@@ -290,7 +290,7 @@
|
|
|
290
290
|
line-height: 30px !important;
|
|
291
291
|
|
|
292
292
|
.table-max-cell-wrapper {
|
|
293
|
-
padding:
|
|
293
|
+
padding: 1px 2px;
|
|
294
294
|
line-height: 28px;
|
|
295
295
|
}
|
|
296
296
|
}
|