@johnhalazonetis/data-table 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@johnhalazonetis/data-table",
3
+ "version": "1.23.0",
4
+ "description": "Feature-rich Vue 3 data grid built on TanStack Table",
5
+ "type": "module",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "src/components/DataTable/index.d.ts"
12
+ ],
13
+ "exports": {
14
+ ".": {
15
+ "types": "./src/components/DataTable/index.d.ts",
16
+ "default": "./dist/data-table.js"
17
+ },
18
+ "./style.css": "./dist/data-table.css"
19
+ },
20
+ "scripts": {
21
+ "dev": "vite",
22
+ "build": "BUILD_LIB=true vite build",
23
+ "build:demo": "vite build",
24
+ "build:lib": "BUILD_LIB=true vite build",
25
+ "prepare": "test -f dist/data-table.js || BUILD_LIB=true vite build",
26
+ "preview": "vite preview --outDir dist-demo"
27
+ },
28
+ "peerDependencies": {
29
+ "@tanstack/vue-table": "^8.21",
30
+ "@tanstack/vue-virtual": "^3.13",
31
+ "@vueuse/core": "^14.2",
32
+ "vue": "^3.5"
33
+ },
34
+ "devDependencies": {
35
+ "@tailwindcss/vite": "^4.3.0",
36
+ "@tanstack/vue-table": "^8.21.3",
37
+ "@tanstack/vue-virtual": "^3.13.24",
38
+ "@vitejs/plugin-vue": "^6.0.6",
39
+ "@vueuse/core": "^14.3.0",
40
+ "tailwindcss": "^4.3.0",
41
+ "vite": "^8.0.12",
42
+ "vue": "^3.5.34"
43
+ }
44
+ }
@@ -0,0 +1,128 @@
1
+ import type { DefineComponent } from 'vue'
2
+ import type { ColumnDef } from '@tanstack/vue-table'
3
+
4
+ /** Custom action shown in the selection toolbar when rows are selected. */
5
+ export interface SelectionAction {
6
+ key: string
7
+ label: string
8
+ }
9
+
10
+ /** Item in the toolbar Actions dropdown next to Sort. */
11
+ export interface ToolbarAction {
12
+ key: string
13
+ label: string
14
+ icon?: string
15
+ disabled?: boolean
16
+ divider?: boolean
17
+ }
18
+
19
+ /** Extra context-menu item (right-click) and bulk Actions menu item when multi-selecting. */
20
+ export interface RowAction {
21
+ /** Omit when `divider` is true. */
22
+ key?: string
23
+ /** Omit when `divider` is true. */
24
+ label?: string
25
+ /** Raw SVG markup; `stroke="currentColor"` recommended. */
26
+ icon?: string
27
+ /** When true, label and icon use the table destructive color (`--st-danger`). */
28
+ danger?: boolean
29
+ /** Alternative to `danger` (either may be set). */
30
+ variant?: 'default' | 'destructive'
31
+ /** Renders a horizontal rule; omit `key`, `label`, and `icon`. */
32
+ divider?: boolean
33
+ /**
34
+ * When true, item is non-interactive. When a function, it receives the row’s `original` data (right-click);
35
+ * in the selection toolbar bulk menu, function callbacks are treated as not disabled so actions stay clickable.
36
+ */
37
+ disabled?: boolean | ((row: any) => boolean)
38
+ }
39
+
40
+ /** Returned from `getSubTable` — nested rows + column defs. */
41
+ export interface SubTableConfig {
42
+ rows: unknown[]
43
+ /** Use `ColumnDef<any>` so callers can pass TanStack defs typed to their row model. */
44
+ columns: ColumnDef<any, any>[]
45
+ /** Optional; passed through to the nested `DataTable`. */
46
+ fontFamily?: string | null
47
+ /** Extra context-menu items for nested rows; forwarded as `contextMenuActions`. */
48
+ contextMenuActions?: ReadonlyArray<RowAction>
49
+ /** Handled internally (stripped before `v-bind`); invokes on nested `@row-action`. */
50
+ onRowAction?: (key: string, rowData: unknown) => void
51
+ }
52
+
53
+ /** Commit payload when `stagedEdits` is true. */
54
+ export interface CommitEditsPayload {
55
+ inserts: Record<string, unknown>[]
56
+ updates: Array<{ id: unknown; changes: Record<string, unknown> }>
57
+ deletes: unknown[]
58
+ }
59
+
60
+ /** Item in the insert button dropdown (`insertActions`). */
61
+ export interface InsertAction {
62
+ key: string
63
+ label: string
64
+ icon?: string
65
+ }
66
+
67
+ export interface DataTableProps {
68
+ columns: ColumnDef<any, any>[]
69
+ rows: unknown[]
70
+ tableName?: string
71
+ loading?: boolean
72
+ error?: string | null
73
+ defaultColumnVisibility?: Record<string, boolean>
74
+ showDataTypes?: boolean
75
+ editable?: boolean | { insert?: boolean; update?: boolean; delete?: boolean }
76
+ selectionActions?: SelectionAction[]
77
+ enableSelectAll?: boolean
78
+ toolbarActions?: ToolbarAction[]
79
+ toolbarActionsLabel?: string
80
+ defaultInsertLabel?: string | null
81
+ /** Custom insert/import menu entries; emits `insert-action` with `key`. */
82
+ insertActions?: InsertAction[]
83
+ showRowBorders?: boolean
84
+ showColumnBorders?: boolean
85
+ cellButtonVisibility?: 'hover' | 'always' | 'select'
86
+ /** Default text cell overflow; per-column `meta.overflow` overrides. */
87
+ cellOverflow?: 'truncate' | 'wrap'
88
+ theme?: 'dark' | 'light'
89
+ accentColor?: string
90
+ /**
91
+ * CSS `font-family` value (e.g. `"Inter", sans-serif`). Inherits to nested/sub-tables via provide/inject.
92
+ * Omit for the bundled system UI stack from `data-table/style.css`.
93
+ */
94
+ fontFamily?: string | null
95
+ getSubTable?: ((rowData: any) => SubTableConfig | null) | null
96
+ subTableColumns?: ColumnDef<any, any>[] | null
97
+ expandedRows?: Record<string, boolean> | null
98
+ nestingDepth?: number
99
+ showToolbar?: boolean
100
+ showPagination?: boolean
101
+ emptyTitle?: string
102
+ emptyMessage?: string
103
+ totalCount?: number | null
104
+ /** Same as totalCount when only server count is known; optional when using filtered exact count. */
105
+ totalFilteredCount?: number | null
106
+ /** Ids selected via parent “select all matching” (cross-page). */
107
+ additionalSelectedRowIds?: readonly string[] | string[] | null
108
+ enableSelectAllMatching?: boolean
109
+ hasRandomAccess?: boolean
110
+ columnFilters?: unknown[] | null
111
+ controlledSorting?: unknown[] | null
112
+ controlledColumnFilters?: unknown[] | null
113
+ controlledColumnVisibility?: Record<string, boolean> | null
114
+ stagedEdits?: boolean
115
+ /** Singular noun after the total in the footer (default "record"). */
116
+ countLabelSingular?: string
117
+ /** Plural noun after the total in the footer (default "records"). */
118
+ countLabelPlural?: string
119
+ /** Extra context-menu entries (right-click); also listed in selection toolbar Actions when multi-selecting. */
120
+ contextMenuActions?: ReadonlyArray<RowAction>
121
+ }
122
+
123
+ /** Exposed instance API (template ref): `ref.value.openDeleteConfirmation(['id', ...])`. */
124
+ export interface DataTableExpose {
125
+ openDeleteConfirmation: (ids: readonly string[] | string[]) => void
126
+ }
127
+
128
+ export declare const DataTable: DefineComponent<DataTableProps>