v-sistec-features 1.3.1 → 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 T, 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 z, withModifiers as L, Fragment as O, renderList as F, normalizeClass as j, readonly as de, isRef as _e, unref as N, 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 T(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 = z(() => e.pagination.limit_per_page ? Math.ceil(e.pagination.count / e.pagination.limit_per_page) : 0), m = z(() => 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 = z(() => {
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: {},
@@ -253,11 +253,11 @@ const xe = /* @__PURE__ */ X(me, [["render", we], ["__scopeId", "data-v-d3e37633
253
253
  next_page_response_name: { default: "next_page" },
254
254
  page_starts_at: { default: 0 },
255
255
  element_id: { default: "" },
256
- watch: { default: () => [] },
257
- scroll_on_trade_page: { type: Boolean, default: !1 }
256
+ watch: { default: () => [] }
258
257
  },
259
- setup(a, { expose: s }) {
260
- 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({
261
261
  current_page: e.page_starts_at,
262
262
  // pagina atual
263
263
  count: 0,
@@ -268,196 +268,204 @@ const xe = /* @__PURE__ */ X(me, [["render", we], ["__scopeId", "data-v-d3e37633
268
268
  // termo de busca
269
269
  filter: ""
270
270
  // filtro selecionado
271
- }), { 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, {
272
272
  params: () => e.deactivate_default_params ? e.add_params && typeof e.add_params == "function" ? e.add_params() : {
273
273
  ...e.add_params
274
274
  } : e.add_params && typeof e.add_params == "function" ? {
275
- ...w.value,
275
+ ...O.value,
276
276
  ...e.add_params()
277
277
  } : {
278
- ...w.value,
278
+ ...O.value,
279
279
  ...e.add_params
280
280
  },
281
281
  retry: e.retry_attempts,
282
282
  retryDelay: e.retry_delay,
283
283
  paramsReactives: !1,
284
284
  immediate: !1
285
- }, e.fetch_name), w = z(() => ({
286
- [e.page_param_name]: t.value.current_page + 1,
287
- [e.page_size_param_name]: t.value.limit_per_page,
288
- [e.search_param_name]: t.value.search || "",
289
- [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 || ""
290
290
  }));
291
- T(h, (n) => {
292
- 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);
293
293
  }, { immediate: !0 });
294
294
  async function b() {
295
- 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(() => {
296
296
  C.value = !1;
297
- }, 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"));
298
300
  }
299
- async function W() {
300
- l.value = [], r.value = [], t.value.current_page = e.page_starts_at, await b(), D(() => {
301
- 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++;
302
304
  });
303
305
  }
304
- function Z(n) {
305
- 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.");
306
308
  }
307
- function ee(n) {
308
- 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();
309
311
  }
310
- function te(n) {
311
- 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();
312
314
  }
313
- function ae(n) {
314
- 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.");
315
317
  }
316
- s({
318
+ p({
317
319
  execute: b,
318
- pagination: de(t),
319
- set_limit_per_page: Z,
320
- set_search: ee,
321
- set_filter: te,
322
- set_page: ae,
323
- default_params: w
324
- }), Y(() => {
325
- D(() => {
326
- i.value && e.type_fetch === "infinite-scroll" ? (W(), i.value = !1) : i.value && e.type_fetch === "pagination" && (b(), i.value = !1);
327
- });
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
328
326
  });
329
- const U = z(() => h.value?.[e.next_page_response_name] || null);
330
- async function ne(n) {
331
- if (!x.value) return;
332
- if (!U.value) {
333
- 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();
334
332
  return;
335
333
  }
336
- if (t.value.current_page += 1, await y(), c.value) {
337
- n.error();
334
+ if (a.value.current_page += 1, await k(), o.value) {
335
+ i.error();
338
336
  return;
339
337
  }
340
- if (!l.value || l.value.length === 0) {
341
- n.complete();
338
+ if (!u.value || u.value.length === 0) {
339
+ i.complete();
342
340
  return;
343
341
  }
344
- const f = l.value.filter(
345
- (k) => !r.value.some((S) => S[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])
346
344
  );
347
- if (f.length === 0 && l.value.length > 0) {
348
- n.loaded();
345
+ if (h.length === 0 && u.value.length > 0) {
346
+ i.loaded();
349
347
  return;
350
348
  }
351
- r.value.push(...f), D(() => {
352
- 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++;
353
351
  });
354
352
  }
355
- async function ie(n) {
356
- if (!x.value) return;
357
- if (t.value.current_page <= e.page_starts_at) {
358
- 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();
359
357
  return;
360
358
  }
361
- const f = r.value[0];
362
- if (!f) return;
363
- const k = f[e.item_key];
364
- if (!k) {
365
- 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();
366
364
  return;
367
365
  }
368
- if (t.value.current_page -= 1, await y(), c.value) {
369
- n.error();
366
+ if (a.value.current_page -= 1, await k(), o.value) {
367
+ i.error();
370
368
  return;
371
369
  }
372
- if (!l.value || l.value.length === 0) {
373
- n.loaded();
370
+ if (!u.value || u.value.length === 0) {
371
+ i.loaded();
374
372
  return;
375
373
  }
376
- const S = l.value.filter(
377
- (A) => !r.value.some((le) => le[e.item_key] === A[e.item_key])
374
+ const H = u.value.filter(
375
+ (S) => !s.value.some((re) => re[e.item_key] === S[e.item_key])
378
376
  );
379
- if (S.length === 0 && l.value.length > 0) {
380
- n.loaded();
377
+ if (H.length === 0 && u.value.length > 0) {
378
+ i.loaded();
381
379
  return;
382
380
  }
383
- r.value.unshift(...S), 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(() => {
384
- const A = document.getElementById(e.element_id + k);
385
- A ? A.scrollIntoView({ behavior: "auto", block: "start" }) : console.warn(`
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);
383
+ S ? S.scrollIntoView({ behavior: "auto", block: "start" }) : console.warn(`
386
384
  Elemento não encontrado para scroll verifique se a propriedade 'element_id' está correta ou não foi definida.
387
- `), u.value++, n.loaded();
385
+ `), g.value++, i.loaded();
388
386
  });
389
387
  }
390
- const H = [];
391
- return e.watch && Array.isArray(e.watch) && e.watch.forEach((n) => {
392
- (_e(n) || typeof n == "function") && H.push(n);
393
- }), T(() => t.value.current_page, () => {
394
- e.type_fetch === "pagination" && e.scroll_on_trade_page && window.scrollTo({ top: 0, behavior: "auto" });
395
- }), H.length > 0 && (e.type_fetch === "pagination" ? T(H, () => {
396
- t.value.current_page = e.page_starts_at, b();
397
- }, { deep: !0 }) : e.type_fetch === "infinite-scroll" && T(H, () => {
398
- x.value = !1, W();
399
- }, { deep: !0 })), (n, f) => (_(), d("div", null, [
400
- 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", {
401
409
  key: 0,
402
- class: j(["", e.class_container])
410
+ class: V(["", e.class_container])
403
411
  }, [
404
- (_(!0), d(O, null, F(l.value, (k) => E(n.$slots, "body", {
405
- key: k[e.item_key],
406
- item: k
412
+ (_(!0), f(j, null, W(u.value, (w) => E(i.$slots, "body", {
413
+ key: w[e.item_key],
414
+ item: w
407
415
  }, void 0, !0)), 128))
408
- ], 2)) : a.type_fetch === "infinite-scroll" ? (_(), d("div", {
416
+ ], 2)) : n.type_fetch === "infinite-scroll" ? (_(), f("div", {
409
417
  key: 1,
410
- class: j(e.class_container)
418
+ class: V(e.class_container)
411
419
  }, [
412
- V(N(J), {
413
- identifier: m.value,
420
+ N(A(Q), {
421
+ identifier: x.value,
414
422
  direction: "top",
415
- onInfinite: ie
423
+ onInfinite: le
416
424
  }, {
417
- complete: q(() => [...f[0] || (f[0] = [
418
- o("span", null, null, -1)
425
+ complete: R(() => [...h[0] || (h[0] = [
426
+ c("span", null, null, -1)
419
427
  ])]),
420
- spinner: q(() => [...f[1] || (f[1] = [
421
- o("span", null, null, -1)
428
+ spinner: R(() => [...h[1] || (h[1] = [
429
+ c("span", null, null, -1)
422
430
  ])]),
423
431
  _: 1
424
432
  }, 8, ["identifier"]),
425
- (_(!0), d(O, null, F(r.value, (k) => E(n.$slots, "body", {
426
- key: k[e.item_key],
427
- item: k
433
+ (_(!0), f(j, null, W(s.value, (w) => E(i.$slots, "body", {
434
+ key: w[e.item_key],
435
+ item: w
428
436
  }, void 0, !0)), 128)),
429
- V(N(J), {
430
- identifier: u.value,
431
- onInfinite: ne
437
+ N(A(Q), {
438
+ identifier: g.value,
439
+ onInfinite: ie
432
440
  }, {
433
- complete: q(() => [
434
- E(n.$slots, "scroll-finish", {}, () => [
435
- 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))
436
444
  ], !0)
437
445
  ]),
438
446
  _: 3
439
447
  }, 8, ["identifier"])
440
448
  ], 2)) : M("", !0),
441
- a.type_fetch === "pagination" ? E(n.$slots, "pagination", {
449
+ n.type_fetch === "pagination" ? E(i.$slots, "pagination", {
442
450
  key: 2,
443
- pagination: t.value,
451
+ pagination: a.value,
444
452
  tradePage: b,
445
- error: N(c)
453
+ error: A(o)
446
454
  }, () => [
447
- !N(c) && t.value.count > 0 ? (_(), d("div", {
455
+ !A(o) && a.value.count > 0 ? (_(), f("div", {
448
456
  key: 0,
449
- class: j(["px-3", e.class_pagination])
457
+ class: V(["px-3", e.class_pagination])
450
458
  }, [
451
- V(Ve, {
459
+ N(je, {
452
460
  filtering: !0,
453
- pagination: t.value,
461
+ pagination: a.value,
454
462
  onTradePage: b
455
463
  }, null, 8, ["pagination"])
456
464
  ], 2)) : M("", !0)
457
465
  ], !0) : M("", !0)
458
466
  ]));
459
467
  }
460
- }), Fe = /* @__PURE__ */ $(je, [["__scopeId", "data-v-7cbfca3a"]]);
468
+ }), Ue = /* @__PURE__ */ X(Oe, [["__scopeId", "data-v-fac17d89"]]);
461
469
  export {
462
- Fe as VDataPage
470
+ Ue as VDataPage
463
471
  };