@douyinfe/semi-foundation 2.8.0 → 2.9.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/avatar/avatar.scss +2 -7
  2. package/avatar/rtl.scss +2 -8
  3. package/cascader/constants.ts +1 -1
  4. package/datePicker/variables.scss +2 -2
  5. package/divider/constants.ts +16 -0
  6. package/divider/divider.scss +80 -0
  7. package/divider/variables.scss +25 -0
  8. package/form/variables.scss +16 -16
  9. package/input/variables.scss +4 -4
  10. package/lib/cjs/avatar/avatar.css +4 -15
  11. package/lib/cjs/avatar/avatar.scss +2 -7
  12. package/lib/cjs/avatar/rtl.scss +2 -8
  13. package/lib/cjs/cascader/constants.d.ts +1 -1
  14. package/lib/cjs/cascader/constants.js +1 -1
  15. package/lib/cjs/datePicker/variables.scss +2 -2
  16. package/lib/cjs/divider/constants.d.ts +7 -0
  17. package/lib/cjs/divider/constants.js +20 -0
  18. package/lib/cjs/divider/divider.css +60 -0
  19. package/lib/cjs/divider/divider.scss +80 -0
  20. package/lib/cjs/divider/variables.scss +25 -0
  21. package/lib/cjs/form/variables.scss +16 -16
  22. package/lib/cjs/input/variables.scss +4 -4
  23. package/lib/cjs/popover/variables.scss +5 -7
  24. package/lib/cjs/scrollList/variables.scss +2 -2
  25. package/lib/cjs/select/variables.scss +2 -2
  26. package/lib/cjs/slider/foundation.d.ts +3 -2
  27. package/lib/cjs/slider/foundation.js +38 -3
  28. package/lib/cjs/tabs/tabs.css +1 -1
  29. package/lib/cjs/tabs/variables.scss +4 -4
  30. package/lib/cjs/tagInput/constants.d.ts +1 -1
  31. package/lib/cjs/tagInput/constants.js +1 -1
  32. package/lib/cjs/tooltip/variables.scss +7 -6
  33. package/lib/es/avatar/avatar.css +4 -15
  34. package/lib/es/avatar/avatar.scss +2 -7
  35. package/lib/es/avatar/rtl.scss +2 -8
  36. package/lib/es/cascader/constants.d.ts +1 -1
  37. package/lib/es/cascader/constants.js +1 -1
  38. package/lib/es/datePicker/variables.scss +2 -2
  39. package/lib/es/divider/constants.d.ts +7 -0
  40. package/lib/es/divider/constants.js +8 -0
  41. package/lib/es/divider/divider.css +60 -0
  42. package/lib/es/divider/divider.scss +80 -0
  43. package/lib/es/divider/variables.scss +25 -0
  44. package/lib/es/form/variables.scss +16 -16
  45. package/lib/es/input/variables.scss +4 -4
  46. package/lib/es/popover/variables.scss +5 -7
  47. package/lib/es/scrollList/variables.scss +2 -2
  48. package/lib/es/select/variables.scss +2 -2
  49. package/lib/es/slider/foundation.d.ts +3 -2
  50. package/lib/es/slider/foundation.js +38 -3
  51. package/lib/es/tabs/tabs.css +1 -1
  52. package/lib/es/tabs/variables.scss +4 -4
  53. package/lib/es/tagInput/constants.d.ts +1 -1
  54. package/lib/es/tagInput/constants.js +1 -1
  55. package/lib/es/tooltip/variables.scss +7 -6
  56. package/package.json +3 -3
  57. package/popover/variables.scss +5 -7
  58. package/scrollList/variables.scss +2 -2
  59. package/select/variables.scss +2 -2
  60. package/slider/foundation.ts +37 -5
  61. package/tabs/variables.scss +4 -4
  62. package/tagInput/constants.ts +1 -1
  63. package/tooltip/variables.scss +7 -6
@@ -1,24 +1,24 @@
1
- $spacing-form_label-paddingTop: ($height-control-default - 20) / 2; // 水平布局表单标题顶部内边距
2
- $spacing-form_label_small-paddingTop: ($height-control-default - 24) / 2; // 水平布局 小尺寸表单标题顶部内边距
1
+ $spacing-form_label-paddingTop: ($height-control-default - 20px) / 2; // 水平布局表单标题顶部内边距
2
+ $spacing-form_label_small-paddingTop: ($height-control-default - 24px) / 2; // 水平布局 小尺寸表单标题顶部内边距
3
3
 
