@cngx/common 0.1.0-rc.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/README.md +15 -2
- package/button/README.md +258 -0
- package/command/README.md +19 -8
- package/data/README.md +10 -10
- package/fesm2022/cngx-common-a11y.mjs +701 -263
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +83 -64
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-button.mjs +1084 -0
- package/fesm2022/cngx-common-button.mjs.map +1 -0
- package/fesm2022/cngx-common-card.mjs +135 -76
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +749 -296
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +51 -29
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +695 -405
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +112 -112
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +668 -308
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +7066 -2739
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +2121 -492
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-menu-button.mjs +557 -0
- package/fesm2022/cngx-common-menu-button.mjs.map +1 -0
- package/fesm2022/cngx-common-popover.mjs +1207 -569
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +256 -261
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +202 -262
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +28 -61
- package/fesm2022/cngx-common-timeline.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +10 -10
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/interactive/README.md +30 -19
- package/layout/README.md +1 -1
- package/menu-button/README.md +234 -0
- package/package.json +14 -4
- package/popover/README.md +42 -5
- package/popover/tooltip-indicator.scss +52 -0
- package/schematics/ng-add/index.js +7 -7
- package/schematics/ng-add/schema.json +5 -0
- package/stepper/README.md +0 -1
- package/theming/components/cngx-accordion.css +36 -7
- package/theming/components/cngx-async.css +185 -37
- package/theming/components/cngx-backdrop.css +3 -1
- package/theming/components/cngx-badge.css +20 -5
- package/theming/components/cngx-bottom-sheet.css +2 -0
- package/theming/components/cngx-breadcrumb.css +3 -1
- package/theming/components/cngx-button-group.css +325 -0
- package/theming/components/cngx-button-toggle.css +55 -23
- package/theming/components/cngx-button.css +975 -0
- package/theming/components/cngx-data-grid.css +2 -0
- package/theming/components/cngx-dialog.css +3 -1
- package/theming/components/cngx-divider.css +24 -9
- package/theming/components/cngx-drawer.css +153 -0
- package/theming/components/cngx-icon-glyph.css +76 -0
- package/theming/components/cngx-listbox.css +79 -25
- package/theming/components/cngx-menu.css +112 -52
- package/theming/components/cngx-nav.css +1220 -0
- package/theming/components/cngx-popover-sheet.css +43 -11
- package/theming/components/cngx-popover.css +37 -13
- package/theming/components/cngx-recycler-placeholder.css +2 -0
- package/theming/components/cngx-ripple.css +74 -16
- package/theming/components/cngx-sidebar.css +71 -0
- package/theming/components/cngx-slider.css +3 -1
- package/theming/components/cngx-tooltip.css +2 -0
- package/timeline/README.md +2 -2
- package/types/cngx-common-a11y.d.ts +343 -120
- package/types/cngx-common-audio.d.ts +60 -88
- package/types/cngx-common-button.d.ts +698 -0
- package/types/cngx-common-card.d.ts +104 -78
- package/types/cngx-common-chart.d.ts +671 -384
- package/types/cngx-common-command.d.ts +44 -47
- package/types/cngx-common-data.d.ts +350 -342
- package/types/cngx-common-dialog.d.ts +91 -120
- package/types/cngx-common-display.d.ts +475 -300
- package/types/cngx-common-interactive.d.ts +4350 -1723
- package/types/cngx-common-layout.d.ts +1365 -286
- package/types/cngx-common-menu-button.d.ts +382 -0
- package/types/cngx-common-popover.d.ts +671 -289
- package/types/cngx-common-stepper.d.ts +217 -347
- package/types/cngx-common-tabs.d.ts +173 -386
- package/types/cngx-common-timeline.d.ts +25 -104
|
@@ -2,19 +2,19 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { InjectionToken, inject, signal, computed, Injectable, ElementRef, DestroyRef, Directive, Renderer2, contentChild, input, effect, untracked, viewChild, ViewContainerRef, ChangeDetectionStrategy, Component, ApplicationRef, EnvironmentInjector, Injector, createComponent } from '@angular/core';
|
|
3
3
|
import { DOCUMENT } from '@angular/common';
|
|
4
4
|
import { createOverrideMerge, nextUid, coerceSignal, buildAsyncStateView, hasTransition, onTransitionDone } from '@cngx/core/utils';
|
|
5
|
+
import { createHotkeyScope, CNGX_HOTKEY_SCOPE, CngxSwipeDismiss } from '@cngx/common/interactive';
|
|
6
|
+
import { CNGX_FOCUSABLE_SELECTOR } from '@cngx/common/a11y';
|
|
5
7
|
import { createScrollLock } from '@cngx/common/layout';
|
|
6
8
|
import { cngxDevWarn } from '@cngx/utils';
|
|
7
9
|
import { isObservable, firstValueFrom, filter, take, map } from 'rxjs';
|
|
8
10
|
import { createLanguageSection } from '@cngx/core/i18n';
|
|
9
11
|
import { toObservable } from '@angular/core/rxjs-interop';
|
|
10
|
-
import { CngxSwipeDismiss } from '@cngx/common/interactive';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Injection token to access the nearest `DialogRef` from inside a dialog.
|
|
14
15
|
*
|
|
15
|
-
* @category common/dialog
|
|
16
16
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/dialog/dialog-ref.ts
|
|
17
|
-
* @since 0.
|
|
17
|
+
* @since 0.3.0
|
|
18
18
|
*/
|
|
19
19
|
const DIALOG_REF = new InjectionToken('CngxDialogRef');
|
|
20
20
|
|
|
@@ -22,8 +22,7 @@ const DIALOG_REF = new InjectionToken('CngxDialogRef');
|
|
|
22
22
|
* The English dialog section: the single source of the dialog family's
|
|
23
23
|
* English copy. The `CNGX_DIALOG_DEFAULTS` labels default to it.
|
|
24
24
|
*
|
|
25
|
-
* @
|
|
26
|
-
* @since 0.1.0
|
|
25
|
+
* @since 0.3.0
|
|
27
26
|
* @relatedTo CNGX_DIALOG_DEFAULTS
|
|
28
27
|
*/
|
|
29
28
|
const CNGX_DIALOG_LANGUAGE_EN = {
|
|
@@ -42,10 +41,9 @@ const dialogLabelsFromPack = createLanguageSection('dialog', CNGX_DIALOG_LANGUAG
|
|
|
42
41
|
* defaults, so a consumer who provides nothing keeps today's behaviour
|
|
43
42
|
* exactly.
|
|
44
43
|
*
|
|
45
|
-
* @category common/dialog/config
|
|
46
44
|
* @wcag AA
|
|
47
45
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/config/dialog-config.ts
|
|
48
|
-
* @since 0.
|
|
46
|
+
* @since 0.3.0
|
|
49
47
|
* @relatedTo CngxDialog, CngxDialogClose, CngxDialogDraggable
|
|
50
48
|
*/
|
|
51
49
|
const CNGX_DIALOG_DEFAULTS = new InjectionToken('CngxDialogDefaults', {
|
|
@@ -67,9 +65,8 @@ const CNGX_DIALOG_DEFAULTS = new InjectionToken('CngxDialogDefaults', {
|
|
|
67
65
|
* });
|
|
68
66
|
* ```
|
|
69
67
|
*
|
|
70
|
-
* @category common/dialog/config
|
|
71
68
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/config/dialog-config.ts
|
|
72
|
-
* @since 0.
|
|
69
|
+
* @since 0.3.0
|
|
73
70
|
*/
|
|
74
71
|
function withDialogLabels(overrides) {
|
|
75
72
|
return { labels: overrides };
|
|
@@ -78,9 +75,8 @@ function withDialogLabels(overrides) {
|
|
|
78
75
|
* Register app-wide dialog defaults composed from `with*` features, applied
|
|
79
76
|
* on top of the active language pack.
|
|
80
77
|
*
|
|
81
|
-
* @category common/dialog/config
|
|
82
78
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/config/dialog-config.ts
|
|
83
|
-
* @since 0.
|
|
79
|
+
* @since 0.3.0
|
|
84
80
|
*/
|
|
85
81
|
function provideDialogConfig(...features) {
|
|
86
82
|
return [
|
|
@@ -96,9 +92,8 @@ function provideDialogConfig(...features) {
|
|
|
96
92
|
* Sub-tree variant - use in `viewProviders` so the defaults only apply to
|
|
97
93
|
* dialogs opened from descendants of this component.
|
|
98
94
|
*
|
|
99
|
-
* @category common/dialog/config
|
|
100
95
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/config/dialog-config.ts
|
|
101
|
-
* @since 0.
|
|
96
|
+
* @since 0.3.0
|
|
102
97
|
*/
|
|
103
98
|
function provideDialogConfigAt(...features) {
|
|
104
99
|
return provideDialogConfig(...features);
|
|
@@ -107,9 +102,8 @@ function provideDialogConfigAt(...features) {
|
|
|
107
102
|
* Inject the currently-resolved dialog defaults. Safe in any injection
|
|
108
103
|
* context; falls back to the English bundle when nothing is provided.
|
|
109
104
|
*
|
|
110
|
-
* @category common/dialog/config
|
|
111
105
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/config/dialog-config.ts
|
|
112
|
-
* @since 0.
|
|
106
|
+
* @since 0.3.0
|
|
113
107
|
*/
|
|
114
108
|
function injectDialogConfig() {
|
|
115
109
|
return inject(CNGX_DIALOG_DEFAULTS);
|
|
@@ -120,6 +114,7 @@ function injectDialogConfig() {
|
|
|
120
114
|
*
|
|
121
115
|
* Provided by `CngxDialog` (`useExisting`) on the dialog element and by
|
|
122
116
|
* `CngxDialogOpener` on the programmatic content's child injector.
|
|
117
|
+
* @internal
|
|
123
118
|
*/
|
|
124
119
|
const CNGX_DIALOG_ARIA_REGISTRY = new InjectionToken('CngxDialogAriaRegistry');
|
|
125
120
|
|
|
@@ -131,20 +126,19 @@ const CNGX_DIALOG_ARIA_REGISTRY = new InjectionToken('CngxDialogAriaRegistry');
|
|
|
131
126
|
* its `::backdrop`. Each `CngxDialog` reads `isTopmost` from this service
|
|
132
127
|
* to control `--cngx-dialog-backdrop-opacity`.
|
|
133
128
|
*
|
|
134
|
-
* @category common/dialog
|
|
135
129
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/dialog/dialog-stack.ts
|
|
136
|
-
* @since 0.
|
|
130
|
+
* @since 0.3.0
|
|
137
131
|
* @relatedTo CngxDialog, CngxDialogOpener
|
|
138
|
-
* <example-url
|
|
139
|
-
* <example-url
|
|
140
|
-
* <example-url
|
|
141
|
-
* <example-url
|
|
142
|
-
* <example-url
|
|
143
|
-
* <example-url
|
|
144
|
-
* <example-url
|
|
145
|
-
* <example-url
|
|
146
|
-
* <example-url
|
|
147
|
-
* <example-url
|
|
132
|
+
* <example-url>/#/common/dialog/alert-dialog</example-url>
|
|
133
|
+
* <example-url>/#/common/dialog/bottom-sheet</example-url>
|
|
134
|
+
* <example-url>/#/common/dialog/cngxdialogopener-programmatic</example-url>
|
|
135
|
+
* <example-url>/#/common/dialog/draggable-dialog</example-url>
|
|
136
|
+
* <example-url>/#/common/dialog/fully-declarative</example-url>
|
|
137
|
+
* <example-url>/#/common/dialog/grid-snap-live-vs-release</example-url>
|
|
138
|
+
* <example-url>/#/common/dialog/nested-dialogs-cngxdialogstack</example-url>
|
|
139
|
+
* <example-url>/#/common/dialog/non-modal-panel</example-url>
|
|
140
|
+
* <example-url>/#/common/dialog/programmatic-control</example-url>
|
|
141
|
+
* <example-url>/#/common/dialog/template-directives</example-url>
|
|
148
142
|
*/
|
|
149
143
|
class CngxDialogStack {
|
|
150
144
|
stackState = signal([], ...(ngDevMode ? [{ debugName: "stackState" }] : /* istanbul ignore next */ []));
|
|
@@ -180,8 +174,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
180
174
|
* })
|
|
181
175
|
* export class NestedDialogHost { }
|
|
182
176
|
* ```
|
|
183
|
-
*
|
|
184
|
-
* @category common/dialog
|
|
185
177
|
*/
|
|
186
178
|
function provideDialogStack() {
|
|
187
179
|
return CngxDialogStack;
|
|
@@ -201,22 +193,20 @@ function provideDialogStack() {
|
|
|
201
193
|
* </dialog>
|
|
202
194
|
* ```
|
|
203
195
|
*
|
|
204
|
-
* @category common/dialog
|
|
205
|
-
* @docsKind primary
|
|
206
196
|
* @wcag AA
|
|
207
197
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/dialog/dialog-title.directive.ts
|
|
208
|
-
* @since 0.
|
|
198
|
+
* @since 0.3.0
|
|
209
199
|
* @relatedTo CngxDialog, CngxDialogDescription, CngxDialogClose
|
|
210
|
-
* <example-url
|
|
211
|
-
* <example-url
|
|
212
|
-
* <example-url
|
|
213
|
-
* <example-url
|
|
214
|
-
* <example-url
|
|
215
|
-
* <example-url
|
|
216
|
-
* <example-url
|
|
217
|
-
* <example-url
|
|
218
|
-
* <example-url
|
|
219
|
-
* <example-url
|
|
200
|
+
* <example-url>/#/common/dialog/alert-dialog</example-url>
|
|
201
|
+
* <example-url>/#/common/dialog/bottom-sheet</example-url>
|
|
202
|
+
* <example-url>/#/common/dialog/cngxdialogopener-programmatic</example-url>
|
|
203
|
+
* <example-url>/#/common/dialog/draggable-dialog</example-url>
|
|
204
|
+
* <example-url>/#/common/dialog/fully-declarative</example-url>
|
|
205
|
+
* <example-url>/#/common/dialog/grid-snap-live-vs-release</example-url>
|
|
206
|
+
* <example-url>/#/common/dialog/nested-dialogs-cngxdialogstack</example-url>
|
|
207
|
+
* <example-url>/#/common/dialog/non-modal-panel</example-url>
|
|
208
|
+
* <example-url>/#/common/dialog/programmatic-control</example-url>
|
|
209
|
+
* <example-url>/#/common/dialog/template-directives</example-url>
|
|
220
210
|
*/
|
|
221
211
|
class CngxDialogTitle {
|
|
222
212
|
elRef = inject(ElementRef);
|
|
@@ -280,22 +270,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
280
270
|
* </dialog>
|
|
281
271
|
* ```
|
|
282
272
|
*
|
|
283
|
-
* @category common/dialog
|
|
284
|
-
* @docsKind primary
|
|
285
273
|
* @wcag AA
|
|
286
274
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/dialog/dialog-description.directive.ts
|
|
287
|
-
* @since 0.
|
|
275
|
+
* @since 0.3.0
|
|
288
276
|
* @relatedTo CngxDialog, CngxDialogTitle, CngxDialogClose
|
|
289
|
-
* <example-url
|
|
290
|
-
* <example-url
|
|
291
|
-
* <example-url
|
|
292
|
-
* <example-url
|
|
293
|
-
* <example-url
|
|
294
|
-
* <example-url
|
|
295
|
-
* <example-url
|
|
296
|
-
* <example-url
|
|
297
|
-
* <example-url
|
|
298
|
-
* <example-url
|
|
277
|
+
* <example-url>/#/common/dialog/alert-dialog</example-url>
|
|
278
|
+
* <example-url>/#/common/dialog/bottom-sheet</example-url>
|
|
279
|
+
* <example-url>/#/common/dialog/cngxdialogopener-programmatic</example-url>
|
|
280
|
+
* <example-url>/#/common/dialog/draggable-dialog</example-url>
|
|
281
|
+
* <example-url>/#/common/dialog/fully-declarative</example-url>
|
|
282
|
+
* <example-url>/#/common/dialog/grid-snap-live-vs-release</example-url>
|
|
283
|
+
* <example-url>/#/common/dialog/nested-dialogs-cngxdialogstack</example-url>
|
|
284
|
+
* <example-url>/#/common/dialog/non-modal-panel</example-url>
|
|
285
|
+
* <example-url>/#/common/dialog/programmatic-control</example-url>
|
|
286
|
+
* <example-url>/#/common/dialog/template-directives</example-url>
|
|
299
287
|
*/
|
|
300
288
|
class CngxDialogDescription {
|
|
301
289
|
dialogRef = inject(DIALOG_REF, { optional: true });
|
|
@@ -345,6 +333,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
345
333
|
* targets and live regions must never be `display: none`.
|
|
346
334
|
*
|
|
347
335
|
* Internal helper - intentionally not exported from `public-api.ts`.
|
|
336
|
+
* @internal
|
|
348
337
|
*/
|
|
349
338
|
function applySrOnly(el) {
|
|
350
339
|
el.className = 'cngx-sr-only';
|
|
@@ -451,22 +440,21 @@ function warnNonModalA11y(id, titleText) {
|
|
|
451
440
|
* </dialog>
|
|
452
441
|
* ```
|
|
453
442
|
*
|
|
454
|
-
* @category common/dialog
|
|
455
|
-
* @docsKind primary
|
|
456
443
|
* @wcag AA
|
|
457
444
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/dialog/dialog.directive.ts
|
|
458
|
-
* @since 0.
|
|
445
|
+
* @since 0.3.0
|
|
459
446
|
* @relatedTo CngxBottomSheet, CngxDialogOpener, CngxDialogTitle, CngxDialogClose, CngxDialogDraggable
|
|
460
|
-
* <example-url
|
|
461
|
-
* <example-url
|
|
462
|
-
* <example-url
|
|
463
|
-
* <example-url
|
|
464
|
-
* <example-url
|
|
465
|
-
* <example-url
|
|
466
|
-
* <example-url
|
|
467
|
-
* <example-url
|
|
468
|
-
* <example-url
|
|
469
|
-
* <example-url
|
|
447
|
+
* <example-url>/#/common/dialog/alert-dialog</example-url>
|
|
448
|
+
* <example-url>/#/common/dialog/bottom-sheet</example-url>
|
|
449
|
+
* <example-url>/#/common/dialog/cngxdialogopener-programmatic</example-url>
|
|
450
|
+
* <example-url>/#/common/dialog/draggable-dialog</example-url>
|
|
451
|
+
* <example-url>/#/common/dialog/fully-declarative</example-url>
|
|
452
|
+
* <example-url>/#/common/dialog/grid-snap-live-vs-release</example-url>
|
|
453
|
+
* <example-url>/#/common/dialog/nested-dialogs-cngxdialogstack</example-url>
|
|
454
|
+
* <example-url>/#/common/dialog/non-modal-panel</example-url>
|
|
455
|
+
* <example-url>/#/common/dialog/programmatic-control</example-url>
|
|
456
|
+
* <example-url>/#/common/dialog/template-directives</example-url>
|
|
457
|
+
* @axis level organism
|
|
470
458
|
*/
|
|
471
459
|
class CngxDialog {
|
|
472
460
|
elRef = inject(ElementRef);
|
|
@@ -520,7 +508,7 @@ class CngxDialog {
|
|
|
520
508
|
* Only applies to modal dialogs.
|
|
521
509
|
*
|
|
522
510
|
* - `'first-focusable'` -- focus the first `[autofocus]` element, or the
|
|
523
|
-
* first
|
|
511
|
+
* first element in DOM order matching `CNGX_FOCUSABLE_SELECTOR` (default)
|
|
524
512
|
* - `'none'` -- do not move focus
|
|
525
513
|
* - Any CSS selector string -- focus the first element matching the selector
|
|
526
514
|
*
|
|
@@ -665,6 +653,18 @@ class CngxDialog {
|
|
|
665
653
|
* nor strand a rendered backdrop without its dismissal surface.
|
|
666
654
|
*/
|
|
667
655
|
openedAsModal = signal(false, ...(ngDevMode ? [{ debugName: "openedAsModal" }] : /* istanbul ignore next */ []));
|
|
656
|
+
/**
|
|
657
|
+
* @internal Hotkey scope of the dialog subtree: modal while opened as a
|
|
658
|
+
* modal, so app bindings outside stay quiet while focus is inside, and
|
|
659
|
+
* inactive while closed, so bindings inside never fire from a hidden dialog.
|
|
660
|
+
*/
|
|
661
|
+
hotkeyScope = createHotkeyScope({
|
|
662
|
+
element: this.elRef.nativeElement,
|
|
663
|
+
modal: this.openedAsModal.asReadonly(),
|
|
664
|
+
active: computed(() => this.lifecycleSignal() !== 'closed'),
|
|
665
|
+
parent: inject(CNGX_HOTKEY_SCOPE, { optional: true, skipSelf: true }),
|
|
666
|
+
destroyRef: this.destroyRef,
|
|
667
|
+
});
|
|
668
668
|
constructor() {
|
|
669
669
|
this.createLiveRegion();
|
|
670
670
|
effect(() => {
|
|
@@ -947,8 +947,7 @@ class CngxDialog {
|
|
|
947
947
|
autofocusEl.focus();
|
|
948
948
|
return;
|
|
949
949
|
}
|
|
950
|
-
|
|
951
|
-
focusable?.focus();
|
|
950
|
+
dialog.querySelector(CNGX_FOCUSABLE_SELECTOR)?.focus();
|
|
952
951
|
}
|
|
953
952
|
else {
|
|
954
953
|
const target = dialog.querySelector(strategy);
|
|
@@ -993,6 +992,7 @@ class CngxDialog {
|
|
|
993
992
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.4", type: CngxDialog, isStandalone: true, selector: "dialog[cngxDialog]", inputs: { modal: { classPropertyName: "modal", publicName: "modal", isSignal: true, isRequired: false, transformFunction: null }, closeOnBackdropClick: { classPropertyName: "closeOnBackdropClick", publicName: "closeOnBackdropClick", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: true, isRequired: false, transformFunction: null }, autoFocus: { classPropertyName: "autoFocus", publicName: "autoFocus", isSignal: true, isRequired: false, transformFunction: null }, focusFallback: { classPropertyName: "focusFallback", publicName: "focusFallback", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, submitAction: { classPropertyName: "submitAction", publicName: "submitAction", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "cancel": "handleCancel($event)", "pointerdown": "handlePointerDown($event)", "click": "handleClick($event)" }, properties: { "class.cngx-dialog--opening": "isOpening()", "class.cngx-dialog--open": "isOpen()", "class.cngx-dialog--closing": "isClosing()", "class.cngx-dialog--modal": "modal()", "attr.aria-modal": "ariaModal()", "attr.aria-labelledby": "ariaLabelledBy()", "attr.aria-describedby": "ariaDescribedBy()", "class.cngx-dialog--pending": "isPending()", "attr.aria-busy": "isPending() || null", "class.cngx-dialog--error": "effectiveError()", "style.--cngx-dialog-backdrop-opacity": "backdropOpacity()" } }, providers: [
|
|
994
993
|
{ provide: DIALOG_REF, useExisting: CngxDialog },
|
|
995
994
|
{ provide: CNGX_DIALOG_ARIA_REGISTRY, useExisting: CngxDialog },
|
|
995
|
+
{ provide: CNGX_HOTKEY_SCOPE, useFactory: () => inject(CngxDialog).hotkeyScope },
|
|
996
996
|
], queries: [{ propertyName: "titleDirective", first: true, predicate: CngxDialogTitle, descendants: true, isSignal: true }, { propertyName: "descriptionDirective", first: true, predicate: CngxDialogDescription, descendants: true, isSignal: true }], exportAs: ["cngxDialog"], ngImport: i0 });
|
|
997
997
|
}
|
|
998
998
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxDialog, decorators: [{
|
|
@@ -1004,6 +1004,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1004
1004
|
providers: [
|
|
1005
1005
|
{ provide: DIALOG_REF, useExisting: CngxDialog },
|
|
1006
1006
|
{ provide: CNGX_DIALOG_ARIA_REGISTRY, useExisting: CngxDialog },
|
|
1007
|
+
{ provide: CNGX_HOTKEY_SCOPE, useFactory: () => inject(CngxDialog).hotkeyScope },
|
|
1007
1008
|
],
|
|
1008
1009
|
host: {
|
|
1009
1010
|
'[class.cngx-dialog--opening]': 'isOpening()',
|
|
@@ -1041,22 +1042,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1041
1042
|
* </dialog>
|
|
1042
1043
|
* ```
|
|
1043
1044
|
*
|
|
1044
|
-
* @category common/dialog
|
|
1045
|
-
* @docsKind primary
|
|
1046
1045
|
* @wcag AA
|
|
1047
1046
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/dialog/dialog-close.directive.ts
|
|
1048
|
-
* @since 0.
|
|
1047
|
+
* @since 0.3.0
|
|
1049
1048
|
* @relatedTo CngxDialog, CngxDialogTitle, CngxDialogDescription
|
|
1050
|
-
* <example-url
|
|
1051
|
-
* <example-url
|
|
1052
|
-
* <example-url
|
|
1053
|
-
* <example-url
|
|
1054
|
-
* <example-url
|
|
1055
|
-
* <example-url
|
|
1056
|
-
* <example-url
|
|
1057
|
-
* <example-url
|
|
1058
|
-
* <example-url
|
|
1059
|
-
* <example-url
|
|
1049
|
+
* <example-url>/#/common/dialog/alert-dialog</example-url>
|
|
1050
|
+
* <example-url>/#/common/dialog/bottom-sheet</example-url>
|
|
1051
|
+
* <example-url>/#/common/dialog/cngxdialogopener-programmatic</example-url>
|
|
1052
|
+
* <example-url>/#/common/dialog/draggable-dialog</example-url>
|
|
1053
|
+
* <example-url>/#/common/dialog/fully-declarative</example-url>
|
|
1054
|
+
* <example-url>/#/common/dialog/grid-snap-live-vs-release</example-url>
|
|
1055
|
+
* <example-url>/#/common/dialog/nested-dialogs-cngxdialogstack</example-url>
|
|
1056
|
+
* <example-url>/#/common/dialog/non-modal-panel</example-url>
|
|
1057
|
+
* <example-url>/#/common/dialog/programmatic-control</example-url>
|
|
1058
|
+
* <example-url>/#/common/dialog/template-directives</example-url>
|
|
1060
1059
|
*/
|
|
1061
1060
|
class CngxDialogClose {
|
|
1062
1061
|
dialogRef = inject(DIALOG_REF);
|
|
@@ -1136,9 +1135,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1136
1135
|
/**
|
|
1137
1136
|
* Injection token for data passed to a programmatically opened dialog via `CngxDialogOpener.open()`.
|
|
1138
1137
|
*
|
|
1139
|
-
* @category common/dialog
|
|
1140
1138
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/dialog/dialog-config.ts
|
|
1141
|
-
* @since 0.
|
|
1139
|
+
* @since 0.3.0
|
|
1142
1140
|
*/
|
|
1143
1141
|
const CNGX_DIALOG_DATA = new InjectionToken('CngxDialogData');
|
|
1144
1142
|
|
|
@@ -1222,9 +1220,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1222
1220
|
* });
|
|
1223
1221
|
* ```
|
|
1224
1222
|
*
|
|
1225
|
-
* @category common/dialog
|
|
1226
1223
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/dialog/dialog.service.ts
|
|
1227
|
-
* @since 0.
|
|
1224
|
+
* @since 0.3.0
|
|
1228
1225
|
* @relatedTo CngxDialogOpener, CngxDialog, CNGX_DIALOG_DATA
|
|
1229
1226
|
*/
|
|
1230
1227
|
class CngxDialogRef {
|
|
@@ -1346,10 +1343,8 @@ class CngxDialogRef {
|
|
|
1346
1343
|
* }
|
|
1347
1344
|
* ```
|
|
1348
1345
|
*
|
|
1349
|
-
* @category common/dialog
|
|
1350
|
-
* @docsKind primary
|
|
1351
1346
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/dialog/dialog.service.ts
|
|
1352
|
-
* @since 0.
|
|
1347
|
+
* @since 0.3.0
|
|
1353
1348
|
* @relatedTo CngxDialog, CngxDialogRef, CNGX_DIALOG_DATA, CngxDialogStack
|
|
1354
1349
|
*/
|
|
1355
1350
|
class CngxDialogOpener {
|
|
@@ -1365,6 +1360,14 @@ class CngxDialogOpener {
|
|
|
1365
1360
|
* one live effect.
|
|
1366
1361
|
*/
|
|
1367
1362
|
cleanupEffects = new WeakMap();
|
|
1363
|
+
/**
|
|
1364
|
+
* Opens a dialog whose body is a component type or a template. Creates the
|
|
1365
|
+
* dialog outlet, appends it to `document.body`, applies the `config` flags
|
|
1366
|
+
* (`modal`, `closeOnBackdropClick` and `closeOnEscape` default to `true`) and
|
|
1367
|
+
* returns a `CngxDialogRef` that stays tracked, and is torn down, until the
|
|
1368
|
+
* dialog closes. If creating the content throws, the outlet is removed and the
|
|
1369
|
+
* error is rethrown.
|
|
1370
|
+
*/
|
|
1368
1371
|
open(content, config = {}) {
|
|
1369
1372
|
const outletRef = createComponent(CngxDialogOutlet, {
|
|
1370
1373
|
environmentInjector: this.envInjector,
|
|
@@ -1405,6 +1408,8 @@ class CngxDialogOpener {
|
|
|
1405
1408
|
// queries cannot see - labelling flows through the registry instead.
|
|
1406
1409
|
{ provide: CNGX_DIALOG_ARIA_REGISTRY, useValue: dialogInstance },
|
|
1407
1410
|
{ provide: CNGX_DIALOG_DATA, useValue: config.data ?? null },
|
|
1411
|
+
// Same reason: content injectors hang off the service, not the dialog.
|
|
1412
|
+
{ provide: CNGX_HOTKEY_SCOPE, useValue: dialogInstance.hotkeyScope },
|
|
1408
1413
|
],
|
|
1409
1414
|
});
|
|
1410
1415
|
// Creating the content and its first render run consumer code. A throw
|
|
@@ -1492,8 +1497,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1492
1497
|
* providers: [provideDialog()],
|
|
1493
1498
|
* });
|
|
1494
1499
|
* ```
|
|
1495
|
-
*
|
|
1496
|
-
* @category common/dialog
|
|
1497
1500
|
*/
|
|
1498
1501
|
function provideDialog() {
|
|
1499
1502
|
return [CngxDialogOpener];
|
|
@@ -1527,12 +1530,11 @@ function provideDialog() {
|
|
|
1527
1530
|
* </dialog>
|
|
1528
1531
|
* ```
|
|
1529
1532
|
*
|
|
1530
|
-
* @category common/dialog
|
|
1531
|
-
* @docsKind primary
|
|
1532
1533
|
* @wcag AA
|
|
1533
1534
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/bottom-sheet/bottom-sheet.directive.ts
|
|
1534
|
-
* @since 0.
|
|
1535
|
+
* @since 0.3.0
|
|
1535
1536
|
* @relatedTo CngxDialog, CngxSwipeDismiss, CngxDialogClose
|
|
1537
|
+
* @axis level organism
|
|
1536
1538
|
*/
|
|
1537
1539
|
class CngxBottomSheet {
|
|
1538
1540
|
dialogRef = inject(DIALOG_REF);
|
|
@@ -1599,22 +1601,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1599
1601
|
* }
|
|
1600
1602
|
* ```
|
|
1601
1603
|
*
|
|
1602
|
-
* @category common/dialog
|
|
1603
|
-
* @docsKind primary
|
|
1604
1604
|
* @wcag AA
|
|
1605
1605
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/draggable/dialog-draggable.directive.ts
|
|
1606
|
-
* @since 0.
|
|
1606
|
+
* @since 0.3.0
|
|
1607
1607
|
* @relatedTo CngxDialog, CngxBottomSheet
|
|
1608
|
-
* <example-url
|
|
1609
|
-
* <example-url
|
|
1610
|
-
* <example-url
|
|
1611
|
-
* <example-url
|
|
1612
|
-
* <example-url
|
|
1613
|
-
* <example-url
|
|
1614
|
-
* <example-url
|
|
1615
|
-
* <example-url
|
|
1616
|
-
* <example-url
|
|
1617
|
-
* <example-url
|
|
1608
|
+
* <example-url>/#/common/dialog/alert-dialog</example-url>
|
|
1609
|
+
* <example-url>/#/common/dialog/bottom-sheet</example-url>
|
|
1610
|
+
* <example-url>/#/common/dialog/cngxdialogopener-programmatic</example-url>
|
|
1611
|
+
* <example-url>/#/common/dialog/draggable-dialog</example-url>
|
|
1612
|
+
* <example-url>/#/common/dialog/fully-declarative</example-url>
|
|
1613
|
+
* <example-url>/#/common/dialog/grid-snap-live-vs-release</example-url>
|
|
1614
|
+
* <example-url>/#/common/dialog/nested-dialogs-cngxdialogstack</example-url>
|
|
1615
|
+
* <example-url>/#/common/dialog/non-modal-panel</example-url>
|
|
1616
|
+
* <example-url>/#/common/dialog/programmatic-control</example-url>
|
|
1617
|
+
* <example-url>/#/common/dialog/template-directives</example-url>
|
|
1618
1618
|
*/
|
|
1619
1619
|
class CngxDialogDraggable {
|
|
1620
1620
|
elRef = inject(ElementRef);
|
|
@@ -1728,8 +1728,8 @@ class CngxDialogDraggable {
|
|
|
1728
1728
|
}
|
|
1729
1729
|
// Don't drag if the target is an interactive element inside the handle
|
|
1730
1730
|
const target = event.target;
|
|
1731
|
-
|
|
1732
|
-
|
|
1731
|
+
const interactiveTarget = target.closest('button, a, input, select, textarea, [tabindex]');
|
|
1732
|
+
if (interactiveTarget !== null && interactiveTarget !== this.currentHandle) {
|
|
1733
1733
|
return;
|
|
1734
1734
|
}
|
|
1735
1735
|
event.preventDefault();
|
|
@@ -1937,7 +1937,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1937
1937
|
}], ctorParameters: () => [], propDecorators: { handle: [{ type: i0.Input, args: [{ isSignal: true, alias: "handle", required: false }] }], constrainToViewport: [{ type: i0.Input, args: [{ isSignal: true, alias: "constrainToViewport", required: false }] }], gridSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridSize", required: false }] }], snapMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "snapMode", required: false }] }] } });
|
|
1938
1938
|
|
|
1939
1939
|
/**
|
|
1940
|
-
* @module
|
|
1940
|
+
* @module `@cngx/common/dialog`
|
|
1941
1941
|
*/
|
|
1942
1942
|
|
|
1943
1943
|
/**
|