@das-fed/upf-web 6.4.0-hot.6 → 6.4.0-hot.8

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.
Files changed (42) hide show
  1. package/es5.js +17640 -788
  2. package/esm-map.json +4 -1
  3. package/index-BfS5ZwdE.js +12613 -0
  4. package/index-BfS5ZwdE.js.gz +0 -0
  5. package/{packages/main-app-framework/index-C8tjINrY.js → index-C8iGOlyv.js} +1 -1
  6. package/index-DfI-VZvq.js +93 -0
  7. package/index-DfI-VZvq.js.gz +0 -0
  8. package/index.js +18 -16
  9. package/package.json +7 -6
  10. package/packages/create-das-web-app/es5.js +138 -254
  11. package/packages/create-das-web-app/index.js +67 -122
  12. package/packages/create-das-web-app/index.js.gz +0 -0
  13. package/packages/i18n/es5.js +206 -114
  14. package/packages/i18n/index.js +99 -60
  15. package/packages/i18n/index.js.gz +0 -0
  16. package/packages/main-app-framework/es5.js +14782 -785
  17. package/{index-CihmHNMg.js → packages/main-app-framework/index-4P5L5Fln.js} +1 -1
  18. package/packages/main-app-framework/index-BZpwzi0c.js +93 -0
  19. package/packages/main-app-framework/index-BZpwzi0c.js.gz +0 -0
  20. package/packages/main-app-framework/index-BfSkRApB.js +11147 -0
  21. package/packages/main-app-framework/index-BfSkRApB.js.gz +0 -0
  22. package/packages/main-app-framework/index.js +1 -1
  23. package/packages/main-app-framework/style.css +1 -1
  24. package/packages/main-app-framework/style.css.gz +0 -0
  25. package/style.css +1 -1
  26. package/style.css.gz +0 -0
  27. package/types/i18n/{microI18n.d.ts → getMicroI18nData.d.ts} +1 -2
  28. package/types/i18n/index.d.ts +3 -1
  29. package/types/main-app-framework/init-config/index.d.ts +0 -1
  30. package/types/main-app-framework/init-mframe/hooks/business/use-iot-hooks.d.ts +3 -0
  31. package/types/main-app-framework/init-mframe/hooks/use-layout.d.ts +1 -0
  32. package/types/main-app-framework/init-mframe/index.d.ts +1 -0
  33. package/index-BhEtGWg9.js +0 -87
  34. package/index-BhEtGWg9.js.gz +0 -0
  35. package/index-ClQkHyu0.js +0 -13991
  36. package/index-ClQkHyu0.js.gz +0 -0
  37. package/packages/main-app-framework/index-BotXvTrW.js +0 -87
  38. package/packages/main-app-framework/index-BotXvTrW.js.gz +0 -0
  39. package/packages/main-app-framework/index-qZN6TvxI.js +0 -12524
  40. package/packages/main-app-framework/index-qZN6TvxI.js.gz +0 -0
  41. package/types/main-app-framework/init-config/get-project-config/api.d.ts +0 -5
  42. package/types/main-app-framework/init-config/get-project-config/index.d.ts +0 -1
