ebuilds-shared 0.1.8 → 0.1.9

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.
@@ -6301,25 +6301,32 @@ var useCommonStore = _pinia.defineStore.call(void 0, "common", {
6301
6301
  */
6302
6302
  async loadConfig() {
6303
6303
  if (this.version) return;
6304
- const { data } = await _axios2.default.get(this.getPublicUrl + "/config/config.json", {
6305
- params: { _t: Date.now() }
6306
- });
6307
- for (const key in data) {
6308
- key in this && (this[key] = data[key]);
6309
- }
6310
- const dbStore = useDbStore();
6311
- const db = dbStore.getDb();
6312
- const { common } = db.stores();
6313
- const id = "common";
6314
- let info = await common.get(id);
6315
- if (!info) {
6316
- await common.add({ id, ...data });
6317
- info = await common.get(id);
6318
- await this.loadUpdateLog();
6319
- }
6320
- if (data.version !== info.version) {
6321
- await this.loadUpdateLog();
6322
- await common.set({ id, ...data });
6304
+ if (window.microApp) {
6305
+ const data = window.microApp.getData();
6306
+ if (data.commonState) {
6307
+ this.$patch(data.commonState);
6308
+ }
6309
+ } else {
6310
+ const { data } = await _axios2.default.get(this.getPublicUrl + "/config/config.json", {
6311
+ params: { _t: Date.now() }
6312
+ });
6313
+ for (const key in data) {
6314
+ key in this && (this[key] = data[key]);
6315
+ }
6316
+ const dbStore = useDbStore();
6317
+ const db = dbStore.getDb();
6318
+ const { common } = db.stores();
6319
+ const id = "common";
6320
+ let info = await common.get(id);
6321
+ if (!info) {
6322
+ await common.add({ id, ...data });
6323
+ info = await common.get(id);
6324
+ await this.loadUpdateLog();
6325
+ }
6326
+ if (data.version !== info.version) {
6327
+ await this.loadUpdateLog();
6328
+ await common.set({ id, ...data });
6329
+ }
6323
6330
  }
6324
6331
  },
6325
6332
  /**
@@ -6835,9 +6842,6 @@ var useMenuStore = _pinia.defineStore.call(void 0, "menu", {
6835
6842
  const data = window.microApp.getData();
6836
6843
  routeData = data.menuData || [];
6837
6844
  defaultPath = data.defaultPath || "";
6838
- if (data.themeColor) {
6839
- useCommonStore().themeColor = data.themeColor;
6840
- }
6841
6845
  }
6842
6846
  this.menuList = routeData;
6843
6847
  const validRoutes = handleRoutes(routeData, pages);
@@ -6851,7 +6855,9 @@ var useMenuStore = _pinia.defineStore.call(void 0, "menu", {
6851
6855
  });
6852
6856
  this.hasGetMenuList = true;
6853
6857
  if (defaultPath) {
6854
- router.push(defaultPath);
6858
+ setTimeout(() => {
6859
+ router.push(defaultPath);
6860
+ }, 100);
6855
6861
  }
6856
6862
  }
6857
6863
  }
@@ -6301,25 +6301,32 @@ var useCommonStore = defineStore2("common", {
6301
6301
  */
6302
6302
  async loadConfig() {
6303
6303
  if (this.version) return;
6304
- const { data } = await axios.get(this.getPublicUrl + "/config/config.json", {
6305
- params: { _t: Date.now() }
6306
- });
6307
- for (const key in data) {
6308
- key in this && (this[key] = data[key]);
6309
- }
6310
- const dbStore = useDbStore();
6311
- const db = dbStore.getDb();
6312
- const { common } = db.stores();
6313
- const id = "common";
6314
- let info = await common.get(id);
6315
- if (!info) {
6316
- await common.add({ id, ...data });
6317
- info = await common.get(id);
6318
- await this.loadUpdateLog();
6319
- }
6320
- if (data.version !== info.version) {
6321
- await this.loadUpdateLog();
6322
- await common.set({ id, ...data });
6304
+ if (window.microApp) {
6305
+ const data = window.microApp.getData();
6306
+ if (data.commonState) {
6307
+ this.$patch(data.commonState);
6308
+ }
6309
+ } else {
6310
+ const { data } = await axios.get(this.getPublicUrl + "/config/config.json", {
6311
+ params: { _t: Date.now() }
6312
+ });
6313
+ for (const key in data) {
6314
+ key in this && (this[key] = data[key]);
6315
+ }
6316
+ const dbStore = useDbStore();
6317
+ const db = dbStore.getDb();
6318
+ const { common } = db.stores();
6319
+ const id = "common";
6320
+ let info = await common.get(id);
6321
+ if (!info) {
6322
+ await common.add({ id, ...data });
6323
+ info = await common.get(id);
6324
+ await this.loadUpdateLog();
6325
+ }
6326
+ if (data.version !== info.version) {
6327
+ await this.loadUpdateLog();
6328
+ await common.set({ id, ...data });
6329
+ }
6323
6330
  }
6324
6331
  },
6325
6332
  /**
@@ -6835,9 +6842,6 @@ var useMenuStore = defineStore3("menu", {
6835
6842
  const data = window.microApp.getData();
6836
6843
  routeData = data.menuData || [];
6837
6844
  defaultPath = data.defaultPath || "";
6838
- if (data.themeColor) {
6839
- useCommonStore().themeColor = data.themeColor;
6840
- }
6841
6845
  }
6842
6846
  this.menuList = routeData;
6843
6847
  const validRoutes = handleRoutes(routeData, pages);
@@ -6851,7 +6855,9 @@ var useMenuStore = defineStore3("menu", {
6851
6855
  });
6852
6856
  this.hasGetMenuList = true;
6853
6857
  if (defaultPath) {
6854
- router.push(defaultPath);
6858
+ setTimeout(() => {
6859
+ router.push(defaultPath);
6860
+ }, 100);
6855
6861
  }
6856
6862
  }
6857
6863
  }
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ var _chunkZIUN3ZQAjs = require('./chunk-ZIUN3ZQA.js');
29
29
 
30
30
 
31
31
 
32
- var _chunk7KNYDZK3js = require('./chunk-7KNYDZK3.js');
32
+ var _chunk3YLIJGC3js = require('./chunk-3YLIJGC3.js');
33
33
 
34
34
 
35
35
  var _chunk3UCTPVIZjs = require('./chunk-3UCTPVIZ.js');
@@ -64,4 +64,4 @@ require('./chunk-QGM4M3NI.js');
64
64
 
65
65
 
66
66
 
67
- exports.clamp = _chunk7KNYDZK3js.clamp; exports.createBaseViteConfig = _chunk3UCTPVIZjs.createBaseViteConfig; exports.createFunctionalComponent = _chunk7KNYDZK3js.createFunctionalComponent; exports.createUnoConfig = _chunkZIUN3ZQAjs.createUnoConfig; exports.duplicateRemovalCompleteSort = _chunk7KNYDZK3js.duplicateRemovalCompleteSort; exports.encryptPwd = _chunk7KNYDZK3js.encryptPwd; exports.filterMenu = _chunk7KNYDZK3js.filterMenu; exports.formatNumber = _chunk7KNYDZK3js.formatNumber; exports.getDecimalPart = _chunk7KNYDZK3js.getDecimalPart; exports.getIntegerPart = _chunk7KNYDZK3js.getIntegerPart; exports.isInteger = _chunk7KNYDZK3js.isInteger; exports.isNumber = _chunk7KNYDZK3js.isNumber; exports.jsonp = _chunk7KNYDZK3js.jsonp; exports.listSort = _chunk7KNYDZK3js.listSort; exports.numberToChinese = _chunk7KNYDZK3js.numberToChinese; exports.padZero = _chunk7KNYDZK3js.padZero; exports.parseFormattedNumber = _chunk7KNYDZK3js.parseFormattedNumber; exports.prototypeInterceptor = _chunk7KNYDZK3js.prototypeInterceptor; exports.request = _chunk7KNYDZK3js.request; exports.roundOrTruncate = _chunk7KNYDZK3js.roundOrTruncate; exports.setupPermission = _chunk7KNYDZK3js.setupPermission; exports.store = _chunk7KNYDZK3js.store; exports.timeFix = _chunk7KNYDZK3js.timeFix; exports.updateDocumentTitle = _chunk7KNYDZK3js.updateDocumentTitle; exports.useCommonStore = _chunk7KNYDZK3js.useCommonStore; exports.useDbStore = _chunk7KNYDZK3js.useDbStore; exports.useLoginHook = _chunk7KNYDZK3js.useLoginHook; exports.useMenuStore = _chunk7KNYDZK3js.useMenuStore; exports.welcome = _chunk7KNYDZK3js.welcome;
67
+ exports.clamp = _chunk3YLIJGC3js.clamp; exports.createBaseViteConfig = _chunk3UCTPVIZjs.createBaseViteConfig; exports.createFunctionalComponent = _chunk3YLIJGC3js.createFunctionalComponent; exports.createUnoConfig = _chunkZIUN3ZQAjs.createUnoConfig; exports.duplicateRemovalCompleteSort = _chunk3YLIJGC3js.duplicateRemovalCompleteSort; exports.encryptPwd = _chunk3YLIJGC3js.encryptPwd; exports.filterMenu = _chunk3YLIJGC3js.filterMenu; exports.formatNumber = _chunk3YLIJGC3js.formatNumber; exports.getDecimalPart = _chunk3YLIJGC3js.getDecimalPart; exports.getIntegerPart = _chunk3YLIJGC3js.getIntegerPart; exports.isInteger = _chunk3YLIJGC3js.isInteger; exports.isNumber = _chunk3YLIJGC3js.isNumber; exports.jsonp = _chunk3YLIJGC3js.jsonp; exports.listSort = _chunk3YLIJGC3js.listSort; exports.numberToChinese = _chunk3YLIJGC3js.numberToChinese; exports.padZero = _chunk3YLIJGC3js.padZero; exports.parseFormattedNumber = _chunk3YLIJGC3js.parseFormattedNumber; exports.prototypeInterceptor = _chunk3YLIJGC3js.prototypeInterceptor; exports.request = _chunk3YLIJGC3js.request; exports.roundOrTruncate = _chunk3YLIJGC3js.roundOrTruncate; exports.setupPermission = _chunk3YLIJGC3js.setupPermission; exports.store = _chunk3YLIJGC3js.store; exports.timeFix = _chunk3YLIJGC3js.timeFix; exports.updateDocumentTitle = _chunk3YLIJGC3js.updateDocumentTitle; exports.useCommonStore = _chunk3YLIJGC3js.useCommonStore; exports.useDbStore = _chunk3YLIJGC3js.useDbStore; exports.useLoginHook = _chunk3YLIJGC3js.useLoginHook; exports.useMenuStore = _chunk3YLIJGC3js.useMenuStore; exports.welcome = _chunk3YLIJGC3js.welcome;
package/dist/index.mjs CHANGED
@@ -29,7 +29,7 @@ import {
29
29
  useLoginHook,
30
30
  useMenuStore,
31
31
  welcome
32
- } from "./chunk-EJOG7JQT.mjs";
32
+ } from "./chunk-EHGI4SF7.mjs";
33
33
  import {
34
34
  createBaseViteConfig
35
35
  } from "./chunk-3GZJNH2K.mjs";
@@ -3,11 +3,11 @@
3
3
 
4
4
 
5
5
 
6
- var _chunk7KNYDZK3js = require('../chunk-7KNYDZK3.js');
6
+ var _chunk3YLIJGC3js = require('../chunk-3YLIJGC3.js');
7
7
  require('../chunk-QGM4M3NI.js');
8
8
 
9
9
 
10
10
 
11
11
 
12
12
 
13
- exports.store = _chunk7KNYDZK3js.store; exports.useCommonStore = _chunk7KNYDZK3js.useCommonStore; exports.useDbStore = _chunk7KNYDZK3js.useDbStore; exports.useMenuStore = _chunk7KNYDZK3js.useMenuStore;
13
+ exports.store = _chunk3YLIJGC3js.store; exports.useCommonStore = _chunk3YLIJGC3js.useCommonStore; exports.useDbStore = _chunk3YLIJGC3js.useDbStore; exports.useMenuStore = _chunk3YLIJGC3js.useMenuStore;
@@ -3,7 +3,7 @@ import {
3
3
  useCommonStore,
4
4
  useDbStore,
5
5
  useMenuStore
6
- } from "../chunk-EJOG7JQT.mjs";
6
+ } from "../chunk-EHGI4SF7.mjs";
7
7
  import "../chunk-6DZX6EAA.mjs";
8
8
  export {
9
9
  store,
@@ -22,7 +22,7 @@
22
22
 
23
23
 
24
24
 
25
- var _chunk7KNYDZK3js = require('../chunk-7KNYDZK3.js');
25
+ var _chunk3YLIJGC3js = require('../chunk-3YLIJGC3.js');
26
26
  require('../chunk-QGM4M3NI.js');
27
27
 
28
28
 
@@ -48,4 +48,4 @@ require('../chunk-QGM4M3NI.js');
48
48
 
49
49
 
50
50
 
51
- exports.clamp = _chunk7KNYDZK3js.clamp; exports.createFunctionalComponent = _chunk7KNYDZK3js.createFunctionalComponent; exports.duplicateRemovalCompleteSort = _chunk7KNYDZK3js.duplicateRemovalCompleteSort; exports.encryptPwd = _chunk7KNYDZK3js.encryptPwd; exports.filterMenu = _chunk7KNYDZK3js.filterMenu; exports.formatNumber = _chunk7KNYDZK3js.formatNumber; exports.getDecimalPart = _chunk7KNYDZK3js.getDecimalPart; exports.getIntegerPart = _chunk7KNYDZK3js.getIntegerPart; exports.isInteger = _chunk7KNYDZK3js.isInteger; exports.isNumber = _chunk7KNYDZK3js.isNumber; exports.jsonp = _chunk7KNYDZK3js.jsonp; exports.listSort = _chunk7KNYDZK3js.listSort; exports.numberToChinese = _chunk7KNYDZK3js.numberToChinese; exports.padZero = _chunk7KNYDZK3js.padZero; exports.parseFormattedNumber = _chunk7KNYDZK3js.parseFormattedNumber; exports.prototypeInterceptor = _chunk7KNYDZK3js.prototypeInterceptor; exports.request = _chunk7KNYDZK3js.request; exports.roundOrTruncate = _chunk7KNYDZK3js.roundOrTruncate; exports.setupPermission = _chunk7KNYDZK3js.setupPermission; exports.timeFix = _chunk7KNYDZK3js.timeFix; exports.updateDocumentTitle = _chunk7KNYDZK3js.updateDocumentTitle; exports.useLoginHook = _chunk7KNYDZK3js.useLoginHook; exports.welcome = _chunk7KNYDZK3js.welcome;
51
+ exports.clamp = _chunk3YLIJGC3js.clamp; exports.createFunctionalComponent = _chunk3YLIJGC3js.createFunctionalComponent; exports.duplicateRemovalCompleteSort = _chunk3YLIJGC3js.duplicateRemovalCompleteSort; exports.encryptPwd = _chunk3YLIJGC3js.encryptPwd; exports.filterMenu = _chunk3YLIJGC3js.filterMenu; exports.formatNumber = _chunk3YLIJGC3js.formatNumber; exports.getDecimalPart = _chunk3YLIJGC3js.getDecimalPart; exports.getIntegerPart = _chunk3YLIJGC3js.getIntegerPart; exports.isInteger = _chunk3YLIJGC3js.isInteger; exports.isNumber = _chunk3YLIJGC3js.isNumber; exports.jsonp = _chunk3YLIJGC3js.jsonp; exports.listSort = _chunk3YLIJGC3js.listSort; exports.numberToChinese = _chunk3YLIJGC3js.numberToChinese; exports.padZero = _chunk3YLIJGC3js.padZero; exports.parseFormattedNumber = _chunk3YLIJGC3js.parseFormattedNumber; exports.prototypeInterceptor = _chunk3YLIJGC3js.prototypeInterceptor; exports.request = _chunk3YLIJGC3js.request; exports.roundOrTruncate = _chunk3YLIJGC3js.roundOrTruncate; exports.setupPermission = _chunk3YLIJGC3js.setupPermission; exports.timeFix = _chunk3YLIJGC3js.timeFix; exports.updateDocumentTitle = _chunk3YLIJGC3js.updateDocumentTitle; exports.useLoginHook = _chunk3YLIJGC3js.useLoginHook; exports.welcome = _chunk3YLIJGC3js.welcome;
@@ -22,7 +22,7 @@ import {
22
22
  updateDocumentTitle,
23
23
  useLoginHook,
24
24
  welcome
25
- } from "../chunk-EJOG7JQT.mjs";
25
+ } from "../chunk-EHGI4SF7.mjs";
26
26
  import "../chunk-6DZX6EAA.mjs";
27
27
  export {
28
28
  clamp,
package/package.json CHANGED
@@ -1,83 +1,82 @@
1
- {
2
- "name": "ebuilds-shared",
3
- "publishConfig": {
4
- "access": "public"
5
- },
6
- "version": "0.1.8",
7
- "description": "共享工具库和类型定义",
8
- "author": "ebuilds",
9
- "license": "MIT",
10
- "keywords": [
11
- "shared",
12
- "utils",
13
- "vue",
14
- "pinia",
15
- "vite"
16
- ],
17
- "main": "dist/index.js",
18
- "module": "dist/index.mjs",
19
- "types": "dist/index.d.ts",
20
- "exports": {
21
- ".": {
22
- "default": "./dist/index.mjs",
23
- "import": "./dist/index.mjs",
24
- "require": "./dist/index.js",
25
- "types": "./dist/index.d.ts"
26
- },
27
- "./utils": {
28
- "default": "./dist/utils/index.mjs",
29
- "import": "./dist/utils/index.mjs",
30
- "require": "./dist/utils/index.js",
31
- "types": "./dist/utils/index.d.ts"
32
- },
33
- "./stores": {
34
- "default": "./dist/stores/index.mjs",
35
- "import": "./dist/stores/index.mjs",
36
- "require": "./dist/stores/index.js",
37
- "types": "./dist/stores/index.d.ts"
38
- },
39
- "./vite-config": {
40
- "default": "./dist/vite-config/index.mjs",
41
- "import": "./dist/vite-config/index.mjs",
42
- "require": "./dist/vite-config/index.js",
43
- "types": "./dist/vite-config/index.d.mts"
44
- },
45
- "./uno-config": {
46
- "default": "./dist/uno-config/index.mjs",
47
- "import": "./dist/uno-config/index.mjs",
48
- "require": "./dist/uno-config/index.js",
49
- "types": "./dist/uno-config/index.d.ts"
50
- },
51
- "./functionalComponent": {
52
- "default": "./dist/functionalComponent/index.mjs",
53
- "import": "./dist/functionalComponent/index.mjs",
54
- "require": "./dist/functionalComponent/index.js",
55
- "types": "./dist/functionalComponent/index.d.ts"
56
- },
57
- "./styles": "./dist/styles/index.css"
58
- },
59
- "files": [
60
- "dist"
61
- ],
62
- "scripts": {
63
- "build": "tsup --config tsup.config.ts",
64
- "build:icons": "ts-node src/utils/build-icons.ts",
65
- "dev": "tsup --config tsup.config.ts --watch",
66
- "lint": "eslint --quiet \"src/**/*.{ts,tsx}\"",
67
- "lint:fix": "eslint --quiet \"src/**/*.{ts,tsx}\" --fix",
68
- "pub": "npm publish"
69
- },
70
- "peerDependencies": {
71
- "pinia": "3.0.1"
72
- },
73
- "dependencies": {
74
- "axios": "^1.8.4",
75
- "jsencrypt": "^3.3.2",
76
- "svgo": "^4.0.0"
77
- },
78
- "devDependencies": {
79
- "@monorepo/ebuilds-ui": "workspace:*",
80
- "shx": "^0.4.0",
81
- "tsup": "^8.0.2"
82
- }
83
- }
1
+ {
2
+ "name": "ebuilds-shared",
3
+ "publishConfig": {
4
+ "access": "public"
5
+ },
6
+ "version": "0.1.9",
7
+ "description": "共享工具库和类型定义",
8
+ "author": "ebuilds",
9
+ "license": "MIT",
10
+ "keywords": [
11
+ "shared",
12
+ "utils",
13
+ "vue",
14
+ "pinia",
15
+ "vite"
16
+ ],
17
+ "main": "dist/index.js",
18
+ "module": "dist/index.mjs",
19
+ "types": "dist/index.d.ts",
20
+ "exports": {
21
+ ".": {
22
+ "default": "./dist/index.mjs",
23
+ "import": "./dist/index.mjs",
24
+ "require": "./dist/index.js",
25
+ "types": "./dist/index.d.ts"
26
+ },
27
+ "./utils": {
28
+ "default": "./dist/utils/index.mjs",
29
+ "import": "./dist/utils/index.mjs",
30
+ "require": "./dist/utils/index.js",
31
+ "types": "./dist/utils/index.d.ts"
32
+ },
33
+ "./stores": {
34
+ "default": "./dist/stores/index.mjs",
35
+ "import": "./dist/stores/index.mjs",
36
+ "require": "./dist/stores/index.js",
37
+ "types": "./dist/stores/index.d.ts"
38
+ },
39
+ "./vite-config": {
40
+ "default": "./dist/vite-config/index.mjs",
41
+ "import": "./dist/vite-config/index.mjs",
42
+ "require": "./dist/vite-config/index.js",
43
+ "types": "./dist/vite-config/index.d.mts"
44
+ },
45
+ "./uno-config": {
46
+ "default": "./dist/uno-config/index.mjs",
47
+ "import": "./dist/uno-config/index.mjs",
48
+ "require": "./dist/uno-config/index.js",
49
+ "types": "./dist/uno-config/index.d.ts"
50
+ },
51
+ "./functionalComponent": {
52
+ "default": "./dist/functionalComponent/index.mjs",
53
+ "import": "./dist/functionalComponent/index.mjs",
54
+ "require": "./dist/functionalComponent/index.js",
55
+ "types": "./dist/functionalComponent/index.d.ts"
56
+ },
57
+ "./styles": "./dist/styles/index.css"
58
+ },
59
+ "files": [
60
+ "dist"
61
+ ],
62
+ "scripts": {
63
+ "build": "tsup --config tsup.config.ts",
64
+ "dev": "tsup --config tsup.config.ts --watch",
65
+ "lint": "eslint --quiet \"src/**/*.{ts,tsx}\"",
66
+ "lint:fix": "eslint --quiet \"src/**/*.{ts,tsx}\" --fix",
67
+ "pub": "npm publish"
68
+ },
69
+ "peerDependencies": {
70
+ "pinia": "3.0.1"
71
+ },
72
+ "dependencies": {
73
+ "axios": "^1.8.4",
74
+ "jsencrypt": "^3.3.2",
75
+ "svgo": "^4.0.0"
76
+ },
77
+ "devDependencies": {
78
+ "@monorepo/ebuilds-ui": "workspace:*",
79
+ "shx": "^0.4.0",
80
+ "tsup": "^8.0.2"
81
+ }
82
+ }