Skip to content

Commit

Permalink
JNG-5693 checkbox selection toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
noherczeg committed Apr 30, 2024
1 parent c42d850 commit 9bfd3f2
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,8 @@ public static List<Column> customizableColumns(Table table) {
.filter(VisualElement::isCustomImplementation)
.toList();
}

public static boolean checkboxSelectionEnabled(Table table) {
return table.getCheckboxSelection() == null || table.getCheckboxSelection() != CheckboxSelection.DISABLED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ interface EagerTableProps<T extends GridValidRowModel, TStored extends GridValid
tableHasSelectorColumn?: boolean;
maskAction?: () => string;
ownerData?: any;
checkboxSelection?: boolean;
isFormUpdateable?: () => boolean;
enabledByName?: string;
relationName: string;
Expand Down Expand Up @@ -120,6 +121,7 @@ export function EagerTable<T extends GridValidRowModel, TStored extends T, S ext
isFormUpdateable,
enabledByName,
relationName,
checkboxSelection,
} = props;

const apiRef = useGridApiRef();
Expand Down Expand Up @@ -436,7 +438,7 @@ export function EagerTable<T extends GridValidRowModel, TStored extends T, S ext
{{/ if }}
disableRowSelectionOnClick
hideFooterSelectedRowCount={ !allowSelectMultiple }
checkboxSelection
checkboxSelection={checkboxSelection !== false}
rowSelectionModel={selectionModel}
onRowSelectionModelChange={handleOnSelection}
keepNonExistentRowsSelected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ interface LazyTableProps<T extends GridValidRowModel, TStored extends GridValidR
selectionDiff?: T[];
isFormUpdateable?: () => boolean;
enabledByName?: string;
checkboxSelection?: boolean;
relationName: string;
}

Expand Down Expand Up @@ -139,6 +140,7 @@ export function LazyTable<T extends GridValidRowModel, TStored extends T, S exte
isFormUpdateable,
enabledByName,
relationName,
checkboxSelection,
} = props;

const apiRef = useGridApiRef();
Expand Down Expand Up @@ -592,7 +594,7 @@ export function LazyTable<T extends GridValidRowModel, TStored extends T, S exte
disableRowSelectionOnClick={!containerIsSelector}
isRowSelectable={handleIsRowSelectable}
hideFooterSelectedRowCount={ !allowSelectMultiple }
checkboxSelection
checkboxSelection={checkboxSelection !== false}
rowSelectionModel={selectionModel}
onRowSelectionModelChange={handleOnSelection}
keepNonExistentRowsSelected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ export function {{ componentName table }}(props: {{ componentName table }}Props)
{{# if container.isSelector }}
containerIsSelector={ true }
{{/ if }}
{{# unless (checkboxSelectionEnabled table) }}
checkboxSelection={ false }
{{/ unless }}
{{# if container.isRelationSelector }}
containerIsRelationSelector={ true }
{{/ if }}
Expand Down Expand Up @@ -306,6 +309,9 @@ export function {{ componentName table }}(props: {{ componentName table }}Props)
{{# if table.allowSelectMultiple }}
allowSelectMultiple={ true }
{{/ if }}
{{# unless (checkboxSelectionEnabled table) }}
checkboxSelection={ false }
{{/ unless }}
dataElementId={ '{{ createId table.dataElement }}' }
crudOperationsDisplayed={ {{ table.crudOperationsDisplayed }} }
transferOperationsDisplayed={ {{ table.transferOperationsDisplayed }} }
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<node-version>18.14.2</node-version>
<pnpm-version>8.9.2</pnpm-version>

<judo-meta-ui-version>1.1.0.20240414_042431_d835a8fa_develop</judo-meta-ui-version>
<judo-meta-ui-version>1.1.0.20240430_141047_55acda3e_develop</judo-meta-ui-version>
<judo-generator-commons-version>1.0.0.20231009_184136_321053b3_develop</judo-generator-commons-version>
<judo-ui-typescript-rest-version>1.0.0.20240308_130018_c6d4c7e2_feature_JNG_5598_command_masks</judo-ui-typescript-rest-version>

Expand Down

0 comments on commit 9bfd3f2

Please sign in to comment.