mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-26 04:41:41 +02:00
step attribute for number widget
This commit is contained in:
parent
b0965ea44d
commit
34cbc6880a
@ -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;
|
var _this = _super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_number._attributes, _child || {})) || this;
|
||||||
_this.min = null;
|
_this.min = null;
|
||||||
_this.max = null;
|
_this.max = null;
|
||||||
|
_this.step = null;
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
et2_number.prototype.transformAttributes = function (_attrs) {
|
et2_number.prototype.transformAttributes = function (_attrs) {
|
||||||
@ -115,6 +116,15 @@ var et2_number = /** @class */ (function (_super) {
|
|||||||
this.input.attr("max", this.max);
|
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 = {
|
et2_number._attributes = {
|
||||||
"value": {
|
"value": {
|
||||||
"type": "float"
|
"type": "float"
|
||||||
@ -135,6 +145,12 @@ var et2_number = /** @class */ (function (_super) {
|
|||||||
"default": et2_no_init,
|
"default": et2_no_init,
|
||||||
"description": "Maximum allowed value"
|
"description": "Maximum allowed value"
|
||||||
},
|
},
|
||||||
|
"step": {
|
||||||
|
"name": "step value",
|
||||||
|
"type": "integer",
|
||||||
|
"default": et2_no_init,
|
||||||
|
"description": "Step attribute specifies the interval between legal numbers"
|
||||||
|
},
|
||||||
"precision": {
|
"precision": {
|
||||||
// TODO: Implement this in some nice way other than HTML5's step attribute
|
// TODO: Implement this in some nice way other than HTML5's step attribute
|
||||||
"name": "Precision",
|
"name": "Precision",
|
||||||
|
@ -43,6 +43,12 @@ class et2_number extends et2_textbox
|
|||||||
"default": et2_no_init,
|
"default": et2_no_init,
|
||||||
"description": "Maximum allowed value"
|
"description": "Maximum allowed value"
|
||||||
},
|
},
|
||||||
|
"step": {
|
||||||
|
"name": "step value",
|
||||||
|
"type": "integer",
|
||||||
|
"default": et2_no_init,
|
||||||
|
"description": "Step attribute specifies the interval between legal numbers"
|
||||||
|
},
|
||||||
"precision": {
|
"precision": {
|
||||||
// TODO: Implement this in some nice way other than HTML5's step attribute
|
// TODO: Implement this in some nice way other than HTML5's step attribute
|
||||||
"name": "Precision",
|
"name": "Precision",
|
||||||
@ -55,6 +61,7 @@ class et2_number extends et2_textbox
|
|||||||
|
|
||||||
min : number = null;
|
min : number = null;
|
||||||
max : number = null;
|
max : number = null;
|
||||||
|
step : number = null;
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -140,6 +147,7 @@ class et2_number extends et2_textbox
|
|||||||
this.input.attr("min",this.min);
|
this.input.attr("min",this.min);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set_max(_value)
|
set_max(_value)
|
||||||
{
|
{
|
||||||
this.max = _value;
|
this.max = _value;
|
||||||
@ -149,6 +157,16 @@ class et2_number extends et2_textbox
|
|||||||
this.input.attr("max",this.max);
|
this.input.attr("max",this.max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_step(_value : number)
|
||||||
|
{
|
||||||
|
this.step = _value;
|
||||||
|
if(this.step == null) {
|
||||||
|
this.input.removeAttr("step");
|
||||||
|
} else {
|
||||||
|
this.input.attr("step",this.step);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
et2_register_widget(et2_number, ["int", "integer", "float"]);
|
et2_register_widget(et2_number, ["int", "integer", "float"]);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user