@fibrae/semi-foundation 0.1.1 → 0.3.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 (282) hide show
  1. package/dist/anchor/foundation.d.ts +1 -4
  2. package/dist/anchor/foundation.js +21 -22
  3. package/dist/audio-player/foundation.d.ts +10 -13
  4. package/dist/audio-player/foundation.js +19 -20
  5. package/dist/auto-complete/foundation.d.ts +12 -14
  6. package/dist/auto-complete/foundation.js +51 -52
  7. package/dist/avatar/foundation.d.ts +5 -6
  8. package/dist/avatar/foundation.js +16 -16
  9. package/dist/avatar/variables.scss +0 -1
  10. package/dist/backtop/foundation.d.ts +2 -5
  11. package/dist/backtop/foundation.js +7 -8
  12. package/dist/banner/foundation.d.ts +1 -1
  13. package/dist/banner/foundation.js +4 -4
  14. package/dist/base/auto-close-foundation.d.ts +8 -9
  15. package/dist/base/auto-close-foundation.js +15 -15
  16. package/dist/base/foundation.d.ts +4 -4
  17. package/dist/base/foundation.js +12 -11
  18. package/dist/base/list-store.d.ts +0 -1
  19. package/dist/breadcrumb/foundation.d.ts +5 -5
  20. package/dist/breadcrumb/foundation.js +9 -10
  21. package/dist/breadcrumb/item-foundation.d.ts +3 -3
  22. package/dist/breadcrumb/item-foundation.js +6 -6
  23. package/dist/calendar/event-util.d.ts +0 -10
  24. package/dist/calendar/event-util.js +1 -11
  25. package/dist/calendar/foundation.d.ts +1 -6
  26. package/dist/calendar/foundation.js +5 -9
  27. package/dist/calendar/month-foundation.d.ts +2 -3
  28. package/dist/calendar/month-foundation.js +6 -7
  29. package/dist/carousel/foundation.d.ts +17 -19
  30. package/dist/carousel/foundation.js +51 -51
  31. package/dist/cascader/foundation.d.ts +36 -32
  32. package/dist/cascader/foundation.js +145 -132
  33. package/dist/cascader/util.d.ts +1 -8
  34. package/dist/cascader/util.js +1 -8
  35. package/dist/checkbox/checkbox-foundation.d.ts +3 -7
  36. package/dist/checkbox/checkbox-foundation.js +15 -17
  37. package/dist/checkbox/checkbox-group-foundation.d.ts +2 -3
  38. package/dist/checkbox/checkbox-group-foundation.js +8 -8
  39. package/dist/code-highlight/index.d.ts +1 -2
  40. package/dist/code-highlight/index.js +3 -3
  41. package/dist/collapse/foundation.d.ts +2 -2
  42. package/dist/collapse/foundation.js +7 -7
  43. package/dist/collapsible/foundation.d.ts +3 -3
  44. package/dist/collapsible/foundation.js +8 -8
  45. package/dist/color-picker/alpha-slider-foundation.d.ts +2 -4
  46. package/dist/color-picker/alpha-slider-foundation.js +10 -10
  47. package/dist/color-picker/color-choose-area-foundation.d.ts +2 -5
  48. package/dist/color-picker/color-choose-area-foundation.js +14 -14
  49. package/dist/color-picker/color-picker.scss +0 -2
  50. package/dist/color-picker/color-slider-foundation.d.ts +2 -4
  51. package/dist/color-picker/color-slider-foundation.js +10 -10
  52. package/dist/color-picker/data-part-foundation.d.ts +5 -5
  53. package/dist/color-picker/data-part-foundation.js +11 -11
  54. package/dist/color-picker/foundation.d.ts +4 -4
  55. package/dist/color-picker/foundation.js +10 -10
  56. package/dist/color-picker/interface.d.ts +0 -1
  57. package/dist/config-provider/breakpoint-observer.d.ts +3 -3
  58. package/dist/config-provider/breakpoint-observer.js +6 -6
  59. package/dist/config-provider/responsive-types.d.ts +0 -16
  60. package/dist/cropper/foundation.d.ts +15 -16
  61. package/dist/cropper/foundation.js +26 -24
  62. package/dist/date-picker/_utils/get-default-picker-date.d.ts +0 -3
  63. package/dist/date-picker/_utils/get-default-picker-date.js +0 -3
  64. package/dist/date-picker/_utils/get-inset-input-format-token.d.ts +0 -2
  65. package/dist/date-picker/_utils/get-inset-input-format-token.js +0 -2
  66. package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.d.ts +0 -2
  67. package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.js +0 -2
  68. package/dist/date-picker/_utils/parser.d.ts +0 -3
  69. package/dist/date-picker/_utils/parser.js +0 -7
  70. package/dist/date-picker/_utils/picker-type.d.ts +1 -3
  71. package/dist/date-picker/_utils/picker-type.js +0 -2
  72. package/dist/date-picker/_utils/to-callback-args.d.ts +0 -1
  73. package/dist/date-picker/_utils/to-callback-args.js +0 -1
  74. package/dist/date-picker/date-picker.scss +0 -3
  75. package/dist/date-picker/foundation.d.ts +39 -58
  76. package/dist/date-picker/foundation.js +126 -153
  77. package/dist/date-picker/input-foundation.d.ts +10 -16
  78. package/dist/date-picker/input-foundation.js +28 -30
  79. package/dist/date-picker/month-foundation.d.ts +0 -3
  80. package/dist/date-picker/month-foundation.js +0 -2
  81. package/dist/date-picker/months-grid-foundation.d.ts +17 -26
  82. package/dist/date-picker/months-grid-foundation.js +65 -75
  83. package/dist/date-picker/year-and-month-foundation.d.ts +3 -3
  84. package/dist/date-picker/year-and-month-foundation.js +11 -11
  85. package/dist/drag-move/foundation.d.ts +2 -3
  86. package/dist/drag-move/foundation.js +15 -13
  87. package/dist/dropdown/foundation.d.ts +8 -7
  88. package/dist/dropdown/foundation.js +32 -28
  89. package/dist/dropdown/menu-foundation.d.ts +1 -2
  90. package/dist/dropdown/menu-foundation.js +11 -11
  91. package/dist/feedback/foundation.d.ts +9 -10
  92. package/dist/feedback/foundation.js +33 -33
  93. package/dist/feedback/variables.scss +1 -5
  94. package/dist/float-button/float-button.css +0 -1
  95. package/dist/float-button/float-button.scss +0 -2
  96. package/dist/form/form-api-proxy.d.ts +8 -7
  97. package/dist/form/form-api-proxy.js +25 -25
  98. package/dist/form/form.scss +0 -12
  99. package/dist/form/foundation.d.ts +5 -5
  100. package/dist/form/foundation.js +60 -76
  101. package/dist/form/interface.d.ts +2 -15
  102. package/dist/form/utils.d.ts +0 -8
  103. package/dist/form/utils.js +0 -7
  104. package/dist/form/variables.scss +1 -4
  105. package/dist/grid/variables.scss +0 -10
  106. package/dist/highlight/foundation.d.ts +0 -2
  107. package/dist/highlight/foundation.js +1 -3
  108. package/dist/hot-keys/foundation.d.ts +2 -3
  109. package/dist/hot-keys/foundation.js +5 -5
  110. package/dist/image/image-foundation.d.ts +4 -6
  111. package/dist/image/image-foundation.js +10 -10
  112. package/dist/image/preview-footer-foundation.d.ts +3 -4
  113. package/dist/image/preview-footer-foundation.js +10 -10
  114. package/dist/image/preview-foundation.d.ts +0 -3
  115. package/dist/image/preview-foundation.js +7 -6
  116. package/dist/image/preview-image-foundation.d.ts +6 -9
  117. package/dist/image/preview-image-foundation.js +14 -14
  118. package/dist/image/preview-inner-foundation.d.ts +9 -10
  119. package/dist/image/preview-inner-foundation.js +38 -38
  120. package/dist/input/foundation.d.ts +10 -11
  121. package/dist/input/foundation.js +47 -49
  122. package/dist/input/text-entry-foundation.d.ts +3 -5
  123. package/dist/input/text-entry-foundation.js +14 -15
  124. package/dist/input/textarea-foundation.d.ts +7 -8
  125. package/dist/input/textarea-foundation.js +36 -36
  126. package/dist/input-number/caret.d.ts +0 -1
  127. package/dist/input-number/caret.js +0 -1
  128. package/dist/input-number/foundation.d.ts +16 -19
  129. package/dist/input-number/foundation.js +54 -58
  130. package/dist/json-viewer/foundation.d.ts +8 -10
  131. package/dist/json-viewer/foundation.js +23 -24
  132. package/dist/locale/interface.d.ts +0 -3
  133. package/dist/lottie/foundation.d.ts +1 -1
  134. package/dist/lottie/foundation.js +4 -4
  135. package/dist/markdown-render/foundation.d.ts +2 -7
  136. package/dist/markdown-render/foundation.js +5 -9
  137. package/dist/modal/modal-content-foundation.d.ts +7 -7
  138. package/dist/modal/modal-content-foundation.js +20 -20
  139. package/dist/modal/modal-foundation.d.ts +6 -6
  140. package/dist/modal/modal-foundation.js +24 -24
  141. package/dist/navigation/foundation.d.ts +1 -8
  142. package/dist/navigation/foundation.js +14 -20
  143. package/dist/navigation/item-foundation.d.ts +1 -1
  144. package/dist/navigation/item-foundation.js +8 -8
  145. package/dist/navigation/sub-nav-foundation.d.ts +3 -4
  146. package/dist/navigation/sub-nav-foundation.js +17 -17
  147. package/dist/notification/notification-list-foundation.d.ts +7 -8
  148. package/dist/notification/notification-list-foundation.js +12 -13
  149. package/dist/notification/variables.scss +0 -1
  150. package/dist/overflow-list/foundation.d.ts +4 -6
  151. package/dist/overflow-list/foundation.js +18 -19
  152. package/dist/pagination/foundation.d.ts +8 -10
  153. package/dist/pagination/foundation.js +28 -28
  154. package/dist/pincode/foundation.d.ts +6 -9
  155. package/dist/pincode/foundation.js +23 -26
  156. package/dist/popconfirm/popconfirm-foundation.d.ts +7 -9
  157. package/dist/popconfirm/popconfirm-foundation.js +26 -26
  158. package/dist/progress/generates.d.ts +1 -4
  159. package/dist/progress/generates.js +1 -4
  160. package/dist/progress/utils.d.ts +1 -1
  161. package/dist/progress/utils.js +1 -1
  162. package/dist/radio/radio-foundation.d.ts +5 -9
  163. package/dist/radio/radio-foundation.js +15 -16
  164. package/dist/radio/radio-group-foundation.d.ts +2 -3
  165. package/dist/radio/radio-group-foundation.js +9 -9
  166. package/dist/rating/foundation.d.ts +10 -15
  167. package/dist/rating/foundation.js +35 -38
  168. package/dist/resizable/group/index.d.ts +6 -10
  169. package/dist/resizable/group/index.js +40 -44
  170. package/dist/resizable/resizable.scss +0 -1
  171. package/dist/resizable/single/index.d.ts +3 -7
  172. package/dist/resizable/single/index.js +10 -13
  173. package/dist/scroll-list/item-foundation.d.ts +7 -9
  174. package/dist/scroll-list/item-foundation.js +35 -36
  175. package/dist/scroll-list/variables.scss +1 -6
  176. package/dist/select/foundation.d.ts +42 -57
  177. package/dist/select/foundation.js +214 -279
  178. package/dist/select/option-foundation.d.ts +23 -28
  179. package/dist/select/option-foundation.js +10 -19
  180. package/dist/select/variables.scss +1 -8
  181. package/dist/side-sheet/side-sheet-foundation.d.ts +7 -12
  182. package/dist/side-sheet/side-sheet-foundation.js +23 -27
  183. package/dist/side-sheet/variables.scss +1 -3
  184. package/dist/slider/foundation.d.ts +17 -28
  185. package/dist/slider/foundation.js +47 -59
  186. package/dist/slider/variables.scss +1 -5
  187. package/dist/sortable/accessibility.d.ts +1 -1
  188. package/dist/sortable/accessibility.js +2 -2
  189. package/dist/spin/foundation.d.ts +2 -4
  190. package/dist/spin/foundation.js +6 -7
  191. package/dist/spin/variables.scss +1 -3
  192. package/dist/steps/utils.d.ts +1 -1
  193. package/dist/switch/foundation.d.ts +2 -3
  194. package/dist/switch/foundation.js +7 -7
  195. package/dist/switch/switch.scss +1 -1
  196. package/dist/switch/variables.scss +1 -5
  197. package/dist/table/foundation.d.ts +24 -33
  198. package/dist/table/foundation.js +144 -108
  199. package/dist/table/table.scss +0 -1
  200. package/dist/table/utils.d.ts +2 -10
  201. package/dist/table/utils.js +0 -13
  202. package/dist/table/variables.scss +1 -5
  203. package/dist/tabs/foundation.d.ts +5 -14
  204. package/dist/tabs/foundation.js +17 -21
  205. package/dist/tabs/tabs.scss +1 -1
  206. package/dist/tag/focus.js +0 -1
  207. package/dist/tag-input/foundation.d.ts +11 -13
  208. package/dist/tag-input/foundation.js +52 -53
  209. package/dist/tag-input/tag-input.scss +0 -1
  210. package/dist/tag-input/utils/tag-focus.d.ts +0 -1
  211. package/dist/tag-input/utils/tag-focus.js +0 -1
  212. package/dist/time-picker/combox-foundation.d.ts +3 -11
  213. package/dist/time-picker/combox-foundation.js +3 -10
  214. package/dist/time-picker/foundation.d.ts +13 -23
  215. package/dist/time-picker/foundation.js +39 -48
  216. package/dist/time-picker/input-foundation.d.ts +4 -4
  217. package/dist/time-picker/input-foundation.js +13 -13
  218. package/dist/time-picker/utils/index.d.ts +0 -11
  219. package/dist/time-picker/utils/index.js +0 -11
  220. package/dist/toast/toast-list-foundation.d.ts +7 -7
  221. package/dist/toast/toast-list-foundation.js +14 -14
  222. package/dist/tooltip/adjust-position.d.ts +1 -2
  223. package/dist/tooltip/constants.d.ts +0 -3
  224. package/dist/tooltip/constants.js +0 -3
  225. package/dist/tooltip/foundation.d.ts +9 -12
  226. package/dist/tooltip/foundation.js +67 -63
  227. package/dist/tooltip/position.scss +0 -1
  228. package/dist/transfer/foundation.d.ts +22 -13
  229. package/dist/transfer/foundation.js +38 -24
  230. package/dist/tree/foundation.d.ts +14 -16
  231. package/dist/tree/foundation.js +61 -62
  232. package/dist/tree/shared.d.ts +2 -4
  233. package/dist/tree/shared.js +0 -2
  234. package/dist/tree/tree-util.d.ts +0 -5
  235. package/dist/tree/tree-util.js +0 -5
  236. package/dist/tree-select/foundation.d.ts +26 -22
  237. package/dist/tree-select/foundation.js +91 -86
  238. package/dist/typography/ellipsis.d.ts +5 -7
  239. package/dist/typography/ellipsis.js +8 -10
  240. package/dist/typography/format-numeral.d.ts +1 -1
  241. package/dist/typography/format-numeral.js +2 -2
  242. package/dist/typography/typography.scss +0 -1
  243. package/dist/upload/constants.d.ts +1 -1
  244. package/dist/upload/foundation.d.ts +17 -23
  245. package/dist/upload/foundation.js +93 -103
  246. package/dist/upload/utils.d.ts +3 -8
  247. package/dist/upload/utils.js +6 -11
  248. package/dist/user-guide/foundation.d.ts +3 -5
  249. package/dist/user-guide/foundation.js +19 -19
  250. package/dist/utils/a11y.d.ts +2 -6
  251. package/dist/utils/a11y.js +1 -4
  252. package/dist/utils/announcer.d.ts +2 -2
  253. package/dist/utils/announcer.js +4 -4
  254. package/dist/utils/array.d.ts +0 -6
  255. package/dist/utils/array.js +0 -6
  256. package/dist/utils/date-fns-extra.js +1 -5
  257. package/dist/utils/dom.d.ts +0 -1
  258. package/dist/utils/dom.js +0 -1
  259. package/dist/utils/escape-html.js +0 -3
  260. package/dist/utils/field-sizing.d.ts +0 -2
  261. package/dist/utils/field-sizing.js +0 -2
  262. package/dist/utils/focus-handle.d.ts +1 -2
  263. package/dist/utils/focus-handle.js +1 -3
  264. package/dist/utils/focus-scope.d.ts +5 -6
  265. package/dist/utils/focus-scope.js +10 -11
  266. package/dist/utils/is-promise.d.ts +1 -1
  267. package/dist/utils/release-holder.d.ts +2 -2
  268. package/dist/utils/release-holder.js +4 -4
  269. package/dist/utils/scroll-lock.d.ts +3 -4
  270. package/dist/utils/scroll-lock.js +3 -4
  271. package/dist/utils/tween.d.ts +0 -1
  272. package/dist/utils/tween.js +0 -1
  273. package/dist/utils/uuid.d.ts +0 -1
  274. package/dist/utils/uuid.js +0 -1
  275. package/dist/utils/warning.d.ts +0 -1
  276. package/dist/utils/warning.js +0 -1
  277. package/dist/video-player/foundation.d.ts +15 -15
  278. package/dist/video-player/foundation.js +89 -89
  279. package/dist/video-player/progress-foundation.d.ts +2 -3
  280. package/dist/video-player/progress-foundation.js +12 -13
  281. package/dist/video-player/variables.scss +1 -1
  282. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  @use 'semi:theme' as *;
