@qsxy/element-plus-react 1.0.0-next.2 → 1.0.0-next.3

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 (131) hide show
  1. package/README.md +31 -0
  2. package/dist/Badge/typings.d.ts +10 -0
  3. package/dist/Breadcrumb/typings.d.ts +4 -0
  4. package/dist/Button/typings.d.ts +28 -0
  5. package/dist/Calendar/CalendarContext.d.ts +10 -0
  6. package/dist/Calendar/ShortCuts.d.ts +2 -0
  7. package/dist/Calendar/typings.d.ts +18 -0
  8. package/dist/Card/typings.d.ts +4 -0
  9. package/dist/Cascader/CascaderDropdown.d.ts +1 -0
  10. package/dist/Cascader/CascaderMenu.d.ts +7 -0
  11. package/dist/Cascader/typings.d.ts +80 -0
  12. package/dist/Cascader/useCascader.d.ts +72 -0
  13. package/dist/Checkbox/typings.d.ts +11 -0
  14. package/dist/CheckboxGroup/CheckboxGroup.d.ts +4 -0
  15. package/dist/CheckboxGroup/CheckboxGroupContext.d.ts +1 -0
  16. package/dist/Col/typings.d.ts +10 -0
  17. package/dist/Collapse/CollapseContext.d.ts +3 -0
  18. package/dist/Collapse/typings.d.ts +7 -0
  19. package/dist/ColorPicker/AlphaSlider.d.ts +7 -0
  20. package/dist/ColorPicker/HueSlider.d.ts +7 -0
  21. package/dist/ColorPicker/Predefine.d.ts +7 -0
  22. package/dist/ColorPicker/SvPanel.d.ts +7 -0
  23. package/dist/ColorPicker/typings.d.ts +9 -0
  24. package/dist/ConfigProvider/ConfigProvider.d.ts +5 -0
  25. package/dist/DatePicker/typings.d.ts +69 -0
  26. package/dist/DateTimePicker/typings.d.ts +1 -0
  27. package/dist/Descriptions/DescriptionsContext.d.ts +2 -0
  28. package/dist/Descriptions/typings.d.ts +13 -0
  29. package/dist/Dialog/DialogContext.d.ts +8 -0
  30. package/dist/Dialog/typings.d.ts +36 -0
  31. package/dist/Divider/Divider.d.ts +4 -0
  32. package/dist/Drawer/DrawerContext.d.ts +10 -0
  33. package/dist/Drawer/typings.d.ts +16 -0
  34. package/dist/Dropdown/DropdownContext.d.ts +2 -0
  35. package/dist/Dropdown/typings.d.ts +15 -0
  36. package/dist/Form/FormItem.d.ts +12 -0
  37. package/dist/Form/typings.d.ts +55 -0
  38. package/dist/Form/useForm.d.ts +22 -0
  39. package/dist/Form/utils/NameMap.d.ts +3 -0
  40. package/dist/Form/utils/validateUtil.d.ts +4 -0
  41. package/dist/Form/utils/valueUtil.d.ts +17 -0
  42. package/dist/Icon/typings.d.ts +7 -0
  43. package/dist/Input/typings.d.ts +61 -0
  44. package/dist/InputNumber/typings.d.ts +21 -0
  45. package/dist/Link/typings.d.ts +6 -1
  46. package/dist/Loading/typings.d.ts +5 -0
  47. package/dist/Message/Main.d.ts +7 -0
  48. package/dist/Message/index.d.ts +8 -0
  49. package/dist/Message/typings.d.ts +11 -0
  50. package/dist/MessageBox/index.d.ts +14 -0
  51. package/dist/MessageBox/typings.d.ts +50 -0
  52. package/dist/Notification/Main.d.ts +7 -0
  53. package/dist/Notification/index.d.ts +15 -0
  54. package/dist/Notification/typings.d.ts +13 -0
  55. package/dist/Pagination/typings.d.ts +28 -0
  56. package/dist/Popconfirm/typings.d.ts +10 -0
  57. package/dist/Popover/typings.d.ts +12 -0
  58. package/dist/Popper/typings.d.ts +7 -1
  59. package/dist/Progress/typings.d.ts +12 -0
  60. package/dist/Radio/typings.d.ts +7 -0
  61. package/dist/RadioGroup/typings.d.ts +1 -0
  62. package/dist/Row/RowContext.d.ts +1 -0
  63. package/dist/Row/typings.d.ts +4 -0
  64. package/dist/Scrollbar/typings.d.ts +20 -0
  65. package/dist/Select/typings.d.ts +33 -0
  66. package/dist/Skeleton/PlaceholderGraph.d.ts +4 -0
  67. package/dist/Skeleton/PlaceholderGrid.d.ts +4 -0
  68. package/dist/Skeleton/PlaceholderParagraph.d.ts +4 -0
  69. package/dist/Switch/typings.d.ts +15 -0
  70. package/dist/Table/Colgroup.d.ts +1 -0
  71. package/dist/Table/TableContext.d.ts +8 -0
  72. package/dist/Table/hooks/useSelection.d.ts +17 -0
  73. package/dist/Table/hooks/useTable.d.ts +7 -0
  74. package/dist/Table/treeUtil.d.ts +39 -0
  75. package/dist/Table/typings.d.ts +137 -1
  76. package/dist/Table/util.d.ts +10 -0
  77. package/dist/Tabs/typings.d.ts +38 -0
  78. package/dist/Tag/Tag.d.ts +1 -1
  79. package/dist/Tag/Tag.js +18 -26
  80. package/dist/Tag/typings.d.ts +10 -0
  81. package/dist/TimeLine/typings.d.ts +9 -0
  82. package/dist/TimePicker/typings.d.ts +13 -0
  83. package/dist/TimePicker/useTimePicker.d.ts +7 -0
  84. package/dist/Tooltip/Tooltip.js +8 -19
  85. package/dist/Tooltip/TooltipContext.d.ts +1 -0
  86. package/dist/Tooltip/typings.d.ts +14 -1
  87. package/dist/Transfer/ListItem.d.ts +1 -0
  88. package/dist/Transfer/typings/index.d.ts +27 -0
  89. package/dist/Transfer/typings/list.d.ts +25 -0
  90. package/dist/Transfer/typings/listBody.d.ts +1 -0
  91. package/dist/Transition/Transition.d.ts +10 -0
  92. package/dist/Transition/TransitionGroup.d.ts +59 -0
  93. package/dist/Transition/childMapping.d.ts +23 -0
  94. package/dist/Tree/NodeList.d.ts +3 -0
  95. package/dist/Tree/RCTree.d.ts +15 -0
  96. package/dist/Tree/Tree.d.ts +15 -0
  97. package/dist/Tree/TreeNode.d.ts +7 -0
  98. package/dist/Tree/contextTypes.d.ts +4 -0
  99. package/dist/Tree/typings.d.ts +3 -0
  100. package/dist/Tree/util.d.ts +17 -0
  101. package/dist/Tree/utils/KeyCode.d.ts +326 -0
  102. package/dist/Tree/utils/conductUtil.d.ts +6 -0
  103. package/dist/Tree/utils/dictUtil.d.ts +1 -0
  104. package/dist/Tree/utils/pickAttrs.d.ts +5 -0
  105. package/dist/Tree/utils/treeUtil.d.ts +25 -1
  106. package/dist/TreeSelect/Utils.d.ts +1 -0
  107. package/dist/TreeSelect/typings.d.ts +19 -0
  108. package/dist/Upload/typings.d.ts +34 -0
  109. package/dist/Upload/use-handlers.d.ts +1 -0
  110. package/dist/Util/Math.d.ts +34 -0
  111. package/dist/Util/base.d.ts +21 -0
  112. package/dist/Util/shallowEqual.d.ts +11 -0
  113. package/dist/Util/treeUtils.d.ts +8 -0
  114. package/dist/VirtualList/Filler.d.ts +5 -0
  115. package/dist/VirtualList/VirtualList.d.ts +3 -0
  116. package/dist/VirtualList/hooks/useLayoutEffect.d.ts +3 -0
  117. package/dist/VirtualList/utils/algorithmUtil.d.ts +17 -0
  118. package/dist/VirtualList/utils/findDOMNode.d.ts +3 -0
  119. package/dist/hooks/animationPropsUtils.d.ts +12 -0
  120. package/dist/hooks/htmlPropsUtils.d.ts +8 -0
  121. package/dist/hooks/popperPropsUtils.d.ts +12 -0
  122. package/dist/hooks/treePropsUtils.d.ts +12 -0
  123. package/dist/hooks/useChildrenInstance.d.ts +11 -0
  124. package/dist/hooks/useClassNames.d.ts +78 -0
  125. package/dist/hooks/useControlled.d.ts +8 -0
  126. package/dist/hooks/useForceUpdate.d.ts +1 -0
  127. package/dist/index.d.ts +1 -0
  128. package/dist/theme-chalk/link/index.scss +0 -85
  129. package/dist/types/common.d.ts +24 -0
  130. package/dist/types/type.d.ts +5 -0
  131. package/package.json +1 -1
