vs-datatable 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +734 -2
- package/dist/index.css +1 -1
- package/dist/vs-datatable.es.js +334 -340
- package/dist/vs-datatable.umd.js +2 -21
- package/package.json +2 -5
- package/src/styles/base.scss +416 -0
- package/src/styles/bootstrap.scss +6 -6
- package/src/styles/index.scss +2 -2
- package/src/styles/themes.scss +215 -0
- package/src/styles/vs-datatable.scss +0 -40
package/dist/vs-datatable.es.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import './index.css';const
|
|
3
|
-
key: 0,
|
|
4
|
-
class: "page-item d-flex"
|
|
5
|
-
}, ie = {
|
|
6
|
-
key: 0,
|
|
7
|
-
class: "page-link disabled"
|
|
8
|
-
}, de = ["id", "onClick"], ce = {
|
|
1
|
+
import { defineComponent as K, computed as v, createElementBlock as n, openBlock as r, createElementVNode as o, createCommentVNode as k, Fragment as M, renderList as D, normalizeClass as w, toDisplayString as b, useAttrs as W, ref as I, watch as X, createVNode as Z, renderSlot as _, normalizeStyle as Y, withModifiers as ee, withDirectives as te, vModelCheckbox as se, createTextVNode as ae } from "vue";
|
|
2
|
+
import './index.css';const le = ["id"], oe = ["disabled"], ne = {
|
|
9
3
|
key: 1,
|
|
10
|
-
class: "
|
|
11
|
-
},
|
|
12
|
-
key:
|
|
13
|
-
class: "
|
|
14
|
-
},
|
|
4
|
+
class: "vs-pagination-ellipsis"
|
|
5
|
+
}, re = ["id", "onClick"], ie = {
|
|
6
|
+
key: 2,
|
|
7
|
+
class: "vs-pagination-ellipsis"
|
|
8
|
+
}, de = ["disabled"], ce = /* @__PURE__ */ K({
|
|
15
9
|
__name: "VsPagination",
|
|
16
10
|
props: {
|
|
17
11
|
modelValue: {},
|
|
@@ -22,170 +16,124 @@ import './index.css';const ae = { ref: "vsPagination" }, oe = ["id"], le = { cla
|
|
|
22
16
|
paginationClass: {}
|
|
23
17
|
},
|
|
24
18
|
emits: ["update:modelValue", "page-changed"],
|
|
25
|
-
setup(
|
|
26
|
-
const
|
|
27
|
-
get: () =>
|
|
28
|
-
set: (
|
|
29
|
-
c("update:modelValue",
|
|
19
|
+
setup(l, { emit: C }) {
|
|
20
|
+
const s = l, c = C, g = s.maxVisible ?? 3, d = v({
|
|
21
|
+
get: () => s.modelValue,
|
|
22
|
+
set: (p) => {
|
|
23
|
+
c("update:modelValue", p), c("page-changed", p);
|
|
30
24
|
}
|
|
31
|
-
}), x =
|
|
32
|
-
const
|
|
33
|
-
for (let
|
|
34
|
-
|
|
35
|
-
return
|
|
36
|
-
}), V = (
|
|
37
|
-
|
|
38
|
-
},
|
|
25
|
+
}), x = v(() => d.value <= Math.floor(g / 2) ? 1 : d.value >= f.value - Math.floor(g / 2) ? Math.max(f.value - g + 1, 1) : d.value - Math.floor(g / 2)), y = v(() => Math.min(x.value + g - 1, f.value)), f = v(() => Math.ceil(s.totalRecords / s.rowsPerPage)), $ = v(() => {
|
|
26
|
+
const p = [];
|
|
27
|
+
for (let h = x.value; h <= y.value; h++)
|
|
28
|
+
p.push(h);
|
|
29
|
+
return p;
|
|
30
|
+
}), V = (p) => {
|
|
31
|
+
p >= 1 && p <= f.value && (d.value = p);
|
|
32
|
+
}, O = () => {
|
|
39
33
|
d.value > 1 && d.value--;
|
|
40
|
-
},
|
|
41
|
-
d.value <
|
|
34
|
+
}, R = () => {
|
|
35
|
+
d.value < f.value && d.value++;
|
|
42
36
|
};
|
|
43
|
-
return (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
37
|
+
return (p, h) => (r(), n("div", {
|
|
38
|
+
class: "vs-pagination",
|
|
39
|
+
id: l.tablename + "-pagination"
|
|
40
|
+
}, [
|
|
41
|
+
o("button", {
|
|
42
|
+
onClick: O,
|
|
43
|
+
type: "button",
|
|
44
|
+
class: "vs-pagination-button vs-pagination-nav",
|
|
45
|
+
disabled: d.value === 1
|
|
46
|
+
}, " ‹‹ ", 8, oe),
|
|
47
|
+
x.value > 1 ? (r(), n("button", {
|
|
48
|
+
key: 0,
|
|
49
|
+
type: "button",
|
|
50
|
+
class: "vs-pagination-button",
|
|
51
|
+
onClick: h[0] || (h[0] = (m) => V(1))
|
|
52
|
+
}, " 1 ")) : k("", !0),
|
|
53
|
+
x.value > 2 ? (r(), n("span", ne, "...")) : k("", !0),
|
|
54
|
+
(r(!0), n(M, null, D($.value, (m) => (r(), n("button", {
|
|
55
|
+
key: m,
|
|
56
|
+
type: "button",
|
|
57
|
+
class: w([
|
|
58
|
+
"vs-pagination-button",
|
|
59
|
+
{ "vs-active": d.value === m }
|
|
55
60
|
]),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}, y(_), 11, de)
|
|
74
|
-
]))), 128)),
|
|
75
|
-
$.value < u.value ? (r(), i("li", ce, [
|
|
76
|
-
$.value < u.value - 1 ? (r(), i("span", ue, "...")) : k("", !0),
|
|
77
|
-
o("button", {
|
|
78
|
-
type: "button",
|
|
79
|
-
class: "page-link",
|
|
80
|
-
onClick: g[1] || (g[1] = (_) => V(u.value))
|
|
81
|
-
}, y(u.value), 1)
|
|
82
|
-
])) : k("", !0),
|
|
83
|
-
o("li", pe, [
|
|
84
|
-
o("button", {
|
|
85
|
-
onClick: C,
|
|
86
|
-
type: "button",
|
|
87
|
-
class: w([e.tablename + "-paginate-navigators page-link", { disabled: d.value === u.value }]),
|
|
88
|
-
disabled: d.value === u.value
|
|
89
|
-
}, " >> ", 10, ve)
|
|
90
|
-
])
|
|
91
|
-
], 8, oe)
|
|
92
|
-
], 512));
|
|
61
|
+
id: l.tablename + "-page-" + m,
|
|
62
|
+
onClick: (N) => V(m)
|
|
63
|
+
}, b(m), 11, re))), 128)),
|
|
64
|
+
y.value < f.value - 1 ? (r(), n("span", ie, "...")) : k("", !0),
|
|
65
|
+
y.value < f.value ? (r(), n("button", {
|
|
66
|
+
key: 3,
|
|
67
|
+
type: "button",
|
|
68
|
+
class: "vs-pagination-button",
|
|
69
|
+
onClick: h[1] || (h[1] = (m) => V(f.value))
|
|
70
|
+
}, b(f.value), 1)) : k("", !0),
|
|
71
|
+
o("button", {
|
|
72
|
+
onClick: R,
|
|
73
|
+
type: "button",
|
|
74
|
+
class: "vs-pagination-button vs-pagination-nav",
|
|
75
|
+
disabled: d.value === f.value
|
|
76
|
+
}, " ›› ", 8, de)
|
|
77
|
+
], 8, le));
|
|
93
78
|
}
|
|
94
|
-
}),
|
|
95
|
-
const
|
|
96
|
-
for (const [c,
|
|
97
|
-
|
|
98
|
-
return
|
|
99
|
-
},
|
|
79
|
+
}), j = (l, C) => {
|
|
80
|
+
const s = l.__vccOpts || l;
|
|
81
|
+
for (const [c, g] of C)
|
|
82
|
+
s[c] = g;
|
|
83
|
+
return s;
|
|
84
|
+
}, ue = /* @__PURE__ */ j(ce, [["__scopeId", "data-v-a6d89ca2"]]), ve = { class: "vs-search" }, he = ["placeholder", "value"], pe = /* @__PURE__ */ K({
|
|
100
85
|
__name: "VsSearch",
|
|
101
86
|
props: {
|
|
102
87
|
modelValue: {},
|
|
103
88
|
placeholder: {}
|
|
104
89
|
},
|
|
105
90
|
emits: ["update:modelValue", "input-typed"],
|
|
106
|
-
setup(
|
|
107
|
-
const
|
|
108
|
-
const d =
|
|
109
|
-
|
|
91
|
+
setup(l, { emit: C }) {
|
|
92
|
+
const s = C, c = (g) => {
|
|
93
|
+
const d = g.target;
|
|
94
|
+
s("update:modelValue", d.value), s("input-typed", d.value);
|
|
110
95
|
};
|
|
111
|
-
return (
|
|
112
|
-
o("div",
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
96
|
+
return (g, d) => (r(), n("div", ve, [
|
|
97
|
+
d[0] || (d[0] = o("div", { class: "vs-search-icon" }, [
|
|
98
|
+
o("svg", {
|
|
99
|
+
viewBox: "0 0 24 24",
|
|
100
|
+
fill: "currentColor"
|
|
116
101
|
}, [
|
|
117
|
-
o("
|
|
118
|
-
]
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
]));
|
|
128
|
-
}
|
|
129
|
-
}), ke = /* @__PURE__ */ H({
|
|
130
|
-
__name: "Loader",
|
|
131
|
-
props: {
|
|
132
|
-
height: { default: "50px" }
|
|
133
|
-
},
|
|
134
|
-
setup(e) {
|
|
135
|
-
return (b, t) => (r(), i("div", null, [
|
|
136
|
-
o("div", {
|
|
137
|
-
class: "loader",
|
|
138
|
-
style: E({ height: e.height })
|
|
139
|
-
}, null, 4)
|
|
102
|
+
o("path", { d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" })
|
|
103
|
+
])
|
|
104
|
+
], -1)),
|
|
105
|
+
o("input", {
|
|
106
|
+
type: "text",
|
|
107
|
+
class: "vs-search-input",
|
|
108
|
+
placeholder: l.placeholder,
|
|
109
|
+
value: l.modelValue,
|
|
110
|
+
onInput: c
|
|
111
|
+
}, null, 40, he)
|
|
140
112
|
]));
|
|
141
113
|
}
|
|
142
|
-
}),
|
|
143
|
-
<svg width="60pt" height="60pt" id="Layer__${e}" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 70 70">
|
|
144
|
-
<defs>
|
|
145
|
-
<linearGradient id="no-data__rfq_${e}" x1="40.1" y1="64.17" x2="40.1" y2="5.83" gradientUnits="userSpaceOnUse">
|
|
146
|
-
<stop offset="0" stop-color="#969698" stop-opacity="0.1" />
|
|
147
|
-
<stop offset="1" stop-color="#869ac0" stop-opacity="0.25" />
|
|
148
|
-
</linearGradient>
|
|
149
|
-
<linearGradient id="no-data__rfq-2_${e}" x1="176.51" y1="-169.09" x2="196.67" y2="-169.09" gradientTransform="matrix(0.73, 0, 0, -0.73, -125.67, -73.17)" gradientUnits="userSpaceOnUse">
|
|
150
|
-
<stop offset="0" stop-color="#969698" />
|
|
151
|
-
<stop offset="1" stop-color="#869ac0" />
|
|
152
|
-
</linearGradient>
|
|
153
|
-
<linearGradient id="no-data__rfq-3_${e}" x1="187.34" y1="-148.34" x2="227.34" y2="-148.34" xlink:href="#no-data__rfq-2_${e}" />
|
|
154
|
-
</defs>
|
|
155
|
-
<path d="M61.25,20.42H46.67V5.83Z" fill="#929aa5" opacity="0.5" style="isolation:isolate" />
|
|
156
|
-
<path d="M19,5.83H46.67L61.25,20.42V64.17H19ZM54,27H26.25V29.9H54Zm0,6.56H26.25v2.92H54ZM26.25,40.1H54V43H26.25Zm0,6.57H54v2.91H26.25Z" fill-rule="evenodd" fill="url(#no-data__rfq_${e})" />
|
|
157
|
-
<path d="M3,53.35,13.62,42.78l4.12,4.13L7.17,57.48,3,53.35Z" fill-rule="evenodd" fill="url(#no-data__rfq-2_${e})" />
|
|
158
|
-
<path d="M37.19,35A11.67,11.67,0,1,0,25.52,46.67,11.68,11.68,0,0,0,37.19,35Zm2.91,0A14.58,14.58,0,1,0,25.52,49.58,14.58,14.58,0,0,0,40.1,35Z" fill-rule="evenodd" fill="url(#no-data__rfq-3_${e})" />
|
|
159
|
-
</svg>
|
|
160
|
-
<div class="fs-5 fw-700 text-fmdqgray">${b}</div>
|
|
161
|
-
`, we = { class: "card-body p-4 vs-table-card-body" }, $e = {
|
|
114
|
+
}), ge = { class: "vs-datatable" }, fe = {
|
|
162
115
|
key: 0,
|
|
163
|
-
class: "
|
|
164
|
-
},
|
|
116
|
+
class: "vs-search-container"
|
|
117
|
+
}, be = {
|
|
165
118
|
ref: "tableResponsiveRef",
|
|
166
|
-
class: "table-
|
|
167
|
-
},
|
|
119
|
+
class: "vs-table-wrapper"
|
|
120
|
+
}, me = {
|
|
168
121
|
key: 0,
|
|
122
|
+
class: "vs-checkbox-column",
|
|
169
123
|
style: { width: "5%" }
|
|
170
|
-
},
|
|
124
|
+
}, we = { class: "vs-checkbox" }, ye = ["id", "checked"], ke = ["for"], Ce = ["onClick"], xe = { class: "vs-header-content" }, Ve = { class: "vs-header-label" }, Pe = {
|
|
171
125
|
key: 0,
|
|
172
|
-
class: "sort-
|
|
173
|
-
},
|
|
126
|
+
class: "vs-sort-icons"
|
|
127
|
+
}, Se = {
|
|
174
128
|
key: 1,
|
|
175
|
-
class: "
|
|
176
|
-
},
|
|
177
|
-
colspan: "100%",
|
|
178
|
-
class: "text-center"
|
|
179
|
-
}, qe = { key: 1 }, Ue = {
|
|
180
|
-
colspan: "100%",
|
|
181
|
-
class: "text-center"
|
|
182
|
-
}, Ae = ["innerHTML"], De = ["onClick"], Ge = { class: "form-check mb-2px" }, Ne = ["id", "value"], ze = ["for"], Ee = { class: "d-md-flex align-items-center mt-1" }, je = {
|
|
129
|
+
class: "vs-sort-priority"
|
|
130
|
+
}, $e = { key: 0 }, Oe = ["colspan"], Re = { key: 1 }, Te = ["colspan"], Ie = { class: "vs-no-data-message" }, _e = { class: "vs-no-data-description" }, Me = ["onClick"], De = { class: "vs-checkbox" }, Be = ["id", "value"], Le = ["for"], ze = { class: "vs-table-footer" }, He = {
|
|
183
131
|
key: 0,
|
|
184
|
-
class: "
|
|
185
|
-
},
|
|
132
|
+
class: "vs-table-info"
|
|
133
|
+
}, Ke = {
|
|
186
134
|
key: 1,
|
|
187
|
-
class: "
|
|
188
|
-
},
|
|
135
|
+
class: "vs-table-info"
|
|
136
|
+
}, Ne = /* @__PURE__ */ K({
|
|
189
137
|
__name: "VsDataTable",
|
|
190
138
|
props: {
|
|
191
139
|
rows: { default: () => [] },
|
|
@@ -201,207 +149,253 @@ import './index.css';const ae = { ref: "vsPagination" }, oe = ["id"], le = { cla
|
|
|
201
149
|
showSearch: { type: Boolean, default: !0 },
|
|
202
150
|
tableClass: {},
|
|
203
151
|
rowClass: {},
|
|
204
|
-
showRowEntries: { type: Boolean, default: !0 }
|
|
152
|
+
showRowEntries: { type: Boolean, default: !0 },
|
|
153
|
+
containerClass: {},
|
|
154
|
+
headerClass: {},
|
|
155
|
+
cellClass: {},
|
|
156
|
+
searchClass: {},
|
|
157
|
+
paginationClass: {},
|
|
158
|
+
searchPlaceholder: { default: "Search..." },
|
|
159
|
+
loadingText: { default: "Loading..." },
|
|
160
|
+
noDataText: { default: "No data available" },
|
|
161
|
+
noDataDescription: { default: "Try adjusting your search criteria" },
|
|
162
|
+
entriesText: { default: "entries" },
|
|
163
|
+
maxVisiblePages: { default: 5 },
|
|
164
|
+
rowKey: { type: [String, Function], default: "id" }
|
|
205
165
|
},
|
|
206
|
-
emits: ["update:itemSelected", "update:serverItemsLength", "update:serverOptions", "input-typed", "page-updated", "sort-changed", "row-click"],
|
|
207
|
-
setup(
|
|
208
|
-
const
|
|
209
|
-
function
|
|
210
|
-
return
|
|
166
|
+
emits: ["update:itemSelected", "update:serverItemsLength", "update:serverOptions", "update:sort", "input-typed", "page-updated", "sort-changed", "row-click"],
|
|
167
|
+
setup(l, { emit: C }) {
|
|
168
|
+
const s = l, c = C, g = W(), d = v(() => !!g.onRowClick), x = v(() => s.columns.length + (z.value ? 1 : 0)), y = (t, a) => typeof s.rowKey == "function" ? s.rowKey(t, a) : t[s.rowKey] || a, f = (t) => P.value.some((a) => y(a, -1) === y(t, -1));
|
|
169
|
+
function $(t, a) {
|
|
170
|
+
return a.split(".").reduce((e, i) => e?.[i], t) ?? "";
|
|
211
171
|
}
|
|
212
|
-
const
|
|
213
|
-
const
|
|
214
|
-
return
|
|
215
|
-
},
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
172
|
+
const V = (t) => h.value.some((a) => a.field === t), O = (t) => {
|
|
173
|
+
const a = h.value.find((e) => e.field === t);
|
|
174
|
+
return a ? a.priority ?? null : null;
|
|
175
|
+
}, R = (t) => h.value.find((a) => a.field === t)?.order ?? null, p = I(s.sort ?? []);
|
|
176
|
+
X(
|
|
177
|
+
() => s.sort,
|
|
178
|
+
(t) => {
|
|
179
|
+
t && (p.value = [...t]);
|
|
180
|
+
},
|
|
181
|
+
{ deep: !0 }
|
|
182
|
+
);
|
|
183
|
+
const h = v(() => s.serverOptions?.sort ?? p.value ?? []), m = v(() => {
|
|
184
|
+
if (!h.value.length) return s.rows;
|
|
185
|
+
const t = (a, e) => e.split(".").reduce((i, u) => i?.[u], a) ?? "";
|
|
186
|
+
return [...s.rows].sort((a, e) => {
|
|
187
|
+
for (const { field: i, order: u } of h.value) {
|
|
188
|
+
const S = t(a, i), H = t(e, i);
|
|
189
|
+
if (S !== H)
|
|
190
|
+
return u === "asc" ? S > H ? 1 : -1 : S < H ? 1 : -1;
|
|
224
191
|
}
|
|
225
192
|
return 0;
|
|
226
193
|
});
|
|
227
|
-
}),
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
t.serverOptions ? c("update:serverOptions", { ...t.serverOptions, rowsPerPage: s }) : g.value = s;
|
|
194
|
+
}), N = (t, a) => {
|
|
195
|
+
let e = [...h.value];
|
|
196
|
+
const i = e.findIndex((u) => u.field === t);
|
|
197
|
+
a.shiftKey ? i === -1 ? e.push({ field: t, order: "asc" }) : e[i]?.order === "asc" ? e[i].order = "desc" : e.splice(i, 1) : i === -1 ? e = [{ field: t, order: "asc" }] : e[i]?.order === "asc" ? e = [{ field: t, order: "desc" }] : e = [], e = e.map((u, S) => ({ ...u, priority: S + 1 })), s.serverOptions ? c("update:serverOptions", { ...s.serverOptions, sort: e }) : (p.value = e, c("update:sort", e), c("sort-changed", { sort: e }));
|
|
198
|
+
}, A = I(""), Q = (t) => c("input-typed", t), E = I(10), q = v({
|
|
199
|
+
get: () => s.serverOptions?.rowsPerPage ?? E.value,
|
|
200
|
+
set: (t) => {
|
|
201
|
+
s.serverOptions ? c("update:serverOptions", { ...s.serverOptions, rowsPerPage: t }) : E.value = t;
|
|
236
202
|
}
|
|
237
|
-
}),
|
|
238
|
-
get: () =>
|
|
239
|
-
set: (
|
|
240
|
-
|
|
203
|
+
}), U = I(1), B = v({
|
|
204
|
+
get: () => s.serverItemsLength !== void 0 ? s.serverItemsLength : s.rows.length,
|
|
205
|
+
set: (t) => {
|
|
206
|
+
s.serverItemsLength !== void 0 && c("update:serverItemsLength", t);
|
|
241
207
|
}
|
|
242
|
-
}),
|
|
243
|
-
get: () =>
|
|
244
|
-
set: (
|
|
245
|
-
|
|
208
|
+
}), T = v({
|
|
209
|
+
get: () => s.serverOptions?.page ?? U.value,
|
|
210
|
+
set: (t) => {
|
|
211
|
+
s.serverOptions ? c("update:serverOptions", { ...s.serverOptions, page: t }) : U.value = t;
|
|
246
212
|
}
|
|
247
|
-
}),
|
|
248
|
-
|
|
249
|
-
},
|
|
250
|
-
const
|
|
251
|
-
return { start:
|
|
252
|
-
}),
|
|
253
|
-
get: () =>
|
|
254
|
-
set: (
|
|
255
|
-
}),
|
|
256
|
-
|
|
213
|
+
}), G = (t) => {
|
|
214
|
+
s.serverOptions && c("update:serverOptions", { ...s.serverOptions, page: t }), c("page-updated", t);
|
|
215
|
+
}, L = v(() => {
|
|
216
|
+
const t = s.serverOptions?.rowsPerPage ?? 10, a = (T.value - 1) * t + 1, e = Math.min(T.value * t, B.value);
|
|
217
|
+
return { start: a, end: e };
|
|
218
|
+
}), P = v({
|
|
219
|
+
get: () => s.itemSelected || [],
|
|
220
|
+
set: (t) => c("update:itemSelected", t)
|
|
221
|
+
}), z = v(() => s.itemSelected !== null), F = v(
|
|
222
|
+
() => s.rows.length > 0 && P.value.length === s.rows.length
|
|
223
|
+
), J = () => {
|
|
224
|
+
P.value = F.value ? [] : [...s.rows];
|
|
257
225
|
};
|
|
258
|
-
return (
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
o("div", Se, [
|
|
290
|
-
o("input", {
|
|
291
|
-
type: "checkbox",
|
|
292
|
-
class: "form-check-input",
|
|
293
|
-
id: e.tablename + "-main-checkbox",
|
|
294
|
-
checked: z.value,
|
|
295
|
-
onChange: F
|
|
296
|
-
}, null, 40, Me),
|
|
297
|
-
o("label", {
|
|
298
|
-
class: "form-check-label pt-1px",
|
|
299
|
-
for: e.tablename + "-main-checkbox"
|
|
300
|
-
}, null, 8, Re)
|
|
301
|
-
])
|
|
302
|
-
])) : k("", !0),
|
|
303
|
-
(r(!0), i(R, null, L(e.columns, (a) => (r(), i("th", {
|
|
304
|
-
key: a.field,
|
|
305
|
-
onClick: (v) => a.sortable ? I(a.field, v) : null,
|
|
306
|
-
style: E({ width: a.width + "%", cursor: a.sortable ? "pointer" : "default" }),
|
|
307
|
-
class: "border-top-0 pt-0 pb-2"
|
|
308
|
-
}, [
|
|
309
|
-
M(s.$slots, `header-${a.field}`, {}, () => [
|
|
310
|
-
o("div", He, [
|
|
311
|
-
o("span", null, y(a.label), 1),
|
|
312
|
-
a.sortable ? (r(), i("span", Ie, [
|
|
313
|
-
o("i", {
|
|
314
|
-
class: w(["fa fa-sort-up sort-icon", { "active-asc": $(a.field) && P(a.field) === "asc" }])
|
|
315
|
-
}, null, 2),
|
|
316
|
-
o("i", {
|
|
317
|
-
class: w(["fa fa-sort-down sort-icon", { "active-desc": $(a.field) && P(a.field) === "desc" }])
|
|
318
|
-
}, null, 2)
|
|
319
|
-
])) : k("", !0),
|
|
320
|
-
u(a.field) !== null ? (r(), i("span", Te, y(u(a.field)), 1)) : k("", !0)
|
|
321
|
-
])
|
|
322
|
-
], !0)
|
|
323
|
-
], 12, Le))), 128))
|
|
226
|
+
return (t, a) => (r(), n("div", ge, [
|
|
227
|
+
l.showSearch ? (r(), n("div", fe, [
|
|
228
|
+
Z(pe, {
|
|
229
|
+
modelValue: A.value,
|
|
230
|
+
"onUpdate:modelValue": a[0] || (a[0] = (e) => A.value = e),
|
|
231
|
+
onInputTyped: Q,
|
|
232
|
+
placeholder: l.searchPlaceholder,
|
|
233
|
+
class: w(l.searchClass)
|
|
234
|
+
}, null, 8, ["modelValue", "placeholder", "class"]),
|
|
235
|
+
_(t.$slots, "filterArea", {}, void 0, !0)
|
|
236
|
+
])) : k("", !0),
|
|
237
|
+
o("div", {
|
|
238
|
+
class: w(["vs-table-container", l.containerClass])
|
|
239
|
+
}, [
|
|
240
|
+
o("div", be, [
|
|
241
|
+
o("table", {
|
|
242
|
+
class: w(["vs-table", l.tableClass])
|
|
243
|
+
}, [
|
|
244
|
+
o("thead", null, [
|
|
245
|
+
o("tr", null, [
|
|
246
|
+
z.value ? (r(), n("th", me, [
|
|
247
|
+
o("div", we, [
|
|
248
|
+
o("input", {
|
|
249
|
+
type: "checkbox",
|
|
250
|
+
id: l.tablename + "-main-checkbox",
|
|
251
|
+
checked: F.value,
|
|
252
|
+
onChange: J
|
|
253
|
+
}, null, 40, ye),
|
|
254
|
+
o("label", {
|
|
255
|
+
for: l.tablename + "-main-checkbox"
|
|
256
|
+
}, null, 8, ke)
|
|
324
257
|
])
|
|
325
|
-
]),
|
|
326
|
-
|
|
327
|
-
e.
|
|
328
|
-
|
|
329
|
-
|
|
258
|
+
])) : k("", !0),
|
|
259
|
+
(r(!0), n(M, null, D(l.columns, (e) => (r(), n("th", {
|
|
260
|
+
key: e.field,
|
|
261
|
+
onClick: (i) => e.sortable ? N(e.field, i) : null,
|
|
262
|
+
style: Y({ width: e.width + "%" }),
|
|
263
|
+
class: w([e.sortable ? "vs-sortable" : "", l.headerClass])
|
|
264
|
+
}, [
|
|
265
|
+
_(t.$slots, `header-${e.field}`, { column: e }, () => [
|
|
266
|
+
o("div", xe, [
|
|
267
|
+
o("span", Ve, b(e.label), 1),
|
|
268
|
+
e.sortable ? (r(), n("div", Pe, [
|
|
269
|
+
o("span", {
|
|
270
|
+
class: w(["vs-sort-icon vs-sort-asc", {
|
|
271
|
+
"vs-active": V(e.field) && R(e.field) === "asc"
|
|
272
|
+
}])
|
|
273
|
+
}, [...a[4] || (a[4] = [
|
|
274
|
+
o("svg", {
|
|
275
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
276
|
+
height: "24px",
|
|
277
|
+
viewBox: "0 -960 960 960",
|
|
278
|
+
width: "24px"
|
|
279
|
+
}, [
|
|
280
|
+
o("path", { d: "m280-400 200-200 200 200H280Z" })
|
|
281
|
+
], -1)
|
|
282
|
+
])], 2),
|
|
283
|
+
o("span", {
|
|
284
|
+
class: w(["vs-sort-icon vs-sort-desc", {
|
|
285
|
+
"vs-active": V(e.field) && R(e.field) === "desc"
|
|
286
|
+
}])
|
|
287
|
+
}, [...a[5] || (a[5] = [
|
|
288
|
+
o("svg", {
|
|
289
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
290
|
+
height: "24px",
|
|
291
|
+
viewBox: "0 -960 960 960",
|
|
292
|
+
width: "24px"
|
|
293
|
+
}, [
|
|
294
|
+
o("path", { d: "M480-360 280-560h400L480-360Z" })
|
|
295
|
+
], -1)
|
|
296
|
+
])], 2)
|
|
297
|
+
])) : k("", !0),
|
|
298
|
+
O(e.field) !== null ? (r(), n("span", Se, b(O(e.field)), 1)) : k("", !0)
|
|
330
299
|
])
|
|
331
|
-
]
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
300
|
+
], !0)
|
|
301
|
+
], 14, Ce))), 128))
|
|
302
|
+
])
|
|
303
|
+
]),
|
|
304
|
+
o("tbody", null, [
|
|
305
|
+
l.loading ? (r(), n("tr", $e, [
|
|
306
|
+
o("td", {
|
|
307
|
+
colspan: x.value,
|
|
308
|
+
class: "vs-loading"
|
|
309
|
+
}, [
|
|
310
|
+
a[6] || (a[6] = o("div", { class: "vs-spinner" }, null, -1)),
|
|
311
|
+
o("span", null, b(l.loadingText), 1)
|
|
312
|
+
], 8, Oe)
|
|
313
|
+
])) : m.value.length ? (r(!0), n(M, { key: 2 }, D(m.value, (e, i) => (r(), n("tr", {
|
|
314
|
+
key: y(e, i),
|
|
315
|
+
class: w([
|
|
316
|
+
l.rowClass,
|
|
317
|
+
{ "vs-row-clickable": d.value },
|
|
318
|
+
{ "vs-row-selected": f(e) }
|
|
319
|
+
]),
|
|
320
|
+
onClick: (u) => t.$emit("row-click", e, i)
|
|
321
|
+
}, [
|
|
322
|
+
z.value ? (r(), n("td", {
|
|
323
|
+
key: 0,
|
|
324
|
+
onClick: a[2] || (a[2] = ee(() => {
|
|
325
|
+
}, ["stop"])),
|
|
326
|
+
class: "vs-checkbox-column"
|
|
327
|
+
}, [
|
|
328
|
+
o("div", De, [
|
|
329
|
+
te(o("input", {
|
|
330
|
+
type: "checkbox",
|
|
331
|
+
id: l.tablename + "-checkbox-" + y(e, i),
|
|
332
|
+
value: e,
|
|
333
|
+
"onUpdate:modelValue": a[1] || (a[1] = (u) => P.value = u)
|
|
334
|
+
}, null, 8, Be), [
|
|
335
|
+
[se, P.value]
|
|
336
|
+
]),
|
|
337
|
+
o("label", {
|
|
338
|
+
for: l.tablename + "-checkbox-" + y(e, i)
|
|
339
|
+
}, null, 8, Le)
|
|
340
|
+
])
|
|
341
|
+
])) : k("", !0),
|
|
342
|
+
(r(!0), n(M, null, D(l.columns, (u) => (r(), n("td", {
|
|
343
|
+
key: u.field,
|
|
344
|
+
class: w(l.cellClass)
|
|
345
|
+
}, [
|
|
346
|
+
_(t.$slots, `cell-${u.field}`, {
|
|
347
|
+
item: e,
|
|
348
|
+
value: $(e, u.field),
|
|
349
|
+
column: u,
|
|
350
|
+
index: i
|
|
351
|
+
}, () => [
|
|
352
|
+
ae(b($(e, u.field)), 1)
|
|
353
|
+
], !0)
|
|
354
|
+
], 2))), 128))
|
|
355
|
+
], 10, Me))), 128)) : (r(), n("tr", Re, [
|
|
356
|
+
o("td", {
|
|
357
|
+
colspan: x.value,
|
|
358
|
+
class: "vs-no-data"
|
|
359
|
+
}, [
|
|
360
|
+
_(t.$slots, "no-data", {}, () => [
|
|
361
|
+
a[7] || (a[7] = o("div", { class: "vs-no-data-icon" }, [
|
|
362
|
+
o("svg", {
|
|
363
|
+
viewBox: "0 0 24 24",
|
|
364
|
+
fill: "currentColor"
|
|
365
|
+
}, [
|
|
366
|
+
o("path", { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z" })
|
|
355
367
|
])
|
|
356
|
-
]
|
|
357
|
-
(
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
item: a,
|
|
363
|
-
value: x(a, f.field)
|
|
364
|
-
}, () => [
|
|
365
|
-
se(y(x(a, f.field)), 1)
|
|
366
|
-
], !0)
|
|
367
|
-
]))), 128))
|
|
368
|
-
], 10, De))), 128)) : (r(), i("tr", qe, [
|
|
369
|
-
o("td", Ue, [
|
|
370
|
-
M(s.$slots, "no-data", {}, () => [
|
|
371
|
-
o("div", {
|
|
372
|
-
innerHTML: X(xe)("vs-table-no_data", "No data available")
|
|
373
|
-
}, null, 8, Ae)
|
|
374
|
-
], !0)
|
|
375
|
-
])
|
|
376
|
-
]))
|
|
377
|
-
])
|
|
378
|
-
], 2)
|
|
379
|
-
], 512),
|
|
380
|
-
o("div", Ee, [
|
|
381
|
-
e.showRowEntries ? (r(), i("div", je, " Showing " + y(Z.value.start < 1 ? 0 : Z.value.start) + " to " + y(Z.value.end) + " of " + y(B.value) + " entries ", 1)) : (r(), i("div", Fe)),
|
|
382
|
-
D(he, {
|
|
383
|
-
modelValue: O.value,
|
|
384
|
-
"onUpdate:modelValue": l[3] || (l[3] = (a) => O.value = a),
|
|
385
|
-
totalRecords: B.value,
|
|
386
|
-
rowsPerPage: _.value,
|
|
387
|
-
maxVisible: 3,
|
|
388
|
-
tablename: e.tablename,
|
|
389
|
-
class: "text-center",
|
|
390
|
-
onPageChanged: j
|
|
391
|
-
}, null, 8, ["modelValue", "totalRecords", "rowsPerPage", "tablename"])
|
|
368
|
+
], -1)),
|
|
369
|
+
o("div", Ie, b(l.noDataText), 1),
|
|
370
|
+
o("div", _e, b(l.noDataDescription), 1)
|
|
371
|
+
], !0)
|
|
372
|
+
], 8, Te)
|
|
373
|
+
]))
|
|
392
374
|
])
|
|
393
|
-
])
|
|
394
|
-
])
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
375
|
+
], 2)
|
|
376
|
+
], 512)
|
|
377
|
+
], 2),
|
|
378
|
+
o("div", ze, [
|
|
379
|
+
l.showRowEntries ? (r(), n("div", He, "showing " + b(L.value.start < 1 ? 0 : L.value.start) + " - " + b(L.value.end) + " of " + b(B.value) + " " + b(l.entriesText), 1)) : (r(), n("div", Ke)),
|
|
380
|
+
Z(ue, {
|
|
381
|
+
modelValue: T.value,
|
|
382
|
+
"onUpdate:modelValue": a[3] || (a[3] = (e) => T.value = e),
|
|
383
|
+
totalRecords: B.value,
|
|
384
|
+
rowsPerPage: q.value,
|
|
385
|
+
maxVisible: l.maxVisiblePages,
|
|
386
|
+
tablename: l.tablename,
|
|
387
|
+
class: w(l.paginationClass),
|
|
388
|
+
onPageChanged: G
|
|
389
|
+
}, null, 8, ["modelValue", "totalRecords", "rowsPerPage", "maxVisible", "tablename", "class"])
|
|
390
|
+
])
|
|
391
|
+
]));
|
|
398
392
|
}
|
|
399
|
-
}),
|
|
400
|
-
install(
|
|
401
|
-
|
|
393
|
+
}), Ae = /* @__PURE__ */ j(Ne, [["__scopeId", "data-v-73862aa1"]]), Ue = {
|
|
394
|
+
install(l) {
|
|
395
|
+
l.component("VsDataTable", Ae);
|
|
402
396
|
}
|
|
403
397
|
};
|
|
404
398
|
export {
|
|
405
|
-
|
|
406
|
-
|
|
399
|
+
Ae as VsDataTable,
|
|
400
|
+
Ue as default
|
|
407
401
|
};
|