4
4
  $spacing-form_field_horizontal-paddingRight: $spacing-base; // 水平布局表单标题右侧内边距
5
- $spacing-form_field_group_horizontal-paddingRight: $spacing-base; // 水平布局表单组标题右侧内边距
5
+ $spacing-form_field_group_horizontal-paddingRight: $spacing-base; // 水平布局表单组标题右侧内边距
6
6
 
7
7
  $spacing-form_field_vertical-paddingTop: $spacing-base-tight; // 垂直布局表单顶部内边距
8
8
  $spacing-form_field_vertical-paddingBottom: $spacing-base-tight; // 垂直布局表单底部内边距
9
9
 
10
- $spacing-form_field_group_vertical-paddingTop: $spacing-base-tight; // 垂直布局表单组顶部内边距
11
- $spacing-form_field_group_vertical-paddingBottom: $spacing-base-tight; // 垂直布局表单组底部内边距
12
- $spacing-form_section-marginTop: $spacing-super-loose - $spacing-base-tight; // 表单分组顶部内边距
13
- $spacing-form_section_text-paddingBottom: $spacing-tight; // 表单分组标题底部内边距
14
- $spacing-form_section_text-marginBottom: $spacing-extra-tight; // 表单分组标题底部外边距
15
-
16
- $spacing-form_label-paddingRight: $spacing-base; // 表单标题右侧内边距
17
- $spacing-form_label-marginBottom: $spacing-extra-tight; // 表单标题底部外边距
18
- $spacing-form_label_extra-marginLeft: $spacing-extra-tight; // 表单标题图标左侧内边距
19
- $spacing-form_label_required-marginLeft: $spacing-extra-tight; // 表单标题必填标志左侧内边距
20
- $spacing-form_label_posLeft-marginRight: 0; // 水平布局表单标题右侧外边距
21
- $spacing-form_label_posLeft-marginBottom: 0; // 水平布局表单标题底部外边距
10
+ $spacing-form_field_group_vertical-paddingTop: $spacing-base-tight; // 垂直布局表单组顶部内边距
11
+ $spacing-form_field_group_vertical-paddingBottom: $spacing-base-tight; // 垂直布局表单组底部内边距
12
+ $spacing-form_section-marginTop: $spacing-super-loose - $spacing-base-tight; // 表单分组顶部内边距
13
+ $spacing-form_section_text-paddingBottom: $spacing-tight; // 表单分组标题底部内边距
14
+ $spacing-form_section_text-marginBottom: $spacing-extra-tight; // 表单分组标题底部外边距
15
+
16
+ $spacing-form_label-paddingRight: $spacing-base; // 表单标题右侧内边距
17
+ $spacing-form_label-marginBottom: $spacing-extra-tight; // 表单标题底部外边距
18
+ $spacing-form_label_extra-marginLeft: $spacing-extra-tight; // 表单标题图标左侧内边距
19
+ $spacing-form_label_required-marginLeft: $spacing-extra-tight; // 表单标题必填标志左侧内边距
20
+ $spacing-form_label_posLeft-marginRight: 0; // 水平布局表单标题右侧外边距
21
+ $spacing-form_label_posLeft-marginBottom: 0; // 水平布局表单标题底部外边距
22
22
  $spacing-form_label_posTop-paddingTop: $spacing-extra-tight; // 垂直布局表单标题顶部内边距
23
23
  $spacing-form_label_posTop-paddingBottom: $spacing-extra-tight; // 垂直布局表单标题底部内边距
24
24
  $spacing-form_label_extra_posMid-marginTop: $spacing-extra-tight; // 表单额外信息辅助文字顶部外边距 - 居中
@@ -41,4 +41,4 @@ $color-form_alertIcon-icon-default: var(--semi-color-warning); // 警告表单
41
41
  $color-form_message_error-text-default: var(--semi-color-danger); // 错误表单项图标颜色
42
42
  $color-form_section-text-default: var(--semi-color-text-0); // 表单分组标题文字颜色
43
43
  $color-form_section-border-default: var(--semi-color-border); // 表单分组描边颜色
