@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
@@ -1,38 +1,64 @@
1
1
  import React from 'react';
2
2
  import { BaseProps, NativeProps } from '../types/common';
3
3
  export interface UploadBaseProps {
4
+ /** 请求 URL */
4
5
  action: string;
6
+ /** 设置上传的请求头部 */
5
7
  headers?: Headers | Record<string, any>;
8
+ /** 设置上传请求方法 */
6
9
  method?: 'post' | 'get';
10
+ /** 是否支持多选文件 */
7
11
  multiple?: boolean;
12
+ /** 上传时附带的额外参数 */
8
13
  data?: Record<string, any> | ((rawFile: UploadRawFile) => Promise<Record<string, any>>) | ((rawFile: UploadRawFile) => Record<string, any>);
14
+ /** 上传的文件字段名 */
9
15
  name?: string;
16
+ /** 是否启用拖拽上传 */
10
17
  drag?: boolean;
18
+ /** 支持发送 cookie 凭证信息 */
11
19
  withCredentials?: boolean;
20
+ /** 是否显示已上传文件列表 */
12
21
  showFileList?: boolean;
22
+ /** 接受上传的文件类型 */
13
23
  accept?: string;
14
24
  type?: string;
25
+ /** 默认上传文件 */
15
26
  fileList?: UploadUserFile[];
27
+ /** 文件列表的类型 */
16
28
  listType?: 'text' | 'picture' | 'picture-card';
29
+ /** 是否自动上传文件 */
17
30
  autoUpload?: boolean;
31
+ /** 覆盖默认的 Xhr 行为,允许自行实现上传文件的请求 */
18
32
  httpRequest?: (options: UploadRequestOptions) => XMLHttpRequest | Promise<unknown>;
33
+ /** 是否禁用上传 */
19
34
  disabled?: boolean;
35
+ /** 允许上传文件的最大数量 */
20
36
  limit?: number;
21
37
  }
