@arsedizioni/ars-utils 22.5.28 → 22.5.32

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.
@@ -1,6 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Validator, AbstractControl, ValidationErrors } from '@angular/forms';
3
- import { PathKind, SchemaPath, SchemaPathRules, LogicFn } from '@angular/forms/signals';
3
+ import { PathKind, LogicFn, SchemaPath, SchemaPathRules } from '@angular/forms/signals';
4
+ import { Validated } from '@arsedizioni/ars-utils/core';
4
5
 
5
6
  /**
6
7
  * Directive that delegates validation to an externally provided validator function.
@@ -266,56 +267,6 @@ declare class NotEmptyValidatorDirective implements Validator {
266
267
  static ɵdir: i0.ɵɵDirectiveDeclaration<NotEmptyValidatorDirective, "[notEmpty]", never, {}, {}, never, never, true, never>;
267
268
  }
268
269
 
269
- /**
270
- * Signal-forms counterparts of the classic validator directives in this entry point.
271
- *
272
- * The `[formField]` directive only honours `NG_VALIDATORS` providers on ControlValueAccessor
273
- * hosts (custom controls); on native inputs the attribute directives (`password`, `emails`,
274
- * `time`, `equals`) are ignored. Schemas built with `form()` must therefore use these
275
- * functions instead. Error kinds and messages match the directive versions one to one.
276
- */
277
- /**
278
- * Binds a validator requiring the value to be a semicolon-separated list of valid
279
- * email addresses. An empty value is considered valid (pair with `required` if needed).
280
- * Signal-forms counterpart of `EmailsValidatorDirective`.
281
- * @param path - Path of the string field to validate.
282
- */
283
- declare function emailsValidator<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>): void;
284
- /**
285
- * Binds a validator requiring the value to meet the minimum password-strength
286
- * requirements (see `SystemUtils.calculatePasswordStrength`). An empty value is
287
- * INVALID, exactly like the classic directive.
288
- * Signal-forms counterpart of `PasswordValidatorDirective`.
289
- * @param path - Path of the string field to validate.
290
- */
291
- declare function passwordValidator<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>): void;
292
- /**
293
- * Binds a validator requiring the value to be a valid `"HH:MM"` time string and,
294
- * when slots are provided, to fall within at least one of the allowed ranges.
295
- * An empty value is considered valid (pair with `required` if needed).
296
- * Signal-forms counterpart of `TimeValidatorDirective`.
297
- * @param path - Path of the string field to validate.
298
- * @param slots - Optional reactive function returning the pipe-separated allowed
299
- * ranges (e.g. `"08:00-12:00|14:00-18:00"`), or `undefined` for none.
300
- */
301
- declare function timeValidator<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, slots?: () => string | undefined): void;
302
- /**
303
- * Binds a validator requiring the value to strictly equal the value of another field
304
- * of the same form. Reactive on both fields, so the host field re-validates when the
305
- * other field changes (this replaces the `valueChanges` subscription of the directive).
306
- * Signal-forms counterpart of `EqualsValidatorDirective`.
307
- * @param path - Path of the field to validate.
308
- * @param other - Path of the field whose value must match.
309
- */
310
- declare function equalsValidator<TValue, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, other: SchemaPath<TValue, SchemaPathRules.Supported>): void;
311
- /**
312
- * Binds a validator requiring the value to be either empty or a complete 6-digit
313
- * OTP code. A partial code (e.g. `"12"`) is invalid; emptiness is left to `required`.
314
- * Schema-level counterpart of the `OtpInputComponent` internal validator.
315
- * @param path - Path of the string field to validate.
316
- */
317
- declare function otpValidator<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>): void;
318
-
319
270
  /**
320
271
  * Options shared by the ARS signal-form validators.
321
272
  *
@@ -336,6 +287,22 @@ interface ArsValidatorConfig<TValue = string, TPathKind extends PathKind = PathK
336
287
  */
337
288
  when?: NoInfer<LogicFn<TValue, boolean, TPathKind>>;
338
289
  }
