@qsxy/element-plus-react 1.0.0-next.2 → 1.0.0-next.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 (144) hide show
  1. package/README.md +29 -0
  2. package/dist/Badge/Badge.js +1 -1
  3. package/dist/Badge/typings.d.ts +10 -0
  4. package/dist/Breadcrumb/typings.d.ts +4 -0
  5. package/dist/Button/typings.d.ts +28 -0
  6. package/dist/Calendar/CalendarContext.d.ts +10 -0
  7. package/dist/Calendar/ShortCuts.d.ts +2 -0
  8. package/dist/Calendar/typings.d.ts +18 -0
  9. package/dist/Card/typings.d.ts +4 -0
  10. package/dist/Cascader/CascaderDropdown.d.ts +1 -0
  11. package/dist/Cascader/CascaderMenu.d.ts +7 -0
  12. package/dist/Cascader/typings.d.ts +80 -0
  13. package/dist/Cascader/useCascader.d.ts +72 -0
  14. package/dist/Checkbox/typings.d.ts +11 -0
  15. package/dist/CheckboxGroup/CheckboxGroup.d.ts +4 -0
  16. package/dist/CheckboxGroup/CheckboxGroupContext.d.ts +1 -0
  17. package/dist/Col/typings.d.ts +10 -0
  18. package/dist/Collapse/CollapseContext.d.ts +3 -0
  19. package/dist/Collapse/CollapseItem.js +1 -1
  20. package/dist/Collapse/typings.d.ts +7 -0
  21. package/dist/ColorPicker/AlphaSlider.d.ts +7 -0
  22. package/dist/ColorPicker/HueSlider.d.ts +7 -0
  23. package/dist/ColorPicker/Predefine.d.ts +7 -0
  24. package/dist/ColorPicker/SvPanel.d.ts +7 -0
  25. package/dist/ColorPicker/typings.d.ts +9 -0
  26. package/dist/ConfigProvider/ConfigProvider.d.ts +5 -0
  27. package/dist/DatePicker/typings.d.ts +69 -0
  28. package/dist/DateTimePicker/DateTimePicker.d.ts +1 -1
  29. package/dist/DateTimePicker/DateTimePicker.js +3 -3
  30. package/dist/DateTimePicker/typings.d.ts +1 -0
  31. package/dist/Descriptions/DescriptionsContext.d.ts +2 -0
  32. package/dist/Descriptions/typings.d.ts +13 -0
  33. package/dist/Dialog/DialogContext.d.ts +8 -0
  34. package/dist/Dialog/typings.d.ts +38 -2
  35. package/dist/Divider/Divider.d.ts +4 -0
  36. package/dist/Drawer/Drawer.js +18 -9
  37. package/dist/Drawer/DrawerContext.d.ts +10 -0
  38. package/dist/Drawer/typings.d.ts +16 -0
  39. package/dist/Dropdown/Dropdown.js +1 -1
  40. package/dist/Dropdown/DropdownContext.d.ts +2 -0
  41. package/dist/Dropdown/typings.d.ts +16 -1
  42. package/dist/Form/FormItem.d.ts +12 -0
  43. package/dist/Form/typings.d.ts +55 -0
  44. package/dist/Form/useForm.d.ts +22 -0
  45. package/dist/Form/utils/NameMap.d.ts +3 -0
  46. package/dist/Form/utils/validateUtil.d.ts +4 -0
  47. package/dist/Form/utils/valueUtil.d.ts +17 -0
  48. package/dist/Icon/typings.d.ts +7 -0
  49. package/dist/Input/Input.js +2 -1
  50. package/dist/Input/typings.d.ts +61 -0
  51. package/dist/InputNumber/typings.d.ts +21 -0
  52. package/dist/Link/typings.d.ts +6 -1
  53. package/dist/Loading/typings.d.ts +5 -0
  54. package/dist/Message/Main.d.ts +7 -0
  55. package/dist/Message/index.d.ts +8 -0
  56. package/dist/Message/typings.d.ts +11 -0
  57. package/dist/MessageBox/index.d.ts +14 -0
  58. package/dist/MessageBox/typings.d.ts +50 -0
  59. package/dist/Notification/Main.d.ts +7 -0
  60. package/dist/Notification/index.d.ts +15 -0
  61. package/dist/Notification/typings.d.ts +13 -0
  62. package/dist/Pagination/typings.d.ts +28 -0
  63. package/dist/Popconfirm/Popconfirm.js +1 -1
  64. package/dist/Popconfirm/typings.d.ts +12 -1
  65. package/dist/Popover/Popover.js +1 -1
  66. package/dist/Popover/typings.d.ts +13 -1
  67. package/dist/Popper/typings.d.ts +7 -1
  68. package/dist/Progress/typings.d.ts +12 -0
  69. package/dist/Radio/typings.d.ts +7 -0
  70. package/dist/RadioGroup/typings.d.ts +1 -0
  71. package/dist/Row/RowContext.d.ts +1 -0
  72. package/dist/Row/typings.d.ts +4 -0
  73. package/dist/Scrollbar/typings.d.ts +20 -0
  74. package/dist/Select/typings.d.ts +33 -0
  75. package/dist/Skeleton/PlaceholderGraph.d.ts +4 -0
  76. package/dist/Skeleton/PlaceholderGrid.d.ts +4 -0
  77. package/dist/Skeleton/PlaceholderParagraph.d.ts +4 -0
  78. package/dist/Switch/typings.d.ts +15 -0
  79. package/dist/Table/Colgroup.d.ts +1 -0
  80. package/dist/Table/TableContext.d.ts +8 -0
  81. package/dist/Table/hooks/useSelection.d.ts +18 -1
  82. package/dist/Table/hooks/useTable.d.ts +7 -0
  83. package/dist/Table/treeUtil.d.ts +39 -0
  84. package/dist/Table/typings.d.ts +137 -1
  85. package/dist/Table/util.d.ts +10 -0
  86. package/dist/Table/util.js +1 -1
  87. package/dist/Tabs/Tabs.js +1 -1
  88. package/dist/Tabs/typings.d.ts +38 -0
  89. package/dist/Tag/Tag.d.ts +1 -1
  90. package/dist/Tag/Tag.js +18 -26
  91. package/dist/Tag/typings.d.ts +10 -0
  92. package/dist/TimeLine/typings.d.ts +9 -0
  93. package/dist/TimePicker/TimePicker.js +1 -0
  94. package/dist/TimePicker/TimeSpinnerPanel.js +2 -1
  95. package/dist/TimePicker/typings.d.ts +13 -0
  96. package/dist/TimePicker/useTimePicker.d.ts +7 -0
  97. package/dist/Tooltip/Tooltip.js +8 -19
  98. package/dist/Tooltip/TooltipContext.d.ts +1 -0
  99. package/dist/Tooltip/typings.d.ts +14 -1
  100. package/dist/Transfer/ListItem.d.ts +1 -0
  101. package/dist/Transfer/typings/index.d.ts +27 -0
  102. package/dist/Transfer/typings/list.d.ts +25 -0
  103. package/dist/Transfer/typings/listBody.d.ts +1 -0
  104. package/dist/Transition/Transition.d.ts +10 -0
  105. package/dist/Transition/TransitionGroup.d.ts +59 -0
  106. package/dist/Transition/childMapping.d.ts +23 -0
  107. package/dist/Tree/NodeList.d.ts +3 -0
  108. package/dist/Tree/RCTree.d.ts +15 -0
  109. package/dist/Tree/Tree.d.ts +15 -0
  110. package/dist/Tree/TreeNode.d.ts +7 -0
  111. package/dist/Tree/contextTypes.d.ts +4 -0
  112. package/dist/Tree/typings.d.ts +3 -0
  113. package/dist/Tree/util.d.ts +17 -0
  114. package/dist/Tree/utils/KeyCode.d.ts +326 -0
  115. package/dist/Tree/utils/conductUtil.d.ts +6 -0
  116. package/dist/Tree/utils/dictUtil.d.ts +1 -0
  117. package/dist/Tree/utils/pickAttrs.d.ts +5 -0
  118. package/dist/Tree/utils/treeUtil.d.ts +25 -1
  119. package/dist/TreeSelect/Utils.d.ts +1 -0
  120. package/dist/TreeSelect/typings.d.ts +19 -0
  121. package/dist/Upload/typings.d.ts +34 -0
  122. package/dist/Upload/use-handlers.d.ts +1 -0
  123. package/dist/Util/Math.d.ts +34 -0
  124. package/dist/Util/base.d.ts +21 -0
  125. package/dist/Util/shallowEqual.d.ts +11 -0
  126. package/dist/Util/treeUtils.d.ts +8 -0
  127. package/dist/VirtualList/Filler.d.ts +5 -0
  128. package/dist/VirtualList/VirtualList.d.ts +3 -0
  129. package/dist/VirtualList/hooks/useLayoutEffect.d.ts +3 -0
  130. package/dist/VirtualList/utils/algorithmUtil.d.ts +17 -0
  131. package/dist/VirtualList/utils/findDOMNode.d.ts +3 -0
  132. package/dist/hooks/animationPropsUtils.d.ts +12 -0
  133. package/dist/hooks/htmlPropsUtils.d.ts +8 -0
  134. package/dist/hooks/popperPropsUtils.d.ts +12 -0
  135. package/dist/hooks/treePropsUtils.d.ts +12 -0
  136. package/dist/hooks/useChildrenInstance.d.ts +11 -0
  137. package/dist/hooks/useClassNames.d.ts +78 -0
  138. package/dist/hooks/useControlled.d.ts +8 -0
  139. package/dist/hooks/useForceUpdate.d.ts +1 -0
  140. package/dist/index.d.ts +1 -0
  141. package/dist/theme-chalk/link/index.scss +0 -85
  142. package/dist/types/common.d.ts +24 -0
  143. package/dist/types/type.d.ts +5 -0
  144. package/package.json +1 -1
