@das-fed/upf-web 6.4.0-hot.6 → 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,141 +1,86 @@
1
- import { reactive as U, ref as D, createApp as B } from "vue";
2
- import { initTheme as W } from "@das-fed/upf-web/packages/theme/index";
3
- import { DasWebLayout as C } from "@das-fed/upf-web/packages/layout/index";
4
- import { createPinia as M } from "pinia";
5
- import S from "pinia-plugin-persistedstate";
6
- import { createRouter as z, createWebHistory as G } from "vue-router";
7
- import { getUrlParams as H, handleI18nData as K } from "@das-fed/upf-utils/common-tools";
8
- import { getConfig as q } from "@das-fed/upf-utils/config";
9
- const F = {
10
- install: (e, t) => {
11
- var c;
12
- const r = (c = t == null ? void 0 : t.plugins) == null ? void 0 : c.glob;
13
- r && Object.values(r).sort((a, o) => (a.index ?? 0) - (o.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);
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";
8
+ const q = {
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
- }, L = M();
18
- L.use(S);
19
- const N = "language", p = U({}), A = U({});
20
- U({});
21
- const T = H(location.href, "uiCulture") || "", J = T || window.localStorage.getItem(N) || window.navigator.language || "zh-CN", R = D(J), Q = () => {
22
- const e = document.documentElement;
23
- e && e.setAttribute("lang", R.value);
24
- }, $ = (e = {}, t) => {
25
- const r = t === "global", c = !r;
26
- console.log("setLangRule===", e, t);
27
- const a = {};
28
- for (const o in e)
29
- for (const n in e[o])
30
- a[n] || (a[n] = {}), a[n][o] = e[o][n] ?? "", r && (A[n] || (A[n] = {}), A[n][o] = a[n][o]), c && (p[n] || (p[n] = {}, console.log(`${p[n]}为空,重新设置为{}`)), p[n][o] = a[n][o]);
31
- console.log("customLangeData===注入", p), console.log("globalLangeData===注入", A);
32
- }, V = (e) => {
33
- R.value = e, console.log("currentLang.value===", R.value), Q();
34
- }, X = {
35
- loaded: {},
36
- isLoaded(e, t) {
37
- return !!(this.loaded[e] && this.loaded[e][t]);
38
- },
39
- markLoaded(e, t) {
40
- this.loaded[e] || (this.loaded[e] = {}), this.loaded[e][t] = !0;
41
- },
42
- markUnloaded(e, t) {
43
- this.loaded[e] && (delete this.loaded[e][t], Object.keys(this.loaded[e]).length === 0 && delete this.loaded[e]);
44
- }
45
- }, Y = async (e, t) => {
46
- var f, b, d;
47
- const r = q() || {}, c = ((f = r.i18n) == null ? void 0 : f.fromOss) ?? !0, a = ((b = r.i18n) == null ? void 0 : b.isPullBack) ?? !1, o = ((d = r.i18n) == null ? void 0 : d.isDasUI) ?? !0;
48
- let n = "/oss/resource/";
49
- try {
50
- const i = await K({
51
- baseUrl: c ? n : "/",
52
- currentLang: t,
53
- appName: e,
54
- isPullBack: a,
55
- fallbackBaseUrl: "/",
56
- isDasUI: o
57
- });
58
- if (!i || !(i != null && i.frontEnd))
59
- throw new Error("Failed to fetch i18n data");
60
- return i;
61
- } catch (w) {
62
- throw new Error(`registerResources error: ${w}`);
63
- }
64
- }, Z = async (e = [], t = "zh-CN") => {
65
- try {
66
- const r = await Y(e, t);
67
- r != null && r.frontEnd && typeof r.frontEnd == "object" && Object.keys(r.frontEnd).length && e.forEach((c) => {
68
- r.frontEnd[c] && typeof r.frontEnd[c] == "object" && Object.keys(r.frontEnd[c]).length ? $({ [t]: r.frontEnd[c] }, "global") : console.warn(`No front-end i18n data found for app: ${c}`);
69
- }), r != null && r.dasUiEnd && typeof r.dasUiEnd == "object" && Object.keys(r.dasUiEnd).length && $({ [t]: r.dasUiEnd }), V(t);
70
- } catch (r) {
71
- console.error("registerMicroI18nData error:", r);
72
- }
73
- }, _ = (e) => {
74
- var w, E, i, j, O;
75
- const t = ((w = e == null ? void 0 : e.router) == null ? void 0 : w.routerBase) ?? "/", r = ((E = e == null ? void 0 : e.router) == null ? void 0 : E.options) || {};
76
- let c = Object.assign(((i = e == null ? void 0 : e.router) == null ? void 0 : i.glob) || {});
77
- const a = Object.values(c).filter((u) => !!u).flat().sort((u, l) => (u.index ?? 0) - (l.index ?? 0)), o = [];
78
- (j = e == null ? void 0 : e.microApps) == null || j.map((u) => {
79
- var k;
80
- const l = Object.values(((k = u.router) == null ? void 0 : k.glob) || {}).filter((s) => !!s).flat().sort((s, y) => (s.index ?? 0) - (y.index ?? 0));
81
- o.push(
82
- ...l.map((s) => ({ ...s, path: `/${u.microAppName}${s.path}` }))
83
- ), o.push(
84
- ...l.filter((s) => !!s.path).filter((s) => s.path !== "").filter((s) => s.path !== "/").filter((s) => !s.path.startsWith(`/${s.microAppName}`)).map((s) => ({
85
- path: s.path,
86
- redirect: `/${u.microAppName}${s.path}`,
87
- 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 }
88
33
  }))
89
34
  );
90
35
  });
91
- const n = ((O = e == null ? void 0 : e.router) == null ? void 0 : O.routers) || [], f = [
92
- ...v(a, e),
93
- ...v(n, e),
94
- ...v(o, e)
95
- ], b = z({ history: G(t), routes: f, ...r }), d = X;
96
- if (Array.isArray(e == null ? void 0 : e.microApps) && e.microApps.length && d) {
97
- const u = /* @__PURE__ */ new Map();
98
- for (const l of e.microApps)
99
- l != null && l.microAppName && (l != null && l.i18n) && u.set(l.microAppName, l.i18n);
100
- b.beforeEach(async (l, k, s) => {
101
- 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;
102
47
  try {
103
- const g = ((y = l.query) == null ? void 0 : y.uiCulture) || window.localStorage.getItem(N) || window.navigator.language || "zh-CN", I = l.path || "";
104
- for (const [h, m] of u.entries()) {
105
- if (!h || !I.toLowerCase().startsWith(`/${h.toLowerCase()}`)) continue;
106
- if (d.isLoaded(g, h) || !m || !(m != null && m.length)) break;
107
- const P = typeof m == "string" ? [m] : m;
108
- d.markLoaded(g, h);
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);
109
54
  try {
110
- await Z(P, g);
111
- } catch (x) {
112
- d.markUnloaded(g, h), console.error(`[initRouter] load micro app i18n failed for ${h}:`, x);
55
+ await B(L, s);
56
+ } catch (N) {
57
+ p.markUnloaded(s, o), console.error(`[initRouter] load micro app i18n failed for ${o}:`, N);
113
58
  }
114
59
  break;
115
60
  }
116
- } catch (g) {
117
- console.error("[initRouter] microApps i18n beforeEach handler error:", g);
61
+ } catch (s) {
62
+ console.error("[initRouter] microApps i18n beforeEach handler error:", s);
118
63
  } finally {
119
- s();
64
+ r();
120
65
  }
121
66
  });
122
67
  }
123
- return { router: b };
124
- }, v = (e, t) => e.map((r) => {
125
- const c = r.meta || {};
126
- return c.keepAlive = c.keepAlive ?? (t == null ? void 0 : t.keepAlive) ?? !0, { ...r, meta: c };
127
- }), le = (e) => {
128
- 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;
129
74
  e || (e = {});
130
- const t = D(!0);
131
- Promise.all([W(e)]).then(() => {
132
- t.value = !1;
75
+ const u = W(!0);
76
+ Promise.all([P(e)]).then(() => {
77
+ u.value = !1;
133
78
  });
134
- const { container: r, component: c, props: a } = (e == null ? void 0 : e.root) || {}, o = B(c || C, a);
135
- o.use(F, e), o.use(L);
136
- const { router: n } = _(e);
137
- return o.use(n), o.mount(r || "#app"), (f = window.top) != null && f.vueRouter || window.top && (window.top.vueRouter = n), { app: o, router: n, loading: t, store: L };
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 };
138
83
  };
139
84
  export {
140
- le as createDasWebApp
85
+ Q as createDasWebApp
141
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 C = "language",
12
- l = vue.reactive({}),
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",
13
69
  i = vue.reactive({}),
14
- m = vue.reactive({}),
15
- h = commonTools.getUrlParams(location.href, "uiCulture") || "",
16
- j = h || window.localStorage.getItem(C) || window.navigator.language || "zh-CN",
17
- c = vue.ref(j),
18
- b = "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 && (i[n] || (i[n] = {}), i[n][o] = s[n][o]), r && (l[n] || (l[n] = {}, console.log("".concat(l[n], "\u4E3A\u7A7A\uFF0C\u91CD\u65B0\u8BBE\u7F6E\u4E3A{}"))), l[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===注入", l), console.log("globalLangeData===注入", i);
90
+ console.log("注册customLangeData", i);
35
91
  },
36
- y = function y() {
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 && !i[o] && (i[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]), l[o] || (l[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[b];
55
- a && y(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 = l[t] || i[t] || r[t] || s[t] || t;
81
- if (o === t) return t;
82
- console.log("customLangeData===获取时", l, l[t]), console.log("globalLangeData===获取时", i, i[t]), 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
- u = {
161
+ y = {
105
162
  "en-US": {
106
163
  ant: function ant() {
107
164
  return Promise.resolve().then(function () {
@@ -259,50 +316,87 @@ var C = "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 = u[t] || u["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;
297
- exports.customLangeData = l;
298
- exports.getDateFormat = x;
299
- exports.getI18nRule = A;
300
- exports.getLang = _;
301
- exports.i18n = I;
302
- exports.initI18n = R;
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;
389
+ exports.customLangeData = i;
390
+ exports.getDateFormat = G;
391
+ exports.getI18nRule = R;
392
+ exports.getLang = $;
393
+ exports.i18n = k;
394
+ exports.initI18n = B;
303
395
  exports.languageKey = C;
304
- exports.loadLocale = O;
305
- exports.setI18nRule = y;
306
- exports.setLang = T;
307
- exports.setLangRule = M;
308
- exports.t = N;
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;