290
+ /**
291
+ * Default texts of the rules declared here, in one place so that the validators and the fallback
292
+ * map of `SignalsUtils.getFieldErrorMessage` cannot drift apart: a rule added below without a
293
+ * message here would show "Errore", and one renamed here without touching the validator would
294
+ * leave the map with a kind nobody produces.
295
+ */
296
+ /**
297
+ * Earliest date {@link date} and {@link dateRange} accept: 1 January 1970.
298
+ *
299
+ * Everything this application stores — events, certificates, payments, communications — happened
300
+ * after it, so an earlier value is always a typo (a two-digit year, a slipped keystroke) and never
301
+ * real data. The floor is deliberately higher than the one of {@link sqlDate}, which only asks
302
+ * what SQL Server can physically store.
303
+ */
304
+ declare const MIN_VALID_YEAR = 1970;
305
+ declare const ARS_VALIDATOR_MESSAGES: Record<string, string>;
339
306
  /**
340
307
  * Requires the value to be a well-formed GUID / UUID.
341
308
  *
@@ -379,6 +346,205 @@ declare function password<TPathKind extends PathKind = PathKind.Root>(path: Sche
379
346
  * const f = form(this.model, p => { required(p.city); notEmpty(p.city); });
380
347
  */
381
348
  declare function notEmpty<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, config?: ArsValidatorConfig<string, TPathKind>): void;
