@creative-web-solution/front-library 7.1.40 → 7.1.41

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,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 7.1.41
4
+
5
+ * [Validator]: Add feature to cancel validation on a field. Do not validate a disabled field.
6
+
3
7
  ## 7.1.40
4
8
 
5
9
  * [Slider]: Improve auto slide function
@@ -159,8 +159,10 @@ export default class Input implements FLib.Validator.Input {
159
159
  this.#hasError = false;
160
160
  this.#isLiveValidation = isLiveValidation;
161
161
 
162
+ const mustCancelValidation = (this.#$input as HTMLInputElement).disabled || this.#$input.hasAttribute(this.#options.cancelFieldValidationAttribute) || this.#$input.closest(`[${ this.#options.cancelFieldValidationAttribute }]`);
163
+
162
164
  // This input has no (known) validation
163
- if ( !this.#hasValidator ) {
165
+ if ( !this.#hasValidator || mustCancelValidation ) {
164
166
  return Promise.resolve();
165
167
  }
166
168
 
@@ -14,6 +14,7 @@ const defaultOptions = {
14
14
  "onInvalidate": null,
15
15
  "validatorsOptions": null,
16
16
  "customErrorLabelPrefix": "data-error-label",
17
+ "cancelFieldValidationAttribute": "data-cancel-validation",
17
18
  "errorMessages": {},
18
19
  "liveValidation": {
19
20
  "onValidate": null,
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Front Library
2
2
 
3
- @version: 7.1.40
3
+ @version: 7.1.41
4
4
 
5
5
 
6
6
  ## Use
@@ -69,6 +69,8 @@ declare namespace FLib {
69
69
  filter: string;
70
70
  /** @defaultValue data-error-label */
71
71
  customErrorLabelPrefix: string;
72
+ /** @defaultValue data-cancel-validation */
73
+ cancelFieldValidationAttribute: string;
72
74
  /** @defaultValue `{}` */
73
75
  errorMessages: { [ key: string ]: string };
74
76
  validatorsOptions?: { [ key: string ]: any };
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.40",
5
+ "version": "7.1.41",
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": [],