@douyinfe/semi-foundation 2.38.3-alpha.2 → 2.38.3-alpha.3

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.
@@ -8,6 +8,7 @@ var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
8
8
  var _get2 = _interopRequireDefault(require("lodash/get"));
9
9
  var _foundation = _interopRequireDefault(require("../base/foundation"));
10
10
  var _constants = require("./constants");
11
+ var _fastCopy = _interopRequireDefault(require("fast-copy"));
11
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
13
  const Boundary = _constants.strings.BOUNDARY_MAP;
13
14
  const OverflowDirection = _constants.strings.OVERFLOW_DIR;
@@ -39,7 +40,8 @@ class OverflowListFoundation extends _foundation.default {
39
40
  if (!this.isScrollMode()) {
40
41
  return overflow;
41
42
  }
42
- const visibleStateArr = items.map(_ref => {
43
+ const cloneItems = (0, _fastCopy.default)(items);
44
+ const visibleStateArr = cloneItems.map(_ref => {
43
45
  let {
44
46
  key
45
47
  } = _ref;
@@ -48,8 +50,8 @@ class OverflowListFoundation extends _foundation.default {
48
50
  const visibleStart = visibleStateArr.indexOf(true);
49
51
  const visibleEnd = visibleStateArr.lastIndexOf(true);
50
52
  const overflowList = [];
51
- overflowList[0] = visibleStart >= 0 ? items.slice(0, visibleStart) : [];
52
- overflowList[1] = visibleEnd >= 0 ? items.slice(visibleEnd + 1, items.length) : items;
53
+ overflowList[0] = visibleStart >= 0 ? cloneItems.slice(0, visibleStart) : [];
54
+ overflowList[1] = visibleEnd >= 0 ? cloneItems.slice(visibleEnd + 1, cloneItems.length) : cloneItems;
53
55
  return overflowList;
54
56
  }
55
57
  handleIntersect(entries) {
@@ -75,6 +75,6 @@ export declare function getValueOrKey(data: any): any;
75
75
  export declare function normalizeValue(value: any, withObject: boolean): any;
76
76
  export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
77
77
  export declare function calcDisabledKeys(keyEntities: KeyEntities): Set<string>;
78
- export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
78
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
79
79
  export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
80
80
  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: ("auto" | "custom")[];
21
+ UPLOAD_TRIGGER: ("custom" | "auto")[];
22
22
  VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
23
23
  PROMPT_POSITION: readonly ["left", "right", "bottom"];
24
24
  };
@@ -2,6 +2,7 @@ import _cloneDeep from "lodash/cloneDeep";
2
2
  import _get from "lodash/get";
3
3
  import BaseFoundation from '../base/foundation';
4
4
  import { strings } from './constants';
5
+ import copy from 'fast-copy';
5
6
  const Boundary = strings.BOUNDARY_MAP;
6
7
  const OverflowDirection = strings.OVERFLOW_DIR;
7
8
  class OverflowListFoundation extends BaseFoundation {
@@ -32,7 +33,8 @@ class OverflowListFoundation extends BaseFoundation {
32
33
  if (!this.isScrollMode()) {
33
34
  return overflow;
34
35
  }
35
- const visibleStateArr = items.map(_ref => {
36
+ const cloneItems = copy(items);
37
+ const visibleStateArr = cloneItems.map(_ref => {
36
38
  let {
37
39
  key
38
40
  } = _ref;
@@ -41,8 +43,8 @@ class OverflowListFoundation extends BaseFoundation {
41
43
  const visibleStart = visibleStateArr.indexOf(true);
42
44
  const visibleEnd = visibleStateArr.lastIndexOf(true);
43
45
  const overflowList = [];
44
- overflowList[0] = visibleStart >= 0 ? items.slice(0, visibleStart) : [];
45
- overflowList[1] = visibleEnd >= 0 ? items.slice(visibleEnd + 1, items.length) : items;
46
+ overflowList[0] = visibleStart >= 0 ? cloneItems.slice(0, visibleStart) : [];
47
+ overflowList[1] = visibleEnd >= 0 ? cloneItems.slice(visibleEnd + 1, cloneItems.length) : cloneItems;
46
48
  return overflowList;
47
49
  }
48
50
  handleIntersect(entries) {
@@ -75,6 +75,6 @@ export declare function getValueOrKey(data: any): any;
75
75
  export declare function normalizeValue(value: any, withObject: boolean): any;
76
76
  export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
77
77
  export declare function calcDisabledKeys(keyEntities: KeyEntities): Set<string>;
78
- export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
78
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
79
79
  export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
80
80
  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: ("auto" | "custom")[];
21
+ UPLOAD_TRIGGER: ("custom" | "auto")[];
22
22
  VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
23
23
  PROMPT_POSITION: readonly ["left", "right", "bottom"];
24
24
  };
@@ -1,6 +1,8 @@
1
1
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
2
2
  import { strings } from './constants';
3
3
  import { noop, get, cloneDeep } from 'lodash';
4
+ import copy from 'fast-copy';
5
+
4
6
  const Boundary = strings.BOUNDARY_MAP;
5
7
  const OverflowDirection = strings.OVERFLOW_DIR;
6
8
 
@@ -31,13 +33,15 @@ class OverflowListFoundation extends BaseFoundation<OverflowListAdapter> {
31
33
  return overflow;
32
34
  }
33
35
 
34
- const visibleStateArr = items.map(({ key }: { key: string }) => Boolean(visibleState.get(key)));
36
+ const cloneItems = copy(items);
37
+
38
+ const visibleStateArr = cloneItems.map(({ key }: { key: string }) => Boolean(visibleState.get(key)));
35
39
  const visibleStart = visibleStateArr.indexOf(true);
36
40
  const visibleEnd = visibleStateArr.lastIndexOf(true);
37
41
 
38
42
  const overflowList = [];
39
- overflowList[0] = visibleStart >= 0 ? items.slice(0, visibleStart) : [];
40
- overflowList[1] = visibleEnd >= 0 ? items.slice(visibleEnd + 1, items.length) : items;
43
+ overflowList[0] = visibleStart >= 0 ? cloneItems.slice(0, visibleStart) : [];
44
+ overflowList[1] = visibleEnd >= 0 ? cloneItems.slice(visibleEnd + 1, cloneItems.length) : cloneItems;
41
45
  return overflowList;
42
46
  }
43
47
 
package/package.json CHANGED
@@ -1,17 +1,18 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.38.3-alpha.2",
3
+ "version": "2.38.3-alpha.3",
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.38.3-alpha.2",
10
+ "@douyinfe/semi-animation": "2.38.3-alpha.3",
11
11
  "async-validator": "^3.5.0",
12
12
  "classnames": "^2.2.6",
13
13
  "date-fns": "^2.29.3",
14
14
  "date-fns-tz": "^1.3.8",
15
+ "fast-copy": "^3.0.1",
15
16
  "lodash": "^4.17.21",
16
17
  "memoize-one": "^5.2.1",
17
18
  "scroll-into-view-if-needed": "^2.2.24"
@@ -23,7 +24,7 @@
23
24
  "*.scss",
24
25
  "*.css"
25
26
  ],
26
- "gitHead": "2b95b13c9f2ddd1205647aef6f25ce70ea6e17a2",
27
+ "gitHead": "3e28ec946a631e2fb0d57928f5271b2353df39de",
27
28
  "devDependencies": {
28
29
  "@babel/plugin-transform-runtime": "^7.15.8",
29
30
  "@babel/preset-env": "^7.15.8",