@arsedizioni/ars-utils 22.6.85 → 22.6.88

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.
Files changed (79) hide show
  1. package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs +3158 -3344
  2. package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs.map +1 -1
  3. package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs +7616 -4772
  4. package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs.map +1 -1
  5. package/fesm2022/arsedizioni-ars-utils-core.date.mjs +321 -702
  6. package/fesm2022/arsedizioni-ars-utils-core.date.mjs.map +1 -1
  7. package/fesm2022/arsedizioni-ars-utils-core.markdown.mjs +445 -590
  8. package/fesm2022/arsedizioni-ars-utils-core.markdown.mjs.map +1 -1
  9. package/fesm2022/arsedizioni-ars-utils-core.mjs +1735 -2370
  10. package/fesm2022/arsedizioni-ars-utils-core.mjs.map +1 -1
  11. package/fesm2022/arsedizioni-ars-utils-core.validators.mjs +1280 -1470
  12. package/fesm2022/arsedizioni-ars-utils-core.validators.mjs.map +1 -1
  13. package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs +1097 -1528
  14. package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs.map +1 -1
  15. package/fesm2022/arsedizioni-ars-utils-support.common.mjs +198 -294
  16. package/fesm2022/arsedizioni-ars-utils-support.common.mjs.map +1 -1
  17. package/fesm2022/arsedizioni-ars-utils-ui.controls.date.mjs +115 -117
  18. package/fesm2022/arsedizioni-ars-utils-ui.controls.date.mjs.map +1 -1
  19. package/fesm2022/arsedizioni-ars-utils-ui.controls.mjs +1607 -613
  20. package/fesm2022/arsedizioni-ars-utils-ui.controls.mjs.map +1 -1
  21. package/fesm2022/arsedizioni-ars-utils-ui.controls.tree.mjs +840 -367
  22. package/fesm2022/arsedizioni-ars-utils-ui.controls.tree.mjs.map +1 -1
  23. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.auth.mjs +1634 -651
  24. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.auth.mjs.map +1 -1
  25. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.mjs +1255 -792
  26. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.mjs.map +1 -1
  27. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.prompt.mjs +1410 -357
  28. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.prompt.mjs.map +1 -1
  29. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.select.mjs +2401 -944
  30. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.select.mjs.map +1 -1
  31. package/fesm2022/arsedizioni-ars-utils-ui.files.mjs +1553 -741
  32. package/fesm2022/arsedizioni-ars-utils-ui.files.mjs.map +1 -1
  33. package/fesm2022/arsedizioni-ars-utils-ui.filters.mjs +901 -430
  34. package/fesm2022/arsedizioni-ars-utils-ui.filters.mjs.map +1 -1
  35. package/fesm2022/arsedizioni-ars-utils-ui.help.mjs +737 -530
  36. package/fesm2022/arsedizioni-ars-utils-ui.help.mjs.map +1 -1
  37. package/fesm2022/arsedizioni-ars-utils-ui.mjs +6638 -1755
  38. package/fesm2022/arsedizioni-ars-utils-ui.mjs.map +1 -1
  39. package/fesm2022/arsedizioni-ars-utils-ui.navigation.mjs +1479 -1207
  40. package/fesm2022/arsedizioni-ars-utils-ui.navigation.mjs.map +1 -1
  41. package/fesm2022/arsedizioni-ars-utils-ui.notifications.mjs +1003 -270
  42. package/fesm2022/arsedizioni-ars-utils-ui.notifications.mjs.map +1 -1
  43. package/fesm2022/arsedizioni-ars-utils-ui.oauth.mjs +497 -278
  44. package/fesm2022/arsedizioni-ars-utils-ui.oauth.mjs.map +1 -1
  45. package/fesm2022/arsedizioni-ars-utils-ui.paginator.mjs +48 -52
  46. package/fesm2022/arsedizioni-ars-utils-ui.paginator.mjs.map +1 -1
  47. package/fesm2022/arsedizioni-ars-utils-ui.shell.mjs +464 -704
  48. package/fesm2022/arsedizioni-ars-utils-ui.shell.mjs.map +1 -1
  49. package/fesm2022/arsedizioni-ars-utils-ui.tinymce.mjs +724 -657
  50. package/fesm2022/arsedizioni-ars-utils-ui.tinymce.mjs.map +1 -1
  51. package/fesm2022/arsedizioni-ars-utils.mjs +3 -19
  52. package/fesm2022/arsedizioni-ars-utils.mjs.map +1 -1
  53. package/package.json +1 -1
  54. package/types/arsedizioni-ars-utils-clipper.common.d.ts +1151 -1163
  55. package/types/arsedizioni-ars-utils-clipper.ui.d.ts +1588 -1426
  56. package/types/arsedizioni-ars-utils-core.d.ts +1169 -1172
  57. package/types/arsedizioni-ars-utils-core.date.d.ts +204 -208
  58. package/types/arsedizioni-ars-utils-core.markdown.d.ts +128 -126
  59. package/types/arsedizioni-ars-utils-core.validators.d.ts +270 -236
  60. package/types/arsedizioni-ars-utils-evolution.common.d.ts +1054 -1067
  61. package/types/arsedizioni-ars-utils-support.common.d.ts +225 -234
  62. package/types/arsedizioni-ars-utils-ui.controls.d.ts +440 -278
  63. package/types/arsedizioni-ars-utils-ui.controls.date.d.ts +24 -28
  64. package/types/arsedizioni-ars-utils-ui.controls.tree.d.ts +172 -136
  65. package/types/arsedizioni-ars-utils-ui.d.ts +2035 -821
  66. package/types/arsedizioni-ars-utils-ui.dialogs.auth.d.ts +327 -322
  67. package/types/arsedizioni-ars-utils-ui.dialogs.d.ts +343 -347
  68. package/types/arsedizioni-ars-utils-ui.dialogs.prompt.d.ts +167 -167
  69. package/types/arsedizioni-ars-utils-ui.dialogs.select.d.ts +373 -367
  70. package/types/arsedizioni-ars-utils-ui.files.d.ts +335 -283
  71. package/types/arsedizioni-ars-utils-ui.filters.d.ts +232 -160
  72. package/types/arsedizioni-ars-utils-ui.help.d.ts +204 -211
  73. package/types/arsedizioni-ars-utils-ui.navigation.d.ts +811 -646
  74. package/types/arsedizioni-ars-utils-ui.notifications.d.ts +74 -78
  75. package/types/arsedizioni-ars-utils-ui.oauth.d.ts +102 -62
  76. package/types/arsedizioni-ars-utils-ui.paginator.d.ts +19 -22
  77. package/types/arsedizioni-ars-utils-ui.shell.d.ts +376 -382
  78. package/types/arsedizioni-ars-utils-ui.tinymce.d.ts +244 -231
  79. package/types/arsedizioni-ars-utils.d.ts +1 -3
