Skip to content

Commit

Permalink
filter live previews updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sgratzl committed Mar 20, 2020
1 parent e69e441 commit 6e93359
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ export interface ILineUpOptions {

/**
* flag whether to shows filter previews as soon as the user changes the filter in the dialog
* @default false
* @default ['filter', 'vis']
*/
liveFilterPreviews: boolean;
livePreviws: ('search' | 'filter' | 'vis')[];

/**
* option to specify the default slope graph mode
Expand Down Expand Up @@ -209,7 +209,7 @@ export function defaultOptions(): ITaggleOptions {
defaultSlopeGraphMode: 'item',
overviewMode: false,

liveFilterPreviews: false,
livePreviws: ['filter', 'vis'],
onDialogBackgroundClick: 'cancel',

rowHeight: 18,
Expand Down
2 changes: 1 addition & 1 deletion src/ui/EngineRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default class EngineRenderer extends AEventDispatcher {

const dialogManager = new DialogManager({
doc: parent.ownerDocument!,
liveFilterPreviews: options.liveFilterPreviews,
livePreviews: options.livePreviws,
onDialogBackgroundClick: options.onDialogBackgroundClick,
});

Expand Down
2 changes: 1 addition & 1 deletion src/ui/dialogs/BooleanFilterDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class BooleanFilterDialog extends ADialog {

constructor(private readonly column: BooleanColumn, dialog: IDialogContext) {
super(dialog, {
livePreview: dialog.manager.liveFilterPreviews
livePreview: dialog.manager.livePreviews.includes('filter')
});
this.before = this.column.getFilter();
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/dialogs/CategoricalFilterDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class CategoricalFilterDialog extends ADialog {

constructor(private readonly column: CategoricalColumn | SetColumn, dialog: IDialogContext) {
super(dialog, {
livePreview: dialog.manager.liveFilterPreviews
livePreview: dialog.manager.livePreviews.includes('filter')
});
this.before = this.column.getFilter() || {filter: this.column.categories.map((d) => d.name), filterMissing: false};
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/dialogs/CategoricalMappingFilterDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class CategoricalMappingFilterDialog extends ADialog {

constructor(private readonly column: OrdinalColumn, dialog: IDialogContext) {
super(dialog, {
livePreview: dialog.manager.liveFilterPreviews
livePreview: dialog.manager.livePreviews.includes('filter')
});
this.before = this.column.getFilter() || {filter: this.column.categories.map((d) => d.name), filterMissing: false};
}
Expand Down
4 changes: 3 additions & 1 deletion src/ui/dialogs/ChangeRendererDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export default class ChangeRendererDialog extends ADialog {
private readonly before: {renderer: string, group: string, summary: string};

constructor(private readonly column: Column, dialog: IDialogContext, private readonly ctx: IRankingHeaderContext) {
super(dialog);
super(dialog, {
livePreview: dialog.manager.livePreviews.includes('vis')
});

this.before = {
renderer: column.getRenderer(),
Expand Down
2 changes: 1 addition & 1 deletion src/ui/dialogs/DateFilterDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class DateFilterDialog extends ADialog {

constructor(private readonly column: DateColumn, dialog: IDialogContext) {
super(dialog, {
livePreview: dialog.manager.liveFilterPreviews
livePreview: dialog.manager.livePreviews.includes('filter')
});
this.before = this.column.getFilter() || noDateFilter();
}
Expand Down
6 changes: 3 additions & 3 deletions src/ui/dialogs/DialogManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ export default class DialogManager {

private readonly openDialogs: ADialog[] = [];
readonly node: HTMLElement;
readonly liveFilterPreviews: boolean;
readonly livePreviews: string[];
readonly onDialogBackgroundClick: 'cancel' | 'confirm';

constructor(options: {doc: Document, liveFilterPreviews: boolean, onDialogBackgroundClick: 'cancel' | 'confirm'}) {
constructor(options: {doc: Document, livePreviews: string[], onDialogBackgroundClick: 'cancel' | 'confirm'}) {
const doc = options.doc;
this.liveFilterPreviews = options.liveFilterPreviews;
this.livePreviews = options.livePreviews;
this.onDialogBackgroundClick = options.onDialogBackgroundClick;
this.node = doc.createElement('div');
this.node.classList.add(cssClass('backdrop'));
Expand Down
2 changes: 1 addition & 1 deletion src/ui/dialogs/NumberFilterDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class NumberFilterDialog extends ADialog {

constructor(private readonly column: IMapAbleColumn, dialog: IDialogContext, private readonly ctx: IRankingHeaderContext) {
super(dialog, {
livePreview: dialog.manager.liveFilterPreviews
livePreview: dialog.manager.livePreviews.includes('filter')
});

this.before = column.getFilter();
Expand Down
4 changes: 3 additions & 1 deletion src/ui/dialogs/SearchDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import {cssClass} from '../../styles';
export default class SearchDialog extends ADialog {

constructor(private readonly column: Column, dialog: IDialogContext, private readonly provider: IDataProvider) {
super(dialog);
super(dialog, {
livePreview: dialog.manager.livePreviews.includes('search')
});
}

protected build(node: HTMLElement) {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/dialogs/StringFilterDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class StringFilterDialog extends ADialog {

constructor(private readonly column: StringColumn, dialog: IDialogContext) {
super(dialog, {
livePreview: dialog.manager.liveFilterPreviews
livePreview: dialog.manager.livePreviews.includes('filter')
});

this.before = this.column.getFilter();
Expand Down

0 comments on commit 6e93359

Please sign in to comment.