spiderly 19.13.0 → 19.15.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.
@@ -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';
@@ -340,6 +341,7 @@ export declare class SpiderlyDataTableComponent implements OnInit, OnChanges, Af
340
341
  * reading exactly the keys they already wrote.
341
342
  */
342
343
  private get viewScope();
344
+ private viewScopeOf;
343
345
  /**
344
346
  * Where the applied filters live. Follows `stateStorage` rather than the layout's always-local
345
347
  * rule, because that is where they lived before the bar took them off the header: PrimeNG's
@@ -348,6 +350,7 @@ export declare class SpiderlyDataTableComponent implements OnInit, OnChanges, Af
348
350
  * durable preference like a column's width.
349
351
  */
350
352
  private get filtersStateKey();
353
+ private filtersStateKeyOf;
351
354
  private get filterStorage();
352
355
  /**
353
356
  * Where the active view id lives. Deliberately NOT view-scoped — it is the input `viewScope`
@@ -397,6 +400,9 @@ export declare class SpiderlyDataTableComponent implements OnInit, OnChanges, Af
397
400
  * the empty state the operator left — they cleared it, and F5 must give the cleared state
398
401
  * back. On a table with no views, `view` is null and this is a plain restore of the
399
402
  * `persistAppliedFilters` snapshot.
403
+ *
404
+ * `viewFilterPayload` passes a scratch store and another view's key, to read what entering
405
+ * that view would send.
400
406
  */
401
407
  private enterViewFilters;
402
408
  private get layoutStateKey();
@@ -558,6 +564,25 @@ export declare class SpiderlyDataTableComponent implements OnInit, OnChanges, Af
558
564
  * view's filters are in place.
559
565
  */
560
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;
561
586
  /**
562
587
  * The filter this column stands for. Defaults to the column's own `field`, because a store id
563
588
  * IS a backend property name — `toFilterPayload` emits it straight into `Filter.filters`. So
@@ -845,6 +870,9 @@ export interface TableView<TFilters = any, TRow = any> {
845
870
  /**
846
871
  * Sets the filters this view asks for. Receives the table's own store, so a consumer writes it
847
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.
848
876
  */
849
877
  apply?: (filters: TFilters) => void;
850
878
  /**
@@ -871,7 +899,9 @@ export interface TableView<TFilters = any, TRow = any> {
871
899
  *
872
900
  * The table never computes it: the consumer runs its own count query and hands the number in,
873
901
  * 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`).
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.
875
905
  */
876
906
  count?: number | null;
877
907
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spiderly",
3
- "version": "19.13.0",
3
+ "version": "19.15.0",
4
4
  "author": "Filip Trivan",
5
5
  "license": "MIT",
6
6
  "description": "Spiderly Angular Library to use in combination with Spiderly.",
package/public-api.d.ts CHANGED
@@ -92,7 +92,6 @@ export * from './lib/services/base-form.service';
92
92
  export * from './lib/services/config.service.base';
93
93
  export * from './lib/services/helper-functions';
94
94
  export * from './lib/services/spiderly-message.service';
95
- export * from './lib/services/spiderly-transloco-loader';
96
95
  export * from './lib/services/validator-abstract.service';
97
96
  export * from './lib/directives/spiderly-cell-template.directive';
98
97
  export * from './lib/directives/spiderly-data-table-actions.directive';
@@ -1,12 +0,0 @@
1
- import { ConfigServiceBase } from './config.service.base';
2
- import { TranslocoLoader } from '@jsverse/transloco';
3
- import { HttpClient } from '@angular/common/http';
4
- import * as i0 from "@angular/core";
5
- export declare class SpiderlyTranslocoLoader implements TranslocoLoader {
6
- private http;
7
- private config;
8
- constructor(http: HttpClient, config: ConfigServiceBase);
9
- getTranslation(lang: string): import("rxjs").Observable<Object>;
10
- static ɵfac: i0.ɵɵFactoryDeclaration<SpiderlyTranslocoLoader, never>;
11
- static ɵprov: i0.ɵɵInjectableDeclaration<SpiderlyTranslocoLoader>;
12
- }