@rossigee/clarity-angular 18.2.1-fixed → 18.2.1
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/fesm2022/clr-angular-accordion.mjs +355 -0
- package/fesm2022/clr-angular-accordion.mjs.map +1 -0
- package/fesm2022/clr-angular-button.mjs +713 -0
- package/fesm2022/clr-angular-button.mjs.map +1 -0
- package/fesm2022/clr-angular-collapsible-panel.mjs +201 -0
- package/fesm2022/clr-angular-collapsible-panel.mjs.map +1 -0
- package/fesm2022/clr-angular-data-datagrid.mjs +7635 -0
- package/fesm2022/clr-angular-data-datagrid.mjs.map +1 -0
- package/fesm2022/clr-angular-data-stack-view.mjs +442 -0
- package/fesm2022/clr-angular-data-stack-view.mjs.map +1 -0
- package/fesm2022/clr-angular-data-tree-view.mjs +1106 -0
- package/fesm2022/clr-angular-data-tree-view.mjs.map +1 -0
- package/fesm2022/clr-angular-data.mjs +40 -0
- package/fesm2022/clr-angular-data.mjs.map +1 -0
- package/fesm2022/clr-angular-emphasis-alert.mjs +624 -0
- package/fesm2022/clr-angular-emphasis-alert.mjs.map +1 -0
- package/fesm2022/clr-angular-emphasis-badge.mjs +69 -0
- package/fesm2022/clr-angular-emphasis-badge.mjs.map +1 -0
- package/fesm2022/clr-angular-emphasis-common.mjs +25 -0
- package/fesm2022/clr-angular-emphasis-common.mjs.map +1 -0
- package/fesm2022/clr-angular-emphasis-label.mjs +105 -0
- package/fesm2022/clr-angular-emphasis-label.mjs.map +1 -0
- package/fesm2022/clr-angular-emphasis.mjs +41 -0
- package/fesm2022/clr-angular-emphasis.mjs.map +1 -0
- package/fesm2022/clr-angular-forms-checkbox.mjs +270 -0
- package/fesm2022/clr-angular-forms-checkbox.mjs.map +1 -0
- package/fesm2022/clr-angular-forms-combobox.mjs +1775 -0
- package/fesm2022/clr-angular-forms-combobox.mjs.map +1 -0
- package/fesm2022/clr-angular-forms-common.mjs +1251 -0
- package/fesm2022/clr-angular-forms-common.mjs.map +1 -0
- package/fesm2022/clr-angular-forms-datalist.mjs +263 -0
- package/fesm2022/clr-angular-forms-datalist.mjs.map +1 -0
- package/fesm2022/clr-angular-forms-datepicker.mjs +3274 -0
- package/fesm2022/clr-angular-forms-datepicker.mjs.map +1 -0
- package/fesm2022/clr-angular-forms-file-input.mjs +826 -0
- package/fesm2022/clr-angular-forms-file-input.mjs.map +1 -0
- package/fesm2022/clr-angular-forms-input.mjs +153 -0
- package/fesm2022/clr-angular-forms-input.mjs.map +1 -0
- package/fesm2022/clr-angular-forms-number-input.mjs +236 -0
- package/fesm2022/clr-angular-forms-number-input.mjs.map +1 -0
- package/fesm2022/clr-angular-forms-password.mjs +233 -0
- package/fesm2022/clr-angular-forms-password.mjs.map +1 -0
- package/fesm2022/clr-angular-forms-radio.mjs +231 -0
- package/fesm2022/clr-angular-forms-radio.mjs.map +1 -0
- package/fesm2022/clr-angular-forms-range.mjs +186 -0
- package/fesm2022/clr-angular-forms-range.mjs.map +1 -0
- package/fesm2022/clr-angular-forms-select.mjs +153 -0
- package/fesm2022/clr-angular-forms-select.mjs.map +1 -0
- package/fesm2022/clr-angular-forms-textarea.mjs +136 -0
- package/fesm2022/clr-angular-forms-textarea.mjs.map +1 -0
- package/fesm2022/clr-angular-forms.mjs +100 -0
- package/fesm2022/clr-angular-forms.mjs.map +1 -0
- package/fesm2022/clr-angular-icon.mjs +7397 -0
- package/fesm2022/clr-angular-icon.mjs.map +1 -0
- package/fesm2022/clr-angular-layout-breadcrumbs.mjs +120 -0
- package/fesm2022/clr-angular-layout-breadcrumbs.mjs.map +1 -0
- package/fesm2022/clr-angular-layout-main-container.mjs +100 -0
- package/fesm2022/clr-angular-layout-main-container.mjs.map +1 -0
- package/fesm2022/clr-angular-layout-nav.mjs +582 -0
- package/fesm2022/clr-angular-layout-nav.mjs.map +1 -0
- package/fesm2022/clr-angular-layout-tabs.mjs +807 -0
- package/fesm2022/clr-angular-layout-tabs.mjs.map +1 -0
- package/fesm2022/clr-angular-layout-vertical-nav.mjs +507 -0
- package/fesm2022/clr-angular-layout-vertical-nav.mjs.map +1 -0
- package/fesm2022/clr-angular-layout.mjs +44 -0
- package/fesm2022/clr-angular-layout.mjs.map +1 -0
- package/fesm2022/clr-angular-modal.mjs +617 -0
- package/fesm2022/clr-angular-modal.mjs.map +1 -0
- package/fesm2022/clr-angular-popover-common.mjs +1082 -0
- package/fesm2022/clr-angular-popover-common.mjs.map +1 -0
- package/fesm2022/clr-angular-popover-dropdown.mjs +492 -0
- package/fesm2022/clr-angular-popover-dropdown.mjs.map +1 -0
- package/fesm2022/clr-angular-popover-signpost.mjs +494 -0
- package/fesm2022/clr-angular-popover-signpost.mjs.map +1 -0
- package/fesm2022/clr-angular-popover-tooltip.mjs +293 -0
- package/fesm2022/clr-angular-popover-tooltip.mjs.map +1 -0
- package/fesm2022/clr-angular-popover.mjs +41 -0
- package/fesm2022/clr-angular-popover.mjs.map +1 -0
- package/fesm2022/clr-angular-progress-progress-bars.mjs +217 -0
- package/fesm2022/clr-angular-progress-progress-bars.mjs.map +1 -0
- package/fesm2022/clr-angular-progress-spinner.mjs +132 -0
- package/fesm2022/clr-angular-progress-spinner.mjs.map +1 -0
- package/fesm2022/clr-angular-stepper.mjs +694 -0
- package/fesm2022/clr-angular-stepper.mjs.map +1 -0
- package/fesm2022/clr-angular-timeline.mjs +316 -0
- package/fesm2022/clr-angular-timeline.mjs.map +1 -0
- package/fesm2022/clr-angular-utils-conditional.mjs +351 -0
- package/fesm2022/clr-angular-utils-conditional.mjs.map +1 -0
- package/fesm2022/clr-angular-utils-loading.mjs +107 -0
- package/fesm2022/clr-angular-utils-loading.mjs.map +1 -0
- package/fesm2022/clr-angular-utils.mjs +2079 -0
- package/fesm2022/clr-angular-utils.mjs.map +1 -0
- package/fesm2022/clr-angular-wizard.mjs +3074 -0
- package/fesm2022/clr-angular-wizard.mjs.map +1 -0
- package/fesm2022/{rossigee-clarity-angular.mjs → clr-angular.mjs} +2 -2
- package/fesm2022/clr-angular.mjs.map +1 -0
- package/package.json +105 -103
- package/schematics/ng-update/index.d.ts +2 -0
- package/schematics/ng-update/index.js +69 -0
- package/schematics/ng-update/index.js.map +1 -0
- package/schematics/ng-update/migrations/css-migration.d.ts +6 -0
- package/schematics/ng-update/migrations/css-migration.js +177 -0
- package/schematics/ng-update/migrations/css-migration.js.map +1 -0
- package/schematics/ng-update/migrations/import-migration.d.ts +4 -0
- package/schematics/ng-update/migrations/import-migration.js +187 -0
- package/schematics/ng-update/migrations/import-migration.js.map +1 -0
- package/schematics/ng-update/migrations/template-migration.d.ts +6 -0
- package/schematics/ng-update/migrations/template-migration.js +261 -0
- package/schematics/ng-update/migrations/template-migration.js.map +1 -0
- package/schematics/ng-update/replacements/css-replacements.d.ts +17 -0
- package/schematics/ng-update/replacements/css-replacements.js +74 -0
- package/schematics/ng-update/replacements/css-replacements.js.map +1 -0
- package/schematics/ng-update/replacements/import-replacements.d.ts +13 -0
- package/schematics/ng-update/replacements/import-replacements.js +108 -0
- package/schematics/ng-update/replacements/import-replacements.js.map +1 -0
- package/schematics/ng-update/replacements/symbol-replacements.d.ts +12 -0
- package/schematics/ng-update/replacements/symbol-replacements.js +67 -0
- package/schematics/ng-update/replacements/symbol-replacements.js.map +1 -0
- package/schematics/ng-update/replacements/template-replacements.d.ts +19 -0
- package/schematics/ng-update/replacements/template-replacements.js +57 -0
- package/schematics/ng-update/replacements/template-replacements.js.map +1 -0
- package/schematics/ng-update/tests/test-helpers.d.ts +6 -0
- package/schematics/ng-update/tests/test-helpers.js +34 -0
- package/schematics/ng-update/tests/test-helpers.js.map +1 -0
- package/schematics/ng-update/utils/file-visitor.d.ts +8 -0
- package/schematics/ng-update/utils/file-visitor.js +44 -0
- package/schematics/ng-update/utils/file-visitor.js.map +1 -0
- package/schematics/ng-update/utils/regexp-utils.d.ts +16 -0
- package/schematics/ng-update/utils/regexp-utils.js +34 -0
- package/schematics/ng-update/utils/regexp-utils.js.map +1 -0
- package/schematics/vitest.config.d.ts +2 -0
- package/schematics/vitest.config.js +17 -0
- package/schematics/vitest.config.js.map +1 -0
- package/types/clr-angular-accordion.d.ts +100 -0
- package/types/clr-angular-button.d.ts +169 -0
- package/types/clr-angular-collapsible-panel.d.ts +73 -0
- package/types/clr-angular-data-datagrid.d.ts +1843 -0
- package/types/clr-angular-data-stack-view.d.ts +87 -0
- package/types/clr-angular-data-tree-view.d.ts +229 -0
- package/types/clr-angular-data.d.ts +15 -0
- package/types/clr-angular-emphasis-alert.d.ts +175 -0
- package/types/clr-angular-emphasis-badge.d.ts +25 -0
- package/types/clr-angular-emphasis-common.d.ts +6 -0
- package/types/clr-angular-emphasis-label.d.ts +29 -0
- package/types/clr-angular-emphasis.d.ts +15 -0
- package/types/clr-angular-forms-checkbox.d.ts +69 -0
- package/types/clr-angular-forms-combobox.d.ts +353 -0
- package/types/clr-angular-forms-common.d.ts +339 -0
- package/types/clr-angular-forms-datalist.d.ts +59 -0
- package/types/clr-angular-forms-datepicker.d.ts +986 -0
- package/types/clr-angular-forms-file-input.d.ts +193 -0
- package/types/clr-angular-forms-input.d.ts +29 -0
- package/types/clr-angular-forms-number-input.d.ts +43 -0
- package/types/clr-angular-forms-password.d.ts +52 -0
- package/types/clr-angular-forms-radio.d.ts +50 -0
- package/types/clr-angular-forms-range.d.ts +37 -0
- package/types/clr-angular-forms-select.d.ts +36 -0
- package/types/clr-angular-forms-textarea.d.ts +29 -0
- package/types/clr-angular-forms.d.ts +36 -0
- package/types/clr-angular-icon.d.ts +1498 -0
- package/types/clr-angular-layout-breadcrumbs.d.ts +45 -0
- package/types/clr-angular-layout-main-container.d.ts +28 -0
- package/types/clr-angular-layout-nav.d.ts +142 -0
- package/types/clr-angular-layout-tabs.d.ts +158 -0
- package/types/clr-angular-layout-vertical-nav.d.ts +128 -0
- package/types/clr-angular-layout.d.ts +19 -0
- package/types/clr-angular-modal.d.ts +160 -0
- package/types/clr-angular-popover-common.d.ts +254 -0
- package/types/clr-angular-popover-dropdown.d.ts +123 -0
- package/types/clr-angular-popover-signpost.d.ts +157 -0
- package/types/clr-angular-popover-tooltip.d.ts +83 -0
- package/types/clr-angular-popover.d.ts +16 -0
- package/types/clr-angular-progress-progress-bars.d.ts +57 -0
- package/types/clr-angular-progress-spinner.d.ts +44 -0
- package/types/clr-angular-stepper.d.ts +179 -0
- package/types/clr-angular-timeline.d.ts +86 -0
- package/types/clr-angular-utils-conditional.d.ts +132 -0
- package/types/clr-angular-utils-loading.d.ts +38 -0
- package/types/clr-angular-utils.d.ts +913 -0
- package/types/clr-angular-wizard.d.ts +1508 -0
- package/fesm2022/rossigee-clarity-angular.mjs.map +0 -1
- /package/types/{rossigee-clarity-angular.d.ts → clr-angular.d.ts} +0 -0
|
@@ -0,0 +1,2079 @@
|
|
|
1
|
+
import { FormControl, FormGroup } from '@angular/forms';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { Injectable, EventEmitter, Output, Input, Directive, NgModule, TemplateRef, ViewChild, Component, ElementRef, HostListener, HostBinding, InjectionToken, PLATFORM_ID, DOCUMENT, Inject, Optional, ContentChildren, SkipSelf, Renderer2 } from '@angular/core';
|
|
4
|
+
import { CommonModule, isPlatformBrowser } from '@angular/common';
|
|
5
|
+
import * as i2 from '@angular/animations';
|
|
6
|
+
import { animation, style, animate, state, transition, trigger, useAnimation } from '@angular/animations';
|
|
7
|
+
export * from '@clr/angular/utils/loading';
|
|
8
|
+
export * from '@clr/angular/utils/conditional';
|
|
9
|
+
import { Subject, fromEvent, Observable, isObservable, of } from 'rxjs';
|
|
10
|
+
import { takeUntil } from 'rxjs/operators';
|
|
11
|
+
import * as i1 from '@angular/cdk/a11y';
|
|
12
|
+
import { CdkTrapFocus } from '@angular/cdk/a11y';
|
|
13
|
+
import * as i2$1 from '@angular/cdk/drag-drop';
|
|
14
|
+
import { CdkDrag, CDK_DROP_LIST, CDK_DRAG_CONFIG } from '@angular/cdk/drag-drop';
|
|
15
|
+
import * as i1$1 from '@angular/cdk/bidi';
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
19
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
20
|
+
* This software is released under MIT license.
|
|
21
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
22
|
+
*/
|
|
23
|
+
function triggerAllFormControlValidation(formGroup) {
|
|
24
|
+
Object.keys(formGroup.controls).forEach(field => {
|
|
25
|
+
const control = formGroup.get(field);
|
|
26
|
+
if (control instanceof FormControl) {
|
|
27
|
+
control.markAsTouched();
|
|
28
|
+
control.markAsDirty();
|
|
29
|
+
control.updateValueAndValidity();
|
|
30
|
+
}
|
|
31
|
+
else if (control instanceof FormGroup) {
|
|
32
|
+
triggerAllFormControlValidation(control);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
39
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
40
|
+
* This software is released under MIT license.
|
|
41
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
42
|
+
*/
|
|
43
|
+
/*
|
|
44
|
+
* If we someday want to be able to render the datagrid in a webworker,
|
|
45
|
+
* this is where we would test if we're in headless mode. Right now it's not testing anything, but any access
|
|
46
|
+
* to native DOM elements' methods and properties in the Datagrid happens here.
|
|
47
|
+
*/
|
|
48
|
+
class DomAdapter {
|
|
49
|
+
/*
|
|
50
|
+
We clone the element and take its measurements from outside the grid
|
|
51
|
+
so we don't trigger reflow for the whole datagrid.
|
|
52
|
+
*/
|
|
53
|
+
userDefinedWidth(element) {
|
|
54
|
+
const clonedElement = element.cloneNode(true);
|
|
55
|
+
if (clonedElement.id) {
|
|
56
|
+
clonedElement.id = clonedElement.id + '-clone';
|
|
57
|
+
}
|
|
58
|
+
clonedElement.classList.add('datagrid-cell-width-zero');
|
|
59
|
+
document.body.appendChild(clonedElement);
|
|
60
|
+
const userDefinedWidth = this.clientRect(clonedElement).width;
|
|
61
|
+
clonedElement.remove();
|
|
62
|
+
return userDefinedWidth;
|
|
63
|
+
}
|
|
64
|
+
scrollBarWidth(element) {
|
|
65
|
+
return element.offsetWidth - element.clientWidth;
|
|
66
|
+
}
|
|
67
|
+
scrollWidth(element) {
|
|
68
|
+
return element.scrollWidth || 0;
|
|
69
|
+
}
|
|
70
|
+
computedHeight(element) {
|
|
71
|
+
return parseInt(getComputedStyle(element).getPropertyValue('height'), 10);
|
|
72
|
+
}
|
|
73
|
+
clientRect(element) {
|
|
74
|
+
const elementClientRect = element.getBoundingClientRect();
|
|
75
|
+
return {
|
|
76
|
+
top: parseInt(elementClientRect.top, 10),
|
|
77
|
+
bottom: parseInt(elementClientRect.bottom, 10),
|
|
78
|
+
left: parseInt(elementClientRect.left, 10),
|
|
79
|
+
right: parseInt(elementClientRect.right, 10),
|
|
80
|
+
width: parseInt(elementClientRect.width, 10),
|
|
81
|
+
height: parseInt(elementClientRect.height, 10),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
minWidth(element) {
|
|
85
|
+
return parseInt(getComputedStyle(element).getPropertyValue('min-width'), 10);
|
|
86
|
+
}
|
|
87
|
+
focus(element) {
|
|
88
|
+
element.focus();
|
|
89
|
+
}
|
|
90
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: DomAdapter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
91
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: DomAdapter }); }
|
|
92
|
+
}
|
|
93
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: DomAdapter, decorators: [{
|
|
94
|
+
type: Injectable
|
|
95
|
+
}] });
|
|
96
|
+
|
|
97
|
+
/*
|
|
98
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
99
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
100
|
+
* This software is released under MIT license.
|
|
101
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
102
|
+
*/
|
|
103
|
+
class MockDomAdapter extends DomAdapter {
|
|
104
|
+
constructor() {
|
|
105
|
+
super(...arguments);
|
|
106
|
+
this._userDefinedWidth = 0;
|
|
107
|
+
this._scrollBarWidth = 0;
|
|
108
|
+
this._scrollWidth = 0;
|
|
109
|
+
this._computedHeight = 0;
|
|
110
|
+
}
|
|
111
|
+
userDefinedWidth(_element) {
|
|
112
|
+
return this._userDefinedWidth;
|
|
113
|
+
}
|
|
114
|
+
scrollBarWidth(_element) {
|
|
115
|
+
return this._scrollBarWidth;
|
|
116
|
+
}
|
|
117
|
+
scrollWidth(_element) {
|
|
118
|
+
return this._scrollWidth;
|
|
119
|
+
}
|
|
120
|
+
computedHeight(_element) {
|
|
121
|
+
return this._computedHeight;
|
|
122
|
+
}
|
|
123
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MockDomAdapter, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
124
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MockDomAdapter }); }
|
|
125
|
+
}
|
|
126
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MockDomAdapter, decorators: [{
|
|
127
|
+
type: Injectable
|
|
128
|
+
}] });
|
|
129
|
+
const MOCK_DOM_ADAPTER_PROVIDER = {
|
|
130
|
+
provide: DomAdapter,
|
|
131
|
+
useClass: MockDomAdapter,
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/*
|
|
135
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
136
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
137
|
+
* This software is released under MIT license.
|
|
138
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
139
|
+
*/
|
|
140
|
+
class OutsideClick {
|
|
141
|
+
constructor(host, renderer, ngZone) {
|
|
142
|
+
this.strict = false;
|
|
143
|
+
this.outsideClick = new EventEmitter(false);
|
|
144
|
+
ngZone.runOutsideAngular(() => {
|
|
145
|
+
this.documentClickListener = renderer.listen('document', 'click', (event) => {
|
|
146
|
+
// Compare the element in the DOM on which the mouse was clicked
|
|
147
|
+
// with the current actionMenu native HTML element.
|
|
148
|
+
if (host.nativeElement === event.target) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (!this.strict && host.nativeElement.contains(event.target)) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
// We'll run change detection only if the click event actually happened outside of
|
|
155
|
+
// the host element.
|
|
156
|
+
ngZone.run(() => {
|
|
157
|
+
this.outsideClick.emit(event);
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
ngOnDestroy() {
|
|
163
|
+
this.documentClickListener();
|
|
164
|
+
}
|
|
165
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: OutsideClick, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
166
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: OutsideClick, isStandalone: false, selector: "[clrOutsideClick]", inputs: { strict: ["clrStrict", "strict"] }, outputs: { outsideClick: "clrOutsideClick" }, ngImport: i0 }); }
|
|
167
|
+
}
|
|
168
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: OutsideClick, decorators: [{
|
|
169
|
+
type: Directive,
|
|
170
|
+
args: [{
|
|
171
|
+
selector: '[clrOutsideClick]',
|
|
172
|
+
standalone: false,
|
|
173
|
+
}]
|
|
174
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }], propDecorators: { strict: [{
|
|
175
|
+
type: Input,
|
|
176
|
+
args: ['clrStrict']
|
|
177
|
+
}], outsideClick: [{
|
|
178
|
+
type: Output,
|
|
179
|
+
args: ['clrOutsideClick']
|
|
180
|
+
}] } });
|
|
181
|
+
|
|
182
|
+
/*
|
|
183
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
184
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
185
|
+
* This software is released under MIT license.
|
|
186
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
187
|
+
*/
|
|
188
|
+
const OUSTIDE_CLICK_DIRECTIVES = [OutsideClick];
|
|
189
|
+
class ClrOutsideClickModule {
|
|
190
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrOutsideClickModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
191
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.3", ngImport: i0, type: ClrOutsideClickModule, declarations: [OutsideClick], imports: [CommonModule], exports: [OutsideClick] }); }
|
|
192
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrOutsideClickModule, imports: [CommonModule] }); }
|
|
193
|
+
}
|
|
194
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrOutsideClickModule, decorators: [{
|
|
195
|
+
type: NgModule,
|
|
196
|
+
args: [{
|
|
197
|
+
imports: [CommonModule],
|
|
198
|
+
declarations: [OUSTIDE_CLICK_DIRECTIVES],
|
|
199
|
+
exports: [OUSTIDE_CLICK_DIRECTIVES],
|
|
200
|
+
}]
|
|
201
|
+
}] });
|
|
202
|
+
|
|
203
|
+
/*
|
|
204
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
205
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
206
|
+
* This software is released under MIT license.
|
|
207
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
208
|
+
*/
|
|
209
|
+
|
|
210
|
+
/*
|
|
211
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
212
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
213
|
+
* This software is released under MIT license.
|
|
214
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
215
|
+
*/
|
|
216
|
+
class TemplateRefContainer {
|
|
217
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TemplateRefContainer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
218
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: TemplateRefContainer, isStandalone: false, selector: "ng-component", viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true }], ngImport: i0, template: `
|
|
219
|
+
<ng-template>
|
|
220
|
+
<ng-content></ng-content>
|
|
221
|
+
</ng-template>
|
|
222
|
+
`, isInline: true }); }
|
|
223
|
+
}
|
|
224
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: TemplateRefContainer, decorators: [{
|
|
225
|
+
type: Component,
|
|
226
|
+
args: [{
|
|
227
|
+
template: `
|
|
228
|
+
<ng-template>
|
|
229
|
+
<ng-content></ng-content>
|
|
230
|
+
</ng-template>
|
|
231
|
+
`,
|
|
232
|
+
standalone: false,
|
|
233
|
+
}]
|
|
234
|
+
}], propDecorators: { template: [{
|
|
235
|
+
type: ViewChild,
|
|
236
|
+
args: [TemplateRef]
|
|
237
|
+
}] } });
|
|
238
|
+
|
|
239
|
+
/*
|
|
240
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
241
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
242
|
+
* This software is released under MIT license.
|
|
243
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
244
|
+
*/
|
|
245
|
+
class ClrTemplateRefModule {
|
|
246
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrTemplateRefModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
247
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.3", ngImport: i0, type: ClrTemplateRefModule, declarations: [TemplateRefContainer], imports: [CommonModule], exports: [TemplateRefContainer] }); }
|
|
248
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrTemplateRefModule, imports: [CommonModule] }); }
|
|
249
|
+
}
|
|
250
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrTemplateRefModule, decorators: [{
|
|
251
|
+
type: NgModule,
|
|
252
|
+
args: [{
|
|
253
|
+
imports: [CommonModule],
|
|
254
|
+
declarations: [TemplateRefContainer],
|
|
255
|
+
exports: [TemplateRefContainer],
|
|
256
|
+
}]
|
|
257
|
+
}] });
|
|
258
|
+
|
|
259
|
+
/*
|
|
260
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
261
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
262
|
+
* This software is released under MIT license.
|
|
263
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
264
|
+
*/
|
|
265
|
+
|
|
266
|
+
/*
|
|
267
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
268
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
269
|
+
* This software is released under MIT license.
|
|
270
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
271
|
+
*/
|
|
272
|
+
/**
|
|
273
|
+
* TODO:
|
|
274
|
+
* Using core functions like:
|
|
275
|
+
* - pluckPixelValue
|
|
276
|
+
* - getCssPropertyValue
|
|
277
|
+
*
|
|
278
|
+
* to get the value of the design token.
|
|
279
|
+
*
|
|
280
|
+
* Note: Memoization/Cache usage possible.
|
|
281
|
+
*/
|
|
282
|
+
// iPad mini screen width
|
|
283
|
+
// http://stephen.io/mediaqueries/#iPadMini
|
|
284
|
+
const DATEPICKER_ENABLE_BREAKPOINT = 768;
|
|
285
|
+
const SMALL_BREAKPOINT = 576;
|
|
286
|
+
const MEDIUM_BREAKPOINT = 768;
|
|
287
|
+
const LARGE_BREAKPOINT = 992;
|
|
288
|
+
const EXTRA_LARGE_BREAKPOINT = 1200;
|
|
289
|
+
|
|
290
|
+
/*
|
|
291
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
292
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
293
|
+
* This software is released under MIT license.
|
|
294
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
295
|
+
*/
|
|
296
|
+
class EmptyAnchor {
|
|
297
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: EmptyAnchor, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
298
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: EmptyAnchor, isStandalone: false, selector: "ng-component", ngImport: i0, template: '', isInline: true }); }
|
|
299
|
+
}
|
|
300
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: EmptyAnchor, decorators: [{
|
|
301
|
+
type: Component,
|
|
302
|
+
args: [{
|
|
303
|
+
template: '',
|
|
304
|
+
standalone: false,
|
|
305
|
+
}]
|
|
306
|
+
}] });
|
|
307
|
+
|
|
308
|
+
/*
|
|
309
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
310
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
311
|
+
* This software is released under MIT license.
|
|
312
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
313
|
+
*/
|
|
314
|
+
/**
|
|
315
|
+
* HostWrapper must be called in OnInit to ensure that the Views are ready. If its called in a constructor the view is
|
|
316
|
+
* still undefined.
|
|
317
|
+
*/
|
|
318
|
+
class HostWrapper {
|
|
319
|
+
constructor(containerType, vcr, index = 0) {
|
|
320
|
+
this.injector = vcr.injector;
|
|
321
|
+
// If the host is already wrapped, we don't do anything
|
|
322
|
+
if (!this.injector.get(containerType, null)) {
|
|
323
|
+
const el = this.injector.get(ElementRef);
|
|
324
|
+
// We need a new anchor, since we're projecting the current one.
|
|
325
|
+
vcr.createComponent(EmptyAnchor);
|
|
326
|
+
// Craft the element array based on what slot to use. Angular only uses the index to determine
|
|
327
|
+
// which ng-content to project into, so if you have more than one ng-content you'll need to set
|
|
328
|
+
// the index in the constructor appropriately
|
|
329
|
+
const element = [];
|
|
330
|
+
element[index] = [el.nativeElement];
|
|
331
|
+
// We're assuming only one projection slot, but in more complex cases we might want to provide
|
|
332
|
+
// a different array of projected elements.
|
|
333
|
+
const containerRef = vcr.createComponent(containerType, {
|
|
334
|
+
projectableNodes: element,
|
|
335
|
+
});
|
|
336
|
+
// We can now remove the useless anchor
|
|
337
|
+
vcr.remove(0);
|
|
338
|
+
// We keep the wrapper's injector to access the dependencies that weren't available before.
|
|
339
|
+
this.injector = containerRef.injector;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
get(token, notFoundValue) {
|
|
343
|
+
return this.injector.get(token, notFoundValue);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/*
|
|
348
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
349
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
350
|
+
* This software is released under MIT license.
|
|
351
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
352
|
+
*/
|
|
353
|
+
/**
|
|
354
|
+
* Internal module, please do not export!
|
|
355
|
+
*/
|
|
356
|
+
class ClrHostWrappingModule {
|
|
357
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrHostWrappingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
358
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.3", ngImport: i0, type: ClrHostWrappingModule, declarations: [EmptyAnchor], exports: [EmptyAnchor] }); }
|
|
359
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrHostWrappingModule }); }
|
|
360
|
+
}
|
|
361
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrHostWrappingModule, decorators: [{
|
|
362
|
+
type: NgModule,
|
|
363
|
+
args: [{
|
|
364
|
+
declarations: [EmptyAnchor],
|
|
365
|
+
exports: [EmptyAnchor],
|
|
366
|
+
}]
|
|
367
|
+
}] });
|
|
368
|
+
|
|
369
|
+
/*
|
|
370
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
371
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
372
|
+
* This software is released under MIT license.
|
|
373
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
374
|
+
*/
|
|
375
|
+
|
|
376
|
+
/*
|
|
377
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
378
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
379
|
+
* This software is released under MIT license.
|
|
380
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
381
|
+
*/
|
|
382
|
+
function assertNever(value) {
|
|
383
|
+
throw new Error(`Unhandled value: ${value}`);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/*
|
|
387
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
388
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
389
|
+
* This software is released under MIT license.
|
|
390
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
391
|
+
*/
|
|
392
|
+
function isBooleanAttributeSet(value) {
|
|
393
|
+
// for null just return false no need to check anything
|
|
394
|
+
if (value === null) {
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
if (typeof value === 'string') {
|
|
398
|
+
// Empty string is valid, 'true' as string is also valid
|
|
399
|
+
return value.length >= 0;
|
|
400
|
+
}
|
|
401
|
+
// Boolean value will be read as it is, everything else is false
|
|
402
|
+
return typeof value === 'boolean' ? value : false;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/*
|
|
406
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
407
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
408
|
+
* This software is released under MIT license.
|
|
409
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
410
|
+
*/
|
|
411
|
+
const defaultAnimationTiming = '0.2s ease-in-out';
|
|
412
|
+
const defaultExpandAnimation = animation([style({ height: '{{ startHeight }}px' }), animate(defaultAnimationTiming, style({ height: '*' }))], {
|
|
413
|
+
params: {
|
|
414
|
+
startHeight: 0, // default
|
|
415
|
+
},
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
/*
|
|
419
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
420
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
421
|
+
* This software is released under MIT license.
|
|
422
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
423
|
+
*/
|
|
424
|
+
function collapse() {
|
|
425
|
+
'use strict';
|
|
426
|
+
return [
|
|
427
|
+
state('true', style({ height: 0, 'overflow-y': 'hidden' })),
|
|
428
|
+
transition('true => false', [animate(defaultAnimationTiming, style({ height: '*', 'overflow-y': 'hidden' }))]),
|
|
429
|
+
transition('false => true', [style({ height: '*', 'overflow-y': 'hidden' }), animate(defaultAnimationTiming)]),
|
|
430
|
+
];
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/*
|
|
434
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
435
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
436
|
+
* This software is released under MIT license.
|
|
437
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
438
|
+
*/
|
|
439
|
+
|
|
440
|
+
/*
|
|
441
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
442
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
443
|
+
* This software is released under MIT license.
|
|
444
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
445
|
+
*/
|
|
446
|
+
class BaseExpandableAnimation {
|
|
447
|
+
constructor(element, domAdapter, renderer) {
|
|
448
|
+
this.element = element;
|
|
449
|
+
this.domAdapter = domAdapter;
|
|
450
|
+
this.renderer = renderer;
|
|
451
|
+
this.startHeight = 0;
|
|
452
|
+
}
|
|
453
|
+
updateStartHeight() {
|
|
454
|
+
this.startHeight = this.domAdapter.computedHeight(this.element.nativeElement) || 0;
|
|
455
|
+
}
|
|
456
|
+
initAnimationEffects() {
|
|
457
|
+
this.renderer.setStyle(this.element.nativeElement, 'overflow', 'hidden');
|
|
458
|
+
}
|
|
459
|
+
cleanupAnimationEffects(cancelAnimations = false) {
|
|
460
|
+
this.renderer.removeStyle(this.element.nativeElement, 'overflow');
|
|
461
|
+
// A "safe" auto-update of the height ensuring basic OOTB user experience .
|
|
462
|
+
// Prone to small jumps in initial animation height if data was changed in the meantime, the window was resized, etc.
|
|
463
|
+
// For optimal behavior call manually updateStartHeight() from the parent component before initiating the update.
|
|
464
|
+
this.updateStartHeight();
|
|
465
|
+
if (cancelAnimations) {
|
|
466
|
+
this.cancelElementAnimations();
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
cancelElementAnimations() {
|
|
470
|
+
this.element.nativeElement.getAnimations().forEach(animation => {
|
|
471
|
+
if (animation.playState === 'finished') {
|
|
472
|
+
animation.cancel(); // clears animation-style set on the element
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: BaseExpandableAnimation, deps: [{ token: i0.ElementRef }, { token: DomAdapter }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
477
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: BaseExpandableAnimation, isStandalone: true, ngImport: i0 }); }
|
|
478
|
+
}
|
|
479
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: BaseExpandableAnimation, decorators: [{
|
|
480
|
+
type: Directive
|
|
481
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: DomAdapter }, { type: i0.Renderer2 }] });
|
|
482
|
+
|
|
483
|
+
/*
|
|
484
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
485
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
486
|
+
* This software is released under MIT license.
|
|
487
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
488
|
+
*/
|
|
489
|
+
class ClrExpandableAnimation extends BaseExpandableAnimation {
|
|
490
|
+
constructor() {
|
|
491
|
+
super(...arguments);
|
|
492
|
+
this.clrExpandTrigger = false;
|
|
493
|
+
}
|
|
494
|
+
get expandAnimation() {
|
|
495
|
+
return { value: this.clrExpandTrigger, params: { startHeight: this.startHeight } };
|
|
496
|
+
}
|
|
497
|
+
animationStart(event) {
|
|
498
|
+
if (event.fromState !== 'void') {
|
|
499
|
+
this.initAnimationEffects();
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
animationDone(event) {
|
|
503
|
+
if (event.fromState !== 'void') {
|
|
504
|
+
this.cleanupAnimationEffects();
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrExpandableAnimation, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
508
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: ClrExpandableAnimation, isStandalone: false, selector: "clr-expandable-animation", inputs: { clrExpandTrigger: "clrExpandTrigger" }, host: { listeners: { "@expandAnimation.start": "animationStart($event)", "@expandAnimation.done": "animationDone($event)" }, properties: { "@expandAnimation": "this.expandAnimation" } }, providers: [DomAdapter], usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, styles: [":host{display:block}\n"], animations: [trigger('expandAnimation', [transition('true <=> false', [useAnimation(defaultExpandAnimation)])])] }); }
|
|
509
|
+
}
|
|
510
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrExpandableAnimation, decorators: [{
|
|
511
|
+
type: Component,
|
|
512
|
+
args: [{ selector: 'clr-expandable-animation', template: `<ng-content></ng-content>`, animations: [trigger('expandAnimation', [transition('true <=> false', [useAnimation(defaultExpandAnimation)])])], providers: [DomAdapter], standalone: false, styles: [":host{display:block}\n"] }]
|
|
513
|
+
}], propDecorators: { clrExpandTrigger: [{
|
|
514
|
+
type: Input
|
|
515
|
+
}], expandAnimation: [{
|
|
516
|
+
type: HostBinding,
|
|
517
|
+
args: ['@expandAnimation']
|
|
518
|
+
}], animationStart: [{
|
|
519
|
+
type: HostListener,
|
|
520
|
+
args: ['@expandAnimation.start', ['$event']]
|
|
521
|
+
}], animationDone: [{
|
|
522
|
+
type: HostListener,
|
|
523
|
+
args: ['@expandAnimation.done', ['$event']]
|
|
524
|
+
}] } });
|
|
525
|
+
|
|
526
|
+
/*
|
|
527
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
528
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
529
|
+
* This software is released under MIT license.
|
|
530
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
531
|
+
*/
|
|
532
|
+
class ClrExpandableAnimationDirective extends BaseExpandableAnimation {
|
|
533
|
+
constructor(element, domAdapter, renderer, builder) {
|
|
534
|
+
super(element, domAdapter, renderer);
|
|
535
|
+
this.builder = builder;
|
|
536
|
+
this.expanded = false;
|
|
537
|
+
}
|
|
538
|
+
ngOnChanges(changes) {
|
|
539
|
+
if (changes['expanded'] && !changes['expanded'].firstChange) {
|
|
540
|
+
Promise.resolve().then(() => this.playAnimation());
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
ngOnDestroy() {
|
|
544
|
+
this.player?.destroy();
|
|
545
|
+
}
|
|
546
|
+
playAnimation() {
|
|
547
|
+
if (this.player) {
|
|
548
|
+
this.player.destroy();
|
|
549
|
+
}
|
|
550
|
+
this.player = this.builder
|
|
551
|
+
.build([useAnimation(defaultExpandAnimation, { params: { startHeight: this.startHeight } })])
|
|
552
|
+
.create(this.element.nativeElement);
|
|
553
|
+
this.player.onStart(() => this.initAnimationEffects());
|
|
554
|
+
this.player.onDone(() => this.cleanupAnimationEffects(true));
|
|
555
|
+
this.player.play();
|
|
556
|
+
}
|
|
557
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrExpandableAnimationDirective, deps: [{ token: i0.ElementRef }, { token: DomAdapter }, { token: i0.Renderer2 }, { token: i2.AnimationBuilder }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
558
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: ClrExpandableAnimationDirective, isStandalone: false, selector: "[clrExpandableAnimation]", inputs: { expanded: ["clrExpandableAnimation", "expanded"] }, host: { properties: { "class.clr-expandable-animation": "true" } }, providers: [DomAdapter], usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
|
|
559
|
+
}
|
|
560
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrExpandableAnimationDirective, decorators: [{
|
|
561
|
+
type: Directive,
|
|
562
|
+
args: [{
|
|
563
|
+
selector: '[clrExpandableAnimation]',
|
|
564
|
+
providers: [DomAdapter],
|
|
565
|
+
host: {
|
|
566
|
+
'[class.clr-expandable-animation]': 'true',
|
|
567
|
+
},
|
|
568
|
+
standalone: false,
|
|
569
|
+
}]
|
|
570
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: DomAdapter }, { type: i0.Renderer2 }, { type: i2.AnimationBuilder }], propDecorators: { expanded: [{
|
|
571
|
+
type: Input,
|
|
572
|
+
args: ['clrExpandableAnimation']
|
|
573
|
+
}] } });
|
|
574
|
+
|
|
575
|
+
/*
|
|
576
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
577
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
578
|
+
* This software is released under MIT license.
|
|
579
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
580
|
+
*/
|
|
581
|
+
const EXPANDABLE_ANIMATION_DIRECTIVES = [ClrExpandableAnimation, ClrExpandableAnimationDirective];
|
|
582
|
+
class ClrExpandableAnimationModule {
|
|
583
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrExpandableAnimationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
584
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.3", ngImport: i0, type: ClrExpandableAnimationModule, declarations: [ClrExpandableAnimation, ClrExpandableAnimationDirective], imports: [CommonModule], exports: [ClrExpandableAnimation, ClrExpandableAnimationDirective] }); }
|
|
585
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrExpandableAnimationModule, imports: [CommonModule] }); }
|
|
586
|
+
}
|
|
587
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrExpandableAnimationModule, decorators: [{
|
|
588
|
+
type: NgModule,
|
|
589
|
+
args: [{
|
|
590
|
+
imports: [CommonModule],
|
|
591
|
+
declarations: [EXPANDABLE_ANIMATION_DIRECTIVES],
|
|
592
|
+
exports: [EXPANDABLE_ANIMATION_DIRECTIVES],
|
|
593
|
+
}]
|
|
594
|
+
}] });
|
|
595
|
+
|
|
596
|
+
/*
|
|
597
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
598
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
599
|
+
* This software is released under MIT license.
|
|
600
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
601
|
+
*/
|
|
602
|
+
|
|
603
|
+
/*
|
|
604
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
605
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
606
|
+
* This software is released under MIT license.
|
|
607
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
608
|
+
*/
|
|
609
|
+
function fade(opacity = 1) {
|
|
610
|
+
return [
|
|
611
|
+
transition('void => *', [style({ opacity: 0 }), animate(defaultAnimationTiming, style({ opacity: opacity }))]),
|
|
612
|
+
transition('* => void', [animate(defaultAnimationTiming, style({ opacity: 0 }))]),
|
|
613
|
+
];
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/*
|
|
617
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
618
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
619
|
+
* This software is released under MIT license.
|
|
620
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
621
|
+
*/
|
|
622
|
+
|
|
623
|
+
/*
|
|
624
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
625
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
626
|
+
* This software is released under MIT license.
|
|
627
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
628
|
+
*/
|
|
629
|
+
function fadeSlide(direction) {
|
|
630
|
+
let transform = null;
|
|
631
|
+
if (direction === 'up') {
|
|
632
|
+
transform = 'translate(0, 25%)';
|
|
633
|
+
}
|
|
634
|
+
else if (direction === 'down') {
|
|
635
|
+
transform = 'translate(0, -25%)';
|
|
636
|
+
}
|
|
637
|
+
else if (direction === 'left') {
|
|
638
|
+
transform = 'translate(25%, 0)';
|
|
639
|
+
}
|
|
640
|
+
else if (direction === 'right') {
|
|
641
|
+
transform = 'translate(-25%, 0)';
|
|
642
|
+
}
|
|
643
|
+
else {
|
|
644
|
+
throw new Error('Unknown direction ' + direction + ' for slide animation.');
|
|
645
|
+
}
|
|
646
|
+
return [
|
|
647
|
+
transition('void => *', [style({ opacity: 0, transform: transform }), animate(defaultAnimationTiming)]),
|
|
648
|
+
transition('* => void', [animate(defaultAnimationTiming, style({ opacity: 0, transform: transform }))]),
|
|
649
|
+
];
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/*
|
|
653
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
654
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
655
|
+
* This software is released under MIT license.
|
|
656
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
657
|
+
*/
|
|
658
|
+
|
|
659
|
+
/*
|
|
660
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
661
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
662
|
+
* This software is released under MIT license.
|
|
663
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
664
|
+
*/
|
|
665
|
+
function slide(direction) {
|
|
666
|
+
let transform = null;
|
|
667
|
+
if (direction === 'up') {
|
|
668
|
+
transform = 'translate(0, 25%)';
|
|
669
|
+
}
|
|
670
|
+
else if (direction === 'down') {
|
|
671
|
+
transform = 'translate(0, -25%)';
|
|
672
|
+
}
|
|
673
|
+
else if (direction === 'left') {
|
|
674
|
+
transform = 'translate(25%, 0)';
|
|
675
|
+
}
|
|
676
|
+
else if (direction === 'right') {
|
|
677
|
+
transform = 'translate(-25%, 0)';
|
|
678
|
+
}
|
|
679
|
+
else {
|
|
680
|
+
throw new Error('Unknown direction ' + direction + ' for slide animation.');
|
|
681
|
+
}
|
|
682
|
+
return [
|
|
683
|
+
transition('void => *', [style({ transform: transform }), animate(defaultAnimationTiming)]),
|
|
684
|
+
transition('* => void', [animate(defaultAnimationTiming, style({ transform: transform }))]),
|
|
685
|
+
];
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/*
|
|
689
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
690
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
691
|
+
* This software is released under MIT license.
|
|
692
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
693
|
+
*/
|
|
694
|
+
|
|
695
|
+
/*
|
|
696
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
697
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
698
|
+
* This software is released under MIT license.
|
|
699
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
700
|
+
*/
|
|
701
|
+
|
|
702
|
+
/*
|
|
703
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
704
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
705
|
+
* This software is released under MIT license.
|
|
706
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
707
|
+
*/
|
|
708
|
+
const commonStringsDefault = {
|
|
709
|
+
open: 'Open',
|
|
710
|
+
close: 'Close',
|
|
711
|
+
show: 'Show',
|
|
712
|
+
hide: 'Hide',
|
|
713
|
+
apply: 'Apply',
|
|
714
|
+
cancel: 'Cancel',
|
|
715
|
+
expand: 'Expand',
|
|
716
|
+
collapse: 'Collapse',
|
|
717
|
+
more: 'More',
|
|
718
|
+
select: 'Select',
|
|
719
|
+
selectAll: 'Select All',
|
|
720
|
+
previous: 'Previous',
|
|
721
|
+
next: 'Next',
|
|
722
|
+
current: 'Jump to current',
|
|
723
|
+
info: 'Info',
|
|
724
|
+
success: 'Success',
|
|
725
|
+
warning: 'Warning',
|
|
726
|
+
danger: 'Error',
|
|
727
|
+
neutral: 'Neutral',
|
|
728
|
+
unknown: 'Unknown',
|
|
729
|
+
rowActions: 'Available actions',
|
|
730
|
+
pickColumns: 'Manage Columns',
|
|
731
|
+
showColumns: 'Show Columns',
|
|
732
|
+
sortColumn: 'Sort Column',
|
|
733
|
+
firstPage: 'First Page',
|
|
734
|
+
lastPage: 'Last Page',
|
|
735
|
+
nextPage: 'Next Page',
|
|
736
|
+
previousPage: 'Previous Page',
|
|
737
|
+
currentPage: 'Current Page',
|
|
738
|
+
totalPages: 'Total Pages',
|
|
739
|
+
filterItems: 'Filter items',
|
|
740
|
+
minValue: 'Min value',
|
|
741
|
+
maxValue: 'Max value',
|
|
742
|
+
modalContentStart: 'Beginning of Modal Content',
|
|
743
|
+
modalContentEnd: 'End of Modal Content',
|
|
744
|
+
sidePanelPin: 'Pin Side Panel',
|
|
745
|
+
showColumnsMenuDescription: 'Show or hide columns menu',
|
|
746
|
+
allColumnsSelected: 'All columns selected',
|
|
747
|
+
signpostToggle: 'Signpost Toggle',
|
|
748
|
+
signpostClose: 'Close',
|
|
749
|
+
loading: 'Loading',
|
|
750
|
+
// Datagrid
|
|
751
|
+
detailPaneStart: 'Start of row details',
|
|
752
|
+
detailPaneEnd: 'End of row details',
|
|
753
|
+
singleSelectionAriaLabel: 'Single selection header',
|
|
754
|
+
singleActionableAriaLabel: 'Single actionable header',
|
|
755
|
+
detailExpandableAriaLabel: 'Toggle more row content',
|
|
756
|
+
datagridFilterAriaLabel: '{COLUMN} filter',
|
|
757
|
+
datagridFilterLabel: '{COLUMN} filter',
|
|
758
|
+
datagridFilterDialogAriaLabel: 'Filter dialog',
|
|
759
|
+
columnSeparatorAriaLabel: 'Column resize handle',
|
|
760
|
+
columnSeparatorDescription: 'Use left or right key to resize the column',
|
|
761
|
+
fromLabel: 'From',
|
|
762
|
+
toLabel: 'To',
|
|
763
|
+
// Alert
|
|
764
|
+
alertCloseButtonAriaLabel: 'Close alert',
|
|
765
|
+
alertNextAlertAriaLabel: 'Next alert message, {CURRENT} of {COUNT}',
|
|
766
|
+
alertPreviousAlertAriaLabel: 'Previous alert message, {CURRENT} of {COUNT}',
|
|
767
|
+
// Date Picker
|
|
768
|
+
datepickerDialogLabel: 'Choose date',
|
|
769
|
+
datepickerToggleChooseDateLabel: 'Choose date',
|
|
770
|
+
datepickerToggleChangeDateLabel: 'Change date, {SELECTED_DATE}',
|
|
771
|
+
datepickerPreviousMonth: 'Previous month',
|
|
772
|
+
datepickerCurrentMonth: 'Current month',
|
|
773
|
+
datepickerNextMonth: 'Next month',
|
|
774
|
+
datepickerPreviousDecade: 'Previous decade',
|
|
775
|
+
datepickerNextDecade: 'Next decade',
|
|
776
|
+
datepickerCurrentDecade: 'Current decade',
|
|
777
|
+
datepickerSelectMonthText: 'Select month, the current month is {CALENDAR_MONTH}',
|
|
778
|
+
datepickerSelectYearText: 'Select year, the current year is {CALENDAR_YEAR}',
|
|
779
|
+
datepickerSelectedLabel: '{FULL_DATE} - Selected',
|
|
780
|
+
// Stack View
|
|
781
|
+
stackViewChanged: 'Value changed.',
|
|
782
|
+
// Responsive Nav
|
|
783
|
+
responsiveNavToggleOpen: 'Open navigation menu',
|
|
784
|
+
responsiveNavToggleClose: 'Close navigation menu',
|
|
785
|
+
responsiveNavOverflowOpen: 'Open navigation overflow menu',
|
|
786
|
+
responsiveNavOverflowClose: 'Close navigation overflow menu',
|
|
787
|
+
//Vertical Nav
|
|
788
|
+
verticalNavToggle: 'Toggle vertical navigation',
|
|
789
|
+
// Timeline steps
|
|
790
|
+
timelineStepNotStarted: 'Not started',
|
|
791
|
+
timelineStepCurrent: 'Current',
|
|
792
|
+
timelineStepSuccess: 'Completed',
|
|
793
|
+
timelineStepError: 'Error',
|
|
794
|
+
timelineStepProcessing: 'In progress',
|
|
795
|
+
// Combobox
|
|
796
|
+
comboboxDelete: 'Delete selected option',
|
|
797
|
+
comboboxSearching: 'Searching for matches for "{INPUT}"',
|
|
798
|
+
comboboxSelection: 'Selection',
|
|
799
|
+
comboboxSelected: 'Selected',
|
|
800
|
+
comboboxNoResults: 'No results',
|
|
801
|
+
comboboxOpen: 'Show options',
|
|
802
|
+
comboboxSelectAll: 'Select All',
|
|
803
|
+
comboboxUnselectAll: 'Unselect All',
|
|
804
|
+
comboboxShowAll: 'Show all {ITEMS} selected',
|
|
805
|
+
comboboxAllSelected: 'All {ITEMS} selected',
|
|
806
|
+
comboboxShowLess: 'Show less',
|
|
807
|
+
// Datagrid expandable rows
|
|
808
|
+
datagridExpandableBeginningOf: 'Beginning of',
|
|
809
|
+
datagridExpandableEndOf: 'End of',
|
|
810
|
+
datagridExpandableRowContent: 'Expandable row content',
|
|
811
|
+
datagridExpandableRowsHelperText: `Screen reader table commands may not work for viewing expanded content, please use your screen reader's browse mode to read the content exposed by this button`,
|
|
812
|
+
// Wizard
|
|
813
|
+
wizardStep: 'Step',
|
|
814
|
+
wizardStepCurrent: 'Current',
|
|
815
|
+
wizardStepSuccess: 'Completed',
|
|
816
|
+
wizardStepError: 'Error',
|
|
817
|
+
wizardStepnavAriaLabel: 'Wizard steps',
|
|
818
|
+
/**
|
|
819
|
+
* Password Input
|
|
820
|
+
* Screen-reader text for the hide/show password field button
|
|
821
|
+
*/
|
|
822
|
+
passwordHide: 'Hide password for {LABEL}',
|
|
823
|
+
passwordShow: 'Show password for {LABEL}',
|
|
824
|
+
/**
|
|
825
|
+
* Datagrid footer; sr-only text after the number of selected rows.
|
|
826
|
+
*/
|
|
827
|
+
selectedRows: 'Selected rows',
|
|
828
|
+
// Accordion/Stepper
|
|
829
|
+
stepComplete: 'Step {STEP} complete',
|
|
830
|
+
stepError: 'Error in step {STEP}',
|
|
831
|
+
// File input
|
|
832
|
+
browse: 'Browse',
|
|
833
|
+
fileCount: '{COUNT} files',
|
|
834
|
+
clearFile: 'Clear {FILE}',
|
|
835
|
+
clearFiles: 'Clear {COUNT} files',
|
|
836
|
+
// Tree
|
|
837
|
+
selectedTreeNode: 'selected',
|
|
838
|
+
unselectedTreeNode: 'unselected',
|
|
839
|
+
// Breadcrumbs
|
|
840
|
+
breadcrumbsLabel: 'breadcrumbs',
|
|
841
|
+
expandBreadcrumbsLabel: 'Expand breadcrumbs',
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
/*
|
|
845
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
846
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
847
|
+
* This software is released under MIT license.
|
|
848
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
849
|
+
*/
|
|
850
|
+
class ClrCommonStringsService {
|
|
851
|
+
constructor() {
|
|
852
|
+
this._strings = commonStringsDefault;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Access to all of the keys as strings
|
|
856
|
+
*/
|
|
857
|
+
get keys() {
|
|
858
|
+
return this._strings;
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* Allows you to pass in new overrides for localization
|
|
862
|
+
*/
|
|
863
|
+
localize(overrides) {
|
|
864
|
+
this._strings = { ...this._strings, ...overrides };
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Parse a string with a set of tokens to replace
|
|
868
|
+
*/
|
|
869
|
+
parse(source, tokens = {}) {
|
|
870
|
+
const names = Object.keys(tokens);
|
|
871
|
+
let output = source;
|
|
872
|
+
if (names.length) {
|
|
873
|
+
names.forEach(name => {
|
|
874
|
+
output = output.replace(`{${name}}`, tokens[name]);
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
return output;
|
|
878
|
+
}
|
|
879
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrCommonStringsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
880
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrCommonStringsService, providedIn: 'root' }); }
|
|
881
|
+
}
|
|
882
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrCommonStringsService, decorators: [{
|
|
883
|
+
type: Injectable,
|
|
884
|
+
args: [{
|
|
885
|
+
providedIn: 'root',
|
|
886
|
+
}]
|
|
887
|
+
}] });
|
|
888
|
+
|
|
889
|
+
/*
|
|
890
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
891
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
892
|
+
* This software is released under MIT license.
|
|
893
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
894
|
+
*/
|
|
895
|
+
|
|
896
|
+
/*
|
|
897
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
898
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
899
|
+
* This software is released under MIT license.
|
|
900
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
901
|
+
*/
|
|
902
|
+
|
|
903
|
+
/*
|
|
904
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
905
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
906
|
+
* This software is released under MIT license.
|
|
907
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
908
|
+
*/
|
|
909
|
+
const FOCUS_ON_VIEW_INIT = new InjectionToken('FOCUS_ON_VIEW_INIT');
|
|
910
|
+
// This provider holds the default value for clrFocusOnViewInit directive's isEnabled property.
|
|
911
|
+
// So users can interject this provider and set their own value for this provider.
|
|
912
|
+
const FOCUS_ON_VIEW_INIT_PROVIDER = {
|
|
913
|
+
provide: FOCUS_ON_VIEW_INIT,
|
|
914
|
+
useValue: true,
|
|
915
|
+
};
|
|
916
|
+
|
|
917
|
+
/*
|
|
918
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
919
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
920
|
+
* This software is released under MIT license.
|
|
921
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
922
|
+
*/
|
|
923
|
+
/* This directive is for guiding the document focus to the newly added content when its view is initialized
|
|
924
|
+
so that assistive technologies can read its content. */
|
|
925
|
+
class ClrFocusOnViewInit {
|
|
926
|
+
constructor(el, platformId, focusOnViewInit, document, renderer, ngZone) {
|
|
927
|
+
this.el = el;
|
|
928
|
+
this.platformId = platformId;
|
|
929
|
+
this.focusOnViewInit = focusOnViewInit;
|
|
930
|
+
this.renderer = renderer;
|
|
931
|
+
this.directFocus = true; // true if the element gets focused without need to set tabindex;
|
|
932
|
+
this.destroy$ = new Subject();
|
|
933
|
+
this._isEnabled = focusOnViewInit;
|
|
934
|
+
// Angular compiler doesn't understand the type Document
|
|
935
|
+
// when working out the metadata for injectable parameters,
|
|
936
|
+
// even though it understands the injection token DOCUMENT
|
|
937
|
+
// https://github.com/angular/angular/issues/20351
|
|
938
|
+
this.document = document;
|
|
939
|
+
ngZone.runOutsideAngular(() => fromEvent(el.nativeElement, 'focusout')
|
|
940
|
+
.pipe(takeUntil(this.destroy$))
|
|
941
|
+
.subscribe(() => {
|
|
942
|
+
if (!this.directFocus) {
|
|
943
|
+
// manually set attributes and styles should be removed
|
|
944
|
+
renderer.removeAttribute(el.nativeElement, 'tabindex');
|
|
945
|
+
renderer.setStyle(el.nativeElement, 'outline', null);
|
|
946
|
+
}
|
|
947
|
+
}));
|
|
948
|
+
}
|
|
949
|
+
set isEnabled(value) {
|
|
950
|
+
if (this.focusOnViewInit && typeof value === 'boolean') {
|
|
951
|
+
this._isEnabled = value;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
ngAfterViewInit() {
|
|
955
|
+
this.focus();
|
|
956
|
+
}
|
|
957
|
+
ngOnDestroy() {
|
|
958
|
+
this.destroy$.next();
|
|
959
|
+
}
|
|
960
|
+
focus() {
|
|
961
|
+
if (!isPlatformBrowser(this.platformId)) {
|
|
962
|
+
return;
|
|
963
|
+
}
|
|
964
|
+
if (!this._isEnabled) {
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
if (this.document && this.document.activeElement !== this.el.nativeElement) {
|
|
968
|
+
this.el.nativeElement.focus();
|
|
969
|
+
if (this.document.activeElement !== this.el.nativeElement) {
|
|
970
|
+
// if it's not directly focused now, it means it was a non-interactive element
|
|
971
|
+
// so we need to give it a tabindex.
|
|
972
|
+
this.directFocus = false;
|
|
973
|
+
this.renderer.setAttribute(this.el.nativeElement, 'tabindex', '-1');
|
|
974
|
+
this.renderer.setStyle(this.el.nativeElement, 'outline', 'none');
|
|
975
|
+
this.el.nativeElement.focus();
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrFocusOnViewInit, deps: [{ token: i0.ElementRef }, { token: PLATFORM_ID }, { token: FOCUS_ON_VIEW_INIT }, { token: DOCUMENT }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
980
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: ClrFocusOnViewInit, isStandalone: false, selector: "[clrFocusOnViewInit]", inputs: { isEnabled: ["clrFocusOnViewInit", "isEnabled"] }, ngImport: i0 }); }
|
|
981
|
+
}
|
|
982
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrFocusOnViewInit, decorators: [{
|
|
983
|
+
type: Directive,
|
|
984
|
+
args: [{
|
|
985
|
+
selector: '[clrFocusOnViewInit]',
|
|
986
|
+
standalone: false,
|
|
987
|
+
}]
|
|
988
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: undefined, decorators: [{
|
|
989
|
+
type: Inject,
|
|
990
|
+
args: [PLATFORM_ID]
|
|
991
|
+
}] }, { type: undefined, decorators: [{
|
|
992
|
+
type: Inject,
|
|
993
|
+
args: [FOCUS_ON_VIEW_INIT]
|
|
994
|
+
}] }, { type: undefined, decorators: [{
|
|
995
|
+
type: Inject,
|
|
996
|
+
args: [DOCUMENT]
|
|
997
|
+
}] }, { type: i0.Renderer2 }, { type: i0.NgZone }], propDecorators: { isEnabled: [{
|
|
998
|
+
type: Input,
|
|
999
|
+
args: ['clrFocusOnViewInit']
|
|
1000
|
+
}] } });
|
|
1001
|
+
|
|
1002
|
+
/*
|
|
1003
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1004
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1005
|
+
* This software is released under MIT license.
|
|
1006
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1007
|
+
*/
|
|
1008
|
+
const FOCUS_ON_VIEW_INIT_DIRECTIVES = [ClrFocusOnViewInit];
|
|
1009
|
+
class ClrFocusOnViewInitModule {
|
|
1010
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrFocusOnViewInitModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1011
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.3", ngImport: i0, type: ClrFocusOnViewInitModule, declarations: [ClrFocusOnViewInit], imports: [CommonModule], exports: [ClrFocusOnViewInit] }); }
|
|
1012
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrFocusOnViewInitModule, providers: [FOCUS_ON_VIEW_INIT_PROVIDER], imports: [CommonModule] }); }
|
|
1013
|
+
}
|
|
1014
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrFocusOnViewInitModule, decorators: [{
|
|
1015
|
+
type: NgModule,
|
|
1016
|
+
args: [{
|
|
1017
|
+
imports: [CommonModule],
|
|
1018
|
+
declarations: [FOCUS_ON_VIEW_INIT_DIRECTIVES],
|
|
1019
|
+
providers: [FOCUS_ON_VIEW_INIT_PROVIDER],
|
|
1020
|
+
exports: [FOCUS_ON_VIEW_INIT_DIRECTIVES],
|
|
1021
|
+
}]
|
|
1022
|
+
}] });
|
|
1023
|
+
|
|
1024
|
+
/*
|
|
1025
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1026
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1027
|
+
* This software is released under MIT license.
|
|
1028
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1029
|
+
*/
|
|
1030
|
+
|
|
1031
|
+
/*
|
|
1032
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1033
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1034
|
+
* This software is released under MIT license.
|
|
1035
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1036
|
+
*/
|
|
1037
|
+
class ClrStandaloneCdkTrapFocus extends CdkTrapFocus {
|
|
1038
|
+
/**
|
|
1039
|
+
* Include the constructor to forward all the dependencies to the base class
|
|
1040
|
+
* as a workaround to fix Angular "ɵɵinvalidFactoryDep" error after upgrading storybook
|
|
1041
|
+
* https://github.com/storybookjs/storybook/issues/23534
|
|
1042
|
+
*/
|
|
1043
|
+
constructor(elementRef, focusTrapFactory, document) {
|
|
1044
|
+
super(elementRef, focusTrapFactory, document);
|
|
1045
|
+
}
|
|
1046
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrStandaloneCdkTrapFocus, deps: [{ token: i0.ElementRef }, { token: i1.FocusTrapFactory }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1047
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: ClrStandaloneCdkTrapFocus, isStandalone: true, usesInheritance: true, ngImport: i0 }); }
|
|
1048
|
+
}
|
|
1049
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrStandaloneCdkTrapFocus, decorators: [{
|
|
1050
|
+
type: Directive,
|
|
1051
|
+
args: [{
|
|
1052
|
+
standalone: true,
|
|
1053
|
+
}]
|
|
1054
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.FocusTrapFactory }, { type: undefined, decorators: [{
|
|
1055
|
+
type: Optional
|
|
1056
|
+
}, {
|
|
1057
|
+
type: Inject,
|
|
1058
|
+
args: [DOCUMENT]
|
|
1059
|
+
}] }] });
|
|
1060
|
+
|
|
1061
|
+
/*
|
|
1062
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1063
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1064
|
+
* This software is released under MIT license.
|
|
1065
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1066
|
+
*/
|
|
1067
|
+
|
|
1068
|
+
/*
|
|
1069
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1070
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1071
|
+
* This software is released under MIT license.
|
|
1072
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1073
|
+
*/
|
|
1074
|
+
var ClrFocusDirection;
|
|
1075
|
+
(function (ClrFocusDirection) {
|
|
1076
|
+
ClrFocusDirection["VERTICAL"] = "vertical";
|
|
1077
|
+
ClrFocusDirection["HORIZONTAL"] = "horizontal";
|
|
1078
|
+
ClrFocusDirection["BOTH"] = "both";
|
|
1079
|
+
})(ClrFocusDirection || (ClrFocusDirection = {}));
|
|
1080
|
+
|
|
1081
|
+
/*
|
|
1082
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1083
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1084
|
+
* This software is released under MIT license.
|
|
1085
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1086
|
+
*/
|
|
1087
|
+
class ClrKeyFocusItem {
|
|
1088
|
+
constructor(elementRef, platformId) {
|
|
1089
|
+
this.elementRef = elementRef;
|
|
1090
|
+
this.platformId = platformId;
|
|
1091
|
+
}
|
|
1092
|
+
get nativeElement() {
|
|
1093
|
+
return this.elementRef.nativeElement;
|
|
1094
|
+
}
|
|
1095
|
+
focus() {
|
|
1096
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
1097
|
+
this.elementRef.nativeElement.focus();
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrKeyFocusItem, deps: [{ token: i0.ElementRef }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1101
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: ClrKeyFocusItem, isStandalone: false, selector: "[clrKeyFocusItem]", ngImport: i0 }); }
|
|
1102
|
+
}
|
|
1103
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrKeyFocusItem, decorators: [{
|
|
1104
|
+
type: Directive,
|
|
1105
|
+
args: [{
|
|
1106
|
+
selector: '[clrKeyFocusItem]',
|
|
1107
|
+
standalone: false,
|
|
1108
|
+
}]
|
|
1109
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: undefined, decorators: [{
|
|
1110
|
+
type: Inject,
|
|
1111
|
+
args: [PLATFORM_ID]
|
|
1112
|
+
}] }] });
|
|
1113
|
+
|
|
1114
|
+
/*
|
|
1115
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1116
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1117
|
+
* This software is released under MIT license.
|
|
1118
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1119
|
+
*/
|
|
1120
|
+
var Keys;
|
|
1121
|
+
(function (Keys) {
|
|
1122
|
+
Keys["ArrowLeft"] = "ArrowLeft";
|
|
1123
|
+
Keys["ArrowUp"] = "ArrowUp";
|
|
1124
|
+
Keys["ArrowRight"] = "ArrowRight";
|
|
1125
|
+
Keys["ArrowDown"] = "ArrowDown";
|
|
1126
|
+
Keys["Backspace"] = "Backspace";
|
|
1127
|
+
Keys["Tab"] = "Tab";
|
|
1128
|
+
Keys["Enter"] = "Enter";
|
|
1129
|
+
Keys["Escape"] = "Escape";
|
|
1130
|
+
Keys["Space"] = "Space";
|
|
1131
|
+
Keys["Spacebar"] = " ";
|
|
1132
|
+
Keys["Home"] = "Home";
|
|
1133
|
+
Keys["End"] = "End";
|
|
1134
|
+
Keys["PageDown"] = "PageDown";
|
|
1135
|
+
Keys["PageUp"] = "PageUp";
|
|
1136
|
+
})(Keys || (Keys = {}));
|
|
1137
|
+
|
|
1138
|
+
/*
|
|
1139
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1140
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1141
|
+
* This software is released under MIT license.
|
|
1142
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1143
|
+
*/
|
|
1144
|
+
function preventArrowKeyScroll(event) {
|
|
1145
|
+
const key = event.key;
|
|
1146
|
+
if (key === Keys.ArrowUp || key === Keys.ArrowDown || key === Keys.ArrowLeft || key === Keys.ArrowRight) {
|
|
1147
|
+
// prevent element container scroll
|
|
1148
|
+
// MDN references this is really the only way to prevent native browser interactions
|
|
1149
|
+
// https://developer.mozilla.org/en-US/docs/Web/Accessibility/Keyboard-navigable_JavaScript_widgets
|
|
1150
|
+
event.preventDefault();
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
function isKeyEitherLetterOrNumber(event) {
|
|
1154
|
+
const char = event.key;
|
|
1155
|
+
// Only letter characters differ when they switch between lowercase and uppercase, whether it's an English or non-English letter.
|
|
1156
|
+
return char.toLowerCase() !== char.toUpperCase() || (char >= '0' && char <= '9');
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
/*
|
|
1160
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1161
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1162
|
+
* This software is released under MIT license.
|
|
1163
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1164
|
+
*/
|
|
1165
|
+
class ClrKeyFocus {
|
|
1166
|
+
constructor(elementRef) {
|
|
1167
|
+
this.elementRef = elementRef;
|
|
1168
|
+
this.direction = ClrFocusDirection.VERTICAL;
|
|
1169
|
+
this.focusOnLoad = false;
|
|
1170
|
+
this.subscriptions = [];
|
|
1171
|
+
this.focusChange = new EventEmitter();
|
|
1172
|
+
this._current = 0;
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Here we use `any` cause any other type require reworking all methods below and a lot of more ifs.
|
|
1176
|
+
* this method will only work with array with FocusableItems anyway so any other value will be ignored.
|
|
1177
|
+
*/
|
|
1178
|
+
get focusableItems() {
|
|
1179
|
+
if (this._focusableItems) {
|
|
1180
|
+
return this._focusableItems;
|
|
1181
|
+
}
|
|
1182
|
+
else if (this.clrKeyFocusItems) {
|
|
1183
|
+
return this.clrKeyFocusItems.toArray();
|
|
1184
|
+
}
|
|
1185
|
+
return [];
|
|
1186
|
+
}
|
|
1187
|
+
set focusableItems(elements) {
|
|
1188
|
+
// We accept a list of focusable elements (HTMLElements or existing Directives) or auto query for clrKeyFocusItem
|
|
1189
|
+
// We accept a list reference in the cases where we cannot use ContentChildren to query
|
|
1190
|
+
// ContentChildren can be unavailable if content is projected outside the scope of the component (see tabs).
|
|
1191
|
+
if (Array.isArray(elements) && elements.length) {
|
|
1192
|
+
this._focusableItems = elements;
|
|
1193
|
+
this.initializeFocus();
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
get nativeElement() {
|
|
1197
|
+
return this.elementRef.nativeElement;
|
|
1198
|
+
}
|
|
1199
|
+
get current() {
|
|
1200
|
+
return this._current;
|
|
1201
|
+
}
|
|
1202
|
+
set current(value) {
|
|
1203
|
+
if (this._current !== value) {
|
|
1204
|
+
this._current = value;
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
get currentItem() {
|
|
1208
|
+
return this.focusableItems[this._current];
|
|
1209
|
+
}
|
|
1210
|
+
get currentItemElement() {
|
|
1211
|
+
return this.currentItem.nativeElement ? this.currentItem.nativeElement : this.currentItem;
|
|
1212
|
+
}
|
|
1213
|
+
ngAfterContentInit() {
|
|
1214
|
+
this.subscriptions.push(this.listenForItemUpdates());
|
|
1215
|
+
this.initializeFocus();
|
|
1216
|
+
}
|
|
1217
|
+
ngOnDestroy() {
|
|
1218
|
+
this.subscriptions.forEach(s => s.unsubscribe());
|
|
1219
|
+
}
|
|
1220
|
+
handleKeyboardEvent(event) {
|
|
1221
|
+
// Make sure event was originated on the current item's element
|
|
1222
|
+
if (this.currentItemElement !== event.target) {
|
|
1223
|
+
const position = this.getItemPosition(event.target);
|
|
1224
|
+
if (this.positionInRange(position)) {
|
|
1225
|
+
this.current = position;
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
if (this.prevKeyPressed(event) && this.currentFocusIsNotFirstItem()) {
|
|
1229
|
+
this.moveTo(this.current - 1);
|
|
1230
|
+
}
|
|
1231
|
+
else if (this.nextKeyPressed(event) && this.currentFocusIsNotLastItem()) {
|
|
1232
|
+
this.moveTo(this.current + 1);
|
|
1233
|
+
}
|
|
1234
|
+
else if (event.code === Keys.Home) {
|
|
1235
|
+
this.moveTo(0);
|
|
1236
|
+
}
|
|
1237
|
+
else if (event.code === Keys.End) {
|
|
1238
|
+
this.moveTo(this.focusableItems.length - 1);
|
|
1239
|
+
}
|
|
1240
|
+
preventArrowKeyScroll(event);
|
|
1241
|
+
}
|
|
1242
|
+
setClickedItemCurrent(event) {
|
|
1243
|
+
const position = this.getItemPosition(event.target);
|
|
1244
|
+
if (position > -1) {
|
|
1245
|
+
this.moveTo(position);
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
focusCurrent() {
|
|
1249
|
+
this.currentItem.focus();
|
|
1250
|
+
this.focusChange.emit(this._current);
|
|
1251
|
+
}
|
|
1252
|
+
moveTo(position) {
|
|
1253
|
+
if (this.positionInRange(position)) {
|
|
1254
|
+
this.current = position;
|
|
1255
|
+
this.focusCurrent();
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
positionInRange(position) {
|
|
1259
|
+
return position >= 0 && position < this.focusableItems.length;
|
|
1260
|
+
}
|
|
1261
|
+
currentFocusIsNotFirstItem() {
|
|
1262
|
+
return this._current - 1 >= 0;
|
|
1263
|
+
}
|
|
1264
|
+
currentFocusIsNotLastItem() {
|
|
1265
|
+
return this._current + 1 < this.focusableItems.length;
|
|
1266
|
+
}
|
|
1267
|
+
initializeFocus() {
|
|
1268
|
+
if (this.focusableItems && this.focusableItems.length) {
|
|
1269
|
+
// It is possible that the focus was on an element, whose index is no longer available.
|
|
1270
|
+
// This can happen when some of the focusable elements are being removed.
|
|
1271
|
+
// In such cases, the new focus is initialized on the last focusable element.
|
|
1272
|
+
if (this._current >= this.focusableItems.length) {
|
|
1273
|
+
this._current = this.focusableItems.length - 1;
|
|
1274
|
+
}
|
|
1275
|
+
if (this.focusOnLoad) {
|
|
1276
|
+
this.currentItem.focus();
|
|
1277
|
+
this.focusChange.emit();
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
nextKeyPressed(event) {
|
|
1282
|
+
switch (this.direction) {
|
|
1283
|
+
case ClrFocusDirection.VERTICAL:
|
|
1284
|
+
return event.key === Keys.ArrowDown;
|
|
1285
|
+
case ClrFocusDirection.HORIZONTAL:
|
|
1286
|
+
return event.key === Keys.ArrowRight;
|
|
1287
|
+
case ClrFocusDirection.BOTH:
|
|
1288
|
+
return event.key === Keys.ArrowDown || event.key === Keys.ArrowRight;
|
|
1289
|
+
default:
|
|
1290
|
+
return false;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
prevKeyPressed(event) {
|
|
1294
|
+
switch (this.direction) {
|
|
1295
|
+
case ClrFocusDirection.VERTICAL:
|
|
1296
|
+
return event.key === Keys.ArrowUp;
|
|
1297
|
+
case ClrFocusDirection.HORIZONTAL:
|
|
1298
|
+
return event.key === Keys.ArrowLeft;
|
|
1299
|
+
case ClrFocusDirection.BOTH:
|
|
1300
|
+
return event.key === Keys.ArrowUp || event.key === Keys.ArrowLeft;
|
|
1301
|
+
default:
|
|
1302
|
+
return false;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
getItemPosition(item) {
|
|
1306
|
+
if (this._focusableItems) {
|
|
1307
|
+
return this.focusableItems.indexOf(item);
|
|
1308
|
+
}
|
|
1309
|
+
else {
|
|
1310
|
+
return this.focusableItems.map(_item => _item.nativeElement).indexOf(item);
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
listenForItemUpdates() {
|
|
1314
|
+
return this.clrKeyFocusItems.changes.subscribe(() => {
|
|
1315
|
+
this.initializeFocus();
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrKeyFocus, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1319
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: ClrKeyFocus, isStandalone: false, selector: "[clrKeyFocus]", inputs: { direction: ["clrDirection", "direction"], focusOnLoad: ["clrFocusOnLoad", "focusOnLoad"], focusableItems: ["clrKeyFocus", "focusableItems"] }, outputs: { focusChange: "clrFocusChange" }, host: { listeners: { "keydown": "handleKeyboardEvent($event)", "click": "setClickedItemCurrent($event)" } }, queries: [{ propertyName: "clrKeyFocusItems", predicate: ClrKeyFocusItem, descendants: true }], ngImport: i0, template: '<ng-content></ng-content>', isInline: true }); }
|
|
1320
|
+
}
|
|
1321
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrKeyFocus, decorators: [{
|
|
1322
|
+
type: Component,
|
|
1323
|
+
args: [{
|
|
1324
|
+
selector: '[clrKeyFocus]',
|
|
1325
|
+
template: '<ng-content></ng-content>',
|
|
1326
|
+
standalone: false,
|
|
1327
|
+
}]
|
|
1328
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { direction: [{
|
|
1329
|
+
type: Input,
|
|
1330
|
+
args: ['clrDirection']
|
|
1331
|
+
}], focusOnLoad: [{
|
|
1332
|
+
type: Input,
|
|
1333
|
+
args: ['clrFocusOnLoad']
|
|
1334
|
+
}], clrKeyFocusItems: [{
|
|
1335
|
+
type: ContentChildren,
|
|
1336
|
+
args: [ClrKeyFocusItem, { descendants: true }]
|
|
1337
|
+
}], focusChange: [{
|
|
1338
|
+
type: Output,
|
|
1339
|
+
args: ['clrFocusChange']
|
|
1340
|
+
}], focusableItems: [{
|
|
1341
|
+
type: Input,
|
|
1342
|
+
args: ['clrKeyFocus']
|
|
1343
|
+
}], handleKeyboardEvent: [{
|
|
1344
|
+
type: HostListener,
|
|
1345
|
+
args: ['keydown', ['$event']]
|
|
1346
|
+
}], setClickedItemCurrent: [{
|
|
1347
|
+
type: HostListener,
|
|
1348
|
+
args: ['click', ['$event']]
|
|
1349
|
+
}] } });
|
|
1350
|
+
|
|
1351
|
+
/*
|
|
1352
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1353
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1354
|
+
* This software is released under MIT license.
|
|
1355
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1356
|
+
*/
|
|
1357
|
+
class ClrRovingTabindex extends ClrKeyFocus {
|
|
1358
|
+
constructor(elementRef, renderer) {
|
|
1359
|
+
super(elementRef);
|
|
1360
|
+
this.renderer = renderer;
|
|
1361
|
+
this.disabled = false;
|
|
1362
|
+
}
|
|
1363
|
+
// Proxy the input, as the selector name from parent class will still be "clrKeyFocus".
|
|
1364
|
+
get rovingIndexItems() {
|
|
1365
|
+
return this.focusableItems;
|
|
1366
|
+
}
|
|
1367
|
+
set rovingIndexItems(elements) {
|
|
1368
|
+
this.focusableItems = elements;
|
|
1369
|
+
}
|
|
1370
|
+
set rovingTabindexDisabled(disabled) {
|
|
1371
|
+
this.disabled = disabled;
|
|
1372
|
+
if (this.currentItem) {
|
|
1373
|
+
this.setTabindex(this.currentItem, disabled ? -1 : 0);
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
handleKeyboardEvent(event) {
|
|
1377
|
+
if (this.prevKeyPressed(event) && this.currentFocusIsNotFirstItem()) {
|
|
1378
|
+
this.updateTabindex(this.current - 1);
|
|
1379
|
+
}
|
|
1380
|
+
else if (this.nextKeyPressed(event) && this.currentFocusIsNotLastItem()) {
|
|
1381
|
+
this.updateTabindex(this.current + 1);
|
|
1382
|
+
}
|
|
1383
|
+
else if (event.code === Keys.Home) {
|
|
1384
|
+
this.updateTabindex(0);
|
|
1385
|
+
}
|
|
1386
|
+
else if (event.code === Keys.End) {
|
|
1387
|
+
this.updateTabindex(this.focusableItems.length - 1);
|
|
1388
|
+
}
|
|
1389
|
+
super.handleKeyboardEvent(event);
|
|
1390
|
+
}
|
|
1391
|
+
setClickedItemCurrent(event) {
|
|
1392
|
+
let position;
|
|
1393
|
+
if (this.focusableItems[0].nativeElement) {
|
|
1394
|
+
position = this.focusableItems.map(item => item.nativeElement).indexOf(event.target);
|
|
1395
|
+
}
|
|
1396
|
+
else {
|
|
1397
|
+
position = this.focusableItems.indexOf(event.target);
|
|
1398
|
+
}
|
|
1399
|
+
if (position > -1) {
|
|
1400
|
+
this.updateTabindex(position);
|
|
1401
|
+
}
|
|
1402
|
+
super.setClickedItemCurrent(event);
|
|
1403
|
+
}
|
|
1404
|
+
initializeFocus() {
|
|
1405
|
+
if (this.focusableItems && this.focusableItems.length) {
|
|
1406
|
+
this.focusableItems.forEach(item => {
|
|
1407
|
+
this.setTabindex(item, -1);
|
|
1408
|
+
});
|
|
1409
|
+
// It is possible that the focus was on an element, whose index is no longer available.
|
|
1410
|
+
// This can happen when some of the focusable elements are being removed.
|
|
1411
|
+
// In such cases, the new focus is initialized on the last focusable element.
|
|
1412
|
+
if (this.current >= this.focusableItems.length) {
|
|
1413
|
+
this.current = this.focusableItems.length - 1;
|
|
1414
|
+
}
|
|
1415
|
+
if (!this.disabled && this.currentItem) {
|
|
1416
|
+
this.setTabindex(this.currentItem, 0);
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
super.initializeFocus();
|
|
1420
|
+
}
|
|
1421
|
+
updateTabindex(newIndex) {
|
|
1422
|
+
this.setTabindex(this.currentItem, -1);
|
|
1423
|
+
this.setTabindex(this.focusableItems[newIndex], 0);
|
|
1424
|
+
}
|
|
1425
|
+
setTabindex(item, value) {
|
|
1426
|
+
if (item instanceof HTMLElement) {
|
|
1427
|
+
this.renderer.setAttribute(item, 'tabindex', value.toString());
|
|
1428
|
+
}
|
|
1429
|
+
else {
|
|
1430
|
+
this.renderer.setAttribute(item.nativeElement, 'tabindex', value.toString());
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrRovingTabindex, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1434
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: ClrRovingTabindex, isStandalone: false, selector: "[clrRovingTabindex]", inputs: { rovingIndexItems: ["clrRovingTabindex", "rovingIndexItems"], rovingTabindexDisabled: ["clrRovingTabindexDisabled", "rovingTabindexDisabled"] }, usesInheritance: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true }); }
|
|
1435
|
+
}
|
|
1436
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrRovingTabindex, decorators: [{
|
|
1437
|
+
type: Component,
|
|
1438
|
+
args: [{
|
|
1439
|
+
selector: '[clrRovingTabindex]',
|
|
1440
|
+
template: '<ng-content></ng-content>',
|
|
1441
|
+
standalone: false,
|
|
1442
|
+
}]
|
|
1443
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { rovingIndexItems: [{
|
|
1444
|
+
type: Input,
|
|
1445
|
+
args: ['clrRovingTabindex']
|
|
1446
|
+
}], rovingTabindexDisabled: [{
|
|
1447
|
+
type: Input,
|
|
1448
|
+
args: ['clrRovingTabindexDisabled']
|
|
1449
|
+
}] } });
|
|
1450
|
+
|
|
1451
|
+
/*
|
|
1452
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1453
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1454
|
+
* This software is released under MIT license.
|
|
1455
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1456
|
+
*/
|
|
1457
|
+
const KEY_FOCUS_DIRECTIVES = [ClrKeyFocus, ClrRovingTabindex, ClrKeyFocusItem];
|
|
1458
|
+
class ClrKeyFocusModule {
|
|
1459
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrKeyFocusModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1460
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.3", ngImport: i0, type: ClrKeyFocusModule, declarations: [ClrKeyFocus, ClrRovingTabindex, ClrKeyFocusItem], imports: [CommonModule], exports: [ClrKeyFocus, ClrRovingTabindex, ClrKeyFocusItem] }); }
|
|
1461
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrKeyFocusModule, imports: [CommonModule] }); }
|
|
1462
|
+
}
|
|
1463
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrKeyFocusModule, decorators: [{
|
|
1464
|
+
type: NgModule,
|
|
1465
|
+
args: [{
|
|
1466
|
+
imports: [CommonModule],
|
|
1467
|
+
declarations: [KEY_FOCUS_DIRECTIVES],
|
|
1468
|
+
exports: [KEY_FOCUS_DIRECTIVES],
|
|
1469
|
+
}]
|
|
1470
|
+
}] });
|
|
1471
|
+
|
|
1472
|
+
/*
|
|
1473
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1474
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1475
|
+
* This software is released under MIT license.
|
|
1476
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1477
|
+
*/
|
|
1478
|
+
|
|
1479
|
+
/*
|
|
1480
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1481
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1482
|
+
* This software is released under MIT license.
|
|
1483
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1484
|
+
*/
|
|
1485
|
+
class FocusableItem {
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
/*
|
|
1489
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1490
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1491
|
+
* This software is released under MIT license.
|
|
1492
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1493
|
+
*/
|
|
1494
|
+
class MockFocusableItem {
|
|
1495
|
+
constructor(id) {
|
|
1496
|
+
this.id = id;
|
|
1497
|
+
this.disabled = false;
|
|
1498
|
+
}
|
|
1499
|
+
focus() {
|
|
1500
|
+
// Do nothing
|
|
1501
|
+
}
|
|
1502
|
+
blur() {
|
|
1503
|
+
// Do nothing
|
|
1504
|
+
}
|
|
1505
|
+
activate() {
|
|
1506
|
+
// Do nothing
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
/*
|
|
1511
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1512
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1513
|
+
* This software is released under MIT license.
|
|
1514
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1515
|
+
*/
|
|
1516
|
+
let NB_INSTANCES = 0;
|
|
1517
|
+
function uniqueIdFactory() {
|
|
1518
|
+
return 'clr-id-' + NB_INSTANCES++;
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
/*
|
|
1522
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1523
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1524
|
+
* This software is released under MIT license.
|
|
1525
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1526
|
+
*/
|
|
1527
|
+
class BasicFocusableItem {
|
|
1528
|
+
constructor(el, renderer, platformId) {
|
|
1529
|
+
this.el = el;
|
|
1530
|
+
this.renderer = renderer;
|
|
1531
|
+
this.platformId = platformId;
|
|
1532
|
+
this.id = uniqueIdFactory();
|
|
1533
|
+
this.disabled = false;
|
|
1534
|
+
renderer.setAttribute(el.nativeElement, 'id', this.id);
|
|
1535
|
+
renderer.setAttribute(el.nativeElement, 'tabindex', '-1');
|
|
1536
|
+
}
|
|
1537
|
+
focus() {
|
|
1538
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
1539
|
+
this.renderer.setAttribute(this.el.nativeElement, 'tabindex', '0');
|
|
1540
|
+
this.el.nativeElement.focus();
|
|
1541
|
+
this.el.nativeElement.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest' });
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
blur() {
|
|
1545
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
1546
|
+
this.renderer.setAttribute(this.el.nativeElement, 'tabindex', '-1');
|
|
1547
|
+
this.el.nativeElement.blur();
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
activate() {
|
|
1551
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
1552
|
+
this.el.nativeElement.click();
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: BasicFocusableItem, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1556
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: BasicFocusableItem }); }
|
|
1557
|
+
}
|
|
1558
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: BasicFocusableItem, decorators: [{
|
|
1559
|
+
type: Injectable
|
|
1560
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: undefined, decorators: [{
|
|
1561
|
+
type: Inject,
|
|
1562
|
+
args: [PLATFORM_ID]
|
|
1563
|
+
}] }] });
|
|
1564
|
+
const BASIC_FOCUSABLE_ITEM_PROVIDER = [
|
|
1565
|
+
{
|
|
1566
|
+
provide: FocusableItem,
|
|
1567
|
+
useClass: BasicFocusableItem,
|
|
1568
|
+
},
|
|
1569
|
+
];
|
|
1570
|
+
|
|
1571
|
+
/*
|
|
1572
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1573
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1574
|
+
* This software is released under MIT license.
|
|
1575
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1576
|
+
*/
|
|
1577
|
+
function customFocusableItemProvider(implementation) {
|
|
1578
|
+
return [
|
|
1579
|
+
implementation,
|
|
1580
|
+
{
|
|
1581
|
+
provide: FocusableItem,
|
|
1582
|
+
useExisting: implementation,
|
|
1583
|
+
},
|
|
1584
|
+
];
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
/*
|
|
1588
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1589
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1590
|
+
* This software is released under MIT license.
|
|
1591
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1592
|
+
*/
|
|
1593
|
+
class Linkers {
|
|
1594
|
+
/**
|
|
1595
|
+
* Links a set of focusable items to a parent along one direction
|
|
1596
|
+
*/
|
|
1597
|
+
static linkParent(items, parent, direction) {
|
|
1598
|
+
items.forEach(item => (item[direction] = parent));
|
|
1599
|
+
}
|
|
1600
|
+
/**
|
|
1601
|
+
* Double-links a set of focusable items vertically, possibly looping
|
|
1602
|
+
*/
|
|
1603
|
+
static linkVertical(items, loop = true) {
|
|
1604
|
+
items.forEach((item, index) => {
|
|
1605
|
+
if (index > 0) {
|
|
1606
|
+
item.up = items[index - 1];
|
|
1607
|
+
}
|
|
1608
|
+
if (index < items.length - 1) {
|
|
1609
|
+
item.down = items[index + 1];
|
|
1610
|
+
}
|
|
1611
|
+
});
|
|
1612
|
+
if (loop && items.length > 1) {
|
|
1613
|
+
items[0].up = items[items.length - 1];
|
|
1614
|
+
items[items.length - 1].down = items[0];
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
// Right now I only need the two linkers above, but we can easily add more linkers. A couple examples:
|
|
1619
|
+
// export function linkHorizontal(items: FocusableItem[], loop = true);
|
|
1620
|
+
// export function linkTable(items: FocusableItem[][]);
|
|
1621
|
+
|
|
1622
|
+
/*
|
|
1623
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1624
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1625
|
+
* This software is released under MIT license.
|
|
1626
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1627
|
+
*/
|
|
1628
|
+
function wrapObservable(observable, onSubscribe, onUnsubscribe) {
|
|
1629
|
+
return Observable.create((observer) => {
|
|
1630
|
+
onSubscribe(observer);
|
|
1631
|
+
const subscription = observable.subscribe(observer);
|
|
1632
|
+
return () => {
|
|
1633
|
+
subscription.unsubscribe();
|
|
1634
|
+
if (onUnsubscribe) {
|
|
1635
|
+
onUnsubscribe(observer);
|
|
1636
|
+
}
|
|
1637
|
+
};
|
|
1638
|
+
});
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
/*
|
|
1642
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1643
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1644
|
+
* This software is released under MIT license.
|
|
1645
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1646
|
+
*/
|
|
1647
|
+
var ArrowKeyDirection;
|
|
1648
|
+
(function (ArrowKeyDirection) {
|
|
1649
|
+
ArrowKeyDirection["UP"] = "up";
|
|
1650
|
+
ArrowKeyDirection["DOWN"] = "down";
|
|
1651
|
+
ArrowKeyDirection["LEFT"] = "left";
|
|
1652
|
+
ArrowKeyDirection["RIGHT"] = "right";
|
|
1653
|
+
})(ArrowKeyDirection || (ArrowKeyDirection = {}));
|
|
1654
|
+
|
|
1655
|
+
/*
|
|
1656
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1657
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1658
|
+
* This software is released under MIT license.
|
|
1659
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1660
|
+
*/
|
|
1661
|
+
class FocusService {
|
|
1662
|
+
constructor(renderer) {
|
|
1663
|
+
this.renderer = renderer;
|
|
1664
|
+
this._unlistenFuncsMap = new Map();
|
|
1665
|
+
}
|
|
1666
|
+
get current() {
|
|
1667
|
+
return this._current;
|
|
1668
|
+
}
|
|
1669
|
+
reset(first) {
|
|
1670
|
+
this._current = first;
|
|
1671
|
+
}
|
|
1672
|
+
registerContainer(el) {
|
|
1673
|
+
// The following listeners return false when there was an action to take for the key pressed,
|
|
1674
|
+
// in order to prevent the default behavior of that key.
|
|
1675
|
+
const unlistenFuncs = [];
|
|
1676
|
+
unlistenFuncs.push(this.renderer.listen(el, 'keydown.arrowup', () => !this.move(ArrowKeyDirection.UP)));
|
|
1677
|
+
unlistenFuncs.push(this.renderer.listen(el, 'keydown.arrowdown', () => !this.move(ArrowKeyDirection.DOWN)));
|
|
1678
|
+
unlistenFuncs.push(this.renderer.listen(el, 'keydown.arrowleft', () => !this.move(ArrowKeyDirection.LEFT)));
|
|
1679
|
+
// arrow right can be used only for nested triggers.
|
|
1680
|
+
// unlistenFuncs.push(this.renderer.listen(el, 'keydown.arrowright', () => !this.move(ArrowKeyDirection.RIGHT)));
|
|
1681
|
+
unlistenFuncs.push(this.renderer.listen(el, 'keydown.space', () => !this.activateCurrent()));
|
|
1682
|
+
unlistenFuncs.push(this.renderer.listen(el, 'keydown.enter', () => !this.activateCurrent()));
|
|
1683
|
+
this._unlistenFuncsMap.set(el, unlistenFuncs);
|
|
1684
|
+
}
|
|
1685
|
+
moveTo(item) {
|
|
1686
|
+
/**
|
|
1687
|
+
* Make sure that item is not undefined,
|
|
1688
|
+
* This is safety net in the case that someone sometime decide to
|
|
1689
|
+
* call this method without having FocusableItem.
|
|
1690
|
+
*/
|
|
1691
|
+
if (item === undefined) {
|
|
1692
|
+
return;
|
|
1693
|
+
}
|
|
1694
|
+
if (this.current) {
|
|
1695
|
+
this.current.blur();
|
|
1696
|
+
}
|
|
1697
|
+
item.focus();
|
|
1698
|
+
this._current = item;
|
|
1699
|
+
}
|
|
1700
|
+
move(direction) {
|
|
1701
|
+
let moved = false;
|
|
1702
|
+
if (this.current) {
|
|
1703
|
+
const next = this.current[direction];
|
|
1704
|
+
if (next) {
|
|
1705
|
+
// Turning the value into an Observable isn't great, but it's the fastest way to avoid code duplication.
|
|
1706
|
+
// If performance ever matters for this, we can refactor using additional private methods.
|
|
1707
|
+
const nextObs = isObservable(next) ? next : of(next);
|
|
1708
|
+
nextObs.subscribe(item => {
|
|
1709
|
+
if (item) {
|
|
1710
|
+
this.moveTo(item);
|
|
1711
|
+
moved = true;
|
|
1712
|
+
}
|
|
1713
|
+
});
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
return moved;
|
|
1717
|
+
}
|
|
1718
|
+
activateCurrent() {
|
|
1719
|
+
if (this.current && this.current.activate) {
|
|
1720
|
+
this.current.activate();
|
|
1721
|
+
return true;
|
|
1722
|
+
}
|
|
1723
|
+
return false;
|
|
1724
|
+
}
|
|
1725
|
+
detachListeners(el) {
|
|
1726
|
+
const unlistenFuncs = this._unlistenFuncsMap.get(el);
|
|
1727
|
+
unlistenFuncs?.forEach(unlisten => unlisten());
|
|
1728
|
+
this._unlistenFuncsMap.delete(el);
|
|
1729
|
+
}
|
|
1730
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: FocusService, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1731
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: FocusService }); }
|
|
1732
|
+
}
|
|
1733
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: FocusService, decorators: [{
|
|
1734
|
+
type: Injectable
|
|
1735
|
+
}], ctorParameters: () => [{ type: i0.Renderer2 }] });
|
|
1736
|
+
function clrFocusServiceFactory(existing, renderer) {
|
|
1737
|
+
return existing || new FocusService(renderer);
|
|
1738
|
+
}
|
|
1739
|
+
const FOCUS_SERVICE_PROVIDER = {
|
|
1740
|
+
provide: FocusService,
|
|
1741
|
+
useFactory: clrFocusServiceFactory,
|
|
1742
|
+
deps: [[new Optional(), new SkipSelf(), FocusService], Renderer2],
|
|
1743
|
+
};
|
|
1744
|
+
|
|
1745
|
+
/*
|
|
1746
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1747
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1748
|
+
* This software is released under MIT license.
|
|
1749
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1750
|
+
*/
|
|
1751
|
+
class ScrollingService {
|
|
1752
|
+
constructor(_document) {
|
|
1753
|
+
this._document = _document;
|
|
1754
|
+
}
|
|
1755
|
+
stopScrolling() {
|
|
1756
|
+
this._document.body.classList.add('no-scrolling');
|
|
1757
|
+
}
|
|
1758
|
+
resumeScrolling() {
|
|
1759
|
+
if (this._document.body.classList.contains('no-scrolling')) {
|
|
1760
|
+
this._document.body.classList.remove('no-scrolling');
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ScrollingService, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1764
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ScrollingService }); }
|
|
1765
|
+
}
|
|
1766
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ScrollingService, decorators: [{
|
|
1767
|
+
type: Injectable
|
|
1768
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1769
|
+
type: Inject,
|
|
1770
|
+
args: [DOCUMENT]
|
|
1771
|
+
}] }] });
|
|
1772
|
+
|
|
1773
|
+
/**
|
|
1774
|
+
* This is just a copy of CdkDrag so it can be used independent of the rest of the CdkDragDropModule.
|
|
1775
|
+
*/
|
|
1776
|
+
class CdkDragModule_CdkDrag extends CdkDrag {
|
|
1777
|
+
/**
|
|
1778
|
+
* Include the constructor to forward all the dependencies to the base class
|
|
1779
|
+
* as a workaround to fix Angular "ɵɵinvalidFactoryDep" error after upgrading storybook
|
|
1780
|
+
* https://github.com/storybookjs/storybook/issues/23534
|
|
1781
|
+
*/
|
|
1782
|
+
constructor(elementRef, dropContainer, document, ngZone, viewContainerRef, config, dir, dragDrop, changeDetectorRef) {
|
|
1783
|
+
super(elementRef, dropContainer, document, ngZone, viewContainerRef, config, dir, dragDrop, changeDetectorRef);
|
|
1784
|
+
}
|
|
1785
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: CdkDragModule_CdkDrag, deps: [{ token: i0.ElementRef }, { token: CDK_DROP_LIST, optional: true }, { token: DOCUMENT, optional: true }, { token: i0.NgZone }, { token: i0.ViewContainerRef }, { token: CDK_DRAG_CONFIG, optional: true }, { token: i1$1.Directionality }, { token: i2$1.DragDrop }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1786
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: CdkDragModule_CdkDrag, isStandalone: false, selector: "[cdkDrag]", usesInheritance: true, ngImport: i0 }); }
|
|
1787
|
+
}
|
|
1788
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: CdkDragModule_CdkDrag, decorators: [{
|
|
1789
|
+
type: Directive,
|
|
1790
|
+
args: [{
|
|
1791
|
+
selector: '[cdkDrag]',
|
|
1792
|
+
standalone: false,
|
|
1793
|
+
}]
|
|
1794
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: undefined, decorators: [{
|
|
1795
|
+
type: Optional
|
|
1796
|
+
}, {
|
|
1797
|
+
type: Inject,
|
|
1798
|
+
args: [CDK_DROP_LIST]
|
|
1799
|
+
}] }, { type: undefined, decorators: [{
|
|
1800
|
+
type: Optional
|
|
1801
|
+
}, {
|
|
1802
|
+
type: Inject,
|
|
1803
|
+
args: [DOCUMENT]
|
|
1804
|
+
}] }, { type: i0.NgZone }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
|
|
1805
|
+
type: Optional
|
|
1806
|
+
}, {
|
|
1807
|
+
type: Inject,
|
|
1808
|
+
args: [CDK_DRAG_CONFIG]
|
|
1809
|
+
}] }, { type: i1$1.Directionality }, { type: i2$1.DragDrop }, { type: i0.ChangeDetectorRef }] });
|
|
1810
|
+
/**
|
|
1811
|
+
* This module allows us to avoid importing all of CdkDragDropModule which results in a smaller application bundle.
|
|
1812
|
+
*/
|
|
1813
|
+
class CdkDragModule {
|
|
1814
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: CdkDragModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1815
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.3", ngImport: i0, type: CdkDragModule, declarations: [CdkDragModule_CdkDrag], exports: [CdkDragModule_CdkDrag] }); }
|
|
1816
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: CdkDragModule }); }
|
|
1817
|
+
}
|
|
1818
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: CdkDragModule, decorators: [{
|
|
1819
|
+
type: NgModule,
|
|
1820
|
+
args: [{
|
|
1821
|
+
declarations: [CdkDragModule_CdkDrag],
|
|
1822
|
+
exports: [CdkDragModule_CdkDrag],
|
|
1823
|
+
}]
|
|
1824
|
+
}] });
|
|
1825
|
+
|
|
1826
|
+
/*
|
|
1827
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1828
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1829
|
+
* This software is released under MIT license.
|
|
1830
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1831
|
+
*/
|
|
1832
|
+
/**
|
|
1833
|
+
* This is just a copy of CdkTrapFocus so it can be used independent of the rest of the A11yModule.
|
|
1834
|
+
*/
|
|
1835
|
+
class CdkTrapFocusModule_CdkTrapFocus extends CdkTrapFocus {
|
|
1836
|
+
/**
|
|
1837
|
+
* Include the constructor to forward all the dependencies to the base class
|
|
1838
|
+
* as a workaround to fix Angular "ɵɵinvalidFactoryDep" error after upgrading storybook
|
|
1839
|
+
* https://github.com/storybookjs/storybook/issues/23534
|
|
1840
|
+
*/
|
|
1841
|
+
constructor(elementRef, focusTrapFactory, document) {
|
|
1842
|
+
super(elementRef, focusTrapFactory, document);
|
|
1843
|
+
}
|
|
1844
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: CdkTrapFocusModule_CdkTrapFocus, deps: [{ token: i0.ElementRef }, { token: i1.FocusTrapFactory }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1845
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: CdkTrapFocusModule_CdkTrapFocus, isStandalone: false, selector: "[cdkTrapFocus]", usesInheritance: true, ngImport: i0 }); }
|
|
1846
|
+
}
|
|
1847
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: CdkTrapFocusModule_CdkTrapFocus, decorators: [{
|
|
1848
|
+
type: Directive,
|
|
1849
|
+
args: [{
|
|
1850
|
+
selector: '[cdkTrapFocus]',
|
|
1851
|
+
standalone: false,
|
|
1852
|
+
}]
|
|
1853
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.FocusTrapFactory }, { type: undefined, decorators: [{
|
|
1854
|
+
type: Optional
|
|
1855
|
+
}, {
|
|
1856
|
+
type: Inject,
|
|
1857
|
+
args: [DOCUMENT]
|
|
1858
|
+
}] }] });
|
|
1859
|
+
/**
|
|
1860
|
+
* This module allows us to avoid importing all of A11yModule which results in a smaller application bundle.
|
|
1861
|
+
*/
|
|
1862
|
+
class CdkTrapFocusModule {
|
|
1863
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: CdkTrapFocusModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1864
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.3", ngImport: i0, type: CdkTrapFocusModule, declarations: [CdkTrapFocusModule_CdkTrapFocus], exports: [CdkTrapFocusModule_CdkTrapFocus] }); }
|
|
1865
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: CdkTrapFocusModule }); }
|
|
1866
|
+
}
|
|
1867
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: CdkTrapFocusModule, decorators: [{
|
|
1868
|
+
type: NgModule,
|
|
1869
|
+
args: [{
|
|
1870
|
+
declarations: [CdkTrapFocusModule_CdkTrapFocus],
|
|
1871
|
+
exports: [CdkTrapFocusModule_CdkTrapFocus],
|
|
1872
|
+
}]
|
|
1873
|
+
}] });
|
|
1874
|
+
|
|
1875
|
+
/*
|
|
1876
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1877
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1878
|
+
* This software is released under MIT license.
|
|
1879
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1880
|
+
*/
|
|
1881
|
+
/**
|
|
1882
|
+
* @description
|
|
1883
|
+
*
|
|
1884
|
+
* Developers should explicitly add this service to providers; it then can be injected
|
|
1885
|
+
* into a constructor and used as a notifier for the `takeUntil` operator. This eliminates
|
|
1886
|
+
* the need for boilerplates with subscriptions, and we don't need to implement the `OnDestroy`
|
|
1887
|
+
* interface and teardown subscriptions there.
|
|
1888
|
+
*
|
|
1889
|
+
* This can be used as follows:
|
|
1890
|
+
* ```ts
|
|
1891
|
+
* @Component({
|
|
1892
|
+
* selector: 'clr-button-group',
|
|
1893
|
+
* templateUrl: 'button-group.html',
|
|
1894
|
+
* providers: [ClrDestroyService],
|
|
1895
|
+
* })
|
|
1896
|
+
* export class ClrButtonGroup {
|
|
1897
|
+
* constructor(public buttonGroupNewService: ButtonInGroupService, private destroy$: ClrDestroyService) {}
|
|
1898
|
+
*
|
|
1899
|
+
* ngAfterContentInit() {
|
|
1900
|
+
* this.buttonGroupNewService.changes.pipe(takeUntil(this.destroy$)).subscribe(button => this.rearrangeButton(button));
|
|
1901
|
+
* }
|
|
1902
|
+
* }
|
|
1903
|
+
* ```
|
|
1904
|
+
*/
|
|
1905
|
+
class ClrDestroyService extends Subject {
|
|
1906
|
+
ngOnDestroy() {
|
|
1907
|
+
this.next();
|
|
1908
|
+
this.complete();
|
|
1909
|
+
}
|
|
1910
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrDestroyService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1911
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrDestroyService }); }
|
|
1912
|
+
}
|
|
1913
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrDestroyService, decorators: [{
|
|
1914
|
+
type: Injectable
|
|
1915
|
+
}] });
|
|
1916
|
+
|
|
1917
|
+
/*
|
|
1918
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1919
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1920
|
+
* This software is released under MIT license.
|
|
1921
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1922
|
+
*/
|
|
1923
|
+
|
|
1924
|
+
/*
|
|
1925
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1926
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1927
|
+
* This software is released under MIT license.
|
|
1928
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1929
|
+
*/
|
|
1930
|
+
|
|
1931
|
+
/*
|
|
1932
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1933
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1934
|
+
* This software is released under MIT license.
|
|
1935
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1936
|
+
*/
|
|
1937
|
+
/**
|
|
1938
|
+
* A (clockwise) enumeration for positions around an element.
|
|
1939
|
+
*
|
|
1940
|
+
* A B C
|
|
1941
|
+
* L ----------- D
|
|
1942
|
+
* | |
|
|
1943
|
+
* | |
|
|
1944
|
+
* K | | E
|
|
1945
|
+
* | |
|
|
1946
|
+
* | |
|
|
1947
|
+
* J ----------- F
|
|
1948
|
+
* I H G
|
|
1949
|
+
*
|
|
1950
|
+
* TOP_LEFT = A
|
|
1951
|
+
* TOP_CENTER = B
|
|
1952
|
+
* TOP_RIGHT = C
|
|
1953
|
+
* RIGHT_TOP = D
|
|
1954
|
+
* RIGHT_CENTER = E
|
|
1955
|
+
* RIGHT_BOTTOM = F
|
|
1956
|
+
* BOTTOM_RIGHT = G
|
|
1957
|
+
* BOTTOM_CENTER = H
|
|
1958
|
+
* BOTTOM_LEFT = I
|
|
1959
|
+
* LEFT_BOTTOM = J
|
|
1960
|
+
* LEFT_CENTER = K
|
|
1961
|
+
* LEFT_TOP = L
|
|
1962
|
+
*
|
|
1963
|
+
*
|
|
1964
|
+
* Consumers tell us that they want something to display on the TOP_LEFT of the trigger and that they want the
|
|
1965
|
+
* _content_ container to orient AT the bottom left.
|
|
1966
|
+
* In order to calculate the position for the content I need to match up the origin/trigger ClrPosition with the
|
|
1967
|
+
* content ClrPosition.
|
|
1968
|
+
*
|
|
1969
|
+
* Origin TOP_LEFT **AT** Content BOTTOM_LEFT.
|
|
1970
|
+
* -----------
|
|
1971
|
+
* | |
|
|
1972
|
+
* | |
|
|
1973
|
+
* | content |
|
|
1974
|
+
* | |
|
|
1975
|
+
* | |
|
|
1976
|
+
* -----------
|
|
1977
|
+
* |/
|
|
1978
|
+
* -----------
|
|
1979
|
+
* | |
|
|
1980
|
+
* | |
|
|
1981
|
+
* | trigger |
|
|
1982
|
+
* | |
|
|
1983
|
+
* | |
|
|
1984
|
+
* -----------
|
|
1985
|
+
*
|
|
1986
|
+
*/
|
|
1987
|
+
var ClrPosition;
|
|
1988
|
+
(function (ClrPosition) {
|
|
1989
|
+
ClrPosition[ClrPosition["TOP_LEFT"] = 0] = "TOP_LEFT";
|
|
1990
|
+
ClrPosition[ClrPosition["TOP_CENTER"] = 1] = "TOP_CENTER";
|
|
1991
|
+
ClrPosition[ClrPosition["TOP_RIGHT"] = 2] = "TOP_RIGHT";
|
|
1992
|
+
ClrPosition[ClrPosition["RIGHT_TOP"] = 3] = "RIGHT_TOP";
|
|
1993
|
+
ClrPosition[ClrPosition["RIGHT_CENTER"] = 4] = "RIGHT_CENTER";
|
|
1994
|
+
ClrPosition[ClrPosition["RIGHT_BOTTOM"] = 5] = "RIGHT_BOTTOM";
|
|
1995
|
+
ClrPosition[ClrPosition["BOTTOM_RIGHT"] = 6] = "BOTTOM_RIGHT";
|
|
1996
|
+
ClrPosition[ClrPosition["BOTTOM_CENTER"] = 7] = "BOTTOM_CENTER";
|
|
1997
|
+
ClrPosition[ClrPosition["BOTTOM_LEFT"] = 8] = "BOTTOM_LEFT";
|
|
1998
|
+
ClrPosition[ClrPosition["LEFT_BOTTOM"] = 9] = "LEFT_BOTTOM";
|
|
1999
|
+
ClrPosition[ClrPosition["LEFT_CENTER"] = 10] = "LEFT_CENTER";
|
|
2000
|
+
ClrPosition[ClrPosition["LEFT_TOP"] = 11] = "LEFT_TOP";
|
|
2001
|
+
})(ClrPosition || (ClrPosition = {}));
|
|
2002
|
+
|
|
2003
|
+
/*
|
|
2004
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
2005
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
2006
|
+
* This software is released under MIT license.
|
|
2007
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
2008
|
+
*/
|
|
2009
|
+
/*
|
|
2010
|
+
* After a conversation with the Angular core team, it turns out we don't have much of a choice for our
|
|
2011
|
+
* declarative API, we need to fight against change detection and its one-way flow. This is
|
|
2012
|
+
* currently the least dirty solution to do what we want.
|
|
2013
|
+
*
|
|
2014
|
+
* Do not modify or even use this class unless you know exactly what you're doing.
|
|
2015
|
+
* It has the potential to trigger change detection loops or kill app performances.
|
|
2016
|
+
*/
|
|
2017
|
+
class WillyWonka {
|
|
2018
|
+
constructor() {
|
|
2019
|
+
this.disableChocolateCheck = false;
|
|
2020
|
+
this._chocolate = new Subject();
|
|
2021
|
+
}
|
|
2022
|
+
get chocolate() {
|
|
2023
|
+
return this._chocolate.asObservable();
|
|
2024
|
+
}
|
|
2025
|
+
ngAfterViewChecked() {
|
|
2026
|
+
if (!this.disableChocolateCheck) {
|
|
2027
|
+
this._chocolate.next();
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: WillyWonka, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2031
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: WillyWonka, isStandalone: true, ngImport: i0 }); }
|
|
2032
|
+
}
|
|
2033
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: WillyWonka, decorators: [{
|
|
2034
|
+
type: Directive
|
|
2035
|
+
}] });
|
|
2036
|
+
|
|
2037
|
+
/*
|
|
2038
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
2039
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
2040
|
+
* This software is released under MIT license.
|
|
2041
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
2042
|
+
*/
|
|
2043
|
+
class OompaLoompa {
|
|
2044
|
+
// FIXME: Request Injector once we move to Angular 4.2+, it'll allow easier refactors
|
|
2045
|
+
constructor(cdr, willyWonka) {
|
|
2046
|
+
this.subscription = willyWonka.chocolate.subscribe(() => {
|
|
2047
|
+
if (this.latestFlavor !== this.flavor) {
|
|
2048
|
+
willyWonka.disableChocolateCheck = true;
|
|
2049
|
+
cdr.detectChanges();
|
|
2050
|
+
willyWonka.disableChocolateCheck = false;
|
|
2051
|
+
}
|
|
2052
|
+
});
|
|
2053
|
+
}
|
|
2054
|
+
ngAfterContentChecked() {
|
|
2055
|
+
this.latestFlavor = this.flavor;
|
|
2056
|
+
}
|
|
2057
|
+
ngOnDestroy() {
|
|
2058
|
+
this.subscription.unsubscribe();
|
|
2059
|
+
}
|
|
2060
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: OompaLoompa, deps: [{ token: i0.ChangeDetectorRef }, { token: WillyWonka }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2061
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: OompaLoompa, isStandalone: true, ngImport: i0 }); }
|
|
2062
|
+
}
|
|
2063
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: OompaLoompa, decorators: [{
|
|
2064
|
+
type: Directive
|
|
2065
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: WillyWonka }] });
|
|
2066
|
+
|
|
2067
|
+
/*
|
|
2068
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
2069
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
2070
|
+
* This software is released under MIT license.
|
|
2071
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
2072
|
+
*/
|
|
2073
|
+
|
|
2074
|
+
/**
|
|
2075
|
+
* Generated bundle index. Do not edit.
|
|
2076
|
+
*/
|
|
2077
|
+
|
|
2078
|
+
export { ArrowKeyDirection, BASIC_FOCUSABLE_ITEM_PROVIDER, BaseExpandableAnimation, BasicFocusableItem, CdkDragModule, CdkDragModule_CdkDrag, CdkTrapFocusModule, CdkTrapFocusModule_CdkTrapFocus, ClrCommonStringsService, ClrDestroyService, ClrExpandableAnimation, ClrExpandableAnimationDirective, ClrExpandableAnimationModule, ClrFocusOnViewInit, ClrFocusOnViewInitModule, ClrHostWrappingModule, ClrKeyFocus, ClrKeyFocusItem, ClrKeyFocusModule, ClrOutsideClickModule, ClrPosition, ClrRovingTabindex, ClrStandaloneCdkTrapFocus, ClrTemplateRefModule, DATEPICKER_ENABLE_BREAKPOINT, DomAdapter, EXPANDABLE_ANIMATION_DIRECTIVES, EXTRA_LARGE_BREAKPOINT, EmptyAnchor, FOCUS_ON_VIEW_INIT, FOCUS_ON_VIEW_INIT_DIRECTIVES, FOCUS_SERVICE_PROVIDER, FocusService, FocusableItem, HostWrapper, Keys, LARGE_BREAKPOINT, Linkers, MEDIUM_BREAKPOINT, MOCK_DOM_ADAPTER_PROVIDER, MockDomAdapter, MockFocusableItem, OUSTIDE_CLICK_DIRECTIVES, OompaLoompa, OutsideClick, SMALL_BREAKPOINT, ScrollingService, TemplateRefContainer, WillyWonka, assertNever, clrFocusServiceFactory, collapse, commonStringsDefault, customFocusableItemProvider, defaultAnimationTiming, defaultExpandAnimation, fade, fadeSlide, isBooleanAttributeSet, isKeyEitherLetterOrNumber, preventArrowKeyScroll, slide, triggerAllFormControlValidation, uniqueIdFactory, wrapObservable };
|
|
2079
|
+
//# sourceMappingURL=clr-angular-utils.mjs.map
|