@arsedizioni/ars-utils 22.1.5 → 22.5.2
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/README.md +158 -10
- package/clipper.ui/clipper.scss +564 -0
- package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs +1 -1
- package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs +11 -7
- package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-core.date.mjs +609 -0
- package/fesm2022/arsedizioni-ars-utils-core.date.mjs.map +1 -0
- package/fesm2022/arsedizioni-ars-utils-core.markdown.mjs +591 -0
- package/fesm2022/arsedizioni-ars-utils-core.markdown.mjs.map +1 -0
- package/fesm2022/arsedizioni-ars-utils-core.mjs +270 -1449
- package/fesm2022/arsedizioni-ars-utils-core.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs +1 -1
- package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-support.common.mjs +1 -1
- package/fesm2022/arsedizioni-ars-utils-support.common.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.application.mjs +14 -4108
- package/fesm2022/arsedizioni-ars-utils-ui.application.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.controls.mjs +962 -0
- package/fesm2022/arsedizioni-ars-utils-ui.controls.mjs.map +1 -0
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.auth.mjs +506 -0
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.auth.mjs.map +1 -0
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.mjs +450 -0
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.mjs.map +1 -0
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.prompt.mjs +184 -0
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.prompt.mjs.map +1 -0
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.select.mjs +825 -0
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.select.mjs.map +1 -0
- package/fesm2022/arsedizioni-ars-utils-ui.files.mjs +708 -0
- package/fesm2022/arsedizioni-ars-utils-ui.files.mjs.map +1 -0
- package/fesm2022/arsedizioni-ars-utils-ui.filters.mjs +426 -0
- package/fesm2022/arsedizioni-ars-utils-ui.filters.mjs.map +1 -0
- package/fesm2022/arsedizioni-ars-utils-ui.help.mjs +531 -0
- package/fesm2022/arsedizioni-ars-utils-ui.help.mjs.map +1 -0
- package/fesm2022/arsedizioni-ars-utils-ui.mjs +54 -1227
- package/fesm2022/arsedizioni-ars-utils-ui.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.navigation.mjs +1049 -0
- package/fesm2022/arsedizioni-ars-utils-ui.navigation.mjs.map +1 -0
- package/fesm2022/arsedizioni-ars-utils-ui.notifications.mjs +263 -0
- package/fesm2022/arsedizioni-ars-utils-ui.notifications.mjs.map +1 -0
- package/fesm2022/arsedizioni-ars-utils-ui.oauth.mjs +4 -3
- package/fesm2022/arsedizioni-ars-utils-ui.oauth.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.paginator.mjs +53 -0
- package/fesm2022/arsedizioni-ars-utils-ui.paginator.mjs.map +1 -0
- package/fesm2022/arsedizioni-ars-utils-ui.shell.mjs +517 -0
- package/fesm2022/arsedizioni-ars-utils-ui.shell.mjs.map +1 -0
- package/fesm2022/arsedizioni-ars-utils-ui.tinymce.mjs +246 -0
- package/fesm2022/arsedizioni-ars-utils-ui.tinymce.mjs.map +1 -0
- package/fesm2022/arsedizioni-ars-utils.mjs +13 -12
- package/fesm2022/arsedizioni-ars-utils.mjs.map +1 -1
- package/help/package.json +4 -0
- package/package.json +80 -14
- package/styles/ui.colors.scss +23 -0
- package/support.ui/package.json +4 -0
- package/tinymce/package.json +4 -0
- package/types/arsedizioni-ars-utils-clipper.common.d.ts +1 -2
- package/types/arsedizioni-ars-utils-clipper.ui.d.ts +4 -1
- package/types/arsedizioni-ars-utils-core.d.ts +684 -1004
- package/types/arsedizioni-ars-utils-core.date.d.ts +304 -0
- package/types/arsedizioni-ars-utils-core.markdown.d.ts +159 -0
- package/types/arsedizioni-ars-utils-ui.application.d.ts +10 -2022
- package/types/arsedizioni-ars-utils-ui.controls.d.ts +413 -0
- package/types/arsedizioni-ars-utils-ui.d.ts +183 -566
- package/types/arsedizioni-ars-utils-ui.dialogs.auth.d.ts +224 -0
- package/types/arsedizioni-ars-utils-ui.dialogs.d.ts +228 -0
- package/types/arsedizioni-ars-utils-ui.dialogs.prompt.d.ts +47 -0
- package/types/arsedizioni-ars-utils-ui.dialogs.select.d.ts +309 -0
- package/types/arsedizioni-ars-utils-ui.files.d.ts +271 -0
- package/types/arsedizioni-ars-utils-ui.filters.d.ts +163 -0
- package/types/arsedizioni-ars-utils-ui.help.d.ts +220 -0
- package/types/arsedizioni-ars-utils-ui.navigation.d.ts +650 -0
- package/types/arsedizioni-ars-utils-ui.notifications.d.ts +73 -0
- package/types/arsedizioni-ars-utils-ui.paginator.d.ts +23 -0
- package/types/arsedizioni-ars-utils-ui.shell.d.ts +345 -0
- package/types/arsedizioni-ars-utils-ui.tinymce.d.ts +63 -0
- package/types/arsedizioni-ars-utils.d.ts +4 -10
- package/ui.tinymce/README.md +12 -0
- package/ui.tinymce/langs/it.js +466 -0
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import { PlatformLocation } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { output, inject, signal, ChangeDetectionStrategy, Component, Service } from '@angular/core';
|
|
4
|
+
import { MatDialogRef, MAT_DIALOG_DATA, MatDialogTitle, MatDialogContent, MatDialogClose, MatDialogActions, MatDialog } from '@angular/material/dialog';
|
|
5
|
+
import { MAT_SNACK_BAR_DATA, MatSnackBar } from '@angular/material/snack-bar';
|
|
6
|
+
import { SafeHtmlPipe, SystemUtils } from '@arsedizioni/ars-utils/core';
|
|
7
|
+
import * as i1 from '@arsedizioni/ars-utils/ui';
|
|
8
|
+
import { FlexLayoutModule, UIService } from '@arsedizioni/ars-utils/ui';
|
|
9
|
+
import { ShellService } from '@arsedizioni/ars-utils/ui.shell';
|
|
10
|
+
import { first } from 'rxjs/operators';
|
|
11
|
+
import * as i3 from '@angular/material/button';
|
|
12
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
13
|
+
import * as i3$1 from '@angular/forms';
|
|
14
|
+
import { FormsModule } from '@angular/forms';
|
|
15
|
+
import * as i2 from '@angular/material/checkbox';
|
|
16
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
17
|
+
import * as i5 from '@angular/material/form-field';
|
|
18
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
19
|
+
import * as i6 from '@angular/material/input';
|
|
20
|
+
import { MatInputModule } from '@angular/material/input';
|
|
21
|
+
import * as i2$1 from '@angular/material/icon';
|
|
22
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
23
|
+
|
|
24
|
+
class ConfirmDialogComponent {
|
|
25
|
+
constructor() {
|
|
26
|
+
/** Emitted when the user makes a choice. Carries the selected result and any option state. */
|
|
27
|
+
this.choosen = output();
|
|
28
|
+
this.dialogRef = inject((MatDialogRef));
|
|
29
|
+
/** Dialog configuration, with sensible defaults applied at construction time. */
|
|
30
|
+
this.dialogData = signal({
|
|
31
|
+
title: 'Conferma',
|
|
32
|
+
okCaption: 'Si',
|
|
33
|
+
cancelCaption: 'No',
|
|
34
|
+
message: '',
|
|
35
|
+
...(inject(MAT_DIALOG_DATA) ?? {}),
|
|
36
|
+
}, /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "dialogData" }] : /* istanbul ignore next */ []));
|
|
38
|
+
// Ensure optional captions always have a value even when the caller omits them
|
|
39
|
+
this.dialogData.update(d => ({
|
|
40
|
+
...d,
|
|
41
|
+
title: d.title ?? 'Conferma',
|
|
42
|
+
okCaption: d.okCaption ?? 'Si',
|
|
43
|
+
cancelCaption: d.cancelCaption ?? 'No',
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Confirms the dialog, emitting `'ok'` together with the current option selections.
|
|
48
|
+
*/
|
|
49
|
+
ok() {
|
|
50
|
+
this.choosen.emit({ result: 'ok', options: this.dialogData().options });
|
|
51
|
+
this.dialogRef.close();
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Cancels the dialog, emitting `'cancel'`.
|
|
55
|
+
*/
|
|
56
|
+
cancel() {
|
|
57
|
+
this.choosen.emit({ result: 'cancel' });
|
|
58
|
+
this.dialogRef.close();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Triggers the tertiary action, emitting `'other'`.
|
|
62
|
+
*/
|
|
63
|
+
other() {
|
|
64
|
+
this.choosen.emit({ result: 'other' });
|
|
65
|
+
this.dialogRef.close();
|
|
66
|
+
}
|
|
67
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ConfirmDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
68
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: ConfirmDialogComponent, isStandalone: true, selector: "ng-component", outputs: { choosen: "choosen" }, ngImport: i0, template: "<div mat-dialog-title [innerHTML]=\"dialogData().title | safeHtml\"></div>\r\n<mat-dialog-content class=\"dialog-content\">\r\n <div fxLayout=\"column\" fxLayoutGap=\"24px\" fxFill>\r\n <div fxFlex=\"*\">\r\n @if (dialogData().message) {\r\n <div [innerHtml]=\"dialogData().message | safeHtml\"></div>\r\n }\r\n </div>\r\n @if (dialogData().details) {\r\n <div class=\"details-box\">\r\n <p class=\"x-small uppercase secondary\">Dettaglio:</p>\r\n <div class=\"small details\">\r\n <div [innerHtml]=\"dialogData().details | safeHtml\"></div>\r\n </div>\r\n </div>\r\n }\r\n @if (dialogData().options) {\r\n <div style=\"padding-bottom: 24px;\">\r\n @for (o of dialogData().options; track o; let i = $index) {\r\n <div>\r\n <mat-checkbox (change)=\"o.selected = $event.checked\" [checked]=\"o.selected === true\" name=\"opt_{{i}}\" >\r\n {{o.description}}\r\n </mat-checkbox>\r\n </div>\r\n }\r\n </div>\r\n } \r\n </div>\r\n</mat-dialog-content>\r\n<mat-dialog-actions>\r\n <div fxLayout=\"row\" fxLayoutGap=\"10px\" fxLayoutAlign=\"start center\" fxFill>\r\n <div fxFlex=\"30\">\r\n @if (dialogData().otherCaption) {\r\n <button mat-flat-button (click)=\"other()\"\r\n [mat-dialog-close]=\"true\">{{dialogData().otherCaption}}</button>\r\n }\r\n </div>\r\n <div fxFlex=\"70\" fxLayoutAlign=\"end\">\r\n <button mat-flat-button (click)=\"ok()\"\r\n [mat-dialog-close]=\"true\">{{dialogData().okCaption}}</button>\r\n <button mat-stroked-button [mat-dialog-close]=\"true\" (click)=\"cancel()\">{{dialogData().cancelCaption}}</button>\r\n </div>\r\n </div>\r\n</mat-dialog-actions>", styles: [".fill,.wide{min-width:100%!important;max-width:100%!important;width:100%!important}.dialog-info{font-size:x-small;font-weight:700;text-align:right;padding:10px}.dialog-info-green,.dialog-info-ok{color:var(--ars-color-ok, #388E3C)}.dialog-info-red,.dialog-info-error{color:var(--mat-form-field-error-text-color, #a80710)}.dialog-header{padding-bottom:20px}.dialog-toolbar{padding:0 5px 0 24px;height:48px;min-height:48px}.dialog-close{margin-right:5px;margin-top:0}.dialog-menu{margin-left:10px;margin-top:10px}.dialog-title{padding:0 24px}.section-title{font-size:large;font-weight:600;padding-top:10px;padding-bottom:8px}.center{text-align:center}.fill{min-height:100%!important;max-height:100%!important;height:100%!important}.scroll-auto{overflow:auto;height:100%}.scroll-hidden{overflow:hidden;height:100%}b{font-weight:700}.large{font-size:large!important;line-height:1.2!important}.smaller{font-size:smaller!important;line-height:1.2!important}.small{font-size:small!important;line-height:1.2!important}.small-icon-button{width:1.5rem!important;height:1.5rem!important;padding:0!important;display:inline-flex!important;align-items:center;justify-content:center}.small-icon-button .mat-mdc-button-touch-target{width:1.5rem!important;height:1.5rem!important}.x-small{font-size:x-small!important;line-height:1.2!important}.bold{font-weight:700}.uppercase{text-transform:uppercase!important}.lowercase{text-transform:lowercase!important}.truncated{min-width:0;max-width:100%}@supports (-webkit-line-clamp: 2){.truncated{overflow:hidden;text-overflow:ellipsis;white-space:initial;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}}.truncated span,.truncated div{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@supports (-webkit-line-clamp: 2){.truncated span,.truncated div{overflow:hidden;text-overflow:ellipsis;white-space:initial;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}}.clipped{min-width:0;max-width:100%}.clipped span,.clipped div{white-space:nowrap;overflow:hidden;text-overflow:clip}.accent{color:var(--ars-color-accent, #7894ae)!important}.primary{color:var(--ars-color-primary, #00a293)!important}.secondary{color:var(--ars-color-secondary, #4a635f)!important}.error{color:var(--ars-color-error, #ff5449)!important}.success{color:var(--ars-color-ok, #388E3C)!important}.warning{color:var(--ars-color-warning, #FFC107)!important}.text{color:var(--ars-color-text, #191c1b)!important}.overlay{position:absolute;top:0;left:0;width:100%;height:100%;z-index:10;background-color:var(--ars-color-overlay, rgba(255, 255, 255, .75))}.drawer-content{padding-top:10px}.drawer .title-container,.drawer .title-container-with-loader,.drawer-small .title-container,.drawer-small .title-container-with-loader{padding-right:5px;padding-bottom:20px;padding-left:0}.drawer .title-container,.drawer-small .title-container{padding-top:20px}.drawer .title-container-with-loader,.drawer-small .title-container-with-loader{padding-top:14px}.drawer .title,.drawer-small .title{font-size:19.2px!important;font-weight:600;padding-left:15px;min-width:150px;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.drawer .accordion-panel,.drawer-small .accordion-panel{background-color:transparent!important}.drawer .accordion-header,.drawer-small .accordion-header{padding-left:10px;padding-right:10px;border-radius:var(--mat-expansion-container-shape)}.drawer .mat-expansion-panel-body,.drawer-small .mat-expansion-panel-body{padding-left:10px!important;padding-right:10px!important;padding-bottom:20px!important}@media screen and (min-width:0px)and (max-width:430px){.drawer,.drawer-small{border-radius:0!important;min-width:100%!important;max-width:100%!important}}@media screen and (min-width:431px){.drawer{min-width:420px!important;max-width:420px!important}.drawer .title{min-width:200px}.drawer .mat-expansion-panel-body{padding-left:15px!important;padding-right:15px!important;padding-bottom:20px!important}.drawer-small{min-width:360px!important;max-width:360px!important}}.drawer-with-loader{padding-top:0!important}.drawer-transparent{background-color:transparent}.fade-in{animation:fadein .5s linear}@keyframes fadein{0%{opacity:0}to{opacity:1}}.bright{filter:brightness(.7)!important}@media(prefers-color-scheme:dark){.dialog-info-green,.dialog-info-ok{color:var(--ars-color-ok, #4CAF50)}.dialog-info-red,.dialog-info-error{color:var(--mat-form-field-error-text-color, #ff5449)}b,.bold{font-weight:600}.bright{filter:brightness(1.5)!important}}.dialog-content{padding:0 24px 24px!important}.details-box{border-top:1px solid var(--ars-color-divider, #757d87)}.details{background-color:var(--ars-item-hover-background-color, #eaecef);border-radius:5px;max-height:350px;padding:8px 12px;overflow:auto}\n"], dependencies: [{ kind: "directive", type: MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "ngmodule", type: FlexLayoutModule }, { kind: "directive", type: i1.FxLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg] ", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i1.FxFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg] ", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { kind: "directive", type: i1.FxLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg] ", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "directive", type: i1.FxLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg] ", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { kind: "directive", type: i1.FxFlexFillDirective, selector: " [fxFlexFill], [fxFill], [fxFlexFill.xs], [fxFlexFill.sm], [fxFlexFill.md], [fxFlexFill.lg], [fxFlexFill.xl], [fxFlexFill.lt-sm], [fxFlexFill.lt-md], [fxFlexFill.lt-lg], [fxFlexFill.lt-xl], [fxFlexFill.gt-xs], [fxFlexFill.gt-sm], [fxFlexFill.gt-md], [fxFlexFill.gt-lg] ", inputs: ["fxFlexFill", "fxFill", "fxFlexFill.xs", "fxFlexFill.sm", "fxFlexFill.md", "fxFlexFill.lg", "fxFlexFill.xl", "fxFlexFill.lt-sm", "fxFlexFill.lt-md", "fxFlexFill.lt-lg", "fxFlexFill.lt-xl", "fxFlexFill.gt-xs", "fxFlexFill.gt-sm", "fxFlexFill.gt-md", "fxFlexFill.gt-lg"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
69
|
+
}
|
|
70
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ConfirmDialogComponent, decorators: [{
|
|
71
|
+
type: Component,
|
|
72
|
+
args: [{ standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatDialogTitle, MatDialogContent, MatDialogClose, FlexLayoutModule, MatCheckboxModule, FormsModule,
|
|
73
|
+
MatDialogActions, MatButtonModule, SafeHtmlPipe], template: "<div mat-dialog-title [innerHTML]=\"dialogData().title | safeHtml\"></div>\r\n<mat-dialog-content class=\"dialog-content\">\r\n <div fxLayout=\"column\" fxLayoutGap=\"24px\" fxFill>\r\n <div fxFlex=\"*\">\r\n @if (dialogData().message) {\r\n <div [innerHtml]=\"dialogData().message | safeHtml\"></div>\r\n }\r\n </div>\r\n @if (dialogData().details) {\r\n <div class=\"details-box\">\r\n <p class=\"x-small uppercase secondary\">Dettaglio:</p>\r\n <div class=\"small details\">\r\n <div [innerHtml]=\"dialogData().details | safeHtml\"></div>\r\n </div>\r\n </div>\r\n }\r\n @if (dialogData().options) {\r\n <div style=\"padding-bottom: 24px;\">\r\n @for (o of dialogData().options; track o; let i = $index) {\r\n <div>\r\n <mat-checkbox (change)=\"o.selected = $event.checked\" [checked]=\"o.selected === true\" name=\"opt_{{i}}\" >\r\n {{o.description}}\r\n </mat-checkbox>\r\n </div>\r\n }\r\n </div>\r\n } \r\n </div>\r\n</mat-dialog-content>\r\n<mat-dialog-actions>\r\n <div fxLayout=\"row\" fxLayoutGap=\"10px\" fxLayoutAlign=\"start center\" fxFill>\r\n <div fxFlex=\"30\">\r\n @if (dialogData().otherCaption) {\r\n <button mat-flat-button (click)=\"other()\"\r\n [mat-dialog-close]=\"true\">{{dialogData().otherCaption}}</button>\r\n }\r\n </div>\r\n <div fxFlex=\"70\" fxLayoutAlign=\"end\">\r\n <button mat-flat-button (click)=\"ok()\"\r\n [mat-dialog-close]=\"true\">{{dialogData().okCaption}}</button>\r\n <button mat-stroked-button [mat-dialog-close]=\"true\" (click)=\"cancel()\">{{dialogData().cancelCaption}}</button>\r\n </div>\r\n </div>\r\n</mat-dialog-actions>", styles: [".fill,.wide{min-width:100%!important;max-width:100%!important;width:100%!important}.dialog-info{font-size:x-small;font-weight:700;text-align:right;padding:10px}.dialog-info-green,.dialog-info-ok{color:var(--ars-color-ok, #388E3C)}.dialog-info-red,.dialog-info-error{color:var(--mat-form-field-error-text-color, #a80710)}.dialog-header{padding-bottom:20px}.dialog-toolbar{padding:0 5px 0 24px;height:48px;min-height:48px}.dialog-close{margin-right:5px;margin-top:0}.dialog-menu{margin-left:10px;margin-top:10px}.dialog-title{padding:0 24px}.section-title{font-size:large;font-weight:600;padding-top:10px;padding-bottom:8px}.center{text-align:center}.fill{min-height:100%!important;max-height:100%!important;height:100%!important}.scroll-auto{overflow:auto;height:100%}.scroll-hidden{overflow:hidden;height:100%}b{font-weight:700}.large{font-size:large!important;line-height:1.2!important}.smaller{font-size:smaller!important;line-height:1.2!important}.small{font-size:small!important;line-height:1.2!important}.small-icon-button{width:1.5rem!important;height:1.5rem!important;padding:0!important;display:inline-flex!important;align-items:center;justify-content:center}.small-icon-button .mat-mdc-button-touch-target{width:1.5rem!important;height:1.5rem!important}.x-small{font-size:x-small!important;line-height:1.2!important}.bold{font-weight:700}.uppercase{text-transform:uppercase!important}.lowercase{text-transform:lowercase!important}.truncated{min-width:0;max-width:100%}@supports (-webkit-line-clamp: 2){.truncated{overflow:hidden;text-overflow:ellipsis;white-space:initial;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}}.truncated span,.truncated div{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@supports (-webkit-line-clamp: 2){.truncated span,.truncated div{overflow:hidden;text-overflow:ellipsis;white-space:initial;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}}.clipped{min-width:0;max-width:100%}.clipped span,.clipped div{white-space:nowrap;overflow:hidden;text-overflow:clip}.accent{color:var(--ars-color-accent, #7894ae)!important}.primary{color:var(--ars-color-primary, #00a293)!important}.secondary{color:var(--ars-color-secondary, #4a635f)!important}.error{color:var(--ars-color-error, #ff5449)!important}.success{color:var(--ars-color-ok, #388E3C)!important}.warning{color:var(--ars-color-warning, #FFC107)!important}.text{color:var(--ars-color-text, #191c1b)!important}.overlay{position:absolute;top:0;left:0;width:100%;height:100%;z-index:10;background-color:var(--ars-color-overlay, rgba(255, 255, 255, .75))}.drawer-content{padding-top:10px}.drawer .title-container,.drawer .title-container-with-loader,.drawer-small .title-container,.drawer-small .title-container-with-loader{padding-right:5px;padding-bottom:20px;padding-left:0}.drawer .title-container,.drawer-small .title-container{padding-top:20px}.drawer .title-container-with-loader,.drawer-small .title-container-with-loader{padding-top:14px}.drawer .title,.drawer-small .title{font-size:19.2px!important;font-weight:600;padding-left:15px;min-width:150px;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.drawer .accordion-panel,.drawer-small .accordion-panel{background-color:transparent!important}.drawer .accordion-header,.drawer-small .accordion-header{padding-left:10px;padding-right:10px;border-radius:var(--mat-expansion-container-shape)}.drawer .mat-expansion-panel-body,.drawer-small .mat-expansion-panel-body{padding-left:10px!important;padding-right:10px!important;padding-bottom:20px!important}@media screen and (min-width:0px)and (max-width:430px){.drawer,.drawer-small{border-radius:0!important;min-width:100%!important;max-width:100%!important}}@media screen and (min-width:431px){.drawer{min-width:420px!important;max-width:420px!important}.drawer .title{min-width:200px}.drawer .mat-expansion-panel-body{padding-left:15px!important;padding-right:15px!important;padding-bottom:20px!important}.drawer-small{min-width:360px!important;max-width:360px!important}}.drawer-with-loader{padding-top:0!important}.drawer-transparent{background-color:transparent}.fade-in{animation:fadein .5s linear}@keyframes fadein{0%{opacity:0}to{opacity:1}}.bright{filter:brightness(.7)!important}@media(prefers-color-scheme:dark){.dialog-info-green,.dialog-info-ok{color:var(--ars-color-ok, #4CAF50)}.dialog-info-red,.dialog-info-error{color:var(--mat-form-field-error-text-color, #ff5449)}b,.bold{font-weight:600}.bright{filter:brightness(1.5)!important}}.dialog-content{padding:0 24px 24px!important}.details-box{border-top:1px solid var(--ars-color-divider, #757d87)}.details{background-color:var(--ars-item-hover-background-color, #eaecef);border-radius:5px;max-height:350px;padding:8px 12px;overflow:auto}\n"] }]
|
|
74
|
+
}], ctorParameters: () => [], propDecorators: { choosen: [{ type: i0.Output, args: ["choosen"] }] } });
|
|
75
|
+
|
|
76
|
+
var DeleteDialogConfirmMode;
|
|
77
|
+
(function (DeleteDialogConfirmMode) {
|
|
78
|
+
DeleteDialogConfirmMode[DeleteDialogConfirmMode["None"] = 0] = "None";
|
|
79
|
+
DeleteDialogConfirmMode[DeleteDialogConfirmMode["Simple"] = 1] = "Simple";
|
|
80
|
+
DeleteDialogConfirmMode[DeleteDialogConfirmMode["Strong"] = 2] = "Strong";
|
|
81
|
+
})(DeleteDialogConfirmMode || (DeleteDialogConfirmMode = {}));
|
|
82
|
+
class DeleteDialogComponent {
|
|
83
|
+
constructor() {
|
|
84
|
+
/** Emitted when the user makes a choice. Carries the selected result. */
|
|
85
|
+
this.choosen = output();
|
|
86
|
+
this.dialogRef = inject((MatDialogRef));
|
|
87
|
+
/** Dialog configuration with defaults applied at construction time. */
|
|
88
|
+
this.dialogData = signal((() => {
|
|
89
|
+
const raw = inject(MAT_DIALOG_DATA) ?? {};
|
|
90
|
+
return {
|
|
91
|
+
title: 'Attenzione',
|
|
92
|
+
okCaption: 'Si',
|
|
93
|
+
cancelCaption: 'No',
|
|
94
|
+
confirmMode: DeleteDialogConfirmMode.None,
|
|
95
|
+
message: '',
|
|
96
|
+
...raw,
|
|
97
|
+
};
|
|
98
|
+
})(), /* @ts-ignore */
|
|
99
|
+
...(ngDevMode ? [{ debugName: "dialogData" }] : /* istanbul ignore next */ []));
|
|
100
|
+
/**
|
|
101
|
+
* Whether the user has confirmed the deletion.
|
|
102
|
+
* Starts as `true` for all modes except `Simple`, which requires explicit checkbox confirmation.
|
|
103
|
+
*/
|
|
104
|
+
this.confirmed = signal(this.dialogData().confirmMode !== DeleteDialogConfirmMode.Simple, /* @ts-ignore */
|
|
105
|
+
...(ngDevMode ? [{ debugName: "confirmed" }] : /* istanbul ignore next */ []));
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Confirms the deletion, emitting `'ok'` and closing the dialog.
|
|
109
|
+
*/
|
|
110
|
+
ok() {
|
|
111
|
+
this.choosen.emit({ result: 'ok' });
|
|
112
|
+
this.dialogRef.close();
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Cancels the operation, emitting `'cancel'` and closing the dialog.
|
|
116
|
+
*/
|
|
117
|
+
cancel() {
|
|
118
|
+
this.choosen.emit({ result: 'cancel' });
|
|
119
|
+
this.dialogRef.close();
|
|
120
|
+
}
|
|
121
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: DeleteDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
122
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: DeleteDialogComponent, isStandalone: true, selector: "ng-component", outputs: { choosen: "choosen" }, ngImport: i0, template: "<div mat-dialog-title [innerHTML]=\"dialogData().title | safeHtml\"></div>\r\n<mat-dialog-content class=\"dialog-content\">\r\n <form name=\"form\" #f=\"ngForm\" novalidate>\r\n <div fxLayout=\"column\" fxLayoutGap=\"24px\" fxFill>\r\n <div fxFlex=\"*\">\r\n @if (dialogData().message) {\r\n <div [innerHtml]=\"dialogData().message | safeHtml\"></div>\r\n }\r\n </div>\r\n @if (dialogData().details) {\r\n <div class=\"details-box\">\r\n <p class=\"x-small uppercase secondary\">Dettaglio:</p>\r\n <div class=\"small details\">\r\n <div [innerHtml]=\"dialogData().details | safeHtml\"></div>\r\n </div>\r\n </div>\r\n }\r\n @if (dialogData().confirmMode === 1) {\r\n <div>\r\n <mat-checkbox (change)=\"confirmed.set($event.checked)\" [checked]=\"confirmed()\">\r\n Confermo la cancellazione\r\n </mat-checkbox>\r\n </div>\r\n } @else if (dialogData().confirmMode === 2) {\r\n <p>Per confermare la cancellazione digita la parola <i><b>elimina</b></i>.</p>\r\n <mat-form-field style=\"width: 200px\" [appearance]=\"dialogData().appearance\">\r\n <mat-label>Conferma</mat-label>\r\n <input matInput #field_confirm=\"ngModel\" [(ngModel)]=\"confirmValue\" name=\"field_confirm\" required\r\n [attr.aria-label]=\"'Digita la parola -elimina-'\">\r\n @if (field_confirm.invalid) {\r\n <mat-error>Digita la parola \"elimina\"</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n <br>\r\n </div>\r\n </form>\r\n</mat-dialog-content>\r\n<mat-dialog-actions>\r\n <div fxLayout=\"row\" fxLayoutGap=\"10px\" fxLayoutAlign=\"end center\" fxFill>\r\n <button mat-flat-button (click)=\"ok()\"\r\n [disabled]=\"f.form.invalid || (confirmValue && confirmValue.toLowerCase() !== 'elimina') || !confirmed()\"\r\n [mat-dialog-close]=\"true\">{{dialogData().okCaption}}</button>\r\n <button mat-stroked-button [mat-dialog-close]=\"true\"\r\n (click)=\"cancel()\">{{dialogData().cancelCaption}}</button>\r\n </div>\r\n</mat-dialog-actions>", styles: [".fill,.wide{min-width:100%!important;max-width:100%!important;width:100%!important}.dialog-info{font-size:x-small;font-weight:700;text-align:right;padding:10px}.dialog-info-green,.dialog-info-ok{color:var(--ars-color-ok, #388E3C)}.dialog-info-red,.dialog-info-error{color:var(--mat-form-field-error-text-color, #a80710)}.dialog-header{padding-bottom:20px}.dialog-toolbar{padding:0 5px 0 24px;height:48px;min-height:48px}.dialog-close{margin-right:5px;margin-top:0}.dialog-menu{margin-left:10px;margin-top:10px}.dialog-title{padding:0 24px}.section-title{font-size:large;font-weight:600;padding-top:10px;padding-bottom:8px}.center{text-align:center}.fill{min-height:100%!important;max-height:100%!important;height:100%!important}.scroll-auto{overflow:auto;height:100%}.scroll-hidden{overflow:hidden;height:100%}b{font-weight:700}.large{font-size:large!important;line-height:1.2!important}.smaller{font-size:smaller!important;line-height:1.2!important}.small{font-size:small!important;line-height:1.2!important}.small-icon-button{width:1.5rem!important;height:1.5rem!important;padding:0!important;display:inline-flex!important;align-items:center;justify-content:center}.small-icon-button .mat-mdc-button-touch-target{width:1.5rem!important;height:1.5rem!important}.x-small{font-size:x-small!important;line-height:1.2!important}.bold{font-weight:700}.uppercase{text-transform:uppercase!important}.lowercase{text-transform:lowercase!important}.truncated{min-width:0;max-width:100%}@supports (-webkit-line-clamp: 2){.truncated{overflow:hidden;text-overflow:ellipsis;white-space:initial;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}}.truncated span,.truncated div{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@supports (-webkit-line-clamp: 2){.truncated span,.truncated div{overflow:hidden;text-overflow:ellipsis;white-space:initial;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}}.clipped{min-width:0;max-width:100%}.clipped span,.clipped div{white-space:nowrap;overflow:hidden;text-overflow:clip}.accent{color:var(--ars-color-accent, #7894ae)!important}.primary{color:var(--ars-color-primary, #00a293)!important}.secondary{color:var(--ars-color-secondary, #4a635f)!important}.error{color:var(--ars-color-error, #ff5449)!important}.success{color:var(--ars-color-ok, #388E3C)!important}.warning{color:var(--ars-color-warning, #FFC107)!important}.text{color:var(--ars-color-text, #191c1b)!important}.overlay{position:absolute;top:0;left:0;width:100%;height:100%;z-index:10;background-color:var(--ars-color-overlay, rgba(255, 255, 255, .75))}.drawer-content{padding-top:10px}.drawer .title-container,.drawer .title-container-with-loader,.drawer-small .title-container,.drawer-small .title-container-with-loader{padding-right:5px;padding-bottom:20px;padding-left:0}.drawer .title-container,.drawer-small .title-container{padding-top:20px}.drawer .title-container-with-loader,.drawer-small .title-container-with-loader{padding-top:14px}.drawer .title,.drawer-small .title{font-size:19.2px!important;font-weight:600;padding-left:15px;min-width:150px;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.drawer .accordion-panel,.drawer-small .accordion-panel{background-color:transparent!important}.drawer .accordion-header,.drawer-small .accordion-header{padding-left:10px;padding-right:10px;border-radius:var(--mat-expansion-container-shape)}.drawer .mat-expansion-panel-body,.drawer-small .mat-expansion-panel-body{padding-left:10px!important;padding-right:10px!important;padding-bottom:20px!important}@media screen and (min-width:0px)and (max-width:430px){.drawer,.drawer-small{border-radius:0!important;min-width:100%!important;max-width:100%!important}}@media screen and (min-width:431px){.drawer{min-width:420px!important;max-width:420px!important}.drawer .title{min-width:200px}.drawer .mat-expansion-panel-body{padding-left:15px!important;padding-right:15px!important;padding-bottom:20px!important}.drawer-small{min-width:360px!important;max-width:360px!important}}.drawer-with-loader{padding-top:0!important}.drawer-transparent{background-color:transparent}.fade-in{animation:fadein .5s linear}@keyframes fadein{0%{opacity:0}to{opacity:1}}.bright{filter:brightness(.7)!important}@media(prefers-color-scheme:dark){.dialog-info-green,.dialog-info-ok{color:var(--ars-color-ok, #4CAF50)}.dialog-info-red,.dialog-info-error{color:var(--mat-form-field-error-text-color, #ff5449)}b,.bold{font-weight:600}.bright{filter:brightness(1.5)!important}}.dialog-content{padding:0 24px 24px!important}.details-box{border-top:1px solid var(--ars-color-divider, #757d87)}.details{background-color:var(--ars-item-hover-background-color, #eaecef);border-radius:5px;max-height:350px;padding:8px 12px;overflow:auto}\n"], dependencies: [{ kind: "directive", type: MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "ngmodule", type: FlexLayoutModule }, { kind: "directive", type: i1.FxLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg] ", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i1.FxFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg] ", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { kind: "directive", type: i1.FxLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg] ", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "directive", type: i1.FxLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg] ", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { kind: "directive", type: i1.FxFlexFillDirective, selector: " [fxFlexFill], [fxFill], [fxFlexFill.xs], [fxFlexFill.sm], [fxFlexFill.md], [fxFlexFill.lg], [fxFlexFill.xl], [fxFlexFill.lt-sm], [fxFlexFill.lt-md], [fxFlexFill.lt-lg], [fxFlexFill.lt-xl], [fxFlexFill.gt-xs], [fxFlexFill.gt-sm], [fxFlexFill.gt-md], [fxFlexFill.gt-lg] ", inputs: ["fxFlexFill", "fxFill", "fxFlexFill.xs", "fxFlexFill.sm", "fxFlexFill.md", "fxFlexFill.lg", "fxFlexFill.xl", "fxFlexFill.lt-sm", "fxFlexFill.lt-md", "fxFlexFill.lt-lg", "fxFlexFill.lt-xl", "fxFlexFill.gt-xs", "fxFlexFill.gt-sm", "fxFlexFill.gt-md", "fxFlexFill.gt-lg"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i3$1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i3$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i3$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatLabel, selector: "mat-label" }, { kind: "directive", type: i5.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
123
|
+
}
|
|
124
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: DeleteDialogComponent, decorators: [{
|
|
125
|
+
type: Component,
|
|
126
|
+
args: [{ standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatDialogTitle, MatDialogContent, MatDialogClose, FlexLayoutModule, MatCheckboxModule, FormsModule,
|
|
127
|
+
MatDialogActions, MatButtonModule, MatFormFieldModule, MatInputModule, SafeHtmlPipe], template: "<div mat-dialog-title [innerHTML]=\"dialogData().title | safeHtml\"></div>\r\n<mat-dialog-content class=\"dialog-content\">\r\n <form name=\"form\" #f=\"ngForm\" novalidate>\r\n <div fxLayout=\"column\" fxLayoutGap=\"24px\" fxFill>\r\n <div fxFlex=\"*\">\r\n @if (dialogData().message) {\r\n <div [innerHtml]=\"dialogData().message | safeHtml\"></div>\r\n }\r\n </div>\r\n @if (dialogData().details) {\r\n <div class=\"details-box\">\r\n <p class=\"x-small uppercase secondary\">Dettaglio:</p>\r\n <div class=\"small details\">\r\n <div [innerHtml]=\"dialogData().details | safeHtml\"></div>\r\n </div>\r\n </div>\r\n }\r\n @if (dialogData().confirmMode === 1) {\r\n <div>\r\n <mat-checkbox (change)=\"confirmed.set($event.checked)\" [checked]=\"confirmed()\">\r\n Confermo la cancellazione\r\n </mat-checkbox>\r\n </div>\r\n } @else if (dialogData().confirmMode === 2) {\r\n <p>Per confermare la cancellazione digita la parola <i><b>elimina</b></i>.</p>\r\n <mat-form-field style=\"width: 200px\" [appearance]=\"dialogData().appearance\">\r\n <mat-label>Conferma</mat-label>\r\n <input matInput #field_confirm=\"ngModel\" [(ngModel)]=\"confirmValue\" name=\"field_confirm\" required\r\n [attr.aria-label]=\"'Digita la parola -elimina-'\">\r\n @if (field_confirm.invalid) {\r\n <mat-error>Digita la parola \"elimina\"</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n <br>\r\n </div>\r\n </form>\r\n</mat-dialog-content>\r\n<mat-dialog-actions>\r\n <div fxLayout=\"row\" fxLayoutGap=\"10px\" fxLayoutAlign=\"end center\" fxFill>\r\n <button mat-flat-button (click)=\"ok()\"\r\n [disabled]=\"f.form.invalid || (confirmValue && confirmValue.toLowerCase() !== 'elimina') || !confirmed()\"\r\n [mat-dialog-close]=\"true\">{{dialogData().okCaption}}</button>\r\n <button mat-stroked-button [mat-dialog-close]=\"true\"\r\n (click)=\"cancel()\">{{dialogData().cancelCaption}}</button>\r\n </div>\r\n</mat-dialog-actions>", styles: [".fill,.wide{min-width:100%!important;max-width:100%!important;width:100%!important}.dialog-info{font-size:x-small;font-weight:700;text-align:right;padding:10px}.dialog-info-green,.dialog-info-ok{color:var(--ars-color-ok, #388E3C)}.dialog-info-red,.dialog-info-error{color:var(--mat-form-field-error-text-color, #a80710)}.dialog-header{padding-bottom:20px}.dialog-toolbar{padding:0 5px 0 24px;height:48px;min-height:48px}.dialog-close{margin-right:5px;margin-top:0}.dialog-menu{margin-left:10px;margin-top:10px}.dialog-title{padding:0 24px}.section-title{font-size:large;font-weight:600;padding-top:10px;padding-bottom:8px}.center{text-align:center}.fill{min-height:100%!important;max-height:100%!important;height:100%!important}.scroll-auto{overflow:auto;height:100%}.scroll-hidden{overflow:hidden;height:100%}b{font-weight:700}.large{font-size:large!important;line-height:1.2!important}.smaller{font-size:smaller!important;line-height:1.2!important}.small{font-size:small!important;line-height:1.2!important}.small-icon-button{width:1.5rem!important;height:1.5rem!important;padding:0!important;display:inline-flex!important;align-items:center;justify-content:center}.small-icon-button .mat-mdc-button-touch-target{width:1.5rem!important;height:1.5rem!important}.x-small{font-size:x-small!important;line-height:1.2!important}.bold{font-weight:700}.uppercase{text-transform:uppercase!important}.lowercase{text-transform:lowercase!important}.truncated{min-width:0;max-width:100%}@supports (-webkit-line-clamp: 2){.truncated{overflow:hidden;text-overflow:ellipsis;white-space:initial;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}}.truncated span,.truncated div{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@supports (-webkit-line-clamp: 2){.truncated span,.truncated div{overflow:hidden;text-overflow:ellipsis;white-space:initial;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}}.clipped{min-width:0;max-width:100%}.clipped span,.clipped div{white-space:nowrap;overflow:hidden;text-overflow:clip}.accent{color:var(--ars-color-accent, #7894ae)!important}.primary{color:var(--ars-color-primary, #00a293)!important}.secondary{color:var(--ars-color-secondary, #4a635f)!important}.error{color:var(--ars-color-error, #ff5449)!important}.success{color:var(--ars-color-ok, #388E3C)!important}.warning{color:var(--ars-color-warning, #FFC107)!important}.text{color:var(--ars-color-text, #191c1b)!important}.overlay{position:absolute;top:0;left:0;width:100%;height:100%;z-index:10;background-color:var(--ars-color-overlay, rgba(255, 255, 255, .75))}.drawer-content{padding-top:10px}.drawer .title-container,.drawer .title-container-with-loader,.drawer-small .title-container,.drawer-small .title-container-with-loader{padding-right:5px;padding-bottom:20px;padding-left:0}.drawer .title-container,.drawer-small .title-container{padding-top:20px}.drawer .title-container-with-loader,.drawer-small .title-container-with-loader{padding-top:14px}.drawer .title,.drawer-small .title{font-size:19.2px!important;font-weight:600;padding-left:15px;min-width:150px;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.drawer .accordion-panel,.drawer-small .accordion-panel{background-color:transparent!important}.drawer .accordion-header,.drawer-small .accordion-header{padding-left:10px;padding-right:10px;border-radius:var(--mat-expansion-container-shape)}.drawer .mat-expansion-panel-body,.drawer-small .mat-expansion-panel-body{padding-left:10px!important;padding-right:10px!important;padding-bottom:20px!important}@media screen and (min-width:0px)and (max-width:430px){.drawer,.drawer-small{border-radius:0!important;min-width:100%!important;max-width:100%!important}}@media screen and (min-width:431px){.drawer{min-width:420px!important;max-width:420px!important}.drawer .title{min-width:200px}.drawer .mat-expansion-panel-body{padding-left:15px!important;padding-right:15px!important;padding-bottom:20px!important}.drawer-small{min-width:360px!important;max-width:360px!important}}.drawer-with-loader{padding-top:0!important}.drawer-transparent{background-color:transparent}.fade-in{animation:fadein .5s linear}@keyframes fadein{0%{opacity:0}to{opacity:1}}.bright{filter:brightness(.7)!important}@media(prefers-color-scheme:dark){.dialog-info-green,.dialog-info-ok{color:var(--ars-color-ok, #4CAF50)}.dialog-info-red,.dialog-info-error{color:var(--mat-form-field-error-text-color, #ff5449)}b,.bold{font-weight:600}.bright{filter:brightness(1.5)!important}}.dialog-content{padding:0 24px 24px!important}.details-box{border-top:1px solid var(--ars-color-divider, #757d87)}.details{background-color:var(--ars-item-hover-background-color, #eaecef);border-radius:5px;max-height:350px;padding:8px 12px;overflow:auto}\n"] }]
|
|
128
|
+
}], propDecorators: { choosen: [{ type: i0.Output, args: ["choosen"] }] } });
|
|
129
|
+
|
|
130
|
+
class ToastComponent {
|
|
131
|
+
constructor() {
|
|
132
|
+
/** Emitted when the user clicks the optional action button. */
|
|
133
|
+
this.action = output();
|
|
134
|
+
/** Snack-bar payload with a safe fallback to an empty message when no data is injected. */
|
|
135
|
+
this.dialogData = signal(inject(MAT_SNACK_BAR_DATA) ?? { message: '' }, /* @ts-ignore */
|
|
136
|
+
...(ngDevMode ? [{ debugName: "dialogData" }] : /* istanbul ignore next */ []));
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Emits the `action` event to notify the caller that the action button was clicked.
|
|
140
|
+
*/
|
|
141
|
+
do() {
|
|
142
|
+
this.action.emit();
|
|
143
|
+
}
|
|
144
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ToastComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
145
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: ToastComponent, isStandalone: true, selector: "ng-component", outputs: { action: "action" }, ngImport: i0, template: "<div fxLayout=\"row\" fxLayoutGap=\"10px\">\r\n @if (dialogData().icon) {\r\n <div fxFlex='30px' fxLayoutAlign=\"start\" fxFlexAlign=\"center\">\r\n <mat-icon>{{dialogData().icon}}</mat-icon>\r\n </div>\r\n }\r\n <div fxFlex='*' fxLayoutAlign=\"start\" fxFlexAlign=\"center\">\r\n @if (dialogData().message) {\r\n <span [innerHTML]=\"dialogData().message | safeHtml\"></span>\r\n }\r\n </div>\r\n @if (dialogData().actionCaption) {\r\n <div fxLayoutAlign=\"end\" fxFlexAlign=\"center\">\r\n <div style=\"padding-left: 20px;\">\r\n <button type=\"button\" mat-flat-button (click)=\"do()\"\r\n [innerHTML]=\"dialogData().actionCaption\"></button>\r\n </div>\r\n </div>\r\n }\r\n</div>", styles: [""], dependencies: [{ kind: "ngmodule", type: FlexLayoutModule }, { kind: "directive", type: i1.FxLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg] ", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i1.FxFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg] ", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { kind: "directive", type: i1.FxLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg] ", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "directive", type: i1.FxLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg] ", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { kind: "directive", type: i1.FxFlexAlignDirective, selector: " [fxFlexAlign], [fxFlexAlign.xs], [fxFlexAlign.sm], [fxFlexAlign.md], [fxFlexAlign.lg], [fxFlexAlign.xl], [fxFlexAlign.lt-sm], [fxFlexAlign.lt-md], [fxFlexAlign.lt-lg], [fxFlexAlign.lt-xl], [fxFlexAlign.gt-xs], [fxFlexAlign.gt-sm], [fxFlexAlign.gt-md], [fxFlexAlign.gt-lg] ", inputs: ["fxFlexAlign", "fxFlexAlign.xs", "fxFlexAlign.sm", "fxFlexAlign.md", "fxFlexAlign.lg", "fxFlexAlign.xl", "fxFlexAlign.lt-sm", "fxFlexAlign.lt-md", "fxFlexAlign.lt-lg", "fxFlexAlign.lt-xl", "fxFlexAlign.gt-xs", "fxFlexAlign.gt-sm", "fxFlexAlign.gt-md", "fxFlexAlign.gt-lg"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
146
|
+
}
|
|
147
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ToastComponent, decorators: [{
|
|
148
|
+
type: Component,
|
|
149
|
+
args: [{ standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [FlexLayoutModule, MatIconModule, MatButtonModule, SafeHtmlPipe], template: "<div fxLayout=\"row\" fxLayoutGap=\"10px\">\r\n @if (dialogData().icon) {\r\n <div fxFlex='30px' fxLayoutAlign=\"start\" fxFlexAlign=\"center\">\r\n <mat-icon>{{dialogData().icon}}</mat-icon>\r\n </div>\r\n }\r\n <div fxFlex='*' fxLayoutAlign=\"start\" fxFlexAlign=\"center\">\r\n @if (dialogData().message) {\r\n <span [innerHTML]=\"dialogData().message | safeHtml\"></span>\r\n }\r\n </div>\r\n @if (dialogData().actionCaption) {\r\n <div fxLayoutAlign=\"end\" fxFlexAlign=\"center\">\r\n <div style=\"padding-left: 20px;\">\r\n <button type=\"button\" mat-flat-button (click)=\"do()\"\r\n [innerHTML]=\"dialogData().actionCaption\"></button>\r\n </div>\r\n </div>\r\n }\r\n</div>" }]
|
|
150
|
+
}], propDecorators: { action: [{ type: i0.Output, args: ["action"] }] } });
|
|
151
|
+
|
|
152
|
+
class DialogService extends ShellService {
|
|
153
|
+
/**
|
|
154
|
+
* Updates the global form-field appearance.
|
|
155
|
+
* @param value - The new appearance value. Falls back to `'fill'` when `undefined` is passed.
|
|
156
|
+
* @returns void
|
|
157
|
+
*/
|
|
158
|
+
setAppearance(value) {
|
|
159
|
+
this.uiService.setAppearance(value);
|
|
160
|
+
}
|
|
161
|
+
constructor() {
|
|
162
|
+
super();
|
|
163
|
+
this.uiService = inject(UIService);
|
|
164
|
+
/**
|
|
165
|
+
* Shares the SAME `appearance` signal instance as the root `UIService`:
|
|
166
|
+
* `uiService.setAppearance('outline')` is immediately visible here and in
|
|
167
|
+
* every dialog opened by this service.
|
|
168
|
+
*
|
|
169
|
+
* Held by delegation and no longer by inheritance: this service now extends `ShellService`,
|
|
170
|
+
* which knows nothing about Material and must not, so the two members every caller uses of
|
|
171
|
+
* `UIService` are re-exposed here.
|
|
172
|
+
*/
|
|
173
|
+
this.appearance = this.uiService.appearance;
|
|
174
|
+
this.dialog = inject(MatDialog);
|
|
175
|
+
this.snackBar = inject(MatSnackBar);
|
|
176
|
+
this.location = inject(PlatformLocation);
|
|
177
|
+
this.popHistory = [];
|
|
178
|
+
this.popState = true;
|
|
179
|
+
this.poppingState = false;
|
|
180
|
+
// Handle dialog close when back button is clicked
|
|
181
|
+
this.location.onPopState(() => {
|
|
182
|
+
if (!this.poppingState) {
|
|
183
|
+
const count = this.dialog.openDialogs.length;
|
|
184
|
+
if (count > 0) {
|
|
185
|
+
// Disable pop state if needed
|
|
186
|
+
this.popState = false;
|
|
187
|
+
// Close dialog
|
|
188
|
+
this.dialog.openDialogs[count - 1].close();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
this.poppingState = false;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Lets the next `popstate` through without closing the topmost dialog.
|
|
198
|
+
*
|
|
199
|
+
* Back closing the dialog on top is the rule of this service, and its listener is registered in
|
|
200
|
+
* the constructor — so nothing attached later can get in front of it. A caller that owns a
|
|
201
|
+
* dismissable state of its own INSIDE a dialog (a full-screen editor, a picker covering the
|
|
202
|
+
* dialog, a wizard step) needs Back to unwind that state first, and this is the only way to ask
|
|
203
|
+
* for it: push a history entry, call this, and handle the pop.
|
|
204
|
+
*
|
|
205
|
+
* The suspension lasts exactly one `popstate` and is consumed whether or not the caller pushed
|
|
206
|
+
* an entry, so it can not leave the service permanently deaf to the Back button.
|
|
207
|
+
*/
|
|
208
|
+
suspendBackClose() {
|
|
209
|
+
this.poppingState = true;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Removes trailing `#` characters from the current URL (e.g. after a page reload).
|
|
213
|
+
* @param resetPoppingState - When `true`, resets the internal popping-state flag.
|
|
214
|
+
*/
|
|
215
|
+
clearUrl(resetPoppingState = false) {
|
|
216
|
+
const url = location.href;
|
|
217
|
+
let l = url.length;
|
|
218
|
+
while (l >= 0 && url[l - 1] === '#')
|
|
219
|
+
l--;
|
|
220
|
+
if (l < url.length)
|
|
221
|
+
history.replaceState({}, '', url.substring(0, l));
|
|
222
|
+
if (resetPoppingState)
|
|
223
|
+
this.poppingState = false;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Close all dialogs
|
|
227
|
+
*/
|
|
228
|
+
closeAll() {
|
|
229
|
+
this.dialog.closeAll();
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Opens a Material dialog. Returns `null` when not running in a browser.
|
|
233
|
+
* @param component - The component to open as a dialog.
|
|
234
|
+
* @param config - The dialog configuration.
|
|
235
|
+
* @returns The dialog reference, or `null` outside the browser.
|
|
236
|
+
*/
|
|
237
|
+
open(component, config) {
|
|
238
|
+
if (!SystemUtils.isBrowser())
|
|
239
|
+
return null;
|
|
240
|
+
// Immediately, not with the grace period: the dialog is about to be drawn under an overlay
|
|
241
|
+
// that sits above it by z-index, and half a second of it covering a fresh dialog would show.
|
|
242
|
+
this.clearBusy(true);
|
|
243
|
+
return this.openDialog(component, config);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Internal helper that wraps `MatDialog.open`, subscribes to lifecycle hooks
|
|
247
|
+
* and manages browser-history push/pop entries.
|
|
248
|
+
* @param component - The component to open.
|
|
249
|
+
* @param config - The dialog configuration.
|
|
250
|
+
* @returns The dialog reference.
|
|
251
|
+
*/
|
|
252
|
+
openDialog(component, config) {
|
|
253
|
+
// We will take care of navigation
|
|
254
|
+
config.closeOnNavigation = false;
|
|
255
|
+
const d = this.dialog.open(component, config);
|
|
256
|
+
d.afterOpened().pipe(first()).subscribe(() => this.pushDialog(d.id));
|
|
257
|
+
d.beforeClosed().pipe(first()).subscribe(() => this.popDialog(d.id));
|
|
258
|
+
return d;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Returns the element height including margins
|
|
262
|
+
* @param element - element
|
|
263
|
+
* @returns the height
|
|
264
|
+
*/
|
|
265
|
+
outerHeight(element) {
|
|
266
|
+
if (!SystemUtils.isBrowser())
|
|
267
|
+
return 0;
|
|
268
|
+
const height = element.offsetHeight;
|
|
269
|
+
const style = window.getComputedStyle(element);
|
|
270
|
+
return ['top', 'bottom']
|
|
271
|
+
.map(side => parseInt(style.getPropertyValue(`margin-${side}`), 10))
|
|
272
|
+
.reduce((total, margin) => total + margin, height);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Return current dialog height
|
|
276
|
+
*/
|
|
277
|
+
getCurrentDialogHeight() {
|
|
278
|
+
if (!SystemUtils.isBrowser())
|
|
279
|
+
return 0;
|
|
280
|
+
const count = this.popHistory.length;
|
|
281
|
+
if (count > 0) {
|
|
282
|
+
let id = this.popHistory[count - 1].id;
|
|
283
|
+
let elem = document.getElementById(id);
|
|
284
|
+
if (elem && elem.clientHeight > 0)
|
|
285
|
+
return elem.clientHeight;
|
|
286
|
+
}
|
|
287
|
+
return 0;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Returns the scrollable content area height for the topmost open dialog.
|
|
291
|
+
* @param fixedPartsClassName - CSS class names of fixed (non-scrollable) elements whose heights are subtracted.
|
|
292
|
+
* @param minimalHeight - Minimum height floor to use when the dialog height is smaller.
|
|
293
|
+
* @returns The computed scrollable height in pixels.
|
|
294
|
+
*/
|
|
295
|
+
getCurrentDialogScrollableHeight(fixedPartsClassName, minimalHeight) {
|
|
296
|
+
if (!SystemUtils.isBrowser())
|
|
297
|
+
return 0;
|
|
298
|
+
let h = Math.max(this.getCurrentDialogHeight(), minimalHeight);
|
|
299
|
+
if (fixedPartsClassName) {
|
|
300
|
+
fixedPartsClassName.forEach(n => {
|
|
301
|
+
const elems = document.getElementsByClassName(n);
|
|
302
|
+
if (elems) {
|
|
303
|
+
for (let i = 0; i < elems.length; i++) {
|
|
304
|
+
h -= this.outerHeight(elems[i]);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
return h;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Push a dialog into the browser history
|
|
313
|
+
*/
|
|
314
|
+
pushDialog(id) {
|
|
315
|
+
if (!SystemUtils.isBrowser())
|
|
316
|
+
return;
|
|
317
|
+
const index = history.length;
|
|
318
|
+
history.pushState({ index }, '', location.href + '#');
|
|
319
|
+
this.popHistory.push({ id, value: index });
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Pop a dialog from the history
|
|
323
|
+
*/
|
|
324
|
+
popDialog(id) {
|
|
325
|
+
if (!SystemUtils.isBrowser())
|
|
326
|
+
return;
|
|
327
|
+
if (this.popState) {
|
|
328
|
+
this.poppingState = true;
|
|
329
|
+
let popped = 1;
|
|
330
|
+
if (id) {
|
|
331
|
+
const p = this.popHistory.findIndex(n => n.id === id);
|
|
332
|
+
if (p !== -1) {
|
|
333
|
+
popped = this.popHistory[p].value - (history.state?.index ?? 0);
|
|
334
|
+
popped = popped ? popped + 1 : 1;
|
|
335
|
+
this.popHistory.splice(p, 1);
|
|
336
|
+
}
|
|
337
|
+
const url = location.href;
|
|
338
|
+
let l = url.length;
|
|
339
|
+
while (l >= 0 && url[l - 1] === '#' && popped > 0) {
|
|
340
|
+
l--;
|
|
341
|
+
popped--;
|
|
342
|
+
}
|
|
343
|
+
if (l < url.length)
|
|
344
|
+
history.replaceState({}, '', url.substring(0, l));
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
this.popState = true;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Shows a snack-bar toast notification.
|
|
351
|
+
* @param message - HTML message to display.
|
|
352
|
+
* @param duration - Visible duration in milliseconds. Defaults to `2000`.
|
|
353
|
+
* @param icon - Material icon name shown beside the message. Defaults to `'check'`.
|
|
354
|
+
* @param actionCaption - Optional label for the action button.
|
|
355
|
+
* @returns The snack-bar reference.
|
|
356
|
+
*/
|
|
357
|
+
toast(message, duration = 2000, icon = 'check', actionCaption) {
|
|
358
|
+
this.clearBusy();
|
|
359
|
+
if (duration === -1)
|
|
360
|
+
duration = 2000; // default
|
|
361
|
+
const toastRef = this.snackBar.openFromComponent(ToastComponent, {
|
|
362
|
+
duration,
|
|
363
|
+
data: { message, icon, actionCaption }
|
|
364
|
+
});
|
|
365
|
+
toastRef.instance.action.subscribe(() => toastRef.dismiss());
|
|
366
|
+
return toastRef;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Opens a confirmation dialog.
|
|
370
|
+
* @param message - HTML message to display.
|
|
371
|
+
* @param title - Dialog title. Defaults to `'Conferma'`.
|
|
372
|
+
* @param okCaption - Primary action button label. Defaults to `'Si'`.
|
|
373
|
+
* @param cancelCaption - Cancel button label. Defaults to `'No'`.
|
|
374
|
+
* @param otherCaption - Optional tertiary action button label.
|
|
375
|
+
* @param options - Optional list of checkbox options shown to the user.
|
|
376
|
+
* @param width - Maximum dialog width in pixels. Defaults to `500`.
|
|
377
|
+
* @param details - Optional secondary details text.
|
|
378
|
+
* @returns The dialog reference, or `null` outside the browser.
|
|
379
|
+
*/
|
|
380
|
+
confirm(message, title = 'Conferma', okCaption = 'Si', cancelCaption = 'No', otherCaption, options, width = 500, details) {
|
|
381
|
+
return this.open(ConfirmDialogComponent, {
|
|
382
|
+
ariaLabel: 'conferma',
|
|
383
|
+
autoFocus: 'dialog',
|
|
384
|
+
restoreFocus: false,
|
|
385
|
+
data: {
|
|
386
|
+
message,
|
|
387
|
+
title,
|
|
388
|
+
okCaption,
|
|
389
|
+
cancelCaption,
|
|
390
|
+
otherCaption,
|
|
391
|
+
options,
|
|
392
|
+
details,
|
|
393
|
+
appearance: this.appearance()
|
|
394
|
+
},
|
|
395
|
+
closeOnNavigation: false,
|
|
396
|
+
disableClose: true,
|
|
397
|
+
minWidth: '375px',
|
|
398
|
+
maxWidth: `${width}px`,
|
|
399
|
+
width: '100%'
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Opens a deletion-confirmation dialog.
|
|
404
|
+
* @param message - HTML message to display.
|
|
405
|
+
* @param title - Dialog title. Defaults to `'Attenzione'`.
|
|
406
|
+
* @param confirmMode - Confirmation mode (none / checkbox / type-to-confirm). Defaults to `None`.
|
|
407
|
+
* @param okCaption - Primary action button label. Defaults to `'Si'`.
|
|
408
|
+
* @param cancelCaption - Cancel button label. Defaults to `'No'`.
|
|
409
|
+
* @param width - Maximum dialog width in pixels. Defaults to `500`.
|
|
410
|
+
* @param details - Optional secondary details text.
|
|
411
|
+
* @returns The dialog reference, or `null` outside the browser.
|
|
412
|
+
*/
|
|
413
|
+
delete(message, title = 'Attenzione', confirmMode = DeleteDialogConfirmMode.None, okCaption = 'Si', cancelCaption = 'No', width = 500, details) {
|
|
414
|
+
return this.open(DeleteDialogComponent, {
|
|
415
|
+
ariaLabel: 'attenzione',
|
|
416
|
+
autoFocus: 'dialog',
|
|
417
|
+
restoreFocus: false,
|
|
418
|
+
data: {
|
|
419
|
+
message,
|
|
420
|
+
title,
|
|
421
|
+
confirmMode,
|
|
422
|
+
okCaption,
|
|
423
|
+
cancelCaption,
|
|
424
|
+
details,
|
|
425
|
+
appearance: this.appearance()
|
|
426
|
+
},
|
|
427
|
+
closeOnNavigation: false,
|
|
428
|
+
disableClose: true,
|
|
429
|
+
minWidth: '375px',
|
|
430
|
+
maxWidth: `${width}px`,
|
|
431
|
+
width: '100%'
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: DialogService, deps: [], target: i0.ɵɵFactoryTarget.Service }); }
|
|
435
|
+
static { this.ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.1.3", ngImport: i0, type: DialogService }); }
|
|
436
|
+
}
|
|
437
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: DialogService, decorators: [{
|
|
438
|
+
type: Service
|
|
439
|
+
}], ctorParameters: () => [] });
|
|
440
|
+
|
|
441
|
+
/*
|
|
442
|
+
* Public API Surface of @arsedizioni/ars-utils/ui.dialogs
|
|
443
|
+
*/
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Generated bundle index. Do not edit.
|
|
447
|
+
*/
|
|
448
|
+
|
|
449
|
+
export { ConfirmDialogComponent, DeleteDialogComponent, DeleteDialogConfirmMode, DialogService, ToastComponent };
|
|
450
|
+
//# sourceMappingURL=arsedizioni-ars-utils-ui.dialogs.mjs.map
|