@douyinfe/semi-foundation 2.80.0 → 2.81.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.
@@ -251,7 +251,7 @@ $module: #{$prefix}-button;
251
251
  color: $color-button_disabled_solid-text-default;
252
252
  cursor: not-allowed;
253
253
 
254
- &:not(.#{$module}-borderless):not(.#{$module}-light):hover {
254
+ &:not(.#{$module}-borderless):not(.#{$module}-light):not(.#{$module}-outline):hover {
255
255
  color: $color-button_disabled-text-hover;
256
256
  }
257
257
 
@@ -259,6 +259,10 @@ $module: #{$prefix}-button;
259
259
  &.#{$module}-borderless {
260
260
  color: $color-button_disabled-text-default;
261
261
  }
262
+
263
+ &.#{$module}-outline {
264
+ color: $color-button_disabled_outline_text-default;
265
+ }
262
266
  }
263
267
 
264
268
  &-borderless {
@@ -80,10 +80,11 @@ $color-button_tertiary_outline-border-default: var(--semi-color-border); // 边
80
80
  $color-button_tertiary_solid-text-default: var(--semi-color-text-1); // 浅色第三按钮文字颜色
81
81
 
82
82
  // disabled
83
- $color-button_disabled_solid-text-default: var(--semi-color-disabled-text); // 禁用按钮文字颜色
84
- $color-button_disabled-text-default: var(--semi-color-disabled-text); // 禁用按钮文字颜色
83
+ $color-button_disabled_solid-text-default: var(--semi-color-disabled-text); // 禁用按钮文字颜色 - 深色主题
84
+ $color-button_disabled-text-default: var(--semi-color-disabled-text); // 禁用按钮文字颜色 - 浅色主题或无背景
85
+ $color-button_disabled_outline_text-default: var(--semi-color-disabled-text); // 禁用按钮文字颜色 - 边框模式
85
86
  $color-button_disabled-bg-default: var(--semi-color-disabled-bg); // 禁用按钮背景颜色
86
- $color-button_disabled-text-hover: $color-button_disabled-text-default; // 禁用按钮文字颜色 - 悬浮
87
+ $color-button_disabled-text-hover: $color-button_disabled-text-default; // 禁用按钮文字颜色 - 深色主题 - 悬浮
87
88
  $color-button_disabled-bg-hover: var(--semi-color-disabled-bg); // 禁用按钮背景颜色 - 悬浮
88
89
  $color-button_disabled_primary-bg-default: $color-button_disabled-bg-default; // 禁用 primary 按钮背景颜色
89
90
  $color-button_disabled_secondary-bg-default: $color-button_disabled-bg-default; // 禁用 secondary 按钮背景颜色
@@ -934,7 +934,16 @@ $module-list: #{$prefix}-scrolllist;
934
934
 
935
935
  .#{$prefix}-input-wrapper {
936
936
  background-color: transparent;
937
+ height: fit-content;
937
938
  border: none;
939
+
940
+ &:active {
941
+ background-color: transparent;
942
+ }
943
+
944
+ &:hover {
945
+ background-color: transparent;
946
+ }
938
947
  }
939
948
 
