@douyinfe/semi-foundation 2.74.1-alpha.3 → 2.74.1-alpha.4

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.
Files changed (42) hide show
  1. package/audioPlayer/foundation.ts +6 -6
  2. package/getBabelConfig.js +1 -0
  3. package/lib/cjs/audioPlayer/foundation.d.ts +2 -3
  4. package/lib/cjs/audioPlayer/foundation.js +4 -5
  5. package/lib/cjs/cascader/foundation.d.ts +10 -1
  6. package/lib/cjs/lottie/foundation.js +8 -4
  7. package/lib/cjs/overflowList/constants.d.ts +1 -1
  8. package/lib/cjs/resizable/group/index.d.ts +6 -9
  9. package/lib/cjs/resizable/group/index.js +4 -13
  10. package/lib/cjs/resizable/single/index.d.ts +5 -9
  11. package/lib/cjs/resizable/single/index.js +4 -17
  12. package/lib/cjs/resizable/types.d.ts +3 -4
  13. package/lib/cjs/select/foundation.js +3 -2
  14. package/lib/cjs/steps/bacisSteps.scss +1 -1
  15. package/lib/cjs/steps/steps.css +1 -1
  16. package/lib/cjs/tree/treeUtil.d.ts +1 -1
  17. package/lib/cjs/tree/treeUtil.js +3 -0
  18. package/lib/cjs/upload/constants.d.ts +1 -1
  19. package/lib/es/audioPlayer/foundation.d.ts +2 -3
  20. package/lib/es/audioPlayer/foundation.js +4 -5
  21. package/lib/es/cascader/foundation.d.ts +10 -1
  22. package/lib/es/lottie/foundation.js +6 -1
  23. package/lib/es/overflowList/constants.d.ts +1 -1
  24. package/lib/es/resizable/group/index.d.ts +6 -9
  25. package/lib/es/resizable/group/index.js +4 -13
  26. package/lib/es/resizable/single/index.d.ts +5 -9
  27. package/lib/es/resizable/single/index.js +4 -17
  28. package/lib/es/resizable/types.d.ts +3 -4
  29. package/lib/es/select/foundation.js +3 -2
  30. package/lib/es/steps/bacisSteps.scss +1 -1
  31. package/lib/es/steps/steps.css +1 -1
  32. package/lib/es/tree/treeUtil.d.ts +1 -1
  33. package/lib/es/tree/treeUtil.js +3 -0
  34. package/lib/es/upload/constants.d.ts +1 -1
  35. package/package.json +4 -4
  36. package/resizable/group/index.ts +9 -21
  37. package/resizable/single/index.ts +8 -25
  38. package/resizable/types.ts +3 -6
  39. package/scripts/babel-plugin-lottie.js +98 -0
  40. package/select/foundation.ts +2 -2
  41. package/steps/bacisSteps.scss +1 -1
  42. 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: () => React.RefObject<HTMLAudioElement>;
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 audioRef = this.getAudioRef();
26
+ const audioElement = this.getAudioRef();
27
27
  const props = this.getProps();
28
-
28
+
29
29
  this.setState({
30
- totalTime: audioRef.current?.duration || 0,
30
+ totalTime: audioElement?.duration || 0,
31
31
  isPlaying: props.autoPlay,
32
- volume: audioRef.current?.volume * 100 || 100,
33
- currentRate: { label: '1.0x', value: audioRef.current?.playbackRate || 1 },
32
+ volume: audioElement?.volume * 100 || 100,
33
+ currentRate: { label: '1.0x', value: audioElement?.playbackRate || 1 },
34
34
  });
35
35
  }
36
36
 
package/getBabelConfig.js CHANGED
@@ -19,6 +19,7 @@ module.exports = ({ isESM }) => {
19
19
  ],
20
20
  plugins: [
21
21
  'lodash',
22
+ ['./scripts/babel-plugin-lottie.js', { isESM }]
22
23
  ]
23
24
  };
24
25
  };
@@ -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: () => React.RefObject<HTMLAudioElement>;
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(): import("react").RefObject<HTMLAudioElement>;
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
- var _a, _b, _c;
15
- const audioRef = this.getAudioRef();
14
+ const audioElement = this.getAudioRef();
16
15
  const props = this.getProps();
