mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) New date filter with a calendar view
Summary: Implements the new date filtering panel. Design results from long discussion between: Alex, Anais, Cyprien and Dmitry. Test environment: https://grist-new-date-range-filter.fly.dev/ Test Plan: Include various new tests. Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D3720
This commit is contained in:
@@ -2827,6 +2827,28 @@ export async function beginAclTran(api: UserAPI, docId: string) {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to set the value of a column range filter bound. Helper also support picking relative date
|
||||
* from options for Date columns, simply pass {relative: '2 days ago'} as value.
|
||||
*/
|
||||
export async function setRangeFilterBound(minMax: 'min'|'max', value: string|{relative: string}|null) {
|
||||
await driver.find(`.test-filter-menu-${minMax}`).click();
|
||||
if (typeof value === 'string' || value === null) {
|
||||
await selectAll();
|
||||
await driver.sendKeys(value === null ? Key.DELETE : value);
|
||||
// send TAB to trigger blur event, that will force call on the debounced callback
|
||||
await driver.sendKeys(Key.TAB);
|
||||
} else {
|
||||
await waitToPass(async () => {
|
||||
// makes sure the relative options is opened
|
||||
if (!await driver.find('.grist-floatin-menu').isPresent()) {
|
||||
await driver.find(`.test-filter-menu-${minMax}`).click();
|
||||
}
|
||||
await driver.findContent('.grist-floating-menu li', value.relative).click();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
} // end of namespace gristUtils
|
||||
|
||||
stackWrapOwnMethods(gristUtils);
|
||||
|
||||
Reference in New Issue
Block a user