vueye-table 2.0.0-alpha.9 → 3.0.0-alpha.10

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.
Files changed (42) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +148 -65
  3. package/dist/index.d.ts +1238 -1
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +820 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/style.css +1 -1
  8. package/package.json +48 -73
  9. package/dist/components/core/VueyeTable/VueyeTable.vue.d.ts +0 -65
  10. package/dist/components/core/VueyeTable/api.d.ts +0 -14
  11. package/dist/components/core/VueyeTable/components/VueyeBody/VueyeBody.vue.d.ts +0 -49
  12. package/dist/components/core/VueyeTable/components/VueyeBody/api.d.ts +0 -7
  13. package/dist/components/core/VueyeTable/components/VueyeBody/index.d.ts +0 -2
  14. package/dist/components/core/VueyeTable/components/VueyeDropdown/api.d.ts +0 -20
  15. package/dist/components/core/VueyeTable/components/VueyeDropdown/index.d.ts +0 -4
  16. package/dist/components/core/VueyeTable/components/VueyeHead/VueyeHead.vue.d.ts +0 -22
  17. package/dist/components/core/VueyeTable/components/VueyeHead/index.d.ts +0 -2
  18. package/dist/components/core/VueyeTable/components/VueyePagination/VueyePagination.vue.d.ts +0 -56
  19. package/dist/components/core/VueyeTable/components/VueyePagination/api.d.ts +0 -12
  20. package/dist/components/core/VueyeTable/components/VueyePagination/index.d.ts +0 -2
  21. package/dist/components/core/VueyeTable/components/index.d.ts +0 -4
  22. package/dist/components/core/VueyeTable/composables/index.d.ts +0 -4
  23. package/dist/components/core/VueyeTable/composables/useHeaderKeys.d.ts +0 -4
  24. package/dist/components/core/VueyeTable/composables/usePagination.d.ts +0 -11
  25. package/dist/components/core/VueyeTable/index.d.ts +0 -5
  26. package/dist/components/core/VueyeTable/types/Column.d.ts +0 -55
  27. package/dist/components/core/VueyeTable/types/Row.d.ts +0 -3
  28. package/dist/components/core/VueyeTable/types/Utils.d.ts +0 -19
  29. package/dist/components/core/VueyeTable/types/index.d.ts +0 -3
  30. package/dist/components/core/VueyeTable/utils/body.d.ts +0 -4
  31. package/dist/components/core/VueyeTable/utils/header.d.ts +0 -7
  32. package/dist/components/core/VueyeTable/utils/humanize.d.ts +0 -1
  33. package/dist/components/core/VueyeTable/utils/index.d.ts +0 -3
  34. package/dist/components/index.d.ts +0 -1
  35. package/dist/composables/dark.d.ts +0 -2
  36. package/dist/composables/index.d.ts +0 -1
  37. package/dist/favicon.ico +0 -0
  38. package/dist/histoire-setup.d.ts +0 -0
  39. package/dist/main.d.ts +0 -1
  40. package/dist/vueye-table.js +0 -429
  41. package/dist/vueye-table.umd.cjs +0 -1
  42. package/dist/white-logo.ico +0 -0
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 radix-vue
3
+ Copyright (c) 2026 Brahim Boussadjra and vueye-table contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,89 +1,172 @@
1
- # Vueye Table
1
+ # vueye-table
2
2
 
3
- Vueye Table is a Vue 3 component for displaying data in a table.
3
+ `VueyeTable` and `VueyeGrid` support opt-in virtualization through `virtual`, `height`, `rowHeight` and `overscan`; grids also expose `virtualColumns` and `columnWidth`. Virtual tables default to no paging, with `paginate` available for large pages. The guide and runnable 100k-record example live in `docs/guide/virtualization.md` and `docs/examples/virtual-components.md`.
4
4
 