349
+ /**
350
+ * Requires the value to differ from the value of another field of the same form.
351
+ *
352
+ * The signal-form counterpart of `NotEqualValidatorDirective`, with its exact rule: two empty
353
+ * values are considered different, so an untouched pair of fields does not start out in error.
354
+ * Reactive on both fields — editing either one re-validates this one, which is what the
355
+ * directive needed a `valueChanges` subscription (and a re-entrancy guard) to achieve.
356
+ *
357
+ * @param path - Path of the field to validate.
358
+ * @param other - Path of the field whose value must differ.
359
+ * @param config - Optional message override and `when` condition.
360
+ * @returns void
361
+ */
362
+ declare function notEqual<TValue, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, other: SchemaPath<TValue, SchemaPathRules.Supported>, config?: ArsValidatorConfig<TValue, TPathKind>): void;
363
+ /**
364
+ * Requires the value to be a date the backend can store: parseable, and after 1750.
365
+ *
366
+ * The signal-form counterpart of `SqlDateValidatorDirective`. The year floor is not arbitrary —
367
+ * it is what separates a real date from the 01/01/0001 that a mistyped year produces, which SQL
368
+ * Server rejects with an error nobody can read.
369
+ *
370
+ * @param path - Path of the field to validate.
371
+ * @param config - Optional message override and `when` condition.
372
+ * @returns void
373
+ */
374
+ declare function sqlDate<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, config?: ArsValidatorConfig<string, TPathKind>): void;
375
+ /**
376
+ * Requires the value to be a real date, as {@link SystemUtils.parseDate} understands one.
377
+ *
378
+ * This is the rule for anything a user picks or types as a date: it accepts both the `Date` a
379
+ * Material datepicker or timepicker writes into the model and the text of a plain input, since
380
+ * `parseDate` handles the shapes this codebase produces (ISO, `dd/MM/yyyy`, `yyyy-MM-dd`, and the
381
+ * shorthand forms). Empty passes — saying "obbligatorio" is the job of `required()`.
382
+ *
383
+ * A date earlier than {@link MIN_VALID_YEAR} (1 January 1970) is rejected: nothing this
384
+ * application stores predates it, so an earlier value is a typo rather than data.
385
+ *
386
+ * Distinct from {@link sqlDate} on purpose: that one is about what the DATABASE can store (the
387
+ * 1750 floor), this one is about whether the value is a date at all. Pair them when both matter.
388
+ *
389
+ * @param path - Path of the field to validate.
390
+ * @param config - Optional message override and `when` condition.
391
+ * @returns void
392
+ * @example
393
+ * const f = form(this.model, p => { required(p.expiry); date(p.expiry); });
394
+ */
395
+ declare function date<TValue extends string | Date | null | undefined, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, config?: ArsValidatorConfig<TValue, TPathKind>): void;
396
+ /**
397
+ * Requires the two ends of a date range to be real dates and to be in order.
398
+ *
399
+ * Written for the two inputs of a `mat-date-range-input`, whose start and end live in two
400
+ * separate fields of the model. Each end is checked with the same rule as {@link date}, and the
401
+ * ordering is checked only when BOTH ends are filled in — a half-open range ("from today
402
+ * onwards") is a legitimate filter, not an error. The 1 January 1970 floor of {@link date}
403
+ * applies to both ends.
404
+ *
405
+ * The rule is bound to BOTH paths, so the error appears on whichever end the user is looking at
406
+ * and a single `<mat-error>` under the range can read either one. Comparison is made on the end
407
+ * of the day, so picking the same day for both ends is valid.
408
+ *
409
+ * @param from - Path of the field holding the start of the range.
410
+ * @param to - Path of the field holding the end of the range.
411
+ * @param config - Optional message override (used for the ordering error) and `when` condition.
412
+ * @returns void
413
+ * @example
414
+ * const f = form(this.model, p => { dateRange(p.sentFrom, p.sentTo); });
415
+ */
416
+ declare function dateRange<TValue extends string | Date | null | undefined, TPathKind extends PathKind = PathKind.Root>(from: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, to: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, config?: ArsValidatorConfig<TValue, TPathKind>): void;
417
+ /**
418
+ * Requires the value to be a date that is not in the future.
419
+ *
420
+ * The signal-form counterpart of `NotFutureValidatorDirective`. Today counts as valid: the
421
+ * comparison is made on the end of the day, so a date entered this morning does not become
422
+ * invalid because the clock says 09:00.
423
+ *
424
+ * @param path - Path of the field to validate.
425
+ * @param config - Optional message override and `when` condition.
426
+ * @returns void
427
+ */
428
+ declare function notFuture<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, config?: ArsValidatorConfig<string, TPathKind>): void;
429
+ /**
430
+ * Requires the value to be a well-formed URL. An empty value passes, as everywhere else here.
431
+ *
432
+ * The signal-form counterpart of `UrlValidatorDirective`.
433
+ *
434
+ * @param path - Path of the field to validate.
435
+ * @param config - Optional message override and `when` condition.
436
+ * @returns void
437
+ */
438
+ declare function url<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, config?: ArsValidatorConfig<string, TPathKind>): void;
439
+ /**
440
+ * Requires the value to hold no more than `max` whitespace-separated terms.
441
+ *
442
+ * The signal-form counterpart of `MaxTermsValidatorDirective`, used on the search boxes where
443
+ * the backend refuses a query past a certain number of words.
444
+ *
445
+ * @param path - Path of the field to validate.
446
+ * @param max - The maximum number of terms, as a number or a reactive function.
447
+ * @param config - Optional message override and `when` condition.
448
+ * @returns void
449
+ */
450
+ declare function maxTerms<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, max: number | (() => number), config?: ArsValidatorConfig<string, TPathKind>): void;
451
+ /**
452
+ * Requires the size of the picked file to fall within the allowed range.
453
+ *
454
+ * The signal-form counterpart of `FileSizeValidatorDirective`, and it keeps its shape: the field
455
+ * itself holds the file NAME, while the size arrives from outside — the control that picked the
456
+ * file knows it, the form does not. An empty field passes, so "no file" is `required()`'s call
457
+ * and not a size error.
458
+ *
459
+ * @param path - Path of the field holding the file name.
460
+ * @param sizeMb - The size of the picked file in megabytes, as a reactive function.
461
+ * @param maxSizeMb - The maximum allowed size in megabytes. Defaults to `5`.
462
+ * @param minSizeMb - The minimum required size in megabytes. Defaults to `0`.
463
+ * @param config - Optional message override and `when` condition.
464
+ * @returns void
465
+ */
466
+ declare function fileSize<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, sizeMb: () => number | undefined, maxSizeMb?: number | (() => number), minSizeMb?: number | (() => number), config?: ArsValidatorConfig<string, TPathKind>): void;
467
+ /**
468
+ * Requires the value to declare itself valid.
469
+ *
470
+ * The signal-form counterpart of `ValidIfDirective`: when the field holds an object implementing
471
+ * `Validated` the verdict is its own `isValid()`, and when the field is empty the verdict is the
472
+ * `flag`. It is the escape hatch for the composite controls whose validity only they can judge.
473
+ *
474
+ * @param path - Path of the field to validate.
475
+ * @param flag - Verdict used while the field is empty, as a boolean or a reactive function.
476
+ * Defaults to `false`.
477
+ * @param config - Optional message override and `when` condition.
478
+ * @returns void
479
+ */
480
+ declare function validIf<TValue extends Partial<Validated>, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, flag?: boolean | (() => boolean), config?: ArsValidatorConfig<TValue, TPathKind>): void;
481
+ /**
482
+ * Requires the value to be a semicolon-separated list of valid e-mail addresses.
483
+ *
484
+ * The signal-form counterpart of `EmailsValidatorDirective`. An empty value passes, and so does
485
+ * an empty entry between two semicolons: the list is typed by hand and a trailing `;` is not a
486
+ * mistake worth an error.
487
+ *
488
+ * @param path - Path of the field to validate.
489
+ * @param config - Optional message override and `when` condition.
490
+ * @returns void
491
+ */
492
+ declare function emails<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, config?: ArsValidatorConfig<string, TPathKind>): void;
493
+ /**
494
+ * Requires the value to be a `"HH:MM"` time and, when slots are given, to fall inside one of them.
495
+ *
496
+ * The signal-form counterpart of `TimeValidatorDirective`. An empty value passes.
497
+ *
498
+ * @param path - Path of the field to validate.
499
+ * @param slots - Optional reactive function returning the pipe-separated allowed ranges
500
+ * (e.g. `"08:00-12:00|14:00-18:00"`), or `undefined` for no restriction.
501
+ * @param config - Optional message override and `when` condition.
502
+ * @returns void
503
+ */
504
+ declare function time<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, slots?: () => string | undefined, config?: ArsValidatorConfig<string, TPathKind>): void;
505
+ /**
506
+ * Requires the value to equal the value of another field of the same form.
507
+ *
508
+ * The signal-form counterpart of `EqualsValidatorDirective`. Reactive on both fields, which is
509
+ * what the directive needed a `valueChanges` subscription to obtain: retyping the first password
510
+ * re-validates the confirmation without anyone wiring the two together.
511
+ *
512
+ * @param path - Path of the field to validate.
513
+ * @param other - Path of the field whose value must match.
514
+ * @param config - Optional message override and `when` condition.
515
+ * @returns void
516
+ */
517
+ declare function equals<TValue, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, other: SchemaPath<TValue, SchemaPathRules.Supported>, config?: ArsValidatorConfig<TValue, TPathKind>): void;
518
+ /**
519
+ * Requires the value to be either empty or a complete six-digit one-time code.
520
+ *
521
+ * The schema-level counterpart of the validator inside `OtpInputComponent`: a partial code is an
522
+ * error, an empty one is `required()`'s business.
523
+ *
524
+ * @param path - Path of the field to validate.
525
+ * @param config - Optional message override and `when` condition.
526
+ * @returns void
527
+ */
528
+ declare function otp<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, config?: ArsValidatorConfig<string, TPathKind>): void;
529
+ /** Helpers around signal forms that are not validators themselves. */
530
+ declare class SignalsUtils {
531
+ /**
532
+ * Builds the error text for a signal-forms field.
533
+ *
534
+ * Deliberately dumb: the wording lives in the schema, next to the rule that produces it
535
+ * (`required(p.x, { message: ... })`), so a field says what is wrong with it in one place
536
+ * instead of here in a switch that has to guess from the error kind. The map below is only
537
+ * the safety net for the rules declared without a message — the Angular built-ins, plus
538
+ * {@link ARS_VALIDATOR_MESSAGES} for the ones declared in this file.
539
+ * @param errors - The errors currently on the field, from `f.x().errors()`.
540
+ * @param message - Optional override applied to every error of the field.
541
+ * @returns The first relevant error text, or `undefined` when the field has no errors.
542
+ */
543
+ static getFieldErrorMessage(errors: readonly {
544
+ kind: string;
545
+ message?: string;
546
+ }[], message?: string): string | undefined;
547
+ }
382
548
 
