@toniel/laravel-tanstack-datatable 0.1.7 → 0.1.8

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 CHANGED
@@ -135,6 +135,7 @@ const {
135
135
  | `enableRowSelection` | `boolean` | `false` | Enable row selection |
136
136
  | `rowSelection` | `RowSelectionState` | `{}` | Selected rows state |
137
137
  | `getRowId` | `Function` | `(row) => row.id` | Get unique row ID |
138
+ | `showSelectionInfo` | `boolean` | `true` | Show selection info bar when rows are selected |
138
139
  | `showSearch` | `boolean` | `true` | Show search input |
139
140
  | `showCaption` | `boolean` | `true` | Show table caption |
140
141
  | `showPerPageSelector` | `boolean` | `true` | Show per page selector |
@@ -205,6 +206,33 @@ Add bulk action buttons when rows are selected:
205
206
  </DataTable>
206
207
  ```
207
208
 
209
+ #### `selection-info` Slot
210
+ Fully customize the selection info bar (replaces the default blue bar):
211
+
212
+ ```vue
213
+ <DataTable
214
+ :enable-row-selection="true"
215
+ v-model:row-selection="selectedRows"
216
+ ...
217
+ >
218
+ <template #selection-info="{ selectedIds, selectedData, selectedCount, clearSelection }">
219
+ <div class="your-custom-class">
220
+ {{ selectedCount }} items selected
221
+ <button @click="handleBulkAction(selectedIds)">Action</button>
222
+ <button @click="clearSelection">Clear</button>
223
+ </div>
224
+ </template>
225
+ </DataTable>
226
+ ```
227
+
228
+ Slot props available:
229
+ - `selectedIds` - Array of selected row IDs
230
+ - `selectedData` - Array of selected row data objects
231
+ - `selectedCount` - Number of selected rows
232
+ - `clearSelection` - Function to clear all selections
233
+ - `selectAllCurrentPage` - Function to select all rows on current page
234
+ - `deselectAllCurrentPage` - Function to deselect all rows on current page
235
+
208
236
  ## Advanced Examples
209
237
 
210
238
  ### With Row Selection
@@ -278,6 +306,99 @@ const columns = [
278
306
  </script>
279
307
  ```
280
308
 
309
+ ### Using `useRowSelection` Composable
310
+
311
+ For more control over row selection, use the `useRowSelection` composable:
312
+
313
+ ```vue
314
+ <script setup lang="ts">
315
+ import { ref } from 'vue'
316
+ import { useRowSelection } from '@toniel/laravel-tanstack-datatable'
317
+ import { createColumnHelper } from '@tanstack/vue-table'
318
+
319
+ interface User {
320
+ id: number
321
+ name: string
322
+ email: string
323
+ }
324
+
325
+ const tableData = ref<User[]>([])
326
+
327
+ const {
328
+ rowSelection,
329
+ selectedRowIds,
330
+ selectedRowData,
331
+ isAllCurrentPageSelected,
332
+ clearSelection,
333
+ toggleAllCurrentPage,
334
+ toggleRowSelection,
335
+ getSelectionColumn,
336
+ } = useRowSelection<User>({
337
+ data: tableData,
338
+ getRowId: (row) => String(row.id),
339
+ })
340
+
341
+ const columnHelper = createColumnHelper<User>()
342
+
343
+ const columns = [
344
+ getSelectionColumn({ size: 50 }), // Automatic checkbox column
345
+ columnHelper.accessor('name', { header: 'Name' }),
346
+ columnHelper.accessor('email', { header: 'Email' }),
347
+ ]
348
+
349
+ const handleBulkDelete = async () => {
350
+ await axios.delete('/api/users/bulk', { data: { ids: selectedRowIds.value } })
351
+ clearSelection()
352
+ // refetch data...
353
+ }
354
+ </script>
355
+
356
+ <template>
357
+ <DataTable
358
+ :data="tableData"
359
+ :columns="columns"
360
+ :enable-row-selection="true"
361
+ v-model:row-selection="rowSelection"
362
+ :show-selection-info="false"
363
+ >
364
+ <template #selection-info="{ selectedIds, selectedCount, clearSelection }">
365
+ <div class="flex items-center gap-4 p-4 bg-red-50 rounded-lg">
366
+ <span>{{ selectedCount }} users selected</span>
367
+ <button @click="handleBulkDelete" class="btn-danger">Delete</button>
368
+ <button @click="clearSelection">Clear</button>
369
+ </div>
370
+ </template>
371
+ </DataTable>
372
+ </template>
373
+ ```
374
+
375
+ #### `useRowSelection` API
376
+
377
+ | Property/Method | Type | Description |
378
+ |-----------------|------|-------------|
379
+ | `rowSelection` | `Ref<RowSelectionState>` | Reactive selection state |
380
+ | `selectedRowIds` | `Ref<string[]>` | Array of selected row IDs |
381
+ | `selectedRowData` | `Ref<T[]>` | Array of selected row data |
382
+ | `isAllCurrentPageSelected` | `Ref<boolean>` | Whether all current page rows are selected |
383
+ | `isSomeCurrentPageSelected` | `Ref<boolean>` | Whether some (but not all) rows are selected |
384
+ | `clearSelection` | `() => void` | Clear all selections |
385
+ | `toggleAllCurrentPage` | `() => void` | Toggle select all on current page |
386
+ | `toggleRowSelection` | `(id: string) => void` | Toggle single row selection |
387
+ | `selectRows` | `(ids: string[]) => void` | Select multiple rows by IDs |
388
+ | `deselectRows` | `(ids: string[]) => void` | Deselect multiple rows by IDs |
389
+ | `getSelectionColumn` | `(options?) => ColumnDef<T>` | Get a checkbox column definition |
390
+
391
+ #### `getSelectionColumn` Options
392
+
393
+ ```ts
394
+ getSelectionColumn({
395
+ headerClass: 'flex items-center justify-center',
396
+ cellClass: 'flex items-center justify-center',
397
+ checkboxClass: 'w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded',
398
+ size: 50,
399
+ })
400
+ ```
401
+
281
402
  ## Styling
282
403
 
283
404
  This package uses Tailwind CSS utility classes. Make sure Tailwind is configured in your project.
@@ -14,6 +14,7 @@ interface Props {
14
14
  rowSelection?: RowSelectionState;
15
15
  enableRowSelection?: boolean;
16
16
  getRowId?: (row: any) => string;
17
+ showSelectionInfo?: boolean;
17
18
  showSearch?: boolean;
18
19
  showPerPageSelector?: boolean;
19
20
  title?: string;
@@ -27,6 +28,14 @@ declare function __VLS_template(): {
27
28
  slots: {
28
29
  filters?(_: {}): any;
29
30
  header?(_: {}): any;
31
+ 'selection-info'?(_: {
32
+ selectedIds: string[];
33
+ selectedData: any[];
34
+ selectedCount: number;
35
+ clearSelection: () => void;
36
+ selectAllCurrentPage: () => void;
37
+ deselectAllCurrentPage: () => void;
38
+ }): any;
30
39
  'bulk-actions'?(_: {
31
40
  selectedIds: string[];
32
41
  selectedData: any[];
@@ -65,20 +74,21 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {
65
74
  onRetry?: (() => any) | undefined;
66
75
  "onUpdate:rowSelection"?: ((selection: RowSelectionState) => any) | undefined;
67
76
  }>, {
77
+ data: any[];
78
+ getRowId: (row: any) => string;
79
+ search: string;
80
+ title: string;
81
+ error: Error | null;
68
82
  pagination: LaravelPaginationResponse | null;
69
83
  perPageOptions: number[];
70
84
  currentPerPage: number;
71
85
  showPerPageSelector: boolean;
72
- search: string;
73
- data: any[];
74
- title: string;
75
86
  isLoading: boolean;
76
- error: Error | null;
77
87
  sortBy: string | null;
78
88
  sortDirection: "asc" | "desc";
79
89
  rowSelection: RowSelectionState;
80
90
  enableRowSelection: boolean;
81
- getRowId: (row: any) => string;
91
+ showSelectionInfo: boolean;
82
92
  showSearch: boolean;
83
93
  itemName: string;
84
94
  loadingText: string;
@@ -1 +1 @@
1
- {"version":3,"file":"DataTable.vue.d.ts","sourceRoot":"","sources":["../../src/components/DataTable.vue"],"names":[],"mappings":"AA2XA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAK7B,UAAU,KAAK;IACb,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACb,OAAO,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;IAC1B,UAAU,CAAC,EAAE,yBAAyB,GAAG,IAAI,CAAC;IAC9C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,aAAa,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAG/B,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;IAGhC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAG9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAiJD,iBAAS,cAAc;WA4WT,OAAO,IAA6B;;yBAZrB,GAAG;wBACJ,GAAG;;;;;;;;YACK,GAAG;;;;EAetC;AA0BD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;gBArjBN,yBAAyB,GAAG,IAAI;oBAK5B,MAAM,EAAE;oBADR,MAAM;yBAYD,OAAO;YAbpB,MAAM;UALR,GAAG,EAAE;WAqBJ,MAAM;eAlBF,OAAO;WACX,KAAK,GAAG,IAAI;YAIX,MAAM,GAAG,IAAI;mBACN,KAAK,GAAG,MAAM;kBAGf,iBAAiB;wBACX,OAAO;cACjB,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM;gBAGlB,OAAO;cAKT,MAAM;iBACH,MAAM;gBACP,MAAM;oBACF,MAAM;wFAwiBvB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"DataTable.vue.d.ts","sourceRoot":"","sources":["../../src/components/DataTable.vue"],"names":[],"mappings":"AAuYA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAK7B,UAAU,KAAK;IACb,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACb,OAAO,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;IAC1B,UAAU,CAAC,EAAE,yBAAyB,GAAG,IAAI,CAAC;IAC9C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,aAAa,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAG/B,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAG5B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAG9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAmJD,iBAAS,cAAc;WAuXT,OAAO,IAA6B;;yBAbrB,GAAG;wBACJ,GAAG;;;;;;;;YACO,GAAG;;;;;;;;YACL,GAAG;;;;EAetC;AA0BD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;UArkBZ,GAAG,EAAE;cAcD,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM;YATtB,MAAM;WAiBP,MAAM;WAlBN,KAAK,GAAG,IAAI;gBAFP,yBAAyB,GAAG,IAAI;oBAK5B,MAAM,EAAE;oBADR,MAAM;yBAaD,OAAO;eAhBjB,OAAO;YAKV,MAAM,GAAG,IAAI;mBACN,KAAK,GAAG,MAAM;kBAGf,iBAAiB;wBACX,OAAO;uBAER,OAAO;gBAGd,OAAO;cAKT,MAAM;iBACH,MAAM;gBACP,MAAM;oBACF,MAAM;wFAqjBvB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { ColumnDef, RowSelectionState } from '@tanstack/vue-table';
2
+ import { Ref } from 'vue';
3
+ export interface UseRowSelectionOptions<T> {
4
+ data: Ref<T[]>;
5
+ getRowId?: (row: T) => string;
6
+ }
7
+ export interface RowSelectionHelpers<T> {
8
+ rowSelection: Ref<RowSelectionState>;
9
+ selectedRowIds: Ref<string[]>;
10
+ selectedRowData: Ref<T[]>;
11
+ isAllCurrentPageSelected: Ref<boolean>;
12
+ isSomeCurrentPageSelected: Ref<boolean>;
13
+ clearSelection: () => void;
14
+ toggleAllCurrentPage: () => void;
15
+ toggleRowSelection: (id: string) => void;
16
+ selectRows: (ids: string[]) => void;
17
+ deselectRows: (ids: string[]) => void;
18
+ getSelectionColumn: (options?: SelectionColumnOptions) => ColumnDef<T>;
19
+ }
20
+ export interface SelectionColumnOptions {
21
+ headerClass?: string;
22
+ cellClass?: string;
23
+ checkboxClass?: string;
24
+ size?: number;
25
+ }
26
+ export declare function useRowSelection<T>(options: UseRowSelectionOptions<T>): RowSelectionHelpers<T>;
27
+ //# sourceMappingURL=useRowSelection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRowSelection.d.ts","sourceRoot":"","sources":["../../src/composables/useRowSelection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAA8B,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAE3D,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,IAAI,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,YAAY,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACrC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9B,eAAe,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1B,wBAAwB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACvC,yBAAyB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACxC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,kBAAkB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACpC,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACtC,kBAAkB,EAAE,CAAC,OAAO,CAAC,EAAE,sBAAsB,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC;CACxE;AAED,MAAM,WAAW,sBAAsB;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,eAAe,CAAC,CAAC,EAC/B,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,GACjC,mBAAmB,CAAC,CAAC,CAAC,CA2IxB"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export { useDarkMode } from './composables/useDarkMode';
2
+ export { useRowSelection } from './composables/useRowSelection';
2
3
  export { default as DataTable } from './components/DataTable.vue';
3
4
  export { default as DataTablePagination } from './components/DataTablePagination.vue';
4
5
  export { cn } from './lib/utils';
6
+ export type { UseRowSelectionOptions, RowSelectionHelpers, SelectionColumnOptions } from './composables/useRowSelection';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAGvD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,sCAAsC,CAAA;AAGrF,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAG/D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,sCAAsC,CAAA;AAGrF,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAGhC,YAAY,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA"}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),x=require("@tanstack/vue-table"),m=require("lucide-vue-next"),w=require("clsx"),E=require("tailwind-merge");function B(){const t=e.ref(!1);if(typeof window<"u"){const s=window.matchMedia("(prefers-color-scheme: dark)");t.value=s.matches,s.addEventListener("change",c=>{t.value=c.matches})}e.watchEffect(()=>{typeof document<"u"&&(t.value?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"))});function k(){t.value=!t.value}return{isDarkMode:t,toggleDarkMode:k}}const N={key:0,class:"flex items-center justify-between border-t border-border bg-background px-4 py-3 sm:px-6"},S={class:"flex flex-1 flex-wrap items-center justify-between gap-4"},V={class:"flex items-center gap-4"},C={class:"hidden text-sm text-muted-foreground sm:block"},P={class:"font-medium"},D={class:"font-medium"},R={class:"font-medium"},$={key:0,class:"flex items-center gap-2"},T=["value"],M=["value"],L={class:"relative z-0 inline-flex -space-x-px rounded-md shadow-sm","aria-label":"Pagination"},_=["disabled"],z=["onClick"],I={key:1,class:"relative inline-flex items-center border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700"},j=["disabled"],v=e.defineComponent({__name:"DataTablePagination",props:{pagination:{default:null},perPageOptions:{default:()=>[10,15,25,50,100]},currentPerPage:{default:10},showPerPageSelector:{type:Boolean,default:!0}},emits:["pageChange","perPageChange"],setup(t,{emit:k}){const s=t,c=k,a=e.computed(()=>s.pagination?s.pagination.meta.current_page>1:!1),p=e.computed(()=>s.pagination?s.pagination.meta.current_page<s.pagination.meta.last_page:!1),f=e.computed(()=>{if(!s.pagination)return[];const g=s.pagination.meta.current_page,l=s.pagination.meta.last_page,i=2,b=[],n=[];let o;for(let r=1;r<=l;r++)(r===1||r===l||r>=g-i&&r<=g+i)&&b.push(r);for(const r of b)o&&(r-o===2?n.push(o+1):r-o!==1&&n.push("...")),n.push(r),o=r;return n}),y=g=>{typeof g=="number"&&c("pageChange",g)},u=()=>{a.value&&s.pagination&&c("pageChange",s.pagination.meta.current_page-1)},h=()=>{p.value&&s.pagination&&c("pageChange",s.pagination.meta.current_page+1)};return(g,l)=>t.pagination&&t.pagination.meta.last_page>1?(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("div",S,[e.createElementVNode("div",V,[e.createElementVNode("p",C,[l[1]||(l[1]=e.createTextVNode(" Showing ",-1)),e.createElementVNode("span",P,e.toDisplayString(t.pagination.meta.from),1),l[2]||(l[2]=e.createTextVNode(" to ",-1)),e.createElementVNode("span",D,e.toDisplayString(t.pagination.meta.to),1),l[3]||(l[3]=e.createTextVNode(" of ",-1)),e.createElementVNode("span",R,e.toDisplayString(t.pagination.meta.total),1),l[4]||(l[4]=e.createTextVNode(" results ",-1))])]),t.showPerPageSelector?(e.openBlock(),e.createElementBlock("div",$,[l[5]||(l[5]=e.createElementVNode("p",{class:"text-sm text-muted-foreground"},"Rows per page:",-1)),e.createElementVNode("select",{value:t.currentPerPage,class:"rounded-md border border-gray-300 bg-white px-2 py-1 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary",onChange:l[0]||(l[0]=i=>c("perPageChange",Number(i.target.value)))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.perPageOptions,i=>(e.openBlock(),e.createElementBlock("option",{key:i,value:i},e.toDisplayString(i),9,M))),128))],40,T)])):e.createCommentVNode("",!0),e.createElementVNode("div",null,[e.createElementVNode("nav",L,[e.createElementVNode("button",{disabled:!a.value,class:"relative inline-flex items-center rounded-l-md border border-gray-300 bg-white px-2 py-2 text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50",onClick:u},[l[6]||(l[6]=e.createElementVNode("span",{class:"sr-only"},"Previous",-1)),e.createVNode(e.unref(m.ChevronLeft),{class:"h-5 w-5","aria-hidden":"true"})],8,_),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(i,b)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:b},[i!=="..."?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["relative inline-flex items-center border px-4 py-2 text-sm font-medium",i===t.pagination.meta.current_page?"z-10 border-primary bg-primary/10 text-primary":"border-gray-300 bg-white text-gray-500 hover:bg-gray-50"]),onClick:n=>y(i)},e.toDisplayString(i),11,z)):(e.openBlock(),e.createElementBlock("span",I," ... "))],64))),128)),e.createElementVNode("button",{disabled:!p.value,class:"relative inline-flex items-center rounded-r-md border border-gray-300 bg-white px-2 py-2 text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50",onClick:h},[l[7]||(l[7]=e.createElementVNode("span",{class:"sr-only"},"Next",-1)),e.createVNode(e.unref(m.ChevronRight),{class:"h-5 w-5","aria-hidden":"true"})],8,j)])])])])):e.createCommentVNode("",!0)}}),F={class:"p-4 flex flex-col gap-4 bg-background text-foreground"},O={class:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between"},q={class:"flex flex-col gap-2 sm:flex-row sm:items-center"},A={key:0,class:"relative w-full max-w-sm"},G=["value"],U={class:"flex items-center gap-2"},H={class:"flex items-center"},Q={key:0,class:"flex items-center justify-between p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg"},W={class:"flex items-center gap-4"},X={class:"text-sm font-medium text-blue-700 dark:text-blue-300"},J={class:"text-xs text-blue-600 dark:text-blue-400"},K={class:"flex items-center gap-2"},Y={key:1,class:"flex items-center justify-center p-8"},Z={class:"text-lg text-gray-700 dark:text-gray-200"},ee={key:2,class:"flex flex-col items-center p-8"},te={class:"flex items-center gap-2 mb-2 text-lg text-red-600 dark:text-red-400"},oe={class:"mb-4 text-sm text-gray-600 dark:text-gray-300"},ne={key:3,class:"rounded-lg border bg-background dark:border-gray-700"},re={key:0,class:"relative"},le={class:"relative w-full overflow-auto"},ae={class:"w-full caption-bottom text-sm"},se={class:"[&_tr]:border-b bg-muted"},ce=["colspan"],ie=["onClick"],de={key:0},ue={class:"[&_tr:last-child]:border-0 dark:[&_tr:last-child]:border-0"},ge={key:1},me=["colspan"],pe={class:"flex flex-col items-center gap-2"},fe={key:0,class:"border-t"},be=["colspan"],ke=e.defineComponent({__name:"DataTable",props:{data:{default:()=>[]},columns:{},pagination:{default:null},isLoading:{type:Boolean,default:!1},error:{default:null},search:{default:""},currentPerPage:{default:10},perPageOptions:{default:()=>[10,15,25,50,100]},sortBy:{default:null},sortDirection:{default:"asc"},rowSelection:{default:()=>({})},enableRowSelection:{type:Boolean,default:!1},getRowId:{type:Function,default:t=>t.id},showSearch:{type:Boolean,default:!0},showPerPageSelector:{type:Boolean,default:!0},title:{default:"Items"},itemName:{default:"items"},loadingText:{default:"Loading..."},errorTitle:{default:"Error loading data"},emptyStateText:{default:"No items found"}},emits:["pageChange","perPageChange","searchChange","sortChange","retry","update:rowSelection"],setup(t,{expose:k,emit:s}){const c=s,a=t,p=e.computed(()=>Object.keys(a.rowSelection||{}).filter(n=>{var o;return(o=a.rowSelection)==null?void 0:o[n]}).length),f=e.computed(()=>Object.keys(a.rowSelection||{}).filter(n=>{var o;return(o=a.rowSelection)==null?void 0:o[n]})),y=e.computed(()=>!a.data||!a.rowSelection?[]:a.data.filter(n=>a.rowSelection[a.getRowId(n)])),u=x.useVueTable({get data(){return a.data||[]},columns:a.columns,getCoreRowModel:x.getCoreRowModel(),enableSorting:!0,manualSorting:!0,enableRowSelection:a.enableRowSelection,getRowId:a.getRowId,state:{rowSelection:a.rowSelection||{}},onRowSelectionChange:n=>{const o=typeof n=="function"?n(a.rowSelection||{}):n;c("update:rowSelection",o)},enableMultiRowSelection:!0,enableSubRowSelection:!1}),h=()=>f.value,g=()=>y.value,l=()=>c("update:rowSelection",{}),i=()=>{const n={...a.rowSelection};u.getRowModel().rows.forEach(o=>{n[o.id]=!0}),c("update:rowSelection",n)},b=()=>{const n={...a.rowSelection};u.getRowModel().rows.forEach(o=>{delete n[o.id]}),c("update:rowSelection",n)};return k({getSelectedRowIds:h,getSelectedRowData:g,clearSelection:l,selectAllCurrentPage:i,deselectAllCurrentPage:b,selectedRowCount:p,selectedRowIds:f,selectedRowData:y,table:u}),(n,o)=>(e.openBlock(),e.createElementBlock("div",F,[e.createElementVNode("div",O,[e.createElementVNode("div",q,[t.showSearch?(e.openBlock(),e.createElementBlock("div",A,[e.createElementVNode("input",{value:t.search,type:"search",placeholder:"Search...",class:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 ps-14 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",onInput:o[0]||(o[0]=r=>c("searchChange",r.target.value))},null,40,G)])):e.createCommentVNode("",!0),e.createElementVNode("div",U,[e.renderSlot(n.$slots,"filters")])]),e.createElementVNode("div",H,[e.renderSlot(n.$slots,"header")])]),t.enableRowSelection&&p.value>0?(e.openBlock(),e.createElementBlock("div",Q,[e.createElementVNode("div",W,[e.createElementVNode("span",X,e.toDisplayString(p.value)+" "+e.toDisplayString(t.itemName)+" selected ",1),e.createElementVNode("div",J," IDs: "+e.toDisplayString(f.value.slice(0,5).join(", "))+e.toDisplayString(f.value.length>5?"...":""),1)]),e.createElementVNode("div",K,[e.renderSlot(n.$slots,"bulk-actions",{selectedIds:f.value,selectedData:y.value,selectedCount:p.value,clearSelection:l,selectAllCurrentPage:i,deselectAllCurrentPage:b}),n.$slots["bulk-actions"]?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,onClick:l,class:"px-3 py-1 text-sm text-blue-700 dark:text-blue-300 hover:bg-blue-100 dark:hover:bg-blue-800 rounded transition-colors"}," Clear Selection "))])])):e.createCommentVNode("",!0),t.isLoading&&!t.data?(e.openBlock(),e.createElementBlock("div",Y,[o[4]||(o[4]=e.createElementVNode("div",{class:"w-8 h-8 mr-3 border-b-2 border-gray-900 dark:border-gray-100 rounded-full animate-spin"},null,-1)),e.createElementVNode("div",Z,e.toDisplayString(t.loadingText),1)])):t.error?(e.openBlock(),e.createElementBlock("div",ee,[e.createElementVNode("div",te,[e.createVNode(e.unref(m.CircleX),{class:"size-6"}),e.createElementVNode("span",null,e.toDisplayString(t.errorTitle),1)]),e.createElementVNode("div",oe,e.toDisplayString(t.error.message),1),e.createElementVNode("button",{class:"flex items-center gap-2 px-4 py-2 text-white transition-colors bg-gray-900 rounded-md hover:bg-gray-800 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-gray-200",onClick:o[1]||(o[1]=r=>c("retry"))},[e.createVNode(e.unref(m.RefreshCw),{class:"size-4"}),o[5]||(o[5]=e.createElementVNode("span",null,"Retry",-1))])])):(e.openBlock(),e.createElementBlock("div",ne,[t.isLoading?(e.openBlock(),e.createElementBlock("div",re,[...o[6]||(o[6]=[e.createElementVNode("div",{class:"absolute inset-0 z-10 flex items-center justify-center bg-white/70 dark:bg-gray-900/70 rounded-lg"},[e.createElementVNode("div",{class:"w-6 h-6 border-b-2 border-gray-900 dark:border-gray-100 rounded-full animate-spin"})],-1)])])):e.createCommentVNode("",!0),e.createElementVNode("div",le,[e.createElementVNode("table",ae,[e.createElementVNode("thead",se,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(u).getHeaderGroups(),r=>(e.openBlock(),e.createElementBlock("tr",{key:r.id,class:"border-b transition-colors"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.headers,d=>(e.openBlock(),e.createElementBlock("th",{key:d.id,colspan:d.colSpan,class:"h-12 px-4 text-left align-middle font-bold text-muted-foreground [&:has([role=checkbox])]:pr-0"},[d.isPlaceholder?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["flex items-center gap-2",d.column.getCanSort()?"cursor-pointer select-none hover:bg-accent p-2 rounded transition-colors":""]),onClick:xe=>d.column.getCanSort()?c("sortChange",d.column.id):void 0},[e.createVNode(e.unref(x.FlexRender),{render:d.column.columnDef.header,props:d.getContext()},null,8,["render","props"]),d.column.getCanSort()?(e.openBlock(),e.createElementBlock("div",de,[t.sortBy!==d.column.id?(e.openBlock(),e.createBlock(e.unref(m.ChevronsUpDown),{key:0,size:10,class:"text-gray-400"})):t.sortBy===d.column.id&&t.sortDirection==="asc"?(e.openBlock(),e.createBlock(e.unref(m.ChevronUp),{key:1,size:10,class:"text-gray-900 dark:text-gray-100"})):t.sortBy===d.column.id&&t.sortDirection==="desc"?(e.openBlock(),e.createBlock(e.unref(m.ChevronDown),{key:2,size:10,class:"text-gray-900 dark:text-gray-100"})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],10,ie))],8,ce))),128))]))),128))]),e.createElementVNode("tbody",ue,[e.unref(u).getRowModel().rows.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(u).getRowModel().rows,r=>(e.openBlock(),e.createElementBlock("tr",{key:r.id,class:e.normalizeClass(["border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted dark:border-gray-700 dark:hover:bg-gray-800",t.enableRowSelection&&r.getIsSelected()?"bg-blue-50 dark:bg-blue-900/20 border-l-4 border-l-blue-500":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.getVisibleCells(),d=>(e.openBlock(),e.createElementBlock("td",{key:d.id,class:"p-4 align-middle [&:has([role=checkbox])]:pr-0"},[e.createVNode(e.unref(x.FlexRender),{render:d.column.columnDef.cell,props:d.getContext()},null,8,["render","props"])]))),128))],2))),128)):(e.openBlock(),e.createElementBlock("tr",ge,[e.createElementVNode("td",{colspan:t.columns.length,class:"h-24 text-center dark:text-gray-400"},[e.createElementVNode("div",pe,[e.createVNode(e.unref(m.Inbox),{class:"size-8 text-muted-foreground"}),e.createElementVNode("span",null,e.toDisplayString(t.emptyStateText),1)])],8,me)]))]),t.pagination&&t.pagination.meta.last_page>1?(e.openBlock(),e.createElementBlock("tfoot",fe,[e.createElementVNode("tr",null,[e.createElementVNode("td",{colspan:t.columns.length,class:"p-0"},[e.createVNode(v,{pagination:t.pagination,"current-per-page":t.currentPerPage,"per-page-options":t.perPageOptions,"show-per-page-selector":t.showPerPageSelector,onPageChange:o[2]||(o[2]=r=>c("pageChange",r)),onPerPageChange:o[3]||(o[3]=r=>c("perPageChange",r))},null,8,["pagination","current-per-page","per-page-options","show-per-page-selector"])],8,be)])])):e.createCommentVNode("",!0)])])]))]))}});function ye(...t){return E.twMerge(w.clsx(t))}exports.DataTable=ke;exports.DataTablePagination=v;exports.cn=ye;exports.useDarkMode=B;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),w=require("@tanstack/vue-table"),y=require("lucide-vue-next"),B=require("clsx"),C=require("tailwind-merge");function N(){const t=e.ref(!1);if(typeof window<"u"){const s=window.matchMedia("(prefers-color-scheme: dark)");t.value=s.matches,s.addEventListener("change",l=>{t.value=l.matches})}e.watchEffect(()=>{typeof document<"u"&&(t.value?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"))});function u(){t.value=!t.value}return{isDarkMode:t,toggleDarkMode:u}}function V(t){const{data:u,getRowId:s=n=>n.id}=t,l=e.ref({}),c=e.computed(()=>Object.keys(l.value).filter(n=>l.value[n])),f=e.computed(()=>u.value?u.value.filter(n=>c.value.includes(String(s(n)))):[]),g=e.computed(()=>!u.value||u.value.length===0?!1:u.value.every(n=>l.value[String(s(n))])),b=e.computed(()=>u.value?u.value.some(o=>l.value[String(s(o))])&&!g.value:!1),p=()=>{l.value={}},v=()=>{if(!u.value)return;const n={...l.value};g.value?u.value.forEach(o=>{delete n[String(s(o))]}):u.value.forEach(o=>{n[String(s(o))]=!0}),l.value=n},m=n=>{const o={...l.value};o[n]?delete o[n]:o[n]=!0,l.value=o};return{rowSelection:l,selectedRowIds:c,selectedRowData:f,isAllCurrentPageSelected:g,isSomeCurrentPageSelected:b,clearSelection:p,toggleAllCurrentPage:v,toggleRowSelection:m,selectRows:n=>{const o={...l.value};n.forEach(r=>{o[r]=!0}),l.value=o},deselectRows:n=>{const o={...l.value};n.forEach(r=>{delete o[r]}),l.value=o},getSelectionColumn:(n={})=>{const{headerClass:o="flex items-center justify-center",cellClass:r="flex items-center justify-center",checkboxClass:i="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2",size:S=50}=n;return{id:"select",header:()=>{const x=e.h("input",{type:"checkbox",class:i,checked:g.value,onChange:v});return b.value&&e.nextTick(()=>{const h=x.el;h&&(h.indeterminate=!0)}),e.h("div",{class:o},[x])},cell:({row:x})=>{const h=String(s(x.original));return e.h("div",{class:r},[e.h("input",{type:"checkbox",class:i,checked:!!l.value[h],onChange:()=>m(h)})])},enableSorting:!1,size:S}}}}const P={key:0,class:"flex items-center justify-between border-t border-border bg-background px-4 py-3 sm:px-6"},R={class:"flex flex-1 flex-wrap items-center justify-between gap-4"},D={class:"flex items-center gap-4"},$={class:"hidden text-sm text-muted-foreground sm:block"},T={class:"font-medium"},I={class:"font-medium"},M={class:"font-medium"},L={key:0,class:"flex items-center gap-2"},j=["value"],z=["value"],F={class:"relative z-0 inline-flex -space-x-px rounded-md shadow-sm","aria-label":"Pagination"},_=["disabled"],O=["onClick"],q={key:1,class:"relative inline-flex items-center border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700"},A=["disabled"],E=e.defineComponent({__name:"DataTablePagination",props:{pagination:{default:null},perPageOptions:{default:()=>[10,15,25,50,100]},currentPerPage:{default:10},showPerPageSelector:{type:Boolean,default:!0}},emits:["pageChange","perPageChange"],setup(t,{emit:u}){const s=t,l=u,c=e.computed(()=>s.pagination?s.pagination.meta.current_page>1:!1),f=e.computed(()=>s.pagination?s.pagination.meta.current_page<s.pagination.meta.last_page:!1),g=e.computed(()=>{if(!s.pagination)return[];const m=s.pagination.meta.current_page,a=s.pagination.meta.last_page,d=2,k=[],n=[];let o;for(let r=1;r<=a;r++)(r===1||r===a||r>=m-d&&r<=m+d)&&k.push(r);for(const r of k)o&&(r-o===2?n.push(o+1):r-o!==1&&n.push("...")),n.push(r),o=r;return n}),b=m=>{typeof m=="number"&&l("pageChange",m)},p=()=>{c.value&&s.pagination&&l("pageChange",s.pagination.meta.current_page-1)},v=()=>{f.value&&s.pagination&&l("pageChange",s.pagination.meta.current_page+1)};return(m,a)=>t.pagination&&t.pagination.meta.last_page>1?(e.openBlock(),e.createElementBlock("div",P,[e.createElementVNode("div",R,[e.createElementVNode("div",D,[e.createElementVNode("p",$,[a[1]||(a[1]=e.createTextVNode(" Showing ",-1)),e.createElementVNode("span",T,e.toDisplayString(t.pagination.meta.from),1),a[2]||(a[2]=e.createTextVNode(" to ",-1)),e.createElementVNode("span",I,e.toDisplayString(t.pagination.meta.to),1),a[3]||(a[3]=e.createTextVNode(" of ",-1)),e.createElementVNode("span",M,e.toDisplayString(t.pagination.meta.total),1),a[4]||(a[4]=e.createTextVNode(" results ",-1))])]),t.showPerPageSelector?(e.openBlock(),e.createElementBlock("div",L,[a[5]||(a[5]=e.createElementVNode("p",{class:"text-sm text-muted-foreground"},"Rows per page:",-1)),e.createElementVNode("select",{value:t.currentPerPage,class:"rounded-md border border-gray-300 bg-white px-2 py-1 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary",onChange:a[0]||(a[0]=d=>l("perPageChange",Number(d.target.value)))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.perPageOptions,d=>(e.openBlock(),e.createElementBlock("option",{key:d,value:d},e.toDisplayString(d),9,z))),128))],40,j)])):e.createCommentVNode("",!0),e.createElementVNode("div",null,[e.createElementVNode("nav",F,[e.createElementVNode("button",{disabled:!c.value,class:"relative inline-flex items-center rounded-l-md border border-gray-300 bg-white px-2 py-2 text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50",onClick:p},[a[6]||(a[6]=e.createElementVNode("span",{class:"sr-only"},"Previous",-1)),e.createVNode(e.unref(y.ChevronLeft),{class:"h-5 w-5","aria-hidden":"true"})],8,_),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(d,k)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:k},[d!=="..."?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["relative inline-flex items-center border px-4 py-2 text-sm font-medium",d===t.pagination.meta.current_page?"z-10 border-primary bg-primary/10 text-primary":"border-gray-300 bg-white text-gray-500 hover:bg-gray-50"]),onClick:n=>b(d)},e.toDisplayString(d),11,O)):(e.openBlock(),e.createElementBlock("span",q," ... "))],64))),128)),e.createElementVNode("button",{disabled:!f.value,class:"relative inline-flex items-center rounded-r-md border border-gray-300 bg-white px-2 py-2 text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50",onClick:v},[a[7]||(a[7]=e.createElementVNode("span",{class:"sr-only"},"Next",-1)),e.createVNode(e.unref(y.ChevronRight),{class:"h-5 w-5","aria-hidden":"true"})],8,A)])])])])):e.createCommentVNode("",!0)}}),G={class:"p-4 flex flex-col gap-4 bg-background text-foreground"},U={class:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between"},H={class:"flex flex-col gap-2 sm:flex-row sm:items-center"},Q={key:0,class:"relative w-full max-w-sm"},W=["value"],X={class:"flex items-center gap-2"},J={class:"flex items-center"},K={key:0,class:"flex items-center justify-between p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg"},Y={class:"flex items-center gap-4"},Z={class:"text-sm font-medium text-blue-700 dark:text-blue-300"},ee={class:"text-xs text-blue-600 dark:text-blue-400"},te={class:"flex items-center gap-2"},oe={key:1,class:"flex items-center justify-center p-8"},ne={class:"text-lg text-gray-700 dark:text-gray-200"},le={key:2,class:"flex flex-col items-center p-8"},re={class:"flex items-center gap-2 mb-2 text-lg text-red-600 dark:text-red-400"},ae={class:"mb-4 text-sm text-gray-600 dark:text-gray-300"},se={key:3,class:"rounded-lg border bg-background dark:border-gray-700"},ce={key:0,class:"relative"},ie={class:"relative w-full overflow-auto"},de={class:"w-full caption-bottom text-sm"},ue={class:"[&_tr]:border-b bg-muted"},ge=["colspan"],me=["onClick"],fe={key:0},pe={class:"[&_tr:last-child]:border-0 dark:[&_tr:last-child]:border-0"},be={key:1},ke=["colspan"],ye={class:"flex flex-col items-center gap-2"},ve={key:0,class:"border-t"},he=["colspan"],xe=e.defineComponent({__name:"DataTable",props:{data:{default:()=>[]},columns:{},pagination:{default:null},isLoading:{type:Boolean,default:!1},error:{default:null},search:{default:""},currentPerPage:{default:10},perPageOptions:{default:()=>[10,15,25,50,100]},sortBy:{default:null},sortDirection:{default:"asc"},rowSelection:{default:()=>({})},enableRowSelection:{type:Boolean,default:!1},getRowId:{type:Function,default:t=>t.id},showSelectionInfo:{type:Boolean,default:!0},showSearch:{type:Boolean,default:!0},showPerPageSelector:{type:Boolean,default:!0},title:{default:"Items"},itemName:{default:"items"},loadingText:{default:"Loading..."},errorTitle:{default:"Error loading data"},emptyStateText:{default:"No items found"}},emits:["pageChange","perPageChange","searchChange","sortChange","retry","update:rowSelection"],setup(t,{expose:u,emit:s}){const l=s,c=t,f=e.computed(()=>Object.keys(c.rowSelection||{}).filter(n=>{var o;return(o=c.rowSelection)==null?void 0:o[n]}).length),g=e.computed(()=>Object.keys(c.rowSelection||{}).filter(n=>{var o;return(o=c.rowSelection)==null?void 0:o[n]})),b=e.computed(()=>!c.data||!c.rowSelection?[]:c.data.filter(n=>c.rowSelection[c.getRowId(n)])),p=w.useVueTable({get data(){return c.data||[]},columns:c.columns,getCoreRowModel:w.getCoreRowModel(),enableSorting:!0,manualSorting:!0,enableRowSelection:c.enableRowSelection,getRowId:c.getRowId,state:{rowSelection:c.rowSelection||{}},onRowSelectionChange:n=>{const o=typeof n=="function"?n(c.rowSelection||{}):n;l("update:rowSelection",o)},enableMultiRowSelection:!0,enableSubRowSelection:!1}),v=()=>g.value,m=()=>b.value,a=()=>l("update:rowSelection",{}),d=()=>{const n={...c.rowSelection};p.getRowModel().rows.forEach(o=>{n[o.id]=!0}),l("update:rowSelection",n)},k=()=>{const n={...c.rowSelection};p.getRowModel().rows.forEach(o=>{delete n[o.id]}),l("update:rowSelection",n)};return u({getSelectedRowIds:v,getSelectedRowData:m,clearSelection:a,selectAllCurrentPage:d,deselectAllCurrentPage:k,selectedRowCount:f,selectedRowIds:g,selectedRowData:b,table:p}),(n,o)=>(e.openBlock(),e.createElementBlock("div",G,[e.createElementVNode("div",U,[e.createElementVNode("div",H,[t.showSearch?(e.openBlock(),e.createElementBlock("div",Q,[e.createElementVNode("input",{value:t.search,type:"search",placeholder:"Search...",class:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 ps-14 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",onInput:o[0]||(o[0]=r=>l("searchChange",r.target.value))},null,40,W)])):e.createCommentVNode("",!0),e.createElementVNode("div",X,[e.renderSlot(n.$slots,"filters")])]),e.createElementVNode("div",J,[e.renderSlot(n.$slots,"header")])]),t.enableRowSelection&&f.value>0?e.renderSlot(n.$slots,"selection-info",{key:0,selectedIds:g.value,selectedData:b.value,selectedCount:f.value,clearSelection:a,selectAllCurrentPage:d,deselectAllCurrentPage:k},()=>[t.showSelectionInfo?(e.openBlock(),e.createElementBlock("div",K,[e.createElementVNode("div",Y,[e.createElementVNode("span",Z,e.toDisplayString(f.value)+" "+e.toDisplayString(t.itemName)+" selected ",1),e.createElementVNode("div",ee," IDs: "+e.toDisplayString(g.value.slice(0,5).join(", "))+e.toDisplayString(g.value.length>5?"...":""),1)]),e.createElementVNode("div",te,[e.renderSlot(n.$slots,"bulk-actions",{selectedIds:g.value,selectedData:b.value,selectedCount:f.value,clearSelection:a,selectAllCurrentPage:d,deselectAllCurrentPage:k}),n.$slots["bulk-actions"]?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,onClick:a,class:"px-3 py-1 text-sm text-blue-700 dark:text-blue-300 hover:bg-blue-100 dark:hover:bg-blue-800 rounded transition-colors"}," Clear Selection "))])])):e.createCommentVNode("",!0)]):e.createCommentVNode("",!0),t.isLoading&&!t.data?(e.openBlock(),e.createElementBlock("div",oe,[o[4]||(o[4]=e.createElementVNode("div",{class:"w-8 h-8 mr-3 border-b-2 border-gray-900 dark:border-gray-100 rounded-full animate-spin"},null,-1)),e.createElementVNode("div",ne,e.toDisplayString(t.loadingText),1)])):t.error?(e.openBlock(),e.createElementBlock("div",le,[e.createElementVNode("div",re,[e.createVNode(e.unref(y.CircleX),{class:"size-6"}),e.createElementVNode("span",null,e.toDisplayString(t.errorTitle),1)]),e.createElementVNode("div",ae,e.toDisplayString(t.error.message),1),e.createElementVNode("button",{class:"flex items-center gap-2 px-4 py-2 text-white transition-colors bg-gray-900 rounded-md hover:bg-gray-800 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-gray-200",onClick:o[1]||(o[1]=r=>l("retry"))},[e.createVNode(e.unref(y.RefreshCw),{class:"size-4"}),o[5]||(o[5]=e.createElementVNode("span",null,"Retry",-1))])])):(e.openBlock(),e.createElementBlock("div",se,[t.isLoading?(e.openBlock(),e.createElementBlock("div",ce,[...o[6]||(o[6]=[e.createElementVNode("div",{class:"absolute inset-0 z-10 flex items-center justify-center bg-white/70 dark:bg-gray-900/70 rounded-lg"},[e.createElementVNode("div",{class:"w-6 h-6 border-b-2 border-gray-900 dark:border-gray-100 rounded-full animate-spin"})],-1)])])):e.createCommentVNode("",!0),e.createElementVNode("div",ie,[e.createElementVNode("table",de,[e.createElementVNode("thead",ue,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p).getHeaderGroups(),r=>(e.openBlock(),e.createElementBlock("tr",{key:r.id,class:"border-b transition-colors"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.headers,i=>(e.openBlock(),e.createElementBlock("th",{key:i.id,colspan:i.colSpan,class:"h-12 px-4 text-left align-middle font-bold text-muted-foreground [&:has([role=checkbox])]:pr-0"},[i.isPlaceholder?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["flex items-center gap-2",i.column.getCanSort()?"cursor-pointer select-none hover:bg-accent p-2 rounded transition-colors":""]),onClick:S=>i.column.getCanSort()?l("sortChange",i.column.id):void 0},[e.createVNode(e.unref(w.FlexRender),{render:i.column.columnDef.header,props:i.getContext()},null,8,["render","props"]),i.column.getCanSort()?(e.openBlock(),e.createElementBlock("div",fe,[t.sortBy!==i.column.id?(e.openBlock(),e.createBlock(e.unref(y.ChevronsUpDown),{key:0,size:10,class:"text-gray-400"})):t.sortBy===i.column.id&&t.sortDirection==="asc"?(e.openBlock(),e.createBlock(e.unref(y.ChevronUp),{key:1,size:10,class:"text-gray-900 dark:text-gray-100"})):t.sortBy===i.column.id&&t.sortDirection==="desc"?(e.openBlock(),e.createBlock(e.unref(y.ChevronDown),{key:2,size:10,class:"text-gray-900 dark:text-gray-100"})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],10,me))],8,ge))),128))]))),128))]),e.createElementVNode("tbody",pe,[e.unref(p).getRowModel().rows.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(p).getRowModel().rows,r=>(e.openBlock(),e.createElementBlock("tr",{key:r.id,class:e.normalizeClass(["border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted dark:border-gray-700 dark:hover:bg-gray-800",t.enableRowSelection&&r.getIsSelected()?"bg-blue-50 dark:bg-blue-900/20 border-l-4 border-l-blue-500":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.getVisibleCells(),i=>(e.openBlock(),e.createElementBlock("td",{key:i.id,class:"p-4 align-middle [&:has([role=checkbox])]:pr-0"},[e.createVNode(e.unref(w.FlexRender),{render:i.column.columnDef.cell,props:i.getContext()},null,8,["render","props"])]))),128))],2))),128)):(e.openBlock(),e.createElementBlock("tr",be,[e.createElementVNode("td",{colspan:t.columns.length,class:"h-24 text-center dark:text-gray-400"},[e.createElementVNode("div",ye,[e.createVNode(e.unref(y.Inbox),{class:"size-8 text-muted-foreground"}),e.createElementVNode("span",null,e.toDisplayString(t.emptyStateText),1)])],8,ke)]))]),t.pagination&&t.pagination.meta.last_page>1?(e.openBlock(),e.createElementBlock("tfoot",ve,[e.createElementVNode("tr",null,[e.createElementVNode("td",{colspan:t.columns.length,class:"p-0"},[e.createVNode(E,{pagination:t.pagination,"current-per-page":t.currentPerPage,"per-page-options":t.perPageOptions,"show-per-page-selector":t.showPerPageSelector,onPageChange:o[2]||(o[2]=r=>l("pageChange",r)),onPerPageChange:o[3]||(o[3]=r=>l("perPageChange",r))},null,8,["pagination","current-per-page","per-page-options","show-per-page-selector"])],8,he)])])):e.createCommentVNode("",!0)])])]))]))}});function we(...t){return C.twMerge(B.clsx(t))}exports.DataTable=xe;exports.DataTablePagination=E;exports.cn=we;exports.useDarkMode=N;exports.useRowSelection=V;
package/dist/index.mjs CHANGED
@@ -1,40 +1,122 @@
1
- import { ref as N, watchEffect as z, defineComponent as M, computed as C, createElementBlock as a, createCommentVNode as b, openBlock as n, createElementVNode as t, createTextVNode as $, toDisplayString as f, Fragment as k, renderList as S, createVNode as y, unref as m, normalizeClass as B, renderSlot as T, createBlock as _ } from "vue";
2
- import { useVueTable as j, getCoreRowModel as E, FlexRender as I } from "@tanstack/vue-table";
3
- import { ChevronLeft as L, ChevronRight as O, CircleX as V, RefreshCw as F, ChevronsUpDown as A, ChevronUp as G, ChevronDown as U, Inbox as H } from "lucide-vue-next";
4
- import { clsx as Q } from "clsx";
5
- import { twMerge as W } from "tailwind-merge";
6
- function We() {
7
- const e = N(!1);
1
+ import { ref as _, watchEffect as O, computed as w, h as T, nextTick as V, defineComponent as L, createElementBlock as s, createCommentVNode as h, openBlock as r, createElementVNode as n, createTextVNode as B, toDisplayString as p, Fragment as P, renderList as $, createVNode as C, unref as b, normalizeClass as M, renderSlot as E, createBlock as j } from "vue";
2
+ import { useVueTable as A, getCoreRowModel as F, FlexRender as N } from "@tanstack/vue-table";
3
+ import { ChevronLeft as G, ChevronRight as U, CircleX as H, RefreshCw as Q, ChevronsUpDown as W, ChevronUp as X, ChevronDown as q, Inbox as J } from "lucide-vue-next";
4
+ import { clsx as K } from "clsx";
5
+ import { twMerge as Y } from "tailwind-merge";
6
+ function Ke() {
7
+ const e = _(!1);
8
8
  if (typeof window < "u") {
9
- const d = window.matchMedia("(prefers-color-scheme: dark)");
10
- e.value = d.matches, d.addEventListener("change", (c) => {
11
- e.value = c.matches;
9
+ const c = window.matchMedia("(prefers-color-scheme: dark)");
10
+ e.value = c.matches, c.addEventListener("change", (a) => {
11
+ e.value = a.matches;
12
12
  });
13
13
  }
14
- z(() => {
14
+ O(() => {
15
15
  typeof document < "u" && (e.value ? document.documentElement.classList.add("dark") : document.documentElement.classList.remove("dark"));
16
16
  });
17
- function P() {
17
+ function f() {
18
18
  e.value = !e.value;
19
19
  }
20
20
  return {
21
21
  isDarkMode: e,
22
- toggleDarkMode: P
22
+ toggleDarkMode: f
23
23
  };
24
24
  }
25
- const X = {
25
+ function Ye(e) {
26
+ const { data: f, getRowId: c = (o) => o.id } = e, a = _({}), d = w(() => Object.keys(a.value).filter(
27
+ (o) => a.value[o]
28
+ )), y = w(() => f.value ? f.value.filter(
29
+ (o) => d.value.includes(String(c(o)))
30
+ ) : []), m = w(() => !f.value || f.value.length === 0 ? !1 : f.value.every(
31
+ (o) => a.value[String(c(o))]
32
+ )), k = w(() => f.value ? f.value.some(
33
+ (t) => a.value[String(c(t))]
34
+ ) && !m.value : !1), x = () => {
35
+ a.value = {};
36
+ }, R = () => {
37
+ if (!f.value) return;
38
+ const o = { ...a.value };
39
+ m.value ? f.value.forEach((t) => {
40
+ delete o[String(c(t))];
41
+ }) : f.value.forEach((t) => {
42
+ o[String(c(t))] = !0;
43
+ }), a.value = o;
44
+ }, v = (o) => {
45
+ const t = { ...a.value };
46
+ t[o] ? delete t[o] : t[o] = !0, a.value = t;
47
+ };
48
+ return {
49
+ rowSelection: a,
50
+ selectedRowIds: d,
51
+ selectedRowData: y,
52
+ isAllCurrentPageSelected: m,
53
+ isSomeCurrentPageSelected: k,
54
+ clearSelection: x,
55
+ toggleAllCurrentPage: R,
56
+ toggleRowSelection: v,
57
+ selectRows: (o) => {
58
+ const t = { ...a.value };
59
+ o.forEach((l) => {
60
+ t[l] = !0;
61
+ }), a.value = t;
62
+ },
63
+ deselectRows: (o) => {
64
+ const t = { ...a.value };
65
+ o.forEach((l) => {
66
+ delete t[l];
67
+ }), a.value = t;
68
+ },
69
+ getSelectionColumn: (o = {}) => {
70
+ const {
71
+ headerClass: t = "flex items-center justify-center",
72
+ cellClass: l = "flex items-center justify-center",
73
+ checkboxClass: u = "w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2",
74
+ size: z = 50
75
+ } = o;
76
+ return {
77
+ id: "select",
78
+ header: () => {
79
+ const I = T("input", {
80
+ type: "checkbox",
81
+ class: u,
82
+ checked: m.value,
83
+ onChange: R
84
+ });
85
+ return k.value && V(() => {
86
+ const D = I.el;
87
+ D && (D.indeterminate = !0);
88
+ }), T("div", { class: t }, [I]);
89
+ },
90
+ cell: ({ row: I }) => {
91
+ const D = String(c(I.original));
92
+ return T("div", { class: l }, [
93
+ T("input", {
94
+ type: "checkbox",
95
+ class: u,
96
+ checked: !!a.value[D],
97
+ onChange: () => v(D)
98
+ })
99
+ ]);
100
+ },
101
+ enableSorting: !1,
102
+ size: z
103
+ };
104
+ }
105
+ };
106
+ }
107
+ const Z = {
26
108
  key: 0,
27
109
  class: "flex items-center justify-between border-t border-border bg-background px-4 py-3 sm:px-6"
28
- }, q = { class: "flex flex-1 flex-wrap items-center justify-between gap-4" }, J = { class: "flex items-center gap-4" }, K = { class: "hidden text-sm text-muted-foreground sm:block" }, Y = { class: "font-medium" }, Z = { class: "font-medium" }, ee = { class: "font-medium" }, te = {
110
+ }, ee = { class: "flex flex-1 flex-wrap items-center justify-between gap-4" }, te = { class: "flex items-center gap-4" }, oe = { class: "hidden text-sm text-muted-foreground sm:block" }, ne = { class: "font-medium" }, ae = { class: "font-medium" }, le = { class: "font-medium" }, re = {
29
111
  key: 0,
30
112
  class: "flex items-center gap-2"
31
- }, oe = ["value"], ne = ["value"], ae = {
113
+ }, se = ["value"], ie = ["value"], ce = {
32
114
  class: "relative z-0 inline-flex -space-x-px rounded-md shadow-sm",
33
115
  "aria-label": "Pagination"
34
- }, re = ["disabled"], se = ["onClick"], le = {
116
+ }, de = ["disabled"], ue = ["onClick"], ge = {
35
117
  key: 1,
36
118
  class: "relative inline-flex items-center border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700"
37
- }, ie = ["disabled"], de = /* @__PURE__ */ M({
119
+ }, fe = ["disabled"], me = /* @__PURE__ */ L({
38
120
  __name: "DataTablePagination",
39
121
  props: {
40
122
  pagination: { default: null },
@@ -43,117 +125,117 @@ const X = {
43
125
  showPerPageSelector: { type: Boolean, default: !0 }
44
126
  },
45
127
  emits: ["pageChange", "perPageChange"],
46
- setup(e, { emit: P }) {
47
- const d = e, c = P, i = C(
48
- () => d.pagination ? d.pagination.meta.current_page > 1 : !1
49
- ), h = C(
50
- () => d.pagination ? d.pagination.meta.current_page < d.pagination.meta.last_page : !1
51
- ), v = C(() => {
52
- if (!d.pagination) return [];
53
- const x = d.pagination.meta.current_page, l = d.pagination.meta.last_page, u = 2, w = [], r = [];
54
- let o;
55
- for (let s = 1; s <= l; s++)
56
- (s === 1 || s === l || s >= x - u && s <= x + u) && w.push(s);
57
- for (const s of w)
58
- o && (s - o === 2 ? r.push(o + 1) : s - o !== 1 && r.push("...")), r.push(s), o = s;
59
- return r;
60
- }), R = (x) => {
61
- typeof x == "number" && c("pageChange", x);
62
- }, p = () => {
63
- i.value && d.pagination && c("pageChange", d.pagination.meta.current_page - 1);
64
- }, D = () => {
65
- h.value && d.pagination && c("pageChange", d.pagination.meta.current_page + 1);
128
+ setup(e, { emit: f }) {
129
+ const c = e, a = f, d = w(
130
+ () => c.pagination ? c.pagination.meta.current_page > 1 : !1
131
+ ), y = w(
132
+ () => c.pagination ? c.pagination.meta.current_page < c.pagination.meta.last_page : !1
133
+ ), m = w(() => {
134
+ if (!c.pagination) return [];
135
+ const v = c.pagination.meta.current_page, i = c.pagination.meta.last_page, g = 2, S = [], o = [];
136
+ let t;
137
+ for (let l = 1; l <= i; l++)
138
+ (l === 1 || l === i || l >= v - g && l <= v + g) && S.push(l);
139
+ for (const l of S)
140
+ t && (l - t === 2 ? o.push(t + 1) : l - t !== 1 && o.push("...")), o.push(l), t = l;
141
+ return o;
142
+ }), k = (v) => {
143
+ typeof v == "number" && a("pageChange", v);
144
+ }, x = () => {
145
+ d.value && c.pagination && a("pageChange", c.pagination.meta.current_page - 1);
146
+ }, R = () => {
147
+ y.value && c.pagination && a("pageChange", c.pagination.meta.current_page + 1);
66
148
  };
67
- return (x, l) => e.pagination && e.pagination.meta.last_page > 1 ? (n(), a("div", X, [
68
- t("div", q, [
69
- t("div", J, [
70
- t("p", K, [
71
- l[1] || (l[1] = $(" Showing ", -1)),
72
- t("span", Y, f(e.pagination.meta.from), 1),
73
- l[2] || (l[2] = $(" to ", -1)),
74
- t("span", Z, f(e.pagination.meta.to), 1),
75
- l[3] || (l[3] = $(" of ", -1)),
76
- t("span", ee, f(e.pagination.meta.total), 1),
77
- l[4] || (l[4] = $(" results ", -1))
149
+ return (v, i) => e.pagination && e.pagination.meta.last_page > 1 ? (r(), s("div", Z, [
150
+ n("div", ee, [
151
+ n("div", te, [
152
+ n("p", oe, [
153
+ i[1] || (i[1] = B(" Showing ", -1)),
154
+ n("span", ne, p(e.pagination.meta.from), 1),
155
+ i[2] || (i[2] = B(" to ", -1)),
156
+ n("span", ae, p(e.pagination.meta.to), 1),
157
+ i[3] || (i[3] = B(" of ", -1)),
158
+ n("span", le, p(e.pagination.meta.total), 1),
159
+ i[4] || (i[4] = B(" results ", -1))
78
160
  ])
79
161
  ]),
80
- e.showPerPageSelector ? (n(), a("div", te, [
81
- l[5] || (l[5] = t("p", { class: "text-sm text-muted-foreground" }, "Rows per page:", -1)),
82
- t("select", {
162
+ e.showPerPageSelector ? (r(), s("div", re, [
163
+ i[5] || (i[5] = n("p", { class: "text-sm text-muted-foreground" }, "Rows per page:", -1)),
164
+ n("select", {
83
165
  value: e.currentPerPage,
84
166
  class: "rounded-md border border-gray-300 bg-white px-2 py-1 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary",
85
- onChange: l[0] || (l[0] = (u) => c(
167
+ onChange: i[0] || (i[0] = (g) => a(
86
168
  "perPageChange",
87
- Number(u.target.value)
169
+ Number(g.target.value)
88
170
  ))
89
171
  }, [
90
- (n(!0), a(k, null, S(e.perPageOptions, (u) => (n(), a("option", {
91
- key: u,
92
- value: u
93
- }, f(u), 9, ne))), 128))
94
- ], 40, oe)
95
- ])) : b("", !0),
96
- t("div", null, [
97
- t("nav", ae, [
98
- t("button", {
99
- disabled: !i.value,
172
+ (r(!0), s(P, null, $(e.perPageOptions, (g) => (r(), s("option", {
173
+ key: g,
174
+ value: g
175
+ }, p(g), 9, ie))), 128))
176
+ ], 40, se)
177
+ ])) : h("", !0),
178
+ n("div", null, [
179
+ n("nav", ce, [
180
+ n("button", {
181
+ disabled: !d.value,
100
182
  class: "relative inline-flex items-center rounded-l-md border border-gray-300 bg-white px-2 py-2 text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50",
101
- onClick: p
183
+ onClick: x
102
184
  }, [
103
- l[6] || (l[6] = t("span", { class: "sr-only" }, "Previous", -1)),
104
- y(m(L), {
185
+ i[6] || (i[6] = n("span", { class: "sr-only" }, "Previous", -1)),
186
+ C(b(G), {
105
187
  class: "h-5 w-5",
106
188
  "aria-hidden": "true"
107
189
  })
108
- ], 8, re),
109
- (n(!0), a(k, null, S(v.value, (u, w) => (n(), a(k, { key: w }, [
110
- u !== "..." ? (n(), a("button", {
190
+ ], 8, de),
191
+ (r(!0), s(P, null, $(m.value, (g, S) => (r(), s(P, { key: S }, [
192
+ g !== "..." ? (r(), s("button", {
111
193
  key: 0,
112
- class: B([
194
+ class: M([
113
195
  "relative inline-flex items-center border px-4 py-2 text-sm font-medium",
114
- u === e.pagination.meta.current_page ? "z-10 border-primary bg-primary/10 text-primary" : "border-gray-300 bg-white text-gray-500 hover:bg-gray-50"
196
+ g === e.pagination.meta.current_page ? "z-10 border-primary bg-primary/10 text-primary" : "border-gray-300 bg-white text-gray-500 hover:bg-gray-50"
115
197
  ]),
116
- onClick: (r) => R(u)
117
- }, f(u), 11, se)) : (n(), a("span", le, " ... "))
198
+ onClick: (o) => k(g)
199
+ }, p(g), 11, ue)) : (r(), s("span", ge, " ... "))
118
200
  ], 64))), 128)),
119
- t("button", {
120
- disabled: !h.value,
201
+ n("button", {
202
+ disabled: !y.value,
121
203
  class: "relative inline-flex items-center rounded-r-md border border-gray-300 bg-white px-2 py-2 text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50",
122
- onClick: D
204
+ onClick: R
123
205
  }, [
124
- l[7] || (l[7] = t("span", { class: "sr-only" }, "Next", -1)),
125
- y(m(O), {
206
+ i[7] || (i[7] = n("span", { class: "sr-only" }, "Next", -1)),
207
+ C(b(U), {
126
208
  class: "h-5 w-5",
127
209
  "aria-hidden": "true"
128
210
  })
129
- ], 8, ie)
211
+ ], 8, fe)
130
212
  ])
131
213
  ])
132
214
  ])
133
- ])) : b("", !0);
215
+ ])) : h("", !0);
134
216
  }
135
- }), ce = { class: "p-4 flex flex-col gap-4 bg-background text-foreground" }, ue = { class: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between" }, ge = { class: "flex flex-col gap-2 sm:flex-row sm:items-center" }, me = {
217
+ }), be = { class: "p-4 flex flex-col gap-4 bg-background text-foreground" }, pe = { class: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between" }, ve = { class: "flex flex-col gap-2 sm:flex-row sm:items-center" }, he = {
136
218
  key: 0,
137
219
  class: "relative w-full max-w-sm"
138
- }, fe = ["value"], be = { class: "flex items-center gap-2" }, pe = { class: "flex items-center" }, xe = {
220
+ }, ye = ["value"], xe = { class: "flex items-center gap-2" }, we = { class: "flex items-center" }, ke = {
139
221
  key: 0,
140
222
  class: "flex items-center justify-between p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg"
141
- }, ye = { class: "flex items-center gap-4" }, he = { class: "text-sm font-medium text-blue-700 dark:text-blue-300" }, ve = { class: "text-xs text-blue-600 dark:text-blue-400" }, we = { class: "flex items-center gap-2" }, ke = {
223
+ }, Se = { class: "flex items-center gap-4" }, Ce = { class: "text-sm font-medium text-blue-700 dark:text-blue-300" }, Pe = { class: "text-xs text-blue-600 dark:text-blue-400" }, Re = { class: "flex items-center gap-2" }, $e = {
142
224
  key: 1,
143
225
  class: "flex items-center justify-center p-8"
144
- }, Se = { class: "text-lg text-gray-700 dark:text-gray-200" }, Ce = {
226
+ }, De = { class: "text-lg text-gray-700 dark:text-gray-200" }, Ie = {
145
227
  key: 2,
146
228
  class: "flex flex-col items-center p-8"
147
- }, Pe = { class: "flex items-center gap-2 mb-2 text-lg text-red-600 dark:text-red-400" }, Re = { class: "mb-4 text-sm text-gray-600 dark:text-gray-300" }, $e = {
229
+ }, Te = { class: "flex items-center gap-2 mb-2 text-lg text-red-600 dark:text-red-400" }, Be = { class: "mb-4 text-sm text-gray-600 dark:text-gray-300" }, Ee = {
148
230
  key: 3,
149
231
  class: "rounded-lg border bg-background dark:border-gray-700"
150
- }, De = {
232
+ }, je = {
151
233
  key: 0,
152
234
  class: "relative"
153
- }, Te = { class: "relative w-full overflow-auto" }, _e = { class: "w-full caption-bottom text-sm" }, Be = { class: "[&_tr]:border-b bg-muted" }, Ie = ["colspan"], Me = ["onClick"], Ne = { key: 0 }, ze = { class: "[&_tr:last-child]:border-0 dark:[&_tr:last-child]:border-0" }, je = { key: 1 }, Ee = ["colspan"], Le = { class: "flex flex-col items-center gap-2" }, Oe = {
235
+ }, Me = { class: "relative w-full overflow-auto" }, ze = { class: "w-full caption-bottom text-sm" }, Ne = { class: "[&_tr]:border-b bg-muted" }, _e = ["colspan"], Le = ["onClick"], Oe = { key: 0 }, Ve = { class: "[&_tr:last-child]:border-0 dark:[&_tr:last-child]:border-0" }, Ae = { key: 1 }, Fe = ["colspan"], Ge = { class: "flex flex-col items-center gap-2" }, Ue = {
154
236
  key: 0,
155
237
  class: "border-t"
156
- }, Ve = ["colspan"], Xe = /* @__PURE__ */ M({
238
+ }, He = ["colspan"], Ze = /* @__PURE__ */ L({
157
239
  __name: "DataTable",
158
240
  props: {
159
241
  data: { default: () => [] },
@@ -169,6 +251,7 @@ const X = {
169
251
  rowSelection: { default: () => ({}) },
170
252
  enableRowSelection: { type: Boolean, default: !1 },
171
253
  getRowId: { type: Function, default: (e) => e.id },
254
+ showSelectionInfo: { type: Boolean, default: !0 },
172
255
  showSearch: { type: Boolean, default: !0 },
173
256
  showPerPageSelector: { type: Boolean, default: !0 },
174
257
  title: { default: "Items" },
@@ -178,221 +261,232 @@ const X = {
178
261
  emptyStateText: { default: "No items found" }
179
262
  },
180
263
  emits: ["pageChange", "perPageChange", "searchChange", "sortChange", "retry", "update:rowSelection"],
181
- setup(e, { expose: P, emit: d }) {
182
- const c = d, i = e, h = C(() => Object.keys(i.rowSelection || {}).filter(
183
- (r) => {
184
- var o;
185
- return (o = i.rowSelection) == null ? void 0 : o[r];
264
+ setup(e, { expose: f, emit: c }) {
265
+ const a = c, d = e, y = w(() => Object.keys(d.rowSelection || {}).filter(
266
+ (o) => {
267
+ var t;
268
+ return (t = d.rowSelection) == null ? void 0 : t[o];
186
269
  }
187
- ).length), v = C(() => Object.keys(i.rowSelection || {}).filter(
188
- (r) => {
189
- var o;
190
- return (o = i.rowSelection) == null ? void 0 : o[r];
270
+ ).length), m = w(() => Object.keys(d.rowSelection || {}).filter(
271
+ (o) => {
272
+ var t;
273
+ return (t = d.rowSelection) == null ? void 0 : t[o];
191
274
  }
192
- )), R = C(() => !i.data || !i.rowSelection ? [] : i.data.filter((r) => i.rowSelection[i.getRowId(r)])), p = j({
275
+ )), k = w(() => !d.data || !d.rowSelection ? [] : d.data.filter((o) => d.rowSelection[d.getRowId(o)])), x = A({
193
276
  get data() {
194
- return i.data || [];
277
+ return d.data || [];
195
278
  },
196
- columns: i.columns,
197
- getCoreRowModel: E(),
279
+ columns: d.columns,
280
+ getCoreRowModel: F(),
198
281
  enableSorting: !0,
199
282
  manualSorting: !0,
200
- enableRowSelection: i.enableRowSelection,
201
- getRowId: i.getRowId,
283
+ enableRowSelection: d.enableRowSelection,
284
+ getRowId: d.getRowId,
202
285
  state: {
203
- rowSelection: i.rowSelection || {}
286
+ rowSelection: d.rowSelection || {}
204
287
  },
205
- onRowSelectionChange: (r) => {
206
- const o = typeof r == "function" ? r(i.rowSelection || {}) : r;
207
- c("update:rowSelection", o);
288
+ onRowSelectionChange: (o) => {
289
+ const t = typeof o == "function" ? o(d.rowSelection || {}) : o;
290
+ a("update:rowSelection", t);
208
291
  },
209
292
  enableMultiRowSelection: !0,
210
293
  enableSubRowSelection: !1
211
- }), D = () => v.value, x = () => R.value, l = () => c("update:rowSelection", {}), u = () => {
212
- const r = { ...i.rowSelection };
213
- p.getRowModel().rows.forEach((o) => {
214
- r[o.id] = !0;
215
- }), c("update:rowSelection", r);
216
- }, w = () => {
217
- const r = { ...i.rowSelection };
218
- p.getRowModel().rows.forEach((o) => {
219
- delete r[o.id];
220
- }), c("update:rowSelection", r);
294
+ }), R = () => m.value, v = () => k.value, i = () => a("update:rowSelection", {}), g = () => {
295
+ const o = { ...d.rowSelection };
296
+ x.getRowModel().rows.forEach((t) => {
297
+ o[t.id] = !0;
298
+ }), a("update:rowSelection", o);
299
+ }, S = () => {
300
+ const o = { ...d.rowSelection };
301
+ x.getRowModel().rows.forEach((t) => {
302
+ delete o[t.id];
303
+ }), a("update:rowSelection", o);
221
304
  };
222
- return P({
223
- getSelectedRowIds: D,
224
- getSelectedRowData: x,
225
- clearSelection: l,
226
- selectAllCurrentPage: u,
227
- deselectAllCurrentPage: w,
228
- selectedRowCount: h,
229
- selectedRowIds: v,
230
- selectedRowData: R,
231
- table: p
232
- }), (r, o) => (n(), a("div", ce, [
233
- t("div", ue, [
234
- t("div", ge, [
235
- e.showSearch ? (n(), a("div", me, [
236
- t("input", {
305
+ return f({
306
+ getSelectedRowIds: R,
307
+ getSelectedRowData: v,
308
+ clearSelection: i,
309
+ selectAllCurrentPage: g,
310
+ deselectAllCurrentPage: S,
311
+ selectedRowCount: y,
312
+ selectedRowIds: m,
313
+ selectedRowData: k,
314
+ table: x
315
+ }), (o, t) => (r(), s("div", be, [
316
+ n("div", pe, [
317
+ n("div", ve, [
318
+ e.showSearch ? (r(), s("div", he, [
319
+ n("input", {
237
320
  value: e.search,
238
321
  type: "search",
239
322
  placeholder: "Search...",
240
323
  class: "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 ps-14 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
241
- onInput: o[0] || (o[0] = (s) => c("searchChange", s.target.value))
242
- }, null, 40, fe)
243
- ])) : b("", !0),
244
- t("div", be, [
245
- T(r.$slots, "filters")
324
+ onInput: t[0] || (t[0] = (l) => a("searchChange", l.target.value))
325
+ }, null, 40, ye)
326
+ ])) : h("", !0),
327
+ n("div", xe, [
328
+ E(o.$slots, "filters")
246
329
  ])
247
330
  ]),
248
- t("div", pe, [
249
- T(r.$slots, "header")
331
+ n("div", we, [
332
+ E(o.$slots, "header")
250
333
  ])
251
334
  ]),
252
- e.enableRowSelection && h.value > 0 ? (n(), a("div", xe, [
253
- t("div", ye, [
254
- t("span", he, f(h.value) + " " + f(e.itemName) + " selected ", 1),
255
- t("div", ve, " IDs: " + f(v.value.slice(0, 5).join(", ")) + f(v.value.length > 5 ? "..." : ""), 1)
256
- ]),
257
- t("div", we, [
258
- T(r.$slots, "bulk-actions", {
259
- selectedIds: v.value,
260
- selectedData: R.value,
261
- selectedCount: h.value,
262
- clearSelection: l,
263
- selectAllCurrentPage: u,
264
- deselectAllCurrentPage: w
265
- }),
266
- r.$slots["bulk-actions"] ? b("", !0) : (n(), a("button", {
267
- key: 0,
268
- onClick: l,
269
- class: "px-3 py-1 text-sm text-blue-700 dark:text-blue-300 hover:bg-blue-100 dark:hover:bg-blue-800 rounded transition-colors"
270
- }, " Clear Selection "))
271
- ])
272
- ])) : b("", !0),
273
- e.isLoading && !e.data ? (n(), a("div", ke, [
274
- o[4] || (o[4] = t("div", { class: "w-8 h-8 mr-3 border-b-2 border-gray-900 dark:border-gray-100 rounded-full animate-spin" }, null, -1)),
275
- t("div", Se, f(e.loadingText), 1)
276
- ])) : e.error ? (n(), a("div", Ce, [
277
- t("div", Pe, [
278
- y(m(V), { class: "size-6" }),
279
- t("span", null, f(e.errorTitle), 1)
335
+ e.enableRowSelection && y.value > 0 ? E(o.$slots, "selection-info", {
336
+ key: 0,
337
+ selectedIds: m.value,
338
+ selectedData: k.value,
339
+ selectedCount: y.value,
340
+ clearSelection: i,
341
+ selectAllCurrentPage: g,
342
+ deselectAllCurrentPage: S
343
+ }, () => [
344
+ e.showSelectionInfo ? (r(), s("div", ke, [
345
+ n("div", Se, [
346
+ n("span", Ce, p(y.value) + " " + p(e.itemName) + " selected ", 1),
347
+ n("div", Pe, " IDs: " + p(m.value.slice(0, 5).join(", ")) + p(m.value.length > 5 ? "..." : ""), 1)
348
+ ]),
349
+ n("div", Re, [
350
+ E(o.$slots, "bulk-actions", {
351
+ selectedIds: m.value,
352
+ selectedData: k.value,
353
+ selectedCount: y.value,
354
+ clearSelection: i,
355
+ selectAllCurrentPage: g,
356
+ deselectAllCurrentPage: S
357
+ }),
358
+ o.$slots["bulk-actions"] ? h("", !0) : (r(), s("button", {
359
+ key: 0,
360
+ onClick: i,
361
+ class: "px-3 py-1 text-sm text-blue-700 dark:text-blue-300 hover:bg-blue-100 dark:hover:bg-blue-800 rounded transition-colors"
362
+ }, " Clear Selection "))
363
+ ])
364
+ ])) : h("", !0)
365
+ ]) : h("", !0),
366
+ e.isLoading && !e.data ? (r(), s("div", $e, [
367
+ t[4] || (t[4] = n("div", { class: "w-8 h-8 mr-3 border-b-2 border-gray-900 dark:border-gray-100 rounded-full animate-spin" }, null, -1)),
368
+ n("div", De, p(e.loadingText), 1)
369
+ ])) : e.error ? (r(), s("div", Ie, [
370
+ n("div", Te, [
371
+ C(b(H), { class: "size-6" }),
372
+ n("span", null, p(e.errorTitle), 1)
280
373
  ]),
281
- t("div", Re, f(e.error.message), 1),
282
- t("button", {
374
+ n("div", Be, p(e.error.message), 1),
375
+ n("button", {
283
376
  class: "flex items-center gap-2 px-4 py-2 text-white transition-colors bg-gray-900 rounded-md hover:bg-gray-800 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-gray-200",
284
- onClick: o[1] || (o[1] = (s) => c("retry"))
377
+ onClick: t[1] || (t[1] = (l) => a("retry"))
285
378
  }, [
286
- y(m(F), { class: "size-4" }),
287
- o[5] || (o[5] = t("span", null, "Retry", -1))
379
+ C(b(Q), { class: "size-4" }),
380
+ t[5] || (t[5] = n("span", null, "Retry", -1))
288
381
  ])
289
- ])) : (n(), a("div", $e, [
290
- e.isLoading ? (n(), a("div", De, [...o[6] || (o[6] = [
291
- t("div", { class: "absolute inset-0 z-10 flex items-center justify-center bg-white/70 dark:bg-gray-900/70 rounded-lg" }, [
292
- t("div", { class: "w-6 h-6 border-b-2 border-gray-900 dark:border-gray-100 rounded-full animate-spin" })
382
+ ])) : (r(), s("div", Ee, [
383
+ e.isLoading ? (r(), s("div", je, [...t[6] || (t[6] = [
384
+ n("div", { class: "absolute inset-0 z-10 flex items-center justify-center bg-white/70 dark:bg-gray-900/70 rounded-lg" }, [
385
+ n("div", { class: "w-6 h-6 border-b-2 border-gray-900 dark:border-gray-100 rounded-full animate-spin" })
293
386
  ], -1)
294
- ])])) : b("", !0),
295
- t("div", Te, [
296
- t("table", _e, [
297
- t("thead", Be, [
298
- (n(!0), a(k, null, S(m(p).getHeaderGroups(), (s) => (n(), a("tr", {
299
- key: s.id,
387
+ ])])) : h("", !0),
388
+ n("div", Me, [
389
+ n("table", ze, [
390
+ n("thead", Ne, [
391
+ (r(!0), s(P, null, $(b(x).getHeaderGroups(), (l) => (r(), s("tr", {
392
+ key: l.id,
300
393
  class: "border-b transition-colors"
301
394
  }, [
302
- (n(!0), a(k, null, S(s.headers, (g) => (n(), a("th", {
303
- key: g.id,
304
- colspan: g.colSpan,
395
+ (r(!0), s(P, null, $(l.headers, (u) => (r(), s("th", {
396
+ key: u.id,
397
+ colspan: u.colSpan,
305
398
  class: "h-12 px-4 text-left align-middle font-bold text-muted-foreground [&:has([role=checkbox])]:pr-0"
306
399
  }, [
307
- g.isPlaceholder ? b("", !0) : (n(), a("div", {
400
+ u.isPlaceholder ? h("", !0) : (r(), s("div", {
308
401
  key: 0,
309
- class: B([
402
+ class: M([
310
403
  "flex items-center gap-2",
311
- g.column.getCanSort() ? "cursor-pointer select-none hover:bg-accent p-2 rounded transition-colors" : ""
404
+ u.column.getCanSort() ? "cursor-pointer select-none hover:bg-accent p-2 rounded transition-colors" : ""
312
405
  ]),
313
- onClick: (Fe) => g.column.getCanSort() ? c("sortChange", g.column.id) : void 0
406
+ onClick: (z) => u.column.getCanSort() ? a("sortChange", u.column.id) : void 0
314
407
  }, [
315
- y(m(I), {
316
- render: g.column.columnDef.header,
317
- props: g.getContext()
408
+ C(b(N), {
409
+ render: u.column.columnDef.header,
410
+ props: u.getContext()
318
411
  }, null, 8, ["render", "props"]),
319
- g.column.getCanSort() ? (n(), a("div", Ne, [
320
- e.sortBy !== g.column.id ? (n(), _(m(A), {
412
+ u.column.getCanSort() ? (r(), s("div", Oe, [
413
+ e.sortBy !== u.column.id ? (r(), j(b(W), {
321
414
  key: 0,
322
415
  size: 10,
323
416
  class: "text-gray-400"
324
- })) : e.sortBy === g.column.id && e.sortDirection === "asc" ? (n(), _(m(G), {
417
+ })) : e.sortBy === u.column.id && e.sortDirection === "asc" ? (r(), j(b(X), {
325
418
  key: 1,
326
419
  size: 10,
327
420
  class: "text-gray-900 dark:text-gray-100"
328
- })) : e.sortBy === g.column.id && e.sortDirection === "desc" ? (n(), _(m(U), {
421
+ })) : e.sortBy === u.column.id && e.sortDirection === "desc" ? (r(), j(b(q), {
329
422
  key: 2,
330
423
  size: 10,
331
424
  class: "text-gray-900 dark:text-gray-100"
332
- })) : b("", !0)
333
- ])) : b("", !0)
334
- ], 10, Me))
335
- ], 8, Ie))), 128))
425
+ })) : h("", !0)
426
+ ])) : h("", !0)
427
+ ], 10, Le))
428
+ ], 8, _e))), 128))
336
429
  ]))), 128))
337
430
  ]),
338
- t("tbody", ze, [
339
- m(p).getRowModel().rows.length > 0 ? (n(!0), a(k, { key: 0 }, S(m(p).getRowModel().rows, (s) => (n(), a("tr", {
340
- key: s.id,
341
- class: B([
431
+ n("tbody", Ve, [
432
+ b(x).getRowModel().rows.length > 0 ? (r(!0), s(P, { key: 0 }, $(b(x).getRowModel().rows, (l) => (r(), s("tr", {
433
+ key: l.id,
434
+ class: M([
342
435
  "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted dark:border-gray-700 dark:hover:bg-gray-800",
343
- e.enableRowSelection && s.getIsSelected() ? "bg-blue-50 dark:bg-blue-900/20 border-l-4 border-l-blue-500" : ""
436
+ e.enableRowSelection && l.getIsSelected() ? "bg-blue-50 dark:bg-blue-900/20 border-l-4 border-l-blue-500" : ""
344
437
  ])
345
438
  }, [
346
- (n(!0), a(k, null, S(s.getVisibleCells(), (g) => (n(), a("td", {
347
- key: g.id,
439
+ (r(!0), s(P, null, $(l.getVisibleCells(), (u) => (r(), s("td", {
440
+ key: u.id,
348
441
  class: "p-4 align-middle [&:has([role=checkbox])]:pr-0"
349
442
  }, [
350
- y(m(I), {
351
- render: g.column.columnDef.cell,
352
- props: g.getContext()
443
+ C(b(N), {
444
+ render: u.column.columnDef.cell,
445
+ props: u.getContext()
353
446
  }, null, 8, ["render", "props"])
354
447
  ]))), 128))
355
- ], 2))), 128)) : (n(), a("tr", je, [
356
- t("td", {
448
+ ], 2))), 128)) : (r(), s("tr", Ae, [
449
+ n("td", {
357
450
  colspan: e.columns.length,
358
451
  class: "h-24 text-center dark:text-gray-400"
359
452
  }, [
360
- t("div", Le, [
361
- y(m(H), { class: "size-8 text-muted-foreground" }),
362
- t("span", null, f(e.emptyStateText), 1)
453
+ n("div", Ge, [
454
+ C(b(J), { class: "size-8 text-muted-foreground" }),
455
+ n("span", null, p(e.emptyStateText), 1)
363
456
  ])
364
- ], 8, Ee)
457
+ ], 8, Fe)
365
458
  ]))
366
459
  ]),
367
- e.pagination && e.pagination.meta.last_page > 1 ? (n(), a("tfoot", Oe, [
368
- t("tr", null, [
369
- t("td", {
460
+ e.pagination && e.pagination.meta.last_page > 1 ? (r(), s("tfoot", Ue, [
461
+ n("tr", null, [
462
+ n("td", {
370
463
  colspan: e.columns.length,
371
464
  class: "p-0"
372
465
  }, [
373
- y(de, {
466
+ C(me, {
374
467
  pagination: e.pagination,
375
468
  "current-per-page": e.currentPerPage,
376
469
  "per-page-options": e.perPageOptions,
377
470
  "show-per-page-selector": e.showPerPageSelector,
378
- onPageChange: o[2] || (o[2] = (s) => c("pageChange", s)),
379
- onPerPageChange: o[3] || (o[3] = (s) => c("perPageChange", s))
471
+ onPageChange: t[2] || (t[2] = (l) => a("pageChange", l)),
472
+ onPerPageChange: t[3] || (t[3] = (l) => a("perPageChange", l))
380
473
  }, null, 8, ["pagination", "current-per-page", "per-page-options", "show-per-page-selector"])
381
- ], 8, Ve)
474
+ ], 8, He)
382
475
  ])
383
- ])) : b("", !0)
476
+ ])) : h("", !0)
384
477
  ])
385
478
  ])
386
479
  ]))
387
480
  ]));
388
481
  }
389
482
  });
390
- function qe(...e) {
391
- return W(Q(e));
483
+ function et(...e) {
484
+ return Y(K(e));
392
485
  }
393
486
  export {
394
- Xe as DataTable,
395
- de as DataTablePagination,
396
- qe as cn,
397
- We as useDarkMode
487
+ Ze as DataTable,
488
+ me as DataTablePagination,
489
+ et as cn,
490
+ Ke as useDarkMode,
491
+ Ye as useRowSelection
398
492
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toniel/laravel-tanstack-datatable",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Vue 3 DataTable components for Laravel pagination with TanStack Query and shadcn-vue",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",