5
- ## Installation
5
+ A Vue framework for data, data tables, and spreadsheets.
6
+
7
+ vueye-table began as a single table component. Version 3 is a rewrite around one idea: a table is
8
+ data plus state plus operations, and rendering is a separate concern. A framework-independent
9
+ engine owns searching, filtering, sorting, pagination, selection, column visibility, editing,
10
+ undo, clipboard, and export. Vue layers sit on top of it, and you pick the one that fits:
11
+
12
+ | Layer | Package | Use it when |
13
+ | ------------------- | ----------------------- | ---------------------------------------------------------- |
14
+ | Full UI | `vueye-table` | You want a complete table or spreadsheet in one tag. |
15
+ | Styled components | `@vueye-table/styled` | You want the look, arranged your own way. |
16
+ | Headless components | `@vueye-table/headless` | You want accessible behavior with your own markup and CSS. |
17
+ | Vue composables | `@vueye-table/vue` | You want reactive state and nothing rendered. |
18
+ | Engine | `@vueye-table/core` | You are outside Vue, on a server, or writing a binding. |
19
+ | Nuxt module | `@vueye-table/nuxt` | You use Nuxt 4. |
20
+
21
+ Each layer depends only on the layers beneath it, and `vueye-table` re-exports all of them, so
22
+ one install covers every level.
23
+
24
+ > **Status:** `3.0.0-alpha`. The API is provisional and may change between alpha releases. The
25
+ > 2.x component lives on the [`legacy`](https://github.com/boussadjra/vueye-table/tree/legacy)
26
+ > branch; see [Upgrading from 2.x](./docs/guide/upgrading-from-2.md).
27
+
28
+ ## Install
6
29
 
7
30
  ```bash
8
- npm install vueye-table
31
+ pnpm add vueye-table
9
32
  ```
10
33
 
11
- ## Usage
34
+ Vue 3.5 or newer is a peer dependency.
35
+
36
+ ## Full table
12
37
 
13
38
  ```vue
39
+ <script setup lang="ts">
40
+ import "vueye-table/style.css";
41
+ import { ref } from "vue";
42
+ import { VueyeTable, defineColumns, type RowKey } from "vueye-table";
43
+
44
+ interface User {
45
+ id: number;
46
+ name: { first: string; last: string };
47
+ age: number;
48
+ city: string;
49
+ }
50
+
51
+ const users: User[] = [
52
+ { id: 1, name: { first: "Ada", last: "Lovelace" }, age: 36, city: "London" },
53
+ { id: 2, name: { first: "Alan", last: "Turing" }, age: 41, city: "Wilmslow" },
54
+ ];
55
+
56
+ const columns = defineColumns<User>([
57
+ { id: "name.first", header: "First name" },
58
+ { id: "name.last", header: "Last name" },
59
+ { id: "age", align: "end", format: (age) => `${age} years` },
60
+ { id: "city" },
61
+ ]);
62
+
63
+ const selected = ref<readonly RowKey[]>([]);
64
+ </script>
65
+
14
66
  <template>
15
- <VueyeTable
16
- :data="data"
17
- :columnHeaders="columnHeaders"
18
- :itemValue="itemValue"
19
- :perPage="perPage"
20
- :currentPage="currentPage"
21
- :perPageOptions="perPageOptions"
22
- :loading="loading"
23
- :selected="selected"
24
- :selectMode="selectMode"
25
- :caption="caption"
26
- :summary="summary"
27
- @update:loading="updateLoading"
28
- @update:selected="updateSelected"
29
- >
30
- <template #headerCellContent.name="props">
31
- {{ props.columnHeader.name }}
32
- </template>
33
- <template #itemCellContent.name="props">
34
- {{ props.item.name }}
35
- </template>
36
- </VueyeTable>
67
+ <VueyeTable v-model:selected="selected" :data="users" :columns="columns" selectable striped>
68
+ <template #cell.city="{ value }">
69
+ <strong>{{ value }}</strong>
70
+ </template>
71
+ </VueyeTable>
37
72
  </template>
38
73
  ```
39
74
 
40
- ### VueyeTableProps
75
+ Column ids are typed paths into your rows, so `format` above receives a `number`. Without
76
+ `columns`, columns are inferred from the data.
77
+
78
+ Every piece of state has a `v-model`: `page`, `pageSize`, `sorting`, `search`, `filters`,
79
+ `hiddenColumns`, and `selected`. Add `manual` and `row-count` to let a server search, sort, and
80
+ page, with the table presenting whatever page it returns.
41
81
 
42
- | Prop Name | Type | Default Value | Description |
43
- | --- | --- | --- | --- |
44
- | data | TData[] | [] | An array of data for the table. |
45
- | columnHeaders | TColumn[] or a function returning an array | [] | An array of column headers for the table. |
46
- | itemValue | string | 'id' | The property name used as a unique identifier for each item. |
47
- | perPage | number | 10 | The number of items displayed per page. |
48
- | currentPage | number | 1 | The current page number. |
49
- | perPageOptions | number[] or a function returning an array | [5, 10, 20, 30] | An array of options for the number of items per page. |
50
- | loading | boolean | false | Indicates whether the table is in a loading state. |
51
- | selected | TData[], Row[], or null | null | An array of selected items or rows. |
52
- | selectMode | 'page' or 'all' | 'all' | The mode for selecting items: 'page' or 'all'. |
53
- | caption | string | '' | The table's caption. |
54
- | summary | string | '' | The table's summary. |
82
+ ## Spreadsheet
55
83
 
56
- ### VueyeTableEmits
84
+ ```vue
85
+ <VueyeGrid v-model:data="lines" :columns="columns" column-letters />
86
+ ```
87
+
88
+ Cells edit in place. Arrows, Tab, Home, and End move; Shift extends the range; Enter or typing
89
+ starts an edit; Delete clears; and copy, cut, paste, undo, and redo behave like a spreadsheet
90
+ application. Each edit emits a new array; the one you passed in is never mutated. Text is parsed
91
+ by the column's type, and a value that cannot be read is refused and reported through
92
+ `edit-error`.
93
+
94
+ ## Headless
57
95
 
58
- | Emit Name | Parameters | Description |
59
- | --------------- | -------------- | ------------------------------------- |
60
- | update:loading | value: boolean | Emits when the loading state changes. |
61
- | update:selected | value: T[] | Emits when the selected items change. |
96
+ ```vue
97
+ <script setup lang="ts">
98
+ import { DataTableRoot, DataTablePagination, DataTableSearch, useDataTable } from "vueye-table";
62
99
 
63
- ### PaginationEmits
100
+ const table = useDataTable({ data: users, columns });
101
+ </script>
64
102
 
65
- | Emit Name | Parameters | Description |
66
- | ------------------ | ------------- | ------------------------------------------------ |
67
- | update:currentPage | value: number | Emits when the current page changes. |
68
- | update:perPage | value: number | Emits when the number of items per page changes. |
103
+ <template>
104
+ <DataTableRoot :table="table" as="div">
105
+ <DataTableSearch />
106
+ <article v-for="row in table.rows" :key="row.key">{{ row.getDisplay("name.first") }}</article>
107
+ <DataTablePagination />
108
+ </DataTableRoot>
109
+ </template>
110
+ ```
69
111
 
70
- ### SlotHeader
112
+ Headless components render semantic, accessible markup (`aria-sort`, `aria-selected`,
113
+ `aria-rowindex`, a polite live status, grid keyboard navigation) with `data-*` state attributes
114
+ and no styles. Every one accepts `as` and exposes its state through slot props.
71
115
 
72
- The SlotHeader component defines various slots for customizing the table header.
116
+ ## Engine
73
117
 
74
- - `headerCell.<ColumnKey>`: Slot for customizing the content of a specific column header.
75
- - `headerCellContent.<ColumnKey>`: Slot for customizing the content within a specific column header cell.
76
- - `headers`: Slot for customizing the entire table header, containing all column headers.
77
- - `checkbox`: Slot for customizing the checkbox used for selecting all items.
118
+ ```ts
119
+ import { createTable } from "@vueye-table/core";
78
120
 
79
- ### SlotRow
121
+ const table = createTable({ data: users, columns: [{ id: "age" }, { id: "city" }] });
122
+ table.search("lon");
123
+ table.toggleSort("age");
124
+ table.getSnapshot().rows; // the current page
125
+ table.exportRows(); // CSV of every filtered row
126
+ ```
127
+
128
+ The state is plain serializable data, so it can be saved, restored, sent to a server, or kept in
129
+ the URL.
130
+
131
+ ## Nuxt
132
+
133
+ ```ts
134
+ export default defineNuxtConfig({
135
+ modules: ["@vueye-table/nuxt"],
136
+ });
137
+ ```
138
+
139
+ The module auto-imports `<VueyeTable>`, `<VueyeGrid>`, `useDataTable`, `useDataGrid`, and
140
+ `defineColumns`, and adds the stylesheet. Set `vueyeTable: { layers: true }` to also register the
141
+ headless and styled components.
142
+
143
+ ## Theming
144
+
145
+ The styled layer is driven by CSS custom properties on `.vt-surface`:
146
+
147
+ ```css
148
+ .vt-surface {
149
+ --vt-accent: #0f766e;
150
+ --vt-radius: 4px;
151
+ --vt-font-size: 0.8125rem;
152
+ }
153
+ ```
154
+
155
+ Dark colors follow `prefers-color-scheme`; `theme="dark"` or `theme="light"` forces one.
156
+ Density is `compact`, `comfortable`, or `spacious`.
157
+
158
+ ## Development
159
+
160
+ ```bash
161
+ pnpm install
162
+ pnpm playground # every layer, side by side
163
+ pnpm test # every Vitest project
164
+ pnpm check # format, lint, types, tests with coverage, build, boundaries, packages
165
+ ```
80
166
 
81
- The SlotRow component defines various slots for customizing the table rows.
167
+ Architecture lives in [ARCHITECTURE.md](./ARCHITECTURE.md) and decisions in
168
+ [docs/adr](./docs/adr).
82
169
 
83
- - `itemCell.<ItemKey>`: Slot for customizing the content of a specific item cell within a row.
84
- - `itemCellContent.<ItemKey>`: Slot for customizing the content within a specific item cell.
85
- - `rows`: Slot for customizing the entire table rows, containing all rows.
86
- - `row`: Slot for customizing a specific row.
87
- - `checkbox`: Slot for customizing the checkbox used for selecting a specific row.
170
+ ## License
88
171
 
89
- You can use these Markdown tables to document the props, emits, and slot definitions for the data table and pagination components in your Vue 3 project.
172
+ [MIT](./LICENSE)