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.
Files changed (2) hide show
  1. package/dist/composition.js +104 -116
  2. package/package.json +1 -1
@@ -1,57 +1,57 @@
1
- const C = (t) => {
2
- const { age: e } = t || {};
1
+ const v = (e) => {
2
+ const { age: t } = e || {};
3
3
  let n, r;
4
- if (e != null && e.included) {
5
- const { minAge: o, maxAge: a } = e.included[0] || {};
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
- }, I = (t, e) => t === "all" ? null : e === 65 ? {
9
+ }, C = (e, t) => e === "all" ? null : t === 65 ? {
10
10
  included: [
11
11
  {
12
- minAge: t
12
+ minAge: e
13
13
  }
14
14
  ]
15
15
  } : {
16
16
  included: [
17
17
  {
18
- minAge: t,
19
- maxAge: e
18
+ minAge: e,
19
+ maxAge: t
20
20
  }
21
21
  ]
22
- }, S = (t) => {
23
- const { gender: e } = t || {};
24
- return e != null && e.included ? e.included[0] : null;
25
- }, A = { useAgeFormat: C, useAgeValue: I, useGenderFormat: S }, L = (t) => new Promise((e, n) => {
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(t) === "String" ? t : URL.createObjectURL(t), r.onload = () => e(r), r.onerror = () => n(new Error("Could not load image"));
28
- }), M = (t) => new Promise((e, n) => {
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(t) === "String" ? r.src = t : r.src = URL.createObjectURL(t), r.onloadedmetadata = () => {
31
- window.URL.revokeObjectURL(t), e(r);
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
- }), R = ({ type: t = "csv", data: e, name: n }) => {
33
+ }), M = ({ type: e = "csv", data: t, name: n }) => {
34
34
  let r = document.createElement("a");
35
- if (t === "csv") {
36
- const a = new Blob(["\uFEFF" + e], {
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), (t === "csv" || t === "video") && URL.revokeObjectURL(r.url), r = null, o = null;
43
- }, E = { loadImage: L, loadVideo: M, download: R }, O = ({ table: t, key: e, form: n, value: r, cb: o = () => {
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 = t.getSelectionRows();
46
- a.length > 1 ? (t.clearSelection(), t.toggleRowSelection(a[1], "selected"), n[r] = a[1][e]) : a.length === 1 && (n[r] = a[0][e]), o();
47
- }, j = (t = {}) => {
48
- let { sortable: e = !0, empty: n = !1, mmp: r = !1 } = t, o = window.$map.asa.asaMetric.all;
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: e,
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
- }, U = () => ({
66
+ }, j = () => ({
67
67
  label: "-"
68
- }), F = ({ columns: t, data: e, currency: n = "", channel: r = "" }) => {
69
- if (!e.length || !t.length)
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
- t.forEach((l, d) => {
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
- e.forEach((w) => {
122
- g = g.plus(w[l.property] || 0);
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 u = o.installs.total ? window.$fa(o.spend.total / o.installs.total) : "0.00";
133
- if (a[s.avgCPA.i] = u, s.avgCPM.i !== void 0) {
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 b = o.impressions.total ? window.$fa(o.taps.total / o.impressions.total * 100) : "0.00";
140
- a[s.ttr.i] = b;
141
- const h = o.impressions.total ? window.$fa(o.installs.total * 1e3 / o.impressions.total) : "0.00";
142
- return a[s.IPM.i] = h, a;
143
- }, H = (t) => {
144
- const e = window.$map.asa.allMetric.obj;
145
- return Object.keys(t).forEach((n) => {
146
- const r = t[n];
147
- e[n] && (t[`${n}Format`] = window.$fu({ prop: n, value: r, currency: !1, obj: e }));
148
- }), t;
149
- }, _ = ({ columns: t, data: e }, n) => t.length && e.length ? t.map((o) => {
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
- }) : [], B = { useSingleSelect: O, useColumn: j, useEmptyColumn: U, useRemoteSummary: _, useSummary: F, useFormat: H }, k = (t, e = 88) => {
158
- const n = document.querySelector("html"), { scrollTop: r } = n, o = t.getBoundingClientRect();
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 - e,
160
+ top: r + o.y - t,
161
161
  behavior: "smooth"
162
162
  });
163
- }, P = async ({ app: t, langs: e, langObj: n }) => new Promise((r) => {
163
+ }, T = async ({ app: e, langs: t, langObj: n }) => new Promise((r) => {
164
164
  const o = [];
165
- e.forEach((i) => {
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 u = a[i] || i;
175
+ let f = a[i] || i;
176
176
  return Object.keys(c).forEach((p) => {
177
- u[`$${p}$`] = c[p];
178
- }), u;
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, t.config.globalProperties.$l = s, r();
187
- }), x = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
186
+ }, globalThis.$l = s, e.config.globalProperties.$l = s, r();
187
+ }), k = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
188
188
  __proto__: null,
189
- pageScrollTo: k,
190
- useLang: P
191
- }, Symbol.toStringTag, { value: "Module" })), f = [];
192
- let T = 0;
193
- const v = function(t) {
194
- f.forEach((e) => {
195
- if (e.time === void 0 || e.lastTime === 0 || t - e.lastTime >= e.time) {
196
- e.cb(t), e.lastTime = t;
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
- }), f.length && window.requestAnimationFrame(v);
200
- }, W = function(t, e = 1e3) {
201
- return T++, f.push({
202
- cb: t,
203
- time: e,
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: T
206
- }), f.length === 1 && window.requestAnimationFrame(v), T;
207
- }, q = function(t) {
208
- for (let e = 0; e < f.length; e++)
209
- if (f[e].id === t) {
210
- f.splice(e, 1);
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
- }, N = { useRaf: W, clearRaf: q }, z = async (t) => new Promise((e) => {
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 = t || globalThis.config.colorfulIcon, document.head.appendChild(n), e();
218
- }), G = async (t = {}) => new Promise(async (e) => {
219
- const { theme: n = "light", currentLang: r, app: o } = t, a = document.documentElement, s = r || localStorage.getItem("lang") || globalThis.config.lang || "en_us";
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 P({ app: o, langs: globalThis.config.langs || [] });
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
- e();
231
- }), Q = async () => new Promise(async (t) => {
232
- const { availWidth: e, availHeight: n } = globalThis.screen, { clientHeight: r } = globalThis.document.body, o = globalThis.config.page.paddingLeft || 32, a = globalThis.config.page.paddingRight || 32, s = e - o - a, i = globalThis.config.page.frameHeader || 82, c = globalThis.config.page.frameFooter || 36, u = r - i - c, p = globalThis.config.page.contentPaddingLeft || 16, b = globalThis.config.page.contentPaddingLeft || 16, h = s - p - b, l = globalThis.config.page.tableHeader || 56, d = globalThis.config.page.tableFooter || 56, m = r - i - l - d, g = globalThis.config.page.drawerHeader || 64, w = r - g, $ = globalThis.navigator.userAgent.match(
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", y = /iPhone|iPad|iPod/i.test(globalThis.navigator.userAgent);
235
- globalThis.config ? globalThis.config.options = {
234
+ ) ? "h5" : "pc", P = /iPhone|iPad|iPod/i.test(globalThis.navigator.userAgent);
235
+ globalThis.config.options = {
236
236
  screenWidth: e,
237
- screenHeight: n,
238
- pageWidth: s,
239
- pageHeight: u,
237
+ screenHeight: t,
238
+ pageWidth: a,
239
+ pageHeight: c,
240
240
  contentWidth: h,
241
- tableHeight: m,
242
- drawerHeight: w,
243
- device: $,
244
- isIOS: y
245
- } : globalThis.config = {
246
- options: {
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: z,
261
- initLang: G,
262
- initOptions: Q
263
- }, Symbol.toStringTag, { value: "Module" })), J = {
264
- ...V,
265
- ...A,
266
- ...E,
267
- ...B,
268
- ...x,
269
- ...N
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
- J as default
260
+ V as default
273
261
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "magtool",
3
3
  "packageManager": "yarn@4.4.1",
4
- "version": "1.3.6",
4
+ "version": "1.3.7",
5
5
  "author": "matt avis",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",