@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,224 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ElementRef } from '@angular/core';
|
|
3
|
+
import { ControlValueAccessor, Validator, AbstractControl, ValidationErrors, NgForm } from '@angular/forms';
|
|
4
|
+
import { PasswordStrength } from '@arsedizioni/ars-utils/core';
|
|
5
|
+
import { CredentialsDialogResult, ResetPasswordDialogResult, RecoverPasswordDialogResult, PromptOtpDialogResult, PromptDialogData } from '@arsedizioni/ars-utils/ui';
|
|
6
|
+
import { MatFormFieldAppearance } from '@angular/material/form-field';
|
|
7
|
+
|
|
8
|
+
declare class OtpInputComponent implements ControlValueAccessor, Validator {
|
|
9
|
+
/** Signal-based query for all individual OTP digit input elements. */
|
|
10
|
+
readonly otpFields: _angular_core.Signal<readonly ElementRef<HTMLInputElement>[]>;
|
|
11
|
+
/** `true` when every digit slot contains a valid single decimal digit. */
|
|
12
|
+
readonly isValid: _angular_core.Signal<boolean>;
|
|
13
|
+
/** Array of per-digit values backing the OTP display. */
|
|
14
|
+
readonly otpArray: _angular_core.WritableSignal<string[]>;
|
|
15
|
+
/** Whether the control is currently disabled. */
|
|
16
|
+
readonly disabled: _angular_core.WritableSignal<boolean>;
|
|
17
|
+
private onChange;
|
|
18
|
+
private onTouched;
|
|
19
|
+
/**
|
|
20
|
+
* Writes a new value into the control from the model.
|
|
21
|
+
* @param value - A string of up to 6 digits to pre-fill the OTP fields.
|
|
22
|
+
*/
|
|
23
|
+
writeValue(value: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* Registers the callback invoked when the control value changes.
|
|
26
|
+
* @param fn - The callback function.
|
|
27
|
+
*/
|
|
28
|
+
registerOnChange(fn: (val: string) => void): void;
|
|
29
|
+
/**
|
|
30
|
+
* Registers the callback invoked when the control is touched.
|
|
31
|
+
* @param fn - The callback function.
|
|
32
|
+
*/
|
|
33
|
+
registerOnTouched(fn: () => void): void;
|
|
34
|
+
/**
|
|
35
|
+
* Enables or disables the control.
|
|
36
|
+
* @param isDisabled - `true` to disable all OTP inputs.
|
|
37
|
+
*/
|
|
38
|
+
setDisabledState(isDisabled: boolean): void;
|
|
39
|
+
/**
|
|
40
|
+
* Validates the OTP value: an empty code is left to `required`, while a
|
|
41
|
+
* PARTIAL code (e.g. "12") is reported as invalid. Without this, the joined
|
|
42
|
+
* value "12" was a non-empty string and `required` let the form submit
|
|
43
|
+
* with an incomplete OTP.
|
|
44
|
+
* @param control - The form control bound to this component.
|
|
45
|
+
* @returns `null` when empty or complete (6 digits), `{ otp: true }` otherwise.
|
|
46
|
+
*/
|
|
47
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
48
|
+
/**
|
|
49
|
+
* Marks the control as touched when an OTP field loses focus.
|
|
50
|
+
*/
|
|
51
|
+
onBlur(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Blocks non-digit characters before they are inserted.
|
|
54
|
+
* @param event - The `beforeinput` event from the input element.
|
|
55
|
+
*/
|
|
56
|
+
onBeforeInput(event: InputEvent): void;
|
|
57
|
+
/**
|
|
58
|
+
* Handles digit input, sanitizes it, syncs the DOM, updates the OTP array, and advances focus.
|
|
59
|
+
* @param event - The `input` event from the digit field.
|
|
60
|
+
* @param index - Zero-based index of the field that received input.
|
|
61
|
+
*/
|
|
62
|
+
onInput(event: Event, index: number): void;
|
|
63
|
+
/**
|
|
64
|
+
* Handles the Backspace key by moving focus to the previous field when the current one is empty.
|
|
65
|
+
* @param event - The `keydown` event.
|
|
66
|
+
* @param index - Zero-based index of the field that received the keydown.
|
|
67
|
+
*/
|
|
68
|
+
onKeyDown(event: KeyboardEvent, index: number): void;
|
|
69
|
+
/**
|
|
70
|
+
* Handles paste events by extracting up to 6 digits and distributing them across the OTP fields.
|
|
71
|
+
* @param event - The `ClipboardEvent` from the paste action.
|
|
72
|
+
*/
|
|
73
|
+
onPaste(event: ClipboardEvent): void;
|
|
74
|
+
/**
|
|
75
|
+
* Clears every digit field, propagates the empty value to the form model and
|
|
76
|
+
* moves focus back to the first field. Does not mark the control as touched,
|
|
77
|
+
* so no validation error is shown right after the reset.
|
|
78
|
+
*/
|
|
79
|
+
clear(): void;
|
|
80
|
+
/**
|
|
81
|
+
* Moves focus to the OTP field at the given index.
|
|
82
|
+
* @param index - Zero-based index of the target field.
|
|
83
|
+
*/
|
|
84
|
+
private focusField;
|
|
85
|
+
/**
|
|
86
|
+
* Notifies the form model of the current OTP value and marks the control as touched.
|
|
87
|
+
*/
|
|
88
|
+
private updateModel;
|
|
89
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<OtpInputComponent, never>;
|
|
90
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<OtpInputComponent, "otp-input", never, {}, {}, never, never, true, never>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Displays a password-strength indicator for the provided password string.
|
|
95
|
+
* Uses `SystemUtils.calculatePasswordStrength` to derive the score and label.
|
|
96
|
+
*/
|
|
97
|
+
declare class PasswordStrengthComponent {
|
|
98
|
+
/** The password to evaluate. An empty string renders the default (score 0) state. */
|
|
99
|
+
readonly password: _angular_core.InputSignal<string>;
|
|
100
|
+
/**
|
|
101
|
+
* Computed strength result for the current password.
|
|
102
|
+
* Falls back to `DEFAULT_STRENGTH` when the password is empty.
|
|
103
|
+
*/
|
|
104
|
+
protected readonly strength: _angular_core.Signal<PasswordStrength>;
|
|
105
|
+
/**
|
|
106
|
+
* CSS class applied to the label element based on the numeric score (1–6 bands).
|
|
107
|
+
* Scores ≤ 2 → `'score-2'`, ≤ 3 → `'score-3'`, etc.
|
|
108
|
+
*/
|
|
109
|
+
protected readonly scoreClass: _angular_core.Signal<string>;
|
|
110
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PasswordStrengthComponent, never>;
|
|
111
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PasswordStrengthComponent, "password-strength", never, { "password": { "alias": "password"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
interface CredentialsDialogData {
|
|
115
|
+
title?: string;
|
|
116
|
+
message?: string;
|
|
117
|
+
remember?: boolean;
|
|
118
|
+
recoverPassword?: boolean;
|
|
119
|
+
recoverPasswordUrl?: string;
|
|
120
|
+
user?: string;
|
|
121
|
+
okCaption?: string;
|
|
122
|
+
mode?: 'email' | 'user' | 'otp';
|
|
123
|
+
appearance?: MatFormFieldAppearance;
|
|
124
|
+
}
|
|
125
|
+
declare class CredentialsDialogComponent {
|
|
126
|
+
/** Emitted when the user submits the form. Carries the entered credentials. */
|
|
127
|
+
readonly done: _angular_core.OutputEmitterRef<CredentialsDialogResult>;
|
|
128
|
+
/** Emitted when the user requests a password-recovery flow. */
|
|
129
|
+
readonly recoveringPassword: _angular_core.OutputEmitterRef<CredentialsDialogResult>;
|
|
130
|
+
/** Dialog configuration with defaults applied at construction time. */
|
|
131
|
+
protected readonly dialogData: _angular_core.WritableSignal<CredentialsDialogData>;
|
|
132
|
+
/** Current form model, pre-filled with the user name from dialog data when provided. */
|
|
133
|
+
protected item: CredentialsDialogResult;
|
|
134
|
+
/** Whether the password field is currently shown as plain text. */
|
|
135
|
+
protected readonly showPassword: _angular_core.WritableSignal<boolean>;
|
|
136
|
+
/**
|
|
137
|
+
* Switches the input mode of the dialog at runtime (e.g. from login to OTP).
|
|
138
|
+
* Intended to be called from outside via the dialog component reference.
|
|
139
|
+
* @param mode - The new input mode (`'email'`, `'user'`, or `'otp'`).
|
|
140
|
+
* @param message - Optional new message to display above the form.
|
|
141
|
+
*/
|
|
142
|
+
changeMode(mode: 'email' | 'user' | 'otp', message?: string): void;
|
|
143
|
+
/**
|
|
144
|
+
* Emits the current form result and closes the dialog.
|
|
145
|
+
*/
|
|
146
|
+
protected ok(): void;
|
|
147
|
+
/**
|
|
148
|
+
* Emits the current form result for the password-recovery flow and optionally
|
|
149
|
+
* opens the recovery URL in a new tab.
|
|
150
|
+
*/
|
|
151
|
+
protected recoverPassword(): void;
|
|
152
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CredentialsDialogComponent, never>;
|
|
153
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CredentialsDialogComponent, "ng-component", never, {}, { "done": "done"; "recoveringPassword": "recoveringPassword"; }, never, never, true, never>;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
type ResetPasswordDialogMode = 'admin' | 'old' | 'otp' | 'forgot';
|
|
157
|
+
interface ResetPasswordDialogData {
|
|
158
|
+
mode: ResetPasswordDialogMode;
|
|
159
|
+
userId?: number;
|
|
160
|
+
userEmail?: string;
|
|
161
|
+
appearance?: MatFormFieldAppearance;
|
|
162
|
+
}
|
|
163
|
+
declare class ResetPasswordDialogComponent {
|
|
164
|
+
/** Emitted when the user submits the new password. Carries the entered password data. */
|
|
165
|
+
readonly done: _angular_core.OutputEmitterRef<ResetPasswordDialogResult>;
|
|
166
|
+
private readonly dialogService;
|
|
167
|
+
private readonly dialogRef;
|
|
168
|
+
/** Dialog configuration with defaults applied at construction time. */
|
|
169
|
+
protected readonly dialogData: _angular_core.WritableSignal<ResetPasswordDialogData>;
|
|
170
|
+
/** Current form model bound to the template inputs. */
|
|
171
|
+
protected item: ResetPasswordDialogResult;
|
|
172
|
+
/** Whether the old-password field is currently shown as plain text. */
|
|
173
|
+
protected readonly showOldPassword: _angular_core.WritableSignal<boolean>;
|
|
174
|
+
/** Whether the new-password field is currently shown as plain text. */
|
|
175
|
+
protected readonly showPassword: _angular_core.WritableSignal<boolean>;
|
|
176
|
+
/** Whether the confirm-password field is currently shown as plain text. */
|
|
177
|
+
protected readonly showPassword2: _angular_core.WritableSignal<boolean>;
|
|
178
|
+
constructor();
|
|
179
|
+
/**
|
|
180
|
+
* Emits the current form result to trigger the password-reset flow.
|
|
181
|
+
*/
|
|
182
|
+
protected ok(): void;
|
|
183
|
+
/**
|
|
184
|
+
* Generates a random password and populates both password fields with it.
|
|
185
|
+
*/
|
|
186
|
+
protected generatePassword(): void;
|
|
187
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ResetPasswordDialogComponent, never>;
|
|
188
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ResetPasswordDialogComponent, "ng-component", never, {}, { "done": "done"; }, never, never, true, never>;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
interface RecoverPasswordDialogData {
|
|
192
|
+
appearance?: MatFormFieldAppearance;
|
|
193
|
+
}
|
|
194
|
+
declare class RecoverPasswordDialogComponent {
|
|
195
|
+
/** Emitted when the user submits the recovery request. Carries the entered email and recaptcha state. */
|
|
196
|
+
readonly done: _angular_core.OutputEmitterRef<RecoverPasswordDialogResult>;
|
|
197
|
+
/** Dialog configuration with defaults applied at construction time. */
|
|
198
|
+
protected readonly dialogData: _angular_core.WritableSignal<RecoverPasswordDialogData>;
|
|
199
|
+
/** Current form model bound to the template inputs. */
|
|
200
|
+
protected item: RecoverPasswordDialogResult;
|
|
201
|
+
/**
|
|
202
|
+
* Emits the current form result to trigger the password-recovery flow.
|
|
203
|
+
*/
|
|
204
|
+
protected ok(): void;
|
|
205
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RecoverPasswordDialogComponent, never>;
|
|
206
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<RecoverPasswordDialogComponent, "ng-component", never, {}, { "done": "done"; }, never, never, true, never>;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
declare class PromptOtpDialogComponent {
|
|
210
|
+
readonly f: _angular_core.Signal<NgForm>;
|
|
211
|
+
readonly done: _angular_core.OutputEmitterRef<PromptOtpDialogResult>;
|
|
212
|
+
private readonly dialogService;
|
|
213
|
+
protected readonly dialogData: _angular_core.WritableSignal<PromptDialogData>;
|
|
214
|
+
protected value: any;
|
|
215
|
+
/**
|
|
216
|
+
* Validates the form and emits the OTP result, or shows an error if validation fails.
|
|
217
|
+
*/
|
|
218
|
+
protected ok(): void;
|
|
219
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PromptOtpDialogComponent, never>;
|
|
220
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PromptOtpDialogComponent, "ng-component", never, {}, { "done": "done"; }, never, never, true, never>;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export { CredentialsDialogComponent, OtpInputComponent, PasswordStrengthComponent, PromptOtpDialogComponent, RecoverPasswordDialogComponent, ResetPasswordDialogComponent };
|
|
224
|
+
export type { CredentialsDialogData, RecoverPasswordDialogData, ResetPasswordDialogData, ResetPasswordDialogMode };
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ComponentType } from '@angular/cdk/portal';
|
|
3
|
+
import { MatDialogConfig, MatDialogRef } from '@angular/material/dialog';
|
|
4
|
+
import { MatSnackBarRef } from '@angular/material/snack-bar';
|
|
5
|
+
import { ShellService } from '@arsedizioni/ars-utils/ui.shell';
|
|
6
|
+
import { DialogResult, DialogOption } from '@arsedizioni/ars-utils/ui';
|
|
7
|
+
import { MatFormFieldAppearance } from '@angular/material/form-field';
|
|
8
|
+
|
|
9
|
+
interface ConfirmDialogOption extends DialogOption {
|
|
10
|
+
}
|
|
11
|
+
interface ConfirmDialogData {
|
|
12
|
+
title?: string;
|
|
13
|
+
message: string;
|
|
14
|
+
okCaption?: string;
|
|
15
|
+
cancelCaption?: string;
|
|
16
|
+
otherCaption?: string;
|
|
17
|
+
options?: ConfirmDialogOption[];
|
|
18
|
+
details?: string;
|
|
19
|
+
}
|
|
20
|
+
declare class ConfirmDialogComponent {
|
|
21
|
+
/** Emitted when the user makes a choice. Carries the selected result and any option state. */
|
|
22
|
+
readonly choosen: _angular_core.OutputEmitterRef<DialogResult>;
|
|
23
|
+
private readonly dialogRef;
|
|
24
|
+
/** Dialog configuration, with sensible defaults applied at construction time. */
|
|
25
|
+
protected readonly dialogData: _angular_core.WritableSignal<ConfirmDialogData>;
|
|
26
|
+
constructor();
|
|
27
|
+
/**
|
|
28
|
+
* Confirms the dialog, emitting `'ok'` together with the current option selections.
|
|
29
|
+
*/
|
|
30
|
+
ok(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Cancels the dialog, emitting `'cancel'`.
|
|
33
|
+
*/
|
|
34
|
+
cancel(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Triggers the tertiary action, emitting `'other'`.
|
|
37
|
+
*/
|
|
38
|
+
other(): void;
|
|
39
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ConfirmDialogComponent, never>;
|
|
40
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ConfirmDialogComponent, "ng-component", never, {}, { "choosen": "choosen"; }, never, never, true, never>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare enum DeleteDialogConfirmMode {
|
|
44
|
+
None = 0,
|
|
45
|
+
Simple = 1,
|
|
46
|
+
Strong = 2
|
|
47
|
+
}
|
|
48
|
+
interface DeleteDialogData {
|
|
49
|
+
title?: string;
|
|
50
|
+
message: string;
|
|
51
|
+
confirmMode: DeleteDialogConfirmMode;
|
|
52
|
+
okCaption?: string;
|
|
53
|
+
cancelCaption?: string;
|
|
54
|
+
details?: string;
|
|
55
|
+
appearance?: MatFormFieldAppearance;
|
|
56
|
+
}
|
|
57
|
+
declare class DeleteDialogComponent {
|
|
58
|
+
/** Emitted when the user makes a choice. Carries the selected result. */
|
|
59
|
+
readonly choosen: _angular_core.OutputEmitterRef<DialogResult>;
|
|
60
|
+
private readonly dialogRef;
|
|
61
|
+
/** Dialog configuration with defaults applied at construction time. */
|
|
62
|
+
protected readonly dialogData: _angular_core.WritableSignal<DeleteDialogData>;
|
|
63
|
+
/**
|
|
64
|
+
* Whether the user has confirmed the deletion.
|
|
65
|
+
* Starts as `true` for all modes except `Simple`, which requires explicit checkbox confirmation.
|
|
66
|
+
*/
|
|
67
|
+
protected readonly confirmed: _angular_core.WritableSignal<boolean>;
|
|
68
|
+
/** Current value typed into the strong-confirmation text field. */
|
|
69
|
+
protected confirmValue?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Confirms the deletion, emitting `'ok'` and closing the dialog.
|
|
72
|
+
*/
|
|
73
|
+
ok(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Cancels the operation, emitting `'cancel'` and closing the dialog.
|
|
76
|
+
*/
|
|
77
|
+
cancel(): void;
|
|
78
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DeleteDialogComponent, never>;
|
|
79
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<DeleteDialogComponent, "ng-component", never, {}, { "choosen": "choosen"; }, never, never, true, never>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
interface ToastData {
|
|
83
|
+
message: string;
|
|
84
|
+
icon?: string;
|
|
85
|
+
actionCaption?: string;
|
|
86
|
+
}
|
|
87
|
+
declare class ToastComponent {
|
|
88
|
+
/** Emitted when the user clicks the optional action button. */
|
|
89
|
+
readonly action: _angular_core.OutputEmitterRef<void>;
|
|
90
|
+
/** Snack-bar payload with a safe fallback to an empty message when no data is injected. */
|
|
91
|
+
protected readonly dialogData: _angular_core.WritableSignal<ToastData>;
|
|
92
|
+
/**
|
|
93
|
+
* Emits the `action` event to notify the caller that the action button was clicked.
|
|
94
|
+
*/
|
|
95
|
+
protected do(): void;
|
|
96
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ToastComponent, never>;
|
|
97
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ToastComponent, "ng-component", never, {}, { "action": "action"; }, never, never, true, never>;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
interface IDialogService {
|
|
101
|
+
}
|
|
102
|
+
declare class DialogService extends ShellService {
|
|
103
|
+
private readonly uiService;
|
|
104
|
+
/**
|
|
105
|
+
* Shares the SAME `appearance` signal instance as the root `UIService`:
|
|
106
|
+
* `uiService.setAppearance('outline')` is immediately visible here and in
|
|
107
|
+
* every dialog opened by this service.
|
|
108
|
+
*
|
|
109
|
+
* Held by delegation and no longer by inheritance: this service now extends `ShellService`,
|
|
110
|
+
* which knows nothing about Material and must not, so the two members every caller uses of
|
|
111
|
+
* `UIService` are re-exposed here.
|
|
112
|
+
*/
|
|
113
|
+
readonly appearance: _angular_core.WritableSignal<"fill" | "outline">;
|
|
114
|
+
/**
|
|
115
|
+
* Updates the global form-field appearance.
|
|
116
|
+
* @param value - The new appearance value. Falls back to `'fill'` when `undefined` is passed.
|
|
117
|
+
* @returns void
|
|
118
|
+
*/
|
|
119
|
+
setAppearance(value: 'fill' | 'outline' | undefined): void;
|
|
120
|
+
private readonly dialog;
|
|
121
|
+
private readonly snackBar;
|
|
122
|
+
private readonly location;
|
|
123
|
+
private readonly popHistory;
|
|
124
|
+
private popState;
|
|
125
|
+
private poppingState;
|
|
126
|
+
constructor();
|
|
127
|
+
/**
|
|
128
|
+
* Lets the next `popstate` through without closing the topmost dialog.
|
|
129
|
+
*
|
|
130
|
+
* Back closing the dialog on top is the rule of this service, and its listener is registered in
|
|
131
|
+
* the constructor — so nothing attached later can get in front of it. A caller that owns a
|
|
132
|
+
* dismissable state of its own INSIDE a dialog (a full-screen editor, a picker covering the
|
|
133
|
+
* dialog, a wizard step) needs Back to unwind that state first, and this is the only way to ask
|
|
134
|
+
* for it: push a history entry, call this, and handle the pop.
|
|
135
|
+
*
|
|
136
|
+
* The suspension lasts exactly one `popstate` and is consumed whether or not the caller pushed
|
|
137
|
+
* an entry, so it can not leave the service permanently deaf to the Back button.
|
|
138
|
+
*/
|
|
139
|
+
suspendBackClose(): void;
|
|
140
|
+
/**
|
|
141
|
+
* Removes trailing `#` characters from the current URL (e.g. after a page reload).
|
|
142
|
+
* @param resetPoppingState - When `true`, resets the internal popping-state flag.
|
|
143
|
+
*/
|
|
144
|
+
clearUrl(resetPoppingState?: boolean): void;
|
|
145
|
+
/**
|
|
146
|
+
* Close all dialogs
|
|
147
|
+
*/
|
|
148
|
+
closeAll(): void;
|
|
149
|
+
/**
|
|
150
|
+
* Opens a Material dialog. Returns `null` when not running in a browser.
|
|
151
|
+
* @param component - The component to open as a dialog.
|
|
152
|
+
* @param config - The dialog configuration.
|
|
153
|
+
* @returns The dialog reference, or `null` outside the browser.
|
|
154
|
+
*/
|
|
155
|
+
open<T>(component: ComponentType<T>, config: MatDialogConfig<unknown>): MatDialogRef<T> | null;
|
|
156
|
+
/**
|
|
157
|
+
* Internal helper that wraps `MatDialog.open`, subscribes to lifecycle hooks
|
|
158
|
+
* and manages browser-history push/pop entries.
|
|
159
|
+
* @param component - The component to open.
|
|
160
|
+
* @param config - The dialog configuration.
|
|
161
|
+
* @returns The dialog reference.
|
|
162
|
+
*/
|
|
163
|
+
private openDialog;
|
|
164
|
+
/**
|
|
165
|
+
* Returns the element height including margins
|
|
166
|
+
* @param element - element
|
|
167
|
+
* @returns the height
|
|
168
|
+
*/
|
|
169
|
+
private outerHeight;
|
|
170
|
+
/**
|
|
171
|
+
* Return current dialog height
|
|
172
|
+
*/
|
|
173
|
+
getCurrentDialogHeight(): number;
|
|
174
|
+
/**
|
|
175
|
+
* Returns the scrollable content area height for the topmost open dialog.
|
|
176
|
+
* @param fixedPartsClassName - CSS class names of fixed (non-scrollable) elements whose heights are subtracted.
|
|
177
|
+
* @param minimalHeight - Minimum height floor to use when the dialog height is smaller.
|
|
178
|
+
* @returns The computed scrollable height in pixels.
|
|
179
|
+
*/
|
|
180
|
+
getCurrentDialogScrollableHeight(fixedPartsClassName: string[], minimalHeight: number): number;
|
|
181
|
+
/**
|
|
182
|
+
* Push a dialog into the browser history
|
|
183
|
+
*/
|
|
184
|
+
private pushDialog;
|
|
185
|
+
/**
|
|
186
|
+
* Pop a dialog from the history
|
|
187
|
+
*/
|
|
188
|
+
private popDialog;
|
|
189
|
+
/**
|
|
190
|
+
* Shows a snack-bar toast notification.
|
|
191
|
+
* @param message - HTML message to display.
|
|
192
|
+
* @param duration - Visible duration in milliseconds. Defaults to `2000`.
|
|
193
|
+
* @param icon - Material icon name shown beside the message. Defaults to `'check'`.
|
|
194
|
+
* @param actionCaption - Optional label for the action button.
|
|
195
|
+
* @returns The snack-bar reference.
|
|
196
|
+
*/
|
|
197
|
+
toast(message: string, duration?: number, icon?: string, actionCaption?: string): MatSnackBarRef<ToastComponent>;
|
|
198
|
+
/**
|
|
199
|
+
* Opens a confirmation dialog.
|
|
200
|
+
* @param message - HTML message to display.
|
|
201
|
+
* @param title - Dialog title. Defaults to `'Conferma'`.
|
|
202
|
+
* @param okCaption - Primary action button label. Defaults to `'Si'`.
|
|
203
|
+
* @param cancelCaption - Cancel button label. Defaults to `'No'`.
|
|
204
|
+
* @param otherCaption - Optional tertiary action button label.
|
|
205
|
+
* @param options - Optional list of checkbox options shown to the user.
|
|
206
|
+
* @param width - Maximum dialog width in pixels. Defaults to `500`.
|
|
207
|
+
* @param details - Optional secondary details text.
|
|
208
|
+
* @returns The dialog reference, or `null` outside the browser.
|
|
209
|
+
*/
|
|
210
|
+
confirm(message: string, title?: string, okCaption?: string, cancelCaption?: string, otherCaption?: string, options?: ConfirmDialogOption[], width?: number, details?: string): MatDialogRef<ConfirmDialogComponent> | null;
|
|
211
|
+
/**
|
|
212
|
+
* Opens a deletion-confirmation dialog.
|
|
213
|
+
* @param message - HTML message to display.
|
|
214
|
+
* @param title - Dialog title. Defaults to `'Attenzione'`.
|
|
215
|
+
* @param confirmMode - Confirmation mode (none / checkbox / type-to-confirm). Defaults to `None`.
|
|
216
|
+
* @param okCaption - Primary action button label. Defaults to `'Si'`.
|
|
217
|
+
* @param cancelCaption - Cancel button label. Defaults to `'No'`.
|
|
218
|
+
* @param width - Maximum dialog width in pixels. Defaults to `500`.
|
|
219
|
+
* @param details - Optional secondary details text.
|
|
220
|
+
* @returns The dialog reference, or `null` outside the browser.
|
|
221
|
+
*/
|
|
222
|
+
delete(message: string, title?: string, confirmMode?: DeleteDialogConfirmMode, okCaption?: string, cancelCaption?: string, width?: number, details?: string): MatDialogRef<DeleteDialogComponent> | null;
|
|
223
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DialogService, never>;
|
|
224
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<DialogService>;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export { ConfirmDialogComponent, DeleteDialogComponent, DeleteDialogConfirmMode, DialogService, ToastComponent };
|
|
228
|
+
export type { ConfirmDialogData, ConfirmDialogOption, DeleteDialogData, IDialogService, ToastData };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { PromptDialogResult, PromptDialogData, PromptDateDialogResult, PromptTimeDialogData } from '@arsedizioni/ars-utils/ui';
|
|
3
|
+
import { NgForm } from '@angular/forms';
|
|
4
|
+
|
|
5
|
+
declare class PromptDialogComponent {
|
|
6
|
+
readonly f: _angular_core.Signal<NgForm>;
|
|
7
|
+
readonly done: _angular_core.OutputEmitterRef<PromptDialogResult>;
|
|
8
|
+
private readonly dialogService;
|
|
9
|
+
protected readonly dialogData: _angular_core.WritableSignal<PromptDialogData>;
|
|
10
|
+
protected value: any;
|
|
11
|
+
/**
|
|
12
|
+
* Validates the form and emits the result, or shows an error if validation fails.
|
|
13
|
+
*/
|
|
14
|
+
protected ok(): void;
|
|
15
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PromptDialogComponent, never>;
|
|
16
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PromptDialogComponent, "ng-component", never, {}, { "done": "done"; }, never, never, true, never>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare class PromptDateDialogComponent {
|
|
20
|
+
readonly f: _angular_core.Signal<NgForm>;
|
|
21
|
+
readonly done: _angular_core.OutputEmitterRef<PromptDateDialogResult>;
|
|
22
|
+
private readonly dialogService;
|
|
23
|
+
protected readonly dialogData: _angular_core.WritableSignal<PromptDialogData>;
|
|
24
|
+
protected value: any;
|
|
25
|
+
/**
|
|
26
|
+
* Validates the form and emits the result, or shows an error if validation fails.
|
|
27
|
+
*/
|
|
28
|
+
protected ok(): void;
|
|
29
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PromptDateDialogComponent, never>;
|
|
30
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PromptDateDialogComponent, "ng-component", never, {}, { "done": "done"; }, never, never, true, never>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare class PromptTimeDialogComponent {
|
|
34
|
+
readonly f: _angular_core.Signal<NgForm>;
|
|
35
|
+
readonly done: _angular_core.OutputEmitterRef<PromptDialogResult>;
|
|
36
|
+
private readonly dialogService;
|
|
37
|
+
protected readonly dialogData: _angular_core.WritableSignal<PromptTimeDialogData>;
|
|
38
|
+
protected value: any;
|
|
39
|
+
/**
|
|
40
|
+
* Validates the form and emits the result, or shows an error if validation fails.
|
|
41
|
+
*/
|
|
42
|
+
protected ok(): void;
|
|
43
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PromptTimeDialogComponent, never>;
|
|
44
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PromptTimeDialogComponent, "ng-component", never, {}, { "done": "done"; }, never, never, true, never>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { PromptDateDialogComponent, PromptDialogComponent, PromptTimeDialogComponent };
|