magtool 1.3.8 → 1.4.0

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # magtool
2
2
 
3
+ 1.4.0
4
+
5
+ Array.filter覆写,返回data和index
6
+
7
+ 1.3.9
8
+
9
+ init 为dev环境热更前置判断,
10
+
3
11
  1.3.8
4
12
 
5
13
  cps支持default和结构引入
@@ -122,20 +122,20 @@ const v = (e) => {
122
122
  mmpInstalls: {},
123
123
  mmpCPI: {}
124
124
  };
125
- e.forEach((s, d) => {
126
- l[s.property] && (l[s.property].i = d);
125
+ e.forEach((s, g) => {
126
+ l[s.property] && (l[s.property].i = g);
127
127
  const m = o[s.property];
128
128
  if (m) {
129
- m.i = d;
130
- let g = window.$bigNumber(0);
131
- t.forEach((b) => {
132
- g = g.plus(b[s.property] || 0);
133
- }), g = g.toNumber(), m.total = g, r.push(g);
129
+ m.i = g;
130
+ let d = window.$bigNumber(0);
131
+ t.forEach((w) => {
132
+ d = d.plus(w[s.property] || 0);
133
+ }), d = d.toNumber(), m.total = d, r.push(d);
134
134
  } else
135
135
  r.push("");
136
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]));
137
+ const g = o[s];
138
+ g.format && r[g.i] && (r[g.i] = g.format(r[g.i]));
139
139
  });
140
140
  const c = o.taps.total ? window.$fa(o.spend.total / o.taps.total) : "0.00";
141
141
  r[l.avgCPT.i] = c;
