quick-platform 1.0.47 → 1.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rollupPluginBabelHelpers.js +2 -0
- package/dist/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/dist/application/constants.js +2 -0
- package/dist/application/constants.js.map +1 -0
- package/dist/application/index.js +2 -0
- package/dist/application/index.js.map +1 -0
- package/dist/application/manage.js +2 -0
- package/dist/application/manage.js.map +1 -0
- package/dist/business/index.js +2 -0
- package/dist/business/index.js.map +1 -0
- package/dist/business/version.js +2 -0
- package/dist/business/version.js.map +1 -0
- package/dist/components/IconFont.js +2 -0
- package/dist/components/IconFont.js.map +1 -0
- package/dist/components/LocalDebug.js +2 -0
- package/dist/components/LocalDebug.js.map +1 -0
- package/dist/components/MicroApp.js +2 -0
- package/dist/components/MicroApp.js.map +1 -0
- package/dist/components/Permission.js +2 -0
- package/dist/components/Permission.js.map +1 -0
- package/dist/components/context.js +2 -0
- package/dist/components/context.js.map +1 -0
- package/dist/components/i18n.js +2 -0
- package/dist/components/i18n.js.map +1 -0
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -0
- package/dist/event.js +2 -0
- package/dist/event.js.map +1 -0
- package/dist/index.js +2 -8
- package/dist/index.js.map +1 -0
- package/dist/theme/define/color.js +2 -0
- package/dist/theme/define/color.js.map +1 -0
- package/dist/theme/define/font.js +2 -0
- package/dist/theme/define/font.js.map +1 -0
- package/dist/theme/define/index.js +2 -0
- package/dist/theme/define/index.js.map +1 -0
- package/dist/theme/define/size.js +2 -0
- package/dist/theme/define/size.js.map +1 -0
- package/dist/theme/define/style.js +2 -0
- package/dist/theme/define/style.js.map +1 -0
- package/dist/theme/lib/index.js +2 -0
- package/dist/theme/lib/index.js.map +1 -0
- package/dist/theme/react/hook.js +2 -0
- package/dist/theme/react/hook.js.map +1 -0
- package/dist/theme/react/index.js +2 -0
- package/dist/theme/react/index.js.map +1 -0
- package/dist/theme/uno.js +2 -0
- package/dist/theme/uno.js.map +1 -0
- package/dist/utils/i18n.js +2 -0
- package/dist/utils/i18n.js.map +1 -0
- package/dist/utils/image.js +2 -0
- package/dist/utils/image.js.map +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/localstorage.js +2 -0
- package/dist/utils/localstorage.js.map +1 -0
- package/dist/utils/request.js +2 -0
- package/dist/utils/request.js.map +1 -0
- package/dist/utils/utils.js +2 -0
- package/dist/utils/utils.js.map +1 -0
- package/package.json +4 -3
- package/dist/quick-platform.cjs.development.js +0 -1379
- package/dist/quick-platform.cjs.development.js.map +0 -1
- package/dist/quick-platform.cjs.production.min.js +0 -2
- package/dist/quick-platform.cjs.production.min.js.map +0 -1
- package/dist/quick-platform.esm.js +0 -1360
- package/dist/quick-platform.esm.js.map +0 -1
|
@@ -1,1360 +0,0 @@
|
|
|
1
|
-
import { loadMicroApp } from 'qiankun';
|
|
2
|
-
import EventEmitter from 'eventemitter3';
|
|
3
|
-
import React, { useRef, useState, useEffect, useMemo, useContext } from 'react';
|
|
4
|
-
import { createFromIconfontCN } from '@ant-design/icons';
|
|
5
|
-
import heic2any from 'heic2any';
|
|
6
|
-
import axios from 'axios';
|
|
7
|
-
|
|
8
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
9
|
-
try {
|
|
10
|
-
var i = n[a](c),
|
|
11
|
-
u = i.value;
|
|
12
|
-
} catch (n) {
|
|
13
|
-
return void e(n);
|
|
14
|
-
}
|
|
15
|
-
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
16
|
-
}
|
|
17
|
-
function _asyncToGenerator(n) {
|
|
18
|
-
return function () {
|
|
19
|
-
var t = this,
|
|
20
|
-
e = arguments;
|
|
21
|
-
return new Promise(function (r, o) {
|
|
22
|
-
var a = n.apply(t, e);
|
|
23
|
-
function _next(n) {
|
|
24
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
25
|
-
}
|
|
26
|
-
function _throw(n) {
|
|
27
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
28
|
-
}
|
|
29
|
-
_next(void 0);
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function _defineProperties(e, r) {
|
|
34
|
-
for (var t = 0; t < r.length; t++) {
|
|
35
|
-
var o = r[t];
|
|
36
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function _createClass(e, r, t) {
|
|
40
|
-
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
41
|
-
writable: !1
|
|
42
|
-
}), e;
|
|
43
|
-
}
|
|
44
|
-
function _extends() {
|
|
45
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
46
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
47
|
-
var t = arguments[e];
|
|
48
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
49
|
-
}
|
|
50
|
-
return n;
|
|
51
|
-
}, _extends.apply(null, arguments);
|
|
52
|
-
}
|
|
53
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
54
|
-
if (null == r) return {};
|
|
55
|
-
var t = {};
|
|
56
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
57
|
-
if (-1 !== e.indexOf(n)) continue;
|
|
58
|
-
t[n] = r[n];
|
|
59
|
-
}
|
|
60
|
-
return t;
|
|
61
|
-
}
|
|
62
|
-
function _regenerator() {
|
|
63
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
64
|
-
var e,
|
|
65
|
-
t,
|
|
66
|
-
r = "function" == typeof Symbol ? Symbol : {},
|
|
67
|
-
n = r.iterator || "@@iterator",
|
|
68
|
-
o = r.toStringTag || "@@toStringTag";
|
|
69
|
-
function i(r, n, o, i) {
|
|
70
|
-
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
71
|
-
u = Object.create(c.prototype);
|
|
72
|
-
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
73
|
-
var i,
|
|
74
|
-
c,
|
|
75
|
-
u,
|
|
76
|
-
f = 0,
|
|
77
|
-
p = o || [],
|
|
78
|
-
y = !1,
|
|
79
|
-
G = {
|
|
80
|
-
p: 0,
|
|
81
|
-
n: 0,
|
|
82
|
-
v: e,
|
|
83
|
-
a: d,
|
|
84
|
-
f: d.bind(e, 4),
|
|
85
|
-
d: function (t, r) {
|
|
86
|
-
return i = t, c = 0, u = e, G.n = r, a;
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
function d(r, n) {
|
|
90
|
-
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
91
|
-
var o,
|
|
92
|
-
i = p[t],
|
|
93
|
-
d = G.p,
|
|
94
|
-
l = i[2];
|
|
95
|
-
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
96
|
-
}
|
|
97
|
-
if (o || r > 1) return a;
|
|
98
|
-
throw y = !0, n;
|
|
99
|
-
}
|
|
100
|
-
return function (o, p, l) {
|
|
101
|
-
if (f > 1) throw TypeError("Generator is already running");
|
|
102
|
-
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
103
|
-
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
104
|
-
try {
|
|
105
|
-
if (f = 2, i) {
|
|
106
|
-
if (c || (o = "next"), t = i[o]) {
|
|
107
|
-
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
108
|
-
if (!t.done) return t;
|
|
109
|
-
u = t.value, c < 2 && (c = 0);
|
|
110
|
-
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
111
|
-
i = e;
|
|
112
|
-
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
113
|
-
} catch (t) {
|
|
114
|
-
i = e, c = 1, u = t;
|
|
115
|
-
} finally {
|
|
116
|
-
f = 1;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
value: t,
|
|
121
|
-
done: y
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
|
-
}(r, o, i), !0), u;
|
|
125
|
-
}
|
|
126
|
-
var a = {};
|
|
127
|
-
function Generator() {}
|
|
128
|
-
function GeneratorFunction() {}
|
|
129
|
-
function GeneratorFunctionPrototype() {}
|
|
130
|
-
t = Object.getPrototypeOf;
|
|
131
|
-
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
|
|
132
|
-
return this;
|
|
133
|
-
}), t),
|
|
134
|
-
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
135
|
-
function f(e) {
|
|
136
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
137
|
-
}
|
|
138
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
|
|
139
|
-
return this;
|
|
140
|
-
}), _regeneratorDefine(u, "toString", function () {
|
|
141
|
-
return "[object Generator]";
|
|
142
|
-
}), (_regenerator = function () {
|
|
143
|
-
return {
|
|
144
|
-
w: i,
|
|
145
|
-
m: f
|
|
146
|
-
};
|
|
147
|
-
})();
|
|
148
|
-
}
|
|
149
|
-
function _regeneratorDefine(e, r, n, t) {
|
|
150
|
-
var i = Object.defineProperty;
|
|
151
|
-
try {
|
|
152
|
-
i({}, "", {});
|
|
153
|
-
} catch (e) {
|
|
154
|
-
i = 0;
|
|
155
|
-
}
|
|
156
|
-
_regeneratorDefine = function (e, r, n, t) {
|
|
157
|
-
function o(r, n) {
|
|
158
|
-
_regeneratorDefine(e, r, function (e) {
|
|
159
|
-
return this._invoke(r, n, e);
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
r ? i ? i(e, r, {
|
|
163
|
-
value: n,
|
|
164
|
-
enumerable: !t,
|
|
165
|
-
configurable: !t,
|
|
166
|
-
writable: !t
|
|
167
|
-
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
168
|
-
}, _regeneratorDefine(e, r, n, t);
|
|
169
|
-
}
|
|
170
|
-
function _toPrimitive(t, r) {
|
|
171
|
-
if ("object" != typeof t || !t) return t;
|
|
172
|
-
var e = t[Symbol.toPrimitive];
|
|
173
|
-
if (void 0 !== e) {
|
|
174
|
-
var i = e.call(t, r || "default");
|
|
175
|
-
if ("object" != typeof i) return i;
|
|
176
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
177
|
-
}
|
|
178
|
-
return ("string" === r ? String : Number)(t);
|
|
179
|
-
}
|
|
180
|
-
function _toPropertyKey(t) {
|
|
181
|
-
var i = _toPrimitive(t, "string");
|
|
182
|
-
return "symbol" == typeof i ? i : i + "";
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
var isMicroApp = !!window.__POWERED_BY_QIANKUN__;
|
|
186
|
-
var assign = function assign(key, value, obj) {
|
|
187
|
-
var _Object$assign;
|
|
188
|
-
if (!key || !value) return obj || {};
|
|
189
|
-
return Object.assign(obj || {}, (_Object$assign = {}, _Object$assign[key] = value, _Object$assign));
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
var ROUTER_BASE_KEY = 'quick_qiankun_router_base';
|
|
193
|
-
var APP_PARENT_KEY = 'quick_qiankun_parent_app';
|
|
194
|
-
var APP_CACHE_PARENT_KEY = 'quick_qiankun_parent_cache';
|
|
195
|
-
var APP_MANAGE_KEY = 'quick_qiankun_manage';
|
|
196
|
-
|
|
197
|
-
var win = /*#__PURE__*/(0, eval)('this');
|
|
198
|
-
var appMap = win[APP_MANAGE_KEY] || (win[APP_MANAGE_KEY] = /*#__PURE__*/new Map());
|
|
199
|
-
var App = /*#__PURE__*/function () {
|
|
200
|
-
function App(name, parent) {
|
|
201
|
-
this.children = [];
|
|
202
|
-
this.cacheMap = new Map();
|
|
203
|
-
this.emitter = new EventEmitter();
|
|
204
|
-
this.on = this.emitter.on.bind(this.emitter);
|
|
205
|
-
this.once = this.emitter.once.bind(this.emitter);
|
|
206
|
-
this.off = this.emitter.off.bind(this.emitter);
|
|
207
|
-
this.name = name;
|
|
208
|
-
if (parent) {
|
|
209
|
-
this.parent = this.getParent(parent);
|
|
210
|
-
this.parent.addChildren(this);
|
|
211
|
-
}
|
|
212
|
-
appMap.set(name, this);
|
|
213
|
-
}
|
|
214
|
-
var _proto = App.prototype;
|
|
215
|
-
_proto.getParent = function getParent(parent) {
|
|
216
|
-
if (parent === 'root' && !appMap.has(parent)) {
|
|
217
|
-
var root = new App('root', '');
|
|
218
|
-
appMap.set(parent, root);
|
|
219
|
-
return root;
|
|
220
|
-
}
|
|
221
|
-
if (!appMap.has(parent)) {
|
|
222
|
-
throw new Error("quick micro app manage error:" + parent + " \u5E94\u7528\u672A\u52A0\u8F7D\uFF01");
|
|
223
|
-
}
|
|
224
|
-
return appMap.get(parent);
|
|
225
|
-
};
|
|
226
|
-
_proto.addChildren = function addChildren(child) {
|
|
227
|
-
this.children.push(child);
|
|
228
|
-
};
|
|
229
|
-
_proto.removeChildren = function removeChildren(name) {
|
|
230
|
-
this.children = this.children.filter(function (app) {
|
|
231
|
-
return app.name !== name;
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
/***
|
|
235
|
-
* 向父级通信
|
|
236
|
-
*/;
|
|
237
|
-
_proto.trigger = function trigger(name, data) {
|
|
238
|
-
if (this.parent) this.parent.emitter.emit(name, data);
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* 向所有子级通信
|
|
242
|
-
*/;
|
|
243
|
-
_proto.broadcast = function broadcast(name, data) {
|
|
244
|
-
for (var i = 0, len = this.children.length; i < len; i++) {
|
|
245
|
-
this.children[i].emitter.emit(name, data);
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
_proto.cache = function cache(key, value) {
|
|
249
|
-
if (typeof value !== 'undefined') this.cacheMap.set(key, value);
|
|
250
|
-
return this.cacheMap.get(key);
|
|
251
|
-
};
|
|
252
|
-
_proto.destroy = function destroy() {
|
|
253
|
-
this.emitter.removeAllListeners();
|
|
254
|
-
this.cacheMap.clear();
|
|
255
|
-
while (this.children.length) {
|
|
256
|
-
this.children.pop().destroy();
|
|
257
|
-
}
|
|
258
|
-
if (this.parent) this.parent.removeChildren(this.name);
|
|
259
|
-
};
|
|
260
|
-
return _createClass(App, [{
|
|
261
|
-
key: "root",
|
|
262
|
-
get: function get() {
|
|
263
|
-
var root = this;
|
|
264
|
-
while ((_root = root) != null && _root.parent) {
|
|
265
|
-
var _root;
|
|
266
|
-
root = root.parent;
|
|
267
|
-
}
|
|
268
|
-
return root;
|
|
269
|
-
}
|
|
270
|
-
}, {
|
|
271
|
-
key: "isRoot",
|
|
272
|
-
get: function get() {
|
|
273
|
-
return this.root.name === this.name;
|
|
274
|
-
}
|
|
275
|
-
}]);
|
|
276
|
-
}();
|
|
277
|
-
var app;
|
|
278
|
-
var intApp = function intApp(name) {
|
|
279
|
-
var win = window;
|
|
280
|
-
//@mark 解决proxy缓存问题,如果强行清除proxy上的缓存,可能导致其它问题引入,所以自行缓存父级缓存关系
|
|
281
|
-
var parent = win[APP_CACHE_PARENT_KEY] || win[APP_PARENT_KEY] || 'root';
|
|
282
|
-
if (!app) {
|
|
283
|
-
app = new App(name, parent);
|
|
284
|
-
win[APP_PARENT_KEY] = name;
|
|
285
|
-
win[APP_CACHE_PARENT_KEY] = parent;
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
var getCurrentApp = function getCurrentApp() {
|
|
289
|
-
if (app) return app;
|
|
290
|
-
return appMap.get('root') || function () {
|
|
291
|
-
var app = new App('root');
|
|
292
|
-
appMap.set('root', app);
|
|
293
|
-
return app;
|
|
294
|
-
}();
|
|
295
|
-
};
|
|
296
|
-
var disposeApp = function disposeApp() {
|
|
297
|
-
if (app) {
|
|
298
|
-
app.destroy();
|
|
299
|
-
app = undefined;
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
|
|
303
|
-
/*
|
|
304
|
-
* @Author: zhaoxuan (zhaoxuan@quickcep.com)
|
|
305
|
-
* @LastEditors: zhaoxuan (zhaoxuan@quickcep.com)
|
|
306
|
-
* @Date: 2023-05-10 13:42:03
|
|
307
|
-
* @Description:
|
|
308
|
-
* @LastEditDescription:
|
|
309
|
-
* @LastEditTime: 2023-05-10 17:36:24
|
|
310
|
-
*/
|
|
311
|
-
var ls = {
|
|
312
|
-
getData: function getData(key) {
|
|
313
|
-
var data = window.localStorage.getItem(key);
|
|
314
|
-
if (data) {
|
|
315
|
-
try {
|
|
316
|
-
return JSON.parse(data);
|
|
317
|
-
} catch (e) {
|
|
318
|
-
console.error(e);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
return null;
|
|
322
|
-
},
|
|
323
|
-
setData: function setData(key, value) {
|
|
324
|
-
try {
|
|
325
|
-
window.localStorage.setItem(key, JSON.stringify(value));
|
|
326
|
-
} catch (e) {
|
|
327
|
-
console.error(e);
|
|
328
|
-
}
|
|
329
|
-
},
|
|
330
|
-
removeItem: function removeItem(key) {
|
|
331
|
-
window.localStorage.removeItem(key);
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
var ReleaseMap;
|
|
336
|
-
(function (ReleaseMap) {
|
|
337
|
-
ReleaseMap[ReleaseMap["Trial"] = 1] = "Trial";
|
|
338
|
-
ReleaseMap[ReleaseMap["Free"] = 2] = "Free";
|
|
339
|
-
ReleaseMap[ReleaseMap["Basic"] = 3] = "Basic";
|
|
340
|
-
ReleaseMap[ReleaseMap["Professional"] = 4] = "Professional";
|
|
341
|
-
ReleaseMap[ReleaseMap["Ultimate"] = 5] = "Ultimate";
|
|
342
|
-
ReleaseMap[ReleaseMap["FreeCode"] = 13] = "FreeCode";
|
|
343
|
-
ReleaseMap[ReleaseMap["Starter"] = 14] = "Starter";
|
|
344
|
-
ReleaseMap[ReleaseMap["Growth"] = 15] = "Growth";
|
|
345
|
-
ReleaseMap[ReleaseMap["Enterprise"] = 6] = "Enterprise";
|
|
346
|
-
})(ReleaseMap || (ReleaseMap = {}));
|
|
347
|
-
//@mark LicenseTypeMap对应storeInfo里面的licenceType
|
|
348
|
-
// storeInfo 里的licenceType与licenceId没有对应关系,不能复用上文ReleaseMap的处理
|
|
349
|
-
var LicenseTypeMap;
|
|
350
|
-
(function (LicenseTypeMap) {
|
|
351
|
-
LicenseTypeMap["Enterprise"] = "ENTERPRISE";
|
|
352
|
-
LicenseTypeMap["PLG"] = "PLG";
|
|
353
|
-
})(LicenseTypeMap || (LicenseTypeMap = {}));
|
|
354
|
-
var PLGList = [ReleaseMap.Free, ReleaseMap.FreeCode, ReleaseMap.Starter, ReleaseMap.Growth];
|
|
355
|
-
var isPLG = function isPLG(licence) {
|
|
356
|
-
if (typeof licence.licenceId === 'undefined') return false;
|
|
357
|
-
return PLGList.includes(licence.licenceId);
|
|
358
|
-
};
|
|
359
|
-
var isSLG = function isSLG(licence) {
|
|
360
|
-
return !isPLG(licence);
|
|
361
|
-
};
|
|
362
|
-
var isEnterprise = function isEnterprise(licence) {
|
|
363
|
-
return ReleaseMap.Enterprise === licence.licenceId;
|
|
364
|
-
};
|
|
365
|
-
var isFree = function isFree(licence) {
|
|
366
|
-
return ReleaseMap.Free === licence.licenceId;
|
|
367
|
-
};
|
|
368
|
-
var isProfessional = function isProfessional(licence) {
|
|
369
|
-
return ReleaseMap.Professional === licence.licenceId;
|
|
370
|
-
};
|
|
371
|
-
var isCredits = function isCredits(licence) {
|
|
372
|
-
return !(LicenseTypeMap.Enterprise === licence.licenceType && licence.useBalance === 1);
|
|
373
|
-
};
|
|
374
|
-
|
|
375
|
-
var login = function login(userInfo) {
|
|
376
|
-
var _getCurrentApp, _getCurrentApp2;
|
|
377
|
-
var root = (_getCurrentApp = getCurrentApp()) == null ? void 0 : _getCurrentApp.root;
|
|
378
|
-
if (!((_getCurrentApp2 = getCurrentApp()) != null && _getCurrentApp2.isRoot)) {
|
|
379
|
-
console.warn('quick platform login warn:current App is not Root App. Invalid login!', getCurrentApp());
|
|
380
|
-
}
|
|
381
|
-
if (root) {
|
|
382
|
-
root == null || root.cache('userinfo', userInfo);
|
|
383
|
-
}
|
|
384
|
-
};
|
|
385
|
-
var buildSystemGetter = function buildSystemGetter(fn) {
|
|
386
|
-
return function () {
|
|
387
|
-
var _getCurrentApp3;
|
|
388
|
-
var root = (_getCurrentApp3 = getCurrentApp()) == null ? void 0 : _getCurrentApp3.root;
|
|
389
|
-
if (!root) {
|
|
390
|
-
console.warn('quick platform warn:root App not found!!!');
|
|
391
|
-
}
|
|
392
|
-
var userinfo = root == null ? void 0 : root.cache('userinfo');
|
|
393
|
-
if (!(userinfo != null && userinfo.userId)) {
|
|
394
|
-
console.error('quick platform warn:root App not logged in yet');
|
|
395
|
-
}
|
|
396
|
-
return fn(userinfo || {});
|
|
397
|
-
};
|
|
398
|
-
};
|
|
399
|
-
var authFunction = /*#__PURE__*/buildSystemGetter(function (userInfo) {
|
|
400
|
-
return userInfo.rightList || [];
|
|
401
|
-
});
|
|
402
|
-
var getUserInfo = /*#__PURE__*/buildSystemGetter(function (userInfo) {
|
|
403
|
-
return userInfo.statffInfo || {};
|
|
404
|
-
});
|
|
405
|
-
var getStaffInfo = /*#__PURE__*/buildSystemGetter(function (userInfo) {
|
|
406
|
-
return userInfo.staffInfo || {};
|
|
407
|
-
});
|
|
408
|
-
var getStoreInfo = /*#__PURE__*/buildSystemGetter(function (userInfo) {
|
|
409
|
-
return userInfo.storeInfo || {};
|
|
410
|
-
});
|
|
411
|
-
var getStoreLicense = /*#__PURE__*/buildSystemGetter(function (userInfo) {
|
|
412
|
-
return userInfo.storeLicenceInfo || {};
|
|
413
|
-
});
|
|
414
|
-
var hasAuth = function hasAuth(code) {
|
|
415
|
-
return authFunction().includes(code);
|
|
416
|
-
};
|
|
417
|
-
var getSystem = function getSystem() {
|
|
418
|
-
var oem = process.env.OEM_NAME;
|
|
419
|
-
var defaultLang = oem ? 'zh-CN' : 'en-US';
|
|
420
|
-
return {
|
|
421
|
-
oem: oem,
|
|
422
|
-
env: process.env.REACT_APP_ENVKEY,
|
|
423
|
-
lang: ls.getData('qs_lang') || defaultLang,
|
|
424
|
-
token: sessionStorage.getItem('quick-token') || '',
|
|
425
|
-
requestTokenKey: 'quick-token',
|
|
426
|
-
storeId: sessionStorage.getItem('quick-im-storeId') || ''
|
|
427
|
-
};
|
|
428
|
-
};
|
|
429
|
-
var getOEMName = function getOEMName() {
|
|
430
|
-
var _window$QUICK_CEP;
|
|
431
|
-
return (_window$QUICK_CEP = window.QUICK_CEP) == null || (_window$QUICK_CEP = _window$QUICK_CEP.oem) == null ? void 0 : _window$QUICK_CEP.name;
|
|
432
|
-
};
|
|
433
|
-
var LicenseCreator = function LicenseCreator(fn) {
|
|
434
|
-
return function () {
|
|
435
|
-
return fn(getStoreLicense());
|
|
436
|
-
};
|
|
437
|
-
};
|
|
438
|
-
var License = {
|
|
439
|
-
isPLG: /*#__PURE__*/LicenseCreator(isPLG),
|
|
440
|
-
isSLG: /*#__PURE__*/LicenseCreator(isSLG),
|
|
441
|
-
isEnterprise: /*#__PURE__*/LicenseCreator(isEnterprise),
|
|
442
|
-
isFree: /*#__PURE__*/LicenseCreator(isFree),
|
|
443
|
-
isProfessional: /*#__PURE__*/LicenseCreator(isProfessional),
|
|
444
|
-
isCredits: /*#__PURE__*/LicenseCreator(isCredits),
|
|
445
|
-
getLicense: getStoreLicense,
|
|
446
|
-
isOEM: function isOEM() {
|
|
447
|
-
return !!getOEMName();
|
|
448
|
-
}
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
var index = {
|
|
452
|
-
__proto__: null,
|
|
453
|
-
login: login,
|
|
454
|
-
getUserInfo: getUserInfo,
|
|
455
|
-
getStaffInfo: getStaffInfo,
|
|
456
|
-
getStoreInfo: getStoreInfo,
|
|
457
|
-
getStoreLicense: getStoreLicense,
|
|
458
|
-
hasAuth: hasAuth,
|
|
459
|
-
getSystem: getSystem,
|
|
460
|
-
getOEMName: getOEMName,
|
|
461
|
-
License: License
|
|
462
|
-
};
|
|
463
|
-
|
|
464
|
-
var baseUrl = 'https://quick-multilingual.obs.ap-southeast-3.myhuaweicloud.com';
|
|
465
|
-
var langMap = {
|
|
466
|
-
'zh-CN': 'zh',
|
|
467
|
-
'en-US': 'en',
|
|
468
|
-
ko: 'ko',
|
|
469
|
-
ja: 'ja',
|
|
470
|
-
'zh-TW': 'zh-tw'
|
|
471
|
-
};
|
|
472
|
-
var getI18nConfigUrl = function getI18nConfigUrl(env, name, lang) {
|
|
473
|
-
if (env === 'prod') return baseUrl + "/" + name + "/" + langMap[lang] + ".json";
|
|
474
|
-
return baseUrl + "/" + name + "/" + env + "/" + langMap[lang] + ".json";
|
|
475
|
-
};
|
|
476
|
-
var loadRemoteI18n = function loadRemoteI18n(env, name, lang) {
|
|
477
|
-
var url = '';
|
|
478
|
-
if (env === 'dev') {
|
|
479
|
-
url = getI18nConfigUrl('dev', name, lang);
|
|
480
|
-
} else {
|
|
481
|
-
url = getI18nConfigUrl(env === 'prod' ? 'prod' : 'test', name, lang);
|
|
482
|
-
}
|
|
483
|
-
return fetch(url + "?t=" + Date.now()).then(function (res) {
|
|
484
|
-
return res.json();
|
|
485
|
-
})["catch"](function () {
|
|
486
|
-
return {};
|
|
487
|
-
});
|
|
488
|
-
};
|
|
489
|
-
var $$i18n = function $$i18n(text, value) {
|
|
490
|
-
if (value === void 0) {
|
|
491
|
-
value = {};
|
|
492
|
-
}
|
|
493
|
-
return text.replace(/\{[a-zA-Z_0-9]*\}/g, function (key) {
|
|
494
|
-
return value[key.slice(1, -1)];
|
|
495
|
-
});
|
|
496
|
-
};
|
|
497
|
-
var initI18n = function initI18n(name, env) {
|
|
498
|
-
var messages = {};
|
|
499
|
-
var system = getSystem();
|
|
500
|
-
return {
|
|
501
|
-
messages: messages,
|
|
502
|
-
setup: function setup() {
|
|
503
|
-
var lang = function () {
|
|
504
|
-
if (isMicroApp) return system.lang;
|
|
505
|
-
return window.localStorage.getItem('quick_local_debug_lang') || system.lang;
|
|
506
|
-
}();
|
|
507
|
-
return loadRemoteI18n(env || 'prod', name, lang).then(function (lang) {
|
|
508
|
-
Object.assign(messages, lang);
|
|
509
|
-
});
|
|
510
|
-
},
|
|
511
|
-
i18n: function i18n(key, value) {
|
|
512
|
-
var content = messages[key];
|
|
513
|
-
if (typeof content === 'undefined') return key;
|
|
514
|
-
if (!value) return content;
|
|
515
|
-
return content.replace(/\{[a-zA-Z_0-9]*\}/g, function (key) {
|
|
516
|
-
return value[key.slice(1, -1)];
|
|
517
|
-
});
|
|
518
|
-
}
|
|
519
|
-
};
|
|
520
|
-
};
|
|
521
|
-
var installI18n = function installI18n(name, env) {
|
|
522
|
-
var _initI18n = initI18n(name, env),
|
|
523
|
-
i18n = _initI18n.i18n,
|
|
524
|
-
setup = _initI18n.setup,
|
|
525
|
-
messages = _initI18n.messages;
|
|
526
|
-
return {
|
|
527
|
-
$i18n: i18n,
|
|
528
|
-
$$i18n: $$i18n,
|
|
529
|
-
messages: messages,
|
|
530
|
-
loadPromise: setup()
|
|
531
|
-
};
|
|
532
|
-
};
|
|
533
|
-
|
|
534
|
-
var loadApp = function loadApp(name, container, props) {
|
|
535
|
-
var _ref = props || {},
|
|
536
|
-
_ref$host = _ref.host,
|
|
537
|
-
host = _ref$host === void 0 ? '' : _ref$host,
|
|
538
|
-
_ref$base = _ref.base,
|
|
539
|
-
base = _ref$base === void 0 ? '' : _ref$base;
|
|
540
|
-
var app = loadMicroApp({
|
|
541
|
-
name: name,
|
|
542
|
-
entry: host || window.location.origin + "/micro/" + name + "/" + ((props == null ? void 0 : props.entry) || 'micro') + ".html",
|
|
543
|
-
container: container,
|
|
544
|
-
props: {
|
|
545
|
-
base: base,
|
|
546
|
-
name: name
|
|
547
|
-
}
|
|
548
|
-
});
|
|
549
|
-
app.mountPromise["catch"](function (e) {
|
|
550
|
-
console.log('----启动子应用失败', e);
|
|
551
|
-
});
|
|
552
|
-
return app;
|
|
553
|
-
};
|
|
554
|
-
var registerApp = function registerApp(options) {
|
|
555
|
-
intApp(options.name);
|
|
556
|
-
var preLoad = options.i18n ? function () {
|
|
557
|
-
var i18n = installI18n(options.name, options.env);
|
|
558
|
-
if (options.i18n.global !== false) {
|
|
559
|
-
window.$$i18n = i18n.$$i18n;
|
|
560
|
-
window.$i18n = i18n.$i18n;
|
|
561
|
-
}
|
|
562
|
-
return Promise.all([i18n.loadPromise, options.i18n.onReady == null ? void 0 : options.i18n.onReady(i18n)]);
|
|
563
|
-
} : function () {
|
|
564
|
-
return Promise.resolve();
|
|
565
|
-
};
|
|
566
|
-
return {
|
|
567
|
-
beforeMount: function beforeMount() {
|
|
568
|
-
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
569
|
-
return _regenerator().w(function (_context) {
|
|
570
|
-
while (1) switch (_context.n) {
|
|
571
|
-
case 0:
|
|
572
|
-
return _context.a(2, new Promise(function () {}));
|
|
573
|
-
}
|
|
574
|
-
}, _callee);
|
|
575
|
-
}))();
|
|
576
|
-
},
|
|
577
|
-
mount: function mount(props) {
|
|
578
|
-
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
579
|
-
return _regenerator().w(function (_context2) {
|
|
580
|
-
while (1) switch (_context2.n) {
|
|
581
|
-
case 0:
|
|
582
|
-
intApp(options.name);
|
|
583
|
-
return _context2.a(2, options.lifecycles.mount == null ? void 0 : options.lifecycles.mount(props));
|
|
584
|
-
}
|
|
585
|
-
}, _callee2);
|
|
586
|
-
}))();
|
|
587
|
-
},
|
|
588
|
-
unmount: function unmount(props) {
|
|
589
|
-
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
590
|
-
return _regenerator().w(function (_context3) {
|
|
591
|
-
while (1) switch (_context3.n) {
|
|
592
|
-
case 0:
|
|
593
|
-
disposeApp(); //todo 可能有点问题
|
|
594
|
-
return _context3.a(2, options.lifecycles.unmount == null ? void 0 : options.lifecycles.unmount(props));
|
|
595
|
-
}
|
|
596
|
-
}, _callee3);
|
|
597
|
-
}))();
|
|
598
|
-
},
|
|
599
|
-
bootstrap: function bootstrap(props) {
|
|
600
|
-
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
601
|
-
return _regenerator().w(function (_context4) {
|
|
602
|
-
while (1) switch (_context4.n) {
|
|
603
|
-
case 0:
|
|
604
|
-
_context4.n = 1;
|
|
605
|
-
return preLoad();
|
|
606
|
-
case 1:
|
|
607
|
-
if (isMicroApp && props.base) {
|
|
608
|
-
console.log('来自主应用的路由base控制:', props.base);
|
|
609
|
-
window[ROUTER_BASE_KEY] = props.base;
|
|
610
|
-
}
|
|
611
|
-
return _context4.a(2, options.lifecycles.bootstrap == null ? void 0 : options.lifecycles.bootstrap(props));
|
|
612
|
-
}
|
|
613
|
-
}, _callee4);
|
|
614
|
-
}))();
|
|
615
|
-
}
|
|
616
|
-
};
|
|
617
|
-
};
|
|
618
|
-
|
|
619
|
-
var events = {
|
|
620
|
-
/**
|
|
621
|
-
*向父级发送事件
|
|
622
|
-
*/
|
|
623
|
-
trigger: function trigger(name, data) {
|
|
624
|
-
var _getCurrentApp;
|
|
625
|
-
(_getCurrentApp = getCurrentApp()) == null || _getCurrentApp.trigger(name, data);
|
|
626
|
-
},
|
|
627
|
-
/**
|
|
628
|
-
*向子级发送事件
|
|
629
|
-
*/
|
|
630
|
-
broadcast: function broadcast(name, data) {
|
|
631
|
-
var _getCurrentApp2;
|
|
632
|
-
(_getCurrentApp2 = getCurrentApp()) == null || _getCurrentApp2.broadcast(name, data);
|
|
633
|
-
},
|
|
634
|
-
on: function on(name, handler) {
|
|
635
|
-
var _getCurrentApp3;
|
|
636
|
-
(_getCurrentApp3 = getCurrentApp()) == null || _getCurrentApp3.on(name, handler);
|
|
637
|
-
},
|
|
638
|
-
off: function off(name, handler) {
|
|
639
|
-
var _getCurrentApp4;
|
|
640
|
-
(_getCurrentApp4 = getCurrentApp()) == null || _getCurrentApp4.off(name, handler);
|
|
641
|
-
}
|
|
642
|
-
};
|
|
643
|
-
|
|
644
|
-
var MicroApp = function MicroApp(props) {
|
|
645
|
-
var app = useRef();
|
|
646
|
-
var _useState = useState(true),
|
|
647
|
-
loading = _useState[0],
|
|
648
|
-
setLoading = _useState[1];
|
|
649
|
-
useEffect(function () {
|
|
650
|
-
return function () {
|
|
651
|
-
if (app.current) {
|
|
652
|
-
console.log(props.name, '应用卸载');
|
|
653
|
-
app.current.unmount();
|
|
654
|
-
console.log(props.name, '应用卸载完成');
|
|
655
|
-
}
|
|
656
|
-
};
|
|
657
|
-
}, []);
|
|
658
|
-
useState(function () {
|
|
659
|
-
if (props.data) {
|
|
660
|
-
getCurrentApp().cache(props.name + "-data", props.data);
|
|
661
|
-
}
|
|
662
|
-
});
|
|
663
|
-
useEffect(function () {
|
|
664
|
-
if (props.data) {
|
|
665
|
-
getCurrentApp().cache(props.name + "-data", props.data);
|
|
666
|
-
events.broadcast(props.name + "-data-change", props.data);
|
|
667
|
-
}
|
|
668
|
-
}, [props.data, props.name]);
|
|
669
|
-
return React.createElement('div', {
|
|
670
|
-
style: {
|
|
671
|
-
width: '100%',
|
|
672
|
-
height: '100%',
|
|
673
|
-
position: 'relative'
|
|
674
|
-
}
|
|
675
|
-
}, [React.createElement('div', {
|
|
676
|
-
style: {
|
|
677
|
-
width: '100%',
|
|
678
|
-
height: '100%'
|
|
679
|
-
},
|
|
680
|
-
className: props.className,
|
|
681
|
-
ref: function ref(instance) {
|
|
682
|
-
if (!instance || app.current) return;
|
|
683
|
-
var system = getSystem();
|
|
684
|
-
app.current = loadApp(props.name, instance, Object.assign({}, props.extra, assign('base', props.base), assign('host', props.host), assign('env', props.env || system.env), assign('entry', props.entry)));
|
|
685
|
-
app.current.mountPromise.then(function () {
|
|
686
|
-
setLoading(false);
|
|
687
|
-
props.onMounted == null || props.onMounted();
|
|
688
|
-
});
|
|
689
|
-
}
|
|
690
|
-
}), loading ? React.createElement('div', {
|
|
691
|
-
style: {
|
|
692
|
-
width: '100%',
|
|
693
|
-
height: '100%',
|
|
694
|
-
position: 'absolute',
|
|
695
|
-
top: 0,
|
|
696
|
-
left: 0
|
|
697
|
-
}
|
|
698
|
-
}, [props.loading]) : null]);
|
|
699
|
-
};
|
|
700
|
-
|
|
701
|
-
var _excluded = ["auth"];
|
|
702
|
-
var Permission = function Permission(_ref) {
|
|
703
|
-
var _ref$auth = _ref.auth,
|
|
704
|
-
auth = _ref$auth === void 0 ? function () {
|
|
705
|
-
return true;
|
|
706
|
-
} : _ref$auth,
|
|
707
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
708
|
-
if (hasAuth(props.code) && auth()) return props.children;
|
|
709
|
-
return null;
|
|
710
|
-
};
|
|
711
|
-
|
|
712
|
-
var _excluded$1 = ["post"],
|
|
713
|
-
_excluded2 = ["post"];
|
|
714
|
-
var URls = {
|
|
715
|
-
UserInfoUrl: '/store/user/getUserInfo',
|
|
716
|
-
Login: '/store/user/login',
|
|
717
|
-
StoreList: '/store/store/list',
|
|
718
|
-
ChangeStore: '/store/store/switch'
|
|
719
|
-
};
|
|
720
|
-
var useRequest = function useRequest(http, url) {
|
|
721
|
-
for (var _len = arguments.length, params = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
722
|
-
params[_key - 2] = arguments[_key];
|
|
723
|
-
}
|
|
724
|
-
var _useState = useState(),
|
|
725
|
-
data = _useState[0],
|
|
726
|
-
setData = _useState[1];
|
|
727
|
-
var _useState2 = useState(true),
|
|
728
|
-
loading = _useState2[0],
|
|
729
|
-
setLoading = _useState2[1];
|
|
730
|
-
var request = function request() {
|
|
731
|
-
setLoading(true);
|
|
732
|
-
return http.apply(void 0, [url].concat(params)).then(function (user) {
|
|
733
|
-
setData(user);
|
|
734
|
-
})["finally"](function () {
|
|
735
|
-
setLoading(false);
|
|
736
|
-
});
|
|
737
|
-
};
|
|
738
|
-
useEffect(function () {
|
|
739
|
-
request();
|
|
740
|
-
}, []);
|
|
741
|
-
return {
|
|
742
|
-
data: data,
|
|
743
|
-
loading: loading,
|
|
744
|
-
request: request,
|
|
745
|
-
setData: setData
|
|
746
|
-
};
|
|
747
|
-
};
|
|
748
|
-
var Spining = /*#__PURE__*/React.createElement('div', {
|
|
749
|
-
style: {
|
|
750
|
-
width: '100%',
|
|
751
|
-
height: '100&',
|
|
752
|
-
textAlign: 'center',
|
|
753
|
-
fontSize: 40
|
|
754
|
-
}
|
|
755
|
-
}, ['微应用本地调试模式初始化中...']);
|
|
756
|
-
var valueById = function valueById(id) {
|
|
757
|
-
return document.getElementById(id).value;
|
|
758
|
-
};
|
|
759
|
-
var Login = function Login(props) {
|
|
760
|
-
var login = function login() {
|
|
761
|
-
props.onLogin({
|
|
762
|
-
email: valueById('local_debug_account'),
|
|
763
|
-
loginStatus: 2,
|
|
764
|
-
password: valueById('local_debug_password')
|
|
765
|
-
});
|
|
766
|
-
};
|
|
767
|
-
return React.createElement('div', {
|
|
768
|
-
style: {
|
|
769
|
-
fontSize: 20,
|
|
770
|
-
display: 'flex',
|
|
771
|
-
alignItems: 'center',
|
|
772
|
-
justifyContent: 'center',
|
|
773
|
-
flexDirection: 'column',
|
|
774
|
-
height: '100%'
|
|
775
|
-
}
|
|
776
|
-
}, [React.createElement('div', {}), ['请先登录:', React.createElement('table', {}, [React.createElement('tr', {}, [React.createElement('td', {}, ['帐号:', React.createElement('input', {
|
|
777
|
-
id: 'local_debug_account',
|
|
778
|
-
style: {
|
|
779
|
-
fontSize: 20,
|
|
780
|
-
width: 400
|
|
781
|
-
}
|
|
782
|
-
})])]), React.createElement('tr', {}, [React.createElement('td', {}, ['密码:', React.createElement('input', {
|
|
783
|
-
id: 'local_debug_password',
|
|
784
|
-
type: 'password',
|
|
785
|
-
style: {
|
|
786
|
-
fontSize: 20,
|
|
787
|
-
width: 400
|
|
788
|
-
}
|
|
789
|
-
})])]), React.createElement('tr', {}, [React.createElement('td', {
|
|
790
|
-
colSpan: 2
|
|
791
|
-
}, [React.createElement('button', {
|
|
792
|
-
style: {
|
|
793
|
-
fontSize: 20,
|
|
794
|
-
width: '100%'
|
|
795
|
-
},
|
|
796
|
-
onClickCapture: login
|
|
797
|
-
}, ['登录'])])])])]]);
|
|
798
|
-
};
|
|
799
|
-
var Info = function Info(_ref) {
|
|
800
|
-
var post = _ref.post,
|
|
801
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
802
|
-
var store = getStoreInfo();
|
|
803
|
-
var staff = getStaffInfo();
|
|
804
|
-
var lang = window.localStorage.getItem('quick_local_debug_lang') || 'zh-CN';
|
|
805
|
-
var _useRequest = useRequest(post, URls.StoreList),
|
|
806
|
-
data = _useRequest.data;
|
|
807
|
-
return React.createElement('div', {
|
|
808
|
-
style: {
|
|
809
|
-
position: 'fixed',
|
|
810
|
-
right: 10,
|
|
811
|
-
bottom: 10,
|
|
812
|
-
zIndex: 10000
|
|
813
|
-
}
|
|
814
|
-
}, ['quick-platform子应用调试工具:', React.createElement('div', {
|
|
815
|
-
key: 'store'
|
|
816
|
-
}, [React.createElement('span', {
|
|
817
|
-
style: {
|
|
818
|
-
"float": 'left'
|
|
819
|
-
}
|
|
820
|
-
}, ["\u5F53\u524D\u5E97\u94FA:"]), React.createElement('select', {
|
|
821
|
-
style: {
|
|
822
|
-
fontSize: 16
|
|
823
|
-
},
|
|
824
|
-
value: store.id,
|
|
825
|
-
onChange: function onChange(e) {
|
|
826
|
-
post(URls.ChangeStore, {
|
|
827
|
-
storeId: e.target.value
|
|
828
|
-
}).then(function (data) {
|
|
829
|
-
sessionStorage.setItem('quick-storeId', data.storeId);
|
|
830
|
-
sessionStorage.setItem('quick-token', data.jwt);
|
|
831
|
-
sessionStorage.removeItem('quick-qyWechat');
|
|
832
|
-
console.log('%c [ halvee>]-133', 'font-size:13px; background:pink; color:#bf2c9f;', data.jwt);
|
|
833
|
-
window.location.reload();
|
|
834
|
-
})["catch"](function () {
|
|
835
|
-
alert('切换店铺失败');
|
|
836
|
-
});
|
|
837
|
-
}
|
|
838
|
-
}, (data || []).map(function (item) {
|
|
839
|
-
return React.createElement('option', {
|
|
840
|
-
value: item.id,
|
|
841
|
-
key: item.id
|
|
842
|
-
}, [item.storeName]);
|
|
843
|
-
}))]), React.createElement('div', {}, [React.createElement('span', {
|
|
844
|
-
style: {
|
|
845
|
-
"float": 'left'
|
|
846
|
-
}
|
|
847
|
-
}, ["\u5F53\u524D\u8BED\u8A00:"]), React.createElement('select', {
|
|
848
|
-
style: {
|
|
849
|
-
fontSize: 16
|
|
850
|
-
},
|
|
851
|
-
value: lang,
|
|
852
|
-
onChange: function onChange(e) {
|
|
853
|
-
localStorage.setItem('quick_local_debug_lang', e.target.value);
|
|
854
|
-
window.location.reload();
|
|
855
|
-
}
|
|
856
|
-
}, ['zh-CN', 'en-US', 'ko', 'ja', 'zh-TW'].map(function (key) {
|
|
857
|
-
return React.createElement('option', {
|
|
858
|
-
value: key,
|
|
859
|
-
key: key
|
|
860
|
-
}, [key]);
|
|
861
|
-
}))]), React.createElement('div', {
|
|
862
|
-
key: 'user'
|
|
863
|
-
}, ["\u5F53\u524D\u7528\u6237:" + staff.email]), React.createElement('button', {
|
|
864
|
-
onClick: function onClick() {
|
|
865
|
-
sessionStorage.clear();
|
|
866
|
-
props.onLogout();
|
|
867
|
-
}
|
|
868
|
-
}, ['退出登录'])]);
|
|
869
|
-
};
|
|
870
|
-
var LocalDebug = function LocalDebug(_ref2) {
|
|
871
|
-
var post = _ref2.post,
|
|
872
|
-
props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
873
|
-
var _useRequest2 = useRequest(post, URls.UserInfoUrl),
|
|
874
|
-
loading = _useRequest2.loading,
|
|
875
|
-
data = _useRequest2.data,
|
|
876
|
-
setData = _useRequest2.setData;
|
|
877
|
-
if (loading) return Spining;
|
|
878
|
-
if (!data) return React.createElement(Login, {
|
|
879
|
-
onLogin: function onLogin(info) {
|
|
880
|
-
post(URls.Login, info).then(function (data) {
|
|
881
|
-
login(data);
|
|
882
|
-
setData(data);
|
|
883
|
-
})["catch"](function (e) {
|
|
884
|
-
alert(e.data.message || '登录失败');
|
|
885
|
-
});
|
|
886
|
-
}
|
|
887
|
-
});
|
|
888
|
-
sessionStorage.setItem('quick-token', data.jwt);
|
|
889
|
-
login(data);
|
|
890
|
-
if (props.hideInfo) return React.createElement(React.Fragment, {}, props.children);
|
|
891
|
-
return React.createElement(React.Fragment, {}, [React.createElement(Info, {
|
|
892
|
-
key: 'info-wrapper',
|
|
893
|
-
post: post,
|
|
894
|
-
onLogout: function onLogout() {
|
|
895
|
-
setData(null);
|
|
896
|
-
}
|
|
897
|
-
}), props.children]);
|
|
898
|
-
};
|
|
899
|
-
|
|
900
|
-
var I18nFC = function I18nFC(text, data) {
|
|
901
|
-
if (!data) return text;
|
|
902
|
-
var list = [];
|
|
903
|
-
var prev = 0;
|
|
904
|
-
text.replace(/\{[a-zA-Z_0-9]*\}/g, function (match, index) {
|
|
905
|
-
var prevText = text.slice(prev, index);
|
|
906
|
-
list.push(prevText);
|
|
907
|
-
list.push(data[match.slice(1, -1)]);
|
|
908
|
-
prev = index + match.length;
|
|
909
|
-
return '';
|
|
910
|
-
});
|
|
911
|
-
list.push(text.slice(prev, text.length));
|
|
912
|
-
return React.createElement(React.Fragment, {}, list);
|
|
913
|
-
};
|
|
914
|
-
|
|
915
|
-
var hasInstalled = !! /*#__PURE__*/document.getElementById('_CD_ICON_1633');
|
|
916
|
-
var IconFont = /*#__PURE__*/createFromIconfontCN({
|
|
917
|
-
scriptUrl: hasInstalled ? '' : 'https://front-assets.obs.ap-southeast-3.myhuaweicloud.com/library/icon/icon.js'
|
|
918
|
-
});
|
|
919
|
-
|
|
920
|
-
var AppContext = /*#__PURE__*/React.createContext({
|
|
921
|
-
data: null
|
|
922
|
-
});
|
|
923
|
-
var useAppData = function useAppData() {
|
|
924
|
-
return React.useContext(AppContext).data;
|
|
925
|
-
};
|
|
926
|
-
var App$1 = function App(props) {
|
|
927
|
-
var _app$parent;
|
|
928
|
-
var app = getCurrentApp();
|
|
929
|
-
var _useState = useState((_app$parent = app.parent) == null ? void 0 : _app$parent.cache(app.name + "-data")),
|
|
930
|
-
data = _useState[0],
|
|
931
|
-
setData = _useState[1];
|
|
932
|
-
useEffect(function () {
|
|
933
|
-
var update = function update(data) {
|
|
934
|
-
setData(data);
|
|
935
|
-
};
|
|
936
|
-
events.on(app.name + "-data-change", update);
|
|
937
|
-
return function () {
|
|
938
|
-
events.off(app.name + "-data-change", update);
|
|
939
|
-
};
|
|
940
|
-
}, [app.name]);
|
|
941
|
-
var value = useMemo(function () {
|
|
942
|
-
return {
|
|
943
|
-
data: data
|
|
944
|
-
};
|
|
945
|
-
}, [data]);
|
|
946
|
-
return React.createElement(AppContext.Provider, {
|
|
947
|
-
value: value
|
|
948
|
-
}, [props.children]);
|
|
949
|
-
};
|
|
950
|
-
|
|
951
|
-
var handlerBlob = function handlerBlob(url, blob) {
|
|
952
|
-
return new Promise(function (resolve, reject) {
|
|
953
|
-
var img = new window.Image();
|
|
954
|
-
img.src = URL.createObjectURL(blob);
|
|
955
|
-
img.onload = resolve.bind(null, img.src);
|
|
956
|
-
img.onerror = reject.bind(null, url);
|
|
957
|
-
});
|
|
958
|
-
};
|
|
959
|
-
// eslint-disable-next-line max-len
|
|
960
|
-
var createFetch = function createFetch(handler) {
|
|
961
|
-
return function (url) {
|
|
962
|
-
return handler(url).then(handlerBlob.bind(null, url))["catch"](function () {
|
|
963
|
-
return Promise.reject(url);
|
|
964
|
-
});
|
|
965
|
-
};
|
|
966
|
-
};
|
|
967
|
-
// eslint-disable-next-line max-len
|
|
968
|
-
var tryHeic = /*#__PURE__*/createFetch(function (url) {
|
|
969
|
-
return fetch(url, {
|
|
970
|
-
headers: {},
|
|
971
|
-
mode: 'cors'
|
|
972
|
-
}).then(function (res) {
|
|
973
|
-
return res.blob();
|
|
974
|
-
}).then(function (blob) {
|
|
975
|
-
return heic2any({
|
|
976
|
-
blob: blob
|
|
977
|
-
});
|
|
978
|
-
}).then(function (blob) {
|
|
979
|
-
if (Array.isArray(blob)) return blob[0];
|
|
980
|
-
return blob;
|
|
981
|
-
});
|
|
982
|
-
});
|
|
983
|
-
// const tryProxy = createFetch((url) => fetch(`/store/stream/downloadFileStream?fileUrl=${encodeURIComponent(url)}`).then((res) => res.blob()));
|
|
984
|
-
var stack = /*#__PURE__*/new Map();
|
|
985
|
-
var tryCache = function tryCache(url, fetch) {
|
|
986
|
-
if (stack.has(url)) return stack.get(url);
|
|
987
|
-
var promise = fetch(url);
|
|
988
|
-
stack.set(url, promise);
|
|
989
|
-
promise["finally"](function () {
|
|
990
|
-
stack["delete"](url);
|
|
991
|
-
});
|
|
992
|
-
return promise;
|
|
993
|
-
};
|
|
994
|
-
var tryImageTranscode = function tryImageTranscode(url, customTry) {
|
|
995
|
-
if (!customTry) return tryCache(url, function () {
|
|
996
|
-
return tryHeic(url);
|
|
997
|
-
});
|
|
998
|
-
var customTryProxy = createFetch(customTry);
|
|
999
|
-
return tryCache(url, function () {
|
|
1000
|
-
return tryHeic(url)["catch"](customTryProxy);
|
|
1001
|
-
});
|
|
1002
|
-
};
|
|
1003
|
-
|
|
1004
|
-
var CancelToken = axios.CancelToken;
|
|
1005
|
-
var createMethods = function createMethods(inst, requestQueue) {
|
|
1006
|
-
return ['get', 'post'].map(function (method) {
|
|
1007
|
-
return function (url, params, config) {
|
|
1008
|
-
var _requestConfig;
|
|
1009
|
-
var source = (config == null ? void 0 : config.cancelTokenSource) || CancelToken.source();
|
|
1010
|
-
config == null || delete config.cancelTokenSource;
|
|
1011
|
-
var requestConfig = (_requestConfig = {}, _requestConfig[method === 'get' ? 'params' : 'data'] = params, _requestConfig);
|
|
1012
|
-
requestQueue.push(source);
|
|
1013
|
-
var requestUrl = url.replace(/\{([a-zA-Z]+)\}/g, function (_match, key) {
|
|
1014
|
-
if (!params) return key;
|
|
1015
|
-
var value = params[key] || key;
|
|
1016
|
-
/**兼容不删除的场景*/
|
|
1017
|
-
if (!params['saveQuery']) {
|
|
1018
|
-
delete params[key];
|
|
1019
|
-
} else {
|
|
1020
|
-
console.log('params', params);
|
|
1021
|
-
delete params['saveQuery'];
|
|
1022
|
-
}
|
|
1023
|
-
return value;
|
|
1024
|
-
});
|
|
1025
|
-
return inst.request(_extends({
|
|
1026
|
-
url: requestUrl,
|
|
1027
|
-
method: method.toUpperCase(),
|
|
1028
|
-
cancelToken: source.token
|
|
1029
|
-
}, requestConfig, config || {})).then(function (res) {
|
|
1030
|
-
return res == null ? void 0 : res.data;
|
|
1031
|
-
}).then(function (res) {
|
|
1032
|
-
if (!res.success) return Promise.reject(res);
|
|
1033
|
-
return res.data;
|
|
1034
|
-
});
|
|
1035
|
-
};
|
|
1036
|
-
});
|
|
1037
|
-
};
|
|
1038
|
-
var createAbort = function createAbort(queue) {
|
|
1039
|
-
return function (reason) {
|
|
1040
|
-
while (queue.length) {
|
|
1041
|
-
queue.shift().cancel(reason);
|
|
1042
|
-
}
|
|
1043
|
-
};
|
|
1044
|
-
};
|
|
1045
|
-
var creatorFactory = function creatorFactory(request, config1) {
|
|
1046
|
-
if (config1 === void 0) {
|
|
1047
|
-
config1 = {};
|
|
1048
|
-
}
|
|
1049
|
-
return function (url, config2) {
|
|
1050
|
-
if (config2 === void 0) {
|
|
1051
|
-
config2 = {};
|
|
1052
|
-
}
|
|
1053
|
-
return function (params, config3) {
|
|
1054
|
-
if (config3 === void 0) {
|
|
1055
|
-
config3 = {};
|
|
1056
|
-
}
|
|
1057
|
-
return request(url, params || {}, Object.assign({}, config1, config2, config3));
|
|
1058
|
-
};
|
|
1059
|
-
};
|
|
1060
|
-
};
|
|
1061
|
-
var createAxios = function createAxios(baseURL) {
|
|
1062
|
-
var inst = axios.create({
|
|
1063
|
-
baseURL: baseURL
|
|
1064
|
-
});
|
|
1065
|
-
var useResponseInterCeptor = inst.interceptors.response.use.bind(inst.interceptors.response);
|
|
1066
|
-
var useRequestInterCeptor = inst.interceptors.request.use.bind(inst.interceptors.request);
|
|
1067
|
-
return {
|
|
1068
|
-
instance: inst,
|
|
1069
|
-
useRequestInterCeptor: useRequestInterCeptor,
|
|
1070
|
-
useResponseInterCeptor: useResponseInterCeptor
|
|
1071
|
-
};
|
|
1072
|
-
};
|
|
1073
|
-
var cancelCreatorFactory = function cancelCreatorFactory() {
|
|
1074
|
-
return function (request) {
|
|
1075
|
-
return function () {
|
|
1076
|
-
var source = CancelToken.source();
|
|
1077
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1078
|
-
args[_key] = arguments[_key];
|
|
1079
|
-
}
|
|
1080
|
-
var configIndex = typeof args[0] === 'string' ? 2 : 1;
|
|
1081
|
-
args[configIndex] = Object.assign({}, args[configIndex] || {}, {
|
|
1082
|
-
cancelTokenSource: source
|
|
1083
|
-
});
|
|
1084
|
-
return [request.apply(void 0, args), function (reason) {
|
|
1085
|
-
source.cancel(reason);
|
|
1086
|
-
}];
|
|
1087
|
-
};
|
|
1088
|
-
};
|
|
1089
|
-
};
|
|
1090
|
-
var buildHttpCtrl = function buildHttpCtrl(server) {
|
|
1091
|
-
var requestQueue = [];
|
|
1092
|
-
var _createAxios = createAxios(server),
|
|
1093
|
-
inst = _createAxios.instance,
|
|
1094
|
-
useRequestInterCeptor = _createAxios.useRequestInterCeptor,
|
|
1095
|
-
useResponseInterCeptor = _createAxios.useResponseInterCeptor;
|
|
1096
|
-
var abort = createAbort(requestQueue);
|
|
1097
|
-
var _createMethods = createMethods(inst, requestQueue),
|
|
1098
|
-
get = _createMethods[0],
|
|
1099
|
-
post = _createMethods[1];
|
|
1100
|
-
var getCreator = creatorFactory(get);
|
|
1101
|
-
var postCreator = creatorFactory(post);
|
|
1102
|
-
var cancelCreator = cancelCreatorFactory();
|
|
1103
|
-
return {
|
|
1104
|
-
abort: abort,
|
|
1105
|
-
get: get,
|
|
1106
|
-
post: post,
|
|
1107
|
-
cancelCreator: cancelCreator,
|
|
1108
|
-
getCreator: getCreator,
|
|
1109
|
-
postCreator: postCreator,
|
|
1110
|
-
useRequestInterCeptor: useRequestInterCeptor,
|
|
1111
|
-
useResponseInterCeptor: useResponseInterCeptor
|
|
1112
|
-
};
|
|
1113
|
-
};
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
var index$1 = {
|
|
1118
|
-
__proto__: null,
|
|
1119
|
-
isMicroApp: isMicroApp,
|
|
1120
|
-
tryImageTranscode: tryImageTranscode,
|
|
1121
|
-
buildHttpCtrl: buildHttpCtrl,
|
|
1122
|
-
installI18n: installI18n
|
|
1123
|
-
};
|
|
1124
|
-
|
|
1125
|
-
var DefaultOpacity = /*#__PURE__*/(0.6 * 255).toString(16);
|
|
1126
|
-
// eslint-disable-next-line import/no-mutable-exports
|
|
1127
|
-
var PrimaryColor = '#ff6600';
|
|
1128
|
-
var generateVar = function generateVar(name) {
|
|
1129
|
-
return "--color-g-" + name;
|
|
1130
|
-
};
|
|
1131
|
-
//
|
|
1132
|
-
/* todo 预留主题色阶
|
|
1133
|
-
{
|
|
1134
|
-
'brand-1': string;
|
|
1135
|
-
'brand-2': string;
|
|
1136
|
-
'brand-3': string;
|
|
1137
|
-
'brand-4': string;
|
|
1138
|
-
'brand-5': string;
|
|
1139
|
-
'brand-6': string;
|
|
1140
|
-
}
|
|
1141
|
-
*/
|
|
1142
|
-
var BrandColor = {};
|
|
1143
|
-
var updateBrandColor = function updateBrandColor(color) {
|
|
1144
|
-
PrimaryColor = color;
|
|
1145
|
-
return BrandColor;
|
|
1146
|
-
};
|
|
1147
|
-
// todo 预留中性色
|
|
1148
|
-
// export const NeutralColor = {} ;
|
|
1149
|
-
// // todo 预留中性色-浅色
|
|
1150
|
-
// export const NeutralHelperColor: Record<
|
|
1151
|
-
// `${keyof typeof NeutralColor}-6`,
|
|
1152
|
-
// string
|
|
1153
|
-
// > = Object.keys(NeutralColor).reduce<any>((map, key) => {
|
|
1154
|
-
// map[`${key}-6`] =
|
|
1155
|
-
// NeutralColor[key as unknown as keyof typeof NeutralColor] + DefaultOpacity;
|
|
1156
|
-
// return map;
|
|
1157
|
-
// }, {});
|
|
1158
|
-
/**
|
|
1159
|
-
* todo预留功能色
|
|
1160
|
-
*/
|
|
1161
|
-
var FunctionalColor = {};
|
|
1162
|
-
var FunctionalHelperColor = /*#__PURE__*/Object.keys(FunctionalColor).reduce(function (map, key) {
|
|
1163
|
-
map[key + "-6"] = FunctionalColor[key] + DefaultOpacity;
|
|
1164
|
-
return map;
|
|
1165
|
-
}, {});
|
|
1166
|
-
|
|
1167
|
-
var color = {
|
|
1168
|
-
__proto__: null,
|
|
1169
|
-
get PrimaryColor () { return PrimaryColor; },
|
|
1170
|
-
generateVar: generateVar,
|
|
1171
|
-
BrandColor: BrandColor,
|
|
1172
|
-
updateBrandColor: updateBrandColor,
|
|
1173
|
-
FunctionalColor: FunctionalColor,
|
|
1174
|
-
FunctionalHelperColor: FunctionalHelperColor
|
|
1175
|
-
};
|
|
1176
|
-
|
|
1177
|
-
var EnFont = 'Inter';
|
|
1178
|
-
var NumberFont = 'Inter';
|
|
1179
|
-
var font = function font(size, _lineHeight) {
|
|
1180
|
-
return {
|
|
1181
|
-
fontSize: size,
|
|
1182
|
-
fontWeight: 'initial'
|
|
1183
|
-
};
|
|
1184
|
-
};
|
|
1185
|
-
var bold = function bold(_font) {
|
|
1186
|
-
return _extends({}, _font, {
|
|
1187
|
-
fontWeight: 'bold'
|
|
1188
|
-
});
|
|
1189
|
-
};
|
|
1190
|
-
var TextFont = {
|
|
1191
|
-
Normal: /*#__PURE__*/font(13),
|
|
1192
|
-
NormalBold: /*#__PURE__*/bold(/*#__PURE__*/font(13)),
|
|
1193
|
-
Small: /*#__PURE__*/font(12),
|
|
1194
|
-
SmallBold: /*#__PURE__*/bold(/*#__PURE__*/font(12)),
|
|
1195
|
-
Middle: /*#__PURE__*/font(14),
|
|
1196
|
-
MiddleBold: /*#__PURE__*/bold(/*#__PURE__*/font(14)),
|
|
1197
|
-
Large: /*#__PURE__*/font(16),
|
|
1198
|
-
LargeBold: /*#__PURE__*/bold(/*#__PURE__*/font(16)),
|
|
1199
|
-
Helper: /*#__PURE__*/font(12)
|
|
1200
|
-
};
|
|
1201
|
-
var TitleFont = {
|
|
1202
|
-
Normal: /*#__PURE__*/font(14),
|
|
1203
|
-
// Small: font(16, 24),
|
|
1204
|
-
Middle: /*#__PURE__*/font(16)
|
|
1205
|
-
};
|
|
1206
|
-
|
|
1207
|
-
var font$1 = {
|
|
1208
|
-
__proto__: null,
|
|
1209
|
-
EnFont: EnFont,
|
|
1210
|
-
NumberFont: NumberFont,
|
|
1211
|
-
TextFont: TextFont,
|
|
1212
|
-
TitleFont: TitleFont
|
|
1213
|
-
};
|
|
1214
|
-
|
|
1215
|
-
var DefaultSize = 4;
|
|
1216
|
-
// todo 还未定义,暂时不处理
|
|
1217
|
-
var BaseSize = /*#__PURE__*/Array.from({
|
|
1218
|
-
length: 10
|
|
1219
|
-
}).reduce(function (map, _, index) {
|
|
1220
|
-
map["size-" + (index + 1)] = (index + 1) * DefaultSize;
|
|
1221
|
-
return map;
|
|
1222
|
-
}, {});
|
|
1223
|
-
var ComponentSize = {};
|
|
1224
|
-
var MarginSize = {};
|
|
1225
|
-
var IconSize = {
|
|
1226
|
-
normal: 16
|
|
1227
|
-
};
|
|
1228
|
-
// 参考 https://www.woshipm.com/pd/4736098.html
|
|
1229
|
-
var ResponsiveScreenSize = {
|
|
1230
|
-
s: 480,
|
|
1231
|
-
m: 640,
|
|
1232
|
-
l: 1024,
|
|
1233
|
-
xl: 1366,
|
|
1234
|
-
xxl: 1920
|
|
1235
|
-
};
|
|
1236
|
-
|
|
1237
|
-
var size = {
|
|
1238
|
-
__proto__: null,
|
|
1239
|
-
BaseSize: BaseSize,
|
|
1240
|
-
ComponentSize: ComponentSize,
|
|
1241
|
-
MarginSize: MarginSize,
|
|
1242
|
-
IconSize: IconSize,
|
|
1243
|
-
ResponsiveScreenSize: ResponsiveScreenSize
|
|
1244
|
-
};
|
|
1245
|
-
|
|
1246
|
-
var border = function border(width, style) {
|
|
1247
|
-
return {
|
|
1248
|
-
borderStyle: style,
|
|
1249
|
-
borderWidth: width,
|
|
1250
|
-
borderColor: '#F0F0F0'
|
|
1251
|
-
};
|
|
1252
|
-
};
|
|
1253
|
-
var borderRadius = function borderRadius(radius) {
|
|
1254
|
-
return {
|
|
1255
|
-
borderRadius: radius
|
|
1256
|
-
};
|
|
1257
|
-
};
|
|
1258
|
-
var BorderRadius = {
|
|
1259
|
-
Small: /*#__PURE__*/borderRadius(6),
|
|
1260
|
-
Normal: /*#__PURE__*/borderRadius(8)
|
|
1261
|
-
};
|
|
1262
|
-
var Border = {
|
|
1263
|
-
SolidStroke: /*#__PURE__*/border(1, 'solid'),
|
|
1264
|
-
// SolidNormal: border(2, 'solid'),
|
|
1265
|
-
// SolidBold: border(3, 'solid'),
|
|
1266
|
-
DashedStroke: /*#__PURE__*/border(1, 'dashed')
|
|
1267
|
-
};
|
|
1268
|
-
// const shadow = (x: number, y: number, b: number, s: number) => {
|
|
1269
|
-
// return {
|
|
1270
|
-
// offsetX: x,
|
|
1271
|
-
// offsetY: y,
|
|
1272
|
-
// blurRadius: b,
|
|
1273
|
-
// spreadRadius: s,
|
|
1274
|
-
// color: '#00000020',
|
|
1275
|
-
// };
|
|
1276
|
-
// };
|
|
1277
|
-
var Shadow = {
|
|
1278
|
-
// Level1: shadow(0, 2, 5, 0),
|
|
1279
|
-
// Level2: shadow(0, 4, 10, 0),
|
|
1280
|
-
// Level3: shadow(0, 8, 20, 0),
|
|
1281
|
-
};
|
|
1282
|
-
|
|
1283
|
-
var style = {
|
|
1284
|
-
__proto__: null,
|
|
1285
|
-
BorderRadius: BorderRadius,
|
|
1286
|
-
Border: Border,
|
|
1287
|
-
Shadow: Shadow
|
|
1288
|
-
};
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
var index$2 = {
|
|
1293
|
-
__proto__: null,
|
|
1294
|
-
Color: color,
|
|
1295
|
-
Size: size,
|
|
1296
|
-
Font: font$1,
|
|
1297
|
-
Style: style
|
|
1298
|
-
};
|
|
1299
|
-
|
|
1300
|
-
var setPrimaryColor = function setPrimaryColor(color$1) {
|
|
1301
|
-
updateBrandColor(color$1);
|
|
1302
|
-
document.documentElement.style.setProperty(generateVar('primary'), PrimaryColor);
|
|
1303
|
-
// Object.keys(Color.BrandColor).forEach(key => {
|
|
1304
|
-
// document.documentElement.style.setProperty(
|
|
1305
|
-
// Color.generateVar(key),
|
|
1306
|
-
// Color.BrandColor[key]
|
|
1307
|
-
// );
|
|
1308
|
-
// });
|
|
1309
|
-
};
|
|
1310
|
-
|
|
1311
|
-
var ThemeContext = /*#__PURE__*/React.createContext({
|
|
1312
|
-
colorPrimary: PrimaryColor,
|
|
1313
|
-
setPrimaryColor: function setPrimaryColor(_color) {}
|
|
1314
|
-
});
|
|
1315
|
-
var ReactThemeHOC = function ReactThemeHOC(Component) {
|
|
1316
|
-
return function (props) {
|
|
1317
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
1318
|
-
var _useState = useState(PrimaryColor),
|
|
1319
|
-
primaryColor = _useState[0],
|
|
1320
|
-
_setPrimaryColor = _useState[1];
|
|
1321
|
-
return React.createElement(ThemeContext.Provider, {
|
|
1322
|
-
key: 'theme-hoc',
|
|
1323
|
-
value: {
|
|
1324
|
-
colorPrimary: primaryColor,
|
|
1325
|
-
setPrimaryColor: function setPrimaryColor(color) {
|
|
1326
|
-
_setPrimaryColor(color);
|
|
1327
|
-
}
|
|
1328
|
-
}
|
|
1329
|
-
}, [React.createElement(Component, _extends({}, props, {
|
|
1330
|
-
key: 'theme-hoc-component'
|
|
1331
|
-
}))]);
|
|
1332
|
-
};
|
|
1333
|
-
};
|
|
1334
|
-
var useThemePrimaryColor = function useThemePrimaryColor() {
|
|
1335
|
-
var context = useContext(ThemeContext);
|
|
1336
|
-
return {
|
|
1337
|
-
color: context.colorPrimary,
|
|
1338
|
-
set: function set(color) {
|
|
1339
|
-
context.setPrimaryColor(color);
|
|
1340
|
-
setPrimaryColor(color);
|
|
1341
|
-
}
|
|
1342
|
-
};
|
|
1343
|
-
};
|
|
1344
|
-
|
|
1345
|
-
var ThemeHOC = function ThemeHOC(Component
|
|
1346
|
-
// options: { antd?: boolean; iconPark?: boolean; antdPrefixCls?: string } = {},
|
|
1347
|
-
) {
|
|
1348
|
-
// const { antd = true } = options;
|
|
1349
|
-
// if (antd) {
|
|
1350
|
-
// Component = AntdHOC(Component, { prefixCls: options.antdPrefixCls });
|
|
1351
|
-
// }
|
|
1352
|
-
return ReactThemeHOC(Component);
|
|
1353
|
-
};
|
|
1354
|
-
|
|
1355
|
-
var win$1 = window;
|
|
1356
|
-
var debugKey = '__quick_platform_get_current_app__';
|
|
1357
|
-
win$1[debugKey] = getCurrentApp;
|
|
1358
|
-
|
|
1359
|
-
export { App$1 as App, events as AppEvent, index as Authentication, I18nFC, IconFont, LocalDebug, MicroApp, Permission, index$2 as Theme, ThemeHOC, index$1 as Utils, getCurrentApp, registerApp, useAppData, useThemePrimaryColor };
|
|
1360
|
-
//# sourceMappingURL=quick-platform.esm.js.map
|