@hi-ui/table 4.5.6-alpha.0 → 4.6.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 +334 -0
- package/lib/cjs/Table.js +17 -4
- package/lib/cjs/hooks/use-check.js +9 -1
- package/lib/cjs/packages/ui/radio/lib/esm/Radio.js +100 -0
- package/lib/cjs/packages/ui/radio/lib/esm/RadioGroup.js +104 -0
- package/lib/cjs/packages/ui/radio/lib/esm/context.js +37 -0
- package/lib/cjs/packages/ui/radio/lib/esm/index.js +33 -0
- package/lib/cjs/packages/ui/radio/lib/esm/styles/index.scss.js +35 -0
- package/lib/cjs/packages/ui/radio/lib/esm/types.js +34 -0
- package/lib/cjs/packages/ui/radio/lib/esm/use-radio-group.js +61 -0
- package/lib/cjs/packages/ui/radio/lib/esm/use-radio.js +88 -0
- package/lib/esm/Table.js +17 -4
- package/lib/esm/hooks/use-check.js +9 -1
- package/lib/esm/packages/ui/radio/lib/esm/Radio.js +88 -0
- package/lib/esm/packages/ui/radio/lib/esm/RadioGroup.js +92 -0
- package/lib/esm/packages/ui/radio/lib/esm/context.js +31 -0
- package/lib/esm/packages/ui/radio/lib/esm/index.js +26 -0
- package/lib/esm/packages/ui/radio/lib/esm/styles/index.scss.js +23 -0
- package/lib/esm/packages/ui/radio/lib/esm/types.js +27 -0
- package/lib/esm/packages/ui/radio/lib/esm/use-radio-group.js +56 -0
- package/lib/esm/packages/ui/radio/lib/esm/use-radio.js +83 -0
- package/lib/types/hooks/use-check.d.ts +1 -0
- package/lib/types/types.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
# @hi-ui/table
|
|
2
|
+
|
|
3
|
+
## 4.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#2968](https://github.com/XiaoMi/hiui/pull/2968) [`6ed4e8eeb`](https://github.com/XiaoMi/hiui/commit/6ed4e8eeb1edb97ed23aa3d5366f993575a6df57) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: 行选中增加单选
|
|
8
|
+
|
|
9
|
+
## 4.5.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#2867](https://github.com/XiaoMi/hiui/pull/2867) [`eec624313`](https://github.com/XiaoMi/hiui/commit/eec624313de88943869f592dd06248455bddedbc) Thanks [@aqiusen](https://github.com/aqiusen)! - 修复统计行中选中模式下显示异常问题(#2863)
|
|
14
|
+
|
|
15
|
+
- [#2859](https://github.com/XiaoMi/hiui/pull/2859) [`a8d3a1f26`](https://github.com/XiaoMi/hiui/commit/a8d3a1f2687709b986fc54408cb6c69b9eb56318) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复 onDragStart 事件不触发问题
|
|
16
|
+
|
|
17
|
+
- [#2847](https://github.com/XiaoMi/hiui/pull/2847) [`0e67d2263`](https://github.com/XiaoMi/hiui/commit/0e67d2263c7e1bf9213e1a2f74300ee201f3a52e) Thanks [@aqiusen](https://github.com/aqiusen)! - fix(table): 修复虚拟列表 maxHeight 无法支持字符串问题
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [[`5508758ec`](https://github.com/XiaoMi/hiui/commit/5508758ec2fe241d635949828065111c9a465ef8)]:
|
|
20
|
+
- @hi-ui/pagination@4.0.16
|
|
21
|
+
|
|
22
|
+
## 4.5.4
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- [#2839](https://github.com/XiaoMi/hiui/pull/2839) [`e8498f36e`](https://github.com/XiaoMi/hiui/commit/e8498f36efe4dd42e0ef26c2e4c60298e2ce0147) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复 columns 中将 title 设置为空字符串报错
|
|
27
|
+
|
|
28
|
+
- [#2840](https://github.com/XiaoMi/hiui/pull/2840) [`c2afbaf33`](https://github.com/XiaoMi/hiui/commit/c2afbaf337dc933aa3858187e0010255ee2b82d5) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复同时设置 fieldKey 和 rowSelection 时 onChange 回调参数异常问题
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [[`3afbf239e`](https://github.com/XiaoMi/hiui/commit/3afbf239e816ede48d6a85cbd99b6b099b8c8eb3), [`613c15a41`](https://github.com/XiaoMi/hiui/commit/613c15a41d783b86d86ccfb1dccd4da897e5ba9c), [`5d531802b`](https://github.com/XiaoMi/hiui/commit/5d531802ba9b142d448a2de2a7a8315722be0af8)]:
|
|
31
|
+
- @hi-ui/env@4.0.7
|
|
32
|
+
- @hi-ui/select@4.4.2
|
|
33
|
+
|
|
34
|
+
## 4.5.3
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- [#2817](https://github.com/XiaoMi/hiui/pull/2817) [`c32ae3dd9`](https://github.com/XiaoMi/hiui/commit/c32ae3dd9b5a89840270649fc397d474e9e1de4b) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复表头分组单元格边框显示问题
|
|
39
|
+
|
|
40
|
+
## 4.5.2
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- [#2791](https://github.com/XiaoMi/hiui/pull/2791) [`1a00f9fc4`](https://github.com/XiaoMi/hiui/commit/1a00f9fc4a44619059d7852e846b54fedbd56715) Thanks [@zyprepare](https://github.com/zyprepare)! - build: style-inject(node 环境下有问题) 替换为 @hi-ui/style-inject
|
|
45
|
+
|
|
46
|
+
- [#2790](https://github.com/XiaoMi/hiui/pull/2790) [`86a096b03`](https://github.com/XiaoMi/hiui/commit/86a096b031e42622714c4147ea99d2867baddfda) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复全选时 onChange 第 4 个参数返回 undefined 问题
|
|
47
|
+
|
|
48
|
+
- Updated dependencies [[`1a00f9fc4`](https://github.com/XiaoMi/hiui/commit/1a00f9fc4a44619059d7852e846b54fedbd56715)]:
|
|
49
|
+
- @hi-ui/env@4.0.5
|
|
50
|
+
- @hi-ui/icons@4.0.19
|
|
51
|
+
- @hi-ui/button@4.0.10
|
|
52
|
+
- @hi-ui/checkbox@4.0.10
|
|
53
|
+
- @hi-ui/drawer@4.1.4
|
|
54
|
+
- @hi-ui/empty-state@4.1.1
|
|
55
|
+
- @hi-ui/icon-button@4.0.9
|
|
56
|
+
- @hi-ui/loading@4.2.1
|
|
57
|
+
- @hi-ui/pagination@4.0.15
|
|
58
|
+
- @hi-ui/popper@4.1.5
|
|
59
|
+
- @hi-ui/scrollbar@4.1.1
|
|
60
|
+
- @hi-ui/select@4.4.1
|
|
61
|
+
- @hi-ui/spinner@4.0.9
|
|
62
|
+
- @hi-ui/array-utils@4.0.5
|
|
63
|
+
- @hi-ui/classname@4.0.5
|
|
64
|
+
|
|
65
|
+
## 4.5.1
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- [#2760](https://github.com/XiaoMi/hiui/pull/2760) [`68afb78ed`](https://github.com/XiaoMi/hiui/commit/68afb78ed1fb8e42bc8eec68cfa5f1787ee052b0) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复 Safari 中设置 virtual 后只能表头滚动问题
|
|
70
|
+
|
|
71
|
+
- [#2759](https://github.com/XiaoMi/hiui/pull/2759) [`7437ca3b0`](https://github.com/XiaoMi/hiui/commit/7437ca3b07ce1fb66fe9fa3572b45c2928e64a73) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复 SettingDrawer 列更新问题
|
|
72
|
+
|
|
73
|
+
## 4.5.0
|
|
74
|
+
|
|
75
|
+
### Minor Changes
|
|
76
|
+
|
|
77
|
+
- [#2735](https://github.com/XiaoMi/hiui/pull/2735) [`a2b9df50b`](https://github.com/XiaoMi/hiui/commit/a2b9df50b454ae033a5dd0e5f6165ab2f6de07a5) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: 设置 rowSelection 后默认冻结该列
|
|
78
|
+
|
|
79
|
+
- [#2735](https://github.com/XiaoMi/hiui/pull/2735) [`81863f522`](https://github.com/XiaoMi/hiui/commit/81863f52200213ae7740f496c4fe8d73f607b66c) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: setting 增加 trigger 配置
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- [#2726](https://github.com/XiaoMi/hiui/pull/2726) [`459c7940c`](https://github.com/XiaoMi/hiui/commit/459c7940cc94b124e182754474424e13de9f120a) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复双表格结构下,无法设置空状态内容问题
|
|
84
|
+
|
|
85
|
+
- [#2735](https://github.com/XiaoMi/hiui/pull/2735) [`6ac546d3e`](https://github.com/XiaoMi/hiui/commit/6ac546d3e9c1b863fb30941dd365220fa138258a) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复虚拟表格设置 maxHeight 底部内容被遮挡问题
|
|
86
|
+
|
|
87
|
+
- [#2735](https://github.com/XiaoMi/hiui/pull/2735) [`b971c0b06`](https://github.com/XiaoMi/hiui/commit/b971c0b06b1c64dd72c79c23068c4fed684d97c3) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复同时设置 bordered 和 scrollbar 后滚动异常问题
|
|
88
|
+
|
|
89
|
+
- [#2735](https://github.com/XiaoMi/hiui/pull/2735) [`a2b9df50b`](https://github.com/XiaoMi/hiui/commit/a2b9df50b454ae033a5dd0e5f6165ab2f6de07a5) Thanks [@zyprepare](https://github.com/zyprepare)! - feat(table): 设置 rowSelection 后默认冻结该列
|
|
90
|
+
|
|
91
|
+
- [#2748](https://github.com/XiaoMi/hiui/pull/2748) [`ca008e4ae`](https://github.com/XiaoMi/hiui/commit/ca008e4ae9753bc1f11efcdcbf09121d1ef07b56) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复表头分组超过 2 列时冻结列交互异常问题
|
|
92
|
+
|
|
93
|
+
- [#2735](https://github.com/XiaoMi/hiui/pull/2735) [`528314e46`](https://github.com/XiaoMi/hiui/commit/528314e46173dd18cc0140e60e763cb84b52fa2c) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复设置 dataSource 组件首次会执行 2 次请求问题
|
|
94
|
+
|
|
95
|
+
- [#2747](https://github.com/XiaoMi/hiui/pull/2747) [`b5654408e`](https://github.com/XiaoMi/hiui/commit/b5654408ee33b6448b6e9f1297a2790a486d753f) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 监听列变化,更新列最小可调整宽度
|
|
96
|
+
|
|
97
|
+
- Updated dependencies [[`a9b9c93fc`](https://github.com/XiaoMi/hiui/commit/a9b9c93fc3a3fea60d14052a5afeef9daf7efa1b), [`ca008e4ae`](https://github.com/XiaoMi/hiui/commit/ca008e4ae9753bc1f11efcdcbf09121d1ef07b56)]:
|
|
98
|
+
- @hi-ui/select@4.3.0
|
|
99
|
+
- @hi-ui/tree-utils@4.1.6
|
|
100
|
+
|
|
101
|
+
## 4.4.1
|
|
102
|
+
|
|
103
|
+
### Patch Changes
|
|
104
|
+
|
|
105
|
+
- [#2722](https://github.com/XiaoMi/hiui/pull/2722) [`a25261a88`](https://github.com/XiaoMi/hiui/commit/a25261a884f9b3470924c29564b3c4758ebab6cf) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复空状态下横向滚动条问题
|
|
106
|
+
|
|
107
|
+
- Updated dependencies [[`a25261a88`](https://github.com/XiaoMi/hiui/commit/a25261a884f9b3470924c29564b3c4758ebab6cf)]:
|
|
108
|
+
- @hi-ui/checkbox@4.0.9
|
|
109
|
+
|
|
110
|
+
## 4.4.0
|
|
111
|
+
|
|
112
|
+
### Minor Changes
|
|
113
|
+
|
|
114
|
+
- [#2699](https://github.com/XiaoMi/hiui/pull/2699) [`6c5d9c7ed`](https://github.com/XiaoMi/hiui/commit/6c5d9c7ed21eaebc26638ba6ee54eb3bfe918af4) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: add fixed and rowClassName api
|
|
115
|
+
feat: SettingDrawer 增加 extraHeader showCheckAll itemRender api
|
|
116
|
+
fix: 修复边框模式下样式问题
|
|
117
|
+
feat: SettingDrawer 支持配置列是否禁止拖拽
|
|
118
|
+
fix: 修复 resize 模式下多选时宽度被重置问题
|
|
119
|
+
fix: 修复树形表格节点图标没有对齐问题
|
|
120
|
+
fix: 修复虚拟表格边框样式问题
|
|
121
|
+
fix: 修复虚拟表格下双滚动条问题
|
|
122
|
+
fix: 修复虚拟表格下 size 和 maxHeight 失效问题
|
|
123
|
+
|
|
124
|
+
### Patch Changes
|
|
125
|
+
|
|
126
|
+
- Updated dependencies [[`4ec059bad`](https://github.com/XiaoMi/hiui/commit/4ec059badc67f3facc98288f3e7a67f51938e40f), [`ffd47b89a`](https://github.com/XiaoMi/hiui/commit/ffd47b89a5d7da54ea717fa827123e9c3b2b6d0f), [`cfc37dc37`](https://github.com/XiaoMi/hiui/commit/cfc37dc37c83ce737d88262644c07ca23cde0731), [`2fa5ee5b6`](https://github.com/XiaoMi/hiui/commit/2fa5ee5b6ecc7f95a5224fd91ccfcd263b41d932), [`9cf8e079f`](https://github.com/XiaoMi/hiui/commit/9cf8e079fd3f342d851d7abfecc1c0447c3ac40b)]:
|
|
127
|
+
- @hi-ui/loading@4.2.0
|
|
128
|
+
- @hi-ui/empty-state@4.1.0
|
|
129
|
+
- @hi-ui/tree-utils@4.1.5
|
|
130
|
+
- @hi-ui/scrollbar@4.1.0
|
|
131
|
+
|
|
132
|
+
## 4.3.4
|
|
133
|
+
|
|
134
|
+
### Patch Changes
|
|
135
|
+
|
|
136
|
+
- build: rollup2 构建
|
|
137
|
+
- Updated dependencies
|
|
138
|
+
- @hi-ui/core@4.0.8
|
|
139
|
+
- @hi-ui/use-cache@4.0.4
|
|
140
|
+
- @hi-ui/use-check@4.0.5
|
|
141
|
+
- @hi-ui/use-check-state@4.0.4
|
|
142
|
+
- @hi-ui/use-drag-sorter@4.0.4
|
|
143
|
+
- @hi-ui/use-latest@4.0.4
|
|
144
|
+
- @hi-ui/use-toggle@4.0.4
|
|
145
|
+
- @hi-ui/use-uncontrolled-state@4.0.4
|
|
146
|
+
- @hi-ui/use-update-effect@4.0.4
|
|
147
|
+
- @hi-ui/icons@4.0.18
|
|
148
|
+
- @hi-ui/button@4.0.9
|
|
149
|
+
- @hi-ui/checkbox@4.0.8
|
|
150
|
+
- @hi-ui/drawer@4.1.3
|
|
151
|
+
- @hi-ui/empty-state@4.0.7
|
|
152
|
+
- @hi-ui/icon-button@4.0.8
|
|
153
|
+
- @hi-ui/loading@4.1.3
|
|
154
|
+
- @hi-ui/pagination@4.0.14
|
|
155
|
+
- @hi-ui/popper@4.1.3
|
|
156
|
+
- @hi-ui/select@4.2.5
|
|
157
|
+
- @hi-ui/spinner@4.0.8
|
|
158
|
+
- @hi-ui/array-utils@4.0.4
|
|
159
|
+
- @hi-ui/classname@4.0.4
|
|
160
|
+
- @hi-ui/dom-utils@4.0.7
|
|
161
|
+
- @hi-ui/env@4.0.4
|
|
162
|
+
- @hi-ui/func-utils@4.0.4
|
|
163
|
+
- @hi-ui/object-utils@4.0.4
|
|
164
|
+
- @hi-ui/react-utils@4.0.4
|
|
165
|
+
- @hi-ui/times@4.0.4
|
|
166
|
+
- @hi-ui/tree-utils@4.1.4
|
|
167
|
+
- @hi-ui/type-assertion@4.0.4
|
|
168
|
+
|
|
169
|
+
## 4.3.3
|
|
170
|
+
|
|
171
|
+
### Patch Changes
|
|
172
|
+
|
|
173
|
+
- fix: 修复 rollup3 打包 cjs 模块问题
|
|
174
|
+
- Updated dependencies
|
|
175
|
+
- @hi-ui/env@4.0.3
|
|
176
|
+
- @hi-ui/core@4.0.7
|
|
177
|
+
- @hi-ui/use-cache@4.0.3
|
|
178
|
+
- @hi-ui/use-check@4.0.4
|
|
179
|
+
- @hi-ui/use-check-state@4.0.3
|
|
180
|
+
- @hi-ui/use-drag-sorter@4.0.3
|
|
181
|
+
- @hi-ui/use-latest@4.0.3
|
|
182
|
+
- @hi-ui/use-toggle@4.0.3
|
|
183
|
+
- @hi-ui/use-uncontrolled-state@4.0.3
|
|
184
|
+
- @hi-ui/use-update-effect@4.0.3
|
|
185
|
+
- @hi-ui/icons@4.0.17
|
|
186
|
+
- @hi-ui/button@4.0.8
|
|
187
|
+
- @hi-ui/checkbox@4.0.7
|
|
188
|
+
- @hi-ui/drawer@4.1.2
|
|
189
|
+
- @hi-ui/empty-state@4.0.6
|
|
190
|
+
- @hi-ui/icon-button@4.0.7
|
|
191
|
+
- @hi-ui/loading@4.1.2
|
|
192
|
+
- @hi-ui/pagination@4.0.13
|
|
193
|
+
- @hi-ui/popper@4.1.2
|
|
194
|
+
- @hi-ui/select@4.2.4
|
|
195
|
+
- @hi-ui/spinner@4.0.7
|
|
196
|
+
- @hi-ui/array-utils@4.0.3
|
|
197
|
+
- @hi-ui/classname@4.0.3
|
|
198
|
+
- @hi-ui/dom-utils@4.0.6
|
|
199
|
+
- @hi-ui/func-utils@4.0.3
|
|
200
|
+
- @hi-ui/object-utils@4.0.3
|
|
201
|
+
- @hi-ui/react-utils@4.0.3
|
|
202
|
+
- @hi-ui/times@4.0.3
|
|
203
|
+
- @hi-ui/tree-utils@4.1.3
|
|
204
|
+
- @hi-ui/type-assertion@4.0.3
|
|
205
|
+
|
|
206
|
+
## 4.3.2
|
|
207
|
+
|
|
208
|
+
### Patch Changes
|
|
209
|
+
|
|
210
|
+
- [#2672](https://github.com/XiaoMi/hiui/pull/2672) [`1ebe27830`](https://github.com/XiaoMi/hiui/commit/1ebe2783098b3a8cd980bd10076d67635463800e) Thanks [@zyprepare](https://github.com/zyprepare)! - build: 升级到 rollup3,重新构建发布组件
|
|
211
|
+
|
|
212
|
+
- [#2671](https://github.com/XiaoMi/hiui/pull/2671) [`6d7909444`](https://github.com/XiaoMi/hiui/commit/6d790944418f36689b34805f858a1268530864b9) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复组件参数类型错误
|
|
213
|
+
|
|
214
|
+
- Updated dependencies [[`1ebe27830`](https://github.com/XiaoMi/hiui/commit/1ebe2783098b3a8cd980bd10076d67635463800e)]:
|
|
215
|
+
- @hi-ui/core@4.0.6
|
|
216
|
+
- @hi-ui/use-cache@4.0.2
|
|
217
|
+
- @hi-ui/use-check@4.0.3
|
|
218
|
+
- @hi-ui/use-check-state@4.0.2
|
|
219
|
+
- @hi-ui/use-drag-sorter@4.0.2
|
|
220
|
+
- @hi-ui/use-latest@4.0.2
|
|
221
|
+
- @hi-ui/use-toggle@4.0.2
|
|
222
|
+
- @hi-ui/use-uncontrolled-state@4.0.2
|
|
223
|
+
- @hi-ui/use-update-effect@4.0.2
|
|
224
|
+
- @hi-ui/icons@4.0.16
|
|
225
|
+
- @hi-ui/button@4.0.7
|
|
226
|
+
- @hi-ui/checkbox@4.0.6
|
|
227
|
+
- @hi-ui/drawer@4.1.1
|
|
228
|
+
- @hi-ui/empty-state@4.0.5
|
|
229
|
+
- @hi-ui/icon-button@4.0.6
|
|
230
|
+
- @hi-ui/loading@4.1.1
|
|
231
|
+
- @hi-ui/pagination@4.0.12
|
|
232
|
+
- @hi-ui/popper@4.1.1
|
|
233
|
+
- @hi-ui/select@4.2.3
|
|
234
|
+
- @hi-ui/spinner@4.0.6
|
|
235
|
+
- @hi-ui/array-utils@4.0.2
|
|
236
|
+
- @hi-ui/classname@4.0.2
|
|
237
|
+
- @hi-ui/dom-utils@4.0.5
|
|
238
|
+
- @hi-ui/env@4.0.2
|
|
239
|
+
- @hi-ui/func-utils@4.0.2
|
|
240
|
+
- @hi-ui/object-utils@4.0.2
|
|
241
|
+
- @hi-ui/react-utils@4.0.2
|
|
242
|
+
- @hi-ui/times@4.0.2
|
|
243
|
+
- @hi-ui/tree-utils@4.1.2
|
|
244
|
+
- @hi-ui/type-assertion@4.0.2
|
|
245
|
+
|
|
246
|
+
## 4.3.1
|
|
247
|
+
|
|
248
|
+
### Patch Changes
|
|
249
|
+
|
|
250
|
+
- [#2654](https://github.com/XiaoMi/hiui/pull/2654) [`dc002a32a`](https://github.com/XiaoMi/hiui/commit/dc002a32a2c6f538b0df37c63d34f603647d9b70) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: 增加 scrollbar 参数,用于在 Windows 环境下优化滚动条样式
|
|
251
|
+
|
|
252
|
+
- Updated dependencies [[`b477d91db`](https://github.com/XiaoMi/hiui/commit/b477d91db15bbc92c8712a9a771af5b332779315)]:
|
|
253
|
+
- @hi-ui/button@4.0.6
|
|
254
|
+
- @hi-ui/icon-button@4.0.5
|
|
255
|
+
- @hi-ui/pagination@4.0.11
|
|
256
|
+
|
|
257
|
+
## 4.3.0
|
|
258
|
+
|
|
259
|
+
### Minor Changes
|
|
260
|
+
|
|
261
|
+
- [#2642](https://github.com/XiaoMi/hiui/pull/2642) [`74d8c5148`](https://github.com/XiaoMi/hiui/commit/74d8c51489ae7a88c90b1426e9da118125579b97) Thanks [@zyprepare](https://github.com/zyprepare)! - perf: 将之前的双表格结构优化成单表格,冻结列和表头吸顶等场景依然采用双表格结构
|
|
262
|
+
|
|
263
|
+
- [#2647](https://github.com/XiaoMi/hiui/pull/2647) [`8767c9470`](https://github.com/XiaoMi/hiui/commit/8767c94702fdc697207001f639508907e20fc6a5) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: add footerRender api
|
|
264
|
+
|
|
265
|
+
### Patch Changes
|
|
266
|
+
|
|
267
|
+
- [#2648](https://github.com/XiaoMi/hiui/pull/2648) [`54387a81e`](https://github.com/XiaoMi/hiui/commit/54387a81e1c6add77e791af8d849a6518077afd5) Thanks [@zyprepare](https://github.com/zyprepare)! - perf: 优化 resizable 模式下可调整的最小宽度
|
|
268
|
+
|
|
269
|
+
- Updated dependencies [[`4f7c8c906`](https://github.com/XiaoMi/hiui/commit/4f7c8c9063d9b72068a2db5fa614eed130aafd0f)]:
|
|
270
|
+
- @hi-ui/select@4.2.2
|
|
271
|
+
|
|
272
|
+
## 4.2.0
|
|
273
|
+
|
|
274
|
+
### Minor Changes
|
|
275
|
+
|
|
276
|
+
- [#2597](https://github.com/XiaoMi/hiui/pull/2597) [`0ddf24960`](https://github.com/XiaoMi/hiui/commit/0ddf24960194fdd15653e34e0a6cef54b1586748) Thanks [@zyprepare](https://github.com/zyprepare)! - chore: axios 升级为 1.5.0
|
|
277
|
+
|
|
278
|
+
### Patch Changes
|
|
279
|
+
|
|
280
|
+
- [#2608](https://github.com/XiaoMi/hiui/pull/2608) [`fb9b1281d`](https://github.com/XiaoMi/hiui/commit/fb9b1281d99ba0d21b5cb32c87b5e671272c1c8e) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复紧凑模式下多选项间距问题
|
|
281
|
+
|
|
282
|
+
- Updated dependencies [[`b3b36813a`](https://github.com/XiaoMi/hiui/commit/b3b36813a6968c5c96c39d1100935372e3aa5b4d)]:
|
|
283
|
+
- @hi-ui/select@4.2.0
|
|
284
|
+
|
|
285
|
+
## 4.1.2
|
|
286
|
+
|
|
287
|
+
### Patch Changes
|
|
288
|
+
|
|
289
|
+
- [#2572](https://github.com/XiaoMi/hiui/pull/2572) [`eee5e6d16`](https://github.com/XiaoMi/hiui/commit/eee5e6d1658685a6119b5aa40038c572145b3b4e) Thanks [@zyprepare](https://github.com/zyprepare)! - perf: 表格性能优化
|
|
290
|
+
|
|
291
|
+
- Updated dependencies [[`937052db3`](https://github.com/XiaoMi/hiui/commit/937052db36ecfa50fef53df13d159bee0d08fa41), [`ccb1eec12`](https://github.com/XiaoMi/hiui/commit/ccb1eec122a33466536b365d443f175d1e16dc86), [`eee5e6d16`](https://github.com/XiaoMi/hiui/commit/eee5e6d1658685a6119b5aa40038c572145b3b4e)]:
|
|
292
|
+
- @hi-ui/icons@4.0.14
|
|
293
|
+
- @hi-ui/popper@4.1.0
|
|
294
|
+
- @hi-ui/tree-utils@4.1.1
|
|
295
|
+
|
|
296
|
+
## 4.1.1
|
|
297
|
+
|
|
298
|
+
### Patch Changes
|
|
299
|
+
|
|
300
|
+
- [#2557](https://github.com/XiaoMi/hiui/pull/2557) [`ef7aae038`](https://github.com/XiaoMi/hiui/commit/ef7aae038362d3a7700611737c474c29d1ba07b4) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: maxHeight 支持表达式
|
|
301
|
+
|
|
302
|
+
- [#2558](https://github.com/XiaoMi/hiui/pull/2558) [`bdd913d71`](https://github.com/XiaoMi/hiui/commit/bdd913d7173de64952437014ab9ffd1947ed506c) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: 增加树形结构排序
|
|
303
|
+
|
|
304
|
+
- Updated dependencies [[`bdd913d71`](https://github.com/XiaoMi/hiui/commit/bdd913d7173de64952437014ab9ffd1947ed506c)]:
|
|
305
|
+
- @hi-ui/tree-utils@4.1.0
|
|
306
|
+
|
|
307
|
+
## 4.1.0
|
|
308
|
+
|
|
309
|
+
### Minor Changes
|
|
310
|
+
|
|
311
|
+
- [#2474](https://github.com/XiaoMi/hiui/pull/2474) [`e95268aa4`](https://github.com/XiaoMi/hiui/commit/e95268aa4af48edaaa9f6afcf5a262342a550cd1) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: rowSelection onChange 回调增加已选数据集合参数
|
|
312
|
+
|
|
313
|
+
- [#2474](https://github.com/XiaoMi/hiui/pull/2474) [`e95268aa4`](https://github.com/XiaoMi/hiui/commit/e95268aa4af48edaaa9f6afcf5a262342a550cd1) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: 增加虚拟滚动功能
|
|
314
|
+
|
|
315
|
+
- [#2474](https://github.com/XiaoMi/hiui/pull/2474) [`e95268aa4`](https://github.com/XiaoMi/hiui/commit/e95268aa4af48edaaa9f6afcf5a262342a550cd1) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: 增加 dataSource 功能
|
|
316
|
+
|
|
317
|
+
- [#2474](https://github.com/XiaoMi/hiui/pull/2474) [`e95268aa4`](https://github.com/XiaoMi/hiui/commit/e95268aa4af48edaaa9f6afcf5a262342a550cd1) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: 列设置增加 checkDisabledColKeys api,用于禁用列选择操作
|
|
318
|
+
|
|
319
|
+
- [#2474](https://github.com/XiaoMi/hiui/pull/2474) [`e95268aa4`](https://github.com/XiaoMi/hiui/commit/e95268aa4af48edaaa9f6afcf5a262342a550cd1) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: add SettingDrawer component
|
|
320
|
+
|
|
321
|
+
### Patch Changes
|
|
322
|
+
|
|
323
|
+
- [#2474](https://github.com/XiaoMi/hiui/pull/2474) [`e95268aa4`](https://github.com/XiaoMi/hiui/commit/e95268aa4af48edaaa9f6afcf5a262342a550cd1) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 数据排序样式不对
|
|
324
|
+
|
|
325
|
+
- [#2473](https://github.com/XiaoMi/hiui/pull/2473) [`3d5f9ba15`](https://github.com/XiaoMi/hiui/commit/3d5f9ba15868ccdc385cdcdc8a3bbe2e55542b39) Thanks [@zyprepare](https://github.com/zyprepare)! - fix: 修复 sonarcloud 扫描的 Bugs
|
|
326
|
+
|
|
327
|
+
- Updated dependencies [[`e95268aa4`](https://github.com/XiaoMi/hiui/commit/e95268aa4af48edaaa9f6afcf5a262342a550cd1)]:
|
|
328
|
+
- @hi-ui/loading@4.1.0
|
|
329
|
+
|
|
330
|
+
## 4.0.13
|
|
331
|
+
|
|
332
|
+
### Patch Changes
|
|
333
|
+
|
|
334
|
+
- [#2315](https://github.com/XiaoMi/hiui/pull/2315) [`551ab0b73`](https://github.com/XiaoMi/hiui/commit/551ab0b734e00d1e0ca170c9a87f316aa4197762) Thanks [@zyprepare](https://github.com/zyprepare)! - 修复设置 size 后,空状态会出现滚动条问题
|
package/lib/cjs/Table.js
CHANGED
|
@@ -25,6 +25,7 @@ var reactUtils = require('@hi-ui/react-utils');
|
|
|
25
25
|
var TableSettingMenu = require('./TableSettingMenu.js');
|
|
26
26
|
var Loading = require('@hi-ui/loading');
|
|
27
27
|
var Checkbox = require('@hi-ui/checkbox');
|
|
28
|
+
var index$1 = require('./packages/ui/radio/lib/esm/index.js');
|
|
28
29
|
var useCheck = require('./hooks/use-check.js');
|
|
29
30
|
var typeAssertion = require('@hi-ui/type-assertion');
|
|
30
31
|
var treeUtils = require('@hi-ui/tree-utils');
|
|
@@ -194,16 +195,19 @@ var Table = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
194
195
|
tryCheckAllRow = _useTableCheck.tryCheckAllRow,
|
|
195
196
|
isCheckedRowKey = _useTableCheck.isCheckedRowKey,
|
|
196
197
|
onCheckedRowKeysChange = _useTableCheck.onCheckedRowKeysChange,
|
|
198
|
+
onRadioCheckedRowKeysChange = _useTableCheck.onRadioCheckedRowKeysChange,
|
|
197
199
|
checkRowIsDisabledCheckbox = _useTableCheck.checkRowIsDisabledCheckbox;
|
|
198
200
|
// 表格列多选操作区
|
|
199
201
|
var getSelectionColumn = React__default["default"].useCallback(function (rowSelection) {
|
|
202
|
+
var _rowSelection$type = rowSelection.type,
|
|
203
|
+
type = _rowSelection$type === void 0 ? 'checkbox' : _rowSelection$type;
|
|
200
204
|
var renderCell = function renderCell(_, rowItem, rowIndex) {
|
|
201
205
|
var rowKey = getRowKeyField(rowItem);
|
|
202
206
|
var checked = isCheckedRowKey(rowKey);
|
|
203
207
|
var disabledCheckbox = checkRowIsDisabledCheckbox(rowItem);
|
|
204
208
|
return {
|
|
205
|
-
node: ( /*#__PURE__*/React__default["default"].createElement(Checkbox__default["default"], {
|
|
206
|
-
checked:
|
|
209
|
+
node: type === 'checkbox' ? ( /*#__PURE__*/React__default["default"].createElement(Checkbox__default["default"], {
|
|
210
|
+
checked: checked,
|
|
207
211
|
disabled: disabledCheckbox,
|
|
208
212
|
onChange: function onChange(evt) {
|
|
209
213
|
onCheckedRowKeysChange(rowItem, evt.target.checked);
|
|
@@ -211,6 +215,15 @@ var Table = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
211
215
|
onClick: function onClick(evt) {
|
|
212
216
|
evt.stopPropagation();
|
|
213
217
|
}
|
|
218
|
+
})) : ( /*#__PURE__*/React__default["default"].createElement(index$1["default"], {
|
|
219
|
+
checked: checked,
|
|
220
|
+
disabled: disabledCheckbox,
|
|
221
|
+
onChange: function onChange(evt) {
|
|
222
|
+
onRadioCheckedRowKeysChange(rowItem, evt.target.checked);
|
|
223
|
+
},
|
|
224
|
+
onClick: function onClick(evt) {
|
|
225
|
+
evt.stopPropagation();
|
|
226
|
+
}
|
|
214
227
|
})),
|
|
215
228
|
checked: checked
|
|
216
229
|
};
|
|
@@ -261,12 +274,12 @@ var Table = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
261
274
|
// selectionColumn 宽度固定,防止自动被拉伸
|
|
262
275
|
fixed: true,
|
|
263
276
|
className: prefixCls + "__selection-col",
|
|
264
|
-
title: renderSelectionTitleCell,
|
|
277
|
+
title: type === 'checkbox' ? renderSelectionTitleCell : undefined,
|
|
265
278
|
// @ts-ignore
|
|
266
279
|
render: renderSelectionCell
|
|
267
280
|
};
|
|
268
281
|
return selectionColumn;
|
|
269
|
-
}, [
|
|
282
|
+
}, [checkboxColWidth, prefixCls, getRowKeyField, isCheckedRowKey, checkRowIsDisabledCheckbox, onCheckedRowKeysChange, onRadioCheckedRowKeysChange, checkedAll, semiChecked, tryCheckAllRow]);
|
|
270
283
|
var mergedColumns = React__default["default"].useMemo(function () {
|
|
271
284
|
if (rowSelection) {
|
|
272
285
|
var selectionColumn = getSelectionColumn(rowSelection);
|
|
@@ -71,6 +71,13 @@ var useTableCheck = function useTableCheck(_ref) {
|
|
|
71
71
|
}
|
|
72
72
|
handleCheckedRowKeysChange(rowItem, checked);
|
|
73
73
|
}, [checkedRowDataItems, checkedRowKeys, fieldKey, handleCheckedRowKeysChange]);
|
|
74
|
+
var onRadioCheckedRowKeysChange = React__default["default"].useCallback(function (rowItem, checked) {
|
|
75
|
+
var _a;
|
|
76
|
+
checkedRowDataItemsRef.current = [rowItem];
|
|
77
|
+
trySetCheckedRowKeys((_a = checkedRowDataItemsRef.current) === null || _a === void 0 ? void 0 : _a.map(function (item) {
|
|
78
|
+
return item[fieldKey];
|
|
79
|
+
}), rowItem, checked, checkedRowDataItemsRef.current);
|
|
80
|
+
}, [fieldKey, trySetCheckedRowKeys]);
|
|
74
81
|
// 判断是否全选
|
|
75
82
|
var _React$useMemo = React__default["default"].useMemo(function () {
|
|
76
83
|
if (rowSelection) {
|
|
@@ -130,12 +137,13 @@ var useTableCheck = function useTableCheck(_ref) {
|
|
|
130
137
|
});
|
|
131
138
|
return Array.from(checkedRowKeysSet);
|
|
132
139
|
}, targetRowItems, true, checkedRowDataItemsRef.current);
|
|
133
|
-
}, [
|
|
140
|
+
}, [flattedData, checkedAll, trySetCheckedRowKeys, checkRowIsDisabledCheckbox, fieldKey]);
|
|
134
141
|
return {
|
|
135
142
|
tryCheckAllRow: tryCheckAllRow,
|
|
136
143
|
checkedAll: checkedAll,
|
|
137
144
|
semiChecked: semiChecked,
|
|
138
145
|
onCheckedRowKeysChange: onCheckedRowKeysChange,
|
|
146
|
+
onRadioCheckedRowKeysChange: onRadioCheckedRowKeysChange,
|
|
139
147
|
isCheckedRowKey: isCheckedRowKey,
|
|
140
148
|
checkedRowKeys: checkedRowKeys,
|
|
141
149
|
trySetCheckedRowKeys: trySetCheckedRowKeys,
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/** @LICENSE
|
|
2
|
+
* @hi-ui/table
|
|
3
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/table#readme
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
13
|
+
Object.defineProperty(exports, '__esModule', {
|
|
14
|
+
value: true
|
|
15
|
+
});
|
|
16
|
+
var tslib = require('tslib');
|
|
17
|
+
var React = require('react');
|
|
18
|
+
var classname = require('@hi-ui/classname');
|
|
19
|
+
var env = require('@hi-ui/env');
|
|
20
|
+
var useRadio = require('./use-radio.js');
|
|
21
|
+
var context = require('./context.js');
|
|
22
|
+
var typeAssertion = require('@hi-ui/type-assertion');
|
|
23
|
+
var funcUtils = require('@hi-ui/func-utils');
|
|
24
|
+
function _interopDefaultCompat(e) {
|
|
25
|
+
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
26
|
+
'default': e
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
30
|
+
|
|
31
|
+
/** @LICENSE
|
|
32
|
+
* @hi-ui/radio
|
|
33
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/radio#readme
|
|
34
|
+
*
|
|
35
|
+
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
36
|
+
*
|
|
37
|
+
* This source code is licensed under the MIT license found in the
|
|
38
|
+
* LICENSE file in the root directory of this source tree.
|
|
39
|
+
*/
|
|
40
|
+
var RADIO_PREFIX = classname.getPrefixCls('radio');
|
|
41
|
+
/**
|
|
42
|
+
* 单选
|
|
43
|
+
*/
|
|
44
|
+
var Radio = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
45
|
+
var _a$prefixCls = _a.prefixCls,
|
|
46
|
+
prefixCls = _a$prefixCls === void 0 ? RADIO_PREFIX : _a$prefixCls,
|
|
47
|
+
_a$role = _a.role,
|
|
48
|
+
role = _a$role === void 0 ? 'radio' : _a$role,
|
|
49
|
+
className = _a.className,
|
|
50
|
+
children = _a.children,
|
|
51
|
+
rest = tslib.__rest(_a, ["prefixCls", "role", "className", "children"]);
|
|
52
|
+
var groupContext = context.useRadioGroupContext();
|
|
53
|
+
var _ref = groupContext || {},
|
|
54
|
+
disabledContext = _ref.disabled,
|
|
55
|
+
isCheckedContext = _ref.isChecked,
|
|
56
|
+
nameContext = _ref.name,
|
|
57
|
+
onChangeContext = _ref.onChange,
|
|
58
|
+
_ref$type = _ref.type,
|
|
59
|
+
type = _ref$type === void 0 ? 'default' : _ref$type;
|
|
60
|
+
var checkedProp = rest.checked,
|
|
61
|
+
valueProp = rest.value,
|
|
62
|
+
_rest$disabled = rest.disabled,
|
|
63
|
+
disabled = _rest$disabled === void 0 ? disabledContext : _rest$disabled,
|
|
64
|
+
_rest$name = rest.name,
|
|
65
|
+
name = _rest$name === void 0 ? nameContext : _rest$name,
|
|
66
|
+
onChangeProp = rest.onChange;
|
|
67
|
+
// Group's priority is higher than its own.
|
|
68
|
+
var checked = isCheckedContext && !typeAssertion.isNullish(valueProp) ? isCheckedContext(valueProp) : checkedProp;
|
|
69
|
+
var onChange = onChangeContext && !typeAssertion.isNullish(valueProp) ? funcUtils.callAllFuncs(function (evt) {
|
|
70
|
+
if (evt.target.checked) {
|
|
71
|
+
onChangeContext(valueProp);
|
|
72
|
+
}
|
|
73
|
+
}, onChangeProp) : onChangeProp;
|
|
74
|
+
var _useRadio = useRadio.useRadio(Object.assign(Object.assign({}, rest), {
|
|
75
|
+
disabled: disabled,
|
|
76
|
+
name: name,
|
|
77
|
+
checked: checked,
|
|
78
|
+
onChange: onChange
|
|
79
|
+
})),
|
|
80
|
+
rootProps = _useRadio.rootProps,
|
|
81
|
+
getInputProps = _useRadio.getInputProps;
|
|
82
|
+
var inputProps = getInputProps();
|
|
83
|
+
var cls = classname.cx(prefixCls, className, prefixCls + "--type-" + type);
|
|
84
|
+
return /*#__PURE__*/React__default["default"].createElement("label", Object.assign({
|
|
85
|
+
ref: ref,
|
|
86
|
+
role: role,
|
|
87
|
+
className: cls
|
|
88
|
+
}, rootProps), /*#__PURE__*/React__default["default"].createElement("input", Object.assign({}, inputProps, {
|
|
89
|
+
tabIndex: 0,
|
|
90
|
+
className: prefixCls + "__input"
|
|
91
|
+
})), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
92
|
+
className: prefixCls + "__controller"
|
|
93
|
+
}), children ? /*#__PURE__*/React__default["default"].createElement("span", {
|
|
94
|
+
className: prefixCls + "__label"
|
|
95
|
+
}, children) : null);
|
|
96
|
+
});
|
|
97
|
+
if (env.__DEV__) {
|
|
98
|
+
Radio.displayName = 'Radio';
|
|
99
|
+
}
|
|
100
|
+
exports.Radio = Radio;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/** @LICENSE
|
|
2
|
+
* @hi-ui/table
|
|
3
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/table#readme
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
13
|
+
Object.defineProperty(exports, '__esModule', {
|
|
14
|
+
value: true
|
|
15
|
+
});
|
|
16
|
+
var tslib = require('tslib');
|
|
17
|
+
var React = require('react');
|
|
18
|
+
var classname = require('@hi-ui/classname');
|
|
19
|
+
var env = require('@hi-ui/env');
|
|
20
|
+
var useRadioGroup = require('./use-radio-group.js');
|
|
21
|
+
var context = require('./context.js');
|
|
22
|
+
var types = require('./types.js');
|
|
23
|
+
var typeAssertion = require('@hi-ui/type-assertion');
|
|
24
|
+
var Radio = require('./Radio.js');
|
|
25
|
+
function _interopDefaultCompat(e) {
|
|
26
|
+
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
27
|
+
'default': e
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
31
|
+
|
|
32
|
+
/** @LICENSE
|
|
33
|
+
* @hi-ui/radio
|
|
34
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/radio#readme
|
|
35
|
+
*
|
|
36
|
+
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
37
|
+
*
|
|
38
|
+
* This source code is licensed under the MIT license found in the
|
|
39
|
+
* LICENSE file in the root directory of this source tree.
|
|
40
|
+
*/
|
|
41
|
+
var RADIO_GROUP_PREFIX = classname.getPrefixCls('radio-group');
|
|
42
|
+
/**
|
|
43
|
+
* 单选组合器
|
|
44
|
+
*/
|
|
45
|
+
var RadioGroup = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
46
|
+
var _a$prefixCls = _a.prefixCls,
|
|
47
|
+
prefixCls = _a$prefixCls === void 0 ? RADIO_GROUP_PREFIX : _a$prefixCls,
|
|
48
|
+
className = _a.className,
|
|
49
|
+
children = _a.children,
|
|
50
|
+
data = _a.data,
|
|
51
|
+
_a$type = _a.type,
|
|
52
|
+
type = _a$type === void 0 ? types.RadioGroupTypeEnum.DEFAULT : _a$type,
|
|
53
|
+
_a$placement = _a.placement,
|
|
54
|
+
placement = _a$placement === void 0 ? types.RadioGroupPlacementEnum.HORIZONTAL : _a$placement,
|
|
55
|
+
_a$autoWidth = _a.autoWidth,
|
|
56
|
+
autoWidth = _a$autoWidth === void 0 ? false : _a$autoWidth,
|
|
57
|
+
rest = tslib.__rest(_a, ["prefixCls", "className", "children", "data", "type", "placement", "autoWidth"]);
|
|
58
|
+
var _useRadioGroup = useRadioGroup.useRadioGroup(rest),
|
|
59
|
+
rootProps = _useRadioGroup.rootProps,
|
|
60
|
+
name = _useRadioGroup.name,
|
|
61
|
+
value = _useRadioGroup.value,
|
|
62
|
+
onChange = _useRadioGroup.onChange,
|
|
63
|
+
isChecked = _useRadioGroup.isChecked,
|
|
64
|
+
disabled = _useRadioGroup.disabled;
|
|
65
|
+
var providedValue = React.useMemo(function () {
|
|
66
|
+
return {
|
|
67
|
+
name: name,
|
|
68
|
+
onChange: onChange,
|
|
69
|
+
value: value,
|
|
70
|
+
isChecked: isChecked,
|
|
71
|
+
disabled: disabled,
|
|
72
|
+
type: type,
|
|
73
|
+
placement: placement
|
|
74
|
+
};
|
|
75
|
+
}, [name, onChange, value, isChecked, disabled, type, placement]);
|
|
76
|
+
var hasData = typeAssertion.isArrayNonEmpty(data);
|
|
77
|
+
// data 优先级大于内嵌式组合
|
|
78
|
+
if (hasData) {
|
|
79
|
+
children = data.map(function (_ref) {
|
|
80
|
+
var id = _ref.id,
|
|
81
|
+
disabled = _ref.disabled,
|
|
82
|
+
title = _ref.title;
|
|
83
|
+
return /*#__PURE__*/React__default["default"].createElement(Radio.Radio, {
|
|
84
|
+
key: id,
|
|
85
|
+
value: id,
|
|
86
|
+
name: name,
|
|
87
|
+
disabled: disabled,
|
|
88
|
+
checked: isChecked(id),
|
|
89
|
+
className: prefixCls + "__item"
|
|
90
|
+
}, title);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
var cls = classname.cx(prefixCls, className, prefixCls + "--placement-" + placement, autoWidth && type === types.RadioGroupTypeEnum.BUTTON && prefixCls + "--auto-width", prefixCls + "--type-" + type, hasData && prefixCls + "--data-wrap");
|
|
94
|
+
return /*#__PURE__*/React__default["default"].createElement(context.RadioGroupProvider, {
|
|
95
|
+
value: providedValue
|
|
96
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", Object.assign({
|
|
97
|
+
ref: ref,
|
|
98
|
+
className: cls
|
|
99
|
+
}, rootProps), children));
|
|
100
|
+
});
|
|
101
|
+
if (env.__DEV__) {
|
|
102
|
+
RadioGroup.displayName = 'RadioGroup';
|
|
103
|
+
}
|
|
104
|
+
exports.RadioGroup = RadioGroup;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** @LICENSE
|
|
2
|
+
* @hi-ui/table
|
|
3
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/table#readme
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
Object.defineProperty(exports, '__esModule', {
|
|
13
|
+
value: true
|
|
14
|
+
});
|
|
15
|
+
var React = require('react');
|
|
16
|
+
|
|
17
|
+
/** @LICENSE
|
|
18
|
+
* @hi-ui/radio
|
|
19
|
+
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/radio#readme
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) HiUI <mi-hiui@xiaomi.com>.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/
|
|
26
|
+
var RadioGroupContext = /*#__PURE__*/React.createContext(null);
|
|
27
|
+
var RadioGroupProvider = RadioGroupContext.Provider;
|
|
28
|
+
var useRadioGroupContext = function useRadioGroupContext() {
|
|
29
|
+
var context = React.useContext(RadioGroupContext);
|
|
30
|
+
// 允许 Radio 单独存在,不做检查
|
|
31
|
+
// if (!context) {
|
|
32
|
+
// throw new Error('The RadioGroupContext context should using in Radio.')
|
|
33
|
+
// }
|
|
34
|
+
return context;
|
|
35
|
+
};
|
|
36
|
+
exports.RadioGroupProvider = RadioGroupProvider;
|
|
37
|
+
exports.useRadioGroupContext = useRadioGroupContext;
|