@masterteam/data-table 0.0.4 → 0.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masterteam/data-table",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Masterteam entity-aware tables and portal renderer for the independent data grid.",
5
5
  "publishConfig": {
6
6
  "directory": "../../../dist/masterteam/data-table",
@@ -15,8 +15,8 @@
15
15
  "@jsverse/transloco": "^8.3.0",
16
16
  "primeng": "21.1.5",
17
17
  "@masterteam/components": "^0.0.335",
18
- "@masterteam/data-grid": "^0.0.3",
19
- "@masterteam/icons": "^0.0.17"
18
+ "@masterteam/icons": "^0.0.17",
19
+ "@masterteam/data-grid": "^0.0.4"
20
20
  },
21
21
  "dependencies": {
22
22
  "tslib": "^2.8.1"
@@ -2,7 +2,7 @@ import * as _angular_core from '@angular/core';
2
2
  import { Signal, TemplateRef } from '@angular/core';
3
3
  import { EntityData, EntityViewType } from '@masterteam/components/entities';
4
4
  import * as _masterteam_data_grid from '@masterteam/data-grid';
5
- import { MtChartCategoryValue, MtCellRendererParams, MtColumnDef, MtExportCellParams, MtGridApi, MtColDef, MtCellRenderer, MtDetailCellRendererParams, MtContextMenuItem, MtGridViewState, MtGridReadyEvent, MtSortModel, MtFilterChangedEvent, MtPaginationChangedEvent, MtRowGroupOpenedEvent, MtSideBarDef, MtRowSelectionOptions, MtStatusBarOptions, MtRowClickedEvent, MtSelectionChangedEvent, MtGetContextMenuItemsParams } from '@masterteam/data-grid';
5
+ import { MtChartCategoryValue, MtCellRendererParams, MtColumnDef, MtExportCellParams, MtGridApi, MtColDef, MtCellRenderer, MtDetailCellRendererParams, MtContextMenuItem, MtRowClassParams, MtGridViewState, MtGridReadyEvent, MtSortModel, MtFilterChangedEvent, MtPaginationChangedEvent, MtRowGroupOpenedEvent, MtSideBarDef, MtRowSelectionOptions, MtStatusBarOptions, MtRowClickedEvent, MtSelectionChangedEvent, MtGetContextMenuItemsParams } from '@masterteam/data-grid';
6
6
  import { TablePrintConfig, TableAction, TableActionShape, ColumnDef } from '@masterteam/components/table';
7
7
  import { Popover } from 'primeng/popover';
8
8
 
@@ -91,6 +91,11 @@ type MtTableTextKey = keyof typeof TEXT;
91
91
  declare class MtTableText {
92
92
  private readonly transloco;
93
93
  readonly language: Signal<string>;
94
+ /**
95
+ * Delivered on the microtask queue: a translation can load synchronously while a template
96
+ * renders (a `transloco` pipe asking for it, e.g. the standard grid's Export / Print
97
+ * buttons), and writing this signal during render throws NG0600.
98
+ */
94
99
  private readonly translationEvents;
95
100
  readonly gridLocale: Signal<Readonly<Record<string, string>>>;
96
101
  text(key: MtTableTextKey): string;
@@ -164,10 +169,20 @@ declare class MtStandardGridComponent<T extends object> {
164
169
  readonly loading: _angular_core.InputSignal<boolean>;
165
170
  /** Grid height in px, or `'auto'` to grow with its rows (the page layout decides). */
166
171
  readonly height: _angular_core.InputSignal<number | "auto">;
172
+ /**
173
+ * Row height in px for a page whose cells stack two lines (mt-table rows grew with their
174
+ * content); the standard 44px when omitted.
175
+ */
176
+ readonly rowHeight: _angular_core.InputSignal<number | undefined>;
167
177
  /** Row checkboxes with the header select-all. */
168
178
  readonly selection: _angular_core.InputSignal<boolean>;
169
179
  /** Export permission: the CSV, Excel and PDF items of the context menu. */
170
180
  readonly exportable: _angular_core.InputSignal<boolean>;
181
+ /**
182
+ * Also show mt-table's Export (Excel) and Print (PDF) buttons above the grid, for the pages
183
+ * that had them in their table caption. They follow `exportable` and `exportFormats`.
184
+ */
185
+ readonly exportButtons: _angular_core.InputSignal<boolean>;
171
186
  readonly exportName: _angular_core.InputSignal<string>;
172
187
  /** The formats the Export menu offers (a narrower export permission). */
173
188
  readonly exportFormats: _angular_core.InputSignal<readonly MtStandardGridExportFormat[]>;
@@ -182,6 +197,21 @@ declare class MtStandardGridComponent<T extends object> {
182
197
  readonly server: _angular_core.InputSignal<MtStandardGridServerPage | null>;
183
198
  /** The pager. A page whose grid scrolls every row inside its own viewport turns it off. */
184
199
  readonly paged: _angular_core.InputSignal<boolean>;
200
+ /**
201
+ * Rows per page when the grid pages its own rows (mt-table's default 10). A server page
202
+ * uses `server.pageSize`; a saved view's page size wins over both.
203
+ */
204
+ readonly pageSize: _angular_core.InputSignal<number>;
205
+ /** Rows that open something on click get the pointer cursor (mt-table's clickable rows). */
206
+ readonly clickableRows: _angular_core.InputSignal<boolean | ((row: T) => boolean)>;
207
+ /**
208
+ * mt-table's `cellClickFilter`: a click on a cell of a pick-list column (status, lookup,
209
+ * user, checkbox: the set-filter columns) filters the grid by that value, and a second
210
+ * click clears it, instead of opening the row.
211
+ */
212
+ readonly cellClickFilter: _angular_core.InputSignal<boolean>;
213
+ /** Extra classes on a row, e.g. a status colour on the whole row or stripes. */
214
+ readonly rowClass: _angular_core.InputSignal<((params: MtRowClassParams<T>) => string | readonly string[] | undefined) | null>;
185
215
  /** A detail row under expandable rows. */
186
216
  readonly detail: _angular_core.InputSignal<MtStandardGridDetail<T> | null>;
187
217
  /** Where the grid sits (e.g. a record path), shown in chart titles; defaults to the label. */
@@ -207,7 +237,7 @@ declare class MtStandardGridComponent<T extends object> {
207
237
  /** Fixed height in px; in `'auto'` mode the grid sizes itself and this is its fallback. */
208
238
  protected readonly gridHeight: _angular_core.Signal<number>;
209
239
  protected readonly standardColumns: _angular_core.Signal<readonly MtColDef<T>[]>;
210
- /** A server page keeps the server's group order; the server supplies the group counts. */
240
+ /** On a server page the server supplies the group counts. */
211
241
  protected readonly serverGroups: _angular_core.Signal<boolean>;
212
242
  protected readonly autoGroupColumnDef: _angular_core.Signal<{
213
243
  cellRendererParams: {
@@ -221,7 +251,12 @@ declare class MtStandardGridComponent<T extends object> {
221
251
  fileName: string;
222
252
  processCellCallback: (params: _masterteam_data_grid.MtExportCellParams<T>) => unknown;
223
253
  }>;
224
- protected readonly pageSize: _angular_core.Signal<number>;
254
+ protected readonly gridPageSize: _angular_core.Signal<number>;
255
+ protected readonly gridStatusBar: _angular_core.Signal<MtStatusBarOptions>;
256
+ protected readonly excelButton: _angular_core.Signal<boolean>;
257
+ protected readonly printButton: _angular_core.Signal<boolean>;
258
+ /** The page's row classes plus the pointer cursor on clickable rows. */
259
+ protected readonly gridRowClass: _angular_core.Signal<((params: MtRowClassParams<T>) => readonly string[]) | undefined>;
225
260
  protected readonly serverTotal: _angular_core.Signal<number | undefined>;
226
261
  protected readonly serverPage: _angular_core.Signal<number | undefined>;
227
262
  protected readonly pagedTotal: _angular_core.Signal<number | undefined>;
@@ -232,25 +267,32 @@ declare class MtStandardGridComponent<T extends object> {
232
267
  protected readonly chartTitle: _angular_core.Signal<string>;
233
268
  protected readonly csvAllowed: _angular_core.Signal<boolean>;
234
269
  protected readonly excelAllowed: _angular_core.Signal<boolean>;
235
- protected readonly statusBar: MtStatusBarOptions;
236
270
  protected readonly pageSizes: readonly number[];
237
271
  protected readonly fit: {
238
272
  readonly type: "fitGridWidth";
239
273
  };
240
274
  private api;
275
+ private readonly grid;
276
+ /** The grid's api: from gridReady, else straight from the grid (a click can come first). */
277
+ private gridApi;
241
278
  private readonly identities;
242
279
  private nextIdentity;
243
280
  private identity;
244
281
  private applyingView;
245
282
  protected onReady(event: MtGridReadyEvent<T>): void;
246
283
  protected onViewChange(): void;
284
+ protected onPaginationChanged(event: MtPaginationChangedEvent): void;
285
+ /** The Export menu and the Export / Print buttons: the owner's exporter, else the grid's. */
286
+ protected exportAs(format: MtStandardGridExportFormat, api?: MtGridApi<T> | null): void;
247
287
  protected onRowClicked(event: MtRowClickedEvent<T>): void;
288
+ /** Toggles a one-value set filter from the clicked cell; false when the cell does not filter. */
289
+ private filterByCell;
248
290
  protected onSelectionChanged(event: MtSelectionChangedEvent<T>): void;
249
291
  private readonly leafColumns;
250
292
  /** The standard context menu: default items, an Export submenu, then the page's row items. */
251
293
  protected readonly contextMenu: (params: MtGetContextMenuItemsParams<T>) => readonly MtContextMenuItem<T>[];
252
294
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<MtStandardGridComponent<any>, never>;
253
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<MtStandardGridComponent<any>, "mt-standard-grid", never, { "rows": { "alias": "rows"; "required": true; "isSignal": true; }; "columns": { "alias": "columns"; "required": true; "isSignal": true; }; "rowId": { "alias": "rowId"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": true; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "selection": { "alias": "selection"; "required": false; "isSignal": true; }; "exportable": { "alias": "exportable"; "required": false; "isSignal": true; }; "exportName": { "alias": "exportName"; "required": false; "isSignal": true; }; "exportFormats": { "alias": "exportFormats"; "required": false; "isSignal": true; }; "exporter": { "alias": "exporter"; "required": false; "isSignal": true; }; "rowMenuItems": { "alias": "rowMenuItems"; "required": false; "isSignal": true; }; "server": { "alias": "server"; "required": false; "isSignal": true; }; "paged": { "alias": "paged"; "required": false; "isSignal": true; }; "detail": { "alias": "detail"; "required": false; "isSignal": true; }; "chartContext": { "alias": "chartContext"; "required": false; "isSignal": true; }; "search": { "alias": "search"; "required": false; "isSignal": true; }; "emptyTitle": { "alias": "emptyTitle"; "required": false; "isSignal": true; }; "emptyDescription": { "alias": "emptyDescription"; "required": false; "isSignal": true; }; "view": { "alias": "view"; "required": false; "isSignal": true; }; }, { "gridReady": "gridReady"; "rowClicked": "rowClicked"; "selectionChanged": "selectionChanged"; "sortChanged": "sortChanged"; "filterChanged": "filterChanged"; "paginationChanged": "paginationChanged"; "rowGroupOpened": "rowGroupOpened"; "viewChanged": "viewChanged"; "chartsChanged": "chartsChanged"; }, never, ["[mtGridToolbar]"], true, never>;
295
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<MtStandardGridComponent<any>, "mt-standard-grid", never, { "rows": { "alias": "rows"; "required": true; "isSignal": true; }; "columns": { "alias": "columns"; "required": true; "isSignal": true; }; "rowId": { "alias": "rowId"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": true; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "rowHeight": { "alias": "rowHeight"; "required": false; "isSignal": true; }; "selection": { "alias": "selection"; "required": false; "isSignal": true; }; "exportable": { "alias": "exportable"; "required": false; "isSignal": true; }; "exportButtons": { "alias": "exportButtons"; "required": false; "isSignal": true; }; "exportName": { "alias": "exportName"; "required": false; "isSignal": true; }; "exportFormats": { "alias": "exportFormats"; "required": false; "isSignal": true; }; "exporter": { "alias": "exporter"; "required": false; "isSignal": true; }; "rowMenuItems": { "alias": "rowMenuItems"; "required": false; "isSignal": true; }; "server": { "alias": "server"; "required": false; "isSignal": true; }; "paged": { "alias": "paged"; "required": false; "isSignal": true; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "clickableRows": { "alias": "clickableRows"; "required": false; "isSignal": true; }; "cellClickFilter": { "alias": "cellClickFilter"; "required": false; "isSignal": true; }; "rowClass": { "alias": "rowClass"; "required": false; "isSignal": true; }; "detail": { "alias": "detail"; "required": false; "isSignal": true; }; "chartContext": { "alias": "chartContext"; "required": false; "isSignal": true; }; "search": { "alias": "search"; "required": false; "isSignal": true; }; "emptyTitle": { "alias": "emptyTitle"; "required": false; "isSignal": true; }; "emptyDescription": { "alias": "emptyDescription"; "required": false; "isSignal": true; }; "view": { "alias": "view"; "required": false; "isSignal": true; }; }, { "gridReady": "gridReady"; "rowClicked": "rowClicked"; "selectionChanged": "selectionChanged"; "sortChanged": "sortChanged"; "filterChanged": "filterChanged"; "paginationChanged": "paginationChanged"; "rowGroupOpened": "rowGroupOpened"; "viewChanged": "viewChanged"; "chartsChanged": "chartsChanged"; }, never, ["[mtGridToolbar]"], true, never>;
254
296
  }
255
297
 
256
298
  /** The standard row-actions column id. */
@@ -265,7 +307,13 @@ declare class MtActionsCell<T> {
265
307
  protected readonly label: _angular_core.Signal<string>;
266
308
  private readonly actions;
267
309
  protected readonly inline: _angular_core.Signal<TableAction[]>;
310
+ /**
311
+ * The ⋮ menu, destructive actions last behind a divider, as in mt-table: colour alone is no
312
+ * separation for an irreversible item. Order within each group is the page's.
313
+ */
268
314
  protected readonly menu: _angular_core.Signal<TableAction[]>;
315
+ /** The divider goes above the first destructive item, never at the top of the menu. */
316
+ protected firstDestructive(index: number): boolean;
269
317
  protected readonly hasMenu: _angular_core.Signal<boolean>;
270
318
  protected loading(): boolean;
271
319
  protected busy(action: TableAction): boolean;