44
- $width-form_section-border: $border-thickness-control; // 表单分组描边宽度
44
+ $width-form_section-border: $border-thickness-control; // 表单分组描边宽度
@@ -56,9 +56,9 @@ $color-input_counter_danger-text-default: var(--semi-color-danger); // 多行文
56
56
 
57
57
  $color-input_group-border-default: var(--semi-color-border); // 输入框组合分割线颜色
58
58
 
59
- $height-input_large: $height-control-large - 2; // 输入框高度 & 行高 - 大尺寸
60
- $height-input_small: $height-control-small - 2; // 输入框高度 & 行高 - 小尺寸
61
- $height-input_default: $height-control-default - 2; // 输入框高度 & 行高 - 默认尺寸
59
+ $height-input_large: $height-control-large - 2px; // 输入框高度 & 行高 - 大尺寸
60
+ $height-input_small: $height-control-small - 2px; // 输入框高度 & 行高 - 小尺寸
61
+ $height-input_default: $height-control-default - 2px; // 输入框高度 & 行高 - 默认尺寸
62
62
  $height-input_wrapper_large: $height-control-large;
63
63
  $height-input_wrapper_small: $height-control-small;
64
64
  $height-input_wrapper_default: $height-control-default;
@@ -72,7 +72,7 @@ $motion-scale_size-inactive: 1;
72
72
 
73
73
  $width-input_append-border: $border-thickness-control; // 后置标签描边宽度
74
74
  $width-input_prepend-border: $border-thickness-control; // 前置标签描边宽度
75
- $width-input_group_pseudo-border: $border-thickness-control;
75
+ $width-input_group_pseudo-border: $border-thickness-control;
76
76
  $width-input_wrapper-border: $border-thickness-control-focus; // 输入框描边宽度
77
77
  $width-input_wrapper_focus-border: $border-thickness-control-focus; // 输入框描边宽度 - 选中态
78
78
 
@@ -4,25 +4,23 @@ $color-popover-bg-default: var(--semi-color-bg-3); // 默认背景色
4
4
  $color-popover-border-default: var(--semi-color-border); // 默认描边颜色
5
5
 
6
6
  // Width/Height
7
- $width-popover_arrow: 24px; // 水平箭头宽度
7
+ $width-popover_arrow: 24px; // 水平箭头宽度 ignore-semi-css-trans
8
8
  $height-popover_arrow: 8px; // 水平箭头高度
9
9
  $height-popover_arrow_vertical: 24px; // 垂直箭头高度
10
10
  $width-popover_arrow_vertical: 8px; // 垂直箭头宽度
11
11
  $height-tooltip_arrow: $height-popover_arrow;
12
- $width-tooltip_arrow: $width-popover_arrow;
12
+ $width-tooltip_arrow: $width-popover_arrow; //ignore-semi-css-trans
13
13
  $width-tooltip_arrow_vertical: $width-popover_arrow_vertical;
14
14
  $height-tooltip_arrow_vertical: $height-popover_arrow_vertical;
15
- $width-popover_title-border: 1px;
15
+ $width-popover_title-border: 1px;
16
16
 
17
17
 
18
18
  // Spacing
19
19
  $spacing-popover_title-padding: 8px; // 气泡卡片标题内边距
20
20
  $spacing-popover_withArrow-padding: 12px; // 带箭头的气泡卡片标题内边距
21
- $spacing-popover_arrow_adjusted_offset-y: 6; // 垂直方向上的校正偏移量,主要修正三角形有棱角的问题
21
+ $spacing-popover_arrow_adjusted_offset-y: 6px; // 垂直方向上的校正偏移量,主要修正三角形有棱角的问题
22
22
  $spacing-tooltip_arrow_adjusted_offset-y: $spacing-popover_arrow_adjusted_offset-y; // 垂直方向上的校正偏移量,主要修正三角形有棱角的问题
23
- $spacing-tooltip_arrow_adjusted_offset-x: round(
24
- $horizontal-rate * $width-tooltip_arrow
25
- ); // 水平方向上的校正偏移量,主要修正三角形有棱角的问题
23
+ $spacing-tooltip_arrow_adjusted_offset-x: round($horizontal-rate * $width-tooltip_arrow); // 水平方向上的校正偏移量,主要修正三角形有棱角的问题 ignore-semi-css-trans
26
24
 
27
25
  // Radius
