@douyinfe/semi-foundation 2.19.2-alpha.0 → 2.20.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 (181) hide show
  1. package/anchor/anchor.scss +1 -1
  2. package/autoComplete/autoComplete.scss +1 -1
  3. package/badge/badge.scss +2 -2
  4. package/breadcrumb/breadcrumb.scss +2 -2
  5. package/button/button.scss +1 -1
  6. package/calendar/variables.scss +2 -2
  7. package/carousel/carousel.scss +1 -1
  8. package/cascader/cascader.scss +2 -1
  9. package/checkbox/checkbox.scss +2 -2
  10. package/datePicker/variables.scss +5 -5
  11. package/dropdown/dropdown.scss +1 -1
  12. package/form/variables.scss +2 -2
  13. package/grid/grid.scss +1 -1
  14. package/grid/mixin.scss +10 -10
  15. package/gulpfile.js +14 -6
  16. package/image/animation.scss +11 -0
  17. package/image/constants.ts +7 -0
  18. package/image/image.scss +221 -0
  19. package/image/imageFoundation.tsx +64 -0
  20. package/image/previewFooterFoundation.tsx +41 -0
  21. package/image/previewFoundation.tsx +25 -0
  22. package/image/previewImageFoundation.tsx +260 -0
  23. package/image/previewInnerFoundation.tsx +260 -0
  24. package/image/rtl.scss +51 -0
  25. package/image/utils.ts +86 -0
  26. package/image/variables.scss +47 -0
  27. package/input/input.scss +2 -2
  28. package/input/textarea.scss +2 -2
  29. package/inputNumber/inputNumber.scss +0 -1
  30. package/inputNumber/variables.scss +3 -3
  31. package/lib/cjs/anchor/anchor.scss +1 -1
  32. package/lib/cjs/autoComplete/autoComplete.scss +1 -1
  33. package/lib/cjs/badge/badge.scss +2 -2
  34. package/lib/cjs/breadcrumb/breadcrumb.scss +2 -2
  35. package/lib/cjs/button/button.scss +1 -1
  36. package/lib/cjs/calendar/variables.scss +2 -2
  37. package/lib/cjs/carousel/carousel.scss +1 -1
  38. package/lib/cjs/cascader/cascader.scss +2 -1
  39. package/lib/cjs/checkbox/checkbox.scss +2 -2
  40. package/lib/cjs/datePicker/datePicker.css +6 -6
  41. package/lib/cjs/datePicker/variables.scss +5 -5
  42. package/lib/cjs/dropdown/dropdown.scss +1 -1
  43. package/lib/cjs/form/variables.scss +2 -2
  44. package/lib/cjs/grid/grid.css +0 -955
  45. package/lib/cjs/grid/grid.scss +1 -1
  46. package/lib/cjs/grid/mixin.scss +10 -10
  47. package/lib/cjs/image/animation.scss +11 -0
  48. package/lib/cjs/image/constants.d.ts +4 -0
  49. package/lib/cjs/image/constants.js +13 -0
  50. package/lib/cjs/image/image.css +228 -0
  51. package/lib/cjs/image/image.scss +221 -0
  52. package/lib/cjs/image/rtl.scss +51 -0
  53. package/lib/cjs/image/utils.d.ts +4 -0
  54. package/lib/cjs/image/utils.js +111 -0
  55. package/lib/cjs/image/variables.scss +47 -0
  56. package/lib/cjs/input/input.scss +2 -2
  57. package/lib/cjs/input/textarea.scss +2 -2
  58. package/lib/cjs/inputNumber/inputNumber.scss +0 -1
  59. package/lib/cjs/inputNumber/variables.scss +3 -3
  60. package/lib/cjs/navigation/navigation.scss +1 -1
  61. package/lib/cjs/navigation/variables.scss +2 -2
  62. package/lib/cjs/pagination/pagination.scss +1 -1
  63. package/lib/cjs/progress/constants.d.ts +1 -0
  64. package/lib/cjs/progress/constants.js +1 -0
  65. package/lib/cjs/progress/generates.d.ts +7 -0
  66. package/lib/cjs/progress/generates.js +249 -0
  67. package/lib/cjs/radio/radio.scss +5 -4
  68. package/lib/cjs/radio/variables.scss +2 -2
  69. package/lib/cjs/rating/rating.scss +2 -1
  70. package/lib/cjs/scrollList/scrollList.scss +3 -2
  71. package/lib/cjs/scrollList/variables.scss +4 -4
  72. package/lib/cjs/select/select.scss +1 -1
  73. package/lib/cjs/sideSheet/sideSheet.scss +2 -1
  74. package/lib/cjs/skeleton/skeleton.css +1 -1
  75. package/lib/cjs/skeleton/skeleton.scss +3 -1
  76. package/lib/cjs/slider/slider.scss +2 -1
  77. package/lib/cjs/steps/steps.scss +1 -1
  78. package/lib/cjs/switch/switch.scss +7 -6
  79. package/lib/cjs/switch/variables.scss +3 -3
  80. package/lib/cjs/table/table.scss +2 -1
  81. package/lib/cjs/tabs/tabs.css +3 -6
  82. package/lib/cjs/tabs/tabs.scss +84 -83
  83. package/lib/cjs/tag/tag.css +6 -0
  84. package/lib/cjs/tag/tag.scss +9 -2
  85. package/lib/cjs/tag/variables.scss +1 -0
  86. package/lib/cjs/tagInput/tagInput.css +1 -0
  87. package/lib/cjs/tagInput/tagInput.scss +9 -7
  88. package/lib/cjs/tagInput/variables.scss +2 -0
  89. package/lib/cjs/toast/toastListFoundation.d.ts +4 -1
  90. package/lib/cjs/toast/toastListFoundation.js +23 -3
  91. package/lib/cjs/transfer/transfer.scss +3 -2
  92. package/lib/cjs/tree/tree.scss +3 -2
  93. package/lib/es/anchor/anchor.scss +1 -1
  94. package/lib/es/autoComplete/autoComplete.scss +1 -1
  95. package/lib/es/badge/badge.scss +2 -2
  96. package/lib/es/breadcrumb/breadcrumb.scss +2 -2
  97. package/lib/es/button/button.scss +1 -1
  98. package/lib/es/calendar/variables.scss +2 -2
  99. package/lib/es/carousel/carousel.scss +1 -1
  100. package/lib/es/cascader/cascader.scss +2 -1
  101. package/lib/es/checkbox/checkbox.scss +2 -2
  102. package/lib/es/datePicker/datePicker.css +6 -6
  103. package/lib/es/datePicker/variables.scss +5 -5
  104. package/lib/es/dropdown/dropdown.scss +1 -1
  105. package/lib/es/form/variables.scss +2 -2
  106. package/lib/es/grid/grid.css +0 -955
  107. package/lib/es/grid/grid.scss +1 -1
  108. package/lib/es/grid/mixin.scss +10 -10
  109. package/lib/es/image/animation.scss +11 -0
  110. package/lib/es/image/constants.d.ts +4 -0
  111. package/lib/es/image/constants.js +5 -0
  112. package/lib/es/image/image.css +228 -0
  113. package/lib/es/image/image.scss +221 -0
  114. package/lib/es/image/rtl.scss +51 -0
  115. package/lib/es/image/utils.d.ts +4 -0
  116. package/lib/es/image/utils.js +93 -0
  117. package/lib/es/image/variables.scss +47 -0
  118. package/lib/es/input/input.scss +2 -2
  119. package/lib/es/input/textarea.scss +2 -2
  120. package/lib/es/inputNumber/inputNumber.scss +0 -1
  121. package/lib/es/inputNumber/variables.scss +3 -3
  122. package/lib/es/navigation/navigation.scss +1 -1
  123. package/lib/es/navigation/variables.scss +2 -2
  124. package/lib/es/pagination/pagination.scss +1 -1
  125. package/lib/es/progress/constants.d.ts +1 -0
  126. package/lib/es/progress/constants.js +1 -0
  127. package/lib/es/progress/generates.d.ts +7 -0
  128. package/lib/es/progress/generates.js +243 -0
  129. package/lib/es/radio/radio.scss +5 -4
  130. package/lib/es/radio/variables.scss +2 -2
  131. package/lib/es/rating/rating.scss +2 -1
  132. package/lib/es/scrollList/scrollList.scss +3 -2
  133. package/lib/es/scrollList/variables.scss +4 -4
  134. package/lib/es/select/select.scss +1 -1
  135. package/lib/es/sideSheet/sideSheet.scss +2 -1
  136. package/lib/es/skeleton/skeleton.css +1 -1
  137. package/lib/es/skeleton/skeleton.scss +3 -1
  138. package/lib/es/slider/slider.scss +2 -1
  139. package/lib/es/steps/steps.scss +1 -1
  140. package/lib/es/switch/switch.scss +7 -6
  141. package/lib/es/switch/variables.scss +3 -3
  142. package/lib/es/table/table.scss +2 -1
  143. package/lib/es/tabs/tabs.css +3 -6
  144. package/lib/es/tabs/tabs.scss +84 -83
  145. package/lib/es/tag/tag.css +6 -0
  146. package/lib/es/tag/tag.scss +9 -2
  147. package/lib/es/tag/variables.scss +1 -0
  148. package/lib/es/tagInput/tagInput.css +1 -0
  149. package/lib/es/tagInput/tagInput.scss +9 -7
  150. package/lib/es/tagInput/variables.scss +2 -0
  151. package/lib/es/toast/toastListFoundation.d.ts +4 -1
  152. package/lib/es/toast/toastListFoundation.js +23 -3
  153. package/lib/es/transfer/transfer.scss +3 -2
  154. package/lib/es/tree/tree.scss +3 -2
  155. package/navigation/navigation.scss +1 -1
  156. package/navigation/variables.scss +2 -2
  157. package/package.json +2 -3
  158. package/pagination/pagination.scss +1 -1
  159. package/progress/constants.ts +2 -1
  160. package/progress/generates.ts +242 -0
  161. package/radio/radio.scss +5 -4
  162. package/radio/variables.scss +2 -2
  163. package/rating/rating.scss +2 -1
  164. package/scrollList/scrollList.scss +3 -2
  165. package/scrollList/variables.scss +4 -4
  166. package/select/select.scss +1 -1
  167. package/sideSheet/sideSheet.scss +2 -1
  168. package/skeleton/skeleton.scss +3 -1
  169. package/slider/slider.scss +2 -1
  170. package/steps/steps.scss +1 -1
  171. package/switch/switch.scss +7 -6
  172. package/switch/variables.scss +3 -3
  173. package/table/table.scss +2 -1
  174. package/tabs/tabs.scss +84 -83
  175. package/tag/tag.scss +9 -2
  176. package/tag/variables.scss +1 -0
  177. package/tagInput/tagInput.scss +9 -7
  178. package/tagInput/variables.scss +2 -0
  179. package/toast/toastListFoundation.ts +16 -4
  180. package/transfer/transfer.scss +3 -2
  181. package/tree/tree.scss +3 -2
