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