@soft-stech/bootsman-ui-shadcn 2.0.21 → 2.0.23
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/BuiPaginationCommon.vue_vue_type_script_setup_true_lang-BOuWIF4c.js +179 -0
- package/dist/{BuiScrollArea.vue_vue_type_script_setup_true_lang-O7VUcRC4.js → BuiScrollArea.vue_vue_type_script_setup_true_lang-lyWD8KAT.js} +1 -1
- package/dist/{BuiScrollBar.vue_vue_type_script_setup_true_lang-cV0od8j0.js → BuiScrollBar.vue_vue_type_script_setup_true_lang-BCvjzEmb.js} +4 -4
- package/dist/BuiTable.vue_vue_type_script_setup_true_lang-BQRl7YR1.js +37 -0
- package/dist/{BuiTableEmpty.vue_vue_type_script_setup_true_lang-Da4qHIWo.js → BuiTableEmpty.vue_vue_type_script_setup_true_lang-CuffOAuP.js} +1 -1
- package/dist/BuiTableRow.vue_vue_type_script_setup_true_lang-BQnadEa7.js +51 -0
- package/dist/components/pagination/BuiPaginationCommon.js +1 -1
- package/dist/components/pagination/BuiPaginationCommon.vue.d.ts +4 -0
- package/dist/components/pagination/index.js +1 -1
- package/dist/components/scroll-area/BuiScrollArea.js +1 -1
- package/dist/components/scroll-area/BuiScrollBar.js +1 -1
- package/dist/components/scroll-area/index.js +2 -2
- package/dist/components/table/BuiDataTable.vue.d.ts +8 -4
- package/dist/components/table/BuiTable.js +1 -1
- package/dist/components/table/BuiTableEmpty.js +1 -1
- package/dist/components/table/BuiTableRow.js +1 -1
- package/dist/components/table/index.d.ts +1 -0
- package/dist/components/table/index.js +721 -671
- package/dist/index.js +6 -6
- package/dist/lib/useResizeColumns.js +24 -22
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/pagination/BuiPaginationCommon.vue +16 -4
- package/src/components/scroll-area/BuiScrollBar.vue +4 -4
- package/src/components/table/BuiDataTable.vue +135 -26
- package/src/components/table/BuiTable.vue +1 -0
- package/src/components/table/BuiTableRow.vue +6 -0
- package/src/components/table/index.ts +2 -0
- package/src/lib/useResizeColumns.ts +13 -1
- package/src/stories/BuiDataTable.stories.ts +13 -0
- package/src/stories/components/BuiDataTableStory.vue +3 -3
- package/src/stories/components/BuiDataTableWithScrollStory.vue +292 -0
- package/dist/BuiPaginationCommon.vue_vue_type_script_setup_true_lang-DhSRYKth.js +0 -170
- package/dist/BuiTable.vue_vue_type_script_setup_true_lang-CQpc0Sr1.js +0 -36
- package/dist/BuiTableRow.vue_vue_type_script_setup_true_lang-BJk8Yk1B.js +0 -54
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { BuiDataTable } from '@/components/table'
|
|
3
|
+
import RowActionsMenuContent from './ActionsMenuContent.vue'
|
|
4
|
+
import type {
|
|
5
|
+
ColumnDef,
|
|
6
|
+
PaginationState,
|
|
7
|
+
Row,
|
|
8
|
+
RowSelectionState,
|
|
9
|
+
VisibilityState,
|
|
10
|
+
ColumnOrderState
|
|
11
|
+
} from '@tanstack/vue-table'
|
|
12
|
+
import { sort, type ISortByObjectSorter } from 'fast-sort'
|
|
13
|
+
import {
|
|
14
|
+
AlignJustifyIcon,
|
|
15
|
+
ArrowUpNarrowWideIcon,
|
|
16
|
+
FolderIcon,
|
|
17
|
+
SignalHighIcon,
|
|
18
|
+
SignalMediumIcon,
|
|
19
|
+
SignalLowIcon
|
|
20
|
+
} from 'lucide-vue-next'
|
|
21
|
+
import { computed, h, ref, withModifiers } from 'vue'
|
|
22
|
+
import { z } from 'zod'
|
|
23
|
+
import tasks from '@/stories/data/tasks.json'
|
|
24
|
+
import { BuiCheckbox } from '@/components/checkbox'
|
|
25
|
+
import { tableColumnSortCommon } from '@/lib/utils'
|
|
26
|
+
import { BuiButton } from '@/components/button'
|
|
27
|
+
import { BuiTabs, BuiTabsList, BuiTabsTrigger } from '@/components/tabs'
|
|
28
|
+
|
|
29
|
+
const taskSchema = z.object({
|
|
30
|
+
id: z.string(),
|
|
31
|
+
title: z.string(),
|
|
32
|
+
status: z.string().nullable().optional(),
|
|
33
|
+
label: z.string(),
|
|
34
|
+
priority: z.string(),
|
|
35
|
+
errorMessage: z.string().optional(),
|
|
36
|
+
age: z.string().optional()
|
|
37
|
+
})
|
|
38
|
+
type Task = z.infer<typeof taskSchema>
|
|
39
|
+
|
|
40
|
+
const columns: ColumnDef<Task>[] = [
|
|
41
|
+
{
|
|
42
|
+
id: 'id',
|
|
43
|
+
accessorKey: 'id',
|
|
44
|
+
header: ({ table, column }) => {
|
|
45
|
+
return h('div', { class: 'flex items-center gap-2' }, [
|
|
46
|
+
h(BuiCheckbox, {
|
|
47
|
+
modelValue: table.getIsSomePageRowsSelected()
|
|
48
|
+
? 'indeterminate'
|
|
49
|
+
: table.getIsAllPageRowsSelected(),
|
|
50
|
+
'onUpdate:modelValue': (value: boolean | 'indeterminate') =>
|
|
51
|
+
table.getIsSomePageRowsSelected()
|
|
52
|
+
? table.toggleAllPageRowsSelected(false)
|
|
53
|
+
: table.toggleAllPageRowsSelected(!!value),
|
|
54
|
+
ariaLabel: 'Select row',
|
|
55
|
+
onClick: withModifiers(() => {}, ['stop'])
|
|
56
|
+
}),
|
|
57
|
+
tableColumnSortCommon(column, 'ID')
|
|
58
|
+
])
|
|
59
|
+
},
|
|
60
|
+
cell: ({ row }) =>
|
|
61
|
+
h('div', { class: 'flex items-center gap-2' }, [
|
|
62
|
+
h(BuiCheckbox, {
|
|
63
|
+
modelValue: row.getIsSelected(),
|
|
64
|
+
'onUpdate:modelValue': (value: boolean | 'indeterminate') => row.toggleSelected(!!value),
|
|
65
|
+
ariaLabel: 'Select row'
|
|
66
|
+
}),
|
|
67
|
+
`${row.getValue('id')}`
|
|
68
|
+
]),
|
|
69
|
+
enableHiding: false,
|
|
70
|
+
meta: { title: 'ID', pinLeft: true }
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
accessorKey: 'title',
|
|
74
|
+
header: 'Title',
|
|
75
|
+
enableSorting: false
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
accessorKey: 'status',
|
|
79
|
+
header: ({ column }) => tableColumnSortCommon(column, 'Очень длинный заголовок для статуса'),
|
|
80
|
+
meta: { title: 'Статус таска' }
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
accessorKey: 'priority',
|
|
84
|
+
header: ({ column }) => tableColumnSortCommon(column, 'Priorities')
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
accessorKey: 'age',
|
|
88
|
+
header: ({ column }) => tableColumnSortCommon(column, 'Age')
|
|
89
|
+
},
|
|
90
|
+
{ id: 'hiddenColumn', header: 'Hidden Column', cell: 'secret info' }
|
|
91
|
+
]
|
|
92
|
+
const data = ref<Task[]>(tasks)
|
|
93
|
+
|
|
94
|
+
function onRowAction(row: Task, action: string) {
|
|
95
|
+
const str = `${action}: ${row.id}`
|
|
96
|
+
alert(str)
|
|
97
|
+
}
|
|
98
|
+
function onGroupAction(group: string | number, action: string) {
|
|
99
|
+
const str = `${action}: ${group}`
|
|
100
|
+
alert(str)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
type TaskSortingState = { id: keyof Task; desc: boolean }
|
|
104
|
+
const sorting = ref<TaskSortingState[]>([{ id: 'id', desc: false }])
|
|
105
|
+
const pagination = ref<PaginationState>({
|
|
106
|
+
pageIndex: 0,
|
|
107
|
+
pageSize: 10
|
|
108
|
+
})
|
|
109
|
+
const totalItems = tasks.length
|
|
110
|
+
|
|
111
|
+
const selection = ref<RowSelectionState | undefined>({})
|
|
112
|
+
function updateSelection(val?: RowSelectionState) {
|
|
113
|
+
console.log('selection was changed', val)
|
|
114
|
+
selection.value = val
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const columnVisibility = ref<VisibilityState>({ hiddenColumn: false })
|
|
118
|
+
const columnSizing = ref<Record<string, number>>({ title: 450 })
|
|
119
|
+
const columnOrder = ref<ColumnOrderState>()
|
|
120
|
+
|
|
121
|
+
type GroupBy = 'none' | 'status' | 'priority'
|
|
122
|
+
const groupBy = ref<GroupBy>('none')
|
|
123
|
+
const groupLabels = {
|
|
124
|
+
status: ['Status', 'Not in any status'],
|
|
125
|
+
priority: ['Priority', 'Not in any priorities']
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const sortedData = computed(() => {
|
|
129
|
+
const sortDirection = (sorting.value[0].desc ? 'desc' : 'asc') as 'asc'
|
|
130
|
+
const sortColumn = sorting.value[0].id
|
|
131
|
+
const groupByStr = groupBy.value
|
|
132
|
+
|
|
133
|
+
const sortBy: ISortByObjectSorter<Task> | ISortByObjectSorter<Task>[] = [
|
|
134
|
+
{
|
|
135
|
+
[sortDirection]: sortColumn
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
|
|
139
|
+
// sort by grouping column first, but not when manually sorting by it
|
|
140
|
+
if (groupByStr !== 'none' && sortColumn !== groupByStr) {
|
|
141
|
+
sortBy.unshift({
|
|
142
|
+
asc: groupByStr
|
|
143
|
+
})
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// sort by ID when possible
|
|
147
|
+
if (sortColumn !== 'id') {
|
|
148
|
+
sortBy.push({
|
|
149
|
+
asc: 'id'
|
|
150
|
+
})
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return sort(data.value).by([...sortBy])
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
function renderSubComponent(row: Row<Task>) {
|
|
157
|
+
if (row.original.errorMessage) {
|
|
158
|
+
return () => h('span', { style: 'color: red' }, `Subrow: ${row.original.errorMessage}`)
|
|
159
|
+
} else {
|
|
160
|
+
return undefined
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function deleteRow() {
|
|
165
|
+
data.value = data.value.map((a) => a)
|
|
166
|
+
}
|
|
167
|
+
function updateRows() {
|
|
168
|
+
data.value.shift()
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function groupName(group: string | number) {
|
|
172
|
+
if (groupBy.value === 'priority') {
|
|
173
|
+
if (group === 'high') {
|
|
174
|
+
return () => h(SignalHighIcon, { class: 'size-4 inline-block' })
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (group === 'medium') {
|
|
178
|
+
return () => h(SignalMediumIcon, { class: 'size-4 inline-block' })
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (group === 'low') {
|
|
182
|
+
return () => h(SignalLowIcon, { class: 'size-4 inline-block' })
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return () => group
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return () => group
|
|
189
|
+
}
|
|
190
|
+
</script>
|
|
191
|
+
|
|
192
|
+
<template>
|
|
193
|
+
<Story title="BuiDataTable" autoPropsDisabled :layout="{ type: 'grid', width: '95%' }">
|
|
194
|
+
<Variant key="variant" title="Sorting, Pagination, Grouping, Subrow">
|
|
195
|
+
<div class="page-wrapper">
|
|
196
|
+
<div class="table-wrapper">
|
|
197
|
+
<BuiDataTable
|
|
198
|
+
:columns="columns"
|
|
199
|
+
:data="sortedData"
|
|
200
|
+
v-model:sorting="sorting"
|
|
201
|
+
v-model:pagination="pagination"
|
|
202
|
+
v-model:column-visibility="columnVisibility"
|
|
203
|
+
v-model:column-sizing="columnSizing"
|
|
204
|
+
v-model:column-order="columnOrder"
|
|
205
|
+
@update:selection="updateSelection"
|
|
206
|
+
:total-items="totalItems"
|
|
207
|
+
class="caption-top"
|
|
208
|
+
:manualPagination="false"
|
|
209
|
+
:getRowId="(row) => row.id"
|
|
210
|
+
:groupBy="groupBy === 'none' ? undefined : groupBy"
|
|
211
|
+
:groupLabels="groupLabels"
|
|
212
|
+
:renderSubComponent="renderSubComponent"
|
|
213
|
+
:freeze-header="true"
|
|
214
|
+
enable-column-list-control
|
|
215
|
+
:enable-group-folding="true"
|
|
216
|
+
:pagination-translations="{
|
|
217
|
+
itemsPerPage: 'Tasks per page',
|
|
218
|
+
itemsPerPageAuto: 'Auto',
|
|
219
|
+
page: 'Page',
|
|
220
|
+
of: 'of'
|
|
221
|
+
}"
|
|
222
|
+
>
|
|
223
|
+
<template #caption="{ table }">
|
|
224
|
+
<div class="flex h-fit items-center justify-between">
|
|
225
|
+
<div class="flex h-full flex-row items-center gap-3">
|
|
226
|
+
<BuiButton variant="outline">Download YAML</BuiButton>
|
|
227
|
+
<BuiButton variant="outline" @click="updateRows"> Delete row </BuiButton>
|
|
228
|
+
<BuiButton variant="outline" @click="deleteRow"> Update rows </BuiButton>
|
|
229
|
+
</div>
|
|
230
|
+
|
|
231
|
+
<div class="flex h-full flex-row items-center gap-3">
|
|
232
|
+
<BuiTabs v-model="groupBy">
|
|
233
|
+
<BuiTabsList class="grid w-full grid-cols-3" variant="default">
|
|
234
|
+
<BuiTabsTrigger value="none" variant="default">
|
|
235
|
+
<AlignJustifyIcon :size="14" />
|
|
236
|
+
</BuiTabsTrigger>
|
|
237
|
+
<BuiTabsTrigger value="status" variant="default">
|
|
238
|
+
<FolderIcon :size="14" />
|
|
239
|
+
</BuiTabsTrigger>
|
|
240
|
+
<BuiTabsTrigger value="priority" variant="default">
|
|
241
|
+
<ArrowUpNarrowWideIcon :size="14" />
|
|
242
|
+
</BuiTabsTrigger>
|
|
243
|
+
</BuiTabsList>
|
|
244
|
+
</BuiTabs>
|
|
245
|
+
|
|
246
|
+
<span>
|
|
247
|
+
{{ table.getFilteredSelectedRowModel().rows?.length }} of
|
|
248
|
+
{{ table.getFilteredRowModel().rows?.length }} row(s) selected
|
|
249
|
+
</span>
|
|
250
|
+
</div>
|
|
251
|
+
</div>
|
|
252
|
+
</template>
|
|
253
|
+
<template #nodata>No data</template>
|
|
254
|
+
<template #groupByRow="{ group }"> Optional slot for: `{{ group }}` </template>
|
|
255
|
+
<template #groupName="{ group }">
|
|
256
|
+
<component :is="groupName(group)"></component>
|
|
257
|
+
</template>
|
|
258
|
+
<template #groupActions="{ group }">
|
|
259
|
+
<RowActionsMenuContent
|
|
260
|
+
:actions="['Group action']"
|
|
261
|
+
@select="(action) => onGroupAction(group, action)"
|
|
262
|
+
/>
|
|
263
|
+
</template>
|
|
264
|
+
<template #rowActions="{ row }">
|
|
265
|
+
<RowActionsMenuContent
|
|
266
|
+
:actions="['action 1', 'action 2']"
|
|
267
|
+
@select="(action) => onRowAction(row, action)"
|
|
268
|
+
/>
|
|
269
|
+
</template>
|
|
270
|
+
<template #numberOfItems>{{ data.length }} tasks</template>
|
|
271
|
+
</BuiDataTable>
|
|
272
|
+
</div>
|
|
273
|
+
</div>
|
|
274
|
+
</Variant>
|
|
275
|
+
</Story>
|
|
276
|
+
</template>
|
|
277
|
+
|
|
278
|
+
<style scoped>
|
|
279
|
+
.page-wrapper {
|
|
280
|
+
height: 95vh;
|
|
281
|
+
flex-direction: column;
|
|
282
|
+
flex-grow: 1;
|
|
283
|
+
display: flex;
|
|
284
|
+
overflow: hidden auto;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.table-wrapper {
|
|
288
|
+
height: 100%;
|
|
289
|
+
flex-direction: column;
|
|
290
|
+
display: flex;
|
|
291
|
+
}
|
|
292
|
+
</style>
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { defineComponent as y, computed as I, createBlock as $, openBlock as x, unref as n, normalizeProps as V, guardReactiveProps as w, withCtx as g, renderSlot as E, mergeModels as L, useModel as h, createVNode as i, createElementVNode as S, createElementBlock as M, createCommentVNode as b, toDisplayString as c, Fragment as R, renderList as z, createTextVNode as B } from "vue";
|
|
2
|
-
import { BuiInput as N } from "./components/input/index.js";
|
|
3
|
-
import "vee-validate";
|
|
4
|
-
import { i as k, P as q } from "./PaginationRoot-Xehp56La.js";
|
|
5
|
-
import { u as U } from "./useForwardExpose-DmyWSR4F.js";
|
|
6
|
-
import { P as j } from "./Primitive-EBuBc72_.js";
|
|
7
|
-
import "@vueuse/core";
|
|
8
|
-
import "./colorUtils-BgA4kYw8.js";
|
|
9
|
-
import { _ as C } from "./BuiSelect.vue_vue_type_script_setup_true_lang-BYtbdIZS.js";
|
|
10
|
-
import { _ as F } from "./BuiSelectValue.vue_vue_type_script_setup_true_lang-C3SieHyq.js";
|
|
11
|
-
import { _ as A } from "./BuiSelectTrigger.vue_vue_type_script_setup_true_lang-YgwOKyQg.js";
|
|
12
|
-
import { _ as D } from "./BuiSelectContent.vue_vue_type_script_setup_true_lang-DedLPTOu.js";
|
|
13
|
-
import { _ as T } from "./BuiSelectItem.vue_vue_type_script_setup_true_lang-LEr6XwVT.js";
|
|
14
|
-
import { _ as G } from "./BuiPaginationFirst.vue_vue_type_script_setup_true_lang-CQIWuH4J.js";
|
|
15
|
-
import { _ as H } from "./BuiPaginationLast.vue_vue_type_script_setup_true_lang-DPHBc8bO.js";
|
|
16
|
-
import { _ as J } from "./BuiPaginationNext.vue_vue_type_script_setup_true_lang-CiVMJM-x.js";
|
|
17
|
-
import { _ as K } from "./BuiPaginationPrev.vue_vue_type_script_setup_true_lang-C95kepR5.js";
|
|
18
|
-
function d(a, r) {
|
|
19
|
-
const e = r - a + 1;
|
|
20
|
-
return Array.from({ length: e }, (l, m) => m + a);
|
|
21
|
-
}
|
|
22
|
-
function O(a) {
|
|
23
|
-
return a.map((r) => typeof r == "number" ? {
|
|
24
|
-
type: "page",
|
|
25
|
-
value: r
|
|
26
|
-
} : { type: "ellipsis" });
|
|
27
|
-
}
|
|
28
|
-
const P = "ellipsis";
|
|
29
|
-
function Q(a, r, e, l) {
|
|
30
|
-
const t = r, p = Math.max(a - e, 1), u = Math.min(a + e, t);
|
|
31
|
-
if (l) {
|
|
32
|
-
const f = Math.min(2 * e + 5, r) - 2, s = p > 3 && Math.abs(t - f - 1 + 1) > 2 && Math.abs(p - 1) > 2, v = u < t - 2 && Math.abs(t - f) > 2 && Math.abs(t - u) > 2;
|
|
33
|
-
if (!s && v)
|
|
34
|
-
return [
|
|
35
|
-
...d(1, f),
|
|
36
|
-
P,
|
|
37
|
-
t
|
|
38
|
-
];
|
|
39
|
-
if (s && !v) {
|
|
40
|
-
const _ = d(t - f + 1, t);
|
|
41
|
-
return [
|
|
42
|
-
1,
|
|
43
|
-
P,
|
|
44
|
-
..._
|
|
45
|
-
];
|
|
46
|
-
}
|
|
47
|
-
if (s && v) {
|
|
48
|
-
const _ = d(p, u);
|
|
49
|
-
return [
|
|
50
|
-
1,
|
|
51
|
-
P,
|
|
52
|
-
..._,
|
|
53
|
-
P,
|
|
54
|
-
t
|
|
55
|
-
];
|
|
56
|
-
}
|
|
57
|
-
return d(1, t);
|
|
58
|
-
} else {
|
|
59
|
-
const o = e * 2 + 1;
|
|
60
|
-
return r < o ? d(1, t) : a <= e + 1 ? d(1, o) : r - a <= e ? d(r - o + 1, t) : d(p, u);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
var W = /* @__PURE__ */ y({
|
|
64
|
-
__name: "PaginationList",
|
|
65
|
-
props: {
|
|
66
|
-
asChild: {
|
|
67
|
-
type: Boolean,
|
|
68
|
-
required: !1
|
|
69
|
-
},
|
|
70
|
-
as: {
|
|
71
|
-
type: null,
|
|
72
|
-
required: !1
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
setup(a) {
|
|
76
|
-
const r = a;
|
|
77
|
-
U();
|
|
78
|
-
const e = k(), l = I(() => O(Q(e.page.value, e.pageCount.value, e.siblingCount.value, e.showEdges.value)));
|
|
79
|
-
return (m, t) => (x(), $(n(j), V(w(r)), {
|
|
80
|
-
default: g(() => [E(m.$slots, "default", { items: l.value })]),
|
|
81
|
-
_: 3
|
|
82
|
-
}, 16));
|
|
83
|
-
}
|
|
84
|
-
}), X = W;
|
|
85
|
-
const Y = { class: "text-muted-foreground text-sm" }, Z = { class: "text-muted-foreground text-sm" }, xe = /* @__PURE__ */ y({
|
|
86
|
-
__name: "BuiPaginationCommon",
|
|
87
|
-
props: /* @__PURE__ */ L({
|
|
88
|
-
total: {},
|
|
89
|
-
translations: {}
|
|
90
|
-
}, {
|
|
91
|
-
pageSize: { default: 10, required: !0 },
|
|
92
|
-
pageSizeModifiers: {},
|
|
93
|
-
pageIndex: { default: 1, required: !0 },
|
|
94
|
-
pageIndexModifiers: {}
|
|
95
|
-
}),
|
|
96
|
-
emits: ["update:pageSize", "update:pageIndex"],
|
|
97
|
-
setup(a) {
|
|
98
|
-
const r = [10, 20, 30, 40, 50], e = a, l = h(a, "pageSize"), m = h(a, "pageIndex"), t = I(() => Math.ceil(e.total / l.value)), p = I({
|
|
99
|
-
get() {
|
|
100
|
-
return String(l.value);
|
|
101
|
-
},
|
|
102
|
-
set(u) {
|
|
103
|
-
l.value = parseInt(u);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
return (u, o) => (x(), $(n(q), {
|
|
107
|
-
total: e.total,
|
|
108
|
-
itemsPerPage: l.value,
|
|
109
|
-
page: m.value,
|
|
110
|
-
"onUpdate:page": o[2] || (o[2] = (f) => m.value = f)
|
|
111
|
-
}, {
|
|
112
|
-
default: g(({ page: f }) => [
|
|
113
|
-
i(n(X), { class: "relative flex items-center justify-center gap-2" }, {
|
|
114
|
-
default: g(() => [
|
|
115
|
-
S("p", Y, c(u.translations?.itemsPerPage || "Items per page"), 1),
|
|
116
|
-
i(n(C), {
|
|
117
|
-
modelValue: p.value,
|
|
118
|
-
"onUpdate:modelValue": o[0] || (o[0] = (s) => p.value = s)
|
|
119
|
-
}, {
|
|
120
|
-
default: g(() => [
|
|
121
|
-
i(n(A), { class: "mr-2 w-[70px]" }, {
|
|
122
|
-
default: g(() => [
|
|
123
|
-
i(n(F), {
|
|
124
|
-
placeholder: l.value.toString()
|
|
125
|
-
}, null, 8, ["placeholder"])
|
|
126
|
-
]),
|
|
127
|
-
_: 1
|
|
128
|
-
}),
|
|
129
|
-
i(n(D), { side: "top" }, {
|
|
130
|
-
default: g(() => [
|
|
131
|
-
(x(), M(R, null, z(r, (s) => i(n(T), {
|
|
132
|
-
key: s,
|
|
133
|
-
value: s.toString()
|
|
134
|
-
}, {
|
|
135
|
-
default: g(() => [
|
|
136
|
-
B(c(s), 1)
|
|
137
|
-
]),
|
|
138
|
-
_: 2
|
|
139
|
-
}, 1032, ["value"])), 64))
|
|
140
|
-
]),
|
|
141
|
-
_: 1
|
|
142
|
-
})
|
|
143
|
-
]),
|
|
144
|
-
_: 1
|
|
145
|
-
}, 8, ["modelValue"]),
|
|
146
|
-
t.value > 1 ? (x(), M(R, { key: 0 }, [
|
|
147
|
-
S("p", Z, c(u.translations?.page || "Page") + " " + c(f) + " " + c(u.translations?.of || "of") + " " + c(t.value), 1),
|
|
148
|
-
i(n(G)),
|
|
149
|
-
i(n(K)),
|
|
150
|
-
i(n(N), {
|
|
151
|
-
modelValue: m.value,
|
|
152
|
-
"onUpdate:modelValue": o[1] || (o[1] = (s) => m.value = s),
|
|
153
|
-
class: "w-28",
|
|
154
|
-
placeholder: "Page number"
|
|
155
|
-
}, null, 8, ["modelValue"]),
|
|
156
|
-
i(n(J)),
|
|
157
|
-
i(n(H))
|
|
158
|
-
], 64)) : b("", !0)
|
|
159
|
-
]),
|
|
160
|
-
_: 2
|
|
161
|
-
}, 1024)
|
|
162
|
-
]),
|
|
163
|
-
_: 1
|
|
164
|
-
}, 8, ["total", "itemsPerPage", "page"]));
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
export {
|
|
168
|
-
X as P,
|
|
169
|
-
xe as _
|
|
170
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { defineComponent as i, ref as t, createBlock as m, openBlock as p, unref as e, withCtx as _, renderSlot as s, createElementVNode as a, createVNode as d, normalizeClass as u } from "vue";
|
|
2
|
-
import { _ as b } from "./BuiScrollArea.vue_vue_type_script_setup_true_lang-O7VUcRC4.js";
|
|
3
|
-
import { _ as h } from "./BuiScrollBar.vue_vue_type_script_setup_true_lang-cV0od8j0.js";
|
|
4
|
-
import { g as w } from "./utils-DhVytAXN.js";
|
|
5
|
-
const x = { class: "flex min-h-[90px] w-full grow flex-col" }, y = /* @__PURE__ */ i({
|
|
6
|
-
__name: "BuiTable",
|
|
7
|
-
props: {
|
|
8
|
-
class: {}
|
|
9
|
-
},
|
|
10
|
-
setup(n, { expose: f }) {
|
|
11
|
-
const c = n, o = t(void 0), r = t(null);
|
|
12
|
-
return f({ tableRef: o, scrollAreaElementRef: r }), (l, k) => (p(), m(e(b), {
|
|
13
|
-
ref_key: "scrollAreaElementRef",
|
|
14
|
-
ref: r,
|
|
15
|
-
class: "border-border/16 w-full grow overflow-auto rounded-sm border"
|
|
16
|
-
}, {
|
|
17
|
-
default: _(() => [
|
|
18
|
-
s(l.$slots, "columnVisibility"),
|
|
19
|
-
a("div", x, [
|
|
20
|
-
a("table", {
|
|
21
|
-
ref_key: "tableRef",
|
|
22
|
-
ref: o,
|
|
23
|
-
class: u(e(w)("h-full caption-top text-sm", c.class))
|
|
24
|
-
}, [
|
|
25
|
-
s(l.$slots, "default")
|
|
26
|
-
], 2)
|
|
27
|
-
]),
|
|
28
|
-
d(e(h), { orientation: "horizontal" })
|
|
29
|
-
]),
|
|
30
|
-
_: 3
|
|
31
|
-
}, 512));
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
export {
|
|
35
|
-
y as _
|
|
36
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { defineComponent as f, createBlock as p, createElementBlock as $, openBlock as l, unref as s, withCtx as d, createVNode as b, renderSlot as a, createElementVNode as w, normalizeClass as m } from "vue";
|
|
2
|
-
import { _ as v } from "./BuiContextMenu.vue_vue_type_script_setup_true_lang-CGtCNQsI.js";
|
|
3
|
-
import { _ as k } from "./BuiContextMenuTrigger.vue_vue_type_script_setup_true_lang-hfu_w_27.js";
|
|
4
|
-
import { g as i } from "./utils-DhVytAXN.js";
|
|
5
|
-
const _ = ["data-row-state"], B = ["data-row-state"], E = /* @__PURE__ */ f({
|
|
6
|
-
__name: "BuiTableRow",
|
|
7
|
-
props: {
|
|
8
|
-
class: {}
|
|
9
|
-
},
|
|
10
|
-
emits: ["mouseenter", "mouseleave"],
|
|
11
|
-
setup(u, { emit: c }) {
|
|
12
|
-
const n = u, o = c;
|
|
13
|
-
return (t, e) => t.$slots.actions ? (l(), p(s(v), { key: 0 }, {
|
|
14
|
-
default: d(() => [
|
|
15
|
-
b(s(k), { "as-child": "" }, {
|
|
16
|
-
default: d(() => [
|
|
17
|
-
w("tr", {
|
|
18
|
-
class: m(
|
|
19
|
-
s(i)(
|
|
20
|
-
"border-border/8 data-[row-state=selected]:bg-accent/8 border-b transition-colors",
|
|
21
|
-
n.class
|
|
22
|
-
)
|
|
23
|
-
),
|
|
24
|
-
"data-row-state": t.$attrs["data-row-state"],
|
|
25
|
-
onMouseenter: e[0] || (e[0] = (r) => o("mouseenter")),
|
|
26
|
-
onMouseleave: e[1] || (e[1] = (r) => o("mouseleave"))
|
|
27
|
-
}, [
|
|
28
|
-
a(t.$slots, "default")
|
|
29
|
-
], 42, _)
|
|
30
|
-
]),
|
|
31
|
-
_: 3
|
|
32
|
-
}),
|
|
33
|
-
a(t.$slots, "actions")
|
|
34
|
-
]),
|
|
35
|
-
_: 3
|
|
36
|
-
})) : (l(), $("tr", {
|
|
37
|
-
key: 1,
|
|
38
|
-
class: m(
|
|
39
|
-
s(i)(
|
|
40
|
-
"border-border/8 data-[row-state=selected]:bg-accent/8 border-b transition-colors",
|
|
41
|
-
n.class
|
|
42
|
-
)
|
|
43
|
-
),
|
|
44
|
-
"data-row-state": t.$attrs["data-row-state"],
|
|
45
|
-
onMouseenter: e[2] || (e[2] = (r) => o("mouseenter")),
|
|
46
|
-
onMouseleave: e[3] || (e[3] = (r) => o("mouseleave"))
|
|
47
|
-
}, [
|
|
48
|
-
a(t.$slots, "default")
|
|
49
|
-
], 42, B));
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
export {
|
|
53
|
-
E as _
|
|
54
|
-
};
|