mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 00:29:38 +01:00
new precision option to limit number of counters shown
This commit is contained in:
parent
bb5157d338
commit
2af199f725
@ -112,6 +112,20 @@ var et2_countdown = /** @class */ (function (_super) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.options.precision) {
|
||||
var units = ['days', 'hours', 'minutes', 'seconds'];
|
||||
for (var u = 0; u < 4; ++u) {
|
||||
if (values[units[u]]) {
|
||||
for (var n = u + this.options.precision; n < 4; n++) {
|
||||
this[units[n]].hide();
|
||||
}
|
||||
break;
|
||||
}
|
||||
else {
|
||||
this[units[u]].hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
return distance;
|
||||
};
|
||||
et2_countdown.prototype._getIndicator = function (_v) {
|
||||
@ -136,6 +150,12 @@ var et2_countdown = /** @class */ (function (_super) {
|
||||
default: true,
|
||||
description: "Only displays none empty values."
|
||||
},
|
||||
precision: {
|
||||
name: "how many counters to show",
|
||||
type: "integer",
|
||||
default: 0,
|
||||
description: "Limit number of counters, eg. 2 does not show minutes and seconds, if days are displayed"
|
||||
},
|
||||
alarm: {
|
||||
name: "alarm",
|
||||
type: "any",
|
||||
|
@ -47,6 +47,12 @@ export class et2_countdown extends et2_valueWidget {
|
||||
default: true,
|
||||
description: "Only displays none empty values."
|
||||
},
|
||||
precision: {
|
||||
name: "how many counters to show",
|
||||
type: "integer",
|
||||
default: 0, // =all
|
||||
description: "Limit number of counters, eg. 2 does not show minutes and seconds, if days are displayed"
|
||||
},
|
||||
alarm: {
|
||||
name: "alarm",
|
||||
type: "any",
|
||||
@ -146,6 +152,25 @@ export class et2_countdown extends et2_valueWidget {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.options.precision)
|
||||
{
|
||||
const units = ['days','hours','minutes','seconds'];
|
||||
for (let u=0; u < 4; ++u)
|
||||
{
|
||||
if (values[units[u]])
|
||||
{
|
||||
for(let n=u+this.options.precision; n < 4; n++)
|
||||
{
|
||||
this[units[n]].hide();
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
this[units[u]].hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
return distance;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user