@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.
- package/README.md +31 -0
- package/dist/Badge/typings.d.ts +10 -0
- package/dist/Breadcrumb/typings.d.ts +4 -0
- package/dist/Button/typings.d.ts +28 -0
- package/dist/Calendar/CalendarContext.d.ts +10 -0
- package/dist/Calendar/ShortCuts.d.ts +2 -0
- package/dist/Calendar/typings.d.ts +18 -0
- package/dist/Card/typings.d.ts +4 -0
- package/dist/Cascader/CascaderDropdown.d.ts +1 -0
- package/dist/Cascader/CascaderMenu.d.ts +7 -0
- package/dist/Cascader/typings.d.ts +80 -0
- package/dist/Cascader/useCascader.d.ts +72 -0
- package/dist/Checkbox/typings.d.ts +11 -0
- package/dist/CheckboxGroup/CheckboxGroup.d.ts +4 -0
- package/dist/CheckboxGroup/CheckboxGroupContext.d.ts +1 -0
- package/dist/Col/typings.d.ts +10 -0
- package/dist/Collapse/CollapseContext.d.ts +3 -0
- package/dist/Collapse/typings.d.ts +7 -0
- package/dist/ColorPicker/AlphaSlider.d.ts +7 -0
- package/dist/ColorPicker/HueSlider.d.ts +7 -0
- package/dist/ColorPicker/Predefine.d.ts +7 -0
- package/dist/ColorPicker/SvPanel.d.ts +7 -0
- package/dist/ColorPicker/typings.d.ts +9 -0
- package/dist/ConfigProvider/ConfigProvider.d.ts +5 -0
- package/dist/DatePicker/typings.d.ts +69 -0
- package/dist/DateTimePicker/typings.d.ts +1 -0
- package/dist/Descriptions/DescriptionsContext.d.ts +2 -0
- package/dist/Descriptions/typings.d.ts +13 -0
- package/dist/Dialog/DialogContext.d.ts +8 -0
- package/dist/Dialog/typings.d.ts +36 -0
- package/dist/Divider/Divider.d.ts +4 -0
- package/dist/Drawer/DrawerContext.d.ts +10 -0
- package/dist/Drawer/typings.d.ts +16 -0
- package/dist/Dropdown/DropdownContext.d.ts +2 -0
- package/dist/Dropdown/typings.d.ts +15 -0
- package/dist/Form/FormItem.d.ts +12 -0
- package/dist/Form/typings.d.ts +55 -0
- package/dist/Form/useForm.d.ts +22 -0
- package/dist/Form/utils/NameMap.d.ts +3 -0
- package/dist/Form/utils/validateUtil.d.ts +4 -0
- package/dist/Form/utils/valueUtil.d.ts +17 -0
- package/dist/Icon/typings.d.ts +7 -0
- package/dist/Input/typings.d.ts +61 -0
- package/dist/InputNumber/typings.d.ts +21 -0
- package/dist/Link/typings.d.ts +6 -1
- package/dist/Loading/typings.d.ts +5 -0
- package/dist/Message/Main.d.ts +7 -0
- package/dist/Message/index.d.ts +8 -0
- package/dist/Message/typings.d.ts +11 -0
- package/dist/MessageBox/index.d.ts +14 -0
- package/dist/MessageBox/typings.d.ts +50 -0
- package/dist/Notification/Main.d.ts +7 -0
- package/dist/Notification/index.d.ts +15 -0
- package/dist/Notification/typings.d.ts +13 -0
- package/dist/Pagination/typings.d.ts +28 -0
- package/dist/Popconfirm/typings.d.ts +10 -0
- package/dist/Popover/typings.d.ts +12 -0
- package/dist/Popper/typings.d.ts +7 -1
- package/dist/Progress/typings.d.ts +12 -0
- package/dist/Radio/typings.d.ts +7 -0
- package/dist/RadioGroup/typings.d.ts +1 -0
- package/dist/Row/RowContext.d.ts +1 -0
- package/dist/Row/typings.d.ts +4 -0
- package/dist/Scrollbar/typings.d.ts +20 -0
- package/dist/Select/typings.d.ts +33 -0
- package/dist/Skeleton/PlaceholderGraph.d.ts +4 -0
- package/dist/Skeleton/PlaceholderGrid.d.ts +4 -0
- package/dist/Skeleton/PlaceholderParagraph.d.ts +4 -0
- package/dist/Switch/typings.d.ts +15 -0
- package/dist/Table/Colgroup.d.ts +1 -0
- package/dist/Table/TableContext.d.ts +8 -0
- package/dist/Table/hooks/useSelection.d.ts +17 -0
- package/dist/Table/hooks/useTable.d.ts +7 -0
- package/dist/Table/treeUtil.d.ts +39 -0
- package/dist/Table/typings.d.ts +137 -1
- package/dist/Table/util.d.ts +10 -0
- package/dist/Tabs/typings.d.ts +38 -0
- package/dist/Tag/Tag.d.ts +1 -1
- package/dist/Tag/Tag.js +18 -26
- package/dist/Tag/typings.d.ts +10 -0
- package/dist/TimeLine/typings.d.ts +9 -0
- package/dist/TimePicker/typings.d.ts +13 -0
- package/dist/TimePicker/useTimePicker.d.ts +7 -0
- package/dist/Tooltip/Tooltip.js +8 -19
- package/dist/Tooltip/TooltipContext.d.ts +1 -0
- package/dist/Tooltip/typings.d.ts +14 -1
- package/dist/Transfer/ListItem.d.ts +1 -0
- package/dist/Transfer/typings/index.d.ts +27 -0
- package/dist/Transfer/typings/list.d.ts +25 -0
- package/dist/Transfer/typings/listBody.d.ts +1 -0
- package/dist/Transition/Transition.d.ts +10 -0
- package/dist/Transition/TransitionGroup.d.ts +59 -0
- package/dist/Transition/childMapping.d.ts +23 -0
- package/dist/Tree/NodeList.d.ts +3 -0
- package/dist/Tree/RCTree.d.ts +15 -0
- package/dist/Tree/Tree.d.ts +15 -0
- package/dist/Tree/TreeNode.d.ts +7 -0
- package/dist/Tree/contextTypes.d.ts +4 -0
- package/dist/Tree/typings.d.ts +3 -0
- package/dist/Tree/util.d.ts +17 -0
- package/dist/Tree/utils/KeyCode.d.ts +326 -0
- package/dist/Tree/utils/conductUtil.d.ts +6 -0
- package/dist/Tree/utils/dictUtil.d.ts +1 -0
- package/dist/Tree/utils/pickAttrs.d.ts +5 -0
- package/dist/Tree/utils/treeUtil.d.ts +25 -1
- package/dist/TreeSelect/Utils.d.ts +1 -0
- package/dist/TreeSelect/typings.d.ts +19 -0
- package/dist/Upload/typings.d.ts +34 -0
- package/dist/Upload/use-handlers.d.ts +1 -0
- package/dist/Util/Math.d.ts +34 -0
- package/dist/Util/base.d.ts +21 -0
- package/dist/Util/shallowEqual.d.ts +11 -0
- package/dist/Util/treeUtils.d.ts +8 -0
- package/dist/VirtualList/Filler.d.ts +5 -0
- package/dist/VirtualList/VirtualList.d.ts +3 -0
- package/dist/VirtualList/hooks/useLayoutEffect.d.ts +3 -0
- package/dist/VirtualList/utils/algorithmUtil.d.ts +17 -0
- package/dist/VirtualList/utils/findDOMNode.d.ts +3 -0
- package/dist/hooks/animationPropsUtils.d.ts +12 -0
- package/dist/hooks/htmlPropsUtils.d.ts +8 -0
- package/dist/hooks/popperPropsUtils.d.ts +12 -0
- package/dist/hooks/treePropsUtils.d.ts +12 -0
- package/dist/hooks/useChildrenInstance.d.ts +11 -0
- package/dist/hooks/useClassNames.d.ts +78 -0
- package/dist/hooks/useControlled.d.ts +8 -0
- package/dist/hooks/useForceUpdate.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/theme-chalk/link/index.scss +0 -85
- package/dist/types/common.d.ts +24 -0
- package/dist/types/type.d.ts +5 -0
- package/package.json +1 -1
package/dist/Util/Math.d.ts
CHANGED
|
@@ -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;
|
package/dist/Util/base.d.ts
CHANGED
|
@@ -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;
|
package/dist/Util/treeUtils.d.ts
CHANGED
|
@@ -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,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,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;
|
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;
|
package/dist/types/common.d.ts
CHANGED
|
@@ -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
|
}
|
package/dist/types/type.d.ts
CHANGED
|
@@ -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 & {});
|