@sulzanoks/vue-datatable 0.4.4 → 0.5.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/README.md CHANGED
@@ -11,7 +11,7 @@ It supports server-side pagination, sorting, global and per-column search, row s
11
11
  - `@inertiajs/vue3`
12
12
  - A server endpoint that accepts DataTables-style query parameters and returns a compatible response
13
13
 
14
- The component also uses Bootstrap/Material-style classes and Material Icons in its default markup.
14
+ Load Material Icons for the default toolbar icons and for icon names supplied through component props.
15
15
 
16
16
  ## Installation
17
17
 
@@ -19,6 +19,72 @@ The component also uses Bootstrap/Material-style classes and Material Icons in i
19
19
  npm install @sulzanoks/vue-datatable
20
20
  ```
21
21
 
22
+ Import the component and its stylesheet in your app:
23
+
24
+ ```js
25
+ import DatatableCard from '@sulzanoks/vue-datatable';
26
+ import '@sulzanoks/vue-datatable/dist/style.css';
27
+ ```
28
+
29
+ The package supplies its own layout and control styles. The page-size menu is controlled by Vue and offers 10, 25, 50, and 100 rows. It highlights the current size, closes on selection, outside click, or Escape, and returns to the first page when the size changes.
30
+
31
+ ## Local development
32
+
33
+ From the package repository:
34
+
35
+ ```sh
36
+ npm install
37
+ npm link
38
+ npm run build -- --watch
39
+ ```
40
+
41
+ From the consuming app:
42
+
43
+ ```sh
44
+ npm link @sulzanoks/vue-datatable
45
+ npm run dev
46
+ ```
47
+
48
+ The linked app imports the package's `dist` files. The watch build updates those files as you edit package source.
49
+
50
+ ## Theming
51
+
52
+ Import the package stylesheet for the default layout. The datatable inherits your application's color scheme. Set CSS custom properties on an ancestor to theme a group of tables, or on the component to theme one instance:
53
+
54
+ ```css
55
+ .admin-tables {
56
+ --vdt-surface: light-dark(#fff, #202124);
57
+ --vdt-text: light-dark(#222, #f1f3f4);
58
+ --vdt-accent: #7e22ce;
59
+ --vdt-accent-text: #fff;
60
+ }
61
+ ```
62
+
63
+ | Variables | Purpose |
64
+ | --- | --- |
65
+ | `--vdt-surface`, `--vdt-text`, `--vdt-muted-text`, `--vdt-border` | Default table and card palette |
66
+ | `--vdt-accent`, `--vdt-accent-text`, `--vdt-link`, `--vdt-focus`, `--vdt-hover-surface` | Interactive states |
67
+ | `--vdt-search-surface`, `--vdt-search-text` | Search toolbar palette |
68
+ | `--vdt-menu-surface`, `--vdt-menu-text` | Page-size menu palette |
69
+ | `--vdt-icon-surface`, `--vdt-error-text`, `--vdt-error-surface` | Header icon and error colors |
70
+ | `--vdt-radius`, `--vdt-shadow`, `--vdt-padding`, `--vdt-cell-padding`, `--vdt-margin-block`, `--vdt-font-size` | Card shape and spacing |
71
+
72
+ For a Bootstrap 6 app, map the package variables in the host stylesheet:
73
+
74
+ ```css
75
+ :root {
76
+ --vdt-surface: var(--bg-2);
77
+ --vdt-text: var(--fg-body);
78
+ --vdt-muted-text: var(--fg-2);
79
+ --vdt-border: var(--border-color-translucent);
80
+ --vdt-search-surface: var(--bg-1);
81
+ }
82
+ ```
83
+
84
+ In apps without a theme, set `color-scheme: light dark` on the page root to follow the operating system. CSS custom properties can also be set on a single datatable through its `style` attribute.
85
+
86
+ Use the existing `header` and `actions` slots when you need custom markup. Classes passed through props, such as an action's `class`, are applied as supplied.
87
+
22
88
  ## Basic usage
23
89
 
24
90
  ```vue
@@ -265,7 +331,7 @@ export default {
265
331
  | `search` | Search placeholder, search button, and tooltip |
266
332
  | `close` | Close-search tooltip |
267
333
  | `createNew` | Create-link tooltip |
268
- | `showEntries` | Page-length menu tooltip |
334
+ | `showEntries` | Page-size menu label and tooltip |
269
335
  | `actions` | Row actions column heading |
270
336
  | `showingRecords` | Record-range text; supports `{first}`, `{last}`, and `{filtered}` |
271
337
  | `totalRecords` | Unfiltered total; supports `{total}` |