|
|
|
@ -1,5 +1,5 @@ |
|
|
|
import { Model } from 'common'; |
|
|
|
import { isUndefined, isString } from 'underscore'; |
|
|
|
import { isUndefined, isString, result } from 'underscore'; |
|
|
|
import { capitalize } from 'utils/mixins'; |
|
|
|
|
|
|
|
export default class Property extends Model { |
|
|
|
@ -48,6 +48,15 @@ export default class Property extends Model { |
|
|
|
return this.get('name'); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Get property value. |
|
|
|
* @returns {String} |
|
|
|
*/ |
|
|
|
getValue() { |
|
|
|
const val = this.get('value'); |
|
|
|
return isUndefined(val) ? this.getDefaultValue() : val; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Clear the value |
|
|
|
* @return {this} |
|
|
|
@ -223,6 +232,10 @@ Property.callInit = function(context, props, opts = {}) { |
|
|
|
!opts.skipInit && context.init(props, opts); |
|
|
|
}; |
|
|
|
|
|
|
|
Property.getDefaults = function() { |
|
|
|
return result(this.prototype, 'defaults'); |
|
|
|
}; |
|
|
|
|
|
|
|
Property.prototype.defaults = { |
|
|
|
name: '', |
|
|
|
property: '', |
|
|
|
|