magtool 1.3.6 → 1.3.7
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/composition.js +104 -116
- package/package.json +1 -1
package/dist/composition.js
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
const
|
|
2
|
-
const { age:
|
|
1
|
+
const v = (e) => {
|
|
2
|
+
const { age: t } = e || {};
|
|
3
3
|
let n, r;
|
|
4
|
-
if (
|
|
5
|
-
const { minAge: o, maxAge: a } =
|
|
4
|
+
if (t != null && t.included) {
|
|
5
|
+
const { minAge: o, maxAge: a } = t.included[0] || {};
|
|
6
6
|
o ? n = o : n = "all", a ? r = a : r = "all";
|
|
7
7
|
}
|
|
8
8
|
return r === "all" ? n === "all" ? "All" : `${n}~65+` : `${n}~${r}`;
|
|
9
|
-
},
|
|
9
|
+
}, C = (e, t) => e === "all" ? null : t === 65 ? {
|
|
10
10
|
included: [
|
|
11
11
|
{
|
|
12
|
-
minAge:
|
|
12
|
+
minAge: e
|
|
13
13
|
}
|
|
14
14
|
]
|
|
15
15
|
} : {
|
|
16
16
|
included: [
|
|
17
17
|
{
|
|
18
|
-
minAge:
|
|
19
|
-
maxAge:
|
|
18
|
+
minAge: e,
|
|
19
|
+
maxAge: t
|
|
20
20
|
}
|
|
21
21
|
]
|
|
22
|
-
},
|
|
23
|
-
const { gender:
|
|
24
|
-
return
|
|
25
|
-
},
|
|
22
|
+
}, I = (e) => {
|
|
23
|
+
const { gender: t } = e || {};
|
|
24
|
+
return t != null && t.included ? t.included[0] : null;
|
|
25
|
+
}, S = { useAgeFormat: v, useAgeValue: C, useGenderFormat: I }, A = (e) => new Promise((t, n) => {
|
|
26
26
|
const r = new Image();
|
|
27
|
-
r.src = window.$getType(
|
|
28
|
-
}),
|
|
27
|
+
r.src = window.$getType(e) === "String" ? e : URL.createObjectURL(e), r.onload = () => t(r), r.onerror = () => n(new Error("Could not load image"));
|
|
28
|
+
}), L = (e) => new Promise((t, n) => {
|
|
29
29
|
const r = document.createElement("video");
|
|
30
|
-
r.preload = "metadata", window.$getType(
|
|
31
|
-
window.URL.revokeObjectURL(
|
|
30
|
+
r.preload = "metadata", window.$getType(e) === "String" ? r.src = e : r.src = URL.createObjectURL(e), r.onloadedmetadata = () => {
|
|
31
|
+
window.URL.revokeObjectURL(e), t(r);
|
|
32
32
|
};
|
|
33
|
-
}),
|
|
33
|
+
}), M = ({ type: e = "csv", data: t, name: n }) => {
|
|
34
34
|
let r = document.createElement("a");
|
|
35
|
-
if (
|
|
36
|
-
const a = new Blob(["\uFEFF" +
|
|
35
|
+
if (e === "csv") {
|
|
36
|
+
const a = new Blob(["\uFEFF" + t], {
|
|
37
37
|
type: "text/csv,charset=UTF-8"
|
|
38
38
|
});
|
|
39
39
|
r.href = URL.createObjectURL(a);
|
|
40
40
|
}
|
|
41
41
|
let o = new MouseEvent("click");
|
|
42
|
-
r.download = n || "download", r.dispatchEvent(o), (
|
|
43
|
-
},
|
|
42
|
+
r.download = n || "download", r.dispatchEvent(o), (e === "csv" || e === "video") && URL.revokeObjectURL(r.url), r = null, o = null;
|
|
43
|
+
}, R = { loadImage: A, loadVideo: L, download: M }, E = ({ table: e, key: t, form: n, value: r, cb: o = () => {
|
|
44
44
|
} }) => {
|
|
45
|
-
const a =
|
|
46
|
-
a.length > 1 ? (
|
|
47
|
-
},
|
|
48
|
-
let { sortable:
|
|
45
|
+
const a = e.getSelectionRows();
|
|
46
|
+
a.length > 1 ? (e.clearSelection(), e.toggleRowSelection(a[1], "selected"), n[r] = a[1][t]) : a.length === 1 && (n[r] = a[0][t]), o();
|
|
47
|
+
}, O = (e = {}) => {
|
|
48
|
+
let { sortable: t = !0, empty: n = !1, mmp: r = !1 } = e, o = window.$map.asa.asaMetric.all;
|
|
49
49
|
r && (o = o.concat(window.$map.asa.mmpMetric.all));
|
|
50
50
|
const a = o.map((s, i) => ({
|
|
51
51
|
label: s.label,
|
|
52
52
|
prop: s.value,
|
|
53
53
|
width: s.width,
|
|
54
|
-
sortable:
|
|
54
|
+
sortable: t,
|
|
55
55
|
type: s.type,
|
|
56
56
|
align: s.align,
|
|
57
57
|
visible: s.visible,
|
|
@@ -63,10 +63,10 @@ const C = (t) => {
|
|
|
63
63
|
width: 80,
|
|
64
64
|
align: "right"
|
|
65
65
|
}), a;
|
|
66
|
-
},
|
|
66
|
+
}, j = () => ({
|
|
67
67
|
label: "-"
|
|
68
|
-
}),
|
|
69
|
-
if (!
|
|
68
|
+
}), U = ({ columns: e, data: t, currency: n = "", channel: r = "" }) => {
|
|
69
|
+
if (!t.length || !e.length)
|
|
70
70
|
return [];
|
|
71
71
|
const o = {
|
|
72
72
|
spend: {
|
|
@@ -112,14 +112,14 @@ const C = (t) => {
|
|
|
112
112
|
mmpInstalls: {},
|
|
113
113
|
mmpCPI: {}
|
|
114
114
|
};
|
|
115
|
-
|
|
115
|
+
e.forEach((l, d) => {
|
|
116
116
|
s[l.property] && (s[l.property].i = d);
|
|
117
117
|
const m = o[l.property];
|
|
118
118
|
if (m) {
|
|
119
119
|
m.i = d;
|
|
120
120
|
let g = window.$bigNumber(0);
|
|
121
|
-
|
|
122
|
-
g = g.plus(
|
|
121
|
+
t.forEach((b) => {
|
|
122
|
+
g = g.plus(b[l.property] || 0);
|
|
123
123
|
}), g = g.toNumber(), m.total = g, a.push(g);
|
|
124
124
|
} else
|
|
125
125
|
a.push("");
|
|
@@ -129,24 +129,24 @@ const C = (t) => {
|
|
|
129
129
|
});
|
|
130
130
|
const c = o.taps.total ? window.$fa(o.spend.total / o.taps.total) : "0.00";
|
|
131
131
|
a[s.avgCPT.i] = c;
|
|
132
|
-
const
|
|
133
|
-
if (a[s.avgCPA.i] =
|
|
132
|
+
const f = o.installs.total ? window.$fa(o.spend.total / o.installs.total) : "0.00";
|
|
133
|
+
if (a[s.avgCPA.i] = f, s.avgCPM.i !== void 0) {
|
|
134
134
|
const l = o.impressions.total ? window.$fa(o.spend.total / (o.impressions.total / 1e3)) : "0.00";
|
|
135
135
|
a[s.avgCPM.i] = l;
|
|
136
136
|
}
|
|
137
137
|
const p = o.taps.total ? window.$fa(o.installs.total / o.taps.total * 100) : "0.00";
|
|
138
138
|
a[s.cr.i] = p;
|
|
139
|
-
const
|
|
140
|
-
a[s.ttr.i] =
|
|
141
|
-
const
|
|
142
|
-
return a[s.IPM.i] =
|
|
143
|
-
},
|
|
144
|
-
const
|
|
145
|
-
return Object.keys(
|
|
146
|
-
const r =
|
|
147
|
-
|
|
148
|
-
}),
|
|
149
|
-
},
|
|
139
|
+
const h = o.impressions.total ? window.$fa(o.taps.total / o.impressions.total * 100) : "0.00";
|
|
140
|
+
a[s.ttr.i] = h;
|
|
141
|
+
const w = o.impressions.total ? window.$fa(o.installs.total * 1e3 / o.impressions.total) : "0.00";
|
|
142
|
+
return a[s.IPM.i] = w, a;
|
|
143
|
+
}, F = (e) => {
|
|
144
|
+
const t = window.$map.asa.allMetric.obj;
|
|
145
|
+
return Object.keys(e).forEach((n) => {
|
|
146
|
+
const r = e[n];
|
|
147
|
+
t[n] && (e[`${n}Format`] = window.$fu({ prop: n, value: r, currency: !1, obj: t }));
|
|
148
|
+
}), e;
|
|
149
|
+
}, H = ({ columns: e, data: t }, n) => e.length && t.length ? e.map((o) => {
|
|
150
150
|
let a = n[o.property] === void 0 ? "" : n[o.property];
|
|
151
151
|
if (a !== "")
|
|
152
152
|
try {
|
|
@@ -154,15 +154,15 @@ const C = (t) => {
|
|
|
154
154
|
} catch {
|
|
155
155
|
}
|
|
156
156
|
return a;
|
|
157
|
-
}) : [],
|
|
158
|
-
const n = document.querySelector("html"), { scrollTop: r } = n, o =
|
|
157
|
+
}) : [], _ = { useSingleSelect: E, useColumn: O, useEmptyColumn: j, useRemoteSummary: H, useSummary: U, useFormat: F }, B = (e, t = 88) => {
|
|
158
|
+
const n = document.querySelector("html"), { scrollTop: r } = n, o = e.getBoundingClientRect();
|
|
159
159
|
n.scrollTo({
|
|
160
|
-
top: r + o.y -
|
|
160
|
+
top: r + o.y - t,
|
|
161
161
|
behavior: "smooth"
|
|
162
162
|
});
|
|
163
|
-
},
|
|
163
|
+
}, T = async ({ app: e, langs: t, langObj: n }) => new Promise((r) => {
|
|
164
164
|
const o = [];
|
|
165
|
-
|
|
165
|
+
t.forEach((i) => {
|
|
166
166
|
i.use && o.push(i);
|
|
167
167
|
}), globalThis.$langs = o;
|
|
168
168
|
let a = {};
|
|
@@ -172,10 +172,10 @@ const C = (t) => {
|
|
|
172
172
|
const s = (i, c) => {
|
|
173
173
|
if (i)
|
|
174
174
|
if (c && globalThis.$getType(c) === "Object") {
|
|
175
|
-
let
|
|
175
|
+
let f = a[i] || i;
|
|
176
176
|
return Object.keys(c).forEach((p) => {
|
|
177
|
-
|
|
178
|
-
}),
|
|
177
|
+
f[`$${p}$`] = c[p];
|
|
178
|
+
}), f;
|
|
179
179
|
} else
|
|
180
180
|
return a[i] || i;
|
|
181
181
|
else
|
|
@@ -183,91 +183,79 @@ const C = (t) => {
|
|
|
183
183
|
};
|
|
184
184
|
String.prototype.$l = function() {
|
|
185
185
|
return s(this);
|
|
186
|
-
}, globalThis.$l = s,
|
|
187
|
-
}),
|
|
186
|
+
}, globalThis.$l = s, e.config.globalProperties.$l = s, r();
|
|
187
|
+
}), k = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
188
188
|
__proto__: null,
|
|
189
|
-
pageScrollTo:
|
|
190
|
-
useLang:
|
|
191
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
192
|
-
let
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
if (
|
|
196
|
-
|
|
189
|
+
pageScrollTo: B,
|
|
190
|
+
useLang: T
|
|
191
|
+
}, Symbol.toStringTag, { value: "Module" })), u = [];
|
|
192
|
+
let $ = 0;
|
|
193
|
+
const y = function(e) {
|
|
194
|
+
u.forEach((t) => {
|
|
195
|
+
if (t.time === void 0 || t.lastTime === 0 || e - t.lastTime >= t.time) {
|
|
196
|
+
t.cb(e), t.lastTime = e;
|
|
197
197
|
return;
|
|
198
198
|
}
|
|
199
|
-
}),
|
|
200
|
-
},
|
|
201
|
-
return
|
|
202
|
-
cb:
|
|
203
|
-
time:
|
|
199
|
+
}), u.length && window.requestAnimationFrame(y);
|
|
200
|
+
}, x = function(e, t = 1e3) {
|
|
201
|
+
return $++, u.push({
|
|
202
|
+
cb: e,
|
|
203
|
+
time: t,
|
|
204
204
|
lastTime: 0,
|
|
205
|
-
id:
|
|
206
|
-
}),
|
|
207
|
-
},
|
|
208
|
-
for (let
|
|
209
|
-
if (
|
|
210
|
-
|
|
205
|
+
id: $
|
|
206
|
+
}), u.length === 1 && window.requestAnimationFrame(y), $;
|
|
207
|
+
}, W = function(e) {
|
|
208
|
+
for (let t = 0; t < u.length; t++)
|
|
209
|
+
if (u[t].id === e) {
|
|
210
|
+
u.splice(t, 1);
|
|
211
211
|
break;
|
|
212
212
|
}
|
|
213
|
-
},
|
|
213
|
+
}, q = { useRaf: x, clearRaf: W }, N = async (e) => new Promise((t) => {
|
|
214
214
|
if (document.getElementById("colorfulIcon"))
|
|
215
215
|
return;
|
|
216
216
|
const n = document.createElement("script");
|
|
217
|
-
n.id = "colorfulIcon", n.type = "text/javascript", n.src =
|
|
218
|
-
}),
|
|
219
|
-
const { theme: n = "light", currentLang: r, app: o } =
|
|
217
|
+
n.id = "colorfulIcon", n.type = "text/javascript", n.src = e || globalThis.config.colorfulIcon, document.head.appendChild(n), t();
|
|
218
|
+
}), z = async (e = {}) => new Promise(async (t) => {
|
|
219
|
+
const { theme: n = "light", currentLang: r, app: o } = e, a = document.documentElement, s = r || localStorage.getItem("lang") || globalThis.config.lang || "en_us";
|
|
220
220
|
a.classList.add(s);
|
|
221
221
|
const i = s.split("_");
|
|
222
222
|
a.setAttribute("lang", `${i[0]}-${i[1].toUpperCase()}`);
|
|
223
223
|
const c = i.includes("ar") ? "rtl" : "ltr";
|
|
224
224
|
if (a.setAttribute("dir", c), a.classList.add(localStorage.getItem("theme") || n), o)
|
|
225
|
-
await
|
|
225
|
+
await T({ app: o, langs: globalThis.config.langs || [] });
|
|
226
226
|
else
|
|
227
227
|
throw new Error(
|
|
228
228
|
"app is not defined, please check your vue app create from createApp() function"
|
|
229
229
|
);
|
|
230
|
-
|
|
231
|
-
}),
|
|
232
|
-
const { availWidth: e, availHeight:
|
|
230
|
+
t();
|
|
231
|
+
}), G = () => {
|
|
232
|
+
const { availWidth: e, availHeight: t } = globalThis.screen, { clientHeight: n } = globalThis.document.body, r = globalThis.config.page.paddingLeft || 32, o = globalThis.config.page.paddingRight || 32, a = e - r - o, s = globalThis.config.page.frameHeader || 82, i = globalThis.config.page.frameFooter || 36, c = n - s - i, f = globalThis.config.page.contentPaddingLeft || 16, p = globalThis.config.page.contentPaddingLeft || 16, h = a - f - p, w = globalThis.config.page.tableHeader || 56, l = globalThis.config.page.tableFooter || 56, d = n - s - w - l, m = globalThis.config.page.drawerHeader || 64, g = n - m, b = globalThis.navigator.userAgent.match(
|
|
233
233
|
/(phone|pad|pod|iPhone|iPod|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
|
|
234
|
-
) ? "h5" : "pc",
|
|
235
|
-
globalThis.config
|
|
234
|
+
) ? "h5" : "pc", P = /iPhone|iPad|iPod/i.test(globalThis.navigator.userAgent);
|
|
235
|
+
globalThis.config.options = {
|
|
236
236
|
screenWidth: e,
|
|
237
|
-
screenHeight:
|
|
238
|
-
pageWidth:
|
|
239
|
-
pageHeight:
|
|
237
|
+
screenHeight: t,
|
|
238
|
+
pageWidth: a,
|
|
239
|
+
pageHeight: c,
|
|
240
240
|
contentWidth: h,
|
|
241
|
-
tableHeight:
|
|
242
|
-
drawerHeight:
|
|
243
|
-
device:
|
|
244
|
-
isIOS:
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
screenWidth: e,
|
|
248
|
-
screenHeight: n,
|
|
249
|
-
pageWidth: s,
|
|
250
|
-
pageHeight: u,
|
|
251
|
-
contentWidth: h,
|
|
252
|
-
tableHeight: m,
|
|
253
|
-
drawerHeight: w,
|
|
254
|
-
device: $,
|
|
255
|
-
isIOS: y
|
|
256
|
-
}
|
|
257
|
-
}, t();
|
|
258
|
-
}), V = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
241
|
+
tableHeight: d,
|
|
242
|
+
drawerHeight: g,
|
|
243
|
+
device: b,
|
|
244
|
+
isIOS: P
|
|
245
|
+
};
|
|
246
|
+
}, Q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
259
247
|
__proto__: null,
|
|
260
|
-
initColorfulIcon:
|
|
261
|
-
initLang:
|
|
262
|
-
initOptions:
|
|
263
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
264
|
-
...
|
|
265
|
-
...
|
|
266
|
-
...
|
|
267
|
-
...
|
|
268
|
-
...
|
|
269
|
-
...
|
|
248
|
+
initColorfulIcon: N,
|
|
249
|
+
initLang: z,
|
|
250
|
+
initOptions: G
|
|
251
|
+
}, Symbol.toStringTag, { value: "Module" })), V = {
|
|
252
|
+
...Q,
|
|
253
|
+
...S,
|
|
254
|
+
...R,
|
|
255
|
+
..._,
|
|
256
|
+
...k,
|
|
257
|
+
...q
|
|
270
258
|
};
|
|
271
259
|
export {
|
|
272
|
-
|
|
260
|
+
V as default
|
|
273
261
|
};
|