@hi-ui/cascader 5.0.0-experimental.3 → 5.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/CHANGELOG.md +74 -127
- package/lib/cjs/CascaderMenuList.js +1 -1
- 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 +2 -2
- 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,161 +1,108 @@
|
|
|
1
1
|
# @hi-ui/cascader
|
|
2
2
|
|
|
3
|
-
## 5.0.0
|
|
3
|
+
## 5.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`8f3aa85e4`](https://github.com/XiaoMi/hiui/commit/8f3aa85e4e1977854cecdf2864498a77e959bc39) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: 组件的 package.json 中的 exports 统一加上 types 配置 (5.0)
|
|
4
8
|
|
|
5
9
|
### Minor Changes
|
|
6
10
|
|
|
7
|
-
-
|
|
11
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`b9989e482`](https://github.com/XiaoMi/hiui/commit/b9989e48214dbbf8a938a788d3a415d9bb94b1b2) Thanks [@zyprepare](https://github.com/zyprepare)! - feat(picker): 增加 clearSearchOnClosed api 默认是 false (5.0)
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`f1ab51725`](https://github.com/XiaoMi/hiui/commit/f1ab517258599ee2dfad183e4a8c7b855ef409c1) Thanks [@zyprepare](https://github.com/zyprepare)! - <br>
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
- feat(picker): 下拉选择类组件增加 xs 尺寸 (5.0)
|
|
16
|
+
- feat(input): 输入框组件增加 xs 尺寸 (5.0)
|
|
12
17
|
|
|
13
|
-
-
|
|
18
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`3e1d3608f`](https://github.com/XiaoMi/hiui/commit/3e1d3608f9bf107a23e28792409e734dde06c189) Thanks [@zyprepare](https://github.com/zyprepare)! - feat(cascader): add onItemClick api (5.0)
|
|
14
19
|
|
|
15
|
-
|
|
20
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`6dca7795c`](https://github.com/XiaoMi/hiui/commit/6dca7795c71123f941d91b991ecd17ce26b6a2da) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: 下拉选择组件增加 showIndicator 参数 & 修改 appearance 中的 unset 样式 (5.0)
|
|
16
21
|
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- @hi-ui/core@5.0.0-experimental.1
|
|
25
|
-
- @hi-ui/highlighter@5.0.0-experimental.1
|
|
26
|
-
- @hi-ui/input@5.0.0-experimental.2
|
|
27
|
-
- @hi-ui/picker@5.0.0-experimental.2
|
|
28
|
-
- @hi-ui/popper@5.0.0-experimental.1
|
|
29
|
-
- @hi-ui/virtual-list@5.0.0-experimental.1
|
|
30
|
-
- @hi-ui/use-merge-semantic@5.0.0-experimental.0
|
|
31
|
-
- @hi-ui/spinner@5.0.0-experimental.1
|
|
32
|
-
|
|
33
|
-
## 5.0.0-experimental.1
|
|
22
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`77d969c2e`](https://github.com/XiaoMi/hiui/commit/77d969c2e4f6db55f6cc154c1803971ac3e3f085) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: 下拉选择类组件 appearance 参数增加 contained 类型 (5.0)
|
|
23
|
+
|
|
24
|
+
- [#3520](https://github.com/XiaoMi/hiui/pull/3520) [`bf1174ed8`](https://github.com/XiaoMi/hiui/commit/bf1174ed8216582d18698be819417f86f826eefb) Thanks [@zyprepare](https://github.com/zyprepare)! - feat(cascader): 每次打开选择面板时自动定位到已选节点位置 (5.0)
|
|
25
|
+
|
|
26
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`58ad82e94`](https://github.com/XiaoMi/hiui/commit/58ad82e9441e76bf6090e6a0f4e36a04342c25f0) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: 输入框和选择器组件增加 borderless 形态 (5.0)
|
|
27
|
+
|
|
28
|
+
- [#3502](https://github.com/XiaoMi/hiui/pull/3502) [`59cef699f`](https://github.com/XiaoMi/hiui/commit/59cef699f96f56d4f68fae7f9dadb960c487b5de) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: 组件语义化样式改造,增加 styles 和 classNames 属性 (5.0)
|
|
34
29
|
|
|
35
30
|
### Patch Changes
|
|
36
31
|
|
|
37
|
-
-
|
|
38
|
-
- 发布 hiui experimental 版本
|
|
39
|
-
- 8561492d5: fix(cascader): 在平铺搜索模式下,当设置了 changeOnSelect 则搜索结果中展示父节点 (5.0)
|
|
40
|
-
- Updated dependencies [8f23e9322]
|
|
41
|
-
- Updated dependencies [b27483796]
|
|
42
|
-
- Updated dependencies [900c6c2f0]
|
|
43
|
-
- Updated dependencies
|
|
44
|
-
- @hi-ui/input@5.0.0-experimental.1
|
|
45
|
-
- @hi-ui/picker@5.0.0-experimental.1
|
|
32
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`cf89262c7`](https://github.com/XiaoMi/hiui/commit/cf89262c72b03fa0a00c154164b68482c3a8ac98) Thanks [@zyprepare](https://github.com/zyprepare)! - style(picker): 移除 picker 组件中的 \_\_text 样式定义 (5.0)
|
|
46
33
|
|
|
47
|
-
|
|
34
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`9b34d99bc`](https://github.com/XiaoMi/hiui/commit/9b34d99bc2aa8b78b9e3281e08afc086ac4afea1) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复 5.0 UI 问题 (5.0)
|
|
48
35
|
|
|
49
|
-
|
|
36
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`79ea480f3`](https://github.com/XiaoMi/hiui/commit/79ea480f33bb8f692dda1e6252a9d2a75c3ac30d) Thanks [@zyprepare](https://github.com/zyprepare)! - feat(global-context): 增加 size api 全局配置 (5.0)
|
|
50
37
|
|
|
51
|
-
-
|
|
38
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`2e56529f7`](https://github.com/XiaoMi/hiui/commit/2e56529f7ea8c74e2fac8b6061628d4fd0d862ac) Thanks [@zyprepare](https://github.com/zyprepare)! - styles: 主题定制功能完善&&样式变量化写法改造&&兼容 RTL (5.0)
|
|
52
39
|
|
|
53
|
-
|
|
40
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`eb718e940`](https://github.com/XiaoMi/hiui/commit/eb718e940a0cabc6914d1242e6ca4a21431a628a) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修改组件问题 (5.0)
|
|
54
41
|
|
|
55
|
-
-
|
|
56
|
-
- f1ab51725: <br>
|
|
57
|
-
- feat(picker): 下拉选择类组件增加 xs 尺寸 (5.0)
|
|
58
|
-
- feat(input): 输入框组件增加 xs 尺寸 (5.0)
|
|
59
|
-
- 3e1d3608f: feat(cascader): add onItemClick api (5.0)
|
|
60
|
-
- 6dca7795c: feat: 下拉选择组件增加 showIndicator 参数 & 修改 appearance 中的 unset 样式 (5.0)
|
|
61
|
-
- 77d969c2e: feat: 下拉选择类组件 appearance 参数增加 contained 类型 (5.0)
|
|
62
|
-
- 58ad82e94: feat: 输入框和选择器组件增加 borderless 形态 (5.0)
|
|
42
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`95abba983`](https://github.com/XiaoMi/hiui/commit/95abba98391a31c3cd79704fa0a63f64f437601f) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修改 UI 问题 (5.0)
|
|
63
43
|
|
|
64
|
-
|
|
44
|
+
- [#3489](https://github.com/XiaoMi/hiui/pull/3489) [`8f23e9322`](https://github.com/XiaoMi/hiui/commit/8f23e9322e8aa117608d42898cce1f9d74414629) Thanks [@zyprepare](https://github.com/zyprepare)! - style: 表单类组件统一调整后缀颜色、placeholder 颜色 (5.0)
|
|
45
|
+
|
|
46
|
+
- [#3504](https://github.com/XiaoMi/hiui/pull/3504) [`eb17c4697`](https://github.com/XiaoMi/hiui/commit/eb17c46978dfcb5e8ec0a0e3b3dcffabae8d31fe) Thanks [@zyprepare](https://github.com/zyprepare)! - style: 修复 UI/样式问题 (5.0)
|
|
47
|
+
|
|
48
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`f3bf08f27`](https://github.com/XiaoMi/hiui/commit/f3bf08f27017409b53782a9cbd5d4bc6d460aa5e) Thanks [@zyprepare](https://github.com/zyprepare)! - fix(cascader): 平铺搜索结果时不再展示不可点击的父节点 (5.0)
|
|
49
|
+
|
|
50
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`de8d058dc`](https://github.com/XiaoMi/hiui/commit/de8d058dc8b8fcd3acd6792ba71eac47475496ed) Thanks [@zyprepare](https://github.com/zyprepare)! - perf: 对下拉选择类组件的 customRender 的内容增加 memoization 以优化性能 (5.0)
|
|
51
|
+
|
|
52
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`5210770d9`](https://github.com/XiaoMi/hiui/commit/5210770d9d6bf9c83e84a28229f2007202d2d3b8) Thanks [@zyprepare](https://github.com/zyprepare)! - feat(picker): add header api (5.0)
|
|
53
|
+
|
|
54
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`424700fc5`](https://github.com/XiaoMi/hiui/commit/424700fc51f0b23332faebeb7ebdb4979c1db0b7) Thanks [@zyprepare](https://github.com/zyprepare)! - style(cascader&check-cascader): 调整下拉框样式,增加搜索框宽度设置 (5.0)
|
|
55
|
+
|
|
56
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`4b2596538`](https://github.com/XiaoMi/hiui/commit/4b25965386693fc1dc3768e77eb802f25990b2ad) Thanks [@zyprepare](https://github.com/zyprepare)! - <br>
|
|
65
57
|
|
|
66
|
-
- 6fb223e3a: style: fix ui bug (5.0)
|
|
67
|
-
- 1662753e0: style: fix ui bug (5.0)
|
|
68
|
-
- cf89262c7: style(picker): 移除 picker 组件中的 \_\_text 样式定义 (5.0)
|
|
69
|
-
- 9b34d99bc: fix: 修复 5.0 UI 问题 (5.0)
|
|
70
|
-
- be5a59325: style: 修改样式问题 (5.0)
|
|
71
|
-
- 79ea480f3: feat(global-context): 增加 size api 全局配置 (5.0)
|
|
72
|
-
- 2e56529f7: styles: 主题定制功能完善&&样式变量化写法改造&&兼容 RTL (5.0)
|
|
73
|
-
- eb718e940: fix: 修改组件问题 (5.0)
|
|
74
|
-
- 95abba983: fix: 修改 UI 问题 (5.0)
|
|
75
|
-
- f3bf08f27: fix(cascader): 平铺搜索结果时不再展示不可点击的父节点 (5.0)
|
|
76
|
-
- de8d058dc: perf: 对下拉选择类组件的 customRender 的内容增加 memoization 以优化性能 (5.0)
|
|
77
|
-
- 5210770d9: feat(picker): add header api (5.0)
|
|
78
|
-
- 424700fc5: style(cascader&check-cascader): 调整下拉框样式,增加搜索框宽度设置 (5.0)
|
|
79
|
-
- 4b2596538: <br>
|
|
80
58
|
- style(cascader&check-cascader): 增加 white-space: nowrap; 样式以防止文本换行 (5.0)
|
|
81
59
|
- style(cascader&check-cascader): 调整搜索框默认宽度为 100px (5.0)
|
|
82
60
|
- feat(check-cascader): 增加 flattedSearchResult 属性,用于控制搜索结果的展现形式 (5.0)
|
|
83
61
|
- fix(cascader): 修复当搜索结果为空时,下拉框没有显示空状态问题 (5.0)
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
|
|
62
|
+
|
|
63
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`33da3144e`](https://github.com/XiaoMi/hiui/commit/33da3144e916edd75ee0669ca9e5090edc681193) Thanks [@zyprepare](https://github.com/zyprepare)! - build: 将 package.json 中 exports 配置中的 types 配置放在最上面 (5.0)
|
|
64
|
+
|
|
65
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`0a4e90dbd`](https://github.com/XiaoMi/hiui/commit/0a4e90dbd7398e69511e7505b1fd6093eca48cee) Thanks [@zyprepare](https://github.com/zyprepare)! - <br>
|
|
66
|
+
|
|
87
67
|
- style(tag-input): 间距调整 (5.0)
|
|
88
68
|
- style(select): 选择类组件选项圆角改为 4px (5.0)
|
|
89
69
|
- style(picker): 搜索框样式调整 (5.0)
|
|
90
|
-
|
|
70
|
+
|
|
71
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`79739ed82`](https://github.com/XiaoMi/hiui/commit/79739ed82a9e28a39bf5af7c8e7e47f03afa7e82) Thanks [@zyprepare](https://github.com/zyprepare)! - <br>
|
|
72
|
+
|
|
91
73
|
- fix(cascader): 处理当 value 为空时清空选项的选中态(5.0)
|
|
92
74
|
- style(cascader&check-cascader): 调整选项容器最小宽度为 160px (5.0)
|
|
93
75
|
- style(cascader&check-cascader): 优化下拉框宽度,让内容和搜索框默认宽度对齐 (5.0)
|
|
94
76
|
- perf(cascader&check-cascader): 优化 customRender 函数,支持传递选中项和当前值 (5.0)
|
|
95
|
-
|
|
96
|
-
-
|
|
97
|
-
|
|
98
|
-
-
|
|
99
|
-
|
|
100
|
-
-
|
|
101
|
-
|
|
102
|
-
- Updated dependencies [122d1d859]
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
-
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
- Updated dependencies [e2d184e74]
|
|
125
|
-
- Updated dependencies [4006b2c8c]
|
|
126
|
-
- Updated dependencies [77d969c2e]
|
|
127
|
-
- Updated dependencies [e42e2badf]
|
|
128
|
-
- Updated dependencies [33da3144e]
|
|
129
|
-
- Updated dependencies [7f3abee55]
|
|
130
|
-
- Updated dependencies [6fcda9bf2]
|
|
131
|
-
- Updated dependencies [0a4e90dbd]
|
|
132
|
-
- Updated dependencies [58ad82e94]
|
|
133
|
-
- Updated dependencies [a0f0c9d6b]
|
|
134
|
-
- Updated dependencies [f2be367e9]
|
|
135
|
-
- Updated dependencies [1972fd16a]
|
|
136
|
-
- Updated dependencies [99801c2d1]
|
|
137
|
-
- Updated dependencies [86910f5e2]
|
|
138
|
-
- Updated dependencies [cb7b794d0]
|
|
139
|
-
- @hi-ui/picker@5.0.0-experimental.0
|
|
140
|
-
- @hi-ui/input@5.0.0-experimental.0
|
|
141
|
-
- @hi-ui/popper@5.0.0-experimental.0
|
|
142
|
-
- @hi-ui/icons@5.0.0-experimental.0
|
|
143
|
-
- @hi-ui/virtual-list@5.0.0-experimental.0
|
|
144
|
-
- @hi-ui/core@5.0.0-experimental.0
|
|
145
|
-
- @hi-ui/use-check-state@5.0.0-experimental.0
|
|
146
|
-
- @hi-ui/use-data-source@5.0.0-experimental.0
|
|
147
|
-
- @hi-ui/use-latest@5.0.0-experimental.0
|
|
148
|
-
- @hi-ui/use-search-mode@5.0.0-experimental.0
|
|
149
|
-
- @hi-ui/use-toggle@5.0.0-experimental.0
|
|
150
|
-
- @hi-ui/use-uncontrolled-state@5.0.0-experimental.0
|
|
151
|
-
- @hi-ui/highlighter@5.0.0-experimental.0
|
|
152
|
-
- @hi-ui/spinner@5.0.0-experimental.0
|
|
153
|
-
- @hi-ui/array-utils@5.0.0-experimental.0
|
|
154
|
-
- @hi-ui/classname@5.0.0-experimental.0
|
|
155
|
-
- @hi-ui/env@5.0.0-experimental.0
|
|
156
|
-
- @hi-ui/func-utils@5.0.0-experimental.0
|
|
157
|
-
- @hi-ui/tree-utils@5.0.0-experimental.0
|
|
158
|
-
- @hi-ui/type-assertion@5.0.0-experimental.0
|
|
77
|
+
|
|
78
|
+
- [#3491](https://github.com/XiaoMi/hiui/pull/3491) [`8561492d5`](https://github.com/XiaoMi/hiui/commit/8561492d5691c1b2284379c9dac6d500e47e732e) Thanks [@zyprepare](https://github.com/zyprepare)! - fix(cascader): 在平铺搜索模式下,当设置了 changeOnSelect 则搜索结果中展示父节点 (5.0)
|
|
79
|
+
|
|
80
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`4a31cea53`](https://github.com/XiaoMi/hiui/commit/4a31cea53a1ec48c6e31b1703315ba5838ad883f) Thanks [@zyprepare](https://github.com/zyprepare)! - style: 统一调整选择类组件 hover 时的背景色 (5.0)
|
|
81
|
+
|
|
82
|
+
- [#3532](https://github.com/XiaoMi/hiui/pull/3532) [`99801c2d1`](https://github.com/XiaoMi/hiui/commit/99801c2d12628c194657579eccd09a86aedea22b) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复 UI 问题 (5.0)
|
|
83
|
+
|
|
84
|
+
- Updated dependencies [[`0b34e1c15`](https://github.com/XiaoMi/hiui/commit/0b34e1c15bbf98c9e44f6d249366bb2a97cad218), [`da2e63a14`](https://github.com/XiaoMi/hiui/commit/da2e63a1478db819ec87d720fbfbf537319620c2), [`1e226cd66`](https://github.com/XiaoMi/hiui/commit/1e226cd66413cea8eb1e63b1cb83c1bfbf5f0a41), [`b9989e482`](https://github.com/XiaoMi/hiui/commit/b9989e48214dbbf8a938a788d3a415d9bb94b1b2), [`7f204c892`](https://github.com/XiaoMi/hiui/commit/7f204c892156ea8a4fb95d218db9d59c8c4e0c49), [`122d1d859`](https://github.com/XiaoMi/hiui/commit/122d1d859bb92379fbe109fe9a5581259e6bb9a1), [`f1ab51725`](https://github.com/XiaoMi/hiui/commit/f1ab517258599ee2dfad183e4a8c7b855ef409c1), [`41552be0b`](https://github.com/XiaoMi/hiui/commit/41552be0b42df7c47b481cf8aacc8be76fc3f277), [`eb17c4697`](https://github.com/XiaoMi/hiui/commit/eb17c46978dfcb5e8ec0a0e3b3dcffabae8d31fe), [`8c0ee78f0`](https://github.com/XiaoMi/hiui/commit/8c0ee78f013dcd9ced94cef13a69933e039621aa), [`9b34d99bc`](https://github.com/XiaoMi/hiui/commit/9b34d99bc2aa8b78b9e3281e08afc086ac4afea1), [`8f3aa85e4`](https://github.com/XiaoMi/hiui/commit/8f3aa85e4e1977854cecdf2864498a77e959bc39), [`ec4c7faa2`](https://github.com/XiaoMi/hiui/commit/ec4c7faa29cb7812664d866260c7a59dc76cb983), [`29cae09ea`](https://github.com/XiaoMi/hiui/commit/29cae09ea3d7a61781c3c4a9f51355a83229bd97), [`fd4c20bbd`](https://github.com/XiaoMi/hiui/commit/fd4c20bbd30e18bc4c1a2eb078acaa4790f7b2eb), [`79ea480f3`](https://github.com/XiaoMi/hiui/commit/79ea480f33bb8f692dda1e6252a9d2a75c3ac30d), [`2e56529f7`](https://github.com/XiaoMi/hiui/commit/2e56529f7ea8c74e2fac8b6061628d4fd0d862ac), [`3a7186e4b`](https://github.com/XiaoMi/hiui/commit/3a7186e4b4e7ce351c3856f3e1ba574b9f6df22f), [`277c5033a`](https://github.com/XiaoMi/hiui/commit/277c5033aacd43ef3d6b8e0b9e818a09ebe21875), [`95abba983`](https://github.com/XiaoMi/hiui/commit/95abba98391a31c3cd79704fa0a63f64f437601f), [`8f23e9322`](https://github.com/XiaoMi/hiui/commit/8f23e9322e8aa117608d42898cce1f9d74414629), [`4a31cea53`](https://github.com/XiaoMi/hiui/commit/4a31cea53a1ec48c6e31b1703315ba5838ad883f), [`b27483796`](https://github.com/XiaoMi/hiui/commit/b2748379661e2e7a4c18e94c478dc2554405c7dd), [`eb17c4697`](https://github.com/XiaoMi/hiui/commit/eb17c46978dfcb5e8ec0a0e3b3dcffabae8d31fe), [`976ec929d`](https://github.com/XiaoMi/hiui/commit/976ec929da088830d4d4bfa5438aa679676f71ca), [`f1ab51725`](https://github.com/XiaoMi/hiui/commit/f1ab517258599ee2dfad183e4a8c7b855ef409c1), [`6dca7795c`](https://github.com/XiaoMi/hiui/commit/6dca7795c71123f941d91b991ecd17ce26b6a2da), [`900c6c2f0`](https://github.com/XiaoMi/hiui/commit/900c6c2f0b397bb2a6c2a5b2cc0c0f83442813ec), [`7b956b1eb`](https://github.com/XiaoMi/hiui/commit/7b956b1eb6ba711b05412e4fc1e413bf17f648a6), [`5210770d9`](https://github.com/XiaoMi/hiui/commit/5210770d9d6bf9c83e84a28229f2007202d2d3b8), [`4006b2c8c`](https://github.com/XiaoMi/hiui/commit/4006b2c8cabba5ec553b69a17e4bf3fb53fe9180), [`c407744fe`](https://github.com/XiaoMi/hiui/commit/c407744fea78d93da66b73eed0b62d18e5b3a011), [`d91a8bb0f`](https://github.com/XiaoMi/hiui/commit/d91a8bb0f887fa886215aa596852eef3c2ce8519), [`77d969c2e`](https://github.com/XiaoMi/hiui/commit/77d969c2e4f6db55f6cc154c1803971ac3e3f085), [`e42e2badf`](https://github.com/XiaoMi/hiui/commit/e42e2badfd099ced93eaf8414513d7a49d1e66c0), [`33da3144e`](https://github.com/XiaoMi/hiui/commit/33da3144e916edd75ee0669ca9e5090edc681193), [`6fcda9bf2`](https://github.com/XiaoMi/hiui/commit/6fcda9bf23e6e16c593fd4d9e3db8d08bcb6b9b5), [`0a4e90dbd`](https://github.com/XiaoMi/hiui/commit/0a4e90dbd7398e69511e7505b1fd6093eca48cee), [`58ad82e94`](https://github.com/XiaoMi/hiui/commit/58ad82e9441e76bf6090e6a0f4e36a04342c25f0), [`95d930354`](https://github.com/XiaoMi/hiui/commit/95d930354a1ab4291e98a9abccb9525d6c210795), [`f2be367e9`](https://github.com/XiaoMi/hiui/commit/f2be367e959d42506953fe9d57cf677ccb79305e), [`1972fd16a`](https://github.com/XiaoMi/hiui/commit/1972fd16ae1971690412192bce03d6860af8efdd), [`59cef699f`](https://github.com/XiaoMi/hiui/commit/59cef699f96f56d4f68fae7f9dadb960c487b5de), [`99801c2d1`](https://github.com/XiaoMi/hiui/commit/99801c2d12628c194657579eccd09a86aedea22b), [`cb7b794d0`](https://github.com/XiaoMi/hiui/commit/cb7b794d07d56c74f7972f05440632335631b9e0)]:
|
|
85
|
+
- @hi-ui/picker@5.0.0
|
|
86
|
+
- @hi-ui/input@5.0.0
|
|
87
|
+
- @hi-ui/popper@5.0.0
|
|
88
|
+
- @hi-ui/icons@5.0.0
|
|
89
|
+
- @hi-ui/core@5.0.0
|
|
90
|
+
- @hi-ui/use-check-state@5.0.0
|
|
91
|
+
- @hi-ui/use-data-source@5.0.0
|
|
92
|
+
- @hi-ui/use-latest@5.0.0
|
|
93
|
+
- @hi-ui/use-search-mode@5.0.0
|
|
94
|
+
- @hi-ui/use-toggle@5.0.0
|
|
95
|
+
- @hi-ui/use-uncontrolled-state@5.0.0
|
|
96
|
+
- @hi-ui/highlighter@5.0.0
|
|
97
|
+
- @hi-ui/spinner@5.0.0
|
|
98
|
+
- @hi-ui/virtual-list@5.0.0
|
|
99
|
+
- @hi-ui/array-utils@5.0.0
|
|
100
|
+
- @hi-ui/classname@5.0.0
|
|
101
|
+
- @hi-ui/env@5.0.0
|
|
102
|
+
- @hi-ui/func-utils@5.0.0
|
|
103
|
+
- @hi-ui/tree-utils@5.0.0
|
|
104
|
+
- @hi-ui/type-assertion@5.0.0
|
|
105
|
+
- @hi-ui/use-merge-semantic@5.0.0
|
|
159
106
|
|
|
160
107
|
## 4.5.2
|
|
161
108
|
|
|
@@ -190,7 +190,7 @@ var renderSuffix = function renderSuffix(prefixCls, item, loading, onLoadChildre
|
|
|
190
190
|
if (canLoadChildren) {
|
|
191
191
|
return /*#__PURE__*/React__default["default"].createElement("span", {
|
|
192
192
|
className: classname.cx(prefixCls + "-switcher", prefixCls + "-switcher--arrow")
|
|
193
|
-
}, index$1.
|
|
193
|
+
}, /*#__PURE__*/React__default["default"].createElement(index$1.DefaultSuffixIcon, null));
|
|
194
194
|
}
|
|
195
195
|
return /*#__PURE__*/React__default["default"].createElement("span", {
|
|
196
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;
|
|
@@ -11,7 +11,7 @@ import { __rest } from 'tslib';
|
|
|
11
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';
|
|
@@ -176,7 +176,7 @@ var renderSuffix = function renderSuffix(prefixCls, item, loading, onLoadChildre
|
|
|
176
176
|
if (canLoadChildren) {
|
|
177
177
|
return /*#__PURE__*/React.createElement("span", {
|
|
178
178
|
className: cx(prefixCls + "-switcher", prefixCls + "-switcher--arrow")
|
|
179
|
-
},
|
|
179
|
+
}, /*#__PURE__*/React.createElement(DefaultSuffixIcon, null));
|
|
180
180
|
}
|
|
181
181
|
return /*#__PURE__*/React.createElement("span", {
|
|
182
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",
|
|
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",
|
|
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-merge-semantic": "^5.0.0",
|
|
63
|
+
"@hi-ui/use-search-mode": "^5.0.0",
|
|
64
|
+
"@hi-ui/use-toggle": "^5.0.0",
|
|
65
|
+
"@hi-ui/use-uncontrolled-state": "^5.0.0",
|
|
66
|
+
"@hi-ui/virtual-list": "^5.0.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",
|
|
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",
|
|
76
|
+
"@hi-ui/core-css": "^5.0.0",
|
|
77
77
|
"react": "^17.0.1",
|
|
78
78
|
"react-dom": "^17.0.1"
|
|
79
79
|
}
|