Add options for min, max and step values for number inputs.
This commit is contained in:
parent
0d86a7e427
commit
7975fadfe9
@ -27,6 +27,9 @@ class Ingredient {
|
|||||||
this.toggleValues = [];
|
this.toggleValues = [];
|
||||||
this.target = null;
|
this.target = null;
|
||||||
this.defaultIndex = 0;
|
this.defaultIndex = 0;
|
||||||
|
this.min = null;
|
||||||
|
this.max = null;
|
||||||
|
this.step = 1;
|
||||||
|
|
||||||
if (ingredientConfig) {
|
if (ingredientConfig) {
|
||||||
this._parseConfig(ingredientConfig);
|
this._parseConfig(ingredientConfig);
|
||||||
@ -50,6 +53,9 @@ class Ingredient {
|
|||||||
this.toggleValues = ingredientConfig.toggleValues;
|
this.toggleValues = ingredientConfig.toggleValues;
|
||||||
this.target = typeof ingredientConfig.target !== "undefined" ? ingredientConfig.target : null;
|
this.target = typeof ingredientConfig.target !== "undefined" ? ingredientConfig.target : null;
|
||||||
this.defaultIndex = typeof ingredientConfig.defaultIndex !== "undefined" ? ingredientConfig.defaultIndex : 0;
|
this.defaultIndex = typeof ingredientConfig.defaultIndex !== "undefined" ? ingredientConfig.defaultIndex : 0;
|
||||||
|
this.min = ingredientConfig.min;
|
||||||
|
this.max = ingredientConfig.max;
|
||||||
|
this.step = ingredientConfig.step;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,6 +184,9 @@ class Operation {
|
|||||||
if (ing.disabled) conf.disabled = ing.disabled;
|
if (ing.disabled) conf.disabled = ing.disabled;
|
||||||
if (ing.target) conf.target = ing.target;
|
if (ing.target) conf.target = ing.target;
|
||||||
if (ing.defaultIndex) conf.defaultIndex = ing.defaultIndex;
|
if (ing.defaultIndex) conf.defaultIndex = ing.defaultIndex;
|
||||||
|
if (typeof ing.min === "number") conf.min = ing.min;
|
||||||
|
if (typeof ing.max === "number") conf.max = ing.max;
|
||||||
|
if (ing.step) conf.step = ing.step;
|
||||||
return conf;
|
return conf;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,9 @@ class HTMLIngredient {
|
|||||||
this.defaultIndex = config.defaultIndex || 0;
|
this.defaultIndex = config.defaultIndex || 0;
|
||||||
this.toggleValues = config.toggleValues;
|
this.toggleValues = config.toggleValues;
|
||||||
this.id = "ing-" + this.app.nextIngId();
|
this.id = "ing-" + this.app.nextIngId();
|
||||||
|
this.min = (typeof config.min === "number") ? config.min : "";
|
||||||
|
this.max = (typeof config.max === "number") ? config.max : "";
|
||||||
|
this.step = config.step || 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -103,6 +106,9 @@ class HTMLIngredient {
|
|||||||
id="${this.id}"
|
id="${this.id}"
|
||||||
arg-name="${this.name}"
|
arg-name="${this.name}"
|
||||||
value="${this.value}"
|
value="${this.value}"
|
||||||
|
min="${this.min}"
|
||||||
|
max="${this.max}"
|
||||||
|
step="${this.step}"
|
||||||
${this.disabled ? "disabled" : ""}>
|
${this.disabled ? "disabled" : ""}>
|
||||||
${this.hint ? "<span class='bmd-help'>" + this.hint + "</span>" : ""}
|
${this.hint ? "<span class='bmd-help'>" + this.hint + "</span>" : ""}
|
||||||
</div>`;
|
</div>`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user