@@ -3,13 +3,22 @@ import { IconName } from '../Icon';
3
3
  import { BaseProps, NativeProps } from '../types/common';
4
4
  export type TimeLineProps = BaseProps & NativeProps<'--el-timeline-node-size-normal' | '--el-timeline-node-size-large' | '--el-timeline-timestamp-color' | '--el-timeline-content-color' | '--el-timeline-content-font-size-small' | '--el-timeline-content-font-size-large' | '--el-timeline-node-color'>;
5
5
  export type TimeLineItemProps = BaseProps & NativeProps & {
6
+ /** 时间戳 */
6
7
  timestamp?: string;
8
+ /** 是否隐藏时间戳 */
7
9
  hideTimestamp?: boolean;
10
+ /** 是否垂直居中 */
8
11
  center?: boolean;
12
+ /** 时间戳位置 */
9
13
  placement?: 'top' | 'bottom';
14
+ /** 节点类型 */
10
15
  type?: 'primary' | 'success' | 'warning' | 'error' | 'info';
16
+ /** 节点颜色 */
11
17
  color?: string;
18
+ /** 节点尺寸 */
12
19
  size?: 'normal' | 'large';
20
+ /** 自定义图标 */
13
21
  icon?: IconName | React.ReactElement<any>;
22
+ /** 是否空心点 */
14
23
  hollow?: boolean;
15
24
  };
