@hi-ui/check-cascader 4.5.0 → 4.5.2
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 +18 -0
- package/lib/cjs/CheckCascader.js +13 -3
- package/lib/esm/CheckCascader.js +13 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @hi-ui/check-cascader
|
|
2
2
|
|
|
3
|
+
## 4.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3336](https://github.com/XiaoMi/hiui/pull/3336) [`9356e8c`](https://github.com/XiaoMi/hiui/commit/9356e8ca43ae75f2886bd5225723ee9afad501a6) Thanks [@zyprepare](https://github.com/zyprepare)! - fix(use-search-mode): 优化初次搜索逻辑 (#3335)
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`9356e8c`](https://github.com/XiaoMi/hiui/commit/9356e8ca43ae75f2886bd5225723ee9afad501a6)]:
|
|
10
|
+
- @hi-ui/use-search-mode@4.2.3
|
|
11
|
+
|
|
12
|
+
## 4.5.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#3326](https://github.com/XiaoMi/hiui/pull/3326) [`c11a132ad`](https://github.com/XiaoMi/hiui/commit/c11a132ad1bb076356752e9d0a6f40cc04c44880) Thanks [@zyprepare](https://github.com/zyprepare)! - fix(check-cascader): 修复 onChange 第三个参数返回的值和类型不匹配问题 (#3325)
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`8db6414b6`](https://github.com/XiaoMi/hiui/commit/8db6414b635ef561c7487a6f713c21a388d85739)]:
|
|
19
|
+
- @hi-ui/use-search-mode@4.2.2
|
|
20
|
+
|
|
3
21
|
## 4.5.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/lib/cjs/CheckCascader.js
CHANGED
|
@@ -119,10 +119,12 @@ var CheckCascader = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
119
119
|
return path[path.length - 1];
|
|
120
120
|
});
|
|
121
121
|
var proxyOnChange = useLatest.useLatestCallback(function (value, item, shouldChecked) {
|
|
122
|
+
var dataItemsPaths = [];
|
|
122
123
|
var itemsPaths = value.map(function (lastId) {
|
|
123
124
|
var item = flattedDataMap.get(lastId);
|
|
124
125
|
if (item) {
|
|
125
|
-
|
|
126
|
+
dataItemsPaths = treeUtils.getTopDownAncestors(item);
|
|
127
|
+
return dataItemsPaths.map(function (_ref) {
|
|
126
128
|
var id = _ref.id;
|
|
127
129
|
return id;
|
|
128
130
|
});
|
|
@@ -131,9 +133,17 @@ var CheckCascader = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
131
133
|
var idPaths = _value.find(function (item) {
|
|
132
134
|
return item[item.length - 1] === lastId;
|
|
133
135
|
});
|
|
134
|
-
|
|
136
|
+
var nextIdPaths = idPaths || [lastId];
|
|
137
|
+
// 对于匹配不到的,将 title 设置为 id 构造一个数据项
|
|
138
|
+
dataItemsPaths = dataItemsPaths.concat(nextIdPaths.map(function (id) {
|
|
139
|
+
return {
|
|
140
|
+
id: id,
|
|
141
|
+
title: id
|
|
142
|
+
};
|
|
143
|
+
}));
|
|
144
|
+
return nextIdPaths;
|
|
135
145
|
});
|
|
136
|
-
tryChangeValue(itemsPaths, item,
|
|
146
|
+
tryChangeValue(itemsPaths, item, dataItemsPaths);
|
|
137
147
|
});
|
|
138
148
|
// ************************** 搜索 ************************* //
|
|
139
149
|
// 无法做异步搜索,因为下拉菜单不能合并(因为树形数据,不知道是第几级)
|
package/lib/esm/CheckCascader.js
CHANGED
|
@@ -107,10 +107,12 @@ var CheckCascader = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
107
107
|
return path[path.length - 1];
|
|
108
108
|
});
|
|
109
109
|
var proxyOnChange = useLatestCallback(function (value, item, shouldChecked) {
|
|
110
|
+
var dataItemsPaths = [];
|
|
110
111
|
var itemsPaths = value.map(function (lastId) {
|
|
111
112
|
var item = flattedDataMap.get(lastId);
|
|
112
113
|
if (item) {
|
|
113
|
-
|
|
114
|
+
dataItemsPaths = getTopDownAncestors(item);
|
|
115
|
+
return dataItemsPaths.map(function (_ref) {
|
|
114
116
|
var id = _ref.id;
|
|
115
117
|
return id;
|
|
116
118
|
});
|
|
@@ -119,9 +121,17 @@ var CheckCascader = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
119
121
|
var idPaths = _value.find(function (item) {
|
|
120
122
|
return item[item.length - 1] === lastId;
|
|
121
123
|
});
|
|
122
|
-
|
|
124
|
+
var nextIdPaths = idPaths || [lastId];
|
|
125
|
+
// 对于匹配不到的,将 title 设置为 id 构造一个数据项
|
|
126
|
+
dataItemsPaths = dataItemsPaths.concat(nextIdPaths.map(function (id) {
|
|
127
|
+
return {
|
|
128
|
+
id: id,
|
|
129
|
+
title: id
|
|
130
|
+
};
|
|
131
|
+
}));
|
|
132
|
+
return nextIdPaths;
|
|
123
133
|
});
|
|
124
|
-
tryChangeValue(itemsPaths, item,
|
|
134
|
+
tryChangeValue(itemsPaths, item, dataItemsPaths);
|
|
125
135
|
});
|
|
126
136
|
// ************************** 搜索 ************************* //
|
|
127
137
|
// 无法做异步搜索,因为下拉菜单不能合并(因为树形数据,不知道是第几级)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hi-ui/check-cascader",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.2",
|
|
4
4
|
"description": "A sub-package for @hi-ui/hiui.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "HiUI <mi-hiui@xiaomi.com>",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@hi-ui/use-latest": "^4.0.4",
|
|
64
64
|
"@hi-ui/use-merge-refs": "^4.0.4",
|
|
65
65
|
"@hi-ui/use-outside-click": "^4.0.4",
|
|
66
|
-
"@hi-ui/use-search-mode": "^4.2.
|
|
66
|
+
"@hi-ui/use-search-mode": "^4.2.3",
|
|
67
67
|
"@hi-ui/use-toggle": "^4.0.4",
|
|
68
68
|
"@hi-ui/use-uncontrolled-state": "^4.0.4"
|
|
69
69
|
},
|