diff --git a/src/domain_abstract/ui/InputNumber.js b/src/domain_abstract/ui/InputNumber.js
index 0e028b318..4492d8991 100644
--- a/src/domain_abstract/ui/InputNumber.js
+++ b/src/domain_abstract/ui/InputNumber.js
@@ -12,7 +12,7 @@ export default Input.extend({
'click [data-arrow-up]': 'upArrowClick',
'click [data-arrow-down]': 'downArrowClick',
'mousedown [data-arrows]': 'downIncrement',
- keydown: 'handleKeyDown'
+ keydown: 'handleKeyDown',
},
template() {
@@ -132,9 +132,7 @@ export default Input.extend({
});
const temp = document.createElement('div');
- temp.innerHTML = ``;
+ temp.innerHTML = ``;
this.unitEl = temp.firstChild;
}
}
@@ -241,7 +239,7 @@ export default Input.extend({
* @param {Object} opts Options
* @return {Object} Validated string
*/
- validateInputValue(value, opts) {
+ validateInputValue(value, opts = {}) {
var force = 0;
var opt = opts || {};
var model = this.model;
@@ -249,8 +247,8 @@ export default Input.extend({
var val = !isUndefined(value) ? value : defValue;
var units = model.get('units') || [];
var unit = model.get('unit') || (units.length && units[0]) || '';
- var max = model.get('max');
- var min = model.get('min');
+ var max = !isUndefined(opts.max) ? opts.max : model.get('max');
+ var min = !isUndefined(opts.min) ? opts.min : model.get('min');
var limitlessMax = !!model.get('limitlessMax');
var limitlessMin = !!model.get('limitlessMin');
@@ -276,15 +274,13 @@ export default Input.extend({
}
}
- if (!limitlessMax && !isUndefined(max) && max !== '')
- val = val > max ? max : val;
- if (!limitlessMin && !isUndefined(min) && min !== '')
- val = val < min ? min : val;
+ if (!limitlessMax && !isUndefined(max) && max !== '') val = val > max ? max : val;
+ if (!limitlessMin && !isUndefined(min) && min !== '') val = val < min ? min : val;
return {
force,
value: val,
- unit
+ unit,
};
},
@@ -292,11 +288,7 @@ export default Input.extend({
Input.prototype.render.call(this);
this.unitEl = null;
const unit = this.getUnitEl();
- unit &&
- this.$el
- .find(`.${this.ppfx}field-units`)
- .get(0)
- .appendChild(unit);
+ unit && this.$el.find(`.${this.ppfx}field-units`).get(0).appendChild(unit);
return this;
- }
+ },
});
diff --git a/src/style_manager/model/Property.js b/src/style_manager/model/Property.js
index 52a16b016..f44b9988a 100644
--- a/src/style_manager/model/Property.js
+++ b/src/style_manager/model/Property.js
@@ -123,12 +123,12 @@ export default class Property extends Model {
}
upValue(value, opts) {
- const parsed = value === null || value === '' ? this.__getClearProps() : this.__parseValue(value);
+ const parsed = value === null || value === '' ? this.__getClearProps() : this.__parseValue(value, opts);
return this._up(parsed, opts);
}
- __parseValue(value) {
- return this.parseValue(value);
+ __parseValue(value, opts) {
+ return this.parseValue(value, opts);
}
__getClearProps() {
diff --git a/src/style_manager/model/PropertyInteger.js b/src/style_manager/model/PropertyInteger.js
index 887186856..223a69801 100644
--- a/src/style_manager/model/PropertyInteger.js
+++ b/src/style_manager/model/PropertyInteger.js
@@ -19,7 +19,7 @@ export default Property.extend({
min: '',
// Maximum value
- max: ''
+ max: '',
},
/**
@@ -66,14 +66,15 @@ export default Property.extend({
__getClearProps() {
return {
...Property.prototype.__getClearProps(),
- unit: ''
+ unit: '',
};
},
- parseValue(val) {
+ parseValue(val, opts = {}) {
const parsed = Property.prototype.parseValue.apply(this, arguments);
const { value, unit } = this.input.validateInputValue(parsed.value, {
- deepCheck: 1
+ deepCheck: 1,
+ ...opts,
});
parsed.value = value;
parsed.unit = unit;
@@ -87,5 +88,5 @@ export default Property.extend({
unit = !isUndefined(unit) && value ? unit : '';
value = `${value}${unit}`;
return Property.prototype.getFullValue.apply(this, [value]);
- }
+ },
});