@@ -36,8 +36,11 @@ export type TimePickerProps = Omit<DatePickerProps, 'type' | 'instance'> & {
36
36
  disabledHours?: DisabledHours;
37
37
  disabledMinutes?: DisabledMinutes;
38
38
  disabledSeconds?: DisabledSeconds;
39
+ /** 等价于原生 name 属性 */
39
40
  name?: string;
41
+ /** 选中项绑定值 */
40
42
  value?: string;
43
+ /** 默认值 */
41
44
  defaultValue?: string;
42
45
  };
43
46
  export type TimePickerRangeProps = Omit<DatePickerRangeProps, 'type' | 'instance'> & {
@@ -47,26 +50,36 @@ export type TimePickerRangeProps = Omit<DatePickerRangeProps, 'type' | 'instance
47
50
  instance?: RefObject<TimePickerRangeRef>;
48
51
  };
49
52
  export interface TimeSpinnerProps extends BaseProps, NativeProps, AnimationEventProps {
53
+ /** 值 */
50
54
  value: Dayjs;
51
55
  disabledHours?: DisabledHours;
52
56
  disabledMinutes?: DisabledMinutes;
53
57
  disabledSeconds?: DisabledSeconds;
54
58
  showSeconds?: boolean;
55
59
  role?: RoleType;
60
+ /** 单选框提交数据方法 */
56
61
  onChange: (value: Dayjs, params?: ChangeParams) => void;
57
62
  setSelectionRange?: (start: number, end: number, pos?: 'min' | 'max') => void;
58
63
  }
59
64
  export interface TimePanelProps extends BaseProps, NativeProps, AnimationEventProps, TimeSpinnerProps {
65
+ /** 是否显示 */
60
66
  visible?: boolean;
67
+ /** */
61
68
  referenceElement: RefObject<HTMLElement> | (() => RefObject<HTMLElement>);
69
+ /** 关闭时回调函数 */
62
70
  onDestroy: () => void;
71
+ /** 单选框提交数据方法 */
63
72
  onOk: () => void;
64
73
  }
65
74
  export interface TimeRangePanelProps extends BaseProps, NativeProps, AnimationEventProps, Omit<TimeSpinnerProps, 'value' | 'onChange'>, Omit<TimePickerRangeProps, 'instance' | 'value' | 'onChange'> {
66
75
  value: ValueRagne;
67
76
  onChange: (value: ValueRagne, params?: ChangeParams) => void;
77
+ /** 是否显示 */
68
78
  visible: boolean;
79
+ /** */
80
+ /** 关闭时回调函数 */
69
81
  onDestroy?: () => void;
82
+ /** 单选框提交数据方法 */
70
83
  onOk: () => void;
71
84
  }
