@kengic/vue 0.0.2-beta.31 → 0.0.2-beta.32

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,74 +1,74 @@
1
- import { defineComponent as O, createVNode as M, openBlock as Z, createElementBlock as z, Fragment as G, createElementVNode as p, toDisplayString as J, unref as x, withCtx as U, createTextVNode as H } from "vue";
1
+ import { defineComponent as v, createVNode as $, openBlock as _, createElementBlock as V, Fragment as Z, createElementVNode as G, toDisplayString as z, unref as O, withCtx as J, createTextVNode as H } from "vue";
2
2
  import { Button as D } from "ant-design-vue";
3
- const X = O({
3
+ const X = v({
4
4
  props: {
5
5
  name: String
6
6
  },
7
7
  setup(e) {
8
- return () => M(D, {
8
+ return () => $(D, {
9
9
  type: "ghost"
10
10
  }, {
11
11
  default: () => [e.name]
12
12
  });
13
13
  }
14
- }), we = /* @__PURE__ */ O({
14
+ }), de = /* @__PURE__ */ v({
15
15
  __name: "ComponentA",
16
16
  props: {
17
17
  msg: String
18
18
  },
19
19
  setup(e) {
20
- return (i, r) => (Z(), z(G, null, [p("div", null, "Hello " + J(e.msg) + "!", 1), M(x(D), {
20
+ return (t, o) => (_(), V(Z, null, [G("div", null, "Hello " + z(e.msg) + "!", 1), $(O(D), {
21
21
  type: "primary"
22
22
  }, {
23
- default: U(() => [H("CLICK")]),
23
+ default: J(() => [H("CLICK")]),
24
24
  _: 1
25
- }), M(x(X), {
25
+ }), $(O(X), {
26
26
  name: "FOO"
27
27
  })], 64));
28
28
  }
29
29
  });
30
- var s = /* @__PURE__ */ ((e) => (e.WMS = "wms", e.MES = "mes", e.WCS = "wcs", e.SYS = "sys", e))(s || {});
31
- const v = ["wms", "mes", "wcs", "sys"];
32
- function q(e, i) {
33
- var r, o, u;
34
- switch (i) {
35
- case s.WMS:
36
- return (r = e == null ? void 0 : e.startsWith(`/${s.WMS}`)) != null ? r : !1;
37
- case s.MES:
38
- return (o = e == null ? void 0 : e.startsWith(`/${s.MES}`)) != null ? o : !1;
39
- case s.WCS:
40
- return (u = e == null ? void 0 : e.startsWith(`/${s.WCS}`)) != null ? u : !1;
41
- case s.SYS:
42
- return !(e != null && e.startsWith(`/${s.WMS}`)) && !(e != null && e.startsWith(`/${s.MES}`)) && !(e != null && e.startsWith(`/${s.WCS}`));
30
+ var c = /* @__PURE__ */ ((e) => (e.WMS = "wms", e.MES = "mes", e.WCS = "wcs", e.SYS = "sys", e))(c || {});
31
+ const P = ["wms", "mes", "wcs", "sys"];
32
+ function q(e, t) {
33
+ var o, n, l;
34
+ switch (t) {
35
+ case c.WMS:
36
+ return (o = e == null ? void 0 : e.startsWith(`/${c.WMS}`)) != null ? o : !1;
37
+ case c.MES:
38
+ return (n = e == null ? void 0 : e.startsWith(`/${c.MES}`)) != null ? n : !1;
39
+ case c.WCS:
40
+ return (l = e == null ? void 0 : e.startsWith(`/${c.WCS}`)) != null ? l : !1;
41
+ case c.SYS:
42
+ return !(e != null && e.startsWith(`/${c.WMS}`)) && !(e != null && e.startsWith(`/${c.MES}`)) && !(e != null && e.startsWith(`/${c.WCS}`));
43
43
  default:
44
- throw new Error(`\u672A\u77E5\u6A21\u5757: ${i}`);
44
+ throw new Error(`\u672A\u77E5\u6A21\u5757: ${t}`);
45
45
  }
46
46
  }
47
- function Ne(e) {
48
- const i = v.find((r) => q(e, r));
49
- if (i)
50
- return i;
47
+ function we(e) {
48
+ const t = P.find((o) => q(e, o));
49
+ if (t)
50
+ return t;
51
51
  throw new Error(`\u5730\u5740\u65E0\u6CD5\u5339\u914D\u6A21\u5757. \u5730\u5740: ${e}`);
52
52
  }
53
- function $e(e) {
54
- let i = "";
53
+ function he(e) {
54
+ let t = "";
55
55
  switch (e) {
56
- case s.WMS:
57
- i = `/${e}/views/adrmst`;
56
+ case c.WMS:
57
+ t = `/${e}/views/adrmst`;
58
58
  break;
59
- case s.MES:
60
- i = `/${e}/about/index`;
59
+ case c.MES:
60
+ t = `/${e}/about/index`;
61
61
  break;
62
- case s.WCS:
63
- i = `/${e}/about/index`;
62
+ case c.WCS:
63
+ t = `/${e}/about/index`;
64
64
  break;
65
- case s.SYS:
66
- i = "/about/index";
65
+ case c.SYS:
66
+ t = "/about/index";
67
67
  break;
68
68
  default:
69
69
  throw new Error(`\u672A\u77E5\u6A21\u5757: ${e}`);
70
70
  }
71
- return i;
71
+ return t;
72
72
  }
73
73
  /**
74
74
  * filesize
@@ -77,7 +77,7 @@ function $e(e) {
77
77
  * @license BSD-3-Clause
78
78
  * @version 10.0.6
79
79
  */
80
- const Q = "array", ee = "bit", Y = "bits", te = "byte", R = "bytes", m = "", ie = "exponent", ne = "function", E = "iec", oe = "Invalid number", re = "Invalid rounding method", S = "jedec", se = "object", k = ".", ce = "round", le = "s", ue = "kbit", fe = "kB", me = " ", be = "string", Se = "0", I = {
80
+ const Q = "array", ee = "bit", Y = "bits", te = "byte", L = "bytes", B = "", ie = "exponent", ne = "function", w = "iec", oe = "Invalid number", re = "Invalid rounding method", y = "jedec", se = "object", p = ".", ce = "round", le = "s", ue = "kbit", fe = "kB", be = " ", me = "string", ge = "0", C = {
81
81
  symbol: {
82
82
  iec: {
83
83
  bits: ["bit", "Kibit", "Mibit", "Gibit", "Tibit", "Pibit", "Eibit", "Zibit", "Yibit"],
@@ -93,82 +93,103 @@ const Q = "array", ee = "bit", Y = "bits", te = "byte", R = "bytes", m = "", ie
93
93
  jedec: ["", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta"]
94
94
  }
95
95
  };
96
- function ge(e, {
97
- bits: i = !1,
98
- pad: r = !1,
99
- base: o = -1,
100
- round: u = 2,
101
- locale: y = m,
102
- localeOptions: P = {},
103
- separator: w = m,
104
- spacer: L = me,
105
- symbols: F = {},
106
- standard: c = m,
107
- output: N = be,
108
- fullform: K = !1,
109
- fullforms: T = [],
110
- exponent: a = -1,
111
- roundingMethod: _ = ce,
112
- precision: g = 0
96
+ function Be(e, {
97
+ bits: t = !1,
98
+ pad: o = !1,
99
+ base: n = -1,
100
+ round: l = 2,
101
+ locale: u = B,
102
+ localeOptions: m = {},
103
+ separator: f = B,
104
+ spacer: S = be,
105
+ symbols: h = {},
106
+ standard: s = B,
107
+ output: A = me,
108
+ fullform: j = !1,
109
+ fullforms: I = [],
110
+ exponent: M = -1,
111
+ roundingMethod: F = ce,
112
+ precision: E = 0
113
113
  } = {}) {
114
- let n = a, f = Number(e), t = [], l = 0, $ = m;
115
- o === -1 && c.length === 0 ? (o = 10, c = S) : o === -1 && c.length > 0 ? (c = c === E ? E : S, o = c === E ? 2 : 10) : (o = o === 2 ? 2 : 10, c = o === 10 || c === S ? S : E);
116
- const B = o === 10 ? 1e3 : 1024, j = K === !0, d = f < 0, C = Math[_];
114
+ let r = M, g = Number(e), i = [], b = 0, N = B;
115
+ n === -1 && s.length === 0 ? (n = 10, s = y) : n === -1 && s.length > 0 ? (s = s === w ? w : y, n = s === w ? 2 : 10) : (n = n === 2 ? 2 : 10, s = n === 10 || s === y ? y : w);
116
+ const d = n === 10 ? 1e3 : 1024, U = j === !0, T = g < 0, W = Math[F];
117
117
  if (typeof e != "bigint" && isNaN(e))
118
118
  throw new TypeError(oe);
119
- if (typeof C !== ne)
119
+ if (typeof W !== ne)
120
120
  throw new TypeError(re);
121
- if (d && (f = -f), (n === -1 || isNaN(n)) && (n = Math.floor(Math.log(f) / Math.log(B)), n < 0 && (n = 0)), n > 8 && (g > 0 && (g += 8 - n), n = 8), N === ie)
122
- return n;
123
- if (f === 0)
124
- t[0] = 0, $ = t[1] = I.symbol[c][i ? Y : R][n];
121
+ if (T && (g = -g), (r === -1 || isNaN(r)) && (r = Math.floor(Math.log(g) / Math.log(d)), r < 0 && (r = 0)), r > 8 && (E > 0 && (E += 8 - r), r = 8), A === ie)
122
+ return r;
123
+ if (g === 0)
124
+ i[0] = 0, N = i[1] = C.symbol[s][t ? Y : L][r];
125
125
  else {
126
- l = f / (o === 2 ? Math.pow(2, n * 10) : Math.pow(1e3, n)), i && (l = l * 8, l >= B && n < 8 && (l = l / B, n++));
127
- const b = Math.pow(10, n > 0 ? u : 0);
128
- t[0] = C(l * b) / b, t[0] === B && n < 8 && a === -1 && (t[0] = 1, n++), $ = t[1] = o === 10 && n === 1 ? i ? ue : fe : I.symbol[c][i ? Y : R][n];
126
+ b = g / (n === 2 ? Math.pow(2, r * 10) : Math.pow(1e3, r)), t && (b = b * 8, b >= d && r < 8 && (b = b / d, r++));
127
+ const a = Math.pow(10, r > 0 ? l : 0);
128
+ i[0] = W(b * a) / a, i[0] === d && r < 8 && M === -1 && (i[0] = 1, r++), N = i[1] = n === 10 && r === 1 ? t ? ue : fe : C.symbol[s][t ? Y : L][r];
129
129
  }
130
- if (d && (t[0] = -t[0]), g > 0 && (t[0] = t[0].toPrecision(g)), t[1] = F[t[1]] || t[1], y === !0 ? t[0] = t[0].toLocaleString() : y.length > 0 ? t[0] = t[0].toLocaleString(y, P) : w.length > 0 && (t[0] = t[0].toString().replace(k, w)), r && Number.isInteger(t[0]) === !1 && u > 0) {
131
- const b = w || k, W = t[0].toString().split(b), A = W[1] || m, h = A.length, V = u - h;
132
- t[0] = `${W[0]}${b}${A.padEnd(h + V, Se)}`;
130
+ if (T && (i[0] = -i[0]), E > 0 && (i[0] = i[0].toPrecision(E)), i[1] = h[i[1]] || i[1], u === !0 ? i[0] = i[0].toLocaleString() : u.length > 0 ? i[0] = i[0].toLocaleString(u, m) : f.length > 0 && (i[0] = i[0].toString().replace(p, f)), o && Number.isInteger(i[0]) === !1 && l > 0) {
131
+ const a = f || p, R = i[0].toString().split(a), x = R[1] || B, k = x.length, K = l - k;
132
+ i[0] = `${R[0]}${a}${x.padEnd(k + K, ge)}`;
133
133
  }
134
- return j && (t[1] = T[n] ? T[n] : I.fullform[c][n] + (i ? ee : te) + (t[0] === 1 ? m : le)), N === Q ? t : N === se ? {
135
- value: t[0],
136
- symbol: t[1],
137
- exponent: n,
138
- unit: $
139
- } : t.join(L);
134
+ return U && (i[1] = I[r] ? I[r] : C.fullform[s][r] + (t ? ee : te) + (i[0] === 1 ? B : le)), A === Q ? i : A === se ? {
135
+ value: i[0],
136
+ symbol: i[1],
137
+ exponent: r,
138
+ unit: N
139
+ } : i.join(S);
140
140
  }
141
- function Ie(e) {
142
- const i = Number(e);
143
- return Number.isNaN(i) || i <= 0 ? "0 KB" : String(ge(i)).toUpperCase();
141
+ function Ae(e) {
142
+ const t = Number(e);
143
+ return Number.isNaN(t) || t <= 0 ? "0 KB" : String(Be(t)).toUpperCase();
144
144
  }
145
- function Be(e) {
146
- const i = [];
147
- return e.forEach((r) => {
145
+ function ae(e, t, o = 512) {
146
+ let n = e;
147
+ n.startsWith("data:") && (n = e.split("base64,")[1]);
148
+ const l = atob(n), u = [];
149
+ for (let m = 0; m < l.length; m += o) {
150
+ const f = l.slice(m, m + o), S = new Array(f.length);
151
+ for (let s = 0; s < f.length; s++)
152
+ S[s] = f.charCodeAt(s);
153
+ const h = new Uint8Array(S);
154
+ u.push(h);
155
+ }
156
+ return new Blob(u, { type: t });
157
+ }
158
+ function Ne(e, t, o) {
159
+ let n;
160
+ typeof e == "string" ? n = new Blob([ae(e, o)], { type: o }) : n = new Blob([e], { type: o });
161
+ const l = URL.createObjectURL(n), u = document.createElement("a");
162
+ document.body.appendChild(u), u.setAttribute("style", "display:none"), u.setAttribute("href", l), u.setAttribute("download", t), u.click(), URL.revokeObjectURL(l);
163
+ }
164
+ function ye(e) {
165
+ const t = [];
166
+ return e.forEach((o) => {
148
167
  [
149
168
  "/online/copyform/:code",
150
169
  "/online/cgformList/:id",
151
170
  "/online/cgformTreeList/:id",
152
171
  "/online/cgreport/:id",
153
172
  "/online/graphreport/chart/:code"
154
- ].includes(r.path) && v.forEach((o) => {
155
- i.push({
156
- ...r,
157
- path: `/${o}${r.path}`,
158
- name: `${o}-${r.name}`,
159
- id: `${o}-${r.id}`
173
+ ].includes(o.path) && P.forEach((n) => {
174
+ t.push({
175
+ ...o,
176
+ path: `/${n}${o.path}`,
177
+ name: `${n}-${o.name}`,
178
+ id: `${n}-${o.id}`
160
179
  });
161
- }), r.children && (r.children = Be(r.children));
162
- }), [...e, ...i];
180
+ }), o.children && (o.children = ye(o.children));
181
+ }), [...e, ...t];
163
182
  }
164
183
  export {
165
184
  X as B,
166
- we as ComponentA,
167
- v as KG_APPS,
168
- s as KG_APPS_ENUM,
169
- Be as addOnlineRoutesForAllApps,
170
- Ne as getAppByPath,
171
- $e as getAppIndexPath,
172
- Ie as getFileSize,
185
+ de as ComponentA,
186
+ P as KG_APPS,
187
+ c as KG_APPS_ENUM,
188
+ ye as addOnlineRoutesForAllApps,
189
+ ae as base64toBlob,
190
+ Ne as downloadFile,
191
+ we as getAppByPath,
192
+ he as getAppIndexPath,
193
+ Ae as getFileSize,
173
194
  q as isPathInApp
174
195
  };
@@ -1,5 +1,19 @@
1
1
  /**
2
- * 根据文件大小数值获取文件大小文本.
2
+ * 根据'文件大小数值'获取'文件大小文本'.
3
3
  * @param size 文件大小数值.
4
4
  */
5
5
  export declare function getFileSize(size: any): string;
6
+ /**
7
+ * base64 转换为 blob.
8
+ * @param base64 base64 字符串.
9
+ * @param contentType 文件类型.
10
+ * @param sliceSize 分块大小.
11
+ */
12
+ export declare function base64toBlob(base64: string, contentType: string, sliceSize?: number): Blob;
13
+ /**
14
+ * 下载文件.
15
+ * @param data 文件数据.
16
+ * @param fileName 文件名称, 包含后缀.
17
+ * @param contentType 文件类型.
18
+ */
19
+ export declare function downloadFile(data: string | BlobPart, fileName: string, contentType: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kengic/vue",
3
- "version": "0.0.2-beta.31",
3
+ "version": "0.0.2-beta.32",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "publish:all:beta": "npm run bump-version:beta && npm run publish:all",