@hsu-react/ui 0.0.1 → 0.0.3

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.
Files changed (175) hide show
  1. package/README.md +2 -0
  2. package/es/components/ChainGraph/_components/SearchSelect/index.js +13 -10
  3. package/es/components/ChainGraph/_components/SearchSelect/index.module.less +8 -2
  4. package/es/components/ChainGraph/index.module.less +1 -1
  5. package/es/components/Chat/ChatInput/_components/SendButton/index.module.less +1 -1
  6. package/es/components/Chat/ChatInput/_components/UploadButton/index.module.less +1 -1
  7. package/es/components/Chat/ChatInput/index.module.less +2 -2
  8. package/es/components/Chat/ChatList/_components/Assistant/AssistantItem/index.module.less +1 -1
  9. package/es/components/Checkbox/CheckboxGroup/index.module.less +16 -16
  10. package/es/components/Checkbox/index.module.less +13 -13
  11. package/es/components/CodeMirror/index.module.less +4 -4
  12. package/es/components/DatePicker/RangePicker/index.module.less +1 -1
  13. package/es/components/DatePicker/StepPicker/index.module.less +1 -1
  14. package/es/components/DatePicker/index.module.less +2 -1
  15. package/es/components/Form/DrawerForm/index.module.less +2 -2
  16. package/es/components/FormItem/FormInput/FormPasswordStrength/index.js +2 -2
  17. package/es/components/FormItem/FormInput/FormPasswordStrength/index.module.less +12 -0
  18. package/es/components/FormItem/FormRadio/index.module.less +9 -9
  19. package/es/components/FormItem/FormSegmented/index.module.less +2 -2
  20. package/es/components/FormItem/FormUpload/index.module.less +4 -4
  21. package/es/components/FormItem/ItemContainer/index.module.less +22 -22
  22. package/es/components/Icon/index.js +9 -24
  23. package/es/components/Input/Number/index.module.less +9 -9
  24. package/es/components/Input/Password/index.module.less +3 -3
  25. package/es/components/Input/Range/index.module.less +4 -4
  26. package/es/components/Input/Search/index.module.less +5 -5
  27. package/es/components/Input/TextArea/index.module.less +5 -5
  28. package/es/components/Input/index.module.less +7 -4
  29. package/es/components/Modal/index.module.less +2 -2
  30. package/es/components/Operate/index.module.less +2 -2
  31. package/es/components/Panel/IframePanel/index.module.less +1 -1
  32. package/es/components/Panel/ListPanel/_components/ColumnMgt/index.module.less +1 -1
  33. package/es/components/Search/index.module.less +2 -2
  34. package/es/components/Select/AutoCompleteSelect/index.module.less +35 -35
  35. package/es/components/Select/IconSelect/index.module.less +3 -3
  36. package/es/components/Select/TreeSelect/index.module.less +17 -17
  37. package/es/components/Select/_utils/getElementPosition.d.ts +6 -2
  38. package/es/components/Select/_utils/getElementPosition.js +8 -6
  39. package/es/components/Select/index.module.less +37 -34
  40. package/es/components/Slider/index.module.less +5 -4
  41. package/es/components/Spreadsheet/index.module.less +4 -4
  42. package/es/components/Switch/index.js +12 -8
  43. package/es/components/Switch/index.module.less +7 -0
  44. package/es/components/Table/_components/Pagination/index.module.less +23 -23
  45. package/es/components/Table/index.module.less +61 -61
  46. package/es/components/Tree/index.module.less +11 -11
  47. package/es/components/Upload/index.module.less +3 -3
  48. package/es/styles/antd-overload.less +1 -1
  49. package/lib/components/ChainGraph/_components/SearchSelect/index.js +10 -7
  50. package/lib/components/ChainGraph/_components/SearchSelect/index.module.less +8 -2
  51. package/lib/components/ChainGraph/index.module.less +1 -1
  52. package/lib/components/Chat/ChatInput/_components/SendButton/index.module.less +1 -1
  53. package/lib/components/Chat/ChatInput/_components/UploadButton/index.module.less +1 -1
  54. package/lib/components/Chat/ChatInput/index.module.less +2 -2
  55. package/lib/components/Chat/ChatList/_components/Assistant/AssistantItem/index.module.less +1 -1
  56. package/lib/components/Checkbox/CheckboxGroup/index.module.less +16 -16
  57. package/lib/components/Checkbox/index.module.less +13 -13
  58. package/lib/components/CodeMirror/index.module.less +4 -4
  59. package/lib/components/DatePicker/RangePicker/index.module.less +1 -1
  60. package/lib/components/DatePicker/StepPicker/index.module.less +1 -1
  61. package/lib/components/DatePicker/index.module.less +2 -1
  62. package/lib/components/Form/DrawerForm/index.module.less +2 -2
  63. package/lib/components/FormItem/FormInput/FormPasswordStrength/index.js +2 -1
  64. package/lib/components/FormItem/FormInput/FormPasswordStrength/index.module.less +12 -0
  65. package/lib/components/FormItem/FormRadio/index.module.less +9 -9
  66. package/lib/components/FormItem/FormSegmented/index.module.less +2 -2
  67. package/lib/components/FormItem/FormUpload/index.module.less +4 -4
  68. package/lib/components/FormItem/ItemContainer/index.module.less +22 -22
  69. package/lib/components/Icon/index.js +9 -27
  70. package/lib/components/Input/Number/index.module.less +9 -9
  71. package/lib/components/Input/Password/index.module.less +3 -3
  72. package/lib/components/Input/Range/index.module.less +4 -4
  73. package/lib/components/Input/Search/index.module.less +5 -5
  74. package/lib/components/Input/TextArea/index.module.less +5 -5
  75. package/lib/components/Input/index.module.less +7 -4
  76. package/lib/components/Modal/index.module.less +2 -2
  77. package/lib/components/Operate/index.module.less +2 -2
  78. package/lib/components/Panel/IframePanel/index.module.less +1 -1
  79. package/lib/components/Panel/ListPanel/_components/ColumnMgt/index.module.less +1 -1
  80. package/lib/components/Search/index.module.less +2 -2
  81. package/lib/components/Select/AutoCompleteSelect/index.module.less +35 -35
  82. package/lib/components/Select/IconSelect/index.module.less +3 -3
  83. package/lib/components/Select/TreeSelect/index.module.less +17 -17
  84. package/lib/components/Select/_utils/getElementPosition.d.ts +6 -2
  85. package/lib/components/Select/_utils/getElementPosition.js +8 -6
  86. package/lib/components/Select/index.module.less +37 -34
  87. package/lib/components/Slider/index.module.less +5 -4
  88. package/lib/components/Spreadsheet/index.module.less +4 -4
  89. package/lib/components/Switch/index.js +8 -4
  90. package/lib/components/Switch/index.module.less +7 -0
  91. package/lib/components/Table/_components/Pagination/index.module.less +23 -23
  92. package/lib/components/Table/index.module.less +61 -61
  93. package/lib/components/Tree/index.module.less +11 -11
  94. package/lib/components/Upload/index.module.less +3 -3
  95. package/lib/styles/antd-overload.less +1 -1
  96. package/package.json +1 -1
  97. package/src/components/Button/index.md +20 -4
  98. package/src/components/ChainGraph/_components/SearchSelect/index.module.less +8 -2
  99. package/src/components/ChainGraph/_components/SearchSelect/index.tsx +18 -16
  100. package/src/components/ChainGraph/index.md +67 -1
  101. package/src/components/ChainGraph/index.module.less +1 -1
  102. package/src/components/Chart/index.md +351 -1
  103. package/src/components/Chat/ChatInput/_components/SendButton/index.module.less +1 -1
  104. package/src/components/Chat/ChatInput/_components/UploadButton/index.module.less +1 -1
  105. package/src/components/Chat/ChatInput/index.module.less +2 -2
  106. package/src/components/Chat/ChatList/_components/Assistant/AssistantItem/index.module.less +1 -1
  107. package/src/components/Chat/index.md +140 -1
  108. package/src/components/Checkbox/CheckboxGroup/index.module.less +16 -16
  109. package/src/components/Checkbox/index.md +85 -1
  110. package/src/components/Checkbox/index.module.less +13 -13
  111. package/src/components/CodeMirror/index.md +41 -1
  112. package/src/components/CodeMirror/index.module.less +4 -4
  113. package/src/components/Copy/index.md +1 -1
  114. package/src/components/DatePicker/RangePicker/index.module.less +1 -1
  115. package/src/components/DatePicker/StepPicker/index.module.less +1 -1
  116. package/src/components/DatePicker/index.md +82 -1
  117. package/src/components/DatePicker/index.module.less +2 -1
  118. package/src/components/Descriptions/index.md +45 -1
  119. package/src/components/Editor/index.md +40 -1
  120. package/src/components/FileCol/index.md +24 -1
  121. package/src/components/FilePreview/index.md +45 -1
  122. package/src/components/FlexFill/index.md +46 -1
  123. package/src/components/Form/DrawerForm/index.module.less +2 -2
  124. package/src/components/Form/index.md +179 -1
  125. package/src/components/FormItem/FormInput/FormPasswordStrength/index.module.less +12 -0
  126. package/src/components/FormItem/FormInput/FormPasswordStrength/index.tsx +2 -2
  127. package/src/components/FormItem/FormRadio/index.module.less +9 -9
  128. package/src/components/FormItem/FormSegmented/index.module.less +2 -2
  129. package/src/components/FormItem/FormUpload/index.module.less +4 -4
  130. package/src/components/FormItem/ItemContainer/index.module.less +22 -22
  131. package/src/components/FormItem/index.md +514 -1
  132. package/src/components/Icon/index.md +24 -4
  133. package/src/components/Icon/index.tsx +9 -37
  134. package/src/components/Input/Number/index.module.less +9 -9
  135. package/src/components/Input/Password/index.module.less +3 -3
  136. package/src/components/Input/Range/index.module.less +4 -4
  137. package/src/components/Input/Search/index.module.less +5 -5
  138. package/src/components/Input/TextArea/index.module.less +5 -5
  139. package/src/components/Input/index.md +148 -1
  140. package/src/components/Input/index.module.less +7 -4
  141. package/src/components/Markdown/index.md +73 -1
  142. package/src/components/Modal/index.md +43 -1
  143. package/src/components/Modal/index.module.less +2 -2
  144. package/src/components/Operate/index.md +43 -1
  145. package/src/components/Operate/index.module.less +2 -2
  146. package/src/components/Panel/IframePanel/index.module.less +1 -1
  147. package/src/components/Panel/ListPanel/_components/ColumnMgt/index.module.less +1 -1
  148. package/src/components/Panel/index.md +193 -1
  149. package/src/components/Search/index.md +248 -1
  150. package/src/components/Search/index.module.less +2 -2
  151. package/src/components/SecondConf/index.md +39 -1
  152. package/src/components/Select/AutoCompleteSelect/index.module.less +35 -35
  153. package/src/components/Select/IconSelect/index.module.less +3 -3
  154. package/src/components/Select/TreeSelect/index.module.less +17 -17
  155. package/src/components/Select/_utils/getElementPosition.ts +8 -6
  156. package/src/components/Select/index.md +47 -1
  157. package/src/components/Select/index.module.less +37 -34
  158. package/src/components/Slider/index.md +28 -1
  159. package/src/components/Slider/index.module.less +5 -4
  160. package/src/components/Spreadsheet/index.md +42 -1
  161. package/src/components/Spreadsheet/index.module.less +4 -4
  162. package/src/components/Switch/index.md +33 -1
  163. package/src/components/Switch/index.module.less +7 -0
  164. package/src/components/Switch/index.tsx +14 -11
  165. package/src/components/TabBar/index.md +70 -1
  166. package/src/components/Table/_components/Pagination/index.module.less +23 -23
  167. package/src/components/Table/index.md +60 -1
  168. package/src/components/Table/index.module.less +61 -61
  169. package/src/components/Tags/index.md +23 -1
  170. package/src/components/TextEllipsis/index.md +29 -1
  171. package/src/components/Tree/index.md +66 -1
  172. package/src/components/Tree/index.module.less +11 -11
  173. package/src/components/Upload/index.md +72 -1
  174. package/src/components/Upload/index.module.less +3 -3
  175. package/src/styles/antd-overload.less +1 -1
