@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.
- package/es/IconSvg/index.js +7 -13
- package/es/error/errorCatch/index.js +0 -0
- package/es/error/errorDisplay/Mobile/Drawer/Drawer.js +104 -0
- package/es/error/errorDisplay/Mobile/Drawer/Drawer.less +177 -0
- package/es/error/errorDisplay/Mobile/Drawer/index.js +132 -0
- package/es/error/errorDisplay/Mobile/ErrorMsg/index.js +199 -0
- package/es/error/errorDisplay/Mobile/Modal/Modal.js +43 -0
- package/es/error/errorDisplay/Mobile/Modal/Modal.less +146 -0
- package/es/error/errorDisplay/Mobile/Modal/index.js +119 -0
- package/es/error/errorDisplay/Mobile/defaultGlobalConfig.js +12 -0
- package/es/error/errorDisplay/SVGstring.js +6 -0
- package/es/error/errorDisplay/Web/Drawer/Drawer.js +232 -0
- package/es/error/errorDisplay/Web/Drawer/Drawer.less +354 -0
- package/es/error/errorDisplay/Web/Drawer/DrawerConnect.js +203 -0
- package/es/error/errorDisplay/Web/Drawer/index.js +124 -0
- package/es/error/errorDisplay/Web/ErrorMsg/index.js +241 -0
- package/es/error/errorDisplay/Web/Notification/Notice.js +151 -0
- package/es/error/errorDisplay/Web/Notification/Notification.js +129 -0
- package/es/error/errorDisplay/Web/Notification/Notification.less +134 -0
- package/es/error/errorDisplay/Web/Notification/index.js +84 -0
- package/es/error/errorDisplay/Web/defaultGlobalConfig.js +12 -0
- package/es/error/errorDisplay/animation.less +112 -0
- package/es/error/errorDisplay/compUtils.js +16 -0
- package/es/error/errorDisplay/const.js +44 -0
- package/es/error/errorDisplay/http.js +103 -0
- package/es/error/errorDisplay/variables.less +1 -0
- package/es/error/index.js +3 -0
- package/es/images/ico-back.png +0 -0
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/security/const.d.ts +14 -0
- package/es/security/const.js +16 -0
- package/es/security/encipher/aes.d.ts +2 -0
- package/es/security/encipher/aes.js +26 -0
- package/es/security/encipher/des.d.ts +2 -0
- package/es/security/encipher/des.js +25 -0
- package/es/security/encipher/rsa.d.ts +2 -0
- package/es/security/encipher/rsa.js +17 -0
- package/es/security/{sign.d.ts → encipher/sign.d.ts} +0 -0
- package/es/security/{sign.js → encipher/sign.js} +27 -50
- package/es/security/fetch.d.ts +6 -2
- package/es/security/fetch.js +193 -19
- package/es/security/httpEncryption.js +22 -17
- package/es/security/index.d.ts +11 -4
- package/es/security/index.js +5 -1
- package/es/utils/url.d.ts +1 -0
- package/es/utils/url.js +24 -0
- package/lib/index.js +13 -4
- package/package.json +4 -2
package/es/IconSvg/index.js
CHANGED
|
@@ -1,29 +1,23 @@
|
|
|
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); }
|
|
1
2
|
var _excluded = ["style", "src"];
|
|
2
|
-
|
|
3
3
|
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; }
|
|
4
|
-
|
|
5
4
|
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; }
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
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); }
|
|
9
8
|
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; }
|
|
10
|
-
|
|
11
9
|
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; }
|
|
12
|
-
|
|
13
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
11
|
import { getSvgImageBase64 } from '../utils/img';
|
|
15
|
-
|
|
16
12
|
var IconSvg = function IconSvg(props) {
|
|
17
13
|
var _props$style = props.style,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
style = _props$style === void 0 ? {} : _props$style,
|
|
15
|
+
src = props.src,
|
|
16
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
22
17
|
return _jsx("i", _objectSpread(_objectSpread({}, restProps), {}, {
|
|
23
18
|
style: _objectSpread(_objectSpread({}, restProps), {}, {
|
|
24
19
|
backgroundImage: getSvgImageBase64(src)
|
|
25
20
|
})
|
|
26
21
|
}));
|
|
27
22
|
};
|
|
28
|
-
|
|
29
23
|
export default IconSvg;
|
|
File without changes
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import React, { forwardRef, isValidElement } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { BackIcon } from '../../SVGstring';
|
|
4
|
+
import { getSvgImageBase64 } from '../../../../utils/img';
|
|
5
|
+
import './Drawer.less';
|
|
6
|
+
var isDomEle = function isDomEle(target) {
|
|
7
|
+
return typeof target === 'string' || /*#__PURE__*/isValidElement(target);
|
|
8
|
+
};
|
|
9
|
+
var emptyTxt = '暂无匹配信息,请联系平台管理员';
|
|
10
|
+
var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
11
|
+
var visible = props.visible,
|
|
12
|
+
title = props.title,
|
|
13
|
+
tabs = props.tabs,
|
|
14
|
+
activeTabsKey = props.activeTabsKey,
|
|
15
|
+
onTabsChange = props.onTabsChange,
|
|
16
|
+
dataSource = props.dataSource,
|
|
17
|
+
onCancel = props.onCancel,
|
|
18
|
+
onClickRecord = props.onClickRecord,
|
|
19
|
+
_props$mode = props.mode,
|
|
20
|
+
mode = _props$mode === void 0 ? 'content' : _props$mode;
|
|
21
|
+
var renderItems = function renderItems() {
|
|
22
|
+
if (Array.isArray(dataSource) && dataSource.length > 0) {
|
|
23
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
className: "lxm-drawer-list"
|
|
25
|
+
}, dataSource.map(function (item) {
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
key: item === null || item === void 0 ? void 0 : item.key,
|
|
28
|
+
className: classnames('lxm-drawer-list-item', item === null || item === void 0 ? void 0 : item.status),
|
|
29
|
+
onClick: function onClick() {
|
|
30
|
+
onClickRecord(item);
|
|
31
|
+
}
|
|
32
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: "lxm-drawer-list-item-dt"
|
|
34
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: "lxm-drawer-list-item-dt-title"
|
|
36
|
+
}, (item === null || item === void 0 ? void 0 : item.title) || ''), (item === null || item === void 0 ? void 0 : item.extra) ? /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: "lxm-drawer-list-item-dt-extra"
|
|
38
|
+
}, item === null || item === void 0 ? void 0 : item.extra) : ''), /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
className: "lxm-drawer-list-item-dd"
|
|
40
|
+
}, (item === null || item === void 0 ? void 0 : item.content) || ''));
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
className: "lxm-drawer-empty"
|
|
45
|
+
}, "\u6682\u65E0\u6570\u636E");
|
|
46
|
+
};
|
|
47
|
+
var renderContent = function renderContent() {
|
|
48
|
+
if (dataSource && ((dataSource === null || dataSource === void 0 ? void 0 : dataSource.title) || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.author) || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.content))) {
|
|
49
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: "lxm-drawer-content"
|
|
51
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
className: "lxm-drawer-content-head"
|
|
53
|
+
}, isDomEle(dataSource === null || dataSource === void 0 ? void 0 : dataSource.title) ? /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: "lxm-drawer-content-head-title"
|
|
55
|
+
}, dataSource === null || dataSource === void 0 ? void 0 : dataSource.title) : '', isDomEle(dataSource === null || dataSource === void 0 ? void 0 : dataSource.author) ? /*#__PURE__*/React.createElement("div", {
|
|
56
|
+
className: "lxm-drawer-content-head-author"
|
|
57
|
+
}, dataSource === null || dataSource === void 0 ? void 0 : dataSource.author) : ''), /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
className: "lxm-drawer-content-body"
|
|
59
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
// eslint-disable-next-line react/no-danger
|
|
61
|
+
dangerouslySetInnerHTML: {
|
|
62
|
+
__html: dataSource === null || dataSource === void 0 ? void 0 : dataSource.content
|
|
63
|
+
}
|
|
64
|
+
})));
|
|
65
|
+
}
|
|
66
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
className: "lxm-drawer-empty"
|
|
68
|
+
}, emptyTxt);
|
|
69
|
+
};
|
|
70
|
+
return visible ? /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
ref: ref,
|
|
72
|
+
className: "lxm-drawer-wraper"
|
|
73
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
className: "lxm-drawer-container"
|
|
75
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: "lxm-drawer-header"
|
|
77
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: "lxm-drawer-header-extend",
|
|
79
|
+
onClick: onCancel
|
|
80
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
81
|
+
src: getSvgImageBase64(BackIcon),
|
|
82
|
+
alt: "",
|
|
83
|
+
className: "lxm-drawer-header-close"
|
|
84
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
85
|
+
className: "lxm-drawer-header-title"
|
|
86
|
+
}, isDomEle(title) ? title : ''), /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
className: "lxm-drawer-header-extend"
|
|
88
|
+
})), Array.isArray(tabs) && tabs.length > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
89
|
+
className: "lxm-drawer-tabs"
|
|
90
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
className: "lxm-drawer-tabs-row"
|
|
92
|
+
}, tabs.map(function (item) {
|
|
93
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
94
|
+
className: classnames('lxm-drawer-tabs-btn', activeTabsKey === (item === null || item === void 0 ? void 0 : item.key) ? 'active' : ''),
|
|
95
|
+
key: item === null || item === void 0 ? void 0 : item.key,
|
|
96
|
+
onClick: function onClick() {
|
|
97
|
+
onTabsChange(item);
|
|
98
|
+
}
|
|
99
|
+
}, item.tab);
|
|
100
|
+
}))) : '', /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
className: "lxm-drawer-main"
|
|
102
|
+
}, mode === 'list' ? renderItems() : renderContent()))) : '';
|
|
103
|
+
});
|
|
104
|
+
export default Drawer;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
@import url('../../animation.less');
|
|
2
|
+
@import url('../../variables.less');
|
|
3
|
+
|
|
4
|
+
.lxm-drawer {
|
|
5
|
+
&-wraper {
|
|
6
|
+
position: absolute;
|
|
7
|
+
left: 0;
|
|
8
|
+
right: 0;
|
|
9
|
+
bottom: 0;
|
|
10
|
+
top: 0;
|
|
11
|
+
z-index: 9999;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&-close-move &-container {
|
|
16
|
+
animation: lxmDrawerClose 0.3s;
|
|
17
|
+
animation-fill-mode: forwards;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&-container {
|
|
21
|
+
position: relative;
|
|
22
|
+
height: 100%;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
background-color: #fff;
|
|
27
|
+
animation: lxmDrawerOpen 0.3s;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&-header {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
height: 44 * @hd;
|
|
34
|
+
background-color: #f6f8fa;
|
|
35
|
+
|
|
36
|
+
&-close {
|
|
37
|
+
width: 24 * @hd;
|
|
38
|
+
height: 24 * @hd;
|
|
39
|
+
display: inline-block;
|
|
40
|
+
vertical-align: middle;
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&-extend {
|
|
45
|
+
width: 80 * @hd;
|
|
46
|
+
padding: 0 20* @hd;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&-title {
|
|
50
|
+
flex: 1;
|
|
51
|
+
text-align: center;
|
|
52
|
+
font-size: 18* @hd;
|
|
53
|
+
font-weight: 500;
|
|
54
|
+
color: #1c242e;
|
|
55
|
+
white-space: nowrap;
|
|
56
|
+
text-overflow: ellipsis;
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&-tabs {
|
|
62
|
+
padding: 8* @hd 20* @hd;
|
|
63
|
+
background-color: #f6f8fa;
|
|
64
|
+
|
|
65
|
+
&-row {
|
|
66
|
+
background: #f0f0f0;
|
|
67
|
+
border-radius: 8* @hd;
|
|
68
|
+
padding: 4* @hd;
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&-row &-btn {
|
|
74
|
+
color: #1c242e;
|
|
75
|
+
text-align: center;
|
|
76
|
+
padding: 4* @hd;
|
|
77
|
+
font-size: 14* @hd;
|
|
78
|
+
flex: 1;
|
|
79
|
+
border-radius: 8* @hd;
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&-row &-btn.active {
|
|
84
|
+
background-color: #fff;
|
|
85
|
+
font-weight: 500;
|
|
86
|
+
box-shadow: 0 1* @hd 6* @hd -4* @hd rgba(28, 36, 46, 0.15);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&-main {
|
|
91
|
+
border-top: 1px solid #f0f0f0;
|
|
92
|
+
flex: 1;
|
|
93
|
+
background-color: #fff;
|
|
94
|
+
overflow-y: auto;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&-content {
|
|
98
|
+
padding: 20* @hd;
|
|
99
|
+
|
|
100
|
+
&-head {
|
|
101
|
+
margin-bottom: 20* @hd;
|
|
102
|
+
|
|
103
|
+
&-title {
|
|
104
|
+
font-size: 21* @hd;
|
|
105
|
+
font-weight: 500;
|
|
106
|
+
color: #1c242e;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&-author {
|
|
110
|
+
font-size: 13* @hd;
|
|
111
|
+
color: rgba(28, 36, 46, 0.45);;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&-body {
|
|
116
|
+
font-size: 15* @hd;
|
|
117
|
+
color: rgba(28, 36, 46, 0.75);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&-list {
|
|
122
|
+
padding: 0 20* @hd;
|
|
123
|
+
|
|
124
|
+
&-item {
|
|
125
|
+
padding: 8* @hd 0;
|
|
126
|
+
border-bottom: 1px solid #f0f0f0;
|
|
127
|
+
|
|
128
|
+
&.purple &-dt {
|
|
129
|
+
&-title {
|
|
130
|
+
color: #9747ff;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&.blue &-dt {
|
|
135
|
+
&-title {
|
|
136
|
+
color: #47e;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&.red &-dt {
|
|
141
|
+
&-title {
|
|
142
|
+
color: #fa7570;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
&-dt {
|
|
147
|
+
display: flex;
|
|
148
|
+
|
|
149
|
+
&-title {
|
|
150
|
+
flex: 1;
|
|
151
|
+
font-size: 14* @hd;
|
|
152
|
+
font-weight: 500;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&-extra {
|
|
156
|
+
font-size: 12* @hd;
|
|
157
|
+
color: rgba(28, 36, 46, 0.45);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
&-title + &-extra {
|
|
161
|
+
margin-left: 8* @hd;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
&-dd {
|
|
166
|
+
font-size: 12* @hd;
|
|
167
|
+
color: rgba(28, 36, 46, 0.75);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&-empty {
|
|
173
|
+
padding: 20* @hd;
|
|
174
|
+
text-align: center;
|
|
175
|
+
color: rgba(28, 36, 46, 0.45);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
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"],
|
|
3
|
+
_excluded2 = ["close", "onTabsChange", "visible", "getContainer"];
|
|
4
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { createPortal, render, unmountComponentAtNode } from 'react-dom';
|
|
14
|
+
import { getChildren } from '../../compUtils';
|
|
15
|
+
import Drawer from './Drawer';
|
|
16
|
+
var DrawerWraper = function DrawerWraper(props) {
|
|
17
|
+
var _props$getContainer = props.getContainer,
|
|
18
|
+
getContainer = _props$getContainer === void 0 ? function () {
|
|
19
|
+
return document.body;
|
|
20
|
+
} : _props$getContainer,
|
|
21
|
+
config = _objectWithoutProperties(props, _excluded);
|
|
22
|
+
var root = getContainer() || document.body;
|
|
23
|
+
return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(Drawer, config), root);
|
|
24
|
+
};
|
|
25
|
+
var LxMobileDrawerNodes = {};
|
|
26
|
+
var nbr = 0;
|
|
27
|
+
var closeTimer;
|
|
28
|
+
function open() {
|
|
29
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
30
|
+
var close = props.close,
|
|
31
|
+
_onTabsChange = props.onTabsChange,
|
|
32
|
+
_props$visible = props.visible,
|
|
33
|
+
visible = _props$visible === void 0 ? true : _props$visible,
|
|
34
|
+
_props$getContainer2 = props.getContainer,
|
|
35
|
+
getContainer = _props$getContainer2 === void 0 ? function () {
|
|
36
|
+
return document.body;
|
|
37
|
+
} : _props$getContainer2,
|
|
38
|
+
config = _objectWithoutProperties(props, _excluded2);
|
|
39
|
+
var createDrawer = function createDrawer() {
|
|
40
|
+
var key = "lxm-drawer-".concat(nbr);
|
|
41
|
+
var root = getContainer() || document.body;
|
|
42
|
+
var rootChild = root ? getChildren(root) : [];
|
|
43
|
+
var div = rootChild.find(function (item) {
|
|
44
|
+
return item.getAttribute('lxm-drawer-key') === key;
|
|
45
|
+
});
|
|
46
|
+
if (!div) {
|
|
47
|
+
div = document.createElement('div');
|
|
48
|
+
div.setAttribute('lxm-drawer-key', key);
|
|
49
|
+
root.appendChild(div);
|
|
50
|
+
}
|
|
51
|
+
var onCloseDrawer = function onCloseDrawer() {
|
|
52
|
+
if (LxMobileDrawerNodes[key]) {
|
|
53
|
+
var _LxMobileDrawerNodes$, _LxMobileDrawerNodes$2;
|
|
54
|
+
(_LxMobileDrawerNodes$ = LxMobileDrawerNodes[key]) === null || _LxMobileDrawerNodes$ === void 0 ? void 0 : (_LxMobileDrawerNodes$2 = _LxMobileDrawerNodes$.nodeDiv) === null || _LxMobileDrawerNodes$2 === void 0 ? void 0 : _LxMobileDrawerNodes$2.classList.add('lxm-drawer-close-move');
|
|
55
|
+
clearTimeout(closeTimer);
|
|
56
|
+
closeTimer = setTimeout(function () {
|
|
57
|
+
var _LxMobileDrawerNodes$3, _LxMobileDrawerNodes$4, _LxMobileDrawerNodes$5;
|
|
58
|
+
unmountComponentAtNode((_LxMobileDrawerNodes$3 = LxMobileDrawerNodes[key]) === null || _LxMobileDrawerNodes$3 === void 0 ? void 0 : _LxMobileDrawerNodes$3.nodeDiv);
|
|
59
|
+
(_LxMobileDrawerNodes$4 = LxMobileDrawerNodes[key]) === null || _LxMobileDrawerNodes$4 === void 0 ? void 0 : (_LxMobileDrawerNodes$5 = _LxMobileDrawerNodes$4.nodeDiv) === null || _LxMobileDrawerNodes$5 === void 0 ? void 0 : _LxMobileDrawerNodes$5.remove();
|
|
60
|
+
delete LxMobileDrawerNodes[key];
|
|
61
|
+
clearTimeout(closeTimer);
|
|
62
|
+
}, 300);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
var renderNode = function renderNode() {
|
|
66
|
+
var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
67
|
+
render( /*#__PURE__*/React.createElement(Drawer, _extends({
|
|
68
|
+
visible: visible,
|
|
69
|
+
onCancel: function onCancel() {
|
|
70
|
+
if ((config === null || config === void 0 ? void 0 : config.onClose) instanceof Function) {
|
|
71
|
+
config === null || config === void 0 ? void 0 : config.onClose();
|
|
72
|
+
}
|
|
73
|
+
onCloseDrawer();
|
|
74
|
+
},
|
|
75
|
+
onOk: function onOk() {
|
|
76
|
+
if ((config === null || config === void 0 ? void 0 : config.onOk) instanceof Function) {
|
|
77
|
+
config === null || config === void 0 ? void 0 : config.onOk();
|
|
78
|
+
}
|
|
79
|
+
onCloseDrawer();
|
|
80
|
+
},
|
|
81
|
+
onTabsChange: function onTabsChange(record) {
|
|
82
|
+
if (_onTabsChange instanceof Function) {
|
|
83
|
+
_onTabsChange(_objectSpread(_objectSpread({}, record), {}, {
|
|
84
|
+
update: function update(prarms) {
|
|
85
|
+
if (LxMobileDrawerNodes[key]) {
|
|
86
|
+
var _LxMobileDrawerNodes$6;
|
|
87
|
+
(_LxMobileDrawerNodes$6 = LxMobileDrawerNodes[key]) === null || _LxMobileDrawerNodes$6 === void 0 ? void 0 : _LxMobileDrawerNodes$6.renderNode(_objectSpread(_objectSpread({}, config), prarms));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}, args)), div);
|
|
94
|
+
};
|
|
95
|
+
renderNode(config);
|
|
96
|
+
LxMobileDrawerNodes[key] = {
|
|
97
|
+
root: root,
|
|
98
|
+
nodeDiv: div,
|
|
99
|
+
renderNode: renderNode
|
|
100
|
+
};
|
|
101
|
+
nbr += 1;
|
|
102
|
+
return key;
|
|
103
|
+
};
|
|
104
|
+
var modalKey = createDrawer();
|
|
105
|
+
var onClose = function onClose() {
|
|
106
|
+
if (LxMobileDrawerNodes[modalKey]) {
|
|
107
|
+
var _LxMobileDrawerNodes$7, _LxMobileDrawerNodes$8;
|
|
108
|
+
(_LxMobileDrawerNodes$7 = LxMobileDrawerNodes[modalKey]) === null || _LxMobileDrawerNodes$7 === void 0 ? void 0 : (_LxMobileDrawerNodes$8 = _LxMobileDrawerNodes$7.nodeDiv) === null || _LxMobileDrawerNodes$8 === void 0 ? void 0 : _LxMobileDrawerNodes$8.classList.add('lxm-drawer-close-move');
|
|
109
|
+
clearTimeout(closeTimer);
|
|
110
|
+
closeTimer = setTimeout(function () {
|
|
111
|
+
var _LxMobileDrawerNodes$9, _LxMobileDrawerNodes$10, _LxMobileDrawerNodes$11;
|
|
112
|
+
unmountComponentAtNode((_LxMobileDrawerNodes$9 = LxMobileDrawerNodes[modalKey]) === null || _LxMobileDrawerNodes$9 === void 0 ? void 0 : _LxMobileDrawerNodes$9.nodeDiv);
|
|
113
|
+
(_LxMobileDrawerNodes$10 = LxMobileDrawerNodes[modalKey]) === null || _LxMobileDrawerNodes$10 === void 0 ? void 0 : (_LxMobileDrawerNodes$11 = _LxMobileDrawerNodes$10.nodeDiv) === null || _LxMobileDrawerNodes$11 === void 0 ? void 0 : _LxMobileDrawerNodes$11.remove();
|
|
114
|
+
delete LxMobileDrawerNodes[modalKey];
|
|
115
|
+
clearTimeout(closeTimer);
|
|
116
|
+
}, 300);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
var onUpdate = function onUpdate() {
|
|
120
|
+
var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
121
|
+
if (LxMobileDrawerNodes[modalKey]) {
|
|
122
|
+
var _LxMobileDrawerNodes$12;
|
|
123
|
+
(_LxMobileDrawerNodes$12 = LxMobileDrawerNodes[modalKey]) === null || _LxMobileDrawerNodes$12 === void 0 ? void 0 : _LxMobileDrawerNodes$12.renderNode(_objectSpread(_objectSpread({}, config), args));
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
return {
|
|
127
|
+
onClose: onClose,
|
|
128
|
+
onUpdate: onUpdate
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
DrawerWraper.open = open;
|
|
132
|
+
export default DrawerWraper;
|