@hi-ui/tree-select 4.0.0-beta.9 → 4.0.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/lib/cjs/TreeSelect.js +32 -22
- package/lib/cjs/index.js +1 -2
- package/lib/cjs/styles/index.scss.js +3 -4
- package/lib/esm/TreeSelect.js +27 -15
- package/lib/esm/index.js +1 -2
- package/lib/esm/styles/index.scss.js +4 -6
- package/lib/types/TreeSelect.d.ts +21 -13
- package/lib/types/context.d.ts +2 -6
- package/lib/types/index.d.ts +1 -0
- package/lib/types/types.d.ts +4 -11
- package/package.json +23 -22
- package/lib/cjs/TreeSelect.js.map +0 -1
- package/lib/cjs/hooks/use-latest/lib/esm/index.js +0 -65
- package/lib/cjs/hooks/use-latest/lib/esm/index.js.map +0 -1
- package/lib/cjs/hooks/use-merge-refs/lib/esm/index.js +0 -77
- package/lib/cjs/hooks/use-merge-refs/lib/esm/index.js.map +0 -1
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/styles/index.scss.js.map +0 -1
- package/lib/cjs/ui/input/lib/esm/Input.js +0 -243
- package/lib/cjs/ui/input/lib/esm/Input.js.map +0 -1
- package/lib/cjs/ui/input/lib/esm/MockInput.js +0 -164
- package/lib/cjs/ui/input/lib/esm/MockInput.js.map +0 -1
- package/lib/cjs/ui/input/lib/esm/styles/index.scss.js +0 -32
- package/lib/cjs/ui/input/lib/esm/styles/index.scss.js.map +0 -1
- package/lib/cjs/ui/input/lib/esm/use-input.js +0 -139
- package/lib/cjs/ui/input/lib/esm/use-input.js.map +0 -1
- package/lib/cjs/ui/input/lib/esm/utils/index.js +0 -202
- package/lib/cjs/ui/input/lib/esm/utils/index.js.map +0 -1
- package/lib/cjs/utils/dom-utils/lib/esm/index.js +0 -34
- package/lib/cjs/utils/dom-utils/lib/esm/index.js.map +0 -1
- package/lib/esm/TreeSelect.js.map +0 -1
- package/lib/esm/hooks/use-latest/lib/esm/index.js +0 -57
- package/lib/esm/hooks/use-latest/lib/esm/index.js.map +0 -1
- package/lib/esm/hooks/use-merge-refs/lib/esm/index.js +0 -69
- package/lib/esm/hooks/use-merge-refs/lib/esm/index.js.map +0 -1
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/styles/index.scss.js.map +0 -1
- package/lib/esm/ui/input/lib/esm/Input.js +0 -219
- package/lib/esm/ui/input/lib/esm/Input.js.map +0 -1
- package/lib/esm/ui/input/lib/esm/MockInput.js +0 -142
- package/lib/esm/ui/input/lib/esm/MockInput.js.map +0 -1
- package/lib/esm/ui/input/lib/esm/styles/index.scss.js +0 -27
- package/lib/esm/ui/input/lib/esm/styles/index.scss.js.map +0 -1
- package/lib/esm/ui/input/lib/esm/use-input.js +0 -128
- package/lib/esm/ui/input/lib/esm/use-input.js.map +0 -1
- package/lib/esm/ui/input/lib/esm/utils/index.js +0 -186
- package/lib/esm/ui/input/lib/esm/utils/index.js.map +0 -1
- package/lib/esm/utils/dom-utils/lib/esm/index.js +0 -29
- package/lib/esm/utils/dom-utils/lib/esm/index.js.map +0 -1
- package/lib/types/use-tree-select.d.ts +0 -8
package/lib/cjs/TreeSelect.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* @hi-ui/tree-select
|
3
3
|
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/tree-select#readme
|
4
4
|
*
|
5
|
-
* Copyright (c)
|
5
|
+
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
6
6
|
*
|
7
7
|
* This source code is licensed under the MIT license found in the
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
@@ -39,15 +39,11 @@ var arrayUtils = require('@hi-ui/array-utils');
|
|
39
39
|
|
40
40
|
var highlighter = require('@hi-ui/highlighter');
|
41
41
|
|
42
|
-
require('
|
43
|
-
|
44
|
-
require('./ui/input/lib/esm/Input.js');
|
45
|
-
|
46
|
-
var MockInput = require('./ui/input/lib/esm/MockInput.js');
|
42
|
+
var input = require('@hi-ui/input');
|
47
43
|
|
48
44
|
var icons = require('@hi-ui/icons');
|
49
45
|
|
50
|
-
var
|
46
|
+
var core = require('@hi-ui/core');
|
51
47
|
|
52
48
|
var funcUtils = require('@hi-ui/func-utils');
|
53
49
|
|
@@ -79,6 +75,9 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
79
75
|
dataSource = _a.dataSource,
|
80
76
|
_a$disabled = _a.disabled,
|
81
77
|
disabled = _a$disabled === void 0 ? false : _a$disabled,
|
78
|
+
visible = _a.visible,
|
79
|
+
onOpen = _a.onOpen,
|
80
|
+
onClose = _a.onClose,
|
82
81
|
_a$fieldNames = _a.fieldNames,
|
83
82
|
fieldNames = _a$fieldNames === void 0 ? DEFAULT_FIELD_NAMES : _a$fieldNames,
|
84
83
|
_a$defaultExpandAll = _a.defaultExpandAll,
|
@@ -102,14 +101,22 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
102
101
|
displayRenderProp = _a.displayRender,
|
103
102
|
placeholderProp = _a.placeholder,
|
104
103
|
appearance = _a.appearance,
|
105
|
-
|
104
|
+
virtual = _a.virtual,
|
105
|
+
itemHeight = _a.itemHeight,
|
106
|
+
height = _a.height,
|
107
|
+
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", "onSearch", "clearable", "invalid", "displayRender", "placeholder", "appearance", "virtual", "itemHeight", "height"]);
|
106
108
|
|
107
|
-
var i18n =
|
109
|
+
var i18n = core.useLocaleContext();
|
108
110
|
var placeholder = typeAssertion.isUndef(placeholderProp) ? i18n.get('treeSelect.placeholder') : placeholderProp;
|
109
111
|
|
110
|
-
var
|
111
|
-
|
112
|
-
|
112
|
+
var _useUncontrolledToggl = useToggle.useUncontrolledToggle({
|
113
|
+
visible: visible,
|
114
|
+
disabled: disabled,
|
115
|
+
onOpen: onOpen,
|
116
|
+
onClose: onClose
|
117
|
+
}),
|
118
|
+
menuVisible = _useUncontrolledToggl[0],
|
119
|
+
menuVisibleAction = _useUncontrolledToggl[1];
|
113
120
|
/**
|
114
121
|
* 转换对象
|
115
122
|
*/
|
@@ -187,7 +194,8 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
187
194
|
var filterSearchStrategy = useSearchMode.useFilterSearch({
|
188
195
|
enabled: searchModeProp === 'filter',
|
189
196
|
data: data,
|
190
|
-
flattedData: flattedData
|
197
|
+
flattedData: flattedData,
|
198
|
+
fieldNames: fieldNames
|
191
199
|
});
|
192
200
|
var highlightSearchStrategy = useSearchMode.useHighlightSearch({
|
193
201
|
data: data,
|
@@ -216,7 +224,7 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
216
224
|
|
217
225
|
|
218
226
|
var highlight = !!searchValue && (searchMode === 'highlight' || searchMode === 'filter');
|
219
|
-
var ret = highlight ? /*#__PURE__*/React__default[
|
227
|
+
var ret = highlight ? /*#__PURE__*/React__default["default"].createElement(highlighter.Highlighter, {
|
220
228
|
keyword: searchValue
|
221
229
|
}, node.title) : true;
|
222
230
|
return ret;
|
@@ -244,7 +252,7 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
244
252
|
return flattedData;
|
245
253
|
}, [selectedItem, flattedData]);
|
246
254
|
var cls = classname.cx(prefixCls, className);
|
247
|
-
return /*#__PURE__*/React__default[
|
255
|
+
return /*#__PURE__*/React__default["default"].createElement(picker.Picker, Object.assign({
|
248
256
|
ref: ref,
|
249
257
|
className: cls
|
250
258
|
}, rest, {
|
@@ -258,13 +266,13 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
258
266
|
searchable: searchable,
|
259
267
|
onSearch: funcUtils.callAllFuncs(onSearchProp, onSearch),
|
260
268
|
loading: loading,
|
261
|
-
trigger: /*#__PURE__*/React__default[
|
269
|
+
trigger: /*#__PURE__*/React__default["default"].createElement(input.MockInput // disabled={disabled}
|
262
270
|
, {
|
263
271
|
// disabled={disabled}
|
264
272
|
clearable: clearable,
|
265
273
|
placeholder: placeholder,
|
266
274
|
displayRender: displayRenderProp,
|
267
|
-
suffix: menuVisible ? /*#__PURE__*/React__default[
|
275
|
+
suffix: menuVisible ? /*#__PURE__*/React__default["default"].createElement(icons.UpOutlined, null) : /*#__PURE__*/React__default["default"].createElement(icons.DownOutlined, null),
|
268
276
|
focused: menuVisible,
|
269
277
|
value: value,
|
270
278
|
onChange: tryChangeValue,
|
@@ -273,15 +281,18 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
273
281
|
invalid: invalid,
|
274
282
|
appearance: appearance
|
275
283
|
})
|
276
|
-
}), typeAssertion.isArrayNonEmpty(treeProps.data) ? /*#__PURE__*/React__default[
|
284
|
+
}), typeAssertion.isArrayNonEmpty(treeProps.data) ? /*#__PURE__*/React__default["default"].createElement(tree.Tree, Object.assign({
|
277
285
|
className: prefixCls + "__tree",
|
278
286
|
selectable: true,
|
279
287
|
selectedId: value,
|
280
288
|
onSelect: onSelect,
|
289
|
+
fieldNames: fieldNames,
|
281
290
|
// onLoadChildren 缓存数据
|
282
|
-
//
|
283
|
-
|
284
|
-
|
291
|
+
// @ts-ignore
|
292
|
+
onLoadChildren: onLoadChildren,
|
293
|
+
virtual: virtual,
|
294
|
+
itemHeight: itemHeight,
|
295
|
+
height: height
|
285
296
|
}, treeProps)) : null);
|
286
297
|
});
|
287
298
|
|
@@ -290,4 +301,3 @@ if (env.__DEV__) {
|
|
290
301
|
}
|
291
302
|
|
292
303
|
exports.TreeSelect = TreeSelect;
|
293
|
-
//# sourceMappingURL=TreeSelect.js.map
|
package/lib/cjs/index.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* @hi-ui/tree-select
|
3
3
|
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/tree-select#readme
|
4
4
|
*
|
5
|
-
* Copyright (c)
|
5
|
+
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
6
6
|
*
|
7
7
|
* This source code is licensed under the MIT license found in the
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
@@ -19,4 +19,3 @@ var TreeSelect = require('./TreeSelect.js');
|
|
19
19
|
|
20
20
|
exports.TreeSelect = TreeSelect.TreeSelect;
|
21
21
|
exports["default"] = TreeSelect.TreeSelect;
|
22
|
-
//# sourceMappingURL=index.js.map
|
@@ -2,7 +2,7 @@
|
|
2
2
|
* @hi-ui/tree-select
|
3
3
|
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/tree-select#readme
|
4
4
|
*
|
5
|
-
* Copyright (c)
|
5
|
+
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
6
6
|
*
|
7
7
|
* This source code is licensed under the MIT license found in the
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
@@ -12,11 +12,10 @@
|
|
12
12
|
Object.defineProperty(exports, '__esModule', {
|
13
13
|
value: true
|
14
14
|
});
|
15
|
-
var css_248z = "
|
15
|
+
var css_248z = "";
|
16
16
|
|
17
|
-
var __styleInject__ = require('
|
17
|
+
var __styleInject__ = require('inject-head-style')["default"];
|
18
18
|
|
19
19
|
__styleInject__(css_248z);
|
20
20
|
|
21
21
|
exports["default"] = css_248z;
|
22
|
-
//# sourceMappingURL=index.scss.js.map
|
package/lib/esm/TreeSelect.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* @hi-ui/tree-select
|
3
3
|
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/tree-select#readme
|
4
4
|
*
|
5
|
-
* Copyright (c)
|
5
|
+
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
6
6
|
*
|
7
7
|
* This source code is licensed under the MIT license found in the
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
@@ -11,7 +11,7 @@ import { __rest } from 'tslib';
|
|
11
11
|
import React, { forwardRef, useCallback, useMemo, useState } from 'react';
|
12
12
|
import { getPrefixCls, cx } from '@hi-ui/classname';
|
13
13
|
import { __DEV__ } from '@hi-ui/env';
|
14
|
-
import {
|
14
|
+
import { useUncontrolledToggle } from '@hi-ui/use-toggle';
|
15
15
|
import { Tree } from '@hi-ui/tree';
|
16
16
|
import { useUncontrolledState } from '@hi-ui/use-uncontrolled-state';
|
17
17
|
import { Picker } from '@hi-ui/picker';
|
@@ -19,11 +19,9 @@ import { baseFlattenTree } from '@hi-ui/tree-utils';
|
|
19
19
|
import { isUndef, isArrayNonEmpty } from '@hi-ui/type-assertion';
|
20
20
|
import { uniqBy } from '@hi-ui/array-utils';
|
21
21
|
import { Highlighter } from '@hi-ui/highlighter';
|
22
|
-
import '
|
23
|
-
import './ui/input/lib/esm/Input.js';
|
24
|
-
import { MockInput } from './ui/input/lib/esm/MockInput.js';
|
22
|
+
import { MockInput } from '@hi-ui/input';
|
25
23
|
import { UpOutlined, DownOutlined } from '@hi-ui/icons';
|
26
|
-
import { useLocaleContext } from '@hi-ui/
|
24
|
+
import { useLocaleContext } from '@hi-ui/core';
|
27
25
|
import { callAllFuncs } from '@hi-ui/func-utils';
|
28
26
|
import { useAsyncSearch, useTreeCustomSearch, useFilterSearch, useHighlightSearch, useSearchMode } from '@hi-ui/use-search-mode';
|
29
27
|
var TREE_SELECT_PREFIX = getPrefixCls('tree-select');
|
@@ -44,6 +42,9 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
44
42
|
dataSource = _a.dataSource,
|
45
43
|
_a$disabled = _a.disabled,
|
46
44
|
disabled = _a$disabled === void 0 ? false : _a$disabled,
|
45
|
+
visible = _a.visible,
|
46
|
+
onOpen = _a.onOpen,
|
47
|
+
onClose = _a.onClose,
|
47
48
|
_a$fieldNames = _a.fieldNames,
|
48
49
|
fieldNames = _a$fieldNames === void 0 ? DEFAULT_FIELD_NAMES : _a$fieldNames,
|
49
50
|
_a$defaultExpandAll = _a.defaultExpandAll,
|
@@ -67,14 +68,22 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
67
68
|
displayRenderProp = _a.displayRender,
|
68
69
|
placeholderProp = _a.placeholder,
|
69
70
|
appearance = _a.appearance,
|
70
|
-
|
71
|
+
virtual = _a.virtual,
|
72
|
+
itemHeight = _a.itemHeight,
|
73
|
+
height = _a.height,
|
74
|
+
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", "onSearch", "clearable", "invalid", "displayRender", "placeholder", "appearance", "virtual", "itemHeight", "height"]);
|
71
75
|
|
72
76
|
var i18n = useLocaleContext();
|
73
77
|
var placeholder = isUndef(placeholderProp) ? i18n.get('treeSelect.placeholder') : placeholderProp;
|
74
78
|
|
75
|
-
var
|
76
|
-
|
77
|
-
|
79
|
+
var _useUncontrolledToggl = useUncontrolledToggle({
|
80
|
+
visible: visible,
|
81
|
+
disabled: disabled,
|
82
|
+
onOpen: onOpen,
|
83
|
+
onClose: onClose
|
84
|
+
}),
|
85
|
+
menuVisible = _useUncontrolledToggl[0],
|
86
|
+
menuVisibleAction = _useUncontrolledToggl[1];
|
78
87
|
/**
|
79
88
|
* 转换对象
|
80
89
|
*/
|
@@ -152,7 +161,8 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
152
161
|
var filterSearchStrategy = useFilterSearch({
|
153
162
|
enabled: searchModeProp === 'filter',
|
154
163
|
data: data,
|
155
|
-
flattedData: flattedData
|
164
|
+
flattedData: flattedData,
|
165
|
+
fieldNames: fieldNames
|
156
166
|
});
|
157
167
|
var highlightSearchStrategy = useHighlightSearch({
|
158
168
|
data: data,
|
@@ -243,10 +253,13 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
243
253
|
selectable: true,
|
244
254
|
selectedId: value,
|
245
255
|
onSelect: onSelect,
|
256
|
+
fieldNames: fieldNames,
|
246
257
|
// onLoadChildren 缓存数据
|
247
|
-
//
|
248
|
-
|
249
|
-
|
258
|
+
// @ts-ignore
|
259
|
+
onLoadChildren: onLoadChildren,
|
260
|
+
virtual: virtual,
|
261
|
+
itemHeight: itemHeight,
|
262
|
+
height: height
|
250
263
|
}, treeProps)) : null);
|
251
264
|
});
|
252
265
|
|
@@ -255,4 +268,3 @@ if (__DEV__) {
|
|
255
268
|
}
|
256
269
|
|
257
270
|
export { TreeSelect };
|
258
|
-
//# sourceMappingURL=TreeSelect.js.map
|
package/lib/esm/index.js
CHANGED
@@ -2,11 +2,10 @@
|
|
2
2
|
* @hi-ui/tree-select
|
3
3
|
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/tree-select#readme
|
4
4
|
*
|
5
|
-
* Copyright (c)
|
5
|
+
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
6
6
|
*
|
7
7
|
* This source code is licensed under the MIT license found in the
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
9
9
|
*/
|
10
10
|
import './styles/index.scss.js';
|
11
11
|
export { TreeSelect, TreeSelect as default } from './TreeSelect.js';
|
12
|
-
//# sourceMappingURL=index.js.map
|
@@ -2,16 +2,14 @@
|
|
2
2
|
* @hi-ui/tree-select
|
3
3
|
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/tree-select#readme
|
4
4
|
*
|
5
|
-
* Copyright (c)
|
5
|
+
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
6
6
|
*
|
7
7
|
* This source code is licensed under the MIT license found in the
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
9
9
|
*/
|
10
|
-
|
11
|
-
|
12
|
-
var __styleInject__ = require('style-inject/dist/style-inject.es.js')["default"];
|
10
|
+
import __styleInject__ from 'inject-head-style';
|
11
|
+
var css_248z = "";
|
13
12
|
|
14
13
|
__styleInject__(css_248z);
|
15
14
|
|
16
|
-
export default
|
17
|
-
//# sourceMappingURL=index.scss.js.map
|
15
|
+
export { css_248z as default };
|
@@ -1,13 +1,14 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
2
|
+
import { TreeSelectDataItem } from './types';
|
3
3
|
import { TreeNodeEventData } from '@hi-ui/tree';
|
4
4
|
import { PickerProps } from '@hi-ui/picker';
|
5
5
|
import { HiBaseAppearanceEnum } from '@hi-ui/core';
|
6
|
+
import { UseDataSource } from '@hi-ui/use-data-source';
|
6
7
|
/**
|
7
8
|
* TODO: What is TreeSelect
|
8
9
|
*/
|
9
10
|
export declare const TreeSelect: React.ForwardRefExoticComponent<TreeSelectProps & React.RefAttributes<HTMLDivElement | null>>;
|
10
|
-
export interface TreeSelectProps extends Omit<PickerProps, 'data' | 'onChange' | 'trigger'> {
|
11
|
+
export interface TreeSelectProps extends Omit<PickerProps, 'data' | 'onChange' | 'trigger' | 'scrollable'> {
|
11
12
|
/**
|
12
13
|
* 展示数据
|
13
14
|
*/
|
@@ -15,11 +16,7 @@ export interface TreeSelectProps extends Omit<PickerProps, 'data' | 'onChange' |
|
|
15
16
|
/**
|
16
17
|
* 设置 data 中 id, title, disabled, children 对应的 key (3.0 新增) object - { title: 'title', id: 'id',disabled:'disabled', children: 'children'}
|
17
18
|
*/
|
18
|
-
fieldNames?:
|
19
|
-
/**
|
20
|
-
* 数据选择类型
|
21
|
-
*/
|
22
|
-
type?: 'single' | 'multiple';
|
19
|
+
fieldNames?: Record<string, string>;
|
23
20
|
/**
|
24
21
|
* 是否有边框
|
25
22
|
*/
|
@@ -79,13 +76,10 @@ export interface TreeSelectProps extends Omit<PickerProps, 'data' | 'onChange' |
|
|
79
76
|
*/
|
80
77
|
onLoadChildren?: (node: TreeNodeEventData) => void | Promise<TreeSelectDataItem[] | void>;
|
81
78
|
/**
|
82
|
-
*
|
79
|
+
* 异步加载数据。暂不对外暴露
|
80
|
+
* @private
|
83
81
|
*/
|
84
|
-
|
85
|
-
/**
|
86
|
-
* 异步加载数据
|
87
|
-
*/
|
88
|
-
dataSource?: DataSourceFunc | TreeSelectDataSource | Promise<TreeSelectDataItem[]>;
|
82
|
+
dataSource?: UseDataSource<TreeSelectDataItem[]>;
|
89
83
|
/**
|
90
84
|
* 没有选项时的提示
|
91
85
|
*/
|
@@ -112,4 +106,18 @@ export interface TreeSelectProps extends Omit<PickerProps, 'data' | 'onChange' |
|
|
112
106
|
* 设置展现形式
|
113
107
|
*/
|
114
108
|
appearance?: HiBaseAppearanceEnum;
|
109
|
+
/**
|
110
|
+
* 设置虚拟滚动容器的可视高度。暂不对外暴露
|
111
|
+
* @private
|
112
|
+
*/
|
113
|
+
height?: number;
|
114
|
+
/**
|
115
|
+
* 设置虚拟列表每项的固定高度。暂不对外暴露
|
116
|
+
* @private
|
117
|
+
*/
|
118
|
+
itemHeight?: number;
|
119
|
+
/**
|
120
|
+
* 设置 `true` 开启虚拟滚动
|
121
|
+
*/
|
122
|
+
virtual?: boolean;
|
115
123
|
}
|
package/lib/types/context.d.ts
CHANGED
@@ -1,7 +1,3 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
export declare const TreeSelectProvider: import("react").Provider<
|
3
|
-
|
4
|
-
}, "rootProps"> | null>;
|
5
|
-
export declare const useTreeSelectContext: () => Omit<{
|
6
|
-
rootProps: {};
|
7
|
-
}, "rootProps">;
|
2
|
+
export declare const TreeSelectProvider: import("react").Provider<any>;
|
3
|
+
export declare const useTreeSelectContext: () => any;
|
package/lib/types/index.d.ts
CHANGED
package/lib/types/types.d.ts
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
+
import { HiBaseDataItem } from '@hi-ui/core';
|
1
2
|
import React from 'react';
|
2
|
-
export interface TreeSelectDataItem {
|
3
|
+
export interface TreeSelectDataItem extends HiBaseDataItem {
|
3
4
|
/**
|
4
5
|
* 节点唯一 id
|
5
6
|
*/
|
6
|
-
id
|
7
|
+
id?: React.ReactText;
|
7
8
|
/**
|
8
9
|
* 节点标题
|
9
10
|
*/
|
10
|
-
title
|
11
|
+
title?: React.ReactNode;
|
11
12
|
/**
|
12
13
|
* 子级数据
|
13
14
|
*/
|
@@ -47,11 +48,3 @@ export interface TreeSelectDataSource<T = any> {
|
|
47
48
|
*/
|
48
49
|
transformResponse?: (response: object) => T;
|
49
50
|
}
|
50
|
-
export declare type FilterOptionFunc = (keyword: string, item: TreeSelectDataItem) => boolean;
|
51
|
-
export declare type DataSourceFunc = (keyword: string) => TreeSelectDataSource;
|
52
|
-
export declare type FieldNames = {
|
53
|
-
id?: string;
|
54
|
-
title?: string;
|
55
|
-
disabled?: string;
|
56
|
-
children?: string;
|
57
|
-
};
|
package/package.json
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hi-ui/tree-select",
|
3
|
-
"version": "4.0.
|
3
|
+
"version": "4.0.2",
|
4
4
|
"description": "A sub-package for @hi-ui/hiui.",
|
5
5
|
"keywords": [],
|
6
|
-
"author": "
|
6
|
+
"author": "HiUI <mi-hiui@xiaomi.com>",
|
7
7
|
"homepage": "https://github.com/XiaoMi/hiui/tree/master/packages/ui/tree-select#readme",
|
8
8
|
"license": "MIT",
|
9
9
|
"directories": {
|
@@ -43,33 +43,34 @@
|
|
43
43
|
"url": "https://github.com/XiaoMi/hiui/issues"
|
44
44
|
},
|
45
45
|
"dependencies": {
|
46
|
-
"@hi-ui/array-utils": "^4.0.
|
47
|
-
"@hi-ui/classname": "^4.0.
|
48
|
-
"@hi-ui/
|
49
|
-
"@hi-ui/
|
50
|
-
"@hi-ui/
|
51
|
-
"@hi-ui/
|
52
|
-
"@hi-ui/
|
53
|
-
"@hi-ui/
|
54
|
-
"@hi-ui/
|
55
|
-
"@hi-ui/
|
56
|
-
"@hi-ui/
|
57
|
-
"@hi-ui/
|
58
|
-
"@hi-ui/
|
59
|
-
"@hi-ui/
|
60
|
-
"@hi-ui/
|
61
|
-
"@hi-ui/use-
|
62
|
-
"@hi-ui/use-toggle": "^4.0.0-beta.1",
|
63
|
-
"@hi-ui/use-uncontrolled-state": "^4.0.0-beta.1"
|
46
|
+
"@hi-ui/array-utils": "^4.0.1",
|
47
|
+
"@hi-ui/classname": "^4.0.1",
|
48
|
+
"@hi-ui/env": "^4.0.1",
|
49
|
+
"@hi-ui/func-utils": "^4.0.1",
|
50
|
+
"@hi-ui/highlighter": "^4.0.2",
|
51
|
+
"@hi-ui/icons": "^4.0.1",
|
52
|
+
"@hi-ui/input": "^4.0.1",
|
53
|
+
"@hi-ui/picker": "^4.0.1",
|
54
|
+
"@hi-ui/popper": "^4.0.1",
|
55
|
+
"@hi-ui/tree": "^4.0.2",
|
56
|
+
"@hi-ui/tree-utils": "^4.0.1",
|
57
|
+
"@hi-ui/type-assertion": "^4.0.1",
|
58
|
+
"@hi-ui/use-data-source": "^4.0.1",
|
59
|
+
"@hi-ui/use-search-mode": "^4.0.2",
|
60
|
+
"@hi-ui/use-toggle": "^4.0.1",
|
61
|
+
"@hi-ui/use-uncontrolled-state": "^4.0.1"
|
64
62
|
},
|
65
63
|
"peerDependencies": {
|
64
|
+
"@hi-ui/core": ">=4.0.0",
|
66
65
|
"react": ">=16.8.6",
|
67
66
|
"react-dom": ">=16.8.6"
|
68
67
|
},
|
69
68
|
"devDependencies": {
|
70
|
-
"@hi-ui/
|
69
|
+
"@hi-ui/core": "^4.0.1",
|
70
|
+
"@hi-ui/core-css": "^4.0.1",
|
71
|
+
"@hi-ui/hi-build": "^4.0.1",
|
71
72
|
"react": "^17.0.1",
|
72
73
|
"react-dom": "^17.0.1"
|
73
74
|
},
|
74
|
-
"gitHead": "
|
75
|
+
"gitHead": "cc2be2029ebdd139b4c658071db864827d138f70"
|
75
76
|
}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"TreeSelect.js","sources":["../../src/TreeSelect.tsx"],"sourcesContent":[null],"names":["TREE_SELECT_PREFIX","getPrefixCls","DEFAULT_DATA","DEFAULT_FIELD_NAMES","DEFAULT_EXPANDED_IDS","TreeSelect","forwardRef","_a","ref","prefixCls","className","data","dataSource","disabled","fieldNames","defaultExpandAll","expandedIdsProp","expandedIds","defaultExpandedIds","onExpand","defaultValue","valueProp","value","onChange","searchableProp","searchable","searchModeProp","searchMode","onLoadChildren","titleRender","render","filterOption","onSearchProp","onSearch","clearable","invalid","displayRenderProp","displayRender","placeholderProp","placeholder","appearance","rest","i18n","useLocaleContext","isUndef","get","useToggle","menuVisible","menuVisibleAction","getKeyFields","useCallback","node","key","flattedData","useMemo","baseFlattenTree","tree","childrenFieldName","transform","flattedNode","raw","id","title","isLeaf","useUncontrolledState","getDefaultExpandedIds","map","tryChangeExpandedIds","tryChangeValue","onSelect","selectedId","selectedNode","setSelectedItem","off","useState","selectedItem","_b","useAsyncSearch","loading","hasError","dataSourceStrategy","customSearchStrategy","useTreeCustomSearch","filterSearchStrategy","useFilterSearch","enabled","highlightSearchStrategy","useHighlightSearch","useSearchMode","strategies","stateInSearch","state","setStateInSearch","searchValue","keyword","proxyTitleRender","ret","highlight","React","Highlighter","shouldUseSearch","treeProps","ids","prev","mergedData","nextData","concat","uniqBy","cls","cx","Picker","visible","onOpen","on","onClose","callAllFuncs","trigger","MockInput","suffix","UpOutlined","DownOutlined","focused","isArrayNonEmpty","Tree","selectable","__DEV__","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAMA,kBAAkB,GAAGC,sBAAAA,CAAa,aAAbA,CAA3B;AACA,IAAMC,YAAY,GAAG,EAArB;;AAEA,IAAMC,mBAAmB,GAAG,EAA5B;AACA,IAAMC,oBAAoB,GAAG,EAA7B;AAEA;;;;IAGaC,UAAU,gBAAGC,gBAAAA,CACxB,UACEC,EADF,EAoCEC,GApCF;wBAEIC;MAAAA,sCAAYT;MAEZU,eAAAA;mBACAC;MAAAA,4BAAOT;MACPU,gBAAAA;uBACAC;MAAAA,oCAAW;yBAGXC;MAAAA,wCAAaX;+BACbY;MAAAA,oDAAmB;MACNC,qBAAbC;iCACAC;MAAAA,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AAA,CAAH,gBAAoBA,yBAAAA,cAAAA,CAACsB,kBAADtB,MAAAA;AACvCuB,MAAAA,OAAO,EAAE1E;AACTzB,MAAAA,KAAK,EAAEA;AACPC,MAAAA,QAAQ,EAAE6C;AACVzD,MAAAA,IAAI,EAAE6F;;AAENrE,MAAAA,OAAO,EAAEA;AACTK,MAAAA,UAAU,EAAEA;KAZd0D;IAfJA,EA+BGwB,6BAAAA,CAAgBrB,SAAS,CAAC1F,IAA1B+G,iBACCxB,yBAAAA,cAAAA,CAACyB,SAADzB;AACExF,IAAAA,SAAS,EAAKD,SAAL;AACTmH,IAAAA,UAAU;AACVtD,IAAAA,UAAU,EAAEhD;AACZ+C,IAAAA,QAAQ,EAAEA;;;;AAIVzC,IAAAA,cAAc,EAAEA;KACZyE,UATNH,CADDwB,GAYG,IA3CNxB;AAvL8B,CAAV5F;;AAmV1B,IAAIuH,WAAJ,EAAa;AACXxH,EAAAA,UAAU,CAACyH,WAAXzH,GAAyB,YAAzBA;;;"}
|
@@ -1,65 +0,0 @@
|
|
1
|
-
/** @LICENSE
|
2
|
-
* @hi-ui/tree-select
|
3
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/tree-select#readme
|
4
|
-
*
|
5
|
-
* Copyright (c) HIUI <mi-hiui@xiaomi.com>.
|
6
|
-
*
|
7
|
-
* This source code is licensed under the MIT license found in the
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
9
|
-
*/
|
10
|
-
'use strict';
|
11
|
-
|
12
|
-
Object.defineProperty(exports, '__esModule', {
|
13
|
-
value: true
|
14
|
-
});
|
15
|
-
|
16
|
-
var React = require('react');
|
17
|
-
/** @LICENSE
|
18
|
-
* @hi-ui/use-latest
|
19
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/hooks/use-latest#readme
|
20
|
-
*
|
21
|
-
* Copyright (c) HIUI <mi-hiui@xiaomi.com>.
|
22
|
-
*
|
23
|
-
* This source code is licensed under the MIT license found in the
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
25
|
-
*/
|
26
|
-
|
27
|
-
/**
|
28
|
-
* Keep value up-to-date if it changes.
|
29
|
-
*
|
30
|
-
* @param value
|
31
|
-
* @returns
|
32
|
-
*/
|
33
|
-
|
34
|
-
|
35
|
-
var useLatestRef = function useLatestRef(value) {
|
36
|
-
var ref = React.useRef(value);
|
37
|
-
ref.current = value;
|
38
|
-
return ref;
|
39
|
-
};
|
40
|
-
/**
|
41
|
-
* Keep callback function up-to-date if it changes.
|
42
|
-
*
|
43
|
-
* @param callback
|
44
|
-
* @returns
|
45
|
-
*/
|
46
|
-
|
47
|
-
|
48
|
-
var useLatestCallback = function useLatestCallback(callback) {
|
49
|
-
var ref = useLatestRef(callback);
|
50
|
-
return React.useCallback(function () {
|
51
|
-
var _a2;
|
52
|
-
|
53
|
-
var _a;
|
54
|
-
|
55
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
56
|
-
args[_key] = arguments[_key];
|
57
|
-
}
|
58
|
-
|
59
|
-
return (_a = ref.current) === null || _a === void 0 ? void 0 : (_a2 = _a).call.apply(_a2, [ref].concat(args));
|
60
|
-
}, []);
|
61
|
-
};
|
62
|
-
|
63
|
-
exports.useLatestCallback = useLatestCallback;
|
64
|
-
exports.useLatestRef = useLatestRef;
|
65
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../../hooks/use-latest/lib/esm/index.js"],"sourcesContent":["/** @LICENSE\n * @hi-ui/use-latest\n * https://github.com/XiaoMi/hiui/tree/master/packages/hooks/use-latest#readme\n *\n * Copyright (c) HIUI <mi-hiui@xiaomi.com>.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { useRef, useCallback } from 'react';\n/**\n * Keep value up-to-date if it changes.\n *\n * @param value\n * @returns\n */\n\nvar useLatestRef = function useLatestRef(value) {\n var ref = useRef(value);\n ref.current = value;\n return ref;\n};\n/**\n * Keep callback function up-to-date if it changes.\n *\n * @param callback\n * @returns\n */\n\n\nvar useLatestCallback = function useLatestCallback(callback) {\n var ref = useLatestRef(callback);\n return useCallback(function () {\n var _a2;\n\n var _a;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return (_a = ref.current) === null || _a === void 0 ? void 0 : (_a2 = _a).call.apply(_a2, [ref].concat(args));\n }, []);\n};\n\nexport { useLatestCallback, useLatestRef };\n//# sourceMappingURL=index.js.map\n"],"names":["useLatestRef","value","ref","useRef","useLatestCallback","callback","useCallback","args","_a","current","_a2","call","apply","concat"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;;;;;;;IAMaA,YAAY,GAAG,SAAfA,YAAe,CAAAC,KAAA,EAAA;MACpBC,GAAG,GAAGC,YAAAA,CAAMF,KAANE;AACZD,EAAAA,GAAG,CAAHA,OAAAA,GAAAA,KAAAA;SACOA;;AAGT;;;;;;;;IAMaE,iBAAiB,GAAG,SAApBA,iBAAoB,CAAAC,QAAA,EAAA;MAGzBH,GAAG,GAAGF,YAAY,CAAAK,QAAA;SACjBC,iBAAAA,CAAY,YAAA;;;;;sCAAIC,IAAAA,GAAAA,IAAAA,KAAAA,CAAAA,IAAAA,GAAAA,IAAAA,GAAAA,GAAAA,IAAAA,GAAAA,MAAAA,IAAAA,IAAAA;AAAAA,MAAAA,IAAAA,CAAAA,IAAAA,CAAAA,GAAAA,SAAAA,CAAAA,IAAAA,CAAAA;;;WAAgB,CAAAC,EAAA,GAAAN,GAAG,CAAHO,OAAA,MAAA,IAAA,IAAAD,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,CAAAE,GAAA,GAAAF,EAAA,EAAAG,IAAA,CAAAC,KAAA,CAAAF,GAAA,EAAA,CAAAR,GAAA,EAAAW,MAAA,CAAiBN,IAAjB,CAAA;AAArB,GAAXD,EAAW,EAAXA;;;;"}
|