@@ -28,11 +28,11 @@
28
28
  .antdAutoComplete {
29
29
  cursor: not-allowed;
30
30
 
31
- .ant-select-selection-item {
31
+ :global(.ant-select-selection-item) {
32
32
  color: var(--cf-text-3);
33
33
  }
34
34
 
35
- .ant-select-arrow {
35
+ :global(.ant-select-arrow) {
36
36
  cursor: not-allowed;
37
37
  }
38
38
  }
@@ -75,7 +75,7 @@
75
75
  margin-inline-start: 4px;
76
76
  }
77
77
 
78
- &:has(.ant-select-status-error) {
78
+ &:has(:global(.ant-select-status-error)) {
79
79
  border: 1px solid #ff4d4f;
80
80
 
81
81
  .prefix,
@@ -108,24 +108,24 @@
108
108
  font-weight: inherit;
109
109
  color: inherit !important;
110
110
 
111
- &:has(> .ant-select-arrow),
112
- &:has(> .ant-select-clear) {
113
- .ant-select-selector {
111
+ &:has(> :global(.ant-select-arrow)),
112
+ &:has(> :global(.ant-select-clear)) {
113
+ :global(.ant-select-selector) {
114
114
  padding-right: 20px;
115
115
  }
116
116
  }
117
117
 
118
118
  &.legacyHasArrowOrClear {
119
- .ant-select-selector {
119
+ :global(.ant-select-selector) {
120
120
  padding-right: 20px;
121
121
  }
122
122
  }
123
123
 
124
- &.ant-select {
124
+ &:global(.ant-select) {
125
125
  width: 100%;
126
126
  height: 100%;
127
127
 
128
- .ant-select-selector {
128
+ :global(.ant-select-selector) {
129
129
  width: 100%;
130
130
  height: 100%;
131
131
  padding: 0;
@@ -143,7 +143,7 @@
143
143
  content: none;
144
144
  }
145
145
 
146
- .ant-select-selection-wrap {
146
+ :global(.ant-select-selection-wrap) {
147
147
  height: 100%;
148
148
 
149
149
  font-family: inherit;
@@ -152,7 +152,7 @@
152
152
  color: inherit;
153
153
  }
154
154
 
155
- .ant-select-selection-search {
155
+ :global(.ant-select-selection-search) {
156
156
  inset-inline-start: 0px;
157
157
  inset-inline-end: 0px;
158
158
 
@@ -171,7 +171,7 @@
171
171
  }
172
172
  }
173
173
 
174
- .ant-select-selection-placeholder {
174
+ :global(.ant-select-selection-placeholder) {
175
175
  display: inline-flex;
176
176
  align-items: center;
177
177
 
@@ -183,7 +183,7 @@
183
183
  font-weight: inherit;
184
184
  }
185
185
 
186
- .ant-select-selection-item {
186
+ :global(.ant-select-selection-item) {
187
187
  padding-inline-end: 0px;
188
188
 
189
189
  font-family: inherit;
@@ -192,8 +192,8 @@
192
192
  color: inherit;
193
193
  }
194
194
 
195
- .ant-select-selection-overflow-item {
196
- .ant-select-selection-item {
195
+ :global(.ant-select-selection-overflow-item) {
196
+ :global(.ant-select-selection-item) {
197
197
  line-height: normal;
198
198
 
199
199
  padding-inline-end: 4px;
@@ -201,50 +201,50 @@
201
201
  }
202
202
  }
203
203
 
204
- &.ant-select-focused {
205
- .ant-select-selector {
204
+ &:global(.ant-select-focused) {
205
+ :global(.ant-select-selector) {
206
206
  border: none !important;
207
207
 
208
208
  box-shadow: none !important;
209
209
  }
210
210
  }
211
211
 
212
- &.ant-select-open {
213
- .ant-select-arrow {
212
+ &:global(.ant-select-open) {
213
+ :global(.ant-select-arrow) {
214
214
  transform: rotate(-180deg) translateY(50%);
215
215
  }
216
216
 
217
217
  &.noArrowAnimation {
218
- .ant-select-arrow {
218
+ :global(.ant-select-arrow) {
219
219
  transform: translateY(-50%);
220
220
  transition: none !important;
221
221
  }
222
222
  }
223
223
  }
224
224
 
225
- &.ant-select-status-error {
226
- .ant-select-selector {
225
+ &:global(.ant-select-status-error) {
226
+ :global(.ant-select-selector) {
227
227
  border: none !important;
228
228
  }
229
229
  }
230
230
 
231
- &.ant-select-multiple {
232
- > .ant-select-selector {
233
- > .ant-select-selection-overflow {
234
- .ant-select-selection-search {
231
+ &:global(.ant-select-multiple) {
232
+ > :global(.ant-select-selector) {
233
+ > :global(.ant-select-selection-overflow) {
234
+ :global(.ant-select-selection-search) {
235
235
  width: 0px !important;
236
236
 
237
237
  margin-inline-start: 0px;
238
238
  }
239
239
  }
240
240
 
241
- > .ant-select-selection-placeholder {
241
+ > :global(.ant-select-selection-placeholder) {
242
242
  inset-inline-start: 0px;
243
243
  }
244
244
  }
245
245
  }
246
246
 
247
- .ant-select-arrow {
247
+ :global(.ant-select-arrow) {
248
248
  width: 14px;
249
249
  height: 14px;
250
250
  margin-top: 0px;
@@ -258,7 +258,7 @@
258
258
  pointer-events: all;
259
259
  }
260
260
 
261
- .ant-select-clear {
261
+ :global(.ant-select-clear) {
262
262
  width: 14px;
263
263
  height: 14px;
264
264
  margin-top: 0px;
@@ -273,14 +273,14 @@
273
273
  }
274
274
 
275
275
  &.popupMatchContentWidth {
276
- .ant-select-dropdown {
276
+ :global(.ant-select-dropdown) {
277
277
  [class="rc-virtual-list-holder-inner"] {
278
278
  position: relative !important;
279
279
  }
280
280
  }
281
281
  }
282
282
 
283
- .ant-select-dropdown {
283
+ :global(.ant-select-dropdown) {
284
284
  position: fixed;
285
285
 
286
286
  font-family: inherit;
@@ -288,16 +288,16 @@
288
288
  font-weight: inherit;
289
289
  color: inherit;
290
290
 
291
- .ant-select-item {
291
+ :global(.ant-select-item) {
292
292
  font-family: inherit;
293
293
  font-size: inherit;
294
294
  font-weight: inherit;
295
295
  color: inherit;
296
296
  }
297
297
 
298
- .ant-select-item-empty,
299
- .ant-empty,
300
- .ant-empty-description {
298
+ :global(.ant-select-item-empty),
299
+ :global(.ant-empty),
300
+ :global(.ant-empty-description) {
301
301
  font-family: inherit;
302
302
  font-size: inherit;
303
303
  font-weight: inherit;
@@ -10,7 +10,7 @@
10
10
  cursor: pointer;
11
11
  }
12
12
 
13
- .ant-input-group-addon {
13
+ :global(.ant-input-group-addon) {
14
14
  padding: 0;
15
15
  }
16
16
  }
@@ -26,11 +26,11 @@
26
26
  .tabs {
27
27
  max-width: min-content;
28
28
 
29
- .ant-tabs-nav {
29
+ :global(.ant-tabs-nav) {
30
30
  margin-bottom: 10px;
31
31
  }
32
32
 
33
- .ant-tabs-tab {
33
+ :global(.ant-tabs-tab) {
34
34
  padding: 4px 0px 6px;
35
35
  }
36
36
 
@@ -11,7 +11,7 @@
11
11
  border: 1px solid var(--cf-border);
12
12
  border-radius: 6px;
13
13
 
14
- .ant-select-selector {
14
+ :global(.ant-select-selector) {
15
15
  font-family: inherit;
16
16
  font-size: inherit;
17
17
  font-weight: inherit;
@@ -21,14 +21,14 @@
21
21
  border: none !important;
22
22
  border-radius: inherit !important;
23
23
 
24
- .ant-select-selection-wrap {
24
+ :global(.ant-select-selection-wrap) {
25
25
  font-family: inherit;
26
26
  font-size: inherit;
27
27
  font-weight: inherit;
28
28
  color: inherit;
29
29
  }
30
30
 
31
- .ant-select-selection-search {
31
+ :global(.ant-select-selection-search) {
32
32
  font-family: inherit;
33
33
  font-size: inherit;
34
34
  font-weight: inherit;
@@ -42,13 +42,13 @@
42
42
  }
43
43
  }
44
44
 
45
- .ant-select-selection-placeholder {
45
+ :global(.ant-select-selection-placeholder) {
46
46
  font-family: inherit;
47
47
  font-size: inherit;
48
48
  font-weight: inherit;
49
49
  }
50
50
 
51
- .ant-select-selection-item {
51
+ :global(.ant-select-selection-item) {
52
52
  font-family: inherit;
53
53
  font-size: inherit;
54
54
  font-weight: inherit;
@@ -56,21 +56,21 @@
56
56
  }
57
57
  }
58
58
 
59
- .ant-select-arrow {
59
+ :global(.ant-select-arrow) {
60
60
  width: 14px;
61
61
  height: 14px;
62
62
 
63
63
  font-size: 14px;
64
64
  }
65
65
 
66
- .ant-select-clear {
66
+ :global(.ant-select-clear) {
67
67
  width: 14px;
68
68
  height: 14px;
69
69
 
70
70
  font-size: 14px;
71
71
  }
72
72
 
73
- .ant-tree-select-dropdown {
73
+ :global(.ant-tree-select-dropdown) {
74
74
  position: fixed;
75
75
 
76
76
  font-family: inherit;
@@ -78,17 +78,17 @@
78
78
  font-weight: inherit;
79
79
  color: inherit;
80
80
 
81
- .ant-select-tree,
82
- .ant-select-tree-treenode,
83
- .ant-select-tree-node-content-wrapper,
84
- .ant-select-tree-title {
81
+ :global(.ant-select-tree),
82
+ :global(.ant-select-tree-treenode),
83
+ :global(.ant-select-tree-node-content-wrapper),
84
+ :global(.ant-select-tree-title) {
85
85
  font-family: inherit;
86
86
  font-size: inherit;
87
87
  font-weight: inherit;
88
88
  color: inherit;
89
89
  }
90
90
 
91
- .ant-select-tree-switcher {
91
+ :global(.ant-select-tree-switcher) {
92
92
  display: inline-flex;
93
93
  align-items: center;
94
94
  justify-content: center;
@@ -103,19 +103,19 @@
103
103
  }
104
104
  }
105
105
 
106
- .ant-select-tree-indent-unit {
106
+ :global(.ant-select-tree-indent-unit) {
107
107
  width: var(--tree-indent-unit-width);
108
108
  }
109
109
 
110
- .ant-empty,
111
- .ant-empty-description {
110
+ :global(.ant-empty),
111
+ :global(.ant-empty-description) {
112
112
  font-family: inherit;
113
113
  font-size: inherit;
114
114
  font-weight: inherit;
115
115
  color: inherit;
116
116
  }
117
117
 
118
- .ant-select-tree-list-scrollbar {
118
+ :global(.ant-select-tree-list-scrollbar) {
119
119
  width: 5px !important;
120
120
 
121
121
  > div {
@@ -1,16 +1,18 @@
1
1
  /**
2
- * 获取元素相对于文档的顶部位置
2
+ * 获取元素相对于视口的顶部位置。
3
+ * 下拉框为 position: fixed(相对视口定位),故此处必须返回视口坐标,
4
+ * 不能叠加 document.scrollTop——否则当文档本身可滚动时(如文档站长页面),
5
+ * 下拉框会被定位到 scrollTop 像素之外而“消失”。
6
+ * 在固定布局(document 不滚动,scrollTop=0)下与原行为一致。
3
7
  */
4
8
  export function getElementTop(element: HTMLDivElement): number {
5
- const rect = element.getBoundingClientRect();
6
- return rect.top + document.documentElement.scrollTop;
9
+ return element.getBoundingClientRect().top;
7
10
  }
8
11
 
9
12
  /**
10
- * 获取元素相对于文档的左侧位置
13
+ * 获取元素相对于视口的左侧位置(同上,配合 position: fixed)。
11
14
  */
12
15
  export function getElementLeft(element: HTMLDivElement): number {
13
- const rect = element.getBoundingClientRect();
14
- return rect.left + document.documentElement.scrollLeft;
16
+ return element.getBoundingClientRect().left;
15
17
  }
16
18
 
@@ -8,10 +8,56 @@ title: Select 选择器
8
8
 
9
9
  # Select 选择器
10
10
 
11
- > `Select` 组件。完整 API 见源码类型定义,下方为基础用法。
11
+ 基于 antd `Select` 封装的选择器,默认开启搜索与清除,支持前后缀、箭头动画、下拉宽度自适应内容、`label` `value` 组合展示,并对中文输入法搜索做了优化。
12
12
 
13
13
  ## 引入
14
14
 
15
15
  ```ts
16
16
  import { Select } from "@hsu-react/ui";
17
17
  ```
18
+
19
+ ## 选择器
20
+
21
+ ```tsx
22
+ import React from "react";
23
+ import { Select } from "@hsu-react/ui";
24
+
25
+ const options = [
26
+ { label: "苹果", value: "apple" },
27
+ { label: "香蕉", value: "banana" },
28
+ { label: "橙子", value: "orange" },
29
+ ];
30
+
31
+ export default () => {
32
+ const [value, setValue] = React.useState("apple");
33
+
34
+ return (
35
+ <Select
36
+ style={{ width: 200 }}
37
+ options={options}
38
+ value={value}
39
+ onChange={setValue}
40
+ placeholder="请选择"
41
+ />
42
+ );
43
+ };
44
+ ```
45
+
46
+ ## API
47
+
48
+ 在 [antd SelectProps](https://ant.design/components/select-cn) 基础上扩展(移除了 `placement`、`filterOption` 并重新定义):
49
+
50
+ | 属性 | 说明 | 类型 | 默认值 |
51
+ | --- | --- | --- | --- |
52
+ | options | 选项数据 | `SelectOption[]` | `[]` |
53
+ | prefix | 选择框前缀内容 | `ReactNode` | - |
54
+ | suffix | 选择框后缀内容 | `ReactNode` | - |
55
+ | selectClassName | 内层 antd Select 的类名 | `string` | - |
56
+ | arrowAnimation | 是否启用箭头展开动画 | `boolean` | `true` |
57
+ | popupMatchContentWidth | 下拉面板宽度是否自适应内容 | `boolean` | - |
58
+ | placement | 下拉弹出位置 | `'bottomLeft' \| 'topLeft'` | `'bottomLeft'` |
59
+ | filterOption | 自定义搜索过滤 | `(searchValue: string, option?: DefaultOptionType) => boolean` | - |
60
+ | optionFontSize | 选项字体大小,用于计算自适应宽度 | `number` | `14` |
61
+ | valueInlabel | 在标签/选项中同时展示 value 的位置 | `'before' \| 'after'` | - |
62
+
63
+ > `SelectOption` 形如 `{ label: string; value: number \| string; disabled?: boolean }`,并可携带额外字段。
@@ -6,6 +6,9 @@
6
6
 
7
7
  width: 100%;
8
8
  height: 100%;
9
+ // 父级未给定高度时(height:100% 解析为 auto),保证最小高度,
10
+ // 与 Input 等录入控件高度一致,避免被压扁或在搜索行中高度异常。
11
+ min-height: 32px;
9
12
  padding: 0px 11px;
10
13
 
11
14
  // CF 风格:随外观切换的描边输入控件
@@ -30,11 +33,11 @@
30
33
  .antdSelect {
31
34
  cursor: not-allowed;
32
35
 
33
- .ant-select-selection-item {
36
+ :global(.ant-select-selection-item) {
34
37
  color: var(--cf-text-3);
35
38
  }
36
39
 
37
- .ant-select-arrow {
40
+ :global(.ant-select-arrow) {
38
41
  cursor: not-allowed;
39
42
  }
40
43
  }
@@ -77,7 +80,7 @@
77
80
  margin-inline-start: 4px;
78
81
  }
79
82
 
80
- &:has(> .ant-select-status-error) {
83
+ &:has(> :global(.ant-select-status-error)) {
81
84
  border: 1px solid #ff4d4f;
82
85
 
83
86
  .prefix,
@@ -113,20 +116,20 @@
113
116
  font-weight: inherit;
114
117
  color: inherit !important;
115
118
 
116
- &:has(> .ant-select-arrow),
117
- &:has(> .ant-select-clear) {
118
- .ant-select-selector {
119
+ &:has(> :global(.ant-select-arrow)),
120
+ &:has(> :global(.ant-select-clear)) {
121
+ :global(.ant-select-selector) {
119
122
  padding-right: 20px;
120
123
  }
121
124
  }
122
125
 
123
126
  &.legacyHasArrowOrClear {
124
- .ant-select-selector {
127
+ :global(.ant-select-selector) {
125
128
  padding-right: 20px;
126
129
  }
127
130
  }
128
131
 
129
- .ant-select-selector {
132
+ :global(.ant-select-selector) {
130
133
  width: 100%;
131
134
  height: 100%;
132
135
  padding: 0;
@@ -145,7 +148,7 @@
145
148
  content: none;
146
149
  }
147
150
 
148
- .ant-select-selection-wrap {
151
+ :global(.ant-select-selection-wrap) {
149
152
  height: 100%;
150
153
 
151
154
  font-family: inherit;
@@ -154,7 +157,7 @@
154
157
  color: inherit;
155
158
  }
156
159
 
157
- .ant-select-selection-search {
160
+ :global(.ant-select-selection-search) {
158
161
  inset-inline-start: 0px;
159
162
  inset-inline-end: 0px;
160
163
 
@@ -173,7 +176,7 @@
173
176
  }
174
177
  }
175
178
 
176
- .ant-select-selection-placeholder {
179
+ :global(.ant-select-selection-placeholder) {
177
180
  display: inline-flex;
178
181
  align-items: center;
179
182
 
@@ -185,7 +188,7 @@
185
188
  font-weight: inherit;
186
189
  }
187
190
 
188
- .ant-select-selection-item {
191
+ :global(.ant-select-selection-item) {
189
192
  padding-inline-end: 0px;
190
193
 
191
194
  font-family: inherit;
@@ -194,8 +197,8 @@
194
197
  color: inherit;
195
198
  }
196
199
 
197
- .ant-select-selection-overflow-item {
198
- .ant-select-selection-item {
200
+ :global(.ant-select-selection-overflow-item) {
201
+ :global(.ant-select-selection-item) {
199
202
  line-height: normal;
200
203
 
201
204
  padding-inline-end: 4px;
@@ -203,34 +206,34 @@
203
206
  }
204
207
  }
205
208
 
206
- &.ant-select-focused {
207
- .ant-select-selector {
209
+ &:global(.ant-select-focused) {
210
+ :global(.ant-select-selector) {
208
211
  border: none !important;
209
212
 
210
213
  box-shadow: none !important;
211
214
  }
212
215
  }
213
216
 
214
- &.ant-select-open {
215
- .ant-select-arrow {
217
+ &:global(.ant-select-open) {
218
+ :global(.ant-select-arrow) {
216
219
  transform: rotate(-180deg) translateY(50%);
217
220
  }
218
221
 
219
222
  &.noArrowAnimation {
220
- .ant-select-arrow {
223
+ :global(.ant-select-arrow) {
221
224
  transform: translateY(-50%);
222
225
  transition: none !important;
223
226
  }
224
227
  }
225
228
  }
226
229
 
227
- &.ant-select-status-error {
228
- .ant-select-selector {
230
+ &:global(.ant-select-status-error) {
231
+ :global(.ant-select-selector) {
229
232
  border: none !important;
230
233
  }
231
234
  }
232
235
 
233
- .ant-select-arrow {
236
+ :global(.ant-select-arrow) {
234
237
  width: 14px;
235
238
  height: 14px;
236
239
  margin-top: 0px;
@@ -244,7 +247,7 @@
244
247
  pointer-events: all;
245
248
  }
246
249
 
247
- .ant-select-clear {
250
+ :global(.ant-select-clear) {
248
251
  width: 14px;
249
252
  height: 14px;
250
253
  margin-top: 0px;
@@ -256,17 +259,17 @@
256
259
  inset-inline-end: 0px;
257
260
  }
258
261
 
259
- &.ant-select-multiple {
260
- > .ant-select-selector {
261
- > .ant-select-selection-overflow {
262
- .ant-select-selection-search {
262
+ &:global(.ant-select-multiple) {
263
+ > :global(.ant-select-selector) {
264
+ > :global(.ant-select-selection-overflow) {
265
+ :global(.ant-select-selection-search) {
263
266
  width: 0px !important;
264
267
 
265
268
  margin-inline-start: 0px;
266
269
  }
267
270
  }
268
271
 
269
- > .ant-select-selection-placeholder {
272
+ > :global(.ant-select-selection-placeholder) {
270
273
  inset-inline-start: 0px;
271
274
  }
272
275
  }
@@ -274,14 +277,14 @@
274
277
  }
275
278
 
276
279
  &.popupMatchContentWidth {
277
- .ant-select-dropdown {
280
+ :global(.ant-select-dropdown) {
278
281
  [class="rc-virtual-list-holder-inner"] {
279
282
  position: relative !important;
280
283
  }
281
284
  }
282
285
  }
283
286
 
284
- .ant-select-dropdown {
287
+ :global(.ant-select-dropdown) {
285
288
  position: fixed;
286
289
 
287
290
  font-family: inherit;
@@ -291,7 +294,7 @@
291
294
 
292
295
  border-radius: inherit;
293
296
 
294
- .ant-select-item {
297
+ :global(.ant-select-item) {
295
298
  font-family: inherit;
296
299
  font-size: inherit;
297
300
  font-weight: inherit;
@@ -300,9 +303,9 @@
300
303
  border-radius: inherit;
301
304
  }
302
305
 
303
- .ant-select-item-empty,
304
- .ant-empty,
305
- .ant-empty-description {
306
+ :global(.ant-select-item-empty),
307
+ :global(.ant-empty),
308
+ :global(.ant-empty-description) {
306
309
  font-family: inherit;
307
310
  font-size: inherit;
308
311
  font-weight: inherit;
@@ -8,10 +8,37 @@ title: Slider 滑动输入
8
8
 
9
9
  # Slider 滑动输入
10
10
 
11
- > `Slider` 组件。完整 API 见源码类型定义,下方为基础用法。
11
+ 基于 antd 单值 `Slider` 封装的滑动输入条,内部维护受控值、默认关闭 Tooltip,并支持通过 `topValue` 从外部强制更新当前值。
12
12
 
13
13
  ## 引入
14
14
 
15
15
  ```ts
16
16
  import { Slider } from "@hsu-react/ui";
17
17
  ```
18
+
19
+ ## 滑动输入
20
+
21
+ ```tsx
22
+ import React from "react";
23
+ import { Slider } from "@hsu-react/ui";
24
+
25
+ export default () => {
26
+ const [value, setValue] = React.useState(30);
27
+
28
+ return (
29
+ <div style={{ width: 240 }}>
30
+ <Slider value={value} onChange={setValue} />
31
+ </div>
32
+ );
33
+ };
34
+ ```
35
+
36
+ ## API
37
+
38
+ 在 [antd SliderSingleProps](https://ant.design/components/slider-cn) 基础上扩展:
39
+
40
+ | 属性 | 说明 | 类型 | 默认值 |
41
+ | --- | --- | --- | --- |
42
+ | topValue | 外部强制同步的当前值,优先级高于 `value` | `number` | - |
43
+ | value | 当前值 | `number` | `0` |
44
+ | onChange | 值变化回调 | `(value: number) => void` | - |