@sneat/datagrid 0.27.20 → 0.27.21
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 +65 -0
- package/fesm2022/sneat-datagrid.mjs +174 -84
- package/fesm2022/sneat-datagrid.mjs.map +1 -1
- package/package.json +1 -1
- package/tsconfig.lib.prod.tsbuildinfo +1 -1
- package/types/sneat-datagrid.d.ts +57 -25
|
@@ -3,30 +3,27 @@ import { AfterViewInit, OnChanges, ElementRef, EventEmitter, SimpleChanges } fro
|
|
|
3
3
|
import { RowContextMenuSignature, ColumnDefinition, Options } from 'tabulator-tables';
|
|
4
4
|
import { IGridColumn } from '@sneat/grid';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
interface IForeignKey {
|
|
17
|
-
name: string;
|
|
18
|
-
columns: string[];
|
|
19
|
-
refTable: ITableRef;
|
|
6
|
+
/**
|
|
7
|
+
* A marker rendered unobtrusively in a column's header, e.g. to flag a
|
|
8
|
+
* semantically-recognised field (a declared or inferred `CustomerId`, etc).
|
|
9
|
+
* The grid has no semantic logic of its own — it only renders what the
|
|
10
|
+
* consumer passes here.
|
|
11
|
+
*/
|
|
12
|
+
interface IDataGridColumnMarker {
|
|
13
|
+
readonly label: string;
|
|
14
|
+
readonly title?: string;
|
|
15
|
+
readonly kind?: 'declared' | 'inferred';
|
|
20
16
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
/** Payload emitted by {@link DataGridComponent.cellSelected}. */
|
|
18
|
+
interface IDataGridCellSelectedEvent {
|
|
19
|
+
readonly row: unknown;
|
|
20
|
+
readonly column: {
|
|
21
|
+
readonly field: string;
|
|
22
|
+
readonly index: number;
|
|
23
|
+
};
|
|
24
|
+
readonly value: unknown;
|
|
25
|
+
readonly rowData: unknown;
|
|
28
26
|
}
|
|
29
|
-
|
|
30
27
|
/**
|
|
31
28
|
* This is a wrapper class for the tabulator JS library.
|
|
32
29
|
* For more info see http://tabulator.info
|
|
@@ -50,6 +47,29 @@ declare class DataGridComponent implements AfterViewInit, OnChanges {
|
|
|
50
47
|
row: unknown;
|
|
51
48
|
event?: Event;
|
|
52
49
|
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Enables Tabulator's cell/range selection (opt-in; off by default so
|
|
52
|
+
* existing consumers are unaffected). Mirrors Tabulator's own
|
|
53
|
+
* `selectableRange` option: `true` for unlimited ranges, or a number to
|
|
54
|
+
* cap how many ranges can be selected at once. Mutually exclusive with
|
|
55
|
+
* row selection (`selectable`) — Tabulator disables range selection and
|
|
56
|
+
* logs a console warning if both are set.
|
|
57
|
+
*/
|
|
58
|
+
selectableRange?: boolean | number;
|
|
59
|
+
/**
|
|
60
|
+
* Small, unobtrusive markers rendered in column headers, keyed by field.
|
|
61
|
+
* The grid applies no semantic meaning to these — it only renders what
|
|
62
|
+
* the consumer passes (e.g. a semantic-detection layer flagging a
|
|
63
|
+
* `CustomerId` column).
|
|
64
|
+
*/
|
|
65
|
+
columnMarkers?: Record<string, IDataGridColumnMarker>;
|
|
66
|
+
/**
|
|
67
|
+
* Emitted when a single cell becomes the active selection, either via a
|
|
68
|
+
* mouse click (always, regardless of `selectableRange`) or, once
|
|
69
|
+
* `selectableRange` is enabled, via keyboard arrow-key navigation between
|
|
70
|
+
* cells. Not emitted for multi-cell range drag-selection.
|
|
71
|
+
*/
|
|
72
|
+
readonly cellSelected: EventEmitter<IDataGridCellSelectedEvent>;
|
|
53
73
|
private tabulator?;
|
|
54
74
|
selectable?: boolean | number | 'highlight';
|
|
55
75
|
private tabulatorOptions?;
|
|
@@ -58,13 +78,25 @@ declare class DataGridComponent implements AfterViewInit, OnChanges {
|
|
|
58
78
|
ngAfterViewInit(): void;
|
|
59
79
|
private drawTable;
|
|
60
80
|
private createTabulatorGrid;
|
|
81
|
+
/** column.index is the field's position in the `columns` input array. */
|
|
82
|
+
private emitCellSelected;
|
|
83
|
+
private handleRangeChanged;
|
|
84
|
+
private buildColumnDefinitions;
|
|
85
|
+
/**
|
|
86
|
+
* Renders the column's title text plus an unobtrusive marker badge.
|
|
87
|
+
* Inline styles (rather than a stylesheet) keep this correct regardless
|
|
88
|
+
* of the host app's CSS and Angular's view encapsulation — Tabulator
|
|
89
|
+
* renders headers into plain DOM nodes outside the component's template,
|
|
90
|
+
* which emulated encapsulation would not otherwise scope styles onto.
|
|
91
|
+
*/
|
|
92
|
+
private buildColumnMarkerTitleFormatter;
|
|
61
93
|
private setTabulatorOptions;
|
|
62
94
|
static ɵfac: i0.ɵɵFactoryDeclaration<DataGridComponent, never>;
|
|
63
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DataGridComponent, "sneat-datagrid", never, { "layout": { "alias": "layout"; "required": false; }; "data": { "alias": "data"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; "groupBy": { "alias": "groupBy"; "required": false; }; "height": { "alias": "height"; "required": false; }; "maxHeight": { "alias": "maxHeight"; "required": false; }; "rowContextMenu": { "alias": "rowContextMenu"; "required": false; }; "rowClick": { "alias": "rowClick"; "required": false; }; "selectable": { "alias": "selectable"; "required": false; }; }, { "rowSelected": "rowSelected"; "rowDeselected": "rowDeselected"; }, never, never, true, never>;
|
|
95
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DataGridComponent, "sneat-datagrid", never, { "layout": { "alias": "layout"; "required": false; }; "data": { "alias": "data"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; "groupBy": { "alias": "groupBy"; "required": false; }; "height": { "alias": "height"; "required": false; }; "maxHeight": { "alias": "maxHeight"; "required": false; }; "rowContextMenu": { "alias": "rowContextMenu"; "required": false; }; "rowClick": { "alias": "rowClick"; "required": false; }; "selectableRange": { "alias": "selectableRange"; "required": false; }; "columnMarkers": { "alias": "columnMarkers"; "required": false; }; "selectable": { "alias": "selectable"; "required": false; }; }, { "rowSelected": "rowSelected"; "rowDeselected": "rowDeselected"; "cellSelected": "cellSelected"; }, never, never, true, never>;
|
|
64
96
|
}
|
|
65
97
|
|
|
66
98
|
type TabulatorColumn = ColumnDefinition;
|
|
67
99
|
type TabulatorOptions = Options;
|
|
68
100
|
|
|
69
|
-
export {
|
|
70
|
-
export type { TabulatorColumn, TabulatorOptions };
|
|
101
|
+
export { DataGridComponent };
|
|
102
|
+
export type { IDataGridCellSelectedEvent, IDataGridColumnMarker, TabulatorColumn, TabulatorOptions };
|