@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.
@@ -1,187 +0,0 @@
1
- import { TemplateRef } from '@angular/core';
2
- import { SuTableAction, SuTableActionView, SuTableColumns, SuTableColumnState, SuTableDraftField, SuTableInputValue, SuTableLabels, SuTablePageSize, SuTablePin, SuTableRowId, SuTableRowView, SuTableSort } from '@su-labs/core/table';
3
- import { SuTableCellContext } from './table-cell.directive';
4
- import { SuTablePinPlacement } from './table-pin.directive';
5
- import { SuTablePinnableChange, SuTableVisibilityChange } from './table-toolbar.component';
6
- import * as i0 from "@angular/core";
7
- /** The action id the table handles itself: it edits the row inline */
8
- export declare const SU_TABLE_EDIT_ACTION = "edit";
9
- /** A row action (or a bulk action) was clicked */
10
- export interface SuTableActionEvent<TRow extends object> {
11
- readonly id: string;
12
- /** The clicked row, or the selected rows for a bulk action */
13
- readonly rows: readonly TRow[];
14
- }
15
- /** The rows were reordered */
16
- export interface SuTableReorderEvent<TRow extends object> {
17
- readonly ids: readonly SuTableRowId[];
18
- /** Every row in its new order */
19
- readonly rows: readonly TRow[];
20
- }
21
- /** The page on screen and how many rows it shows */
22
- export interface SuTablePageEvent {
23
- /** From 0 */
24
- readonly page: number;
25
- readonly pageSize: SuTablePageSize;
26
- }
27
- /** A row being dragged with the pointer */
28
- interface DragState {
29
- readonly id: SuTableRowId;
30
- readonly from: number;
31
- readonly to: number;
32
- /** Where the pointer went down, in page coordinates */
33
- readonly startY: number;
34
- readonly offsetY: number;
35
- /** The dragged row's height: how far the rows it passes slide to make room */
36
- readonly height: number;
37
- /** Every row's vertical middle before the drag, in page coordinates */
38
- readonly middles: readonly number[];
39
- }
40
- /**
41
- * An accessible data table over `SuTableController` from `@su-labs/core/table`: typed columns map the API's rows,
42
- * with sorting, selection, inline and bulk editing, drag-and-drop and keyboard reordering, row actions and announced
43
- * changes. Edited rows come out in the API's own shape through `edited`.
44
- */
45
- export declare class SuTableComponent<TRow extends object> {
46
- readonly columns: import("@angular/core").InputSignal<SuTableColumns<TRow>>;
47
- readonly rows: import("@angular/core").InputSignal<readonly TRow[]>;
48
- /** The table's name for screen readers, shown as its caption */
49
- readonly caption: import("@angular/core").InputSignal<string>;
50
- /** Shows the caption on screen too @default false */
51
- readonly showCaption: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
52
- /** The row's identity, e.g. the API's id; keeps the selection and edits across new rows */
53
- readonly rowId: import("@angular/core").InputSignal<((row: TRow) => SuTableRowId) | undefined>;
54
- /** Buttons on each row; the `edit` id edits the row inline */
55
- readonly actions: import("@angular/core").InputSignal<readonly SuTableAction<TRow>[]>;
56
- /** Rows can be selected, to edit or act on many at once @default false */
57
- readonly selectable: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
58
- /** Rows can be reordered, by dragging or with the keyboard @default false */
59
- readonly reorderable: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
60
- /** A Columns button with a menu to show or hide columns and the pin in their headings @default false */
61
- readonly columnControls: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
62
- /** A search box above the table that narrows the rows by their text @default false */
63
- readonly searchable: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
64
- /**
65
- * The most the table grows before it scrolls inside, any CSS length (e.g. `'28rem'`); the header and the pinned
66
- * rows stay in view while the rows scroll under them
67
- */
68
- readonly maxHeight: import("@angular/core").InputSignal<string | undefined>;
69
- /**
70
- * Extra classes for a row, e.g. `(user) => (user.active ? null : 'is-muted')`. The table styles `is-muted` and
71
- * `is-highlighted`; other classes are yours to style
72
- */
73
- readonly rowClass: import("@angular/core").InputSignal<((row: TRow) => string | null) | undefined>;
74
- /** A double-click on an editable cell edits its row, starting in that field @default true */
75
- readonly editOnDoubleClick: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
76
- /** Rows per page; without it, every row shows @default 'all' */
77
- readonly pageSize: import("@angular/core").InputSignal<SuTablePageSize | undefined>;
78
- /** The page sizes people choose from under the table, e.g. `[10, 25, 50, 'all']` */
79
- readonly pageSizes: import("@angular/core").InputSignal<readonly SuTablePageSize[]>;
80
- /** A Pin button on each row, keeping it above the others on every page @default false */
81
- readonly rowPinning: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
82
- /** The ids of the rows pinned to start with */
83
- readonly pinnedRows: import("@angular/core").InputSignal<readonly SuTableRowId[] | undefined>;
84
- /** Texts to replace, e.g. in the page's language */
85
- readonly labels: import("@angular/core").InputSignal<Partial<SuTableLabels>>;
86
- /** Rows were edited and saved; send them to the API as they are */
87
- readonly edited: import("@angular/core").OutputEmitterRef<readonly TRow[]>;
88
- readonly reordered: import("@angular/core").OutputEmitterRef<SuTableReorderEvent<TRow>>;
89
- readonly action: import("@angular/core").OutputEmitterRef<SuTableActionEvent<TRow>>;
90
- readonly sortChange: import("@angular/core").OutputEmitterRef<SuTableSort<TRow> | null>;
91
- readonly selectionChange: import("@angular/core").OutputEmitterRef<readonly TRow[]>;
92
- /** The search changed, after typing paused */
93
- readonly searchChange: import("@angular/core").OutputEmitterRef<string>;
94
- /** The pinned rows changed: their ids, in pin order */
95
- readonly pinnedRowsChange: import("@angular/core").OutputEmitterRef<readonly SuTableRowId[]>;
96
- /** A column was shown, hidden, pinned or unpinned from the Columns menu: every column's state, e.g. to save it */
97
- readonly columnsChange: import("@angular/core").OutputEmitterRef<readonly SuTableColumnState<TRow>[]>;
98
- /** The page or the page size changed */
99
- readonly pageChange: import("@angular/core").OutputEmitterRef<SuTablePageEvent>;
100
- private readonly controller;
101
- private readonly host;
102
- private readonly cellTemplates;
103
- private readonly focusHandleId;
104
- /** The id of the field to focus once it renders, after a double-click */
105
- private readonly focusFieldId;
106
- private searchTimer;
107
- private readonly headerWidths;
108
- private readonly scrollerWidth;
109
- private readonly headerLayout;
110
- private readonly headerHeight;
111
- private readonly pinnedRowHeights;
112
- protected readonly tableId: string;
113
- protected readonly state: import("@angular/core").WritableSignal<import("@su-labs/core/table").SuTableState<TRow>>;
114
- protected readonly text: import("@angular/core").Signal<SuTableLabels>;
115
- protected readonly drag: import("@angular/core").WritableSignal<DragState | null>;
116
- protected readonly inlineDraft: import("@angular/core").Signal<import("@su-labs/core/table").SuTableDraft<TRow> | null>;
117
- protected readonly bulkDraft: import("@angular/core").Signal<import("@su-labs/core/table").SuTableDraft<TRow> | null>;
118
- /** The actions column also shows, for Save and Cancel, while a row is edited by double-click */
119
- protected readonly hasActions: import("@angular/core").Signal<boolean>;
120
- /** The pinned rows, then the current page */
121
- protected readonly bodyRows: import("@angular/core").Signal<SuTableRowView<TRow>[]>;
122
- protected readonly scrolledFromStart: import("@angular/core").WritableSignal<boolean>;
123
- protected readonly moreAtEnd: import("@angular/core").WritableSignal<boolean>;
124
- protected readonly scrolledFromTop: import("@angular/core").WritableSignal<boolean>;
125
- /** Where each pinned row sticks: under the header and the pinned rows above it */
126
- protected readonly pinnedRowTops: import("@angular/core").Signal<number[]>;
127
- protected readonly columnSlot: import("@angular/core").Signal<number>;
128
- /**
129
- * Where each header slot sticks, in order: the move handles, the checkboxes, the columns and the actions. The
130
- * handles and checkboxes stay with columns pinned to the start, the actions with columns pinned to the end.
131
- * When the pinned cells would leave too little room to scroll the rest (e.g. on a phone), nothing sticks.
132
- */
133
- protected readonly placements: import("@angular/core").Signal<readonly (SuTablePinPlacement | null)[]>;
134
- protected readonly columnCount: import("@angular/core").Signal<number>;
135
- constructor();
136
- protected cellTemplate(key: keyof TRow): TemplateRef<SuTableCellContext<object>> | null;
137
- protected inlineField(key: keyof TRow): SuTableDraftField<TRow> | null;
138
- protected controlId(id: SuTableRowId, key: keyof TRow): string;
139
- /** The pin in a heading unpins its column, or pins it back to the side it was set up with (by default the start) */
140
- protected toggleColumnPin(key: keyof TRow, pinned: SuTablePin | null): void;
141
- protected setColumnPinnable({ key, pinnable, }: SuTablePinnableChange<TRow>): void;
142
- protected setColumnsVisible(visible: boolean): void;
143
- protected setColumnVisible({ key, visible, }: SuTableVisibilityChange<TRow>): void;
144
- /** Narrows the rows once typing pauses, so each keystroke isn't announced */
145
- protected search(query: string): void;
146
- protected onScroll(event: Event): void;
147
- protected sortBy(key: keyof TRow): void;
148
- protected select(id: SuTableRowId): void;
149
- protected selectAll(selected?: boolean): void;
150
- protected pinRow(id: SuTableRowId): void;
151
- protected runAction(action: SuTableActionView, row: SuTableRowView<TRow>): void;
152
- protected runBulkAction(action: SuTableActionView): void;
153
- protected setPage(page: number): void;
154
- protected setPageSize(pageSize: SuTablePageSize): void;
155
- /** Whether a double-click on this cell edits its row */
156
- protected editsOnDoubleClick(key: keyof TRow): boolean;
157
- /**
158
- * Edits the row of a double-clicked cell, starting in its field. While another row (or several) is being edited,
159
- * only a cell of that same row moves the focus, so unsaved changes are never dropped.
160
- */
161
- protected editCell(row: SuTableRowView<TRow>, key: keyof TRow): void;
162
- /** The second click of a double-click doesn't select the word under it */
163
- protected keepTextUnselected(event: MouseEvent, key: keyof TRow): void;
164
- protected editSelected(): void;
165
- protected setDraft(key: keyof TRow, value: SuTableInputValue): void;
166
- protected save(event?: Event): void;
167
- protected cancelEdit(): void;
168
- /** Enter saves the row being edited inline (but adds a line in a text area), Escape cancels */
169
- protected onEditKey(event: KeyboardEvent): void;
170
- protected onHandleKey(event: KeyboardEvent, id: SuTableRowId): void;
171
- protected onHandleDown(event: PointerEvent, id: SuTableRowId, index: number): void;
172
- protected onHandleMove(event: PointerEvent): void;
173
- protected onHandleUp(): void;
174
- protected onHandleCancel(): void;
175
- /** While dragging, the dragged row follows the pointer and the rows it passes slide aside to open its place */
176
- protected rowClassOf(row: SuTableRowView<TRow>): string | null;
177
- /** Where the drop line shows while dragging: on the edge of the gap the dragged row will land in */
178
- protected dropSide(index: number): 'before' | 'after' | null;
179
- protected dragTransform(index: number): string | null;
180
- /** Shadows show on the pinned edges only while columns or rows are scrolled under them */
181
- private updateScrollEdges;
182
- private emitPage;
183
- private emitReorder;
184
- static ɵfac: i0.ɵɵFactoryDeclaration<SuTableComponent<any>, never>;
185
- static ɵcmp: i0.ɵɵ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>;
186
- }
187
- export {};
package/public-api.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export { SU_TABLE_LABELS, suCheckboxEditor, suDateEditor, suNumberEditor, suSelectEditor, suTextEditor, } from '@su-labs/core/table';
2
- export type { SuNumberEditorOptions, SuSelectChoice, SuTableAction, SuTableAlign, SuTableColumn, SuTableColumns, SuTableColumnState, SuTableEditor, SuTableInput, SuTableInputAttributes, SuTableInputValue, SuTableLabels, SuTableOption, SuTablePageSize, SuTablePagination, SuTablePin, SuTableRowId, SuTableSort, SuTableSortDirection, SuTextEditorOptions, } from '@su-labs/core/table';
3
- export * from './lib/table-cell.directive';
4
- export * from './lib/table-field.component';
5
- export * from './lib/table-paginator.component';
6
- export * from './lib/table-pin.directive';
7
- export * from './lib/table-toolbar.component';
8
- export * from './lib/table.component';