interface.d.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import type * as React from 'react';
  2. import type { SafeKey, Key, DataNode as TreeDataNode } from 'rc-tree/lib/interface';
  3. export type { SafeKey, Key };
  4. export interface DataNode extends Record<string, any>, Omit<TreeDataNode, 'key' | 'children'> {
  5. key?: Key;
  6. value?: SafeKey;
  7. children?: DataNode[];
  8. }
  9. export type SelectSource = 'option' | 'selection' | 'input' | 'clear';
  10. export interface LabeledValueType {
  11. key?: Key;
  12. value?: SafeKey;
  13. label?: React.ReactNode;
  14. /** Only works on `treeCheckStrictly` */
  15. halfChecked?: boolean;
  16. }
  17. export type DefaultValueType = SafeKey | LabeledValueType | (SafeKey | LabeledValueType)[];
  18. export interface LegacyDataNode extends DataNode {
  19. props: any;
  20. }
  21. export interface FlattenDataNode {
  22. data: DataNode;
  23. key: Key;
  24. value: SafeKey;
  25. level: number;
  26. parent?: FlattenDataNode;
  27. }
  28. export interface SimpleModeConfig {
  29. id?: SafeKey;
  30. pId?: SafeKey;
  31. rootPId?: SafeKey;
  32. }
  33. /** @deprecated This is only used for legacy compatible. Not works on new code. */
  34. export interface LegacyCheckedNode {
  35. pos: string;
  36. node: React.ReactElement;
  37. children?: LegacyCheckedNode[];
  38. }
  39. export interface ChangeEventExtra {
  40. /** @deprecated Please save prev value by control logic instead */
  41. preValue: LabeledValueType[];
  42. triggerValue: SafeKey;
  43. /** @deprecated Use `onSelect` or `onDeselect` instead. */
  44. selected?: boolean;
  45. /** @deprecated Use `onSelect` or `onDeselect` instead. */
  46. checked?: boolean;
  47. /** @deprecated This prop not work as react node anymore. */
  48. triggerNode: React.ReactElement;
  49. /** @deprecated This prop not work as react node anymore. */
  50. allCheckedNodes: LegacyCheckedNode[];
  51. }
  52. export interface FieldNames {
  53. value?: string;
  54. label?: string;
  55. children?: string;
  56. _title?: string[];
  57. }