v-sistec-features 1.3.0 → 1.3.2

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