|
|
|
@ -1,37 +1,24 @@ |
|
|
|
const InputNumber = require('domain_abstract/ui/InputNumber'); |
|
|
|
|
|
|
|
module.exports = require('./PropertyView').extend({ |
|
|
|
module.exports = require('./PropertyIntegerView').extend({ |
|
|
|
|
|
|
|
events: { |
|
|
|
'change': 'inputValueChanged', |
|
|
|
'input': 'inputValueChangedSoft', |
|
|
|
}, |
|
|
|
|
|
|
|
template(model) { |
|
|
|
const pfx = this.pfx; |
|
|
|
templateInput(model) { |
|
|
|
const ppfx = this.ppfx; |
|
|
|
return ` |
|
|
|
<div class="${pfx}label"> |
|
|
|
${this.templateLabel(model)} |
|
|
|
</div> |
|
|
|
<div class="${ppfx}fields"> |
|
|
|
<div class="${ppfx}field ${ppfx}field-range"> |
|
|
|
<input type="range" |
|
|
|
min="${model.get('min')}" |
|
|
|
max="${model.get('max')}" |
|
|
|
step="${model.get('step')}"/> |
|
|
|
</div> |
|
|
|
<div class="${ppfx}field ${ppfx}field-range"> |
|
|
|
<input type="range" |
|
|
|
min="${model.get('min')}" |
|
|
|
max="${model.get('max')}" |
|
|
|
step="${model.get('step')}"/> |
|
|
|
</div> |
|
|
|
`;
|
|
|
|
}, |
|
|
|
|
|
|
|
init() { |
|
|
|
console.log('Init slider'); |
|
|
|
const model = this.model; |
|
|
|
this.listenTo(model, 'change:unit', this.modelValueChanged); |
|
|
|
this.listenTo(model, 'el:change', this.elementUpdated); |
|
|
|
}, |
|
|
|
|
|
|
|
getSliderEl() { |
|
|
|
if (!this.slider) { |
|
|
|
this.slider = this.el.querySelector('input[type=range]'); |
|
|
|
@ -56,24 +43,7 @@ module.exports = require('./PropertyView').extend({ |
|
|
|
}, |
|
|
|
|
|
|
|
setValue(value) { |
|
|
|
this.getSliderEl().value = value; |
|
|
|
this.inputInst.setValue(value, {silent: 1}); |
|
|
|
}, |
|
|
|
|
|
|
|
onRender() { |
|
|
|
const ppfx = this.ppfx; |
|
|
|
|
|
|
|
if (!this.input) { |
|
|
|
const inputNumber = new InputNumber({ |
|
|
|
model: this.model, |
|
|
|
ppfx: this.ppfx |
|
|
|
}); |
|
|
|
const input = inputNumber.render(); |
|
|
|
this.$el.find(`.${ppfx}fields`).append(input.$el); |
|
|
|
this.$input = input.inputEl; |
|
|
|
this.$unit = input.unitEl; |
|
|
|
this.input = this.$input.get(0); |
|
|
|
this.inputInst = input; |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
}); |
|
|
|
|