@hi-ui/table 4.5.3 → 4.5.4
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
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @hi-ui/table
|
|
2
2
|
|
|
3
|
+
## 4.5.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2839](https://github.com/XiaoMi/hiui/pull/2839) [`e8498f36e`](https://github.com/XiaoMi/hiui/commit/e8498f36efe4dd42e0ef26c2e4c60298e2ce0147) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复 columns 中将 title 设置为空字符串报错
|
|
8
|
+
|
|
9
|
+
- [#2840](https://github.com/XiaoMi/hiui/pull/2840) [`c2afbaf33`](https://github.com/XiaoMi/hiui/commit/c2afbaf337dc933aa3858187e0010255ee2b82d5) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复同时设置 fieldKey 和 rowSelection 时 onChange 回调参数异常问题
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`3afbf239e`](https://github.com/XiaoMi/hiui/commit/3afbf239e816ede48d6a85cbd99b6b099b8c8eb3), [`613c15a41`](https://github.com/XiaoMi/hiui/commit/613c15a41d783b86d86ccfb1dccd4da897e5ba9c), [`5d531802b`](https://github.com/XiaoMi/hiui/commit/5d531802ba9b142d448a2de2a7a8315722be0af8)]:
|
|
12
|
+
- @hi-ui/env@4.0.7
|
|
13
|
+
- @hi-ui/select@4.4.2
|
|
14
|
+
|
|
3
15
|
## 4.5.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -35,11 +35,10 @@ var useTableCheck = function useTableCheck(_ref) {
|
|
|
35
35
|
checkedRowKeys = _useUncontrolledState[0],
|
|
36
36
|
trySetCheckedRowKeys = _useUncontrolledState[1];
|
|
37
37
|
React.useEffect(function () {
|
|
38
|
-
checkedRowDataItemsRef.current = checkedRowDataItemsRef.current.filter(function (
|
|
39
|
-
|
|
40
|
-
return checkedRowKeys === null || checkedRowKeys === void 0 ? void 0 : checkedRowKeys.includes(key);
|
|
38
|
+
checkedRowDataItemsRef.current = checkedRowDataItemsRef.current.filter(function (item) {
|
|
39
|
+
return checkedRowKeys === null || checkedRowKeys === void 0 ? void 0 : checkedRowKeys.includes(item[fieldKey]);
|
|
41
40
|
});
|
|
42
|
-
}, [checkedRowKeys]);
|
|
41
|
+
}, [checkedRowKeys, fieldKey]);
|
|
43
42
|
// 已选中的行数据集合
|
|
44
43
|
var checkedRowDataItemsRef = React__default["default"].useRef([]);
|
|
45
44
|
var checkedRowDataItems = checkedRowDataItemsRef.current;
|
|
@@ -56,9 +55,8 @@ var useTableCheck = function useTableCheck(_ref) {
|
|
|
56
55
|
// 选中项变化会触发该函数
|
|
57
56
|
var onCheckedRowKeysChange = React__default["default"].useCallback(function (rowItem, checked) {
|
|
58
57
|
// 记录选中的行数据集合
|
|
59
|
-
var nextCheckedDataItems = checkedRowDataItems.filter(function (
|
|
60
|
-
|
|
61
|
-
return checkedRowKeys.includes(key);
|
|
58
|
+
var nextCheckedDataItems = checkedRowDataItems.filter(function (item) {
|
|
59
|
+
return checkedRowKeys.includes(item[fieldKey]);
|
|
62
60
|
});
|
|
63
61
|
if (checked) {
|
|
64
62
|
if (!nextCheckedDataItems.find(function (item) {
|
|
@@ -110,9 +108,8 @@ var useTableCheck = function useTableCheck(_ref) {
|
|
|
110
108
|
});
|
|
111
109
|
var checkedRowKeysSet = new Set(checkedRowKeys);
|
|
112
110
|
if (checkedAll) {
|
|
113
|
-
checkedRowDataItemsRef.current = checkedRowDataItemsRef.current.filter(function (
|
|
114
|
-
|
|
115
|
-
return !checkedRowKeysSet.has(key);
|
|
111
|
+
checkedRowDataItemsRef.current = checkedRowDataItemsRef.current.filter(function (item) {
|
|
112
|
+
return !checkedRowKeysSet.has(item[fieldKey]);
|
|
116
113
|
});
|
|
117
114
|
// 移除当前页所有行 ids
|
|
118
115
|
trySetCheckedRowKeys(function (prev) {
|
|
@@ -123,7 +120,7 @@ var useTableCheck = function useTableCheck(_ref) {
|
|
|
123
120
|
return;
|
|
124
121
|
}
|
|
125
122
|
checkedRowDataItemsRef.current = targetRowItems.concat(checkedRowDataItemsRef.current.filter(function (item) {
|
|
126
|
-
return !checkedRowKeysSet.has(item
|
|
123
|
+
return !checkedRowKeysSet.has(item[fieldKey]);
|
|
127
124
|
}));
|
|
128
125
|
trySetCheckedRowKeys(
|
|
129
126
|
// 添加当前页所有行 ids
|
|
@@ -156,7 +156,7 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
156
156
|
return child.offsetWidth;
|
|
157
157
|
}).reduce(function (prev, next) {
|
|
158
158
|
return prev + next;
|
|
159
|
-
}) + thPaddingLeft * 2 + resizableHandlerWidth;
|
|
159
|
+
}, 0) + thPaddingLeft * 2 + resizableHandlerWidth;
|
|
160
160
|
});
|
|
161
161
|
setMinColWidth(_minColWidth);
|
|
162
162
|
});
|
|
@@ -23,11 +23,10 @@ var useTableCheck = function useTableCheck(_ref) {
|
|
|
23
23
|
checkedRowKeys = _useUncontrolledState[0],
|
|
24
24
|
trySetCheckedRowKeys = _useUncontrolledState[1];
|
|
25
25
|
useEffect(function () {
|
|
26
|
-
checkedRowDataItemsRef.current = checkedRowDataItemsRef.current.filter(function (
|
|
27
|
-
|
|
28
|
-
return checkedRowKeys === null || checkedRowKeys === void 0 ? void 0 : checkedRowKeys.includes(key);
|
|
26
|
+
checkedRowDataItemsRef.current = checkedRowDataItemsRef.current.filter(function (item) {
|
|
27
|
+
return checkedRowKeys === null || checkedRowKeys === void 0 ? void 0 : checkedRowKeys.includes(item[fieldKey]);
|
|
29
28
|
});
|
|
30
|
-
}, [checkedRowKeys]);
|
|
29
|
+
}, [checkedRowKeys, fieldKey]);
|
|
31
30
|
// 已选中的行数据集合
|
|
32
31
|
var checkedRowDataItemsRef = React__default.useRef([]);
|
|
33
32
|
var checkedRowDataItems = checkedRowDataItemsRef.current;
|
|
@@ -44,9 +43,8 @@ var useTableCheck = function useTableCheck(_ref) {
|
|
|
44
43
|
// 选中项变化会触发该函数
|
|
45
44
|
var onCheckedRowKeysChange = React__default.useCallback(function (rowItem, checked) {
|
|
46
45
|
// 记录选中的行数据集合
|
|
47
|
-
var nextCheckedDataItems = checkedRowDataItems.filter(function (
|
|
48
|
-
|
|
49
|
-
return checkedRowKeys.includes(key);
|
|
46
|
+
var nextCheckedDataItems = checkedRowDataItems.filter(function (item) {
|
|
47
|
+
return checkedRowKeys.includes(item[fieldKey]);
|
|
50
48
|
});
|
|
51
49
|
if (checked) {
|
|
52
50
|
if (!nextCheckedDataItems.find(function (item) {
|
|
@@ -98,9 +96,8 @@ var useTableCheck = function useTableCheck(_ref) {
|
|
|
98
96
|
});
|
|
99
97
|
var checkedRowKeysSet = new Set(checkedRowKeys);
|
|
100
98
|
if (checkedAll) {
|
|
101
|
-
checkedRowDataItemsRef.current = checkedRowDataItemsRef.current.filter(function (
|
|
102
|
-
|
|
103
|
-
return !checkedRowKeysSet.has(key);
|
|
99
|
+
checkedRowDataItemsRef.current = checkedRowDataItemsRef.current.filter(function (item) {
|
|
100
|
+
return !checkedRowKeysSet.has(item[fieldKey]);
|
|
104
101
|
});
|
|
105
102
|
// 移除当前页所有行 ids
|
|
106
103
|
trySetCheckedRowKeys(function (prev) {
|
|
@@ -111,7 +108,7 @@ var useTableCheck = function useTableCheck(_ref) {
|
|
|
111
108
|
return;
|
|
112
109
|
}
|
|
113
110
|
checkedRowDataItemsRef.current = targetRowItems.concat(checkedRowDataItemsRef.current.filter(function (item) {
|
|
114
|
-
return !checkedRowKeysSet.has(item
|
|
111
|
+
return !checkedRowKeysSet.has(item[fieldKey]);
|
|
115
112
|
}));
|
|
116
113
|
trySetCheckedRowKeys(
|
|
117
114
|
// 添加当前页所有行 ids
|
|
@@ -144,7 +144,7 @@ var useColWidth = function useColWidth(_ref) {
|
|
|
144
144
|
return child.offsetWidth;
|
|
145
145
|
}).reduce(function (prev, next) {
|
|
146
146
|
return prev + next;
|
|
147
|
-
}) + thPaddingLeft * 2 + resizableHandlerWidth;
|
|
147
|
+
}, 0) + thPaddingLeft * 2 + resizableHandlerWidth;
|
|
148
148
|
});
|
|
149
149
|
setMinColWidth(_minColWidth);
|
|
150
150
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hi-ui/table",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.4",
|
|
4
4
|
"description": "A sub-package for @hi-ui/hiui.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "HiUI <mi-hiui@xiaomi.com>",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@hi-ui/dom-utils": "^4.0.7",
|
|
51
51
|
"@hi-ui/drawer": "^4.1.4",
|
|
52
52
|
"@hi-ui/empty-state": "^4.1.1",
|
|
53
|
-
"@hi-ui/env": "^4.0.
|
|
53
|
+
"@hi-ui/env": "^4.0.7",
|
|
54
54
|
"@hi-ui/func-utils": "^4.0.4",
|
|
55
55
|
"@hi-ui/icon-button": "^4.0.9",
|
|
56
56
|
"@hi-ui/icons": "^4.0.19",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@hi-ui/popper": "^4.1.5",
|
|
61
61
|
"@hi-ui/react-utils": "^4.0.4",
|
|
62
62
|
"@hi-ui/scrollbar": "^4.1.1",
|
|
63
|
-
"@hi-ui/select": "^4.4.
|
|
63
|
+
"@hi-ui/select": "^4.4.2",
|
|
64
64
|
"@hi-ui/spinner": "^4.0.9",
|
|
65
65
|
"@hi-ui/times": "^4.0.4",
|
|
66
66
|
"@hi-ui/tree-utils": "^4.1.6",
|