mirror of https://github.com/artf/grapesjs.git
nocodeframeworkdrag-and-dropsite-buildersite-generatortemplate-builderui-builderweb-builderweb-builder-frameworkwebsite-builderno-codepage-builder
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
47 lines
1.1 KiB
var TraitView = require('./TraitView');
|
|
var InputNumber = require('domain_abstract/ui/InputNumber');
|
|
|
|
module.exports = TraitView.extend({
|
|
|
|
getValueForTarget: function () {
|
|
var model = this.model;
|
|
var value = model.get('value');
|
|
var unit = model.get('unit');
|
|
return value ? (value + unit) : '';
|
|
},
|
|
|
|
/**
|
|
* Returns input element
|
|
* @return {HTMLElement}
|
|
* @private
|
|
*/
|
|
getInputEl: function() {
|
|
if (!this.$input) {
|
|
var value = this.getModelValue();
|
|
var inputNumber = new InputNumber({
|
|
contClass: this.ppfx + 'field-int',
|
|
model: this.model,
|
|
ppfx: this.ppfx
|
|
});
|
|
this.input = inputNumber.render();
|
|
this.$input = this.input.inputEl;
|
|
this.$unit = this.input.unitEl;
|
|
this.model.set('value', value);
|
|
this.$input.val(value);
|
|
}
|
|
return this.$input.get(0);
|
|
},
|
|
|
|
/**
|
|
* Renders input
|
|
* @private
|
|
* */
|
|
renderField: function() {
|
|
if(!this.$input){
|
|
this.$el.append(this.tmpl);
|
|
this.getInputEl();
|
|
this.$el.find('.' + this.inputhClass).prepend(this.input.el);
|
|
}
|
|
},
|
|
|
|
});
|
|
|