2
2
  @use '../base/mixin' as *;
3
- // Color
3
+
4
4
  $color-slider-text-default: var(--semi-color-text-0); // 滑动条文本颜色 - 默认
5
5
  $color-slider_dot-bg-default: var(--semi-color-white); // 滑动条圆形刻度点颜色 - 默认态
6
6
  $color-slider_dot-border-active: var(--semi-color-white); // 滑动条圆形刻度点描边颜色 - 按下态
@@ -18,7 +18,6 @@ $color-slider_track_disabled-bg: var(--semi-color-primary-disabled); // 禁用
18
18
  $color-slider_handle-focus: $color-focus-ring; // 圆形按钮轮廓 - 聚焦
19
19
  $color-slider_handle_dot: var(--semi-color-primary); // 圆形按钮内部圆点颜色
20
20
 
21
- // Spacing
22
21
  $spacing-slider-paddingX: 13px; // 滑动条整体水平内边距
23
22
  $spacing-slider-paddingY: 0px; // 滑动条整体垂直内边距
24
23
  $spacing-slider-margin: 0px; // 滑动条整体外边距
@@ -45,11 +44,9 @@ $spacing-slider_vertical_handle-translateX: 0px; // 垂直滑动条原型按钮
45
44
  $spacing-slider_dot-translateX: 0px; // 水平滑动条圆形刻度点水平偏移量
