@coolon/angular-ui-powerups 16.1.0-alpha.265 → 16.1.0-alpha.267

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.
Files changed (20) hide show
  1. package/esm2022/lib/components/tables/abstract-table-model.mjs +30 -3
  2. package/esm2022/lib/components/tables/column/column-model.mjs +13 -1
  3. package/esm2022/lib/components/tables/column/custom-value-column-model.mjs +5 -1
  4. package/esm2022/lib/components/tables/column/list-propery-column-model.mjs +5 -1
  5. package/esm2022/lib/components/tables/column/property-column-model.mjs +5 -1
  6. package/esm2022/lib/components/tables/filter/enable-cell-text-search.decorator.mjs +8 -2
  7. package/esm2022/lib/components/tables/filter/table-filter-model.mjs +8 -6
  8. package/esm2022/lib/components/tables/filter/text-search-predicate.mjs +2 -17
  9. package/esm2022/lib/components/tables/renderer/select-header-cell/selection-header-cell.component.mjs +9 -4
  10. package/esm2022/lib/components/tables/renderer/selection-cell/selection-cell.component.mjs +12 -5
  11. package/esm2022/lib/components/tables/renderer/table-body/table-body.component.mjs +4 -4
  12. package/fesm2022/coolon-angular-ui-powerups.mjs +97 -44
  13. package/fesm2022/coolon-angular-ui-powerups.mjs.map +1 -1
  14. package/lib/components/tables/abstract-table-model.d.ts +10 -0
  15. package/lib/components/tables/column/column-model.d.ts +7 -0
  16. package/lib/components/tables/filter/enable-cell-text-search.decorator.d.ts +16 -1
  17. package/lib/components/tables/filter/text-search-predicate.d.ts +16 -10
  18. package/lib/components/tables/renderer/select-header-cell/selection-header-cell.component.d.ts +1 -0
  19. package/lib/components/tables/renderer/selection-cell/selection-cell.component.d.ts +2 -0
  20. package/package.json +3 -3
@@ -33,6 +33,7 @@ export declare abstract class AbstractTableModel<Row extends object> extends Gar
33
33
  protected identityOf: (item: Row) => any;
34
34
  readonly dataSourceEmpty$: ValueModel<boolean>;
35
35
  readonly selectedItems$: ListModel<Row>;
36
+ readonly selectableRows$: ListModel<Row>;
36
37
  readonly leadSelection$: ValueModel<Row>;
37
38
  readonly hasSelection$: BooleanValueModelChain;
38
39
  readonly footerRowModels: FooterRowModel.Impl[];
@@ -105,6 +106,15 @@ export declare abstract class AbstractTableModel<Row extends object> extends Gar
105
106
  getSelectionModel(): SelectionModel<Row> | undefined;
106
107
  isHoverEnabled(): boolean;
107
108
  isCursorEnabled(column: ColumnModel<Row>): boolean;
109
+ /** Whether the selection model will accept this row (see MultipleSelectionModel.disableSelectionIf). */
110
+ isRowSelectable(row: Row): boolean;
111
+ isRowSelectionEnabledForRow(row: Row): boolean;
112
+ /**
113
+ * Per-row hover affordance. A row that can't be selected shouldn't look like it can -- but row
114
+ * click listeners still fire for it, so it keeps its hover in that case.
115
+ */
116
+ isHoverEnabledForRow(row: Row): boolean;
117
+ isCursorEnabledForRow(column: ColumnModel<Row>, row: Row): boolean;
108
118
  selectRow(row: Row): void;
109
119
  onRowClicked(callback: (row: Row) => void): Disposable;
110
120
  _notifyCellClicked(columnModel: ColumnModel<Row>, row: Row): void;
@@ -3,6 +3,7 @@ import { CdkPortalOutletAttachedRef } from "@angular/cdk/portal";
3
3
  import { Injector } from "@angular/core";
4
4
  import { GarbageCollector, ValueModel } from "@coolon/pectin";
5
5
  import { ColumnTextSearchFormatter } from "../filter/column-text-search-formatter";
6
+ import type { ColumnTextMatcher } from "../filter/text-search-predicate";
6
7
  import { CellHeaderPortalRef, type CellRendererPortalRef } from "../renderer/cell-portal-ref";
