linkmore-design 1.0.50 → 1.0.54
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/Alert/ErrorBoundary.d.ts +22 -0
- package/dist/{Notification → Alert}/demos/basic.d.ts +0 -0
- package/dist/{Notification/demos/button.d.ts → Alert/demos/visible.d.ts} +0 -0
- package/dist/Alert/index.d.ts +41 -0
- package/dist/{Notification → Alert}/style/index.d.ts +0 -0
- package/dist/Button/style/index.d.ts +1 -1
- package/dist/CardTable/fns/index.d.ts +7 -3
- package/dist/CardTable/{toolbar → pager}/TablePagination.d.ts +0 -0
- package/dist/CardTable/pager/index.d.ts +3 -0
- package/dist/LmEditTable/style/index.d.ts +1 -1
- package/dist/LmFilter/LmFilter.d.ts +3 -0
- package/dist/LmFilter/baseFilter/index.d.ts +3 -0
- package/dist/LmFilter/clearFilter/index.d.ts +3 -0
- package/dist/LmFilter/complexFilter/index.d.ts +2 -0
- package/dist/LmFilter/components/CascaderFilter.d.ts +5 -0
- package/dist/LmFilter/components/CheckboxFilter.d.ts +5 -0
- package/dist/LmFilter/components/DateFilter.d.ts +5 -0
- package/dist/LmFilter/components/DropdownFIlter.d.ts +3 -0
- package/dist/LmFilter/components/EmptyFilter.d.ts +2 -0
- package/dist/LmFilter/components/InputFilter.d.ts +4 -0
- package/dist/LmFilter/components/InputSearchClose.d.ts +3 -0
- package/dist/LmFilter/components/SelectFilter.d.ts +5 -0
- package/dist/LmFilter/components/fuzzySearch.d.ts +4 -0
- package/dist/LmFilter/components/index.d.ts +3 -0
- package/dist/LmFilter/customFilter/index.d.ts +2 -0
- package/dist/LmFilter/demos/basic.d.ts +2 -0
- package/dist/LmFilter/filterFns/index.d.ts +12 -0
- package/dist/LmFilter/hooks/index.d.ts +1 -0
- package/dist/LmFilter/hooks/useDelayedFn.d.ts +2 -0
- package/dist/LmFilter/index.d.ts +2 -0
- package/dist/LmFilter/style/index.d.ts +1 -0
- package/dist/LmFilter/utils.d.ts +8 -0
- package/dist/LmFilter/wrapper/Filter.d.ts +3 -0
- package/dist/LmFilter/wrapper/FilterContainer.d.ts +3 -0
- package/dist/LmFilter/wrapper/FilterRoot.d.ts +3 -0
- package/dist/LmFilter/wrapper/FilterWrapper.d.ts +3 -0
- package/dist/_util/getDataOrAriaProps.d.ts +1 -0
- package/dist/_util/reactNode.d.ts +7 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.umd.js +3019 -425
- package/dist/index.umd.min.js +6 -6
- package/dist/message/hooks/useMessage.d.ts +7 -0
- package/dist/message/index.d.ts +63 -4
- package/dist/{Notification/demos/icon.d.ts → notification/demos/basic.d.ts} +0 -0
- package/dist/notification/demos/button.d.ts +2 -0
- package/dist/notification/demos/icon.d.ts +2 -0
- package/dist/notification/hooks/useNotification.d.ts +7 -0
- package/dist/notification/index.d.ts +54 -0
- package/dist/notification/style/index.d.ts +1 -0
- package/es/Alert/ErrorBoundary.d.ts +22 -0
- package/es/Alert/ErrorBoundary.js +65 -0
- package/es/Alert/index.d.ts +41 -0
- package/es/Alert/index.js +192 -0
- package/{lib/Notification → es/Alert}/style/index.css +25 -2
- package/es/{Notification → Alert}/style/index.d.ts +0 -0
- package/es/{Notification → Alert}/style/index.js +0 -0
- package/es/Button/style/{style.css → index.css} +0 -0
- package/es/Button/style/index.d.ts +1 -1
- package/es/Button/style/index.js +1 -1
- package/es/ButtonTags/style/{style.css → index.css} +0 -0
- package/es/ButtonTags/style/index.js +1 -1
- package/es/CardTable/card/PictureTextColumn.js +8 -6
- package/es/CardTable/card/PictureTextRow.js +1 -1
- package/es/CardTable/fns/index.js +38 -9
- package/es/CardTable/{toolbar → pager}/TablePagination.js +0 -0
- package/es/CardTable/pager/index.js +48 -0
- package/{lib/CardTable/style/style.css → es/CardTable/style/index.css} +2 -2
- package/es/CardTable/style/index.js +1 -1
- package/es/CardTable/table/TableRoot.js +20 -18
- package/es/CardTable/table/TableWrapper.js +4 -0
- package/es/CardTable/toolbar/ToolBarBottom.js +8 -27
- package/es/Checkbox/style/{style.css → index.css} +0 -0
- package/es/Checkbox/style/index.js +1 -1
- package/es/CkFilter/style/{style.css → index.css} +0 -0
- package/es/CkFilter/style/index.js +1 -1
- package/es/CustomerService/style/{style.css → index.css} +0 -0
- package/es/CustomerService/style/index.js +1 -1
- package/es/EditTable/style/{style.css → index.css} +0 -0
- package/es/EditTable/style/index.js +1 -1
- package/es/EnlargeImg/style/{style.css → index.css} +0 -0
- package/es/EnlargeImg/style/index.js +1 -1
- package/es/Filter/style/{style.css → index.css} +0 -0
- package/es/Filter/style/index.js +1 -1
- package/es/IconSelect/style/{style.css → index.css} +0 -0
- package/es/IconSelect/style/index.js +1 -1
- package/es/Input/style/{style.css → index.css} +0 -0
- package/es/Input/style/index.js +1 -1
- package/es/LeftTable/style/{style.css → index.css} +0 -0
- package/es/LeftTable/style/index.js +1 -1
- package/es/LmEditTable/style/{style.css → index.css} +0 -0
- package/es/LmEditTable/style/index.d.ts +1 -1
- package/es/LmEditTable/style/index.js +1 -1
- package/es/LmFilter/LmFilter.js +27 -0
- package/es/LmFilter/baseFilter/index.js +34 -0
- package/es/LmFilter/clearFilter/index.js +33 -0
- package/es/LmFilter/complexFilter/index.js +17 -0
- package/es/LmFilter/components/CascaderFilter.js +183 -0
- package/es/LmFilter/components/CheckboxFilter.js +197 -0
- package/es/LmFilter/components/DateFilter.js +147 -0
- package/es/LmFilter/components/DropdownFIlter.js +162 -0
- package/es/LmFilter/components/EmptyFilter.js +27 -0
- package/es/LmFilter/components/InputFilter.js +52 -0
- package/es/LmFilter/components/InputSearchClose.js +74 -0
- package/es/LmFilter/components/SelectFilter.js +113 -0
- package/es/LmFilter/components/fuzzySearch.js +37 -0
- package/es/LmFilter/components/index.js +97 -0
- package/es/LmFilter/customFilter/index.js +17 -0
- package/es/LmFilter/filterFns/index.js +54 -0
- package/es/LmFilter/hooks/index.js +18 -0
- package/es/LmFilter/hooks/useDelayedFn.js +27 -0
- package/es/LmFilter/icon_placeholder.png +0 -0
- package/es/LmFilter/index.js +16 -0
- package/es/LmFilter/style/index.js +3 -0
- package/es/LmFilter/style/style.css +189 -0
- package/es/LmFilter/utils.js +55 -0
- package/es/LmFilter/wrapper/Filter.js +33 -0
- package/es/LmFilter/wrapper/FilterContainer.js +29 -0
- package/es/LmFilter/wrapper/FilterRoot.js +114 -0
- package/es/LmFilter/wrapper/FilterWrapper.js +25 -0
- package/es/LmTable/Table.js +3 -5
- package/{lib/LmTable/style/style.css → es/LmTable/style/index.css} +6 -0
- package/es/LmTable/style/index.js +1 -1
- package/es/OldModal/style/{style.css → index.css} +0 -0
- package/es/OldModal/style/index.js +1 -1
- package/es/PopTable/style/{style.css → index.css} +0 -0
- package/es/PopTable/style/index.js +1 -1
- package/es/ProTable/style/{style.css → index.css} +0 -0
- package/es/ProTable/style/index.js +1 -1
- package/es/Radio/style/{style.css → index.css} +0 -0
- package/es/Radio/style/index.js +1 -1
- package/es/TableRender/style/{style.css → index.css} +0 -0
- package/es/TableRender/style/index.js +1 -1
- package/es/UploadOss/style/{style.css → index.css} +0 -0
- package/es/UploadOss/style/index.js +1 -1
- package/es/VirtualList/style/{style.css → index.css} +0 -0
- package/es/VirtualList/style/index.js +1 -1
- package/es/_util/getDataOrAriaProps.d.ts +1 -0
- package/es/_util/getDataOrAriaProps.js +9 -0
- package/es/_util/reactNode.d.ts +7 -0
- package/es/_util/reactNode.js +10 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/message/hooks/useMessage.d.ts +7 -0
- package/es/message/hooks/useMessage.js +83 -0
- package/es/message/index.d.ts +63 -4
- package/es/message/index.js +241 -12
- package/es/message/style/index.css +28 -1
- package/es/notification/hooks/useNotification.d.ts +7 -0
- package/es/notification/hooks/useNotification.js +54 -0
- package/es/notification/index.d.ts +54 -0
- package/es/notification/index.js +342 -0
- package/es/notification/style/index.css +546 -0
- package/{lib/Notification → es/notification}/style/index.d.ts +0 -0
- package/es/notification/style/index.js +1 -0
- package/lib/Alert/ErrorBoundary.d.ts +22 -0
- package/lib/Alert/ErrorBoundary.js +79 -0
- package/lib/Alert/index.d.ts +41 -0
- package/lib/Alert/index.js +215 -0
- package/{es/Notification → lib/Alert}/style/index.css +25 -2
- package/lib/Alert/style/index.d.ts +1 -0
- package/lib/{Notification → Alert}/style/index.js +0 -0
- package/lib/Button/style/{style.css → index.css} +0 -0
- package/lib/Button/style/index.d.ts +1 -1
- package/lib/Button/style/index.js +1 -1
- package/lib/ButtonTags/style/{style.css → index.css} +0 -0
- package/lib/ButtonTags/style/index.js +1 -1
- package/lib/CardTable/card/PictureTextColumn.js +8 -6
- package/lib/CardTable/card/PictureTextRow.js +1 -1
- package/lib/CardTable/fns/index.js +38 -9
- package/lib/CardTable/{toolbar → pager}/TablePagination.js +0 -0
- package/lib/CardTable/pager/index.js +48 -0
- package/{es/CardTable/style/style.css → lib/CardTable/style/index.css} +2 -2
- package/lib/CardTable/style/index.js +1 -1
- package/lib/CardTable/table/TableRoot.js +20 -18
- package/lib/CardTable/table/TableWrapper.js +4 -0
- package/lib/CardTable/toolbar/ToolBarBottom.js +8 -27
- package/lib/Checkbox/style/{style.css → index.css} +0 -0
- package/lib/Checkbox/style/index.js +1 -1
- package/lib/CkFilter/style/{style.css → index.css} +0 -0
- package/lib/CkFilter/style/index.js +1 -1
- package/lib/CustomerService/style/{style.css → index.css} +0 -0
- package/lib/CustomerService/style/index.js +1 -1
- package/lib/EditTable/style/{style.css → index.css} +0 -0
- package/lib/EditTable/style/index.js +1 -1
- package/lib/EnlargeImg/style/{style.css → index.css} +0 -0
- package/lib/EnlargeImg/style/index.js +1 -1
- package/lib/Filter/style/{style.css → index.css} +0 -0
- package/lib/Filter/style/index.js +1 -1
- package/lib/IconSelect/style/{style.css → index.css} +0 -0
- package/lib/IconSelect/style/index.js +1 -1
- package/lib/Input/style/{style.css → index.css} +0 -0
- package/lib/Input/style/index.js +1 -1
- package/lib/LeftTable/style/{style.css → index.css} +0 -0
- package/lib/LeftTable/style/index.js +1 -1
- package/lib/LmEditTable/style/{style.css → index.css} +0 -0
- package/lib/LmEditTable/style/index.d.ts +1 -1
- package/lib/LmEditTable/style/index.js +1 -1
- package/lib/LmFilter/LmFilter.js +27 -0
- package/lib/LmFilter/baseFilter/index.js +34 -0
- package/lib/LmFilter/clearFilter/index.js +33 -0
- package/lib/LmFilter/complexFilter/index.js +17 -0
- package/lib/LmFilter/components/CascaderFilter.js +183 -0
- package/lib/LmFilter/components/CheckboxFilter.js +197 -0
- package/lib/LmFilter/components/DateFilter.js +147 -0
- package/lib/LmFilter/components/DropdownFIlter.js +162 -0
- package/lib/LmFilter/components/EmptyFilter.js +27 -0
- package/lib/LmFilter/components/InputFilter.js +52 -0
- package/lib/LmFilter/components/InputSearchClose.js +74 -0
- package/lib/LmFilter/components/SelectFilter.js +113 -0
- package/lib/LmFilter/components/fuzzySearch.js +37 -0
- package/lib/LmFilter/components/index.js +97 -0
- package/lib/LmFilter/customFilter/index.js +17 -0
- package/lib/LmFilter/filterFns/index.js +54 -0
- package/lib/LmFilter/hooks/index.js +18 -0
- package/lib/LmFilter/hooks/useDelayedFn.js +27 -0
- package/lib/LmFilter/icon_placeholder.png +0 -0
- package/lib/LmFilter/index.js +16 -0
- package/lib/LmFilter/style/index.js +3 -0
- package/lib/LmFilter/style/style.css +189 -0
- package/lib/LmFilter/utils.js +55 -0
- package/lib/LmFilter/wrapper/Filter.js +33 -0
- package/lib/LmFilter/wrapper/FilterContainer.js +29 -0
- package/lib/LmFilter/wrapper/FilterRoot.js +114 -0
- package/lib/LmFilter/wrapper/FilterWrapper.js +25 -0
- package/lib/LmTable/Table.js +3 -5
- package/{es/LmTable/style/style.css → lib/LmTable/style/index.css} +6 -0
- package/lib/LmTable/style/index.js +1 -1
- package/lib/OldModal/style/{style.css → index.css} +0 -0
- package/lib/OldModal/style/index.js +1 -1
- package/lib/PopTable/style/{style.css → index.css} +0 -0
- package/lib/PopTable/style/index.js +1 -1
- package/lib/ProTable/style/{style.css → index.css} +0 -0
- package/lib/ProTable/style/index.js +1 -1
- package/lib/Radio/style/{style.css → index.css} +0 -0
- package/lib/Radio/style/index.js +1 -1
- package/lib/TableRender/style/{style.css → index.css} +0 -0
- package/lib/TableRender/style/index.js +1 -1
- package/lib/UploadOss/style/{style.css → index.css} +0 -0
- package/lib/UploadOss/style/index.js +1 -1
- package/lib/VirtualList/style/{style.css → index.css} +0 -0
- package/lib/VirtualList/style/index.js +1 -1
- package/lib/_util/getDataOrAriaProps.d.ts +1 -0
- package/lib/_util/getDataOrAriaProps.js +16 -0
- package/lib/_util/reactNode.d.ts +7 -0
- package/lib/_util/reactNode.js +24 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -2
- package/lib/message/hooks/useMessage.d.ts +7 -0
- package/lib/message/hooks/useMessage.js +101 -0
- package/lib/message/index.d.ts +63 -4
- package/lib/message/index.js +262 -16
- package/lib/message/style/index.css +28 -1
- package/lib/notification/hooks/useNotification.d.ts +7 -0
- package/lib/notification/hooks/useNotification.js +69 -0
- package/lib/notification/index.d.ts +54 -0
- package/lib/notification/index.js +365 -0
- package/lib/notification/style/index.css +546 -0
- package/lib/notification/style/index.d.ts +1 -0
- package/lib/notification/style/index.js +3 -0
- package/package.json +1 -1
- package/dist/Notification/index.d.ts +0 -7
- package/es/Notification/index.d.ts +0 -7
- package/es/Notification/index.js +0 -10
- package/lib/Notification/index.d.ts +0 -7
- package/lib/Notification/index.js +0 -23
package/lib/message/index.js
CHANGED
|
@@ -1,24 +1,270 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
|
|
3
5
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
6
|
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
|
-
exports.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var
|
|
10
|
+
exports.attachTypeApi = attachTypeApi;
|
|
11
|
+
exports.getInstance = exports.default = void 0;
|
|
12
|
+
exports.getKeyThenIncreaseKey = getKeyThenIncreaseKey;
|
|
13
|
+
exports.typeList = void 0;
|
|
14
|
+
|
|
15
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
+
|
|
17
|
+
var _icons = require("@ant-design/icons");
|
|
18
|
+
|
|
19
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
20
|
+
|
|
21
|
+
var _rcNotification = _interopRequireDefault(require("rc-notification"));
|
|
22
|
+
|
|
23
|
+
var _react = _interopRequireDefault(require("react"));
|
|
24
|
+
|
|
25
|
+
var _configProvider = _interopRequireWildcard(require("antd/es/config-provider"));
|
|
26
|
+
|
|
27
|
+
var _useMessage = _interopRequireDefault(require("./hooks/useMessage"));
|
|
28
|
+
|
|
29
|
+
var messageInstance;
|
|
30
|
+
var defaultDuration = 3;
|
|
31
|
+
var defaultTop;
|
|
32
|
+
var key = 1;
|
|
33
|
+
var localPrefixCls = '';
|
|
34
|
+
var transitionName = 'move-up';
|
|
35
|
+
var hasTransitionName = false;
|
|
36
|
+
var getContainer;
|
|
37
|
+
var maxCount;
|
|
38
|
+
var rtl = false;
|
|
39
|
+
|
|
40
|
+
function getKeyThenIncreaseKey() {
|
|
41
|
+
return key++;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function setMessageConfig(options) {
|
|
45
|
+
if (options.top !== undefined) {
|
|
46
|
+
defaultTop = options.top;
|
|
47
|
+
messageInstance = null; // delete messageInstance for new defaultTop
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (options.duration !== undefined) {
|
|
51
|
+
defaultDuration = options.duration;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (options.prefixCls !== undefined) {
|
|
55
|
+
localPrefixCls = options.prefixCls;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (options.getContainer !== undefined) {
|
|
59
|
+
getContainer = options.getContainer;
|
|
60
|
+
messageInstance = null; // delete messageInstance for new getContainer
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (options.transitionName !== undefined) {
|
|
64
|
+
transitionName = options.transitionName;
|
|
65
|
+
messageInstance = null; // delete messageInstance for new transitionName
|
|
66
|
+
|
|
67
|
+
hasTransitionName = true;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (options.maxCount !== undefined) {
|
|
71
|
+
maxCount = options.maxCount;
|
|
72
|
+
messageInstance = null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (options.rtl !== undefined) {
|
|
76
|
+
rtl = options.rtl;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function getRCNotificationInstance(args, callback) {
|
|
81
|
+
var customizePrefixCls = args.prefixCls,
|
|
82
|
+
getContextPopupContainer = args.getPopupContainer;
|
|
83
|
+
|
|
84
|
+
var _globalConfig = (0, _configProvider.globalConfig)(),
|
|
85
|
+
getPrefixCls = _globalConfig.getPrefixCls,
|
|
86
|
+
getRootPrefixCls = _globalConfig.getRootPrefixCls,
|
|
87
|
+
getIconPrefixCls = _globalConfig.getIconPrefixCls;
|
|
88
|
+
|
|
89
|
+
var prefixCls = getPrefixCls('message', customizePrefixCls || localPrefixCls);
|
|
90
|
+
var rootPrefixCls = getRootPrefixCls(args.rootPrefixCls, prefixCls);
|
|
91
|
+
var iconPrefixCls = getIconPrefixCls();
|
|
92
|
+
|
|
93
|
+
if (messageInstance) {
|
|
94
|
+
callback({
|
|
95
|
+
prefixCls: prefixCls,
|
|
96
|
+
rootPrefixCls: rootPrefixCls,
|
|
97
|
+
iconPrefixCls: iconPrefixCls,
|
|
98
|
+
instance: messageInstance
|
|
99
|
+
});
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
var instanceConfig = {
|
|
104
|
+
prefixCls: prefixCls,
|
|
105
|
+
transitionName: hasTransitionName ? transitionName : "".concat(rootPrefixCls, "-").concat(transitionName),
|
|
106
|
+
style: {
|
|
107
|
+
top: defaultTop
|
|
108
|
+
},
|
|
109
|
+
getContainer: getContainer || getContextPopupContainer,
|
|
110
|
+
maxCount: maxCount
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
_rcNotification.default.newInstance(instanceConfig, function (instance) {
|
|
114
|
+
if (messageInstance) {
|
|
115
|
+
callback({
|
|
116
|
+
prefixCls: prefixCls,
|
|
117
|
+
rootPrefixCls: rootPrefixCls,
|
|
118
|
+
iconPrefixCls: iconPrefixCls,
|
|
119
|
+
instance: messageInstance
|
|
120
|
+
});
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
messageInstance = instance;
|
|
125
|
+
|
|
126
|
+
if (process.env.NODE_ENV === 'test') {
|
|
127
|
+
messageInstance.config = instanceConfig;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
callback({
|
|
131
|
+
prefixCls: prefixCls,
|
|
132
|
+
rootPrefixCls: rootPrefixCls,
|
|
133
|
+
iconPrefixCls: iconPrefixCls,
|
|
134
|
+
instance: instance
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
var typeToIcon = {
|
|
140
|
+
info: _icons.InfoCircleFilled,
|
|
141
|
+
success: _icons.CheckCircleFilled,
|
|
142
|
+
error: _icons.CloseCircleFilled,
|
|
143
|
+
warning: _icons.ExclamationCircleFilled,
|
|
144
|
+
loading: _icons.LoadingOutlined
|
|
145
|
+
};
|
|
146
|
+
var typeList = Object.keys(typeToIcon);
|
|
147
|
+
exports.typeList = typeList;
|
|
148
|
+
|
|
149
|
+
function getRCNoticeProps(args, prefixCls, iconPrefixCls) {
|
|
150
|
+
var _classNames;
|
|
151
|
+
|
|
152
|
+
var duration = args.duration !== undefined ? args.duration : defaultDuration;
|
|
153
|
+
var progress = args.progress === false ? false : true;
|
|
154
|
+
var IconComponent = typeToIcon[args.type];
|
|
155
|
+
var messageClass = (0, _classnames.default)("".concat(prefixCls, "-custom-content"), (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-").concat(args.type), args.type), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-rtl"), rtl === true), _classNames));
|
|
156
|
+
return {
|
|
157
|
+
key: args.key,
|
|
158
|
+
duration: duration,
|
|
159
|
+
style: args.style || {},
|
|
160
|
+
className: (0, _classnames.default)(args.className, 'lm_message'),
|
|
161
|
+
content: /*#__PURE__*/_react.default.createElement(_configProvider.default, {
|
|
162
|
+
iconPrefixCls: iconPrefixCls
|
|
163
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
164
|
+
className: messageClass
|
|
165
|
+
}, args.icon || IconComponent && /*#__PURE__*/_react.default.createElement(IconComponent, null), /*#__PURE__*/_react.default.createElement("span", null, args.content), progress && duration > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
166
|
+
className: 'message_progress',
|
|
167
|
+
style: {
|
|
168
|
+
animationDuration: "".concat(duration, "s")
|
|
169
|
+
}
|
|
170
|
+
}))),
|
|
171
|
+
onClose: args.onClose,
|
|
172
|
+
onClick: args.onClick
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function notice(args) {
|
|
177
|
+
var target = args.key || getKeyThenIncreaseKey();
|
|
178
|
+
var closePromise = new Promise(function (resolve) {
|
|
179
|
+
var callback = function callback() {
|
|
180
|
+
if (typeof args.onClose === 'function') {
|
|
181
|
+
args.onClose();
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return resolve(true);
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
getRCNotificationInstance(args, function (_ref) {
|
|
188
|
+
var prefixCls = _ref.prefixCls,
|
|
189
|
+
iconPrefixCls = _ref.iconPrefixCls,
|
|
190
|
+
instance = _ref.instance;
|
|
191
|
+
instance.notice(getRCNoticeProps(Object.assign(Object.assign({}, args), {
|
|
192
|
+
key: target,
|
|
193
|
+
onClose: callback
|
|
194
|
+
}), prefixCls, iconPrefixCls));
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
var result = function result() {
|
|
199
|
+
if (messageInstance) {
|
|
200
|
+
messageInstance.removeNotice(target);
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
result.then = function (filled, rejected) {
|
|
205
|
+
return closePromise.then(filled, rejected);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
result.promise = closePromise;
|
|
209
|
+
return result;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function isArgsProps(content) {
|
|
213
|
+
return Object.prototype.toString.call(content) === '[object Object]' && !!content.content;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
var api = {
|
|
217
|
+
open: notice,
|
|
218
|
+
config: setMessageConfig,
|
|
219
|
+
destroy: function destroy(messageKey) {
|
|
220
|
+
if (messageInstance) {
|
|
221
|
+
if (messageKey) {
|
|
222
|
+
var _messageInstance = messageInstance,
|
|
223
|
+
removeNotice = _messageInstance.removeNotice;
|
|
224
|
+
removeNotice(messageKey);
|
|
225
|
+
} else {
|
|
226
|
+
var _messageInstance2 = messageInstance,
|
|
227
|
+
destroy = _messageInstance2.destroy;
|
|
228
|
+
destroy();
|
|
229
|
+
messageInstance = null;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
function attachTypeApi(originalApi, type) {
|
|
236
|
+
originalApi[type] = function (content, duration, onClose) {
|
|
237
|
+
if (isArgsProps(content)) {
|
|
238
|
+
return originalApi.open(Object.assign(Object.assign({}, content), {
|
|
239
|
+
type: type
|
|
240
|
+
}));
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (typeof duration === 'function') {
|
|
244
|
+
onClose = duration;
|
|
245
|
+
duration = undefined;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return originalApi.open({
|
|
249
|
+
content: content,
|
|
250
|
+
duration: duration,
|
|
251
|
+
type: type,
|
|
252
|
+
onClose: onClose
|
|
253
|
+
});
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
typeList.forEach(function (type) {
|
|
258
|
+
return attachTypeApi(api, type);
|
|
259
|
+
});
|
|
260
|
+
api.warn = api.warning;
|
|
261
|
+
api.useMessage = (0, _useMessage.default)(getRCNotificationInstance, getRCNoticeProps);
|
|
262
|
+
/** @private test Only function. Not work on production */
|
|
263
|
+
|
|
264
|
+
var getInstance = function getInstance() {
|
|
265
|
+
return process.env.NODE_ENV === 'test' ? messageInstance : null;
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
exports.getInstance = getInstance;
|
|
269
|
+
var _default = api;
|
|
24
270
|
exports.default = _default;
|
|
@@ -503,7 +503,34 @@ html {
|
|
|
503
503
|
.card_cell_content:hover .card_cell_body .card_cell_checkbox {
|
|
504
504
|
opacity: 1;
|
|
505
505
|
}
|
|
506
|
-
.
|
|
506
|
+
.lm_message .ant-message-notice-content {
|
|
507
|
+
position: relative;
|
|
507
508
|
padding: 8px 16px;
|
|
508
509
|
font-size: 12px;
|
|
509
510
|
}
|
|
511
|
+
.lm_message .message_progress {
|
|
512
|
+
position: absolute;
|
|
513
|
+
width: 100%;
|
|
514
|
+
height: 2px;
|
|
515
|
+
background-color: #52C41A;
|
|
516
|
+
left: 0;
|
|
517
|
+
bottom: 0;
|
|
518
|
+
animation-name: Progress;
|
|
519
|
+
animation-iteration-count: 1;
|
|
520
|
+
animation-fill-mode: forwards;
|
|
521
|
+
transition: width 0.2s;
|
|
522
|
+
animation-timing-function: linear;
|
|
523
|
+
}
|
|
524
|
+
.lm_message:hover .message_progress {
|
|
525
|
+
width: 100%;
|
|
526
|
+
animation-name: none;
|
|
527
|
+
animation-play-state: paused;
|
|
528
|
+
}
|
|
529
|
+
@keyframes Progress {
|
|
530
|
+
from {
|
|
531
|
+
width: 100%;
|
|
532
|
+
}
|
|
533
|
+
to {
|
|
534
|
+
width: 0;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NoticeContent as RCNoticeContent, NotificationInstance as RCNotificationInstance } from 'rc-notification/lib/Notification';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import type { ArgsProps, NotificationInstance } from '..';
|
|
4
|
+
export default function createUseNotification(getNotificationInstance: (args: ArgsProps, callback: (info: {
|
|
5
|
+
prefixCls: string;
|
|
6
|
+
instance: RCNotificationInstance;
|
|
7
|
+
}) => void) => void, getRCNoticeProps: (args: ArgsProps, prefixCls: string) => RCNoticeContent): () => [NotificationInstance, React.ReactElement];
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = createUseNotification;
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _useNotification = _interopRequireDefault(require("rc-notification/lib/useNotification"));
|
|
15
|
+
|
|
16
|
+
var React = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _configProvider = require("antd/es/config-provider");
|
|
19
|
+
|
|
20
|
+
function createUseNotification(getNotificationInstance, getRCNoticeProps) {
|
|
21
|
+
var useNotification = function useNotification() {
|
|
22
|
+
// We can only get content by render
|
|
23
|
+
var getPrefixCls; // We create a proxy to handle delay created instance
|
|
24
|
+
|
|
25
|
+
var innerInstance = null;
|
|
26
|
+
var proxy = {
|
|
27
|
+
add: function add(noticeProps, holderCallback) {
|
|
28
|
+
innerInstance === null || innerInstance === void 0 ? void 0 : innerInstance.component.add(noticeProps, holderCallback);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var _useRCNotification = (0, _useNotification.default)(proxy),
|
|
33
|
+
_useRCNotification2 = (0, _slicedToArray2.default)(_useRCNotification, 2),
|
|
34
|
+
hookNotify = _useRCNotification2[0],
|
|
35
|
+
holder = _useRCNotification2[1];
|
|
36
|
+
|
|
37
|
+
function notify(args) {
|
|
38
|
+
var customizePrefixCls = args.prefixCls;
|
|
39
|
+
var mergedPrefixCls = getPrefixCls('notification', customizePrefixCls);
|
|
40
|
+
getNotificationInstance(Object.assign(Object.assign({}, args), {
|
|
41
|
+
prefixCls: mergedPrefixCls
|
|
42
|
+
}), function (_ref) {
|
|
43
|
+
var prefixCls = _ref.prefixCls,
|
|
44
|
+
instance = _ref.instance;
|
|
45
|
+
innerInstance = instance;
|
|
46
|
+
hookNotify(getRCNoticeProps(args, prefixCls));
|
|
47
|
+
});
|
|
48
|
+
} // Fill functions
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
var hookApiRef = React.useRef({});
|
|
52
|
+
hookApiRef.current.open = notify;
|
|
53
|
+
['success', 'info', 'warning', 'error'].forEach(function (type) {
|
|
54
|
+
hookApiRef.current[type] = function (args) {
|
|
55
|
+
return hookApiRef.current.open(Object.assign(Object.assign({}, args), {
|
|
56
|
+
type: type
|
|
57
|
+
}));
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
return [hookApiRef.current, /*#__PURE__*/React.createElement(_configProvider.ConfigConsumer, {
|
|
61
|
+
key: "holder"
|
|
62
|
+
}, function (context) {
|
|
63
|
+
getPrefixCls = context.getPrefixCls;
|
|
64
|
+
return holder;
|
|
65
|
+
})];
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return useNotification;
|
|
69
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { NotificationInstance as RCNotificationInstance } from 'rc-notification/lib/Notification';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export declare type NotificationPlacement = 'top' | 'topLeft' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight';
|
|
4
|
+
export declare type IconType = 'success' | 'info' | 'error' | 'warning';
|
|
5
|
+
export interface ConfigProps {
|
|
6
|
+
top?: number;
|
|
7
|
+
bottom?: number;
|
|
8
|
+
duration?: number;
|
|
9
|
+
prefixCls?: string;
|
|
10
|
+
placement?: NotificationPlacement;
|
|
11
|
+
getContainer?: () => HTMLElement;
|
|
12
|
+
closeIcon?: React.ReactNode;
|
|
13
|
+
rtl?: boolean;
|
|
14
|
+
maxCount?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ArgsProps {
|
|
17
|
+
message: React.ReactNode;
|
|
18
|
+
description?: React.ReactNode;
|
|
19
|
+
btn?: React.ReactNode;
|
|
20
|
+
key?: string;
|
|
21
|
+
onClose?: () => void;
|
|
22
|
+
duration?: number | null;
|
|
23
|
+
icon?: React.ReactNode;
|
|
24
|
+
placement?: NotificationPlacement;
|
|
25
|
+
maxCount?: number;
|
|
26
|
+
style?: React.CSSProperties;
|
|
27
|
+
prefixCls?: string;
|
|
28
|
+
className?: string;
|
|
29
|
+
readonly type?: IconType;
|
|
30
|
+
onClick?: () => void;
|
|
31
|
+
top?: number;
|
|
32
|
+
bottom?: number;
|
|
33
|
+
getContainer?: () => HTMLElement;
|
|
34
|
+
closeIcon?: React.ReactNode;
|
|
35
|
+
progress?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface NotificationInstance {
|
|
38
|
+
success(args: ArgsProps): void;
|
|
39
|
+
error(args: ArgsProps): void;
|
|
40
|
+
info(args: ArgsProps): void;
|
|
41
|
+
warning(args: ArgsProps): void;
|
|
42
|
+
open(args: ArgsProps): void;
|
|
43
|
+
}
|
|
44
|
+
export interface NotificationApi extends NotificationInstance {
|
|
45
|
+
warn(args: ArgsProps): void;
|
|
46
|
+
close(key: string): void;
|
|
47
|
+
config(options: ConfigProps): void;
|
|
48
|
+
destroy(): void;
|
|
49
|
+
useNotification: () => [NotificationInstance, React.ReactElement];
|
|
50
|
+
}
|
|
51
|
+
/** @private test Only function. Not work on production */
|
|
52
|
+
export declare const getInstance: (cacheKey: string) => Promise<RCNotificationInstance>;
|
|
53
|
+
declare const _default: NotificationApi;
|
|
54
|
+
export default _default;
|