@douyinfe/semi-foundation 2.22.3 → 2.23.0-alpha.2

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 (76) hide show
  1. package/cascader/cascader.scss +15 -0
  2. package/cascader/variables.scss +1 -0
  3. package/checkbox/variables.scss +1 -1
  4. package/form/form.scss +3 -4
  5. package/form/interface.ts +8 -4
  6. package/form/rtl.scss +0 -1
  7. package/form/variables.scss +38 -35
  8. package/image/imageFoundation.ts +1 -1
  9. package/image/previewFooterFoundation.ts +2 -2
  10. package/image/previewImageFoundation.ts +0 -1
  11. package/image/previewInnerFoundation.ts +2 -2
  12. package/lib/cjs/cascader/cascader.css +12 -0
  13. package/lib/cjs/cascader/cascader.scss +15 -0
  14. package/lib/cjs/cascader/variables.scss +1 -0
  15. package/lib/cjs/checkbox/variables.scss +1 -1
  16. package/lib/cjs/form/form.css +0 -2
  17. package/lib/cjs/form/form.scss +3 -4
  18. package/lib/cjs/form/interface.d.ts +8 -6
  19. package/lib/cjs/form/rtl.scss +0 -1
  20. package/lib/cjs/form/variables.scss +38 -35
  21. package/lib/cjs/image/imageFoundation.js +1 -1
  22. package/lib/cjs/image/previewFooterFoundation.js +2 -2
  23. package/lib/cjs/image/previewInnerFoundation.d.ts +1 -1
  24. package/lib/cjs/image/previewInnerFoundation.js +1 -1
  25. package/lib/cjs/navigation/navigation.css +6 -0
  26. package/lib/cjs/navigation/navigation.scss +9 -0
  27. package/lib/cjs/table/constants.d.ts +1 -0
  28. package/lib/cjs/table/constants.js +4 -2
  29. package/lib/cjs/table/table.css +2 -1
  30. package/lib/cjs/table/table.scss +2 -1
  31. package/lib/cjs/tabs/tabs.css +40 -0
  32. package/lib/cjs/tabs/tabs.scss +43 -2
  33. package/lib/cjs/tabs/variables.scss +20 -0
  34. package/lib/cjs/tooltip/constants.d.ts +1 -0
  35. package/lib/cjs/tooltip/constants.js +2 -2
  36. package/lib/cjs/tooltip/foundation.d.ts +21 -2
  37. package/lib/cjs/tooltip/foundation.js +352 -77
  38. package/lib/cjs/transfer/foundation.d.ts +1 -1
  39. package/lib/cjs/transfer/foundation.js +3 -4
  40. package/lib/es/cascader/cascader.css +12 -0
  41. package/lib/es/cascader/cascader.scss +15 -0
  42. package/lib/es/cascader/variables.scss +1 -0
  43. package/lib/es/checkbox/variables.scss +1 -1
  44. package/lib/es/form/form.css +0 -2
  45. package/lib/es/form/form.scss +3 -4
  46. package/lib/es/form/interface.d.ts +8 -6
  47. package/lib/es/form/rtl.scss +0 -1
  48. package/lib/es/form/variables.scss +38 -35
  49. package/lib/es/image/imageFoundation.js +1 -1
  50. package/lib/es/image/previewFooterFoundation.js +2 -2
  51. package/lib/es/image/previewInnerFoundation.d.ts +1 -1
  52. package/lib/es/image/previewInnerFoundation.js +1 -1
  53. package/lib/es/navigation/navigation.css +6 -0
  54. package/lib/es/navigation/navigation.scss +9 -0
  55. package/lib/es/table/constants.d.ts +1 -0
  56. package/lib/es/table/constants.js +4 -2
  57. package/lib/es/table/table.css +2 -1
  58. package/lib/es/table/table.scss +2 -1
  59. package/lib/es/tabs/tabs.css +40 -0
  60. package/lib/es/tabs/tabs.scss +43 -2
  61. package/lib/es/tabs/variables.scss +20 -0
  62. package/lib/es/tooltip/constants.d.ts +1 -0
  63. package/lib/es/tooltip/constants.js +2 -2
  64. package/lib/es/tooltip/foundation.d.ts +21 -2
  65. package/lib/es/tooltip/foundation.js +352 -77
  66. package/lib/es/transfer/foundation.d.ts +1 -1
  67. package/lib/es/transfer/foundation.js +3 -4
  68. package/navigation/navigation.scss +9 -0
  69. package/package.json +2 -2
  70. package/table/constants.ts +2 -0
  71. package/table/table.scss +2 -1
  72. package/tabs/tabs.scss +43 -2
  73. package/tabs/variables.scss +20 -0
  74. package/tooltip/constants.ts +1 -0
  75. package/tooltip/foundation.ts +318 -78
  76. package/transfer/foundation.ts +3 -3
@@ -408,6 +408,21 @@ $module: #{$prefix}-cascader;
408
408
  &-empty {
409
409
  margin-right: $spacing-cascader_empty_icon-marginRight;
410
410
  }
411
+
412
+ &-left {
413
+ margin-left: $spacing-cascader_option-icon-marginLeft;
414
+ }
415
+ }
416
+
417
+ &-spin-icon {
418
+ width: $width-cascader-icon;
419
+ height: $width-cascader-icon;
420
+ line-height: 0;
421
+
422
+ & svg {
423
+ width: $width-cascader-icon;
424
+ height: $width-cascader-icon;
425
+ }
411
426
  }