@@ -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 D } from "pinia";
5
+ import M from "pinia-plugin-persistedstate";
6
+ import { createRouter as C, 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 = D();
17
+ b.use(M);
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 = C({ 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.lang) || 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,162 @@
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, n) {
18
+ return !!(this.loaded[t] && this.loaded[t][n]);
19
+ },
20
+ markLoaded: function markLoaded(t, n) {
21
+ this.loaded[t] || (this.loaded[t] = {}), this.loaded[t][n] = true;
22
+ },
23
+ markUnloaded: function markUnloaded(t, n) {
24
+ this.loaded[t] && (delete this.loaded[t][n], 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, n) {
29
+ var _ref2, _ref3, _ref4;
30
+ var m, u, g, o, a, s, e, 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, e = (_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: n,
41
+ appName: t,
42
+ isPullBack: s,
43
+ fallbackBaseUrl: "/",
44
+ isDasUI: e
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, "lang") || "",
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 n = arguments.length > 1 ? arguments[1] : undefined;
83
+ var o = n === "global",
84
+ a = !o,
85
+ s = {};
86
+ for (var e in t) for (var r in t[e]) {
87
+ var _t$e$r;
88
+ s[r] || (s[r] = {}), s[r][e] = (_t$e$r = t[e][r]) !== null && _t$e$r !== void 0 ? _t$e$r : "", o && (c[r] || (c[r] = {}), c[r][e] = s[r][e]), a && (i[r] || (i[r] = {}), i[r][e] = s[r][e]);
33
89
  }
34
- console.log("customLangeData===注入", l), console.log("globalLangeData===注入", i);
35
90
  },
36
- y = function y() {
91
+ A = function A() {
37
92
  var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
38
- var a = arguments.length > 1 ? arguments[1] : undefined;
93
+ var n = arguments.length > 1 ? arguments[1] : undefined;
39
94
  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]);
95
+ var o = n === "global",
96
+ a = !o;
97
+ for (var e in t) if (o && !c[e] && (c[e] = t[e]), a) {
98
+ var r = (s = t[e]) != null && s._appCode ? t[e]._appCode.toLowerCase() : "";
99
+ r && (d[r] || (d[r] = {}), d[r][e] = t[e]), i[e] || (i[e] = t[e]);
45
100
  }
46
101
  },
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) {
102
+ B = /*#__PURE__*/function () {
103
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(t) {
104
+ var n;
105
+ return _regenerator().w(function (_context2) {
106
+ while (1) switch (_context2.n) {
52
107
  case 0:
53
- p();
54
- a = window[b];
55
- a && y(a, "global");
108
+ E();
109
+ n = window[z];
110
+ n && A(n, "global");
56
111
  case 1:
57
- return _context.a(2);
112
+ return _context2.a(2);
58
113
  }
59
- }, _callee);
114
+ }, _callee2);
60
115
  }));
61
- return function R(_x) {
62
- return _ref.apply(this, arguments);
116
+ return function B(_x3) {
117
+ return _ref5.apply(this, arguments);
63
118
  };
64
119
  }(),
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() : "";
120
+ N = function N(t) {
121
+ var n = "";
122
+ var o = /\/([^\/]+)\/([^\/]+)\//,
123
+ a = t.match(o);
124
+ return a && a.length >= 3 && (n = a[1] + "/" + a[2]), n ? n.toLowerCase() : "";
70
125
  },
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];
126
+ R = function R(t) {
127
+ for (var _len = arguments.length, n = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
128
+ n[_key - 1] = arguments[_key];
74
129
  }
75
130
  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
131
+ var _d$framework, _d$o;
132
+ var o = N(location.pathname);
133
+ var a = (_d$framework = d.framework) !== null && _d$framework !== void 0 ? _d$framework : {},
134
+ s = (_d$o = d[o]) !== null && _d$o !== void 0 ? _d$o : {},
135
+ e = i[t] || c[t] || a[t] || s[t] || t;
136
+ if (e === t) return t;
137
+ typeof e == "string" && (e = {
138
+ "zh-CN": e
84
139
  });
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;
140
+ var r = e[f.value];
141
+ return f.value === "zh-CN" && e["zh-cn"] && !e["zh-CN"] && (r = e["zh-cn"]), n.map(function (m, u) {
142
+ r && (r = r.replace("$".concat(u), m));
143
+ }), r;
89
144
  });
90
145
  },
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];
146
+ k = R,
147
+ F = function F(t) {
148
+ for (var _len2 = arguments.length, n = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
149
+ n[_key2 - 1] = arguments[_key2];
95
150
  }
96
- return I.apply(void 0, [t].concat(a)).value;
151
+ return k.apply(void 0, [t].concat(n)).value;
97
152
  },
