linkmore-design 1.0.53 → 1.0.56
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/{Notification → Affix}/demos/basic.d.ts +0 -0
- package/dist/Affix/index.d.ts +54 -0
- package/dist/{Notification → Affix}/style/index.d.ts +0 -0
- package/dist/Affix/utils.d.ts +15 -0
- package/dist/Alert/ErrorBoundary.d.ts +22 -0
- package/dist/{Notification/demos/button.d.ts → Alert/demos/basic.d.ts} +0 -0
- package/dist/{Notification/demos/icon.d.ts → Alert/demos/visible.d.ts} +0 -0
- package/dist/Alert/index.d.ts +41 -0
- package/dist/Alert/style/index.d.ts +1 -0
- package/dist/CardTable/card/PictureTextRowOperate.d.ts +7 -0
- package/dist/CardTable/fns/index.d.ts +3 -3
- package/dist/CardTable/{toolbar → pager}/TablePagination.d.ts +0 -0
- package/dist/CardTable/pager/index.d.ts +3 -0
- package/dist/IconFont/index.d.ts +1 -1
- package/dist/LmFilter/Controls/CheckboxTags.d.ts +6 -0
- package/dist/LmFilter/Controls/index.d.ts +2 -0
- package/dist/LmFilter/LmFilter.d.ts +6 -0
- package/dist/LmFilter/baseFilter/fuzzySearch.d.ts +4 -0
- package/dist/LmFilter/baseFilter/index.d.ts +3 -0
- package/dist/LmFilter/clearFilter/index.d.ts +3 -0
- package/dist/LmFilter/complexFilter/drawer.d.ts +4 -0
- package/dist/LmFilter/complexFilter/index.d.ts +4 -0
- package/dist/LmFilter/complexFilter/valueDrawer.d.ts +4 -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/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/localization.d.ts +8 -0
- package/dist/LmFilter/style/index.d.ts +1 -0
- package/dist/LmFilter/utils.d.ts +9 -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/QuickMenu/demos/basic.d.ts +2 -0
- package/dist/QuickMenu/index.d.ts +14 -0
- package/dist/QuickMenu/style/index.d.ts +1 -0
- package/dist/Switch/demos/table.d.ts +2 -0
- package/dist/Switch/index.d.ts +2 -1
- package/dist/Tag/demos/ExigencyTag.d.ts +2 -0
- package/dist/Tag/index.d.ts +4 -0
- package/dist/Upload/demos/picture-little.d.ts +3 -0
- package/dist/Upload/index.d.ts +5 -1
- package/dist/_util/domTarget.d.ts +7 -0
- package/dist/_util/getDataOrAriaProps.d.ts +1 -0
- package/dist/_util/reactNode.d.ts +7 -0
- package/dist/_util/throttleByAnimationFrame.d.ts +8 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.umd.js +4245 -3326
- package/dist/index.umd.min.js +5 -5
- package/dist/notification/demos/basic.d.ts +2 -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/Affix/index.d.ts +54 -0
- package/es/Affix/index.js +326 -0
- package/es/{Notification → Affix}/style/index.css +0 -3
- package/es/{Notification → Affix}/style/index.d.ts +0 -0
- package/es/{Notification → Affix}/style/index.js +0 -0
- package/es/Affix/utils.d.ts +15 -0
- package/es/Affix/utils.js +83 -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/es/Alert/style/index.css +531 -0
- package/{lib/Notification → es/Alert}/style/index.d.ts +0 -0
- package/es/Alert/style/index.js +1 -0
- package/es/CardTable/body/TableBodyCell.js +3 -0
- package/es/CardTable/card/PictureTextColumn.js +8 -6
- package/es/CardTable/card/PictureTextRow.js +14 -51
- package/es/CardTable/card/PictureTextRowOperate.js +130 -0
- package/es/CardTable/fns/index.js +38 -8
- package/es/CardTable/{toolbar → pager}/TablePagination.js +0 -0
- package/es/CardTable/pager/index.js +48 -0
- package/es/CardTable/style/index.css +160 -12
- 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/Descriptions/style/index.css +10 -8
- package/es/IconFont/index.js +3 -2
- package/es/LmFilter/Controls/CheckboxTags.js +53 -0
- package/es/LmFilter/Controls/index.js +47 -0
- package/es/LmFilter/LmFilter.js +39 -0
- package/es/LmFilter/baseFilter/fuzzySearch.js +53 -0
- package/es/LmFilter/baseFilter/index.js +34 -0
- package/es/LmFilter/clearFilter/index.js +35 -0
- package/es/LmFilter/complexFilter/drawer.js +376 -0
- package/es/LmFilter/complexFilter/index.js +64 -0
- package/es/LmFilter/complexFilter/valueDrawer.js +238 -0
- package/es/LmFilter/components/CascaderFilter.js +159 -0
- package/es/LmFilter/components/CheckboxFilter.js +197 -0
- package/es/LmFilter/components/DateFilter.js +139 -0
- package/es/LmFilter/components/DropdownFIlter.js +229 -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/index.js +140 -0
- package/es/LmFilter/customFilter/index.js +17 -0
- package/es/LmFilter/filterFns/index.js +73 -0
- package/es/LmFilter/hooks/index.js +18 -0
- package/es/LmFilter/hooks/useDelayedFn.js +29 -0
- package/es/LmFilter/icon_placeholder.png +0 -0
- package/es/LmFilter/index.js +16 -0
- package/es/LmFilter/localization.d.ts +8 -0
- package/es/LmFilter/localization.js +12 -0
- package/es/LmFilter/style/index.js +3 -0
- package/es/LmFilter/style/style.css +212 -0
- package/es/LmFilter/utils.js +71 -0
- package/es/LmFilter/wrapper/Filter.js +33 -0
- package/es/LmFilter/wrapper/FilterContainer.js +29 -0
- package/es/LmFilter/wrapper/FilterRoot.js +170 -0
- package/es/LmFilter/wrapper/FilterWrapper.js +25 -0
- package/es/QuickMenu/index.d.ts +14 -0
- package/es/QuickMenu/index.js +169 -0
- package/es/QuickMenu/style/index.css +560 -0
- package/es/QuickMenu/style/index.d.ts +1 -0
- package/es/QuickMenu/style/index.js +1 -0
- package/es/Switch/index.d.ts +2 -1
- package/es/Switch/index.js +33 -1
- package/es/Switch/style/index.css +41 -0
- package/es/Tag/index.d.ts +4 -0
- package/es/Tag/index.js +48 -2
- package/es/Tag/style/index.css +4 -1
- package/es/Upload/index.d.ts +5 -1
- package/es/Upload/index.js +7 -2
- package/es/Upload/style/index.css +35 -0
- package/es/_util/domTarget.d.ts +7 -0
- package/es/_util/domTarget.js +20 -0
- 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/_util/throttleByAnimationFrame.d.ts +8 -0
- package/es/_util/throttleByAnimationFrame.js +58 -0
- package/es/index.d.ts +2 -1
- package/es/index.js +3 -2
- package/es/message/style/index.css +1 -0
- 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/es/notification/style/index.d.ts +1 -0
- package/es/notification/style/index.js +1 -0
- package/lib/Affix/index.d.ts +54 -0
- package/lib/Affix/index.js +349 -0
- package/lib/{Notification → Affix}/style/index.css +0 -3
- package/lib/Affix/style/index.d.ts +1 -0
- package/lib/{Notification → Affix}/style/index.js +0 -0
- package/lib/Affix/utils.d.ts +15 -0
- package/lib/Affix/utils.js +104 -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/lib/Alert/style/index.css +531 -0
- package/lib/Alert/style/index.d.ts +1 -0
- package/lib/Alert/style/index.js +3 -0
- package/lib/CardTable/body/TableBodyCell.js +3 -0
- package/lib/CardTable/card/PictureTextColumn.js +8 -6
- package/lib/CardTable/card/PictureTextRow.js +14 -51
- package/lib/CardTable/card/PictureTextRowOperate.js +130 -0
- package/lib/CardTable/fns/index.js +38 -8
- package/lib/CardTable/{toolbar → pager}/TablePagination.js +0 -0
- package/lib/CardTable/pager/index.js +48 -0
- package/lib/CardTable/style/index.css +160 -12
- 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/Descriptions/style/index.css +10 -8
- package/lib/IconFont/index.js +3 -2
- package/lib/LmFilter/Controls/CheckboxTags.js +53 -0
- package/lib/LmFilter/Controls/index.js +47 -0
- package/lib/LmFilter/LmFilter.js +39 -0
- package/lib/LmFilter/baseFilter/fuzzySearch.js +53 -0
- package/lib/LmFilter/baseFilter/index.js +34 -0
- package/lib/LmFilter/clearFilter/index.js +35 -0
- package/lib/LmFilter/complexFilter/drawer.js +376 -0
- package/lib/LmFilter/complexFilter/index.js +64 -0
- package/lib/LmFilter/complexFilter/valueDrawer.js +238 -0
- package/lib/LmFilter/components/CascaderFilter.js +159 -0
- package/lib/LmFilter/components/CheckboxFilter.js +197 -0
- package/lib/LmFilter/components/DateFilter.js +139 -0
- package/lib/LmFilter/components/DropdownFIlter.js +229 -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/index.js +140 -0
- package/lib/LmFilter/customFilter/index.js +17 -0
- package/lib/LmFilter/filterFns/index.js +73 -0
- package/lib/LmFilter/hooks/index.js +18 -0
- package/lib/LmFilter/hooks/useDelayedFn.js +29 -0
- package/lib/LmFilter/icon_placeholder.png +0 -0
- package/lib/LmFilter/index.js +16 -0
- package/lib/LmFilter/localization.d.ts +8 -0
- package/lib/LmFilter/localization.js +19 -0
- package/lib/LmFilter/style/index.js +3 -0
- package/lib/LmFilter/style/style.css +212 -0
- package/lib/LmFilter/utils.js +71 -0
- package/lib/LmFilter/wrapper/Filter.js +33 -0
- package/lib/LmFilter/wrapper/FilterContainer.js +29 -0
- package/lib/LmFilter/wrapper/FilterRoot.js +170 -0
- package/lib/LmFilter/wrapper/FilterWrapper.js +25 -0
- package/lib/QuickMenu/index.d.ts +14 -0
- package/lib/QuickMenu/index.js +187 -0
- package/lib/QuickMenu/style/index.css +560 -0
- package/lib/QuickMenu/style/index.d.ts +1 -0
- package/lib/QuickMenu/style/index.js +3 -0
- package/lib/Switch/index.d.ts +2 -1
- package/lib/Switch/index.js +34 -1
- package/lib/Switch/style/index.css +41 -0
- package/lib/Tag/index.d.ts +4 -0
- package/lib/Tag/index.js +48 -1
- package/lib/Tag/style/index.css +4 -1
- package/lib/Upload/index.d.ts +5 -1
- package/lib/Upload/index.js +8 -2
- package/lib/Upload/style/index.css +35 -0
- package/lib/_util/domTarget.d.ts +7 -0
- package/lib/_util/domTarget.js +31 -0
- 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/_util/throttleByAnimationFrame.d.ts +8 -0
- package/lib/_util/throttleByAnimationFrame.js +72 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +11 -3
- package/lib/message/style/index.css +1 -0
- 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 +5 -2
- 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
|
@@ -0,0 +1,365 @@
|
|
|
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.getInstance = exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
+
|
|
14
|
+
require("antd/es/notification/style");
|
|
15
|
+
|
|
16
|
+
var _notification2 = _interopRequireDefault(require("antd/es/notification"));
|
|
17
|
+
|
|
18
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
|
+
|
|
20
|
+
var _icons = require("@ant-design/icons");
|
|
21
|
+
|
|
22
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
23
|
+
|
|
24
|
+
var _rcNotification = _interopRequireDefault(require("rc-notification"));
|
|
25
|
+
|
|
26
|
+
var React = _interopRequireWildcard(require("react"));
|
|
27
|
+
|
|
28
|
+
var _configProvider = _interopRequireWildcard(require("antd/es/config-provider"));
|
|
29
|
+
|
|
30
|
+
var _useNotification = _interopRequireDefault(require("./hooks/useNotification"));
|
|
31
|
+
|
|
32
|
+
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
33
|
+
function adopt(value) {
|
|
34
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
35
|
+
resolve(value);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
40
|
+
function fulfilled(value) {
|
|
41
|
+
try {
|
|
42
|
+
step(generator.next(value));
|
|
43
|
+
} catch (e) {
|
|
44
|
+
reject(e);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function rejected(value) {
|
|
49
|
+
try {
|
|
50
|
+
step(generator["throw"](value));
|
|
51
|
+
} catch (e) {
|
|
52
|
+
reject(e);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function step(result) {
|
|
57
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
var notificationInstance = {};
|
|
65
|
+
var defaultDuration = 4.5;
|
|
66
|
+
var defaultTop = 24;
|
|
67
|
+
var defaultBottom = 24;
|
|
68
|
+
var defaultPrefixCls = '';
|
|
69
|
+
var defaultPlacement = 'topRight';
|
|
70
|
+
var defaultGetContainer;
|
|
71
|
+
var defaultCloseIcon;
|
|
72
|
+
var rtl = false;
|
|
73
|
+
var maxCount;
|
|
74
|
+
|
|
75
|
+
function setNotificationConfig(options) {
|
|
76
|
+
var duration = options.duration,
|
|
77
|
+
placement = options.placement,
|
|
78
|
+
bottom = options.bottom,
|
|
79
|
+
top = options.top,
|
|
80
|
+
getContainer = options.getContainer,
|
|
81
|
+
closeIcon = options.closeIcon,
|
|
82
|
+
prefixCls = options.prefixCls;
|
|
83
|
+
|
|
84
|
+
if (prefixCls !== undefined) {
|
|
85
|
+
defaultPrefixCls = prefixCls;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (duration !== undefined) {
|
|
89
|
+
defaultDuration = duration;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (placement !== undefined) {
|
|
93
|
+
defaultPlacement = placement;
|
|
94
|
+
} else if (options.rtl) {
|
|
95
|
+
defaultPlacement = 'topLeft';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (bottom !== undefined) {
|
|
99
|
+
defaultBottom = bottom;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (top !== undefined) {
|
|
103
|
+
defaultTop = top;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (getContainer !== undefined) {
|
|
107
|
+
defaultGetContainer = getContainer;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (closeIcon !== undefined) {
|
|
111
|
+
defaultCloseIcon = closeIcon;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (options.rtl !== undefined) {
|
|
115
|
+
rtl = options.rtl;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (options.maxCount !== undefined) {
|
|
119
|
+
maxCount = options.maxCount;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function getPlacementStyle(placement) {
|
|
124
|
+
var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultTop;
|
|
125
|
+
var bottom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultBottom;
|
|
126
|
+
var style;
|
|
127
|
+
|
|
128
|
+
switch (placement) {
|
|
129
|
+
case 'top':
|
|
130
|
+
style = {
|
|
131
|
+
left: '50%',
|
|
132
|
+
transform: 'translateX(-50%)',
|
|
133
|
+
right: 'auto',
|
|
134
|
+
top: top,
|
|
135
|
+
bottom: 'auto'
|
|
136
|
+
};
|
|
137
|
+
break;
|
|
138
|
+
|
|
139
|
+
case 'topLeft':
|
|
140
|
+
style = {
|
|
141
|
+
left: 0,
|
|
142
|
+
top: top,
|
|
143
|
+
bottom: 'auto'
|
|
144
|
+
};
|
|
145
|
+
break;
|
|
146
|
+
|
|
147
|
+
case 'topRight':
|
|
148
|
+
style = {
|
|
149
|
+
right: 0,
|
|
150
|
+
top: top,
|
|
151
|
+
bottom: 'auto'
|
|
152
|
+
};
|
|
153
|
+
break;
|
|
154
|
+
|
|
155
|
+
case 'bottom':
|
|
156
|
+
style = {
|
|
157
|
+
left: '50%',
|
|
158
|
+
transform: 'translateX(-50%)',
|
|
159
|
+
right: 'auto',
|
|
160
|
+
top: 'auto',
|
|
161
|
+
bottom: bottom
|
|
162
|
+
};
|
|
163
|
+
break;
|
|
164
|
+
|
|
165
|
+
case 'bottomLeft':
|
|
166
|
+
style = {
|
|
167
|
+
left: 0,
|
|
168
|
+
top: 'auto',
|
|
169
|
+
bottom: bottom
|
|
170
|
+
};
|
|
171
|
+
break;
|
|
172
|
+
|
|
173
|
+
default:
|
|
174
|
+
style = {
|
|
175
|
+
right: 0,
|
|
176
|
+
top: 'auto',
|
|
177
|
+
bottom: bottom
|
|
178
|
+
};
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return style;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function getNotificationInstance(args, callback) {
|
|
186
|
+
var _args$placement = args.placement,
|
|
187
|
+
placement = _args$placement === void 0 ? defaultPlacement : _args$placement,
|
|
188
|
+
top = args.top,
|
|
189
|
+
bottom = args.bottom,
|
|
190
|
+
_args$getContainer = args.getContainer,
|
|
191
|
+
getContainer = _args$getContainer === void 0 ? defaultGetContainer : _args$getContainer,
|
|
192
|
+
customizePrefixCls = args.prefixCls;
|
|
193
|
+
|
|
194
|
+
var _globalConfig = (0, _configProvider.globalConfig)(),
|
|
195
|
+
getPrefixCls = _globalConfig.getPrefixCls,
|
|
196
|
+
getIconPrefixCls = _globalConfig.getIconPrefixCls;
|
|
197
|
+
|
|
198
|
+
var prefixCls = getPrefixCls('notification', customizePrefixCls || defaultPrefixCls);
|
|
199
|
+
var iconPrefixCls = getIconPrefixCls();
|
|
200
|
+
var cacheKey = "".concat(prefixCls, "-").concat(placement);
|
|
201
|
+
var cacheInstance = notificationInstance[cacheKey];
|
|
202
|
+
|
|
203
|
+
if (cacheInstance) {
|
|
204
|
+
Promise.resolve(cacheInstance).then(function (instance) {
|
|
205
|
+
callback({
|
|
206
|
+
prefixCls: "".concat(prefixCls, "-notice"),
|
|
207
|
+
iconPrefixCls: iconPrefixCls,
|
|
208
|
+
instance: instance
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
var notificationClass = (0, _classnames.default)("".concat(prefixCls, "-").concat(placement), (0, _defineProperty2.default)({}, "".concat(prefixCls, "-rtl"), rtl === true));
|
|
215
|
+
notificationInstance[cacheKey] = new Promise(function (resolve) {
|
|
216
|
+
_rcNotification.default.newInstance({
|
|
217
|
+
prefixCls: prefixCls,
|
|
218
|
+
className: notificationClass,
|
|
219
|
+
style: getPlacementStyle(placement, top, bottom),
|
|
220
|
+
getContainer: getContainer,
|
|
221
|
+
maxCount: maxCount
|
|
222
|
+
}, function (notification) {
|
|
223
|
+
resolve(notification);
|
|
224
|
+
callback({
|
|
225
|
+
prefixCls: "".concat(prefixCls, "-notice"),
|
|
226
|
+
iconPrefixCls: iconPrefixCls,
|
|
227
|
+
instance: notification
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
var typeToIcon = {
|
|
234
|
+
success: _icons.CheckCircleOutlined,
|
|
235
|
+
info: _icons.InfoCircleOutlined,
|
|
236
|
+
error: _icons.CloseCircleOutlined,
|
|
237
|
+
warning: _icons.ExclamationCircleOutlined
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
function getRCNoticeProps(args, prefixCls, iconPrefixCls) {
|
|
241
|
+
var durationArg = args.duration,
|
|
242
|
+
icon = args.icon,
|
|
243
|
+
type = args.type,
|
|
244
|
+
description = args.description,
|
|
245
|
+
message = args.message,
|
|
246
|
+
btn = args.btn,
|
|
247
|
+
onClose = args.onClose,
|
|
248
|
+
onClick = args.onClick,
|
|
249
|
+
key = args.key,
|
|
250
|
+
style = args.style,
|
|
251
|
+
className = args.className,
|
|
252
|
+
_args$closeIcon = args.closeIcon,
|
|
253
|
+
closeIcon = _args$closeIcon === void 0 ? defaultCloseIcon : _args$closeIcon,
|
|
254
|
+
_args$progress = args.progress,
|
|
255
|
+
progress = _args$progress === void 0 ? true : _args$progress;
|
|
256
|
+
var duration = durationArg === undefined ? defaultDuration : durationArg;
|
|
257
|
+
var iconNode = null;
|
|
258
|
+
|
|
259
|
+
if (icon) {
|
|
260
|
+
iconNode = /*#__PURE__*/React.createElement("span", {
|
|
261
|
+
className: "".concat(prefixCls, "-icon")
|
|
262
|
+
}, args.icon);
|
|
263
|
+
} else if (type) {
|
|
264
|
+
iconNode = /*#__PURE__*/React.createElement(typeToIcon[type] || null, {
|
|
265
|
+
className: "".concat(prefixCls, "-icon ").concat(prefixCls, "-icon-").concat(type)
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
var closeIconToRender = /*#__PURE__*/React.createElement("span", {
|
|
270
|
+
className: "".concat(prefixCls, "-close-x")
|
|
271
|
+
}, closeIcon || /*#__PURE__*/React.createElement(_icons.CloseOutlined, {
|
|
272
|
+
className: "".concat(prefixCls, "-close-icon")
|
|
273
|
+
}));
|
|
274
|
+
var autoMarginTag = !description && iconNode ? /*#__PURE__*/React.createElement("span", {
|
|
275
|
+
className: "".concat(prefixCls, "-message-single-line-auto-margin")
|
|
276
|
+
}) : null;
|
|
277
|
+
return {
|
|
278
|
+
content: /*#__PURE__*/React.createElement(_configProvider.default, {
|
|
279
|
+
iconPrefixCls: iconPrefixCls
|
|
280
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
281
|
+
className: iconNode ? "".concat(prefixCls, "-with-icon") : '',
|
|
282
|
+
role: "alert"
|
|
283
|
+
}, iconNode, /*#__PURE__*/React.createElement("div", {
|
|
284
|
+
className: "".concat(prefixCls, "-message")
|
|
285
|
+
}, autoMarginTag, message), /*#__PURE__*/React.createElement("div", {
|
|
286
|
+
className: "".concat(prefixCls, "-description")
|
|
287
|
+
}, description), btn ? /*#__PURE__*/React.createElement("span", {
|
|
288
|
+
className: "".concat(prefixCls, "-btn")
|
|
289
|
+
}, btn) : null, progress && duration > 0 && /*#__PURE__*/React.createElement("div", {
|
|
290
|
+
className: 'message_progress',
|
|
291
|
+
style: {
|
|
292
|
+
animationDuration: "".concat(duration, "s")
|
|
293
|
+
}
|
|
294
|
+
}))),
|
|
295
|
+
duration: duration,
|
|
296
|
+
closable: true,
|
|
297
|
+
closeIcon: closeIconToRender,
|
|
298
|
+
onClose: onClose,
|
|
299
|
+
onClick: onClick,
|
|
300
|
+
key: key,
|
|
301
|
+
style: style || {},
|
|
302
|
+
className: (0, _classnames.default)(className, (0, _defineProperty2.default)({}, "".concat(prefixCls, "-").concat(type), !!type), 'lm_notification')
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function notice(args) {
|
|
307
|
+
getNotificationInstance(args, function (_ref) {
|
|
308
|
+
var prefixCls = _ref.prefixCls,
|
|
309
|
+
iconPrefixCls = _ref.iconPrefixCls,
|
|
310
|
+
instance = _ref.instance;
|
|
311
|
+
instance.notice(getRCNoticeProps(args, prefixCls, iconPrefixCls));
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
var api = {
|
|
316
|
+
open: notice,
|
|
317
|
+
close: function close(key) {
|
|
318
|
+
Object.keys(notificationInstance).forEach(function (cacheKey) {
|
|
319
|
+
return Promise.resolve(notificationInstance[cacheKey]).then(function (instance) {
|
|
320
|
+
instance.removeNotice(key);
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
},
|
|
324
|
+
config: setNotificationConfig,
|
|
325
|
+
destroy: function destroy() {
|
|
326
|
+
Object.keys(notificationInstance).forEach(function (cacheKey) {
|
|
327
|
+
Promise.resolve(notificationInstance[cacheKey]).then(function (instance) {
|
|
328
|
+
instance.destroy();
|
|
329
|
+
});
|
|
330
|
+
delete notificationInstance[cacheKey]; // lgtm[js/missing-await]
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
['success', 'info', 'warning', 'error'].forEach(function (type) {
|
|
335
|
+
api[type] = function (args) {
|
|
336
|
+
return api.open(Object.assign(Object.assign({}, args), {
|
|
337
|
+
type: type
|
|
338
|
+
}));
|
|
339
|
+
};
|
|
340
|
+
});
|
|
341
|
+
api.warn = api.warning;
|
|
342
|
+
api.useNotification = (0, _useNotification.default)(getNotificationInstance, getRCNoticeProps);
|
|
343
|
+
api.antdNotification = _notification2.default;
|
|
344
|
+
/** @private test Only function. Not work on production */
|
|
345
|
+
|
|
346
|
+
var getInstance = function getInstance(cacheKey) {
|
|
347
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
348
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
349
|
+
while (1) {
|
|
350
|
+
switch (_context.prev = _context.next) {
|
|
351
|
+
case 0:
|
|
352
|
+
return _context.abrupt("return", process.env.NODE_ENV === 'test' ? notificationInstance[cacheKey] : null);
|
|
353
|
+
|
|
354
|
+
case 1:
|
|
355
|
+
case "end":
|
|
356
|
+
return _context.stop();
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}, _callee);
|
|
360
|
+
}));
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
exports.getInstance = getInstance;
|
|
364
|
+
var _default = api;
|
|
365
|
+
exports.default = _default;
|