mvframe 1.0.4

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.
@@ -0,0 +1,809 @@
1
+ import { defineComponent as Q, reactive as J, inject as oe, getCurrentInstance as se, onMounted as z, computed as F, watch as te, onUnmounted as X, openBlock as p, createElementBlock as b, createElementVNode as t, Fragment as U, renderList as H, unref as a, withModifiers as Y, normalizeClass as D, createCommentVNode as L, createTextVNode as W, toDisplayString as v, nextTick as ne, renderSlot as G, resolveComponent as j, createBlock as K, withCtx as M, createVNode as E, mergeProps as ae } from "vue";
2
+ import { isInView as ie, download as ce } from "../composition.js";
3
+ import { useRoute as ee, useRouter as le } from "vue-router";
4
+ /* empty css */
5
+ import { _ as P } from "../vendor.js";
6
+ import { D as Z } from "../vuedraggable.js";
7
+ const _l = Q({
8
+ name: "MvcFormItemFilter",
9
+ setup: (k, S) => {
10
+ var I, g;
11
+ const f = (N) => Array.isArray(N) ? N.filter((r) => r.children !== "v-if").map((r) => {
12
+ var w, T, $, d;
13
+ return r && (window.$getType(r.children) === "Array" ? r.children = f(r.children) : ((w = r.type) == null ? void 0 : w.name) === "ElFormItem" && (T = r.props) != null && T.label && (r.props.label = ((d = ($ = r.props.label).$l) == null ? void 0 : d.call($)) || r.props.label), r);
14
+ }) : [], l = (g = (I = S.slots).default) == null ? void 0 : g.call(I), m = l == null ? void 0 : l[0];
15
+ return () => f((m == null ? void 0 : m.children) ?? []);
16
+ }
17
+ }), re = { class: "FrameTab relative h36 pl16 pt4 xscroll nobar fadeout" }, de = { class: "relative flexMode vr g4 z2" }, ue = ["id", "onContextmenu", "onClick", "onDblclick"], pe = ["onClick"], me = /* @__PURE__ */ Object.assign({
18
+ name: "FrameTab",
19
+ inheritAttrs: !1
20
+ }, {
21
+ __name: "Tab",
22
+ setup(k) {
23
+ J({
24
+ active: 2
25
+ });
26
+ const S = oe("store"), f = S.tab(), l = S.rmenu(), m = ee(), I = le(), { proxy: g } = se();
27
+ z(() => {
28
+ N();
29
+ });
30
+ const N = () => {
31
+ g.$el.addEventListener("scroll", C);
32
+ }, r = () => {
33
+ const o = localStorage.getItem("tabsScroll");
34
+ o && (g.$el.scrollLeft = Number(o));
35
+ }, C = (o) => {
36
+ let n = null;
37
+ n !== null && clearTimeout(n), n = setTimeout(function() {
38
+ const { scrollLeft: u } = o.target;
39
+ localStorage.setItem("tabsScroll", u);
40
+ }, 100);
41
+ }, w = () => {
42
+ ne(() => {
43
+ const o = g.$el.querySelector(`#tab_${s.value}`);
44
+ ie(g.$el, o) ? r() : g.$el.scrollLeft = (o == null ? void 0 : o.offsetLeft) - 16;
45
+ });
46
+ }, T = (o, n, u) => {
47
+ l.saveData("type", "tabManager"), l.saveData("options", [
48
+ {
49
+ label: "Close",
50
+ value: "close",
51
+ icon: "im-close",
52
+ disabled: i.value.length === 1,
53
+ cb: () => {
54
+ f.closeTab(n, u);
55
+ }
56
+ },
57
+ {
58
+ label: "Close Right",
59
+ value: "closeRight",
60
+ icon: "im-right",
61
+ disabled: u === i.value.length - 1,
62
+ cb: () => {
63
+ f.closeRightTab(n, u);
64
+ }
65
+ },
66
+ {
67
+ label: "Close Left",
68
+ value: "closeLeft",
69
+ icon: "im-left",
70
+ disabled: u === 0,
71
+ cb: () => {
72
+ f.closeLeftTab(n, u);
73
+ }
74
+ },
75
+ {
76
+ label: "Close Other",
77
+ value: "closeOther",
78
+ icon: "im-left",
79
+ disabled: i.value.length === 1,
80
+ cb: () => {
81
+ f.closeOtherTab(n, u);
82
+ }
83
+ }
84
+ ]), l.show({ el: o.target });
85
+ }, $ = (o) => {
86
+ o.name !== s.value && I.push({ name: o.name });
87
+ }, d = (o) => {
88
+ o.name === s.value ? I.replace({ name: o.name, query: { t: +/* @__PURE__ */ new Date() } }) : $(o);
89
+ }, O = (o, n) => {
90
+ f.closeTab(o, n);
91
+ }, i = F(() => f.tabs), s = F(() => m.name), e = F(() => i.value.length);
92
+ return te(
93
+ () => e.value,
94
+ (o) => {
95
+ o && (localStorage.setItem("tabs", JSON.stringify(i.value)), w());
96
+ },
97
+ {
98
+ immediate: !0
99
+ }
100
+ ), X(() => {
101
+ g.$el.removeEventListener("scroll", C);
102
+ }), (o, n) => (p(), b("div", re, [
103
+ t("div", de, [
104
+ (p(!0), b(U, null, H(a(i), (u, c) => (p(), b("div", {
105
+ key: u.name,
106
+ id: `tab_${u.name}`,
107
+ class: D(["relative flexMode vc g4 noShrink tabItem h32 p0-8 fs12 radius4 point noselect", [
108
+ u.name === a(s) && "active",
109
+ a(i).length > 1 && "hoverItem"
110
+ ]]),
111
+ onContextmenu: Y((h) => T(h, u, c), ["prevent", "stop"]),
112
+ onClick: (h) => $(u),
113
+ onDblclick: (h) => d(u)
114
+ }, [
115
+ u.icon ? (p(), b("i", {
116
+ key: 0,
117
+ class: D(["imicon", u.icon])
118
+ }, null, 2)) : L("", !0),
119
+ W(" " + v(u.meta.title) + " ", 1),
120
+ t("div", {
121
+ class: "abs r flexMode hc vc w20 h20",
122
+ onClick: Y((h) => O(u, c), ["stop"])
123
+ }, [...n[0] || (n[0] = [
124
+ t("span", null, "✕", -1)
125
+ ])], 8, pe)
126
+ ], 42, ue))), 128)),
127
+ n[1] || (n[1] = t("div", { class: "w16 h16 noShrink" }, null, -1))
128
+ ])
129
+ ]));
130
+ }
131
+ }), Cl = /* @__PURE__ */ P(me, [["__scopeId", "data-v-1a5bae58"]]), fe = { class: "LogoArea flexMode vc h64 p0-16 relative" }, he = { class: "logo" }, be = { class: "logomini" }, ve = { class: "MenuArea p4 yscroll" }, ge = ["onClick"], ye = { class: "itemIcon w24 txt-c txt-tip fs18" }, _e = { key: 1 }, Ce = {
132
+ key: 0,
133
+ class: "itemChildrenArea mt2 p4"
134
+ }, $e = ["onClick"], xe = { class: "itemIcon w24 txt-c txt-tip fs18" }, ke = /* @__PURE__ */ Object.assign({
135
+ name: "FrameMenu",
136
+ inheritAttrs: !1
137
+ }, {
138
+ __name: "Menu",
139
+ props: {
140
+ iconClass: {
141
+ type: String,
142
+ default: ""
143
+ },
144
+ routes: {
145
+ type: Array,
146
+ default: () => []
147
+ }
148
+ },
149
+ setup(k, { emit: S }) {
150
+ const f = k, l = J({
151
+ collapse: !1
152
+ }), m = ee(), I = le();
153
+ z(() => {
154
+ N();
155
+ });
156
+ const g = S, N = () => {
157
+ const i = localStorage.getItem("collapse");
158
+ i && (l.collapse = JSON.parse(i)), document.addEventListener("keydown", C);
159
+ }, r = (i) => {
160
+ l.collapse === !0 ? l.collapse = !1 : l.collapse === !1 ? l.collapse = !0 : l.collapse = i, localStorage.setItem("collapse", l.collapse), g("on-collapse-change", l.collapse);
161
+ }, C = (i) => {
162
+ i.shiftKey && (i.metaKey || i.ctrlKey) && (i.keyCode === 37 ? r(!0) : i.keyCode === 39 && r(!1));
163
+ }, w = (i) => {
164
+ var s;
165
+ return (s = i == null ? void 0 : i.children) != null && s.length ? w(i.children[0]) : i;
166
+ }, T = (i) => {
167
+ var s;
168
+ return ((s = i == null ? void 0 : i.children) == null ? void 0 : s.some((e) => e.name === m.name || T(e))) ?? !1;
169
+ }, $ = (i) => {
170
+ const s = w(i);
171
+ s != null && s.name && I.push({ name: s.name });
172
+ }, d = () => {
173
+ const i = { ...m.query, _: Date.now() }, s = m.name ? { name: m.name, params: m.params, query: i } : { path: m.path, query: i };
174
+ I.replace(s).catch(() => {
175
+ });
176
+ }, O = F(() => l.collapse ? "im-verticalleft" : "im-verticalright");
177
+ return X(() => {
178
+ document.removeEventListener("keydown", C);
179
+ }), (i, s) => (p(), b("div", {
180
+ class: D(["FrameMenu sticky vh100 noselect noShrink", a(l).collapse && "collapse"])
181
+ }, [
182
+ t("div", fe, [
183
+ t("div", he, [
184
+ G(i.$slots, "logo", {}, void 0, !0)
185
+ ]),
186
+ t("div", be, [
187
+ G(i.$slots, "logomini", {}, void 0, !0)
188
+ ]),
189
+ t("div", {
190
+ class: "collapseArea hover abs",
191
+ onClick: s[0] || (s[0] = (e) => r(a(l).collapse))
192
+ }, [
193
+ t("i", {
194
+ class: D(["imicon fs20", a(O)])
195
+ }, null, 2)
196
+ ])
197
+ ]),
198
+ t("div", ve, [
199
+ (p(!0), b(U, null, H(f.routes, (e, o) => {
200
+ var n, u;
201
+ return p(), b("div", {
202
+ key: o,
203
+ class: "menuItemWrap mb2"
204
+ }, [
205
+ t("div", {
206
+ class: D(["menuItem flexMode vc g8 radius4 p0-16", [
207
+ a(m).name === e.name && "active bg-primary",
208
+ a(l).collapse && "hc",
209
+ a(l).collapse && T(e) && "activeChild"
210
+ ]]),
211
+ onClick: (c) => $(e),
212
+ onDblclick: d
213
+ }, [
214
+ t("div", ye, [
215
+ e.meta.icon ? (p(), b("i", {
216
+ key: 0,
217
+ class: D([f.iconClass, e.meta.icon])
218
+ }, null, 2)) : (p(), b("span", _e, v(((n = e.meta.title) == null ? void 0 : n.substr(0, 1)) || "U"), 1))
219
+ ]),
220
+ a(l).collapse ? L("", !0) : (p(), b("div", {
221
+ key: 0,
222
+ class: D(["itemTitle txt-nowrap fs14", a(m).name === e.name ? "txt-white" : "txt-h1"])
223
+ }, v(e.meta.title), 3))
224
+ ], 42, ge),
225
+ (u = e.children) != null && u.length ? (p(), b("div", Ce, [
226
+ (p(!0), b(U, null, H(e.children, (c, h) => (p(), b("div", {
227
+ key: h,
228
+ class: D(["childrenItem flexMode vc g8 radius4 h40 p0-16", a(m).name === c.name && "active bg-primary"]),
229
+ onClick: (A) => $(c),
230
+ onDblclick: d
231
+ }, [
232
+ t("div", xe, [
233
+ c.meta.icon ? (p(), b("i", {
234
+ key: 0,
235
+ class: D([f.iconClass, c.meta.icon])
236
+ }, null, 2)) : L("", !0)
237
+ ]),
238
+ a(l).collapse ? L("", !0) : (p(), b("div", {
239
+ key: 0,
240
+ class: D(["itemTitle txt-nowrap fs14", a(m).name === c.name ? "txt-white" : "txt-h1"])
241
+ }, v(c.meta.title), 3))
242
+ ], 42, $e))), 128))
243
+ ])) : L("", !0)
244
+ ]);
245
+ }), 128))
246
+ ])
247
+ ], 2));
248
+ }
249
+ }), $l = /* @__PURE__ */ P(ke, [["__scopeId", "data-v-8dc648a5"]]), we = { class: "FrameFooter" }, Me = { class: "txt-tip" }, Se = { class: "txt-primary" }, Te = /* @__PURE__ */ Object.assign({
250
+ name: "FrameFooter",
251
+ inheritAttrs: !1
252
+ }, {
253
+ __name: "Footer",
254
+ setup(k) {
255
+ J({});
256
+ const S = F(() => globalThis.$config);
257
+ return (f, l) => (p(), b("div", we, [
258
+ t("span", Me, v(a(S).copyright), 1),
259
+ t("span", Se, v(a(S).author), 1)
260
+ ]));
261
+ }
262
+ }), xl = /* @__PURE__ */ P(Te, [["__scopeId", "data-v-c3ba0162"]]), kl = Q({
263
+ name: "MvcTableColumnFilter",
264
+ props: {
265
+ tableName: {
266
+ type: String,
267
+ default: ""
268
+ },
269
+ group: {
270
+ type: Object,
271
+ default: /* @__PURE__ */ Object.create(null)
272
+ },
273
+ column: {
274
+ type: Boolean,
275
+ default: !1
276
+ }
277
+ },
278
+ setup: (k, S) => {
279
+ var N;
280
+ const f = J({
281
+ options: [],
282
+ slots: []
283
+ }), l = k.tableName + "_Column";
284
+ let m = [];
285
+ (() => {
286
+ const r = S.slots.default()[0].children, C = {
287
+ normal: [],
288
+ mmp: [],
289
+ asa: [],
290
+ fixed: [],
291
+ columns: []
292
+ }, w = k.tableName ? JSON.parse(localStorage.getItem(l)) : null, T = [void 0];
293
+ r.forEach((d) => {
294
+ window.$getType(d.type) === "Symbol" ? m = m.concat(d.children) : m.push(d);
295
+ }), m.forEach((d, O) => {
296
+ var i;
297
+ if (window.$getType(d.type), ((i = d.type) == null ? void 0 : i.name) === "ElTableColumn") {
298
+ let s = {
299
+ ...d.props,
300
+ sort: O,
301
+ nomove: d.props.nomove || d.props.nomove === "" || d.props.type === "selection" || d.props.label === "Operation",
302
+ resizable: !0,
303
+ visible: d.props.visible !== !1
304
+ };
305
+ if (s.labelKey || (s.labelKey = s.label), s.label = window.$l(s.labelKey), k.column && (w != null && w.length) && T.indexOf(d.props.prop) === -1) {
306
+ const { data: e } = w.filter1((o) => o.prop === d.props.prop);
307
+ e && (s.sort = e.sort, s.fixed = e.fixed, s.visible = e.visible);
308
+ }
309
+ d.props.fixed && C.fixed.push(s), d.props.type === "mmp" ? C.mmp.push(s) : d.props.type === "asa" ? C.asa.push(s) : C.normal.push(s), d.props = s;
310
+ }
311
+ }), f.columnInfo = C;
312
+ let $ = [...C.normal, ...C.mmp, ...C.asa];
313
+ k.tableName && ($ = $.sort((d, O) => d.sort - O.sort), localStorage.setItem(l, JSON.stringify($)));
314
+ })();
315
+ let g = [];
316
+ if (m.forEach((r) => {
317
+ window.$getType(r) !== "String" && r.props.visible && g.push(r);
318
+ }), (N = k.group) != null && N.label) {
319
+ const r = {
320
+ label: "Group By " + k.group.label,
321
+ // prop: props.group.value,
322
+ width: k.group.width,
323
+ fixed: "left",
324
+ visible: !0,
325
+ resizable: !0
326
+ };
327
+ g[0].props.type === "selection" ? g.splice(1, 0, {
328
+ ...g[1],
329
+ props: r
330
+ }) : g.unshift({
331
+ ...g[0],
332
+ props: r
333
+ });
334
+ }
335
+ return g = g.sort((r, C) => r.props.sort - C.props.sort), () => g;
336
+ }
337
+ }), Ie = { class: "hp100 flexMode" }, Ne = { class: "w200 hp100 border-r fs14" }, Ae = { class: "flexMode vc h36 p8 bg-gray3 border-b txt-nowrap" }, Ve = { class: "p4" }, Ee = ["onClick"], Oe = {
338
+ class: "flexMode vs hp100",
339
+ style: { width: "calc(100% - 200px)" }
340
+ }, De = { class: "wp50 border-r fs14" }, Fe = { class: "flexMode vc g8 h36 p8 bg-gray3 border-b txt-nowrap" }, Le = { class: "tagArea blue small" }, je = { class: "p4" }, Ue = {
341
+ key: 0,
342
+ class: "absCenter fs12 txt-dark5 txt-nowrap"
343
+ }, He = { class: "flexMode vc g8" }, Je = ["txt", "onClick"], Re = { class: "wp50 border-r fs14" }, Be = { class: "flexMode vc g8 h36 p8 bg-gray3 border-b txt-nowrap" }, Ke = { class: "tagArea blue small" }, ze = {
344
+ class: "relative p4",
345
+ style: { height: "calc(100% - 36px)" }
346
+ }, Pe = {
347
+ class: "relative",
348
+ style: { height: "30%" }
349
+ }, qe = {
350
+ key: 0,
351
+ class: "absCenter fs12 txt-dark5 txt-nowrap"
352
+ }, We = { class: "columnItem flexMode vc hb h40 g8 p4-8 mb4 radius4" }, Ye = { class: "flexMode vc g8 txt-nowrap" }, Ge = { class: "flexMode vc g8" }, Ze = ["txt", "onClick"], Qe = {
353
+ class: "relative",
354
+ style: { height: "calc(70% - 10px)" }
355
+ }, Xe = {
356
+ key: 0,
357
+ class: "absCenter fs12 txt-dark5 txt-nowrap"
358
+ }, el = { class: "columnItem flexMode vc hb h40 g8 p4-8 mb4 radius4" }, ll = { class: "flexMode vc g8 txt-nowrap" }, ol = { class: "flexMode vc" }, sl = ["txt", "onClick"], tl = ["txt", "onClick"], nl = /* @__PURE__ */ Object.assign({
359
+ name: "MvcTableColumnConfig",
360
+ inheritAttrs: !1
361
+ }, {
362
+ __name: "ColumnConfig",
363
+ props: {
364
+ tableName: {
365
+ type: String,
366
+ default: ""
367
+ }
368
+ },
369
+ emits: "close",
370
+ setup(k, { emit: S }) {
371
+ const f = k, l = J({
372
+ loading: !1,
373
+ type: "normal",
374
+ columns: {
375
+ normal: [],
376
+ mmp: [],
377
+ asa: []
378
+ },
379
+ fixed: [],
380
+ visible: [],
381
+ selection: [],
382
+ operation: [],
383
+ columnType: {},
384
+ mounted: !1
385
+ });
386
+ z(() => {
387
+ I();
388
+ });
389
+ const m = S, I = () => {
390
+ m("mounted");
391
+ const e = JSON.parse(localStorage.getItem(`${f.tableName}_Column`)), o = {};
392
+ e.forEach((n) => {
393
+ n.type && (o[n.type] = !0), n.visible ? n.type === "selection" ? l.selection.push(n) : n.type === "operation" ? l.operation.push(n) : n.label && (n.fixed ? l.fixed.push(n) : l.visible.push(n)) : n.type === "mmp" ? l.columns.mmp.push(n) : n.type === "asa" ? l.columns.asa.push(n) : l.columns.normal.push(n);
394
+ }), l.columnType = o;
395
+ }, g = (e) => {
396
+ l.type = e;
397
+ }, N = (e, o) => {
398
+ e.visible = !0, l.visible.unshift(e), e.type ? l.columns[e.type].splice(o, 1) : l.columns.normal.splice(o, 1);
399
+ }, r = (e, o) => {
400
+ l.fixed.unshift(e), l.visible.splice(o, 1);
401
+ }, C = (e, o) => {
402
+ l.visible.unshift(e), l.fixed.splice(o, 1);
403
+ }, w = (e, o) => {
404
+ l.visible.splice(o, 1), e.type ? l.columns[e.type].unshift(e) : l.columns.normal.unshift(e);
405
+ }, T = async () => {
406
+ l.loading = !0, window.$pm(() => {
407
+ const { fixed: e, visible: o, columns: n, selection: u, operation: c } = l;
408
+ let h = [];
409
+ Object.keys(n).map((y) => {
410
+ h = h.concat(n[y]);
411
+ }), e.forEach((y) => y.fixed = "left"), h.forEach((y) => y.visible = !1);
412
+ const A = u.concat(e, o, h, c);
413
+ A.forEach((y, _) => y.sort = _), localStorage.setItem(`${f.tableName}_Column`, JSON.stringify(A)), l.loading = !1, m("close"), m("init-column");
414
+ });
415
+ }, $ = () => {
416
+ l.loading = !0, localStorage.removeItem(`${f.tableName}_Column`), window.$pm(() => {
417
+ l.loading = !1, m("close"), m("init-column");
418
+ }, 4);
419
+ }, d = F(() => window.config.options.drawerHeight - 36 - 64), O = F(() => (d.value * 0.3).toFixed(0)), i = F(() => (d.value * 0.7 - 10).toFixed(0)), s = F(() => [
420
+ {
421
+ label: "Base Info",
422
+ value: "normal"
423
+ },
424
+ {
425
+ label: "Asa Metrics",
426
+ value: "asa",
427
+ hide: !l.columnType.asa
428
+ },
429
+ {
430
+ label: "MMP Metrics",
431
+ value: "mmp",
432
+ hide: !l.columnType.mmp
433
+ }
434
+ ]);
435
+ return (e, o) => {
436
+ const n = j("el-scrollbar"), u = j("DrawerArea");
437
+ return p(), K(u, {
438
+ loading: a(l).loading,
439
+ noscroll: "",
440
+ "cancel-txt": "Reset",
441
+ "cancel-icon": "im-sync",
442
+ class: "MvcTableColumnConfig",
443
+ onCancel: $,
444
+ onSubmit: T
445
+ }, {
446
+ default: M(() => [
447
+ t("div", Ie, [
448
+ t("div", Ne, [
449
+ t("div", Ae, v(e.$l("Column Type")), 1),
450
+ t("div", Ve, [
451
+ (p(!0), b(U, null, H(a(s), (c) => (p(), b("div", {
452
+ key: c.value,
453
+ class: D(["typeItem p8-16 mb4 radius4 txt-nowrap", [a(l).type === c.value && "active", c.hide && "hide"]]),
454
+ onClick: (h) => g(c.value)
455
+ }, v(c.label), 11, Ee))), 128))
456
+ ])
457
+ ]),
458
+ t("div", Oe, [
459
+ t("div", De, [
460
+ t("div", Fe, [
461
+ t("span", null, v(e.$l("Columns")), 1),
462
+ t("span", Le, v(a(l).columns[a(l).type].length), 1)
463
+ ]),
464
+ E(n, { style: { height: "calc(100% - 36px)" } }, {
465
+ default: M(() => [
466
+ t("div", je, [
467
+ a(l).columns[a(l).type].length === 0 ? (p(), b("span", Ue, v(e.$l("No Columns")), 1)) : L("", !0),
468
+ (p(!0), b(U, null, H(a(l).columns[a(l).type], (c, h) => (p(), b("div", {
469
+ key: c.prop,
470
+ class: "columnItem flexMode vc hb h40 g8 p4-8 mb4 radius4 txt-nowrap"
471
+ }, [
472
+ t("span", null, v(e.$l(c.label)), 1),
473
+ t("div", He, [
474
+ t("div", {
475
+ class: "tipbtn left",
476
+ txt: e.$l("Visible"),
477
+ onClick: (A) => N(c, h)
478
+ }, [...o[0] || (o[0] = [
479
+ t("i", { class: "imicon im-plus fs16" }, null, -1)
480
+ ])], 8, Je)
481
+ ])
482
+ ]))), 128))
483
+ ])
484
+ ]),
485
+ _: 1
486
+ })
487
+ ]),
488
+ t("div", Re, [
489
+ t("div", Be, [
490
+ t("span", null, v(e.$l("Visible Columns")), 1),
491
+ t("span", Ke, v(a(l).visible.length), 1)
492
+ ]),
493
+ t("div", ze, [
494
+ t("div", Pe, [
495
+ a(l).fixed.length === 0 ? (p(), b("span", qe, v(e.$l("No Fixed Columns")), 1)) : L("", !0),
496
+ E(n, { height: a(O) }, {
497
+ default: M(() => [
498
+ E(a(Z), {
499
+ list: a(l).fixed,
500
+ "item-key": (c) => c,
501
+ handle: ".im-handle",
502
+ "ghost-class": "ghost"
503
+ }, {
504
+ item: M(({ element: c, index: h }) => [
505
+ t("div", We, [
506
+ t("div", Ye, [
507
+ o[1] || (o[1] = t("i", { class: "imicon im-handle cursor-grab" }, null, -1)),
508
+ t("span", null, v(e.$l(c.label)), 1)
509
+ ]),
510
+ t("div", Ge, [
511
+ t("div", {
512
+ class: "tipbtn red left",
513
+ txt: e.$l("Unfixed"),
514
+ onClick: (A) => C(c, h)
515
+ }, [...o[2] || (o[2] = [
516
+ t("i", { class: "imicon im-download1 fs14" }, null, -1)
517
+ ])], 8, Ze)
518
+ ])
519
+ ])
520
+ ]),
521
+ _: 1
522
+ }, 8, ["list", "item-key"])
523
+ ]),
524
+ _: 1
525
+ }, 8, ["height"])
526
+ ]),
527
+ o[6] || (o[6] = t("div", { class: "p4-0" }, [
528
+ t("div", { class: "border-t" })
529
+ ], -1)),
530
+ t("div", Qe, [
531
+ a(l).visible.length === 0 ? (p(), b("span", Xe, v(e.$l("No Columns")), 1)) : L("", !0),
532
+ E(n, { height: a(i) }, {
533
+ default: M(() => [
534
+ E(a(Z), {
535
+ list: a(l).visible,
536
+ "item-key": (c) => c,
537
+ options: { lockAxis: "y" },
538
+ handle: ".im-handle",
539
+ "ghost-class": "ghost"
540
+ }, {
541
+ item: M(({ element: c, index: h }) => [
542
+ t("div", el, [
543
+ t("div", ll, [
544
+ o[3] || (o[3] = t("i", { class: "imicon im-handle cursor-grab" }, null, -1)),
545
+ t("span", null, v(e.$l(c.label)), 1)
546
+ ]),
547
+ t("div", ol, [
548
+ t("div", {
549
+ class: "tipbtn left",
550
+ txt: e.$l("Fixed"),
551
+ onClick: (A) => r(c, h)
552
+ }, [...o[4] || (o[4] = [
553
+ t("i", { class: "imicon im-download1 fs14 rotateZ180" }, null, -1)
554
+ ])], 8, sl),
555
+ t("div", {
556
+ class: "tipbtn red left",
557
+ txt: e.$l("Hide"),
558
+ onClick: (A) => w(c, h)
559
+ }, [...o[5] || (o[5] = [
560
+ t("i", { class: "imicon im-close fs14" }, null, -1)
561
+ ])], 8, tl)
562
+ ])
563
+ ])
564
+ ]),
565
+ _: 1
566
+ }, 8, ["list", "item-key"])
567
+ ]),
568
+ _: 1
569
+ }, 8, ["height"])
570
+ ])
571
+ ])
572
+ ])
573
+ ])
574
+ ])
575
+ ]),
576
+ _: 1
577
+ }, 8, ["loading"]);
578
+ };
579
+ }
580
+ }), wl = /* @__PURE__ */ P(nl, [["__scopeId", "data-v-01691821"]]), al = { class: "p16 border-b" }, il = { class: "flexMode vc g8" }, cl = {
581
+ key: 0,
582
+ class: "flexMode vc g8"
583
+ }, rl = { class: "flexMode g16 hr vc" }, dl = { class: "TheEnd p16" }, ul = { class: "sticky flexMode vc hb p4-8 mt16 mb8 fs14 txt-dark9 z9 backdrop border-l4-primary bg-gray3 radius4" }, pl = { class: "fw700" }, ml = { class: "flexMode vc g8" }, Ml = /* @__PURE__ */ Object.assign({
584
+ name: "MvcTableColumnDownload",
585
+ inheritAttrs: !1
586
+ }, {
587
+ __name: "ColumnDownload",
588
+ props: {
589
+ tableName: {
590
+ type: String,
591
+ default: ""
592
+ },
593
+ list: {
594
+ type: Array,
595
+ default: () => []
596
+ },
597
+ selection: {
598
+ type: Array,
599
+ default: () => []
600
+ }
601
+ },
602
+ emits: ["mounted"],
603
+ setup(k, { emit: S }) {
604
+ const f = k, l = J({
605
+ loading: !1,
606
+ columns: [],
607
+ checked: [],
608
+ useHead: !1,
609
+ onlySelection: !1,
610
+ mounted: !1
611
+ });
612
+ z(() => {
613
+ I();
614
+ });
615
+ const m = S, I = () => {
616
+ m("mounted"), g(), N();
617
+ }, g = () => {
618
+ const s = JSON.parse(localStorage.getItem(`${f.tableName}_Column`)), e = ["selection", "operation"];
619
+ l.columns = s.filter((o) => !e.includes(o.type) && o.label);
620
+ }, N = () => {
621
+ f.selection.length && (l.onlySelection = !0);
622
+ }, r = (s, e) => {
623
+ s ? e.children.forEach((o) => {
624
+ o.visible = !0;
625
+ }) : e.children.forEach((o) => {
626
+ o.visible = !1;
627
+ });
628
+ }, C = () => {
629
+ window.$copy(T());
630
+ }, w = async () => {
631
+ l.loading = !0;
632
+ try {
633
+ const s = T("download");
634
+ let e = l.fileName || $.value;
635
+ e && !e.toLowerCase().endsWith(".csv") && (e = `${e}.csv`), await ce({ content: s, filename: e, bom: !0 });
636
+ } finally {
637
+ l.loading = !1;
638
+ }
639
+ }, T = (s) => {
640
+ const e = l.onlySelection ? f.selection : f.list, o = {}, n = [];
641
+ l.columns.filter((_) => _.visible).forEach((_) => {
642
+ n.push(window.$l(_.label)), o[_.prop] = !0;
643
+ });
644
+ let u = "", c = [], h = s === "download" ? "," : " ";
645
+ (l.useHead || s) && (u = n.join(h) + `
646
+ `);
647
+ let A = [], y;
648
+ return Object.keys(o).forEach((_, R) => {
649
+ _.includes("country") && (y = R);
650
+ const x = [];
651
+ e.forEach((V) => {
652
+ V[_] !== void 0 && x.push(V[_]);
653
+ }), A.push(x);
654
+ }), A.forEach((_, R) => {
655
+ !l.useCountryCode && y === R ? _.forEach((x, V) => {
656
+ let B = x;
657
+ window.$getType(x) === "Array" ? B = x.map((q) => i[q.toUpperCase()].label.$l()).join(",") : window.$getType(x) === "String" ? B = x.split(",").map((q) => i[q.toUpperCase()].label.$l()).join(",") : B = JSON.stringify(x), c[V] ? c[V] += B + h : c[V] = B + h;
658
+ }) : _.forEach((x, V) => {
659
+ c[V] ? c[V] += x + h : c[V] = x + h;
660
+ });
661
+ }), `${u}${c.join(`
662
+ `)}`;
663
+ }, $ = F(() => {
664
+ const s = window.$m().format("YYYYMMDDHHmmss");
665
+ return `${f.tableName}_${s}`;
666
+ }), d = F(() => {
667
+ const s = {};
668
+ return l.columns.forEach((e) => {
669
+ const o = e.type ? e.type : "normal", n = {
670
+ label: O[o],
671
+ type: o,
672
+ visible: 0
673
+ };
674
+ s[o] ? (s[o].children.push(e), e.visible && s[o].visible++) : (n.children = [e], e.visible && n.visible++, s[o] = n);
675
+ }), Object.keys(s).forEach((e) => {
676
+ const o = s[e].visible === s[e].children.length, n = s[e].visible === 0;
677
+ o ? (s[e].checkstatus = !0, s[e].indeterminate = !1) : n ? (s[e].checkstatus = !1, s[e].indeterminate = !1) : (s[e].checkstatus = !1, s[e].indeterminate = !0);
678
+ }), s;
679
+ }), O = {
680
+ asa: "Asa Metrics",
681
+ normal: "Base Info",
682
+ mmp: "MMP Metrics"
683
+ };
684
+ "Check All".$l(), "Cancel All".$l();
685
+ const i = useMap("asa.countryAll.obj");
686
+ return (s, e) => {
687
+ const o = j("el-checkbox"), n = j("el-button"), u = j("MvcAlert"), c = j("el-switch"), h = j("Input"), A = j("DrawerArea");
688
+ return p(), K(A, ae(s.$attrs, { class: "MvcTableColumnDownload" }), {
689
+ cancel: M(() => [
690
+ E(h, {
691
+ modelValue: a(l).fileName,
692
+ "onUpdate:modelValue": e[3] || (e[3] = (y) => a(l).fileName = y),
693
+ icon: "catalog",
694
+ placeholder: a($),
695
+ class: "w600"
696
+ }, {
697
+ append: M(() => [
698
+ E(n, {
699
+ loading: a(l).loading,
700
+ onClick: w
701
+ }, {
702
+ icon: M(() => [...e[5] || (e[5] = [
703
+ t("i", { class: "imicon im-download1" }, null, -1)
704
+ ])]),
705
+ default: M(() => [
706
+ W(" " + v(s.$l("Download")), 1)
707
+ ]),
708
+ _: 1
709
+ }, 8, ["loading"])
710
+ ]),
711
+ _: 1
712
+ }, 8, ["modelValue", "placeholder"])
713
+ ]),
714
+ submit: M(() => [...e[6] || (e[6] = [])]),
715
+ default: M(() => [
716
+ t("div", al, [
717
+ E(u, null, {
718
+ default: M(() => [
719
+ t("div", il, [
720
+ t("span", null, v(s.$l("Total")), 1),
721
+ t("span", null, v(f.list.length), 1)
722
+ ]),
723
+ f.selection.length ? (p(), b("div", cl, [
724
+ t("span", null, v(s.$l("Selection")), 1),
725
+ t("span", null, v(f.selection.length), 1),
726
+ E(o, {
727
+ modelValue: a(l).onlySelection,
728
+ "onUpdate:modelValue": e[0] || (e[0] = (y) => a(l).onlySelection = y),
729
+ label: s.$l("Only Selection")
730
+ }, null, 8, ["modelValue", "label"])
731
+ ])) : L("", !0),
732
+ t("div", rl, [
733
+ E(n, { onClick: C }, {
734
+ icon: M(() => [...e[4] || (e[4] = [
735
+ t("i", { class: "imicon im-copy" }, null, -1)
736
+ ])]),
737
+ default: M(() => [
738
+ W(" " + v(s.$l("Copy to Clipboard")), 1)
739
+ ]),
740
+ _: 1
741
+ }),
742
+ E(o, {
743
+ modelValue: a(l).useHead,
744
+ "onUpdate:modelValue": e[1] || (e[1] = (y) => a(l).useHead = y),
745
+ label: s.$l("With Table Head")
746
+ }, null, 8, ["modelValue", "label"])
747
+ ])
748
+ ]),
749
+ _: 1
750
+ })
751
+ ]),
752
+ t("div", dl, [
753
+ (p(!0), b(U, null, H(a(d), (y) => (p(), b("div", {
754
+ key: y.type
755
+ }, [
756
+ t("div", ul, [
757
+ t("span", pl, v(y.label), 1),
758
+ E(o, {
759
+ modelValue: y.checkstatus,
760
+ "onUpdate:modelValue": (_) => y.checkstatus = _,
761
+ indeterminate: y.indeterminate,
762
+ label: s.$l("Check"),
763
+ onChange: (_) => r(_, y)
764
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "indeterminate", "label", "onChange"])
765
+ ]),
766
+ (p(!0), b(U, null, H(y.children, (_, R) => (p(), K(o, {
767
+ modelValue: _.visible,
768
+ "onUpdate:modelValue": (x) => _.visible = x,
769
+ key: R,
770
+ label: _.label,
771
+ value: _.value,
772
+ class: "fullCheckbox p8-12 mb4 radius2 hover-txt-primary hover-bg-gray3"
773
+ }, {
774
+ default: M(() => {
775
+ var x;
776
+ return [
777
+ t("div", ml, [
778
+ t("span", null, v(_.label), 1),
779
+ (x = _.prop) != null && x.includes("country") ? (p(), K(c, {
780
+ key: 0,
781
+ modelValue: a(l).useCountryCode,
782
+ "onUpdate:modelValue": e[2] || (e[2] = (V) => a(l).useCountryCode = V),
783
+ "inline-prompt": "",
784
+ "active-text": "Use Alpha-2 Code",
785
+ "inactive-text": "Use Country Name",
786
+ class: "primarySwitch"
787
+ }, null, 8, ["modelValue"])) : L("", !0)
788
+ ])
789
+ ];
790
+ }),
791
+ _: 2
792
+ }, 1032, ["modelValue", "onUpdate:modelValue", "label", "value"]))), 128))
793
+ ]))), 128))
794
+ ])
795
+ ]),
796
+ _: 1
797
+ }, 16);
798
+ };
799
+ }
800
+ });
801
+ export {
802
+ wl as C,
803
+ xl as F,
804
+ $l as M,
805
+ Cl as T,
806
+ Ml as _,
807
+ kl as a,
808
+ _l as f
809
+ };