@@ -1,5 +1,5 @@
1
- @import './variables.scss';
2
1
  @import "./animation.scss";
2
+ @import './variables.scss';
3
3
 
4
4
  $module: #{$prefix}-anchor;
5
5
 
@@ -1,5 +1,5 @@
1
- @import "./variables.scss";
2
1
  @import "./animation.scss";
2
+ @import "./variables.scss";
3
3
  @import "./option.scss";
4
4
 
5
5
  $module: #{$prefix}-autocomplete;
package/badge/badge.scss CHANGED
@@ -20,7 +20,7 @@ $module: #{$prefix}-badge;
20
20
  box-sizing: border-box;
21
21
  height: $height-badge_count;
22
22
  min-width: $height-badge_count;
23
- border-radius: $height-badge_count / 2;
23
+ border-radius: $height-badge_count * 0.5;
24
24
  padding: $spacing-badge_count-paddingY $spacing-badge_count-paddingX;
25
25
  background-color: $color-badge_default-bg-default;
26
26
  border: $width-badge-border $color-badge_default-border-default solid;
@@ -162,7 +162,7 @@ $module: #{$prefix}-badge;
162
162
  color: $color-badge_warning_inverted-text-default;
163
163
  }
164
164
  }
165
-
165
+
166
166
  }
