@douyinfe/semi-foundation 2.18.2 → 2.18.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.
@@ -1,7 +1,5 @@
1
- export declare function cloneDeep(value: any, customizer?: (v: any) => any): any;
2
1
  export declare function equalWith(value: any, other: any, customizer?: (...args: any[]) => boolean): boolean;
3
2
  export declare function getColumnKey(column: any, keyPropNames: any[]): any;
4
- export declare function mergeColumns(oldColumns?: any[], newColumns?: any[], keyPropNames?: any[], deep?: boolean): any[];
5
3
  /**
6
4
  *
7
5
  * @param {Array<number>} arr
@@ -80,7 +78,7 @@ export declare function mergeQueries(query: Record<string, any>, queries?: Recor
80
78
  * @param {Object[]} columns columns retain the column width after resize
81
79
  * @param {Object[]} newColumns
82
80
  */
83
- export declare function withResizeWidth(columns: Record<string, any>[], newColumns: Record<string, any>[]): any;
81
+ export declare function withResizeWidth(columns: Record<string, any>[], newColumns: Record<string, any>[]): Record<string, any>[];
84
82
  /**
85
83
  * Pure function version of the same function in table foundation
86
84
  * This is not accessible in getDerivedStateFromProps, so fork one out
@@ -10,7 +10,6 @@ _Object$defineProperty(exports, "__esModule", {
10
10
 
11
11
  exports.arrayAdd = arrayAdd;
12
12
  exports.assignColumnKeys = assignColumnKeys;
13
- exports.cloneDeep = cloneDeep;
14
13
  exports.equalWith = equalWith;
15
14
  exports.expandBtnShouldInRow = expandBtnShouldInRow;
16
15
  exports.filterColumns = filterColumns;
@@ -42,7 +41,6 @@ exports.isScrollbarColumn = isScrollbarColumn;
42
41
  exports.isSelected = isSelected;
43
42
  exports.isSelectionColumn = isSelectionColumn;
44
43
  exports.isTreeTable = isTreeTable;
45
- exports.mergeColumns = mergeColumns;
46
44
  exports.mergeQueries = mergeQueries;
47
45
  exports.sliceColumnsByLevel = sliceColumnsByLevel;
48
46
  exports.warnIfNoDataIndex = warnIfNoDataIndex;
@@ -50,8 +48,6 @@ exports.withResizeWidth = withResizeWidth;
50
48
 
51
49
  var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
52
50
 
53
- var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
54
-
55
51
  var _every = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/every"));
56
52
 
57
53
  var _includes2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
@@ -64,6 +60,8 @@ var _some2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stab
64
60
 
65
61
  var _findIndex2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find-index"));
66
62
 
63
+ var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
64
+
67
65
  var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/splice"));
68
66
 
69
67
  var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
@@ -78,10 +76,6 @@ var _findIndex3 = _interopRequireDefault(require("lodash/findIndex"));
78
76
 
79
77
  var _each2 = _interopRequireDefault(require("lodash/each"));
80
78
 
81
- var _clone2 = _interopRequireDefault(require("lodash/clone"));
82
-
83
- var _map2 = _interopRequireDefault(require("lodash/map"));
84
-
85
79
  var _find2 = _interopRequireDefault(require("lodash/find"));
86
80
 
87
81
  var _filter2 = _interopRequireDefault(require("lodash/filter"));
@@ -90,26 +84,12 @@ var _get2 = _interopRequireDefault(require("lodash/get"));
90
84
 
91
85
  var _isEqualWith2 = _interopRequireDefault(require("lodash/isEqualWith"));
92
86
 
93
- var _cloneDeepWith2 = _interopRequireDefault(require("lodash/cloneDeepWith"));
94
-
95
87
  var _constants = require("./constants");
96
88
 
97
89
  var _isNullOrUndefined = _interopRequireDefault(require("../utils/isNullOrUndefined"));
98
90
 
99
91
  var _Logger = _interopRequireDefault(require("../utils/Logger"));
100
92
 
101
- function cloneDeep(value, customizer) {
102
- return (0, _cloneDeepWith2.default)(value, v => {
103
- if (typeof v === 'function') {
104
- return v;
105
- } else if (typeof customizer === 'function') {
106
- return customizer(v);
107
- }
108
-
109
- return undefined;
110
- });
111
- }
112
-
113
93
  function equalWith(value, other, customizer) {
114
94
  return (0, _isEqualWith2.default)(value, other, function (objVal, othVal) {
115
95
  if (typeof objVal === 'function' && typeof othVal === 'function') {
@@ -143,27 +123,6 @@ function getColumnKey(column, keyPropNames) {
143
123
  });
144
124
  return key;
145
125
  }
146
-
147
- function mergeColumns() {
148
- let oldColumns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
149
- let newColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
150
- let keyPropNames = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
151
- let deep = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
152
- const finalColumns = [];
153
- const clone = deep ? cloneDeep : _clone2.default;
154
- (0, _map2.default)(newColumns, newColumn => {
155
- newColumn = (0, _assign.default)({}, newColumn);
156
- const key = getColumnKey(newColumn, keyPropNames);
157
- const oldColumn = key != null && (0, _find2.default)(oldColumns, item => getColumnKey(item, keyPropNames) === key);
158
-
159
- if (oldColumn) {
160
- finalColumns.push(clone((0, _assign.default)((0, _assign.default)({}, oldColumn), newColumn)));
161
- } else {
162
- finalColumns.push(clone(newColumn));
163
- }
164
- });
165
- return finalColumns;
166
- }
167
126
  /**
168
127
  *
169
128
  * @param {Array<number>} arr
@@ -551,7 +510,7 @@ function mergeQueries(query) {
551
510
 
552
511
 
553
512
  function withResizeWidth(columns, newColumns) {
554
- const _newColumns = cloneDeep(newColumns);
513
+ const _newColumns = [...newColumns];
555
514
 
556
515
  for (const column of columns) {
557
516
  if (!(0, _isNullOrUndefined.default)(column.width)) {
@@ -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): 1 | -1 | 0;
77
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
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: ("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,7 +1,5 @@
1
- export declare function cloneDeep(value: any, customizer?: (v: any) => any): any;
2
1
  export declare function equalWith(value: any, other: any, customizer?: (...args: any[]) => boolean): boolean;
3
2
  export declare function getColumnKey(column: any, keyPropNames: any[]): any;
4
- export declare function mergeColumns(oldColumns?: any[], newColumns?: any[], keyPropNames?: any[], deep?: boolean): any[];
5
3
  /**
6
4
  *
7
5
  * @param {Array<number>} arr
@@ -80,7 +78,7 @@ export declare function mergeQueries(query: Record<string, any>, queries?: Recor
80
78
  * @param {Object[]} columns columns retain the column width after resize
81
79
  * @param {Object[]} newColumns
82
80
  */