17
16
  this.setState({
18
- totalTime: ((_a = audioRef.current) === null || _a === void 0 ? void 0 : _a.duration) || 0,
17
+ totalTime: (audioElement === null || audioElement === void 0 ? void 0 : audioElement.duration) || 0,
19
18
  isPlaying: props.autoPlay,
20
- volume: ((_b = audioRef.current) === null || _b === void 0 ? void 0 : _b.volume) * 100 || 100,
19
+ volume: (audioElement === null || audioElement === void 0 ? void 0 : audioElement.volume) * 100 || 100,
21
20
  currentRate: {
22
21
  label: '1.0x',
23
- value: ((_c = audioRef.current) === null || _c === void 0 ? void 0 : _c.playbackRate) || 1
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;
@@ -5,8 +5,12 @@ 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"));
9
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ var lottie = undefined;
10
+ if (typeof document !== "undefined") {
11
+ lottie = require("lottie-web");
12
+ if (lottie && lottie.__esModule) lottie = lottie.default;
13
+ }
10
14
  class LottieFoundation extends _foundation.default {
11
15
  constructor(adapter) {
12
16
  super(Object.assign(Object.assign({}, LottieFoundation.defaultAdapter), adapter));
@@ -14,14 +18,14 @@ class LottieFoundation extends _foundation.default {
14
18
  this.handleParamsUpdate = () => {
15
19
  var _a;
16
20
  this.animation.destroy();
17
- this.animation = _lottieWeb.default.loadAnimation(this._adapter.getLoadParams());
21
+ this.animation = lottie.loadAnimation(this._adapter.getLoadParams());
18
22
  (_a = this.getProp("getAnimationInstance")) === null || _a === void 0 ? void 0 : _a(this.animation);
19
23
  };
20
24
  }
21
25
  init(lifecycle) {
22
26
  var _a, _b;
23
27
  super.init(lifecycle);
24
- this.animation = _lottieWeb.default.loadAnimation(this._adapter.getLoadParams());
28
+ this.animation = lottie.loadAnimation(this._adapter.getLoadParams());
25
29
  (_a = this.getProp("getAnimationInstance")) === null || _a === void 0 ? void 0 : _a(this.animation);
26
30
  (_b = this.getProp("getLottie")) === null || _b === void 0 ? void 0 : _b(LottieFoundation.getLottie());
27
31
  }
@@ -31,6 +35,6 @@ class LottieFoundation extends _foundation.default {
31
35
  }
32
36
  }
33
37
  LottieFoundation.getLottie = () => {
34
- return _lottieWeb.default;
38
+ return lottie;
35
39
  };
36
40
  var _default = exports.default = LottieFoundation;
@@ -2,7 +2,7 @@ declare const cssClasses: {
2
2
  PREFIX: string;
3
3
  };
4
4
  declare const strings: {
5
- BOUNDARY_SET: ("end" | "start")[];
5
+ BOUNDARY_SET: ("start" | "end")[];
6
6
  POSITION_SET: string[];
7
7
  MODE_SET: string[];
8
8
  MODE_MAP: {
@@ -1,6 +1,6 @@
1
1
  /// <reference types="lodash" />
2
2
  import BaseFoundation, { DefaultAdapter } from '../../base/foundation';
3
- import { ResizeStartCallback, ResizeCallback, ResizeEventType } from "../types";
3
+ import { ResizeStartCallback, ResizeCallback } 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: (type: ResizeEventType) => void;
33
- unregisterEvents: (type: ResizeEventType) => void;
32
+ registerEvents: () => void;
33
+ unregisterEvents: () => 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,16 +40,13 @@ 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;
44
43
  init(): void;
45
44
  get window(): Window | null;
46
45
  registerEvents: () => void;
47
46
  unregisterEvents: () => void;
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;
47
+ onResizeStart: (handlerIndex: number, e: MouseEvent) => void;
48
+ onResizing: (e: MouseEvent) => void;
49
+ onResizeEnd: (e: MouseEvent) => void;
53
50
  initSpace: () => void;
54
51
  ensureConstraint: import("lodash").DebouncedFunc<() => void>;
55
52
  destroy(): void;
@@ -32,13 +32,12 @@ class ResizeGroupFoundation extends _foundation.default {
32
32
  constructor(adapter) {
33
33
  super(Object.assign({}, adapter));
34
34
  this.registerEvents = () => {
35
- this._adapter.registerEvents(this.type);
35
+ this._adapter.registerEvents();
36
36
  };
37
37
  this.unregisterEvents = () => {
38
- this._adapter.unregisterEvents(this.type);
38
+ this._adapter.unregisterEvents();
39
39
  };
40
- this.onResizeStart = (handlerIndex, e, type) => {
41
- this.type = type;
40
+ this.onResizeStart = (handlerIndex, e) => {
42
41
  let {
43
42
  clientX,
44
43
  clientY
@@ -80,14 +79,6 @@ class ResizeGroupFoundation extends _foundation.default {
80
79
  nextStart(e, nextDir);
81
80
  }
82
81
  };
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
- };
91
82
  this.onResizing = e => {
92
83
  const state = this.getStates();
93
84
  if (!state.isResizing) {
@@ -108,7 +99,7 @@ class ResizeGroupFoundation extends _foundation.default {
108
99
  let {
109
100
  clientX,
110
101
  clientY
111
- } = this.type === 'mouse' ? e : e.targetTouches[0];
102
+ } = e;
112
103
  const props = this.getProps();
113
104
  const {
114
105
  direction
@@ -1,5 +1,5 @@
1
1
  import BaseFoundation, { DefaultAdapter } from '../../base/foundation';
2
- import { Size, NumberSize, Direction, ResizeEventType } from "../types";
2
+ import { Size, NumberSize, Direction } 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,19 +8,17 @@ 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;
12
11
  destroy(): void;
13
12
  }
14
13
  export interface ResizableAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
15
14
  getResizable: () => HTMLDivElement | null;
16
- registerEvent: (type: ResizeEventType) => void;
17
- unregisterEvent: (type: ResizeEventType) => void;
15
+ registerEvent: () => void;
16
+ unregisterEvent: () => void;
18
17
  }
19
18
  export declare class ResizableFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<ResizableAdapter<P, S>, P, S> {
20
19
  constructor(adapter: ResizableAdapter<P, S>);
21
20
  init(): void;
22
21
  flexDirection?: 'row' | 'column';
23
- type?: ResizeEventType;
24
22
  lockAspectRatio: number;
25
23
  resizable: HTMLElement | null;
26
24
  parentLeft: number;
@@ -65,10 +63,8 @@ export declare class ResizableFoundation<P = Record<string, any>, S = Record<str
65
63
  newHeight: number;
66
64
  };
67
65
  setBoundary(): void;
68
- onResizeStart: (e: MouseEvent, direction: Direction, type: ResizeEventType) => void;
66
+ onResizeStart: (e: MouseEvent, direction: Direction) => void;
69
67
  onMouseMove: (event: MouseEvent) => void;
70
- onTouchMove: (event: TouchEvent) => void;
71
- changePosition: (event: Touch | MouseEvent) => void;
72
- onMouseUp: (event: MouseEvent | TouchEvent) => void;
68
+ onMouseUp: (event: MouseEvent) => void;
73
69
  destroy(): void;
74
70
  }
@@ -12,11 +12,7 @@ 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'), 'mouse');
16
- };
17
- this.onTouchStart = e => {
18
- const touch = e.targetTouches[0];
19
- this.getProp('onResizeStart')(touch, this.getProp('direction'), 'touch');
15
+ this.getProp('onResizeStart')(e, this.getProp('direction'));
20
16
  };
21
17
  }
22
18
  init() {
@@ -40,8 +36,7 @@ class ResizableFoundation extends _foundation.default {
40
36
  this.boundaryBottom = 0;
41
37
  this.targetLeft = 0;
42
38
  this.targetTop = 0;
43
- this.onResizeStart = (e, direction, type) => {
44
- this.type = type;
39
+ this.onResizeStart = (e, direction) => {
45
40
  this.resizable = this._adapter.getResizable();
46
41
  if (!this.resizable || !this.window) {
47
42
  return;
@@ -117,14 +112,6 @@ class ResizableFoundation extends _foundation.default {
117
112
  this.setState(state);
118
113
  };
119
114
  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 => {
128
115
  var _a, _b;
129
116
  const states = this.getStates();
130
117
  const props = this.getProps();
@@ -423,10 +410,10 @@ class ResizableFoundation extends _foundation.default {
423
410
  return size;
424
411
  }
425
412
  registerEvents() {
426
- this._adapter.registerEvent(this.type);
413
+ this._adapter.registerEvent();
427
414
  }
428
415
  unregisterEvents() {
429
- this._adapter.unregisterEvent(this.type);
416
+ this._adapter.unregisterEvent();
430
417
  }
431
418
  getCssPropertySize(newSize, property) {
432
419
  var _a;
@@ -10,8 +10,7 @@ export interface HandleClassName {
10
10
  bottomLeft?: string;
11
11
  topLeft?: string;
12
12
  }
13
- export type ResizeEventType = 'mouse' | 'touch';
14
- export type HandlerCallback = (e: MouseEvent, direction: Direction, type?: ResizeEventType) => void;
13
+ export type HandlerCallback = (e: MouseEvent, direction: Direction) => void;
15
14
  export interface Enable {
16
15
  top?: boolean;
17
16
  right?: boolean;
@@ -38,5 +37,5 @@ export declare const DEFAULT_SIZE: {
38
37
  width: string;
39
38
  height: string;
40
39
  };
41
- export type ResizeCallback = (size: Size, event: MouseEvent | TouchEvent, direction: Direction) => void;
42
- export type ResizeStartCallback = (e: MouseEvent | Touch, dir: Direction) => void | boolean;
40
+ export type ResizeCallback = (size: Size, event: MouseEvent, direction: Direction) => void;
41
+ export type ResizeStartCallback = (e: MouseEvent, dir: Direction) => void | boolean;
@@ -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
- padding-bottom: $spacing-steps_basic_item_title-paddingBottom;
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
  }
@@ -316,7 +316,7 @@
316
316
  color: var(--semi-color-text-0);
317
317
  vertical-align: top;
318
318
  padding-right: 16px;
319
- padding-bottom: 4px;
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): 1 | -1 | 0;
86
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
87
87
  export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
88
88
  export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
@@ -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) => {
@@ -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,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: () => React.RefObject<HTMLAudioElement>;
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(): import("react").RefObject<HTMLAudioElement>;
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
- var _a, _b, _c;
8
- const audioRef = this.getAudioRef();
7
+ const audioElement = this.getAudioRef();
9
8
  const props = this.getProps();
10
9
  this.setState({
11
- totalTime: ((_a = audioRef.current) === null || _a === void 0 ? void 0 : _a.duration) || 0,
10
+ totalTime: (audioElement === null || audioElement === void 0 ? void 0 : audioElement.duration) || 0,
12
11
  isPlaying: props.autoPlay,
13
- volume: ((_b = audioRef.current) === null || _b === void 0 ? void 0 : _b.volume) * 100 || 100,
12
+ volume: (audioElement === null || audioElement === void 0 ? void 0 : audioElement.volume) * 100 || 100,
14
13
  currentRate: {
15
14
  label: '1.0x',
16
- value: ((_c = audioRef.current) === null || _c === void 0 ? void 0 : _c.playbackRate) || 1
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;
@@ -1,5 +1,10 @@
1
1
  import BaseFoundation from "../base/foundation";
2
- import lottie from "lottie-web";
2
+ var lottie = undefined;
3
+ (async () => {
4
+ if (typeof document !== "undefined") {
5
+ lottie = await import("lottie-web");
6
+ }
7
+ })();
3
8
  class LottieFoundation extends BaseFoundation {
4
9
  constructor(adapter) {
5
10
  super(Object.assign(Object.assign({}, LottieFoundation.defaultAdapter), adapter));
@@ -2,7 +2,7 @@ declare const cssClasses: {
2
2
  PREFIX: string;
3
3
  };
4
4
  declare const strings: {
5
- BOUNDARY_SET: ("end" | "start")[];
5
+ BOUNDARY_SET: ("start" | "end")[];
6
6
  POSITION_SET: string[];
7
7
  MODE_SET: string[];
8
8
  MODE_MAP: {
@@ -1,6 +1,6 @@
1
1
  /// <reference types="lodash" />
2
2
  import BaseFoundation, { DefaultAdapter } from '../../base/foundation';
3
- import { ResizeStartCallback, ResizeCallback, ResizeEventType } from "../types";
3
+ import { ResizeStartCallback, ResizeCallback } 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: (type: ResizeEventType) => void;
33
- unregisterEvents: (type: ResizeEventType) => void;
32
+ registerEvents: () => void;
33
+ unregisterEvents: () => 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,16 +40,13 @@ 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;
44
43
  init(): void;
45
44
  get window(): Window | null;
46
45
  registerEvents: () => void;
47
46
  unregisterEvents: () => void;
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;
47
+ onResizeStart: (handlerIndex: number, e: MouseEvent) => void;
48
+ onResizing: (e: MouseEvent) => void;
49
+ onResizeEnd: (e: MouseEvent) => void;
53
50
  initSpace: () => void;
54
51
  ensureConstraint: import("lodash").DebouncedFunc<() => void>;
55
52
  destroy(): void;
@@ -24,13 +24,12 @@ export class ResizeGroupFoundation extends BaseFoundation {
24
24
  constructor(adapter) {
25
25
  super(Object.assign({}, adapter));
26
26
  this.registerEvents = () => {
27
- this._adapter.registerEvents(this.type);
27
+ this._adapter.registerEvents();
28
28
  };
29
29
  this.unregisterEvents = () => {
30
- this._adapter.unregisterEvents(this.type);
30
+ this._adapter.unregisterEvents();
31
31
  };
32
- this.onResizeStart = (handlerIndex, e, type) => {
33
- this.type = type;
32
+ this.onResizeStart = (handlerIndex, e) => {
34
33
  let {
35
34
  clientX,
36
35
  clientY
@@ -72,14 +71,6 @@ export class ResizeGroupFoundation extends BaseFoundation {
72
71
  nextStart(e, nextDir);
73
72
  }
74
73
  };
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
- };
83
74
  this.onResizing = e => {
84
75
  const state = this.getStates();
85
76
  if (!state.isResizing) {
@@ -100,7 +91,7 @@ export class ResizeGroupFoundation extends BaseFoundation {
100
91
  let {
101
92
  clientX,
102
93
  clientY
103
- } = this.type === 'mouse' ? e : e.targetTouches[0];
94
+ } = e;
104
95
  const props = this.getProps();
105
96
  const {
106
97
  direction
@@ -1,5 +1,5 @@
1
1
  import BaseFoundation, { DefaultAdapter } from '../../base/foundation';
2
- import { Size, NumberSize, Direction, ResizeEventType } from "../types";
2
+ import { Size, NumberSize, Direction } 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,19 +8,17 @@ 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;
12
11
  destroy(): void;
13
12
  }
14
13
  export interface ResizableAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
15
14
  getResizable: () => HTMLDivElement | null;
16
- registerEvent: (type: ResizeEventType) => void;
17
- unregisterEvent: (type: ResizeEventType) => void;
15
+ registerEvent: () => void;
16
+ unregisterEvent: () => void;
18
17
  }
19
18
  export declare class ResizableFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<ResizableAdapter<P, S>, P, S> {
20
19
  constructor(adapter: ResizableAdapter<P, S>);
21
20
  init(): void;
22
21
  flexDirection?: 'row' | 'column';
23
- type?: ResizeEventType;
24
22
  lockAspectRatio: number;
25
23
  resizable: HTMLElement | null;
26
24
  parentLeft: number;
@@ -65,10 +63,8 @@ export declare class ResizableFoundation<P = Record<string, any>, S = Record<str
65
63
  newHeight: number;
66
64
  };
67
65
  setBoundary(): void;
68
- onResizeStart: (e: MouseEvent, direction: Direction, type: ResizeEventType) => void;
66
+ onResizeStart: (e: MouseEvent, direction: Direction) => void;
69
67
  onMouseMove: (event: MouseEvent) => void;
70
- onTouchMove: (event: TouchEvent) => void;
71
- changePosition: (event: Touch | MouseEvent) => void;
72
- onMouseUp: (event: MouseEvent | TouchEvent) => void;
68
+ onMouseUp: (event: MouseEvent) => void;
73
69
  destroy(): void;
74
70
  }
@@ -5,11 +5,7 @@ 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'), 'mouse');
9
- };
10
- this.onTouchStart = e => {
11
- const touch = e.targetTouches[0];
12
- this.getProp('onResizeStart')(touch, this.getProp('direction'), 'touch');
8
+ this.getProp('onResizeStart')(e, this.getProp('direction'));
13
9
  };
14
10
  }
15
11
  init() {
@@ -32,8 +28,7 @@ export class ResizableFoundation extends BaseFoundation {
32
28
  this.boundaryBottom = 0;
33
29
  this.targetLeft = 0;
34
30
  this.targetTop = 0;
35
- this.onResizeStart = (e, direction, type) => {
36
- this.type = type;
31
+ this.onResizeStart = (e, direction) => {
37
32
  this.resizable = this._adapter.getResizable();
38
33
  if (!this.resizable || !this.window) {
39
34
  return;
@@ -109,14 +104,6 @@ export class ResizableFoundation extends BaseFoundation {
109
104
  this.setState(state);
110
105
  };
111
106
  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 => {
120
107
  var _a, _b;
121
108
  const states = this.getStates();
122
109
  const props = this.getProps();
@@ -415,10 +402,10 @@ export class ResizableFoundation extends BaseFoundation {
415
402
  return size;
416
403
  }
417
404
  registerEvents() {
418
- this._adapter.registerEvent(this.type);
405
+ this._adapter.registerEvent();
419
406
  }
420
407
  unregisterEvents() {
421
- this._adapter.unregisterEvent(this.type);
408
+ this._adapter.unregisterEvent();
422
409
  }
423
410
  getCssPropertySize(newSize, property) {
424
411
  var _a;
@@ -10,8 +10,7 @@ export interface HandleClassName {
10
10
  bottomLeft?: string;
11
11
  topLeft?: string;
12
12
  }
13
- export type ResizeEventType = 'mouse' | 'touch';
14
- export type HandlerCallback = (e: MouseEvent, direction: Direction, type?: ResizeEventType) => void;
13
+ export type HandlerCallback = (e: MouseEvent, direction: Direction) => void;
15
14
  export interface Enable {
16
15
  top?: boolean;
17
16
  right?: boolean;
@@ -38,5 +37,5 @@ export declare const DEFAULT_SIZE: {
38
37
  width: string;
39
38
  height: string;
40
39
  };
41
- export type ResizeCallback = (size: Size, event: MouseEvent | TouchEvent, direction: Direction) => void;
42
- export type ResizeStartCallback = (e: MouseEvent | Touch, dir: Direction) => void | boolean;
40
+ export type ResizeCallback = (size: Size, event: MouseEvent, direction: Direction) => void;
41
+ export type ResizeStartCallback = (e: MouseEvent, dir: Direction) => void | boolean;
@@ -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
- padding-bottom: $spacing-steps_basic_item_title-paddingBottom;
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
  }
@@ -316,7 +316,7 @@
316
316
  color: var(--semi-color-text-0);
317
317
  vertical-align: top;
318
318
  padding-right: 16px;
319
- padding-bottom: 4px;
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): 1 | -1 | 0;
86
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
87
87
  export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
88
88
  export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
@@ -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) => {
@@ -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,14 +1,14 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.74.1-alpha.3",
3
+ "version": "2.74.1-alpha.4",
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.1-alpha.3",
11
- "@douyinfe/semi-json-viewer-core": "2.74.1-alpha.3",
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": "555d2e8969779e9a1eb15654845e7ed8e062d250",
32
+ "gitHead": "96ccc916dd3d9ad2ece7282d51d8b230c253b307",
33
33
  "devDependencies": {
34
34
  "@babel/plugin-transform-runtime": "^7.15.8",
35
35
  "@babel/preset-env": "^7.15.8",
@@ -1,6 +1,6 @@
1
1
  import { getItemDirection, getPixelSize } from "../utils";
2
2
  import BaseFoundation, { DefaultAdapter } from '../../base/foundation';
3
- import { ResizeStartCallback, ResizeCallback, ResizeEventType } from "../types";
3
+ import { ResizeStartCallback, ResizeCallback } 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: (type: ResizeEventType) => void;
53
- unregisterEvents: (type: ResizeEventType) => void
52
+ registerEvents: () => void;
53
+ unregisterEvents: () => 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,7 +72,6 @@ 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;
76
75
 
77
76
 
78
77
  init(): void {
@@ -87,15 +86,14 @@ export class ResizeGroupFoundation<P = Record<string, any>, S = Record<string, a
87
86
 
88
87
 
89
88
  registerEvents = () => {
90
- this._adapter.registerEvents(this.type);
89
+ this._adapter.registerEvents();
91
90
  }
92
91
 
93
92
  unregisterEvents = () => {
94
- this._adapter.unregisterEvents(this.type);
93
+ this._adapter.unregisterEvents();
95
94
  }
96
95
 
97
- onResizeStart = (handlerIndex: number, e: MouseEvent | Touch, type: ResizeEventType) => { // handler ref
98
- this.type = type;
96
+ onResizeStart = (handlerIndex: number, e: MouseEvent) => { // handler ref
99
97
  let { clientX, clientY } = e;
100
98
  let lastItem = this._adapter.getItem(handlerIndex), nextItem = this._adapter.getItem(handlerIndex + 1);
101
99
  let lastOffset: number, nextOffset: number;
@@ -137,25 +135,15 @@ export class ResizeGroupFoundation<P = Record<string, any>, S = Record<string, a
137
135
  }
138
136
  }
139
137
 
140
- onMouseMove = (e: MouseEvent) => {
141
- this.onResizing(e);
142
- }
143
138
 
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) => {
139
+ onResizing = (e: MouseEvent) => {
152
140
  const state = this.getStates();
153
141
  if (!state.isResizing) {
154
142
  return;
155
143
  }
156
144
  const { curHandler, originalPosition } = state;
157
145
  let { x: initX, y: initY, lastItemSize, nextItemSize, lastOffset, nextOffset } = originalPosition;
158
- let { clientX, clientY } = this.type === 'mouse' ? e : (e as any).targetTouches[0];
146
+ let { clientX, clientY } = e;
159
147
 
160
148
  const props = this.getProps();
161
149
  const { direction } = props;
@@ -205,7 +193,7 @@ export class ResizeGroupFoundation<P = Record<string, any>, S = Record<string, a
205
193
  }
206
194
  }
207
195
 
208
- onResizeEnd = (e: MouseEvent | TouchEvent) => {
196
+ onResizeEnd = (e: MouseEvent) => {
209
197
  const { curHandler } = this.getStates();
210
198
  let lastItem = this._adapter.getItem(curHandler), nextItem = this._adapter.getItem(curHandler + 1);
211
199
  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, ResizeEventType } from "../types";
2
+ import { DEFAULT_SIZE, Size, NumberSize, Direction, NewSize } 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,14 +16,9 @@ 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'), 'mouse');
19
+ this.getProp('onResizeStart')(e, this.getProp('direction'));
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
-
27
22
  destroy(): void {
28
23
  this._adapter.unregisterEvent();
29
24
  }
@@ -31,8 +26,8 @@ export class ResizableHandlerFoundation<P = Record<string, any>, S = Record<stri
31
26
 
32
27
  export interface ResizableAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
33
28
  getResizable: () => HTMLDivElement | null;
34
- registerEvent: (type: ResizeEventType) => void;
35
- unregisterEvent: (type: ResizeEventType) => void
29
+ registerEvent: () => void;
30
+ unregisterEvent: () => void
36
31
  }
37
32
 
38
33
  export class ResizableFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<ResizableAdapter<P, S>, P, S> {
@@ -58,7 +53,6 @@ export class ResizableFoundation<P = Record<string, any>, S = Record<string, any
58
53
  }
59
54
 
60
55
  flexDirection?: 'row' | 'column';
61
- type?: ResizeEventType;
62
56
 
63
57
  lockAspectRatio = 1;
64
58
  resizable: HTMLElement | null = null;
@@ -208,11 +202,11 @@ export class ResizableFoundation<P = Record<string, any>, S = Record<string, any
208
202
  }
209
203
 
210
204
  registerEvents() {
211
- this._adapter.registerEvent(this.type);
205
+ this._adapter.registerEvent();
212
206
  }
213
207
 
214
208
  unregisterEvents() {
215
- this._adapter.unregisterEvent(this.type);
209
+ this._adapter.unregisterEvent();
216
210
  }
217
211
 
218
212
  getCssPropertySize(newSize: number | string, property: 'width' | 'height'): number | string {
@@ -386,8 +380,7 @@ export class ResizableFoundation<P = Record<string, any>, S = Record<string, any
386
380
  }
387
381
 
388
382
 
389
- onResizeStart = (e: MouseEvent, direction: Direction, type: ResizeEventType) => {
390
- this.type = type;
383
+ onResizeStart = (e: MouseEvent, direction: Direction) => {
391
384
  this.resizable = this._adapter.getResizable();
392
385
  if (!this.resizable || !this.window) {
393
386
  return;
@@ -463,16 +456,6 @@ export class ResizableFoundation<P = Record<string, any>, S = Record<string, any
463
456
 
464
457
 
465
458
  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) => {
476
459
  const states = this.getStates();
477
460
  const props = this.getProps();
478
461
 
@@ -600,7 +583,7 @@ export class ResizableFoundation<P = Record<string, any>, S = Record<string, any
600
583
  }
601
584
 
602
585
 
603
- onMouseUp = (event: MouseEvent | TouchEvent) => {
586
+ onMouseUp = (event: MouseEvent) => {
604
587
  const { isResizing, direction, original } = this.getStates();
605
588
 
606
589
  if (!isResizing || !this.resizable) {
@@ -14,12 +14,9 @@ export interface HandleClassName {
14
14
  topLeft?: string
15
15
  }
16
16
 
17
- export type ResizeEventType = 'mouse' | 'touch';
18
-
19
17
  export type HandlerCallback = (
20
18
  e: MouseEvent,
21
- direction: Direction,
22
- type?: ResizeEventType,
19
+ direction: Direction
23
20
  ) => void;
24
21
 
25
22
  export interface Enable {
@@ -54,12 +51,12 @@ export const DEFAULT_SIZE = {
54
51
 
55
52
  export type ResizeCallback = (
56
53
  size: Size,
57
- event: MouseEvent | TouchEvent,
54
+ event: MouseEvent,
58
55
  direction: Direction,
59
56
  ) => void;
60
57
 
61
58
  export type ResizeStartCallback = (
62
- e: MouseEvent | Touch,
59
+ e: MouseEvent,
63
60
  dir: Direction,
64
61
  ) => void | boolean;
65
62
 
@@ -0,0 +1,98 @@
1
+ module.exports = function (babel) {
2
+ const { types: t } = babel;
3
+
4
+ return {
5
+ visitor: {
6
+ ImportDeclaration(path, state) {
7
+ // 只处理 lottie-web 的导入
8
+ if (path.node.source.value === 'lottie-web') {
9
+ const isESM = state.opts.isESM;
10
+
11
+ // 创建变量声明
12
+ const varDeclaration = t.variableDeclaration('var', [
13
+ t.variableDeclarator(
14
+ t.identifier('lottie'),
15
+ t.identifier('undefined')
16
+ )
17
+ ]);
18
+
19
+ if (isESM) {
20
+ // 创建 IIFE async 函数
21
+ const iife = t.expressionStatement(
22
+ t.callExpression(
23
+ t.arrowFunctionExpression(
24
+ [],
25
+ t.blockStatement([
26
+ t.ifStatement(
27
+ t.binaryExpression(
28
+ '!==',
29
+ t.unaryExpression('typeof', t.identifier('document')),
30
+ t.stringLiteral('undefined')
31
+ ),
32
+ t.blockStatement([
33
+ t.expressionStatement(
34
+ t.assignmentExpression(
35
+ '=',
36
+ t.identifier('lottie'),
37
+ t.awaitExpression(
38
+ t.callExpression(
39
+ t.import(),
40
+ [t.stringLiteral('lottie-web')]
41
+ )
42
+ )
43
+ )
44
+ )
45
+ ])
46
+ )
47
+ ]),
48
+ true // async
49
+ ),
50
+ []
51
+ )
52
+ );
53
+
54
+ path.insertBefore(varDeclaration);
55
+ path.replaceWith(iife);
56
+ } else {
57
+ // 原有的 CommonJS 逻辑
58
+ const ifStatement = t.ifStatement(
59
+ t.binaryExpression(
60
+ '!==',
61
+ t.unaryExpression('typeof', t.identifier('document')),
62
+ t.stringLiteral('undefined')
63
+ ),
64
+ t.blockStatement([
65
+ t.expressionStatement(
66
+ t.assignmentExpression(
67
+ '=',
68
+ t.identifier('lottie'),
69
+ t.callExpression(t.identifier('require'), [
70
+ t.stringLiteral('lottie-web')
71
+ ])
72
+ )
73
+ ),
74
+ t.ifStatement(
75
+ t.logicalExpression(
76
+ '&&',
77
+ t.identifier('lottie'),
78
+ t.memberExpression(t.identifier('lottie'), t.identifier('__esModule'))
79
+ ),
80
+ t.expressionStatement(
81
+ t.assignmentExpression(
82
+ '=',
83
+ t.identifier('lottie'),
84
+ t.memberExpression(t.identifier('lottie'), t.identifier('default'))
85
+ )
86
+ )
87
+ )
88
+ ])
89
+ );
90
+
91
+ path.insertBefore(varDeclaration);
92
+ path.replaceWith(ifStatement);
93
+ }
94
+ }
95
+ }
96
+ }
97
+ };
98
+ };
@@ -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
  }
@@ -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
- padding-bottom: $spacing-steps_basic_item_title-paddingBottom;
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);