mooho-base-admin-plus 0.4.1 → 0.4.2

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.
@@ -6799,15 +6799,15 @@ var LocalStorage = function(_Base) {
6799
6799
  }(Base);
6800
6800
  var LocalStorage_1 = LocalStorage;
6801
6801
  const adapter = new LocalStorage_1(`admin-plus-${Setting.appID}`);
6802
- const db$2 = main(adapter);
6803
- db$2.defaults({
6802
+ const db$1 = main(adapter);
6803
+ db$1.defaults({
6804
6804
  sys: {},
6805
6805
  database: {}
6806
6806
  }).write();
6807
6807
  const util$2 = {
6808
6808
  cookies: cookies$2,
6809
6809
  log: log$2,
6810
- db: db$2
6810
+ db: db$1
6811
6811
  };
6812
6812
  function tTitle$1(title = "") {
6813
6813
  const $t = window ? window.$app.$t : null;
@@ -12694,7 +12694,7 @@ var match = {
12694
12694
  })
12695
12695
  };
12696
12696
  var match$1 = match;
12697
- var locale$1 = {
12697
+ var locale = {
12698
12698
  code: "en-US",
12699
12699
  formatDistance: formatDistance$1,
12700
12700
  formatLong: formatLong$1,
@@ -12706,7 +12706,7 @@ var locale$1 = {
12706
12706
  firstWeekContainsDate: 1
12707
12707
  }
12708
12708
  };
12709
- var defaultLocale = locale$1;
12709
+ var defaultLocale = locale;
12710
12710
  function toInteger(dirtyNumber) {
12711
12711
  if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
12712
12712
  return NaN;
@@ -14310,7 +14310,7 @@ function pathInit({ dbName = "database", path = "", user: user2 = true, validato
14310
14310
  }
14311
14311
  return currentPath;
14312
14312
  }
14313
- var db$1 = {
14313
+ var db = {
14314
14314
  namespaced: true,
14315
14315
  actions: {
14316
14316
  set(context, { dbName = "database", path = "", value = "", user: user2 = false }) {
@@ -14409,7 +14409,7 @@ var db$1 = {
14409
14409
  var __glob_0_3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
14410
14410
  __proto__: null,
14411
14411
  pathInit,
14412
- "default": db$1
14412
+ "default": db
14413
14413
  }, Symbol.toStringTag, { value: "Module" }));
14414
14414
  const e$1 = typeof window != "undefined";
14415
14415
  function n(i2) {
@@ -17812,32 +17812,10 @@ vueI18n_cjs_prod.vTDirective = vTDirective;
17812
17812
  {
17813
17813
  vueI18n.exports = vueI18n_cjs_prod;
17814
17814
  }
17815
- const savedLocaleKey$1 = "i18n-locale";
17816
- let locale;
17817
- const db = util$2.db.get(pathInit({
17818
- dbName: "database",
17819
- path: "",
17820
- user: false,
17821
- defaultValue: {}
17822
- }));
17823
- const savedLocale = db.get(savedLocaleKey$1).value();
17824
- console.log("savedLocale", savedLocale);
17825
- if (savedLocale) {
17826
- locale = savedLocale;
17827
- } else {
17828
- if (Setting.i18n.auto) {
17829
- const navLang = navigator.language;
17830
- locale = navLang;
17831
- } else {
17832
- locale = Setting.i18n.default;
17833
- }
17834
- db.set(savedLocaleKey$1, locale).write();
17835
- }
17836
17815
  var i18n$1 = vueI18n.exports.createI18n({
17837
17816
  allowComposition: true,
17838
17817
  globalInjection: true,
17839
- legacy: false,
17840
- locale
17818
+ legacy: false
17841
17819
  });
17842
17820
  const res$k = "I18nText";
17843
17821
  var i18nTextApi = {
@@ -17895,14 +17873,32 @@ var i18n = {
17895
17873
  });
17896
17874
  }
17897
17875
  },
17898
- async load({ state }) {
17876
+ async load({ state }, app) {
17877
+ let locale2;
17899
17878
  const db2 = util$2.db.get(pathInit({
17900
17879
  dbName: "database",
17901
17880
  path: "",
17902
17881
  user: false,
17903
17882
  defaultValue: {}
17904
17883
  }));
17905
- state.locale = db2.get(savedLocaleKey).value();
17884
+ const savedLocale = db2.get(savedLocaleKey).value();
17885
+ if (savedLocale) {
17886
+ locale2 = savedLocale;
17887
+ } else {
17888
+ if (Setting.i18n.auto) {
17889
+ const navLang = navigator.language;
17890
+ if (state.languages[navLang]) {
17891
+ locale2 = navLang;
17892
+ } else {
17893
+ locale2 = Setting.i18n.default;
17894
+ }
17895
+ } else {
17896
+ locale2 = Setting.i18n.default;
17897
+ }
17898
+ db2.set(savedLocaleKey, locale2).write();
17899
+ }
17900
+ state.locale = locale2;
17901
+ app.config.globalProperties.$i18n.locale = locale2;
17906
17902
  const ViewUIPlusLocale = { "../../../../i18n/locale/en-US.js": __glob_5_0, "../../../../i18n/locale/zh-CN.js": __glob_5_1 };
17907
17903
  let res2 = await i18nTextApi.getAll();
17908
17904
  state.languages = {};
@@ -120840,8 +120836,8 @@ const pages = {};
120840
120836
  Object.keys(files).forEach((key) => {
120841
120837
  pages[key.replace(/(\.\/pages\/)/g, "")] = files[key].default;
120842
120838
  });
120843
- const created = async () => {
120844
- await store.dispatch("admin/i18n/load");
120839
+ const created = async (app) => {
120840
+ await store.dispatch("admin/i18n/load", app);
120845
120841
  store.commit("admin/menu/setHeader", menuHeader);
120846
120842
  store.dispatch("admin/account/load");
120847
120843
  store.dispatch("admin/layout/listenFullscreen");