@su-labs/table 0.0.0-stage → 22.0.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/CHANGELOG.md +22 -0
- package/LICENSE +21 -0
- package/README.md +231 -2
- package/fesm2022/su-labs-table.mjs +621 -0
- package/fesm2022/su-labs-table.mjs.map +1 -0
- package/package.json +53 -3
- package/types/su-labs-table.d.ts +217 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [22.0.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `<su-lib-table>`: an accessible data table over typed columns (`SuTableColumns<TRow>`), with `caption`, `rowId`, `actions`, `selectable`, `reorderable` and `labels`
|
|
14
|
+
- Sorting from the column headings, with `aria-sort`
|
|
15
|
+
- Selection with checkboxes, and a toolbar to edit the selected rows together, run bulk actions or clear the selection
|
|
16
|
+
- Inline editing of one row (the `edit` action) and bulk editing of many, with validation messages; `edited` emits the saved rows in the API's shape
|
|
17
|
+
- Reordering by dragging the handle (mouse or touch; the row follows the pointer and the others slide aside to open its place) or with the keyboard; `reordered` emits the new order
|
|
18
|
+
- Row actions, hidden or disabled per row; `action` emits the clicked or selected rows
|
|
19
|
+
- `suTableCell` templates for custom cells
|
|
20
|
+
- Every change announced to screen readers, every text replaceable with `labels`
|
|
21
|
+
- Every part themeable with `--su-table-*` CSS variables
|
|
22
|
+
- Depends on exactly `@su-labs/core` 1.7.0 (version 22 follows Angular 22)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Yevheniy Alekseyev <yev.alekseyev@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,232 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Table
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@su-labs/table`
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
Accessible data tables for Angular, mapped from your API's JSON with typed columns: sort, select, edit one row or many
|
|
11
|
+
at once, reorder by dragging or with the keyboard, and act on rows with your own buttons. Edited rows come back in the
|
|
12
|
+
API's own shape, ready to send.
|
|
13
|
+
|
|
14
|
+
> **Not using Angular?** The same table logic is in [`@su-labs/core/table`](https://www.npmjs.com/package/@su-labs/core).
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- **Typed columns**: each column maps one field of your row type; its `format`, `sortable` and `edit` are typed by
|
|
19
|
+
that field, with no `any`
|
|
20
|
+
- **Sorting**: ascending, descending, then back to the rows' own order; numbers, dates and text compare naturally
|
|
21
|
+
- **Editing**: one row inline, or many selected rows at once (only the fields you change are applied to all of them),
|
|
22
|
+
with validation messages
|
|
23
|
+
- **Reordering**: drag the handle (mouse or touch), or with the keyboard: Space picks the row up, the arrows move it,
|
|
24
|
+
Space drops it, Escape puts it back
|
|
25
|
+
- **Row actions**: edit, delete, duplicate… any button, hidden or disabled per row, and bulk actions for the selection
|
|
26
|
+
- **Accessible**: a real `<table>` with a caption and row headers, sort buttons with `aria-sort`, labelled checkboxes
|
|
27
|
+
and handles, and every change announced to screen readers
|
|
28
|
+
- **Themeable**: every colour and spacing is a `--su-table-*` CSS variable
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install @su-labs/table
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Peer dependencies: `@angular/core` and `@angular/common` 22.
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
Describe your API's rows and map each field to a column:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { suCheckboxEditor, suNumberEditor, suSelectEditor, SuTableAction, SuTableActionEvent, SuTableColumns, SuTableComponent, SuTableReorderEvent, suTextEditor } from '@su-labs/table';
|
|
44
|
+
|
|
45
|
+
interface User {
|
|
46
|
+
readonly id: number;
|
|
47
|
+
readonly name: string;
|
|
48
|
+
readonly age: number;
|
|
49
|
+
readonly admin: boolean;
|
|
50
|
+
readonly status: 'active' | 'paused';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@Component({
|
|
54
|
+
selector: 'app-users',
|
|
55
|
+
imports: [SuTableComponent],
|
|
56
|
+
template: `
|
|
57
|
+
<su-lib-table
|
|
58
|
+
caption="Users"
|
|
59
|
+
selectable
|
|
60
|
+
reorderable
|
|
61
|
+
[columns]="columns"
|
|
62
|
+
[rows]="users()"
|
|
63
|
+
[rowId]="userId"
|
|
64
|
+
[actions]="actions"
|
|
65
|
+
(edited)="save($event)"
|
|
66
|
+
(reordered)="reorder($event)"
|
|
67
|
+
(action)="onAction($event)"
|
|
68
|
+
/>
|
|
69
|
+
`,
|
|
70
|
+
})
|
|
71
|
+
export class UsersPage {
|
|
72
|
+
protected readonly users = signal<readonly User[]>([]);
|
|
73
|
+
protected readonly userId = (user: User) => user.id;
|
|
74
|
+
|
|
75
|
+
protected readonly columns: SuTableColumns<User> = [
|
|
76
|
+
{ key: 'name', header: 'Name', sortable: true, edit: suTextEditor({ requiredMessage: 'Enter a name' }) },
|
|
77
|
+
{ key: 'age', header: 'Age', sortable: true, align: 'end', edit: suNumberEditor({ min: 0, max: 130 }) },
|
|
78
|
+
{ key: 'admin', header: 'Admin', edit: suCheckboxEditor() },
|
|
79
|
+
{
|
|
80
|
+
key: 'status',
|
|
81
|
+
header: 'Status',
|
|
82
|
+
sortable: true,
|
|
83
|
+
format: (status) => (status === 'active' ? 'Active' : 'Paused'),
|
|
84
|
+
edit: suSelectEditor([
|
|
85
|
+
{ value: 'active', label: 'Active' },
|
|
86
|
+
{ value: 'paused', label: 'Paused' },
|
|
87
|
+
]),
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
protected readonly actions: readonly SuTableAction<User>[] = [
|
|
92
|
+
{ id: 'edit', label: 'Edit' },
|
|
93
|
+
{ id: 'duplicate', label: 'Duplicate' },
|
|
94
|
+
{ id: 'delete', label: 'Delete', danger: true, bulk: true, disabled: (user) => user.admin },
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
protected save(rows: readonly User[]): void {
|
|
98
|
+
// PUT each row as it is; then update `users` with the API's answer
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
protected reorder({ rows }: SuTableReorderEvent<User>): void {
|
|
102
|
+
this.users.set(rows);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
protected onAction({ id, rows }: SuTableActionEvent<User>): void {
|
|
106
|
+
// 'duplicate' or 'delete' for these rows (confirm a delete with @su-labs/dialog)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The `edit` action is handled by the table: it edits that row inline (Enter saves, Escape cancels). Selecting rows
|
|
112
|
+
shows a toolbar to edit them together or run the bulk actions.
|
|
113
|
+
|
|
114
|
+
### Custom cells
|
|
115
|
+
|
|
116
|
+
Put anything in a column's cells with a template; `suTableCellOf` only types the row:
|
|
117
|
+
|
|
118
|
+
```html
|
|
119
|
+
<su-lib-table caption="Users" [columns]="columns" [rows]="users()">
|
|
120
|
+
<ng-template suTableCell="status" [suTableCellOf]="users()" let-user let-text="text">
|
|
121
|
+
<span class="badge" [class.is-active]="user.status === 'active'">{{ text }}</span>
|
|
122
|
+
</ng-template>
|
|
123
|
+
</su-lib-table>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## API
|
|
127
|
+
|
|
128
|
+
### Inputs
|
|
129
|
+
|
|
130
|
+
| Input | Default | Description |
|
|
131
|
+
|-------|---------|-------------|
|
|
132
|
+
| `columns` | — | `SuTableColumns<TRow>`, one per field (see below) |
|
|
133
|
+
| `rows` | — | The rows, as the API sends them |
|
|
134
|
+
| `caption` | — | The table's name for screen readers |
|
|
135
|
+
| `showCaption` | `false` | Shows the caption on screen too |
|
|
136
|
+
| `rowId` | each row object | The row's identity, e.g. `(user) => user.id`; keeps the selection when new rows arrive |
|
|
137
|
+
| `actions` | `[]` | `SuTableAction<TRow>[]`, buttons on each row |
|
|
138
|
+
| `selectable` | `false` | Checkboxes to select rows, with a toolbar for the selection |
|
|
139
|
+
| `reorderable` | `false` | A move handle on each row |
|
|
140
|
+
| `labels` | English | `Partial<SuTableLabels>`: any text, e.g. in the page's language |
|
|
141
|
+
|
|
142
|
+
### Outputs
|
|
143
|
+
|
|
144
|
+
| Output | Payload |
|
|
145
|
+
|--------|---------|
|
|
146
|
+
| `edited` | `readonly TRow[]`: the saved rows in the API's shape |
|
|
147
|
+
| `reordered` | `{ ids, rows }`: every row in its new order |
|
|
148
|
+
| `action` | `{ id, rows }`: the clicked row, or the selected rows for a bulk action |
|
|
149
|
+
| `sortChange` | `{ key, direction } \| null` |
|
|
150
|
+
| `selectionChange` | `readonly TRow[]` |
|
|
151
|
+
|
|
152
|
+
The table shows your changes right away; update `rows` with the API's answer to keep them, or to undo a failed save.
|
|
153
|
+
|
|
154
|
+
### Columns
|
|
155
|
+
|
|
156
|
+
| Field | Description |
|
|
157
|
+
|-------|-------------|
|
|
158
|
+
| `key` | The field in the row |
|
|
159
|
+
| `header` | The column's heading |
|
|
160
|
+
| `format(value, row)` | The cell's text; by default the value (booleans as Yes and No, nothing for null) |
|
|
161
|
+
| `sortable` | `true`, or how two values compare |
|
|
162
|
+
| `edit` | How the field is edited; without it the column is read-only |
|
|
163
|
+
| `validate(value, row)` | A message when an edited value isn't valid, or `null` |
|
|
164
|
+
| `align` | `'start'`, `'center'` or `'end'` |
|
|
165
|
+
|
|
166
|
+
### Editors
|
|
167
|
+
|
|
168
|
+
| Editor | API value | Control |
|
|
169
|
+
|--------|-----------|---------|
|
|
170
|
+
| `suTextEditor({ input, requiredMessage, maxLength, placeholder })` | `string` (trimmed) | `text`, `email` or `textarea` |
|
|
171
|
+
| `suNumberEditor({ min, max, step, invalidMessage })` | `number` | `number` |
|
|
172
|
+
| `suCheckboxEditor()` | `boolean` | checkbox |
|
|
173
|
+
| `suDateEditor({ min, max })` | `string`, `YYYY-MM-DD` | date |
|
|
174
|
+
| `suSelectEditor([{ value, label }, …])` | one of the values | select |
|
|
175
|
+
|
|
176
|
+
Any other field gets its own `SuTableEditor<TValue>`: an `input`, `toInput(value)` for the control, `parse(input)`
|
|
177
|
+
back to the API value, and an optional `validate(value)`.
|
|
178
|
+
|
|
179
|
+
### Actions
|
|
180
|
+
|
|
181
|
+
| Field | Description |
|
|
182
|
+
|-------|-------------|
|
|
183
|
+
| `id` / `label` | `'edit'` edits the row inline; any other id is sent to `action` |
|
|
184
|
+
| `danger` | Styled as something that can't be undone |
|
|
185
|
+
| `bulk` | Also offered for the selected rows |
|
|
186
|
+
| `hidden(row)` / `disabled(row)` | Leaves the button out, or disables it, for a row |
|
|
187
|
+
|
|
188
|
+
## Keyboard
|
|
189
|
+
|
|
190
|
+
| Where | Key | Does |
|
|
191
|
+
|-------|-----|------|
|
|
192
|
+
| Column heading | Enter or Space | Sorts by it: ascending, descending, then unsorted |
|
|
193
|
+
| Move handle | Space or Enter | Picks the row up, then drops it |
|
|
194
|
+
| Move handle, row picked up | ↑ / ↓, Home / End | Moves it one place, or to the top or bottom |
|
|
195
|
+
| Move handle, row picked up | Escape or Tab | Puts it back where it was |
|
|
196
|
+
| Row being edited | Enter / Escape | Saves / cancels |
|
|
197
|
+
|
|
198
|
+
## Styling
|
|
199
|
+
|
|
200
|
+
Set the variables on `:root` (your theme) or on `su-lib-table`:
|
|
201
|
+
|
|
202
|
+
```css
|
|
203
|
+
su-lib-table {
|
|
204
|
+
--su-table-border: 1px solid var(--border);
|
|
205
|
+
--su-table-header-background: var(--surface);
|
|
206
|
+
--su-table-accent: var(--accent);
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
| Variable | Default |
|
|
211
|
+
|----------|---------|
|
|
212
|
+
| `--su-table-font-family` / `--su-table-font-size` / `--su-table-text-color` | `inherit` / `0.95rem` / `inherit` |
|
|
213
|
+
| `--su-table-background` | `transparent` |
|
|
214
|
+
| `--su-table-border` / `--su-table-radius` | `1px solid rgb(0 0 0 / 0.12)` / `10px` |
|
|
215
|
+
| `--su-table-row-border` / `--su-table-cell-padding` | `1px solid rgb(0 0 0 / 0.08)` / `0.6rem 0.75rem` |
|
|
216
|
+
| `--su-table-header-background` / `--su-table-header-color` | a faint tint / `inherit` |
|
|
217
|
+
| `--su-table-row-header-weight` | `600` |
|
|
218
|
+
| `--su-table-hover-background` / `--su-table-selected-background` / `--su-table-editing-background` | faint tints |
|
|
219
|
+
| `--su-table-grabbed-background` / `--su-table-grabbed-outline` | blue tints |
|
|
220
|
+
| `--su-table-dragging-background` / `--su-table-dragging-shadow` | `Canvas` / `0 8px 24px rgb(0 0 0 / 0.18)` (the row being dragged) |
|
|
221
|
+
| `--su-table-accent` | `#2563eb` (checkboxes) |
|
|
222
|
+
| `--su-table-button-background` / `--su-table-button-border` / `--su-table-button-color` | `transparent` / `1px solid rgb(0 0 0 / 0.2)` / `inherit` |
|
|
223
|
+
| `--su-table-button-radius` / `--su-table-button-padding` | `6px` / `0.3rem 0.7rem` |
|
|
224
|
+
| `--su-table-primary-background` / `--su-table-primary-color` | `#111` / `#fff` (Save) |
|
|
225
|
+
| `--su-table-danger-color` / `--su-table-danger-border` | `#b42318` / a soft red line |
|
|
226
|
+
| `--su-table-input-background` / `--su-table-input-border` / `--su-table-input-radius` | `transparent` / `1px solid rgb(0 0 0 / 0.25)` / `6px` |
|
|
227
|
+
| `--su-table-panel-background` | a faint tint (selection toolbar and bulk edit) |
|
|
228
|
+
| `--su-table-focus-outline` | `2px solid currentColor` |
|
|
229
|
+
|
|
230
|
+
## Browser Compatibility
|
|
231
|
+
|
|
232
|
+
Uses pointer events and `color-mix()`: Chrome, Edge, Firefox and Safari from 2023 on.
|
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
import { SU_TABLE_LABELS, SU_TABLE_LABELS as SU_TABLE_LABELS$1, SuTableController, suCheckboxEditor, suDateEditor, suNumberEditor, suSelectEditor, suTableDropIndex, suTextEditor } from "@su-labs/core/table";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, Directive, ElementRef, TemplateRef, afterRenderEffect, booleanAttribute, computed, contentChildren, effect, inject, input, output, signal, untracked } from "@angular/core";
|
|
4
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
5
|
+
var SuTableCellDirective = class SuTableCellDirective {
|
|
6
|
+
key = input.required({
|
|
7
|
+
...ngDevMode ? { debugName: "key" } : /* istanbul ignore next */ {},
|
|
8
|
+
alias: "suTableCell"
|
|
9
|
+
});
|
|
10
|
+
rowsOf = input([], {
|
|
11
|
+
...ngDevMode ? { debugName: "rowsOf" } : /* istanbul ignore next */ {},
|
|
12
|
+
alias: "suTableCellOf"
|
|
13
|
+
});
|
|
14
|
+
template = inject(TemplateRef);
|
|
15
|
+
static ngTemplateContextGuard(_directive, context) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
19
|
+
minVersion: "12.0.0",
|
|
20
|
+
version: "22.2.4",
|
|
21
|
+
ngImport: i0,
|
|
22
|
+
type: SuTableCellDirective,
|
|
23
|
+
deps: [],
|
|
24
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
25
|
+
});
|
|
26
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
27
|
+
minVersion: "17.1.0",
|
|
28
|
+
version: "22.2.4",
|
|
29
|
+
type: SuTableCellDirective,
|
|
30
|
+
isStandalone: true,
|
|
31
|
+
selector: "ng-template[suTableCell]",
|
|
32
|
+
inputs: {
|
|
33
|
+
key: {
|
|
34
|
+
classPropertyName: "key",
|
|
35
|
+
publicName: "suTableCell",
|
|
36
|
+
isSignal: true,
|
|
37
|
+
isRequired: true,
|
|
38
|
+
transformFunction: null
|
|
39
|
+
},
|
|
40
|
+
rowsOf: {
|
|
41
|
+
classPropertyName: "rowsOf",
|
|
42
|
+
publicName: "suTableCellOf",
|
|
43
|
+
isSignal: true,
|
|
44
|
+
isRequired: false,
|
|
45
|
+
transformFunction: null
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
ngImport: i0
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
52
|
+
minVersion: "12.0.0",
|
|
53
|
+
version: "22.2.4",
|
|
54
|
+
ngImport: i0,
|
|
55
|
+
type: SuTableCellDirective,
|
|
56
|
+
decorators: [{
|
|
57
|
+
type: Directive,
|
|
58
|
+
args: [{ selector: "ng-template[suTableCell]" }]
|
|
59
|
+
}],
|
|
60
|
+
propDecorators: {
|
|
61
|
+
key: [{
|
|
62
|
+
type: i0.Input,
|
|
63
|
+
args: [{
|
|
64
|
+
isSignal: true,
|
|
65
|
+
alias: "suTableCell",
|
|
66
|
+
required: true
|
|
67
|
+
}]
|
|
68
|
+
}],
|
|
69
|
+
rowsOf: [{
|
|
70
|
+
type: i0.Input,
|
|
71
|
+
args: [{
|
|
72
|
+
isSignal: true,
|
|
73
|
+
alias: "suTableCellOf",
|
|
74
|
+
required: false
|
|
75
|
+
}]
|
|
76
|
+
}]
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
var SuTableFieldComponent = class SuTableFieldComponent {
|
|
80
|
+
field = input.required(...ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []);
|
|
81
|
+
controlId = input.required(...ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []);
|
|
82
|
+
ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
83
|
+
mixedLabel = input.required(...ngDevMode ? [{ debugName: "mixedLabel" }] : /* istanbul ignore next */ []);
|
|
84
|
+
valueChange = output();
|
|
85
|
+
errorId = computed(() => `${this.controlId()}-error`, ...ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []);
|
|
86
|
+
placeholder = computed(() => {
|
|
87
|
+
const field = this.field();
|
|
88
|
+
return field.mixed ? this.mixedLabel() : field.editor.attributes.placeholder ?? null;
|
|
89
|
+
}, ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
90
|
+
onChange(event) {
|
|
91
|
+
const target = event.target;
|
|
92
|
+
if (target instanceof HTMLInputElement && target.type === "checkbox") this.valueChange.emit(target.checked);
|
|
93
|
+
else if (target instanceof HTMLInputElement || target instanceof HTMLSelectElement || target instanceof HTMLTextAreaElement) this.valueChange.emit(target.value);
|
|
94
|
+
}
|
|
95
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
96
|
+
minVersion: "12.0.0",
|
|
97
|
+
version: "22.2.4",
|
|
98
|
+
ngImport: i0,
|
|
99
|
+
type: SuTableFieldComponent,
|
|
100
|
+
deps: [],
|
|
101
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
102
|
+
});
|
|
103
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
104
|
+
minVersion: "17.0.0",
|
|
105
|
+
version: "22.2.4",
|
|
106
|
+
type: SuTableFieldComponent,
|
|
107
|
+
isStandalone: true,
|
|
108
|
+
selector: "su-lib-table-field",
|
|
109
|
+
inputs: {
|
|
110
|
+
field: {
|
|
111
|
+
classPropertyName: "field",
|
|
112
|
+
publicName: "field",
|
|
113
|
+
isSignal: true,
|
|
114
|
+
isRequired: true,
|
|
115
|
+
transformFunction: null
|
|
116
|
+
},
|
|
117
|
+
controlId: {
|
|
118
|
+
classPropertyName: "controlId",
|
|
119
|
+
publicName: "controlId",
|
|
120
|
+
isSignal: true,
|
|
121
|
+
isRequired: true,
|
|
122
|
+
transformFunction: null
|
|
123
|
+
},
|
|
124
|
+
ariaLabel: {
|
|
125
|
+
classPropertyName: "ariaLabel",
|
|
126
|
+
publicName: "ariaLabel",
|
|
127
|
+
isSignal: true,
|
|
128
|
+
isRequired: false,
|
|
129
|
+
transformFunction: null
|
|
130
|
+
},
|
|
131
|
+
mixedLabel: {
|
|
132
|
+
classPropertyName: "mixedLabel",
|
|
133
|
+
publicName: "mixedLabel",
|
|
134
|
+
isSignal: true,
|
|
135
|
+
isRequired: true,
|
|
136
|
+
transformFunction: null
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
outputs: { valueChange: "valueChange" },
|
|
140
|
+
host: { classAttribute: "su-table-field" },
|
|
141
|
+
ngImport: i0,
|
|
142
|
+
template: "@let item = field();\n@let attributes = item.editor.attributes;\n@switch (item.editor.input) {\n @case ('checkbox') {\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [id]=\"controlId()\"\n [checked]=\"item.value === true\"\n [indeterminate]=\"item.mixed\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (change)=\"onChange($event)\"\n />\n }\n @case ('select') {\n <select\n class=\"su-table-control\"\n [id]=\"controlId()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (change)=\"onChange($event)\"\n >\n @if (item.mixed) {\n <option value=\"\" disabled selected>{{ mixedLabel() }}</option>\n }\n @for (option of item.editor.options; track option.value) {\n <option [value]=\"option.value\" [selected]=\"!item.mixed && option.value === item.value\">\n {{ option.label }}\n </option>\n }\n </select>\n }\n @case ('textarea') {\n <textarea\n class=\"su-table-control\"\n rows=\"2\"\n [id]=\"controlId()\"\n [value]=\"item.value\"\n [attr.placeholder]=\"placeholder()\"\n [attr.maxlength]=\"attributes.maxLength ?? null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (input)=\"onChange($event)\"\n ></textarea>\n }\n @default {\n <input\n class=\"su-table-control\"\n [type]=\"item.editor.input\"\n [id]=\"controlId()\"\n [value]=\"item.value\"\n [attr.placeholder]=\"placeholder()\"\n [attr.min]=\"attributes.min ?? null\"\n [attr.max]=\"attributes.max ?? null\"\n [attr.step]=\"attributes.step ?? null\"\n [attr.maxlength]=\"attributes.maxLength ?? null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (input)=\"onChange($event)\"\n />\n }\n}\n@if (item.error) {\n <span class=\"su-table-error\" [id]=\"errorId()\">{{ item.error }}</span>\n}\n",
|
|
143
|
+
styles: [":host{display:flex;flex-direction:column;gap:.2rem}.su-table-control{background:var(--su-table-input-background, transparent);border:var(--su-table-input-border, 1px solid rgba(0, 0, 0, .25));border-radius:var(--su-table-input-radius, 6px);box-sizing:border-box;color:inherit;font:inherit;min-height:2rem;min-width:6rem;padding:.3rem .45rem;width:100%}.su-table-control[aria-invalid=true]{border-color:var(--su-table-danger-color, #b42318)}.su-table-control:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-checkbox{accent-color:var(--su-table-accent, #2563eb);height:1rem;margin:0;width:1rem}.su-table-checkbox:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-error{color:var(--su-table-danger-color, #b42318);font-size:.8em;font-weight:400}\n"],
|
|
144
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
148
|
+
minVersion: "12.0.0",
|
|
149
|
+
version: "22.2.4",
|
|
150
|
+
ngImport: i0,
|
|
151
|
+
type: SuTableFieldComponent,
|
|
152
|
+
decorators: [{
|
|
153
|
+
type: Component,
|
|
154
|
+
args: [{
|
|
155
|
+
selector: "su-lib-table-field",
|
|
156
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
157
|
+
host: { class: "su-table-field" },
|
|
158
|
+
template: "@let item = field();\n@let attributes = item.editor.attributes;\n@switch (item.editor.input) {\n @case ('checkbox') {\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [id]=\"controlId()\"\n [checked]=\"item.value === true\"\n [indeterminate]=\"item.mixed\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (change)=\"onChange($event)\"\n />\n }\n @case ('select') {\n <select\n class=\"su-table-control\"\n [id]=\"controlId()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (change)=\"onChange($event)\"\n >\n @if (item.mixed) {\n <option value=\"\" disabled selected>{{ mixedLabel() }}</option>\n }\n @for (option of item.editor.options; track option.value) {\n <option [value]=\"option.value\" [selected]=\"!item.mixed && option.value === item.value\">\n {{ option.label }}\n </option>\n }\n </select>\n }\n @case ('textarea') {\n <textarea\n class=\"su-table-control\"\n rows=\"2\"\n [id]=\"controlId()\"\n [value]=\"item.value\"\n [attr.placeholder]=\"placeholder()\"\n [attr.maxlength]=\"attributes.maxLength ?? null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (input)=\"onChange($event)\"\n ></textarea>\n }\n @default {\n <input\n class=\"su-table-control\"\n [type]=\"item.editor.input\"\n [id]=\"controlId()\"\n [value]=\"item.value\"\n [attr.placeholder]=\"placeholder()\"\n [attr.min]=\"attributes.min ?? null\"\n [attr.max]=\"attributes.max ?? null\"\n [attr.step]=\"attributes.step ?? null\"\n [attr.maxlength]=\"attributes.maxLength ?? null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (input)=\"onChange($event)\"\n />\n }\n}\n@if (item.error) {\n <span class=\"su-table-error\" [id]=\"errorId()\">{{ item.error }}</span>\n}\n",
|
|
159
|
+
styles: [":host{display:flex;flex-direction:column;gap:.2rem}.su-table-control{background:var(--su-table-input-background, transparent);border:var(--su-table-input-border, 1px solid rgba(0, 0, 0, .25));border-radius:var(--su-table-input-radius, 6px);box-sizing:border-box;color:inherit;font:inherit;min-height:2rem;min-width:6rem;padding:.3rem .45rem;width:100%}.su-table-control[aria-invalid=true]{border-color:var(--su-table-danger-color, #b42318)}.su-table-control:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-checkbox{accent-color:var(--su-table-accent, #2563eb);height:1rem;margin:0;width:1rem}.su-table-checkbox:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-error{color:var(--su-table-danger-color, #b42318);font-size:.8em;font-weight:400}\n"]
|
|
160
|
+
}]
|
|
161
|
+
}],
|
|
162
|
+
propDecorators: {
|
|
163
|
+
field: [{
|
|
164
|
+
type: i0.Input,
|
|
165
|
+
args: [{
|
|
166
|
+
isSignal: true,
|
|
167
|
+
alias: "field",
|
|
168
|
+
required: true
|
|
169
|
+
}]
|
|
170
|
+
}],
|
|
171
|
+
controlId: [{
|
|
172
|
+
type: i0.Input,
|
|
173
|
+
args: [{
|
|
174
|
+
isSignal: true,
|
|
175
|
+
alias: "controlId",
|
|
176
|
+
required: true
|
|
177
|
+
}]
|
|
178
|
+
}],
|
|
179
|
+
ariaLabel: [{
|
|
180
|
+
type: i0.Input,
|
|
181
|
+
args: [{
|
|
182
|
+
isSignal: true,
|
|
183
|
+
alias: "ariaLabel",
|
|
184
|
+
required: false
|
|
185
|
+
}]
|
|
186
|
+
}],
|
|
187
|
+
mixedLabel: [{
|
|
188
|
+
type: i0.Input,
|
|
189
|
+
args: [{
|
|
190
|
+
isSignal: true,
|
|
191
|
+
alias: "mixedLabel",
|
|
192
|
+
required: true
|
|
193
|
+
}]
|
|
194
|
+
}],
|
|
195
|
+
valueChange: [{
|
|
196
|
+
type: i0.Output,
|
|
197
|
+
args: ["valueChange"]
|
|
198
|
+
}]
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
const SU_TABLE_EDIT_ACTION = "edit";
|
|
202
|
+
let nextTableId = 0;
|
|
203
|
+
var SuTableComponent = class SuTableComponent {
|
|
204
|
+
columns = input.required(...ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []);
|
|
205
|
+
rows = input.required(...ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []);
|
|
206
|
+
caption = input.required(...ngDevMode ? [{ debugName: "caption" }] : /* istanbul ignore next */ []);
|
|
207
|
+
showCaption = input(false, {
|
|
208
|
+
...ngDevMode ? { debugName: "showCaption" } : /* istanbul ignore next */ {},
|
|
209
|
+
transform: booleanAttribute
|
|
210
|
+
});
|
|
211
|
+
rowId = input(...ngDevMode ? [void 0, { debugName: "rowId" }] : /* istanbul ignore next */ []);
|
|
212
|
+
actions = input([], ...ngDevMode ? [{ debugName: "actions" }] : /* istanbul ignore next */ []);
|
|
213
|
+
selectable = input(false, {
|
|
214
|
+
...ngDevMode ? { debugName: "selectable" } : /* istanbul ignore next */ {},
|
|
215
|
+
transform: booleanAttribute
|
|
216
|
+
});
|
|
217
|
+
reorderable = input(false, {
|
|
218
|
+
...ngDevMode ? { debugName: "reorderable" } : /* istanbul ignore next */ {},
|
|
219
|
+
transform: booleanAttribute
|
|
220
|
+
});
|
|
221
|
+
labels = input({}, ...ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []);
|
|
222
|
+
edited = output();
|
|
223
|
+
reordered = output();
|
|
224
|
+
action = output();
|
|
225
|
+
sortChange = output();
|
|
226
|
+
selectionChange = output();
|
|
227
|
+
controller = new SuTableController();
|
|
228
|
+
host = inject(ElementRef);
|
|
229
|
+
cellTemplates = contentChildren(SuTableCellDirective, ...ngDevMode ? [{ debugName: "cellTemplates" }] : /* istanbul ignore next */ []);
|
|
230
|
+
focusHandleId = signal(null, ...ngDevMode ? [{ debugName: "focusHandleId" }] : /* istanbul ignore next */ []);
|
|
231
|
+
tableId = `su-table-${nextTableId++}`;
|
|
232
|
+
state = signal(this.controller.state.get(), ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
233
|
+
text = computed(() => ({
|
|
234
|
+
...SU_TABLE_LABELS$1,
|
|
235
|
+
...this.labels()
|
|
236
|
+
}), ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
|
|
237
|
+
drag = signal(null, ...ngDevMode ? [{ debugName: "drag" }] : /* istanbul ignore next */ []);
|
|
238
|
+
inlineDraft = computed(() => {
|
|
239
|
+
const draft = this.state().draft;
|
|
240
|
+
return draft && !draft.bulk ? draft : null;
|
|
241
|
+
}, ...ngDevMode ? [{ debugName: "inlineDraft" }] : /* istanbul ignore next */ []);
|
|
242
|
+
bulkDraft = computed(() => {
|
|
243
|
+
const draft = this.state().draft;
|
|
244
|
+
return draft?.bulk ? draft : null;
|
|
245
|
+
}, ...ngDevMode ? [{ debugName: "bulkDraft" }] : /* istanbul ignore next */ []);
|
|
246
|
+
hasActions = computed(() => this.actions().length > 0, ...ngDevMode ? [{ debugName: "hasActions" }] : /* istanbul ignore next */ []);
|
|
247
|
+
columnCount = computed(() => this.state().columns.length + Number(this.reorderable()) + Number(this.selectable()) + Number(this.hasActions()), ...ngDevMode ? [{ debugName: "columnCount" }] : /* istanbul ignore next */ []);
|
|
248
|
+
constructor() {
|
|
249
|
+
const unsubscribe = this.controller.state.subscribe((state) => this.state.set(state));
|
|
250
|
+
inject(DestroyRef).onDestroy(unsubscribe);
|
|
251
|
+
effect(() => {
|
|
252
|
+
const options = {
|
|
253
|
+
columns: this.columns(),
|
|
254
|
+
rowId: this.rowId(),
|
|
255
|
+
actions: this.actions(),
|
|
256
|
+
labels: this.labels()
|
|
257
|
+
};
|
|
258
|
+
untracked(() => this.controller.configure(options));
|
|
259
|
+
});
|
|
260
|
+
effect(() => {
|
|
261
|
+
const rows = this.rows();
|
|
262
|
+
untracked(() => this.controller.setRows(rows));
|
|
263
|
+
});
|
|
264
|
+
afterRenderEffect(() => {
|
|
265
|
+
const id = this.focusHandleId();
|
|
266
|
+
this.state();
|
|
267
|
+
const handle = this.host.nativeElement.querySelector(`[data-su-handle="${id}"]`);
|
|
268
|
+
if (id !== null && handle && document.activeElement !== handle) handle.focus();
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
cellTemplate(key) {
|
|
272
|
+
return this.cellTemplates().find((cell) => cell.key() === String(key))?.template ?? null;
|
|
273
|
+
}
|
|
274
|
+
inlineField(key) {
|
|
275
|
+
return this.inlineDraft()?.fields.find((field) => field.key === key) ?? null;
|
|
276
|
+
}
|
|
277
|
+
controlId(id, key) {
|
|
278
|
+
return `${this.tableId}-${id}-${String(key)}`;
|
|
279
|
+
}
|
|
280
|
+
sortBy(key) {
|
|
281
|
+
this.controller.sortBy(key);
|
|
282
|
+
this.sortChange.emit(this.state().sort);
|
|
283
|
+
}
|
|
284
|
+
select(id) {
|
|
285
|
+
this.controller.select(id);
|
|
286
|
+
this.selectionChange.emit(this.controller.selectedRows());
|
|
287
|
+
}
|
|
288
|
+
selectAll(selected) {
|
|
289
|
+
this.controller.selectAll(selected);
|
|
290
|
+
this.selectionChange.emit(this.controller.selectedRows());
|
|
291
|
+
}
|
|
292
|
+
runAction(action, row) {
|
|
293
|
+
if (action.id === "edit" && this.state().editable) {
|
|
294
|
+
this.controller.startEdit([row.id]);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
this.action.emit({
|
|
298
|
+
id: action.id,
|
|
299
|
+
rows: [row.data]
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
runBulkAction(action) {
|
|
303
|
+
this.action.emit({
|
|
304
|
+
id: action.id,
|
|
305
|
+
rows: this.controller.selectedRows()
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
editSelected() {
|
|
309
|
+
this.controller.startEdit();
|
|
310
|
+
}
|
|
311
|
+
setDraft(key, value) {
|
|
312
|
+
this.controller.setDraft(key, value);
|
|
313
|
+
}
|
|
314
|
+
save(event) {
|
|
315
|
+
event?.preventDefault();
|
|
316
|
+
const result = this.controller.save();
|
|
317
|
+
if (result.ok && result.rows.length > 0) this.edited.emit(result.rows);
|
|
318
|
+
}
|
|
319
|
+
cancelEdit() {
|
|
320
|
+
this.controller.cancelEdit();
|
|
321
|
+
}
|
|
322
|
+
onEditKey(event) {
|
|
323
|
+
if (event.key === "Escape") this.cancelEdit();
|
|
324
|
+
else if (event.key === "Enter" && !(event.target instanceof HTMLTextAreaElement)) this.save(event);
|
|
325
|
+
}
|
|
326
|
+
onHandleKey(event, id) {
|
|
327
|
+
const result = this.controller.moveKey(id, event.key);
|
|
328
|
+
if (!result.handled) {
|
|
329
|
+
this.focusHandleId.set(null);
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
event.preventDefault();
|
|
333
|
+
this.focusHandleId.set(id);
|
|
334
|
+
if (result.order) this.emitReorder(result.order);
|
|
335
|
+
}
|
|
336
|
+
onHandleDown(event, id, index) {
|
|
337
|
+
if (event.button !== 0) return;
|
|
338
|
+
event.preventDefault();
|
|
339
|
+
if (event.target instanceof Element) event.target.setPointerCapture(event.pointerId);
|
|
340
|
+
const rows = [...this.host.nativeElement.querySelectorAll("tbody > tr[data-su-row]")].map((row) => row.getBoundingClientRect());
|
|
341
|
+
this.drag.set({
|
|
342
|
+
id,
|
|
343
|
+
from: index,
|
|
344
|
+
to: index,
|
|
345
|
+
startY: event.clientY + window.scrollY,
|
|
346
|
+
offsetY: 0,
|
|
347
|
+
height: rows[index]?.height ?? 0,
|
|
348
|
+
middles: rows.map(({ top, height }) => top + window.scrollY + height / 2)
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
onHandleMove(event) {
|
|
352
|
+
const drag = this.drag();
|
|
353
|
+
if (!drag) return;
|
|
354
|
+
const pointerY = event.clientY + window.scrollY;
|
|
355
|
+
this.drag.set({
|
|
356
|
+
...drag,
|
|
357
|
+
to: suTableDropIndex(pointerY, drag.middles, drag.from),
|
|
358
|
+
offsetY: pointerY - drag.startY
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
onHandleUp() {
|
|
362
|
+
const drag = this.drag();
|
|
363
|
+
this.drag.set(null);
|
|
364
|
+
const order = drag ? this.controller.move(drag.id, drag.to) : null;
|
|
365
|
+
if (order) this.emitReorder(order);
|
|
366
|
+
}
|
|
367
|
+
onHandleCancel() {
|
|
368
|
+
this.drag.set(null);
|
|
369
|
+
}
|
|
370
|
+
dragTransform(index) {
|
|
371
|
+
const drag = this.drag();
|
|
372
|
+
if (!drag) return null;
|
|
373
|
+
if (index === drag.from) return `translateY(${drag.offsetY}px)`;
|
|
374
|
+
const slidesUp = index > drag.from && index <= drag.to;
|
|
375
|
+
const slidesDown = index < drag.from && index >= drag.to;
|
|
376
|
+
return slidesUp || slidesDown ? `translateY(${slidesUp ? -drag.height : drag.height}px)` : null;
|
|
377
|
+
}
|
|
378
|
+
emitReorder(ids) {
|
|
379
|
+
this.reordered.emit({
|
|
380
|
+
ids,
|
|
381
|
+
rows: this.controller.rowsOf(ids)
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
385
|
+
minVersion: "12.0.0",
|
|
386
|
+
version: "22.2.4",
|
|
387
|
+
ngImport: i0,
|
|
388
|
+
type: SuTableComponent,
|
|
389
|
+
deps: [],
|
|
390
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
391
|
+
});
|
|
392
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
393
|
+
minVersion: "17.0.0",
|
|
394
|
+
version: "22.2.4",
|
|
395
|
+
type: SuTableComponent,
|
|
396
|
+
isStandalone: true,
|
|
397
|
+
selector: "su-lib-table",
|
|
398
|
+
inputs: {
|
|
399
|
+
columns: {
|
|
400
|
+
classPropertyName: "columns",
|
|
401
|
+
publicName: "columns",
|
|
402
|
+
isSignal: true,
|
|
403
|
+
isRequired: true,
|
|
404
|
+
transformFunction: null
|
|
405
|
+
},
|
|
406
|
+
rows: {
|
|
407
|
+
classPropertyName: "rows",
|
|
408
|
+
publicName: "rows",
|
|
409
|
+
isSignal: true,
|
|
410
|
+
isRequired: true,
|
|
411
|
+
transformFunction: null
|
|
412
|
+
},
|
|
413
|
+
caption: {
|
|
414
|
+
classPropertyName: "caption",
|
|
415
|
+
publicName: "caption",
|
|
416
|
+
isSignal: true,
|
|
417
|
+
isRequired: true,
|
|
418
|
+
transformFunction: null
|
|
419
|
+
},
|
|
420
|
+
showCaption: {
|
|
421
|
+
classPropertyName: "showCaption",
|
|
422
|
+
publicName: "showCaption",
|
|
423
|
+
isSignal: true,
|
|
424
|
+
isRequired: false,
|
|
425
|
+
transformFunction: null
|
|
426
|
+
},
|
|
427
|
+
rowId: {
|
|
428
|
+
classPropertyName: "rowId",
|
|
429
|
+
publicName: "rowId",
|
|
430
|
+
isSignal: true,
|
|
431
|
+
isRequired: false,
|
|
432
|
+
transformFunction: null
|
|
433
|
+
},
|
|
434
|
+
actions: {
|
|
435
|
+
classPropertyName: "actions",
|
|
436
|
+
publicName: "actions",
|
|
437
|
+
isSignal: true,
|
|
438
|
+
isRequired: false,
|
|
439
|
+
transformFunction: null
|
|
440
|
+
},
|
|
441
|
+
selectable: {
|
|
442
|
+
classPropertyName: "selectable",
|
|
443
|
+
publicName: "selectable",
|
|
444
|
+
isSignal: true,
|
|
445
|
+
isRequired: false,
|
|
446
|
+
transformFunction: null
|
|
447
|
+
},
|
|
448
|
+
reorderable: {
|
|
449
|
+
classPropertyName: "reorderable",
|
|
450
|
+
publicName: "reorderable",
|
|
451
|
+
isSignal: true,
|
|
452
|
+
isRequired: false,
|
|
453
|
+
transformFunction: null
|
|
454
|
+
},
|
|
455
|
+
labels: {
|
|
456
|
+
classPropertyName: "labels",
|
|
457
|
+
publicName: "labels",
|
|
458
|
+
isSignal: true,
|
|
459
|
+
isRequired: false,
|
|
460
|
+
transformFunction: null
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
outputs: {
|
|
464
|
+
edited: "edited",
|
|
465
|
+
reordered: "reordered",
|
|
466
|
+
action: "action",
|
|
467
|
+
sortChange: "sortChange",
|
|
468
|
+
selectionChange: "selectionChange"
|
|
469
|
+
},
|
|
470
|
+
host: { classAttribute: "su-table" },
|
|
471
|
+
queries: [{
|
|
472
|
+
propertyName: "cellTemplates",
|
|
473
|
+
predicate: SuTableCellDirective,
|
|
474
|
+
isSignal: true
|
|
475
|
+
}],
|
|
476
|
+
ngImport: i0,
|
|
477
|
+
template: "@let current = state();\n@let t = text();\n@let selectedCount = current.selectedIds.length;\n@if (selectable() && selectedCount > 0) {\n <div class=\"su-table-toolbar\" role=\"toolbar\" [attr.aria-label]=\"t.selected(selectedCount)\">\n <span class=\"su-table-toolbar-count\">{{ t.selected(selectedCount) }}</span>\n @if (current.editable && !current.draft) {\n <button type=\"button\" class=\"su-table-button\" (click)=\"editSelected()\">\n {{ t.editSelected(selectedCount) }}\n </button>\n }\n @for (action of current.bulkActions; track action.id) {\n <button type=\"button\" class=\"su-table-button\" [class.is-danger]=\"action.danger\" (click)=\"runBulkAction(action)\">\n {{ action.label }}\n </button>\n }\n <button type=\"button\" class=\"su-table-button is-quiet\" (click)=\"selectAll(false)\">{{ t.clearSelection }}</button>\n </div>\n}\n\n@if (bulkDraft(); as draft) {\n <form\n class=\"su-table-bulk\"\n [attr.aria-labelledby]=\"tableId + '-bulk-title'\"\n (submit)=\"save($event)\"\n (keydown.escape)=\"cancelEdit()\"\n >\n <h3 class=\"su-table-bulk-title\" [id]=\"tableId + '-bulk-title'\">{{ t.editing(draft.ids.length) }}</h3>\n <div class=\"su-table-bulk-fields\">\n @for (field of draft.fields; track field.key) {\n <div class=\"su-table-bulk-field\">\n <label class=\"su-table-label\" [for]=\"controlId('bulk', field.key)\">{{ field.header }}</label>\n <su-lib-table-field\n [field]=\"field\"\n [controlId]=\"controlId('bulk', field.key)\"\n [mixedLabel]=\"t.mixed\"\n (valueChange)=\"setDraft(field.key, $event)\"\n />\n </div>\n }\n </div>\n <div class=\"su-table-bulk-actions\">\n <button type=\"submit\" class=\"su-table-button is-primary\">{{ t.save }}</button>\n <button type=\"button\" class=\"su-table-button\" (click)=\"cancelEdit()\">{{ t.cancel }}</button>\n </div>\n </form>\n}\n\n<div class=\"su-table-scroll\">\n <table class=\"su-table-grid\" [class.is-dragging-rows]=\"drag() !== null\">\n <caption [class.su-table-visually-hidden]=\"!showCaption()\">{{ caption() }}</caption>\n <thead>\n <tr>\n @if (reorderable()) {\n <th scope=\"col\" class=\"su-table-handle-cell\">\n <span class=\"su-table-visually-hidden\">{{ t.order }}</span>\n </th>\n }\n @if (selectable()) {\n <th scope=\"col\" class=\"su-table-select-cell\">\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [checked]=\"current.selection === 'all'\"\n [indeterminate]=\"current.selection === 'some'\"\n [disabled]=\"current.rows.length === 0\"\n [attr.aria-label]=\"t.selectAll\"\n (change)=\"selectAll()\"\n />\n </th>\n }\n @for (column of current.columns; track column.key) {\n <th\n scope=\"col\"\n class=\"su-table-align-{{ column.align }}\"\n [attr.aria-sort]=\"column.sort === 'none' ? null : column.sort\"\n >\n @if (column.sortable) {\n <button type=\"button\" class=\"su-table-sort\" (click)=\"sortBy(column.key)\">\n {{ column.header }}\n <span class=\"su-table-sort-icon is-{{ column.sort }}\" aria-hidden=\"true\"></span>\n </button>\n } @else {\n {{ column.header }}\n }\n </th>\n }\n @if (hasActions()) {\n <th scope=\"col\" class=\"su-table-actions-cell\">{{ t.actions }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of current.rows; track row.id; let index = $index) {\n @let editing = inlineDraft()?.ids?.[0] === row.id;\n <tr\n data-su-row\n [class.is-selected]=\"row.selected\"\n [class.is-editing]=\"editing\"\n [class.is-grabbed]=\"current.grabbedId === row.id\"\n [class.is-dragging]=\"drag()?.id === row.id\"\n [style.transform]=\"dragTransform(index)\"\n (keydown)=\"editing && onEditKey($event)\"\n >\n @if (reorderable()) {\n <td class=\"su-table-handle-cell\">\n <button\n type=\"button\"\n class=\"su-table-handle\"\n [attr.data-su-handle]=\"row.id\"\n [attr.aria-label]=\"t.moveRow(row.label)\"\n [attr.aria-pressed]=\"current.grabbedId === row.id\"\n (keydown)=\"onHandleKey($event, row.id)\"\n (pointerdown)=\"onHandleDown($event, row.id, index)\"\n (pointermove)=\"onHandleMove($event)\"\n (pointerup)=\"onHandleUp()\"\n (pointercancel)=\"onHandleCancel()\"\n >\n <span class=\"su-table-grip\" aria-hidden=\"true\"></span>\n </button>\n </td>\n }\n @if (selectable()) {\n <td class=\"su-table-select-cell\">\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [checked]=\"row.selected\"\n [attr.aria-label]=\"t.selectRow(row.label)\"\n (change)=\"select(row.id)\"\n />\n </td>\n }\n @for (cell of row.cells; track cell.key; let first = $first, cellIndex = $index) {\n @let column = current.columns[cellIndex];\n <ng-template #content>\n @if (editing && inlineField(cell.key); as field) {\n <su-lib-table-field\n [field]=\"field\"\n [controlId]=\"controlId(row.id, cell.key)\"\n [ariaLabel]=\"column.header\"\n [mixedLabel]=\"t.mixed\"\n (valueChange)=\"setDraft(cell.key, $event)\"\n />\n } @else if (cellTemplate(cell.key); as template) {\n <ng-container *ngTemplateOutlet=\"template; context: { $implicit: row.data, text: cell.text }\" />\n } @else {\n {{ cell.text }}\n }\n </ng-template>\n @if (first) {\n <th scope=\"row\" class=\"su-table-align-{{ column.align }}\">\n <ng-container *ngTemplateOutlet=\"content\" />\n </th>\n } @else {\n <td class=\"su-table-align-{{ column.align }}\"><ng-container *ngTemplateOutlet=\"content\" /></td>\n }\n }\n @if (hasActions()) {\n <td class=\"su-table-actions-cell\">\n <div class=\"su-table-actions\">\n @if (editing) {\n <button type=\"button\" class=\"su-table-button is-primary\" (click)=\"save()\">{{ t.save }}</button>\n <button type=\"button\" class=\"su-table-button\" (click)=\"cancelEdit()\">{{ t.cancel }}</button>\n } @else {\n @for (action of row.actions; track action.id) {\n <button\n type=\"button\"\n class=\"su-table-button\"\n [class.is-danger]=\"action.danger\"\n [disabled]=\"action.disabled\"\n [attr.aria-label]=\"action.label + ', ' + row.label\"\n (click)=\"runAction(action, row)\"\n >\n {{ action.label }}\n </button>\n }\n }\n </div>\n </td>\n }\n </tr>\n } @empty {\n <tr>\n <td class=\"su-table-empty\" [attr.colspan]=\"columnCount()\">{{ t.empty }}</td>\n </tr>\n }\n </tbody>\n </table>\n</div>\n\n<div class=\"su-table-visually-hidden\" role=\"status\">{{ current.announcement }}</div>\n",
|
|
478
|
+
styles: [":host{color:var(--su-table-text-color, inherit);display:block;font-family:var(--su-table-font-family, inherit);font-size:var(--su-table-font-size, .95rem)}.su-table-scroll{border:var(--su-table-border, 1px solid rgba(0, 0, 0, .12));border-radius:var(--su-table-radius, 10px);overflow-x:auto}.su-table-grid{background:var(--su-table-background, transparent);border-collapse:collapse;min-width:100%}caption{caption-side:top;font-weight:600;padding:var(--su-table-cell-padding, .6rem .75rem);text-align:start}th,td{border-bottom:var(--su-table-row-border, 1px solid rgba(0, 0, 0, .08));padding:var(--su-table-cell-padding, .6rem .75rem);text-align:start;vertical-align:middle}thead th{background:var(--su-table-header-background, rgba(0, 0, 0, .03));color:var(--su-table-header-color, inherit);font-weight:600;white-space:nowrap}tbody th{font-weight:var(--su-table-row-header-weight, 600)}tbody tr:last-child>*{border-bottom:none}tbody tr:hover{background:var(--su-table-hover-background, rgba(0, 0, 0, .025))}tr.is-selected{background:var(--su-table-selected-background, color-mix(in srgb, #2563eb 8%, transparent))}tr.is-editing{background:var(--su-table-editing-background, color-mix(in srgb, #2563eb 5%, transparent))}tr.is-grabbed,tr.is-dragging{background:var(--su-table-grabbed-background, color-mix(in srgb, #2563eb 14%, transparent));outline:var(--su-table-grabbed-outline, 2px solid color-mix(in srgb, #2563eb 60%, transparent));outline-offset:-2px}tr.is-dragging{--su-table-row-tint: var(--su-table-grabbed-background, color-mix(in srgb, #2563eb 14%, transparent));background:linear-gradient(var(--su-table-row-tint),var(--su-table-row-tint)),var(--su-table-dragging-background, Canvas);box-shadow:var(--su-table-dragging-shadow, 0 8px 24px rgba(0, 0, 0, .18));cursor:grabbing;position:relative;z-index:1}@media(prefers-reduced-motion:no-preference){.is-dragging-rows tbody tr:not(.is-dragging){transition:transform .15s ease-out}}.su-table-align-start{text-align:start}.su-table-align-center{text-align:center}.su-table-align-end{text-align:end}.su-table-handle-cell,.su-table-select-cell{text-align:center;width:1%}.su-table-actions-cell{text-align:end;width:1%}.su-table-actions{display:flex;gap:.35rem;justify-content:flex-end}.su-table-sort{align-items:center;background:none;border:none;border-radius:4px;color:inherit;cursor:pointer;display:inline-flex;font:inherit;gap:.35rem;margin:-.2rem -.35rem;padding:.2rem .35rem}.su-table-sort-icon{border-left:.3rem solid transparent;border-right:.3rem solid transparent;height:0;opacity:.35;width:0}.su-table-sort-icon.is-none,.su-table-sort-icon.is-ascending{border-bottom:.4rem solid currentColor}.su-table-sort-icon.is-descending{border-top:.4rem solid currentColor}.su-table-sort-icon.is-ascending,.su-table-sort-icon.is-descending{opacity:1}.su-table-handle{background:none;border:none;border-radius:4px;color:inherit;cursor:grab;display:inline-flex;padding:.35rem .3rem;touch-action:none}.su-table-handle:active{cursor:grabbing}.su-table-grip{background-image:radial-gradient(currentColor 1.2px,transparent 1.4px);background-size:6px 6px;display:block;height:18px;opacity:.6;width:12px}.su-table-button{background:var(--su-table-button-background, transparent);border:var(--su-table-button-border, 1px solid rgba(0, 0, 0, .2));border-radius:var(--su-table-button-radius, 6px);color:var(--su-table-button-color, inherit);cursor:pointer;font:inherit;font-size:.875em;padding:var(--su-table-button-padding, .3rem .7rem);white-space:nowrap}.su-table-button:disabled{cursor:not-allowed;opacity:.45}.su-table-button.is-primary{background:var(--su-table-primary-background, #111);border-color:transparent;color:var(--su-table-primary-color, #fff)}.su-table-button.is-danger{border-color:var(--su-table-danger-border, color-mix(in srgb, #b42318 35%, transparent));color:var(--su-table-danger-color, #b42318)}.su-table-button.is-quiet{border-color:transparent}.su-table-sort:focus-visible,.su-table-handle:focus-visible,.su-table-button:focus-visible,.su-table-checkbox:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-checkbox{accent-color:var(--su-table-accent, #2563eb);height:1rem;margin:0;width:1rem}.su-table-toolbar,.su-table-bulk{background:var(--su-table-panel-background, rgba(0, 0, 0, .03));border-radius:var(--su-table-radius, 10px);margin-bottom:.75rem;padding:.6rem .75rem}.su-table-toolbar{align-items:center;display:flex;flex-wrap:wrap;gap:.5rem}.su-table-toolbar-count{font-weight:600;margin-right:auto}.su-table-bulk-title{font-size:1rem;margin:0 0 .75rem}.su-table-bulk-fields{display:grid;gap:.75rem;grid-template-columns:repeat(auto-fill,minmax(12rem,1fr))}.su-table-bulk-field{display:flex;flex-direction:column;gap:.3rem}.su-table-label{font-size:.85em;font-weight:600}.su-table-bulk-actions{display:flex;gap:.5rem;margin-top:.75rem}.su-table-empty{opacity:.7;padding:1.5rem;text-align:center}.su-table-visually-hidden{clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}@media(prefers-reduced-motion:no-preference){tbody tr{transition:background-color .12s ease-out}}\n"],
|
|
479
|
+
dependencies: [{
|
|
480
|
+
kind: "directive",
|
|
481
|
+
type: NgTemplateOutlet,
|
|
482
|
+
selector: "[ngTemplateOutlet]",
|
|
483
|
+
inputs: [
|
|
484
|
+
"ngTemplateOutletContext",
|
|
485
|
+
"ngTemplateOutlet",
|
|
486
|
+
"ngTemplateOutletInjector"
|
|
487
|
+
]
|
|
488
|
+
}, {
|
|
489
|
+
kind: "component",
|
|
490
|
+
type: SuTableFieldComponent,
|
|
491
|
+
selector: "su-lib-table-field",
|
|
492
|
+
inputs: [
|
|
493
|
+
"field",
|
|
494
|
+
"controlId",
|
|
495
|
+
"ariaLabel",
|
|
496
|
+
"mixedLabel"
|
|
497
|
+
],
|
|
498
|
+
outputs: ["valueChange"]
|
|
499
|
+
}],
|
|
500
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
501
|
+
});
|
|
502
|
+
};
|
|
503
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
504
|
+
minVersion: "12.0.0",
|
|
505
|
+
version: "22.2.4",
|
|
506
|
+
ngImport: i0,
|
|
507
|
+
type: SuTableComponent,
|
|
508
|
+
decorators: [{
|
|
509
|
+
type: Component,
|
|
510
|
+
args: [{
|
|
511
|
+
selector: "su-lib-table",
|
|
512
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
513
|
+
imports: [NgTemplateOutlet, SuTableFieldComponent],
|
|
514
|
+
host: { class: "su-table" },
|
|
515
|
+
template: "@let current = state();\n@let t = text();\n@let selectedCount = current.selectedIds.length;\n@if (selectable() && selectedCount > 0) {\n <div class=\"su-table-toolbar\" role=\"toolbar\" [attr.aria-label]=\"t.selected(selectedCount)\">\n <span class=\"su-table-toolbar-count\">{{ t.selected(selectedCount) }}</span>\n @if (current.editable && !current.draft) {\n <button type=\"button\" class=\"su-table-button\" (click)=\"editSelected()\">\n {{ t.editSelected(selectedCount) }}\n </button>\n }\n @for (action of current.bulkActions; track action.id) {\n <button type=\"button\" class=\"su-table-button\" [class.is-danger]=\"action.danger\" (click)=\"runBulkAction(action)\">\n {{ action.label }}\n </button>\n }\n <button type=\"button\" class=\"su-table-button is-quiet\" (click)=\"selectAll(false)\">{{ t.clearSelection }}</button>\n </div>\n}\n\n@if (bulkDraft(); as draft) {\n <form\n class=\"su-table-bulk\"\n [attr.aria-labelledby]=\"tableId + '-bulk-title'\"\n (submit)=\"save($event)\"\n (keydown.escape)=\"cancelEdit()\"\n >\n <h3 class=\"su-table-bulk-title\" [id]=\"tableId + '-bulk-title'\">{{ t.editing(draft.ids.length) }}</h3>\n <div class=\"su-table-bulk-fields\">\n @for (field of draft.fields; track field.key) {\n <div class=\"su-table-bulk-field\">\n <label class=\"su-table-label\" [for]=\"controlId('bulk', field.key)\">{{ field.header }}</label>\n <su-lib-table-field\n [field]=\"field\"\n [controlId]=\"controlId('bulk', field.key)\"\n [mixedLabel]=\"t.mixed\"\n (valueChange)=\"setDraft(field.key, $event)\"\n />\n </div>\n }\n </div>\n <div class=\"su-table-bulk-actions\">\n <button type=\"submit\" class=\"su-table-button is-primary\">{{ t.save }}</button>\n <button type=\"button\" class=\"su-table-button\" (click)=\"cancelEdit()\">{{ t.cancel }}</button>\n </div>\n </form>\n}\n\n<div class=\"su-table-scroll\">\n <table class=\"su-table-grid\" [class.is-dragging-rows]=\"drag() !== null\">\n <caption [class.su-table-visually-hidden]=\"!showCaption()\">{{ caption() }}</caption>\n <thead>\n <tr>\n @if (reorderable()) {\n <th scope=\"col\" class=\"su-table-handle-cell\">\n <span class=\"su-table-visually-hidden\">{{ t.order }}</span>\n </th>\n }\n @if (selectable()) {\n <th scope=\"col\" class=\"su-table-select-cell\">\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [checked]=\"current.selection === 'all'\"\n [indeterminate]=\"current.selection === 'some'\"\n [disabled]=\"current.rows.length === 0\"\n [attr.aria-label]=\"t.selectAll\"\n (change)=\"selectAll()\"\n />\n </th>\n }\n @for (column of current.columns; track column.key) {\n <th\n scope=\"col\"\n class=\"su-table-align-{{ column.align }}\"\n [attr.aria-sort]=\"column.sort === 'none' ? null : column.sort\"\n >\n @if (column.sortable) {\n <button type=\"button\" class=\"su-table-sort\" (click)=\"sortBy(column.key)\">\n {{ column.header }}\n <span class=\"su-table-sort-icon is-{{ column.sort }}\" aria-hidden=\"true\"></span>\n </button>\n } @else {\n {{ column.header }}\n }\n </th>\n }\n @if (hasActions()) {\n <th scope=\"col\" class=\"su-table-actions-cell\">{{ t.actions }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of current.rows; track row.id; let index = $index) {\n @let editing = inlineDraft()?.ids?.[0] === row.id;\n <tr\n data-su-row\n [class.is-selected]=\"row.selected\"\n [class.is-editing]=\"editing\"\n [class.is-grabbed]=\"current.grabbedId === row.id\"\n [class.is-dragging]=\"drag()?.id === row.id\"\n [style.transform]=\"dragTransform(index)\"\n (keydown)=\"editing && onEditKey($event)\"\n >\n @if (reorderable()) {\n <td class=\"su-table-handle-cell\">\n <button\n type=\"button\"\n class=\"su-table-handle\"\n [attr.data-su-handle]=\"row.id\"\n [attr.aria-label]=\"t.moveRow(row.label)\"\n [attr.aria-pressed]=\"current.grabbedId === row.id\"\n (keydown)=\"onHandleKey($event, row.id)\"\n (pointerdown)=\"onHandleDown($event, row.id, index)\"\n (pointermove)=\"onHandleMove($event)\"\n (pointerup)=\"onHandleUp()\"\n (pointercancel)=\"onHandleCancel()\"\n >\n <span class=\"su-table-grip\" aria-hidden=\"true\"></span>\n </button>\n </td>\n }\n @if (selectable()) {\n <td class=\"su-table-select-cell\">\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [checked]=\"row.selected\"\n [attr.aria-label]=\"t.selectRow(row.label)\"\n (change)=\"select(row.id)\"\n />\n </td>\n }\n @for (cell of row.cells; track cell.key; let first = $first, cellIndex = $index) {\n @let column = current.columns[cellIndex];\n <ng-template #content>\n @if (editing && inlineField(cell.key); as field) {\n <su-lib-table-field\n [field]=\"field\"\n [controlId]=\"controlId(row.id, cell.key)\"\n [ariaLabel]=\"column.header\"\n [mixedLabel]=\"t.mixed\"\n (valueChange)=\"setDraft(cell.key, $event)\"\n />\n } @else if (cellTemplate(cell.key); as template) {\n <ng-container *ngTemplateOutlet=\"template; context: { $implicit: row.data, text: cell.text }\" />\n } @else {\n {{ cell.text }}\n }\n </ng-template>\n @if (first) {\n <th scope=\"row\" class=\"su-table-align-{{ column.align }}\">\n <ng-container *ngTemplateOutlet=\"content\" />\n </th>\n } @else {\n <td class=\"su-table-align-{{ column.align }}\"><ng-container *ngTemplateOutlet=\"content\" /></td>\n }\n }\n @if (hasActions()) {\n <td class=\"su-table-actions-cell\">\n <div class=\"su-table-actions\">\n @if (editing) {\n <button type=\"button\" class=\"su-table-button is-primary\" (click)=\"save()\">{{ t.save }}</button>\n <button type=\"button\" class=\"su-table-button\" (click)=\"cancelEdit()\">{{ t.cancel }}</button>\n } @else {\n @for (action of row.actions; track action.id) {\n <button\n type=\"button\"\n class=\"su-table-button\"\n [class.is-danger]=\"action.danger\"\n [disabled]=\"action.disabled\"\n [attr.aria-label]=\"action.label + ', ' + row.label\"\n (click)=\"runAction(action, row)\"\n >\n {{ action.label }}\n </button>\n }\n }\n </div>\n </td>\n }\n </tr>\n } @empty {\n <tr>\n <td class=\"su-table-empty\" [attr.colspan]=\"columnCount()\">{{ t.empty }}</td>\n </tr>\n }\n </tbody>\n </table>\n</div>\n\n<div class=\"su-table-visually-hidden\" role=\"status\">{{ current.announcement }}</div>\n",
|
|
516
|
+
styles: [":host{color:var(--su-table-text-color, inherit);display:block;font-family:var(--su-table-font-family, inherit);font-size:var(--su-table-font-size, .95rem)}.su-table-scroll{border:var(--su-table-border, 1px solid rgba(0, 0, 0, .12));border-radius:var(--su-table-radius, 10px);overflow-x:auto}.su-table-grid{background:var(--su-table-background, transparent);border-collapse:collapse;min-width:100%}caption{caption-side:top;font-weight:600;padding:var(--su-table-cell-padding, .6rem .75rem);text-align:start}th,td{border-bottom:var(--su-table-row-border, 1px solid rgba(0, 0, 0, .08));padding:var(--su-table-cell-padding, .6rem .75rem);text-align:start;vertical-align:middle}thead th{background:var(--su-table-header-background, rgba(0, 0, 0, .03));color:var(--su-table-header-color, inherit);font-weight:600;white-space:nowrap}tbody th{font-weight:var(--su-table-row-header-weight, 600)}tbody tr:last-child>*{border-bottom:none}tbody tr:hover{background:var(--su-table-hover-background, rgba(0, 0, 0, .025))}tr.is-selected{background:var(--su-table-selected-background, color-mix(in srgb, #2563eb 8%, transparent))}tr.is-editing{background:var(--su-table-editing-background, color-mix(in srgb, #2563eb 5%, transparent))}tr.is-grabbed,tr.is-dragging{background:var(--su-table-grabbed-background, color-mix(in srgb, #2563eb 14%, transparent));outline:var(--su-table-grabbed-outline, 2px solid color-mix(in srgb, #2563eb 60%, transparent));outline-offset:-2px}tr.is-dragging{--su-table-row-tint: var(--su-table-grabbed-background, color-mix(in srgb, #2563eb 14%, transparent));background:linear-gradient(var(--su-table-row-tint),var(--su-table-row-tint)),var(--su-table-dragging-background, Canvas);box-shadow:var(--su-table-dragging-shadow, 0 8px 24px rgba(0, 0, 0, .18));cursor:grabbing;position:relative;z-index:1}@media(prefers-reduced-motion:no-preference){.is-dragging-rows tbody tr:not(.is-dragging){transition:transform .15s ease-out}}.su-table-align-start{text-align:start}.su-table-align-center{text-align:center}.su-table-align-end{text-align:end}.su-table-handle-cell,.su-table-select-cell{text-align:center;width:1%}.su-table-actions-cell{text-align:end;width:1%}.su-table-actions{display:flex;gap:.35rem;justify-content:flex-end}.su-table-sort{align-items:center;background:none;border:none;border-radius:4px;color:inherit;cursor:pointer;display:inline-flex;font:inherit;gap:.35rem;margin:-.2rem -.35rem;padding:.2rem .35rem}.su-table-sort-icon{border-left:.3rem solid transparent;border-right:.3rem solid transparent;height:0;opacity:.35;width:0}.su-table-sort-icon.is-none,.su-table-sort-icon.is-ascending{border-bottom:.4rem solid currentColor}.su-table-sort-icon.is-descending{border-top:.4rem solid currentColor}.su-table-sort-icon.is-ascending,.su-table-sort-icon.is-descending{opacity:1}.su-table-handle{background:none;border:none;border-radius:4px;color:inherit;cursor:grab;display:inline-flex;padding:.35rem .3rem;touch-action:none}.su-table-handle:active{cursor:grabbing}.su-table-grip{background-image:radial-gradient(currentColor 1.2px,transparent 1.4px);background-size:6px 6px;display:block;height:18px;opacity:.6;width:12px}.su-table-button{background:var(--su-table-button-background, transparent);border:var(--su-table-button-border, 1px solid rgba(0, 0, 0, .2));border-radius:var(--su-table-button-radius, 6px);color:var(--su-table-button-color, inherit);cursor:pointer;font:inherit;font-size:.875em;padding:var(--su-table-button-padding, .3rem .7rem);white-space:nowrap}.su-table-button:disabled{cursor:not-allowed;opacity:.45}.su-table-button.is-primary{background:var(--su-table-primary-background, #111);border-color:transparent;color:var(--su-table-primary-color, #fff)}.su-table-button.is-danger{border-color:var(--su-table-danger-border, color-mix(in srgb, #b42318 35%, transparent));color:var(--su-table-danger-color, #b42318)}.su-table-button.is-quiet{border-color:transparent}.su-table-sort:focus-visible,.su-table-handle:focus-visible,.su-table-button:focus-visible,.su-table-checkbox:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-checkbox{accent-color:var(--su-table-accent, #2563eb);height:1rem;margin:0;width:1rem}.su-table-toolbar,.su-table-bulk{background:var(--su-table-panel-background, rgba(0, 0, 0, .03));border-radius:var(--su-table-radius, 10px);margin-bottom:.75rem;padding:.6rem .75rem}.su-table-toolbar{align-items:center;display:flex;flex-wrap:wrap;gap:.5rem}.su-table-toolbar-count{font-weight:600;margin-right:auto}.su-table-bulk-title{font-size:1rem;margin:0 0 .75rem}.su-table-bulk-fields{display:grid;gap:.75rem;grid-template-columns:repeat(auto-fill,minmax(12rem,1fr))}.su-table-bulk-field{display:flex;flex-direction:column;gap:.3rem}.su-table-label{font-size:.85em;font-weight:600}.su-table-bulk-actions{display:flex;gap:.5rem;margin-top:.75rem}.su-table-empty{opacity:.7;padding:1.5rem;text-align:center}.su-table-visually-hidden{clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}@media(prefers-reduced-motion:no-preference){tbody tr{transition:background-color .12s ease-out}}\n"]
|
|
517
|
+
}]
|
|
518
|
+
}],
|
|
519
|
+
ctorParameters: () => [],
|
|
520
|
+
propDecorators: {
|
|
521
|
+
columns: [{
|
|
522
|
+
type: i0.Input,
|
|
523
|
+
args: [{
|
|
524
|
+
isSignal: true,
|
|
525
|
+
alias: "columns",
|
|
526
|
+
required: true
|
|
527
|
+
}]
|
|
528
|
+
}],
|
|
529
|
+
rows: [{
|
|
530
|
+
type: i0.Input,
|
|
531
|
+
args: [{
|
|
532
|
+
isSignal: true,
|
|
533
|
+
alias: "rows",
|
|
534
|
+
required: true
|
|
535
|
+
}]
|
|
536
|
+
}],
|
|
537
|
+
caption: [{
|
|
538
|
+
type: i0.Input,
|
|
539
|
+
args: [{
|
|
540
|
+
isSignal: true,
|
|
541
|
+
alias: "caption",
|
|
542
|
+
required: true
|
|
543
|
+
}]
|
|
544
|
+
}],
|
|
545
|
+
showCaption: [{
|
|
546
|
+
type: i0.Input,
|
|
547
|
+
args: [{
|
|
548
|
+
isSignal: true,
|
|
549
|
+
alias: "showCaption",
|
|
550
|
+
required: false
|
|
551
|
+
}]
|
|
552
|
+
}],
|
|
553
|
+
rowId: [{
|
|
554
|
+
type: i0.Input,
|
|
555
|
+
args: [{
|
|
556
|
+
isSignal: true,
|
|
557
|
+
alias: "rowId",
|
|
558
|
+
required: false
|
|
559
|
+
}]
|
|
560
|
+
}],
|
|
561
|
+
actions: [{
|
|
562
|
+
type: i0.Input,
|
|
563
|
+
args: [{
|
|
564
|
+
isSignal: true,
|
|
565
|
+
alias: "actions",
|
|
566
|
+
required: false
|
|
567
|
+
}]
|
|
568
|
+
}],
|
|
569
|
+
selectable: [{
|
|
570
|
+
type: i0.Input,
|
|
571
|
+
args: [{
|
|
572
|
+
isSignal: true,
|
|
573
|
+
alias: "selectable",
|
|
574
|
+
required: false
|
|
575
|
+
}]
|
|
576
|
+
}],
|
|
577
|
+
reorderable: [{
|
|
578
|
+
type: i0.Input,
|
|
579
|
+
args: [{
|
|
580
|
+
isSignal: true,
|
|
581
|
+
alias: "reorderable",
|
|
582
|
+
required: false
|
|
583
|
+
}]
|
|
584
|
+
}],
|
|
585
|
+
labels: [{
|
|
586
|
+
type: i0.Input,
|
|
587
|
+
args: [{
|
|
588
|
+
isSignal: true,
|
|
589
|
+
alias: "labels",
|
|
590
|
+
required: false
|
|
591
|
+
}]
|
|
592
|
+
}],
|
|
593
|
+
edited: [{
|
|
594
|
+
type: i0.Output,
|
|
595
|
+
args: ["edited"]
|
|
596
|
+
}],
|
|
597
|
+
reordered: [{
|
|
598
|
+
type: i0.Output,
|
|
599
|
+
args: ["reordered"]
|
|
600
|
+
}],
|
|
601
|
+
action: [{
|
|
602
|
+
type: i0.Output,
|
|
603
|
+
args: ["action"]
|
|
604
|
+
}],
|
|
605
|
+
sortChange: [{
|
|
606
|
+
type: i0.Output,
|
|
607
|
+
args: ["sortChange"]
|
|
608
|
+
}],
|
|
609
|
+
selectionChange: [{
|
|
610
|
+
type: i0.Output,
|
|
611
|
+
args: ["selectionChange"]
|
|
612
|
+
}],
|
|
613
|
+
cellTemplates: [{
|
|
614
|
+
type: i0.ContentChildren,
|
|
615
|
+
args: [i0.forwardRef(() => SuTableCellDirective), { isSignal: true }]
|
|
616
|
+
}]
|
|
617
|
+
}
|
|
618
|
+
});
|
|
619
|
+
export { SU_TABLE_EDIT_ACTION, SU_TABLE_LABELS, SuTableCellDirective, SuTableComponent, SuTableFieldComponent, suCheckboxEditor, suDateEditor, suNumberEditor, suSelectEditor, suTextEditor };
|
|
620
|
+
|
|
621
|
+
//# sourceMappingURL=su-labs-table.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"su-labs-table.mjs","names":["SU_TABLE_LABELS"],"sources":["../../../../projects/su-labs/table/src/lib/table-cell.directive.ts","../../../../projects/su-labs/table/src/lib/table-field.component.ts","../../../../projects/su-labs/table/src/lib/table-field.component.html","../../../../projects/su-labs/table/src/lib/table.component.ts","../../../../projects/su-labs/table/src/lib/table.component.html"],"sourcesContent":["import { Directive, inject, input, TemplateRef } from '@angular/core';\n\n/** What a custom cell template gets: the row (`let-row`) and its formatted text (`let-text=\"text\"`) */\nexport interface SuTableCellContext<TRow extends object> {\n readonly $implicit: TRow;\n readonly text: string;\n}\n\n/**\n * A custom cell for one column, in place of its text:\n * `<ng-template suTableCell=\"status\" [suTableCellOf]=\"users()\" let-user>…</ng-template>`.\n * `suTableCellOf` only types `let-user` as the row.\n */\n@Directive({ selector: 'ng-template[suTableCell]' })\nexport class SuTableCellDirective<TRow extends object> {\n /** The column's key */\n readonly key = input.required<string>({ alias: 'suTableCell' });\n /** The table's rows, to type the template's row */\n readonly rowsOf = input<readonly TRow[]>([], { alias: 'suTableCellOf' });\n readonly template: TemplateRef<SuTableCellContext<TRow>> = inject(TemplateRef);\n\n static ngTemplateContextGuard<TRow extends object>(\n _directive: SuTableCellDirective<TRow>,\n context: unknown,\n ): context is SuTableCellContext<TRow> {\n return true;\n }\n}\n","import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core';\nimport { SuTableDraftField, SuTableInputValue } from '@su-labs/core/table';\n\n/** The form control of one field being edited, chosen by its editor's input */\n@Component({\n selector: 'su-lib-table-field',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'su-table-field' },\n templateUrl: './table-field.component.html',\n styleUrl: './table-field.component.scss',\n})\nexport class SuTableFieldComponent<TRow extends object> {\n readonly field = input.required<SuTableDraftField<TRow>>();\n readonly controlId = input.required<string>();\n /** The control's name when no visible `<label>` points at it */\n readonly ariaLabel = input<string | null>(null);\n readonly mixedLabel = input.required<string>();\n readonly valueChange = output<SuTableInputValue>();\n\n protected readonly errorId = computed(() => `${this.controlId()}-error`);\n protected readonly placeholder = computed(() => {\n const field = this.field();\n return field.mixed ? this.mixedLabel() : (field.editor.attributes.placeholder ?? null);\n });\n\n protected onChange(event: Event): void {\n const target = event.target;\n if (target instanceof HTMLInputElement && target.type === 'checkbox') {\n this.valueChange.emit(target.checked);\n } else if (\n target instanceof HTMLInputElement ||\n target instanceof HTMLSelectElement ||\n target instanceof HTMLTextAreaElement\n ) {\n this.valueChange.emit(target.value);\n }\n }\n}\n","@let item = field();\n@let attributes = item.editor.attributes;\n@switch (item.editor.input) {\n @case ('checkbox') {\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [id]=\"controlId()\"\n [checked]=\"item.value === true\"\n [indeterminate]=\"item.mixed\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (change)=\"onChange($event)\"\n />\n }\n @case ('select') {\n <select\n class=\"su-table-control\"\n [id]=\"controlId()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (change)=\"onChange($event)\"\n >\n @if (item.mixed) {\n <option value=\"\" disabled selected>{{ mixedLabel() }}</option>\n }\n @for (option of item.editor.options; track option.value) {\n <option [value]=\"option.value\" [selected]=\"!item.mixed && option.value === item.value\">\n {{ option.label }}\n </option>\n }\n </select>\n }\n @case ('textarea') {\n <textarea\n class=\"su-table-control\"\n rows=\"2\"\n [id]=\"controlId()\"\n [value]=\"item.value\"\n [attr.placeholder]=\"placeholder()\"\n [attr.maxlength]=\"attributes.maxLength ?? null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (input)=\"onChange($event)\"\n ></textarea>\n }\n @default {\n <input\n class=\"su-table-control\"\n [type]=\"item.editor.input\"\n [id]=\"controlId()\"\n [value]=\"item.value\"\n [attr.placeholder]=\"placeholder()\"\n [attr.min]=\"attributes.min ?? null\"\n [attr.max]=\"attributes.max ?? null\"\n [attr.step]=\"attributes.step ?? null\"\n [attr.maxlength]=\"attributes.maxLength ?? null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (input)=\"onChange($event)\"\n />\n }\n}\n@if (item.error) {\n <span class=\"su-table-error\" [id]=\"errorId()\">{{ item.error }}</span>\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport { afterRenderEffect, booleanAttribute, ChangeDetectionStrategy, Component, computed, contentChildren, DestroyRef, effect, ElementRef, inject, input, output, signal, TemplateRef, untracked } from '@angular/core';\nimport { SU_TABLE_LABELS, SuTableAction, SuTableActionView, SuTableColumns, SuTableController, SuTableDraftField, suTableDropIndex, SuTableInputValue, SuTableLabels, SuTableRowId, SuTableRowView, SuTableSort } from '@su-labs/core/table';\nimport { SuTableCellContext, SuTableCellDirective } from './table-cell.directive';\nimport { SuTableFieldComponent } from './table-field.component';\n\n/** The action id the table handles itself: it edits the row inline */\nexport const SU_TABLE_EDIT_ACTION = 'edit';\n\n/** A row action (or a bulk action) was clicked */\nexport interface SuTableActionEvent<TRow extends object> {\n readonly id: string;\n /** The clicked row, or the selected rows for a bulk action */\n readonly rows: readonly TRow[];\n}\n\n/** The rows were reordered */\nexport interface SuTableReorderEvent<TRow extends object> {\n readonly ids: readonly SuTableRowId[];\n /** Every row in its new order */\n readonly rows: readonly TRow[];\n}\n\n/** A row being dragged with the pointer */\ninterface DragState {\n readonly id: SuTableRowId;\n readonly from: number;\n readonly to: number;\n /** Where the pointer went down, in page coordinates */\n readonly startY: number;\n readonly offsetY: number;\n /** The dragged row's height: how far the rows it passes slide to make room */\n readonly height: number;\n /** Every row's vertical middle before the drag, in page coordinates */\n readonly middles: readonly number[];\n}\n\nlet nextTableId = 0;\n\n/**\n * An accessible data table over `SuTableController` from `@su-labs/core/table`: typed columns map the API's rows,\n * with sorting, selection, inline and bulk editing, drag-and-drop and keyboard reordering, row actions and announced\n * changes. Edited rows come out in the API's own shape through `edited`.\n */\n@Component({\n selector: 'su-lib-table',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgTemplateOutlet, SuTableFieldComponent],\n templateUrl: './table.component.html',\n styleUrl: './table.component.scss',\n host: { class: 'su-table' },\n})\nexport class SuTableComponent<TRow extends object> {\n readonly columns = input.required<SuTableColumns<TRow>>();\n readonly rows = input.required<readonly TRow[]>();\n /** The table's name for screen readers, shown as its caption */\n readonly caption = input.required<string>();\n /** Shows the caption on screen too @default false */\n readonly showCaption = input(false, { transform: booleanAttribute });\n /** The row's identity, e.g. the API's id; keeps the selection and edits across new rows */\n readonly rowId = input<(row: TRow) => SuTableRowId>();\n /** Buttons on each row; the `edit` id edits the row inline */\n readonly actions = input<readonly SuTableAction<TRow>[]>([]);\n /** Rows can be selected, to edit or act on many at once @default false */\n readonly selectable = input(false, { transform: booleanAttribute });\n /** Rows can be reordered, by dragging or with the keyboard @default false */\n readonly reorderable = input(false, { transform: booleanAttribute });\n /** Texts to replace, e.g. in the page's language */\n readonly labels = input<Partial<SuTableLabels>>({});\n\n /** Rows were edited and saved; send them to the API as they are */\n readonly edited = output<readonly TRow[]>();\n readonly reordered = output<SuTableReorderEvent<TRow>>();\n readonly action = output<SuTableActionEvent<TRow>>();\n readonly sortChange = output<SuTableSort<TRow> | null>();\n readonly selectionChange = output<readonly TRow[]>();\n\n private readonly controller = new SuTableController<TRow>();\n private readonly host: ElementRef<HTMLElement> = inject(ElementRef);\n private readonly cellTemplates = contentChildren(SuTableCellDirective);\n private readonly focusHandleId = signal<SuTableRowId | null>(null);\n\n protected readonly tableId = `su-table-${nextTableId++}`;\n protected readonly state = signal(this.controller.state.get());\n protected readonly text = computed<SuTableLabels>(() => ({\n ...SU_TABLE_LABELS,\n ...this.labels(),\n }));\n protected readonly drag = signal<DragState | null>(null);\n protected readonly inlineDraft = computed(() => {\n const draft = this.state().draft;\n return draft && !draft.bulk ? draft : null;\n });\n protected readonly bulkDraft = computed(() => {\n const draft = this.state().draft;\n return draft?.bulk ? draft : null;\n });\n protected readonly hasActions = computed(() => this.actions().length > 0);\n protected readonly columnCount = computed(\n () =>\n this.state().columns.length +\n Number(this.reorderable()) +\n Number(this.selectable()) +\n Number(this.hasActions())\n );\n\n constructor() {\n const unsubscribe = this.controller.state.subscribe(state =>\n this.state.set(state)\n );\n inject(DestroyRef).onDestroy(unsubscribe);\n effect(() => {\n const options = {\n columns: this.columns(),\n rowId: this.rowId(),\n actions: this.actions(),\n labels: this.labels(),\n };\n untracked(() => this.controller.configure(options));\n });\n effect(() => {\n const rows = this.rows();\n untracked(() => this.controller.setRows(rows));\n });\n afterRenderEffect(() => {\n const id = this.focusHandleId();\n this.state();\n const handle = this.host.nativeElement.querySelector<HTMLElement>(\n `[data-su-handle=\"${id}\"]`\n );\n if (id !== null && handle && document.activeElement !== handle) {\n handle.focus();\n }\n });\n }\n\n protected cellTemplate(\n key: keyof TRow\n ): TemplateRef<SuTableCellContext<object>> | null {\n return (\n this.cellTemplates().find(cell => cell.key() === String(key))?.template ??\n null\n );\n }\n\n protected inlineField(key: keyof TRow): SuTableDraftField<TRow> | null {\n return this.inlineDraft()?.fields.find(field => field.key === key) ?? null;\n }\n\n protected controlId(id: SuTableRowId | 'bulk', key: keyof TRow): string {\n return `${this.tableId}-${id}-${String(key)}`;\n }\n\n protected sortBy(key: keyof TRow): void {\n this.controller.sortBy(key);\n this.sortChange.emit(this.state().sort);\n }\n\n protected select(id: SuTableRowId): void {\n this.controller.select(id);\n this.selectionChange.emit(this.controller.selectedRows());\n }\n\n protected selectAll(selected?: boolean): void {\n this.controller.selectAll(selected);\n this.selectionChange.emit(this.controller.selectedRows());\n }\n\n protected runAction(\n action: SuTableActionView,\n row: SuTableRowView<TRow>\n ): void {\n if (action.id === SU_TABLE_EDIT_ACTION && this.state().editable) {\n this.controller.startEdit([row.id]);\n return;\n }\n this.action.emit({ id: action.id, rows: [row.data] });\n }\n\n protected runBulkAction(action: SuTableActionView): void {\n this.action.emit({ id: action.id, rows: this.controller.selectedRows() });\n }\n\n protected editSelected(): void {\n this.controller.startEdit();\n }\n\n protected setDraft(key: keyof TRow, value: SuTableInputValue): void {\n this.controller.setDraft(key, value);\n }\n\n protected save(event?: Event): void {\n event?.preventDefault();\n const result = this.controller.save();\n if (result.ok && result.rows.length > 0) {\n this.edited.emit(result.rows);\n }\n }\n\n protected cancelEdit(): void {\n this.controller.cancelEdit();\n }\n\n /** Enter saves the row being edited inline (but adds a line in a text area), Escape cancels */\n protected onEditKey(event: KeyboardEvent): void {\n if (event.key === 'Escape') {\n this.cancelEdit();\n } else if (\n event.key === 'Enter' &&\n !(event.target instanceof HTMLTextAreaElement)\n ) {\n this.save(event);\n }\n }\n\n protected onHandleKey(event: KeyboardEvent, id: SuTableRowId): void {\n const result = this.controller.moveKey(id, event.key);\n if (!result.handled) {\n this.focusHandleId.set(null);\n return;\n }\n event.preventDefault();\n this.focusHandleId.set(id);\n if (result.order) {\n this.emitReorder(result.order);\n }\n }\n\n protected onHandleDown(\n event: PointerEvent,\n id: SuTableRowId,\n index: number\n ): void {\n if (event.button !== 0) {\n return;\n }\n event.preventDefault();\n if (event.target instanceof Element) {\n event.target.setPointerCapture(event.pointerId);\n }\n const rows = [\n ...this.host.nativeElement.querySelectorAll('tbody > tr[data-su-row]'),\n ].map(row => row.getBoundingClientRect());\n this.drag.set({\n id,\n from: index,\n to: index,\n startY: event.clientY + window.scrollY,\n offsetY: 0,\n height: rows[index]?.height ?? 0,\n middles: rows.map(({ top, height }) => top + window.scrollY + height / 2),\n });\n }\n\n protected onHandleMove(event: PointerEvent): void {\n const drag = this.drag();\n if (!drag) {\n return;\n }\n const pointerY = event.clientY + window.scrollY;\n this.drag.set({\n ...drag,\n to: suTableDropIndex(pointerY, drag.middles, drag.from),\n offsetY: pointerY - drag.startY,\n });\n }\n\n protected onHandleUp(): void {\n const drag = this.drag();\n this.drag.set(null);\n const order = drag ? this.controller.move(drag.id, drag.to) : null;\n if (order) {\n this.emitReorder(order);\n }\n }\n\n protected onHandleCancel(): void {\n this.drag.set(null);\n }\n\n /** While dragging, the dragged row follows the pointer and the rows it passes slide aside to open its place */\n protected dragTransform(index: number): string | null {\n const drag = this.drag();\n if (!drag) {\n return null;\n }\n if (index === drag.from) {\n return `translateY(${drag.offsetY}px)`;\n }\n const slidesUp = index > drag.from && index <= drag.to;\n const slidesDown = index < drag.from && index >= drag.to;\n return slidesUp || slidesDown\n ? `translateY(${slidesUp ? -drag.height : drag.height}px)`\n : null;\n }\n\n private emitReorder(ids: readonly SuTableRowId[]): void {\n this.reordered.emit({ ids, rows: this.controller.rowsOf(ids) });\n }\n}\n","@let current = state();\n@let t = text();\n@let selectedCount = current.selectedIds.length;\n@if (selectable() && selectedCount > 0) {\n <div class=\"su-table-toolbar\" role=\"toolbar\" [attr.aria-label]=\"t.selected(selectedCount)\">\n <span class=\"su-table-toolbar-count\">{{ t.selected(selectedCount) }}</span>\n @if (current.editable && !current.draft) {\n <button type=\"button\" class=\"su-table-button\" (click)=\"editSelected()\">\n {{ t.editSelected(selectedCount) }}\n </button>\n }\n @for (action of current.bulkActions; track action.id) {\n <button type=\"button\" class=\"su-table-button\" [class.is-danger]=\"action.danger\" (click)=\"runBulkAction(action)\">\n {{ action.label }}\n </button>\n }\n <button type=\"button\" class=\"su-table-button is-quiet\" (click)=\"selectAll(false)\">{{ t.clearSelection }}</button>\n </div>\n}\n\n@if (bulkDraft(); as draft) {\n <form\n class=\"su-table-bulk\"\n [attr.aria-labelledby]=\"tableId + '-bulk-title'\"\n (submit)=\"save($event)\"\n (keydown.escape)=\"cancelEdit()\"\n >\n <h3 class=\"su-table-bulk-title\" [id]=\"tableId + '-bulk-title'\">{{ t.editing(draft.ids.length) }}</h3>\n <div class=\"su-table-bulk-fields\">\n @for (field of draft.fields; track field.key) {\n <div class=\"su-table-bulk-field\">\n <label class=\"su-table-label\" [for]=\"controlId('bulk', field.key)\">{{ field.header }}</label>\n <su-lib-table-field\n [field]=\"field\"\n [controlId]=\"controlId('bulk', field.key)\"\n [mixedLabel]=\"t.mixed\"\n (valueChange)=\"setDraft(field.key, $event)\"\n />\n </div>\n }\n </div>\n <div class=\"su-table-bulk-actions\">\n <button type=\"submit\" class=\"su-table-button is-primary\">{{ t.save }}</button>\n <button type=\"button\" class=\"su-table-button\" (click)=\"cancelEdit()\">{{ t.cancel }}</button>\n </div>\n </form>\n}\n\n<div class=\"su-table-scroll\">\n <table class=\"su-table-grid\" [class.is-dragging-rows]=\"drag() !== null\">\n <caption [class.su-table-visually-hidden]=\"!showCaption()\">{{ caption() }}</caption>\n <thead>\n <tr>\n @if (reorderable()) {\n <th scope=\"col\" class=\"su-table-handle-cell\">\n <span class=\"su-table-visually-hidden\">{{ t.order }}</span>\n </th>\n }\n @if (selectable()) {\n <th scope=\"col\" class=\"su-table-select-cell\">\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [checked]=\"current.selection === 'all'\"\n [indeterminate]=\"current.selection === 'some'\"\n [disabled]=\"current.rows.length === 0\"\n [attr.aria-label]=\"t.selectAll\"\n (change)=\"selectAll()\"\n />\n </th>\n }\n @for (column of current.columns; track column.key) {\n <th\n scope=\"col\"\n class=\"su-table-align-{{ column.align }}\"\n [attr.aria-sort]=\"column.sort === 'none' ? null : column.sort\"\n >\n @if (column.sortable) {\n <button type=\"button\" class=\"su-table-sort\" (click)=\"sortBy(column.key)\">\n {{ column.header }}\n <span class=\"su-table-sort-icon is-{{ column.sort }}\" aria-hidden=\"true\"></span>\n </button>\n } @else {\n {{ column.header }}\n }\n </th>\n }\n @if (hasActions()) {\n <th scope=\"col\" class=\"su-table-actions-cell\">{{ t.actions }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of current.rows; track row.id; let index = $index) {\n @let editing = inlineDraft()?.ids?.[0] === row.id;\n <tr\n data-su-row\n [class.is-selected]=\"row.selected\"\n [class.is-editing]=\"editing\"\n [class.is-grabbed]=\"current.grabbedId === row.id\"\n [class.is-dragging]=\"drag()?.id === row.id\"\n [style.transform]=\"dragTransform(index)\"\n (keydown)=\"editing && onEditKey($event)\"\n >\n @if (reorderable()) {\n <td class=\"su-table-handle-cell\">\n <button\n type=\"button\"\n class=\"su-table-handle\"\n [attr.data-su-handle]=\"row.id\"\n [attr.aria-label]=\"t.moveRow(row.label)\"\n [attr.aria-pressed]=\"current.grabbedId === row.id\"\n (keydown)=\"onHandleKey($event, row.id)\"\n (pointerdown)=\"onHandleDown($event, row.id, index)\"\n (pointermove)=\"onHandleMove($event)\"\n (pointerup)=\"onHandleUp()\"\n (pointercancel)=\"onHandleCancel()\"\n >\n <span class=\"su-table-grip\" aria-hidden=\"true\"></span>\n </button>\n </td>\n }\n @if (selectable()) {\n <td class=\"su-table-select-cell\">\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [checked]=\"row.selected\"\n [attr.aria-label]=\"t.selectRow(row.label)\"\n (change)=\"select(row.id)\"\n />\n </td>\n }\n @for (cell of row.cells; track cell.key; let first = $first, cellIndex = $index) {\n @let column = current.columns[cellIndex];\n <ng-template #content>\n @if (editing && inlineField(cell.key); as field) {\n <su-lib-table-field\n [field]=\"field\"\n [controlId]=\"controlId(row.id, cell.key)\"\n [ariaLabel]=\"column.header\"\n [mixedLabel]=\"t.mixed\"\n (valueChange)=\"setDraft(cell.key, $event)\"\n />\n } @else if (cellTemplate(cell.key); as template) {\n <ng-container *ngTemplateOutlet=\"template; context: { $implicit: row.data, text: cell.text }\" />\n } @else {\n {{ cell.text }}\n }\n </ng-template>\n @if (first) {\n <th scope=\"row\" class=\"su-table-align-{{ column.align }}\">\n <ng-container *ngTemplateOutlet=\"content\" />\n </th>\n } @else {\n <td class=\"su-table-align-{{ column.align }}\"><ng-container *ngTemplateOutlet=\"content\" /></td>\n }\n }\n @if (hasActions()) {\n <td class=\"su-table-actions-cell\">\n <div class=\"su-table-actions\">\n @if (editing) {\n <button type=\"button\" class=\"su-table-button is-primary\" (click)=\"save()\">{{ t.save }}</button>\n <button type=\"button\" class=\"su-table-button\" (click)=\"cancelEdit()\">{{ t.cancel }}</button>\n } @else {\n @for (action of row.actions; track action.id) {\n <button\n type=\"button\"\n class=\"su-table-button\"\n [class.is-danger]=\"action.danger\"\n [disabled]=\"action.disabled\"\n [attr.aria-label]=\"action.label + ', ' + row.label\"\n (click)=\"runAction(action, row)\"\n >\n {{ action.label }}\n </button>\n }\n }\n </div>\n </td>\n }\n </tr>\n } @empty {\n <tr>\n <td class=\"su-table-empty\" [attr.colspan]=\"columnCount()\">{{ t.empty }}</td>\n </tr>\n }\n </tbody>\n </table>\n</div>\n\n<div class=\"su-table-visually-hidden\" role=\"status\">{{ current.announcement }}</div>\n"],"mappings":";;;;AAcA,IAAa,uBAAb,MAAa,qBAAoB;CAEtB,MAAM,MAAM,SAAQ;EAAA,GAAA,YAAA,EAAA,WAAA,MAAA,+BAAA,CAAA;EAAW,OAAO;CAAa,CAAA;CAEnD,SAAS,MAAuB,CAAA,GAAE;EAAA,GAAA,YAAA,EAAA,WAAA,SAAA,+BAAA,CAAA;EAAI,OAAO;CAAe,CAAA;CAC5D,WAAkD,OAAO,WAAW;CAE7E,OAAO,uBACL,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A;EAAA,CAAA;EAAA,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,WAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,YAAA;EAAA,CAAA;EAAA,iBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,iBAAA;EAAA,CAAA;EAAA,eAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,oBAAoB,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@su-labs/table",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "22.0.0",
|
|
4
|
+
"description": "Accessible data tables for Angular, mapped from your API's JSON with typed columns: sorting, selection, inline and bulk editing, drag-and-drop and keyboard reordering, and row actions, themeable with CSS variables.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"angular",
|
|
7
|
+
"table",
|
|
8
|
+
"data-table",
|
|
9
|
+
"datagrid",
|
|
10
|
+
"sorting",
|
|
11
|
+
"inline-editing",
|
|
12
|
+
"bulk-edit",
|
|
13
|
+
"drag-and-drop",
|
|
14
|
+
"reorder",
|
|
15
|
+
"accessible",
|
|
16
|
+
"signals",
|
|
17
|
+
"themeable",
|
|
18
|
+
"css-variables"
|
|
19
|
+
],
|
|
20
|
+
"homepage": "https://su-labs.dev/",
|
|
21
|
+
"author": {
|
|
22
|
+
"name": "Yevheniy Alekseyev",
|
|
23
|
+
"email": "yev.alekseyev@gmail.com",
|
|
24
|
+
"url": "https://github.com/Greezaaa"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/Greezaaa/settings-utils-lib.git",
|
|
29
|
+
"directory": "projects/su-labs/table"
|
|
30
|
+
},
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/Greezaaa/settings-utils-lib/issues"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@angular/common": "^22.0.0",
|
|
36
|
+
"@angular/core": "^22.0.0"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@su-labs/core": "1.7.0",
|
|
40
|
+
"tslib": "^2.3.0"
|
|
41
|
+
},
|
|
42
|
+
"sideEffects": false,
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"module": "fesm2022/su-labs-table.mjs",
|
|
45
|
+
"typings": "types/su-labs-table.d.ts",
|
|
46
|
+
"exports": {
|
|
47
|
+
"./package.json": {
|
|
48
|
+
"default": "./package.json"
|
|
49
|
+
},
|
|
50
|
+
".": {
|
|
51
|
+
"types": "./types/su-labs-table.d.ts",
|
|
52
|
+
"default": "./fesm2022/su-labs-table.mjs"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"type": "module"
|
|
6
56
|
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { SU_TABLE_LABELS, SuNumberEditorOptions, SuSelectChoice, SuTableAction, SuTableAction as SuTableAction$1, SuTableActionView, SuTableAlign, SuTableColumn, SuTableColumns, SuTableColumns as SuTableColumns$1, SuTableDraftField, SuTableEditor, SuTableInput, SuTableInputAttributes, SuTableInputValue, SuTableInputValue as SuTableInputValue$1, SuTableLabels, SuTableLabels as SuTableLabels$1, SuTableOption, SuTableRowId, SuTableRowId as SuTableRowId$1, SuTableRowView, SuTableSort, SuTableSort as SuTableSort$1, SuTableSortDirection, SuTextEditorOptions, suCheckboxEditor, suDateEditor, suNumberEditor, suSelectEditor, suTextEditor } from "@su-labs/core/table";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { TemplateRef } from "@angular/core";
|
|
4
|
+
/** What a custom cell template gets: the row (`let-row`) and its formatted text (`let-text="text"`) */
|
|
5
|
+
export interface SuTableCellContext<TRow extends object> {
|
|
6
|
+
readonly $implicit: TRow;
|
|
7
|
+
readonly text: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A custom cell for one column, in place of its text:
|
|
11
|
+
* `<ng-template suTableCell="status" [suTableCellOf]="users()" let-user>…</ng-template>`.
|
|
12
|
+
* `suTableCellOf` only types `let-user` as the row.
|
|
13
|
+
*/
|
|
14
|
+
export declare class SuTableCellDirective<TRow extends object> {
|
|
15
|
+
/** The column's key */
|
|
16
|
+
readonly key: import("@angular/core").InputSignal<string>;
|
|
17
|
+
/** The table's rows, to type the template's row */
|
|
18
|
+
readonly rowsOf: import("@angular/core").InputSignal<readonly TRow[]>;
|
|
19
|
+
readonly template: TemplateRef<SuTableCellContext<TRow>>;
|
|
20
|
+
static ngTemplateContextGuard<TRow extends object>(_directive: SuTableCellDirective<TRow>, context: unknown): context is SuTableCellContext<TRow>;
|
|
21
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SuTableCellDirective<any>, never>;
|
|
22
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<SuTableCellDirective<any>, "ng-template[suTableCell]", never, {
|
|
23
|
+
"key": {
|
|
24
|
+
"alias": "suTableCell";
|
|
25
|
+
"required": true;
|
|
26
|
+
"isSignal": true;
|
|
27
|
+
};
|
|
28
|
+
"rowsOf": {
|
|
29
|
+
"alias": "suTableCellOf";
|
|
30
|
+
"required": false;
|
|
31
|
+
"isSignal": true;
|
|
32
|
+
};
|
|
33
|
+
}, {}, never, never, true, never>;
|
|
34
|
+
}
|
|
35
|
+
/** The form control of one field being edited, chosen by its editor's input */
|
|
36
|
+
export declare class SuTableFieldComponent<TRow extends object> {
|
|
37
|
+
readonly field: import("@angular/core").InputSignal<SuTableDraftField<TRow>>;
|
|
38
|
+
readonly controlId: import("@angular/core").InputSignal<string>;
|
|
39
|
+
/** The control's name when no visible `<label>` points at it */
|
|
40
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string | null>;
|
|
41
|
+
readonly mixedLabel: import("@angular/core").InputSignal<string>;
|
|
42
|
+
readonly valueChange: import("@angular/core").OutputEmitterRef<SuTableInputValue$1>;
|
|
43
|
+
protected readonly errorId: import("@angular/core").Signal<string>;
|
|
44
|
+
protected readonly placeholder: import("@angular/core").Signal<string | null>;
|
|
45
|
+
protected onChange(event: Event): void;
|
|
46
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SuTableFieldComponent<any>, never>;
|
|
47
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SuTableFieldComponent<any>, "su-lib-table-field", never, {
|
|
48
|
+
"field": {
|
|
49
|
+
"alias": "field";
|
|
50
|
+
"required": true;
|
|
51
|
+
"isSignal": true;
|
|
52
|
+
};
|
|
53
|
+
"controlId": {
|
|
54
|
+
"alias": "controlId";
|
|
55
|
+
"required": true;
|
|
56
|
+
"isSignal": true;
|
|
57
|
+
};
|
|
58
|
+
"ariaLabel": {
|
|
59
|
+
"alias": "ariaLabel";
|
|
60
|
+
"required": false;
|
|
61
|
+
"isSignal": true;
|
|
62
|
+
};
|
|
63
|
+
"mixedLabel": {
|
|
64
|
+
"alias": "mixedLabel";
|
|
65
|
+
"required": true;
|
|
66
|
+
"isSignal": true;
|
|
67
|
+
};
|
|
68
|
+
}, {
|
|
69
|
+
"valueChange": "valueChange";
|
|
70
|
+
}, never, never, true, never>;
|
|
71
|
+
}
|
|
72
|
+
/** The action id the table handles itself: it edits the row inline */
|
|
73
|
+
export declare const SU_TABLE_EDIT_ACTION = "edit";
|
|
74
|
+
/** A row action (or a bulk action) was clicked */
|
|
75
|
+
export interface SuTableActionEvent<TRow extends object> {
|
|
76
|
+
readonly id: string;
|
|
77
|
+
/** The clicked row, or the selected rows for a bulk action */
|
|
78
|
+
readonly rows: readonly TRow[];
|
|
79
|
+
}
|
|
80
|
+
/** The rows were reordered */
|
|
81
|
+
export interface SuTableReorderEvent<TRow extends object> {
|
|
82
|
+
readonly ids: readonly SuTableRowId$1[];
|
|
83
|
+
/** Every row in its new order */
|
|
84
|
+
readonly rows: readonly TRow[];
|
|
85
|
+
}
|
|
86
|
+
/** A row being dragged with the pointer */
|
|
87
|
+
interface DragState {
|
|
88
|
+
readonly id: SuTableRowId$1;
|
|
89
|
+
readonly from: number;
|
|
90
|
+
readonly to: number;
|
|
91
|
+
/** Where the pointer went down, in page coordinates */
|
|
92
|
+
readonly startY: number;
|
|
93
|
+
readonly offsetY: number;
|
|
94
|
+
/** The dragged row's height: how far the rows it passes slide to make room */
|
|
95
|
+
readonly height: number;
|
|
96
|
+
/** Every row's vertical middle before the drag, in page coordinates */
|
|
97
|
+
readonly middles: readonly number[];
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* An accessible data table over `SuTableController` from `@su-labs/core/table`: typed columns map the API's rows,
|
|
101
|
+
* with sorting, selection, inline and bulk editing, drag-and-drop and keyboard reordering, row actions and announced
|
|
102
|
+
* changes. Edited rows come out in the API's own shape through `edited`.
|
|
103
|
+
*/
|
|
104
|
+
export declare class SuTableComponent<TRow extends object> {
|
|
105
|
+
readonly columns: import("@angular/core").InputSignal<SuTableColumns$1<TRow>>;
|
|
106
|
+
readonly rows: import("@angular/core").InputSignal<readonly TRow[]>;
|
|
107
|
+
/** The table's name for screen readers, shown as its caption */
|
|
108
|
+
readonly caption: import("@angular/core").InputSignal<string>;
|
|
109
|
+
/** Shows the caption on screen too @default false */
|
|
110
|
+
readonly showCaption: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
111
|
+
/** The row's identity, e.g. the API's id; keeps the selection and edits across new rows */
|
|
112
|
+
readonly rowId: import("@angular/core").InputSignal<((row: TRow) => SuTableRowId$1) | undefined>;
|
|
113
|
+
/** Buttons on each row; the `edit` id edits the row inline */
|
|
114
|
+
readonly actions: import("@angular/core").InputSignal<readonly SuTableAction$1<TRow>[]>;
|
|
115
|
+
/** Rows can be selected, to edit or act on many at once @default false */
|
|
116
|
+
readonly selectable: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
117
|
+
/** Rows can be reordered, by dragging or with the keyboard @default false */
|
|
118
|
+
readonly reorderable: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
119
|
+
/** Texts to replace, e.g. in the page's language */
|
|
120
|
+
readonly labels: import("@angular/core").InputSignal<Partial<SuTableLabels$1>>;
|
|
121
|
+
/** Rows were edited and saved; send them to the API as they are */
|
|
122
|
+
readonly edited: import("@angular/core").OutputEmitterRef<readonly TRow[]>;
|
|
123
|
+
readonly reordered: import("@angular/core").OutputEmitterRef<SuTableReorderEvent<TRow>>;
|
|
124
|
+
readonly action: import("@angular/core").OutputEmitterRef<SuTableActionEvent<TRow>>;
|
|
125
|
+
readonly sortChange: import("@angular/core").OutputEmitterRef<SuTableSort$1<TRow> | null>;
|
|
126
|
+
readonly selectionChange: import("@angular/core").OutputEmitterRef<readonly TRow[]>;
|
|
127
|
+
private readonly controller;
|
|
128
|
+
private readonly host;
|
|
129
|
+
private readonly cellTemplates;
|
|
130
|
+
private readonly focusHandleId;
|
|
131
|
+
protected readonly tableId: string;
|
|
132
|
+
protected readonly state: import("@angular/core").WritableSignal<import("@su-labs/core/table").SuTableState<TRow>>;
|
|
133
|
+
protected readonly text: import("@angular/core").Signal<SuTableLabels$1>;
|
|
134
|
+
protected readonly drag: import("@angular/core").WritableSignal<DragState | null>;
|
|
135
|
+
protected readonly inlineDraft: import("@angular/core").Signal<import("@su-labs/core/table").SuTableDraft<TRow> | null>;
|
|
136
|
+
protected readonly bulkDraft: import("@angular/core").Signal<import("@su-labs/core/table").SuTableDraft<TRow> | null>;
|
|
137
|
+
protected readonly hasActions: import("@angular/core").Signal<boolean>;
|
|
138
|
+
protected readonly columnCount: import("@angular/core").Signal<number>;
|
|
139
|
+
constructor();
|
|
140
|
+
protected cellTemplate(key: keyof TRow): TemplateRef<SuTableCellContext<object>> | null;
|
|
141
|
+
protected inlineField(key: keyof TRow): SuTableDraftField<TRow> | null;
|
|
142
|
+
protected controlId(id: SuTableRowId$1 | 'bulk', key: keyof TRow): string;
|
|
143
|
+
protected sortBy(key: keyof TRow): void;
|
|
144
|
+
protected select(id: SuTableRowId$1): void;
|
|
145
|
+
protected selectAll(selected?: boolean): void;
|
|
146
|
+
protected runAction(action: SuTableActionView, row: SuTableRowView<TRow>): void;
|
|
147
|
+
protected runBulkAction(action: SuTableActionView): void;
|
|
148
|
+
protected editSelected(): void;
|
|
149
|
+
protected setDraft(key: keyof TRow, value: SuTableInputValue$1): void;
|
|
150
|
+
protected save(event?: Event): void;
|
|
151
|
+
protected cancelEdit(): void;
|
|
152
|
+
/** Enter saves the row being edited inline (but adds a line in a text area), Escape cancels */
|
|
153
|
+
protected onEditKey(event: KeyboardEvent): void;
|
|
154
|
+
protected onHandleKey(event: KeyboardEvent, id: SuTableRowId$1): void;
|
|
155
|
+
protected onHandleDown(event: PointerEvent, id: SuTableRowId$1, index: number): void;
|
|
156
|
+
protected onHandleMove(event: PointerEvent): void;
|
|
157
|
+
protected onHandleUp(): void;
|
|
158
|
+
protected onHandleCancel(): void;
|
|
159
|
+
/** While dragging, the dragged row follows the pointer and the rows it passes slide aside to open its place */
|
|
160
|
+
protected dragTransform(index: number): string | null;
|
|
161
|
+
private emitReorder;
|
|
162
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SuTableComponent<any>, never>;
|
|
163
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SuTableComponent<any>, "su-lib-table", never, {
|
|
164
|
+
"columns": {
|
|
165
|
+
"alias": "columns";
|
|
166
|
+
"required": true;
|
|
167
|
+
"isSignal": true;
|
|
168
|
+
};
|
|
169
|
+
"rows": {
|
|
170
|
+
"alias": "rows";
|
|
171
|
+
"required": true;
|
|
172
|
+
"isSignal": true;
|
|
173
|
+
};
|
|
174
|
+
"caption": {
|
|
175
|
+
"alias": "caption";
|
|
176
|
+
"required": true;
|
|
177
|
+
"isSignal": true;
|
|
178
|
+
};
|
|
179
|
+
"showCaption": {
|
|
180
|
+
"alias": "showCaption";
|
|
181
|
+
"required": false;
|
|
182
|
+
"isSignal": true;
|
|
183
|
+
};
|
|
184
|
+
"rowId": {
|
|
185
|
+
"alias": "rowId";
|
|
186
|
+
"required": false;
|
|
187
|
+
"isSignal": true;
|
|
188
|
+
};
|
|
189
|
+
"actions": {
|
|
190
|
+
"alias": "actions";
|
|
191
|
+
"required": false;
|
|
192
|
+
"isSignal": true;
|
|
193
|
+
};
|
|
194
|
+
"selectable": {
|
|
195
|
+
"alias": "selectable";
|
|
196
|
+
"required": false;
|
|
197
|
+
"isSignal": true;
|
|
198
|
+
};
|
|
199
|
+
"reorderable": {
|
|
200
|
+
"alias": "reorderable";
|
|
201
|
+
"required": false;
|
|
202
|
+
"isSignal": true;
|
|
203
|
+
};
|
|
204
|
+
"labels": {
|
|
205
|
+
"alias": "labels";
|
|
206
|
+
"required": false;
|
|
207
|
+
"isSignal": true;
|
|
208
|
+
};
|
|
209
|
+
}, {
|
|
210
|
+
"edited": "edited";
|
|
211
|
+
"reordered": "reordered";
|
|
212
|
+
"action": "action";
|
|
213
|
+
"sortChange": "sortChange";
|
|
214
|
+
"selectionChange": "selectionChange";
|
|
215
|
+
}, ["cellTemplates"], never, true, never>;
|
|
216
|
+
}
|
|
217
|
+
export { SU_TABLE_LABELS, type SuNumberEditorOptions, type SuSelectChoice, type SuTableAction, type SuTableAlign, type SuTableColumn, type SuTableColumns, type SuTableEditor, type SuTableInput, type SuTableInputAttributes, type SuTableInputValue, type SuTableLabels, type SuTableOption, type SuTableRowId, type SuTableSort, type SuTableSortDirection, type SuTextEditorOptions, suCheckboxEditor, suDateEditor, suNumberEditor, suSelectEditor, suTextEditor };
|