saasufy-components 2.7.0 → 2.8.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.
@@ -40,7 +40,10 @@ class CollectionAdder extends SocketConsumer {
40
40
  'model-values',
41
41
  'submit-button-label',
42
42
  'hide-submit-button',
43
- 'success-message'
43
+ 'success-message',
44
+ 'autocapitalize',
45
+ 'autocorrect',
46
+ 'trim-spaces'
44
47
  ];
45
48
  }
46
49
 
@@ -106,6 +109,8 @@ class CollectionAdder extends SocketConsumer {
106
109
  }
107
110
  }
108
111
 
112
+ let trimSpaces = this.hasAttribute('trim-spaces');
113
+
109
114
  let newModelData = {
110
115
  ...this.modelFieldValues,
111
116
  ...radioData,
@@ -121,7 +126,11 @@ class CollectionAdder extends SocketConsumer {
121
126
  } else {
122
127
  value = input.value;
123
128
  }
124
- return [ input.name, Type(value) ];
129
+ let sanitizedValue = Type(value);
130
+ if (trimSpaces && typeof sanitizedValue === 'string') {
131
+ sanitizedValue = sanitizedValue.trim();
132
+ }
133
+ return [ input.name, sanitizedValue ];
125
134
  })
126
135
  )
127
136
  };
@@ -188,6 +197,15 @@ class CollectionAdder extends SocketConsumer {
188
197
  fieldValues: optionLabels
189
198
  } = this.getFieldDetails(this.getAttribute('option-labels'));
190
199
 
200
+ let autocapitalize = this.getAttribute('autocapitalize');
201
+ let autocorrect = this.getAttribute('autocorrect');
202
+
203
+ let extraAttributesString = `${
204
+ autocapitalize ? ` autocapitalize="${autocapitalize}"` : ''
205
+ }${
206
+ autocorrect ? ` autocorrect="${autocorrect}"` : ''
207
+ }`;
208
+
191
209
  this.modelFieldValues = modelFieldValues;
192
210
 
193
211
  if (this.collection) this.collection.destroy();
@@ -242,7 +260,7 @@ class CollectionAdder extends SocketConsumer {
242
260
  field
243
261
  }" placeholder="${
244
262
  inputLabel
245
- }" />
263
+ }"${extraAttributesString} />
246
264
  <select class="collection-adder-select">
247
265
  <option value="" selected disabled hidden>${optionLabel}</option>
248
266
  ${inputTypeParams.map(param => `<option value="${param}">${param}</option>`).join('')}
@@ -278,7 +296,7 @@ class CollectionAdder extends SocketConsumer {
278
296
  field
279
297
  }" placeholder="${
280
298
  inputLabel
281
- }"></textarea>`
299
+ }"${extraAttributesString}></textarea>`
282
300
  );
283
301
  } else {
284
302
  items.push(
@@ -288,7 +306,7 @@ class CollectionAdder extends SocketConsumer {
288
306
  field
289
307
  }" placeholder="${
290
308
  inputLabel
291
- }" />`
309
+ }"${extraAttributesString} />`
292
310
  );
293
311
  }
294
312
  }
package/input-provider.js CHANGED
@@ -28,7 +28,9 @@ class InputProvider extends HTMLElement {
28
28
  'debounce-delay',
29
29
  'options',
30
30
  'value',
31
- 'height'
31
+ 'height',
32
+ 'autocapitalize',
33
+ 'autocorrect'
32
34
  ];
33
35
  }
34
36
 
@@ -59,6 +61,8 @@ class InputProvider extends HTMLElement {
59
61
  render() {
60
62
  this.innerHTML = '';
61
63
  let inputId = this.getAttribute('input-id');
64
+ let autocapitalize = this.getAttribute('autocapitalize');
65
+ let autocorrect = this.getAttribute('autocorrect');
62
66
  let inputList = this.getAttribute('list');
63
67
  let type = this.getAttribute('type') || 'text';
64
68
  let placeholder = this.getAttribute('placeholder');
@@ -97,6 +101,12 @@ class InputProvider extends HTMLElement {
97
101
  if (inputId) {
98
102
  this.inputElement.setAttribute('id', inputId);
99
103
  }
104
+ if (autocapitalize) {
105
+ this.inputElement.setAttribute('autocapitalize', autocapitalize);
106
+ }
107
+ if (autocorrect) {
108
+ this.inputElement.setAttribute('autocorrect', autocorrect);
109
+ }
100
110
  if (placeholder) {
101
111
  this.inputElement.setAttribute('placeholder', placeholder);
102
112
  }
package/model-input.js CHANGED
@@ -36,7 +36,9 @@ class ModelInput extends SocketConsumer {
36
36
  'enable-rebound',
37
37
  'options',
38
38
  'height',
39
- 'hide-error-logs'
39
+ 'hide-error-logs',
40
+ 'autocapitalize',
41
+ 'autocorrect'
40
42
  ];
41
43
  }
42
44
 
@@ -71,6 +73,8 @@ class ModelInput extends SocketConsumer {
71
73
  let modelInstanceProperty = this.getAttribute('model-instance-property');
72
74
  let showErrorMessage = this.hasAttribute('show-error-message');
73
75
  let inputId = this.getAttribute('input-id');
76
+ let autocapitalize = this.getAttribute('autocapitalize');
77
+ let autocorrect = this.getAttribute('autocorrect');
74
78
  let inputList = this.getAttribute('list');
75
79
  let type = this.getAttribute('type') || 'text';
76
80
  let placeholder = this.getAttribute('placeholder');
@@ -188,6 +192,12 @@ class ModelInput extends SocketConsumer {
188
192
  if (inputId) {
189
193
  this.inputElement.setAttribute('id', inputId);
190
194
  }
195
+ if (autocapitalize) {
196
+ this.inputElement.setAttribute('autocapitalize', autocapitalize);
197
+ }
198
+ if (autocorrect) {
199
+ this.inputElement.setAttribute('autocorrect', autocorrect);
200
+ }
191
201
  if (placeholder) {
192
202
  this.inputElement.setAttribute('placeholder', placeholder);
193
203
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saasufy-components",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "description": "Components for Saasufy.",
5
5
  "main": "index.js",
6
6
  "scripts": {