@@ -148,8 +148,8 @@ const v = (e) => {
148
148
  r[l.cr.i] = p;
149
149
  const h = o.impressions.total ? window.$fa(o.taps.total / o.impressions.total * 100) : "0.00";
150
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;
151
+ const b = o.impressions.total ? window.$fa(o.installs.total * 1e3 / o.impressions.total) : "0.00";
152
+ return r[l.IPM.i] = b, r;
153
153
  }, U = (e) => {
154
154
  const t = window.$map.asa.allMetric.obj;
155
155
  return Object.keys(e).forEach((n) => {
@@ -232,28 +232,34 @@ const $ = function(e) {
232
232
  __proto__: null,
233
233
  clearRaf: z,
234
234
  useRaf: x
235
- }, Symbol.toStringTag, { value: "Module" })), q = async (e) => new Promise((t) => {
236
- if (document.getElementById("colorfulIcon"))
237
- return;
238
- const n = document.createElement("script");
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()}`);
245
- const c = i.includes("ar") ? "rtl" : "ltr";
246
- if (r.setAttribute("dir", c), r.classList.add(localStorage.getItem("theme") || n), o)
247
- await y({ app: o, langs: globalThis.config.langs || [] });
248
- else
235
+ }, Symbol.toStringTag, { value: "Module" })), q = async (e) => {
236
+ if (!document.getElementById("colorfulIcon"))
237
+ return new Promise((t) => {
238
+ const n = document.createElement("script");
239
+ n.id = "colorfulIcon", n.type = "text/javascript", n.src = e || globalThis.config.colorfulIcon, document.head.appendChild(n), t();
240
+ });
241
+ }, N = async (e = {}) => {
242
+ if (!globalThis.$langs)
243
+ return new Promise(async (t) => {
244
+ const { theme: n = "light", currentLang: a, app: o } = e, r = document.documentElement, l = a || localStorage.getItem("lang") || globalThis.config.lang || "en_us";
245
+ r.classList.add(l);
246
+ const i = l.split("_");
247
+ r.setAttribute("lang", `${i[0]}-${i[1].toUpperCase()}`);
248
+ const c = i.includes("ar") ? "rtl" : "ltr";
249
+ if (r.setAttribute("dir", c), r.classList.add(localStorage.getItem("theme") || n), o)
250
+ await y({ app: o, langs: globalThis.config.langs || [] });
251
+ else
252
+ throw new Error(
253
+ "app is not defined, please check your vue app create from createApp() function"
254
+ );
255
+ t();
256
+ });
257
+ }, G = () => {
258
+ if (!globalThis.config)
249
259
  throw new Error(
250
- "app is not defined, please check your vue app create from createApp() function"
260
+ "globalThis.config is not defined, please create globalThis.config frist"
251
261
  );
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(
262
+ 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, b = globalThis.config.page.tableHeader || 56, s = globalThis.config.page.tableFooter || 56, g = n - l - b - s, m = globalThis.config.page.drawerHeader || 64, d = n - m, w = globalThis.navigator.userAgent.match(
257
263
  /(phone|pad|pod|iPhone|iPod|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
258
264
  ) ? "h5" : "pc", P = /iPhone|iPad|iPod/i.test(globalThis.navigator.userAgent);
259
265
  return globalThis.config.options = {
@@ -262,9 +268,9 @@ const $ = function(e) {
262
268
  pageWidth: r,
263
269
  pageHeight: c,
264
270
  contentWidth: h,
265
- tableHeight: d,
266
- drawerHeight: g,
267
- device: b,
271
+ tableHeight: g,
272
+ drawerHeight: d,
273
+ device: w,
268
274
  isIOS: P
269
275
  }, globalThis.config.options;
270
276
  }, Q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
package/dist/util.js CHANGED
@@ -73,9 +73,9 @@ const N = (s) => {
73
73
  return e;
74
74
  };
75
75
  globalThis.$fd = F;
76
- const b = (o, r = !1) => o.substr(0, 1).toUpperCase() + (r ? o.substr(1, o.length).toLowerCase() : o.substr(1, o.length));
77
- s.config.globalProperties.$toUpperCamel = b, globalThis.$toUpperCamel = b;
78
- const p = (o, r = 2) => {
76
+ const p = (o, r = !1) => o.substr(0, 1).toUpperCase() + (r ? o.substr(1, o.length).toLowerCase() : o.substr(1, o.length));
77
+ s.config.globalProperties.$toUpperCamel = p, globalThis.$toUpperCamel = p;
78
+ const u = (o, r = 2) => {
79
79
  const e = globalThis.$getType(o);
80
80
  let t;
81
81
  e === "Number" ? (o = o.toFixed(r), t = String(o), o = String(Math.abs(o))) : e === "String" && (t = o, o = String(Math.abs(Number(o))));
@@ -83,14 +83,14 @@ const N = (s) => {
83
83
  let n = l[0].split("");
84
84
  n = n.reverse();
85
85
  let a = [];
86
- n.forEach((E, $) => {
87
- $ !== 0 && $ % 3 === 0 && a.push(","), a.push(E);
86
+ n.forEach((O, $) => {
87
+ $ !== 0 && $ % 3 === 0 && a.push(","), a.push(O);
88
88
  });
89
89
  let c = a.reverse().join("");
90
90
  return globalThis.$getType(r) === "Number" && r > 0 && (c += ".", l[1] ? c += l[1].padEnd(r, 0).substr(0, r) : c += "0".padEnd(r, "0")), Number(t) !== Number(o) ? `-${c}` : c;
91
91
  };
92
- globalThis.$fa = p, s.config.globalProperties.$fa = p;
93
- const u = ({
92
+ globalThis.$fa = u, s.config.globalProperties.$fa = u;
93
+ const b = ({
94
94
  prop: o,
95
95
  currency: r,
96
96
  value: e,
@@ -99,7 +99,7 @@ const N = (s) => {
99
99
  const l = t[o];
100
100
  return l.unit === "currency" ? r ? `${r} ${globalThis.$fa(e, l == null ? void 0 : l.precision)}` : globalThis.$fa(e, l == null ? void 0 : l.precision) : l.unit === "%" ? `${globalThis.$fa(e, l == null ? void 0 : l.precision)}%` : globalThis.$fa(e, l == null ? void 0 : l.precision);
101
101
  };
102
- globalThis.$fu2 = u, s.config.globalProperties.$fu2 = u;
102
+ globalThis.$fu2 = b, s.config.globalProperties.$fu2 = b;
103
103
  const h = (o = () => {
104
104
  }, r = 2) => {
105
105
  let e = null;
@@ -134,6 +134,13 @@ const N = (s) => {
134
134
  index: e,
135
135
  data: r
136
136
  };
137
+ }, Array.prototype.filter = function(o) {
138
+ if (!o || typeof o != "function")
139
+ throw new Error(o + " is not a function");
140
+ const r = [];
141
+ for (let e = 0; e < this.length; e++)
142
+ o(this[e], e, this) && r.push({ data: this[e], index: e });
143
+ return r;
137
144
  }, globalThis.$getType = (o) => Object.prototype.toString.call(o).slice(8, -1);
138
145
  const m = (o, r) => {
139
146
  if (!o) {
@@ -204,7 +211,7 @@ const N = (s) => {
204
211
  tag: "background-color:#20c997; color:#f6fffc; border-radius: 2px 0 0 2px;",
205
212
  style: "background-color:#f6fffc; color:#20c997;"
206
213
  }
207
- }, O = (o) => {
214
+ }, A = (o) => {
208
215
  let r = !1;
209
216
  for (let e in o)
210
217
  if (globalThis.$getType(o[e]) === "Object") {
@@ -212,11 +219,11 @@ const N = (s) => {
212
219
  break;
213
220
  }
214
221
  return r;
215
- }, A = ["info", "log", "warn", "error", "success"];
216
- globalThis.$c = {}, A.forEach((o) => {
222
+ }, E = ["info", "log", "warn", "error", "success"];
223
+ globalThis.$c = {}, E.forEach((o) => {
217
224
  globalThis.$c[o] = (...r) => {
218
225
  const e = o.toUpperCase();
219
- O(r) ? (console.groupCollapsed(`%c ${e} `, `${i[o].tag}`), console[o](r), console.groupEnd()) : console.info(
226
+ A(r) ? (console.groupCollapsed(`%c ${e} `, `${i[o].tag}`), console[o](r), console.groupEnd()) : console.info(
220
227
  `%c ${e} %c┆${r}┆`,
221
228
  `${i[o].tag}`,
222
229
  `${i[o].style}`
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.8",
4
+ "version": "1.4.0",
5
5
  "author": "matt avis",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",