saasufy-components 2.1.0 → 2.2.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.
@@ -32,6 +32,7 @@ class CollectionAdder extends SocketConsumer {
32
32
  return [
33
33
  'collection-type',
34
34
  'collection-fields',
35
+ 'field-labels',
35
36
  'model-values',
36
37
  'submit-button-label',
37
38
  'hide-submit-button',
@@ -166,6 +167,10 @@ class CollectionAdder extends SocketConsumer {
166
167
  fieldValues: modelFieldValues
167
168
  } = this.getFieldDetails(this.getAttribute('model-values'));
168
169
 
170
+ let {
171
+ fieldValues: modelFieldLabels
172
+ } = this.getFieldDetails(this.getAttribute('field-labels'));
173
+
169
174
  this.modelFieldValues = modelFieldValues;
170
175
 
171
176
  if (this.collection) this.collection.destroy();
@@ -186,11 +191,12 @@ class CollectionAdder extends SocketConsumer {
186
191
  inputType = inputTypeParts[1];
187
192
  inputTypeParams = inputTypeParts[3] ? inputTypeParts[3].split(',') : [];
188
193
  }
194
+ let inputLabel = modelFieldLabels[field] == null ? field : modelFieldLabels[field];
189
195
  if (inputType === 'checkbox') {
190
196
  items.push(
191
197
  `<label>
192
198
  ${
193
- field
199
+ inputLabel
194
200
  }
195
201
  <input class="collection-adder-input" type="${
196
202
  inputType
@@ -205,7 +211,7 @@ class CollectionAdder extends SocketConsumer {
205
211
  <input class="collection-adder-input" type="text" name="${
206
212
  field
207
213
  }" placeholder="${
208
- field
214
+ inputLabel
209
215
  }" />
210
216
  <select class="collection-adder-select">
211
217
  <option value="" selected disabled hidden>Options</option>
@@ -218,7 +224,7 @@ class CollectionAdder extends SocketConsumer {
218
224
  `<textarea class="collection-adder-input" name="${
219
225
  field
220
226
  }" placeholder="${
221
- field
227
+ inputLabel
222
228
  }"></textarea>`
223
229
  );
224
230
  } else {
@@ -228,7 +234,7 @@ class CollectionAdder extends SocketConsumer {
228
234
  }" name="${
229
235
  field
230
236
  }" placeholder="${
231
- field
237
+ inputLabel
232
238
  }" />`
233
239
  );
234
240
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saasufy-components",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Components for Saasufy.",
5
5
  "main": "index.js",
6
6
  "scripts": {