@akcelik/strct 5.8.0 → 5.9.0

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": "@akcelik/strct",
3
- "version": "5.8.0",
3
+ "version": "5.9.0",
4
4
  "description": "UIStruct — a standalone Angular component library with a tokenised, multi-palette theme system, built for datacenter / infrastructure management UIs.",
5
5
  "author": "Serkan Akcelik <serkan.akcelik@gmail.com>",
6
6
  "license": "MIT",
@@ -3919,6 +3919,21 @@ interface StrctDatagridColumn {
3919
3919
  */
3920
3920
  editor?: 'text' | 'number' | 'select';
3921
3921
  /** Options for `editor: 'select'` (the library's own option shape). */
3922
+ /**
3923
+ * What this column sorts by, when the cell does not show it: "1.5 TB" is
3924
+ * sorted by its bytes, a formatted date by its timestamp. `null` and `''`
3925
+ * are "unread" and sort last in both directions.
3926
+ */
3927
+ sortValue?: (row: StrctRow) => unknown;
3928
+ /** Full control of the order, when a key is not enough. Wins over `sortValue`. */
3929
+ comparator?: (a: StrctRow, b: StrctRow) => number;
3930
+ /** What an export writes for this column; defaults to the stored value. */
3931
+ exportValue?: (row: StrctRow) => unknown;
3932
+ /**
3933
+ * Hidden until the chooser is asked for it — the column exists, it is just
3934
+ * not one of the defaults. A persisted or bound `columnState` wins.
3935
+ */
3936
+ hidden?: boolean;
3922
3937
  /**
3923
3938
  * The choices an `editor: 'select'` offers. A function is asked per row: a
3924
3939
  * rule that holds a value the host no longer reports lists it for that row
@@ -3962,6 +3977,9 @@ interface StrctDatagridColumnState {
3962
3977
  widths?: Record<string, number>;
3963
3978
  hidden?: string[];
3964
3979
  order?: string[];
3980
+ /** The column the operator sorted by, and which way. */
3981
+ sortKey?: string | null;
3982
+ sortDir?: 'asc' | 'desc';
3965
3983
  }
3966
3984
  /** One rendered tbody item: a data row, or a group header. */
