magtool 1.5.38 → 1.5.39

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 (44) hide show
  1. package/dist/cpt/AiApp.js +117 -0
  2. package/dist/cpt/AiOrg.js +130 -0
  3. package/dist/cpt/AsaAdGroup.js +261 -0
  4. package/dist/cpt/AsaApp.js +126 -0
  5. package/dist/cpt/AsaCampaign.js +268 -0
  6. package/dist/cpt/AsaOrg.js +130 -0
  7. package/dist/cpt/Card.js +92 -0
  8. package/dist/cpt/Country.js +32 -0
  9. package/dist/cpt/CountryItem.js +56 -0
  10. package/dist/cpt/DatePicker.js +246 -0
  11. package/dist/cpt/EChart.js +271 -0
  12. package/dist/cpt/Form.js +75 -0
  13. package/dist/cpt/Header.js +786 -0
  14. package/dist/cpt/Icon.js +24 -0
  15. package/dist/cpt/Image.js +58 -0
  16. package/dist/cpt/Input.js +129 -0
  17. package/dist/cpt/Main.js +230 -0
  18. package/dist/cpt/MultipleSelect.js +143 -0
  19. package/dist/cpt/Nodata.js +39 -0
  20. package/dist/cpt/Org.js +99 -0
  21. package/dist/cpt/Page.js +74 -0
  22. package/dist/cpt/StatusItem.js +68 -0
  23. package/dist/cpt/StatusSelect.js +79 -0
  24. package/dist/cpt/Table.js +123 -0
  25. package/dist/cpt/Textarea.js +132 -0
  26. package/dist/cpt/Timezone.js +128 -0
  27. package/dist/cpt/chip.js +639 -0
  28. package/dist/cpt/component.js +21 -0
  29. package/dist/css/cpt/Card.css +1 -0
  30. package/dist/css/cpt/EChart.css +1 -0
  31. package/dist/css/cpt/Header.css +1 -0
  32. package/dist/css/cpt/Main.css +1 -0
  33. package/dist/css/cpt/MultipleSelect.css +1 -0
  34. package/dist/css/cpt/Nodata.css +1 -0
  35. package/dist/css/cpt/Page.css +1 -0
  36. package/dist/css/cpt/Table.css +1 -0
  37. package/dist/css/cpt/Textarea.css +1 -0
  38. package/dist/css/cpt/chip.css +1 -0
  39. package/dist/css/{magtool.css → css/scss.css} +1 -1
  40. package/dist/index.js +2 -2
  41. package/dist/util.js +5 -5
  42. package/dist/vendor.js +17 -14
  43. package/package.json +1 -1
  44. package/dist/component.js +0 -4427
