@coolon/angular-ui-powerups 16.1.0-alpha.329 → 16.1.0-alpha.330

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.
@@ -88,11 +88,11 @@ export declare abstract class AbstractTableModel<Row extends object> extends Gar
88
88
  * search class's `dependsOn` change.
89
89
  *
90
90
  * @example
91
- * const criteria$ = this.table.useCriteria(base$, {
92
- * searchCriteriaClass: AlarmSearchCriteriaDto,
93
- * withSearchCriteria: (criteria, searchCriteria) => criteria.copy({searchCriteria}),
91
+ * const query$ = this.table.useCriteria(base$, {
92
+ * searchCriteriaClass: HeroSearchCriteria,
93
+ * withSearchCriteria: (query, searchCriteria) => query.with({searchCriteria}),
94
94
  * });
95
- * this.history.useCriteria(criteria$);
95
+ * chain(query$).subscribe(query => this.send(query));
96
96
  */
97
97
  useCriteria<Criteria, S>(base$: ValueModel<Criteria>, placement: SearchCriteriaPlacement<Criteria, S>): ValueModelChain<Criteria>;
98
98
  private initialiseSearchCriteria;
@@ -2,8 +2,9 @@ import type { Constructable, HasValue } from "@coolon/pectin";
2
2
  import type { TableSearch } from "./table-search";
3
3
  /**
4
4
  * What a search means for one column, written into search criteria: the part of a server request's
5
- * criteria that carries the search, shared by every resource that lists the same kind of thing (for
6
- * example `AlarmSearchCriteriaDto`, which the Alarm history page's criteria hold as `searchCriteria`).
5
+ * criteria that carries the search, shared by every resource that lists the same kind of thing. For
6
+ * example, `HeroSearchCriteria` is what a search asks of any list of heroes, and a page's `HeroQuery`
7
+ * holds it as `searchCriteria`.
7
8
  *
8
9
  * A cell renderer names its search classes with {@link SearchCriteria}. The table resolves them through
9
10
  * the injector, so a search class may inject what it needs to match against, such as the manager that
@@ -14,12 +15,13 @@ import type { TableSearch } from "./table-search";
14
15
  * nothing matches.
15
16
  *
16
17
  * @example
18
+ * // The server stores a power's code, not its label, so the search is turned into codes here.
17
19
  * @Injectable({providedIn: 'root'})
18
- * export class AlarmTypeSearch implements CellSearch<AlarmSearchCriteriaDto> {
19
- * readonly searchCriteriaClass = AlarmSearchCriteriaDto;
20
- * criteriaFor(searchCriteria: AlarmSearchCriteriaDto, search: TableSearch): AlarmSearchCriteriaDto {
21
- * const types = AlarmType.values().filter(type => search.regex.test(type.label));
22
- * return types.length ? searchCriteria.copy(c => c.types = types) : searchCriteria;
20
+ * export class PowerSearch implements CellSearch<HeroSearchCriteria> {
21
+ * readonly searchCriteriaClass = HeroSearchCriteria;
22
+ * criteriaFor(searchCriteria: HeroSearchCriteria, search: TableSearch): HeroSearchCriteria {
23
+ * const powers = Power.ALL.filter(power => search.regex.test(Power.label(power)));
24
+ * return powers.length ? searchCriteria.with({powers}) : searchCriteria;
23
25
  * }
24
26
  * }
25
27
  */
@@ -40,8 +42,8 @@ export declare namespace CellSearch {
40
42
  *
41
43
  * @example
42
44
  * table.useCriteria(base$, {
43
- * searchCriteriaClass: AlarmSearchCriteriaDto,
44
- * withSearchCriteria: (criteria, searchCriteria) => criteria.copy({searchCriteria}),
45
+ * searchCriteriaClass: HeroSearchCriteria,
46
+ * withSearchCriteria: (query, searchCriteria) => query.with({searchCriteria}),
45
47
  * });
46
48
  */
47
49
  export interface SearchCriteriaPlacement<Criteria, S> {
@@ -10,9 +10,10 @@ import type { CellSearch } from "./cell-search";
10
10
  * its own metadata key, so a renderer may carry both.
11
11
  *
12
12
  * @example
13
- * @SearchCriteria(AlarmSourceSearch, DeviceNameSearch)
14
- * @Component({selector: 'frontend-alarm-source-cell-renderer', ...})
15
- * export class AlarmSourceCellRendererComponent { ... }
13
+ * // Shown in tables of heroes and of villains, so it names a search class for each one's search criteria.
14
+ * @SearchCriteria(HeroPowerSearch, VillainPowerSearch)
15
+ * @Component({selector: 'app-power-cell', ...})
16
+ * export class PowerCellComponent { ... }
16
17
  */
17
18
  export declare function SearchCriteria(...searchClasses: CellSearch.Class[]): ClassDecorator;
18
19
  export declare namespace SearchCriteria {
@@ -4,18 +4,17 @@ import type { TextSearchPredicate } from "./text-search-predicate";
4
4
  /**
5
5
  * The search model of a table whose rows the server finds, such as one that loads them a step at a
6
6
  * time. The rows a table holds are what the server found for the search and the filters, so it shows
7
- * them all. Its settled search
8
- * ({@link search$}) becomes the server request's criteria through `AbstractTableModel.useCriteria`, and
9
- * the cells highlight the search text as usual.
7
+ * them all. Its settled search ({@link search$}) becomes the server request's criteria through
8
+ * `AbstractTableModel.useCriteria`, and the cells highlight the search text as usual.
10
9
  *
11
10
  * It has no row predicate, so a page's filters cannot filter the rows held: they reach the server as
12
11
  * criteria, as the search does.
13
12
  *
14
13
  * @example
15
- * this.search = new ServerSearchModel<DecoratedAlarm>({disposedWith: this, searchText$: this.searchText$});
16
- * const criteria$ = this.table.useCriteria(base$, {
17
- * searchCriteriaClass: AlarmSearchCriteriaDto,
18
- * withSearchCriteria: (criteria, searchCriteria) => criteria.copy({searchCriteria}),
14
+ * this.search = new ServerSearchModel<Hero>({disposedWith: this, searchText$: this.searchText$});
15
+ * const query$ = this.table.useCriteria(base$, {
16
+ * searchCriteriaClass: HeroSearchCriteria,
17
+ * withSearchCriteria: (query, searchCriteria) => query.with({searchCriteria}),
19
18
  * });
20
19
  *
21
20
  * <aup-table [tableModel]="table" [filterModel]="search"></aup-table>
@@ -89,7 +89,11 @@ export declare class TableComponent<Row extends object> extends AbstractTableCom
89
89
  * Set to true to keep the rows in view where they are when rows are inserted, removed or resized above
90
90
  * them, so a reader scrolled down the table is not moved. At the top of the table nothing is held, so a
91
91
  * row inserted there comes into view. Applies with `scrollMode="classic"` only, and only to rows with an
92
- * identity of their own (a list `identifiedBy` an id), because a row is found again by its id.
92
+ * identity of their own (a list `identifiedBy` an id), because a row is found again by its id. In
93
+ * development, a table set to hold without either warns in the console.
94
+ *
95
+ * The element that scrolls the rows, in either scroll mode, carries the attribute `aup-scroll-container`,
96
+ * and each row its id as `aup-row-id`, so a test can scroll the table and find a row where it is drawn.
93
97
  */
94
98
  holdScrollPosition: boolean;
95
99
  private _footerContentAdded;
@@ -97,6 +101,11 @@ export declare class TableComponent<Row extends object> extends AbstractTableCom
97
101
  protected readonly tableBodyScrollMode$: ValueModel<TableBodyComponent.ScrollMode>;
98
102
  constructor(injector: Injector);
99
103
  ngOnInit(): void;
104
+ /**
105
+ * Warns of a table set to hold its scroll position where it cannot. Nothing fails otherwise: the
106
+ * table moves the rows the reader is on, or holds the wrong one.
107
+ */
108
+ private warnWhereHoldingCannotWork;
100
109
  protected getModel(): AbstractTableModel<Row>;
101
110
  /**
102
111
  * True while the filters leave no row and the host gave content for the empty slot. A host that
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coolon/angular-ui-powerups",
3
- "version": "16.1.0-alpha.329",
3
+ "version": "16.1.0-alpha.330",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "^16.2.9",
6
6
  "@angular/common": "^16.2.9",