28
26
  $radius-popover: var(--semi-border-radius-medium); // 气泡卡片的圆角大小
@@ -13,7 +13,7 @@ $color-scrollList_selected_item-icon: var(--semi-color-text-2); // 滚动列表
13
13
  $color-scrollList_footer-border: var(--semi-color-border); // 滚动列表底部描边颜色
14
14
 
15
15
  // Width/Height
16
- $height-scrollList: 300px;
16
+ $height-scrollList: 300px;
17
17
  $height-scrollList_item: 36px;
18
18
  $width-scrollList_item-border: $border-thickness-control;
19
19
  $width-scrollList_item_sel_svg: 16px;
@@ -34,7 +34,7 @@ $spacing-scrollList_item_ul-margin: 0;
34
34
  $spacing-scrollList_item_ul-paddingBottom: ($height-scrollList - $height-scrollList_item) / 2;
35
35
  $spacing-scrollList_item_sel_svg-marginRight: 12px;
36
36
  $spacing-scrollList_item_wheel_list_outer-paddingRight: $height-scrollList_item / 2;
37
- $spacing-scrollList_item_wheel_list_shade_pre-marginTop: -($height-scrollList_item / 2 + $border-thickness-control);
37
+ $spacing-scrollList_item_wheel_list_shade_pre-marginTop: -1 * ($height-scrollList_item / 2 + $border-thickness-control);
38
38
  $spacing-scrollList_item_wheel_list_shade_post-marginTop: $height-scrollList_item / 2 + $border-thickness-control;
39
39
  $spacing-scrollList_footer-padding: 10px;
40
40
 
@@ -86,9 +86,9 @@ $spacing-select_option-paddingTop: $spacing-tight; // 选择器菜单项顶部
86
86
  $spacing-select_option-paddingBottom: $spacing-tight; // 选择器菜单项底部内边距
87
87
  $spacing-select_option_first-marginTop: $spacing-extra-tight; // 选择器第一个菜单项顶部外边距
88
88
  $spacing-select_option_last-marginBottom: $spacing-extra-tight; // 选择器最后一个菜单项顶部外边距
89
- $spacing-select_tag-marginTop: $spacing-super-tight - 1; // 多项选择器标签顶部外边距
89
+ $spacing-select_tag-marginTop: $spacing-super-tight - 1px; // 多项选择器标签顶部外边距
90
90
  $spacing-select_tag-marginRight: $spacing-extra-tight; // 多项选择器标签右侧外边距
91
- $spacing-select_tag-marginBottom: $spacing-super-tight - 1; // 多项选择器标签底部外边距
91
+ $spacing-select_tag-marginBottom: $spacing-super-tight - 1px; // 多项选择器标签底部外边距
92
92
  $spacing-select_selection-marginLeft: $spacing-base-tight; // 选择器内容区左侧外边距
93
93
  $spacing-select_insetLabel-marginRight: $spacing-base-tight; // 选择器内嵌标签右侧外边距
94
94
  $spacing-select_option_list-paddingTop: 0; // 选择器内容区顶部内边距
@@ -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?: boolean) => void;
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._adapter.onHandleMove(pagePos, chooseMovePos === 'min');
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.setHandlePos(position, isMin, true);
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
@@ -19,7 +19,7 @@
19
19
  flex-direction: column;
20
20
  }
21
21
  .semi-tabs-bar-extra {
22
- padding: 0 5px;
22
+ padding: 0px 5px;
23
23
  }
