@lingxiteam/assets 4.0.1-alpha.2 → 4.1.1
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/es/error/errorDisplay/Web/ErrorMsg/index.js +318 -307
- package/es/error/errorDisplay/Web/Notification/Notice.js +7 -2
- package/es/error/errorDisplay/Web/Notification/Notification.js +26 -7
- package/es/error/errorDisplay/Web/Notification/Notification.less +23 -0
- package/es/error/errorDisplay/Web/Notification/index.js +4 -0
- package/es/error/errorDisplay/Web/defaultGlobalConfig.js +2 -0
- package/lib/error/errorDisplay/Web/ErrorMsg/index.js +318 -307
- package/lib/error/errorDisplay/Web/Notification/Notice.js +7 -2
- package/lib/error/errorDisplay/Web/Notification/Notification.js +26 -7
- package/lib/error/errorDisplay/Web/Notification/Notification.less +23 -0
- package/lib/error/errorDisplay/Web/Notification/index.js +4 -0
- package/lib/error/errorDisplay/Web/defaultGlobalConfig.js +2 -0
- package/package.json +1 -1
|
@@ -21,7 +21,9 @@ var Notice = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
21
21
|
footer = props.footer,
|
|
22
22
|
maxLine = props.maxLine,
|
|
23
23
|
maxLen = props.maxLen,
|
|
24
|
-
duration = props.duration
|
|
24
|
+
duration = props.duration,
|
|
25
|
+
badge = props.badge,
|
|
26
|
+
onShowStash = props.onShowStash;
|
|
25
27
|
var _useState = useState(),
|
|
26
28
|
_useState2 = _slicedToArray(_useState, 2),
|
|
27
29
|
footerContent = _useState2[0],
|
|
@@ -98,7 +100,10 @@ var Notice = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
98
100
|
}
|
|
99
101
|
}, /*#__PURE__*/React.createElement("div", {
|
|
100
102
|
className: "lx-notification-notice"
|
|
101
|
-
},
|
|
103
|
+
}, badge ? /*#__PURE__*/React.createElement("i", {
|
|
104
|
+
className: "lx-notification-notice-badge",
|
|
105
|
+
onClick: onShowStash
|
|
106
|
+
}, badge + 1) : null, isDomEle(title) ? /*#__PURE__*/React.createElement("div", {
|
|
102
107
|
className: "lx-notification-notice-head"
|
|
103
108
|
}, /*#__PURE__*/React.createElement("img", {
|
|
104
109
|
src: getSvgImageBase64(WarnIcon),
|
|
@@ -25,12 +25,14 @@ import Notice from './Notice';
|
|
|
25
25
|
import './Notification.less';
|
|
26
26
|
var keyNbr = 0;
|
|
27
27
|
var Notification = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
28
|
-
var _props$maxCount = props.maxCount,
|
|
29
|
-
maxCount = _props$maxCount === void 0 ? 6 : _props$maxCount;
|
|
30
28
|
var _useState = useState([]),
|
|
31
29
|
_useState2 = _slicedToArray(_useState, 2),
|
|
32
30
|
configList = _useState2[0],
|
|
33
31
|
setConfigList = _useState2[1];
|
|
32
|
+
var _useState3 = useState([]),
|
|
33
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
34
|
+
stashOpenList = _useState4[0],
|
|
35
|
+
setStashOpenList = _useState4[1];
|
|
34
36
|
var openListRef = useRef([]);
|
|
35
37
|
useMemo(function () {
|
|
36
38
|
openListRef.current = configList;
|
|
@@ -46,6 +48,9 @@ var Notification = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
46
48
|
return item.key !== key;
|
|
47
49
|
});
|
|
48
50
|
});
|
|
51
|
+
if (stashOpenList.length) {
|
|
52
|
+
setStashOpenList([]);
|
|
53
|
+
}
|
|
49
54
|
};
|
|
50
55
|
var onAddNotice = function onAddNotice(config) {
|
|
51
56
|
setConfigList(function (list) {
|
|
@@ -69,12 +74,17 @@ var Notification = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
69
74
|
}
|
|
70
75
|
}));
|
|
71
76
|
}
|
|
72
|
-
if (maxCount > 0 && clone.length > maxCount) {
|
|
73
|
-
clone = clone.slice(-maxCount);
|
|
74
|
-
}
|
|
75
77
|
return clone;
|
|
76
78
|
});
|
|
77
79
|
};
|
|
80
|
+
var onShowStash = function onShowStash() {
|
|
81
|
+
if (stashOpenList.length) {
|
|
82
|
+
stashOpenList.forEach(function (item) {
|
|
83
|
+
return onAddNotice(item);
|
|
84
|
+
});
|
|
85
|
+
setStashOpenList([]);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
78
88
|
useImperativeHandle(ref, function () {
|
|
79
89
|
return {
|
|
80
90
|
open: onAddNotice,
|
|
@@ -89,6 +99,11 @@ var Notification = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
89
99
|
},
|
|
90
100
|
setOpenList: function setOpenList(_param) {
|
|
91
101
|
setConfigList(_toConsumableArray(_param));
|
|
102
|
+
},
|
|
103
|
+
stashOpenListSet: function stashOpenListSet(config) {
|
|
104
|
+
setStashOpenList(function (pre) {
|
|
105
|
+
return [].concat(_toConsumableArray(pre), [config]);
|
|
106
|
+
});
|
|
92
107
|
}
|
|
93
108
|
};
|
|
94
109
|
});
|
|
@@ -97,7 +112,10 @@ var Notification = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
97
112
|
return configList.map(function (notice) {
|
|
98
113
|
return /*#__PURE__*/React.createElement(Notice, _extends({
|
|
99
114
|
itemKey: notice === null || notice === void 0 ? void 0 : notice.itemKey
|
|
100
|
-
}, notice
|
|
115
|
+
}, notice, {
|
|
116
|
+
onShowStash: onShowStash,
|
|
117
|
+
badge: stashOpenList.length
|
|
118
|
+
}));
|
|
101
119
|
});
|
|
102
120
|
}
|
|
103
121
|
return '';
|
|
@@ -136,7 +154,8 @@ Notification.insert = function () {
|
|
|
136
154
|
close: notification.close,
|
|
137
155
|
destroy: notification.destroy,
|
|
138
156
|
getOpenList: notification.getOpenList,
|
|
139
|
-
setOpenList: notification.setOpenList
|
|
157
|
+
setOpenList: notification.setOpenList,
|
|
158
|
+
stashOpenListSet: notification.stashOpenListSet
|
|
140
159
|
});
|
|
141
160
|
};
|
|
142
161
|
render( /*#__PURE__*/React.createElement(Notification, _extends({}, props, {
|
|
@@ -47,6 +47,29 @@
|
|
|
47
47
|
line-height: 1.5;
|
|
48
48
|
position: relative;
|
|
49
49
|
cursor: default;
|
|
50
|
+
|
|
51
|
+
&-badge {
|
|
52
|
+
position: absolute;
|
|
53
|
+
top: 0;
|
|
54
|
+
right: 0;
|
|
55
|
+
transform: translate(50%,-50%);
|
|
56
|
+
transform-origin: 100% 0%;
|
|
57
|
+
z-index: auto;
|
|
58
|
+
min-width: 20px;
|
|
59
|
+
height: 20px;
|
|
60
|
+
padding: 0 6px;
|
|
61
|
+
color: #fff;
|
|
62
|
+
font-weight: 400;
|
|
63
|
+
font-style:normal;
|
|
64
|
+
font-size: 12px;
|
|
65
|
+
line-height: 20px;
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
text-align: center;
|
|
68
|
+
background: #ff4d4f;
|
|
69
|
+
border-radius: 10px;
|
|
70
|
+
box-shadow: 0 0 0 1px #fff;
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
}
|
|
50
73
|
|
|
51
74
|
&-head {
|
|
52
75
|
display: flex;
|
|
@@ -89,6 +89,10 @@ var ontificationAPI = {
|
|
|
89
89
|
},
|
|
90
90
|
setOpenList: function setOpenList(_arr) {
|
|
91
91
|
return Object.values(notificationInstance)[0].setOpenList(_arr);
|
|
92
|
+
},
|
|
93
|
+
stashOpenListSet: function stashOpenListSet(_args) {
|
|
94
|
+
// console.log(Object.values(notificationInstance)[0]);
|
|
95
|
+
Object.values(notificationInstance)[0].stashOpenListSet(_args);
|
|
92
96
|
}
|
|
93
97
|
};
|
|
94
98
|
export { notificationInstance };
|