167
167
 
168
168
  @import "./rtl.scss";
@@ -1,8 +1,8 @@
1
1
  //@import '../theme/variables.scss';
2
2
  // @import '../theme/mixin.scss';
3
3
  // @import '../theme/_font.scss';
4
- @import './variables.scss';
5
4
  @import "./animation.scss";
5
+ @import './variables.scss';
6
6
 
7
7
  $module: #{$prefix}-breadcrumb;
8
8
 
@@ -120,4 +120,4 @@ $module: #{$prefix}-breadcrumb;
120
120
 
121
121
  }
122
122
 
123
- @import './rtl.scss';
123
+ @import './rtl.scss';
@@ -1,5 +1,5 @@
1
- @import './variables.scss';
2
1
  @import './animation.scss';
2
+ @import './variables.scss';
3
3
  @import './splitButtonGroup.scss';
4
4
 
5
5
  $module: #{$prefix}-button;
@@ -17,7 +17,7 @@ $width-calendar_day-minWidth: 70px;
17
17
  $height-calendar_day_grid: 60px;
18
18
  $width-calendar_day_grid: 130px;
19
19
  $width-calendar_day_grid-minWidth: 130px;
20
- $height-calendar_time_grid: $height-calendar_day_grid / 2;
20
+ $height-calendar_time_grid: $height-calendar_day_grid * 0.5;
21
21
  $height-calendar_allDay: 26px;
22
22
  $height-calendar_allDay-minHeight: 26px;
23
23
  $width-calendar_currCircle: 8px;
@@ -29,7 +29,7 @@ $height-calendar_month_day: 24px;
29
29
  $height-calendar_month_week_skeletion: 100%;
30
30
  $height-calendar_month_grid_wrapper: calc(100% - 27px);
31
31
  $width-calendar_card: 220px;
32
- $height-calendar_day_gridTime: $height-calendar_day_grid / 2;
32
+ $height-calendar_day_gridTime: $height-calendar_day_grid * 0.5;
33
33
  $width-calendar_today_date: 24px;
34
34
  $height-calendar_today_date: 24px;
35
35
  $height-calendar_body_li: 24px;
@@ -1,5 +1,5 @@
1
- @import './variables.scss';
2
1
  @import './animation.scss';
2
+ @import './variables.scss';
3
3
 
4
4
  $module: #{$prefix}-carousel;
5
5
 
@@ -1,5 +1,6 @@
1
- @import './variables.scss';
2
1
  @import "./animation.scss";
2
+ @import './variables.scss';
3
+
3
4
 
4
5
  $module: #{$prefix}-cascader;
5
6
 
@@ -1,7 +1,7 @@
1
1
  //@import '../theme/variables.scss';
2
2
  // @import '../theme/mixin.scss';
3
- @import "./variables.scss";
4
3
  @import "./animation.scss";
