Skip to content

Commit

Permalink
mark all dialog todos
Browse files Browse the repository at this point in the history
  • Loading branch information
sgratzl committed Mar 17, 2020
1 parent 8400125 commit 9700562
Show file tree
Hide file tree
Showing 16 changed files with 22 additions and 19 deletions.
6 changes: 0 additions & 6 deletions src/ui/dialogs/ADialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,6 @@ abstract class ADialog {
return (<M[]>Array.from(this.node.querySelectorAll(selector))).map(callback);
}

protected readonly changed = () => {
if (this.options.livePreview) {
this.submit();
}
}

protected abstract reset(): void;

protected abstract submit(): boolean;
Expand Down
3 changes: 2 additions & 1 deletion src/ui/dialogs/AddonDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {IToolbarDialogAddon, IRankingHeaderContext} from '../interfaces';

/** @internal */
export default class AddonDialog extends ADialog {
constructor(private readonly column: Column, private readonly addons: IToolbarDialogAddon[], dialog: IDialogContext, private readonly ctx: IRankingHeaderContext, private readonly onClick?: ()=>void) {
constructor(private readonly column: Column, private readonly addons: IToolbarDialogAddon[], dialog: IDialogContext, private readonly ctx: IRankingHeaderContext, private readonly onClick?: () => void) {
// TODO dialog
super(dialog, {
fullDialog: Boolean(onClick),
resetPossible: false
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 @@ -19,7 +19,7 @@ export default class BooleanFilterDialog extends ADialog {
<label class="${cssClass('checkbox')}"><input type="radio" name="boolean_check" value="true" ${this.before === true ? 'checked="checked"' : ''}><span>True</span></label>
<label class="${cssClass('checkbox')}"><input type="radio" name="boolean_check" value="false" ${this.before === false ? 'checked="checked"' : ''}><span>False</span></label>
`);
this.forEach('input[type=radio]', (elem: HTMLInputElement) => elem.onclick = this.changed);
this.enableLivePreviews('input[type=radio]');
}

private updateFilter(filter: boolean | null) {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/dialogs/ChangeRendererDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class ChangeRendererDialog extends ADialog {
}

protected reset() {
// TODO get the defaults from the description
// TODO dialog get the defaults from the description
}

protected submit() {
Expand Down
5 changes: 3 additions & 2 deletions src/ui/dialogs/ChooseRankingDialog.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import ADialog, {IDialogContext} from './ADialog';
import {IDialogContext} from './ADialog';
import {cssClass} from '../../styles';
import APopup from './APopup';

/** @internal */
export default class ChooseRankingDialog extends ADialog {
export default class ChooseRankingDialog extends APopup {

constructor(private readonly items: HTMLElement[], dialog: IDialogContext) {
super(dialog);
Expand Down
1 change: 1 addition & 0 deletions src/ui/dialogs/ColorMappingDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export default class ColorMappingDialog extends ADialog {

node.insertAdjacentHTML('beforeend', h);

// TODO dialog
this.interactive(node, id);
}

Expand Down
1 change: 1 addition & 0 deletions src/ui/dialogs/GroupDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function sortOrder(node: HTMLElement, column: Column, idPrefix: string) {
updateDisabled(!enabled);

const trigger = () => {
// TODO dialog
ranking.groupBy(column, !enabled ? -1 : order);
updateDisabled(!enabled);
};
Expand Down
5 changes: 2 additions & 3 deletions src/ui/dialogs/MappingDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ export default class MappingDialog extends ADialog {
};

constructor(private readonly column: IMapAbleColumn, dialog: IDialogContext, ctx: IRankingHeaderContext) {
super(dialog, {
fullDialog: true
});
super(dialog);

// TODO dialog
this.idPrefix = `me${ctx.idPrefix}`;
this.scale = this.column.getMapping().clone();
const domain = this.scale.domain;
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 @@ -17,7 +17,7 @@ export default class NumberFilterDialog extends ADialog {
build(node: HTMLElement) {
node.classList.add(cssClass('dialog-mapper'));

// TODO
// TODO dialog summary delayed??

// patch in lu-summary and renderer
const summary = this.ctx.asElement(this.summary.template);
Expand Down
1 change: 1 addition & 0 deletions src/ui/dialogs/ReduceDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {EAdvancedSortMethod, ReduceColumn} from '../../model';
import ADialog, {IDialogContext} from './ADialog';
import {sortMethods} from './utils';

// TODO dialog
/** @internal */
export default class ReduceDialog extends ADialog {
constructor(private readonly column: ReduceColumn, dialog: IDialogContext) {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/dialogs/RenameDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class RenameDialog extends ADialog {
}

protected reset() {
// TODO not just before but defaults
// TODO dialog not just before but defaults
this.findInput('input[type="text"]').value = this.before.label;
this.findInput('input[name="summary"]').value = this.before.summary;
this.node.querySelector('textarea')!.value = this.before.description;
Expand Down
1 change: 1 addition & 0 deletions src/ui/dialogs/SortDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {getToolbarDialogAddons} from '../toolbar';
import {IRankingHeaderContext, IToolbarDialogAddon} from '../interfaces';
import {cssClass} from '../../styles';

// TODO dialog
/** @internal */
export default class SortDialog extends ADialog {
private readonly addons: IToolbarDialogAddon[];
Expand Down
1 change: 1 addition & 0 deletions src/ui/dialogs/groupDate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default function appendDate(col: DateColumn, node: HTMLElement) {
node.insertAdjacentHTML('beforeend', html);

const update = () => {
// TODO dialog
col.setDateGrouper({granularity, circular});
};

Expand Down
3 changes: 2 additions & 1 deletion src/ui/dialogs/groupNumber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {cssClass} from '../../styles';


/** @internal */
export default function append(col: NumberColumn, node: HTMLElement, dialog: IDialogContext) {
export default function groupNumber(col: NumberColumn, node: HTMLElement, dialog: IDialogContext) {
const domain = col.getMapping().domain;
const current = col.getGroupThresholds();
let isThreshold = current.length <= 1;
Expand Down Expand Up @@ -34,6 +34,7 @@ export default function append(col: NumberColumn, node: HTMLElement, dialog: IDi
bins.disabled = isThreshold;

if (isThreshold) {
// TODO dialog
col.setGroupThresholds([threshold.valueAsNumber]);
return;
}
Expand Down
5 changes: 3 additions & 2 deletions src/ui/dialogs/groupString.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {IDialogContext} from './ADialog';
import {StringColumn, EStringGroupCriteriaType} from '../../model';
import {cssClass} from '../../styles/index';
import {cssClass} from '../../styles';

/** @internal */
export default function append(col: StringColumn, node: HTMLElement, dialog: IDialogContext) {
export default function groupString(col: StringColumn, node: HTMLElement, dialog: IDialogContext) {
const current = col.getGroupCriteria();
const {type, values} = current;

Expand Down Expand Up @@ -57,6 +57,7 @@ export default function append(col: StringColumn, node: HTMLElement, dialog: IDi
if (newType === EStringGroupCriteriaType.regex) {
items = items.map((d) => new RegExp(d.toString(), 'gm'));
}
// TODO dialog
col.setGroupCriteria({
type: newType,
values: items
Expand Down
1 change: 1 addition & 0 deletions src/ui/dialogs/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export function updateFilterState(attachment: HTMLElement, column: Column, filte
Array.from(root.querySelectorAll(`[data-col-id="${column.id}"] i[title^=Filter]`)).forEach(toggle);
}

// TODO dialog
/** @internal */
export function sortMethods(node: HTMLElement, column: {setSortMethod(v: string): void, getSortMethod(): string}, methods: string[]) {
const bak = column.getSortMethod();
Expand Down

0 comments on commit 9700562

Please sign in to comment.