46
45
  $spacing-slider_vertical_dot-translateY: 0px; // 垂直滑动条圆形刻度点垂直偏移量
47
46
 
48
- // Radius
49
47
  $radius-slider_rail: var(--semi-border-radius-small); // 滚动条未填充轨道圆角
50
48
  $radius-slider_track: var(--semi-border-radius-small); // 滚动条已填充轨道圆角
51
49
 
52
- // Width/Height
53
50
  $height-slider_wrapper: 32px; // 滚动条容器整体高度
54
51
  $height-slider_vertical_wrapper: 4px; // 垂直滚动条整体宽度
55
52
  $height-slider_rail: 4px; // 滚动条未填充轨道高度
@@ -61,7 +58,6 @@ $width-slider_handle_border_disabled: 1px; // 禁用滚动条圆形按钮按下
61
58
  $width-slider_handle-focus: $width-focus-ring; // 圆形按钮轮廓 - 聚焦
62
59
  $width-slider_handle_dot: 4px; // 圆形按钮内部圆点宽度
63
60
 
64
- // Font
65
61
  $font-slider_rail-fontSize: 14px; // 滚动条轨道文本字号
66
62
  $font-slider_marks-fontSize: 14px; // 滚动条刻度标签字号
67
63
  $font-slider_rail-lineHeight: 1.5; // 滚动条轨道文本行高倍数
