@douyinfe/semi-foundation 2.46.1 → 2.47.0-beta.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.
Files changed (45) hide show
  1. package/button/button.scss +88 -20
  2. package/button/variables.scss +13 -0
  3. package/datePicker/inputFoundation.ts +7 -5
  4. package/lib/cjs/button/button.css +30 -2
  5. package/lib/cjs/button/button.scss +88 -20
  6. package/lib/cjs/button/variables.scss +13 -0
  7. package/lib/cjs/cascader/foundation.d.ts +1 -4
  8. package/lib/cjs/datePicker/inputFoundation.js +17 -8
  9. package/lib/cjs/table/foundation.d.ts +1 -1
  10. package/lib/cjs/tree/foundation.d.ts +2 -1
  11. package/lib/cjs/tree/foundation.js +17 -8
  12. package/lib/cjs/tree/treeUtil.d.ts +15 -6
  13. package/lib/cjs/tree/treeUtil.js +39 -20
  14. package/lib/cjs/treeSelect/foundation.d.ts +0 -1
  15. package/lib/cjs/treeSelect/foundation.js +47 -26
  16. package/lib/cjs/typography/typography.css +5 -0
  17. package/lib/cjs/typography/typography.scss +5 -0
  18. package/lib/cjs/typography/variables.scss +4 -0
  19. package/lib/cjs/utils/array.d.ts +2 -2
  20. package/lib/cjs/utils/array.js +2 -2
  21. package/lib/es/button/button.css +30 -2
  22. package/lib/es/button/button.scss +88 -20
  23. package/lib/es/button/variables.scss +13 -0
  24. package/lib/es/cascader/foundation.d.ts +1 -4
  25. package/lib/es/datePicker/inputFoundation.js +17 -8
  26. package/lib/es/table/foundation.d.ts +1 -1
  27. package/lib/es/tree/foundation.d.ts +2 -1
  28. package/lib/es/tree/foundation.js +17 -8
  29. package/lib/es/tree/treeUtil.d.ts +15 -6
  30. package/lib/es/tree/treeUtil.js +39 -20
  31. package/lib/es/treeSelect/foundation.d.ts +0 -1
  32. package/lib/es/treeSelect/foundation.js +47 -26
  33. package/lib/es/typography/typography.css +5 -0
  34. package/lib/es/typography/typography.scss +5 -0
  35. package/lib/es/typography/variables.scss +4 -0
  36. package/lib/es/utils/array.d.ts +2 -2
  37. package/lib/es/utils/array.js +2 -2
  38. package/package.json +3 -3
  39. package/table/foundation.ts +1 -1
  40. package/tree/foundation.ts +14 -7
  41. package/tree/treeUtil.ts +47 -18
  42. package/treeSelect/foundation.ts +35 -26
  43. package/typography/typography.scss +5 -0
  44. package/typography/variables.scss +4 -0
  45. package/utils/array.ts +4 -4
@@ -53,6 +53,10 @@ $module: #{$prefix}-typography;
53
53
 
54
54
  &-small {
55
55
  @include font-size-small;
56
+ font-weight: $font-typography_smallText-regular-fontWeight;
57
+ &.#{$module}-paragraph{
58
+ font-weight: $font-typography_smallParagraph-regular-fontWeight;
59
+ }
56
60
  }
57
61
 
58
62
  code {
@@ -351,6 +355,7 @@ h6.#{$module},
351
355
  p.#{$module}-extended,
352
356
  .#{$module}-paragraph.#{$module}-extended {
353
357
  line-height: $font-typography_paragraph_extended-lineHeight;
358
+ font-weight: $font-typography_normalParagraph-regular-fontWeight;
354
359
  }
355
360
 
356
361
  @import "./rtl.scss";
@@ -26,6 +26,10 @@ $font-typography_title-fontWeight: $font-weight-bold; // 标题文本字重
26
26
  $font-typography_link-fontWeight: $font-weight-bold; // 链接文本字重
27
27
  $font-typography_strong-fontWeight: $font-weight-bold; // 强调文本字重
28
28
  $font-typography_paragraph_extended-lineHeight: 24px; // 宽松行距段落文本行高
29
+ $font-typography_normalText-regular-fontWeight: $font-weight-regular; // normal text 字重 - 正常
30
+ $font-typography_smallText-regular-fontWeight: $font-weight-regular; // small text 字重 - 正常
31
+ $font-typography_normalParagraph-regular-fontWeight: $font-weight-regular; // normal paragraph 字重 - 正常
32
+ $font-typography_smallParagraph-regular-fontWeight: $font-weight-regular; // small paragraph 字重 - 正常
29
33
 
