@douyinfe/semi-foundation 2.8.2 → 2.9.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/avatar/avatar.scss +2 -7
- package/avatar/rtl.scss +2 -8
- package/cascader/constants.ts +1 -1
- package/divider/constants.ts +16 -0
- package/divider/divider.scss +80 -0
- package/divider/variables.scss +25 -0
- package/form/form.scss +0 -1
- package/lib/cjs/avatar/avatar.css +4 -15
- package/lib/cjs/avatar/avatar.scss +2 -7
- package/lib/cjs/avatar/rtl.scss +2 -8
- package/lib/cjs/cascader/constants.d.ts +1 -1
- package/lib/cjs/cascader/constants.js +1 -1
- package/lib/cjs/divider/constants.d.ts +7 -0
- package/lib/cjs/divider/constants.js +20 -0
- package/lib/cjs/divider/divider.css +60 -0
- package/lib/cjs/divider/divider.scss +80 -0
- package/lib/cjs/divider/variables.scss +25 -0
- package/lib/cjs/form/form.css +0 -1
- package/lib/cjs/form/form.scss +0 -1
- package/lib/cjs/slider/foundation.d.ts +3 -2
- package/lib/cjs/slider/foundation.js +38 -3
- package/lib/cjs/tagInput/constants.d.ts +1 -1
- package/lib/cjs/tagInput/constants.js +1 -1
- package/lib/cjs/tagInput/foundation.js +6 -2
- package/lib/cjs/transfer/transfer.css +1 -1
- package/lib/cjs/transfer/transfer.scss +1 -1
- package/lib/es/avatar/avatar.css +4 -15
- package/lib/es/avatar/avatar.scss +2 -7
- package/lib/es/avatar/rtl.scss +2 -8
- package/lib/es/cascader/constants.d.ts +1 -1
- package/lib/es/cascader/constants.js +1 -1
- package/lib/es/divider/constants.d.ts +7 -0
- package/lib/es/divider/constants.js +8 -0
- package/lib/es/divider/divider.css +60 -0
- package/lib/es/divider/divider.scss +80 -0
- package/lib/es/divider/variables.scss +25 -0
- package/lib/es/form/form.css +0 -1
- package/lib/es/form/form.scss +0 -1
- package/lib/es/slider/foundation.d.ts +3 -2
- package/lib/es/slider/foundation.js +38 -3
- package/lib/es/tagInput/constants.d.ts +1 -1
- package/lib/es/tagInput/constants.js +1 -1
- package/lib/es/tagInput/foundation.js +6 -2
- package/lib/es/transfer/transfer.css +1 -1
- package/lib/es/transfer/transfer.scss +1 -1
- package/package.json +3 -3
- package/slider/foundation.ts +37 -5
- package/tagInput/constants.ts +1 -1
- package/tagInput/foundation.ts +5 -2
- package/transfer/transfer.scss +1 -1
package/lib/es/avatar/avatar.css
CHANGED
|
@@ -20,12 +20,7 @@
|
|
|
20
20
|
font-weight: 600;
|
|
21
21
|
}
|
|
22
22
|
.semi-avatar-content {
|
|
23
|
-
position: absolute;
|
|
24
23
|
user-select: none;
|
|
25
|
-
left: 50%;
|
|
26
|
-
top: 50%;
|
|
27
|
-
transform: translate(-50%, -50%);
|
|
28
|
-
transform-origin: center;
|
|
29
24
|
}
|
|
30
25
|
.semi-avatar-extra-extra-small {
|
|
31
26
|
width: 20px;
|
|
@@ -33,7 +28,7 @@
|
|
|
33
28
|
}
|
|
34
29
|
.semi-avatar-extra-extra-small .semi-avatar-content {
|
|
35
30
|
transform-origin: center;
|
|
36
|
-
transform: scale(0.8)
|
|
31
|
+
transform: scale(0.8);
|
|
37
32
|
}
|
|
38
33
|
.semi-avatar-extra-extra-small .semi-avatar-label {
|
|
39
34
|
font-size: 10px;
|
|
@@ -45,7 +40,7 @@
|
|
|
45
40
|
}
|
|
46
41
|
.semi-avatar-extra-small .semi-avatar-content {
|
|
47
42
|
transform-origin: center;
|
|
48
|
-
transform: scale(0.8)
|
|
43
|
+
transform: scale(0.8);
|
|
49
44
|
}
|
|
50
45
|
.semi-avatar-extra-small .semi-avatar-label {
|
|
51
46
|
font-size: 10px;
|
|
@@ -369,19 +364,13 @@
|
|
|
369
364
|
.semi-portal-rtl .semi-avatar {
|
|
370
365
|
direction: rtl;
|
|
371
366
|
}
|
|
372
|
-
.semi-rtl .semi-avatar-content,
|
|
373
|
-
.semi-portal-rtl .semi-avatar-content {
|
|
374
|
-
left: auto;
|
|
375
|
-
right: 50%;
|
|
376
|
-
transform: translate(50%, -50%);
|
|
377
|
-
}
|
|
378
367
|
.semi-rtl .semi-avatar-extra-extra-small .semi-avatar-content,
|
|
379
368
|
.semi-portal-rtl .semi-avatar-extra-extra-small .semi-avatar-content {
|
|
380
|
-
transform: scale(0.8)
|
|
369
|
+
transform: scale(0.8);
|
|
381
370
|
}
|
|
382
371
|
.semi-rtl .semi-avatar-extra-small .semi-avatar-content,
|
|
383
372
|
.semi-portal-rtl .semi-avatar-extra-small .semi-avatar-content {
|
|
384
|
-
transform: scale(0.8)
|
|
373
|
+
transform: scale(0.8);
|
|
385
374
|
}
|
|
386
375
|
.semi-rtl .semi-avatar-hover,
|
|
387
376
|
.semi-portal-rtl .semi-avatar-hover {
|
|
@@ -24,12 +24,7 @@ $colors: "amber", "blue", "cyan", "green", "grey", "indigo", "light-blue", "ligh
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
&-content {
|
|
27
|
-
position: absolute;
|
|
28
27
|
user-select: none;
|
|
29
|
-
left: 50%;
|
|
30
|
-
top: 50%;
|
|
31
|
-
transform: translate(-50%, -50%);
|
|
32
|
-
transform-origin: center;
|
|
33
28
|
}
|
|
34
29
|
|
|
35
30
|
&-extra-extra-small {
|
|
@@ -38,7 +33,7 @@ $colors: "amber", "blue", "cyan", "green", "grey", "indigo", "light-blue", "ligh
|
|
|
38
33
|
|
|
39
34
|
.#{$module}-content {
|
|
40
35
|
transform-origin: center;
|
|
41
|
-
transform: scale(.8)
|
|
36
|
+
transform: scale(0.8);
|
|
42
37
|
}
|
|
43
38
|
|
|
44
39
|
.#{$module}-label {
|
|
@@ -53,7 +48,7 @@ $colors: "amber", "blue", "cyan", "green", "grey", "indigo", "light-blue", "ligh
|
|
|
53
48
|
|
|
54
49
|
.#{$module}-content {
|
|
55
50
|
transform-origin: center;
|
|
56
|
-
transform: scale(.8)
|
|
51
|
+
transform: scale(0.8);
|
|
57
52
|
}
|
|
58
53
|
|
|
59
54
|
.#{$module}-label {
|
package/lib/es/avatar/rtl.scss
CHANGED
|
@@ -4,22 +4,16 @@ $module: #{$prefix}-avatar;
|
|
|
4
4
|
.#{$prefix}-portal-rtl {
|
|
5
5
|
.#{$module} {
|
|
6
6
|
direction: rtl;
|
|
7
|
-
|
|
8
|
-
&-content {
|
|
9
|
-
left: auto;
|
|
10
|
-
right: 50%;
|
|
11
|
-
transform: translate(50%, -50%);
|
|
12
|
-
}
|
|
13
7
|
|
|
14
8
|
&-extra-extra-small {
|
|
15
9
|
.#{$module}-content {
|
|
16
|
-
transform: scale(.8)
|
|
10
|
+
transform: scale(0.8);
|
|
17
11
|
}
|
|
18
12
|
}
|
|
19
13
|
|
|
20
14
|
&-extra-small {
|
|
21
15
|
.#{$module}-content {
|
|
22
|
-
transform: scale(.8)
|
|
16
|
+
transform: scale(0.8);
|
|
23
17
|
}
|
|
24
18
|
}
|
|
25
19
|
|
|
@@ -4,7 +4,7 @@ declare const cssClasses: {
|
|
|
4
4
|
};
|
|
5
5
|
declare const strings: {
|
|
6
6
|
readonly SIZE_SET: readonly ["small", "large", "default"];
|
|
7
|
-
readonly VALIDATE_STATUS: readonly ["default", "error", "warning"];
|
|
7
|
+
readonly VALIDATE_STATUS: readonly ["success", "default", "error", "warning"];
|
|
8
8
|
readonly IS_KEY: "isKey";
|
|
9
9
|
readonly IS_VALUE: "isValue";
|
|
10
10
|
readonly SHOW_NEXT_BY_CLICK: "click";
|
|
@@ -5,7 +5,7 @@ const cssClasses = {
|
|
|
5
5
|
};
|
|
6
6
|
const strings = {
|
|
7
7
|
SIZE_SET: ['small', 'large', 'default'],
|
|
8
|
-
VALIDATE_STATUS: ['default', 'error', 'warning'],
|
|
8
|
+
VALIDATE_STATUS: ['success', 'default', 'error', 'warning'],
|
|
9
9
|
IS_KEY: 'isKey',
|
|
10
10
|
IS_VALUE: 'isValue',
|
|
11
11
|
SHOW_NEXT_BY_CLICK: 'click',
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* shadow */
|
|
2
|
+
/* sizing */
|
|
3
|
+
/* spacing */
|
|
4
|
+
.semi-divider {
|
|
5
|
+
margin: 1px 0px 1px 0px;
|
|
6
|
+
border-bottom: 1px solid var(--semi-color-border);
|
|
7
|
+
color: var(--semi-color-text-0);
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
}
|
|
10
|
+
.semi-divider-dashed {
|
|
11
|
+
border-bottom-style: dashed;
|
|
12
|
+
}
|
|
13
|
+
.semi-divider-horizontal {
|
|
14
|
+
width: 100%;
|
|
15
|
+
display: flex;
|
|
16
|
+
}
|
|
17
|
+
.semi-divider-vertical {
|
|
18
|
+
border-bottom: 0;
|
|
19
|
+
display: inline-block;
|
|
20
|
+
margin: 0px 1px 0px 1px;
|
|
21
|
+
border-left: 1px solid var(--semi-color-border);
|
|
22
|
+
height: 20px;
|
|
23
|
+
vertical-align: middle;
|
|
24
|
+
}
|
|
25
|
+
.semi-divider-with-text {
|
|
26
|
+
display: flex;
|
|
27
|
+
border-bottom: 0;
|
|
28
|
+
white-space: nowrap;
|
|
29
|
+
align-items: center;
|
|
30
|
+
}
|
|
31
|
+
.semi-divider-with-text .semi-divider_inner-text {
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
padding: 0px 8px 0px 8px;
|
|
34
|
+
display: inline-block;
|
|
35
|
+
}
|
|
36
|
+
.semi-divider-with-text::before, .semi-divider-with-text::after {
|
|
37
|
+
content: "";
|
|
38
|
+
width: 50%;
|
|
39
|
+
border-bottom: 1px solid var(--semi-color-border);
|
|
40
|
+
}
|
|
41
|
+
.semi-divider-with-text-left::before {
|
|
42
|
+
width: 40px;
|
|
43
|
+
}
|
|
44
|
+
.semi-divider-with-text-left::after {
|
|
45
|
+
flex: 1;
|
|
46
|
+
}
|
|
47
|
+
.semi-divider-with-text-right::before {
|
|
48
|
+
flex: 1;
|
|
49
|
+
}
|
|
50
|
+
.semi-divider-with-text-right::after {
|
|
51
|
+
width: 40px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.semi-divider-dashed::before, .semi-divider-dashed::after {
|
|
55
|
+
border-bottom: 1px dashed var(--semi-color-border);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.semi-divider-vertical.semi-divider-dashed {
|
|
59
|
+
border-left: 1px dashed var(--semi-color-border);
|
|
60
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
@import './variables.scss';
|
|
2
|
+
|
|
3
|
+
$module: #{$prefix}-divider;
|
|
4
|
+
|
|
5
|
+
.#{$module} {
|
|
6
|
+
margin: $spacing-divider_horizontal-marginTop $spacing-divider_horizontal-marginRight $spacing-divider_horizontal-marginBottom $spacing-divider_horizontal-marginLeft;
|
|
7
|
+
border-bottom: $width-divider-border solid $color-divider_border-color;
|
|
8
|
+
color: $color-divider_text-default;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
|
|
11
|
+
&-dashed {
|
|
12
|
+
border-bottom-style: dashed;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&-horizontal {
|
|
16
|
+
width: 100%;
|
|
17
|
+
display: flex;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&-vertical {
|
|
21
|
+
border-bottom: 0;
|
|
22
|
+
display: inline-block;
|
|
23
|
+
margin: $spacing-divider_vertical-marginTop $spacing-divider_vertical-marginRight $spacing-divider_vertical-marginBottom $spacing-divider_vertical-marginLeft;
|
|
24
|
+
border-left: $width-divider-border solid $color-divider_border-color;
|
|
25
|
+
height: $height-divider_vertical;
|
|
26
|
+
vertical-align: middle;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&-with-text {
|
|
30
|
+
display: flex;
|
|
31
|
+
border-bottom: 0;
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
align-items: center;
|
|
34
|
+
|
|
35
|
+
.#{$module}_inner-text {
|
|
36
|
+
font-weight: $font-divider_text-weight;
|
|
37
|
+
padding: $spacing-divider_inner-text-paddingTop $spacing-divider_inner-text-paddingRight $spacing-divider_inner-text-paddingBottom $spacing-divider_inner-text-paddingLeft;
|
|
38
|
+
display: inline-block;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
&::before,
|
|
43
|
+
&::after {
|
|
44
|
+
content: "";
|
|
45
|
+
width: 50%;
|
|
46
|
+
border-bottom: $width-divider-border solid $color-divider_border-color;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&-left {
|
|
50
|
+
&::before {
|
|
51
|
+
width: $width-divider_inner_text_left_line;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&::after {
|
|
55
|
+
flex: 1;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&-right {
|
|
60
|
+
&::before {
|
|
61
|
+
flex: 1;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&::after {
|
|
65
|
+
width: $width-divider_inner_text_right_line;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.#{$module}-dashed {
|
|
72
|
+
&::before,
|
|
73
|
+
&::after {
|
|
74
|
+
border-bottom: $width-divider-border dashed $color-divider_border-color;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.#{$module}-vertical.#{$module}-dashed {
|
|
79
|
+
border-left: $width-divider-border dashed $color-divider_border-color;
|
|
80
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
$spacing-divider_horizontal-marginLeft: 0px; // 水平模式左间距
|
|
2
|
+
$spacing-divider_horizontal-marginRight: 0px; // 水平模式右间距
|
|
3
|
+
$spacing-divider_horizontal-marginTop: 1px; // 水平模式上间距
|
|
4
|
+
$spacing-divider_horizontal-marginBottom: 1px; // 水平模式下间距
|
|
5
|
+
$spacing-divider_vertical-marginLeft: 1px; //垂直模式左间距
|
|
6
|
+
$spacing-divider_vertical-marginRight: 1px; //垂直模式右间距
|
|
7
|
+
$spacing-divider_vertical-marginTop: 0px; //垂直模式上间距
|
|
8
|
+
$spacing-divider_vertical-marginBottom: 0px; //垂直模式下间距
|
|
9
|
+
$spacing-divider_inner_text-paddingLeft: 8px; //内容为纯文字时内容左间距
|
|
10
|
+
$spacing-divider_inner_text-paddingRight: 8px; //内容为纯文字时内容右间距
|
|
11
|
+
$spacing-divider_inner_text-paddingTop: 0px; //内容为纯文字时内容上间距
|
|
12
|
+
$spacing-divider_inner_text-paddingBottom: 0px; //内容为纯文字时内容下间距
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
$width-divider_inner_text_left_line: 40px; //左对齐文字时左间距宽度
|
|
16
|
+
$width-divider_inner_text_right_line: 40px; //右对齐文字时右间距宽度
|
|
17
|
+
$width-divider-border: 1px; // 分割线宽度
|
|
18
|
+
$height-divider_vertical: 20px;// 垂直分割线高度
|
|
19
|
+
|
|
20
|
+
$color-divider_border-color: var(--semi-color-border); // 分割线颜色
|
|
21
|
+
$color-divider_text-default: var(--semi-color-text-0); // 标题颜色
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
$font-divider_text-weight: $font-weight-bold; // 分割线文字字重
|
package/lib/es/form/form.css
CHANGED
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
line-height: 20px;
|
|
48
48
|
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
49
49
|
flex-shrink: 0;
|
|
50
|
-
user-select: none;
|
|
51
50
|
}
|
|
52
51
|
.semi-form-field-label-disabled {
|
|
53
52
|
color: var(--semi-color-disabled-text);
|
package/lib/es/form/form.scss
CHANGED
|
@@ -74,7 +74,7 @@ export interface SliderAdapter extends DefaultAdapter<SliderProps, SliderState>
|
|
|
74
74
|
current: HTMLElement;
|
|
75
75
|
};
|
|
76
76
|
onHandleDown: (e: any) => any;
|
|
77
|
-
onHandleMove: (mousePos: number, isMin: boolean, stateChangeCallback?: () => void, clickTrack?: boolean) => boolean | void;
|
|
77
|
+
onHandleMove: (mousePos: number, isMin: boolean, stateChangeCallback?: () => void, clickTrack?: boolean, outPutValue?: number | number[]) => boolean | void;
|
|
78
78
|
setEventDefault: (e: any) => void;
|
|
79
79
|
setStateVal: (state: keyof SliderState, value: any) => void;
|
|
80
80
|
onHandleEnter: (position: SliderState['focusPos']) => void;
|
|
@@ -175,6 +175,7 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
175
175
|
outPutValue: (inputValue: SliderProps['value']) => number | number[];
|
|
176
176
|
handleDisabledChange: (disabled: SliderState['disabled']) => void;
|
|
177
177
|
checkAndUpdateIsInRenderTreeState: () => boolean;
|
|
178
|
+
calculateOutputValue: (position: number, isMin: boolean) => undefined | number | number[];
|
|
178
179
|
/**
|
|
179
180
|
*
|
|
180
181
|
*
|
|
@@ -195,7 +196,7 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
195
196
|
*
|
|
196
197
|
* @memberof SliderFoundation
|
|
197
198
|
*/
|
|
198
|
-
setHandlePos: (position: number, isMin: boolean, clickTrack
|
|
199
|
+
setHandlePos: (position: number, isMin: boolean, clickTrack: boolean, outPutValue: number | number[]) => void;
|
|
199
200
|
/**
|
|
200
201
|
* Determine which slider should be moved currently
|
|
201
202
|
*
|
|
@@ -385,6 +385,16 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
385
385
|
};
|
|
386
386
|
|
|
387
387
|
this.checkAndUpdateIsInRenderTreeState = () => this._adapter.checkAndUpdateIsInRenderTreeState();
|
|
388
|
+
|
|
389
|
+
this.calculateOutputValue = (position, isMin) => {
|
|
390
|
+
const moveValue = this.transPosToValue(position, isMin);
|
|
391
|
+
|
|
392
|
+
if (moveValue === false) {
|
|
393
|
+
return undefined;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
return this.outPutValue(moveValue);
|
|
397
|
+
};
|
|
388
398
|
/**
|
|
389
399
|
*
|
|
390
400
|
*
|
|
@@ -500,7 +510,16 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
500
510
|
pagePos = pagePos - this._dragOffset;
|
|
501
511
|
|
|
502
512
|
if (chooseMovePos === 'min' && dragging[0] || chooseMovePos === 'max' && dragging[1]) {
|
|
503
|
-
this.
|
|
513
|
+
const outPutValue = this.calculateOutputValue(pagePos, chooseMovePos === 'min');
|
|
514
|
+
|
|
515
|
+
if (outPutValue === undefined) {
|
|
516
|
+
return false;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
this._adapter.notifyChange(outPutValue); // allow drag for controlled component, so no _isControlledComponent check
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
this._adapter.onHandleMove(pagePos, chooseMovePos === 'min', undefined, false, outPutValue);
|
|
504
523
|
}
|
|
505
524
|
|
|
506
525
|
return true;
|
|
@@ -607,7 +626,22 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
607
626
|
const mousePos = this.handleMousePos(e.pageX, e.pageY);
|
|
608
627
|
const position = vertical ? mousePos.y : mousePos.x;
|
|
609
628
|
const isMin = this.checkWhichHandle(position);
|
|
610
|
-
this.
|
|
629
|
+
const outPutValue = this.calculateOutputValue(position, isMin);
|
|
630
|
+
|
|
631
|
+
if (outPutValue === undefined) {
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
this._adapter.notifyChange(outPutValue); // check if is controlled component
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
if (this._isControlledComponent()) {
|
|
639
|
+
// only perform callback ops, skip UI update
|
|
640
|
+
return;
|
|
641
|
+
} // trigger UI state update
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
this.setHandlePos(position, isMin, true, outPutValue);
|
|
611
645
|
};
|
|
612
646
|
/**
|
|
613
647
|
* Move the slider to the current click position
|
|
@@ -618,8 +652,9 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
618
652
|
|
|
619
653
|
this.setHandlePos = function (position, isMin) {
|
|
620
654
|
let clickTrack = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
655
|
+
let outPutValue = arguments.length > 3 ? arguments[3] : undefined;
|
|
621
656
|
|
|
622
|
-
_this._adapter.onHandleMove(position, isMin, () => _this._adapter.onHandleUpAfter(), clickTrack);
|
|
657
|
+
_this._adapter.onHandleMove(position, isMin, () => _this._adapter.onHandleUpAfter(), clickTrack, outPutValue);
|
|
623
658
|
};
|
|
624
659
|
/**
|
|
625
660
|
* Determine which slider should be moved currently
|
|
@@ -3,6 +3,6 @@ declare const cssClasses: {
|
|
|
3
3
|
};
|
|
4
4
|
declare const strings: {
|
|
5
5
|
readonly SIZE_SET: readonly ["large", "default", "small"];
|
|
6
|
-
readonly STATUS: readonly ["default", "error", "warning"];
|
|
6
|
+
readonly STATUS: readonly ["success", "default", "error", "warning"];
|
|
7
7
|
};
|
|
8
8
|
export { cssClasses, strings };
|
|
@@ -82,8 +82,12 @@ class TagInputFoundation extends BaseFoundation {
|
|
|
82
82
|
|
|
83
83
|
const code = e.keyCode;
|
|
84
84
|
|
|
85
|
-
if (code === keyCode.ENTER
|
|
86
|
-
|
|
85
|
+
if (code === keyCode.ENTER) {
|
|
86
|
+
e.preventDefault(); // prevent trigger submit when using in form
|
|
87
|
+
|
|
88
|
+
if (inputValue !== '') {
|
|
89
|
+
this._handleAddTags(e);
|
|
90
|
+
}
|
|
87
91
|
}
|
|
88
92
|
|
|
89
93
|
const {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
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.
|
|
11
|
+
"@douyinfe/semi-animation": "2.9.0",
|
|
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": "22b74e58077b068daa6b35bc8b32f47a064734a3",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
30
30
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
package/slider/foundation.ts
CHANGED
|
@@ -83,7 +83,7 @@ export interface SliderAdapter extends DefaultAdapter<SliderProps, SliderState>{
|
|
|
83
83
|
getMinHandleEl: () => { current: HTMLElement };
|
|
84
84
|
getMaxHandleEl: () => { current: HTMLElement };
|
|
85
85
|
onHandleDown: (e: any) => any;
|
|
86
|
-
onHandleMove: (mousePos: number, isMin: boolean, stateChangeCallback?: () => void, clickTrack?: boolean) => boolean | void;
|
|
86
|
+
onHandleMove: (mousePos: number, isMin: boolean, stateChangeCallback?: () => void, clickTrack?: boolean, outPutValue?: number | number[]) => boolean | void;
|
|
87
87
|
setEventDefault: (e: any) => void;
|
|
88
88
|
setStateVal: (state: keyof SliderState, value: any) => void;
|
|
89
89
|
onHandleEnter: (position: SliderState['focusPos']) => void;
|
|
@@ -406,6 +406,14 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
406
406
|
|
|
407
407
|
checkAndUpdateIsInRenderTreeState = () => this._adapter.checkAndUpdateIsInRenderTreeState();
|
|
408
408
|
|
|
409
|
+
calculateOutputValue = (position: number, isMin: boolean): undefined | number | number[] => {
|
|
410
|
+
const moveValue = this.transPosToValue(position, isMin);
|
|
411
|
+
if (moveValue === false) {
|
|
412
|
+
return undefined;
|
|
413
|
+
}
|
|
414
|
+
return this.outPutValue(moveValue);
|
|
415
|
+
}
|
|
416
|
+
|
|
409
417
|
/**
|
|
410
418
|
*
|
|
411
419
|
*
|
|
@@ -487,7 +495,16 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
487
495
|
let pagePos = vertical ? mousePos.y : mousePos.x;
|
|
488
496
|
pagePos = pagePos - this._dragOffset;
|
|
489
497
|
if ((chooseMovePos === 'min' && dragging[0]) || (chooseMovePos === 'max' && dragging[1])) {
|
|
490
|
-
this.
|
|
498
|
+
const outPutValue = this.calculateOutputValue(pagePos, chooseMovePos === 'min' );
|
|
499
|
+
|
|
500
|
+
if (outPutValue === undefined) {
|
|
501
|
+
return false;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
this._adapter.notifyChange(outPutValue);
|
|
505
|
+
|
|
506
|
+
// allow drag for controlled component, so no _isControlledComponent check
|
|
507
|
+
this._adapter.onHandleMove(pagePos, chooseMovePos === 'min', undefined, false, outPutValue);
|
|
491
508
|
}
|
|
492
509
|
return true;
|
|
493
510
|
};
|
|
@@ -565,7 +582,22 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
565
582
|
const mousePos = this.handleMousePos(e.pageX, e.pageY);
|
|
566
583
|
const position = vertical ? mousePos.y : mousePos.x;
|
|
567
584
|
const isMin = this.checkWhichHandle(position);
|
|
568
|
-
|
|
585
|
+
|
|
586
|
+
const outPutValue = this.calculateOutputValue(position, isMin);
|
|
587
|
+
if (outPutValue === undefined) {
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
this._adapter.notifyChange(outPutValue);
|
|
592
|
+
|
|
593
|
+
// check if is controlled component
|
|
594
|
+
if (this._isControlledComponent()) {
|
|
595
|
+
// only perform callback ops, skip UI update
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
// trigger UI state update
|
|
600
|
+
this.setHandlePos(position, isMin, true, outPutValue);
|
|
569
601
|
};
|
|
570
602
|
|
|
571
603
|
/**
|
|
@@ -573,8 +605,8 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
573
605
|
*
|
|
574
606
|
* @memberof SliderFoundation
|
|
575
607
|
*/
|
|
576
|
-
setHandlePos = (position: number, isMin: boolean, clickTrack = false) => {
|
|
577
|
-
this._adapter.onHandleMove(position, isMin, () => this._adapter.onHandleUpAfter(), clickTrack);
|
|
608
|
+
setHandlePos = (position: number, isMin: boolean, clickTrack = false, outPutValue: number | number[]) => {
|
|
609
|
+
this._adapter.onHandleMove(position, isMin, () => this._adapter.onHandleUpAfter(), clickTrack, outPutValue);
|
|
578
610
|
};
|
|
579
611
|
|
|
580
612
|
/**
|
package/tagInput/constants.ts
CHANGED
package/tagInput/foundation.ts
CHANGED
|
@@ -83,8 +83,11 @@ class TagInputFoundation extends BaseFoundation<TagInputAdapter> {
|
|
|
83
83
|
tagsArray
|
|
84
84
|
} = this._adapter.getStates();
|
|
85
85
|
const code = e.keyCode;
|
|
86
|
-
if (code === keyCode.ENTER
|
|
87
|
-
|
|
86
|
+
if (code === keyCode.ENTER) {
|
|
87
|
+
e.preventDefault(); // prevent trigger submit when using in form
|
|
88
|
+
if (inputValue !== '') {
|
|
89
|
+
this._handleAddTags(e);
|
|
90
|
+
}
|
|
88
91
|
}
|
|
89
92
|
const { length } = tagsArray;
|
|
90
93
|
if (code === keyCode.BACKSPACE && inputValue === '' && length > 0) {
|