@douyinfe/semi-foundation 2.63.2-alpha.0 → 2.64.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 (95) hide show
  1. package/calendar/foundation.ts +20 -0
  2. package/colorPicker/AlphaSliderFoundation.ts +62 -0
  3. package/colorPicker/ColorChooseAreaFoundation.ts +86 -0
  4. package/colorPicker/ColorSliderFoundation.ts +61 -0
  5. package/colorPicker/DataPartFoundation.ts +113 -0
  6. package/colorPicker/colorPicker.scss +113 -0
  7. package/colorPicker/constants.ts +11 -0
  8. package/colorPicker/foundation.ts +206 -0
  9. package/colorPicker/interface.ts +51 -0
  10. package/colorPicker/utils/convert.ts +228 -0
  11. package/colorPicker/utils/round.ts +3 -0
  12. package/colorPicker/utils/split.ts +40 -0
  13. package/colorPicker/variables.scss +28 -0
  14. package/image/previewImageFoundation.ts +22 -17
  15. package/lib/cjs/calendar/foundation.js +18 -0
  16. package/lib/cjs/colorPicker/AlphaSliderFoundation.d.ts +27 -0
  17. package/lib/cjs/colorPicker/AlphaSliderFoundation.js +40 -0
  18. package/lib/cjs/colorPicker/ColorChooseAreaFoundation.d.ts +42 -0
  19. package/lib/cjs/colorPicker/ColorChooseAreaFoundation.js +62 -0
  20. package/lib/cjs/colorPicker/ColorSliderFoundation.d.ts +26 -0
  21. package/lib/cjs/colorPicker/ColorSliderFoundation.js +40 -0
  22. package/lib/cjs/colorPicker/DataPartFoundation.d.ts +28 -0
  23. package/lib/cjs/colorPicker/DataPartFoundation.js +115 -0
  24. package/lib/cjs/colorPicker/colorPicker.css +84 -0
  25. package/lib/cjs/colorPicker/colorPicker.scss +113 -0
  26. package/lib/cjs/colorPicker/constants.d.ts +4 -0
  27. package/lib/cjs/colorPicker/constants.js +11 -0
  28. package/lib/cjs/colorPicker/foundation.d.ts +66 -0
  29. package/lib/cjs/colorPicker/foundation.js +150 -0
  30. package/lib/cjs/colorPicker/interface.d.ts +40 -0
  31. package/lib/cjs/colorPicker/interface.js +5 -0
  32. package/lib/cjs/colorPicker/utils/convert.d.ts +28 -0
  33. package/lib/cjs/colorPicker/utils/convert.js +306 -0
  34. package/lib/cjs/colorPicker/utils/round.d.ts +1 -0
  35. package/lib/cjs/colorPicker/utils/round.js +12 -0
  36. package/lib/cjs/colorPicker/utils/split.d.ts +18 -0
  37. package/lib/cjs/colorPicker/utils/split.js +40 -0
  38. package/lib/cjs/colorPicker/variables.scss +28 -0
  39. package/lib/cjs/image/previewImageFoundation.js +22 -18
  40. package/lib/cjs/slider/foundation.d.ts +1 -0
  41. package/lib/cjs/slider/foundation.js +15 -0
  42. package/lib/cjs/tabs/constants.d.ts +0 -1
  43. package/lib/cjs/tabs/constants.js +1 -2
  44. package/lib/cjs/tabs/tabs.css +199 -28
  45. package/lib/cjs/tabs/tabs.scss +297 -336
  46. package/lib/cjs/tabs/variables.scss +2 -21
  47. package/lib/cjs/tooltip/foundation.js +2 -1
  48. package/lib/cjs/tree/treeUtil.d.ts +1 -1
  49. package/lib/cjs/upload/constants.d.ts +1 -1
  50. package/lib/cjs/upload/foundation.d.ts +1 -0
  51. package/lib/cjs/upload/foundation.js +30 -14
  52. package/lib/es/calendar/foundation.js +18 -0
  53. package/lib/es/colorPicker/AlphaSliderFoundation.d.ts +27 -0
  54. package/lib/es/colorPicker/AlphaSliderFoundation.js +33 -0
  55. package/lib/es/colorPicker/ColorChooseAreaFoundation.d.ts +42 -0
  56. package/lib/es/colorPicker/ColorChooseAreaFoundation.js +55 -0
  57. package/lib/es/colorPicker/ColorSliderFoundation.d.ts +26 -0
  58. package/lib/es/colorPicker/ColorSliderFoundation.js +33 -0
  59. package/lib/es/colorPicker/DataPartFoundation.d.ts +28 -0
  60. package/lib/es/colorPicker/DataPartFoundation.js +108 -0
  61. package/lib/es/colorPicker/colorPicker.css +84 -0
  62. package/lib/es/colorPicker/colorPicker.scss +113 -0
  63. package/lib/es/colorPicker/constants.d.ts +4 -0
  64. package/lib/es/colorPicker/constants.js +6 -0
  65. package/lib/es/colorPicker/foundation.d.ts +66 -0
  66. package/lib/es/colorPicker/foundation.js +143 -0
  67. package/lib/es/colorPicker/interface.d.ts +40 -0
  68. package/lib/es/colorPicker/interface.js +1 -0
  69. package/lib/es/colorPicker/utils/convert.d.ts +28 -0
  70. package/lib/es/colorPicker/utils/convert.js +277 -0
  71. package/lib/es/colorPicker/utils/round.d.ts +1 -0
  72. package/lib/es/colorPicker/utils/round.js +5 -0
  73. package/lib/es/colorPicker/utils/split.d.ts +18 -0
  74. package/lib/es/colorPicker/utils/split.js +34 -0
  75. package/lib/es/colorPicker/variables.scss +28 -0
  76. package/lib/es/image/previewImageFoundation.js +22 -18
  77. package/lib/es/slider/foundation.d.ts +1 -0
  78. package/lib/es/slider/foundation.js +15 -0
  79. package/lib/es/tabs/constants.d.ts +0 -1
  80. package/lib/es/tabs/constants.js +1 -2
  81. package/lib/es/tabs/tabs.css +199 -28
  82. package/lib/es/tabs/tabs.scss +297 -336
  83. package/lib/es/tabs/variables.scss +2 -21
  84. package/lib/es/tooltip/foundation.js +2 -1
  85. package/lib/es/tree/treeUtil.d.ts +1 -1
  86. package/lib/es/upload/constants.d.ts +1 -1
  87. package/lib/es/upload/foundation.d.ts +1 -0
  88. package/lib/es/upload/foundation.js +30 -14
  89. package/package.json +3 -3
  90. package/slider/foundation.ts +13 -0
  91. package/tabs/constants.ts +1 -2
  92. package/tabs/tabs.scss +297 -336
  93. package/tabs/variables.scss +2 -21
  94. package/tooltip/foundation.ts +1 -1
  95. package/upload/foundation.ts +19 -3
