@douyinfe/semi-foundation 2.48.0-alpha.0 → 2.48.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.
@@ -5,7 +5,9 @@ export interface AvatarAdapter<P = Record<string, any>, S = Record<string, any>>
5
5
  notifyImgState(isImgExist: boolean): void;
6
6
  notifyLeave(event: any): void;
7
7
  notifyEnter(event: any): void;
8
- setFocusVisible: (focusVisible: boolean) => void
8
+ setFocusVisible: (focusVisible: boolean) => void;
9
+ setScale: (scale: number) => void;
10
+ getAvatarNode: () => HTMLSpanElement
9
11
  }
10
12
 
11
13
  export default class AvatarFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<AvatarAdapter<P, S>, P, S> {
@@ -14,7 +16,12 @@ export default class AvatarFoundation<P = Record<string, any>, S = Record<string
14
16
  super({ ...adapter });
15
17
  }
16
18
 
17
- init() { }
19
+ init() {
20
+ const { children } = this.getProps();
21
+ if (typeof children === "string") {
22
+ this.changeScale();
23
+ }
24
+ }
18
25
 
19
26
  destroy() { }
20
27
 
@@ -49,4 +56,14 @@ export default class AvatarFoundation<P = Record<string, any>, S = Record<string
49
56
  this._adapter.setFocusVisible(false);
50
57
  }
51
58
 
59
+ changeScale = () => {
60
+ const { gap } = this.getProps();
61
+ const node = this._adapter.getAvatarNode();
62
+ const stringNode = node?.firstChild as HTMLSpanElement;
63
+ const [nodeWidth, stringNodeWidth] = [node?.offsetWidth || 0, stringNode?.offsetWidth || 0];
64
+ if (nodeWidth !== 0 && stringNodeWidth !== 0 && gap * 2 < nodeWidth) {
65
+ const scale = nodeWidth - gap * 2 > stringNodeWidth ? 1 : (nodeWidth - gap * 2) / stringNodeWidth;
66
+ this._adapter.setScale(scale);
67
+ }
68
+ }
52
69
  }
@@ -4,6 +4,8 @@ export interface AvatarAdapter<P = Record<string, any>, S = Record<string, any>>
4
4
  notifyLeave(event: any): void;
5
5
  notifyEnter(event: any): void;
6
6
  setFocusVisible: (focusVisible: boolean) => void;
7
+ setScale: (scale: number) => void;
8
+ getAvatarNode: () => HTMLSpanElement;
7
9
  }
8
10
  export default class AvatarFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<AvatarAdapter<P, S>, P, S> {
9
11
  constructor(adapter: AvatarAdapter<P, S>);
@@ -14,4 +16,5 @@ export default class AvatarFoundation<P = Record<string, any>, S = Record<string
14
16
  handleLeave(e: any): void;
15
17
  handleFocusVisible: (event: any) => void;
16
18
  handleBlur: () => void;
19
+ changeScale: () => void;
17
20
  }
@@ -25,8 +25,27 @@ class AvatarFoundation extends _foundation.default {
25
25
  this.handleBlur = () => {
26
26
  this._adapter.setFocusVisible(false);
27
27
  };
28
+ this.changeScale = () => {
29
+ const {
30
+ gap
31
+ } = this.getProps();
32
+ const node = this._adapter.getAvatarNode();
33
+ const stringNode = node === null || node === void 0 ? void 0 : node.firstChild;
34
+ const [nodeWidth, stringNodeWidth] = [(node === null || node === void 0 ? void 0 : node.offsetWidth) || 0, (stringNode === null || stringNode === void 0 ? void 0 : stringNode.offsetWidth) || 0];
35
+ if (nodeWidth !== 0 && stringNodeWidth !== 0 && gap * 2 < nodeWidth) {
36
+ const scale = nodeWidth - gap * 2 > stringNodeWidth ? 1 : (nodeWidth - gap * 2) / stringNodeWidth;
37
+ this._adapter.setScale(scale);
38
+ }
39
+ };
40
+ }
41
+ init() {
42
+ const {
43
+ children
44
+ } = this.getProps();
45
+ if (typeof children === "string") {
46
+ this.changeScale();
47
+ }
28
48
  }
29
- init() {}
30
49
  destroy() {}
