@one-grid-core/angular 0.5.2 → 0.5.3
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 -1
- package/esm2022/lib/components/one-grid/one-grid.component.mjs +102 -20
- package/esm2022/lib/core/instants/one-grid-api.class.mjs +78 -9
- package/esm2022/lib/core/models/one-column-def-types.model.mjs +1 -1
- package/esm2022/lib/core/models/one-event-types.model.mjs +1 -1
- package/esm2022/lib/core/services/og-column.service.mjs +11 -1
- package/esm2022/lib/helpers/one-row-grouping.helper.mjs +14 -4
- package/fesm2022/one-grid-core-angular.mjs +204 -33
- package/fesm2022/one-grid-core-angular.mjs.map +1 -1
- package/lib/components/one-grid/one-grid.component.d.ts +43 -0
- package/lib/core/instants/one-grid-api.class.d.ts +27 -4
- package/lib/core/models/one-column-def-types.model.d.ts +4 -0
- package/lib/core/models/one-event-types.model.d.ts +13 -0
- package/lib/core/services/og-column.service.d.ts +8 -0
- package/lib/helpers/one-row-grouping.helper.d.ts +7 -1
- package/package.json +1 -1
|
@@ -177,9 +177,52 @@ export declare class OneGridComponent<T> implements OnInit, OnChanges, AfterView
|
|
|
177
177
|
protected bodyScrollLeft: number;
|
|
178
178
|
private _oneRowNumberColumnDef;
|
|
179
179
|
private subscriptions;
|
|
180
|
+
/**
|
|
181
|
+
* Row grouping, as the grid sees it.
|
|
182
|
+
*
|
|
183
|
+
* The three `_host*` fields hold what was bound before grouping touched
|
|
184
|
+
* anything, because grouping is reversible: turn it off and the columns,
|
|
185
|
+
* the group column and the grid type all have to go back to what the host
|
|
186
|
+
* asked for. `_appliedGroupFields` is the grouping the registered columns
|
|
187
|
+
* currently reflect — the row model's copy lives in `api.rowGroupFields`.
|
|
188
|
+
*/
|
|
189
|
+
private _hostColumnDefs;
|
|
190
|
+
private _hostAutoGroupColumnDef;
|
|
191
|
+
private _hostGridType;
|
|
192
|
+
private _hostTreeData;
|
|
193
|
+
private _appliedGroupFields;
|
|
180
194
|
constructor(api: OneGridApi, eventService: OneGridEventService, elementRef: ElementRef, cdr: ChangeDetectorRef);
|
|
181
195
|
ngOnChanges(changes: SimpleChanges): void;
|
|
182
196
|
ngOnInit(): void;
|
|
197
|
+
/**
|
|
198
|
+
* The group column: host-tuned through `autoGroupColumnDef`, but its field
|
|
199
|
+
* is always the synthetic label — that is where a group row carries its
|
|
200
|
+
* display value — and it always carries the marker the tree machinery keys
|
|
201
|
+
* on, which is what puts the expander on this column.
|
|
202
|
+
*/
|
|
203
|
+
private buildAutoGroupColumnDef;
|
|
204
|
+
/**
|
|
205
|
+
* The host's columns with the grouped-by ones hidden.
|
|
206
|
+
*
|
|
207
|
+
* A grouped-by column's value is on the group row; showing the flat column
|
|
208
|
+
* too repeats it down every leaf. Hidden, not removed — the host can bring
|
|
209
|
+
* one back with `api.setColumnVisible`, and ungrouping restores whatever
|
|
210
|
+
* visibility the host itself declared.
|
|
211
|
+
*/
|
|
212
|
+
private groupedColumnDefs;
|
|
213
|
+
/** The columns the grid registers: row numbers, the group column, the host's. */
|
|
214
|
+
private columnStack;
|
|
215
|
+
/**
|
|
216
|
+
* Re-plumb everything grouping owns outside the row model: tree mode, the
|
|
217
|
+
* children field, the group column, and which of the host's columns are
|
|
218
|
+
* hidden because their value now shows on a group row.
|
|
219
|
+
*
|
|
220
|
+
* Driven by `rowGroupingChanged`, so a host regroups through one call —
|
|
221
|
+
* `api.setRowGrouping(['country', 'city'])` — instead of re-creating the
|
|
222
|
+
* grid. Grouping and host tree data are mutually exclusive, which the API
|
|
223
|
+
* enforces, so this only ever switches a tree that grouping itself built.
|
|
224
|
+
*/
|
|
225
|
+
private applyRowGroupingColumns;
|
|
183
226
|
ngAfterViewInit(): void;
|
|
184
227
|
/**
|
|
185
228
|
* Handle Body Scroll Event
|
|
@@ -46,11 +46,25 @@ export declare class OneGridApi<T = any> {
|
|
|
46
46
|
private _quickFilterValue;
|
|
47
47
|
private _activeFilters;
|
|
48
48
|
private _visibleRowNodes;
|
|
49
|
+
/**
|
|
50
|
+
* The rows as the host last handed them over — before grouping folded
|
|
51
|
+
* them. Grouping is a transform on the way in, so this is what a change of
|
|
52
|
+
* grouping re-folds, and it is why regrouping keeps the host's row order
|
|
53
|
+
* instead of inheriting the order the previous grouping happened to leave.
|
|
54
|
+
*/
|
|
55
|
+
private _sourceRows;
|
|
49
56
|
private readonly _pinnedRowNodes;
|
|
50
57
|
private _originalRowNodes;
|
|
51
58
|
private _nodeCleanupMap;
|
|
52
59
|
private _destroyed;
|
|
53
60
|
private treeData;
|
|
61
|
+
/**
|
|
62
|
+
* Whether the *host* declared tree data, as opposed to grouping having
|
|
63
|
+
* turned tree mode on. `treeData` above answers "is this a tree right now",
|
|
64
|
+
* which grouping flips; this answers "whose tree is it", which decides
|
|
65
|
+
* whether grouping may touch it at all.
|
|
66
|
+
*/
|
|
67
|
+
private _hostTreeData;
|
|
54
68
|
private treeDataChildrenField;
|
|
55
69
|
private groupDefaultExpanded;
|
|
56
70
|
private masterDetail;
|
|
@@ -324,10 +338,19 @@ export declare class OneGridApi<T = any> {
|
|
|
324
338
|
/** The fields the rows are grouped by, in nesting order. Empty when off. */
|
|
325
339
|
get rowGroupFields(): readonly string[];
|
|
326
340
|
/**
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
341
|
+
* Group the rows by these fields, in nesting order — or ungroup by passing
|
|
342
|
+
* an empty array.
|
|
343
|
+
*
|
|
344
|
+
* `OneGridComponent` calls this once for the column definitions that
|
|
345
|
+
* declare `rowGroup`; hosts call it to regroup afterwards. Either way the
|
|
346
|
+
* grid re-plumbs itself around the new grouping — tree mode, the auto group
|
|
347
|
+
* column, the visibility of the grouped-by columns — and folds the rows it
|
|
348
|
+
* already holds again, so nothing has to be rebound and no grid has to be
|
|
349
|
+
* torn down and re-created to group by a different column.
|
|
350
|
+
*
|
|
351
|
+
* `aggregations` defaults to the `aggFunc` columns currently registered, so
|
|
352
|
+
* `setRowGrouping(['country'])` keeps the totals the column definitions
|
|
353
|
+
* already describe.
|
|
331
354
|
*/
|
|
332
355
|
setRowGrouping(groupFields: string[], aggregations?: OneAggColumn<T>[]): void;
|
|
333
356
|
private _undoLimit;
|
|
@@ -192,6 +192,10 @@ export interface OneColumnDef<T = any> {
|
|
|
192
192
|
* hidden automatically (their value shows on the group row); un-hide via
|
|
193
193
|
* `api.setColumnVisible` if you want both. Client-side rows only, and
|
|
194
194
|
* exclusive with `treeData` and `masterDetail`.
|
|
195
|
+
*
|
|
196
|
+
* This is the *initial* grouping, read when the grid initialises; needs a
|
|
197
|
+
* `field` to group on. `api.setRowGrouping(fields)` changes it afterwards
|
|
198
|
+
* — any columns, in any nesting order, `[]` to ungroup.
|
|
195
199
|
*/
|
|
196
200
|
rowGroup?: boolean;
|
|
197
201
|
/**
|
|
@@ -101,6 +101,18 @@ export interface RowOrderChangedEvent<T = any> {
|
|
|
101
101
|
fromIndex: number;
|
|
102
102
|
toIndex: number;
|
|
103
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* The grouping changed through `api.setRowGrouping` — including the call the
|
|
106
|
+
* grid makes itself for the `rowGroup` column definitions when it starts.
|
|
107
|
+
*
|
|
108
|
+
* Carries the fields in nesting order, empty when grouping was turned off,
|
|
109
|
+
* and the ones that were in force before, so a listener can tell what the
|
|
110
|
+
* change actually was.
|
|
111
|
+
*/
|
|
112
|
+
export interface RowGroupingChangedEvent {
|
|
113
|
+
groupFields: readonly string[];
|
|
114
|
+
previousGroupFields: readonly string[];
|
|
115
|
+
}
|
|
104
116
|
export interface EventPayloadMap<T = any> {
|
|
105
117
|
rowSelected: RowSelectedEvent;
|
|
106
118
|
cellClicked: CellClickedEvent;
|
|
@@ -114,6 +126,7 @@ export interface EventPayloadMap<T = any> {
|
|
|
114
126
|
rowOrderChanged: RowOrderChangedEvent<T>;
|
|
115
127
|
cellStateChanged: CellStateChangedEvent<T>;
|
|
116
128
|
cellValueChanged: CellValueChangedEvent<T>;
|
|
129
|
+
rowGroupingChanged: RowGroupingChangedEvent;
|
|
117
130
|
}
|
|
118
131
|
export type OneCheckboxState = 'checked' | 'unchecked' | 'indeterminate';
|
|
119
132
|
export type RowSelectionMode = 'single' | 'multiple' | null;
|
|
@@ -19,6 +19,14 @@ export declare class OgColumnService {
|
|
|
19
19
|
private columnDefs$;
|
|
20
20
|
private groupColumnDefs$;
|
|
21
21
|
initColumnDefs(defaultColumnDef: OneColumnDef, columnDefs: OneColumnDef[], groupColumnDefs: OneGroupColumnDef[], context?: unknown): void;
|
|
22
|
+
/**
|
|
23
|
+
* Every registered column, hidden ones included, in display order.
|
|
24
|
+
*
|
|
25
|
+
* `getColumnState` answers what is on screen; this answers what the grid
|
|
26
|
+
* knows about — which is what anything reading a column's *configuration*
|
|
27
|
+
* (an `aggFunc`, say) needs, since hiding a column does not unconfigure it.
|
|
28
|
+
*/
|
|
29
|
+
getAllColumnDefs(): readonly OneColumnDef[];
|
|
22
30
|
getColumnState(): ColumnChangedEvent;
|
|
23
31
|
setGroupColumnDefs(groupColumnDefs: OneGroupColumnDef[]): void;
|
|
24
32
|
setColumnDefs(columnDefs: OneColumnDef[]): void;
|
|
@@ -14,7 +14,13 @@ export interface OneAggColumn<T = any> {
|
|
|
14
14
|
field: string;
|
|
15
15
|
aggFunc: OneAggFunc<T>;
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* The `rowGroup` fields of a column set, in definition order.
|
|
19
|
+
*
|
|
20
|
+
* Grouping keys on a row's own field, so a column that asks to group without
|
|
21
|
+
* one has nothing to group by — it is dropped, but not silently: that is a
|
|
22
|
+
* definition that reads as if it works.
|
|
23
|
+
*/
|
|
18
24
|
export declare function rowGroupFields<T>(columns: readonly OneColumnDef<T>[]): string[];
|
|
19
25
|
/** The `aggFunc` columns of a column set. */
|
|
20
26
|
export declare function aggColumns<T>(columns: readonly OneColumnDef<T>[]): OneAggColumn<T>[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@one-grid-core/angular",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "OneGrid — a feature-rich Angular data grid component with tree data, master/detail, editing, selection, pagination, and virtual scrolling.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|