3967
3985
  interface DgItem {
@@ -4473,11 +4491,28 @@ declare class StrctDatagrid {
4473
4491
  constructor();
4474
4492
  private readPersistedState;
4475
4493
  private applyColumnState;
4494
+ /** Whether a persisted or bound state has already decided what is hidden. */
4495
+ private hiddenDecidedByState;
4496
+ /** Whether the columns' own `hidden` flags have been read (once). */
4497
+ private declaredHiddenApplied;
4498
+ /**
4499
+ * Columns the consumer declared hidden — the default for a column no state
4500
+ * mentions. A list that shows five of twenty columns says so on the columns,
4501
+ * rather than seeding `columnState` and reaching into the library's storage
4502
+ * key to keep from overriding what the operator chose.
4503
+ */
4504
+ private applyDeclaredHidden;
4476
4505
  /**
4477
4506
  * The grid as CSV: header labels + every non-hidden column, all rows in the
4478
4507
  * current order (client mode: the full sorted set, not just the page).
4479
4508
  */
4480
4509
  toCSV(): string;
4510
+ /**
4511
+ * What an export writes for a cell: what the column says, else the stored
4512
+ * value. A templated cell shows "2 h 15 m" and stored 8100; without this the
4513
+ * export carries the seconds, an enum code or a bare `true`.
4514
+ */
4515
+ private exportValueOf;
4481
4516
  /**
4482
4517
  * The grid as a real .xlsx workbook (dependency-free SpreadsheetML):
4483
4518
  * header labels + every non-hidden column in the current order, all rows in
@@ -4536,6 +4571,17 @@ declare class StrctDatagrid {
4536
4571
  /** Emit every selected row: fresh objects from the latest data where
4537
4572
  * available, the last known snapshot otherwise (off-page lazy rows). */
4538
4573
  private commitSelection;
4574
+ /**
4575
+ * One row's sort key for a column: what the column says to sort by, else the
4576
+ * stored value. A cell that shows "1.5 TB" sorts as text without this, which
4577
+ * puts it before "900 GB"; a date written by toLocaleString sorts across
4578
+ * days and AM/PM by its characters.
4579
+ */
4580
+ private sortKeyOf;
4581
+ /** The column a key belongs to — the comparator and the sort key need it. */
4582
+ private columnOf;
4583
+ /** Compare two rows by a column, honouring its comparator and nulls-last. */
4584
+ private compareRows;
4539
4585
  private compare;
4540
4586
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<StrctDatagrid, never>;
4541
4587
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<StrctDatagrid, "strct-datagrid", never, { "columns": { "alias": "columns"; "required": true; "isSignal": true; }; "rows": { "alias": "rows"; "required": true; "isSignal": true; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; "expandable": { "alias": "expandable"; "required": false; "isSignal": true; }; "detailPane": { "alias": "detailPane"; "required": false; "isSignal": true; }; "compact": { "alias": "compact"; "required": false; "isSignal": true; }; "singleLine": { "alias": "singleLine"; "required": false; "isSignal": true; }; "emptyText": { "alias": "emptyText"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "resizable": { "alias": "resizable"; "required": false; "isSignal": true; }; "columnChooser": { "alias": "columnChooser"; "required": false; "isSignal": true; }; "sync": { "alias": "sync"; "required": false; "isSignal": true; }; "footerActionsDisabled": { "alias": "footerActionsDisabled"; "required": false; "isSignal": true; }; "rowId": { "alias": "rowId"; "required": false; "isSignal": true; }; "selectionMode": { "alias": "selectionMode"; "required": false; "isSignal": true; }; "selectedId": { "alias": "selectedId"; "required": false; "isSignal": true; }; "rowSelectable": { "alias": "rowSelectable"; "required": false; "isSignal": true; }; "flush": { "alias": "flush"; "required": false; "isSignal": true; }; "caption": { "alias": "caption"; "required": false; "isSignal": true; }; "paging": { "alias": "paging"; "required": false; "isSignal": true; }; "hasMore": { "alias": "hasMore"; "required": false; "isSignal": true; }; "loadingMore": { "alias": "loadingMore"; "required": false; "isSignal": true; }; "moreTotal": { "alias": "moreTotal"; "required": false; "isSignal": true; }; "groupSelect": { "alias": "groupSelect"; "required": false; "isSignal": true; }; "rowActions": { "alias": "rowActions"; "required": false; "isSignal": true; }; "initialSelection": { "alias": "initialSelection"; "required": false; "isSignal": true; }; "selectedIds": { "alias": "selectedIds"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; "virtual": { "alias": "virtual"; "required": false; "isSignal": true; }; "viewportHeight": { "alias": "viewportHeight"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "editHint": { "alias": "editHint"; "required": false; "isSignal": true; }; "rowHeight": { "alias": "rowHeight"; "required": false; "isSignal": true; }; "lazy": { "alias": "lazy"; "required": false; "isSignal": true; }; "total": { "alias": "total"; "required": false; "isSignal": true; }; "stateKey": { "alias": "stateKey"; "required": false; "isSignal": true; }; "columnState": { "alias": "columnState"; "required": false; "isSignal": true; }; "reorderable": { "alias": "reorderable"; "required": false; "isSignal": true; }; "groupBy": { "alias": "groupBy"; "required": false; "isSignal": true; }; "filters": { "alias": "filters"; "required": false; "isSignal": true; }; "quickFilter": { "alias": "quickFilter"; "required": false; "isSignal": true; }; "quickFilterFields": { "alias": "quickFilterFields"; "required": false; "isSignal": true; }; "quickFilterable": { "alias": "quickFilterable"; "required": false; "isSignal": true; }; "quickFilterAlign": { "alias": "quickFilterAlign"; "required": false; "isSignal": true; }; "childrenKey": { "alias": "childrenKey"; "required": false; "isSignal": true; }; }, { "selectedId": "selectedIdChange"; "loadMore": "loadMore"; "selectedIds": "selectedIdsChange"; "columnState": "columnStateChange"; "filters": "filtersChange"; "quickFilter": "quickFilterChange"; "selectionChange": "selectionChange"; "syncChange": "syncChange"; "rowAction": "rowAction"; "lazyLoad": "lazyLoad"; "cellEdit": "cellEdit"; }, ["detailDef", "actionBarDef", "actionBarCaptionDef", "cellDefs"], ["[strctDatagridActionBarCaption]", "[strctDatagridActionBar]"], true, never>;