31
50
  handleImgLoadError() {
32
51
  const {
@@ -6,6 +6,7 @@ export type tipFormatterBasicType = string | number | boolean | null;
6
6
  export interface SliderProps {
7
7
  defaultValue?: number | number[];
8
8
  disabled?: boolean;
9
+ showMarkLabel?: boolean;
9
10
  included?: boolean;
10
11
  marks?: Marks;
11
12
  max?: number;
@@ -18,8 +19,10 @@ export interface SliderProps {
18
19
  onAfterChange?: (value: SliderProps['value']) => void;
19
20
  onChange?: (value: SliderProps['value']) => void;
20
21
  onMouseUp?: (e: any) => void;
22
+ tooltipOnMark?: boolean;
21
23
  tooltipVisible?: boolean;
22
24
  style?: Record<string, any>;
25
+ showArrow?: boolean;
23
26
  className?: string;
24
27
  showBoundary?: boolean;
25
28
  railStyle?: Record<string, any>;
@@ -22,7 +22,7 @@ const parseToDate = function (input) {
22
22
  let dateFnsLocale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _locale.zhCN;
23
23
  if (input instanceof Date) {
24
24
  return input;
25
- } else if (typeof input === 'number' || !isNaN(Number(input))) {
25
+ } else if (typeof input === 'number') {
26
26
  return new Date((0, _toNumber2.default)(input));
27
27
  } else if (typeof input === 'string') {
28
28
  let curDate = new Date();
@@ -3,7 +3,8 @@
3
3
  * https://github.com/react-component/tree
4
4
  */
5
5
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
6
- export { KeyMapProps } from './treeUtil';
6
+ import type { KeyMapProps } from './treeUtil';
7
+ export type { KeyMapProps };
7
8
  export interface BasicTreeNodeProps {
8
9
  [x: string]: any;
9
10
  expanded?: boolean;
@@ -84,6 +84,6 @@ export declare function getValueOrKey(data: any, keyMaps?: KeyMapProps): any;
84
84
  export declare function normalizeValue(value: any, withObject: boolean, keyMaps?: KeyMapProps): any;
85
85
  export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
86
86
  export declare function calcDisabledKeys(keyEntities: KeyEntities, keyMaps?: KeyMapProps): Set<string>;
87
- export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
87
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
88
88
  export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
89
89
  export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
@@ -75,7 +75,7 @@ export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize'
75
75
  onVisibleChange?: (isVisible: boolean) => void;
76
76
  onLoad?: (keys: Set<string>, data: BasicTreeNodeData) => void;
77
77
  }
78
- export interface BasicTreeSelectInnerData extends Pick<BasicTreeInnerData, 'keyEntities' | 'treeData' | 'flattenNodes' | 'cachedFlattenNodes' | 'selectedKeys' | 'checkedKeys' | 'halfCheckedKeys' | 'motionKeys' | 'motionType' | 'expandedKeys' | 'filteredKeys' | 'filteredExpandedKeys' | 'filteredShownKeys' | 'cachedKeyValuePairs' | 'inputValue' | 'disabledKeys' | 'loadedKeys' | 'loadingKeys' | 'realCheckedKeys'> {
78
+ export interface BasicTreeSelectInnerData extends Pick<BasicTreeInnerData, 'keyEntities' | 'treeData' | 'flattenNodes' | 'selectedKeys' | 'checkedKeys' | 'halfCheckedKeys' | 'motionKeys' | 'motionType' | 'expandedKeys' | 'filteredKeys' | 'filteredExpandedKeys' | 'filteredShownKeys' | 'cachedKeyValuePairs' | 'inputValue' | 'disabledKeys' | 'loadedKeys' | 'loadingKeys' | 'realCheckedKeys'> {
79
79
  inputTriggerFocus: boolean;
80
80
  isOpen: boolean;
81
81
  rePosKey: number;
@@ -135,7 +135,6 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
135
135
  _notifyMultipleChange(key: string[], e: any): void;
136
136
  _notifyChange(key: any, e: any): void;
137
137
  _registerClickOutsideHandler: (e: any) => void;
138
- clearInputValue: () => void;
139
138
  _notifyFocus(e: any): void;
140
139
  handleTriggerFocus(e: any): void;
141
140
  _notifyBlur(e: any): void;
@@ -26,12 +26,6 @@ class TreeSelectFoundation extends _foundation.default {
26
26
  this.close(e);
27
27
  });
28
28
  };
29
- this.clearInputValue = () => {
30
- const {
31
- inputValue
32
- } = this.getStates();
33
- inputValue && this._adapter.updateInputValue('');
34
- };
35
29
  }
36
30
  init() {
37
31
  const {
@@ -183,7 +177,7 @@ class TreeSelectFoundation extends _foundation.default {
183
177
  const isSearching = Boolean(inputValue);
184
178
  const treeNodeProps = {
185
179
  eventKey: key,
186
- expanded: isSearching ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
180
+ expanded: isSearching && !this._isExpandControlled() ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
187
181
  selected: selectedKeys.includes(key),
188
182
  checked: realChecked,
189
183
  halfChecked: realHalfChecked,
@@ -456,8 +450,8 @@ class TreeSelectFoundation extends _foundation.default {
456
450
  expandedOptsKeys.forEach(item => newExpandedKeys.add(item));
457
451
  const newFlattenNodes = (0, _treeUtil.flattenTreeData)(treeData, newExpandedKeys, keyMaps);
458
452
  this._adapter.updateState({
459
- expandedKeys: newExpandedKeys,
460
- flattenNodes: newFlattenNodes,
453
+ expandedKeys: isExpandControlled ? expandedKeys : newExpandedKeys,
454
+ flattenNodes: isExpandControlled ? flattenNodes : newFlattenNodes,
461
455
  inputValue: '',
462
456
  motionKeys: new Set([]),
463
457
  filteredKeys: new Set([]),
@@ -506,8 +500,8 @@ class TreeSelectFoundation extends _foundation.default {
506
500
  const newFilteredExpandedKeys = new Set(expandedOptsKeys);
507
501
  this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys));
508
502
  this._adapter.updateState({
509
- expandedKeys: newExpandedKeys,
510
- flattenNodes: newFlattenNodes,
503
+ expandedKeys: this._isExpandControlled() ? expandedKeys : newExpandedKeys,
504
+ flattenNodes: this._isExpandControlled() ? flattenNodes : newFlattenNodes,
511
505
  motionKeys: new Set([]),
512
506
  filteredKeys: new Set(filteredOptsKeys),
513
507
  filteredExpandedKeys: newFilteredExpandedKeys,
@@ -715,7 +709,7 @@ class TreeSelectFoundation extends _foundation.default {
715
709
  return;
716
710
  }
717
711
  const isExpandControlled = this._isExpandControlled();
718
- if (isSearching) {
712
+ if (isSearching && !isExpandControlled) {
719
713
  this.handleNodeExpandInSearch(e, treeNode);
720
714
  return;
721
715
  }
@@ -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: ("custom" | "auto")[];
21
+ UPLOAD_TRIGGER: ("auto" | "custom")[];
22
22
  VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
23
23
  PROMPT_POSITION: readonly ["left", "right", "bottom"];
24
24
  };
@@ -4,6 +4,8 @@ export interface AvatarAdapter<P = Record<string, any>, S = Record<string, any>>
4
4
  notifyLeave(event: any): void;
5
5
  notifyEnter(event: any): void;
6
6
  setFocusVisible: (focusVisible: boolean) => void;
7
+ setScale: (scale: number) => void;
8
+ getAvatarNode: () => HTMLSpanElement;
7
9
  }
8
10
  export default class AvatarFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<AvatarAdapter<P, S>, P, S> {
9
11
  constructor(adapter: AvatarAdapter<P, S>);
@@ -14,4 +16,5 @@ export default class AvatarFoundation<P = Record<string, any>, S = Record<string
14
16
  handleLeave(e: any): void;
15
17
  handleFocusVisible: (event: any) => void;
16
18
  handleBlur: () => void;
19
+ changeScale: () => void;
17
20
  }
@@ -18,8 +18,27 @@ export default class AvatarFoundation extends BaseFoundation {
18
18
  this.handleBlur = () => {
19
19
  this._adapter.setFocusVisible(false);
20
20
  };
21
+ this.changeScale = () => {
22
+ const {
23
+ gap
24
+ } = this.getProps();
25
+ const node = this._adapter.getAvatarNode();
26
+ const stringNode = node === null || node === void 0 ? void 0 : node.firstChild;
27
+ const [nodeWidth, stringNodeWidth] = [(node === null || node === void 0 ? void 0 : node.offsetWidth) || 0, (stringNode === null || stringNode === void 0 ? void 0 : stringNode.offsetWidth) || 0];
28
+ if (nodeWidth !== 0 && stringNodeWidth !== 0 && gap * 2 < nodeWidth) {
29
+ const scale = nodeWidth - gap * 2 > stringNodeWidth ? 1 : (nodeWidth - gap * 2) / stringNodeWidth;
30
+ this._adapter.setScale(scale);
31
+ }
32
+ };
33
+ }
34
+ init() {
35
+ const {
36
+ children
37
+ } = this.getProps();
38
+ if (typeof children === "string") {
39
+ this.changeScale();
40
+ }
21
41
  }
22
- init() {}
23
42
  destroy() {}
24
43
  handleImgLoadError() {
25
44
  const {
@@ -6,6 +6,7 @@ export type tipFormatterBasicType = string | number | boolean | null;
6
6
  export interface SliderProps {
7
7
  defaultValue?: number | number[];
8
8
  disabled?: boolean;
9
+ showMarkLabel?: boolean;
9
10
  included?: boolean;
10
11
  marks?: Marks;
11
12
  max?: number;
@@ -18,8 +19,10 @@ export interface SliderProps {
18
19
  onAfterChange?: (value: SliderProps['value']) => void;
19
20
  onChange?: (value: SliderProps['value']) => void;
20
21
  onMouseUp?: (e: any) => void;
22
+ tooltipOnMark?: boolean;
21
23
  tooltipVisible?: boolean;
22
24
  style?: Record<string, any>;
25
+ showArrow?: boolean;
23
26
  className?: string;
24
27
  showBoundary?: boolean;
25
28
  railStyle?: Record<string, any>;
@@ -15,7 +15,7 @@ export const parseToDate = function (input) {
15
15
  let dateFnsLocale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultLocale;
16
16
  if (input instanceof Date) {
17
17
  return input;
18
- } else if (typeof input === 'number' || !isNaN(Number(input))) {
18
+ } else if (typeof input === 'number') {
19
19
  return new Date(_toNumber(input));
20
20
  } else if (typeof input === 'string') {
21
21
  let curDate = new Date();
@@ -3,7 +3,8 @@
3
3
  * https://github.com/react-component/tree
4
4
  */
5
5
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
6
- export { KeyMapProps } from './treeUtil';
6
+ import type { KeyMapProps } from './treeUtil';
7
+ export type { KeyMapProps };
7
8
  export interface BasicTreeNodeProps {
8
9
  [x: string]: any;
9
10
  expanded?: boolean;
@@ -84,6 +84,6 @@ export declare function getValueOrKey(data: any, keyMaps?: KeyMapProps): any;
84
84
  export declare function normalizeValue(value: any, withObject: boolean, keyMaps?: KeyMapProps): any;
85
85
  export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
86
86
  export declare function calcDisabledKeys(keyEntities: KeyEntities, keyMaps?: KeyMapProps): Set<string>;
87
- export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
87
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
88
88
  export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
89
89
  export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
@@ -75,7 +75,7 @@ export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize'
75
75
  onVisibleChange?: (isVisible: boolean) => void;
76
76
  onLoad?: (keys: Set<string>, data: BasicTreeNodeData) => void;
77
77
  }
78
- export interface BasicTreeSelectInnerData extends Pick<BasicTreeInnerData, 'keyEntities' | 'treeData' | 'flattenNodes' | 'cachedFlattenNodes' | 'selectedKeys' | 'checkedKeys' | 'halfCheckedKeys' | 'motionKeys' | 'motionType' | 'expandedKeys' | 'filteredKeys' | 'filteredExpandedKeys' | 'filteredShownKeys' | 'cachedKeyValuePairs' | 'inputValue' | 'disabledKeys' | 'loadedKeys' | 'loadingKeys' | 'realCheckedKeys'> {
78
+ export interface BasicTreeSelectInnerData extends Pick<BasicTreeInnerData, 'keyEntities' | 'treeData' | 'flattenNodes' | 'selectedKeys' | 'checkedKeys' | 'halfCheckedKeys' | 'motionKeys' | 'motionType' | 'expandedKeys' | 'filteredKeys' | 'filteredExpandedKeys' | 'filteredShownKeys' | 'cachedKeyValuePairs' | 'inputValue' | 'disabledKeys' | 'loadedKeys' | 'loadingKeys' | 'realCheckedKeys'> {
79
79
  inputTriggerFocus: boolean;
80
80
  isOpen: boolean;
81
81
  rePosKey: number;
@@ -135,7 +135,6 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
135
135
  _notifyMultipleChange(key: string[], e: any): void;
136
136
  _notifyChange(key: any, e: any): void;
137
137
  _registerClickOutsideHandler: (e: any) => void;
138
- clearInputValue: () => void;
139
138
  _notifyFocus(e: any): void;
140
139
  handleTriggerFocus(e: any): void;
141
140
  _notifyBlur(e: any): void;
@@ -19,12 +19,6 @@ export default class TreeSelectFoundation extends BaseFoundation {
19
19
  this.close(e);
20
20
  });
21
21
  };
22
- this.clearInputValue = () => {
23
- const {
24
- inputValue
25
- } = this.getStates();
26
- inputValue && this._adapter.updateInputValue('');
27
- };
28
22
  }
29
23
  init() {
30
24
  const {
@@ -176,7 +170,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
176
170
  const isSearching = Boolean(inputValue);
177
171
  const treeNodeProps = {
178
172
  eventKey: key,
179
- expanded: isSearching ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
173
+ expanded: isSearching && !this._isExpandControlled() ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
180
174
  selected: selectedKeys.includes(key),
181
175
  checked: realChecked,
182
176
  halfChecked: realHalfChecked,
@@ -449,8 +443,8 @@ export default class TreeSelectFoundation extends BaseFoundation {
449
443
  expandedOptsKeys.forEach(item => newExpandedKeys.add(item));
450
444
  const newFlattenNodes = flattenTreeData(treeData, newExpandedKeys, keyMaps);
451
445
  this._adapter.updateState({
452
- expandedKeys: newExpandedKeys,
453
- flattenNodes: newFlattenNodes,
446
+ expandedKeys: isExpandControlled ? expandedKeys : newExpandedKeys,
447
+ flattenNodes: isExpandControlled ? flattenNodes : newFlattenNodes,
454
448
  inputValue: '',
455
449
  motionKeys: new Set([]),
456
450
  filteredKeys: new Set([]),
@@ -499,8 +493,8 @@ export default class TreeSelectFoundation extends BaseFoundation {
499
493
  const newFilteredExpandedKeys = new Set(expandedOptsKeys);
500
494
  this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys));
501
495
  this._adapter.updateState({
502
- expandedKeys: newExpandedKeys,
503
- flattenNodes: newFlattenNodes,
496
+ expandedKeys: this._isExpandControlled() ? expandedKeys : newExpandedKeys,
497
+ flattenNodes: this._isExpandControlled() ? flattenNodes : newFlattenNodes,
504
498
  motionKeys: new Set([]),
505
499
  filteredKeys: new Set(filteredOptsKeys),
506
500
  filteredExpandedKeys: newFilteredExpandedKeys,
@@ -708,7 +702,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
708
702
  return;
709
703
  }
710
704
  const isExpandControlled = this._isExpandControlled();
711
- if (isSearching) {
705
+ if (isSearching && !isExpandControlled) {
712
706
  this.handleNodeExpandInSearch(e, treeNode);
713
707
  return;
714
708
  }
@@ -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: ("custom" | "auto")[];
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,13 +1,13 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.48.0-alpha.0",
3
+ "version": "2.48.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.48.0-alpha.0",
10
+ "@douyinfe/semi-animation": "2.48.0",
11
11
  "async-validator": "^3.5.0",
12
12
  "classnames": "^2.2.6",
13
13
  "date-fns": "^2.29.3",
@@ -23,7 +23,7 @@
23
23
  "*.scss",
24
24
  "*.css"
25
25
  ],
26
- "gitHead": "930287380571d83f7a34d99fb13d80b4474adff8",
26
+ "gitHead": "6f3b0957a0fbd5b5cf5a2187782bac2f767162b3",
27
27
  "devDependencies": {
28
28
  "@babel/plugin-transform-runtime": "^7.15.8",
29
29
  "@babel/preset-env": "^7.15.8",
@@ -12,6 +12,7 @@ export type tipFormatterBasicType = string | number | boolean | null;
12
12
  export interface SliderProps{
13
13
  defaultValue?: number | number[];
14
14
  disabled?: boolean;
15
+ showMarkLabel?: boolean;
15
16
  included?: boolean; // Whether to juxtapose. Allow dragging
16
17
  marks?: Marks; // Scale
17
18
  max?: number;
@@ -24,8 +25,10 @@ export interface SliderProps{
24
25
  onAfterChange?: (value: SliderProps['value']) => void; // triggered when mouse up and clicked
25
26
  onChange?: (value: SliderProps['value']) => void;
26
27
  onMouseUp?: (e: any) => void;
28
+ tooltipOnMark?: boolean;
27
29
  tooltipVisible?: boolean;
28
30
  style?: Record<string, any>;
31
+ showArrow?: boolean;
29
32
  className?: string;
30
33
  showBoundary?: boolean;
31
34
  railStyle?: Record<string, any>;
@@ -14,7 +14,7 @@ import { zhCN as defaultLocale } from 'date-fns/locale';
14
14
  export const parseToDate = (input: string | Date | number, formatToken = strings.DEFAULT_FORMAT, dateFnsLocale = defaultLocale) => {
15
15
  if (input instanceof Date) {
16
16
  return input;
17
- } else if (typeof input === 'number' || !isNaN(Number(input))) {
17
+ } else if (typeof input === 'number') {
18
18
  return new Date(toNumber(input));
19
19
  } else if (typeof input === 'string') {
20
20
  let curDate = new Date();
@@ -22,7 +22,8 @@ import {
22
22
  calcDropActualPosition
23
23
  } from './treeUtil';
24
24
 
25
- export { KeyMapProps } from './treeUtil';
25
+ import type { KeyMapProps } from './treeUtil';
26
+ export type { KeyMapProps };
26
27
 
27
28
  export interface BasicTreeNodeProps {
28
29
  [x: string]: any;
@@ -150,7 +150,6 @@ export interface BasicTreeSelectInnerData extends Pick<BasicTreeInnerData,
150
150
  'keyEntities'
151
151
  | 'treeData'
152
152
  | 'flattenNodes'
153
- | 'cachedFlattenNodes'
154
153
  | 'selectedKeys'
155
154
  | 'checkedKeys'
156
155
  | 'halfCheckedKeys'
@@ -347,7 +346,9 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
347
346
  const isSearching = Boolean(inputValue);
348
347
  const treeNodeProps: BasicTreeNodeProps = {
349
348
  eventKey: key,
350
- expanded: isSearching ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
349
+ expanded: isSearching && !this._isExpandControlled()
350
+ ? filteredExpandedKeys.has(key)
351
+ : expandedKeys.has(key),
351
352
  selected: selectedKeys.includes(key),
352
353
  checked: realChecked,
353
354
  halfChecked: realHalfChecked,
@@ -443,11 +444,6 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
443
444
  });
444
445
  }
445
446
 
446
- clearInputValue = () => {
447
- const { inputValue } = this.getStates();
448
- inputValue && this._adapter.updateInputValue('');
449
- }
450
-
451
447
  // Scenes that may trigger focus:
452
448
  // 1、click selection
453
449
  _notifyFocus(e: any) {
@@ -601,8 +597,8 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
601
597
  const newFlattenNodes = flattenTreeData(treeData, newExpandedKeys, keyMaps);
602
598
 
603
599
  this._adapter.updateState({
604
- expandedKeys: newExpandedKeys,
605
- flattenNodes: newFlattenNodes,
600
+ expandedKeys: isExpandControlled ? expandedKeys : newExpandedKeys,
601
+ flattenNodes: isExpandControlled ? flattenNodes : newFlattenNodes,
606
602
  inputValue: '',
607
603
  motionKeys: new Set([]),
608
604
  filteredKeys: new Set([]),
@@ -641,8 +637,8 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
641
637
  const newFilteredExpandedKeys = new Set(expandedOptsKeys);
642
638
  this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys));
643
639
  this._adapter.updateState({
644
- expandedKeys: newExpandedKeys,
645
- flattenNodes: newFlattenNodes,
640
+ expandedKeys: this._isExpandControlled() ? expandedKeys : newExpandedKeys,
641
+ flattenNodes: this._isExpandControlled() ? flattenNodes : newFlattenNodes,
646
642
  motionKeys: new Set([]),
647
643
  filteredKeys: new Set(filteredOptsKeys),
648
644
  filteredExpandedKeys: newFilteredExpandedKeys,
@@ -812,7 +808,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
812
808
  }
813
809
 
814
810
  const isExpandControlled = this._isExpandControlled();
815
- if (isSearching) {
811
+ if (isSearching && !isExpandControlled) {
816
812
  this.handleNodeExpandInSearch(e, treeNode);
817
813
  return;
818
814
  }