package/dist/Tag/Tag.js CHANGED
@@ -33,21 +33,16 @@ __export(Tag_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(Tag_exports);
35
35
  var import_classnames = __toESM(require("classnames"));
36
+ var import_ref = require("rc-util/lib/ref");
36
37
  var import_react = __toESM(require("react"));
37
38
  var import_Icon = require("../Icon");
38
39
  var import_Transition = require("../Transition");
39
- var import_Util = require("../Util");
40
40
  var import_hooks = require("../hooks");
41
41
  var Tag = (0, import_react.forwardRef)((props, ref) => {
42
- props = (0, import_Util.mergeDefaultProps)(
43
- {
44
- type: "primary",
45
- theme: "light"
46
- },
47
- props
48
- );
49
- const { type, closable, size, color, theme, round, hit, classPrefix = "tag", className, style, onClick, onClose, disableTransitions } = props;
42
+ const { type = "primary", closable, size, color, theme = "light", round, hit, classPrefix = "tag", className, style, onClick, onClose, disableTransitions } = props;
50
43
  const { b, m, e, is } = (0, import_hooks.useClassNames)(classPrefix);
44
+ const containerRef = (0, import_react.useRef)(null);
45
+ const mergedRef = (0, import_ref.useComposeRef)(ref, containerRef);
51
46
  const onClickTag = (0, import_react.useCallback)(
52
47
  (event) => {
53
48
  event == null ? void 0 : event.stopPropagation();
@@ -62,22 +57,19 @@ var Tag = (0, import_react.forwardRef)((props, ref) => {
62
57
  },
63
58
  [onClose]
64
59
  );
65
- return (
66
- // @ts-ignore
67
- /* @__PURE__ */ import_react.default.createElement(import_Transition.Transition, { nodeRef: ref, name: disableTransitions ? "" : "r-zoom-in-center", visible: true, display: "", transitionAppear: true, unmountOnExit: true, duration: 200 }, /* @__PURE__ */ import_react.default.createElement(
68
- "span",
69
- {
70
- ref,
71
- className: (0, import_classnames.default)(b(), m(type, theme, { [size]: size }), is({ round, hit }), className),
72
- style: { background: color, ...style },
73
- onClick: onClickTag,
74
- onMouseEnter: props.onMouseEnter,
75
- onMouseLeave: props.onMouseLeave
76
- },
77
- /* @__PURE__ */ import_react.default.createElement("span", { className: e`content` }, props.children),
78
- closable && /* @__PURE__ */ import_react.default.createElement(import_Icon.Icon, { name: "xmark", className: e`close`, onClick: onCloseTag })
79
- ))
80
- );
60
+ return /* @__PURE__ */ import_react.default.createElement(import_Transition.Transition, { nodeRef: containerRef, name: disableTransitions ? "" : b("zoom-in-center", false), visible: true, display: "", transitionAppear: true, unmountOnExit: true, duration: 200 }, /* @__PURE__ */ import_react.default.createElement(
61
+ "span",
62
+ {
63
+ ref: mergedRef,
64
+ className: (0, import_classnames.default)(b(), m(type, theme, { [size]: size }), is({ round, hit }), className),
65
+ style: { background: color, ...style },
66
+ onClick: onClickTag,
67
+ onMouseEnter: props.onMouseEnter,
68
+ onMouseLeave: props.onMouseLeave
69
+ },
70
+ /* @__PURE__ */ import_react.default.createElement("span", { className: e`content` }, props.children),
71
+ closable && /* @__PURE__ */ import_react.default.createElement(import_Icon.Icon, { name: "xmark", className: e`close`, onClick: onCloseTag })
72
+ ));
81
73
  });
82
- Tag.displayName = "Tag";
74
+ Tag.displayName = "ElTag";
83
75
  var Tag_default = Tag;
@@ -1,14 +1,24 @@
1
1
  import React from 'react';
2
2
  import { BaseProps, NativeProps, TooltipBaseProps, TypeAttributes } from '../types/common';
3
3
  export interface TagProps extends Omit<TooltipBaseProps<HTMLSpanElement>, 'onClick'>, BaseProps, NativeProps {
4
+ /** 类型 */
4
5
  type?: TypeAttributes.Appearance;
6
+ /** 是否可关闭 */
5
7
  closable?: boolean;
8
+ /** 是否禁用渐变动画 */
6
9
  disableTransitions?: boolean;
10
+ /** 是否有边框描边 */
7
11
  hit?: boolean;
12
+ /** Tag 是否为圆形 */
8
13
  round?: boolean;
14
+ /** 背景色 */
9
15
  color?: string;
16
+ /** 尺寸 */
10
17
  size?: TypeAttributes.Size;
18
+ /** 主题 */
11
19
  theme?: 'dark' | 'light' | 'plain';
20
+ /** 点击 Tag 时触发的事件 */
12
21
  onClick?: (e?: React.MouseEvent<HTMLSpanElement>) => void;
22
+ /** 关闭 Tag 时触发的事件 */
13
23
  onClose?: (e?: React.MouseEvent<HTMLSpanElement>) => void;
14
24
  }
@@ -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
  };
@@ -199,6 +199,7 @@ var TimePicker = (0, import_react.forwardRef)((props, ref) => {
199
199
  setVisible(false);
200
200
  setValue(initialValue.current);
201
201
  },
202
+ onEnter: () => timePanelRef.current.adjustSpinners(),
202
203
  ...animationInputProps,
203
204
  transitionAppear: true,
204
205
  unmountOnExit: true
@@ -186,8 +186,9 @@ var TimeSpinnerPanel = (0, import_react.memo)(
186
186
  ),
187
187
  type === "hours" ? 23 : 59
188
188
  );
189
- debouncedResetScroll(type);
190
189
  modifyDateField(type, value);
190
+ debouncedResetScroll(type);
191
+ isScrolling.current = false;
191
192
  },
192
193
  [debouncedResetScroll, listRefsMap, modifyDateField, scrollBarHeight, typeItemHeight]
193
194
  );
@@ -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;