Skip to content

Commit

Permalink
fix linting and small bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
sgratzl committed Mar 18, 2020
1 parent c8e6e46 commit e69e441
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/model/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export function integrateDefaults<T>(desc: T, defaults: Partial<T> = {}) {
const typed = <keyof T>key;
if (typeof desc[typed] === 'undefined') {
(<any>desc)[typed] = defaults[typed];
};
})
}
});
return desc;
}

Expand Down
17 changes: 9 additions & 8 deletions src/renderer/HistogramCellRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export function createNumberFilter(col: INumberColumn & IMapAbleColumn, parent:
const renderer = getHistDOMRenderer(col);
const fContext = createFilterContext(col, context);

parent.innerHTML = renderer.template + filteredHistTemplate(fContext, createFilterInfo(col)) + '</div>';
parent.innerHTML = `${renderer.template}${filteredHistTemplate(fContext, createFilterInfo(col))}</div>`;
const summaryNode = <HTMLElement>parent.firstElementChild!;
summaryNode.classList.add(cssClass('summary'), cssClass('renderer'));
summaryNode.dataset.renderer = 'histogram';
Expand Down Expand Up @@ -155,13 +155,14 @@ export function createNumberFilter(col: INumberColumn & IMapAbleColumn, parent:
return;
}
renderer.render(summaryNode, summary, data);
})
if (ready) {
summaryNode.classList.add(engineCssClass('loading'));
ready.then(() => {
summaryNode.classList.remove(engineCssClass('loading'));
});
});
if (!ready) {
return;
}
summaryNode.classList.add(engineCssClass('loading'));
ready.then(() => {
summaryNode.classList.remove(engineCssClass('loading'));
});
};
rerender();

Expand All @@ -172,7 +173,7 @@ export function createNumberFilter(col: INumberColumn & IMapAbleColumn, parent:
submit() {
applyFilter(currentFilter.filterMissing, currentFilter.filterMin, currentFilter.filterMax);
}
}
};
}

/** @internal */
Expand Down
6 changes: 3 additions & 3 deletions src/ui/dialogs/APopup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ADialog, {IDialogContext, IDialogOptions} from "./ADialog";
import ADialog, {IDialogContext, IDialogOptions} from './ADialog';

abstract class APopup extends ADialog {
constructor(dialog: Readonly<IDialogContext>, options: Partial<IDialogOptions> = {}) {
Expand All @@ -12,11 +12,11 @@ abstract class APopup extends ADialog {
}

protected reset() {

// dummy
}

protected cancel() {

// dummy
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/ui/dialogs/BooleanFilterDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export default class BooleanFilterDialog extends ADialog {
private readonly before: boolean | null;

constructor(private readonly column: BooleanColumn, dialog: IDialogContext) {
super(dialog);
super(dialog, {
livePreview: dialog.manager.liveFilterPreviews
});
this.before = this.column.getFilter();
}

Expand Down
4 changes: 3 additions & 1 deletion src/ui/dialogs/CategoricalMappingFilterDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export default class CategoricalMappingFilterDialog extends ADialog {
private readonly before: ICategoricalFilter;

constructor(private readonly column: OrdinalColumn, dialog: IDialogContext) {
super(dialog);
super(dialog, {
livePreview: dialog.manager.liveFilterPreviews
});
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/NumberFilterDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export default class NumberFilterDialog extends ADialog {
private handler: {reset: () => void, submit: () => void} | null = null;

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

this.before = column.getFilter();
}
Expand Down
4 changes: 2 additions & 2 deletions src/ui/dialogs/RenameDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export default class RenameDialog extends ADialog {
label: desc.label || this.column.id,
summary: desc.summary || '',
description: desc.description || ''
}
};
this.findInput('input[type="text"]').value = meta.label;
this.findInput('input[name="summary"]').value = meta.summary
this.findInput('input[name="summary"]').value = meta.summary;
this.node.querySelector('textarea')!.value = meta.description;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ui/dialogs/SearchDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class SearchDialog extends ADialog {
const input = <HTMLInputElement>node.querySelector('input[type="text"]')!;
const checkbox = <HTMLInputElement>node.querySelector('input[type="checkbox"]')!;
const update = () => {
let search: any = input.value;
const search: any = input.value;
if (search.length < 3) {
input.setCustomValidity('at least 3 characters');
return;
Expand Down
4 changes: 2 additions & 2 deletions src/ui/dialogs/groupNumber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export default function groupNumber(col: NumberColumn, node: HTMLElement, dialog
threshold.value = value.toString();
threshold.disabled = false;
bins.value = getNumberOfBins(ranking.getOrderLength()).toString();
bins.disabled = false;
bins.disabled = true;
node.querySelector<HTMLInputElement>('input[name=threshold][value=threshold]')!.checked = true;
}
}
};
}
2 changes: 1 addition & 1 deletion src/ui/dialogs/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function sortMethods(node: HTMLElement, column: {setSortMethod(v: string)
reset() {
node.querySelector<HTMLInputElement>(`input[name=multivaluesort][value="${bak}"]`)!.checked = true;
}
}
};
}


Expand Down

0 comments on commit e69e441

Please sign in to comment.