@douyinfe/semi-foundation 2.38.3-alpha.3 → 2.38.3-alpha.3-patch-fix-2932
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.
- package/lib/cjs/navigation/subNavFoundation.js +3 -1
- package/lib/cjs/overflowList/foundation.js +3 -5
- package/lib/cjs/slider/foundation.js +2 -3
- package/lib/cjs/tooltip/foundation.js +1 -0
- package/lib/cjs/tree/treeUtil.d.ts +1 -1
- package/lib/cjs/upload/constants.d.ts +1 -1
- package/lib/es/navigation/subNavFoundation.js +3 -1
- package/lib/es/overflowList/foundation.js +3 -5
- package/lib/es/slider/foundation.js +2 -3
- package/lib/es/tooltip/foundation.js +1 -0
- package/lib/es/tree/treeUtil.d.ts +1 -1
- package/lib/es/upload/constants.d.ts +1 -1
- package/navigation/subNavFoundation.ts +3 -1
- package/overflowList/foundation.ts +3 -7
- package/package.json +3 -4
- package/slider/foundation.ts +4 -5
- package/tooltip/foundation.ts +1 -0
|
@@ -33,7 +33,9 @@ class SubNavFoundation extends _foundation.default {
|
|
|
33
33
|
// this.log('invoke SubNavFoundation init()');
|
|
34
34
|
this._timer = null;
|
|
35
35
|
}
|
|
36
|
-
destroy() {
|
|
36
|
+
destroy() {
|
|
37
|
+
this.clearDelayTimer();
|
|
38
|
+
}
|
|
37
39
|
clearDelayTimer() {
|
|
38
40
|
if (this._timer) {
|
|
39
41
|
clearTimeout(this._timer);
|
|
@@ -8,7 +8,6 @@ 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"));
|
|
12
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
12
|
const Boundary = _constants.strings.BOUNDARY_MAP;
|
|
14
13
|
const OverflowDirection = _constants.strings.OVERFLOW_DIR;
|
|
@@ -40,8 +39,7 @@ class OverflowListFoundation extends _foundation.default {
|
|
|
40
39
|
if (!this.isScrollMode()) {
|
|
41
40
|
return overflow;
|
|
42
41
|
}
|
|
43
|
-
const
|
|
44
|
-
const visibleStateArr = cloneItems.map(_ref => {
|
|
42
|
+
const visibleStateArr = items.map(_ref => {
|
|
45
43
|
let {
|
|
46
44
|
key
|
|
47
45
|
} = _ref;
|
|
@@ -50,8 +48,8 @@ class OverflowListFoundation extends _foundation.default {
|
|
|
50
48
|
const visibleStart = visibleStateArr.indexOf(true);
|
|
51
49
|
const visibleEnd = visibleStateArr.lastIndexOf(true);
|
|
52
50
|
const overflowList = [];
|
|
53
|
-
overflowList[0] = visibleStart >= 0 ?
|
|
54
|
-
overflowList[1] = visibleEnd >= 0 ?
|
|
51
|
+
overflowList[0] = visibleStart >= 0 ? items.slice(0, visibleStart) : [];
|
|
52
|
+
overflowList[1] = visibleEnd >= 0 ? items.slice(visibleEnd + 1, items.length) : items;
|
|
55
53
|
return overflowList;
|
|
56
54
|
}
|
|
57
55
|
handleIntersect(entries) {
|
|
@@ -111,12 +111,11 @@ class SliderFoundation extends _foundation.default {
|
|
|
111
111
|
*/
|
|
112
112
|
this.handleMousePos = (clientX, clientY) => {
|
|
113
113
|
const parentRect = this._adapter.getParentRect();
|
|
114
|
-
const scrollParent = this._adapter.getScrollParentVal();
|
|
115
114
|
const parentX = parentRect ? parentRect.left : 0;
|
|
116
115
|
const parentY = parentRect ? parentRect.top : 0;
|
|
117
116
|
return {
|
|
118
|
-
x: clientX - parentX
|
|
119
|
-
y: clientY - parentY
|
|
117
|
+
x: clientX - parentX,
|
|
118
|
+
y: clientY - parentY
|
|
120
119
|
};
|
|
121
120
|
};
|
|
122
121
|
/**
|
|
@@ -235,6 +235,7 @@ class Tooltip extends _foundation.default {
|
|
|
235
235
|
this._adapter.unregisterClickOutsideHandler();
|
|
236
236
|
this.unBindResizeEvent();
|
|
237
237
|
this.unBindScrollEvent();
|
|
238
|
+
clearTimeout(this._timer);
|
|
238
239
|
}
|
|
239
240
|
_bindTriggerEvent(triggerEventSet) {
|
|
240
241
|
this._adapter.registerTriggerEvent(triggerEventSet);
|
|
@@ -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):
|
|
78
|
+
export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
|
|
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: ("
|
|
21
|
+
UPLOAD_TRIGGER: ("auto" | "custom")[];
|
|
22
22
|
VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
|
|
23
23
|
PROMPT_POSITION: readonly ["left", "right", "bottom"];
|
|
24
24
|
};
|
|
@@ -26,7 +26,9 @@ export default class SubNavFoundation extends BaseFoundation {
|
|
|
26
26
|
// this.log('invoke SubNavFoundation init()');
|
|
27
27
|
this._timer = null;
|
|
28
28
|
}
|
|
29
|
-
destroy() {
|
|
29
|
+
destroy() {
|
|
30
|
+
this.clearDelayTimer();
|
|
31
|
+
}
|
|
30
32
|
clearDelayTimer() {
|
|
31
33
|
if (this._timer) {
|
|
32
34
|
clearTimeout(this._timer);
|
|
@@ -2,7 +2,6 @@ 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';
|
|
6
5
|
const Boundary = strings.BOUNDARY_MAP;
|
|
7
6
|
const OverflowDirection = strings.OVERFLOW_DIR;
|
|
8
7
|
class OverflowListFoundation extends BaseFoundation {
|
|
@@ -33,8 +32,7 @@ class OverflowListFoundation extends BaseFoundation {
|
|
|
33
32
|
if (!this.isScrollMode()) {
|
|
34
33
|
return overflow;
|
|
35
34
|
}
|
|
36
|
-
const
|
|
37
|
-
const visibleStateArr = cloneItems.map(_ref => {
|
|
35
|
+
const visibleStateArr = items.map(_ref => {
|
|
38
36
|
let {
|
|
39
37
|
key
|
|
40
38
|
} = _ref;
|
|
@@ -43,8 +41,8 @@ class OverflowListFoundation extends BaseFoundation {
|
|
|
43
41
|
const visibleStart = visibleStateArr.indexOf(true);
|
|
44
42
|
const visibleEnd = visibleStateArr.lastIndexOf(true);
|
|
45
43
|
const overflowList = [];
|
|
46
|
-
overflowList[0] = visibleStart >= 0 ?
|
|
47
|
-
overflowList[1] = visibleEnd >= 0 ?
|
|
44
|
+
overflowList[0] = visibleStart >= 0 ? items.slice(0, visibleStart) : [];
|
|
45
|
+
overflowList[1] = visibleEnd >= 0 ? items.slice(visibleEnd + 1, items.length) : items;
|
|
48
46
|
return overflowList;
|
|
49
47
|
}
|
|
50
48
|
handleIntersect(entries) {
|
|
@@ -103,12 +103,11 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
103
103
|
*/
|
|
104
104
|
this.handleMousePos = (clientX, clientY) => {
|
|
105
105
|
const parentRect = this._adapter.getParentRect();
|
|
106
|
-
const scrollParent = this._adapter.getScrollParentVal();
|
|
107
106
|
const parentX = parentRect ? parentRect.left : 0;
|
|
108
107
|
const parentY = parentRect ? parentRect.top : 0;
|
|
109
108
|
return {
|
|
110
|
-
x: clientX - parentX
|
|
111
|
-
y: clientY - parentY
|
|
109
|
+
x: clientX - parentX,
|
|
110
|
+
y: clientY - parentY
|
|
112
111
|
};
|
|
113
112
|
};
|
|
114
113
|
/**
|
|
@@ -227,6 +227,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
227
227
|
this._adapter.unregisterClickOutsideHandler();
|
|
228
228
|
this.unBindResizeEvent();
|
|
229
229
|
this.unBindScrollEvent();
|
|
230
|
+
clearTimeout(this._timer);
|
|
230
231
|
}
|
|
231
232
|
_bindTriggerEvent(triggerEventSet) {
|
|
232
233
|
this._adapter.registerTriggerEvent(triggerEventSet);
|
|
@@ -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):
|
|
78
|
+
export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
|
|
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: ("
|
|
21
|
+
UPLOAD_TRIGGER: ("auto" | "custom")[];
|
|
22
22
|
VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
|
|
23
23
|
PROMPT_POSITION: readonly ["left", "right", "bottom"];
|
|
24
24
|
};
|
|
@@ -1,8 +1,6 @@
|
|
|
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
|
-
|
|
6
4
|
const Boundary = strings.BOUNDARY_MAP;
|
|
7
5
|
const OverflowDirection = strings.OVERFLOW_DIR;
|
|
8
6
|
|
|
@@ -33,15 +31,13 @@ class OverflowListFoundation extends BaseFoundation<OverflowListAdapter> {
|
|
|
33
31
|
return overflow;
|
|
34
32
|
}
|
|
35
33
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
const visibleStateArr = cloneItems.map(({ key }: { key: string }) => Boolean(visibleState.get(key)));
|
|
34
|
+
const visibleStateArr = items.map(({ key }: { key: string }) => Boolean(visibleState.get(key)));
|
|
39
35
|
const visibleStart = visibleStateArr.indexOf(true);
|
|
40
36
|
const visibleEnd = visibleStateArr.lastIndexOf(true);
|
|
41
37
|
|
|
42
38
|
const overflowList = [];
|
|
43
|
-
overflowList[0] = visibleStart >= 0 ?
|
|
44
|
-
overflowList[1] = visibleEnd >= 0 ?
|
|
39
|
+
overflowList[0] = visibleStart >= 0 ? items.slice(0, visibleStart) : [];
|
|
40
|
+
overflowList[1] = visibleEnd >= 0 ? items.slice(visibleEnd + 1, items.length) : items;
|
|
45
41
|
return overflowList;
|
|
46
42
|
}
|
|
47
43
|
|
package/package.json
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.38.3-alpha.3",
|
|
3
|
+
"version": "2.38.3-alpha.3-patch-fix-2932",
|
|
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.3",
|
|
10
|
+
"@douyinfe/semi-animation": "2.38.3-alpha.3-patch-fix-2932",
|
|
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",
|
|
16
15
|
"lodash": "^4.17.21",
|
|
17
16
|
"memoize-one": "^5.2.1",
|
|
18
17
|
"scroll-into-view-if-needed": "^2.2.24"
|
|
@@ -24,7 +23,7 @@
|
|
|
24
23
|
"*.scss",
|
|
25
24
|
"*.css"
|
|
26
25
|
],
|
|
27
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "007aa8cccc50de0a7ee68b53bc6e1a62eed8e952",
|
|
28
27
|
"devDependencies": {
|
|
29
28
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
30
29
|
"@babel/preset-env": "^7.15.8",
|
package/slider/foundation.ts
CHANGED
|
@@ -221,10 +221,9 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
221
221
|
*/
|
|
222
222
|
handleMousePos = (clientX: number, clientY: number) => {
|
|
223
223
|
const parentRect = this._adapter.getParentRect();
|
|
224
|
-
const scrollParent = this._adapter.getScrollParentVal();
|
|
225
224
|
const parentX = parentRect ? parentRect.left : 0;
|
|
226
225
|
const parentY = parentRect ? parentRect.top : 0;
|
|
227
|
-
return { x: clientX - parentX
|
|
226
|
+
return { x: clientX - parentX, y: clientY - parentY };
|
|
228
227
|
};
|
|
229
228
|
|
|
230
229
|
/**
|
|
@@ -378,7 +377,7 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
378
377
|
* @memberof SliderFoundation
|
|
379
378
|
*/
|
|
380
379
|
outPutValue = (inputValue: SliderProps['value']) => {
|
|
381
|
-
const checkHowManyDecimals = (num: number)=>{
|
|
380
|
+
const checkHowManyDecimals = (num: number) => {
|
|
382
381
|
const reg = /^\d+(\.\d+)?$/;
|
|
383
382
|
if (reg.test(String(num))) {
|
|
384
383
|
return num.toString().split('.')[1]?.length ?? 0;
|
|
@@ -386,10 +385,10 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
386
385
|
return 0;
|
|
387
386
|
};
|
|
388
387
|
const step = this._adapter.getProp('step');
|
|
389
|
-
const transWay = (()=>{
|
|
388
|
+
const transWay = (() => {
|
|
390
389
|
const decimals = checkHowManyDecimals(step);
|
|
391
390
|
const multipler = Math.pow(10, decimals);
|
|
392
|
-
return (value: number)=>{
|
|
391
|
+
return (value: number) => {
|
|
393
392
|
return Math.round(value * multipler) / multipler;
|
|
394
393
|
};
|
|
395
394
|
})();
|
package/tooltip/foundation.ts
CHANGED
|
@@ -115,6 +115,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
115
115
|
this._adapter.unregisterClickOutsideHandler();
|
|
116
116
|
this.unBindResizeEvent();
|
|
117
117
|
this.unBindScrollEvent();
|
|
118
|
+
clearTimeout(this._timer);
|
|
118
119
|
}
|
|
119
120
|
|
|
120
121
|
_bindTriggerEvent(triggerEventSet: Record<string, any>) {
|