4
+ @import "./variables.scss";
5
5
  @import "./mixin.scss";
6
6
 
7
7
  $module: #{$prefix}-checkbox;
@@ -412,4 +412,4 @@ $module: #{$prefix}-checkbox;
412
412
  }
413
413
  }
414
414
 
415
- @import "./rtl.scss";
415
+ @import "./rtl.scss";
@@ -36,7 +36,7 @@ $height-datepicker_month_grid_yearType_insetInput: 317px;
36
36
  $height-datepicker_month_grid_timeType_insetInput: 317px;
37
37
 
38
38
  // Spacing
39
- $spacing-datepicker_day-marginX: ($width-datepicker_day - $width-datepicker_day_main) / 2; // 日期格子水平外边距
39
+ $spacing-datepicker_day-marginX: ($width-datepicker_day - $width-datepicker_day_main) * 0.5; // 日期格子水平外边距
40
40
  $spacing-datepicker_yam_header-paddingX: $spacing-base; // 年月选择 header 水平内边距
41
41
  $spacing-datepicker_yam_header-paddingY: $spacing-base-tight; // 年月选择 header 垂直内边距
42
42
  $spacing-datepicker_scrolllist_header-padding: $spacing-base; // 时间选择 header 内边距
@@ -182,7 +182,7 @@ $height-datepicker_insetInput_compact: 26px;
182
182
  $fontSize-datepicker_insetInput_compact-fontSize: 12px;
183
183
 
184
184
  $spacing-datepicker_switch_compact-padding: 6px;
185
- $spacing-datepicker_day_compact-margin: ($width-datepicker_day_compact - $width-datepicker_day_main_compact) / 2;
185
+ $spacing-datepicker_day_compact-margin: ($width-datepicker_day_compact - $width-datepicker_day_main_compact) * 0.5;
186
186
  $spacing-datepicker_weeks_compact-padding: 10px;
187
187
  $spacing-datepicker_weeks_compact-paddingTop: $spacing-tight - 2px;
188
188
  $spacing-datepicker_weekday_compact-paddingLeft: 10px;
@@ -234,12 +234,12 @@ $height-datepicker_date_time_panel_compact: $height-datepicker_date_panel_compac
234
234
  $height-datepicker_presetPanel_left_and_right_except_content_compact: 20px + $spacing-datepicker_quick_control_header_compact-paddingTop + $spacing-datepicker_quick_control_content_compact-marginTop; // compact,除去content以外的高度,默认48px
235
235
 
236
236
  $width-datepicker_presetPanel_left_and_right_two_col_button: ($width-datepicker_presetPanel_left_and_right_content - $spacing-datepicker_quick_control_item-margin) * 0.5; // 左右方位快捷选择面板,固定两列,按钮宽度
237
- $width-datepicker_presetPanel_top_and_bottom_three_col_button: ($width-datepicker_presetPanel_top_and_bottom_content_date - $spacing-datepicker_quick_control_item-margin * 2) / 3; // 上下方位快捷选择面板,固定三列,按钮宽度
237
+ $width-datepicker_presetPanel_top_and_bottom_three_col_button: ($width-datepicker_presetPanel_top_and_bottom_content_date - $spacing-datepicker_quick_control_item-margin * 2) * 0.333; // 上下方位快捷选择面板,固定三列,按钮宽度
238
238
  $width-datepicker_presetPanel_top_and_bottom_five_col_button: ($width-datepicker_presetPanel_top_and_bottom_content_range - $spacing-datepicker_quick_control_item-margin * 4) * 0.2; // 上下方位快捷选择面板,固定五列,按钮宽度
239
239
  $width-datepicker_presetPanel_top_and_bottom_two_col_button:($width-datepicker_presetPanel_top_and_bottom_content_month - $spacing-datepicker_quick_control_item-margin) * 0.5; // 上下方位快捷选择面板,固定两列,按钮宽度
240
240
 
241
241
  // compact
242
- $width-datepicker_presetPanel_top_and_bottom_three_col_button_compact: ($width-datepicker_presetPanel_top_and_bottom_content_date_compact - $spacing-datepicker_quick_control_item-margin * 2) / 3; // 上下方位快捷选择面板,固定三列,按钮宽度
242
+ $width-datepicker_presetPanel_top_and_bottom_three_col_button_compact: ($width-datepicker_presetPanel_top_and_bottom_content_date_compact - $spacing-datepicker_quick_control_item-margin * 2) * 0.333; // 上下方位快捷选择面板,固定三列,按钮宽度
243
243
  $width-datepicker_presetPanel_top_and_bottom_five_col_button_compact: ($width-datepicker_presetPanel_top_and_bottom_content_range_compact - $spacing-datepicker_quick_control_item-margin * 4) * 0.2; // 上下方位快捷选择面板,固定五列,按钮宽度
244
244
  $width-datepicker_presetPanel_top_and_bottom_two_col_button_compact: ($width-datepicker_presetPanel_top_and_bottom_content_month_compact - $spacing-datepicker_quick_control_item-margin) * 0.5; // 上下方位快捷选择面板,固定两列,按钮宽度