@@ -26,13 +26,9 @@ $color-tabs_tab_line_disabled-text-hover: var(--semi-color-disabled-text); //
26
26
 
27
27
  $color-tabs_tab_card_default-border-default: var(--semi-color-border); // 卡片式页签描边颜色 - 默认
28
28
 
29
- $color-tabs_tab_button-bg-default: transparent; // 按钮式页签背景颜色 - 默认
30
29
  $color-tabs_tab_button_selected-bg-default: var(--semi-color-primary-light-default); // 按钮式页签背景颜色 - 选中
31
30
  $color-tabs_tab_button_selected-text-default: var(--semi-color-primary); // 按钮式页签文本颜色 - 选中
32
31
  $color-tabs_tab_button-text-default: var(--semi-color-text-2); // 按钮式页签文本颜色 - 默认
33
- $color-tabs_tab_button-text-active: var(--semi-color-text-0); // 按钮式页签文本颜色 - 按下
34
- $color-tabs_tab_button-text-hover: var(--semi-color-text-0); // 按钮式页签文本颜色 - 按下
35
-
36
32
  $color-tabs_tab_button-bg-hover: var(--semi-color-fill-0); // 按钮式页签背景颜色 - 悬浮
37
33
  $color-tabs_tab_button-bg-active: var(--semi-color-fill-1); // 按钮式页签背景颜色 - 按下
38
34
 
@@ -69,10 +65,6 @@ $color-tabs_tab-pane_arrow_disabled-bg-hover: transparent;
69
65
  $color-tabs_tab-pane_arrow_disabled-text-default: var(--semi-color-disabled-text);
70
66
  $color-tabs_tab-pane_arrow_disabled-text-hover: var(--semi-color-disabled-text);
71
67
 
72
- $color-tabs_tab_slash_line: var(--semi-color-text-2); //斜线式页签分割线字体颜色
73
- // $font-tabs_tab_slash_line-fontWeight: $font-weight-regular; //斜线式页签分割线字重
74
- $font-tabs_tab_slash_line-fontSize: $font-size-regular; //斜线式页签分割线字体大小
75
-
76
68
  $font-tabs_tab-fontWeight: $font-weight-regular; // 页签文本字重 - 默认
77
69
  $font-tabs_tab_active-fontWeight: $font-weight-bold; // 页签文本字重 - 选中
78
70
 
@@ -126,11 +118,6 @@ $spacing-tabs_bar_line_tab_left-padding: 12px; // 垂直线条式页签左侧内
126
118
  $spacing-tabs_bar_line_tab_left_small-padding: $spacing-tight - 2px; // 小尺寸垂直线条式页签左侧内边距
