@douyinfe/semi-foundation 2.74.0-beta.0 → 2.74.0
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/lib/cjs/audioPlayer/foundation.d.ts +2 -3
- package/lib/cjs/audioPlayer/foundation.js +4 -5
- package/lib/cjs/cascader/foundation.d.ts +10 -1
- package/lib/cjs/select/foundation.js +3 -2
- 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 +3 -0
- package/lib/es/audioPlayer/foundation.d.ts +2 -3
- package/lib/es/audioPlayer/foundation.js +4 -5
- package/lib/es/cascader/foundation.d.ts +10 -1
- package/lib/es/select/foundation.js +3 -2
- 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 +3 -0
- package/package.json +4 -4
- package/select/foundation.ts +2 -2
- package/steps/bacisSteps.scss +1 -1
- package/tree/treeUtil.ts +3 -0
|
@@ -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: () =>
|
|
11
|
+
getAudioRef: () => 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 audioElement = this.getAudioRef();
|
|
27
27
|
const props = this.getProps();
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
this.setState({
|
|
30
|
-
totalTime:
|
|
30
|
+
totalTime: audioElement?.duration || 0,
|
|
31
31
|
isPlaying: props.autoPlay,
|
|
32
|
-
volume:
|
|
33
|
-
currentRate: { label: '1.0x', value:
|
|
32
|
+
volume: audioElement?.volume * 100 || 100,
|
|
33
|
+
currentRate: { label: '1.0x', value: audioElement?.playbackRate || 1 },
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
3
2
|
export interface AudioPlayerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
4
3
|
init: () => void;
|
|
@@ -6,7 +5,7 @@ export interface AudioPlayerAdapter<P = Record<string, any>, S = Record<string,
|
|
|
6
5
|
handleStatusClick: () => void;
|
|
7
6
|
handleTimeUpdate: () => void;
|
|
8
7
|
handleTrackChange: (direction: 'next' | 'prev') => void;
|
|
9
|
-
getAudioRef: () =>
|
|
8
|
+
getAudioRef: () => HTMLAudioElement;
|
|
10
9
|
handleTimeChange: (value: number) => void;
|
|
11
10
|
handleSpeedChange: (value: {
|
|
12
11
|
label: string;
|
|
@@ -28,7 +27,7 @@ declare class AudioPlayerFoundation extends BaseFoundation<AudioPlayerAdapter> {
|
|
|
28
27
|
handleStatusClick(): void;
|
|
29
28
|
handleTimeUpdate(): void;
|
|
30
29
|
handleTrackChange(direction: 'next' | 'prev'): void;
|
|
31
|
-
getAudioRef():
|
|
30
|
+
getAudioRef(): HTMLAudioElement;
|
|
32
31
|
handleTimeChange(value: number): void;
|
|
33
32
|
handleSpeedChange(value: {
|
|
34
33
|
label: string;
|
|
@@ -11,16 +11,15 @@ class AudioPlayerFoundation extends _foundation.default {
|
|
|
11
11
|
super(Object.assign(Object.assign({}, AudioPlayerFoundation), adapter));
|
|
12
12
|
}
|
|
13
13
|
initAudioState() {
|
|
14
|
-
|
|
15
|
-
const audioRef = this.getAudioRef();
|
|
14
|
+
const audioElement = this.getAudioRef();
|
|
16
15
|
const props = this.getProps();
|
|
17
16
|
this.setState({
|
|
18
|
-
totalTime: (
|
|
17
|
+
totalTime: (audioElement === null || audioElement === void 0 ? void 0 : audioElement.duration) || 0,
|
|
19
18
|
isPlaying: props.autoPlay,
|
|
20
|
-
volume: (
|
|
19
|
+
volume: (audioElement === null || audioElement === void 0 ? void 0 : audioElement.volume) * 100 || 100,
|
|
21
20
|
currentRate: {
|
|
22
21
|
label: '1.0x',
|
|
23
|
-
value: (
|
|
22
|
+
value: (audioElement === null || audioElement === void 0 ? void 0 : audioElement.playbackRate) || 1
|
|
24
23
|
}
|
|
25
24
|
});
|
|
26
25
|
}
|
|
@@ -244,7 +244,16 @@ 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>;
|
|
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
|
+
*/
|
|
248
257
|
};
|
|
249
258
|
handleInputChange(sugInput: string): void;
|
|
250
259
|
handleClear(): void;
|
|
@@ -1131,11 +1131,12 @@ class SelectFoundation extends _foundation.default {
|
|
|
1131
1131
|
autoFocus
|
|
1132
1132
|
} = this.getProps();
|
|
1133
1133
|
const {
|
|
1134
|
-
showInput
|
|
1134
|
+
showInput,
|
|
1135
|
+
isOpen
|
|
1135
1136
|
} = this.getStates();
|
|
1136
1137
|
const isMultiple = this._isMultiple();
|
|
1137
1138
|
if (filter && !isMultiple) {
|
|
1138
|
-
if (showInput || autoFocus) {
|
|
1139
|
+
if ((showInput || autoFocus) && !isOpen) {
|
|
1139
1140
|
this.toggle2SearchInput(false);
|
|
1140
1141
|
}
|
|
1141
1142
|
}
|
|
@@ -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
|
+
margin-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
|
+
margin-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,6 +68,9 @@ 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
|
+
}
|
|
71
74
|
function flatten(list) {
|
|
72
75
|
let parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
73
76
|
return list.map((treeNode, index) => {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
3
2
|
export interface AudioPlayerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
4
3
|
init: () => void;
|
|
@@ -6,7 +5,7 @@ export interface AudioPlayerAdapter<P = Record<string, any>, S = Record<string,
|
|
|
6
5
|
handleStatusClick: () => void;
|
|
7
6
|
handleTimeUpdate: () => void;
|
|
8
7
|
handleTrackChange: (direction: 'next' | 'prev') => void;
|
|
9
|
-
getAudioRef: () =>
|
|
8
|
+
getAudioRef: () => HTMLAudioElement;
|
|
10
9
|
handleTimeChange: (value: number) => void;
|
|
11
10
|
handleSpeedChange: (value: {
|
|
12
11
|
label: string;
|
|
@@ -28,7 +27,7 @@ declare class AudioPlayerFoundation extends BaseFoundation<AudioPlayerAdapter> {
|
|
|
28
27
|
handleStatusClick(): void;
|
|
29
28
|
handleTimeUpdate(): void;
|
|
30
29
|
handleTrackChange(direction: 'next' | 'prev'): void;
|
|
31
|
-
getAudioRef():
|
|
30
|
+
getAudioRef(): HTMLAudioElement;
|
|
32
31
|
handleTimeChange(value: number): void;
|
|
33
32
|
handleSpeedChange(value: {
|
|
34
33
|
label: string;
|
|
@@ -4,16 +4,15 @@ class AudioPlayerFoundation extends BaseFoundation {
|
|
|
4
4
|
super(Object.assign(Object.assign({}, AudioPlayerFoundation), adapter));
|
|
5
5
|
}
|
|
6
6
|
initAudioState() {
|
|
7
|
-
|
|
8
|
-
const audioRef = this.getAudioRef();
|
|
7
|
+
const audioElement = this.getAudioRef();
|
|
9
8
|
const props = this.getProps();
|
|
10
9
|
this.setState({
|
|
11
|
-
totalTime: (
|
|
10
|
+
totalTime: (audioElement === null || audioElement === void 0 ? void 0 : audioElement.duration) || 0,
|
|
12
11
|
isPlaying: props.autoPlay,
|
|
13
|
-
volume: (
|
|
12
|
+
volume: (audioElement === null || audioElement === void 0 ? void 0 : audioElement.volume) * 100 || 100,
|
|
14
13
|
currentRate: {
|
|
15
14
|
label: '1.0x',
|
|
16
|
-
value: (
|
|
15
|
+
value: (audioElement === null || audioElement === void 0 ? void 0 : audioElement.playbackRate) || 1
|
|
17
16
|
}
|
|
18
17
|
});
|
|
19
18
|
}
|
|
@@ -244,7 +244,16 @@ 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>;
|
|
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
|
+
*/
|
|
248
257
|
};
|
|
249
258
|
handleInputChange(sugInput: string): void;
|
|
250
259
|
handleClear(): void;
|
|
@@ -1122,11 +1122,12 @@ export default class SelectFoundation extends BaseFoundation {
|
|
|
1122
1122
|
autoFocus
|
|
1123
1123
|
} = this.getProps();
|
|
1124
1124
|
const {
|
|
1125
|
-
showInput
|
|
1125
|
+
showInput,
|
|
1126
|
+
isOpen
|
|
1126
1127
|
} = this.getStates();
|
|
1127
1128
|
const isMultiple = this._isMultiple();
|
|
1128
1129
|
if (filter && !isMultiple) {
|
|
1129
|
-
if (showInput || autoFocus) {
|
|
1130
|
+
if ((showInput || autoFocus) && !isOpen) {
|
|
1130
1131
|
this.toggle2SearchInput(false);
|
|
1131
1132
|
}
|
|
1132
1133
|
}
|
|
@@ -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
|
+
margin-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
|
+
margin-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,6 +33,9 @@ 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
|
+
}
|
|
36
39
|
function flatten(list) {
|
|
37
40
|
let parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
38
41
|
return list.map((treeNode, index) => {
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.74.0
|
|
3
|
+
"version": "2.74.0",
|
|
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.0
|
|
11
|
-
"@douyinfe/semi-json-viewer-core": "2.74.0
|
|
10
|
+
"@douyinfe/semi-animation": "2.74.0",
|
|
11
|
+
"@douyinfe/semi-json-viewer-core": "2.74.0",
|
|
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": "f88ca5423473b6b4a44751396ceda02b6e6bf7d5",
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
35
35
|
"@babel/preset-env": "^7.15.8",
|
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 } = this.getStates();
|
|
1116
|
+
const { showInput, isOpen } = this.getStates();
|
|
1117
1117
|
const isMultiple = this._isMultiple();
|
|
1118
1118
|
if (filter && !isMultiple ) {
|
|
1119
|
-
if (showInput || autoFocus) {
|
|
1119
|
+
if ((showInput || autoFocus) && !isOpen) {
|
|
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
|
+
margin-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,6 +53,9 @@ 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
|
+
}
|
|
56
59
|
function flatten(list: any[], parent: any = null) {
|
|
57
60
|
return list.map((treeNode, index) => {
|
|
58
61
|
const pos = getPosition(parent ? parent.pos : '0', index);
|