neo.mjs 4.0.59 → 4.0.60

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "4.0.59",
3
+ "version": "4.0.60",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -64,7 +64,21 @@ class Container extends BaseContainer {
64
64
  }
65
65
 
66
66
  /**
67
- * @returns {Object} values
67
+ * @returns {Object}
68
+ */
69
+ getSubmitValues() {
70
+ let fields = this.getFields(),
71
+ values = {};
72
+
73
+ fields.forEach(item => {
74
+ values[item.name || item.id] = item.getSubmitValue();
75
+ });
76
+
77
+ return values;
78
+ }
79
+
80
+ /**
81
+ * @returns {Object}
68
82
  */
69
83
  getValues() {
70
84
  let fields = this.getFields(),
@@ -109,7 +109,13 @@ class Select extends Picker {
109
109
  * Display the first matching result while typing
110
110
  * @member {Boolean} typeAhead_=true
111
111
  */
112
- typeAhead_: true
112
+ typeAhead_: true,
113
+ /**
114
+ * This config should point to the store keyProperty or a different model field,
115
+ * which you want to submit instead
116
+ * @member {Number|String} valueField='id'
117
+ */
118
+ valueField: 'id'
113
119
  }}
114
120
 
115
121
  /**
@@ -338,6 +344,15 @@ class Select extends Picker {
338
344
  return recordKey && this.store.get(list.getItemRecordId(recordKey)) || null;
339
345
  }
340
346
 
347
+ /**
348
+ * @returns {Number|String}
349
+ */
350
+ getSubmitValue() {
351
+ let me = this;
352
+
353
+ return me.record?.[me.valueField] || me.value;
354
+ }
355
+
341
356
  /**
342
357
  * @param {Object} data
343
358
  * @protected
@@ -463,7 +478,7 @@ class Select extends Picker {
463
478
 
464
479
  me.fire('select', {
465
480
  record,
466
- value : record[displayField]
481
+ value: record[displayField]
467
482
  });
468
483
  }
469
484
  }