@douyinfe/semi-foundation 2.4.1 → 2.6.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.
- package/button/button.scss +11 -0
- package/button/variables.scss +4 -0
- package/cascader/cascader.scss +3 -2
- package/cascader/foundation.ts +19 -0
- package/cascader/variables.scss +6 -3
- package/datePicker/foundation.ts +16 -4
- package/datePicker/inputFoundation.ts +0 -1
- package/datePicker/monthFoundation.ts +1 -0
- package/form/form.scss +7 -1
- package/form/foundation.ts +40 -36
- package/form/interface.ts +1 -1
- package/input/input.scss +2 -1
- package/lib/cjs/autoComplete/constants.d.ts +1 -1
- package/lib/cjs/button/button.css +9 -0
- package/lib/cjs/button/button.scss +11 -0
- package/lib/cjs/button/variables.scss +4 -0
- package/lib/cjs/cascader/cascader.css +2 -1
- package/lib/cjs/cascader/cascader.scss +3 -2
- package/lib/cjs/cascader/foundation.d.ts +19 -0
- package/lib/cjs/cascader/foundation.js +22 -0
- package/lib/cjs/cascader/variables.scss +6 -3
- package/lib/cjs/datePicker/foundation.d.ts +9 -4
- package/lib/cjs/datePicker/foundation.js +18 -0
- package/lib/cjs/datePicker/inputFoundation.d.ts +0 -1
- package/lib/cjs/datePicker/monthFoundation.d.ts +1 -0
- package/lib/cjs/dropdown/constants.d.ts +1 -1
- package/lib/cjs/form/form.css +4 -0
- package/lib/cjs/form/form.scss +7 -1
- package/lib/cjs/form/foundation.d.ts +6 -6
- package/lib/cjs/form/foundation.js +51 -52
- package/lib/cjs/form/interface.d.ts +1 -1
- package/lib/cjs/input/input.css +1 -0
- package/lib/cjs/input/input.scss +2 -1
- package/lib/cjs/select/constants.d.ts +1 -1
- package/lib/cjs/select/foundation.d.ts +1 -1
- package/lib/cjs/select/foundation.js +2 -1
- package/lib/cjs/select/optionFoundation.d.ts +1 -1
- package/lib/cjs/select/optionFoundation.js +3 -3
- package/lib/cjs/slider/foundation.js +2 -2
- package/lib/cjs/table/foundation.d.ts +2 -0
- package/lib/cjs/table/foundation.js +16 -4
- package/lib/cjs/table/table.css +1 -2
- package/lib/cjs/table/table.scss +4 -5
- package/lib/cjs/table/utils.js +4 -1
- package/lib/cjs/table/variables.scss +1 -0
- package/lib/cjs/tooltip/constants.d.ts +1 -1
- package/lib/cjs/tooltip/constants.js +1 -1
- package/lib/cjs/tooltip/foundation.js +65 -4
- package/lib/cjs/tree/foundation.d.ts +4 -1
- package/lib/cjs/tree/foundation.js +69 -20
- package/lib/cjs/treeSelect/foundation.d.ts +3 -3
- package/lib/cjs/treeSelect/foundation.js +103 -35
- package/lib/cjs/upload/upload.css +49 -27
- package/lib/cjs/upload/upload.scss +66 -41
- package/lib/cjs/upload/variables.scss +3 -1
- package/lib/es/autoComplete/constants.d.ts +1 -1
- package/lib/es/button/button.css +9 -0
- package/lib/es/button/button.scss +11 -0
- package/lib/es/button/variables.scss +4 -0
- package/lib/es/cascader/cascader.css +2 -1
- package/lib/es/cascader/cascader.scss +3 -2
- package/lib/es/cascader/foundation.d.ts +19 -0
- package/lib/es/cascader/foundation.js +22 -1
- package/lib/es/cascader/variables.scss +6 -3
- package/lib/es/datePicker/foundation.d.ts +9 -4
- package/lib/es/datePicker/foundation.js +18 -0
- package/lib/es/datePicker/inputFoundation.d.ts +0 -1
- package/lib/es/datePicker/monthFoundation.d.ts +1 -0
- package/lib/es/dropdown/constants.d.ts +1 -1
- package/lib/es/form/form.css +4 -0
- package/lib/es/form/form.scss +7 -1
- package/lib/es/form/foundation.d.ts +6 -6
- package/lib/es/form/foundation.js +51 -52
- package/lib/es/form/interface.d.ts +1 -1
- package/lib/es/input/input.css +1 -0
- package/lib/es/input/input.scss +2 -1
- package/lib/es/select/constants.d.ts +1 -1
- package/lib/es/select/foundation.d.ts +1 -1
- package/lib/es/select/foundation.js +2 -1
- package/lib/es/select/optionFoundation.d.ts +1 -1
- package/lib/es/select/optionFoundation.js +3 -3
- package/lib/es/slider/foundation.js +2 -2
- package/lib/es/table/foundation.d.ts +2 -0
- package/lib/es/table/foundation.js +16 -4
- package/lib/es/table/table.css +1 -2
- package/lib/es/table/table.scss +4 -5
- package/lib/es/table/utils.js +4 -1
- package/lib/es/table/variables.scss +1 -0
- package/lib/es/tooltip/constants.d.ts +1 -1
- package/lib/es/tooltip/constants.js +1 -1
- package/lib/es/tooltip/foundation.js +65 -4
- package/lib/es/tree/foundation.d.ts +4 -1
- package/lib/es/tree/foundation.js +69 -20
- package/lib/es/treeSelect/foundation.d.ts +3 -3
- package/lib/es/treeSelect/foundation.js +102 -35
- package/lib/es/upload/upload.css +49 -27
- package/lib/es/upload/upload.scss +66 -41
- package/lib/es/upload/variables.scss +3 -1
- package/package.json +3 -3
- package/select/foundation.ts +3 -2
- package/select/optionFoundation.ts +3 -3
- package/slider/foundation.ts +2 -2
- package/table/foundation.ts +23 -10
- package/table/table.scss +4 -5
- package/table/utils.ts +3 -1
- package/table/variables.scss +1 -0
- package/tooltip/constants.ts +2 -0
- package/tooltip/foundation.ts +52 -4
- package/tree/foundation.ts +56 -17
- package/treeSelect/foundation.ts +89 -41
- package/upload/upload.scss +66 -41
- package/upload/variables.scss +3 -1
package/button/button.scss
CHANGED
|
@@ -23,6 +23,11 @@ $module: #{$prefix}-button;
|
|
|
23
23
|
outline: none;
|
|
24
24
|
vertical-align: middle;
|
|
25
25
|
white-space: nowrap;
|
|
26
|
+
|
|
27
|
+
&:focus {
|
|
28
|
+
outline: $width-button-outline solid $color-button_primary-outline-focus;
|
|
29
|
+
}
|
|
30
|
+
|
|
26
31
|
&-danger {
|
|
27
32
|
background-color: $color-button_danger-bg-default;
|
|
28
33
|
color: $color-button_danger-text-default;
|
|
@@ -36,6 +41,9 @@ $module: #{$prefix}-button;
|
|
|
36
41
|
&.#{$module}-borderless {
|
|
37
42
|
color: $color-button_danger-bg-default;
|
|
38
43
|
}
|
|
44
|
+
&:not(.#{$module}-borderless):not(.#{$module}-light):focus {
|
|
45
|
+
outline-color: $color-button_danger-outline-focus;
|
|
46
|
+
}
|
|
39
47
|
}
|
|
40
48
|
&-warning {
|
|
41
49
|
background-color: $color-button_warning-bg-default;
|
|
@@ -50,6 +58,9 @@ $module: #{$prefix}-button;
|
|
|
50
58
|
&.#{$module}-borderless {
|
|
51
59
|
color: $color-button_warning-bg-default;
|
|
52
60
|
}
|
|
61
|
+
&:not(.#{$module}-borderless):not(.#{$module}-light):focus {
|
|
62
|
+
outline-color: $color-button_warning-outline-focus;
|
|
63
|
+
}
|
|
53
64
|
}
|
|
54
65
|
&-tertiary {
|
|
55
66
|
background-color: $color-button_tertiary-bg-default;
|
package/button/variables.scss
CHANGED
|
@@ -10,6 +10,7 @@ $color-button_primary-text-hover: white; // 主要按钮文字颜色 - 悬浮
|
|
|
10
10
|
$color-button_primary-bg-active: var(--semi-color-primary-active); // 主要按钮背景颜色 - 按下
|
|
11
11
|
$color-button_primary-border-active: var(--semi-color-primary-active); // 主要按钮描边颜色 - 按下
|
|
12
12
|
$color-button_primary-text-active: white; // 主要按钮文字颜色 - 按下
|
|
13
|
+
$color-button_primary-outline-focus: var(--semi-color-primary-light-active); // 主要按钮轮廓 - 聚焦
|
|
13
14
|
|
|
14
15
|
// secondary
|
|
15
16
|
$color-button_secondary-bg-default: var(--semi-color-secondary); // 次要按钮背景颜色
|
|
@@ -36,6 +37,7 @@ $color-button_danger-text-hover: white; // 危险按钮文字颜色 - 悬浮
|
|
|
36
37
|
$color-button_danger-bg-active: var(--semi-color-danger-active); // 危险按钮背景颜色 - 按下
|
|
37
38
|
$color-button_danger-border-active: var(--semi-color-danger-active); // 危险按钮描边颜色 - 按下
|
|
38
39
|
$color-button_danger-text-active: white; // 危险按钮文字颜色 - 按下
|
|
40
|
+
$color-button_danger-outline-focus: var(--semi-color-danger-light-active); // 危险按钮轮廓 - 聚焦
|
|
39
41
|
|
|
40
42
|
// warning
|
|
41
43
|
$color-button_warning-bg-default: var(--semi-color-warning); // 警告按钮背景颜色
|
|
@@ -49,6 +51,7 @@ $color-button_warning-text-hover: white; // 警告按钮文字颜色 - 悬浮
|
|
|
49
51
|
$color-button_warning-bg-active: var(--semi-color-warning-active); // 警告按钮背景颜色 - 按下
|
|
50
52
|
$color-button_warning-border-active: var(--semi-color-warning-active); // 警告按钮描边颜色 - 按下
|
|
51
53
|
$color-button_warning-text-active: white; // 警告按钮文字颜色 - 按下
|
|
54
|
+
$color-button_warning-outline-focus: var(--semi-color-warning-light-active); // 警告按钮轮廓 - 聚焦
|
|
52
55
|
|
|
53
56
|
// tertiary
|
|
54
57
|
$color-button_tertiary-bg-default: var(--semi-color-tertiary); // 第三按钮背景颜色
|
|
@@ -134,3 +137,4 @@ $height-button_default: $height-control-default; // 按钮高度 - 默认
|
|
|
134
137
|
$width-button-border: $border-thickness; // 按钮描边宽度
|
|
135
138
|
$radius-button: var(--semi-border-radius-small); // 按钮圆角大小
|
|
136
139
|
$radius-button_group: $radius-button; // 按钮组圆角大小
|
|
140
|
+
$width-button-outline: 2px; // 按钮轮廓宽度
|
package/cascader/cascader.scss
CHANGED
|
@@ -20,6 +20,7 @@ $module: #{$prefix}-cascader;
|
|
|
20
20
|
|
|
21
21
|
&:hover {
|
|
22
22
|
background-color: $color-cascader_default-bg-hover;
|
|
23
|
+
border: $width-cascader_hover-border $color-cascader_default-border-hover solid;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
&-small {
|
|
@@ -110,7 +111,7 @@ $module: #{$prefix}-cascader;
|
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
&-tag {
|
|
113
|
-
margin: $spacing-cascader_selection_tag-marginY $spacing-cascader_selection_tag-
|
|
114
|
+
margin: $spacing-cascader_selection_tag-marginY $spacing-cascader_selection_tag-marginRight $spacing-cascader_selection_tag-marginY $spacing-cascader_selection_tag-marginLeft;
|
|
114
115
|
|
|
115
116
|
&:first-child {
|
|
116
117
|
margin-left: 0;
|
|
@@ -119,7 +120,7 @@ $module: #{$prefix}-cascader;
|
|
|
119
120
|
&-disabled.#{$prefix}-tag {
|
|
120
121
|
color: $color-cascader_input_disabled-text-default;
|
|
121
122
|
cursor: not-allowed;
|
|
122
|
-
|
|
123
|
+
|
|
123
124
|
.#{$prefix}-tag-close {
|
|
124
125
|
color: $color-cascader_input_disabled-text-default;
|
|
125
126
|
cursor: not-allowed;
|
package/cascader/foundation.ts
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
calcMergeType
|
|
19
19
|
} from './util';
|
|
20
20
|
import { strings } from './constants';
|
|
21
|
+
import isEnterPress from '../utils/isEnterPress';
|
|
21
22
|
|
|
22
23
|
export interface BasicData {
|
|
23
24
|
data: BasicCascaderData;
|
|
@@ -602,6 +603,15 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
|
|
|
602
603
|
}
|
|
603
604
|
}
|
|
604
605
|
|
|
606
|
+
/**
|
|
607
|
+
* A11y: simulate selection click
|
|
608
|
+
*/
|
|
609
|
+
handleSelectionEnterPress(keyboardEvent: any) {
|
|
610
|
+
if (isEnterPress(keyboardEvent)) {
|
|
611
|
+
this.handleClick(keyboardEvent);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
605
615
|
toggleHoverState(bool: boolean) {
|
|
606
616
|
this._adapter.toggleHovering(bool);
|
|
607
617
|
}
|
|
@@ -911,6 +921,15 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
|
|
|
911
921
|
this._adapter.rePositionDropdown();
|
|
912
922
|
}
|
|
913
923
|
|
|
924
|
+
/**
|
|
925
|
+
* A11y: simulate clear button click
|
|
926
|
+
*/
|
|
927
|
+
handleClearEnterPress(keyboardEvent: any) {
|
|
928
|
+
if (isEnterPress(keyboardEvent)) {
|
|
929
|
+
this.handleClear();
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
|
|
914
933
|
getRenderData() {
|
|
915
934
|
const { keyEntities, isSearching } = this.getStates();
|
|
916
935
|
const isFilterable = this._isFilterable();
|
package/cascader/variables.scss
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
$radius-cascader: var(--semi-border-radius-small); // 级联选择菜单圆角
|
|
2
2
|
|
|
3
|
-
$color-cascader_default-border-default: transparent; // 级联选择描边颜色
|
|
3
|
+
$color-cascader_default-border-default: transparent; // 级联选择描边颜色 - 默认
|
|
4
|
+
$color-cascader_default-border-hover: transparent; // 级联选择描边颜色 - 悬浮
|
|
5
|
+
$color-cascader_default-border-focus: var(--semi-color-focus-border); // 级联选择描边颜色 - 选中
|
|
4
6
|
$color-cascader_default-bg-default: var(--semi-color-fill-0); // 级联选择菜单项背景颜色 - 默认
|
|
5
7
|
$color-cascader_default-bg-hover: var(--semi-color-fill-1); // 级联选择菜单项背景颜色 - 悬浮
|
|
6
|
-
$color-cascader_default-border-focus: var(--semi-color-focus-border); // 级联选择描边颜色 - 选中
|
|
7
8
|
$color-cascader_option_list-border-default: var(--semi-color-fill-0); // 级联选择各级菜单分割线颜色
|
|
8
9
|
$color-cascader_option_main-text-default: var(--semi-color-text-0); // 级联选择菜单项文字颜色
|
|
9
10
|
$color-cascader_option-bg-hover: var(--semi-color-fill-0); // 级联选择菜单项背景颜色 - 悬浮
|
|
@@ -43,7 +44,8 @@ $spacing-cascader_selection-paddingLeft: 12px; // 级联选择触发器左侧内
|
|
|
43
44
|
$spacing-cascader_selection-paddingRight: 12px; // 级联选择触发器右侧内边距
|
|
44
45
|
$spacing-cascader_selection_multiple-paddingLeft: $spacing-extra-tight; // 级联选择触发器多选时左侧内边距
|
|
45
46
|
$spacing-cascader_selection_multiple-paddingRight: $spacing-extra-tight; // 级联选择触发器多选时右侧内边距
|
|
46
|
-
$spacing-cascader_selection_tag-
|
|
47
|
+
$spacing-cascader_selection_tag-marginLeft: $spacing-none; // 级联选择触发器多选时标签的水平左外边距
|
|
48
|
+
$spacing-cascader_selection_tag-marginRight: $spacing-super-tight; // 级联选择触发器多选时标签的水平右外边距
|
|
47
49
|
$spacing-cascader_selection_tag-marginY: 1px; // 级联选择触发器多选时标签的垂直外边距
|
|
48
50
|
$spacing-cascader_selection_tagInput-marginLeft: - $spacing-extra-tight; // 级联选择触发器多选搜索时 TagInput 的左外边距
|
|
49
51
|
$spacing-cascader_selection_input-marginLeft: $spacing-extra-tight; // 级联选择触发器多选搜索时输入框的左外边距
|
|
@@ -83,6 +85,7 @@ $width-cascader: 80px; // 级联选择触发器最小宽度
|
|
|
83
85
|
$height-cascader_default: $height-control-default; // 级联选择触发器高度 - 默认
|
|
84
86
|
$height-cascader_small: $height-control-small; // 级联选择触发器高度 - 小尺寸
|
|
85
87
|
$height-cascader_large: $height-control-large; // 级联选择触发器高度 - 大尺寸
|
|
88
|
+
$width-cascader_hover-border: $width-cascader-border; // 级联选择触发器描边宽度 - 悬浮
|
|
86
89
|
$width-cascader_focus-border: $border-thickness-control-focus; // 级联选择触发器描边宽度 - 选中态
|
|
87
90
|
$width-cascader_search-border: 1px; // 级联选择触搜索描边宽度
|
|
88
91
|
$width-cascader-icon: 16px; // 级联选择图标尺寸
|
package/datePicker/foundation.ts
CHANGED
|
@@ -163,8 +163,8 @@ export interface DatePickerFoundationState {
|
|
|
163
163
|
panelShow: boolean;
|
|
164
164
|
isRange: boolean;
|
|
165
165
|
inputValue: string;
|
|
166
|
-
value:
|
|
167
|
-
cachedSelectedValue:
|
|
166
|
+
value: Date[];
|
|
167
|
+
cachedSelectedValue: Date[];
|
|
168
168
|
prevTimeZone: string | number;
|
|
169
169
|
motionEnd: boolean;
|
|
170
170
|
rangeInputFocus: 'rangeStart' | 'rangeEnd' | boolean;
|
|
@@ -185,9 +185,9 @@ export interface DatePickerAdapter extends DefaultAdapter<DatePickerFoundationPr
|
|
|
185
185
|
notifyConfirm: DatePickerFoundationProps['onConfirm'];
|
|
186
186
|
notifyOpenChange: DatePickerFoundationProps['onOpenChange'];
|
|
187
187
|
notifyPresetsClick: DatePickerFoundationProps['onPresetClick'];
|
|
188
|
-
updateValue: (value:
|
|
188
|
+
updateValue: (value: Date[]) => void;
|
|
189
189
|
updatePrevTimezone: (prevTimeZone: string | number) => void;
|
|
190
|
-
updateCachedSelectedValue: (cachedSelectedValue:
|
|
190
|
+
updateCachedSelectedValue: (cachedSelectedValue: Date[]) => void;
|
|
191
191
|
updateInputValue: (inputValue: string) => void;
|
|
192
192
|
needConfirm: () => boolean;
|
|
193
193
|
typeIsYearOrMonth: () => boolean;
|
|
@@ -384,6 +384,18 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
384
384
|
this._adapter.notifyBlur(e);
|
|
385
385
|
}
|
|
386
386
|
|
|
387
|
+
/**
|
|
388
|
+
* clear range input focus when open is controlled
|
|
389
|
+
* fixed github 1375
|
|
390
|
+
*/
|
|
391
|
+
clearRangeInputFocus = () => {
|
|
392
|
+
const { type } = this._adapter.getProps();
|
|
393
|
+
const { rangeInputFocus } = this._adapter.getStates();
|
|
394
|
+
if (type === 'dateTimeRange' && rangeInputFocus) {
|
|
395
|
+
this._adapter.setRangeInputFocus(false);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
387
399
|
/**
|
|
388
400
|
* Callback when the content of the input box changes
|
|
389
401
|
* Update the date panel if the changed value is a legal date, otherwise only update the input box
|
package/form/form.scss
CHANGED
|
@@ -8,6 +8,8 @@ $col: #{$form}-col;
|
|
|
8
8
|
|
|
9
9
|
$checkboxGroup: #{$prefix}-checkboxGroup;
|
|
10
10
|
$radioGroup: #{$prefix}-radioGroup;
|
|
11
|
+
$buttonRadioGroup: #{$prefix}-radioGroup-buttonRadio;
|
|
12
|
+
|
|
11
13
|
$switch: #{$prefix}-switch;
|
|
12
14
|
$rating: #{$prefix}-rating;
|
|
13
15
|
|
|
@@ -154,7 +156,6 @@ $rating: #{$prefix}-rating;
|
|
|
154
156
|
padding-top: $spacing-form_label_posTop-paddingTop;
|
|
155
157
|
padding-bottom: $spacing-form_label_posTop-paddingBottom;
|
|
156
158
|
}
|
|
157
|
-
|
|
158
159
|
}
|
|
159
160
|
|
|
160
161
|
&[x-label-pos="left"] {
|
|
@@ -173,6 +174,11 @@ $rating: #{$prefix}-rating;
|
|
|
173
174
|
padding-top: $spacing-form_label-paddingTop;
|
|
174
175
|
padding-bottom: $spacing-form_label-paddingTop;
|
|
175
176
|
}
|
|
177
|
+
// no need to adjust height for button radio, already 32px
|
|
178
|
+
.#{$buttonRadioGroup} {
|
|
179
|
+
padding-top: 0;
|
|
180
|
+
padding-bottom: 0;
|
|
181
|
+
}
|
|
176
182
|
.#{$switch},
|
|
177
183
|
.#{$rating} {
|
|
178
184
|
vertical-align: middle;
|
package/form/foundation.ts
CHANGED
|
@@ -410,7 +410,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
410
410
|
}
|
|
411
411
|
|
|
412
412
|
// update formState value
|
|
413
|
-
updateStateValue(field: string, value: any, opts: CallOpts): void {
|
|
413
|
+
updateStateValue(field: string, value: any, opts: CallOpts, callback?: () => void): void {
|
|
414
414
|
const notNotify = opts && opts.notNotify;
|
|
415
415
|
const notUpdate = opts && opts.notUpdate;
|
|
416
416
|
const fieldAllowEmpty = opts && opts.fieldAllowEmpty;
|
|
@@ -442,7 +442,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
if (!notUpdate) {
|
|
445
|
-
this._adapter.forceUpdate();
|
|
445
|
+
this._adapter.forceUpdate(callback);
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
|
|
@@ -455,7 +455,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
455
455
|
}
|
|
456
456
|
|
|
457
457
|
// update formState touched
|
|
458
|
-
updateStateTouched(field: string, isTouched: boolean, opts?: CallOpts): void {
|
|
458
|
+
updateStateTouched(field: string, isTouched: boolean, opts?: CallOpts, callback?: () => void): void {
|
|
459
459
|
const notNotify = opts && opts.notNotify;
|
|
460
460
|
const notUpdate = opts && opts.notUpdate;
|
|
461
461
|
ObjectUtil.set(this.data.touched, field, isTouched);
|
|
@@ -464,7 +464,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
464
464
|
this._adapter.notifyChange(this.data);
|
|
465
465
|
}
|
|
466
466
|
if (!notUpdate) {
|
|
467
|
-
this._adapter.forceUpdate();
|
|
467
|
+
this._adapter.forceUpdate(callback);
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
470
|
|
|
@@ -477,7 +477,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
477
477
|
}
|
|
478
478
|
|
|
479
479
|
// update formState error
|
|
480
|
-
updateStateError(field: string, error: any, opts: CallOpts): void {
|
|
480
|
+
updateStateError(field: string, error: any, opts: CallOpts, callback?: () => void): void {
|
|
481
481
|
const notNotify = opts && opts.notNotify;
|
|
482
482
|
const notUpdate = opts && opts.notUpdate;
|
|
483
483
|
ObjectUtil.set(this.data.errors, field, error);
|
|
@@ -488,7 +488,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
488
488
|
}
|
|
489
489
|
|
|
490
490
|
if (!notUpdate) {
|
|
491
|
-
this._adapter.forceUpdate();
|
|
491
|
+
this._adapter.forceUpdate(callback);
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
494
|
|
|
@@ -506,16 +506,18 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
506
506
|
// At this time, first modify formState directly, then find out the subordinate fields and drive them to update
|
|
507
507
|
// Eg: peoples: [0, 2, 3]. Each value of the peoples array corresponds to an Input Field
|
|
508
508
|
// When the user directly calls formA pi.set Value ('peoples', [2,3])
|
|
509
|
-
this.updateStateValue(field, newValue, opts)
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
509
|
+
this.updateStateValue(field, newValue, opts, () => {
|
|
510
|
+
let nestedFields = this._getNestedField(field);
|
|
511
|
+
if (nestedFields.size) {
|
|
512
|
+
nestedFields.forEach(fieldStaff => {
|
|
513
|
+
let fieldPath = fieldStaff.field;
|
|
514
|
+
let newFieldVal = ObjectUtil.get(this.data.values, fieldPath);
|
|
515
|
+
let nestedBatchUpdateOpts = { notNotify: true, notUpdate: true };
|
|
516
|
+
fieldStaff.fieldApi.setValue(newFieldVal, nestedBatchUpdateOpts);
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
|
|
519
521
|
// If the reset happens to be, then update the updateKey corresponding to ArrayField to render it again
|
|
520
522
|
if (this.getArrayField(field)) {
|
|
521
523
|
this.updateArrayField(field, { updateKey: new Date().valueOf() });
|
|
@@ -528,16 +530,17 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
528
530
|
if (fieldApi) {
|
|
529
531
|
fieldApi.setError(newError, opts);
|
|
530
532
|
} else {
|
|
531
|
-
this.updateStateError(field, newError, opts)
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
533
|
+
this.updateStateError(field, newError, opts, () => {
|
|
534
|
+
let nestedFields = this._getNestedField(field);
|
|
535
|
+
if (nestedFields.size) {
|
|
536
|
+
nestedFields.forEach(fieldStaff => {
|
|
537
|
+
let fieldPath = fieldStaff.field;
|
|
538
|
+
let newFieldError = ObjectUtil.get(this.data.errors, fieldPath);
|
|
539
|
+
let nestedBatchUpdateOpts = { notNotify: true, notUpdate: true };
|
|
540
|
+
fieldStaff.fieldApi.setError(newFieldError, nestedBatchUpdateOpts);
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
});
|
|
541
544
|
if (this.getArrayField(field)) {
|
|
542
545
|
this.updateArrayField(field, { updateKey: new Date().valueOf() });
|
|
543
546
|
}
|
|
@@ -549,16 +552,17 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
549
552
|
if (fieldApi) {
|
|
550
553
|
fieldApi.setTouched(isTouched, opts);
|
|
551
554
|
} else {
|
|
552
|
-
this.updateStateTouched(field, isTouched, opts)
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
555
|
+
this.updateStateTouched(field, isTouched, opts, () => {
|
|
556
|
+
let nestedFields = this._getNestedField(field);
|
|
557
|
+
if (nestedFields.size) {
|
|
558
|
+
nestedFields.forEach(fieldStaff => {
|
|
559
|
+
let fieldPath = fieldStaff.field;
|
|
560
|
+
let newFieldTouch = ObjectUtil.get(this.data.touched, fieldPath);
|
|
561
|
+
let nestedBatchUpdateOpts = { notNotify: true, notUpdate: true };
|
|
562
|
+
fieldStaff.fieldApi.setTouched(newFieldTouch, nestedBatchUpdateOpts);
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
});
|
|
562
566
|
if (this.getArrayField(field)) {
|
|
563
567
|
this.updateArrayField(field, { updateKey: new Date().valueOf() });
|
|
564
568
|
}
|
package/form/interface.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface BaseFormAdapter<P = Record<string, any>, S = Record<string, any
|
|
|
12
12
|
cloneDeep: (val: any, ...rest: any[]) => any;
|
|
13
13
|
notifySubmit: (values: any) => void;
|
|
14
14
|
notifySubmitFail: (errors: Record<string, any>, values: any) => void;
|
|
15
|
-
forceUpdate: () => void;
|
|
15
|
+
forceUpdate: (callback?: () => void) => void;
|
|
16
16
|
notifyChange: (formState: FormState) => void;
|
|
17
17
|
notifyValueChange: (values: any, changedValues: any) => void;
|
|
18
18
|
notifyReset: () => void;
|
package/input/input.scss
CHANGED
|
@@ -382,7 +382,8 @@ $module: #{$prefix}-input;
|
|
|
382
382
|
// border: $border-thickness-control $color-input_disabled-border-default solid;
|
|
383
383
|
color: $color-input_disabled-text-default;
|
|
384
384
|
background-color: $color-input_disabled-bg-default;
|
|
385
|
-
|
|
385
|
+
// fix issue 670 in safari
|
|
386
|
+
-webkit-text-fill-color: $color-input_disabled-text-default;
|
|
386
387
|
&:hover {
|
|
387
388
|
background-color: $color-input_disabled-bg-default;
|
|
388
389
|
}
|
|
@@ -3,7 +3,7 @@ declare const cssClasses: {
|
|
|
3
3
|
};
|
|
4
4
|
declare const strings: {
|
|
5
5
|
readonly SIZE: readonly ["small", "large", "default"];
|
|
6
|
-
readonly POSITION: readonly ["top", "topLeft", "topRight", "left", "leftTop", "leftBottom", "right", "rightTop", "rightBottom", "bottom", "bottomLeft", "bottomRight", "leftTopOver", "rightTopOver"];
|
|
6
|
+
readonly POSITION: readonly ["top", "topLeft", "topRight", "left", "leftTop", "leftBottom", "right", "rightTop", "rightBottom", "bottom", "bottomLeft", "bottomRight", "leftTopOver", "rightTopOver", "leftBottomOver", "rightBottomOver"];
|
|
7
7
|
readonly OPTIONS: readonly ["children", "value"];
|
|
8
8
|
readonly STATUS: readonly ["default", "error", "warning", "success"];
|
|
9
9
|
};
|
|
@@ -44,6 +44,9 @@
|
|
|
44
44
|
vertical-align: middle;
|
|
45
45
|
white-space: nowrap;
|
|
46
46
|
}
|
|
47
|
+
.semi-button:focus {
|
|
48
|
+
outline: 2px solid var(--semi-color-primary-light-active);
|
|
49
|
+
}
|
|
47
50
|
.semi-button-danger {
|
|
48
51
|
background-color: var(--semi-color-danger);
|
|
49
52
|
color: white;
|
|
@@ -57,6 +60,9 @@
|
|
|
57
60
|
.semi-button-danger.semi-button-light, .semi-button-danger.semi-button-borderless {
|
|
58
61
|
color: var(--semi-color-danger);
|
|
59
62
|
}
|
|
63
|
+
.semi-button-danger:not(.semi-button-borderless):not(.semi-button-light):focus {
|
|
64
|
+
outline-color: var(--semi-color-danger-light-active);
|
|
65
|
+
}
|
|
60
66
|
.semi-button-warning {
|
|
61
67
|
background-color: var(--semi-color-warning);
|
|
62
68
|
color: white;
|
|
@@ -70,6 +76,9 @@
|
|
|
70
76
|
.semi-button-warning.semi-button-light, .semi-button-warning.semi-button-borderless {
|
|
71
77
|
color: var(--semi-color-warning);
|
|
72
78
|
}
|
|
79
|
+
.semi-button-warning:not(.semi-button-borderless):not(.semi-button-light):focus {
|
|
80
|
+
outline-color: var(--semi-color-warning-light-active);
|
|
81
|
+
}
|
|
73
82
|
.semi-button-tertiary {
|
|
74
83
|
background-color: var(--semi-color-tertiary);
|
|
75
84
|
color: white;
|
|
@@ -23,6 +23,11 @@ $module: #{$prefix}-button;
|
|
|
23
23
|
outline: none;
|
|
24
24
|
vertical-align: middle;
|
|
25
25
|
white-space: nowrap;
|
|
26
|
+
|
|
27
|
+
&:focus {
|
|
28
|
+
outline: $width-button-outline solid $color-button_primary-outline-focus;
|
|
29
|
+
}
|
|
30
|
+
|
|
26
31
|
&-danger {
|
|
27
32
|
background-color: $color-button_danger-bg-default;
|
|
28
33
|
color: $color-button_danger-text-default;
|
|
@@ -36,6 +41,9 @@ $module: #{$prefix}-button;
|
|
|
36
41
|
&.#{$module}-borderless {
|
|
37
42
|
color: $color-button_danger-bg-default;
|
|
38
43
|
}
|
|
44
|
+
&:not(.#{$module}-borderless):not(.#{$module}-light):focus {
|
|
45
|
+
outline-color: $color-button_danger-outline-focus;
|
|
46
|
+
}
|
|
39
47
|
}
|
|
40
48
|
&-warning {
|
|
41
49
|
background-color: $color-button_warning-bg-default;
|
|
@@ -50,6 +58,9 @@ $module: #{$prefix}-button;
|
|
|
50
58
|
&.#{$module}-borderless {
|
|
51
59
|
color: $color-button_warning-bg-default;
|
|
52
60
|
}
|
|
61
|
+
&:not(.#{$module}-borderless):not(.#{$module}-light):focus {
|
|
62
|
+
outline-color: $color-button_warning-outline-focus;
|
|
63
|
+
}
|
|
53
64
|
}
|
|
54
65
|
&-tertiary {
|
|
55
66
|
background-color: $color-button_tertiary-bg-default;
|
|
@@ -10,6 +10,7 @@ $color-button_primary-text-hover: white; // 主要按钮文字颜色 - 悬浮
|
|
|
10
10
|
$color-button_primary-bg-active: var(--semi-color-primary-active); // 主要按钮背景颜色 - 按下
|
|
11
11
|
$color-button_primary-border-active: var(--semi-color-primary-active); // 主要按钮描边颜色 - 按下
|
|
12
12
|
$color-button_primary-text-active: white; // 主要按钮文字颜色 - 按下
|
|
13
|
+
$color-button_primary-outline-focus: var(--semi-color-primary-light-active); // 主要按钮轮廓 - 聚焦
|
|
13
14
|
|
|
14
15
|
// secondary
|
|
15
16
|
$color-button_secondary-bg-default: var(--semi-color-secondary); // 次要按钮背景颜色
|
|
@@ -36,6 +37,7 @@ $color-button_danger-text-hover: white; // 危险按钮文字颜色 - 悬浮
|
|
|
36
37
|
$color-button_danger-bg-active: var(--semi-color-danger-active); // 危险按钮背景颜色 - 按下
|
|
37
38
|
$color-button_danger-border-active: var(--semi-color-danger-active); // 危险按钮描边颜色 - 按下
|
|
38
39
|
$color-button_danger-text-active: white; // 危险按钮文字颜色 - 按下
|
|
40
|
+
$color-button_danger-outline-focus: var(--semi-color-danger-light-active); // 危险按钮轮廓 - 聚焦
|
|
39
41
|
|
|
40
42
|
// warning
|
|
41
43
|
$color-button_warning-bg-default: var(--semi-color-warning); // 警告按钮背景颜色
|
|
@@ -49,6 +51,7 @@ $color-button_warning-text-hover: white; // 警告按钮文字颜色 - 悬浮
|
|
|
49
51
|
$color-button_warning-bg-active: var(--semi-color-warning-active); // 警告按钮背景颜色 - 按下
|
|
50
52
|
$color-button_warning-border-active: var(--semi-color-warning-active); // 警告按钮描边颜色 - 按下
|
|
51
53
|
$color-button_warning-text-active: white; // 警告按钮文字颜色 - 按下
|
|
54
|
+
$color-button_warning-outline-focus: var(--semi-color-warning-light-active); // 警告按钮轮廓 - 聚焦
|
|
52
55
|
|
|
53
56
|
// tertiary
|
|
54
57
|
$color-button_tertiary-bg-default: var(--semi-color-tertiary); // 第三按钮背景颜色
|
|
@@ -134,3 +137,4 @@ $height-button_default: $height-control-default; // 按钮高度 - 默认
|
|
|
134
137
|
$width-button-border: $border-thickness; // 按钮描边宽度
|
|
135
138
|
$radius-button: var(--semi-border-radius-small); // 按钮圆角大小
|
|
136
139
|
$radius-button_group: $radius-button; // 按钮组圆角大小
|
|
140
|
+
$width-button-outline: 2px; // 按钮轮廓宽度
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
}
|
|
20
20
|
.semi-cascader:hover {
|
|
21
21
|
background-color: var(--semi-color-fill-1);
|
|
22
|
+
border: 1px transparent solid;
|
|
22
23
|
}
|
|
23
24
|
.semi-cascader-small {
|
|
24
25
|
min-height: 24px;
|
|
@@ -94,7 +95,7 @@
|
|
|
94
95
|
color: var(--semi-color-text-2);
|
|
95
96
|
}
|
|
96
97
|
.semi-cascader-selection-tag {
|
|
97
|
-
margin: 1px 2px;
|
|
98
|
+
margin: 1px 2px 1px 0;
|
|
98
99
|
}
|
|
99
100
|
.semi-cascader-selection-tag:first-child {
|
|
100
101
|
margin-left: 0;
|
|
@@ -20,6 +20,7 @@ $module: #{$prefix}-cascader;
|
|
|
20
20
|
|
|
21
21
|
&:hover {
|
|
22
22
|
background-color: $color-cascader_default-bg-hover;
|
|
23
|
+
border: $width-cascader_hover-border $color-cascader_default-border-hover solid;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
&-small {
|
|
@@ -110,7 +111,7 @@ $module: #{$prefix}-cascader;
|
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
&-tag {
|
|
113
|
-
margin: $spacing-cascader_selection_tag-marginY $spacing-cascader_selection_tag-
|
|
114
|
+
margin: $spacing-cascader_selection_tag-marginY $spacing-cascader_selection_tag-marginRight $spacing-cascader_selection_tag-marginY $spacing-cascader_selection_tag-marginLeft;
|
|
114
115
|
|
|
115
116
|
&:first-child {
|
|
116
117
|
margin-left: 0;
|
|
@@ -119,7 +120,7 @@ $module: #{$prefix}-cascader;
|
|
|
119
120
|
&-disabled.#{$prefix}-tag {
|
|
120
121
|
color: $color-cascader_input_disabled-text-default;
|
|
121
122
|
cursor: not-allowed;
|
|
122
|
-
|
|
123
|
+
|
|
123
124
|
.#{$prefix}-tag-close {
|
|
124
125
|
color: $color-cascader_input_disabled-text-default;
|
|
125
126
|
cursor: not-allowed;
|
|
@@ -193,6 +193,10 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
|
|
|
193
193
|
handleShowNextByHover(item: BasicEntity): void;
|
|
194
194
|
onItemCheckboxClick(item: BasicEntity | BasicData): void;
|
|
195
195
|
handleClick(e: any): void;
|
|
196
|
+
/**
|
|
197
|
+
* A11y: simulate selection click
|
|
198
|
+
*/
|
|
199
|
+
handleSelectionEnterPress(keyboardEvent: any): void;
|
|
196
200
|
toggleHoverState(bool: boolean): void;
|
|
197
201
|
_defaultRenderText(path: any[], displayRender?: BasicCascaderProps['displayRender']): any;
|
|
198
202
|
renderDisplayText(targetKey: string, keyEntities?: BasicEntities): any;
|
|
@@ -201,6 +205,17 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
|
|
|
201
205
|
handleSingleSelect(e: any, item: BasicEntity | BasicData): void;
|
|
202
206
|
_handleMultipleSelect(item: BasicEntity | BasicData): void;
|
|
203
207
|
calcNonDisabedCheckedKeys(eventKey: string, targetStatus: boolean): {
|
|
208
|
+
/**
|
|
209
|
+
* The typical scenario is: suppose we select the 0-0 node, at this time
|
|
210
|
+
* selectedKeys=Set('0-0'), the input box will display a 0-0 label. When
|
|
211
|
+
* treeData is updated, assuming 0-0 does not exist in treeData at this
|
|
212
|
+
* time, then selectedKeys=Set('not-exist-0-0'), at this time the input
|
|
213
|
+
* box displays 0-0, which means not-exist -After the content. When treeData
|
|
214
|
+
* is updated again, assuming that 0-0 exists in treeData at this time,
|
|
215
|
+
* then selectedKeys=Set('0-0'), and the input box displays a label of
|
|
216
|
+
* 0-0 at this time. The operation done here is for the 0-0 label to be
|
|
217
|
+
* displayed normally after the second update in the example.
|
|
218
|
+
*/
|
|
204
219
|
checkedKeys: Set<string>;
|
|
205
220
|
halfCheckedKeys: Set<any>;
|
|
206
221
|
};
|
|
@@ -217,6 +232,10 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
|
|
|
217
232
|
};
|
|
218
233
|
handleInputChange(sugInput: string): void;
|
|
219
234
|
handleClear(): void;
|
|
235
|
+
/**
|
|
236
|
+
* A11y: simulate clear button click
|
|
237
|
+
*/
|
|
238
|
+
handleClearEnterPress(keyboardEvent: any): void;
|
|
220
239
|
getRenderData(): BasicEntity[] | BasicData[];
|
|
221
240
|
getFilteredData(): BasicData[];
|
|
222
241
|
handleListScroll(e: any, ind: number): void;
|
|
@@ -64,6 +64,8 @@ var _util = require("./util");
|
|
|
64
64
|
|
|
65
65
|
var _constants = require("./constants");
|
|
66
66
|
|
|
67
|
+
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
68
|
+
|
|
67
69
|
// eslint-disable-next-line max-len
|
|
68
70
|
class CascaderFoundation extends _foundation.default {
|
|
69
71
|
constructor(adapter) {
|
|
@@ -564,6 +566,16 @@ class CascaderFoundation extends _foundation.default {
|
|
|
564
566
|
this.close(e);
|
|
565
567
|
}
|
|
566
568
|
}
|
|
569
|
+
/**
|
|
570
|
+
* A11y: simulate selection click
|
|
571
|
+
*/
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
handleSelectionEnterPress(keyboardEvent) {
|
|
575
|
+
if ((0, _isEnterPress.default)(keyboardEvent)) {
|
|
576
|
+
this.handleClick(keyboardEvent);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
567
579
|
|
|
568
580
|
toggleHoverState(bool) {
|
|
569
581
|
this._adapter.toggleHovering(bool);
|
|
@@ -986,6 +998,16 @@ class CascaderFoundation extends _foundation.default {
|
|
|
986
998
|
|
|
987
999
|
this._adapter.rePositionDropdown();
|
|
988
1000
|
}
|
|
1001
|
+
/**
|
|
1002
|
+
* A11y: simulate clear button click
|
|
1003
|
+
*/
|
|
1004
|
+
|
|
1005
|
+
|
|
1006
|
+
handleClearEnterPress(keyboardEvent) {
|
|
1007
|
+
if ((0, _isEnterPress.default)(keyboardEvent)) {
|
|
1008
|
+
this.handleClear();
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
989
1011
|
|
|
990
1012
|
getRenderData() {
|
|
991
1013
|
var _context9, _context10;
|