magtool 1.5.39 → 1.5.41

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,21 +1,124 @@
1
+ import { a as u } from "../vendor.js";
1
2
  import { defineAsyncComponent as n } from "vue";
2
- const t = /* @__PURE__ */ Object.assign({ "./Mvc/Card/index.vue": () => import("./Card.js"), "./Mvc/Icon/index.vue": () => import("./Icon.js"), "./Mvc/Image/index.vue": () => import("./Image.js"), "./Mvc/Input/index.vue": () => import("./Input.js"), "./Mvc/Nodata/index.vue": () => import("./Nodata.js"), "./Mvc/Page/index.vue": () => import("./Page.js"), "./Mvc/Textarea/index.vue": () => import("./Textarea.js") }), o = {};
3
- for (const e in t) {
4
- const i = e.match(/Mvc\/(\S*)\/index.vue/)[1];
5
- o[i] = n(t[e]);
3
+ class v {
4
+ constructor() {
5
+ this.appRegistrationStatus = /* @__PURE__ */ new WeakMap(), this.loadedComponents = /* @__PURE__ */ new Map(), this.loadingPromises = /* @__PURE__ */ new Map();
6
+ }
7
+ async registerAllComponents(e) {
8
+ if (this.appRegistrationStatus.has(e))
9
+ return console.warn("Components already registered for this app instance"), !1;
10
+ try {
11
+ return (await Promise.resolve().then(() => x)).default(e), this.appRegistrationStatus.set(e, {
12
+ registeredAt: /* @__PURE__ */ new Date(),
13
+ components: Object.keys(await this.getAllComponentNames())
14
+ }), !0;
15
+ } catch (t) {
16
+ return console.error("Failed to register all components:", t), !1;
17
+ }
18
+ }
19
+ async registerSpecificComponents(e, t) {
20
+ if (!Array.isArray(t) || t.length === 0)
21
+ return console.warn("componentNames should be a non-empty array"), !1;
22
+ try {
23
+ for (const r of t)
24
+ await this.registerSingleComponent(e, r);
25
+ return !0;
26
+ } catch (r) {
27
+ return console.error("Failed to register specific components:", r), !1;
28
+ }
29
+ }
30
+ async registerSingleComponent(e, t) {
31
+ try {
32
+ if (this.loadedComponents.has(t))
33
+ return e.component(t, this.loadedComponents.get(t)), !0;
34
+ if (this.loadingPromises.has(t))
35
+ return await this.loadingPromises.get(t), e.component(t, this.loadedComponents.get(t)), !0;
36
+ const r = this._loadComponent(t);
37
+ this.loadingPromises.set(t, r);
38
+ const o = await r;
39
+ return this.loadedComponents.set(t, o), e.component(t, o), this.loadingPromises.delete(t), !0;
40
+ } catch (r) {
41
+ return console.warn(`Failed to load component ${t}:`, r), !1;
42
+ }
43
+ }
44
+ async _loadComponent(e) {
45
+ try {
46
+ const t = await u(/* @__PURE__ */ Object.assign({ "./Mvc/Card/index.vue": () => import("./Card.js"), "./Mvc/Icon/index.vue": () => import("./Icon.js"), "./Mvc/Image/index.vue": () => import("./Image.js"), "./Mvc/Input/index.vue": () => import("./Input.js"), "./Mvc/Nodata/index.vue": () => import("./Nodata.js"), "./Mvc/Page/index.vue": () => import("./Page.js"), "./Mvc/Textarea/index.vue": () => import("./Textarea.js") }), `./Mvc/${e}/index.vue`, 4);
47
+ return n(t.default);
48
+ } catch {
49
+ try {
50
+ const r = await u(/* @__PURE__ */ Object.assign({ "./Super/AiApp/index.vue": () => import("./AiApp.js"), "./Super/AiOrg/index.vue": () => import("./AiOrg.js"), "./Super/AsaAdGroup/index.vue": () => import("./AsaAdGroup.js"), "./Super/AsaApp/index.vue": () => import("./AsaApp.js"), "./Super/AsaCampaign/index.vue": () => import("./AsaCampaign.js"), "./Super/AsaOrg/index.vue": () => import("./AsaOrg.js"), "./Super/Country/index.vue": () => import("./Country.js"), "./Super/CountryItem/index.vue": () => import("./CountryItem.js"), "./Super/DatePicker/index.vue": () => import("./DatePicker.js"), "./Super/EChart/index.vue": () => import("./EChart.js"), "./Super/Form/index.vue": () => import("./Form.js"), "./Super/MultipleSelect/index.vue": () => import("./MultipleSelect.js"), "./Super/Org/index.vue": () => import("./Org.js"), "./Super/StatusItem/index.vue": () => import("./StatusItem.js"), "./Super/StatusSelect/index.vue": () => import("./StatusSelect.js"), "./Super/Table/index.vue": () => import("./Table.js"), "./Super/Timezone/index.vue": () => import("./Timezone.js") }), `./Super/${e}/index.vue`, 4);
51
+ return n(r.default);
52
+ } catch {
53
+ throw new Error(`Component ${e} not found in Mvc or Super directories`);
54
+ }
55
+ }
56
+ }
57
+ async getAllComponentNames() {
58
+ const t = Object.keys(/* @__PURE__ */ Object.assign({ "./Mvc/Card/index.vue": () => import("./Card.js"), "./Mvc/Icon/index.vue": () => import("./Icon.js"), "./Mvc/Image/index.vue": () => import("./Image.js"), "./Mvc/Input/index.vue": () => import("./Input.js"), "./Mvc/Nodata/index.vue": () => import("./Nodata.js"), "./Mvc/Page/index.vue": () => import("./Page.js"), "./Mvc/Textarea/index.vue": () => import("./Textarea.js") })).map(
59
+ (p) => p.match(/Mvc\/(\S*)\/index.vue/)[1]
60
+ ), o = Object.keys(/* @__PURE__ */ Object.assign({ "./Super/AiApp/index.vue": () => import("./AiApp.js"), "./Super/AiOrg/index.vue": () => import("./AiOrg.js"), "./Super/AsaAdGroup/index.vue": () => import("./AsaAdGroup.js"), "./Super/AsaApp/index.vue": () => import("./AsaApp.js"), "./Super/AsaCampaign/index.vue": () => import("./AsaCampaign.js"), "./Super/AsaOrg/index.vue": () => import("./AsaOrg.js"), "./Super/Country/index.vue": () => import("./Country.js"), "./Super/CountryItem/index.vue": () => import("./CountryItem.js"), "./Super/DatePicker/index.vue": () => import("./DatePicker.js"), "./Super/EChart/index.vue": () => import("./EChart.js"), "./Super/Form/index.vue": () => import("./Form.js"), "./Super/MultipleSelect/index.vue": () => import("./MultipleSelect.js"), "./Super/Org/index.vue": () => import("./Org.js"), "./Super/StatusItem/index.vue": () => import("./StatusItem.js"), "./Super/StatusSelect/index.vue": () => import("./StatusSelect.js"), "./Super/Table/index.vue": () => import("./Table.js"), "./Super/Timezone/index.vue": () => import("./Timezone.js") })).map(
61
+ (p) => p.match(/Super\/(\S*)\/index.vue/)[1]
62
+ );
63
+ return [...t, ...o];
64
+ }
65
+ /**
66
+ * 检查应用实例的注册状态
67
+ * @param {import('vue').App} app - Vue 应用实例
68
+ * @returns {Object|null} - 注册状态信息
69
+ */
70
+ getRegistrationStatus(e) {
71
+ return this.appRegistrationStatus.get(e) || null;
72
+ }
73
+ /**
74
+ * 检查应用实例是否已注册组件
75
+ * @param {import('vue').App} app - Vue 应用实例
76
+ * @returns {boolean} - 是否已注册
77
+ */
78
+ isAppRegistered(e) {
79
+ return this.appRegistrationStatus.has(e);
80
+ }
81
+ /**
82
+ * 重置应用实例的注册状态
83
+ * @param {import('vue').App} app - Vue 应用实例
84
+ */
85
+ resetRegistration(e) {
86
+ this.appRegistrationStatus.delete(e);
87
+ }
88
+ /**
89
+ * 获取已加载的组件数量
90
+ * @returns {number} - 已加载组件数量
91
+ */
92
+ getLoadedComponentsCount() {
93
+ return this.loadedComponents.size;
94
+ }
95
+ /**
96
+ * 清理所有状态(用于登出或重置)
97
+ */
98
+ clearAll() {
99
+ this.appRegistrationStatus = /* @__PURE__ */ new WeakMap(), this.loadedComponents.clear(), this.loadingPromises.clear();
100
+ }
6
101
  }
7
- const r = /* @__PURE__ */ Object.assign({ "./Super/AiApp/index.vue": () => import("./AiApp.js"), "./Super/AiOrg/index.vue": () => import("./AiOrg.js"), "./Super/AsaAdGroup/index.vue": () => import("./AsaAdGroup.js"), "./Super/AsaApp/index.vue": () => import("./AsaApp.js"), "./Super/AsaCampaign/index.vue": () => import("./AsaCampaign.js"), "./Super/AsaOrg/index.vue": () => import("./AsaOrg.js"), "./Super/Country/index.vue": () => import("./Country.js"), "./Super/CountryItem/index.vue": () => import("./CountryItem.js"), "./Super/DatePicker/index.vue": () => import("./DatePicker.js"), "./Super/EChart/index.vue": () => import("./EChart.js"), "./Super/Form/index.vue": () => import("./Form.js"), "./Super/MultipleSelect/index.vue": () => import("./MultipleSelect.js"), "./Super/Org/index.vue": () => import("./Org.js"), "./Super/StatusItem/index.vue": () => import("./StatusItem.js"), "./Super/StatusSelect/index.vue": () => import("./StatusSelect.js"), "./Super/Table/index.vue": () => import("./Table.js"), "./Super/Timezone/index.vue": () => import("./Timezone.js") }), u = {};
8
- for (const e in r) {
9
- const i = e.match(/Super\/(\S*)\/index.vue/)[1];
10
- u[i] = n(r[e]);
102
+ const h = new v(), s = /* @__PURE__ */ Object.assign({ "./Mvc/Card/index.vue": () => import("./Card.js"), "./Mvc/Icon/index.vue": () => import("./Icon.js"), "./Mvc/Image/index.vue": () => import("./Image.js"), "./Mvc/Input/index.vue": () => import("./Input.js"), "./Mvc/Nodata/index.vue": () => import("./Nodata.js"), "./Mvc/Page/index.vue": () => import("./Page.js"), "./Mvc/Textarea/index.vue": () => import("./Textarea.js") }), m = {};
103
+ for (const i in s) {
104
+ const e = i.match(/Mvc\/(\S*)\/index.vue/)[1];
105
+ m[e] = n(s[i]);
11
106
  }
12
- const p = {
13
- ...o,
14
- ...u
15
- }, v = (e) => {
16
- for (let i in p)
17
- e.component(i, p[i]);
18
- };
107
+ const a = /* @__PURE__ */ Object.assign({ "./Super/AiApp/index.vue": () => import("./AiApp.js"), "./Super/AiOrg/index.vue": () => import("./AiOrg.js"), "./Super/AsaAdGroup/index.vue": () => import("./AsaAdGroup.js"), "./Super/AsaApp/index.vue": () => import("./AsaApp.js"), "./Super/AsaCampaign/index.vue": () => import("./AsaCampaign.js"), "./Super/AsaOrg/index.vue": () => import("./AsaOrg.js"), "./Super/Country/index.vue": () => import("./Country.js"), "./Super/CountryItem/index.vue": () => import("./CountryItem.js"), "./Super/DatePicker/index.vue": () => import("./DatePicker.js"), "./Super/EChart/index.vue": () => import("./EChart.js"), "./Super/Form/index.vue": () => import("./Form.js"), "./Super/MultipleSelect/index.vue": () => import("./MultipleSelect.js"), "./Super/Org/index.vue": () => import("./Org.js"), "./Super/StatusItem/index.vue": () => import("./StatusItem.js"), "./Super/StatusSelect/index.vue": () => import("./StatusSelect.js"), "./Super/Table/index.vue": () => import("./Table.js"), "./Super/Timezone/index.vue": () => import("./Timezone.js") }), c = {};
108
+ for (const i in a) {
109
+ const e = i.match(/Super\/(\S*)\/index.vue/)[1];
110
+ c[e] = n(a[i]);
111
+ }
112
+ const d = {
113
+ ...m,
114
+ ...c
115
+ }, l = (i) => {
116
+ for (let e in d)
117
+ i.component(e, d[e]);
118
+ }, x = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
119
+ __proto__: null,
120
+ default: l
121
+ }, Symbol.toStringTag, { value: "Module" }));
19
122
  export {
20
- v as c
123
+ h as c
21
124
  };