412
427
 
413
428
  &-label {
@@ -51,6 +51,7 @@ $spacing-cascader_selection_tagInput-marginLeft: - $spacing-extra-tight; // 级
51
51
  $spacing-cascader_selection_input-marginLeft: $spacing-extra-tight; // 级联选择触发器多选搜索时输入框的左外边距
52
52
  $spacing-cascader_selection_n-marginRight: $spacing-extra-tight; // 超出 maxTagCount 后,+n 的右外边距
53
53
  $spacing-cascader_clearBtn-marginRight: 12px; // 级联选择触发器清空按钮右侧外边距
54
+ $spacing-cascader_option-icon-marginLeft: 8px; // 级联选择菜单项图标左侧外边距
54
55
 
55
56
  $color-cascader_selection_n-text-default: var(--semi-color-text-0); // 超出 maxTagCount 后,+n 的文字默认颜色
56
57
  $color-cascader_selection_n-text-disabled: var(--semi-color-disabled-text); // 超出 maxTagCount 后,+n 的文字disabled颜色
@@ -52,7 +52,7 @@ $spacing-checkbox_extra-marginTop: $spacing-extra-tight; // extra 副标题顶
52
52
  $spacing-checkbox_cardType-paddingX: $spacing-base; // 卡片类型复选框的水平内间距
53
53
  $spacing-checkbox_cardType-paddingY: $spacing-base-tight; // 卡片类型复选框的垂直内间距
54
54
  $spacing-checkbox_cardType_inner-marginRight: $spacing-tight; // 卡片类型复选框 inner 的右外边距
55
- $spacing-checkbox_card_group_vertical-marginBottom: $spacing-base; // 卡片类型复选框的垂直向下外边距
55
+ $spacing-checkbox_card_group_vertical-marginBottom: $spacing-base; // 卡片样式复选框的下间距
56
56
 
57
57
  $color-checkbox_extra-text-default: var(--semi-color-text-2); // extra 副标题文字颜色
58
58
 
package/form/form.scss CHANGED
@@ -88,9 +88,7 @@ $rating: #{$prefix}-rating;
88
88
  }
89
89
 
90
90
  &-field-label {
91
- // padding-left: $spacing-base;
92
91
  box-sizing: border-box;
93
- padding-right: $spacing-form_label-paddingRight;
94
92
  font-weight: $font-form_label-fontWeight;
95
93
  color: $color-form_label-text-default;
96
94
  margin-bottom: $spacing-form_label-marginBottom;
@@ -146,6 +144,7 @@ $rating: #{$prefix}-rating;
146
144
  @include font-size-regular;
147
145
  display: flex;
148
146
  align-items: center;
147
+ // TODO help text margin token?
149
148
  margin-top: $spacing-form_message-marginTop;
150
149
  .#{$prefix}-icon-alert_triangle {
151
150
  color: $color-form_alertIcon-icon-default;
@@ -204,8 +203,8 @@ $rating: #{$prefix}-rating;
204
203
  .#{$switch},
205
204
  .#{$rating} {
206
205
  vertical-align: middle;
207
- margin-top: $spacing-form_label_small-paddingTop;
208
- margin-bottom: $spacing-form_label_small-paddingTop;
206
+ margin-top: $spacing-form_switch_rating_marginY;
207
+ margin-bottom: $spacing-form_switch_rating_marginY;
209
208
  }
210
209
  }
211
210
 
package/form/interface.ts CHANGED
@@ -9,24 +9,28 @@ export type FieldValidateTriggerType = BasicTriggerType | Array<BasicTriggerType
9
9
 
10
10
  export type CommonFieldError = boolean | string | Array<any> | undefined | unknown;
11
11
 
12
- export interface BaseFormAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
12
+ export type BasicFieldError = Array<any>;
13
+
14
+ export interface BaseFormAdapter<P = Record<string, any>, S = Record<string, any>, Values extends object = any> extends DefaultAdapter<P, S> {
13
15
  cloneDeep: (val: any, ...rest: any[]) => any;
14
16
  notifySubmit: (values: any) => void;
15
- notifySubmitFail: (errors: Record<string, any>, values: any) => void;
17
+ notifySubmitFail: (errors: Record<keyof Values, BasicFieldError>, values: Partial<Values>) => void;
16
18
  forceUpdate: (callback?: () => void) => void;
17
19
  notifyChange: (formState: FormState) => void;
18
20
  notifyValueChange: (values: any, changedValues: any) => void;
19
21
  notifyReset: () => void;
20
- getInitValues: () => Record<string, any>;
22
+ getInitValues: () => Partial<Values>;
21
23
  getFormProps: (keys: undefined | string | Array<string>) => any;
22
24
  getAllErrorDOM: () => NodeList;
23
25
  getFieldDOM: (field: string) => Node;
24
26
  initFormId: () => void
25
27
  }
26
28
 
29
+ export type AllErrors<T> = T extends Record<string, any> ? { [K in keyof T]?: string } : Record<string, any>;
30
+
27
31
  export interface FormState<T extends Record<string, any> = any> {
28
32
  values?: T extends Record<string, any> ? T : Record<string, any>;
29
- errors?: T extends Record<string, any> ? { [K in keyof T]?: string } : Record<string, any>;
33
+ errors?: AllErrors<T>;
30
34
  touched?: T extends Record<string, any> ? { [K in keyof T]?: boolean } : Record<string, any>
31
35
  }
