@douyinfe/semi-foundation 2.5.0 → 2.5.1
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/constants.ts +2 -2
- package/cascader/cascader.scss +2 -2
- package/cascader/variables.scss +2 -1
- 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/constants.d.ts +9 -1
- package/lib/cjs/cascader/cascader.css +1 -1
- package/lib/cjs/cascader/cascader.scss +2 -2
- package/lib/cjs/cascader/variables.scss +2 -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/table/table.css +0 -1
- package/lib/cjs/table/table.scss +3 -4
- package/lib/es/button/constants.d.ts +9 -1
- package/lib/es/cascader/cascader.css +1 -1
- package/lib/es/cascader/cascader.scss +2 -2
- package/lib/es/cascader/variables.scss +2 -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/table/table.css +0 -1
- package/lib/es/table/table.scss +3 -4
- package/package.json +3 -3
- package/table/table.scss +3 -4
package/button/constants.ts
CHANGED
|
@@ -4,7 +4,7 @@ const cssClasses = {
|
|
|
4
4
|
PREFIX: `${BASE_CLASS_PREFIX}-button`,
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
const strings
|
|
7
|
+
const strings = {
|
|
8
8
|
sizes: ['default', 'small', 'large'],
|
|
9
9
|
iconPositions: ['left', 'right'],
|
|
10
10
|
htmlTypes: ['button', 'reset', 'submit'],
|
|
@@ -12,7 +12,7 @@ const strings: Record<string, any> = {
|
|
|
12
12
|
themes: ['solid', 'borderless', 'light'],
|
|
13
13
|
DEFAULT_ICON_SIZE: 'default',
|
|
14
14
|
DEFAULT_ICON_POSITION: 'left',
|
|
15
|
-
};
|
|
15
|
+
} as const;
|
|
16
16
|
|
|
17
17
|
const numbers = {};
|
|
18
18
|
|
package/cascader/cascader.scss
CHANGED
|
@@ -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;
|
package/cascader/variables.scss
CHANGED
|
@@ -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; // 级联选择触发器多选搜索时输入框的左外边距
|
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
|
}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
declare const cssClasses: {
|
|
2
2
|
PREFIX: string;
|
|
3
3
|
};
|
|
4
|
-
declare const strings:
|
|
4
|
+
declare const strings: {
|
|
5
|
+
readonly sizes: readonly ["default", "small", "large"];
|
|
6
|
+
readonly iconPositions: readonly ["left", "right"];
|
|
7
|
+
readonly htmlTypes: readonly ["button", "reset", "submit"];
|
|
8
|
+
readonly btnTypes: readonly ["primary", "secondary", "tertiary", "warning", "danger"];
|
|
9
|
+
readonly themes: readonly ["solid", "borderless", "light"];
|
|
10
|
+
readonly DEFAULT_ICON_SIZE: "default";
|
|
11
|
+
readonly DEFAULT_ICON_POSITION: "left";
|
|
12
|
+
};
|
|
5
13
|
declare const numbers: {};
|
|
6
14
|
export { cssClasses, strings, numbers };
|
|
@@ -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;
|
|
@@ -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; // 级联选择触发器多选搜索时输入框的左外边距
|
package/lib/cjs/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/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;
|
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 {
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
declare const cssClasses: {
|
|
2
2
|
PREFIX: string;
|
|
3
3
|
};
|
|
4
|
-
declare const strings:
|
|
4
|
+
declare const strings: {
|
|
5
|
+
readonly sizes: readonly ["default", "small", "large"];
|
|
6
|
+
readonly iconPositions: readonly ["left", "right"];
|
|
7
|
+
readonly htmlTypes: readonly ["button", "reset", "submit"];
|
|
8
|
+
readonly btnTypes: readonly ["primary", "secondary", "tertiary", "warning", "danger"];
|
|
9
|
+
readonly themes: readonly ["solid", "borderless", "light"];
|
|
10
|
+
readonly DEFAULT_ICON_SIZE: "default";
|
|
11
|
+
readonly DEFAULT_ICON_POSITION: "left";
|
|
12
|
+
};
|
|
5
13
|
declare const numbers: {};
|
|
6
14
|
export { cssClasses, strings, numbers };
|
|
@@ -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;
|
|
@@ -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; // 级联选择触发器多选搜索时输入框的左外边距
|
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>;
|
|
@@ -486,7 +486,7 @@ export default class FormFoundation extends BaseFoundation {
|
|
|
486
486
|
} // update formState value
|
|
487
487
|
|
|
488
488
|
|
|
489
|
-
updateStateValue(field, value, opts) {
|
|
489
|
+
updateStateValue(field, value, opts, callback) {
|
|
490
490
|
const notNotify = opts && opts.notNotify;
|
|
491
491
|
const notUpdate = opts && opts.notUpdate;
|
|
492
492
|
const fieldAllowEmpty = opts && opts.fieldAllowEmpty;
|
|
@@ -518,7 +518,7 @@ export default class FormFoundation extends BaseFoundation {
|
|
|
518
518
|
}
|
|
519
519
|
|
|
520
520
|
if (!notUpdate) {
|
|
521
|
-
this._adapter.forceUpdate();
|
|
521
|
+
this._adapter.forceUpdate(callback);
|
|
522
522
|
}
|
|
523
523
|
} // get touched from formState
|
|
524
524
|
|
|
@@ -532,7 +532,7 @@ export default class FormFoundation extends BaseFoundation {
|
|
|
532
532
|
} // update formState touched
|
|
533
533
|
|
|
534
534
|
|
|
535
|
-
updateStateTouched(field, isTouched, opts) {
|
|
535
|
+
updateStateTouched(field, isTouched, opts, callback) {
|
|
536
536
|
const notNotify = opts && opts.notNotify;
|
|
537
537
|
const notUpdate = opts && opts.notUpdate;
|
|
538
538
|
ObjectUtil.set(this.data.touched, field, isTouched);
|
|
@@ -542,7 +542,7 @@ export default class FormFoundation extends BaseFoundation {
|
|
|
542
542
|
}
|
|
543
543
|
|
|
544
544
|
if (!notUpdate) {
|
|
545
|
-
this._adapter.forceUpdate();
|
|
545
|
+
this._adapter.forceUpdate(callback);
|
|
546
546
|
}
|
|
547
547
|
} // get error from formState
|
|
548
548
|
|
|
@@ -556,7 +556,7 @@ export default class FormFoundation extends BaseFoundation {
|
|
|
556
556
|
} // update formState error
|
|
557
557
|
|
|
558
558
|
|
|
559
|
-
updateStateError(field, error, opts) {
|
|
559
|
+
updateStateError(field, error, opts, callback) {
|
|
560
560
|
const notNotify = opts && opts.notNotify;
|
|
561
561
|
const notUpdate = opts && opts.notUpdate;
|
|
562
562
|
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
|
|
@@ -567,7 +567,7 @@ export default class FormFoundation extends BaseFoundation {
|
|
|
567
567
|
}
|
|
568
568
|
|
|
569
569
|
if (!notUpdate) {
|
|
570
|
-
this._adapter.forceUpdate();
|
|
570
|
+
this._adapter.forceUpdate(callback);
|
|
571
571
|
}
|
|
572
572
|
} // For internal use in the FormApi Operating Field
|
|
573
573
|
|
|
@@ -586,22 +586,21 @@ export default class FormFoundation extends BaseFoundation {
|
|
|
586
586
|
// At this time, first modify formState directly, then find out the subordinate fields and drive them to update
|
|
587
587
|
// Eg: peoples: [0, 2, 3]. Each value of the peoples array corresponds to an Input Field
|
|
588
588
|
// When the user directly calls formA pi.set Value ('peoples', [2,3])
|
|
589
|
-
this.updateStateValue(field, newValue, opts)
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
}
|
|
603
|
-
} // If the reset happens to be, then update the updateKey corresponding to ArrayField to render it again
|
|
604
|
-
|
|
589
|
+
this.updateStateValue(field, newValue, opts, () => {
|
|
590
|
+
let nestedFields = this._getNestedField(field);
|
|
591
|
+
|
|
592
|
+
if (nestedFields.size) {
|
|
593
|
+
_forEachInstanceProperty(nestedFields).call(nestedFields, fieldStaff => {
|
|
594
|
+
let fieldPath = fieldStaff.field;
|
|
595
|
+
let newFieldVal = ObjectUtil.get(_valuesInstanceProperty(this.data), fieldPath);
|
|
596
|
+
let nestedBatchUpdateOpts = {
|
|
597
|
+
notNotify: true,
|
|
598
|
+
notUpdate: true
|
|
599
|
+
};
|
|
600
|
+
fieldStaff.fieldApi.setValue(newFieldVal, nestedBatchUpdateOpts);
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
}); // If the reset happens to be, then update the updateKey corresponding to ArrayField to render it again
|
|
605
604
|
|
|
606
605
|
if (this.getArrayField(field)) {
|
|
607
606
|
this.updateArrayField(field, {
|
|
@@ -619,21 +618,21 @@ export default class FormFoundation extends BaseFoundation {
|
|
|
619
618
|
if (fieldApi) {
|
|
620
619
|
fieldApi.setError(newError, opts);
|
|
621
620
|
} else {
|
|
622
|
-
this.updateStateError(field, newError, opts)
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
}
|
|
636
|
-
}
|
|
621
|
+
this.updateStateError(field, newError, opts, () => {
|
|
622
|
+
let nestedFields = this._getNestedField(field);
|
|
623
|
+
|
|
624
|
+
if (nestedFields.size) {
|
|
625
|
+
_forEachInstanceProperty(nestedFields).call(nestedFields, fieldStaff => {
|
|
626
|
+
let fieldPath = fieldStaff.field;
|
|
627
|
+
let newFieldError = ObjectUtil.get(this.data.errors, fieldPath);
|
|
628
|
+
let nestedBatchUpdateOpts = {
|
|
629
|
+
notNotify: true,
|
|
630
|
+
notUpdate: true
|
|
631
|
+
};
|
|
632
|
+
fieldStaff.fieldApi.setError(newFieldError, nestedBatchUpdateOpts);
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
});
|
|
637
636
|
|
|
638
637
|
if (this.getArrayField(field)) {
|
|
639
638
|
this.updateArrayField(field, {
|
|
@@ -649,21 +648,21 @@ export default class FormFoundation extends BaseFoundation {
|
|
|
649
648
|
if (fieldApi) {
|
|
650
649
|
fieldApi.setTouched(isTouched, opts);
|
|
651
650
|
} else {
|
|
652
|
-
this.updateStateTouched(field, isTouched, opts)
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
}
|
|
666
|
-
}
|
|
651
|
+
this.updateStateTouched(field, isTouched, opts, () => {
|
|
652
|
+
let nestedFields = this._getNestedField(field);
|
|
653
|
+
|
|
654
|
+
if (nestedFields.size) {
|
|
655
|
+
_forEachInstanceProperty(nestedFields).call(nestedFields, fieldStaff => {
|
|
656
|
+
let fieldPath = fieldStaff.field;
|
|
657
|
+
let newFieldTouch = ObjectUtil.get(this.data.touched, fieldPath);
|
|
658
|
+
let nestedBatchUpdateOpts = {
|
|
659
|
+
notNotify: true,
|
|
660
|
+
notUpdate: true
|
|
661
|
+
};
|
|
662
|
+
fieldStaff.fieldApi.setTouched(newFieldTouch, nestedBatchUpdateOpts);
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
});
|
|
667
666
|
|
|
668
667
|
if (this.getArrayField(field)) {
|
|
669
668
|
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/es/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/es/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/es/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;
|
package/lib/es/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 {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
11
|
-
"@douyinfe/semi-animation": "2.5.
|
|
11
|
+
"@douyinfe/semi-animation": "2.5.1",
|
|
12
12
|
"async-validator": "^3.5.0",
|
|
13
13
|
"classnames": "^2.2.6",
|
|
14
14
|
"date-fns": "^2.9.0",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"*.scss",
|
|
25
25
|
"*.css"
|
|
26
26
|
],
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "3f83639f8a4fff7f912a237bf2842cb0944d993c",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
30
30
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
package/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 {
|