@maxtropy/v-components 0.1.12-beta.3 → 0.1.12-beta.5

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.
@@ -0,0 +1,70 @@
1
+ function O() {
2
+ return window.__MICRO_APP_ENVIRONMENT__ ? I() + "/" + window.__MICRO_APP_NAME__ : window.__MICRO_APP_BASE_APPLICATION__ ? window.location.pathname.split("/").slice(0, 3).join("/") : "";
3
+ }
4
+ function I() {
5
+ return window.__MICRO_APP_ENVIRONMENT__ ? window.__MICRO_APP_BASE_ROUTE__ ?? "" : window.__MICRO_APP_BASE_APPLICATION__ ? "/" + window.location.pathname.split("/")[1] : "";
6
+ }
7
+ function p() {
8
+ var a;
9
+ window.$location = window.__MICRO_APP_ENVIRONMENT__ ? window.microApp.location : window.location;
10
+ const w = O();
11
+ if (!w)
12
+ return;
13
+ const n = I();
14
+ window.rawFetch = window.fetch, window.fetch = (o, t) => {
15
+ var f, r;
16
+ const i = w;
17
+ let e = o;
18
+ typeof o == "string" && !o.startsWith("http") && !o.startsWith(n) && (e = i + o), typeof o == "object" && !(o instanceof URL) && !o.url.startsWith("http") && !o.url.startsWith(n) && (e = { ...o, url: i + o.url });
19
+ const s = window.document.cookie.split(";").filter((R) => R.indexOf("GT=GT-") > -1), d = (r = (f = s == null ? void 0 : s[0]) == null ? void 0 : f.split("=")) == null ? void 0 : r[1];
20
+ let c = { ...t };
21
+ return d && (c = {
22
+ ...t,
23
+ headers: {
24
+ "X-GT": d,
25
+ ...t == null ? void 0 : t.headers
26
+ }
27
+ }), window.rawFetch(e, c);
28
+ }, window.rawXMLHttpRequest = window.XMLHttpRequest, window.XMLHttpRequest = class extends window.XMLHttpRequest {
29
+ constructor() {
30
+ super(), this.open = (o, t, i, e, _) => {
31
+ var d, c;
32
+ const s = w;
33
+ if (!t.startsWith("http") && !t.startsWith(n)) {
34
+ super.open(o, s + t, i ?? !0, e, _);
35
+ const r = window.document.cookie.split(";").filter((l) => l.indexOf("GT=GT-") > -1), R = (c = (d = r == null ? void 0 : r[0]) == null ? void 0 : d.split("=")) == null ? void 0 : c[1];
36
+ R && super.setRequestHeader("X-GT", R);
37
+ } else
38
+ super.open(o, t, i ?? !0, e, _);
39
+ };
40
+ }
41
+ }, window.rawOpen = window.open, window.open = (o, t, i) => typeof o == "string" && o.startsWith("/") && !o.startsWith(n) ? window.rawWindow.rawOpen(w + o, t, i) : window.rawOpen(o, t, i), window.addEventListener("click", (o) => {
42
+ if (o.defaultPrevented)
43
+ return;
44
+ const i = o.target.closest("a");
45
+ if (!i)
46
+ return;
47
+ const e = i.getAttribute("href");
48
+ e && (o.preventDefault(), window.open(e, i.getAttribute("target") ?? "_self"));
49
+ }), window.SELECTSTAFFORIGIN = window.location.origin + n + "/ms-cc", window.IOTPLATFORMORIGIN = window.location.origin + n + "/ms-dc", window.DMEPLATFORMSORIGIN = window.location.origin + n + "/ms-ds", window.IDSPLATFORMORIGIN = window.location.origin + n + "/ms-ids", (a = window.SERVERALARM) == null || a.forEach((o) => {
50
+ o.originId === 1 ? o.origin = window.SELECTSTAFFORIGIN : o.originId === 2 ? o.origin = window.IOTPLATFORMORIGIN : o.originId === 3 ? o.origin = window.DMEPLATFORMSORIGIN : o.originId === 4 && (o.origin = window.IDSPLATFORMORIGIN);
51
+ }), window.RAW_ALARMWORKORDER = window.ALARMWORKORDER, window.ALARMWORKORDER = window.location.origin + n + "/ms-wo";
52
+ }
53
+ function A(w) {
54
+ window.__MICRO_APP_ENVIRONMENT__ && w.afterEach((n, a) => {
55
+ n.fullPath !== a.fullPath && window.rawWindow.dispatchEvent(new PopStateEvent("popstate", { state: null }));
56
+ });
57
+ }
58
+ const M = {
59
+ getBase: O,
60
+ getMicroAppBaseRoute: I,
61
+ microAppRewrite: p,
62
+ microAppRouterHandle: A
63
+ };
64
+ export {
65
+ M as default,
66
+ O as getBase,
67
+ I as getMicroAppBaseRoute,
68
+ p as microAppRewrite,
69
+ A as microAppRouterHandle
70
+ };
@@ -1,12 +1,12 @@
1
1
  import type { Router } from 'vue-router';
2
2
  export declare function getBase(): string;
3
3
  export declare function getMicroAppBaseRoute(): string;
4
- export declare function microAppRewrite({ router }: {
5
- router: Router;
6
- }): void;
4
+ export declare function microAppRewrite(): void;
5
+ export declare function microAppRouterHandle(router: Router): void;
7
6
  declare const _default: {
8
7
  getBase: typeof getBase;
9
8
  getMicroAppBaseRoute: typeof getMicroAppBaseRoute;
10
9
  microAppRewrite: typeof microAppRewrite;
10
+ microAppRouterHandle: typeof microAppRouterHandle;
11
11
  };
12
12
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maxtropy/v-components",
3
- "version": "0.1.12-beta.3",
3
+ "version": "0.1.12-beta.5",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -10,6 +10,9 @@
10
10
  ".": {
11
11
  "import": "./dist/mx-vcomponents.es.js"
12
12
  },
13
+ "./micro": {
14
+ "import": "./dist/mx-vcomponents.es2.js"
15
+ },
13
16
  "./dist/style.css": "./dist/style.css"
14
17
  },
15
18
  "publishConfig": {