@znap/components-vue2 1.1.7 → 1.2.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.
@@ -0,0 +1,2856 @@
1
+ var H = Object.defineProperty;
2
+ var Z = (s, e, t) => e in s ? H(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var p = (s, e, t) => Z(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import v from "moment";
5
+ import { HotTable as Q } from "@handsontable/vue";
6
+ import "handsontable/dist/handsontable.full.min.css";
7
+ function u(s, e, t, a, r, n, i, o) {
8
+ var l = typeof s == "function" ? s.options : s;
9
+ return e && (l.render = e, l.staticRenderFns = t, l._compiled = !0), n && (l._scopeId = "data-v-" + n), {
10
+ exports: s,
11
+ options: l
12
+ };
13
+ }
14
+ const U = {
15
+ props: {
16
+ minWidth: {
17
+ default: "48px",
18
+ required: !1,
19
+ type: String
20
+ },
21
+ buttonClass: {
22
+ default: "",
23
+ required: !1,
24
+ type: String
25
+ },
26
+ text: {
27
+ default: "Limpar filtros",
28
+ required: !1,
29
+ type: String
30
+ },
31
+ size: {
32
+ required: !1,
33
+ default: "small",
34
+ type: String
35
+ },
36
+ color: {
37
+ required: !1,
38
+ default: "secondary",
39
+ type: String
40
+ }
41
+ }
42
+ };
43
+ var J = function() {
44
+ var e = this, t = e._self._c;
45
+ return t("v-tooltip", { attrs: { top: "" }, scopedSlots: e._u([{ key: "activator", fn: function({ on: a }) {
46
+ return [t("v-btn", e._g(e._b({ class: e.buttonClass, attrs: { color: e.color, "min-width": e.minWidth } }, "v-btn", e.$attrs, !1), { ...a, ...e.$listeners }), [t("v-icon", [e._v("mdi-cancel")])], 1)];
47
+ } }]) }, [t("span", [e._v(" " + e._s(e.text) + " ")])]);
48
+ }, X = [], G = /* @__PURE__ */ u(
49
+ U,
50
+ J,
51
+ X,
52
+ !1,
53
+ null,
54
+ "90656fff"
55
+ );
56
+ const k = G.exports, ee = {
57
+ props: {
58
+ minWidth: {
59
+ default: "48px",
60
+ required: !1,
61
+ type: String
62
+ },
63
+ buttonClass: {
64
+ default: "",
65
+ required: !1,
66
+ type: String
67
+ },
68
+ text: {
69
+ default: "Fechar",
70
+ required: !1,
71
+ type: String
72
+ },
73
+ size: {
74
+ required: !1,
75
+ default: "small",
76
+ type: String
77
+ },
78
+ color: {
79
+ required: !1,
80
+ default: "primary",
81
+ type: String
82
+ }
83
+ }
84
+ };
85
+ var te = function() {
86
+ var e = this, t = e._self._c;
87
+ return t("v-tooltip", { attrs: { top: "" }, scopedSlots: e._u([{ key: "activator", fn: function({ on: a }) {
88
+ return [t("v-btn", e._g(e._b({ class: e.buttonClass, attrs: { color: e.color, "min-width": e.minWidth } }, "v-btn", e.$attrs, !1), { ...a, ...e.$listeners }), [t("v-icon", [e._v("mdi-close")])], 1)];
89
+ } }]) }, [t("span", [e._v(" " + e._s(e.text) + " ")])]);
90
+ }, se = [], ae = /* @__PURE__ */ u(
91
+ ee,
92
+ te,
93
+ se,
94
+ !1,
95
+ null,
96
+ "b0b960ea"
97
+ );
98
+ const b = ae.exports, ne = {
99
+ props: {
100
+ minWidth: {
101
+ default: "48px",
102
+ required: !1,
103
+ type: String
104
+ },
105
+ buttonClass: {
106
+ default: "",
107
+ required: !1,
108
+ type: String
109
+ },
110
+ text: {
111
+ default: "Atualizar",
112
+ required: !1,
113
+ type: String
114
+ },
115
+ size: {
116
+ required: !1,
117
+ default: "small",
118
+ type: String
119
+ },
120
+ color: {
121
+ required: !1,
122
+ default: "primary",
123
+ type: String
124
+ }
125
+ }
126
+ };
127
+ var re = function() {
128
+ var e = this, t = e._self._c;
129
+ return t("v-tooltip", { attrs: { top: "" }, scopedSlots: e._u([{ key: "activator", fn: function({ on: a }) {
130
+ return [t("v-btn", e._g(e._b({ class: e.buttonClass, attrs: { color: e.color, "min-width": e.minWidth } }, "v-btn", e.$attrs, !1), { ...a, ...e.$listeners }), [t("v-icon", [e._v("mdi-refresh")])], 1)];
131
+ } }]) }, [t("span", [e._v(" " + e._s(e.text) + " ")])]);
132
+ }, ie = [], oe = /* @__PURE__ */ u(
133
+ ne,
134
+ re,
135
+ ie,
136
+ !1,
137
+ null,
138
+ "9907c6df"
139
+ );
140
+ const x = oe.exports, le = {
141
+ props: {
142
+ minWidth: {
143
+ default: "48px",
144
+ required: !1,
145
+ type: String
146
+ },
147
+ buttonClass: {
148
+ default: "",
149
+ required: !1,
150
+ type: String
151
+ },
152
+ text: {
153
+ default: "Filtros",
154
+ required: !1,
155
+ type: String
156
+ },
157
+ size: {
158
+ required: !1,
159
+ default: "small",
160
+ type: String
161
+ },
162
+ color: {
163
+ required: !1,
164
+ default: "secondary",
165
+ type: String
166
+ }
167
+ }
168
+ };
169
+ var ce = function() {
170
+ var e = this, t = e._self._c;
171
+ return t("v-tooltip", { attrs: { top: "" }, scopedSlots: e._u([{ key: "activator", fn: function({ on: a }) {
172
+ return [t("v-btn", e._g(e._b({ class: e.buttonClass, attrs: { color: e.color, "min-width": e.minWidth } }, "v-btn", e.$attrs, !1), { ...a, ...e.$listeners }), [t("v-icon", [e._v("mdi-filter")])], 1)];
173
+ } }]) }, [t("span", [e._v(" " + e._s(e.text) + " ")])]);
174
+ }, ue = [], de = /* @__PURE__ */ u(
175
+ le,
176
+ ce,
177
+ ue,
178
+ !1,
179
+ null,
180
+ "4039282c"
181
+ );
182
+ const D = de.exports, pe = {
183
+ props: {
184
+ icon: {
185
+ default: "mdi-microsoft-excel",
186
+ required: !1,
187
+ type: String
188
+ },
189
+ minWidth: {
190
+ default: "48px",
191
+ required: !1,
192
+ type: String
193
+ },
194
+ buttonClass: {
195
+ default: "",
196
+ required: !1,
197
+ type: String
198
+ },
199
+ text: {
200
+ default: "Exportar Excel",
201
+ required: !1,
202
+ type: String
203
+ },
204
+ size: {
205
+ required: !1,
206
+ default: "small",
207
+ type: String
208
+ },
209
+ color: {
210
+ required: !1,
211
+ default: "primary",
212
+ type: String
213
+ }
214
+ }
215
+ };
216
+ var fe = function() {
217
+ var e = this, t = e._self._c;
218
+ return t("v-tooltip", { attrs: { top: "" }, scopedSlots: e._u([{ key: "activator", fn: function({ on: a }) {
219
+ return [t("v-btn", e._g(e._b({ class: e.buttonClass, attrs: { color: e.color, "min-width": e.minWidth } }, "v-btn", e.$attrs, !1), { ...a, ...e.$listeners }), [t("v-icon", [e._v(e._s(e.icon))])], 1)];
220
+ } }]) }, [t("span", [e._v(" " + e._s(e.text) + " ")])]);
221
+ }, me = [], he = /* @__PURE__ */ u(
222
+ pe,
223
+ fe,
224
+ me,
225
+ !1,
226
+ null,
227
+ "215bbc35"
228
+ );
229
+ const q = he.exports, ve = {
230
+ props: {
231
+ icon: {
232
+ default: "mdi-file-excel",
233
+ required: !1,
234
+ type: String
235
+ },
236
+ minWidth: {
237
+ default: "48px",
238
+ required: !1,
239
+ type: String
240
+ },
241
+ buttonClass: {
242
+ default: "",
243
+ required: !1,
244
+ type: String
245
+ },
246
+ text: {
247
+ default: "Importar excel",
248
+ required: !1,
249
+ type: String
250
+ },
251
+ size: {
252
+ required: !1,
253
+ default: "small",
254
+ type: String
255
+ },
256
+ color: {
257
+ required: !1,
258
+ default: "primary",
259
+ type: String
260
+ }
261
+ },
262
+ emits: ["getFileUploaderRef", "changeFile"],
263
+ mounted() {
264
+ this.$emit("getFileUploaderRef", this.$refs.uploader);
265
+ },
266
+ methods: {
267
+ onChangeFile(s) {
268
+ this.$emit("changeFile", s);
269
+ }
270
+ }
271
+ };
272
+ var _e = function() {
273
+ var e = this, t = e._self._c;
274
+ return t("v-tooltip", { attrs: { top: "" }, scopedSlots: e._u([{ key: "activator", fn: function({ on: a }) {
275
+ return [t("v-btn", e._g(e._b({ class: e.buttonClass, attrs: { color: e.color, "min-width": e.minWidth } }, "v-btn", e.$attrs, !1), { ...a, ...e.$listeners }), [t("v-icon", [e._v(e._s(e.icon))])], 1), t("input", { ref: "uploader", staticClass: "d-none", attrs: { type: "file" }, on: { change: e.onChangeFile } })];
276
+ } }]) }, [t("span", [e._v(" " + e._s(e.text) + " ")])]);
277
+ }, ye = [], ge = /* @__PURE__ */ u(
278
+ ve,
279
+ _e,
280
+ ye,
281
+ !1,
282
+ null,
283
+ "b92ee8b6"
284
+ );
285
+ const B = ge.exports, be = {
286
+ props: {
287
+ minWidth: {
288
+ default: "48px",
289
+ required: !1,
290
+ type: String
291
+ },
292
+ buttonClass: {
293
+ default: "",
294
+ required: !1,
295
+ type: String
296
+ },
297
+ text: {
298
+ default: "Adicionar nova linha",
299
+ required: !1,
300
+ type: String
301
+ },
302
+ size: {
303
+ required: !1,
304
+ default: "small",
305
+ type: String
306
+ },
307
+ color: {
308
+ required: !1,
309
+ default: "primary",
310
+ type: String
311
+ }
312
+ }
313
+ };
314
+ var xe = function() {
315
+ var e = this, t = e._self._c;
316
+ return t("v-tooltip", { attrs: { top: "" }, scopedSlots: e._u([{ key: "activator", fn: function({ on: a }) {
317
+ return [t("v-btn", e._g(e._b({ class: e.buttonClass, attrs: { color: e.color, "min-width": e.minWidth } }, "v-btn", e.$attrs, !1), { ...a, ...e.$listeners }), [t("v-icon", [e._v("mdi-plus")])], 1)];
318
+ } }]) }, [t("span", [e._v(" " + e._s(e.text) + " ")])]);
319
+ }, Se = [], $e = /* @__PURE__ */ u(
320
+ be,
321
+ xe,
322
+ Se,
323
+ !1,
324
+ null,
325
+ "066df4e1"
326
+ );
327
+ const R = $e.exports, Fe = {
328
+ inheritAttrs: !1,
329
+ props: {
330
+ icon: {
331
+ default: "mdi-content-save",
332
+ required: !1,
333
+ type: String
334
+ },
335
+ minWidth: {
336
+ default: "48px",
337
+ required: !1,
338
+ type: String
339
+ },
340
+ buttonClass: {
341
+ default: "",
342
+ required: !1,
343
+ type: String
344
+ },
345
+ text: {
346
+ default: "Salvar",
347
+ required: !1,
348
+ type: String
349
+ },
350
+ size: {
351
+ required: !1,
352
+ default: "small",
353
+ type: String
354
+ },
355
+ color: {
356
+ required: !1,
357
+ default: "primary",
358
+ type: String
359
+ },
360
+ disabled: {
361
+ required: !1,
362
+ default: !1,
363
+ type: Boolean
364
+ }
365
+ }
366
+ };
367
+ var Ce = function() {
368
+ var e = this, t = e._self._c;
369
+ return t("v-tooltip", { attrs: { top: "" }, scopedSlots: e._u([{ key: "activator", fn: function({ on: a }) {
370
+ return [t("v-btn", e._g(e._b({ class: e.buttonClass, attrs: { color: e.color, "min-width": e.minWidth, disabled: e.disabled } }, "v-btn", e.$attrs, !1), { ...a, ...e.$listeners }), [t("v-icon", [e._v(e._s(e.icon))])], 1)];
371
+ } }]) }, [t("span", [e._v(" " + e._s(e.text) + " ")])]);
372
+ }, we = [], ke = /* @__PURE__ */ u(
373
+ Fe,
374
+ Ce,
375
+ we,
376
+ !1,
377
+ null,
378
+ "09aef337"
379
+ );
380
+ const I = ke.exports, De = {
381
+ props: {
382
+ minWidth: {
383
+ default: "48px",
384
+ required: !1,
385
+ type: String
386
+ },
387
+ buttonClass: {
388
+ default: "",
389
+ required: !1,
390
+ type: String
391
+ },
392
+ text: {
393
+ default: "Consolidar valores",
394
+ required: !1,
395
+ type: String
396
+ },
397
+ size: {
398
+ required: !1,
399
+ default: "small",
400
+ type: String
401
+ },
402
+ color: {
403
+ required: !1,
404
+ default: "secondary",
405
+ type: String
406
+ },
407
+ disabled: {
408
+ required: !1,
409
+ default: !1,
410
+ type: Boolean
411
+ }
412
+ }
413
+ };
414
+ var qe = function() {
415
+ var e = this, t = e._self._c;
416
+ return t("v-tooltip", { attrs: { top: "" }, scopedSlots: e._u([{ key: "activator", fn: function({ on: a }) {
417
+ return [t("v-btn", e._g(e._b({ class: e.buttonClass, attrs: { color: e.color, "min-width": e.minWidth, disabled: e.disabled } }, "v-btn", e.$attrs, !1), { ...a, ...e.$listeners }), [t("v-icon", [e._v("mdi-calculator-variant")])], 1)];
418
+ } }]) }, [t("span", [e._v(e._s(e.text))])]);
419
+ }, Be = [], Re = /* @__PURE__ */ u(
420
+ De,
421
+ qe,
422
+ Be,
423
+ !1,
424
+ null,
425
+ "58757950"
426
+ );
427
+ const Ie = Re.exports, Me = {
428
+ props: {
429
+ minWidth: {
430
+ default: "48px",
431
+ required: !1,
432
+ type: String
433
+ },
434
+ buttonClass: {
435
+ default: "",
436
+ required: !1,
437
+ type: String
438
+ },
439
+ text: {
440
+ default: "Remover linha(s) selecionada(s)",
441
+ required: !1,
442
+ type: String
443
+ },
444
+ size: {
445
+ required: !1,
446
+ default: "small",
447
+ type: String
448
+ },
449
+ color: {
450
+ required: !1,
451
+ default: "primary",
452
+ type: String
453
+ },
454
+ disabled: {
455
+ required: !1,
456
+ default: !1,
457
+ type: Boolean
458
+ }
459
+ }
460
+ };
461
+ var Ee = function() {
462
+ var e = this, t = e._self._c;
463
+ return t("v-tooltip", { attrs: { top: "" }, scopedSlots: e._u([{ key: "activator", fn: function({ on: a }) {
464
+ return [t("v-btn", e._g(e._b({ class: e.buttonClass, attrs: { color: e.color, "min-width": e.minWidth, disabled: e.disabled } }, "v-btn", e.$attrs, !1), { ...a, ...e.$listeners }), [t("v-icon", [e._v("mdi-delete-sweep")])], 1)];
465
+ } }]) }, [t("span", [e._v(e._s(e.text))])]);
466
+ }, Oe = [], Te = /* @__PURE__ */ u(
467
+ Me,
468
+ Ee,
469
+ Oe,
470
+ !1,
471
+ null,
472
+ "48390312"
473
+ );
474
+ const M = Te.exports, Pe = {
475
+ props: {
476
+ buttonClass: {
477
+ default: "",
478
+ required: !1,
479
+ type: String
480
+ },
481
+ text: {
482
+ default: "",
483
+ required: !1,
484
+ type: String
485
+ },
486
+ size: {
487
+ required: !1,
488
+ default: "small",
489
+ type: String
490
+ },
491
+ color: {
492
+ required: !1,
493
+ default: "primary",
494
+ type: String
495
+ }
496
+ }
497
+ };
498
+ var Ae = function() {
499
+ var e = this, t = e._self._c;
500
+ return t("v-btn", e._g(e._b({ class: e.buttonClass, attrs: { color: e.color, text: "" } }, "v-btn", e.$attrs, !1), { ...e.$listeners }), [e._v(" " + e._s(e.text) + " ")]);
501
+ }, Ve = [], Ne = /* @__PURE__ */ u(
502
+ Pe,
503
+ Ae,
504
+ Ve,
505
+ !1,
506
+ null,
507
+ "bd5e11bb"
508
+ );
509
+ const S = Ne.exports, je = {
510
+ props: {
511
+ minWidth: {
512
+ default: "48px",
513
+ required: !1,
514
+ type: String
515
+ },
516
+ buttonClass: {
517
+ default: "",
518
+ required: !1,
519
+ type: String
520
+ },
521
+ text: {
522
+ default: "Duplicar item selecionado",
523
+ required: !1,
524
+ type: String
525
+ },
526
+ size: {
527
+ required: !1,
528
+ default: "small",
529
+ type: String
530
+ },
531
+ color: {
532
+ required: !1,
533
+ default: "secondary",
534
+ type: String
535
+ }
536
+ }
537
+ };
538
+ var Ye = function() {
539
+ var e = this, t = e._self._c;
540
+ return t("v-tooltip", { attrs: { top: "" }, scopedSlots: e._u([{ key: "activator", fn: function({ on: a }) {
541
+ return [t("v-btn", e._g(e._b({ class: e.buttonClass, attrs: { color: e.color, "min-width": e.minWidth } }, "v-btn", e.$attrs, !1), { ...a, ...e.$listeners }), [t("v-icon", [e._v("mdi-content-duplicate")])], 1)];
542
+ } }]) }, [t("span", [e._v(" " + e._s(e.text) + " ")])]);
543
+ }, Ke = [], Le = /* @__PURE__ */ u(
544
+ je,
545
+ Ye,
546
+ Ke,
547
+ !1,
548
+ null,
549
+ "5bae9fc6"
550
+ );
551
+ const E = Le.exports, We = {
552
+ props: {
553
+ minWidth: {
554
+ default: "48px",
555
+ required: !1,
556
+ type: String
557
+ },
558
+ buttonClass: {
559
+ default: "",
560
+ required: !1,
561
+ type: String
562
+ },
563
+ text: {
564
+ default: "Editar item selecionado",
565
+ required: !1,
566
+ type: String
567
+ },
568
+ size: {
569
+ required: !1,
570
+ default: "small",
571
+ type: String
572
+ },
573
+ color: {
574
+ required: !1,
575
+ default: "secondary",
576
+ type: String
577
+ }
578
+ }
579
+ };
580
+ var ze = function() {
581
+ var e = this, t = e._self._c;
582
+ return t("v-tooltip", { attrs: { top: "" }, scopedSlots: e._u([{ key: "activator", fn: function({ on: a }) {
583
+ return [t("v-btn", e._g(e._b({ class: e.buttonClass, attrs: { color: e.color, "min-width": e.minWidth } }, "v-btn", e.$attrs, !1), { ...a, ...e.$listeners }), [t("v-icon", [e._v("mdi-pencil")])], 1)];
584
+ } }]) }, [t("span", [e._v(" " + e._s(e.text) + " ")])]);
585
+ }, He = [], Ze = /* @__PURE__ */ u(
586
+ We,
587
+ ze,
588
+ He,
589
+ !1,
590
+ null,
591
+ "4ead0419"
592
+ );
593
+ const O = Ze.exports, Qe = {
594
+ props: {
595
+ minWidth: {
596
+ default: "48px",
597
+ required: !1,
598
+ type: String
599
+ },
600
+ buttonClass: {
601
+ default: "",
602
+ required: !1,
603
+ type: String
604
+ },
605
+ text: {
606
+ default: "Desfazer alterações",
607
+ required: !1,
608
+ type: String
609
+ },
610
+ size: {
611
+ required: !1,
612
+ default: "small",
613
+ type: String
614
+ },
615
+ color: {
616
+ required: !1,
617
+ default: "secondary",
618
+ type: String
619
+ }
620
+ }
621
+ };
622
+ var Ue = function() {
623
+ var e = this, t = e._self._c;
624
+ return t("v-tooltip", { attrs: { top: "" }, scopedSlots: e._u([{ key: "activator", fn: function({ on: a }) {
625
+ return [t("v-btn", e._g(e._b({ class: e.buttonClass, attrs: { color: e.color, "min-width": e.minWidth } }, "v-btn", e.$attrs, !1), { ...a, ...e.$listeners }), [t("v-icon", [e._v("mdi mdi-undo-variant")])], 1)];
626
+ } }]) }, [t("span", [e._v(" " + e._s(e.text) + " ")])]);
627
+ }, Je = [], Xe = /* @__PURE__ */ u(
628
+ Qe,
629
+ Ue,
630
+ Je,
631
+ !1,
632
+ null,
633
+ "b3cd2dc7"
634
+ );
635
+ const T = Xe.exports, Ge = {
636
+ props: {
637
+ tableIcon: {
638
+ required: !0,
639
+ default: "",
640
+ type: String
641
+ },
642
+ tableName: {
643
+ required: !0,
644
+ default: "",
645
+ type: String
646
+ }
647
+ }
648
+ };
649
+ var et = function() {
650
+ var e = this, t = e._self._c;
651
+ return t("section", { ref: "cardHeaderRef" }, [t("div", { staticClass: "d-flex align-center pt-2 pb-4" }, [t("div", { staticClass: "d-flex align-start mr-4" }, [t("v-icon", { attrs: { "x-large": "", color: "primary" } }, [e._v(e._s(e.tableIcon))])], 1), t("span", { staticClass: "text-h6 font-weight-regular", staticStyle: { display: "inline-block", "white-space": "nowrap", overflow: "hidden !important", "text-overflow": "ellipsis" } }, [e._v(" " + e._s(e.tableName) + " ")]), t("v-spacer"), e._t("default")], 2)]);
652
+ }, tt = [], st = /* @__PURE__ */ u(
653
+ Ge,
654
+ et,
655
+ tt,
656
+ !1,
657
+ null,
658
+ "936f6d66"
659
+ );
660
+ const P = st.exports, at = {
661
+ props: {
662
+ tableIcon: {
663
+ required: !0,
664
+ default: "",
665
+ type: String
666
+ },
667
+ tableName: {
668
+ required: !0,
669
+ default: "",
670
+ type: String
671
+ },
672
+ showPrimaryFilters: {
673
+ require: !1,
674
+ default: !0,
675
+ type: Boolean
676
+ },
677
+ closeTableButton: {
678
+ require: !1,
679
+ default: () => ({
680
+ show: !0,
681
+ text: void 0,
682
+ minWidth: void 0,
683
+ color: void 0
684
+ })
685
+ }
686
+ },
687
+ components: {
688
+ CloseTableButton: b,
689
+ ViewHeader: P
690
+ },
691
+ data() {
692
+ return {
693
+ isComponentMounted: !1
694
+ };
695
+ },
696
+ emits: ["closeTable"],
697
+ mounted() {
698
+ window.addEventListener("resize", this.adjustComponentLayout), this.isComponentMounted = !0, this.$nextTick(() => {
699
+ this.adjustComponentLayout();
700
+ });
701
+ },
702
+ beforeDestroy() {
703
+ this.isComponentMounted = !1, window.removeEventListener("resize", this.adjustComponentLayout);
704
+ },
705
+ methods: {
706
+ closeTable() {
707
+ this.$emit("closeTable");
708
+ },
709
+ adjustComponentLayout() {
710
+ if (!this.isComponentMounted || !this.$el) return;
711
+ const s = document.querySelector(".v-app-bar"), t = `calc(100vh - ${s ? s.offsetHeight : 64}px)`, a = this.$el;
712
+ a && (a.style.height = t, a.style.maxHeight = t, a.style.overflow = "hidden");
713
+ }
714
+ }
715
+ };
716
+ var nt = function() {
717
+ var e = this, t = e._self._c;
718
+ return t("v-container", { staticClass: "znap-crud-full-height-container", attrs: { fluid: "", "fill-height": "", app: "" } }, [t("v-card", { staticClass: "px-4 rounded-t d-flex flex-column", staticStyle: { width: "100%", height: "100%" }, attrs: { color: "white" } }, [t("ViewHeader", { attrs: { tableIcon: e.tableIcon, tableName: e.tableName } }, [e._t("action-buttons"), e.closeTableButton.show ? t("CloseTableButton", { attrs: { color: e.closeTableButton.color, "min-width": e.closeTableButton.minWidth, text: e.closeTableButton.text, buttonClass: "pa-0" }, on: { click: e.closeTable } }) : e._e()], 2), t("v-divider", { staticClass: "mb-2" }), e.showPrimaryFilters ? t("section", { ref: "filtersRef" }, [e._t("primary-filters")], 2) : e._e(), t("section", { ref: "default-container", staticClass: "w-100 flex-grow-1 d-flex flex-column" }, [e._t("default")], 2)], 1)], 1);
719
+ }, rt = [], it = /* @__PURE__ */ u(
720
+ at,
721
+ nt,
722
+ rt,
723
+ !1,
724
+ null,
725
+ "78062916"
726
+ );
727
+ const A = it.exports, ot = {
728
+ props: {
729
+ message: {
730
+ required: !0,
731
+ default: ""
732
+ }
733
+ }
734
+ };
735
+ var lt = function() {
736
+ var e = this, t = e._self._c;
737
+ return t("v-row", { staticClass: "justify-center mb-5 mt-3 text-h6 primary--text", staticStyle: { color: "#e71b7b", "font-size": "1.25rem" } }, [e._v(" " + e._s(e.message) + " ")]);
738
+ }, ct = [], ut = /* @__PURE__ */ u(
739
+ ot,
740
+ lt,
741
+ ct,
742
+ !1,
743
+ null,
744
+ "2dfbf14b"
745
+ );
746
+ const V = ut.exports, dt = {
747
+ props: {
748
+ formAction: {
749
+ default: ""
750
+ },
751
+ formSubject: {
752
+ default: ""
753
+ },
754
+ showCloseButton: {
755
+ default: !0
756
+ }
757
+ },
758
+ emits: ["close"]
759
+ };
760
+ var pt = function() {
761
+ var e = this, t = e._self._c;
762
+ return t("v-card-title", { staticClass: "light--text", style: `background: linear-gradient(90deg, ${e.$vuetify.theme.themes.light.primary} 0%, ${e.$vuetify.theme.themes.light.secondary} 100%)` }, [t("span", { ref: "formTitle", staticClass: "headline" }, [e._v(" " + e._s(e.formAction) + " " + e._s(e.formSubject) + " ")]), t("v-spacer"), e._t("default"), e.showCloseButton ? t("v-tooltip", { attrs: { top: "" }, scopedSlots: e._u([{ key: "activator", fn: function({ on: a }) {
763
+ return [t("v-btn", e._g({ staticClass: "pa-0", attrs: { "min-width": "48px", text: "", dark: "" }, on: { click: function(r) {
764
+ return e.$emit("close");
765
+ } } }, a), [t("v-icon", { attrs: { color: "light" } }, [e._v("mdi-close")])], 1)];
766
+ } }], null, !1, 519693881) }, [t("span", [e._v("Fechar")])]) : e._e()], 2);
767
+ }, ft = [], mt = /* @__PURE__ */ u(
768
+ dt,
769
+ pt,
770
+ ft,
771
+ !1,
772
+ null,
773
+ "63d665a0"
774
+ );
775
+ const N = mt.exports, ht = {};
776
+ var vt = function() {
777
+ var e = this, t = e._self._c;
778
+ return t("span", { staticClass: "text-caption primary--text ml-3" }, [e._v("* Campos obrigatórios")]);
779
+ }, _t = [], yt = /* @__PURE__ */ u(
780
+ ht,
781
+ vt,
782
+ _t,
783
+ !1,
784
+ null,
785
+ "8a322ee4"
786
+ );
787
+ const j = yt.exports, gt = {
788
+ props: {
789
+ showRequiredFieldsIndicator: {
790
+ default: !0
791
+ },
792
+ showCancelButton: {
793
+ default: !0
794
+ },
795
+ cancelButtonText: {
796
+ default: "Cancelar"
797
+ },
798
+ showSubmitButton: {
799
+ default: !0
800
+ },
801
+ submitButtonText: {
802
+ default: "Salvar"
803
+ },
804
+ submitButtonLoadingText: {
805
+ default: "Carregando..."
806
+ },
807
+ disableSubmitButton: {
808
+ default: !1
809
+ },
810
+ loading: {
811
+ default: !1
812
+ },
813
+ readOnly: {
814
+ default: !1
815
+ }
816
+ },
817
+ components: {
818
+ RequiredFieldsIndicator: j
819
+ },
820
+ emits: ["close", "submit"]
821
+ };
822
+ var bt = function() {
823
+ var e = this, t = e._self._c;
824
+ return t("div", { staticClass: "light" }, [t("v-divider", { staticClass: "mx-4" }), t("v-card-actions", { staticClass: "px-6 py-6" }, [e.showRequiredFieldsIndicator ? t("RequiredFieldsIndicator") : e._e(), t("v-spacer"), e.showCancelButton ? t("v-btn", { staticClass: "mr-4", attrs: { color: "primary", text: "" }, on: { click: function(a) {
825
+ return e.$emit("close");
826
+ } } }, [e._v(" " + e._s(e.cancelButtonText) + " ")]) : e._e(), e.showSubmitButton || e.readOnly ? t("v-btn", { attrs: { color: "primary", disabled: e.disableSubmitButton, loading: e.loading }, on: { click: function(a) {
827
+ return e.$emit("submit");
828
+ } } }, [e._v(" " + e._s(e.loading ? e.submitButtonLoadingText : e.submitButtonText) + " ")]) : e._e()], 1)], 1);
829
+ }, xt = [], St = /* @__PURE__ */ u(
830
+ gt,
831
+ bt,
832
+ xt,
833
+ !1,
834
+ null,
835
+ "36312b96"
836
+ );
837
+ const Y = St.exports, $t = {};
838
+ var Ft = function() {
839
+ var e = this, t = e._self._c;
840
+ return t("section", { staticClass: "text-center" }, [t("v-progress-circular", { attrs: { color: "primary", indeterminate: "", size: "50" } })], 1);
841
+ }, Ct = [], wt = /* @__PURE__ */ u(
842
+ $t,
843
+ Ft,
844
+ Ct,
845
+ !1,
846
+ null,
847
+ "e541b081"
848
+ );
849
+ const y = wt.exports, kt = {
850
+ props: {
851
+ formAction: {
852
+ default: ""
853
+ },
854
+ formSubject: {
855
+ default: ""
856
+ },
857
+ showCloseButton: {
858
+ default: !0
859
+ },
860
+ isLoadingData: {
861
+ default: !1
862
+ },
863
+ disableSubmitButton: {
864
+ default: !1
865
+ },
866
+ loading: {
867
+ default: !1
868
+ },
869
+ readOnly: {
870
+ default: !0
871
+ },
872
+ submitButtonLoadingText: {
873
+ required: !1
874
+ },
875
+ submitButtonText: {
876
+ required: !1
877
+ },
878
+ showSubmitButton: {
879
+ default: !0
880
+ },
881
+ cancelButtonText: {
882
+ required: !1
883
+ },
884
+ showCancelButton: {
885
+ default: !0
886
+ },
887
+ maxWidth: {
888
+ default: "80%"
889
+ },
890
+ scrollable: {
891
+ default: !0
892
+ },
893
+ validateOn: {
894
+ default: "submit"
895
+ }
896
+ },
897
+ data() {
898
+ return {
899
+ showModal: !1
900
+ };
901
+ },
902
+ components: { FormTitle: N, FormFooter: Y, LoadingIndicator: y },
903
+ emits: ["close", "submit"],
904
+ methods: {
905
+ show() {
906
+ this.showModal = !0, this.resetFormValidation();
907
+ },
908
+ close() {
909
+ this.$emit("close");
910
+ },
911
+ hidden() {
912
+ this.showModal = !1, this.resetFormValidation();
913
+ },
914
+ submit() {
915
+ this.$emit("submit");
916
+ },
917
+ async validateForm() {
918
+ var e, t;
919
+ return await ((t = (e = this.$refs) == null ? void 0 : e.formRef) == null ? void 0 : t.validate());
920
+ },
921
+ resetFormValidation() {
922
+ var s, e;
923
+ (e = (s = this.$refs) == null ? void 0 : s.formRef) == null || e.resetValidation();
924
+ }
925
+ }
926
+ };
927
+ var Dt = function() {
928
+ var e = this, t = e._self._c;
929
+ return t("v-dialog", { attrs: { "max-width": e.maxWidth, scrollable: e.scrollable }, model: { value: e.showModal, callback: function(a) {
930
+ e.showModal = a;
931
+ }, expression: "showModal" } }, [t("v-form", { ref: "formRef", attrs: { "lazy-validation": !0, readonly: e.readOnly }, on: { submit: function(a) {
932
+ a.preventDefault();
933
+ } } }, [t("v-card", [t("FormTitle", { attrs: { "form-action": e.formAction, "form-subject": e.formSubject, "show-close-button": e.showCloseButton }, on: { close: e.close } }), t("v-card-text", [e.isLoadingData ? t("LoadingIndicator", { staticClass: "mt-3" }) : t("section", { staticClass: "pa-5" }, [e._t("default")], 2)], 1), t("FormFooter", { attrs: { loading: e.loading, "read-only": e.readOnly, "submit-button-loading-text": e.submitButtonLoadingText, "submit-button-text": e.submitButtonText, "show-submit-button": e.showSubmitButton, "cancel-button-text": e.cancelButtonText, "disable-submit-button": e.disableSubmitButton && !e.isLoadingData, "show-cancel-button": e.showCancelButton }, on: { close: e.close, submit: e.submit } })], 1)], 1)], 1);
934
+ }, qt = [], Bt = /* @__PURE__ */ u(
935
+ kt,
936
+ Dt,
937
+ qt,
938
+ !1,
939
+ null,
940
+ "fd576364"
941
+ );
942
+ const K = Bt.exports, Rt = {
943
+ components: {
944
+ TextButton: S
945
+ },
946
+ data() {
947
+ return {
948
+ showModal: !1,
949
+ onSave: () => {
950
+ },
951
+ onWithoutSave: () => {
952
+ }
953
+ };
954
+ },
955
+ emits: ["hidden"],
956
+ methods: {
957
+ show({ onSave: s = () => {
958
+ }, onWithoutSave: e = () => {
959
+ } } = {}) {
960
+ this.onSave = s, this.onWithoutSave = e, this.showModal = !0;
961
+ },
962
+ close() {
963
+ this.$emit("hidden");
964
+ },
965
+ hidden() {
966
+ this.onSave = () => {
967
+ }, this.onWithoutSave = () => {
968
+ }, this.showModal = !1;
969
+ },
970
+ submit({ save: s = !0 }) {
971
+ const e = s ? this.onSave : this.onWithoutSave;
972
+ this.hidden(), e();
973
+ }
974
+ },
975
+ destroyed() {
976
+ this.onSave = () => {
977
+ }, this.onWithoutSave = () => {
978
+ };
979
+ }
980
+ };
981
+ var It = function() {
982
+ var e = this, t = e._self._c;
983
+ return t("v-dialog", { attrs: { "max-width": "850px" }, model: { value: e.showModal, callback: function(a) {
984
+ e.showModal = a;
985
+ }, expression: "showModal" } }, [t("v-card", [t("div", { staticClass: "d-flex justify-center" }, [t("v-card-title", { staticClass: "headline" }, [e._v(" Você possui edições não salvas. Tem certeza de que deseja continuar? ")])], 1), t("v-card-actions", { staticClass: "px-6 pb-6" }, [t("v-spacer"), t("TextButton", { attrs: { color: "primary", text: "Cancelar", buttonClass: "mr-4" }, on: { click: e.close } }), t("TextButton", { attrs: { color: "secondary", text: "Continuar sem salvar", buttonClass: "mr-4" }, on: { click: function(a) {
986
+ return e.submit({ save: !1 });
987
+ } } }), t("v-btn", { attrs: { color: "primary" }, on: { click: function(a) {
988
+ return e.submit({ save: !0 });
989
+ } } }, [e._v(" Salvar e continuar ")])], 1)], 1)], 1);
990
+ }, Mt = [], Et = /* @__PURE__ */ u(
991
+ Rt,
992
+ It,
993
+ Mt,
994
+ !1,
995
+ null,
996
+ "53a39d49"
997
+ );
998
+ const L = Et.exports, Ot = {
999
+ components: {
1000
+ TextButton: S
1001
+ },
1002
+ data() {
1003
+ return {
1004
+ showModal: !1
1005
+ };
1006
+ },
1007
+ emits: ["hidden", "submit"],
1008
+ methods: {
1009
+ show() {
1010
+ this.showModal = !0;
1011
+ },
1012
+ close() {
1013
+ this.$emit("hidden");
1014
+ },
1015
+ hidden() {
1016
+ this.showModal = !1;
1017
+ },
1018
+ submit() {
1019
+ this.hidden(), this.$emit("submit");
1020
+ }
1021
+ }
1022
+ };
1023
+ var Tt = function() {
1024
+ var e = this, t = e._self._c;
1025
+ return t("v-dialog", { attrs: { "max-width": "850px" }, model: { value: e.showModal, callback: function(a) {
1026
+ e.showModal = a;
1027
+ }, expression: "showModal" } }, [t("v-card", [t("div", { staticClass: "d-flex justify-center" }, [t("v-card-title", { staticClass: "headline" }, [e._v(" Tem certeza de que deseja excluir esta(s) linha(s)? ")])], 1), t("v-card-actions", { staticClass: "px-6 pb-6" }, [t("v-spacer"), t("TextButton", { attrs: { color: "primary", text: "Cancelar", buttonClass: "mr-4" }, on: { click: e.close } }), t("v-btn", { attrs: { color: "primary" }, on: { click: function(a) {
1028
+ return e.submit();
1029
+ } } }, [e._v(" Confirmar ")])], 1)], 1)], 1);
1030
+ }, Pt = [], At = /* @__PURE__ */ u(
1031
+ Ot,
1032
+ Tt,
1033
+ Pt,
1034
+ !1,
1035
+ null,
1036
+ "8e3b5cd9"
1037
+ );
1038
+ const W = At.exports, Vt = {
1039
+ props: {
1040
+ label: { type: String, required: !0 },
1041
+ clearable: { type: Boolean, default: !0 },
1042
+ disabled: { type: Boolean, required: !1 },
1043
+ range: { type: Boolean, default: !1 },
1044
+ initialValue: { default: null }
1045
+ },
1046
+ data() {
1047
+ return {
1048
+ dates: "",
1049
+ menu: !1
1050
+ };
1051
+ },
1052
+ mounted() {
1053
+ this.dates = this.initialValue;
1054
+ },
1055
+ computed: {
1056
+ closeMenuOnContentClick() {
1057
+ return !this.range;
1058
+ }
1059
+ },
1060
+ methods: {
1061
+ handleDateChange(s) {
1062
+ this.dates = s, this.setDatepickerValue();
1063
+ },
1064
+ formattedDates() {
1065
+ return !this.dates || this.dates.length === 0 ? null : this.range ? this.dates.length === 2 ? `${v(this.dates[0]).format("DD/MM/YYYY")} - ${v(
1066
+ this.dates[1]
1067
+ ).format("DD/MM/YYYY")}` : v(this.dates[0]).format("DD/MM/YYYY") : v(this.dates).format("DD/MM/YYYY");
1068
+ },
1069
+ setDatepickerValue() {
1070
+ let s = "";
1071
+ this.range || (s = v(this.dates).format("YYYY-MM-DD")), this.range && (s = this.dates.length === 2 ? [
1072
+ v(this.dates[0]).format("YYYY-MM-DD"),
1073
+ v(this.dates[1]).format("YYYY-MM-DD")
1074
+ ] : [v(this.dates[0]).format("YYYY-MM-DD")]), this.$emit("setDatepickerValue", s);
1075
+ },
1076
+ clearSelectedFilter() {
1077
+ this.dates = this.range ? [] : null, this.$emit("setDatepickerValue", null);
1078
+ }
1079
+ }
1080
+ };
1081
+ var Nt = function() {
1082
+ var e = this, t = e._self._c;
1083
+ return t("v-menu", { ref: "menu", attrs: { "close-on-content-click": e.closeMenuOnContentClick, transition: "scale-transition", "offset-y": "", "min-width": "auto" }, scopedSlots: e._u([{ key: "activator", fn: function({ on: a }) {
1084
+ return [t("v-text-field", e._g({ staticClass: "pb-2", attrs: { value: e.formattedDates(), label: e.label, "append-icon": "mdi-calendar", readonly: "", clearable: e.clearable, "hide-details": "auto", disabled: e.disabled }, on: { "click:clear": function(r) {
1085
+ return e.clearSelectedFilter();
1086
+ } } }, a))];
1087
+ } }]), model: { value: e.menu, callback: function(a) {
1088
+ e.menu = a;
1089
+ }, expression: "menu" } }, [t("v-date-picker", { attrs: { color: "primary", "no-title": "", scrollable: "", range: e.range, disabled: e.disabled }, on: { input: e.handleDateChange }, model: { value: e.dates, callback: function(a) {
1090
+ e.dates = a;
1091
+ }, expression: "dates" } })], 1);
1092
+ }, jt = [], Yt = /* @__PURE__ */ u(
1093
+ Vt,
1094
+ Nt,
1095
+ jt,
1096
+ !1,
1097
+ null,
1098
+ null
1099
+ );
1100
+ const g = Yt.exports, Kt = {
1101
+ components: {
1102
+ BaseFormLayout: K,
1103
+ DatePicker: g
1104
+ },
1105
+ props: {
1106
+ headers: {
1107
+ type: Array,
1108
+ required: !0
1109
+ },
1110
+ primaryKey: {
1111
+ type: String,
1112
+ required: !0
1113
+ },
1114
+ formSettings: {
1115
+ type: Object,
1116
+ required: !0
1117
+ }
1118
+ },
1119
+ data() {
1120
+ return {
1121
+ formAction: "Novo",
1122
+ loadingData: !1,
1123
+ item: {}
1124
+ };
1125
+ },
1126
+ emits: ["hidden", "submit"],
1127
+ created() {
1128
+ this.item = { ...this.formSettings.baseModel ?? {} };
1129
+ },
1130
+ computed: {
1131
+ formOptionsByColumnMap() {
1132
+ var e, t, a;
1133
+ const s = /* @__PURE__ */ new Map();
1134
+ if (!((t = (e = this.formSettings) == null ? void 0 : e.formOptions) != null && t.length)) return s;
1135
+ for (const r of (a = this.formSettings) == null ? void 0 : a.formOptions)
1136
+ s.set(r.column, r);
1137
+ return s;
1138
+ },
1139
+ headersByValueMap() {
1140
+ const s = /* @__PURE__ */ new Map();
1141
+ if (!this.headers.length) return s;
1142
+ for (const e of this.headers)
1143
+ s.set(e.value, e);
1144
+ return s;
1145
+ }
1146
+ },
1147
+ methods: {
1148
+ async show(s = null) {
1149
+ var e, t, a, r, n, i, o, l, d, c;
1150
+ try {
1151
+ this.loadingData = !0, this.item = { ...this.formSettings.baseModel ?? {} }, s && (this.formAction = s[this.primaryKey] ? "Editar" : "Criar", (t = (e = this == null ? void 0 : this.formSettings) == null ? void 0 : e.hooks) != null && t.beforeSetItem && await ((r = (a = this == null ? void 0 : this.formSettings) == null ? void 0 : a.hooks) == null ? void 0 : r.beforeSetItem(s)), this.item = { ...s }, (i = (n = this == null ? void 0 : this.formSettings) == null ? void 0 : n.hooks) != null && i.afterSetItem && await ((l = (o = this == null ? void 0 : this.formSettings) == null ? void 0 : o.hooks) == null ? void 0 : l.afterSetItem(this.item))), (c = (d = this.$refs) == null ? void 0 : d.formRef) == null || c.show();
1152
+ } catch (f) {
1153
+ this.$fnError(f);
1154
+ } finally {
1155
+ this.loadingData = !1;
1156
+ }
1157
+ },
1158
+ close() {
1159
+ this.$emit("hidden");
1160
+ },
1161
+ hidden() {
1162
+ var s, e;
1163
+ (e = (s = this.$refs) == null ? void 0 : s.formRef) == null || e.hidden(), this.formAction = "Novo";
1164
+ },
1165
+ async submit() {
1166
+ var e;
1167
+ await ((e = this.$refs.formRef) == null ? void 0 : e.validateForm()) && this.$emit("submit", { ...this.item });
1168
+ },
1169
+ getDependentFieldMessage(s, e) {
1170
+ var n, i;
1171
+ const t = this.formOptionsByColumnMap.get(e.value), a = t == null ? void 0 : t.dependsOn;
1172
+ if (!a || !this.isDependentFieldEmpty(s, e)) return;
1173
+ const r = this.headersByValueMap.get(a);
1174
+ if (r)
1175
+ return `O campo ${(n = e.text) == null ? void 0 : n.toLowerCase()} depende do campo ${(i = r.text) == null ? void 0 : i.toLowerCase()}.`;
1176
+ },
1177
+ isDependentFieldEmpty(s, e) {
1178
+ const t = this.formOptionsByColumnMap.get(e.value), a = t == null ? void 0 : t.dependsOn;
1179
+ return a ? s[a] === null || s[a] === void 0 || s[a] === "" : !1;
1180
+ },
1181
+ getOptions(s, e) {
1182
+ const t = this.formOptionsByColumnMap.get(s.value);
1183
+ if (!t) return [];
1184
+ if (!t.dependsOn) return t.items;
1185
+ const a = t.dependsOn, r = e[a], n = r == null || r === "";
1186
+ return a && n ? [] : t.items;
1187
+ },
1188
+ getRequiredFieldMessage(s) {
1189
+ return `O campo ${s} é obrigatorio!`;
1190
+ },
1191
+ getFieldValidations(s, e) {
1192
+ var o;
1193
+ const t = e.value, a = s[t], r = [], n = this.isRequired(e), i = [null, void 0, ""].includes(a);
1194
+ return n && i && r.push(
1195
+ this.getRequiredFieldMessage(((o = e == null ? void 0 : e.text) == null ? void 0 : o.toLowerCase()) ?? "")
1196
+ ), r;
1197
+ },
1198
+ formatFloat(s) {
1199
+ var e, t;
1200
+ return s == null ? "" : (t = (e = this == null ? void 0 : this.$options) == null ? void 0 : e.filters) == null ? void 0 : t.floatFilter(s);
1201
+ },
1202
+ isRequired(s) {
1203
+ var e;
1204
+ return s.rules ? (e = s.rules) == null ? void 0 : e.includes("required") : !1;
1205
+ },
1206
+ getLabel(s) {
1207
+ return this.isRequired(s) ? `${s.text} *` : s.text;
1208
+ },
1209
+ formatCheckboxValue(s) {
1210
+ return !!s;
1211
+ },
1212
+ setSelectedOption(s, e, t, a) {
1213
+ var o, l, d, c;
1214
+ const r = this.formOptionsByColumnMap.get(t);
1215
+ (o = r.hooks) != null && o.beforeChange && ((l = r.hooks) == null || l.beforeChange(s));
1216
+ const n = a ? a.id : null, i = a ? a.text : null;
1217
+ s[e] = n, s[t] = i, (d = r.hooks) != null && d.afterChange && ((c = r.hooks) == null || c.afterChange(s));
1218
+ }
1219
+ }
1220
+ };
1221
+ var Lt = function() {
1222
+ var e = this, t = e._self._c;
1223
+ return t("BaseFormLayout", { ref: "formRef", attrs: { "form-action": e.formAction, "form-subject": "item", "read-only": !1, "is-loading-data": e.loadingData, loading: e.formSettings.loading }, on: { close: e.close, submit: e.submit } }, [e._l(e.headers, function(a) {
1224
+ return [!a.hideInForm && a.type ? t("v-row", { key: a.value }, [t("v-col", { attrs: { cols: "12" } }, [a.options && a.columnType !== "radio" ? t("v-autocomplete", { attrs: { label: e.getLabel(a), items: e.getOptions(a, e.item), clearable: !e.isRequired(a), "item-label": "text", "return-object": "", disabled: e.isDependentFieldEmpty(e.item, a), messages: e.getDependentFieldMessage(e.item, a), rules: e.getFieldValidations(e.item, a), "hide-details": "auto" }, on: { change: function(r) {
1225
+ return e.setSelectedOption(e.item, a.columnId, a.value, r);
1226
+ } }, model: { value: e.item[a.value], callback: function(r) {
1227
+ e.$set(e.item, a.value, r);
1228
+ }, expression: "item[header.value]" } }) : a.options && a.columnType === "radio" && a.type === "VARCHAR" ? t("v-radio-group", { staticClass: "mt-0 py-2", attrs: { rules: e.getFieldValidations(e.item, a), "hide-details": "auto" }, scopedSlots: e._u([{ key: "label", fn: function() {
1229
+ return [t("span", { staticClass: "text-subtitle-1" }, [e._v(" " + e._s(e.getLabel(a)) + " ")])];
1230
+ }, proxy: !0 }], null, !0), model: { value: e.item[a.value], callback: function(r) {
1231
+ e.$set(e.item, a.value, r);
1232
+ }, expression: "item[header.value]" } }, [e._l(e.getOptions(a, e.item), function(r) {
1233
+ return t("v-radio", { key: r.id, staticClass: "d-flex align-center", attrs: { ripple: !1, value: r.text }, scopedSlots: e._u([{ key: "label", fn: function() {
1234
+ return [t("span", { staticClass: "mr-4" }, [e._v(e._s(r.text))]), t("span", { staticClass: "text-caption" }, [e._v("(" + e._s(r.description) + ")")])];
1235
+ }, proxy: !0 }], null, !0) });
1236
+ })], 2) : a.type === "INT" && a.columnType === "check" ? t("v-switch", { attrs: { label: e.getLabel(a), rules: e.getFieldValidations(e.item, a), "hide-details": "auto" }, model: { value: e.item[a.value], callback: function(r) {
1237
+ e.$set(e.item, a.value, r);
1238
+ }, expression: "item[header.value]" } }) : a.type === "INT" && a.columnType !== "check" ? t("v-text-field", { attrs: { label: e.getLabel(a), type: "number", counter: a.length, maxlength: a.length, rules: e.getFieldValidations(e.item, a), "hide-details": "auto" }, model: { value: e.item[a.value], callback: function(r) {
1239
+ e.$set(e.item, a.value, e._n(r));
1240
+ }, expression: "item[header.value]" } }) : a.type === "DECIMAL" ? t("v-text-field", { attrs: { label: e.getLabel(a), type: "number", counter: a.length, maxlength: a.length, rules: e.getFieldValidations(e.item, a), "hide-details": "auto" }, on: { change: function(r) {
1241
+ return e.formatFloat(e.item[a.value]);
1242
+ } }, model: { value: e.item[a.value], callback: function(r) {
1243
+ e.$set(e.item, a.value, e._n(r));
1244
+ }, expression: "item[header.value]" } }) : a.type === "VARCHAR" || a.type === "TEXT" ? t("v-text-field", { attrs: { label: e.getLabel(a), type: "text", counter: a.length, maxlength: a.length, rules: e.getFieldValidations(e.item, a), "hide-details": "auto" }, model: { value: e.item[a.value], callback: function(r) {
1245
+ e.$set(e.item, a.value, r);
1246
+ }, expression: "item[header.value]" } }) : a.type === "DATE" || a.type === "DATETIME" ? t("DatePicker", { attrs: { label: a.text, "initial-value": e.item[a.value], rules: e.getFieldValidations(e.item, a), "hide-details": "auto" }, on: { setDatepickerValue: function(r) {
1247
+ e.item[a.value] = r;
1248
+ } } }) : e._e()], 1)], 1) : e._e()];
1249
+ })], 2);
1250
+ }, Wt = [], zt = /* @__PURE__ */ u(
1251
+ Kt,
1252
+ Lt,
1253
+ Wt,
1254
+ !1,
1255
+ null,
1256
+ "9f5172cd"
1257
+ );
1258
+ const z = zt.exports, Ht = {
1259
+ props: {
1260
+ filters: {
1261
+ type: Array,
1262
+ required: !0,
1263
+ default: () => []
1264
+ }
1265
+ },
1266
+ emits: ["refresh", "hidden", "update:filter", "clear:filters"],
1267
+ components: {
1268
+ LoadingIndicator: y,
1269
+ RefreshButton: x,
1270
+ CloseTableButton: b,
1271
+ ClearFilterButton: k,
1272
+ DatePicker: g
1273
+ },
1274
+ data() {
1275
+ return {
1276
+ showDrawer: !1,
1277
+ isLoadingData: !1,
1278
+ tabIndex: 0
1279
+ };
1280
+ },
1281
+ computed: {
1282
+ filterOptionIndexByColumnMap() {
1283
+ var e;
1284
+ const s = /* @__PURE__ */ new Map();
1285
+ if (!((e = this.filters) != null && e.length)) return s;
1286
+ for (const [t, a] of this.filters.entries())
1287
+ for (const [r, n] of a == null ? void 0 : a.filters.entries())
1288
+ s.set(n.column, [t, r]);
1289
+ return s;
1290
+ }
1291
+ },
1292
+ methods: {
1293
+ show() {
1294
+ this.showDrawer = !0;
1295
+ },
1296
+ close() {
1297
+ this.$emit("hidden");
1298
+ },
1299
+ hidden() {
1300
+ this.showDrawer = !1;
1301
+ },
1302
+ setFilter(s, e) {
1303
+ this.$emit("update:filter", e, s);
1304
+ },
1305
+ isFieldDependentFieldEmpty(s) {
1306
+ const e = s == null ? void 0 : s.dependsOn;
1307
+ if (!e) return !1;
1308
+ const t = this.filterOptionIndexByColumnMap.get(e);
1309
+ return !!(isNaN(t) || !this.filters[t[0]].filters[t[1]].value);
1310
+ },
1311
+ changeFilterValue(s, e) {
1312
+ e.value = s, e != null && e.hooks.afterChange && (e == null || e.hooks.afterChange(s));
1313
+ }
1314
+ },
1315
+ watch: {},
1316
+ created() {
1317
+ },
1318
+ destroyed() {
1319
+ }
1320
+ };
1321
+ var Zt = function() {
1322
+ var a;
1323
+ var e = this, t = e._self._c;
1324
+ return t("v-navigation-drawer", { attrs: { temporary: "", "hide-overlay": "", absolute: "", right: "", width: "500" }, model: { value: e.showDrawer, callback: function(r) {
1325
+ e.showDrawer = r;
1326
+ }, expression: "showDrawer" } }, [t("section", { staticClass: "d-flex justify-end mt-3 w-100 mb-2" }, [t("ClearFilterButton", { attrs: { "button-class": "mr-4", "min-width": "48px" }, on: { click: function(r) {
1327
+ return e.$emit("clear:filters");
1328
+ } } }), t("RefreshButton", { attrs: { "button-class": "mr-4", "min-width": "48px" }, on: { click: function(r) {
1329
+ return e.$emit("refresh");
1330
+ } } }), t("CloseTableButton", { attrs: { "button-class": "mr-3" }, on: { click: e.close } })], 1), e.isLoadingData ? t("section", { staticClass: "h-100 d-flex justify-center align-center" }, [t("LoadingIndicator", { staticClass: "mt-4" })], 1) : t("section", { staticClass: "mx-3 mt-4" }, [(a = e.filters) != null && a.length ? t("section", [t("v-tabs", { attrs: { height: "30" }, model: { value: e.tabIndex, callback: function(r) {
1331
+ e.tabIndex = r;
1332
+ }, expression: "tabIndex" } }, e._l(e.filters.entries(), function([r, n]) {
1333
+ return t("v-tab", { key: r }, [e._v(" " + e._s(n.title) + " ")]);
1334
+ }), 1), t("v-tabs-items", { staticClass: "mt-3", model: { value: e.tabIndex, callback: function(r) {
1335
+ e.tabIndex = r;
1336
+ }, expression: "tabIndex" } }, e._l(e.filters.entries(), function([r, n]) {
1337
+ return t("v-tab-item", { key: r }, e._l(n.filters, function(i) {
1338
+ var o, l;
1339
+ return t("v-row", { key: `${i.column}-${i.type}`, attrs: { "no-gutters": "" } }, [t("v-col", [i.component === "v-autocomplete" ? t("v-autocomplete", e._b({ attrs: { items: i.items, "item-text": "text", "item-value": "id", "return-object": !1, disabled: e.isFieldDependentFieldEmpty(i) }, on: { change: function(d) {
1340
+ return e.changeFilterValue(d, i);
1341
+ } }, model: { value: i.value, callback: function(d) {
1342
+ e.$set(i, "value", d);
1343
+ }, expression: "filter.value" } }, "v-autocomplete", i.componentProps, !1)) : i.component === "v-checkbox" ? t("v-checkbox", e._b({ staticStyle: { display: "inline-block", "white-space": "nowrap", overflow: "hidden !important", "text-overflow": "ellipsis" }, attrs: { "hide-details": "", disabled: e.isFieldDependentFieldEmpty(i) }, on: { change: function(d) {
1344
+ return e.changeFilterValue(d, i);
1345
+ } }, model: { value: i.value, callback: function(d) {
1346
+ e.$set(i, "value", d);
1347
+ }, expression: "filter.value" } }, "v-checkbox", i.componentProps, !1)) : i.component === "date-picker" ? t("DatePicker", e._b({ attrs: { "initial-value": i.value, label: (o = i.componentProps) == null ? void 0 : o.label, disabled: e.isFieldDependentFieldEmpty(i) }, on: { setDatepickerValue: function(d) {
1348
+ return e.changeFilterValue(d, i);
1349
+ } } }, "DatePicker", i.componentProps, !1)) : i.component === "v-text-field" ? t("v-text-field", e._b({ directives: [{ name: "maska", rawName: "v-maska", value: (l = i.componentProps) == null ? void 0 : l.mask, expression: "filter.componentProps?.mask" }], attrs: { type: "text", disabled: e.isFieldDependentFieldEmpty(i) }, on: { change: function(d) {
1350
+ return e.changeFilterValue(d, i);
1351
+ } }, model: { value: i.value, callback: function(d) {
1352
+ e.$set(i, "value", d);
1353
+ }, expression: "filter.value" } }, "v-text-field", i.componentProps, !1)) : e._e()], 1)], 1);
1354
+ }), 1);
1355
+ }), 1)], 1) : e._e()])]);
1356
+ }, Qt = [], Ut = /* @__PURE__ */ u(
1357
+ Ht,
1358
+ Zt,
1359
+ Qt,
1360
+ !1,
1361
+ null,
1362
+ "af7a55c2"
1363
+ );
1364
+ const Jt = Ut.exports, Xt = {
1365
+ props: {
1366
+ tableIcon: {
1367
+ type: String,
1368
+ required: !0
1369
+ },
1370
+ tableName: {
1371
+ type: String,
1372
+ required: !0
1373
+ },
1374
+ endpoint: {
1375
+ type: Array,
1376
+ required: !0
1377
+ },
1378
+ filters: {
1379
+ type: Object,
1380
+ required: !1
1381
+ },
1382
+ tableOptions: {
1383
+ type: Array
1384
+ },
1385
+ formOptions: {
1386
+ type: Array,
1387
+ required: !1,
1388
+ default: () => []
1389
+ },
1390
+ apiData: {
1391
+ type: Array,
1392
+ required: !0,
1393
+ default: () => []
1394
+ },
1395
+ headers: {
1396
+ type: Array,
1397
+ required: !0,
1398
+ default: () => []
1399
+ },
1400
+ loading: {
1401
+ type: Boolean,
1402
+ required: !0,
1403
+ default: !1
1404
+ },
1405
+ hasFetch: {
1406
+ type: Boolean,
1407
+ required: !0,
1408
+ default: !1
1409
+ },
1410
+ paginationSettings: {
1411
+ type: Object,
1412
+ required: !0
1413
+ },
1414
+ useServerSidePagination: {
1415
+ type: Boolean,
1416
+ required: !1,
1417
+ default: !1
1418
+ },
1419
+ useServerSideSearch: {
1420
+ type: Boolean,
1421
+ required: !1,
1422
+ default: !1
1423
+ },
1424
+ primaryKey: {
1425
+ type: String,
1426
+ required: !0
1427
+ },
1428
+ rowsChanged: {
1429
+ type: Set,
1430
+ required: !0
1431
+ },
1432
+ onReload: {
1433
+ type: Function,
1434
+ required: !0
1435
+ },
1436
+ onExport: {
1437
+ type: Function,
1438
+ required: !0
1439
+ },
1440
+ onImport: {
1441
+ type: Function,
1442
+ required: !0
1443
+ },
1444
+ onSave: {
1445
+ type: Function,
1446
+ required: !0
1447
+ },
1448
+ onDelete: {
1449
+ type: Function,
1450
+ required: !0
1451
+ },
1452
+ formSettings: {
1453
+ type: Object,
1454
+ required: !0
1455
+ },
1456
+ "update:rows-changed": {
1457
+ type: Function,
1458
+ required: !1
1459
+ },
1460
+ "update:row": {
1461
+ type: Function,
1462
+ required: !1
1463
+ }
1464
+ },
1465
+ components: {
1466
+ BaseViewLayout: A,
1467
+ ImportFileButton: B,
1468
+ ExportFileButton: q,
1469
+ RefreshButton: x,
1470
+ DeleteItemButton: M,
1471
+ NewItemButton: R,
1472
+ DuplicatedItemButton: E,
1473
+ EditItemButton: O,
1474
+ UnsavedChangesDialog: L,
1475
+ RequiredFilterMessage: V,
1476
+ LoadingIndicator: y,
1477
+ DatePicker: g,
1478
+ SaveButton: I,
1479
+ ConfirmDeleteDialog: W,
1480
+ UndoChangesButton: T,
1481
+ BaseCrudForm: z,
1482
+ BaseCrudSecondaryFiltersDrawer: Jt,
1483
+ FiltersButton: D
1484
+ },
1485
+ data() {
1486
+ return {
1487
+ selectedRows: [],
1488
+ selected: [],
1489
+ readOnly: !1,
1490
+ fileUploaderRef: null,
1491
+ loadingExport: !1,
1492
+ loadingImport: !1,
1493
+ loadingSave: !1,
1494
+ loadingDelete: !1,
1495
+ backupEditedItemsMap: /* @__PURE__ */ new Map(),
1496
+ tableMaxHeigth: 0,
1497
+ alreadySetTableHeigth: !1,
1498
+ primaryFilterTab: 0,
1499
+ isComponentMounted: !1
1500
+ };
1501
+ },
1502
+ computed: {
1503
+ paginationOptions: {
1504
+ get() {
1505
+ return this.paginationSettings;
1506
+ },
1507
+ set(s) {
1508
+ const e = this.paginationSettings;
1509
+ if (s.page === e.page && s.itemsPerPage === e.itemsPerPage) return;
1510
+ const a = this.paginationSettings;
1511
+ a.page = s.page, a.itemsPerPage = s.itemsPerPage, a.sortBy = s.sortBy, a.sortDesc = s.sortDesc, this.useServerSidePagination && this.handleReload();
1512
+ }
1513
+ },
1514
+ itemsIndexByPrimaryKey() {
1515
+ const s = /* @__PURE__ */ new Map();
1516
+ for (const [e, t] of this.apiData.entries()) {
1517
+ const a = t[this.primaryKey];
1518
+ s.set(a, e);
1519
+ }
1520
+ return s;
1521
+ },
1522
+ tableOptionsByColumnMap() {
1523
+ var e;
1524
+ const s = /* @__PURE__ */ new Map();
1525
+ if (!((e = this.tableOptions) != null && e.length)) return s;
1526
+ for (const t of this.tableOptions)
1527
+ s.set(t.column, t);
1528
+ return s;
1529
+ },
1530
+ primaryFilterOptionIndexByColumnMap() {
1531
+ var e, t, a;
1532
+ const s = /* @__PURE__ */ new Map();
1533
+ if (!((t = (e = this.filters) == null ? void 0 : e.primary) != null && t.length)) return s;
1534
+ for (const [r, n] of (a = this.filters) == null ? void 0 : a.primary.entries())
1535
+ for (const [i, o] of n == null ? void 0 : n.filters.entries())
1536
+ s.set(o.column, [r, i]);
1537
+ return s;
1538
+ },
1539
+ hasRowsSelected() {
1540
+ return this.selectedRows.length;
1541
+ },
1542
+ hasOnlyOneRowSelected() {
1543
+ return this.selectedRows.length === 1;
1544
+ },
1545
+ selectedRowIsEdited() {
1546
+ if (!this.hasOnlyOneRowSelected) return !1;
1547
+ const s = this.selectedRows[0][this.primaryKey];
1548
+ if (!s) return !1;
1549
+ const e = this.itemsIndexByPrimaryKey.get(s);
1550
+ return isNaN(e) ? !1 : this.rowsChanged.has(e);
1551
+ },
1552
+ requiredFilterMessage() {
1553
+ var s, e, t, a, r;
1554
+ if (!((e = (s = this.filters) == null ? void 0 : s.primary) != null && e.length)) return "";
1555
+ for (const n of (t = this == null ? void 0 : this.filters) == null ? void 0 : t.primary)
1556
+ for (const i of n.filters)
1557
+ if ((a = i == null ? void 0 : i.componentProps) != null && a.required && !i.value)
1558
+ return this.getRequiredFilterMessage((r = i == null ? void 0 : i.componentProps) == null ? void 0 : r.label);
1559
+ return "";
1560
+ },
1561
+ allRequiredFilterAreFilled() {
1562
+ var e, t, a;
1563
+ if (!((t = (e = this.filters) == null ? void 0 : e.primary) != null && t.length)) return !0;
1564
+ const s = [];
1565
+ for (const r of (a = this == null ? void 0 : this.filters) == null ? void 0 : a.primary)
1566
+ s.push(
1567
+ ...r.filters.filter((n) => {
1568
+ var i;
1569
+ return (i = n == null ? void 0 : n.componentProps) == null ? void 0 : i.required;
1570
+ })
1571
+ );
1572
+ return s.length ? s.every((r) => r.value) : !0;
1573
+ },
1574
+ tableHeaders() {
1575
+ const s = [];
1576
+ for (const e of this.headers)
1577
+ e != null && e.hideInTable || s.push(e);
1578
+ return s;
1579
+ },
1580
+ hasPrimaryFilters() {
1581
+ var s;
1582
+ return (s = this.filters) == null ? void 0 : s.primary.some((e) => e.filters.length);
1583
+ },
1584
+ hasSecondaryFilters() {
1585
+ var s;
1586
+ return (s = this.filters) == null ? void 0 : s.secondary.some((e) => e.filters.length);
1587
+ }
1588
+ },
1589
+ methods: {
1590
+ getOptions(s, e) {
1591
+ const t = this.tableOptionsByColumnMap.get(s.value);
1592
+ return t != null && t.filterFunction ? t.filterFunction(e) ?? [] : (t == null ? void 0 : t.items) ?? [];
1593
+ },
1594
+ getFormatedItemValue(s, e) {
1595
+ const t = this.tableOptionsByColumnMap.get(s.value);
1596
+ return t && t != null && t.formatter ? t.formatter(e) : e;
1597
+ },
1598
+ changeFilterValue(s, e) {
1599
+ e.value = s, e != null && e.hooks.afterChange && (e == null || e.hooks.afterChange(s));
1600
+ },
1601
+ isFieldDependentFieldEmpty(s) {
1602
+ var n;
1603
+ if (!((n = this.filters) != null && n.primary.length)) return !1;
1604
+ const e = s == null ? void 0 : s.dependsOn;
1605
+ if (!e) return !1;
1606
+ const t = this.primaryFilterOptionIndexByColumnMap.get(e);
1607
+ return !!(isNaN(t) || !this.filters.primary[t[0]].filters[t[1]].value);
1608
+ },
1609
+ setSelectedOption(s, e, t, a) {
1610
+ if (!a) {
1611
+ s[e] = null, s[t] = null;
1612
+ return;
1613
+ }
1614
+ s[e] = a.id, s[t] = a.text;
1615
+ },
1616
+ formatFloat(s) {
1617
+ var e, t;
1618
+ return s == null ? "" : (t = (e = this == null ? void 0 : this.$options) == null ? void 0 : e.filters) == null ? void 0 : t.floatFilter(s);
1619
+ },
1620
+ isRequired(s) {
1621
+ var e;
1622
+ return s.rules ? (e = s.rules) == null ? void 0 : e.includes("required") : !1;
1623
+ },
1624
+ formatCheckboxValue(s) {
1625
+ return !!s;
1626
+ },
1627
+ setCheckboxValue(s, e, t) {
1628
+ this.setBackupEditedItem(e);
1629
+ const a = e[this.primaryKey];
1630
+ if (!a) return;
1631
+ const r = this.itemsIndexByPrimaryKey.get(a);
1632
+ if (!isNaN(r)) {
1633
+ if (this.rowsChanged.add(r), this.$emit("update:rows-changed"), s) return e[t] = 1;
1634
+ e[t] = 0;
1635
+ }
1636
+ },
1637
+ getFileUploaderRef(s) {
1638
+ this.fileUploaderRef = s;
1639
+ },
1640
+ closeTable() {
1641
+ if (this.rowsChanged.size)
1642
+ return this.showUnsavedChangesDialog({
1643
+ onSave: async () => {
1644
+ const s = await this.handleSave({ reload: !1 });
1645
+ s != null && s.error || this.$router.push("/");
1646
+ },
1647
+ onWithoutSave: () => {
1648
+ this.$router.push("/");
1649
+ }
1650
+ });
1651
+ this.$router.push("/");
1652
+ },
1653
+ async handleSave({ reload: s = !0, itemData: e = null } = {}) {
1654
+ try {
1655
+ this.loadingSave = !0, await this.onSave({ reload: s, itemData: e }), e && this.closeBaseCrudForm();
1656
+ } catch (t) {
1657
+ return this.$fnError(t), { error: !0 };
1658
+ } finally {
1659
+ this.loadingSave = !1;
1660
+ }
1661
+ },
1662
+ async handleReload() {
1663
+ if (this.rowsChanged.size)
1664
+ return this.showUnsavedChangesDialog({
1665
+ onSave: async () => {
1666
+ const s = await this.handleSave({ reload: !1 });
1667
+ s != null && s.error || this.reload();
1668
+ },
1669
+ onWithoutSave: () => {
1670
+ this.reload();
1671
+ }
1672
+ });
1673
+ this.reload();
1674
+ },
1675
+ showUnsavedChangesDialog({
1676
+ onSave: s = () => {
1677
+ },
1678
+ onWithoutSave: e = () => {
1679
+ }
1680
+ } = {}) {
1681
+ var t;
1682
+ (t = this.$refs.unsavedChangesDialogRef) == null || t.show({
1683
+ onSave: s,
1684
+ onWithoutSave: e
1685
+ });
1686
+ },
1687
+ closeUnsavedChangesDialog() {
1688
+ var s;
1689
+ (s = this.$refs.unsavedChangesDialogRef) == null || s.hidden();
1690
+ },
1691
+ async reload() {
1692
+ if (this.allRequiredFilterAreFilled)
1693
+ try {
1694
+ this.alreadySetTableHeigth = !1, await this.onReload();
1695
+ } catch (s) {
1696
+ this.$fnError(s);
1697
+ }
1698
+ },
1699
+ getRequiredFilterMessage(s) {
1700
+ return `Selecione o filtro obrigatório ${s} e atualize para exibir dados`;
1701
+ },
1702
+ importFile() {
1703
+ var s;
1704
+ (s = this.fileUploaderRef) == null || s.click();
1705
+ },
1706
+ async handleImport(s) {
1707
+ try {
1708
+ this.loadingImport = !0, await this.onImport(s);
1709
+ } catch (e) {
1710
+ this.$fnError(e);
1711
+ } finally {
1712
+ s.target.value = "", this.loadingImport = !1;
1713
+ }
1714
+ },
1715
+ async handleExport() {
1716
+ try {
1717
+ this.loadingExport = !0, await this.onExport();
1718
+ } catch (s) {
1719
+ this.$fnError(s);
1720
+ } finally {
1721
+ this.loadingExport = !1;
1722
+ }
1723
+ },
1724
+ async deleteSelectedRows() {
1725
+ try {
1726
+ this.loadingDelete = !0, await this.onDelete(this.selectedRows), this.selectedRows = [];
1727
+ } catch (s) {
1728
+ this.$fnError(s);
1729
+ } finally {
1730
+ this.loadingDelete = !1;
1731
+ }
1732
+ },
1733
+ async showConfirmDeleteDialog(s = null) {
1734
+ var e;
1735
+ s && this.selectedRows.push(s), (e = this.$refs.confirmDeleteDialogRef) == null || e.show();
1736
+ },
1737
+ closeConfirmDeleteDialog() {
1738
+ var s;
1739
+ (s = this.$refs.confirmDeleteDialogRef) == null || s.hidden();
1740
+ },
1741
+ itemHasBeenEdited(s) {
1742
+ const e = s[this.primaryKey];
1743
+ if (!e) return;
1744
+ const t = this.itemsIndexByPrimaryKey.get(e);
1745
+ if (!isNaN(t))
1746
+ return this.rowsChanged.has(t);
1747
+ },
1748
+ setBackupEditedItem(s) {
1749
+ const e = s[this.primaryKey];
1750
+ e && (this.backupEditedItemsMap.has(e) || this.backupEditedItemsMap.set(e, { ...s }));
1751
+ },
1752
+ cancelItemEditDialog(s, e) {
1753
+ const t = e[this.primaryKey];
1754
+ if (!t || !this.backupEditedItemsMap.has(t)) return;
1755
+ const a = this.backupEditedItemsMap.get(t);
1756
+ e[s.value] = a[s.value], s.columnId && (e[s.columnId] = a[s.columnId]);
1757
+ },
1758
+ saveItemEditDialog(s) {
1759
+ const e = s[this.primaryKey];
1760
+ if (!e) return;
1761
+ const t = this.itemsIndexByPrimaryKey.get(e);
1762
+ isNaN(t) || (this.rowsChanged.add(t), this.$emit("update:rows-changed"));
1763
+ },
1764
+ undoSelectedItemModification(s) {
1765
+ if (!s) return;
1766
+ const e = s[this.primaryKey];
1767
+ if (!e) return;
1768
+ const t = this.backupEditedItemsMap.get(e);
1769
+ if (!t) return;
1770
+ const a = this.itemsIndexByPrimaryKey.get(e);
1771
+ isNaN(a) || (this.$emit("update:row", a, t), this.rowsChanged.delete(a), this.$emit("update:rows-changed"));
1772
+ },
1773
+ showBaseCrudForm(s = null) {
1774
+ var e;
1775
+ (e = this.$refs.baseCrudFormRef) == null || e.show(s);
1776
+ },
1777
+ closeBaseCrudForm() {
1778
+ var s;
1779
+ (s = this.$refs.baseCrudFormRef) == null || s.hidden();
1780
+ },
1781
+ async handleSubmit(s) {
1782
+ try {
1783
+ await this.handleSave({ itemData: s });
1784
+ } catch (e) {
1785
+ this.$fnError(e);
1786
+ }
1787
+ },
1788
+ duplicateSelectedItem(s) {
1789
+ const e = { ...s };
1790
+ delete e[this.primaryKey], this.showBaseCrudForm(e);
1791
+ },
1792
+ updateSearchFilter(s) {
1793
+ if (!this.filters) return;
1794
+ const e = this.filters;
1795
+ e.search = s;
1796
+ },
1797
+ showSecondaryFilters() {
1798
+ var s;
1799
+ (s = this.$refs.baseCrudSecondaryFiltersDrawerRef) == null || s.show();
1800
+ },
1801
+ closeSecondaryFilters() {
1802
+ var s;
1803
+ (s = this.$refs.baseCrudSecondaryFiltersDrawerRef) == null || s.hidden();
1804
+ },
1805
+ clearSecondaryFilters() {
1806
+ var s, e, t;
1807
+ if ((e = (s = this.filters) == null ? void 0 : s.secondary) != null && e.length)
1808
+ for (const a of (t = this == null ? void 0 : this.filters) == null ? void 0 : t.secondary)
1809
+ for (const r of a.filters)
1810
+ r.type === "filter" && (r.value = null);
1811
+ }
1812
+ },
1813
+ created() {
1814
+ this.paginationOptions = this.paginationSettings;
1815
+ }
1816
+ };
1817
+ var Gt = function() {
1818
+ var a, r;
1819
+ var e = this, t = e._self._c;
1820
+ return t("BaseViewLayout", { ref: "baseViewLayoutRef", attrs: { "table-icon": e.tableIcon, "table-name": e.tableName }, on: { closeTable: e.closeTable }, scopedSlots: e._u([{ key: "action-buttons", fn: function() {
1821
+ var n;
1822
+ return [t("v-text-field", { staticClass: "mr-3", attrs: { "append-icon": "mdi-magnify", label: "Pesquisar", "hide-details": "", "single-line": "", dense: "", clearable: "", loading: e.loading }, on: { input: e.updateSearchFilter } }), e.hasOnlyOneRowSelected ? t("DuplicatedItemButton", { attrs: { buttonClass: "mr-3 pa-0" }, on: { click: function(i) {
1823
+ return e.duplicateSelectedItem(e.selectedRows[0]);
1824
+ } } }) : e._e(), e.hasOnlyOneRowSelected ? t("EditItemButton", { attrs: { buttonClass: "mr-3 pa-0" }, on: { click: function(i) {
1825
+ return e.showBaseCrudForm(e.selectedRows[0]);
1826
+ } } }) : e._e(), e.hasOnlyOneRowSelected && e.selectedRowIsEdited ? t("UndoChangesButton", { attrs: { buttonClass: "mr-3 pa-0" }, on: { click: function(i) {
1827
+ return e.undoSelectedItemModification(e.selectedRows[0]);
1828
+ } } }) : e._e(), e.hasRowsSelected ? t("DeleteItemButton", { attrs: { color: "secondary", buttonClass: "mr-3 pa-0", loading: e.loadingDelete }, on: { click: function(i) {
1829
+ return e.showConfirmDeleteDialog();
1830
+ } } }) : e._e(), e.hasSecondaryFilters ? t("FiltersButton", { attrs: { buttonClass: "mr-4 pa-0" }, on: { click: e.showSecondaryFilters } }) : e._e(), t("NewItemButton", { attrs: { disabled: !e.hasFetch || !((n = e.headers) != null && n.length), buttonClass: "mr-3 pa-0" }, on: { click: function(i) {
1831
+ return e.showBaseCrudForm();
1832
+ } } }), t("RefreshButton", { attrs: { disabled: !e.allRequiredFilterAreFilled, loading: e.loading, buttonClass: "mr-3 pa-0" }, on: { click: e.handleReload } }), t("SaveButton", { attrs: { disabled: !e.rowsChanged.size, loading: e.loadingSave, buttonClass: "mr-3 pa-0" }, on: { click: e.handleSave } }), t("ImportFileButton", { attrs: { loading: e.loadingImport, disabled: !e.allRequiredFilterAreFilled, buttonClass: "mr-3 pa-0" }, on: { click: e.importFile, changeFile: e.handleImport, getFileUploaderRef: e.getFileUploaderRef } }), t("ExportFileButton", { attrs: { buttonClass: "mr-3 pa-0", loading: e.loadingExport, disabled: !e.allRequiredFilterAreFilled }, on: { click: e.handleExport } })];
1833
+ }, proxy: !0 }, { key: "primary-filters", fn: function() {
1834
+ return [e.hasPrimaryFilters ? t("section", [t("v-tabs", { attrs: { height: "30" }, model: { value: e.primaryFilterTab, callback: function(n) {
1835
+ e.primaryFilterTab = n;
1836
+ }, expression: "primaryFilterTab" } }, e._l(e.filters.primary.entries(), function([n, i]) {
1837
+ return t("v-tab", { key: n }, [e._v(" " + e._s(i.title) + " ")]);
1838
+ }), 1), t("v-tabs-items", { staticClass: "mt-3", model: { value: e.primaryFilterTab, callback: function(n) {
1839
+ e.primaryFilterTab = n;
1840
+ }, expression: "primaryFilterTab" } }, e._l(e.filters.primary.entries(), function([n, i]) {
1841
+ return t("v-tab-item", { key: n }, [t("v-row", e._l(i.filters, function(o) {
1842
+ var l, d, c, f, m, $, F, C, w;
1843
+ return t("v-col", { key: o.column, staticClass: "flex-grow-1", attrs: { cols: ((l = o.componentProps) == null ? void 0 : l.cols) || "auto", md: ((d = o.componentProps) == null ? void 0 : d.md) || void 0, sm: ((c = o.componentProps) == null ? void 0 : c.sm) || void 0, lg: ((f = o.componentProps) == null ? void 0 : f.lg) || void 0, xl: ((m = o.componentProps) == null ? void 0 : m.xl) || void 0 } }, [o.component === "v-autocomplete" ? t("v-autocomplete", e._b({ attrs: { items: o.items, disabled: e.isFieldDependentFieldEmpty(o) }, on: { change: function(h) {
1844
+ return e.changeFilterValue(h, o);
1845
+ } }, model: { value: o.value, callback: function(h) {
1846
+ e.$set(o, "value", h);
1847
+ }, expression: "primaryFilter.value" } }, "v-autocomplete", {
1848
+ "item-value": (($ = o.componentProps) == null ? void 0 : $.itemValue) ?? "id",
1849
+ "item-text": ((F = o.componentProps) == null ? void 0 : F.itemText) ?? "text",
1850
+ ...o.componentProps
1851
+ }, !1)) : o.component === "v-checkbox" ? t("v-checkbox", e._b({ staticStyle: { display: "inline-block", "white-space": "nowrap", overflow: "hidden !important", "text-overflow": "ellipsis" }, attrs: { "hide-details": "", disabled: e.isFieldDependentFieldEmpty(o) }, on: { change: function(h) {
1852
+ return e.changeFilterValue(h, o);
1853
+ } }, model: { value: o.value, callback: function(h) {
1854
+ e.$set(o, "value", h);
1855
+ }, expression: "primaryFilter.value" } }, "v-checkbox", o.componentProps, !1)) : o.component === "date-picker" ? t("DatePicker", e._b({ attrs: { "initial-value": o.value, label: (C = o.componentProps) == null ? void 0 : C.label }, on: { setDatepickerValue: function(h) {
1856
+ return e.changeFilterValue(h, o);
1857
+ } } }, "DatePicker", o.componentProps, !1)) : o.component === "v-text-field" ? t("v-text-field", e._b({ directives: [{ name: "maska", rawName: "v-maska", value: (w = o.componentProps) == null ? void 0 : w.mask, expression: "primaryFilter.componentProps?.mask" }], attrs: { disabled: e.isFieldDependentFieldEmpty(o) }, on: { change: function(h) {
1858
+ return e.changeFilterValue(h, o);
1859
+ } }, model: { value: o.value, callback: function(h) {
1860
+ e.$set(o, "value", h);
1861
+ }, expression: "primaryFilter.value" } }, "v-text-field", {
1862
+ type: "text",
1863
+ ...o.componentProps
1864
+ }, !1)) : e._e()], 1);
1865
+ }), 1)], 1);
1866
+ }), 1)], 1) : e._e()];
1867
+ }, proxy: !0 }]) }, [e.allRequiredFilterAreFilled ? e.loading ? t("LoadingIndicator", { staticClass: "mt-4" }) : !e.loading && !e.apiData.length && e.hasFetch ? t("section", { staticClass: "d-flex justify-center align-center text-h6 primary--text" }, [e._v(" Não há dados disponíveis ")]) : !e.loading && !e.apiData.length && !e.hasFetch ? t("section") : t("section", { staticClass: "mt-4 flex-grow-1 d-flex flex-column" }, [t("v-data-table", e._b({ staticClass: "text-no-wrap d-flex flex-column", attrs: { "show-select": !e.readOnly, headers: e.tableHeaders, items: e.apiData, loading: e.loading, "fixed-header": "", "item-key": e.primaryKey, options: e.paginationOptions, "footer-props": {
1868
+ itemsPerPageOptions: e.paginationSettings.itemsPerPageOptions
1869
+ } }, on: { "update:options": function(n) {
1870
+ e.paginationOptions = n;
1871
+ } }, scopedSlots: e._u([{ key: "item", fn: function({ item: n, select: i, isSelected: o }) {
1872
+ return [t("tr", { staticClass: "table-row", class: {
1873
+ "selected-row": o,
1874
+ "edited-row": e.itemHasBeenEdited(n)
1875
+ } }, [t("td", [t("v-simple-checkbox", { attrs: { color: "secondary", value: o, ripple: !1 }, on: { input: function(l) {
1876
+ return i(l);
1877
+ } } })], 1), e._l(e.tableHeaders, function(l, d) {
1878
+ return [t("td", { key: d, class: {
1879
+ "actions-column text-end": l.value === "actions"
1880
+ } }, [l.value === "actions" ? [t("v-tooltip", { attrs: { top: "" }, scopedSlots: e._u([{ key: "activator", fn: function({ on: c }) {
1881
+ return [t("v-btn", e._g({ attrs: { icon: "" }, on: { click: function(f) {
1882
+ return e.showBaseCrudForm(n);
1883
+ } } }, c), [t("v-icon", [e._v(" mdi-pencil ")])], 1)];
1884
+ } }], null, !0) }, [t("span", [e._v("Editar item")])]), t("v-tooltip", { attrs: { top: "" }, scopedSlots: e._u([{ key: "activator", fn: function({ on: c }) {
1885
+ return [t("v-btn", e._g({ attrs: { icon: "" }, on: { click: function(f) {
1886
+ return e.showConfirmDeleteDialog(n);
1887
+ } } }, c), [t("v-icon", [e._v(" mdi-delete ")])], 1)];
1888
+ } }], null, !0) }, [t("span", [e._v("Deletar item")])])] : l.type === "INT" && l.columnType === "check" ? t("div", { staticClass: "d-flex justify-center align-center", staticStyle: { width: "100%" } }, [t("v-simple-checkbox", { attrs: { color: "primary", value: e.formatCheckboxValue(n[l.value]), ripple: !1, disabled: l.editable }, on: { input: function(c) {
1889
+ return e.setCheckboxValue(c, n, l.value);
1890
+ } } })], 1) : l.img ? t("div", { staticClass: "d-flex justify-center" }, [n[l.value] ? t("v-avatar", { staticClass: "my-1", attrs: { size: "54" } }, [t("v-img", { attrs: { src: n[l.value] }, scopedSlots: e._u([{ key: "placeholder", fn: function() {
1891
+ return [t("v-skeleton-loader", { attrs: { type: "avatar" } })];
1892
+ }, proxy: !0 }], null, !0) })], 1) : t("v-avatar", { staticClass: "my-1", attrs: { size: "54" } }, [t("v-sheet", [t("v-icon", { attrs: { color: "primary", size: "62" } }, [e._v(" mdi-account-circle ")])], 1)], 1)], 1) : l.options ? t("v-edit-dialog", { attrs: { "return-value": n[l.value], large: "", "cancel-text": "Cancelar", "save-text": "Alterar", persistent: "" }, on: { "update:returnValue": function(c) {
1893
+ return e.$set(n, l.value, c);
1894
+ }, "update:return-value": function(c) {
1895
+ return e.$set(n, l.value, c);
1896
+ }, cancel: function(c) {
1897
+ return e.cancelItemEditDialog(l, n);
1898
+ }, open: function(c) {
1899
+ return e.setBackupEditedItem(n);
1900
+ }, save: function(c) {
1901
+ return e.saveItemEditDialog(n);
1902
+ } }, scopedSlots: e._u([{ key: "input", fn: function() {
1903
+ return [l.columnType !== "radio" ? t("v-autocomplete", { attrs: { label: l.text, items: e.getOptions(l, n), "item-label": "text", "return-object": "", clearable: !e.isRequired(l) }, on: { change: function(c) {
1904
+ return e.setSelectedOption(
1905
+ n,
1906
+ l.columnId,
1907
+ l.value,
1908
+ c
1909
+ );
1910
+ } }, model: { value: n[l.value], callback: function(c) {
1911
+ e.$set(n, l.value, c);
1912
+ }, expression: "item[header.value]" } }) : t("v-select", { attrs: { label: l.text, items: l.options, "item-value": "text", clearable: !e.isRequired(l) }, model: { value: n[l.value], callback: function(c) {
1913
+ e.$set(n, l.value, c);
1914
+ }, expression: "item[header.value]" } })];
1915
+ }, proxy: !0 }], null, !0) }, [e._v(" " + e._s(e.getFormatedItemValue(l, n[l.value])) + " ")]) : !l.options && l.editable ? t("v-edit-dialog", { attrs: { "return-value": n[l.value], large: "", "cancel-text": "Cancelar", "save-text": "Alterar", persistent: "" }, on: { "update:returnValue": function(c) {
1916
+ return e.$set(n, l.value, c);
1917
+ }, "update:return-value": function(c) {
1918
+ return e.$set(n, l.value, c);
1919
+ }, cancel: function(c) {
1920
+ return e.cancelItemEditDialog(l, n);
1921
+ }, open: function(c) {
1922
+ return e.setBackupEditedItem(n);
1923
+ }, save: function(c) {
1924
+ return e.saveItemEditDialog(n);
1925
+ } }, scopedSlots: e._u([{ key: "input", fn: function() {
1926
+ return [l.type === "VARCHAR" || l.type === "TEXT" ? t("v-text-field", { attrs: { label: l.text, type: "text", "single-line": "", counter: l.length, maxlength: l.length }, model: { value: n[l.value], callback: function(c) {
1927
+ e.$set(n, l.value, c);
1928
+ }, expression: "item[header.value]" } }) : e._e(), l.type === "INT" && l.columnType !== "check" ? t("v-text-field", { attrs: { label: l.text, type: "number", "single-line": "", counter: l.length, maxlength: l.length }, model: { value: n[l.value], callback: function(c) {
1929
+ e.$set(n, l.value, e._n(c));
1930
+ }, expression: "item[header.value]" } }) : e._e(), l.type === "DECIMAL" ? t("v-text-field", { attrs: { label: l.text, type: "number", "single-line": "", counter: l.length, maxlength: l.length }, on: { change: function(c) {
1931
+ return e.formatFloat(n[l.value]);
1932
+ } }, model: { value: n[l.value], callback: function(c) {
1933
+ e.$set(n, l.value, e._n(c));
1934
+ }, expression: "item[header.value]" } }) : e._e(), l.type === "DATETIME" || l.type === "DATE" ? t("DatePicker", { attrs: { "initial-value": n[l.value], label: l.text }, on: { setDatepickerValue: function(c) {
1935
+ n[l.value] = c;
1936
+ } } }) : e._e()];
1937
+ }, proxy: !0 }], null, !0) }, [t("span", { staticClass: "d-flex", class: l.align === "center" ? " justify-center" : "justify-start" }, [e._v(" " + e._s(e.getFormatedItemValue(l, n[l.value])) + " ")])]) : t("div", { staticClass: "d-flex", class: l.align === "center" ? " justify-center" : "justify-start" }, [e._v(" " + e._s(e.getFormatedItemValue(l, n[l.value])) + " ")])], 2)];
1938
+ })], 2)];
1939
+ } }, { key: "footer.prepend", fn: function() {
1940
+ return [e._t("footer-prepend")];
1941
+ }, proxy: !0 }], null, !0), model: { value: e.selectedRows, callback: function(n) {
1942
+ e.selectedRows = n;
1943
+ }, expression: "selectedRows" } }, "v-data-table", {
1944
+ serverItemsLength: e.useServerSidePagination ? e.paginationSettings.serverItemsLength : void 0,
1945
+ search: e.useServerSideSearch || (a = e.filters) == null ? void 0 : a.search
1946
+ }, !1))], 1) : t("RequiredFilterMessage", { attrs: { message: e.requiredFilterMessage } }), t("UnsavedChangesDialog", { ref: "unsavedChangesDialogRef", on: { hidden: e.closeUnsavedChangesDialog } }), t("ConfirmDeleteDialog", { ref: "confirmDeleteDialogRef", on: { submit: e.deleteSelectedRows, hidden: e.closeConfirmDeleteDialog } }), t("BaseCrudForm", { ref: "baseCrudFormRef", attrs: { headers: e.headers, "primary-key": e.primaryKey, formSettings: e.formSettings }, on: { hidden: e.closeBaseCrudForm, submit: e.handleSubmit } }), t("BaseCrudSecondaryFiltersDrawer", { ref: "baseCrudSecondaryFiltersDrawerRef", attrs: { filters: (r = e.filters) == null ? void 0 : r.secondary }, on: { hidden: e.closeSecondaryFilters, refresh: e.handleReload, "clear:filters": e.clearSecondaryFilters } })], 1);
1947
+ }, es = [], ts = /* @__PURE__ */ u(
1948
+ Xt,
1949
+ Gt,
1950
+ es,
1951
+ !1,
1952
+ null,
1953
+ "1cea94ef"
1954
+ );
1955
+ const ss = ts.exports, as = {
1956
+ components: {
1957
+ HotTable: Q
1958
+ },
1959
+ computed: {
1960
+ licenseKey() {
1961
+ return this.$configs.licenseKey ? this.$configs.licenseKey : "";
1962
+ },
1963
+ hotInstance() {
1964
+ return this.$refs.hotTable.hotInstance;
1965
+ },
1966
+ hotTableRef() {
1967
+ return this.$refs.hotTable;
1968
+ }
1969
+ }
1970
+ };
1971
+ var ns = function() {
1972
+ var e = this, t = e._self._c;
1973
+ return t("HotTable", e._g(e._b({ ref: "hotTable", attrs: { licenseKey: e.licenseKey, language: "pt-BR" } }, "HotTable", e.$attrs, !1), e.$listeners), [e._t("default")], 2);
1974
+ }, rs = [], is = /* @__PURE__ */ u(
1975
+ as,
1976
+ ns,
1977
+ rs,
1978
+ !1,
1979
+ null,
1980
+ "889c5e48"
1981
+ );
1982
+ const os = is.exports, ls = {
1983
+ props: {
1984
+ isYear2: {
1985
+ type: Boolean,
1986
+ default: !1
1987
+ },
1988
+ value: {
1989
+ type: Array,
1990
+ required: !0
1991
+ },
1992
+ disabled: {
1993
+ type: Boolean,
1994
+ default: !1
1995
+ }
1996
+ },
1997
+ data() {
1998
+ const s = [
1999
+ { text: "Janeiro", value: 1 },
2000
+ { text: "Fevereiro", value: 2 },
2001
+ { text: "Março", value: 3 },
2002
+ { text: "Abril", value: 4 },
2003
+ { text: "Maio", value: 5 },
2004
+ { text: "Junho", value: 6 },
2005
+ { text: "Julho", value: 7 },
2006
+ { text: "Agosto", value: 8 },
2007
+ { text: "Setembro", value: 9 },
2008
+ { text: "Outubro", value: 10 },
2009
+ { text: "Novembro", value: 11 },
2010
+ { text: "Dezembro", value: 12 }
2011
+ ];
2012
+ return {
2013
+ months: s,
2014
+ selectedMonths: this.value.length ? this.value : [...s],
2015
+ showMonths: !this.isYear2
2016
+ };
2017
+ },
2018
+ watch: {
2019
+ value(s) {
2020
+ this.selectedMonths = s.length ? s : [...this.months];
2021
+ }
2022
+ },
2023
+ methods: {
2024
+ selectAll() {
2025
+ this.selectedMonths = [...this.months], this.$emit("input", this.selectedMonths);
2026
+ },
2027
+ onCheckboxChange() {
2028
+ this.showMonths ? this.selectedMonths = [...this.months] : this.selectedMonths = [], this.$emit("input", this.selectedMonths);
2029
+ },
2030
+ updateSelection() {
2031
+ this.$emit("input", this.selectedMonths);
2032
+ }
2033
+ }
2034
+ };
2035
+ var cs = function() {
2036
+ var e = this, t = e._self._c;
2037
+ return t("div", { staticClass: "month-selector d-flex align-center" }, [t("v-checkbox", { staticClass: "pa-0 ma-0", attrs: { label: "Mês", disabled: e.disabled, dense: "", "hide-details": "" }, on: { change: e.onCheckboxChange }, model: { value: e.showMonths, callback: function(a) {
2038
+ e.showMonths = a;
2039
+ }, expression: "showMonths" } }), t("v-menu", { attrs: { bottom: "", left: "", "close-on-content-click": !1 }, scopedSlots: e._u([{ key: "activator", fn: function({ on: a }) {
2040
+ return [t("v-btn", e._g({ staticClass: "ma-0 pa-0", attrs: { icon: "", "x-small": "", disabled: e.disabled } }, a), [t("v-icon", [e._v("mdi-dots-vertical")])], 1)];
2041
+ } }]) }, [t("v-sheet", { staticClass: "px-4 py-2", attrs: { "max-width": "260px" } }, [t("v-select", { attrs: { items: e.months, label: "Escolha os meses", multiple: "", "return-object": "" }, on: { change: e.updateSelection }, scopedSlots: e._u([{ key: "selection", fn: function({ item: a, index: r }) {
2042
+ return [r === 0 ? t("span", [e._v(e._s(a.text))]) : e._e(), r === 1 ? t("span", [e._v(", " + e._s(a.text))]) : e._e(), r === 2 ? [t("span", [e._v("...")]), t("span", { staticClass: "grey--text text-caption pa-1" }, [e._v(" +" + e._s(e.selectedMonths.length - 2) + " ")])] : e._e()];
2043
+ } }]), model: { value: e.selectedMonths, callback: function(a) {
2044
+ e.selectedMonths = a;
2045
+ }, expression: "selectedMonths" } }), t("div", { staticClass: "d-flex justify-end" }, [t("v-btn", { staticClass: "ma-0 mb-2", attrs: { small: "", color: "primary", disabled: e.selectedMonths.length === 12 }, on: { click: e.selectAll } }, [e._v(" Selecionar todos ")])], 1)], 1)], 1)], 1);
2046
+ }, us = [], ds = /* @__PURE__ */ u(
2047
+ ls,
2048
+ cs,
2049
+ us,
2050
+ !1,
2051
+ null,
2052
+ null
2053
+ );
2054
+ const ps = ds.exports, fs = {
2055
+ props: {
2056
+ value: {
2057
+ type: Array,
2058
+ required: !0
2059
+ },
2060
+ disabled: {
2061
+ type: Boolean,
2062
+ default: !1
2063
+ }
2064
+ },
2065
+ data() {
2066
+ const s = [
2067
+ { text: "1º Trimestre", value: 1 },
2068
+ { text: "2º Trimestre", value: 2 },
2069
+ { text: "3º Trimestre", value: 3 },
2070
+ { text: "4º Trimestre", value: 4 }
2071
+ ];
2072
+ return {
2073
+ quarters: s,
2074
+ selectedQuarters: this.value.length ? this.value : [...s],
2075
+ showQuarters: !1
2076
+ };
2077
+ },
2078
+ watch: {
2079
+ value(s) {
2080
+ this.selectedQuarters = s;
2081
+ }
2082
+ },
2083
+ methods: {
2084
+ selectAll() {
2085
+ this.selectedQuarters = [...this.quarters], this.$emit("input", this.selectedQuarters);
2086
+ },
2087
+ onCheckboxChange() {
2088
+ this.showQuarters ? this.selectedQuarters = [...this.quarters] : this.selectedQuarters = [], this.$emit("input", this.selectedQuarters, this.showQuarters);
2089
+ },
2090
+ updateSelection() {
2091
+ this.$emit("input", this.selectedQuarters, this.showQuarters);
2092
+ }
2093
+ }
2094
+ };
2095
+ var ms = function() {
2096
+ var e = this, t = e._self._c;
2097
+ return t("div", { staticClass: "quarter-selector d-flex align-center" }, [t("v-checkbox", { staticClass: "pa-0 ma-0", attrs: { label: "Tri", disabled: e.disabled, dense: "", "hide-details": "" }, on: { change: e.onCheckboxChange }, model: { value: e.showQuarters, callback: function(a) {
2098
+ e.showQuarters = a;
2099
+ }, expression: "showQuarters" } }), t("v-menu", { attrs: { bottom: "", left: "", "close-on-content-click": !1 }, scopedSlots: e._u([{ key: "activator", fn: function({ on: a }) {
2100
+ return [t("v-btn", e._g({ staticClass: "ma-0 pa-0", attrs: { icon: "", "x-small": "", disabled: e.disabled } }, a), [t("v-icon", [e._v("mdi-dots-vertical")])], 1)];
2101
+ } }]) }, [t("v-sheet", { staticClass: "px-4 py-2", attrs: { "max-width": "260px" } }, [t("v-select", { attrs: { items: e.quarters, label: "Escolha os trimestres", multiple: "", "return-object": "" }, on: { change: e.updateSelection }, scopedSlots: e._u([{ key: "selection", fn: function({ item: a, index: r }) {
2102
+ return [r === 0 ? t("span", [e._v(e._s(a.text))]) : e._e(), r === 1 ? t("span", [e._v(", " + e._s(a.text))]) : e._e(), r === 2 ? [t("span", [e._v("...")]), t("span", { staticClass: "grey--text text-caption pa-1" }, [e._v(" +" + e._s(e.selectedQuarters.length - 2) + " ")])] : e._e()];
2103
+ } }]), model: { value: e.selectedQuarters, callback: function(a) {
2104
+ e.selectedQuarters = a;
2105
+ }, expression: "selectedQuarters" } }), t("div", { staticClass: "d-flex justify-end" }, [t("v-btn", { staticClass: "ma-0 mb-2", attrs: { small: "", color: "primary", disabled: e.selectedQuarters.length === 12 }, on: { click: e.selectAll } }, [e._v(" Selecionar todos ")])], 1)], 1)], 1)], 1);
2106
+ }, hs = [], vs = /* @__PURE__ */ u(
2107
+ fs,
2108
+ ms,
2109
+ hs,
2110
+ !1,
2111
+ null,
2112
+ null
2113
+ );
2114
+ const _s = vs.exports, ys = {
2115
+ props: {
2116
+ value: {
2117
+ type: Array,
2118
+ required: !0
2119
+ },
2120
+ disabled: {
2121
+ type: Boolean,
2122
+ default: !1
2123
+ }
2124
+ },
2125
+ data() {
2126
+ const s = [
2127
+ { text: "1º Semestre", value: 1 },
2128
+ { text: "2º Semestre", value: 2 }
2129
+ ];
2130
+ return {
2131
+ semesters: s,
2132
+ selectedSemesters: this.value.length ? this.value : [...s],
2133
+ showSemesters: !1
2134
+ };
2135
+ },
2136
+ watch: {
2137
+ value(s) {
2138
+ this.selectedSemesters = s;
2139
+ }
2140
+ },
2141
+ methods: {
2142
+ selectAll() {
2143
+ this.selectedSemesters = [...this.semesters], this.$emit("input", this.selectedSemesters);
2144
+ },
2145
+ onCheckboxChange() {
2146
+ this.showSemesters ? this.selectedSemesters = [...this.semesters] : this.selectedSemesters = [], this.$emit("input", this.selectedSemesters);
2147
+ },
2148
+ updateSelection() {
2149
+ this.$emit("input", this.selectedSemesters);
2150
+ }
2151
+ }
2152
+ };
2153
+ var gs = function() {
2154
+ var e = this, t = e._self._c;
2155
+ return t("div", { staticClass: "semester-selector d-flex align-center" }, [t("v-checkbox", { staticClass: "pa-0 ma-0", attrs: { label: "Sem", disabled: e.disabled, dense: "", "hide-details": "" }, on: { change: e.onCheckboxChange }, model: { value: e.showSemesters, callback: function(a) {
2156
+ e.showSemesters = a;
2157
+ }, expression: "showSemesters" } }), t("v-menu", { attrs: { bottom: "", left: "", "close-on-content-click": !1 }, scopedSlots: e._u([{ key: "activator", fn: function({ on: a }) {
2158
+ return [t("v-btn", e._g({ staticClass: "ma-0 pa-0", attrs: { icon: "", "x-small": "", disabled: e.disabled } }, a), [t("v-icon", [e._v("mdi-dots-vertical")])], 1)];
2159
+ } }]) }, [t("v-sheet", { staticClass: "px-4 py-2", attrs: { "max-width": "260px" } }, [t("v-select", { attrs: { items: e.semesters, label: "Escolha os semestres", multiple: "", "return-object": "" }, on: { change: e.updateSelection }, scopedSlots: e._u([{ key: "selection", fn: function({ item: a, index: r }) {
2160
+ return [r === 0 ? t("span", [e._v(e._s(a.text))]) : e._e(), r === 1 ? t("span", [e._v(", " + e._s(a.text))]) : e._e()];
2161
+ } }]), model: { value: e.selectedSemesters, callback: function(a) {
2162
+ e.selectedSemesters = a;
2163
+ }, expression: "selectedSemesters" } }), t("div", { staticClass: "d-flex justify-end" }, [t("v-btn", { staticClass: "ma-0 mb-2", attrs: { small: "", color: "primary", disabled: e.selectedSemesters.length === 2 }, on: { click: e.selectAll } }, [e._v(" Selecionar todos ")])], 1)], 1)], 1)], 1);
2164
+ }, bs = [], xs = /* @__PURE__ */ u(
2165
+ ys,
2166
+ gs,
2167
+ bs,
2168
+ !1,
2169
+ null,
2170
+ null
2171
+ );
2172
+ const Ss = xs.exports, $s = {
2173
+ props: {
2174
+ value: {
2175
+ type: Boolean,
2176
+ default: !0
2177
+ },
2178
+ disabled: {
2179
+ type: Boolean,
2180
+ default: !1
2181
+ }
2182
+ },
2183
+ data() {
2184
+ return {
2185
+ yearSelected: this.value
2186
+ };
2187
+ },
2188
+ watch: {
2189
+ value(s) {
2190
+ this.yearSelected = s;
2191
+ }
2192
+ },
2193
+ methods: {
2194
+ updateSelection() {
2195
+ this.$emit("input", this.yearSelected);
2196
+ }
2197
+ }
2198
+ };
2199
+ var Fs = function() {
2200
+ var e = this, t = e._self._c;
2201
+ return t("div", { staticClass: "year-selector d-flex align-center" }, [t("v-checkbox", { staticClass: "pa-0 ma-0", attrs: { label: "Ano", disabled: e.disabled, "input-value": e.yearSelected, dense: "", "hide-details": "" }, on: { change: e.updateSelection }, model: { value: e.yearSelected, callback: function(a) {
2202
+ e.yearSelected = a;
2203
+ }, expression: "yearSelected" } })], 1);
2204
+ }, Cs = [], ws = /* @__PURE__ */ u(
2205
+ $s,
2206
+ Fs,
2207
+ Cs,
2208
+ !1,
2209
+ null,
2210
+ null
2211
+ );
2212
+ const ks = ws.exports, Ds = {
2213
+ components: {
2214
+ MonthSelector: ps,
2215
+ QuarterSelector: _s,
2216
+ SemesterSelector: Ss,
2217
+ YearSelector: ks
2218
+ },
2219
+ props: {
2220
+ year: {
2221
+ type: Number,
2222
+ required: !0
2223
+ },
2224
+ isYear2: {
2225
+ type: Boolean,
2226
+ default: !1
2227
+ },
2228
+ disableActionButtons: {
2229
+ type: Boolean,
2230
+ default: !1
2231
+ }
2232
+ },
2233
+ data() {
2234
+ const s = [
2235
+ { text: "Janeiro", value: 1 },
2236
+ { text: "Fevereiro", value: 2 },
2237
+ { text: "Março", value: 3 },
2238
+ { text: "Abril", value: 4 },
2239
+ { text: "Maio", value: 5 },
2240
+ { text: "Junho", value: 6 },
2241
+ { text: "Julho", value: 7 },
2242
+ { text: "Agosto", value: 8 },
2243
+ { text: "Setembro", value: 9 },
2244
+ { text: "Outubro", value: 10 },
2245
+ { text: "Novembro", value: 11 },
2246
+ { text: "Dezembro", value: 12 }
2247
+ ];
2248
+ return {
2249
+ selectedMonths: this.isYear2 ? [] : s,
2250
+ selectedQuarters: [],
2251
+ selectedSemesters: [],
2252
+ yearSelected: !this.isYear2
2253
+ };
2254
+ },
2255
+ computed: {
2256
+ yearLabel() {
2257
+ return this.year.toString();
2258
+ }
2259
+ },
2260
+ methods: {
2261
+ updateMonths(s) {
2262
+ this.selectedMonths = s, this.updateSelection();
2263
+ },
2264
+ updateQuarters(s) {
2265
+ this.selectedQuarters = s, this.updateSelection();
2266
+ },
2267
+ updateSemesters(s) {
2268
+ this.selectedSemesters = s, this.updateSelection();
2269
+ },
2270
+ updateYear(s) {
2271
+ this.yearSelected = s, this.updateSelection();
2272
+ },
2273
+ updateSelection() {
2274
+ this.$emit("update:selection", {
2275
+ months: this.selectedMonths,
2276
+ quarters: this.selectedQuarters,
2277
+ semesters: this.selectedSemesters,
2278
+ yearSelected: this.yearSelected
2279
+ });
2280
+ }
2281
+ }
2282
+ };
2283
+ var qs = function() {
2284
+ var e = this, t = e._self._c;
2285
+ return t("div", { staticClass: "period-selector" }, [t("span", { staticClass: "text-h6 mr-4" }, [e._v(e._s(e.yearLabel))]), t("div", { staticClass: "d-flex mt-1" }, [t("MonthSelector", { attrs: { isYear2: e.isYear2, value: e.selectedMonths, disabled: e.disableActionButtons }, on: { input: e.updateMonths } }), t("QuarterSelector", { attrs: { value: e.selectedQuarters, disabled: e.disableActionButtons }, on: { input: e.updateQuarters } }), t("SemesterSelector", { attrs: { value: e.selectedSemesters, disabled: e.disableActionButtons }, on: { input: e.updateSemesters } }), t("YearSelector", { attrs: { value: e.yearSelected, disabled: e.disableActionButtons }, on: { input: e.updateYear } })], 1)]);
2286
+ }, Bs = [], Rs = /* @__PURE__ */ u(
2287
+ Ds,
2288
+ qs,
2289
+ Bs,
2290
+ !1,
2291
+ null,
2292
+ "617fd88c"
2293
+ );
2294
+ const Is = Rs.exports, Ms = {
2295
+ components: {
2296
+ PeriodSelector: Is
2297
+ },
2298
+ props: {
2299
+ year1: {
2300
+ type: Number,
2301
+ required: !0
2302
+ },
2303
+ year2: {
2304
+ type: Number,
2305
+ default: null
2306
+ },
2307
+ disableActionButtons: {
2308
+ type: Boolean,
2309
+ default: !1
2310
+ }
2311
+ },
2312
+ data() {
2313
+ return {
2314
+ year1Selection: {},
2315
+ year2Selection: {}
2316
+ };
2317
+ },
2318
+ methods: {
2319
+ updateYear1Selection(s) {
2320
+ this.year1Selection = s, this.$emit("update:year1", s);
2321
+ },
2322
+ updateYear2Selection(s) {
2323
+ this.year2Selection = s, this.$emit("update:year2", s);
2324
+ }
2325
+ }
2326
+ };
2327
+ var Es = function() {
2328
+ var e = this, t = e._self._c;
2329
+ return t("div", { staticClass: "view" }, [t("v-row", { attrs: { align: "center", "no-gutters": "" } }, [t("div", { staticClass: "d-flex justify-start" }, [t("PeriodSelector", { attrs: { isYear2: !1, year: e.year1, "disable-action-buttons": e.disableActionButtons }, on: { "update:selection": e.updateYear1Selection } }), e.year2 ? t("v-divider", { staticClass: "mx-4", attrs: { vertical: "" } }) : e._e(), e.year2 ? t("PeriodSelector", { attrs: { isYear2: "", year: e.year2, "disable-action-buttons": e.disableActionButtons }, on: { "update:selection": e.updateYear2Selection } }) : e._e()], 1)])], 1);
2330
+ }, Os = [], Ts = /* @__PURE__ */ u(
2331
+ Ms,
2332
+ Es,
2333
+ Os,
2334
+ !1,
2335
+ null,
2336
+ null
2337
+ );
2338
+ const Ps = Ts.exports, As = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2339
+ __proto__: null,
2340
+ ZnapBaseCrudForm: z,
2341
+ ZnapBaseCrudView: ss,
2342
+ ZnapBaseFormLayout: K,
2343
+ ZnapBaseViewLayout: A,
2344
+ ZnapClearFilterButton: k,
2345
+ ZnapCloseTableButton: b,
2346
+ ZnapConfirmDeleteDialog: W,
2347
+ ZnapConsolidateButton: Ie,
2348
+ ZnapDatePicker: g,
2349
+ ZnapDeleteItemButton: M,
2350
+ ZnapDuplicatedItemButton: E,
2351
+ ZnapEditItemButton: O,
2352
+ ZnapExportFileButton: q,
2353
+ ZnapFiltersButton: D,
2354
+ ZnapFormFooter: Y,
2355
+ ZnapFormTitle: N,
2356
+ ZnapHandsOnTable: os,
2357
+ ZnapImportFileButton: B,
2358
+ ZnapLoadingIndicator: y,
2359
+ ZnapNewItemButton: R,
2360
+ ZnapRefreshButton: x,
2361
+ ZnapRequiredFieldsIndicator: j,
2362
+ ZnapRequiredFilterMessage: V,
2363
+ ZnapSaveButton: I,
2364
+ ZnapTextButton: S,
2365
+ ZnapUndoChangesButton: T,
2366
+ ZnapUnsavedChangesDialog: L,
2367
+ ZnapViewHeader: P,
2368
+ ZnapYearPeriodSelector: Ps
2369
+ }, Symbol.toStringTag, { value: "Module" }));
2370
+ class _ {
2371
+ constructor({
2372
+ viewTitle: e,
2373
+ viewIcon: t,
2374
+ primaryKey: a,
2375
+ endpoint: r,
2376
+ baseTransaction: n,
2377
+ readOnly: i = !1,
2378
+ allowExport: o = !0,
2379
+ allowImport: l = !0,
2380
+ useServerSidePagination: d = !1,
2381
+ useServerSideSearch: c = !1
2382
+ }) {
2383
+ p(this, "tableName", "");
2384
+ p(this, "tableIcon", "");
2385
+ p(this, "hasFetch", !1);
2386
+ p(this, "readOnly", !1);
2387
+ p(this, "allowExport", !1);
2388
+ p(this, "allowImport", !1);
2389
+ p(this, "baseTransaction", "");
2390
+ p(this, "useServerSidePagination", !1);
2391
+ p(this, "useServerSideSearch", !1);
2392
+ p(this, "primaryKey", "");
2393
+ p(this, "endpoint");
2394
+ p(this, "paginationSettings", {
2395
+ page: 1,
2396
+ itemsPerPage: 15,
2397
+ serverItemsLength: null,
2398
+ sortBy: [],
2399
+ sortDesc: [],
2400
+ itemsPerPageOptions: [5, 10, 15, 25, 50, 100, -1]
2401
+ });
2402
+ p(this, "headers", []);
2403
+ p(this, "columns", []);
2404
+ p(this, "apiData", []);
2405
+ p(this, "searchColums", []);
2406
+ p(this, "rowsChanged", /* @__PURE__ */ new Set());
2407
+ p(this, "filters", {
2408
+ primary: [
2409
+ {
2410
+ filters: [],
2411
+ title: "Filtros Principais"
2412
+ }
2413
+ ],
2414
+ secondary: [{ filters: [], title: "Filtros Secundários" }],
2415
+ search: ""
2416
+ });
2417
+ p(this, "currentFilters", {
2418
+ primary: [],
2419
+ secondary: [],
2420
+ search: ""
2421
+ });
2422
+ p(this, "loading", !1);
2423
+ p(this, "tableOptions", []);
2424
+ p(this, "formSettings", {
2425
+ baseModel: {},
2426
+ formOptions: [],
2427
+ hooks: {},
2428
+ loading: !1
2429
+ });
2430
+ p(this, "avalibleFilterComponents", /* @__PURE__ */ new Set([
2431
+ "v-autocomplete",
2432
+ "v-checkbox",
2433
+ "date-picker",
2434
+ "v-text-field"
2435
+ ]));
2436
+ p(this, "avalibleFormOptionHooks", /* @__PURE__ */ new Set(["afterChange", "beforeChange"]));
2437
+ p(this, "avalibleFilterOptionHooks", /* @__PURE__ */ new Set(["afterChange"]));
2438
+ p(this, "avalibleFormHooks", /* @__PURE__ */ new Set(["beforeSetItem", "afterSetItem"]));
2439
+ this.tableName = e, this.tableIcon = t, this.primaryKey = a, this.readOnly = i, this.allowExport = o, this.allowImport = l, this.baseTransaction = n, this.endpoint = this.isValidEndpoint(r) ? r : _.generateEndpoint(), this.useServerSidePagination = d, d && (c = !0), this.useServerSideSearch = c;
2440
+ }
2441
+ get viewConfigs() {
2442
+ return {
2443
+ tableName: this.tableName,
2444
+ tableIcon: this.tableIcon,
2445
+ headers: this.headers,
2446
+ columns: this.columns,
2447
+ apiData: this.apiData,
2448
+ useServerSidePagination: this.useServerSidePagination,
2449
+ useServerSideSearch: this.useServerSideSearch,
2450
+ paginationSettings: this.paginationSettings,
2451
+ searchColums: this.searchColums,
2452
+ primaryKey: this.primaryKey,
2453
+ loading: this.loading,
2454
+ rowsChanged: this.rowsChanged,
2455
+ filters: this.filters,
2456
+ currentFilters: this.currentFilters,
2457
+ tableOptions: this.tableOptions,
2458
+ formSettings: this.formSettings,
2459
+ endpoint: this.endpoint,
2460
+ hasFetch: this.hasFetch
2461
+ };
2462
+ }
2463
+ get viewMethods() {
2464
+ return {
2465
+ getFilters: this.getFilters.bind(this),
2466
+ getDisplayFilters: this.getDisplayFilters.bind(this),
2467
+ fetchTableOptionsData: this.fetchTableOptionsData.bind(this),
2468
+ fetchFormOptionsData: this.fetchFormOptionsData.bind(this),
2469
+ fetchFiltersData: this.fetchFiltersData.bind(this),
2470
+ setCurrentFilters: this.setCurrentFilters.bind(this),
2471
+ validateFiltersKeyHaveChange: this.validateFiltersKeyHaveChange.bind(this)
2472
+ };
2473
+ }
2474
+ validateFiltersKeyHaveChange(e, t, a = ["search", "primary", "secondary"]) {
2475
+ const r = this.getCurrentFilters(e);
2476
+ return a.some((n) => Array.isArray(e[n]) ? r[n].some(
2477
+ (i, o) => i !== t[n][o]
2478
+ ) : e[n] !== t[n]);
2479
+ }
2480
+ getSearchFilters(e, t) {
2481
+ return t.map((a) => ({
2482
+ AndOr: "OR",
2483
+ column: a,
2484
+ operator: "CONTAINS",
2485
+ value: e,
2486
+ type: "search"
2487
+ }));
2488
+ }
2489
+ getFilters(e, t) {
2490
+ var r, n;
2491
+ const a = [];
2492
+ if ((r = e == null ? void 0 : e.primary) == null || r.forEach((i) => {
2493
+ i.filters.forEach((o) => {
2494
+ var c, f;
2495
+ if ((o == null ? void 0 : o.type) === "display" || [null, void 0].includes(o.value)) return;
2496
+ if (o.component === "date-picker") {
2497
+ const m = (c = o.componentProps) == null ? void 0 : c.range;
2498
+ return a.push({
2499
+ AndOr: "AND",
2500
+ column: o.column,
2501
+ operator: m ? "BETWEEN" : "=",
2502
+ value: m ? o.value[0] : o.value,
2503
+ value2: m ? o.value[1] : null
2504
+ });
2505
+ }
2506
+ if (o.component === "v-checkbox")
2507
+ return a.push({
2508
+ AndOr: "AND",
2509
+ column: o.column,
2510
+ operator: "=",
2511
+ value: o.value ? 1 : 0
2512
+ });
2513
+ if (!((f = o.componentProps) != null && f.multiple))
2514
+ return a.push({
2515
+ AndOr: "AND",
2516
+ column: o.column,
2517
+ operator: "=",
2518
+ value: o.value
2519
+ });
2520
+ o.value.length && a.push({
2521
+ AndOr: "AND",
2522
+ column: o.column,
2523
+ operator: "IN",
2524
+ value: o.value
2525
+ });
2526
+ });
2527
+ }), (n = e == null ? void 0 : e.secondary) == null || n.forEach((i) => {
2528
+ i.filters.forEach((o) => {
2529
+ var c, f;
2530
+ if ((o == null ? void 0 : o.type) === "display" || [null, void 0].includes(o.value)) return;
2531
+ if (o.component === "date-picker") {
2532
+ const m = (c = o.componentProps) == null ? void 0 : c.range;
2533
+ return a.push({
2534
+ AndOr: "AND",
2535
+ column: o.column,
2536
+ operator: m ? "BETWEEN" : "=",
2537
+ value: m ? o.value[0] : o.value,
2538
+ value2: m ? o.value[2] : null
2539
+ });
2540
+ }
2541
+ if (o.component === "v-checkbox")
2542
+ return a.push({
2543
+ AndOr: "AND",
2544
+ column: o.column,
2545
+ operator: "=",
2546
+ value: o.value ? 1 : 0
2547
+ });
2548
+ if (!((f = o.componentProps) != null && f.multiple))
2549
+ return a.push({
2550
+ AndOr: "AND",
2551
+ column: o.column,
2552
+ operator: "=",
2553
+ value: o.value
2554
+ });
2555
+ o.value.length && a.push({
2556
+ AndOr: "AND",
2557
+ column: o.column,
2558
+ operator: "IN",
2559
+ value: o.value
2560
+ });
2561
+ });
2562
+ }), e != null && e.search && (t != null && t.length)) {
2563
+ const i = this.getSearchFilters(
2564
+ e.search,
2565
+ t
2566
+ );
2567
+ a.push(...i);
2568
+ }
2569
+ return a;
2570
+ }
2571
+ getDisplayFilters(e) {
2572
+ var a, r;
2573
+ const t = [];
2574
+ return (a = e == null ? void 0 : e.primary) == null || a.forEach((n) => {
2575
+ n.filters.forEach((i) => {
2576
+ (i == null ? void 0 : i.type) === "display" && t.push([i.column, i.value]);
2577
+ });
2578
+ }), (r = e == null ? void 0 : e.secondary) == null || r.forEach((n) => {
2579
+ n.filters.forEach((i) => {
2580
+ (i == null ? void 0 : i.type) === "display" && t.push([i.column, i.value]);
2581
+ });
2582
+ }), t;
2583
+ }
2584
+ setCurrentFilters(e) {
2585
+ var t, a;
2586
+ return this.currentFilters.primary = [], this.currentFilters.secondary = [], this.currentFilters.search = "", (t = e == null ? void 0 : e.primary) == null || t.forEach((r) => {
2587
+ r.filters.forEach((n) => {
2588
+ (n == null ? void 0 : n.type) !== "display" && this.currentFilters.primary.push(n.value);
2589
+ });
2590
+ }), (a = e == null ? void 0 : e.secondary) == null || a.forEach((r) => {
2591
+ r.filters.forEach((n) => {
2592
+ (n == null ? void 0 : n.type) !== "display" && this.currentFilters.secondary.push(n.value);
2593
+ });
2594
+ }), this.currentFilters.search = e.search, this.currentFilters;
2595
+ }
2596
+ getCurrentFilters(e) {
2597
+ var a, r;
2598
+ const t = {
2599
+ primary: [],
2600
+ secondary: [],
2601
+ search: ""
2602
+ };
2603
+ return (a = e == null ? void 0 : e.primary) == null || a.forEach((n) => {
2604
+ n.filters.forEach((i) => {
2605
+ (i == null ? void 0 : i.type) !== "display" && t.primary.push(i.value);
2606
+ });
2607
+ }), (r = e == null ? void 0 : e.secondary) == null || r.forEach((n) => {
2608
+ n.filters.forEach((i) => {
2609
+ (i == null ? void 0 : i.type) !== "display" && t.secondary.push(i.value);
2610
+ });
2611
+ }), t.search = e.search, t;
2612
+ }
2613
+ async fetchTableOption(e, t) {
2614
+ var a, r;
2615
+ if (!(!((a = e.endpoint) != null && a.length) || !(e != null && e.endpoint[0])))
2616
+ try {
2617
+ const n = await t.post(
2618
+ e.endpoint[0],
2619
+ e.endpoint[1] ?? {}
2620
+ );
2621
+ e.items = ((r = n == null ? void 0 : n.data) == null ? void 0 : r.rows) ?? [];
2622
+ } catch (n) {
2623
+ console.error(n);
2624
+ }
2625
+ }
2626
+ async fetchTableOptionsData(e, t) {
2627
+ const a = [];
2628
+ e.forEach((r) => {
2629
+ if (r != null && r.ignoreOnFetchFunction) return a.push(null);
2630
+ a.push(this.fetchTableOption(r, t));
2631
+ }), await Promise.all(a);
2632
+ }
2633
+ async fetchFormOption(e, t) {
2634
+ var a, r;
2635
+ if (!(!((a = e.endpoint) != null && a.length) || !(e != null && e.endpoint[0])))
2636
+ try {
2637
+ e.loading = !0;
2638
+ const n = await t.post(
2639
+ e.endpoint[0],
2640
+ e.endpoint[1] ?? {}
2641
+ );
2642
+ e.items = ((r = n == null ? void 0 : n.data) == null ? void 0 : r.rows) ?? [];
2643
+ } catch (n) {
2644
+ console.error(n);
2645
+ } finally {
2646
+ e.loading = !1;
2647
+ }
2648
+ }
2649
+ async fetchFormOptionsData(e, t) {
2650
+ const a = [];
2651
+ e.forEach((r) => {
2652
+ r.ignoreOnFetchFunction || a.push(this.fetchFormOption(r, t));
2653
+ }), await Promise.all(a);
2654
+ }
2655
+ async fetchFilter(e, t) {
2656
+ var a, r;
2657
+ if (!(!((a = e.endpoint) != null && a.length) || !e.endpoint[0]))
2658
+ try {
2659
+ e.componentProps.loading = !0;
2660
+ const n = await t.post(
2661
+ e.endpoint[0],
2662
+ e.endpoint[1] ?? {}
2663
+ );
2664
+ e.items = ((r = n == null ? void 0 : n.data) == null ? void 0 : r.rows) ?? [];
2665
+ } catch (n) {
2666
+ console.error(n);
2667
+ } finally {
2668
+ e.componentProps.loading = !1;
2669
+ }
2670
+ }
2671
+ async fetchFiltersData(e, t) {
2672
+ const a = [];
2673
+ e.primary.forEach((r) => {
2674
+ r.filters.forEach((n) => {
2675
+ n.ignoreOnFetchFunction || a.push(this.fetchFilter(n, t));
2676
+ });
2677
+ }), e.secondary.forEach((r) => {
2678
+ r.filters.forEach((n) => {
2679
+ n.ignoreOnFetchFunction || a.push(this.fetchFilter(n, t));
2680
+ });
2681
+ }), await Promise.all([a]);
2682
+ }
2683
+ static generateEndpoint(e = "", t = { conditions: [] }) {
2684
+ return e ? [e, t] : ["", t];
2685
+ }
2686
+ isValidEndpoint(e) {
2687
+ return !(!Array.isArray(e) || !(e != null && e.length) || typeof e[0] != "string");
2688
+ }
2689
+ isValidColumn(e) {
2690
+ return typeof e == "string";
2691
+ }
2692
+ isValidItemsArray(e) {
2693
+ return !!Array.isArray(e);
2694
+ }
2695
+ createFilterTab(e) {
2696
+ const t = { title: e, filters: [] }, a = {
2697
+ addFilter: (r) => (t.filters.push(this.generateFilter(r)), a),
2698
+ build: () => t
2699
+ };
2700
+ return a;
2701
+ }
2702
+ addNewPrimaryFilterTab(e) {
2703
+ return this.filters.primary.push(e), this;
2704
+ }
2705
+ addPrimaryFilter(e) {
2706
+ return this.filters.primary[0].filters.push(this.generateFilter(e)), this;
2707
+ }
2708
+ addNewSecondaryFilterTab(e) {
2709
+ return this.filters.secondary.push(e), this;
2710
+ }
2711
+ addSecondaryFilter(e) {
2712
+ return this.filters.secondary[0].filters.push(this.generateFilter(e)), this;
2713
+ }
2714
+ generateFilter({
2715
+ column: e = "",
2716
+ component: t,
2717
+ items: a = [],
2718
+ value: r = null,
2719
+ endpoint: n = _.generateEndpoint(),
2720
+ componentProps: i = {},
2721
+ hooks: o = {},
2722
+ dependsOn: l = "",
2723
+ ignoreOnFetchFunction: d = !1,
2724
+ type: c = "filter"
2725
+ }) {
2726
+ if (!this.avalibleFilterComponents.has(t))
2727
+ throw new Error(
2728
+ `O componente: ${t} escolhido para o filtro do tipo: ${c} não é um componente valido!`
2729
+ );
2730
+ const f = Object.keys(o);
2731
+ for (const m of f)
2732
+ if (!this.avalibleFilterOptionHooks.has(m))
2733
+ throw new Error(
2734
+ `O hook ${m}, não esta disponivel para o filtro: ${e} do tipo: ${c} do componente: ${t}!`
2735
+ );
2736
+ return {
2737
+ column: this.isValidColumn(e) ? e : "",
2738
+ component: t,
2739
+ items: this.isValidItemsArray(a) ? a : [],
2740
+ value: r ?? null,
2741
+ endpoint: this.isValidEndpoint(n) ? n : _.generateEndpoint(),
2742
+ componentProps: {
2743
+ loading: !1,
2744
+ returnObject: !1,
2745
+ ...i
2746
+ },
2747
+ dependsOn: l,
2748
+ hooks: o,
2749
+ ignoreOnFetchFunction: d,
2750
+ type: c
2751
+ };
2752
+ }
2753
+ setTableOptions(e = []) {
2754
+ return this.tableOptions = e, this;
2755
+ }
2756
+ addTableOption({
2757
+ column: e = "",
2758
+ items: t = [],
2759
+ endpoint: a,
2760
+ formatter: r,
2761
+ filterFunction: n,
2762
+ ignoreOnFetchFunction: i = !1
2763
+ }) {
2764
+ return this.tableOptions.push({
2765
+ column: this.isValidColumn(e) ? e : "",
2766
+ endpoint: this.isValidEndpoint(a) ? a : _.generateEndpoint(),
2767
+ items: this.isValidItemsArray(t) ? t : [],
2768
+ formatter: r,
2769
+ filterFunction: n,
2770
+ ignoreOnFetchFunction: i
2771
+ }), this;
2772
+ }
2773
+ setFormSettings({
2774
+ baseModel: e = {},
2775
+ formOptions: t = [],
2776
+ hooks: a = {},
2777
+ loading: r = !1
2778
+ }) {
2779
+ return this.formSettings = {
2780
+ baseModel: e,
2781
+ formOptions: t,
2782
+ hooks: a,
2783
+ loading: r
2784
+ }, this;
2785
+ }
2786
+ setFormModel(e) {
2787
+ return this.formSettings.baseModel = e, this;
2788
+ }
2789
+ setFormOptions(e) {
2790
+ return this.formSettings.formOptions = e, this;
2791
+ }
2792
+ addFormOption({
2793
+ column: e = "",
2794
+ items: t = [],
2795
+ dependsOn: a = "",
2796
+ endpoint: r,
2797
+ hooks: n,
2798
+ ignoreOnFetchFunction: i = !1,
2799
+ componentProps: o,
2800
+ component: l,
2801
+ loading: d = !1
2802
+ }) {
2803
+ if (n) {
2804
+ const c = Object.keys(n);
2805
+ for (const f of c)
2806
+ if (!this.avalibleFormOptionHooks.has(f))
2807
+ throw new Error(
2808
+ `O hook ${f}, não esta disponivel para o form option: ${e}!`
2809
+ );
2810
+ }
2811
+ return this.formSettings.formOptions.push({
2812
+ column: this.isValidColumn(e) ? e : "",
2813
+ items: this.isValidItemsArray(t) ? t : [],
2814
+ loading: d,
2815
+ endpoint: this.isValidEndpoint(r) ? r : _.generateEndpoint(),
2816
+ dependsOn: a,
2817
+ hooks: n,
2818
+ ignoreOnFetchFunction: i,
2819
+ componentProps: o,
2820
+ component: l
2821
+ }), this;
2822
+ }
2823
+ setFormHooks(e = {}) {
2824
+ const t = Object.keys(e);
2825
+ for (const a of t)
2826
+ if (!this.avalibleFormHooks.has(a))
2827
+ throw new Error(`O hook ${a}, não esta disponivel como form hook!`);
2828
+ return this.formSettings.hooks = e, this;
2829
+ }
2830
+ setPaginationSettings({
2831
+ page: e = 1,
2832
+ itemsPerPage: t = 15,
2833
+ itemsPerPageOptions: a = [],
2834
+ serverItemsLength: r = 0,
2835
+ sortBy: n = [],
2836
+ sortDesc: i = []
2837
+ }) {
2838
+ return this.paginationSettings.page = e, this.paginationSettings.itemsPerPage = t, this.paginationSettings.serverItemsLength = r, a != null && a.length && (this.paginationSettings.itemsPerPageOptions = a), n.length && (this.paginationSettings.sortBy = n), i.length && (this.paginationSettings.sortDesc = i), this;
2839
+ }
2840
+ }
2841
+ const Ks = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2842
+ __proto__: null,
2843
+ CrudViewConfigs: _
2844
+ }, Symbol.toStringTag, { value: "Module" })), Ls = {
2845
+ install(s, e = {}) {
2846
+ s.prototype.$configs = e, Object.entries(As).forEach(([t, a]) => {
2847
+ s.component(t, a);
2848
+ });
2849
+ }
2850
+ };
2851
+ export {
2852
+ As as components,
2853
+ Ls as plugin,
2854
+ Ks as utils
2855
+ };
2856
+ //# sourceMappingURL=index.es.js.map