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/v-sistec-features.css +1 -1
- package/dist/vDataPage.js +250 -239
- package/dist/vDataTable.js +275 -269
- package/package.json +1 -1
- package/src/DataPageVue/components/VDataPage.vue +51 -50
- 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 = 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
|
-
|
|
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: {},
|
|
@@ -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
|
-
|
|
259
|
-
|
|
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:
|
|
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
|
-
...
|
|
275
|
+
...O.value,
|
|
275
276
|
...e.add_params()
|
|
276
277
|
} : {
|
|
277
|
-
...
|
|
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),
|
|
285
|
-
[e.page_param_name]:
|
|
286
|
-
[e.page_size_param_name]:
|
|
287
|
-
[e.search_param_name]:
|
|
288
|
-
[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 || ""
|
|
289
290
|
}));
|
|
290
|
-
|
|
291
|
-
|
|
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
|
-
|
|
295
|
+
if (r.value && clearTimeout(r.value), C.value = !0, r.value = setTimeout(() => {
|
|
295
296
|
C.value = !1;
|
|
296
|
-
}, 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"));
|
|
297
300
|
}
|
|
298
|
-
async function
|
|
299
|
-
|
|
300
|
-
|
|
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
|
|
304
|
-
|
|
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
|
|
307
|
-
|
|
309
|
+
function te(i) {
|
|
310
|
+
a.value.search = i, a.value.current_page = 0, b();
|
|
308
311
|
}
|
|
309
|
-
function
|
|
310
|
-
|
|
312
|
+
function ae(i) {
|
|
313
|
+
a.value.filter = i, a.value.current_page = 0, b();
|
|
311
314
|
}
|
|
312
|
-
function
|
|
313
|
-
|
|
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
|
-
|
|
318
|
+
p({
|
|
316
319
|
execute: b,
|
|
317
|
-
pagination:
|
|
318
|
-
set_limit_per_page:
|
|
319
|
-
set_search:
|
|
320
|
-
set_filter:
|
|
321
|
-
set_page:
|
|
322
|
-
default_params:
|
|
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
|
|
329
|
-
async function
|
|
330
|
-
if (!
|
|
331
|
-
if (!
|
|
332
|
-
|
|
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 (
|
|
336
|
-
|
|
334
|
+
if (a.value.current_page += 1, await k(), o.value) {
|
|
335
|
+
i.error();
|
|
337
336
|
return;
|
|
338
337
|
}
|
|
339
|
-
if (!
|
|
340
|
-
|
|
338
|
+
if (!u.value || u.value.length === 0) {
|
|
339
|
+
i.complete();
|
|
341
340
|
return;
|
|
342
341
|
}
|
|
343
|
-
const
|
|
344
|
-
(
|
|
342
|
+
const h = u.value.filter(
|
|
343
|
+
(w) => !s.value.some((H) => H[e.item_key] === w[e.item_key])
|
|
345
344
|
);
|
|
346
|
-
if (
|
|
347
|
-
|
|
345
|
+
if (h.length === 0 && u.value.length > 0) {
|
|
346
|
+
i.loaded();
|
|
348
347
|
return;
|
|
349
348
|
}
|
|
350
|
-
|
|
351
|
-
|
|
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
|
|
355
|
-
if (!
|
|
356
|
-
if (
|
|
357
|
-
|
|
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
|
|
361
|
-
if (!
|
|
362
|
-
const
|
|
363
|
-
if (!
|
|
364
|
-
|
|
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 (
|
|
368
|
-
|
|
366
|
+
if (a.value.current_page -= 1, await k(), o.value) {
|
|
367
|
+
i.error();
|
|
369
368
|
return;
|
|
370
369
|
}
|
|
371
|
-
if (!
|
|
372
|
-
|
|
370
|
+
if (!u.value || u.value.length === 0) {
|
|
371
|
+
i.loaded();
|
|
373
372
|
return;
|
|
374
373
|
}
|
|
375
|
-
const H =
|
|
376
|
-
(S) => !
|
|
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 &&
|
|
379
|
-
|
|
377
|
+
if (H.length === 0 && u.value.length > 0) {
|
|
378
|
+
i.loaded();
|
|
380
379
|
return;
|
|
381
380
|
}
|
|
382
|
-
|
|
383
|
-
const S = document.getElementById(e.element_id +
|
|
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
|
-
`),
|
|
385
|
+
`), g.value++, i.loaded();
|
|
387
386
|
});
|
|
388
387
|
}
|
|
389
|
-
const
|
|
390
|
-
|
|
391
|
-
(
|
|
392
|
-
}),
|
|
393
|
-
|
|
394
|
-
},
|
|
395
|
-
|
|
396
|
-
}, { deep: !0 })
|
|
397
|
-
|
|
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:
|
|
410
|
+
class: V(["", e.class_container])
|
|
400
411
|
}, [
|
|
401
|
-
(_(!0),
|
|
402
|
-
key:
|
|
403
|
-
item:
|
|
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)) :
|
|
416
|
+
], 2)) : n.type_fetch === "infinite-scroll" ? (_(), f("div", {
|
|
406
417
|
key: 1,
|
|
407
|
-
class:
|
|
418
|
+
class: V(e.class_container)
|
|
408
419
|
}, [
|
|
409
|
-
|
|
410
|
-
identifier:
|
|
420
|
+
N(A(Q), {
|
|
421
|
+
identifier: x.value,
|
|
411
422
|
direction: "top",
|
|
412
|
-
onInfinite:
|
|
423
|
+
onInfinite: le
|
|
413
424
|
}, {
|
|
414
|
-
complete:
|
|
415
|
-
|
|
425
|
+
complete: R(() => [...h[0] || (h[0] = [
|
|
426
|
+
c("span", null, null, -1)
|
|
416
427
|
])]),
|
|
417
|
-
spinner:
|
|
418
|
-
|
|
428
|
+
spinner: R(() => [...h[1] || (h[1] = [
|
|
429
|
+
c("span", null, null, -1)
|
|
419
430
|
])]),
|
|
420
431
|
_: 1
|
|
421
432
|
}, 8, ["identifier"]),
|
|
422
|
-
(_(!0),
|
|
423
|
-
key:
|
|
424
|
-
item:
|
|
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
|
-
|
|
427
|
-
identifier:
|
|
428
|
-
onInfinite:
|
|
437
|
+
N(A(Q), {
|
|
438
|
+
identifier: g.value,
|
|
439
|
+
onInfinite: ie
|
|
429
440
|
}, {
|
|
430
|
-
complete:
|
|
431
|
-
E(
|
|
432
|
-
|
|
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
|
-
|
|
449
|
+
n.type_fetch === "pagination" ? E(i.$slots, "pagination", {
|
|
439
450
|
key: 2,
|
|
440
|
-
pagination:
|
|
451
|
+
pagination: a.value,
|
|
441
452
|
tradePage: b,
|
|
442
|
-
error: A(
|
|
453
|
+
error: A(o)
|
|
443
454
|
}, () => [
|
|
444
|
-
!A(
|
|
455
|
+
!A(o) && a.value.count > 0 ? (_(), f("div", {
|
|
445
456
|
key: 0,
|
|
446
|
-
class:
|
|
457
|
+
class: V(["px-3", e.class_pagination])
|
|
447
458
|
}, [
|
|
448
|
-
|
|
459
|
+
N(je, {
|
|
449
460
|
filtering: !0,
|
|
450
|
-
pagination:
|
|
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
|
-
}),
|
|
468
|
+
}), Ue = /* @__PURE__ */ X(Oe, [["__scopeId", "data-v-fac17d89"]]);
|
|
458
469
|
export {
|
|
459
|
-
|
|
470
|
+
Ue as VDataPage
|
|
460
471
|
};
|