v-sistec-features 1.7.0 → 1.8.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.
Files changed (38) hide show
  1. package/dist/Pagination-DtVDFQ07.js +118 -0
  2. package/dist/Pagination.d.ts +27 -0
  3. package/dist/Pagination.js +4 -0
  4. package/dist/{core/plugin.d.ts → core.d.ts} +7 -5
  5. package/dist/{iframeCommunicator/useIframeCommunicator.d.ts → iframeCommunicator.d.ts} +18 -8
  6. package/dist/index.d.ts +26 -3
  7. package/dist/toast.d.ts +19 -0
  8. package/dist/v-sistec-features.css +1 -1
  9. package/dist/vDataPage.d.ts +109 -0
  10. package/dist/vDataPage.js +262 -360
  11. package/dist/vDataTable.d.ts +161 -0
  12. package/dist/vDataTable.js +381 -488
  13. package/package.json +6 -2
  14. package/src/DataPageVue/components/VDataPage.vue +17 -16
  15. package/src/DataPageVue/types/v-data-page.ts +1 -0
  16. package/src/DatatableVue/components/VDataTable.vue +3 -2
  17. package/src/Pagination/index.ts +4 -0
  18. package/dist/DataPageVue/components/PaginationDatatable.vue.d.ts +0 -17
  19. package/dist/DataPageVue/components/VDataPage.vue.d.ts +0 -45
  20. package/dist/DataPageVue/index.d.ts +0 -2
  21. package/dist/DataPageVue/types/v-data-page.d.ts +0 -50
  22. package/dist/DatatableVue/components/PaginationDatatable.vue.d.ts +0 -19
  23. package/dist/DatatableVue/components/SearchDatatable.vue.d.ts +0 -20
  24. package/dist/DatatableVue/components/VColumn.vue.d.ts +0 -53
  25. package/dist/DatatableVue/components/VDataTable.vue.d.ts +0 -36
  26. package/dist/DatatableVue/composables/useImagePreview.d.ts +0 -9
  27. package/dist/DatatableVue/index.d.ts +0 -3
  28. package/dist/DatatableVue/keys.d.ts +0 -31
  29. package/dist/DatatableVue/types/v-data-table.d.ts +0 -46
  30. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  31. package/dist/core/index.d.ts +0 -1
  32. package/dist/iframeCommunicator/index.d.ts +0 -2
  33. package/dist/iframeCommunicator/useThemeFromParent.d.ts +0 -5
  34. package/dist/toast/components/ToastComponent.vue.d.ts +0 -6
  35. package/dist/toast/index.d.ts +0 -1
  36. package/dist/toast/useToastStore.d.ts +0 -15
  37. package/src/DataPageVue/components/PaginationDatatable.vue +0 -222
  38. /package/src/{DatatableVue/components/PaginationDatatable.vue → Pagination/Pagination.vue} +0 -0