83
- export declare function withResizeWidth(columns: Record<string, any>[], newColumns: Record<string, any>[]): any;
81
+ export declare function withResizeWidth(columns: Record<string, any>[], newColumns: Record<string, any>[]): Record<string, any>[];
84
82
  /**
85
83
  * Pure function version of the same function in table foundation
86
84
  * This is not accessible in getDerivedStateFromProps, so fork one out
@@ -4,36 +4,22 @@ import _includes from "lodash/includes";
4
4
  import _some from "lodash/some";
5
5
  import _findIndex from "lodash/findIndex";
6
6
  import _each from "lodash/each";
7
- import _clone from "lodash/clone";
8
- import _map from "lodash/map";
9
7
  import _find from "lodash/find";
10
8
  import _filter from "lodash/filter";
11
9
  import _get from "lodash/get";
12
10
  import _isEqualWith from "lodash/isEqualWith";
13
- import _cloneDeepWith from "lodash/cloneDeepWith";
14
11
  import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
15
- import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
16
12
  import _everyInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/every";
17
13
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
18
14
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
19
15
  import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
20
16
  import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
21
17
  import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
18
+ import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
22
19
  import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
23
20
  import { strings, numbers } from './constants';
24
21
  import isNullOrUndefined from '../utils/isNullOrUndefined';
25
22
  import Logger from '../utils/Logger';
26
- export function cloneDeep(value, customizer) {
27
- return _cloneDeepWith(value, v => {
28
- if (typeof v === 'function') {
29
- return v;
30
- } else if (typeof customizer === 'function') {
31
- return customizer(v);
32
- }
33
-
34
- return undefined;
35
- });
36
- }
37
23
  export function equalWith(value, other, customizer) {
38
24
  return _isEqualWith(value, other, function (objVal, othVal) {
39
25
  if (typeof objVal === 'function' && typeof othVal === 'function') {
@@ -68,29 +54,6 @@ export function getColumnKey(column, keyPropNames) {
68
54
 
69
55
  return key;
70
56
  }
71
- export function mergeColumns() {
72
- let oldColumns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
73
- let newColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
74
- let keyPropNames = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
75
- let deep = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
76
- const finalColumns = [];
77
- const clone = deep ? cloneDeep : _clone;
78
-
79
- _map(newColumns, newColumn => {
80
- newColumn = _Object$assign({}, newColumn);
81
- const key = getColumnKey(newColumn, keyPropNames);
82
-
83
- const oldColumn = key != null && _find(oldColumns, item => getColumnKey(item, keyPropNames) === key);
84
-
85
- if (oldColumn) {
86
- finalColumns.push(clone(_Object$assign(_Object$assign({}, oldColumn), newColumn)));
87
- } else {
88
- finalColumns.push(clone(newColumn));
89
- }
90
- });
91
-
92
- return finalColumns;
93
- }
94
57
  /**
95
58
  *
96
59
  * @param {Array<number>} arr
@@ -458,7 +421,7 @@ export function mergeQueries(query) {
458
421
  */