940
949
  &-focus {
@@ -36,6 +36,7 @@ class InputFoundation extends BaseFoundation<InputAdapter> {
36
36
  }
37
37
 
38
38
  _timer: number | null;
39
+ compositionEnter: boolean = false;
39
40
 
40
41
  constructor(adapter: InputAdapter) {
41
42
  super({ ...InputFoundation.inputDefaultAdapter, ...adapter });
@@ -55,28 +56,62 @@ class InputFoundation extends BaseFoundation<InputAdapter> {
55
56
  }
56
57
 
57
58
  handleChange(value: any, e: any) {
58
- const { maxLength, minLength, getValueLength } = this._adapter.getProps();
59
59
  let nextValue = value;
60
- if (maxLength && isFunction(getValueLength)) {
61
- nextValue = this.handleVisibleMaxLength(value);
60
+ if (!this.compositionEnter) {
61
+ nextValue = this.getNextValue(nextValue);
62
+ }
63
+ this.changeInput(nextValue, e);
64
+ }
65
+
66
+ getNextValue = (value: any) => {
67
+ const { maxLength, minLength, getValueLength } = this._adapter.getProps();
68
+ if (!isFunction(getValueLength)) {
69
+ return value;
70
+ }
71
+ if (maxLength) {
72
+ return this.handleVisibleMaxLength(value);
62
73
  }
63
- if (minLength && isFunction(getValueLength)) {
64
- this.handleVisibleMinLength(nextValue);
74
+ if (minLength) {
75
+ this.handleVisibleMinLength(value);
65
76
  }
77
+ return value;
78
+ }
79
+
80
+ changeInput = (value: any, e: any) => {
66
81
  if (this._isControlledComponent()) {
67
82
  /**
68
83
  * If it is a controlled component, directly notify the caller of the modified value.
69
84
  * Truncate the input value from the input box if the input value exceeds the maximum length limit.
70
85
  * Even in controlled components, characters that exceed the length limit cannot be entered through the input box.
71
86
  */
72
- this._adapter.notifyChange(nextValue, e);
87
+ this._adapter.notifyChange(value, e);
73
88
  } else {
74
- this._adapter.setValue(nextValue);
75
- this._adapter.notifyChange(nextValue, e);
89
+ this._adapter.setValue(value);
90
+ this._adapter.notifyChange(value, e);
76
91
  // this.checkAllowClear(value);
77
92
  }
78
93
  }
79
94
 
95
+ handleCompositionStart = () => {
96
+ this.compositionEnter = true;
97
+ }
98
+
99
+ handleCompositionEnd = (e: any) => {
100
+ const value = e.target.value;
101
+ this.compositionEnter = false;
102
+ const { getValueLength, maxLength, minLength } = this.getProps();
103
+ if (!isFunction(getValueLength)) {
104
+ return;
105
+ }
106
+ if (maxLength) {
107
+ const nextValue = this.handleVisibleMaxLength(value);
108
+ nextValue !== value && this.changeInput(nextValue, e);
109
+ }
110
+ if (minLength) {
111
+ this.handleVisibleMinLength(value);
112
+ }
113
+ }
114
+
80
115
  /**
81
116
  * Modify minLength to trigger browser check for minimum length
82
117
  * Controlled mode is not checked
@@ -42,6 +42,8 @@ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdapter>
42
42
  };
43
43
  }
44
44
 
45
+ compositionEnter: boolean = false;
46
+
45
47
  constructor(adapter: TextAreaAdapter) {
46
48
  super({
47
49
  ...TextAreaFoundation.textAreaDefaultAdapter,
@@ -58,18 +60,53 @@ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdapter>
58
60
  handleChange(value: string, e: any) {
59
61
  const { maxLength, minLength, getValueLength } = this._adapter.getProps();
60
62
  let nextValue = value;
61
- if (maxLength && isFunction(getValueLength)) {
62
- nextValue = this.handleVisibleMaxLength(value);
63
- }
64
- if (minLength && isFunction(getValueLength)) {
65
- this.handleVisibleMinLength(nextValue);
63
+ if (!this.compositionEnter) {
64
+ nextValue = this.getNextValue(nextValue);
66
65
  }
66
+ this._changeValue(nextValue, e);
67
+ }
68
+
69
+ _changeValue = (value: any, e: any) => {
67
70
  if (this._isControlledComponent()) {
68
- this._adapter.notifyChange(nextValue, e);
71
+ this._adapter.notifyChange(value, e);
69
72
  } else {
70
- this._adapter.setValue(nextValue);
71
- this._adapter.notifyChange(nextValue, e);
73
+ this._adapter.setValue(value);
74
+ this._adapter.notifyChange(value, e);
75
+ }
76
+ }
77
+
78
+ getNextValue = (value: any) => {
79
+ const { maxLength, minLength, getValueLength } = this._adapter.getProps();
80
+ if (!isFunction(getValueLength)) {
81
+ return value;
82
+ }
83
+ if (maxLength) {
84
+ return this.handleVisibleMaxLength(value);
85
+ }
86
+ if (minLength) {
87
+ this.handleVisibleMinLength(value);
88
+ }
89
+ return value;
90
+ }
91
+
92
+ handleCompositionStart = () => {
93
+ this.compositionEnter = true;
94
+ }
95
+
96
+ handleCompositionEnd = (e: any) => {
97
+ this.compositionEnter = false;
98
+ const { getValueLength, maxLength, minLength } = this.getProps();
99
+ if (!isFunction(getValueLength)) {
100
+ return;
101
+ }
102
+ const value = e.target.value;
103
+ if (maxLength) {
104
+ const nextValue = this.handleVisibleMaxLength(value);
105
+ nextValue !== value && this._changeValue(nextValue, e);
72
106
  }
107
+ if (minLength) {
108
+ this.handleVisibleMinLength(value);
109
+ }
73
110
  }
74
111
 
75
112
  /**
@@ -205,12 +205,15 @@
205
205
  color: var(--semi-color-disabled-text);
206
206
  cursor: not-allowed;
207
207
  }
208
- .semi-button-disabled:not(.semi-button-borderless):not(.semi-button-light):hover {
208
+ .semi-button-disabled:not(.semi-button-borderless):not(.semi-button-light):not(.semi-button-outline):hover {
209
209
  color: var(--semi-color-disabled-text);
210
210
  }
211
211
  .semi-button-disabled.semi-button-light, .semi-button-disabled.semi-button-borderless {
212
212
  color: var(--semi-color-disabled-text);
213
213
  }
214
+ .semi-button-disabled.semi-button-outline {
215
+ color: var(--semi-color-disabled-text);
216
+ }
214
217
  .semi-button-borderless {
215
218
  background-color: transparent;
216
219
  border: 0 transparent solid;
@@ -251,7 +251,7 @@ $module: #{$prefix}-button;
251
251
  color: $color-button_disabled_solid-text-default;
252
252
  cursor: not-allowed;
253
253
 
254
- &:not(.#{$module}-borderless):not(.#{$module}-light):hover {
254
+ &:not(.#{$module}-borderless):not(.#{$module}-light):not(.#{$module}-outline):hover {
255
255
  color: $color-button_disabled-text-hover;
256
256
  }
257
257
 
@@ -259,6 +259,10 @@ $module: #{$prefix}-button;
259
259
  &.#{$module}-borderless {
260
260
  color: $color-button_disabled-text-default;
261
261
  }
262
+
263
+ &.#{$module}-outline {
264
+ color: $color-button_disabled_outline_text-default;
265
+ }
262
266
  }
263
267
 
264
268
  &-borderless {
@@ -80,10 +80,11 @@ $color-button_tertiary_outline-border-default: var(--semi-color-border); // 边
80
80
  $color-button_tertiary_solid-text-default: var(--semi-color-text-1); // 浅色第三按钮文字颜色
81
81
 
82
82
  // disabled
83
- $color-button_disabled_solid-text-default: var(--semi-color-disabled-text); // 禁用按钮文字颜色
84
- $color-button_disabled-text-default: var(--semi-color-disabled-text); // 禁用按钮文字颜色
83
+ $color-button_disabled_solid-text-default: var(--semi-color-disabled-text); // 禁用按钮文字颜色 - 深色主题
84
+ $color-button_disabled-text-default: var(--semi-color-disabled-text); // 禁用按钮文字颜色 - 浅色主题或无背景
85
+ $color-button_disabled_outline_text-default: var(--semi-color-disabled-text); // 禁用按钮文字颜色 - 边框模式
85
86
  $color-button_disabled-bg-default: var(--semi-color-disabled-bg); // 禁用按钮背景颜色
86
- $color-button_disabled-text-hover: $color-button_disabled-text-default; // 禁用按钮文字颜色 - 悬浮
87
+ $color-button_disabled-text-hover: $color-button_disabled-text-default; // 禁用按钮文字颜色 - 深色主题 - 悬浮
87
88
  $color-button_disabled-bg-hover: var(--semi-color-disabled-bg); // 禁用按钮背景颜色 - 悬浮
88
89
  $color-button_disabled_primary-bg-default: $color-button_disabled-bg-default; // 禁用 primary 按钮背景颜色
89
90
  $color-button_disabled_secondary-bg-default: $color-button_disabled-bg-default; // 禁用 secondary 按钮背景颜色
@@ -621,8 +621,15 @@
621
621
  }
622
622
  .semi-datepicker-range-input-wrapper .semi-input-wrapper {
623
623
  background-color: transparent;
624
+ height: fit-content;
624
625
  border: none;
625
626
  }
627
+ .semi-datepicker-range-input-wrapper .semi-input-wrapper:active {
628
+ background-color: transparent;
629
+ }
630
+ .semi-datepicker-range-input-wrapper .semi-input-wrapper:hover {
631
+ background-color: transparent;
632
+ }
626
633
  .semi-datepicker-range-input-wrapper-focus {
627
634
  border-color: transparent;
628
635
  background-color: var(--semi-color-fill-1);
@@ -934,7 +934,16 @@ $module-list: #{$prefix}-scrolllist;
934
934
 
935
935
  .#{$prefix}-input-wrapper {
936
936
  background-color: transparent;
937
+ height: fit-content;
937
938
  border: none;
939
+
940
+ &:active {
941
+ background-color: transparent;
942
+ }
943
+
944
+ &:hover {
945
+ background-color: transparent;
946
+ }
938
947
  }
939
948
 
940
949
  &-focus {
@@ -24,11 +24,16 @@ declare class InputFoundation extends BaseFoundation<InputAdapter> {
24
24
  setValue: (...args: any[]) => void;
25
25
  };
26
26
  _timer: number | null;
27
+ compositionEnter: boolean;
27
28
  constructor(adapter: InputAdapter);
28
29
  destroy(): void;
29
30
  setDisable(): void;
30
31
  setValue(value: any): void;
31
32
  handleChange(value: any, e: any): void;
33
+ getNextValue: (value: any) => any;
34
+ changeInput: (value: any, e: any) => void;
35
+ handleCompositionStart: () => void;
36
+ handleCompositionEnd: (e: any) => void;
32
37
  /**
33
38
  * Modify minLength to trigger browser check for minimum length
34
39
  * Controlled mode is not checked
@@ -24,6 +24,60 @@ class InputFoundation extends _foundation.default {
24
24
  }
25
25
  constructor(adapter) {
26
26
  super(Object.assign(Object.assign({}, InputFoundation.inputDefaultAdapter), adapter));
27
+ this.compositionEnter = false;
28
+ this.getNextValue = value => {
29
+ const {
30
+ maxLength,
31
+ minLength,
32
+ getValueLength
33
+ } = this._adapter.getProps();
34
+ if (!(0, _isFunction2.default)(getValueLength)) {
35
+ return value;
36
+ }
37
+ if (maxLength) {
38
+ return this.handleVisibleMaxLength(value);
39
+ }
40
+ if (minLength) {
41
+ this.handleVisibleMinLength(value);
42
+ }
43
+ return value;
44
+ };
45
+ this.changeInput = (value, e) => {
46
+ if (this._isControlledComponent()) {
47
+ /**
48
+ * If it is a controlled component, directly notify the caller of the modified value.
49
+ * Truncate the input value from the input box if the input value exceeds the maximum length limit.
50
+ * Even in controlled components, characters that exceed the length limit cannot be entered through the input box.
51
+ */
52
+ this._adapter.notifyChange(value, e);
53
+ } else {
54
+ this._adapter.setValue(value);
55
+ this._adapter.notifyChange(value, e);
56
+ // this.checkAllowClear(value);
57
+ }
58
+ };
59
+ this.handleCompositionStart = () => {
60
+ this.compositionEnter = true;
61
+ };
62
+ this.handleCompositionEnd = e => {
63
+ const value = e.target.value;
64
+ this.compositionEnter = false;
65
+ const {
66
+ getValueLength,
67
+ maxLength,
68
+ minLength
69
+ } = this.getProps();
70
+ if (!(0, _isFunction2.default)(getValueLength)) {
71
+ return;
72
+ }
73
+ if (maxLength) {
74
+ const nextValue = this.handleVisibleMaxLength(value);
75
+ nextValue !== value && this.changeInput(nextValue, e);
76
+ }
77
+ if (minLength) {
78
+ this.handleVisibleMinLength(value);
79
+ }
80
+ };
27
81
  }
28
82
  destroy() {
29
83
  if (this._timer) {
@@ -36,30 +90,11 @@ class InputFoundation extends _foundation.default {
36
90
  this._adapter.setValue(value);
37
91
  }
38
92
  handleChange(value, e) {
39
- const {
40
- maxLength,
41
- minLength,
42
- getValueLength
43
- } = this._adapter.getProps();
44
93
  let nextValue = value;
45
- if (maxLength && (0, _isFunction2.default)(getValueLength)) {
46
- nextValue = this.handleVisibleMaxLength(value);
47
- }
48
- if (minLength && (0, _isFunction2.default)(getValueLength)) {
49
- this.handleVisibleMinLength(nextValue);
50
- }
51
- if (this._isControlledComponent()) {
52
- /**
53
- * If it is a controlled component, directly notify the caller of the modified value.
54
- * Truncate the input value from the input box if the input value exceeds the maximum length limit.
55
- * Even in controlled components, characters that exceed the length limit cannot be entered through the input box.
56
- */
57
- this._adapter.notifyChange(nextValue, e);
58
- } else {
59
- this._adapter.setValue(nextValue);
60
- this._adapter.notifyChange(nextValue, e);
61
- // this.checkAllowClear(value);
94
+ if (!this.compositionEnter) {
95
+ nextValue = this.getNextValue(nextValue);
62
96
  }
97
+ this.changeInput(nextValue, e);
63
98
  }
64
99
  /**
65
100
  * Modify minLength to trigger browser check for minimum length
@@ -27,10 +27,15 @@ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdapter>
27
27
  notifyKeyDown: (...args: any[]) => void;
28
28
  notifyEnterPress: (...args: any[]) => void;
29
29
  };
30
+ compositionEnter: boolean;
30
31
  constructor(adapter: TextAreaAdapter);
31
32
  destroy(): void;
32
33
  handleValueChange(v: string): void;
33
34
  handleChange(value: string, e: any): void;
35
+ _changeValue: (value: any, e: any) => void;
36
+ getNextValue: (value: any) => any;
37
+ handleCompositionStart: () => void;
38
+ handleCompositionEnd: (e: any) => void;
34
39
  /**
35
40
  * Modify minLength to trigger browser check for minimum length
36
41
  * Controlled mode is not checked
@@ -28,6 +28,54 @@ class TextAreaFoundation extends _foundation.default {
28
28
  }
29
29
  constructor(adapter) {
30
30
  super(Object.assign(Object.assign({}, TextAreaFoundation.textAreaDefaultAdapter), adapter));
31
+ this.compositionEnter = false;
32
+ this._changeValue = (value, e) => {
33
+ if (this._isControlledComponent()) {
34
+ this._adapter.notifyChange(value, e);
35
+ } else {
36
+ this._adapter.setValue(value);
37
+ this._adapter.notifyChange(value, e);
38
+ }
39
+ };
40
+ this.getNextValue = value => {
41
+ const {
42
+ maxLength,
43
+ minLength,
44
+ getValueLength
45
+ } = this._adapter.getProps();
46
+ if (!(0, _isFunction2.default)(getValueLength)) {
47
+ return value;
48
+ }
49
+ if (maxLength) {
50
+ return this.handleVisibleMaxLength(value);
51
+ }
52
+ if (minLength) {
53
+ this.handleVisibleMinLength(value);
54
+ }
55
+ return value;
56
+ };
57
+ this.handleCompositionStart = () => {
58
+ this.compositionEnter = true;
59
+ };
60
+ this.handleCompositionEnd = e => {
61
+ this.compositionEnter = false;
62
+ const {
63
+ getValueLength,
64
+ maxLength,
65
+ minLength
66
+ } = this.getProps();
67
+ if (!(0, _isFunction2.default)(getValueLength)) {
68
+ return;
69
+ }
70
+ const value = e.target.value;
71
+ if (maxLength) {
72
+ const nextValue = this.handleVisibleMaxLength(value);
73
+ nextValue !== value && this._changeValue(nextValue, e);
74
+ }
75
+ if (minLength) {
76
+ this.handleVisibleMinLength(value);
77
+ }
78
+ };
31
79
  this.resizeTextarea = () => {
32
80
  var _a;
33
81
  const {
@@ -62,18 +110,10 @@ class TextAreaFoundation extends _foundation.default {
62
110
  getValueLength
63
111
  } = this._adapter.getProps();
64
112
  let nextValue = value;
65
- if (maxLength && (0, _isFunction2.default)(getValueLength)) {
66
- nextValue = this.handleVisibleMaxLength(value);
67
- }
68
- if (minLength && (0, _isFunction2.default)(getValueLength)) {
69
- this.handleVisibleMinLength(nextValue);
70
- }
71
- if (this._isControlledComponent()) {
72
- this._adapter.notifyChange(nextValue, e);
73
- } else {
74
- this._adapter.setValue(nextValue);
75
- this._adapter.notifyChange(nextValue, e);
113
+ if (!this.compositionEnter) {
114
+ nextValue = this.getNextValue(nextValue);
76
115
  }
116
+ this._changeValue(nextValue, e);
77
117
  }
78
118
  /**
79
119
  * Modify minLength to trigger browser check for minimum length
@@ -64,6 +64,7 @@ class Tooltip extends _foundation.default {
64
64
  }
65
65
  };
66
66
  this.show = () => {
67
+ this._initContainerPosition();
67
68
  if (this._adapter.getAnimatingState()) {
68
69
  return;
69
70
  }
@@ -233,7 +234,6 @@ class Tooltip extends _foundation.default {
233
234
  this._mounted = true;
234
235
  this._bindEvent();
235
236
  this._shouldShow();
236
- this._initContainerPosition();
237
237
  if (!wrapperId) {
238
238
  this._adapter.setId();
239
239
  }
@@ -1041,6 +1041,9 @@ class Tooltip extends _foundation.default {
1041
1041
  this._adapter.unregisterScrollHandler();
1042
1042
  }
1043
1043
  _initContainerPosition() {
1044
+ if (this._adapter.getContainerPosition() || !this._adapter.containerIsBody()) {
1045
+ return;
1046
+ }
1044
1047
  this._adapter.updateContainerPosition();
1045
1048
  }
1046
1049
  _handleTriggerKeydown(event) {
@@ -205,12 +205,15 @@
205
205
  color: var(--semi-color-disabled-text);
206
206
  cursor: not-allowed;
207
207
  }
208
- .semi-button-disabled:not(.semi-button-borderless):not(.semi-button-light):hover {
208
+ .semi-button-disabled:not(.semi-button-borderless):not(.semi-button-light):not(.semi-button-outline):hover {
209
209
  color: var(--semi-color-disabled-text);
210
210
  }
211
211
  .semi-button-disabled.semi-button-light, .semi-button-disabled.semi-button-borderless {
212
212
  color: var(--semi-color-disabled-text);
213
213
  }
214
+ .semi-button-disabled.semi-button-outline {
215
+ color: var(--semi-color-disabled-text);
216
+ }
214
217
  .semi-button-borderless {
215
218
  background-color: transparent;
216
219
  border: 0 transparent solid;
@@ -251,7 +251,7 @@ $module: #{$prefix}-button;
251
251
  color: $color-button_disabled_solid-text-default;
252
252
  cursor: not-allowed;
253
253
 
254
- &:not(.#{$module}-borderless):not(.#{$module}-light):hover {
254
+ &:not(.#{$module}-borderless):not(.#{$module}-light):not(.#{$module}-outline):hover {
255
255
  color: $color-button_disabled-text-hover;
256
256
  }
257
257
 
@@ -259,6 +259,10 @@ $module: #{$prefix}-button;
259
259
  &.#{$module}-borderless {
260
260
  color: $color-button_disabled-text-default;
261
261
  }
262
+
263
+ &.#{$module}-outline {
264
+ color: $color-button_disabled_outline_text-default;
265
+ }
262
266
  }
263
267
 
264
268
  &-borderless {
@@ -80,10 +80,11 @@ $color-button_tertiary_outline-border-default: var(--semi-color-border); // 边
80
80
  $color-button_tertiary_solid-text-default: var(--semi-color-text-1); // 浅色第三按钮文字颜色
81
81
 
82
82
  // disabled
83
- $color-button_disabled_solid-text-default: var(--semi-color-disabled-text); // 禁用按钮文字颜色
84
- $color-button_disabled-text-default: var(--semi-color-disabled-text); // 禁用按钮文字颜色
83
+ $color-button_disabled_solid-text-default: var(--semi-color-disabled-text); // 禁用按钮文字颜色 - 深色主题
84
+ $color-button_disabled-text-default: var(--semi-color-disabled-text); // 禁用按钮文字颜色 - 浅色主题或无背景
85
+ $color-button_disabled_outline_text-default: var(--semi-color-disabled-text); // 禁用按钮文字颜色 - 边框模式
85
86
  $color-button_disabled-bg-default: var(--semi-color-disabled-bg); // 禁用按钮背景颜色
86
- $color-button_disabled-text-hover: $color-button_disabled-text-default; // 禁用按钮文字颜色 - 悬浮
87
+ $color-button_disabled-text-hover: $color-button_disabled-text-default; // 禁用按钮文字颜色 - 深色主题 - 悬浮
87
88
  $color-button_disabled-bg-hover: var(--semi-color-disabled-bg); // 禁用按钮背景颜色 - 悬浮
88
89
  $color-button_disabled_primary-bg-default: $color-button_disabled-bg-default; // 禁用 primary 按钮背景颜色
89
90
  $color-button_disabled_secondary-bg-default: $color-button_disabled-bg-default; // 禁用 secondary 按钮背景颜色
@@ -621,8 +621,15 @@
621
621
  }
622
622
  .semi-datepicker-range-input-wrapper .semi-input-wrapper {
623
623
  background-color: transparent;
624
+ height: fit-content;
624
625
  border: none;
625
626
  }
627
+ .semi-datepicker-range-input-wrapper .semi-input-wrapper:active {
628
+ background-color: transparent;
629
+ }
630
+ .semi-datepicker-range-input-wrapper .semi-input-wrapper:hover {
631
+ background-color: transparent;
632
+ }
626
633
  .semi-datepicker-range-input-wrapper-focus {
627
634
  border-color: transparent;
628
635
  background-color: var(--semi-color-fill-1);
@@ -934,7 +934,16 @@ $module-list: #{$prefix}-scrolllist;
934
934
 
935
935
  .#{$prefix}-input-wrapper {
936
936
  background-color: transparent;
937
+ height: fit-content;
937
938
  border: none;
939
+
940
+ &:active {
941
+ background-color: transparent;
942
+ }
943
+
944
+ &:hover {
945
+ background-color: transparent;
946
+ }
938
947
  }
939
948
 
940
949
  &-focus {
@@ -24,11 +24,16 @@ declare class InputFoundation extends BaseFoundation<InputAdapter> {
24
24
  setValue: (...args: any[]) => void;
25
25
  };
26
26
  _timer: number | null;
27
+ compositionEnter: boolean;
27
28
  constructor(adapter: InputAdapter);
28
29
  destroy(): void;
29
30
  setDisable(): void;
30
31
  setValue(value: any): void;
31
32
  handleChange(value: any, e: any): void;
33
+ getNextValue: (value: any) => any;
34
+ changeInput: (value: any, e: any) => void;
35
+ handleCompositionStart: () => void;
36
+ handleCompositionEnd: (e: any) => void;
32
37
  /**
33
38
  * Modify minLength to trigger browser check for minimum length
34
39
  * Controlled mode is not checked
@@ -17,6 +17,60 @@ class InputFoundation extends BaseFoundation {
17
17
  }
18
18
  constructor(adapter) {
19
19
  super(Object.assign(Object.assign({}, InputFoundation.inputDefaultAdapter), adapter));
20
+ this.compositionEnter = false;
21
+ this.getNextValue = value => {
22
+ const {
23
+ maxLength,
24
+ minLength,
25
+ getValueLength
26
+ } = this._adapter.getProps();
27
+ if (!_isFunction(getValueLength)) {
28
+ return value;
29
+ }
30
+ if (maxLength) {
31
+ return this.handleVisibleMaxLength(value);
32
+ }
33
+ if (minLength) {
34
+ this.handleVisibleMinLength(value);
35
+ }
36
+ return value;
37
+ };
38
+ this.changeInput = (value, e) => {
39
+ if (this._isControlledComponent()) {
40
+ /**
41
+ * If it is a controlled component, directly notify the caller of the modified value.
42
+ * Truncate the input value from the input box if the input value exceeds the maximum length limit.
43
+ * Even in controlled components, characters that exceed the length limit cannot be entered through the input box.
44
+ */
45
+ this._adapter.notifyChange(value, e);
46
+ } else {
47
+ this._adapter.setValue(value);
48
+ this._adapter.notifyChange(value, e);
49
+ // this.checkAllowClear(value);
50
+ }
51
+ };
52
+ this.handleCompositionStart = () => {
53
+ this.compositionEnter = true;
54
+ };
55
+ this.handleCompositionEnd = e => {
56
+ const value = e.target.value;
57
+ this.compositionEnter = false;
58
+ const {
59
+ getValueLength,
60
+ maxLength,
61
+ minLength
62
+ } = this.getProps();
63
+ if (!_isFunction(getValueLength)) {
64
+ return;
65
+ }
66
+ if (maxLength) {
67
+ const nextValue = this.handleVisibleMaxLength(value);
68
+ nextValue !== value && this.changeInput(nextValue, e);
69
+ }
70
+ if (minLength) {
71
+ this.handleVisibleMinLength(value);
72
+ }
73
+ };
20
74
  }
21
75
  destroy() {
22
76
  if (this._timer) {
@@ -29,30 +83,11 @@ class InputFoundation extends BaseFoundation {
29
83
  this._adapter.setValue(value);
30
84
  }
31
85
  handleChange(value, e) {
32
- const {
33
- maxLength,
34
- minLength,
35
- getValueLength
36
- } = this._adapter.getProps();
37
86
  let nextValue = value;
38
- if (maxLength && _isFunction(getValueLength)) {
39
- nextValue = this.handleVisibleMaxLength(value);
40
- }
41
- if (minLength && _isFunction(getValueLength)) {
42
- this.handleVisibleMinLength(nextValue);
43
- }
44
- if (this._isControlledComponent()) {
45
- /**
46
- * If it is a controlled component, directly notify the caller of the modified value.
47
- * Truncate the input value from the input box if the input value exceeds the maximum length limit.
48
- * Even in controlled components, characters that exceed the length limit cannot be entered through the input box.
49
- */
50
- this._adapter.notifyChange(nextValue, e);
51
- } else {
52
- this._adapter.setValue(nextValue);
53
- this._adapter.notifyChange(nextValue, e);
54
- // this.checkAllowClear(value);
87
+ if (!this.compositionEnter) {
88
+ nextValue = this.getNextValue(nextValue);
55
89
  }
90
+ this.changeInput(nextValue, e);
56
91
  }
57
92
  /**
58
93
  * Modify minLength to trigger browser check for minimum length
@@ -27,10 +27,15 @@ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdapter>
27
27
  notifyKeyDown: (...args: any[]) => void;
28
28
  notifyEnterPress: (...args: any[]) => void;
29
29
  };
30
+ compositionEnter: boolean;
30
31
  constructor(adapter: TextAreaAdapter);
31
32
  destroy(): void;
32
33
  handleValueChange(v: string): void;
33
34
  handleChange(value: string, e: any): void;
35
+ _changeValue: (value: any, e: any) => void;
36
+ getNextValue: (value: any) => any;
37
+ handleCompositionStart: () => void;
38
+ handleCompositionEnd: (e: any) => void;
34
39
  /**
35
40
  * Modify minLength to trigger browser check for minimum length
36
41
  * Controlled mode is not checked
@@ -21,6 +21,54 @@ export default class TextAreaFoundation extends BaseFoundation {
21
21
  }
22
22
  constructor(adapter) {
23
23
  super(Object.assign(Object.assign({}, TextAreaFoundation.textAreaDefaultAdapter), adapter));
24
+ this.compositionEnter = false;
25
+ this._changeValue = (value, e) => {
26
+ if (this._isControlledComponent()) {
27
+ this._adapter.notifyChange(value, e);
28
+ } else {
29
+ this._adapter.setValue(value);
30
+ this._adapter.notifyChange(value, e);
31
+ }
32
+ };
33
+ this.getNextValue = value => {
34
+ const {
35
+ maxLength,
36
+ minLength,
37
+ getValueLength
38
+ } = this._adapter.getProps();
39
+ if (!_isFunction(getValueLength)) {
40
+ return value;
41
+ }
42
+ if (maxLength) {
43
+ return this.handleVisibleMaxLength(value);
44
+ }
45
+ if (minLength) {
46
+ this.handleVisibleMinLength(value);
47
+ }
48
+ return value;
49
+ };
50
+ this.handleCompositionStart = () => {
51
+ this.compositionEnter = true;
52
+ };
53
+ this.handleCompositionEnd = e => {
54
+ this.compositionEnter = false;
55
+ const {
56
+ getValueLength,
57
+ maxLength,
58
+ minLength
59
+ } = this.getProps();
60
+ if (!_isFunction(getValueLength)) {
61
+ return;
62
+ }
63
+ const value = e.target.value;
64
+ if (maxLength) {
65
+ const nextValue = this.handleVisibleMaxLength(value);
66
+ nextValue !== value && this._changeValue(nextValue, e);
67
+ }
68
+ if (minLength) {
69
+ this.handleVisibleMinLength(value);
70
+ }
71
+ };
24
72
  this.resizeTextarea = () => {
25
73
  var _a;
26
74
  const {
@@ -55,18 +103,10 @@ export default class TextAreaFoundation extends BaseFoundation {
55
103
  getValueLength
56
104
  } = this._adapter.getProps();
57
105
  let nextValue = value;
58
- if (maxLength && _isFunction(getValueLength)) {
59
- nextValue = this.handleVisibleMaxLength(value);
60
- }
61
- if (minLength && _isFunction(getValueLength)) {
62
- this.handleVisibleMinLength(nextValue);
63
- }
64
- if (this._isControlledComponent()) {
65
- this._adapter.notifyChange(nextValue, e);
66
- } else {
67
- this._adapter.setValue(nextValue);
68
- this._adapter.notifyChange(nextValue, e);
106
+ if (!this.compositionEnter) {
107
+ nextValue = this.getNextValue(nextValue);
69
108
  }
109
+ this._changeValue(nextValue, e);
70
110
  }
71
111
  /**
72
112
  * Modify minLength to trigger browser check for minimum length
@@ -57,6 +57,7 @@ export default class Tooltip extends BaseFoundation {
57
57
  }
58
58
  };
59
59
  this.show = () => {
60
+ this._initContainerPosition();
60
61
  if (this._adapter.getAnimatingState()) {
61
62
  return;
62
63
  }
@@ -226,7 +227,6 @@ export default class Tooltip extends BaseFoundation {
226
227
  this._mounted = true;
227
228
  this._bindEvent();
228
229
  this._shouldShow();
229
- this._initContainerPosition();
230
230
  if (!wrapperId) {
231
231
  this._adapter.setId();
232
232
  }
@@ -1034,6 +1034,9 @@ export default class Tooltip extends BaseFoundation {
1034
1034
  this._adapter.unregisterScrollHandler();
1035
1035
  }
1036
1036
  _initContainerPosition() {
1037
+ if (this._adapter.getContainerPosition() || !this._adapter.containerIsBody()) {
1038
+ return;
1039
+ }
1037
1040
  this._adapter.updateContainerPosition();
1038
1041
  }
1039
1042
  _handleTriggerKeydown(event) {
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.80.0",
3
+ "version": "2.81.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
7
7
  "prepublishOnly": "npm run build:lib"
8
8
  },
9
9
  "dependencies": {
10
- "@douyinfe/semi-animation": "2.80.0",
11
- "@douyinfe/semi-json-viewer-core": "2.80.0",
10
+ "@douyinfe/semi-animation": "2.81.0",
11
+ "@douyinfe/semi-json-viewer-core": "2.81.0",
12
12
  "@mdx-js/mdx": "^3.0.1",
13
13
  "async-validator": "^3.5.0",
14
14
  "classnames": "^2.2.6",
@@ -29,7 +29,7 @@
29
29
  "*.scss",
30
30
  "*.css"
31
31
  ],
32
- "gitHead": "cadd54a8955c5426065988796e4fae19744cc910",
32
+ "gitHead": "5fa3239b65dcbdca2a72a2f0682645c17a1b2d63",
33
33
  "devDependencies": {
34
34
  "@babel/plugin-transform-runtime": "^7.15.8",
35
35
  "@babel/preset-env": "^7.15.8",
@@ -92,7 +92,6 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
92
92
  this._mounted = true;
93
93
  this._bindEvent();
94
94
  this._shouldShow();
95
- this._initContainerPosition();
96
95
  if (!wrapperId) {
97
96
  this._adapter.setId();
98
97
  }
@@ -316,6 +315,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
316
315
  };
317
316
 
318
317
  show = () => {
318
+ this._initContainerPosition();
319
319
  if (this._adapter.getAnimatingState()) {
320
320
  return;
321
321
  }
@@ -1134,6 +1134,9 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
1134
1134
  }
1135
1135
 
1136
1136
  _initContainerPosition() {
1137
+ if (this._adapter.getContainerPosition() || !this._adapter.containerIsBody()) {
1138
+ return;
1139
+ }
1137
1140
  this._adapter.updateContainerPosition();
1138
1141
  }
1139
1142