= (
label: action.label,
startIcon: action.icon,
onClick: () => action.action!(params.row),
- disabled: action.disabled ? action.disabled(params.row, isLoading, getSelectedRows, ownerdata) : false,
+ disabled: action.disabled ? action.disabled(params.row, isLoading, getSelectedRows, ownerData) : false,
}))}
>
diff --git a/judo-ui-react/src/main/resources/actor/src/components/widgets/Tags.tsx.hbs b/judo-ui-react/src/main/resources/actor/src/components/widgets/Tags.tsx.hbs
index 6cfd96b3..b3e638be 100644
--- a/judo-ui-react/src/main/resources/actor/src/components/widgets/Tags.tsx.hbs
+++ b/judo-ui-react/src/main/resources/actor/src/components/widgets/Tags.tsx.hbs
@@ -12,7 +12,7 @@ import { MdiIcon } from '~/components/MdiIcon';
import { debounce } from '@mui/material/utils';
import { debounceInputs } from '~/config/general';
import { QueryCustomizer } from '~/services/data-api/common/QueryCustomizer';
-import { FilterBytypesString } from '~/services/data-api/rest/FilterBytypesString';
+import { FilterByTypesString } from '~/services/data-api/rest/FilterByTypesString';
import { StringOperation } from '~/services/data-api/model/StringOperation';
export interface TagsProps {
@@ -78,7 +78,7 @@ export function Tags
(props: TagsProps
) {
const handleSearch = async (searchText: string) => {
try {
setLoading(true);
- const filter: FilterBytypesString[] = (ownerData[name] as T[] ?? []).map((c: any) => ({
+ const filter: FilterByTypesString[] = (ownerData[name] as T[] ?? []).map((c: any) => ({
value: c[autoCompleteAttribute]!,
operator: StringOperation.notEqual,
}));
diff --git a/judo-ui-react/src/main/resources/actor/src/containers/components/link/index.tsx.hbs b/judo-ui-react/src/main/resources/actor/src/containers/components/link/index.tsx.hbs
index 21638fee..129fe5fe 100644
--- a/judo-ui-react/src/main/resources/actor/src/containers/components/link/index.tsx.hbs
+++ b/judo-ui-react/src/main/resources/actor/src/containers/components/link/index.tsx.hbs
@@ -6,16 +6,23 @@ import { exists, processQueryCustomizer } from '~/utilities';
import { MdiIcon } from '~/components';
import { SingleRelationInput } from '~/components/widgets';
import { StringOperation } from '~/services/data-api/model/StringOperation';
-import type {
- {{ getLinkAPIImports link container }}
-} from '~/services/data-api';
+{{# each (getLinkAPIImports link container) as |imp| }}
+ import type {
+ {{ imp }},
+ {{ imp }}Stored,
+ } from '~/services/data-api/model/{{ imp }}';
+ import type {
+ {{ imp }}QueryCustomizer,
+ } from '~/services/data-api/rest/{{ imp }}QueryCustomizer';
+{{/ each }}
+import type { JudoRestResponse } from '~/services/data-api/rest/requestResponse';
import { SingleRelationInputButtonProps } from '~/utilities/application/interfaces';
import type { {{ componentName link }}ActionDefinitions, {{ componentName link }}Props } from './types';
// XMIID: {{ getXMIID link }}
// Name: {{ link.name }}
export function {{ componentName link }}(props: {{ componentName link }}Props) {
- const { ownerData, actions, storeDiff, submit, validationError, disabled, readOnly, editMode, isLoading, isDraft{{# unless link.isEager }}, refreshCounter{{/ unless }} } = props;
+ const { ownerData, actions, dataPath, storeDiff, submit, validationError, disabled, readOnly, editMode, isLoading, isDraft{{# unless link.isEager }}, refreshCounter{{/ unless }} } = props;
const { t } = useTranslation();
const isRequired = useMemo(() => {
diff --git a/judo-ui-react/src/main/resources/actor/src/containers/components/link/types.ts.hbs b/judo-ui-react/src/main/resources/actor/src/containers/components/link/types.ts.hbs
index a4a9870b..56a97e31 100644
--- a/judo-ui-react/src/main/resources/actor/src/containers/components/link/types.ts.hbs
+++ b/judo-ui-react/src/main/resources/actor/src/containers/components/link/types.ts.hbs
@@ -1,6 +1,13 @@
-import type {
- {{ getLinkAPIImports link container }}
-} from '~/services/data-api';
+{{# each (getLinkAPIImports link container) as |imp| }}
+ import type {
+ {{ imp }},
+ {{ imp }}Stored,
+ } from '~/services/data-api/model/{{ imp }}';
+ import type {
+ {{ imp }}QueryCustomizer,
+ } from '~/services/data-api/rest/{{ imp }}QueryCustomizer';
+{{/ each }}
+import type { JudoRestResponse } from '~/services/data-api/rest/requestResponse';
export interface {{ componentName link }}ActionDefinitions {
{{# each link.actionDefinitions as |actionDefinition| }}
@@ -16,6 +23,7 @@ export interface {{ componentName link }}ActionDefinitions {
export interface {{ componentName link }}Props {
ownerData: {{ classDataName container.dataElement '' }} | {{ classDataName container.dataElement 'Stored' }};
+ dataPath?: string;
actions: {{ componentName link }}ActionDefinitions;
storeDiff: (attributeName: keyof {{ classDataName container.dataElement '' }}, value: any) => void;
submit: () => Promise;
diff --git a/judo-ui-react/src/main/resources/actor/src/containers/components/table/index.tsx.hbs b/judo-ui-react/src/main/resources/actor/src/containers/components/table/index.tsx.hbs
index 7eee86e2..0b0ecfd4 100644
--- a/judo-ui-react/src/main/resources/actor/src/containers/components/table/index.tsx.hbs
+++ b/judo-ui-react/src/main/resources/actor/src/containers/components/table/index.tsx.hbs
@@ -47,9 +47,15 @@ import type { ContextMenuApi } from '~/components/table/ContextMenu';
import type { Filter, FilterOption } from '~/components-api';
import { FilterType } from '~/components-api';
import { CUSTOM_VISUAL_ELEMENT_INTERFACE_KEY } from '~/custom';
-import type {
- {{ getTableAPIImports table container }}
-} from '~/services/data-api';
+{{# each (getTableAPIImports table container) as |imp| }}
+ import type {
+ {{ imp }},
+ {{ imp }}Stored,
+ } from '~/services/data-api/model/{{ imp }}';
+ import type {
+ {{ imp }}QueryCustomizer,
+ } from '~/services/data-api/rest/{{ imp }}QueryCustomizer';
+{{/ each }}
{{# or (tableHasNumericColumn table) (tableHasDateColumn table) (tableHasDateTimeColumn table) }}
import { useL10N } from '~/l10n/l10n-context';
{{/ or }}
@@ -67,24 +73,19 @@ import {
{{# if (tableHasBinaryColumn table) }}
fileHandling,
{{/ if }}
- {{# or (tableHasDateTimeColumn table) (tableHasDateColumn table) }}
- serviceDateToUiDate,
- {{/ or }}
- {{# if (tableHasTimeColumn table) }}
- serviceTimeToUiTime,
- {{/ if }}
{{# if isUseInlineColumnFilters }}
mapFilterModelToFilters,
mapFilterToFilterModel,
{{/ if }}
mapAllFiltersToQueryCustomizerProperties,
processQueryCustomizer,
+ serializeFilters,
+ deserializeFilters,
{{# unless table.isEager }}
useErrorHandler,
{{/ unless }}
} from '~/utilities';
-import type { SidekickComponentProps, DialogResult, TableRowAction, ToolBarActionProps, ColumnCustomizerHook{{# if isMUILicensePlanPro }}, PersistedColumnInfo{{/ if }} } from '~/utilities';
-import { useDataStore } from '~/hooks';
+import type { SidekickComponentProps, DialogResult, TableRowAction, ToolBarActionProps, ColumnCustomizerHook, FiltersSerializer{{# if isMUILicensePlanPro }}, PersistedColumnInfo{{/ if }} } from '~/utilities';
import { OBJECTCLASS } from '@pandino/pandino-api';
import { useTrackComponent, ComponentProxy } from '@pandino/react-hooks';
{{# if (stringValueIsTrue useTableRowHighlighting) }}
@@ -94,15 +95,22 @@ import { TABLE_ROW_HIGHLIGHTING_HOOK_INTERFACE_KEY, transformRowStylings } from
import type { RowStylerConfigured, TableRowHighlightingHook } from '~/theme/table-row-highlighting';
{{/ if }}
import type { {{ componentName table }}ActionDefinitions, {{ componentName table }}Props } from './types';
+import { {{ classDataName (getReferenceClassType table) 'StoredSerializer' }} } from '~/services/data-api/rest/{{ classDataName (getReferenceClassType table) 'Serializer' }}';
export const {{ camelCaseNameToInterfaceKey (componentName table) }}_SIDEKICK_COMPONENT_INTERFACE_KEY = '{{ componentName table }}SidekickComponent';
+export const filtersSerializer: FiltersSerializer = {
+ serialize: (filters: Filter[]) => serializeFilters<{{ classDataName (getReferenceClassType table) 'Stored' }}>(filters, {{ classDataName (getReferenceClassType table) 'StoredSerializer' }}.getInstance()),
+ deserialize: (filters: Filter[]) => deserializeFilters<{{ classDataName (getReferenceClassType table) 'Stored' }}>(filters, {{ classDataName (getReferenceClassType table) 'StoredSerializer' }}.getInstance()),
+};
+
// XMIID: {{ getXMIID table }}
// Name: {{ table.name }}
export function {{ componentName table }}(props: {{ componentName table }}Props) {
const {
uniqueId,
actions,
+ dataPath,
refreshCounter,
isOwnerLoading,
isDraft,
@@ -123,7 +131,6 @@ export function {{ componentName table }}(props: {{ componentName table }}Props)
const sidekickComponentFilter = `(&(${OBJECTCLASS}=${CUSTOM_VISUAL_ELEMENT_INTERFACE_KEY})(component=${ {{ camelCaseNameToInterfaceKey (componentName table) }}_SIDEKICK_COMPONENT_INTERFACE_KEY }))`;
const { openConfirmDialog } = useConfirmDialog();
- const { getItemParsed, getItemParsedWithDefault, setItemStringified } = useDataStore('sessionStorage');
const { t } = useTranslation();
{{# unless table.isEager }}
const handleError = useErrorHandler();
@@ -270,6 +277,7 @@ export function {{ componentName table }}(props: {{ componentName table }}Props)
enabledByName='{{ table.enabledBy.name }}'
dataElement={ ownerData?.{{ table.dataElement.name }} }
relationName='{{ table.relationName }}'
+ filtersSerializer={filtersSerializer}
{{# if container.isSelector }}
selectionDiff={selectionDiff}
setSelectionDiff={setSelectionDiff}
@@ -306,6 +314,7 @@ export function {{ componentName table }}(props: {{ componentName table }}Props)
{{/ if }}
{{# if container.isRelationSelector }}
containerIsRelationSelector={ true }
+ alreadySelected={alreadySelected}
{{/ if }}
{{# if table.showTotalCount }}
showTotalCount={ true }
@@ -345,6 +354,7 @@ export function {{ componentName table }}(props: {{ componentName table }}Props)
{{/ unless }}
enabledByName='{{ table.enabledBy.name }}'
relationName='{{ table.relationName }}'
+ filtersSerializer={filtersSerializer}
{{# if container.isSelector }}
selectionDiff={selectionDiff}
setSelectionDiff={setSelectionDiff}
diff --git a/judo-ui-react/src/main/resources/actor/src/containers/components/table/types.ts.hbs b/judo-ui-react/src/main/resources/actor/src/containers/components/table/types.ts.hbs
index 0192c9e2..e9d8332d 100644
--- a/judo-ui-react/src/main/resources/actor/src/containers/components/table/types.ts.hbs
+++ b/judo-ui-react/src/main/resources/actor/src/containers/components/table/types.ts.hbs
@@ -2,9 +2,15 @@ import type { ElementType, Dispatch, SetStateAction } from 'react';
import type {
GridFilterModel,
} from '@mui/x-data-grid{{ getMUIDataGridPlanSuffix }}';
-import type {
- {{ getTableAPIImports table container }}
-} from '~/services/data-api';
+{{# each (getTableAPIImports table container) as |imp| }}
+ import type {
+ {{ imp }},
+ {{ imp }}Stored,
+ } from '~/services/data-api/model/{{ imp }}';
+ import type {
+ {{ imp }}QueryCustomizer,
+ } from '~/services/data-api/rest/{{ imp }}QueryCustomizer';
+{{/ each }}
import type { JudoRestResponse } from '~/services/data-api/rest/requestResponse';
import type { Filter, FilterOption } from '~/components-api';
import type { DialogResult } from '~/utilities';
@@ -55,6 +61,7 @@ export interface {{ componentName table }}ActionDefinitions {
export interface {{ componentName table }}Props {
uniqueId: string;
actions: {{ componentName table }}ActionDefinitions;
+ dataPath?: string;
refreshCounter: number;
isOwnerLoading?: boolean;
isDraft?: boolean;
diff --git a/judo-ui-react/src/main/resources/actor/src/containers/container.tsx.hbs b/judo-ui-react/src/main/resources/actor/src/containers/container.tsx.hbs
index 9df29fa5..2568778e 100644
--- a/judo-ui-react/src/main/resources/actor/src/containers/container.tsx.hbs
+++ b/judo-ui-react/src/main/resources/actor/src/containers/container.tsx.hbs
@@ -40,7 +40,7 @@ import type { {{# unless (containerIsEmptyDashboard container) }}{{ pageContaine
export default function {{ containerComponentName container }}(props: {{ containerComponentName container }}Props) {
{{# unless (containerIsEmptyDashboard container) }}
// Container props
- const { refreshCounter, isLoading, isDraft, actions: pageActions{{# if container.isSelector }}, selectionDiff, setSelectionDiff{{/ if }}{{# if container.isRelationSelector }}, alreadySelected{{/ if }}{{# unless container.table }}, data, isFormUpdateable, isFormDeleteable, storeDiff, editMode, validation, setValidation, submit{{/ unless }} } = props;
+ const { refreshCounter, isLoading, isDraft, dataPath, actions: pageActions{{# if container.isSelector }}, selectionDiff, setSelectionDiff{{/ if }}{{# if container.isRelationSelector }}, alreadySelected{{/ if }}{{# unless container.table }}, data, isFormUpdateable, isFormDeleteable, storeDiff, editMode, validation, setValidation, submit{{/ unless }} } = props;
// Container hooks
const { t } = useTranslation();
diff --git a/judo-ui-react/src/main/resources/actor/src/containers/dialog.tsx.hbs b/judo-ui-react/src/main/resources/actor/src/containers/dialog.tsx.hbs
index cd3788dd..4bcda2fc 100644
--- a/judo-ui-react/src/main/resources/actor/src/containers/dialog.tsx.hbs
+++ b/judo-ui-react/src/main/resources/actor/src/containers/dialog.tsx.hbs
@@ -28,8 +28,11 @@ import { useConfirmDialog } from '~/components/dialog';
import type {
{{ classDataName container.dataElement '' }},
{{ classDataName container.dataElement 'Stored' }},
- {{ classDataName container.dataElement 'QueryCustomizer' }}
- } from '~/services/data-api';
+ } from '~/services/data-api/model/{{ classDataName container.dataElement '' }}';
+ import type {
+ {{ classDataName container.dataElement 'QueryCustomizer' }},
+ } from '~/services/data-api/rest/{{ classDataName container.dataElement 'QueryCustomizer' }}';
+
import type {
{{ containerComponentName container }}ActionDefinitions,
{{ containerComponentName container }}DialogActions,
@@ -57,6 +60,7 @@ export default function {{ containerComponentName container }}Dialog({{# unless
onClose
{{# unless (containerIsEmptyDashboard container) }},
actions,
+ dataPath,
isLoading,
editMode,
refreshCounter,
@@ -119,6 +123,7 @@ export default function {{ containerComponentName container }}Dialog({{# unless
<{{ containerComponentName container }}
actions={actions}
+ dataPath={dataPath}
refreshCounter={refreshCounter}
isLoading={isLoading}
{{# if container.isSelector }}
diff --git a/judo-ui-react/src/main/resources/actor/src/containers/page.tsx.hbs b/judo-ui-react/src/main/resources/actor/src/containers/page.tsx.hbs
index 130c7741..4a5f270f 100644
--- a/judo-ui-react/src/main/resources/actor/src/containers/page.tsx.hbs
+++ b/judo-ui-react/src/main/resources/actor/src/containers/page.tsx.hbs
@@ -17,8 +17,11 @@ import { mainContainerPadding } from '~/theme';
import type {
{{ classDataName container.dataElement '' }},
{{ classDataName container.dataElement 'Stored' }},
- {{ classDataName container.dataElement 'QueryCustomizer' }}
- } from '~/services/data-api';
+ } from '~/services/data-api/model/{{ classDataName container.dataElement '' }}';
+ import type {
+ {{ classDataName container.dataElement 'QueryCustomizer' }},
+ } from '~/services/data-api/rest/{{ classDataName container.dataElement 'QueryCustomizer' }}';
+
import type {
{{ containerComponentName container }}ActionDefinitions,
{{ containerComponentName container }}PageActions,
@@ -37,7 +40,7 @@ export default function {{ containerComponentName container }}Page ({{# unless (
{{# unless (containerIsEmptyDashboard container) }}
const { t } = useTranslation();
const { navigate, back } = useJudoNavigation();
- const { actions, isLoading, editMode, refreshCounter{{# unless container.table }}, data, isFormUpdateable, isFormDeleteable, storeDiff, validation, setValidation, submit{{/ unless }} } = props;
+ const { actions, dataPath, isLoading, editMode, refreshCounter{{# unless container.table }}, data, isFormUpdateable, isFormDeleteable, storeDiff, validation, setValidation, submit{{/ unless }} } = props;
const isDraft = false; // currently no page can be opened as draft, but we need this variable anyway
{{# if container.view }}
const queryCustomizer: {{ classDataName container.dataElement 'QueryCustomizer' }} = {
@@ -88,6 +91,7 @@ export default function {{ containerComponentName container }}Page ({{# unless (
<{{ containerComponentName container }}
actions={actions}
+ dataPath={dataPath}
refreshCounter={refreshCounter}
{{# unless (containerIsEmptyDashboard container) }}
isLoading={isLoading}
diff --git a/judo-ui-react/src/main/resources/actor/src/containers/types.ts.hbs b/judo-ui-react/src/main/resources/actor/src/containers/types.ts.hbs
index cf2fbf6f..595a62c5 100644
--- a/judo-ui-react/src/main/resources/actor/src/containers/types.ts.hbs
+++ b/judo-ui-react/src/main/resources/actor/src/containers/types.ts.hbs
@@ -64,6 +64,7 @@
isLoading: boolean;
editMode: boolean;
refreshCounter: number;
+ dataPath?: string;
{{# unless container.table }}
data: {{ classDataName container.dataElement 'Stored' }};
isFormUpdateable: () => boolean;
@@ -87,6 +88,7 @@
onClose: () => Promise;
{{# unless (containerIsEmptyDashboard container) }}
actions: {{ containerComponentName container }}DialogActions;
+ dataPath?: string;
isLoading: boolean;
editMode: boolean;
refreshCounter: number;
@@ -126,6 +128,7 @@ export interface {{ containerComponentName container }}Props {
refreshCounter: number;
isLoading: boolean;
actions: {{ pageContainerActionDefinitionTypeName container }};
+ dataPath?: string;
{{# if container.isSelector }}
selectionDiff: {{ classDataName container.dataElement 'Stored' }}[];
setSelectionDiff: Dispatch>;
diff --git a/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/dateinput.hbs b/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/dateinput.hbs
index 18139606..4b656c8e 100644
--- a/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/dateinput.hbs
+++ b/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/dateinput.hbs
@@ -48,10 +48,10 @@
}) }
views={['year', 'month', 'day']}
label={ t('{{ getTranslationKeyForVisualElement child }}', { defaultValue: '{{ child.label }}' }) as string }
- value={ serviceDateToUiDate(data.{{ child.attributeType.name }} ?? null) }
+ value={ data.{{ child.attributeType.name }} ?? null }
readOnly={ {{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable() }
disabled={actions?.is{{ firstToUpper child.attributeType.name }}Disabled ? actions.is{{ firstToUpper child.attributeType.name }}Disabled(data, editMode, isLoading) : ({{# if child.enabledBy }}!data.{{ child.enabledBy.name }} ||{{/ if }} isLoading)}
- onChange={ (newValue?: any | null) => {
+ onChange={ (newValue?: Date | null) => {
storeDiff('{{ child.attributeType.name }}', newValue);
{{# if child.onBlur }}
if (actions?.on{{ firstToUpper child.attributeType.name }}BlurAction) {
diff --git a/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/datetimeinput.hbs b/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/datetimeinput.hbs
index 6bc418a6..3020d486 100644
--- a/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/datetimeinput.hbs
+++ b/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/datetimeinput.hbs
@@ -50,10 +50,10 @@
} }
views={['year', 'month', 'day', 'hours', 'minutes', 'seconds']}
label={ t('{{ getTranslationKeyForVisualElement child }}', { defaultValue: '{{ child.label }}' }) as string }
- value={ serviceDateToUiDate(data.{{ child.attributeType.name }} ?? null) }
+ value={ data.{{ child.attributeType.name }} ?? null }
readOnly={ {{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable() }
disabled={actions?.is{{ firstToUpper child.attributeType.name }}Disabled ? actions.is{{ firstToUpper child.attributeType.name }}Disabled(data, editMode, isLoading) : ({{# if child.enabledBy }}!data.{{ child.enabledBy.name }} ||{{/ if }} isLoading)}
- onChange={ (newValue: Date) => {
+ onChange={ (newValue: Date | null) => {
storeDiff('{{ child.attributeType.name }}', newValue);
{{# if child.onBlur }}
if (actions?.on{{ firstToUpper child.attributeType.name }}BlurAction) {
diff --git a/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/link.hbs b/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/link.hbs
index 044b8ca9..db954cdf 100644
--- a/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/link.hbs
+++ b/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/link.hbs
@@ -15,9 +15,10 @@
>
{{/ if }}
<{{ componentName child }}
- disabled={ {{# if child.enabledBy }}!data.{{ child.enabledBy.name }} ||{{/ if }} false }
+ disabled={ {{# if child.enabledBy }}!data.{{ child.enabledBy.name }} ||{{/ if }} false || isLoading }
readOnly={ {{ boolValue child.relationType.isReadOnly }} || !isFormUpdateable() }
ownerData={data}
+ dataPath={dataPath ? (dataPath + '.{{ child.dataElement.name }}') : '{{ child.dataElement.name }}'}
editMode={editMode}
isLoading={isLoading}
isDraft={isDraft}
diff --git a/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/table.hbs b/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/table.hbs
index a3461db6..2587a187 100644
--- a/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/table.hbs
+++ b/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/table.hbs
@@ -33,6 +33,7 @@
<{{ componentName child }}
uniqueId={'{{ getXMIID child }}'}
actions={actions}
+ dataPath={dataPath ? (dataPath + '.{{ child.dataElement.name }}') : '{{ child.dataElement.name }}'}
{{# if container.isSelector }}
selectionDiff={selectionDiff}
setSelectionDiff={setSelectionDiff}
diff --git a/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/timeinput.hbs b/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/timeinput.hbs
index 91c6e506..6e02e1c7 100644
--- a/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/timeinput.hbs
+++ b/judo-ui-react/src/main/resources/actor/src/containers/widget-fragments/timeinput.hbs
@@ -50,7 +50,7 @@
}) }
views={['hours', 'minutes', 'seconds']}
label={ t('{{ getTranslationKeyForVisualElement child }}', { defaultValue: '{{ child.label }}' }) as string }
- value={ serviceTimeToUiTime(data.{{ child.attributeType.name }} ?? null) }
+ value={ data.{{ child.attributeType.name }} ?? null }
readOnly={ {{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable() }
disabled={actions?.is{{ firstToUpper child.attributeType.name }}Disabled ? actions.is{{ firstToUpper child.attributeType.name }}Disabled(data, editMode, isLoading) : ({{# if child.enabledBy }}!data.{{ child.enabledBy.name }} ||{{/ if }} isLoading)}
{{# if child.onBlur }}
@@ -60,7 +60,7 @@
}
} }
{{/ if }}
- onChange={ (newValue: string | null | undefined) => {
+ onChange={ (newValue?: Date | null) => {
storeDiff('{{ child.attributeType.name }}', newValue);
} }
/>
diff --git a/judo-ui-react/src/main/resources/actor/src/custom/custom-element-types.ts.hbs b/judo-ui-react/src/main/resources/actor/src/custom/custom-element-types.ts.hbs
index 3b490af5..2499bd97 100644
--- a/judo-ui-react/src/main/resources/actor/src/custom/custom-element-types.ts.hbs
+++ b/judo-ui-react/src/main/resources/actor/src/custom/custom-element-types.ts.hbs
@@ -22,7 +22,7 @@ export interface CustomFormVisualElementProps {
readonly editMode: boolean;
/**
- * State modifier method which implicitly updates the `data` and adds an entry to the `payloadDiff` as well.
+ * State modifier method which implicitly updates the `data` with additional meta attributes.
*
* It is highly recommended to use this method to update the data/state on pages in order to be consistent with the
* framework and reduce erroneous behaviour.
diff --git a/judo-ui-react/src/main/resources/actor/src/dialogs/hooks.tsx.hbs b/judo-ui-react/src/main/resources/actor/src/dialogs/hooks.tsx.hbs
index 92f18bb7..0ab37fef 100644
--- a/judo-ui-react/src/main/resources/actor/src/dialogs/hooks.tsx.hbs
+++ b/judo-ui-react/src/main/resources/actor/src/dialogs/hooks.tsx.hbs
@@ -5,7 +5,20 @@ import type { DialogResult } from '~/utilities';
import type { {{ classDataName imp '' }}, {{ classDataName imp 'Stored' }} } from '~/services/data-api/model/{{ classDataName imp '' }}';
{{/ each }}
-export const use{{ pageName page }} = (): ({{{ getDialogOpenParameters page }}}) => Promise{{/ if }};{{/ unless }}
+ ownerValidation?: (target: any) => Promise;
+ isDraft?: boolean;
+ {{# unless page.container.table}}
+ maskRequest?: string;
+ {{/ unless }}
+ dataPath?: string;
+}
+
+export const use{{ pageName page }} = (): ({ ownerData{{# and (isPageDataElementUnmappedSingle page) page.container.view }}, data{{/ and }}{{# if page.container.isRelationSelector }}, alreadySelected{{/ if }}{{# unless page.container.isSelector }}, templateDataOverride{{/ unless }}, ownerValidation, isDraft{{# unless page.container.table}}, maskRequest{{/ unless }}, dataPath }: {{ pageName page }}HookProps) => Promise import('~/dialogs/{{ pagePath page }}'));
- return ({{{ getDialogOpenParameters page }}}) => new Promise((resolve) => {
+ return ({ ownerData{{# and (isPageDataElementUnmappedSingle page) page.container.view }}, data{{/ and }}{{# if page.container.isRelationSelector }}, alreadySelected{{/ if }}{{# unless page.container.isSelector }}, templateDataOverride{{/ unless }}, ownerValidation, isDraft{{# unless page.container.table}}, maskRequest{{/ unless }}, dataPath }: {{ pageName page }}HookProps) => new Promise((resolve) => {
createDialog({
{{# if page.dialogSize }}
fullWidth: true,
@@ -43,11 +56,10 @@ export const use{{ pageName page }} = (): ({{{ getDialogOpenParameters page }}})
{{/ unless }}
isDraft={isDraft}
{{# unless page.container.table }}
+ maskRequest={maskRequest}
ownerValidation={ownerValidation}
{{/ unless }}
- {{# if page.container.form }}
- maskRequest={maskRequest}
- {{/ if }}
+ dataPath={dataPath}
onClose={async () => {
await closeDialog();
resolve({
diff --git a/judo-ui-react/src/main/resources/actor/src/dialogs/index.tsx.hbs b/judo-ui-react/src/main/resources/actor/src/dialogs/index.tsx.hbs
index 47c41a30..5d2292f7 100644
--- a/judo-ui-react/src/main/resources/actor/src/dialogs/index.tsx.hbs
+++ b/judo-ui-react/src/main/resources/actor/src/dialogs/index.tsx.hbs
@@ -1,11 +1,12 @@
{{> fragment.header.hbs }}
-import { {{# unless page.container.table }}useCallback, useRef, {{/ unless }}useEffect, useState, useMemo, lazy, Suspense } from 'react';
+import { useRef, useCallback, useEffect, useState, useMemo, lazy, Suspense } from 'react';
{{# unless (containerIsEmptyDashboard page.container) }}
import type { FC, ReactNode, Dispatch, SetStateAction } from 'react';
import { OBJECTCLASS } from '@pandino/pandino-api';
import { useTrackService } from '@pandino/react-hooks';
import type { JudoIdentifiable } from '~/services/data-api/common/JudoIdentifiable';
+ import { draftIdentifierPrefix } from '~/services/data-api/common/utils';
import type { JudoRestResponse } from '~/services/data-api/rest/requestResponse';
{{# if (containerHasTableWithTotalCount page.container) }}
import { X_JUDO_COUNT_RECORDS } from '~/services/data-api/rest/headers';
@@ -25,15 +26,11 @@ import { {{# unless page.container.table }}useCallback, useRef, {{/ unless }}use
import {
{{# if (hasPageRequiredBy page) }}passesLocalValidation,{{/ if }}
processQueryCustomizer,
- {{# if (containerHasDateInput page.container) }}uiDateToServiceDate,{{/ if }}
- {{# if (containerHasTimeInput page.container) }}uiTimeToServiceTime,{{/ if }}
useErrorHandler,
isErrorNestedValidationError,
- cleanUpPayload,
- decoratePayloadWithMetaFromData,
- {{# if page.container.view }}
- cloneDeep,
- {{/ if }}
+ simpleCloneDeep,
+ getValue,
+ setValue,
} from '~/utilities';
import type {
DialogResult,
@@ -66,20 +63,28 @@ import { {{# unless page.container.table }}useCallback, useRef, {{/ unless }}use
{{/ unless }}
{{# unless (containerIsEmptyDashboard page.container) }}
- {{# unless page.container.table }}
- {{# if isDebugPrint }}// include: actor/src/fragments/page/payload-converter.fragment.hbs{{/ if }}
- {{> actor/src/fragments/page/payload-converter.fragment.hbs classType=page.dataElement.target page=page }}
- {{/ unless }}
-
const {{ containerComponentName page.container }}DialogContainer = lazy(() => import('~/containers/{{ containerPath page.container }}/{{ containerComponentName page.container }}DialogContainer'));
{{/ unless }}
// XMIID: {{ getXMIID page }}
// Name: {{ page.name }}
export default function {{ pageName page }}(props: {{ pageName page }}Props) {
- const { ownerData, {{# and (isPageDataElementUnmappedSingle page) page.container.view }}data: output, {{/ and }}{{# if page.container.isRelationSelector }}alreadySelected, {{/ if }}{{# unless page.container.isSelector }}templateDataOverride, {{/ unless }}{{# unless page.container.table }}maskRequest, {{/ unless }}onClose, onSubmit, isDraft, ownerValidation } = props;
+ const {
+ ownerData,
+ {{# and (isPageDataElementUnmappedSingle page) page.container.view }}data: output,{{/ and }}
+ {{# if page.container.isRelationSelector }}alreadySelected,{{/ if }}
+ {{# unless page.container.isSelector }}templateDataOverride,{{/ unless }}
+ ownerValidation,
+ isDraft,
+ {{# unless page.container.table}}maskRequest,{{/ unless }}
+ dataPath,
+ onClose,
+ onSubmit,
+ } = props;
{{# unless (containerIsEmptyDashboard page.container) }}
+ const owner = useRef(ownerData ?? null);
+
// Services
const {{ firstToLower (getServiceImplForPage page) }} = useMemo(() => new {{ getServiceClassForPage page }}(judoAxiosProvider), []);
{{# each (getRelatedServicesForPage page) as |rel| }}
@@ -101,34 +106,22 @@ export default function {{ pageName page }}(props: {{ pageName page }}Props) {
const [isLoading, setIsLoading] = useState(false);
const [editMode, setEditMode] = useState({{# if page.container.form }}true{{ else }}false{{/ if }});
const [refreshCounter, setRefreshCounter] = useState(0);
- const [data, setData] = useState<{{ dialogDataType page }}{{# if page.container.table }}[]{{/ if }}>(
- {{# if page.container.table }}
- []
- {{ else }}
- {{# and (isPageDataElementUnmappedSingle page) page.container.view }}output{{ else }}{}{{/ and }} as {{ classDataName (getReferenceClassType page) 'Stored' }}
- {{/ if }}
- );
+ const [data, setData] = useState<{{ dialogDataType page }}{{# if page.container.table }}[]{{/ if }}>({{ dialogDataInitialValue page }} as {{ dialogDataType page }}{{# if page.container.table }}[]{{/ if }});
{{# if page.container.isSelector }}
const [selectionDiff, setSelectionDiff] = useState<{{ dialogDataType page }}[]>([]);
{{/ if }}
{{# unless page.container.table }}
const [validation, setValidation] = useState