@douyinfe/semi-foundation 2.74.1-alpha.2 → 2.74.1-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.
- package/audioPlayer/foundation.ts +6 -6
- package/getBabelConfig.js +0 -1
- package/lib/cjs/audioPlayer/foundation.d.ts +3 -2
- package/lib/cjs/audioPlayer/foundation.js +5 -4
- package/lib/cjs/cascader/foundation.d.ts +1 -10
- package/lib/cjs/lottie/foundation.js +4 -8
- package/lib/cjs/resizable/group/index.d.ts +9 -6
- package/lib/cjs/resizable/group/index.js +13 -4
- package/lib/cjs/resizable/single/index.d.ts +9 -5
- package/lib/cjs/resizable/single/index.js +17 -4
- package/lib/cjs/resizable/types.d.ts +4 -3
- package/lib/cjs/select/foundation.js +2 -3
- package/lib/cjs/steps/bacisSteps.scss +1 -1
- package/lib/cjs/steps/steps.css +1 -1
- package/lib/cjs/tree/treeUtil.d.ts +1 -1
- package/lib/cjs/tree/treeUtil.js +0 -3
- package/lib/cjs/upload/constants.d.ts +1 -1
- package/lib/es/audioPlayer/foundation.d.ts +3 -2
- package/lib/es/audioPlayer/foundation.js +5 -4
- package/lib/es/cascader/foundation.d.ts +1 -10
- package/lib/es/resizable/group/index.d.ts +9 -6
- package/lib/es/resizable/group/index.js +13 -4
- package/lib/es/resizable/single/index.d.ts +9 -5
- package/lib/es/resizable/single/index.js +17 -4
- package/lib/es/resizable/types.d.ts +4 -3
- package/lib/es/select/foundation.js +2 -3
- package/lib/es/steps/bacisSteps.scss +1 -1
- package/lib/es/steps/steps.css +1 -1
- package/lib/es/tree/treeUtil.d.ts +1 -1
- package/lib/es/tree/treeUtil.js +0 -3
- package/lib/es/upload/constants.d.ts +1 -1
- package/package.json +4 -4
- package/resizable/group/index.ts +21 -9
- package/resizable/single/index.ts +25 -8
- package/resizable/types.ts +6 -3
- package/select/foundation.ts +2 -2
- package/steps/bacisSteps.scss +1 -1
- package/tree/treeUtil.ts +0 -3
- package/scripts/babel-plugin-lottie.js +0 -58
|
@@ -8,7 +8,7 @@ export interface AudioPlayerAdapter<P = Record<string, any>, S = Record<string,
|
|
|
8
8
|
handleStatusClick: () => void;
|
|
9
9
|
handleTimeUpdate: () => void;
|
|
10
10
|
handleTrackChange: (direction: 'next' | 'prev') => void;
|
|
11
|
-
getAudioRef: () => HTMLAudioElement
|
|
11
|
+
getAudioRef: () => React.RefObject<HTMLAudioElement>;
|
|
12
12
|
handleTimeChange: (value: number) => void;
|
|
13
13
|
handleSpeedChange: (value: { label: string; value: number }) => void;
|
|
14
14
|
handleSeek: (direction: number) => void;
|
|
@@ -23,14 +23,14 @@ class AudioPlayerFoundation extends BaseFoundation<AudioPlayerAdapter> {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
initAudioState() {
|
|
26
|
-
const
|
|
26
|
+
const audioRef = this.getAudioRef();
|
|
27
27
|
const props = this.getProps();
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
this.setState({
|
|
30
|
-
totalTime:
|
|
30
|
+
totalTime: audioRef.current?.duration || 0,
|
|
31
31
|
isPlaying: props.autoPlay,
|
|
32
|
-
volume:
|
|
33
|
-
currentRate: { label: '1.0x', value:
|
|
32
|
+
volume: audioRef.current?.volume * 100 || 100,
|
|
33
|
+
currentRate: { label: '1.0x', value: audioRef.current?.playbackRate || 1 },
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
|
package/getBabelConfig.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
3
|
export interface AudioPlayerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
3
4
|
init: () => void;
|
|
@@ -5,7 +6,7 @@ export interface AudioPlayerAdapter<P = Record<string, any>, S = Record<string,
|
|
|
5
6
|
handleStatusClick: () => void;
|
|
6
7
|
handleTimeUpdate: () => void;
|
|
7
8
|
handleTrackChange: (direction: 'next' | 'prev') => void;
|
|
8
|
-
getAudioRef: () => HTMLAudioElement
|
|
9
|
+
getAudioRef: () => React.RefObject<HTMLAudioElement>;
|
|
9
10
|
handleTimeChange: (value: number) => void;
|
|
10
11
|
handleSpeedChange: (value: {
|
|
11
12
|
label: string;
|
|
@@ -27,7 +28,7 @@ declare class AudioPlayerFoundation extends BaseFoundation<AudioPlayerAdapter> {
|
|
|
27
28
|
handleStatusClick(): void;
|
|
28
29
|
handleTimeUpdate(): void;
|
|
29
30
|
handleTrackChange(direction: 'next' | 'prev'): void;
|
|
30
|
-
getAudioRef(): HTMLAudioElement
|
|
31
|
+
getAudioRef(): import("react").RefObject<HTMLAudioElement>;
|
|
31
32
|
handleTimeChange(value: number): void;
|
|
32
33
|
handleSpeedChange(value: {
|
|
33
34
|
label: string;
|
|
@@ -11,15 +11,16 @@ class AudioPlayerFoundation extends _foundation.default {
|
|
|
11
11
|
super(Object.assign(Object.assign({}, AudioPlayerFoundation), adapter));
|
|
12
12
|
}
|
|
13
13
|
initAudioState() {
|
|
14
|
-
|
|
14
|
+
var _a, _b, _c;
|
|
15
|
+
const audioRef = this.getAudioRef();
|
|
15
16
|
const props = this.getProps();
|
|
16
17
|
this.setState({
|
|
17
|
-
totalTime: (
|
|
18
|
+
totalTime: ((_a = audioRef.current) === null || _a === void 0 ? void 0 : _a.duration) || 0,
|
|
18
19
|
isPlaying: props.autoPlay,
|
|
19
|
-
volume: (
|
|
20
|
+
volume: ((_b = audioRef.current) === null || _b === void 0 ? void 0 : _b.volume) * 100 || 100,
|
|
20
21
|
currentRate: {
|
|
21
22
|
label: '1.0x',
|
|
22
|
-
value: (
|
|
23
|
+
value: ((_c = audioRef.current) === null || _c === void 0 ? void 0 : _c.playbackRate) || 1
|
|
23
24
|
}
|
|
24
25
|
});
|
|
25
26
|
}
|
|
@@ -244,16 +244,7 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
|
|
|
244
244
|
*/
|
|
245
245
|
calcCheckedKeys(key: string, curCheckedStatus: boolean): {
|
|
246
246
|
checkedKeys: Set<string>;
|
|
247
|
-
halfCheckedKeys: Set<string>;
|
|
248
|
-
* If selectedKeys does not meet the update conditions,
|
|
249
|
-
* and state.selectedKeys is the same as selectedKeys
|
|
250
|
-
* at this time, state.selectedKeys should be cleared.
|
|
251
|
-
* A typical scenario is:
|
|
252
|
-
* The originally selected node is the leaf node, but
|
|
253
|
-
* after props.treeData is dynamically updated, the node
|
|
254
|
-
* is a non-leaf node. At this point, selectedKeys should
|
|
255
|
-
* be cleared.
|
|
256
|
-
*/
|
|
247
|
+
halfCheckedKeys: Set<string>;
|
|
257
248
|
};
|
|
258
249
|
handleInputChange(sugInput: string): void;
|
|
259
250
|
handleClear(): void;
|
|
@@ -5,12 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
8
|
+
var _lottieWeb = _interopRequireDefault(require("lottie-web"));
|
|
8
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
var _lottieWeb = undefined;
|
|
10
|
-
if (typeof document !== "undefined") {
|
|
11
|
-
_lottieWeb = require("lottie-web");
|
|
12
|
-
if (_lottieWeb && _lottieWeb.__esModule) _lottieWeb = _lottieWeb.default;
|
|
13
|
-
}
|
|
14
10
|
class LottieFoundation extends _foundation.default {
|
|
15
11
|
constructor(adapter) {
|
|
16
12
|
super(Object.assign(Object.assign({}, LottieFoundation.defaultAdapter), adapter));
|
|
@@ -18,14 +14,14 @@ class LottieFoundation extends _foundation.default {
|
|
|
18
14
|
this.handleParamsUpdate = () => {
|
|
19
15
|
var _a;
|
|
20
16
|
this.animation.destroy();
|
|
21
|
-
this.animation =
|
|
17
|
+
this.animation = _lottieWeb.default.loadAnimation(this._adapter.getLoadParams());
|
|
22
18
|
(_a = this.getProp("getAnimationInstance")) === null || _a === void 0 ? void 0 : _a(this.animation);
|
|
23
19
|
};
|
|
24
20
|
}
|
|
25
21
|
init(lifecycle) {
|
|
26
22
|
var _a, _b;
|
|
27
23
|
super.init(lifecycle);
|
|
28
|
-
this.animation =
|
|
24
|
+
this.animation = _lottieWeb.default.loadAnimation(this._adapter.getLoadParams());
|
|
29
25
|
(_a = this.getProp("getAnimationInstance")) === null || _a === void 0 ? void 0 : _a(this.animation);
|
|
30
26
|
(_b = this.getProp("getLottie")) === null || _b === void 0 ? void 0 : _b(LottieFoundation.getLottie());
|
|
31
27
|
}
|
|
@@ -35,6 +31,6 @@ class LottieFoundation extends _foundation.default {
|
|
|
35
31
|
}
|
|
36
32
|
}
|
|
37
33
|
LottieFoundation.getLottie = () => {
|
|
38
|
-
return
|
|
34
|
+
return _lottieWeb.default;
|
|
39
35
|
};
|
|
40
36
|
var _default = exports.default = LottieFoundation;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="lodash" />
|
|
2
2
|
import BaseFoundation, { DefaultAdapter } from '../../base/foundation';
|
|
3
|
-
import { ResizeStartCallback, ResizeCallback } from "../types";
|
|
3
|
+
import { ResizeStartCallback, ResizeCallback, ResizeEventType } from "../types";
|
|
4
4
|
export interface ResizeHandlerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
5
5
|
registerEvents: () => void;
|
|
6
6
|
unregisterEvents: () => void;
|
|
@@ -29,8 +29,8 @@ export interface ResizeGroupAdapter<P = Record<string, any>, S = Record<string,
|
|
|
29
29
|
getItemChange: (index: number) => ResizeCallback;
|
|
30
30
|
getItemEnd: (index: number) => ResizeCallback;
|
|
31
31
|
getItemDefaultSize: (index: number) => string | number;
|
|
32
|
-
registerEvents: () => void;
|
|
33
|
-
unregisterEvents: () => void;
|
|
32
|
+
registerEvents: (type: ResizeEventType) => void;
|
|
33
|
+
unregisterEvents: (type: ResizeEventType) => void;
|
|
34
34
|
}
|
|
35
35
|
export declare class ResizeGroupFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<ResizeGroupAdapter<P, S>, P, S> {
|
|
36
36
|
constructor(adapter: ResizeGroupAdapter<P, S>);
|
|
@@ -40,13 +40,16 @@ export declare class ResizeGroupFoundation<P = Record<string, any>, S = Record<s
|
|
|
40
40
|
itemMinusMap: Map<number, number>;
|
|
41
41
|
totalMinus: number;
|
|
42
42
|
itemPercentMap: Map<number, number>;
|
|
43
|
+
type?: ResizeEventType;
|
|
43
44
|
init(): void;
|
|
44
45
|
get window(): Window | null;
|
|
45
46
|
registerEvents: () => void;
|
|
46
47
|
unregisterEvents: () => void;
|
|
47
|
-
onResizeStart: (handlerIndex: number, e: MouseEvent) => void;
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
onResizeStart: (handlerIndex: number, e: MouseEvent | Touch, type: ResizeEventType) => void;
|
|
49
|
+
onMouseMove: (e: MouseEvent) => void;
|
|
50
|
+
onTouchMove: (e: TouchEvent) => void;
|
|
51
|
+
onResizing: (e: MouseEvent | TouchEvent) => void;
|
|
52
|
+
onResizeEnd: (e: MouseEvent | TouchEvent) => void;
|
|
50
53
|
initSpace: () => void;
|
|
51
54
|
ensureConstraint: import("lodash").DebouncedFunc<() => void>;
|
|
52
55
|
destroy(): void;
|
|
@@ -32,12 +32,13 @@ class ResizeGroupFoundation extends _foundation.default {
|
|
|
32
32
|
constructor(adapter) {
|
|
33
33
|
super(Object.assign({}, adapter));
|
|
34
34
|
this.registerEvents = () => {
|
|
35
|
-
this._adapter.registerEvents();
|
|
35
|
+
this._adapter.registerEvents(this.type);
|
|
36
36
|
};
|
|
37
37
|
this.unregisterEvents = () => {
|
|
38
|
-
this._adapter.unregisterEvents();
|
|
38
|
+
this._adapter.unregisterEvents(this.type);
|
|
39
39
|
};
|
|
40
|
-
this.onResizeStart = (handlerIndex, e) => {
|
|
40
|
+
this.onResizeStart = (handlerIndex, e, type) => {
|
|
41
|
+
this.type = type;
|
|
41
42
|
let {
|
|
42
43
|
clientX,
|
|
43
44
|
clientY
|
|
@@ -79,6 +80,14 @@ class ResizeGroupFoundation extends _foundation.default {
|
|
|
79
80
|
nextStart(e, nextDir);
|
|
80
81
|
}
|
|
81
82
|
};
|
|
83
|
+
this.onMouseMove = e => {
|
|
84
|
+
this.onResizing(e);
|
|
85
|
+
};
|
|
86
|
+
this.onTouchMove = e => {
|
|
87
|
+
// prevent page move in mobile
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
this.onResizing(e);
|
|
90
|
+
};
|
|
82
91
|
this.onResizing = e => {
|
|
83
92
|
const state = this.getStates();
|
|
84
93
|
if (!state.isResizing) {
|
|
@@ -99,7 +108,7 @@ class ResizeGroupFoundation extends _foundation.default {
|
|
|
99
108
|
let {
|
|
100
109
|
clientX,
|
|
101
110
|
clientY
|
|
102
|
-
} = e;
|
|
111
|
+
} = this.type === 'mouse' ? e : e.targetTouches[0];
|
|
103
112
|
const props = this.getProps();
|
|
104
113
|
const {
|
|
105
114
|
direction
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from '../../base/foundation';
|
|
2
|
-
import { Size, NumberSize, Direction } from "../types";
|
|
2
|
+
import { Size, NumberSize, Direction, ResizeEventType } from "../types";
|
|
3
3
|
export interface ResizableHandlerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
4
4
|
registerEvent: () => void;
|
|
5
5
|
unregisterEvent: () => void;
|
|
@@ -8,17 +8,19 @@ export declare class ResizableHandlerFoundation<P = Record<string, any>, S = Rec
|
|
|
8
8
|
constructor(adapter: ResizableHandlerAdapter<P, S>);
|
|
9
9
|
init(): void;
|
|
10
10
|
onMouseDown: (e: MouseEvent) => void;
|
|
11
|
+
onTouchStart: (e: TouchEvent) => void;
|
|
11
12
|
destroy(): void;
|
|
12
13
|
}
|
|
13
14
|
export interface ResizableAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
14
15
|
getResizable: () => HTMLDivElement | null;
|
|
15
|
-
registerEvent: () => void;
|
|
16
|
-
unregisterEvent: () => void;
|
|
16
|
+
registerEvent: (type: ResizeEventType) => void;
|
|
17
|
+
unregisterEvent: (type: ResizeEventType) => void;
|
|
17
18
|
}
|
|
18
19
|
export declare class ResizableFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<ResizableAdapter<P, S>, P, S> {
|
|
19
20
|
constructor(adapter: ResizableAdapter<P, S>);
|
|
20
21
|
init(): void;
|
|
21
22
|
flexDirection?: 'row' | 'column';
|
|
23
|
+
type?: ResizeEventType;
|
|
22
24
|
lockAspectRatio: number;
|
|
23
25
|
resizable: HTMLElement | null;
|
|
24
26
|
parentLeft: number;
|
|
@@ -63,8 +65,10 @@ export declare class ResizableFoundation<P = Record<string, any>, S = Record<str
|
|
|
63
65
|
newHeight: number;
|
|
64
66
|
};
|
|
65
67
|
setBoundary(): void;
|
|
66
|
-
onResizeStart: (e: MouseEvent, direction: Direction) => void;
|
|
68
|
+
onResizeStart: (e: MouseEvent, direction: Direction, type: ResizeEventType) => void;
|
|
67
69
|
onMouseMove: (event: MouseEvent) => void;
|
|
68
|
-
|
|
70
|
+
onTouchMove: (event: TouchEvent) => void;
|
|
71
|
+
changePosition: (event: Touch | MouseEvent) => void;
|
|
72
|
+
onMouseUp: (event: MouseEvent | TouchEvent) => void;
|
|
69
73
|
destroy(): void;
|
|
70
74
|
}
|
|
@@ -12,7 +12,11 @@ class ResizableHandlerFoundation extends _foundation.default {
|
|
|
12
12
|
constructor(adapter) {
|
|
13
13
|
super(Object.assign({}, adapter));
|
|
14
14
|
this.onMouseDown = e => {
|
|
15
|
-
this.getProp('onResizeStart')(e, this.getProp('direction'));
|
|
15
|
+
this.getProp('onResizeStart')(e, this.getProp('direction'), 'mouse');
|
|
16
|
+
};
|
|
17
|
+
this.onTouchStart = e => {
|
|
18
|
+
const touch = e.targetTouches[0];
|
|
19
|
+
this.getProp('onResizeStart')(touch, this.getProp('direction'), 'touch');
|
|
16
20
|
};
|
|
17
21
|
}
|
|
18
22
|
init() {
|
|
@@ -36,7 +40,8 @@ class ResizableFoundation extends _foundation.default {
|
|
|
36
40
|
this.boundaryBottom = 0;
|
|
37
41
|
this.targetLeft = 0;
|
|
38
42
|
this.targetTop = 0;
|
|
39
|
-
this.onResizeStart = (e, direction) => {
|
|
43
|
+
this.onResizeStart = (e, direction, type) => {
|
|
44
|
+
this.type = type;
|
|
40
45
|
this.resizable = this._adapter.getResizable();
|
|
41
46
|
if (!this.resizable || !this.window) {
|
|
42
47
|
return;
|
|
@@ -112,6 +117,14 @@ class ResizableFoundation extends _foundation.default {
|
|
|
112
117
|
this.setState(state);
|
|
113
118
|
};
|
|
114
119
|
this.onMouseMove = event => {
|
|
120
|
+
this.changePosition(event);
|
|
121
|
+
};
|
|
122
|
+
this.onTouchMove = event => {
|
|
123
|
+
event.preventDefault();
|
|
124
|
+
const touch = event.targetTouches[0];
|
|
125
|
+
this.changePosition(touch);
|
|
126
|
+
};
|
|
127
|
+
this.changePosition = event => {
|
|
115
128
|
var _a, _b;
|
|
116
129
|
const states = this.getStates();
|
|
117
130
|
const props = this.getProps();
|
|
@@ -410,10 +423,10 @@ class ResizableFoundation extends _foundation.default {
|
|
|
410
423
|
return size;
|
|
411
424
|
}
|
|
412
425
|
registerEvents() {
|
|
413
|
-
this._adapter.registerEvent();
|
|
426
|
+
this._adapter.registerEvent(this.type);
|
|
414
427
|
}
|
|
415
428
|
unregisterEvents() {
|
|
416
|
-
this._adapter.unregisterEvent();
|
|
429
|
+
this._adapter.unregisterEvent(this.type);
|
|
417
430
|
}
|
|
418
431
|
getCssPropertySize(newSize, property) {
|
|
419
432
|
var _a;
|
|
@@ -10,7 +10,8 @@ export interface HandleClassName {
|
|
|
10
10
|
bottomLeft?: string;
|
|
11
11
|
topLeft?: string;
|
|
12
12
|
}
|
|
13
|
-
export type
|
|
13
|
+
export type ResizeEventType = 'mouse' | 'touch';
|
|
14
|
+
export type HandlerCallback = (e: MouseEvent, direction: Direction, type?: ResizeEventType) => void;
|
|
14
15
|
export interface Enable {
|
|
15
16
|
top?: boolean;
|
|
16
17
|
right?: boolean;
|
|
@@ -37,5 +38,5 @@ export declare const DEFAULT_SIZE: {
|
|
|
37
38
|
width: string;
|
|
38
39
|
height: string;
|
|
39
40
|
};
|
|
40
|
-
export type ResizeCallback = (size: Size, event: MouseEvent, direction: Direction) => void;
|
|
41
|
-
export type ResizeStartCallback = (e: MouseEvent, dir: Direction) => void | boolean;
|
|
41
|
+
export type ResizeCallback = (size: Size, event: MouseEvent | TouchEvent, direction: Direction) => void;
|
|
42
|
+
export type ResizeStartCallback = (e: MouseEvent | Touch, dir: Direction) => void | boolean;
|
|
@@ -1131,12 +1131,11 @@ class SelectFoundation extends _foundation.default {
|
|
|
1131
1131
|
autoFocus
|
|
1132
1132
|
} = this.getProps();
|
|
1133
1133
|
const {
|
|
1134
|
-
showInput
|
|
1135
|
-
isOpen
|
|
1134
|
+
showInput
|
|
1136
1135
|
} = this.getStates();
|
|
1137
1136
|
const isMultiple = this._isMultiple();
|
|
1138
1137
|
if (filter && !isMultiple) {
|
|
1139
|
-
if (
|
|
1138
|
+
if (showInput || autoFocus) {
|
|
1140
1139
|
this.toggle2SearchInput(false);
|
|
1141
1140
|
}
|
|
1142
1141
|
}
|
|
@@ -233,7 +233,7 @@ $basicType: #{$module}-basic;
|
|
|
233
233
|
color: $color-steps_main-text-default;
|
|
234
234
|
vertical-align: top;
|
|
235
235
|
padding-right: $spacing-steps_basic_item_title-paddingRight;
|
|
236
|
-
|
|
236
|
+
padding-bottom: $spacing-steps_basic_item_title-paddingBottom;
|
|
237
237
|
transition: color $transition_duration-steps_item_title-text $transition_function-steps_item_title-text $transition_delay-steps_item_title-text; //step文字color的transition变化
|
|
238
238
|
|
|
239
239
|
}
|
package/lib/cjs/steps/steps.css
CHANGED
|
@@ -316,7 +316,7 @@
|
|
|
316
316
|
color: var(--semi-color-text-0);
|
|
317
317
|
vertical-align: top;
|
|
318
318
|
padding-right: 16px;
|
|
319
|
-
|
|
319
|
+
padding-bottom: 4px;
|
|
320
320
|
transition: color var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none);
|
|
321
321
|
}
|
|
322
322
|
.semi-steps-basic .semi-steps-item-finish .semi-steps-item-left .semi-steps-item-icon {
|
|
@@ -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):
|
|
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;
|
package/lib/cjs/tree/treeUtil.js
CHANGED
|
@@ -68,9 +68,6 @@ function flattenTreeData(treeNodeList, expandedKeys, keyMaps) {
|
|
|
68
68
|
const filterSearch = Boolean(filteredShownKeys);
|
|
69
69
|
const realKeyName = (0, _get2.default)(keyMaps, 'key', 'key');
|
|
70
70
|
const realChildrenName = (0, _get2.default)(keyMaps, 'children', 'children');
|
|
71
|
-
if ((0, _isUndefined2.default)(treeNodeList)) {
|
|
72
|
-
return [];
|
|
73
|
-
}
|
|
74
71
|
function flatten(list) {
|
|
75
72
|
let parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
76
73
|
return list.map((treeNode, index) => {
|
|
@@ -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,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
3
|
export interface AudioPlayerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
3
4
|
init: () => void;
|
|
@@ -5,7 +6,7 @@ export interface AudioPlayerAdapter<P = Record<string, any>, S = Record<string,
|
|
|
5
6
|
handleStatusClick: () => void;
|
|
6
7
|
handleTimeUpdate: () => void;
|
|
7
8
|
handleTrackChange: (direction: 'next' | 'prev') => void;
|
|
8
|
-
getAudioRef: () => HTMLAudioElement
|
|
9
|
+
getAudioRef: () => React.RefObject<HTMLAudioElement>;
|
|
9
10
|
handleTimeChange: (value: number) => void;
|
|
10
11
|
handleSpeedChange: (value: {
|
|
11
12
|
label: string;
|
|
@@ -27,7 +28,7 @@ declare class AudioPlayerFoundation extends BaseFoundation<AudioPlayerAdapter> {
|
|
|
27
28
|
handleStatusClick(): void;
|
|
28
29
|
handleTimeUpdate(): void;
|
|
29
30
|
handleTrackChange(direction: 'next' | 'prev'): void;
|
|
30
|
-
getAudioRef(): HTMLAudioElement
|
|
31
|
+
getAudioRef(): import("react").RefObject<HTMLAudioElement>;
|
|
31
32
|
handleTimeChange(value: number): void;
|
|
32
33
|
handleSpeedChange(value: {
|
|
33
34
|
label: string;
|
|
@@ -4,15 +4,16 @@ class AudioPlayerFoundation extends BaseFoundation {
|
|
|
4
4
|
super(Object.assign(Object.assign({}, AudioPlayerFoundation), adapter));
|
|
5
5
|
}
|
|
6
6
|
initAudioState() {
|
|
7
|
-
|
|
7
|
+
var _a, _b, _c;
|
|
8
|
+
const audioRef = this.getAudioRef();
|
|
8
9
|
const props = this.getProps();
|
|
9
10
|
this.setState({
|
|
10
|
-
totalTime: (
|
|
11
|
+
totalTime: ((_a = audioRef.current) === null || _a === void 0 ? void 0 : _a.duration) || 0,
|
|
11
12
|
isPlaying: props.autoPlay,
|
|
12
|
-
volume: (
|
|
13
|
+
volume: ((_b = audioRef.current) === null || _b === void 0 ? void 0 : _b.volume) * 100 || 100,
|
|
13
14
|
currentRate: {
|
|
14
15
|
label: '1.0x',
|
|
15
|
-
value: (
|
|
16
|
+
value: ((_c = audioRef.current) === null || _c === void 0 ? void 0 : _c.playbackRate) || 1
|
|
16
17
|
}
|
|
17
18
|
});
|
|
18
19
|
}
|
|
@@ -244,16 +244,7 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
|
|
|
244
244
|
*/
|
|
245
245
|
calcCheckedKeys(key: string, curCheckedStatus: boolean): {
|
|
246
246
|
checkedKeys: Set<string>;
|
|
247
|
-
halfCheckedKeys: Set<string>;
|
|
248
|
-
* If selectedKeys does not meet the update conditions,
|
|
249
|
-
* and state.selectedKeys is the same as selectedKeys
|
|
250
|
-
* at this time, state.selectedKeys should be cleared.
|
|
251
|
-
* A typical scenario is:
|
|
252
|
-
* The originally selected node is the leaf node, but
|
|
253
|
-
* after props.treeData is dynamically updated, the node
|
|
254
|
-
* is a non-leaf node. At this point, selectedKeys should
|
|
255
|
-
* be cleared.
|
|
256
|
-
*/
|
|
247
|
+
halfCheckedKeys: Set<string>;
|
|
257
248
|
};
|
|
258
249
|
handleInputChange(sugInput: string): void;
|
|
259
250
|
handleClear(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="lodash" />
|
|
2
2
|
import BaseFoundation, { DefaultAdapter } from '../../base/foundation';
|
|
3
|
-
import { ResizeStartCallback, ResizeCallback } from "../types";
|
|
3
|
+
import { ResizeStartCallback, ResizeCallback, ResizeEventType } from "../types";
|
|
4
4
|
export interface ResizeHandlerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
5
5
|
registerEvents: () => void;
|
|
6
6
|
unregisterEvents: () => void;
|
|
@@ -29,8 +29,8 @@ export interface ResizeGroupAdapter<P = Record<string, any>, S = Record<string,
|
|
|
29
29
|
getItemChange: (index: number) => ResizeCallback;
|
|
30
30
|
getItemEnd: (index: number) => ResizeCallback;
|
|
31
31
|
getItemDefaultSize: (index: number) => string | number;
|
|
32
|
-
registerEvents: () => void;
|
|
33
|
-
unregisterEvents: () => void;
|
|
32
|
+
registerEvents: (type: ResizeEventType) => void;
|
|
33
|
+
unregisterEvents: (type: ResizeEventType) => void;
|
|
34
34
|
}
|
|
35
35
|
export declare class ResizeGroupFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<ResizeGroupAdapter<P, S>, P, S> {
|
|
36
36
|
constructor(adapter: ResizeGroupAdapter<P, S>);
|
|
@@ -40,13 +40,16 @@ export declare class ResizeGroupFoundation<P = Record<string, any>, S = Record<s
|
|
|
40
40
|
itemMinusMap: Map<number, number>;
|
|
41
41
|
totalMinus: number;
|
|
42
42
|
itemPercentMap: Map<number, number>;
|
|
43
|
+
type?: ResizeEventType;
|
|
43
44
|
init(): void;
|
|
44
45
|
get window(): Window | null;
|
|
45
46
|
registerEvents: () => void;
|
|
46
47
|
unregisterEvents: () => void;
|
|
47
|
-
onResizeStart: (handlerIndex: number, e: MouseEvent) => void;
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
onResizeStart: (handlerIndex: number, e: MouseEvent | Touch, type: ResizeEventType) => void;
|
|
49
|
+
onMouseMove: (e: MouseEvent) => void;
|
|
50
|
+
onTouchMove: (e: TouchEvent) => void;
|
|
51
|
+
onResizing: (e: MouseEvent | TouchEvent) => void;
|
|
52
|
+
onResizeEnd: (e: MouseEvent | TouchEvent) => void;
|
|
50
53
|
initSpace: () => void;
|
|
51
54
|
ensureConstraint: import("lodash").DebouncedFunc<() => void>;
|
|
52
55
|
destroy(): void;
|
|
@@ -24,12 +24,13 @@ export class ResizeGroupFoundation extends BaseFoundation {
|
|
|
24
24
|
constructor(adapter) {
|
|
25
25
|
super(Object.assign({}, adapter));
|
|
26
26
|
this.registerEvents = () => {
|
|
27
|
-
this._adapter.registerEvents();
|
|
27
|
+
this._adapter.registerEvents(this.type);
|
|
28
28
|
};
|
|
29
29
|
this.unregisterEvents = () => {
|
|
30
|
-
this._adapter.unregisterEvents();
|
|
30
|
+
this._adapter.unregisterEvents(this.type);
|
|
31
31
|
};
|
|
32
|
-
this.onResizeStart = (handlerIndex, e) => {
|
|
32
|
+
this.onResizeStart = (handlerIndex, e, type) => {
|
|
33
|
+
this.type = type;
|
|
33
34
|
let {
|
|
34
35
|
clientX,
|
|
35
36
|
clientY
|
|
@@ -71,6 +72,14 @@ export class ResizeGroupFoundation extends BaseFoundation {
|
|
|
71
72
|
nextStart(e, nextDir);
|
|
72
73
|
}
|
|
73
74
|
};
|
|
75
|
+
this.onMouseMove = e => {
|
|
76
|
+
this.onResizing(e);
|
|
77
|
+
};
|
|
78
|
+
this.onTouchMove = e => {
|
|
79
|
+
// prevent page move in mobile
|
|
80
|
+
e.preventDefault();
|
|
81
|
+
this.onResizing(e);
|
|
82
|
+
};
|
|
74
83
|
this.onResizing = e => {
|
|
75
84
|
const state = this.getStates();
|
|
76
85
|
if (!state.isResizing) {
|
|
@@ -91,7 +100,7 @@ export class ResizeGroupFoundation extends BaseFoundation {
|
|
|
91
100
|
let {
|
|
92
101
|
clientX,
|
|
93
102
|
clientY
|
|
94
|
-
} = e;
|
|
103
|
+
} = this.type === 'mouse' ? e : e.targetTouches[0];
|
|
95
104
|
const props = this.getProps();
|
|
96
105
|
const {
|
|
97
106
|
direction
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from '../../base/foundation';
|
|
2
|
-
import { Size, NumberSize, Direction } from "../types";
|
|
2
|
+
import { Size, NumberSize, Direction, ResizeEventType } from "../types";
|
|
3
3
|
export interface ResizableHandlerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
4
4
|
registerEvent: () => void;
|
|
5
5
|
unregisterEvent: () => void;
|
|
@@ -8,17 +8,19 @@ export declare class ResizableHandlerFoundation<P = Record<string, any>, S = Rec
|
|
|
8
8
|
constructor(adapter: ResizableHandlerAdapter<P, S>);
|
|
9
9
|
init(): void;
|
|
10
10
|
onMouseDown: (e: MouseEvent) => void;
|
|
11
|
+
onTouchStart: (e: TouchEvent) => void;
|
|
11
12
|
destroy(): void;
|
|
12
13
|
}
|
|
13
14
|
export interface ResizableAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
14
15
|
getResizable: () => HTMLDivElement | null;
|
|
15
|
-
registerEvent: () => void;
|
|
16
|
-
unregisterEvent: () => void;
|
|
16
|
+
registerEvent: (type: ResizeEventType) => void;
|
|
17
|
+
unregisterEvent: (type: ResizeEventType) => void;
|
|
17
18
|
}
|
|
18
19
|
export declare class ResizableFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<ResizableAdapter<P, S>, P, S> {
|
|
19
20
|
constructor(adapter: ResizableAdapter<P, S>);
|
|
20
21
|
init(): void;
|
|
21
22
|
flexDirection?: 'row' | 'column';
|
|
23
|
+
type?: ResizeEventType;
|
|
22
24
|
lockAspectRatio: number;
|
|
23
25
|
resizable: HTMLElement | null;
|
|
24
26
|
parentLeft: number;
|
|
@@ -63,8 +65,10 @@ export declare class ResizableFoundation<P = Record<string, any>, S = Record<str
|
|
|
63
65
|
newHeight: number;
|
|
64
66
|
};
|
|
65
67
|
setBoundary(): void;
|
|
66
|
-
onResizeStart: (e: MouseEvent, direction: Direction) => void;
|
|
68
|
+
onResizeStart: (e: MouseEvent, direction: Direction, type: ResizeEventType) => void;
|
|
67
69
|
onMouseMove: (event: MouseEvent) => void;
|
|
68
|
-
|
|
70
|
+
onTouchMove: (event: TouchEvent) => void;
|
|
71
|
+
changePosition: (event: Touch | MouseEvent) => void;
|
|
72
|
+
onMouseUp: (event: MouseEvent | TouchEvent) => void;
|
|
69
73
|
destroy(): void;
|
|
70
74
|
}
|
|
@@ -5,7 +5,11 @@ export class ResizableHandlerFoundation extends BaseFoundation {
|
|
|
5
5
|
constructor(adapter) {
|
|
6
6
|
super(Object.assign({}, adapter));
|
|
7
7
|
this.onMouseDown = e => {
|
|
8
|
-
this.getProp('onResizeStart')(e, this.getProp('direction'));
|
|
8
|
+
this.getProp('onResizeStart')(e, this.getProp('direction'), 'mouse');
|
|
9
|
+
};
|
|
10
|
+
this.onTouchStart = e => {
|
|
11
|
+
const touch = e.targetTouches[0];
|
|
12
|
+
this.getProp('onResizeStart')(touch, this.getProp('direction'), 'touch');
|
|
9
13
|
};
|
|
10
14
|
}
|
|
11
15
|
init() {
|
|
@@ -28,7 +32,8 @@ export class ResizableFoundation extends BaseFoundation {
|
|
|
28
32
|
this.boundaryBottom = 0;
|
|
29
33
|
this.targetLeft = 0;
|
|
30
34
|
this.targetTop = 0;
|
|
31
|
-
this.onResizeStart = (e, direction) => {
|
|
35
|
+
this.onResizeStart = (e, direction, type) => {
|
|
36
|
+
this.type = type;
|
|
32
37
|
this.resizable = this._adapter.getResizable();
|
|
33
38
|
if (!this.resizable || !this.window) {
|
|
34
39
|
return;
|
|
@@ -104,6 +109,14 @@ export class ResizableFoundation extends BaseFoundation {
|
|
|
104
109
|
this.setState(state);
|
|
105
110
|
};
|
|
106
111
|
this.onMouseMove = event => {
|
|
112
|
+
this.changePosition(event);
|
|
113
|
+
};
|
|
114
|
+
this.onTouchMove = event => {
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
const touch = event.targetTouches[0];
|
|
117
|
+
this.changePosition(touch);
|
|
118
|
+
};
|
|
119
|
+
this.changePosition = event => {
|
|
107
120
|
var _a, _b;
|
|
108
121
|
const states = this.getStates();
|
|
109
122
|
const props = this.getProps();
|
|
@@ -402,10 +415,10 @@ export class ResizableFoundation extends BaseFoundation {
|
|
|
402
415
|
return size;
|
|
403
416
|
}
|
|
404
417
|
registerEvents() {
|
|
405
|
-
this._adapter.registerEvent();
|
|
418
|
+
this._adapter.registerEvent(this.type);
|
|
406
419
|
}
|
|
407
420
|
unregisterEvents() {
|
|
408
|
-
this._adapter.unregisterEvent();
|
|
421
|
+
this._adapter.unregisterEvent(this.type);
|
|
409
422
|
}
|
|
410
423
|
getCssPropertySize(newSize, property) {
|
|
411
424
|
var _a;
|
|
@@ -10,7 +10,8 @@ export interface HandleClassName {
|
|
|
10
10
|
bottomLeft?: string;
|
|
11
11
|
topLeft?: string;
|
|
12
12
|
}
|
|
13
|
-
export type
|
|
13
|
+
export type ResizeEventType = 'mouse' | 'touch';
|
|
14
|
+
export type HandlerCallback = (e: MouseEvent, direction: Direction, type?: ResizeEventType) => void;
|
|
14
15
|
export interface Enable {
|
|
15
16
|
top?: boolean;
|
|
16
17
|
right?: boolean;
|
|
@@ -37,5 +38,5 @@ export declare const DEFAULT_SIZE: {
|
|
|
37
38
|
width: string;
|
|
38
39
|
height: string;
|
|
39
40
|
};
|
|
40
|
-
export type ResizeCallback = (size: Size, event: MouseEvent, direction: Direction) => void;
|
|
41
|
-
export type ResizeStartCallback = (e: MouseEvent, dir: Direction) => void | boolean;
|
|
41
|
+
export type ResizeCallback = (size: Size, event: MouseEvent | TouchEvent, direction: Direction) => void;
|
|
42
|
+
export type ResizeStartCallback = (e: MouseEvent | Touch, dir: Direction) => void | boolean;
|
|
@@ -1122,12 +1122,11 @@ export default class SelectFoundation extends BaseFoundation {
|
|
|
1122
1122
|
autoFocus
|
|
1123
1123
|
} = this.getProps();
|
|
1124
1124
|
const {
|
|
1125
|
-
showInput
|
|
1126
|
-
isOpen
|
|
1125
|
+
showInput
|
|
1127
1126
|
} = this.getStates();
|
|
1128
1127
|
const isMultiple = this._isMultiple();
|
|
1129
1128
|
if (filter && !isMultiple) {
|
|
1130
|
-
if (
|
|
1129
|
+
if (showInput || autoFocus) {
|
|
1131
1130
|
this.toggle2SearchInput(false);
|
|
1132
1131
|
}
|
|
1133
1132
|
}
|
|
@@ -233,7 +233,7 @@ $basicType: #{$module}-basic;
|
|
|
233
233
|
color: $color-steps_main-text-default;
|
|
234
234
|
vertical-align: top;
|
|
235
235
|
padding-right: $spacing-steps_basic_item_title-paddingRight;
|
|
236
|
-
|
|
236
|
+
padding-bottom: $spacing-steps_basic_item_title-paddingBottom;
|
|
237
237
|
transition: color $transition_duration-steps_item_title-text $transition_function-steps_item_title-text $transition_delay-steps_item_title-text; //step文字color的transition变化
|
|
238
238
|
|
|
239
239
|
}
|
package/lib/es/steps/steps.css
CHANGED
|
@@ -316,7 +316,7 @@
|
|
|
316
316
|
color: var(--semi-color-text-0);
|
|
317
317
|
vertical-align: top;
|
|
318
318
|
padding-right: 16px;
|
|
319
|
-
|
|
319
|
+
padding-bottom: 4px;
|
|
320
320
|
transition: color var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none);
|
|
321
321
|
}
|
|
322
322
|
.semi-steps-basic .semi-steps-item-finish .semi-steps-item-left .semi-steps-item-icon {
|
|
@@ -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):
|
|
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;
|
package/lib/es/tree/treeUtil.js
CHANGED
|
@@ -33,9 +33,6 @@ export function flattenTreeData(treeNodeList, expandedKeys, keyMaps) {
|
|
|
33
33
|
const filterSearch = Boolean(filteredShownKeys);
|
|
34
34
|
const realKeyName = _get(keyMaps, 'key', 'key');
|
|
35
35
|
const realChildrenName = _get(keyMaps, 'children', 'children');
|
|
36
|
-
if (_isUndefined(treeNodeList)) {
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
36
|
function flatten(list) {
|
|
40
37
|
let parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
41
38
|
return list.map((treeNode, index) => {
|
|
@@ -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
|
};
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.74.1-alpha.
|
|
3
|
+
"version": "2.74.1-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.74.
|
|
11
|
-
"@douyinfe/semi-json-viewer-core": "2.74.
|
|
10
|
+
"@douyinfe/semi-animation": "2.74.1-alpha.3",
|
|
11
|
+
"@douyinfe/semi-json-viewer-core": "2.74.1-alpha.3",
|
|
12
12
|
"@mdx-js/mdx": "^3.0.1",
|
|
13
13
|
"async-validator": "^3.5.0",
|
|
14
14
|
"classnames": "^2.2.6",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"*.scss",
|
|
30
30
|
"*.css"
|
|
31
31
|
],
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "555d2e8969779e9a1eb15654845e7ed8e062d250",
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
35
35
|
"@babel/preset-env": "^7.15.8",
|
package/resizable/group/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getItemDirection, getPixelSize } from "../utils";
|
|
2
2
|
import BaseFoundation, { DefaultAdapter } from '../../base/foundation';
|
|
3
|
-
import { ResizeStartCallback, ResizeCallback } from "../types";
|
|
3
|
+
import { ResizeStartCallback, ResizeCallback, ResizeEventType } from "../types";
|
|
4
4
|
import { adjustNewSize, judgeConstraint, getOffset } from "../utils";
|
|
5
5
|
import { debounce } from "lodash";
|
|
6
6
|
export interface ResizeHandlerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
@@ -49,8 +49,8 @@ export interface ResizeGroupAdapter<P = Record<string, any>, S = Record<string,
|
|
|
49
49
|
getItemChange: (index: number) => ResizeCallback;
|
|
50
50
|
getItemEnd: (index: number) => ResizeCallback;
|
|
51
51
|
getItemDefaultSize: (index: number) => string | number;
|
|
52
|
-
registerEvents: () => void;
|
|
53
|
-
unregisterEvents: () => void
|
|
52
|
+
registerEvents: (type: ResizeEventType) => void;
|
|
53
|
+
unregisterEvents: (type: ResizeEventType) => void
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export class ResizeGroupFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<ResizeGroupAdapter<P, S>, P, S> {
|
|
@@ -72,6 +72,7 @@ export class ResizeGroupFoundation<P = Record<string, any>, S = Record<string, a
|
|
|
72
72
|
itemMinusMap: Map<number, number>; // 这个是为了给handler留出空间,方便维护每一个item的size为cal(percent% - minus)
|
|
73
73
|
totalMinus: number;
|
|
74
74
|
itemPercentMap: Map<number, number>; // 内部维护一个百分比数组,消除浮点计算误差
|
|
75
|
+
type?: ResizeEventType;
|
|
75
76
|
|
|
76
77
|
|
|
77
78
|
init(): void {
|
|
@@ -86,14 +87,15 @@ export class ResizeGroupFoundation<P = Record<string, any>, S = Record<string, a
|
|
|
86
87
|
|
|
87
88
|
|
|
88
89
|
registerEvents = () => {
|
|
89
|
-
this._adapter.registerEvents();
|
|
90
|
+
this._adapter.registerEvents(this.type);
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
unregisterEvents = () => {
|
|
93
|
-
this._adapter.unregisterEvents();
|
|
94
|
+
this._adapter.unregisterEvents(this.type);
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
onResizeStart = (handlerIndex: number, e: MouseEvent) => { // handler ref
|
|
97
|
+
onResizeStart = (handlerIndex: number, e: MouseEvent | Touch, type: ResizeEventType) => { // handler ref
|
|
98
|
+
this.type = type;
|
|
97
99
|
let { clientX, clientY } = e;
|
|
98
100
|
let lastItem = this._adapter.getItem(handlerIndex), nextItem = this._adapter.getItem(handlerIndex + 1);
|
|
99
101
|
let lastOffset: number, nextOffset: number;
|
|
@@ -135,15 +137,25 @@ export class ResizeGroupFoundation<P = Record<string, any>, S = Record<string, a
|
|
|
135
137
|
}
|
|
136
138
|
}
|
|
137
139
|
|
|
140
|
+
onMouseMove = (e: MouseEvent) => {
|
|
141
|
+
this.onResizing(e);
|
|
142
|
+
}
|
|
138
143
|
|
|
139
|
-
|
|
144
|
+
onTouchMove = (e: TouchEvent) => {
|
|
145
|
+
// prevent page move in mobile
|
|
146
|
+
e.preventDefault();
|
|
147
|
+
this.onResizing(e);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
onResizing = (e: MouseEvent | TouchEvent) => {
|
|
140
152
|
const state = this.getStates();
|
|
141
153
|
if (!state.isResizing) {
|
|
142
154
|
return;
|
|
143
155
|
}
|
|
144
156
|
const { curHandler, originalPosition } = state;
|
|
145
157
|
let { x: initX, y: initY, lastItemSize, nextItemSize, lastOffset, nextOffset } = originalPosition;
|
|
146
|
-
let { clientX, clientY } = e;
|
|
158
|
+
let { clientX, clientY } = this.type === 'mouse' ? e : (e as any).targetTouches[0];
|
|
147
159
|
|
|
148
160
|
const props = this.getProps();
|
|
149
161
|
const { direction } = props;
|
|
@@ -193,7 +205,7 @@ export class ResizeGroupFoundation<P = Record<string, any>, S = Record<string, a
|
|
|
193
205
|
}
|
|
194
206
|
}
|
|
195
207
|
|
|
196
|
-
onResizeEnd = (e: MouseEvent) => {
|
|
208
|
+
onResizeEnd = (e: MouseEvent | TouchEvent) => {
|
|
197
209
|
const { curHandler } = this.getStates();
|
|
198
210
|
let lastItem = this._adapter.getItem(curHandler), nextItem = this._adapter.getItem(curHandler + 1);
|
|
199
211
|
let lastFunc = this._adapter.getItemEnd(curHandler),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from '../../base/foundation';
|
|
2
|
-
import { DEFAULT_SIZE, Size, NumberSize, Direction, NewSize } from "../types";
|
|
2
|
+
import { DEFAULT_SIZE, Size, NumberSize, Direction, NewSize, ResizeEventType } from "../types";
|
|
3
3
|
import { getStringSize, getNumberSize, has, calculateNewMax, findNextSnap, snap, clamp } from "../utils";
|
|
4
4
|
export interface ResizableHandlerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
5
5
|
registerEvent: () => void;
|
|
@@ -16,9 +16,14 @@ export class ResizableHandlerFoundation<P = Record<string, any>, S = Record<stri
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
onMouseDown = (e: MouseEvent) => {
|
|
19
|
-
this.getProp('onResizeStart')(e, this.getProp('direction'));
|
|
19
|
+
this.getProp('onResizeStart')(e, this.getProp('direction'), 'mouse');
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
onTouchStart = (e: TouchEvent) => {
|
|
23
|
+
const touch = e.targetTouches[0];
|
|
24
|
+
this.getProp('onResizeStart')(touch, this.getProp('direction'), 'touch');
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
destroy(): void {
|
|
23
28
|
this._adapter.unregisterEvent();
|
|
24
29
|
}
|
|
@@ -26,8 +31,8 @@ export class ResizableHandlerFoundation<P = Record<string, any>, S = Record<stri
|
|
|
26
31
|
|
|
27
32
|
export interface ResizableAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
28
33
|
getResizable: () => HTMLDivElement | null;
|
|
29
|
-
registerEvent: () => void;
|
|
30
|
-
unregisterEvent: () => void
|
|
34
|
+
registerEvent: (type: ResizeEventType) => void;
|
|
35
|
+
unregisterEvent: (type: ResizeEventType) => void
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
export class ResizableFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<ResizableAdapter<P, S>, P, S> {
|
|
@@ -53,6 +58,7 @@ export class ResizableFoundation<P = Record<string, any>, S = Record<string, any
|
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
flexDirection?: 'row' | 'column';
|
|
61
|
+
type?: ResizeEventType;
|
|
56
62
|
|
|
57
63
|
lockAspectRatio = 1;
|
|
58
64
|
resizable: HTMLElement | null = null;
|
|
@@ -202,11 +208,11 @@ export class ResizableFoundation<P = Record<string, any>, S = Record<string, any
|
|
|
202
208
|
}
|
|
203
209
|
|
|
204
210
|
registerEvents() {
|
|
205
|
-
this._adapter.registerEvent();
|
|
211
|
+
this._adapter.registerEvent(this.type);
|
|
206
212
|
}
|
|
207
213
|
|
|
208
214
|
unregisterEvents() {
|
|
209
|
-
this._adapter.unregisterEvent();
|
|
215
|
+
this._adapter.unregisterEvent(this.type);
|
|
210
216
|
}
|
|
211
217
|
|
|
212
218
|
getCssPropertySize(newSize: number | string, property: 'width' | 'height'): number | string {
|
|
@@ -380,7 +386,8 @@ export class ResizableFoundation<P = Record<string, any>, S = Record<string, any
|
|
|
380
386
|
}
|
|
381
387
|
|
|
382
388
|
|
|
383
|
-
onResizeStart = (e: MouseEvent, direction: Direction) => {
|
|
389
|
+
onResizeStart = (e: MouseEvent, direction: Direction, type: ResizeEventType) => {
|
|
390
|
+
this.type = type;
|
|
384
391
|
this.resizable = this._adapter.getResizable();
|
|
385
392
|
if (!this.resizable || !this.window) {
|
|
386
393
|
return;
|
|
@@ -456,6 +463,16 @@ export class ResizableFoundation<P = Record<string, any>, S = Record<string, any
|
|
|
456
463
|
|
|
457
464
|
|
|
458
465
|
onMouseMove = (event: MouseEvent) => {
|
|
466
|
+
this.changePosition(event);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
onTouchMove = (event: TouchEvent) => {
|
|
470
|
+
event.preventDefault();
|
|
471
|
+
const touch = event.targetTouches[0];
|
|
472
|
+
this.changePosition(touch);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
changePosition = (event: Touch | MouseEvent) => {
|
|
459
476
|
const states = this.getStates();
|
|
460
477
|
const props = this.getProps();
|
|
461
478
|
|
|
@@ -583,7 +600,7 @@ export class ResizableFoundation<P = Record<string, any>, S = Record<string, any
|
|
|
583
600
|
}
|
|
584
601
|
|
|
585
602
|
|
|
586
|
-
onMouseUp = (event: MouseEvent) => {
|
|
603
|
+
onMouseUp = (event: MouseEvent | TouchEvent) => {
|
|
587
604
|
const { isResizing, direction, original } = this.getStates();
|
|
588
605
|
|
|
589
606
|
if (!isResizing || !this.resizable) {
|
package/resizable/types.ts
CHANGED
|
@@ -14,9 +14,12 @@ export interface HandleClassName {
|
|
|
14
14
|
topLeft?: string
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
export type ResizeEventType = 'mouse' | 'touch';
|
|
18
|
+
|
|
17
19
|
export type HandlerCallback = (
|
|
18
20
|
e: MouseEvent,
|
|
19
|
-
direction: Direction
|
|
21
|
+
direction: Direction,
|
|
22
|
+
type?: ResizeEventType,
|
|
20
23
|
) => void;
|
|
21
24
|
|
|
22
25
|
export interface Enable {
|
|
@@ -51,12 +54,12 @@ export const DEFAULT_SIZE = {
|
|
|
51
54
|
|
|
52
55
|
export type ResizeCallback = (
|
|
53
56
|
size: Size,
|
|
54
|
-
event: MouseEvent,
|
|
57
|
+
event: MouseEvent | TouchEvent,
|
|
55
58
|
direction: Direction,
|
|
56
59
|
) => void;
|
|
57
60
|
|
|
58
61
|
export type ResizeStartCallback = (
|
|
59
|
-
e: MouseEvent,
|
|
62
|
+
e: MouseEvent | Touch,
|
|
60
63
|
dir: Direction,
|
|
61
64
|
) => void | boolean;
|
|
62
65
|
|
package/select/foundation.ts
CHANGED
|
@@ -1113,10 +1113,10 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
|
|
|
1113
1113
|
|
|
1114
1114
|
handleInputBlur(e: any) {
|
|
1115
1115
|
const { filter, autoFocus } = this.getProps();
|
|
1116
|
-
const { showInput
|
|
1116
|
+
const { showInput } = this.getStates();
|
|
1117
1117
|
const isMultiple = this._isMultiple();
|
|
1118
1118
|
if (filter && !isMultiple ) {
|
|
1119
|
-
if (
|
|
1119
|
+
if (showInput || autoFocus) {
|
|
1120
1120
|
this.toggle2SearchInput(false);
|
|
1121
1121
|
}
|
|
1122
1122
|
}
|
package/steps/bacisSteps.scss
CHANGED
|
@@ -233,7 +233,7 @@ $basicType: #{$module}-basic;
|
|
|
233
233
|
color: $color-steps_main-text-default;
|
|
234
234
|
vertical-align: top;
|
|
235
235
|
padding-right: $spacing-steps_basic_item_title-paddingRight;
|
|
236
|
-
|
|
236
|
+
padding-bottom: $spacing-steps_basic_item_title-paddingBottom;
|
|
237
237
|
transition: color $transition_duration-steps_item_title-text $transition_function-steps_item_title-text $transition_delay-steps_item_title-text; //step文字color的transition变化
|
|
238
238
|
|
|
239
239
|
}
|
package/tree/treeUtil.ts
CHANGED
|
@@ -53,9 +53,6 @@ export function flattenTreeData(treeNodeList: any[], expandedKeys: Set<string>,
|
|
|
53
53
|
const filterSearch = Boolean(filteredShownKeys);
|
|
54
54
|
const realKeyName = get(keyMaps, 'key', 'key');
|
|
55
55
|
const realChildrenName = get(keyMaps, 'children', 'children');
|
|
56
|
-
if (isUndefined(treeNodeList)) {
|
|
57
|
-
return [];
|
|
58
|
-
}
|
|
59
56
|
function flatten(list: any[], parent: any = null) {
|
|
60
57
|
return list.map((treeNode, index) => {
|
|
61
58
|
const pos = getPosition(parent ? parent.pos : '0', index);
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
module.exports = function (babel) {
|
|
2
|
-
const { types: t } = babel;
|
|
3
|
-
return {
|
|
4
|
-
visitor: {
|
|
5
|
-
ImportDeclaration(path) {
|
|
6
|
-
// 只处理 lottie-web 的导入
|
|
7
|
-
if (path.node.source.value === 'lottie-web') {
|
|
8
|
-
// 创建变量声明
|
|
9
|
-
const varDeclaration = t.variableDeclaration('var', [
|
|
10
|
-
t.variableDeclarator(
|
|
11
|
-
t.identifier('_lottieWeb'),
|
|
12
|
-
t.identifier('undefined')
|
|
13
|
-
)
|
|
14
|
-
]);
|
|
15
|
-
|
|
16
|
-
// 创建条件语句
|
|
17
|
-
const ifStatement = t.ifStatement(
|
|
18
|
-
t.binaryExpression(
|
|
19
|
-
'!==',
|
|
20
|
-
t.unaryExpression('typeof', t.identifier('document')),
|
|
21
|
-
t.stringLiteral('undefined')
|
|
22
|
-
),
|
|
23
|
-
t.blockStatement([
|
|
24
|
-
// _lottieWeb = require("lottie-web")
|
|
25
|
-
t.expressionStatement(
|
|
26
|
-
t.assignmentExpression(
|
|
27
|
-
'=',
|
|
28
|
-
t.identifier('_lottieWeb'),
|
|
29
|
-
t.callExpression(t.identifier('require'), [
|
|
30
|
-
t.stringLiteral('lottie-web')
|
|
31
|
-
])
|
|
32
|
-
)
|
|
33
|
-
),
|
|
34
|
-
// if (_lottieWeb && _lottieWeb.__esModule) _lottieWeb = _lottieWeb.default
|
|
35
|
-
t.ifStatement(
|
|
36
|
-
t.logicalExpression(
|
|
37
|
-
'&&',
|
|
38
|
-
t.identifier('_lottieWeb'),
|
|
39
|
-
t.memberExpression(t.identifier('_lottieWeb'), t.identifier('__esModule'))
|
|
40
|
-
),
|
|
41
|
-
t.expressionStatement(
|
|
42
|
-
t.assignmentExpression(
|
|
43
|
-
'=',
|
|
44
|
-
t.identifier('_lottieWeb'),
|
|
45
|
-
t.memberExpression(t.identifier('_lottieWeb'), t.identifier('default'))
|
|
46
|
-
)
|
|
47
|
-
)
|
|
48
|
-
)
|
|
49
|
-
])
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
path.insertBefore(varDeclaration);
|
|
53
|
-
path.replaceWith(ifStatement);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
};
|