spiderly 19.12.4 → 19.14.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/agent/docs/angular-customization/index.md +34 -2
- package/agent/docs/entity-design/index.md +2 -2
- package/fesm2022/spiderly.mjs +697 -638
- package/fesm2022/spiderly.mjs.map +1 -1
- package/lib/components/spiderly-data-table/spiderly-data-table.component.d.ts +66 -3
- package/package.json +1 -1
- package/styles/components/spiderly-data-table/spiderly-data-table.component.scss +10 -0
|
@@ -7,6 +7,7 @@ import { Table, TableLazyLoadEvent } from 'primeng/table';
|
|
|
7
7
|
import { Observable } from 'rxjs';
|
|
8
8
|
import { CellTemplateContext, SpiderlyCellTemplateDirective } from '../../directives/spiderly-cell-template.directive';
|
|
9
9
|
import { Filter } from '../../entities/filter';
|
|
10
|
+
import { FilterRule } from '../../entities/filter-rule';
|
|
10
11
|
import { LazyLoadSelectedIdsResult } from '../../entities/lazy-load-selected-ids-result';
|
|
11
12
|
import { PaginatedResult } from '../../entities/paginated-result';
|
|
12
13
|
import { PrimengOption } from '../../entities/primeng-option';
|
|
@@ -248,6 +249,8 @@ export declare class SpiderlyDataTableComponent implements OnInit, OnChanges, Af
|
|
|
248
249
|
private get columnsStateKey();
|
|
249
250
|
/** Actions columns always render; data columns follow the override, then declared default. */
|
|
250
251
|
isColumnVisible(col: Column): boolean;
|
|
252
|
+
/** The declared default in the current context: the active view's `columns`, then `Column.visible`. */
|
|
253
|
+
private isDeclaredVisible;
|
|
251
254
|
/**
|
|
252
255
|
* `cols` in the operator's order. A field the stored order has never seen — a column added in a
|
|
253
256
|
* later release — sorts to the END rather than displacing a layout someone built by hand
|
|
@@ -338,6 +341,7 @@ export declare class SpiderlyDataTableComponent implements OnInit, OnChanges, Af
|
|
|
338
341
|
* reading exactly the keys they already wrote.
|
|
339
342
|
*/
|
|
340
343
|
private get viewScope();
|
|
344
|
+
private viewScopeOf;
|
|
341
345
|
/**
|
|
342
346
|
* Where the applied filters live. Follows `stateStorage` rather than the layout's always-local
|
|
343
347
|
* rule, because that is where they lived before the bar took them off the header: PrimeNG's
|
|
@@ -346,6 +350,7 @@ export declare class SpiderlyDataTableComponent implements OnInit, OnChanges, Af
|
|
|
346
350
|
* durable preference like a column's width.
|
|
347
351
|
*/
|
|
348
352
|
private get filtersStateKey();
|
|
353
|
+
private filtersStateKeyOf;
|
|
349
354
|
private get filterStorage();
|
|
350
355
|
/**
|
|
351
356
|
* Where the active view id lives. Deliberately NOT view-scoped — it is the input `viewScope`
|
|
@@ -376,6 +381,11 @@ export declare class SpiderlyDataTableComponent implements OnInit, OnChanges, Af
|
|
|
376
381
|
* overwrites it, the operator's own choice wins by construction. Accepted cost of adopting
|
|
377
382
|
* late instead of holding the first request: a brief flash of the seeded view's rows and a
|
|
378
383
|
* second request when the late view lands.
|
|
384
|
+
*
|
|
385
|
+
* Only a view this change BROUGHT is adopted. A consumer rebuilds `[views]` on every list load
|
|
386
|
+
* to refresh `TableView.count`, and under `stateStorage: 'local'` the key can name a view the
|
|
387
|
+
* operator picked in another browser tab — adopting on every change switched this tab's view
|
|
388
|
+
* at the next count refresh (spiderly#430).
|
|
379
389
|
*/
|
|
380
390
|
private adoptStoredView;
|
|
381
391
|
private viewById;
|
|
@@ -390,6 +400,9 @@ export declare class SpiderlyDataTableComponent implements OnInit, OnChanges, Af
|
|
|
390
400
|
* the empty state the operator left — they cleared it, and F5 must give the cleared state
|
|
391
401
|
* back. On a table with no views, `view` is null and this is a plain restore of the
|
|
392
402
|
* `persistAppliedFilters` snapshot.
|
|
403
|
+
*
|
|
404
|
+
* `viewFilterPayload` passes a scratch store and another view's key, to read what entering
|
|
405
|
+
* that view would send.
|
|
393
406
|
*/
|
|
394
407
|
private enterViewFilters;
|
|
395
408
|
private get layoutStateKey();
|
|
@@ -551,6 +564,25 @@ export declare class SpiderlyDataTableComponent implements OnInit, OnChanges, Af
|
|
|
551
564
|
* view's filters are in place.
|
|
552
565
|
*/
|
|
553
566
|
selectView(view: TableView): void;
|
|
567
|
+
/**
|
|
568
|
+
* The `filters` payload a view's own list request carries — the same shape the store's
|
|
569
|
+
* `toFilterPayload()` emits — so a consumer's count query can narrow each view by the bar
|
|
570
|
+
* filters the operator saved on it, and a `TableView.count` stays the number of rows that tab
|
|
571
|
+
* lists: on screen for the active view, after a click for the others (spiderly#439).
|
|
572
|
+
*
|
|
573
|
+
* - The ACTIVE view answers with the live filters. Not with what a click would enter: clicking
|
|
574
|
+
* the active tab re-asks its question when the operator has cleared the bar, but the list on
|
|
575
|
+
* screen, and so its count, has not.
|
|
576
|
+
* - Any other view answers with what a click would enter (`enterViewFilters`): the filters
|
|
577
|
+
* saved on it, else its `apply` — always `apply` for a transient view. That runs on a scratch
|
|
578
|
+
* `createFilterStore` of the same declarations, so nothing switches, persists or re-queries.
|
|
579
|
+
* Untracked: the scratch store's signal writes would otherwise make a read inside a
|
|
580
|
+
* `computed` throw NG0600.
|
|
581
|
+
*
|
|
582
|
+
* `{}` on a table without `[filters]`, whose requests carry none; `null` for an id that is not
|
|
583
|
+
* in `[views]`.
|
|
584
|
+
*/
|
|
585
|
+
viewFilterPayload(viewId: string): Record<string, FilterRule[]> | null;
|
|
554
586
|
/**
|
|
555
587
|
* The filter this column stands for. Defaults to the column's own `field`, because a store id
|
|
556
588
|
* IS a backend property name — `toFilterPayload` emits it straight into `Filter.filters`. So
|
|
@@ -752,6 +784,8 @@ export declare class SpiderlyDataTableComponent implements OnInit, OnChanges, Af
|
|
|
752
784
|
getRowData(rowData: any, col: Column): string;
|
|
753
785
|
colTrackByFn(index: any, item: any): any;
|
|
754
786
|
actionTrackByFn(index: any, item: Action): string;
|
|
787
|
+
/** By id: a count refresh rebuilds `[views]` as new objects, and must not re-create the focused tab. */
|
|
788
|
+
viewTrackByFn(index: number, view: TableView): string;
|
|
755
789
|
exportListToExcel(): void;
|
|
756
790
|
/**
|
|
757
791
|
* Clears the FILTERS — and nothing else (2026-09-06, grilled). It used to also reach the
|
|
@@ -830,12 +864,15 @@ export declare class Action {
|
|
|
830
864
|
* fixed daily jobs, shared built-in views cover the work, while personal saved views would drift
|
|
831
865
|
* into five variants of the same question. Personal LAYOUT choices still persist on top, per view.
|
|
832
866
|
*/
|
|
833
|
-
export interface TableView<TFilters = any> {
|
|
867
|
+
export interface TableView<TFilters = any, TRow = any> {
|
|
834
868
|
id: string;
|
|
835
869
|
label: string;
|
|
836
870
|
/**
|
|
837
871
|
* Sets the filters this view asks for. Receives the table's own store, so a consumer writes it
|
|
838
872
|
* with the store's typing. Called on a CLEARED store: a view is a state, not an addition.
|
|
873
|
+
*
|
|
874
|
+
* `viewFilterPayload` also calls it, on a scratch store of the same declarations, to read what
|
|
875
|
+
* entering the view would send, so it writes into the store it receives and nothing else.
|
|
839
876
|
*/
|
|
840
877
|
apply?: (filters: TFilters) => void;
|
|
841
878
|
/**
|
|
@@ -851,10 +888,35 @@ export interface TableView<TFilters = any> {
|
|
|
851
888
|
* first" IS the work list, not a reading preference). Entering the view applies it; the
|
|
852
889
|
* tri-state un-sort and Clear filters return to it instead of the table default; an operator's
|
|
853
890
|
* own sort overrides it, persisted per view on store tables (decision 10's sort half). A view
|
|
854
|
-
* declaring none
|
|
855
|
-
*
|
|
891
|
+
* declaring none falls back to the table's `defaultSortField`, else unsorted — it never keeps
|
|
892
|
+
* the previous view's ordering (`applyViewSort`).
|
|
856
893
|
*/
|
|
857
894
|
sort?: SortMeta[];
|
|
895
|
+
/**
|
|
896
|
+
* How many rows the view holds, shown as a badge beside its label so an operator sees which
|
|
897
|
+
* work list has something in it without clicking through every tab (Polaris IndexFilters
|
|
898
|
+
* carries the same badge). `null` or absent shows no badge; `0` shows one.
|
|
899
|
+
*
|
|
900
|
+
* The table never computes it: the consumer runs its own count query and hands the number in,
|
|
901
|
+
* typically by rebuilding `[views]` after every list load. Such a rebuild is safe — it neither
|
|
902
|
+
* re-enters the active view nor sends a request (see `adoptStoredView`). For a count that
|
|
903
|
+
* honors the bar filters an operator saved on each view, send each view's
|
|
904
|
+
* `viewFilterPayload(id)` with that query.
|
|
905
|
+
*/
|
|
906
|
+
count?: number | null;
|
|
907
|
+
/**
|
|
908
|
+
* The view's own column defaults, as field → visible: `{ why: true, location: false }` shows
|
|
909
|
+
* `why` and hides `location` in this view only, overriding their `Column.visible`. A column the
|
|
910
|
+
* map does not name keeps its `Column.visible`, so a column added to the table later shows up
|
|
911
|
+
* in every view that does not hide it. Place a column a view swaps in next to the one it
|
|
912
|
+
* replaces in `cols`, and it takes that column's place.
|
|
913
|
+
*
|
|
914
|
+
* The operator's own per-view choices still win, and are stored only where they differ from
|
|
915
|
+
* this declaration, so a changed declaration reaches every operator who never touched that
|
|
916
|
+
* column; Reset returns to it. A `lockVisible` column always shows, whatever the map says.
|
|
917
|
+
* Rebuilding `[views]` with a changed map re-renders the active view's columns.
|
|
918
|
+
*/
|
|
919
|
+
columns?: Partial<Record<string & keyof TRow, boolean>>;
|
|
858
920
|
}
|
|
859
921
|
export declare class Column<T = any> {
|
|
860
922
|
name?: string;
|
|
@@ -901,6 +963,7 @@ export declare class Column<T = any> {
|
|
|
901
963
|
/**
|
|
902
964
|
* Whether the column is initially rendered. Defaults to `true`. Declare `visible: false` for
|
|
903
965
|
* columns that should be available in the column chooser but hidden until the user reveals them.
|
|
966
|
+
* A view overrides it for itself through {@link TableView.columns}.
|
|
904
967
|
*/
|
|
905
968
|
visible?: boolean;
|
|
906
969
|
/**
|
package/package.json
CHANGED
|
@@ -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
|