aw-front-helpers 2.5.29 → 2.5.31

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.
@@ -70,6 +70,8 @@ export default class FormControl {
70
70
  ...options,
71
71
  };
72
72
 
73
+ this.disabledControls = [];
74
+
73
75
  this._form.setAttribute('novalidate', 'novalidate');
74
76
  this._formCreateBound();
75
77
  this._formGrabDom();
@@ -104,6 +106,15 @@ export default class FormControl {
104
106
 
105
107
  //________________________________________________________ public
106
108
  // -
109
+ disableControlsIn(container) {
110
+ this.disabledControls.push( container );
111
+ }
112
+
113
+ enableControlsIn(container) {
114
+ const index = this.disabledControls.indexOf(container);
115
+ this.disabledControls.splice( index, 1 );
116
+ }
117
+
107
118
  destroy() {
108
119
  this._form.removeEventListener('submit', this._onFormSubmit);
109
120
  this._domForm.inputs.forEach((input) => {
@@ -251,7 +262,12 @@ export default class FormControl {
251
262
  const group = el.closest(this._options.selectorGroup);
252
263
  if (group === null) return false;
253
264
  if (el.getAttribute('disabled') !== null) return false;
254
-
265
+ if( this.disabledControls.length > 0 ) {
266
+ for( let i = 0; i < this.disabledControls.length; i++) {
267
+ const container = this.disabledControls[i];
268
+ if (container.contains(el)) return false;
269
+ }
270
+ }
255
271
  let invalid = false;
256
272
  if (!testRequired(el, this._form)) {
257
273
  invalid = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aw-front-helpers",
3
- "version": "2.5.29",
3
+ "version": "2.5.31",
4
4
  "description": "Assets helpers for projects",
5
5
  "author": "Yoann Le Poupon",
6
6
  "license": "ISC",