@douyinfe/semi-foundation 2.20.5-alpha.2 → 2.20.6

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.
@@ -413,7 +413,9 @@ class AutoCompleteFoundation<P = Record<string, any>, S = Record<string, any>> e
413
413
  this._adapter.notifyFocus(e);
414
414
  }
415
415
 
416
- handleBlur(e: FocusEvent) {
416
+ handleBlur(e: any) {
417
+ // https://reactjs.org/docs/legacy-event-pooling.html
418
+ e.persist();
417
419
  // In order to handle the problem of losing onClick binding when clicking on the padding area, the onBlur event is triggered first to cause the react view to be updated
418
420
  // internal-issues:1231
419
421
  setTimeout(() => {
@@ -59,6 +59,6 @@ declare class AutoCompleteFoundation<P = Record<string, any>, S = Record<string,
59
59
  _handleEnterKeyDown(): void;
60
60
  handleOptionMouseEnter(optionIndex: number): void;
61
61
  handleFocus(e: FocusEvent): void;
62
- handleBlur(e: FocusEvent): void;
62
+ handleBlur(e: any): void;
63
63
  }
64
64
  export default AutoCompleteFoundation;
@@ -497,8 +497,10 @@ class AutoCompleteFoundation extends _foundation.default {
497
497
  }
498
498
 
499
499
  handleBlur(e) {
500
- // In order to handle the problem of losing onClick binding when clicking on the padding area, the onBlur event is triggered first to cause the react view to be updated
500
+ // https://reactjs.org/docs/legacy-event-pooling.html
501
+ e.persist(); // In order to handle the problem of losing onClick binding when clicking on the padding area, the onBlur event is triggered first to cause the react view to be updated
501
502
  // internal-issues:1231
503
+
502
504
  setTimeout(() => {
503
505
  this._adapter.notifyBlur(e);
504
506
 
@@ -249,6 +249,6 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
249
249
  * - When yam open type is 'left' or 'right', weeks minHeight should be set
250
250
  * If the minHeight is not set, the change of the number of weeks will cause the scrollList to be unstable
251
251
  */
252
- getYAMOpenType(): "left" | "right" | "both" | "none";
252
+ getYAMOpenType(): "left" | "right" | "none" | "both";
253
253
  }
254
254
  export {};
@@ -74,6 +74,6 @@ export declare function getValueOrKey(data: any): any;
74
74
  export declare function normalizeValue(value: any, withObject: boolean): any;
75
75
  export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
76
76
  export declare function calcDisabledKeys(keyEntities: KeyEntities): Set<string>;
77
- export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
77
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
78
78
  export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
79
79
  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
  };
@@ -14,7 +14,7 @@ function getUuid(prefix) {
14
14
 
15
15
  function getUuidv4() {
16
16
  try {
17
- return crypto.randomUUID();
17
+ return String(1e7 + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => (Number(c) ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> Number(c) / 4).toString(16));
18
18
  } catch (err) {
19
19
  return getUuid('semi');
20
20
  }
@@ -59,6 +59,6 @@ declare class AutoCompleteFoundation<P = Record<string, any>, S = Record<string,
59
59
  _handleEnterKeyDown(): void;
60
60
  handleOptionMouseEnter(optionIndex: number): void;
61
61
  handleFocus(e: FocusEvent): void;
62
- handleBlur(e: FocusEvent): void;
62
+ handleBlur(e: any): void;
63
63
  }
64
64
  export default AutoCompleteFoundation;
@@ -483,8 +483,10 @@ class AutoCompleteFoundation extends BaseFoundation {
483
483
  }
484
484
 
485
485
  handleBlur(e) {
486
- // In order to handle the problem of losing onClick binding when clicking on the padding area, the onBlur event is triggered first to cause the react view to be updated
486
+ // https://reactjs.org/docs/legacy-event-pooling.html
487
+ e.persist(); // In order to handle the problem of losing onClick binding when clicking on the padding area, the onBlur event is triggered first to cause the react view to be updated
487
488
  // internal-issues:1231
489
+
488
490
  setTimeout(() => {
489
491
  this._adapter.notifyBlur(e);
490
492
 
@@ -249,6 +249,6 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
249
249
  * - When yam open type is 'left' or 'right', weeks minHeight should be set
250
250
  * If the minHeight is not set, the change of the number of weeks will cause the scrollList to be unstable
251
251
  */
252
- getYAMOpenType(): "left" | "right" | "both" | "none";
252
+ getYAMOpenType(): "left" | "right" | "none" | "both";
253
253
  }
254
254
  export {};
@@ -74,6 +74,6 @@ export declare function getValueOrKey(data: any): any;
74
74
  export declare function normalizeValue(value: any, withObject: boolean): any;
75
75
  export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
76
76
  export declare function calcDisabledKeys(keyEntities: KeyEntities): Set<string>;
77
- export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
77
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
78
78
  export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
79
79
  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
  };
@@ -4,7 +4,7 @@ export default function getUuid(prefix) {
4
4
 
5
5
  function getUuidv4() {
6
6
  try {
7
- return crypto.randomUUID();
7
+ return String(1e7 + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => (Number(c) ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> Number(c) / 4).toString(16));
8
8
  } catch (err) {
9
9
  return getUuid('semi');
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.20.5-alpha.2",
3
+ "version": "2.20.6",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
@@ -23,7 +23,7 @@
23
23
  "*.scss",
24
24
  "*.css"
25
25
  ],
26
- "gitHead": "4c4b25fd1c11f392a1c323fb6a11a50a744b24ad",
26
+ "gitHead": "a3ff44756182c53fb1216ab4fd974edea4473bcd",
27
27
  "devDependencies": {
28
28
  "@babel/plugin-transform-runtime": "^7.15.8",
29
29
  "@babel/preset-env": "^7.15.8",
package/utils/uuid.ts CHANGED
@@ -5,7 +5,9 @@ export default function getUuid(prefix: string) {
5
5
  // https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
6
6
  function getUuidv4() {
7
7
  try {
8
- return crypto.randomUUID();
8
+ return String(1e7 + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
9
+ (Number(c) ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (Number(c) / 4)))).toString(16)
10
+ );
9
11
  } catch (err) {
10
12
  return getUuid('semi');
11
13
  }