383
- export { EmailsValidatorDirective, EqualsValidatorDirective, FileSizeValidatorDirective, GuidValidatorDirective, MaxTermsValidatorDirective, NotEmptyValidatorDirective, NotEqualValidatorDirective, NotFutureValidatorDirective, PasswordValidatorDirective, SqlDateValidatorDirective, TimeValidatorDirective, UrlValidatorDirective, ValidIfDirective, ValidatorDirective, emailsValidator, equalsValidator, guid, notEmpty, otpValidator, password, passwordValidator, timeValidator };
549
+ export { ARS_VALIDATOR_MESSAGES, EmailsValidatorDirective, EqualsValidatorDirective, FileSizeValidatorDirective, GuidValidatorDirective, MIN_VALID_YEAR, MaxTermsValidatorDirective, NotEmptyValidatorDirective, NotEqualValidatorDirective, NotFutureValidatorDirective, PasswordValidatorDirective, SignalsUtils, SqlDateValidatorDirective, TimeValidatorDirective, UrlValidatorDirective, ValidIfDirective, ValidatorDirective, date, dateRange, emails, equals, fileSize, guid, maxTerms, notEmpty, notEqual, notFuture, otp, password, sqlDate, time, url, validIf };
384
550
  export type { ArsValidatorConfig };
