@hi-ui/cascader 5.0.0-experimental.2 → 5.0.0-rc.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/CHANGELOG.md +38 -71
- package/lib/cjs/CascaderMenuList.js +32 -4
- package/lib/cjs/hooks/use-async-switch.js +18 -21
- package/lib/cjs/icons/index.js +7 -2
- package/lib/cjs/styles/index.scss.js +1 -1
- package/lib/esm/CascaderMenuList.js +33 -6
- package/lib/esm/hooks/use-async-switch.js +18 -21
- package/lib/esm/icons/index.js +8 -3
- package/lib/esm/styles/index.scss.js +1 -1
- package/lib/types/Cascader.d.ts +4 -4
- package/lib/types/CascaderMenuList.d.ts +1 -1
- package/lib/types/context.d.ts +14 -14
- package/lib/types/hooks/use-async-switch.d.ts +1 -1
- package/lib/types/hooks/use-select.d.ts +1 -1
- package/lib/types/icons/index.d.ts +1 -1
- package/lib/types/types.d.ts +2 -2
- package/lib/types/use-cascader.d.ts +2 -2
- package/lib/types/utils/index.d.ts +3 -3
- package/package.json +25 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,44 +1,6 @@
|
|
|
1
1
|
# @hi-ui/cascader
|
|
2
2
|
|
|
3
|
-
## 5.0.0-
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- 59cef699f: feat: 组件语义化样式改造,增加 styles 和 classNames 属性 (5.0)
|
|
8
|
-
|
|
9
|
-
### Patch Changes
|
|
10
|
-
|
|
11
|
-
- eb17c4697: style: 修复 UI/样式问题 (5.0)
|
|
12
|
-
- Updated dependencies [7f204c892]
|
|
13
|
-
- Updated dependencies [eb17c4697]
|
|
14
|
-
- Updated dependencies [eb17c4697]
|
|
15
|
-
- Updated dependencies [c407744fe]
|
|
16
|
-
- Updated dependencies [59cef699f]
|
|
17
|
-
- @hi-ui/icons@5.0.0-experimental.1
|
|
18
|
-
- @hi-ui/core@5.0.0-experimental.1
|
|
19
|
-
- @hi-ui/highlighter@5.0.0-experimental.1
|
|
20
|
-
- @hi-ui/input@5.0.0-experimental.2
|
|
21
|
-
- @hi-ui/picker@5.0.0-experimental.2
|
|
22
|
-
- @hi-ui/popper@5.0.0-experimental.1
|
|
23
|
-
- @hi-ui/virtual-list@5.0.0-experimental.1
|
|
24
|
-
- @hi-ui/use-merge-semantic@5.0.0-experimental.0
|
|
25
|
-
- @hi-ui/spinner@5.0.0-experimental.1
|
|
26
|
-
|
|
27
|
-
## 5.0.0-experimental.1
|
|
28
|
-
|
|
29
|
-
### Patch Changes
|
|
30
|
-
|
|
31
|
-
- 8f23e9322: style: 表单类组件统一调整后缀颜色、placeholder 颜色 (5.0)
|
|
32
|
-
- 发布 hiui experimental 版本
|
|
33
|
-
- 8561492d5: fix(cascader): 在平铺搜索模式下,当设置了 changeOnSelect 则搜索结果中展示父节点 (5.0)
|
|
34
|
-
- Updated dependencies [8f23e9322]
|
|
35
|
-
- Updated dependencies [b27483796]
|
|
36
|
-
- Updated dependencies [900c6c2f0]
|
|
37
|
-
- Updated dependencies
|
|
38
|
-
- @hi-ui/input@5.0.0-experimental.1
|
|
39
|
-
- @hi-ui/picker@5.0.0-experimental.1
|
|
40
|
-
|
|
41
|
-
## 5.0.0-experimental.0
|
|
3
|
+
## 5.0.0-rc.0
|
|
42
4
|
|
|
43
5
|
### Major Changes
|
|
44
6
|
|
|
@@ -53,19 +15,20 @@
|
|
|
53
15
|
- 3e1d3608f: feat(cascader): add onItemClick api (5.0)
|
|
54
16
|
- 6dca7795c: feat: 下拉选择组件增加 showIndicator 参数 & 修改 appearance 中的 unset 样式 (5.0)
|
|
55
17
|
- 77d969c2e: feat: 下拉选择类组件 appearance 参数增加 contained 类型 (5.0)
|
|
18
|
+
- bf1174ed8: feat(cascader): 每次打开选择面板时自动定位到已选节点位置 (5.0)
|
|
56
19
|
- 58ad82e94: feat: 输入框和选择器组件增加 borderless 形态 (5.0)
|
|
20
|
+
- 59cef699f: feat: 组件语义化样式改造,增加 styles 和 classNames 属性 (5.0)
|
|
57
21
|
|
|
58
22
|
### Patch Changes
|
|
59
23
|
|
|
60
|
-
- 6fb223e3a: style: fix ui bug (5.0)
|
|
61
|
-
- 1662753e0: style: fix ui bug (5.0)
|
|
62
24
|
- cf89262c7: style(picker): 移除 picker 组件中的 \_\_text 样式定义 (5.0)
|
|
63
25
|
- 9b34d99bc: fix: 修复 5.0 UI 问题 (5.0)
|
|
64
|
-
- be5a59325: style: 修改样式问题 (5.0)
|
|
65
26
|
- 79ea480f3: feat(global-context): 增加 size api 全局配置 (5.0)
|
|
66
27
|
- 2e56529f7: styles: 主题定制功能完善&&样式变量化写法改造&&兼容 RTL (5.0)
|
|
67
28
|
- eb718e940: fix: 修改组件问题 (5.0)
|
|
68
29
|
- 95abba983: fix: 修改 UI 问题 (5.0)
|
|
30
|
+
- 8f23e9322: style: 表单类组件统一调整后缀颜色、placeholder 颜色 (5.0)
|
|
31
|
+
- eb17c4697: style: 修复 UI/样式问题 (5.0)
|
|
69
32
|
- f3bf08f27: fix(cascader): 平铺搜索结果时不再展示不可点击的父节点 (5.0)
|
|
70
33
|
- de8d058dc: perf: 对下拉选择类组件的 customRender 的内容增加 memoization 以优化性能 (5.0)
|
|
71
34
|
- 5210770d9: feat(picker): add header api (5.0)
|
|
@@ -76,7 +39,6 @@
|
|
|
76
39
|
- feat(check-cascader): 增加 flattedSearchResult 属性,用于控制搜索结果的展现形式 (5.0)
|
|
77
40
|
- fix(cascader): 修复当搜索结果为空时,下拉框没有显示空状态问题 (5.0)
|
|
78
41
|
- 33da3144e: build: 将 package.json 中 exports 配置中的 types 配置放在最上面 (5.0)
|
|
79
|
-
- 7f3abee55: style: fix ui bug (5.0)
|
|
80
42
|
- 0a4e90dbd: <br>
|
|
81
43
|
- style(tag-input): 间距调整 (5.0)
|
|
82
44
|
- style(select): 选择类组件选项圆角改为 4px (5.0)
|
|
@@ -86,70 +48,75 @@
|
|
|
86
48
|
- style(cascader&check-cascader): 调整选项容器最小宽度为 160px (5.0)
|
|
87
49
|
- style(cascader&check-cascader): 优化下拉框宽度,让内容和搜索框默认宽度对齐 (5.0)
|
|
88
50
|
- perf(cascader&check-cascader): 优化 customRender 函数,支持传递选中项和当前值 (5.0)
|
|
51
|
+
- 8561492d5: fix(cascader): 在平铺搜索模式下,当设置了 changeOnSelect 则搜索结果中展示父节点 (5.0)
|
|
89
52
|
- 4a31cea53: style: 统一调整选择类组件 hover 时的背景色 (5.0)
|
|
90
53
|
- 99801c2d1: fix: 修复 UI 问题 (5.0)
|
|
91
54
|
- Updated dependencies [0b34e1c15]
|
|
92
55
|
- Updated dependencies [da2e63a14]
|
|
93
56
|
- Updated dependencies [1e226cd66]
|
|
94
57
|
- Updated dependencies [b9989e482]
|
|
95
|
-
- Updated dependencies [
|
|
58
|
+
- Updated dependencies [7f204c892]
|
|
96
59
|
- Updated dependencies [122d1d859]
|
|
97
60
|
- Updated dependencies [f1ab51725]
|
|
98
61
|
- Updated dependencies [41552be0b]
|
|
62
|
+
- Updated dependencies [eb17c4697]
|
|
99
63
|
- Updated dependencies [8c0ee78f0]
|
|
100
64
|
- Updated dependencies [9b34d99bc]
|
|
101
65
|
- Updated dependencies [8f3aa85e4]
|
|
102
|
-
- Updated dependencies [f4fc0ef30]
|
|
103
66
|
- Updated dependencies [ec4c7faa2]
|
|
104
67
|
- Updated dependencies [29cae09ea]
|
|
105
68
|
- Updated dependencies [fd4c20bbd]
|
|
106
|
-
- Updated dependencies [be5a59325]
|
|
107
|
-
- Updated dependencies [71fc15e5c]
|
|
108
69
|
- Updated dependencies [79ea480f3]
|
|
109
70
|
- Updated dependencies [2e56529f7]
|
|
71
|
+
- Updated dependencies [3a7186e4b]
|
|
110
72
|
- Updated dependencies [277c5033a]
|
|
111
73
|
- Updated dependencies [95abba983]
|
|
74
|
+
- Updated dependencies [8f23e9322]
|
|
112
75
|
- Updated dependencies [4a31cea53]
|
|
76
|
+
- Updated dependencies [b27483796]
|
|
77
|
+
- Updated dependencies [eb17c4697]
|
|
113
78
|
- Updated dependencies [976ec929d]
|
|
114
79
|
- Updated dependencies [f1ab51725]
|
|
115
80
|
- Updated dependencies [6dca7795c]
|
|
81
|
+
- Updated dependencies [900c6c2f0]
|
|
116
82
|
- Updated dependencies [7b956b1eb]
|
|
117
83
|
- Updated dependencies [5210770d9]
|
|
118
|
-
- Updated dependencies [e2d184e74]
|
|
119
84
|
- Updated dependencies [4006b2c8c]
|
|
85
|
+
- Updated dependencies [c407744fe]
|
|
86
|
+
- Updated dependencies [d91a8bb0f]
|
|
120
87
|
- Updated dependencies [77d969c2e]
|
|
121
88
|
- Updated dependencies [e42e2badf]
|
|
122
89
|
- Updated dependencies [33da3144e]
|
|
123
|
-
- Updated dependencies [7f3abee55]
|
|
124
90
|
- Updated dependencies [6fcda9bf2]
|
|
125
91
|
- Updated dependencies [0a4e90dbd]
|
|
126
92
|
- Updated dependencies [58ad82e94]
|
|
127
|
-
- Updated dependencies [
|
|
93
|
+
- Updated dependencies [95d930354]
|
|
128
94
|
- Updated dependencies [f2be367e9]
|
|
129
95
|
- Updated dependencies [1972fd16a]
|
|
96
|
+
- Updated dependencies [59cef699f]
|
|
130
97
|
- Updated dependencies [99801c2d1]
|
|
131
|
-
- Updated dependencies [86910f5e2]
|
|
132
98
|
- Updated dependencies [cb7b794d0]
|
|
133
|
-
- @hi-ui/picker@5.0.0-
|
|
134
|
-
- @hi-ui/input@5.0.0-
|
|
135
|
-
- @hi-ui/popper@5.0.0-
|
|
136
|
-
- @hi-ui/icons@5.0.0-
|
|
137
|
-
- @hi-ui/
|
|
138
|
-
- @hi-ui/
|
|
139
|
-
- @hi-ui/use-
|
|
140
|
-
- @hi-ui/use-
|
|
141
|
-
- @hi-ui/use-
|
|
142
|
-
- @hi-ui/use-
|
|
143
|
-
- @hi-ui/use-
|
|
144
|
-
- @hi-ui/
|
|
145
|
-
- @hi-ui/
|
|
146
|
-
- @hi-ui/
|
|
147
|
-
- @hi-ui/array-utils@5.0.0-
|
|
148
|
-
- @hi-ui/classname@5.0.0-
|
|
149
|
-
- @hi-ui/env@5.0.0-
|
|
150
|
-
- @hi-ui/func-utils@5.0.0-
|
|
151
|
-
- @hi-ui/tree-utils@5.0.0-
|
|
152
|
-
- @hi-ui/type-assertion@5.0.0-
|
|
99
|
+
- @hi-ui/picker@5.0.0-rc.0
|
|
100
|
+
- @hi-ui/input@5.0.0-rc.0
|
|
101
|
+
- @hi-ui/popper@5.0.0-rc.0
|
|
102
|
+
- @hi-ui/icons@5.0.0-rc.0
|
|
103
|
+
- @hi-ui/core@5.0.0-rc.0
|
|
104
|
+
- @hi-ui/use-check-state@5.0.0-rc.0
|
|
105
|
+
- @hi-ui/use-data-source@5.0.0-rc.0
|
|
106
|
+
- @hi-ui/use-latest@5.0.0-rc.0
|
|
107
|
+
- @hi-ui/use-search-mode@5.0.0-rc.0
|
|
108
|
+
- @hi-ui/use-toggle@5.0.0-rc.0
|
|
109
|
+
- @hi-ui/use-uncontrolled-state@5.0.0-rc.0
|
|
110
|
+
- @hi-ui/highlighter@5.0.0-rc.0
|
|
111
|
+
- @hi-ui/spinner@5.0.0-rc.0
|
|
112
|
+
- @hi-ui/virtual-list@5.0.0-rc.0
|
|
113
|
+
- @hi-ui/array-utils@5.0.0-rc.0
|
|
114
|
+
- @hi-ui/classname@5.0.0-rc.0
|
|
115
|
+
- @hi-ui/env@5.0.0-rc.0
|
|
116
|
+
- @hi-ui/func-utils@5.0.0-rc.0
|
|
117
|
+
- @hi-ui/tree-utils@5.0.0-rc.0
|
|
118
|
+
- @hi-ui/type-assertion@5.0.0-rc.0
|
|
119
|
+
- @hi-ui/use-merge-semantic@5.0.0-rc.0
|
|
153
120
|
|
|
154
121
|
## 4.5.2
|
|
155
122
|
|
|
@@ -22,6 +22,7 @@ var index = require('./utils/index.js');
|
|
|
22
22
|
var context = require('./context.js');
|
|
23
23
|
var treeUtils = require('@hi-ui/tree-utils');
|
|
24
24
|
var typeAssertion = require('@hi-ui/type-assertion');
|
|
25
|
+
var scrollIntoView = require('scroll-into-view-if-needed');
|
|
25
26
|
var VirtualList = require('@hi-ui/virtual-list');
|
|
26
27
|
function _interopDefaultCompat(e) {
|
|
27
28
|
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
@@ -29,6 +30,7 @@ function _interopDefaultCompat(e) {
|
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
32
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
33
|
+
var scrollIntoView__default = /*#__PURE__*/_interopDefaultCompat(scrollIntoView);
|
|
32
34
|
var VirtualList__default = /*#__PURE__*/_interopDefaultCompat(VirtualList);
|
|
33
35
|
var menuListPrefix = classname.getPrefixCls('cascader-menu-list');
|
|
34
36
|
var CascaderMenuList = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
@@ -82,6 +84,26 @@ var CascaderMenu = function CascaderMenu(_ref) {
|
|
|
82
84
|
height: 260,
|
|
83
85
|
itemHeight: 32
|
|
84
86
|
};
|
|
87
|
+
var activeNodeRef = React.useRef();
|
|
88
|
+
var _useState = React.useState(null),
|
|
89
|
+
activeNode = _useState[0],
|
|
90
|
+
setActiveNode = _useState[1];
|
|
91
|
+
var timeoutId = React.useRef(null);
|
|
92
|
+
React.useEffect(function () {
|
|
93
|
+
if (activeNode) {
|
|
94
|
+
timeoutId.current = setTimeout(function () {
|
|
95
|
+
scrollIntoView__default["default"](activeNode, {
|
|
96
|
+
scrollMode: 'if-needed',
|
|
97
|
+
block: 'center'
|
|
98
|
+
});
|
|
99
|
+
}, 100);
|
|
100
|
+
}
|
|
101
|
+
return function () {
|
|
102
|
+
if (timeoutId.current) {
|
|
103
|
+
clearTimeout(timeoutId.current);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}, [activeNode, activeNodeRef, virtual]);
|
|
85
107
|
return /*#__PURE__*/React__default["default"].createElement("ul", {
|
|
86
108
|
className: cls,
|
|
87
109
|
style: menuStyle,
|
|
@@ -99,13 +121,15 @@ var CascaderMenu = function CascaderMenu(_ref) {
|
|
|
99
121
|
return /*#__PURE__*/React__default["default"].createElement(MenuItem, {
|
|
100
122
|
key: option.id,
|
|
101
123
|
option: option,
|
|
102
|
-
prefixCls: prefixCls
|
|
124
|
+
prefixCls: prefixCls,
|
|
125
|
+
setActiveNode: setActiveNode
|
|
103
126
|
});
|
|
104
127
|
}) : null);
|
|
105
128
|
};
|
|
106
129
|
var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
107
130
|
var option = _ref2.option,
|
|
108
|
-
prefixCls = _ref2.prefixCls
|
|
131
|
+
prefixCls = _ref2.prefixCls,
|
|
132
|
+
setActiveNode = _ref2.setActiveNode;
|
|
109
133
|
var _useCascaderContext3 = context.useCascaderContext(),
|
|
110
134
|
flatted = _useCascaderContext3.flatted,
|
|
111
135
|
disabledContext = _useCascaderContext3.disabled,
|
|
@@ -125,7 +149,11 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
|
125
149
|
var disabled = disabledContext || option.disabled;
|
|
126
150
|
var optionCls = classname.cx(prefixCls + "-option", active && prefixCls + "-option--active", loading && prefixCls + "-option--loading", disabled && prefixCls + "-option--disabled", selected && prefixCls + "-option--selected", classNames === null || classNames === void 0 ? void 0 : classNames.option);
|
|
127
151
|
return /*#__PURE__*/React__default["default"].createElement("li", {
|
|
128
|
-
ref: ref
|
|
152
|
+
ref: function ref(node) {
|
|
153
|
+
if (node && active) {
|
|
154
|
+
setActiveNode === null || setActiveNode === void 0 ? void 0 : setActiveNode(node);
|
|
155
|
+
}
|
|
156
|
+
},
|
|
129
157
|
key: option.id,
|
|
130
158
|
role: "menu-item",
|
|
131
159
|
className: prefixCls + "-item",
|
|
@@ -162,7 +190,7 @@ var renderSuffix = function renderSuffix(prefixCls, item, loading, onLoadChildre
|
|
|
162
190
|
if (canLoadChildren) {
|
|
163
191
|
return /*#__PURE__*/React__default["default"].createElement("span", {
|
|
164
192
|
className: classname.cx(prefixCls + "-switcher", prefixCls + "-switcher--arrow")
|
|
165
|
-
}, index$1.
|
|
193
|
+
}, /*#__PURE__*/React__default["default"].createElement(index$1.DefaultSuffixIcon, null));
|
|
166
194
|
}
|
|
167
195
|
return /*#__PURE__*/React__default["default"].createElement("span", {
|
|
168
196
|
className: classname.cx(prefixCls + "-switcher", prefixCls + "-switcher--noop")
|
|
@@ -62,56 +62,53 @@ var useAsyncSwitch = function useAsyncSwitch(setCascaderData, onExpand, onLoadCh
|
|
|
62
62
|
addLoadingIds = _useCheckState.add,
|
|
63
63
|
removeLoadingIds = _useCheckState.remove;
|
|
64
64
|
var onExpandLatest = useLatest.useLatestCallback(onExpand);
|
|
65
|
-
var onNodeSwitch = React.useCallback(function (
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
var onNodeSwitch = React.useCallback(function (node, onlyExpand) {
|
|
66
|
+
if (onlyExpand === void 0) {
|
|
67
|
+
onlyExpand = false;
|
|
68
68
|
}
|
|
69
|
-
return tslib.__awaiter(void 0,
|
|
69
|
+
return tslib.__awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2() {
|
|
70
70
|
var id, children, isLeaf;
|
|
71
71
|
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
|
|
72
72
|
while (1) {
|
|
73
73
|
switch (_context2.prev = _context2.next) {
|
|
74
74
|
case 0:
|
|
75
|
-
if (onlyExpand === void 0) {
|
|
76
|
-
onlyExpand = false;
|
|
77
|
-
}
|
|
78
75
|
// 直接触发选中该节点
|
|
79
76
|
onExpandLatest(node, onlyExpand);
|
|
80
77
|
id = node.id, children = node.children, isLeaf = node.isLeaf;
|
|
81
78
|
if (!children) {
|
|
82
|
-
_context2.next =
|
|
79
|
+
_context2.next = 4;
|
|
83
80
|
break;
|
|
84
81
|
}
|
|
85
82
|
return _context2.abrupt("return");
|
|
86
|
-
case
|
|
83
|
+
case 4:
|
|
87
84
|
if (!isLeaf) {
|
|
88
|
-
_context2.next =
|
|
85
|
+
_context2.next = 6;
|
|
89
86
|
break;
|
|
90
87
|
}
|
|
91
88
|
return _context2.abrupt("return");
|
|
92
|
-
case
|
|
89
|
+
case 6:
|
|
93
90
|
if (!onLoadChildren) {
|
|
94
|
-
_context2.next =
|
|
91
|
+
_context2.next = 17;
|
|
95
92
|
break;
|
|
96
93
|
}
|
|
97
94
|
addLoadingIds(id);
|
|
98
|
-
_context2.prev =
|
|
99
|
-
_context2.next =
|
|
95
|
+
_context2.prev = 8;
|
|
96
|
+
_context2.next = 11;
|
|
100
97
|
return loadChildren(node);
|
|
101
|
-
case
|
|
98
|
+
case 11:
|
|
102
99
|
removeLoadingIds(id);
|
|
103
|
-
_context2.next =
|
|
100
|
+
_context2.next = 17;
|
|
104
101
|
break;
|
|
105
|
-
case
|
|
106
|
-
_context2.prev =
|
|
107
|
-
_context2.t0 = _context2["catch"](
|
|
102
|
+
case 14:
|
|
103
|
+
_context2.prev = 14;
|
|
104
|
+
_context2.t0 = _context2["catch"](8);
|
|
108
105
|
removeLoadingIds(id);
|
|
109
|
-
case
|
|
106
|
+
case 17:
|
|
110
107
|
case "end":
|
|
111
108
|
return _context2.stop();
|
|
112
109
|
}
|
|
113
110
|
}
|
|
114
|
-
}, _callee2, null, [[
|
|
111
|
+
}, _callee2, null, [[8, 14]]);
|
|
115
112
|
}));
|
|
116
113
|
}, [loadChildren, onLoadChildren, onExpandLatest, addLoadingIds, removeLoadingIds]);
|
|
117
114
|
return [isLoadingId, onNodeSwitch];
|
package/lib/cjs/icons/index.js
CHANGED
|
@@ -16,17 +16,22 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
16
16
|
var React = require('react');
|
|
17
17
|
var icons = require('@hi-ui/icons');
|
|
18
18
|
var spinner = require('@hi-ui/spinner');
|
|
19
|
+
var core = require('@hi-ui/core');
|
|
19
20
|
function _interopDefaultCompat(e) {
|
|
20
21
|
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
21
22
|
'default': e
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
25
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
25
|
-
var
|
|
26
|
+
var DefaultSuffixIcon = function DefaultSuffixIcon() {
|
|
27
|
+
var _useGlobalContext = core.useGlobalContext(),
|
|
28
|
+
direction = _useGlobalContext.direction;
|
|
29
|
+
return direction === 'rtl' ? /*#__PURE__*/React__default["default"].createElement(icons.LeftOutlined, null) : /*#__PURE__*/React__default["default"].createElement(icons.RightOutlined, null);
|
|
30
|
+
};
|
|
26
31
|
var defaultLeafIcon = null;
|
|
27
32
|
var defaultLoadingIcon = /*#__PURE__*/React__default["default"].createElement(spinner.Spinner, {
|
|
28
33
|
size: "sm"
|
|
29
34
|
});
|
|
35
|
+
exports.DefaultSuffixIcon = DefaultSuffixIcon;
|
|
30
36
|
exports.defaultLeafIcon = defaultLeafIcon;
|
|
31
37
|
exports.defaultLoadingIcon = defaultLoadingIcon;
|
|
32
|
-
exports.defaultSuffixIcon = defaultSuffixIcon;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
Object.defineProperty(exports, '__esModule', {
|
|
13
13
|
value: true
|
|
14
14
|
});
|
|
15
|
-
var css_248z = "@charset \"UTF-8\";.hi-v5-cascader__popper .hi-v5-picker__panel {-webkit-box-sizing: border-box;box-sizing: border-box;min-width: 160px;}.hi-v5-cascader__popper .hi-v5-picker__search .hi-v5-input__text {width: 100px;}.hi-v5-cascader__popper .hi-v5-picker__body {padding: 0;overflow-y: hidden;}.hi-v5-cascader__popper .hi-v5-picker__loading, .hi-v5-cascader__popper .hi-v5-picker__empty {padding: var(--hi-v5-spacing-5, 10px) var(--hi-v5-spacing-8, 16px);}.hi-v5-cascader-panel {white-space: nowrap;-webkit-box-sizing: border-box;box-sizing: border-box;font-size: var(--hi-v5-text-size-md, 0.875rem);color: var(--hi-v5-color-gray-800, #1a1d26);}.hi-v5-cascader-search {-webkit-box-sizing: border-box;box-sizing: border-box;padding: 0 var(--hi-v5-spacing-5, 10px) var(--hi-v5-spacing-5, 10px);position: relative;}.hi-v5-cascader-search .hi-v5-input__prefix {font-size: var(--hi-v5-text-size-lg, 1rem);-webkit-padding-start: 0;padding-inline-start: 0;}.hi-v5-cascader-search__empty {display: inline-block;-webkit-margin-before: var(--hi-v5-spacing-10, 20px);margin-block-start: var(--hi-v5-spacing-10, 20px);font-size: var(--hi-v5-text-size-md, 0.875rem);font-weight: var(--hi-v5-text-weight-normal, 400);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);color: var(--hi-v5-color-gray-800, #1a1d26);}.hi-v5-cascader-menu-list {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-sizing: border-box;box-sizing: border-box;overflow-x: auto;}.hi-v5-cascader-menu-list--flatted .hi-v5-cascader-menu {-ms-flex-preferred-size: 100%;flex-basis: 100%;}.hi-v5-cascader-menu {-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;border: none;outline: none;font-size: var(--hi-v5-text-size-md, 0.875rem);vertical-align: middle;list-style: none;width: auto;box-sizing: border-box;-ms-flex-negative: 0;flex-shrink: 0;display: inline-block;min-width: 160px;max-height: 260px;overflow: auto;padding: var(--hi-v5-spacing-2, 4px);}.hi-v5-cascader-menu:not(:last-of-type) {-webkit-border-end: var(--hi-v5-border-size-normal, 1px solid) var(--hi-v5-color-gray-300, #e6e8eb);border-inline-end: var(--hi-v5-border-size-normal, 1px solid) var(--hi-v5-color-gray-300, #e6e8eb);}.hi-v5-cascader-menu-item {width: 100%;position: relative;cursor: pointer;display: -webkit-box;display: -ms-flexbox;display: flex;}.hi-v5-cascader-menu-option {padding: var(--hi-v5-spacing-1, 2px) var(--hi-v5-spacing-4, 8px);-webkit-box-sizing: border-box;box-sizing: border-box;height: var(--hi-v5-height-8, 32px);width: 100%;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;position: relative;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;border-radius: var(--hi-v5-border-radius-md, 4px);white-space: nowrap;}.hi-v5-cascader-menu-option:hover {background-color: var(--hi-v5-color-gray-100, #f2f4f7);}.hi-v5-cascader-menu-option.hi-v5-cascader-menu-option--selected {background-color: var(--hi-v5-color-primary-50, var(--hi-v5-color-brandblue-50, #edf2ff));color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-cascader-menu-option.hi-v5-cascader-menu-option--selected .hi-v5-cascader-menu-switcher {color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-cascader-menu-option--focused {background-color: var(--hi-v5-color-primary-50, var(--hi-v5-color-brandblue-50, #edf2ff));}.hi-v5-cascader-menu-option--checked {font-weight: var(--hi-v5-text-weight-bold, 700);}.hi-v5-cascader-menu-option.hi-v5-cascader-menu-option--disabled {cursor: not-allowed;color: var(--hi-v5-color-gray-600, #91959e);background: transparent;}.hi-v5-cascader-menu-option.hi-v5-cascader-menu-option--disabled .hi-v5-cascader-menu-switcher {color: var(--hi-v5-color-gray-500, #babcc2);}.hi-v5-cascader-menu .title__text {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}.hi-v5-cascader-menu .title__text--cols {display: block;width: 100%;-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;border: none;outline: none;font-size: var(--hi-v5-text-size-md, 0.875rem);vertical-align: middle;list-style: none;}.hi-v5-cascader-menu .title__text--col {display: inline-block;}.hi-v5-cascader-menu .title__text--col::after {content: \" / \";}.hi-v5-cascader-menu .title__text--col:last-child::after {content: none;}.hi-v5-cascader-menu .title__text--matched {color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-cascader-menu-switcher {-ms-flex-negative: 0;flex-shrink: 0;font-size: var(--hi-v5-text-size-lg, 1rem);color: var(--hi-v5-color-gray-600, #91959e);}.hi-v5-cascader-menu-switcher--loading {color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-
|
|
15
|
+
var css_248z = "@charset \"UTF-8\";.hi-v5-cascader__popper .hi-v5-picker__panel {-webkit-box-sizing: border-box;box-sizing: border-box;min-width: 160px;}.hi-v5-cascader__popper .hi-v5-picker__search .hi-v5-input__text {width: 100px;}.hi-v5-cascader__popper .hi-v5-picker__body {padding: 0;overflow-y: hidden;}.hi-v5-cascader__popper .hi-v5-picker__loading, .hi-v5-cascader__popper .hi-v5-picker__empty {padding: var(--hi-v5-spacing-5, 10px) var(--hi-v5-spacing-8, 16px);}.hi-v5-cascader-panel {white-space: nowrap;-webkit-box-sizing: border-box;box-sizing: border-box;font-size: var(--hi-v5-text-size-md, 0.875rem);color: var(--hi-v5-color-gray-800, #1a1d26);}.hi-v5-cascader-search {-webkit-box-sizing: border-box;box-sizing: border-box;padding: 0 var(--hi-v5-spacing-5, 10px) var(--hi-v5-spacing-5, 10px);position: relative;}.hi-v5-cascader-search .hi-v5-input__prefix {font-size: var(--hi-v5-text-size-lg, 1rem);-webkit-padding-start: 0;padding-inline-start: 0;}.hi-v5-cascader-search__empty {display: inline-block;-webkit-margin-before: var(--hi-v5-spacing-10, 20px);margin-block-start: var(--hi-v5-spacing-10, 20px);font-size: var(--hi-v5-text-size-md, 0.875rem);font-weight: var(--hi-v5-text-weight-normal, 400);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);color: var(--hi-v5-color-gray-800, #1a1d26);}.hi-v5-cascader-menu-list {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-sizing: border-box;box-sizing: border-box;overflow-x: auto;}.hi-v5-cascader-menu-list--flatted .hi-v5-cascader-menu {-ms-flex-preferred-size: 100%;flex-basis: 100%;}.hi-v5-cascader-menu {-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;border: none;outline: none;font-size: var(--hi-v5-text-size-md, 0.875rem);vertical-align: middle;list-style: none;width: auto;box-sizing: border-box;-ms-flex-negative: 0;flex-shrink: 0;display: inline-block;min-width: 160px;max-height: 260px;overflow: auto;padding: var(--hi-v5-spacing-2, 4px);}.hi-v5-cascader-menu:not(:last-of-type) {-webkit-border-end: var(--hi-v5-border-size-normal, 1px solid) var(--hi-v5-color-gray-300, #e6e8eb);border-inline-end: var(--hi-v5-border-size-normal, 1px solid) var(--hi-v5-color-gray-300, #e6e8eb);}.hi-v5-cascader-menu-item {width: 100%;position: relative;cursor: pointer;display: -webkit-box;display: -ms-flexbox;display: flex;}.hi-v5-cascader-menu-option {padding: var(--hi-v5-spacing-1, 2px) var(--hi-v5-spacing-4, 8px);-webkit-box-sizing: border-box;box-sizing: border-box;height: var(--hi-v5-height-8, 32px);width: 100%;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;position: relative;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;border-radius: var(--hi-v5-border-radius-md, 4px);white-space: nowrap;}.hi-v5-cascader-menu-option:hover {background-color: var(--hi-v5-color-gray-100, #f2f4f7);}.hi-v5-cascader-menu-option.hi-v5-cascader-menu-option--selected {background-color: var(--hi-v5-color-primary-50, var(--hi-v5-color-brandblue-50, #edf2ff));color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-cascader-menu-option.hi-v5-cascader-menu-option--selected .hi-v5-cascader-menu-switcher {color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-cascader-menu-option--focused {background-color: var(--hi-v5-color-primary-50, var(--hi-v5-color-brandblue-50, #edf2ff));}.hi-v5-cascader-menu-option--checked {font-weight: var(--hi-v5-text-weight-bold, 700);}.hi-v5-cascader-menu-option.hi-v5-cascader-menu-option--disabled {cursor: not-allowed;color: var(--hi-v5-color-gray-600, #91959e);background: transparent;}.hi-v5-cascader-menu-option.hi-v5-cascader-menu-option--disabled .hi-v5-cascader-menu-switcher {color: var(--hi-v5-color-gray-500, #babcc2);}.hi-v5-cascader-menu .title__text {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}.hi-v5-cascader-menu .title__text--cols {display: block;width: 100%;-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;border: none;outline: none;font-size: var(--hi-v5-text-size-md, 0.875rem);vertical-align: middle;list-style: none;}.hi-v5-cascader-menu .title__text--col {display: inline-block;}.hi-v5-cascader-menu .title__text--col::after {content: \" / \";}.hi-v5-cascader-menu .title__text--col:last-child::after {content: none;}.hi-v5-cascader-menu .title__text--matched {color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-cascader-menu-switcher {-ms-flex-negative: 0;flex-shrink: 0;font-size: var(--hi-v5-text-size-lg, 1rem);color: var(--hi-v5-color-gray-600, #91959e);}.hi-v5-cascader-menu-switcher--loading {color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-cascader__icon--loading {display: inline-block;width: 1em;height: 1em;stroke: none;cursor: default;fill: currentColor;}.hi-v5-cascader__icon--loading svg {-webkit-animation-name: hi-rotate;animation-name: hi-rotate;-webkit-animation-duration: 2s;animation-duration: 2s;-webkit-animation-iteration-count: infinite;animation-iteration-count: infinite;}@-webkit-keyframes rotate {to {-webkit-transform: rotate(360deg);transform: rotate(360deg);}}@keyframes rotate {to {-webkit-transform: rotate(360deg);transform: rotate(360deg);}}";
|
|
16
16
|
var __styleInject__ = require('@hi-ui/style-inject')["default"];
|
|
17
17
|
__styleInject__(css_248z);
|
|
18
18
|
exports["default"] = css_248z;
|
|
@@ -8,14 +8,15 @@
|
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
10
|
import { __rest } from 'tslib';
|
|
11
|
-
import React, { forwardRef } from 'react';
|
|
11
|
+
import React, { forwardRef, useRef, useState, useEffect } from 'react';
|
|
12
12
|
import { getPrefixCls, cx } from '@hi-ui/classname';
|
|
13
13
|
import { __DEV__ } from '@hi-ui/env';
|
|
14
|
-
import { defaultLoadingIcon,
|
|
14
|
+
import { defaultLoadingIcon, DefaultSuffixIcon, defaultLeafIcon } from './icons/index.js';
|
|
15
15
|
import { getItemEventData, checkCanLoadChildren } from './utils/index.js';
|
|
16
16
|
import { useCascaderContext } from './context.js';
|
|
17
17
|
import { getTopDownAncestors } from '@hi-ui/tree-utils';
|
|
18
18
|
import { isArrayNonEmpty, isFunction } from '@hi-ui/type-assertion';
|
|
19
|
+
import scrollIntoView from 'scroll-into-view-if-needed';
|
|
19
20
|
import VirtualList from '@hi-ui/virtual-list';
|
|
20
21
|
var menuListPrefix = getPrefixCls('cascader-menu-list');
|
|
21
22
|
var CascaderMenuList = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
@@ -69,6 +70,26 @@ var CascaderMenu = function CascaderMenu(_ref) {
|
|
|
69
70
|
height: 260,
|
|
70
71
|
itemHeight: 32
|
|
71
72
|
};
|
|
73
|
+
var activeNodeRef = useRef();
|
|
74
|
+
var _useState = useState(null),
|
|
75
|
+
activeNode = _useState[0],
|
|
76
|
+
setActiveNode = _useState[1];
|
|
77
|
+
var timeoutId = useRef(null);
|
|
78
|
+
useEffect(function () {
|
|
79
|
+
if (activeNode) {
|
|
80
|
+
timeoutId.current = setTimeout(function () {
|
|
81
|
+
scrollIntoView(activeNode, {
|
|
82
|
+
scrollMode: 'if-needed',
|
|
83
|
+
block: 'center'
|
|
84
|
+
});
|
|
85
|
+
}, 100);
|
|
86
|
+
}
|
|
87
|
+
return function () {
|
|
88
|
+
if (timeoutId.current) {
|
|
89
|
+
clearTimeout(timeoutId.current);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}, [activeNode, activeNodeRef, virtual]);
|
|
72
93
|
return /*#__PURE__*/React.createElement("ul", {
|
|
73
94
|
className: cls,
|
|
74
95
|
style: menuStyle,
|
|
@@ -86,13 +107,15 @@ var CascaderMenu = function CascaderMenu(_ref) {
|
|
|
86
107
|
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
87
108
|
key: option.id,
|
|
88
109
|
option: option,
|
|
89
|
-
prefixCls: prefixCls
|
|
110
|
+
prefixCls: prefixCls,
|
|
111
|
+
setActiveNode: setActiveNode
|
|
90
112
|
});
|
|
91
113
|
}) : null);
|
|
92
114
|
};
|
|
93
115
|
var MenuItem = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
94
116
|
var option = _ref2.option,
|
|
95
|
-
prefixCls = _ref2.prefixCls
|
|
117
|
+
prefixCls = _ref2.prefixCls,
|
|
118
|
+
setActiveNode = _ref2.setActiveNode;
|
|
96
119
|
var _useCascaderContext3 = useCascaderContext(),
|
|
97
120
|
flatted = _useCascaderContext3.flatted,
|
|
98
121
|
disabledContext = _useCascaderContext3.disabled,
|
|
@@ -112,7 +135,11 @@ var MenuItem = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
112
135
|
var disabled = disabledContext || option.disabled;
|
|
113
136
|
var optionCls = cx(prefixCls + "-option", active && prefixCls + "-option--active", loading && prefixCls + "-option--loading", disabled && prefixCls + "-option--disabled", selected && prefixCls + "-option--selected", classNames === null || classNames === void 0 ? void 0 : classNames.option);
|
|
114
137
|
return /*#__PURE__*/React.createElement("li", {
|
|
115
|
-
ref: ref
|
|
138
|
+
ref: function ref(node) {
|
|
139
|
+
if (node && active) {
|
|
140
|
+
setActiveNode === null || setActiveNode === void 0 ? void 0 : setActiveNode(node);
|
|
141
|
+
}
|
|
142
|
+
},
|
|
116
143
|
key: option.id,
|
|
117
144
|
role: "menu-item",
|
|
118
145
|
className: prefixCls + "-item",
|
|
@@ -149,7 +176,7 @@ var renderSuffix = function renderSuffix(prefixCls, item, loading, onLoadChildre
|
|
|
149
176
|
if (canLoadChildren) {
|
|
150
177
|
return /*#__PURE__*/React.createElement("span", {
|
|
151
178
|
className: cx(prefixCls + "-switcher", prefixCls + "-switcher--arrow")
|
|
152
|
-
},
|
|
179
|
+
}, /*#__PURE__*/React.createElement(DefaultSuffixIcon, null));
|
|
153
180
|
}
|
|
154
181
|
return /*#__PURE__*/React.createElement("span", {
|
|
155
182
|
className: cx(prefixCls + "-switcher", prefixCls + "-switcher--noop")
|
|
@@ -50,56 +50,53 @@ var useAsyncSwitch = function useAsyncSwitch(setCascaderData, onExpand, onLoadCh
|
|
|
50
50
|
addLoadingIds = _useCheckState.add,
|
|
51
51
|
removeLoadingIds = _useCheckState.remove;
|
|
52
52
|
var onExpandLatest = useLatestCallback(onExpand);
|
|
53
|
-
var onNodeSwitch = useCallback(function (
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
var onNodeSwitch = useCallback(function (node, onlyExpand) {
|
|
54
|
+
if (onlyExpand === void 0) {
|
|
55
|
+
onlyExpand = false;
|
|
56
56
|
}
|
|
57
|
-
return __awaiter(void 0,
|
|
57
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
58
58
|
var id, children, isLeaf;
|
|
59
59
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
60
60
|
while (1) {
|
|
61
61
|
switch (_context2.prev = _context2.next) {
|
|
62
62
|
case 0:
|
|
63
|
-
if (onlyExpand === void 0) {
|
|
64
|
-
onlyExpand = false;
|
|
65
|
-
}
|
|
66
63
|
// 直接触发选中该节点
|
|
67
64
|
onExpandLatest(node, onlyExpand);
|
|
68
65
|
id = node.id, children = node.children, isLeaf = node.isLeaf;
|
|
69
66
|
if (!children) {
|
|
70
|
-
_context2.next =
|
|
67
|
+
_context2.next = 4;
|
|
71
68
|
break;
|
|
72
69
|
}
|
|
73
70
|
return _context2.abrupt("return");
|
|
74
|
-
case
|
|
71
|
+
case 4:
|
|
75
72
|
if (!isLeaf) {
|
|
76
|
-
_context2.next =
|
|
73
|
+
_context2.next = 6;
|
|
77
74
|
break;
|
|
78
75
|
}
|
|
79
76
|
return _context2.abrupt("return");
|
|
80
|
-
case
|
|
77
|
+
case 6:
|
|
81
78
|
if (!onLoadChildren) {
|
|
82
|
-
_context2.next =
|
|
79
|
+
_context2.next = 17;
|
|
83
80
|
break;
|
|
84
81
|
}
|
|
85
82
|
addLoadingIds(id);
|
|
86
|
-
_context2.prev =
|
|
87
|
-
_context2.next =
|
|
83
|
+
_context2.prev = 8;
|
|
84
|
+
_context2.next = 11;
|
|
88
85
|
return loadChildren(node);
|
|
89
|
-
case
|
|
86
|
+
case 11:
|
|
90
87
|
removeLoadingIds(id);
|
|
91
|
-
_context2.next =
|
|
88
|
+
_context2.next = 17;
|
|
92
89
|
break;
|
|
93
|
-
case
|
|
94
|
-
_context2.prev =
|
|
95
|
-
_context2.t0 = _context2["catch"](
|
|
90
|
+
case 14:
|
|
91
|
+
_context2.prev = 14;
|
|
92
|
+
_context2.t0 = _context2["catch"](8);
|
|
96
93
|
removeLoadingIds(id);
|
|
97
|
-
case
|
|
94
|
+
case 17:
|
|
98
95
|
case "end":
|
|
99
96
|
return _context2.stop();
|
|
100
97
|
}
|
|
101
98
|
}
|
|
102
|
-
}, _callee2, null, [[
|
|
99
|
+
}, _callee2, null, [[8, 14]]);
|
|
103
100
|
}));
|
|
104
101
|
}, [loadChildren, onLoadChildren, onExpandLatest, addLoadingIds, removeLoadingIds]);
|
|
105
102
|
return [isLoadingId, onNodeSwitch];
|
package/lib/esm/icons/index.js
CHANGED
|
@@ -8,11 +8,16 @@
|
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
10
|
import React from 'react';
|
|
11
|
-
import {
|
|
11
|
+
import { LeftOutlined, RightOutlined } from '@hi-ui/icons';
|
|
12
12
|
import { Spinner } from '@hi-ui/spinner';
|
|
13
|
-
|
|
13
|
+
import { useGlobalContext } from '@hi-ui/core';
|
|
14
|
+
var DefaultSuffixIcon = function DefaultSuffixIcon() {
|
|
15
|
+
var _useGlobalContext = useGlobalContext(),
|
|
16
|
+
direction = _useGlobalContext.direction;
|
|
17
|
+
return direction === 'rtl' ? /*#__PURE__*/React.createElement(LeftOutlined, null) : /*#__PURE__*/React.createElement(RightOutlined, null);
|
|
18
|
+
};
|
|
14
19
|
var defaultLeafIcon = null;
|
|
15
20
|
var defaultLoadingIcon = /*#__PURE__*/React.createElement(Spinner, {
|
|
16
21
|
size: "sm"
|
|
17
22
|
});
|
|
18
|
-
export { defaultLeafIcon, defaultLoadingIcon
|
|
23
|
+
export { DefaultSuffixIcon, defaultLeafIcon, defaultLoadingIcon };
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
10
|
import __styleInject__ from '@hi-ui/style-inject';
|
|
11
|
-
var css_248z = "@charset \"UTF-8\";.hi-v5-cascader__popper .hi-v5-picker__panel {-webkit-box-sizing: border-box;box-sizing: border-box;min-width: 160px;}.hi-v5-cascader__popper .hi-v5-picker__search .hi-v5-input__text {width: 100px;}.hi-v5-cascader__popper .hi-v5-picker__body {padding: 0;overflow-y: hidden;}.hi-v5-cascader__popper .hi-v5-picker__loading, .hi-v5-cascader__popper .hi-v5-picker__empty {padding: var(--hi-v5-spacing-5, 10px) var(--hi-v5-spacing-8, 16px);}.hi-v5-cascader-panel {white-space: nowrap;-webkit-box-sizing: border-box;box-sizing: border-box;font-size: var(--hi-v5-text-size-md, 0.875rem);color: var(--hi-v5-color-gray-800, #1a1d26);}.hi-v5-cascader-search {-webkit-box-sizing: border-box;box-sizing: border-box;padding: 0 var(--hi-v5-spacing-5, 10px) var(--hi-v5-spacing-5, 10px);position: relative;}.hi-v5-cascader-search .hi-v5-input__prefix {font-size: var(--hi-v5-text-size-lg, 1rem);-webkit-padding-start: 0;padding-inline-start: 0;}.hi-v5-cascader-search__empty {display: inline-block;-webkit-margin-before: var(--hi-v5-spacing-10, 20px);margin-block-start: var(--hi-v5-spacing-10, 20px);font-size: var(--hi-v5-text-size-md, 0.875rem);font-weight: var(--hi-v5-text-weight-normal, 400);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);color: var(--hi-v5-color-gray-800, #1a1d26);}.hi-v5-cascader-menu-list {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-sizing: border-box;box-sizing: border-box;overflow-x: auto;}.hi-v5-cascader-menu-list--flatted .hi-v5-cascader-menu {-ms-flex-preferred-size: 100%;flex-basis: 100%;}.hi-v5-cascader-menu {-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;border: none;outline: none;font-size: var(--hi-v5-text-size-md, 0.875rem);vertical-align: middle;list-style: none;width: auto;box-sizing: border-box;-ms-flex-negative: 0;flex-shrink: 0;display: inline-block;min-width: 160px;max-height: 260px;overflow: auto;padding: var(--hi-v5-spacing-2, 4px);}.hi-v5-cascader-menu:not(:last-of-type) {-webkit-border-end: var(--hi-v5-border-size-normal, 1px solid) var(--hi-v5-color-gray-300, #e6e8eb);border-inline-end: var(--hi-v5-border-size-normal, 1px solid) var(--hi-v5-color-gray-300, #e6e8eb);}.hi-v5-cascader-menu-item {width: 100%;position: relative;cursor: pointer;display: -webkit-box;display: -ms-flexbox;display: flex;}.hi-v5-cascader-menu-option {padding: var(--hi-v5-spacing-1, 2px) var(--hi-v5-spacing-4, 8px);-webkit-box-sizing: border-box;box-sizing: border-box;height: var(--hi-v5-height-8, 32px);width: 100%;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;position: relative;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;border-radius: var(--hi-v5-border-radius-md, 4px);white-space: nowrap;}.hi-v5-cascader-menu-option:hover {background-color: var(--hi-v5-color-gray-100, #f2f4f7);}.hi-v5-cascader-menu-option.hi-v5-cascader-menu-option--selected {background-color: var(--hi-v5-color-primary-50, var(--hi-v5-color-brandblue-50, #edf2ff));color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-cascader-menu-option.hi-v5-cascader-menu-option--selected .hi-v5-cascader-menu-switcher {color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-cascader-menu-option--focused {background-color: var(--hi-v5-color-primary-50, var(--hi-v5-color-brandblue-50, #edf2ff));}.hi-v5-cascader-menu-option--checked {font-weight: var(--hi-v5-text-weight-bold, 700);}.hi-v5-cascader-menu-option.hi-v5-cascader-menu-option--disabled {cursor: not-allowed;color: var(--hi-v5-color-gray-600, #91959e);background: transparent;}.hi-v5-cascader-menu-option.hi-v5-cascader-menu-option--disabled .hi-v5-cascader-menu-switcher {color: var(--hi-v5-color-gray-500, #babcc2);}.hi-v5-cascader-menu .title__text {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}.hi-v5-cascader-menu .title__text--cols {display: block;width: 100%;-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;border: none;outline: none;font-size: var(--hi-v5-text-size-md, 0.875rem);vertical-align: middle;list-style: none;}.hi-v5-cascader-menu .title__text--col {display: inline-block;}.hi-v5-cascader-menu .title__text--col::after {content: \" / \";}.hi-v5-cascader-menu .title__text--col:last-child::after {content: none;}.hi-v5-cascader-menu .title__text--matched {color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-cascader-menu-switcher {-ms-flex-negative: 0;flex-shrink: 0;font-size: var(--hi-v5-text-size-lg, 1rem);color: var(--hi-v5-color-gray-600, #91959e);}.hi-v5-cascader-menu-switcher--loading {color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-
|
|
11
|
+
var css_248z = "@charset \"UTF-8\";.hi-v5-cascader__popper .hi-v5-picker__panel {-webkit-box-sizing: border-box;box-sizing: border-box;min-width: 160px;}.hi-v5-cascader__popper .hi-v5-picker__search .hi-v5-input__text {width: 100px;}.hi-v5-cascader__popper .hi-v5-picker__body {padding: 0;overflow-y: hidden;}.hi-v5-cascader__popper .hi-v5-picker__loading, .hi-v5-cascader__popper .hi-v5-picker__empty {padding: var(--hi-v5-spacing-5, 10px) var(--hi-v5-spacing-8, 16px);}.hi-v5-cascader-panel {white-space: nowrap;-webkit-box-sizing: border-box;box-sizing: border-box;font-size: var(--hi-v5-text-size-md, 0.875rem);color: var(--hi-v5-color-gray-800, #1a1d26);}.hi-v5-cascader-search {-webkit-box-sizing: border-box;box-sizing: border-box;padding: 0 var(--hi-v5-spacing-5, 10px) var(--hi-v5-spacing-5, 10px);position: relative;}.hi-v5-cascader-search .hi-v5-input__prefix {font-size: var(--hi-v5-text-size-lg, 1rem);-webkit-padding-start: 0;padding-inline-start: 0;}.hi-v5-cascader-search__empty {display: inline-block;-webkit-margin-before: var(--hi-v5-spacing-10, 20px);margin-block-start: var(--hi-v5-spacing-10, 20px);font-size: var(--hi-v5-text-size-md, 0.875rem);font-weight: var(--hi-v5-text-weight-normal, 400);line-height: var(--hi-v5-text-lineheight-md, 1.375rem);color: var(--hi-v5-color-gray-800, #1a1d26);}.hi-v5-cascader-menu-list {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-sizing: border-box;box-sizing: border-box;overflow-x: auto;}.hi-v5-cascader-menu-list--flatted .hi-v5-cascader-menu {-ms-flex-preferred-size: 100%;flex-basis: 100%;}.hi-v5-cascader-menu {-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;border: none;outline: none;font-size: var(--hi-v5-text-size-md, 0.875rem);vertical-align: middle;list-style: none;width: auto;box-sizing: border-box;-ms-flex-negative: 0;flex-shrink: 0;display: inline-block;min-width: 160px;max-height: 260px;overflow: auto;padding: var(--hi-v5-spacing-2, 4px);}.hi-v5-cascader-menu:not(:last-of-type) {-webkit-border-end: var(--hi-v5-border-size-normal, 1px solid) var(--hi-v5-color-gray-300, #e6e8eb);border-inline-end: var(--hi-v5-border-size-normal, 1px solid) var(--hi-v5-color-gray-300, #e6e8eb);}.hi-v5-cascader-menu-item {width: 100%;position: relative;cursor: pointer;display: -webkit-box;display: -ms-flexbox;display: flex;}.hi-v5-cascader-menu-option {padding: var(--hi-v5-spacing-1, 2px) var(--hi-v5-spacing-4, 8px);-webkit-box-sizing: border-box;box-sizing: border-box;height: var(--hi-v5-height-8, 32px);width: 100%;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;position: relative;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;border-radius: var(--hi-v5-border-radius-md, 4px);white-space: nowrap;}.hi-v5-cascader-menu-option:hover {background-color: var(--hi-v5-color-gray-100, #f2f4f7);}.hi-v5-cascader-menu-option.hi-v5-cascader-menu-option--selected {background-color: var(--hi-v5-color-primary-50, var(--hi-v5-color-brandblue-50, #edf2ff));color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-cascader-menu-option.hi-v5-cascader-menu-option--selected .hi-v5-cascader-menu-switcher {color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-cascader-menu-option--focused {background-color: var(--hi-v5-color-primary-50, var(--hi-v5-color-brandblue-50, #edf2ff));}.hi-v5-cascader-menu-option--checked {font-weight: var(--hi-v5-text-weight-bold, 700);}.hi-v5-cascader-menu-option.hi-v5-cascader-menu-option--disabled {cursor: not-allowed;color: var(--hi-v5-color-gray-600, #91959e);background: transparent;}.hi-v5-cascader-menu-option.hi-v5-cascader-menu-option--disabled .hi-v5-cascader-menu-switcher {color: var(--hi-v5-color-gray-500, #babcc2);}.hi-v5-cascader-menu .title__text {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}.hi-v5-cascader-menu .title__text--cols {display: block;width: 100%;-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;border: none;outline: none;font-size: var(--hi-v5-text-size-md, 0.875rem);vertical-align: middle;list-style: none;}.hi-v5-cascader-menu .title__text--col {display: inline-block;}.hi-v5-cascader-menu .title__text--col::after {content: \" / \";}.hi-v5-cascader-menu .title__text--col:last-child::after {content: none;}.hi-v5-cascader-menu .title__text--matched {color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-cascader-menu-switcher {-ms-flex-negative: 0;flex-shrink: 0;font-size: var(--hi-v5-text-size-lg, 1rem);color: var(--hi-v5-color-gray-600, #91959e);}.hi-v5-cascader-menu-switcher--loading {color: var(--hi-v5-color-primary-500, var(--hi-v5-color-brandblue-500, #2660ff));}.hi-v5-cascader__icon--loading {display: inline-block;width: 1em;height: 1em;stroke: none;cursor: default;fill: currentColor;}.hi-v5-cascader__icon--loading svg {-webkit-animation-name: hi-rotate;animation-name: hi-rotate;-webkit-animation-duration: 2s;animation-duration: 2s;-webkit-animation-iteration-count: infinite;animation-iteration-count: infinite;}@-webkit-keyframes rotate {to {-webkit-transform: rotate(360deg);transform: rotate(360deg);}}@keyframes rotate {to {-webkit-transform: rotate(360deg);transform: rotate(360deg);}}";
|
|
12
12
|
__styleInject__(css_248z);
|
|
13
13
|
export { css_248z as default };
|
package/lib/types/Cascader.d.ts
CHANGED
|
@@ -10,10 +10,10 @@ import type { ComponentSemantic, SemanticClassNamesType, SemanticStylesType } fr
|
|
|
10
10
|
* Trigger + MenuList + Search
|
|
11
11
|
*/
|
|
12
12
|
export declare const Cascader: React.ForwardRefExoticComponent<CascaderProps & React.RefAttributes<HTMLDivElement | null>>;
|
|
13
|
-
export type CascaderSemanticName = PickerSemanticName | 'menuList' | 'menu' | 'option';
|
|
14
|
-
export type CascaderSemanticClassNames = SemanticClassNamesType<CascaderProps, CascaderSemanticName>;
|
|
15
|
-
export type CascaderSemanticStyles = SemanticStylesType<CascaderProps, CascaderSemanticName>;
|
|
16
|
-
export type CascaderSemantic = ComponentSemantic<CascaderSemanticClassNames, CascaderSemanticStyles>;
|
|
13
|
+
export declare type CascaderSemanticName = PickerSemanticName | 'menuList' | 'menu' | 'option';
|
|
14
|
+
export declare type CascaderSemanticClassNames = SemanticClassNamesType<CascaderProps, CascaderSemanticName>;
|
|
15
|
+
export declare type CascaderSemanticStyles = SemanticStylesType<CascaderProps, CascaderSemanticName>;
|
|
16
|
+
export declare type CascaderSemantic = ComponentSemantic<CascaderSemanticClassNames, CascaderSemanticStyles>;
|
|
17
17
|
export interface CascaderProps extends Omit<PickerProps, 'data' | 'onChange' | 'trigger' | 'scrollable' | 'header' | 'footer' | 'classNames' | 'styles'>, UseCascaderProps, CascaderSemantic {
|
|
18
18
|
/**
|
|
19
19
|
* 将 check 子项拍平展示。暂不对外暴露
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { HiBaseHTMLProps } from '@hi-ui/core';
|
|
3
3
|
import { FlattedCascaderDataItem } from './types';
|
|
4
|
-
export declare const CascaderMenuList: React.ForwardRefExoticComponent<Pick<CascaderMenuListProps,
|
|
4
|
+
export declare const CascaderMenuList: React.ForwardRefExoticComponent<Pick<CascaderMenuListProps, string | number> & React.RefAttributes<HTMLDivElement | null>>;
|
|
5
5
|
export interface CascaderMenuListProps extends HiBaseHTMLProps {
|
|
6
6
|
}
|
|
7
7
|
export declare const CascaderMenu: ({ prefixCls, role, className, style, data: menu, }: CascaderMenuProps) => JSX.Element;
|
package/lib/types/context.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { CascaderItemEventData, CascaderExpandTriggerEnum } from './types';
|
|
3
3
|
export declare const CascaderProvider: React.Provider<(Omit<{
|
|
4
4
|
rootProps: {
|
|
5
|
-
closeOnSelect?: boolean;
|
|
5
|
+
closeOnSelect?: boolean | undefined;
|
|
6
6
|
};
|
|
7
7
|
reset: () => void;
|
|
8
8
|
clear: () => void;
|
|
@@ -14,21 +14,21 @@ export declare const CascaderProvider: React.Provider<(Omit<{
|
|
|
14
14
|
onItemClick: (node: CascaderItemEventData, onlyExpand?: any) => Promise<void>;
|
|
15
15
|
onItemHover: (option: any) => void;
|
|
16
16
|
changeOnSelect: boolean;
|
|
17
|
-
onLoadChildren: ((item: CascaderItemEventData, idPaths: React.ReactText[]) => Promise<import("./types").CascaderDataItem[]
|
|
17
|
+
onLoadChildren: ((item: CascaderItemEventData, idPaths: React.ReactText[]) => void | Promise<void | import("./types").CascaderDataItem[]>) | undefined;
|
|
18
18
|
disabled: boolean;
|
|
19
19
|
menuList: import("./types").FlattedCascaderDataItem[][];
|
|
20
20
|
}, "rootProps"> & {
|
|
21
21
|
expandTrigger: CascaderExpandTriggerEnum;
|
|
22
22
|
titleRender: (item: CascaderItemEventData) => React.ReactNode;
|
|
23
|
-
dropdownColumnRender?: (menu: React.ReactElement, level: number) => React.ReactNode;
|
|
24
|
-
virtual?: boolean;
|
|
25
|
-
onItemClickProp?: (event: React.MouseEvent<HTMLDivElement>, option: CascaderItemEventData) => void;
|
|
26
|
-
classNames?: Partial<Record<string, string
|
|
27
|
-
styles?: Partial<Record<string, React.CSSProperties
|
|
23
|
+
dropdownColumnRender?: ((menu: React.ReactElement, level: number) => React.ReactNode) | undefined;
|
|
24
|
+
virtual?: boolean | undefined;
|
|
25
|
+
onItemClickProp?: ((event: React.MouseEvent<HTMLDivElement>, option: CascaderItemEventData) => void) | undefined;
|
|
26
|
+
classNames?: Partial<Record<string, string>> | undefined;
|
|
27
|
+
styles?: Partial<Record<string, React.CSSProperties>> | undefined;
|
|
28
28
|
}) | null>;
|
|
29
29
|
export declare const useCascaderContext: () => Omit<{
|
|
30
30
|
rootProps: {
|
|
31
|
-
closeOnSelect?: boolean;
|
|
31
|
+
closeOnSelect?: boolean | undefined;
|
|
32
32
|
};
|
|
33
33
|
reset: () => void;
|
|
34
34
|
clear: () => void;
|
|
@@ -40,15 +40,15 @@ export declare const useCascaderContext: () => Omit<{
|
|
|
40
40
|
onItemClick: (node: CascaderItemEventData, onlyExpand?: any) => Promise<void>;
|
|
41
41
|
onItemHover: (option: any) => void;
|
|
42
42
|
changeOnSelect: boolean;
|
|
43
|
-
onLoadChildren: ((item: CascaderItemEventData, idPaths: React.ReactText[]) => Promise<import("./types").CascaderDataItem[]
|
|
43
|
+
onLoadChildren: ((item: CascaderItemEventData, idPaths: React.ReactText[]) => void | Promise<void | import("./types").CascaderDataItem[]>) | undefined;
|
|
44
44
|
disabled: boolean;
|
|
45
45
|
menuList: import("./types").FlattedCascaderDataItem[][];
|
|
46
46
|
}, "rootProps"> & {
|
|
47
47
|
expandTrigger: CascaderExpandTriggerEnum;
|
|
48
48
|
titleRender: (item: CascaderItemEventData) => React.ReactNode;
|
|
49
|
-
dropdownColumnRender?: (menu: React.ReactElement, level: number) => React.ReactNode;
|
|
50
|
-
virtual?: boolean;
|
|
51
|
-
onItemClickProp?: (event: React.MouseEvent<HTMLDivElement>, option: CascaderItemEventData) => void;
|
|
52
|
-
classNames?: Partial<Record<string, string
|
|
53
|
-
styles?: Partial<Record<string, React.CSSProperties
|
|
49
|
+
dropdownColumnRender?: ((menu: React.ReactElement, level: number) => React.ReactNode) | undefined;
|
|
50
|
+
virtual?: boolean | undefined;
|
|
51
|
+
onItemClickProp?: ((event: React.MouseEvent<HTMLDivElement>, option: CascaderItemEventData) => void) | undefined;
|
|
52
|
+
classNames?: Partial<Record<string, string>> | undefined;
|
|
53
|
+
styles?: Partial<Record<string, React.CSSProperties>> | undefined;
|
|
54
54
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CascaderDataItem, CascaderItemEventData } from '../types';
|
|
3
|
-
export declare const useAsyncSwitch: (setCascaderData: React.Dispatch<React.SetStateAction<CascaderDataItem[]>>, onExpand?: (selectedOption: CascaderItemEventData, onlyExpand: boolean) => void, onLoadChildren?: (item: CascaderItemEventData, idPaths: React.ReactText[]) => Promise<CascaderDataItem[] | void> | void) => readonly [(targetKey: unknown) => boolean, (node: CascaderItemEventData, onlyExpand?: any) => Promise<void>];
|
|
3
|
+
export declare const useAsyncSwitch: (setCascaderData: React.Dispatch<React.SetStateAction<CascaderDataItem[]>>, onExpand?: ((selectedOption: CascaderItemEventData, onlyExpand: boolean) => void) | undefined, onLoadChildren?: ((item: CascaderItemEventData, idPaths: React.ReactText[]) => Promise<CascaderDataItem[] | void> | void) | undefined) => readonly [(targetKey: unknown) => boolean, (node: CascaderItemEventData, onlyExpand?: any) => Promise<void>];
|
|
@@ -3,4 +3,4 @@ import { CascaderItemEventData, FlattedCascaderDataItem } from '../types';
|
|
|
3
3
|
/**
|
|
4
4
|
* 用于选中的 hook
|
|
5
5
|
*/
|
|
6
|
-
export declare const useSelect: (disabled: boolean, onSelect: (value: React.ReactText, item: CascaderItemEventData, itemPaths: FlattedCascaderDataItem[]) => void, changeOnSelect: boolean, onLoadChildren?: (item: CascaderItemEventData, idPaths: React.ReactText[]) => void, value?: React.ReactText) => readonly [React.ReactText, (targetItem: CascaderItemEventData, onlyExpand: boolean) => void, React.Dispatch<React.SetStateAction<React.ReactText>>];
|
|
6
|
+
export declare const useSelect: (disabled: boolean, onSelect: (value: React.ReactText, item: CascaderItemEventData, itemPaths: FlattedCascaderDataItem[]) => void, changeOnSelect: boolean, onLoadChildren?: ((item: CascaderItemEventData, idPaths: React.ReactText[]) => void) | undefined, value?: React.ReactText | undefined) => readonly [React.ReactText, (targetItem: CascaderItemEventData, onlyExpand: boolean) => void, React.Dispatch<React.SetStateAction<React.ReactText>>];
|
package/lib/types/types.d.ts
CHANGED
|
@@ -59,5 +59,5 @@ export interface CascaderItemRequiredProps {
|
|
|
59
59
|
}
|
|
60
60
|
export interface CascaderItemEventData extends FlattedCascaderDataItem, CascaderItemRequiredProps {
|
|
61
61
|
}
|
|
62
|
-
export type CascaderExpandTriggerEnum = 'click' | 'hover';
|
|
63
|
-
export type CascaderAppearanceEnum = HiBaseAppearanceEnum | 'contained' | undefined;
|
|
62
|
+
export declare type CascaderExpandTriggerEnum = 'click' | 'hover';
|
|
63
|
+
export declare type CascaderAppearanceEnum = HiBaseAppearanceEnum | 'contained' | undefined;
|
|
@@ -6,7 +6,7 @@ export declare const useCascader: ({ defaultValue, value: valueProp, onChange: o
|
|
|
6
6
|
* 是否启用选择即关闭(用于 changeOnSelect 模式下控制父节点点击交互)
|
|
7
7
|
* @default true
|
|
8
8
|
*/
|
|
9
|
-
closeOnSelect?: boolean;
|
|
9
|
+
closeOnSelect?: boolean | undefined;
|
|
10
10
|
};
|
|
11
11
|
reset: () => void;
|
|
12
12
|
clear: () => void;
|
|
@@ -71,4 +71,4 @@ export interface UseCascaderProps {
|
|
|
71
71
|
*/
|
|
72
72
|
onLoadChildren?: (item: CascaderItemEventData, idPaths: React.ReactText[]) => Promise<CascaderDataItem[] | void> | void;
|
|
73
73
|
}
|
|
74
|
-
export type UseCascaderReturn = ReturnType<typeof useCascader>;
|
|
74
|
+
export declare type UseCascaderReturn = ReturnType<typeof useCascader>;
|
|
@@ -4,15 +4,15 @@ import { CascaderItemRequiredProps, CascaderItemEventData, CascaderDataItem, Fla
|
|
|
4
4
|
/**
|
|
5
5
|
* 扁平化树数据结构,基于前序遍历
|
|
6
6
|
*/
|
|
7
|
-
export declare const flattenTreeData: (treeData: CascaderDataItem[], fieldNames?: HiBaseFieldNames) => FlattedCascaderDataItem[];
|
|
7
|
+
export declare const flattenTreeData: (treeData: CascaderDataItem[], fieldNames?: HiBaseFieldNames | undefined) => FlattedCascaderDataItem[];
|
|
8
8
|
/**
|
|
9
9
|
* 获取选中节点的节点路径,包含选中节点
|
|
10
10
|
*/
|
|
11
|
-
export declare const getActiveNodePaths: (flattedData: FlattedCascaderDataItem[], selectedId?: React.ReactText) => FlattedCascaderDataItem[];
|
|
11
|
+
export declare const getActiveNodePaths: (flattedData: FlattedCascaderDataItem[], selectedId?: React.ReactText | undefined) => FlattedCascaderDataItem[];
|
|
12
12
|
/**
|
|
13
13
|
* 获取自顶向下的兄弟节点列表菜单
|
|
14
14
|
*/
|
|
15
|
-
export declare const getActiveMenus: (flattedData: FlattedCascaderDataItem[], selectedId?: React.ReactText) => FlattedCascaderDataItem[][];
|
|
15
|
+
export declare const getActiveMenus: (flattedData: FlattedCascaderDataItem[], selectedId?: React.ReactText | undefined) => FlattedCascaderDataItem[][];
|
|
16
16
|
export declare const getFlattedMenus: (data: FlattedCascaderDataItem[], filter: (option: FlattedCascaderDataItem) => boolean) => FlattedCascaderDataItem[][];
|
|
17
17
|
export declare const checkCanLoadChildren: (node: FlattedCascaderDataItem, onLoadChildren?: any) => any;
|
|
18
18
|
export declare function getItemEventData(node: FlattedCascaderDataItem, requiredProps: CascaderItemRequiredProps): CascaderItemEventData;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hi-ui/cascader",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-rc.0",
|
|
4
4
|
"description": "A sub-package for @hi-ui/hiui.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "HiUI <mi-hiui@xiaomi.com>",
|
|
@@ -44,36 +44,36 @@
|
|
|
44
44
|
"url": "https://github.com/XiaoMi/hiui/issues"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@hi-ui/array-utils": "^5.0.0-
|
|
48
|
-
"@hi-ui/classname": "^5.0.0-
|
|
49
|
-
"@hi-ui/env": "^5.0.0-
|
|
50
|
-
"@hi-ui/func-utils": "^5.0.0-
|
|
51
|
-
"@hi-ui/highlighter": "^5.0.0-
|
|
52
|
-
"@hi-ui/icons": "^5.0.0-
|
|
53
|
-
"@hi-ui/input": "^5.0.0-
|
|
54
|
-
"@hi-ui/picker": "^5.0.0-
|
|
55
|
-
"@hi-ui/popper": "^5.0.0-
|
|
56
|
-
"@hi-ui/spinner": "^5.0.0-
|
|
57
|
-
"@hi-ui/tree-utils": "^5.0.0-
|
|
58
|
-
"@hi-ui/type-assertion": "^5.0.0-
|
|
59
|
-
"@hi-ui/use-check-state": "^5.0.0-
|
|
60
|
-
"@hi-ui/use-data-source": "^5.0.0-
|
|
61
|
-
"@hi-ui/use-latest": "^5.0.0-
|
|
62
|
-
"@hi-ui/use-
|
|
63
|
-
"@hi-ui/use-
|
|
64
|
-
"@hi-ui/use-
|
|
65
|
-
"@hi-ui/
|
|
66
|
-
"
|
|
67
|
-
"
|
|
47
|
+
"@hi-ui/array-utils": "^5.0.0-rc.0",
|
|
48
|
+
"@hi-ui/classname": "^5.0.0-rc.0",
|
|
49
|
+
"@hi-ui/env": "^5.0.0-rc.0",
|
|
50
|
+
"@hi-ui/func-utils": "^5.0.0-rc.0",
|
|
51
|
+
"@hi-ui/highlighter": "^5.0.0-rc.0",
|
|
52
|
+
"@hi-ui/icons": "^5.0.0-rc.0",
|
|
53
|
+
"@hi-ui/input": "^5.0.0-rc.0",
|
|
54
|
+
"@hi-ui/picker": "^5.0.0-rc.0",
|
|
55
|
+
"@hi-ui/popper": "^5.0.0-rc.0",
|
|
56
|
+
"@hi-ui/spinner": "^5.0.0-rc.0",
|
|
57
|
+
"@hi-ui/tree-utils": "^5.0.0-rc.0",
|
|
58
|
+
"@hi-ui/type-assertion": "^5.0.0-rc.0",
|
|
59
|
+
"@hi-ui/use-check-state": "^5.0.0-rc.0",
|
|
60
|
+
"@hi-ui/use-data-source": "^5.0.0-rc.0",
|
|
61
|
+
"@hi-ui/use-latest": "^5.0.0-rc.0",
|
|
62
|
+
"@hi-ui/use-merge-semantic": "^5.0.0-rc.0",
|
|
63
|
+
"@hi-ui/use-search-mode": "^5.0.0-rc.0",
|
|
64
|
+
"@hi-ui/use-toggle": "^5.0.0-rc.0",
|
|
65
|
+
"@hi-ui/use-uncontrolled-state": "^5.0.0-rc.0",
|
|
66
|
+
"@hi-ui/virtual-list": "^5.0.0-rc.0",
|
|
67
|
+
"scroll-into-view-if-needed": "^3.1.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@hi-ui/core": ">=5.0.0-
|
|
70
|
+
"@hi-ui/core": ">=5.0.0-rc.0",
|
|
71
71
|
"react": ">=16.8.6",
|
|
72
72
|
"react-dom": ">=16.8.6"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@hi-ui/core": "^5.0.0-
|
|
76
|
-
"@hi-ui/core-css": "^5.0.0-
|
|
75
|
+
"@hi-ui/core": "^5.0.0-rc.0",
|
|
76
|
+
"@hi-ui/core-css": "^5.0.0-rc.0",
|
|
77
77
|
"react": "^17.0.1",
|
|
78
78
|
"react-dom": "^17.0.1"
|
|
79
79
|
}
|