@one-grid-core/angular 0.5.2 → 0.5.4

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.
@@ -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
@@ -37,6 +37,7 @@ export declare class OneGridRowActionComponent<T> implements OnInit {
37
37
  protected detailActiveExcludeLevels: Set<number>;
38
38
  protected gotoDetailExcludeLevels: Set<number>;
39
39
  protected addNewExcludeLevels: Set<number>;
40
+ protected gotoListExcludeLevels: Set<number>;
40
41
  /**
41
42
  * Accessible names for the action buttons.
42
43
  *
@@ -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
- * Turn row grouping on. Called by `OneGridComponent` when column
328
- * definitions declare `rowGroup`; the grid then behaves as a tree over
329
- * synthetic group rows, and `setRowData` / `updateRowData` keep taking the
330
- * flat rows they always took.
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;
@@ -98,6 +98,7 @@ export interface OneCellRendererParams<T = any> {
98
98
  copyButtonStatus?: OneCellStatus;
99
99
  deleteButtonStatus?: OneCellStatus;
100
100
  gotoListButtonStatus?: OneCellStatus;
101
+ gotoListExcludeLevels?: number[];
101
102
  optionButtonStatus?: OneCellStatus;
102
103
  languageButtonStatus?: OneCellStatus;
103
104
  editButtonStatus?: OneCellStatus;
@@ -192,6 +193,10 @@ export interface OneColumnDef<T = any> {
192
193
  * hidden automatically (their value shows on the group row); un-hide via
193
194
  * `api.setColumnVisible` if you want both. Client-side rows only, and
194
195
  * exclusive with `treeData` and `masterDetail`.
196
+ *
197
+ * This is the *initial* grouping, read when the grid initialises; needs a
198
+ * `field` to group on. `api.setRowGrouping(fields)` changes it afterwards
199
+ * — any columns, in any nesting order, `[]` to ungroup.
195
200
  */
196
201
  rowGroup?: boolean;
197
202
  /**
@@ -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
- /** The `rowGroup` fields of a column set, in definition order. */
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.2",
3
+ "version": "0.5.4",
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",
@@ -57,9 +57,22 @@ $row-drag-indicator-size: 2px !default;
57
57
 
58
58
  // Master / detail
59
59
  //
60
- // The detail area is a continuation of the row that opened it, so it sits
61
- // flush by default. Set this to inset it.
62
- $detail-padding: 0 !default;
60
+ // The inset around a detail row's nested grid one step of the spacing scale
61
+ // (the same 8px as `$cell-item-space`, declared literally because that
62
+ // variable comes later in this file).
63
+ //
64
+ // A gap this size is what separates the nested grid from the master rows above
65
+ // and below it without turning it into a card: it reads as content belonging
66
+ // to its row, and the left inset indents it the way nesting is read everywhere
67
+ // else in the grid. Anything larger starts to float; anything smaller stops
68
+ // registering as deliberate.
69
+ //
70
+ // It costs height. `node.detailRowHeight` is the nested grid's own height, and
71
+ // the block around it is that plus this inset top and bottom, which the body's
72
+ // fixed-`itemSize` virtual scroller cannot see — the same drift an expanded
73
+ // row already causes, 2 × this larger. Set it to `0` for a flush detail area
74
+ // that adds nothing at all.
75
+ $detail-padding: 8px !default;
63
76
 
64
77
  // Cell
65
78
  $cell-height: 30px !default;
@@ -531,17 +544,18 @@ $_og-defaults: (
531
544
  outline-offset: -2px;
532
545
  }
533
546
 
534
- // A detail row is a continuation of the master row above it, not a
535
- // card floating inside the grid, so it sits flush: its left edge
536
- // lines up with the master grid's and it occupies exactly the
537
- // height the API reserved.
547
+ // A detail row belongs to the master row above it, so it is inset
548
+ // rather than boxed: `detail-padding` all round separates it from
549
+ // the rows either side and indents it, and the body background
550
+ // shows through the gap instead of a border or a card surface.
538
551
  //
539
- // That reserved height is the reason the default is 0 rather than
540
- // a taste call. `node.detailRowHeight` is what the grid computes
541
- // for an open row, and the body's virtual-scroll viewport is
542
- // configured with a single fixed `itemSize` any padding here is
543
- // height the scroller cannot see, so it becomes scroll drift on
544
- // top of the drift an expanded row already causes.
552
+ // The inset is the only height this box adds. The nested grid
553
+ // keeps exactly the height the API reserved for it — padding is
554
+ // never taken out of it, which would clip its last row — so the
555
+ // block is `node.detailRowHeight` plus the inset top and bottom.
556
+ // The body's virtual-scroll viewport runs on a single fixed
557
+ // `itemSize` and cannot see any of it; `--one-grid-detail-padding: 0`
558
+ // restores a flush detail area that adds nothing beyond the grid.
545
559
  //
546
560
  // `height: inherit` used to sit here. It resolved to `auto`, since
547
561
  // that is the content wrapper's computed height, so it never did