Adding filtering dialog and action to OE (#22937)

* Adding init change

* Adding filter cache in OE

* Adding more filtering changes

* Fixed stuff with dialog

* Fixing filter

* Adding support for connecitons

* Fixed stuff

* filtering

* Fixing  date

* Filters

* Removing is filtering supported

* Removing contracts

* Fixing filters

* Fixing cache

* Adding some accessibility changes

* Reverting some more changes to pull in changes from the main

* Adding comments

* Fixing boolean operators

* Fixing stuff

* Fixing stuff

* Fixing error handling and making dialog generic

* Fixing more stuff

* Making filter a generic dialog

* adding erase icon

* removing floating promises

* Fixing compile issue

* Adding support for choice filter with different and actual value.

* Adding null checks

* Adding durability type fix

* Fixing filtering for providers that do not play well with empty filter properties
This commit is contained in:
Aasim Khan
2023-05-08 11:00:59 -07:00
committed by GitHub
parent 4c10133ae9
commit 25bc14fb25
12 changed files with 964 additions and 13 deletions

View File

@@ -41,7 +41,7 @@ export class TableCellEditorFactory {
};
}
public getTextEditorClass(context: any, inputType: 'text' | 'number' = 'text'): any {
public getTextEditorClass(context: any, inputType: 'text' | 'number' | 'date' = 'text', presetValue?: string): any {
const self = this;
class TextEditor extends Disposable {
private _originalValue: string;
@@ -76,6 +76,8 @@ export class TableCellEditorFactory {
this._register(self._options.onStyleChange(() => {
self._options.editorStyler(this._input);
}));
this._input.value = presetValue ?? '';
}
private async commitEdit(): Promise<void> {
@@ -96,11 +98,21 @@ export class TableCellEditorFactory {
public loadValue(item: Slick.SlickData): void {
this._originalValue = self._options.valueGetter(item, this._args.column) ?? '';
this._input.value = this._originalValue;
if (inputType === 'date') {
this._input.inputElement.valueAsDate = new Date(this._originalValue);
} else {
this._input.value = this._originalValue;
}
}
public applyValue(item: Slick.SlickData, state: string): void {
const activeCell = this._args.grid.getActiveCell();
if (inputType === 'date') {
// Usually, the date picker will return the date in the local time zone and change the date to the previous day.
// We need to convert the date to UTC time zone to avoid this behavior so that the date will be the same as the
// date picked in the date picker.
state = new Date(state).toLocaleDateString(window.navigator.language, { timeZone: 'UTC' });
}
self._options.valueSetter(context, activeCell.row, item, this._args.column, state);
}