@onehat/data 1.19.13 → 1.19.15
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 +1 -1
- package/src/Property/Property.js +6 -2
- package/src/Schema/Schema.js +8 -2
package/package.json
CHANGED
package/src/Property/Property.js
CHANGED
|
@@ -192,10 +192,14 @@ export default class Property extends EventEmitter {
|
|
|
192
192
|
* @return {any} defaultValue
|
|
193
193
|
*/
|
|
194
194
|
getDefaultValue() {
|
|
195
|
+
let value = null;
|
|
195
196
|
if (!_.isNil(this.defaultValue)) {
|
|
196
|
-
|
|
197
|
+
value = this.defaultValue;
|
|
197
198
|
}
|
|
198
|
-
|
|
199
|
+
if (_.isFunction(value)) {
|
|
200
|
+
value = value();
|
|
201
|
+
}
|
|
202
|
+
return value;
|
|
199
203
|
}
|
|
200
204
|
|
|
201
205
|
/**
|
package/src/Schema/Schema.js
CHANGED
|
@@ -236,9 +236,15 @@ export default class Schema extends EventEmitter {
|
|
|
236
236
|
if (this.isDestroyed) {
|
|
237
237
|
throw Error('this.getPropertyDefinition is no longer valid. Schema has been destroyed.');
|
|
238
238
|
}
|
|
239
|
-
|
|
239
|
+
const found = _.clone(_.find(this.model.properties, (propertyDefinition) => {
|
|
240
240
|
return propertyDefinition.name === propertyName;
|
|
241
|
-
});
|
|
241
|
+
}));
|
|
242
|
+
|
|
243
|
+
if (this.model?.validator?.fields && this.model.validator.fields[propertyName]) {
|
|
244
|
+
found.validator = this.model?.validator?.fields[propertyName];
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return found;
|
|
242
248
|
}
|
|
243
249
|
|
|
244
250
|
getTitles = () => {
|