127
119
  $spacing-tabs_bar_line_tab_left_medium-padding: $spacing-base-tight - 2px; // 中等尺寸垂直线条式页签左侧内边距
128
120
 
129
- $spacing-tabs_bar_slash_tab-paddingY: 12px; // 斜线式页签上下内边距
130
- $spacing-tabs_bar_slash_tab-paddingX: 4px; // 斜线式页签水平内边距
131
- $spacing-tabs_bar_slash-marginRight: 16px; // 斜线式页签右侧外边距
132
- $spacing-tabs_bar_slash_line_marginLeft: 16px; // 斜线式页签斜线左侧外边距
133
-
134
121
  $spacing-tabs_content-paddingY: 5px; // 页签内容区垂直方向内边距
135
122
  $spacing-tabs_content-paddingX: 0; // 页签内容区水平方向内边距
136
123
 
@@ -161,11 +148,5 @@ $radius-tabs_tab_button: var(--semi-border-radius-small); // 按钮式页签圆
161
148
  $font-tabs_bar_large-fontSize: $font-size-regular; // 大号模式 字体大小
162
149
  $font-tabs_bar_small-fontSize: $font-size-regular; // 小号模式 字体大小
163
150
  $font-tabs_bar_medium-fontSize: $font-size-regular; // 中等模式 字体大小
164
- $font-tabs_bar_button-fontSize: $font-size-regular; // 按钮式页签 字体大小
165
- $font-tabs_bar_slash-fontSize: $font-size-regular; // 斜线式页签 字体大小
166
-
167
- $font-tabs_bar_large-lineHeight: 20px; // 线条式页签大号模式 行高
168
- $font-tabs_bar_small-lineHeight: 20px; // 线条式页签小号模式 行高
169
- $font-tabs_bar_medium-lineHeight: 20px; // 线条式页签中等模式 行高
170
- $font-tabs_bar_button-lineHeight: 20px; // 按钮式页签 行高
171
- $font-tabs_bar_slash-lineHeight: 20px; // 卡片式页签 行高
151
+
152
+
@@ -77,8 +77,9 @@ export default class Tooltip extends BaseFoundation {
77
77
  });