30
34
  $font-typography_title1-fontWeight: $font-typography_title-fontWeight; // 一级标题文本字重
31
35
  $font-typography_title2-fontWeight: $font-typography_title-fontWeight; // 二级标题文本字重
@@ -11,12 +11,12 @@
11
11
  * => ['b', 'b']
12
12
  */
13
13
  export declare function pullAll(arrayA: any[], arrayB: any[]): any[];
14
- type CompareFn<T> = (a: T, b: T) => number;
14
+ type CompareFn<T> = (a: T, b: T, sortOrder: 'ascend' | 'descend') => number;
15
15
  /**
16
16
  * Adapt the descending order
17
17
  * @param {Function} fn
18
18
  * @param {String} order
19
19
  * @returns
20
20
  */
21
- export declare function withOrderSort<T = any>(fn: CompareFn<T>, order?: string): CompareFn<T>;
21
+ export declare function withOrderSort<T = any>(fn: CompareFn<T>, order?: 'ascend' | 'descend'): (a: T, b: T) => number;
22
22
  export {};
@@ -38,11 +38,11 @@ function withOrderSort(fn) {
38
38
  switch (order) {
39
39
  case 'descend':
40
40
  return (a, b) => {
41
- const result = Number(fn(a, b));
41
+ const result = Number(fn(a, b, order));
42
42
  return result !== 0 ? -result : result;
43
43
  };
44
44
  case 'ascend':
45
45
  default:
46
- return fn;
46
+ return (a, b) => fn(a, b, order);
47
47
  }
48
48
  }
@@ -52,6 +52,12 @@
52
52
  transition: background-color var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none), border var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none);
53
53
  transform: scale(var(--semi-transform_scale-none));
54
54
  }
55
+ .semi-button-danger-disabled {
56
+ background-color: var(--semi-color-disabled-bg);
57
+ }
58
+ .semi-button-danger-disabled.semi-button-light {
59
+ background-color: var(--semi-color-fill-0);
60
+ }
55
61
  .semi-button-danger:hover {
56
62
  background-color: var(--semi-color-danger-hover);
57
63
  }
@@ -70,6 +76,12 @@
70
76
  transition: background-color var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none), border var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none);
71
77
  transform: scale(var(--semi-transform_scale-none));
72
78
  }
79
+ .semi-button-warning-disabled {
80
+ background-color: var(--semi-color-disabled-bg);
81
+ }
82
+ .semi-button-warning-disabled.semi-button-light {
83
+ background-color: var(--semi-color-fill-0);
84
+ }
73
85
  .semi-button-warning:hover {
74
86
  background-color: var(--semi-color-warning-hover);
75
87
  }
@@ -88,6 +100,12 @@
88
100
  transition: background-color var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none), border var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none);
89
101
  transform: scale(var(--semi-transform_scale-none));
90
102
  }
103
+ .semi-button-tertiary-disabled {
104
+ background-color: var(--semi-color-disabled-bg);
105
+ }
106
+ .semi-button-tertiary-disabled.semi-button-light {
107
+ background-color: var(--semi-color-fill-0);
108
+ }
91
109
  .semi-button-tertiary:hover {
92
110
  background-color: var(--semi-color-tertiary-hover);
93
111
  }
@@ -103,6 +121,12 @@
103
121
  transition: background-color var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none), border var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none);
104
122
  transform: scale(var(--semi-transform_scale-none));
105
123
  }
124
+ .semi-button-primary-disabled {
125
+ background-color: var(--semi-color-disabled-bg);
126
+ }
127
+ .semi-button-primary-disabled.semi-button-light {
128
+ background: var(--semi-color-fill-0);
129
+ }
106
130
  .semi-button-primary:not(.semi-button-borderless):not(.semi-button-light):hover {
107
131
  background-color: var(--semi-color-primary-hover);
108
132
  }
@@ -119,6 +143,12 @@
119
143
  transition: background-color var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none), border var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none);
120
144
  transform: scale(var(--semi-transform_scale-none));
121
145
  }
146
+ .semi-button-secondary-disabled {
147
+ background-color: var(--semi-color-disabled-bg);
148
+ }
149
+ .semi-button-secondary-disabled.semi-button-light {
150
+ background-color: var(--semi-color-fill-0);
151
+ }
122
152
  .semi-button-secondary:hover {
123
153
  background-color: var(--semi-color-secondary-hover);
124
154
  }
@@ -130,12 +160,10 @@
130
160
  }
