step attribute for number widget

This commit is contained in:
Ralf Becker
2020-07-06 18:24:07 +02:00
parent b0965ea44d
commit 34cbc6880a
2 changed files with 34 additions and 0 deletions

View File

@@ -44,6 +44,7 @@ var et2_number = /** @class */ (function (_super) {
var _this = _super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_number._attributes, _child || {})) || this;
_this.min = null;
_this.max = null;
_this.step = null;
return _this;
}
et2_number.prototype.transformAttributes = function (_attrs) {
@@ -115,6 +116,15 @@ var et2_number = /** @class */ (function (_super) {
this.input.attr("max", this.max);
}
};
et2_number.prototype.set_step = function (_value) {
this.step = _value;
if (this.step == null) {
this.input.removeAttr("step");
}
else {
this.input.attr("step", this.step);
}
};
et2_number._attributes = {
"value": {
"type": "float"
@@ -135,6 +145,12 @@ var et2_number = /** @class */ (function (_super) {
"default": et2_no_init,
"description": "Maximum allowed value"
},
"step": {
"name": "step value",
"type": "integer",
"default": et2_no_init,
"description": "Step attribute specifies the interval between legal numbers"
},
"precision": {
// TODO: Implement this in some nice way other than HTML5's step attribute
"name": "Precision",