22
38
  export interface UploadHooks {
39
+ /** 上传文件之前的钩子,参数为上传的文件, 若返回false或者返回 Promise 且被 reject,则停止上传。 */
23
40
  beforeUpload?: (rawFile: UploadRawFile) => Awaitable<void | undefined | null | boolean | File | Blob>;
41
+ /** 删除文件之前的钩子,参数为上传的文件和文件列表, 若返回 false 或者返回 Promise 且被 reject,则停止删除。 */
24
42
  beforeRemove?: (uploadFile: UploadFile, uploadFiles: UploadFiles) => Awaitable<boolean>;
43
+ /** 文件列表移除文件时的钩子 */
25
44
  onRemove?: (uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
45
+ /** 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用 */
26
46
  onChange?: (uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
47
+ /** 点击文件列表中已上传的文件时的钩子 */
27
48
  onPreview?: (uploadFile: UploadFile) => void;
49
+ /** 文件上传成功时的钩子 */
28
50
  onSuccess?: (response: any, uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
51
+ /** 文件上传时的钩子 */
29
52
  onProgress?: (evt: UploadProgressEvent, uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
53
+ /** 文件上传失败时的钩子 */
30
54
  onError?: (error: Error, uploadFile: UploadFile, uploadFiles: UploadFiles) => void;
55
+ /** 当超出限制时,执行的钩子函数 */
31
56
  onExceed?: (files: File[], uploadFiles: UploadUserFile[]) => void;
32
57
  }
33
58
  export interface UploadContentProps extends UploadBaseProps, BaseProps {
34
59
  beforeUpload?: UploadHooks['beforeUpload'];
35
60
  onRemove?: (file: UploadFile | UploadRawFile) => void;
61
+ /** 手动选择文件 */
36
62
  onStart?: (rawFile: UploadRawFile) => void;
37
63
  onSuccess?: (response: any, rawFile: UploadRawFile) => unknown;
38
64
  onProgress?: (evt: UploadProgressEvent, rawFile: UploadRawFile) => void;
@@ -44,15 +70,23 @@ export interface UploadContentRef {
44
70
  upload: (rawFile: UploadRawFile) => Promise<void>;
45
71
  }
46
72
  export interface UploadRef {
73
+ /** 取消上传请求 */
47
74
  abort: (file?: UploadFile) => void;
75
+ /** 手动上传文件列表 */
48
76
  submit: () => void;
77
+ /** 清空已上传的文件列表(该方法不支持在 before-upload 中调用) */
49
78
  clearFiles: (status?: Array<'ready' | 'uploading' | 'success' | 'fail'>) => void;
79
+ /** 手动选择文件 */
50
80
  handleStart: (rawFile: UploadRawFile) => void;
81
+ /** 手动移除文件。 file 和rawFile 已被合并。 rawFile 将在 v2.2.0 中移除 */
51
82
  handleRemove: (file: UploadFile | UploadRawFile) => void;
52
83
  }
53
84
  export interface UploadProps extends UploadBaseProps, UploadHooks, BaseProps, NativeProps {
85
+ /** 缩略图模板的内容 */
54
86
  formatter?: (file: UploadFile) => React.ReactElement;
87
+ /** 触发文件选择框的内容 */
55
88
  trigger?: React.ReactElement;
89
+ /** 提示说明文字 */
56
90
  tip?: React.ReactElement;
57
91
  }
58
92
  export interface UploadListProps {
@@ -3,6 +3,7 @@ import { UploadContentRef, UploadFile, UploadFiles, UploadProps, UploadRawFile,
3
3
  export declare const useHandlers: (props: Omit<UploadProps, 'fileList'> & {
4
4
  fileList: UploadFiles;
5
5
  }, uploadRef: RefObject<UploadContentRef | undefined>) => {
6
+ /** @description two-way binding ref from props `fileList` */
6
7
  uploadFiles: UploadFiles;
7
8
  setUploadFiles: (value: UploadFiles) => void;
8
9
  abort: (file: UploadFile) => void;
@@ -1,5 +1,39 @@
1
+ /**
2
+ * 乘法 - js运算精度丢失问题
3
+ * @param arg1 数1
4
+ * @param arg2 数2
5
+ * 0.0023 * 100 ==> 0.22999999999999998
6
+ * {{ 0.0023 | multiply(100) }} ==> 0.23
7
+ */
1
8
  export declare function floatMultiply(arg1: number | string, arg2: number | string): number;
9
+ /**
10
+ * 除法 - js运算精度丢失问题
11
+ * @param arg1 数1
12
+ * @param arg2 数2
13
+ * 0.0023 / 0.00001 ==> 229.99999999999997
14
+ * {{ 0.0023 | divide(0.00001) }} ==> 230
15
+ */
2
16
  export declare function floatDivide(arg1: number | string, arg2: number | string): number;
17
+ /**
18
+ * 加法 - js运算精度丢失问题
19
+ * @param arg1 数1
20
+ * @param arg2 数2
21
+ * 0.0023 + 0.00000000000001 ==> 0.0023000000000099998
22
+ * {{ 0.0023 | plus(0.00000000000001) }} ==> 0.00230000000001
23
+ */
3
24
  export declare function floatAdd(arg1: string | number, arg2: string | number): number;
25
+ /**
26
+ * 减法 - js运算精度丢失问题
27
+ * @param arg1 数1
28
+ * @param arg2 数2
29
+ * 0.0023 - 0.00000011 ==> 0.0022998899999999997
30
+ * {{ 0.0023 | minus( 0.00000011 ) }} ==> 0.00229989
31
+ */
4
32
  export declare function floatSub(arg1: string | number, arg2: string | number): number;
33
+ /**
34
+ * 格式化数字,带精度
35
+ * @param value 数字
36
+ * @param precision 精度
37
+ * @returns
38
+ */
5
39
  export declare const formatNumber: (value: number, precision: number) => string;
@@ -1,8 +1,29 @@
1
+ /**
2
+ * 判断对象是否为空
3
+ * @param {Object} val 被判断的对象
4
+ * @returns {Boolean} 返回true或false
5
+ */
1
6
  export declare function isEmpty(val: any): boolean;
7
+ /**
8
+ * 判断对象是否不为空
9
+ * @param {Object} val 被判断的对象
10
+ * @returns {Boolean} 返回true或false
11
+ */
2
12
  export declare function isNotEmpty(val: any): boolean;
13
+ /**
14
+ * 随机序列,包含数字和字母
15
+ * @param {Number} n 序列的个数
16
+ * @returns {String} 返回序列
17
+ */
3
18
  export declare function randomCode(n: number): string;
4
19
  export declare function getScrollWidth(elem: HTMLElement): number;
5
20
  export declare function warning(valid: boolean, message: string): void;
21
+ /**
22
+ * 创建隐形表单下载方法
23
+ * @param url 下载地址
24
+ * @param params 参数列表
25
+ * @param pther method:请求方式,target:是否新窗口
26
+ */
6
27
  export declare const download: (url: string, params: {
7
28
  name: string;
8
29
  value: string;
@@ -1,2 +1,13 @@
1
+ /**
2
+ * From: https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/shallowEqual.js
3
+ * @providesModule shallowEqual
4
+ * @typechecks
5
+ * @flow
6
+ */
7
+ /**
8
+ * Performs equality by iterating through keys on an object and returning false
9
+ * when any key has values which are not strictly equal between the arguments.
10
+ * Returns true when the values of all keys are strictly equal.
11
+ */
1
12
  declare function shallowEqual(objA: any, objB: any): boolean;
2
13
  export default shallowEqual;
@@ -3,5 +3,13 @@ interface FieldNames {
3
3
  parentIdKey?: string;
4
4
  childrenKey?: string;
5
5
  }
6
+ /**
7
+ * 非递归实现
8
+ * 每一项都有parentId,根元素
9
+ * @param list
10
+ * @param rootId 根元素id
11
+ * @param param2 可配晋参数
12
+ * @returns
13
+ */
6
14
  export declare const generateTree: <T>(list: T[], rootId: string | number, { idKey, parentIdKey, childrenKey }?: FieldNames) => T[];
7
15
  export {};
@@ -2,10 +2,15 @@ import React from 'react';
2
2
  import { ComponentChildren } from '../types/common';
3
3
  interface FillerProps {
4
4
  prefixCls?: string;
5
+ /** Virtual filler height. Should be `count * itemMinHeight` */
5
6
  height: number;
7
+ /** Set offset of visible items. Should be the top of start item position */
6
8
  offset?: number;
7
9
  children: ComponentChildren;
8
10
  onInnerResize?: () => void;
9
11
  }
12
+ /**
13
+ * Fill component to provided the scroll content real height.
14
+ */
10
15
  declare const Filler: React.ForwardRefExoticComponent<FillerProps & React.RefAttributes<HTMLDivElement>>;
11
16
  export default Filler;
@@ -21,11 +21,14 @@ export interface ListProps<T = any> extends Omit<React.AllHTMLAttributes<any>, '
21
21
  height?: number;
22
22
  itemHeight?: number;
23
23
  style?: React.CSSProperties;
24
+ /** If not match virtual scroll condition, Set List still use height of container. */
24
25
  fullHeight?: boolean;
25
26
  itemKey: Key | ((item: T) => Key);
26
27
  component?: string | FC<any> | ComponentClass<any>;
28
+ /** Set `false` will always use real scroll instead of virtual one */
27
29
  virtual?: boolean;
28
30
  onScroll?: React.UIEventHandler<HTMLElement>;
31
+ /** Trigger when render list item changed */
29
32
  onVisibleChange?: (visibleList: T[], fullList: T[]) => void;
30
33
  }
31
34
  export declare function RawList<T>(props: ListProps<T>, ref: Ref<ListRef>): React.JSX.Element;
@@ -1,3 +1,6 @@
1
1
  import { useEffect } from 'react';
2
+ /**
3
+ * Wrap `useLayoutEffect` which will not throw warning message in test env
4
+ */
2
5
  declare const useLayoutEffect: typeof useEffect;
3
6
  export default useLayoutEffect;
@@ -1,5 +1,22 @@
1
1
  import { Key } from 'react';
2
+ /**
3
+ * Get index with specific start index one by one. e.g.
4
+ * min: 3, max: 9, start: 6
5
+ *
6
+ * Return index is:
7
+ * [0]: 6
8
+ * [1]: 7
9
+ * [2]: 5
10
+ * [3]: 8
11
+ * [4]: 4
12
+ * [5]: 9
13
+ * [6]: 3
14
+ */
2
15
  export declare function getIndexByStartLoc(min: number, max: number, start: number, index: number): number;
16
+ /**
17
+ * We assume that 2 list has only 1 item diff and others keeping the order.
18
+ * So we can use dichotomy algorithm to find changed one.
19
+ */
3
20
  export declare function findListDiffIndex<T>(originList: T[], targetList: T[], getKey: (item: T) => Key): {
4
21
  index: number;
5
22
  multiple: boolean;
@@ -1,2 +1,5 @@
1
1
  import React from 'react';
2
+ /**
3
+ * Return if a node is a DOM node. Else will return by `findDOMNode`
4
+ */
2
5
  export default function findDOMNode<T = Element | Text>(node: React.ReactElement | HTMLElement): T;
@@ -1,3 +1,15 @@
1
1
  import { TransitionProps } from '../Transition';
2
2
  export declare const animationAllProps: string[];
3
+ /**
4
+ * Returns an array of objects consisting of: props of html input element and rest.
5
+ * @author Parker
6
+ * @CreateTime 2022/4/8 17:46:40
7
+ * @LastEditor Parker
8
+ * @ModifyTime 2022/4/22 15:38:45
9
+ * @param {object} props A ReactElement props object
10
+ * @param {Object} [options={}]
11
+ * @param {Array} [options.htmlProps] An array of html input props
12
+ * @param {boolean} [options.includeAria] Includes all input props that starts with "aria-"
13
+ * @returns {[{}, {}]} An array of objects
14
+ */
3
15
  export declare const partitionAnimationProps: (props: any, options?: any) => [TransitionProps, any];
@@ -2,4 +2,12 @@ import React from 'react';
2
2
  export declare const htmlInputAttrs: string[];
3
3
  export declare const htmlInputEvents: string[];
4
4
  export declare const htmlInputProps: string[];
5
+ /**
6
+ * Returns an array of objects consisting of: props of html input element and rest.
7
+ * @param {object} props A ReactElement props object
8
+ * @param {Object} [options={}]
9
+ * @param {Array} [options.htmlProps] An array of html input props
10
+ * @param {boolean} [options.includeAria] Includes all input props that starts with "aria-"
11
+ * @returns {[{}, {}]} An array of objects
12
+ */
5
13
  export declare const partitionHTMLProps: (props: any, options?: any) => [React.AllHTMLAttributes<any>, any];
@@ -1,3 +1,15 @@
1
1
  import { PopperProps } from '../Popper';
2
2
  export declare const popperAllProps: string[];
3
+ /**
4
+ * Returns an array of objects consisting of: props of html input element and rest.
5
+ * @author Parker
6
+ * @CreateTime 2022/4/8 17:46:40
7
+ * @LastEditor Parker
8
+ * @ModifyTime 2025/2/22 11:48:08
9
+ * @param {object} props A ReactElement props object
10
+ * @param {Object} [options={}]
11
+ * @param {Array} [options.htmlProps] An array of html input props
12
+ * @param {boolean} [options.includeAria] Includes all input props that starts with "aria-"
13
+ * @returns {[{}, {}]} An array of objects
14
+ */
3
15
  export declare const partitionPopperPropsUtils: (props: any, options?: any) => [Partial<PopperProps>, any];
@@ -1,3 +1,15 @@
1
1
  import { DirectoryTreeProps } from '../Tree';
2
2
  export declare const treeAllProps: string[];
3
+ /**
4
+ * Returns an array of objects consisting of: props of html input element and rest.
5
+ * @author Parker
6
+ * @CreateTime 2022/4/8 17:46:40
7
+ * @LastEditor Parker
8
+ * @ModifyTime 2022/4/21 10:06:19
9
+ * @param {object} props A ReactElement props object
10
+ * @param {Object} [options={}]
11
+ * @param {Array} [options.htmlProps] An array of html input props
12
+ * @param {boolean} [options.includeAria] Includes all input props that starts with "aria-"
13
+ * @returns {[{}, {}]} An array of objects
14
+ */
3
15
  export declare const partitionTreePropsUtils: (props: any, options?: any) => [DirectoryTreeProps<any>, any];
@@ -1,4 +1,15 @@
1
1
  import React from 'react';
2
2
  import { ComponentChildren } from '../types/common';
3
+ /**
4
+ * 获取特定名称的子组件
5
+ * @author Parker
6
+ * @CreateTime 2022/3/30下午2:08:36
7
+ * @LastEditor Parker
8
+ * @ModifyTime 2022/9/23 14:44:20
9
+ * @param componentChildren 子组件
10
+ * @param compName 目标组件名称 (`displayName`属性)
11
+ * @param virtualCompName 子组件中的需要继续乡下递归查找的组件名称(`displayName`属性)
12
+ * @returns 返回获取组件的函数以供随时调用
13
+ */
3
14
  declare function useChildrenInstance<T, S = T>(compName: string | string[], ...virtualCompName: string[]): (componentChildren: ComponentChildren) => React.ReactElement<S>[];
4
15
  export default useChildrenInstance;
@@ -14,16 +14,94 @@ export type ClassNameM = {
14
14
  ebm: (sub: string, prefix: string, modifier: string, compName?: boolean) => string;
15
15
  is: (...classes: ClassValue[]) => string;
16
16
  };
17
+ /**
18
+ * Add a prefix to all classNames.
19
+ *
20
+ * @param str prefix of className
21
+ * @returns { wb, merge, prefix }
22
+ * - wb: A function of combining className and adding a prefix to each className.
23
+ * At the same time, the default `classPrefix` is the first className.
24
+ * - merge: A merge className function.
25
+ * - prefix: Add a prefix to className
26
+ */
17
27
  declare function useClassNames(str: string, classPrefix?: string): {
28
+ /**
29
+ * 如果组件前缀是'button':
30
+ *
31
+ * wb('red', { active: true }) => 'el-button el-button-red el-button-active'
32
+ *
33
+ * wb('red', { active: true }, false) => 'el-button el-red el-active'
34
+ */
18
35
  wb: (...classes: ClassValue[]) => string;
36
+ /**
37
+ * 如果组件前缀是'button':
38
+ *
39
+ * b('red', { active: true }) => 'el-button-red el-button-active'
40
+ *
41
+ * b('red', { active: true }, false) => 'el-red el-active'
42
+ */
19
43
  b: (...classes: ClassValue[]) => string;
44
+ /**
45
+ * 如果组件前缀是'button':
46
+ *
47
+ * e('red', { active: true }) => 'el-button__red el-button__active'
48
+ *
49
+ * e('red', { active: true }, false) => 'r__red r__active'
50
+ */
20
51
  e: (...classes: ClassValue[]) => string;
52
+ /**
53
+ * 如果组件前缀是'button':
54
+ *
55
+ * m('red', { active: true }) => 'el-button--red el-button--active'
56
+ *
57
+ * m('red', { active: true }, false) => 'el--red el--active'
58
+ */
21
59
  m: (...classes: ClassValue[]) => string;
60
+ /**
61
+ * 如果组件前缀是'button':
62
+ *
63
+ * be('red', 'active') => 'el-button-red__active'
64
+ *
65
+ * be('red', 'active', false) => 'el-red__active'
66
+ */
22
67
  be: (prefix: string, sub: string, compName?: boolean) => string;
68
+ /**
69
+ * 如果组件前缀是'button':
70
+ *
71
+ * em( 'color", 'active') => 'el-button__color--active'
72
+ *
73
+ * em( 'color", 'active', false) => 'r__color--active'
74
+ */
23
75
  em: (sub: string, modifier: string, compName?: boolean) => string;
76
+ /**
77
+ * 如果组件前缀是'button':
78
+ *
79
+ * be( 'color", 'active') => 'el-button-color--active'
80
+ *
81
+ * be( 'color", 'active', false) => 'el-color--active'
82
+ */
24
83
  bm: (prefix: string, modifier: string, compName?: boolean) => string;
84
+ /**
85
+ * 如果组件前缀是'button':
86
+ *
87
+ * bem('red', 'color", 'active') => 'el-button-red__color--active'
88
+ *
89
+ * bem('red', 'color", 'active', false) => 'el-red__color--active'
90
+ */
25
91
  bem: (prefix: string, sub: string, modifier: string, compName?: boolean) => string;
92
+ /**
93
+ * 如果组件前缀是'button':
94
+ *
95
+ * ebm('close', 'icon", 'hidden') => 'el-button__close-icon--hidden'
96
+ *
97
+ * ebm('close', 'icon", 'hidden', false) => 'r__close-icon--hidden'
98
+ */
26
99
  ebm: (sub: string, prefix: string, modifier: string, compName?: boolean) => string;
100
+ /**
101
+ * 如果组件前缀是'button':
102
+ *
103
+ * is('block', { block: true }) => 'is-block'
104
+ */
27
105
  is: (...classes: ClassValue[]) => string;
28
106
  };
29
107
  export default useClassNames;
@@ -1,2 +1,10 @@
1
+ /**
2
+ * A hook for controlled value management.
3
+ * In the case of passing the controlled value, the controlled value is returned, otherwise the value in state is returned.
4
+ * Generally used for a component including controlled and uncontrolled modes.
5
+ * @param controlledValue
6
+ * @param defaultValue
7
+ * @param formatValue
8
+ */
1
9
  declare function useControlled<T>(controlledValue: T, defaultValue?: T): [T, (value: T) => void, boolean];
2
10
  export default useControlled;
@@ -1,3 +1,4 @@
1
+ /** 强制刷新 */
1
2
  export declare const useForceUpdate: () => {
2
3
  forceUpdate: () => void;
3
4
  };
package/dist/index.d.ts CHANGED
@@ -106,5 +106,6 @@ export type { DividerProps } from './Divider';
106
106
  export { PopupManager, download, genFileId, generateTree, getScrollWidth, isEmpty, isNotEmpty, randomCode } from './Util';
107
107
  export * from './hooks';
108
108
  export type { AnimationEventProps, BaseProps, FormControlBaseProps, NativeProps, StandardProps, TooltipBaseProps, TypeAttributes } from './types/common';
109
+ /** 全局配置 */
109
110
  export { ConfigProvider } from './ConfigProvider';
110
111
  export type { ConfigProviderProps } from './ConfigProvider';
@@ -1,88 +1,3 @@
1
- // @use 'sass:map';
2
-
3
- // @use '../../Common/styles/mixins/mixins' as *;
4
- // @use '../../Common/styles/mixins/var' as *;
5
- // @use '../../Common/styles/mixins/utils' as *;
6
- // @use '../../Common/styles/common/var' as *;
7
-
8
- // @include b(link) {
9
- // @include set-component-css-var('link', $link);
10
- // }
11
-
12
- // @include b(link) {
13
- // display: inline-flex;
14
- // flex-direction: row;
15
- // align-items: center;
16
- // justify-content: center;
17
- // vertical-align: middle;
18
- // position: relative;
19
- // text-decoration: none;
20
- // outline: none;
21
- // cursor: pointer;
22
- // padding: 0;
23
- // font-size: getCssVar('link', 'font-size');
24
- // font-weight: getCssVar('link', 'font-weight');
25
-
26
- // color: getCssVar('link', 'text-color');
27
-
28
- // &:hover {
29
- // color: getCssVar('link', 'hover-text-color');
30
- // }
31
-
32
- // @include when(underline) {
33
- // &:hover:after {
34
- // content: '';
35
- // position: absolute;
36
- // left: 0;
37
- // right: 0;
38
- // height: 0;
39
- // bottom: 0;
40
- // border-bottom: 1px solid getCssVar('link', 'hover-text-color');
41
- // }
42
- // }
43
-
44
- // @include when(disabled) {
45
- // color: getCssVar('link', 'disabled-text-color');
46
- // cursor: not-allowed;
47
- // }
48
-
49
- // & [class*='#{$namespace}-icon-'] {
50
- // & + span {
51
- // margin-left: 5px;
52
- // }
53
- // }
54
-
55
- // &.#{$namespace}-link--default {
56
- // &:after {
57
- // border-color: getCssVar('link', 'hover-text-color');
58
- // }
59
- // }
60
-
61
- // @include e(inner) {
62
- // display: inline-flex;
63
- // justify-content: center;
64
- // align-items: center;
65
- // }
66
-
67
- // @each $type in $types {
68
- // &.#{$namespace}-link--#{$type} {
69
- // @include css-var-from-global(('link', 'text-color'), ('color', $type));
70
- // @include css-var-from-global(('link', 'hover-text-color'), ('color', $type, 'light-3'));
71
- // @include css-var-from-global(('link', 'disabled-text-color'), ('color', $type, 'light-5'));
72
-
73
- // &:after {
74
- // border-color: getCssVar('link', 'text-color');
75
- // }
76
-
77
- // @include when(underline) {
78
- // &:hover:after {
79
- // border-color: getCssVar('link', 'text-color');
80
- // }
81
- // }
82
- // }
83
- // }
84
- // }
85
-
86
1
  @use '../common/var';
87
2
  .#{$namespace}-link {
88
3
  --#{$namespace}-link-font-size: 14px;
@@ -12,29 +12,49 @@ export declare namespace TypeAttributes {
12
12
  export type ComponentChildren = React.ReactNode | React.ReactNode[];
13
13
  export interface FormControlBaseProps<ValueType = React.AllHTMLAttributes<HTMLInputElement>['value']> {
14
14
  name?: string;
15
+ /** 初始值 */
15
16
  defaultValue?: ValueType;
17
+ /** 值(可控) */
16
18
  value?: ValueType;
19
+ /** 选中值发生变化时触发 */
17
20
  onChange?: (value: ValueType | boolean, event?: React.ChangeEvent<any>) => void;
21
+ /** 禁用 */
18
22
  disabled?: boolean;
23
+ /** 尺寸 */
19
24
  size?: TypeAttributes.Size;
25
+ /** Render the control as plain text */
26
+ /** 只读 */
20
27
  readOnly?: boolean;
28
+ /** 样式前缀 */
21
29
  classPrefix?: string;
22
30
  }
31
+ /** 基础参数 */
23
32
  export interface BaseProps<S = ComponentChildren> {
33
+ /** 组件 CSS 类的前缀 */
24
34
  classPrefix?: string;
35
+ /** 下拉面板自定义内联样式 */
25
36
  popperStyle?: React.CSSProperties;
37
+ /** 子组件 */
26
38
  children?: S;
27
39
  }
28
40
  export type NativeProps<S extends string = never> = {
41
+ /** 自定义样式 */
29
42
  className?: string;
43
+ /** 自定义内联样式 */
30
44
  style?: React.CSSProperties & Partial<Record<S, string>>;
31
45
  };
32
46
  export interface AnimationEventProps {
47
+ /** 显示前动画过渡的回调函数 */
33
48
  beforeEnter?: (node?: null | HTMLElement | Text) => void;
49
+ /** 显示中动画过渡的回调函数 */
34
50
  onEnter?: (node?: null | HTMLElement | Text) => void;
51
+ /** 显示后动画过渡的回调函数 */
35
52
  afterEnter?: (node?: null | HTMLElement | Text) => void;
53
+ /** 退出前动画过渡的回调函数 */
36
54
  beforeLeave?: (node?: null | HTMLElement | Text) => void;
55
+ /** 退出中动画过渡的回调函数 */
37
56
  onLeave?: (node?: null | HTMLElement | Text) => void;
57
+ /** 退出后动画过渡的回调函数 */
38
58
  afterLeave?: (node?: null | HTMLElement | Text) => void;
39
59
  }
40
60
  export interface TooltipBaseProps<T extends EventTarget> {
@@ -44,8 +64,12 @@ export interface TooltipBaseProps<T extends EventTarget> {
44
64
  onContextMenu?: (event?: React.MouseEvent<T>) => void;
45
65
  }
46
66
  export interface StandardProps extends React.HTMLAttributes<HTMLElement> {
67
+ /** The prefix of the component CSS class */
47
68
  classPrefix?: string;
69
+ /** 自定义样式 */
48
70
  className?: string;
71
+ /** 自定义内联样式 */
49
72
  style?: React.CSSProperties;
73
+ /** 子组件 */
50
74
  children?: ComponentChildren;
51
75
  }
@@ -1,4 +1,9 @@
1
1
  export declare const tuple: <T extends string[]>(...args: T) => T;
2
2
  export declare const tupleNum: <T extends number[]>(...args: T) => T;
3
+ /**
4
+ * https://stackoverflow.com/a/59187769 Extract the type of an element of an array/tuple without
5
+ * performing indexing
6
+ */
3
7
  export type ElementOf<T> = T extends (infer E)[] ? E : T extends readonly (infer F)[] ? F : never;
8
+ /** https://github.com/Microsoft/TypeScript/issues/29729 */
4
9
  export type LiteralUnion<T extends U, U> = T | (U & {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qsxy/element-plus-react",
3
- "version": "1.0.0-next.2",
3
+ "version": "1.0.0-next.4",
4
4
  "description": "element-plus-react",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",