@douyinfe/semi-foundation 2.24.0-beta.0 → 2.24.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/highlight/variables.scss +2 -2
- package/input/foundation.ts +4 -0
- package/inputNumber/foundation.ts +2 -1
- package/lib/cjs/highlight/highlight.css +2 -2
- package/lib/cjs/highlight/variables.scss +2 -2
- package/lib/cjs/input/foundation.d.ts +1 -0
- package/lib/cjs/input/foundation.js +6 -0
- package/lib/cjs/inputNumber/foundation.js +3 -1
- package/lib/cjs/tooltip/foundation.js +9 -6
- package/lib/es/highlight/highlight.css +2 -2
- package/lib/es/highlight/variables.scss +2 -2
- package/lib/es/input/foundation.d.ts +1 -0
- package/lib/es/input/foundation.js +6 -0
- package/lib/es/inputNumber/foundation.js +3 -1
- package/lib/es/tooltip/foundation.js +9 -6
- package/package.json +2 -2
- package/tooltip/foundation.ts +9 -4
package/highlight/variables.scss
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
$color-highlight-text-default:
|
|
3
|
-
$color-highlight-text-bg-default:
|
|
2
|
+
$color-highlight-text-default: var(--semi-color-highlight); // 高亮文字颜色
|
|
3
|
+
$color-highlight-text-bg-default: var(--semi-color-highlight-bg); // 高亮文字背景颜色
|
|
4
4
|
|
|
5
5
|
$font-highlight-text-fontWeight: 600; // 高亮文字字重
|
package/input/foundation.ts
CHANGED
|
@@ -15,6 +15,7 @@ export interface InputAdapter extends Partial<DefaultAdapter>, Partial<InputDefa
|
|
|
15
15
|
notifyBlur(value: any, e: any): void;
|
|
16
16
|
setEyeClosed(eyeClosed: boolean): void;
|
|
17
17
|
toggleFocusing(focused: boolean): void;
|
|
18
|
+
focusInput(): void;
|
|
18
19
|
notifyFocus(value: any, e: any): void;
|
|
19
20
|
notifyInput(e: any): void;
|
|
20
21
|
notifyKeyDown(e: any): void;
|
|
@@ -198,6 +199,7 @@ class InputFoundation extends BaseFoundation<InputAdapter> {
|
|
|
198
199
|
}
|
|
199
200
|
// do not handle bubbling up events
|
|
200
201
|
if (this._adapter.isEventTarget(e)) {
|
|
202
|
+
this._adapter.focusInput();
|
|
201
203
|
this._adapter.toggleFocusing(true);
|
|
202
204
|
}
|
|
203
205
|
}
|
|
@@ -212,6 +214,7 @@ class InputFoundation extends BaseFoundation<InputAdapter> {
|
|
|
212
214
|
|
|
213
215
|
handleClickEye(e: any) {
|
|
214
216
|
const eyeClosed = this._adapter.getState('eyeClosed');
|
|
217
|
+
this._adapter.focusInput();
|
|
215
218
|
this._adapter.toggleFocusing(true);
|
|
216
219
|
this._adapter.setEyeClosed(!eyeClosed);
|
|
217
220
|
}
|
|
@@ -276,6 +279,7 @@ class InputFoundation extends BaseFoundation<InputAdapter> {
|
|
|
276
279
|
const { disabled } = this._adapter.getProps();
|
|
277
280
|
const { isFocus } = this._adapter.getStates();
|
|
278
281
|
if (!disabled && !isFocus) {
|
|
282
|
+
this._adapter.focusInput();
|
|
279
283
|
this._adapter.toggleFocusing(true);
|
|
280
284
|
}
|
|
281
285
|
}
|
|
@@ -343,7 +343,8 @@ class InputNumberFoundation extends BaseFoundation<InputNumberAdapter> {
|
|
|
343
343
|
|
|
344
344
|
_preventDefault(event: any) {
|
|
345
345
|
const keepFocus = this._adapter.getProp('keepFocus');
|
|
346
|
-
|
|
346
|
+
const innerButtons = this._adapter.getProp('innerButtons');
|
|
347
|
+
if (keepFocus || innerButtons) {
|
|
347
348
|
event.preventDefault();
|
|
348
349
|
}
|
|
349
350
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
$color-highlight-text-default:
|
|
3
|
-
$color-highlight-text-bg-default:
|
|
2
|
+
$color-highlight-text-default: var(--semi-color-highlight); // 高亮文字颜色
|
|
3
|
+
$color-highlight-text-bg-default: var(--semi-color-highlight-bg); // 高亮文字背景颜色
|
|
4
4
|
|
|
5
5
|
$font-highlight-text-fontWeight: 600; // 高亮文字字重
|
|
@@ -9,6 +9,7 @@ export interface InputAdapter extends Partial<DefaultAdapter>, Partial<InputDefa
|
|
|
9
9
|
notifyBlur(value: any, e: any): void;
|
|
10
10
|
setEyeClosed(eyeClosed: boolean): void;
|
|
11
11
|
toggleFocusing(focused: boolean): void;
|
|
12
|
+
focusInput(): void;
|
|
12
13
|
notifyFocus(value: any, e: any): void;
|
|
13
14
|
notifyInput(e: any): void;
|
|
14
15
|
notifyKeyDown(e: any): void;
|
|
@@ -240,6 +240,8 @@ class InputFoundation extends _foundation.default {
|
|
|
240
240
|
|
|
241
241
|
|
|
242
242
|
if (this._adapter.isEventTarget(e)) {
|
|
243
|
+
this._adapter.focusInput();
|
|
244
|
+
|
|
243
245
|
this._adapter.toggleFocusing(true);
|
|
244
246
|
}
|
|
245
247
|
}
|
|
@@ -255,6 +257,8 @@ class InputFoundation extends _foundation.default {
|
|
|
255
257
|
handleClickEye(e) {
|
|
256
258
|
const eyeClosed = this._adapter.getState('eyeClosed');
|
|
257
259
|
|
|
260
|
+
this._adapter.focusInput();
|
|
261
|
+
|
|
258
262
|
this._adapter.toggleFocusing(true);
|
|
259
263
|
|
|
260
264
|
this._adapter.setEyeClosed(!eyeClosed);
|
|
@@ -347,6 +351,8 @@ class InputFoundation extends _foundation.default {
|
|
|
347
351
|
} = this._adapter.getStates();
|
|
348
352
|
|
|
349
353
|
if (!disabled && !isFocus) {
|
|
354
|
+
this._adapter.focusInput();
|
|
355
|
+
|
|
350
356
|
this._adapter.toggleFocusing(true);
|
|
351
357
|
}
|
|
352
358
|
}
|
|
@@ -371,7 +371,9 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
371
371
|
_preventDefault(event) {
|
|
372
372
|
const keepFocus = this._adapter.getProp('keepFocus');
|
|
373
373
|
|
|
374
|
-
|
|
374
|
+
const innerButtons = this._adapter.getProp('innerButtons');
|
|
375
|
+
|
|
376
|
+
if (keepFocus || innerButtons) {
|
|
375
377
|
event.preventDefault();
|
|
376
378
|
}
|
|
377
379
|
}
|
|
@@ -1142,23 +1142,26 @@ class Tooltip extends _foundation.default {
|
|
|
1142
1142
|
|
|
1143
1143
|
|
|
1144
1144
|
if (this.isTB(position)) {
|
|
1145
|
-
isHeightOverFlow = isViewYOverFlow && isContainerYOverFlow;
|
|
1145
|
+
isHeightOverFlow = isViewYOverFlow && isContainerYOverFlow; // Related PR: https://github.com/DouyinFE/semi-design/pull/1297
|
|
1146
|
+
// If clientRight or restClientRight less than 0, means that the left and right parts of the trigger are blocked
|
|
1147
|
+
// Then the display of the wrapper will also be affected, make width overflow to offset the wrapper
|
|
1146
1148
|
|
|
1147
1149
|
if (position === 'top' || position === 'bottom') {
|
|
1148
|
-
isWidthOverFlow = isViewXOverFlowSideHalf && isContainerXOverFlowSideHalf;
|
|
1150
|
+
isWidthOverFlow = isViewXOverFlowSideHalf && isContainerXOverFlowSideHalf || clientRight < 0 || restClientRight < 0;
|
|
1149
1151
|
} else {
|
|
1150
|
-
isWidthOverFlow = isViewXOverFlowSide && isContainerXOverFlowSide;
|
|
1152
|
+
isWidthOverFlow = isViewXOverFlowSide && isContainerXOverFlowSide || clientRight < 0 || restClientRight < 0;
|
|
1151
1153
|
}
|
|
1152
1154
|
} // 左右方向 left and right
|
|
1153
1155
|
|
|
1154
1156
|
|
|
1155
1157
|
if (this.isLR(position)) {
|
|
1156
|
-
isWidthOverFlow = isViewXOverFlow && isContainerXOverFlow;
|
|
1158
|
+
isWidthOverFlow = isViewXOverFlow && isContainerXOverFlow; // If clientTop or restClientTop less than 0, means that the top and bottom parts of the trigger are blocked
|
|
1159
|
+
// Then the display of the wrapper will also be affected, make height overflow to offset the wrapper
|
|
1157
1160
|
|
|
1158
1161
|
if (position === 'left' || position === 'right') {
|
|
1159
|
-
isHeightOverFlow = isViewYOverFlowSideHalf && isContainerYOverFlowSideHalf;
|
|
1162
|
+
isHeightOverFlow = isViewYOverFlowSideHalf && isContainerYOverFlowSideHalf || clientTop < 0 || restClientTop < 0;
|
|
1160
1163
|
} else {
|
|
1161
|
-
isHeightOverFlow = isViewYOverFlowSide && isContainerYOverFlowSide;
|
|
1164
|
+
isHeightOverFlow = isViewYOverFlowSide && isContainerYOverFlowSide || clientTop < 0 || restClientTop < 0;
|
|
1162
1165
|
}
|
|
1163
1166
|
}
|
|
1164
1167
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
$color-highlight-text-default:
|
|
3
|
-
$color-highlight-text-bg-default:
|
|
2
|
+
$color-highlight-text-default: var(--semi-color-highlight); // 高亮文字颜色
|
|
3
|
+
$color-highlight-text-bg-default: var(--semi-color-highlight-bg); // 高亮文字背景颜色
|
|
4
4
|
|
|
5
5
|
$font-highlight-text-fontWeight: 600; // 高亮文字字重
|
|
@@ -9,6 +9,7 @@ export interface InputAdapter extends Partial<DefaultAdapter>, Partial<InputDefa
|
|
|
9
9
|
notifyBlur(value: any, e: any): void;
|
|
10
10
|
setEyeClosed(eyeClosed: boolean): void;
|
|
11
11
|
toggleFocusing(focused: boolean): void;
|
|
12
|
+
focusInput(): void;
|
|
12
13
|
notifyFocus(value: any, e: any): void;
|
|
13
14
|
notifyInput(e: any): void;
|
|
14
15
|
notifyKeyDown(e: any): void;
|
|
@@ -225,6 +225,8 @@ class InputFoundation extends BaseFoundation {
|
|
|
225
225
|
|
|
226
226
|
|
|
227
227
|
if (this._adapter.isEventTarget(e)) {
|
|
228
|
+
this._adapter.focusInput();
|
|
229
|
+
|
|
228
230
|
this._adapter.toggleFocusing(true);
|
|
229
231
|
}
|
|
230
232
|
}
|
|
@@ -240,6 +242,8 @@ class InputFoundation extends BaseFoundation {
|
|
|
240
242
|
handleClickEye(e) {
|
|
241
243
|
const eyeClosed = this._adapter.getState('eyeClosed');
|
|
242
244
|
|
|
245
|
+
this._adapter.focusInput();
|
|
246
|
+
|
|
243
247
|
this._adapter.toggleFocusing(true);
|
|
244
248
|
|
|
245
249
|
this._adapter.setEyeClosed(!eyeClosed);
|
|
@@ -332,6 +336,8 @@ class InputFoundation extends BaseFoundation {
|
|
|
332
336
|
} = this._adapter.getStates();
|
|
333
337
|
|
|
334
338
|
if (!disabled && !isFocus) {
|
|
339
|
+
this._adapter.focusInput();
|
|
340
|
+
|
|
335
341
|
this._adapter.toggleFocusing(true);
|
|
336
342
|
}
|
|
337
343
|
}
|
|
@@ -355,7 +355,9 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
355
355
|
_preventDefault(event) {
|
|
356
356
|
const keepFocus = this._adapter.getProp('keepFocus');
|
|
357
357
|
|
|
358
|
-
|
|
358
|
+
const innerButtons = this._adapter.getProp('innerButtons');
|
|
359
|
+
|
|
360
|
+
if (keepFocus || innerButtons) {
|
|
359
361
|
event.preventDefault();
|
|
360
362
|
}
|
|
361
363
|
}
|
|
@@ -1132,23 +1132,26 @@ export default class Tooltip extends BaseFoundation {
|
|
|
1132
1132
|
|
|
1133
1133
|
|
|
1134
1134
|
if (this.isTB(position)) {
|
|
1135
|
-
isHeightOverFlow = isViewYOverFlow && isContainerYOverFlow;
|
|
1135
|
+
isHeightOverFlow = isViewYOverFlow && isContainerYOverFlow; // Related PR: https://github.com/DouyinFE/semi-design/pull/1297
|
|
1136
|
+
// If clientRight or restClientRight less than 0, means that the left and right parts of the trigger are blocked
|
|
1137
|
+
// Then the display of the wrapper will also be affected, make width overflow to offset the wrapper
|
|
1136
1138
|
|
|
1137
1139
|
if (position === 'top' || position === 'bottom') {
|
|
1138
|
-
isWidthOverFlow = isViewXOverFlowSideHalf && isContainerXOverFlowSideHalf;
|
|
1140
|
+
isWidthOverFlow = isViewXOverFlowSideHalf && isContainerXOverFlowSideHalf || clientRight < 0 || restClientRight < 0;
|
|
1139
1141
|
} else {
|
|
1140
|
-
isWidthOverFlow = isViewXOverFlowSide && isContainerXOverFlowSide;
|
|
1142
|
+
isWidthOverFlow = isViewXOverFlowSide && isContainerXOverFlowSide || clientRight < 0 || restClientRight < 0;
|
|
1141
1143
|
}
|
|
1142
1144
|
} // 左右方向 left and right
|
|
1143
1145
|
|
|
1144
1146
|
|
|
1145
1147
|
if (this.isLR(position)) {
|
|
1146
|
-
isWidthOverFlow = isViewXOverFlow && isContainerXOverFlow;
|
|
1148
|
+
isWidthOverFlow = isViewXOverFlow && isContainerXOverFlow; // If clientTop or restClientTop less than 0, means that the top and bottom parts of the trigger are blocked
|
|
1149
|
+
// Then the display of the wrapper will also be affected, make height overflow to offset the wrapper
|
|
1147
1150
|
|
|
1148
1151
|
if (position === 'left' || position === 'right') {
|
|
1149
|
-
isHeightOverFlow = isViewYOverFlowSideHalf && isContainerYOverFlowSideHalf;
|
|
1152
|
+
isHeightOverFlow = isViewYOverFlowSideHalf && isContainerYOverFlowSideHalf || clientTop < 0 || restClientTop < 0;
|
|
1150
1153
|
} else {
|
|
1151
|
-
isHeightOverFlow = isViewYOverFlowSide && isContainerYOverFlowSide;
|
|
1154
|
+
isHeightOverFlow = isViewYOverFlowSide && isContainerYOverFlowSide || clientTop < 0 || restClientTop < 0;
|
|
1152
1155
|
}
|
|
1153
1156
|
}
|
|
1154
1157
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.24.0
|
|
3
|
+
"version": "2.24.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"*.scss",
|
|
24
24
|
"*.css"
|
|
25
25
|
],
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "3cf6c8a6fa76511fd3797c7168f9ecd4bc0ef662",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
29
29
|
"@babel/preset-env": "^7.15.8",
|
package/tooltip/foundation.ts
CHANGED
|
@@ -1002,19 +1002,24 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
1002
1002
|
// 上下方向 top and bottom
|
|
1003
1003
|
if (this.isTB(position)){
|
|
1004
1004
|
isHeightOverFlow = isViewYOverFlow && isContainerYOverFlow;
|
|
1005
|
+
// Related PR: https://github.com/DouyinFE/semi-design/pull/1297
|
|
1006
|
+
// If clientRight or restClientRight less than 0, means that the left and right parts of the trigger are blocked
|
|
1007
|
+
// Then the display of the wrapper will also be affected, make width overflow to offset the wrapper
|
|
1005
1008
|
if (position === 'top' || position === 'bottom') {
|
|
1006
|
-
isWidthOverFlow = isViewXOverFlowSideHalf && isContainerXOverFlowSideHalf;
|
|
1009
|
+
isWidthOverFlow = isViewXOverFlowSideHalf && isContainerXOverFlowSideHalf || (clientRight < 0 || restClientRight < 0);
|
|
1007
1010
|
} else {
|
|
1008
|
-
isWidthOverFlow = isViewXOverFlowSide && isContainerXOverFlowSide;
|
|
1011
|
+
isWidthOverFlow = isViewXOverFlowSide && isContainerXOverFlowSide || (clientRight < 0 || restClientRight < 0);
|
|
1009
1012
|
}
|
|
1010
1013
|
}
|
|
1011
1014
|
// 左右方向 left and right
|
|
1012
1015
|
if (this.isLR(position)){
|
|
1013
1016
|
isWidthOverFlow = isViewXOverFlow && isContainerXOverFlow;
|
|
1017
|
+
// If clientTop or restClientTop less than 0, means that the top and bottom parts of the trigger are blocked
|
|
1018
|
+
// Then the display of the wrapper will also be affected, make height overflow to offset the wrapper
|
|
1014
1019
|
if (position === 'left' || position === 'right') {
|
|
1015
|
-
isHeightOverFlow = isViewYOverFlowSideHalf && isContainerYOverFlowSideHalf;
|
|
1020
|
+
isHeightOverFlow = isViewYOverFlowSideHalf && isContainerYOverFlowSideHalf || (clientTop < 0 || restClientTop < 0);
|
|
1016
1021
|
} else {
|
|
1017
|
-
isHeightOverFlow = isViewYOverFlowSide && isContainerYOverFlowSide;
|
|
1022
|
+
isHeightOverFlow = isViewYOverFlowSide && isContainerYOverFlowSide || (clientTop < 0 || restClientTop < 0);
|
|
1018
1023
|
}
|
|
1019
1024
|
}
|
|
1020
1025
|
}
|