131
161
  .semi-button-disabled {
132
162
  color: var(--semi-color-disabled-text);
133
- background-color: var(--semi-color-disabled-bg);
134
163
  cursor: not-allowed;
135
164
  }
136
165
  .semi-button-disabled:not(.semi-button-borderless):not(.semi-button-light):hover {
137
166
  color: var(--semi-color-disabled-text);
138
- background-color: var(--semi-color-disabled-bg);
139
167
  }
140
168
  .semi-button-disabled.semi-button-light, .semi-button-disabled.semi-button-borderless {
141
169
  color: var(--semi-color-disabled-text);
@@ -39,74 +39,117 @@ $module: #{$prefix}-button;
39
39
  &-danger {
40
40
  background-color: $color-button_danger-bg-default;
41
41
  color: $color-button_danger-text-default;
42
- transition: background-color $transition_duration-button_danger-bg $transition_function-button_danger-bg $transition_delay-button_danger-bg,
43
- border $transition_duration-button_danger-border $transition_function-button_danger-border $transition_delay-button_danger-border;
44
- transform: scale($transform-scale-button_danger);
42
+ transition: background-color $transition_duration-button_danger-bg $transition_function-button_danger-bg $transition_delay-button_danger-bg,
43
+ border $transition_duration-button_danger-border $transition_function-button_danger-border $transition_delay-button_danger-border;
44
+ transform: scale($transform-scale-button_danger);
45
45
 
46
+ &-disabled {
47
+ background-color: $color-button_disabled_danger-bg-default;
48
+
49
+ &.#{$module}-light {
50
+ background-color: $color-button_disabled_light_danger-bg-default;
51
+ }
52
+ }
46
53
 
47
54
  &:hover {
48
55
  background-color: $color-button_danger-bg-hover;
49
56
  }
57
+
50
58
  &:active {
51
59
  background-color: $color-button_danger-bg-active;
52
60
  }
61
+
53
62
  &.#{$module}-light,
54
63
  &.#{$module}-borderless {
55
64
  color: $color-button_danger_borderless-text-default;
56
65
  }
66
+
57
67
  &:not(.#{$module}-borderless):not(.#{$module}-light):focus-visible {
58
68
  outline: $width-button-outline solid $color-button_danger-outline-focus;
59
69
  }
60
70
  }
71
+
61
72
  &-warning {
62
73
  background-color: $color-button_warning-bg-default;
63
74
  color: $color-button_warning-text-default;
64
- transition: background-color $transition_duration-button_warning-bg $transition_function-button_warning-bg $transition_delay-button_warning-bg,
65
- border $transition_duration-button_warning-border $transition_function-button_warning-border $transition_delay-button_warning-border;
66
- transform:scale($transform_scale-button_warning);
75
+ transition: background-color $transition_duration-button_warning-bg $transition_function-button_warning-bg $transition_delay-button_warning-bg,
76
+ border $transition_duration-button_warning-border $transition_function-button_warning-border $transition_delay-button_warning-border;
77
+ transform: scale($transform_scale-button_warning);
78
+
79
+ &-disabled {
80
+ background-color: $color-button_disabled_warning-bg-default;
81
+
82
+ &.#{$module}-light {
83
+ background-color: $color-button_disabled_light_warning-bg-default;
84
+ }
85
+ }
67
86
 
68
87
  &:hover {
69
88
  background-color: $color-button_warning-bg-hover;
70
89
  }
90
+
71
91
  &:active {
72
92
  background-color: $color-button_warning-bg-active;
73
93
  }
94
+
74
95
  &.#{$module}-light,
75
96
  &.#{$module}-borderless {
76
97
  color: $color-button_warning_borderless-text-default;
77
98
  }
99
+
78
100
  &:not(.#{$module}-borderless):not(.#{$module}-light):focus-visible {
79
101
  outline: $width-button-outline solid $color-button_warning-outline-focus;
80
102
  }
81
103
  }
104
+
82
105
  &-tertiary {
83
106
  background-color: $color-button_tertiary-bg-default;
84
107
  color: $color-button_tertiary-text-default;
85
- transition: background-color $transition_duration-button_tertiary-bg $transition_function-button_tertiary-bg $transition_delay-button_tertiary-bg,
86
- border $transition_duration-button_tertiary-border $transition_function-button_tertiary-border $transition_delay-button_tertiary-border;
87
- transform:scale($transform_scale_button_tertiary);
108
+ transition: background-color $transition_duration-button_tertiary-bg $transition_function-button_tertiary-bg $transition_delay-button_tertiary-bg,
109
+ border $transition_duration-button_tertiary-border $transition_function-button_tertiary-border $transition_delay-button_tertiary-border;
110
+ transform: scale($transform_scale_button_tertiary);
111
+
112
+ &-disabled {
113
+ background-color: $color-button_disabled_tertiary-bg-default;
114
+
115
+ &.#{$module}-light {
116
+ background-color: $color-button_disabled_light_tertiary-bg-default;
117
+ }
118
+ }
88
119
 
