@lingxiteam/assets 0.9.30 → 0.11.30-alpha-2

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.
Files changed (49) hide show
  1. package/es/IconSvg/index.js +7 -13
  2. package/es/error/errorCatch/index.js +0 -0
  3. package/es/error/errorDisplay/Mobile/Drawer/Drawer.js +104 -0
  4. package/es/error/errorDisplay/Mobile/Drawer/Drawer.less +177 -0
  5. package/es/error/errorDisplay/Mobile/Drawer/index.js +132 -0
  6. package/es/error/errorDisplay/Mobile/ErrorMsg/index.js +199 -0
  7. package/es/error/errorDisplay/Mobile/Modal/Modal.js +43 -0
  8. package/es/error/errorDisplay/Mobile/Modal/Modal.less +146 -0
  9. package/es/error/errorDisplay/Mobile/Modal/index.js +119 -0
  10. package/es/error/errorDisplay/Mobile/defaultGlobalConfig.js +12 -0
  11. package/es/error/errorDisplay/SVGstring.js +6 -0
  12. package/es/error/errorDisplay/Web/Drawer/Drawer.js +232 -0
  13. package/es/error/errorDisplay/Web/Drawer/Drawer.less +354 -0
  14. package/es/error/errorDisplay/Web/Drawer/DrawerConnect.js +203 -0
  15. package/es/error/errorDisplay/Web/Drawer/index.js +124 -0
  16. package/es/error/errorDisplay/Web/ErrorMsg/index.js +241 -0
  17. package/es/error/errorDisplay/Web/Notification/Notice.js +151 -0
  18. package/es/error/errorDisplay/Web/Notification/Notification.js +129 -0
  19. package/es/error/errorDisplay/Web/Notification/Notification.less +134 -0
  20. package/es/error/errorDisplay/Web/Notification/index.js +84 -0
  21. package/es/error/errorDisplay/Web/defaultGlobalConfig.js +12 -0
  22. package/es/error/errorDisplay/animation.less +112 -0
  23. package/es/error/errorDisplay/compUtils.js +16 -0
  24. package/es/error/errorDisplay/const.js +44 -0
  25. package/es/error/errorDisplay/http.js +103 -0
  26. package/es/error/errorDisplay/variables.less +1 -0
  27. package/es/error/index.js +3 -0
  28. package/es/images/ico-back.png +0 -0
  29. package/es/index.d.ts +2 -1
  30. package/es/index.js +2 -1
  31. package/es/security/const.d.ts +14 -0
  32. package/es/security/const.js +16 -0
  33. package/es/security/encipher/aes.d.ts +2 -0
  34. package/es/security/encipher/aes.js +26 -0
  35. package/es/security/encipher/des.d.ts +2 -0
  36. package/es/security/encipher/des.js +25 -0
  37. package/es/security/encipher/rsa.d.ts +2 -0
  38. package/es/security/encipher/rsa.js +17 -0
  39. package/es/security/{sign.d.ts → encipher/sign.d.ts} +0 -0
  40. package/es/security/{sign.js → encipher/sign.js} +27 -50
  41. package/es/security/fetch.d.ts +6 -2
  42. package/es/security/fetch.js +193 -19
  43. package/es/security/httpEncryption.js +22 -17
  44. package/es/security/index.d.ts +11 -4
  45. package/es/security/index.js +5 -1
  46. package/es/utils/url.d.ts +1 -0
  47. package/es/utils/url.js +24 -0
  48. package/lib/index.js +13 -4
  49. package/package.json +4 -2