78
78
  if (trigger === "hover") {
79
79
  const checkTriggerIsHover = () => {
80
+ var _a;
80
81
  const triggerDOM = this._adapter.getTriggerDOM();
81
- if (trigger && !triggerDOM.matches(":hover")) {
82
+ if (trigger && !((_a = triggerDOM === null || triggerDOM === void 0 ? void 0 : triggerDOM.matches) === null || _a === void 0 ? void 0 : _a.call(triggerDOM, ":hover"))) {
82
83
  this.hide();
83
84
  }
84
85
  this._adapter.off("portalInserted", checkTriggerIsHover);
@@ -83,6 +83,6 @@ export declare function getValueOrKey(data: any, keyMaps?: KeyMapProps): any;
83
83
  export declare function normalizeValue(value: any, withObject: boolean, keyMaps?: KeyMapProps): any;
84
84
  export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
85
85
  export declare function calcDisabledKeys(keyEntities: KeyEntities, keyMaps?: KeyMapProps): Set<string>;
86
- export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
86
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
87
87
  export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
88
88
  export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
@@ -18,7 +18,7 @@ declare const strings: {
18
18
  DRAG_AREA_ILLEGAL: string;
19
19
  TRIGGER_AUTO: "auto";
20
20
  TRIGGER_CUSTOM: "custom";
21
- UPLOAD_TRIGGER: ("custom" | "auto")[];
21
+ UPLOAD_TRIGGER: ("auto" | "custom")[];
22
22
  VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
23
23
  PROMPT_POSITION: readonly ["left", "right", "bottom"];
24
24
  };
@@ -80,6 +80,7 @@ export interface UploadAdapter<P = Record<string, any>, S = Record<string, any>>
80
80
  notifyPastingError: (error: Error | PermissionStatus) => void;
81
81
  }
82
82
  declare class UploadFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<UploadAdapter<P, S>, P, S> {
83
+ destroyState: boolean;
83
84
  constructor(adapter: UploadAdapter<P, S>);
84
85
  init(): void;
85
86
  destroy(): void;
@@ -43,6 +43,7 @@ const {
43
43
  class UploadFoundation extends BaseFoundation {
44
44
  constructor(adapter) {
45
45
  super(Object.assign({}, adapter));
46
+ this.destroyState = false;
46
47
  }
47
48
  init() {
48
49
  const {
@@ -62,6 +63,7 @@ class UploadFoundation extends BaseFoundation {
62
63
  if (!disabled) {
63
64
  this.unbindPastingHandler();
64
65
  }
66
+ this.destroyState = true;
65
67
  }
66
68
  getError(_ref) {
67
69
  let {
@@ -570,22 +572,36 @@ class UploadFoundation extends BaseFoundation {
570
572
  xhr.withCredentials = true;
571
573
  }
572
574
  if (xhr.upload) {
573
- xhr.upload.onprogress = e => this.handleProgress({
574
- e,
575
- fileInstance
576
- });
575
+ xhr.upload.onprogress = e => {
576
+ if (!this.destroyState) {
577
+ this.handleProgress({
578
+ e,
579
+ fileInstance
580
+ });
581
+ } else {
582
+ xhr.abort();
583
+ }
584
+ };
577
585
  }
578
586
  // Callback function after upload is completed
579
- xhr.onload = e => this.handleOnLoad({
580
- e,
581
- xhr,
582
- fileInstance
583
- });
584
- xhr.onerror = e => this.handleError({
585
- e,
586
- xhr,
587
- fileInstance
588
- });
587
+ xhr.onload = e => {
588
+ if (!this.destroyState) {
589
+ this.handleOnLoad({
590
+ e,
591
+ xhr,
592
+ fileInstance
593
+ });
594
+ }
595
+ };
596
+ xhr.onerror = e => {
597
+ if (!this.destroyState) {
598
+ this.handleError({
599
+ e,
600
+ xhr,
601
+ fileInstance
602
+ });
603
+ }
604
+ };
589
605
  // add headers
590
606
  let headers = option.headers || {};
591
607
  if (typeof headers === 'function') {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.63.2-alpha.0",
3
+ "version": "2.64.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
7
7
  "prepublishOnly": "npm run build:lib"
8
8
  },
9
9
  "dependencies": {
10
- "@douyinfe/semi-animation": "2.63.2-alpha.0",
10
+ "@douyinfe/semi-animation": "2.64.0",
11
11
  "@mdx-js/mdx": "^3.0.1",
12
12
  "async-validator": "^3.5.0",
13
13
  "classnames": "^2.2.6",
@@ -28,7 +28,7 @@
28
28
  "*.scss",
29
29
  "*.css"
30
30
  ],
31
- "gitHead": "da3c8fa2fd069e2eaf585659a6df12016483e236",
31
+ "gitHead": "b5976e500b9e93cf0cf1f3ce6f4ec87d75e1d62f",
32
32
  "devDependencies": {
33
33
  "@babel/plugin-transform-runtime": "^7.15.8",
34
34
  "@babel/preset-env": "^7.15.8",
@@ -686,7 +686,16 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
686
686
  }
687
687
  }
688
688
 
689
+ _noTooltip = () => {
690
+ const { tipFormatter, tooltipVisible } = this.getProps();
691
+ return tipFormatter === null || tooltipVisible === false;
692
+ }
693
+
689
694
  onFocus = (e: any, handler: 'min'| 'max') => {
695
+ const noTooltip = this._noTooltip();
696
+ if (noTooltip) {
697
+ return;
698
+ }
690
699
  handlePrevent(e);
691
700
  const { target } = e;
692
701
  try {
@@ -703,6 +712,10 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
703
712
  }
704
713
 
705
714
  onBlur = (e: any, handler: 'min'| 'max') => {
715
+ const noTooltip = this._noTooltip();
716
+ if (noTooltip) {
717
+ return;
718
+ }
706
719
  const { firstDotFocusVisible, secondDotFocusVisible } = this.getStates();
707
720
  if (handler === 'min') {
708
721
  firstDotFocusVisible && this._adapter.setStateVal('firstDotFocusVisible', false);
package/tabs/constants.ts CHANGED
@@ -6,7 +6,6 @@ const cssClasses = {
6
6
  TABS_BAR_LINE: `${BASE_CLASS_PREFIX}-tabs-bar-line`,
7
7
  TABS_BAR_CARD: `${BASE_CLASS_PREFIX}-tabs-bar-card`,
8
8
  TABS_BAR_BUTTON: `${BASE_CLASS_PREFIX}-tabs-bar-button`,
9
- TABS_BAR_SLASH: `${BASE_CLASS_PREFIX}-tabs-bar-slash`,
10
9
  TABS_BAR_EXTRA: `${BASE_CLASS_PREFIX}-tabs-bar-extra`,
11
10
  TABS_TAB: `${BASE_CLASS_PREFIX}-tabs-tab`,
12
11
  TABS_TAB_ACTIVE: `${BASE_CLASS_PREFIX}-tabs-tab-active`,
@@ -30,7 +29,7 @@ const numbers = {
30
29
  };
31
30
 
32
31
  const strings = {
33
- TYPE_MAP: ['line', 'card', 'button', 'slash'],
32
+ TYPE_MAP: ['line', 'card', 'button'],
34
33
  SIZE: ['small', 'medium', 'large'],
35
34
  POSITION_MAP: ['top', 'left']
36
35
  };