89
120
  &:hover {
90
121
  background-color: $color-button_tertiary-bg-hover;
91
122
  }
123
+
92
124
  &:active {
93
125
  background-color: $color-button_tertiary-bg-active;
94
126
  }
127
+
95
128
  &.#{$module}-light,
96
129
  &.#{$module}-borderless {
97
130
  color: $color-button_tertiary_solid-text-default;
98
131
  }
99
132
  }
133
+
100
134
  &-primary {
101
135
  background-color: $color-button_primary-bg-default;
102
136
  color: $color-button_primary-text-default;
103
137
  transition: background-color $transition_duration-button_primary-bg $transition_function-button_primary-bg $transition_delay-button_primary-bg,
104
138
  border $transition_duration-button_primary-border $transition_function-button_primary-border $transition_delay-button_primary-border;;
105
- transform:scale($transform_scale-button_primary);
139
+ transform: scale($transform_scale-button_primary);
140
+
141
+ &-disabled {
142
+ background-color: $color-button_disabled_primary-bg-default;
143
+
144
+ &.#{$module}-light {
145
+ background: $color-button_disabled_light_primary-bg-default;
146
+ }
147
+ }
106
148
 
107
149
  &:not(.#{$module}-borderless):not(.#{$module}-light):hover {
108
150
  background-color: $color-button_primary-bg-hover;
109
151
  }
152
+
110
153
  &:not(.#{$module}-borderless):not(.#{$module}-light):active {
111
154
  background-color: $color-button_primary-bg-active;
112
155
  }
@@ -116,17 +159,27 @@ $module: #{$prefix}-button;
116
159
  color: $color-button_primary_borderless-text-default;
117
160
  }
118
161
  }
162
+
119
163
  &-secondary {
120
164
  background-color: $color-button_secondary-bg-default;
121
165
  outline-color: $color-button_secondary-border-default;
122
166
  color: $color-button_secondary-text-default;
123
- transition: background-color $transition_duration-button_secondary-bg $transition_function-button_secondary-bg $transition_delay-button_secondary-bg,
124
- border $transition_duration-button_secondary-border $transition_function-button_secondary-border $transition_delay-button_secondary-border;
125
- transform:scale($transform_scale-button_secondary);
167
+ transition: background-color $transition_duration-button_secondary-bg $transition_function-button_secondary-bg $transition_delay-button_secondary-bg,
168
+ border $transition_duration-button_secondary-border $transition_function-button_secondary-border $transition_delay-button_secondary-border;
169
+ transform: scale($transform_scale-button_secondary);
170
+
171
+ &-disabled {
172
+ background-color: $color-button_disabled_secondary-bg-default;
173
+
174
+ &.#{$module}-light {
175
+ background-color: $color-button_disabled_light_secondary-bg-default;
176
+ }
177
+ }
126
178
 
127
179
  &:hover {
128
180
  background-color: $color-button_secondary-bg-hover;
129
181
  }
182
+
130
183
  &:active {
131
184
  background-color: $color-button_secondary-bg-active;
132
185
  }
@@ -136,13 +189,14 @@ $module: #{$prefix}-button;
136
189
  color: $color-button_secondary_borderless-text-default;
137
190
  }
138
191
  }
192
+
139
193
  &-disabled {
140
194
  color: $color-button_disabled_solid-text-default;
141
- background-color: $color-button_disabled-bg-default;
195
+
142
196
  &:not(.#{$module}-borderless):not(.#{$module}-light):hover {
143
197
  color: $color-button_disabled-text-hover;
144
- background-color: $color-button_disabled-bg-hover;
145
198
  }
199
+
146
200
  cursor: not-allowed;
147
201
 
148
202
  &.#{$module}-light,
@@ -150,16 +204,18 @@ $module: #{$prefix}-button;
150
204
  color: $color-button_disabled-text-default;
151
205
  }
152
206
  }
