@qsxy/element-plus-react 1.0.0-next.1 → 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/Badge.js +4 -5
- package/dist/Badge/typings.d.ts +10 -0
- package/dist/Breadcrumb/Breadcrumb.js +1 -4
- package/dist/Breadcrumb/typings.d.ts +4 -0
- package/dist/Button/Button.d.ts +0 -1
- package/dist/Button/Button.js +21 -9
- package/dist/Button/typings.d.ts +28 -0
- package/dist/Calendar/Calendar.js +1 -2
- package/dist/Calendar/CalendarContext.d.ts +10 -0
- package/dist/Calendar/Footer.js +1 -2
- package/dist/Calendar/Header.js +3 -8
- 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/Cascader.js +26 -25
- 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/Checkbox.js +2 -6
- package/dist/Checkbox/CheckboxButton.js +2 -6
- 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/Col.js +1 -8
- package/dist/Col/typings.d.ts +10 -0
- package/dist/Collapse/CollapseContext.d.ts +3 -0
- package/dist/Collapse/CollapseItem.js +9 -7
- package/dist/Collapse/CollapseTransition.d.ts +7 -6
- package/dist/Collapse/CollapseTransition.js +49 -31
- package/dist/Collapse/typings.d.ts +7 -0
- package/dist/ColorPicker/AlphaSlider.d.ts +7 -0
- package/dist/ColorPicker/AlphaSlider.js +0 -1
- package/dist/ColorPicker/ColorPicker.js +0 -1
- package/dist/ColorPicker/HueSlider.d.ts +7 -0
- package/dist/ColorPicker/HueSlider.js +0 -1
- package/dist/ColorPicker/Predefine.d.ts +7 -0
- package/dist/ColorPicker/Predefine.js +0 -1
- package/dist/ColorPicker/SvPanel.d.ts +7 -0
- package/dist/ColorPicker/SvPanel.js +0 -1
- package/dist/ColorPicker/typings.d.ts +9 -0
- package/dist/ConfigProvider/ConfigProvider.d.ts +5 -0
- package/dist/DatePicker/DatePicker.js +19 -8
- package/dist/DatePicker/DateRangePicker.js +11 -10
- package/dist/DatePicker/typings.d.ts +69 -0
- package/dist/DateTimePicker/DateTimePicker.d.ts +1 -1
- package/dist/DateTimePicker/DateTimePicker.js +10 -8
- package/dist/DateTimePicker/typings.d.ts +1 -0
- package/dist/Descriptions/Descriptions.js +1 -5
- package/dist/Descriptions/DescriptionsContext.d.ts +2 -0
- package/dist/Descriptions/typings.d.ts +13 -0
- package/dist/Dialog/Dialog.d.ts +0 -1
- package/dist/Dialog/Dialog.js +3 -6
- package/dist/Dialog/DialogBody.js +0 -3
- package/dist/Dialog/DialogContext.d.ts +8 -0
- package/dist/Dialog/DialogHeader.js +1 -4
- package/dist/Dialog/typings.d.ts +36 -0
- package/dist/Divider/Divider.d.ts +4 -0
- package/dist/Divider/Divider.js +1 -6
- package/dist/Drawer/Drawer.js +10 -5
- package/dist/Drawer/DrawerBody.js +1 -4
- package/dist/Drawer/DrawerContext.d.ts +10 -0
- package/dist/Drawer/DrawerHeader.js +1 -4
- package/dist/Drawer/typings.d.ts +16 -0
- package/dist/Dropdown/Dropdown.js +11 -7
- package/dist/Dropdown/DropdownContext.d.ts +2 -0
- package/dist/Dropdown/typings.d.ts +15 -0
- package/dist/Empty/Empty.js +1 -4
- package/dist/Form/Form.js +10 -6
- package/dist/Form/FormItem.d.ts +12 -0
- package/dist/Form/FormItem.js +3 -1
- 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/Icon.js +1 -4
- package/dist/Icon/typings.d.ts +7 -0
- package/dist/Input/Input.js +16 -9
- package/dist/Input/InputRange.js +11 -8
- package/dist/Input/TextArea.js +8 -4
- package/dist/Input/typings.d.ts +61 -0
- package/dist/InputNumber/InputNumber.js +10 -7
- package/dist/InputNumber/typings.d.ts +21 -0
- package/dist/Link/Link.js +1 -4
- package/dist/Link/typings.d.ts +6 -1
- package/dist/Loading/Loading.js +3 -5
- package/dist/Loading/typings.d.ts +5 -0
- package/dist/Message/Main.d.ts +7 -0
- package/dist/Message/Message.js +11 -8
- package/dist/Message/index.d.ts +8 -0
- package/dist/Message/typings.d.ts +11 -0
- package/dist/MessageBox/Main.js +3 -1
- package/dist/MessageBox/index.d.ts +17 -3
- package/dist/MessageBox/index.js +1 -1
- package/dist/MessageBox/typings.d.ts +50 -0
- package/dist/Notification/Main.d.ts +7 -0
- package/dist/Notification/Notification.js +17 -14
- package/dist/Notification/index.d.ts +15 -0
- package/dist/Notification/typings.d.ts +13 -0
- package/dist/Pagination/Pagination.js +15 -11
- package/dist/Pagination/typings.d.ts +28 -0
- package/dist/Popconfirm/Popconfirm.js +13 -9
- package/dist/Popconfirm/typings.d.ts +10 -0
- package/dist/Popover/Popover.js +12 -8
- package/dist/Popover/typings.d.ts +12 -0
- package/dist/Popper/Popper.js +15 -11
- package/dist/Popper/typings.d.ts +7 -1
- package/dist/Progress/Progress.js +12 -8
- 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/Row.js +8 -5
- package/dist/Row/RowContext.d.ts +1 -0
- package/dist/Row/typings.d.ts +4 -0
- package/dist/Scrollbar/Scrollbar.js +13 -9
- package/dist/Scrollbar/Thumb.js +1 -1
- package/dist/Scrollbar/typings.d.ts +20 -0
- package/dist/Select/SelectCore.js +17 -14
- 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/PlaceholderGrid.js +0 -4
- package/dist/Skeleton/PlaceholderParagraph.d.ts +4 -0
- package/dist/Skeleton/PlaceholderParagraph.js +0 -4
- package/dist/Switch/Switch.js +13 -10
- package/dist/Switch/typings.d.ts +15 -0
- package/dist/Table/Colgroup.d.ts +1 -0
- package/dist/Table/Table.js +13 -9
- package/dist/Table/TableBody.js +10 -41
- package/dist/Table/TableCell.js +0 -5
- package/dist/Table/TableColumn.js +0 -4
- 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/Tabs.js +1 -4
- package/dist/Tabs/typings.d.ts +38 -0
- package/dist/Tag/Tag.d.ts +1 -1
- package/dist/Tag/Tag.js +7 -8
- package/dist/Tag/typings.d.ts +10 -0
- package/dist/TimeLine/TimeLineItem.js +7 -4
- package/dist/TimeLine/typings.d.ts +9 -0
- package/dist/TimePicker/TimePicker.js +14 -11
- package/dist/TimePicker/TimePickerRange.js +15 -12
- package/dist/TimePicker/TimeSpinnerPanel.js +1 -4
- package/dist/TimePicker/typings.d.ts +13 -0
- package/dist/TimePicker/useTimePicker.d.ts +7 -0
- package/dist/Tooltip/Tooltip.js +8 -15
- package/dist/Tooltip/TooltipContext.d.ts +1 -0
- package/dist/Tooltip/typings.d.ts +14 -1
- package/dist/Transfer/List.js +12 -8
- package/dist/Transfer/ListItem.d.ts +1 -0
- package/dist/Transfer/Transfer.js +11 -7
- 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 +16 -3
- package/dist/Transition/Transition.js +6 -4
- 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/TreeNode.js +1 -4
- 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/TreeSelect.js +14 -13
- package/dist/TreeSelect/Utils.d.ts +1 -0
- package/dist/TreeSelect/typings.d.ts +19 -0
- package/dist/Upload/Upload.js +9 -8
- package/dist/Upload/UploadList.js +2 -1
- package/dist/Upload/typings.d.ts +34 -0
- package/dist/Upload/use-handlers.d.ts +1 -0
- package/dist/Upload/use-handlers.js +1 -1
- package/dist/Util/Math.d.ts +34 -0
- package/dist/Util/base.d.ts +22 -0
- package/dist/Util/base.js +5 -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.css +72 -45422
- package/dist/index.d.ts +1 -0
- package/dist/theme-chalk/build.scss +64 -0
- package/dist/theme-chalk/icon/fonts.scss +8 -0
- package/dist/theme-chalk/icon/index.scss +0 -9
- package/dist/theme-chalk/index.scss +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/Input/typings.d.ts
CHANGED
|
@@ -3,11 +3,16 @@ import { BaseProps, FormControlBaseProps, NativeProps, TypeAttributes } from '..
|
|
|
3
3
|
export type LiteralUnion<T extends U, U> = T | (U & {});
|
|
4
4
|
export type ValueType = React.AllHTMLAttributes<HTMLInputElement>['value'];
|
|
5
5
|
export type BaseInputRef = {
|
|
6
|
+
/** 获取值 */
|
|
6
7
|
getValue: () => ValueType;
|
|
8
|
+
/** 设置值 */
|
|
7
9
|
setValue: (value: ValueType) => void;
|
|
8
10
|
onClear: (event?: any) => void;
|
|
11
|
+
/** 重置值 */
|
|
9
12
|
clear: (event?: any) => void;
|
|
13
|
+
/** 使 input 组件获得焦点 */
|
|
10
14
|
focus: () => void;
|
|
15
|
+
/** 使 input 组件失去焦点 */
|
|
11
16
|
blur: () => void;
|
|
12
17
|
showClear?: (value: ValueType) => void;
|
|
13
18
|
hideClear?: () => void;
|
|
@@ -21,67 +26,123 @@ export type TextareaRef = {
|
|
|
21
26
|
} & BaseInputRef;
|
|
22
27
|
export interface InputProps extends FormControlBaseProps<ValueType>, BaseProps, NativeProps, Omit<React.AllHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'size' | 'prefix' | 'type' | 'onInput' | 'onChange' | 'style' | 'children'> {
|
|
23
28
|
size?: TypeAttributes.Size;
|
|
29
|
+
/** 初始值 */
|
|
24
30
|
defaultValue?: ValueType;
|
|
31
|
+
/**
|
|
32
|
+
* text,textarea 和其他原生 input 的 type 值
|
|
33
|
+
* ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#%3Cinput%3E_types */
|
|
25
34
|
type?: LiteralUnion<'color' | 'date' | 'datetime-local' | 'email' | 'file' | 'hidden' | 'image' | 'number' | 'password' | 'range' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week', string>;
|
|
35
|
+
/** 输入框头部内容,只对 type="text" 有效 */
|
|
26
36
|
prefix?: React.ReactElement<any> | string | number;
|
|
37
|
+
/** 输入框尾部内容,只对 type="text" 有效 */
|
|
27
38
|
suffix?: React.ReactElement<any> | string | number;
|
|
39
|
+
/** 输入框前置内容,只对 type="text" 有效 */
|
|
28
40
|
prepend?: React.ReactElement<any> | string | number;
|
|
41
|
+
/** 输入框后置内容,只对 type="text" 有效 */
|
|
29
42
|
append?: React.ReactElement | string | number;
|
|
43
|
+
/** 是否可清空 */
|
|
30
44
|
clearable?: boolean;
|
|
45
|
+
/** 是否显示切换密码图标 */
|
|
31
46
|
showPassword?: boolean;
|
|
47
|
+
/** 是否纯文本模式,即无边框 */
|
|
32
48
|
plain?: boolean;
|
|
49
|
+
/** 表单校验错误提示 */
|
|
33
50
|
error?: boolean;
|
|
51
|
+
/** 表单校验警告提示 */
|
|
34
52
|
warning?: boolean;
|
|
53
|
+
/** 输入是否防抖动 */
|
|
35
54
|
debounceInput?: boolean;
|
|
55
|
+
/** 获取输入建议的防抖延时,单位为毫秒 */
|
|
36
56
|
debounceTime?: number;
|
|
57
|
+
/** input自定义内联样式 */
|
|
37
58
|
innerStyle?: React.CSSProperties;
|
|
59
|
+
/** 范围选择时开始输入框的占位内容 */
|
|
38
60
|
startPlaceholder?: string;
|
|
61
|
+
/** 范围选择时结束输入框的占位内容 */
|
|
39
62
|
endPlaceholder?: string;
|
|
63
|
+
/** 最大输入长度 */
|
|
40
64
|
maxLength?: number;
|
|
65
|
+
/** 原生属性,最小输入长度 */
|
|
41
66
|
minLength?: number;
|
|
67
|
+
/** 是否显示统计字数, 只在 type 为 'text' 或 'textarea' 的时候生效 */
|
|
42
68
|
showWordLimit?: boolean;
|
|
69
|
+
/** 是否隐藏值 */
|
|
43
70
|
hiddenValue?: boolean;
|
|
71
|
+
/** 在点击由 clearable 属性生成的清空按钮时触发 */
|
|
44
72
|
onClear?: (e: MouseEvent) => void;
|
|
73
|
+
/** 在 Input 值改变时触发 */
|
|
45
74
|
onChange?: (value: ValueType, event?: React.ChangeEvent) => void;
|
|
46
75
|
}
|
|
47
76
|
export interface InputGroupProps extends BaseProps, NativeProps {
|
|
77
|
+
/** 输入框前置内容,只对 type="text" 有效 */
|
|
48
78
|
prepend?: React.ReactElement<any> | string | number;
|
|
79
|
+
/** 输入框后置内容,只对 type="text" 有效 */
|
|
49
80
|
append?: React.ReactElement | string | number;
|
|
50
81
|
}
|
|
51
82
|
export interface TextareaProps extends Omit<React.AllHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'size' | 'prefix' | 'type' | 'onInput' | 'onChange' | 'style' | 'children'>, FormControlBaseProps<ValueType>, BaseProps, NativeProps {
|
|
83
|
+
/** 初始值 */
|
|
52
84
|
defaultValue?: ValueType;
|
|
85
|
+
/** 表单校验错误提示 */
|
|
53
86
|
error?: boolean;
|
|
87
|
+
/** 表单校验警告提示 */
|
|
54
88
|
warning?: boolean;
|
|
89
|
+
/** 是否纯文本模式,即无边框 */
|
|
55
90
|
plain?: boolean;
|
|
56
91
|
rows?: number;
|
|
92
|
+
/** input自定义内联样式 */
|
|
57
93
|
innerStyle?: React.CSSProperties;
|
|
94
|
+
/** 最大输入长度 */
|
|
58
95
|
maxLength?: number;
|
|
96
|
+
/** 原生属性,最小输入长度 */
|
|
59
97
|
minLength?: number;
|
|
98
|
+
/** 是否显示统计字数, 只在 type 为 'text' 或 'textarea' 的时候生效 */
|
|
60
99
|
showWordLimit?: boolean;
|
|
100
|
+
/** 在 Input 值改变时触发 */
|
|
61
101
|
onChange?: (value: ValueType, event?: React.ChangeEvent) => void;
|
|
62
102
|
}
|
|
63
103
|
export type InputRangeValueType = [string | null, string | null] | [number | null, number | null];
|
|
64
104
|
export interface InputRangeProps<T = InputRangeValueType> extends Omit<FormControlBaseProps<T>, 'name' | 'onChange'>, BaseProps, NativeProps {
|
|
65
105
|
name?: [string, string];
|
|
66
106
|
size?: TypeAttributes.Size;
|
|
107
|
+
/** 只读 */
|
|
67
108
|
readOnly?: boolean;
|
|
109
|
+
/** 是否激活状态 */
|
|
68
110
|
active?: boolean;
|
|
69
111
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
112
|
+
/**
|
|
113
|
+
* text,textarea 和其他原生 input 的 type 值
|
|
114
|
+
* ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#%3Cinput%3E_types */
|
|
70
115
|
type?: 'text' | 'hidden' | 'number';
|
|
116
|
+
/** 输入框头部内容,只对 type="text" 有效 */
|
|
71
117
|
prefix?: React.ReactElement<any> | string | number;
|
|
118
|
+
/** 输入框尾部内容,只对 type="text" 有效 */
|
|
72
119
|
suffix?: React.ReactElement<any> | string | number;
|
|
120
|
+
/** 输入框前置内容,只对 type="text" 有效 */
|
|
73
121
|
prepend?: React.ReactElement<any> | string | number;
|
|
122
|
+
/** 输入框后置内容,只对 type="text" 有效 */
|
|
74
123
|
append?: React.ReactElement | string | number;
|
|
124
|
+
/** 数值精度 */
|
|
75
125
|
precision?: number;
|
|
126
|
+
/** 是否可清空 */
|
|
76
127
|
clearable?: boolean;
|
|
128
|
+
/** 是否纯文本模式,即无边框 */
|
|
77
129
|
plain?: boolean;
|
|
130
|
+
/** 表单校验失败 */
|
|
78
131
|
error?: boolean;
|
|
132
|
+
/** 表单校验失败 */
|
|
79
133
|
warning?: boolean;
|
|
134
|
+
/** 选择范围时的分隔符 */
|
|
80
135
|
rangeSeparator?: string;
|
|
136
|
+
/** 输入是否防抖动 */
|
|
81
137
|
debounceInput?: boolean;
|
|
138
|
+
/** input自定义内联样式 */
|
|
82
139
|
innerStyle?: React.CSSProperties;
|
|
140
|
+
/** 范围选择时开始输入框的占位内容 */
|
|
83
141
|
startPlaceholder?: string;
|
|
142
|
+
/** 范围选择时结束输入框的占位内容 */
|
|
84
143
|
endPlaceholder?: string;
|
|
144
|
+
/** 在点击由 clearable 属性生成的清空按钮时触发 */
|
|
85
145
|
onClear?: (e: MouseEvent) => void;
|
|
146
|
+
/** 选中值发生变化时触发 */
|
|
86
147
|
onChange?: (value: InputRangeValueType | null, event?: Event) => void;
|
|
87
148
|
}
|
|
@@ -44,6 +44,16 @@ var import_Input = require("../Input");
|
|
|
44
44
|
var import_Util = require("../Util");
|
|
45
45
|
var import_hooks = require("../hooks");
|
|
46
46
|
var InputNumber = (0, import_react.forwardRef)((props, ref) => {
|
|
47
|
+
props = (0, import_Util.mergeDefaultProps)(
|
|
48
|
+
{
|
|
49
|
+
step: 1,
|
|
50
|
+
precision: 0,
|
|
51
|
+
max: Infinity,
|
|
52
|
+
min: -Infinity,
|
|
53
|
+
placeholder: "请输入"
|
|
54
|
+
},
|
|
55
|
+
props
|
|
56
|
+
);
|
|
47
57
|
const {
|
|
48
58
|
name,
|
|
49
59
|
max: _maxProp,
|
|
@@ -220,12 +230,5 @@ var InputNumber = (0, import_react.forwardRef)((props, ref) => {
|
|
|
220
230
|
}
|
|
221
231
|
));
|
|
222
232
|
});
|
|
223
|
-
InputNumber.defaultProps = {
|
|
224
|
-
step: 1,
|
|
225
|
-
precision: 0,
|
|
226
|
-
max: Infinity,
|
|
227
|
-
min: -Infinity,
|
|
228
|
-
placeholder: "请输入"
|
|
229
|
-
};
|
|
230
233
|
InputNumber.displayName = "ElInputNumber";
|
|
231
234
|
var InputNumber_default = (0, import_react.memo)(InputNumber);
|
|
@@ -4,28 +4,49 @@ import { BaseProps, FormControlBaseProps, NativeProps } from '../types/common';
|
|
|
4
4
|
export type LiteralUnion<T extends U, U> = T | (U & {});
|
|
5
5
|
export type ValueType = number | string;
|
|
6
6
|
export interface InputNumberProps<V = ValueType> extends Omit<FormControlBaseProps<V>, 'onChange'>, BaseProps<HTMLDivElement>, NativeProps, Omit<React.AllHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'size' | 'prefix' | 'type' | 'onInput' | 'onChange' | 'style' | 'value' | 'ref' | 'className' | 'readOnly' | 'disabled' | 'name' | 'children'> {
|
|
7
|
+
/** 设置计数器允许的最大值 */
|
|
7
8
|
max?: number;
|
|
9
|
+
/** 设置计数器允许的最小值 */
|
|
8
10
|
min?: number;
|
|
11
|
+
/** 计数器步长 */
|
|
9
12
|
step?: number;
|
|
13
|
+
/** 是否只能输入 step 的倍数 */
|
|
10
14
|
stepStrictly?: boolean;
|
|
15
|
+
/** 数值精度 */
|
|
11
16
|
precision?: number;
|
|
17
|
+
/** 控制按钮位置 */
|
|
12
18
|
controlsPositionRight?: boolean;
|
|
19
|
+
/** 占位符 */
|
|
13
20
|
placeholder?: string;
|
|
21
|
+
/** 绑定值被改变时触发 */
|
|
14
22
|
onChange?: (currentValue: number | string, oldValue?: number | string) => void;
|
|
23
|
+
/** 样式前缀 */
|
|
15
24
|
prefixCls?: string;
|
|
25
|
+
/** 表单校验错误提示 */
|
|
16
26
|
error?: boolean;
|
|
27
|
+
/** 表单校验警告提示 */
|
|
17
28
|
warning?: boolean;
|
|
29
|
+
/** 输入框头部内容 */
|
|
18
30
|
prefix?: React.ReactElement<any> | string | number;
|
|
31
|
+
/** 输入框尾部内容 */
|
|
19
32
|
suffix?: React.ReactElement<any> | string | number;
|
|
33
|
+
/** 输入框前置内容 */
|
|
20
34
|
prepend?: React.ReactElement<any> | string | number;
|
|
35
|
+
/** 输入框后置内容 */
|
|
21
36
|
append?: React.ReactElement | string | number;
|
|
37
|
+
/** 最大输入长度 */
|
|
22
38
|
maxLength?: number;
|
|
39
|
+
/** 原生属性,最小输入长度 */
|
|
23
40
|
minLength?: number;
|
|
24
41
|
}
|
|
25
42
|
export interface InputNumberRef {
|
|
43
|
+
/** 顶级div */
|
|
26
44
|
ref: Ref<HTMLDivElement>;
|
|
45
|
+
/** input */
|
|
27
46
|
input: Ref<InputRef>;
|
|
28
47
|
getValue: () => number;
|
|
48
|
+
/** 使 input 组件获得焦点 */
|
|
29
49
|
focus: () => void;
|
|
50
|
+
/** 使 input 组件失去焦点 */
|
|
30
51
|
blur: () => void;
|
|
31
52
|
}
|
package/dist/Link/Link.js
CHANGED
|
@@ -37,7 +37,7 @@ var import_react = __toESM(require("react"));
|
|
|
37
37
|
var import_Icon = require("../Icon");
|
|
38
38
|
var import_hooks = require("../hooks");
|
|
39
39
|
var Link = (0, import_react.forwardRef)((props, ref) => {
|
|
40
|
-
const { type, underline, disabled, className, style, classPrefix = "link", onClick, icon, ...rest } = props;
|
|
40
|
+
const { type = "default", underline, disabled, className, style, classPrefix = "link", onClick, icon, ...rest } = props;
|
|
41
41
|
const { b, m, is } = (0, import_hooks.useClassNames)(classPrefix);
|
|
42
42
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
43
43
|
"a",
|
|
@@ -58,7 +58,4 @@ var Link = (0, import_react.forwardRef)((props, ref) => {
|
|
|
58
58
|
);
|
|
59
59
|
});
|
|
60
60
|
Link.displayName = "Link";
|
|
61
|
-
Link.defaultProps = {
|
|
62
|
-
type: "default"
|
|
63
|
-
};
|
|
64
61
|
var Link_default = (0, import_react.memo)(Link);
|
package/dist/Link/typings.d.ts
CHANGED
|
@@ -2,10 +2,15 @@ import React from 'react';
|
|
|
2
2
|
import { IconName } from '../Icon';
|
|
3
3
|
import { BaseProps, NativeProps, TypeAttributes } from '../types/common';
|
|
4
4
|
export type LinkType = TypeAttributes.Appearance;
|
|
5
|
-
export interface LinkProps extends BaseProps, NativeProps
|
|
5
|
+
export interface LinkProps extends BaseProps, NativeProps<'--el-link-font-size' | '--el-link-font-weight' | '--el-link-text-color' | '--el-link-hover-text-color' | '--el-link-disabled-text-color'>, Omit<React.AllHTMLAttributes<HTMLAnchorElement>, 'type' | 'style' | 'children'> {
|
|
6
|
+
/** 链接地址 */
|
|
6
7
|
href?: string;
|
|
8
|
+
/** 链接类型 */
|
|
7
9
|
type?: LinkType;
|
|
10
|
+
/** 是否下划线 */
|
|
8
11
|
underline?: boolean;
|
|
12
|
+
/** 是否禁用状态 */
|
|
9
13
|
disabled?: boolean;
|
|
14
|
+
/** 图标组件 */
|
|
10
15
|
icon?: IconName;
|
|
11
16
|
}
|
package/dist/Loading/Loading.js
CHANGED
|
@@ -41,9 +41,10 @@ var import_Transition = require("../Transition");
|
|
|
41
41
|
var import_Util = require("../Util");
|
|
42
42
|
var import_hooks = require("../hooks");
|
|
43
43
|
var Main = (props) => {
|
|
44
|
-
const { visible, text, fullscreen, spinner, background } = props;
|
|
44
|
+
const { visible, text, fullscreen = true, spinner, background } = props;
|
|
45
45
|
const { b, is } = (0, import_hooks.useClassNames)("loading");
|
|
46
|
-
|
|
46
|
+
const nodeRef = (0, import_react.useRef)(null);
|
|
47
|
+
return /* @__PURE__ */ import_react.default.createElement(import_Transition.Transition, { nodeRef, name: "loading-fade", visible }, /* @__PURE__ */ import_react.default.createElement("div", { ref: nodeRef, className: (0, import_classnames.default)(b`mask`, is({ fullscreen }), props.className), style: { ...props.style, background, zIndex: import_Util.PopupManager.nextZIndex() } }, /* @__PURE__ */ import_react.default.createElement("div", { className: b`spinner` }, spinner ? /* @__PURE__ */ import_react.default.createElement(import_Icon.Icon, { name: spinner, spin: true }) : /* @__PURE__ */ import_react.default.createElement("svg", { className: "circular", viewBox: "25 25 50 50" }, /* @__PURE__ */ import_react.default.createElement("circle", { className: "path", cx: "50", cy: "50", r: "20", fill: "none" })), text && /* @__PURE__ */ import_react.default.createElement("p", { className: b`text` }, text))));
|
|
47
48
|
};
|
|
48
49
|
var service = (props = {}) => {
|
|
49
50
|
const { target = { current: document.body } } = props;
|
|
@@ -62,9 +63,6 @@ var Loading = (props) => {
|
|
|
62
63
|
}
|
|
63
64
|
return /* @__PURE__ */ import_react.default.createElement(Main, { ...props, visible });
|
|
64
65
|
};
|
|
65
|
-
Loading.defaultProps = {
|
|
66
|
-
fullscreen: true
|
|
67
|
-
};
|
|
68
66
|
Loading.service = service;
|
|
69
67
|
Loading.displayName = "Loading";
|
|
70
68
|
var Loading_default = Loading;
|
|
@@ -2,12 +2,17 @@ import { RefObject } from 'react';
|
|
|
2
2
|
import { IconName } from '../Icon';
|
|
3
3
|
import { BaseProps, NativeProps } from '../types/common';
|
|
4
4
|
export interface LoadingProps extends BaseProps, NativeProps {
|
|
5
|
+
/** Loading 需要覆盖的 DOM 节点。 可传入一个 DOM 对象或字符串; 若传入字符串,则会将其作为参数传入 document.querySelector以获取到对应 DOM 节点 */
|
|
5
6
|
target?: RefObject<HTMLElement>;
|
|
6
7
|
visible?: boolean;
|
|
8
|
+
/** 是否让加载组件铺满整个屏幕 */
|
|
7
9
|
fullscreen?: boolean;
|
|
8
10
|
lock?: boolean;
|
|
11
|
+
/** 显示在加载图标下方的加载文案 */
|
|
9
12
|
text?: string;
|
|
13
|
+
/** 自定义加载图标类名 */
|
|
10
14
|
spinner?: IconName;
|
|
15
|
+
/** 遮罩背景色 */
|
|
11
16
|
background?: string;
|
|
12
17
|
}
|
|
13
18
|
export type LoadingService = (props?: LoadingProps) => {
|
package/dist/Message/Main.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MessageProps, MessageRef } from './typings';
|
|
3
|
+
/**
|
|
4
|
+
* @author Parker
|
|
5
|
+
* @CreateTime 2022/5/2 21:15:44
|
|
6
|
+
* @LastEditor Parker
|
|
7
|
+
* @ModifyTime 2022/5/3 12:09:53
|
|
8
|
+
* @Description
|
|
9
|
+
*/
|
|
3
10
|
export declare class Main {
|
|
4
11
|
ref: React.RefObject<MessageRef>;
|
|
5
12
|
constructor(props: MessageProps);
|
package/dist/Message/Message.js
CHANGED
|
@@ -41,6 +41,16 @@ var import_Util = require("../Util");
|
|
|
41
41
|
var import_Constants = require("../config/Constants");
|
|
42
42
|
var import_hooks = require("../hooks");
|
|
43
43
|
var Message = (0, import_react.forwardRef)((props, ref) => {
|
|
44
|
+
props = (0, import_Util.mergeDefaultProps)(
|
|
45
|
+
{
|
|
46
|
+
duration: 3e3,
|
|
47
|
+
message: "",
|
|
48
|
+
showClose: true,
|
|
49
|
+
type: "info",
|
|
50
|
+
offset: 20
|
|
51
|
+
},
|
|
52
|
+
props
|
|
53
|
+
);
|
|
44
54
|
const { classPrefix = "message", center, iconClass, showClose: closable, type, onClose, duration, message, immediate, userOnClose, afterLeave } = props;
|
|
45
55
|
const { b, e, m, is } = (0, import_hooks.useClassNames)(classPrefix);
|
|
46
56
|
const [visible, setVisible] = (0, import_react.useState)(false);
|
|
@@ -124,7 +134,7 @@ var Message = (0, import_react.forwardRef)((props, ref) => {
|
|
|
124
134
|
}, [b, iconClass, type]);
|
|
125
135
|
const closeIcon = (0, import_react.useMemo)(() => closable && /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(e`closeBtn`, b("icon-close", false)), onClick: handleClose }), [closable, e, b, handleClose]);
|
|
126
136
|
return (0, import_react_dom.createPortal)(
|
|
127
|
-
/* @__PURE__ */ import_react.default.createElement(import_Transition.Transition, { name: b("message-fade", false), visible, display: "flex", unmountOnExit: true, afterEnter: startTimer, afterLeave }, /* @__PURE__ */ import_react.default.createElement(
|
|
137
|
+
/* @__PURE__ */ import_react.default.createElement(import_Transition.Transition, { nodeRef: messageRef, name: b("message-fade", false), visible, display: "flex", unmountOnExit: true, afterEnter: startTimer, afterLeave }, /* @__PURE__ */ import_react.default.createElement(
|
|
128
138
|
"div",
|
|
129
139
|
{
|
|
130
140
|
ref: messageRef,
|
|
@@ -145,11 +155,4 @@ var Message = (0, import_react.forwardRef)((props, ref) => {
|
|
|
145
155
|
document.body
|
|
146
156
|
);
|
|
147
157
|
});
|
|
148
|
-
Message.defaultProps = {
|
|
149
|
-
duration: 3e3,
|
|
150
|
-
message: "",
|
|
151
|
-
showClose: true,
|
|
152
|
-
type: "info",
|
|
153
|
-
offset: 20
|
|
154
|
-
};
|
|
155
158
|
var Message_default = (0, import_react.memo)(Message);
|
package/dist/Message/index.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
import { MessageMethod, MessageQueue } from './typings';
|
|
3
3
|
export declare const instances: MessageQueue;
|
|
4
|
+
/**
|
|
5
|
+
* 消息提示组件
|
|
6
|
+
* @author Parker
|
|
7
|
+
* @CreateTime 2022/3/10 12:45:48
|
|
8
|
+
* @LastEditor Parker
|
|
9
|
+
* @ModifyTime 2022/5/3 12:10:04
|
|
10
|
+
* @Description Element Plus 消息提示组件魔改过来的,源代码见:https://github.com/element-plus/element-plus
|
|
11
|
+
*/
|
|
4
12
|
export declare const Message: MessageMethod;
|
|
5
13
|
export declare function close(id: string, userOnClose?: (el?: RefObject<HTMLElement>) => void): void;
|
|
6
14
|
export declare function closeAll(): void;
|
|
@@ -6,15 +6,25 @@ export interface MessageHandle {
|
|
|
6
6
|
}
|
|
7
7
|
export interface MessageProps extends BaseProps, NativeProps, AnimationEventProps {
|
|
8
8
|
id?: string;
|
|
9
|
+
/** 文字是否居中 */
|
|
9
10
|
center?: boolean;
|
|
11
|
+
/** 显示时间,单位为毫秒。 设为 0 则不会自动关闭 */
|
|
10
12
|
duration?: number;
|
|
13
|
+
/** 自定义图标 */
|
|
11
14
|
iconClass?: string;
|
|
15
|
+
/** 消息文字 */
|
|
12
16
|
message?: string | React.ReactElement;
|
|
17
|
+
/** Message 距离窗口顶部的偏移量 */
|
|
13
18
|
offset?: number;
|
|
19
|
+
/** 关闭时的回调函数, 参数为被关闭的 message 实例 */
|
|
14
20
|
onClose?: (el?: RefObject<HTMLElement>) => void;
|
|
21
|
+
/** 是否显示关闭按钮 */
|
|
15
22
|
showClose?: boolean;
|
|
23
|
+
/** 消息类型 */
|
|
16
24
|
type?: 'success' | 'warning' | 'info' | 'error' | '';
|
|
25
|
+
/** 是否立即执行onClose方法 */
|
|
17
26
|
immediate?: boolean;
|
|
27
|
+
/** 合并内容相同的消息,不支持 VNode 类型的消息 */
|
|
18
28
|
grouping?: boolean;
|
|
19
29
|
userOnClose?: (el?: RefObject<HTMLElement>) => void;
|
|
20
30
|
}
|
|
@@ -37,6 +47,7 @@ export interface MessageRef {
|
|
|
37
47
|
message: string | React.ReactElement;
|
|
38
48
|
close: () => void;
|
|
39
49
|
setOffset: (val: number) => void;
|
|
50
|
+
/** 设置重复数量 */
|
|
40
51
|
setReapetNum: () => void;
|
|
41
52
|
}
|
|
42
53
|
export type MessageQueue = Array<RefObject<MessageRef>>;
|
package/dist/MessageBox/Main.js
CHANGED
|
@@ -2,8 +2,22 @@ import React from 'react';
|
|
|
2
2
|
import { MessageBoxData, MessageBoxProps } from './typings';
|
|
3
3
|
export declare const MessageBox: {
|
|
4
4
|
(options?: MessageBoxProps): Promise<unknown>;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* 消息弹窗提示
|
|
7
|
+
* @param message 消息内容
|
|
8
|
+
* @param title 标题
|
|
9
|
+
* @param options 其他设置项
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
alert: (message: string | React.ReactElement, title: string | React.ReactElement | MessageBoxProps, options?: MessageBoxProps) => Promise<MessageBoxData>;
|
|
13
|
+
/**
|
|
14
|
+
* 确认消息
|
|
15
|
+
* @param message 消息内容
|
|
16
|
+
* @param title 标题
|
|
17
|
+
* @param options 其他设置项
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
confirm: (message: string | React.ReactElement, title: string | React.ReactElement | MessageBoxProps, options?: MessageBoxProps) => Promise<MessageBoxData>;
|
|
21
|
+
prompt: (message: string | React.ReactElement, title: string | React.ReactElement | MessageBoxProps, options?: MessageBoxProps) => Promise<MessageBoxData>;
|
|
8
22
|
};
|
|
9
23
|
export type { Action as MessageBoxAction, MessageBoxMethod, MessageBoxProps, MessageBoxRef } from './typings';
|
package/dist/MessageBox/index.js
CHANGED
|
@@ -41,7 +41,6 @@ var MESSAGE_BOX_DEFAULT_OPTS = {
|
|
|
41
41
|
};
|
|
42
42
|
var instanceFactory = (boxType) => {
|
|
43
43
|
return (message, title, options) => {
|
|
44
|
-
const { distinguishCancelAndClose } = options;
|
|
45
44
|
let titleOrOpts = "";
|
|
46
45
|
if ((0, import_Util.isObject)(title)) {
|
|
47
46
|
options = title;
|
|
@@ -51,6 +50,7 @@ var instanceFactory = (boxType) => {
|
|
|
51
50
|
} else {
|
|
52
51
|
titleOrOpts = title;
|
|
53
52
|
}
|
|
53
|
+
const { distinguishCancelAndClose } = options ?? {};
|
|
54
54
|
return new Promise((resolve, reject) => {
|
|
55
55
|
new import_Main.default({
|
|
56
56
|
boxType,
|
|
@@ -3,37 +3,70 @@ import { DialogFooterProps, DialogProps } from '../Dialog/typings';
|
|
|
3
3
|
import { IconName, IconProps } from '../Icon';
|
|
4
4
|
import { AnimationEventProps, BaseProps, NativeProps, TypeAttributes } from '../types/common';
|
|
5
5
|
export interface MessageBoxProps extends BaseProps, NativeProps, AnimationEventProps {
|
|
6
|
+
/** 标题 */
|
|
6
7
|
title?: string | React.ReactElement;
|
|
8
|
+
/** 消息正文内容 */
|
|
7
9
|
message?: string | React.ReactElement;
|
|
10
|
+
/** 是否将 message 属性作为 HTML 片段处理 */
|
|
11
|
+
/** 消息类型,用于显示图标 */
|
|
8
12
|
type?: 'success' | 'info' | 'warning' | 'error';
|
|
13
|
+
/** 消息自定义图标,该属性会覆盖 type 的图标 */
|
|
9
14
|
icon?: IconName | React.ReactElement<IconProps>;
|
|
15
|
+
/** 遮罩的自定义类名 */
|
|
10
16
|
modalClass?: string;
|
|
17
|
+
/** 自定义确认按钮及取消按钮的大小 */
|
|
11
18
|
width?: DialogProps['width'];
|
|
19
|
+
/** 若不使用 Promise,可以使用此参数指定 MessageBox 关闭后的回调函数, instance 为 MessageBox 实例, 可以通过它访问实例上的属性和方法 */
|
|
12
20
|
callback?: (value: string, action: Action) => any | ((action: Action) => any);
|
|
21
|
+
/** 是否显示右上角关闭按钮 */
|
|
13
22
|
showClose?: boolean;
|
|
23
|
+
/** 是否可以通过点击 modal 关闭 MessageBox */
|
|
14
24
|
closeOnClickModal?: boolean;
|
|
25
|
+
/** 关闭前的回调,会暂停消息弹出框的关闭过程;instance为 MessageBox 实例,可以通过它访问实例上的属性和方法;done用于关闭 MessageBox 实例 */
|
|
15
26
|
beforeClose?: (action?: Action, done?: () => void, ref?: RefObject<MessageBoxRef>) => void;
|
|
27
|
+
/** 是否显示取消按钮(以 confirm 和 prompt 方式调用时为 true) */
|
|
16
28
|
showCancelButton?: boolean;
|
|
29
|
+
/** 是否显示确定按钮 */
|
|
17
30
|
showConfirmButton?: boolean;
|
|
31
|
+
/** 取消按钮的文本内容 */
|
|
18
32
|
cancelButtonText?: string;
|
|
33
|
+
/** 确定按钮的文本内容 */
|
|
19
34
|
confirmButtonText?: string;
|
|
35
|
+
/** 取消按钮的自定义类名 */
|
|
20
36
|
cancelButtonClass?: string;
|
|
37
|
+
/** 确定按钮的自定义类名 */
|
|
21
38
|
confirmButtonClass?: string;
|
|
39
|
+
/** 自定义确认和取消按钮的尺寸 */
|
|
22
40
|
buttonSize?: TypeAttributes.Size;
|
|
41
|
+
/** 按钮位置 */
|
|
23
42
|
buttonPosition?: DialogFooterProps['position'];
|
|
43
|
+
/** 是否将取消(点击取消按钮)与关闭(点击关闭按钮或遮罩层、按下 Esc 键)进行区分 */
|
|
24
44
|
distinguishCancelAndClose?: boolean;
|
|
45
|
+
/** 内容区域padding */
|
|
25
46
|
padding?: string | number;
|
|
47
|
+
/** 是否在 MessageBox 出现时将 body 滚动锁定 */
|
|
26
48
|
lockScroll?: boolean;
|
|
49
|
+
/** 是否显示输入框 */
|
|
27
50
|
showInput?: boolean;
|
|
51
|
+
/** 输入框占位文本 */
|
|
28
52
|
inputPlaceholder?: string;
|
|
53
|
+
/** 输入框的类型 */
|
|
29
54
|
inputType?: string;
|
|
55
|
+
/** 输入框的初始文本 */
|
|
30
56
|
inputValue?: string;
|
|
57
|
+
/** 输入框的校验表达式 */
|
|
31
58
|
inputPattern?: RegExp;
|
|
59
|
+
/** 输入框的校验函数。 应该返回一个 boolean 或者 string, 如果返回的是一个 string 类型,那么该返回值会被赋值给 inputErrorMessage 用于向用户展示错误消息。 */
|
|
32
60
|
inputValidator?: (value: string) => boolean | string;
|
|
61
|
+
/** 校验未通过时的提示文本 */
|
|
33
62
|
inputErrorMessage?: string;
|
|
63
|
+
/** 是否居中布局 */
|
|
34
64
|
center?: boolean;
|
|
65
|
+
/** 为 MessageBox 启用可拖拽功能 */
|
|
35
66
|
draggable?: boolean;
|
|
67
|
+
/** 拖动范围可以超出可视区 */
|
|
36
68
|
overflow?: boolean;
|
|
69
|
+
/** 是否使用圆角按钮 */
|
|
37
70
|
roundButton?: boolean;
|
|
38
71
|
}
|
|
39
72
|
export type MessageState = {
|
|
@@ -51,13 +84,30 @@ export interface MessageBoxInputData {
|
|
|
51
84
|
export type ElMessageBoxShortcutMethod = (((message: MessageBoxProps['message'], title: MessageBoxProps['title'], options?: Omit<MessageBoxProps, 'message' | 'title'>) => Promise<MessageBoxData>) & ((message: MessageBoxProps['message'], options?: Omit<MessageBoxProps, 'message' | 'title'>) => Promise<MessageBoxData>));
|
|
52
85
|
export interface MessageBoxMethod {
|
|
53
86
|
(options?: MessageBoxProps): Promise<MessageBoxData>;
|
|
87
|
+
/**
|
|
88
|
+
* 消息弹窗提示
|
|
89
|
+
* @param message 消息内容
|
|
90
|
+
* @param title 标题
|
|
91
|
+
* @param options 其他设置项
|
|
92
|
+
* @returns
|
|
93
|
+
*/
|
|
54
94
|
alert: ElMessageBoxShortcutMethod;
|
|
95
|
+
/**
|
|
96
|
+
* 确认消息
|
|
97
|
+
* @param message 消息内容
|
|
98
|
+
* @param title 标题
|
|
99
|
+
* @param options 其他设置项
|
|
100
|
+
* @returns
|
|
101
|
+
*/
|
|
55
102
|
confirm: ElMessageBoxShortcutMethod;
|
|
56
103
|
prompt: ElMessageBoxShortcutMethod;
|
|
57
104
|
}
|
|
58
105
|
export interface MessageBoxRef {
|
|
59
106
|
ref: RefObject<HTMLDivElement>;
|
|
107
|
+
/** 关闭方法 */
|
|
60
108
|
close: () => void;
|
|
109
|
+
/** 设置确认按钮是否加载状态 */
|
|
61
110
|
setConfirmButtonLoading: (value: boolean) => void;
|
|
111
|
+
/** 修改确认按钮文本方法 */
|
|
62
112
|
setConfirmButtonText: (value: string) => void;
|
|
63
113
|
}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
import { NotificationProps, NotificationRef } from './typings';
|
|
3
|
+
/**
|
|
4
|
+
* @author Parker
|
|
5
|
+
* @CreateTime 2022/3/10 12:45:48
|
|
6
|
+
* @LastEditor Parker
|
|
7
|
+
* @ModifyTime 2022/5/3 12:24:58
|
|
8
|
+
* @Description
|
|
9
|
+
*/
|
|
3
10
|
export declare class Main {
|
|
4
11
|
ref: RefObject<NotificationRef>;
|
|
5
12
|
constructor(props: NotificationProps);
|
|
@@ -40,6 +40,22 @@ var import_Util = require("../Util");
|
|
|
40
40
|
var import_Constants = require("../config/Constants");
|
|
41
41
|
var import_hooks = require("../hooks");
|
|
42
42
|
var Notification = (0, import_react.forwardRef)((props, ref) => {
|
|
43
|
+
props = (0, import_Util.mergeDefaultProps)(
|
|
44
|
+
{
|
|
45
|
+
duration: 4500,
|
|
46
|
+
// default 4500
|
|
47
|
+
message: "",
|
|
48
|
+
onClose: null,
|
|
49
|
+
onClick: null,
|
|
50
|
+
afterLeave: null,
|
|
51
|
+
offset: 0,
|
|
52
|
+
// defaults 0
|
|
53
|
+
position: "top-right",
|
|
54
|
+
// default top-right
|
|
55
|
+
showClose: true
|
|
56
|
+
},
|
|
57
|
+
props
|
|
58
|
+
);
|
|
43
59
|
const { iconClass, message, position, showClose, type, title, classPrefix = "notification", onClose, duration, onSuccess, afterLeave } = props;
|
|
44
60
|
const { b, e } = (0, import_hooks.useClassNames)(classPrefix);
|
|
45
61
|
const [visible, setVisible] = (0, import_react.useState)(false);
|
|
@@ -115,7 +131,7 @@ var Notification = (0, import_react.forwardRef)((props, ref) => {
|
|
|
115
131
|
}, [b, iconClass, type]);
|
|
116
132
|
const closeIcon = (0, import_react.useMemo)(() => showClose && /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(e`closeBtn`, b("icon-close", false)), onClick: handleClose }), [showClose, e, b, handleClose]);
|
|
117
133
|
return (0, import_react_dom.createPortal)(
|
|
118
|
-
/* @__PURE__ */ import_react.default.createElement(import_Transition.Transition, { name: b("notification-fade", false), visible, display: "flex", afterLeave }, /* @__PURE__ */ import_react.default.createElement(
|
|
134
|
+
/* @__PURE__ */ import_react.default.createElement(import_Transition.Transition, { nodeRef: notificationRef, name: b("notification-fade", false), visible, display: "flex", afterLeave }, /* @__PURE__ */ import_react.default.createElement(
|
|
119
135
|
"div",
|
|
120
136
|
{
|
|
121
137
|
ref: notificationRef,
|
|
@@ -133,18 +149,5 @@ var Notification = (0, import_react.forwardRef)((props, ref) => {
|
|
|
133
149
|
document.body
|
|
134
150
|
);
|
|
135
151
|
});
|
|
136
|
-
Notification.defaultProps = {
|
|
137
|
-
duration: 4500,
|
|
138
|
-
// default 4500
|
|
139
|
-
message: "",
|
|
140
|
-
onClose: null,
|
|
141
|
-
onClick: null,
|
|
142
|
-
afterLeave: null,
|
|
143
|
-
offset: 0,
|
|
144
|
-
// defaults 0
|
|
145
|
-
position: "top-right",
|
|
146
|
-
// default top-right
|
|
147
|
-
showClose: true
|
|
148
|
-
};
|
|
149
152
|
Notification.displayName = "ElNotification";
|
|
150
153
|
var Notification_default = Notification;
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import type { INotification, NotificationRef, Position } from './typings';
|
|
2
|
+
/**
|
|
3
|
+
* 通知组件
|
|
4
|
+
* @author Parker
|
|
5
|
+
* @CreateTime 2022/3/10 12:45:48
|
|
6
|
+
* @LastEditor Parker
|
|
7
|
+
* @ModifyTime 2022/5/3 13:43:28
|
|
8
|
+
* @Description Element Plus 通知组件魔改过来的,源代码见:https://github.com/element-plus/element-plus
|
|
9
|
+
*/
|
|
2
10
|
export declare const Notification: INotification;
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param id
|
|
14
|
+
* @param position
|
|
15
|
+
* @param userOnClose
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
3
18
|
export declare function close(id: string, position: Position, userOnClose?: (vm: NotificationRef) => void): void;
|
|
4
19
|
export declare function closeAll(): void;
|
|
5
20
|
export type { INotification, INotificationHandle, NotificationProps as INotificationOptions } from './typings';
|