This commit is contained in:
fullergalway 2024-05-05 02:08:29 -03:00 committed by GitHub
commit 233003f0ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 34 additions and 0 deletions

View File

@ -581,6 +581,40 @@ export default function transformProps(
back: t('restore zoom'),
},
},
myEmitTimeFilter: {
show: zoomable && emitFilter,
title: 'Apply Time Filter',
icon: 'path://M9.59961 17.8C9.59961 18.3523 10.0473 18.8 10.5996 18.8H13.3996C13.9519 18.8 14.3996 18.3523 14.3996 17.8V17.8C14.3996 17.2477 13.9519 16.8 13.3996 16.8H10.5996C10.0473 16.8 9.59961 17.2477 9.59961 17.8V17.8ZM2.59961 4C2.04732 4 1.59961 4.44772 1.59961 5V5C1.59961 5.55228 2.04732 6 2.59961 6H21.3996C21.9519 6 22.3996 5.55228 22.3996 5V5C22.3996 4.44772 21.9519 4 21.3996 4H2.59961ZM6.39961 11.4C6.39961 11.9523 6.84732 12.4 7.39961 12.4H16.5996C17.1519 12.4 17.5996 11.9523 17.5996 11.4V11.4C17.5996 10.8477 17.1519 10.4 16.5996 10.4H7.39961C6.84732 10.4 6.39961 10.8477 6.39961 11.4V11.4Z',
onclick(model: {
option: { dataZoom: { startValue: any; endValue: any }[] };
}) {
const zoom = model?.option?.dataZoom;
const startValue = zoom?.[0]?.startValue;
const endValue = zoom?.[0]?.endValue;
if (startValue !== undefined && endValue !== undefined) {
const from = new Date(startValue).toISOString().substring(0, 19);
// add 1 second to end value so not to exclude that
// since the filter is done: >= start and < end
const until = new Date(endValue + 1000)
.toISOString()
.substring(0, 19);
const time_range = `${from} : ${until}`;
const dataMask = {
extraFormData: {
time_range,
},
filterState: {
label: ['Time range'],
value: time_range,
selectedValues: [time_range],
},
};
setDataMask(dataMask);
}
},
},
},
},
dataZoom: zoomable