207
+
153
208
  &-borderless {
154
209
  background-color: transparent;
155
210
  border: $width-button_borderless-border $color-button_borderless-border-default solid;
156
- transition:background-color $transition_duration-button_borderless-bg $transition_function-button_borderless-bg $transition_delay-button_borderless-bg;
157
- transform:scale($transform_scale-button_borderless);
211
+ transition: background-color $transition_duration-button_borderless-bg $transition_function-button_borderless-bg $transition_delay-button_borderless-bg;
212
+ transform: scale($transform_scale-button_borderless);
158
213
 
159
214
  &:not(.#{$module}-disabled):hover {
160
215
  background-color: $color-button_borderless-bg-hover;
161
216
  border: $width-button_borderless-border $color-button_borderless-border-hover solid;
162
217
  }
218
+
163
219
  &:not(.#{$module}-disabled):active {
164
220
  background-color: $color-button_borderless-bg-active;
165
221
  border: $width-button_borderless-border $color-button_borderless-border-active solid;
@@ -169,19 +225,21 @@ $module: #{$prefix}-button;
169
225
  &-light {
170
226
  background-color: $color-button_light-bg-default;
171
227
  border: $width-button_light-border $color-button_light-border-default solid;
172
- transition: background-color $transition_duration-button_light-bg $transition_function-button_light-bg $transition_delay-button_light-bg,
173
- border $transition_duration-button_light-border $transition_function-button_light-border $transition_delay-button_light-border;
174
- transform:scale($transform_scale-button_light);
228
+ transition: background-color $transition_duration-button_light-bg $transition_function-button_light-bg $transition_delay-button_light-bg,
229
+ border $transition_duration-button_light-border $transition_function-button_light-border $transition_delay-button_light-border;
230
+ transform: scale($transform_scale-button_light);
175
231
 
176
232
  &:not(.#{$module}-disabled):hover {
177
233
  background-color: $color-button_light-bg-hover;
178
234
  border: $width-button_light-border $color-button_light-border-hover solid;
179
235
  }
236
+
180
237
  &:not(.#{$module}-disabled):active {
181
238
  background-color: $color-button_light-bg-active;
182
239
  border: $width-button_light-border $color-button_light-border-active solid;
183
240
  }
184
241
  }
242
+
185
243
  &-size-small {
186
244
  height: $height-button_small;
187
245
  padding-top: $spacing-button_small-paddingTop;
@@ -189,6 +247,7 @@ $module: #{$prefix}-button;
189
247
  padding-left: $spacing-button_small-paddingLeft;
190
248
  padding-right: $spacing-button_small-paddingRight;
191
249
  }
250
+
192
251
  &-size-large {
193
252
  height: $height-button_large;
194
253
  padding-top: $spacing-button_large-paddingTop;
@@ -196,6 +255,7 @@ $module: #{$prefix}-button;
196
255
  padding-left: $spacing-button_large-paddingLeft;
197
256
  padding-right: $spacing-button_large-paddingRight;
198
257
  }
258
+
199
259
  &-block {
200
260
  width: 100%;
201
261
  }
@@ -259,6 +319,7 @@ $module: #{$prefix}-button;
259
319
  border-top-left-radius: $radius-button_group;
260
320
  border-bottom-left-radius: $radius-button_group;
261
321
  }
322
+
262
323
  &:last-child {
263
324
  border-top-right-radius: $radius-button_group;
264
325
  border-bottom-right-radius: $radius-button_group;
@@ -273,24 +334,31 @@ $module: #{$prefix}-button;
273
334
  &-primary {
274
335
  background-color: $color-button_primary-bg-default;
275
336
  }
337
+
276
338
  &-secondary {
277
339
  background-color: $color-button_secondary-bg-default;
278
340
  }
341
+
279
342
  &-tertiary {
280
343
  background-color: $color-button_tertiary-bg-default;
281
344
  }
345
+
282
346
  &-warning {
283
347
  background-color: $color-button_warning-bg-default;
284
348
  }
349
+
285
350
  &-danger {
286
351
  background-color: $color-button_danger-bg-default;
287
352
  }
353
+
288
354
  &-disabled {
289
355
  background-color: $color-button_disabled-bg-default;
290
356
  }
357
+
291
358
  &-light {
292
359
  background-color: $color-button_light-bg-default;
293
360
  }
361
+
294
362
  &-borderless {
295
363
  background-color: transparent;
296
364
  }
@@ -82,6 +82,13 @@ $color-button_disabled-text-default: var(--semi-color-disabled-text); // 禁用
82
82
  $color-button_disabled-bg-default: var(--semi-color-disabled-bg); // 禁用按钮背景颜色
83
83
  $color-button_disabled-text-hover: $color-button_disabled-text-default; // 禁用按钮文字颜色 - 悬浮
84
84
  $color-button_disabled-bg-hover: var(--semi-color-disabled-bg); // 禁用按钮背景颜色 - 悬浮
85
+ $color-button_disabled_primary-bg-default: $color-button_disabled-bg-default; // 禁用 primary 按钮背景颜色
86
+ $color-button_disabled_secondary-bg-default: $color-button_disabled-bg-default; // 禁用 secondary 按钮背景颜色
87
+ $color-button_disabled_danger-bg-default: $color-button_disabled-bg-default; // 禁用 danger 按钮背景颜色
88
+ $color-button_disabled_warning-bg-default: $color-button_disabled-bg-default; // 禁用 warning 按钮背景颜色
89
+ $color-button_disabled_tertiary-bg-default: $color-button_disabled-bg-default; // 禁用 tertiary 按钮背景颜色
90
+
91
+
85
92
 
86
93
  // light
87
94
  $color-button_light-bg-default: var(--semi-color-fill-0); // 浅色按钮背景颜色
@@ -92,6 +99,12 @@ $color-button_light-border-hover: $color-button_light-border-default; // 浅色
92
99
  $color-button_light-border-active: $color-button_light-border-hover; // 浅色按钮描边颜色 - 按下
93
100
  $width-button_light-border: 0; // 浅色按钮描边宽度
94
101
 
102
+ $color-button_disabled_light_primary-bg-default: $color-button_light-bg-default; // 禁用 light primary 按钮背景颜色
103
+ $color-button_disabled_light_secondary-bg-default: $color-button_light-bg-default; // 禁用 light secondary 按钮背景颜色
104
+ $color-button_disabled_light_danger-bg-default: $color-button_light-bg-default; // 禁用 light danger 按钮背景颜色
105
+ $color-button_disabled_light_warning-bg-default: $color-button_light-bg-default; // 禁用 light warning 按钮背景颜色
106
+ $color-button_disabled_light_tertiary-bg-default: $color-button_light-bg-default; // 禁用 light tertiary 按钮背景颜色
107
+
95
108
  // borderless
96
109
  $color-button_borderless-text-default: var(--semi-color-primary); // 无背景按钮背景颜色
97
110
  $color-button_borderless-bg-hover: var(--semi-color-fill-0); // 无背景按钮背景颜色 - 悬浮
@@ -239,10 +239,7 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
239
239
  * @param {boolean} curCheckedStatus checked status of node
240
240
  */
241
241
  calcCheckedKeys(key: string, curCheckedStatus: boolean): {
242
- checkedKeys: Set<string>; /**
243
- * When changeOnSelect is turned on, or the target option is a leaf option,
244
- * the option is considered to be selected, even if the option is disabled
245
- */
242
+ checkedKeys: Set<string>;
246
243
  halfCheckedKeys: Set<string>;
247
244
  };
248
245
  handleInputChange(sugInput: string): void;
@@ -106,25 +106,34 @@ export default class InputFoundation extends BaseFoundation {
106
106
  } = options;
107
107
  const {
108
108
  format,
109
- type
109
+ type,
110
+ rangeSeparator
110
111
  } = this._adapter.getProps();
111
112
  const insetFormatToken = getInsetInputFormatToken({
112
113
  type,
113
114
  format
114
115
  });
115
- let newInsetInputValue = _set(_cloneDeep(insetInputValue), valuePath, value);
116
- newInsetInputValue = this._autoFillTimeToInsetInputValue({
117
- insetInputValue: newInsetInputValue,
116
+ const newInsetInputValue = _set(_cloneDeep(insetInputValue), valuePath, value);
117
+ const insetInputStr = this.concatInsetInputValue({
118
+ insetInputValue: newInsetInputValue
119
+ });
120
+ const parsedInsetInputValueFromInputStr = getInsetInputValueFromInsetInputStr({
121
+ inputValue: insetInputStr,
122
+ type,
123
+ rangeSeparator
124
+ });
125
+ const filledTimeInsetInputValue = this._autoFillTimeToInsetInputValue({
126
+ insetInputValue: parsedInsetInputValueFromInputStr,
118
127
  valuePath,
119
128
  format: insetFormatToken
120
129
  });
121
- const newInputValue = this.concatInsetInputValue({
122
- insetInputValue: newInsetInputValue
130
+ const finalInsetInputStr = this.concatInsetInputValue({
131
+ insetInputValue: filledTimeInsetInputValue
123
132
  });
124
133
  this._adapter.notifyInsetInputChange({
125
- insetInputValue: newInsetInputValue,
134
+ insetInputValue: filledTimeInsetInputValue,
126
135
  format: insetFormatToken,
127
- insetInputStr: newInputValue
136
+ insetInputStr: finalInsetInputStr
128
137
  });
129
138
  }
130
139
  _autoFillTimeToInsetInputValue(options) {
@@ -327,7 +327,7 @@ export interface BaseSorterInfo<RecordType> {
327
327
  sorter?: BaseSorter<RecordType>;
328
328
  }
329
329
  export type BaseSortOrder = boolean | ArrayElement<typeof strings.SORT_DIRECTIONS>;
330
- export type BaseSorter<RecordType> = boolean | ((a?: RecordType, b?: RecordType) => number);
330
+ export type BaseSorter<RecordType> = boolean | ((a?: RecordType, b?: RecordType, sortOrder?: 'ascend' | 'descend') => number);
331
331
  export interface BaseChangeInfoFilter<RecordType> {
332
332
  dataIndex?: string;
333
333
  value?: any;
@@ -3,6 +3,7 @@
3
3
  * https://github.com/react-component/tree
4
4
  */
5
5
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
6
+ export { KeyMapProps } from './treeUtil';
6
7
  export interface BasicTreeNodeProps {
7
8
  [x: string]: any;
8
9
  expanded?: boolean;
@@ -24,7 +25,7 @@ export interface BasicTreeNodeProps {
24
25
  }
25
26
  export interface BasicTreeNodeData {
26
27
  [x: string]: any;
27
- key: string;
28
+ key?: string;
28
29
  value?: number | string;
29
30
  label?: any;
30
31
  icon?: any;
@@ -121,7 +121,8 @@ export default class TreeFoundation extends BaseFoundation {
121
121
  } = this.getStates();
122
122
  const {
123
123
  leafOnly,
124
- checkRelation
124
+ checkRelation,
125
+ keyMaps
125
126
  } = this.getProps();
126
127
  let value;
127
128
  let keyList = [];
@@ -133,12 +134,15 @@ export default class TreeFoundation extends BaseFoundation {
133
134
  if (this.getProp('onChangeWithObject')) {
134
135
  value = keyList.map(itemKey => keyEntities[itemKey].data);
135
136
  } else {
136
- value = getValueOrKey(keyList.map(itemKey => keyEntities[itemKey].data));
137
+ value = getValueOrKey(keyList.map(itemKey => keyEntities[itemKey].data), keyMaps);
137
138
  }
138
139
  this._adapter.notifyChange(value);
139
140
  }
140
141
  notifyChange(key, e) {
141
142
  const isMultiple = this._isMultiple();
143
+ const {
144
+ keyMaps
145
+ } = this.getProps();
142
146
  const {
143
147
  keyEntities
144
148
  } = this.getStates();
@@ -154,7 +158,7 @@ export default class TreeFoundation extends BaseFoundation {
154
158
  const {
155
159
  data
156
160
  } = _get(keyEntities, key);
157
- value = getValueOrKey(data);
161
+ value = getValueOrKey(data, keyMaps);
158
162
  }
159
163
  this._adapter.notifyChange(value);
160
164
  }
@@ -171,8 +175,10 @@ export default class TreeFoundation extends BaseFoundation {
171
175
  const {
172
176
  showFilteredOnly,
173
177
  filterTreeNode,
174
- treeNodeFilterProp
178
+ treeNodeFilterProp,
179
+ keyMaps
175
180
  } = this.getProps();
181
+ const realFilterProp = treeNodeFilterProp !== 'label' ? treeNodeFilterProp : _get(keyMaps, 'label', 'label');
176
182
  let filteredOptsKeys = [];
177
183
  let expandedOptsKeys = [];
178
184
  let flattenNodes = [];
@@ -180,13 +186,13 @@ export default class TreeFoundation extends BaseFoundation {
180
186
  if (!sugInput) {
181
187
  expandedOptsKeys = findAncestorKeys(selectedKeys, keyEntities);
182
188
  expandedOptsKeys.forEach(item => expandedKeys.add(item));
183
- flattenNodes = flattenTreeData(treeData, expandedKeys);
189
+ flattenNodes = flattenTreeData(treeData, expandedKeys, keyMaps);
184
190
  } else {
185
- filteredOptsKeys = Object.values(keyEntities).filter(item => filter(sugInput, item.data, filterTreeNode, treeNodeFilterProp)).map(item => item.key);
191
+ filteredOptsKeys = Object.values(keyEntities).filter(item => filter(sugInput, item.data, filterTreeNode, realFilterProp)).map(item => item.key);
186
192
  expandedOptsKeys = findAncestorKeys(filteredOptsKeys, keyEntities, false);
187
193
  const shownChildKeys = findDescendantKeys(filteredOptsKeys, keyEntities, true);
188
194
  filteredShownKeys = new Set([...shownChildKeys, ...expandedOptsKeys]);
189
- flattenNodes = flattenTreeData(treeData, new Set(expandedOptsKeys), showFilteredOnly && filteredShownKeys);
195
+ flattenNodes = flattenTreeData(treeData, new Set(expandedOptsKeys), keyMaps, showFilteredOnly && filteredShownKeys);
190
196
  }
191
197
  const newFilteredExpandedKeys = new Set(expandedOptsKeys);
192
198
  this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys));
@@ -354,6 +360,9 @@ export default class TreeFoundation extends BaseFoundation {
354
360
  filteredShownKeys,
355
361
  keyEntities
356
362
  } = this.getStates();
363
+ const {
364
+ keyMaps
365
+ } = this.getProps();
357
366
  const isSearching = Boolean(inputValue);
358
367
  const showFilteredOnly = this._showFilteredOnly();
359
368
  const expandedStateKey = isSearching ? 'filteredExpandedKeys' : 'expandedKeys';
@@ -372,7 +381,7 @@ export default class TreeFoundation extends BaseFoundation {
372
381
  }
373
382
  this._adapter.cacheFlattenNodes(motionType === 'hide' && this._isAnimated());
374
383
  if (!this._isExpandControlled()) {
375
- const flattenNodes = flattenTreeData(treeData, expandedKeys, isSearching && showFilteredOnly && filteredShownKeys);
384
+ const flattenNodes = flattenTreeData(treeData, expandedKeys, keyMaps, isSearching && showFilteredOnly && filteredShownKeys);
376
385
  const motionKeys = this._isAnimated() ? getMotionKeys(eventKey, expandedKeys, keyEntities) : [];
377
386
  const newState = {
378
387
  [expandedStateKey]: expandedKeys,
@@ -14,6 +14,15 @@ export interface NodeData {
14
14
  value: any;
15
15
  children?: any;
16
16
  }
17
+ export interface KeyMapProps {
18
+ key?: string;
19
+ label?: string;
20
+ value?: string;
21
+ disabled?: string;
22
+ children?: string;
23
+ isLeaf?: string;
24
+ icon?: string;
25
+ }
17
26
  /**
18
27
  * Flat nest tree data into flatten list. This is used for virtual list render.
19
28
  * @param treeNodeList Origin data node list
@@ -21,13 +30,13 @@ export interface NodeData {
21
30
  * @param filteredShownKeys
22
31
  * need expanded keys, provides `true` means all expanded
23
32
  */
24
- export declare function flattenTreeData(treeNodeList: any[], expandedKeys: Set<string>, filteredShownKeys?: boolean | Set<any>): any[];
33
+ export declare function flattenTreeData(treeNodeList: any[], expandedKeys: Set<string>, keyMaps: KeyMapProps, filteredShownKeys?: boolean | Set<any>): any[];
25
34
  export declare function convertJsonToData(treeJson: TreeDataSimpleJson): any[];
26
35
  /**
27
36
  * Traverse all the data by `treeData`.
28
37
  */
29
- export declare function traverseDataNodes(treeNodes: any[], callback: (data: any) => void): void;
30
- export declare function convertDataToEntities(dataNodes: any[]): {
38
+ export declare function traverseDataNodes(treeNodes: any[], callback: (data: any) => void, keyMaps: KeyMapProps): void;
39
+ export declare function convertDataToEntities(dataNodes: any[], keyMaps?: KeyMapProps): {
31
40
  posEntities: {};
32
41
  keyEntities: {};
33
42
  valueEntities: {};
@@ -71,10 +80,10 @@ export declare function filterTreeData(info: any): {
71
80
  filteredExpandedKeys: Set<any>;
72
81
  filteredShownKeys: Set<any>;
73
82
  };
74
- export declare function getValueOrKey(data: any): any;
75
- export declare function normalizeValue(value: any, withObject: boolean): any;
83
+ export declare function getValueOrKey(data: any, keyMaps?: KeyMapProps): any;
84
+ export declare function normalizeValue(value: any, withObject: boolean, keyMaps?: KeyMapProps): any;
76
85
  export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
77
- export declare function calcDisabledKeys(keyEntities: KeyEntities): Set<string>;
86
+ export declare function calcDisabledKeys(keyEntities: KeyEntities, keyMaps?: KeyMapProps): Set<string>;
78
87
  export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
79
88
  export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
80
89
  export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;