@arsedizioni/ars-utils 22.5.6 → 22.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/fesm2022/arsedizioni-ars-utils-core.mjs +3 -700
- package/fesm2022/arsedizioni-ars-utils-core.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-core.validators.mjs +717 -0
- package/fesm2022/arsedizioni-ars-utils-core.validators.mjs.map +1 -0
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.auth.mjs +2 -1
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.auth.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.prompt.mjs +2 -1
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.prompt.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.select.mjs +2 -1
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.select.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.files.mjs +2 -1
- package/fesm2022/arsedizioni-ars-utils-ui.files.mjs.map +1 -1
- package/package.json +5 -1
- package/types/arsedizioni-ars-utils-clipper.ui.d.ts +1 -1
- package/types/arsedizioni-ars-utils-core.d.ts +1 -266
- package/types/arsedizioni-ars-utils-core.validators.d.ts +268 -0
|
@@ -2,7 +2,6 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { EventEmitter, PipeTransform, OnDestroy, Signal } from '@angular/core';
|
|
3
3
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
4
4
|
import { Locale } from 'date-fns';
|
|
5
|
-
import { Validator, AbstractControl, ValidationErrors } from '@angular/forms';
|
|
6
5
|
import { SafeHtml, SafeResourceUrl } from '@angular/platform-browser';
|
|
7
6
|
import { Observable } from 'rxjs';
|
|
8
7
|
|
|
@@ -759,183 +758,6 @@ declare class CopyClipboardDirective {
|
|
|
759
758
|
static ɵdir: i0.ɵɵDirectiveDeclaration<CopyClipboardDirective, "[copyClipboard]", never, { "payload": { "alias": "copyClipboard"; "required": false; "isSignal": true; }; }, { "copied": "copied"; }, never, never, true, never>;
|
|
760
759
|
}
|
|
761
760
|
|
|
762
|
-
/**
|
|
763
|
-
* Directive that validates a semicolon-separated list of email addresses.
|
|
764
|
-
* Apply `emails` to a text input containing one or more addresses separated by `;`.
|
|
765
|
-
*/
|
|
766
|
-
declare class EmailsValidatorDirective implements Validator {
|
|
767
|
-
/**
|
|
768
|
-
* Validates each address in a semicolon-separated email list.
|
|
769
|
-
* Returns `null` when the control is empty.
|
|
770
|
-
* @param control - The form control to validate.
|
|
771
|
-
*/
|
|
772
|
-
validate(control: AbstractControl): ValidationErrors | null;
|
|
773
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<EmailsValidatorDirective, never>;
|
|
774
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<EmailsValidatorDirective, "[emails]", never, {}, {}, never, never, true, never>;
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
/**
|
|
778
|
-
* Directive that validates that the host control's value equals the value of another control.
|
|
779
|
-
* Bind `[equals]="otherControl"`.
|
|
780
|
-
*
|
|
781
|
-
* The host control is re-validated whenever the OTHER control's value changes:
|
|
782
|
-
* without this, typing a new password AFTER the confirmation field was filled
|
|
783
|
-
* left the form incorrectly valid (the classic password/confirm bug).
|
|
784
|
-
*
|
|
785
|
-
* IMPORTANT (reciprocal-binding safety): the re-validation triggered from the
|
|
786
|
-
* other control's `valueChanges` runs with `{ emitEvent: false }`. Calling
|
|
787
|
-
* Angular's `onValidatorChange` instead would re-emit valueChanges, so a
|
|
788
|
-
* reciprocal setup (A [equals]=B and B [equals]=A) would overflow the stack.
|
|
789
|
-
*/
|
|
790
|
-
declare class EqualsValidatorDirective implements Validator {
|
|
791
|
-
/** The control whose value must match the host control's value. */
|
|
792
|
-
readonly equals: i0.InputSignal<AbstractControl<any, any, any>>;
|
|
793
|
-
/** The host control, captured on the first validate() call. */
|
|
794
|
-
private hostControl?;
|
|
795
|
-
/** Subscription to the other control's valueChanges. */
|
|
796
|
-
private subscription?;
|
|
797
|
-
constructor();
|
|
798
|
-
/**
|
|
799
|
-
* Validates that the host control value equals the bound control's value.
|
|
800
|
-
* Returns `null` (valid) when no control is bound.
|
|
801
|
-
* @param control - The form control to validate.
|
|
802
|
-
* @returns `null` when valid, `{ equals: ... }` otherwise.
|
|
803
|
-
*/
|
|
804
|
-
validate(control: AbstractControl): ValidationErrors | null;
|
|
805
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<EqualsValidatorDirective, never>;
|
|
806
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<EqualsValidatorDirective, "[equals]", never, { "equals": { "alias": "equals"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
/**
|
|
810
|
-
* Directive that validates a file size against configurable minimum and maximum bounds.
|
|
811
|
-
* Bind `[fileSize]` together with `[size]="fileSizeInMb"`, `[maxSizeMb]`, and `[minSizeMb]`.
|
|
812
|
-
*/
|
|
813
|
-
declare class FileSizeValidatorDirective implements Validator {
|
|
814
|
-
/** Maximum allowed file size in megabytes. Defaults to 5. */
|
|
815
|
-
readonly maxSizeMb: i0.InputSignal<number>;
|
|
816
|
-
/** Minimum required file size in megabytes. Defaults to 0. */
|
|
817
|
-
readonly minSizeMb: i0.InputSignal<number>;
|
|
818
|
-
/** The actual file size in megabytes to validate against the bounds. */
|
|
819
|
-
readonly size: i0.InputSignal<number>;
|
|
820
|
-
/**
|
|
821
|
-
* Validates that the bound file size falls within the configured min/max range.
|
|
822
|
-
* Returns `null` when no control value is present.
|
|
823
|
-
* @param control - The form control to validate.
|
|
824
|
-
*/
|
|
825
|
-
validate(control: AbstractControl): ValidationErrors | null;
|
|
826
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<FileSizeValidatorDirective, never>;
|
|
827
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<FileSizeValidatorDirective, "[fileSize]", never, { "maxSizeMb": { "alias": "maxSizeMb"; "required": false; "isSignal": true; }; "minSizeMb": { "alias": "minSizeMb"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
/**
|
|
831
|
-
* Directive that validates a control value as a GUID / UUID string.
|
|
832
|
-
* Apply `guid` to a text input that expects a valid UUID.
|
|
833
|
-
*/
|
|
834
|
-
declare class GuidValidatorDirective implements Validator {
|
|
835
|
-
/**
|
|
836
|
-
* Validates that the control value is a well-formed GUID / UUID.
|
|
837
|
-
* Returns `null` when the control is empty.
|
|
838
|
-
* @param control - The form control to validate.
|
|
839
|
-
*/
|
|
840
|
-
validate(control: AbstractControl): ValidationErrors | null;
|
|
841
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<GuidValidatorDirective, never>;
|
|
842
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<GuidValidatorDirective, "[guid]", never, {}, {}, never, never, true, never>;
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
/**
|
|
846
|
-
* Directive that validates that a control value does not exceed a maximum word count.
|
|
847
|
-
* Bind `[maxTerms]="10"` to allow at most 10 whitespace-separated terms.
|
|
848
|
-
*/
|
|
849
|
-
declare class MaxTermsValidatorDirective implements Validator {
|
|
850
|
-
/** The maximum number of whitespace-separated terms allowed. */
|
|
851
|
-
readonly maxTerms: i0.InputSignal<number>;
|
|
852
|
-
/**
|
|
853
|
-
* Validates that the control value contains no more than the configured number of terms.
|
|
854
|
-
* Returns `null` when the control is empty.
|
|
855
|
-
* @param control - The form control to validate.
|
|
856
|
-
*/
|
|
857
|
-
validate(control: AbstractControl): ValidationErrors | null;
|
|
858
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<MaxTermsValidatorDirective, never>;
|
|
859
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<MaxTermsValidatorDirective, "[maxTerms]", never, { "maxTerms": { "alias": "maxTerms"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
/**
|
|
863
|
-
* Directive that validates that a string control value is not blank (whitespace-only).
|
|
864
|
-
* Apply `notEmpty` to a text input where non-blank content is required.
|
|
865
|
-
*/
|
|
866
|
-
declare class NotEmptyValidatorDirective implements Validator {
|
|
867
|
-
/**
|
|
868
|
-
* Validates that the control value is a non-blank string.
|
|
869
|
-
* Returns `null` when the control is empty or not a string.
|
|
870
|
-
* @param control - The form control to validate.
|
|
871
|
-
*/
|
|
872
|
-
validate(control: AbstractControl): ValidationErrors | null;
|
|
873
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NotEmptyValidatorDirective, never>;
|
|
874
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<NotEmptyValidatorDirective, "[notEmpty]", never, {}, {}, never, never, true, never>;
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
/**
|
|
878
|
-
* Directive that validates that the host control's value is different from another control's value.
|
|
879
|
-
* Bind `[notEqual]="otherControl"`.
|
|
880
|
-
*
|
|
881
|
-
* The host control is re-validated whenever the OTHER control's value changes,
|
|
882
|
-
* so editing either field keeps both error states consistent.
|
|
883
|
-
*
|
|
884
|
-
* IMPORTANT (reciprocal-binding safety): the re-validation triggered from the
|
|
885
|
-
* other control's `valueChanges` is run with `{ emitEvent: false }`. Using
|
|
886
|
-
* Angular's `onValidatorChange` here instead would call `host.updateValueAndValidity()`
|
|
887
|
-
* WITH events, so a reciprocal setup (A [notEqual]=B and B [notEqual]=A) would
|
|
888
|
-
* ping-pong valueChanges between the two controls and overflow the stack.
|
|
889
|
-
*/
|
|
890
|
-
declare class NotEqualValidatorDirective implements Validator {
|
|
891
|
-
/** The control whose value must differ from the host control's value. */
|
|
892
|
-
readonly notEqual: i0.InputSignal<AbstractControl<any, any, any>>;
|
|
893
|
-
/** The host control, captured on the first validate() call. */
|
|
894
|
-
private hostControl?;
|
|
895
|
-
/** Subscription to the other control's valueChanges. */
|
|
896
|
-
private subscription?;
|
|
897
|
-
constructor();
|
|
898
|
-
/**
|
|
899
|
-
* Validates that the host control value is not equal to the bound control's value.
|
|
900
|
-
* Also clears the `notequal` error on the other control when the host becomes valid.
|
|
901
|
-
* Returns `null` (valid) when no control is bound.
|
|
902
|
-
* @param control - The form control to validate.
|
|
903
|
-
* @returns `null` when valid, `{ notequal: true }` otherwise.
|
|
904
|
-
*/
|
|
905
|
-
validate(control: AbstractControl): ValidationErrors | null;
|
|
906
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NotEqualValidatorDirective, never>;
|
|
907
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<NotEqualValidatorDirective, "[notEqual]", never, { "notEqual": { "alias": "notEqual"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
/**
|
|
911
|
-
* Directive that validates that a control value is not a future date.
|
|
912
|
-
* Apply `notFuture` to a text input that expects a date on or before today.
|
|
913
|
-
*/
|
|
914
|
-
declare class NotFutureValidatorDirective implements Validator {
|
|
915
|
-
/**
|
|
916
|
-
* Validates that the control value represents a date that is not in the future.
|
|
917
|
-
* Returns `null` when the control is empty.
|
|
918
|
-
* @param control - The form control to validate.
|
|
919
|
-
*/
|
|
920
|
-
validate(control: AbstractControl): ValidationErrors | null;
|
|
921
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NotFutureValidatorDirective, never>;
|
|
922
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<NotFutureValidatorDirective, "[notFuture]", never, {}, {}, never, never, true, never>;
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
/**
|
|
926
|
-
* Directive that validates a control value as a sufficiently strong password.
|
|
927
|
-
* Apply `password` to a password input.
|
|
928
|
-
*/
|
|
929
|
-
declare class PasswordValidatorDirective implements Validator {
|
|
930
|
-
/**
|
|
931
|
-
* Validates that the control value meets the minimum password-strength requirements.
|
|
932
|
-
* @param control - The form control to validate.
|
|
933
|
-
*/
|
|
934
|
-
validate(control: AbstractControl): ValidationErrors | null;
|
|
935
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<PasswordValidatorDirective, never>;
|
|
936
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<PasswordValidatorDirective, "[password]", never, {}, {}, never, never, true, never>;
|
|
937
|
-
}
|
|
938
|
-
|
|
939
761
|
/**
|
|
940
762
|
* Directive that removes focus from the host element after it is clicked,
|
|
941
763
|
* preventing the browser from keeping a visible focus ring post-interaction.
|
|
@@ -952,93 +774,6 @@ declare class RemoveFocusDirective {
|
|
|
952
774
|
static ɵdir: i0.ɵɵDirectiveDeclaration<RemoveFocusDirective, "[removeFocus]", never, {}, {}, never, never, true, never>;
|
|
953
775
|
}
|
|
954
776
|
|
|
955
|
-
/**
|
|
956
|
-
* Directive that validates a control value as a parseable SQL-compatible date string.
|
|
957
|
-
* Apply `sqlDate` to a text input that expects a date after year 1750.
|
|
958
|
-
*/
|
|
959
|
-
declare class SqlDateValidatorDirective implements Validator {
|
|
960
|
-
/**
|
|
961
|
-
* Validates that the control value can be parsed as a date after 1750.
|
|
962
|
-
* Returns `null` when the control is empty.
|
|
963
|
-
* @param control - The form control to validate.
|
|
964
|
-
*/
|
|
965
|
-
validate(control: AbstractControl): ValidationErrors | null;
|
|
966
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SqlDateValidatorDirective, never>;
|
|
967
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<SqlDateValidatorDirective, "[sqlDate]", never, {}, {}, never, never, true, never>;
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
/**
|
|
971
|
-
* Directive that validates a time string against optional allowed time slot ranges.
|
|
972
|
-
* Bind `[time]` and optionally `[slots]="'08:00-12:00|14:00-18:00'"` (pipe-separated ranges).
|
|
973
|
-
*/
|
|
974
|
-
declare class TimeValidatorDirective implements Validator {
|
|
975
|
-
/** Optional pipe-separated list of allowed time ranges, e.g. `"08:00-12:00|14:00-18:00"`. */
|
|
976
|
-
readonly slots: i0.InputSignal<string>;
|
|
977
|
-
/**
|
|
978
|
-
* Parses a `"HH:MM"` time string into a comparable integer (e.g. `"09:30"` -> `930`).
|
|
979
|
-
* Returns `-1` when the string is not a valid time.
|
|
980
|
-
* @param value - The time string to parse.
|
|
981
|
-
*/
|
|
982
|
-
private getTime;
|
|
983
|
-
/**
|
|
984
|
-
* Validates that the control value is a valid time string and, when slots are configured,
|
|
985
|
-
* that it falls within at least one of the allowed ranges.
|
|
986
|
-
* Returns `null` when the control is empty.
|
|
987
|
-
* @param control - The form control to validate.
|
|
988
|
-
*/
|
|
989
|
-
validate(control: AbstractControl): ValidationErrors | null;
|
|
990
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<TimeValidatorDirective, never>;
|
|
991
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<TimeValidatorDirective, "[time]", never, { "slots": { "alias": "slots"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
/**
|
|
995
|
-
* Directive that validates a control value as a well-formed URL.
|
|
996
|
-
* Apply `url` to a text input that expects a URL.
|
|
997
|
-
*/
|
|
998
|
-
declare class UrlValidatorDirective implements Validator {
|
|
999
|
-
/**
|
|
1000
|
-
* Validates that the control value is a well-formed URL.
|
|
1001
|
-
* Returns `null` (valid) when the control is empty.
|
|
1002
|
-
* @param control - The form control to validate.
|
|
1003
|
-
*/
|
|
1004
|
-
validate(control: AbstractControl): ValidationErrors | null;
|
|
1005
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<UrlValidatorDirective, never>;
|
|
1006
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<UrlValidatorDirective, "[url]", never, {}, {}, never, never, true, never>;
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
/**
|
|
1010
|
-
* Directive that validates a control using the host object's `isValid()` method
|
|
1011
|
-
* or a boolean expression passed via `[validIf]`.
|
|
1012
|
-
*/
|
|
1013
|
-
declare class ValidIfDirective implements Validator {
|
|
1014
|
-
/** When `true`, the control is considered valid regardless of the bound value. */
|
|
1015
|
-
readonly validIf: i0.InputSignal<boolean>;
|
|
1016
|
-
/**
|
|
1017
|
-
* Validates the control value against a boolean flag or the value's own `isValid()` method.
|
|
1018
|
-
* @param control - The form control to validate.
|
|
1019
|
-
*/
|
|
1020
|
-
validate(control: AbstractControl): ValidationErrors | null;
|
|
1021
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ValidIfDirective, never>;
|
|
1022
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<ValidIfDirective, "[validIf]", never, { "validIf": { "alias": "validIf"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
/**
|
|
1026
|
-
* Directive that delegates validation to an externally provided validator function.
|
|
1027
|
-
* Bind `[validator]="myFn"` where `myFn` is `(c: AbstractControl) => ValidationErrors | null`.
|
|
1028
|
-
*/
|
|
1029
|
-
declare class ValidatorDirective implements Validator {
|
|
1030
|
-
/** The custom validator function to apply. */
|
|
1031
|
-
readonly validator: i0.InputSignal<(control: AbstractControl) => ValidationErrors | null>;
|
|
1032
|
-
/**
|
|
1033
|
-
* Invokes the provided validator function against the given control.
|
|
1034
|
-
* Returns `null` (valid) when no function is bound.
|
|
1035
|
-
* @param control - The form control to validate.
|
|
1036
|
-
*/
|
|
1037
|
-
validate(control: AbstractControl): ValidationErrors | null;
|
|
1038
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ValidatorDirective, never>;
|
|
1039
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<ValidatorDirective, "[validator]", never, { "validator": { "alias": "validator"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
777
|
/**
|
|
1043
778
|
* Pipe that converts plain-text newlines (`\r\n`, `\r`, `\n`) to HTML `<br>` tags
|
|
1044
779
|
* and marks the result as trusted HTML so Angular does not escape it.
|
|
@@ -1574,5 +1309,5 @@ declare class ThemeService implements OnDestroy {
|
|
|
1574
1309
|
static ɵprov: i0.ɵɵInjectableDeclaration<ThemeService>;
|
|
1575
1310
|
}
|
|
1576
1311
|
|
|
1577
|
-
export { AutoFocusDirective, BroadcastChannelManager, BroadcastService, CHANNEL_NAME, CopyClipboardDirective, DateFormat, DateInterval, DateIntervalChangeDirective, DeleteModel,
|
|
1312
|
+
export { AutoFocusDirective, BroadcastChannelManager, BroadcastService, CHANNEL_NAME, CopyClipboardDirective, DateFormat, DateInterval, DateIntervalChangeDirective, DeleteModel, EnvironmentService, FileInfo, FormatHtmlPipe, FormatPipe, GroupModel, IDModel, ImportModel, LoginOAuthType, QueryModel, RelationModel, RemoveFocusDirective, ReplacePipe, SafeHtmlPipe, SafeUrlPipe, ScreenService, SearchCallbackPipe, SearchFilterPipe, SelectableModel, SplashService, SystemUtils, ThemeService, UpdateRelationsModel, UtilsMessages, ValueModel };
|
|
1578
1313
|
export type { AddModel, AddResultModel, ApiResponse, ApiResult, BroadcastChannelMessageBag, BroadcastChannelSubscriberInfo, BroadcastMessageInfo, BroadcastMessageToastData, Checkable, DeleteResultModel, DoneResult, EnableDisableModel, ErrorInfo, File, Folder, FolderTree, INode, KeyOf, LoginOAuthResult, LoginResult, NameValueItem, PasswordStrength, QueryResultModel, SearchBag, SearchFilterMetadata, Searchable, SendToModel, ThemeType, UpdateModel, UpdateResultModel, Validated };
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Validator, AbstractControl, ValidationErrors } from '@angular/forms';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Directive that delegates validation to an externally provided validator function.
|
|
6
|
+
* Bind `[validator]="myFn"` where `myFn` is `(c: AbstractControl) => ValidationErrors | null`.
|
|
7
|
+
*/
|
|
8
|
+
declare class ValidatorDirective implements Validator {
|
|
9
|
+
/** The custom validator function to apply. */
|
|
10
|
+
readonly validator: i0.InputSignal<(control: AbstractControl) => ValidationErrors | null>;
|
|
11
|
+
/**
|
|
12
|
+
* Invokes the provided validator function against the given control.
|
|
13
|
+
* Returns `null` (valid) when no function is bound.
|
|
14
|
+
* @param control - The form control to validate.
|
|
15
|
+
*/
|
|
16
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ValidatorDirective, never>;
|
|
18
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ValidatorDirective, "[validator]", never, { "validator": { "alias": "validator"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Directive that validates a control using the host object's `isValid()` method
|
|
23
|
+
* or a boolean expression passed via `[validIf]`.
|
|
24
|
+
*/
|
|
25
|
+
declare class ValidIfDirective implements Validator {
|
|
26
|
+
/** When `true`, the control is considered valid regardless of the bound value. */
|
|
27
|
+
readonly validIf: i0.InputSignal<boolean>;
|
|
28
|
+
/**
|
|
29
|
+
* Validates the control value against a boolean flag or the value's own `isValid()` method.
|
|
30
|
+
* @param control - The form control to validate.
|
|
31
|
+
*/
|
|
32
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
33
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ValidIfDirective, never>;
|
|
34
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ValidIfDirective, "[validIf]", never, { "validIf": { "alias": "validIf"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Directive that validates that the host control's value equals the value of another control.
|
|
39
|
+
* Bind `[equals]="otherControl"`.
|
|
40
|
+
*
|
|
41
|
+
* The host control is re-validated whenever the OTHER control's value changes:
|
|
42
|
+
* without this, typing a new password AFTER the confirmation field was filled
|
|
43
|
+
* left the form incorrectly valid (the classic password/confirm bug).
|
|
44
|
+
*
|
|
45
|
+
* IMPORTANT (reciprocal-binding safety): the re-validation triggered from the
|
|
46
|
+
* other control's `valueChanges` runs with `{ emitEvent: false }`. Calling
|
|
47
|
+
* Angular's `onValidatorChange` instead would re-emit valueChanges, so a
|
|
48
|
+
* reciprocal setup (A [equals]=B and B [equals]=A) would overflow the stack.
|
|
49
|
+
*/
|
|
50
|
+
declare class EqualsValidatorDirective implements Validator {
|
|
51
|
+
/** The control whose value must match the host control's value. */
|
|
52
|
+
readonly equals: i0.InputSignal<AbstractControl<any, any, any>>;
|
|
53
|
+
/** The host control, captured on the first validate() call. */
|
|
54
|
+
private hostControl?;
|
|
55
|
+
/** Subscription to the other control's valueChanges. */
|
|
56
|
+
private subscription?;
|
|
57
|
+
constructor();
|
|
58
|
+
/**
|
|
59
|
+
* Validates that the host control value equals the bound control's value.
|
|
60
|
+
* Returns `null` (valid) when no control is bound.
|
|
61
|
+
* @param control - The form control to validate.
|
|
62
|
+
* @returns `null` when valid, `{ equals: ... }` otherwise.
|
|
63
|
+
*/
|
|
64
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
65
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EqualsValidatorDirective, never>;
|
|
66
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<EqualsValidatorDirective, "[equals]", never, { "equals": { "alias": "equals"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Directive that validates that the host control's value is different from another control's value.
|
|
71
|
+
* Bind `[notEqual]="otherControl"`.
|
|
72
|
+
*
|
|
73
|
+
* The host control is re-validated whenever the OTHER control's value changes,
|
|
74
|
+
* so editing either field keeps both error states consistent.
|
|
75
|
+
*
|
|
76
|
+
* IMPORTANT (reciprocal-binding safety): the re-validation triggered from the
|
|
77
|
+
* other control's `valueChanges` is run with `{ emitEvent: false }`. Using
|
|
78
|
+
* Angular's `onValidatorChange` here instead would call `host.updateValueAndValidity()`
|
|
79
|
+
* WITH events, so a reciprocal setup (A [notEqual]=B and B [notEqual]=A) would
|
|
80
|
+
* ping-pong valueChanges between the two controls and overflow the stack.
|
|
81
|
+
*/
|
|
82
|
+
declare class NotEqualValidatorDirective implements Validator {
|
|
83
|
+
/** The control whose value must differ from the host control's value. */
|
|
84
|
+
readonly notEqual: i0.InputSignal<AbstractControl<any, any, any>>;
|
|
85
|
+
/** The host control, captured on the first validate() call. */
|
|
86
|
+
private hostControl?;
|
|
87
|
+
/** Subscription to the other control's valueChanges. */
|
|
88
|
+
private subscription?;
|
|
89
|
+
constructor();
|
|
90
|
+
/**
|
|
91
|
+
* Validates that the host control value is not equal to the bound control's value.
|
|
92
|
+
* Also clears the `notequal` error on the other control when the host becomes valid.
|
|
93
|
+
* Returns `null` (valid) when no control is bound.
|
|
94
|
+
* @param control - The form control to validate.
|
|
95
|
+
* @returns `null` when valid, `{ notequal: true }` otherwise.
|
|
96
|
+
*/
|
|
97
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
98
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NotEqualValidatorDirective, never>;
|
|
99
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NotEqualValidatorDirective, "[notEqual]", never, { "notEqual": { "alias": "notEqual"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Directive that validates a semicolon-separated list of email addresses.
|
|
104
|
+
* Apply `emails` to a text input containing one or more addresses separated by `;`.
|
|
105
|
+
*/
|
|
106
|
+
declare class EmailsValidatorDirective implements Validator {
|
|
107
|
+
/**
|
|
108
|
+
* Validates each address in a semicolon-separated email list.
|
|
109
|
+
* Returns `null` when the control is empty.
|
|
110
|
+
* @param control - The form control to validate.
|
|
111
|
+
*/
|
|
112
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
113
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmailsValidatorDirective, never>;
|
|
114
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<EmailsValidatorDirective, "[emails]", never, {}, {}, never, never, true, never>;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Directive that validates a control value as a GUID / UUID string.
|
|
119
|
+
* Apply `guid` to a text input that expects a valid UUID.
|
|
120
|
+
*/
|
|
121
|
+
declare class GuidValidatorDirective implements Validator {
|
|
122
|
+
/**
|
|
123
|
+
* Validates that the control value is a well-formed GUID / UUID.
|
|
124
|
+
* Returns `null` when the control is empty.
|
|
125
|
+
* @param control - The form control to validate.
|
|
126
|
+
*/
|
|
127
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
128
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GuidValidatorDirective, never>;
|
|
129
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<GuidValidatorDirective, "[guid]", never, {}, {}, never, never, true, never>;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Directive that validates a control value as a parseable SQL-compatible date string.
|
|
134
|
+
* Apply `sqlDate` to a text input that expects a date after year 1750.
|
|
135
|
+
*/
|
|
136
|
+
declare class SqlDateValidatorDirective implements Validator {
|
|
137
|
+
/**
|
|
138
|
+
* Validates that the control value can be parsed as a date after 1750.
|
|
139
|
+
* Returns `null` when the control is empty.
|
|
140
|
+
* @param control - The form control to validate.
|
|
141
|
+
*/
|
|
142
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
143
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SqlDateValidatorDirective, never>;
|
|
144
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<SqlDateValidatorDirective, "[sqlDate]", never, {}, {}, never, never, true, never>;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Directive that validates that a control value is not a future date.
|
|
149
|
+
* Apply `notFuture` to a text input that expects a date on or before today.
|
|
150
|
+
*/
|
|
151
|
+
declare class NotFutureValidatorDirective implements Validator {
|
|
152
|
+
/**
|
|
153
|
+
* Validates that the control value represents a date that is not in the future.
|
|
154
|
+
* Returns `null` when the control is empty.
|
|
155
|
+
* @param control - The form control to validate.
|
|
156
|
+
*/
|
|
157
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
158
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NotFutureValidatorDirective, never>;
|
|
159
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NotFutureValidatorDirective, "[notFuture]", never, {}, {}, never, never, true, never>;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Directive that validates a control value as a well-formed URL.
|
|
164
|
+
* Apply `url` to a text input that expects a URL.
|
|
165
|
+
*/
|
|
166
|
+
declare class UrlValidatorDirective implements Validator {
|
|
167
|
+
/**
|
|
168
|
+
* Validates that the control value is a well-formed URL.
|
|
169
|
+
* Returns `null` (valid) when the control is empty.
|
|
170
|
+
* @param control - The form control to validate.
|
|
171
|
+
*/
|
|
172
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
173
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UrlValidatorDirective, never>;
|
|
174
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<UrlValidatorDirective, "[url]", never, {}, {}, never, never, true, never>;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Directive that validates a file size against configurable minimum and maximum bounds.
|
|
179
|
+
* Bind `[fileSize]` together with `[size]="fileSizeInMb"`, `[maxSizeMb]`, and `[minSizeMb]`.
|
|
180
|
+
*/
|
|
181
|
+
declare class FileSizeValidatorDirective implements Validator {
|
|
182
|
+
/** Maximum allowed file size in megabytes. Defaults to 5. */
|
|
183
|
+
readonly maxSizeMb: i0.InputSignal<number>;
|
|
184
|
+
/** Minimum required file size in megabytes. Defaults to 0. */
|
|
185
|
+
readonly minSizeMb: i0.InputSignal<number>;
|
|
186
|
+
/** The actual file size in megabytes to validate against the bounds. */
|
|
187
|
+
readonly size: i0.InputSignal<number>;
|
|
188
|
+
/**
|
|
189
|
+
* Validates that the bound file size falls within the configured min/max range.
|
|
190
|
+
* Returns `null` when no control value is present.
|
|
191
|
+
* @param control - The form control to validate.
|
|
192
|
+
*/
|
|
193
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
194
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FileSizeValidatorDirective, never>;
|
|
195
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<FileSizeValidatorDirective, "[fileSize]", never, { "maxSizeMb": { "alias": "maxSizeMb"; "required": false; "isSignal": true; }; "minSizeMb": { "alias": "minSizeMb"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Directive that validates that a control value does not exceed a maximum word count.
|
|
200
|
+
* Bind `[maxTerms]="10"` to allow at most 10 whitespace-separated terms.
|
|
201
|
+
*/
|
|
202
|
+
declare class MaxTermsValidatorDirective implements Validator {
|
|
203
|
+
/** The maximum number of whitespace-separated terms allowed. */
|
|
204
|
+
readonly maxTerms: i0.InputSignal<number>;
|
|
205
|
+
/**
|
|
206
|
+
* Validates that the control value contains no more than the configured number of terms.
|
|
207
|
+
* Returns `null` when the control is empty.
|
|
208
|
+
* @param control - The form control to validate.
|
|
209
|
+
*/
|
|
210
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
211
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MaxTermsValidatorDirective, never>;
|
|
212
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MaxTermsValidatorDirective, "[maxTerms]", never, { "maxTerms": { "alias": "maxTerms"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Directive that validates a control value as a sufficiently strong password.
|
|
217
|
+
* Apply `password` to a password input.
|
|
218
|
+
*/
|
|
219
|
+
declare class PasswordValidatorDirective implements Validator {
|
|
220
|
+
/**
|
|
221
|
+
* Validates that the control value meets the minimum password-strength requirements.
|
|
222
|
+
* @param control - The form control to validate.
|
|
223
|
+
*/
|
|
224
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
225
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PasswordValidatorDirective, never>;
|
|
226
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<PasswordValidatorDirective, "[password]", never, {}, {}, never, never, true, never>;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Directive that validates a time string against optional allowed time slot ranges.
|
|
231
|
+
* Bind `[time]` and optionally `[slots]="'08:00-12:00|14:00-18:00'"` (pipe-separated ranges).
|
|
232
|
+
*/
|
|
233
|
+
declare class TimeValidatorDirective implements Validator {
|
|
234
|
+
/** Optional pipe-separated list of allowed time ranges, e.g. `"08:00-12:00|14:00-18:00"`. */
|
|
235
|
+
readonly slots: i0.InputSignal<string>;
|
|
236
|
+
/**
|
|
237
|
+
* Parses a `"HH:MM"` time string into a comparable integer (e.g. `"09:30"` -> `930`).
|
|
238
|
+
* Returns `-1` when the string is not a valid time.
|
|
239
|
+
* @param value - The time string to parse.
|
|
240
|
+
*/
|
|
241
|
+
private getTime;
|
|
242
|
+
/**
|
|
243
|
+
* Validates that the control value is a valid time string and, when slots are configured,
|
|
244
|
+
* that it falls within at least one of the allowed ranges.
|
|
245
|
+
* Returns `null` when the control is empty.
|
|
246
|
+
* @param control - The form control to validate.
|
|
247
|
+
*/
|
|
248
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
249
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TimeValidatorDirective, never>;
|
|
250
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<TimeValidatorDirective, "[time]", never, { "slots": { "alias": "slots"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Directive that validates that a string control value is not blank (whitespace-only).
|
|
255
|
+
* Apply `notEmpty` to a text input where non-blank content is required.
|
|
256
|
+
*/
|
|
257
|
+
declare class NotEmptyValidatorDirective implements Validator {
|
|
258
|
+
/**
|
|
259
|
+
* Validates that the control value is a non-blank string.
|
|
260
|
+
* Returns `null` when the control is empty or not a string.
|
|
261
|
+
* @param control - The form control to validate.
|
|
262
|
+
*/
|
|
263
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
264
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NotEmptyValidatorDirective, never>;
|
|
265
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NotEmptyValidatorDirective, "[notEmpty]", never, {}, {}, never, never, true, never>;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export { EmailsValidatorDirective, EqualsValidatorDirective, FileSizeValidatorDirective, GuidValidatorDirective, MaxTermsValidatorDirective, NotEmptyValidatorDirective, NotEqualValidatorDirective, NotFutureValidatorDirective, PasswordValidatorDirective, SqlDateValidatorDirective, TimeValidatorDirective, UrlValidatorDirective, ValidIfDirective, ValidatorDirective };
|