@@ -9,6 +9,6 @@ export declare class SortableAnnouncer {
9
9
  #private;
10
10
  readonly plugin: ReturnType<typeof Accessibility.configure>;
11
11
  constructor(locale: SortableLocale, total: number);
12
- update(locale: SortableLocale, total: number): void;
12
+ update: (locale: SortableLocale, total: number) => void;
13
13
  }
14
14
  export {};
@@ -32,7 +32,7 @@ var SortableAnnouncer = class {
32
32
  }
33
33
  });
34
34
  }
35
- update(locale, total) {
35
+ update = (locale, total) => {
36
36
  if (locale.instructions !== this.#instructions.draggable) {
37
37
  this.#instructions.draggable = locale.instructions;
38
38
  const description = document.getElementById(`${descriptionPrefix}-${this.#id}`);
@@ -40,6 +40,6 @@ var SortableAnnouncer = class {
40
40
  }
41
41
  this.#locale = locale;
42
42
  this.#total = total;
43
- }
43
+ };
44
44
  };
45
45
  export { SortableAnnouncer };
@@ -2,19 +2,17 @@ import BaseFoundation, { DefaultAdapter } from "../base/foundation.js";
2
2
  export interface SpinAdapter<P extends SpinBaseProps = SpinBaseProps, S extends object = object> extends DefaultAdapter<P, S> {
3
3
  setLoading: (val: boolean) => void;
4
4
  }
