v-sistec-features 1.3.1 → 1.3.3
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/v-sistec-features.css +1 -1
- package/dist/vDataPage.js +252 -244
- package/dist/vDataTable.js +275 -269
- package/package.json +1 -1
- package/src/DataPageVue/components/VDataPage.vue +46 -55
- package/src/DatatableVue/components/VDataTable.vue +29 -21
package/dist/vDataPage.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { _ as
|
|
3
|
-
function
|
|
4
|
-
if (!
|
|
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
|
|
7
|
-
return
|
|
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
|
|
10
|
-
return
|
|
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
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
(
|
|
17
|
-
|
|
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:
|
|
19
|
+
{ root: n.parentEl, rootMargin: p }
|
|
20
20
|
);
|
|
21
|
-
return
|
|
21
|
+
return n.infiniteLoading.value && t.observe(n.infiniteLoading.value), t;
|
|
22
22
|
}
|
|
23
|
-
async function
|
|
24
|
-
if (await
|
|
23
|
+
async function K(n, p) {
|
|
24
|
+
if (await L(), !n.top)
|
|
25
25
|
return;
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
const t = n.parentEl || document.documentElement;
|
|
27
|
+
t.scrollTop = t.scrollHeight - p;
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
for (const [
|
|
32
|
-
|
|
33
|
-
return
|
|
34
|
-
},
|
|
35
|
-
|
|
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
|
|
38
|
-
return _(),
|
|
37
|
+
function Ie(n, p) {
|
|
38
|
+
return _(), f("div", ke, xe);
|
|
39
39
|
}
|
|
40
|
-
const
|
|
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(
|
|
52
|
-
const
|
|
53
|
-
let
|
|
54
|
-
const
|
|
55
|
-
infiniteLoading:
|
|
56
|
-
top:
|
|
57
|
-
firstload:
|
|
58
|
-
distance:
|
|
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
|
-
|
|
61
|
+
e = (r.parentEl || document.documentElement).scrollHeight, v.loading(), p("infinite", v);
|
|
62
62
|
}
|
|
63
|
-
},
|
|
63
|
+
}, v = {
|
|
64
64
|
loading() {
|
|
65
|
-
|
|
65
|
+
g.value = "loading";
|
|
66
66
|
},
|
|
67
67
|
async loaded() {
|
|
68
|
-
|
|
68
|
+
g.value = "loaded", await K(r, e), ve(y.value, r.parentEl) && r.emit();
|
|
69
69
|
},
|
|
70
70
|
async complete() {
|
|
71
|
-
|
|
71
|
+
g.value = "complete", await K(r, e), l?.disconnect();
|
|
72
72
|
},
|
|
73
73
|
error() {
|
|
74
|
-
|
|
74
|
+
g.value = "error";
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
|
-
function
|
|
78
|
-
|
|
77
|
+
function a() {
|
|
78
|
+
l?.disconnect(), l = he(r);
|
|
79
79
|
}
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
}),
|
|
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:
|
|
84
|
+
ref: y,
|
|
85
85
|
class: "v3-infinite-loading"
|
|
86
86
|
}, [
|
|
87
|
-
|
|
88
|
-
E(
|
|
89
|
-
|
|
87
|
+
ce(c("div", null, [
|
|
88
|
+
E(d.$slots, "spinner", {}, () => [
|
|
89
|
+
N(Pe)
|
|
90
90
|
], !0)
|
|
91
91
|
], 512), [
|
|
92
|
-
[
|
|
92
|
+
[pe, g.value == "loading"]
|
|
93
93
|
]),
|
|
94
|
-
|
|
95
|
-
var
|
|
94
|
+
g.value == "complete" ? E(d.$slots, "complete", { key: 0 }, () => {
|
|
95
|
+
var o;
|
|
96
96
|
return [
|
|
97
|
-
|
|
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
|
-
|
|
100
|
+
g.value == "error" ? E(d.$slots, "error", {
|
|
101
101
|
key: 1,
|
|
102
|
-
retry:
|
|
102
|
+
retry: r.emit
|
|
103
103
|
}, () => {
|
|
104
|
-
var
|
|
104
|
+
var o;
|
|
105
105
|
return [
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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:
|
|
111
|
-
(...
|
|
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
|
-
}),
|
|
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
|
-
},
|
|
121
|
+
}, Be = {
|
|
122
122
|
key: 0,
|
|
123
123
|
class: "d-flex align-items-center gap-2"
|
|
124
|
-
},
|
|
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
|
-
},
|
|
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
|
-
`,
|
|
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
|
-
`,
|
|
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(
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
|
|
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
|
-
|
|
156
|
-
}, C = () => {
|
|
157
|
-
e.
|
|
158
|
-
|
|
159
|
-
|
|
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
|
-
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
r - 1,
|
|
168
|
+
r,
|
|
169
|
+
r + 1,
|
|
170
170
|
// Mostra a atual e vizinhas
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
v - 1,
|
|
172
|
+
v
|
|
173
173
|
// Sempre mostra as 2 últimas
|
|
174
|
-
]),
|
|
175
|
-
let
|
|
176
|
-
return Array.from(
|
|
177
|
-
|
|
178
|
-
}),
|
|
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 (
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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:
|
|
187
|
-
disabled:
|
|
188
|
-
innerHTML:
|
|
189
|
-
}, null, 8,
|
|
190
|
-
|
|
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:
|
|
193
|
-
disabled:
|
|
194
|
-
innerHTML:
|
|
195
|
-
}, null, 8,
|
|
192
|
+
onClick: T(I, ["prevent"]),
|
|
193
|
+
disabled: t.pagination.current_page === 0,
|
|
194
|
+
innerHTML: $
|
|
195
|
+
}, null, 8, Te)
|
|
196
196
|
]),
|
|
197
|
-
|
|
198
|
-
(_(!0),
|
|
199
|
-
typeof
|
|
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:
|
|
202
|
-
onClick:
|
|
203
|
-
disabled:
|
|
204
|
-
},
|
|
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
|
-
|
|
208
|
-
|
|
209
|
-
onClick:
|
|
207
|
+
c("div", Se, [
|
|
208
|
+
c("button", {
|
|
209
|
+
onClick: T(g, ["prevent"]),
|
|
210
210
|
class: "btn btn-estilo rotate-180",
|
|
211
|
-
disabled: !
|
|
212
|
-
innerHTML:
|
|
213
|
-
}, null, 8,
|
|
214
|
-
|
|
215
|
-
onClick:
|
|
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: !
|
|
218
|
-
innerHTML:
|
|
219
|
-
}, null, 8,
|
|
217
|
+
disabled: !y.value,
|
|
218
|
+
innerHTML: Y
|
|
219
|
+
}, null, 8, Ne)
|
|
220
220
|
])
|
|
221
221
|
])) : M("", !0)
|
|
222
222
|
])) : M("", !0);
|
|
223
223
|
}
|
|
224
|
-
}),
|
|
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
|
-
|
|
260
|
-
|
|
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:
|
|
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
|
-
...
|
|
275
|
+
...O.value,
|
|
276
276
|
...e.add_params()
|
|
277
277
|
} : {
|
|
278
|
-
...
|
|
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),
|
|
286
|
-
[e.page_param_name]:
|
|
287
|
-
[e.page_size_param_name]:
|
|
288
|
-
[e.search_param_name]:
|
|
289
|
-
[e.filter_param_name]:
|
|
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
|
-
|
|
292
|
-
|
|
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
|
-
|
|
295
|
+
if (r.value && clearTimeout(r.value), C.value = !0, r.value = setTimeout(() => {
|
|
296
296
|
C.value = !1;
|
|
297
|
-
}, e.min_loading_delay),
|
|
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
|
|
300
|
-
|
|
301
|
-
|
|
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
|
|
305
|
-
|
|
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
|
|
308
|
-
|
|
309
|
+
function te(i) {
|
|
310
|
+
a.value.search = i, a.value.current_page = 0, b();
|
|
309
311
|
}
|
|
310
|
-
function
|
|
311
|
-
|
|
312
|
+
function ae(i) {
|
|
313
|
+
a.value.filter = i, a.value.current_page = 0, b();
|
|
312
314
|
}
|
|
313
|
-
function
|
|
314
|
-
|
|
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
|
-
|
|
318
|
+
p({
|
|
317
319
|
execute: b,
|
|
318
|
-
pagination:
|
|
319
|
-
set_limit_per_page:
|
|
320
|
-
set_search:
|
|
321
|
-
set_filter:
|
|
322
|
-
set_page:
|
|
323
|
-
default_params:
|
|
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
|
|
330
|
-
async function
|
|
331
|
-
if (!
|
|
332
|
-
if (!
|
|
333
|
-
|
|
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 (
|
|
337
|
-
|
|
334
|
+
if (a.value.current_page += 1, await k(), o.value) {
|
|
335
|
+
i.error();
|
|
338
336
|
return;
|
|
339
337
|
}
|
|
340
|
-
if (!
|
|
341
|
-
|
|
338
|
+
if (!u.value || u.value.length === 0) {
|
|
339
|
+
i.complete();
|
|
342
340
|
return;
|
|
343
341
|
}
|
|
344
|
-
const
|
|
345
|
-
(
|
|
342
|
+
const h = u.value.filter(
|
|
343
|
+
(w) => !s.value.some((H) => H[e.item_key] === w[e.item_key])
|
|
346
344
|
);
|
|
347
|
-
if (
|
|
348
|
-
|
|
345
|
+
if (h.length === 0 && u.value.length > 0) {
|
|
346
|
+
i.loaded();
|
|
349
347
|
return;
|
|
350
348
|
}
|
|
351
|
-
|
|
352
|
-
|
|
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
|
|
356
|
-
if (!
|
|
357
|
-
if (
|
|
358
|
-
|
|
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
|
|
362
|
-
if (!
|
|
363
|
-
const
|
|
364
|
-
if (!
|
|
365
|
-
|
|
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 (
|
|
369
|
-
|
|
366
|
+
if (a.value.current_page -= 1, await k(), o.value) {
|
|
367
|
+
i.error();
|
|
370
368
|
return;
|
|
371
369
|
}
|
|
372
|
-
if (!
|
|
373
|
-
|
|
370
|
+
if (!u.value || u.value.length === 0) {
|
|
371
|
+
i.loaded();
|
|
374
372
|
return;
|
|
375
373
|
}
|
|
376
|
-
const
|
|
377
|
-
(
|
|
374
|
+
const H = u.value.filter(
|
|
375
|
+
(S) => !s.value.some((re) => re[e.item_key] === S[e.item_key])
|
|
378
376
|
);
|
|
379
|
-
if (
|
|
380
|
-
|
|
377
|
+
if (H.length === 0 && u.value.length > 0) {
|
|
378
|
+
i.loaded();
|
|
381
379
|
return;
|
|
382
380
|
}
|
|
383
|
-
|
|
384
|
-
const
|
|
385
|
-
|
|
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
|
-
`),
|
|
385
|
+
`), g.value++, i.loaded();
|
|
388
386
|
});
|
|
389
387
|
}
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
(
|
|
393
|
-
}),
|
|
394
|
-
|
|
395
|
-
}),
|
|
396
|
-
|
|
397
|
-
}, { deep: !0 }) : e.type_fetch === "infinite-scroll" &&
|
|
398
|
-
|
|
399
|
-
}, { deep: !0 }))
|
|
400
|
-
|
|
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, immediate: !0 }
|
|
407
|
+
), (i, h) => (_(), f("div", null, [
|
|
408
|
+
n.type_fetch === "pagination" ? (_(), f("div", {
|
|
401
409
|
key: 0,
|
|
402
|
-
class:
|
|
410
|
+
class: V(["", e.class_container])
|
|
403
411
|
}, [
|
|
404
|
-
(_(!0),
|
|
405
|
-
key:
|
|
406
|
-
item:
|
|
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)) :
|
|
416
|
+
], 2)) : n.type_fetch === "infinite-scroll" ? (_(), f("div", {
|
|
409
417
|
key: 1,
|
|
410
|
-
class:
|
|
418
|
+
class: V(e.class_container)
|
|
411
419
|
}, [
|
|
412
|
-
|
|
413
|
-
identifier:
|
|
420
|
+
N(A(Q), {
|
|
421
|
+
identifier: x.value,
|
|
414
422
|
direction: "top",
|
|
415
|
-
onInfinite:
|
|
423
|
+
onInfinite: le
|
|
416
424
|
}, {
|
|
417
|
-
complete:
|
|
418
|
-
|
|
425
|
+
complete: R(() => [...h[0] || (h[0] = [
|
|
426
|
+
c("span", null, null, -1)
|
|
419
427
|
])]),
|
|
420
|
-
spinner:
|
|
421
|
-
|
|
428
|
+
spinner: R(() => [...h[1] || (h[1] = [
|
|
429
|
+
c("span", null, null, -1)
|
|
422
430
|
])]),
|
|
423
431
|
_: 1
|
|
424
432
|
}, 8, ["identifier"]),
|
|
425
|
-
(_(!0),
|
|
426
|
-
key:
|
|
427
|
-
item:
|
|
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
|
-
|
|
430
|
-
identifier:
|
|
431
|
-
onInfinite:
|
|
437
|
+
N(A(Q), {
|
|
438
|
+
identifier: g.value,
|
|
439
|
+
onInfinite: ie
|
|
432
440
|
}, {
|
|
433
|
-
complete:
|
|
434
|
-
E(
|
|
435
|
-
|
|
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
|
-
|
|
449
|
+
n.type_fetch === "pagination" ? E(i.$slots, "pagination", {
|
|
442
450
|
key: 2,
|
|
443
|
-
pagination:
|
|
451
|
+
pagination: a.value,
|
|
444
452
|
tradePage: b,
|
|
445
|
-
error:
|
|
453
|
+
error: A(o)
|
|
446
454
|
}, () => [
|
|
447
|
-
!
|
|
455
|
+
!A(o) && a.value.count > 0 ? (_(), f("div", {
|
|
448
456
|
key: 0,
|
|
449
|
-
class:
|
|
457
|
+
class: V(["px-3", e.class_pagination])
|
|
450
458
|
}, [
|
|
451
|
-
|
|
459
|
+
N(je, {
|
|
452
460
|
filtering: !0,
|
|
453
|
-
pagination:
|
|
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
|
-
}),
|
|
468
|
+
}), Ue = /* @__PURE__ */ X(Oe, [["__scopeId", "data-v-39ccb159"]]);
|
|
461
469
|
export {
|
|
462
|
-
|
|
470
|
+
Ue as VDataPage
|
|
463
471
|
};
|