package/dist/vDataPage.js CHANGED
@@ -1,43 +1,43 @@
1
- import { defineComponent as G, ref as b, toRefs as de, createElementBlock as f, watch as z, onMounted as ce, onUnmounted as pe, openBlock as g, withDirectives as fe, renderSlot as x, createCommentVNode as T, createElementVNode as c, createVNode as j, vShow as ge, toDisplayString as F, nextTick as H, pushScopeId as _e, popScopeId as ve, computed as S, withModifiers as A, Fragment as C, renderList as $, normalizeClass as U, readonly as me, isRef as he, unref as B, withCtx as W } from "vue";
2
- import { _ as Z } from "./_plugin-vue_export-helper-CHgC5LLL.js";
3
- function ye(i, _ = null) {
4
- if (!i)
1
+ import { defineComponent as Q, ref as _, toRefs as oe, createElementBlock as g, watch as P, onMounted as ue, onUnmounted as se, openBlock as m, withDirectives as de, renderSlot as k, createCommentVNode as U, createElementVNode as v, createVNode as q, vShow as ce, toDisplayString as A, nextTick as B, pushScopeId as fe, popScopeId as pe, computed as W, readonly as _e, isRef as ge, Fragment as D, createTextVNode as me, normalizeClass as M, renderList as $, unref as T, withCtx as j } from "vue";
2
+ import { P as ve, _ as he } from "./Pagination-DtVDFQ07.js";
3
+ function ye(a, d = null) {
4
+ if (!a)
5
5
  return !1;
6
- const t = i.getBoundingClientRect(), l = _ ? _.getBoundingClientRect() : { top: 0, left: 0, bottom: window.innerHeight, right: window.innerWidth };
7
- return t.bottom >= l.top && t.top <= l.bottom && t.right >= l.left && t.left <= l.right;
6
+ const u = a.getBoundingClientRect(), i = d ? d.getBoundingClientRect() : { top: 0, left: 0, bottom: window.innerHeight, right: window.innerWidth };
7
+ return u.bottom >= i.top && u.top <= i.bottom && u.right >= i.left && u.left <= i.right;
8
8
  }
9
- async function ke(i) {
10
- return i ? (await H(), i.value instanceof HTMLElement ? i.value : i.value ? document.querySelector(i.value) : null) : null;
9
+ async function ke(a) {
10
+ return a ? (await B(), a.value instanceof HTMLElement ? a.value : a.value ? document.querySelector(a.value) : null) : null;
11
11
  }
12
- function be(i) {
13
- let _ = `0px 0px ${i.distance}px 0px`;
14
- i.top && (_ = `${i.distance}px 0px 0px 0px`);
15
- const t = new IntersectionObserver(
16
- (l) => {
17
- l[0].isIntersecting && (i.firstload && i.emit(), i.firstload = !0);
12
+ function Ie(a) {
13
+ let d = `0px 0px ${a.distance}px 0px`;
14
+ a.top && (d = `${a.distance}px 0px 0px 0px`);
15
+ const u = new IntersectionObserver(
16
+ (i) => {
17
+ i[0].isIntersecting && (a.firstload && a.emit(), a.firstload = !0);
18
18
  },
19
- { root: i.parentEl, rootMargin: _ }
19
+ { root: a.parentEl, rootMargin: d }
20
20
  );
21
- return i.infiniteLoading.value && t.observe(i.infiniteLoading.value), t;
21
+ return a.infiniteLoading.value && u.observe(a.infiniteLoading.value), u;
22
22
  }
23
- async function K(i, _) {
24
- if (await H(), !i.top)
23
+ async function J(a, d) {
24
+ if (await B(), !a.top)
25
25
  return;
26
- const t = i.parentEl || document.documentElement;
27
- t.scrollTop = t.scrollHeight - _;
26
+ const u = a.parentEl || document.documentElement;
27
+ u.scrollTop = u.scrollHeight - d;
28
28
  }
29
- const ee = (i, _) => {
30
- const t = i.__vccOpts || i;
31
- for (const [l, e] of _)
32
- t[l] = e;
33
- return t;
34
- }, we = {}, Ie = (i) => (_e("data-v-d3e37633"), i = i(), ve(), i), xe = { class: "container" }, Le = /* @__PURE__ */ Ie(() => /* @__PURE__ */ c("div", { class: "spinner" }, null, -1)), Ee = [
35
- Le
29
+ const Y = (a, d) => {
30
+ const u = a.__vccOpts || a;
31
+ for (const [i, e] of d)
32
+ u[i] = e;
33
+ return u;
34
+ }, we = {}, Le = (a) => (fe("data-v-d3e37633"), a = a(), pe(), a), Ee = { class: "container" }, be = /* @__PURE__ */ Le(() => /* @__PURE__ */ v("div", { class: "spinner" }, null, -1)), xe = [
35
+ be
36
36
  ];
37
- function Pe(i, _) {
38
- return g(), f("div", xe, Ee);
37
+ function De(a, d) {
38
+ return m(), g("div", Ee, xe);
39
39
  }
40
- const Me = /* @__PURE__ */ ee(we, [["render", Pe], ["__scopeId", "data-v-d3e37633"]]), De = { class: "state-error" }, Ce = /* @__PURE__ */ G({
40
+ const Te = /* @__PURE__ */ Y(we, [["render", De], ["__scopeId", "data-v-d3e37633"]]), Pe = { class: "state-error" }, Be = /* @__PURE__ */ Q({
41
41
  __name: "InfiniteLoading",
42
42
  props: {
43
43
  top: { type: Boolean, default: !1 },
@@ -48,180 +48,74 @@ const Me = /* @__PURE__ */ ee(we, [["render", Pe], ["__scopeId", "data-v-d3e3763
48
48
  slots: {}
49
49
  },
50
50
  emits: ["infinite"],
51
- setup(i, { emit: _ }) {
52
- const t = i;
53
- let l = null, e = 0;
54
- const y = b(null), m = b(""), { top: P, firstload: p, distance: o } = t, { identifier: M, target: D } = de(t), s = {
55
- infiniteLoading: y,
56
- top: P,
57
- firstload: p,
51
+ setup(a, { emit: d }) {
52
+ const u = a;
53
+ let i = null, e = 0;
54
+ const I = _(null), h = _(""), { top: F, firstload: s, distance: o } = u, { identifier: S, target: z } = oe(u), c = {
55
+ infiniteLoading: I,
56
+ top: F,
57
+ firstload: s,
58
58
  distance: o,
59
59
  parentEl: null,
60
60
  emit() {
61
- e = (s.parentEl || document.documentElement).scrollHeight, h.loading(), _("infinite", h);
61
+ e = (c.parentEl || document.documentElement).scrollHeight, w.loading(), d("infinite", w);
62
62
  }
63
- }, h = {
63
+ }, w = {
64
64
  loading() {
65
- m.value = "loading";
65
+ h.value = "loading";
66
66
  },
67
67
  async loaded() {
68
- m.value = "loaded", await K(s, e), ye(y.value, s.parentEl) && s.emit();
68
+ h.value = "loaded", await J(c, e), ye(I.value, c.parentEl) && c.emit();
69
69
  },
70
70
  async complete() {
71
- m.value = "complete", await K(s, e), l?.disconnect();
71
+ h.value = "complete", await J(c, e), i?.disconnect();
72
72
  },
73
73
  error() {
74
- m.value = "error";
74
+ h.value = "error";
75
75
  }
76
76
  };
77
77
  function n() {
78
- l?.disconnect(), l = be(s);
78
+ i?.disconnect(), i = Ie(c);
79
79
  }
80
- return z(M, n), ce(async () => {
81
- s.parentEl = await ke(D), n();
82
- }), pe(() => l?.disconnect()), (v, E) => (g(), f("div", {
80
+ return P(S, n), ue(async () => {
81
+ c.parentEl = await ke(z), n();
82
+ }), se(() => i?.disconnect()), (L, C) => (m(), g("div", {
83
83
  ref_key: "infiniteLoading",
84
- ref: y,
84
+ ref: I,
85
85
  class: "v3-infinite-loading"
86
86
  }, [
87
- fe(c("div", null, [
88
- x(v.$slots, "spinner", {}, () => [
89
- j(Me)
87
+ de(v("div", null, [
88
+ k(L.$slots, "spinner", {}, () => [
89
+ q(Te)
90
90
  ], !0)
91
91
  ], 512), [
92
- [ge, m.value == "loading"]
92
+ [ce, h.value == "loading"]
93
93
  ]),
94
- m.value == "complete" ? x(v.$slots, "complete", { key: 0 }, () => {
95
- var u;
94
+ h.value == "complete" ? k(L.$slots, "complete", { key: 0 }, () => {
95
+ var f;
96
96
  return [
97
- c("span", null, F(((u = v.slots) == null ? void 0 : u.complete) || "No more results!"), 1)
97
+ v("span", null, A(((f = L.slots) == null ? void 0 : f.complete) || "No more results!"), 1)
98
98
  ];
99
- }, !0) : T("", !0),
100
- m.value == "error" ? x(v.$slots, "error", {
99
+ }, !0) : U("", !0),
100
+ h.value == "error" ? k(L.$slots, "error", {
101
101
  key: 1,
102
- retry: s.emit
102
+ retry: c.emit
103
103
  }, () => {
104
- var u;
104
+ var f;
105
105
  return [
106
- c("span", De, [
107
- c("span", null, F(((u = v.slots) == null ? void 0 : u.error) || "Oops something went wrong!"), 1),
108
- c("button", {
106
+ v("span", Pe, [
107
+ v("span", null, A(((f = L.slots) == null ? void 0 : f.error) || "Oops something went wrong!"), 1),
108
+ v("button", {
109
109
  class: "retry",
110
- onClick: E[0] || (E[0] = //@ts-ignore
111
- (...L) => s.emit && s.emit(...L))
110
+ onClick: C[0] || (C[0] = //@ts-ignore
111
+ (...b) => c.emit && c.emit(...b))
112
112
  }, "retry")
113
113
  ])
114
114
  ];
115
- }, !0) : T("", !0)
115
+ }, !0) : U("", !0)
116
116
  ], 512));
117
117
  }
118
- }), Q = /* @__PURE__ */ ee(Ce, [["__scopeId", "data-v-4bdee133"]]), Te = {
119
- key: 0,
120
- class: "d-flex align-items-center justify-content-between w-100"
121
- }, Be = {
122
- key: 0,
123
- class: "d-flex align-items-center gap-2"
124
- }, ze = { class: "d-flex" }, Fe = ["disabled"], He = ["disabled"], Se = { class: "d-flex gap-2" }, Ae = ["onClick", "disabled"], Ue = {
125
- key: 1,
126
- class: "m-0 p-0"
127
- }, Ne = { class: "d-flex" }, Oe = ["disabled"], Ve = ["disabled"], Y = `
128
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
129
- stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
130
- class="icon icon-tabler icons-tabler-outline icon-tabler-chevrons-left">
131
- <path stroke="none" d="M0 0h24v24H0z" fill="none" />
132
- <path d="M11 7l-5 5l5 5" />
133
- <path d="M17 7l-5 5l5 5" />
134
- </svg>
135
- `, X = `
136
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
137
- stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
138
- class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-left">
139
- <path stroke="none" d="M0 0h24v24H0z" fill="none" />
140
- <path d="M15 6l-6 6l6 6" />
141
- </svg>
142
- `, je = /* @__PURE__ */ G({
143
- __name: "PaginationDatatable",
144
- props: {
145
- pagination: {},
146
- filtering: { type: Boolean, default: !1 }
147
- },
148
- emits: ["tradePage"],
149
- setup(i, { emit: _ }) {
150
- const t = i, l = _, e = S(() => t.pagination.limit_per_page ? Math.ceil(t.pagination.count / t.pagination.limit_per_page) : 0), y = S(() => t.pagination.current_page + 1 < e.value ? t.pagination.current_page + 1 : null), m = () => {
151
- t.pagination.current_page++, l("tradePage");
152
- }, P = (s) => {
153
- t.pagination.current_page = s - 1, l("tradePage");
154
- }, p = () => {
155
- t.pagination.current_page = e.value - 1, l("tradePage");
156
- }, o = () => {
157
- t.pagination.current_page = 0, l("tradePage");
158
- }, M = () => {
159
- t.pagination.current_page > 0 && (t.pagination.current_page--, l("tradePage"));
160
- }, D = S(() => {
161
- if (e.value <= 7)
162
- return Array.from({ length: e.value }, (u, L) => L + 1);
163
- const s = t.pagination.current_page + 1, h = e.value, n = /* @__PURE__ */ new Set([
164
- 1,
165
- 2,
166
- // Sempre mostra as 2 primeiras
167
- s - 1,
168
- s,
169
- s + 1,
170
- // Mostra a atual e vizinhas
171
- h - 1,
172
- h
173
- // Sempre mostra as 2 últimas
174
- ]), v = [];
175
- let E = 0;
176
- return Array.from(n).sort((u, L) => u - L).forEach((u) => {
177
- u < 1 || u > h || (u > E + 1 && v.push("..."), v.push(u), E = u);
178
- }), v;
179
- });
180
- return (s, h) => t.pagination.count > 0 ? (g(), f("div", Te, [
181
- c("span", null, " Mostrando de " + F(t.pagination.count !== 0 ? t.pagination.limit_per_page * t.pagination.current_page + 1 : 0) + " até " + F(t.pagination.limit_per_page * (t.pagination.current_page + 1) < t.pagination.count ? t.pagination.limit_per_page * (t.pagination.current_page + 1) : t.pagination.count) + " de " + F(t.pagination.count) + " registros ", 1),
182
- e.value > 0 ? (g(), f("div", Be, [
183
- c("div", ze, [
184
- c("button", {
185
- class: "btn btn-estilo",
186
- onClick: A(o, ["prevent"]),
187
- disabled: t.pagination.current_page === 0,
188
- innerHTML: Y
189
- }, null, 8, Fe),
190
- c("button", {
191
- class: "btn btn-estilo",
192
- onClick: A(M, ["prevent"]),
193
- disabled: t.pagination.current_page === 0,
194
- innerHTML: X
195
- }, null, 8, He)
196
- ]),
197
- c("div", Se, [
198
- (g(!0), f(C, null, $(D.value, (n, v) => (g(), f(C, { key: v }, [
199
- typeof n == "number" ? (g(), f("button", {
200
- key: 0,
201
- class: U([t.pagination.current_page + 1 == n ? "page-select" : "", "page-estilo"]),
202
- onClick: A((E) => P(n), ["prevent"]),
203
- disabled: t.pagination.current_page + 1 == n
204
- }, F(n), 11, Ae)) : (g(), f("span", Ue, "..."))
205
- ], 64))), 128))
206
- ]),
207
- c("div", Ne, [
208
- c("button", {
209
- onClick: A(m, ["prevent"]),
210
- class: "btn btn-estilo rotate-180",
211
- disabled: !y.value,
212
- innerHTML: X
213
- }, null, 8, Oe),
214
- c("button", {
215
- onClick: A(p, ["prevent"]),
216
- class: "btn btn-estilo rotate-180",
217
- disabled: !y.value,
218
- innerHTML: Y
219
- }, null, 8, Ve)
220
- ])
221
- ])) : T("", !0)
222
- ])) : T("", !0);
223
- }
224
- }), $e = /* @__PURE__ */ Z(je, [["__scopeId", "data-v-df81be49"]]), qe = /* @__PURE__ */ G({
118
+ }), K = /* @__PURE__ */ Y(Be, [["__scopeId", "data-v-4bdee133"]]), Fe = /* @__PURE__ */ Q({
225
119
  __name: "VDataPage",
226
120
  props: {
227
121
  fetch: {},
@@ -257,8 +151,8 @@ const Me = /* @__PURE__ */ ee(we, [["render", Pe], ["__scopeId", "data-v-d3e3763
257
151
  watch: { default: () => [] }
258
152
  },
259
153
  emits: ["tradePage", "beforeFetch", "afterFetch"],
260
- setup(i, { expose: _, emit: t }) {
261
- const l = t, e = i, y = b(!0), m = b(Date.now()), P = b(Date.now()), p = b([]), o = b([]), M = b(0), D = b(!1), s = b(null), h = b(!1), n = b({
154
+ setup(a, { expose: d, emit: u }) {
155
+ const i = u, e = a, I = _(!0), h = _(Date.now()), F = _(Date.now()), s = _([]), o = _([]), S = _(0), z = _(!1), c = _(null), w = _(!1), n = _({
262
156
  current_page: e.page_starts_at,
263
157
  // pagina atual
264
158
  count: 0,
@@ -269,258 +163,266 @@ const Me = /* @__PURE__ */ ee(we, [["render", Pe], ["__scopeId", "data-v-d3e3763
269
163
  // termo de busca
270
164
  filter: ""
271
165
  // filtro selecionado
272
- }), { data: v, pending: E, error: u, execute: L, attempt: Re } = e.fetch(e.endpoint, {
166
+ }), { data: L, pending: C, error: f, execute: b, attempt: Se } = e.fetch(e.endpoint, {
273
167
  params: () => e.deactivate_default_params ? e.add_params && typeof e.add_params == "function" ? e.add_params() : {
274
168
  ...e.add_params
275
169
  } : e.add_params && typeof e.add_params == "function" ? {
276
- ...q.value,
170
+ ...H.value,
277
171
  ...e.add_params()
278
172
  } : {
279
- ...q.value,
173
+ ...H.value,
280
174
  ...e.add_params
281
175
  },
282
176
  retry: e.retry_attempts,
283
177
  retryDelay: e.retry_delay,
284
178
  paramsReactives: !1,
285
179
  immediate: !1
286
- }, e.fetch_name), q = S(() => ({
180
+ }, e.fetch_name), H = W(() => ({
287
181
  [e.page_param_name]: n.value.current_page + 1,
288
182
  [e.page_size_param_name]: n.value.limit_per_page,
289
183
  [e.search_param_name]: n.value.search || "",
290
184
  [e.filter_param_name]: n.value.filter || ""
291
- })), te = S(() => E.value || D.value);
292
- z(v, (a) => {
293
- a ? (p.value = a[e.data_key] || [], M.value = a[e.total_key] || 0, n.value.count = M.value) : (p.value = [], M.value = 0);
185
+ })), X = W(() => C.value || z.value);
186
+ P(L, (t) => {
187
+ t ? (s.value = t[e.data_key] || [], S.value = t[e.total_key] || 0, n.value.count = S.value) : (s.value = [], S.value = 0);
294
188
  }, { immediate: !0 });
295
- async function w() {
296
- if (s.value && clearTimeout(s.value), D.value = !0, s.value = setTimeout(() => {
297
- D.value = !1;
189
+ function x() {
190
+ n.value.current_page = e.page_starts_at, E();
191
+ }
192
+ async function E() {
193
+ if (c.value && clearTimeout(c.value), z.value = !0, c.value = setTimeout(() => {
194
+ z.value = !1;
298
195
  }, e.min_loading_delay), e.type_fetch === "infinite-scroll")
299
- return L();
300
- e.type_fetch === "pagination" && (l("beforeFetch"), await L(), l("afterFetch"));
196
+ return b();
197
+ e.type_fetch === "pagination" && (i("beforeFetch"), await b(), i("afterFetch"));
301
198
  }
302
199
  let N = 0;
303
200
  async function R() {
304
201
  N++;
305
- const a = N;
306
- p.value = [], o.value = [], n.value.current_page = e.page_starts_at, l("beforeFetch"), await w(), l("afterFetch"), a === N && H(() => {
307
- if (a !== N)
202
+ const t = N;
203
+ s.value = [], o.value = [], n.value.current_page = e.page_starts_at, i("beforeFetch"), await E(), i("afterFetch"), t === N && B(() => {
204
+ if (t !== N)
308
205
  return;
309
- let d = crypto.randomUUID();
310
- p.value.forEach((r) => {
311
- r.loading = !0, r.idhashInfiniteLoading = d;
312
- }), o.value.push(...p.value), setTimeout(() => {
313
- o.value.forEach((r) => {
314
- r.idhashInfiniteLoading === d && (r.loading = !1, delete r.idhashInfiniteLoading);
206
+ let r = crypto.randomUUID();
207
+ s.value.forEach((l) => {
208
+ l.loading = !0, l.idhashInfiniteLoading = r;
209
+ }), o.value.push(...s.value), setTimeout(() => {
210
+ o.value.forEach((l) => {
211
+ l.idhashInfiniteLoading === r && (l.loading = !1, delete l.idhashInfiniteLoading);
315
212
  });
316
- }, e.min_loading_delay), h.value = !0, m.value++, P.value++;
213
+ }, e.min_loading_delay), w.value = !0, h.value++, F.value++;
317
214
  });
318
215
  }
319
- function ae(a) {
320
- a > 0 ? (n.value.limit_per_page = a, n.value.current_page = 0, w()) : console.warn("O limite deve ser um número maior que zero.");
216
+ function Z(t) {
217
+ t > 0 ? (n.value.limit_per_page = t, x()) : console.warn("O limite deve ser um número maior que zero.");
321
218
  }
322
- function ne(a) {
323
- n.value.search = a, n.value.current_page = 0, w();
219
+ function ee(t) {
220
+ n.value.search = t, x();
324
221
  }
325
- function ie(a) {
326
- n.value.filter = a, n.value.current_page = 0, w();
222
+ function te(t) {
223
+ n.value.filter = t, x();
327
224
  }
328
- function le(a) {
329
- a >= 1 && a <= Math.ceil(n.value.count / n.value.limit_per_page) ? (n.value.current_page = a - 1, w()) : console.warn("Número de página inválido.");
225
+ function ae(t) {
226
+ t >= 0 && t <= Math.ceil(n.value.count / n.value.limit_per_page) ? (n.value.current_page = t, E()) : console.warn("Número de página inválido.");
330
227
  }
331
- _({
332
- execute: w,
333
- pagination: me(n),
334
- set_limit_per_page: ae,
335
- set_search: ne,
336
- set_filter: ie,
337
- set_page: le,
338
- default_params: q
228
+ d({
229
+ execute: E,
230
+ pagination: _e(n),
231
+ set_limit_per_page: Z,
232
+ set_search: ee,
233
+ set_filter: te,
234
+ set_page: ae,
235
+ reSearch: x,
236
+ default_params: H
339
237
  });
340
- const J = S(() => v.value?.[e.next_page_response_name] || null);
341
- async function re(a) {
342
- if (!h.value) return;
343
- if (!J.value) {
344
- a.complete();
238
+ const G = W(() => L.value?.[e.next_page_response_name] || null);
239
+ async function ne(t) {
240
+ if (!w.value) return;
241
+ if (!G.value) {
242
+ t.complete();
345
243
  return;
346
244
  }
347
- if (n.value.current_page += 1, await L(), u.value) {
348
- a.error();
245
+ if (n.value.current_page += 1, await b(), f.value) {
246
+ t.error();
349
247
  return;
350
248
  }
351
- if (!p.value || p.value.length === 0) {
352
- a.complete();
249
+ if (!s.value || s.value.length === 0) {
250
+ t.complete();
353
251
  return;
354
252
  }
355
- const d = p.value.filter(
356
- (k) => !o.value.some((V) => V[e.item_key] === k[e.item_key])
253
+ const r = s.value.filter(
254
+ (p) => !o.value.some((O) => O[e.item_key] === p[e.item_key])
357
255
  );
358
- if (d.length === 0 && p.value.length > 0) {
359
- a.loaded();
256
+ if (r.length === 0 && s.value.length > 0) {
257
+ t.loaded();
360
258
  return;
361
259
  }
362
- const r = crypto.randomUUID();
363
- d.forEach((k) => {
364
- k.loading = !0, k.idhashInfiniteLoading = r;
365
- }), o.value.push(...d), setTimeout(() => {
366
- o.value.forEach((k) => {
367
- k.idhashInfiniteLoading === r && (k.loading = !1, delete k.idhashInfiniteLoading);
260
+ const l = crypto.randomUUID();
261
+ r.forEach((p) => {
262
+ p.loading = !0, p.idhashInfiniteLoading = l;
263
+ }), o.value.push(...r), setTimeout(() => {
264
+ o.value.forEach((p) => {
265
+ p.idhashInfiniteLoading === l && (p.loading = !1, delete p.idhashInfiniteLoading);
368
266
  });
369
- }, e.min_loading_delay), H(() => {
370
- o.value && o.value.length > n.value.limit_per_page * 2 && o.value.splice(0, n.value.limit_per_page), J.value ? a.loaded() : a.complete(), P.value++;
267
+ }, e.min_loading_delay), B(() => {
268
+ o.value && o.value.length > n.value.limit_per_page * 2 && o.value.splice(0, n.value.limit_per_page), G.value ? t.loaded() : t.complete(), F.value++;
371
269
  });
372
270
  }
373
- async function oe(a) {
374
- if (!h.value) return;
271
+ async function ie(t) {
272
+ if (!w.value) return;
375
273
  if (n.value.current_page <= e.page_starts_at) {
376
- a.complete();
274
+ t.complete();
377
275
  return;
378
276
  }
379
- const d = o.value[0];
380
- if (!d) return;
381
- const r = d[e.item_key];
382
- if (!r) {
383
- a.error();
277
+ const r = o.value[0];
278
+ if (!r) return;
279
+ const l = r[e.item_key];
280
+ if (!l) {
281
+ t.error();
384
282
  return;
385
283
  }
386
- if (n.value.current_page -= 1, await L(), u.value) {
387
- a.error();
284
+ if (n.value.current_page -= 1, await b(), f.value) {
285
+ t.error();
388
286
  return;
389
287
  }
390
- if (!p.value || p.value.length === 0) {
391
- a.loaded();
288
+ if (!s.value || s.value.length === 0) {
289
+ t.loaded();
392
290
  return;
393
291
  }
394
- const k = p.value.filter(
395
- (I) => !o.value.some((ue) => ue[e.item_key] === I[e.item_key])
396
- ), V = crypto.randomUUID();
397
- if (k.forEach((I) => {
398
- I.loading = !0, I.idhashInfiniteLoading = V;
399
- }), k.length === 0 && p.value.length > 0) {
400
- a.loaded();
292
+ const p = s.value.filter(
293
+ (y) => !o.value.some((re) => re[e.item_key] === y[e.item_key])
294
+ ), O = crypto.randomUUID();
295
+ if (p.forEach((y) => {
296
+ y.loading = !0, y.idhashInfiniteLoading = O;
297
+ }), p.length === 0 && s.value.length > 0) {
298
+ t.loaded();
401
299
  return;
402
300
  }
403
- o.value.unshift(...k), o.value && o.value.length > n.value.limit_per_page * 2 && o.value.splice(-n.value.limit_per_page, n.value.limit_per_page), setTimeout(() => {
404
- o.value.forEach((I) => {
405
- I.idhashInfiniteLoading === V && (I.loading = !1, delete I.idhashInfiniteLoading);
301
+ o.value.unshift(...p), o.value && o.value.length > n.value.limit_per_page * 2 && o.value.splice(-n.value.limit_per_page, n.value.limit_per_page), setTimeout(() => {
302
+ o.value.forEach((y) => {
303
+ y.idhashInfiniteLoading === O && (y.loading = !1, delete y.idhashInfiniteLoading);
406
304
  });
407
- }, e.min_loading_delay), H(() => {
408
- const I = document.getElementById(e.element_id + r);
409
- I ? I.scrollIntoView({ behavior: "auto", block: "start" }) : console.warn(`
305
+ }, e.min_loading_delay), B(() => {
306
+ const y = document.getElementById(e.element_id + l);
307
+ y ? y.scrollIntoView({ behavior: "auto", block: "start" }) : console.warn(`
410
308
  Elemento não encontrado para scroll verifique se a propriedade 'element_id' está correta ou não foi definida.
411
- `), m.value++, a.loaded();
309
+ `), h.value++, t.loaded();
412
310
  });
413
311
  }
414
- const O = [];
415
- e.watch && Array.isArray(e.watch) && e.watch.forEach((a) => {
416
- (he(a) || typeof a == "function") && O.push(a);
417
- }), z(() => n.value.current_page, () => {
418
- l("tradePage");
419
- }), O.length > 0 && (e.type_fetch === "pagination" ? z(O, () => {
420
- n.value.current_page = e.page_starts_at, w();
421
- }, { deep: !0 }) : e.type_fetch === "infinite-scroll" && z(O, () => {
422
- h.value = !1, R();
312
+ const V = [];
313
+ e.watch && Array.isArray(e.watch) && e.watch.forEach((t) => {
314
+ (ge(t) || typeof t == "function") && V.push(t);
315
+ }), P(() => n.value.current_page, () => {
316
+ i("tradePage");
317
+ }), V.length > 0 && (e.type_fetch === "pagination" ? P(V, () => {
318
+ x();
319
+ }, { deep: !0 }) : e.type_fetch === "infinite-scroll" && P(V, () => {
320
+ w.value = !1, R();
423
321
  }, { deep: !0 }));
424
- function se() {
425
- l("tradePage"), w();
322
+ function le() {
323
+ i("tradePage"), E();
426
324
  }
427
- return z(
325
+ return P(
428
326
  () => e.add_params,
429
327
  () => {
430
- y.value ? H(() => {
431
- y.value && e.type_fetch === "infinite-scroll" ? (R(), y.value = !1) : y.value && e.type_fetch === "pagination" && (w(), y.value = !1);
432
- }) : e.type_fetch === "pagination" ? (n.value.current_page = e.page_starts_at, w()) : e.type_fetch === "infinite-scroll" && (h.value = !1, R());
328
+ I.value ? B(() => {
329
+ I.value && e.type_fetch === "infinite-scroll" ? (R(), I.value = !1) : I.value && e.type_fetch === "pagination" && (E(), I.value = !1);
330
+ }) : e.type_fetch === "pagination" ? x() : e.type_fetch === "infinite-scroll" && (w.value = !1, R());
433
331
  },
434
332
  { deep: !0, immediate: !0 }
435
- ), (a, d) => (g(), f("div", null, [
436
- i.type_fetch === "pagination" ? (g(), f(C, { key: 0 }, [
437
- te.value ? (g(), f("div", {
438
- key: 0,
439
- class: U(e.class_loading_container)
440
- }, [
441
- (g(!0), f(C, null, $(n.value.limit_per_page, (r) => x(a.$slots, "loading", {
442
- key: "placeholder-" + r,
443
- n: r
444
- }, void 0, !0)), 128))
445
- ], 2)) : B(u) ? x(a.$slots, "error", {
333
+ ), (t, r) => (m(), g(D, null, [
334
+ me(A(e.limit_per_page) + " " + A(n.value.limit_per_page) + " ", 1),
335
+ v("div", null, [
336
+ a.type_fetch === "pagination" ? (m(), g(D, { key: 0 }, [
337
+ X.value ? (m(), g("div", {
338
+ key: 0,
339
+ class: M(e.class_loading_container)
340
+ }, [
341
+ (m(!0), g(D, null, $(n.value.limit_per_page, (l) => k(t.$slots, "loading", {
342
+ key: "placeholder-" + l,
343
+ n: l
344
+ }, void 0, !0)), 128))
345
+ ], 2)) : T(f) ? k(t.$slots, "error", {
346
+ key: 1,
347
+ error: T(f)
348
+ }, () => [
349
+ r[0] || (r[0] = v("div", {
350
+ class: "alert alert-danger",
351
+ role: "alert"
352
+ }, " Ocorreu um erro ao carregar os dados. ", -1))
353
+ ], !0) : n.value.count === 0 ? k(t.$slots, "empty", { key: 2 }, () => [
354
+ r[1] || (r[1] = v("div", {
355
+ class: "alert alert-info",
356
+ role: "alert"
357
+ }, " Nenhum registro encontrado. ", -1))
358
+ ], !0) : (m(), g("div", {
359
+ key: 3,
360
+ class: M(e.class_container)
361
+ }, [
362
+ (m(!0), g(D, null, $(s.value, (l) => k(t.$slots, "body", {
363
+ key: l[e.item_key],
364
+ item: l
365
+ }, void 0, !0)), 128))
366
+ ], 2))
367
+ ], 64)) : a.type_fetch === "infinite-scroll" ? (m(), g("div", {
446
368
  key: 1,
447
- error: B(u)
448
- }, () => [
449
- d[0] || (d[0] = c("div", {
450
- class: "alert alert-danger",
451
- role: "alert"
452
- }, " Ocorreu um erro ao carregar os dados. ", -1))
453
- ], !0) : n.value.count === 0 ? x(a.$slots, "empty", { key: 2 }, () => [
454
- d[1] || (d[1] = c("div", {
455
- class: "alert alert-info",
456
- role: "alert"
457
- }, " Nenhum registro encontrado. ", -1))
458
- ], !0) : (g(), f("div", {
459
- key: 3,
460
- class: U(e.class_container)
461
- }, [
462
- (g(!0), f(C, null, $(p.value, (r) => x(a.$slots, "body", {
463
- key: r[e.item_key],
464
- item: r
465
- }, void 0, !0)), 128))
466
- ], 2))
467
- ], 64)) : i.type_fetch === "infinite-scroll" ? (g(), f("div", {
468
- key: 1,
469
- class: U(e.class_container)
470
- }, [
471
- j(B(Q), {
472
- identifier: P.value,
473
- direction: "top",
474
- onInfinite: oe
475
- }, {
476
- complete: W(() => [...d[2] || (d[2] = [
477
- c("span", null, null, -1)
478
- ])]),
479
- spinner: W(() => [...d[3] || (d[3] = [
480
- c("span", null, null, -1)
481
- ])]),
482
- _: 1
483
- }, 8, ["identifier"]),
484
- (g(!0), f(C, null, $(o.value, (r) => (g(), f(C, {
485
- key: r[e.item_key]
369
+ class: M(e.class_container)
486
370
  }, [
487
- r.loading ? x(a.$slots, "loading", { key: 1 }, void 0, !0) : x(a.$slots, "body", {
371
+ q(T(K), {
372
+ identifier: F.value,
373
+ direction: "top",
374
+ onInfinite: ie
375
+ }, {
376
+ complete: j(() => [...r[2] || (r[2] = [
377
+ v("span", null, null, -1)
378
+ ])]),
379
+ spinner: j(() => [...r[3] || (r[3] = [
380
+ v("span", null, null, -1)
381
+ ])]),
382
+ _: 1
383
+ }, 8, ["identifier"]),
384
+ (m(!0), g(D, null, $(o.value, (l) => (m(), g(D, {
385
+ key: l[e.item_key]
386
+ }, [
387
+ l.loading ? k(t.$slots, "loading", { key: 1 }, void 0, !0) : k(t.$slots, "body", {
388
+ key: 0,
389
+ item: l
390
+ }, void 0, !0)
391
+ ], 64))), 128)),
392
+ q(T(K), {
393
+ identifier: h.value,
394
+ onInfinite: ne
395
+ }, {
396
+ complete: j(() => [
397
+ k(t.$slots, "scroll-finish", {}, () => [
398
+ r[4] || (r[4] = v("span", { class: "scroll-finish-style" }, " Fim dos registros", -1))
399
+ ], !0)
400
+ ]),
401
+ _: 3
402
+ }, 8, ["identifier"])
403
+ ], 2)) : U("", !0),
404
+ a.type_fetch === "pagination" ? k(t.$slots, "pagination", {
405
+ key: 2,
406
+ pagination: n.value,
407
+ tradePage: E,
408
+ error: T(f)
409
+ }, () => [
410
+ !T(f) && n.value.count > 0 ? (m(), g("div", {
488
411
  key: 0,
489
- item: r
490
- }, void 0, !0)
491
- ], 64))), 128)),
492
- j(B(Q), {
493
- identifier: m.value,
494
- onInfinite: re
495
- }, {
496
- complete: W(() => [
497
- x(a.$slots, "scroll-finish", {}, () => [
498
- d[4] || (d[4] = c("span", { class: "scroll-finish-style" }, " Fim dos registros", -1))
499
- ], !0)
500
- ]),
501
- _: 3
502
- }, 8, ["identifier"])
503
- ], 2)) : T("", !0),
504
- i.type_fetch === "pagination" ? x(a.$slots, "pagination", {
505
- key: 2,
506
- pagination: n.value,
507
- tradePage: w,
508
- error: B(u)
509
- }, () => [
510
- !B(u) && n.value.count > 0 ? (g(), f("div", {
511
- key: 0,
512
- class: U(["px-3", e.class_pagination])
513
- }, [
514
- j($e, {
515
- filtering: !0,
516
- pagination: n.value,
517
- onTradePage: se
518
- }, null, 8, ["pagination"])
519
- ], 2)) : T("", !0)
520
- ], !0) : T("", !0)
521
- ]));
412
+ class: M(["px-3", e.class_pagination])
413
+ }, [
414
+ q(ve, {
415
+ filtering: !0,
416
+ page_starts_at: e.page_starts_at,
417
+ pagination: n.value,
418
+ onTradePage: le
419
+ }, null, 8, ["page_starts_at", "pagination"])
420
+ ], 2)) : U("", !0)
421
+ ], !0) : U("", !0)
422
+ ])
423
+ ], 64));
522
424
  }
523
- }), Je = /* @__PURE__ */ Z(qe, [["__scopeId", "data-v-08efb648"]]);
425
+ }), Ce = /* @__PURE__ */ he(Fe, [["__scopeId", "data-v-48421ad6"]]);
524
426
  export {
525
- Je as VDataPage
427
+ Ce as VDataPage
526
428
  };