72
85
  export interface TimePanelRef {
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @author Element Plus
3
+ * @CreateTime 2022/4/1 09:09:12
4
+ * @LastEditor Parker
5
+ * @ModifyTime 2022/4/6 14:44:01
6
+ * @Description Element Plus 时间选择面板工具类,见https://github.com/element-plus/element-plus
7
+ */
1
8
  import { Compare, DisabledHours, DisabledMinutes, DisabledSeconds, RoleType } from './typings';
2
9
  export declare const getTimeLists: (disabledHours: DisabledHours, disabledMinutes: DisabledMinutes, disabledSeconds: DisabledSeconds) => {
3
10
  getHoursList: (role: RoleType, compare?: Compare) => boolean[];
@@ -38,29 +38,17 @@ var import_react = __toESM(require("react"));
38
38
  var ReactIs = __toESM(require("react-is"));
39
39
  var import_hooks = require("../hooks");
40
40
  var import_Popper = require("../Popper");
41
- var import_Util = require("../Util");
42
41
  var import_TooltipContext = require("./TooltipContext");
43
42
  var Tooltip = (0, import_react.forwardRef)((props, ref) => {
44
- props = (0, import_Util.mergeDefaultProps)(
45
- {
46
- effect: "dark",
47
- showArrow: true,
48
- showAfter: 0,
49
- hideAfter: 200,
50
- trigger: "hover",
51
- unmountOnExit: true
52
- },
53
- props
54
- );
55
43
  const {
56
44
  classPrefix = "tooltip",
57
- effect: theme,
58
- trigger,
45
+ effect = "dark",
46
+ trigger = "hover",
59
47
  content,
60
48
  disabled,
61
- enterable,
62
- showAfter,
63
- hideAfter,
49
+ enterable = true,
50
+ showAfter = 0,
51
+ hideAfter = 200,
64
52
  onMouseEnter,
65
53
  onMouseLeave,
66
54
  onEnter,
@@ -68,6 +56,7 @@ var Tooltip = (0, import_react.forwardRef)((props, ref) => {
68
56
  contentSlot,
69
57
  virtualTriggering,
70
58
  virtualRef,
59
+ unmountOnExit = true,
71
60
  ...rest
72
61
  } = props;
73
62
  const [popperProps] = (0, import_hooks.partitionPopperPropsUtils)(rest);
@@ -193,8 +182,8 @@ var Tooltip = (0, import_react.forwardRef)((props, ref) => {
193
182
  },
194
183
  onMouseEnter: enterable && trigger === "hover" ? handleMouseEnter : import_noop.default,
195
184
  onMouseLeave: enterable && trigger === "hover" ? handleMouseLeave : import_noop.default,
196
- className: (0, import_classnames.default)(is(theme), props.popperClass, { [e`popper`]: classPrefix === "tooltip" }),
197
- unmountOnExit: props.unmountOnExit,
185
+ className: (0, import_classnames.default)(is(effect), props.popperClass, { [e`popper`]: classPrefix === "tooltip" }),
186
+ unmountOnExit,
198
187
  ...popperProps,
199
188
  ...transitionProps
200
189
  },
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  export interface TooltipContextProps {
3
3
  onMouseEnter?: (e?: React.MouseEvent<any>) => void;
4
4
  onMouseLeave?: (e?: React.MouseEvent<any>) => void;
5
+ /** 触发下拉的行为 */
5
6
  trigger: 'hover' | 'click' | 'contextmenu';
6
7
  onClose: () => void;
7
8
  }
@@ -11,21 +11,34 @@ export type TooltipRef = {
11
11
  hide: () => void;
12
12
  };
13
13
  export interface TooltipProps extends BaseProps<React.ReactNode>, NativeProps, PopperOptions, AnimationEventProps, Omit<TransitionProps, 'children'> {
14
+ /** class 前缀 */
14
15
  classPrefix?: string;
16
+ /** 指示 Tooltip 的内容将附加在哪一个网页元素上 */
15
17
  appendTo?: HTMLElement;
16
- effect?: 'light' | 'dark';
18
+ /** 默认提供的主题 */
19
+ effect?: 'light' | 'dark' | string;
20
+ /** 显示的内容 */
17
21
  content?: string | React.ReactNode;
22
+ /** 触发下拉的行为 */
18
23
  trigger?: 'hover' | 'click' | 'contextmenu';
24
+ /** 状态是否可见 */
19
25
  visible?: boolean;
26
+ /** 初始值 */
20
27
  defaultVisible?: boolean;
28
+ /** Tooltip 是否可用 */
21
29
  disabled?: boolean;
30
+ /** 鼠标是否可进入到 tooltip 中 */
22
31
  enterable?: boolean;
32
+ /** 延迟出现,单位毫秒 */
23
33
  showAfter?: number;
34
+ /** Tooltip 出现后自动隐藏延时,单位毫秒,为 0 则不会自动隐藏 */
24
35
  hideAfter?: number;
25
36
  onMouseEnter?: (e?: React.MouseEvent<any>) => void;
26
37
  onMouseLeave?: (e?: React.MouseEvent<any>) => void;
27
38
  triggerRef?: React.ReactElement;
39
+ /** 用来标识虚拟触发是否被启用 */
28
40
  virtualTriggering?: boolean;
41
+ /** 标识虚拟触发时的触发元素 */
29
42
  virtualRef?: VirtualElement;
30
43
  contentSlot?: ComponentChildren;
31
44
  }
@@ -9,6 +9,7 @@ type ListItemProps<RecordType> = {
9
9
  onClick: (item: RecordType) => void;
10
10
  onRemove?: (item: RecordType) => void;
11
11
  item: RecordType;
12
+ /** 数据源的字段别名 */
12
13
  fieldNames: FieldNames;
13
14
  };
14
15
  declare const ListItem: <RecordType extends KeyWiseTransferItem>(props: ListItemProps<RecordType>) => React.JSX.Element;
@@ -20,6 +20,7 @@ export type TransferRender<RecordType> = (item: RecordType) => RenderResult;
20
20
  export interface ListStyle {
21
21
  direction: TransferDirection;
22
22
  }
23
+ /** 自定义顶部多选框标题的集合 */
23
24
  export type SelectAllLabel = React.ReactElement<any> | ((info: {
24
25
  selectedCount: number;
25
26
  totalCount: number;
@@ -39,32 +40,58 @@ export interface TransferLocale {
39
40
  removeCurrent?: string;
40
41
  }
41
42
  export interface TransferProps<RecordType extends TransferItem = TransferItem> extends Omit<BaseProps, 'children'>, NativeProps {
43
+ /** 是否禁用 */
42
44
  disabled?: boolean;
45
+ /** 数据源,其中的数据将会被渲染到左边一栏中,targetKeys 中指定的除外 */
43
46
  data: RecordType[];
47
+ /** 默认显示在右侧框数据的 key 集合 */
44
48
  defaultValue?: (string | number)[];
49
+ /** 显示在右侧框数据的 key 集合(控制模式) */
45
50
  value?: (string | number)[];
51
+ /** 设置哪些项应该被选中 */
46
52
  selectedKeys?: (string | number)[];
53
+ /** 每行数据渲染函数,该函数的入参为 dataSource 中的项,返回值为 ReactElement。或者返回一个普通对象,其中 label 字段为 ReactElement,value 字段为 title */
47
54
  render?: TransferRender<RecordType>;
55
+ /** 选项在两栏之间转移时的回调函数 */
48
56
  onChange?: (targetKeys: (string | number)[], direction: TransferDirection, moveKeys: (string | number)[]) => void;
57
+ /** 选中项发生改变时的回调函数 */
49
58
  onSelectChange?: (sourceSelectedKeys: (string | number)[], targetSelectedKeys: (string | number)[]) => void;
59
+ /** 两个穿梭框的自定义样式 */
50
60
  listStyle?: ((style: ListStyle) => React.CSSProperties) | React.CSSProperties;
61
+ /** 操作栏的自定义样式 */
51
62
  operationStyle?: React.CSSProperties;
63
+ /** 标题集合,顺序从左至右 */
52
64
  titles?: (React.ReactElement | string)[];
65
+ /** 操作文案集合,顺序从上至下 */
53
66
  operations?: string[];
67
+ /** 是否显示搜索框 */
54
68
  filterable?: boolean;
69
+ /** 接收 inputValue option 两个参数,当 option 符合筛选条件时,应返回 true,反之则返回 false */
55
70
  filterMethod?: (inputValue: string, item: RecordType) => boolean;
71
+ /** */
56
72
  locale?: Partial<TransferLocale>;
73
+ /** 底部渲染函数 */
57
74
  footer?: (props: TransferListProps<RecordType>, extra: {
58
75
  direction: TransferDirection;
59
76
  }) => React.ReactElement;
77
+ /** 搜索框内容时改变时的回调函数 */
60
78
  onSearch?: (direction: TransferDirection, value: string) => void;
79
+ /** 选项列表滚动时的回调函数 */
61
80
  onScroll?: (direction: TransferDirection, e: any) => void;
81
+ /** */
62
82
  children?: (props: TransferListBodyProps<RecordType>) => React.ReactElement;
83
+ /** 是否展示全选勾选框 */
63
84
  showSelectAll?: boolean;
85
+ /** 自定义顶部多选框标题的集合 */
64
86
  selectAllLabels?: SelectAllLabel[];
87
+ /** 展示为单向样式 */
65
88
  oneWay?: boolean;
89
+ /** 使用分页样式,自定义渲染列表下无效 */
66
90
  pagination?: PaginationType;
91
+ /** 数据源的字段别名 */
67
92
  fieldNames?: FieldNames;
93
+ /** 表单校验错误提示 */
68
94
  error?: boolean;
95
+ /** 表单校验警告提示 */
69
96
  warning?: boolean;
70
97
  }
@@ -10,30 +10,55 @@ export interface RenderedItem<RecordType> {
10
10
  }
11
11
  export type RenderListFunction<T> = (props: TransferListBodyProps<T>) => React.ReactElement;
12
12
  export interface TransferListProps<RecordType> extends TransferLocale, BaseProps, NativeProps {
13
+ /** 标题 */
13
14
  titleText?: string | React.ReactElement;
15
+ /** 数据源 */
14
16
  data: RecordType[];
17
+ /** */
15
18
  filterOption?: (filterText: string, item: RecordType) => boolean;
19
+ /** */
16
20
  checkedKeys: (string | number)[];
21
+ /** */
17
22
  handleFilter: (e: any) => void;
23
+ /** */
18
24
  onItemSelect: (key: string | number, check: boolean) => void;
25
+ /** */
19
26
  onItemSelectAll: (data: (string | number)[], checkAll: boolean, overWrite?: boolean) => void;
27
+ /** */
20
28
  onItemRemove?: (keys: (string | number)[]) => void;
29
+ /** */
21
30
  handleClear: () => void;
31
+ /** */
22
32
  render?: (item: RecordType) => RenderResult;
33
+ /** */
23
34
  showSearch?: boolean;
35
+ /** */
24
36
  searchPlaceholder?: string;
37
+ /** */
25
38
  itemUnit?: string;
39
+ /** */
26
40
  itemsUnit?: string;
41
+ /** */
27
42
  renderList?: RenderListFunction<RecordType>;
43
+ /** */
28
44
  footer?: (props: TransferListProps<RecordType>, info?: {
29
45
  direction: TransferDirection;
30
46
  }) => React.ReactElement;
47
+ /** */
31
48
  onScroll: (e: any) => void;
49
+ /** */
32
50
  disabled?: boolean;
51
+ /** */
33
52
  direction: TransferDirection;
53
+ /** 是否展示全选勾选框 */
34
54
  showSelectAll?: boolean;
55
+ /** */
56
+ /** 自定义顶部多选框标题 */
35
57
  selectAllLabel?: SelectAllLabel;
58
+ /** */
36
59
  showRemove?: boolean;
60
+ /** 分页 */
37
61
  pagination?: PaginationType;
62
+ /** 数据源的字段别名 */
38
63
  fieldNames: FieldNames;
39
64
  }
@@ -12,6 +12,7 @@ export interface TransferListBodyProps<RecordType> extends PartialTransferListPr
12
12
  filteredItems: RecordType[];
13
13
  filteredRenderItems: RenderedItem<RecordType>[];
14
14
  selectedKeys: (string | number)[];
15
+ /** 数据源的字段别名 */
15
16
  fieldNames: FieldNames;
16
17
  }
17
18
  export {};
@@ -14,17 +14,27 @@ interface ExtraProps {
14
14
  }
15
15
  export interface TransitionProps extends AnimationEventProps {
16
16
  animation?: boolean;
17
+ /** Primary content */
17
18
  children?: ComponentChildren;
19
+ /** Additional classes */
18
20
  className?: string;
19
21
  name?: string;
20
22
  display?: string;
23
+ /** Show the component; triggers the enter or exit animation */
21
24
  visible?: boolean;
25
+ /** Unmount the component (remove it from the DOM) when it is not shown */
22
26
  unmountOnExit?: boolean;
27
+ /** Run the enter animation when the component mounts, if it is initially shown */
23
28
  transitionAppear?: boolean;
29
+ /** A Timeout for the animation */
24
30
  duration?: number;
31
+ /** CSS class or classes applied when the component is exited */
25
32
  exitedClassName?: string;
33
+ /** CSS class or classes applied while the component is exiting */
26
34
  exitingClassName?: string;
35
+ /** CSS class or classes applied when the component is entered */
27
36
  enteredClassName?: string;
37
+ /** CSS class or classes applied while the component is entering */
28
38
  enteringClassName?: string;
29
39
  }
30
40
  interface TransitionState {
@@ -1,10 +1,55 @@
1
1
  import React, { Component } from 'react';
2
2
  export interface TransitionGroupProps {
3
+ /**
4
+ * `<TransitionGroup>` renders a `<div>` by default. You can change this
5
+ * behavior by providing a `component` prop.
6
+ * If you use React v16+ and would like to avoid a wrapping `<div>` element
7
+ * you can pass in `component={null}`. This is useful if the wrapping div
8
+ * borks your css styles.
9
+ */
3
10
  component: any;
11
+ /**
12
+ * A set of `<Transition>` components, that are toggled `in` and out as they
13
+ * leave. the `<TransitionGroup>` will inject specific transition props, so
14
+ * remember to spread them through if you are wrapping the `<Transition>` as
15
+ * with our `<Fade>` example.
16
+ *
17
+ * While this component is meant for multiple `Transition` or `CSSTransition`
18
+ * children, sometimes you may want to have a single transition child with
19
+ * content that you want to be transitioned out and in when you change it
20
+ * (e.g. routes, images etc.) In that case you can change the `key` prop of
21
+ * the transition child as you change its content, this will cause
22
+ * `TransitionGroup` to transition the child out and back in.
23
+ */
4
24
  children: React.ReactNode;
25
+ /**
26
+ * A convenience prop that enables or disables transitionAppear animations
27
+ * for all children. Note that specifying this will override any defaults set
28
+ * on individual children Transitions.
29
+ */
5
30
  transitionAppear: boolean;
31
+ /**
32
+ * A convenience prop that enables or disables enter animations
33
+ * for all children. Note that specifying this will override any defaults set
34
+ * on individual children Transitions.
35
+ */
6
36
  enter: boolean;
37
+ /**
38
+ * A convenience prop that enables or disables exit animations
39
+ * for all children. Note that specifying this will override any defaults set
40
+ * on individual children Transitions.
41
+ */
7
42
  exit: boolean;
43
+ /**
44
+ * You may need to apply reactive updates to a child as it is exiting.
45
+ * This is generally done by using `cloneElement` however in the case of an exiting
46
+ * child the element has already been removed and not accessible to the consumer.
47
+ *
48
+ * If you do need to update a child as it leaves you can provide a `childFactory`
49
+ * to wrap every child, even the ones that are leaving.
50
+ *
51
+ * @type Function(child: ReactElement) -> ReactElement
52
+ */
8
53
  childFactory: (child: React.ReactNode) => React.ReactNode;
9
54
  }
10
55
  interface State {
@@ -15,6 +60,20 @@ interface State {
15
60
  handleExited?: (child: any, node: any) => void;
16
61
  firstRender?: boolean;
17
62
  }
63
+ /**
64
+ * The `<TransitionGroup>` component manages a set of transition components
65
+ * (`<Transition>` and `<CSSTransition>`) in a list. Like with the transition
66
+ * components, `<TransitionGroup>` is a state machine for managing the mounting
67
+ * and unmounting of components over time.
68
+ *
69
+ * Consider the example below. As items are removed or added to the TodoList the
70
+ * `in` prop is toggled automatically by the `<TransitionGroup>`.
71
+ *
72
+ * Note that `<TransitionGroup>` does not define any animation behavior!
73
+ * Exactly _how_ a list item animates is up to the individual transition
74
+ * component. This means you can mix and match animations across different list
75
+ * items.
76
+ */
18
77
  declare class TransitionGroup extends Component<TransitionGroupProps, State> {
19
78
  mounted: boolean | undefined;
20
79
  static defaultProps: {
@@ -1,5 +1,28 @@
1
1
  import React from 'react';
2
+ /**
3
+ * Given `this.props.children`, return an object mapping key to child.
4
+ *
5
+ * @param {*} children `this.props.children`
6
+ * @return {object} Mapping of key to child
7
+ */
2
8
  export declare function getChildMapping(children: React.ReactElement<any>[] | React.ReactElement<any>, mapFn?: (child: React.ReactElement<any>) => React.ReactNode): any;
9
+ /**
10
+ * When you're adding or removing children some may be added or removed in the
11
+ * same render pass. We want to show *both* since we want to simultaneously
12
+ * animate elements in and out. This function takes a previous set of keys
13
+ * and a new set of keys and merges them with its best guess of the correct
14
+ * ordering. In the future we may expose some of the utilities in
15
+ * ReactMultiChild to make this easy, but for now React itself does not
16
+ * directly have this concept of the union of prevChildren and nextChildren
17
+ * so we implement it here.
18
+ *
19
+ * @param {object} prev prev children as returned from
20
+ * `ReactTransitionChildMapping.getChildMapping()`.
21
+ * @param {object} next next children as returned from
22
+ * `ReactTransitionChildMapping.getChildMapping()`.
23
+ * @return {object} a key set that contains all keys in `prev` and all keys
24
+ * in `next` in a reasonable order.
25
+ */
3
26
  export declare function mergeChildMappings(prev: any, next: any): {};
4
27
  export declare function getInitialChildMapping(props: any, afterLeave: any): any;
5
28
  export declare function getNextChildMapping(nextProps: any, prevChildMapping: any, afterLeave: any): {};
@@ -38,6 +38,9 @@ interface NodeListProps {
38
38
  onListChangeStart: () => void;
39
39
  onListChangeEnd: () => void;
40
40
  }
41
+ /**
42
+ * We only need get visible content items to play the animation.
43
+ */
41
44
  export declare function getMinimumRangeTransitionRange(list: FlattenNode[], virtual: boolean, height: number, itemHeight: number): FlattenNode[];
42
45
  declare const NodeList: FC<NodeListProps>;
43
46
  export default NodeList;
@@ -114,6 +114,10 @@ export interface TreeProps<TreeDataType extends BasicDataNode = DataNode> {
114
114
  dropPosition: number;
115
115
  dropToGap: boolean;
116
116
  }) => void;
117
+ /**
118
+ * Used for `rc-tree-select` only.
119
+ * Do not use in your production code directly since this will be refactor.
120
+ */
117
121
  onActiveChange?: (key: Key) => void;
118
122
  filterTreeNode?: (treeNode: EventDataNode) => boolean;
119
123
  motion?: any;
@@ -186,6 +190,13 @@ declare class RCTree<TreeDataType extends BasicDataNode = DataNode> extends Comp
186
190
  componentWillUnmount(): void;
187
191
  static getDerivedStateFromProps(props: TreeProps, prevState: TreeState): Partial<TreeState<DataNode<any>>>;
188
192
  onNodeDragStart: NodeDragEventHandler<HTMLDivElement, TreeDataType>;
193
+ /**
194
+ * [Legacy] Select handler is smaller than node,
195
+ * so that this will trigger when drag enter node or select handler.
196
+ * This is a little tricky if customize css without padding.
197
+ * Better for use mouse move event to refresh drag state.
198
+ * But let's just keep it to avoid event trigger logic change.
199
+ */
189
200
  onNodeDragEnter: (event: any, node: NodeInstance<TreeDataType>) => void;
190
201
  onNodeDragOver: (event: any, node: NodeInstance<TreeDataType>) => void;
191
202
  onNodeDragLeave: NodeDragEventHandler;
@@ -215,6 +226,7 @@ declare class RCTree<TreeDataType extends BasicDataNode = DataNode> extends Comp
215
226
  dropPosition: 0 | 1 | -1;
216
227
  keyEntities: Record<Key, DataEntity<TreeDataType>>;
217
228
  };
229
+ /** Set uncontrolled `expandedKeys`. This will also auto update `flattenNodes`. */
218
230
  setExpandedKeys: (expandedKeys: Key[]) => void;
219
231
  flattenTreeData: (expandedKeys: Key[]) => FlattenNode[];
220
232
  onNodeExpand: (e: any, treeNode: EventDataNode) => void;
@@ -224,6 +236,9 @@ declare class RCTree<TreeDataType extends BasicDataNode = DataNode> extends Comp
224
236
  getActiveItem: () => FlattenNode;
225
237
  offsetActiveKey: (offset: number) => void;
226
238
  onKeyDown: React.KeyboardEventHandler<HTMLDivElement>;
239
+ /**
240
+ * Only update the value which is not in props
241
+ */
227
242
  setUncontrolledState: (state: Partial<TreeState>, atomic?: boolean, forceState?: Partial<TreeState<TreeDataType>> | null) => void;
228
243
  scrollTo: ScrollTo;
229
244
  render(): React.JSX.Element;
@@ -84,25 +84,40 @@ export interface TreeProps<T> extends Omit<RcTreeProps<T>, 'prefixCls' | 'showLi
84
84
  showLeafIcon: boolean;
85
85
  };
86
86
  className?: string;
87
+ /** 是否支持多选 */
87
88
  multiple?: boolean;
89
+ /** 是否自动展开父节点 */
88
90
  autoExpandParent?: boolean;
91
+ /** Checkable状态下节点选择完全受控(父子节点选中状态不再关联) */
89
92
  checkStrictly?: boolean;
93
+ /** 是否支持选中 */
90
94
  checkable?: boolean;
95
+ /** 是否禁用树 */
91
96
  disabled?: boolean;
97
+ /** 默认展开所有树节点 */
92
98
  defaultExpandAll?: boolean;
99
+ /** 默认展开对应树节点 */
93
100
  defaultExpandParent?: boolean;
101
+ /** 默认展开指定的树节点 */
94
102
  defaultExpandedKeys?: Key[];
103
+ /** (受控)展开指定的树节点 */
95
104
  expandedKeys?: Key[];
105
+ /** (受控)选中复选框的树节点 */
96
106
  checkedKeys?: Key[] | {
97
107
  checked: Key[];
98
108
  halfChecked: Key[];
99
109
  };
110
+ /** 默认选中复选框的树节点 */
100
111
  defaultCheckedKeys?: Key[];
112
+ /** (受控)设置选中的树节点 */
101
113
  selectedKeys?: Key[];
114
+ /** 默认选中的树节点 */
102
115
  defaultSelectedKeys?: Key[];
103
116
  selectable?: boolean;
117
+ /** 点击树节点触发 */
104
118
  filterAntTreeNode?: (node: AntTreeNode) => boolean;
105
119
  loadedKeys?: Key[];
120
+ /** 设置节点可拖拽(IE>8) */
106
121
  draggable?: DraggableFn | boolean | DraggableConfig;
107
122
  style?: React.CSSProperties;
108
123
  showIcon?: boolean;
@@ -18,16 +18,23 @@ export interface TreeNodeProps<TreeDataType extends BasicDataNode = DataNode> {
18
18
  dragOverGapBottom?: boolean;
19
19
  pos?: string;
20
20
  domRef?: Ref<HTMLDivElement>;
21
+ /** New added in Tree for easy data access */
21
22
  data?: TreeDataType;
22
23
  isStart?: boolean[];
23
24
  isEnd?: boolean[];
24
25
  active?: boolean;
25
26
  onMouseMove?: React.MouseEventHandler<HTMLDivElement>;
27
+ /** 设置为叶子节点 (设置了 loadData 时有效)。为 false 时会强制将其作为父节点 */
26
28
  isLeaf?: boolean;
29
+ /** 当树为 checkable 时,设置独立节点是否展示 Checkbox */
27
30
  checkable?: boolean;
31
+ /** 设置节点是否可被选中 */
28
32
  selectable?: boolean;
33
+ /** 禁掉响应 */
29
34
  disabled?: boolean;
35
+ /** 禁掉 checkbox */
30
36
  disableCheckbox?: boolean;
37
+ /** 自定义图标。可接收组件,props 为当前节点 props */
31
38
  icon?: IconType;
32
39
  switcherIcon?: IconType;
33
40
  children?: React.ReactElement;
@@ -1,4 +1,8 @@
1
1
  import React, { Context } from 'react';
2
+ /**
3
+ * Webpack has bug for import loop, which is not the same behavior as ES module.
4
+ * When util.js imports the TreeNode for tree generate will cause treeContextTypes be empty.
5
+ */
2
6
  import { DraggableConfig } from './RCTree';
3
7
  import { BasicDataNode, DataEntity, DataNode, Direction, EventDataNode, IconType, Key, NodeInstance } from './typings';
4
8
  export type NodeMouseEventParams = {
@@ -2,6 +2,7 @@ import React, { Component } from 'react';
2
2
  import { IconName } from '../Icon';
3
3
  import { TreeNodeProps } from './TreeNode';
4
4
  export { ScrollTo } from '../VirtualList';
5
+ /** For fieldNames, we provides a abstract interface */
5
6
  export interface BasicDataNode {
6
7
  checkable?: boolean;
7
8
  disabled?: boolean;
@@ -10,6 +11,7 @@ export interface BasicDataNode {
10
11
  isLeaf?: boolean;
11
12
  selectable?: boolean;
12
13
  switcherIcon?: IconType;
14
+ /** Set style of TreeNode. This is not recommend if you don't have any force requirement */
13
15
  className?: string;
14
16
  style?: React.CSSProperties;
15
17
  }
@@ -72,6 +74,7 @@ export type GetCheckDisabled<RecordType> = (record: RecordType) => boolean;
72
74
  export type Direction = 'ltr' | 'rtl' | undefined;
73
75
  export interface FieldNames {
74
76
  title?: string;
77
+ /** @private Internal usage for `rc-tree-select`, safe to remove if no need */
75
78
  _title?: string[];
76
79
  key?: string;
77
80
  children?: string;
@@ -26,13 +26,30 @@ export declare function calcDropPosition<TreeDataType extends BasicDataNode = Da
26
26
  dragOverNodeKey: Key;
27
27
  dropAllowed: boolean;
28
28
  };
29
+ /**
30
+ * Return selectedKeys according with multiple prop
31
+ * @param selectedKeys
32
+ * @param props
33
+ * @returns [string]
34
+ */
29
35
  export declare function calcSelectedKeys(selectedKeys: Key[], props: TreeProps): Key[];
30
36
  export declare function convertDataToTree(treeData: DataNode[], processor?: {
31
37
  processProps: (prop: DataNode) => any;
32
38
  }): NodeElement[];
39
+ /**
40
+ * Parse `checkedKeys` to { checkedKeys, halfCheckedKeys } style
41
+ */
33
42
  export declare function parseCheckedKeys(keys: Key[] | {
34
43
  checked: Key[];
35
44
  halfChecked: Key[];
36
45
  }): any;
46
+ /**
47
+ * If user use `autoExpandParent` we should get the list of parent node
48
+ * @param keyList
49
+ * @param keyEntities
50
+ */
37
51
  export declare function conductExpandParent(keyList: Key[], keyEntities: Record<Key, DataEntity>): Key[];
52
+ /**
53
+ * omit prop
54
+ */
38
55
  export declare function omit<T extends object, K extends keyof T>(obj: T, fields: K[]): Omit<T, K>;