@bridge-ui/vue 0.17.1 → 0.17.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/Components/CalendarRange/composables/useCalendarRange.js +1 -1
- package/dist/Components/ChartTooltip/composables/useChartTooltip.js +1 -1
- package/dist/Components/ColorPicker/composables/useColorPicker.js +1 -1
- package/dist/Components/DataTable/DataTable.vue_vue_type_script_setup_true_lang.js +25 -25
- package/dist/Components/DataTable/DataTableSortButton.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/Components/DataTable/composables/useDataTable.d.ts +3 -2
- package/dist/Components/DataTable/composables/useDataTable.js +301 -313
- package/dist/Components/DataTable/dataTable.types.d.ts +12 -0
- package/dist/Components/DatePicker/composables/useDatePicker.js +1 -1
- package/dist/Components/DateRangePicker/composables/useDateRangePicker.js +1 -1
- package/dist/Components/DateTimePicker/composables/useDateTimePicker.js +1 -1
- package/dist/Components/DateTimeRangePicker/composables/useDateTimeRangePicker.js +1 -1
- package/dist/Components/FormField/composables/useFormField.js +3 -1
- package/dist/Components/OtpField/composables/useOtpField.js +90 -89
- package/dist/Components/TimePicker/composables/useTimePicker.js +1 -1
- package/dist/Components/TimeRangePicker/composables/useTimeRangePicker.js +1 -1
- package/docs/components/DataTable.md +2 -0
- package/package.json +3 -3
|
@@ -1,152 +1,152 @@
|
|
|
1
1
|
import { mergePartBind as e, useBridgeUIComponent as t, useBridgeUIMergedRegistryClasses as n } from "../../../Utils/index.js";
|
|
2
2
|
import { computed as r, getCurrentInstance as i, onBeforeUnmount as a, ref as ee, useAttrs as te, useSlots as ne, watch as re } from "vue";
|
|
3
3
|
import { compact as ie, fromPairs as ae, get as o, head as s, isArray as oe, isEmpty as se, isFunction as c, isNil as ce, isString as le, keyBy as ue, map as l, omit as de } from "es-toolkit/compat";
|
|
4
|
-
import { DATATABLE_AMBIGUOUS_PAGING_WARNING as fe, DATATABLE_EXPAND_COLUMN_ID as u, DATATABLE_SELECTION_COLUMN_ID as d, getDataTableAriaSort as pe, getDataTableColumnAccessor as
|
|
5
|
-
import { tableVariantProps as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { columnFilteringFeature as
|
|
4
|
+
import { DATATABLE_AMBIGUOUS_PAGING_WARNING as fe, DATATABLE_EXPAND_COLUMN_ID as u, DATATABLE_SELECTION_COLUMN_ID as d, getDataTableAriaSort as pe, getDataTableColumnAccessor as f, getDataTableColumnCssWidth as me, getDataTableColumnFilterValues as he, getDataTableColumnSearch as ge, getDataTableDefaultCellContent as _e, getDataTableFooterLayout as ve, getDataTablePaginationSlotProps as ye, getDataTablePerPageSelectOptions as be, getDataTableResolvedPageCount as xe, getDataTableResolvedPerPage as Se, getDataTableSelectAllState as Ce, getDataTableSelectionTotal as we, getDataTableSortIcon as Te, getDataTableStickyInsets as p, getDataTableStickyPing as Ee, isDataTableClientPaged as De, isDataTableColumnFilterable as m, isDataTableColumnFiltered as Oe, isDataTableColumnSearchable as h, isDataTableColumnSearched as ke, isDataTableCursorPaged as Ae, isDataTableExpandEnabled as je, isDataTablePagingAmbiguous as Me, isDataTablePerPageEnabled as Ne, isDataTableSearchEnabled as Pe, isDataTableSelectionEnabled as Fe, isDataTableSelectionMultiple as Ie, isDataTableServerPaged as Le, isDataTableStickyHeader as Re, isDataTableStickyHeaderBoxed as ze, isDataTableVisibilityEnabled as Be, resolveDataTableRowId as Ve, rowMatchesDataTableColumnSearch as He, rowMatchesDataTableToolbarSearch as Ue, rowSelectionToIds as We, selectionToRowSelection as Ge, setDataTableColumnFilter as Ke, setDataTableColumnSearch as qe, setDataTableRowSelection as Je, sliceDataTablePage as Ye, toggleDataTableColumnVisibility as Xe, toggleDataTablePageSelection as Ze, toggleDataTableRowExpansion as Qe, toggleDataTableSorting as $e } from "@bridge-ui/core/Domain";
|
|
5
|
+
import { tableVariantProps as et } from "@bridge-ui/core/Tokens";
|
|
6
|
+
import { cn as g, mergeBridgeUILayeredClasses as tt, splitComponentProps as nt } from "@bridge-ui/core/Utils";
|
|
7
|
+
import { columnFilteringFeature as _, columnVisibilityFeature as rt, createFilteredRowModel as v, createSortedRowModel as y, rowSelectionFeature as b, rowSortingFeature as x, sortFn_alphanumeric as S, sortFn_datetime as C, sortFn_text as w, tableFeatures as it, useTable as at } from "@tanstack/vue-table";
|
|
8
8
|
//#region src/Components/DataTable/composables/useDataTable.ts
|
|
9
|
-
var
|
|
9
|
+
var ot = /* @__PURE__ */ "full.page.rows.size.cursor.search.classes.columns.filters.loading.perPage.rounded.sorting.striped.variant.expanded.getRowId.hoverable.pageCount.selection.nextCursor.prevCursor.showSearch.totalCount.customProps.columnSearch.stickyHeader.filterOverlay.hiddenColumns.selectionMode.columnsOverlay.loadingVariant.perPageOptions.columnsShowFooter.showColumnVisibility".split("."), st = {
|
|
10
10
|
enableHiding: !1,
|
|
11
11
|
enableSorting: !1,
|
|
12
12
|
cell: () => null,
|
|
13
13
|
header: () => null
|
|
14
|
-
},
|
|
15
|
-
rowSortingFeature:
|
|
16
|
-
rowSelectionFeature:
|
|
17
|
-
columnFilteringFeature:
|
|
18
|
-
columnVisibilityFeature:
|
|
19
|
-
sortedRowModel:
|
|
20
|
-
filteredRowModel:
|
|
14
|
+
}, ct = [], lt = [], ut = [], dt = it({
|
|
15
|
+
rowSortingFeature: x,
|
|
16
|
+
rowSelectionFeature: b,
|
|
17
|
+
columnFilteringFeature: _,
|
|
18
|
+
columnVisibilityFeature: rt,
|
|
19
|
+
sortedRowModel: y(),
|
|
20
|
+
filteredRowModel: v(),
|
|
21
21
|
sortFns: {
|
|
22
|
-
text:
|
|
23
|
-
datetime:
|
|
24
|
-
alphanumeric:
|
|
22
|
+
text: w,
|
|
23
|
+
datetime: C,
|
|
24
|
+
alphanumeric: S
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
-
function
|
|
28
|
-
let
|
|
29
|
-
bridgeKeys:
|
|
27
|
+
function T(_, rt, v) {
|
|
28
|
+
let y = te(), b = ne(), x = i(), S = r(() => nt({
|
|
29
|
+
bridgeKeys: ot,
|
|
30
30
|
props: {
|
|
31
|
-
...
|
|
32
|
-
...
|
|
33
|
-
page:
|
|
34
|
-
cursor:
|
|
35
|
-
perPage:
|
|
36
|
-
filters:
|
|
37
|
-
sorting:
|
|
38
|
-
expanded:
|
|
39
|
-
selection:
|
|
40
|
-
columnSearch:
|
|
41
|
-
hiddenColumns:
|
|
31
|
+
...y,
|
|
32
|
+
..._,
|
|
33
|
+
page: v.page.value,
|
|
34
|
+
cursor: v.cursor?.value,
|
|
35
|
+
perPage: v.perPage.value,
|
|
36
|
+
filters: v.filters.value,
|
|
37
|
+
sorting: v.sorting.value,
|
|
38
|
+
expanded: v.expanded.value,
|
|
39
|
+
selection: v.selection.value,
|
|
40
|
+
columnSearch: v.columnSearch.value,
|
|
41
|
+
hiddenColumns: v.hiddenColumns.value
|
|
42
42
|
}
|
|
43
|
-
})), { merged:
|
|
44
|
-
libDefaults:
|
|
43
|
+
})), { merged: C, components: w, entry: it } = t({
|
|
44
|
+
libDefaults: rt,
|
|
45
45
|
componentName: "DataTable",
|
|
46
|
-
props: () =>
|
|
47
|
-
}),
|
|
48
|
-
entry:
|
|
49
|
-
props: () =>
|
|
50
|
-
}),
|
|
46
|
+
props: () => S.value.componentProps
|
|
47
|
+
}), T = r(() => C.value.customProps), ft = r(() => de(S.value.inheritedAttrs, ["children"])), E = n({
|
|
48
|
+
entry: it,
|
|
49
|
+
props: () => S.value.componentProps
|
|
50
|
+
}), pt = r(() => tt(et, o(w.value, [
|
|
51
51
|
"Table",
|
|
52
52
|
"tokens",
|
|
53
53
|
"variant"
|
|
54
|
-
]))),
|
|
55
|
-
cursor:
|
|
56
|
-
nextCursor:
|
|
57
|
-
prevCursor:
|
|
58
|
-
hasCursorHandler:
|
|
54
|
+
]))), D = r(() => o(pt.value, C.value.variant)), O = r(() => C.value.columns ?? lt), k = r(() => ue(O.value, "id")), mt = r(() => C.value.rows ?? ct), A = r(() => Fe(v.selection.value, y["onUpdate:selection"] !== void 0)), ht = r(() => je(v.expanded.value, y["onUpdate:expanded"] !== void 0, b.expanded !== void 0)), j = r(() => Be(v.hiddenColumns.value, y["onUpdate:hiddenColumns"] !== void 0, C.value.showColumnVisibility)), gt = r(() => Ie(C.value.selectionMode)), M = r(() => Ae({
|
|
55
|
+
cursor: v.cursor?.value,
|
|
56
|
+
nextCursor: C.value.nextCursor,
|
|
57
|
+
prevCursor: C.value.prevCursor,
|
|
58
|
+
hasCursorHandler: x?.vnode.props?.["onUpdate:cursor"] !== void 0
|
|
59
59
|
}));
|
|
60
|
-
re(() =>
|
|
60
|
+
re(() => Me(v.page.value, C.value.pageCount, C.value.totalCount, M.value), (e) => {
|
|
61
61
|
e && process.env.NODE_ENV !== "production" && console.warn(fe);
|
|
62
62
|
}, { immediate: !0 });
|
|
63
|
-
let
|
|
64
|
-
id:
|
|
65
|
-
desc:
|
|
66
|
-
}] : []),
|
|
63
|
+
let N = r(() => Le(v.page.value, C.value.pageCount, C.value.totalCount, M.value)), P = r(() => De(v.page.value, v.perPage.value, C.value.pageCount, C.value.totalCount, M.value)), F = r(() => Se(v.perPage.value)), I = r(() => Re(C.value.stickyHeader)), L = r(() => ze(C.value.stickyHeader)), _t = r(() => v.sorting.value ? [{
|
|
64
|
+
id: v.sorting.value.id,
|
|
65
|
+
desc: v.sorting.value.desc
|
|
66
|
+
}] : []), vt = r(() => l(v.filters.value ?? {}, (e, t) => ({
|
|
67
67
|
id: t,
|
|
68
68
|
value: e
|
|
69
|
-
}))),
|
|
70
|
-
let e =
|
|
69
|
+
}))), yt = r(() => Ge(v.selection.value)), R = r(() => v.hiddenColumns.value ?? ut), bt = r(() => ae(R.value.map((e) => [e, !1]))), xt = r(() => {
|
|
70
|
+
let e = O.value.map((e) => ({
|
|
71
71
|
id: e.id,
|
|
72
72
|
enableSorting: e.sortable === !0,
|
|
73
73
|
enableHiding: e.hideable !== !1,
|
|
74
|
-
enableColumnFilter:
|
|
74
|
+
enableColumnFilter: m(e),
|
|
75
75
|
header: () => e.header,
|
|
76
76
|
cell: (t) => e.cell?.(t.row.original) ?? null,
|
|
77
|
-
accessorFn: (t) =>
|
|
77
|
+
accessorFn: (t) => f(t, e),
|
|
78
78
|
filterFn: (e, t, n) => {
|
|
79
79
|
let r = oe(n) ? n : [];
|
|
80
80
|
return se(r) ? !0 : r.includes(String(e.getValue(t) ?? ""));
|
|
81
81
|
}
|
|
82
82
|
}));
|
|
83
83
|
return ie([
|
|
84
|
-
|
|
85
|
-
...
|
|
84
|
+
A.value ? {
|
|
85
|
+
...st,
|
|
86
86
|
id: d
|
|
87
87
|
} : void 0,
|
|
88
|
-
|
|
89
|
-
...
|
|
88
|
+
ht.value ? {
|
|
89
|
+
...st,
|
|
90
90
|
id: u
|
|
91
91
|
} : void 0,
|
|
92
92
|
...e
|
|
93
93
|
]);
|
|
94
|
-
}),
|
|
95
|
-
data:
|
|
94
|
+
}), z = at({
|
|
95
|
+
data: mt,
|
|
96
96
|
enableSortingRemoval: !0,
|
|
97
|
-
features:
|
|
97
|
+
features: dt,
|
|
98
98
|
get columns() {
|
|
99
|
-
return
|
|
99
|
+
return xt.value;
|
|
100
100
|
},
|
|
101
101
|
get manualSorting() {
|
|
102
|
-
return
|
|
102
|
+
return N.value;
|
|
103
103
|
},
|
|
104
104
|
get manualFiltering() {
|
|
105
|
-
return
|
|
105
|
+
return N.value;
|
|
106
106
|
},
|
|
107
107
|
get enableHiding() {
|
|
108
|
-
return
|
|
108
|
+
return j.value;
|
|
109
109
|
},
|
|
110
110
|
get enableRowSelection() {
|
|
111
|
-
return
|
|
111
|
+
return A.value;
|
|
112
112
|
},
|
|
113
113
|
get enableMultiRowSelection() {
|
|
114
|
-
return
|
|
114
|
+
return gt.value;
|
|
115
115
|
},
|
|
116
|
-
getRowId: (e, t) =>
|
|
116
|
+
getRowId: (e, t) => Ve(e, t, C.value.getRowId),
|
|
117
117
|
onRowSelectionChange: (e) => {
|
|
118
|
-
let t = c(e) ? e(
|
|
119
|
-
|
|
118
|
+
let t = c(e) ? e(yt.value) : e;
|
|
119
|
+
v.selection.value = We(t);
|
|
120
120
|
},
|
|
121
121
|
onSortingChange: (e) => {
|
|
122
|
-
let t = c(e) ? e(
|
|
123
|
-
|
|
122
|
+
let t = c(e) ? e(_t.value) : e, n = s(t);
|
|
123
|
+
v.sorting.value = n ? {
|
|
124
124
|
id: n.id,
|
|
125
125
|
desc: n.desc
|
|
126
126
|
} : null;
|
|
127
127
|
},
|
|
128
128
|
state: {
|
|
129
129
|
get sorting() {
|
|
130
|
-
return
|
|
130
|
+
return _t.value;
|
|
131
131
|
},
|
|
132
132
|
get rowSelection() {
|
|
133
|
-
return
|
|
133
|
+
return yt.value;
|
|
134
134
|
},
|
|
135
135
|
get columnFilters() {
|
|
136
|
-
return
|
|
136
|
+
return vt.value;
|
|
137
137
|
},
|
|
138
138
|
get columnVisibility() {
|
|
139
|
-
return
|
|
139
|
+
return bt.value;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
}),
|
|
143
|
-
let e =
|
|
144
|
-
if (
|
|
145
|
-
let t =
|
|
146
|
-
return e.filter((e) =>
|
|
147
|
-
}),
|
|
148
|
-
let e = (s(
|
|
149
|
-
let t = o(
|
|
142
|
+
}), B = r(() => {
|
|
143
|
+
let e = z.getRowModel().rows;
|
|
144
|
+
if (N.value) return e;
|
|
145
|
+
let t = v.search.value ?? "", n = R.value;
|
|
146
|
+
return e.filter((e) => He(e.original, O.value, v.columnSearch.value, n) ? Ue(e.original, O.value, t, n) : !1);
|
|
147
|
+
}), V = r(() => P.value ? Ye(B.value, v.page.value ?? 1, F.value) : B.value), H = r(() => l(V.value, "id")), St = r(() => Ce(H.value, v.selection.value ?? [])), U = r(() => {
|
|
148
|
+
let e = (s(z.getHeaderGroups())?.headers ?? []).map((e) => {
|
|
149
|
+
let t = o(k.value, e.column.id);
|
|
150
150
|
return {
|
|
151
151
|
column: t,
|
|
152
152
|
id: e.column.id,
|
|
@@ -155,9 +155,9 @@ function S(ot, st, h) {
|
|
|
155
155
|
isExpand: e.column.id === u,
|
|
156
156
|
isSelection: e.column.id === d
|
|
157
157
|
};
|
|
158
|
-
}), t =
|
|
158
|
+
}), t = p(e, I.value ? 20 : 10);
|
|
159
159
|
return e.map((e) => {
|
|
160
|
-
let n = o(t, e.id), r = e.column?.sortable ? pe(
|
|
160
|
+
let n = o(t, e.id), r = e.column?.sortable ? pe(v.sorting.value ?? null, e.id) : "none";
|
|
161
161
|
return {
|
|
162
162
|
ariaSort: r,
|
|
163
163
|
id: e.id,
|
|
@@ -172,32 +172,32 @@ function S(ot, st, h) {
|
|
|
172
172
|
stickyEdge: n?.edge === !0,
|
|
173
173
|
ellipsis: e.column?.ellipsis === !0,
|
|
174
174
|
sortable: e.column?.sortable === !0,
|
|
175
|
-
sortIcon:
|
|
175
|
+
sortIcon: Te(r),
|
|
176
176
|
hideable: e.column?.hideable !== !1,
|
|
177
177
|
filterOptions: e.column?.filters ?? [],
|
|
178
|
-
filterable:
|
|
179
|
-
searchable:
|
|
178
|
+
filterable: m(e.column),
|
|
179
|
+
searchable: h(e.column),
|
|
180
180
|
filterMultiple: e.column?.filterMultiple !== !1,
|
|
181
|
-
searchQuery:
|
|
182
|
-
filterValues:
|
|
183
|
-
filterActive:
|
|
181
|
+
searchQuery: ge(v.columnSearch.value, e.id),
|
|
182
|
+
filterValues: he(v.filters.value, e.id),
|
|
183
|
+
filterActive: Oe(v.filters.value, e.id) || ke(v.columnSearch.value, e.id)
|
|
184
184
|
};
|
|
185
185
|
});
|
|
186
|
-
}),
|
|
187
|
-
let e =
|
|
186
|
+
}), W = r(() => {
|
|
187
|
+
let e = p(U.value.map((e) => ({
|
|
188
188
|
id: e.id,
|
|
189
189
|
width: e.width,
|
|
190
190
|
sticky: e.sticky,
|
|
191
191
|
isExpand: e.isExpand,
|
|
192
192
|
isSelection: e.isSelection
|
|
193
193
|
})), 1);
|
|
194
|
-
return
|
|
194
|
+
return V.value.map((t) => ({
|
|
195
195
|
id: t.id,
|
|
196
196
|
original: t.original,
|
|
197
|
-
expanded: (
|
|
198
|
-
selected: (
|
|
197
|
+
expanded: (v.expanded.value ?? []).includes(t.id),
|
|
198
|
+
selected: (v.selection.value ?? []).includes(t.id),
|
|
199
199
|
cells: t.getVisibleCells().map((n) => {
|
|
200
|
-
let r = o(
|
|
200
|
+
let r = o(k.value, n.column.id), i = o(e, n.column.id), a = r ? f(t.original, r) : void 0;
|
|
201
201
|
return {
|
|
202
202
|
tooltip: r?.ellipsis === !0 && !ce(a) && a !== "" ? String(a) : void 0,
|
|
203
203
|
value: a,
|
|
@@ -211,111 +211,98 @@ function S(ot, st, h) {
|
|
|
211
211
|
ellipsis: r?.ellipsis === !0,
|
|
212
212
|
isExpand: n.column.id === u,
|
|
213
213
|
isSelection: n.column.id === d,
|
|
214
|
-
content: r?.cell ? r.cell(t.original) :
|
|
214
|
+
content: r?.cell ? r.cell(t.original) : _e(a)
|
|
215
215
|
};
|
|
216
216
|
})
|
|
217
217
|
}));
|
|
218
|
-
}),
|
|
219
|
-
if (!
|
|
220
|
-
perPage:
|
|
221
|
-
clientPaged:
|
|
222
|
-
pageCount:
|
|
223
|
-
totalCount:
|
|
224
|
-
filteredCount:
|
|
218
|
+
}), Ct = r(() => U.value.length), G = r(() => Ne(v.perPage.value, x?.vnode.props?.["onUpdate:perPage"] !== void 0, !!b.perPage)), K = r(() => {
|
|
219
|
+
if (!M.value) return xe({
|
|
220
|
+
perPage: v.perPage.value,
|
|
221
|
+
clientPaged: P.value,
|
|
222
|
+
pageCount: C.value.pageCount,
|
|
223
|
+
totalCount: C.value.totalCount,
|
|
224
|
+
filteredCount: B.value.length
|
|
225
225
|
});
|
|
226
|
-
}),
|
|
226
|
+
}), q = r(() => A.value), J = r(() => !!b.pagination || M.value || K.value !== void 0), wt = r(() => q.value || J.value || G.value), Tt = r(() => W.value.length === 0), Et = r(() => e(T.value?.root, ft.value, { class: g({ [L.value ? "" : o(E.value, "root") ?? ""]: !0 }) })), Dt = r(() => U.value.some((e) => e.ellipsis)), Ot = r(() => U.value.some((e) => !!e.stickyStyle)), Y = ee({
|
|
227
227
|
end: !1,
|
|
228
228
|
start: !1
|
|
229
|
-
}),
|
|
230
|
-
function
|
|
231
|
-
let t = e ?
|
|
229
|
+
}), X;
|
|
230
|
+
function Z(e) {
|
|
231
|
+
let t = e ? Ee(e.scrollLeft, e.scrollWidth, e.clientWidth) : {
|
|
232
232
|
end: !1,
|
|
233
233
|
start: !1
|
|
234
234
|
};
|
|
235
|
-
(
|
|
235
|
+
(Y.value.end !== t.end || Y.value.start !== t.start) && (Y.value = t);
|
|
236
236
|
}
|
|
237
|
-
function Y(e) {
|
|
238
|
-
q?.disconnect(), q = void 0, J(e), e && typeof ResizeObserver < "u" && (q = new ResizeObserver(() => {
|
|
239
|
-
J(e);
|
|
240
|
-
}), q.observe(e));
|
|
241
|
-
}
|
|
242
|
-
let X = ee(!1), Z;
|
|
243
237
|
function Q(e) {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}));
|
|
247
|
-
}
|
|
248
|
-
function Nt(e) {
|
|
249
|
-
let t = e.el;
|
|
250
|
-
Q(t instanceof HTMLElement ? t : null);
|
|
238
|
+
X?.disconnect(), X = void 0, Z(e), e && typeof ResizeObserver < "u" && (X = new ResizeObserver(() => {
|
|
239
|
+
Z(e);
|
|
240
|
+
}), X.observe(e));
|
|
251
241
|
}
|
|
252
|
-
function
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
function Ft(e) {
|
|
256
|
-
let t = S.value?.wrapper?.onScroll;
|
|
242
|
+
function kt(e) {
|
|
243
|
+
let t = T.value?.wrapper?.onScroll;
|
|
257
244
|
c(t) && t(e);
|
|
258
245
|
let n = e.currentTarget;
|
|
259
|
-
n instanceof HTMLElement &&
|
|
246
|
+
n instanceof HTMLElement && Z(n);
|
|
260
247
|
}
|
|
261
|
-
function
|
|
262
|
-
let n =
|
|
248
|
+
function At(e, t) {
|
|
249
|
+
let n = T.value?.wrapper?.[e];
|
|
263
250
|
c(n) && n(t);
|
|
264
251
|
}
|
|
265
|
-
function
|
|
266
|
-
|
|
252
|
+
function jt(e) {
|
|
253
|
+
At("onVnodeMounted", e);
|
|
267
254
|
let t = e.el;
|
|
268
|
-
|
|
255
|
+
Q(t instanceof HTMLElement ? t : null);
|
|
269
256
|
}
|
|
270
|
-
function
|
|
271
|
-
|
|
257
|
+
function Mt(e) {
|
|
258
|
+
At("onVnodeUnmounted", e), Q(null);
|
|
272
259
|
}
|
|
273
260
|
a(() => {
|
|
274
|
-
|
|
261
|
+
Q(null);
|
|
275
262
|
});
|
|
276
|
-
let
|
|
277
|
-
size:
|
|
278
|
-
variant:
|
|
279
|
-
rounded:
|
|
280
|
-
full:
|
|
281
|
-
striped:
|
|
282
|
-
stickyHeader:
|
|
283
|
-
hoverable:
|
|
263
|
+
let Nt = r(() => ({
|
|
264
|
+
size: C.value.size,
|
|
265
|
+
variant: C.value.variant,
|
|
266
|
+
rounded: C.value.rounded,
|
|
267
|
+
full: C.value.full !== !1,
|
|
268
|
+
striped: C.value.striped === !0,
|
|
269
|
+
stickyHeader: I.value,
|
|
270
|
+
hoverable: C.value.hoverable === !0,
|
|
284
271
|
customProps: {
|
|
285
272
|
table: {
|
|
286
|
-
...
|
|
287
|
-
"aria-busy":
|
|
273
|
+
...T.value?.table,
|
|
274
|
+
"aria-busy": C.value.loading || void 0
|
|
288
275
|
},
|
|
289
276
|
root: {
|
|
290
|
-
...
|
|
291
|
-
onScroll:
|
|
292
|
-
onVnodeMounted:
|
|
293
|
-
onVnodeUnmounted:
|
|
277
|
+
...T.value?.wrapper,
|
|
278
|
+
onScroll: kt,
|
|
279
|
+
onVnodeMounted: jt,
|
|
280
|
+
onVnodeUnmounted: Mt
|
|
294
281
|
}
|
|
295
282
|
},
|
|
296
283
|
classes: {
|
|
297
|
-
row: o(
|
|
298
|
-
body: o(
|
|
299
|
-
cell: o(
|
|
300
|
-
head: o(
|
|
301
|
-
header:
|
|
302
|
-
"relative z-40":
|
|
303
|
-
[o(
|
|
284
|
+
row: o(E.value, "row"),
|
|
285
|
+
body: o(E.value, "body"),
|
|
286
|
+
cell: o(E.value, "cell"),
|
|
287
|
+
head: o(E.value, "head"),
|
|
288
|
+
header: g({
|
|
289
|
+
"relative z-40": C.value.loading && C.value.loadingVariant === "bar",
|
|
290
|
+
[o(E.value, "header") ?? ""]: !0
|
|
304
291
|
}),
|
|
305
|
-
root:
|
|
306
|
-
"overflow-auto":
|
|
307
|
-
[o(
|
|
308
|
-
[
|
|
292
|
+
root: g({
|
|
293
|
+
"overflow-auto": L.value,
|
|
294
|
+
[o(E.value, "wrapper") ?? ""]: !0,
|
|
295
|
+
[L.value ? o(E.value, "root") ?? "" : ""]: !0
|
|
309
296
|
}),
|
|
310
|
-
table:
|
|
311
|
-
"w-full table-fixed":
|
|
312
|
-
"border-separate border-spacing-0":
|
|
313
|
-
[o(
|
|
297
|
+
table: g({
|
|
298
|
+
"w-full table-fixed": Dt.value,
|
|
299
|
+
"border-separate border-spacing-0": Ot.value && !I.value,
|
|
300
|
+
[o(E.value, "table") ?? ""]: !0
|
|
314
301
|
})
|
|
315
302
|
}
|
|
316
303
|
}));
|
|
317
|
-
function
|
|
318
|
-
let n =
|
|
304
|
+
function Pt(e, t = !1) {
|
|
305
|
+
let n = me(e.width, e.isExpand || e.isSelection), r = t && I.value;
|
|
319
306
|
return {
|
|
320
307
|
...n ? {
|
|
321
308
|
width: n,
|
|
@@ -330,140 +317,140 @@ function S(ot, st, h) {
|
|
|
330
317
|
} : {}
|
|
331
318
|
};
|
|
332
319
|
}
|
|
333
|
-
function
|
|
320
|
+
function Ft(e) {
|
|
334
321
|
return e.isSelection || e.isExpand ? "center" : e.align ?? "start";
|
|
335
322
|
}
|
|
336
|
-
function
|
|
323
|
+
function It(e) {
|
|
337
324
|
return e.isSelection || e.isExpand ? "center" : e.align ?? "start";
|
|
338
325
|
}
|
|
339
|
-
function
|
|
326
|
+
function Lt(t) {
|
|
340
327
|
let n = t.isSelection || t.isExpand;
|
|
341
|
-
return e(
|
|
342
|
-
style:
|
|
328
|
+
return e(T.value?.head, {}, {
|
|
329
|
+
style: Pt(t, !0),
|
|
343
330
|
"aria-sort": t.sortable ? t.ariaSort : void 0,
|
|
344
|
-
class:
|
|
331
|
+
class: g({
|
|
345
332
|
"min-w-0": !0,
|
|
346
333
|
"border-e-0": n,
|
|
347
334
|
"sticky z-20": !!t.stickyStyle,
|
|
348
335
|
"after:hidden": n,
|
|
349
|
-
[o(
|
|
350
|
-
[o(
|
|
336
|
+
[o(D.value, "cellStickyEdgeStart") ?? ""]: t.sticky === "start" && t.stickyEdge && Y.value.start,
|
|
337
|
+
[o(D.value, "cellStickyEdgeEnd") ?? ""]: t.sticky === "end" && t.stickyEdge && Y.value.end,
|
|
351
338
|
[t.classes?.header ?? ""]: !0
|
|
352
339
|
})
|
|
353
340
|
});
|
|
354
341
|
}
|
|
355
|
-
function
|
|
342
|
+
function Rt(t) {
|
|
356
343
|
let n = t.isSelection || t.isExpand;
|
|
357
|
-
return e(
|
|
358
|
-
style:
|
|
359
|
-
class:
|
|
344
|
+
return e(T.value?.cell, {}, {
|
|
345
|
+
style: Pt(t),
|
|
346
|
+
class: g({
|
|
360
347
|
"min-w-0": !0,
|
|
361
348
|
"overflow-hidden": t.ellipsis,
|
|
362
349
|
"border-e-0": n,
|
|
363
350
|
"after:hidden": n,
|
|
364
|
-
[o(
|
|
365
|
-
[o(
|
|
366
|
-
[o(
|
|
351
|
+
[o(D.value, "cellSticky") ?? ""]: !!t.stickyStyle,
|
|
352
|
+
[o(D.value, "cellStickyEdgeStart") ?? ""]: t.sticky === "start" && t.stickyEdge && Y.value.start,
|
|
353
|
+
[o(D.value, "cellStickyEdgeEnd") ?? ""]: t.sticky === "end" && t.stickyEdge && Y.value.end,
|
|
367
354
|
[t.classes?.cell ?? ""]: !0
|
|
368
355
|
})
|
|
369
356
|
});
|
|
370
357
|
}
|
|
371
|
-
let
|
|
358
|
+
let zt = r(() => e(T.value?.toolbar, {}, { class: g({
|
|
372
359
|
"flex items-center justify-between gap-3 pb-3": !0,
|
|
373
|
-
[o(
|
|
374
|
-
}) })),
|
|
360
|
+
[o(E.value, "toolbar") ?? ""]: !0
|
|
361
|
+
}) })), Bt = r(() => e(T.value?.empty, {}, { class: g({
|
|
375
362
|
"w-full": !0,
|
|
376
|
-
[o(
|
|
377
|
-
}) })),
|
|
378
|
-
"absolute inset-0 z-30 bg-white/50 dark:bg-dark-
|
|
379
|
-
"flex items-center justify-center":
|
|
380
|
-
[o(
|
|
381
|
-
}) })),
|
|
382
|
-
"w-0 min-w-full":
|
|
383
|
-
"border-t border-dark-200 bg-dark-50 px-3 py-2.5 text-sm text-dark-600 dark:border-dark-700 dark:bg-dark-
|
|
384
|
-
[o(
|
|
385
|
-
}) })), $ = r(() =>
|
|
386
|
-
showPager:
|
|
387
|
-
showPerPage:
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
grow:
|
|
363
|
+
[o(E.value, "empty") ?? ""]: !0
|
|
364
|
+
}) })), Vt = r(() => e(T.value?.loading, {}, { class: g({
|
|
365
|
+
"absolute inset-0 z-30 bg-white/50 dark:bg-dark-800/50": !0,
|
|
366
|
+
"flex items-center justify-center": C.value.loadingVariant !== "bar",
|
|
367
|
+
[o(E.value, "loading") ?? ""]: !0
|
|
368
|
+
}) })), Ht = r(() => e({}, {}, { class: g({ "pointer-events-none absolute inset-x-0 top-0 z-40": !0 }) })), Ut = r(() => e({}, {}, { class: g({ "w-fit min-w-0 max-w-full": C.value.full === !1 }) })), Wt = r(() => e(T.value?.footer, {}, { class: g({
|
|
369
|
+
"w-0 min-w-full": C.value.full === !1,
|
|
370
|
+
"border-t border-dark-200 bg-dark-50 px-3 py-2.5 text-sm text-dark-600 dark:border-dark-700 dark:bg-dark-700/50 dark:text-dark-300": !0,
|
|
371
|
+
[o(E.value, "footer") ?? ""]: !0
|
|
372
|
+
}) })), $ = r(() => ve({
|
|
373
|
+
showPager: J.value,
|
|
374
|
+
showPerPage: G.value,
|
|
375
|
+
showSelected: q.value
|
|
376
|
+
})), Gt = r(() => e(T.value?.selected, {}, { class: g({
|
|
377
|
+
grow: $.value.breakpoint === null,
|
|
378
|
+
"@lg/footer:grow": $.value.breakpoint === "compact",
|
|
379
|
+
"@2xl/footer:grow": $.value.breakpoint === "wide",
|
|
392
380
|
"whitespace-nowrap text-sm text-dark-500 dark:text-dark-400": !0,
|
|
393
|
-
[o(
|
|
394
|
-
}) })),
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
h.sorting.value = nt(h.sorting.value ?? null, e);
|
|
381
|
+
[o(E.value, "selected") ?? ""]: !0
|
|
382
|
+
}) })), Kt = r(() => e(T.value?.footerBar, {}, { class: g({
|
|
383
|
+
"@container/footer": !0,
|
|
384
|
+
"w-full": C.value.full !== !1,
|
|
385
|
+
"w-0 min-w-full": C.value.full === !1,
|
|
386
|
+
[o(E.value, "footerBar") ?? ""]: !0
|
|
387
|
+
}) })), qt = r(() => e({}, {}, { class: g({
|
|
388
|
+
"flex w-full items-center gap-3 py-3 [&>*]:shrink-0": !0,
|
|
389
|
+
"flex-row": $.value.breakpoint === null,
|
|
390
|
+
"flex-col justify-center": $.value.breakpoint !== null,
|
|
391
|
+
"@lg/footer:flex-row @lg/footer:flex-wrap @lg/footer:justify-between @lg/footer:[&>:last-child]:ml-auto": $.value.breakpoint === "compact",
|
|
392
|
+
"@2xl/footer:flex-row @2xl/footer:flex-wrap @2xl/footer:justify-between @2xl/footer:[&>:last-child]:ml-auto": $.value.breakpoint === "wide",
|
|
393
|
+
"justify-end": $.value.justify === "end",
|
|
394
|
+
"justify-start": $.value.justify === "start",
|
|
395
|
+
[o(E.value, "pagination") ?? ""]: !0
|
|
396
|
+
}) }));
|
|
397
|
+
function Jt(e) {
|
|
398
|
+
v.sorting.value = $e(v.sorting.value ?? null, e);
|
|
412
399
|
}
|
|
413
|
-
function
|
|
414
|
-
|
|
400
|
+
function Yt(e, t) {
|
|
401
|
+
v.selection.value = Je(v.selection.value ?? [], e, t, C.value.selectionMode);
|
|
415
402
|
}
|
|
416
|
-
function
|
|
417
|
-
|
|
403
|
+
function Xt(e) {
|
|
404
|
+
v.perPage.value = e, v.page.value !== 1 && (v.page.value = 1);
|
|
418
405
|
}
|
|
419
|
-
function
|
|
420
|
-
|
|
406
|
+
function Zt(e) {
|
|
407
|
+
v.search.value = e, v.page.value !== 1 && (v.page.value = 1);
|
|
421
408
|
}
|
|
422
|
-
let
|
|
423
|
-
page:
|
|
424
|
-
cursor:
|
|
425
|
-
cursorPaged:
|
|
426
|
-
count:
|
|
427
|
-
nextCursor:
|
|
428
|
-
prevCursor:
|
|
409
|
+
let Qt = r(() => ye({
|
|
410
|
+
page: v.page.value,
|
|
411
|
+
cursor: v.cursor?.value,
|
|
412
|
+
cursorPaged: M.value,
|
|
413
|
+
count: K.value,
|
|
414
|
+
nextCursor: C.value.nextCursor,
|
|
415
|
+
prevCursor: C.value.prevCursor,
|
|
429
416
|
onPageChange: (e) => {
|
|
430
|
-
|
|
417
|
+
v.page.value = e;
|
|
431
418
|
},
|
|
432
419
|
onCursorChange: (e) => {
|
|
433
|
-
|
|
420
|
+
v.cursor && (v.cursor.value = e);
|
|
434
421
|
}
|
|
435
|
-
})),
|
|
436
|
-
perPage:
|
|
437
|
-
onPerPageChange:
|
|
438
|
-
options:
|
|
439
|
-
})),
|
|
440
|
-
selectedCount: (
|
|
441
|
-
totalCount:
|
|
442
|
-
totalCount:
|
|
443
|
-
filteredCount:
|
|
422
|
+
})), $t = r(() => ({
|
|
423
|
+
perPage: F.value,
|
|
424
|
+
onPerPageChange: Xt,
|
|
425
|
+
options: be(F.value, C.value.perPageOptions)
|
|
426
|
+
})), en = r(() => ({
|
|
427
|
+
selectedCount: (v.selection.value ?? []).length,
|
|
428
|
+
totalCount: we({
|
|
429
|
+
totalCount: C.value.totalCount,
|
|
430
|
+
filteredCount: B.value.length
|
|
444
431
|
})
|
|
445
432
|
}));
|
|
446
|
-
function
|
|
447
|
-
|
|
433
|
+
function tn(e) {
|
|
434
|
+
v.selection.value = Ze(v.selection.value ?? [], H.value, e);
|
|
448
435
|
}
|
|
449
|
-
function
|
|
450
|
-
let r = o(
|
|
451
|
-
r?.filters && r.filters.length > 0 && (
|
|
436
|
+
function nn(e, t, n) {
|
|
437
|
+
let r = o(k.value, e);
|
|
438
|
+
r?.filters && r.filters.length > 0 && (v.filters.value = Ke(v.filters.value, e, t)), h(r) && (v.columnSearch.value = qe(v.columnSearch.value, e, n)), v.page.value !== 1 && (v.page.value = 1);
|
|
452
439
|
}
|
|
453
|
-
function
|
|
454
|
-
|
|
440
|
+
function rn(e, t) {
|
|
441
|
+
v.expanded.value = Qe(v.expanded.value ?? [], e, t);
|
|
455
442
|
}
|
|
456
|
-
function
|
|
457
|
-
|
|
443
|
+
function an(e, t) {
|
|
444
|
+
v.hiddenColumns.value = Xe(v.hiddenColumns.value ?? [], e, t, l(O.value, "id"));
|
|
458
445
|
}
|
|
459
|
-
function
|
|
460
|
-
|
|
446
|
+
function on(e) {
|
|
447
|
+
v.hiddenColumns.value = e;
|
|
461
448
|
}
|
|
462
|
-
let
|
|
463
|
-
if (!
|
|
464
|
-
let e = l(
|
|
465
|
-
return
|
|
466
|
-
let n = o(
|
|
449
|
+
let sn = r(() => {
|
|
450
|
+
if (!O.value.some((e) => e.summary !== void 0)) return null;
|
|
451
|
+
let e = l(B.value, "original");
|
|
452
|
+
return U.value.map((t) => {
|
|
453
|
+
let n = o(k.value, t.id);
|
|
467
454
|
return {
|
|
468
455
|
id: t.id,
|
|
469
456
|
ellipsis: !1,
|
|
@@ -480,65 +467,66 @@ function S(ot, st, h) {
|
|
|
480
467
|
content: t.isSelection || t.isExpand ? null : n?.summary?.(e) ?? null
|
|
481
468
|
};
|
|
482
469
|
});
|
|
483
|
-
}),
|
|
470
|
+
}), cn = r(() => O.value.map((e) => ({
|
|
484
471
|
id: e.id,
|
|
485
472
|
hideable: e.hideable !== !1,
|
|
486
|
-
hidden:
|
|
473
|
+
hidden: R.value.includes(e.id),
|
|
487
474
|
label: le(e.header) ? e.header : e.id
|
|
488
|
-
}))),
|
|
475
|
+
}))), ln = r(() => Pe(v.search.value, x?.vnode.props?.["onUpdate:search"] !== void 0, b.search !== void 0, C.value.showSearch));
|
|
489
476
|
return {
|
|
490
|
-
merged:
|
|
491
|
-
pageIds:
|
|
492
|
-
rowViews:
|
|
493
|
-
rootBind:
|
|
494
|
-
emptyBind:
|
|
495
|
-
showEmpty:
|
|
496
|
-
frameBind:
|
|
497
|
-
showPager:
|
|
498
|
-
tableProps:
|
|
499
|
-
footerBind:
|
|
500
|
-
showSearch:
|
|
501
|
-
getHeadBind:
|
|
502
|
-
headerViews:
|
|
503
|
-
loadingBind:
|
|
504
|
-
onToggleRow:
|
|
505
|
-
toolbarBind:
|
|
506
|
-
getCellBind:
|
|
507
|
-
columnCount:
|
|
508
|
-
clientPaged:
|
|
509
|
-
cursorPaged:
|
|
510
|
-
serverPaged:
|
|
511
|
-
showPerPage:
|
|
512
|
-
showToolbar: r(() => !!
|
|
513
|
-
selectedBind:
|
|
514
|
-
showSelected:
|
|
515
|
-
getHeadAlign:
|
|
516
|
-
getCellAlign:
|
|
517
|
-
onTogglePage:
|
|
518
|
-
onToggleSort:
|
|
519
|
-
summaryCells:
|
|
520
|
-
showFooterBar:
|
|
521
|
-
expandEnabled:
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
477
|
+
merged: C,
|
|
478
|
+
pageIds: H,
|
|
479
|
+
rowViews: W,
|
|
480
|
+
rootBind: Et,
|
|
481
|
+
emptyBind: Bt,
|
|
482
|
+
showEmpty: Tt,
|
|
483
|
+
frameBind: Ut,
|
|
484
|
+
showPager: J,
|
|
485
|
+
tableProps: Nt,
|
|
486
|
+
footerBind: Wt,
|
|
487
|
+
showSearch: ln,
|
|
488
|
+
getHeadBind: Lt,
|
|
489
|
+
headerViews: U,
|
|
490
|
+
loadingBind: Vt,
|
|
491
|
+
onToggleRow: Yt,
|
|
492
|
+
toolbarBind: zt,
|
|
493
|
+
getCellBind: Rt,
|
|
494
|
+
columnCount: Ct,
|
|
495
|
+
clientPaged: P,
|
|
496
|
+
cursorPaged: M,
|
|
497
|
+
serverPaged: N,
|
|
498
|
+
showPerPage: G,
|
|
499
|
+
showToolbar: r(() => !!b.toolbar || !!b.toolbarActions || j.value || ln.value),
|
|
500
|
+
selectedBind: Gt,
|
|
501
|
+
showSelected: q,
|
|
502
|
+
getHeadAlign: Ft,
|
|
503
|
+
getCellAlign: It,
|
|
504
|
+
onTogglePage: tn,
|
|
505
|
+
onToggleSort: Jt,
|
|
506
|
+
summaryCells: sn,
|
|
507
|
+
showFooterBar: wt,
|
|
508
|
+
expandEnabled: ht,
|
|
509
|
+
footerBarBind: Kt,
|
|
510
|
+
onChangeSearch: Zt,
|
|
511
|
+
loadingBarBind: Ht,
|
|
512
|
+
paginationBind: qt,
|
|
513
|
+
selectAllState: St,
|
|
514
|
+
onToggleExpand: rn,
|
|
515
|
+
visibilityItems: cn,
|
|
516
|
+
onChangePerPage: Xt,
|
|
517
|
+
resolvedPerPage: F,
|
|
518
|
+
selectionEnabled: A,
|
|
519
|
+
perPageSlotProps: $t,
|
|
520
|
+
selectedSlotProps: en,
|
|
521
|
+
resolvedPageCount: K,
|
|
522
|
+
selectionMultiple: gt,
|
|
523
|
+
visibilityEnabled: j,
|
|
524
|
+
paginationSlotProps: Qt,
|
|
525
|
+
onCommitColumnFilter: nn,
|
|
526
|
+
onHiddenColumnsChange: on,
|
|
527
|
+
onToggleColumnVisibility: an,
|
|
528
|
+
loadingBar: r(() => C.value.loadingVariant === "bar")
|
|
541
529
|
};
|
|
542
530
|
}
|
|
543
531
|
//#endregion
|
|
544
|
-
export {
|
|
532
|
+
export { T as useDataTable };
|