32
36
  export interface setValuesConfig {
package/form/rtl.scss CHANGED
@@ -33,7 +33,6 @@ $rating: #{$prefix}-rating;
33
33
 
34
34
  &-field-label {
35
35
  padding-right: 0;
36
- padding-left: $spacing-form_label-paddingRight;
37
36
 
38
37
  &-with-extra {
39
38
  .#{$field}-label-extra {
@@ -1,45 +1,48 @@
1
- $spacing-form_label-paddingTop: ($height-control-default - 20px) * 0.5; // 水平布局表单标题顶部内边距
2
- $spacing-form_label_small-paddingTop: ($height-control-default - 24px) * 0.5; // 水平布局 小尺寸表单标题顶部内边距
3
-
4
- $spacing-form_field_horizontal-paddingRight: $spacing-base; // 水平布局表单标题右侧内边距
1
+ // form field
2
+ $spacing-form_field_horizontal-paddingRight: $spacing-base; // 水平布局表单项右侧内边距
5
3
  $spacing-form_field_group_horizontal-paddingRight: $spacing-base; // 水平布局表单组标题右侧内边距
6
-
7
- $spacing-form_field_vertical-paddingTop: $spacing-base-tight; // 垂直布局表单顶部内边距
8
- $spacing-form_field_vertical-paddingBottom: $spacing-base-tight; // 垂直布局表单底部内边距
9
-
4
+ $spacing-form_field_vertical-paddingTop: $spacing-base-tight; // 表单项顶部内边距(垂直布局)
5
+ $spacing-form_field_vertical-paddingBottom: $spacing-base-tight; // 表单项底部内边距(垂直布局)
10
6
  $spacing-form_field_group_vertical-paddingTop: $spacing-base-tight; // 垂直布局表单组顶部内边距
11
7
  $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
8
 
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
- $spacing-form_label_posTop-paddingTop: $spacing-extra-tight; // 垂直布局表单标题顶部内边距
23
- $spacing-form_label_posTop-paddingBottom: $spacing-extra-tight; // 垂直布局表单标题底部内边距
24
- $spacing-form_label_extra_posMid-marginTop: $spacing-extra-tight; // 表单额外信息辅助文字顶部外边距 - 居中
25
- $spacing-form_label_extra_posMid-marginBottom: $spacing-extra-tight; // 表单额外信息辅助文字底部外边距 - 居中
26
- $spacing-form_label_extra_posBottom-marginTop: $spacing-extra-tight; // 表单额外信息辅助文字顶部外边距 - 底部
27
- $spacing-form_statusIcon-marginRight: $spacing-extra-tight; // 表单校验图标右侧外边距
9
+ // form label
10
+ $spacing-form_label-paddingTop: ($height-control-default - 20px) * 0.5; // 表单项标签顶部内边距(水平布局)
11
+ $spacing-form_label-marginBottom: $spacing-extra-tight; // 表单项标签底部外边距
12
+ $spacing-form_label_extra-marginLeft: $spacing-extra-tight; // 表单项标签额外信息左侧边距
13
+ $spacing-form_label_required-marginLeft: $spacing-extra-tight; // 表单项标签必填标志左侧边距
14
+ $spacing-form_label_posLeft-marginRight: 0; // 表单项左侧标签右侧外边距
15
+ $spacing-form_label_posLeft-marginBottom: 0; // 表单项左侧标签底部外边距
16
+ $spacing-form_label_posTop-paddingTop: $spacing-extra-tight; // 表单项顶部标签顶部边距
17
+ $spacing-form_label_posTop-paddingBottom: $spacing-extra-tight; // 表单项顶部标签底部边距
18
+ $spacing-form_label_extra_posMid-marginTop: $spacing-extra-tight; // 表单项标签 图标/可选标记 顶部外边距
19
+ $spacing-form_label_extra_posMid-marginBottom: $spacing-extra-tight; // 表单项标签 图标/可选标记 底部外边距 - 居中
20
+ $spacing-form_label_extra_posBottom-marginTop: $spacing-extra-tight; // 表单项标签 图标/可选标记 顶部外边距 - 底部
21
+
22
+ // form switch rating需要额外margin以对齐高度 32px
23
+ $spacing-form_switch_rating_marginY: ($height-control-default - 24px) * 0.5; // Switch / Rating 表单项顶部内边距(水平布局)
28
24
 
29
- $spacing-form_message-marginTop: $spacing-extra-tight; // 表单校验信息顶部外边距
25
+ $color-form_requiredMark_disabled-text-default: var(--semi-color-danger); // 禁用表单项必填标记颜色
26
+ $color-form_label_disabled-text-default: var(--semi-color-disabled-text); // 禁用表单项标签文字颜色
27
+ $font-form_label-fontWeight: $font-weight-bold; // 表单项标签字重
30
28
 
31
- $font-form_label-fontWeight: $font-weight-bold; // 表单标题字重
29
+ $color-form_label-text-default: var(--semi-color-text-0); // 表单项标签文字颜色
30
+ $color-form_label_optional-text-default: var(--semi-color-tertiary); // 表单项标签可选标记颜色
31
+ $color-form_label_extra-text-default: var(--semi-color-tertiary); // 表单项标签图标颜色
32
+ $color-form_requiredMark-text-default: var(--semi-color-danger); // 必填标记颜色
32
33
  $font-form_requiredMark-fontWeight: $font-weight-bold; // 表单必填标识字重
33
34
 
34
- $color-form_label-text-default: var(--semi-color-text-0); // 表单标题文字颜色
35
- $color-form_label_optional-text-default: var(--semi-color-tertiary); // 表单可选标记文字颜色
36
- $color-form_label_extra-text-default: var(--semi-color-tertiary); // 表单额外信息辅助文字颜色
35
+ // form errormessage
36
+ $color-form_message_error-text-default: var(--semi-color-danger); // 错误提示颜色
37
+ $color-form_alertIcon-icon-default: var(--semi-color-warning); // 警告图标颜色
38
+ $spacing-form_statusIcon-marginRight: $spacing-extra-tight; // 表单校验状态图标右侧外边距
39
+ $spacing-form_message-marginTop: $spacing-extra-tight; // 表单错误信息、辅助文字顶部外边距
37
40
 
38
- $color-form_label_disabled-text-default: var(--semi-color-disabled-text); // 禁用表单项标题文字颜色
39
- $color-form_requiredMark-text-default: var(--semi-color-danger); // 必填标记颜色
40
- $color-form_requiredMark_disabled-text-default: var(--semi-color-danger); // 禁用表单项必填标记颜色
41
- $color-form_alertIcon-icon-default: var(--semi-color-warning); // 警告表单项图标颜色
42
- $color-form_message_error-text-default: var(--semi-color-danger); // 错误表单项图标颜色
41
+ // form section
43
42
  $color-form_section-text-default: var(--semi-color-text-0); // 表单分组标题文字颜色
44
- $color-form_section-border-default: var(--semi-color-border); // 表单分组描边颜色
45
- $width-form_section-border: $border-thickness-control; // 表单分组描边宽度
43
+ $color-form_section-border-default: var(--semi-color-border); // 表单分组标题底部描边颜色
44
+ $width-form_section-border: $border-thickness-control; // 表单分组标题底部描边宽度
45
+ $spacing-form_section-marginTop: $spacing-super-loose - $spacing-base-tight; // 表单分组顶部内边距
46
+ $spacing-form_section_text-paddingBottom: $spacing-tight; // 表单分组标题底部内边距
47
+ $spacing-form_section_text-marginBottom: $spacing-extra-tight; // 表单分组标题底部外边距
48
+
@@ -50,7 +50,7 @@ export default class ImageFoundation<P = Record<string, any>, S = Record<string,
50
50
  if (isObject(preview)) {
51
51
  const { onVisibleChange } = preview as any;
52
52
  onVisibleChange && onVisibleChange(newVisible);
53
- if (!("visible" in this.getProps())) {
53
+ if (!("visible" in preview)) {
54
54
  this.setState({
55
55
  previewVisible: newVisible,
56
56
  } as any);
@@ -20,9 +20,9 @@ export default class PreviewFooterFoundation<P = Record<string, any>, S = Record
20
20
  handleValueChange = (value: number): void => {
21
21
  const { onZoomIn, onZoomOut, zoom } = this.getProps();
22
22
  if (value > zoom) {
23
- onZoomIn(value / 100);
23
+ onZoomIn(Number((value / 100).toFixed(2)));
24
24
  } else {
25
- onZoomOut(value / 100);
25
+ onZoomOut(Number((value / 100).toFixed(2)));
26
26
  }
27
27
  this._adapter.setStartMouseOffset(value);
28
28
  };
@@ -257,7 +257,6 @@ export default class PreviewImageFoundation<P = Record<string, any>, S = Record<
257
257
  }
258
258
  if (canDragVertical) {
259
259
  newY = newY > 0 ? 0 : newY < extremeTop ? extremeTop : newY;
260
-
261
260
  }
262
261
  const _offset = {
263
262
  x: newX,
@@ -4,7 +4,7 @@ import { getPreloadImagArr, downloadImage, isTargetEmit } from "./utils";
4
4
 
5
5
  export interface PreviewInnerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
6
6
  getIsInGroup: () => boolean;
7
- notifyChange: (index: number) => void;
7
+ notifyChange: (index: number, direction: string) => void;
8
8
  notifyZoom: (zoom: number, increase: boolean) => void;
9
9
  notifyClose: () => void;
10
10
  notifyVisibleChange: (visible: boolean) => void;
@@ -119,7 +119,7 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
119
119
  currentIndex: newIndex,
120
120
  } as any);
121
121
  }
122
- this._adapter.notifyChange(newIndex);
122
+ this._adapter.notifyChange(newIndex, direction);
123
123
  this.setState({
124
124
  direction,
125
125
  rotation: 0,
@@ -337,6 +337,18 @@
337
337
  .semi-cascader-option-lists .semi-cascader-option-icon-active, .semi-cascader-option-lists .semi-cascader-option-icon-empty {
338
338
  margin-right: 8px;
339
339
  }
340
+ .semi-cascader-option-lists .semi-cascader-option-icon-left {
341
+ margin-left: 8px;
342
+ }
343
+ .semi-cascader-option-lists .semi-cascader-option-spin-icon {
344
+ width: 16px;
345
+ height: 16px;
346
+ line-height: 0;
347
+ }
348
+ .semi-cascader-option-lists .semi-cascader-option-spin-icon svg {
349
+ width: 16px;
350
+ height: 16px;
351
+ }
340
352
  .semi-cascader-option-lists .semi-cascader-option-label {
341
353
  display: flex;
342
354
  align-items: center;
@@ -408,6 +408,21 @@ $module: #{$prefix}-cascader;
408
408
  &-empty {
409
409
  margin-right: $spacing-cascader_empty_icon-marginRight;
410
410
  }
411
+
412
+ &-left {
413
+ margin-left: $spacing-cascader_option-icon-marginLeft;
414
+ }
415
+ }
416
+
417
+ &-spin-icon {
418
+ width: $width-cascader-icon;
419
+ height: $width-cascader-icon;
420
+ line-height: 0;
421
+
422
+ & svg {
423
+ width: $width-cascader-icon;
424
+ height: $width-cascader-icon;
425
+ }
411
426
  }
412
427
 
413
428
  &-label {
@@ -51,6 +51,7 @@ $spacing-cascader_selection_tagInput-marginLeft: - $spacing-extra-tight; // 级
51
51
  $spacing-cascader_selection_input-marginLeft: $spacing-extra-tight; // 级联选择触发器多选搜索时输入框的左外边距
52
52
  $spacing-cascader_selection_n-marginRight: $spacing-extra-tight; // 超出 maxTagCount 后,+n 的右外边距
53
53
  $spacing-cascader_clearBtn-marginRight: 12px; // 级联选择触发器清空按钮右侧外边距
54
+ $spacing-cascader_option-icon-marginLeft: 8px; // 级联选择菜单项图标左侧外边距
54
55
 
55
56
  $color-cascader_selection_n-text-default: var(--semi-color-text-0); // 超出 maxTagCount 后,+n 的文字默认颜色
56
57
  $color-cascader_selection_n-text-disabled: var(--semi-color-disabled-text); // 超出 maxTagCount 后,+n 的文字disabled颜色
@@ -52,7 +52,7 @@ $spacing-checkbox_extra-marginTop: $spacing-extra-tight; // extra 副标题顶
52
52
  $spacing-checkbox_cardType-paddingX: $spacing-base; // 卡片类型复选框的水平内间距
53
53
  $spacing-checkbox_cardType-paddingY: $spacing-base-tight; // 卡片类型复选框的垂直内间距
54
54
  $spacing-checkbox_cardType_inner-marginRight: $spacing-tight; // 卡片类型复选框 inner 的右外边距
55
- $spacing-checkbox_card_group_vertical-marginBottom: $spacing-base; // 卡片类型复选框的垂直向下外边距
55
+ $spacing-checkbox_card_group_vertical-marginBottom: $spacing-base; // 卡片样式复选框的下间距
56
56
 
57
57
  $color-checkbox_extra-text-default: var(--semi-color-text-2); // extra 副标题文字颜色
58
58
 
@@ -45,7 +45,6 @@
45
45
  }
46
46
  .semi-form-field-label {
47
47
  box-sizing: border-box;
48
- padding-right: 16px;
49
48
  font-weight: 600;
50
49
  color: var(--semi-color-text-0);
51
50
  margin-bottom: 4px;
@@ -232,7 +231,6 @@
232
231
  .semi-rtl .semi-form-field-label,
233
232
  .semi-portal-rtl .semi-form-field-label {
234
233
  padding-right: 0;
235
- padding-left: 16px;
236
234
  }
237
235
  .semi-rtl .semi-form-field-label-with-extra .semi-form-field-label-extra,
238
236
  .semi-portal-rtl .semi-form-field-label-with-extra .semi-form-field-label-extra {
@@ -88,9 +88,7 @@ $rating: #{$prefix}-rating;
88
88
  }
89
89
 
90
90
  &-field-label {
91
- // padding-left: $spacing-base;
92
91
  box-sizing: border-box;
93
- padding-right: $spacing-form_label-paddingRight;
94
92
  font-weight: $font-form_label-fontWeight;
95
93
  color: $color-form_label-text-default;
96
94
  margin-bottom: $spacing-form_label-marginBottom;
@@ -146,6 +144,7 @@ $rating: #{$prefix}-rating;
146
144
  @include font-size-regular;
147
145
  display: flex;
148
146
  align-items: center;
147
+ // TODO help text margin token?
149
148
  margin-top: $spacing-form_message-marginTop;
150
149
  .#{$prefix}-icon-alert_triangle {
151
150
  color: $color-form_alertIcon-icon-default;
@@ -204,8 +203,8 @@ $rating: #{$prefix}-rating;
204
203
  .#{$switch},
205
204
  .#{$rating} {
206
205
  vertical-align: middle;
207
- margin-top: $spacing-form_label_small-paddingTop;
208
- margin-bottom: $spacing-form_label_small-paddingTop;
206
+ margin-top: $spacing-form_switch_rating_marginY;
207
+ margin-bottom: $spacing-form_switch_rating_marginY;
209
208
  }
210
209
  }
211
210
 
@@ -3,25 +3,27 @@ import { Options as scrollIntoViewOptions } from 'scroll-into-view-if-needed';
3
3
  export declare type BasicTriggerType = 'blur' | 'change' | 'custom' | 'mount';
4
4
  export declare type FieldValidateTriggerType = BasicTriggerType | Array<BasicTriggerType>;
5
5
  export declare type CommonFieldError = boolean | string | Array<any> | undefined | unknown;
6
- export interface BaseFormAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
6
+ export declare type BasicFieldError = Array<any>;
7
+ export interface BaseFormAdapter<P = Record<string, any>, S = Record<string, any>, Values extends object = any> extends DefaultAdapter<P, S> {
7
8
  cloneDeep: (val: any, ...rest: any[]) => any;
8
9
  notifySubmit: (values: any) => void;
9
- notifySubmitFail: (errors: Record<string, any>, values: any) => void;
10
+ notifySubmitFail: (errors: Record<keyof Values, BasicFieldError>, values: Partial<Values>) => void;
10
11
  forceUpdate: (callback?: () => void) => void;
11
12
  notifyChange: (formState: FormState) => void;
12
13
  notifyValueChange: (values: any, changedValues: any) => void;
13
14
  notifyReset: () => void;
14
- getInitValues: () => Record<string, any>;
15
+ getInitValues: () => Partial<Values>;
15
16
  getFormProps: (keys: undefined | string | Array<string>) => any;
16
17
  getAllErrorDOM: () => NodeList;
17
18
  getFieldDOM: (field: string) => Node;
18
19
  initFormId: () => void;
19
20
  }
21
+ export declare type AllErrors<T> = T extends Record<string, any> ? {
22
+ [K in keyof T]?: string;
23
+ } : Record<string, any>;
20
24
  export interface FormState<T extends Record<string, any> = any> {
21
25
  values?: T extends Record<string, any> ? T : Record<string, any>;
22
- errors?: T extends Record<string, any> ? {
23
- [K in keyof T]?: string;
24
- } : Record<string, any>;
26
+ errors?: AllErrors<T>;
25
27
  touched?: T extends Record<string, any> ? {
26
28
  [K in keyof T]?: boolean;
27
29
  } : Record<string, any>;
@@ -33,7 +33,6 @@ $rating: #{$prefix}-rating;
33
33
 
34
34
  &-field-label {
35
35
  padding-right: 0;
36
- padding-left: $spacing-form_label-paddingRight;
37
36
 
38
37
  &-with-extra {
39
38
  .#{$field}-label-extra {
@@ -1,45 +1,48 @@
1
- $spacing-form_label-paddingTop: ($height-control-default - 20px) * 0.5; // 水平布局表单标题顶部内边距
2
- $spacing-form_label_small-paddingTop: ($height-control-default - 24px) * 0.5; // 水平布局 小尺寸表单标题顶部内边距
3
-
4
- $spacing-form_field_horizontal-paddingRight: $spacing-base; // 水平布局表单标题右侧内边距
1
+ // form field
2
+ $spacing-form_field_horizontal-paddingRight: $spacing-base; // 水平布局表单项右侧内边距
5
3
  $spacing-form_field_group_horizontal-paddingRight: $spacing-base; // 水平布局表单组标题右侧内边距
6
-
7
- $spacing-form_field_vertical-paddingTop: $spacing-base-tight; // 垂直布局表单顶部内边距
8
- $spacing-form_field_vertical-paddingBottom: $spacing-base-tight; // 垂直布局表单底部内边距
9
-
4
+ $spacing-form_field_vertical-paddingTop: $spacing-base-tight; // 表单项顶部内边距(垂直布局)
5
+ $spacing-form_field_vertical-paddingBottom: $spacing-base-tight; // 表单项底部内边距(垂直布局)
10
6
  $spacing-form_field_group_vertical-paddingTop: $spacing-base-tight; // 垂直布局表单组顶部内边距
11
7
  $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
8
 
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
- $spacing-form_label_posTop-paddingTop: $spacing-extra-tight; // 垂直布局表单标题顶部内边距
23
- $spacing-form_label_posTop-paddingBottom: $spacing-extra-tight; // 垂直布局表单标题底部内边距
24
- $spacing-form_label_extra_posMid-marginTop: $spacing-extra-tight; // 表单额外信息辅助文字顶部外边距 - 居中
25
- $spacing-form_label_extra_posMid-marginBottom: $spacing-extra-tight; // 表单额外信息辅助文字底部外边距 - 居中
26
- $spacing-form_label_extra_posBottom-marginTop: $spacing-extra-tight; // 表单额外信息辅助文字顶部外边距 - 底部
27
- $spacing-form_statusIcon-marginRight: $spacing-extra-tight; // 表单校验图标右侧外边距
9
+ // form label
10
+ $spacing-form_label-paddingTop: ($height-control-default - 20px) * 0.5; // 表单项标签顶部内边距(水平布局)
11
+ $spacing-form_label-marginBottom: $spacing-extra-tight; // 表单项标签底部外边距
12
+ $spacing-form_label_extra-marginLeft: $spacing-extra-tight; // 表单项标签额外信息左侧边距
13
+ $spacing-form_label_required-marginLeft: $spacing-extra-tight; // 表单项标签必填标志左侧边距
14
+ $spacing-form_label_posLeft-marginRight: 0; // 表单项左侧标签右侧外边距
15
+ $spacing-form_label_posLeft-marginBottom: 0; // 表单项左侧标签底部外边距
16
+ $spacing-form_label_posTop-paddingTop: $spacing-extra-tight; // 表单项顶部标签顶部边距
17
+ $spacing-form_label_posTop-paddingBottom: $spacing-extra-tight; // 表单项顶部标签底部边距
18
+ $spacing-form_label_extra_posMid-marginTop: $spacing-extra-tight; // 表单项标签 图标/可选标记 顶部外边距
19
+ $spacing-form_label_extra_posMid-marginBottom: $spacing-extra-tight; // 表单项标签 图标/可选标记 底部外边距 - 居中
20
+ $spacing-form_label_extra_posBottom-marginTop: $spacing-extra-tight; // 表单项标签 图标/可选标记 顶部外边距 - 底部
21
+
22
+ // form switch rating需要额外margin以对齐高度 32px
23
+ $spacing-form_switch_rating_marginY: ($height-control-default - 24px) * 0.5; // Switch / Rating 表单项顶部内边距(水平布局)
28
24
 
29
- $spacing-form_message-marginTop: $spacing-extra-tight; // 表单校验信息顶部外边距
25
+ $color-form_requiredMark_disabled-text-default: var(--semi-color-danger); // 禁用表单项必填标记颜色
26
+ $color-form_label_disabled-text-default: var(--semi-color-disabled-text); // 禁用表单项标签文字颜色
27
+ $font-form_label-fontWeight: $font-weight-bold; // 表单项标签字重
30
28
 
31
- $font-form_label-fontWeight: $font-weight-bold; // 表单标题字重
29
+ $color-form_label-text-default: var(--semi-color-text-0); // 表单项标签文字颜色
30
+ $color-form_label_optional-text-default: var(--semi-color-tertiary); // 表单项标签可选标记颜色
31
+ $color-form_label_extra-text-default: var(--semi-color-tertiary); // 表单项标签图标颜色
32
+ $color-form_requiredMark-text-default: var(--semi-color-danger); // 必填标记颜色
32
33
  $font-form_requiredMark-fontWeight: $font-weight-bold; // 表单必填标识字重
33
34
 
34
- $color-form_label-text-default: var(--semi-color-text-0); // 表单标题文字颜色
35
- $color-form_label_optional-text-default: var(--semi-color-tertiary); // 表单可选标记文字颜色
36
- $color-form_label_extra-text-default: var(--semi-color-tertiary); // 表单额外信息辅助文字颜色
35
+ // form errormessage
36
+ $color-form_message_error-text-default: var(--semi-color-danger); // 错误提示颜色
37
+ $color-form_alertIcon-icon-default: var(--semi-color-warning); // 警告图标颜色
38
+ $spacing-form_statusIcon-marginRight: $spacing-extra-tight; // 表单校验状态图标右侧外边距
39
+ $spacing-form_message-marginTop: $spacing-extra-tight; // 表单错误信息、辅助文字顶部外边距
37
40
 
38
- $color-form_label_disabled-text-default: var(--semi-color-disabled-text); // 禁用表单项标题文字颜色
39
- $color-form_requiredMark-text-default: var(--semi-color-danger); // 必填标记颜色
40
- $color-form_requiredMark_disabled-text-default: var(--semi-color-danger); // 禁用表单项必填标记颜色
41
- $color-form_alertIcon-icon-default: var(--semi-color-warning); // 警告表单项图标颜色
42
- $color-form_message_error-text-default: var(--semi-color-danger); // 错误表单项图标颜色
41
+ // form section
43
42
  $color-form_section-text-default: var(--semi-color-text-0); // 表单分组标题文字颜色
44
- $color-form_section-border-default: var(--semi-color-border); // 表单分组描边颜色
45
- $width-form_section-border: $border-thickness-control; // 表单分组描边宽度
43
+ $color-form_section-border-default: var(--semi-color-border); // 表单分组标题底部描边颜色
44
+ $width-form_section-border: $border-thickness-control; // 表单分组标题底部描边宽度
45
+ $spacing-form_section-marginTop: $spacing-super-loose - $spacing-base-tight; // 表单分组顶部内边距
46
+ $spacing-form_section_text-paddingBottom: $spacing-tight; // 表单分组标题底部内边距
47
+ $spacing-form_section_text-marginBottom: $spacing-extra-tight; // 表单分组标题底部外边距
48
+
@@ -71,7 +71,7 @@ class ImageFoundation extends _foundation.default {
71
71
  } = preview;
72
72
  onVisibleChange && onVisibleChange(newVisible);
73
73
 
74
- if (!("visible" in this.getProps())) {
74
+ if (!("visible" in preview)) {
75
75
  this.setState({
76
76
  previewVisible: newVisible
77
77
  });
@@ -39,9 +39,9 @@ class PreviewFooterFoundation extends _foundation.default {
39
39
  } = this.getProps();
40
40
 
41
41
  if (value > zoom) {
42
- onZoomIn(value / 100);
42
+ onZoomIn(Number((value / 100).toFixed(2)));
43
43
  } else {
44
- onZoomOut(value / 100);
44
+ onZoomOut(Number((value / 100).toFixed(2)));
45
45
  }
46
46
 
47
47
  this._adapter.setStartMouseOffset(value);
@@ -1,7 +1,7 @@
1
1
  import BaseFoundation, { DefaultAdapter } from "../base/foundation";
2
2
  export interface PreviewInnerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
3
3
  getIsInGroup: () => boolean;
4
- notifyChange: (index: number) => void;
4
+ notifyChange: (index: number, direction: string) => void;
5
5
  notifyZoom: (zoom: number, increase: boolean) => void;
6
6
  notifyClose: () => void;
7
7
  notifyVisibleChange: (visible: boolean) => void;
@@ -133,7 +133,7 @@ class PreviewInnerFoundation extends _foundation.default {
133
133
  });
134
134
  }
135
135
 
136
- this._adapter.notifyChange(newIndex);
136
+ this._adapter.notifyChange(newIndex, direction);
137
137
 
138
138
  this.setState({
139
139
  direction,
@@ -87,6 +87,12 @@
87
87
  align-items: center;
88
88
  justify-content: flex-start;
89
89
  }
90
+ .semi-navigation-item-has-link {
91
+ padding: 0;
92
+ }
93
+ .semi-navigation-item-has-link .semi-navigation-item-link {
94
+ padding: 8px 12px;
95
+ }
90
96
  .semi-navigation-item-sub {
91
97
  padding: 0;
92
98
  }
@@ -113,6 +113,15 @@ $module: #{$prefix}-navigation;
113
113
  justify-content: flex-start;
114
114
  }
115
115
 
116
+ // when item has link, add the padding to link instead of item
117
+ &-item-has-link {
118
+ padding: 0;
119
+
120
+ .#{$module}-item-link {
121
+ padding: $spacing-navigation_item-paddingY $spacing-navigation_item-paddingX;
122
+ }
123
+ }
124
+
116
125
  &-item-sub {
117
126
  padding: $spacing-navigation_item_sub-padding;
118
127
  }
@@ -73,5 +73,6 @@ declare const numbers: {
73
73
  readonly DEFAULT_VIRTUALIZED_SECTION_ROW_SMALL_HEIGHT: number;
74
74
  readonly DEFAULT_VIRTUALIZED_ROW_SMALL_HEIGHT: number;
75
75
  readonly DEFAULT_VIRTUALIZED_ROW_SMALL_MIN_HEIGHT: number;
76
+ readonly DEFAULT_EMPTYSLOT_HEIGHT: 52;
76
77
  };
77
78
  export { cssClasses, strings, numbers };
@@ -66,7 +66,8 @@ const DEFAULT_CELL_MIDDLE_PADDING_TOP = 12;
66
66
  const DEFAULT_CELL_MIDDLE_PADDING_BOTTOM = 12;
67
67
  const DEFAULT_CELL_SMALL_PADDING_TOP = 8;
68
68
  const DEFAULT_CELL_SMALL_PADDING_BOTTOM = 8;
69
- const DEFAULT_CELL_LINE_HEIGHT = 20; // normal size
69
+ const DEFAULT_CELL_LINE_HEIGHT = 20;
70
+ const DEFAULT_EMPTYSLOT_HEIGHT = 52; // normal size
70
71
 
71
72
  const DEFAULT_VIRTUALIZED_ROW_HEIGHT = DEFAULT_CELL_LINE_HEIGHT + DEFAULT_CELL_BORDER_WITH_BOTTOM + DEFAULT_CELL_BORDER_WITH_TOP + DEFAULT_CELL_PADDING_TOP + DEFAULT_CELL_PADDING_BOTTOM;
72
73
  const DEFAULT_VIRTUALIZED_ROW_MIN_HEIGHT = DEFAULT_CELL_PADDING_TOP + DEFAULT_CELL_PADDING_BOTTOM + DEFAULT_CELL_BORDER_WITH_BOTTOM; // middle size
@@ -102,6 +103,7 @@ const numbers = {
102
103
  DEFAULT_VIRTUALIZED_ROW_MIDDLE_MIN_HEIGHT,
103
104
  DEFAULT_VIRTUALIZED_SECTION_ROW_SMALL_HEIGHT: DEFAULT_VIRTUALIZED_ROW_SMALL_HEIGHT,
104
105
  DEFAULT_VIRTUALIZED_ROW_SMALL_HEIGHT,
105
- DEFAULT_VIRTUALIZED_ROW_SMALL_MIN_HEIGHT
106
+ DEFAULT_VIRTUALIZED_ROW_SMALL_MIN_HEIGHT,
107
+ DEFAULT_EMPTYSLOT_HEIGHT
106
108
  };
107
109
  exports.numbers = numbers;
@@ -394,7 +394,8 @@
394
394
  border-right: 1px solid var(--semi-color-border);
395
395
  }
396
396
  .semi-table-placeholder {
397
- position: relative;
397
+ position: sticky;
398
+ left: 0px;
398
399
  z-index: 1;
399
400
  padding: 16px 12px;
400
401
  color: var(--semi-color-text-2);
@@ -481,7 +481,8 @@ $module: #{$prefix}-table;
481
481
  }
482
482
 
483
483
  &-placeholder {
484
- position: relative;
484
+ position: sticky;
485
+ left: 0px;
485
486
  z-index: 1;
486
487
  padding: #{$spacing-table-paddingY} #{$spacing-table-paddingX};
487
488
  color: $color-table_placeholder-text-default;