@@ -0,0 +1,151 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
5
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import React, { useEffect, isValidElement, forwardRef, useRef, useState, useCallback } from 'react';
8
+ import { CloseIcon, WarnIcon } from '../../SVGstring';
9
+ import { getSvgImageBase64 } from '../../../../utils/img';
10
+ var isDomEle = function isDomEle(target) {
11
+ return typeof target === 'string' || /*#__PURE__*/isValidElement(target);
12
+ };
13
+ var Notice = /*#__PURE__*/forwardRef(function (props, ref) {
14
+ var title = props.title,
15
+ code = props.code,
16
+ extra = props.extra,
17
+ content = props.content,
18
+ onClose = props.onClose,
19
+ footer = props.footer,
20
+ maxLine = props.maxLine,
21
+ maxLen = props.maxLen,
22
+ duration = props.duration;
23
+ var _useState = useState(),
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ footerContent = _useState2[0],
26
+ setFooterContent = _useState2[1];
27
+ var _useState3 = useState(!!duration),
28
+ _useState4 = _slicedToArray(_useState3, 2),
29
+ isCountDown = _useState4[0],
30
+ setIsCountDown = _useState4[1];
31
+ var circleRef = useRef();
32
+ var countDownTime = useRef(duration);
33
+ var lastTime = useRef();
34
+ var timer = useRef();
35
+ var updateCountDown = useCallback(function (timestamp) {
36
+ lastTime.current = lastTime.current || timestamp;
37
+ var tickInterval = timestamp - lastTime.current;
38
+ if (countDownTime.current - tickInterval > 0) {
39
+ var _circleRef$current;
40
+ countDownTime.current -= tickInterval;
41
+ lastTime.current = timestamp;
42
+ circleRef === null || circleRef === void 0 ? void 0 : (_circleRef$current = circleRef.current) === null || _circleRef$current === void 0 ? void 0 : _circleRef$current.setAttribute('stroke-dasharray', "".concat(57 * (countDownTime.current / duration), " 57"));
43
+ timer.current = window.requestAnimationFrame(updateCountDown);
44
+ } else {
45
+ onClose();
46
+ }
47
+ });
48
+ var autoClose = function autoClose() {
49
+ if (onClose instanceof Function && typeof duration === 'number') {
50
+ setIsCountDown(true);
51
+ timer.current = window.requestAnimationFrame(updateCountDown);
52
+ }
53
+ };
54
+ var stopAutoClose = function stopAutoClose() {
55
+ setIsCountDown(false);
56
+ lastTime.current = null;
57
+ window.cancelAnimationFrame(timer.current);
58
+ };
59
+ useEffect(function () {
60
+ autoClose();
61
+ return function () {
62
+ stopAutoClose();
63
+ };
64
+ }, [onClose, duration]);
65
+ useEffect(function () {
66
+ if (typeof footer === 'function') {
67
+ footer({
68
+ title: title,
69
+ content: content,
70
+ handels: {
71
+ stopAutoClose: stopAutoClose,
72
+ autoClose: autoClose,
73
+ onClose: onClose
74
+ }
75
+ }).then(function (els) {
76
+ setFooterContent(els);
77
+ });
78
+ }
79
+ }, []);
80
+ return /*#__PURE__*/React.createElement("div", {
81
+ className: "lx-notification-wraper opening",
82
+ ref: ref,
83
+ onFocus: function onFocus() {
84
+ stopAutoClose();
85
+ },
86
+ onBlur: function onBlur() {
87
+ autoClose();
88
+ },
89
+ onMouseEnter: function onMouseEnter() {
90
+ stopAutoClose();
91
+ },
92
+ onMouseLeave: function onMouseLeave() {
93
+ autoClose();
94
+ }
95
+ }, /*#__PURE__*/React.createElement("div", {
96
+ className: "lx-notification-notice"
97
+ }, isDomEle(title) ? /*#__PURE__*/React.createElement("div", {
98
+ className: "lx-notification-notice-head"
99
+ }, /*#__PURE__*/React.createElement("img", {
100
+ src: getSvgImageBase64(WarnIcon),
101
+ alt: "",
102
+ className: "lx-notification-notice-head-state"
103
+ }), /*#__PURE__*/React.createElement("div", {
104
+ className: "lx-notification-notice-head-title"
105
+ }, title, isDomEle(code) ? /*#__PURE__*/React.createElement("span", {
106
+ className: "lx-notification-notice-head-code"
107
+ }, code) : ''), isDomEle(extra) ? /*#__PURE__*/React.createElement("div", {
108
+ className: "lx-notification-notice-head-extra"
109
+ }, extra) : null, isCountDown ? /*#__PURE__*/React.createElement("svg", {
110
+ width: "20",
111
+ height: "20",
112
+ viewBox: "0 0 20 20",
113
+ className: "lx-notification-notice-head-count-down"
114
+ }, /*#__PURE__*/React.createElement("circle", {
115
+ cx: "10",
116
+ cy: "10",
117
+ r: "9",
118
+ strokeWidth: "2",
119
+ stroke: "#D1D3D7",
120
+ fill: "none",
121
+ strokeLinecap: "round"
122
+ }), /*#__PURE__*/React.createElement("circle", {
123
+ cx: "10",
124
+ cy: "10",
125
+ r: "9",
126
+ strokeWidth: "2",
127
+ stroke: "#4477ee",
128
+ fill: "none",
129
+ transform: "matrix(0,-1,1,0,0,20)",
130
+ ref: circleRef,
131
+ strokeDasharray: "57 57",
132
+ strokeLinecap: "round"
133
+ })) : /*#__PURE__*/React.createElement("div", {
134
+ className: "lx-notification-notice-head-extra",
135
+ onClick: function onClick() {
136
+ onClose();
137
+ }
138
+ }, /*#__PURE__*/React.createElement("img", {
139
+ src: getSvgImageBase64(CloseIcon),
140
+ alt: "",
141
+ className: "lx-notification-notice-head-ico"
142
+ }))) : null, isDomEle(content) ? /*#__PURE__*/React.createElement("div", {
143
+ className: "lx-notification-notice-content ".concat(maxLine && 'max-line'),
144
+ style: maxLine ? {
145
+ WebkitLineClamp: maxLine
146
+ } : {}
147
+ }, maxLen && typeof content === 'string' && content.length > maxLen ? "".concat(content.slice(0, maxLen), "...") : content) : null, isDomEle(footerContent) ? /*#__PURE__*/React.createElement("div", {
148
+ className: "lx-notification-notice-footer"
149
+ }, footerContent) : null));
150
+ });
151
+ export default Notice;
@@ -0,0 +1,129 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ var _excluded = ["getContainer", "placement"];
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
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
5
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
+ 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; }
9
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
11
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
12
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
14
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
15
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
16
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
17
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
18
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
19
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
20
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
+ import React, { forwardRef, useImperativeHandle, useState } from 'react';
22
+ import { render } from 'react-dom';
23
+ import { getChildren } from '../../compUtils';
24
+ import Notice from './Notice';
25
+ import './Notification.less';
26
+ var keyNbr = 0;
27
+ var Notification = /*#__PURE__*/forwardRef(function (props, ref) {
28
+ var _props$maxCount = props.maxCount,
29
+ maxCount = _props$maxCount === void 0 ? 6 : _props$maxCount;
30
+ var _useState = useState([]),
31
+ _useState2 = _slicedToArray(_useState, 2),
32
+ configList = _useState2[0],
33
+ setConfigList = _useState2[1];
34
+ var onNoticeClose = function onNoticeClose(key) {
35
+ var _config$onClose;
36
+ var config = configList.find(function (item) {
37
+ return item.key === key;
38
+ });
39
+ config === null || config === void 0 ? void 0 : (_config$onClose = config.onClose) === null || _config$onClose === void 0 ? void 0 : _config$onClose.call(config);
40
+ setConfigList(function (list) {
41
+ return list.filter(function (item) {
42
+ return item.key !== key;
43
+ });
44
+ });
45
+ };
46
+ var onAddNotice = function onAddNotice(config) {
47
+ setConfigList(function (list) {
48
+ var clone = _toConsumableArray(list);
49
+ var nowKey = config === null || config === void 0 ? void 0 : config.key;
50
+ if (!nowKey) {
51
+ nowKey = "lx-notification-".concat(keyNbr);
52
+ keyNbr += 1;
53
+ }
54
+ var index = clone.findIndex(function (item) {
55
+ return item.key === nowKey;
56
+ });
57
+ if (index >= 0) {
58
+ clone[index] = config;
59
+ } else {
60
+ clone.push(_objectSpread(_objectSpread({}, config), {}, {
61
+ key: nowKey,
62
+ onClose: function onClose() {
63
+ onNoticeClose(nowKey);
64
+ }
65
+ }));
66
+ }
67
+ if (maxCount > 0 && clone.length > maxCount) {
68
+ clone = clone.slice(-maxCount);
69
+ }
70
+ return clone;
71
+ });
72
+ };
73
+ useImperativeHandle(ref, function () {
74
+ return {
75
+ open: onAddNotice,
76
+ close: function close(key) {
77
+ onNoticeClose(key);
78
+ },
79
+ destroy: function destroy() {
80
+ setConfigList([]);
81
+ }
82
+ };
83
+ });
84
+ var renderCfgList = function renderCfgList() {
85
+ if (Array.isArray(configList) && configList.length > 0) {
86
+ return configList.map(function (notice) {
87
+ return /*#__PURE__*/React.createElement(Notice, notice);
88
+ });
89
+ }
90
+ return '';
91
+ };
92
+ return renderCfgList();
93
+ });
94
+ Notification.insert = function () {
95
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
96
+ var callback = arguments.length > 1 ? arguments[1] : undefined;
97
+ var _ref = options || {},
98
+ getContainer = _ref.getContainer,
99
+ placement = _ref.placement,
100
+ props = _objectWithoutProperties(_ref, _excluded);
101
+ var root = getContainer ? getContainer() : document.body;
102
+ var placementCls = typeof placement === 'string' && ['topRight', 'topLeft', 'bottomRight', 'bottomLeft'].includes(placement) ? placement : 'topRight';
103
+ var key = "lx-notification-root-".concat(placementCls);
104
+ var clsName = "lx-notification-root ".concat(placementCls);
105
+ var rootChild = root ? getChildren(root) : [];
106
+ var div = rootChild.find(function (item) {
107
+ return item.getAttribute('lx-comp-key') === key;
108
+ });
109
+ if (!div) {
110
+ div = document.createElement('div');
111
+ div.setAttribute('lx-comp-key', key);
112
+ div.className = clsName;
113
+ root.appendChild(div);
114
+ }
115
+ var called = false;
116
+ var ref = function ref(notification) {
117
+ if (called) {
118
+ return;
119
+ }
120
+ called = true;
121
+ callback({
122
+ open: notification.open
123
+ });
124
+ };
125
+ render( /*#__PURE__*/React.createElement(Notification, _extends({}, props, {
126
+ ref: ref
127
+ })), div);
128
+ };
129
+ export default Notification;
@@ -0,0 +1,134 @@
1
+ @import url('../../animation.less');
2
+
3
+ .lx-notification {
4
+ &-root {
5
+ position: fixed;
6
+ z-index: 99999;
7
+
8
+ &.topRight {
9
+ top: 24px;
10
+ right: 24px;
11
+ }
12
+
13
+ &.topLeft {
14
+ top: 24px;
15
+ left: 24px;
16
+ }
17
+
18
+ &.bottomRight {
19
+ bottom: 24px;
20
+ right: 24px;
21
+ }
22
+
23
+ &.bottomLeft {
24
+ bottom: 24px;
25
+ left: 24px;
26
+ }
27
+ }
28
+
29
+ &-wraper {
30
+ margin-bottom: 24px;
31
+
32
+ &.opening {
33
+ animation: lxMoveOpen 0.3s;
34
+ }
35
+ }
36
+
37
+ &-notice {
38
+ width: 350px;
39
+ padding: 16px 12px;
40
+ border-radius: 4px;
41
+ box-shadow:
42
+ 0 9px 28px 8px rgba(0, 0, 0, 0.05),
43
+ 0 6px 16px 0 rgba(0, 0, 0, 0.08),
44
+ 0 3px 6px -4px rgba(0, 0, 0, 0.12);
45
+ background: #fff;
46
+ display: block;
47
+ line-height: 1.5;
48
+ position: relative;
49
+ cursor: default;
50
+
51
+ &-head {
52
+ display: flex;
53
+ align-items: flex-start;
54
+
55
+ // circle {
56
+ // -webkit-transition: stroke-dasharray .5s;
57
+ // transition: stroke-dasharray .5s;
58
+ // }
59
+
60
+ &-state,
61
+ &-ico {
62
+ width: 16px;
63
+ height: 16px;
64
+ display: inline-block;
65
+ vertical-align: middle;
66
+ }
67
+
68
+ &-state {
69
+ margin-right: 4px;
70
+ margin-top: 4px;
71
+ }
72
+
73
+ &-title {
74
+ font-size: 16px;
75
+ flex: 1;
76
+ }
77
+
78
+ &-code {
79
+ margin-left: 12px;
80
+ font-size: 12px;
81
+ color: rgba(28, 36, 46, 0.45);
82
+ }
83
+
84
+ &-count-down {
85
+ animation: lxFadeIn 0.5s;
86
+ }
87
+ &-extra {
88
+ width: 20px;
89
+ height: 20px;
90
+ text-align: center;
91
+ }
92
+ &-extra &-ico {
93
+ cursor: pointer;
94
+ border-radius: 10px;
95
+ animation: lxFadeIn 0.5s;
96
+ transition: transform 0.5s;
97
+ &:hover {
98
+ // animation: lxCloseRotate 0.5s;
99
+ transform: rotate(180deg);
100
+ }
101
+ }
102
+
103
+ &-title + &-extra {
104
+ margin-left: 20px;
105
+ }
106
+ }
107
+
108
+ &-content {
109
+ color: rgba(28, 36, 46, 0.85);
110
+ font-size: 14px;
111
+ line-height: 22px;
112
+ &.max-line {
113
+ display: -webkit-box;
114
+ overflow: hidden;
115
+ text-overflow: ellipsis;
116
+ -webkit-box-orient: vertical;
117
+ }
118
+ }
119
+
120
+ &-head + &-content,
121
+ &-content + &-content {
122
+ margin-top: 8px;
123
+ }
124
+
125
+ &-head + &-footer,
126
+ &-content + &-footer {
127
+ margin-top: 12px;
128
+ }
129
+
130
+ &-footer {
131
+ text-align: right;
132
+ }
133
+ }
134
+ }
@@ -0,0 +1,84 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ import Notification from './Notification';
6
+ var notificationInstance = {};
7
+ function getNotificationInstance() {
8
+ return _getNotificationInstance.apply(this, arguments);
9
+ }
10
+ function _getNotificationInstance() {
11
+ _getNotificationInstance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
12
+ var args,
13
+ callback,
14
+ _ref2,
15
+ _ref2$placement,
16
+ placement,
17
+ cacheKey,
18
+ cacheInstance,
19
+ _args = arguments;
20
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
21
+ while (1) {
22
+ switch (_context.prev = _context.next) {
23
+ case 0:
24
+ args = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
25
+ callback = _args.length > 1 ? _args[1] : undefined;
26
+ _ref2 = args || {}, _ref2$placement = _ref2.placement, placement = _ref2$placement === void 0 ? 'topRight' : _ref2$placement;
27
+ cacheKey = "lx-notification-root ".concat(placement);
28
+ cacheInstance = notificationInstance[cacheKey];
29
+ if (!cacheInstance) {
30
+ _context.next = 8;
31
+ break;
32
+ }
33
+ Promise.resolve(cacheInstance).then(function (instance) {
34
+ callback({
35
+ instance: instance
36
+ });
37
+ });
38
+ return _context.abrupt("return");
39
+ case 8:
40
+ _context.next = 10;
41
+ return new Promise(function (resolve) {
42
+ Notification.insert(args, function (notification) {
43
+ resolve(notification);
44
+ callback({
45
+ instance: notification
46
+ });
47
+ });
48
+ });
49
+ case 10:
50
+ notificationInstance[cacheKey] = _context.sent;
51
+ case 11:
52
+ case "end":
53
+ return _context.stop();
54
+ }
55
+ }
56
+ }, _callee);
57
+ }));
58
+ return _getNotificationInstance.apply(this, arguments);
59
+ }
60
+ function notice(args) {
61
+ getNotificationInstance(args, function (_ref) {
62
+ var instance = _ref.instance;
63
+ instance.open(args);
64
+ });
65
+ }
66
+ var ontificationAPI = {
67
+ open: notice,
68
+ close: function close(key) {
69
+ Object.keys(notificationInstance).forEach(function (cacheKey) {
70
+ return Promise.resolve(notificationInstance[cacheKey]).then(function (instance) {
71
+ instance.close(key);
72
+ });
73
+ });
74
+ },
75
+ destroy: function destroy() {
76
+ Object.keys(notificationInstance).forEach(function (cacheKey) {
77
+ Promise.resolve(notificationInstance[cacheKey]).then(function (instance) {
78
+ instance.destroy();
79
+ });
80
+ delete notificationInstance[cacheKey];
81
+ });
82
+ }
83
+ };
84
+ export default ontificationAPI;
@@ -0,0 +1,12 @@
1
+ export var defaultGlobalConfig = {
2
+ duration: 4500,
3
+ maxLine: null,
4
+ maxLen: null,
5
+ showType: 'notification',
6
+ maxCount: null,
7
+ resolve: process.env.LingXi_ERROR_RESLOVE || '/api/lcdp/error/queryErrorInfoByCodeOrMsg'
8
+ };
9
+ export var setGlobalConfig = function setGlobalConfig() {
10
+ var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
11
+ Object.assign(defaultGlobalConfig, config);
12
+ };
@@ -0,0 +1,112 @@
1
+ @keyframes lxFadeIn {
2
+ from {
3
+ opacity: 0;
4
+ }
5
+
6
+ to {
7
+ opacity: 1;
8
+ }
9
+ }
10
+
11
+ @keyframes lxFadeOut {
12
+ from {
13
+ opacity: 1;
14
+ }
15
+
16
+ to {
17
+ opacity: 0;
18
+ }
19
+ }
20
+
21
+ @keyframes lxMoveOpen {
22
+ from {
23
+ transform: translateX(100%);
24
+ opacity: 0;
25
+ }
26
+
27
+ to {
28
+ transform: translateX(0);
29
+ opacity: 1;
30
+ }
31
+ }
32
+
33
+ @keyframes lxMoveClose {
34
+ from {
35
+ transform: translateX(0);
36
+ opacity: 1;
37
+ }
38
+
39
+ to {
40
+ transform: translateX(100%);
41
+ opacity: 0;
42
+ }
43
+ }
44
+
45
+
46
+ @keyframes lxmModalOpen {
47
+ from {
48
+ transform: scale(0.6);
49
+ opacity: 0;
50
+ }
51
+
52
+ to {
53
+ transform: scale(1);
54
+ opacity: 1;
55
+ }
56
+ }
57
+
58
+ @keyframes lxmModalClose {
59
+ from {
60
+ transform: scale(1);
61
+ opacity: 1;
62
+ }
63
+
64
+ to {
65
+ transform: scale(0.6);
66
+ opacity: 0;
67
+ }
68
+ }
69
+
70
+ @keyframes lxmModalMaskClose {
71
+ from {
72
+ opacity: 1;
73
+ }
74
+
75
+ to {
76
+ opacity: 0;
77
+ }
78
+ }
79
+
80
+ @keyframes lxmDrawerOpen {
81
+ from {
82
+ transform: translateX(100%);
83
+ opacity: 0;
84
+ }
85
+
86
+ to {
87
+ transform: translateX(0);
88
+ opacity: 1;
89
+ }
90
+ }
91
+
92
+ @keyframes lxmDrawerClose {
93
+ from {
94
+ transform: translateX(0);
95
+ opacity: 1;
96
+ }
97
+
98
+ to {
99
+ transform: translateX(100%);
100
+ opacity: 0;
101
+ }
102
+ }
103
+
104
+ @keyframes lxCloseRotate {
105
+ form {
106
+ transform: rotate(0);
107
+ }
108
+
109
+ to {
110
+ transform: rotate(180deg);
111
+ }
112
+ }
@@ -0,0 +1,16 @@
1
+ function getChildren(obj) {
2
+ var objChild = [];
3
+ var objs = obj.getElementsByTagName('*');
4
+ for (var i = 0, j = objs.length; i < j; i += 1) {
5
+ var temp = objs[i].parentNode;
6
+ if (temp.nodeType === 1) {
7
+ if (temp === obj) {
8
+ objChild.push(objs[i]);
9
+ }
10
+ } else if (temp.parentNode === obj) {
11
+ objChild.push(objs[i]);
12
+ }
13
+ }
14
+ return objChild;
15
+ }
16
+ export { getChildren };