neo.mjs 4.0.42 → 4.0.43
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 +2 -2
- package/src/data/RecordFactory.mjs +16 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neo.mjs",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.43",
|
|
4
4
|
"description": "The webworkers driven UI framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"postcss": "^8.4.14",
|
|
53
53
|
"sass": "^1.52.3",
|
|
54
54
|
"webpack": "^5.73.0",
|
|
55
|
-
"webpack-cli": "^4.
|
|
55
|
+
"webpack-cli": "^4.10.0",
|
|
56
56
|
"webpack-dev-server": "4.9.2",
|
|
57
57
|
"webpack-hook-plugin": "^1.0.7",
|
|
58
58
|
"webpack-node-externals": "^3.0.0"
|
|
@@ -76,7 +76,7 @@ class RecordFactory extends Base {
|
|
|
76
76
|
|
|
77
77
|
if (Array.isArray(model.fields)) {
|
|
78
78
|
model.fields.forEach(field => {
|
|
79
|
-
let parsedValue = instance.parseRecordValue(field, config[field.name]),
|
|
79
|
+
let parsedValue = instance.parseRecordValue(field, config[field.name], config),
|
|
80
80
|
symbol = Symbol.for(field.name);
|
|
81
81
|
|
|
82
82
|
properties = {
|
|
@@ -98,7 +98,7 @@ class RecordFactory extends Base {
|
|
|
98
98
|
oldValue = me[symbol];
|
|
99
99
|
|
|
100
100
|
if (!Neo.isEqual(value, oldValue)) {
|
|
101
|
-
value = instance.parseRecordValue(field, value);
|
|
101
|
+
value = instance.parseRecordValue(field, value, null);
|
|
102
102
|
|
|
103
103
|
me[symbol] = value;
|
|
104
104
|
|
|
@@ -223,10 +223,22 @@ class RecordFactory extends Base {
|
|
|
223
223
|
* todo: parse value for more field types
|
|
224
224
|
* @param {Object} field
|
|
225
225
|
* @param {*} value
|
|
226
|
+
* @param {Object} recordConfig
|
|
226
227
|
* @returns {*}
|
|
227
228
|
*/
|
|
228
|
-
parseRecordValue(field, value) {
|
|
229
|
-
|
|
229
|
+
parseRecordValue(field, value, recordConfig) {
|
|
230
|
+
let mapping = record.mapping,
|
|
231
|
+
type = field.type?.toLowerCase();
|
|
232
|
+
|
|
233
|
+
// only trigger mappings for initial values
|
|
234
|
+
// dynamic changes of a field will not pass the recordConfig
|
|
235
|
+
if (mapping && recordConfig) {
|
|
236
|
+
let ns = mapping.split('.'),
|
|
237
|
+
key = mapping.pop();
|
|
238
|
+
|
|
239
|
+
ns = Neo.ns(ns, true, recordConfig);
|
|
240
|
+
value = ns[key];
|
|
241
|
+
}
|
|
230
242
|
|
|
231
243
|
if (type === 'date') {
|
|
232
244
|
return new Date(value);
|