@iobroker/adapter-react-v5 3.1.1 → 3.1.4
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/Components/FileBrowser.js +277 -237
- package/Components/FileBrowser.js.map +1 -1
- package/Components/FileViewer.js +3 -1
- package/Components/FileViewer.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAutocomplete.js +5 -3
- package/Components/JsonConfigComponent/ConfigAutocomplete.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +5 -3
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js +16 -2
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCustom.js +148 -25
- package/Components/JsonConfigComponent/ConfigCustom.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigGeneric.js +105 -20
- package/Components/JsonConfigComponent/ConfigGeneric.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js +132 -46
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigLanguage.js +25 -1
- package/Components/JsonConfigComponent/ConfigLanguage.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigNumber.js +5 -4
- package/Components/JsonConfigComponent/ConfigNumber.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigObjectId.js +3 -2
- package/Components/JsonConfigComponent/ConfigObjectId.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPanel.js +51 -40
- package/Components/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPattern.js +1 -1
- package/Components/JsonConfigComponent/ConfigPattern.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSelect.js +4 -2
- package/Components/JsonConfigComponent/ConfigSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSendto.js +2 -2
- package/Components/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSetState.js +2 -2
- package/Components/JsonConfigComponent/ConfigSetState.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticHeader.js +31 -8
- package/Components/JsonConfigComponent/ConfigStaticHeader.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticImage.js +1 -1
- package/Components/JsonConfigComponent/ConfigStaticImage.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTable.js +1 -1
- package/Components/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTabs.js +12 -3
- package/Components/JsonConfigComponent/ConfigTabs.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigText.js +4 -2
- package/Components/JsonConfigComponent/ConfigText.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTopic.js.map +1 -1
- package/Components/JsonConfigComponent/index.js +12 -4
- package/Components/JsonConfigComponent/index.js.map +1 -1
- package/Components/ObjectBrowser.js +464 -261
- package/Components/ObjectBrowser.js.map +1 -1
- package/Components/TableResize.js +323 -0
- package/Components/TableResize.js.map +1 -0
- package/Components/TreeTable.js +2 -2
- package/Components/TreeTable.js.map +1 -1
- package/Components/Utils.js +5 -5
- package/Components/Utils.js.map +1 -1
- package/Dialogs/Confirm.js +3 -3
- package/Dialogs/Confirm.js.map +1 -1
- package/Dialogs/FileSelect.js +259 -0
- package/Dialogs/FileSelect.js.map +1 -0
- package/Dialogs/SelectID.js +15 -16
- package/Dialogs/SelectID.js.map +1 -1
- package/README.md +9 -0
- package/i18n/de.json +4 -3
- package/i18n/en.json +2 -1
- package/i18n/es.json +2 -1
- package/i18n/fr.json +2 -1
- package/i18n/it.json +2 -1
- package/i18n/nl.json +2 -1
- package/i18n/pl.json +2 -1
- package/i18n/pt.json +2 -1
- package/i18n/ru.json +2 -1
- package/i18n/zh-cn.json +2 -1
- package/icons/IconDocumentReadOnly.js +43 -0
- package/icons/IconDocumentReadOnly.js.map +1 -0
- package/package.json +1 -1
- package/GenericApp.js +0 -1025
- package/GenericApp.js.map +0 -1
- package/Prompt.js +0 -21
- package/Prompt.js.map +0 -1
- package/Theme.js +0 -422
- package/Theme.js.map +0 -1
- package/i18n.js +0 -180
- package/i18n.js.map +0 -1
|
@@ -15,8 +15,6 @@ var _toArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toArray")
|
|
|
15
15
|
|
|
16
16
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
17
17
|
|
|
18
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
19
|
-
|
|
20
18
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
21
19
|
|
|
22
20
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -27,6 +25,8 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
27
25
|
|
|
28
26
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
29
27
|
|
|
28
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
29
|
+
|
|
30
30
|
var _react = _interopRequireWildcard(require("react"));
|
|
31
31
|
|
|
32
32
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -45,6 +45,132 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
45
45
|
|
|
46
46
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
47
47
|
|
|
48
|
+
var getOrLoadRemote = function getOrLoadRemote(remote, shareScope) {
|
|
49
|
+
var remoteFallbackUrl = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
50
|
+
return new Promise(function (resolve, reject) {
|
|
51
|
+
// check if remote exists on window
|
|
52
|
+
if (!window[remote]) {
|
|
53
|
+
// search dom to see if remote tag exists, but might still be loading (async)
|
|
54
|
+
var existingRemote = document.querySelector("script[data-webpack=\"".concat(remote, "\"]")); // when remote is loaded.
|
|
55
|
+
|
|
56
|
+
var onload = /*#__PURE__*/function () {
|
|
57
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
58
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
59
|
+
while (1) {
|
|
60
|
+
switch (_context.prev = _context.next) {
|
|
61
|
+
case 0:
|
|
62
|
+
if (!window[remote]) {
|
|
63
|
+
_context.next = 12;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (window[remote].__initialized) {
|
|
68
|
+
_context.next = 10;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!(typeof __webpack_share_scopes__ === 'undefined')) {
|
|
73
|
+
_context.next = 7;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
_context.next = 5;
|
|
78
|
+
return window[remote].init(shareScope["default"]);
|
|
79
|
+
|
|
80
|
+
case 5:
|
|
81
|
+
_context.next = 9;
|
|
82
|
+
break;
|
|
83
|
+
|
|
84
|
+
case 7:
|
|
85
|
+
_context.next = 9;
|
|
86
|
+
return window[remote].init(__webpack_share_scopes__[shareScope]);
|
|
87
|
+
|
|
88
|
+
case 9:
|
|
89
|
+
// mark remote as initialized
|
|
90
|
+
window[remote].__initialized = true;
|
|
91
|
+
|
|
92
|
+
case 10:
|
|
93
|
+
_context.next = 14;
|
|
94
|
+
break;
|
|
95
|
+
|
|
96
|
+
case 12:
|
|
97
|
+
console.error('Cannot load ' + remote);
|
|
98
|
+
return _context.abrupt("return", reject('Cannot load ' + remote));
|
|
99
|
+
|
|
100
|
+
case 14:
|
|
101
|
+
// resolve promise so marking remote as loaded
|
|
102
|
+
resolve(window[remote]);
|
|
103
|
+
|
|
104
|
+
case 15:
|
|
105
|
+
case "end":
|
|
106
|
+
return _context.stop();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}, _callee);
|
|
110
|
+
}));
|
|
111
|
+
|
|
112
|
+
return function onload() {
|
|
113
|
+
return _ref.apply(this, arguments);
|
|
114
|
+
};
|
|
115
|
+
}();
|
|
116
|
+
|
|
117
|
+
if (existingRemote) {
|
|
118
|
+
// if existing remote but not loaded, hook into its onload and wait for it to be ready
|
|
119
|
+
existingRemote.onload = onload;
|
|
120
|
+
existingRemote.onerror = reject; // check if remote fallback exists as param passed to function
|
|
121
|
+
// TODO: should scan public config for a matching key if no override exists
|
|
122
|
+
} else if (remoteFallbackUrl) {
|
|
123
|
+
// inject remote if a fallback exists and call the same onload function
|
|
124
|
+
var d = document;
|
|
125
|
+
var script = d.createElement('script');
|
|
126
|
+
script.type = 'text/javascript'; // mark as data-webpack so runtime can track it internally
|
|
127
|
+
|
|
128
|
+
script.setAttribute('data-webpack', "".concat(remote));
|
|
129
|
+
script.async = true;
|
|
130
|
+
script.onerror = reject;
|
|
131
|
+
script.onload = onload;
|
|
132
|
+
script.src = remoteFallbackUrl;
|
|
133
|
+
d.getElementsByTagName('head')[0].appendChild(script);
|
|
134
|
+
} else {
|
|
135
|
+
// no remote and no fallback exist, reject
|
|
136
|
+
reject("Cannot Find Remote ".concat(remote, " to inject"));
|
|
137
|
+
}
|
|
138
|
+
} else {
|
|
139
|
+
// remote already instantiated, resolve
|
|
140
|
+
resolve(window[remote]);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
var loadComponent = function loadComponent(remote, sharedScope, module, url) {
|
|
146
|
+
return /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
147
|
+
var container, factory, Module;
|
|
148
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
149
|
+
while (1) {
|
|
150
|
+
switch (_context2.prev = _context2.next) {
|
|
151
|
+
case 0:
|
|
152
|
+
_context2.next = 2;
|
|
153
|
+
return getOrLoadRemote(remote, sharedScope, url);
|
|
154
|
+
|
|
155
|
+
case 2:
|
|
156
|
+
container = _context2.sent;
|
|
157
|
+
_context2.next = 5;
|
|
158
|
+
return container.get(module);
|
|
159
|
+
|
|
160
|
+
case 5:
|
|
161
|
+
factory = _context2.sent;
|
|
162
|
+
Module = factory();
|
|
163
|
+
return _context2.abrupt("return", Module);
|
|
164
|
+
|
|
165
|
+
case 8:
|
|
166
|
+
case "end":
|
|
167
|
+
return _context2.stop();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}, _callee2);
|
|
171
|
+
}));
|
|
172
|
+
};
|
|
173
|
+
|
|
48
174
|
var ConfigCustom = /*#__PURE__*/function (_Component) {
|
|
49
175
|
(0, _inherits2["default"])(ConfigCustom, _Component);
|
|
50
176
|
|
|
@@ -69,15 +195,15 @@ var ConfigCustom = /*#__PURE__*/function (_Component) {
|
|
|
69
195
|
(0, _createClass2["default"])(ConfigCustom, [{
|
|
70
196
|
key: "componentDidMount",
|
|
71
197
|
value: function () {
|
|
72
|
-
var _componentDidMount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
198
|
+
var _componentDidMount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
73
199
|
var url, pos, i18nURL, lang, file, _this$props$schema$na, _this$props$schema$na2, uniqueName, fileToLoad, componentName, component, keys;
|
|
74
200
|
|
|
75
|
-
return _regenerator["default"].wrap(function
|
|
201
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
76
202
|
while (1) {
|
|
77
|
-
switch (
|
|
203
|
+
switch (_context3.prev = _context3.next) {
|
|
78
204
|
case 0:
|
|
79
205
|
if (this.props.schema.url) {
|
|
80
|
-
|
|
206
|
+
_context3.next = 4;
|
|
81
207
|
break;
|
|
82
208
|
}
|
|
83
209
|
|
|
@@ -85,7 +211,7 @@ var ConfigCustom = /*#__PURE__*/function (_Component) {
|
|
|
85
211
|
this.setState({
|
|
86
212
|
error: 'URL is empty. Cannot load custom component!'
|
|
87
213
|
});
|
|
88
|
-
return
|
|
214
|
+
return _context3.abrupt("return");
|
|
89
215
|
|
|
90
216
|
case 4:
|
|
91
217
|
if (this.props.schema.url.startsWith('http:') || this.props.schema.url.startsWith('https:')) {
|
|
@@ -97,7 +223,7 @@ var ConfigCustom = /*#__PURE__*/function (_Component) {
|
|
|
97
223
|
}
|
|
98
224
|
|
|
99
225
|
if (!(this.props.schema.i18n === true)) {
|
|
100
|
-
|
|
226
|
+
_context3.next = 14;
|
|
101
227
|
break;
|
|
102
228
|
}
|
|
103
229
|
|
|
@@ -112,7 +238,7 @@ var ConfigCustom = /*#__PURE__*/function (_Component) {
|
|
|
112
238
|
|
|
113
239
|
lang = _i18n["default"].getLanguage();
|
|
114
240
|
file = "".concat(i18nURL, "/i18n/").concat(lang, ".json");
|
|
115
|
-
|
|
241
|
+
_context3.next = 12;
|
|
116
242
|
return fetch(file).then(function (data) {
|
|
117
243
|
return data.json();
|
|
118
244
|
}).then(function (json) {
|
|
@@ -122,7 +248,7 @@ var ConfigCustom = /*#__PURE__*/function (_Component) {
|
|
|
122
248
|
});
|
|
123
249
|
|
|
124
250
|
case 12:
|
|
125
|
-
|
|
251
|
+
_context3.next = 15;
|
|
126
252
|
break;
|
|
127
253
|
|
|
128
254
|
case 14:
|
|
@@ -135,18 +261,15 @@ var ConfigCustom = /*#__PURE__*/function (_Component) {
|
|
|
135
261
|
}
|
|
136
262
|
|
|
137
263
|
case 15:
|
|
138
|
-
|
|
264
|
+
_context3.prev = 15;
|
|
139
265
|
_this$props$schema$na = this.props.schema.name.split('/'), _this$props$schema$na2 = (0, _toArray2["default"])(_this$props$schema$na), uniqueName = _this$props$schema$na2[0], fileToLoad = _this$props$schema$na2[1], componentName = _this$props$schema$na2.slice(2);
|
|
140
|
-
console.log(uniqueName, fileToLoad, componentName.join('/'));
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
format: 'esm',
|
|
145
|
-
from: 'vite'
|
|
146
|
-
}, fileToLoad);
|
|
266
|
+
console.log(uniqueName, fileToLoad, componentName.join('/')); // const component = await window.importFederation(uniqueName, {url, format: 'esm', from: 'vite'}, fileToLoad);
|
|
267
|
+
|
|
268
|
+
_context3.next = 20;
|
|
269
|
+
return loadComponent(uniqueName, 'default', "./".concat(fileToLoad), url)();
|
|
147
270
|
|
|
148
271
|
case 20:
|
|
149
|
-
component =
|
|
272
|
+
component = _context3.sent["default"];
|
|
150
273
|
|
|
151
274
|
if (!component || !component || !component[componentName.join('/')]) {
|
|
152
275
|
keys = Object.keys(component || {});
|
|
@@ -160,22 +283,22 @@ var ConfigCustom = /*#__PURE__*/function (_Component) {
|
|
|
160
283
|
});
|
|
161
284
|
}
|
|
162
285
|
|
|
163
|
-
|
|
286
|
+
_context3.next = 27;
|
|
164
287
|
break;
|
|
165
288
|
|
|
166
289
|
case 24:
|
|
167
|
-
|
|
168
|
-
|
|
290
|
+
_context3.prev = 24;
|
|
291
|
+
_context3.t0 = _context3["catch"](15);
|
|
169
292
|
this.setState({
|
|
170
|
-
error: "Cannot import from ".concat(this.props.schema.url, ": ").concat(
|
|
293
|
+
error: "Cannot import from ".concat(this.props.schema.url, ": ").concat(_context3.t0)
|
|
171
294
|
});
|
|
172
295
|
|
|
173
296
|
case 27:
|
|
174
297
|
case "end":
|
|
175
|
-
return
|
|
298
|
+
return _context3.stop();
|
|
176
299
|
}
|
|
177
300
|
}
|
|
178
|
-
},
|
|
301
|
+
}, _callee3, this, [[15, 24]]);
|
|
179
302
|
}));
|
|
180
303
|
|
|
181
304
|
function componentDidMount() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigCustom.js","names":["ConfigCustom","props","state","Component","error","schema","url","console","setState","startsWith","window","location","protocol","host","replace","adapterName","i18n","pos","lastIndexOf","i18nURL","substring","lang","getLanguage","file","fetch","then","data","json","extendTranslations","log","name","split","uniqueName","fileToLoad","componentName","join","importFederation","format","from","component","keys","Object","item","xs","undefined","lg","md","sm","assign","marginBottom","textAlign","width","type","style","themeType","darkStyle","newLine","flexBasis","height","propTypes","socket","PropTypes","object","string","themeName","className","attr","isRequired","onError","func","onChange"],"sources":["JsonConfigComponent/ConfigCustom.jsx"],"sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\n\nimport LinearProgress from '@mui/material/LinearProgress';\nimport Grid from '@mui/material/Grid';\nimport i18n from '../../i18n';\n\nclass ConfigCustom extends Component {\n constructor(props) {\n super(props);\n // schema.url - location of Widget\n // schema.name - Component name\n // schema.i18n - i18n\n\n this.state = {\n Component: null,\n error: '',\n };\n }\n\n // load component dynamically\n async componentDidMount() {\n if (!this.props.schema.url) {\n console.error('URL is empty. Cannot load custom component!');\n this.setState({ error: 'URL is empty. Cannot load custom component!' });\n return;\n }\n\n let url;\n if (this.props.schema.url.startsWith('http:') || this.props.schema.url.startsWith('https:')) {\n url = this.props.schema.url;\n } else if (this.props.schema.url.startsWith('./')) {\n url = `${window.location.protocol}//${window.location.host}${this.props.schema.url.replace(/^\\./, '')}`;\n } else {\n url = `${window.location.protocol}//${window.location.host}/adapter/${this.props.adapterName}/${this.props.schema.url}`;\n }\n\n if (this.props.schema.i18n === true) {\n // load i18n from files\n const pos = url.lastIndexOf('/');\n let i18nURL;\n if (pos !== -1) {\n i18nURL = url.substring(0, pos);\n } else {\n i18nURL = url;\n }\n const lang = i18n.getLanguage();\n const file = `${i18nURL}/i18n/${lang}.json`;\n\n await fetch(file)\n .then(data => data.json())\n .then(json => i18n.extendTranslations(json, lang))\n .catch(error => console.log(`Cannot load i18n \"${file}\": ${error}`));\n } else if (this.props.schema.i18n && typeof this.props.schema.i18n === 'object') {\n try {\n i18n.extendTranslations(this.props.schema.i18n);\n } catch (error) {\n console.error(`Cannot import i18n: ${error}`);\n }\n }\n\n try {\n const [uniqueName, fileToLoad, ...componentName] = this.props.schema.name.split('/');\n console.log(uniqueName, fileToLoad, componentName.join('/'));\n const component = await window.importFederation(uniqueName, {url, format: 'esm', from: 'vite'}, fileToLoad);\n\n if (!component || !component || !component[componentName.join('/')]) {\n const keys = Object.keys(component || {});\n console.error('URL is empty. Cannot load custom component!');\n this.setState({ error: `Component ${this.props.schema.name} not found in ${this.props.schema.url}. Found: ${keys.join(', ')}` });\n } else {\n this.setState({ Component: component[componentName.join('/')] });\n }\n } catch (error) {\n this.setState({ error: `Cannot import from ${this.props.schema.url}: ${error}` });\n }\n }\n\n render() {\n const Component = this.state.Component;\n\n // render temporary placeholder\n if (!Component) {\n if (this.state.error) {\n return;\n } else {\n const schema = this.props.schema || {};\n\n const item = <Grid\n item\n xs={schema.xs || undefined}\n lg={schema.lg || undefined}\n md={schema.md || undefined}\n sm={schema.sm || undefined}\n style={Object.assign({}, {\n marginBottom: 0,\n //marginRight: 8,\n textAlign: 'left',\n width: schema.type === 'divider' || schema.type === 'header' ? schema.width || '100%' : undefined\n }, schema.style, this.props.themeType === 'dark' ? schema.darkStyle : {})}>\n {this.state.error ? <div>{this.state.error}</div> : <LinearProgress />}\n </Grid>;\n\n if (schema.newLine) {\n return <>\n <div style={{ flexBasis: '100%', height: 0 }} />\n {item}\n </>;\n } else {\n return item;\n }\n }\n }\n\n return <Component {...this.props} />;\n }\n}\n\nConfigCustom.propTypes = {\n socket: PropTypes.object,\n themeType: PropTypes.string,\n themeName: PropTypes.string,\n style: PropTypes.object,\n className: PropTypes.string,\n attr: PropTypes.string,\n data: PropTypes.object.isRequired,\n schema: PropTypes.object.isRequired,\n onError: PropTypes.func,\n onChange: PropTypes.func,\n};\n\nexport default ConfigCustom;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;;;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,gCAAC,SAAD,EAAe,KAAKzC,KAApB,CAAP;IACH;;;EA5GsBE,gB;;AA+G3BH,YAAY,CAAC2D,SAAb,GAAyB;EACrBC,MAAM,EAAEC,qBAAA,CAAUC,MADG;EAErBR,SAAS,EAAEO,qBAAA,CAAUE,MAFA;EAGrBC,SAAS,EAAEH,qBAAA,CAAUE,MAHA;EAIrBV,KAAK,EAAEQ,qBAAA,CAAUC,MAJI;EAKrBG,SAAS,EAAEJ,qBAAA,CAAUE,MALA;EAMrBG,IAAI,EAAEL,qBAAA,CAAUE,MANK;EAOrBrC,IAAI,EAAEmC,qBAAA,CAAUC,MAAV,CAAiBK,UAPF;EAQrB9D,MAAM,EAAEwD,qBAAA,CAAUC,MAAV,CAAiBK,UARJ;EASrBC,OAAO,EAAEP,qBAAA,CAAUQ,IATE;EAUrBC,QAAQ,EAAET,qBAAA,CAAUQ;AAVC,CAAzB;eAaerE,Y"}
|
|
1
|
+
{"version":3,"file":"ConfigCustom.js","names":["getOrLoadRemote","remote","shareScope","remoteFallbackUrl","undefined","Promise","resolve","reject","window","existingRemote","document","querySelector","onload","__initialized","__webpack_share_scopes__","init","console","error","onerror","d","script","createElement","type","setAttribute","async","src","getElementsByTagName","appendChild","loadComponent","sharedScope","module","url","container","get","factory","Module","ConfigCustom","props","state","Component","schema","setState","startsWith","location","protocol","host","replace","adapterName","i18n","pos","lastIndexOf","i18nURL","substring","lang","getLanguage","file","fetch","then","data","json","extendTranslations","log","name","split","uniqueName","fileToLoad","componentName","join","component","keys","Object","item","xs","lg","md","sm","assign","marginBottom","textAlign","width","style","themeType","darkStyle","newLine","flexBasis","height","propTypes","socket","PropTypes","object","string","themeName","className","attr","isRequired","onError","func","onChange"],"sources":["JsonConfigComponent/ConfigCustom.jsx"],"sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\n\nimport LinearProgress from '@mui/material/LinearProgress';\nimport Grid from '@mui/material/Grid';\n\nimport i18n from '../../i18n';\nconst getOrLoadRemote = (remote, shareScope, remoteFallbackUrl = undefined) =>\n new Promise((resolve, reject) => {\n // check if remote exists on window\n if (!window[remote]) {\n // search dom to see if remote tag exists, but might still be loading (async)\n const existingRemote = document.querySelector(`script[data-webpack=\"${remote}\"]`);\n // when remote is loaded.\n const onload = async () => {\n // check if it was initialized\n if (window[remote]) {\n if (!window[remote].__initialized) {\n // if share scope doesn't exist (like in webpack 4) then expect shareScope to be a manual object\n if (typeof __webpack_share_scopes__ === 'undefined') {\n // use default share scope object passed in manually\n await window[remote].init(shareScope.default);\n } else {\n // otherwise, init share scope as usual\n // eslint-disable-next-line\n await window[remote].init(__webpack_share_scopes__[shareScope]);\n }\n // mark remote as initialized\n window[remote].__initialized = true;\n }\n } else {\n console.error('Cannot load ' + remote);\n return reject('Cannot load ' + remote);\n }\n // resolve promise so marking remote as loaded\n resolve(window[remote]);\n };\n\n if (existingRemote) {\n // if existing remote but not loaded, hook into its onload and wait for it to be ready\n existingRemote.onload = onload;\n existingRemote.onerror = reject;\n // check if remote fallback exists as param passed to function\n // TODO: should scan public config for a matching key if no override exists\n } else if (remoteFallbackUrl) {\n // inject remote if a fallback exists and call the same onload function\n const d = document;\n const script = d.createElement('script');\n script.type = 'text/javascript';\n // mark as data-webpack so runtime can track it internally\n script.setAttribute('data-webpack', `${remote}`);\n script.async = true;\n script.onerror = reject;\n script.onload = onload;\n script.src = remoteFallbackUrl;\n d.getElementsByTagName('head')[0].appendChild(script);\n } else {\n // no remote and no fallback exist, reject\n reject(`Cannot Find Remote ${remote} to inject`);\n }\n } else {\n // remote already instantiated, resolve\n resolve(window[remote]);\n }\n });\n\nconst loadComponent = (remote, sharedScope, module, url) => async () => {\n const container = await getOrLoadRemote(remote, sharedScope, url);\n const factory = await container.get(module);\n const Module = factory();\n return Module;\n};\n\nclass ConfigCustom extends Component {\n constructor(props) {\n super(props);\n // schema.url - location of Widget\n // schema.name - Component name\n // schema.i18n - i18n\n\n this.state = {\n Component: null,\n error: '',\n };\n }\n\n // load component dynamically\n async componentDidMount() {\n if (!this.props.schema.url) {\n console.error('URL is empty. Cannot load custom component!');\n this.setState({ error: 'URL is empty. Cannot load custom component!' });\n return;\n }\n\n let url;\n if (this.props.schema.url.startsWith('http:') || this.props.schema.url.startsWith('https:')) {\n url = this.props.schema.url;\n } else if (this.props.schema.url.startsWith('./')) {\n url = `${window.location.protocol}//${window.location.host}${this.props.schema.url.replace(/^\\./, '')}`;\n } else {\n url = `${window.location.protocol}//${window.location.host}/adapter/${this.props.adapterName}/${this.props.schema.url}`;\n }\n\n if (this.props.schema.i18n === true) {\n // load i18n from files\n const pos = url.lastIndexOf('/');\n let i18nURL;\n if (pos !== -1) {\n i18nURL = url.substring(0, pos);\n } else {\n i18nURL = url;\n }\n const lang = i18n.getLanguage();\n const file = `${i18nURL}/i18n/${lang}.json`;\n\n await fetch(file)\n .then(data => data.json())\n .then(json => i18n.extendTranslations(json, lang))\n .catch(error => console.log(`Cannot load i18n \"${file}\": ${error}`));\n } else if (this.props.schema.i18n && typeof this.props.schema.i18n === 'object') {\n try {\n i18n.extendTranslations(this.props.schema.i18n);\n } catch (error) {\n console.error(`Cannot import i18n: ${error}`);\n }\n }\n\n try {\n const [uniqueName, fileToLoad, ...componentName] = this.props.schema.name.split('/');\n console.log(uniqueName, fileToLoad, componentName.join('/'));\n // const component = await window.importFederation(uniqueName, {url, format: 'esm', from: 'vite'}, fileToLoad);\n const component = (await loadComponent(uniqueName, 'default', `./${fileToLoad}`, url)()).default;\n\n if (!component || !component || !component[componentName.join('/')]) {\n const keys = Object.keys(component || {});\n console.error('URL is empty. Cannot load custom component!');\n this.setState({ error: `Component ${this.props.schema.name} not found in ${this.props.schema.url}. Found: ${keys.join(', ')}` });\n } else {\n this.setState({ Component: component[componentName.join('/')] });\n }\n } catch (error) {\n this.setState({ error: `Cannot import from ${this.props.schema.url}: ${error}` });\n }\n }\n\n render() {\n const Component = this.state.Component;\n\n // render temporary placeholder\n if (!Component) {\n if (this.state.error) {\n return;\n } else {\n const schema = this.props.schema || {};\n\n const item = <Grid\n item\n xs={schema.xs || undefined}\n lg={schema.lg || undefined}\n md={schema.md || undefined}\n sm={schema.sm || undefined}\n style={Object.assign({}, {\n marginBottom: 0,\n //marginRight: 8,\n textAlign: 'left',\n width: schema.type === 'divider' || schema.type === 'header' ? schema.width || '100%' : undefined\n }, schema.style, this.props.themeType === 'dark' ? schema.darkStyle : {})}>\n {this.state.error ? <div>{this.state.error}</div> : <LinearProgress />}\n </Grid>;\n\n if (schema.newLine) {\n return <>\n <div style={{ flexBasis: '100%', height: 0 }} />\n {item}\n </>;\n } else {\n return item;\n }\n }\n }\n\n return <Component {...this.props} />;\n }\n}\n\nConfigCustom.propTypes = {\n socket: PropTypes.object,\n themeType: PropTypes.string,\n themeName: PropTypes.string,\n style: PropTypes.object,\n className: PropTypes.string,\n attr: PropTypes.string,\n data: PropTypes.object.isRequired,\n schema: PropTypes.object.isRequired,\n onError: PropTypes.func,\n onChange: PropTypes.func,\n};\n\nexport default ConfigCustom;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AAEA;;;;;;;;;;AACA,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,CAACC,MAAD,EAASC,UAAT;EAAA,IAAqBC,iBAArB,uEAAyCC,SAAzC;EAAA,OACpB,IAAIC,OAAJ,CAAY,UAACC,OAAD,EAAUC,MAAV,EAAqB;IACjC;IACI,IAAI,CAACC,MAAM,CAACP,MAAD,CAAX,EAAqB;MACjB;MACA,IAAMQ,cAAc,GAAGC,QAAQ,CAACC,aAAT,iCAA+CV,MAA/C,SAAvB,CAFiB,CAGjB;;MACA,IAAMW,MAAM;QAAA,yFAAG;UAAA;YAAA;cAAA;gBAAA;kBAAA,KAEPJ,MAAM,CAACP,MAAD,CAFC;oBAAA;oBAAA;kBAAA;;kBAAA,IAGFO,MAAM,CAACP,MAAD,CAAN,CAAeY,aAHb;oBAAA;oBAAA;kBAAA;;kBAAA,MAKC,OAAOC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(require("prop-types"));
|
|
|
35
35
|
|
|
36
36
|
var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
|
|
37
37
|
|
|
38
|
+
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
39
|
+
|
|
38
40
|
var _Info = _interopRequireDefault(require("@mui/icons-material/Info"));
|
|
39
41
|
|
|
40
42
|
var _Warning = _interopRequireDefault(require("@mui/icons-material/Warning"));
|
|
@@ -123,12 +125,69 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
123
125
|
}
|
|
124
126
|
}, 100);
|
|
125
127
|
}
|
|
128
|
+
} else if (this.props.schema.defaultSendTo) {
|
|
129
|
+
this.sendTo();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}, {
|
|
133
|
+
key: "sendTo",
|
|
134
|
+
value: function sendTo() {
|
|
135
|
+
var _this3 = this;
|
|
136
|
+
|
|
137
|
+
if (this.props.alive) {
|
|
138
|
+
this.defaultSendToDone = true;
|
|
139
|
+
var data = this.props.schema.data;
|
|
140
|
+
|
|
141
|
+
if (data === undefined && this.props.schema.jsonData) {
|
|
142
|
+
data = this.getPattern(this.props.schema.jsonData);
|
|
143
|
+
|
|
144
|
+
try {
|
|
145
|
+
data = JSON.parse(data);
|
|
146
|
+
} catch (e) {
|
|
147
|
+
console.error('Cannot parse json data: ' + data);
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
data = {
|
|
151
|
+
attr: this.props.attr,
|
|
152
|
+
value: ConfigGeneric.getValue(this.props.data, this.props.attr)
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (data === undefined) {
|
|
157
|
+
data = null;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
this.props.socket.sendTo(this.props.adapterName + '.' + this.props.instance, this.props.schema.defaultSendTo, data).then(function (value) {
|
|
161
|
+
if (value !== null && value !== undefined) {
|
|
162
|
+
if (_this3.props.custom) {
|
|
163
|
+
_this3.props.onChange(_this3.props.attr, value, function () {
|
|
164
|
+
return _this3.props.forceUpdate([_this3.props.attr], _this3.props.data);
|
|
165
|
+
}); //this.onChange(this.props.attr, this.defaultValue);
|
|
166
|
+
|
|
167
|
+
} else {
|
|
168
|
+
ConfigGeneric.setValue(_this3.props.data, _this3.props.attr, value);
|
|
169
|
+
|
|
170
|
+
_this3.props.onChange(_this3.props.data, undefined, function () {
|
|
171
|
+
return _this3.props.forceUpdate([_this3.props.attr], _this3.props.data);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
} else {
|
|
177
|
+
this.defaultSendToDone = false; // show error, that instance does not started
|
|
178
|
+
|
|
179
|
+
this.onError(this.props.attr, _i18n["default"].t('ra_Instance %s is not alive', this.props.instance));
|
|
126
180
|
}
|
|
127
181
|
}
|
|
128
182
|
}, {
|
|
129
183
|
key: "componentWillUnmount",
|
|
130
184
|
value: function componentWillUnmount() {
|
|
131
185
|
this.props.registerOnForceUpdate && this.props.registerOnForceUpdate(this.props.attr);
|
|
186
|
+
|
|
187
|
+
if (this.sendToTimeout) {
|
|
188
|
+
clearTimeout(this.sendToTimeout);
|
|
189
|
+
this.sendToTimeout = null;
|
|
190
|
+
}
|
|
132
191
|
}
|
|
133
192
|
}, {
|
|
134
193
|
key: "getText",
|
|
@@ -161,7 +220,7 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
161
220
|
}, {
|
|
162
221
|
key: "renderConfirmDialog",
|
|
163
222
|
value: function renderConfirmDialog() {
|
|
164
|
-
var
|
|
223
|
+
var _this4 = this;
|
|
165
224
|
|
|
166
225
|
if (!this.state.confirmDialog) {
|
|
167
226
|
return null;
|
|
@@ -185,19 +244,19 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
185
244
|
cancel: this.getText(confirm.cancel) || _i18n["default"].t('ra_Cancel'),
|
|
186
245
|
icon: icon,
|
|
187
246
|
onClose: function onClose(isOk) {
|
|
188
|
-
return
|
|
247
|
+
return _this4.setState({
|
|
189
248
|
confirmDialog: false
|
|
190
249
|
}, function () {
|
|
191
250
|
if (isOk) {
|
|
192
|
-
var data = JSON.parse(JSON.stringify(
|
|
251
|
+
var data = JSON.parse(JSON.stringify(_this4.props.data));
|
|
193
252
|
|
|
194
|
-
if (
|
|
195
|
-
ConfigGeneric.setValue(data,
|
|
253
|
+
if (_this4.state.confirmDepAttr) {
|
|
254
|
+
ConfigGeneric.setValue(data, _this4.state.confirmDepAttr, _this4.state.confirmDepNewValue);
|
|
196
255
|
}
|
|
197
256
|
|
|
198
|
-
ConfigGeneric.setValue(data,
|
|
257
|
+
ConfigGeneric.setValue(data, _this4.state.confirmAttr, _this4.state.confirmNewValue);
|
|
199
258
|
|
|
200
|
-
|
|
259
|
+
_this4.setState({
|
|
201
260
|
confirmDialog: false,
|
|
202
261
|
confirmDepAttr: null,
|
|
203
262
|
confirmDepNewValue: null,
|
|
@@ -206,10 +265,10 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
206
265
|
confirmOldValue: null,
|
|
207
266
|
confirmData: null
|
|
208
267
|
}, function () {
|
|
209
|
-
return
|
|
268
|
+
return _this4.props.onChange(data);
|
|
210
269
|
});
|
|
211
270
|
} else {
|
|
212
|
-
|
|
271
|
+
_this4.setState({
|
|
213
272
|
confirmDialog: false,
|
|
214
273
|
confirmDepAttr: null,
|
|
215
274
|
confirmDepNewValue: null,
|
|
@@ -226,7 +285,7 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
226
285
|
}, {
|
|
227
286
|
key: "onChange",
|
|
228
287
|
value: function onChange(attr, newValue) {
|
|
229
|
-
var
|
|
288
|
+
var _this5 = this;
|
|
230
289
|
|
|
231
290
|
var data = JSON.parse(JSON.stringify(this.props.data));
|
|
232
291
|
ConfigGeneric.setValue(data, attr, newValue);
|
|
@@ -315,12 +374,12 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
315
374
|
this.props.onChange(attr, newValue);
|
|
316
375
|
changed && changed.length && changed.forEach(function (_attr, i) {
|
|
317
376
|
return setTimeout(function () {
|
|
318
|
-
return
|
|
377
|
+
return _this5.props.onChange(_attr, ConfigGeneric.getValue(data, attr));
|
|
319
378
|
}, i * 50);
|
|
320
379
|
});
|
|
321
380
|
} else {
|
|
322
381
|
this.props.onChange(data, undefined, function () {
|
|
323
|
-
return changed.length &&
|
|
382
|
+
return changed.length && _this5.props.forceUpdate(changed, data);
|
|
324
383
|
});
|
|
325
384
|
}
|
|
326
385
|
}
|
|
@@ -465,7 +524,7 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
465
524
|
}, {
|
|
466
525
|
key: "render",
|
|
467
526
|
value: function render() {
|
|
468
|
-
var
|
|
527
|
+
var _this6 = this;
|
|
469
528
|
|
|
470
529
|
var schema = this.props.schema;
|
|
471
530
|
|
|
@@ -473,6 +532,14 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
473
532
|
return null;
|
|
474
533
|
}
|
|
475
534
|
|
|
535
|
+
if (this.props.alive && this.defaultSendToDone === false) {
|
|
536
|
+
this.sendToTimeout = setTimeout(function () {
|
|
537
|
+
_this6.sendToTimeout = null;
|
|
538
|
+
|
|
539
|
+
_this6.sendTo();
|
|
540
|
+
}, 200);
|
|
541
|
+
}
|
|
542
|
+
|
|
476
543
|
var _this$calculate = this.calculate(schema),
|
|
477
544
|
error = _this$calculate.error,
|
|
478
545
|
disabled = _this$calculate.disabled,
|
|
@@ -484,7 +551,7 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
484
551
|
if (Object.keys(this.isError).length) {
|
|
485
552
|
setTimeout(function (isError) {
|
|
486
553
|
return Object.keys(isError).forEach(function (attr) {
|
|
487
|
-
return
|
|
554
|
+
return _this6.props.onError(attr);
|
|
488
555
|
});
|
|
489
556
|
}, 100, JSON.parse(JSON.stringify(this.isError)));
|
|
490
557
|
this.isError = {};
|
|
@@ -525,19 +592,21 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
525
592
|
this.isError = (0, _defineProperty2["default"])({}, this.props.attr, schema.validatorErrorText ? _i18n["default"].t(schema.validatorErrorText) : true);
|
|
526
593
|
setTimeout(function (isError) {
|
|
527
594
|
return Object.keys(isError).forEach(function (attr) {
|
|
528
|
-
return
|
|
595
|
+
return _this6.props.onError(attr, isError[attr]);
|
|
529
596
|
});
|
|
530
597
|
}, 100, JSON.parse(JSON.stringify(this.isError)));
|
|
531
598
|
} else if (!error && Object.keys(this.isError).length) {
|
|
532
599
|
setTimeout(function (isError) {
|
|
533
600
|
return Object.keys(isError).forEach(function (attr) {
|
|
534
|
-
return
|
|
601
|
+
return _this6.props.onError(attr);
|
|
535
602
|
});
|
|
536
603
|
}, 100, JSON.parse(JSON.stringify(this.isError)));
|
|
537
604
|
this.isError = {};
|
|
538
605
|
}
|
|
539
606
|
}
|
|
540
607
|
|
|
608
|
+
var renderedItem = this.renderItem(error, disabled || this.props.commandRunning || this.props.disabled, defaultValue);
|
|
609
|
+
|
|
541
610
|
var _item = /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
|
|
542
611
|
item: true,
|
|
543
612
|
title: this.getText(schema.tooltip),
|
|
@@ -547,11 +616,27 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
547
616
|
sm: schema.sm || undefined,
|
|
548
617
|
style: Object.assign({}, {
|
|
549
618
|
marginBottom: 0,
|
|
550
|
-
//marginRight: 8,
|
|
619
|
+
// marginRight: 8,
|
|
551
620
|
textAlign: 'left',
|
|
552
621
|
width: schema.type === 'divider' || schema.type === 'header' ? schema.width || '100%' : undefined
|
|
553
622
|
}, schema.style, this.props.themeType === 'dark' ? schema.darkStyle : {})
|
|
554
|
-
}, this.
|
|
623
|
+
}, this.props.schema.defaultSendTo && this.props.schema.button ? /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
|
|
624
|
+
container: true,
|
|
625
|
+
style: {
|
|
626
|
+
width: '100%'
|
|
627
|
+
}
|
|
628
|
+
}, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
|
|
629
|
+
item: true,
|
|
630
|
+
flex: 1
|
|
631
|
+
}, renderedItem), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
|
|
632
|
+
item: true
|
|
633
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
634
|
+
variant: "outlined",
|
|
635
|
+
onClick: function onClick() {
|
|
636
|
+
return _this6.sendTo();
|
|
637
|
+
},
|
|
638
|
+
title: this.props.schema.buttonTooltip ? this.getText(this.props.schema.buttonTooltip, this.props.schema.buttonTooltipNoTranslation) : _i18n["default"].t('ra_Request data by instance')
|
|
639
|
+
}, this.getText(this.props.schema.button)))) : renderedItem);
|
|
555
640
|
|
|
556
641
|
if (schema.newLine) {
|
|
557
642
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -616,9 +701,9 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
|
|
|
616
701
|
}(_react.Component);
|
|
617
702
|
|
|
618
703
|
(0, _defineProperty2["default"])(ConfigGeneric, "DIFFERENT_VALUE", '__different__');
|
|
619
|
-
(0, _defineProperty2["default"])(ConfigGeneric, "DIFFERENT_LABEL",
|
|
704
|
+
(0, _defineProperty2["default"])(ConfigGeneric, "DIFFERENT_LABEL", 'ra___different__');
|
|
620
705
|
(0, _defineProperty2["default"])(ConfigGeneric, "NONE_VALUE", '');
|
|
621
|
-
(0, _defineProperty2["default"])(ConfigGeneric, "NONE_LABEL",
|
|
706
|
+
(0, _defineProperty2["default"])(ConfigGeneric, "NONE_LABEL", 'ra_none');
|
|
622
707
|
(0, _defineProperty2["default"])(ConfigGeneric, "AsyncFunction", Object.getPrototypeOf( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
623
708
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
624
709
|
while (1) {
|