245
245
 
@@ -250,4 +250,4 @@ $height-datepicker_preset_panel_inset_input: $height-datepicker_month_max + $spa
250
250
 
251
251
  // insetinput compact
252
252
  $height-datepicker_inset_input_compact: 28px + $spacing-datepicker_insetInput_wrapper_compact-paddingY; // compact,insetInput高度, 默认36px
253
- $height-datepicker_preset_panel_inset_input_compact: $height-datepicker_month_max_compact + $width-datepicker_nav_compact + $spacing-datepicker_insetInput_wrapper_compact-paddingY * 2 + $height-datepicker_inset_input_compact; // inset_input下,非month面板渲染最大高度,默认296px
253
+ $height-datepicker_preset_panel_inset_input_compact: $height-datepicker_month_max_compact + $width-datepicker_nav_compact + $spacing-datepicker_insetInput_wrapper_compact-paddingY * 2 + $height-datepicker_inset_input_compact; // inset_input下,非month面板渲染最大高度,默认296px
@@ -1,6 +1,6 @@
1
1
  //@import '../theme/variables.scss';
2
- @import './variables.scss';
3
2
  @import './animation.scss';
3
+ @import './variables.scss';
4
4
 
5
5
  $module: #{$prefix}-dropdown;
6
6
 
@@ -1,5 +1,5 @@
1
- $spacing-form_label-paddingTop: ($height-control-default - 20px) / 2; // 水平布局表单标题顶部内边距
2
- $spacing-form_label_small-paddingTop: ($height-control-default - 24px) / 2; // 水平布局 小尺寸表单标题顶部内边距
1
+ $spacing-form_label-paddingTop: ($height-control-default - 20px) * 0.5; // 水平布局表单标题顶部内边距
2
+ $spacing-form_label_small-paddingTop: ($height-control-default - 24px) * 0.5; // 水平布局 小尺寸表单标题顶部内边距
3
3
 
4
4
  $spacing-form_field_horizontal-paddingRight: $spacing-base; // 水平布局表单标题右侧内边距
5
5
  $spacing-form_field_group_horizontal-paddingRight: $spacing-base; // 水平布局表单组标题右侧内边距
package/grid/grid.scss CHANGED
@@ -118,4 +118,4 @@ $module: #{$prefix};
118
118
  @include make-grid(-xxl);
119
119
  }
120
120
 
121
- @import "./rtl.scss";
121
+ @import "./rtl.scss";
package/grid/mixin.scss CHANGED
@@ -1,6 +1,6 @@
1
+ @use "sass:math";
1
2
  // mixins for clearfix
2
3
  // ------------------------
3
-
4
4
  //TODO 提出到公共mixin
5
5
  @mixin clearfix() {
6
6
  zoom: 1;
@@ -21,8 +21,8 @@
21
21
  @mixin make-row($gutter: $width-grid_gutter) {
22
22
  position: relative;
23
23
  height: auto;
24
- margin-right: ($gutter / -2);
25
- margin-left: ($gutter / -2);
24
+ margin-right: ($gutter * -0.5);
25
+ margin-left: ($gutter * -0.5);
26
26
  @include clearfix();
27
27
  }
28
28
 
@@ -35,8 +35,8 @@
35
35
  #{$item} {
36
36
  position: relative;
37
37
  min-height: 1px;
38
- padding-right: ($width-grid_gutter / 2);
39
- padding-left: ($width-grid_gutter / 2);
38
+ padding-right: ($width-grid_gutter * 0.5);
39
+ padding-left: ($width-grid_gutter * 0.5);
40
40
  }
41
41
  }
42
42
  }
@@ -59,19 +59,19 @@
59
59
  .#{$module}-col#{$class}-#{$i} {
60
60
  display: block;
61
61
  box-sizing: border-box;
62
- width: percentage(($i / $width-grid_columns));
62
+ width: percentage(math.div($i , $width-grid_columns));
63
63
  }
64
64
 
65
65
  .#{$module}-col#{$class}-push-#{$i} {
66
- left: percentage(($i / $width-grid_columns));
66
+ left: percentage(math.div($i , $width-grid_columns));
67
67
  }
68
68
 
69
69
  .#{$module}-col#{$class}-pull-#{$i} {
70
- right: percentage(($i / $width-grid_columns));
70
+ right: percentage(math.div($i , $width-grid_columns));
71
71
  }
72
72
 
73
73
  .#{$module}-col#{$class}-offset-#{$i} {
74
- margin-left: percentage(($i / $width-grid_columns));
74
+ margin-left: percentage(math.div($i , $width-grid_columns));
75
75
  }
76
76
 
77
77
  .#{$module}-col#{$class}-order-#{$i} {
@@ -101,7 +101,7 @@
101
101
  .#{$module}-col#{$class}-offset-#{$i} {
102
102
  .#{$prefix}-rtl & {
103
103
  margin-left: auto;
104
- margin-right: percentage(($i / $width-grid_columns));
104
+ margin-right: percentage(math.div($i , $width-grid_columns));
105
105
  }
106
106
  }
