linkmore-design 1.1.26 → 1.1.27-alpha.0
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/LmEditTable/DndContainer.d.ts +6 -3
- package/dist/LmEditTable/EditTable.d.ts +10 -5
- package/dist/LmEditTable/components/DraggableContainer.d.ts +10 -0
- package/dist/LmEditTable/components/QuickOpetate.d.ts +12 -0
- package/dist/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
- package/dist/LmEditTable/components/index.d.ts +16 -0
- package/dist/LmEditTable/hooks/useForkRef.d.ts +2 -0
- package/dist/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
- package/dist/LmEditTable/sortableItem.d.ts +3 -2
- package/dist/LmEditTable/util.d.ts +7 -0
- package/dist/LmEditTable/virtual/VirtualRow.d.ts +7 -0
- package/dist/LmEditTable/virtual/VirtualRowBack.d.ts +6 -0
- package/dist/LmEditTable/virtual/VirtualTable.d.ts +3 -0
- package/dist/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
- package/dist/LmEditTable/virtual/context.d.ts +13 -0
- package/dist/LmEditTable/virtual/index.d.ts +4 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.umd.js +1140 -529
- package/dist/index.umd.min.js +8 -8
- package/dist/variables.css +65 -0
- package/es/InputNumber/index.js +7 -9
- package/es/LmEditTable/DndContainer.d.ts +6 -3
- package/es/LmEditTable/DndContainer.js +70 -10
- package/es/LmEditTable/DragHandle.js +1 -1
- package/es/LmEditTable/EditTable.d.ts +10 -5
- package/es/LmEditTable/EditTable.js +352 -360
- package/es/LmEditTable/components/DraggableContainer.d.ts +10 -0
- package/es/LmEditTable/components/DraggableContainer.js +39 -0
- package/es/LmEditTable/components/QuickOpetate.d.ts +12 -0
- package/es/LmEditTable/components/QuickOpetate.js +82 -0
- package/es/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
- package/es/LmEditTable/components/bottomOpetateComponent.js +23 -0
- package/es/LmEditTable/components/index.d.ts +16 -0
- package/es/LmEditTable/components/index.js +7 -0
- package/es/LmEditTable/hooks/useForkRef.d.ts +2 -0
- package/es/LmEditTable/hooks/useForkRef.js +22 -0
- package/es/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
- package/es/LmEditTable/rowSort/DndContainerRow.js +81 -0
- package/es/LmEditTable/sortableItem.d.ts +3 -2
- package/es/LmEditTable/sortableItem.js +16 -4
- package/es/LmEditTable/sortableItemCol.js +40 -10
- package/es/LmEditTable/style/index.css +65 -0
- package/es/LmEditTable/style/variables.css +65 -0
- package/es/LmEditTable/util.d.ts +7 -0
- package/es/LmEditTable/util.js +92 -7
- package/es/LmEditTable/virtual/VirtualRow.d.ts +7 -0
- package/es/LmEditTable/virtual/VirtualRow.js +62 -0
- package/es/LmEditTable/virtual/VirtualRowBack.d.ts +6 -0
- package/es/LmEditTable/virtual/VirtualRowBack.js +100 -0
- package/es/LmEditTable/virtual/VirtualTable.d.ts +3 -0
- package/es/LmEditTable/virtual/VirtualTable.js +54 -0
- package/es/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
- package/es/LmEditTable/virtual/VirtualWrapper.js +60 -0
- package/es/LmEditTable/virtual/context.d.ts +13 -0
- package/es/LmEditTable/virtual/context.js +54 -0
- package/es/LmEditTable/virtual/index.d.ts +4 -0
- package/es/LmEditTable/virtual/index.js +4 -0
- package/es/LmFilter/filterFns/index.js +7 -2
- package/es/LmTable/virTual/VirtualRow.js +12 -14
- package/es/hooks/useEvent/index.js +1 -1
- package/es/index.d.ts +1 -2
- package/es/styles/variables.css +65 -0
- package/lib/InputNumber/index.js +9 -9
- package/lib/LmEditTable/DndContainer.d.ts +6 -3
- package/lib/LmEditTable/DndContainer.js +74 -9
- package/lib/LmEditTable/DragHandle.js +1 -1
- package/lib/LmEditTable/EditTable.d.ts +10 -5
- package/lib/LmEditTable/EditTable.js +349 -357
- package/lib/LmEditTable/components/DraggableContainer.d.ts +10 -0
- package/lib/LmEditTable/components/DraggableContainer.js +52 -0
- package/lib/LmEditTable/components/QuickOpetate.d.ts +12 -0
- package/lib/LmEditTable/components/QuickOpetate.js +96 -0
- package/lib/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
- package/lib/LmEditTable/components/bottomOpetateComponent.js +34 -0
- package/lib/LmEditTable/components/index.d.ts +16 -0
- package/lib/LmEditTable/components/index.js +37 -0
- package/lib/LmEditTable/hooks/useForkRef.d.ts +2 -0
- package/lib/LmEditTable/hooks/useForkRef.js +29 -0
- package/lib/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
- package/lib/LmEditTable/rowSort/DndContainerRow.js +99 -0
- package/lib/LmEditTable/sortableItem.d.ts +3 -2
- package/lib/LmEditTable/sortableItem.js +19 -5
- package/lib/LmEditTable/sortableItemCol.js +37 -8
- package/lib/LmEditTable/style/index.css +65 -0
- package/lib/LmEditTable/style/variables.css +65 -0
- package/lib/LmEditTable/util.d.ts +7 -0
- package/lib/LmEditTable/util.js +97 -6
- package/lib/LmEditTable/virtual/VirtualRow.d.ts +7 -0
- package/lib/LmEditTable/virtual/VirtualRow.js +78 -0
- package/lib/LmEditTable/virtual/VirtualRowBack.d.ts +6 -0
- package/lib/LmEditTable/virtual/VirtualRowBack.js +113 -0
- package/lib/LmEditTable/virtual/VirtualTable.d.ts +3 -0
- package/lib/LmEditTable/virtual/VirtualTable.js +71 -0
- package/lib/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
- package/lib/LmEditTable/virtual/VirtualWrapper.js +73 -0
- package/lib/LmEditTable/virtual/context.d.ts +13 -0
- package/lib/LmEditTable/virtual/context.js +64 -0
- package/lib/LmEditTable/virtual/index.d.ts +4 -0
- package/lib/LmEditTable/virtual/index.js +31 -0
- package/lib/LmFilter/filterFns/index.js +7 -2
- package/lib/LmTable/virTual/VirtualRow.js +12 -14
- package/lib/hooks/useEvent/index.js +1 -1
- package/lib/index.d.ts +1 -2
- package/lib/styles/variables.css +65 -0
- package/package.json +7 -9
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
width: 32px;
|
|
27
27
|
padding: 0 8px;
|
|
28
28
|
}
|
|
29
|
+
.lm_editTable_warpper .ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
|
|
30
|
+
height: 100%;
|
|
31
|
+
}
|
|
29
32
|
.lm_editTable_warpper .lm_editTable_cell {
|
|
30
33
|
cursor: pointer;
|
|
31
34
|
height: 40px;
|
|
@@ -37,6 +40,21 @@
|
|
|
37
40
|
letter-spacing: 0px;
|
|
38
41
|
color: var(--color-85);
|
|
39
42
|
}
|
|
43
|
+
.lm_editTable_warpper .lm_custom_cell_td {
|
|
44
|
+
position: relative;
|
|
45
|
+
}
|
|
46
|
+
.lm_editTable_warpper .lm_custom_cell_td.ant-table-cell-with-append {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: row;
|
|
49
|
+
flex-wrap: nowrap;
|
|
50
|
+
}
|
|
51
|
+
.lm_editTable_warpper .lm_custom_cell_td.ant-table-cell-with-append .ant-table-row-expand-icon {
|
|
52
|
+
margin-right: 8px;
|
|
53
|
+
flex: none;
|
|
54
|
+
}
|
|
55
|
+
.lm_editTable_warpper .lm_custom_cell_td > .ant-form-item {
|
|
56
|
+
flex: 1 1 auto;
|
|
57
|
+
}
|
|
40
58
|
.lm_editTable_warpper .lm_custom_cell_td .ant-form-item-control-input-content {
|
|
41
59
|
display: flex;
|
|
42
60
|
flex-direction: row;
|
|
@@ -48,6 +66,32 @@
|
|
|
48
66
|
.lm_editTable_warpper .lm_custom_cell_td .ant-table-row-expand-icon {
|
|
49
67
|
margin-top: 6px;
|
|
50
68
|
}
|
|
69
|
+
.lm_editTable_warpper .lm_custom_cell_td .quick_copy_warp {
|
|
70
|
+
font-size: 8px;
|
|
71
|
+
position: absolute;
|
|
72
|
+
left: calc(50% - 10px);
|
|
73
|
+
z-index: 100;
|
|
74
|
+
width: 20px;
|
|
75
|
+
height: 10px;
|
|
76
|
+
background-color: var(--color-6);
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
color: #D8D8D8;
|
|
81
|
+
}
|
|
82
|
+
.lm_editTable_warpper .lm_custom_cell_td .quick_copy_warp:hover {
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
background-color: var(--primary-color);
|
|
85
|
+
color: #fff;
|
|
86
|
+
}
|
|
87
|
+
.lm_editTable_warpper .lm_custom_cell_td .quick_copy_up {
|
|
88
|
+
top: -4px;
|
|
89
|
+
left: calc(50% - 10px);
|
|
90
|
+
}
|
|
91
|
+
.lm_editTable_warpper .lm_custom_cell_td .quick_copy_down {
|
|
92
|
+
bottom: -6px;
|
|
93
|
+
left: calc(50% - 10px);
|
|
94
|
+
}
|
|
51
95
|
.lm_editTable_warpper .lm_editTable_cell_edit {
|
|
52
96
|
height: 40px;
|
|
53
97
|
padding: 8px 8px !important;
|
|
@@ -59,6 +103,9 @@
|
|
|
59
103
|
.lm_editTable_warpper .lm_table_quickcopy .anticon {
|
|
60
104
|
color: var(--text-color);
|
|
61
105
|
}
|
|
106
|
+
.lm_editTable_warpper .ant-table-body {
|
|
107
|
+
scroll-behavior: smooth;
|
|
108
|
+
}
|
|
62
109
|
.lm_editTable_warpper .icon_drag {
|
|
63
110
|
color: var(--tip-text-color);
|
|
64
111
|
}
|
|
@@ -75,6 +122,9 @@
|
|
|
75
122
|
.lm_editTable_warpper .ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
|
|
76
123
|
background-color: rgba(0, 0, 0, 0.06) !important;
|
|
77
124
|
}
|
|
125
|
+
.lm_editTable_warpper .ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
|
|
126
|
+
background-color: rgba(0, 0, 0, 0.06) !important;
|
|
127
|
+
}
|
|
78
128
|
.lm_editTable_warpper .ant-picker {
|
|
79
129
|
height: 24px !important;
|
|
80
130
|
padding: 2px 8px;
|
|
@@ -118,3 +168,18 @@
|
|
|
118
168
|
.lm_table_append_add_popover .ant-popover-inner-content ul li:hover {
|
|
119
169
|
background-color: var(--color-15);
|
|
120
170
|
}
|
|
171
|
+
.lm_edittable_col_sort_item {
|
|
172
|
+
overflow: hidden;
|
|
173
|
+
}
|
|
174
|
+
.lm_editable_col_drag {
|
|
175
|
+
background-color: #fff;
|
|
176
|
+
font-size: 12px;
|
|
177
|
+
display: flex;
|
|
178
|
+
box-sizing: border-box;
|
|
179
|
+
transform: translate3d(var(--translate-x, 0), var(--translate-y, 0), 0) scaleX(var(--scale-x, 1)) scaleY(var(--scale-y, 1));
|
|
180
|
+
transform-origin: 0 0;
|
|
181
|
+
touch-action: manipulation;
|
|
182
|
+
scale: 1.05;
|
|
183
|
+
box-shadow: 0 0 0 calc(1px / var(--scale-x, 1)) rgba(63, 63, 68, 0.05), 0 1px calc(3px / var(--scale-x, 1)) 0 rgba(34, 33, 81, 0.15);
|
|
184
|
+
padding: 8px;
|
|
185
|
+
}
|
|
@@ -2,6 +2,13 @@ export declare function isObjEmpty(obj: Record<string, any>): boolean;
|
|
|
2
2
|
export declare function deepDataSourcePreKeys(dataSource: any[], rowKey: string): any;
|
|
3
3
|
export declare function isExpandRow(children: any): boolean;
|
|
4
4
|
export declare function checkRowKeyByDataSource(dataSource: any, rowKey: any): any;
|
|
5
|
+
export declare function getExpandStatus(children: any): any;
|
|
6
|
+
export declare function checkMemoShouldUploadSpecialFun(prev: any, next: any): any;
|
|
7
|
+
export declare function checkExpandIconColumnIndex({ rowSelection, sortOpen, indexCol }: {
|
|
8
|
+
rowSelection: any;
|
|
9
|
+
sortOpen: any;
|
|
10
|
+
indexCol: any;
|
|
11
|
+
}): number;
|
|
5
12
|
declare const _default: {
|
|
6
13
|
isObjEmpty: typeof isObjEmpty;
|
|
7
14
|
};
|
package/lib/LmEditTable/util.js
CHANGED
|
@@ -5,9 +5,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
+
exports.checkExpandIconColumnIndex = checkExpandIconColumnIndex;
|
|
9
|
+
exports.checkMemoShouldUploadSpecialFun = checkMemoShouldUploadSpecialFun;
|
|
8
10
|
exports.checkRowKeyByDataSource = checkRowKeyByDataSource;
|
|
9
11
|
exports.deepDataSourcePreKeys = deepDataSourcePreKeys;
|
|
10
12
|
exports.default = void 0;
|
|
13
|
+
exports.getExpandStatus = getExpandStatus;
|
|
11
14
|
exports.isExpandRow = isExpandRow;
|
|
12
15
|
exports.isObjEmpty = isObjEmpty;
|
|
13
16
|
|
|
@@ -26,19 +29,20 @@ function isObjEmpty(obj) {
|
|
|
26
29
|
function deepDataSourcePreKeys(dataSource, rowKey) {
|
|
27
30
|
var deepDataSource = [];
|
|
28
31
|
|
|
29
|
-
var eachChildren = function eachChildren(children, preKeys) {
|
|
30
|
-
children === null || children === void 0 ? void 0 : children.forEach(function (item) {
|
|
32
|
+
var eachChildren = function eachChildren(children, preKeys, deepIds) {
|
|
33
|
+
children === null || children === void 0 ? void 0 : children.forEach(function (item, index) {
|
|
31
34
|
deepDataSource.push(Object.assign(Object.assign({}, item), {
|
|
32
|
-
preKeys: [].concat((0, _toConsumableArray2.default)(preKeys), [item === null || item === void 0 ? void 0 : item[rowKey]])
|
|
35
|
+
preKeys: [].concat((0, _toConsumableArray2.default)(preKeys), [item === null || item === void 0 ? void 0 : item[rowKey]]),
|
|
36
|
+
_deepIds: [].concat((0, _toConsumableArray2.default)(deepIds), [index + 1])
|
|
33
37
|
}));
|
|
34
38
|
|
|
35
39
|
if (item === null || item === void 0 ? void 0 : item.children) {
|
|
36
|
-
eachChildren(item === null || item === void 0 ? void 0 : item.children, [].concat((0, _toConsumableArray2.default)(preKeys), [item === null || item === void 0 ? void 0 : item[rowKey]])); // deepDataSource.push({ ...item, preKeys: [...preKeys, item[rowKey]] })
|
|
40
|
+
eachChildren(item === null || item === void 0 ? void 0 : item.children, [].concat((0, _toConsumableArray2.default)(preKeys), [item === null || item === void 0 ? void 0 : item[rowKey]]), [].concat((0, _toConsumableArray2.default)(deepIds), [index + 1])); // deepDataSource.push({ ...item, preKeys: [...preKeys, item[rowKey]] })
|
|
37
41
|
}
|
|
38
42
|
});
|
|
39
43
|
};
|
|
40
44
|
|
|
41
|
-
eachChildren(dataSource, []);
|
|
45
|
+
eachChildren(dataSource, [], []);
|
|
42
46
|
return (0, _lodash.keyBy)(deepDataSource, rowKey);
|
|
43
47
|
}
|
|
44
48
|
|
|
@@ -72,7 +76,94 @@ function checkRowKeyByDataSource(dataSource, rowKey) {
|
|
|
72
76
|
|
|
73
77
|
return Object.assign(Object.assign({}, v), (0, _defineProperty2.default)({}, rowKey, v[rowKey] || "v".concat(idx + 1)));
|
|
74
78
|
});
|
|
75
|
-
return res;
|
|
79
|
+
return res || [];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function getExpandStatus(children) {
|
|
83
|
+
var _a, _b, _c, _d, _e;
|
|
84
|
+
|
|
85
|
+
return isExpandRow(children) ? (_e = (_d = (_c = (_b = (_a = children === null || children === void 0 ? void 0 : children[0]) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.children) === null || _c === void 0 ? void 0 : _c[1]) === null || _d === void 0 ? void 0 : _d.props) === null || _e === void 0 ? void 0 : _e['aria-label'] : '';
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function checkMemoShouldUploadSpecialFun(prev, next) {
|
|
89
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
90
|
+
|
|
91
|
+
var checkExpandStatus = getExpandStatus(prev.children) === getExpandStatus(next.children);
|
|
92
|
+
|
|
93
|
+
if (!checkExpandStatus) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
var prevCol = prev === null || prev === void 0 ? void 0 : prev.col;
|
|
98
|
+
var nextCol = next === null || next === void 0 ? void 0 : next.col;
|
|
99
|
+
/** TODO: 使用了自定义render, 是否要判断rowIndex? 这样排序之后,渲染的性能就会变差 */
|
|
100
|
+
|
|
101
|
+
if (((prevCol === null || prevCol === void 0 ? void 0 : prevCol.render) || (nextCol === null || nextCol === void 0 ? void 0 : nextCol.render)) && !(0, _lodash.isEqual)((0, _lodash.pick)(prev, ['colIndex', 'record', 'children']), (0, _lodash.pick)(next, ['colIndex', 'record', 'children']))) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (!(next === null || next === void 0 ? void 0 : next.quickOpetateClearAll) && ((next === null || next === void 0 ? void 0 : next.getLength) < 2 || (prev === null || prev === void 0 ? void 0 : prev.getLength) === 1) && (next === null || next === void 0 ? void 0 : next.dataIndex) === 'lm_edit_opetate') {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (prev.isEdit !== next.isEdit) {
|
|
110
|
+
return false;
|
|
111
|
+
} // console.log(22, prevCol?.editable === 'render', nextCol?.editable === 'render', prevCol?.componentProps, prevCol?.componentProps)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
if (((prevCol === null || prevCol === void 0 ? void 0 : prevCol.editable) === 'render' || (nextCol === null || nextCol === void 0 ? void 0 : nextCol.editable) === 'render') && (((_a = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _a === void 0 ? void 0 : _a.render) || ((_b = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _b === void 0 ? void 0 : _b.render)) && (!(0, _lodash.isEqual)((0, _lodash.omit)(prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps, ['render']), (0, _lodash.omit)(nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps, ['render'])) || !(0, _lodash.isEqual)((0, _lodash.pick)(prev, ['colIndex', 'record', 'rowIndex']), (0, _lodash.pick)(next, ['colIndex', 'record', 'rowIndex'])))) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (((prevCol === null || prevCol === void 0 ? void 0 : prevCol.fixed) || (nextCol === null || nextCol === void 0 ? void 0 : nextCol.fixed)) && !(0, _lodash.isEqual)(prev === null || prev === void 0 ? void 0 : prev.style, next === null || next === void 0 ? void 0 : next.style)) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if ((((_c = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _c === void 0 ? void 0 : _c.optionOnly) || ((_d = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _d === void 0 ? void 0 : _d.optionOnly)) && !(0, _lodash.isEqual)((_e = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _e === void 0 ? void 0 : _e.options, (_f = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _f === void 0 ? void 0 : _f.options)) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if ((((_g = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _g === void 0 ? void 0 : _g.options) || ((_h = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _h === void 0 ? void 0 : _h.options)) && !(0, _lodash.isEqual)((_j = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _j === void 0 ? void 0 : _j.options, (_k = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _k === void 0 ? void 0 : _k.options)) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (((0, _lodash.isFunction)(prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) || (0, _lodash.isFunction)(nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps)) && !(0, _lodash.isEqual)(prevCol.newOptions, nextCol.newOptions) && !(0, _lodash.isEqual)(prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps, nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps)) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (((prevCol === null || prevCol === void 0 ? void 0 : prevCol.order) || (nextCol === null || nextCol === void 0 ? void 0 : nextCol.order)) && !(0, _lodash.isEqual)(prevCol === null || prevCol === void 0 ? void 0 : prevCol.order, nextCol === null || nextCol === void 0 ? void 0 : nextCol.order)) {
|
|
135
|
+
// return isEqual(prevCol?.order, nextCol?.fixed)
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (next.className.indexOf('drag-visible') > -1) {
|
|
140
|
+
return (0, _lodash.isEqual)(prev.style, next.style);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (next.className.indexOf('ant-table-selection-column') > -1) {
|
|
144
|
+
return (0, _lodash.isEqual)((_m = (_l = prev.children) === null || _l === void 0 ? void 0 : _l[1]) === null || _m === void 0 ? void 0 : _m.props, (_p = (_o = next.children) === null || _o === void 0 ? void 0 : _o[1]) === null || _p === void 0 ? void 0 : _p.props);
|
|
145
|
+
}
|
|
146
|
+
/** 如果启用了快速复制功能,需要实时判断rowIndex与getLength */
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
if (((_q = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _q === void 0 ? void 0 : _q.quickcopy) || ((_r = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _r === void 0 ? void 0 : _r.quickcopy)) {
|
|
150
|
+
var pickProps = ['record', 'colIndex', 'rowIndex', 'getLength'];
|
|
151
|
+
var p = (0, _lodash.pick)(prev, pickProps);
|
|
152
|
+
var n = (0, _lodash.pick)(next, pickProps);
|
|
153
|
+
return (0, _lodash.isEqual)(p, n);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function checkExpandIconColumnIndex(_ref) {
|
|
160
|
+
var rowSelection = _ref.rowSelection,
|
|
161
|
+
sortOpen = _ref.sortOpen,
|
|
162
|
+
indexCol = _ref.indexCol;
|
|
163
|
+
var arr = [rowSelection, sortOpen, indexCol].filter(function (item) {
|
|
164
|
+
return !!item;
|
|
165
|
+
});
|
|
166
|
+
return arr.length;
|
|
76
167
|
}
|
|
77
168
|
|
|
78
169
|
var _default = {
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
|
|
14
|
+
var _context = require("./context");
|
|
15
|
+
|
|
16
|
+
var _useForkRef = _interopRequireDefault(require("../hooks/useForkRef"));
|
|
17
|
+
|
|
18
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
19
|
+
var t = {};
|
|
20
|
+
|
|
21
|
+
for (var p in s) {
|
|
22
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
26
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
27
|
+
}
|
|
28
|
+
return t;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
var VirtualRow = /*#__PURE__*/_react.default.memo(function (_a, ref) {
|
|
32
|
+
var children = _a.children,
|
|
33
|
+
pref = _a.pref,
|
|
34
|
+
resetProps = __rest(_a, ["children", "pref"]);
|
|
35
|
+
|
|
36
|
+
var _useStore = (0, _context.useStore)(),
|
|
37
|
+
state = _useStore.state,
|
|
38
|
+
dispatch = _useStore.dispatch;
|
|
39
|
+
|
|
40
|
+
var rowHeight = state.rowHeight,
|
|
41
|
+
totalLen = state.totalLen;
|
|
42
|
+
var trRef = (0, _react.useRef)(null); // 列长度
|
|
43
|
+
|
|
44
|
+
var columnsLen = (0, _react.useMemo)(function () {
|
|
45
|
+
var _a;
|
|
46
|
+
|
|
47
|
+
return (_a = children === null || children === void 0 ? void 0 : children.length) !== null && _a !== void 0 ? _a : 0;
|
|
48
|
+
}, [children]);
|
|
49
|
+
(0, _react.useEffect)(function () {
|
|
50
|
+
if (state.columnsLen !== columnsLen) {
|
|
51
|
+
dispatch({
|
|
52
|
+
type: 'changeColumnsLen',
|
|
53
|
+
columnsLen: columnsLen !== null && columnsLen !== void 0 ? columnsLen : 0
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}, [columnsLen, dispatch, state.columnsLen]);
|
|
57
|
+
(0, _react.useEffect)(function () {
|
|
58
|
+
var initHeight = function initHeight(tempRef) {
|
|
59
|
+
var _a, _b, _c;
|
|
60
|
+
|
|
61
|
+
if (((_a = tempRef === null || tempRef === void 0 ? void 0 : tempRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) && !rowHeight && totalLen) {
|
|
62
|
+
var tempRowHeight = (_c = (_b = tempRef === null || tempRef === void 0 ? void 0 : tempRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) !== null && _c !== void 0 ? _c : 0;
|
|
63
|
+
dispatch({
|
|
64
|
+
type: 'initHeight',
|
|
65
|
+
rowHeight: tempRowHeight
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
initHeight(trRef);
|
|
71
|
+
}, [trRef, dispatch, rowHeight, totalLen, ref]);
|
|
72
|
+
return /*#__PURE__*/_react.default.createElement("tr", Object.assign({}, resetProps, {
|
|
73
|
+
ref: (0, _useForkRef.default)(pref, trRef)
|
|
74
|
+
}), children);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
var _default = VirtualRow;
|
|
78
|
+
exports.default = _default;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _context = require("./context");
|
|
13
|
+
|
|
14
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
15
|
+
var t = {};
|
|
16
|
+
|
|
17
|
+
for (var p in s) {
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
22
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var VirtualRow = /*#__PURE__*/_react.default.memo(function (_a, ref) {
|
|
28
|
+
var children = _a.children,
|
|
29
|
+
resetProps = __rest(_a, ["children"]);
|
|
30
|
+
|
|
31
|
+
var _useStore = (0, _context.useStore)(),
|
|
32
|
+
state = _useStore.state,
|
|
33
|
+
dispatch = _useStore.dispatch,
|
|
34
|
+
instance = _useStore.instance;
|
|
35
|
+
|
|
36
|
+
var rowHeight = state.rowHeight,
|
|
37
|
+
totalLen = state.totalLen;
|
|
38
|
+
var virtualItems = instance.columnVirtual.virtualItems;
|
|
39
|
+
var trRef = (0, _react.useRef)(null); // 非固定列长度
|
|
40
|
+
|
|
41
|
+
var columnsLen = (0, _react.useMemo)(function () {
|
|
42
|
+
var _a;
|
|
43
|
+
|
|
44
|
+
return (_a = children === null || children === void 0 ? void 0 : children.filter(function (v) {
|
|
45
|
+
var _a, _b;
|
|
46
|
+
|
|
47
|
+
return typeof ((_a = v.props) === null || _a === void 0 ? void 0 : _a.fixLeft) !== 'number' && typeof ((_b = v.props) === null || _b === void 0 ? void 0 : _b.fixRight) !== 'number';
|
|
48
|
+
}).length) !== null && _a !== void 0 ? _a : 0;
|
|
49
|
+
}, [children]);
|
|
50
|
+
(0, _react.useEffect)(function () {
|
|
51
|
+
if (state.columnsLen !== columnsLen) {
|
|
52
|
+
dispatch({
|
|
53
|
+
type: 'changeColumnsLen',
|
|
54
|
+
columnsLen: columnsLen !== null && columnsLen !== void 0 ? columnsLen : 0
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}, [columnsLen, dispatch, state.columnsLen]);
|
|
58
|
+
(0, _react.useEffect)(function () {
|
|
59
|
+
var initHeight = function initHeight(tempRef) {
|
|
60
|
+
var _a, _b, _c;
|
|
61
|
+
|
|
62
|
+
if (((_a = tempRef === null || tempRef === void 0 ? void 0 : tempRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) && !rowHeight && totalLen) {
|
|
63
|
+
var tempRowHeight = (_c = (_b = tempRef === null || tempRef === void 0 ? void 0 : tempRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) !== null && _c !== void 0 ? _c : 0;
|
|
64
|
+
dispatch({
|
|
65
|
+
type: 'initHeight',
|
|
66
|
+
rowHeight: tempRowHeight
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
initHeight(Object.prototype.hasOwnProperty.call(ref, 'current') ? ref : trRef);
|
|
72
|
+
}, [trRef, dispatch, rowHeight, totalLen, ref]); // return {fixedLeft: [], fixedRight: [], columns: []}
|
|
73
|
+
|
|
74
|
+
var fixedColumns = (0, _react.useMemo)(function () {
|
|
75
|
+
return children === null || children === void 0 ? void 0 : children.reduce(function (pre, cur) {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
|
|
78
|
+
if (typeof ((_a = cur.props) === null || _a === void 0 ? void 0 : _a.fixLeft) === 'number') {
|
|
79
|
+
pre.fixedLeft.push(cur);
|
|
80
|
+
return pre;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (typeof ((_b = cur.props) === null || _b === void 0 ? void 0 : _b.fixRight) === 'number') {
|
|
84
|
+
pre.fixedRight.push(cur);
|
|
85
|
+
return pre;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
pre.columns.push(cur);
|
|
89
|
+
return pre;
|
|
90
|
+
}, {
|
|
91
|
+
fixedLeft: [],
|
|
92
|
+
fixedRight: [],
|
|
93
|
+
columns: []
|
|
94
|
+
});
|
|
95
|
+
}, [children]); // 横向单元格合并
|
|
96
|
+
|
|
97
|
+
var colSpan = (0, _react.useMemo)(function () {
|
|
98
|
+
var _a;
|
|
99
|
+
|
|
100
|
+
return (_a = virtualItems[0]) === null || _a === void 0 ? void 0 : _a.index;
|
|
101
|
+
}, [virtualItems]);
|
|
102
|
+
console.log('virtualItems', virtualItems);
|
|
103
|
+
return /*#__PURE__*/_react.default.createElement("tr", Object.assign({}, resetProps, {
|
|
104
|
+
ref: Object.prototype.hasOwnProperty.call(ref, 'current') ? ref : trRef
|
|
105
|
+
}), fixedColumns.fixedLeft, !!colSpan && /*#__PURE__*/_react.default.createElement("td", {
|
|
106
|
+
colSpan: colSpan
|
|
107
|
+
}), virtualItems.map(function (virtualCol) {
|
|
108
|
+
return fixedColumns.columns[virtualCol.index];
|
|
109
|
+
}), fixedColumns.fixedRight);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
var _default = VirtualRow;
|
|
113
|
+
exports.default = _default;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _reactVirtual = require("react-virtual");
|
|
17
|
+
|
|
18
|
+
var _context = require("./context");
|
|
19
|
+
|
|
20
|
+
var VirtualTable = /*#__PURE__*/_react.default.memo(function (tableProps) {
|
|
21
|
+
var _a, _b, _c, _d;
|
|
22
|
+
|
|
23
|
+
var bodyRef = (0, _react.useRef)(null);
|
|
24
|
+
|
|
25
|
+
var _useRealive = (0, _context.useRealive)(),
|
|
26
|
+
_useRealive2 = (0, _slicedToArray2.default)(_useRealive, 2),
|
|
27
|
+
state = _useRealive2[0],
|
|
28
|
+
dispatch = _useRealive2[1]; // { totalSize, virtualItems }
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
var rowVirtual = (0, _reactVirtual.useVirtual)({
|
|
32
|
+
size: state.totalLen,
|
|
33
|
+
// 绑定父节点
|
|
34
|
+
parentRef: {
|
|
35
|
+
current: (_a = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.current) === null || _a === void 0 ? void 0 : _a.parentNode
|
|
36
|
+
},
|
|
37
|
+
estimateSize: _react.default.useCallback(function () {
|
|
38
|
+
return state.rowHeight;
|
|
39
|
+
}, [state.rowHeight]),
|
|
40
|
+
overscan: 5
|
|
41
|
+
});
|
|
42
|
+
var columnVirtual = (0, _reactVirtual.useVirtual)({
|
|
43
|
+
horizontal: true,
|
|
44
|
+
size: state.columnsLen,
|
|
45
|
+
parentRef: {
|
|
46
|
+
current: (_b = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.current) === null || _b === void 0 ? void 0 : _b.parentNode
|
|
47
|
+
},
|
|
48
|
+
estimateSize: _react.default.useCallback(function (i) {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
|
|
51
|
+
return (_b = (_a = tableProps === null || tableProps === void 0 ? void 0 : tableProps.children[0]) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.colWidths[i];
|
|
52
|
+
}, [(_d = (_c = tableProps.children[0]) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.colWidths]),
|
|
53
|
+
overscan: 5
|
|
54
|
+
});
|
|
55
|
+
var instance = {
|
|
56
|
+
rowVirtual: rowVirtual,
|
|
57
|
+
columnVirtual: columnVirtual
|
|
58
|
+
};
|
|
59
|
+
return /*#__PURE__*/_react.default.createElement(_context.TableContext.Provider, {
|
|
60
|
+
value: {
|
|
61
|
+
state: state,
|
|
62
|
+
dispatch: dispatch,
|
|
63
|
+
instance: instance
|
|
64
|
+
}
|
|
65
|
+
}, /*#__PURE__*/_react.default.createElement("table", Object.assign({
|
|
66
|
+
ref: bodyRef
|
|
67
|
+
}, tableProps)));
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
var _default = VirtualTable;
|
|
71
|
+
exports.default = _default;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _context = require("./context");
|
|
13
|
+
|
|
14
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
15
|
+
var t = {};
|
|
16
|
+
|
|
17
|
+
for (var p in s) {
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
22
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var VirtualWrapper = /*#__PURE__*/_react.default.memo(function (wrapperProps) {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
|
|
30
|
+
var children = wrapperProps.children,
|
|
31
|
+
resetProps = __rest(wrapperProps, ["children"]);
|
|
32
|
+
|
|
33
|
+
var _useStore = (0, _context.useStore)(),
|
|
34
|
+
state = _useStore.state,
|
|
35
|
+
dispatch = _useStore.dispatch,
|
|
36
|
+
instance = _useStore.instance;
|
|
37
|
+
|
|
38
|
+
var _instance$rowVirtual = instance.rowVirtual,
|
|
39
|
+
virtualItems = _instance$rowVirtual.virtualItems,
|
|
40
|
+
totalSize = _instance$rowVirtual.totalSize;
|
|
41
|
+
var contents = (0, _react.useMemo)(function () {
|
|
42
|
+
return children[1];
|
|
43
|
+
}, [children]);
|
|
44
|
+
var contentsLen = (0, _react.useMemo)(function () {
|
|
45
|
+
var _a;
|
|
46
|
+
|
|
47
|
+
return (_a = contents === null || contents === void 0 ? void 0 : contents.length) !== null && _a !== void 0 ? _a : 0;
|
|
48
|
+
}, [contents]);
|
|
49
|
+
(0, _react.useEffect)(function () {
|
|
50
|
+
if (state.totalLen !== contentsLen) {
|
|
51
|
+
dispatch({
|
|
52
|
+
type: 'changeTotalLen',
|
|
53
|
+
totalLen: contentsLen !== null && contentsLen !== void 0 ? contentsLen : 0
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}, [contentsLen, dispatch, state.totalLen]);
|
|
57
|
+
var paddingTop = virtualItems.length > 0 ? ((_a = virtualItems === null || virtualItems === void 0 ? void 0 : virtualItems[0]) === null || _a === void 0 ? void 0 : _a.start) || 0 : 0;
|
|
58
|
+
var paddingBottom = virtualItems.length > 0 ? totalSize - (((_b = virtualItems === null || virtualItems === void 0 ? void 0 : virtualItems[virtualItems.length - 1]) === null || _b === void 0 ? void 0 : _b.end) || 0) : 0;
|
|
59
|
+
return /*#__PURE__*/_react.default.createElement("tbody", Object.assign({}, resetProps), paddingTop > 0 && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", {
|
|
60
|
+
style: {
|
|
61
|
+
height: "".concat(paddingTop, "px")
|
|
62
|
+
}
|
|
63
|
+
})), children[0], virtualItems.map(function (virtualRow) {
|
|
64
|
+
return contents[virtualRow.index];
|
|
65
|
+
}), paddingBottom > 0 && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", {
|
|
66
|
+
style: {
|
|
67
|
+
height: "".concat(paddingBottom, "px")
|
|
68
|
+
}
|
|
69
|
+
})));
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
var _default = VirtualWrapper;
|
|
73
|
+
exports.default = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const TableContext: import("react").Context<{
|
|
3
|
+
state: any;
|
|
4
|
+
dispatch: any;
|
|
5
|
+
instance: any;
|
|
6
|
+
}>;
|
|
7
|
+
declare const useStore: () => {
|
|
8
|
+
state: any;
|
|
9
|
+
dispatch: any;
|
|
10
|
+
instance: any;
|
|
11
|
+
};
|
|
12
|
+
declare const useRealive: () => [any, import("react").Dispatch<any>];
|
|
13
|
+
export { TableContext, useStore, useRealive };
|