TreeSelect.d.ts 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import type { BaseSelectPropsWithoutPrivate, BaseSelectRef } from 'rc-select';
  2. import type { IconType } from 'rc-tree/lib/interface';
  3. import type { ExpandAction } from 'rc-tree/lib/Tree';
  4. import * as React from 'react';
  5. import TreeNode from './TreeNode';
  6. import type { CheckedStrategy } from './utils/strategyUtil';
  7. import { SHOW_ALL, SHOW_CHILD, SHOW_PARENT } from './utils/strategyUtil';
  8. import type { SafeKey, DataNode, SimpleModeConfig, ChangeEventExtra, FieldNames, LegacyDataNode } from './interface';
  9. export interface TreeSelectProps<ValueType = any, OptionType extends DataNode = DataNode> extends Omit<BaseSelectPropsWithoutPrivate, 'mode'> {
  10. prefixCls?: string;
  11. id?: string;
  12. children?: React.ReactNode;
  13. value?: ValueType;
  14. defaultValue?: ValueType;
  15. onChange?: (value: ValueType, labelList: React.ReactNode[], extra: ChangeEventExtra) => void;
  16. searchValue?: string;
  17. /** @deprecated Use `searchValue` instead */
  18. inputValue?: string;
  19. onSearch?: (value: string) => void;
  20. autoClearSearchValue?: boolean;
  21. filterTreeNode?: boolean | ((inputValue: string, treeNode: DataNode) => boolean);
  22. treeNodeFilterProp?: string;
  23. onSelect?: (value: ValueType, option: OptionType) => void;
  24. onDeselect?: (value: ValueType, option: OptionType) => void;
  25. showCheckedStrategy?: CheckedStrategy;
  26. treeNodeLabelProp?: string;
  27. fieldNames?: FieldNames;
  28. multiple?: boolean;
  29. treeCheckable?: boolean | React.ReactNode;
  30. treeCheckStrictly?: boolean;
  31. labelInValue?: boolean;
  32. maxCount?: number;
  33. treeData?: OptionType[];
  34. treeDataSimpleMode?: boolean | SimpleModeConfig;
  35. loadData?: (dataNode: LegacyDataNode) => Promise<unknown>;
  36. treeLoadedKeys?: SafeKey[];
  37. onTreeLoad?: (loadedKeys: SafeKey[]) => void;
  38. treeDefaultExpandAll?: boolean;
  39. treeExpandedKeys?: SafeKey[];
  40. treeDefaultExpandedKeys?: SafeKey[];
  41. onTreeExpand?: (expandedKeys: SafeKey[]) => void;
  42. treeExpandAction?: ExpandAction;
  43. virtual?: boolean;
  44. listHeight?: number;
  45. listItemHeight?: number;
  46. listItemScrollOffset?: number;
  47. onDropdownVisibleChange?: (open: boolean) => void;
  48. treeTitleRender?: (node: OptionType) => React.ReactNode;
  49. treeLine?: boolean;
  50. treeIcon?: IconType;
  51. showTreeIcon?: boolean;
  52. switcherIcon?: IconType;
  53. treeMotion?: any;
  54. }
  55. declare const GenericTreeSelect: (<ValueType = any, OptionType extends DataNode = DataNode>(props: TreeSelectProps<ValueType, OptionType> & {
  56. children?: React.ReactNode;
  57. } & {
  58. ref?: React.Ref<BaseSelectRef>;
  59. }) => React.ReactElement) & {
  60. TreeNode: typeof TreeNode;
  61. SHOW_ALL: typeof SHOW_ALL;
  62. SHOW_PARENT: typeof SHOW_PARENT;
  63. SHOW_CHILD: typeof SHOW_CHILD;
  64. };
  65. export default GenericTreeSelect;