@qsxy/element-plus-react 1.0.0-next.13 → 1.0.0-next.16
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/dist/Button/Button.js +5 -3
- package/dist/Button/typings.d.ts +3 -1
- package/dist/ColorPicker/AlphaSlider.d.ts +0 -7
- package/dist/ColorPicker/AlphaSlider.js +0 -7
- package/dist/ColorPicker/HueSlider.d.ts +0 -7
- package/dist/ColorPicker/HueSlider.js +0 -7
- package/dist/ColorPicker/Predefine.d.ts +0 -7
- package/dist/ColorPicker/Predefine.js +0 -7
- package/dist/ColorPicker/SvPanel.d.ts +0 -7
- package/dist/ColorPicker/SvPanel.js +0 -7
- package/dist/DateTimePicker/DateTimePicker.d.ts +1 -1
- package/dist/Descriptions/Descriptions.d.ts +2 -2
- package/dist/Descriptions/Descriptions.js +7 -6
- package/dist/Descriptions/DescriptionsCell.d.ts +11 -12
- package/dist/Descriptions/DescriptionsCell.js +13 -6
- package/dist/Descriptions/DescriptionsItem.js +1 -1
- package/dist/Descriptions/DescriptionsRow.d.ts +2 -5
- package/dist/Descriptions/DescriptionsRow.js +11 -4
- package/dist/Dialog/Dialog.js +5 -6
- package/dist/Dialog/DialogContext.d.ts +1 -1
- package/dist/Dialog/DialogContext.js +1 -1
- package/dist/Drawer/Drawer.d.ts +2 -5
- package/dist/Drawer/Drawer.js +98 -35
- package/dist/Drawer/DrawerBody.js +6 -12
- package/dist/Drawer/DrawerContext.d.ts +1 -13
- package/dist/Drawer/DrawerContext.js +1 -11
- package/dist/Drawer/DrawerHeader.js +5 -18
- package/dist/Drawer/typings.d.ts +31 -10
- package/dist/Dropdown/Dropdown.js +7 -7
- package/dist/Dropdown/DropdownItem.js +1 -1
- package/dist/Dropdown/DropdownMenu.d.ts +5 -2
- package/dist/Dropdown/DropdownMenu.js +5 -3
- package/dist/Dropdown/typings.d.ts +3 -1
- package/dist/MessageBox/MessageBox.js +6 -1
- package/dist/MessageBox/index.d.ts +3 -3
- package/dist/Notification/Notification.js +6 -3
- package/dist/Notification/index.d.ts +0 -8
- package/dist/Notification/index.js +0 -9
- package/dist/Notification/typings.d.ts +0 -2
- package/dist/Pagination/Options.js +2 -1
- package/dist/Popconfirm/Popconfirm.d.ts +3 -2
- package/dist/Popconfirm/Popconfirm.js +15 -8
- package/dist/Popconfirm/typings.d.ts +2 -1
- package/dist/Popover/Popover.js +7 -5
- package/dist/Popover/typings.d.ts +1 -1
- package/dist/Select/Option.js +1 -1
- package/dist/Select/OptionGroup.js +1 -1
- package/dist/Select/Select.d.ts +3 -15
- package/dist/Select/Select.js +3 -9
- package/dist/Select/SelectCore.js +52 -27
- package/dist/Select/index.d.ts +1 -0
- package/dist/Select/index.js +1 -0
- package/dist/Select/typings.d.ts +13 -1
- package/dist/Skeleton/PlaceholderGraph.d.ts +1 -1
- package/dist/Skeleton/PlaceholderGraph.js +3 -3
- package/dist/Skeleton/PlaceholderGrid.d.ts +1 -1
- package/dist/Skeleton/PlaceholderGrid.js +3 -3
- package/dist/Skeleton/PlaceholderParagraph.d.ts +2 -2
- package/dist/Skeleton/PlaceholderParagraph.js +13 -8
- package/dist/Skeleton/Skeleton.d.ts +2 -9
- package/dist/Skeleton/Skeleton.js +94 -7
- package/dist/Skeleton/SkeletonContext.d.ts +17 -0
- package/dist/Skeleton/SkeletonContext.js +5 -0
- package/dist/Skeleton/SkeletonItem.d.ts +4 -0
- package/dist/Skeleton/SkeletonItem.js +47 -0
- package/dist/Skeleton/index.d.ts +2 -3
- package/dist/Skeleton/index.js +2 -1
- package/dist/Skeleton/typings.d.ts +29 -0
- package/dist/Skeleton/typings.js +1 -0
- package/dist/Table/TableColumn.js +2 -2
- package/dist/Table/TableHeaderCell.js +16 -16
- package/dist/Table/hooks/useTable.d.ts +0 -7
- package/dist/Table/hooks/useTable.js +1 -9
- package/dist/Table/typings.d.ts +1 -1
- package/dist/Tabs/TabPane.js +1 -1
- package/dist/Tabs/Tabs.d.ts +2 -2
- package/dist/Tabs/Tabs.js +8 -4
- package/dist/Tabs/typings.d.ts +2 -0
- package/dist/Tag/Tag.d.ts +1 -1
- package/dist/Tag/Tag.js +5 -5
- package/dist/Tag/typings.d.ts +1 -1
- package/dist/TimeLine/TimeLine.js +1 -0
- package/dist/TimeLine/TimeLineItem.js +1 -0
- package/dist/TimeLine/typings.d.ts +2 -2
- package/dist/TimePicker/useTimePicker.d.ts +0 -7
- package/dist/TimePicker/useTimePicker.js +1 -8
- package/dist/Upload/use-handlers.d.ts +1 -1
- package/dist/hooks/animationPropsUtils.d.ts +0 -4
- package/dist/hooks/animationPropsUtils.js +0 -4
- package/dist/hooks/popperPropsUtils.d.ts +0 -4
- package/dist/hooks/popperPropsUtils.js +0 -4
- package/dist/hooks/useChildrenInstance.d.ts +0 -4
- package/dist/hooks/useChildrenInstance.js +0 -4
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/theme-chalk/drawer/index.scss +61 -65
- package/theme-chalk/index.scss +1 -1
- package/theme-chalk/placeholder/index.scss +22 -37
- package/theme-chalk/skeleton/index.scss +120 -0
- package/theme-chalk/tabs/index.scss +3 -3
- package/theme-chalk/tag/index.scss +5 -162
- package/theme-chalk/time-line/_timeline-item.scss +1 -1
package/dist/Drawer/Drawer.js
CHANGED
|
@@ -14,10 +14,10 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
14
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
15
|
import classNames from 'classnames';
|
|
16
16
|
import { addClass, removeClass } from 'dom-lib';
|
|
17
|
-
import React, { forwardRef, useEffect, useRef } from 'react';
|
|
17
|
+
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
18
18
|
import { createPortal } from 'react-dom';
|
|
19
19
|
import Transition from "../Transition/Transition";
|
|
20
|
-
import { PopupManager, mergeDefaultProps } from "../Util";
|
|
20
|
+
import { PopupManager, addUnit, mergeDefaultProps } from "../Util";
|
|
21
21
|
import { useClassNames, useControlled } from "../hooks";
|
|
22
22
|
import { namespace } from "../hooks/prefix";
|
|
23
23
|
import DrawerBody from "./DrawerBody";
|
|
@@ -26,26 +26,46 @@ import DrawerFooter from "./DrawerFooter";
|
|
|
26
26
|
import DrawerHeader from "./DrawerHeader";
|
|
27
27
|
function InternalComp(props, ref) {
|
|
28
28
|
props = mergeDefaultProps({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
direction: 'right',
|
|
30
|
+
modal: true,
|
|
31
|
+
closeOnClickModal: true,
|
|
32
|
+
withHeader: true,
|
|
33
|
+
lockScroll: true,
|
|
34
|
+
size: '30%'
|
|
32
35
|
}, props);
|
|
33
36
|
var _props = props,
|
|
34
|
-
|
|
37
|
+
modal = _props.modal,
|
|
38
|
+
closeOnClickModal = _props.closeOnClickModal,
|
|
39
|
+
title = _props.title,
|
|
40
|
+
withHeader = _props.withHeader,
|
|
35
41
|
size = _props.size,
|
|
36
|
-
|
|
42
|
+
direction = _props.direction,
|
|
37
43
|
children = _props.children,
|
|
38
|
-
|
|
44
|
+
close = _props.close,
|
|
45
|
+
beforeClose = _props.beforeClose,
|
|
46
|
+
showClose = _props.showClose,
|
|
47
|
+
border = _props.border,
|
|
39
48
|
_props$classPrefix = _props.classPrefix,
|
|
40
|
-
classPrefix = _props$classPrefix === void 0 ? 'drawer' : _props$classPrefix
|
|
49
|
+
classPrefix = _props$classPrefix === void 0 ? 'drawer' : _props$classPrefix,
|
|
50
|
+
lockScroll = _props.lockScroll;
|
|
41
51
|
var _useClassNames = useClassNames(classPrefix),
|
|
42
52
|
b = _useClassNames.b,
|
|
43
53
|
wb = _useClassNames.wb;
|
|
44
54
|
var _useControlled = useControlled(props.visible, props.defaultVisible),
|
|
45
|
-
_useControlled2 = _slicedToArray(_useControlled,
|
|
55
|
+
_useControlled2 = _slicedToArray(_useControlled, 2),
|
|
46
56
|
visible = _useControlled2[0],
|
|
47
|
-
setVisible = _useControlled2[1]
|
|
48
|
-
|
|
57
|
+
setVisible = _useControlled2[1];
|
|
58
|
+
var sizeStyle = useMemo(function () {
|
|
59
|
+
if (['left', 'right'].includes(direction)) {
|
|
60
|
+
return {
|
|
61
|
+
'--el-drawer-width': addUnit(size)
|
|
62
|
+
};
|
|
63
|
+
} else if (['top', 'bottom'].includes(direction)) {
|
|
64
|
+
return {
|
|
65
|
+
'--el-drawer-height': addUnit(size)
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}, [direction, size]);
|
|
49
69
|
|
|
50
70
|
// 模态框容器div
|
|
51
71
|
var wrapperRef = useRef(null);
|
|
@@ -53,11 +73,36 @@ function InternalComp(props, ref) {
|
|
|
53
73
|
var drawerRef = useRef(null);
|
|
54
74
|
// 遮罩div
|
|
55
75
|
var backdropRef = useRef(null);
|
|
76
|
+
var _useState = useState({
|
|
77
|
+
modal: 1,
|
|
78
|
+
drawer: 1
|
|
79
|
+
}),
|
|
80
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
81
|
+
zIndex = _useState2[0],
|
|
82
|
+
setZIndex = _useState2[1];
|
|
83
|
+
var doClose = useCallback(function () {
|
|
84
|
+
if (beforeClose) {
|
|
85
|
+
beforeClose === null || beforeClose === void 0 || beforeClose(function (value) {
|
|
86
|
+
if (value) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
setVisible(false);
|
|
90
|
+
close === null || close === void 0 || close();
|
|
91
|
+
});
|
|
92
|
+
} else {
|
|
93
|
+
setVisible(false);
|
|
94
|
+
close === null || close === void 0 || close();
|
|
95
|
+
}
|
|
96
|
+
}, [beforeClose, close, setVisible]);
|
|
56
97
|
|
|
57
98
|
/**关闭对话框 */
|
|
58
99
|
useEffect(function () {
|
|
59
100
|
if (visible) {
|
|
60
101
|
var _ref$current;
|
|
102
|
+
setZIndex({
|
|
103
|
+
modal: PopupManager.nextZIndex(),
|
|
104
|
+
drawer: PopupManager.nextZIndex()
|
|
105
|
+
});
|
|
61
106
|
var mousedown;
|
|
62
107
|
var shadowRef = (_ref$current = ref === null || ref === void 0 ? void 0 : ref.current) !== null && _ref$current !== void 0 ? _ref$current : wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current;
|
|
63
108
|
shadowRef === null || shadowRef === void 0 || shadowRef.addEventListener('mousedown', function (e) {
|
|
@@ -72,10 +117,9 @@ function InternalComp(props, ref) {
|
|
|
72
117
|
if (isTargetExists || isContainedByPopper) {
|
|
73
118
|
return;
|
|
74
119
|
}
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
} else if (backdrop === 'static') {
|
|
120
|
+
if (closeOnClickModal) {
|
|
121
|
+
doClose();
|
|
122
|
+
} else {
|
|
79
123
|
addClass(drawerRef.current, "".concat(namespace, "-drawer-shake"));
|
|
80
124
|
setTimeout(function () {
|
|
81
125
|
removeClass(drawerRef.current, "".concat(namespace, "-drawer-shake"));
|
|
@@ -83,15 +127,12 @@ function InternalComp(props, ref) {
|
|
|
83
127
|
}
|
|
84
128
|
});
|
|
85
129
|
}
|
|
86
|
-
}, [b,
|
|
130
|
+
}, [b, closeOnClickModal, modal, close, ref, setVisible, visible, doClose]);
|
|
87
131
|
return /*#__PURE__*/React.createElement(DrawerContext.Provider, {
|
|
88
132
|
value: {
|
|
89
|
-
|
|
90
|
-
setVisible: setVisible,
|
|
91
|
-
isControlled: isControlled,
|
|
92
|
-
onClose: onClose
|
|
133
|
+
doClose: doClose
|
|
93
134
|
}
|
|
94
|
-
},
|
|
135
|
+
}, modal && /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(Transition, {
|
|
95
136
|
nodeRef: backdropRef,
|
|
96
137
|
visible: visible,
|
|
97
138
|
transitionAppear: true,
|
|
@@ -108,7 +149,7 @@ function InternalComp(props, ref) {
|
|
|
108
149
|
}, /*#__PURE__*/React.createElement("div", {
|
|
109
150
|
className: classNames(b(_templateObject || (_templateObject = _taggedTemplateLiteral(["backdrop"]))), "".concat(namespace, "-anim-fade")),
|
|
110
151
|
style: {
|
|
111
|
-
zIndex:
|
|
152
|
+
zIndex: zIndex.modal
|
|
112
153
|
},
|
|
113
154
|
ref: backdropRef
|
|
114
155
|
})), document.body), /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(Transition, {
|
|
@@ -121,38 +162,60 @@ function InternalComp(props, ref) {
|
|
|
121
162
|
var _props$onOpen, _props2, _props$onEnter, _props3;
|
|
122
163
|
(_props$onOpen = (_props2 = props).onOpen) === null || _props$onOpen === void 0 || _props$onOpen.call(_props2);
|
|
123
164
|
(_props$onEnter = (_props3 = props).onEnter) === null || _props$onEnter === void 0 || _props$onEnter.call(_props3);
|
|
165
|
+
if (lockScroll) {
|
|
166
|
+
addClass(document.body, b('popup-parent--hidden', false));
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
afterEnter: function afterEnter() {
|
|
170
|
+
var _props$afterEnter, _props4, _props$onOpened, _props5;
|
|
171
|
+
(_props$afterEnter = (_props4 = props).afterEnter) === null || _props$afterEnter === void 0 || _props$afterEnter.call(_props4);
|
|
172
|
+
(_props$onOpened = (_props5 = props).onOpened) === null || _props$onOpened === void 0 || _props$onOpened.call(_props5);
|
|
124
173
|
},
|
|
125
174
|
beforeLeave: function beforeLeave() {
|
|
126
|
-
var _props$beforeLeave,
|
|
175
|
+
var _props$beforeLeave, _props6;
|
|
127
176
|
removeClass(drawerRef.current, "".concat(namespace, "-anim-slide-in"));
|
|
128
177
|
addClass(drawerRef.current, "".concat(namespace, "-anim-slide-out"));
|
|
129
|
-
(_props$beforeLeave = (
|
|
178
|
+
(_props$beforeLeave = (_props6 = props).beforeLeave) === null || _props$beforeLeave === void 0 || _props$beforeLeave.call(_props6);
|
|
179
|
+
},
|
|
180
|
+
onLeave: function onLeave() {
|
|
181
|
+
var _props$onClose, _props7, _props$onLeave, _props8;
|
|
182
|
+
(_props$onClose = (_props7 = props).onClose) === null || _props$onClose === void 0 || _props$onClose.call(_props7);
|
|
183
|
+
(_props$onLeave = (_props8 = props).onLeave) === null || _props$onLeave === void 0 || _props$onLeave.call(_props8);
|
|
184
|
+
},
|
|
185
|
+
afterLeave: function afterLeave() {
|
|
186
|
+
var _props$afterLeave, _props9, _props$onClosed, _props10;
|
|
187
|
+
(_props$afterLeave = (_props9 = props).afterLeave) === null || _props$afterLeave === void 0 || _props$afterLeave.call(_props9);
|
|
188
|
+
(_props$onClosed = (_props10 = props).onClosed) === null || _props$onClosed === void 0 || _props$onClosed.call(_props10);
|
|
189
|
+
if (lockScroll) {
|
|
190
|
+
removeClass(document.body, b('popup-parent--hidden', false));
|
|
191
|
+
}
|
|
130
192
|
},
|
|
131
|
-
onLeave: props.onLeave,
|
|
132
|
-
afterLeave: props.afterLeave,
|
|
133
193
|
duration: 300
|
|
134
194
|
}, /*#__PURE__*/React.createElement("div", {
|
|
135
195
|
className: classNames(b(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["wrapper"]))), props.className),
|
|
136
196
|
style: _objectSpread(_objectSpread({}, props.style), {}, {
|
|
137
|
-
zIndex:
|
|
197
|
+
zIndex: zIndex.drawer
|
|
138
198
|
}),
|
|
139
199
|
ref: ref || wrapperRef
|
|
140
200
|
}, /*#__PURE__*/React.createElement("div", {
|
|
141
|
-
className: classNames(wb(
|
|
142
|
-
style: {
|
|
201
|
+
className: classNames(wb(direction), "".concat(namespace, "-anim-slide-in"), "".concat(namespace, "-anim-").concat(direction)),
|
|
202
|
+
style: _objectSpread({
|
|
143
203
|
display: 'block'
|
|
144
|
-
},
|
|
204
|
+
}, sizeStyle),
|
|
145
205
|
ref: drawerRef
|
|
146
206
|
}, /*#__PURE__*/React.createElement("div", {
|
|
147
207
|
className: b(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["dialog"])))
|
|
148
208
|
}, /*#__PURE__*/React.createElement("div", {
|
|
149
209
|
className: b(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["content"])))
|
|
150
|
-
},
|
|
210
|
+
}, withHeader ? /*#__PURE__*/React.createElement(DrawerHeader, {
|
|
211
|
+
classPrefix: classPrefix,
|
|
212
|
+
showClose: showClose,
|
|
213
|
+
border: border
|
|
214
|
+
}, title) : null, children))))), document.body));
|
|
151
215
|
}
|
|
152
216
|
var Comp = /*#__PURE__*/forwardRef(InternalComp);
|
|
153
217
|
var Drawer = Comp;
|
|
154
|
-
Drawer.
|
|
155
|
-
Drawer.
|
|
156
|
-
Drawer.Footer = DrawerFooter;
|
|
218
|
+
Drawer.body = DrawerBody;
|
|
219
|
+
Drawer.footer = DrawerFooter;
|
|
157
220
|
Drawer.displayName = 'Drawer';
|
|
158
221
|
export default Drawer;
|
|
@@ -5,9 +5,7 @@ import Scrollbar from "../Scrollbar/Scrollbar";
|
|
|
5
5
|
import { useClassNames } from "../hooks";
|
|
6
6
|
var DrawerBody = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
7
7
|
var _props$classPrefix = props.classPrefix,
|
|
8
|
-
classPrefix = _props$classPrefix === void 0 ? 'drawer-body' : _props$classPrefix
|
|
9
|
-
_props$padding = props.padding,
|
|
10
|
-
padding = _props$padding === void 0 ? '0 20px' : _props$padding;
|
|
8
|
+
classPrefix = _props$classPrefix === void 0 ? 'drawer-body' : _props$classPrefix;
|
|
11
9
|
var _useClassNames = useClassNames(classPrefix),
|
|
12
10
|
b = _useClassNames.b;
|
|
13
11
|
var scrollbarInstance = useRef(null);
|
|
@@ -22,17 +20,13 @@ var DrawerBody = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
22
20
|
};
|
|
23
21
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24
22
|
}, []);
|
|
25
|
-
return /*#__PURE__*/React.createElement(
|
|
23
|
+
return /*#__PURE__*/React.createElement(Scrollbar, {
|
|
24
|
+
ref: scrollbarInstance
|
|
25
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
26
26
|
className: classNames(b(), props.className),
|
|
27
27
|
ref: ref,
|
|
28
28
|
style: props.style
|
|
29
|
-
},
|
|
30
|
-
ref: scrollbarInstance
|
|
31
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
32
|
-
style: {
|
|
33
|
-
padding: padding
|
|
34
|
-
}
|
|
35
|
-
}, props.children)));
|
|
29
|
+
}, props.children));
|
|
36
30
|
});
|
|
37
|
-
DrawerBody.displayName = '
|
|
31
|
+
DrawerBody.displayName = 'ElDrawerBody';
|
|
38
32
|
export default DrawerBody;
|
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
interface DrawerContentProps {
|
|
3
|
-
/** 当设置为 true,Drawer 打开时会显示背景,点击背景会关闭 Drawer,如果不想关闭 Drawer,可以设置为 'static' */
|
|
4
|
-
backdrop: boolean | 'static';
|
|
5
|
-
setVisible: (visible: boolean) => void;
|
|
6
3
|
/** 隐藏时的回调函数 */
|
|
7
|
-
|
|
8
|
-
/** 是否可控 */
|
|
9
|
-
isControlled: boolean;
|
|
4
|
+
doClose: () => void;
|
|
10
5
|
}
|
|
11
|
-
/**
|
|
12
|
-
* @author Parker
|
|
13
|
-
* @CreateTime 2022/3/20下午3:10:40
|
|
14
|
-
* @LastEditor Parker
|
|
15
|
-
* @ModifyTime 2022/5/3 22:55:13
|
|
16
|
-
* @Description 模态框上下文
|
|
17
|
-
*/
|
|
18
6
|
export declare const DrawerContext: import("react").Context<DrawerContentProps>;
|
|
19
7
|
export {};
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import noop from 'lodash/noop';
|
|
2
2
|
import { createContext } from 'react';
|
|
3
|
-
/**
|
|
4
|
-
* @author Parker
|
|
5
|
-
* @CreateTime 2022/3/20下午3:10:40
|
|
6
|
-
* @LastEditor Parker
|
|
7
|
-
* @ModifyTime 2022/5/3 22:55:13
|
|
8
|
-
* @Description 模态框上下文
|
|
9
|
-
*/
|
|
10
3
|
export var DrawerContext = /*#__PURE__*/createContext({
|
|
11
|
-
|
|
12
|
-
setVisible: noop,
|
|
13
|
-
onClose: noop,
|
|
14
|
-
isControlled: false
|
|
4
|
+
doClose: noop
|
|
15
5
|
});
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
var _templateObject, _templateObject2, _templateObject3;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import React, {
|
|
4
|
+
import React, { useContext } from 'react';
|
|
5
5
|
import Icon from "../Icon/Icon";
|
|
6
6
|
import { useClassNames } from "../hooks";
|
|
7
7
|
import { DrawerContext } from "./DrawerContext";
|
|
8
8
|
var DrawerHeader = function DrawerHeader(props) {
|
|
9
|
-
var _props$
|
|
10
|
-
closeButton = _props$
|
|
11
|
-
onCloseHeader = props.onClose,
|
|
9
|
+
var _props$showClose = props.showClose,
|
|
10
|
+
closeButton = _props$showClose === void 0 ? true : _props$showClose,
|
|
12
11
|
_props$classPrefix = props.classPrefix,
|
|
13
12
|
classPrefix = _props$classPrefix === void 0 ? 'drawer' : _props$classPrefix,
|
|
14
13
|
border = props.border;
|
|
@@ -16,19 +15,7 @@ var DrawerHeader = function DrawerHeader(props) {
|
|
|
16
15
|
b = _useClassNames.b,
|
|
17
16
|
is = _useClassNames.is;
|
|
18
17
|
var _useContext = useContext(DrawerContext),
|
|
19
|
-
|
|
20
|
-
isControlled = _useContext.isControlled,
|
|
21
|
-
onClose = _useContext.onClose;
|
|
22
|
-
|
|
23
|
-
/**关闭对话框 */
|
|
24
|
-
var handleCloseDialog = useCallback(function () {
|
|
25
|
-
if (isControlled) {
|
|
26
|
-
onClose === null || onClose === void 0 || onClose();
|
|
27
|
-
onCloseHeader === null || onCloseHeader === void 0 || onCloseHeader();
|
|
28
|
-
} else {
|
|
29
|
-
setVisible(false);
|
|
30
|
-
}
|
|
31
|
-
}, [isControlled, onClose, onCloseHeader, setVisible]);
|
|
18
|
+
doClose = _useContext.doClose;
|
|
32
19
|
return /*#__PURE__*/React.createElement("div", {
|
|
33
20
|
className: classNames(b(_templateObject || (_templateObject = _taggedTemplateLiteral(["header"]))), props.className, is({
|
|
34
21
|
border: border
|
|
@@ -39,7 +26,7 @@ var DrawerHeader = function DrawerHeader(props) {
|
|
|
39
26
|
style: props.titleStyle
|
|
40
27
|
}, props.children), closeButton && /*#__PURE__*/React.createElement("span", {
|
|
41
28
|
className: b(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["header-close"]))),
|
|
42
|
-
onClick:
|
|
29
|
+
onClick: doClose
|
|
43
30
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
44
31
|
name: 'xmark'
|
|
45
32
|
})));
|
package/dist/Drawer/typings.d.ts
CHANGED
|
@@ -1,26 +1,48 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AnimationEventProps, BaseProps, NativeProps } from '../types/common';
|
|
3
|
-
export interface DrawerProps extends AnimationEventProps, BaseProps, NativeProps {
|
|
3
|
+
export interface DrawerProps extends AnimationEventProps, BaseProps, NativeProps<'--el-drawer-width' | '--el-drawer-height' | '--el-drawer-margin-top' | '--el-drawer-bg-color' | '--el-drawer-box-shadow' | '--el-drawer-title-font-size' | '--el-drawer-content-font-size' | '--el-drawer-font-line-height' | '--el-drawer-padding-primary' | '--el-drawer-border-radius'> {
|
|
4
4
|
/** 是否显示抽屉(可控) */
|
|
5
5
|
visible?: boolean;
|
|
6
6
|
/** 默认是否显示抽屉 */
|
|
7
7
|
defaultVisible?: boolean;
|
|
8
8
|
/** 当设置为 true,Drawer 打开时会显示背景,点击背景会关闭 Drawer,如果不想关闭 Drawer,可以设置为 'static' */
|
|
9
|
-
|
|
9
|
+
modal?: boolean;
|
|
10
|
+
/** 是否可以通过点击 modal 关闭 Drawer */
|
|
11
|
+
closeOnClickModal?: boolean;
|
|
12
|
+
/** 是否在 Drawer 出现时将 body 滚动锁定 */
|
|
13
|
+
lockScroll?: boolean;
|
|
10
14
|
/** 应用于 backdrop DOM 节点的 css class */
|
|
11
|
-
|
|
15
|
+
modalClassName?: string;
|
|
16
|
+
/** Drawer 对话框 Drawer 的标题 */
|
|
17
|
+
title?: string | React.ReactElement;
|
|
18
|
+
/** 控制是否显示 header 栏, 默认为 true, 当此项为 false 时, title 属性不生效 */
|
|
19
|
+
withHeader?: boolean;
|
|
20
|
+
/** 当设置为 true, 显示关闭按钮 */
|
|
21
|
+
showClose?: boolean;
|
|
22
|
+
/** 标题是否有边框 */
|
|
23
|
+
border?: boolean;
|
|
12
24
|
/** 设置 Drawer 尺寸 */
|
|
13
|
-
size?:
|
|
25
|
+
size?: number | string;
|
|
14
26
|
/** 设置 Drawer 显示的位置 */
|
|
15
|
-
|
|
16
|
-
/**
|
|
27
|
+
direction?: 'top' | 'bottom' | 'right' | 'left';
|
|
28
|
+
/** Drawer 打开的回调 */
|
|
17
29
|
onOpen?: () => void;
|
|
18
|
-
/**
|
|
30
|
+
/** Drawer 打开动画结束时的回调 */
|
|
31
|
+
onOpened?: () => void;
|
|
32
|
+
/** Drawer 关闭的回调 */
|
|
19
33
|
onClose?: () => void;
|
|
34
|
+
/** Drawer 关闭动画结束时的回调 */
|
|
35
|
+
onClosed?: () => void;
|
|
36
|
+
/** 关闭弹窗函数 */
|
|
37
|
+
close: () => void;
|
|
38
|
+
/** 关闭前的回调,会暂停 Drawer 的关闭. 回调函数内执行 done 参数方法的时候才是真正关闭对话框的时候. */
|
|
39
|
+
beforeClose?: DrawerBeforeCloseFn;
|
|
20
40
|
}
|
|
41
|
+
type DoneFn = (cancel?: boolean) => void;
|
|
42
|
+
export type DrawerBeforeCloseFn = (done: DoneFn) => void;
|
|
21
43
|
export interface DrawerHeaderProps extends BaseProps, NativeProps {
|
|
22
44
|
/** 当设置为 true, 显示关闭按钮 */
|
|
23
|
-
|
|
45
|
+
showClose?: boolean;
|
|
24
46
|
/** 标题是否有边框 */
|
|
25
47
|
border?: boolean;
|
|
26
48
|
/** 组件 CSS 类的前缀 */
|
|
@@ -33,10 +55,9 @@ export interface DrawerHeaderProps extends BaseProps, NativeProps {
|
|
|
33
55
|
export interface DrawerBodyProps extends BaseProps, NativeProps {
|
|
34
56
|
/** 组件 CSS 类的前缀 */
|
|
35
57
|
classPrefix?: string;
|
|
36
|
-
/** 内容区域padding */
|
|
37
|
-
padding?: string | number;
|
|
38
58
|
}
|
|
39
59
|
export interface DrawerFooterProps extends BaseProps, NativeProps {
|
|
40
60
|
/** 组件 CSS 类的前缀 */
|
|
41
61
|
classPrefix?: string;
|
|
42
62
|
}
|
|
63
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var _templateObject;
|
|
2
|
-
var _excluded = ["menu", "classPrefix", "showTimeout", "hideTimeout", "offset", "trigger", "hideOnClick", "onClick", "
|
|
2
|
+
var _excluded = ["menu", "classPrefix", "showTimeout", "hideTimeout", "offset", "trigger", "hideOnClick", "onClick", "onVisiblechange", "onEnter", "onMouseEnter", "onMouseLeave", "disabled"];
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
5
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -34,7 +34,7 @@ var Dropdown = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
34
34
|
trigger = _props.trigger,
|
|
35
35
|
hideOnClick = _props.hideOnClick,
|
|
36
36
|
onClick = _props.onClick,
|
|
37
|
-
|
|
37
|
+
onVisiblechange = _props.onVisiblechange,
|
|
38
38
|
onEnter = _props.onEnter,
|
|
39
39
|
onMouseEnter = _props.onMouseEnter,
|
|
40
40
|
onMouseLeave = _props.onMouseLeave,
|
|
@@ -59,14 +59,14 @@ var Dropdown = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
59
59
|
/** 显示 */
|
|
60
60
|
var handleMouseEnter = useCallback(function (event) {
|
|
61
61
|
onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter(event);
|
|
62
|
-
|
|
63
|
-
}, [onMouseEnter,
|
|
62
|
+
onVisiblechange === null || onVisiblechange === void 0 || onVisiblechange(true);
|
|
63
|
+
}, [onMouseEnter, onVisiblechange]);
|
|
64
64
|
|
|
65
65
|
/** 隐藏 */
|
|
66
66
|
var handleMouseLeave = useCallback(function (event) {
|
|
67
67
|
onMouseLeave === null || onMouseLeave === void 0 || onMouseLeave(event);
|
|
68
|
-
|
|
69
|
-
}, [onMouseLeave,
|
|
68
|
+
onVisiblechange === null || onVisiblechange === void 0 || onVisiblechange(false);
|
|
69
|
+
}, [onMouseLeave, onVisiblechange]);
|
|
70
70
|
useImperativeHandle(ref, function () {
|
|
71
71
|
return {
|
|
72
72
|
ref: containerRef,
|
|
@@ -101,5 +101,5 @@ var Dropdown = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
101
101
|
unmountOnExit: true
|
|
102
102
|
}, popperProps, transitionProps)));
|
|
103
103
|
});
|
|
104
|
-
Dropdown.displayName = '
|
|
104
|
+
Dropdown.displayName = 'ElDropdown';
|
|
105
105
|
export default Dropdown;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { DropdownMenuProps } from './typings';
|
|
3
|
-
declare const DropdownMenu:
|
|
3
|
+
declare const DropdownMenu: {
|
|
4
|
+
(props: DropdownMenuProps): React.JSX.Element;
|
|
5
|
+
displayName: string;
|
|
6
|
+
};
|
|
4
7
|
export default DropdownMenu;
|
|
@@ -8,7 +8,8 @@ import { TooltipContext } from "../Tooltip/TooltipContext";
|
|
|
8
8
|
import { useClassNames } from "../hooks";
|
|
9
9
|
var DropdownMenu = function DropdownMenu(props) {
|
|
10
10
|
var _props$classPrefix = props.classPrefix,
|
|
11
|
-
classPrefix = _props$classPrefix === void 0 ? 'dropdown' : _props$classPrefix
|
|
11
|
+
classPrefix = _props$classPrefix === void 0 ? 'dropdown' : _props$classPrefix,
|
|
12
|
+
maxHeight = props.maxHeight;
|
|
12
13
|
var _useClassNames = useClassNames(classPrefix),
|
|
13
14
|
b = _useClassNames.b,
|
|
14
15
|
e = _useClassNames.e;
|
|
@@ -17,7 +18,8 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
17
18
|
onMouseLeave = _useContext.onMouseLeave,
|
|
18
19
|
trigger = _useContext.trigger;
|
|
19
20
|
return /*#__PURE__*/React.createElement(Scrollbar, {
|
|
20
|
-
viewClass: e(_templateObject || (_templateObject = _taggedTemplateLiteral(["list"])))
|
|
21
|
+
viewClass: e(_templateObject || (_templateObject = _taggedTemplateLiteral(["list"]))),
|
|
22
|
+
height: maxHeight
|
|
21
23
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
22
24
|
onMouseEnter: trigger === 'hover' ? onMouseEnter : noop,
|
|
23
25
|
onMouseLeave: trigger === 'hover' ? onMouseLeave : noop,
|
|
@@ -25,5 +27,5 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
25
27
|
style: props.style
|
|
26
28
|
}, props.children));
|
|
27
29
|
};
|
|
28
|
-
DropdownMenu.displayName = '
|
|
30
|
+
DropdownMenu.displayName = 'ElDropdownMenu';
|
|
29
31
|
export default DropdownMenu;
|
|
@@ -24,10 +24,12 @@ export interface DropdownProps extends BaseProps<React.ReactElement>, NativeProp
|
|
|
24
24
|
/** 点击菜单项触发的事件回调 */
|
|
25
25
|
onClick?: (command: string | number | object) => void;
|
|
26
26
|
/** 下拉框出现/隐藏时触发: 出现则为 true,隐藏则为 false */
|
|
27
|
-
|
|
27
|
+
onVisiblechange?: (visible: boolean) => void;
|
|
28
28
|
}
|
|
29
29
|
export interface DropdownMenuProps extends BaseProps, NativeProps {
|
|
30
30
|
classPrefix?: string;
|
|
31
|
+
/** 菜单最大高度 */
|
|
32
|
+
maxHeight?: number;
|
|
31
33
|
}
|
|
32
34
|
/** Dropdown-Item 属性 */
|
|
33
35
|
export interface DropdownItemProps extends BaseProps, NativeProps {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
3
|
-
var _excluded = ["title", "message", "type", "icon", "width", "callback", "showClose", "beforeClose", "showCancelButton", "showConfirmButton", "cancelButtonText", "cancelButtonClass", "confirmButtonClass", "buttonSize", "buttonPosition", "overflow", "showInput", "inputType", "inputPlaceholder", "inputPattern", "inputErrorMessage", "inputValidator", "distinguishCancelAndClose", "classPrefix", "className", "style", "padding"];
|
|
3
|
+
var _excluded = ["title", "message", "type", "icon", "width", "callback", "showClose", "beforeClose", "showCancelButton", "showConfirmButton", "cancelButtonText", "cancelButtonClass", "confirmButtonClass", "buttonSize", "buttonPosition", "draggable", "overflow", "showInput", "inputType", "inputPlaceholder", "inputPattern", "inputErrorMessage", "inputValidator", "distinguishCancelAndClose", "classPrefix", "className", "style", "padding", "roundButton"];
|
|
4
4
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -51,6 +51,7 @@ var MessageBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (props, ref
|
|
|
51
51
|
buttonSize = options.buttonSize,
|
|
52
52
|
_options$buttonPositi = options.buttonPosition,
|
|
53
53
|
buttonPosition = _options$buttonPositi === void 0 ? 'right' : _options$buttonPositi,
|
|
54
|
+
draggable = options.draggable,
|
|
54
55
|
overflow = options.overflow,
|
|
55
56
|
showInput = options.showInput,
|
|
56
57
|
inputType = options.inputType,
|
|
@@ -64,6 +65,7 @@ var MessageBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (props, ref
|
|
|
64
65
|
className = options.className,
|
|
65
66
|
style = options.style,
|
|
66
67
|
padding = options.padding,
|
|
68
|
+
roundButton = options.roundButton,
|
|
67
69
|
rest = _objectWithoutProperties(options, _excluded);
|
|
68
70
|
var _useClassNames = useClassNames(classPrefix),
|
|
69
71
|
e = _useClassNames.e,
|
|
@@ -220,6 +222,7 @@ var MessageBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (props, ref
|
|
|
220
222
|
,
|
|
221
223
|
style: _objectSpread(_objectSpread({}, style), {}, _defineProperty({}, "--".concat(namespace, "-messagebox-width"), addUnit(width))),
|
|
222
224
|
modal: true,
|
|
225
|
+
draggable: draggable,
|
|
223
226
|
overflow: overflow,
|
|
224
227
|
showClose: showClose,
|
|
225
228
|
title: title,
|
|
@@ -252,6 +255,7 @@ var MessageBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (props, ref
|
|
|
252
255
|
}, showCancelButton && /*#__PURE__*/React.createElement(Button, {
|
|
253
256
|
className: cancelButtonClass,
|
|
254
257
|
size: buttonSize,
|
|
258
|
+
round: roundButton,
|
|
255
259
|
onClick: function onClick() {
|
|
256
260
|
return handleAction('cancel');
|
|
257
261
|
}
|
|
@@ -259,6 +263,7 @@ var MessageBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (props, ref
|
|
|
259
263
|
className: confirmButtonClass,
|
|
260
264
|
type: "primary",
|
|
261
265
|
size: buttonSize,
|
|
266
|
+
round: roundButton,
|
|
262
267
|
loading: confirmButtonLoading,
|
|
263
268
|
onClick: function onClick() {
|
|
264
269
|
return handleAction('confirm');
|
|
@@ -9,7 +9,7 @@ export declare const MessageBox: {
|
|
|
9
9
|
* @param options 其他设置项
|
|
10
10
|
* @returns
|
|
11
11
|
*/
|
|
12
|
-
alert: (message: string | React.ReactElement, title
|
|
12
|
+
alert: (message: string | React.ReactElement, title?: string | React.ReactElement | MessageBoxProps, options?: MessageBoxProps) => Promise<Action>;
|
|
13
13
|
/**
|
|
14
14
|
* 确认消息
|
|
15
15
|
* @param message 消息内容
|
|
@@ -17,7 +17,7 @@ export declare const MessageBox: {
|
|
|
17
17
|
* @param options 其他设置项
|
|
18
18
|
* @returns
|
|
19
19
|
*/
|
|
20
|
-
confirm: (message: string | React.ReactElement, title
|
|
21
|
-
prompt: (message: string | React.ReactElement, title
|
|
20
|
+
confirm: (message: string | React.ReactElement, title?: string | React.ReactElement | MessageBoxProps, options?: MessageBoxProps) => Promise<Action>;
|
|
21
|
+
prompt: (message: string | React.ReactElement, title?: string | React.ReactElement | MessageBoxProps, options?: MessageBoxProps) => Promise<MessageBoxInputData>;
|
|
22
22
|
};
|
|
23
23
|
export type { Action as MessageBoxAction, MessageBoxMethod, MessageBoxProps, MessageBoxRef } from './typings';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
5
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
@@ -144,12 +146,13 @@ var Notification = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
144
146
|
afterLeave: afterLeave
|
|
145
147
|
}, /*#__PURE__*/React.createElement("div", {
|
|
146
148
|
ref: notificationRef,
|
|
147
|
-
className: classNames(b(), position.indexOf('right') > 1 ? 'right' : 'left'),
|
|
148
|
-
style: _defineProperty(_defineProperty({}, verticalProperty, offset), "zIndex", PopupManager.nextZIndex())
|
|
149
|
+
className: classNames(b(), position.indexOf('right') > 1 ? 'right' : 'left', props.className),
|
|
150
|
+
style: _objectSpread(_defineProperty(_defineProperty({}, verticalProperty, offset), "zIndex", PopupManager.nextZIndex()), props.style)
|
|
149
151
|
// 鼠标悬浮停止自动关闭
|
|
150
152
|
,
|
|
151
153
|
onMouseEnter: clearTimer,
|
|
152
|
-
onMouseLeave: startTimer
|
|
154
|
+
onMouseLeave: startTimer,
|
|
155
|
+
onClick: props.onClick
|
|
153
156
|
}, (type || iconClass) && /*#__PURE__*/React.createElement("i", {
|
|
154
157
|
className: classNames(e(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["icon"]))), typeClass, iconClass)
|
|
155
158
|
}), /*#__PURE__*/React.createElement("div", {
|
|
@@ -1,12 +1,4 @@
|
|
|
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
|
-
*/
|
|
10
2
|
export declare const Notification: INotification;
|
|
11
3
|
/**
|
|
12
4
|
*
|
|
@@ -16,15 +16,6 @@ var notifications = {
|
|
|
16
16
|
// the gap size between each notification
|
|
17
17
|
var GAP_SIZE = 16;
|
|
18
18
|
var seed = 1;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* 通知组件
|
|
22
|
-
* @author Parker
|
|
23
|
-
* @CreateTime 2022/3/10 12:45:48
|
|
24
|
-
* @LastEditor Parker
|
|
25
|
-
* @ModifyTime 2022/5/3 13:43:28
|
|
26
|
-
* @Description Element Plus 通知组件魔改过来的,源代码见:https://github.com/element-plus/element-plus
|
|
27
|
-
*/
|
|
28
19
|
export var Notification = function Notification(options) {
|
|
29
20
|
var _ref$current, _ref$current2;
|
|
30
21
|
var position = options.position || 'top-right';
|