@das-fed/upf-web 6.4.0-hot.5 → 6.4.0-hot.7

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.
@@ -1,149 +1,86 @@
1
- import { reactive as U, ref as O, createApp as P } from "vue";
2
- import { initTheme as x } from "@das-fed/upf-web/packages/theme/index";
3
- import { DasWebLayout as B } from "@das-fed/upf-web/packages/layout/index";
4
- import { createPinia as M } from "pinia";
5
- import W from "pinia-plugin-persistedstate";
6
- import { createRouter as S, createWebHistory as z } from "vue-router";
7
- import { getUrlParams as C, handleI18nData as H } from "@das-fed/upf-utils/common-tools";
8
- import { getConfig as K } from "@das-fed/upf-utils/config";
1
+ import { ref as W, createApp as O } from "vue";
2
+ import { initTheme as P } from "@das-fed/upf-web/packages/theme/index";
3
+ import { DasWebLayout as j } from "@das-fed/upf-web/packages/layout/index";
4
+ import { createPinia as C } from "pinia";
5
+ import D from "pinia-plugin-persistedstate";
6
+ import { createRouter as M, createWebHistory as E } from "vue-router";
7
+ import { languageKey as S, registerMicroI18nData as B, microI18nStore as I } from "@das-fed/upf-web/packages/i18n/index";
9
8
  const q = {
10
- install: (e, t) => {
11
- var o;
12
- const r = (o = t == null ? void 0 : t.plugins) == null ? void 0 : o.glob;
13
- r && Object.values(r).sort((a, l) => (a.index ?? 0) - (l.index ?? 0)).filter((a) => a ? !!(a.default && a.default.install || a.install) : !1).forEach((a) => {
14
- a.default && a.default.install && e.use(a.default, t), a.install && e.use(a, t);
9
+ install: (e, u) => {
10
+ var l;
11
+ const i = (l = u == null ? void 0 : u.plugins) == null ? void 0 : l.glob;
12
+ i && Object.values(i).sort((t, c) => (t.index ?? 0) - (c.index ?? 0)).filter((t) => t ? !!(t.default && t.default.install || t.install) : !1).forEach((t) => {
13
+ t.default && t.default.install && e.use(t.default, u), t.install && e.use(t, u);
15
14
  });
16
15
  }
17
- }, R = M();
18
- R.use(W);
19
- const L = "language", w = U({}), F = U({});
20
- U({});
21
- const G = C(location.href, "uiCulture") || "", T = G || window.localStorage.getItem(L) || window.navigator.language || "zh-CN", v = O(T), J = () => {
22
- const e = document.documentElement;
23
- e && e.setAttribute("lang", v.value);
24
- }, Q = (e = {}, t) => {
25
- console.log("setLangRule===", e, t);
26
- const r = {};
27
- for (const o in e)
28
- for (const a in e[o])
29
- r[a] || (r[a] = {}), r[a][o] = e[o][a] ?? "", w[a] || (w[a] = {}, console.log(`${w[a]}为空,重新设置为{}`)), w[a][o] = r[a][o];
30
- console.log("customLangeData===", w), console.log("globalLangeData===", F);
31
- }, V = (e) => {
32
- v.value = e, console.log("currentLang.value===", v.value), J();
33
- }, X = {
34
- loaded: {},
35
- isLoaded(e, t) {
36
- return !!(this.loaded[e] && this.loaded[e][t]);
37
- },
38
- markLoaded(e, t) {
39
- this.loaded[e] || (this.loaded[e] = {}), this.loaded[e][t] = !0;
40
- },
41
- markUnloaded(e, t) {
42
- this.loaded[e] && (delete this.loaded[e][t], Object.keys(this.loaded[e]).length === 0 && delete this.loaded[e]);
43
- }
44
- }, Y = async (e, t) => {
45
- var f, b, d;
46
- const r = K() || {}, o = ((f = r.i18n) == null ? void 0 : f.fromOss) ?? !0, a = ((b = r.i18n) == null ? void 0 : b.isPullBack) ?? !1, l = ((d = r.i18n) == null ? void 0 : d.isDasUI) ?? !0;
47
- let u = "/oss/resource/";
48
- try {
49
- const i = await H({
50
- baseUrl: o ? u : "/",
51
- currentLang: t,
52
- appName: e,
53
- isPullBack: a,
54
- fallbackBaseUrl: "/",
55
- isDasUI: l
56
- });
57
- if (!i || !(i != null && i.frontEnd))
58
- throw new Error("Failed to fetch i18n data");
59
- return i;
60
- } catch (p) {
61
- throw new Error(`registerResources error: ${p}`);
62
- }
63
- }, Z = async (e = [], t = "zh-CN") => {
64
- console.log("registerMicroI18nData===", e, t);
65
- try {
66
- const r = await Y(e, t);
67
- console.log("i18nData===", r);
68
- const o = {};
69
- r != null && r.frontEnd && typeof r.frontEnd == "object" && Object.keys(r.frontEnd).length && e.forEach((a) => {
70
- r.frontEnd[a] && typeof r.frontEnd[a] == "object" && Object.keys(r.frontEnd[a]).length ? o[t] = {
71
- ...o[t] || {},
72
- ...r.frontEnd[a]
73
- } : console.warn(`No front-end i18n data found for app: ${a}`);
74
- }), r != null && r.dasUiEnd && typeof r.dasUiEnd == "object" && Object.keys(r.dasUiEnd).length && (o[t] = {
75
- ...o[t] || {},
76
- ...r.dasUiEnd
77
- }), o[t] && Object.keys(o[t]).length && Q(o), V(t);
78
- } catch (r) {
79
- console.error("registerMicroI18nData error:", r);
80
- }
81
- }, _ = (e) => {
82
- var p, A, i, j, D;
83
- const t = ((p = e == null ? void 0 : e.router) == null ? void 0 : p.routerBase) ?? "/", r = ((A = e == null ? void 0 : e.router) == null ? void 0 : A.options) || {};
84
- let o = Object.assign(((i = e == null ? void 0 : e.router) == null ? void 0 : i.glob) || {});
85
- const a = Object.values(o).filter((c) => !!c).flat().sort((c, n) => (c.index ?? 0) - (n.index ?? 0)), l = [];
86
- (j = e == null ? void 0 : e.microApps) == null || j.map((c) => {
87
- var k;
88
- const n = Object.values(((k = c.router) == null ? void 0 : k.glob) || {}).filter((s) => !!s).flat().sort((s, y) => (s.index ?? 0) - (y.index ?? 0));
89
- l.push(
90
- ...n.map((s) => ({ ...s, path: `/${c.microAppName}${s.path}` }))
91
- ), l.push(
92
- ...n.filter((s) => !!s.path).filter((s) => s.path !== "").filter((s) => s.path !== "/").filter((s) => !s.path.startsWith(`/${s.microAppName}`)).map((s) => ({
93
- path: s.path,
94
- redirect: `/${c.microAppName}${s.path}`,
95
- meta: { ...s.meta || {}, isMicroAppRouteRedirect: !0 }
16
+ }, b = C();
17
+ b.use(D);
18
+ const z = (e) => {
19
+ var R, y, v, k, $;
20
+ const u = ((R = e == null ? void 0 : e.router) == null ? void 0 : R.routerBase) ?? "/", i = ((y = e == null ? void 0 : e.router) == null ? void 0 : y.options) || {};
21
+ let l = Object.assign(((v = e == null ? void 0 : e.router) == null ? void 0 : v.glob) || {});
22
+ const t = Object.values(l).filter((n) => !!n).flat().sort((n, a) => (n.index ?? 0) - (a.index ?? 0)), c = [];
23
+ (k = e == null ? void 0 : e.microApps) == null || k.map((n) => {
24
+ var g;
25
+ const a = Object.values(((g = n.router) == null ? void 0 : g.glob) || {}).filter((r) => !!r).flat().sort((r, h) => (r.index ?? 0) - (h.index ?? 0));
26
+ c.push(
27
+ ...a.map((r) => ({ ...r, path: `/${n.microAppName}${r.path}` }))
28
+ ), c.push(
29
+ ...a.filter((r) => !!r.path).filter((r) => r.path !== "").filter((r) => r.path !== "/").filter((r) => !r.path.startsWith(`/${r.microAppName}`)).map((r) => ({
30
+ path: r.path,
31
+ redirect: `/${n.microAppName}${r.path}`,
32
+ meta: { ...r.meta || {}, isMicroAppRouteRedirect: !0 }
96
33
  }))
97
34
  );
98
35
  });
99
- const u = ((D = e == null ? void 0 : e.router) == null ? void 0 : D.routers) || [], f = [
100
- ...E(a, e),
101
- ...E(u, e),
102
- ...E(l, e)
103
- ], b = S({ history: z(t), routes: f, ...r }), d = X;
104
- if (Array.isArray(e == null ? void 0 : e.microApps) && e.microApps.length && d) {
105
- const c = /* @__PURE__ */ new Map();
106
- for (const n of e.microApps)
107
- n != null && n.microAppName && (n != null && n.i18n) && c.set(n.microAppName, n.i18n);
108
- b.beforeEach(async (n, k, s) => {
109
- var y;
36
+ const m = (($ = e == null ? void 0 : e.router) == null ? void 0 : $.routers) || [], d = [
37
+ ...A(t, e),
38
+ ...A(m, e),
39
+ ...A(c, e)
40
+ ], w = M({ history: E(u), routes: d, ...i }), p = I;
41
+ if (Array.isArray(e == null ? void 0 : e.microApps) && e.microApps.length && p) {
42
+ const n = /* @__PURE__ */ new Map();
43
+ for (const a of e.microApps)
44
+ a != null && a.microAppName && (a != null && a.i18n) && n.set(a.microAppName, a.i18n);
45
+ w.beforeEach(async (a, g, r) => {
46
+ var h;
110
47
  try {
111
- const h = ((y = n.query) == null ? void 0 : y.uiCulture) || window.localStorage.getItem(L) || window.navigator.language || "zh-CN", $ = n.path || "";
112
- for (const [g, m] of c.entries()) {
113
- if (!g || !$.toLowerCase().startsWith(`/${g.toLowerCase()}`)) continue;
114
- if (d.isLoaded(h, g) || !m || !(m != null && m.length)) break;
115
- const I = typeof m == "string" ? [m] : m;
116
- d.markLoaded(h, g);
48
+ const s = ((h = a.query) == null ? void 0 : h.uiCulture) || window.localStorage.getItem(S) || window.navigator.language || "zh-CN", x = a.path || "";
49
+ for (const [o, f] of n.entries()) {
50
+ if (!o || !x.toLowerCase().startsWith(`/${o.toLowerCase()}`)) continue;
51
+ if (p.isLoaded(s, o) || !f || !(f != null && f.length)) break;
52
+ const L = typeof f == "string" ? [f] : f;
53
+ p.markLoaded(s, o);
117
54
  try {
118
- await Z(I, h);
55
+ await B(L, s);
119
56
  } catch (N) {
120
- d.markUnloaded(h, g), console.error(`[initRouter] load micro app i18n failed for ${g}:`, N);
57
+ p.markUnloaded(s, o), console.error(`[initRouter] load micro app i18n failed for ${o}:`, N);
121
58
  }
122
59
  break;
123
60
  }
124
- } catch (h) {
125
- console.error("[initRouter] microApps i18n beforeEach handler error:", h);
61
+ } catch (s) {
62
+ console.error("[initRouter] microApps i18n beforeEach handler error:", s);
126
63
  } finally {
127
- s();
64
+ r();
128
65
  }
129
66
  });
130
67
  }
131
- return { router: b };
132
- }, E = (e, t) => e.map((r) => {
133
- const o = r.meta || {};
134
- return o.keepAlive = o.keepAlive ?? (t == null ? void 0 : t.keepAlive) ?? !0, { ...r, meta: o };
135
- }), ce = (e) => {
136
- var f;
68
+ return { router: w };
69
+ }, A = (e, u) => e.map((i) => {
70
+ const l = i.meta || {};
71
+ return l.keepAlive = l.keepAlive ?? (u == null ? void 0 : u.keepAlive) ?? !0, { ...i, meta: l };
72
+ }), Q = (e) => {
73
+ var d;
137
74
  e || (e = {});
138
- const t = O(!0);
139
- Promise.all([x(e)]).then(() => {
140
- t.value = !1;
75
+ const u = W(!0);
76
+ Promise.all([P(e)]).then(() => {
77
+ u.value = !1;
141
78
  });
142
- const { container: r, component: o, props: a } = (e == null ? void 0 : e.root) || {}, l = P(o || B, a);
143
- l.use(q, e), l.use(R);
144
- const { router: u } = _(e);
145
- return l.use(u), l.mount(r || "#app"), (f = window.top) != null && f.vueRouter || window.top && (window.top.vueRouter = u), { app: l, router: u, loading: t, store: R };
79
+ const { container: i, component: l, props: t } = (e == null ? void 0 : e.root) || {}, c = O(l || j, t);
80
+ c.use(q, e), c.use(b);
81
+ const { router: m } = z(e);
82
+ return c.use(m), c.mount(i || "#app"), (d = window.top) != null && d.vueRouter || window.top && (window.top.vueRouter = m), { app: c, router: m, loading: u, store: b };
146
83
  };
147
84
  export {
148
- ce as createDasWebApp
85
+ Q as createDasWebApp
149
86
  };
@@ -1,107 +1,164 @@
1
1
  'use strict';
2
2
 
3
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
5
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
3
6
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
7
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t4 in e) "default" !== _t4 && {}.hasOwnProperty.call(e, _t4) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t4)) && (i.get || i.set) ? o(f, _t4, i) : f[_t4] = e[_t4]); return f; })(e, t); }
5
8
  function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; 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)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
6
9
  function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var o = function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
7
10
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
8
11
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
9
12
  var vue = require('vue');
10
13
  var commonTools = require('@das-fed/upf-utils/common-tools');
11
- var D = "language",
14
+ var config = require('@das-fed/upf-utils/config');
15
+ var x = {
16
+ loaded: {},
17
+ isLoaded: function isLoaded(t, e) {
18
+ return !!(this.loaded[t] && this.loaded[t][e]);
19
+ },
20
+ markLoaded: function markLoaded(t, e) {
21
+ this.loaded[t] || (this.loaded[t] = {}), this.loaded[t][e] = true;
22
+ },
23
+ markUnloaded: function markUnloaded(t, e) {
24
+ this.loaded[t] && (delete this.loaded[t][e], Object.keys(this.loaded[t]).length === 0 && delete this.loaded[t]);
25
+ }
26
+ },
27
+ U = /*#__PURE__*/function () {
28
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(t, e) {
29
+ var _ref2, _ref3, _ref4;
30
+ var m, u, g, o, a, s, n, r, l, _t;
31
+ return _regenerator().w(function (_context) {
32
+ while (1) switch (_context.p = _context.n) {
33
+ case 0:
34
+ o = config.getConfig() || {}, a = (_ref2 = (m = o.i18n) == null ? undefined : m.fromOss) !== null && _ref2 !== void 0 ? _ref2 : true, s = (_ref3 = (u = o.i18n) == null ? undefined : u.isPullBack) !== null && _ref3 !== void 0 ? _ref3 : false, n = (_ref4 = (g = o.i18n) == null ? undefined : g.isDasUI) !== null && _ref4 !== void 0 ? _ref4 : true;
35
+ r = "/oss/resource/";
36
+ _context.p = 1;
37
+ _context.n = 2;
38
+ return commonTools.handleI18nData({
39
+ baseUrl: a ? r : "/",
40
+ currentLang: e,
41
+ appName: t,
42
+ isPullBack: s,
43
+ fallbackBaseUrl: "/",
44
+ isDasUI: n
45
+ });
46
+ case 2:
47
+ l = _context.v;
48
+ if (!(!l || !(l != null && l.frontEnd))) {
49
+ _context.n = 3;
50
+ break;
51
+ }
52
+ throw new Error("Failed to fetch i18n data");
53
+ case 3:
54
+ return _context.a(2, l);
55
+ case 4:
56
+ _context.p = 4;
57
+ _t = _context.v;
58
+ throw new Error("registerResources error: ".concat(_t));
59
+ case 5:
60
+ return _context.a(2);
61
+ }
62
+ }, _callee, null, [[1, 4]]);
63
+ }));
64
+ return function U(_x, _x2) {
65
+ return _ref.apply(this, arguments);
66
+ };
67
+ }(),
68
+ C = "language",
12
69
  i = vue.reactive({}),
13
- l = vue.reactive({}),
14
- m = vue.reactive({}),
15
- h = commonTools.getUrlParams(location.href, "uiCulture") || "",
16
- j = h || window.localStorage.getItem(D) || window.navigator.language || "zh-CN",
17
- c = vue.ref(j),
18
- y = "dasI18n",
19
- p = function p() {
70
+ c = vue.reactive({}),
71
+ d = vue.reactive({}),
72
+ M = commonTools.getUrlParams(location.href, "uiCulture") || "",
73
+ O = M || window.localStorage.getItem(C) || window.navigator.language || "zh-CN",
74
+ f = vue.ref(O),
75
+ z = "dasI18n",
76
+ E = function E() {
20
77
  var t = document.documentElement;
21
- t && t.setAttribute("lang", c.value);
78
+ t && t.setAttribute("lang", f.value);
22
79
  },
23
- M = function M() {
80
+ w = function w() {
24
81
  var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
25
- var a = arguments.length > 1 ? arguments[1] : undefined;
26
- var e = a === "global",
27
- r = !e;
28
- console.log("setLangRule===", t, a);
29
- var s = {};
30
- for (var o in t) for (var n in t[o]) {
31
- var _t$o$n;
32
- s[n] || (s[n] = {}), s[n][o] = (_t$o$n = t[o][n]) !== null && _t$o$n !== void 0 ? _t$o$n : "", e && (l[n] || (l[n] = {}), l[n][o] = s[n][o]), r && (i[n] || (i[n] = {}, console.log("".concat(i[n], "\u4E3A\u7A7A\uFF0C\u91CD\u65B0\u8BBE\u7F6E\u4E3A{}"))), i[n][o] = s[n][o]);
82
+ var e = arguments.length > 1 ? arguments[1] : undefined;
83
+ var o = e === "global",
84
+ a = !o,
85
+ s = {};
86
+ for (var n in t) for (var r in t[n]) {
87
+ var _t$n$r;
88
+ s[r] || (s[r] = {}), s[r][n] = (_t$n$r = t[n][r]) !== null && _t$n$r !== void 0 ? _t$n$r : "", o && (c[r] || (c[r] = {}), c[r][n] = s[r][n]), a && (i[r] || (i[r] = {}), i[r][n] = s[r][n]);
33
89
  }
34
- console.log("customLangeData===", i), console.log("globalLangeData===", l);
90
+ console.log("注册customLangeData", i);
35
91
  },
36
- b = function b() {
92
+ A = function A() {
37
93
  var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
38
- var a = arguments.length > 1 ? arguments[1] : undefined;
94
+ var e = arguments.length > 1 ? arguments[1] : undefined;
39
95
  var s;
40
- var e = a === "global",
41
- r = !e;
42
- for (var o in t) if (e && !l[o] && (l[o] = t[o]), r) {
43
- var n = (s = t[o]) != null && s._appCode ? t[o]._appCode.toLowerCase() : "";
44
- n && (m[n] || (m[n] = {}), m[n][o] = t[o]), i[o] || (i[o] = t[o]);
96
+ var o = e === "global",
97
+ a = !o;
98
+ for (var n in t) if (o && !c[n] && (c[n] = t[n]), a) {
99
+ var r = (s = t[n]) != null && s._appCode ? t[n]._appCode.toLowerCase() : "";
100
+ r && (d[r] || (d[r] = {}), d[r][n] = t[n]), i[n] || (i[n] = t[n]);
45
101
  }
102
+ console.log("获取customLangeData", i);
46
103
  },
47
- R = /*#__PURE__*/function () {
48
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(t) {
49
- var a;
50
- return _regenerator().w(function (_context) {
51
- while (1) switch (_context.n) {
104
+ B = /*#__PURE__*/function () {
105
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(t) {
106
+ var e;
107
+ return _regenerator().w(function (_context2) {
108
+ while (1) switch (_context2.n) {
52
109
  case 0:
53
- p();
54
- a = window[y];
55
- a && b(a, "global");
110
+ E();
111
+ e = window[z];
112
+ e && A(e, "global");
56
113
  case 1:
57
- return _context.a(2);
114
+ return _context2.a(2);
58
115
  }
59
- }, _callee);
116
+ }, _callee2);
60
117
  }));
61
- return function R(_x) {
62
- return _ref.apply(this, arguments);
118
+ return function B(_x3) {
119
+ return _ref5.apply(this, arguments);
63
120
  };
64
121
  }(),
65
- v = function v(t) {
66
- var a = "";
67
- var e = /\/([^\/]+)\/([^\/]+)\//,
68
- r = t.match(e);
69
- return r && r.length >= 3 && (a = r[1] + "/" + r[2]), a ? a.toLowerCase() : "";
122
+ N = function N(t) {
123
+ var e = "";
124
+ var o = /\/([^\/]+)\/([^\/]+)\//,
125
+ a = t.match(o);
126
+ return a && a.length >= 3 && (e = a[1] + "/" + a[2]), e ? e.toLowerCase() : "";
70
127
  },
71
- A = function A(t) {
72
- for (var _len = arguments.length, a = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
73
- a[_key - 1] = arguments[_key];
128
+ R = function R(t) {
129
+ for (var _len = arguments.length, e = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
130
+ e[_key - 1] = arguments[_key];
74
131
  }
75
132
  return vue.computed(function () {
76
- var _m$framework, _m$e;
77
- var e = v(location.pathname);
78
- var r = (_m$framework = m.framework) !== null && _m$framework !== void 0 ? _m$framework : {},
79
- s = (_m$e = m[e]) !== null && _m$e !== void 0 ? _m$e : {},
80
- o = i[t] || l[t] || r[t] || s[t] || t;
81
- if (o === t) return t;
82
- console.log("customLangeData===222", i), typeof o == "string" && (o = {
83
- "zh-CN": o
133
+ var _d$framework, _d$o;
134
+ var o = N(location.pathname);
135
+ var a = (_d$framework = d.framework) !== null && _d$framework !== void 0 ? _d$framework : {},
136
+ s = (_d$o = d[o]) !== null && _d$o !== void 0 ? _d$o : {},
137
+ n = i[t] || c[t] || a[t] || s[t] || t;
138
+ if (n === t) return t;
139
+ typeof n == "string" && (n = {
140
+ "zh-CN": n
84
141
  });
85
- var n = o[c.value];
86
- return c.value === "zh-CN" && o["zh-cn"] && !o["zh-CN"] && (n = o["zh-cn"]), a.map(function (f, d) {
87
- n && (n = n.replace("$".concat(d), f));
88
- }), n;
142
+ var r = n[f.value];
143
+ return f.value === "zh-CN" && n["zh-cn"] && !n["zh-CN"] && (r = n["zh-cn"]), e.map(function (m, u) {
144
+ r && (r = r.replace("$".concat(u), m));
145
+ }), r;
89
146
  });
90
147
  },
91
- I = A,
92
- N = function N(t) {
93
- for (var _len2 = arguments.length, a = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
94
- a[_key2 - 1] = arguments[_key2];
148
+ k = R,
149
+ F = function F(t) {
150
+ for (var _len2 = arguments.length, e = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
151
+ e[_key2 - 1] = arguments[_key2];
95
152
  }
96
- return I.apply(void 0, [t].concat(a)).value;
153
+ return k.apply(void 0, [t].concat(e)).value;
97
154
  },
98
- T = function T(t) {
99
- c.value = t, console.log("currentLang.value===", c.value), p();
155
+ v = function v(t) {
156
+ f.value = t, E();
100
157
  },
101
- _ = function _() {
102
- return c;
158
+ $ = function $() {
159
+ return f;
103
160
  },
104
- g = {
161
+ y = {
105
162
  "en-US": {
106
163
  ant: function ant() {
107
164
  return Promise.resolve().then(function () {
@@ -259,50 +316,87 @@ var D = "language",
259
316
  }
260
317
  }
261
318
  };
262
- function x(t, a) {
263
- var r;
264
- var e = window.DATE_FORMAT_MAP;
265
- return e && e[t] && e[t][a] ? e[t][a] : ((r = window.DATE_FORMAT_MAP[t]) == null ? undefined : r[a]) || "YYYY-MM-DD";
319
+ function G(t, e) {
320
+ var a;
321
+ var o = window.DATE_FORMAT_MAP;
322
+ return o && o[t] && o[t][e] ? o[t][e] : ((a = window.DATE_FORMAT_MAP[t]) == null ? undefined : a[e]) || "YYYY-MM-DD";
266
323
  }
267
- var O = /*#__PURE__*/function () {
268
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(t) {
269
- var a, e, _t;
270
- return _regenerator().w(function (_context2) {
271
- while (1) switch (_context2.p = _context2.n) {
272
- case 0:
273
- a = g[t] || g["zh-CN"];
274
- _context2.p = 1;
275
- _context2.n = 2;
276
- return a.ant();
277
- case 2:
278
- e = _context2.v;
279
- _context2.n = 3;
280
- return a.dayjs();
281
- case 3:
282
- return _context2.a(2, e["default"]);
283
- case 4:
284
- _context2.p = 4;
285
- _t = _context2.v;
286
- console.warn("\u672A\u627E\u5230\u5BF9\u5E94\u7684\u8BED\u8A00\u5305: ".concat(_t));
287
- case 5:
288
- return _context2.a(2);
289
- }
290
- }, _callee2, null, [[1, 4]]);
291
- }));
292
- return function O(_x2) {
293
- return _ref2.apply(this, arguments);
294
- };
295
- }();
296
- exports.currentLang = c;
324
+ var Y = /*#__PURE__*/function () {
325
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(t) {
326
+ var e, o, _t2;
327
+ return _regenerator().w(function (_context3) {
328
+ while (1) switch (_context3.p = _context3.n) {
329
+ case 0:
330
+ e = y[t] || y["zh-CN"];
331
+ _context3.p = 1;
332
+ _context3.n = 2;
333
+ return e.ant();
334
+ case 2:
335
+ o = _context3.v;
336
+ _context3.n = 3;
337
+ return e.dayjs();
338
+ case 3:
339
+ return _context3.a(2, o["default"]);
340
+ case 4:
341
+ _context3.p = 4;
342
+ _t2 = _context3.v;
343
+ console.warn("\u672A\u627E\u5230\u5BF9\u5E94\u7684\u8BED\u8A00\u5305: ".concat(_t2));
344
+ case 5:
345
+ return _context3.a(2);
346
+ }
347
+ }, _callee3, null, [[1, 4]]);
348
+ }));
349
+ return function Y(_x4) {
350
+ return _ref6.apply(this, arguments);
351
+ };
352
+ }(),
353
+ K = /*#__PURE__*/function () {
354
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
355
+ var t,
356
+ e,
357
+ o,
358
+ _args4 = arguments,
359
+ _t3;
360
+ return _regenerator().w(function (_context4) {
361
+ while (1) switch (_context4.p = _context4.n) {
362
+ case 0:
363
+ t = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : [];
364
+ e = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : "zh-CN";
365
+ _context4.p = 1;
366
+ _context4.n = 2;
367
+ return U(t, e);
368
+ case 2:
369
+ o = _context4.v;
370
+ o != null && o.frontEnd && _typeof(o.frontEnd) == "object" && Object.keys(o.frontEnd).length && t.forEach(function (a) {
371
+ o.frontEnd[a] && _typeof(o.frontEnd[a]) == "object" && Object.keys(o.frontEnd[a]).length ? w(_defineProperty({}, e, o.frontEnd[a])) : console.warn("No front-end i18n data found for app: ".concat(a));
372
+ }), o != null && o.dasUiEnd && _typeof(o.dasUiEnd) == "object" && Object.keys(o.dasUiEnd).length && w(_defineProperty({}, e, o.dasUiEnd)), v(e);
373
+ _context4.n = 4;
374
+ break;
375
+ case 3:
376
+ _context4.p = 3;
377
+ _t3 = _context4.v;
378
+ console.error("registerMicroI18nData error:", _t3);
379
+ case 4:
380
+ return _context4.a(2);
381
+ }
382
+ }, _callee4, null, [[1, 3]]);
383
+ }));
384
+ return function K() {
385
+ return _ref7.apply(this, arguments);
386
+ };
387
+ }();
388
+ exports.currentLang = f;
297
389
  exports.customLangeData = i;
298
- exports.getDateFormat = x;
299
- exports.getI18nRule = A;
300
- exports.getLang = _;
301
- exports.i18n = I;
302
- exports.initI18n = R;
303
- exports.languageKey = D;
304
- exports.loadLocale = O;
305
- exports.setI18nRule = b;
306
- exports.setLang = T;
307
- exports.setLangRule = M;
308
- exports.t = N;
390
+ exports.getDateFormat = G;
391
+ exports.getI18nRule = R;
392
+ exports.getLang = $;
393
+ exports.i18n = k;
394
+ exports.initI18n = B;
395
+ exports.languageKey = C;
396
+ exports.loadLocale = Y;
397
+ exports.microI18nStore = x;
398
+ exports.registerMicroI18nData = K;
399
+ exports.setI18nRule = A;
400
+ exports.setLang = v;
401
+ exports.setLangRule = w;
402
+ exports.t = F;