package/dist/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import "./util.js";
2
2
  import "./directive.js";
3
3
  import "./store.js";
4
- import "./cpt/component.js";
5
4
  /* empty css */
6
- import { i as e } from "./vendor.js";
5
+ import { c as e } from "./cpt/component.js";
6
+ import { i as f } from "./vendor.js";
7
7
  export {
8
- e as default
8
+ f as default,
9
+ e as registCpt
9
10
  };
package/dist/vendor.js CHANGED
@@ -1,25 +1,38 @@
1
- import { d as c } from "./util.js";
2
- import { d as m } from "./directive.js";
3
- import { p as d } from "./store.js";
4
- import { c as l } from "./cpt/component.js";
1
+ import { d as m } from "./util.js";
2
+ import { d as c } from "./directive.js";
3
+ import { p as u } from "./store.js";
5
4
  /* empty css */
6
- let _, a, i, n;
7
- const M = (t, e) => {
8
- t.use(c).use(m).use(l);
5
+ import "./cpt/component.js";
6
+ const h = (e, t, r) => {
7
+ const o = e[t];
8
+ return o ? typeof o == "function" ? o() : Promise.resolve(o) : new Promise((n, l) => {
9
+ (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
10
+ l.bind(
11
+ null,
12
+ new Error(
13
+ "Unknown variable dynamic import: " + t + (t.split("/").length !== r ? ". Note that variables only represent file names one level deep." : "")
14
+ )
15
+ )
16
+ );
17
+ });
18
+ };
19
+ let i, s, a, _;
20
+ const M = (e, t) => {
21
+ e.use(m).use(c).use(component);
9
22
  let r;
10
- if (e.storeChips)
23
+ if (t.storeChips)
11
24
  try {
12
- const { store: o, pinia: s } = d(e.storeChips);
13
- r = o, t.provide("store", o).use(s);
25
+ const { store: o, pinia: n } = u(t.storeChips);
26
+ r = o, e.provide("store", o).use(n);
14
27
  } catch {
15
28
  throw new Error("RangeError: Maximum call stack size exceeded");
16
29
  }
17
30
  };
18
31
  window.$m = async () => {
19
- if (!_) {
20
- _ = (await import("moment")).default;
21
- const e = localStorage.getItem("lang");
22
- e && e.includes("cn") && _.locale("zh-cn", {
32
+ if (!i) {
33
+ i = (await import("moment")).default;
34
+ const t = localStorage.getItem("lang");
35
+ t && t.includes("cn") && i.locale("zh-cn", {
23
36
  months: "一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split(
24
37
  "_"
25
38
  ),
@@ -31,18 +44,19 @@ window.$m = async () => {
31
44
  weekdaysMin: "日_一_二_三_四_五_六".split("_")
32
45
  });
33
46
  }
34
- return _;
47
+ return i;
35
48
  };
36
- window.$md = async () => (a || (a = (await import("markdown-it")).default), a);
37
- window.$ecs = async () => (i || (i = (await import("echarts")).default), i);
38
- window.$bn = async () => (n || (n = (await import("bignumber.js")).default), n);
39
- const g = (t, e) => {
40
- const r = t.__vccOpts || t;
41
- for (const [o, s] of e)
42
- r[o] = s;
49
+ window.$md = async () => (s || (s = (await import("markdown-it")).default), s);
50
+ window.$ecs = async () => (a || (a = (await import("echarts")).default), a);
51
+ window.$bn = async () => (_ || (_ = (await import("bignumber.js")).default), _);
52
+ const k = (e, t) => {
53
+ const r = e.__vccOpts || e;
54
+ for (const [o, n] of t)
55
+ r[o] = n;
43
56
  return r;
44
57
  };
45
58
  export {
46
- g as _,
59
+ k as _,
60
+ h as a,
47
61
  M as i
48
62
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "magtool",
3
3
  "packageManager": "yarn@4.4.1",
4
- "version": "1.5.39",
4
+ "version": "1.5.41",
5
5
  "author": "matt avis",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",