7
8
  import type { TableCellComponent } from "../renderer/table-cell/table-cell.component";
8
9
  import type { TableHeaderCellComponent } from "../renderer/table-header-cell/table-header-cell.component";
@@ -33,6 +34,8 @@ export declare class ColumnModel<Row extends object> extends GarbageCollector {
33
34
  private _userVisible$;
34
35
  readonly dasherisedColumnId: string;
35
36
  private readonly textSearchDelegate;
37
+ private _textMatcher;
38
+ private _textMatcherMap;
36
39
  readonly visible$: ValueModel<boolean>;
37
40
  constructor(columnId: string, order: ColumnOrderManager, textPropertiesProvider: ColumnModel.TextPropertiesProvider);
38
41
  protected installHeaderRenderer(): void;
@@ -54,6 +57,10 @@ export declare class ColumnModel<Row extends object> extends GarbageCollector {
54
57
  getSearchTextFor(row: Row): string;
55
58
  configureColumnTextSearch(formatter: ColumnTextSearchFormatter<Row>): this;
56
59
  configureColumnTextSearch<T>(formatter: ColumnTextSearchFormatter<T>, mapper: (row: Row) => T): this;
60
+ /** False for a column without a matcher — it contributes only its search text. */
61
+ matchesSearchFor(row: Row, searchText: string): boolean;
62
+ configureColumnTextMatch(matcher: ColumnTextMatcher<Row>): this;
63
+ configureColumnTextMatch<T>(matcher: ColumnTextMatcher<T>, mapper: (row: Row) => T): this;
57
64
  protected configureHeaderRenderer<C>(config: CellHeaderPortalRef<Row, unknown>): void;
58
65
  protected configureCellRenderer<C>(config: CellRendererPortalRef<Row, unknown>): void;
59
66
  cellHeaderRenderer<C>(componentType: ComponentType<C>, initialiser: (component: C, column: ColumnModel<Row>) => void): this;
@@ -3,10 +3,12 @@ import { Constructable } from "@coolon/typescript-utilities";
3
3
  import { Enum } from "typescript-string-enums";
4
4
  import type { CellRenderer } from "../renderer/cell-renderer";
5
5
  import { ColumnTextSearchFormatter } from "./column-text-search-formatter";
6
+ import type { ColumnTextMatcher } from "./text-search-predicate";
6
7
  export declare const Keys: {
7
8
  useFunction: "useFunction";
8
9
  useInstance: "useInstance";
9
10
  useClass: "useClass";
11
+ useMatcher: "useMatcher";
10
12
  };
11
13
  export type Keys = Enum<typeof Keys>;
12
14
  interface UseFunction<Row> {
@@ -18,8 +20,21 @@ interface UseInstance<Row> {
18
20
  interface UseClass<Row> {
19
21
  [Keys.useClass]: Constructable<ColumnTextSearchFormatter<Row>>;
20
22
  }
21
- export declare function EnableCellTextSearch<Row>(options: UseFunction<Row> | UseInstance<Row> | UseClass<Row>): ClassDecorator;
23
+ interface UseMatcher<Row> {
24
+ [Keys.useMatcher]: ColumnTextMatcher<Row>;
25
+ }
26
+ type FormatterOptions<Row> = UseFunction<Row> | UseInstance<Row> | UseClass<Row>;
27
+ /**
28
+ * A renderer contributes searchable TEXT (a formatter — matched against the escaped literal form
29
+ * of the query), its own MATCHING of the raw query (a matcher — for semantics a literal substring
30
+ * can't express), or both. With a matcher alone the column contributes no text and answers only
31
+ * through the matcher.
32
+ */
33
+ export type CellTextSearchOptions<Row> = FormatterOptions<Row> | UseMatcher<Row> | (FormatterOptions<Row> & UseMatcher<Row>);
34
+ export declare function EnableCellTextSearch<Row>(options: CellTextSearchOptions<Row>): ClassDecorator;
22
35
  export declare namespace EnableCellTextSearch {
23
36
  function getFormatter(renderer: ComponentType<CellRenderer<any>>, useDefault: () => ColumnTextSearchFormatter<any>): ColumnTextSearchFormatter<any>;
37
+ /** Undefined unless the renderer declared `useMatcher` — the column then matches on text alone. */
38
+ function getMatcher(renderer: ComponentType<CellRenderer<any>>): ColumnTextMatcher<any> | undefined;
24
39
  }
25
40
  export {};
@@ -1,10 +1,16 @@
1
- import { AbstractConstructable } from "@coolon/restilence-plugin";
2
- export type TextSearchPredicate<Row> = (row: Row, regex: RegExp) => boolean;
3
- export declare class TextSearchContext<Row> {
4
- readonly row: Row;
5
- readonly searchText: string;
6
- readonly searchRegex: RegExp;
7
- constructor(row: Row, searchText: string, searchRegex: RegExp);
8
- getOrCreate<T>(type: AbstractConstructable<T>, create: () => T): void;
9
- matchesText(text: string): boolean;
10
- }
1
+ /**
2
+ * Tests a row against the current search. `regex` is the escaped literal form of the search text,
3
+ * tested against the text columns contribute (ColumnTextSearchFormatter); `searchText` is the raw
4
+ * query, for columns matching via a ColumnTextMatcher instead.
5
+ */
6
+ export type TextSearchPredicate<Row> = (row: Row, regex: RegExp, searchText?: string) => boolean;
7
+ /**
8
+ * A column's own answer to "does this cell match the query?", given the RAW search text — for
9
+ * search semantics one escaped literal substring can't express, e.g. the category-qualified
10
+ * `loc:depar` = category starts with LOC and name contains "depar". Declared by a cell renderer
11
+ * via `@EnableCellTextSearch({useMatcher})`, so `value` is the renderer's value type: the column's
12
+ * existing row -> value accessor does the projection.
13
+ *
14
+ * A row matches when the joined column text matches the regex OR any column's matcher returns true.
15
+ */
16
+ export type ColumnTextMatcher<V> = (value: V, searchText: string) => boolean;
@@ -11,6 +11,7 @@ export declare class SelectionHeaderCellComponent<Row> extends DisposableCompone
11
11
  isSelected(): boolean;
12
12
  isIntermediate(): boolean;
13
13
  isVisible(): boolean;
14
+ isDisabled(): boolean;
14
15
  isMultiSelectionModel(): boolean;
15
16
  ifMultiSelectionModel<T>(runnable: (model$: MultipleSelectionModel<Row, unknown>) => T, otherwise?: T): T;
16
17
  handleClick(event$: Event): void;
@@ -10,6 +10,8 @@ export declare class SelectionCellComponent<Row> extends DisposableComponent {
10
10
  constructor();
11
11
  select($event: MouseEvent): void;
12
12
  isSelected(): boolean;
13
+ /** Whether this row gets a checkbox at all. */
14
+ isSelectable(): boolean;
13
15
  isDisabled(): boolean;
14
16
  static ɵfac: i0.ɵɵFactoryDeclaration<SelectionCellComponent<any>, never>;
15
17
  static ɵcmp: i0.ɵɵComponentDeclaration<SelectionCellComponent<any>, "aup-selection-cell", never, { "row": { "alias": "row"; "required": false; }; }, {}, never, never, false, never>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coolon/angular-ui-powerups",
3
- "version": "16.1.0-alpha.265",
3
+ "version": "16.1.0-alpha.267",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "^16.2.9",
6
6
  "@angular/common": "^16.2.9",
@@ -12,7 +12,7 @@
12
12
  "@angular/platform-browser-dynamic": "^16.2.9",
13
13
  "@angular/material-moment-adapter": "^16.2.10",
14
14
  "@angular/router": "^16.2.9",
15
- "@coolon/pectin": "^5.0.0-alpha.133",
15
+ "@coolon/pectin": "^5.0.0-alpha.136",
16
16
  "fast-typescript-memoize": "^1.1.1",
17
17
  "lodash-es": "^4.17.21",
18
18
  "marked": "4.0.10",
@@ -46,4 +46,4 @@
46
46
  }
47
47
  },
48
48
  "sideEffects": false
49
- }
49
+ }