@ngrdt/gov 0.0.91 → 0.0.94
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/ngrdt-gov.mjs +254 -178
- package/fesm2022/ngrdt-gov.mjs.map +1 -1
- package/index.d.ts +144 -86
- package/package.json +7 -7
package/fesm2022/ngrdt-gov.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Injector, signal, input, linkedSignal, viewChild, effect, afterNextRender, untracked, HostBinding, Component, forwardRef, Injectable, ViewEncapsulation,
|
|
2
|
+
import { inject, Injector, signal, input, linkedSignal, viewChild, effect, afterNextRender, untracked, HostBinding, Component, forwardRef, Injectable, ViewEncapsulation, ChangeDetectionStrategy, computed, InjectionToken, Renderer2, CUSTOM_ELEMENTS_SCHEMA, Directive, ViewContainerRef, viewChildren, booleanAttribute, importProvidersFrom, LOCALE_ID, numberAttribute } from '@angular/core';
|
|
3
3
|
import { provideDateFnsAdapter } from '@angular/material-date-fns-adapter';
|
|
4
4
|
import { MAT_DATE_LOCALE, DateAdapter } from '@angular/material/core';
|
|
5
5
|
import * as i1$3 from '@angular/material/datepicker';
|
|
@@ -7,7 +7,7 @@ import { MatDatepickerIntl, MatDatepickerModule } from '@angular/material/datepi
|
|
|
7
7
|
import * as i1 from '@gov-design-system-ce/angular';
|
|
8
8
|
import { GovButton, GovDesignSystemModule, GovFormCheckbox } from '@gov-design-system-ce/angular';
|
|
9
9
|
import { RdtButtonBase, RDT_BUTTON_BASE_PROVIDER } from '@ngrdt/button';
|
|
10
|
-
import { RdtTranslateService, RdtAutoFocusOnInitDirective, RdtTranslatePipe, RDT_NOTIFICATION_SERVICE_PROVIDER } from '@ngrdt/core';
|
|
10
|
+
import { RdtTranslateService, RdtAutoFocusOnInitDirective, RdtTranslatePipe, RDT_NOTIFICATION_SERVICE_PROVIDER, RDT_DIALOG_SERVICE_PROVIDER } from '@ngrdt/core';
|
|
11
11
|
import { RdtCheckboxComponent, RdtFormErrorPipe, RdtNumericInputComponent, RdtBaseFormInputComponent, RdtSelectOfflineDatasourceProviderDirective, RdtBaseSelectCommonComponent, RdtSelectOptionDirective, RdtSelectStore, RdtSingleSelectComponent, RDT_CHECKBOX_BASE_PROVIDER, RDT_NUMERIC_INPUT_BASE_PROVIDER, RDT_SELECT_BASE_PROVIDER, defaultRdtFormErrorCodes, RDT_FORM_ERROR_CODES_PROVIDER, RdtDateComponent, RdtTextInputComponent } from '@ngrdt/forms';
|
|
12
12
|
import { RdtIconOutletDirective, RdtIcon, RdtIconComponent, RDT_ICON_BASE_PROVIDER, RDT_ICON_REGISTRY_PROVIDER } from '@ngrdt/icon';
|
|
13
13
|
import { RdtSpinnerComponent, RDT_SPINNER_BASE_PROVIDER } from '@ngrdt/loading';
|
|
@@ -16,10 +16,10 @@ import { NgTemplateOutlet, CommonModule } from '@angular/common';
|
|
|
16
16
|
import { RouterLink } from '@angular/router';
|
|
17
17
|
import * as i1$2 from '@angular/forms';
|
|
18
18
|
import { NG_VALUE_ACCESSOR, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
19
|
-
import { ReplaySubject, Subject,
|
|
19
|
+
import { ReplaySubject, Subject, map, fromEvent, filter, throttleTime, animationFrameScheduler } from 'rxjs';
|
|
20
|
+
import { CdkDrag } from '@angular/cdk/drag-drop';
|
|
20
21
|
import { Overlay } from '@angular/cdk/overlay';
|
|
21
22
|
import { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
|
|
22
|
-
import { CdkDrag } from '@angular/cdk/drag-drop';
|
|
23
23
|
import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
|
|
24
24
|
import { TAB, ENTER } from '@angular/cdk/keycodes';
|
|
25
25
|
import { defineCustomElements } from '@gov-design-system-ce/components/loader';
|
|
@@ -202,20 +202,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImpor
|
|
|
202
202
|
}] });
|
|
203
203
|
|
|
204
204
|
class RdtGovDialogRef {
|
|
205
|
-
|
|
205
|
+
component;
|
|
206
|
+
injector;
|
|
207
|
+
minHeight;
|
|
208
|
+
maxHeight;
|
|
209
|
+
minWidth;
|
|
210
|
+
maxWidth;
|
|
211
|
+
size;
|
|
212
|
+
hasBackdrop;
|
|
213
|
+
isDraggable;
|
|
214
|
+
isResizable;
|
|
206
215
|
_close$ = new ReplaySubject(1);
|
|
207
216
|
_open$ = new Subject();
|
|
208
217
|
close$ = this._close$.asObservable();
|
|
209
218
|
open$ = this._open$.asObservable();
|
|
210
|
-
header
|
|
211
|
-
headerIcons
|
|
212
|
-
isLoading
|
|
213
|
-
|
|
214
|
-
isDraggable = signal(false);
|
|
215
|
-
isResizable = signal(false);
|
|
216
|
-
inputData = signal(null);
|
|
219
|
+
header;
|
|
220
|
+
headerIcons;
|
|
221
|
+
isLoading;
|
|
222
|
+
inputData;
|
|
217
223
|
constructor(config) {
|
|
218
|
-
this.
|
|
224
|
+
this.component = config.component;
|
|
225
|
+
this.injector = config.injector;
|
|
226
|
+
this.minHeight = config.minHeight;
|
|
227
|
+
this.maxHeight = config.maxHeight;
|
|
228
|
+
this.minWidth = config.minWidth;
|
|
229
|
+
this.maxWidth = config.maxWidth;
|
|
230
|
+
this.size = config.size;
|
|
231
|
+
this.isLoading = signal(config.initialLoading);
|
|
232
|
+
this.hasBackdrop = config.hasBackdrop;
|
|
233
|
+
this.isDraggable = config.isDraggable;
|
|
234
|
+
this.isResizable = config.isResizable;
|
|
235
|
+
this.inputData = signal(config.inputData);
|
|
236
|
+
this.header = signal(config.header ?? null);
|
|
237
|
+
this.headerIcons = signal(config.headerIcons ?? null);
|
|
219
238
|
}
|
|
220
239
|
ready() {
|
|
221
240
|
this._open$.next();
|
|
@@ -240,8 +259,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImpor
|
|
|
240
259
|
class RdtGovDialogHeaderComponent {
|
|
241
260
|
dialogRef = inject(RdtGovDialogRef);
|
|
242
261
|
govIcon = RdtIcon.Close;
|
|
262
|
+
getIconColorDeclaration(color) {
|
|
263
|
+
if (color) {
|
|
264
|
+
return `--icon-color: var(--icon-${color});`;
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
return undefined;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
243
270
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtGovDialogHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
244
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: RdtGovDialogHeaderComponent, isStandalone: true, selector: "rdt-gov-dialog-header", ngImport: i0, template: "<div class=\"gov-dialog__header\">\n <div class=\"gov-dialog__header-left\">\n @let
|
|
271
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: RdtGovDialogHeaderComponent, isStandalone: true, selector: "rdt-gov-dialog-header", ngImport: i0, template: "<div class=\"gov-dialog__header\">\n <div class=\"gov-dialog__header-left\">\n @let icons = dialogRef.headerIcons(); @let iL = icons?.iconStart; @if(iL){\n <span [style]=\"getIconColorDeclaration(icons?.iconStartColor)\">\n <ng-container rdtIconOutlet [inputs]=\"{ name: iL }\"></ng-container>\n </span>\n }\n <h2 class=\"gov-dialog__title\">\n {{ dialogRef.header() }}\n </h2>\n @let rI = icons?.icon; @if(rI){\n <span [style]=\"getIconColorDeclaration(icons?.iconColor)\">\n <ng-container rdtIconOutlet [inputs]=\"{ name: rI }\"> </ng-container>\n </span>\n }\n </div>\n <rdt-gov-button\n appearance=\"base\"\n size=\"l\"\n [expanded]=\"true\"\n [iconStart]=\"govIcon\"\n (click)=\"dialogRef.close()\"\n ></rdt-gov-button>\n</div>\n", dependencies: [{ kind: "ngmodule", type: GovDesignSystemModule }, { kind: "component", type: RdtGovButtonComponent, selector: "rdt-gov-button", inputs: ["appearance", "color", "size", "iconStart", "expanded"] }, { kind: "directive", type: RdtIconOutletDirective, selector: "[rdtIconOutlet]", exportAs: ["rdtIconOutlet"] }] });
|
|
245
272
|
}
|
|
246
273
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtGovDialogHeaderComponent, decorators: [{
|
|
247
274
|
type: Component,
|
|
@@ -249,7 +276,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImpor
|
|
|
249
276
|
GovDesignSystemModule,
|
|
250
277
|
RdtGovButtonComponent,
|
|
251
278
|
RdtIconOutletDirective,
|
|
252
|
-
], template: "<div class=\"gov-dialog__header\">\n <div class=\"gov-dialog__header-left\">\n @let
|
|
279
|
+
], template: "<div class=\"gov-dialog__header\">\n <div class=\"gov-dialog__header-left\">\n @let icons = dialogRef.headerIcons(); @let iL = icons?.iconStart; @if(iL){\n <span [style]=\"getIconColorDeclaration(icons?.iconStartColor)\">\n <ng-container rdtIconOutlet [inputs]=\"{ name: iL }\"></ng-container>\n </span>\n }\n <h2 class=\"gov-dialog__title\">\n {{ dialogRef.header() }}\n </h2>\n @let rI = icons?.icon; @if(rI){\n <span [style]=\"getIconColorDeclaration(icons?.iconColor)\">\n <ng-container rdtIconOutlet [inputs]=\"{ name: rI }\"> </ng-container>\n </span>\n }\n </div>\n <rdt-gov-button\n appearance=\"base\"\n size=\"l\"\n [expanded]=\"true\"\n [iconStart]=\"govIcon\"\n (click)=\"dialogRef.close()\"\n ></rdt-gov-button>\n</div>\n" }]
|
|
253
280
|
}] });
|
|
254
281
|
|
|
255
282
|
class RdtGovSpinnerComponent extends RdtSpinnerComponent {
|
|
@@ -290,204 +317,237 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImpor
|
|
|
290
317
|
args: [{ selector: 'rdt-gov-dialog-loading', imports: [GovDesignSystemModule, RdtGovSpinnerComponent], template: "<div class=\"gov-dialog__loading\">\n <rdt-gov-spinner\n [size]=\"'m'\"\n [messagePosition]=\"'below'\"\n [message]=\"message() ?? 'Loading...'\"\n ></rdt-gov-spinner>\n <div></div>\n</div>\n" }]
|
|
291
318
|
}] });
|
|
292
319
|
|
|
293
|
-
class RdtGovBaseDialog {
|
|
294
|
-
dialogRef = inject(RdtGovDialogRef);
|
|
295
|
-
constructor() {
|
|
296
|
-
this.ready();
|
|
297
|
-
}
|
|
298
|
-
ready() {
|
|
299
|
-
this.dialogRef.ready();
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
const RDT_BASE_DIALOG_PROVIDER = new InjectionToken('RDT_GOV_BASE_DIALOG_PROVIDER');
|
|
304
|
-
const RDT_ALERT_DIALOG_PROVIDER = new InjectionToken('RDT_GOV_ALERT_DIALOG_PROVIDER');
|
|
305
|
-
const RDT_CONFIRM_DIALOG_PROVIDER = new InjectionToken('RDT_GOV_CONFIRM_DIALOG_PROVIDER');
|
|
306
|
-
|
|
307
320
|
class RdtGovDialogComponent {
|
|
308
321
|
dialogRef = inject(RdtGovDialogRef);
|
|
309
|
-
|
|
310
|
-
dialogRefInjector = computed(() => Injector.create({
|
|
322
|
+
dialogRefInjector = Injector.create({
|
|
311
323
|
providers: [{ provide: RdtGovDialogRef, useValue: this.dialogRef }],
|
|
312
|
-
parent: this.dialogRef.
|
|
313
|
-
})
|
|
314
|
-
constructor() {
|
|
315
|
-
const config = this.dialogRef.config();
|
|
316
|
-
const pxBindings = {
|
|
317
|
-
minHeight: '--dialog-min-height',
|
|
318
|
-
minWidth: '--dialog-min-width',
|
|
319
|
-
maxHeight: '--dialog-max-height',
|
|
320
|
-
maxWidth: '--dialog-max-width',
|
|
321
|
-
};
|
|
322
|
-
Object.keys(pxBindings).forEach((prop) => {
|
|
323
|
-
if (this.isPxSize(prop)) {
|
|
324
|
-
const value = config[prop];
|
|
325
|
-
if (value) {
|
|
326
|
-
document.documentElement.style.setProperty(pxBindings[prop], value);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
isPxSize(propname) {
|
|
332
|
-
const size = this.dialogRef.config()[propname];
|
|
333
|
-
return typeof size === 'string' && size.endsWith('px');
|
|
334
|
-
}
|
|
324
|
+
parent: this.dialogRef.injector,
|
|
325
|
+
});
|
|
335
326
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtGovDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
336
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.0", type: RdtGovDialogComponent, isStandalone: true, selector: "rdt-gov-dialog", host: { properties: { "class.fullscreen-modal": "dialogRef.
|
|
327
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.0", type: RdtGovDialogComponent, isStandalone: true, selector: "rdt-gov-dialog", host: { properties: { "class.fullscreen-modal": "dialogRef.size === 'fullscreen'", "style.width": "dialogRef.size", "style.--dialog-min-height": "dialogRef.minHeight", "style.--dialog-max-height": "dialogRef.maxHeight", "style.--dialog-min-width": "dialogRef.minWidth", "style.--dialog-max-width": "dialogRef.maxWidth" } }, ngImport: i0, template: "<div\n class=\"gov-modal__dialog rdt-gov-dialog\"\n cdkDrag\n [cdkDragDisabled]=\"!dialogRef.isDraggable\"\n>\n <ng-container\n *ngComponentOutlet=\"dialogRef.component; injector: dialogRefInjector\"\n ></ng-container>\n</div>\n", styles: [":root{--dialog-min-height: 400px;--dialog-min-width: 400px;--dialog-max-height: 100%;--dialog-max-width: 100%}.fullscreen-modal{width:100vw;height:100vh}.fullscreen-modal .rdt-gov-dialog{padding:1.25rem;height:100%}.gov-dialog__content{flex:1;display:flex;flex-direction:column}.gov-modal__dialog>*{min-width:var(--dialog-min-width);min-height:var(--dialog-min-height);position:relative;display:flex;flex-direction:column;width:100%;height:100%;max-height:var(--dialog-max-height);max-width:var(--dialog-max-width);border-radius:var(--border-radius, var(--corner-radius-s));background:var(--background, var(--background-block-primary));overflow:hidden;pointer-events:auto;box-shadow:0 .5rem 2rem #0000004d}.gov-modal__dialog>* rdt-gov-dialog-content{flex:1;position:relative}.gov-dialog__header{margin-top:0;margin-bottom:0;display:flex;padding:var(--spacing-m) var(--spacing-l);line-height:var(--height-line-l);border-bottom:var(--border-width, .0625rem) solid var(--border-color, var(--border-subtlest));justify-content:space-between;align-items:center}.gov-dialog__header h2{font-size:var(--font-size-body-l);line-height:150%;font-weight:400}.gov-dialog__header-left{display:flex;gap:var(--spacing-m)}.gov-dialog__header-left .warning{color:var(--warning, var(--icon-warning))}.gov-dialog__header-left .error{color:var(--error, var(--icon-error))}.gov-dialog__header-left .success{color:var(--success, var(--icon-success))}.gov-dialog__header-left .neutral{color:var(--neutral, var(--icon-neutral))}.gov-dialog__header-left .primary{color:var(--primary, var(--icon-on-subtle))}.gov-dialog__header-left .secondary{color:var(--secondary, var(--icon-secondary))}rdt-gov-dialog-loading{min-height:calc(var(--dialog-min-height) - 210px);flex:1;display:grid;place-items:center}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"], exportAs: ["ngComponentOutlet"] }, { kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
337
328
|
}
|
|
338
329
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtGovDialogComponent, decorators: [{
|
|
339
330
|
type: Component,
|
|
340
331
|
args: [{ selector: 'rdt-gov-dialog', standalone: true, imports: [CommonModule, CdkDrag], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
341
|
-
'[class.fullscreen-modal]': "dialogRef.
|
|
342
|
-
'[style.width]': '
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
this.dialogRef.close(true);
|
|
349
|
-
}
|
|
350
|
-
get alert() {
|
|
351
|
-
return this.dialogRef.inputData();
|
|
352
|
-
}
|
|
353
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtGovAlertDialog, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
354
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.0", type: RdtGovAlertDialog, isStandalone: true, selector: "rdt-gov-alert-dialog", usesInheritance: true, ngImport: i0, template: "<rdt-gov-dialog-header />\n<rdt-gov-dialog-content>\n <p>{{ alert.message }}</p>\n</rdt-gov-dialog-content>\n<rdt-gov-dialog-footer>\n <rdt-gov-button\n [appearance]=\"alert.okBtn?.appearance ?? 'solid'\"\n [label]=\"alert.okBtn?.text\"\n [size]=\"alert.okBtn?.size ?? 'm'\"\n [iconStart]=\"alert.okBtn?.iconStart\"\n [icon]=\"alert.okBtn?.icon\"\n [color]=\"alert.okBtn?.color ?? 'primary'\"\n [autofocus]=\"alert.okBtn?.isAutofocused ?? true\"\n (click)=\"proceed()\"\n ></rdt-gov-button>\n</rdt-gov-dialog-footer>\n", dependencies: [{ kind: "component", type: RdtGovDialogHeaderComponent, selector: "rdt-gov-dialog-header" }, { kind: "component", type: RdtGovDialogFooterComponent, selector: "rdt-gov-dialog-footer" }, { kind: "component", type: RdtGovDialogContentComponent, selector: "rdt-gov-dialog-content" }, { kind: "component", type: RdtGovButtonComponent, selector: "rdt-gov-button", inputs: ["appearance", "color", "size", "iconStart", "expanded"] }] });
|
|
355
|
-
}
|
|
356
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtGovAlertDialog, decorators: [{
|
|
357
|
-
type: Component,
|
|
358
|
-
args: [{ selector: 'rdt-gov-alert-dialog', imports: [
|
|
359
|
-
RdtGovDialogHeaderComponent,
|
|
360
|
-
RdtGovDialogFooterComponent,
|
|
361
|
-
RdtGovDialogContentComponent,
|
|
362
|
-
RdtGovButtonComponent,
|
|
363
|
-
], template: "<rdt-gov-dialog-header />\n<rdt-gov-dialog-content>\n <p>{{ alert.message }}</p>\n</rdt-gov-dialog-content>\n<rdt-gov-dialog-footer>\n <rdt-gov-button\n [appearance]=\"alert.okBtn?.appearance ?? 'solid'\"\n [label]=\"alert.okBtn?.text\"\n [size]=\"alert.okBtn?.size ?? 'm'\"\n [iconStart]=\"alert.okBtn?.iconStart\"\n [icon]=\"alert.okBtn?.icon\"\n [color]=\"alert.okBtn?.color ?? 'primary'\"\n [autofocus]=\"alert.okBtn?.isAutofocused ?? true\"\n (click)=\"proceed()\"\n ></rdt-gov-button>\n</rdt-gov-dialog-footer>\n" }]
|
|
332
|
+
'[class.fullscreen-modal]': "dialogRef.size === 'fullscreen'",
|
|
333
|
+
'[style.width]': 'dialogRef.size',
|
|
334
|
+
'[style.--dialog-min-height]': 'dialogRef.minHeight',
|
|
335
|
+
'[style.--dialog-max-height]': 'dialogRef.maxHeight',
|
|
336
|
+
'[style.--dialog-min-width]': 'dialogRef.minWidth',
|
|
337
|
+
'[style.--dialog-max-width]': 'dialogRef.maxWidth',
|
|
338
|
+
}, template: "<div\n class=\"gov-modal__dialog rdt-gov-dialog\"\n cdkDrag\n [cdkDragDisabled]=\"!dialogRef.isDraggable\"\n>\n <ng-container\n *ngComponentOutlet=\"dialogRef.component; injector: dialogRefInjector\"\n ></ng-container>\n</div>\n", styles: [":root{--dialog-min-height: 400px;--dialog-min-width: 400px;--dialog-max-height: 100%;--dialog-max-width: 100%}.fullscreen-modal{width:100vw;height:100vh}.fullscreen-modal .rdt-gov-dialog{padding:1.25rem;height:100%}.gov-dialog__content{flex:1;display:flex;flex-direction:column}.gov-modal__dialog>*{min-width:var(--dialog-min-width);min-height:var(--dialog-min-height);position:relative;display:flex;flex-direction:column;width:100%;height:100%;max-height:var(--dialog-max-height);max-width:var(--dialog-max-width);border-radius:var(--border-radius, var(--corner-radius-s));background:var(--background, var(--background-block-primary));overflow:hidden;pointer-events:auto;box-shadow:0 .5rem 2rem #0000004d}.gov-modal__dialog>* rdt-gov-dialog-content{flex:1;position:relative}.gov-dialog__header{margin-top:0;margin-bottom:0;display:flex;padding:var(--spacing-m) var(--spacing-l);line-height:var(--height-line-l);border-bottom:var(--border-width, .0625rem) solid var(--border-color, var(--border-subtlest));justify-content:space-between;align-items:center}.gov-dialog__header h2{font-size:var(--font-size-body-l);line-height:150%;font-weight:400}.gov-dialog__header-left{display:flex;gap:var(--spacing-m)}.gov-dialog__header-left .warning{color:var(--warning, var(--icon-warning))}.gov-dialog__header-left .error{color:var(--error, var(--icon-error))}.gov-dialog__header-left .success{color:var(--success, var(--icon-success))}.gov-dialog__header-left .neutral{color:var(--neutral, var(--icon-neutral))}.gov-dialog__header-left .primary{color:var(--primary, var(--icon-on-subtle))}.gov-dialog__header-left .secondary{color:var(--secondary, var(--icon-secondary))}rdt-gov-dialog-loading{min-height:calc(var(--dialog-min-height) - 210px);flex:1;display:grid;place-items:center}\n"] }]
|
|
364
339
|
}] });
|
|
365
340
|
|
|
366
|
-
class
|
|
367
|
-
|
|
368
|
-
|
|
341
|
+
class RdtGovDialogBase {
|
|
342
|
+
dialogRef = inject(RdtGovDialogRef);
|
|
343
|
+
constructor() {
|
|
344
|
+
this.ready();
|
|
369
345
|
}
|
|
370
|
-
|
|
371
|
-
this.dialogRef.
|
|
346
|
+
ready() {
|
|
347
|
+
this.dialogRef.ready();
|
|
372
348
|
}
|
|
373
|
-
|
|
374
|
-
|
|
349
|
+
close(data) {
|
|
350
|
+
this.dialogRef.close(data);
|
|
375
351
|
}
|
|
376
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtGovConfirmDialog, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
377
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.0", type: RdtGovConfirmDialog, isStandalone: true, selector: "rdt-gov-confirm-dialog", usesInheritance: true, ngImport: i0, template: "<rdt-gov-dialog-header />\n<rdt-gov-dialog-content>\n <p>{{ confirm.message }}</p>\n</rdt-gov-dialog-content>\n<rdt-gov-dialog-footer>\n <rdt-gov-button\n [appearance]=\"confirm.noBtn?.appearance ?? 'outlined'\"\n [label]=\"confirm.noBtn?.text\"\n [size]=\"confirm.noBtn?.size ?? 'm'\"\n [color]=\"confirm.noBtn?.color ?? 'primary'\"\n [icon]=\"confirm.noBtn?.icon\"\n [iconStart]=\"confirm.noBtn?.iconStart\"\n [autofocus]=\"\n confirm.noBtn?.isAutofocused ?? confirm.yesBtn?.isAutofocused\n ? false\n : true\n \"\n (click)=\"abort()\"\n ></rdt-gov-button>\n <rdt-gov-button\n [appearance]=\"confirm.yesBtn?.appearance ?? 'solid'\"\n [label]=\"confirm.yesBtn?.text\"\n [size]=\"confirm.yesBtn?.size ?? 'm'\"\n [icon]=\"confirm.yesBtn?.icon\"\n [iconStart]=\"confirm.yesBtn?.iconStart\"\n [color]=\"confirm.yesBtn?.color ?? 'primary'\"\n [autofocus]=\"confirm.yesBtn?.isAutofocused ?? false\"\n (click)=\"proceed()\"\n ></rdt-gov-button>\n</rdt-gov-dialog-footer>\n", dependencies: [{ kind: "component", type: RdtGovDialogHeaderComponent, selector: "rdt-gov-dialog-header" }, { kind: "component", type: RdtGovDialogFooterComponent, selector: "rdt-gov-dialog-footer" }, { kind: "component", type: RdtGovDialogContentComponent, selector: "rdt-gov-dialog-content" }, { kind: "component", type: RdtGovButtonComponent, selector: "rdt-gov-button", inputs: ["appearance", "color", "size", "iconStart", "expanded"] }] });
|
|
378
352
|
}
|
|
379
|
-
|
|
353
|
+
|
|
354
|
+
class RdtGovStandardDialogComponent extends RdtGovDialogBase {
|
|
355
|
+
message = computed(() => this.dialogRef.inputData().message);
|
|
356
|
+
buttons = computed(() => this.dialogRef.inputData().buttons);
|
|
357
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtGovStandardDialogComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
358
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: RdtGovStandardDialogComponent, isStandalone: true, selector: "rdt-gov-standard-dialog", usesInheritance: true, ngImport: i0, template: "<rdt-gov-dialog-header />\n<rdt-gov-dialog-content>\n <p>{{ message() }}</p>\n</rdt-gov-dialog-content>\n<rdt-gov-dialog-footer>\n @for (button of buttons(); track button.label) {\n <rdt-gov-button\n [appearance]=\"button.appearance\"\n [label]=\"button.label\"\n [size]=\"button.size\"\n [color]=\"button.color\"\n [icon]=\"button.icon\"\n [iconStart]=\"button.iconStart\"\n [autofocus]=\"button.isAutofocused\"\n (click)=\"close(button.value)\"\n />\n }\n</rdt-gov-dialog-footer>\n", dependencies: [{ kind: "component", type: RdtGovDialogHeaderComponent, selector: "rdt-gov-dialog-header" }, { kind: "component", type: RdtGovDialogFooterComponent, selector: "rdt-gov-dialog-footer" }, { kind: "component", type: RdtGovDialogContentComponent, selector: "rdt-gov-dialog-content" }, { kind: "component", type: RdtGovButtonComponent, selector: "rdt-gov-button", inputs: ["appearance", "color", "size", "iconStart", "expanded"] }] });
|
|
359
|
+
}
|
|
360
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtGovStandardDialogComponent, decorators: [{
|
|
380
361
|
type: Component,
|
|
381
|
-
args: [{ selector: 'rdt-gov-
|
|
362
|
+
args: [{ selector: 'rdt-gov-standard-dialog', imports: [
|
|
382
363
|
RdtGovDialogHeaderComponent,
|
|
383
364
|
RdtGovDialogFooterComponent,
|
|
384
365
|
RdtGovDialogContentComponent,
|
|
385
366
|
RdtGovButtonComponent,
|
|
386
|
-
], template: "<rdt-gov-dialog-header />\n<rdt-gov-dialog-content>\n <p>{{
|
|
367
|
+
], template: "<rdt-gov-dialog-header />\n<rdt-gov-dialog-content>\n <p>{{ message() }}</p>\n</rdt-gov-dialog-content>\n<rdt-gov-dialog-footer>\n @for (button of buttons(); track button.label) {\n <rdt-gov-button\n [appearance]=\"button.appearance\"\n [label]=\"button.label\"\n [size]=\"button.size\"\n [color]=\"button.color\"\n [icon]=\"button.icon\"\n [iconStart]=\"button.iconStart\"\n [autofocus]=\"button.isAutofocused\"\n (click)=\"close(button.value)\"\n />\n }\n</rdt-gov-dialog-footer>\n" }]
|
|
387
368
|
}] });
|
|
388
369
|
|
|
370
|
+
const RDT_GOV_BASE_DIALOG_CONFIG_PROVIDER = new InjectionToken('RDT_GOV_BASE_DIALOG_CONFIG_PROVIDER');
|
|
371
|
+
const RDT_GOV_ALERT_DIALOG_CONFIG_PROVIDER = new InjectionToken('RDT_GOV_ALERT_DIALOG_CONFIG_PROVIDER');
|
|
372
|
+
const RDT_GOV_CONFIRM_DIALOG_CONFIG_PROVIDER = new InjectionToken('RDT_GOV_CONFIRM_DIALOG_CONFIG_PROVIDER');
|
|
373
|
+
|
|
374
|
+
const RDT_GOV_DIALOG_DEFAULT_DATA = {
|
|
375
|
+
size: 'content',
|
|
376
|
+
initialLoading: false,
|
|
377
|
+
hasBackdrop: true,
|
|
378
|
+
isDraggable: false,
|
|
379
|
+
isResizable: false,
|
|
380
|
+
minWidth: undefined,
|
|
381
|
+
maxWidth: undefined,
|
|
382
|
+
minHeight: undefined,
|
|
383
|
+
maxHeight: undefined,
|
|
384
|
+
header: undefined,
|
|
385
|
+
headerIcons: undefined,
|
|
386
|
+
injector: undefined,
|
|
387
|
+
inputData: undefined,
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
const RDT_GOV_DIALOG_DEFAULT_BUTTON = {
|
|
391
|
+
icon: undefined,
|
|
392
|
+
iconStart: undefined,
|
|
393
|
+
size: 's',
|
|
394
|
+
color: 'primary',
|
|
395
|
+
appearance: 'outlined',
|
|
396
|
+
isAutofocused: false,
|
|
397
|
+
value: undefined,
|
|
398
|
+
};
|
|
399
|
+
const RDT_GOV_DIALOG_OK_BUTTON = {
|
|
400
|
+
...RDT_GOV_DIALOG_DEFAULT_BUTTON,
|
|
401
|
+
appearance: 'solid',
|
|
402
|
+
isAutofocused: true,
|
|
403
|
+
value: undefined,
|
|
404
|
+
};
|
|
405
|
+
const RDT_GOV_DIALOG_YES_BUTTON = {
|
|
406
|
+
...RDT_GOV_DIALOG_DEFAULT_BUTTON,
|
|
407
|
+
appearance: 'solid',
|
|
408
|
+
isAutofocused: true,
|
|
409
|
+
value: true,
|
|
410
|
+
};
|
|
411
|
+
const RDT_GOV_DIALOG_NO_BUTTON = {
|
|
412
|
+
...RDT_GOV_DIALOG_DEFAULT_BUTTON,
|
|
413
|
+
value: false,
|
|
414
|
+
};
|
|
415
|
+
|
|
389
416
|
class RdtGovDialogService {
|
|
390
417
|
overlay = inject(Overlay);
|
|
391
|
-
|
|
418
|
+
t = inject(RdtTranslateService);
|
|
419
|
+
confirmDefaults = inject(RDT_GOV_CONFIRM_DIALOG_CONFIG_PROVIDER, {
|
|
392
420
|
optional: true,
|
|
393
421
|
});
|
|
394
|
-
alertDefaults = inject(
|
|
422
|
+
alertDefaults = inject(RDT_GOV_ALERT_DIALOG_CONFIG_PROVIDER, {
|
|
395
423
|
optional: true,
|
|
396
424
|
});
|
|
397
|
-
baseDefaults = inject(
|
|
425
|
+
baseDefaults = inject(RDT_GOV_BASE_DIALOG_CONFIG_PROVIDER, {
|
|
398
426
|
optional: true,
|
|
399
427
|
});
|
|
400
428
|
open(config) {
|
|
401
|
-
const
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
console.log(config, mergedConfig);
|
|
406
|
-
const overlayRef = this.overlay.create(this.getOverlayConfig(mergedConfig));
|
|
407
|
-
const dialogRef = new RdtGovDialogRef(mergedConfig);
|
|
408
|
-
dialogRef.header.set(mergedConfig.header ?? null);
|
|
409
|
-
dialogRef.headerIcons.set(mergedConfig.headerIcons ?? null);
|
|
410
|
-
dialogRef.hasBackdrop.set(mergedConfig.hasBackdrop ?? true);
|
|
411
|
-
dialogRef.isDraggable.set(mergedConfig.isDraggable ?? true);
|
|
412
|
-
dialogRef.isResizable.set(mergedConfig.isResizable ?? true);
|
|
413
|
-
dialogRef.inputData.set(mergedConfig.inputData);
|
|
414
|
-
const portal = new ComponentPortal(RdtGovDialogComponent, null, Injector.create({
|
|
415
|
-
providers: [{ provide: RdtGovDialogRef, useValue: dialogRef }],
|
|
416
|
-
parent: mergedConfig.injector,
|
|
417
|
-
}));
|
|
429
|
+
const dialogData = this.getDialogData(config);
|
|
430
|
+
const dialogRef = new RdtGovDialogRef(dialogData);
|
|
431
|
+
const overlayRef = this.createOverlayRef(dialogRef);
|
|
432
|
+
const portal = this.createComponentPortal(dialogRef);
|
|
418
433
|
overlayRef.attach(portal);
|
|
419
|
-
|
|
420
|
-
dialogRef.isLoading.set(mergedConfig.initialLoading);
|
|
421
|
-
}
|
|
422
|
-
dialogRef.open$.pipe(take(1)).subscribe(() => {
|
|
423
|
-
dialogRef.isLoading.set(false);
|
|
424
|
-
});
|
|
425
|
-
dialogRef.close$.subscribe(() => {
|
|
426
|
-
overlayRef.dispose();
|
|
427
|
-
});
|
|
434
|
+
dialogRef.close$.subscribe(() => overlayRef.dispose());
|
|
428
435
|
return dialogRef;
|
|
429
436
|
}
|
|
437
|
+
openStandard(config) {
|
|
438
|
+
const dialogConfig = this.getDialogDataFromStandardConfig(config);
|
|
439
|
+
return this.open(dialogConfig);
|
|
440
|
+
}
|
|
430
441
|
alert(config) {
|
|
431
|
-
const
|
|
442
|
+
const defaultLabel = this.t.instant('RDT_OK');
|
|
443
|
+
const okBtn = {
|
|
444
|
+
...RDT_GOV_DIALOG_OK_BUTTON,
|
|
445
|
+
label: defaultLabel,
|
|
446
|
+
...this.alertDefaults?.okBtn,
|
|
447
|
+
...config.okBtn,
|
|
448
|
+
};
|
|
449
|
+
if (!okBtn.label) {
|
|
450
|
+
okBtn.label = defaultLabel;
|
|
451
|
+
}
|
|
452
|
+
const alertConfig = {
|
|
432
453
|
...this.alertDefaults,
|
|
433
454
|
...config,
|
|
455
|
+
buttons: [okBtn],
|
|
434
456
|
};
|
|
435
|
-
|
|
436
|
-
component: RdtGovAlertDialog,
|
|
437
|
-
header: mergedConfig.header,
|
|
438
|
-
headerIcons: mergedConfig.headerIcons,
|
|
439
|
-
inputData: mergedConfig,
|
|
440
|
-
minHeight: mergedConfig.minHeight,
|
|
441
|
-
maxHeight: mergedConfig.maxHeight,
|
|
442
|
-
maxWidth: mergedConfig.maxWidth,
|
|
443
|
-
minWidth: mergedConfig.minWidth,
|
|
444
|
-
};
|
|
445
|
-
if (dialogConfig.inputData && !dialogConfig.inputData.okBtn) {
|
|
446
|
-
dialogConfig.inputData.okBtn = {
|
|
447
|
-
text: 'OK',
|
|
448
|
-
};
|
|
449
|
-
}
|
|
450
|
-
return this.open(this.parseInternalConfig(dialogConfig));
|
|
457
|
+
return this.openStandard(alertConfig);
|
|
451
458
|
}
|
|
452
459
|
confirm(config) {
|
|
453
|
-
const
|
|
454
|
-
|
|
455
|
-
|
|
460
|
+
const defaultYesLabel = this.t.instant('RDT_YES');
|
|
461
|
+
const defaultNoLabel = this.t.instant('RDT_NO');
|
|
462
|
+
const yesBtn = {
|
|
463
|
+
...RDT_GOV_DIALOG_YES_BUTTON,
|
|
464
|
+
label: defaultYesLabel,
|
|
465
|
+
...this.confirmDefaults?.yesBtn,
|
|
466
|
+
...config.yesBtn,
|
|
456
467
|
};
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
minWidth: mergedConfig.minWidth,
|
|
468
|
+
if (!yesBtn.label) {
|
|
469
|
+
yesBtn.label = defaultYesLabel;
|
|
470
|
+
}
|
|
471
|
+
const noBtn = {
|
|
472
|
+
...RDT_GOV_DIALOG_NO_BUTTON,
|
|
473
|
+
label: defaultNoLabel,
|
|
474
|
+
...this.confirmDefaults?.noBtn,
|
|
475
|
+
...config.noBtn,
|
|
466
476
|
};
|
|
467
|
-
if (
|
|
468
|
-
|
|
469
|
-
text: 'Ano',
|
|
470
|
-
};
|
|
477
|
+
if (!noBtn.label) {
|
|
478
|
+
noBtn.label = defaultNoLabel;
|
|
471
479
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
480
|
+
const confirmConfig = {
|
|
481
|
+
...this.confirmDefaults,
|
|
482
|
+
...config,
|
|
483
|
+
buttons: [yesBtn, noBtn],
|
|
484
|
+
};
|
|
485
|
+
return this.openStandard(confirmConfig);
|
|
486
|
+
}
|
|
487
|
+
simpleAlert(config) {
|
|
488
|
+
return this.alert({
|
|
489
|
+
header: config.header,
|
|
490
|
+
message: config.message,
|
|
491
|
+
okBtn: {
|
|
492
|
+
label: config.okButtonLabel,
|
|
493
|
+
},
|
|
494
|
+
}).close$;
|
|
495
|
+
}
|
|
496
|
+
simpleConfirm(config) {
|
|
497
|
+
return this.confirm({
|
|
498
|
+
header: config.header,
|
|
499
|
+
message: config.message,
|
|
500
|
+
yesBtn: {
|
|
501
|
+
label: config.yesButtonLabel,
|
|
502
|
+
},
|
|
503
|
+
noBtn: {
|
|
504
|
+
label: config.noButtonLabel,
|
|
505
|
+
},
|
|
506
|
+
}).close$.pipe(map(Boolean));
|
|
507
|
+
}
|
|
508
|
+
getButtons(buttons, defaultButton = RDT_GOV_DIALOG_DEFAULT_BUTTON) {
|
|
509
|
+
const mapped = buttons?.map((btn) => ({ ...defaultButton, ...btn })) ?? [];
|
|
510
|
+
for (let autofocusExists = false, i = 0; i < mapped.length; i++) {
|
|
511
|
+
if (mapped[i].isAutofocused) {
|
|
512
|
+
if (!autofocusExists) {
|
|
513
|
+
autofocusExists = true;
|
|
514
|
+
}
|
|
515
|
+
else {
|
|
516
|
+
mapped[i].isAutofocused = false;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
476
519
|
}
|
|
477
|
-
return
|
|
520
|
+
return mapped;
|
|
478
521
|
}
|
|
479
|
-
|
|
480
|
-
|
|
522
|
+
getDialogDataFromStandardConfig(config) {
|
|
523
|
+
return {
|
|
524
|
+
...RDT_GOV_DIALOG_DEFAULT_DATA,
|
|
525
|
+
...this.baseDefaults,
|
|
481
526
|
...config,
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
527
|
+
component: RdtGovStandardDialogComponent,
|
|
528
|
+
inputData: {
|
|
529
|
+
message: config.message,
|
|
530
|
+
buttons: this.getButtons(config.buttons, RDT_GOV_DIALOG_DEFAULT_BUTTON),
|
|
531
|
+
},
|
|
485
532
|
};
|
|
486
|
-
return filled;
|
|
487
533
|
}
|
|
488
|
-
|
|
534
|
+
getDialogData(cfg) {
|
|
489
535
|
return {
|
|
490
|
-
|
|
536
|
+
...RDT_GOV_DIALOG_DEFAULT_DATA,
|
|
537
|
+
...this.baseDefaults,
|
|
538
|
+
...cfg,
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
createComponentPortal(dialogRef) {
|
|
542
|
+
const injector = Injector.create({
|
|
543
|
+
providers: [{ provide: RdtGovDialogRef, useValue: dialogRef }],
|
|
544
|
+
parent: dialogRef.injector,
|
|
545
|
+
});
|
|
546
|
+
return new ComponentPortal(RdtGovDialogComponent, null, injector);
|
|
547
|
+
}
|
|
548
|
+
createOverlayRef(config) {
|
|
549
|
+
const overlayConfig = {
|
|
550
|
+
hasBackdrop: config.hasBackdrop,
|
|
491
551
|
backdropClass: 'cdk-overlay-dark-backdrop',
|
|
492
552
|
positionStrategy: this.overlay
|
|
493
553
|
.position()
|
|
@@ -497,6 +557,7 @@ class RdtGovDialogService {
|
|
|
497
557
|
scrollStrategy: this.overlay.scrollStrategies.block(),
|
|
498
558
|
disposeOnNavigation: true,
|
|
499
559
|
};
|
|
560
|
+
return this.overlay.create(overlayConfig);
|
|
500
561
|
}
|
|
501
562
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtGovDialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
502
563
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtGovDialogService, providedIn: 'root' });
|
|
@@ -507,8 +568,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImpor
|
|
|
507
568
|
}] });
|
|
508
569
|
|
|
509
570
|
class RdtGovIconComponent extends RdtIconComponent {
|
|
510
|
-
size = input('
|
|
511
|
-
color = input(
|
|
571
|
+
size = input('s');
|
|
572
|
+
color = input();
|
|
512
573
|
parsed = computed(() => {
|
|
513
574
|
const value = this.name() || '';
|
|
514
575
|
const [type, name] = value.split('/');
|
|
@@ -518,11 +579,14 @@ class RdtGovIconComponent extends RdtIconComponent {
|
|
|
518
579
|
return this.parsed().type === 'bs';
|
|
519
580
|
});
|
|
520
581
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtGovIconComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
521
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: RdtGovIconComponent, isStandalone: true, selector: "rdt-gov-icon", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "@let p = parsed(); @if (
|
|
582
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: RdtGovIconComponent, isStandalone: true, selector: "rdt-gov-icon", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.size": "size()" }, classAttribute: "gov-icon" }, usesInheritance: true, ngImport: i0, template: "@let p = parsed(); @if (isBootstrapIcon()) {\n<i\n class=\"bi bi-{{ p.name }} gov-icon\"\n [attr.size]=\"size()\"\n [attr.color]=\"color()\"\n></i>\n} @else {\n<gov-icon\n [type]=\"p.type\"\n [name]=\"p.name\"\n [size]=\"size()\"\n [color]=\"color()\"\n></gov-icon>\n}\n", styles: [":host{vertical-align:middle}gov-icon{color:var(--icon-color, currentColor)}i.bi:before{vertical-align:.125em;font-size:var(--icon-size, 1rem);color:var(--icon-color, currentColor)}i.bi[size=xs]:before{font-size:var(--icon-size, var(--icon-size-xs))}i.bi[size=s]:before{font-size:var(--icon-size, var(--icon-size-s))}i.bi[size=m]:before{font-size:var(--icon-size, var(--icon-size-m))}i.bi[size=l]:before{font-size:var(--icon-size, var(--icon-size-l))}i.bi[size=xl]:before{font-size:var(--icon-size, var(--icon-size-xl))}i.bi[color=primary]:before{color:var(--primary, var(--icon-on-subtle))}i.bi[color=secondary]:before{color:var(--secondary, var(--icon-secondary))}i.bi[color=success]:before{color:var(--success, var(--icon-success))}i.bi[color=warning]:before{color:var(--warning, var(--icon-warning))}i.bi[color=error]:before{color:var(--error, var(--icon-error))}\n"], dependencies: [{ kind: "ngmodule", type: GovDesignSystemModule }, { kind: "component", type: i1.GovIcon, selector: "gov-icon", inputs: ["color", "name", "size", "type"] }, { kind: "ngmodule", type: CommonModule }] });
|
|
522
583
|
}
|
|
523
584
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtGovIconComponent, decorators: [{
|
|
524
585
|
type: Component,
|
|
525
|
-
args: [{ selector: 'rdt-gov-icon', imports: [GovDesignSystemModule, CommonModule],
|
|
586
|
+
args: [{ selector: 'rdt-gov-icon', imports: [GovDesignSystemModule, CommonModule], host: {
|
|
587
|
+
class: 'gov-icon',
|
|
588
|
+
'[attr.size]': 'size()',
|
|
589
|
+
}, template: "@let p = parsed(); @if (isBootstrapIcon()) {\n<i\n class=\"bi bi-{{ p.name }} gov-icon\"\n [attr.size]=\"size()\"\n [attr.color]=\"color()\"\n></i>\n} @else {\n<gov-icon\n [type]=\"p.type\"\n [name]=\"p.name\"\n [size]=\"size()\"\n [color]=\"color()\"\n></gov-icon>\n}\n", styles: [":host{vertical-align:middle}gov-icon{color:var(--icon-color, currentColor)}i.bi:before{vertical-align:.125em;font-size:var(--icon-size, 1rem);color:var(--icon-color, currentColor)}i.bi[size=xs]:before{font-size:var(--icon-size, var(--icon-size-xs))}i.bi[size=s]:before{font-size:var(--icon-size, var(--icon-size-s))}i.bi[size=m]:before{font-size:var(--icon-size, var(--icon-size-m))}i.bi[size=l]:before{font-size:var(--icon-size, var(--icon-size-l))}i.bi[size=xl]:before{font-size:var(--icon-size, var(--icon-size-xl))}i.bi[color=primary]:before{color:var(--primary, var(--icon-on-subtle))}i.bi[color=secondary]:before{color:var(--secondary, var(--icon-secondary))}i.bi[color=success]:before{color:var(--success, var(--icon-success))}i.bi[color=warning]:before{color:var(--warning, var(--icon-warning))}i.bi[color=error]:before{color:var(--error, var(--icon-error))}\n"] }]
|
|
526
590
|
}] });
|
|
527
591
|
|
|
528
592
|
const RDT_GOV_NOTIFICATION_DEFAULT_CONFIG = {
|
|
@@ -550,11 +614,11 @@ const RDT_GOV_NOTIFICATION_DATA_PROVIDER = new InjectionToken('RDT_GOV_NOTIFICAT
|
|
|
550
614
|
class RdtGovNotificationPopupComponent {
|
|
551
615
|
data = inject(RDT_GOV_NOTIFICATION_DATA_PROVIDER);
|
|
552
616
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtGovNotificationPopupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
553
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: RdtGovNotificationPopupComponent, isStandalone: true, selector: "rdt-gov-notification-popup", ngImport: i0, template: "@if(data){\n<gov-toast\n [color]=\"data.color\"\n [gravity]=\"data.positionVert\"\n [position]=\"data.positionHoriz\"\n [type]=\"data.type\"\n [closeLabel]=\"data.closeLabel\"\n
|
|
617
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: RdtGovNotificationPopupComponent, isStandalone: true, selector: "rdt-gov-notification-popup", ngImport: i0, template: "@if(data){\n<gov-toast\n [color]=\"data.color\"\n [gravity]=\"data.positionVert\"\n [position]=\"data.positionHoriz\"\n [type]=\"data.type\"\n [closeLabel]=\"data.closeLabel\"\n>\n <div class=\"toast-wrapper\">\n @if (data.icon) {\n <span class=\"toast-icon\">\n <ng-container rdtIconOutlet [inputs]=\"{ name: data.icon }\"></ng-container>\n </span>\n }\n <div>\n @if(data.header) {\n <span class=\"toast-header\">{{ data.header }}</span>\n }\n <span>{{ data.message }}</span>\n </div>\n </div>\n</gov-toast>\n}\n", styles: [".toast-wrapper{display:flex;gap:var(--spacing-s-nudge);align-items:center}.toast-header{font-weight:500}\n"], dependencies: [{ kind: "ngmodule", type: GovDesignSystemModule }, { kind: "component", type: i1.GovToast, selector: "gov-toast", inputs: ["accessibleCloseLabel", "closeLabel", "color", "gravity", "position", "time", "type"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: RdtIconOutletDirective, selector: "[rdtIconOutlet]", exportAs: ["rdtIconOutlet"] }] });
|
|
554
618
|
}
|
|
555
619
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtGovNotificationPopupComponent, decorators: [{
|
|
556
620
|
type: Component,
|
|
557
|
-
args: [{ selector: 'rdt-gov-notification-popup', imports: [GovDesignSystemModule, CommonModule, RdtIconOutletDirective], template: "@if(data){\n<gov-toast\n [color]=\"data.color\"\n [gravity]=\"data.positionVert\"\n [position]=\"data.positionHoriz\"\n [type]=\"data.type\"\n [closeLabel]=\"data.closeLabel\"\n
|
|
621
|
+
args: [{ selector: 'rdt-gov-notification-popup', imports: [GovDesignSystemModule, CommonModule, RdtIconOutletDirective], template: "@if(data){\n<gov-toast\n [color]=\"data.color\"\n [gravity]=\"data.positionVert\"\n [position]=\"data.positionHoriz\"\n [type]=\"data.type\"\n [closeLabel]=\"data.closeLabel\"\n>\n <div class=\"toast-wrapper\">\n @if (data.icon) {\n <span class=\"toast-icon\">\n <ng-container rdtIconOutlet [inputs]=\"{ name: data.icon }\"></ng-container>\n </span>\n }\n <div>\n @if(data.header) {\n <span class=\"toast-header\">{{ data.header }}</span>\n }\n <span>{{ data.message }}</span>\n </div>\n </div>\n</gov-toast>\n}\n", styles: [".toast-wrapper{display:flex;gap:var(--spacing-s-nudge);align-items:center}.toast-header{font-weight:500}\n"] }]
|
|
558
622
|
}] });
|
|
559
623
|
|
|
560
624
|
class RdtGovNotificationService {
|
|
@@ -572,13 +636,21 @@ class RdtGovNotificationService {
|
|
|
572
636
|
setTimeout(() => this.close(overlayRef), cfg.duration);
|
|
573
637
|
}
|
|
574
638
|
success(message = this.t.instant('RDT_GOV_NOTIFY_SUCCESS')) {
|
|
575
|
-
this.
|
|
639
|
+
this.showSimple('success', message);
|
|
576
640
|
}
|
|
577
641
|
warn(message = this.t.instant('RDT_GOV_NOTIFY_WARNING')) {
|
|
578
|
-
this.
|
|
642
|
+
this.showSimple('warning', message);
|
|
579
643
|
}
|
|
580
644
|
error(message = this.t.instant('RDT_GOV_NOTIFY_ERROR')) {
|
|
581
|
-
this.
|
|
645
|
+
this.showSimple('error', message);
|
|
646
|
+
}
|
|
647
|
+
showSimple(color, message) {
|
|
648
|
+
if (typeof message === 'object') {
|
|
649
|
+
this.show({ color, ...message });
|
|
650
|
+
}
|
|
651
|
+
else {
|
|
652
|
+
this.show({ color, message });
|
|
653
|
+
}
|
|
582
654
|
}
|
|
583
655
|
mergeConfig(cfg) {
|
|
584
656
|
return {
|
|
@@ -1097,19 +1169,23 @@ function provideNgrdtGov(options = {}) {
|
|
|
1097
1169
|
useFactory: () => inject(RdtGovNotificationService),
|
|
1098
1170
|
},
|
|
1099
1171
|
{
|
|
1100
|
-
provide:
|
|
1172
|
+
provide: RDT_DIALOG_SERVICE_PROVIDER,
|
|
1173
|
+
useFactory: () => inject(RdtGovDialogService),
|
|
1174
|
+
},
|
|
1175
|
+
{
|
|
1176
|
+
provide: RDT_GOV_ALERT_DIALOG_CONFIG_PROVIDER,
|
|
1101
1177
|
useValue: {
|
|
1102
1178
|
minHeight: '250px',
|
|
1103
1179
|
},
|
|
1104
1180
|
},
|
|
1105
1181
|
{
|
|
1106
|
-
provide:
|
|
1182
|
+
provide: RDT_GOV_CONFIRM_DIALOG_CONFIG_PROVIDER,
|
|
1107
1183
|
useValue: {
|
|
1108
1184
|
minHeight: '250px',
|
|
1109
1185
|
},
|
|
1110
1186
|
},
|
|
1111
1187
|
{
|
|
1112
|
-
provide:
|
|
1188
|
+
provide: RDT_GOV_BASE_DIALOG_CONFIG_PROVIDER,
|
|
1113
1189
|
useValue: {
|
|
1114
1190
|
isDraggable: false,
|
|
1115
1191
|
minHeight: '400px',
|
|
@@ -1532,5 +1608,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImpor
|
|
|
1532
1608
|
* Generated bundle index. Do not edit.
|
|
1533
1609
|
*/
|
|
1534
1610
|
|
|
1535
|
-
export { DEFAULT_GOV_BUTTON_COLOR, DEFAULT_GOV_BUTTON_SIZE, DEFAULT_GOV_BUTTON_TYPE,
|
|
1611
|
+
export { DEFAULT_GOV_BUTTON_COLOR, DEFAULT_GOV_BUTTON_SIZE, DEFAULT_GOV_BUTTON_TYPE, RDT_GOV_ALERT_DIALOG_CONFIG_PROVIDER, RDT_GOV_BASE_DIALOG_CONFIG_PROVIDER, RDT_GOV_CONFIRM_DIALOG_CONFIG_PROVIDER, RDT_GOV_NOTIFICATION_CONFIG_PROVIDER, RDT_GOV_NOTIFICATION_DEFAULT_CONFIG, RdtGovButtonComponent, RdtGovCheckboxComponent, RdtGovDateComponent, RdtGovDialogBase, RdtGovDialogComponent, RdtGovDialogContentComponent, RdtGovDialogFooterComponent, RdtGovDialogHeaderComponent, RdtGovDialogLoadingComponent, RdtGovDialogRef, RdtGovDialogService, RdtGovIconComponent, RdtGovNotificationService, RdtGovNumberInputComponent, RdtGovSelectComponent, RdtGovSelectOfflineProviderDirective, RdtGovSpinnerComponent, RdtGovStandardDialogComponent, RdtGovTextInputComponent, RdtGovThemeService, forceFocus, initRdtGov, provideNgrdtGov };
|
|
1536
1612
|
//# sourceMappingURL=ngrdt-gov.mjs.map
|