spiderly 19.12.3 → 19.13.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.
@@ -248,6 +248,8 @@ export declare class SpiderlyDataTableComponent implements OnInit, OnChanges, Af
248
248
  private get columnsStateKey();
249
249
  /** Actions columns always render; data columns follow the override, then declared default. */
250
250
  isColumnVisible(col: Column): boolean;
251
+ /** The declared default in the current context: the active view's `columns`, then `Column.visible`. */
252
+ private isDeclaredVisible;
251
253
  /**
252
254
  * `cols` in the operator's order. A field the stored order has never seen — a column added in a
253
255
  * later release — sorts to the END rather than displacing a layout someone built by hand
@@ -376,6 +378,11 @@ export declare class SpiderlyDataTableComponent implements OnInit, OnChanges, Af
376
378
  * overwrites it, the operator's own choice wins by construction. Accepted cost of adopting
377
379
  * late instead of holding the first request: a brief flash of the seeded view's rows and a
378
380
  * second request when the late view lands.
381
+ *
382
+ * Only a view this change BROUGHT is adopted. A consumer rebuilds `[views]` on every list load
383
+ * to refresh `TableView.count`, and under `stateStorage: 'local'` the key can name a view the
384
+ * operator picked in another browser tab — adopting on every change switched this tab's view
385
+ * at the next count refresh (spiderly#430).
379
386
  */
380
387
  private adoptStoredView;
381
388
  private viewById;
@@ -752,6 +759,8 @@ export declare class SpiderlyDataTableComponent implements OnInit, OnChanges, Af
752
759
  getRowData(rowData: any, col: Column): string;
753
760
  colTrackByFn(index: any, item: any): any;
754
761
  actionTrackByFn(index: any, item: Action): string;
762
+ /** By id: a count refresh rebuilds `[views]` as new objects, and must not re-create the focused tab. */
763
+ viewTrackByFn(index: number, view: TableView): string;
755
764
  exportListToExcel(): void;
756
765
  /**
757
766
  * Clears the FILTERS — and nothing else (2026-09-06, grilled). It used to also reach the
@@ -830,7 +839,7 @@ export declare class Action {
830
839
  * fixed daily jobs, shared built-in views cover the work, while personal saved views would drift
831
840
  * into five variants of the same question. Personal LAYOUT choices still persist on top, per view.
832
841
  */
833
- export interface TableView<TFilters = any> {
842
+ export interface TableView<TFilters = any, TRow = any> {
834
843
  id: string;
835
844
  label: string;
836
845
  /**
@@ -851,10 +860,33 @@ export interface TableView<TFilters = any> {
851
860
  * first" IS the work list, not a reading preference). Entering the view applies it; the
852
861
  * tri-state un-sort and Clear filters return to it instead of the table default; an operator's
853
862
  * own sort overrides it, persisted per view on store tables (decision 10's sort half). A view
854
- * declaring none keeps whatever ordering the grid already has, exactly as before this field
855
- * existed.
863
+ * declaring none falls back to the table's `defaultSortField`, else unsorted — it never keeps
864
+ * the previous view's ordering (`applyViewSort`).
856
865
  */
857
866
  sort?: SortMeta[];
867
+ /**
868
+ * How many rows the view holds, shown as a badge beside its label so an operator sees which
869
+ * work list has something in it without clicking through every tab (Polaris IndexFilters
870
+ * carries the same badge). `null` or absent shows no badge; `0` shows one.
871
+ *
872
+ * The table never computes it: the consumer runs its own count query and hands the number in,
873
+ * typically by rebuilding `[views]` after every list load. Such a rebuild is safe — it neither
874
+ * re-enters the active view nor sends a request (see `adoptStoredView`).
875
+ */
876
+ count?: number | null;
877
+ /**
878
+ * The view's own column defaults, as field → visible: `{ why: true, location: false }` shows
879
+ * `why` and hides `location` in this view only, overriding their `Column.visible`. A column the
880
+ * map does not name keeps its `Column.visible`, so a column added to the table later shows up
881
+ * in every view that does not hide it. Place a column a view swaps in next to the one it
882
+ * replaces in `cols`, and it takes that column's place.
883
+ *
884
+ * The operator's own per-view choices still win, and are stored only where they differ from
885
+ * this declaration, so a changed declaration reaches every operator who never touched that
886
+ * column; Reset returns to it. A `lockVisible` column always shows, whatever the map says.
887
+ * Rebuilding `[views]` with a changed map re-renders the active view's columns.
888
+ */
889
+ columns?: Partial<Record<string & keyof TRow, boolean>>;
858
890
  }
859
891
  export declare class Column<T = any> {
860
892
  name?: string;
@@ -901,6 +933,7 @@ export declare class Column<T = any> {
901
933
  /**
902
934
  * Whether the column is initially rendered. Defaults to `true`. Declare `visible: false` for
903
935
  * columns that should be available in the column chooser but hidden until the user reveals them.
936
+ * A view overrides it for itself through {@link TableView.columns}.
904
937
  */
905
938
  visible?: boolean;
906
939
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spiderly",
3
- "version": "19.12.3",
3
+ "version": "19.13.0",
4
4
  "author": "Filip Trivan",
5
5
  "license": "MIT",
6
6
  "description": "Spiderly Angular Library to use in combination with Spiderly.",
@@ -149,6 +149,16 @@
149
149
  background: var(--p-content-hover-background);
150
150
  }
151
151
 
152
+ // Inherits the tab's colour, so the active tab's count reads as part of the active tab.
153
+ .table-view-count {
154
+ margin-left: 6px;
155
+ padding: 0 6px;
156
+ border-radius: 999px;
157
+ background: var(--p-content-border-color);
158
+ font-size: 0.75rem;
159
+ font-variant-numeric: tabular-nums;
160
+ }
161
+
152
162
  // The left edge that survives a horizontal scroll. Geometry only here: the opaque background
153
163
  // lives on the BODY cells below, because the header th already gets an opaque
154
164
  // header.cell.background from PrimeNG's own th rule. Painting the row palette on the whole