@sumaris-net/ngx-components 1.12.13 → 1.13.0
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/bundles/sumaris-net.ngx-components.umd.js +113 -0
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +7 -2
- package/esm2015/src/app/shared/observables.js +12 -2
- package/esm2015/src/app/shared/validator/validators.js +103 -2
- package/fesm2015/sumaris-net.ngx-components.js +110 -2
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/shared/observables.d.ts +1 -0
- package/src/app/shared/validator/validators.d.ts +35 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
package/package.json
CHANGED
|
@@ -22,3 +22,4 @@ export declare function firstFalse(obs: Observable<boolean>): Observable<void>;
|
|
|
22
22
|
*/
|
|
23
23
|
export declare function waitFor(predicate: Predicate<void>, opts?: WaitForOptions): Promise<void>;
|
|
24
24
|
export declare function waitForTrue(observable: Observable<boolean>, opts?: WaitForOptions): Promise<void>;
|
|
25
|
+
export declare function fromPromise<T>(promise: Promise<T>): Observable<T>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { AbstractControl, FormControl, ValidationErrors, ValidatorFn } from '@angular/forms';
|
|
1
|
+
import { AbstractControl, AsyncValidatorFn, FormControl, ValidationErrors, ValidatorFn } from '@angular/forms';
|
|
2
2
|
import { Moment, unitOfTime } from 'moment';
|
|
3
|
+
import { Observable, Subscription } from 'rxjs';
|
|
3
4
|
export declare class SharedValidators {
|
|
4
5
|
private static _REGEXP_CACHE;
|
|
5
6
|
private static getDoubleRegexp;
|
|
@@ -71,3 +72,36 @@ export declare class SharedFormArrayValidators {
|
|
|
71
72
|
*/
|
|
72
73
|
static validSumMaxValue(controlName: string, max: number): ValidatorFn;
|
|
73
74
|
}
|
|
75
|
+
export declare type ObservableValidatorFn = (control: AbstractControl) => Observable<ValidationErrors | null>;
|
|
76
|
+
export declare type PromiseValidatorFn = (control: AbstractControl) => Promise<ValidationErrors | null>;
|
|
77
|
+
export declare class SharedAsyncValidators {
|
|
78
|
+
/**
|
|
79
|
+
* Create an observable validator function. Will execute the validator, then cnvert the result into an observable
|
|
80
|
+
* @param validatorFn any validator
|
|
81
|
+
*/
|
|
82
|
+
static of(validatorFn: ValidatorFn | AsyncValidatorFn): ObservableValidatorFn;
|
|
83
|
+
private static DEBOUNCE_TIME_VALIDATOR_ID;
|
|
84
|
+
/**
|
|
85
|
+
* Add a debounce time to a validator.
|
|
86
|
+
* @param form
|
|
87
|
+
* @param validatorFn
|
|
88
|
+
* @param opts Use opts.stopSubject to stop the validator, before end
|
|
89
|
+
*/
|
|
90
|
+
static debounceTime(validatorFn: ValidatorFn | AsyncValidatorFn, opts?: {
|
|
91
|
+
dispose?: Observable<any>;
|
|
92
|
+
debounceTime?: number;
|
|
93
|
+
markForCheck?: () => void;
|
|
94
|
+
debug?: boolean;
|
|
95
|
+
}): ObservableValidatorFn;
|
|
96
|
+
/**
|
|
97
|
+
* Add an async validator, that can be disposed by the returned subscription
|
|
98
|
+
* @param form
|
|
99
|
+
* @param validatorFn the validator or job to execute
|
|
100
|
+
* @param opts
|
|
101
|
+
*/
|
|
102
|
+
static registerAsyncValidator(form: AbstractControl, validatorFn: ValidatorFn | AsyncValidatorFn, opts?: {
|
|
103
|
+
debounceTime?: number;
|
|
104
|
+
markForCheck?: () => void;
|
|
105
|
+
debug?: boolean;
|
|
106
|
+
}): Subscription;
|
|
107
|
+
}
|