@oneb/ui-vue 0.2.20 → 0.2.22
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/dataTable/dataTable.d.ts +23 -7
- package/dist/dataTable/index.cjs +1 -1
- package/dist/dataTable/index.js +1 -1
- package/dist/dataTable/util.d.ts +4 -4
- package/dist/dropdown/index.cjs +1 -1
- package/dist/dropdown/index.js +1 -1
- package/dist/form/form.d.ts +8 -8
- package/dist/{index-cf1ac49c.cjs → index-0209cbf7.cjs} +1 -1
- package/dist/{index-6104c28e.js → index-36b9a57c.js} +4 -4
- package/dist/index-69599314.cjs +1 -0
- package/dist/index-8091f421.js +852 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +16 -12
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/index-b101fe42.js +0 -796
- package/dist/index-bf8920c1.cjs +0 -1
package/dist/index-b101fe42.js
DELETED
|
@@ -1,796 +0,0 @@
|
|
|
1
|
-
import { openBlock as l, createElementBlock as n, createElementVNode as c, defineComponent as D, computed as f, normalizeClass as g, toDisplayString as S, Fragment as R, renderList as B, createCommentVNode as y, createBlock as m, resolveDynamicComponent as k, unref as p, useSlots as be, ref as z, provide as Ee, watch as T, withDirectives as ze, renderSlot as F, vShow as Be, normalizeStyle as de, createTextVNode as J, withModifiers as ue, createVNode as je, inject as Ne, onBeforeUnmount as Ke } from "vue";
|
|
2
|
-
import { b as ve, r as Ae, a as pe } from "./ChevronRightIcon-8df1af46.js";
|
|
3
|
-
import { S as ce } from "./SpinnerIcon-24e552a8.js";
|
|
4
|
-
function fe(a, d) {
|
|
5
|
-
return l(), n("svg", {
|
|
6
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
7
|
-
fill: "none",
|
|
8
|
-
viewBox: "0 0 24 24",
|
|
9
|
-
"stroke-width": "1.8",
|
|
10
|
-
stroke: "currentColor",
|
|
11
|
-
"aria-hidden": "true"
|
|
12
|
-
}, [
|
|
13
|
-
c("path", {
|
|
14
|
-
"stroke-linecap": "round",
|
|
15
|
-
"stroke-linejoin": "round",
|
|
16
|
-
d: "M4.5 12.75l6 6 9-13.5"
|
|
17
|
-
})
|
|
18
|
-
]);
|
|
19
|
-
}
|
|
20
|
-
function Te(a, d) {
|
|
21
|
-
return l(), n("svg", {
|
|
22
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
23
|
-
fill: "none",
|
|
24
|
-
viewBox: "0 0 24 24",
|
|
25
|
-
"stroke-width": "1.8",
|
|
26
|
-
stroke: "currentColor",
|
|
27
|
-
"aria-hidden": "true"
|
|
28
|
-
}, [
|
|
29
|
-
c("path", {
|
|
30
|
-
"stroke-linecap": "round",
|
|
31
|
-
"stroke-linejoin": "round",
|
|
32
|
-
d: "M15.75 19.5L8.25 12l7.5-7.5"
|
|
33
|
-
})
|
|
34
|
-
]);
|
|
35
|
-
}
|
|
36
|
-
function ye(a, d) {
|
|
37
|
-
return l(), n("svg", {
|
|
38
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
39
|
-
fill: "none",
|
|
40
|
-
viewBox: "0 0 24 24",
|
|
41
|
-
"stroke-width": "1.8",
|
|
42
|
-
stroke: "currentColor",
|
|
43
|
-
"aria-hidden": "true"
|
|
44
|
-
}, [
|
|
45
|
-
c("path", {
|
|
46
|
-
"stroke-linecap": "round",
|
|
47
|
-
"stroke-linejoin": "round",
|
|
48
|
-
d: "M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9"
|
|
49
|
-
})
|
|
50
|
-
]);
|
|
51
|
-
}
|
|
52
|
-
const Ve = {
|
|
53
|
-
field: {
|
|
54
|
-
type: String,
|
|
55
|
-
required: !1
|
|
56
|
-
},
|
|
57
|
-
header: {
|
|
58
|
-
type: String,
|
|
59
|
-
required: !1
|
|
60
|
-
},
|
|
61
|
-
sortable: {
|
|
62
|
-
type: Boolean,
|
|
63
|
-
default: !1
|
|
64
|
-
},
|
|
65
|
-
sortField: {
|
|
66
|
-
type: String,
|
|
67
|
-
required: !1
|
|
68
|
-
},
|
|
69
|
-
filterable: {
|
|
70
|
-
type: Boolean,
|
|
71
|
-
default: !1
|
|
72
|
-
},
|
|
73
|
-
filterField: {
|
|
74
|
-
type: String,
|
|
75
|
-
required: !1
|
|
76
|
-
},
|
|
77
|
-
expander: {
|
|
78
|
-
type: Boolean,
|
|
79
|
-
default: !1
|
|
80
|
-
},
|
|
81
|
-
width: {
|
|
82
|
-
type: String,
|
|
83
|
-
required: !1
|
|
84
|
-
},
|
|
85
|
-
headerClass: {
|
|
86
|
-
type: String,
|
|
87
|
-
required: !1
|
|
88
|
-
},
|
|
89
|
-
bodyClass: {
|
|
90
|
-
type: String,
|
|
91
|
-
required: !1
|
|
92
|
-
},
|
|
93
|
-
headerStyle: {
|
|
94
|
-
type: [String, Object],
|
|
95
|
-
required: !1
|
|
96
|
-
},
|
|
97
|
-
bodyStyle: {
|
|
98
|
-
type: [String, Object],
|
|
99
|
-
required: !1
|
|
100
|
-
}
|
|
101
|
-
}, Ue = {
|
|
102
|
-
value: {
|
|
103
|
-
type: Array,
|
|
104
|
-
default: () => []
|
|
105
|
-
},
|
|
106
|
-
dataKey: {
|
|
107
|
-
type: String,
|
|
108
|
-
required: !1
|
|
109
|
-
},
|
|
110
|
-
lazy: {
|
|
111
|
-
type: Boolean,
|
|
112
|
-
default: !1
|
|
113
|
-
},
|
|
114
|
-
paginator: {
|
|
115
|
-
type: Boolean,
|
|
116
|
-
default: !1
|
|
117
|
-
},
|
|
118
|
-
rows: {
|
|
119
|
-
type: Number,
|
|
120
|
-
default: 10
|
|
121
|
-
},
|
|
122
|
-
first: {
|
|
123
|
-
type: Number,
|
|
124
|
-
default: 0
|
|
125
|
-
},
|
|
126
|
-
totalRecords: {
|
|
127
|
-
type: Number,
|
|
128
|
-
required: !1
|
|
129
|
-
},
|
|
130
|
-
rowsPerPageOptions: {
|
|
131
|
-
type: Array,
|
|
132
|
-
default: () => [10, 25, 50, 100]
|
|
133
|
-
},
|
|
134
|
-
sortField: {
|
|
135
|
-
type: String,
|
|
136
|
-
required: !1
|
|
137
|
-
},
|
|
138
|
-
sortOrder: {
|
|
139
|
-
type: Number,
|
|
140
|
-
default: null
|
|
141
|
-
},
|
|
142
|
-
selectionMode: {
|
|
143
|
-
type: String,
|
|
144
|
-
required: !1
|
|
145
|
-
},
|
|
146
|
-
selection: {
|
|
147
|
-
type: [Object, Array],
|
|
148
|
-
required: !1
|
|
149
|
-
},
|
|
150
|
-
expandedRows: {
|
|
151
|
-
type: [Array, Object],
|
|
152
|
-
default: () => []
|
|
153
|
-
},
|
|
154
|
-
filters: {
|
|
155
|
-
type: Object,
|
|
156
|
-
required: !1
|
|
157
|
-
},
|
|
158
|
-
filterDisplay: {
|
|
159
|
-
type: String,
|
|
160
|
-
default: null
|
|
161
|
-
},
|
|
162
|
-
globalFilterFields: {
|
|
163
|
-
type: Array,
|
|
164
|
-
required: !1
|
|
165
|
-
},
|
|
166
|
-
loading: {
|
|
167
|
-
type: Boolean,
|
|
168
|
-
default: !1
|
|
169
|
-
},
|
|
170
|
-
emptyMessage: {
|
|
171
|
-
type: String,
|
|
172
|
-
default: "No records found"
|
|
173
|
-
},
|
|
174
|
-
striped: {
|
|
175
|
-
type: Boolean,
|
|
176
|
-
default: !1
|
|
177
|
-
},
|
|
178
|
-
hoverable: {
|
|
179
|
-
type: Boolean,
|
|
180
|
-
default: !0
|
|
181
|
-
},
|
|
182
|
-
bordered: {
|
|
183
|
-
type: Boolean,
|
|
184
|
-
default: !1
|
|
185
|
-
},
|
|
186
|
-
size: {
|
|
187
|
-
type: String,
|
|
188
|
-
default: "md"
|
|
189
|
-
},
|
|
190
|
-
tableClass: {
|
|
191
|
-
type: String,
|
|
192
|
-
required: !1
|
|
193
|
-
},
|
|
194
|
-
hasNextPage: {
|
|
195
|
-
type: Boolean,
|
|
196
|
-
default: !1
|
|
197
|
-
},
|
|
198
|
-
loadingNext: {
|
|
199
|
-
type: Boolean,
|
|
200
|
-
default: !1
|
|
201
|
-
},
|
|
202
|
-
loadMoreLabel: {
|
|
203
|
-
type: String,
|
|
204
|
-
default: "Show more"
|
|
205
|
-
}
|
|
206
|
-
}, me = Symbol("OneDataTable"), ge = {
|
|
207
|
-
contains: (a, d) => String(a ?? "").toLowerCase().includes(String(d).toLowerCase()),
|
|
208
|
-
startsWith: (a, d) => String(a ?? "").toLowerCase().startsWith(String(d).toLowerCase()),
|
|
209
|
-
endsWith: (a, d) => String(a ?? "").toLowerCase().endsWith(String(d).toLowerCase()),
|
|
210
|
-
equals: (a, d) => String(a ?? "").toLowerCase() === String(d).toLowerCase(),
|
|
211
|
-
notEquals: (a, d) => String(a ?? "").toLowerCase() !== String(d).toLowerCase()
|
|
212
|
-
}, We = () => ["overflow-x-auto", "w-full", "border", "border-gray-100", "rounded"], He = (a) => {
|
|
213
|
-
const d = ["min-w-full", "border-collapse", "text-left", "relative"];
|
|
214
|
-
return a === "sm" ? d.push("text-xs") : a === "lg" ? d.push("text-base") : d.push("text-sm"), d;
|
|
215
|
-
}, Q = (a, d) => {
|
|
216
|
-
const t = [
|
|
217
|
-
"bg-gray-100",
|
|
218
|
-
"text-gray-600",
|
|
219
|
-
"font-semibold",
|
|
220
|
-
"text-xs",
|
|
221
|
-
"uppercase",
|
|
222
|
-
"tracking-wide",
|
|
223
|
-
"border-b",
|
|
224
|
-
"border-gray-200",
|
|
225
|
-
"whitespace-nowrap"
|
|
226
|
-
];
|
|
227
|
-
return d && t.push("cursor-pointer", "select-none", "hover:text-primary-base", "transition-colors"), a === "sm" ? t.push("px-1.5", "py-1") : a === "lg" ? t.push("px-4", "py-3") : t.push("p-2"), t;
|
|
228
|
-
}, X = (a, d) => {
|
|
229
|
-
const t = ["border-b", "border-gray-100", "text-gray-900"];
|
|
230
|
-
return d && t.push("border-r"), a === "sm" ? t.push("px-1.5", "py-1") : a === "lg" ? t.push("px-4", "py-3") : t.push("px-2", "py-1.5"), t;
|
|
231
|
-
}, Ge = (a, d, t, i) => {
|
|
232
|
-
const w = [];
|
|
233
|
-
return i ? w.push("bg-primary-25") : a && t && w.push("bg-gray-50"), d && w.push("hover:bg-gray-50", "transition-colors"), w;
|
|
234
|
-
}, V = (a, d) => {
|
|
235
|
-
const t = ["w-3.5", "h-3.5", "inline-block", "ml-1"];
|
|
236
|
-
return a ? (t.push("text-primary-base"), d === -1 && t.push("rotate-180")) : t.push("text-gray-400"), t.push("transition-transform", "duration-200"), t;
|
|
237
|
-
}, Z = (a) => {
|
|
238
|
-
const d = ["text-center"];
|
|
239
|
-
return a === "sm" ? d.push("w-8") : a === "lg" ? d.push("w-14") : d.push("w-12"), d;
|
|
240
|
-
}, he = (a) => Z(a), Ie = () => [
|
|
241
|
-
"flex",
|
|
242
|
-
"items-center",
|
|
243
|
-
"justify-between",
|
|
244
|
-
"px-2",
|
|
245
|
-
"py-2",
|
|
246
|
-
"border-t",
|
|
247
|
-
"border-gray-100",
|
|
248
|
-
"bg-white",
|
|
249
|
-
"text-sm"
|
|
250
|
-
], Y = (a) => {
|
|
251
|
-
const d = ["bg-gray-100", "border-b", "border-gray-200"];
|
|
252
|
-
return a === "sm" ? d.push("px-1.5", "py-1") : a === "lg" ? d.push("px-4", "py-2") : d.push("px-2", "py-1.5"), d;
|
|
253
|
-
}, Je = { class: "flex items-center gap-4" }, Qe = { class: "text-gray-600" }, Xe = ["value"], Ye = ["value"], Ze = { class: "flex items-center gap-1" }, De = ["disabled"], et = { class: "px-2 text-gray-600" }, tt = ["disabled"], st = /* @__PURE__ */ D({
|
|
254
|
-
__name: "OneDataTablePaginator",
|
|
255
|
-
props: {
|
|
256
|
-
first: {
|
|
257
|
-
type: Number,
|
|
258
|
-
required: !0
|
|
259
|
-
},
|
|
260
|
-
rows: {
|
|
261
|
-
type: Number,
|
|
262
|
-
required: !0
|
|
263
|
-
},
|
|
264
|
-
totalRecords: {
|
|
265
|
-
type: Number,
|
|
266
|
-
required: !0
|
|
267
|
-
},
|
|
268
|
-
rowsPerPageOptions: {
|
|
269
|
-
type: Array,
|
|
270
|
-
default: () => [10, 25, 50, 100]
|
|
271
|
-
}
|
|
272
|
-
},
|
|
273
|
-
emits: ["update:first", "update:rows", "page"],
|
|
274
|
-
setup(a, { emit: d }) {
|
|
275
|
-
const t = a, i = d, w = f(() => Math.ceil(t.totalRecords / t.rows)), C = f(() => Math.floor(t.first / t.rows) + 1), U = f(() => t.totalRecords === 0 ? 0 : t.first + 1), ee = f(() => Math.min(t.first + t.rows, t.totalRecords)), _ = f(() => t.first === 0), O = f(() => t.first + t.rows >= t.totalRecords), q = f(() => Ie()), P = (b) => {
|
|
276
|
-
b < 0 || b >= t.totalRecords || (i("update:first", b), i("page", {
|
|
277
|
-
first: b,
|
|
278
|
-
rows: t.rows,
|
|
279
|
-
page: Math.floor(b / t.rows),
|
|
280
|
-
pageCount: w.value
|
|
281
|
-
}));
|
|
282
|
-
}, j = () => {
|
|
283
|
-
P(Math.max(0, t.first - t.rows));
|
|
284
|
-
}, N = () => {
|
|
285
|
-
P(t.first + t.rows);
|
|
286
|
-
}, M = (b) => {
|
|
287
|
-
const v = parseInt(b.target.value);
|
|
288
|
-
i("update:rows", v), i("update:first", 0), i("page", {
|
|
289
|
-
first: 0,
|
|
290
|
-
rows: v,
|
|
291
|
-
page: 0,
|
|
292
|
-
pageCount: Math.ceil(t.totalRecords / v)
|
|
293
|
-
});
|
|
294
|
-
};
|
|
295
|
-
return (b, v) => (l(), n("div", {
|
|
296
|
-
class: g(q.value)
|
|
297
|
-
}, [
|
|
298
|
-
c("div", Je, [
|
|
299
|
-
c("span", Qe, S(U.value) + "–" + S(ee.value) + " of " + S(a.totalRecords), 1),
|
|
300
|
-
a.rowsPerPageOptions.length > 1 ? (l(), n("select", {
|
|
301
|
-
key: 0,
|
|
302
|
-
value: a.rows,
|
|
303
|
-
class: "border border-gray-300 rounded px-2 py-1 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-primary-glow",
|
|
304
|
-
onChange: M
|
|
305
|
-
}, [
|
|
306
|
-
(l(!0), n(R, null, B(a.rowsPerPageOptions, (L) => (l(), n("option", {
|
|
307
|
-
key: L,
|
|
308
|
-
value: L
|
|
309
|
-
}, S(L) + " / page ", 9, Ye))), 128))
|
|
310
|
-
], 40, Xe)) : y("", !0)
|
|
311
|
-
]),
|
|
312
|
-
c("div", Ze, [
|
|
313
|
-
c("button", {
|
|
314
|
-
disabled: _.value,
|
|
315
|
-
class: "p-1.5 rounded hover:bg-gray-100 disabled:opacity-30 disabled:cursor-default transition-colors",
|
|
316
|
-
onClick: j
|
|
317
|
-
}, [
|
|
318
|
-
(l(), m(k(p(Te)), { class: "w-4 h-4 text-gray-600" }))
|
|
319
|
-
], 8, De),
|
|
320
|
-
c("span", et, S(C.value) + " / " + S(w.value), 1),
|
|
321
|
-
c("button", {
|
|
322
|
-
disabled: O.value,
|
|
323
|
-
class: "p-1.5 rounded hover:bg-gray-100 disabled:opacity-30 disabled:cursor-default transition-colors",
|
|
324
|
-
onClick: N
|
|
325
|
-
}, [
|
|
326
|
-
(l(), m(k(p(ve)), { class: "w-4 h-4 text-gray-600" }))
|
|
327
|
-
], 8, tt)
|
|
328
|
-
])
|
|
329
|
-
], 2));
|
|
330
|
-
}
|
|
331
|
-
}), rt = {
|
|
332
|
-
key: 0,
|
|
333
|
-
class: "mb-3"
|
|
334
|
-
}, lt = {
|
|
335
|
-
key: 0,
|
|
336
|
-
class: "w-5 h-5 rounded bg-primary-base flex items-center justify-center text-white"
|
|
337
|
-
}, ot = {
|
|
338
|
-
key: 1,
|
|
339
|
-
class: "w-5 h-5 rounded border border-gray-300 bg-white"
|
|
340
|
-
}, at = ["onClick"], nt = {
|
|
341
|
-
key: 1,
|
|
342
|
-
class: "inline-flex items-center gap-1"
|
|
343
|
-
}, it = { key: 0 }, dt = ["value", "placeholder", "onInput"], ut = { key: 0 }, pt = ["onClick"], ct = ["onClick"], ft = {
|
|
344
|
-
key: 0,
|
|
345
|
-
class: "w-5 h-5 rounded bg-primary-base flex items-center justify-center text-white"
|
|
346
|
-
}, yt = {
|
|
347
|
-
key: 1,
|
|
348
|
-
class: "w-5 h-5 rounded border border-gray-300 bg-white"
|
|
349
|
-
}, gt = ["onClick"], ht = {
|
|
350
|
-
key: 0,
|
|
351
|
-
class: "w-5 h-5 rounded-full bg-primary-base flex items-center justify-center"
|
|
352
|
-
}, bt = {
|
|
353
|
-
key: 1,
|
|
354
|
-
class: "w-5 h-5 rounded-full border border-gray-300 bg-white"
|
|
355
|
-
}, vt = ["onClick"], mt = { key: 0 }, wt = ["colspan"], kt = { key: 1 }, Ct = ["colspan"], xt = { class: "flex items-center justify-center gap-2 text-gray-500" }, St = { key: 2 }, _t = ["colspan"], Rt = { class: "text-gray-400" }, Mt = { key: 3 }, Ft = ["colspan"], Pt = ["disabled"], Lt = {
|
|
356
|
-
key: 2,
|
|
357
|
-
class: "mt-3"
|
|
358
|
-
}, Et = /* @__PURE__ */ D({
|
|
359
|
-
__name: "OneDataTable",
|
|
360
|
-
props: Ue,
|
|
361
|
-
emits: [
|
|
362
|
-
"update:selection",
|
|
363
|
-
"update:expandedRows",
|
|
364
|
-
"update:first",
|
|
365
|
-
"update:rows",
|
|
366
|
-
"update:sortField",
|
|
367
|
-
"update:sortOrder",
|
|
368
|
-
"update:filters",
|
|
369
|
-
"sort",
|
|
370
|
-
"page",
|
|
371
|
-
"filter",
|
|
372
|
-
"row-click",
|
|
373
|
-
"row-select",
|
|
374
|
-
"row-unselect",
|
|
375
|
-
"row-expand",
|
|
376
|
-
"row-collapse",
|
|
377
|
-
"load:next"
|
|
378
|
-
],
|
|
379
|
-
setup(a, { emit: d }) {
|
|
380
|
-
const t = a, i = d, w = be(), C = z([]);
|
|
381
|
-
Ee(me, { registerColumn: (e) => {
|
|
382
|
-
C.value.push(e);
|
|
383
|
-
}, unregisterColumn: (e) => {
|
|
384
|
-
const s = C.value.indexOf(e);
|
|
385
|
-
s > -1 && C.value.splice(s, 1);
|
|
386
|
-
} });
|
|
387
|
-
const _ = z(t.first), O = z(t.rows), q = z(t.sortField), P = z(t.sortOrder);
|
|
388
|
-
T(() => t.first, (e) => {
|
|
389
|
-
_.value = e;
|
|
390
|
-
}), T(() => t.rows, (e) => {
|
|
391
|
-
O.value = e;
|
|
392
|
-
}), T(() => t.sortField, (e) => {
|
|
393
|
-
q.value = e;
|
|
394
|
-
}), T(() => t.sortOrder, (e) => {
|
|
395
|
-
P.value = e;
|
|
396
|
-
});
|
|
397
|
-
const j = f(() => _.value), N = f(() => O.value), M = f(() => q.value), b = f(() => P.value), v = (e, s) => s ? s.split(".").reduce((r, u) => r == null ? void 0 : r[u], e) : e, L = (e) => t.dataKey ? v(e, t.dataKey) : e, x = (e, s) => e == null || s == null ? e === s : t.dataKey ? v(e, t.dataKey) === v(s, t.dataKey) : e === s, we = (e, s) => t.dataKey ? v(e, t.dataKey) : s, E = f(
|
|
398
|
-
() => C.value.some((e) => e.props.expander)
|
|
399
|
-
), K = f(
|
|
400
|
-
() => !!t.selectionMode
|
|
401
|
-
), te = f(
|
|
402
|
-
() => t.selectionMode === "multiple"
|
|
403
|
-
), W = f(
|
|
404
|
-
() => C.value.filter((e) => !e.props.expander)
|
|
405
|
-
), A = f(
|
|
406
|
-
() => C.value.length + (K.value ? 1 : 0) + (E.value ? 1 : 0)
|
|
407
|
-
), se = f(() => {
|
|
408
|
-
var r, u;
|
|
409
|
-
if (t.lazy || !t.filters)
|
|
410
|
-
return t.value;
|
|
411
|
-
let e = [...t.value];
|
|
412
|
-
const s = t.filters;
|
|
413
|
-
if ((r = s.global) != null && r.value && ((u = t.globalFilterFields) != null && u.length)) {
|
|
414
|
-
const o = s.global.value;
|
|
415
|
-
e = e.filter(
|
|
416
|
-
(h) => t.globalFilterFields.some(
|
|
417
|
-
(I) => ge.contains(v(h, I), o)
|
|
418
|
-
)
|
|
419
|
-
);
|
|
420
|
-
}
|
|
421
|
-
for (const [o, h] of Object.entries(s)) {
|
|
422
|
-
if (o === "global" || !h.value)
|
|
423
|
-
continue;
|
|
424
|
-
const I = h.matchMode || "contains", ie = ge[I];
|
|
425
|
-
ie && (e = e.filter((qe) => ie(v(qe, o), h.value)));
|
|
426
|
-
}
|
|
427
|
-
return e;
|
|
428
|
-
}), ke = f(() => {
|
|
429
|
-
const e = se.value;
|
|
430
|
-
return t.lazy || !M.value || !b.value ? e : [...e].sort((s, r) => {
|
|
431
|
-
const u = v(s, M.value), o = v(r, M.value);
|
|
432
|
-
if (u == null && o == null)
|
|
433
|
-
return 0;
|
|
434
|
-
if (u == null)
|
|
435
|
-
return 1;
|
|
436
|
-
if (o == null)
|
|
437
|
-
return -1;
|
|
438
|
-
let h;
|
|
439
|
-
return typeof u == "number" && typeof o == "number" ? h = u - o : h = String(u).localeCompare(String(o)), b.value === 1 ? h : -h;
|
|
440
|
-
});
|
|
441
|
-
}), re = f(
|
|
442
|
-
() => t.totalRecords ?? se.value.length
|
|
443
|
-
), $ = f(() => {
|
|
444
|
-
const e = ke.value;
|
|
445
|
-
if (t.paginator && !t.lazy) {
|
|
446
|
-
const s = j.value, r = s + N.value;
|
|
447
|
-
return e.slice(s, r);
|
|
448
|
-
}
|
|
449
|
-
return e;
|
|
450
|
-
}), Ce = (e) => {
|
|
451
|
-
let s;
|
|
452
|
-
M.value === e ? b.value === 1 ? s = -1 : b.value === -1 ? s = null : s = 1 : s = 1, q.value = e, P.value = s, i("update:sortField", e), i("update:sortOrder", s), i("sort", { field: e, order: s }), !t.lazy && t.paginator && (_.value = 0, i("update:first", 0));
|
|
453
|
-
}, le = (e) => e.props.sortField || e.props.field, xe = (e) => M.value === le(e), H = (e) => t.selection ? t.selectionMode === "single" ? x(t.selection, e) : t.selectionMode === "multiple" ? t.selection.some((s) => x(s, e)) : !1 : !1, oe = (e, s, r) => {
|
|
454
|
-
if (i("row-click", { originalEvent: e, data: s, index: r }), t.selectionMode === "single") {
|
|
455
|
-
const u = x(t.selection, s) ? null : s;
|
|
456
|
-
i("update:selection", u), u ? i("row-select", { originalEvent: e, data: s }) : i("row-unselect", { originalEvent: e, data: s });
|
|
457
|
-
}
|
|
458
|
-
}, Se = (e, s) => {
|
|
459
|
-
if (e.stopPropagation(), t.selectionMode === "multiple") {
|
|
460
|
-
const r = t.selection || [], u = r.some((h) => x(h, s));
|
|
461
|
-
let o;
|
|
462
|
-
u ? (o = r.filter((h) => !x(h, s)), i("row-unselect", { originalEvent: e, data: s })) : (o = [...r, s], i("row-select", { originalEvent: e, data: s })), i("update:selection", o);
|
|
463
|
-
}
|
|
464
|
-
}, ae = f(() => {
|
|
465
|
-
if (t.selectionMode !== "multiple" || !t.selection)
|
|
466
|
-
return !1;
|
|
467
|
-
const e = t.selection;
|
|
468
|
-
return $.value.length > 0 && $.value.every((s) => e.some((r) => x(r, s)));
|
|
469
|
-
}), _e = (e) => {
|
|
470
|
-
e.stopPropagation();
|
|
471
|
-
const s = t.selection || [];
|
|
472
|
-
if (ae.value) {
|
|
473
|
-
const r = s.filter(
|
|
474
|
-
(u) => !$.value.some((o) => x(u, o))
|
|
475
|
-
);
|
|
476
|
-
i("update:selection", r);
|
|
477
|
-
} else {
|
|
478
|
-
const r = [...s];
|
|
479
|
-
$.value.forEach((u) => {
|
|
480
|
-
r.some((o) => x(o, u)) || r.push(u);
|
|
481
|
-
}), i("update:selection", r);
|
|
482
|
-
}
|
|
483
|
-
}, G = (e) => {
|
|
484
|
-
if (!t.expandedRows)
|
|
485
|
-
return !1;
|
|
486
|
-
if (Array.isArray(t.expandedRows))
|
|
487
|
-
return t.expandedRows.some((s) => x(s, e));
|
|
488
|
-
if (t.dataKey) {
|
|
489
|
-
const s = String(L(e));
|
|
490
|
-
return !!t.expandedRows[s];
|
|
491
|
-
}
|
|
492
|
-
return !1;
|
|
493
|
-
}, Re = (e, s) => {
|
|
494
|
-
e.stopPropagation();
|
|
495
|
-
const r = G(s);
|
|
496
|
-
if (Array.isArray(t.expandedRows)) {
|
|
497
|
-
let u;
|
|
498
|
-
r ? (u = t.expandedRows.filter((o) => !x(o, s)), i("row-collapse", { originalEvent: e, data: s })) : (u = [...t.expandedRows, s], i("row-expand", { originalEvent: e, data: s })), i("update:expandedRows", u);
|
|
499
|
-
} else if (t.dataKey) {
|
|
500
|
-
const u = String(L(s)), o = { ...t.expandedRows };
|
|
501
|
-
r ? (delete o[u], i("row-collapse", { originalEvent: e, data: s })) : (o[u] = !0, i("row-expand", { originalEvent: e, data: s })), i("update:expandedRows", o);
|
|
502
|
-
}
|
|
503
|
-
}, Me = (e, s, r) => {
|
|
504
|
-
var o;
|
|
505
|
-
if (!t.filters)
|
|
506
|
-
return;
|
|
507
|
-
const u = {
|
|
508
|
-
...t.filters,
|
|
509
|
-
[e]: { value: s, matchMode: r || ((o = t.filters[e]) == null ? void 0 : o.matchMode) || "contains" }
|
|
510
|
-
};
|
|
511
|
-
i("update:filters", u), t.lazy && i("filter", { filters: u }), t.paginator && (_.value = 0, i("update:first", 0));
|
|
512
|
-
}, ne = (e) => {
|
|
513
|
-
var s;
|
|
514
|
-
return ((s = t.filters) == null ? void 0 : s[e]) || { value: null };
|
|
515
|
-
}, Fe = (e) => () => {
|
|
516
|
-
t.filters && (i("update:filters", { ...t.filters }), t.lazy && i("filter", { filters: t.filters }), t.paginator && (_.value = 0, i("update:first", 0)));
|
|
517
|
-
}, Pe = (e) => {
|
|
518
|
-
_.value = e, i("update:first", e);
|
|
519
|
-
}, Le = (e) => {
|
|
520
|
-
O.value = e, i("update:rows", e);
|
|
521
|
-
}, $e = f(() => We()), Oe = f(() => {
|
|
522
|
-
const e = He(t.size);
|
|
523
|
-
return t.tableClass && e.push(t.tableClass), t.bordered && e.push("border", "border-gray-100"), e;
|
|
524
|
-
});
|
|
525
|
-
return (e, s) => (l(), n("div", null, [
|
|
526
|
-
ze(c("div", null, [
|
|
527
|
-
F(e.$slots, "default")
|
|
528
|
-
], 512), [
|
|
529
|
-
[Be, !1]
|
|
530
|
-
]),
|
|
531
|
-
p(w).header ? (l(), n("div", rt, [
|
|
532
|
-
F(e.$slots, "header")
|
|
533
|
-
])) : y("", !0),
|
|
534
|
-
c("div", {
|
|
535
|
-
class: g($e.value)
|
|
536
|
-
}, [
|
|
537
|
-
c("table", {
|
|
538
|
-
class: g(Oe.value)
|
|
539
|
-
}, [
|
|
540
|
-
c("thead", null, [
|
|
541
|
-
c("tr", null, [
|
|
542
|
-
K.value ? (l(), n("th", {
|
|
543
|
-
key: 0,
|
|
544
|
-
class: g([
|
|
545
|
-
...p(Q)(e.size, !1),
|
|
546
|
-
...p(Z)(e.size)
|
|
547
|
-
])
|
|
548
|
-
}, [
|
|
549
|
-
te.value ? (l(), n("div", {
|
|
550
|
-
key: 0,
|
|
551
|
-
class: "flex items-center justify-center cursor-pointer",
|
|
552
|
-
onClick: s[0] || (s[0] = (r) => _e(r))
|
|
553
|
-
}, [
|
|
554
|
-
ae.value ? (l(), n("div", lt, [
|
|
555
|
-
(l(), m(k(p(fe)), { class: "w-3.5 h-3.5" }))
|
|
556
|
-
])) : (l(), n("div", ot))
|
|
557
|
-
])) : y("", !0)
|
|
558
|
-
], 2)) : y("", !0),
|
|
559
|
-
E.value ? (l(), n("th", {
|
|
560
|
-
key: 1,
|
|
561
|
-
class: g([
|
|
562
|
-
...p(Q)(e.size, !1),
|
|
563
|
-
...p(he)(e.size)
|
|
564
|
-
])
|
|
565
|
-
}, null, 2)) : y("", !0),
|
|
566
|
-
(l(!0), n(R, null, B(W.value, (r, u) => (l(), n("th", {
|
|
567
|
-
key: u,
|
|
568
|
-
class: g([
|
|
569
|
-
...p(Q)(e.size, r.props.sortable),
|
|
570
|
-
r.props.headerClass
|
|
571
|
-
]),
|
|
572
|
-
style: de([
|
|
573
|
-
r.props.headerStyle,
|
|
574
|
-
r.props.width ? { width: r.props.width } : {}
|
|
575
|
-
]),
|
|
576
|
-
onClick: (o) => r.props.sortable ? Ce(le(r)) : void 0
|
|
577
|
-
}, [
|
|
578
|
-
r.slots.header ? (l(), m(k(r.slots.header), { key: 0 })) : (l(), n("span", nt, [
|
|
579
|
-
J(S(r.props.header) + " ", 1),
|
|
580
|
-
r.props.sortable ? (l(), n(R, { key: 0 }, [
|
|
581
|
-
xe(r) ? b.value === 1 ? (l(), m(k(p(Ae)), {
|
|
582
|
-
key: 1,
|
|
583
|
-
class: g(p(V)(!0, 1))
|
|
584
|
-
}, null, 8, ["class"])) : b.value === -1 ? (l(), m(k(p(pe)), {
|
|
585
|
-
key: 2,
|
|
586
|
-
class: g(p(V)(!0, -1))
|
|
587
|
-
}, null, 8, ["class"])) : (l(), m(k(p(ye)), {
|
|
588
|
-
key: 3,
|
|
589
|
-
class: g(p(V)(!1, null))
|
|
590
|
-
}, null, 8, ["class"])) : (l(), m(k(p(ye)), {
|
|
591
|
-
key: 0,
|
|
592
|
-
class: g(p(V)(!1, null))
|
|
593
|
-
}, null, 8, ["class"]))
|
|
594
|
-
], 64)) : y("", !0)
|
|
595
|
-
]))
|
|
596
|
-
], 14, at))), 128))
|
|
597
|
-
]),
|
|
598
|
-
e.filterDisplay === "row" ? (l(), n("tr", it, [
|
|
599
|
-
K.value ? (l(), n("th", {
|
|
600
|
-
key: 0,
|
|
601
|
-
class: g(p(Y)(e.size))
|
|
602
|
-
}, null, 2)) : y("", !0),
|
|
603
|
-
E.value ? (l(), n("th", {
|
|
604
|
-
key: 1,
|
|
605
|
-
class: g(p(Y)(e.size))
|
|
606
|
-
}, null, 2)) : y("", !0),
|
|
607
|
-
(l(!0), n(R, null, B(W.value, (r, u) => (l(), n("th", {
|
|
608
|
-
key: `filter-${u}`,
|
|
609
|
-
class: g(p(Y)(e.size))
|
|
610
|
-
}, [
|
|
611
|
-
r.props.filterable && r.slots.filter ? (l(), m(k(r.slots.filter), {
|
|
612
|
-
key: 0,
|
|
613
|
-
filterModel: ne(
|
|
614
|
-
r.props.filterField || r.props.field
|
|
615
|
-
),
|
|
616
|
-
filterCallback: Fe(
|
|
617
|
-
r.props.filterField || r.props.field
|
|
618
|
-
)
|
|
619
|
-
}, null, 8, ["filterModel", "filterCallback"])) : r.props.filterable && r.props.field ? (l(), n("input", {
|
|
620
|
-
key: 1,
|
|
621
|
-
type: "text",
|
|
622
|
-
value: ne(
|
|
623
|
-
r.props.filterField || r.props.field
|
|
624
|
-
).value || "",
|
|
625
|
-
class: "w-full border border-gray-300 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-primary-glow",
|
|
626
|
-
placeholder: `Filter ${r.props.header || r.props.field}`,
|
|
627
|
-
onInput: (o) => Me(
|
|
628
|
-
r.props.filterField || r.props.field,
|
|
629
|
-
o.target.value
|
|
630
|
-
)
|
|
631
|
-
}, null, 40, dt)) : y("", !0)
|
|
632
|
-
], 2))), 128))
|
|
633
|
-
])) : y("", !0)
|
|
634
|
-
]),
|
|
635
|
-
!e.loading && $.value.length > 0 ? (l(), n("tbody", ut, [
|
|
636
|
-
(l(!0), n(R, null, B($.value, (r, u) => (l(), n(R, {
|
|
637
|
-
key: we(r, u)
|
|
638
|
-
}, [
|
|
639
|
-
c("tr", {
|
|
640
|
-
class: g([
|
|
641
|
-
...p(Ge)(e.striped, e.hoverable, u % 2 === 1, H(r)),
|
|
642
|
-
e.selectionMode ? "cursor-pointer" : ""
|
|
643
|
-
]),
|
|
644
|
-
onClick: (o) => oe(o, r, u)
|
|
645
|
-
}, [
|
|
646
|
-
K.value ? (l(), n("td", {
|
|
647
|
-
key: 0,
|
|
648
|
-
class: g([
|
|
649
|
-
...p(X)(e.size, e.bordered),
|
|
650
|
-
...p(Z)(e.size)
|
|
651
|
-
])
|
|
652
|
-
}, [
|
|
653
|
-
te.value ? (l(), n("div", {
|
|
654
|
-
key: 0,
|
|
655
|
-
class: "flex items-center justify-center cursor-pointer",
|
|
656
|
-
onClick: ue((o) => Se(o, r), ["stop"])
|
|
657
|
-
}, [
|
|
658
|
-
H(r) ? (l(), n("div", ft, [
|
|
659
|
-
(l(), m(k(p(fe)), { class: "w-3.5 h-3.5" }))
|
|
660
|
-
])) : (l(), n("div", yt))
|
|
661
|
-
], 8, ct)) : (l(), n("div", {
|
|
662
|
-
key: 1,
|
|
663
|
-
class: "flex items-center justify-center cursor-pointer",
|
|
664
|
-
onClick: ue((o) => oe(o, r, u), ["stop"])
|
|
665
|
-
}, [
|
|
666
|
-
H(r) ? (l(), n("div", ht, s[3] || (s[3] = [
|
|
667
|
-
c("div", { class: "w-2 h-2 rounded-full bg-white" }, null, -1)
|
|
668
|
-
]))) : (l(), n("div", bt))
|
|
669
|
-
], 8, gt))
|
|
670
|
-
], 2)) : y("", !0),
|
|
671
|
-
E.value ? (l(), n("td", {
|
|
672
|
-
key: 1,
|
|
673
|
-
class: g([
|
|
674
|
-
...p(X)(e.size, e.bordered),
|
|
675
|
-
...p(he)(e.size)
|
|
676
|
-
])
|
|
677
|
-
}, [
|
|
678
|
-
c("button", {
|
|
679
|
-
class: "p-1 rounded hover:bg-gray-100 transition-colors",
|
|
680
|
-
onClick: (o) => Re(o, r)
|
|
681
|
-
}, [
|
|
682
|
-
(l(), m(k(G(r) ? p(pe) : p(ve)), { class: "w-4 h-4 text-gray-500" }))
|
|
683
|
-
], 8, vt)
|
|
684
|
-
], 2)) : y("", !0),
|
|
685
|
-
(l(!0), n(R, null, B(W.value, (o, h) => (l(), n("td", {
|
|
686
|
-
key: h,
|
|
687
|
-
class: g([
|
|
688
|
-
...p(X)(e.size, e.bordered),
|
|
689
|
-
o.props.bodyClass
|
|
690
|
-
]),
|
|
691
|
-
style: de(o.props.bodyStyle)
|
|
692
|
-
}, [
|
|
693
|
-
o.slots.body ? (l(), m(k(o.slots.body), {
|
|
694
|
-
key: 0,
|
|
695
|
-
data: r,
|
|
696
|
-
field: o.props.field,
|
|
697
|
-
index: u
|
|
698
|
-
}, null, 8, ["data", "field", "index"])) : o.props.field ? (l(), n(R, { key: 1 }, [
|
|
699
|
-
J(S(v(r, o.props.field)), 1)
|
|
700
|
-
], 64)) : y("", !0)
|
|
701
|
-
], 6))), 128))
|
|
702
|
-
], 10, pt),
|
|
703
|
-
E.value && G(r) ? (l(), n("tr", mt, [
|
|
704
|
-
c("td", {
|
|
705
|
-
colspan: A.value,
|
|
706
|
-
class: "p-0"
|
|
707
|
-
}, [
|
|
708
|
-
F(e.$slots, "expansion", {
|
|
709
|
-
data: r,
|
|
710
|
-
index: u
|
|
711
|
-
})
|
|
712
|
-
], 8, wt)
|
|
713
|
-
])) : y("", !0)
|
|
714
|
-
], 64))), 128))
|
|
715
|
-
])) : e.loading ? (l(), n("tbody", kt, [
|
|
716
|
-
c("tr", null, [
|
|
717
|
-
c("td", {
|
|
718
|
-
colspan: A.value,
|
|
719
|
-
class: "text-center py-12"
|
|
720
|
-
}, [
|
|
721
|
-
F(e.$slots, "loading", {}, () => [
|
|
722
|
-
c("div", xt, [
|
|
723
|
-
je(ce, { class: "w-5 h-5" }),
|
|
724
|
-
s[4] || (s[4] = c("span", null, "Loading...", -1))
|
|
725
|
-
])
|
|
726
|
-
])
|
|
727
|
-
], 8, Ct)
|
|
728
|
-
])
|
|
729
|
-
])) : (l(), n("tbody", St, [
|
|
730
|
-
c("tr", null, [
|
|
731
|
-
c("td", {
|
|
732
|
-
colspan: A.value,
|
|
733
|
-
class: "text-center py-12"
|
|
734
|
-
}, [
|
|
735
|
-
F(e.$slots, "empty", {}, () => [
|
|
736
|
-
c("span", Rt, S(e.emptyMessage), 1)
|
|
737
|
-
])
|
|
738
|
-
], 8, _t)
|
|
739
|
-
])
|
|
740
|
-
])),
|
|
741
|
-
e.hasNextPage && !e.loading ? (l(), n("tfoot", Mt, [
|
|
742
|
-
c("tr", null, [
|
|
743
|
-
c("td", {
|
|
744
|
-
colspan: A.value,
|
|
745
|
-
class: "px-3 pb-3 pt-2"
|
|
746
|
-
}, [
|
|
747
|
-
c("button", {
|
|
748
|
-
class: "w-full p-2 rounded bg-primary-base bg-opacity-10 text-primary-base text-sm font-medium hover:bg-opacity-20 transition-colors disabled:opacity-50 disabled:cursor-default flex items-center justify-center gap-2",
|
|
749
|
-
disabled: e.loadingNext,
|
|
750
|
-
onClick: s[1] || (s[1] = (r) => i("load:next"))
|
|
751
|
-
}, [
|
|
752
|
-
e.loadingNext ? (l(), m(ce, {
|
|
753
|
-
key: 0,
|
|
754
|
-
class: "w-4 h-4"
|
|
755
|
-
})) : y("", !0),
|
|
756
|
-
J(" " + S(e.loadMoreLabel), 1)
|
|
757
|
-
], 8, Pt)
|
|
758
|
-
], 8, Ft)
|
|
759
|
-
])
|
|
760
|
-
])) : y("", !0)
|
|
761
|
-
], 2)
|
|
762
|
-
], 2),
|
|
763
|
-
e.paginator && re.value > 0 ? (l(), m(st, {
|
|
764
|
-
key: 1,
|
|
765
|
-
first: j.value,
|
|
766
|
-
rows: N.value,
|
|
767
|
-
"total-records": re.value,
|
|
768
|
-
"rows-per-page-options": e.rowsPerPageOptions,
|
|
769
|
-
"onUpdate:first": Pe,
|
|
770
|
-
"onUpdate:rows": Le,
|
|
771
|
-
onPage: s[2] || (s[2] = (r) => i("page", r))
|
|
772
|
-
}, null, 8, ["first", "rows", "total-records", "rows-per-page-options"])) : y("", !0),
|
|
773
|
-
p(w).footer ? (l(), n("div", Lt, [
|
|
774
|
-
F(e.$slots, "footer")
|
|
775
|
-
])) : y("", !0)
|
|
776
|
-
]));
|
|
777
|
-
}
|
|
778
|
-
}), zt = /* @__PURE__ */ D({
|
|
779
|
-
__name: "OneColumn",
|
|
780
|
-
props: Ve,
|
|
781
|
-
setup(a) {
|
|
782
|
-
const d = a, t = be(), i = Ne(me), w = {
|
|
783
|
-
props: d,
|
|
784
|
-
slots: t
|
|
785
|
-
};
|
|
786
|
-
return i && i.registerColumn(w), Ke(() => {
|
|
787
|
-
i && i.unregisterColumn(w);
|
|
788
|
-
}), (C, U) => F(C.$slots, "default");
|
|
789
|
-
}
|
|
790
|
-
});
|
|
791
|
-
export {
|
|
792
|
-
Et as _,
|
|
793
|
-
zt as a,
|
|
794
|
-
st as b,
|
|
795
|
-
fe as r
|
|
796
|
-
};
|