@creative-web-solution/front-library 7.1.20 → 7.1.22
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/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## 7.1.22
|
|
5
|
+
|
|
6
|
+
* [Validator] Fix MultiRequired validator
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## 7.1.21
|
|
10
|
+
|
|
11
|
+
* [Validator] Avoid registering the same validator several times
|
|
12
|
+
* [Validator] Add a function to remove a validator
|
|
13
|
+
|
|
14
|
+
|
|
4
15
|
## 7.1.20
|
|
5
16
|
|
|
6
17
|
* Remove legacy Modernizr addons
|
|
@@ -5,18 +5,15 @@ import InputValidator from './InputValidator';
|
|
|
5
5
|
* Object managing all validation functions
|
|
6
6
|
*/
|
|
7
7
|
class ValidatorFunctions {
|
|
8
|
-
#validators: FLib.Validator.Validator
|
|
8
|
+
#validators: Map<string, FLib.Validator.Validator> = new Map();
|
|
9
9
|
|
|
10
|
-
/*
|
|
11
|
-
* Add new validator to the list
|
|
12
|
-
*/
|
|
13
10
|
addValidator = ( name: string, selector: string, isAsynch: boolean | FLib.Validator.ValidateFunction, func?: FLib.Validator.ValidateFunction ) => {
|
|
14
11
|
if ( typeof func === 'undefined' ) {
|
|
15
12
|
func = (isAsynch as unknown) as FLib.Validator.ValidateFunction;
|
|
16
13
|
isAsynch = false;
|
|
17
14
|
}
|
|
18
15
|
|
|
19
|
-
this.#validators.
|
|
16
|
+
this.#validators.set(name, {
|
|
20
17
|
name,
|
|
21
18
|
selector,
|
|
22
19
|
"validate": func,
|
|
@@ -25,6 +22,11 @@ class ValidatorFunctions {
|
|
|
25
22
|
}
|
|
26
23
|
|
|
27
24
|
|
|
25
|
+
removeValidator = ( name: string ) => {
|
|
26
|
+
this.#validators.delete(name);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
28
30
|
/*
|
|
29
31
|
* Create and return all validators that apply to an inputs
|
|
30
32
|
*/
|
|
@@ -63,7 +63,8 @@ addValidator( 'multirequired', '[data-multirequired]', ( $input, value, isLiveVa
|
|
|
63
63
|
isRadioListChecked( $elem.__$radioGroup ) ) ||
|
|
64
64
|
( $elem.type !== 'checkbox' &&
|
|
65
65
|
$elem.type !== 'radio' &&
|
|
66
|
-
Array.isArray( VALUE ) ? VALUE.length > 0 : !isEmpty( VALUE as string )
|
|
66
|
+
(Array.isArray( VALUE ) ? VALUE.length > 0 : !isEmpty( VALUE as string ))
|
|
67
|
+
)
|
|
67
68
|
) {
|
|
68
69
|
count++
|
|
69
70
|
}
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@creative-web-solution/front-library",
|
|
3
3
|
"title": "Frontend library",
|
|
4
4
|
"description": "Frontend functions and modules",
|
|
5
|
-
"version": "7.1.
|
|
5
|
+
"version": "7.1.22",
|
|
6
6
|
"homepage": "https://github.com/creative-web-solution/front-library",
|
|
7
7
|
"author": "Creative Web Solution <contact@cws-studio.com> (https://www.cws-studio.com)",
|
|
8
8
|
"keywords": [],
|