24
24
  .semi-tabs-bar .semi-tabs-tab {
25
25
  font-size: 14px;
@@ -61,7 +61,7 @@ $font-tabs_bar_extra_large-lineHeight: $height-tabs_bar_extra_large; // 大尺
61
61
  $height-tabs_bar_extra_small: 36px; // 小尺寸页签高度
62
62
  $font-tabs_bar_extra_small-lineHeight: $height-tabs_bar_extra_small; // 小尺寸页签文字行高
63
63
 
64
- $spacing-tabs_bar_extra-paddingY: 0; // 附加操作垂直内边距
64
+ $spacing-tabs_bar_extra-paddingY: 0px; // 附加操作垂直内边距
65
65
  $spacing-tabs_bar_extra-paddingX: 5px; // 附加操作水平内边距
66
66
  $spacing-tabs_tab_icon-marginRight: $spacing-tight; // 附加操作垂直内边距
67
67
  $spacing-tabs_tab_icon-top: 3px; // 页签图标顶部位置
@@ -85,8 +85,8 @@ $spacing-tabs_bar_line_tab_medium-paddingBottom: $spacing-base-tight - $width-ta
85
85
  $spacing-tabs_bar_line_tab_medium-paddingLeft: $spacing-extra-tight; // 中等尺寸线条式页签左侧内边距
86
86
 
87
87
  $spacing-tabs_bar_line_tab_left-padding: 12px; // 垂直线条式页签左侧内边距
88
- $spacing-tabs_bar_line_tab_left_small-padding: $spacing-tight - 2; // 小尺寸垂直线条式页签左侧内边距
89
- $spacing-tabs_bar_line_tab_left_medium-padding: $spacing-base-tight - 2; // 中等尺寸垂直线条式页签左侧内边距
88
+ $spacing-tabs_bar_line_tab_left_small-padding: $spacing-tight - 2px; // 小尺寸垂直线条式页签左侧内边距
89
+ $spacing-tabs_bar_line_tab_left_medium-padding: $spacing-base-tight - 2px; // 中等尺寸垂直线条式页签左侧内边距
90
90
 
91
91
  $spacing-tabs_content-paddingY: 5px; // 页签内容区垂直方向内边距
92
92
  $spacing-tabs_content-paddingX: 0; // 页签内容区水平方向内边距
@@ -96,7 +96,7 @@ $spacing-tabs_content_left-paddingY: 0; // 垂直页签内容区水平方向内
96
96
 
97
97
  $spacing-tabs_bar_card_tab-marginRight: $spacing-tight; // 卡片式页签右侧外边距
98
98
  $spacing-tabs_bar_card_tab_active-paddingTop: $spacing-tight; // 卡片式选中页签顶部内边距
99
- $spacing-tabs_bar_card_tab_active-paddingBottom: $spacing-tight - 1; // 卡片式选中页签底部内边距
99
+ $spacing-tabs_bar_card_tab_active-paddingBottom: $spacing-tight - 1px; // 卡片式选中页签底部内边距
100
100
  $spacing-tabs_bar_card_tab_active-paddingLeft: $spacing-base-tight; // 卡片式选中页签左侧内边距
101
101
  $spacing-tabs_bar_card_tab_active-paddingRight: $spacing-base-tight; // 卡片式选中页签右侧内边距
102
102
  $spacing-tabs_bar_card_tab_left-marginBottom: $spacing-tight; // 垂直卡片式页签底部外边距
@@ -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 };
@@ -4,6 +4,6 @@ const cssClasses = {
4
4
  };
5
5
  const strings = {
6
6
  SIZE_SET: ['large', 'default', 'small'],
7
- STATUS: ["default", "error", "warning"]
7
+ STATUS: ["success", "default", "error", "warning"]
8
8
  };
9
9
  export { cssClasses, strings };
@@ -1,5 +1,5 @@
1
- $horizontal-rate: 0.24; // 水平方向矫正因子
2
- $vertical-rate: 0; // 垂直方向矫正因子
1
+ $horizontal-rate: 0.24; // 水平方向矫正因子 ignore-semi-css-trans
2
+ $vertical-rate: 0; // 垂直方向矫正因子 ignore-semi-css-trans
3
3
 
4
4
  $motion-zoom_scale-from: 0.8; // 初始缩放 - 动画用
5
5
  $motion-zoom_opacity-from: 0; // 初始透明度 - 动画用
@@ -24,8 +24,9 @@ $height-tooltip_arrow: 7px; // 工具提示小三角箭头高度 - 水平
24
24
 
25
25
  $height-tooltip_arrow_vertical: 24px; // 工具提示小三角箭头高度 - 垂直
26
26
  $width-tooltip_arrow_vertical: 7px; // 工具提示小三角箭头宽度度 - 垂直
27
- $spacing-tooltip_arrow_offset-x: 1; // 水平方向渲染会有缝隙,所以加个偏移量
28
- $spacing-tooltip_arrow_offset-y: 1; // 垂直方向渲染会有缝隙,所以加个偏移量
27
+ $spacing-tooltip_arrow_offset-x: 1px; // 水平方向渲染会有缝隙,所以加个偏移量
28
+ $spacing-tooltip_arrow_offset-y: 1px; // 垂直方向渲染会有缝隙,所以加个偏移量
29
29
 