5
- /** The props the foundation reads with getProps */
6
5
  export interface SpinBaseProps {
7
6
  delay?: number;
8
7
  }
9
8
  export default class SpinFoundation<P extends SpinBaseProps = SpinBaseProps, S extends object = object> extends BaseFoundation<SpinAdapter<P, S>, P, S> {
10
9
  #private;
11
- /** Shows the spinner after `delay`; stopping hides it at once and drops a pending show */
12
- handleSpinningChange(spinning: boolean): void;
10
+ handleSpinningChange: (spinning: boolean) => void;
13
11
  /**
14
12
  * Called when the content under `root` becomes inert (`blocked`) or interactive again. inert drops focus to <body> on
15
13
  * the next frame, which would restart keyboard users from the top of the page; the root holds it meanwhile and hands
16
14
  * it back afterwards.
17
15
  */
18
- handleBlockedChange(root: HTMLElement, blocked: boolean): void;
16
+ handleBlockedChange: (root: HTMLElement, blocked: boolean) => void;
19
17
  destroy(): void;
20
18
  }
@@ -8,22 +8,21 @@ var SpinFoundation = class extends BaseFoundation {
8
8
  clearTimeout(this.#timer);
9
9
  this.#timer = null;
10
10
  }
11
- /** Shows the spinner after `delay`; stopping hides it at once and drops a pending show */
12
- handleSpinningChange(spinning) {
11
+ handleSpinningChange = (spinning) => {
13
12
  this.#clearTimer();
14
13
  const { delay } = this.getProps();
15
14
  if (spinning && delay) this.#timer = setTimeout(() => {
16
15
  this.#timer = null;
17
- this._adapter.setLoading(true);
16
+ this.adapter.setLoading(true);
18
17
  }, delay);
19
- else this._adapter.setLoading(spinning);
20
- }
18
+ else this.adapter.setLoading(spinning);
19
+ };
21
20
  /**
22
21
  * Called when the content under `root` becomes inert (`blocked`) or interactive again. inert drops focus to <body> on
23
22
  * the next frame, which would restart keyboard users from the top of the page; the root holds it meanwhile and hands
24
23
  * it back afterwards.
25
24
  */
