@spartan-ng/brain 0.0.1-alpha.405 → 0.0.1-alpha.406
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/alert-dialog/lib/brn-alert-dialog-trigger.directive.d.ts +3 -2
- package/dialog/index.d.ts +1 -0
- package/dialog/lib/brn-dialog-close.directive.d.ts +2 -4
- package/dialog/lib/brn-dialog-content.directive.d.ts +3 -3
- package/dialog/lib/brn-dialog-overlay.component.d.ts +3 -2
- package/dialog/lib/brn-dialog-token.d.ts +8 -0
- package/dialog/lib/brn-dialog-trigger.directive.d.ts +5 -2
- package/dialog/lib/brn-dialog.component.d.ts +52 -31
- package/esm2022/alert-dialog/lib/brn-alert-dialog-trigger.directive.mjs +16 -9
- package/esm2022/alert-dialog/lib/brn-alert-dialog.component.mjs +5 -5
- package/esm2022/dialog/index.mjs +2 -1
- package/esm2022/dialog/lib/brn-dialog-close.directive.mjs +6 -11
- package/esm2022/dialog/lib/brn-dialog-content.directive.mjs +19 -19
- package/esm2022/dialog/lib/brn-dialog-overlay.component.mjs +13 -9
- package/esm2022/dialog/lib/brn-dialog-token.mjs +15 -0
- package/esm2022/dialog/lib/brn-dialog-trigger.directive.mjs +16 -8
- package/esm2022/dialog/lib/brn-dialog.component.mjs +112 -133
- package/esm2022/popover/lib/brn-popover-trigger.directive.mjs +19 -13
- package/esm2022/popover/lib/brn-popover.component.mjs +36 -40
- package/esm2022/select/lib/brn-select.component.mjs +5 -3
- package/esm2022/sheet/lib/brn-sheet-trigger.directive.mjs +8 -9
- package/esm2022/sheet/lib/brn-sheet.component.mjs +27 -25
- package/fesm2022/spartan-ng-brain-alert-dialog.mjs +18 -11
- package/fesm2022/spartan-ng-brain-alert-dialog.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-dialog.mjs +170 -171
- package/fesm2022/spartan-ng-brain-dialog.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-popover.mjs +52 -50
- package/fesm2022/spartan-ng-brain-popover.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-select.mjs +4 -2
- package/fesm2022/spartan-ng-brain-select.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-sheet.mjs +32 -31
- package/fesm2022/spartan-ng-brain-sheet.mjs.map +1 -1
- package/package.json +1 -1
- package/popover/lib/brn-popover-trigger.directive.d.ts +2 -2
- package/popover/lib/brn-popover.component.d.ts +3 -6
- package/select/lib/brn-select.component.d.ts +3 -2
- package/sheet/lib/brn-sheet-trigger.directive.d.ts +2 -2
- package/sheet/lib/brn-sheet.component.d.ts +4 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Directive,
|
|
2
|
+
import { inject, input, Directive, InjectionToken, RendererFactory2, Injector, signal, computed, runInInjectionContext, effect, Injectable, ViewContainerRef, output, booleanAttribute, untracked, numberAttribute, Component, ChangeDetectionStrategy, ViewEncapsulation, TemplateRef, NgModule } from '@angular/core';
|
|
3
3
|
import { coerceNumberProperty } from '@angular/cdk/coercion';
|
|
4
4
|
import { Subject } from 'rxjs';
|
|
5
5
|
import { take, takeUntil, filter } from 'rxjs/operators';
|
|
@@ -72,15 +72,12 @@ class BrnDialogRef {
|
|
|
72
72
|
|
|
73
73
|
class BrnDialogCloseDirective {
|
|
74
74
|
_brnDialogRef = inject(BrnDialogRef);
|
|
75
|
-
|
|
76
|
-
set delay(value) {
|
|
77
|
-
this._delay = coerceNumberProperty(value);
|
|
78
|
-
}
|
|
75
|
+
delay = input(undefined, { transform: coerceNumberProperty });
|
|
79
76
|
close() {
|
|
80
|
-
this._brnDialogRef.close(undefined, this.
|
|
77
|
+
this._brnDialogRef.close(undefined, this.delay());
|
|
81
78
|
}
|
|
82
79
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnDialogCloseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
83
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
80
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.5", type: BrnDialogCloseDirective, isStandalone: true, selector: "button[brnDialogClose]", inputs: { delay: { classPropertyName: "delay", publicName: "delay", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "close()" } }, ngImport: i0 });
|
|
84
81
|
}
|
|
85
82
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnDialogCloseDirective, decorators: [{
|
|
86
83
|
type: Directive,
|
|
@@ -91,9 +88,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImpor
|
|
|
91
88
|
'(click)': 'close()',
|
|
92
89
|
},
|
|
93
90
|
}]
|
|
94
|
-
}]
|
|
95
|
-
type: Input
|
|
96
|
-
}] } });
|
|
91
|
+
}] });
|
|
97
92
|
|
|
98
93
|
const DEFAULT_BRN_DIALOG_OPTIONS = {
|
|
99
94
|
role: 'dialog',
|
|
@@ -114,6 +109,20 @@ const DEFAULT_BRN_DIALOG_OPTIONS = {
|
|
|
114
109
|
ariaModal: true,
|
|
115
110
|
};
|
|
116
111
|
|
|
112
|
+
const defaultOptions = {
|
|
113
|
+
closeDelay: 0,
|
|
114
|
+
};
|
|
115
|
+
const BRN_DIALOG_DEFAULT_OPTIONS = new InjectionToken('brn-dialog-default-options', {
|
|
116
|
+
providedIn: 'root',
|
|
117
|
+
factory: () => defaultOptions,
|
|
118
|
+
});
|
|
119
|
+
function provideBrnDialogDefaultOptions(options) {
|
|
120
|
+
return { provide: BRN_DIALOG_DEFAULT_OPTIONS, useValue: { ...defaultOptions, ...options } };
|
|
121
|
+
}
|
|
122
|
+
function injectBrnDialogDefaultOptions() {
|
|
123
|
+
return inject(BRN_DIALOG_DEFAULT_OPTIONS, { optional: true }) ?? defaultOptions;
|
|
124
|
+
}
|
|
125
|
+
|
|
117
126
|
let dialogSequence = 0;
|
|
118
127
|
/** @deprecated `injectBrnDialogCtx` will no longer be supported once components are stable. Use `injectBrnDialogContext` instead. */
|
|
119
128
|
const injectBrnDialogCtx = () => {
|
|
@@ -240,91 +249,120 @@ class BrnDialogComponent {
|
|
|
240
249
|
positionBuilder = inject(OverlayPositionBuilder);
|
|
241
250
|
ssos = inject(ScrollStrategyOptions);
|
|
242
251
|
_injector = inject(Injector);
|
|
252
|
+
_defaultOptions = injectBrnDialogDefaultOptions();
|
|
243
253
|
_context = {};
|
|
244
|
-
|
|
245
|
-
...DEFAULT_BRN_DIALOG_OPTIONS,
|
|
246
|
-
};
|
|
254
|
+
stateComputed = computed(() => this._dialogRef()?.state() ?? 'closed');
|
|
247
255
|
_contentTemplate;
|
|
248
256
|
_dialogRef = signal(undefined);
|
|
249
257
|
_dialogStateEffectRef;
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
this._options.scrollStrategy = this.ssos.close();
|
|
258
|
+
_backdropClass = signal(null);
|
|
259
|
+
_panelClass = signal(null);
|
|
260
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
261
|
+
closed = output();
|
|
262
|
+
stateChanged = output();
|
|
263
|
+
state = input(null);
|
|
264
|
+
role = input('dialog');
|
|
265
|
+
mutableRole = computed(() => signal(this.role()));
|
|
266
|
+
_roleState = computed(() => this.mutableRole()());
|
|
267
|
+
hasBackdrop = input(true, { transform: booleanAttribute });
|
|
268
|
+
_mutableHasBackdrop = computed(() => signal(this.hasBackdrop()));
|
|
269
|
+
_hasBackdropState = computed(() => this._mutableHasBackdrop()());
|
|
270
|
+
positionStrategy = input();
|
|
271
|
+
mutablePositionStrategy = computed(() => signal(this.positionStrategy()));
|
|
272
|
+
_positionStrategyState = computed(() => this.mutablePositionStrategy()());
|
|
273
|
+
scrollStrategy = input(null);
|
|
274
|
+
mutableScrollStrategy = computed(() => signal(this.scrollStrategy()));
|
|
275
|
+
_scrollStrategyState = computed(() => this.mutableScrollStrategy()());
|
|
276
|
+
_options = computed(() => {
|
|
277
|
+
const scrollStrategyInput = this._scrollStrategyState();
|
|
278
|
+
let scrollStrategy;
|
|
279
|
+
if (scrollStrategyInput === 'close') {
|
|
280
|
+
scrollStrategy = this.ssos.close();
|
|
274
281
|
}
|
|
275
|
-
else if (
|
|
276
|
-
|
|
282
|
+
else if (scrollStrategyInput === 'reposition') {
|
|
283
|
+
scrollStrategy = this.ssos.reposition();
|
|
277
284
|
}
|
|
278
285
|
else {
|
|
279
|
-
|
|
286
|
+
scrollStrategy = scrollStrategyInput;
|
|
280
287
|
}
|
|
288
|
+
return {
|
|
289
|
+
...DEFAULT_BRN_DIALOG_OPTIONS,
|
|
290
|
+
role: this._roleState(),
|
|
291
|
+
hasBackdrop: this._hasBackdropState(),
|
|
292
|
+
positionStrategy: this._positionStrategyState(),
|
|
293
|
+
scrollStrategy,
|
|
294
|
+
restoreFocus: this.restoreFocus(),
|
|
295
|
+
closeOnOutsidePointerEvents: this._closeOnOutsidePointerEventsState(),
|
|
296
|
+
closeOnBackdropClick: this._closeOnBackdropClickState(),
|
|
297
|
+
attachTo: this._attachToState(),
|
|
298
|
+
attachPositions: this._attachPositionsState(),
|
|
299
|
+
autoFocus: this.autoFocus(),
|
|
300
|
+
closeDelay: 100,
|
|
301
|
+
disableClose: this.disableClose(),
|
|
302
|
+
backdropClass: this._backdropClass() ?? '',
|
|
303
|
+
panelClass: this._panelClass() ?? '',
|
|
304
|
+
ariaDescribedBy: this._ariaDescribedByState(),
|
|
305
|
+
ariaLabelledBy: this._ariaLabelledByState(),
|
|
306
|
+
ariaLabel: this._ariaLabelState(),
|
|
307
|
+
ariaModal: this._ariaModalState(),
|
|
308
|
+
};
|
|
309
|
+
});
|
|
310
|
+
constructor() {
|
|
311
|
+
effect(() => {
|
|
312
|
+
const state = this.state();
|
|
313
|
+
if (state === 'open') {
|
|
314
|
+
untracked(() => this.open());
|
|
315
|
+
}
|
|
316
|
+
if (state === 'closed') {
|
|
317
|
+
untracked(() => this.close(this._options().closeDelay));
|
|
318
|
+
}
|
|
319
|
+
});
|
|
281
320
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}
|
|
317
|
-
set ariaModal(isModal) {
|
|
318
|
-
this.setAriaModal(isModal);
|
|
319
|
-
}
|
|
321
|
+
restoreFocus = input(true);
|
|
322
|
+
closeOnOutsidePointerEvents = input(false, {
|
|
323
|
+
transform: booleanAttribute,
|
|
324
|
+
});
|
|
325
|
+
mutableCloseOnOutsidePointerEvents = computed(() => signal(this.closeOnOutsidePointerEvents()));
|
|
326
|
+
_closeOnOutsidePointerEventsState = computed(() => this.mutableCloseOnOutsidePointerEvents()());
|
|
327
|
+
closeOnBackdropClick = input(DEFAULT_BRN_DIALOG_OPTIONS.closeOnBackdropClick, {
|
|
328
|
+
transform: booleanAttribute,
|
|
329
|
+
});
|
|
330
|
+
mutableCloseOnBackdropClick = computed(() => signal(this.closeOnBackdropClick()));
|
|
331
|
+
_closeOnBackdropClickState = computed(() => this.mutableCloseOnBackdropClick()());
|
|
332
|
+
attachTo = input(null);
|
|
333
|
+
mutableAttachTo = computed(() => signal(this.attachTo()));
|
|
334
|
+
_attachToState = computed(() => this.mutableAttachTo()());
|
|
335
|
+
attachPositions = input([]);
|
|
336
|
+
mutableAttachPositions = computed(() => signal(this.attachPositions()));
|
|
337
|
+
_attachPositionsState = computed(() => this.mutableAttachPositions()());
|
|
338
|
+
autoFocus = input('first-tabbable');
|
|
339
|
+
closeDelay = input(100, { alias: 'closeDelay', transform: numberAttribute });
|
|
340
|
+
disableClose = input(false, { transform: booleanAttribute });
|
|
341
|
+
ariaDescribedBy = input(null, {
|
|
342
|
+
alias: 'aria-describedby',
|
|
343
|
+
});
|
|
344
|
+
_mutableAriaDescribedBy = computed(() => signal(this.ariaDescribedBy()));
|
|
345
|
+
_ariaDescribedByState = computed(() => this._mutableAriaDescribedBy()());
|
|
346
|
+
ariaLabelledBy = input(null, { alias: 'aria-labelledby' });
|
|
347
|
+
_mutableAriaLabelledBy = computed(() => signal(this.ariaLabelledBy()));
|
|
348
|
+
_ariaLabelledByState = computed(() => this._mutableAriaLabelledBy()());
|
|
349
|
+
ariaLabel = input(null, { alias: 'aria-label' });
|
|
350
|
+
_mutableAriaLabel = computed(() => signal(this.ariaLabel()));
|
|
351
|
+
_ariaLabelState = computed(() => this._mutableAriaLabel()());
|
|
352
|
+
ariaModal = input(true, { alias: 'aria-modal', transform: booleanAttribute });
|
|
353
|
+
_mutableAriaModal = computed(() => signal(this.ariaModal()));
|
|
354
|
+
_ariaModalState = computed(() => this._mutableAriaModal()());
|
|
320
355
|
open() {
|
|
321
356
|
if (!this._contentTemplate || this._dialogRef())
|
|
322
357
|
return;
|
|
323
358
|
this._dialogStateEffectRef?.destroy();
|
|
324
|
-
const dialogRef = this._dialogService.open(this._contentTemplate, this._vcr, this._context, this._options);
|
|
359
|
+
const dialogRef = this._dialogService.open(this._contentTemplate, this._vcr, this._context, this._options());
|
|
325
360
|
this._dialogRef.set(dialogRef);
|
|
326
361
|
runInInjectionContext(this._injector, () => {
|
|
327
|
-
this._dialogStateEffectRef = effect(() =>
|
|
362
|
+
this._dialogStateEffectRef = effect(() => {
|
|
363
|
+
const state = dialogRef.state();
|
|
364
|
+
untracked(() => this.stateChanged.emit(state));
|
|
365
|
+
});
|
|
328
366
|
});
|
|
329
367
|
dialogRef.closed$.pipe(take(1)).subscribe((result) => {
|
|
330
368
|
this._dialogRef.set(undefined);
|
|
@@ -333,17 +371,17 @@ class BrnDialogComponent {
|
|
|
333
371
|
}
|
|
334
372
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
335
373
|
close(result, delay) {
|
|
336
|
-
this._dialogRef()?.close(result, delay ?? this._options.closeDelay);
|
|
374
|
+
this._dialogRef()?.close(result, delay ?? this._options().closeDelay);
|
|
337
375
|
}
|
|
338
376
|
registerTemplate(template) {
|
|
339
377
|
this._contentTemplate = template;
|
|
340
378
|
}
|
|
341
379
|
setOverlayClass(overlayClass) {
|
|
342
|
-
this.
|
|
380
|
+
this._backdropClass.set(overlayClass);
|
|
343
381
|
this._dialogRef()?.setOverlayClass(overlayClass);
|
|
344
382
|
}
|
|
345
383
|
setPanelClass(panelClass) {
|
|
346
|
-
this.
|
|
384
|
+
this._panelClass.set(panelClass ?? '');
|
|
347
385
|
this._dialogRef()?.setPanelClass(panelClass);
|
|
348
386
|
}
|
|
349
387
|
setContext(context) {
|
|
@@ -352,22 +390,22 @@ class BrnDialogComponent {
|
|
|
352
390
|
this._context = { ...this._context, ...context };
|
|
353
391
|
}
|
|
354
392
|
setAriaDescribedBy(ariaDescribedBy) {
|
|
355
|
-
this.
|
|
393
|
+
this._mutableAriaDescribedBy().set(ariaDescribedBy);
|
|
356
394
|
this._dialogRef()?.setAriaDescribedBy(ariaDescribedBy);
|
|
357
395
|
}
|
|
358
396
|
setAriaLabelledBy(ariaLabelledBy) {
|
|
359
|
-
this.
|
|
397
|
+
this._mutableAriaLabelledBy().set(ariaLabelledBy);
|
|
360
398
|
this._dialogRef()?.setAriaLabelledBy(ariaLabelledBy);
|
|
361
399
|
}
|
|
362
400
|
setAriaLabel(ariaLabel) {
|
|
363
|
-
this.
|
|
401
|
+
this._mutableAriaLabel().set(ariaLabel);
|
|
364
402
|
this._dialogRef()?.setAriaLabel(ariaLabel);
|
|
365
403
|
}
|
|
366
404
|
setAriaModal(ariaModal) {
|
|
367
|
-
this.
|
|
405
|
+
this._mutableAriaModal().set(ariaModal);
|
|
368
406
|
}
|
|
369
407
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
370
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
408
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.5", type: BrnDialogComponent, isStandalone: true, selector: "brn-dialog", inputs: { state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null }, hasBackdrop: { classPropertyName: "hasBackdrop", publicName: "hasBackdrop", isSignal: true, isRequired: false, transformFunction: null }, positionStrategy: { classPropertyName: "positionStrategy", publicName: "positionStrategy", isSignal: true, isRequired: false, transformFunction: null }, scrollStrategy: { classPropertyName: "scrollStrategy", publicName: "scrollStrategy", isSignal: true, isRequired: false, transformFunction: null }, restoreFocus: { classPropertyName: "restoreFocus", publicName: "restoreFocus", isSignal: true, isRequired: false, transformFunction: null }, closeOnOutsidePointerEvents: { classPropertyName: "closeOnOutsidePointerEvents", publicName: "closeOnOutsidePointerEvents", isSignal: true, isRequired: false, transformFunction: null }, closeOnBackdropClick: { classPropertyName: "closeOnBackdropClick", publicName: "closeOnBackdropClick", isSignal: true, isRequired: false, transformFunction: null }, attachTo: { classPropertyName: "attachTo", publicName: "attachTo", isSignal: true, isRequired: false, transformFunction: null }, attachPositions: { classPropertyName: "attachPositions", publicName: "attachPositions", isSignal: true, isRequired: false, transformFunction: null }, autoFocus: { classPropertyName: "autoFocus", publicName: "autoFocus", isSignal: true, isRequired: false, transformFunction: null }, closeDelay: { classPropertyName: "closeDelay", publicName: "closeDelay", isSignal: true, isRequired: false, transformFunction: null }, disableClose: { classPropertyName: "disableClose", publicName: "disableClose", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaModal: { classPropertyName: "ariaModal", publicName: "aria-modal", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closed: "closed", stateChanged: "stateChanged" }, exportAs: ["brnDialog"], ngImport: i0, template: `
|
|
371
409
|
<ng-content />
|
|
372
410
|
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
373
411
|
}
|
|
@@ -383,81 +421,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImpor
|
|
|
383
421
|
encapsulation: ViewEncapsulation.None,
|
|
384
422
|
exportAs: 'brnDialog',
|
|
385
423
|
}]
|
|
386
|
-
}],
|
|
387
|
-
type: Output
|
|
388
|
-
}], stateChanged: [{
|
|
389
|
-
type: Output
|
|
390
|
-
}], newState: [{
|
|
391
|
-
type: Input,
|
|
392
|
-
args: ['state']
|
|
393
|
-
}], role: [{
|
|
394
|
-
type: Input
|
|
395
|
-
}], hasBackdrop: [{
|
|
396
|
-
type: Input,
|
|
397
|
-
args: [{ transform: booleanAttribute }]
|
|
398
|
-
}], positionStrategy: [{
|
|
399
|
-
type: Input
|
|
400
|
-
}], scrollStrategy: [{
|
|
401
|
-
type: Input
|
|
402
|
-
}], restoreFocus: [{
|
|
403
|
-
type: Input
|
|
404
|
-
}], closeOnOutsidePointerEvents: [{
|
|
405
|
-
type: Input,
|
|
406
|
-
args: [{ transform: booleanAttribute }]
|
|
407
|
-
}], closeOnBackdropClick: [{
|
|
408
|
-
type: Input,
|
|
409
|
-
args: [{ transform: booleanAttribute }]
|
|
410
|
-
}], attachTo: [{
|
|
411
|
-
type: Input
|
|
412
|
-
}], attachPositions: [{
|
|
413
|
-
type: Input
|
|
414
|
-
}], autoFocus: [{
|
|
415
|
-
type: Input
|
|
416
|
-
}], closeDelay: [{
|
|
417
|
-
type: Input,
|
|
418
|
-
args: [{ transform: numberAttribute }]
|
|
419
|
-
}], disableClose: [{
|
|
420
|
-
type: Input,
|
|
421
|
-
args: [{ transform: booleanAttribute }]
|
|
422
|
-
}], ariaDescribedBy: [{
|
|
423
|
-
type: Input,
|
|
424
|
-
args: ['aria-describedby']
|
|
425
|
-
}], ariaLabelledBy: [{
|
|
426
|
-
type: Input,
|
|
427
|
-
args: ['aria-labelledby']
|
|
428
|
-
}], ariaLabel: [{
|
|
429
|
-
type: Input,
|
|
430
|
-
args: ['aria-label']
|
|
431
|
-
}], ariaModal: [{
|
|
432
|
-
type: Input,
|
|
433
|
-
args: [{
|
|
434
|
-
alias: 'aria-modal',
|
|
435
|
-
transform: booleanAttribute,
|
|
436
|
-
}]
|
|
437
|
-
}] } });
|
|
424
|
+
}], ctorParameters: () => [] });
|
|
438
425
|
|
|
439
426
|
class BrnDialogContentDirective {
|
|
440
427
|
_brnDialog = inject(BrnDialogComponent, { optional: true });
|
|
441
428
|
_brnDialogRef = inject(BrnDialogRef, { optional: true });
|
|
442
429
|
_template = inject(TemplateRef);
|
|
443
|
-
state = computed(() => this._brnDialog?.
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
return;
|
|
447
|
-
this._brnDialog.setPanelClass(newClass);
|
|
448
|
-
}
|
|
449
|
-
set context(context) {
|
|
450
|
-
if (!this._brnDialog)
|
|
451
|
-
return;
|
|
452
|
-
this._brnDialog.setContext(context);
|
|
453
|
-
}
|
|
430
|
+
state = computed(() => this._brnDialog?.stateComputed() ?? this._brnDialogRef?.state() ?? 'closed');
|
|
431
|
+
className = input(undefined, { alias: 'class' });
|
|
432
|
+
context = input(undefined);
|
|
454
433
|
constructor() {
|
|
455
434
|
if (!this._brnDialog)
|
|
456
435
|
return;
|
|
457
436
|
this._brnDialog.registerTemplate(this._template);
|
|
437
|
+
effect(() => {
|
|
438
|
+
const context = this.context();
|
|
439
|
+
if (!this._brnDialog || !context)
|
|
440
|
+
return;
|
|
441
|
+
untracked(() => this._brnDialog?.setContext(context));
|
|
442
|
+
});
|
|
443
|
+
effect(() => {
|
|
444
|
+
if (!this._brnDialog)
|
|
445
|
+
return;
|
|
446
|
+
const newClass = this.className();
|
|
447
|
+
untracked(() => this._brnDialog?.setPanelClass(newClass));
|
|
448
|
+
});
|
|
458
449
|
}
|
|
459
450
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnDialogContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
460
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
451
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.5", type: BrnDialogContentDirective, isStandalone: true, selector: "[brnDialogContent]", inputs: { className: { classPropertyName: "className", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideExposesStateProviderExisting((() => BrnDialogContentDirective))], ngImport: i0 });
|
|
461
452
|
}
|
|
462
453
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnDialogContentDirective, decorators: [{
|
|
463
454
|
type: Directive,
|
|
@@ -466,11 +457,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImpor
|
|
|
466
457
|
standalone: true,
|
|
467
458
|
providers: [provideExposesStateProviderExisting((() => BrnDialogContentDirective))],
|
|
468
459
|
}]
|
|
469
|
-
}], ctorParameters: () => []
|
|
470
|
-
type: Input
|
|
471
|
-
}], context: [{
|
|
472
|
-
type: Input
|
|
473
|
-
}] } });
|
|
460
|
+
}], ctorParameters: () => [] });
|
|
474
461
|
|
|
475
462
|
class BrnDialogDescriptionDirective {
|
|
476
463
|
_brnDialogRef = inject(BrnDialogRef);
|
|
@@ -496,14 +483,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImpor
|
|
|
496
483
|
|
|
497
484
|
class BrnDialogOverlayComponent {
|
|
498
485
|
_brnDialog = inject(BrnDialogComponent);
|
|
499
|
-
|
|
500
|
-
this._brnDialog.setOverlayClass(newClass);
|
|
501
|
-
}
|
|
486
|
+
className = input(undefined, { alias: 'class' });
|
|
502
487
|
setClassToCustomElement(newClass) {
|
|
503
488
|
this._brnDialog.setOverlayClass(newClass);
|
|
504
489
|
}
|
|
490
|
+
constructor() {
|
|
491
|
+
effect(() => {
|
|
492
|
+
if (!this._brnDialog)
|
|
493
|
+
return;
|
|
494
|
+
const newClass = this.className();
|
|
495
|
+
untracked(() => this._brnDialog.setOverlayClass(newClass));
|
|
496
|
+
});
|
|
497
|
+
}
|
|
505
498
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnDialogOverlayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
506
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
499
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.5", type: BrnDialogOverlayComponent, isStandalone: true, selector: "brn-dialog-overlay", inputs: { className: { classPropertyName: "className", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideCustomClassSettableExisting((() => BrnDialogOverlayComponent))], ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
507
500
|
}
|
|
508
501
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnDialogOverlayComponent, decorators: [{
|
|
509
502
|
type: Component,
|
|
@@ -515,9 +508,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImpor
|
|
|
515
508
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
516
509
|
encapsulation: ViewEncapsulation.None,
|
|
517
510
|
}]
|
|
518
|
-
}],
|
|
519
|
-
type: Input
|
|
520
|
-
}] } });
|
|
511
|
+
}], ctorParameters: () => [] });
|
|
521
512
|
|
|
522
513
|
class BrnDialogTitleDirective {
|
|
523
514
|
_brnDialogRef = inject(BrnDialogRef);
|
|
@@ -548,14 +539,24 @@ class BrnDialogTriggerDirective {
|
|
|
548
539
|
id = input(`brn-dialog-trigger-${idSequence++}`);
|
|
549
540
|
state = this._brnDialogRef?.state ?? signal('closed');
|
|
550
541
|
dialogId = `brn-dialog-${this._brnDialogRef?.dialogId ?? idSequence++}`;
|
|
551
|
-
|
|
552
|
-
|
|
542
|
+
brnDialogTriggerFor = input(undefined, {
|
|
543
|
+
alias: 'brnDialogTriggerFor',
|
|
544
|
+
});
|
|
545
|
+
mutableBrnDialogTriggerFor = computed(() => signal(this.brnDialogTriggerFor()));
|
|
546
|
+
brnDialogTriggerForState = computed(() => this.mutableBrnDialogTriggerFor()());
|
|
547
|
+
constructor() {
|
|
548
|
+
effect(() => {
|
|
549
|
+
const brnDialog = this.brnDialogTriggerForState();
|
|
550
|
+
if (!brnDialog)
|
|
551
|
+
return;
|
|
552
|
+
this._brnDialog = brnDialog;
|
|
553
|
+
});
|
|
553
554
|
}
|
|
554
555
|
open() {
|
|
555
556
|
this._brnDialog?.open();
|
|
556
557
|
}
|
|
557
558
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnDialogTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
558
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.5", type: BrnDialogTriggerDirective, isStandalone: true, selector: "button[brnDialogTrigger],button[brnDialogTriggerFor]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, brnDialogTriggerFor: { classPropertyName: "brnDialogTriggerFor", publicName: "brnDialogTriggerFor", isSignal:
|
|
559
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.5", type: BrnDialogTriggerDirective, isStandalone: true, selector: "button[brnDialogTrigger],button[brnDialogTriggerFor]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, brnDialogTriggerFor: { classPropertyName: "brnDialogTriggerFor", publicName: "brnDialogTriggerFor", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-haspopup": "dialog" }, listeners: { "click": "open()" }, properties: { "id": "id()", "attr.aria-expanded": "state() === 'open' ? 'true': 'false'", "attr.data-state": "state()", "attr.aria-controls": "dialogId" } }, exportAs: ["brnDialogTrigger"], ngImport: i0 });
|
|
559
560
|
}
|
|
560
561
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnDialogTriggerDirective, decorators: [{
|
|
561
562
|
type: Directive,
|
|
@@ -572,9 +573,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImpor
|
|
|
572
573
|
},
|
|
573
574
|
exportAs: 'brnDialogTrigger',
|
|
574
575
|
}]
|
|
575
|
-
}],
|
|
576
|
-
type: Input
|
|
577
|
-
}] } });
|
|
576
|
+
}], ctorParameters: () => [] });
|
|
578
577
|
|
|
579
578
|
const BrnDialogImports = [
|
|
580
579
|
BrnDialogComponent,
|
|
@@ -614,5 +613,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImpor
|
|
|
614
613
|
* Generated bundle index. Do not edit.
|
|
615
614
|
*/
|
|
616
615
|
|
|
617
|
-
export { BrnDialogCloseDirective, BrnDialogComponent, BrnDialogContentDirective, BrnDialogDescriptionDirective, BrnDialogImports, BrnDialogModule, BrnDialogOverlayComponent, BrnDialogRef, BrnDialogService, BrnDialogTitleDirective, BrnDialogTriggerDirective, DEFAULT_BRN_DIALOG_OPTIONS, cssClassesToArray, injectBrnDialogContext, injectBrnDialogCtx };
|
|
616
|
+
export { BrnDialogCloseDirective, BrnDialogComponent, BrnDialogContentDirective, BrnDialogDescriptionDirective, BrnDialogImports, BrnDialogModule, BrnDialogOverlayComponent, BrnDialogRef, BrnDialogService, BrnDialogTitleDirective, BrnDialogTriggerDirective, DEFAULT_BRN_DIALOG_OPTIONS, cssClassesToArray, defaultOptions, injectBrnDialogContext, injectBrnDialogCtx, injectBrnDialogDefaultOptions, provideBrnDialogDefaultOptions };
|
|
618
617
|
//# sourceMappingURL=spartan-ng-brain-dialog.mjs.map
|