@rxap/material-table-system 13.0.3 → 13.1.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.
@@ -1,4 +1,6 @@
1
- export interface SelectRowOptions<RowData = any> {
1
+ export interface SelectRowOptions<RowData = unknown> {
2
2
  multiple?: boolean;
3
3
  selected?: RowData[];
4
+ emitChanges?: boolean;
5
+ compareWith?: (o1: RowData, o2: RowData) => boolean;
4
6
  }
@@ -1,6 +1,6 @@
1
- import { SelectionModel } from '@angular/cdk/collections';
2
1
  import type { Observable } from 'rxjs';
3
2
  import { SelectRowOptions } from './select-row.options';
3
+ import { SelectionModel } from './selection-model';
4
4
  import * as i0 from "@angular/core";
5
5
  export declare class SelectRowService<Data extends Record<string, any>> {
6
6
  selectedRows$: Observable<Data[]>;
@@ -0,0 +1,118 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ import { Subject } from 'rxjs';
9
+ /**
10
+ * Class to be used to power selecting one or more options from a list.
11
+ */
12
+ export declare class SelectionModel<T> {
13
+ private _multiple;
14
+ private _emitChanges;
15
+ compareWith?: ((o1: T, o2: T) => boolean) | undefined;
16
+ /** Currently-selected values. */
17
+ private _selection;
18
+ /** Keeps track of the deselected options that haven't been emitted by the change event. */
19
+ private _deselectedToEmit;
20
+ /** Keeps track of the selected options that haven't been emitted by the change event. */
21
+ private _selectedToEmit;
22
+ /** Cache for the array value of the selected items. */
23
+ private _selected;
24
+ /** Selected values. */
25
+ get selected(): T[];
26
+ /** Event emitted when the value has changed. */
27
+ readonly changed: Subject<SelectionChange<T>>;
28
+ constructor(_multiple?: boolean, initiallySelectedValues?: T[], _emitChanges?: boolean, compareWith?: ((o1: T, o2: T) => boolean) | undefined);
29
+ /**
30
+ * Selects a value or an array of values.
31
+ * @param values The values to select
32
+ * @return Whether the selection changed as a result of this call
33
+ * @breaking-change 16.0.0 make return type boolean
34
+ */
35
+ select(...values: T[]): boolean | void;
36
+ /**
37
+ * Deselects a value or an array of values.
38
+ * @param values The values to deselect
39
+ * @return Whether the selection changed as a result of this call
40
+ * @breaking-change 16.0.0 make return type boolean
41
+ */
42
+ deselect(...values: T[]): boolean | void;
43
+ /**
44
+ * Sets the selected values
45
+ * @param values The new selected values
46
+ * @return Whether the selection changed as a result of this call
47
+ * @breaking-change 16.0.0 make return type boolean
48
+ */
49
+ setSelection(...values: T[]): boolean | void;
50
+ /**
51
+ * Toggles a value between selected and deselected.
52
+ * @param value The value to toggle
53
+ * @return Whether the selection changed as a result of this call
54
+ * @breaking-change 16.0.0 make return type boolean
55
+ */
56
+ toggle(value: T): boolean | void;
57
+ /**
58
+ * Clears all of the selected values.
59
+ * @param flushEvent Whether to flush the changes in an event.
60
+ * If false, the changes to the selection will be flushed along with the next event.
61
+ * @return Whether the selection changed as a result of this call
62
+ * @breaking-change 16.0.0 make return type boolean
63
+ */
64
+ clear(flushEvent?: boolean): boolean | void;
65
+ /**
66
+ * Determines whether a value is selected.
67
+ */
68
+ isSelected(value: T): boolean;
69
+ /**
70
+ * Determines whether the model does not have a value.
71
+ */
72
+ isEmpty(): boolean;
73
+ /**
74
+ * Determines whether the model has a value.
75
+ */
76
+ hasValue(): boolean;
77
+ /**
78
+ * Sorts the selected values based on a predicate function.
79
+ */
80
+ sort(predicate?: (a: T, b: T) => number): void;
81
+ /**
82
+ * Gets whether multiple values can be selected.
83
+ */
84
+ isMultipleSelection(): boolean;
85
+ /** Emits a change event and clears the records of selected and deselected values. */
86
+ private _emitChangeEvent;
87
+ /** Selects a value. */
88
+ private _markSelected;
89
+ /** Deselects a value. */
90
+ private _unmarkSelected;
91
+ /** Clears out the selected values. */
92
+ private _unmarkAll;
93
+ /**
94
+ * Verifies the value assignment and throws an error if the specified value array is
95
+ * including multiple values while the selection model is not supporting multiple values.
96
+ */
97
+ private _verifyValueAssignment;
98
+ /** Whether there are queued up change to be emitted. */
99
+ private _hasQueuedChanges;
100
+ }
101
+ /**
102
+ * Event emitted when the value of a MatSelectionModel has changed.
103
+ * @docs-private
104
+ */
105
+ export interface SelectionChange<T> {
106
+ /** Model that dispatched the event. */
107
+ source: SelectionModel<T>;
108
+ /** Options that were added to the model. */
109
+ added: T[];
110
+ /** Options that were removed from the model. */
111
+ removed: T[];
112
+ }
113
+ /**
114
+ * Returns an error that reports that multiple values are passed into a selection model
115
+ * with a single value.
116
+ * @docs-private
117
+ */
118
+ export declare function getMultipleValuesInSingleSelectionError(): Error;
@@ -1,3 +1,3 @@
1
1
  import { InjectionToken } from '@angular/core';
2
2
  import { SelectRowOptions } from './select-row.options';
3
- export declare const RXAP_MATERIAL_TABLE_SYSTEM_SELECT_ROW_OPTIONS: InjectionToken<SelectRowOptions<any>>;
3
+ export declare const RXAP_MATERIAL_TABLE_SYSTEM_SELECT_ROW_OPTIONS: InjectionToken<SelectRowOptions<unknown>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rxap/material-table-system",
3
- "version": "13.0.3",
3
+ "version": "13.1.0",
4
4
  "peerDependencies": {
5
5
  "@angular-devkit/schematics": "^13.2.4",
6
6
  "@angular/animations": "^13.2.3",
@@ -22,7 +22,7 @@
22
22
  "@rxap/forms": "^13.0.0",
23
23
  "@rxap/material-directives": "^13.0.0",
24
24
  "@rxap/mixin": "^13.0.0",
25
- "@rxap/open-api": "^13.0.0",
25
+ "@rxap/open-api": "^13.0.1",
26
26
  "@rxap/remote-method": "^13.0.0",
27
27
  "@rxap/services": "^13.0.0",
28
28
  "@rxap/utilities": "^13.0.0",