@@ -5,6 +5,7 @@ import { PasswordStrength } from '@arsedizioni/ars-utils/core';
5
5
  import * as _angular_forms_signals from '@angular/forms/signals';
6
6
  import { CredentialsDialogResult, ResetPasswordDialogResult, RecoverPasswordDialogResult, PromptOtpDialogResult, PromptDialogData } from '@arsedizioni/ars-utils/ui';
7
7
  import { MatFormFieldAppearance } from '@angular/material/form-field';
8
+ import { SignalsUtils } from '@arsedizioni/ars-utils/core.validators';
8
9
 
9
10
  declare class OtpInputComponent implements ControlValueAccessor, Validator {
10
11
  /** Signal-based query for all individual OTP digit input elements. */
@@ -124,6 +125,8 @@ interface CredentialsDialogData {
124
125
  appearance?: MatFormFieldAppearance;
125
126
  }
126
127
  declare class CredentialsDialogComponent {
128
+ /** Error text of a field: the message declared in the schema, or the shared fallback. */
129
+ protected readonly getErrorMessage: typeof SignalsUtils.getFieldErrorMessage;
127
130
  /** Emitted when the user submits the form. Carries the entered credentials. */
128
131
  readonly done: _angular_core.OutputEmitterRef<CredentialsDialogResult>;
129
132
  /** Emitted when the user requests a password-recovery flow. */
@@ -169,6 +172,8 @@ interface ResetPasswordDialogData {
169
172
  appearance?: MatFormFieldAppearance;
170
173
  }
171
174
  declare class ResetPasswordDialogComponent {
175
+ /** Error text of a field: the message declared in the schema, or the shared fallback. */
176
+ protected readonly getErrorMessage: typeof SignalsUtils.getFieldErrorMessage;
172
177
  /** Emitted when the user submits the new password. Carries the entered password data. */
173
178
  readonly done: _angular_core.OutputEmitterRef<ResetPasswordDialogResult>;
174
179
  private readonly dialogService;
@@ -208,6 +213,8 @@ interface RecoverPasswordDialogData {
208
213
  appearance?: MatFormFieldAppearance;
209
214
  }
210
215
  declare class RecoverPasswordDialogComponent {
216
+ /** Error text of a field: the message declared in the schema, or the shared fallback. */
217
+ protected readonly getErrorMessage: typeof SignalsUtils.getFieldErrorMessage;
211
218
  /** Emitted when the user submits the recovery request. Carries the entered email and recaptcha state. */
212
219
  readonly done: _angular_core.OutputEmitterRef<RecoverPasswordDialogResult>;
213
220
  /** Dialog configuration with defaults applied at construction time. */
@@ -2,9 +2,14 @@ import * as i0 from '@angular/core';
2
2
  import { ComponentType } from '@angular/cdk/portal';
3
3
  import { MatDialogConfig, MatDialogRef } from '@angular/material/dialog';
4
4
  import { MatSnackBarRef } from '@angular/material/snack-bar';
5
+ import { DialogResult, DialogOption, SelectDialogData, PromptDialogType } from '@arsedizioni/ars-utils/ui';
6
+ import { SendToDialogComponent, SelectTreeDialogComponent, SelectDialogComponent } from '@arsedizioni/ars-utils/ui.dialogs.select';
7
+ import { SelectPictureDialogComponent, SelectFileDialogComponent } from '@arsedizioni/ars-utils/ui.files';
8
+ import { PromptDialogComponent, PromptDateDialogComponent, PromptTimeDialogComponent } from '@arsedizioni/ars-utils/ui.dialogs.prompt';
9
+ import { PromptOtpDialogComponent } from '@arsedizioni/ars-utils/ui.dialogs.auth';
5
10
  import { ShellService } from '@arsedizioni/ars-utils/ui.shell';
6
- import { DialogResult, DialogOption } from '@arsedizioni/ars-utils/ui';
7
11
  import * as _angular_forms_signals from '@angular/forms/signals';
12
+ import { SignalsUtils } from '@arsedizioni/ars-utils/core.validators';
8
13
  import { MatFormFieldAppearance } from '@angular/material/form-field';
9
14
 
10
15
  interface ConfirmDialogOption extends DialogOption {
@@ -56,6 +61,8 @@ interface DeleteDialogData {
56
61
  appearance?: MatFormFieldAppearance;
57
62
  }
58
63
  declare class DeleteDialogComponent {
64
+ /** Error text of a field: the message declared in the schema, or the shared fallback. */
65
+ protected readonly getErrorMessage: typeof SignalsUtils.getFieldErrorMessage;
59
66
  /** Emitted when the user makes a choice. Carries the selected result. */
60
67
  readonly choosen: i0.OutputEmitterRef<DialogResult>;
61
68
  private readonly dialogRef;
@@ -228,6 +235,117 @@ declare class DialogService extends ShellService {
228
235
  * @returns The dialog reference, or `null` outside the browser.
229
236
  */
230
237
  delete(message: string, title?: string, confirmMode?: DeleteDialogConfirmMode, okCaption?: string, cancelCaption?: string, width?: number, details?: string): MatDialogRef<DeleteDialogComponent> | null;
238
+ /**
239
+ * Open a send-to-email dialog.
240
+ * @param title - Dialog title.
241
+ * @param text - Pre-filled message body.
242
+ * @param subject - Pre-filled subject line.
243
+ * @param canPopulate - Whether the populate-recipients action is available.
244
+ * @param count - Number of documents being sent.
245
+ * @param options - Checkable option list.
246
+ * @param width - Maximum dialog width in pixels.
247
+ * @returns The opened dialog reference.
248
+ */
249
+ sendTo(title?: string, text?: string, subject?: string, canPopulate?: boolean, count?: number, options?: any, width?: number): Promise<MatDialogRef<SendToDialogComponent, any> | null>;
250
+ /**
251
+ * Open a tree-node selection dialog.
252
+ * @param nodes - The tree nodes to display.
253
+ * @param title - Dialog title.
254
+ * @param description - Optional description shown below the title.
255
+ * @param initialFilter - Pre-applied filter text.
256
+ * @param width - Maximum dialog width in pixels.
257
+ * @param okCaption - Label for the confirm button.
258
+ * @param canAppend - Whether the append-node action is available.
259
+ * @returns The opened dialog reference.
260
+ */
261
+ selectTree(nodes: any, title?: string, description?: string, initialFilter?: string, width?: number, okCaption?: string, canAppend?: boolean): Promise<MatDialogRef<SelectTreeDialogComponent, any> | null>;
262
+ /**
263
+ * Open a picture-selection dialog.
264
+ * @param title - Dialog title.
265
+ * @param description - Brief description shown in the dialog.
266
+ * @param okCaption - Label for the confirm button.
267
+ * @param options - Checkable option list.
268
+ * @param width - Maximum dialog width in pixels.
269
+ * @param maxSize - Maximum accepted file size in MB.
270
+ * @param maxPictureWidth - Maximum accepted picture width in pixels.
271
+ * @param maxPictureHeight - Maximum accepted picture height in pixels.
272
+ * @returns The opened dialog reference.
273
+ */
274
+ selectPicture(title?: string, description?: string, okCaption?: string, options?: any, width?: number, maxSize?: number, maxPictureWidth?: number, maxPictureHeight?: number): Promise<MatDialogRef<SelectPictureDialogComponent, any> | null>;
275
+ /**
276
+ * Open a file-selection dialog.
277
+ * @param title - Dialog title.
278
+ * @param description - Brief description shown in the dialog.
279
+ * @param okCaption - Label for the confirm button.
280
+ * @param helpLink - URL for the help link.
281
+ * @param helpCaption - Display text for the help link.
282
+ * @param options - Checkable option list.
283
+ * @param width - Maximum dialog width in pixels.
284
+ * @param maxSize - Maximum accepted file size in MB.
285
+ * @param accept - Accepted file extensions (e.g. `.pdf,.docx`).
286
+ * @returns The opened dialog reference.
287
+ */
288
+ selectFile(title?: string, description?: string, okCaption?: string, helpLink?: string, helpCaption?: string, options?: any, width?: number, maxSize?: number, accept?: string): Promise<MatDialogRef<SelectFileDialogComponent, any> | null>;
289
+ /**
290
+ * Open a multipurpose selection and CRUD dialog.
291
+ * @param data - The dialog configuration model.
292
+ * @param disableClose - Whether the dialog can be closed by clicking outside.
293
+ * @param closeOnNavigation - Whether the dialog closes on route navigation.
294
+ * @returns The opened dialog reference.
295
+ */
296
+ select(data: SelectDialogData, disableClose?: boolean, closeOnNavigation?: boolean): Promise<MatDialogRef<SelectDialogComponent, any> | null>;
297
+ /**
298
+ * Prompt the user to enter a value.
299
+ * @param title - Dialog title.
300
+ * @param type - The input type (default, text, number, etc.).
301
+ * @param description - Placeholder or description text.
302
+ * @param initialValue - Pre-filled value.
303
+ * @param okCaption - Label for the confirm button.
304
+ * @param cancelCaption - Label for the cancel button.
305
+ * @param options - Checkable option list.
306
+ * @param width - Maximum dialog width in pixels.
307
+ * @param required - Whether the input is required.
308
+ * @returns The opened dialog reference.
309
+ */
310
+ prompt(title: string, type?: PromptDialogType, description?: string, initialValue?: any, okCaption?: string, cancelCaption?: string, options?: any, width?: number, required?: boolean): Promise<MatDialogRef<PromptDialogComponent> | null>;
311
+ /**
312
+ * Prompt the user to enter a date or date interval.
313
+ * @param title - Dialog title.
314
+ * @param type - Date or DateInterval.
315
+ * @param description - Placeholder or description text.
316
+ * @param initialValue - Pre-filled value.
317
+ * @param okCaption - Label for the confirm button.
318
+ * @param cancelCaption - Label for the cancel button.
319
+ * @param options - Checkable option list.
320
+ * @param width - Maximum dialog width in pixels.
321
+ * @param required - Whether the input is required.
322
+ * @returns The opened dialog reference.
323
+ */
324
+ promptDate(title: string, type?: PromptDialogType.Date | PromptDialogType.DateInterval, description?: string, initialValue?: any, okCaption?: string, cancelCaption?: string, options?: any, width?: number, required?: boolean): Promise<MatDialogRef<PromptDateDialogComponent> | null>;
325
+ /**
326
+ * Prompt the user to enter a time value.
327
+ * @param title - Dialog title.
328
+ * @param description - Placeholder or description text.
329
+ * @param slots - Optional time slots string.
330
+ * @param initialValue - Pre-filled value.
331
+ * @param okCaption - Label for the confirm button.
332
+ * @param cancelCaption - Label for the cancel button.
333
+ * @param options - Checkable option list.
334
+ * @param width - Maximum dialog width in pixels.
335
+ * @param required - Whether the input is required.
336
+ * @returns The opened dialog reference.
337
+ */
338
+ promptTime(title: string, description?: string, slots?: string, initialValue?: any, okCaption?: string, cancelCaption?: string, options?: any, width?: number, required?: boolean): Promise<MatDialogRef<PromptTimeDialogComponent> | null>;
339
+ /**
340
+ * Prompt the user to enter an OTP code.
341
+ * @param title - Dialog title.
342
+ * @param description - Description text shown in the dialog.
343
+ * @param okCaption - Label for the confirm button.
344
+ * @param cancelCaption - Label for the cancel button.
345
+ * @param width - Maximum dialog width in pixels.
346
+ * @returns The opened dialog reference.
347
+ */
348
+ promptOtp(title?: string, description?: string, okCaption?: string, cancelCaption?: string, width?: number): Promise<MatDialogRef<PromptOtpDialogComponent> | null>;
231
349
  static ɵfac: i0.ɵɵFactoryDeclaration<DialogService, never>;
232
350
  static ɵprov: i0.ɵɵInjectableDeclaration<DialogService>;
233
351
  }
@@ -1,8 +1,11 @@
1
1
  import * as _angular_forms_signals from '@angular/forms/signals';
2
2
  import * as _angular_core from '@angular/core';
3
3
  import { PromptDialogResult, PromptDialogData, PromptDateDialogResult, PromptTimeDialogData } from '@arsedizioni/ars-utils/ui';
4
+ import { SignalsUtils } from '@arsedizioni/ars-utils/core.validators';
4
5
 
5
6
  declare class PromptDialogComponent {
7
+ /** Error text of a field: the message declared in the schema, or the shared fallback. */
8
+ protected readonly getErrorMessage: typeof SignalsUtils.getFieldErrorMessage;
6
9
  readonly done: _angular_core.OutputEmitterRef<PromptDialogResult>;
7
10
  private readonly dialogService;
8
11
  protected readonly dialogData: _angular_core.WritableSignal<PromptDialogData>;
@@ -24,6 +27,21 @@ declare class PromptDialogComponent {
24
27
  }
25
28
 
26
29
  declare class PromptDateDialogComponent {
30
+ /** Error text of a field: the message declared in the schema, or the shared fallback. */
31
+ protected readonly getErrorMessage: typeof SignalsUtils.getFieldErrorMessage;
32
+ /**
33
+ * Error text for a date range: whichever end is in error speaks for the pair.
34
+ * @param from - Errors of the start field, from `f.from().errors()`.
35
+ * @param to - Errors of the end field, from `f.to().errors()`.
36
+ * @returns The text to show under the range, or `undefined` when neither end is in error.
37
+ */
38
+ protected rangeErrorMessage(from: readonly {
39
+ kind: string;
40
+ message?: string;
41
+ }[], to: readonly {
42
+ kind: string;
43
+ message?: string;
44
+ }[]): string | undefined;
27
45
  readonly done: _angular_core.OutputEmitterRef<PromptDateDialogResult>;
28
46
  private readonly dialogService;
29
47
  protected readonly dialogData: _angular_core.WritableSignal<PromptDialogData>;
@@ -73,6 +91,8 @@ declare class PromptDateDialogComponent {
73
91
  }
74
92
 
75
93
  declare class PromptTimeDialogComponent {
94
+ /** Error text of a field: the message declared in the schema, or the shared fallback. */
95
+ protected readonly getErrorMessage: typeof SignalsUtils.getFieldErrorMessage;
76
96
  readonly done: _angular_core.OutputEmitterRef<PromptDialogResult>;
77
97
  private readonly dialogService;
78
98
  protected readonly dialogData: _angular_core.WritableSignal<PromptTimeDialogData>;
@@ -9,6 +9,7 @@ import { SelectDialogData, SelectDialogResult, SelectDialogEdit, SelectableItem,
9
9
  import * as rxjs from 'rxjs';
10
10
  import { MatTree } from '@angular/material/tree';
11
11
  import { MatFormFieldAppearance } from '@angular/material/form-field';
12
+ import { SignalsUtils } from '@arsedizioni/ars-utils/core.validators';
12
13
 
13
14
  declare class SelectDialogComponent {
14
15
  readonly paginator: _angular_core.Signal<MatPaginator>;
@@ -283,6 +284,8 @@ interface SendToDialogData {
283
284
  options?: any;
284
285
  }
285
286
  declare class SendToDialogComponent implements ISendToDialog {
287
+ /** Error text of a field: the message declared in the schema, or the shared fallback. */
288
+ protected readonly getErrorMessage: typeof SignalsUtils.getFieldErrorMessage;
286
289
  /** Emitted when the user confirms and sends the message. */
287
290
  readonly done: _angular_core.OutputEmitterRef<SendToDialogResult>;
288
291
  /** Emitted when the user requests to populate the recipient list. */
@@ -2,6 +2,7 @@ import * as _angular_forms_signals from '@angular/forms/signals';
2
2
  import * as _angular_core from '@angular/core';
3
3
  import { OnDestroy, DoCheck, ElementRef } from '@angular/core';
4
4
  import { ControlValueAccessor, NgControl } from '@angular/forms';
5
+ import { SignalsUtils } from '@arsedizioni/ars-utils/core.validators';
5
6
  import { MatFormFieldControl } from '@angular/material/form-field';
6
7
  import { FileInfo } from '@arsedizioni/ars-utils/core';
7
8
  import { Subject } from 'rxjs';
@@ -9,6 +10,8 @@ import { SelectFile, SelectFileDialogData, SelectPictureFileDialogData } from '@
9
10
 
10
11
  declare class FileInputComponent implements OnDestroy, DoCheck, MatFormFieldControl<FileInfo>, ControlValueAccessor {
11
12
  ngControl: NgControl;
13
+ /** Error text of a field: the message declared in the schema, or the shared fallback. */
14
+ protected readonly getErrorMessage: typeof SignalsUtils.getFieldErrorMessage;
12
15
  /** Reference to the hidden native file input element. */
13
16
  protected readonly __file: _angular_core.Signal<ElementRef<any>>;
14
17
  private readonly renderer;
@@ -0,0 +1,4 @@
1
+ {
2
+ "module": "../fesm2022/arsedizioni-ars-utils-ui.application.mjs",
3
+ "typings": "../types/arsedizioni-ars-utils-ui.application.d.ts"
4
+ }