@su-labs/table 19.1.2 → 20.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/fesm2022/su-labs-table.mjs +93 -93
- package/fesm2022/su-labs-table.mjs.map +1 -1
- package/index.d.ts +299 -3
- package/package.json +3 -3
- package/lib/table-cell.directive.d.ts +0 -22
- package/lib/table-field.component.d.ts +0 -16
- package/lib/table-paginator.component.d.ts +0 -15
- package/lib/table-pin-icon.component.d.ts +0 -6
- package/lib/table-pin.directive.d.ts +0 -16
- package/lib/table-toolbar.component.d.ts +0 -48
- package/lib/table.component.d.ts +0 -187
- package/public-api.d.ts +0 -8
package/index.d.ts
CHANGED
|
@@ -1,5 +1,301 @@
|
|
|
1
|
+
import * as _su_labs_core_table from '@su-labs/core/table';
|
|
2
|
+
import { SuTableDraftField, SuTableInputValue, SuTablePagination, SuTableLabels, SuTablePageSize, SuTablePin, SuTableColumnState, SuTableColumns, SuTableRowId, SuTableAction, SuTableSort, SuTableRowView, SuTableActionView } from '@su-labs/core/table';
|
|
3
|
+
export { SU_TABLE_LABELS, SuNumberEditorOptions, SuSelectChoice, SuTableAction, SuTableAlign, SuTableColumn, SuTableColumnState, SuTableColumns, SuTableEditor, SuTableInput, SuTableInputAttributes, SuTableInputValue, SuTableLabels, SuTableOption, SuTablePageSize, SuTablePagination, SuTablePin, SuTableRowId, SuTableSort, SuTableSortDirection, SuTextEditorOptions, suCheckboxEditor, suDateEditor, suNumberEditor, suSelectEditor, suTextEditor } from '@su-labs/core/table';
|
|
4
|
+
import * as _angular_core from '@angular/core';
|
|
5
|
+
import { TemplateRef } from '@angular/core';
|
|
6
|
+
|
|
7
|
+
/** What a custom cell template gets: the row (`let-row`) and its formatted text (`let-text="text"`) */
|
|
8
|
+
interface SuTableCellContext<TRow extends object> {
|
|
9
|
+
readonly $implicit: TRow;
|
|
10
|
+
readonly text: string;
|
|
11
|
+
}
|
|
1
12
|
/**
|
|
2
|
-
*
|
|
13
|
+
* A custom cell for one column, in place of its text:
|
|
14
|
+
* `<ng-template suTableCell="status" [suTableCellOf]="users()" let-user>…</ng-template>`.
|
|
15
|
+
* `suTableCellOf` only types `let-user` as the row.
|
|
3
16
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
17
|
+
declare class SuTableCellDirective<TRow extends object> {
|
|
18
|
+
/** The column's key */
|
|
19
|
+
readonly key: _angular_core.InputSignal<string>;
|
|
20
|
+
/** The table's rows, to type the template's row */
|
|
21
|
+
readonly rowsOf: _angular_core.InputSignal<readonly TRow[]>;
|
|
22
|
+
readonly template: TemplateRef<SuTableCellContext<TRow>>;
|
|
23
|
+
static ngTemplateContextGuard<TRow extends object>(_directive: SuTableCellDirective<TRow>, context: unknown): context is SuTableCellContext<TRow>;
|
|
24
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SuTableCellDirective<any>, never>;
|
|
25
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<SuTableCellDirective<any>, "ng-template[suTableCell]", never, { "key": { "alias": "suTableCell"; "required": true; "isSignal": true; }; "rowsOf": { "alias": "suTableCellOf"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** The form control of one field being edited, chosen by its editor's input */
|
|
29
|
+
declare class SuTableFieldComponent<TRow extends object> {
|
|
30
|
+
readonly field: _angular_core.InputSignal<SuTableDraftField<TRow>>;
|
|
31
|
+
readonly controlId: _angular_core.InputSignal<string>;
|
|
32
|
+
/** The control's name when no visible `<label>` points at it */
|
|
33
|
+
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
34
|
+
readonly mixedLabel: _angular_core.InputSignal<string>;
|
|
35
|
+
readonly valueChange: _angular_core.OutputEmitterRef<SuTableInputValue>;
|
|
36
|
+
protected readonly errorId: _angular_core.Signal<string>;
|
|
37
|
+
protected readonly placeholder: _angular_core.Signal<string | null>;
|
|
38
|
+
protected onChange(event: Event): void;
|
|
39
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SuTableFieldComponent<any>, never>;
|
|
40
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SuTableFieldComponent<any>, "su-lib-table-field", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "controlId": { "alias": "controlId"; "required": true; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "mixedLabel": { "alias": "mixedLabel"; "required": true; "isSignal": true; }; }, { "valueChange": "valueChange"; }, never, never, true, never>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** The page controls under a table: rows per page, the range on screen, and previous and next */
|
|
44
|
+
declare class SuTablePaginatorComponent {
|
|
45
|
+
readonly pagination: _angular_core.InputSignal<SuTablePagination>;
|
|
46
|
+
readonly labels: _angular_core.InputSignal<SuTableLabels>;
|
|
47
|
+
readonly controlId: _angular_core.InputSignal<string>;
|
|
48
|
+
readonly pageChange: _angular_core.OutputEmitterRef<number>;
|
|
49
|
+
readonly pageSizeChange: _angular_core.OutputEmitterRef<SuTablePageSize>;
|
|
50
|
+
/** The buttons stay focusable at the first and last page (`aria-disabled`), so focus isn't lost on the way */
|
|
51
|
+
protected turn(page: number): void;
|
|
52
|
+
protected onPageSize(event: Event): void;
|
|
53
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SuTablePaginatorComponent, never>;
|
|
54
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SuTablePaginatorComponent, "su-lib-table-paginator", never, { "pagination": { "alias": "pagination"; "required": true; "isSignal": true; }; "labels": { "alias": "labels"; "required": true; "isSignal": true; }; "controlId": { "alias": "controlId"; "required": true; "isSignal": true; }; }, { "pageChange": "pageChange"; "pageSizeChange": "pageSizeChange"; }, never, never, true, never>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Where one cell of a pinned column sticks */
|
|
58
|
+
interface SuTablePinPlacement {
|
|
59
|
+
readonly pin: SuTablePin;
|
|
60
|
+
/** The distance from its edge: the width of the pinned cells before it */
|
|
61
|
+
readonly offset: number;
|
|
62
|
+
/** The innermost pinned cell on its side, which casts the shadow over the scrolling cells */
|
|
63
|
+
readonly edge: boolean;
|
|
64
|
+
}
|
|
65
|
+
/** Makes a table cell stick to its edge while the other columns scroll */
|
|
66
|
+
declare class SuTablePinDirective {
|
|
67
|
+
readonly placement: _angular_core.InputSignal<SuTablePinPlacement | null>;
|
|
68
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SuTablePinDirective, never>;
|
|
69
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<SuTablePinDirective, "[suTablePin]", never, { "placement": { "alias": "suTablePin"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** A column's heading pin was shown or hidden from the Columns menu */
|
|
73
|
+
interface SuTablePinnableChange<TRow extends object> {
|
|
74
|
+
readonly key: keyof TRow;
|
|
75
|
+
readonly pinnable: boolean;
|
|
76
|
+
}
|
|
77
|
+
/** A column was shown or hidden from the Columns menu */
|
|
78
|
+
interface SuTableVisibilityChange<TRow extends object> {
|
|
79
|
+
readonly key: keyof TRow;
|
|
80
|
+
readonly visible: boolean;
|
|
81
|
+
}
|
|
82
|
+
/** The bar above a table: the search box, and the Columns button with its menu to show, hide and pin columns */
|
|
83
|
+
declare class SuTableToolbarComponent<TRow extends object> {
|
|
84
|
+
readonly labels: _angular_core.InputSignal<SuTableLabels>;
|
|
85
|
+
/** Prefix for the ids of the controls */
|
|
86
|
+
readonly controlId: _angular_core.InputSignal<string>;
|
|
87
|
+
readonly searchable: _angular_core.InputSignal<boolean>;
|
|
88
|
+
readonly query: _angular_core.InputSignal<string>;
|
|
89
|
+
readonly columnControls: _angular_core.InputSignal<boolean>;
|
|
90
|
+
/** The columns in the order they were set up */
|
|
91
|
+
readonly columns: _angular_core.InputSignal<readonly SuTableColumnState<TRow>[]>;
|
|
92
|
+
readonly queryChange: _angular_core.OutputEmitterRef<string>;
|
|
93
|
+
readonly pinnableChange: _angular_core.OutputEmitterRef<SuTablePinnableChange<TRow>>;
|
|
94
|
+
readonly visibilityChange: _angular_core.OutputEmitterRef<SuTableVisibilityChange<TRow>>;
|
|
95
|
+
/** Every column shown (true), or all hidden but one (false) */
|
|
96
|
+
readonly allVisibilityChange: _angular_core.OutputEmitterRef<boolean>;
|
|
97
|
+
private readonly menu;
|
|
98
|
+
private readonly menuButton;
|
|
99
|
+
protected readonly columnsOpen: _angular_core.WritableSignal<boolean>;
|
|
100
|
+
protected readonly columnQuery: _angular_core.WritableSignal<string>;
|
|
101
|
+
/** The columns matching the menu's search */
|
|
102
|
+
protected readonly listedColumns: _angular_core.Signal<SuTableColumnState<TRow>[]>;
|
|
103
|
+
protected readonly shownCount: _angular_core.Signal<number>;
|
|
104
|
+
protected toggleMenu(): void;
|
|
105
|
+
/** Escape closes the menu and puts focus back on its button */
|
|
106
|
+
protected closeMenu(): void;
|
|
107
|
+
protected closeOutside(event: PointerEvent): void;
|
|
108
|
+
protected onQuery(event: Event): void;
|
|
109
|
+
protected clearQuery(event: Event): void;
|
|
110
|
+
protected onColumnQuery(event: Event): void;
|
|
111
|
+
protected onVisible(key: keyof TRow, event: Event): void;
|
|
112
|
+
protected onAllVisible(event: Event): void;
|
|
113
|
+
/** The pin button shows or hides the column's pin in its heading; that pin is what pins it */
|
|
114
|
+
protected togglePinnable(column: SuTableColumnState<TRow>): void;
|
|
115
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SuTableToolbarComponent<any>, never>;
|
|
116
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SuTableToolbarComponent<any>, "su-lib-table-toolbar", never, { "labels": { "alias": "labels"; "required": true; "isSignal": true; }; "controlId": { "alias": "controlId"; "required": true; "isSignal": true; }; "searchable": { "alias": "searchable"; "required": false; "isSignal": true; }; "query": { "alias": "query"; "required": false; "isSignal": true; }; "columnControls": { "alias": "columnControls"; "required": false; "isSignal": true; }; "columns": { "alias": "columns"; "required": false; "isSignal": true; }; }, { "queryChange": "queryChange"; "pinnableChange": "pinnableChange"; "visibilityChange": "visibilityChange"; "allVisibilityChange": "allVisibilityChange"; }, never, never, true, never>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** The action id the table handles itself: it edits the row inline */
|
|
120
|
+
declare const SU_TABLE_EDIT_ACTION = "edit";
|
|
121
|
+
/** A row action (or a bulk action) was clicked */
|
|
122
|
+
interface SuTableActionEvent<TRow extends object> {
|
|
123
|
+
readonly id: string;
|
|
124
|
+
/** The clicked row, or the selected rows for a bulk action */
|
|
125
|
+
readonly rows: readonly TRow[];
|
|
126
|
+
}
|
|
127
|
+
/** The rows were reordered */
|
|
128
|
+
interface SuTableReorderEvent<TRow extends object> {
|
|
129
|
+
readonly ids: readonly SuTableRowId[];
|
|
130
|
+
/** Every row in its new order */
|
|
131
|
+
readonly rows: readonly TRow[];
|
|
132
|
+
}
|
|
133
|
+
/** The page on screen and how many rows it shows */
|
|
134
|
+
interface SuTablePageEvent {
|
|
135
|
+
/** From 0 */
|
|
136
|
+
readonly page: number;
|
|
137
|
+
readonly pageSize: SuTablePageSize;
|
|
138
|
+
}
|
|
139
|
+
/** A row being dragged with the pointer */
|
|
140
|
+
interface DragState {
|
|
141
|
+
readonly id: SuTableRowId;
|
|
142
|
+
readonly from: number;
|
|
143
|
+
readonly to: number;
|
|
144
|
+
/** Where the pointer went down, in page coordinates */
|
|
145
|
+
readonly startY: number;
|
|
146
|
+
readonly offsetY: number;
|
|
147
|
+
/** The dragged row's height: how far the rows it passes slide to make room */
|
|
148
|
+
readonly height: number;
|
|
149
|
+
/** Every row's vertical middle before the drag, in page coordinates */
|
|
150
|
+
readonly middles: readonly number[];
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* An accessible data table over `SuTableController` from `@su-labs/core/table`: typed columns map the API's rows,
|
|
154
|
+
* with sorting, selection, inline and bulk editing, drag-and-drop and keyboard reordering, row actions and announced
|
|
155
|
+
* changes. Edited rows come out in the API's own shape through `edited`.
|
|
156
|
+
*/
|
|
157
|
+
declare class SuTableComponent<TRow extends object> {
|
|
158
|
+
readonly columns: _angular_core.InputSignal<SuTableColumns<TRow>>;
|
|
159
|
+
readonly rows: _angular_core.InputSignal<readonly TRow[]>;
|
|
160
|
+
/** The table's name for screen readers, shown as its caption */
|
|
161
|
+
readonly caption: _angular_core.InputSignal<string>;
|
|
162
|
+
/** Shows the caption on screen too @default false */
|
|
163
|
+
readonly showCaption: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
164
|
+
/** The row's identity, e.g. the API's id; keeps the selection and edits across new rows */
|
|
165
|
+
readonly rowId: _angular_core.InputSignal<((row: TRow) => SuTableRowId) | undefined>;
|
|
166
|
+
/** Buttons on each row; the `edit` id edits the row inline */
|
|
167
|
+
readonly actions: _angular_core.InputSignal<readonly SuTableAction<TRow>[]>;
|
|
168
|
+
/** Rows can be selected, to edit or act on many at once @default false */
|
|
169
|
+
readonly selectable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
170
|
+
/** Rows can be reordered, by dragging or with the keyboard @default false */
|
|
171
|
+
readonly reorderable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
172
|
+
/** A Columns button with a menu to show or hide columns and the pin in their headings @default false */
|
|
173
|
+
readonly columnControls: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
174
|
+
/** A search box above the table that narrows the rows by their text @default false */
|
|
175
|
+
readonly searchable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
176
|
+
/**
|
|
177
|
+
* The most the table grows before it scrolls inside, any CSS length (e.g. `'28rem'`); the header and the pinned
|
|
178
|
+
* rows stay in view while the rows scroll under them
|
|
179
|
+
*/
|
|
180
|
+
readonly maxHeight: _angular_core.InputSignal<string | undefined>;
|
|
181
|
+
/**
|
|
182
|
+
* Extra classes for a row, e.g. `(user) => (user.active ? null : 'is-muted')`. The table styles `is-muted` and
|
|
183
|
+
* `is-highlighted`; other classes are yours to style
|
|
184
|
+
*/
|
|
185
|
+
readonly rowClass: _angular_core.InputSignal<((row: TRow) => string | null) | undefined>;
|
|
186
|
+
/** A double-click on an editable cell edits its row, starting in that field @default true */
|
|
187
|
+
readonly editOnDoubleClick: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
188
|
+
/** Rows per page; without it, every row shows @default 'all' */
|
|
189
|
+
readonly pageSize: _angular_core.InputSignal<SuTablePageSize | undefined>;
|
|
190
|
+
/** The page sizes people choose from under the table, e.g. `[10, 25, 50, 'all']` */
|
|
191
|
+
readonly pageSizes: _angular_core.InputSignal<readonly SuTablePageSize[]>;
|
|
192
|
+
/** A Pin button on each row, keeping it above the others on every page @default false */
|
|
193
|
+
readonly rowPinning: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
194
|
+
/** The ids of the rows pinned to start with */
|
|
195
|
+
readonly pinnedRows: _angular_core.InputSignal<readonly SuTableRowId[] | undefined>;
|
|
196
|
+
/** Texts to replace, e.g. in the page's language */
|
|
197
|
+
readonly labels: _angular_core.InputSignal<Partial<SuTableLabels>>;
|
|
198
|
+
/** Rows were edited and saved; send them to the API as they are */
|
|
199
|
+
readonly edited: _angular_core.OutputEmitterRef<readonly TRow[]>;
|
|
200
|
+
readonly reordered: _angular_core.OutputEmitterRef<SuTableReorderEvent<TRow>>;
|
|
201
|
+
readonly action: _angular_core.OutputEmitterRef<SuTableActionEvent<TRow>>;
|
|
202
|
+
readonly sortChange: _angular_core.OutputEmitterRef<SuTableSort<TRow> | null>;
|
|
203
|
+
readonly selectionChange: _angular_core.OutputEmitterRef<readonly TRow[]>;
|
|
204
|
+
/** The search changed, after typing paused */
|
|
205
|
+
readonly searchChange: _angular_core.OutputEmitterRef<string>;
|
|
206
|
+
/** The pinned rows changed: their ids, in pin order */
|
|
207
|
+
readonly pinnedRowsChange: _angular_core.OutputEmitterRef<readonly SuTableRowId[]>;
|
|
208
|
+
/** A column was shown, hidden, pinned or unpinned from the Columns menu: every column's state, e.g. to save it */
|
|
209
|
+
readonly columnsChange: _angular_core.OutputEmitterRef<readonly SuTableColumnState<TRow>[]>;
|
|
210
|
+
/** The page or the page size changed */
|
|
211
|
+
readonly pageChange: _angular_core.OutputEmitterRef<SuTablePageEvent>;
|
|
212
|
+
private readonly controller;
|
|
213
|
+
private readonly host;
|
|
214
|
+
private readonly cellTemplates;
|
|
215
|
+
private readonly focusHandleId;
|
|
216
|
+
/** The id of the field to focus once it renders, after a double-click */
|
|
217
|
+
private readonly focusFieldId;
|
|
218
|
+
private searchTimer;
|
|
219
|
+
private readonly headerWidths;
|
|
220
|
+
private readonly scrollerWidth;
|
|
221
|
+
private readonly headerLayout;
|
|
222
|
+
private readonly headerHeight;
|
|
223
|
+
private readonly pinnedRowHeights;
|
|
224
|
+
protected readonly tableId: string;
|
|
225
|
+
protected readonly state: _angular_core.WritableSignal<_su_labs_core_table.SuTableState<TRow>>;
|
|
226
|
+
protected readonly text: _angular_core.Signal<SuTableLabels>;
|
|
227
|
+
protected readonly drag: _angular_core.WritableSignal<DragState | null>;
|
|
228
|
+
protected readonly inlineDraft: _angular_core.Signal<_su_labs_core_table.SuTableDraft<TRow> | null>;
|
|
229
|
+
protected readonly bulkDraft: _angular_core.Signal<_su_labs_core_table.SuTableDraft<TRow> | null>;
|
|
230
|
+
/** The actions column also shows, for Save and Cancel, while a row is edited by double-click */
|
|
231
|
+
protected readonly hasActions: _angular_core.Signal<boolean>;
|
|
232
|
+
/** The pinned rows, then the current page */
|
|
233
|
+
protected readonly bodyRows: _angular_core.Signal<SuTableRowView<TRow>[]>;
|
|
234
|
+
protected readonly scrolledFromStart: _angular_core.WritableSignal<boolean>;
|
|
235
|
+
protected readonly moreAtEnd: _angular_core.WritableSignal<boolean>;
|
|
236
|
+
protected readonly scrolledFromTop: _angular_core.WritableSignal<boolean>;
|
|
237
|
+
/** Where each pinned row sticks: under the header and the pinned rows above it */
|
|
238
|
+
protected readonly pinnedRowTops: _angular_core.Signal<number[]>;
|
|
239
|
+
protected readonly columnSlot: _angular_core.Signal<number>;
|
|
240
|
+
/**
|
|
241
|
+
* Where each header slot sticks, in order: the move handles, the checkboxes, the columns and the actions. The
|
|
242
|
+
* handles and checkboxes stay with columns pinned to the start, the actions with columns pinned to the end.
|
|
243
|
+
* When the pinned cells would leave too little room to scroll the rest (e.g. on a phone), nothing sticks.
|
|
244
|
+
*/
|
|
245
|
+
protected readonly placements: _angular_core.Signal<readonly (SuTablePinPlacement | null)[]>;
|
|
246
|
+
protected readonly columnCount: _angular_core.Signal<number>;
|
|
247
|
+
constructor();
|
|
248
|
+
protected cellTemplate(key: keyof TRow): TemplateRef<SuTableCellContext<object>> | null;
|
|
249
|
+
protected inlineField(key: keyof TRow): SuTableDraftField<TRow> | null;
|
|
250
|
+
protected controlId(id: SuTableRowId, key: keyof TRow): string;
|
|
251
|
+
/** The pin in a heading unpins its column, or pins it back to the side it was set up with (by default the start) */
|
|
252
|
+
protected toggleColumnPin(key: keyof TRow, pinned: SuTablePin | null): void;
|
|
253
|
+
protected setColumnPinnable({ key, pinnable, }: SuTablePinnableChange<TRow>): void;
|
|
254
|
+
protected setColumnsVisible(visible: boolean): void;
|
|
255
|
+
protected setColumnVisible({ key, visible, }: SuTableVisibilityChange<TRow>): void;
|
|
256
|
+
/** Narrows the rows once typing pauses, so each keystroke isn't announced */
|
|
257
|
+
protected search(query: string): void;
|
|
258
|
+
protected onScroll(event: Event): void;
|
|
259
|
+
protected sortBy(key: keyof TRow): void;
|
|
260
|
+
protected select(id: SuTableRowId): void;
|
|
261
|
+
protected selectAll(selected?: boolean): void;
|
|
262
|
+
protected pinRow(id: SuTableRowId): void;
|
|
263
|
+
protected runAction(action: SuTableActionView, row: SuTableRowView<TRow>): void;
|
|
264
|
+
protected runBulkAction(action: SuTableActionView): void;
|
|
265
|
+
protected setPage(page: number): void;
|
|
266
|
+
protected setPageSize(pageSize: SuTablePageSize): void;
|
|
267
|
+
/** Whether a double-click on this cell edits its row */
|
|
268
|
+
protected editsOnDoubleClick(key: keyof TRow): boolean;
|
|
269
|
+
/**
|
|
270
|
+
* Edits the row of a double-clicked cell, starting in its field. While another row (or several) is being edited,
|
|
271
|
+
* only a cell of that same row moves the focus, so unsaved changes are never dropped.
|
|
272
|
+
*/
|
|
273
|
+
protected editCell(row: SuTableRowView<TRow>, key: keyof TRow): void;
|
|
274
|
+
/** The second click of a double-click doesn't select the word under it */
|
|
275
|
+
protected keepTextUnselected(event: MouseEvent, key: keyof TRow): void;
|
|
276
|
+
protected editSelected(): void;
|
|
277
|
+
protected setDraft(key: keyof TRow, value: SuTableInputValue): void;
|
|
278
|
+
protected save(event?: Event): void;
|
|
279
|
+
protected cancelEdit(): void;
|
|
280
|
+
/** Enter saves the row being edited inline (but adds a line in a text area), Escape cancels */
|
|
281
|
+
protected onEditKey(event: KeyboardEvent): void;
|
|
282
|
+
protected onHandleKey(event: KeyboardEvent, id: SuTableRowId): void;
|
|
283
|
+
protected onHandleDown(event: PointerEvent, id: SuTableRowId, index: number): void;
|
|
284
|
+
protected onHandleMove(event: PointerEvent): void;
|
|
285
|
+
protected onHandleUp(): void;
|
|
286
|
+
protected onHandleCancel(): void;
|
|
287
|
+
/** While dragging, the dragged row follows the pointer and the rows it passes slide aside to open its place */
|
|
288
|
+
protected rowClassOf(row: SuTableRowView<TRow>): string | null;
|
|
289
|
+
/** Where the drop line shows while dragging: on the edge of the gap the dragged row will land in */
|
|
290
|
+
protected dropSide(index: number): 'before' | 'after' | null;
|
|
291
|
+
protected dragTransform(index: number): string | null;
|
|
292
|
+
/** Shadows show on the pinned edges only while columns or rows are scrolled under them */
|
|
293
|
+
private updateScrollEdges;
|
|
294
|
+
private emitPage;
|
|
295
|
+
private emitReorder;
|
|
296
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SuTableComponent<any>, never>;
|
|
297
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SuTableComponent<any>, "su-lib-table", never, { "columns": { "alias": "columns"; "required": true; "isSignal": true; }; "rows": { "alias": "rows"; "required": true; "isSignal": true; }; "caption": { "alias": "caption"; "required": true; "isSignal": true; }; "showCaption": { "alias": "showCaption"; "required": false; "isSignal": true; }; "rowId": { "alias": "rowId"; "required": false; "isSignal": true; }; "actions": { "alias": "actions"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; "reorderable": { "alias": "reorderable"; "required": false; "isSignal": true; }; "columnControls": { "alias": "columnControls"; "required": false; "isSignal": true; }; "searchable": { "alias": "searchable"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "rowClass": { "alias": "rowClass"; "required": false; "isSignal": true; }; "editOnDoubleClick": { "alias": "editOnDoubleClick"; "required": false; "isSignal": true; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "pageSizes": { "alias": "pageSizes"; "required": false; "isSignal": true; }; "rowPinning": { "alias": "rowPinning"; "required": false; "isSignal": true; }; "pinnedRows": { "alias": "pinnedRows"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; }, { "edited": "edited"; "reordered": "reordered"; "action": "action"; "sortChange": "sortChange"; "selectionChange": "selectionChange"; "searchChange": "searchChange"; "pinnedRowsChange": "pinnedRowsChange"; "columnsChange": "columnsChange"; "pageChange": "pageChange"; }, ["cellTemplates"], never, true, never>;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export { SU_TABLE_EDIT_ACTION, SuTableCellDirective, SuTableComponent, SuTableFieldComponent, SuTablePaginatorComponent, SuTablePinDirective, SuTableToolbarComponent };
|
|
301
|
+
export type { SuTableActionEvent, SuTableCellContext, SuTablePageEvent, SuTablePinPlacement, SuTablePinnableChange, SuTableReorderEvent, SuTableVisibilityChange };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@su-labs/table",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.1.2",
|
|
4
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
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"url": "https://github.com/Greezaaa/settings-utils-lib/issues"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@angular/common": "^
|
|
36
|
-
"@angular/core": "^
|
|
35
|
+
"@angular/common": "^20.0.0",
|
|
36
|
+
"@angular/core": "^20.0.0"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@su-labs/core": "1.9.0",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { TemplateRef } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
/** What a custom cell template gets: the row (`let-row`) and its formatted text (`let-text="text"`) */
|
|
4
|
-
export interface SuTableCellContext<TRow extends object> {
|
|
5
|
-
readonly $implicit: TRow;
|
|
6
|
-
readonly text: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* A custom cell for one column, in place of its text:
|
|
10
|
-
* `<ng-template suTableCell="status" [suTableCellOf]="users()" let-user>…</ng-template>`.
|
|
11
|
-
* `suTableCellOf` only types `let-user` as the row.
|
|
12
|
-
*/
|
|
13
|
-
export declare class SuTableCellDirective<TRow extends object> {
|
|
14
|
-
/** The column's key */
|
|
15
|
-
readonly key: import("@angular/core").InputSignal<string>;
|
|
16
|
-
/** The table's rows, to type the template's row */
|
|
17
|
-
readonly rowsOf: import("@angular/core").InputSignal<readonly TRow[]>;
|
|
18
|
-
readonly template: TemplateRef<SuTableCellContext<TRow>>;
|
|
19
|
-
static ngTemplateContextGuard<TRow extends object>(_directive: SuTableCellDirective<TRow>, context: unknown): context is SuTableCellContext<TRow>;
|
|
20
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SuTableCellDirective<any>, never>;
|
|
21
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<SuTableCellDirective<any>, "ng-template[suTableCell]", never, { "key": { "alias": "suTableCell"; "required": true; "isSignal": true; }; "rowsOf": { "alias": "suTableCellOf"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
22
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { SuTableDraftField, SuTableInputValue } from '@su-labs/core/table';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
/** The form control of one field being edited, chosen by its editor's input */
|
|
4
|
-
export declare class SuTableFieldComponent<TRow extends object> {
|
|
5
|
-
readonly field: import("@angular/core").InputSignal<SuTableDraftField<TRow>>;
|
|
6
|
-
readonly controlId: import("@angular/core").InputSignal<string>;
|
|
7
|
-
/** The control's name when no visible `<label>` points at it */
|
|
8
|
-
readonly ariaLabel: import("@angular/core").InputSignal<string | null>;
|
|
9
|
-
readonly mixedLabel: import("@angular/core").InputSignal<string>;
|
|
10
|
-
readonly valueChange: import("@angular/core").OutputEmitterRef<SuTableInputValue>;
|
|
11
|
-
protected readonly errorId: import("@angular/core").Signal<string>;
|
|
12
|
-
protected readonly placeholder: import("@angular/core").Signal<string | null>;
|
|
13
|
-
protected onChange(event: Event): void;
|
|
14
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SuTableFieldComponent<any>, never>;
|
|
15
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SuTableFieldComponent<any>, "su-lib-table-field", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "controlId": { "alias": "controlId"; "required": true; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "mixedLabel": { "alias": "mixedLabel"; "required": true; "isSignal": true; }; }, { "valueChange": "valueChange"; }, never, never, true, never>;
|
|
16
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { SuTableLabels, SuTablePageSize, SuTablePagination } from '@su-labs/core/table';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
/** The page controls under a table: rows per page, the range on screen, and previous and next */
|
|
4
|
-
export declare class SuTablePaginatorComponent {
|
|
5
|
-
readonly pagination: import("@angular/core").InputSignal<SuTablePagination>;
|
|
6
|
-
readonly labels: import("@angular/core").InputSignal<SuTableLabels>;
|
|
7
|
-
readonly controlId: import("@angular/core").InputSignal<string>;
|
|
8
|
-
readonly pageChange: import("@angular/core").OutputEmitterRef<number>;
|
|
9
|
-
readonly pageSizeChange: import("@angular/core").OutputEmitterRef<SuTablePageSize>;
|
|
10
|
-
/** The buttons stay focusable at the first and last page (`aria-disabled`), so focus isn't lost on the way */
|
|
11
|
-
protected turn(page: number): void;
|
|
12
|
-
protected onPageSize(event: Event): void;
|
|
13
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SuTablePaginatorComponent, never>;
|
|
14
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SuTablePaginatorComponent, "su-lib-table-paginator", never, { "pagination": { "alias": "pagination"; "required": true; "isSignal": true; }; "labels": { "alias": "labels"; "required": true; "isSignal": true; }; "controlId": { "alias": "controlId"; "required": true; "isSignal": true; }; }, { "pageChange": "pageChange"; "pageSizeChange": "pageSizeChange"; }, never, never, true, never>;
|
|
15
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as i0 from "@angular/core";
|
|
2
|
-
/** The pin drawn on pinned columns and pin buttons: `<svg suTablePinIcon></svg>` */
|
|
3
|
-
export declare class SuTablePinIconComponent {
|
|
4
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SuTablePinIconComponent, never>;
|
|
5
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SuTablePinIconComponent, "svg[suTablePinIcon]", never, {}, {}, never, never, true, never>;
|
|
6
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { SuTablePin } from '@su-labs/core/table';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
/** Where one cell of a pinned column sticks */
|
|
4
|
-
export interface SuTablePinPlacement {
|
|
5
|
-
readonly pin: SuTablePin;
|
|
6
|
-
/** The distance from its edge: the width of the pinned cells before it */
|
|
7
|
-
readonly offset: number;
|
|
8
|
-
/** The innermost pinned cell on its side, which casts the shadow over the scrolling cells */
|
|
9
|
-
readonly edge: boolean;
|
|
10
|
-
}
|
|
11
|
-
/** Makes a table cell stick to its edge while the other columns scroll */
|
|
12
|
-
export declare class SuTablePinDirective {
|
|
13
|
-
readonly placement: import("@angular/core").InputSignal<SuTablePinPlacement | null>;
|
|
14
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SuTablePinDirective, never>;
|
|
15
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<SuTablePinDirective, "[suTablePin]", never, { "placement": { "alias": "suTablePin"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
16
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { SuTableColumnState, SuTableLabels } from '@su-labs/core/table';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
/** A column's heading pin was shown or hidden from the Columns menu */
|
|
4
|
-
export interface SuTablePinnableChange<TRow extends object> {
|
|
5
|
-
readonly key: keyof TRow;
|
|
6
|
-
readonly pinnable: boolean;
|
|
7
|
-
}
|
|
8
|
-
/** A column was shown or hidden from the Columns menu */
|
|
9
|
-
export interface SuTableVisibilityChange<TRow extends object> {
|
|
10
|
-
readonly key: keyof TRow;
|
|
11
|
-
readonly visible: boolean;
|
|
12
|
-
}
|
|
13
|
-
/** The bar above a table: the search box, and the Columns button with its menu to show, hide and pin columns */
|
|
14
|
-
export declare class SuTableToolbarComponent<TRow extends object> {
|
|
15
|
-
readonly labels: import("@angular/core").InputSignal<SuTableLabels>;
|
|
16
|
-
/** Prefix for the ids of the controls */
|
|
17
|
-
readonly controlId: import("@angular/core").InputSignal<string>;
|
|
18
|
-
readonly searchable: import("@angular/core").InputSignal<boolean>;
|
|
19
|
-
readonly query: import("@angular/core").InputSignal<string>;
|
|
20
|
-
readonly columnControls: import("@angular/core").InputSignal<boolean>;
|
|
21
|
-
/** The columns in the order they were set up */
|
|
22
|
-
readonly columns: import("@angular/core").InputSignal<readonly SuTableColumnState<TRow>[]>;
|
|
23
|
-
readonly queryChange: import("@angular/core").OutputEmitterRef<string>;
|
|
24
|
-
readonly pinnableChange: import("@angular/core").OutputEmitterRef<SuTablePinnableChange<TRow>>;
|
|
25
|
-
readonly visibilityChange: import("@angular/core").OutputEmitterRef<SuTableVisibilityChange<TRow>>;
|
|
26
|
-
/** Every column shown (true), or all hidden but one (false) */
|
|
27
|
-
readonly allVisibilityChange: import("@angular/core").OutputEmitterRef<boolean>;
|
|
28
|
-
private readonly menu;
|
|
29
|
-
private readonly menuButton;
|
|
30
|
-
protected readonly columnsOpen: import("@angular/core").WritableSignal<boolean>;
|
|
31
|
-
protected readonly columnQuery: import("@angular/core").WritableSignal<string>;
|
|
32
|
-
/** The columns matching the menu's search */
|
|
33
|
-
protected readonly listedColumns: import("@angular/core").Signal<SuTableColumnState<TRow>[]>;
|
|
34
|
-
protected readonly shownCount: import("@angular/core").Signal<number>;
|
|
35
|
-
protected toggleMenu(): void;
|
|
36
|
-
/** Escape closes the menu and puts focus back on its button */
|
|
37
|
-
protected closeMenu(): void;
|
|
38
|
-
protected closeOutside(event: PointerEvent): void;
|
|
39
|
-
protected onQuery(event: Event): void;
|
|
40
|
-
protected clearQuery(event: Event): void;
|
|
41
|
-
protected onColumnQuery(event: Event): void;
|
|
42
|
-
protected onVisible(key: keyof TRow, event: Event): void;
|
|
43
|
-
protected onAllVisible(event: Event): void;
|
|
44
|
-
/** The pin button shows or hides the column's pin in its heading; that pin is what pins it */
|
|
45
|
-
protected togglePinnable(column: SuTableColumnState<TRow>): void;
|
|
46
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SuTableToolbarComponent<any>, never>;
|
|
47
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SuTableToolbarComponent<any>, "su-lib-table-toolbar", never, { "labels": { "alias": "labels"; "required": true; "isSignal": true; }; "controlId": { "alias": "controlId"; "required": true; "isSignal": true; }; "searchable": { "alias": "searchable"; "required": false; "isSignal": true; }; "query": { "alias": "query"; "required": false; "isSignal": true; }; "columnControls": { "alias": "columnControls"; "required": false; "isSignal": true; }; "columns": { "alias": "columns"; "required": false; "isSignal": true; }; }, { "queryChange": "queryChange"; "pinnableChange": "pinnableChange"; "visibilityChange": "visibilityChange"; "allVisibilityChange": "allVisibilityChange"; }, never, never, true, never>;
|
|
48
|
-
}
|