@lilydesignsystem/angular-data-grid 0.0.0-stage → 0.9.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 +61 -2
- package/fesm2022/lilydesignsystem-angular-data-grid.mjs +3016 -0
- package/fesm2022/lilydesignsystem-angular-data-grid.mjs.map +1 -0
- package/package.json +47 -3
- package/types/lilydesignsystem-angular-data-grid.d.ts +811 -0
- package/types/lilydesignsystem-angular-data-grid.d.ts.map +1 -0
package/README.md
CHANGED
|
@@ -1,3 +1,62 @@
|
|
|
1
|
-
#
|
|
1
|
+
# DataGrid (Angular helper)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A reusable Angular (standalone, signals) headless **interactive data grid**. It composes
|
|
4
|
+
`@lilydesignsystem/angular-headless`'s `DataTable` family — the same `role="grid"` container the headless catalog
|
|
5
|
+
ships, with zero behaviour built in — and adds sort, client-side filter, row selection, column
|
|
6
|
+
resize / visibility / reorder / pinning, pagination, WAI-ARIA APG Grid keyboard navigation,
|
|
7
|
+
inline cell editing, row virtualization, export to CSV / TSV / Excel and twelve cell types
|
|
8
|
+
(text, number, link, date, time, time with time zone, select, radio, person, file, rollup,
|
|
9
|
+
formula). Ships no CSS: every visual detail is the consumer's, via kebab-case class hooks.
|
|
10
|
+
Ported from the canonical [`@lilydesignsystem/svelte-data-grid`](../lily-design-system-svelte-data-grid/),
|
|
11
|
+
whose [spec](../lily-design-system-svelte-data-grid/spec/index.md) is the contract.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { Component } from "@angular/core";
|
|
17
|
+
import { DataGrid, type DataGridColumn } from "@lilydesignsystem/angular-data-grid";
|
|
18
|
+
|
|
19
|
+
@Component({
|
|
20
|
+
selector: "app-users",
|
|
21
|
+
standalone: true,
|
|
22
|
+
imports: [DataGrid],
|
|
23
|
+
template: `<lily-data-grid label="Users" [columns]="columns" [rows]="rows" selectionMode="multiple" [(selected)]="selected" [labels]="labels" />`,
|
|
24
|
+
})
|
|
25
|
+
export class UsersComponent {
|
|
26
|
+
columns: DataGridColumn[] = [
|
|
27
|
+
{ id: "name", header: "Name", sortable: true, resizable: true },
|
|
28
|
+
{ id: "email", header: "Email", sortable: true },
|
|
29
|
+
{ id: "role", header: "Role", sortable: true, hidable: true },
|
|
30
|
+
];
|
|
31
|
+
rows = [
|
|
32
|
+
{ name: "Alice", email: "alice@example.com", role: "Admin" },
|
|
33
|
+
{ name: "Bob", email: "bob@example.com", role: "Editor" },
|
|
34
|
+
];
|
|
35
|
+
selected: string[] = [];
|
|
36
|
+
labels = { search: "Search users", selectAll: "Select all rows", selectRow: (name: string) => `Select ${name}` };
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## What is Angular-specific
|
|
41
|
+
|
|
42
|
+
| Svelte | Angular |
|
|
43
|
+
| --- | --- |
|
|
44
|
+
| `selected`, `filter`, `sort`, `columnOrder`, `page` (bindable) | `model()`s: `[(selected)]`, `[(filter)]`, `[(sort)]`, `[(columnOrder)]`, `[(page)]` |
|
|
45
|
+
| `onCellEdit`, `onFilesSelected`, `onFileRemove`, `onRowActivate`, `onExport` | the outputs `cellEdit`, `filesSelected`, `fileRemove`, `rowActivate`, `exportFile`, and the `exportHandler` input (return `false` to stop the save). An output cannot be tested for a listener, so Enter / a click activates a row only when `[activateRows]="true"` |
|
|
46
|
+
| `empty`, `footer`, column `cell`, `headerCell`, `avatar`, `personEditor` snippets | `TemplateRef`s: the `empty` and `footer` inputs, and the column's `cell`, `headerCell`, `avatar`, `personEditor` (the context is `$implicit`) |
|
|
47
|
+
| rest props on the root | the root `<div class="data-grid">` is inside the `<lily-data-grid>` host; put extra attributes on the host, and `className` on the root |
|
|
48
|
+
| `rowAttrs`, column `cellAttrs` | the same inputs, applied through the `lilyDataGridAttrs` directive |
|
|
49
|
+
| `class` | `className` |
|
|
50
|
+
|
|
51
|
+
Everything else — columns, labels, `rowId`, `selectionMode`, `pageSize`, `storageKey`, `mode`,
|
|
52
|
+
the keyboard model, the cell types, editing, export and virtualization — is as in the Svelte
|
|
53
|
+
reference. Every user-facing string is a `labels.*` prop (a label's presence gates the control it
|
|
54
|
+
names); nothing is hardcoded.
|
|
55
|
+
|
|
56
|
+
## Install
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
npm install @lilydesignsystem/angular-data-grid
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Requires `@lilydesignsystem/angular-headless`.
|