26
- handleBlockedChange(root, blocked) {
25
+ handleBlockedChange = (root, blocked) => {
27
26
  if (blocked) {
28
27
  const active = FocusTrapHandle.getActiveElement(root);
29
28
  if (active instanceof HTMLElement && active !== root && root.contains(active)) {
@@ -35,7 +34,7 @@ var SpinFoundation = class extends BaseFoundation {
35
34
  this.#heldFocus = null;
36
35
  if (held.isConnected && (FocusTrapHandle.getActiveElement(root) === root || document.activeElement === document.body)) held.focus();
37
36
  }
38
- }
37
+ };
39
38
  destroy() {
40
39
  this.#clearTimer();
41
40
  }
@@ -1,11 +1,9 @@
1
1
  @use 'semi:theme' as *;
2
- // Color
2
+
3
3
  $color-spin-bg: var(--semi-color-primary); // 加载图标背景颜色
4
4
 
5
- // Width
6
5
  $width-spin_large: 32px; // 加载图标尺寸 - 大
7
6
  $width-spin_middle: 20px; // 加载图标尺寸 - 中
8
7
  $width-spin_small: 14px; // 加载图标尺寸 - 小
9
8
 
10
- // Other
11
9
  $opacity-spin_children: 0.5; // 加载图标透明度
@@ -1,7 +1,7 @@
1
1
  export type StepStatus = 'wait' | 'process' | 'finish' | 'error' | 'warning';
2
2
  export interface StepState {
3
3
  /** Undefined when the step has its own status */
4
- status: StepStatus | undefined;
4
+ status?: StepStatus;
5
5
  active: boolean;
6
6
  done: boolean;
7
7
  /** The step before the current one while the flow is in error */
@@ -11,14 +11,13 @@ interface SwitchCheckedProps {
11
11
  export interface SwitchState {
12
12
  checked?: boolean;
13
13
  }
14
- /** The props the foundation reads with getProps */
15
14
  export interface SwitchBaseProps extends SwitchCheckedProps {
16
15
  loading?: boolean;
17
16
  }
18
17
  export default class SwitchFoundation<P extends SwitchBaseProps = SwitchBaseProps, S extends SwitchState = SwitchState, E = unknown> extends BaseFoundation<SwitchAdapter<P, S, E>, P, S> {
19
18
  static getInitialState(props: SwitchCheckedProps): SwitchState;
20
19
  static deriveChecked(props: SwitchCheckedProps, state: Pick<SwitchState, 'checked'>): boolean;
21
- setChecked(checked?: boolean): void;
22
- handleChange(checked: boolean, e: E): void;
20
+ setChecked: (checked?: boolean) => void;
21
+ handleChange: (checked: boolean, e: E) => void;
23
22
  }
24
23
  export {};
@@ -7,13 +7,13 @@ var SwitchFoundation = class extends BaseFoundation {
7
7
  static deriveChecked(props, state) {
8
8
  return Boolean(props.checked !== void 0 ? props.checked : state.checked);
9
9
  }
10
- setChecked(checked) {
11
- this._adapter.setChecked(checked);
12
- }
13
- handleChange(checked, e) {
10
+ setChecked = (checked) => {
11
+ this.adapter.setChecked(checked);
12
+ };
13
+ handleChange = (checked, e) => {
14
14
  if (this.getProp("loading")) return;
15
- if (!this._isControlledComponent("checked")) this.setChecked(checked);
16
- this._adapter.notifyChange(checked, e);
17
- }
15
+ if (!this.isControlledComponent("checked")) this.setChecked(checked);
16
+ this.adapter.notifyChange(checked, e);
17
+ };
18
18
  };
19
19
  export { SwitchFoundation as default };
@@ -136,7 +136,7 @@ $module: #{$prefix}-switch;
136
136
  top: 0;
137
137
  width: 100%;
138
138
  height: 100%;
139
- margin: 0; // reset the UA margin
139
+ margin: 0;
140
140
  pointer-events: auto;
141
141
  cursor: inherit;
142
142
  opacity: 0;
@@ -1,6 +1,6 @@
1
1
  @use 'semi:theme' as *;
2
2
  @use '../base/mixin' as *;
3
- // Other
3
+
4
4
  $spacing-switch_unchecked-translateX: 2px; // 未选中态开关滑块位移距离
5
5
  $spacing-switch_spin_unchecked-translateX: 2px; // 未选中态加载图标位移距离
6
6
  $spacing-switch_checked-translateX: 18px; // 选中态开关滑块位移距离
@@ -17,7 +17,6 @@ $spacing-switch_checked_small-translateX: 11px; // 小尺寸选中态开关滑
17
17
  $spacing-switch_spin_checked_small-translateX: 10px; // 小尺寸选中态加载图标位移距离
18
18
  $motion-switch-transitionDuration: 200ms; // 开关动画时长
19
19
 
20
- // Color
21
20
  $color-switch_default-bg-default: var(--semi-color-fill-0); // 关闭态(未选中)开关背景色 - 默认
22
21
  $color-switch_default-bg-hover: var(--semi-color-fill-1); // 关闭态开关背景色 - 悬浮
23
22
  $color-switch_default-bg-active: var(--semi-color-fill-2); // 关闭态开关背景色 - 按下
@@ -42,7 +41,6 @@ $color-switch_spin_checked-bg-default: var(--semi-color-success-hover); // 已
42
41
  $color-switch_spin_unchecked-bg-default: var(--semi-color-fill-1); // 已关闭开关加载态loading背景颜色
43
42
  $color-switch_primary-outline-focus: $color-focus-ring; // 开关轮廓 - 聚焦
44
43
 
45
- // Width/Height
46
44
  $width-switch: 40px; // 开关宽度
47
45
  $height-switch: 24px; // 开关高度
48
46
  $width-switch_knob_expand: 6px; // 开关滑块按压时延展宽度
@@ -63,13 +61,11 @@ $width-switch_spin-default: 18px; // 默认尺寸开关加载 spin 宽度
63
61
  $width-switch_spin-large: 28px; // 大尺寸开关加载 spin 宽度
64
62
  $width-switch-outline: $width-focus-ring; // 开关轮廓宽度
65
63
 
66
- // Spacing
67
64
  $spacing-switch_knob-padding: 2px; // 开关滑块顶部边距
68
65
  $spacing-switch_knob_large-padding: 3px; // 大尺寸开关滑块顶部边距
69
66
  $spacing-switch_knob_small-padding: 1px; // 小尺寸开关滑块顶部边距
70
67
  $spacing-switch_knob-left: 0px; // 开关滑块左侧偏移距离
71
68
 
72
- // Radius
73
69
  $radius-switch: $height-switch * 0.5; // 开关圆角
74
70
  $radius-switch_large: $height-switch_large * 0.5; // 大尺寸开关圆角
75
71
  $radius-switch_small: $height-switch_small * 0.5; // 小尺寸开关圆角
@@ -100,7 +100,6 @@ export interface BaseTableDataProps<RecordType> {
100
100
  getCheckboxProps?: GetCheckboxProps<RecordType>;
101
101
  } | boolean;
102
102
  }
103
- /** The rowSelection options the foundation reads */
104
103
  export interface TableBaseRowSelection<RecordType> {
105
104
  selectedRowKeys?: BaseRowKeyType[];
106
105
  defaultSelectedRowKeys?: BaseRowKeyType[];
@@ -138,22 +137,17 @@ export interface TableBaseState<RecordType> {
138
137
  /** Group key (what groupBy returns) -> the row keys in that group */
139
138
  groups?: Map<string | number, Set<BaseRowKeyType>>;
140
139
  allRowKeys?: BaseRowKeyType[];
141
- /** Disabled row keys of the current page */
142
140
  pageDisabledRowKeys?: BaseRowKeyType[];
143
141
  pageDisabledRowKeysSet?: Set<BaseRowKeyType>;
144
142
  headWidths?: BaseHeadWidth[][];
145
143
  bodyHasScrollBar?: boolean;
146
- /** The props the derived state was last computed from */
147
144
  prePropRowSelection?: TableBaseProps<RecordType>['rowSelection'];
148
145
  prePagination?: TableBaseProps<RecordType>['pagination'];
149
146
  preExpandedRowKeys?: BaseRowKeyType[];
150
- /** Disabled row keys in sorted and filtered data */
151
147
  filteredDisabledRowKeys?: BaseRowKeyType[];
152
148
  filteredDisabledRowKeysSet?: Set<BaseRowKeyType>;
153
- /** Half-checked row keys for tree selection (checkRelation='related') */
154
149
  halfCheckedRowKeys?: BaseRowKeyType[];
155
150
  halfCheckedRowKeysSet?: Set<BaseRowKeyType>;
156
- /** Key entities map for tree data structure */
157
151
  keyEntities?: BaseEntitys;
158
152
  filteredSortedDataSource?: RecordType[];
159
153
  filteredSortedRowKeys?: BaseRowKeyType[];
@@ -185,9 +179,6 @@ export default class TableFoundation<RecordType, P extends TableBaseProps<Record
185
179
  static initFilteredValue<R>(column: BaseColumnProps<R>): void;
186
180
  static initSorterOrder<R>(column: BaseColumnProps<R>): void;
187
181
  static getFilteredSortedDataSource<R>(props: BaseTableDataProps<R>, dataSource: R[], queries: BaseColumnProps<R>[]): R[];
188
- /**
189
- * Group, paginate and collect the row keys of filtered and sorted data
190
- */
191
182
  static getPageData<R>(props: BaseTableDataProps<R>, dataSource: R[], pagination: BasePagination, queries: BaseColumnProps<R>[]): BasePageData<R>;
192
183
  static groupDataSource<R>(props: BaseTableDataProps<R>, dataSource: R[]): {
193
184
  groups: Map<string | number, Set<BaseRowKeyType>>;
@@ -202,7 +193,7 @@ export default class TableFoundation<RecordType, P extends TableBaseProps<Record
202
193
  static getAllRowKeys<R>(props: BaseTableDataProps<R>, dataSource: R[]): BaseRowKeyType[];
203
194
  /** scrollLeft is 0 at the start edge and negative in RTL; a pixel of slack absorbs fractional scroll positions */
204
195
  static getScrollableEdges({ scrollLeft, scrollWidth, clientWidth, rtl }: TableScrollMetrics): TableScrollableEdges;
205
- static readScrollMetrics(body: HTMLElement | null | undefined): TableScrollMetrics | null;
196
+ static readScrollMetrics(body?: HTMLElement | null): TableScrollMetrics | null;
206
197
  /** The attributes sit on the container, the ancestor shared by the header and body scrollers */
207
198
  static writeScrollableEdges(body: HTMLElement | null | undefined, { left, right }: TableScrollableEdges): void;
208
199
  static hasRowSelected(selectedRowKeys: BaseRowKeyType[], allRowKeysSet: Set<BaseRowKeyType>): boolean;
@@ -213,7 +204,6 @@ export default class TableFoundation<RecordType, P extends TableBaseProps<Record
213
204
  total?: number;
214
205
  }) => any)): string;
215
206
  static isSortOrderValid(sortOrder: BaseSortOrder): boolean;
216
- /** The sort and filter state a header cell shows: the column's query by dataIndex, its sort order and filtered values */
217
207
  static getColumnQueryState<Q extends {
218
208
  dataIndex?: unknown;
219
209
  sortOrder?: unknown;
@@ -233,43 +223,45 @@ export default class TableFoundation<RecordType, P extends TableBaseProps<Record
233
223
  */
234
224
  static deriveState<R, C extends BaseColumnProps<R> = BaseColumnProps<R>>(props: TableBaseProps<R>, state: TableColumnsState<R, C>, flattenColumns: C[]): Partial<TableColumnsState<R, C>> | null;
235
225
  /**
236
- * @param flattenColumns the leaf columns of the props
237
226
  * @param queries copies of flattenColumns with initColumnsFilteredValueAndSorterOrder applied; the framework copies
238
227
  * them, since a deep clone would break framework values held by a column
239
228
  */
240
229
  static getInitialState<R, C extends BaseColumnProps<R> = BaseColumnProps<R>>(props: TableBaseProps<R>, flattenColumns: C[], queries: C[]): TableColumnsState<R, C>;
241
230
  /** Hosts call it after mount, on body scroll and when the table or its content resizes */
242
- syncScrollEdges(): void;
231
+ syncScrollEdges: () => void;
243
232
  init(): void;
244
- /**
245
- * @param prevProps the props of the previous commit
246
- * @param prevFlattenColumns the flattenColumns state of the previous commit
247
- */
248
- handleUpdate(prevProps: P, prevFlattenColumns: S['flattenColumns']): void;
233
+ handleUpdate: (prevProps: TableBaseProps<RecordType>, prevFlattenColumns: TableBaseState<RecordType>["flattenColumns"]) => void;
249
234
  initExpandedRowKeys({ groups }?: {
250
235
  groups?: Map<string | number, Set<BaseRowKeyType>>;
251
236
  }): void;
252
- getCurrentPageData(dataSource?: RecordType[], pagination?: BasePagination, queries?: BaseColumnProps<RecordType>[]): BasePageData<RecordType>;
237
+ getCurrentPageData: (dataSource?: RecordType[], pagination?: BasePagination, queries?: BaseColumnProps<RecordType>[]) => BasePageData<RecordType>;
253
238
  /** Scrolls back to the first row; a pagination.onChange that takes over paging still gets the scroll */
254
- resetScrollY(): void;
239
+ resetScrollY: () => void;
255
240
  setPage: (currentPage: number, currentPageSize: number) => void;
256
- handleSelectRow(realKey: BaseRowKeyType, selected: boolean, e: any): void;
257
- handleSelectAllRow(selected: boolean, e: any): void;
258
- handleRowExpanded(expanded: boolean, realKey: BaseRowKeyType, domEvent: any): void;
259
- toggleShowFilter(dataIndex: string, visible: boolean): void;
260
- handleFilterSelect(dataIndex: string, data?: {
241
+ handleSelectionKeyUp: (e: Pick<KeyboardEvent, "key" | "shiftKey">) => void;
242
+ handleSelectRow: (realKey: BaseRowKeyType, selected: boolean, e?: BaseSelectRowEvent) => void;
243
+ handleSelectAllRow: (selected: boolean, e?: Pick<Event, "stopPropagation">) => void;
244
+ handleRowExpanded: (expanded: boolean, realKey: BaseRowKeyType, domEvent: any) => void;
245
+ toggleShowFilter: (dataIndex: string, visible: boolean) => void;
246
+ handleFilterSelect: (dataIndex: string, data?: {
261
247
  filteredValue?: string[];
262
- }): void;
263
- handleSort({ dataIndex }?: {
248
+ }) => void;
249
+ handleSort: ({ dataIndex }?: {
264
250
  dataIndex?: string;
265
251
  sortOrder?: BaseSortOrder;
266
- }): void;
267
- /**
268
- * Select or deselect a row by clicking it when rowSelection.clickRow is set
269
- */
270
- handleRowClickSelection(rowKey: BaseRowKeyType, selected: boolean, e: Pick<Event, 'stopPropagation'>): void;
252
+ }) => void;
253
+ handleRowClickSelection: (rowKey: BaseRowKeyType, selected: boolean, e: BaseSelectRowEvent) => void;
271
254
  }
272
255
  export type BaseRowKeyType = string | number;
256
+ /** A row click passes its mouse event; a checkbox change passes its change event, with the click in nativeEvent */
257
+ export interface BaseSelectRowEvent {
258
+ stopPropagation: () => void;
259
+ shiftKey?: boolean;
260
+ nativeEvent?: {
261
+ shiftKey?: boolean;
262
+ detail?: number;
263
+ };
264
+ }
273
265
  export type BaseRowKey<RecordType> = BaseRowKeyType | ((record: RecordType) => BaseRowKeyType);
274
266
  export interface BasePagination {
275
267
  total?: number;
@@ -285,7 +277,6 @@ export interface BaseHeadWidth {
285
277
  }
286
278
  export interface BasePageData<RecordType> {
287
279
  dataSource?: RecordType[];
288
- /** Group key (what groupBy returns) -> the row keys in that group */
289
280
  groups?: Map<string | number, Set<BaseRowKeyType>>;
290
281
  pagination?: BasePagination;
291
282
  disabledRowKeys?: BaseRowKeyType[];