Skip to content

Commit

Permalink
JNG-6010 enum column inline selector (#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
noherczeg authored Dec 21, 2024
1 parent bb795bf commit 6c3366d
Show file tree
Hide file tree
Showing 12 changed files with 437 additions and 371 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,25 @@ export function ViewMatterTableTableComponent(props: ViewMatterTableTableCompone
const errors = rowValidation.current.get(props.row.__identifier);
error = errors?.get('type');
}
return <CellEditInput {...props} error={error} cellEditorType={'text'} />;
return <CellEditInput {...props} error={error} cellEditorType={'singleSelect'} />;
},
filterable: false && true,
valueFormatter: (value?: string) => {
if (value !== undefined && value !== null) {
return t(`enumerations.MatterType.${value}`, { defaultValue: value });
}
},
valueOptions: [
{ value: 'dark', label: t('enumerations.MatterType.dark', { defaultValue: 'dark' }) },
{
value: 'interstellarMedium',
label: t('enumerations.MatterType.interstellarMedium', { defaultValue: 'interstellarMedium' }),
},
{
value: 'intergalacticDust',
label: t('enumerations.MatterType.intergalacticDust', { defaultValue: 'intergalacticDust' }),
},
],
};
const massColumn: GridColDef<ViewMatterStored> = {
...baseColumnConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ export default function GodGodEarthAccessViewPage() {
}
};
// OpenOperationInputSelectorAction: God/(esm/_a2C4RT0wEe-oxNmZsPxMmA)/OperationFormTableRowCallAction/(discriminator/God/(esm/_oaE_YM_fEe6fibzd7gNETg)/AccessViewPageDefinition)
const creaturesTalkToGodAction = async (target?: ViewPlanetStored) => {
const creaturesTalkToGodAction = async (target?: ViewCreatureStored) => {
const { result, data: returnedData } =
await openViewPlanetViewGroup_2RightCreaturesTalkToGodRelationTableCallSelector({
ownerData: target!,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ export default function ViewStarPlanetsRelationViewPage() {
}
};
// OpenOperationInputSelectorAction: God/(esm/_a2C4RT0wEe-oxNmZsPxMmA)/OperationFormTableRowCallAction/(discriminator/God/(esm/_Hfxf0E7sEeycO-gUAWxcVg)/RelationFeatureView)
const creaturesTalkToGodAction = async (target?: ViewPlanetStored) => {
const creaturesTalkToGodAction = async (target?: ViewCreatureStored) => {
const { result, data: returnedData } =
await openViewPlanetViewGroup_2RightCreaturesTalkToGodRelationTableCallSelector({
ownerData: target!,
Expand Down
61 changes: 30 additions & 31 deletions judo-ui-react-itest/ActionGroupTest/model/ActionGroupTest-ui.model

Large diffs are not rendered by default.

Large diffs are not rendered by default.

228 changes: 114 additions & 114 deletions judo-ui-react-itest/CRUDActionsTest/model/CRUDActionsTest-ui.model

Large diffs are not rendered by default.

Large diffs are not rendered by default.

112 changes: 82 additions & 30 deletions judo-ui-react-itest/RelationTest/model/RelationTest-ui.model

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,20 @@ export default function ActorInlineEditTransferAccessViewPage() {
const getPageQueryCustomizer: () => InlineEditTransferQueryCustomizer = () => ({
_mask: actions.getMask
? actions.getMask!()
: '{field,manyAggregationAssociation{booleanAttr,dateAttr,doubleAttr,emailAttr,intAttr,stringAttr,timestampAttr},manyAggregationComposition{booleanAttr,dateAttr,doubleAttr,emailAttr,intAttr,stringAttr,timestampAttr},manyDerivedAggregationAssociation{booleanAttr,dateAttr,doubleAttr,emailAttr,intAttr,stringAttr,timestampAttr},manyDerivedAggregationComposition{booleanAttr,dateAttr,doubleAttr,emailAttr,intAttr,stringAttr,timestampAttr}}',
: '{field,manyAggregationAssociation{booleanAttr,dateAttr,doubleAttr,emailAttr,grade,intAttr,stringAttr,timestampAttr},manyAggregationComposition{booleanAttr,dateAttr,doubleAttr,emailAttr,grade,intAttr,stringAttr,timestampAttr},manyDerivedAggregationAssociation{booleanAttr,dateAttr,doubleAttr,emailAttr,grade,intAttr,stringAttr,timestampAttr},manyDerivedAggregationComposition{booleanAttr,dateAttr,doubleAttr,emailAttr,grade,intAttr,stringAttr,timestampAttr}}',
});

// Masks
const getMask = () =>
'{field,manyAggregationAssociation{booleanAttr,dateAttr,doubleAttr,emailAttr,intAttr,stringAttr,timestampAttr},manyAggregationComposition{booleanAttr,dateAttr,doubleAttr,emailAttr,intAttr,stringAttr,timestampAttr},manyDerivedAggregationAssociation{booleanAttr,dateAttr,doubleAttr,emailAttr,intAttr,stringAttr,timestampAttr},manyDerivedAggregationComposition{booleanAttr,dateAttr,doubleAttr,emailAttr,intAttr,stringAttr,timestampAttr}}';
'{field,manyAggregationAssociation{booleanAttr,dateAttr,doubleAttr,emailAttr,grade,intAttr,stringAttr,timestampAttr},manyAggregationComposition{booleanAttr,dateAttr,doubleAttr,emailAttr,grade,intAttr,stringAttr,timestampAttr},manyDerivedAggregationAssociation{booleanAttr,dateAttr,doubleAttr,emailAttr,grade,intAttr,stringAttr,timestampAttr},manyDerivedAggregationComposition{booleanAttr,dateAttr,doubleAttr,emailAttr,grade,intAttr,stringAttr,timestampAttr}}';
const getManyAggregationAssociationMask = () =>
'{booleanAttr,dateAttr,doubleAttr,emailAttr,intAttr,stringAttr,timestampAttr}';
'{booleanAttr,dateAttr,doubleAttr,emailAttr,grade,intAttr,stringAttr,timestampAttr}';
const getManyAggregationCompositionMask = () =>
'{booleanAttr,dateAttr,doubleAttr,emailAttr,intAttr,stringAttr,timestampAttr}';
'{booleanAttr,dateAttr,doubleAttr,emailAttr,grade,intAttr,stringAttr,timestampAttr}';
const getManyDerivedAggregationAssociationMask = () =>
'{booleanAttr,dateAttr,doubleAttr,emailAttr,intAttr,stringAttr,timestampAttr}';
'{booleanAttr,dateAttr,doubleAttr,emailAttr,grade,intAttr,stringAttr,timestampAttr}';
const getManyDerivedAggregationCompositionMask = () =>
'{booleanAttr,dateAttr,doubleAttr,emailAttr,intAttr,stringAttr,timestampAttr}';
'{booleanAttr,dateAttr,doubleAttr,emailAttr,grade,intAttr,stringAttr,timestampAttr}';

// Private actions
const submit = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ public static String getCellEditType(Column column) {
if (dataType instanceof DateType || dataType instanceof TimestampType) {
return "date";
} else if (dataType instanceof EnumerationType) {
return "text";
return "singleSelect";
} else if (dataType instanceof BooleanType) {
if (!column.getAttributeType().isIsRequired()) {
return "optionalBoolean";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
GridEditDateCell,
GridEditInputCell,
GridEditBooleanCell,
GridEditSingleSelectCell,
type GridRenderEditCellParams,
} from '@mui/x-data-grid{{ getMUIDataGridPlanSuffix }}';
import { AdapterDateFns } from '@mui/x-date-pickers{{ getMUIPickersPlanSuffix }}/AdapterDateFns';
Expand All @@ -25,7 +26,7 @@ const StyledTooltip = styled(({ className, ...props }: TooltipProps) => (
},
}));

export type CellEditorType = 'text' | 'boolean' | 'optionalBoolean' | 'date';
export type CellEditorType = 'text' | 'boolean' | 'optionalBoolean' | 'date' | 'singleSelect';

export function BooleanSelectEditInputCell(props: GridRenderEditCellParams<any>) {
const { id, value, field, api, error } = props;
Expand Down Expand Up @@ -77,12 +78,16 @@ export function CellEditInput(props: GridRenderEditCellParams & { error?: string
EditComponent = GridEditBooleanCell;
} else if (cellEditorType === 'optionalBoolean') {
EditComponent = BooleanSelectEditInputCell;
} else if (cellEditorType === 'singleSelect') {
EditComponent = GridEditSingleSelectCell;
}

return (
<LocalizationProvider dateAdapter={AdapterDateFns} adapterLocale={locales[locale]}>
<StyledTooltip open={!!error} title={error}>
<EditComponent {...otherProps} error={error !== null && error !== undefined} />
<div style={ { display: 'flex', width: '100%' } }>
<EditComponent {...otherProps} error={error !== null && error !== undefined} />
</div>
</StyledTooltip>
</LocalizationProvider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ valueFormatter: (value?: string) => {
return t(`enumerations.{{ restParamName column.attributeType.dataType }}.${value}`, { defaultValue: value });
}
},
valueOptions: [
{{# each column.attributeType.dataType.members as |member| }}
{ value: '{{ member.name }}', label: t('enumerations.{{ restParamName column.attributeType.dataType }}.{{ member.name }}', { defaultValue: '{{ member.name }}' }) },
{{/ each }}
],
{{# if isUseInlineColumnFilters }}
filterOperators: singleSelectColumnOperators,
valueOptions: [
{{# each column.attributeType.dataType.members as |member| }}
{ value: '{{ member.name }}', label: t('enumerations.{{ restParamName column.attributeType.dataType }}.{{ member.name }}', { defaultValue: '{{ member.name }}' }) as string },
{{/ each }}
],
{{/ if }}
{{/ if }}
{{# if (isColumnTimestamp column) }}
Expand Down

0 comments on commit 6c3366d

Please sign in to comment.