459
422
 
460
423
  export function withResizeWidth(columns, newColumns) {
461
- const _newColumns = cloneDeep(newColumns);
424
+ const _newColumns = [...newColumns];
462
425
 
463
426
  for (const column of columns) {
464
427
  if (!isNullOrUndefined(column.width)) {
@@ -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): 1 | -1 | 0;
77
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
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: ("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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.18.2",
3
+ "version": "2.18.3",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
@@ -24,7 +24,7 @@
24
24
  "*.scss",
25
25
  "*.css"
26
26
  ],
27
- "gitHead": "576fdef0e26abd56fef7893ad7f6f80b5e652c9d",
27
+ "gitHead": "680b7e5bb7e5c52474df556db3a72f65c0be28c0",
28
28
  "devDependencies": {
29
29
  "@babel/plugin-proposal-decorators": "^7.15.8",
30
30
  "@babel/plugin-transform-runtime": "^7.15.8",
package/table/utils.ts CHANGED
@@ -2,7 +2,6 @@
2
2
  /* eslint-disable no-param-reassign */
3
3
  /* eslint-disable eqeqeq */
4
4
  import {
5
- cloneDeepWith,
6
5
  isEqualWith,
7
6
  get,
8
7
  filter,
@@ -21,17 +20,6 @@ import isNullOrUndefined from '../utils/isNullOrUndefined';
21
20
  import Logger from '../utils/Logger';
22
21
 
23
22
 
24
- export function cloneDeep(value: any, customizer?: (v: any) => any) {
25
- return cloneDeepWith(value, v => {
26
- if (typeof v === 'function') {
27
- return v;
28
- } else if (typeof customizer === 'function') {
29
- return customizer(v);
30
- }
31
- return undefined;
32
- });
33
- }
34
-
35
23
  export function equalWith(value: any, other: any, customizer?: (...args: any[]) => boolean) {
36
24
  return isEqualWith(value, other, (objVal, othVal, ...rest) => {
37
25
  if (typeof objVal === 'function' && typeof othVal === 'function') {
@@ -61,31 +49,6 @@ export function getColumnKey(column: any, keyPropNames: any[]): any {
61
49
  return key;
62
50
  }
63
51
 
64
- export function mergeColumns(oldColumns: any[] = [], newColumns: any[] = [], keyPropNames: any[] = null, deep = true) {
65
- const finalColumns: any[] = [];
66
- const clone = deep ? cloneDeep : lodashClone;
67
-
68
- map(newColumns, newColumn => {
69
- newColumn = { ...newColumn };
70
- const key = getColumnKey(newColumn, keyPropNames);
71
-
72
- const oldColumn = key != null && find(oldColumns, item => getColumnKey(item, keyPropNames) === key);
73
-
74
- if (oldColumn) {
75
- finalColumns.push(
76
- clone({
77
- ...oldColumn,
78
- ...newColumn,
79
- })
80
- );
81
- } else {
82
- finalColumns.push(clone(newColumn));
83
- }
84
- });
85
-
86
- return finalColumns;
87
- }
88
-
89
52
  /**
90
53
  *
91
54
  * @param {Array<number>} arr
@@ -432,7 +395,7 @@ export function mergeQueries(query: Record<string, any>, queries: Record<string,
432
395
  * @param {Object[]} newColumns
433
396
  */
434
397
  export function withResizeWidth(columns: Record<string, any>[], newColumns: Record<string, any>[]) {
435
- const _newColumns = cloneDeep(newColumns);
398
+ const _newColumns = [ ...newColumns ];
436
399
  for (const column of columns) {
437
400
  if (!isNullOrUndefined(column.width)) {
438
401
  const currentColumn = column.key;