magtool 1.5.18 → 1.5.19
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.
- package/dist/component.js +414 -413
- package/dist/composition.js +107 -90
- package/dist/css/magtool.css +1 -1
- package/package.json +1 -1
package/dist/composition.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const v = (t) => {
|
|
2
2
|
const { age: e } = t || {};
|
|
3
|
-
let
|
|
3
|
+
let o, l;
|
|
4
4
|
if (e != null && e.included) {
|
|
5
|
-
const { minAge:
|
|
6
|
-
|
|
5
|
+
const { minAge: n, maxAge: r } = e.included[0] || {};
|
|
6
|
+
n ? o = n : o = "all", r ? l = r : l = "all";
|
|
7
7
|
}
|
|
8
|
-
return l === "all" ?
|
|
8
|
+
return l === "all" ? o === "all" ? "All" : `${o}~65+` : `${o}~${l}`;
|
|
9
9
|
}, S = (t, e) => t === "all" ? null : e === 65 ? {
|
|
10
10
|
included: [
|
|
11
11
|
{
|
|
@@ -22,42 +22,59 @@ const v = (t) => {
|
|
|
22
22
|
}, _ = (t) => {
|
|
23
23
|
const { gender: e } = t || {};
|
|
24
24
|
return e != null && e.included ? e.included[0] : null;
|
|
25
|
-
},
|
|
25
|
+
}, E = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
26
26
|
__proto__: null,
|
|
27
27
|
useAgeFormat: v,
|
|
28
28
|
useAgeValue: S,
|
|
29
29
|
useGenderFormat: _
|
|
30
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
30
|
+
}, Symbol.toStringTag, { value: "Module" })), M = (t) => new Promise((e, o) => {
|
|
31
31
|
const l = new Image();
|
|
32
|
-
l.src = window.$getType(t) === "String" ? t : URL.createObjectURL(t), l.onload = () => e(l), l.onerror = () =>
|
|
33
|
-
}), O = (t) => new Promise((e,
|
|
32
|
+
l.src = window.$getType(t) === "String" ? t : URL.createObjectURL(t), l.onload = () => e(l), l.onerror = () => o(new Error("Could not load image"));
|
|
33
|
+
}), O = (t) => new Promise((e, o) => {
|
|
34
34
|
const l = document.createElement("video");
|
|
35
35
|
l.preload = "metadata", window.$getType(t) === "String" ? l.src = t : l.src = URL.createObjectURL(t), l.onloadedmetadata = () => {
|
|
36
36
|
window.URL.revokeObjectURL(t), e(l);
|
|
37
37
|
};
|
|
38
|
-
}), j = ({
|
|
39
|
-
|
|
38
|
+
}), j = async ({
|
|
39
|
+
type: t,
|
|
40
|
+
url: e,
|
|
41
|
+
headers: o,
|
|
42
|
+
data: l,
|
|
43
|
+
name: n,
|
|
44
|
+
error: r = () => {
|
|
45
|
+
}
|
|
46
|
+
}) => {
|
|
47
|
+
let a = document.createElement("a");
|
|
40
48
|
if (t === "csv") {
|
|
41
|
-
|
|
49
|
+
if (!l)
|
|
50
|
+
throw r(), new Error("data is null");
|
|
51
|
+
const c = new Blob(["\uFEFF" + l], {
|
|
42
52
|
type: "text/csv,charset=UTF-8"
|
|
43
53
|
});
|
|
44
|
-
|
|
54
|
+
a.href = URL.createObjectURL(c);
|
|
55
|
+
} else if (t === "excel") {
|
|
56
|
+
const c = await fetch(e, {
|
|
57
|
+
headers: o
|
|
58
|
+
}).then((g) => g.blob());
|
|
59
|
+
if (!(c != null && c.type.includes("sheet")))
|
|
60
|
+
throw r(), new Error("excel does not exist");
|
|
61
|
+
a.href = URL.createObjectURL(c);
|
|
45
62
|
}
|
|
46
|
-
let
|
|
47
|
-
|
|
48
|
-
},
|
|
63
|
+
let i = new MouseEvent("click");
|
|
64
|
+
a.download = n || "download", a.dispatchEvent(i), URL.revokeObjectURL(a.url), a = null, i = null;
|
|
65
|
+
}, A = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
49
66
|
__proto__: null,
|
|
50
67
|
download: j,
|
|
51
|
-
loadImage:
|
|
68
|
+
loadImage: M,
|
|
52
69
|
loadVideo: O
|
|
53
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
70
|
+
}, Symbol.toStringTag, { value: "Module" })), L = ({ table: t, key: e, form: o, value: l, cb: n = () => {
|
|
54
71
|
} }) => {
|
|
55
72
|
const r = t.getSelectionRows();
|
|
56
|
-
r.length > 1 ? (t.clearSelection(), t.toggleRowSelection(r[1], "selected"),
|
|
57
|
-
},
|
|
58
|
-
let { sortable: e = !0, empty:
|
|
59
|
-
l && (
|
|
60
|
-
const r =
|
|
73
|
+
r.length > 1 ? (t.clearSelection(), t.toggleRowSelection(r[1], "selected"), o[l] = r[1][e]) : r.length === 1 && (o[l] = r[0][e]), n();
|
|
74
|
+
}, C = (t = {}) => {
|
|
75
|
+
let { sortable: e = !0, empty: o = !1, mmp: l = !1 } = t, n = window.$map.asa.asaMetric.all;
|
|
76
|
+
l && (n = n.concat(window.$map.asa.mmpMetric.all));
|
|
77
|
+
const r = n.map((a, i) => ({
|
|
61
78
|
label: a.label,
|
|
62
79
|
prop: a.value,
|
|
63
80
|
width: a.width,
|
|
@@ -73,15 +90,15 @@ const v = (t) => {
|
|
|
73
90
|
width: 80,
|
|
74
91
|
align: "right"
|
|
75
92
|
}), r;
|
|
76
|
-
},
|
|
93
|
+
}, I = () => ({
|
|
77
94
|
label: "-"
|
|
78
|
-
}), R = ({ columns: t, data: e, currency:
|
|
95
|
+
}), R = ({ columns: t, data: e, currency: o = "", channel: l = "" }) => {
|
|
79
96
|
if (!e.length || !t.length)
|
|
80
97
|
return [];
|
|
81
|
-
const
|
|
98
|
+
const n = {
|
|
82
99
|
spend: {
|
|
83
100
|
prop: "spend",
|
|
84
|
-
prefix:
|
|
101
|
+
prefix: o,
|
|
85
102
|
format: (s) => window.$fa(s, 2)
|
|
86
103
|
},
|
|
87
104
|
taps: {
|
|
@@ -124,76 +141,76 @@ const v = (t) => {
|
|
|
124
141
|
};
|
|
125
142
|
t.forEach((s, d) => {
|
|
126
143
|
a[s.property] && (a[s.property].i = d);
|
|
127
|
-
const m =
|
|
144
|
+
const m = n[s.property];
|
|
128
145
|
if (m) {
|
|
129
146
|
m.i = d;
|
|
130
|
-
let
|
|
131
|
-
e.forEach((
|
|
132
|
-
|
|
133
|
-
}),
|
|
147
|
+
let f = window.$bn(0);
|
|
148
|
+
e.forEach((b) => {
|
|
149
|
+
f = f.plus(b[s.property] || 0);
|
|
150
|
+
}), f = f.toNumber(), m.total = f, r.push(f);
|
|
134
151
|
} else
|
|
135
152
|
r.push("");
|
|
136
|
-
}), Object.keys(
|
|
137
|
-
const d =
|
|
153
|
+
}), Object.keys(n).forEach((s) => {
|
|
154
|
+
const d = n[s];
|
|
138
155
|
d.format && r[d.i] && (r[d.i] = d.format(r[d.i]));
|
|
139
156
|
});
|
|
140
|
-
const c =
|
|
157
|
+
const c = n.taps.total ? window.$fa(n.spend.total / n.taps.total) : "0.00";
|
|
141
158
|
r[a.avgCPT.i] = c;
|
|
142
|
-
const
|
|
143
|
-
if (r[a.avgCPA.i] =
|
|
144
|
-
const s =
|
|
159
|
+
const g = n.installs.total ? window.$fa(n.spend.total / n.installs.total) : "0.00";
|
|
160
|
+
if (r[a.avgCPA.i] = g, a.avgCPM.i !== void 0) {
|
|
161
|
+
const s = n.impressions.total ? window.$fa(n.spend.total / (n.impressions.total / 1e3)) : "0.00";
|
|
145
162
|
r[a.avgCPM.i] = s;
|
|
146
163
|
}
|
|
147
|
-
const p =
|
|
164
|
+
const p = n.taps.total ? window.$fa(n.installs.total / n.taps.total * 100) : "0.00";
|
|
148
165
|
r[a.cr.i] = p;
|
|
149
|
-
const h =
|
|
166
|
+
const h = n.impressions.total ? window.$fa(n.taps.total / n.impressions.total * 100) : "0.00";
|
|
150
167
|
r[a.ttr.i] = h;
|
|
151
|
-
const
|
|
152
|
-
return r[a.IPM.i] =
|
|
168
|
+
const w = n.impressions.total ? window.$fa(n.installs.total * 1e3 / n.impressions.total) : "0.00";
|
|
169
|
+
return r[a.IPM.i] = w, r;
|
|
153
170
|
}, U = (t) => {
|
|
154
171
|
const e = window.$map.asa.allMetric.obj;
|
|
155
|
-
return Object.keys(t).forEach((
|
|
156
|
-
const l = t[
|
|
157
|
-
e[
|
|
172
|
+
return Object.keys(t).forEach((o) => {
|
|
173
|
+
const l = t[o];
|
|
174
|
+
e[o] && (t[`${o}Format`] = window.$fu({ prop: o, value: l, currency: !1, obj: e }));
|
|
158
175
|
}), t;
|
|
159
|
-
}, F = ({ columns: t, data: e },
|
|
160
|
-
let r = n
|
|
176
|
+
}, F = ({ columns: t, data: e }, o) => t.length && e.length ? t.map((n) => {
|
|
177
|
+
let r = o[n.property] === void 0 ? "" : o[n.property];
|
|
161
178
|
if (r !== "")
|
|
162
179
|
try {
|
|
163
|
-
r = window.$fa(r, window.$map.asa.allMetric.obj[
|
|
180
|
+
r = window.$fa(r, window.$map.asa.allMetric.obj[n.property].precision);
|
|
164
181
|
} catch {
|
|
165
182
|
}
|
|
166
183
|
return r;
|
|
167
184
|
}) : [], H = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
168
185
|
__proto__: null,
|
|
169
|
-
useColumn:
|
|
170
|
-
useEmptyColumn:
|
|
186
|
+
useColumn: C,
|
|
187
|
+
useEmptyColumn: I,
|
|
171
188
|
useFormat: U,
|
|
172
189
|
useRemoteSummary: F,
|
|
173
|
-
useSingleSelect:
|
|
190
|
+
useSingleSelect: L,
|
|
174
191
|
useSummary: R
|
|
175
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
top: l +
|
|
192
|
+
}, Symbol.toStringTag, { value: "Module" })), x = (t, e = 88) => {
|
|
193
|
+
const o = document.querySelector("html"), { scrollTop: l } = o, n = t.getBoundingClientRect();
|
|
194
|
+
o.scrollTo({
|
|
195
|
+
top: l + n.y - e,
|
|
179
196
|
behavior: "smooth"
|
|
180
197
|
});
|
|
181
|
-
}, T = async ({ app: t, langs: e, langObj:
|
|
182
|
-
const
|
|
198
|
+
}, T = async ({ app: t, langs: e, langObj: o }) => new Promise((l) => {
|
|
199
|
+
const n = [];
|
|
183
200
|
e.forEach((i) => {
|
|
184
|
-
i.use &&
|
|
185
|
-
}), globalThis.$langs =
|
|
201
|
+
i.use && n.push(i);
|
|
202
|
+
}), globalThis.$langs = n;
|
|
186
203
|
let r = {};
|
|
187
|
-
globalThis.$getType(
|
|
188
|
-
`Language object "${
|
|
204
|
+
globalThis.$getType(o) === "Object" ? r = o : globalThis.$getType(o) === "String" && (globalThis.$store.common()[o] ? r = globalThis.$store.common()[o] : console.warn(
|
|
205
|
+
`Language object "${o}" not found in store.common()`
|
|
189
206
|
));
|
|
190
207
|
const a = (i, c) => {
|
|
191
208
|
if (i)
|
|
192
209
|
if (c && globalThis.$getType(c) === "Object") {
|
|
193
|
-
let
|
|
210
|
+
let g = r[i] || i;
|
|
194
211
|
return Object.keys(c).forEach((p) => {
|
|
195
|
-
|
|
196
|
-
}),
|
|
212
|
+
g[`$${p}$`] = c[p];
|
|
213
|
+
}), g;
|
|
197
214
|
} else
|
|
198
215
|
return r[i] || i;
|
|
199
216
|
else
|
|
@@ -202,9 +219,9 @@ const v = (t) => {
|
|
|
202
219
|
String.prototype.$l = function() {
|
|
203
220
|
return a(this);
|
|
204
221
|
}, globalThis.$l = a, t.config.globalProperties.$l = a, l();
|
|
205
|
-
}),
|
|
222
|
+
}), B = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
206
223
|
__proto__: null,
|
|
207
|
-
pageScrollTo:
|
|
224
|
+
pageScrollTo: x,
|
|
208
225
|
useLang: T
|
|
209
226
|
}, Symbol.toStringTag, { value: "Module" })), u = [];
|
|
210
227
|
let y = 0;
|
|
@@ -215,39 +232,39 @@ const $ = function(t) {
|
|
|
215
232
|
return;
|
|
216
233
|
}
|
|
217
234
|
}), u.length && window.requestAnimationFrame($);
|
|
218
|
-
},
|
|
235
|
+
}, k = function(t, e = 1e3) {
|
|
219
236
|
return y++, u.push({
|
|
220
237
|
cb: t,
|
|
221
238
|
time: e,
|
|
222
239
|
lastTime: 0,
|
|
223
240
|
id: y
|
|
224
241
|
}), u.length === 1 && window.requestAnimationFrame($), y;
|
|
225
|
-
},
|
|
242
|
+
}, z = function(t) {
|
|
226
243
|
for (let e = 0; e < u.length; e++)
|
|
227
244
|
if (u[e].id === t) {
|
|
228
245
|
u.splice(e, 1);
|
|
229
246
|
break;
|
|
230
247
|
}
|
|
231
|
-
},
|
|
248
|
+
}, q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
232
249
|
__proto__: null,
|
|
233
|
-
clearRaf:
|
|
234
|
-
useRaf:
|
|
250
|
+
clearRaf: z,
|
|
251
|
+
useRaf: k
|
|
235
252
|
}, Symbol.toStringTag, { value: "Module" })), W = async (t) => {
|
|
236
253
|
if (!document.getElementById("colorfulIcon"))
|
|
237
254
|
return new Promise((e) => {
|
|
238
|
-
const
|
|
239
|
-
|
|
255
|
+
const o = document.createElement("script");
|
|
256
|
+
o.id = "colorfulIcon", o.type = "text/javascript", o.src = t || globalThis.config.colorfulIcon, document.head.appendChild(o), e();
|
|
240
257
|
});
|
|
241
258
|
}, G = async (t = {}) => {
|
|
242
259
|
if (!globalThis.$langs)
|
|
243
260
|
return new Promise(async (e) => {
|
|
244
|
-
const { theme:
|
|
261
|
+
const { theme: o = "light", currentLang: l, app: n } = t, r = document.documentElement, a = l || localStorage.getItem("lang") || globalThis.config.lang || "en_us";
|
|
245
262
|
r.classList.add(a);
|
|
246
263
|
const i = a.split("_");
|
|
247
264
|
r.setAttribute("lang", `${i[0]}-${i[1].toUpperCase()}`);
|
|
248
265
|
const c = i.includes("ar") ? "rtl" : "ltr";
|
|
249
|
-
if (r.setAttribute("dir", c), r.classList.add(localStorage.getItem("theme") ||
|
|
250
|
-
await T({ app:
|
|
266
|
+
if (r.setAttribute("dir", c), r.classList.add(localStorage.getItem("theme") || o), n)
|
|
267
|
+
await T({ app: n, langs: globalThis.config.langs || [] });
|
|
251
268
|
else
|
|
252
269
|
throw new Error(
|
|
253
270
|
"app is not defined, please check your vue app create from createApp() function"
|
|
@@ -259,7 +276,7 @@ const $ = function(t) {
|
|
|
259
276
|
throw new Error(
|
|
260
277
|
"globalThis.config is not defined, please create globalThis.config frist"
|
|
261
278
|
);
|
|
262
|
-
const { availWidth: t, availHeight: e } = globalThis.screen, { clientHeight:
|
|
279
|
+
const { availWidth: t, availHeight: e } = globalThis.screen, { clientHeight: o } = globalThis.document.body, l = globalThis.config.page.paddingLeft || 32, n = globalThis.config.page.paddingRight || 32, r = t - l - n, a = globalThis.config.page.frameHeader || 82, i = globalThis.config.page.frameFooter || 36, c = o - a - i, g = globalThis.config.page.contentPaddingLeft || 16, p = globalThis.config.page.contentPaddingLeft || 16, h = r - g - p, w = globalThis.config.page.tableHeader || 56, s = globalThis.config.page.tableFooter || 56, d = o - a - w - s, m = globalThis.config.page.drawerHeader || 64, f = o - m, b = globalThis.navigator.userAgent.match(
|
|
263
280
|
/(phone|pad|pod|iPhone|iPod|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
|
|
264
281
|
) ? "h5" : "pc", P = /iPhone|iPad|iPod/i.test(globalThis.navigator.userAgent);
|
|
265
282
|
return globalThis.config.options = {
|
|
@@ -269,8 +286,8 @@ const $ = function(t) {
|
|
|
269
286
|
pageHeight: c,
|
|
270
287
|
contentWidth: h,
|
|
271
288
|
tableHeight: d,
|
|
272
|
-
drawerHeight:
|
|
273
|
-
device:
|
|
289
|
+
drawerHeight: f,
|
|
290
|
+
device: b,
|
|
274
291
|
isIOS: P
|
|
275
292
|
}, globalThis.config.options;
|
|
276
293
|
}, Q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -287,42 +304,42 @@ const $ = function(t) {
|
|
|
287
304
|
e && (e.style.display = "none");
|
|
288
305
|
} else {
|
|
289
306
|
const e = document.querySelectorAll(".echart-tooltip");
|
|
290
|
-
e != null && e.length && e.forEach((
|
|
307
|
+
e != null && e.length && e.forEach((o) => o.remove());
|
|
291
308
|
}
|
|
292
309
|
}, K = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
293
310
|
__proto__: null,
|
|
294
311
|
clearEchartTooltip: V,
|
|
295
312
|
hideEchartTooltip: J
|
|
296
313
|
}, Symbol.toStringTag, { value: "Module" })), X = {
|
|
297
|
-
...
|
|
298
|
-
...
|
|
314
|
+
...E,
|
|
315
|
+
...A,
|
|
299
316
|
...H,
|
|
300
|
-
...
|
|
301
|
-
...
|
|
317
|
+
...B,
|
|
318
|
+
...q,
|
|
302
319
|
...Q,
|
|
303
320
|
...K
|
|
304
321
|
};
|
|
305
322
|
export {
|
|
306
323
|
V as clearEchartTooltip,
|
|
307
|
-
|
|
324
|
+
z as clearRaf,
|
|
308
325
|
X as default,
|
|
309
326
|
j as download,
|
|
310
327
|
J as hideEchartTooltip,
|
|
311
328
|
W as initColorfulIcon,
|
|
312
329
|
G as initLang,
|
|
313
330
|
N as initOptions,
|
|
314
|
-
|
|
331
|
+
M as loadImage,
|
|
315
332
|
O as loadVideo,
|
|
316
|
-
|
|
333
|
+
x as pageScrollTo,
|
|
317
334
|
v as useAgeFormat,
|
|
318
335
|
S as useAgeValue,
|
|
319
|
-
|
|
320
|
-
|
|
336
|
+
C as useColumn,
|
|
337
|
+
I as useEmptyColumn,
|
|
321
338
|
U as useFormat,
|
|
322
339
|
_ as useGenderFormat,
|
|
323
340
|
T as useLang,
|
|
324
|
-
|
|
341
|
+
k as useRaf,
|
|
325
342
|
F as useRemoteSummary,
|
|
326
|
-
|
|
343
|
+
L as useSingleSelect,
|
|
327
344
|
R as useSummary
|
|
328
345
|
};
|