@angular/cdk 19.2.3 → 19.2.4
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/a11y/index.d.ts +12 -843
- package/a11y-module.d-7d03e079.d.ts +313 -0
- package/accordion/index.d.ts +1 -1
- package/activedescendant-key-manager.d-11921e3a.d.ts +31 -0
- package/bidi/index.d.ts +3 -52
- package/bidi-module.d-f8648621.d.ts +53 -0
- package/coercion/index.d.ts +2 -15
- package/collections/index.d.ts +10 -269
- package/data-source.d-7cab2c9d.d.ts +42 -0
- package/dialog/index.d.ts +17 -9
- package/drag-drop/index.d.ts +6 -5
- package/fesm2022/a11y-module-012407f8.mjs +952 -0
- package/fesm2022/a11y-module-012407f8.mjs.map +1 -0
- package/fesm2022/a11y.mjs +33 -2439
- package/fesm2022/a11y.mjs.map +1 -1
- package/fesm2022/accordion.mjs +2 -2
- package/fesm2022/accordion.mjs.map +1 -1
- package/fesm2022/activedescendant-key-manager-1351a9d3.mjs +16 -0
- package/fesm2022/activedescendant-key-manager-1351a9d3.mjs.map +1 -0
- package/fesm2022/array-ee3b4bab.mjs +6 -0
- package/fesm2022/array-ee3b4bab.mjs.map +1 -0
- package/fesm2022/backwards-compatibility-bcbe473e.mjs +25 -0
- package/fesm2022/backwards-compatibility-bcbe473e.mjs.map +1 -0
- package/fesm2022/bidi-module-56dd006c.mjs +78 -0
- package/fesm2022/bidi-module-56dd006c.mjs.map +1 -0
- package/fesm2022/bidi.mjs +4 -143
- package/fesm2022/bidi.mjs.map +1 -1
- package/fesm2022/breakpoints-observer-63bede13.mjs +179 -0
- package/fesm2022/breakpoints-observer-63bede13.mjs.map +1 -0
- package/fesm2022/cdk.mjs +1 -1
- package/fesm2022/cdk.mjs.map +1 -1
- package/fesm2022/coercion/private.mjs +2 -14
- package/fesm2022/coercion/private.mjs.map +1 -1
- package/fesm2022/coercion.mjs +5 -39
- package/fesm2022/coercion.mjs.map +1 -1
- package/fesm2022/collections.mjs +7 -472
- package/fesm2022/collections.mjs.map +1 -1
- package/fesm2022/css-pixel-value-286c9a60.mjs +10 -0
- package/fesm2022/css-pixel-value-286c9a60.mjs.map +1 -0
- package/fesm2022/data-source-5320b6fd.mjs +15 -0
- package/fesm2022/data-source-5320b6fd.mjs.map +1 -0
- package/fesm2022/dialog.mjs +26 -6
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/directionality-0a678adc.mjs +72 -0
- package/fesm2022/directionality-0a678adc.mjs.map +1 -0
- package/fesm2022/dispose-view-repeater-strategy-b11b87ea.mjs +44 -0
- package/fesm2022/dispose-view-repeater-strategy-b11b87ea.mjs.map +1 -0
- package/fesm2022/drag-drop.mjs +14 -6
- package/fesm2022/drag-drop.mjs.map +1 -1
- package/fesm2022/element-705567fe.mjs +29 -0
- package/fesm2022/element-705567fe.mjs.map +1 -0
- package/fesm2022/fake-event-detection-7055b1bd.mjs +24 -0
- package/fesm2022/fake-event-detection-7055b1bd.mjs.map +1 -0
- package/fesm2022/focus-key-manager-58d29acd.mjs +22 -0
- package/fesm2022/focus-key-manager-58d29acd.mjs.map +1 -0
- package/fesm2022/focus-monitor-81212fa3.mjs +629 -0
- package/fesm2022/focus-monitor-81212fa3.mjs.map +1 -0
- package/fesm2022/id-generator-1959b006.mjs +37 -0
- package/fesm2022/id-generator-1959b006.mjs.map +1 -0
- package/fesm2022/keycodes-107cd3e4.mjs +122 -0
- package/fesm2022/keycodes-107cd3e4.mjs.map +1 -0
- package/fesm2022/keycodes.mjs +2 -132
- package/fesm2022/keycodes.mjs.map +1 -1
- package/fesm2022/layout.mjs +8 -176
- package/fesm2022/layout.mjs.map +1 -1
- package/fesm2022/list-key-manager-c7b5cefb.mjs +360 -0
- package/fesm2022/list-key-manager-c7b5cefb.mjs.map +1 -0
- package/fesm2022/listbox.mjs +11 -6
- package/fesm2022/listbox.mjs.map +1 -1
- package/fesm2022/menu.mjs +27 -7
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/modifiers-33a5859e.mjs +13 -0
- package/fesm2022/modifiers-33a5859e.mjs.map +1 -0
- package/fesm2022/observable-97c0792c.mjs +15 -0
- package/fesm2022/observable-97c0792c.mjs.map +1 -0
- package/fesm2022/observe-content-41b1b248.mjs +210 -0
- package/fesm2022/observe-content-41b1b248.mjs.map +1 -0
- package/fesm2022/observers.mjs +5 -209
- package/fesm2022/observers.mjs.map +1 -1
- package/fesm2022/overlay-module-7f527d71.mjs +3029 -0
- package/fesm2022/overlay-module-7f527d71.mjs.map +1 -0
- package/fesm2022/overlay.mjs +25 -3020
- package/fesm2022/overlay.mjs.map +1 -1
- package/fesm2022/passive-listeners-c0bdc49f.mjs +31 -0
- package/fesm2022/passive-listeners-c0bdc49f.mjs.map +1 -0
- package/fesm2022/platform-610a08ae.mjs +77 -0
- package/fesm2022/platform-610a08ae.mjs.map +1 -0
- package/fesm2022/platform.mjs +9 -285
- package/fesm2022/platform.mjs.map +1 -1
- package/fesm2022/portal-directives-06c9f3e0.mjs +653 -0
- package/fesm2022/portal-directives-06c9f3e0.mjs.map +1 -0
- package/fesm2022/portal.mjs +4 -651
- package/fesm2022/portal.mjs.map +1 -1
- package/fesm2022/private.mjs +3 -59
- package/fesm2022/private.mjs.map +1 -1
- package/fesm2022/recycle-view-repeater-strategy-c1712813.mjs +156 -0
- package/fesm2022/recycle-view-repeater-strategy-c1712813.mjs.map +1 -0
- package/fesm2022/scrolling-61955dd1.mjs +99 -0
- package/fesm2022/scrolling-61955dd1.mjs.map +1 -0
- package/fesm2022/scrolling-module-dbd83632.mjs +1463 -0
- package/fesm2022/scrolling-module-dbd83632.mjs.map +1 -0
- package/fesm2022/scrolling.mjs +12 -1459
- package/fesm2022/scrolling.mjs.map +1 -1
- package/fesm2022/selection-model-0f5fc202.mjs +226 -0
- package/fesm2022/selection-model-0f5fc202.mjs.map +1 -0
- package/fesm2022/shadow-dom-9f403d00.mjs +49 -0
- package/fesm2022/shadow-dom-9f403d00.mjs.map +1 -0
- package/fesm2022/stepper.mjs +10 -4
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/style-loader-51b80670.mjs +47 -0
- package/fesm2022/style-loader-51b80670.mjs.map +1 -0
- package/fesm2022/table.mjs +10 -5
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/test-environment-34eef1ee.mjs +19 -0
- package/fesm2022/test-environment-34eef1ee.mjs.map +1 -0
- package/fesm2022/testing/selenium-webdriver.mjs +2 -1
- package/fesm2022/testing/selenium-webdriver.mjs.map +1 -1
- package/fesm2022/testing/testbed.mjs +33 -34
- package/fesm2022/testing/testbed.mjs.map +1 -1
- package/fesm2022/testing.mjs +2 -697
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/text-field.mjs +8 -3
- package/fesm2022/text-field.mjs.map +1 -1
- package/fesm2022/text-filtering-b60ba8a2.mjs +698 -0
- package/fesm2022/text-filtering-b60ba8a2.mjs.map +1 -0
- package/fesm2022/tree-key-manager-2f20c79c.mjs +360 -0
- package/fesm2022/tree-key-manager-2f20c79c.mjs.map +1 -0
- package/fesm2022/tree.mjs +8 -4
- package/fesm2022/tree.mjs.map +1 -1
- package/fesm2022/typeahead-11ae39bd.mjs +88 -0
- package/fesm2022/typeahead-11ae39bd.mjs.map +1 -0
- package/fesm2022/unique-selection-dispatcher-8d1187be.mjs +49 -0
- package/fesm2022/unique-selection-dispatcher-8d1187be.mjs.map +1 -0
- package/fesm2022/visually-hidden-7e8689f8.mjs +18 -0
- package/fesm2022/visually-hidden-7e8689f8.mjs.map +1 -0
- package/focus-key-manager.d-415a6958.d.ts +33 -0
- package/focus-monitor.d-810a02e6.d.ts +209 -0
- package/harness-environment.d-4d615248.d.ts +619 -0
- package/list-key-manager.d-72e9a2e7.d.ts +164 -0
- package/listbox/index.d.ts +4 -3
- package/menu/index.d.ts +14 -6
- package/number-property.d-ce316715.d.ts +15 -0
- package/observe-content.d-c08bc882.d.ts +84 -0
- package/observers/index.d.ts +4 -84
- package/overlay/index.d.ts +15 -1080
- package/overlay-module.d-13717e08.d.ts +790 -0
- package/overlay.d-f1a41275.d.ts +295 -0
- package/package.json +1 -1
- package/platform/index.d.ts +2 -31
- package/platform.d-0a5b4792.d.ts +33 -0
- package/portal/index.d.ts +4 -230
- package/portal-directives.d-ef3fad92.d.ts +231 -0
- package/private/index.d.ts +2 -19
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/scrolling/index.d.ts +7 -604
- package/scrolling-module.d-e181b1be.d.ts +551 -0
- package/selection-model.d-0f0cc883.d.ts +116 -0
- package/stepper/index.d.ts +5 -3
- package/style-loader.d-19baab84.d.ts +21 -0
- package/table/index.d.ts +7 -5
- package/testing/index.d.ts +2 -618
- package/testing/selenium-webdriver/index.d.ts +1 -1
- package/testing/testbed/index.d.ts +1 -1
- package/text-field/index.d.ts +3 -1
- package/tree/index.d.ts +3 -2
- package/tree-key-manager-strategy.d-603161dd.d.ts +116 -0
- package/unique-selection-dispatcher.d-7993b9f5.d.ts +32 -0
- package/view-repeater.d-79039e1f.d.ts +88 -0
- package/viewport-ruler.d-f3d3e82f.d.ts +57 -0
package/fesm2022/cdk.mjs
CHANGED
package/fesm2022/cdk.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk.mjs","sources":["../../../../../../src/cdk/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('19.2.
|
|
1
|
+
{"version":3,"file":"cdk.mjs","sources":["../../../../../../src/cdk/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('19.2.4');\n"],"names":[],"mappings":";;AAUA;MACa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;;;"}
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Given either an Observable or non-Observable value, returns either the original
|
|
5
|
-
* Observable, or wraps it in an Observable that emits the non-Observable value.
|
|
6
|
-
*/
|
|
7
|
-
function coerceObservable(data) {
|
|
8
|
-
if (!isObservable(data)) {
|
|
9
|
-
return of(data);
|
|
10
|
-
}
|
|
11
|
-
return data;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { coerceObservable };
|
|
1
|
+
export { c as coerceObservable } from '../observable-97c0792c.mjs';
|
|
2
|
+
import 'rxjs';
|
|
15
3
|
//# sourceMappingURL=private.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private.mjs","sources":[
|
|
1
|
+
{"version":3,"file":"private.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/fesm2022/coercion.mjs
CHANGED
|
@@ -1,47 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
export { _ as _isNumberValue, c as coerceElement, a as coerceNumberProperty } from './element-705567fe.mjs';
|
|
2
|
+
export { c as coerceArray } from './array-ee3b4bab.mjs';
|
|
3
|
+
export { c as coerceCssPixelValue } from './css-pixel-value-286c9a60.mjs';
|
|
4
|
+
import '@angular/core';
|
|
2
5
|
|
|
3
6
|
/** Coerces a data-bound value (typically a string) to a boolean. */
|
|
4
7
|
function coerceBooleanProperty(value) {
|
|
5
8
|
return value != null && `${value}` !== 'false';
|
|
6
9
|
}
|
|
7
10
|
|
|
8
|
-
function coerceNumberProperty(value, fallbackValue = 0) {
|
|
9
|
-
if (_isNumberValue(value)) {
|
|
10
|
-
return Number(value);
|
|
11
|
-
}
|
|
12
|
-
return arguments.length === 2 ? fallbackValue : 0;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Whether the provided value is considered a number.
|
|
16
|
-
* @docs-private
|
|
17
|
-
*/
|
|
18
|
-
function _isNumberValue(value) {
|
|
19
|
-
// parseFloat(value) handles most of the cases we're interested in (it treats null, empty string,
|
|
20
|
-
// and other non-number values as NaN, where Number just uses 0) but it considers the string
|
|
21
|
-
// '123hello' to be a valid number. Therefore we also check if Number(value) is NaN.
|
|
22
|
-
return !isNaN(parseFloat(value)) && !isNaN(Number(value));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function coerceArray(value) {
|
|
26
|
-
return Array.isArray(value) ? value : [value];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** Coerces a value to a CSS pixel value. */
|
|
30
|
-
function coerceCssPixelValue(value) {
|
|
31
|
-
if (value == null) {
|
|
32
|
-
return '';
|
|
33
|
-
}
|
|
34
|
-
return typeof value === 'string' ? value : `${value}px`;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Coerces an ElementRef or an Element into an element.
|
|
39
|
-
* Useful for APIs that can accept either a ref or the native element itself.
|
|
40
|
-
*/
|
|
41
|
-
function coerceElement(elementOrRef) {
|
|
42
|
-
return elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : elementOrRef;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
11
|
/**
|
|
46
12
|
* Coerces a value to an array of trimmed non-empty strings.
|
|
47
13
|
* Any input that is not an array, `null` or `undefined` will be turned into a string
|
|
@@ -73,5 +39,5 @@ function coerceStringArray(value, separator = /\s+/) {
|
|
|
73
39
|
return result;
|
|
74
40
|
}
|
|
75
41
|
|
|
76
|
-
export {
|
|
42
|
+
export { coerceBooleanProperty, coerceStringArray };
|
|
77
43
|
//# sourceMappingURL=coercion.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coercion.mjs","sources":["../../../../../../src/cdk/coercion/boolean-property.ts","../../../../../../src/cdk/coercion/
|
|
1
|
+
{"version":3,"file":"coercion.mjs","sources":["../../../../../../src/cdk/coercion/boolean-property.ts","../../../../../../src/cdk/coercion/string-array.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * Type describing the allowed values for a boolean input.\n * @docs-private\n */\nexport type BooleanInput = string | boolean | null | undefined;\n\n/** Coerces a data-bound value (typically a string) to a boolean. */\nexport function coerceBooleanProperty(value: any): boolean {\n return value != null && `${value}` !== 'false';\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * Coerces a value to an array of trimmed non-empty strings.\n * Any input that is not an array, `null` or `undefined` will be turned into a string\n * via `toString()` and subsequently split with the given separator.\n * `null` and `undefined` will result in an empty array.\n * This results in the following outcomes:\n * - `null` -> `[]`\n * - `[null]` -> `[\"null\"]`\n * - `[\"a\", \"b \", \" \"]` -> `[\"a\", \"b\"]`\n * - `[1, [2, 3]]` -> `[\"1\", \"2,3\"]`\n * - `[{ a: 0 }]` -> `[\"[object Object]\"]`\n * - `{ a: 0 }` -> `[\"[object\", \"Object]\"]`\n *\n * Useful for defining CSS classes or table columns.\n * @param value the value to coerce into an array of strings\n * @param separator split-separator if value isn't an array\n */\nexport function coerceStringArray(value: any, separator: string | RegExp = /\\s+/): string[] {\n const result = [];\n\n if (value != null) {\n const sourceValues = Array.isArray(value) ? value : `${value}`.split(separator);\n for (const sourceValue of sourceValues) {\n const trimmedString = `${sourceValue}`.trim();\n if (trimmedString) {\n result.push(trimmedString);\n }\n }\n }\n\n return result;\n}\n"],"names":[],"mappings":";;;;;AAcA;AACM,SAAU,qBAAqB,CAAC,KAAU,EAAA;IAC9C,OAAO,KAAK,IAAI,IAAI,IAAI,GAAG,KAAK,CAAA,CAAE,KAAK,OAAO,CAAA;AAChD;;ACTA;;;;;;;;;;;;;;;;AAgBG;SACa,iBAAiB,CAAC,KAAU,EAAE,YAA6B,KAAK,EAAA;IAC9E,MAAM,MAAM,GAAG,EAAE,CAAA;AAEjB,IAAA,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAA,EAAG,KAAK,CAAA,CAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;AAC/E,QAAA,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;YACtC,MAAM,aAAa,GAAG,CAAG,EAAA,WAAW,EAAE,CAAC,IAAI,EAAE,CAAA;YAC7C,IAAI,aAAa,EAAE;AACjB,gBAAA,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;aAC5B;SACF;KACF;AAEA,IAAA,OAAO,MAAM,CAAA;AACf;;;;"}
|
package/fesm2022/collections.mjs
CHANGED
|
@@ -1,473 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function isDataSource(value) {
|
|
9
|
-
// Check if the value is a DataSource by observing if it has a connect function. Cannot
|
|
10
|
-
// be checked as an `instanceof DataSource` since people could create their own sources
|
|
11
|
-
// that match the interface, but don't extend DataSource. We also can't use `isObservable`
|
|
12
|
-
// here, because of some internal apps.
|
|
13
|
-
return value && typeof value.connect === 'function' && !(value instanceof ConnectableObservable);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/** DataSource wrapper for a native array. */
|
|
17
|
-
class ArrayDataSource extends DataSource {
|
|
18
|
-
_data;
|
|
19
|
-
constructor(_data) {
|
|
20
|
-
super();
|
|
21
|
-
this._data = _data;
|
|
22
|
-
}
|
|
23
|
-
connect() {
|
|
24
|
-
return isObservable(this._data) ? this._data : of(this._data);
|
|
25
|
-
}
|
|
26
|
-
disconnect() { }
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** Indicates how a view was changed by a {@link _ViewRepeater}. */
|
|
30
|
-
var _ViewRepeaterOperation;
|
|
31
|
-
(function (_ViewRepeaterOperation) {
|
|
32
|
-
/** The content of an existing view was replaced with another item. */
|
|
33
|
-
_ViewRepeaterOperation[_ViewRepeaterOperation["REPLACED"] = 0] = "REPLACED";
|
|
34
|
-
/** A new view was created with `createEmbeddedView`. */
|
|
35
|
-
_ViewRepeaterOperation[_ViewRepeaterOperation["INSERTED"] = 1] = "INSERTED";
|
|
36
|
-
/** The position of a view changed, but the content remains the same. */
|
|
37
|
-
_ViewRepeaterOperation[_ViewRepeaterOperation["MOVED"] = 2] = "MOVED";
|
|
38
|
-
/** A view was detached from the view container. */
|
|
39
|
-
_ViewRepeaterOperation[_ViewRepeaterOperation["REMOVED"] = 3] = "REMOVED";
|
|
40
|
-
})(_ViewRepeaterOperation || (_ViewRepeaterOperation = {}));
|
|
41
|
-
/**
|
|
42
|
-
* Injection token for {@link _ViewRepeater}. This token is for use by Angular Material only.
|
|
43
|
-
* @docs-private
|
|
44
|
-
*/
|
|
45
|
-
const _VIEW_REPEATER_STRATEGY = new InjectionToken('_ViewRepeater');
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* A repeater that destroys views when they are removed from a
|
|
49
|
-
* {@link ViewContainerRef}. When new items are inserted into the container,
|
|
50
|
-
* the repeater will always construct a new embedded view for each item.
|
|
51
|
-
*
|
|
52
|
-
* @template T The type for the embedded view's $implicit property.
|
|
53
|
-
* @template R The type for the item in each IterableDiffer change record.
|
|
54
|
-
* @template C The type for the context passed to each embedded view.
|
|
55
|
-
*/
|
|
56
|
-
class _DisposeViewRepeaterStrategy {
|
|
57
|
-
applyChanges(changes, viewContainerRef, itemContextFactory, itemValueResolver, itemViewChanged) {
|
|
58
|
-
changes.forEachOperation((record, adjustedPreviousIndex, currentIndex) => {
|
|
59
|
-
let view;
|
|
60
|
-
let operation;
|
|
61
|
-
if (record.previousIndex == null) {
|
|
62
|
-
const insertContext = itemContextFactory(record, adjustedPreviousIndex, currentIndex);
|
|
63
|
-
view = viewContainerRef.createEmbeddedView(insertContext.templateRef, insertContext.context, insertContext.index);
|
|
64
|
-
operation = _ViewRepeaterOperation.INSERTED;
|
|
65
|
-
}
|
|
66
|
-
else if (currentIndex == null) {
|
|
67
|
-
viewContainerRef.remove(adjustedPreviousIndex);
|
|
68
|
-
operation = _ViewRepeaterOperation.REMOVED;
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
view = viewContainerRef.get(adjustedPreviousIndex);
|
|
72
|
-
viewContainerRef.move(view, currentIndex);
|
|
73
|
-
operation = _ViewRepeaterOperation.MOVED;
|
|
74
|
-
}
|
|
75
|
-
if (itemViewChanged) {
|
|
76
|
-
itemViewChanged({
|
|
77
|
-
context: view?.context,
|
|
78
|
-
operation,
|
|
79
|
-
record,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
detach() { }
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* A repeater that caches views when they are removed from a
|
|
89
|
-
* {@link ViewContainerRef}. When new items are inserted into the container,
|
|
90
|
-
* the repeater will reuse one of the cached views instead of creating a new
|
|
91
|
-
* embedded view. Recycling cached views reduces the quantity of expensive DOM
|
|
92
|
-
* inserts.
|
|
93
|
-
*
|
|
94
|
-
* @template T The type for the embedded view's $implicit property.
|
|
95
|
-
* @template R The type for the item in each IterableDiffer change record.
|
|
96
|
-
* @template C The type for the context passed to each embedded view.
|
|
97
|
-
*/
|
|
98
|
-
class _RecycleViewRepeaterStrategy {
|
|
99
|
-
/**
|
|
100
|
-
* The size of the cache used to store unused views.
|
|
101
|
-
* Setting the cache size to `0` will disable caching. Defaults to 20 views.
|
|
102
|
-
*/
|
|
103
|
-
viewCacheSize = 20;
|
|
104
|
-
/**
|
|
105
|
-
* View cache that stores embedded view instances that have been previously stamped out,
|
|
106
|
-
* but don't are not currently rendered. The view repeater will reuse these views rather than
|
|
107
|
-
* creating brand new ones.
|
|
108
|
-
*
|
|
109
|
-
* TODO(michaeljamesparsons) Investigate whether using a linked list would improve performance.
|
|
110
|
-
*/
|
|
111
|
-
_viewCache = [];
|
|
112
|
-
/** Apply changes to the DOM. */
|
|
113
|
-
applyChanges(changes, viewContainerRef, itemContextFactory, itemValueResolver, itemViewChanged) {
|
|
114
|
-
// Rearrange the views to put them in the right location.
|
|
115
|
-
changes.forEachOperation((record, adjustedPreviousIndex, currentIndex) => {
|
|
116
|
-
let view;
|
|
117
|
-
let operation;
|
|
118
|
-
if (record.previousIndex == null) {
|
|
119
|
-
// Item added.
|
|
120
|
-
const viewArgsFactory = () => itemContextFactory(record, adjustedPreviousIndex, currentIndex);
|
|
121
|
-
view = this._insertView(viewArgsFactory, currentIndex, viewContainerRef, itemValueResolver(record));
|
|
122
|
-
operation = view ? _ViewRepeaterOperation.INSERTED : _ViewRepeaterOperation.REPLACED;
|
|
123
|
-
}
|
|
124
|
-
else if (currentIndex == null) {
|
|
125
|
-
// Item removed.
|
|
126
|
-
this._detachAndCacheView(adjustedPreviousIndex, viewContainerRef);
|
|
127
|
-
operation = _ViewRepeaterOperation.REMOVED;
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
// Item moved.
|
|
131
|
-
view = this._moveView(adjustedPreviousIndex, currentIndex, viewContainerRef, itemValueResolver(record));
|
|
132
|
-
operation = _ViewRepeaterOperation.MOVED;
|
|
133
|
-
}
|
|
134
|
-
if (itemViewChanged) {
|
|
135
|
-
itemViewChanged({
|
|
136
|
-
context: view?.context,
|
|
137
|
-
operation,
|
|
138
|
-
record,
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
detach() {
|
|
144
|
-
for (const view of this._viewCache) {
|
|
145
|
-
view.destroy();
|
|
146
|
-
}
|
|
147
|
-
this._viewCache = [];
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Inserts a view for a new item, either from the cache or by creating a new
|
|
151
|
-
* one. Returns `undefined` if the item was inserted into a cached view.
|
|
152
|
-
*/
|
|
153
|
-
_insertView(viewArgsFactory, currentIndex, viewContainerRef, value) {
|
|
154
|
-
const cachedView = this._insertViewFromCache(currentIndex, viewContainerRef);
|
|
155
|
-
if (cachedView) {
|
|
156
|
-
cachedView.context.$implicit = value;
|
|
157
|
-
return undefined;
|
|
158
|
-
}
|
|
159
|
-
const viewArgs = viewArgsFactory();
|
|
160
|
-
return viewContainerRef.createEmbeddedView(viewArgs.templateRef, viewArgs.context, viewArgs.index);
|
|
161
|
-
}
|
|
162
|
-
/** Detaches the view at the given index and inserts into the view cache. */
|
|
163
|
-
_detachAndCacheView(index, viewContainerRef) {
|
|
164
|
-
const detachedView = viewContainerRef.detach(index);
|
|
165
|
-
this._maybeCacheView(detachedView, viewContainerRef);
|
|
166
|
-
}
|
|
167
|
-
/** Moves view at the previous index to the current index. */
|
|
168
|
-
_moveView(adjustedPreviousIndex, currentIndex, viewContainerRef, value) {
|
|
169
|
-
const view = viewContainerRef.get(adjustedPreviousIndex);
|
|
170
|
-
viewContainerRef.move(view, currentIndex);
|
|
171
|
-
view.context.$implicit = value;
|
|
172
|
-
return view;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Cache the given detached view. If the cache is full, the view will be
|
|
176
|
-
* destroyed.
|
|
177
|
-
*/
|
|
178
|
-
_maybeCacheView(view, viewContainerRef) {
|
|
179
|
-
if (this._viewCache.length < this.viewCacheSize) {
|
|
180
|
-
this._viewCache.push(view);
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
const index = viewContainerRef.indexOf(view);
|
|
184
|
-
// The host component could remove views from the container outside of
|
|
185
|
-
// the view repeater. It's unlikely this will occur, but just in case,
|
|
186
|
-
// destroy the view on its own, otherwise destroy it through the
|
|
187
|
-
// container to ensure that all the references are removed.
|
|
188
|
-
if (index === -1) {
|
|
189
|
-
view.destroy();
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
viewContainerRef.remove(index);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
/** Inserts a recycled view from the cache at the given index. */
|
|
197
|
-
_insertViewFromCache(index, viewContainerRef) {
|
|
198
|
-
const cachedView = this._viewCache.pop();
|
|
199
|
-
if (cachedView) {
|
|
200
|
-
viewContainerRef.insert(cachedView, index);
|
|
201
|
-
}
|
|
202
|
-
return cachedView || null;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Class to be used to power selecting one or more options from a list.
|
|
208
|
-
*/
|
|
209
|
-
class SelectionModel {
|
|
210
|
-
_multiple;
|
|
211
|
-
_emitChanges;
|
|
212
|
-
compareWith;
|
|
213
|
-
/** Currently-selected values. */
|
|
214
|
-
_selection = new Set();
|
|
215
|
-
/** Keeps track of the deselected options that haven't been emitted by the change event. */
|
|
216
|
-
_deselectedToEmit = [];
|
|
217
|
-
/** Keeps track of the selected options that haven't been emitted by the change event. */
|
|
218
|
-
_selectedToEmit = [];
|
|
219
|
-
/** Cache for the array value of the selected items. */
|
|
220
|
-
_selected;
|
|
221
|
-
/** Selected values. */
|
|
222
|
-
get selected() {
|
|
223
|
-
if (!this._selected) {
|
|
224
|
-
this._selected = Array.from(this._selection.values());
|
|
225
|
-
}
|
|
226
|
-
return this._selected;
|
|
227
|
-
}
|
|
228
|
-
/** Event emitted when the value has changed. */
|
|
229
|
-
changed = new Subject();
|
|
230
|
-
constructor(_multiple = false, initiallySelectedValues, _emitChanges = true, compareWith) {
|
|
231
|
-
this._multiple = _multiple;
|
|
232
|
-
this._emitChanges = _emitChanges;
|
|
233
|
-
this.compareWith = compareWith;
|
|
234
|
-
if (initiallySelectedValues && initiallySelectedValues.length) {
|
|
235
|
-
if (_multiple) {
|
|
236
|
-
initiallySelectedValues.forEach(value => this._markSelected(value));
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
239
|
-
this._markSelected(initiallySelectedValues[0]);
|
|
240
|
-
}
|
|
241
|
-
// Clear the array in order to avoid firing the change event for preselected values.
|
|
242
|
-
this._selectedToEmit.length = 0;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Selects a value or an array of values.
|
|
247
|
-
* @param values The values to select
|
|
248
|
-
* @return Whether the selection changed as a result of this call
|
|
249
|
-
* @breaking-change 16.0.0 make return type boolean
|
|
250
|
-
*/
|
|
251
|
-
select(...values) {
|
|
252
|
-
this._verifyValueAssignment(values);
|
|
253
|
-
values.forEach(value => this._markSelected(value));
|
|
254
|
-
const changed = this._hasQueuedChanges();
|
|
255
|
-
this._emitChangeEvent();
|
|
256
|
-
return changed;
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Deselects a value or an array of values.
|
|
260
|
-
* @param values The values to deselect
|
|
261
|
-
* @return Whether the selection changed as a result of this call
|
|
262
|
-
* @breaking-change 16.0.0 make return type boolean
|
|
263
|
-
*/
|
|
264
|
-
deselect(...values) {
|
|
265
|
-
this._verifyValueAssignment(values);
|
|
266
|
-
values.forEach(value => this._unmarkSelected(value));
|
|
267
|
-
const changed = this._hasQueuedChanges();
|
|
268
|
-
this._emitChangeEvent();
|
|
269
|
-
return changed;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Sets the selected values
|
|
273
|
-
* @param values The new selected values
|
|
274
|
-
* @return Whether the selection changed as a result of this call
|
|
275
|
-
* @breaking-change 16.0.0 make return type boolean
|
|
276
|
-
*/
|
|
277
|
-
setSelection(...values) {
|
|
278
|
-
this._verifyValueAssignment(values);
|
|
279
|
-
const oldValues = this.selected;
|
|
280
|
-
const newSelectedSet = new Set(values.map(value => this._getConcreteValue(value)));
|
|
281
|
-
values.forEach(value => this._markSelected(value));
|
|
282
|
-
oldValues
|
|
283
|
-
.filter(value => !newSelectedSet.has(this._getConcreteValue(value, newSelectedSet)))
|
|
284
|
-
.forEach(value => this._unmarkSelected(value));
|
|
285
|
-
const changed = this._hasQueuedChanges();
|
|
286
|
-
this._emitChangeEvent();
|
|
287
|
-
return changed;
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Toggles a value between selected and deselected.
|
|
291
|
-
* @param value The value to toggle
|
|
292
|
-
* @return Whether the selection changed as a result of this call
|
|
293
|
-
* @breaking-change 16.0.0 make return type boolean
|
|
294
|
-
*/
|
|
295
|
-
toggle(value) {
|
|
296
|
-
return this.isSelected(value) ? this.deselect(value) : this.select(value);
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Clears all of the selected values.
|
|
300
|
-
* @param flushEvent Whether to flush the changes in an event.
|
|
301
|
-
* If false, the changes to the selection will be flushed along with the next event.
|
|
302
|
-
* @return Whether the selection changed as a result of this call
|
|
303
|
-
* @breaking-change 16.0.0 make return type boolean
|
|
304
|
-
*/
|
|
305
|
-
clear(flushEvent = true) {
|
|
306
|
-
this._unmarkAll();
|
|
307
|
-
const changed = this._hasQueuedChanges();
|
|
308
|
-
if (flushEvent) {
|
|
309
|
-
this._emitChangeEvent();
|
|
310
|
-
}
|
|
311
|
-
return changed;
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* Determines whether a value is selected.
|
|
315
|
-
*/
|
|
316
|
-
isSelected(value) {
|
|
317
|
-
return this._selection.has(this._getConcreteValue(value));
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* Determines whether the model does not have a value.
|
|
321
|
-
*/
|
|
322
|
-
isEmpty() {
|
|
323
|
-
return this._selection.size === 0;
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* Determines whether the model has a value.
|
|
327
|
-
*/
|
|
328
|
-
hasValue() {
|
|
329
|
-
return !this.isEmpty();
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* Sorts the selected values based on a predicate function.
|
|
333
|
-
*/
|
|
334
|
-
sort(predicate) {
|
|
335
|
-
if (this._multiple && this.selected) {
|
|
336
|
-
this._selected.sort(predicate);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* Gets whether multiple values can be selected.
|
|
341
|
-
*/
|
|
342
|
-
isMultipleSelection() {
|
|
343
|
-
return this._multiple;
|
|
344
|
-
}
|
|
345
|
-
/** Emits a change event and clears the records of selected and deselected values. */
|
|
346
|
-
_emitChangeEvent() {
|
|
347
|
-
// Clear the selected values so they can be re-cached.
|
|
348
|
-
this._selected = null;
|
|
349
|
-
if (this._selectedToEmit.length || this._deselectedToEmit.length) {
|
|
350
|
-
this.changed.next({
|
|
351
|
-
source: this,
|
|
352
|
-
added: this._selectedToEmit,
|
|
353
|
-
removed: this._deselectedToEmit,
|
|
354
|
-
});
|
|
355
|
-
this._deselectedToEmit = [];
|
|
356
|
-
this._selectedToEmit = [];
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
/** Selects a value. */
|
|
360
|
-
_markSelected(value) {
|
|
361
|
-
value = this._getConcreteValue(value);
|
|
362
|
-
if (!this.isSelected(value)) {
|
|
363
|
-
if (!this._multiple) {
|
|
364
|
-
this._unmarkAll();
|
|
365
|
-
}
|
|
366
|
-
if (!this.isSelected(value)) {
|
|
367
|
-
this._selection.add(value);
|
|
368
|
-
}
|
|
369
|
-
if (this._emitChanges) {
|
|
370
|
-
this._selectedToEmit.push(value);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
/** Deselects a value. */
|
|
375
|
-
_unmarkSelected(value) {
|
|
376
|
-
value = this._getConcreteValue(value);
|
|
377
|
-
if (this.isSelected(value)) {
|
|
378
|
-
this._selection.delete(value);
|
|
379
|
-
if (this._emitChanges) {
|
|
380
|
-
this._deselectedToEmit.push(value);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
/** Clears out the selected values. */
|
|
385
|
-
_unmarkAll() {
|
|
386
|
-
if (!this.isEmpty()) {
|
|
387
|
-
this._selection.forEach(value => this._unmarkSelected(value));
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Verifies the value assignment and throws an error if the specified value array is
|
|
392
|
-
* including multiple values while the selection model is not supporting multiple values.
|
|
393
|
-
*/
|
|
394
|
-
_verifyValueAssignment(values) {
|
|
395
|
-
if (values.length > 1 && !this._multiple && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
396
|
-
throw getMultipleValuesInSingleSelectionError();
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
/** Whether there are queued up change to be emitted. */
|
|
400
|
-
_hasQueuedChanges() {
|
|
401
|
-
return !!(this._deselectedToEmit.length || this._selectedToEmit.length);
|
|
402
|
-
}
|
|
403
|
-
/** Returns a value that is comparable to inputValue by applying compareWith function, returns the same inputValue otherwise. */
|
|
404
|
-
_getConcreteValue(inputValue, selection) {
|
|
405
|
-
if (!this.compareWith) {
|
|
406
|
-
return inputValue;
|
|
407
|
-
}
|
|
408
|
-
else {
|
|
409
|
-
selection = selection ?? this._selection;
|
|
410
|
-
for (let selectedValue of selection) {
|
|
411
|
-
if (this.compareWith(inputValue, selectedValue)) {
|
|
412
|
-
return selectedValue;
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
return inputValue;
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* Returns an error that reports that multiple values are passed into a selection model
|
|
421
|
-
* with a single value.
|
|
422
|
-
* @docs-private
|
|
423
|
-
*/
|
|
424
|
-
function getMultipleValuesInSingleSelectionError() {
|
|
425
|
-
return Error('Cannot pass multiple values into SelectionModel with single-value mode.');
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
/**
|
|
429
|
-
* Class to coordinate unique selection based on name.
|
|
430
|
-
* Intended to be consumed as an Angular service.
|
|
431
|
-
* This service is needed because native radio change events are only fired on the item currently
|
|
432
|
-
* being selected, and we still need to uncheck the previous selection.
|
|
433
|
-
*
|
|
434
|
-
* This service does not *store* any IDs and names because they may change at any time, so it is
|
|
435
|
-
* less error-prone if they are simply passed through when the events occur.
|
|
436
|
-
*/
|
|
437
|
-
class UniqueSelectionDispatcher {
|
|
438
|
-
_listeners = [];
|
|
439
|
-
/**
|
|
440
|
-
* Notify other items that selection for the given name has been set.
|
|
441
|
-
* @param id ID of the item.
|
|
442
|
-
* @param name Name of the item.
|
|
443
|
-
*/
|
|
444
|
-
notify(id, name) {
|
|
445
|
-
for (let listener of this._listeners) {
|
|
446
|
-
listener(id, name);
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* Listen for future changes to item selection.
|
|
451
|
-
* @return Function used to deregister listener
|
|
452
|
-
*/
|
|
453
|
-
listen(listener) {
|
|
454
|
-
this._listeners.push(listener);
|
|
455
|
-
return () => {
|
|
456
|
-
this._listeners = this._listeners.filter((registered) => {
|
|
457
|
-
return listener !== registered;
|
|
458
|
-
});
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
|
-
ngOnDestroy() {
|
|
462
|
-
this._listeners = [];
|
|
463
|
-
}
|
|
464
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: UniqueSelectionDispatcher, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
465
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: UniqueSelectionDispatcher, providedIn: 'root' });
|
|
466
|
-
}
|
|
467
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: UniqueSelectionDispatcher, decorators: [{
|
|
468
|
-
type: Injectable,
|
|
469
|
-
args: [{ providedIn: 'root' }]
|
|
470
|
-
}] });
|
|
471
|
-
|
|
472
|
-
export { ArrayDataSource, DataSource, SelectionModel, UniqueSelectionDispatcher, _DisposeViewRepeaterStrategy, _RecycleViewRepeaterStrategy, _VIEW_REPEATER_STRATEGY, _ViewRepeaterOperation, getMultipleValuesInSingleSelectionError, isDataSource };
|
|
1
|
+
export { U as UniqueSelectionDispatcher } from './unique-selection-dispatcher-8d1187be.mjs';
|
|
2
|
+
export { A as ArrayDataSource, _ as _RecycleViewRepeaterStrategy, b as _VIEW_REPEATER_STRATEGY, a as _ViewRepeaterOperation } from './recycle-view-repeater-strategy-c1712813.mjs';
|
|
3
|
+
export { D as DataSource, i as isDataSource } from './data-source-5320b6fd.mjs';
|
|
4
|
+
export { _ as _DisposeViewRepeaterStrategy } from './dispose-view-repeater-strategy-b11b87ea.mjs';
|
|
5
|
+
export { S as SelectionModel, g as getMultipleValuesInSingleSelectionError } from './selection-model-0f5fc202.mjs';
|
|
6
|
+
import '@angular/core';
|
|
7
|
+
import 'rxjs';
|
|
473
8
|
//# sourceMappingURL=collections.mjs.map
|