@@ -0,0 +1,786 @@
1
+ import { defineComponent as W, defineAsyncComponent as oe, reactive as q, markRaw as ne, getCurrentInstance as se, computed as p, resolveComponent as C, createElementBlock as D, openBlock as b, createElementVNode as n, createVNode as h, createBlock as U, createCommentVNode as $, unref as t, withCtx as d, createTextVNode as J, toDisplayString as c, normalizeClass as ae, withModifiers as ee, onMounted as re, createSlots as K, normalizeStyle as Q, Fragment as de, renderList as ce } from "vue";
2
+ import { pageScrollTo as P, download as ue } from "../composition.js";
3
+ import { _ as te } from "../vendor.js";
4
+ import X from "vuedraggable";
5
+ import { useRoute as me } from "vue-router";
6
+ import { useMap as pe } from "asamap";
7
+ const fe = { class: "MvcTableHeaderTool" }, ge = { class: "ToolArea" }, he = W({
8
+ name: "MvcTableHeaderTool",
9
+ inheritAttrs: !1
10
+ }), be = /* @__PURE__ */ Object.assign(he, {
11
+ props: {
12
+ tableName: {
13
+ type: String,
14
+ default: ""
15
+ },
16
+ list: {
17
+ type: Array,
18
+ default: () => []
19
+ },
20
+ selection: {
21
+ type: Array,
22
+ default: () => []
23
+ },
24
+ loadData: {
25
+ type: [Function, void 0],
26
+ default: void 0
27
+ },
28
+ remote: {
29
+ type: Boolean,
30
+ default: !1
31
+ },
32
+ filter: {
33
+ type: Object,
34
+ default: /* @__PURE__ */ Object.create(null)
35
+ },
36
+ tool: {
37
+ type: [Object, Boolean, void 0],
38
+ default: /* @__PURE__ */ Object.create(null)
39
+ },
40
+ useAll: {
41
+ type: Boolean,
42
+ default: !1
43
+ },
44
+ type: {
45
+ type: String,
46
+ default: ""
47
+ }
48
+ },
49
+ setup(M, { emit: H }) {
50
+ const g = oe(() => Promise.resolve().then(() => Ue)), e = oe(() => Promise.resolve().then(() => dt)), m = M, y = q({
51
+ drawer: [
52
+ {
53
+ title: window.$l("Table Column Customization"),
54
+ size: 1024,
55
+ cpt: ne(g)
56
+ },
57
+ {
58
+ title: window.$l("Download from Current Table"),
59
+ cpt: ne(e)
60
+ }
61
+ ],
62
+ groupby: [],
63
+ current: "",
64
+ searchGroupBy: "",
65
+ filterVisible: !1,
66
+ filterTop: 0,
67
+ dt: []
68
+ }), { proxy: Y } = se(), N = H, V = (s) => {
69
+ m.type === "drawer" || (s.target.localName === "span" ? P(s.target.parentNode) : s.target.localName === "i" ? s.target.parentNode.localName === "button" ? P(s.target.parentNode) : P(s.target.parentNode.parentNode) : P(s.target)), N("refresh");
70
+ }, R = () => {
71
+ y.drawer[0].params = { tableName: m.tableName }, y.current = 0;
72
+ }, L = () => {
73
+ y.drawer[1].params = {
74
+ useAll: m.useAll,
75
+ tableName: m.tableName,
76
+ list: m.list,
77
+ selection: m.selection,
78
+ remote: m.remote
79
+ }, y.current = 1;
80
+ }, _ = (s) => {
81
+ s === "column" ? N("to-init-table") : s === "download" && N("to-download");
82
+ }, T = p(() => {
83
+ var s;
84
+ return ((s = m.tool) == null ? void 0 : s.download) === void 0;
85
+ }), F = p(() => {
86
+ var s;
87
+ return ((s = m.tool) == null ? void 0 : s.column) === void 0;
88
+ }), O = p(() => {
89
+ var s;
90
+ return ((s = m.tool) == null ? void 0 : s.refresh) === void 0;
91
+ });
92
+ p(() => {
93
+ const s = y.searchGroupBy.toLowerCase();
94
+ return B.map((u) => (u.label.toLowerCase().includes(s) ? u.hide = !1 : u.hide = !0, u));
95
+ });
96
+ const B = [
97
+ {
98
+ label: "Age",
99
+ value: "Age",
100
+ width: 100
101
+ },
102
+ {
103
+ label: "Campaign Category",
104
+ value: "CampaignCategory",
105
+ width: 200
106
+ },
107
+ {
108
+ label: "Campaign Type",
109
+ value: "CampaignType",
110
+ width: 200
111
+ },
112
+ {
113
+ label: "Country",
114
+ value: "Country",
115
+ width: 120
116
+ },
117
+ {
118
+ label: "Day",
119
+ value: "Day",
120
+ width: 100
121
+ }
122
+ ];
123
+ return (s, u) => {
124
+ const S = C("el-button"), E = C("Drawer");
125
+ return b(), D("div", fe, [
126
+ n("div", ge, [
127
+ t(O) ? (b(), U(S, {
128
+ key: 0,
129
+ plain: "",
130
+ onClick: u[0] || (u[0] = (a) => V(a))
131
+ }, {
132
+ icon: d(() => [...u[2] || (u[2] = [
133
+ n("i", { class: "imicon im-reset" }, null, -1)
134
+ ])]),
135
+ default: d(() => [
136
+ J(" " + c(s.$l("Refresh")), 1)
137
+ ]),
138
+ _: 1
139
+ })) : $("", !0),
140
+ t(F) ? (b(), U(S, {
141
+ key: 1,
142
+ plain: "",
143
+ onClick: R
144
+ }, {
145
+ icon: d(() => [...u[3] || (u[3] = [
146
+ n("i", { class: "imicon im-columns1" }, null, -1)
147
+ ])]),
148
+ default: d(() => [
149
+ J(" " + c(s.$l("Columns")), 1)
150
+ ]),
151
+ _: 1
152
+ })) : $("", !0),
153
+ t(T) ? (b(), U(S, {
154
+ key: 2,
155
+ plain: "",
156
+ onClick: L
157
+ }, {
158
+ icon: d(() => [...u[4] || (u[4] = [
159
+ n("i", { class: "imicon im-download1" }, null, -1)
160
+ ])]),
161
+ default: d(() => [
162
+ J(" " + c(s.$l("Download")), 1)
163
+ ]),
164
+ _: 1
165
+ })) : $("", !0)
166
+ ]),
167
+ h(E, {
168
+ current: t(y).current,
169
+ "onUpdate:current": u[1] || (u[1] = (a) => t(y).current = a),
170
+ drawer: t(y).drawer,
171
+ dt: t(y).dt,
172
+ "load-data": m.loadData,
173
+ onFetchAllData: s.fetchAllData,
174
+ onRecoverCurrentData: s.recoverCurrentData,
175
+ onSubmit: _
176
+ }, null, 8, ["current", "drawer", "dt", "load-data", "onFetchAllData", "onRecoverCurrentData"])
177
+ ]);
178
+ };
179
+ }
180
+ }), ht = /* @__PURE__ */ te(be, [["__scopeId", "data-v-e46db4e1"]]), ye = { class: "dragCenter flexMode vc flexGrow txt-nowrap" }, _e = { class: "pl10 fs14 txt-h2" }, ve = { class: "pb5 fs12 txt-primary3" }, we = W({
181
+ name: "ColumnConfigDragItem"
182
+ }), Ce = /* @__PURE__ */ Object.assign(we, {
183
+ props: {
184
+ modelValue: {
185
+ type: Object,
186
+ default: /* @__PURE__ */ Object.create(null)
187
+ },
188
+ it: {
189
+ type: Object,
190
+ default: /* @__PURE__ */ Object.create(null)
191
+ },
192
+ index: {
193
+ type: Number,
194
+ default: 0
195
+ },
196
+ type: {
197
+ type: String,
198
+ default: "center"
199
+ },
200
+ lang: {
201
+ type: String,
202
+ default: "en_us"
203
+ }
204
+ },
205
+ setup(M, { emit: H }) {
206
+ const g = M, e = q({
207
+ editMode: !1,
208
+ form: g.it,
209
+ info: {}
210
+ }), m = H, y = () => {
211
+ m("add-left", g);
212
+ }, Y = () => {
213
+ m("add-right", g);
214
+ }, N = (L) => {
215
+ m("change", { it: e.form, index: g.index, type: g.type });
216
+ };
217
+ p(() => e.form.align ? " " : R[0].label);
218
+ const V = p(() => g.it.nomove || e.editMode), R = [
219
+ {
220
+ label: "Left",
221
+ value: "left"
222
+ },
223
+ {
224
+ label: "Center",
225
+ value: "center"
226
+ },
227
+ {
228
+ label: "Right",
229
+ value: "right"
230
+ }
231
+ ];
232
+ return (L, _) => {
233
+ const T = C("el-switch");
234
+ return b(), D("div", {
235
+ class: ae(["ColumnConfigDragItem", [!t(V) && "drag", g.type]])
236
+ }, [
237
+ n("div", {
238
+ class: ae(["itemArea relative flexMode vc p4", [
239
+ t(e).editMode && "edit",
240
+ t(V) ? "cursor-disabled hover-bg-gray1" : "cursor-grab hover-bg-primary1"
241
+ ]])
242
+ }, [
243
+ n("div", {
244
+ class: "arrowLeft ml4 mr8 circle24 hover-txt-primary point",
245
+ onClick: ee(y, ["stop"])
246
+ }, [..._[1] || (_[1] = [
247
+ n("i", { class: "imicon im-arrow-left" }, null, -1)
248
+ ])]),
249
+ n("div", ye, [
250
+ h(T, {
251
+ modelValue: t(e).form.visible,
252
+ "onUpdate:modelValue": _[0] || (_[0] = (F) => t(e).form.visible = F),
253
+ disabled: t(e).form.nomove,
254
+ size: "default",
255
+ onChange: N
256
+ }, null, 8, ["modelValue", "disabled"]),
257
+ n("span", _e, c(t(e).form.label || t(e).form.type), 1)
258
+ ]),
259
+ n("span", ve, c(t(e).form.tips), 1),
260
+ n("div", {
261
+ class: "arrowRight mr4 ml8 circle24 hover-txt-primary point",
262
+ onClick: ee(Y, ["stop"])
263
+ }, [..._[2] || (_[2] = [
264
+ n("i", { class: "imicon im-arrow-right" }, null, -1)
265
+ ])])
266
+ ], 2)
267
+ ], 2);
268
+ };
269
+ }
270
+ }), Z = /* @__PURE__ */ te(Ce, [["__scopeId", "data-v-4812bddc"]]), $e = { class: "flexMode vs p16 g16" }, xe = { class: "ml16 p2-4 bg-gary3 radius4 lh12" }, ke = { class: "fs12 txt-primary" }, De = { class: "fs12 txt-dark5" }, Ae = {
271
+ key: 0,
272
+ class: "fs12 txt-dark3"
273
+ }, Ne = {
274
+ key: 0,
275
+ class: "absCenter txt-nowrap txt-dark7 fs12"
276
+ }, Se = { class: "ml16 p2-4 bg-gary3 radius4 lh12" }, Ve = { class: "fs12 txt-primary" }, Te = { class: "fs12 txt-dark5" }, Oe = {
277
+ key: 0,
278
+ class: "fs12 txt-dark3"
279
+ }, je = {
280
+ key: 0,
281
+ class: "absCenter txt-nowrap txt-dark7 fs12"
282
+ }, Me = { class: "ml16 p2-4 bg-gary3 radius4 lh12" }, Re = { class: "fs12 txt-primary" }, Le = { class: "fs12 txt-dark5" }, Fe = {
283
+ key: 0,
284
+ class: "fs12 txt-dark3"
285
+ }, Be = {
286
+ key: 0,
287
+ class: "absCenter txt-nowrap txt-dark7 fs12"
288
+ }, Ee = W({
289
+ name: "TableHeaderColumnConfig",
290
+ inheritAttrs: !1
291
+ }), Ie = /* @__PURE__ */ Object.assign(Ee, {
292
+ props: {
293
+ params: {
294
+ type: Object,
295
+ default: /* @__PURE__ */ Object.create(null)
296
+ }
297
+ },
298
+ setup(M, { emit: H }) {
299
+ const g = M, e = q({
300
+ loading: !1,
301
+ left: [],
302
+ center: [],
303
+ right: [],
304
+ total: 0
305
+ });
306
+ re(() => {
307
+ y();
308
+ });
309
+ const m = H, y = () => {
310
+ Y();
311
+ }, Y = () => {
312
+ let a = localStorage.getItem(O.value);
313
+ if (a) {
314
+ a = JSON.parse(a);
315
+ let i = 0;
316
+ a.forEach((r) => {
317
+ r.label && !r.nomove && (i++, r.fixed ? e[r.fixed].push(r) : e.center.push(r));
318
+ }), e.total = i;
319
+ }
320
+ }, N = ({ it: a, index: i, type: r }) => {
321
+ e.left.unshift(a), e.center.splice(i, 1);
322
+ }, V = ({ it: a, index: i, type: r }) => {
323
+ e.right.unshift(a), e.center.splice(i, 1);
324
+ }, R = ({ it: a, index: i, type: r }) => {
325
+ e.center.unshift(a), e.left.splice(i, 1);
326
+ }, L = ({ it: a, index: i, type: r }) => {
327
+ e.center.unshift(a), e.right.splice(i, 1);
328
+ }, _ = ({ it: a, index: i, type: r }) => {
329
+ e[r][i] = a;
330
+ }, T = async () => {
331
+ e.loading = !0, localStorage.removeItem(O.value), window.$promise(() => {
332
+ e.loading = !1, m("submit", "column"), m("close");
333
+ });
334
+ }, F = async () => {
335
+ e.loading = !0, await window.$promise(() => {
336
+ const { left: a, center: i, right: r } = e;
337
+ a.forEach((v, l) => {
338
+ v.fixed = "left", v.sort = l;
339
+ }), i.forEach((v, l) => {
340
+ v.fixed = !1, v.sort = l;
341
+ }), r.forEach((v, l) => {
342
+ v.fixed = "right", v.sort = l;
343
+ });
344
+ const j = [...a, ...i, ...r].sort(
345
+ (v, l) => v.sort - l.sort
346
+ );
347
+ localStorage.setItem(O.value, JSON.stringify(j));
348
+ }, 10), e.loading = !1, m("submit", "column"), m("close");
349
+ }, O = p(() => `${g.params.tableName}_Column`), B = p(() => ({
350
+ height: window.global.config.options.drawerHeight - 80 + "px"
351
+ })), s = p(() => {
352
+ let a = 0, i = 0;
353
+ return e.left.forEach((r) => {
354
+ r.visible ? a++ : i++;
355
+ }), {
356
+ visible: a,
357
+ hide: i
358
+ };
359
+ }), u = p(() => {
360
+ let a = 0, i = 0;
361
+ return e.center.forEach((r) => {
362
+ r.visible ? a++ : i++;
363
+ }), {
364
+ visible: a,
365
+ hide: i
366
+ };
367
+ }), S = p(() => {
368
+ let a = 0, i = 0;
369
+ return e.right.forEach((r) => {
370
+ r.visible ? a++ : i++;
371
+ }), {
372
+ visible: a,
373
+ hide: i
374
+ };
375
+ }), E = p(() => window.$getLang());
376
+ return (a, i) => {
377
+ const r = C("Card"), j = C("el-button"), v = C("DrawerArea");
378
+ return b(), U(v, {
379
+ class: "TableHeaderColumnConfig",
380
+ loading: t(e).loading,
381
+ noscroll: "",
382
+ onSubmit: F
383
+ }, {
384
+ cancel: d(() => [
385
+ h(j, {
386
+ plain: "",
387
+ onClick: T
388
+ }, {
389
+ icon: d(() => [...i[0] || (i[0] = [
390
+ n("i", { class: "imicon im-reset" }, null, -1)
391
+ ])]),
392
+ default: d(() => [
393
+ J(" " + c(a.$l("Reset")), 1)
394
+ ]),
395
+ _: 1
396
+ })
397
+ ]),
398
+ default: d(() => [
399
+ n("div", $e, [
400
+ h(r, {
401
+ title: "Fixed on Left",
402
+ class: "flex1",
403
+ "body-class": "border"
404
+ }, K({
405
+ default: d(() => [
406
+ t(e).left.length === 0 ? (b(), D("div", Ne, c(a.$l("No Column Fixed on Left")), 1)) : $("", !0),
407
+ h(t(X), {
408
+ list: t(e).left,
409
+ group: "columnFilter",
410
+ class: "dragBody p4-0 yscroll nobar",
411
+ draggable: ".drag",
412
+ style: Q(t(B)),
413
+ "item-key": (l) => l
414
+ }, {
415
+ item: d(({ element: l, index: o }) => [
416
+ h(Z, {
417
+ it: l,
418
+ index: o,
419
+ lang: t(E),
420
+ type: "left",
421
+ onAddRight: R,
422
+ onChange: _
423
+ }, null, 8, ["it", "index", "lang"])
424
+ ]),
425
+ _: 1
426
+ }, 8, ["list", "style", "item-key"])
427
+ ]),
428
+ _: 2
429
+ }, [
430
+ t(s) ? {
431
+ name: "header",
432
+ fn: d(() => [
433
+ n("div", xe, [
434
+ n("span", ke, c(t(s).visible), 1),
435
+ n("span", De, " / " + c(t(e).total), 1),
436
+ t(s).hide ? (b(), D("span", Ae, "(" + c(t(s).hide) + ")", 1)) : $("", !0)
437
+ ])
438
+ ]),
439
+ key: "0"
440
+ } : void 0
441
+ ]), 1024),
442
+ h(r, {
443
+ title: "In Center",
444
+ class: "flex1",
445
+ "body-class": "border"
446
+ }, K({
447
+ default: d(() => [
448
+ t(e).center.length === 0 ? (b(), D("div", je, c(a.$l("No Column Fixed on Left")), 1)) : $("", !0),
449
+ h(t(X), {
450
+ list: t(e).center,
451
+ group: "columnFilter",
452
+ class: "dragBody p4-0 yscroll nobar",
453
+ draggable: ".drag",
454
+ style: Q(t(B)),
455
+ "item-key": (l) => l
456
+ }, {
457
+ item: d(({ element: l, index: o }) => [
458
+ h(Z, {
459
+ it: l,
460
+ index: o,
461
+ onAddLeft: N,
462
+ lang: t(E),
463
+ onAddRight: V,
464
+ onChange: _
465
+ }, null, 8, ["it", "index", "lang"])
466
+ ]),
467
+ _: 1
468
+ }, 8, ["list", "style", "item-key"])
469
+ ]),
470
+ _: 2
471
+ }, [
472
+ t(u) ? {
473
+ name: "header",
474
+ fn: d(() => [
475
+ n("div", Se, [
476
+ n("span", Ve, c(t(u).visible), 1),
477
+ n("span", Te, " / " + c(t(e).total), 1),
478
+ t(u).hide ? (b(), D("span", Oe, "(" + c(t(u).hide) + ")", 1)) : $("", !0)
479
+ ])
480
+ ]),
481
+ key: "0"
482
+ } : void 0
483
+ ]), 1024),
484
+ h(r, {
485
+ title: "Fixed on Right",
486
+ class: "flex1",
487
+ "body-class": "border"
488
+ }, K({
489
+ default: d(() => [
490
+ t(e).right.length === 0 ? (b(), D("div", Be, c(a.$l("No Column Fixed on Right")), 1)) : $("", !0),
491
+ h(t(X), {
492
+ list: t(e).right,
493
+ group: "columnFilter",
494
+ class: "dragBody p4-0 yscroll nobar",
495
+ draggable: ".drag",
496
+ style: Q(t(B)),
497
+ "item-key": (l) => l
498
+ }, {
499
+ item: d(({ element: l, index: o }) => [
500
+ h(Z, {
501
+ it: l,
502
+ index: o,
503
+ type: "right",
504
+ lang: t(E),
505
+ onAddLeft: L,
506
+ onChange: _
507
+ }, null, 8, ["it", "index", "lang"])
508
+ ]),
509
+ _: 1
510
+ }, 8, ["list", "style", "item-key"])
511
+ ]),
512
+ _: 2
513
+ }, [
514
+ t(S) ? {
515
+ name: "header",
516
+ fn: d(() => [
517
+ n("div", Me, [
518
+ n("span", Re, c(t(S).visible), 1),
519
+ n("span", Le, " / " + c(t(e).total), 1),
520
+ t(S).hide ? (b(), D("span", Fe, "(" + c(t(S).hide) + ")", 1)) : $("", !0)
521
+ ])
522
+ ]),
523
+ key: "0"
524
+ } : void 0
525
+ ]), 1024)
526
+ ])
527
+ ]),
528
+ _: 1
529
+ }, 8, ["loading"]);
530
+ };
531
+ }
532
+ }), ze = /* @__PURE__ */ te(Ie, [["__scopeId", "data-v-849ae649"]]), Ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
533
+ __proto__: null,
534
+ default: ze
535
+ }, Symbol.toStringTag, { value: "Module" })), He = { class: "p16 wp100 sticky bg-white9 border-b backdrop z2" }, Ye = { class: "flexMode vc g4 p8" }, Ge = { class: "txt-dark5" }, Pe = { class: "txt-dark" }, Je = {
536
+ key: 0,
537
+ class: "flexMode vc p8 g8"
538
+ }, We = {
539
+ key: 0,
540
+ class: "flexMode vc g4"
541
+ }, qe = { class: "txt-dark5" }, Ke = { class: "txt-dark" }, Qe = {
542
+ key: 1,
543
+ class: "flexMode vc p8"
544
+ }, Xe = { class: "txt-dark5" }, Ze = { class: "pl8 pr16 txt-dark" }, et = { class: "flexMode hr vc g16" }, tt = { class: "pr8" }, lt = { class: "relative wp100 pb8 z1" }, ot = { class: "p16 txt-dark9" }, nt = { class: "pr8" }, at = { class: "inputGroup flexMode vc flexGrow" }, st = { class: "inputGroupRight" }, rt = W({
545
+ name: "TableDownload"
546
+ }), it = /* @__PURE__ */ Object.assign(rt, {
547
+ props: {
548
+ params: {
549
+ type: Object,
550
+ default: /* @__PURE__ */ Object.create(null)
551
+ },
552
+ loadData: {
553
+ type: [Function, void 0],
554
+ default: void 0
555
+ }
556
+ },
557
+ setup(M, { emit: H }) {
558
+ const g = M, e = q({
559
+ loading: !1,
560
+ columns: [],
561
+ items: [],
562
+ all: !1,
563
+ // 下载所有
564
+ onlySelection: !1,
565
+ // 只下载选中项
566
+ remoteDownload: !1,
567
+ // 远程下载
568
+ filename: "",
569
+ // 文件名
570
+ useCountryName: !1,
571
+ // 使用国家名称
572
+ widthTableHead: !0,
573
+ allData: []
574
+ }), { proxy: m } = se(), y = me();
575
+ re(() => {
576
+ Y();
577
+ });
578
+ const Y = () => {
579
+ N(), V();
580
+ }, N = () => {
581
+ j.value.length && (e.onlySelection = !0);
582
+ }, V = () => {
583
+ const l = JSON.parse(localStorage.getItem(S.value)) || [], o = [], A = [];
584
+ l.forEach((x) => {
585
+ x.prop && (o.push(x), x.visible && A.push(x.prop));
586
+ }), e.columns = o, e.items = A;
587
+ }, R = (l) => {
588
+ l && !e.allData.length && L();
589
+ }, L = async () => {
590
+ e.loading = !0;
591
+ const { list: l, total: o } = await g.loadData({
592
+ pageStart: 1,
593
+ pageSize: 99999
594
+ });
595
+ e.loading = !1, o && (e.allData = l);
596
+ }, _ = () => {
597
+ }, T = (l = ",", o) => {
598
+ const A = e.items.map((w) => i.value[w].label);
599
+ let x = [];
600
+ e.all ? x = e.allData : e.onlySelection ? x = j.value : x = r.value;
601
+ const G = x.map((w) => {
602
+ const I = [];
603
+ return e.items.forEach((k) => {
604
+ if (["country"].includes(k))
605
+ if (e.useCountryName) {
606
+ const z = window.$getType(w[k]);
607
+ let f;
608
+ z === "Array" ? f = w[k] : f = w[k].split(","), f = f.map((le) => pe("country.asaObj")[le.toLowerCase()][`label_${B.value}`]), I.push(`"${f.join(",")}"`);
609
+ } else
610
+ I.push(`"${w[k]}"`);
611
+ else if (["spendOrigin"].includes(k)) {
612
+ const z = w.currency + " " + (w[`${k}Format`] || w[k]);
613
+ I.push(`"${z || "-"}"`);
614
+ } else {
615
+ const z = w[`${k}Format`] || w[k];
616
+ I.push(`"${z || "-"}"`);
617
+ }
618
+ }), I.join(l);
619
+ });
620
+ return o && G.unshift(A.join(l)), G.join(`
621
+ `);
622
+ }, F = () => {
623
+ var o;
624
+ let l = !1;
625
+ if ((e.onlySelection && ((o = g.params.selection) != null && o.length) || r.value.length) && (l = !0), l) {
626
+ const A = T(" ", e.withTableHead);
627
+ window.$copy(A);
628
+ } else
629
+ m.$message.info("No Data to Download");
630
+ }, O = () => {
631
+ const l = T(",", !0);
632
+ let o = u.value;
633
+ e.filename ? o ? o += `_${e.filename}` : o = e.filename : o || (o = E.value), ue({
634
+ type: "csv",
635
+ name: o,
636
+ data: l
637
+ });
638
+ }, B = p(() => window.$getLang()), s = p(() => g.params.tableName), u = p(() => s.value ? `${window.$l(s.value)}_${window.$m().format("YYYYMMDD_hhmmss")}` : ""), S = p(() => g.params.tableName + "_Column"), E = p(() => `${y.name}_${window.$m().format("YYYYMMDD_hhmmss")}`), a = p(() => g.params.useAll && !!g.loadData), i = p(() => {
639
+ const l = {};
640
+ return e.columns.forEach((o) => {
641
+ l[o.prop] = o;
642
+ }), l;
643
+ }), r = p(() => {
644
+ var l;
645
+ return ((l = g.params) == null ? void 0 : l.list) || [];
646
+ }), j = p(() => {
647
+ var l;
648
+ return ((l = g.params) == null ? void 0 : l.selection) || [];
649
+ }), v = p(() => e.loading ? !0 : e.all ? !e.allData.length : e.items.length === 0 || r.value.length === 0);
650
+ return (l, o) => {
651
+ const A = C("el-checkbox"), x = C("el-button"), G = C("Alert"), w = C("el-switch"), I = C("el-checkbox-group"), k = C("el-input"), z = C("DrawerArea");
652
+ return b(), U(z, {
653
+ loading: t(e).loading,
654
+ onSubmit: O
655
+ }, {
656
+ footer: d(() => [
657
+ n("div", at, [
658
+ h(k, {
659
+ modelValue: t(e).filename,
660
+ "onUpdate:modelValue": o[5] || (o[5] = (f) => t(e).filename = f),
661
+ clearable: "",
662
+ placeholder: t(u),
663
+ class: "inputGroupLeft"
664
+ }, {
665
+ prefix: d(() => [...o[7] || (o[7] = [
666
+ n("i", { class: "imicon im-file" }, null, -1)
667
+ ])]),
668
+ _: 1
669
+ }, 8, ["modelValue", "placeholder"]),
670
+ n("div", st, [
671
+ h(x, {
672
+ disabled: t(v),
673
+ plain: "",
674
+ type: "primary",
675
+ onClick: O
676
+ }, {
677
+ icon: d(() => [...o[8] || (o[8] = [
678
+ n("i", { class: "imicon im-download1" }, null, -1)
679
+ ])]),
680
+ default: d(() => [
681
+ n("span", null, c(l.$l("Download")), 1)
682
+ ]),
683
+ _: 1
684
+ }, 8, ["disabled"])
685
+ ])
686
+ ])
687
+ ]),
688
+ default: d(() => [
689
+ n("div", He, [
690
+ h(G, null, {
691
+ default: d(() => [
692
+ n("div", Ye, [
693
+ n("span", Ge, c(l.$l("Total in Current Page")) + ": ", 1),
694
+ n("span", Pe, c(t(r).length), 1)
695
+ ]),
696
+ t(a) ? (b(), D("div", Je, [
697
+ h(A, {
698
+ modelValue: t(e).all,
699
+ "onUpdate:modelValue": o[0] || (o[0] = (f) => t(e).all = f),
700
+ label: l.$l("Download All Data"),
701
+ class: "h24",
702
+ onChange: R
703
+ }, null, 8, ["modelValue", "label"]),
704
+ t(e).allData.length ? (b(), D("div", We, [
705
+ n("span", qe, c(l.$l("Total in All Page")) + ":", 1),
706
+ n("span", Ke, c(t(e).allData.length), 1)
707
+ ])) : $("", !0)
708
+ ])) : $("", !0),
709
+ t(j).length ? (b(), D("div", Qe, [
710
+ n("span", Xe, c(l.$l("Selected")), 1),
711
+ n("span", Ze, c(t(j).length), 1),
712
+ h(A, {
713
+ modelValue: t(e).onlySelection,
714
+ "onUpdate:modelValue": o[1] || (o[1] = (f) => t(e).onlySelection = f),
715
+ label: l.$l("Only Selection"),
716
+ disabled: t(e).all,
717
+ class: "h24"
718
+ }, null, 8, ["modelValue", "label", "disabled"])
719
+ ])) : $("", !0),
720
+ n("div", et, [
721
+ h(x, {
722
+ plain: "",
723
+ size: "default",
724
+ onClick: F
725
+ }, {
726
+ icon: d(() => [...o[6] || (o[6] = [
727
+ n("i", { class: "imicon im-copy" }, null, -1)
728
+ ])]),
729
+ default: d(() => [
730
+ n("span", tt, c(l.$l("Copy to Clipboard")), 1),
731
+ h(A, {
732
+ modelValue: t(e).withTableHead,
733
+ "onUpdate:modelValue": o[2] || (o[2] = (f) => t(e).withTableHead = f),
734
+ label: l.$l("With Table Head"),
735
+ onClick: ee((f) => null, ["stop"])
736
+ }, null, 8, ["modelValue", "label"])
737
+ ]),
738
+ _: 1
739
+ })
740
+ ])
741
+ ]),
742
+ _: 1
743
+ })
744
+ ]),
745
+ n("div", lt, [
746
+ n("div", ot, c(l.$l("What do you want to Download?")), 1),
747
+ h(I, {
748
+ modelValue: t(e).items,
749
+ "onUpdate:modelValue": o[4] || (o[4] = (f) => t(e).items = f)
750
+ }, {
751
+ default: d(() => [
752
+ (b(!0), D(de, null, ce(t(e).columns, (f, le) => (b(), U(A, {
753
+ key: f.prop,
754
+ value: f.prop,
755
+ class: "wp100 p0-16 h36 hover-bg-gray1"
756
+ }, {
757
+ default: d(() => [
758
+ n("span", nt, c(f.label), 1),
759
+ f.prop === "country" ? (b(), U(w, {
760
+ key: 0,
761
+ modelValue: t(e).useCountryName,
762
+ "onUpdate:modelValue": o[3] || (o[3] = (ie) => t(e).useCountryName = ie),
763
+ "inline-prompt": "",
764
+ "active-text": " Use name  ",
765
+ "inactive-text": " Use Alpha-2 code ",
766
+ onChange: _
767
+ }, null, 8, ["modelValue"])) : $("", !0)
768
+ ]),
769
+ _: 2
770
+ }, 1032, ["value"]))), 128))
771
+ ]),
772
+ _: 1
773
+ }, 8, ["modelValue"])
774
+ ])
775
+ ]),
776
+ _: 1
777
+ }, 8, ["loading"]);
778
+ };
779
+ }
780
+ }), dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
781
+ __proto__: null,
782
+ default: it
783
+ }, Symbol.toStringTag, { value: "Module" }));
784
+ export {
785
+ ht as T
786
+ };