magtool 1.5.35 → 1.5.37
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 +1109 -1105
- package/dist/composition.js +54 -50
- 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 n, a;
|
|
4
4
|
if (e != null && e.included) {
|
|
5
|
-
const { minAge:
|
|
6
|
-
|
|
5
|
+
const { minAge: o, maxAge: r } = e.included[0] || {};
|
|
6
|
+
o ? n = o : n = "all", r ? a = r : a = "all";
|
|
7
7
|
}
|
|
8
|
-
return a === "all" ?
|
|
8
|
+
return a === "all" ? n === "all" ? "All" : `${n}~65+` : `${n}~${a}`;
|
|
9
9
|
}, S = (t, e) => t === "all" ? null : e === 65 ? {
|
|
10
10
|
included: [
|
|
11
11
|
{
|
|
@@ -27,10 +27,14 @@ const v = (t) => {
|
|
|
27
27
|
useAgeFormat: v,
|
|
28
28
|
useAgeValue: S,
|
|
29
29
|
useGenderFormat: _
|
|
30
|
-
}, Symbol.toStringTag, { value: "Module" })), M = (t) => new Promise((e,
|
|
30
|
+
}, Symbol.toStringTag, { value: "Module" })), M = (t) => new Promise((e, n) => {
|
|
31
31
|
const a = new Image();
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
try {
|
|
33
|
+
a.src = window.$getType(t) === "String" ? t : URL.createObjectURL(t), a.onload = () => e(a), a.onerror = () => n(new Error("Could not load image"));
|
|
34
|
+
} catch (o) {
|
|
35
|
+
console.error(`${{ error: o }}. Error Url: ${t}`);
|
|
36
|
+
}
|
|
37
|
+
}), O = (t) => new Promise((e, n) => {
|
|
34
38
|
const a = document.createElement("video");
|
|
35
39
|
a.preload = "metadata", window.$getType(t) === "String" ? a.src = t : a.src = URL.createObjectURL(t), a.onloadedmetadata = () => {
|
|
36
40
|
window.URL.revokeObjectURL(t), e(a);
|
|
@@ -38,9 +42,9 @@ const v = (t) => {
|
|
|
38
42
|
}), j = async ({
|
|
39
43
|
type: t,
|
|
40
44
|
url: e,
|
|
41
|
-
headers:
|
|
45
|
+
headers: n,
|
|
42
46
|
data: a,
|
|
43
|
-
name:
|
|
47
|
+
name: o,
|
|
44
48
|
error: r = () => {
|
|
45
49
|
}
|
|
46
50
|
}) => {
|
|
@@ -55,13 +59,13 @@ const v = (t) => {
|
|
|
55
59
|
l.href = URL.createObjectURL(c);
|
|
56
60
|
} else if (t === "excel") {
|
|
57
61
|
const c = await fetch(e, {
|
|
58
|
-
headers:
|
|
62
|
+
headers: n
|
|
59
63
|
}).then((g) => g.blob());
|
|
60
64
|
if (!(c != null && c.type.includes("sheet")))
|
|
61
65
|
throw r(), new Error("excel does not exist");
|
|
62
66
|
l.href = URL.createObjectURL(c);
|
|
63
67
|
}
|
|
64
|
-
i = new MouseEvent("click"), l.download =
|
|
68
|
+
i = new MouseEvent("click"), l.download = o || "download", l.dispatchEvent(i), URL.revokeObjectURL(l.url);
|
|
65
69
|
} finally {
|
|
66
70
|
l && l.parentNode && l.parentNode.removeChild(l), l = null, i = null;
|
|
67
71
|
}
|
|
@@ -70,14 +74,14 @@ const v = (t) => {
|
|
|
70
74
|
download: j,
|
|
71
75
|
loadImage: M,
|
|
72
76
|
loadVideo: O
|
|
73
|
-
}, Symbol.toStringTag, { value: "Module" })), C = ({ table: t, key: e, form:
|
|
77
|
+
}, Symbol.toStringTag, { value: "Module" })), C = ({ table: t, key: e, form: n, value: a, cb: o = () => {
|
|
74
78
|
} }) => {
|
|
75
79
|
const r = t.getSelectionRows();
|
|
76
|
-
r.length > 1 ? (t.clearSelection(), t.toggleRowSelection(r[1], "selected"),
|
|
80
|
+
r.length > 1 ? (t.clearSelection(), t.toggleRowSelection(r[1], "selected"), n[a] = r[1][e]) : r.length === 1 && (n[a] = r[0][e]), o();
|
|
77
81
|
}, L = (t = {}) => {
|
|
78
|
-
let { sortable: e = !0, empty:
|
|
79
|
-
a && (
|
|
80
|
-
const r =
|
|
82
|
+
let { sortable: e = !0, empty: n = !1, mmp: a = !1 } = t, o = window.$map.asa.asaMetric.all;
|
|
83
|
+
a && (o = o.concat(window.$map.asa.mmpMetric.all));
|
|
84
|
+
const r = o.map((l, i) => ({
|
|
81
85
|
label: l.label,
|
|
82
86
|
prop: l.value,
|
|
83
87
|
width: l.width,
|
|
@@ -95,13 +99,13 @@ const v = (t) => {
|
|
|
95
99
|
}), r;
|
|
96
100
|
}, I = () => ({
|
|
97
101
|
label: "-"
|
|
98
|
-
}), R = ({ columns: t, data: e, currency:
|
|
102
|
+
}), R = ({ columns: t, data: e, currency: n = "", channel: a = "" }) => {
|
|
99
103
|
if (!e.length || !t.length)
|
|
100
104
|
return [];
|
|
101
|
-
const
|
|
105
|
+
const o = {
|
|
102
106
|
spend: {
|
|
103
107
|
prop: "spend",
|
|
104
|
-
prefix:
|
|
108
|
+
prefix: n,
|
|
105
109
|
format: (s) => window.$fa(s, 2)
|
|
106
110
|
},
|
|
107
111
|
taps: {
|
|
@@ -144,7 +148,7 @@ const v = (t) => {
|
|
|
144
148
|
};
|
|
145
149
|
t.forEach((s, d) => {
|
|
146
150
|
l[s.property] && (l[s.property].i = d);
|
|
147
|
-
const m =
|
|
151
|
+
const m = o[s.property];
|
|
148
152
|
if (m) {
|
|
149
153
|
m.i = d;
|
|
150
154
|
let f = window.$bn(0);
|
|
@@ -153,34 +157,34 @@ const v = (t) => {
|
|
|
153
157
|
}), f = f.toNumber(), m.total = f, r.push(f);
|
|
154
158
|
} else
|
|
155
159
|
r.push("");
|
|
156
|
-
}), Object.keys(
|
|
157
|
-
const d =
|
|
160
|
+
}), Object.keys(o).forEach((s) => {
|
|
161
|
+
const d = o[s];
|
|
158
162
|
d.format && r[d.i] && (r[d.i] = d.format(r[d.i]));
|
|
159
163
|
});
|
|
160
|
-
const c =
|
|
164
|
+
const c = o.taps.total ? window.$fa(o.spend.total / o.taps.total) : "0.00";
|
|
161
165
|
r[l.avgCPT.i] = c;
|
|
162
|
-
const g =
|
|
166
|
+
const g = o.installs.total ? window.$fa(o.spend.total / o.installs.total) : "0.00";
|
|
163
167
|
if (r[l.avgCPA.i] = g, l.avgCPM.i !== void 0) {
|
|
164
|
-
const s =
|
|
168
|
+
const s = o.impressions.total ? window.$fa(o.spend.total / (o.impressions.total / 1e3)) : "0.00";
|
|
165
169
|
r[l.avgCPM.i] = s;
|
|
166
170
|
}
|
|
167
|
-
const p =
|
|
171
|
+
const p = o.taps.total ? window.$fa(o.installs.total / o.taps.total * 100) : "0.00";
|
|
168
172
|
r[l.cr.i] = p;
|
|
169
|
-
const h =
|
|
173
|
+
const h = o.impressions.total ? window.$fa(o.taps.total / o.impressions.total * 100) : "0.00";
|
|
170
174
|
r[l.ttr.i] = h;
|
|
171
|
-
const w =
|
|
175
|
+
const w = o.impressions.total ? window.$fa(o.installs.total * 1e3 / o.impressions.total) : "0.00";
|
|
172
176
|
return r[l.IPM.i] = w, r;
|
|
173
177
|
}, U = (t) => {
|
|
174
178
|
const e = window.$map.asa.allMetric.obj;
|
|
175
|
-
return Object.keys(t).forEach((
|
|
176
|
-
const a = t[
|
|
177
|
-
e[
|
|
179
|
+
return Object.keys(t).forEach((n) => {
|
|
180
|
+
const a = t[n];
|
|
181
|
+
e[n] && (t[`${n}Format`] = window.$fu({ prop: n, value: a, currency: !1, obj: e }));
|
|
178
182
|
}), t;
|
|
179
|
-
}, F = ({ columns: t, data: e },
|
|
180
|
-
let r = o
|
|
183
|
+
}, F = ({ columns: t, data: e }, n) => t.length && e.length ? t.map((o) => {
|
|
184
|
+
let r = n[o.property] === void 0 ? "" : n[o.property];
|
|
181
185
|
if (r !== "")
|
|
182
186
|
try {
|
|
183
|
-
r = window.$fa(r, window.$map.asa.allMetric.obj[
|
|
187
|
+
r = window.$fa(r, window.$map.asa.allMetric.obj[o.property].precision);
|
|
184
188
|
} catch {
|
|
185
189
|
}
|
|
186
190
|
return r;
|
|
@@ -193,19 +197,19 @@ const v = (t) => {
|
|
|
193
197
|
useSingleSelect: C,
|
|
194
198
|
useSummary: R
|
|
195
199
|
}, Symbol.toStringTag, { value: "Module" })), x = (t, e = 96) => {
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
top: a +
|
|
200
|
+
const n = document.querySelector("html"), { scrollTop: a } = n, o = t.getBoundingClientRect();
|
|
201
|
+
n.scrollTo({
|
|
202
|
+
top: a + o.y - e,
|
|
199
203
|
behavior: "smooth"
|
|
200
204
|
});
|
|
201
|
-
}, T = async ({ app: t, langs: e, langObj:
|
|
202
|
-
const
|
|
205
|
+
}, T = async ({ app: t, langs: e, langObj: n }) => new Promise((a) => {
|
|
206
|
+
const o = [];
|
|
203
207
|
e.forEach((i) => {
|
|
204
|
-
i.use &&
|
|
205
|
-
}), globalThis.$langs =
|
|
208
|
+
i.use && o.push(i);
|
|
209
|
+
}), globalThis.$langs = o;
|
|
206
210
|
let r = {};
|
|
207
|
-
globalThis.$getType(
|
|
208
|
-
`Language object "${
|
|
211
|
+
globalThis.$getType(n) === "Object" ? r = n : globalThis.$getType(n) === "String" && (globalThis.$store.common()[n] ? r = globalThis.$store.common()[n] : console.warn(
|
|
212
|
+
`Language object "${n}" not found in store.common()`
|
|
209
213
|
));
|
|
210
214
|
const l = (i, c) => {
|
|
211
215
|
if (i)
|
|
@@ -255,19 +259,19 @@ const $ = function(t) {
|
|
|
255
259
|
}, Symbol.toStringTag, { value: "Module" })), W = async (t) => {
|
|
256
260
|
if (!document.getElementById("colorfulIcon"))
|
|
257
261
|
return new Promise((e) => {
|
|
258
|
-
const
|
|
259
|
-
|
|
262
|
+
const n = document.createElement("script");
|
|
263
|
+
n.id = "colorfulIcon", n.type = "text/javascript", n.src = t || globalThis.config.colorfulIcon, document.head.appendChild(n), e();
|
|
260
264
|
});
|
|
261
265
|
}, N = async (t = {}) => {
|
|
262
266
|
if (!globalThis.$langs)
|
|
263
267
|
return new Promise(async (e) => {
|
|
264
|
-
const { theme:
|
|
268
|
+
const { theme: n = "light", currentLang: a, app: o } = t, r = document.documentElement, l = a || localStorage.getItem("lang") || globalThis.config.lang || "en_us";
|
|
265
269
|
r.classList.add(l);
|
|
266
270
|
const i = l.split("_");
|
|
267
271
|
r.setAttribute("lang", `${i[0]}-${i[1].toUpperCase()}`);
|
|
268
272
|
const c = i.includes("ar") ? "rtl" : "ltr";
|
|
269
|
-
if (r.setAttribute("dir", c), r.classList.add(localStorage.getItem("theme") ||
|
|
270
|
-
await T({ app:
|
|
273
|
+
if (r.setAttribute("dir", c), r.classList.add(localStorage.getItem("theme") || n), o)
|
|
274
|
+
await T({ app: o, langs: globalThis.config.langs || [] });
|
|
271
275
|
else
|
|
272
276
|
throw new Error(
|
|
273
277
|
"app is not defined, please check your vue app create from createApp() function"
|
|
@@ -279,7 +283,7 @@ const $ = function(t) {
|
|
|
279
283
|
throw new Error(
|
|
280
284
|
"globalThis.config is not defined, please create globalThis.config frist"
|
|
281
285
|
);
|
|
282
|
-
const { availWidth: t, availHeight: e } = globalThis.screen, { clientHeight:
|
|
286
|
+
const { availWidth: t, availHeight: e } = globalThis.screen, { clientHeight: n } = globalThis.document.body, a = globalThis.config.page.paddingLeft || 32, o = globalThis.config.page.paddingRight || 32, r = t - a - o, l = globalThis.config.page.frameHeader || 82, i = globalThis.config.page.frameFooter || 36, c = n - l - 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 = n - l - w - s, m = globalThis.config.page.drawerHeader || 64, f = n - m, b = globalThis.navigator.userAgent.match(
|
|
283
287
|
/(phone|pad|pod|iPhone|iPod|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
|
|
284
288
|
) ? "h5" : "pc", P = /iPhone|iPad|iPod/i.test(globalThis.navigator.userAgent);
|
|
285
289
|
return globalThis.config.options = {
|
|
@@ -307,7 +311,7 @@ const $ = function(t) {
|
|
|
307
311
|
e && (e.style.display = "none");
|
|
308
312
|
} else {
|
|
309
313
|
const e = document.querySelectorAll(".echart-tooltip");
|
|
310
|
-
e != null && e.length && e.forEach((
|
|
314
|
+
e != null && e.length && e.forEach((n) => n.remove());
|
|
311
315
|
}
|
|
312
316
|
}, K = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
313
317
|
__proto__: null,
|