@hi-ui/tree-select 4.0.0-beta.7 → 4.0.0
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 +33 -21
- package/lib/cjs/index.js +1 -2
- package/lib/cjs/styles/index.scss.js +3 -4
- package/lib/esm/TreeSelect.js +27 -14
- package/lib/esm/index.js +1 -2
- package/lib/esm/styles/index.scss.js +4 -6
- package/lib/types/TreeSelect.d.ts +19 -8
- package/lib/types/index.d.ts +1 -0
- package/lib/types/types.d.ts +2 -10
- package/package.json +23 -21
- 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/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,13 @@ 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');
|
47
|
+
|
48
|
+
var funcUtils = require('@hi-ui/func-utils');
|
51
49
|
|
52
50
|
var useSearchMode = require('@hi-ui/use-search-mode');
|
53
51
|
|
@@ -77,6 +75,9 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
77
75
|
dataSource = _a.dataSource,
|
78
76
|
_a$disabled = _a.disabled,
|
79
77
|
disabled = _a$disabled === void 0 ? false : _a$disabled,
|
78
|
+
visible = _a.visible,
|
79
|
+
onOpen = _a.onOpen,
|
80
|
+
onClose = _a.onClose,
|
80
81
|
_a$fieldNames = _a.fieldNames,
|
81
82
|
fieldNames = _a$fieldNames === void 0 ? DEFAULT_FIELD_NAMES : _a$fieldNames,
|
82
83
|
_a$defaultExpandAll = _a.defaultExpandAll,
|
@@ -94,19 +95,28 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
94
95
|
onLoadChildren = _a.onLoadChildren,
|
95
96
|
titleRender = _a.render,
|
96
97
|
filterOption = _a.filterOption,
|
98
|
+
onSearchProp = _a.onSearch,
|
97
99
|
clearable = _a.clearable,
|
98
100
|
invalid = _a.invalid,
|
99
101
|
displayRenderProp = _a.displayRender,
|
100
102
|
placeholderProp = _a.placeholder,
|
101
103
|
appearance = _a.appearance,
|
102
|
-
|
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"]);
|
103
108
|
|
104
|
-
var i18n =
|
109
|
+
var i18n = core.useLocaleContext();
|
105
110
|
var placeholder = typeAssertion.isUndef(placeholderProp) ? i18n.get('treeSelect.placeholder') : placeholderProp;
|
106
111
|
|
107
|
-
var
|
108
|
-
|
109
|
-
|
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];
|
110
120
|
/**
|
111
121
|
* 转换对象
|
112
122
|
*/
|
@@ -213,7 +223,7 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
213
223
|
|
214
224
|
|
215
225
|
var highlight = !!searchValue && (searchMode === 'highlight' || searchMode === 'filter');
|
216
|
-
var ret = highlight ? /*#__PURE__*/React__default[
|
226
|
+
var ret = highlight ? /*#__PURE__*/React__default["default"].createElement(highlighter.Highlighter, {
|
217
227
|
keyword: searchValue
|
218
228
|
}, node.title) : true;
|
219
229
|
return ret;
|
@@ -241,7 +251,7 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
241
251
|
return flattedData;
|
242
252
|
}, [selectedItem, flattedData]);
|
243
253
|
var cls = classname.cx(prefixCls, className);
|
244
|
-
return /*#__PURE__*/React__default[
|
254
|
+
return /*#__PURE__*/React__default["default"].createElement(picker.Picker, Object.assign({
|
245
255
|
ref: ref,
|
246
256
|
className: cls
|
247
257
|
}, rest, {
|
@@ -253,15 +263,15 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
253
263
|
// onChange={tryChangeValue}
|
254
264
|
// data={mergedData}
|
255
265
|
searchable: searchable,
|
256
|
-
onSearch: onSearch,
|
266
|
+
onSearch: funcUtils.callAllFuncs(onSearchProp, onSearch),
|
257
267
|
loading: loading,
|
258
|
-
trigger: /*#__PURE__*/React__default[
|
268
|
+
trigger: /*#__PURE__*/React__default["default"].createElement(input.MockInput // disabled={disabled}
|
259
269
|
, {
|
260
270
|
// disabled={disabled}
|
261
271
|
clearable: clearable,
|
262
272
|
placeholder: placeholder,
|
263
273
|
displayRender: displayRenderProp,
|
264
|
-
suffix: menuVisible ? /*#__PURE__*/React__default[
|
274
|
+
suffix: menuVisible ? /*#__PURE__*/React__default["default"].createElement(icons.UpOutlined, null) : /*#__PURE__*/React__default["default"].createElement(icons.DownOutlined, null),
|
265
275
|
focused: menuVisible,
|
266
276
|
value: value,
|
267
277
|
onChange: tryChangeValue,
|
@@ -270,15 +280,18 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
270
280
|
invalid: invalid,
|
271
281
|
appearance: appearance
|
272
282
|
})
|
273
|
-
}), typeAssertion.isArrayNonEmpty(treeProps.data) ? /*#__PURE__*/React__default[
|
283
|
+
}), typeAssertion.isArrayNonEmpty(treeProps.data) ? /*#__PURE__*/React__default["default"].createElement(tree.Tree, Object.assign({
|
274
284
|
className: prefixCls + "__tree",
|
275
285
|
selectable: true,
|
276
286
|
selectedId: value,
|
277
287
|
onSelect: onSelect,
|
278
288
|
// onLoadChildren 缓存数据
|
279
289
|
// TODO: 支持 fieldNames
|
280
|
-
//
|
281
|
-
onLoadChildren: onLoadChildren
|
290
|
+
// @ts-ignore
|
291
|
+
onLoadChildren: onLoadChildren,
|
292
|
+
virtual: virtual,
|
293
|
+
itemHeight: itemHeight,
|
294
|
+
height: height
|
282
295
|
}, treeProps)) : null);
|
283
296
|
});
|
284
297
|
|
@@ -287,4 +300,3 @@ if (env.__DEV__) {
|
|
287
300
|
}
|
288
301
|
|
289
302
|
exports.TreeSelect = TreeSelect;
|
290
|
-
//# 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,10 @@ 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';
|
25
|
+
import { callAllFuncs } from '@hi-ui/func-utils';
|
27
26
|
import { useAsyncSearch, useTreeCustomSearch, useFilterSearch, useHighlightSearch, useSearchMode } from '@hi-ui/use-search-mode';
|
28
27
|
var TREE_SELECT_PREFIX = getPrefixCls('tree-select');
|
29
28
|
var DEFAULT_DATA = []; // const DEFAULT_VALUE = [] as []
|
@@ -43,6 +42,9 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
43
42
|
dataSource = _a.dataSource,
|
44
43
|
_a$disabled = _a.disabled,
|
45
44
|
disabled = _a$disabled === void 0 ? false : _a$disabled,
|
45
|
+
visible = _a.visible,
|
46
|
+
onOpen = _a.onOpen,
|
47
|
+
onClose = _a.onClose,
|
46
48
|
_a$fieldNames = _a.fieldNames,
|
47
49
|
fieldNames = _a$fieldNames === void 0 ? DEFAULT_FIELD_NAMES : _a$fieldNames,
|
48
50
|
_a$defaultExpandAll = _a.defaultExpandAll,
|
@@ -60,19 +62,28 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
60
62
|
onLoadChildren = _a.onLoadChildren,
|
61
63
|
titleRender = _a.render,
|
62
64
|
filterOption = _a.filterOption,
|
65
|
+
onSearchProp = _a.onSearch,
|
63
66
|
clearable = _a.clearable,
|
64
67
|
invalid = _a.invalid,
|
65
68
|
displayRenderProp = _a.displayRender,
|
66
69
|
placeholderProp = _a.placeholder,
|
67
70
|
appearance = _a.appearance,
|
68
|
-
|
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"]);
|
69
75
|
|
70
76
|
var i18n = useLocaleContext();
|
71
77
|
var placeholder = isUndef(placeholderProp) ? i18n.get('treeSelect.placeholder') : placeholderProp;
|
72
78
|
|
73
|
-
var
|
74
|
-
|
75
|
-
|
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];
|
76
87
|
/**
|
77
88
|
* 转换对象
|
78
89
|
*/
|
@@ -219,7 +230,7 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
219
230
|
// onChange={tryChangeValue}
|
220
231
|
// data={mergedData}
|
221
232
|
searchable: searchable,
|
222
|
-
onSearch: onSearch,
|
233
|
+
onSearch: callAllFuncs(onSearchProp, onSearch),
|
223
234
|
loading: loading,
|
224
235
|
trigger: /*#__PURE__*/React.createElement(MockInput // disabled={disabled}
|
225
236
|
, {
|
@@ -243,8 +254,11 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
243
254
|
onSelect: onSelect,
|
244
255
|
// onLoadChildren 缓存数据
|
245
256
|
// TODO: 支持 fieldNames
|
246
|
-
//
|
247
|
-
onLoadChildren: onLoadChildren
|
257
|
+
// @ts-ignore
|
258
|
+
onLoadChildren: onLoadChildren,
|
259
|
+
virtual: virtual,
|
260
|
+
itemHeight: itemHeight,
|
261
|
+
height: height
|
248
262
|
}, treeProps)) : null);
|
249
263
|
});
|
250
264
|
|
@@ -253,4 +267,3 @@ if (__DEV__) {
|
|
253
267
|
}
|
254
268
|
|
255
269
|
export { TreeSelect };
|
256
|
-
//# 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
|
*/
|
@@ -85,7 +82,7 @@ export interface TreeSelectProps extends Omit<PickerProps, 'data' | 'onChange' |
|
|
85
82
|
/**
|
86
83
|
* 异步加载数据
|
87
84
|
*/
|
88
|
-
dataSource?:
|
85
|
+
dataSource?: UseDataSource<TreeSelectDataItem[]>;
|
89
86
|
/**
|
90
87
|
* 没有选项时的提示
|
91
88
|
*/
|
@@ -112,4 +109,18 @@ export interface TreeSelectProps extends Omit<PickerProps, 'data' | 'onChange' |
|
|
112
109
|
* 设置展现形式
|
113
110
|
*/
|
114
111
|
appearance?: HiBaseAppearanceEnum;
|
112
|
+
/**
|
113
|
+
* 设置虚拟滚动容器的可视高度。暂不对外暴露
|
114
|
+
* @private
|
115
|
+
*/
|
116
|
+
height?: number;
|
117
|
+
/**
|
118
|
+
* 设置虚拟列表每项的固定高度。暂不对外暴露
|
119
|
+
* @private
|
120
|
+
*/
|
121
|
+
itemHeight?: number;
|
122
|
+
/**
|
123
|
+
* 设置 `true` 开启虚拟滚动
|
124
|
+
*/
|
125
|
+
virtual?: boolean;
|
115
126
|
}
|
package/lib/types/index.d.ts
CHANGED
package/lib/types/types.d.ts
CHANGED
@@ -3,11 +3,11 @@ export interface TreeSelectDataItem {
|
|
3
3
|
/**
|
4
4
|
* 节点唯一 id
|
5
5
|
*/
|
6
|
-
id
|
6
|
+
id?: React.ReactText;
|
7
7
|
/**
|
8
8
|
* 节点标题
|
9
9
|
*/
|
10
|
-
title
|
10
|
+
title?: React.ReactNode;
|
11
11
|
/**
|
12
12
|
* 子级数据
|
13
13
|
*/
|
@@ -47,11 +47,3 @@ export interface TreeSelectDataSource<T = any> {
|
|
47
47
|
*/
|
48
48
|
transformResponse?: (response: object) => T;
|
49
49
|
}
|
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.0
|
3
|
+
"version": "4.0.0",
|
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,32 +43,34 @@
|
|
43
43
|
"url": "https://github.com/XiaoMi/hiui/issues"
|
44
44
|
},
|
45
45
|
"dependencies": {
|
46
|
-
"@hi-ui/array-utils": "^4.0.0
|
47
|
-
"@hi-ui/classname": "^4.0.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/use-
|
61
|
-
"@hi-ui/use-
|
62
|
-
"@hi-ui/use-uncontrolled-state": "^4.0.0-beta.1"
|
46
|
+
"@hi-ui/array-utils": "^4.0.0",
|
47
|
+
"@hi-ui/classname": "^4.0.0",
|
48
|
+
"@hi-ui/env": "^4.0.0",
|
49
|
+
"@hi-ui/func-utils": "^4.0.0",
|
50
|
+
"@hi-ui/highlighter": "^4.0.0",
|
51
|
+
"@hi-ui/icons": "^4.0.0",
|
52
|
+
"@hi-ui/input": "^4.0.0",
|
53
|
+
"@hi-ui/picker": "^4.0.0",
|
54
|
+
"@hi-ui/popper": "^4.0.0",
|
55
|
+
"@hi-ui/tree": "^4.0.0",
|
56
|
+
"@hi-ui/tree-utils": "^4.0.0",
|
57
|
+
"@hi-ui/type-assertion": "^4.0.0",
|
58
|
+
"@hi-ui/use-data-source": "^4.0.0",
|
59
|
+
"@hi-ui/use-search-mode": "^4.0.0",
|
60
|
+
"@hi-ui/use-toggle": "^4.0.0",
|
61
|
+
"@hi-ui/use-uncontrolled-state": "^4.0.0"
|
63
62
|
},
|
64
63
|
"peerDependencies": {
|
64
|
+
"@hi-ui/core": ">=4.0.0",
|
65
65
|
"react": ">=16.8.6",
|
66
66
|
"react-dom": ">=16.8.6"
|
67
67
|
},
|
68
68
|
"devDependencies": {
|
69
|
-
"@hi-ui/
|
69
|
+
"@hi-ui/core": "^4.0.0",
|
70
|
+
"@hi-ui/core-css": "^4.0.0",
|
71
|
+
"@hi-ui/hi-build": "^4.0.0",
|
70
72
|
"react": "^17.0.1",
|
71
73
|
"react-dom": "^17.0.1"
|
72
74
|
},
|
73
|
-
"gitHead": "
|
75
|
+
"gitHead": "3530e4f3c0b4394b91d66a4aa749579708ebff84"
|
74
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","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","onSearch","searchValue","keyword","proxyTitleRender","ret","highlight","React","Highlighter","shouldUseSearch","treeProps","ids","prev","mergedData","nextData","concat","uniqBy","cls","cx","Picker","visible","onOpen","on","onClose","trigger","MockInput","suffix","UpOutlined","DownOutlined","focused","isArrayNonEmpty","Tree","selectable","__DEV__","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,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,EAmCEC,GAnCF;wBAEIC;MAAAA,sCAAYT;MAEZU,eAAAA;mBACAC;MAAAA,4BAAOT;MACPU,gBAAAA;uBACAC;MAAAA,oCAAW;yBAGXC;MAAAA,wCAAaX;+BACbY;MAAAA,oDAAmB;MACNC,qBAAbC;iCACAC;MAAAA,wDAAqBd;MACrBe,cAAAA;2BACAC;MAAAA,4CAAe;MACRC,eAAPC;MACAC,cAAAA;MACYC,oBAAZC;MACYC,oBAAZC;MACAC,oBAAAA;MACQC,iBAARC;MACAC,kBAAAA;MAMAC,eAAAA;MACAC,aAAAA;MACeC,uBAAfC;MACaC,qBAAbC;MACAC,gBAAAA;MACGC,wBAhCL,YAAA,QAAA,aAAA,QAAA,cAAA,YAAA,cAAA,oBAAA,eAAA,sBAAA,YAAA,gBAAA,SAAA,YAAA,cAAA,cAAA,kBAAA,UAAA,gBAAA,aAAA,WAAA,iBAAA,eAAA,cAAA;;MAoCMC,IAAI,GAAGC,8BAAAA;MAEPJ,WAAW,GAAGK,qBAAAA,CAAQN,eAARM,IAChBF,IAAI,CAACG,GAALH,CAAS,wBAATA,CADgBE,GAEhBN;;mBAEqCQ,mBAAAA;MAAlCC,WAAP;MAA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
|
@@ -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;;;;"}
|
@@ -1,77 +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-merge-refs
|
19
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/hooks/use-merge-refs#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
|
-
* A hook to merge multiple refs into a single function ref.
|
29
|
-
*
|
30
|
-
* @param refs
|
31
|
-
*/
|
32
|
-
|
33
|
-
|
34
|
-
var useMergeRefs = function useMergeRefs() {
|
35
|
-
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
36
|
-
refs[_key] = arguments[_key];
|
37
|
-
}
|
38
|
-
|
39
|
-
return React.useMemo(function () {
|
40
|
-
return mergeRefs.apply(void 0, refs);
|
41
|
-
}, refs);
|
42
|
-
};
|
43
|
-
/**
|
44
|
-
* Merges multiple refs into a single function ref.
|
45
|
-
*
|
46
|
-
* @param refs
|
47
|
-
* @returns
|
48
|
-
*/
|
49
|
-
|
50
|
-
|
51
|
-
function mergeRefs() {
|
52
|
-
for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
53
|
-
refs[_key2] = arguments[_key2];
|
54
|
-
} // Empty check
|
55
|
-
|
56
|
-
|
57
|
-
if (refs.some(function (ref) {
|
58
|
-
return ref;
|
59
|
-
}) === false) return null;
|
60
|
-
return function (value) {
|
61
|
-
refs.forEach(function (ref) {
|
62
|
-
setRef(ref, value);
|
63
|
-
});
|
64
|
-
};
|
65
|
-
}
|
66
|
-
|
67
|
-
function setRef(ref, value) {
|
68
|
-
if (typeof ref === 'function') {
|
69
|
-
ref(value);
|
70
|
-
} else if (ref) {
|
71
|
-
ref.current = value;
|
72
|
-
}
|
73
|
-
}
|
74
|
-
|
75
|
-
exports.mergeRefs = mergeRefs;
|
76
|
-
exports.useMergeRefs = useMergeRefs;
|
77
|
-
//# sourceMappingURL=index.js.map
|