From 391bdf4951fabff97907f0a75a69ed6e71c84079 Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Sat, 21 Dec 2024 00:21:24 +0100 Subject: [PATCH] JNG-6010 enum column inline selector --- .../index.tsx.snapshot | 2 +- .../Earth/AccessViewPage/index.tsx.snapshot | 2 +- .../RelationViewPage/index.tsx.snapshot | 2 +- .../model/ActionGroupTest-ui.model | 61 ++-- .../model/ActionGroupTestPro-ui.model | 61 ++-- .../model/CRUDActionsTest-ui.model | 228 +++++++------- .../model/OperationParametersTest-ui.model | 296 +++++++++--------- .../RelationTest/model/RelationTest-ui.model | 112 +++++-- .../AccessViewPage/index.tsx.snapshot | 12 +- .../ui/generator/react/UiWidgetHelper.java | 2 +- .../src/components/table/table-editor.tsx.hbs | 9 +- .../fragments/relation/column.fragment.hbs | 10 +- 12 files changed, 426 insertions(+), 371 deletions(-) diff --git a/judo-ui-react-itest/ActionGroupTest/action_group_test__god/src/test/resources/snapshots/frontend-react/src/containers/View/Matter/Table/components/ViewMatterTableTableComponent/index.tsx.snapshot b/judo-ui-react-itest/ActionGroupTest/action_group_test__god/src/test/resources/snapshots/frontend-react/src/containers/View/Matter/Table/components/ViewMatterTableTableComponent/index.tsx.snapshot index 0a751e05..9fcef64e 100644 --- a/judo-ui-react-itest/ActionGroupTest/action_group_test__god/src/test/resources/snapshots/frontend-react/src/containers/View/Matter/Table/components/ViewMatterTableTableComponent/index.tsx.snapshot +++ b/judo-ui-react-itest/ActionGroupTest/action_group_test__god/src/test/resources/snapshots/frontend-react/src/containers/View/Matter/Table/components/ViewMatterTableTableComponent/index.tsx.snapshot @@ -155,7 +155,7 @@ export function ViewMatterTableTableComponent(props: ViewMatterTableTableCompone const errors = rowValidation.current.get(props.row.__identifier); error = errors?.get('type'); } - return ; + return ; }, filterable: false && true, valueFormatter: (value?: string) => { diff --git a/judo-ui-react-itest/ActionGroupTest/action_group_test__god/src/test/resources/snapshots/frontend-react/src/pages/God/God/Earth/AccessViewPage/index.tsx.snapshot b/judo-ui-react-itest/ActionGroupTest/action_group_test__god/src/test/resources/snapshots/frontend-react/src/pages/God/God/Earth/AccessViewPage/index.tsx.snapshot index 6ce0b569..551eeefc 100644 --- a/judo-ui-react-itest/ActionGroupTest/action_group_test__god/src/test/resources/snapshots/frontend-react/src/pages/God/God/Earth/AccessViewPage/index.tsx.snapshot +++ b/judo-ui-react-itest/ActionGroupTest/action_group_test__god/src/test/resources/snapshots/frontend-react/src/pages/God/God/Earth/AccessViewPage/index.tsx.snapshot @@ -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!, diff --git a/judo-ui-react-itest/ActionGroupTest/action_group_test__god/src/test/resources/snapshots/frontend-react/src/pages/View/Star/Planets/RelationViewPage/index.tsx.snapshot b/judo-ui-react-itest/ActionGroupTest/action_group_test__god/src/test/resources/snapshots/frontend-react/src/pages/View/Star/Planets/RelationViewPage/index.tsx.snapshot index 2edb09aa..a1577374 100644 --- a/judo-ui-react-itest/ActionGroupTest/action_group_test__god/src/test/resources/snapshots/frontend-react/src/pages/View/Star/Planets/RelationViewPage/index.tsx.snapshot +++ b/judo-ui-react-itest/ActionGroupTest/action_group_test__god/src/test/resources/snapshots/frontend-react/src/pages/View/Star/Planets/RelationViewPage/index.tsx.snapshot @@ -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!, diff --git a/judo-ui-react-itest/ActionGroupTest/model/ActionGroupTest-ui.model b/judo-ui-react-itest/ActionGroupTest/model/ActionGroupTest-ui.model index 224e0da8..b0c7a726 100644 --- a/judo-ui-react-itest/ActionGroupTest/model/ActionGroupTest-ui.model +++ b/judo-ui-react-itest/ActionGroupTest/model/ActionGroupTest-ui.model @@ -1066,8 +1066,8 @@ - - + + @@ -2828,6 +2828,10 @@ + + + + @@ -2904,10 +2908,6 @@ - - - - @@ -2990,6 +2990,10 @@ + + + + @@ -3066,10 +3070,6 @@ - - - - @@ -3728,7 +3728,7 @@ - + @@ -3788,7 +3788,6 @@ - @@ -5046,18 +5045,18 @@ - - - - - - + + + + + + @@ -5319,6 +5318,12 @@ + + + + + + @@ -5360,12 +5365,6 @@ - - - - - - @@ -6153,18 +6152,18 @@ - - - - - - + + + + + + @@ -6645,7 +6644,7 @@ - + diff --git a/judo-ui-react-itest/ActionGroupTestPro/model/ActionGroupTestPro-ui.model b/judo-ui-react-itest/ActionGroupTestPro/model/ActionGroupTestPro-ui.model index 224e0da8..b0c7a726 100644 --- a/judo-ui-react-itest/ActionGroupTestPro/model/ActionGroupTestPro-ui.model +++ b/judo-ui-react-itest/ActionGroupTestPro/model/ActionGroupTestPro-ui.model @@ -1066,8 +1066,8 @@ - - + + @@ -2828,6 +2828,10 @@ + + + + @@ -2904,10 +2908,6 @@ - - - - @@ -2990,6 +2990,10 @@ + + + + @@ -3066,10 +3070,6 @@ - - - - @@ -3728,7 +3728,7 @@ - + @@ -3788,7 +3788,6 @@ - @@ -5046,18 +5045,18 @@ - - - - - - + + + + + + @@ -5319,6 +5318,12 @@ + + + + + + @@ -5360,12 +5365,6 @@ - - - - - - @@ -6153,18 +6152,18 @@ - - - - - - + + + + + + @@ -6645,7 +6644,7 @@ - + diff --git a/judo-ui-react-itest/CRUDActionsTest/model/CRUDActionsTest-ui.model b/judo-ui-react-itest/CRUDActionsTest/model/CRUDActionsTest-ui.model index 3e5ebe28..78eadeb8 100644 --- a/judo-ui-react-itest/CRUDActionsTest/model/CRUDActionsTest-ui.model +++ b/judo-ui-react-itest/CRUDActionsTest/model/CRUDActionsTest-ui.model @@ -977,6 +977,14 @@ + + + + + + + + @@ -1028,14 +1036,6 @@ - - - - - - - - @@ -1184,6 +1184,11 @@ + + + + + @@ -1201,14 +1206,14 @@ - - - - - + + + + + @@ -1234,14 +1239,14 @@ - - - - - + + + + + @@ -1271,11 +1276,6 @@ - - - - - @@ -1344,6 +1344,11 @@ + + + + + @@ -1361,14 +1366,14 @@ - - - - - + + + + + @@ -1394,14 +1399,14 @@ - - - - - + + + + + @@ -1431,11 +1436,6 @@ - - - - - @@ -3172,6 +3172,14 @@ + + + + + + + + @@ -3223,14 +3231,6 @@ - - - - - - - - @@ -3379,6 +3379,11 @@ + + + + + @@ -3396,14 +3401,14 @@ - - - - - + + + + + @@ -3429,14 +3434,14 @@ - - - - - + + + + + @@ -3466,11 +3471,6 @@ - - - - - @@ -3539,6 +3539,11 @@ + + + + + @@ -3556,14 +3561,14 @@ - - - - - + + + + + @@ -3589,14 +3594,14 @@ - - - - - + + + + + @@ -3626,11 +3631,6 @@ - - - - - @@ -5358,6 +5358,14 @@ + + + + + + + + @@ -5409,14 +5417,6 @@ - - - - - - - - @@ -5565,6 +5565,11 @@ + + + + + @@ -5582,14 +5587,14 @@ - - - - - + + + + + @@ -5615,14 +5620,14 @@ - - - - - + + + + + @@ -5652,11 +5657,6 @@ - - - - - @@ -5725,6 +5725,11 @@ + + + + + @@ -5742,14 +5747,14 @@ - - - - - + + + + + @@ -5775,14 +5780,14 @@ - - - - - + + + + + @@ -5812,11 +5817,6 @@ - - - - - diff --git a/judo-ui-react-itest/OperationParametersTest/model/OperationParametersTest-ui.model b/judo-ui-react-itest/OperationParametersTest/model/OperationParametersTest-ui.model index 9ae86dd6..7196c531 100644 --- a/judo-ui-react-itest/OperationParametersTest/model/OperationParametersTest-ui.model +++ b/judo-ui-react-itest/OperationParametersTest/model/OperationParametersTest-ui.model @@ -1154,6 +1154,14 @@ + + + + + + + + @@ -1183,14 +1191,6 @@ - - - - - - - - @@ -1294,6 +1294,17 @@ + + + + + + + + + + + @@ -1306,17 +1317,6 @@ - - - - - - - - - - - @@ -1517,6 +1517,7 @@ + @@ -1540,7 +1541,6 @@ - @@ -1984,24 +1984,24 @@ - - - + + - - + + + @@ -2426,6 +2426,11 @@ + + + + + @@ -2438,7 +2443,6 @@ - @@ -2462,7 +2466,6 @@ - @@ -2483,7 +2486,6 @@ - @@ -2504,7 +2506,6 @@ - @@ -2542,7 +2543,6 @@ - @@ -2949,6 +2949,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -2984,29 +3007,6 @@ - - - - - - - - - - - - - - - - - - - - - - - @@ -3062,6 +3062,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3085,7 +3115,6 @@ - @@ -3109,7 +3138,6 @@ - @@ -3133,13 +3161,6 @@ - - - - - - - @@ -3156,7 +3177,6 @@ - @@ -3192,13 +3212,6 @@ - - - - - - - @@ -3219,7 +3232,6 @@ - @@ -3261,18 +3273,6 @@ - - - - - - - - - - - - @@ -3578,6 +3578,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3598,13 +3628,6 @@ - - - - - - - @@ -3646,18 +3669,6 @@ - - - - - - - - - - - - @@ -3670,7 +3681,6 @@ - @@ -3687,7 +3697,6 @@ - @@ -3723,13 +3732,6 @@ - - - - - - - @@ -3753,7 +3755,6 @@ - @@ -3777,7 +3778,6 @@ - @@ -3984,6 +3984,9 @@ + + + @@ -4007,7 +4010,6 @@ - @@ -4020,7 +4022,6 @@ - @@ -4056,7 +4057,6 @@ - @@ -4268,6 +4268,10 @@ + + + + @@ -4290,7 +4294,6 @@ - @@ -4307,7 +4310,6 @@ - @@ -4320,7 +4322,6 @@ - @@ -4356,7 +4357,6 @@ - @@ -4629,30 +4629,30 @@ - - - + + + - - - + + + @@ -5039,6 +5039,10 @@ + + + + @@ -5062,8 +5066,6 @@ - - @@ -5076,8 +5078,6 @@ - - @@ -5232,6 +5232,24 @@ + + + + + + + + + + + + + + + + + + @@ -5250,17 +5268,6 @@ - - - - - - - - - - - @@ -5273,7 +5280,6 @@ - @@ -5297,12 +5303,6 @@ - - - - - - diff --git a/judo-ui-react-itest/RelationTest/model/RelationTest-ui.model b/judo-ui-react-itest/RelationTest/model/RelationTest-ui.model index f0da5e60..28ba2033 100644 --- a/judo-ui-react-itest/RelationTest/model/RelationTest-ui.model +++ b/judo-ui-react-itest/RelationTest/model/RelationTest-ui.model @@ -410,15 +410,26 @@ + + + + + + + + + + + @@ -968,7 +979,12 @@ LIST + CREATE + VALIDATE_CREATE REFRESH + UPDATE + VALIDATE_UPDATE + DELETE @@ -1307,6 +1323,7 @@ + @@ -1344,16 +1361,21 @@ + + + + + + + + + - - - - @@ -1369,6 +1391,7 @@ + @@ -1376,6 +1399,7 @@ + @@ -1430,6 +1454,7 @@ + @@ -1437,6 +1462,7 @@ + @@ -1502,6 +1528,7 @@ + @@ -1509,6 +1536,7 @@ + @@ -1618,6 +1646,7 @@ + @@ -1625,6 +1654,7 @@ + @@ -1679,6 +1709,7 @@ + @@ -1686,6 +1717,7 @@ + @@ -1720,6 +1752,7 @@ + @@ -1727,6 +1760,7 @@ + @@ -1777,6 +1811,7 @@ + @@ -1784,6 +1819,7 @@ + @@ -1844,6 +1880,7 @@ + @@ -1851,6 +1888,7 @@ + @@ -3089,13 +3127,27 @@ - - - + + + + + + + + + + + + + + + + + @@ -3145,10 +3197,6 @@ - - - - @@ -3194,11 +3242,6 @@ - - - - - @@ -3227,11 +3270,6 @@ - - - - - @@ -3416,6 +3454,10 @@ + + + + @@ -3465,10 +3507,6 @@ - - - - @@ -3572,6 +3610,11 @@ + + + + + @@ -3600,11 +3643,6 @@ - - - - - @@ -4417,6 +4455,12 @@ + + + + + + @@ -4440,6 +4484,7 @@ + @@ -4447,6 +4492,7 @@ + @@ -4532,6 +4578,12 @@ + + + + + + diff --git a/judo-ui-react-itest/RelationTest/relation_test__actor/src/test/resources/snapshots/frontend-react/src/pages/Actor/InlineEditTransfer/AccessViewPage/index.tsx.snapshot b/judo-ui-react-itest/RelationTest/relation_test__actor/src/test/resources/snapshots/frontend-react/src/pages/Actor/InlineEditTransfer/AccessViewPage/index.tsx.snapshot index 8284a859..f2c1c840 100644 --- a/judo-ui-react-itest/RelationTest/relation_test__actor/src/test/resources/snapshots/frontend-react/src/pages/Actor/InlineEditTransfer/AccessViewPage/index.tsx.snapshot +++ b/judo-ui-react-itest/RelationTest/relation_test__actor/src/test/resources/snapshots/frontend-react/src/pages/Actor/InlineEditTransfer/AccessViewPage/index.tsx.snapshot @@ -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 () => { diff --git a/judo-ui-react/src/main/java/hu/blackbelt/judo/ui/generator/react/UiWidgetHelper.java b/judo-ui-react/src/main/java/hu/blackbelt/judo/ui/generator/react/UiWidgetHelper.java index cc32d982..11524b53 100644 --- a/judo-ui-react/src/main/java/hu/blackbelt/judo/ui/generator/react/UiWidgetHelper.java +++ b/judo-ui-react/src/main/java/hu/blackbelt/judo/ui/generator/react/UiWidgetHelper.java @@ -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"; diff --git a/judo-ui-react/src/main/resources/actor/src/components/table/table-editor.tsx.hbs b/judo-ui-react/src/main/resources/actor/src/components/table/table-editor.tsx.hbs index 0511a96b..add68dee 100644 --- a/judo-ui-react/src/main/resources/actor/src/components/table/table-editor.tsx.hbs +++ b/judo-ui-react/src/main/resources/actor/src/components/table/table-editor.tsx.hbs @@ -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'; @@ -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) { const { id, value, field, api, error } = props; @@ -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 ( - +
+ +
); diff --git a/judo-ui-react/src/main/resources/actor/src/fragments/relation/column.fragment.hbs b/judo-ui-react/src/main/resources/actor/src/fragments/relation/column.fragment.hbs index 8e30fb48..1e09721b 100644 --- a/judo-ui-react/src/main/resources/actor/src/fragments/relation/column.fragment.hbs +++ b/judo-ui-react/src/main/resources/actor/src/fragments/relation/column.fragment.hbs @@ -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) }}