(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:
Cyprien P
2022-09-14 11:04:20 +02:00
parent 7dc49f3c85
commit 620e86a9f1
18 changed files with 1526 additions and 213 deletions

View File

@@ -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);