@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,1082 @@
|
|
|
1
|
+
import { hasModifierKey } from '@angular/cdk/keycodes';
|
|
2
|
+
import * as i1 from '@angular/cdk/overlay';
|
|
3
|
+
import { OverlayConfig } from '@angular/cdk/overlay';
|
|
4
|
+
import { DomPortal } from '@angular/cdk/portal';
|
|
5
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
6
|
+
import * as i0 from '@angular/core';
|
|
7
|
+
import { ElementRef, Injectable, PLATFORM_ID, Input, Optional, SkipSelf, Inject, Directive, InjectionToken, HostListener, EventEmitter, Output, NgModule } from '@angular/core';
|
|
8
|
+
import { preventArrowKeyScroll, ClrPosition, Keys } from '@clr/angular/utils';
|
|
9
|
+
import { Subject, merge, timer, switchMap, fromEvent } from 'rxjs';
|
|
10
|
+
import { filter } from 'rxjs/operators';
|
|
11
|
+
|
|
12
|
+
class ClrPopoverService {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.panelClass = [];
|
|
15
|
+
this._open = false;
|
|
16
|
+
this._openChange = new Subject();
|
|
17
|
+
this._openEventChange = new Subject();
|
|
18
|
+
this._positionChange = new Subject();
|
|
19
|
+
this._resetPositions = new Subject();
|
|
20
|
+
this._updatePosition = new Subject();
|
|
21
|
+
this._popoverVisible = new Subject();
|
|
22
|
+
}
|
|
23
|
+
get originElement() {
|
|
24
|
+
return this.origin instanceof ElementRef ? this.origin : null;
|
|
25
|
+
}
|
|
26
|
+
get originPoint() {
|
|
27
|
+
return this.origin && 'x' in this.origin && 'y' in this.origin ? this.origin : null;
|
|
28
|
+
}
|
|
29
|
+
get openChange() {
|
|
30
|
+
return this._openChange.asObservable();
|
|
31
|
+
}
|
|
32
|
+
get popoverVisible() {
|
|
33
|
+
return this._popoverVisible.asObservable();
|
|
34
|
+
}
|
|
35
|
+
get openEvent() {
|
|
36
|
+
return this._openEvent;
|
|
37
|
+
}
|
|
38
|
+
set openEvent(event) {
|
|
39
|
+
this._openEvent = event;
|
|
40
|
+
this._openEventChange.next(event);
|
|
41
|
+
}
|
|
42
|
+
get open() {
|
|
43
|
+
return this._open;
|
|
44
|
+
}
|
|
45
|
+
set open(value) {
|
|
46
|
+
value = !!value;
|
|
47
|
+
if (this._open !== value) {
|
|
48
|
+
this._open = value;
|
|
49
|
+
this._openChange.next(value);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
get resetPositionsChange() {
|
|
53
|
+
return this._resetPositions.asObservable();
|
|
54
|
+
}
|
|
55
|
+
positionChange(position) {
|
|
56
|
+
this._positionChange.next(position);
|
|
57
|
+
}
|
|
58
|
+
updatePositionChange() {
|
|
59
|
+
return this._updatePosition.asObservable();
|
|
60
|
+
}
|
|
61
|
+
getPositionChange() {
|
|
62
|
+
return this._positionChange.asObservable();
|
|
63
|
+
}
|
|
64
|
+
getEventChange() {
|
|
65
|
+
return this._openEventChange.asObservable();
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Sometimes, we need to remember the event that triggered the toggling to avoid loops.
|
|
69
|
+
* This is for instance the case of components that open on a click, but close on a click outside.
|
|
70
|
+
*/
|
|
71
|
+
toggleWithEvent(event) {
|
|
72
|
+
preventArrowKeyScroll(event);
|
|
73
|
+
this.openEvent = event;
|
|
74
|
+
this.open = !this.open;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Opens the popover at a specific screen coordinate.
|
|
78
|
+
* Useful for context menus where the popover should appear at the cursor position.
|
|
79
|
+
*/
|
|
80
|
+
openAtPoint(point, targetElement) {
|
|
81
|
+
if (this._open) {
|
|
82
|
+
this._open = false;
|
|
83
|
+
this._openChange.next(false);
|
|
84
|
+
}
|
|
85
|
+
this.origin = point;
|
|
86
|
+
this.pointTargetElement = targetElement;
|
|
87
|
+
this.open = true;
|
|
88
|
+
}
|
|
89
|
+
popoverVisibleEmit(visible) {
|
|
90
|
+
this._popoverVisible.next(visible);
|
|
91
|
+
}
|
|
92
|
+
resetPositions() {
|
|
93
|
+
this._resetPositions.next();
|
|
94
|
+
}
|
|
95
|
+
updatePosition() {
|
|
96
|
+
this._updatePosition.next();
|
|
97
|
+
}
|
|
98
|
+
focusCloseButton() {
|
|
99
|
+
this.closeButtonRef.nativeElement?.focus();
|
|
100
|
+
}
|
|
101
|
+
focusOrigin() {
|
|
102
|
+
this.originElement?.nativeElement?.focus({ preventScroll: true });
|
|
103
|
+
}
|
|
104
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrPopoverService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
105
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrPopoverService }); }
|
|
106
|
+
}
|
|
107
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrPopoverService, decorators: [{
|
|
108
|
+
type: Injectable
|
|
109
|
+
}] });
|
|
110
|
+
|
|
111
|
+
/*
|
|
112
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
113
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
114
|
+
* This software is released under MIT license.
|
|
115
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
116
|
+
*/
|
|
117
|
+
var ClrPopoverType;
|
|
118
|
+
(function (ClrPopoverType) {
|
|
119
|
+
ClrPopoverType[ClrPopoverType["SIGNPOST"] = 0] = "SIGNPOST";
|
|
120
|
+
ClrPopoverType[ClrPopoverType["TOOLTIP"] = 1] = "TOOLTIP";
|
|
121
|
+
ClrPopoverType[ClrPopoverType["DROPDOWN"] = 2] = "DROPDOWN";
|
|
122
|
+
ClrPopoverType[ClrPopoverType["DEFAULT"] = 3] = "DEFAULT";
|
|
123
|
+
})(ClrPopoverType || (ClrPopoverType = {}));
|
|
124
|
+
var ClrPopoverPosition;
|
|
125
|
+
(function (ClrPopoverPosition) {
|
|
126
|
+
ClrPopoverPosition["TOP_RIGHT"] = "top-right";
|
|
127
|
+
ClrPopoverPosition["TOP_MIDDLE"] = "top-middle";
|
|
128
|
+
ClrPopoverPosition["TOP_LEFT"] = "top-left";
|
|
129
|
+
ClrPopoverPosition["RIGHT"] = "right";
|
|
130
|
+
ClrPopoverPosition["RIGHT_TOP"] = "right-top";
|
|
131
|
+
ClrPopoverPosition["RIGHT_MIDDLE"] = "right-middle";
|
|
132
|
+
ClrPopoverPosition["RIGHT_BOTTOM"] = "right-bottom";
|
|
133
|
+
ClrPopoverPosition["LEFT"] = "left";
|
|
134
|
+
ClrPopoverPosition["LEFT_TOP"] = "left-top";
|
|
135
|
+
ClrPopoverPosition["LEFT_MIDDLE"] = "left-middle";
|
|
136
|
+
ClrPopoverPosition["LEFT_BOTTOM"] = "left-bottom";
|
|
137
|
+
ClrPopoverPosition["BOTTOM_RIGHT"] = "bottom-right";
|
|
138
|
+
ClrPopoverPosition["BOTTOM_MIDDLE"] = "bottom-middle";
|
|
139
|
+
ClrPopoverPosition["BOTTOM_LEFT"] = "bottom-left";
|
|
140
|
+
})(ClrPopoverPosition || (ClrPopoverPosition = {}));
|
|
141
|
+
const TOOLTIP_POSITIONS = [
|
|
142
|
+
ClrPopoverPosition.RIGHT, // default. must be at index 0
|
|
143
|
+
ClrPopoverPosition.LEFT,
|
|
144
|
+
ClrPopoverPosition.BOTTOM_RIGHT,
|
|
145
|
+
ClrPopoverPosition.BOTTOM_LEFT,
|
|
146
|
+
ClrPopoverPosition.TOP_RIGHT,
|
|
147
|
+
ClrPopoverPosition.TOP_LEFT,
|
|
148
|
+
];
|
|
149
|
+
const DROPDOWN_POSITIONS = [
|
|
150
|
+
ClrPopoverPosition.BOTTOM_LEFT, // default. must be at index 0
|
|
151
|
+
ClrPopoverPosition.BOTTOM_RIGHT,
|
|
152
|
+
ClrPopoverPosition.TOP_LEFT,
|
|
153
|
+
ClrPopoverPosition.TOP_RIGHT,
|
|
154
|
+
ClrPopoverPosition.RIGHT_TOP,
|
|
155
|
+
ClrPopoverPosition.RIGHT_BOTTOM,
|
|
156
|
+
ClrPopoverPosition.LEFT_TOP,
|
|
157
|
+
ClrPopoverPosition.LEFT_BOTTOM,
|
|
158
|
+
];
|
|
159
|
+
const SIGNPOST_POSITIONS = [
|
|
160
|
+
ClrPopoverPosition.RIGHT_MIDDLE, // default. must be at index 0
|
|
161
|
+
ClrPopoverPosition.RIGHT_TOP,
|
|
162
|
+
ClrPopoverPosition.RIGHT_BOTTOM,
|
|
163
|
+
ClrPopoverPosition.TOP_RIGHT,
|
|
164
|
+
ClrPopoverPosition.TOP_LEFT,
|
|
165
|
+
ClrPopoverPosition.TOP_MIDDLE,
|
|
166
|
+
ClrPopoverPosition.BOTTOM_RIGHT,
|
|
167
|
+
ClrPopoverPosition.BOTTOM_MIDDLE,
|
|
168
|
+
ClrPopoverPosition.BOTTOM_LEFT,
|
|
169
|
+
ClrPopoverPosition.LEFT_BOTTOM,
|
|
170
|
+
ClrPopoverPosition.LEFT_MIDDLE,
|
|
171
|
+
ClrPopoverPosition.LEFT_TOP,
|
|
172
|
+
];
|
|
173
|
+
function getPositionsArray(type) {
|
|
174
|
+
switch (type) {
|
|
175
|
+
case ClrPopoverType.TOOLTIP:
|
|
176
|
+
return TOOLTIP_POSITIONS;
|
|
177
|
+
case ClrPopoverType.DROPDOWN:
|
|
178
|
+
return DROPDOWN_POSITIONS;
|
|
179
|
+
case ClrPopoverType.SIGNPOST:
|
|
180
|
+
case ClrPopoverType.DEFAULT:
|
|
181
|
+
default:
|
|
182
|
+
return SIGNPOST_POSITIONS;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function getConnectedPositions(type) {
|
|
186
|
+
const result = [];
|
|
187
|
+
getPositionsArray(type).forEach(position => {
|
|
188
|
+
result.push(mapPopoverKeyToPosition(position, type));
|
|
189
|
+
});
|
|
190
|
+
return result;
|
|
191
|
+
}
|
|
192
|
+
const POPOVER_OFFSETS = {
|
|
193
|
+
[ClrPopoverType.SIGNPOST]: 16,
|
|
194
|
+
[ClrPopoverType.TOOLTIP]: 21,
|
|
195
|
+
[ClrPopoverType.DROPDOWN]: 2,
|
|
196
|
+
[ClrPopoverType.DEFAULT]: 0,
|
|
197
|
+
};
|
|
198
|
+
function getOffset(key, type) {
|
|
199
|
+
const offset = POPOVER_OFFSETS[type] || 0;
|
|
200
|
+
switch (key) {
|
|
201
|
+
// TOP
|
|
202
|
+
case ClrPopoverPosition.TOP_LEFT:
|
|
203
|
+
case ClrPopoverPosition.TOP_MIDDLE:
|
|
204
|
+
case ClrPopoverPosition.TOP_RIGHT:
|
|
205
|
+
return {
|
|
206
|
+
offsetY: -offset,
|
|
207
|
+
offsetX: 0,
|
|
208
|
+
};
|
|
209
|
+
// LEFT
|
|
210
|
+
case ClrPopoverPosition.LEFT_TOP:
|
|
211
|
+
case ClrPopoverPosition.LEFT_MIDDLE:
|
|
212
|
+
case ClrPopoverPosition.LEFT:
|
|
213
|
+
case ClrPopoverPosition.LEFT_BOTTOM:
|
|
214
|
+
return {
|
|
215
|
+
offsetY: 0,
|
|
216
|
+
offsetX: -offset,
|
|
217
|
+
};
|
|
218
|
+
// RIGHT
|
|
219
|
+
case ClrPopoverPosition.RIGHT_TOP:
|
|
220
|
+
case ClrPopoverPosition.RIGHT_MIDDLE:
|
|
221
|
+
case ClrPopoverPosition.RIGHT:
|
|
222
|
+
case ClrPopoverPosition.RIGHT_BOTTOM:
|
|
223
|
+
return {
|
|
224
|
+
offsetY: 0,
|
|
225
|
+
offsetX: offset,
|
|
226
|
+
};
|
|
227
|
+
// BOTTOM and DEFAULT
|
|
228
|
+
case ClrPopoverPosition.BOTTOM_RIGHT:
|
|
229
|
+
case ClrPopoverPosition.BOTTOM_MIDDLE:
|
|
230
|
+
case ClrPopoverPosition.BOTTOM_LEFT:
|
|
231
|
+
default:
|
|
232
|
+
return {
|
|
233
|
+
offsetY: offset,
|
|
234
|
+
offsetX: 0,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
const STANDARD_ORIGINS = {
|
|
239
|
+
// TOP
|
|
240
|
+
[ClrPopoverPosition.TOP_RIGHT]: { origin: ClrPosition.TOP_CENTER, content: ClrPosition.BOTTOM_LEFT },
|
|
241
|
+
[ClrPopoverPosition.TOP_MIDDLE]: { origin: ClrPosition.TOP_CENTER, content: ClrPosition.BOTTOM_CENTER },
|
|
242
|
+
[ClrPopoverPosition.TOP_LEFT]: { origin: ClrPosition.TOP_CENTER, content: ClrPosition.BOTTOM_RIGHT },
|
|
243
|
+
// LEFT
|
|
244
|
+
[ClrPopoverPosition.LEFT]: { origin: ClrPosition.LEFT_CENTER, content: ClrPosition.RIGHT_TOP },
|
|
245
|
+
[ClrPopoverPosition.LEFT_TOP]: { origin: ClrPosition.LEFT_CENTER, content: ClrPosition.RIGHT_BOTTOM },
|
|
246
|
+
[ClrPopoverPosition.LEFT_MIDDLE]: { origin: ClrPosition.LEFT_CENTER, content: ClrPosition.RIGHT_CENTER },
|
|
247
|
+
[ClrPopoverPosition.LEFT_BOTTOM]: { origin: ClrPosition.LEFT_CENTER, content: ClrPosition.RIGHT_TOP },
|
|
248
|
+
// RIGHT
|
|
249
|
+
[ClrPopoverPosition.RIGHT]: { origin: ClrPosition.RIGHT_CENTER, content: ClrPosition.LEFT_TOP },
|
|
250
|
+
[ClrPopoverPosition.RIGHT_TOP]: { origin: ClrPosition.RIGHT_CENTER, content: ClrPosition.LEFT_BOTTOM },
|
|
251
|
+
[ClrPopoverPosition.RIGHT_MIDDLE]: { origin: ClrPosition.RIGHT_CENTER, content: ClrPosition.LEFT_CENTER },
|
|
252
|
+
[ClrPopoverPosition.RIGHT_BOTTOM]: { origin: ClrPosition.RIGHT_CENTER, content: ClrPosition.LEFT_TOP },
|
|
253
|
+
// BOTTOM
|
|
254
|
+
[ClrPopoverPosition.BOTTOM_RIGHT]: { origin: ClrPosition.BOTTOM_CENTER, content: ClrPosition.TOP_LEFT },
|
|
255
|
+
[ClrPopoverPosition.BOTTOM_MIDDLE]: { origin: ClrPosition.BOTTOM_CENTER, content: ClrPosition.TOP_CENTER },
|
|
256
|
+
[ClrPopoverPosition.BOTTOM_LEFT]: { origin: ClrPosition.BOTTOM_CENTER, content: ClrPosition.TOP_RIGHT },
|
|
257
|
+
};
|
|
258
|
+
const DROPDOWN_ORIGINS = {
|
|
259
|
+
// TOP
|
|
260
|
+
[ClrPopoverPosition.TOP_RIGHT]: { origin: ClrPosition.TOP_RIGHT, content: ClrPosition.BOTTOM_RIGHT },
|
|
261
|
+
[ClrPopoverPosition.TOP_LEFT]: { origin: ClrPosition.TOP_LEFT, content: ClrPosition.BOTTOM_LEFT },
|
|
262
|
+
// LEFT
|
|
263
|
+
[ClrPopoverPosition.LEFT_TOP]: { origin: ClrPosition.LEFT_TOP, content: ClrPosition.TOP_RIGHT },
|
|
264
|
+
[ClrPopoverPosition.LEFT_BOTTOM]: { origin: ClrPosition.LEFT_BOTTOM, content: ClrPosition.BOTTOM_RIGHT },
|
|
265
|
+
// RIGHT
|
|
266
|
+
[ClrPopoverPosition.RIGHT_TOP]: { origin: ClrPosition.RIGHT_TOP, content: ClrPosition.LEFT_TOP },
|
|
267
|
+
[ClrPopoverPosition.RIGHT_BOTTOM]: { origin: ClrPosition.RIGHT_BOTTOM, content: ClrPosition.LEFT_BOTTOM },
|
|
268
|
+
// BOTTOM
|
|
269
|
+
[ClrPopoverPosition.BOTTOM_RIGHT]: { origin: ClrPosition.BOTTOM_LEFT, content: ClrPosition.TOP_RIGHT },
|
|
270
|
+
[ClrPopoverPosition.BOTTOM_LEFT]: { origin: ClrPosition.BOTTOM_RIGHT, content: ClrPosition.TOP_LEFT },
|
|
271
|
+
};
|
|
272
|
+
function mapPopoverKeyToPosition(key, type) {
|
|
273
|
+
let offset = getOffset(key, type);
|
|
274
|
+
const defaultPosition = { origin: ClrPosition.BOTTOM_LEFT, content: ClrPosition.TOP_LEFT };
|
|
275
|
+
const { origin, content } = (type === ClrPopoverType.DROPDOWN ? DROPDOWN_ORIGINS[key] : STANDARD_ORIGINS[key]) ?? defaultPosition;
|
|
276
|
+
return {
|
|
277
|
+
...getOriginPosition(origin),
|
|
278
|
+
...getContentPosition(content),
|
|
279
|
+
...offset,
|
|
280
|
+
panelClass: key,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
function getOriginPosition(key) {
|
|
284
|
+
switch (key) {
|
|
285
|
+
// TOP Positions
|
|
286
|
+
case ClrPosition.TOP_LEFT:
|
|
287
|
+
return {
|
|
288
|
+
originX: 'start',
|
|
289
|
+
originY: 'top',
|
|
290
|
+
};
|
|
291
|
+
case ClrPosition.TOP_CENTER:
|
|
292
|
+
return {
|
|
293
|
+
originX: 'center',
|
|
294
|
+
originY: 'top',
|
|
295
|
+
};
|
|
296
|
+
case ClrPosition.TOP_RIGHT:
|
|
297
|
+
return {
|
|
298
|
+
originX: 'end',
|
|
299
|
+
originY: 'top',
|
|
300
|
+
};
|
|
301
|
+
// LEFT Positions
|
|
302
|
+
case ClrPosition.LEFT_TOP:
|
|
303
|
+
return {
|
|
304
|
+
originX: 'start',
|
|
305
|
+
originY: 'top',
|
|
306
|
+
};
|
|
307
|
+
case ClrPosition.LEFT_CENTER:
|
|
308
|
+
return {
|
|
309
|
+
originX: 'start',
|
|
310
|
+
originY: 'center',
|
|
311
|
+
};
|
|
312
|
+
case ClrPosition.LEFT_BOTTOM:
|
|
313
|
+
return {
|
|
314
|
+
originX: 'start',
|
|
315
|
+
originY: 'bottom',
|
|
316
|
+
};
|
|
317
|
+
// RIGHT Positions
|
|
318
|
+
case ClrPosition.RIGHT_TOP:
|
|
319
|
+
return {
|
|
320
|
+
originX: 'end',
|
|
321
|
+
originY: 'top',
|
|
322
|
+
};
|
|
323
|
+
case ClrPosition.RIGHT_CENTER:
|
|
324
|
+
return {
|
|
325
|
+
originX: 'end',
|
|
326
|
+
originY: 'center',
|
|
327
|
+
};
|
|
328
|
+
case ClrPosition.RIGHT_BOTTOM:
|
|
329
|
+
return {
|
|
330
|
+
originX: 'end',
|
|
331
|
+
originY: 'bottom',
|
|
332
|
+
};
|
|
333
|
+
// BOTTOM positions and default
|
|
334
|
+
case ClrPosition.BOTTOM_LEFT:
|
|
335
|
+
return {
|
|
336
|
+
originX: 'end',
|
|
337
|
+
originY: 'bottom',
|
|
338
|
+
};
|
|
339
|
+
case ClrPosition.BOTTOM_CENTER:
|
|
340
|
+
return {
|
|
341
|
+
originX: 'center',
|
|
342
|
+
originY: 'bottom',
|
|
343
|
+
};
|
|
344
|
+
case ClrPosition.BOTTOM_RIGHT:
|
|
345
|
+
default:
|
|
346
|
+
return {
|
|
347
|
+
originX: 'start',
|
|
348
|
+
originY: 'bottom',
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
function getContentPosition(key) {
|
|
353
|
+
switch (key) {
|
|
354
|
+
// TOP Positions
|
|
355
|
+
case ClrPosition.TOP_LEFT:
|
|
356
|
+
return {
|
|
357
|
+
overlayX: 'start',
|
|
358
|
+
overlayY: 'top',
|
|
359
|
+
};
|
|
360
|
+
case ClrPosition.TOP_CENTER:
|
|
361
|
+
return {
|
|
362
|
+
overlayX: 'center',
|
|
363
|
+
overlayY: 'top',
|
|
364
|
+
};
|
|
365
|
+
case ClrPosition.TOP_RIGHT:
|
|
366
|
+
return {
|
|
367
|
+
overlayX: 'end',
|
|
368
|
+
overlayY: 'top',
|
|
369
|
+
};
|
|
370
|
+
// LEFT Positions
|
|
371
|
+
case ClrPosition.LEFT_TOP:
|
|
372
|
+
return {
|
|
373
|
+
overlayX: 'start',
|
|
374
|
+
overlayY: 'top',
|
|
375
|
+
};
|
|
376
|
+
case ClrPosition.LEFT_CENTER:
|
|
377
|
+
return {
|
|
378
|
+
overlayX: 'start',
|
|
379
|
+
overlayY: 'center',
|
|
380
|
+
};
|
|
381
|
+
case ClrPosition.LEFT_BOTTOM:
|
|
382
|
+
return {
|
|
383
|
+
overlayX: 'start',
|
|
384
|
+
overlayY: 'bottom',
|
|
385
|
+
};
|
|
386
|
+
// RIGHT Positions
|
|
387
|
+
case ClrPosition.RIGHT_TOP:
|
|
388
|
+
return {
|
|
389
|
+
overlayX: 'end',
|
|
390
|
+
overlayY: 'top',
|
|
391
|
+
};
|
|
392
|
+
case ClrPosition.RIGHT_CENTER:
|
|
393
|
+
return {
|
|
394
|
+
overlayX: 'end',
|
|
395
|
+
overlayY: 'center',
|
|
396
|
+
};
|
|
397
|
+
case ClrPosition.RIGHT_BOTTOM:
|
|
398
|
+
return {
|
|
399
|
+
overlayX: 'end',
|
|
400
|
+
overlayY: 'bottom',
|
|
401
|
+
};
|
|
402
|
+
// BOTTOM positions and default
|
|
403
|
+
case ClrPosition.BOTTOM_LEFT:
|
|
404
|
+
return {
|
|
405
|
+
overlayX: 'start',
|
|
406
|
+
overlayY: 'bottom',
|
|
407
|
+
};
|
|
408
|
+
case ClrPosition.BOTTOM_CENTER:
|
|
409
|
+
return {
|
|
410
|
+
overlayX: 'center',
|
|
411
|
+
overlayY: 'bottom',
|
|
412
|
+
};
|
|
413
|
+
case ClrPosition.BOTTOM_RIGHT:
|
|
414
|
+
default:
|
|
415
|
+
return {
|
|
416
|
+
overlayX: 'end',
|
|
417
|
+
overlayY: 'bottom',
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/*
|
|
423
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
424
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
425
|
+
* This software is released under MIT license.
|
|
426
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
427
|
+
*/
|
|
428
|
+
/** @dynamic */
|
|
429
|
+
class ClrPopoverContent {
|
|
430
|
+
constructor(element, container, template, overlayContainer, parent, overlay, popoverService, zone, platformId) {
|
|
431
|
+
this.container = container;
|
|
432
|
+
this.template = template;
|
|
433
|
+
this.parent = parent;
|
|
434
|
+
this.overlay = overlay;
|
|
435
|
+
this.popoverService = popoverService;
|
|
436
|
+
this.zone = zone;
|
|
437
|
+
this.platformId = platformId;
|
|
438
|
+
this._outsideClickClose = true;
|
|
439
|
+
this._scrollToClose = false;
|
|
440
|
+
this.popoverType = ClrPopoverType.DEFAULT;
|
|
441
|
+
this._availablePositions = [];
|
|
442
|
+
this._position = ClrPopoverPosition.BOTTOM_LEFT;
|
|
443
|
+
this.subscriptions = [];
|
|
444
|
+
this.preferredPositionIsSet = false;
|
|
445
|
+
this.availablePositionsAreSet = false;
|
|
446
|
+
this._preferredPosition = {
|
|
447
|
+
originX: 'start',
|
|
448
|
+
originY: 'top',
|
|
449
|
+
overlayX: 'end',
|
|
450
|
+
overlayY: 'top',
|
|
451
|
+
panelClass: ClrPopoverPosition.LEFT_TOP,
|
|
452
|
+
};
|
|
453
|
+
popoverService.panelClass.push('clr-popover-content');
|
|
454
|
+
overlayContainer.getContainerElement().classList.add('clr-overlay-container');
|
|
455
|
+
if (!template) {
|
|
456
|
+
this.elementRef = element;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
set open(value) {
|
|
460
|
+
this.popoverService.open = !!value;
|
|
461
|
+
}
|
|
462
|
+
get contentAt() {
|
|
463
|
+
return this.preferredPositionIsSet ? this._preferredPosition : this._position;
|
|
464
|
+
}
|
|
465
|
+
set contentAt(position) {
|
|
466
|
+
if (typeof position === 'string') {
|
|
467
|
+
if (!position || Object.values(ClrPopoverPosition).indexOf(position) === -1) {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
// set the popover values based on menu position
|
|
471
|
+
this._position = position;
|
|
472
|
+
this.popoverService.positionChange(this._position);
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
this.preferredPositionIsSet = true;
|
|
476
|
+
this._preferredPosition = position;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
set availablePositions(positions) {
|
|
480
|
+
this.availablePositionsAreSet = true;
|
|
481
|
+
this._availablePositions = positions;
|
|
482
|
+
}
|
|
483
|
+
set contentType(type) {
|
|
484
|
+
this.popoverType = type;
|
|
485
|
+
if (!this.availablePositionsAreSet) {
|
|
486
|
+
this._availablePositions = getConnectedPositions(type);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
get outsideClickClose() {
|
|
490
|
+
return this._outsideClickClose;
|
|
491
|
+
}
|
|
492
|
+
set outsideClickClose(clickToClose) {
|
|
493
|
+
this._outsideClickClose = !!clickToClose;
|
|
494
|
+
}
|
|
495
|
+
get scrollToClose() {
|
|
496
|
+
return this._scrollToClose;
|
|
497
|
+
}
|
|
498
|
+
set scrollToClose(scrollToClose) {
|
|
499
|
+
this._scrollToClose = !!scrollToClose;
|
|
500
|
+
}
|
|
501
|
+
set contentOrigin(origin) {
|
|
502
|
+
if (origin instanceof Element) {
|
|
503
|
+
this.popoverService.origin = new ElementRef(origin);
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
this.popoverService.origin = origin;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
get positionStrategy() {
|
|
510
|
+
return this.overlay
|
|
511
|
+
.position()
|
|
512
|
+
.flexibleConnectedTo(this.popoverService.origin)
|
|
513
|
+
.setOrigin(this.popoverService.origin)
|
|
514
|
+
.withPush(true)
|
|
515
|
+
.withPositions([this.preferredPosition, ...this._availablePositions])
|
|
516
|
+
.withFlexibleDimensions(true);
|
|
517
|
+
}
|
|
518
|
+
get preferredPosition() {
|
|
519
|
+
if (this.preferredPositionIsSet) {
|
|
520
|
+
return this._preferredPosition;
|
|
521
|
+
}
|
|
522
|
+
// Default position is "bottom-left"
|
|
523
|
+
return mapPopoverKeyToPosition(this._position, this.popoverType);
|
|
524
|
+
}
|
|
525
|
+
ngAfterViewInit() {
|
|
526
|
+
if (this.popoverService.open) {
|
|
527
|
+
this.showOverlay();
|
|
528
|
+
}
|
|
529
|
+
this.openCloseSubscription = this.popoverService.openChange.subscribe(change => {
|
|
530
|
+
if (change) {
|
|
531
|
+
this.showOverlay();
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
this.closePopover();
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
ngOnDestroy() {
|
|
539
|
+
this.removeOverlay();
|
|
540
|
+
this.openCloseSubscription?.unsubscribe();
|
|
541
|
+
}
|
|
542
|
+
_createOverlayRef() {
|
|
543
|
+
this.overlayRef = this.overlay.create(new OverlayConfig({
|
|
544
|
+
// This is where we can pass externally facing inputs into the angular overlay API, and essentially proxy behaviors our users want directly to the CDK if they have them.
|
|
545
|
+
positionStrategy: this.positionStrategy,
|
|
546
|
+
// the scrolling behaviour is controlled by this popover content directive
|
|
547
|
+
scrollStrategy: this.overlay.scrollStrategies.noop(),
|
|
548
|
+
panelClass: this.popoverService.panelClass,
|
|
549
|
+
hasBackdrop: false,
|
|
550
|
+
}));
|
|
551
|
+
this.subscriptions.push(merge(this.popoverService.resetPositionsChange, this.popoverService.getPositionChange()).subscribe(() => {
|
|
552
|
+
this.resetPosition();
|
|
553
|
+
}), this.popoverService.updatePositionChange().subscribe(() => {
|
|
554
|
+
this.overlayRef?.updatePosition();
|
|
555
|
+
}), this.overlayRef.keydownEvents().subscribe(event => {
|
|
556
|
+
if (event && event.key && event.key === Keys.Escape && !hasModifierKey(event)) {
|
|
557
|
+
event.preventDefault();
|
|
558
|
+
this.closePopover();
|
|
559
|
+
}
|
|
560
|
+
}), this.popoverService.originPoint
|
|
561
|
+
? this.createPointBasedOutsideClickSubscription()
|
|
562
|
+
: this.createElementBasedOutsideClickSubscription());
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Point-based origins (context menus) delay the subscription to avoid the
|
|
566
|
+
* mouseup from the same right-click that opened the popover.
|
|
567
|
+
*/
|
|
568
|
+
createPointBasedOutsideClickSubscription() {
|
|
569
|
+
return timer(500)
|
|
570
|
+
.pipe(switchMap(() => this.overlayRef.outsidePointerEvents()))
|
|
571
|
+
.subscribe(event => {
|
|
572
|
+
if (this.elementRef?.nativeElement?.contains(event.target)) {
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
if (this._outsideClickClose) {
|
|
576
|
+
this.closePopover();
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Element-based origins close on outside clicks and suppress toggle-button
|
|
582
|
+
* re-clicks so the popover doesn't immediately reopen.
|
|
583
|
+
*/
|
|
584
|
+
createElementBasedOutsideClickSubscription() {
|
|
585
|
+
return this.overlayRef.outsidePointerEvents().subscribe(event => {
|
|
586
|
+
// web components (cds-icon) register as outside pointer events, so if the event target is inside the content panel return early
|
|
587
|
+
if (this.elementRef?.nativeElement?.contains(event.target)) {
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
// Check if the same element that opened the popover is the same element triggering the outside pointer events (toggle button)
|
|
591
|
+
const isToggleButton = this.popoverService.openEvent &&
|
|
592
|
+
(this.popoverService.openEvent.target.contains(event.target) ||
|
|
593
|
+
this.popoverService.openEvent.target.parentElement.contains(event.target) ||
|
|
594
|
+
this.popoverService.openEvent.target === event.target);
|
|
595
|
+
if (isToggleButton) {
|
|
596
|
+
event.stopPropagation();
|
|
597
|
+
}
|
|
598
|
+
if (this._outsideClickClose || isToggleButton) {
|
|
599
|
+
this.closePopover();
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
resetPosition() {
|
|
604
|
+
if (this.overlayRef) {
|
|
605
|
+
this.overlayRef.updatePositionStrategy(this.positionStrategy);
|
|
606
|
+
this.overlayRef.updatePosition();
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
closePopover() {
|
|
610
|
+
if (!this.overlayRef) {
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
this.removeOverlay();
|
|
614
|
+
this.popoverService.open = false;
|
|
615
|
+
if (this.popoverService.originElement) {
|
|
616
|
+
const shouldFocusTrigger = this.popoverType !== ClrPopoverType.TOOLTIP &&
|
|
617
|
+
(document.activeElement === document.body ||
|
|
618
|
+
document.activeElement === this.popoverService.originElement.nativeElement);
|
|
619
|
+
if (shouldFocusTrigger) {
|
|
620
|
+
this.popoverService.focusOrigin();
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
showOverlay() {
|
|
625
|
+
if (!this.overlayRef) {
|
|
626
|
+
this._createOverlayRef();
|
|
627
|
+
}
|
|
628
|
+
if (!this.view && this.template) {
|
|
629
|
+
this.view = this.container.createEmbeddedView(this.template);
|
|
630
|
+
if (!this.elementRef) {
|
|
631
|
+
const [rootNode] = this.view.rootNodes;
|
|
632
|
+
this.elementRef = new ElementRef(rootNode); // So we know where/what to set close focus on
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
if (!this.domPortal) {
|
|
636
|
+
this.domPortal = new DomPortal(this.elementRef);
|
|
637
|
+
this.overlayRef.attach(this.domPortal);
|
|
638
|
+
}
|
|
639
|
+
if (this.popoverService.originElement) {
|
|
640
|
+
this.popoverService.originElement.nativeElement.scrollIntoView({
|
|
641
|
+
behavior: 'instant',
|
|
642
|
+
block: 'nearest',
|
|
643
|
+
inline: 'nearest',
|
|
644
|
+
});
|
|
645
|
+
this.setupIntersectionObserver();
|
|
646
|
+
}
|
|
647
|
+
setTimeout(() => {
|
|
648
|
+
// Get Scrollable Parents
|
|
649
|
+
this.listenToScrollEvents();
|
|
650
|
+
this.popoverService.popoverVisibleEmit(true);
|
|
651
|
+
if (this.elementRef?.nativeElement?.focus) {
|
|
652
|
+
this.elementRef.nativeElement.focus();
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
removeOverlay() {
|
|
657
|
+
this.subscriptions.forEach(s => s.unsubscribe());
|
|
658
|
+
this.subscriptions = [];
|
|
659
|
+
if (this.overlayRef?.hasAttached()) {
|
|
660
|
+
this.overlayRef.detach();
|
|
661
|
+
this.overlayRef.dispose();
|
|
662
|
+
}
|
|
663
|
+
if (this.domPortal?.isAttached) {
|
|
664
|
+
this.domPortal.detach();
|
|
665
|
+
}
|
|
666
|
+
if (this.view) {
|
|
667
|
+
this.view.destroy();
|
|
668
|
+
}
|
|
669
|
+
this.overlayRef = null;
|
|
670
|
+
this.domPortal = null;
|
|
671
|
+
if (this.template) {
|
|
672
|
+
this.elementRef = null;
|
|
673
|
+
}
|
|
674
|
+
this.view = null;
|
|
675
|
+
this.intersectionObserver?.disconnect();
|
|
676
|
+
this.intersectionObserver = null;
|
|
677
|
+
this.popoverService.popoverVisibleEmit(false);
|
|
678
|
+
}
|
|
679
|
+
getScrollableParents(node) {
|
|
680
|
+
let parent = node;
|
|
681
|
+
const overflowScrollKeys = ['auto', 'scroll', 'clip'];
|
|
682
|
+
const scrollableParents = [window.document];
|
|
683
|
+
while (parent && !(parent instanceof HTMLHtmlElement)) {
|
|
684
|
+
if (parent instanceof ShadowRoot) {
|
|
685
|
+
parent = parent.host;
|
|
686
|
+
}
|
|
687
|
+
const { overflowY, overflowX } = window.getComputedStyle(parent);
|
|
688
|
+
if (overflowScrollKeys.includes(overflowY) || overflowScrollKeys.includes(overflowX)) {
|
|
689
|
+
scrollableParents.push(parent);
|
|
690
|
+
}
|
|
691
|
+
parent = parent.parentNode;
|
|
692
|
+
}
|
|
693
|
+
return scrollableParents;
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Uses IntersectionObserver to detect when the origin element leaves the screen.
|
|
697
|
+
* This handles the "Close on Scroll" logic much cheaper than getBoundingClientRect.
|
|
698
|
+
*/
|
|
699
|
+
setupIntersectionObserver() {
|
|
700
|
+
if (!this.popoverService.originElement || this.intersectionObserver) {
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
this.intersectionObserver = new IntersectionObserver(entries => {
|
|
704
|
+
entries.forEach(entry => {
|
|
705
|
+
// If the origin is no longer visible (scrolled out of view)
|
|
706
|
+
if (!entry.isIntersecting && this.popoverService.open) {
|
|
707
|
+
this.zone.run(() => this.closePopover());
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
}, { root: null, threshold: 0.8 });
|
|
711
|
+
this.intersectionObserver.observe(this.popoverService.originElement.nativeElement);
|
|
712
|
+
}
|
|
713
|
+
listenToScrollEvents() {
|
|
714
|
+
if (!isPlatformBrowser(this.platformId)) {
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
const originEl = this.popoverService.originPoint
|
|
718
|
+
? this.popoverService.pointTargetElement
|
|
719
|
+
: this.getRootPopover(this)?.popoverService?.originElement?.nativeElement;
|
|
720
|
+
this.listenToScrollForElementOrigin(originEl);
|
|
721
|
+
}
|
|
722
|
+
// Element origins track ancestor scroll containers to reposition or close.
|
|
723
|
+
listenToScrollForElementOrigin(originEl) {
|
|
724
|
+
const scrollableParents = this.getScrollableParents(originEl);
|
|
725
|
+
this.zone.runOutsideAngular(() => {
|
|
726
|
+
this.subscriptions.push(merge(...scrollableParents.map(parent => fromEvent(parent, 'scroll', { passive: true }))).subscribe(() => {
|
|
727
|
+
if (this._scrollToClose) {
|
|
728
|
+
this.zone.run(() => this.closePopover());
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
this.overlayRef?.updatePosition();
|
|
732
|
+
}));
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
getRootPopover(popover) {
|
|
736
|
+
if (popover && popover.parent) {
|
|
737
|
+
return this.getRootPopover(popover.parent);
|
|
738
|
+
}
|
|
739
|
+
return popover;
|
|
740
|
+
}
|
|
741
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrPopoverContent, deps: [{ token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: i0.TemplateRef, optional: true }, { token: i1.OverlayContainer }, { token: ClrPopoverContent, optional: true, skipSelf: true }, { token: i1.Overlay }, { token: ClrPopoverService }, { token: i0.NgZone }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
742
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: ClrPopoverContent, isStandalone: true, selector: "[clrPopoverContent]", inputs: { open: ["clrPopoverContent", "open"], contentAt: ["clrPopoverContentAt", "contentAt"], availablePositions: ["clrPopoverContentAvailablePositions", "availablePositions"], contentType: ["clrPopoverContentType", "contentType"], outsideClickClose: ["clrPopoverContentOutsideClickToClose", "outsideClickClose"], scrollToClose: ["clrPopoverContentScrollToClose", "scrollToClose"], contentOrigin: ["clrPopoverContentOrigin", "contentOrigin"] }, ngImport: i0 }); }
|
|
743
|
+
}
|
|
744
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrPopoverContent, decorators: [{
|
|
745
|
+
type: Directive,
|
|
746
|
+
args: [{
|
|
747
|
+
selector: '[clrPopoverContent]',
|
|
748
|
+
}]
|
|
749
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: i0.TemplateRef, decorators: [{
|
|
750
|
+
type: Optional
|
|
751
|
+
}] }, { type: i1.OverlayContainer }, { type: ClrPopoverContent, decorators: [{
|
|
752
|
+
type: Optional
|
|
753
|
+
}, {
|
|
754
|
+
type: SkipSelf
|
|
755
|
+
}] }, { type: i1.Overlay }, { type: ClrPopoverService, decorators: [{
|
|
756
|
+
type: Inject,
|
|
757
|
+
args: [ClrPopoverService]
|
|
758
|
+
}] }, { type: i0.NgZone }, { type: undefined, decorators: [{
|
|
759
|
+
type: Inject,
|
|
760
|
+
args: [PLATFORM_ID]
|
|
761
|
+
}] }], propDecorators: { open: [{
|
|
762
|
+
type: Input,
|
|
763
|
+
args: ['clrPopoverContent']
|
|
764
|
+
}], contentAt: [{
|
|
765
|
+
type: Input,
|
|
766
|
+
args: ['clrPopoverContentAt']
|
|
767
|
+
}], availablePositions: [{
|
|
768
|
+
type: Input,
|
|
769
|
+
args: ['clrPopoverContentAvailablePositions']
|
|
770
|
+
}], contentType: [{
|
|
771
|
+
type: Input,
|
|
772
|
+
args: ['clrPopoverContentType']
|
|
773
|
+
}], outsideClickClose: [{
|
|
774
|
+
type: Input,
|
|
775
|
+
args: ['clrPopoverContentOutsideClickToClose']
|
|
776
|
+
}], scrollToClose: [{
|
|
777
|
+
type: Input,
|
|
778
|
+
args: ['clrPopoverContentScrollToClose']
|
|
779
|
+
}], contentOrigin: [{
|
|
780
|
+
type: Input,
|
|
781
|
+
args: ['clrPopoverContentOrigin']
|
|
782
|
+
}] } });
|
|
783
|
+
|
|
784
|
+
/*
|
|
785
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
786
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
787
|
+
* This software is released under MIT license.
|
|
788
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
789
|
+
*/
|
|
790
|
+
class ClrPopoverOrigin {
|
|
791
|
+
constructor(popoverService, element) {
|
|
792
|
+
popoverService.origin = element;
|
|
793
|
+
}
|
|
794
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrPopoverOrigin, deps: [{ token: ClrPopoverService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
795
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: ClrPopoverOrigin, isStandalone: false, selector: "[clrPopoverOrigin]", host: { properties: { "class.clr-popover-origin": "true" } }, ngImport: i0 }); }
|
|
796
|
+
}
|
|
797
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrPopoverOrigin, decorators: [{
|
|
798
|
+
type: Directive,
|
|
799
|
+
args: [{
|
|
800
|
+
selector: '[clrPopoverOrigin]',
|
|
801
|
+
host: {
|
|
802
|
+
'[class.clr-popover-origin]': 'true',
|
|
803
|
+
},
|
|
804
|
+
standalone: false,
|
|
805
|
+
}]
|
|
806
|
+
}], ctorParameters: () => [{ type: ClrPopoverService }, { type: i0.ElementRef }] });
|
|
807
|
+
|
|
808
|
+
/*
|
|
809
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
810
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
811
|
+
* This software is released under MIT license.
|
|
812
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
813
|
+
*/
|
|
814
|
+
const POPOVER_HOST_ORIGIN = new InjectionToken('POPOVER_HOST_ORIGIN');
|
|
815
|
+
|
|
816
|
+
/*
|
|
817
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
818
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
819
|
+
* This software is released under MIT license.
|
|
820
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
821
|
+
*/
|
|
822
|
+
class ClrStopEscapePropagationDirective {
|
|
823
|
+
constructor(popoverService) {
|
|
824
|
+
this.popoverService = popoverService;
|
|
825
|
+
this.lastOpenChange = null;
|
|
826
|
+
}
|
|
827
|
+
ngOnInit() {
|
|
828
|
+
this.subscription = this.popoverService.openChange.subscribe(open => {
|
|
829
|
+
this.lastOpenChange = open;
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
ngOnDestroy() {
|
|
833
|
+
this.subscription?.unsubscribe();
|
|
834
|
+
}
|
|
835
|
+
onEscapeKey(event) {
|
|
836
|
+
if (this.lastOpenChange !== null) {
|
|
837
|
+
if (this.lastOpenChange === false) {
|
|
838
|
+
event.stopPropagation();
|
|
839
|
+
}
|
|
840
|
+
this.lastOpenChange = null;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrStopEscapePropagationDirective, deps: [{ token: ClrPopoverService }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
844
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: ClrStopEscapePropagationDirective, isStandalone: true, host: { listeners: { "keyup.escape": "onEscapeKey($event)" } }, ngImport: i0 }); }
|
|
845
|
+
}
|
|
846
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrStopEscapePropagationDirective, decorators: [{
|
|
847
|
+
type: Directive,
|
|
848
|
+
args: [{
|
|
849
|
+
standalone: true,
|
|
850
|
+
}]
|
|
851
|
+
}], ctorParameters: () => [{ type: ClrPopoverService }], propDecorators: { onEscapeKey: [{
|
|
852
|
+
type: HostListener,
|
|
853
|
+
args: ['keyup.escape', ['$event']]
|
|
854
|
+
}] } });
|
|
855
|
+
|
|
856
|
+
/*
|
|
857
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
858
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
859
|
+
* This software is released under MIT license.
|
|
860
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
861
|
+
*/
|
|
862
|
+
class ClrPopoverHostDirective {
|
|
863
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrPopoverHostDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
864
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: ClrPopoverHostDirective, isStandalone: true, providers: [ClrPopoverService, { provide: POPOVER_HOST_ORIGIN, useExisting: ElementRef }], hostDirectives: [{ directive: ClrStopEscapePropagationDirective }], ngImport: i0 }); }
|
|
865
|
+
}
|
|
866
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrPopoverHostDirective, decorators: [{
|
|
867
|
+
type: Directive,
|
|
868
|
+
args: [{
|
|
869
|
+
standalone: true,
|
|
870
|
+
providers: [ClrPopoverService, { provide: POPOVER_HOST_ORIGIN, useExisting: ElementRef }],
|
|
871
|
+
hostDirectives: [ClrStopEscapePropagationDirective],
|
|
872
|
+
}]
|
|
873
|
+
}] });
|
|
874
|
+
|
|
875
|
+
/*
|
|
876
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
877
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
878
|
+
* This software is released under MIT license.
|
|
879
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
880
|
+
*/
|
|
881
|
+
/**********
|
|
882
|
+
*
|
|
883
|
+
* @class ClrIfOpen
|
|
884
|
+
*
|
|
885
|
+
* @description
|
|
886
|
+
* A structural directive that controls whether or not the associated TemplateRef is instantiated or not.
|
|
887
|
+
* It makes use of a Component instance level service: ClrPopoverService to maintain state between itself and the component
|
|
888
|
+
* using it in the component template.
|
|
889
|
+
*
|
|
890
|
+
*/
|
|
891
|
+
class ClrIfOpen {
|
|
892
|
+
constructor(popoverService, template, container) {
|
|
893
|
+
this.popoverService = popoverService;
|
|
894
|
+
this.template = template;
|
|
895
|
+
this.container = container;
|
|
896
|
+
/**********
|
|
897
|
+
* @property openChange
|
|
898
|
+
*
|
|
899
|
+
* @description
|
|
900
|
+
* An event emitter that emits when the open property is set to allow for 2way binding when the directive is
|
|
901
|
+
* used with de-structured / de-sugared syntax.
|
|
902
|
+
*/
|
|
903
|
+
this.openChange = new EventEmitter(false);
|
|
904
|
+
this.subscriptions = [];
|
|
905
|
+
this.subscriptions.push(popoverService.openChange.subscribe(change => {
|
|
906
|
+
// OPEN before overlay is built
|
|
907
|
+
if (change) {
|
|
908
|
+
container.createEmbeddedView(template);
|
|
909
|
+
this.openChange.emit(change);
|
|
910
|
+
}
|
|
911
|
+
}), popoverService.popoverVisible.subscribe(change => {
|
|
912
|
+
// CLOSE after overlay is destroyed
|
|
913
|
+
if (!change) {
|
|
914
|
+
container.clear();
|
|
915
|
+
this.openChange.emit(change);
|
|
916
|
+
}
|
|
917
|
+
}));
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* @description
|
|
921
|
+
* A property that gets/sets ClrPopoverService.open with value.
|
|
922
|
+
*/
|
|
923
|
+
get open() {
|
|
924
|
+
return this.popoverService.open;
|
|
925
|
+
}
|
|
926
|
+
set open(value) {
|
|
927
|
+
this.popoverService.open = value;
|
|
928
|
+
}
|
|
929
|
+
ngOnDestroy() {
|
|
930
|
+
this.subscriptions.forEach(sub => sub.unsubscribe());
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* @description
|
|
934
|
+
* Function that takes a boolean value and either created an embedded view for the associated ViewContainerRef or,
|
|
935
|
+
* Clears all views from the ViewContainerRef
|
|
936
|
+
*
|
|
937
|
+
* @param value
|
|
938
|
+
*/
|
|
939
|
+
updateView(value) {
|
|
940
|
+
if (value) {
|
|
941
|
+
this.container.createEmbeddedView(this.template);
|
|
942
|
+
}
|
|
943
|
+
else {
|
|
944
|
+
this.container.clear();
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrIfOpen, deps: [{ token: ClrPopoverService }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
948
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: ClrIfOpen, isStandalone: true, selector: "[clrIfOpen]", inputs: { open: ["clrIfOpen", "open"] }, outputs: { openChange: "clrIfOpenChange" }, ngImport: i0 }); }
|
|
949
|
+
}
|
|
950
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrIfOpen, decorators: [{
|
|
951
|
+
type: Directive,
|
|
952
|
+
args: [{
|
|
953
|
+
selector: '[clrIfOpen]',
|
|
954
|
+
}]
|
|
955
|
+
}], ctorParameters: () => [{ type: ClrPopoverService }, { type: i0.TemplateRef }, { type: i0.ViewContainerRef }], propDecorators: { openChange: [{
|
|
956
|
+
type: Output,
|
|
957
|
+
args: ['clrIfOpenChange']
|
|
958
|
+
}], open: [{
|
|
959
|
+
type: Input,
|
|
960
|
+
args: ['clrIfOpen']
|
|
961
|
+
}] } });
|
|
962
|
+
|
|
963
|
+
/*
|
|
964
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
965
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
966
|
+
* This software is released under MIT license.
|
|
967
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
968
|
+
*/
|
|
969
|
+
class ClrPopoverCloseButton {
|
|
970
|
+
constructor(elementRef, popoverService) {
|
|
971
|
+
this.elementRef = elementRef;
|
|
972
|
+
this.popoverService = popoverService;
|
|
973
|
+
this.closeChange = new EventEmitter();
|
|
974
|
+
this.subscriptions = [];
|
|
975
|
+
this.subscriptions.push(popoverService.openChange.pipe(filter(value => !value)).subscribe(() => {
|
|
976
|
+
this.closeChange.emit();
|
|
977
|
+
}));
|
|
978
|
+
}
|
|
979
|
+
handleClick(event) {
|
|
980
|
+
this.popoverService.toggleWithEvent(event);
|
|
981
|
+
this.popoverService.focusOrigin();
|
|
982
|
+
}
|
|
983
|
+
ngAfterViewInit() {
|
|
984
|
+
this.popoverService.closeButtonRef = this.elementRef;
|
|
985
|
+
}
|
|
986
|
+
ngOnDestroy() {
|
|
987
|
+
this.subscriptions.forEach(sub => sub.unsubscribe());
|
|
988
|
+
}
|
|
989
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrPopoverCloseButton, deps: [{ token: i0.ElementRef }, { token: ClrPopoverService }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
990
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: ClrPopoverCloseButton, isStandalone: false, selector: "[clrPopoverCloseButton]", outputs: { closeChange: "clrPopoverOnCloseChange" }, host: { listeners: { "click": "handleClick($event)" }, properties: { "class.clr-smart-close-button": "true" } }, ngImport: i0 }); }
|
|
991
|
+
}
|
|
992
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrPopoverCloseButton, decorators: [{
|
|
993
|
+
type: Directive,
|
|
994
|
+
args: [{
|
|
995
|
+
selector: '[clrPopoverCloseButton]',
|
|
996
|
+
host: {
|
|
997
|
+
'[class.clr-smart-close-button]': 'true',
|
|
998
|
+
},
|
|
999
|
+
standalone: false,
|
|
1000
|
+
}]
|
|
1001
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: ClrPopoverService }], propDecorators: { closeChange: [{
|
|
1002
|
+
type: Output,
|
|
1003
|
+
args: ['clrPopoverOnCloseChange']
|
|
1004
|
+
}], handleClick: [{
|
|
1005
|
+
type: HostListener,
|
|
1006
|
+
args: ['click', ['$event']]
|
|
1007
|
+
}] } });
|
|
1008
|
+
|
|
1009
|
+
/*
|
|
1010
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1011
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1012
|
+
* This software is released under MIT license.
|
|
1013
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1014
|
+
*/
|
|
1015
|
+
class ClrPopoverOpenCloseButton {
|
|
1016
|
+
constructor(popoverService) {
|
|
1017
|
+
this.popoverService = popoverService;
|
|
1018
|
+
this.openCloseChange = new EventEmitter();
|
|
1019
|
+
this.subscriptions = [];
|
|
1020
|
+
this.subscriptions.push(popoverService.openChange.subscribe(change => {
|
|
1021
|
+
this.openCloseChange.emit(change);
|
|
1022
|
+
}));
|
|
1023
|
+
}
|
|
1024
|
+
handleClick(event) {
|
|
1025
|
+
this.popoverService.toggleWithEvent(event);
|
|
1026
|
+
}
|
|
1027
|
+
ngOnDestroy() {
|
|
1028
|
+
this.subscriptions.forEach(sub => sub.unsubscribe());
|
|
1029
|
+
}
|
|
1030
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrPopoverOpenCloseButton, deps: [{ token: ClrPopoverService }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1031
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: ClrPopoverOpenCloseButton, isStandalone: false, selector: "[clrPopoverOpenCloseButton]", outputs: { openCloseChange: "clrPopoverOpenCloseChange" }, host: { listeners: { "click": "handleClick($event)" }, properties: { "class.clr-smart-open-close": "true" } }, ngImport: i0 }); }
|
|
1032
|
+
}
|
|
1033
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrPopoverOpenCloseButton, decorators: [{
|
|
1034
|
+
type: Directive,
|
|
1035
|
+
args: [{
|
|
1036
|
+
selector: '[clrPopoverOpenCloseButton]',
|
|
1037
|
+
host: {
|
|
1038
|
+
'[class.clr-smart-open-close]': 'true',
|
|
1039
|
+
},
|
|
1040
|
+
standalone: false,
|
|
1041
|
+
}]
|
|
1042
|
+
}], ctorParameters: () => [{ type: ClrPopoverService }], propDecorators: { openCloseChange: [{
|
|
1043
|
+
type: Output,
|
|
1044
|
+
args: ['clrPopoverOpenCloseChange']
|
|
1045
|
+
}], handleClick: [{
|
|
1046
|
+
type: HostListener,
|
|
1047
|
+
args: ['click', ['$event']]
|
|
1048
|
+
}] } });
|
|
1049
|
+
|
|
1050
|
+
/*
|
|
1051
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1052
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1053
|
+
* This software is released under MIT license.
|
|
1054
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1055
|
+
*/
|
|
1056
|
+
class ClrPopoverModuleNext {
|
|
1057
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrPopoverModuleNext, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1058
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.3", ngImport: i0, type: ClrPopoverModuleNext, declarations: [ClrPopoverOrigin, ClrPopoverCloseButton, ClrPopoverOpenCloseButton], imports: [ClrPopoverContent, ClrIfOpen], exports: [ClrPopoverOrigin, ClrPopoverCloseButton, ClrPopoverOpenCloseButton, ClrPopoverContent, ClrIfOpen] }); }
|
|
1059
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrPopoverModuleNext }); }
|
|
1060
|
+
}
|
|
1061
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ClrPopoverModuleNext, decorators: [{
|
|
1062
|
+
type: NgModule,
|
|
1063
|
+
args: [{
|
|
1064
|
+
imports: [ClrPopoverContent, ClrIfOpen],
|
|
1065
|
+
declarations: [ClrPopoverOrigin, ClrPopoverCloseButton, ClrPopoverOpenCloseButton],
|
|
1066
|
+
exports: [ClrPopoverOrigin, ClrPopoverCloseButton, ClrPopoverOpenCloseButton, ClrPopoverContent, ClrIfOpen],
|
|
1067
|
+
}]
|
|
1068
|
+
}] });
|
|
1069
|
+
|
|
1070
|
+
/*
|
|
1071
|
+
* Copyright (c) 2016-2026 Broadcom. All Rights Reserved.
|
|
1072
|
+
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
|
|
1073
|
+
* This software is released under MIT license.
|
|
1074
|
+
* The full license information can be found in LICENSE in the root directory of this project.
|
|
1075
|
+
*/
|
|
1076
|
+
|
|
1077
|
+
/**
|
|
1078
|
+
* Generated bundle index. Do not edit.
|
|
1079
|
+
*/
|
|
1080
|
+
|
|
1081
|
+
export { ClrIfOpen, ClrPopoverCloseButton, ClrPopoverContent, ClrPopoverHostDirective, ClrPopoverModuleNext, ClrPopoverOpenCloseButton, ClrPopoverOrigin, ClrPopoverPosition, ClrPopoverService, ClrPopoverType, ClrStopEscapePropagationDirective, DROPDOWN_POSITIONS, POPOVER_HOST_ORIGIN, SIGNPOST_POSITIONS, TOOLTIP_POSITIONS, getConnectedPositions, getContentPosition, getOriginPosition, getPositionsArray, mapPopoverKeyToPosition };
|
|
1082
|
+
//# sourceMappingURL=clr-angular-popover-common.mjs.map
|