30
- $spacing-tooltip_arrow_adjusted_offset-y: 5; // 垂直方向上的校正偏移量,主要修正三角形有棱角的问题
31
- $spacing-tooltip_arrow_adjusted_offset-x: round($horizontal-rate * $width-tooltip_arrow); // 水平方向上的校正偏移量,主要修正三角形有棱角的问题
30
+ $spacing-tooltip_arrow_adjusted_offset-y: 5px; // 垂直方向上的校正偏移量,主要修正三角形有棱角的问题
31
+
32
+ $spacing-tooltip_arrow_adjusted_offset-x: round($horizontal-rate * $width-tooltip_arrow); // 水平方向上的校正偏移量,主要修正三角形有棱角的问题 ignore-semi-css-trans
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.8.0",
3
+ "version": "2.9.0-beta.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.8.0",
11
+ "@douyinfe/semi-animation": "2.9.0-beta.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": "756ffea15f08be07c1fe934d06a7fd033d88a96e",
27
+ "gitHead": "acb1db546e6d3b2a7a40467d83d4b1e1b51e2b21",
28
28
  "devDependencies": {
29
29
  "@babel/plugin-proposal-decorators": "^7.15.8",
30
30
  "@babel/plugin-transform-runtime": "^7.15.8",
@@ -4,25 +4,23 @@ $color-popover-bg-default: var(--semi-color-bg-3); // 默认背景色
4
4
  $color-popover-border-default: var(--semi-color-border); // 默认描边颜色
5
5
 
6
6
  // Width/Height
7
- $width-popover_arrow: 24px; // 水平箭头宽度
7
+ $width-popover_arrow: 24px; // 水平箭头宽度 ignore-semi-css-trans
8
8
  $height-popover_arrow: 8px; // 水平箭头高度
9
9
  $height-popover_arrow_vertical: 24px; // 垂直箭头高度
10
10
  $width-popover_arrow_vertical: 8px; // 垂直箭头宽度
11
11
  $height-tooltip_arrow: $height-popover_arrow;
12
- $width-tooltip_arrow: $width-popover_arrow;
12
+ $width-tooltip_arrow: $width-popover_arrow; //ignore-semi-css-trans
13
13
  $width-tooltip_arrow_vertical: $width-popover_arrow_vertical;
14
14
  $height-tooltip_arrow_vertical: $height-popover_arrow_vertical;
15
- $width-popover_title-border: 1px;
15
+ $width-popover_title-border: 1px;
16
16
 
17
17
 
18
18
  // Spacing
19
19
  $spacing-popover_title-padding: 8px; // 气泡卡片标题内边距
20
20
  $spacing-popover_withArrow-padding: 12px; // 带箭头的气泡卡片标题内边距
21
- $spacing-popover_arrow_adjusted_offset-y: 6; // 垂直方向上的校正偏移量,主要修正三角形有棱角的问题
21
+ $spacing-popover_arrow_adjusted_offset-y: 6px; // 垂直方向上的校正偏移量,主要修正三角形有棱角的问题
22
22
  $spacing-tooltip_arrow_adjusted_offset-y: $spacing-popover_arrow_adjusted_offset-y; // 垂直方向上的校正偏移量,主要修正三角形有棱角的问题
23
- $spacing-tooltip_arrow_adjusted_offset-x: round(
24
- $horizontal-rate * $width-tooltip_arrow
25
- ); // 水平方向上的校正偏移量,主要修正三角形有棱角的问题
23
+ $spacing-tooltip_arrow_adjusted_offset-x: round($horizontal-rate * $width-tooltip_arrow); // 水平方向上的校正偏移量,主要修正三角形有棱角的问题 ignore-semi-css-trans
26
24
 
27
25
  // Radius
28
26
  $radius-popover: var(--semi-border-radius-medium); // 气泡卡片的圆角大小
@@ -13,7 +13,7 @@ $color-scrollList_selected_item-icon: var(--semi-color-text-2); // 滚动列表
13
13
  $color-scrollList_footer-border: var(--semi-color-border); // 滚动列表底部描边颜色
14
14
 
15
15
  // Width/Height
16
- $height-scrollList: 300px;
16
+ $height-scrollList: 300px;
17
17
  $height-scrollList_item: 36px;
18
18
  $width-scrollList_item-border: $border-thickness-control;
19
19
  $width-scrollList_item_sel_svg: 16px;
@@ -34,7 +34,7 @@ $spacing-scrollList_item_ul-margin: 0;
34
34
  $spacing-scrollList_item_ul-paddingBottom: ($height-scrollList - $height-scrollList_item) / 2;
35
35
  $spacing-scrollList_item_sel_svg-marginRight: 12px;
36
36
  $spacing-scrollList_item_wheel_list_outer-paddingRight: $height-scrollList_item / 2;
37
- $spacing-scrollList_item_wheel_list_shade_pre-marginTop: -($height-scrollList_item / 2 + $border-thickness-control);
37
+ $spacing-scrollList_item_wheel_list_shade_pre-marginTop: -1 * ($height-scrollList_item / 2 + $border-thickness-control);
38
38
  $spacing-scrollList_item_wheel_list_shade_post-marginTop: $height-scrollList_item / 2 + $border-thickness-control;
39
39
  $spacing-scrollList_footer-padding: 10px;
40
40
 
@@ -86,9 +86,9 @@ $spacing-select_option-paddingTop: $spacing-tight; // 选择器菜单项顶部
86
86
  $spacing-select_option-paddingBottom: $spacing-tight; // 选择器菜单项底部内边距
87
87
  $spacing-select_option_first-marginTop: $spacing-extra-tight; // 选择器第一个菜单项顶部外边距
88
88
  $spacing-select_option_last-marginBottom: $spacing-extra-tight; // 选择器最后一个菜单项顶部外边距
89
- $spacing-select_tag-marginTop: $spacing-super-tight - 1; // 多项选择器标签顶部外边距
89
+ $spacing-select_tag-marginTop: $spacing-super-tight - 1px; // 多项选择器标签顶部外边距
90
90
  $spacing-select_tag-marginRight: $spacing-extra-tight; // 多项选择器标签右侧外边距
91
- $spacing-select_tag-marginBottom: $spacing-super-tight - 1; // 多项选择器标签底部外边距
91
+ $spacing-select_tag-marginBottom: $spacing-super-tight - 1px; // 多项选择器标签底部外边距
92
92
  $spacing-select_selection-marginLeft: $spacing-base-tight; // 选择器内容区左侧外边距
93
93
  $spacing-select_insetLabel-marginRight: $spacing-base-tight; // 选择器内嵌标签右侧外边距
94
94
  $spacing-select_option_list-paddingTop: 0; // 选择器内容区顶部内边距
@@ -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._adapter.onHandleMove(pagePos, chooseMovePos === 'min');
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
- this.setHandlePos(position, isMin, true);
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
  /**
@@ -61,7 +61,7 @@ $font-tabs_bar_extra_large-lineHeight: $height-tabs_bar_extra_large; // 大尺
61
61
  $height-tabs_bar_extra_small: 36px; // 小尺寸页签高度
62
62
  $font-tabs_bar_extra_small-lineHeight: $height-tabs_bar_extra_small; // 小尺寸页签文字行高
63
63
 
64
- $spacing-tabs_bar_extra-paddingY: 0; // 附加操作垂直内边距
64
+ $spacing-tabs_bar_extra-paddingY: 0px; // 附加操作垂直内边距
65
65
  $spacing-tabs_bar_extra-paddingX: 5px; // 附加操作水平内边距
66
66
  $spacing-tabs_tab_icon-marginRight: $spacing-tight; // 附加操作垂直内边距
67
67
  $spacing-tabs_tab_icon-top: 3px; // 页签图标顶部位置
@@ -85,8 +85,8 @@ $spacing-tabs_bar_line_tab_medium-paddingBottom: $spacing-base-tight - $width-ta
85
85
  $spacing-tabs_bar_line_tab_medium-paddingLeft: $spacing-extra-tight; // 中等尺寸线条式页签左侧内边距
86
86
 
87
87
  $spacing-tabs_bar_line_tab_left-padding: 12px; // 垂直线条式页签左侧内边距
88
- $spacing-tabs_bar_line_tab_left_small-padding: $spacing-tight - 2; // 小尺寸垂直线条式页签左侧内边距
89
- $spacing-tabs_bar_line_tab_left_medium-padding: $spacing-base-tight - 2; // 中等尺寸垂直线条式页签左侧内边距
88
+ $spacing-tabs_bar_line_tab_left_small-padding: $spacing-tight - 2px; // 小尺寸垂直线条式页签左侧内边距
89
+ $spacing-tabs_bar_line_tab_left_medium-padding: $spacing-base-tight - 2px; // 中等尺寸垂直线条式页签左侧内边距
90
90
 
91
91
  $spacing-tabs_content-paddingY: 5px; // 页签内容区垂直方向内边距
92
92
  $spacing-tabs_content-paddingX: 0; // 页签内容区水平方向内边距
@@ -96,7 +96,7 @@ $spacing-tabs_content_left-paddingY: 0; // 垂直页签内容区水平方向内
96
96
 
97
97
  $spacing-tabs_bar_card_tab-marginRight: $spacing-tight; // 卡片式页签右侧外边距
98
98
  $spacing-tabs_bar_card_tab_active-paddingTop: $spacing-tight; // 卡片式选中页签顶部内边距
99
- $spacing-tabs_bar_card_tab_active-paddingBottom: $spacing-tight - 1; // 卡片式选中页签底部内边距
99
+ $spacing-tabs_bar_card_tab_active-paddingBottom: $spacing-tight - 1px; // 卡片式选中页签底部内边距
100
100
  $spacing-tabs_bar_card_tab_active-paddingLeft: $spacing-base-tight; // 卡片式选中页签左侧内边距
101
101
  $spacing-tabs_bar_card_tab_active-paddingRight: $spacing-base-tight; // 卡片式选中页签右侧内边距
102
102
  $spacing-tabs_bar_card_tab_left-marginBottom: $spacing-tight; // 垂直卡片式页签底部外边距
@@ -6,7 +6,7 @@ const cssClasses = {
6
6
 
7
7
  const strings = {
8
8
  SIZE_SET: ['large', 'default', 'small'],
9
- STATUS: ["default", "error", "warning"],
9
+ STATUS: ["success", "default", "error", "warning"],
10
10
  } as const;
11
11
 
12
12
  export {
@@ -1,5 +1,5 @@
1
- $horizontal-rate: 0.24; // 水平方向矫正因子
2
- $vertical-rate: 0; // 垂直方向矫正因子
1
+ $horizontal-rate: 0.24; // 水平方向矫正因子 ignore-semi-css-trans
2
+ $vertical-rate: 0; // 垂直方向矫正因子 ignore-semi-css-trans
3
3
 
4
4
  $motion-zoom_scale-from: 0.8; // 初始缩放 - 动画用
5
5
  $motion-zoom_opacity-from: 0; // 初始透明度 - 动画用
@@ -24,8 +24,9 @@ $height-tooltip_arrow: 7px; // 工具提示小三角箭头高度 - 水平
24
24
 
25
25
  $height-tooltip_arrow_vertical: 24px; // 工具提示小三角箭头高度 - 垂直
26
26
  $width-tooltip_arrow_vertical: 7px; // 工具提示小三角箭头宽度度 - 垂直
27
- $spacing-tooltip_arrow_offset-x: 1; // 水平方向渲染会有缝隙,所以加个偏移量
28
- $spacing-tooltip_arrow_offset-y: 1; // 垂直方向渲染会有缝隙,所以加个偏移量
27
+ $spacing-tooltip_arrow_offset-x: 1px; // 水平方向渲染会有缝隙,所以加个偏移量
28
+ $spacing-tooltip_arrow_offset-y: 1px; // 垂直方向渲染会有缝隙,所以加个偏移量
29
29
 
30
- $spacing-tooltip_arrow_adjusted_offset-y: 5; // 垂直方向上的校正偏移量,主要修正三角形有棱角的问题
31
- $spacing-tooltip_arrow_adjusted_offset-x: round($horizontal-rate * $width-tooltip_arrow); // 水平方向上的校正偏移量,主要修正三角形有棱角的问题
30
+ $spacing-tooltip_arrow_adjusted_offset-y: 5px; // 垂直方向上的校正偏移量,主要修正三角形有棱角的问题
31
+
32
+ $spacing-tooltip_arrow_adjusted_offset-x: round($horizontal-rate * $width-tooltip_arrow); // 水平方向上的校正偏移量,主要修正三角形有棱角的问题 ignore-semi-css-trans