@douyinfe/semi-foundation 2.5.0 → 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 +2 -2
- package/cascader/foundation.ts +19 -0
- package/cascader/variables.scss +2 -1
- package/datePicker/foundation.ts +4 -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/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 +1 -1
- package/lib/cjs/cascader/cascader.scss +2 -2
- package/lib/cjs/cascader/foundation.d.ts +19 -0
- package/lib/cjs/cascader/foundation.js +22 -0
- package/lib/cjs/cascader/variables.scss +2 -1
- package/lib/cjs/datePicker/foundation.d.ts +4 -4
- package/lib/cjs/datePicker/inputFoundation.d.ts +0 -1
- package/lib/cjs/datePicker/monthFoundation.d.ts +1 -0
- 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/table/table.css +1 -2
- package/lib/cjs/table/table.scss +4 -5
- package/lib/cjs/table/variables.scss +1 -0
- 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 +1 -1
- package/lib/es/cascader/cascader.scss +2 -2
- package/lib/es/cascader/foundation.d.ts +19 -0
- package/lib/es/cascader/foundation.js +22 -1
- package/lib/es/cascader/variables.scss +2 -1
- package/lib/es/datePicker/foundation.d.ts +4 -4
- package/lib/es/datePicker/inputFoundation.d.ts +0 -1
- package/lib/es/datePicker/monthFoundation.d.ts +1 -0
- 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/table/table.css +1 -2
- package/lib/es/table/table.scss +4 -5
- package/lib/es/table/variables.scss +1 -0
- package/package.json +3 -3
- package/table/table.scss +4 -5
- package/table/variables.scss +1 -0
package/lib/cjs/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;
|
|
@@ -41,11 +41,11 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
41
41
|
setValues(values: any, { isOverride }: {
|
|
42
42
|
isOverride?: boolean;
|
|
43
43
|
}): void;
|
|
44
|
-
updateStateValue(field: string, value: any, opts: CallOpts): void;
|
|
44
|
+
updateStateValue(field: string, value: any, opts: CallOpts, callback?: () => void): void;
|
|
45
45
|
getTouched(field?: string): boolean | Record<string, any> | undefined;
|
|
46
|
-
updateStateTouched(field: string, isTouched: boolean, opts?: CallOpts): void;
|
|
46
|
+
updateStateTouched(field: string, isTouched: boolean, opts?: CallOpts, callback?: () => void): void;
|
|
47
47
|
getError(field?: string): any;
|
|
48
|
-
updateStateError(field: string, error: any, opts: CallOpts): void;
|
|
48
|
+
updateStateError(field: string, error: any, opts: CallOpts, callback?: () => void): void;
|
|
49
49
|
getFieldSetterApi(): {
|
|
50
50
|
setValue: (field: string, value: any, opts: CallOpts) => void;
|
|
51
51
|
setError: (field: string, error: any, opts: CallOpts) => void;
|
|
@@ -54,9 +54,9 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
54
54
|
getModifyFormStateApi(): {
|
|
55
55
|
register: (field: string, fieldState: FieldState, fieldStuff: FieldStaff) => void;
|
|
56
56
|
unRegister: (field: string) => void;
|
|
57
|
-
updateStateValue: (field: string, value: any, opts: CallOpts) => void;
|
|
58
|
-
updateStateError: (field: string, error: any, opts: CallOpts) => void;
|
|
59
|
-
updateStateTouched: (field: string, isTouched: boolean, opts?: CallOpts) => void;
|
|
57
|
+
updateStateValue: (field: string, value: any, opts: CallOpts, callback?: () => void) => void;
|
|
58
|
+
updateStateError: (field: string, error: any, opts: CallOpts, callback?: () => void) => void;
|
|
59
|
+
updateStateTouched: (field: string, isTouched: boolean, opts?: CallOpts, callback?: () => void) => void;
|
|
60
60
|
getValue: (field: string, opts?: CallOpts) => any;
|
|
61
61
|
getError: (field?: string) => any;
|
|
62
62
|
getTouched: (field?: string) => boolean | Record<string, any>;
|
|
@@ -514,7 +514,7 @@ class FormFoundation extends _foundation.default {
|
|
|
514
514
|
} // update formState value
|
|
515
515
|
|
|
516
516
|
|
|
517
|
-
updateStateValue(field, value, opts) {
|
|
517
|
+
updateStateValue(field, value, opts, callback) {
|
|
518
518
|
const notNotify = opts && opts.notNotify;
|
|
519
519
|
const notUpdate = opts && opts.notUpdate;
|
|
520
520
|
const fieldAllowEmpty = opts && opts.fieldAllowEmpty;
|
|
@@ -546,7 +546,7 @@ class FormFoundation extends _foundation.default {
|
|
|
546
546
|
}
|
|
547
547
|
|
|
548
548
|
if (!notUpdate) {
|
|
549
|
-
this._adapter.forceUpdate();
|
|
549
|
+
this._adapter.forceUpdate(callback);
|
|
550
550
|
}
|
|
551
551
|
} // get touched from formState
|
|
552
552
|
|
|
@@ -560,7 +560,7 @@ class FormFoundation extends _foundation.default {
|
|
|
560
560
|
} // update formState touched
|
|
561
561
|
|
|
562
562
|
|
|
563
|
-
updateStateTouched(field, isTouched, opts) {
|
|
563
|
+
updateStateTouched(field, isTouched, opts, callback) {
|
|
564
564
|
const notNotify = opts && opts.notNotify;
|
|
565
565
|
const notUpdate = opts && opts.notUpdate;
|
|
566
566
|
ObjectUtil.set(this.data.touched, field, isTouched);
|
|
@@ -570,7 +570,7 @@ class FormFoundation extends _foundation.default {
|
|
|
570
570
|
}
|
|
571
571
|
|
|
572
572
|
if (!notUpdate) {
|
|
573
|
-
this._adapter.forceUpdate();
|
|
573
|
+
this._adapter.forceUpdate(callback);
|
|
574
574
|
}
|
|
575
575
|
} // get error from formState
|
|
576
576
|
|
|
@@ -584,7 +584,7 @@ class FormFoundation extends _foundation.default {
|
|
|
584
584
|
} // update formState error
|
|
585
585
|
|
|
586
586
|
|
|
587
|
-
updateStateError(field, error, opts) {
|
|
587
|
+
updateStateError(field, error, opts, callback) {
|
|
588
588
|
const notNotify = opts && opts.notNotify;
|
|
589
589
|
const notUpdate = opts && opts.notUpdate;
|
|
590
590
|
ObjectUtil.set(this.data.errors, field, error); // The setError caused by centralized validation does not need to trigger notify, otherwise it will be called too frequently, as many times as there are fields
|
|
@@ -595,7 +595,7 @@ class FormFoundation extends _foundation.default {
|
|
|
595
595
|
}
|
|
596
596
|
|
|
597
597
|
if (!notUpdate) {
|
|
598
|
-
this._adapter.forceUpdate();
|
|
598
|
+
this._adapter.forceUpdate(callback);
|
|
599
599
|
}
|
|
600
600
|
} // For internal use in the FormApi Operating Field
|
|
601
601
|
|
|
@@ -614,22 +614,21 @@ class FormFoundation extends _foundation.default {
|
|
|
614
614
|
// At this time, first modify formState directly, then find out the subordinate fields and drive them to update
|
|
615
615
|
// Eg: peoples: [0, 2, 3]. Each value of the peoples array corresponds to an Input Field
|
|
616
616
|
// When the user directly calls formA pi.set Value ('peoples', [2,3])
|
|
617
|
-
this.updateStateValue(field, newValue, opts)
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
}
|
|
631
|
-
} // If the reset happens to be, then update the updateKey corresponding to ArrayField to render it again
|
|
632
|
-
|
|
617
|
+
this.updateStateValue(field, newValue, opts, () => {
|
|
618
|
+
let nestedFields = this._getNestedField(field);
|
|
619
|
+
|
|
620
|
+
if (nestedFields.size) {
|
|
621
|
+
(0, _forEach.default)(nestedFields).call(nestedFields, fieldStaff => {
|
|
622
|
+
let fieldPath = fieldStaff.field;
|
|
623
|
+
let newFieldVal = ObjectUtil.get((0, _values2.default)(this.data), fieldPath);
|
|
624
|
+
let nestedBatchUpdateOpts = {
|
|
625
|
+
notNotify: true,
|
|
626
|
+
notUpdate: true
|
|
627
|
+
};
|
|
628
|
+
fieldStaff.fieldApi.setValue(newFieldVal, nestedBatchUpdateOpts);
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
}); // If the reset happens to be, then update the updateKey corresponding to ArrayField to render it again
|
|
633
632
|
|
|
634
633
|
if (this.getArrayField(field)) {
|
|
635
634
|
this.updateArrayField(field, {
|
|
@@ -647,21 +646,21 @@ class FormFoundation extends _foundation.default {
|
|
|
647
646
|
if (fieldApi) {
|
|
648
647
|
fieldApi.setError(newError, opts);
|
|
649
648
|
} else {
|
|
650
|
-
this.updateStateError(field, newError, opts)
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
}
|
|
664
|
-
}
|
|
649
|
+
this.updateStateError(field, newError, opts, () => {
|
|
650
|
+
let nestedFields = this._getNestedField(field);
|
|
651
|
+
|
|
652
|
+
if (nestedFields.size) {
|
|
653
|
+
(0, _forEach.default)(nestedFields).call(nestedFields, fieldStaff => {
|
|
654
|
+
let fieldPath = fieldStaff.field;
|
|
655
|
+
let newFieldError = ObjectUtil.get(this.data.errors, fieldPath);
|
|
656
|
+
let nestedBatchUpdateOpts = {
|
|
657
|
+
notNotify: true,
|
|
658
|
+
notUpdate: true
|
|
659
|
+
};
|
|
660
|
+
fieldStaff.fieldApi.setError(newFieldError, nestedBatchUpdateOpts);
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
});
|
|
665
664
|
|
|
666
665
|
if (this.getArrayField(field)) {
|
|
667
666
|
this.updateArrayField(field, {
|
|
@@ -677,21 +676,21 @@ class FormFoundation extends _foundation.default {
|
|
|
677
676
|
if (fieldApi) {
|
|
678
677
|
fieldApi.setTouched(isTouched, opts);
|
|
679
678
|
} else {
|
|
680
|
-
this.updateStateTouched(field, isTouched, opts)
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
}
|
|
694
|
-
}
|
|
679
|
+
this.updateStateTouched(field, isTouched, opts, () => {
|
|
680
|
+
let nestedFields = this._getNestedField(field);
|
|
681
|
+
|
|
682
|
+
if (nestedFields.size) {
|
|
683
|
+
(0, _forEach.default)(nestedFields).call(nestedFields, fieldStaff => {
|
|
684
|
+
let fieldPath = fieldStaff.field;
|
|
685
|
+
let newFieldTouch = ObjectUtil.get(this.data.touched, fieldPath);
|
|
686
|
+
let nestedBatchUpdateOpts = {
|
|
687
|
+
notNotify: true,
|
|
688
|
+
notUpdate: true
|
|
689
|
+
};
|
|
690
|
+
fieldStaff.fieldApi.setTouched(newFieldTouch, nestedBatchUpdateOpts);
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
});
|
|
695
694
|
|
|
696
695
|
if (this.getArrayField(field)) {
|
|
697
696
|
this.updateArrayField(field, {
|
|
@@ -7,7 +7,7 @@ export interface BaseFormAdapter<P = Record<string, any>, S = Record<string, any
|
|
|
7
7
|
cloneDeep: (val: any, ...rest: any[]) => any;
|
|
8
8
|
notifySubmit: (values: any) => void;
|
|
9
9
|
notifySubmitFail: (errors: Record<string, any>, values: any) => void;
|
|
10
|
-
forceUpdate: () => void;
|
|
10
|
+
forceUpdate: (callback?: () => void) => void;
|
|
11
11
|
notifyChange: (formState: FormState) => void;
|
|
12
12
|
notifyValueChange: (values: any, changedValues: any) => void;
|
|
13
13
|
notifyReset: () => void;
|
package/lib/cjs/input/input.css
CHANGED
|
@@ -278,6 +278,7 @@
|
|
|
278
278
|
cursor: not-allowed;
|
|
279
279
|
color: var(--semi-color-disabled-text);
|
|
280
280
|
background-color: var(--semi-color-disabled-fill);
|
|
281
|
+
-webkit-text-fill-color: var(--semi-color-disabled-text);
|
|
281
282
|
}
|
|
282
283
|
.semi-input-wrapper-disabled:hover {
|
|
283
284
|
background-color: var(--semi-color-disabled-fill);
|
package/lib/cjs/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
|
}
|
package/lib/cjs/table/table.css
CHANGED
|
@@ -109,7 +109,6 @@
|
|
|
109
109
|
word-break: break-all;
|
|
110
110
|
word-wrap: break-word;
|
|
111
111
|
position: relative;
|
|
112
|
-
user-select: none;
|
|
113
112
|
}
|
|
114
113
|
.semi-table-thead > .semi-table-row > .semi-table-row-head.semi-table-cell-fixed-left, .semi-table-thead > .semi-table-row > .semi-table-row-head.semi-table-cell-fixed-right {
|
|
115
114
|
z-index: 101;
|
|
@@ -381,7 +380,7 @@
|
|
|
381
380
|
position: relative;
|
|
382
381
|
z-index: 1;
|
|
383
382
|
padding: 16px 12px;
|
|
384
|
-
color: var(--semi-color-
|
|
383
|
+
color: var(--semi-color-text-2);
|
|
385
384
|
font-size: 14px;
|
|
386
385
|
text-align: center;
|
|
387
386
|
background: transparent;
|
package/lib/cjs/table/table.scss
CHANGED
|
@@ -100,7 +100,6 @@ $module: #{$prefix}-table;
|
|
|
100
100
|
word-break: break-all;
|
|
101
101
|
word-wrap: break-word;
|
|
102
102
|
position: relative;
|
|
103
|
-
user-select: none;
|
|
104
103
|
|
|
105
104
|
&.#{$module}-cell-fixed {
|
|
106
105
|
|
|
@@ -199,11 +198,11 @@ $module: #{$prefix}-table;
|
|
|
199
198
|
background-color: $color-table_body-bg-hover;
|
|
200
199
|
|
|
201
200
|
&.#{$module}-cell-fixed {
|
|
202
|
-
|
|
201
|
+
|
|
203
202
|
&-left,
|
|
204
203
|
&-right {
|
|
205
204
|
background-color: $color-table_body-bg-default;
|
|
206
|
-
|
|
205
|
+
|
|
207
206
|
&::before {
|
|
208
207
|
background-color: $color-table_body-bg-hover;
|
|
209
208
|
content: "";
|
|
@@ -327,7 +326,7 @@ $module: #{$prefix}-table;
|
|
|
327
326
|
&-wrap {
|
|
328
327
|
// inline-flex vertical-align baseline 会导致父元素高度异常
|
|
329
328
|
display: inline-flex;
|
|
330
|
-
vertical-align: bottom;
|
|
329
|
+
vertical-align: bottom;
|
|
331
330
|
}
|
|
332
331
|
|
|
333
332
|
&-disabled {
|
|
@@ -467,7 +466,7 @@ $module: #{$prefix}-table;
|
|
|
467
466
|
position: relative;
|
|
468
467
|
z-index: 1;
|
|
469
468
|
padding: #{$spacing-table-paddingY} #{$spacing-table-paddingX};
|
|
470
|
-
color: $color-
|
|
469
|
+
color: $color-table_placeholder-text-default;
|
|
471
470
|
font-size: #{$font-table_base-fontSize};
|
|
472
471
|
text-align: center;
|
|
473
472
|
background: $color-table_pl-bg-default;
|
|
@@ -73,6 +73,7 @@ $color-table_sorter-text-hover: var(--semi-color-text-2); // 表格排序按钮
|
|
|
73
73
|
$color-table_page-text-default: var(--semi-color-text-2); // 表格翻页器文本颜色
|
|
74
74
|
$color-table_resizer-bg-default: var(--semi-color-primary); // 表格拉伸标示线颜色
|
|
75
75
|
$color-table_selection-bg-default: rgba(var(--semi-grey-0), 1); // 表格分组背景色
|
|
76
|
+
$color-table_placeholder-text-default: var(--semi-color-text-2); // 表格空数据文本颜色
|
|
76
77
|
|
|
77
78
|
// Other
|
|
78
79
|
$font-table_base-fontSize: 14px; // 表格默认文本字号
|
package/lib/es/button/button.css
CHANGED
|
@@ -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; // 按钮轮廓宽度
|
|
@@ -111,7 +111,7 @@ $module: #{$prefix}-cascader;
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
&-tag {
|
|
114
|
-
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;
|
|
115
115
|
|
|
116
116
|
&:first-child {
|
|
117
117
|
margin-left: 0;
|
|
@@ -120,7 +120,7 @@ $module: #{$prefix}-cascader;
|
|
|
120
120
|
&-disabled.#{$prefix}-tag {
|
|
121
121
|
color: $color-cascader_input_disabled-text-default;
|
|
122
122
|
cursor: not-allowed;
|
|
123
|
-
|
|
123
|
+
|
|
124
124
|
.#{$prefix}-tag-close {
|
|
125
125
|
color: $color-cascader_input_disabled-text-default;
|
|
126
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;
|
|
@@ -23,7 +23,8 @@ import _parseInt from "@babel/runtime-corejs3/core-js-stable/parse-int";
|
|
|
23
23
|
import BaseFoundation from '../base/foundation';
|
|
24
24
|
import { filter, findAncestorKeys, calcCheckedKeysForUnchecked, calcCheckedKeysForChecked, calcCheckedKeys, findDescendantKeys, normalizeKeyList } from '../tree/treeUtil';
|
|
25
25
|
import { convertDataToEntities, findKeysForValues, normalizedArr, isValid, calcMergeType } from './util';
|
|
26
|
-
import { strings } from './constants';
|
|
26
|
+
import { strings } from './constants';
|
|
27
|
+
import isEnterPress from '../utils/isEnterPress'; // eslint-disable-next-line max-len
|
|
27
28
|
|
|
28
29
|
export default class CascaderFoundation extends BaseFoundation {
|
|
29
30
|
constructor(adapter) {
|
|
@@ -530,6 +531,16 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
530
531
|
this.close(e);
|
|
531
532
|
}
|
|
532
533
|
}
|
|
534
|
+
/**
|
|
535
|
+
* A11y: simulate selection click
|
|
536
|
+
*/
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
handleSelectionEnterPress(keyboardEvent) {
|
|
540
|
+
if (isEnterPress(keyboardEvent)) {
|
|
541
|
+
this.handleClick(keyboardEvent);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
533
544
|
|
|
534
545
|
toggleHoverState(bool) {
|
|
535
546
|
this._adapter.toggleHovering(bool);
|
|
@@ -961,6 +972,16 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
961
972
|
|
|
962
973
|
this._adapter.rePositionDropdown();
|
|
963
974
|
}
|
|
975
|
+
/**
|
|
976
|
+
* A11y: simulate clear button click
|
|
977
|
+
*/
|
|
978
|
+
|
|
979
|
+
|
|
980
|
+
handleClearEnterPress(keyboardEvent) {
|
|
981
|
+
if (isEnterPress(keyboardEvent)) {
|
|
982
|
+
this.handleClear();
|
|
983
|
+
}
|
|
984
|
+
}
|
|
964
985
|
|
|
965
986
|
getRenderData() {
|
|
966
987
|
var _context9, _context10;
|
|
@@ -44,7 +44,8 @@ $spacing-cascader_selection-paddingLeft: 12px; // 级联选择触发器左侧内
|
|
|
44
44
|
$spacing-cascader_selection-paddingRight: 12px; // 级联选择触发器右侧内边距
|
|
45
45
|
$spacing-cascader_selection_multiple-paddingLeft: $spacing-extra-tight; // 级联选择触发器多选时左侧内边距
|
|
46
46
|
$spacing-cascader_selection_multiple-paddingRight: $spacing-extra-tight; // 级联选择触发器多选时右侧内边距
|
|
47
|
-
$spacing-cascader_selection_tag-
|
|
47
|
+
$spacing-cascader_selection_tag-marginLeft: $spacing-none; // 级联选择触发器多选时标签的水平左外边距
|
|
48
|
+
$spacing-cascader_selection_tag-marginRight: $spacing-super-tight; // 级联选择触发器多选时标签的水平右外边距
|
|
48
49
|
$spacing-cascader_selection_tag-marginY: 1px; // 级联选择触发器多选时标签的垂直外边距
|
|
49
50
|
$spacing-cascader_selection_tagInput-marginLeft: - $spacing-extra-tight; // 级联选择触发器多选搜索时 TagInput 的左外边距
|
|
50
51
|
$spacing-cascader_selection_input-marginLeft: $spacing-extra-tight; // 级联选择触发器多选搜索时输入框的左外边距
|
|
@@ -135,8 +135,8 @@ export interface DatePickerFoundationState {
|
|
|
135
135
|
panelShow: boolean;
|
|
136
136
|
isRange: boolean;
|
|
137
137
|
inputValue: string;
|
|
138
|
-
value:
|
|
139
|
-
cachedSelectedValue:
|
|
138
|
+
value: Date[];
|
|
139
|
+
cachedSelectedValue: Date[];
|
|
140
140
|
prevTimeZone: string | number;
|
|
141
141
|
motionEnd: boolean;
|
|
142
142
|
rangeInputFocus: 'rangeStart' | 'rangeEnd' | boolean;
|
|
@@ -155,9 +155,9 @@ export interface DatePickerAdapter extends DefaultAdapter<DatePickerFoundationPr
|
|
|
155
155
|
notifyConfirm: DatePickerFoundationProps['onConfirm'];
|
|
156
156
|
notifyOpenChange: DatePickerFoundationProps['onOpenChange'];
|
|
157
157
|
notifyPresetsClick: DatePickerFoundationProps['onPresetClick'];
|
|
158
|
-
updateValue: (value:
|
|
158
|
+
updateValue: (value: Date[]) => void;
|
|
159
159
|
updatePrevTimezone: (prevTimeZone: string | number) => void;
|
|
160
|
-
updateCachedSelectedValue: (cachedSelectedValue:
|
|
160
|
+
updateCachedSelectedValue: (cachedSelectedValue: Date[]) => void;
|
|
161
161
|
updateInputValue: (inputValue: string) => void;
|
|
162
162
|
needConfirm: () => boolean;
|
|
163
163
|
typeIsYearOrMonth: () => boolean;
|
package/lib/es/form/form.css
CHANGED
|
@@ -111,6 +111,10 @@
|
|
|
111
111
|
padding-top: 6px;
|
|
112
112
|
padding-bottom: 6px;
|
|
113
113
|
}
|
|
114
|
+
.semi-form-field[x-label-pos=left] .semi-radioGroup-buttonRadio {
|
|
115
|
+
padding-top: 0;
|
|
116
|
+
padding-bottom: 0;
|
|
117
|
+
}
|
|
114
118
|
.semi-form-field[x-label-pos=left] .semi-switch,
|
|
115
119
|
.semi-form-field[x-label-pos=left] .semi-rating {
|
|
116
120
|
vertical-align: middle;
|
package/lib/es/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;
|
|
@@ -41,11 +41,11 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
41
41
|
setValues(values: any, { isOverride }: {
|
|
42
42
|
isOverride?: boolean;
|
|
43
43
|
}): void;
|
|
44
|
-
updateStateValue(field: string, value: any, opts: CallOpts): void;
|
|
44
|
+
updateStateValue(field: string, value: any, opts: CallOpts, callback?: () => void): void;
|
|
45
45
|
getTouched(field?: string): boolean | Record<string, any> | undefined;
|
|
46
|
-
updateStateTouched(field: string, isTouched: boolean, opts?: CallOpts): void;
|
|
46
|
+
updateStateTouched(field: string, isTouched: boolean, opts?: CallOpts, callback?: () => void): void;
|
|
47
47
|
getError(field?: string): any;
|
|
48
|
-
updateStateError(field: string, error: any, opts: CallOpts): void;
|
|
48
|
+
updateStateError(field: string, error: any, opts: CallOpts, callback?: () => void): void;
|
|
49
49
|
getFieldSetterApi(): {
|
|
50
50
|
setValue: (field: string, value: any, opts: CallOpts) => void;
|
|
51
51
|
setError: (field: string, error: any, opts: CallOpts) => void;
|
|
@@ -54,9 +54,9 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
54
54
|
getModifyFormStateApi(): {
|
|
55
55
|
register: (field: string, fieldState: FieldState, fieldStuff: FieldStaff) => void;
|
|
56
56
|
unRegister: (field: string) => void;
|
|
57
|
-
updateStateValue: (field: string, value: any, opts: CallOpts) => void;
|
|
58
|
-
updateStateError: (field: string, error: any, opts: CallOpts) => void;
|
|
59
|
-
updateStateTouched: (field: string, isTouched: boolean, opts?: CallOpts) => void;
|
|
57
|
+
updateStateValue: (field: string, value: any, opts: CallOpts, callback?: () => void) => void;
|
|
58
|
+
updateStateError: (field: string, error: any, opts: CallOpts, callback?: () => void) => void;
|
|
59
|
+
updateStateTouched: (field: string, isTouched: boolean, opts?: CallOpts, callback?: () => void) => void;
|
|
60
60
|
getValue: (field: string, opts?: CallOpts) => any;
|
|
61
61
|
getError: (field?: string) => any;
|
|
62
62
|
getTouched: (field?: string) => boolean | Record<string, any>;
|