mirror of
https://github.com/apache/superset.git
synced 2024-09-17 11:09:47 -04:00
fix: bug due to name mangle when minifying
This commit is contained in:
parent
4c335a1df9
commit
46384d790a
@ -79,7 +79,7 @@ function getStepSeconds(step, start) {
|
|||||||
return endMilliseconds - startMillliseconds;
|
return endMilliseconds - startMillliseconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getPlaySliderParams = function(timestamps, timeGrain) {
|
export function getPlaySliderParams(timestamps, timeGrain) {
|
||||||
const minTimestamp = moment(Math.min(...timestamps));
|
const minTimestamp = moment(Math.min(...timestamps));
|
||||||
const maxTimestamp = moment(Math.max(...timestamps));
|
const maxTimestamp = moment(Math.max(...timestamps));
|
||||||
let step;
|
let step;
|
||||||
@ -106,24 +106,26 @@ export const getPlaySliderParams = function(timestamps, timeGrain) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// find the largest `reference + n * step` smaller than the minimum timestamp
|
// find the largest `reference + n * step` smaller than the minimum timestamp
|
||||||
const start = moment(reference);
|
let start;
|
||||||
while (start < minTimestamp) {
|
const minValue = minTimestamp.valueOf();
|
||||||
|
for (start = reference.clone(); start.valueOf() < minValue; ) {
|
||||||
start.add(step);
|
start.add(step);
|
||||||
}
|
}
|
||||||
while (start > minTimestamp) {
|
for (; start.valueOf() > minValue; ) {
|
||||||
start.subtract(step);
|
start.subtract(step);
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the smallest `reference + n * step` larger than the maximum timestamp
|
// find the smallest `reference + n * step` larger than the maximum timestamp
|
||||||
const end = moment(reference);
|
let end;
|
||||||
while (end > maxTimestamp) {
|
const maxValue = maxTimestamp.valueOf();
|
||||||
|
for (end = reference.clone(); end.valueOf() > maxValue; ) {
|
||||||
end.subtract(step);
|
end.subtract(step);
|
||||||
}
|
}
|
||||||
while (end < maxTimestamp) {
|
for (; end.valueOf() < maxValue; ) {
|
||||||
end.add(step);
|
end.add(step);
|
||||||
}
|
}
|
||||||
|
|
||||||
const values = timeGrain != null ? [start, moment(start).add(step)] : [start, end];
|
const values = timeGrain != null ? [start, start.clone().add(step)] : [start, end];
|
||||||
const disabled = timestamps.every(timestamp => timestamp === null);
|
const disabled = timestamps.every(timestamp => timestamp === null);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -133,4 +135,4 @@ export const getPlaySliderParams = function(timestamps, timeGrain) {
|
|||||||
values: values.map(v => parseInt(v.format('x'), 10)),
|
values: values.map(v => parseInt(v.format('x'), 10)),
|
||||||
disabled,
|
disabled,
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user