107
107
  }
package/gulpfile.js CHANGED
@@ -34,7 +34,7 @@ gulp.task('compileTSForCJS', function compileTSForCJS() {
34
34
  });
35
35
 
36
36
  const excludeScss = [
37
- '!**/button/splitButtonGroup.scss',
37
+ '!**/button/splitButtonGroup.scss',
38
38
  '!**/steps/bacisSteps.scss',
39
39
  '!**/steps/fillSteps.scss',
40
40
  '!**/steps/navSteps.scss',
@@ -49,8 +49,16 @@ gulp.task('compileScss', function compileScss() {
49
49
  function (chunk, enc, cb) {
50
50
  const rootPath = path.join(__dirname, '../../');
51
51
  const scssVarStr = `@import "${rootPath}/packages/semi-theme-default/scss/index.scss";\n`;
52
- const scssBuffer = Buffer.from(scssVarStr);
53
- chunk.contents = Buffer.concat([scssBuffer, chunk.contents]);
52
+ let scssRaw = chunk.contents.toString('utf-8');
53
+ if (scssRaw.startsWith("@use")) {
54
+ const scssRawSplit = scssRaw.split("\n");
55
+ const codeStartIndex = scssRawSplit.findIndex(item => !item.startsWith("@use"));
56
+ scssRawSplit.splice(codeStartIndex, 0, scssVarStr);
57
+ scssRaw = scssRawSplit.join("\n");
58
+ } else {
59
+ scssRaw = `${scssVarStr}\n${scssRaw}`;
60
+ }
61
+ chunk.contents = Buffer.from(scssRaw, 'utf-8');
54
62
  cb(null, chunk);
55
63
  }
56
64
  ))
@@ -67,11 +75,11 @@ gulp.task('moveScss', function moveScss() {
67
75
  .pipe(gulp.dest('lib/cjs'));
68
76
  });
69
77
 
70
- gulp.task('compileLib',
78
+ gulp.task('compileLib',
71
79
  gulp.series(
72
80
  [
73
- 'cleanLib', 'compileScss',
74
- 'moveScss',
81
+ 'cleanLib', 'compileScss',
82
+ 'moveScss',
75
83
  gulp.parallel('compileTSForESM', 'compileTSForCJS'),
76
84
  ]
77
85
  )
@@ -0,0 +1,11 @@
1
+ $transform_rotate-image_preview_spinner: var(--semi-transform_rotate-clockwise360deg); // 预览图像加载spin旋转角度
2
+ $transform_scale3d-image_preview_image_img: 1, 1, 1; // 预览图片放大
3
+ $transform_rotate-image_preview_image_img: var(--semi-transform-rotate-none); // 预览图片旋转角度
4
+
5
+ $transition_duration-image_preview_image_img: 0.3s; // 预览图像动画持续时间
6
+ $transition_function-image_preview_image_img: cubic-bezier(0.215, 0.61, 0.355, 1); // 预览图片动画函数
7
+ $transition_delay-image_preview_image_img: 0s; // 预览图片延迟时间
8
+
9
+ $transition_duration-image_preview: 500ms; // 预览图片透明度变化动画时间
10
+
11
+ $transform_rotate-image_preview_icon_rtl: var(--semi-transform_rotate-clockwise180deg); // rtl模式下向前/向后切换图片按钮旋转角度
@@ -0,0 +1,7 @@
1
+ import { BASE_CLASS_PREFIX } from "../base/constants";
2
+
3
+ const cssClasses = {
4
+ PREFIX: `${BASE_CLASS_PREFIX}-image`,
5
+ } as const;
6
+
7
+ export { cssClasses };
@@ -0,0 +1,221 @@
1
+ @import "./animation.scss";
2
+ @import "./variables.scss";
3
+
4
+ $module: #{$prefix}-image;
5
+
6
+ .#{$module} {
7
+
8
+ border-radius: $radius-image;
9
+ position: relative;
10
+ display: inline-block;
11
+ overflow: hidden;
12
+
13
+ &-img {
14
+ vertical-align: middle;
15
+ border-radius: inherit;
16
+
17
+ &-preview {
18
+ cursor: zoom-in;
19
+ }
20
+
21
+ &-error {
22
+ opacity: 0;
23
+ }
24
+ }
25
+
26
+ &-overlay {
27
+ position: absolute;
28
+ top: 0;
29
+ left: 0;
30
+ width: 100%;
31
+ height: 100%;
32
+ }
33
+ }
34
+
35
+ .#{$module}-status {
36
+ width: 100%;
37
+ height: 100%;
38
+ display: flex;
39
+ justify-content: center;
40
+ align-items: center;
41
+ border-radius: $radius-image;
42
+ background-color: $color-image_status-bg;
43
+ color: $color-image_status;
44
+ }
45
+
46
+ .#{$module}-preview {
47
+ position: fixed;
48
+ top: 0;
49
+ left: 0;
50
+ width: 100%;
51
+ height: 100%;
52
+ z-index: $z-image_preview;
53
+ background-color: var(--semi-color-overlay-bg);
54
+ transition: opacity $transition_duration-image_preview;
55
+ overflow: hidden;
56
+
57
+ &-popup {
58
+ position: absolute;
59
+ }
60
+
61
+ .#{$module}-preview-hide {
62
+ opacity: 0;
63
+ }
64
+
65
+ &-icon {
66
+ display: flex;
67
+ justify-content: center;
68
+ align-items: center;
69
+ width: $width-image_preview_icon;
70
+ height: $height-image_preview_icon;
71
+ border-radius: 50%;
72
+ position: absolute;
73
+ top: 50%;
74
+ transform: translateY(-50%);
75
+ background: $color-image_preview_icon-bg;
76
+ cursor: pointer;
77
+ color: $color-image_preview_icon;
78
+ }
79
+
80
+ &-prev {
81
+ left: $spacing-image_preview_icon-x;
82
+ }
83
+
84
+ &-next {
85
+ right: $spacing-image_preview_icon-x;
86
+ }
87
+
88
+ &-header {
89
+ position: absolute;
90
+ top: 0;
91
+ left: 0;
92
+ right: 0;
93
+ font-weight: normal;
94
+ @include font-size-regular;
95
+ color: $color-image_preview_header;
96
+ height: $height-image_preview_header;
97
+ display: flex;
98
+ justify-content: space-between;
99
+ align-items: center;
100
+ padding: $spacing-image_preview_header-paddingY $spacing-image_preview_header-paddingX;
101
+ z-index: $z-image_preview_header;
102
+
103
+ &-title {
104
+ flex: 1;
105
+ }
106
+
107
+ &-close {
108
+ display: flex;
109
+ justify-content: center;
110
+ align-items: center;
111
+ cursor: pointer;
112
+ width: $width-image_preview_header_close;
113
+ height: $height-image_preview_header_close;
114
+ border-radius: 50%;
115
+
116
+ &:hover {
117
+ background-color: $color-image_header_close-bg;
118
+ }
119
+ }
120
+ }
121
+
122
+ &-footer {
123
+ display: flex;
124
+ align-items: center;
125
+ padding: $spacing-image_preview_footer-paddingY $spacing-image_preview_footer-paddingX;
126
+ background: $color-image_preview_footer-bg;
127
+ border-radius: $radius-image_preview_footer;
128
+ height: $height-image_preview_footer;
129
+
130
+ &-wrapper {
131
+ position: absolute;
132
+ left: 50%;
133
+ bottom: 16px;
134
+ transform: translateX(-50%);
135
+ }
136
+
137
+ &-page {
138
+ color: $color-image_preview_footer_icon;
139
+ @include font-size-header-6;
140
+ margin: $spacing-image_preview_footer_page-marginY $spacing-image_preview_footer_page-marginX;
141
+ }
142
+
143
+ .#{$prefix}-icon {
144
+ color: $color-image_preview_footer_icon;
145
+ cursor: pointer;
146
+ }
147
+
148
+ &-gap {
149
+ margin-left: $spacing-image_preview_footer_gap-marginLeft;
150
+ }
151
+
152
+ .#{$prefix}-slider {
153
+ width: $width-image_preview_footer_slider;
154
+ padding: $spacing-image_preview_footer_slider-paddingY $spacing-image_preview_footer_slider-paddingX;
155
+
156
+ .#{$prefix}-slider-rail {
157
+ color: $color-image_preview_footer_slider_rail;
158
+ height: $height-image_preview_footer_slider;
159
+ }
160
+
161
+ .#{$prefix}-slider-track {
162
+ height: $height-image_preview_footer_slider;
163
+ }
164
+
165
+ .#{$prefix}-slider-handle {
166
+ width: $width-image_preview_footer_slider_handle;
167
+ height: $height-image_preview_footer_slider_handle;
168
+ margin-top: $spacing-image_preview_footer_slider_handle-marginTop;
169
+ box-sizing: border-box;
170
+ }
171
+ }
172
+
173
+ .#{$prefix}-divider {
174
+ background: $color-image-preview_divider-bg;
175
+ margin: $spacing-image_preview_footer_divider-marginY $spacing-image_preview_footer_divider-marginX;
176
+ }
177
+
178
+ .#{$module}-preview-footer-disabled {
179
+ color: $color-image_preview_disabled;
180
+ cursor: default;
181
+ pointer-events: none;
182
+ }
183
+
184
+ }
185
+
186
+ &-image {
187
+ position: relative;
188
+ height: 100%;
189
+
190
+ &-img {
191
+ position: absolute;
192
+ transform: scale3d($transform_scale3d-image_preview_image_img) $transform_rotate-image_preview_image_img;
193
+ transition: transform $transition_duration-image_preview_image_img $transition_delay-image_preview_image_img;
194
+ z-index: 0;
195
+ }
196
+
197
+ &-spin {
198
+ position: absolute;
199
+ top: 50%;
200
+ left: 50%;
201
+ transform: translate(-50%, -50%);
202
+
203
+ .#{$prefix}-spin-wrapper {
204
+ color: $color-image_preview_image_spin;
205
+ }
206
+ }
207
+ }
208
+
209
+ @keyframes spinner {
210
+ to {
211
+ transform: $transform_rotate-image_preview_spinner;
212
+ }
213
+ }
214
+ }
215
+
216
+ // Remove the default border of img when src is empty or src is invalid
217
+ img[src=""], img:not([src]) {
218
+ opacity: 0;
219
+ }
220
+
221
+ @import "./rtl.scss";
@@ -0,0 +1,64 @@
1
+ import BaseFoundation, { DefaultAdapter } from "../base/foundation";
2
+ import { isObject } from "lodash";
3
+
4
+
5
+ export interface ImageAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
6
+ getIsInGroup: () => boolean;
7
+ }
8
+
9
+
10
+ export default class ImageFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<ImageAdapter<P, S>, P, S> {
11
+ constructor(adapter: ImageAdapter<P, S>) {
12
+ super({ ...adapter });
13
+ }
14
+
15
+ handleClick = (e: any) => {
16
+ const { imageID, preview } = this.getProps();
17
+ // if preview = false, then it cannot preview
18
+ if (!preview) {
19
+ return;
20
+ }
21
+ // if image in group, then use group's Preview components
22
+ if (this._adapter.getIsInGroup()) {
23
+ const { setCurrentIndex, handleVisibleChange } = this._adapter.getContexts();
24
+ setCurrentIndex(imageID);
25
+ handleVisibleChange(true);
26
+ } else {
27
+ // image isn't in group, then use it's own Preview components
28
+ this.handlePreviewVisibleChange(true);
29
+ }
30
+ }
31
+
32
+ handleLoaded = (e: any) => {
33
+ const { onLoad } = this.getProps();
34
+ onLoad && onLoad(e);
35
+ this.setState ({
36
+ loadStatus: "success",
37
+ } as any);
38
+ }
39
+
40
+ handleError = (e: any) => {
41
+ const { onError } = this.getProps();
42
+ onError && onError(e);
43
+ this.setState ({
44
+ loadStatus: "error",
45
+ } as any);
46
+ }
47
+
48
+ handlePreviewVisibleChange = (newVisible: boolean) => {
49
+ const { preview } = this.getProps();
50
+ if (isObject(preview)) {
51
+ const { onVisibleChange } = preview as any;
52
+ onVisibleChange && onVisibleChange(newVisible);
53
+ if (!("visible" in this.getProps())) {
54
+ this.setState({
55
+ previewVisible: newVisible,
56
+ } as any);
57
+ }
58
+ } else {
59
+ this.setState({
60
+ previewVisible: newVisible,
61
+ } as any);
62
+ }
63
+ }
64
+ }
@@ -0,0 +1,41 @@
1
+ import BaseFoundation, { DefaultAdapter } from "../base/foundation";
2
+
3
+ export interface PreviewFooterAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
4
+ setStartMouseOffset: (time: number) => void;
5
+ }
6
+
7
+ export default class PreviewFooterFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<PreviewFooterAdapter<P, S>, P, S> {
8
+
9
+ changeSliderValue = (type: string): void => {
10
+ const { zoom, step, min, max } = this.getProps();
11
+ let newValue = type === "plus" ? zoom + step : zoom - step;
12
+ if (newValue > max) {
13
+ newValue = max;
14
+ } else if (newValue < min) {
15
+ newValue = min;
16
+ }
17
+ this.handleValueChange(newValue);
18
+ };
19
+
20
+ handleValueChange = (value: number): void => {
21
+ const { onZoomIn, onZoomOut, zoom } = this.getProps();
22
+ if (value > zoom) {
23
+ onZoomIn(value / 100);
24
+ } else {
25
+ onZoomOut(value / 100);
26
+ }
27
+ this._adapter.setStartMouseOffset(value);
28
+ };
29
+
30
+ handleRatioClick = (): void => {
31
+ const { ratio, onAdjustRatio } = this.getProps();
32
+ const type = ratio === "adaptation" ? "realSize" : "adaptation";
33
+ onAdjustRatio(type);
34
+ }
35
+
36
+ handleRotate = (direction: string): void => {
37
+ const { onRotate } = this.getProps();
38
+ onRotate && onRotate(direction);
39
+ }
40
+
41
+ }
@@ -0,0 +1,25 @@
1
+ import BaseFoundation, { DefaultAdapter } from "../base/foundation";
2
+
3
+ export default class PreviewFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<Partial<DefaultAdapter>> {
4
+
5
+ handleVisibleChange = (newVisible : boolean) => {
6
+ const { visible, onVisibleChange } = this.getProps();
7
+ if (!(visible in this.getProps())) {
8
+ this.setState({
9
+ visible: newVisible,
10
+ });
11
+ }
12
+ onVisibleChange && onVisibleChange(newVisible);
13
+ };
14
+
15
+ handleCurrentIndexChange = (index: number) => {
16
+ const { currentIndex, onChange } = this.getProps();
17
+ if (!(currentIndex in this.getProps())) {
18
+ this.setState({
19
+ currentIndex: index,
20
+ } as any);
21
+ }
22
+ onChange && onChange(index);
23
+ };
24
+
25
+ }