@sumaris-net/ngx-components 1.12.13 → 1.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sumaris-net/ngx-components",
3
3
  "description": "SUMARiS Angular components",
4
- "version": "1.12.13",
4
+ "version": "1.13.2",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
@@ -57,6 +57,7 @@ export declare class PlatformService extends StartableService {
57
57
  isIOSCordova(): boolean;
58
58
  isWeb(): boolean;
59
59
  isApp(): boolean;
60
+ isMobileWeb(): boolean;
60
61
  get canDownload(): boolean;
61
62
  get canOpenFile(): boolean;
62
63
  width(): number;
@@ -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,31 @@ 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
+ private static DEBOUNCE_TIME_VALIDATOR_ID;
79
+ /**
80
+ * Add a debounce time to a validator.
81
+ * @param form
82
+ * @param validatorFn
83
+ * @param opts Use opts.stopSubject to stop the validator, before end
84
+ */
85
+ static debounceTime(validatorFn: ValidatorFn | AsyncValidatorFn, opts?: {
86
+ dispose?: Observable<any>;
87
+ debounceTime?: number;
88
+ markForCheck?: () => void;
89
+ debug?: boolean;
90
+ }): ObservableValidatorFn;
91
+ /**
92
+ * Add an async validator, that can be disposed by the returned subscription
93
+ * @param form
94
+ * @param validatorFn the validator or job to execute
95
+ * @param opts
96
+ */
97
+ static registerAsyncValidator(form: AbstractControl, validatorFn: ValidatorFn | AsyncValidatorFn, opts?: {
98
+ debounceTime?: number;
99
+ markForCheck?: () => void;
100
+ debug?: boolean;
101
+ }): Subscription;
102
+ }