@@ -1,742 +1,1554 @@
1
- import { coerceBooleanProperty } from '@angular/cdk/coercion';
2
- import * as i0 from '@angular/core';
3
- import { viewChild, inject, Renderer2, signal, model, input, output, effect, afterNextRender, Input, Optional, Self, ChangeDetectionStrategy, Component, DestroyRef } from '@angular/core';
4
- import { form, required, disabled, FormField } from '@angular/forms/signals';
5
- import { SignalsUtils, notEmpty, fileSize } from '@arsedizioni/ars-utils/core.validators';
6
- import * as i2 from '@angular/material/form-field';
7
- import { MatFormFieldModule, MatFormFieldControl } from '@angular/material/form-field';
8
- import { FileInfo, SystemUtils, SafeUrlPipe, SafeHtmlPipe } from '@arsedizioni/ars-utils/core';
9
- import { Subject } from 'rxjs';
10
- import * as i6 from '@angular/material/tooltip';
11
- import { MatTooltipModule } from '@angular/material/tooltip';
12
- import * as i5 from '@angular/material/icon';
13
- import { MatIconModule } from '@angular/material/icon';
14
- import * as i2$1 from '@angular/material/button';
15
- import { MatButtonModule } from '@angular/material/button';
16
- import * as i3 from '@angular/material/input';
17
- import { MatInputModule } from '@angular/material/input';
18
- import * as i1$1 from '@arsedizioni/ars-utils/ui';
19
- import { UIService, FlexLayoutModule } from '@arsedizioni/ars-utils/ui';
20
- import * as i1 from '@angular/forms';
21
- import { HttpClient, HttpHeaders } from '@angular/common/http';
22
- import { ShellService } from '@arsedizioni/ars-utils/ui.shell';
23
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
24
- import { MAT_DIALOG_DATA, MatDialogContent, MatDialogActions, MatDialogClose, MatDialogRef, MatDialogTitle } from '@angular/material/dialog';
25
- import * as i3$1 from '@angular/material/checkbox';
26
- import { MatCheckboxModule } from '@angular/material/checkbox';
27
-
28
- class FileInputComponent {
29
- // Initialize
30
- static { this.nextId = 0; }
31
- set value(value) {
32
- this.setValue(value, true);
33
- }
34
- /**
35
- * Updates the internal state. Form propagation is skipped for model->view
36
- * writes (writeValue) to avoid the CVA echo loop, and performed for
37
- * user-driven changes (selectFile/clearFile) and the public value setter.
38
- * @param value - The new file info to store and display.
39
- * @param propagate - When `true`, notifies the registered onChange callback.
40
- */
41
- setValue(value, propagate) {
42
- this._value = value;
43
- if (propagate) {
44
- this.propagateChange(this._value);
45
- }
46
- this.stateChanges.next();
47
- this.changed.emit(this._value);
48
- }
49
- get value() {
50
- return this._value;
51
- }
52
- get size() {
53
- return this._value?.file?.size;
54
- }
55
- get required() {
56
- return this._required();
57
- }
58
- set required(value) {
59
- this._required.set(coerceBooleanProperty(value));
60
- this.stateChanges.next();
61
- }
62
- get disabled() {
63
- if (this.ngControl && this.ngControl.disabled != null) {
64
- return this.ngControl.disabled;
65
- }
66
- return this._disabled();
67
- }
68
- set disabled(value) {
69
- this._disabled.set(coerceBooleanProperty(value));
70
- if (this.focused) {
71
- this.focused = false;
72
- this.stateChanges.next();
73
- }
74
- }
75
- get placeholder() {
76
- return this._placeholder();
77
- }
78
- set placeholder(value) {
79
- this._placeholder.set(value);
80
- this.stateChanges.next();
81
- }
82
- get empty() {
83
- return !this._value || !this._value.file;
84
- }
85
- /** True when the control has validation errors and has been touched. */
86
- get errorState() {
87
- return (this.ngControl?.errors != null) && (this.ngControl?.touched ?? false);
88
- }
89
- /** True when the label should float above the field. */
90
- get shouldLabelFloat() {
91
- return this.focused || !this.empty;
92
- }
93
- constructor(ngControl) {
94
- this.ngControl = ngControl;
95
- /** Error text of a field: the message declared in the schema, or the shared fallback. */
96
- this.getErrorMessage = SignalsUtils.getFieldErrorMessage;
97
- /** Reference to the hidden native file input element. */
98
- this.__file = viewChild.required('__file', /* @ts-ignore */
99
- ...(ngDevMode ? [{ debugName: "__file" }] : /* istanbul ignore next */ []));
100
- this.renderer = inject(Renderer2);
101
- this.uiService = inject(UIService);
102
- this.stateChanges = new Subject();
103
- this.controlType = 'file-input';
104
- this.focused = false;
105
- /** Whether the device supports camera capture. */
106
- this.canCapture = signal(false, /* @ts-ignore */
107
- ...(ngDevMode ? [{ debugName: "canCapture" }] : /* istanbul ignore next */ []));
108
- /** Size in MB of the currently selected file. */
109
- this.fileSize = signal(0, /* @ts-ignore */
110
- ...(ngDevMode ? [{ debugName: "fileSize" }] : /* istanbul ignore next */ []));
111
- this._placeholder = signal('', /* @ts-ignore */
112
- ...(ngDevMode ? [{ debugName: "_placeholder" }] : /* istanbul ignore next */ []));
113
- this._value = new FileInfo();
114
- /** Backing signal so the internal form schema reacts to `required` changes. */
115
- this._required = signal(false, /* @ts-ignore */
116
- ...(ngDevMode ? [{ debugName: "_required" }] : /* istanbul ignore next */ []));
117
- /** Backing signal so the internal form schema reacts to `disabled` changes. */
118
- this._disabled = signal(false, /* @ts-ignore */
119
- ...(ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []));
120
- /** The currently displayed file name. Can be bound two-way from outside or updated on file selection. */
121
- this.fileName = model(undefined, /* @ts-ignore */
122
- ...(ngDevMode ? [{ debugName: "fileName" }] : /* istanbul ignore next */ []));
123
- this.maxSizeMb = input(5, /* @ts-ignore */
124
- ...(ngDevMode ? [{ debugName: "maxSizeMb" }] : /* istanbul ignore next */ []));
125
- this.minSizeMb = input(0, /* @ts-ignore */
126
- ...(ngDevMode ? [{ debugName: "minSizeMb" }] : /* istanbul ignore next */ []));
127
- this.isNew = input(false, /* @ts-ignore */
128
- ...(ngDevMode ? [{ debugName: "isNew" }] : /* istanbul ignore next */ []));
129
- this.canPreview = input(false, /* @ts-ignore */
130
- ...(ngDevMode ? [{ debugName: "canPreview" }] : /* istanbul ignore next */ []));
131
- this.appearance = input(this.uiService.appearance(), /* @ts-ignore */
132
- ...(ngDevMode ? [{ debugName: "appearance" }] : /* istanbul ignore next */ []));
133
- this.accept = input(/* @ts-ignore */
134
- ...(ngDevMode ? [undefined, { debugName: "accept" }] : /* istanbul ignore next */ []));
135
- this.id = `${this.controlType}-${FileInputComponent.nextId++}`;
136
- this.describedBy = '';
137
- this.changed = output();
138
- this.download = output();
139
- this.preview = output();
140
- /** Model backing the internal display form: the (readonly) file-name text. */
141
- this.nameModel = signal({ name: '' }, /* @ts-ignore */
142
- ...(ngDevMode ? [{ debugName: "nameModel" }] : /* istanbul ignore next */ []));
143
- /**
144
- * Internal signal form for the file-name input. It reproduces the previous
145
- * template-driven validators: `required` follows the `required` input and the
146
- * size rule mirrors FileSizeValidatorDirective (empty name is left to `required`).
147
- */
148
- this.nameForm = form(this.nameModel, p => {
149
- required(p.name, { when: () => this._required() });
150
- notEmpty(p.name, { when: () => this._required() });
151
- // The outer-form path is covered by setDisabledState, which writes the DOM directly.
152
- disabled(p.name, () => this._disabled());
153
- // The shared rule, so the message comes from the same table as everywhere else.
154
- fileSize(p.name, () => this.fileSize(), () => this.maxSizeMb(), () => this.minSizeMb());
155
- });
156
- this.propagateChange = (_) => { };
157
- this.propagateTouched = () => { };
158
- if (this.ngControl != null) {
159
- this.ngControl.valueAccessor = this;
160
- }
161
- // Keep the internal form model in sync with the two-way bindable fileName.
162
- effect(() => this.nameModel.set({ name: this.fileName() ?? '' }));
163
- // Detect camera availability and set the default placeholder after the first render.
164
- // The file-name input is also made read-only imperatively: marking the field as
165
- // readonly in the form schema would skip its validation entirely by design.
166
- afterNextRender(() => {
167
- this.setupDevices();
168
- const elem = document.getElementById(this.id);
169
- if (elem) {
170
- this.renderer.setProperty(elem, 'readOnly', true);
171
- }
172
- });
173
- }
174
- /**
175
- * Detects camera availability and updates the placeholder accordingly.
176
- */
177
- async setupDevices() {
178
- this.canCapture.set(false);
179
- if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
180
- try {
181
- const stream = await navigator.mediaDevices.getUserMedia({ video: true });
182
- if (stream) {
183
- this.canCapture.set(true);
184
- }
185
- }
186
- catch { }
187
- }
188
- if (!this.placeholder || this.placeholder === 'Seleziona file') {
189
- this._placeholder.set(this.canCapture()
190
- ? 'Seleziona file o acquisisci con fotocamera'
191
- : 'Seleziona file');
192
- }
193
- }
194
- ngOnDestroy() {
195
- this.stateChanges.complete();
196
- }
197
- ngDoCheck() {
198
- this.updateInputDirtyCheck();
199
- }
200
- /**
201
- * Writes a new value to the component (called by the form layer).
202
- * @param value - The new file info to display.
203
- */
204
- writeValue(value) {
205
- // Model -> view write: must NOT propagate back to the form (echo loop)
206
- this.setValue(value, false);
207
- }
208
- /**
209
- * Registers the on-change callback (called by the form layer).
210
- * @param fn - Callback to invoke whenever the value changes.
211
- */
212
- registerOnChange(fn) {
213
- this.propagateChange = fn;
214
- }
215
- /**
216
- * Registers the on-touched callback (called by the form layer).
217
- * @param fn - Callback to invoke when the control is touched.
218
- */
219
- registerOnTouched(fn) {
220
- this.propagateTouched = fn;
221
- }
222
- /**
223
- * Sets the ARIA describedby attribute from the given element IDs.
224
- * @param ids - Array of element IDs that describe this control.
225
- */
226
- setDescribedByIds(ids) {
227
- this.describedBy = ids.join(' ');
228
- }
229
- /**
230
- * Updates the disabled state of the underlying native element.
231
- * @param isDisabled - Whether the control should be disabled.
232
- */
233
- setDisabledState(isDisabled) {
234
- this._disabled.set(isDisabled);
235
- if (!SystemUtils.isBrowser())
236
- return;
237
- const elem = document.getElementById(this.id);
238
- if (elem) {
239
- this.renderer.setProperty(elem, 'disabled', isDisabled);
240
- }
241
- }
242
- /** Focuses the native input element and marks the control as touched. */
243
- onContainerClick() {
244
- if (!this.focused) {
245
- if (!SystemUtils.isBrowser())
246
- return;
247
- const elem = document.getElementById(this.id);
248
- if (elem) {
249
- elem.focus();
250
- this.propagateTouched();
251
- }
252
- }
253
- }
254
- /**
255
- * Checks whether the value has changed since the last dirty check and emits `stateChanges` if needed.
256
- */
257
- updateInputDirtyCheck() {
258
- const newValue = this._value;
259
- if (this.previousNativeValue !== newValue) {
260
- this.previousNativeValue = newValue;
261
- this.stateChanges.next();
262
- }
263
- }
264
- /**
265
- * Handles file selection from the native input element.
266
- * @param e - The DOM change event from the file input.
267
- */
268
- selectFile(e) {
269
- const input = e.target;
270
- if (input.files?.length) {
271
- const f = input.files[0];
272
- const fileInfo = new FileInfo();
273
- const fileSizeMb = f.size / 1048576;
274
- fileInfo.file = f;
275
- fileInfo.valid =
276
- (!this.maxSizeMb() || fileSizeMb <= this.maxSizeMb()) &&
277
- (!this.minSizeMb() || fileSizeMb >= this.minSizeMb());
278
- this.setValue(fileInfo, true);
279
- this.fileName.set(f.name);
280
- this.fileSize.set(Math.round(fileSizeMb));
281
- }
282
- }
283
- /**
284
- * Checks whether a file is currently selected.
285
- * @returns `true` if a file is attached to the current value.
286
- */
287
- hasFile() {
288
- return !!(this._value?.file);
289
- }
290
- /**
291
- * Clears the currently selected file and resets the control.
292
- */
293
- clearFile() {
294
- if (this.hasFile()) {
295
- this.fileName.set(undefined);
296
- this.fileSize.set(0);
297
- const fi = new FileInfo();
298
- fi.file = undefined;
299
- fi.valid = !this.required;
300
- this.setValue(fi, true);
301
- this.__file().nativeElement.value = '';
302
- }
303
- }
304
- /**
305
- * Emits the `download` output event if the file is not newly added.
306
- */
307
- downloadFile() {
308
- if (!this.isNew())
309
- this.download.emit();
310
- }
311
- /**
312
- * Emits the `preview` output event if the file is not new and preview is enabled.
313
- */
314
- previewFile() {
315
- if (!this.isNew() && this.canPreview())
316
- this.preview.emit();
317
- }
318
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: FileInputComponent, deps: [{ token: i1.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component }); }
319
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: FileInputComponent, isStandalone: true, selector: "file-input", inputs: { required: { classPropertyName: "required", publicName: "required", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: false, isRequired: false, transformFunction: null }, fileName: { classPropertyName: "fileName", publicName: "fileName", isSignal: true, isRequired: false, transformFunction: null }, maxSizeMb: { classPropertyName: "maxSizeMb", publicName: "maxSizeMb", isSignal: true, isRequired: false, transformFunction: null }, minSizeMb: { classPropertyName: "minSizeMb", publicName: "minSizeMb", isSignal: true, isRequired: false, transformFunction: null }, isNew: { classPropertyName: "isNew", publicName: "isNew", isSignal: true, isRequired: false, transformFunction: null }, canPreview: { classPropertyName: "canPreview", publicName: "canPreview", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { fileName: "fileNameChange", changed: "changed", download: "download", preview: "preview" }, host: { properties: { "id": "id", "class.floating": "shouldLabelFloat", "attr.aria-describedBy": "describedBy" } }, providers: [{ provide: MatFormFieldControl, useExisting: FileInputComponent }], viewQueries: [{ propertyName: "__file", first: true, predicate: ["__file"], descendants: true, isSignal: true }], ngImport: i0, template: "<mat-form-field style=\"width:100%\" [appearance]=\"appearance()\">\n <mat-label>{{placeholder}}</mat-label>\n <input type=\"file\" [hidden]=\"true\" [accept]=\"accept()\" (change)=\"selectFile($event)\" #__file />\n <input [formField]=\"nameForm.name\" [id]=\"id\" matInput />\n @if (hasFile()) {\n <button type=\"button\" tabindex=\"-1\" mat-icon-button matSuffix aria-label=\"Azzera\" (click)=\"clearFile()\" [disabled]=\"disabled\">\n <mat-icon>close</mat-icon>\n </button>\n }\n @if (!disabled) {\n <button type=\"button\" type=\"button\" mat-icon-button matSuffix (click)=\"__file.click()\" aria-label=\"Seleziona file\"\n matTooltip=\"Seleziona\" [disabled]=\"disabled\">\n <mat-icon>add</mat-icon>\n </button>\n }\n @if (!isNew() && canPreview()) {\n <button type=\"button\" mat-icon-button matSuffix (click)=\"previewFile()\" aria-label=\"Anteprima\" matTooltip=\"Anteprima\" [disabled]=\"disabled\">\n <mat-icon>preview</mat-icon>\n </button>\n }\n @if (!isNew()) {\n <button type=\"button\" mat-icon-button matSuffix (click)=\"downloadFile()\" aria-label=\"Scarica file\"\n matTooltip=\"Scarica\" [disabled]=\"disabled\">\n <mat-icon>save_alt</mat-icon>\n </button>\n }\n @if (hasFile() && fileSize() > 0) {\n <mat-hint align=\"start\">{{fileSize()}} MB</mat-hint>\n }\n @if (hasFile() && fileSize() == 0) {\n <mat-hint align=\"start\">\n &gt; 1 MB</mat-hint>\n } @if (maxSizeMb()) {\n <mat-hint align=\"end\">Massimo {{maxSizeMb()}} MB\n </mat-hint>\n }\n @if (nameForm.name().invalid()) {\n <mat-error>{{ getErrorMessage(nameForm.name().errors()) }}</mat-error>\n }\n</mat-form-field>", styles: [""], dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.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: "directive", type: FormField, selector: "[formField]", inputs: ["formField"], exportAs: ["formField"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$1.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i6.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
320
- }
321
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: FileInputComponent, decorators: [{
322
- type: Component,
323
- args: [{ selector: 'file-input', providers: [{ provide: MatFormFieldControl, useExisting: FileInputComponent }], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatFormFieldModule, MatInputModule, FormField, MatButtonModule,
324
- MatIconModule, MatTooltipModule], host: {
325
- '[id]': 'id',
326
- '[class.floating]': 'shouldLabelFloat',
327
- '[attr.aria-describedBy]': 'describedBy',
328
- }, template: "<mat-form-field style=\"width:100%\" [appearance]=\"appearance()\">\n <mat-label>{{placeholder}}</mat-label>\n <input type=\"file\" [hidden]=\"true\" [accept]=\"accept()\" (change)=\"selectFile($event)\" #__file />\n <input [formField]=\"nameForm.name\" [id]=\"id\" matInput />\n @if (hasFile()) {\n <button type=\"button\" tabindex=\"-1\" mat-icon-button matSuffix aria-label=\"Azzera\" (click)=\"clearFile()\" [disabled]=\"disabled\">\n <mat-icon>close</mat-icon>\n </button>\n }\n @if (!disabled) {\n <button type=\"button\" type=\"button\" mat-icon-button matSuffix (click)=\"__file.click()\" aria-label=\"Seleziona file\"\n matTooltip=\"Seleziona\" [disabled]=\"disabled\">\n <mat-icon>add</mat-icon>\n </button>\n }\n @if (!isNew() && canPreview()) {\n <button type=\"button\" mat-icon-button matSuffix (click)=\"previewFile()\" aria-label=\"Anteprima\" matTooltip=\"Anteprima\" [disabled]=\"disabled\">\n <mat-icon>preview</mat-icon>\n </button>\n }\n @if (!isNew()) {\n <button type=\"button\" mat-icon-button matSuffix (click)=\"downloadFile()\" aria-label=\"Scarica file\"\n matTooltip=\"Scarica\" [disabled]=\"disabled\">\n <mat-icon>save_alt</mat-icon>\n </button>\n }\n @if (hasFile() && fileSize() > 0) {\n <mat-hint align=\"start\">{{fileSize()}} MB</mat-hint>\n }\n @if (hasFile() && fileSize() == 0) {\n <mat-hint align=\"start\">\n &gt; 1 MB</mat-hint>\n } @if (maxSizeMb()) {\n <mat-hint align=\"end\">Massimo {{maxSizeMb()}} MB\n </mat-hint>\n }\n @if (nameForm.name().invalid()) {\n <mat-error>{{ getErrorMessage(nameForm.name().errors()) }}</mat-error>\n }\n</mat-form-field>" }]
329
- }], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
330
- type: Optional
331
- }, {
332
- type: Self
333
- }] }], propDecorators: { __file: [{ type: i0.ViewChild, args: ['__file', { isSignal: true }] }], required: [{
334
- type: Input
335
- }], disabled: [{
336
- type: Input
337
- }], placeholder: [{
338
- type: Input
339
- }], fileName: [{ type: i0.Input, args: [{ isSignal: true, alias: "fileName", required: false }] }, { type: i0.Output, args: ["fileNameChange"] }], maxSizeMb: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSizeMb", required: false }] }], minSizeMb: [{ type: i0.Input, args: [{ isSignal: true, alias: "minSizeMb", required: false }] }], isNew: [{ type: i0.Input, args: [{ isSignal: true, alias: "isNew", required: false }] }], canPreview: [{ type: i0.Input, args: [{ isSignal: true, alias: "canPreview", required: false }] }], appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], changed: [{ type: i0.Output, args: ["changed"] }], download: [{ type: i0.Output, args: ["download"] }], preview: [{ type: i0.Output, args: ["preview"] }] } });
340
-
341
- class FilePreviewComponent {
342
- constructor() {
343
- this.iframe = viewChild('iframe', /* @ts-ignore */
344
- ...(ngDevMode ? [{ debugName: "iframe" }] : /* istanbul ignore next */ []));
345
- this.httpClient = inject(HttpClient);
346
- this.dialogService = inject(ShellService);
347
- this.dialogData = inject(MAT_DIALOG_DATA) ?? {};
348
- this.url = signal(null, /* @ts-ignore */
349
- ...(ngDevMode ? [{ debugName: "url" }] : /* istanbul ignore next */ []));
350
- // Revoke the blob object URL on destroy: createObjectURL keeps the whole
351
- // downloaded blob alive until revoked — repeated previews leaked memory.
352
- inject(DestroyRef).onDestroy(() => {
353
- const u = this.url();
354
- if (u?.startsWith('blob:'))
355
- URL.revokeObjectURL(u);
356
- });
357
- const data = this.dialogData;
358
- if (!data?.url)
359
- return;
360
- if (!data.embed) {
361
- this.dialogService.setBusy('Download in corso...');
362
- this.httpClient.get(data.url, {
363
- headers: data.authToken
364
- ? new HttpHeaders().set('Authorization', data.authToken)
365
- : new HttpHeaders(),
366
- responseType: 'blob'
367
- })
368
- .pipe(takeUntilDestroyed())
369
- .subscribe({
370
- next: (res) => {
371
- this.url.set(URL.createObjectURL(res));
372
- this.dialogService.clearBusy();
373
- },
374
- error: () => {
375
- this.dialogService.clearBusy();
376
- }
377
- });
378
- }
379
- else {
380
- this.url.set('https://view.officeapps.live.com/op/embed.aspx?src=' + encodeURIComponent(data.url));
381
- }
382
- }
383
- /**
384
- * Handles the iframe load event: scrolls to the top and centers a single image when present.
385
- */
386
- loaded() {
387
- const iframe = this.iframe()?.nativeElement;
388
- if (!iframe) {
389
- return;
390
- }
391
- try {
392
- iframe.contentWindow?.scrollTo(0, 0);
393
- // Resize and center single image
394
- if (!this.dialogData?.embed && iframe.contentDocument) {
395
- const images = iframe.contentDocument.querySelectorAll('img') || [];
396
- if (images.length === 1) {
397
- Object.assign(images[0].style, {
398
- position: 'absolute',
399
- top: '50%',
400
- left: '50%',
401
- transform: 'translate(-50%, -50%)',
402
- maxWidth: images[0].style.maxWidth || '100%',
403
- maxHeight: images[0].style.maxHeight || '100%'
404
- });
405
- const iframeBody = iframe.contentDocument.body;
406
- if (iframeBody && !iframeBody.style.height) {
407
- iframeBody.style.height = '100%';
408
- }
409
- }
410
- }
411
- }
412
- catch (e) {
413
- console.error('Impossibile accedere al contenuto dell\'iframe:', e);
414
- }
415
- }
416
- /**
417
- * Opens the current file URL in a new browser tab for manual download.
418
- */
419
- download() {
420
- const currentUrl = this.url();
421
- if (currentUrl) {
422
- window.open(currentUrl, '_blank');
423
- }
424
- }
425
- /**
426
- * Displays a help dialog with browser-specific instructions for enabling PDF preview.
427
- */
428
- troubles() {
429
- this.dialogService.info("<p>Se non riesci a visualizzare l'anteprima dei file PDF probabilmente devi abilitare un'impostazione del tuo browser.</p>" +
430
- "<b>Per Google Chrome</b><br>" +
431
- "<p class='small' style='padding-left:10px'><i>impostazioni > privacy e sicurezza > impostazioni sito > documenti PDF</i></p>" +
432
- "<b>Per Microsoft Edge</b><br>" +
433
- "<p class='small' style='padding-left:10px'><i>impostazioni > cookie e autorizzazioni sito > documenti PDF</i></p>" +
434
- "<b>Per Mozilla Firefox</b><br>" +
435
- "<p class='small' style='padding-left:10px'><i>impostazioni > generale > applicazioni</i></p>" +
436
- "<b>Altri browser</b><br>" +
437
- "<p class='small' style='padding-left:10px'>Fate riferimento alla documentazione specifica del vostro browser.</p>", "Problemi con le anteprime dei file PDF?");
438
- }
439
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: FilePreviewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
440
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: FilePreviewComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "iframe", first: true, predicate: ["iframe"], descendants: true, isSignal: true }], ngImport: i0, template: "<mat-dialog-content class=\"file-preview\" id=\"file-preview-scrollable\">\r\n <div class=\"content\">\r\n @if (!url()) {\r\n <div class=\"loading\">Caricamento in corso...</div>\r\n } @else {\r\n <iframe class=\"iframe\" #iframe (load)=\"loaded()\" [src]=\"url() | safeUrl\"></iframe>\r\n }\r\n </div>\r\n</mat-dialog-content>\r\n<mat-dialog-actions id=\"file-preview-fixed\">\r\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\" fxLayoutGap=\"10px\" fxFill>\r\n <div fxFlex=\"50\">\r\n <button mat-stroked-button (click)=\"troubles()\"\r\n matTooltip=\"Fai click se non riesci a visualizzare l'anteprima dei file PDF\">Problemi con i PDF?</button>\r\n </div>\r\n <div fxFlex=\"50\" fxLayoutAlign=\"end\">\r\n <button mat-stroked-button (click)=\"download()\">Scarica</button>\r\n <button mat-stroked-button [mat-dialog-close]=\"true\" >Chiudi</button>\r\n </div>\r\n </div>\r\n</mat-dialog-actions>", styles: [".file-preview{padding:0}.file-preview .content{height:100%;width:100%;overflow:hidden;background-color:var(--ars-filepreview-content-background-color, #f7faf8)}.file-preview .content .loading{animation:blinker 2s linear infinite;font-size:x-large;color:var(--ars-color-text, #191c1b);width:100%;height:100%;padding:20px}.file-preview .content .iframe{width:100%;height:100%;border:0;background-color:var(--ars-filepreview-content-background-color, #f7faf8)!important}@keyframes blinker{50%{opacity:0}}.mat-mdc-dialog-content{max-height:unset!important;padding:0!important}\n"], dependencies: [{ kind: "directive", type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: FlexLayoutModule }, { kind: "directive", type: i1$1.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$1.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$1.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$1.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$1.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: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$1.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: MatTooltipModule }, { kind: "directive", type: i6.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "pipe", type: SafeUrlPipe, name: "safeUrl" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
441
- }
442
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: FilePreviewComponent, decorators: [{
443
- type: Component,
444
- args: [{ standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatDialogContent, FlexLayoutModule, MatDialogActions, MatButtonModule, MatTooltipModule,
445
- MatDialogClose, SafeUrlPipe], template: "<mat-dialog-content class=\"file-preview\" id=\"file-preview-scrollable\">\r\n <div class=\"content\">\r\n @if (!url()) {\r\n <div class=\"loading\">Caricamento in corso...</div>\r\n } @else {\r\n <iframe class=\"iframe\" #iframe (load)=\"loaded()\" [src]=\"url() | safeUrl\"></iframe>\r\n }\r\n </div>\r\n</mat-dialog-content>\r\n<mat-dialog-actions id=\"file-preview-fixed\">\r\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\" fxLayoutGap=\"10px\" fxFill>\r\n <div fxFlex=\"50\">\r\n <button mat-stroked-button (click)=\"troubles()\"\r\n matTooltip=\"Fai click se non riesci a visualizzare l'anteprima dei file PDF\">Problemi con i PDF?</button>\r\n </div>\r\n <div fxFlex=\"50\" fxLayoutAlign=\"end\">\r\n <button mat-stroked-button (click)=\"download()\">Scarica</button>\r\n <button mat-stroked-button [mat-dialog-close]=\"true\" >Chiudi</button>\r\n </div>\r\n </div>\r\n</mat-dialog-actions>", styles: [".file-preview{padding:0}.file-preview .content{height:100%;width:100%;overflow:hidden;background-color:var(--ars-filepreview-content-background-color, #f7faf8)}.file-preview .content .loading{animation:blinker 2s linear infinite;font-size:x-large;color:var(--ars-color-text, #191c1b);width:100%;height:100%;padding:20px}.file-preview .content .iframe{width:100%;height:100%;border:0;background-color:var(--ars-filepreview-content-background-color, #f7faf8)!important}@keyframes blinker{50%{opacity:0}}.mat-mdc-dialog-content{max-height:unset!important;padding:0!important}\n"] }]
446
- }], ctorParameters: () => [], propDecorators: { iframe: [{ type: i0.ViewChild, args: ['iframe', { isSignal: true }] }] } });
447
-
448
- class SelectFileDialogComponent {
449
- constructor() {
450
- this.done = output();
451
- this.dialogService = inject(ShellService);
452
- this.dialogRef = inject((MatDialogRef));
453
- this.dialogData = signal(inject(MAT_DIALOG_DATA) ?? {}, /* @ts-ignore */
454
- ...(ngDevMode ? [{ debugName: "dialogData" }] : /* istanbul ignore next */ []));
455
- this.file = signal(undefined, /* @ts-ignore */
456
- ...(ngDevMode ? [{ debugName: "file" }] : /* istanbul ignore next */ []));
457
- this.fileClass = signal('selectfile-file', /* @ts-ignore */
458
- ...(ngDevMode ? [{ debugName: "fileClass" }] : /* istanbul ignore next */ []));
459
- }
460
- /**
461
- * Handles the native file input change event and delegates to `selectFile`.
462
- * @param e - The DOM change event from the file input.
463
- */
464
- update(e) {
465
- const input = e.target;
466
- if (input.files?.length) {
467
- this.selectFile(input.files[0]);
468
- }
469
- }
470
- /**
471
- * Validates and sets the selected file, showing an error if size or type constraints are violated.
472
- * @param file - The `File` object to validate and store.
473
- */
474
- selectFile(file) {
475
- const data = this.dialogData();
476
- const maxSize = data.maxSize ?? 0;
477
- if (maxSize > 0) {
478
- const size = file.size / 1048576;
479
- if (size > maxSize) {
480
- this.dialogService.error(`File troppo grande (massimo ${SystemUtils.formatFileSize(maxSize * 1048576)})`);
481
- return;
482
- }
483
- }
484
- if (data.accept) {
485
- const accept = data.accept.toLowerCase();
486
- const a = file.name.split('.').pop()?.toLowerCase();
487
- let b = file.type.toLowerCase();
488
- if (b.startsWith('image/') && accept.includes('image/*')) {
489
- b = 'image/*';
490
- }
491
- else if (b.startsWith('video/') && accept.includes('video/*')) {
492
- b = 'video/*';
493
- }
494
- else if (b.startsWith('audio/') && accept.includes('audio/*')) {
495
- b = 'audio/*';
496
- }
497
- if (!accept.includes(a ?? '') && !accept.includes(b)) {
498
- this.dialogService.error(`Sono accettati solo questi tipi di file: ${accept}`);
499
- return;
500
- }
501
- }
502
- this.file.set(file);
503
- }
504
- /**
505
- * Formats a byte count into a human-readable size string.
506
- * @param size - File size in bytes.
507
- * @returns A formatted size string (e.g. "1.2 MB").
508
- */
509
- size(size) {
510
- return SystemUtils.formatFileSize(size);
511
- }
512
- /** Emits the selected file and options, then closes the dialog. */
513
- ok() {
514
- this.done.emit({ file: this.file(), options: this.dialogData().options });
515
- setTimeout(() => {
516
- this.dialogRef.close();
517
- }, 500);
518
- }
519
- /** Highlights the drop zone when a drag enters the area.
520
- * @param e - The drag event.
521
- */
522
- onDragOver(e) {
523
- this.fileClass.set('selectfile-file-drop');
524
- e.preventDefault();
525
- }
526
- /** Highlights the drop zone when a dragged item enters.
527
- * @param e - The drag event.
528
- */
529
- onDragEnter(e) {
530
- this.fileClass.set('selectfile-file-drop');
531
- e.preventDefault();
532
- }
533
- /** Resets the drop zone style when dragging ends.
534
- * @param e - The drag event.
535
- */
536
- onDragEnd(e) {
537
- this.fileClass.set('selectfile-file');
538
- e.preventDefault();
539
- }
540
- /** Resets the drop zone style when a dragged item leaves the area.
541
- * @param e - The drag event.
542
- */
543
- onDragLeave(e) {
544
- this.fileClass.set('selectfile-file');
545
- e.preventDefault();
546
- }
547
- /**
548
- * Handles a file drop event, extracting and processing the dropped files.
549
- * @param e - The drop event.
550
- */
551
- onDrop(e) {
552
- this.fileClass.set('selectfile-file');
553
- e.preventDefault();
554
- e.stopPropagation();
555
- if (e.dataTransfer?.files?.length) {
556
- this.addFiles(e.dataTransfer.files);
557
- }
558
- }
559
- /**
560
- * Picks the first file from the list and passes it to `selectFile`.
561
- * @param files - The `FileList` from the drag-and-drop event.
562
- */
563
- addFiles(files) {
564
- if (files.length > 0) {
565
- this.selectFile(files[0]);
566
- }
567
- }
568
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: SelectFileDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
569
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: SelectFileDialogComponent, isStandalone: true, selector: "ng-component", outputs: { done: "done" }, ngImport: i0, template: "<div mat-dialog-title [innerHTML]=\"dialogData().title | safeHtml\"></div>\n@if (dialogData().description) {\n<div class=\"selectfile-description\" [innerHtml]=\"dialogData().description | safeHtml\"></div>\n}\n<mat-dialog-content class=\"dialog-content\">\n <div fxLayout=\"column\" fxLayoutGap=\"24px\" fxLayoutAlign=\"center center\" fxFill>\n <div fxFlex=\"*\" [class]=\"fileClass()\" (drop)=\"onDrop($event)\" (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\" (dragenter)=\"onDragEnter($event)\" (dragend)=\"onDragEnd($event)\">\n <div fxLayout=\"column\" fxLayoutGap=\"24px\" fxLayoutAlign=\"center center\" fxFill>\n <div fxFlex=\"10px\" fxFlexAlign=\"start\" class=\"x-small secondary\"><i>Trascina qui il file o selezionalo</i></div>\n <div>\n <input #_file type=\"file\" [accept]=\"dialogData().accept\" [hidden]=\"true\" (change)=\"update($event)\" />\n <button type=\"button\" mat-stroked-button (click)=\"_file.click()\">Seleziona file...</button>\n </div>\n @if (file()) {\n <div style=\"padding:0 24px\">\n <div fxLayout=\"column\" fxLayoutAlign=\"center center\" fxFill>\n <div class=\"small accent bold\"><i>{{file().name}}</i></div>\n <div class=\"small\">Dimensioni: <i>{{size(file().size)}}</i></div>\n </div>\n </div>\n }\n </div>\n </div>\n @if (dialogData().options) {\n <div style=\"padding-bottom: 24px;\">\n @for (o of dialogData().options; track o; let i = $index) {\n <div>\n <mat-checkbox (change)=\"o.selected = $event.checked\" [checked]=\"o.selected === true\" name=\"opt_{{i}}\" >\n {{o.description}}\n </mat-checkbox>\n </div>\n }\n </div>\n }\n </div>\n</mat-dialog-content>\n<mat-dialog-actions>\n <div fxLayout=\"row\" fxLayoutGap=\"10px\" fxFill>\n <div fxFlex=\"50\">\n @if (dialogData().helpLink) {\n <a mat-stroked-button href=\"{{dialogData().helpLink}}\" target=\"_blank\">{{dialogData().helpCaption}}</a>\n }\n </div>\n <div fxFlex=\"50\" fxLayoutAlign=\"end\">\n <button mat-flat-button (click)=\"ok()\" [disabled]=\"!file()\">{{dialogData().okCaption}}</button>\n <button mat-stroked-button [mat-dialog-close]=\"true\">Annulla</button>\n </div>\n </div>\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}}.selectfile-file,.selectfile-file-drop{padding:4px 4px 24px;width:80%;border:5px dotted var(--ars-color-divider, #757d87)!important}.selectfile-file-drop{border:5px dotted var(--ars-color-accent, #7894ae)!important}.selectfile-description{padding:0 24px 24px}.dialog-content{padding:0 24px 24px!important}\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: "ngmodule", type: FlexLayoutModule }, { kind: "directive", type: i1$1.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$1.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$1.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$1.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$1.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: "directive", type: i1$1.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: MatButtonModule }, { kind: "component", type: i2$1.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: MatCheckboxModule }, { kind: "component", type: i3$1.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: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
570
- }
571
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: SelectFileDialogComponent, decorators: [{
572
- type: Component,
573
- args: [{ standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatDialogTitle, MatDialogContent, FlexLayoutModule, MatButtonModule, MatCheckboxModule,
574
- MatDialogActions, MatDialogClose, SafeHtmlPipe], template: "<div mat-dialog-title [innerHTML]=\"dialogData().title | safeHtml\"></div>\n@if (dialogData().description) {\n<div class=\"selectfile-description\" [innerHtml]=\"dialogData().description | safeHtml\"></div>\n}\n<mat-dialog-content class=\"dialog-content\">\n <div fxLayout=\"column\" fxLayoutGap=\"24px\" fxLayoutAlign=\"center center\" fxFill>\n <div fxFlex=\"*\" [class]=\"fileClass()\" (drop)=\"onDrop($event)\" (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\" (dragenter)=\"onDragEnter($event)\" (dragend)=\"onDragEnd($event)\">\n <div fxLayout=\"column\" fxLayoutGap=\"24px\" fxLayoutAlign=\"center center\" fxFill>\n <div fxFlex=\"10px\" fxFlexAlign=\"start\" class=\"x-small secondary\"><i>Trascina qui il file o selezionalo</i></div>\n <div>\n <input #_file type=\"file\" [accept]=\"dialogData().accept\" [hidden]=\"true\" (change)=\"update($event)\" />\n <button type=\"button\" mat-stroked-button (click)=\"_file.click()\">Seleziona file...</button>\n </div>\n @if (file()) {\n <div style=\"padding:0 24px\">\n <div fxLayout=\"column\" fxLayoutAlign=\"center center\" fxFill>\n <div class=\"small accent bold\"><i>{{file().name}}</i></div>\n <div class=\"small\">Dimensioni: <i>{{size(file().size)}}</i></div>\n </div>\n </div>\n }\n </div>\n </div>\n @if (dialogData().options) {\n <div style=\"padding-bottom: 24px;\">\n @for (o of dialogData().options; track o; let i = $index) {\n <div>\n <mat-checkbox (change)=\"o.selected = $event.checked\" [checked]=\"o.selected === true\" name=\"opt_{{i}}\" >\n {{o.description}}\n </mat-checkbox>\n </div>\n }\n </div>\n }\n </div>\n</mat-dialog-content>\n<mat-dialog-actions>\n <div fxLayout=\"row\" fxLayoutGap=\"10px\" fxFill>\n <div fxFlex=\"50\">\n @if (dialogData().helpLink) {\n <a mat-stroked-button href=\"{{dialogData().helpLink}}\" target=\"_blank\">{{dialogData().helpCaption}}</a>\n }\n </div>\n <div fxFlex=\"50\" fxLayoutAlign=\"end\">\n <button mat-flat-button (click)=\"ok()\" [disabled]=\"!file()\">{{dialogData().okCaption}}</button>\n <button mat-stroked-button [mat-dialog-close]=\"true\">Annulla</button>\n </div>\n </div>\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}}.selectfile-file,.selectfile-file-drop{padding:4px 4px 24px;width:80%;border:5px dotted var(--ars-color-divider, #757d87)!important}.selectfile-file-drop{border:5px dotted var(--ars-color-accent, #7894ae)!important}.selectfile-description{padding:0 24px 24px}.dialog-content{padding:0 24px 24px!important}\n"] }]
575
- }], propDecorators: { done: [{ type: i0.Output, args: ["done"] }] } });
576
-
577
- class SelectPictureDialogComponent {
578
- constructor() {
579
- this.done = output();
580
- this.dialogService = inject(ShellService);
581
- this.dialogRef = inject((MatDialogRef));
582
- this.dialogData = signal(inject(MAT_DIALOG_DATA) ?? {}, /* @ts-ignore */
583
- ...(ngDevMode ? [{ debugName: "dialogData" }] : /* istanbul ignore next */ []));
584
- this.file = signal(undefined, /* @ts-ignore */
585
- ...(ngDevMode ? [{ debugName: "file" }] : /* istanbul ignore next */ []));
586
- this.fileClass = signal('selectpicture-file', /* @ts-ignore */
587
- ...(ngDevMode ? [{ debugName: "fileClass" }] : /* istanbul ignore next */ []));
588
- this.pictureWidth = signal(0, /* @ts-ignore */
589
- ...(ngDevMode ? [{ debugName: "pictureWidth" }] : /* istanbul ignore next */ []));
590
- this.pictureHeight = signal(0, /* @ts-ignore */
591
- ...(ngDevMode ? [{ debugName: "pictureHeight" }] : /* istanbul ignore next */ []));
592
- this.picturePreview = signal(undefined, /* @ts-ignore */
593
- ...(ngDevMode ? [{ debugName: "picturePreview" }] : /* istanbul ignore next */ []));
594
- }
595
- /**
596
- * Handles the native file input change event and delegates to `selectFile`.
597
- * @param e - The DOM change event from the file input.
598
- */
599
- update(e) {
600
- const input = e.target;
601
- if (input.files?.length) {
602
- this.selectFile(input.files[0]);
603
- }
604
- }
605
- /**
606
- * Validates the file size and type, then reads it as a data URL to generate a preview.
607
- * @param file - The `File` object to validate and preview.
608
- */
609
- selectFile(file) {
610
- const data = this.dialogData();
611
- const maxSize = data.maxSize ?? 0;
612
- if (maxSize > 0) {
613
- const size = file.size / 1048576;
614
- if (size > maxSize) {
615
- this.dialogService.error(`File troppo grande (massimo ${SystemUtils.formatFileSize(maxSize * 1048576)})`);
616
- return;
617
- }
618
- }
619
- if (data.accept) {
620
- const accept = data.accept.toLowerCase();
621
- const a = file.name.split('.').pop()?.toLowerCase();
622
- let b = file.type.toLowerCase();
623
- if (b.startsWith('image/') && accept.includes('image/*')) {
624
- b = 'image/*';
625
- }
626
- else if (b.startsWith('video/') && accept.includes('video/*')) {
627
- b = 'video/*';
628
- }
629
- else if (b.startsWith('audio/') && accept.includes('audio/*')) {
630
- b = 'audio/*';
631
- }
632
- if (!accept.includes(a ?? '') && !accept.includes(b)) {
633
- this.dialogService.error(`Sono accettati solo questi tipi di file: ${accept}`);
634
- return;
635
- }
636
- }
637
- const reader = new FileReader();
638
- reader.onload = (_e) => {
639
- const img = new Image();
640
- img.onload = () => {
641
- const maxWidth = data.maxWidth ?? 0;
642
- if (maxWidth > 0 && img.width > maxWidth) {
643
- this.dialogService.error(`Immagine troppo larga (massimo ${maxWidth} pixel)`);
644
- return;
645
- }
646
- const maxHeight = data.maxHeight ?? 0;
647
- if (maxHeight > 0 && img.height > maxHeight) {
648
- this.dialogService.error(`Immagine troppo alta (massimo ${maxHeight} pixel)`);
649
- return;
650
- }
651
- this.pictureWidth.set(img.width);
652
- this.pictureHeight.set(img.height);
653
- this.picturePreview.set(_e.target.result);
654
- this.file.set(file);
655
- };
656
- img.src = _e.target.result;
657
- };
658
- reader.readAsDataURL(file);
659
- }
660
- /**
661
- * Formats a byte count into a human-readable size string.
662
- * @param size - File size in bytes.
663
- * @returns A formatted size string (e.g. "1.2 MB").
664
- */
665
- size(size) {
666
- return SystemUtils.formatFileSize(size);
667
- }
668
- /** Emits the selected file and options, then closes the dialog. */
669
- ok() {
670
- this.done.emit({ file: this.file(), options: this.dialogData().options });
671
- setTimeout(() => {
672
- this.dialogRef.close();
673
- }, 500);
674
- }
675
- /** Highlights the drop zone when a dragged item is over it.
676
- * @param e - The drag event.
677
- */
678
- onDragOver(e) {
679
- this.fileClass.set('selectpicture-file-drop');
680
- e.preventDefault();
681
- }
682
- /** Highlights the drop zone when a dragged item enters.
683
- * @param e - The drag event.
684
- */
685
- onDragEnter(e) {
686
- this.fileClass.set('selectpicture-file-drop');
687
- e.preventDefault();
688
- }
689
- /** Resets the drop zone style when dragging ends.
690
- * @param e - The drag event.
691
- */
692
- onDragEnd(e) {
693
- this.fileClass.set('selectpicture-file');
694
- e.preventDefault();
695
- }
696
- /** Resets the drop zone style when a dragged item leaves.
697
- * @param e - The drag event.
698
- */
699
- onDragLeave(e) {
700
- this.fileClass.set('selectpicture-file');
701
- e.preventDefault();
702
- }
703
- /**
704
- * Handles a file drop event, extracting and processing the dropped image.
705
- * @param e - The drop event.
706
- */
707
- onDrop(e) {
708
- this.fileClass.set('selectpicture-file');
709
- e.preventDefault();
710
- e.stopPropagation();
711
- if (e.dataTransfer?.files?.length) {
712
- this.addFiles(e.dataTransfer.files);
713
- }
714
- }
715
- /**
716
- * Picks the first file from the list and passes it to `selectFile`.
717
- * @param files - The `FileList` from the drag-and-drop event.
718
- */
719
- addFiles(files) {
720
- if (files.length > 0) {
721
- this.selectFile(files[0]);
722
- }
723
- }
724
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: SelectPictureDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
725
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: SelectPictureDialogComponent, isStandalone: true, selector: "ng-component", outputs: { done: "done" }, ngImport: i0, template: "<div mat-dialog-title [innerHTML]=\"dialogData().title | safeHtml\"></div>\n@if (dialogData().description) {\n<div class=\"selectpicture-description\" [innerHtml]=\"dialogData().description | safeHtml\"></div>\n}\n<mat-dialog-content class=\"dialog-content\">\n <div fxLayout=\"column\" fxLayoutAlign=\"center center\" fxLayoutGap=\"24px\" fxFill>\n <div fxFlex=\"*\" [class]=\"fileClass()\" (drop)=\"onDrop($event)\" (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\" (dragenter)=\"onDragEnter($event)\" (dragend)=\"onDragEnd($event)\">\n <div fxLayout=\"column\" fxLayoutGap=\"24px\" fxLayoutAlign=\"center center\" fxFill>\n <div fxFlex=\"10px\" fxFlexAlign=\"start\" class=\"x-small secondary\"><i>Trascina qui l'immagine o selezionala</i></div>\n <div>\n <input #_file type=\"file\" [hidden]=\"true\" [accept]=\"dialogData().accept ?? 'image/*'\"\n (change)=\"update($event)\" />\n <button type=\"button\" mat-stroked-button (click)=\"_file.click()\">Seleziona file...</button>\n </div>\n @if (file()) {\n <div style=\"padding:0 24px\">\n <div fxLayout=\"column\" fxLayoutAlign=\"center center\" fxFill>\n <img [src]=\"picturePreview()\" class=\"selectpicture-preview\">\n <div class=\"small accent bold \"><i>{{file().name}}</i></div>\n <div class=\"small\">Dimensioni:<i>{{pictureWidth()}} x {{pictureHeight()}} ({{size(file().size)}})</i></div>\n </div>\n </div>\n }\n </div>\n </div>\n @if (dialogData().options) {\n <div style=\"padding-bottom: 24px;\">\n @for (o of dialogData().options; track o; let i = $index) {\n <div>\n <mat-checkbox (change)=\"o.selected = $event.checked\" [checked]=\"o.selected === true\" name=\"opt_{{i}}\" >\n {{o.description}}\n </mat-checkbox>\n </div>\n }\n </div>\n }\n </div>\n</mat-dialog-content>\n<mat-dialog-actions>\n <div fxLayout=\"row\" fxLayoutAlign=\"end\" fxFill>\n <button mat-flat-button (click)=\"ok()\" [disabled]=\"!file()\">{{dialogData().okCaption}}</button>\n <button mat-stroked-button mat-dialog-close >Annulla</button>\n </div>\n</mat-dialog-actions>\n", 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}}.selectpicture-file{padding:24px;width:320px;border:5px dotted #eee}.selectpicture-preview{max-height:300px;max-width:300px;margin-bottom:15px!important}.selectpicture-file,.selectpicture-file-drop{padding:4px 4px 24px;width:80%;border:5px dotted var(--ars-color-divider, #757d87)!important}.selectpicture-file-drop{border:5px dotted var(--ars-color-accent, #7894ae)!important}.selectpicture-description{padding:0 24px 24px}.dialog-content{padding:0 24px 24px!important}\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: "ngmodule", type: FlexLayoutModule }, { kind: "directive", type: i1$1.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$1.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$1.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$1.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$1.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: "directive", type: i1$1.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: MatButtonModule }, { kind: "component", type: i2$1.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: MatCheckboxModule }, { kind: "component", type: i3$1.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: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
726
- }
727
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: SelectPictureDialogComponent, decorators: [{
728
- type: Component,
729
- args: [{ standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatDialogTitle, MatDialogContent, FlexLayoutModule, MatButtonModule, MatCheckboxModule,
730
- MatDialogActions, MatDialogClose, SafeHtmlPipe], template: "<div mat-dialog-title [innerHTML]=\"dialogData().title | safeHtml\"></div>\n@if (dialogData().description) {\n<div class=\"selectpicture-description\" [innerHtml]=\"dialogData().description | safeHtml\"></div>\n}\n<mat-dialog-content class=\"dialog-content\">\n <div fxLayout=\"column\" fxLayoutAlign=\"center center\" fxLayoutGap=\"24px\" fxFill>\n <div fxFlex=\"*\" [class]=\"fileClass()\" (drop)=\"onDrop($event)\" (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\" (dragenter)=\"onDragEnter($event)\" (dragend)=\"onDragEnd($event)\">\n <div fxLayout=\"column\" fxLayoutGap=\"24px\" fxLayoutAlign=\"center center\" fxFill>\n <div fxFlex=\"10px\" fxFlexAlign=\"start\" class=\"x-small secondary\"><i>Trascina qui l'immagine o selezionala</i></div>\n <div>\n <input #_file type=\"file\" [hidden]=\"true\" [accept]=\"dialogData().accept ?? 'image/*'\"\n (change)=\"update($event)\" />\n <button type=\"button\" mat-stroked-button (click)=\"_file.click()\">Seleziona file...</button>\n </div>\n @if (file()) {\n <div style=\"padding:0 24px\">\n <div fxLayout=\"column\" fxLayoutAlign=\"center center\" fxFill>\n <img [src]=\"picturePreview()\" class=\"selectpicture-preview\">\n <div class=\"small accent bold \"><i>{{file().name}}</i></div>\n <div class=\"small\">Dimensioni:<i>{{pictureWidth()}} x {{pictureHeight()}} ({{size(file().size)}})</i></div>\n </div>\n </div>\n }\n </div>\n </div>\n @if (dialogData().options) {\n <div style=\"padding-bottom: 24px;\">\n @for (o of dialogData().options; track o; let i = $index) {\n <div>\n <mat-checkbox (change)=\"o.selected = $event.checked\" [checked]=\"o.selected === true\" name=\"opt_{{i}}\" >\n {{o.description}}\n </mat-checkbox>\n </div>\n }\n </div>\n }\n </div>\n</mat-dialog-content>\n<mat-dialog-actions>\n <div fxLayout=\"row\" fxLayoutAlign=\"end\" fxFill>\n <button mat-flat-button (click)=\"ok()\" [disabled]=\"!file()\">{{dialogData().okCaption}}</button>\n <button mat-stroked-button mat-dialog-close >Annulla</button>\n </div>\n</mat-dialog-actions>\n", 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}}.selectpicture-file{padding:24px;width:320px;border:5px dotted #eee}.selectpicture-preview{max-height:300px;max-width:300px;margin-bottom:15px!important}.selectpicture-file,.selectpicture-file-drop{padding:4px 4px 24px;width:80%;border:5px dotted var(--ars-color-divider, #757d87)!important}.selectpicture-file-drop{border:5px dotted var(--ars-color-accent, #7894ae)!important}.selectpicture-description{padding:0 24px 24px}.dialog-content{padding:0 24px 24px!important}\n"] }]
731
- }], propDecorators: { done: [{ type: i0.Output, args: ["done"] }] } });
732
-
733
- /*
734
- * Public API Surface of @arsedizioni/ars-utils/ui.files
735
- */
736
-
737
- /**
738
- * Generated bundle index. Do not edit.
739
- */
740
-
1
+ import { coerceBooleanProperty } from "@angular/cdk/coercion";
2
+ import * as i0 from "@angular/core";
3
+ import { ChangeDetectionStrategy, Component, DestroyRef, Input, Optional, Renderer2, Self, afterNextRender, effect, inject, input, model, output, signal, viewChild } from "@angular/core";
4
+ import { FormField, disabled, form, required } from "@angular/forms/signals";
5
+ import { SignalsUtils, fileSize, notEmpty } from "@arsedizioni/ars-utils/core.validators";
6
+ import * as i2 from "@angular/material/form-field";
7
+ import { MatFormFieldControl, MatFormFieldModule } from "@angular/material/form-field";
8
+ import { FileInfo, SafeHtmlPipe, SafeUrlPipe, SystemUtils } from "@arsedizioni/ars-utils/core";
9
+ import { Subject } from "rxjs";
10
+ import * as i6 from "@angular/material/tooltip";
11
+ import { MatTooltipModule } from "@angular/material/tooltip";
12
+ import * as i5 from "@angular/material/icon";
13
+ import { MatIconModule } from "@angular/material/icon";
14
+ import * as i4 from "@angular/material/button";
15
+ import { MatButtonModule } from "@angular/material/button";
16
+ import * as i3$1 from "@angular/material/input";
17
+ import { MatInputModule } from "@angular/material/input";
18
+ import * as i1 from "@arsedizioni/ars-utils/ui";
19
+ import { FlexLayoutModule, UIService } from "@arsedizioni/ars-utils/ui";
20
+ import * as i1$1 from "@angular/forms";
21
+ import { HttpClient, HttpHeaders } from "@angular/common/http";
22
+ import { ShellService } from "@arsedizioni/ars-utils/ui.shell";
23
+ import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
24
+ import { MAT_DIALOG_DATA, MatDialogActions, MatDialogClose, MatDialogContent, MatDialogRef, MatDialogTitle } from "@angular/material/dialog";
25
+ import * as i3 from "@angular/material/checkbox";
26
+ import { MatCheckboxModule } from "@angular/material/checkbox";
27
+ var FileInputComponent = class FileInputComponent {
28
+ static {
29
+ this.nextId = 0;
30
+ }
31
+ set value(value) {
32
+ this.setValue(value, true);
33
+ }
34
+ setValue(value, propagate) {
35
+ this._value = value;
36
+ if (propagate) this.propagateChange(this._value);
37
+ this.stateChanges.next();
38
+ this.changed.emit(this._value);
39
+ }
40
+ get value() {
41
+ return this._value;
42
+ }
43
+ get size() {
44
+ return this._value?.file?.size;
45
+ }
46
+ get required() {
47
+ return this._required();
48
+ }
49
+ set required(value) {
50
+ this._required.set(coerceBooleanProperty(value));
51
+ this.stateChanges.next();
52
+ }
53
+ get disabled() {
54
+ if (this.ngControl && this.ngControl.disabled != null) return this.ngControl.disabled;
55
+ return this._disabled();
56
+ }
57
+ set disabled(value) {
58
+ this._disabled.set(coerceBooleanProperty(value));
59
+ if (this.focused) {
60
+ this.focused = false;
61
+ this.stateChanges.next();
62
+ }
63
+ }
64
+ get placeholder() {
65
+ return this._placeholder();
66
+ }
67
+ set placeholder(value) {
68
+ this._placeholder.set(value);
69
+ this.stateChanges.next();
70
+ }
71
+ get empty() {
72
+ return !this._value || !this._value.file;
73
+ }
74
+ get errorState() {
75
+ return this.ngControl?.errors != null && (this.ngControl?.touched ?? false);
76
+ }
77
+ get shouldLabelFloat() {
78
+ return this.focused || !this.empty;
79
+ }
80
+ constructor(ngControl) {
81
+ this.ngControl = ngControl;
82
+ this.getErrorMessage = SignalsUtils.getFieldErrorMessage;
83
+ this.__file = viewChild.required("__file", ...ngDevMode ? [{ debugName: "__file" }] : /* istanbul ignore next */ []);
84
+ this.renderer = inject(Renderer2);
85
+ this.uiService = inject(UIService);
86
+ this.stateChanges = new Subject();
87
+ this.controlType = "file-input";
88
+ this.focused = false;
89
+ this.canCapture = signal(false, ...ngDevMode ? [{ debugName: "canCapture" }] : /* istanbul ignore next */ []);
90
+ this.fileSize = signal(0, ...ngDevMode ? [{ debugName: "fileSize" }] : /* istanbul ignore next */ []);
91
+ this._placeholder = signal("", ...ngDevMode ? [{ debugName: "_placeholder" }] : /* istanbul ignore next */ []);
92
+ this._value = new FileInfo();
93
+ this._required = signal(false, ...ngDevMode ? [{ debugName: "_required" }] : /* istanbul ignore next */ []);
94
+ this._disabled = signal(false, ...ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []);
95
+ this.fileName = model(void 0, ...ngDevMode ? [{ debugName: "fileName" }] : /* istanbul ignore next */ []);
96
+ this.maxSizeMb = input(5, ...ngDevMode ? [{ debugName: "maxSizeMb" }] : /* istanbul ignore next */ []);
97
+ this.minSizeMb = input(0, ...ngDevMode ? [{ debugName: "minSizeMb" }] : /* istanbul ignore next */ []);
98
+ this.isNew = input(false, ...ngDevMode ? [{ debugName: "isNew" }] : /* istanbul ignore next */ []);
99
+ this.canPreview = input(false, ...ngDevMode ? [{ debugName: "canPreview" }] : /* istanbul ignore next */ []);
100
+ this.appearance = input(this.uiService.appearance(), ...ngDevMode ? [{ debugName: "appearance" }] : /* istanbul ignore next */ []);
101
+ this.accept = input(...ngDevMode ? [void 0, { debugName: "accept" }] : /* istanbul ignore next */ []);
102
+ this.id = `${this.controlType}-${FileInputComponent.nextId++}`;
103
+ this.describedBy = "";
104
+ this.changed = output();
105
+ this.download = output();
106
+ this.preview = output();
107
+ this.nameModel = signal({ name: "" }, ...ngDevMode ? [{ debugName: "nameModel" }] : /* istanbul ignore next */ []);
108
+ this.nameForm = form(this.nameModel, (p) => {
109
+ required(p.name, { when: () => this._required() });
110
+ notEmpty(p.name, { when: () => this._required() });
111
+ disabled(p.name, () => this._disabled());
112
+ fileSize(p.name, () => this.fileSize(), () => this.maxSizeMb(), () => this.minSizeMb());
113
+ });
114
+ this.propagateChange = (_) => {};
115
+ this.propagateTouched = () => {};
116
+ if (this.ngControl != null) this.ngControl.valueAccessor = this;
117
+ effect(() => this.nameModel.set({ name: this.fileName() ?? "" }));
118
+ afterNextRender(() => {
119
+ this.setupDevices();
120
+ const elem = document.getElementById(this.id);
121
+ if (elem) this.renderer.setProperty(elem, "readOnly", true);
122
+ });
123
+ }
124
+ async setupDevices() {
125
+ this.canCapture.set(false);
126
+ if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) try {
127
+ if (await navigator.mediaDevices.getUserMedia({ video: true })) this.canCapture.set(true);
128
+ } catch {}
129
+ if (!this.placeholder || this.placeholder === "Seleziona file") this._placeholder.set(this.canCapture() ? "Seleziona file o acquisisci con fotocamera" : "Seleziona file");
130
+ }
131
+ ngOnDestroy() {
132
+ this.stateChanges.complete();
133
+ }
134
+ ngDoCheck() {
135
+ this.updateInputDirtyCheck();
136
+ }
137
+ writeValue(value) {
138
+ this.setValue(value, false);
139
+ }
140
+ registerOnChange(fn) {
141
+ this.propagateChange = fn;
142
+ }
143
+ registerOnTouched(fn) {
144
+ this.propagateTouched = fn;
145
+ }
146
+ setDescribedByIds(ids) {
147
+ this.describedBy = ids.join(" ");
148
+ }
149
+ setDisabledState(isDisabled) {
150
+ this._disabled.set(isDisabled);
151
+ if (!SystemUtils.isBrowser()) return;
152
+ const elem = document.getElementById(this.id);
153
+ if (elem) this.renderer.setProperty(elem, "disabled", isDisabled);
154
+ }
155
+ onContainerClick() {
156
+ if (!this.focused) {
157
+ if (!SystemUtils.isBrowser()) return;
158
+ const elem = document.getElementById(this.id);
159
+ if (elem) {
160
+ elem.focus();
161
+ this.propagateTouched();
162
+ }
163
+ }
164
+ }
165
+ updateInputDirtyCheck() {
166
+ const newValue = this._value;
167
+ if (this.previousNativeValue !== newValue) {
168
+ this.previousNativeValue = newValue;
169
+ this.stateChanges.next();
170
+ }
171
+ }
172
+ selectFile(e) {
173
+ const input = e.target;
174
+ if (input.files?.length) {
175
+ const f = input.files[0];
176
+ const fileInfo = new FileInfo();
177
+ const fileSizeMb = f.size / 1048576;
178
+ fileInfo.file = f;
179
+ fileInfo.valid = (!this.maxSizeMb() || fileSizeMb <= this.maxSizeMb()) && (!this.minSizeMb() || fileSizeMb >= this.minSizeMb());
180
+ this.setValue(fileInfo, true);
181
+ this.fileName.set(f.name);
182
+ this.fileSize.set(Math.round(fileSizeMb));
183
+ }
184
+ }
185
+ hasFile() {
186
+ return !!this._value?.file;
187
+ }
188
+ clearFile() {
189
+ if (this.hasFile()) {
190
+ this.fileName.set(void 0);
191
+ this.fileSize.set(0);
192
+ const fi = new FileInfo();
193
+ fi.file = void 0;
194
+ fi.valid = !this.required;
195
+ this.setValue(fi, true);
196
+ this.__file().nativeElement.value = "";
197
+ }
198
+ }
199
+ downloadFile() {
200
+ if (!this.isNew()) this.download.emit();
201
+ }
202
+ previewFile() {
203
+ if (!this.isNew() && this.canPreview()) this.preview.emit();
204
+ }
205
+ static {
206
+ this.ɵfac = i0.ɵɵngDeclareFactory({
207
+ minVersion: "12.0.0",
208
+ version: "22.2.1",
209
+ ngImport: i0,
210
+ type: FileInputComponent,
211
+ deps: [{
212
+ token: i1$1.NgControl,
213
+ optional: true,
214
+ self: true
215
+ }],
216
+ target: i0.ɵɵFactoryTarget.Component
217
+ });
218
+ }
219
+ static {
220
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
221
+ minVersion: "17.0.0",
222
+ version: "22.2.1",
223
+ type: FileInputComponent,
224
+ isStandalone: true,
225
+ selector: "file-input",
226
+ inputs: {
227
+ required: {
228
+ classPropertyName: "required",
229
+ publicName: "required",
230
+ isSignal: false,
231
+ isRequired: false,
232
+ transformFunction: null
233
+ },
234
+ disabled: {
235
+ classPropertyName: "disabled",
236
+ publicName: "disabled",
237
+ isSignal: false,
238
+ isRequired: false,
239
+ transformFunction: null
240
+ },
241
+ placeholder: {
242
+ classPropertyName: "placeholder",
243
+ publicName: "placeholder",
244
+ isSignal: false,
245
+ isRequired: false,
246
+ transformFunction: null
247
+ },
248
+ fileName: {
249
+ classPropertyName: "fileName",
250
+ publicName: "fileName",
251
+ isSignal: true,
252
+ isRequired: false,
253
+ transformFunction: null
254
+ },
255
+ maxSizeMb: {
256
+ classPropertyName: "maxSizeMb",
257
+ publicName: "maxSizeMb",
258
+ isSignal: true,
259
+ isRequired: false,
260
+ transformFunction: null
261
+ },
262
+ minSizeMb: {
263
+ classPropertyName: "minSizeMb",
264
+ publicName: "minSizeMb",
265
+ isSignal: true,
266
+ isRequired: false,
267
+ transformFunction: null
268
+ },
269
+ isNew: {
270
+ classPropertyName: "isNew",
271
+ publicName: "isNew",
272
+ isSignal: true,
273
+ isRequired: false,
274
+ transformFunction: null
275
+ },
276
+ canPreview: {
277
+ classPropertyName: "canPreview",
278
+ publicName: "canPreview",
279
+ isSignal: true,
280
+ isRequired: false,
281
+ transformFunction: null
282
+ },
283
+ appearance: {
284
+ classPropertyName: "appearance",
285
+ publicName: "appearance",
286
+ isSignal: true,
287
+ isRequired: false,
288
+ transformFunction: null
289
+ },
290
+ accept: {
291
+ classPropertyName: "accept",
292
+ publicName: "accept",
293
+ isSignal: true,
294
+ isRequired: false,
295
+ transformFunction: null
296
+ }
297
+ },
298
+ outputs: {
299
+ fileName: "fileNameChange",
300
+ changed: "changed",
301
+ download: "download",
302
+ preview: "preview"
303
+ },
304
+ host: { properties: {
305
+ "id": "id",
306
+ "class.floating": "shouldLabelFloat",
307
+ "attr.aria-describedBy": "describedBy"
308
+ } },
309
+ providers: [{
310
+ provide: MatFormFieldControl,
311
+ useExisting: FileInputComponent
312
+ }],
313
+ viewQueries: [{
314
+ propertyName: "__file",
315
+ first: true,
316
+ predicate: ["__file"],
317
+ descendants: true,
318
+ isSignal: true
319
+ }],
320
+ ngImport: i0,
321
+ template: "<mat-form-field style=\"width:100%\" [appearance]=\"appearance()\">\n <mat-label>{{placeholder}}</mat-label>\n <input type=\"file\" [hidden]=\"true\" [accept]=\"accept()\" (change)=\"selectFile($event)\" #__file />\n <input [formField]=\"nameForm.name\" [id]=\"id\" matInput />\n @if (hasFile()) {\n <button type=\"button\" tabindex=\"-1\" mat-icon-button matSuffix aria-label=\"Azzera\" (click)=\"clearFile()\" [disabled]=\"disabled\">\n <mat-icon>close</mat-icon>\n </button>\n }\n @if (!disabled) {\n <button type=\"button\" type=\"button\" mat-icon-button matSuffix (click)=\"__file.click()\" aria-label=\"Seleziona file\"\n matTooltip=\"Seleziona\" [disabled]=\"disabled\">\n <mat-icon>add</mat-icon>\n </button>\n }\n @if (!isNew() && canPreview()) {\n <button type=\"button\" mat-icon-button matSuffix (click)=\"previewFile()\" aria-label=\"Anteprima\" matTooltip=\"Anteprima\" [disabled]=\"disabled\">\n <mat-icon>preview</mat-icon>\n </button>\n }\n @if (!isNew()) {\n <button type=\"button\" mat-icon-button matSuffix (click)=\"downloadFile()\" aria-label=\"Scarica file\"\n matTooltip=\"Scarica\" [disabled]=\"disabled\">\n <mat-icon>save_alt</mat-icon>\n </button>\n }\n @if (hasFile() && fileSize() > 0) {\n <mat-hint align=\"start\">{{fileSize()}} MB</mat-hint>\n }\n @if (hasFile() && fileSize() == 0) {\n <mat-hint align=\"start\">\n &gt; 1 MB</mat-hint>\n } @if (maxSizeMb()) {\n <mat-hint align=\"end\">Massimo {{maxSizeMb()}} MB\n </mat-hint>\n }\n @if (nameForm.name().invalid()) {\n <mat-error>{{ getErrorMessage(nameForm.name().errors()) }}</mat-error>\n }\n</mat-form-field>",
322
+ styles: [""],
323
+ dependencies: [
324
+ {
325
+ kind: "ngmodule",
326
+ type: MatFormFieldModule
327
+ },
328
+ {
329
+ kind: "component",
330
+ type: i2.MatFormField,
331
+ selector: "mat-form-field",
332
+ inputs: [
333
+ "hideRequiredMarker",
334
+ "color",
335
+ "floatLabel",
336
+ "appearance",
337
+ "subscriptSizing",
338
+ "hintLabel"
339
+ ],
340
+ exportAs: ["matFormField"]
341
+ },
342
+ {
343
+ kind: "directive",
344
+ type: i2.MatLabel,
345
+ selector: "mat-label"
346
+ },
347
+ {
348
+ kind: "directive",
349
+ type: i2.MatHint,
350
+ selector: "mat-hint",
351
+ inputs: ["align", "id"]
352
+ },
353
+ {
354
+ kind: "directive",
355
+ type: i2.MatError,
356
+ selector: "mat-error, [matError]",
357
+ inputs: ["id"]
358
+ },
359
+ {
360
+ kind: "directive",
361
+ type: i2.MatSuffix,
362
+ selector: "[matSuffix], [matIconSuffix], [matTextSuffix]",
363
+ inputs: ["matTextSuffix"]
364
+ },
365
+ {
366
+ kind: "ngmodule",
367
+ type: MatInputModule
368
+ },
369
+ {
370
+ kind: "directive",
371
+ type: i3$1.MatInput,
372
+ selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]",
373
+ inputs: [
374
+ "disabled",
375
+ "id",
376
+ "placeholder",
377
+ "name",
378
+ "required",
379
+ "type",
380
+ "errorStateMatcher",
381
+ "aria-describedby",
382
+ "value",
383
+ "readonly",
384
+ "disabledInteractive"
385
+ ],
386
+ exportAs: ["matInput"]
387
+ },
388
+ {
389
+ kind: "directive",
390
+ type: FormField,
391
+ selector: "[formField]",
392
+ inputs: ["formField"],
393
+ exportAs: ["formField"]
394
+ },
395
+ {
396
+ kind: "ngmodule",
397
+ type: MatButtonModule
398
+ },
399
+ {
400
+ kind: "component",
401
+ type: i4.MatIconButton,
402
+ selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]",
403
+ exportAs: ["matButton", "matAnchor"]
404
+ },
405
+ {
406
+ kind: "ngmodule",
407
+ type: MatIconModule
408
+ },
409
+ {
410
+ kind: "component",
411
+ type: i5.MatIcon,
412
+ selector: "mat-icon",
413
+ inputs: [
414
+ "color",
415
+ "inline",
416
+ "svgIcon",
417
+ "fontSet",
418
+ "fontIcon"
419
+ ],
420
+ exportAs: ["matIcon"]
421
+ },
422
+ {
423
+ kind: "ngmodule",
424
+ type: MatTooltipModule
425
+ },
426
+ {
427
+ kind: "directive",
428
+ type: i6.MatTooltip,
429
+ selector: "[matTooltip]",
430
+ inputs: [
431
+ "matTooltipPosition",
432
+ "matTooltipPositionAtOrigin",
433
+ "matTooltipDisabled",
434
+ "matTooltipShowDelay",
435
+ "matTooltipHideDelay",
436
+ "matTooltipTouchGestures",
437
+ "matTooltip",
438
+ "matTooltipClass"
439
+ ],
440
+ exportAs: ["matTooltip"]
441
+ }
442
+ ],
443
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
444
+ });
445
+ }
446
+ };
447
+ i0.ɵɵngDeclareClassMetadata({
448
+ minVersion: "12.0.0",
449
+ version: "22.2.1",
450
+ ngImport: i0,
451
+ type: FileInputComponent,
452
+ decorators: [{
453
+ type: Component,
454
+ args: [{
455
+ selector: "file-input",
456
+ providers: [{
457
+ provide: MatFormFieldControl,
458
+ useExisting: FileInputComponent
459
+ }],
460
+ standalone: true,
461
+ changeDetection: ChangeDetectionStrategy.OnPush,
462
+ imports: [
463
+ MatFormFieldModule,
464
+ MatInputModule,
465
+ FormField,
466
+ MatButtonModule,
467
+ MatIconModule,
468
+ MatTooltipModule
469
+ ],
470
+ host: {
471
+ "[id]": "id",
472
+ "[class.floating]": "shouldLabelFloat",
473
+ "[attr.aria-describedBy]": "describedBy"
474
+ },
475
+ template: "<mat-form-field style=\"width:100%\" [appearance]=\"appearance()\">\n <mat-label>{{placeholder}}</mat-label>\n <input type=\"file\" [hidden]=\"true\" [accept]=\"accept()\" (change)=\"selectFile($event)\" #__file />\n <input [formField]=\"nameForm.name\" [id]=\"id\" matInput />\n @if (hasFile()) {\n <button type=\"button\" tabindex=\"-1\" mat-icon-button matSuffix aria-label=\"Azzera\" (click)=\"clearFile()\" [disabled]=\"disabled\">\n <mat-icon>close</mat-icon>\n </button>\n }\n @if (!disabled) {\n <button type=\"button\" type=\"button\" mat-icon-button matSuffix (click)=\"__file.click()\" aria-label=\"Seleziona file\"\n matTooltip=\"Seleziona\" [disabled]=\"disabled\">\n <mat-icon>add</mat-icon>\n </button>\n }\n @if (!isNew() && canPreview()) {\n <button type=\"button\" mat-icon-button matSuffix (click)=\"previewFile()\" aria-label=\"Anteprima\" matTooltip=\"Anteprima\" [disabled]=\"disabled\">\n <mat-icon>preview</mat-icon>\n </button>\n }\n @if (!isNew()) {\n <button type=\"button\" mat-icon-button matSuffix (click)=\"downloadFile()\" aria-label=\"Scarica file\"\n matTooltip=\"Scarica\" [disabled]=\"disabled\">\n <mat-icon>save_alt</mat-icon>\n </button>\n }\n @if (hasFile() && fileSize() > 0) {\n <mat-hint align=\"start\">{{fileSize()}} MB</mat-hint>\n }\n @if (hasFile() && fileSize() == 0) {\n <mat-hint align=\"start\">\n &gt; 1 MB</mat-hint>\n } @if (maxSizeMb()) {\n <mat-hint align=\"end\">Massimo {{maxSizeMb()}} MB\n </mat-hint>\n }\n @if (nameForm.name().invalid()) {\n <mat-error>{{ getErrorMessage(nameForm.name().errors()) }}</mat-error>\n }\n</mat-form-field>"
476
+ }]
477
+ }],
478
+ ctorParameters: () => [{
479
+ type: i1$1.NgControl,
480
+ decorators: [{ type: Optional }, { type: Self }]
481
+ }],
482
+ propDecorators: {
483
+ __file: [{
484
+ type: i0.ViewChild,
485
+ args: ["__file", { isSignal: true }]
486
+ }],
487
+ required: [{ type: Input }],
488
+ disabled: [{ type: Input }],
489
+ placeholder: [{ type: Input }],
490
+ fileName: [{
491
+ type: i0.Input,
492
+ args: [{
493
+ isSignal: true,
494
+ alias: "fileName",
495
+ required: false
496
+ }]
497
+ }, {
498
+ type: i0.Output,
499
+ args: ["fileNameChange"]
500
+ }],
501
+ maxSizeMb: [{
502
+ type: i0.Input,
503
+ args: [{
504
+ isSignal: true,
505
+ alias: "maxSizeMb",
506
+ required: false
507
+ }]
508
+ }],
509
+ minSizeMb: [{
510
+ type: i0.Input,
511
+ args: [{
512
+ isSignal: true,
513
+ alias: "minSizeMb",
514
+ required: false
515
+ }]
516
+ }],
517
+ isNew: [{
518
+ type: i0.Input,
519
+ args: [{
520
+ isSignal: true,
521
+ alias: "isNew",
522
+ required: false
523
+ }]
524
+ }],
525
+ canPreview: [{
526
+ type: i0.Input,
527
+ args: [{
528
+ isSignal: true,
529
+ alias: "canPreview",
530
+ required: false
531
+ }]
532
+ }],
533
+ appearance: [{
534
+ type: i0.Input,
535
+ args: [{
536
+ isSignal: true,
537
+ alias: "appearance",
538
+ required: false
539
+ }]
540
+ }],
541
+ accept: [{
542
+ type: i0.Input,
543
+ args: [{
544
+ isSignal: true,
545
+ alias: "accept",
546
+ required: false
547
+ }]
548
+ }],
549
+ changed: [{
550
+ type: i0.Output,
551
+ args: ["changed"]
552
+ }],
553
+ download: [{
554
+ type: i0.Output,
555
+ args: ["download"]
556
+ }],
557
+ preview: [{
558
+ type: i0.Output,
559
+ args: ["preview"]
560
+ }]
561
+ }
562
+ });
563
+ var FilePreviewComponent = class FilePreviewComponent {
564
+ constructor() {
565
+ this.iframe = viewChild("iframe", ...ngDevMode ? [{ debugName: "iframe" }] : /* istanbul ignore next */ []);
566
+ this.httpClient = inject(HttpClient);
567
+ this.dialogService = inject(ShellService);
568
+ this.dialogData = inject(MAT_DIALOG_DATA) ?? {};
569
+ this.url = signal(null, ...ngDevMode ? [{ debugName: "url" }] : /* istanbul ignore next */ []);
570
+ inject(DestroyRef).onDestroy(() => {
571
+ const u = this.url();
572
+ if (u?.startsWith("blob:")) URL.revokeObjectURL(u);
573
+ });
574
+ const data = this.dialogData;
575
+ if (!data?.url) return;
576
+ if (!data.embed) {
577
+ this.dialogService.setBusy("Download in corso...");
578
+ this.httpClient.get(data.url, {
579
+ headers: data.authToken ? new HttpHeaders().set("Authorization", data.authToken) : new HttpHeaders(),
580
+ responseType: "blob"
581
+ }).pipe(takeUntilDestroyed()).subscribe({
582
+ next: (res) => {
583
+ this.url.set(URL.createObjectURL(res));
584
+ this.dialogService.clearBusy();
585
+ },
586
+ error: () => {
587
+ this.dialogService.clearBusy();
588
+ }
589
+ });
590
+ } else this.url.set("https://view.officeapps.live.com/op/embed.aspx?src=" + encodeURIComponent(data.url));
591
+ }
592
+ loaded() {
593
+ const iframe = this.iframe()?.nativeElement;
594
+ if (!iframe) return;
595
+ try {
596
+ iframe.contentWindow?.scrollTo(0, 0);
597
+ if (!this.dialogData?.embed && iframe.contentDocument) {
598
+ const images = iframe.contentDocument.querySelectorAll("img") || [];
599
+ if (images.length === 1) {
600
+ Object.assign(images[0].style, {
601
+ position: "absolute",
602
+ top: "50%",
603
+ left: "50%",
604
+ transform: "translate(-50%, -50%)",
605
+ maxWidth: images[0].style.maxWidth || "100%",
606
+ maxHeight: images[0].style.maxHeight || "100%"
607
+ });
608
+ const iframeBody = iframe.contentDocument.body;
609
+ if (iframeBody && !iframeBody.style.height) iframeBody.style.height = "100%";
610
+ }
611
+ }
612
+ } catch (e) {
613
+ console.error("Impossibile accedere al contenuto dell'iframe:", e);
614
+ }
615
+ }
616
+ download() {
617
+ const currentUrl = this.url();
618
+ if (currentUrl) window.open(currentUrl, "_blank");
619
+ }
620
+ troubles() {
621
+ this.dialogService.info("<p>Se non riesci a visualizzare l'anteprima dei file PDF probabilmente devi abilitare un'impostazione del tuo browser.</p><b>Per Google Chrome</b><br><p class='small' style='padding-left:10px'><i>impostazioni > privacy e sicurezza > impostazioni sito > documenti PDF</i></p><b>Per Microsoft Edge</b><br><p class='small' style='padding-left:10px'><i>impostazioni > cookie e autorizzazioni sito > documenti PDF</i></p><b>Per Mozilla Firefox</b><br><p class='small' style='padding-left:10px'><i>impostazioni > generale > applicazioni</i></p><b>Altri browser</b><br><p class='small' style='padding-left:10px'>Fate riferimento alla documentazione specifica del vostro browser.</p>", "Problemi con le anteprime dei file PDF?");
622
+ }
623
+ static {
624
+ this.ɵfac = i0.ɵɵngDeclareFactory({
625
+ minVersion: "12.0.0",
626
+ version: "22.2.1",
627
+ ngImport: i0,
628
+ type: FilePreviewComponent,
629
+ deps: [],
630
+ target: i0.ɵɵFactoryTarget.Component
631
+ });
632
+ }
633
+ static {
634
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
635
+ minVersion: "17.0.0",
636
+ version: "22.2.1",
637
+ type: FilePreviewComponent,
638
+ isStandalone: true,
639
+ selector: "ng-component",
640
+ viewQueries: [{
641
+ propertyName: "iframe",
642
+ first: true,
643
+ predicate: ["iframe"],
644
+ descendants: true,
645
+ isSignal: true
646
+ }],
647
+ ngImport: i0,
648
+ template: "<mat-dialog-content class=\"file-preview\" id=\"file-preview-scrollable\">\r\n <div class=\"content\">\r\n @if (!url()) {\r\n <div class=\"loading\">Caricamento in corso...</div>\r\n } @else {\r\n <iframe class=\"iframe\" #iframe (load)=\"loaded()\" [src]=\"url() | safeUrl\"></iframe>\r\n }\r\n </div>\r\n</mat-dialog-content>\r\n<mat-dialog-actions id=\"file-preview-fixed\">\r\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\" fxLayoutGap=\"10px\" fxFill>\r\n <div fxFlex=\"50\">\r\n <button mat-stroked-button (click)=\"troubles()\"\r\n matTooltip=\"Fai click se non riesci a visualizzare l'anteprima dei file PDF\">Problemi con i PDF?</button>\r\n </div>\r\n <div fxFlex=\"50\" fxLayoutAlign=\"end\">\r\n <button mat-stroked-button (click)=\"download()\">Scarica</button>\r\n <button mat-stroked-button [mat-dialog-close]=\"true\" >Chiudi</button>\r\n </div>\r\n </div>\r\n</mat-dialog-actions>",
649
+ styles: [".file-preview{padding:0}.file-preview .content{height:100%;width:100%;overflow:hidden;background-color:var(--ars-filepreview-content-background-color, #f7faf8)}.file-preview .content .loading{animation:blinker 2s linear infinite;font-size:x-large;color:var(--ars-color-text, #191c1b);width:100%;height:100%;padding:20px}.file-preview .content .iframe{width:100%;height:100%;border:0;background-color:var(--ars-filepreview-content-background-color, #f7faf8)!important}@keyframes blinker{50%{opacity:0}}.mat-mdc-dialog-content{max-height:unset!important;padding:0!important}\n"],
650
+ dependencies: [
651
+ {
652
+ kind: "directive",
653
+ type: MatDialogContent,
654
+ selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]"
655
+ },
656
+ {
657
+ kind: "ngmodule",
658
+ type: FlexLayoutModule
659
+ },
660
+ {
661
+ kind: "directive",
662
+ type: i1.FxLayoutDirective,
663
+ 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] ",
664
+ inputs: [
665
+ "fxLayout",
666
+ "fxLayout.xs",
667
+ "fxLayout.sm",
668
+ "fxLayout.md",
669
+ "fxLayout.lg",
670
+ "fxLayout.xl",
671
+ "fxLayout.lt-sm",
672
+ "fxLayout.lt-md",
673
+ "fxLayout.lt-lg",
674
+ "fxLayout.lt-xl",
675
+ "fxLayout.gt-xs",
676
+ "fxLayout.gt-sm",
677
+ "fxLayout.gt-md",
678
+ "fxLayout.gt-lg"
679
+ ]
680
+ },
681
+ {
682
+ kind: "directive",
683
+ type: i1.FxFlexDirective,
684
+ 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] ",
685
+ inputs: [
686
+ "fxFlex",
687
+ "fxFlex.xs",
688
+ "fxFlex.sm",
689
+ "fxFlex.md",
690
+ "fxFlex.lg",
691
+ "fxFlex.xl",
692
+ "fxFlex.lt-sm",
693
+ "fxFlex.lt-md",
694
+ "fxFlex.lt-lg",
695
+ "fxFlex.lt-xl",
696
+ "fxFlex.gt-xs",
697
+ "fxFlex.gt-sm",
698
+ "fxFlex.gt-md",
699
+ "fxFlex.gt-lg"
700
+ ]
701
+ },
702
+ {
703
+ kind: "directive",
704
+ type: i1.FxLayoutAlignDirective,
705
+ 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] ",
706
+ inputs: [
707
+ "fxLayoutAlign",
708
+ "fxLayoutAlign.xs",
709
+ "fxLayoutAlign.sm",
710
+ "fxLayoutAlign.md",
711
+ "fxLayoutAlign.lg",
712
+ "fxLayoutAlign.xl",
713
+ "fxLayoutAlign.lt-sm",
714
+ "fxLayoutAlign.lt-md",
715
+ "fxLayoutAlign.lt-lg",
716
+ "fxLayoutAlign.lt-xl",
717
+ "fxLayoutAlign.gt-xs",
718
+ "fxLayoutAlign.gt-sm",
719
+ "fxLayoutAlign.gt-md",
720
+ "fxLayoutAlign.gt-lg"
721
+ ]
722
+ },
723
+ {
724
+ kind: "directive",
725
+ type: i1.FxLayoutGapDirective,
726
+ 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] ",
727
+ inputs: [
728
+ "fxLayoutGap",
729
+ "fxLayoutGap.xs",
730
+ "fxLayoutGap.sm",
731
+ "fxLayoutGap.md",
732
+ "fxLayoutGap.lg",
733
+ "fxLayoutGap.xl",
734
+ "fxLayoutGap.lt-sm",
735
+ "fxLayoutGap.lt-md",
736
+ "fxLayoutGap.lt-lg",
737
+ "fxLayoutGap.lt-xl",
738
+ "fxLayoutGap.gt-xs",
739
+ "fxLayoutGap.gt-sm",
740
+ "fxLayoutGap.gt-md",
741
+ "fxLayoutGap.gt-lg"
742
+ ]
743
+ },
744
+ {
745
+ kind: "directive",
746
+ type: i1.FxFlexFillDirective,
747
+ 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] ",
748
+ inputs: [
749
+ "fxFlexFill",
750
+ "fxFill",
751
+ "fxFlexFill.xs",
752
+ "fxFlexFill.sm",
753
+ "fxFlexFill.md",
754
+ "fxFlexFill.lg",
755
+ "fxFlexFill.xl",
756
+ "fxFlexFill.lt-sm",
757
+ "fxFlexFill.lt-md",
758
+ "fxFlexFill.lt-lg",
759
+ "fxFlexFill.lt-xl",
760
+ "fxFlexFill.gt-xs",
761
+ "fxFlexFill.gt-sm",
762
+ "fxFlexFill.gt-md",
763
+ "fxFlexFill.gt-lg"
764
+ ]
765
+ },
766
+ {
767
+ kind: "directive",
768
+ type: MatDialogActions,
769
+ selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]",
770
+ inputs: ["align"]
771
+ },
772
+ {
773
+ kind: "ngmodule",
774
+ type: MatButtonModule
775
+ },
776
+ {
777
+ kind: "component",
778
+ type: i4.MatButton,
779
+ 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] ",
780
+ inputs: ["matButton"],
781
+ exportAs: ["matButton", "matAnchor"]
782
+ },
783
+ {
784
+ kind: "ngmodule",
785
+ type: MatTooltipModule
786
+ },
787
+ {
788
+ kind: "directive",
789
+ type: i6.MatTooltip,
790
+ selector: "[matTooltip]",
791
+ inputs: [
792
+ "matTooltipPosition",
793
+ "matTooltipPositionAtOrigin",
794
+ "matTooltipDisabled",
795
+ "matTooltipShowDelay",
796
+ "matTooltipHideDelay",
797
+ "matTooltipTouchGestures",
798
+ "matTooltip",
799
+ "matTooltipClass"
800
+ ],
801
+ exportAs: ["matTooltip"]
802
+ },
803
+ {
804
+ kind: "directive",
805
+ type: MatDialogClose,
806
+ selector: "[mat-dialog-close], [matDialogClose]",
807
+ inputs: [
808
+ "aria-label",
809
+ "type",
810
+ "mat-dialog-close",
811
+ "matDialogClose"
812
+ ],
813
+ exportAs: ["matDialogClose"]
814
+ },
815
+ {
816
+ kind: "pipe",
817
+ type: SafeUrlPipe,
818
+ name: "safeUrl"
819
+ }
820
+ ],
821
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
822
+ });
823
+ }
824
+ };
825
+ i0.ɵɵngDeclareClassMetadata({
826
+ minVersion: "12.0.0",
827
+ version: "22.2.1",
828
+ ngImport: i0,
829
+ type: FilePreviewComponent,
830
+ decorators: [{
831
+ type: Component,
832
+ args: [{
833
+ standalone: true,
834
+ changeDetection: ChangeDetectionStrategy.OnPush,
835
+ imports: [
836
+ MatDialogContent,
837
+ FlexLayoutModule,
838
+ MatDialogActions,
839
+ MatButtonModule,
840
+ MatTooltipModule,
841
+ MatDialogClose,
842
+ SafeUrlPipe
843
+ ],
844
+ template: "<mat-dialog-content class=\"file-preview\" id=\"file-preview-scrollable\">\r\n <div class=\"content\">\r\n @if (!url()) {\r\n <div class=\"loading\">Caricamento in corso...</div>\r\n } @else {\r\n <iframe class=\"iframe\" #iframe (load)=\"loaded()\" [src]=\"url() | safeUrl\"></iframe>\r\n }\r\n </div>\r\n</mat-dialog-content>\r\n<mat-dialog-actions id=\"file-preview-fixed\">\r\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\" fxLayoutGap=\"10px\" fxFill>\r\n <div fxFlex=\"50\">\r\n <button mat-stroked-button (click)=\"troubles()\"\r\n matTooltip=\"Fai click se non riesci a visualizzare l'anteprima dei file PDF\">Problemi con i PDF?</button>\r\n </div>\r\n <div fxFlex=\"50\" fxLayoutAlign=\"end\">\r\n <button mat-stroked-button (click)=\"download()\">Scarica</button>\r\n <button mat-stroked-button [mat-dialog-close]=\"true\" >Chiudi</button>\r\n </div>\r\n </div>\r\n</mat-dialog-actions>",
845
+ styles: [".file-preview{padding:0}.file-preview .content{height:100%;width:100%;overflow:hidden;background-color:var(--ars-filepreview-content-background-color, #f7faf8)}.file-preview .content .loading{animation:blinker 2s linear infinite;font-size:x-large;color:var(--ars-color-text, #191c1b);width:100%;height:100%;padding:20px}.file-preview .content .iframe{width:100%;height:100%;border:0;background-color:var(--ars-filepreview-content-background-color, #f7faf8)!important}@keyframes blinker{50%{opacity:0}}.mat-mdc-dialog-content{max-height:unset!important;padding:0!important}\n"]
846
+ }]
847
+ }],
848
+ ctorParameters: () => [],
849
+ propDecorators: { iframe: [{
850
+ type: i0.ViewChild,
851
+ args: ["iframe", { isSignal: true }]
852
+ }] }
853
+ });
854
+ var SelectFileDialogComponent = class SelectFileDialogComponent {
855
+ constructor() {
856
+ this.done = output();
857
+ this.dialogService = inject(ShellService);
858
+ this.dialogRef = inject(MatDialogRef);
859
+ this.dialogData = signal(inject(MAT_DIALOG_DATA) ?? {}, ...ngDevMode ? [{ debugName: "dialogData" }] : /* istanbul ignore next */ []);
860
+ this.file = signal(void 0, ...ngDevMode ? [{ debugName: "file" }] : /* istanbul ignore next */ []);
861
+ this.fileClass = signal("selectfile-file", ...ngDevMode ? [{ debugName: "fileClass" }] : /* istanbul ignore next */ []);
862
+ }
863
+ update(e) {
864
+ const input = e.target;
865
+ if (input.files?.length) this.selectFile(input.files[0]);
866
+ }
867
+ selectFile(file) {
868
+ const data = this.dialogData();
869
+ const maxSize = data.maxSize ?? 0;
870
+ if (maxSize > 0) {
871
+ if (file.size / 1048576 > maxSize) {
872
+ this.dialogService.error(`File troppo grande (massimo ${SystemUtils.formatFileSize(maxSize * 1048576)})`);
873
+ return;
874
+ }
875
+ }
876
+ if (data.accept) {
877
+ const accept = data.accept.toLowerCase();
878
+ const a = file.name.split(".").pop()?.toLowerCase();
879
+ let b = file.type.toLowerCase();
880
+ if (b.startsWith("image/") && accept.includes("image/*")) b = "image/*";
881
+ else if (b.startsWith("video/") && accept.includes("video/*")) b = "video/*";
882
+ else if (b.startsWith("audio/") && accept.includes("audio/*")) b = "audio/*";
883
+ if (!accept.includes(a ?? "") && !accept.includes(b)) {
884
+ this.dialogService.error(`Sono accettati solo questi tipi di file: ${accept}`);
885
+ return;
886
+ }
887
+ }
888
+ this.file.set(file);
889
+ }
890
+ size(size) {
891
+ return SystemUtils.formatFileSize(size);
892
+ }
893
+ ok() {
894
+ this.done.emit({
895
+ file: this.file(),
896
+ options: this.dialogData().options
897
+ });
898
+ setTimeout(() => {
899
+ this.dialogRef.close();
900
+ }, 500);
901
+ }
902
+ onDragOver(e) {
903
+ this.fileClass.set("selectfile-file-drop");
904
+ e.preventDefault();
905
+ }
906
+ onDragEnter(e) {
907
+ this.fileClass.set("selectfile-file-drop");
908
+ e.preventDefault();
909
+ }
910
+ onDragEnd(e) {
911
+ this.fileClass.set("selectfile-file");
912
+ e.preventDefault();
913
+ }
914
+ onDragLeave(e) {
915
+ this.fileClass.set("selectfile-file");
916
+ e.preventDefault();
917
+ }
918
+ onDrop(e) {
919
+ this.fileClass.set("selectfile-file");
920
+ e.preventDefault();
921
+ e.stopPropagation();
922
+ if (e.dataTransfer?.files?.length) this.addFiles(e.dataTransfer.files);
923
+ }
924
+ addFiles(files) {
925
+ if (files.length > 0) this.selectFile(files[0]);
926
+ }
927
+ static {
928
+ this.ɵfac = i0.ɵɵngDeclareFactory({
929
+ minVersion: "12.0.0",
930
+ version: "22.2.1",
931
+ ngImport: i0,
932
+ type: SelectFileDialogComponent,
933
+ deps: [],
934
+ target: i0.ɵɵFactoryTarget.Component
935
+ });
936
+ }
937
+ static {
938
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
939
+ minVersion: "17.0.0",
940
+ version: "22.2.1",
941
+ type: SelectFileDialogComponent,
942
+ isStandalone: true,
943
+ selector: "ng-component",
944
+ outputs: { done: "done" },
945
+ ngImport: i0,
946
+ template: "<div mat-dialog-title [innerHTML]=\"dialogData().title | safeHtml\"></div>\n@if (dialogData().description) {\n<div class=\"selectfile-description\" [innerHtml]=\"dialogData().description | safeHtml\"></div>\n}\n<mat-dialog-content class=\"dialog-content\">\n <div fxLayout=\"column\" fxLayoutGap=\"24px\" fxLayoutAlign=\"center center\" fxFill>\n <div fxFlex=\"*\" [class]=\"fileClass()\" (drop)=\"onDrop($event)\" (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\" (dragenter)=\"onDragEnter($event)\" (dragend)=\"onDragEnd($event)\">\n <div fxLayout=\"column\" fxLayoutGap=\"24px\" fxLayoutAlign=\"center center\" fxFill>\n <div fxFlex=\"10px\" fxFlexAlign=\"start\" class=\"x-small secondary\"><i>Trascina qui il file o selezionalo</i></div>\n <div>\n <input #_file type=\"file\" [accept]=\"dialogData().accept\" [hidden]=\"true\" (change)=\"update($event)\" />\n <button type=\"button\" mat-stroked-button (click)=\"_file.click()\">Seleziona file...</button>\n </div>\n @if (file()) {\n <div style=\"padding:0 24px\">\n <div fxLayout=\"column\" fxLayoutAlign=\"center center\" fxFill>\n <div class=\"small accent bold\"><i>{{file().name}}</i></div>\n <div class=\"small\">Dimensioni: <i>{{size(file().size)}}</i></div>\n </div>\n </div>\n }\n </div>\n </div>\n @if (dialogData().options) {\n <div style=\"padding-bottom: 24px;\">\n @for (o of dialogData().options; track o; let i = $index) {\n <div>\n <mat-checkbox (change)=\"o.selected = $event.checked\" [checked]=\"o.selected === true\" name=\"opt_{{i}}\" >\n {{o.description}}\n </mat-checkbox>\n </div>\n }\n </div>\n }\n </div>\n</mat-dialog-content>\n<mat-dialog-actions>\n <div fxLayout=\"row\" fxLayoutGap=\"10px\" fxFill>\n <div fxFlex=\"50\">\n @if (dialogData().helpLink) {\n <a mat-stroked-button href=\"{{dialogData().helpLink}}\" target=\"_blank\">{{dialogData().helpCaption}}</a>\n }\n </div>\n <div fxFlex=\"50\" fxLayoutAlign=\"end\">\n <button mat-flat-button (click)=\"ok()\" [disabled]=\"!file()\">{{dialogData().okCaption}}</button>\n <button mat-stroked-button [mat-dialog-close]=\"true\">Annulla</button>\n </div>\n </div>\n</mat-dialog-actions>",
947
+ 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}}.selectfile-file,.selectfile-file-drop{padding:4px 4px 24px;width:80%;border:5px dotted var(--ars-color-divider, #757d87)!important}.selectfile-file-drop{border:5px dotted var(--ars-color-accent, #7894ae)!important}.selectfile-description{padding:0 24px 24px}.dialog-content{padding:0 24px 24px!important}\n"],
948
+ dependencies: [
949
+ {
950
+ kind: "directive",
951
+ type: MatDialogTitle,
952
+ selector: "[mat-dialog-title], [matDialogTitle]",
953
+ inputs: ["id"],
954
+ exportAs: ["matDialogTitle"]
955
+ },
956
+ {
957
+ kind: "directive",
958
+ type: MatDialogContent,
959
+ selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]"
960
+ },
961
+ {
962
+ kind: "ngmodule",
963
+ type: FlexLayoutModule
964
+ },
965
+ {
966
+ kind: "directive",
967
+ type: i1.FxLayoutDirective,
968
+ 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] ",
969
+ inputs: [
970
+ "fxLayout",
971
+ "fxLayout.xs",
972
+ "fxLayout.sm",
973
+ "fxLayout.md",
974
+ "fxLayout.lg",
975
+ "fxLayout.xl",
976
+ "fxLayout.lt-sm",
977
+ "fxLayout.lt-md",
978
+ "fxLayout.lt-lg",
979
+ "fxLayout.lt-xl",
980
+ "fxLayout.gt-xs",
981
+ "fxLayout.gt-sm",
982
+ "fxLayout.gt-md",
983
+ "fxLayout.gt-lg"
984
+ ]
985
+ },
986
+ {
987
+ kind: "directive",
988
+ type: i1.FxFlexDirective,
989
+ 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] ",
990
+ inputs: [
991
+ "fxFlex",
992
+ "fxFlex.xs",
993
+ "fxFlex.sm",
994
+ "fxFlex.md",
995
+ "fxFlex.lg",
996
+ "fxFlex.xl",
997
+ "fxFlex.lt-sm",
998
+ "fxFlex.lt-md",
999
+ "fxFlex.lt-lg",
1000
+ "fxFlex.lt-xl",
1001
+ "fxFlex.gt-xs",
1002
+ "fxFlex.gt-sm",
1003
+ "fxFlex.gt-md",
1004
+ "fxFlex.gt-lg"
1005
+ ]
1006
+ },
1007
+ {
1008
+ kind: "directive",
1009
+ type: i1.FxLayoutAlignDirective,
1010
+ 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] ",
1011
+ inputs: [
1012
+ "fxLayoutAlign",
1013
+ "fxLayoutAlign.xs",
1014
+ "fxLayoutAlign.sm",
1015
+ "fxLayoutAlign.md",
1016
+ "fxLayoutAlign.lg",
1017
+ "fxLayoutAlign.xl",
1018
+ "fxLayoutAlign.lt-sm",
1019
+ "fxLayoutAlign.lt-md",
1020
+ "fxLayoutAlign.lt-lg",
1021
+ "fxLayoutAlign.lt-xl",
1022
+ "fxLayoutAlign.gt-xs",
1023
+ "fxLayoutAlign.gt-sm",
1024
+ "fxLayoutAlign.gt-md",
1025
+ "fxLayoutAlign.gt-lg"
1026
+ ]
1027
+ },
1028
+ {
1029
+ kind: "directive",
1030
+ type: i1.FxLayoutGapDirective,
1031
+ 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] ",
1032
+ inputs: [
1033
+ "fxLayoutGap",
1034
+ "fxLayoutGap.xs",
1035
+ "fxLayoutGap.sm",
1036
+ "fxLayoutGap.md",
1037
+ "fxLayoutGap.lg",
1038
+ "fxLayoutGap.xl",
1039
+ "fxLayoutGap.lt-sm",
1040
+ "fxLayoutGap.lt-md",
1041
+ "fxLayoutGap.lt-lg",
1042
+ "fxLayoutGap.lt-xl",
1043
+ "fxLayoutGap.gt-xs",
1044
+ "fxLayoutGap.gt-sm",
1045
+ "fxLayoutGap.gt-md",
1046
+ "fxLayoutGap.gt-lg"
1047
+ ]
1048
+ },
1049
+ {
1050
+ kind: "directive",
1051
+ type: i1.FxFlexAlignDirective,
1052
+ 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] ",
1053
+ inputs: [
1054
+ "fxFlexAlign",
1055
+ "fxFlexAlign.xs",
1056
+ "fxFlexAlign.sm",
1057
+ "fxFlexAlign.md",
1058
+ "fxFlexAlign.lg",
1059
+ "fxFlexAlign.xl",
1060
+ "fxFlexAlign.lt-sm",
1061
+ "fxFlexAlign.lt-md",
1062
+ "fxFlexAlign.lt-lg",
1063
+ "fxFlexAlign.lt-xl",
1064
+ "fxFlexAlign.gt-xs",
1065
+ "fxFlexAlign.gt-sm",
1066
+ "fxFlexAlign.gt-md",
1067
+ "fxFlexAlign.gt-lg"
1068
+ ]
1069
+ },
1070
+ {
1071
+ kind: "directive",
1072
+ type: i1.FxFlexFillDirective,
1073
+ 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] ",
1074
+ inputs: [
1075
+ "fxFlexFill",
1076
+ "fxFill",
1077
+ "fxFlexFill.xs",
1078
+ "fxFlexFill.sm",
1079
+ "fxFlexFill.md",
1080
+ "fxFlexFill.lg",
1081
+ "fxFlexFill.xl",
1082
+ "fxFlexFill.lt-sm",
1083
+ "fxFlexFill.lt-md",
1084
+ "fxFlexFill.lt-lg",
1085
+ "fxFlexFill.lt-xl",
1086
+ "fxFlexFill.gt-xs",
1087
+ "fxFlexFill.gt-sm",
1088
+ "fxFlexFill.gt-md",
1089
+ "fxFlexFill.gt-lg"
1090
+ ]
1091
+ },
1092
+ {
1093
+ kind: "ngmodule",
1094
+ type: MatButtonModule
1095
+ },
1096
+ {
1097
+ kind: "component",
1098
+ type: i4.MatButton,
1099
+ 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] ",
1100
+ inputs: ["matButton"],
1101
+ exportAs: ["matButton", "matAnchor"]
1102
+ },
1103
+ {
1104
+ kind: "ngmodule",
1105
+ type: MatCheckboxModule
1106
+ },
1107
+ {
1108
+ kind: "component",
1109
+ type: i3.MatCheckbox,
1110
+ selector: "mat-checkbox",
1111
+ inputs: [
1112
+ "aria-label",
1113
+ "aria-labelledby",
1114
+ "aria-describedby",
1115
+ "aria-expanded",
1116
+ "aria-controls",
1117
+ "aria-owns",
1118
+ "id",
1119
+ "required",
1120
+ "labelPosition",
1121
+ "name",
1122
+ "value",
1123
+ "disableRipple",
1124
+ "tabIndex",
1125
+ "color",
1126
+ "disabledInteractive",
1127
+ "checked",
1128
+ "disabled",
1129
+ "indeterminate"
1130
+ ],
1131
+ outputs: ["change", "indeterminateChange"],
1132
+ exportAs: ["matCheckbox"]
1133
+ },
1134
+ {
1135
+ kind: "directive",
1136
+ type: MatDialogActions,
1137
+ selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]",
1138
+ inputs: ["align"]
1139
+ },
1140
+ {
1141
+ kind: "directive",
1142
+ type: MatDialogClose,
1143
+ selector: "[mat-dialog-close], [matDialogClose]",
1144
+ inputs: [
1145
+ "aria-label",
1146
+ "type",
1147
+ "mat-dialog-close",
1148
+ "matDialogClose"
1149
+ ],
1150
+ exportAs: ["matDialogClose"]
1151
+ },
1152
+ {
1153
+ kind: "pipe",
1154
+ type: SafeHtmlPipe,
1155
+ name: "safeHtml"
1156
+ }
1157
+ ],
1158
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
1159
+ });
1160
+ }
1161
+ };
1162
+ i0.ɵɵngDeclareClassMetadata({
1163
+ minVersion: "12.0.0",
1164
+ version: "22.2.1",
1165
+ ngImport: i0,
1166
+ type: SelectFileDialogComponent,
1167
+ decorators: [{
1168
+ type: Component,
1169
+ args: [{
1170
+ standalone: true,
1171
+ changeDetection: ChangeDetectionStrategy.OnPush,
1172
+ imports: [
1173
+ MatDialogTitle,
1174
+ MatDialogContent,
1175
+ FlexLayoutModule,
1176
+ MatButtonModule,
1177
+ MatCheckboxModule,
1178
+ MatDialogActions,
1179
+ MatDialogClose,
1180
+ SafeHtmlPipe
1181
+ ],
1182
+ template: "<div mat-dialog-title [innerHTML]=\"dialogData().title | safeHtml\"></div>\n@if (dialogData().description) {\n<div class=\"selectfile-description\" [innerHtml]=\"dialogData().description | safeHtml\"></div>\n}\n<mat-dialog-content class=\"dialog-content\">\n <div fxLayout=\"column\" fxLayoutGap=\"24px\" fxLayoutAlign=\"center center\" fxFill>\n <div fxFlex=\"*\" [class]=\"fileClass()\" (drop)=\"onDrop($event)\" (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\" (dragenter)=\"onDragEnter($event)\" (dragend)=\"onDragEnd($event)\">\n <div fxLayout=\"column\" fxLayoutGap=\"24px\" fxLayoutAlign=\"center center\" fxFill>\n <div fxFlex=\"10px\" fxFlexAlign=\"start\" class=\"x-small secondary\"><i>Trascina qui il file o selezionalo</i></div>\n <div>\n <input #_file type=\"file\" [accept]=\"dialogData().accept\" [hidden]=\"true\" (change)=\"update($event)\" />\n <button type=\"button\" mat-stroked-button (click)=\"_file.click()\">Seleziona file...</button>\n </div>\n @if (file()) {\n <div style=\"padding:0 24px\">\n <div fxLayout=\"column\" fxLayoutAlign=\"center center\" fxFill>\n <div class=\"small accent bold\"><i>{{file().name}}</i></div>\n <div class=\"small\">Dimensioni: <i>{{size(file().size)}}</i></div>\n </div>\n </div>\n }\n </div>\n </div>\n @if (dialogData().options) {\n <div style=\"padding-bottom: 24px;\">\n @for (o of dialogData().options; track o; let i = $index) {\n <div>\n <mat-checkbox (change)=\"o.selected = $event.checked\" [checked]=\"o.selected === true\" name=\"opt_{{i}}\" >\n {{o.description}}\n </mat-checkbox>\n </div>\n }\n </div>\n }\n </div>\n</mat-dialog-content>\n<mat-dialog-actions>\n <div fxLayout=\"row\" fxLayoutGap=\"10px\" fxFill>\n <div fxFlex=\"50\">\n @if (dialogData().helpLink) {\n <a mat-stroked-button href=\"{{dialogData().helpLink}}\" target=\"_blank\">{{dialogData().helpCaption}}</a>\n }\n </div>\n <div fxFlex=\"50\" fxLayoutAlign=\"end\">\n <button mat-flat-button (click)=\"ok()\" [disabled]=\"!file()\">{{dialogData().okCaption}}</button>\n <button mat-stroked-button [mat-dialog-close]=\"true\">Annulla</button>\n </div>\n </div>\n</mat-dialog-actions>",
1183
+ 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}}.selectfile-file,.selectfile-file-drop{padding:4px 4px 24px;width:80%;border:5px dotted var(--ars-color-divider, #757d87)!important}.selectfile-file-drop{border:5px dotted var(--ars-color-accent, #7894ae)!important}.selectfile-description{padding:0 24px 24px}.dialog-content{padding:0 24px 24px!important}\n"]
1184
+ }]
1185
+ }],
1186
+ propDecorators: { done: [{
1187
+ type: i0.Output,
1188
+ args: ["done"]
1189
+ }] }
1190
+ });
1191
+ var SelectPictureDialogComponent = class SelectPictureDialogComponent {
1192
+ constructor() {
1193
+ this.done = output();
1194
+ this.dialogService = inject(ShellService);
1195
+ this.dialogRef = inject(MatDialogRef);
1196
+ this.dialogData = signal(inject(MAT_DIALOG_DATA) ?? {}, ...ngDevMode ? [{ debugName: "dialogData" }] : /* istanbul ignore next */ []);
1197
+ this.file = signal(void 0, ...ngDevMode ? [{ debugName: "file" }] : /* istanbul ignore next */ []);
1198
+ this.fileClass = signal("selectpicture-file", ...ngDevMode ? [{ debugName: "fileClass" }] : /* istanbul ignore next */ []);
1199
+ this.pictureWidth = signal(0, ...ngDevMode ? [{ debugName: "pictureWidth" }] : /* istanbul ignore next */ []);
1200
+ this.pictureHeight = signal(0, ...ngDevMode ? [{ debugName: "pictureHeight" }] : /* istanbul ignore next */ []);
1201
+ this.picturePreview = signal(void 0, ...ngDevMode ? [{ debugName: "picturePreview" }] : /* istanbul ignore next */ []);
1202
+ }
1203
+ update(e) {
1204
+ const input = e.target;
1205
+ if (input.files?.length) this.selectFile(input.files[0]);
1206
+ }
1207
+ selectFile(file) {
1208
+ const data = this.dialogData();
1209
+ const maxSize = data.maxSize ?? 0;
1210
+ if (maxSize > 0) {
1211
+ if (file.size / 1048576 > maxSize) {
1212
+ this.dialogService.error(`File troppo grande (massimo ${SystemUtils.formatFileSize(maxSize * 1048576)})`);
1213
+ return;
1214
+ }
1215
+ }
1216
+ if (data.accept) {
1217
+ const accept = data.accept.toLowerCase();
1218
+ const a = file.name.split(".").pop()?.toLowerCase();
1219
+ let b = file.type.toLowerCase();
1220
+ if (b.startsWith("image/") && accept.includes("image/*")) b = "image/*";
1221
+ else if (b.startsWith("video/") && accept.includes("video/*")) b = "video/*";
1222
+ else if (b.startsWith("audio/") && accept.includes("audio/*")) b = "audio/*";
1223
+ if (!accept.includes(a ?? "") && !accept.includes(b)) {
1224
+ this.dialogService.error(`Sono accettati solo questi tipi di file: ${accept}`);
1225
+ return;
1226
+ }
1227
+ }
1228
+ const reader = new FileReader();
1229
+ reader.onload = (_e) => {
1230
+ const img = new Image();
1231
+ img.onload = () => {
1232
+ const maxWidth = data.maxWidth ?? 0;
1233
+ if (maxWidth > 0 && img.width > maxWidth) {
1234
+ this.dialogService.error(`Immagine troppo larga (massimo ${maxWidth} pixel)`);
1235
+ return;
1236
+ }
1237
+ const maxHeight = data.maxHeight ?? 0;
1238
+ if (maxHeight > 0 && img.height > maxHeight) {
1239
+ this.dialogService.error(`Immagine troppo alta (massimo ${maxHeight} pixel)`);
1240
+ return;
1241
+ }
1242
+ this.pictureWidth.set(img.width);
1243
+ this.pictureHeight.set(img.height);
1244
+ this.picturePreview.set(_e.target.result);
1245
+ this.file.set(file);
1246
+ };
1247
+ img.src = _e.target.result;
1248
+ };
1249
+ reader.readAsDataURL(file);
1250
+ }
1251
+ size(size) {
1252
+ return SystemUtils.formatFileSize(size);
1253
+ }
1254
+ ok() {
1255
+ this.done.emit({
1256
+ file: this.file(),
1257
+ options: this.dialogData().options
1258
+ });
1259
+ setTimeout(() => {
1260
+ this.dialogRef.close();
1261
+ }, 500);
1262
+ }
1263
+ onDragOver(e) {
1264
+ this.fileClass.set("selectpicture-file-drop");
1265
+ e.preventDefault();
1266
+ }
1267
+ onDragEnter(e) {
1268
+ this.fileClass.set("selectpicture-file-drop");
1269
+ e.preventDefault();
1270
+ }
1271
+ onDragEnd(e) {
1272
+ this.fileClass.set("selectpicture-file");
1273
+ e.preventDefault();
1274
+ }
1275
+ onDragLeave(e) {
1276
+ this.fileClass.set("selectpicture-file");
1277
+ e.preventDefault();
1278
+ }
1279
+ onDrop(e) {
1280
+ this.fileClass.set("selectpicture-file");
1281
+ e.preventDefault();
1282
+ e.stopPropagation();
1283
+ if (e.dataTransfer?.files?.length) this.addFiles(e.dataTransfer.files);
1284
+ }
1285
+ addFiles(files) {
1286
+ if (files.length > 0) this.selectFile(files[0]);
1287
+ }
1288
+ static {
1289
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1290
+ minVersion: "12.0.0",
1291
+ version: "22.2.1",
1292
+ ngImport: i0,
1293
+ type: SelectPictureDialogComponent,
1294
+ deps: [],
1295
+ target: i0.ɵɵFactoryTarget.Component
1296
+ });
1297
+ }
1298
+ static {
1299
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1300
+ minVersion: "17.0.0",
1301
+ version: "22.2.1",
1302
+ type: SelectPictureDialogComponent,
1303
+ isStandalone: true,
1304
+ selector: "ng-component",
1305
+ outputs: { done: "done" },
1306
+ ngImport: i0,
1307
+ template: "<div mat-dialog-title [innerHTML]=\"dialogData().title | safeHtml\"></div>\n@if (dialogData().description) {\n<div class=\"selectpicture-description\" [innerHtml]=\"dialogData().description | safeHtml\"></div>\n}\n<mat-dialog-content class=\"dialog-content\">\n <div fxLayout=\"column\" fxLayoutAlign=\"center center\" fxLayoutGap=\"24px\" fxFill>\n <div fxFlex=\"*\" [class]=\"fileClass()\" (drop)=\"onDrop($event)\" (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\" (dragenter)=\"onDragEnter($event)\" (dragend)=\"onDragEnd($event)\">\n <div fxLayout=\"column\" fxLayoutGap=\"24px\" fxLayoutAlign=\"center center\" fxFill>\n <div fxFlex=\"10px\" fxFlexAlign=\"start\" class=\"x-small secondary\"><i>Trascina qui l'immagine o selezionala</i></div>\n <div>\n <input #_file type=\"file\" [hidden]=\"true\" [accept]=\"dialogData().accept ?? 'image/*'\"\n (change)=\"update($event)\" />\n <button type=\"button\" mat-stroked-button (click)=\"_file.click()\">Seleziona file...</button>\n </div>\n @if (file()) {\n <div style=\"padding:0 24px\">\n <div fxLayout=\"column\" fxLayoutAlign=\"center center\" fxFill>\n <img [src]=\"picturePreview()\" class=\"selectpicture-preview\">\n <div class=\"small accent bold \"><i>{{file().name}}</i></div>\n <div class=\"small\">Dimensioni:<i>{{pictureWidth()}} x {{pictureHeight()}} ({{size(file().size)}})</i></div>\n </div>\n </div>\n }\n </div>\n </div>\n @if (dialogData().options) {\n <div style=\"padding-bottom: 24px;\">\n @for (o of dialogData().options; track o; let i = $index) {\n <div>\n <mat-checkbox (change)=\"o.selected = $event.checked\" [checked]=\"o.selected === true\" name=\"opt_{{i}}\" >\n {{o.description}}\n </mat-checkbox>\n </div>\n }\n </div>\n }\n </div>\n</mat-dialog-content>\n<mat-dialog-actions>\n <div fxLayout=\"row\" fxLayoutAlign=\"end\" fxFill>\n <button mat-flat-button (click)=\"ok()\" [disabled]=\"!file()\">{{dialogData().okCaption}}</button>\n <button mat-stroked-button mat-dialog-close >Annulla</button>\n </div>\n</mat-dialog-actions>\n",
1308
+ 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}}.selectpicture-file{padding:24px;width:320px;border:5px dotted #eee}.selectpicture-preview{max-height:300px;max-width:300px;margin-bottom:15px!important}.selectpicture-file,.selectpicture-file-drop{padding:4px 4px 24px;width:80%;border:5px dotted var(--ars-color-divider, #757d87)!important}.selectpicture-file-drop{border:5px dotted var(--ars-color-accent, #7894ae)!important}.selectpicture-description{padding:0 24px 24px}.dialog-content{padding:0 24px 24px!important}\n"],
1309
+ dependencies: [
1310
+ {
1311
+ kind: "directive",
1312
+ type: MatDialogTitle,
1313
+ selector: "[mat-dialog-title], [matDialogTitle]",
1314
+ inputs: ["id"],
1315
+ exportAs: ["matDialogTitle"]
1316
+ },
1317
+ {
1318
+ kind: "directive",
1319
+ type: MatDialogContent,
1320
+ selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]"
1321
+ },
1322
+ {
1323
+ kind: "ngmodule",
1324
+ type: FlexLayoutModule
1325
+ },
1326
+ {
1327
+ kind: "directive",
1328
+ type: i1.FxLayoutDirective,
1329
+ 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] ",
1330
+ inputs: [
1331
+ "fxLayout",
1332
+ "fxLayout.xs",
1333
+ "fxLayout.sm",
1334
+ "fxLayout.md",
1335
+ "fxLayout.lg",
1336
+ "fxLayout.xl",
1337
+ "fxLayout.lt-sm",
1338
+ "fxLayout.lt-md",
1339
+ "fxLayout.lt-lg",
1340
+ "fxLayout.lt-xl",
1341
+ "fxLayout.gt-xs",
1342
+ "fxLayout.gt-sm",
1343
+ "fxLayout.gt-md",
1344
+ "fxLayout.gt-lg"
1345
+ ]
1346
+ },
1347
+ {
1348
+ kind: "directive",
1349
+ type: i1.FxFlexDirective,
1350
+ 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] ",
1351
+ inputs: [
1352
+ "fxFlex",
1353
+ "fxFlex.xs",
1354
+ "fxFlex.sm",
1355
+ "fxFlex.md",
1356
+ "fxFlex.lg",
1357
+ "fxFlex.xl",
1358
+ "fxFlex.lt-sm",
1359
+ "fxFlex.lt-md",
1360
+ "fxFlex.lt-lg",
1361
+ "fxFlex.lt-xl",
1362
+ "fxFlex.gt-xs",
1363
+ "fxFlex.gt-sm",
1364
+ "fxFlex.gt-md",
1365
+ "fxFlex.gt-lg"
1366
+ ]
1367
+ },
1368
+ {
1369
+ kind: "directive",
1370
+ type: i1.FxLayoutAlignDirective,
1371
+ 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] ",
1372
+ inputs: [
1373
+ "fxLayoutAlign",
1374
+ "fxLayoutAlign.xs",
1375
+ "fxLayoutAlign.sm",
1376
+ "fxLayoutAlign.md",
1377
+ "fxLayoutAlign.lg",
1378
+ "fxLayoutAlign.xl",
1379
+ "fxLayoutAlign.lt-sm",
1380
+ "fxLayoutAlign.lt-md",
1381
+ "fxLayoutAlign.lt-lg",
1382
+ "fxLayoutAlign.lt-xl",
1383
+ "fxLayoutAlign.gt-xs",
1384
+ "fxLayoutAlign.gt-sm",
1385
+ "fxLayoutAlign.gt-md",
1386
+ "fxLayoutAlign.gt-lg"
1387
+ ]
1388
+ },
1389
+ {
1390
+ kind: "directive",
1391
+ type: i1.FxLayoutGapDirective,
1392
+ 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] ",
1393
+ inputs: [
1394
+ "fxLayoutGap",
1395
+ "fxLayoutGap.xs",
1396
+ "fxLayoutGap.sm",
1397
+ "fxLayoutGap.md",
1398
+ "fxLayoutGap.lg",
1399
+ "fxLayoutGap.xl",
1400
+ "fxLayoutGap.lt-sm",
1401
+ "fxLayoutGap.lt-md",
1402
+ "fxLayoutGap.lt-lg",
1403
+ "fxLayoutGap.lt-xl",
1404
+ "fxLayoutGap.gt-xs",
1405
+ "fxLayoutGap.gt-sm",
1406
+ "fxLayoutGap.gt-md",
1407
+ "fxLayoutGap.gt-lg"
1408
+ ]
1409
+ },
1410
+ {
1411
+ kind: "directive",
1412
+ type: i1.FxFlexAlignDirective,
1413
+ 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] ",
1414
+ inputs: [
1415
+ "fxFlexAlign",
1416
+ "fxFlexAlign.xs",
1417
+ "fxFlexAlign.sm",
1418
+ "fxFlexAlign.md",
1419
+ "fxFlexAlign.lg",
1420
+ "fxFlexAlign.xl",
1421
+ "fxFlexAlign.lt-sm",
1422
+ "fxFlexAlign.lt-md",
1423
+ "fxFlexAlign.lt-lg",
1424
+ "fxFlexAlign.lt-xl",
1425
+ "fxFlexAlign.gt-xs",
1426
+ "fxFlexAlign.gt-sm",
1427
+ "fxFlexAlign.gt-md",
1428
+ "fxFlexAlign.gt-lg"
1429
+ ]
1430
+ },
1431
+ {
1432
+ kind: "directive",
1433
+ type: i1.FxFlexFillDirective,
1434
+ 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] ",
1435
+ inputs: [
1436
+ "fxFlexFill",
1437
+ "fxFill",
1438
+ "fxFlexFill.xs",
1439
+ "fxFlexFill.sm",
1440
+ "fxFlexFill.md",
1441
+ "fxFlexFill.lg",
1442
+ "fxFlexFill.xl",
1443
+ "fxFlexFill.lt-sm",
1444
+ "fxFlexFill.lt-md",
1445
+ "fxFlexFill.lt-lg",
1446
+ "fxFlexFill.lt-xl",
1447
+ "fxFlexFill.gt-xs",
1448
+ "fxFlexFill.gt-sm",
1449
+ "fxFlexFill.gt-md",
1450
+ "fxFlexFill.gt-lg"
1451
+ ]
1452
+ },
1453
+ {
1454
+ kind: "ngmodule",
1455
+ type: MatButtonModule
1456
+ },
1457
+ {
1458
+ kind: "component",
1459
+ type: i4.MatButton,
1460
+ 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] ",
1461
+ inputs: ["matButton"],
1462
+ exportAs: ["matButton", "matAnchor"]
1463
+ },
1464
+ {
1465
+ kind: "ngmodule",
1466
+ type: MatCheckboxModule
1467
+ },
1468
+ {
1469
+ kind: "component",
1470
+ type: i3.MatCheckbox,
1471
+ selector: "mat-checkbox",
1472
+ inputs: [
1473
+ "aria-label",
1474
+ "aria-labelledby",
1475
+ "aria-describedby",
1476
+ "aria-expanded",
1477
+ "aria-controls",
1478
+ "aria-owns",
1479
+ "id",
1480
+ "required",
1481
+ "labelPosition",
1482
+ "name",
1483
+ "value",
1484
+ "disableRipple",
1485
+ "tabIndex",
1486
+ "color",
1487
+ "disabledInteractive",
1488
+ "checked",
1489
+ "disabled",
1490
+ "indeterminate"
1491
+ ],
1492
+ outputs: ["change", "indeterminateChange"],
1493
+ exportAs: ["matCheckbox"]
1494
+ },
1495
+ {
1496
+ kind: "directive",
1497
+ type: MatDialogActions,
1498
+ selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]",
1499
+ inputs: ["align"]
1500
+ },
1501
+ {
1502
+ kind: "directive",
1503
+ type: MatDialogClose,
1504
+ selector: "[mat-dialog-close], [matDialogClose]",
1505
+ inputs: [
1506
+ "aria-label",
1507
+ "type",
1508
+ "mat-dialog-close",
1509
+ "matDialogClose"
1510
+ ],
1511
+ exportAs: ["matDialogClose"]
1512
+ },
1513
+ {
1514
+ kind: "pipe",
1515
+ type: SafeHtmlPipe,
1516
+ name: "safeHtml"
1517
+ }
1518
+ ],
1519
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
1520
+ });
1521
+ }
1522
+ };
1523
+ i0.ɵɵngDeclareClassMetadata({
1524
+ minVersion: "12.0.0",
1525
+ version: "22.2.1",
1526
+ ngImport: i0,
1527
+ type: SelectPictureDialogComponent,
1528
+ decorators: [{
1529
+ type: Component,
1530
+ args: [{
1531
+ standalone: true,
1532
+ changeDetection: ChangeDetectionStrategy.OnPush,
1533
+ imports: [
1534
+ MatDialogTitle,
1535
+ MatDialogContent,
1536
+ FlexLayoutModule,
1537
+ MatButtonModule,
1538
+ MatCheckboxModule,
1539
+ MatDialogActions,
1540
+ MatDialogClose,
1541
+ SafeHtmlPipe
1542
+ ],
1543
+ template: "<div mat-dialog-title [innerHTML]=\"dialogData().title | safeHtml\"></div>\n@if (dialogData().description) {\n<div class=\"selectpicture-description\" [innerHtml]=\"dialogData().description | safeHtml\"></div>\n}\n<mat-dialog-content class=\"dialog-content\">\n <div fxLayout=\"column\" fxLayoutAlign=\"center center\" fxLayoutGap=\"24px\" fxFill>\n <div fxFlex=\"*\" [class]=\"fileClass()\" (drop)=\"onDrop($event)\" (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\" (dragenter)=\"onDragEnter($event)\" (dragend)=\"onDragEnd($event)\">\n <div fxLayout=\"column\" fxLayoutGap=\"24px\" fxLayoutAlign=\"center center\" fxFill>\n <div fxFlex=\"10px\" fxFlexAlign=\"start\" class=\"x-small secondary\"><i>Trascina qui l'immagine o selezionala</i></div>\n <div>\n <input #_file type=\"file\" [hidden]=\"true\" [accept]=\"dialogData().accept ?? 'image/*'\"\n (change)=\"update($event)\" />\n <button type=\"button\" mat-stroked-button (click)=\"_file.click()\">Seleziona file...</button>\n </div>\n @if (file()) {\n <div style=\"padding:0 24px\">\n <div fxLayout=\"column\" fxLayoutAlign=\"center center\" fxFill>\n <img [src]=\"picturePreview()\" class=\"selectpicture-preview\">\n <div class=\"small accent bold \"><i>{{file().name}}</i></div>\n <div class=\"small\">Dimensioni:<i>{{pictureWidth()}} x {{pictureHeight()}} ({{size(file().size)}})</i></div>\n </div>\n </div>\n }\n </div>\n </div>\n @if (dialogData().options) {\n <div style=\"padding-bottom: 24px;\">\n @for (o of dialogData().options; track o; let i = $index) {\n <div>\n <mat-checkbox (change)=\"o.selected = $event.checked\" [checked]=\"o.selected === true\" name=\"opt_{{i}}\" >\n {{o.description}}\n </mat-checkbox>\n </div>\n }\n </div>\n }\n </div>\n</mat-dialog-content>\n<mat-dialog-actions>\n <div fxLayout=\"row\" fxLayoutAlign=\"end\" fxFill>\n <button mat-flat-button (click)=\"ok()\" [disabled]=\"!file()\">{{dialogData().okCaption}}</button>\n <button mat-stroked-button mat-dialog-close >Annulla</button>\n </div>\n</mat-dialog-actions>\n",
1544
+ 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}}.selectpicture-file{padding:24px;width:320px;border:5px dotted #eee}.selectpicture-preview{max-height:300px;max-width:300px;margin-bottom:15px!important}.selectpicture-file,.selectpicture-file-drop{padding:4px 4px 24px;width:80%;border:5px dotted var(--ars-color-divider, #757d87)!important}.selectpicture-file-drop{border:5px dotted var(--ars-color-accent, #7894ae)!important}.selectpicture-description{padding:0 24px 24px}.dialog-content{padding:0 24px 24px!important}\n"]
1545
+ }]
1546
+ }],
1547
+ propDecorators: { done: [{
1548
+ type: i0.Output,
1549
+ args: ["done"]
1550
+ }] }
1551
+ });
741
1552
  export { FileInputComponent, FilePreviewComponent, SelectFileDialogComponent, SelectPictureDialogComponent };
742
- //# sourceMappingURL=arsedizioni-ars-utils-ui.files.mjs.map
1553
+
1554
+ //# sourceMappingURL=arsedizioni-ars-utils-ui.files.mjs.map