98
- T = function T(t) {
99
- c.value = t, console.log("currentLang.value===", c.value), p();
153
+ v = function v(t) {
154
+ f.value = t, E();
100
155
  },
101
- _ = function _() {
102
- return c;
156
+ $ = function $() {
157
+ return f;
103
158
  },
104
- u = {
159
+ y = {
105
160
  "en-US": {
106
161
  ant: function ant() {
107
162
  return Promise.resolve().then(function () {
@@ -259,50 +314,87 @@ var C = "language",
259
314
  }
260
315
  }
261
316
  };
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";
317
+ function G(t, n) {
318
+ var a;
319
+ var o = window.DATE_FORMAT_MAP;
320
+ return o && o[t] && o[t][n] ? o[t][n] : ((a = window.DATE_FORMAT_MAP[t]) == null ? undefined : a[n]) || "YYYY-MM-DD";
266
321
  }
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;
322
+ var Y = /*#__PURE__*/function () {
323
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(t) {
324
+ var n, o, _t2;
325
+ return _regenerator().w(function (_context3) {
326
+ while (1) switch (_context3.p = _context3.n) {
327
+ case 0:
328
+ n = y[t] || y["zh-CN"];
329
+ _context3.p = 1;
330
+ _context3.n = 2;
331
+ return n.ant();
332
+ case 2:
333
+ o = _context3.v;
334
+ _context3.n = 3;
335
+ return n.dayjs();
336
+ case 3:
337
+ return _context3.a(2, o["default"]);
338
+ case 4:
339
+ _context3.p = 4;
340
+ _t2 = _context3.v;
341
+ console.warn("\u672A\u627E\u5230\u5BF9\u5E94\u7684\u8BED\u8A00\u5305: ".concat(_t2));
342
+ case 5:
343
+ return _context3.a(2);
344
+ }
345
+ }, _callee3, null, [[1, 4]]);
346
+ }));
347
+ return function Y(_x4) {
348
+ return _ref6.apply(this, arguments);
349
+ };
350
+ }(),
351
+ K = /*#__PURE__*/function () {
352
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
353
+ var t,
354
+ n,
355
+ o,
356
+ _args4 = arguments,
357
+ _t3;
358
+ return _regenerator().w(function (_context4) {
359
+ while (1) switch (_context4.p = _context4.n) {
360
+ case 0:
361
+ t = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : [];
362
+ n = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : "zh-CN";
363
+ _context4.p = 1;
364
+ _context4.n = 2;
365
+ return U(t, n);
366
+ case 2:
367
+ o = _context4.v;
368
+ o != null && o.frontEnd && _typeof(o.frontEnd) == "object" && Object.keys(o.frontEnd).length && t.forEach(function (a) {
369
+ o.frontEnd[a] && _typeof(o.frontEnd[a]) == "object" && Object.keys(o.frontEnd[a]).length ? w(_defineProperty({}, n, o.frontEnd[a])) : console.warn("No front-end i18n data found for app: ".concat(a));
370
+ }), o != null && o.dasUiEnd && _typeof(o.dasUiEnd) == "object" && Object.keys(o.dasUiEnd).length && w(_defineProperty({}, n, o.dasUiEnd)), v(n);
371
+ _context4.n = 4;
372
+ break;
373
+ case 3:
374
+ _context4.p = 3;
375
+ _t3 = _context4.v;
376
+ console.error("registerMicroI18nData error:", _t3);
377
+ case 4:
378
+ return _context4.a(2);
379
+ }
380
+ }, _callee4, null, [[1, 3]]);
381
+ }));
382
+ return function K() {
383
+ return _ref7.apply(this, arguments);
384
+ };
385
+ }();
386
+ exports.currentLang = f;
387
+ exports.customLangeData = i;
388
+ exports.getDateFormat = G;
389
+ exports.getI18nRule = R;
390
+ exports.getLang = $;
391
+ exports.i18n = k;
392
+ exports.initI18n = B;
303
393
  exports.languageKey = C;
304
- exports.loadLocale = O;
305
- exports.setI18nRule = y;
306
- exports.setLang = T;
307
- exports.setLangRule = M;
308
- exports.t = N;
394
+ exports.loadLocale = Y;
395
+ exports.microI18nStore = x;
396
+ exports.registerMicroI18nData = K;
397
+ exports.setI18nRule = A;
398
+ exports.setLang = v;
399
+ exports.setLangRule = w;
400
+ exports.t = F;