@hi-ui/tree-select 5.0.0-canary.13 → 5.0.0-canary.15
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 +25 -0
- package/lib/cjs/TreeSelect.js +11 -7
- package/lib/esm/TreeSelect.js +11 -7
- package/lib/types/TreeSelect.d.ts +10 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @hi-ui/tree-select
|
|
2
2
|
|
|
3
|
+
## 5.0.0-canary.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8f23e9322: style: 表单类组件统一调整后缀颜色、placeholder 颜色 (5.0)
|
|
8
|
+
- fe579e212: style(tree): update class names for tree node elements in SCSS (5.0)
|
|
9
|
+
- Updated dependencies [8f23e9322]
|
|
10
|
+
- Updated dependencies [b27483796]
|
|
11
|
+
- Updated dependencies [900c6c2f0]
|
|
12
|
+
- Updated dependencies [fe579e212]
|
|
13
|
+
- @hi-ui/input@5.0.0-canary.18
|
|
14
|
+
- @hi-ui/picker@5.0.0-canary.15
|
|
15
|
+
- @hi-ui/tree@5.0.0-canary.12
|
|
16
|
+
|
|
17
|
+
## 5.0.0-canary.14
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- 1fae66f2d: feat(tree): add shouldShowSwitcher prop for custom switcher display logic (#3471)
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [1fae66f2d]
|
|
26
|
+
- @hi-ui/tree@5.0.0-canary.11
|
|
27
|
+
|
|
3
28
|
## 5.0.0-canary.13
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
package/lib/cjs/TreeSelect.js
CHANGED
|
@@ -45,7 +45,7 @@ var DEFAULT_EXPANDED_IDS = [];
|
|
|
45
45
|
* 树形选择器
|
|
46
46
|
*/
|
|
47
47
|
var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
48
|
-
var _b;
|
|
48
|
+
var _b, _c;
|
|
49
49
|
var _a$prefixCls = _a.prefixCls,
|
|
50
50
|
prefixCls = _a$prefixCls === void 0 ? TREE_SELECT_PREFIX : _a$prefixCls,
|
|
51
51
|
className = _a.className,
|
|
@@ -90,11 +90,13 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
90
90
|
prefix = _a.prefix,
|
|
91
91
|
suffix = _a.suffix,
|
|
92
92
|
customRender = _a.customRender,
|
|
93
|
+
shouldShowSwitcher = _a.shouldShowSwitcher,
|
|
93
94
|
label = _a.label,
|
|
94
95
|
_a$showIndicator = _a.showIndicator,
|
|
95
96
|
showIndicator = _a$showIndicator === void 0 ? true : _a$showIndicator,
|
|
96
97
|
renderExtraHeader = _a.renderExtraHeader,
|
|
97
|
-
|
|
98
|
+
renderExtraFooter = _a.renderExtraFooter,
|
|
99
|
+
rest = tslib.__rest(_a, ["prefixCls", "role", "className", "data", "dataSource", "disabled", "visible", "onOpen", "onClose", "fieldNames", "defaultExpandAll", "expandedIds", "defaultExpandedIds", "onExpand", "defaultValue", "value", "onChange", "searchable", "searchMode", "onLoadChildren", "render", "filterOption", "keyword", "onSearch", "clearSearchOnClosed", "clearable", "onClear", "invalid", "displayRender", "placeholder", "appearance", "virtual", "itemHeight", "height", "size", "prefix", "suffix", "customRender", "shouldShowSwitcher", "label", "showIndicator", "renderExtraHeader", "renderExtraFooter"]);
|
|
98
100
|
var _useGlobalContext = core.useGlobalContext(),
|
|
99
101
|
globalSize = _useGlobalContext.size;
|
|
100
102
|
var size = (_b = sizeProp !== null && sizeProp !== void 0 ? sizeProp : globalSize) !== null && _b !== void 0 ? _b : 'md';
|
|
@@ -164,12 +166,12 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
164
166
|
setSelectedItem = _useState[1];
|
|
165
167
|
// ************************** 异步搜索 ************************* //
|
|
166
168
|
// const { loading, hasError, loadRemoteData } = useDataSource({ dataSource, validate: isArray })
|
|
167
|
-
var
|
|
169
|
+
var _d = useSearchMode.useAsyncSearch({
|
|
168
170
|
dataSource: dataSource
|
|
169
171
|
}),
|
|
170
|
-
loading =
|
|
171
|
-
hasError =
|
|
172
|
-
dataSourceStrategy = tslib.__rest(
|
|
172
|
+
loading = _d.loading,
|
|
173
|
+
hasError = _d.hasError,
|
|
174
|
+
dataSourceStrategy = tslib.__rest(_d, ["loading", "hasError"]);
|
|
173
175
|
var customSearchStrategy = useSearchMode.useTreeCustomSearch({
|
|
174
176
|
data: data,
|
|
175
177
|
filterOption: filterOption
|
|
@@ -261,6 +263,7 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
261
263
|
clearSearchOnClosed: clearSearchOnClosed,
|
|
262
264
|
loading: rest.loading !== undefined ? rest.loading : loading,
|
|
263
265
|
header: renderExtraHeader === null || renderExtraHeader === void 0 ? void 0 : renderExtraHeader(),
|
|
266
|
+
footer: (_c = rest.footer) !== null && _c !== void 0 ? _c : renderExtraFooter === null || renderExtraFooter === void 0 ? void 0 : renderExtraFooter(),
|
|
264
267
|
trigger: customRender ? customRenderContent : ( /*#__PURE__*/React__default["default"].createElement(input.MockInput, {
|
|
265
268
|
style: {
|
|
266
269
|
maxWidth: appearance === 'contained' ? '360px' : undefined
|
|
@@ -294,7 +297,8 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
294
297
|
onLoadChildren: onLoadChildren,
|
|
295
298
|
virtual: virtual,
|
|
296
299
|
itemHeight: itemHeight,
|
|
297
|
-
height: height
|
|
300
|
+
height: height,
|
|
301
|
+
shouldShowSwitcher: shouldShowSwitcher
|
|
298
302
|
}, treeProps))) : null);
|
|
299
303
|
});
|
|
300
304
|
if (env.__DEV__) {
|
package/lib/esm/TreeSelect.js
CHANGED
|
@@ -33,7 +33,7 @@ var DEFAULT_EXPANDED_IDS = [];
|
|
|
33
33
|
* 树形选择器
|
|
34
34
|
*/
|
|
35
35
|
var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
36
|
-
var _b;
|
|
36
|
+
var _b, _c;
|
|
37
37
|
var _a$prefixCls = _a.prefixCls,
|
|
38
38
|
prefixCls = _a$prefixCls === void 0 ? TREE_SELECT_PREFIX : _a$prefixCls,
|
|
39
39
|
className = _a.className,
|
|
@@ -78,11 +78,13 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
78
78
|
prefix = _a.prefix,
|
|
79
79
|
suffix = _a.suffix,
|
|
80
80
|
customRender = _a.customRender,
|
|
81
|
+
shouldShowSwitcher = _a.shouldShowSwitcher,
|
|
81
82
|
label = _a.label,
|
|
82
83
|
_a$showIndicator = _a.showIndicator,
|
|
83
84
|
showIndicator = _a$showIndicator === void 0 ? true : _a$showIndicator,
|
|
84
85
|
renderExtraHeader = _a.renderExtraHeader,
|
|
85
|
-
|
|
86
|
+
renderExtraFooter = _a.renderExtraFooter,
|
|
87
|
+
rest = __rest(_a, ["prefixCls", "role", "className", "data", "dataSource", "disabled", "visible", "onOpen", "onClose", "fieldNames", "defaultExpandAll", "expandedIds", "defaultExpandedIds", "onExpand", "defaultValue", "value", "onChange", "searchable", "searchMode", "onLoadChildren", "render", "filterOption", "keyword", "onSearch", "clearSearchOnClosed", "clearable", "onClear", "invalid", "displayRender", "placeholder", "appearance", "virtual", "itemHeight", "height", "size", "prefix", "suffix", "customRender", "shouldShowSwitcher", "label", "showIndicator", "renderExtraHeader", "renderExtraFooter"]);
|
|
86
88
|
var _useGlobalContext = useGlobalContext(),
|
|
87
89
|
globalSize = _useGlobalContext.size;
|
|
88
90
|
var size = (_b = sizeProp !== null && sizeProp !== void 0 ? sizeProp : globalSize) !== null && _b !== void 0 ? _b : 'md';
|
|
@@ -152,12 +154,12 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
152
154
|
setSelectedItem = _useState[1];
|
|
153
155
|
// ************************** 异步搜索 ************************* //
|
|
154
156
|
// const { loading, hasError, loadRemoteData } = useDataSource({ dataSource, validate: isArray })
|
|
155
|
-
var
|
|
157
|
+
var _d = useAsyncSearch({
|
|
156
158
|
dataSource: dataSource
|
|
157
159
|
}),
|
|
158
|
-
loading =
|
|
159
|
-
hasError =
|
|
160
|
-
dataSourceStrategy = __rest(
|
|
160
|
+
loading = _d.loading,
|
|
161
|
+
hasError = _d.hasError,
|
|
162
|
+
dataSourceStrategy = __rest(_d, ["loading", "hasError"]);
|
|
161
163
|
var customSearchStrategy = useTreeCustomSearch({
|
|
162
164
|
data: data,
|
|
163
165
|
filterOption: filterOption
|
|
@@ -249,6 +251,7 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
249
251
|
clearSearchOnClosed: clearSearchOnClosed,
|
|
250
252
|
loading: rest.loading !== undefined ? rest.loading : loading,
|
|
251
253
|
header: renderExtraHeader === null || renderExtraHeader === void 0 ? void 0 : renderExtraHeader(),
|
|
254
|
+
footer: (_c = rest.footer) !== null && _c !== void 0 ? _c : renderExtraFooter === null || renderExtraFooter === void 0 ? void 0 : renderExtraFooter(),
|
|
252
255
|
trigger: customRender ? customRenderContent : ( /*#__PURE__*/React.createElement(MockInput, {
|
|
253
256
|
style: {
|
|
254
257
|
maxWidth: appearance === 'contained' ? '360px' : undefined
|
|
@@ -282,7 +285,8 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
282
285
|
onLoadChildren: onLoadChildren,
|
|
283
286
|
virtual: virtual,
|
|
284
287
|
itemHeight: itemHeight,
|
|
285
|
-
height: height
|
|
288
|
+
height: height,
|
|
289
|
+
shouldShowSwitcher: shouldShowSwitcher
|
|
286
290
|
}, treeProps))) : null);
|
|
287
291
|
});
|
|
288
292
|
if (__DEV__) {
|
|
@@ -145,11 +145,20 @@ export interface TreeSelectProps extends Omit<PickerProps, 'data' | 'onChange' |
|
|
|
145
145
|
*/
|
|
146
146
|
customRender?: React.ReactNode | ((selectedItem: TreeSelectDataItem | null) => React.ReactNode);
|
|
147
147
|
/**
|
|
148
|
-
*
|
|
148
|
+
* 自定义切换器显示逻辑
|
|
149
|
+
*/
|
|
150
|
+
shouldShowSwitcher?: (node: TreeNodeEventData) => boolean;
|
|
151
|
+
/**
|
|
152
|
+
* 是否展示指示器
|
|
153
|
+
* @default true
|
|
149
154
|
*/
|
|
150
155
|
showIndicator?: boolean;
|
|
151
156
|
/**
|
|
152
157
|
* 自定义下拉菜单顶部渲染
|
|
153
158
|
*/
|
|
154
159
|
renderExtraHeader?: () => React.ReactNode;
|
|
160
|
+
/**
|
|
161
|
+
* 自定义下拉菜单底部渲染
|
|
162
|
+
*/
|
|
163
|
+
renderExtraFooter?: () => React.ReactNode;
|
|
155
164
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hi-ui/tree-select",
|
|
3
|
-
"version": "5.0.0-canary.
|
|
3
|
+
"version": "5.0.0-canary.15",
|
|
4
4
|
"description": "A sub-package for @hi-ui/hiui.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "HiUI <mi-hiui@xiaomi.com>",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"@hi-ui/func-utils": "^5.0.0-canary.2",
|
|
51
51
|
"@hi-ui/highlighter": "^5.0.0-canary.4",
|
|
52
52
|
"@hi-ui/icons": "^5.0.0-canary.8",
|
|
53
|
-
"@hi-ui/input": "^5.0.0-canary.
|
|
54
|
-
"@hi-ui/picker": "^5.0.0-canary.
|
|
53
|
+
"@hi-ui/input": "^5.0.0-canary.18",
|
|
54
|
+
"@hi-ui/picker": "^5.0.0-canary.15",
|
|
55
55
|
"@hi-ui/popper": "^5.0.0-canary.12",
|
|
56
|
-
"@hi-ui/tree": "^5.0.0-canary.
|
|
56
|
+
"@hi-ui/tree": "^5.0.0-canary.12",
|
|
57
57
|
"@hi-ui/tree-utils": "^5.0.0-canary.2",
|
|
58
58
|
"@hi-ui/type-assertion": "^5.0.0-canary.2",
|
|
59
59
|
"@hi-ui/use-data-source": "^5.0.0-canary.2",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@hi-ui/core": "^5.0.0-canary.5",
|
|
71
|
-
"@hi-ui/core-css": "^5.0.0-canary.
|
|
71
|
+
"@hi-ui/core-css": "^5.0.0-canary.10",
|
|
72
72
|
"react": "^17.0.1",
|
|
73
73
|
"react-dom": "^17.0.1"
|
|
74
74
|
}
|