Skip to content

Commit 0a6ea5e

Browse files
committed
refactor: use interfaces
1 parent 923bf92 commit 0a6ea5e

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

packages/pluggableWidgets/datagrid-web/src/view-models/SelectAllBarViewModel.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { SelectAllService, SelectionCounterViewModel } from "@mendix/widget-plugin-grid/main";
21
import { DerivedPropsGate, SetupComponent, SetupComponentHost } from "@mendix/widget-plugin-mobx-kit/main";
32
import { action, makeAutoObservable, reaction } from "mobx";
43
import { DatagridContainerProps } from "../../typings/DatagridProps";
@@ -8,6 +7,18 @@ type DynamicProps = Pick<
87
"selectAllTemplate" | "selectAllText" | "itemSelection" | "datasource" | "allSelectedText"
98
>;
109

10+
interface SelectService {
11+
selectAllPages(): Promise<{ success: boolean }> | { success: boolean };
12+
clearSelection(): void;
13+
}
14+
15+
interface CounterService {
16+
selectedCount: number;
17+
selectedCountText: string;
18+
clearButtonLabel: string;
19+
}
20+
21+
/** @injectable */
1122
export class SelectAllBarViewModel implements SetupComponent {
1223
private barVisible = false;
1324
private clearVisible = false;
@@ -17,8 +28,8 @@ export class SelectAllBarViewModel implements SetupComponent {
1728
constructor(
1829
host: SetupComponentHost,
1930
private readonly gate: DerivedPropsGate<DynamicProps>,
20-
private readonly selectService: SelectAllService,
21-
private readonly count: SelectionCounterViewModel,
31+
private readonly selectService: SelectService,
32+
private readonly count: CounterService,
2233
private readonly enableSelectAll: boolean
2334
) {
2435
host.add(this);

packages/shared/widget-plugin-grid/src/view-models/SelectionCounterViewModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface DynamicProps {
99
clearSelectionButtonLabel?: DynamicValue<string>;
1010
}
1111

12-
/** @observable */
12+
/** @injectable */
1313
export class SelectionCounterViewModel {
1414
constructor(
1515
private readonly gate: DerivedPropsGate<DynamicProps>,

0 commit comments

Comments
 (0)