@hi-ui/cascader 5.0.0-canary.9 → 5.0.0-experimental.1
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 +122 -125
- package/lib/cjs/Cascader.js +38 -10
- package/lib/cjs/CascaderMenuList.js +8 -4
- package/lib/cjs/hooks/use-async-switch.js +21 -18
- package/lib/cjs/icons/index.js +3 -6
- package/lib/cjs/styles/index.scss.js +1 -1
- package/lib/cjs/use-cascader.js +4 -0
- package/lib/cjs/utils/index.js +1 -0
- package/lib/esm/Cascader.js +50 -22
- package/lib/esm/CascaderMenuList.js +23 -20
- package/lib/esm/hooks/use-async-switch.js +21 -18
- package/lib/esm/icons/index.js +5 -8
- package/lib/esm/styles/index.scss.js +1 -1
- package/lib/esm/use-cascader.js +4 -0
- package/lib/esm/utils/index.js +1 -0
- package/lib/types/Cascader.d.ts +14 -2
- package/lib/types/CascaderMenuList.d.ts +1 -1
- package/lib/types/context.d.ts +12 -8
- 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 +3 -2
- package/lib/types/utils/index.d.ts +4 -4
- package/package.json +24 -22
- package/lib/cjs/ui/virtual-list/lib/esm/_virtual/index.js +0 -28
- package/lib/cjs/ui/virtual-list/lib/esm/_virtual/index2.js +0 -28
- package/lib/cjs/ui/virtual-list/lib/esm/_virtual/react-is.development.js +0 -26
- package/lib/cjs/ui/virtual-list/lib/esm/_virtual/react-is.production.min.js +0 -26
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/classnames/index.js +0 -74
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-resize-observer/es/index.js +0 -200
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/Children/toArray.js +0 -52
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/Dom/findDOMNode.js +0 -44
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/ref.js +0 -71
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/warning.js +0 -45
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-util/es/Dom/canUseDom.js +0 -28
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-util/es/Dom/findDOMNode.js +0 -44
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-util/es/hooks/useLayoutEffect.js +0 -54
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-util/es/raf.js +0 -71
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/Filler.js +0 -128
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/Item.js +0 -57
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/List.js +0 -476
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/ScrollBar.js +0 -363
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/hooks/useChildren.js +0 -63
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/hooks/useDiffItem.js +0 -115
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/hooks/useFrameWheel.js +0 -64
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/hooks/useHeights.js +0 -161
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/hooks/useMobileTouchMove.js +0 -87
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/hooks/useOriginScroll.js +0 -61
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/hooks/useScrollTo.js +0 -141
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/utils/CacheMap.js +0 -68
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/utils/algorithmUtil.js +0 -84
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/utils/isFirefox.js +0 -35
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/react-is/cjs/react-is.development.js +0 -189
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/react-is/cjs/react-is.production.min.js +0 -139
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/react-is/index.js +0 -31
- package/lib/cjs/ui/virtual-list/lib/esm/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +0 -970
- package/lib/esm/ui/virtual-list/lib/esm/_virtual/index.js +0 -22
- package/lib/esm/ui/virtual-list/lib/esm/_virtual/index2.js +0 -22
- package/lib/esm/ui/virtual-list/lib/esm/_virtual/react-is.development.js +0 -20
- package/lib/esm/ui/virtual-list/lib/esm/_virtual/react-is.production.min.js +0 -20
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/classnames/index.js +0 -62
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-resize-observer/es/index.js +0 -164
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/Children/toArray.js +0 -40
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/Dom/findDOMNode.js +0 -32
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/ref.js +0 -57
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/warning.js +0 -36
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-util/es/Dom/canUseDom.js +0 -22
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-util/es/Dom/findDOMNode.js +0 -32
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-util/es/hooks/useLayoutEffect.js +0 -28
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-util/es/raf.js +0 -65
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/Filler.js +0 -102
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/Item.js +0 -31
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/List.js +0 -450
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/ScrollBar.js +0 -337
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/hooks/useChildren.js +0 -37
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/hooks/useDiffItem.js +0 -89
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/hooks/useFrameWheel.js +0 -59
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/hooks/useHeights.js +0 -136
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/hooks/useMobileTouchMove.js +0 -82
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/hooks/useOriginScroll.js +0 -56
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/hooks/useScrollTo.js +0 -115
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/utils/CacheMap.js +0 -62
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/utils/algorithmUtil.js +0 -78
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/rc-virtual-list/es/utils/isFirefox.js +0 -29
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/react-is/cjs/react-is.development.js +0 -177
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/react-is/cjs/react-is.production.min.js +0 -127
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/react-is/index.js +0 -29
- package/lib/esm/ui/virtual-list/lib/esm/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +0 -964
package/CHANGELOG.md
CHANGED
|
@@ -1,160 +1,157 @@
|
|
|
1
1
|
# @hi-ui/cascader
|
|
2
2
|
|
|
3
|
-
## 5.0.0-
|
|
3
|
+
## 5.0.0-experimental.1
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
### Minor Changes
|
|
14
|
-
|
|
15
|
-
- bbba46153: feat(cascader): onChange 回调中增加选中项对象参数返回 (#3230)
|
|
16
|
-
|
|
17
|
-
### Patch Changes
|
|
18
|
-
|
|
19
|
-
- Updated dependencies [bf65028e6]
|
|
20
|
-
- @hi-ui/popper@5.0.0-canary.4
|
|
21
|
-
|
|
22
|
-
## 5.0.0-canary.7
|
|
23
|
-
|
|
24
|
-
### Patch Changes
|
|
25
|
-
|
|
26
|
-
- chore: rebase master (5.0)
|
|
7
|
+
- 8f23e9322: style: 表单类组件统一调整后缀颜色、placeholder 颜色 (5.0)
|
|
8
|
+
- 发布 hiui experimental 版本
|
|
9
|
+
- 8561492d5: fix(cascader): 在平铺搜索模式下,当设置了 changeOnSelect 则搜索结果中展示父节点 (5.0)
|
|
10
|
+
- Updated dependencies [8f23e9322]
|
|
11
|
+
- Updated dependencies [b27483796]
|
|
12
|
+
- Updated dependencies [900c6c2f0]
|
|
27
13
|
- Updated dependencies
|
|
28
|
-
- @hi-ui/
|
|
29
|
-
- @hi-ui/
|
|
30
|
-
- @hi-ui/use-data-source@5.0.0-canary.2
|
|
31
|
-
- @hi-ui/use-latest@5.0.0-canary.2
|
|
32
|
-
- @hi-ui/use-search-mode@5.0.0-canary.2
|
|
33
|
-
- @hi-ui/use-toggle@5.0.0-canary.2
|
|
34
|
-
- @hi-ui/use-uncontrolled-state@5.0.0-canary.2
|
|
35
|
-
- @hi-ui/icons@5.0.0-canary.2
|
|
36
|
-
- @hi-ui/highlighter@5.0.0-canary.2
|
|
37
|
-
- @hi-ui/input@5.0.0-canary.7
|
|
38
|
-
- @hi-ui/picker@5.0.0-canary.8
|
|
39
|
-
- @hi-ui/popper@5.0.0-canary.3
|
|
40
|
-
- @hi-ui/spinner@5.0.0-canary.2
|
|
41
|
-
- @hi-ui/array-utils@5.0.0-canary.2
|
|
42
|
-
- @hi-ui/classname@5.0.0-canary.2
|
|
43
|
-
- @hi-ui/env@5.0.0-canary.2
|
|
44
|
-
- @hi-ui/func-utils@5.0.0-canary.2
|
|
45
|
-
- @hi-ui/tree-utils@5.0.0-canary.2
|
|
46
|
-
- @hi-ui/type-assertion@5.0.0-canary.2
|
|
47
|
-
|
|
48
|
-
## 5.0.0-canary.6
|
|
14
|
+
- @hi-ui/input@5.0.0-experimental.1
|
|
15
|
+
- @hi-ui/picker@5.0.0-experimental.1
|
|
49
16
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
- 4b09e728b: build: 将 package.json 中 exports 配置中的 types 配置放在最上面 (5.0)
|
|
53
|
-
- ba7c324c2: style: 统一调整选择类组件 hover 时的背景色 (5.0)
|
|
54
|
-
- Updated dependencies [ba7c324c2]
|
|
55
|
-
- Updated dependencies [4b09e728b]
|
|
56
|
-
- @hi-ui/picker@5.0.0-canary.7
|
|
57
|
-
- @hi-ui/core@5.0.0-canary.1
|
|
58
|
-
- @hi-ui/use-check-state@5.0.0-canary.1
|
|
59
|
-
- @hi-ui/use-data-source@5.0.0-canary.1
|
|
60
|
-
- @hi-ui/use-latest@5.0.0-canary.1
|
|
61
|
-
- @hi-ui/use-search-mode@5.0.0-canary.1
|
|
62
|
-
- @hi-ui/use-toggle@5.0.0-canary.1
|
|
63
|
-
- @hi-ui/use-uncontrolled-state@5.0.0-canary.1
|
|
64
|
-
- @hi-ui/icons@5.0.0-canary.1
|
|
65
|
-
- @hi-ui/highlighter@5.0.0-canary.1
|
|
66
|
-
- @hi-ui/input@5.0.0-canary.6
|
|
67
|
-
- @hi-ui/popper@5.0.0-canary.2
|
|
68
|
-
- @hi-ui/spinner@5.0.0-canary.1
|
|
69
|
-
- @hi-ui/array-utils@5.0.0-canary.1
|
|
70
|
-
- @hi-ui/classname@5.0.0-canary.1
|
|
71
|
-
- @hi-ui/env@5.0.0-canary.1
|
|
72
|
-
- @hi-ui/func-utils@5.0.0-canary.1
|
|
73
|
-
- @hi-ui/tree-utils@5.0.0-canary.1
|
|
74
|
-
- @hi-ui/type-assertion@5.0.0-canary.1
|
|
75
|
-
|
|
76
|
-
## 5.0.0-canary.5
|
|
77
|
-
|
|
78
|
-
### Patch Changes
|
|
17
|
+
## 5.0.0-experimental.0
|
|
79
18
|
|
|
80
|
-
|
|
81
|
-
- Updated dependencies [40f819417]
|
|
82
|
-
- @hi-ui/input@5.0.0-canary.5
|
|
83
|
-
|
|
84
|
-
## 5.0.0-canary.4
|
|
19
|
+
### Major Changes
|
|
85
20
|
|
|
86
|
-
|
|
21
|
+
- 8f3aa85e4: feat: 组件的 package.json 中的 exports 统一加上 types 配置 (5.0)
|
|
87
22
|
|
|
88
|
-
|
|
23
|
+
### Minor Changes
|
|
89
24
|
|
|
90
|
-
|
|
25
|
+
- b9989e482: feat(picker): 增加 clearSearchOnClosed api 默认是 false (5.0)
|
|
26
|
+
- f1ab51725: <br>
|
|
27
|
+
- feat(picker): 下拉选择类组件增加 xs 尺寸 (5.0)
|
|
28
|
+
- feat(input): 输入框组件增加 xs 尺寸 (5.0)
|
|
29
|
+
- 3e1d3608f: feat(cascader): add onItemClick api (5.0)
|
|
30
|
+
- 6dca7795c: feat: 下拉选择组件增加 showIndicator 参数 & 修改 appearance 中的 unset 样式 (5.0)
|
|
31
|
+
- 77d969c2e: feat: 下拉选择类组件 appearance 参数增加 contained 类型 (5.0)
|
|
32
|
+
- 58ad82e94: feat: 输入框和选择器组件增加 borderless 形态 (5.0)
|
|
91
33
|
|
|
92
34
|
### Patch Changes
|
|
93
35
|
|
|
94
|
-
-
|
|
36
|
+
- 6fb223e3a: style: fix ui bug (5.0)
|
|
37
|
+
- 1662753e0: style: fix ui bug (5.0)
|
|
38
|
+
- cf89262c7: style(picker): 移除 picker 组件中的 \_\_text 样式定义 (5.0)
|
|
39
|
+
- 9b34d99bc: fix: 修复 5.0 UI 问题 (5.0)
|
|
40
|
+
- be5a59325: style: 修改样式问题 (5.0)
|
|
41
|
+
- 79ea480f3: feat(global-context): 增加 size api 全局配置 (5.0)
|
|
42
|
+
- 2e56529f7: styles: 主题定制功能完善&&样式变量化写法改造&&兼容 RTL (5.0)
|
|
43
|
+
- eb718e940: fix: 修改组件问题 (5.0)
|
|
44
|
+
- 95abba983: fix: 修改 UI 问题 (5.0)
|
|
45
|
+
- f3bf08f27: fix(cascader): 平铺搜索结果时不再展示不可点击的父节点 (5.0)
|
|
46
|
+
- de8d058dc: perf: 对下拉选择类组件的 customRender 的内容增加 memoization 以优化性能 (5.0)
|
|
47
|
+
- 5210770d9: feat(picker): add header api (5.0)
|
|
48
|
+
- 424700fc5: style(cascader&check-cascader): 调整下拉框样式,增加搜索框宽度设置 (5.0)
|
|
49
|
+
- 4b2596538: <br>
|
|
50
|
+
- style(cascader&check-cascader): 增加 white-space: nowrap; 样式以防止文本换行 (5.0)
|
|
51
|
+
- style(cascader&check-cascader): 调整搜索框默认宽度为 100px (5.0)
|
|
52
|
+
- feat(check-cascader): 增加 flattedSearchResult 属性,用于控制搜索结果的展现形式 (5.0)
|
|
53
|
+
- fix(cascader): 修复当搜索结果为空时,下拉框没有显示空状态问题 (5.0)
|
|
54
|
+
- 33da3144e: build: 将 package.json 中 exports 配置中的 types 配置放在最上面 (5.0)
|
|
55
|
+
- 7f3abee55: style: fix ui bug (5.0)
|
|
56
|
+
- 0a4e90dbd: <br>
|
|
95
57
|
- style(tag-input): 间距调整 (5.0)
|
|
96
58
|
- style(select): 选择类组件选项圆角改为 4px (5.0)
|
|
97
59
|
- style(picker): 搜索框样式调整 (5.0)
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
-
|
|
60
|
+
- 79739ed82: <br>
|
|
61
|
+
- fix(cascader): 处理当 value 为空时清空选项的选中态(5.0)
|
|
62
|
+
- style(cascader&check-cascader): 调整选项容器最小宽度为 160px (5.0)
|
|
63
|
+
- style(cascader&check-cascader): 优化下拉框宽度,让内容和搜索框默认宽度对齐 (5.0)
|
|
64
|
+
- perf(cascader&check-cascader): 优化 customRender 函数,支持传递选中项和当前值 (5.0)
|
|
65
|
+
- 4a31cea53: style: 统一调整选择类组件 hover 时的背景色 (5.0)
|
|
66
|
+
- 99801c2d1: fix: 修复 UI 问题 (5.0)
|
|
67
|
+
- Updated dependencies [0b34e1c15]
|
|
68
|
+
- Updated dependencies [da2e63a14]
|
|
69
|
+
- Updated dependencies [1e226cd66]
|
|
70
|
+
- Updated dependencies [b9989e482]
|
|
71
|
+
- Updated dependencies [1662753e0]
|
|
72
|
+
- Updated dependencies [122d1d859]
|
|
73
|
+
- Updated dependencies [f1ab51725]
|
|
74
|
+
- Updated dependencies [41552be0b]
|
|
75
|
+
- Updated dependencies [8c0ee78f0]
|
|
76
|
+
- Updated dependencies [9b34d99bc]
|
|
77
|
+
- Updated dependencies [8f3aa85e4]
|
|
78
|
+
- Updated dependencies [f4fc0ef30]
|
|
79
|
+
- Updated dependencies [ec4c7faa2]
|
|
80
|
+
- Updated dependencies [29cae09ea]
|
|
81
|
+
- Updated dependencies [fd4c20bbd]
|
|
82
|
+
- Updated dependencies [be5a59325]
|
|
83
|
+
- Updated dependencies [71fc15e5c]
|
|
84
|
+
- Updated dependencies [79ea480f3]
|
|
85
|
+
- Updated dependencies [2e56529f7]
|
|
86
|
+
- Updated dependencies [277c5033a]
|
|
87
|
+
- Updated dependencies [95abba983]
|
|
88
|
+
- Updated dependencies [4a31cea53]
|
|
89
|
+
- Updated dependencies [976ec929d]
|
|
90
|
+
- Updated dependencies [f1ab51725]
|
|
91
|
+
- Updated dependencies [6dca7795c]
|
|
92
|
+
- Updated dependencies [7b956b1eb]
|
|
93
|
+
- Updated dependencies [5210770d9]
|
|
94
|
+
- Updated dependencies [e2d184e74]
|
|
95
|
+
- Updated dependencies [4006b2c8c]
|
|
96
|
+
- Updated dependencies [77d969c2e]
|
|
97
|
+
- Updated dependencies [e42e2badf]
|
|
98
|
+
- Updated dependencies [33da3144e]
|
|
99
|
+
- Updated dependencies [7f3abee55]
|
|
100
|
+
- Updated dependencies [6fcda9bf2]
|
|
101
|
+
- Updated dependencies [0a4e90dbd]
|
|
102
|
+
- Updated dependencies [58ad82e94]
|
|
103
|
+
- Updated dependencies [a0f0c9d6b]
|
|
104
|
+
- Updated dependencies [f2be367e9]
|
|
105
|
+
- Updated dependencies [1972fd16a]
|
|
106
|
+
- Updated dependencies [99801c2d1]
|
|
107
|
+
- Updated dependencies [86910f5e2]
|
|
108
|
+
- Updated dependencies [cb7b794d0]
|
|
109
|
+
- @hi-ui/picker@5.0.0-experimental.0
|
|
110
|
+
- @hi-ui/input@5.0.0-experimental.0
|
|
111
|
+
- @hi-ui/popper@5.0.0-experimental.0
|
|
112
|
+
- @hi-ui/icons@5.0.0-experimental.0
|
|
113
|
+
- @hi-ui/virtual-list@5.0.0-experimental.0
|
|
114
|
+
- @hi-ui/core@5.0.0-experimental.0
|
|
115
|
+
- @hi-ui/use-check-state@5.0.0-experimental.0
|
|
116
|
+
- @hi-ui/use-data-source@5.0.0-experimental.0
|
|
117
|
+
- @hi-ui/use-latest@5.0.0-experimental.0
|
|
118
|
+
- @hi-ui/use-search-mode@5.0.0-experimental.0
|
|
119
|
+
- @hi-ui/use-toggle@5.0.0-experimental.0
|
|
120
|
+
- @hi-ui/use-uncontrolled-state@5.0.0-experimental.0
|
|
121
|
+
- @hi-ui/highlighter@5.0.0-experimental.0
|
|
122
|
+
- @hi-ui/spinner@5.0.0-experimental.0
|
|
123
|
+
- @hi-ui/array-utils@5.0.0-experimental.0
|
|
124
|
+
- @hi-ui/classname@5.0.0-experimental.0
|
|
125
|
+
- @hi-ui/env@5.0.0-experimental.0
|
|
126
|
+
- @hi-ui/func-utils@5.0.0-experimental.0
|
|
127
|
+
- @hi-ui/tree-utils@5.0.0-experimental.0
|
|
128
|
+
- @hi-ui/type-assertion@5.0.0-experimental.0
|
|
129
|
+
|
|
130
|
+
## 4.5.2
|
|
107
131
|
|
|
108
132
|
### Patch Changes
|
|
109
133
|
|
|
110
|
-
-
|
|
111
|
-
- @hi-ui/input@5.0.0-canary.2
|
|
134
|
+
- [#3415](https://github.com/XiaoMi/hiui/pull/3415) [`e7a09db`](https://github.com/XiaoMi/hiui/commit/e7a09db7f75022fee82a254a74a2ec17c6b03638) Thanks [@zyprepare](https://github.com/zyprepare)! - fix(cascader): 修复在异步加载数据下,首次打开弹窗没有定位到已选节点位置的问题 (#3414)
|
|
112
135
|
|
|
113
|
-
## 5.
|
|
136
|
+
## 4.5.1
|
|
114
137
|
|
|
115
138
|
### Patch Changes
|
|
116
139
|
|
|
117
|
-
-
|
|
118
|
-
- Updated dependencies [3903bd4ff]
|
|
119
|
-
- @hi-ui/input@5.0.0-canary.1
|
|
120
|
-
- @hi-ui/picker@5.0.0-canary.1
|
|
140
|
+
- [#3407](https://github.com/XiaoMi/hiui/pull/3407) [`4a1444965`](https://github.com/XiaoMi/hiui/commit/4a1444965bdeeeb12333e43a05caa2e76d74eb47) Thanks [@zyprepare](https://github.com/zyprepare)! - perf(cascader): 体验优化:每次打开菜单时自动定位到已选节点 (#3406)
|
|
121
141
|
|
|
122
|
-
|
|
142
|
+
- Updated dependencies [[`b2de718e9`](https://github.com/XiaoMi/hiui/commit/b2de718e9fd12dbe8fa1d762c6924696c19bc924)]:
|
|
143
|
+
- @hi-ui/core@4.0.11
|
|
123
144
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
- 225ebaa51: feat: 组件的 package.json 中的 exports 统一加上 types 配置 (5.0)
|
|
145
|
+
## 4.5.0
|
|
127
146
|
|
|
128
147
|
### Minor Changes
|
|
129
148
|
|
|
130
|
-
-
|
|
131
|
-
- feat(picker): 下拉选择类组件增加 xs 尺寸 (5.0)
|
|
132
|
-
- feat(input): 输入框组件增加 xs 尺寸 (5.0)
|
|
149
|
+
- [#3231](https://github.com/XiaoMi/hiui/pull/3231) [`bbba46153`](https://github.com/XiaoMi/hiui/commit/bbba4615313cd0618deff633bebc657e7f34ec94) Thanks [@zyprepare](https://github.com/zyprepare)! - feat(cascader): onChange 回调中增加选中项对象参数返回 (#3230)
|
|
133
150
|
|
|
134
151
|
### Patch Changes
|
|
135
152
|
|
|
136
|
-
- Updated dependencies [
|
|
137
|
-
-
|
|
138
|
-
- Updated dependencies [428716024]
|
|
139
|
-
- @hi-ui/input@5.0.0-canary.0
|
|
140
|
-
- @hi-ui/picker@5.0.0-canary.0
|
|
141
|
-
- @hi-ui/core@5.0.0-canary.0
|
|
142
|
-
- @hi-ui/use-check-state@5.0.0-canary.0
|
|
143
|
-
- @hi-ui/use-data-source@5.0.0-canary.0
|
|
144
|
-
- @hi-ui/use-latest@5.0.0-canary.0
|
|
145
|
-
- @hi-ui/use-search-mode@5.0.0-canary.0
|
|
146
|
-
- @hi-ui/use-toggle@5.0.0-canary.0
|
|
147
|
-
- @hi-ui/use-uncontrolled-state@5.0.0-canary.0
|
|
148
|
-
- @hi-ui/icons@5.0.0-canary.0
|
|
149
|
-
- @hi-ui/highlighter@5.0.0-canary.0
|
|
150
|
-
- @hi-ui/popper@5.0.0-canary.0
|
|
151
|
-
- @hi-ui/spinner@5.0.0-canary.0
|
|
152
|
-
- @hi-ui/array-utils@5.0.0-canary.0
|
|
153
|
-
- @hi-ui/classname@5.0.0-canary.0
|
|
154
|
-
- @hi-ui/env@5.0.0-canary.0
|
|
155
|
-
- @hi-ui/func-utils@5.0.0-canary.0
|
|
156
|
-
- @hi-ui/tree-utils@5.0.0-canary.0
|
|
157
|
-
- @hi-ui/type-assertion@5.0.0-canary.0
|
|
153
|
+
- Updated dependencies [[`dc1311a91`](https://github.com/XiaoMi/hiui/commit/dc1311a917518bc5debef755a9fcd4e33fb58790)]:
|
|
154
|
+
- @hi-ui/use-search-mode@4.2.1
|
|
158
155
|
|
|
159
156
|
## 4.4.1
|
|
160
157
|
|
package/lib/cjs/Cascader.js
CHANGED
|
@@ -47,6 +47,7 @@ var NOOP_ARRAY = [];
|
|
|
47
47
|
* Trigger + MenuList + Search
|
|
48
48
|
*/
|
|
49
49
|
var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
50
|
+
var _a;
|
|
50
51
|
var _props$prefixCls = props.prefixCls,
|
|
51
52
|
prefixCls = _props$prefixCls === void 0 ? _prefix : _props$prefixCls,
|
|
52
53
|
className = props.className,
|
|
@@ -69,6 +70,7 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
69
70
|
searchableProp = props.searchable,
|
|
70
71
|
keywordProp = props.keyword,
|
|
71
72
|
onSearchProp = props.onSearch,
|
|
73
|
+
clearSearchOnClosed = props.clearSearchOnClosed,
|
|
72
74
|
titleRender = props.render,
|
|
73
75
|
overlayClassName = props.overlayClassName,
|
|
74
76
|
_props$data = props.data,
|
|
@@ -76,8 +78,7 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
76
78
|
_props$flattedSearchR = props.flattedSearchResult,
|
|
77
79
|
flattedSearchResult = _props$flattedSearchR === void 0 ? true : _props$flattedSearchR,
|
|
78
80
|
visible = props.visible,
|
|
79
|
-
|
|
80
|
-
size = _props$size === void 0 ? 'md' : _props$size,
|
|
81
|
+
sizeProp = props.size,
|
|
81
82
|
prefix = props.prefix,
|
|
82
83
|
suffix = props.suffix,
|
|
83
84
|
onOpen = props.onOpen,
|
|
@@ -90,7 +91,15 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
90
91
|
customRender = props.customRender,
|
|
91
92
|
label = props.label,
|
|
92
93
|
virtual = props.virtual,
|
|
93
|
-
|
|
94
|
+
onItemClickProp = props.onItemClick,
|
|
95
|
+
_props$showIndicator = props.showIndicator,
|
|
96
|
+
showIndicator = _props$showIndicator === void 0 ? true : _props$showIndicator,
|
|
97
|
+
renderExtraHeader = props.renderExtraHeader,
|
|
98
|
+
changeOnSelect = props.changeOnSelect,
|
|
99
|
+
rest = tslib.__rest(props, ["prefixCls", "className", "placeholder", "disabled", "clearable", "type", "fieldNames", "expandTrigger", "displayRender", "onSelect", "onLoadChildren", "appearance", "invalid", "filterOption", "searchable", "keyword", "onSearch", "clearSearchOnClosed", "render", "overlayClassName", "data", "flattedSearchResult", "visible", "size", "prefix", "suffix", "onOpen", "onClose", "onClear", "renderExtraFooter", "dropdownColumnRender", "closeOnSelect", "customRender", "label", "virtual", "onItemClick", "showIndicator", "renderExtraHeader", "changeOnSelect"]);
|
|
100
|
+
var _useGlobalContext = core.useGlobalContext(),
|
|
101
|
+
globalSize = _useGlobalContext.size;
|
|
102
|
+
var size = (_a = sizeProp !== null && sizeProp !== void 0 ? sizeProp : globalSize) !== null && _a !== void 0 ? _a : 'md';
|
|
94
103
|
var i18n = core.useLocaleContext();
|
|
95
104
|
var pickerInnerRef = React.useRef(null);
|
|
96
105
|
var placeholder = typeAssertion.isUndef(placeholderProp) ? i18n.get('cascader.placeholder') : placeholderProp;
|
|
@@ -140,7 +149,7 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
140
149
|
flattedData: flattedData,
|
|
141
150
|
enabled: searchableProp,
|
|
142
151
|
exclude: function exclude(node) {
|
|
143
|
-
return node.disabled;
|
|
152
|
+
return node.disabled || (changeOnSelect ? false : node.children);
|
|
144
153
|
}
|
|
145
154
|
// exclude: (option: FlattedCascaderDataItem) => {
|
|
146
155
|
// return checkCanLoadChildren(option, onLoadChildren)
|
|
@@ -180,7 +189,7 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
180
189
|
var shouldUseSearch = !!searchValue;
|
|
181
190
|
// 搜索的结果列表也采用 flatted 模式进行展示
|
|
182
191
|
var flatted = shouldUseSearch ? flattedSearchResult : type === 'flatted';
|
|
183
|
-
var
|
|
192
|
+
var _b = useCascader.useCascader(Object.assign(Object.assign({}, rest), {
|
|
184
193
|
disabled: disabled,
|
|
185
194
|
fieldNames: fieldNames,
|
|
186
195
|
flatted: flatted,
|
|
@@ -190,13 +199,15 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
190
199
|
// @ts-ignore
|
|
191
200
|
cascaderData: cascaderData,
|
|
192
201
|
setCascaderData: setCascaderData,
|
|
193
|
-
flattedData: flattedData
|
|
202
|
+
flattedData: flattedData,
|
|
203
|
+
changeOnSelect: changeOnSelect
|
|
194
204
|
})),
|
|
195
|
-
rootProps =
|
|
196
|
-
context$1 = tslib.__rest(
|
|
205
|
+
rootProps = _b.rootProps,
|
|
206
|
+
context$1 = tslib.__rest(_b, ["rootProps"]);
|
|
197
207
|
var value = context$1.value,
|
|
198
208
|
tryChangeValue = context$1.tryChangeValue,
|
|
199
209
|
reset = context$1.reset,
|
|
210
|
+
clear = context$1.clear,
|
|
200
211
|
menuList = context$1.menuList,
|
|
201
212
|
getItemRequiredProps = context$1.getItemRequiredProps;
|
|
202
213
|
var showData = React.useMemo(function () {
|
|
@@ -222,6 +233,14 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
222
233
|
}
|
|
223
234
|
return flattedData;
|
|
224
235
|
}, [selectedItem, flattedData]);
|
|
236
|
+
var mergedDataSelectedItem = React.useMemo(function () {
|
|
237
|
+
return mergedData.find(function (d) {
|
|
238
|
+
return d.id === value[value.length - 1];
|
|
239
|
+
});
|
|
240
|
+
}, [mergedData, value]);
|
|
241
|
+
var customRenderContent = React.useMemo(function () {
|
|
242
|
+
return customRender ? typeof customRender === 'function' ? customRender(mergedDataSelectedItem, value) : customRender : null;
|
|
243
|
+
}, [customRender, mergedDataSelectedItem, value]);
|
|
225
244
|
var cls = classname.cx(prefixCls, className, prefixCls + "--" + (menuVisible ? 'open' : 'closed'));
|
|
226
245
|
React.useEffect(function () {
|
|
227
246
|
var _a;
|
|
@@ -230,13 +249,19 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
230
249
|
(_a = pickerInnerRef.current) === null || _a === void 0 ? void 0 : _a.update();
|
|
231
250
|
}
|
|
232
251
|
}, [menuVisible, showData]);
|
|
252
|
+
React.useEffect(function () {
|
|
253
|
+
if (!value || value.length === 0) {
|
|
254
|
+
clear();
|
|
255
|
+
}
|
|
256
|
+
}, [value, clear]);
|
|
233
257
|
return /*#__PURE__*/React__default["default"].createElement(context.CascaderProvider, {
|
|
234
258
|
value: Object.assign(Object.assign({}, context$1), {
|
|
235
259
|
expandTrigger: expandTrigger,
|
|
236
260
|
titleRender: proxyTitleRender,
|
|
237
261
|
menuList: showData,
|
|
238
262
|
dropdownColumnRender: dropdownColumnRender,
|
|
239
|
-
virtual: virtual
|
|
263
|
+
virtual: virtual,
|
|
264
|
+
onItemClickProp: onItemClickProp
|
|
240
265
|
})
|
|
241
266
|
}, /*#__PURE__*/React__default["default"].createElement(picker.Picker, Object.assign({
|
|
242
267
|
ref: ref,
|
|
@@ -257,7 +282,9 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
257
282
|
footer: typeAssertion.isFunction(renderExtraFooter) && renderExtraFooter(),
|
|
258
283
|
keyword: keywordProp,
|
|
259
284
|
onSearch: funcUtils.callAllFuncs(onSearchProp, onSearch),
|
|
260
|
-
|
|
285
|
+
clearSearchOnClosed: clearSearchOnClosed,
|
|
286
|
+
header: renderExtraHeader === null || renderExtraHeader === void 0 ? void 0 : renderExtraHeader(),
|
|
287
|
+
trigger: customRender ? customRenderContent : ( /*#__PURE__*/React__default["default"].createElement(input.MockInput, {
|
|
261
288
|
style: {
|
|
262
289
|
maxWidth: appearance === 'contained' ? '360px' : undefined
|
|
263
290
|
},
|
|
@@ -267,6 +294,7 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
267
294
|
placeholder: placeholder,
|
|
268
295
|
displayRender: displayRender,
|
|
269
296
|
prefix: prefix,
|
|
297
|
+
showIndicator: showIndicator,
|
|
270
298
|
suffix: [menuVisible ? /*#__PURE__*/React__default["default"].createElement(icons.UpOutlined, null) : /*#__PURE__*/React__default["default"].createElement(icons.DownOutlined, null), suffix],
|
|
271
299
|
focused: menuVisible,
|
|
272
300
|
value: value[value.length - 1],
|
|
@@ -22,13 +22,14 @@ 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
|
|
25
|
+
var VirtualList = require('@hi-ui/virtual-list');
|
|
26
26
|
function _interopDefaultCompat(e) {
|
|
27
27
|
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
28
28
|
'default': e
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
32
|
+
var VirtualList__default = /*#__PURE__*/_interopDefaultCompat(VirtualList);
|
|
32
33
|
var menuListPrefix = classname.getPrefixCls('cascader-menu-list');
|
|
33
34
|
var CascaderMenuList = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
34
35
|
var _a$prefixCls = _a.prefixCls,
|
|
@@ -78,7 +79,7 @@ var CascaderMenu = function CascaderMenu(_ref) {
|
|
|
78
79
|
className: cls,
|
|
79
80
|
style: style,
|
|
80
81
|
role: role
|
|
81
|
-
}, typeAssertion.isArrayNonEmpty(menu) ? virtual ? ( /*#__PURE__*/React__default["default"].createElement(
|
|
82
|
+
}, typeAssertion.isArrayNonEmpty(menu) ? virtual ? ( /*#__PURE__*/React__default["default"].createElement(VirtualList__default["default"], Object.assign({
|
|
82
83
|
itemKey: 'id',
|
|
83
84
|
fullHeight: false
|
|
84
85
|
}, virtualListProps), function (option) {
|
|
@@ -103,6 +104,7 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
|
103
104
|
disabledContext = _useCascaderContext3.disabled,
|
|
104
105
|
expandTrigger = _useCascaderContext3.expandTrigger,
|
|
105
106
|
onItemClick = _useCascaderContext3.onItemClick,
|
|
107
|
+
onItemClickProp = _useCascaderContext3.onItemClickProp,
|
|
106
108
|
onItemHover = _useCascaderContext3.onItemHover,
|
|
107
109
|
titleRender = _useCascaderContext3.titleRender,
|
|
108
110
|
onLoadChildren = _useCascaderContext3.onLoadChildren,
|
|
@@ -117,12 +119,14 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
|
117
119
|
ref: ref,
|
|
118
120
|
key: option.id,
|
|
119
121
|
role: "menu-item",
|
|
120
|
-
className: prefixCls + "-item"
|
|
122
|
+
className: prefixCls + "-item",
|
|
123
|
+
title: typeof option.title === 'string' ? option.title : undefined
|
|
121
124
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
122
125
|
className: optionCls,
|
|
123
|
-
onClick: function onClick() {
|
|
126
|
+
onClick: function onClick(evt) {
|
|
124
127
|
if (disabled) return;
|
|
125
128
|
onItemClick(eventOption);
|
|
129
|
+
onItemClickProp === null || onItemClickProp === void 0 ? void 0 : onItemClickProp(evt, eventOption);
|
|
126
130
|
},
|
|
127
131
|
onMouseEnter: function onMouseEnter() {
|
|
128
132
|
if (disabled) return;
|
|
@@ -62,53 +62,56 @@ 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_1) {
|
|
66
|
+
for (var _len = arguments.length, args_1 = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
67
|
+
args_1[_key - 1] = arguments[_key];
|
|
68
68
|
}
|
|
69
|
-
return tslib.__awaiter(void 0,
|
|
69
|
+
return tslib.__awaiter(void 0, [node_1].concat(args_1), void 0, /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(node, onlyExpand) {
|
|
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
|
+
}
|
|
75
78
|
// 直接触发选中该节点
|
|
76
79
|
onExpandLatest(node, onlyExpand);
|
|
77
80
|
id = node.id, children = node.children, isLeaf = node.isLeaf;
|
|
78
81
|
if (!children) {
|
|
79
|
-
_context2.next =
|
|
82
|
+
_context2.next = 5;
|
|
80
83
|
break;
|
|
81
84
|
}
|
|
82
85
|
return _context2.abrupt("return");
|
|
83
|
-
case
|
|
86
|
+
case 5:
|
|
84
87
|
if (!isLeaf) {
|
|
85
|
-
_context2.next =
|
|
88
|
+
_context2.next = 7;
|
|
86
89
|
break;
|
|
87
90
|
}
|
|
88
91
|
return _context2.abrupt("return");
|
|
89
|
-
case
|
|
92
|
+
case 7:
|
|
90
93
|
if (!onLoadChildren) {
|
|
91
|
-
_context2.next =
|
|
94
|
+
_context2.next = 18;
|
|
92
95
|
break;
|
|
93
96
|
}
|
|
94
97
|
addLoadingIds(id);
|
|
95
|
-
_context2.prev =
|
|
96
|
-
_context2.next =
|
|
98
|
+
_context2.prev = 9;
|
|
99
|
+
_context2.next = 12;
|
|
97
100
|
return loadChildren(node);
|
|
98
|
-
case
|
|
101
|
+
case 12:
|
|
99
102
|
removeLoadingIds(id);
|
|
100
|
-
_context2.next =
|
|
103
|
+
_context2.next = 18;
|
|
101
104
|
break;
|
|
102
|
-
case
|
|
103
|
-
_context2.prev =
|
|
104
|
-
_context2.t0 = _context2["catch"](
|
|
105
|
+
case 15:
|
|
106
|
+
_context2.prev = 15;
|
|
107
|
+
_context2.t0 = _context2["catch"](9);
|
|
105
108
|
removeLoadingIds(id);
|
|
106
|
-
case
|
|
109
|
+
case 18:
|
|
107
110
|
case "end":
|
|
108
111
|
return _context2.stop();
|
|
109
112
|
}
|
|
110
113
|
}
|
|
111
|
-
}, _callee2, null, [[
|
|
114
|
+
}, _callee2, null, [[9, 15]]);
|
|
112
115
|
}));
|
|
113
116
|
}, [loadChildren, onLoadChildren, onExpandLatest, addLoadingIds, removeLoadingIds]);
|
|
114
117
|
return [isLoadingId, onNodeSwitch];
|
package/lib/cjs/icons/index.js
CHANGED
|
@@ -23,13 +23,10 @@ function _interopDefaultCompat(e) {
|
|
|
23
23
|
}
|
|
24
24
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
25
25
|
var defaultSuffixIcon = /*#__PURE__*/React__default["default"].createElement(icons.DownOutlined, null);
|
|
26
|
-
var defaultLeafIcon =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
width: 16
|
|
30
|
-
}
|
|
26
|
+
var defaultLeafIcon = null;
|
|
27
|
+
var defaultLoadingIcon = /*#__PURE__*/React__default["default"].createElement(spinner.Spinner, {
|
|
28
|
+
size: "sm"
|
|
31
29
|
});
|
|
32
|
-
var defaultLoadingIcon = /*#__PURE__*/React__default["default"].createElement(spinner.Spinner, null);
|
|
33
30
|
exports.defaultLeafIcon = defaultLeafIcon;
|
|
34
31
|
exports.defaultLoadingIcon = defaultLoadingIcon;
|
|
35
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-
|
|
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-menu-switcher--arrow {-webkit-transform: rotate(-90deg);transform: rotate(-90deg);}.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;
|
package/lib/cjs/use-cascader.js
CHANGED
|
@@ -99,9 +99,13 @@ var useCascader = function useCascader(_a) {
|
|
|
99
99
|
var reset = React.useCallback(function () {
|
|
100
100
|
setSelectedId(value[value.length - 1]);
|
|
101
101
|
}, [setSelectedId, value]);
|
|
102
|
+
var clear = React.useCallback(function () {
|
|
103
|
+
setSelectedId(value[value.length <= 1 ? 0 : value.length - 2]);
|
|
104
|
+
}, [setSelectedId, value]);
|
|
102
105
|
return {
|
|
103
106
|
rootProps: rest,
|
|
104
107
|
reset: reset,
|
|
108
|
+
clear: clear,
|
|
105
109
|
flattedData: flattedData,
|
|
106
110
|
value: value,
|
|
107
111
|
tryChangeValue: tryChangeValue,
|
package/lib/cjs/utils/index.js
CHANGED
|
@@ -107,6 +107,7 @@ var getFilteredMenuList = function getFilteredMenuList(menuList, searchedData) {
|
|
|
107
107
|
item = item.parent;
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
|
+
if (result.length === 0) return result;
|
|
110
111
|
return menuList.map(function (depthItems, depth) {
|
|
111
112
|
var depthSavedMp = result[depth];
|
|
112
113
|
if (!depthSavedMp) return depthItems;
|