@hi-ui/table 5.0.0-canary.6 → 5.0.0-canary.8
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/CHANGELOG.md +51 -0
- package/lib/cjs/hooks/use-col-width.js +24 -20
- package/lib/cjs/utils/index.js +11 -4
- package/lib/esm/hooks/use-col-width.js +22 -18
- package/lib/esm/utils/index.js +11 -4
- package/lib/types/types.d.ts +5 -1
- package/lib/types/utils/index.d.ts +4 -1
- package/package.json +34 -34
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# @hi-ui/table
|
|
2
2
|
|
|
3
|
+
## 5.0.0-canary.8
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ca7a945fe: feat(table): TableColumnItem 类型增加 minWidth 参数 (#3216)
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [756473045]
|
|
12
|
+
- Updated dependencies [b4cecde83]
|
|
13
|
+
- @hi-ui/scrollbar@5.0.0-canary.3
|
|
14
|
+
- @hi-ui/button@5.0.0-canary.6
|
|
15
|
+
|
|
16
|
+
## 5.0.0-canary.7
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- chore: rebase master (5.0)
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
- @hi-ui/core@5.0.0-canary.2
|
|
23
|
+
- @hi-ui/use-cache@5.0.0-canary.2
|
|
24
|
+
- @hi-ui/use-check@5.0.0-canary.2
|
|
25
|
+
- @hi-ui/use-check-state@5.0.0-canary.2
|
|
26
|
+
- @hi-ui/use-drag-sorter@5.0.0-canary.2
|
|
27
|
+
- @hi-ui/use-latest@5.0.0-canary.2
|
|
28
|
+
- @hi-ui/use-toggle@5.0.0-canary.2
|
|
29
|
+
- @hi-ui/use-uncontrolled-state@5.0.0-canary.2
|
|
30
|
+
- @hi-ui/use-update-effect@5.0.0-canary.2
|
|
31
|
+
- @hi-ui/icons@5.0.0-canary.2
|
|
32
|
+
- @hi-ui/button@5.0.0-canary.5
|
|
33
|
+
- @hi-ui/checkbox@5.0.0-canary.2
|
|
34
|
+
- @hi-ui/drawer@5.0.0-canary.4
|
|
35
|
+
- @hi-ui/empty-state@5.0.0-canary.2
|
|
36
|
+
- @hi-ui/icon-button@5.0.0-canary.2
|
|
37
|
+
- @hi-ui/loading@5.0.0-canary.2
|
|
38
|
+
- @hi-ui/pagination@5.0.0-canary.4
|
|
39
|
+
- @hi-ui/popper@5.0.0-canary.3
|
|
40
|
+
- @hi-ui/scrollbar@5.0.0-canary.2
|
|
41
|
+
- @hi-ui/select@5.0.0-canary.7
|
|
42
|
+
- @hi-ui/spinner@5.0.0-canary.2
|
|
43
|
+
- @hi-ui/array-utils@5.0.0-canary.2
|
|
44
|
+
- @hi-ui/classname@5.0.0-canary.2
|
|
45
|
+
- @hi-ui/dom-utils@5.0.0-canary.2
|
|
46
|
+
- @hi-ui/env@5.0.0-canary.2
|
|
47
|
+
- @hi-ui/func-utils@5.0.0-canary.2
|
|
48
|
+
- @hi-ui/object-utils@5.0.0-canary.2
|
|
49
|
+
- @hi-ui/react-utils@5.0.0-canary.2
|
|
50
|
+
- @hi-ui/times@5.0.0-canary.2
|
|
51
|
+
- @hi-ui/tree-utils@5.0.0-canary.2
|
|
52
|
+
- @hi-ui/type-assertion@5.0.0-canary.2
|
|
53
|
+
|
|
3
54
|
## 5.0.0-canary.6
|
|
4
55
|
|
|
5
56
|
### Patch Changes
|
|
@@ -31,7 +31,7 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
31
31
|
// 是否重新设置过表格每列宽度
|
|
32
32
|
var hasResetWidths = React__default["default"].useRef(false);
|
|
33
33
|
var _React$useState = React__default["default"].useState(function () {
|
|
34
|
-
return index.getGroupItemWidth(columns);
|
|
34
|
+
return index.getGroupItemWidth(columns).colWidths;
|
|
35
35
|
}),
|
|
36
36
|
colWidths = _React$useState[0],
|
|
37
37
|
setColWidths = _React$useState[1];
|
|
@@ -39,12 +39,12 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
39
39
|
if (measureRowElement && measureRowElement.childNodes) {
|
|
40
40
|
// 超出的宽度,即每列真实的宽度超出设置的宽度的总和
|
|
41
41
|
var exceedWidth = 0;
|
|
42
|
-
var _realColumnsWidth = Array.from(measureRowElement.childNodes).map(function (node, index) {
|
|
42
|
+
var _realColumnsWidth = Array.from(measureRowElement.childNodes).map(function (node, index$1) {
|
|
43
43
|
var _a;
|
|
44
44
|
var realWidth = node.getBoundingClientRect().width || 0;
|
|
45
|
-
var _ref2 = (_a = columns[index]) !== null && _a !== void 0 ? _a : {},
|
|
46
|
-
width = _ref2.width,
|
|
45
|
+
var _ref2 = (_a = columns[index$1]) !== null && _a !== void 0 ? _a : {},
|
|
47
46
|
fixed = _ref2.fixed;
|
|
47
|
+
var width = index.getGroupItemWidth(columns).colWidths[index$1];
|
|
48
48
|
// 如果该列设置了 fixed 并且真实宽度大于设置的 width 则设置为 width
|
|
49
49
|
if (fixed && width && width < realWidth) {
|
|
50
50
|
exceedWidth += realWidth - width;
|
|
@@ -71,12 +71,12 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
71
71
|
return _realColumnsWidth;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
return index.getGroupItemWidth(columns);
|
|
74
|
+
return index.getGroupItemWidth(columns).colWidths;
|
|
75
75
|
}, [columns]);
|
|
76
76
|
var getVirtualWidths = React.useCallback(function () {
|
|
77
77
|
var measureRowElement = measureRowElementRef.current;
|
|
78
78
|
if (!measureRowElement) {
|
|
79
|
-
return index.getGroupItemWidth(columns);
|
|
79
|
+
return index.getGroupItemWidth(columns).colWidths;
|
|
80
80
|
}
|
|
81
81
|
/** 虚拟滚动时,内容宽度不能用以前table自动渲染的方式获取,需要手动计算 */
|
|
82
82
|
var columnDefaultWidth = 200;
|
|
@@ -105,7 +105,7 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
105
105
|
}
|
|
106
106
|
}, [getVirtualWidths, virtual]);
|
|
107
107
|
useUpdateEffect.useUpdateEffect(function () {
|
|
108
|
-
setColWidths(index.getGroupItemWidth(columns));
|
|
108
|
+
setColWidths(index.getGroupItemWidth(columns).colWidths);
|
|
109
109
|
// setColWidths((prev) => {
|
|
110
110
|
// // resizable 模式下通过 measureRowElementRef.current 去更新列宽,防止拖拽后宽度被重置
|
|
111
111
|
// // 例如同时设置了 resizable 和 rowSelection,当拖拽某列宽度后再选中某行时,该列宽度会被重置
|
|
@@ -147,15 +147,19 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
147
147
|
setHeaderTableElement = _React$useState2[1];
|
|
148
148
|
// 控制列最小可调整宽度
|
|
149
149
|
var _React$useState3 = React__default["default"].useState([]),
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
// 当列变化时同步更新
|
|
150
|
+
minColWidths = _React$useState3[0],
|
|
151
|
+
setMinColWidths = _React$useState3[1];
|
|
152
|
+
// 当列变化时同步更新 minColWidths
|
|
153
153
|
React__default["default"].useEffect(function () {
|
|
154
154
|
var resizeObserver;
|
|
155
155
|
if (headerTableElement) {
|
|
156
156
|
resizeObserver = new ResizeObserver(function () {
|
|
157
157
|
var resizableHandlerWidth = 4;
|
|
158
|
-
var
|
|
158
|
+
var calcMinColWidths = Array.from(headerTableElement.childNodes).map(function (th, index$1) {
|
|
159
|
+
var minColWidth = index.getGroupItemWidth(columns).minColWidths[index$1];
|
|
160
|
+
if (minColWidth && minColWidth > 0) {
|
|
161
|
+
return minColWidth;
|
|
162
|
+
}
|
|
159
163
|
var thPaddingLeft = parseFloat(window.getComputedStyle(th).getPropertyValue('padding-left'));
|
|
160
164
|
var childNodes = Array.from(th.childNodes);
|
|
161
165
|
return childNodes.map(function (child) {
|
|
@@ -164,16 +168,16 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
164
168
|
return prev + next;
|
|
165
169
|
}, 0) + thPaddingLeft * 2 + resizableHandlerWidth;
|
|
166
170
|
});
|
|
167
|
-
|
|
171
|
+
setMinColWidths(calcMinColWidths);
|
|
168
172
|
});
|
|
169
173
|
resizeObserver.observe(headerTableElement);
|
|
170
174
|
} else {
|
|
171
|
-
|
|
175
|
+
setMinColWidths(Array(columns.length).fill(0));
|
|
172
176
|
}
|
|
173
177
|
return function () {
|
|
174
178
|
resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
|
|
175
179
|
};
|
|
176
|
-
}, [columns.length, headerTableElement, resizable]);
|
|
180
|
+
}, [columns, columns.length, headerTableElement, resizable]);
|
|
177
181
|
/**
|
|
178
182
|
* 控制列最小可调整宽度
|
|
179
183
|
*/
|
|
@@ -198,8 +202,8 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
198
202
|
*/
|
|
199
203
|
var onColumnResizable = React__default["default"].useCallback(function (evt, _ref3, index) {
|
|
200
204
|
var size = _ref3.size;
|
|
201
|
-
var minWidth =
|
|
202
|
-
var anotherMinWidth =
|
|
205
|
+
var minWidth = minColWidths[index];
|
|
206
|
+
var anotherMinWidth = minColWidths[index + 1];
|
|
203
207
|
var nextWidth = size.width > minWidth ? size.width : minWidth;
|
|
204
208
|
setColWidths(function (prev) {
|
|
205
209
|
var nextColWidths = [].concat(prev);
|
|
@@ -216,18 +220,18 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
216
220
|
nextColWidths[index + 1] = anotherWidth;
|
|
217
221
|
return nextColWidths;
|
|
218
222
|
});
|
|
219
|
-
}, [
|
|
223
|
+
}, [minColWidths, tableWidthAdjustOnResize]);
|
|
220
224
|
var getColgroupProps = React__default["default"].useCallback(function (column, index) {
|
|
221
225
|
var width = colWidths[index] || undefined;
|
|
226
|
+
var minWidth = minColWidths[index] || undefined;
|
|
222
227
|
return {
|
|
223
228
|
style: {
|
|
224
229
|
width: width,
|
|
225
|
-
|
|
226
|
-
minWidth: width
|
|
230
|
+
minWidth: minWidth || width
|
|
227
231
|
}
|
|
228
232
|
// 'data-hover-highlight': setAttrStatus(isHoveredCol(column.dataKey)),
|
|
229
233
|
};
|
|
230
|
-
}, [colWidths]);
|
|
234
|
+
}, [colWidths, minColWidths]);
|
|
231
235
|
return {
|
|
232
236
|
measureRowElementRef: measureRowElementRef,
|
|
233
237
|
onColumnResizable: onColumnResizable,
|
package/lib/cjs/utils/index.js
CHANGED
|
@@ -66,22 +66,29 @@ var setColumnsDefaultWidth = function setColumnsDefaultWidth(columns, defaultWid
|
|
|
66
66
|
* 如果是多级表头,将会递归 children 得到叶子结点层每项的宽度
|
|
67
67
|
*/
|
|
68
68
|
var getGroupItemWidth = function getGroupItemWidth(columns) {
|
|
69
|
-
var
|
|
69
|
+
var colWidths = [];
|
|
70
|
+
var minColWidths = [];
|
|
70
71
|
var dig = function dig(column) {
|
|
71
72
|
column.forEach(function (_ref) {
|
|
72
73
|
var children = _ref.children,
|
|
73
|
-
width = _ref.width
|
|
74
|
+
width = _ref.width,
|
|
75
|
+
minWidth = _ref.minWidth;
|
|
74
76
|
if (Array.isArray(children)) {
|
|
75
77
|
dig(children);
|
|
76
78
|
return;
|
|
77
79
|
}
|
|
78
80
|
// 如果没有设置列宽度,css 宽度默认是 `auto`,这里对于非数字 width 均设置为 0
|
|
79
81
|
var colWidth = typeAssertion.isNumeric(width) ? Number(width) : 0;
|
|
80
|
-
|
|
82
|
+
var minColWidth = typeAssertion.isNumeric(minWidth) ? Number(minWidth) : 0;
|
|
83
|
+
colWidths.push(colWidth < minColWidth ? minColWidth : colWidth);
|
|
84
|
+
minColWidths.push(minColWidth);
|
|
81
85
|
});
|
|
82
86
|
};
|
|
83
87
|
dig(columns);
|
|
84
|
-
return
|
|
88
|
+
return {
|
|
89
|
+
colWidths: colWidths,
|
|
90
|
+
minColWidths: minColWidths
|
|
91
|
+
};
|
|
85
92
|
};
|
|
86
93
|
var parseFixedColumns = function parseFixedColumns(item, index, columns, arr, key, parentStickyWidth) {
|
|
87
94
|
if (parentStickyWidth === void 0) {
|
|
@@ -19,7 +19,7 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
19
19
|
// 是否重新设置过表格每列宽度
|
|
20
20
|
var hasResetWidths = React__default.useRef(false);
|
|
21
21
|
var _React$useState = React__default.useState(function () {
|
|
22
|
-
return getGroupItemWidth(columns);
|
|
22
|
+
return getGroupItemWidth(columns).colWidths;
|
|
23
23
|
}),
|
|
24
24
|
colWidths = _React$useState[0],
|
|
25
25
|
setColWidths = _React$useState[1];
|
|
@@ -31,8 +31,8 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
31
31
|
var _a;
|
|
32
32
|
var realWidth = node.getBoundingClientRect().width || 0;
|
|
33
33
|
var _ref2 = (_a = columns[index]) !== null && _a !== void 0 ? _a : {},
|
|
34
|
-
width = _ref2.width,
|
|
35
34
|
fixed = _ref2.fixed;
|
|
35
|
+
var width = getGroupItemWidth(columns).colWidths[index];
|
|
36
36
|
// 如果该列设置了 fixed 并且真实宽度大于设置的 width 则设置为 width
|
|
37
37
|
if (fixed && width && width < realWidth) {
|
|
38
38
|
exceedWidth += realWidth - width;
|
|
@@ -59,12 +59,12 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
59
59
|
return _realColumnsWidth;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
return getGroupItemWidth(columns);
|
|
62
|
+
return getGroupItemWidth(columns).colWidths;
|
|
63
63
|
}, [columns]);
|
|
64
64
|
var getVirtualWidths = useCallback(function () {
|
|
65
65
|
var measureRowElement = measureRowElementRef.current;
|
|
66
66
|
if (!measureRowElement) {
|
|
67
|
-
return getGroupItemWidth(columns);
|
|
67
|
+
return getGroupItemWidth(columns).colWidths;
|
|
68
68
|
}
|
|
69
69
|
/** 虚拟滚动时,内容宽度不能用以前table自动渲染的方式获取,需要手动计算 */
|
|
70
70
|
var columnDefaultWidth = 200;
|
|
@@ -93,7 +93,7 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
93
93
|
}
|
|
94
94
|
}, [getVirtualWidths, virtual]);
|
|
95
95
|
useUpdateEffect(function () {
|
|
96
|
-
setColWidths(getGroupItemWidth(columns));
|
|
96
|
+
setColWidths(getGroupItemWidth(columns).colWidths);
|
|
97
97
|
// setColWidths((prev) => {
|
|
98
98
|
// // resizable 模式下通过 measureRowElementRef.current 去更新列宽,防止拖拽后宽度被重置
|
|
99
99
|
// // 例如同时设置了 resizable 和 rowSelection,当拖拽某列宽度后再选中某行时,该列宽度会被重置
|
|
@@ -135,15 +135,19 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
135
135
|
setHeaderTableElement = _React$useState2[1];
|
|
136
136
|
// 控制列最小可调整宽度
|
|
137
137
|
var _React$useState3 = React__default.useState([]),
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
// 当列变化时同步更新
|
|
138
|
+
minColWidths = _React$useState3[0],
|
|
139
|
+
setMinColWidths = _React$useState3[1];
|
|
140
|
+
// 当列变化时同步更新 minColWidths
|
|
141
141
|
React__default.useEffect(function () {
|
|
142
142
|
var resizeObserver;
|
|
143
143
|
if (headerTableElement) {
|
|
144
144
|
resizeObserver = new ResizeObserver(function () {
|
|
145
145
|
var resizableHandlerWidth = 4;
|
|
146
|
-
var
|
|
146
|
+
var calcMinColWidths = Array.from(headerTableElement.childNodes).map(function (th, index) {
|
|
147
|
+
var minColWidth = getGroupItemWidth(columns).minColWidths[index];
|
|
148
|
+
if (minColWidth && minColWidth > 0) {
|
|
149
|
+
return minColWidth;
|
|
150
|
+
}
|
|
147
151
|
var thPaddingLeft = parseFloat(window.getComputedStyle(th).getPropertyValue('padding-left'));
|
|
148
152
|
var childNodes = Array.from(th.childNodes);
|
|
149
153
|
return childNodes.map(function (child) {
|
|
@@ -152,16 +156,16 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
152
156
|
return prev + next;
|
|
153
157
|
}, 0) + thPaddingLeft * 2 + resizableHandlerWidth;
|
|
154
158
|
});
|
|
155
|
-
|
|
159
|
+
setMinColWidths(calcMinColWidths);
|
|
156
160
|
});
|
|
157
161
|
resizeObserver.observe(headerTableElement);
|
|
158
162
|
} else {
|
|
159
|
-
|
|
163
|
+
setMinColWidths(Array(columns.length).fill(0));
|
|
160
164
|
}
|
|
161
165
|
return function () {
|
|
162
166
|
resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
|
|
163
167
|
};
|
|
164
|
-
}, [columns.length, headerTableElement, resizable]);
|
|
168
|
+
}, [columns, columns.length, headerTableElement, resizable]);
|
|
165
169
|
/**
|
|
166
170
|
* 控制列最小可调整宽度
|
|
167
171
|
*/
|
|
@@ -186,8 +190,8 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
186
190
|
*/
|
|
187
191
|
var onColumnResizable = React__default.useCallback(function (evt, _ref3, index) {
|
|
188
192
|
var size = _ref3.size;
|
|
189
|
-
var minWidth =
|
|
190
|
-
var anotherMinWidth =
|
|
193
|
+
var minWidth = minColWidths[index];
|
|
194
|
+
var anotherMinWidth = minColWidths[index + 1];
|
|
191
195
|
var nextWidth = size.width > minWidth ? size.width : minWidth;
|
|
192
196
|
setColWidths(function (prev) {
|
|
193
197
|
var nextColWidths = [].concat(prev);
|
|
@@ -204,18 +208,18 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
204
208
|
nextColWidths[index + 1] = anotherWidth;
|
|
205
209
|
return nextColWidths;
|
|
206
210
|
});
|
|
207
|
-
}, [
|
|
211
|
+
}, [minColWidths, tableWidthAdjustOnResize]);
|
|
208
212
|
var getColgroupProps = React__default.useCallback(function (column, index) {
|
|
209
213
|
var width = colWidths[index] || undefined;
|
|
214
|
+
var minWidth = minColWidths[index] || undefined;
|
|
210
215
|
return {
|
|
211
216
|
style: {
|
|
212
217
|
width: width,
|
|
213
|
-
|
|
214
|
-
minWidth: width
|
|
218
|
+
minWidth: minWidth || width
|
|
215
219
|
}
|
|
216
220
|
// 'data-hover-highlight': setAttrStatus(isHoveredCol(column.dataKey)),
|
|
217
221
|
};
|
|
218
|
-
}, [colWidths]);
|
|
222
|
+
}, [colWidths, minColWidths]);
|
|
219
223
|
return {
|
|
220
224
|
measureRowElementRef: measureRowElementRef,
|
|
221
225
|
onColumnResizable: onColumnResizable,
|
package/lib/esm/utils/index.js
CHANGED
|
@@ -61,22 +61,29 @@ var setColumnsDefaultWidth = function setColumnsDefaultWidth(columns, defaultWid
|
|
|
61
61
|
* 如果是多级表头,将会递归 children 得到叶子结点层每项的宽度
|
|
62
62
|
*/
|
|
63
63
|
var getGroupItemWidth = function getGroupItemWidth(columns) {
|
|
64
|
-
var
|
|
64
|
+
var colWidths = [];
|
|
65
|
+
var minColWidths = [];
|
|
65
66
|
var dig = function dig(column) {
|
|
66
67
|
column.forEach(function (_ref) {
|
|
67
68
|
var children = _ref.children,
|
|
68
|
-
width = _ref.width
|
|
69
|
+
width = _ref.width,
|
|
70
|
+
minWidth = _ref.minWidth;
|
|
69
71
|
if (Array.isArray(children)) {
|
|
70
72
|
dig(children);
|
|
71
73
|
return;
|
|
72
74
|
}
|
|
73
75
|
// 如果没有设置列宽度,css 宽度默认是 `auto`,这里对于非数字 width 均设置为 0
|
|
74
76
|
var colWidth = isNumeric(width) ? Number(width) : 0;
|
|
75
|
-
|
|
77
|
+
var minColWidth = isNumeric(minWidth) ? Number(minWidth) : 0;
|
|
78
|
+
colWidths.push(colWidth < minColWidth ? minColWidth : colWidth);
|
|
79
|
+
minColWidths.push(minColWidth);
|
|
76
80
|
});
|
|
77
81
|
};
|
|
78
82
|
dig(columns);
|
|
79
|
-
return
|
|
83
|
+
return {
|
|
84
|
+
colWidths: colWidths,
|
|
85
|
+
minColWidths: minColWidths
|
|
86
|
+
};
|
|
80
87
|
};
|
|
81
88
|
var parseFixedColumns = function parseFixedColumns(item, index, columns, arr, key, parentStickyWidth) {
|
|
82
89
|
if (parentStickyWidth === void 0) {
|
package/lib/types/types.d.ts
CHANGED
|
@@ -95,7 +95,11 @@ export declare type TableColumnItem = {
|
|
|
95
95
|
*/
|
|
96
96
|
width?: number;
|
|
97
97
|
/**
|
|
98
|
-
*
|
|
98
|
+
* 该列最小宽度
|
|
99
|
+
*/
|
|
100
|
+
minWidth?: number;
|
|
101
|
+
/**
|
|
102
|
+
* 是否固定列宽,使用场景:设置 width 后,当所有列宽总和小于表格宽度时,多的宽度会分摊到每一列上,设置 fixed 后该列不会参与多余宽度分摊。
|
|
99
103
|
*/
|
|
100
104
|
fixed?: boolean;
|
|
101
105
|
/**
|
|
@@ -6,7 +6,10 @@ export declare const setColumnsDefaultWidth: (columns: any, defaultWidth: any) =
|
|
|
6
6
|
* 获取每个 Column 的真实列宽度(排除合并列头)
|
|
7
7
|
* 如果是多级表头,将会递归 children 得到叶子结点层每项的宽度
|
|
8
8
|
*/
|
|
9
|
-
export declare const getGroupItemWidth: (columns: TableColumnItem[]) =>
|
|
9
|
+
export declare const getGroupItemWidth: (columns: TableColumnItem[]) => {
|
|
10
|
+
colWidths: number[];
|
|
11
|
+
minColWidths: number[];
|
|
12
|
+
};
|
|
10
13
|
export declare const getMaskItemsWIdth: (columns: TableColumnItem[]) => number;
|
|
11
14
|
export declare const parseFixedColumns: (item: any, index: number, columns: any[], arr: any[], key: string, parentStickyWidth?: number) => any;
|
|
12
15
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hi-ui/table",
|
|
3
|
-
"version": "5.0.0-canary.
|
|
3
|
+
"version": "5.0.0-canary.8",
|
|
4
4
|
"description": "A sub-package for @hi-ui/hiui.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "HiUI <mi-hiui@xiaomi.com>",
|
|
@@ -44,47 +44,47 @@
|
|
|
44
44
|
"url": "https://github.com/XiaoMi/hiui/issues"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@hi-ui/array-utils": "^5.0.0-canary.
|
|
48
|
-
"@hi-ui/button": "^5.0.0-canary.
|
|
49
|
-
"@hi-ui/checkbox": "^5.0.0-canary.
|
|
50
|
-
"@hi-ui/classname": "^5.0.0-canary.
|
|
51
|
-
"@hi-ui/dom-utils": "^5.0.0-canary.
|
|
52
|
-
"@hi-ui/drawer": "^5.0.0-canary.
|
|
53
|
-
"@hi-ui/empty-state": "^5.0.0-canary.
|
|
54
|
-
"@hi-ui/env": "^5.0.0-canary.
|
|
55
|
-
"@hi-ui/func-utils": "^5.0.0-canary.
|
|
56
|
-
"@hi-ui/icon-button": "^5.0.0-canary.
|
|
57
|
-
"@hi-ui/icons": "^5.0.0-canary.
|
|
58
|
-
"@hi-ui/loading": "^5.0.0-canary.
|
|
59
|
-
"@hi-ui/object-utils": "^5.0.0-canary.
|
|
60
|
-
"@hi-ui/pagination": "^5.0.0-canary.
|
|
61
|
-
"@hi-ui/popper": "^5.0.0-canary.
|
|
62
|
-
"@hi-ui/react-utils": "^5.0.0-canary.
|
|
63
|
-
"@hi-ui/scrollbar": "^5.0.0-canary.
|
|
64
|
-
"@hi-ui/select": "^5.0.0-canary.
|
|
65
|
-
"@hi-ui/spinner": "^5.0.0-canary.
|
|
66
|
-
"@hi-ui/times": "^5.0.0-canary.
|
|
67
|
-
"@hi-ui/tree-utils": "^5.0.0-canary.
|
|
68
|
-
"@hi-ui/type-assertion": "^5.0.0-canary.
|
|
69
|
-
"@hi-ui/use-cache": "^5.0.0-canary.
|
|
70
|
-
"@hi-ui/use-check": "^5.0.0-canary.
|
|
71
|
-
"@hi-ui/use-check-state": "^5.0.0-canary.
|
|
72
|
-
"@hi-ui/use-drag-sorter": "^5.0.0-canary.
|
|
73
|
-
"@hi-ui/use-latest": "^5.0.0-canary.
|
|
74
|
-
"@hi-ui/use-toggle": "^5.0.0-canary.
|
|
75
|
-
"@hi-ui/use-uncontrolled-state": "^5.0.0-canary.
|
|
76
|
-
"@hi-ui/use-update-effect": "^5.0.0-canary.
|
|
47
|
+
"@hi-ui/array-utils": "^5.0.0-canary.2",
|
|
48
|
+
"@hi-ui/button": "^5.0.0-canary.6",
|
|
49
|
+
"@hi-ui/checkbox": "^5.0.0-canary.2",
|
|
50
|
+
"@hi-ui/classname": "^5.0.0-canary.2",
|
|
51
|
+
"@hi-ui/dom-utils": "^5.0.0-canary.2",
|
|
52
|
+
"@hi-ui/drawer": "^5.0.0-canary.4",
|
|
53
|
+
"@hi-ui/empty-state": "^5.0.0-canary.2",
|
|
54
|
+
"@hi-ui/env": "^5.0.0-canary.2",
|
|
55
|
+
"@hi-ui/func-utils": "^5.0.0-canary.2",
|
|
56
|
+
"@hi-ui/icon-button": "^5.0.0-canary.2",
|
|
57
|
+
"@hi-ui/icons": "^5.0.0-canary.2",
|
|
58
|
+
"@hi-ui/loading": "^5.0.0-canary.2",
|
|
59
|
+
"@hi-ui/object-utils": "^5.0.0-canary.2",
|
|
60
|
+
"@hi-ui/pagination": "^5.0.0-canary.4",
|
|
61
|
+
"@hi-ui/popper": "^5.0.0-canary.3",
|
|
62
|
+
"@hi-ui/react-utils": "^5.0.0-canary.2",
|
|
63
|
+
"@hi-ui/scrollbar": "^5.0.0-canary.3",
|
|
64
|
+
"@hi-ui/select": "^5.0.0-canary.7",
|
|
65
|
+
"@hi-ui/spinner": "^5.0.0-canary.2",
|
|
66
|
+
"@hi-ui/times": "^5.0.0-canary.2",
|
|
67
|
+
"@hi-ui/tree-utils": "^5.0.0-canary.2",
|
|
68
|
+
"@hi-ui/type-assertion": "^5.0.0-canary.2",
|
|
69
|
+
"@hi-ui/use-cache": "^5.0.0-canary.2",
|
|
70
|
+
"@hi-ui/use-check": "^5.0.0-canary.2",
|
|
71
|
+
"@hi-ui/use-check-state": "^5.0.0-canary.2",
|
|
72
|
+
"@hi-ui/use-drag-sorter": "^5.0.0-canary.2",
|
|
73
|
+
"@hi-ui/use-latest": "^5.0.0-canary.2",
|
|
74
|
+
"@hi-ui/use-toggle": "^5.0.0-canary.2",
|
|
75
|
+
"@hi-ui/use-uncontrolled-state": "^5.0.0-canary.2",
|
|
76
|
+
"@hi-ui/use-update-effect": "^5.0.0-canary.2",
|
|
77
77
|
"axios": "^1.5.0",
|
|
78
78
|
"react-resizable": "^3.0.4"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
|
-
"@hi-ui/core": ">=5.0.0-canary.
|
|
81
|
+
"@hi-ui/core": ">=5.0.0-canary.2",
|
|
82
82
|
"react": ">=16.8.6",
|
|
83
83
|
"react-dom": ">=16.8.6"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"@hi-ui/core": "^5.0.0-canary.
|
|
87
|
-
"@hi-ui/core-css": "^5.0.0-canary.
|
|
86
|
+
"@hi-ui/core": "^5.0.0-canary.2",
|
|
87
|
+
"@hi-ui/core-css": "^5.0.0-canary.6",
|
|
88
88
|
"@types/react-resizable": "^1.7.4",
|
|
89
89
|
"react": "^17.0.1",
|
|
90
90
|
"react-dom": "^17.0.1"
|