From ecf1e092adcca88e9bb2ea97d09e8dc8782670b2 Mon Sep 17 00:00:00 2001 From: evoiron Date: Thu, 17 Oct 2024 15:41:55 +0200 Subject: [PATCH] display calculated values (#588) * feat: display calculated values Co-authored-by: Philippe Chevieux --- .../actions/excelCalculationAction.spec.ts | 23 ++- .../domain/actions/excelCalculationAction.ts | 3 +- .../domain/actionsList/actionsListDomain.ts | 5 +- libs/ui/src/_gqlTypes/index.ts | 20 +-- .../records/getRecordsFromLibraryQuery.ts | 1 + .../_queries/values/valueDetailsFragment.ts | 1 + .../EditRecordContent/antdUtils.tsx | 7 +- .../standardFieldReducer.test.ts | 6 +- .../standardFieldReducer.ts | 94 ++++++++-- .../DSBooleanWrapper.test.tsx | 114 ++++++++++++- .../StandardFieldValue/DSBooleanWrapper.tsx | 35 ++-- .../DSDatePickerWrapper.test.tsx | 117 ++++++++++++- .../DSDatePickerWrapper.tsx | 39 +++-- .../DSInputEncryptedWrapper.test.tsx | 128 +++++++++++++- .../DSInputEncryptedWrapper.tsx | 45 +++-- .../DSInputNumberWrapper.test.tsx | 160 +++++++++++++++++- .../DSInputNumberWrapper.tsx | 39 +++-- .../DSInputWrapper.test.tsx | 128 +++++++++++++- .../StandardFieldValue/DSInputWrapper.tsx | 49 ++++-- .../DSRangePickerWrapper.test.tsx | 126 +++++++++++++- .../DSRangePickerWrapper.tsx | 60 +++++-- .../DSRichTextWrapper.test.tsx | 98 ++++++++++- .../StandardFieldValue/DSRichTextWrapper.tsx | 41 +++-- .../StandardFieldValueRead.tsx | 37 +++- libs/ui/src/locales/en/shared.json | 1 + libs/ui/src/locales/fr/shared.json | 1 + 26 files changed, 1229 insertions(+), 149 deletions(-) diff --git a/apps/core/src/domain/actions/excelCalculationAction.spec.ts b/apps/core/src/domain/actions/excelCalculationAction.spec.ts index 6653dca24..c85439674 100644 --- a/apps/core/src/domain/actions/excelCalculationAction.spec.ts +++ b/apps/core/src/domain/actions/excelCalculationAction.spec.ts @@ -51,7 +51,7 @@ describe('excelCalculationAction', () => { ctx ); - expect(res).toEqual({errors: [], values: [{...mockResultValueBase, payload: '42'}]}); + expect(res).toEqual({errors: [], values: [{...mockResultValueBase, payload: '42', raw_payload: '42'}]}); expect( await action( [], @@ -61,7 +61,7 @@ describe('excelCalculationAction', () => { }, ctx ) - ).toEqual({errors: [], values: [{...mockResultValueBase, payload: '84'}]}); + ).toEqual({errors: [], values: [{...mockResultValueBase, payload: '84', raw_payload: '84'}]}); }); test('no formula', async () => { @@ -74,7 +74,7 @@ describe('excelCalculationAction', () => { }, ctx ); - expect(res).toEqual({errors: [], values: [{...mockResultValueBase, payload: ''}]}); + expect(res).toEqual({errors: [], values: [{...mockResultValueBase, payload: '', raw_payload: ''}]}); }); test('Replace variables', async () => { @@ -92,7 +92,13 @@ describe('excelCalculationAction', () => { expect(res).toEqual({ errors: [], - values: [{...mockResultValueBase, payload: 'resultat totoValue tataValue titiValue'}] + values: [ + { + ...mockResultValueBase, + payload: 'resultat totoValue tataValue titiValue', + raw_payload: 'resultat totoValue tataValue titiValue' + } + ] }); }); @@ -111,7 +117,14 @@ describe('excelCalculationAction', () => { expect(res).toEqual({ errors: [], - values: [mockStandardValue, {...mockResultValueBase, payload: 'resultat totoValue tataValue titiValue'}] + values: [ + mockStandardValue, + { + ...mockResultValueBase, + payload: 'resultat totoValue tataValue titiValue', + raw_payload: 'resultat totoValue tataValue titiValue' + } + ] }); }); diff --git a/apps/core/src/domain/actions/excelCalculationAction.ts b/apps/core/src/domain/actions/excelCalculationAction.ts index cf7668b63..2aaca63d5 100644 --- a/apps/core/src/domain/actions/excelCalculationAction.ts +++ b/apps/core/src/domain/actions/excelCalculationAction.ts @@ -120,7 +120,8 @@ export default function ({ modified_by: null, created_at: null, created_by: null, - payload: String(result) + payload: String(result), + raw_payload: String(result) }; return {values: [...values, finalResult], errors: []}; diff --git a/apps/core/src/domain/actionsList/actionsListDomain.ts b/apps/core/src/domain/actionsList/actionsListDomain.ts index 7a612f4ff..7c9e0b9b6 100644 --- a/apps/core/src/domain/actionsList/actionsListDomain.ts +++ b/apps/core/src/domain/actionsList/actionsListDomain.ts @@ -79,6 +79,7 @@ export default function ({'core.depsManager': depsManager, translator}: IActions async runActionsList(actions, values, ctx) { const availActions: IActionsListFunction[] = this.getAvailableActions(); let resultAction = values; + for (const action of actions) { const params: ActionsListParams = !!action.params ? action.params.reduce((all, p) => { @@ -100,7 +101,7 @@ export default function ({'core.depsManager': depsManager, translator}: IActions ? action.error_message[ctx.defaultLang] : ''; if (customMessage) { - customMessage += ': ' + errors.map(error => error.attributeValue.payload).join(', '); + customMessage += ': ' + errors.map(error => error.attributeValue?.payload).join(', '); throw new ValidationError({[ctx.attribute.id]: customMessage}, customMessage, true); } else { const errorsByType = errors.reduce< @@ -117,7 +118,7 @@ export default function ({'core.depsManager': depsManager, translator}: IActions (message, [errorType, {attributeValues, message: optionalMessage}]) => { const messageText = optionalMessage ?? translator.t(`error.${errorType}`); message.push( - `${messageText}: ${(attributeValues ?? []).map(value => value.payload).join(', ')}` + `${messageText}: ${(attributeValues ?? []).map(value => value?.payload).join(', ')}` ); return message; }, diff --git a/libs/ui/src/_gqlTypes/index.ts b/libs/ui/src/_gqlTypes/index.ts index 989559c5f..772121c60 100644 --- a/libs/ui/src/_gqlTypes/index.ts +++ b/libs/ui/src/_gqlTypes/index.ts @@ -1,6 +1,3 @@ -// Copyright LEAV Solutions 2017 -// This file is released under LGPL V3 -// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt import {IPreviewScalar} from '@leav/utils' import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; @@ -902,13 +899,13 @@ export type LibraryLinkAttributeDetailsFragment = { linked_library?: { id: strin export type LibraryPreviewsSettingsFragment = { label: any, description?: any | null, system: boolean, versions: { background: string, density: number, sizes: Array<{ name: string, size: number }> } }; -export type RecordFormElementFragment = { id: string, containerId: string, uiElementType: string, type: FormElementTypes, valueError?: string | null, values?: Array<{ id_value?: string | null, isInherited?: boolean | null, modified_at?: number | null, created_at?: number | null, linkValue?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { id_value?: string | null, isInherited?: boolean | null, modified_at?: number | null, created_at?: number | null, treeValue?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }, ancestors?: Array<{ record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } }> | null } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { payload?: any | null, raw_payload?: any | null, value?: any | null, raw_value?: any | null, id_value?: string | null, isInherited?: boolean | null, modified_at?: number | null, created_at?: number | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null }> | null, attribute?: { id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, linked_library?: { id: string, label?: any | null, behavior: LibraryBehavior, permissions?: { create_record: boolean } | null } | null, linkValuesList?: { enable: boolean, allowFreeEntry?: boolean | null, values?: Array<{ id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }> | null } | null, permissions: { access_attribute: boolean, edit_value: boolean }, versions_conf?: { versionable: boolean, profile?: { id: string, trees: Array<{ id: string, label?: any | null }> } | null } | null, metadata_fields?: Array<{ id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, permissions: { access_attribute: boolean, edit_value: boolean }, values_list?: { enable: boolean, allowFreeEntry?: boolean | null, dateRangeValues?: Array<{ from?: string | null, to?: string | null }> | null } | { enable: boolean, allowFreeEntry?: boolean | null, values?: Array | null } | null, metadata_fields?: Array<{ id: string }> | null }> | null } | { id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, values_list?: { enable: boolean, allowFreeEntry?: boolean | null, dateRangeValues?: Array<{ from?: string | null, to?: string | null }> | null } | { enable: boolean, allowFreeEntry?: boolean | null, values?: Array | null } | null, permissions: { access_attribute: boolean, edit_value: boolean }, versions_conf?: { versionable: boolean, profile?: { id: string, trees: Array<{ id: string, label?: any | null }> } | null } | null, metadata_fields?: Array<{ id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, permissions: { access_attribute: boolean, edit_value: boolean }, values_list?: { enable: boolean, allowFreeEntry?: boolean | null, dateRangeValues?: Array<{ from?: string | null, to?: string | null }> | null } | { enable: boolean, allowFreeEntry?: boolean | null, values?: Array | null } | null, metadata_fields?: Array<{ id: string }> | null }> | null } | { id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, linked_tree?: { id: string, label?: any | null } | null, treeValuesList?: { enable: boolean, allowFreeEntry?: boolean | null, values?: Array<{ id: string, record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }, ancestors?: Array<{ record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } }> | null }> | null } | null, permissions: { access_attribute: boolean, edit_value: boolean }, versions_conf?: { versionable: boolean, profile?: { id: string, trees: Array<{ id: string, label?: any | null }> } | null } | null, metadata_fields?: Array<{ id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, permissions: { access_attribute: boolean, edit_value: boolean }, values_list?: { enable: boolean, allowFreeEntry?: boolean | null, dateRangeValues?: Array<{ from?: string | null, to?: string | null }> | null } | { enable: boolean, allowFreeEntry?: boolean | null, values?: Array | null } | null, metadata_fields?: Array<{ id: string }> | null }> | null } | null, settings: Array<{ key: string, value: any }> }; +export type RecordFormElementFragment = { id: string, containerId: string, uiElementType: string, type: FormElementTypes, valueError?: string | null, values?: Array<{ id_value?: string | null, isInherited?: boolean | null, isCalculated?: boolean | null, modified_at?: number | null, created_at?: number | null, linkValue?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { id_value?: string | null, isInherited?: boolean | null, isCalculated?: boolean | null, modified_at?: number | null, created_at?: number | null, treeValue?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }, ancestors?: Array<{ record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } }> | null } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { payload?: any | null, raw_payload?: any | null, value?: any | null, raw_value?: any | null, id_value?: string | null, isInherited?: boolean | null, isCalculated?: boolean | null, modified_at?: number | null, created_at?: number | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null }> | null, attribute?: { id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, linked_library?: { id: string, label?: any | null, behavior: LibraryBehavior, permissions?: { create_record: boolean } | null } | null, linkValuesList?: { enable: boolean, allowFreeEntry?: boolean | null, values?: Array<{ id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }> | null } | null, permissions: { access_attribute: boolean, edit_value: boolean }, versions_conf?: { versionable: boolean, profile?: { id: string, trees: Array<{ id: string, label?: any | null }> } | null } | null, metadata_fields?: Array<{ id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, permissions: { access_attribute: boolean, edit_value: boolean }, values_list?: { enable: boolean, allowFreeEntry?: boolean | null, dateRangeValues?: Array<{ from?: string | null, to?: string | null }> | null } | { enable: boolean, allowFreeEntry?: boolean | null, values?: Array | null } | null, metadata_fields?: Array<{ id: string }> | null }> | null } | { id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, values_list?: { enable: boolean, allowFreeEntry?: boolean | null, dateRangeValues?: Array<{ from?: string | null, to?: string | null }> | null } | { enable: boolean, allowFreeEntry?: boolean | null, values?: Array | null } | null, permissions: { access_attribute: boolean, edit_value: boolean }, versions_conf?: { versionable: boolean, profile?: { id: string, trees: Array<{ id: string, label?: any | null }> } | null } | null, metadata_fields?: Array<{ id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, permissions: { access_attribute: boolean, edit_value: boolean }, values_list?: { enable: boolean, allowFreeEntry?: boolean | null, dateRangeValues?: Array<{ from?: string | null, to?: string | null }> | null } | { enable: boolean, allowFreeEntry?: boolean | null, values?: Array | null } | null, metadata_fields?: Array<{ id: string }> | null }> | null } | { id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, linked_tree?: { id: string, label?: any | null } | null, treeValuesList?: { enable: boolean, allowFreeEntry?: boolean | null, values?: Array<{ id: string, record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }, ancestors?: Array<{ record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } }> | null }> | null } | null, permissions: { access_attribute: boolean, edit_value: boolean }, versions_conf?: { versionable: boolean, profile?: { id: string, trees: Array<{ id: string, label?: any | null }> } | null } | null, metadata_fields?: Array<{ id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, permissions: { access_attribute: boolean, edit_value: boolean }, values_list?: { enable: boolean, allowFreeEntry?: boolean | null, dateRangeValues?: Array<{ from?: string | null, to?: string | null }> | null } | { enable: boolean, allowFreeEntry?: boolean | null, values?: Array | null } | null, metadata_fields?: Array<{ id: string }> | null }> | null } | null, settings: Array<{ key: string, value: any }> }; -export type ValueDetailsLinkValueFragment = { id_value?: string | null, isInherited?: boolean | null, modified_at?: number | null, created_at?: number | null, linkValue?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null }; +export type ValueDetailsLinkValueFragment = { id_value?: string | null, isInherited?: boolean | null, isCalculated?: boolean | null, modified_at?: number | null, created_at?: number | null, linkValue?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null }; -export type ValueDetailsTreeValueFragment = { id_value?: string | null, isInherited?: boolean | null, modified_at?: number | null, created_at?: number | null, treeValue?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }, ancestors?: Array<{ record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } }> | null } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null }; +export type ValueDetailsTreeValueFragment = { id_value?: string | null, isInherited?: boolean | null, isCalculated?: boolean | null, modified_at?: number | null, created_at?: number | null, treeValue?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }, ancestors?: Array<{ record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } }> | null } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null }; -export type ValueDetailsValueFragment = { payload?: any | null, raw_payload?: any | null, value?: any | null, raw_value?: any | null, id_value?: string | null, isInherited?: boolean | null, modified_at?: number | null, created_at?: number | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null }; +export type ValueDetailsValueFragment = { payload?: any | null, raw_payload?: any | null, value?: any | null, raw_value?: any | null, id_value?: string | null, isInherited?: boolean | null, isCalculated?: boolean | null, modified_at?: number | null, created_at?: number | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null }; export type ValueDetailsFragment = ValueDetailsLinkValueFragment | ValueDetailsTreeValueFragment | ValueDetailsValueFragment; @@ -1184,14 +1181,14 @@ export type RecordFormQueryVariables = Exact<{ }>; -export type RecordFormQuery = { recordForm?: { id: string, recordId?: string | null, library: { id: string }, dependencyAttributes?: Array<{ id: string }> | null, elements: Array<{ id: string, containerId: string, uiElementType: string, type: FormElementTypes, valueError?: string | null, values?: Array<{ id_value?: string | null, isInherited?: boolean | null, modified_at?: number | null, created_at?: number | null, linkValue?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { id_value?: string | null, isInherited?: boolean | null, modified_at?: number | null, created_at?: number | null, treeValue?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }, ancestors?: Array<{ record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } }> | null } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { payload?: any | null, raw_payload?: any | null, value?: any | null, raw_value?: any | null, id_value?: string | null, isInherited?: boolean | null, modified_at?: number | null, created_at?: number | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null }> | null, attribute?: { id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, linked_library?: { id: string, label?: any | null, behavior: LibraryBehavior, permissions?: { create_record: boolean } | null } | null, linkValuesList?: { enable: boolean, allowFreeEntry?: boolean | null, values?: Array<{ id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }> | null } | null, permissions: { access_attribute: boolean, edit_value: boolean }, versions_conf?: { versionable: boolean, profile?: { id: string, trees: Array<{ id: string, label?: any | null }> } | null } | null, metadata_fields?: Array<{ id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, permissions: { access_attribute: boolean, edit_value: boolean }, values_list?: { enable: boolean, allowFreeEntry?: boolean | null, dateRangeValues?: Array<{ from?: string | null, to?: string | null }> | null } | { enable: boolean, allowFreeEntry?: boolean | null, values?: Array | null } | null, metadata_fields?: Array<{ id: string }> | null }> | null } | { id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, values_list?: { enable: boolean, allowFreeEntry?: boolean | null, dateRangeValues?: Array<{ from?: string | null, to?: string | null }> | null } | { enable: boolean, allowFreeEntry?: boolean | null, values?: Array | null } | null, permissions: { access_attribute: boolean, edit_value: boolean }, versions_conf?: { versionable: boolean, profile?: { id: string, trees: Array<{ id: string, label?: any | null }> } | null } | null, metadata_fields?: Array<{ id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, permissions: { access_attribute: boolean, edit_value: boolean }, values_list?: { enable: boolean, allowFreeEntry?: boolean | null, dateRangeValues?: Array<{ from?: string | null, to?: string | null }> | null } | { enable: boolean, allowFreeEntry?: boolean | null, values?: Array | null } | null, metadata_fields?: Array<{ id: string }> | null }> | null } | { id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, linked_tree?: { id: string, label?: any | null } | null, treeValuesList?: { enable: boolean, allowFreeEntry?: boolean | null, values?: Array<{ id: string, record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }, ancestors?: Array<{ record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } }> | null }> | null } | null, permissions: { access_attribute: boolean, edit_value: boolean }, versions_conf?: { versionable: boolean, profile?: { id: string, trees: Array<{ id: string, label?: any | null }> } | null } | null, metadata_fields?: Array<{ id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, permissions: { access_attribute: boolean, edit_value: boolean }, values_list?: { enable: boolean, allowFreeEntry?: boolean | null, dateRangeValues?: Array<{ from?: string | null, to?: string | null }> | null } | { enable: boolean, allowFreeEntry?: boolean | null, values?: Array | null } | null, metadata_fields?: Array<{ id: string }> | null }> | null } | null, settings: Array<{ key: string, value: any }> }> } | null }; +export type RecordFormQuery = { recordForm?: { id: string, recordId?: string | null, library: { id: string }, dependencyAttributes?: Array<{ id: string }> | null, elements: Array<{ id: string, containerId: string, uiElementType: string, type: FormElementTypes, valueError?: string | null, values?: Array<{ id_value?: string | null, isInherited?: boolean | null, isCalculated?: boolean | null, modified_at?: number | null, created_at?: number | null, linkValue?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { id_value?: string | null, isInherited?: boolean | null, isCalculated?: boolean | null, modified_at?: number | null, created_at?: number | null, treeValue?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }, ancestors?: Array<{ record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } }> | null } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { payload?: any | null, raw_payload?: any | null, value?: any | null, raw_value?: any | null, id_value?: string | null, isInherited?: boolean | null, isCalculated?: boolean | null, modified_at?: number | null, created_at?: number | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null }> | null, attribute?: { id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, linked_library?: { id: string, label?: any | null, behavior: LibraryBehavior, permissions?: { create_record: boolean } | null } | null, linkValuesList?: { enable: boolean, allowFreeEntry?: boolean | null, values?: Array<{ id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }> | null } | null, permissions: { access_attribute: boolean, edit_value: boolean }, versions_conf?: { versionable: boolean, profile?: { id: string, trees: Array<{ id: string, label?: any | null }> } | null } | null, metadata_fields?: Array<{ id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, permissions: { access_attribute: boolean, edit_value: boolean }, values_list?: { enable: boolean, allowFreeEntry?: boolean | null, dateRangeValues?: Array<{ from?: string | null, to?: string | null }> | null } | { enable: boolean, allowFreeEntry?: boolean | null, values?: Array | null } | null, metadata_fields?: Array<{ id: string }> | null }> | null } | { id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, values_list?: { enable: boolean, allowFreeEntry?: boolean | null, dateRangeValues?: Array<{ from?: string | null, to?: string | null }> | null } | { enable: boolean, allowFreeEntry?: boolean | null, values?: Array | null } | null, permissions: { access_attribute: boolean, edit_value: boolean }, versions_conf?: { versionable: boolean, profile?: { id: string, trees: Array<{ id: string, label?: any | null }> } | null } | null, metadata_fields?: Array<{ id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, permissions: { access_attribute: boolean, edit_value: boolean }, values_list?: { enable: boolean, allowFreeEntry?: boolean | null, dateRangeValues?: Array<{ from?: string | null, to?: string | null }> | null } | { enable: boolean, allowFreeEntry?: boolean | null, values?: Array | null } | null, metadata_fields?: Array<{ id: string }> | null }> | null } | { id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, linked_tree?: { id: string, label?: any | null } | null, treeValuesList?: { enable: boolean, allowFreeEntry?: boolean | null, values?: Array<{ id: string, record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }, ancestors?: Array<{ record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } }> | null }> | null } | null, permissions: { access_attribute: boolean, edit_value: boolean }, versions_conf?: { versionable: boolean, profile?: { id: string, trees: Array<{ id: string, label?: any | null }> } | null } | null, metadata_fields?: Array<{ id: string, label?: any | null, description?: any | null, type: AttributeType, format?: AttributeFormat | null, system: boolean, readonly: boolean, multiple_values: boolean, permissions: { access_attribute: boolean, edit_value: boolean }, values_list?: { enable: boolean, allowFreeEntry?: boolean | null, dateRangeValues?: Array<{ from?: string | null, to?: string | null }> | null } | { enable: boolean, allowFreeEntry?: boolean | null, values?: Array | null } | null, metadata_fields?: Array<{ id: string }> | null }> | null } | null, settings: Array<{ key: string, value: any }> }> } | null }; export type RecordUpdateSubscriptionVariables = Exact<{ filters?: InputMaybe; }>; -export type RecordUpdateSubscription = { recordUpdate: { record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } }, modified_by: Array<{ value?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null }> }, updatedValues: Array<{ attribute: string, value: { id_value?: string | null, isInherited?: boolean | null, modified_at?: number | null, created_at?: number | null, linkValue?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { id_value?: string | null, isInherited?: boolean | null, modified_at?: number | null, created_at?: number | null, treeValue?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }, ancestors?: Array<{ record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } }> | null } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { payload?: any | null, raw_payload?: any | null, value?: any | null, raw_value?: any | null, id_value?: string | null, isInherited?: boolean | null, modified_at?: number | null, created_at?: number | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } }> } }; +export type RecordUpdateSubscription = { recordUpdate: { record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } }, modified_by: Array<{ value?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null }> }, updatedValues: Array<{ attribute: string, value: { id_value?: string | null, isInherited?: boolean | null, isCalculated?: boolean | null, modified_at?: number | null, created_at?: number | null, linkValue?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { id_value?: string | null, isInherited?: boolean | null, isCalculated?: boolean | null, modified_at?: number | null, created_at?: number | null, treeValue?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }, ancestors?: Array<{ record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } }> | null } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { payload?: any | null, raw_payload?: any | null, value?: any | null, raw_value?: any | null, id_value?: string | null, isInherited?: boolean | null, isCalculated?: boolean | null, modified_at?: number | null, created_at?: number | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } }> } }; export type IndexRecordsMutationVariables = Exact<{ libraryId: Scalars['String']; @@ -1283,7 +1280,7 @@ export type DeleteValueMutationVariables = Exact<{ }>; -export type DeleteValueMutation = { deleteValue: Array<{ id_value?: string | null, isInherited?: boolean | null, modified_at?: number | null, created_at?: number | null, linkValue?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { id_value?: string | null, isInherited?: boolean | null, modified_at?: number | null, created_at?: number | null, treeValue?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }, ancestors?: Array<{ record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } }> | null } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { payload?: any | null, raw_payload?: any | null, value?: any | null, raw_value?: any | null, id_value?: string | null, isInherited?: boolean | null, modified_at?: number | null, created_at?: number | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null }> }; +export type DeleteValueMutation = { deleteValue: Array<{ id_value?: string | null, isInherited?: boolean | null, isCalculated?: boolean | null, modified_at?: number | null, created_at?: number | null, linkValue?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { id_value?: string | null, isInherited?: boolean | null, isCalculated?: boolean | null, modified_at?: number | null, created_at?: number | null, treeValue?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }, ancestors?: Array<{ record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } }> | null } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { payload?: any | null, raw_payload?: any | null, value?: any | null, raw_value?: any | null, id_value?: string | null, isInherited?: boolean | null, isCalculated?: boolean | null, modified_at?: number | null, created_at?: number | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null }> }; export type SaveValueBatchMutationVariables = Exact<{ library: Scalars['ID']; @@ -1294,7 +1291,7 @@ export type SaveValueBatchMutationVariables = Exact<{ }>; -export type SaveValueBatchMutation = { saveValueBatch: { values?: Array<{ id_value?: string | null, isInherited?: boolean | null, modified_at?: number | null, created_at?: number | null, linkValue?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { id_value?: string | null, isInherited?: boolean | null, modified_at?: number | null, created_at?: number | null, treeValue?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }, ancestors?: Array<{ record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } }> | null } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { payload?: any | null, raw_payload?: any | null, value?: any | null, raw_value?: any | null, id_value?: string | null, isInherited?: boolean | null, modified_at?: number | null, created_at?: number | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null }> | null, errors?: Array<{ type: string, attribute: string, input?: string | null, message: string }> | null } }; +export type SaveValueBatchMutation = { saveValueBatch: { values?: Array<{ id_value?: string | null, isInherited?: boolean | null, isCalculated?: boolean | null, modified_at?: number | null, created_at?: number | null, linkValue?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { id_value?: string | null, isInherited?: boolean | null, isCalculated?: boolean | null, modified_at?: number | null, created_at?: number | null, treeValue?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } }, ancestors?: Array<{ record: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } }> | null } | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null } | { payload?: any | null, raw_payload?: any | null, value?: any | null, raw_value?: any | null, id_value?: string | null, isInherited?: boolean | null, isCalculated?: boolean | null, modified_at?: number | null, created_at?: number | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null, attribute?: { id: string, format?: AttributeFormat | null, type: AttributeType, system: boolean } | null, metadata?: Array<{ name: string, value?: { id_value?: string | null, modified_at?: number | null, created_at?: number | null, payload?: any | null, raw_payload?: any | null, modified_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, created_by?: { id: string, whoAmI: { id: string, label?: string | null, subLabel?: string | null, color?: string | null, preview?: IPreviewScalar | null, library: { id: string, label?: any | null } } } | null, version?: Array<{ treeId: string, treeNode?: { id: string, record: { id: string, whoAmI: { id: string, label?: string | null, library: { id: string } } } } | null } | null> | null } | null } | null> | null }> | null, errors?: Array<{ type: string, attribute: string, input?: string | null, message: string }> | null } }; export type DeleteViewMutationVariables = Exact<{ viewId: Scalars['String']; @@ -1568,6 +1565,7 @@ export const ValueDetailsFragmentDoc = gql` fragment ValueDetails on GenericValue { id_value isInherited + isCalculated modified_at modified_by { ...RecordIdentity diff --git a/libs/ui/src/_queries/records/getRecordsFromLibraryQuery.ts b/libs/ui/src/_queries/records/getRecordsFromLibraryQuery.ts index e9968f39a..072a1dd2b 100644 --- a/libs/ui/src/_queries/records/getRecordsFromLibraryQuery.ts +++ b/libs/ui/src/_queries/records/getRecordsFromLibraryQuery.ts @@ -65,6 +65,7 @@ const _handleType = (field: IField): string => { ${field.id}: property(attribute: "${field.id}") { ${typePart.trim()} isInherited + isCalculated } `; }; diff --git a/libs/ui/src/_queries/values/valueDetailsFragment.ts b/libs/ui/src/_queries/values/valueDetailsFragment.ts index 3e004ba07..5ecdd2346 100644 --- a/libs/ui/src/_queries/values/valueDetailsFragment.ts +++ b/libs/ui/src/_queries/values/valueDetailsFragment.ts @@ -11,6 +11,7 @@ export const valueDetailsFragment = gql` fragment ValueDetails on GenericValue { id_value isInherited + isCalculated modified_at modified_by { ...RecordIdentity diff --git a/libs/ui/src/components/RecordEdition/EditRecordContent/antdUtils.tsx b/libs/ui/src/components/RecordEdition/EditRecordContent/antdUtils.tsx index eba687e64..352c2c4b9 100644 --- a/libs/ui/src/components/RecordEdition/EditRecordContent/antdUtils.tsx +++ b/libs/ui/src/components/RecordEdition/EditRecordContent/antdUtils.tsx @@ -15,9 +15,14 @@ import dayjs from 'dayjs'; const hasDateRangeValues = (dateRange: unknown): dateRange is IDateRangeValue => (dateRange as IDateRangeValue).from !== undefined && (dateRange as IDateRangeValue).to !== undefined; +const getCalculatedValue = values => values.find(value => value.isCalculated); + const getInheritedValue = values => values.find(value => value.isInherited); const getNotInheritedOrOverrideValue = values => values.find(value => !value.isInherited && value.raw_payload !== null); +const getUserInputValue = values => + values.find(value => !value.isInherited && !value.isCalculated && value.raw_value !== null); + const isRecordFormElementsValueLinkValue = ( value: RecordFormElementsValue, attribute: IRecordForm['elements'][0]['attribute'] @@ -37,7 +42,7 @@ export const getAntdFormInitialValues = (recordForm: IRecordForm) => return acc; } - const value = getNotInheritedOrOverrideValue(values) ?? getInheritedValue(values) ?? null; + const value = getUserInputValue(values) ?? getInheritedValue(values) ?? getCalculatedValue(values) ?? null; if (isRecordFormElementsValueLinkValue(value, attribute)) { acc[attribute.id] = value?.linkValue?.id; diff --git a/libs/ui/src/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducer.test.ts b/libs/ui/src/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducer.test.ts index 9ea5f8745..b3ea0fe3a 100644 --- a/libs/ui/src/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducer.test.ts +++ b/libs/ui/src/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducer.test.ts @@ -70,7 +70,11 @@ describe('standardFieldReducer', () => { inheritedValue: null, isInheritedValue: false, isInheritedNotOverrideValue: false, - isInheritedOverrideValue: false + isInheritedOverrideValue: false, + calculatedValue: null, + isCalculatedNotOverrideValue: false, + isCalculatedOverrideValue: false, + isCalculatedValue: false }; const _getInitialStateWithValues = ( diff --git a/libs/ui/src/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducer.ts b/libs/ui/src/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducer.ts index ce4fbea34..318adcd47 100644 --- a/libs/ui/src/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducer.ts +++ b/libs/ui/src/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducer.ts @@ -62,9 +62,33 @@ interface INotInherited { export type InheritedFlags = INotInherited | IInheritedOverride | IInheritedNotOverride; +interface ICalculatedNotOverride { + isCalculatedValue: true; + isCalculatedOverrideValue: false; + isCalculatedNotOverrideValue: true; + calculatedValue: RecordFormElementsValueStandardValue; +} + +interface ICalculatedOverride { + isCalculatedValue: true; + isCalculatedOverrideValue: true; + isCalculatedNotOverrideValue: false; + calculatedValue: RecordFormElementsValueStandardValue; +} + +interface INotCalculated { + isCalculatedValue: false; + isCalculatedOverrideValue: false; + isCalculatedNotOverrideValue: false; + calculatedValue: null; +} + +export type CalculatedFlags = INotCalculated | ICalculatedOverride | ICalculatedNotOverride; + export type IStandardFieldReducerState = ICommonFieldsReducerState & { metadataEdit: boolean; -} & InheritedFlags; +} & InheritedFlags & + CalculatedFlags; export enum StandardFieldReducerActionsTypes { ADD_VALUE = 'ADD_VALUE', @@ -190,8 +214,10 @@ const _updateValueData = ( }; const getInheritedValue = (values: RecordFormElementsValueStandardValue[]) => values.filter(value => value.isInherited); -const getNotInheritedOrOverrideValue = (values: RecordFormElementsValueStandardValue[]) => - values.filter(value => !value.isInherited && value.raw_value !== null); +const getCalculatedValue = (values: RecordFormElementsValueStandardValue[]) => + values.filter(value => value.isCalculated); +const getUserInputValue = (values: RecordFormElementsValueStandardValue[]) => + values.filter(value => !value.isInherited && !value.isCalculated && value.raw_value !== null); /** * For given list of values, determine if there is inherited values, inherited/current version and default active scope @@ -204,9 +230,12 @@ const _computeScopeAndValues = (params: { const {attribute, values, formVersion} = params; // Get override or inhertied values - let valuesToHandle = getNotInheritedOrOverrideValue(values); + let valuesToHandle = getUserInputValue(values); if (!valuesToHandle.length) { - valuesToHandle = getInheritedValue(values); + valuesToHandle = getCalculatedValue(values); + if (!valuesToHandle.length) { + valuesToHandle = getInheritedValue(values); + } } const preparedValues = valuesToHandle.length @@ -266,7 +295,7 @@ const _computeScopeAndValues = (params: { const _computeInheritedFlags = (fieldValues: RecordFormElementsValueStandardValue[]): InheritedFlags => { const inheritedValue = fieldValues.find(fieldValue => fieldValue.isInherited); - const overrideValue = fieldValues.find(fieldValue => !fieldValue.isInherited); + const overrideValue = fieldValues.find(fieldValue => !fieldValue.isInherited && !fieldValue.isCalculated); if (inheritedValue === undefined) { return { @@ -296,6 +325,38 @@ const _computeInheritedFlags = (fieldValues: RecordFormElementsValueStandardValu }; }; +const _computeCalculatedFlags = (fieldValues: RecordFormElementsValueStandardValue[]): CalculatedFlags => { + const calculatedValue = fieldValues.find(fieldValue => fieldValue.isCalculated); + const overrideValue = fieldValues.find(fieldValue => !fieldValue.isCalculated && !fieldValue.isInherited); + + if (calculatedValue === undefined) { + return { + calculatedValue: null, + isCalculatedValue: false, + isCalculatedOverrideValue: false, + isCalculatedNotOverrideValue: false + }; + } + + const isCalculatedValue = true; + + if (overrideValue.value === null) { + return { + calculatedValue, + isCalculatedValue, + isCalculatedNotOverrideValue: true, + isCalculatedOverrideValue: false + }; + } + + return { + calculatedValue, + isCalculatedValue, + isCalculatedNotOverrideValue: false, + isCalculatedOverrideValue: true + }; +}; + export const computeInitialState = (params: { element: FormElement; record: IRecordIdentityWhoAmI; @@ -315,7 +376,8 @@ export const computeInitialState = (params: { isReadOnly: attribute?.readonly || isRecordReadOnly || !attribute?.permissions?.edit_value, metadataEdit, ..._computeScopeAndValues({attribute, values: fieldValues, formVersion}), - ..._computeInheritedFlags(fieldValues) + ..._computeInheritedFlags(fieldValues), + ..._computeCalculatedFlags(fieldValues) }; }; @@ -413,7 +475,11 @@ const standardFieldReducer = ( { ...state, isInheritedOverrideValue: state.isInheritedValue ? true : state.isInheritedOverrideValue, - isInheritedNotOverrideValue: state.isInheritedValue ? false : state.isInheritedNotOverrideValue + isInheritedNotOverrideValue: state.isInheritedValue ? false : state.isInheritedNotOverrideValue, + isCalculatedOverrideValue: state.isCalculatedValue ? true : state.isCalculatedOverrideValue, + isCalculatedNotOverrideValue: state.isCalculatedValue + ? false + : state.isCalculatedNotOverrideValue } as IStandardFieldReducerState, newValueData ); @@ -424,6 +490,10 @@ const standardFieldReducer = ( }; newState.isInheritedOverrideValue = state.isInheritedValue ? true : state.isInheritedOverrideValue; newState.isInheritedNotOverrideValue = state.isInheritedValue ? false : state.isInheritedNotOverrideValue; + newState.isCalculatedOverrideValue = state.isCalculatedValue ? true : state.isCalculatedOverrideValue; + newState.isCalculatedNotOverrideValue = state.isCalculatedValue + ? false + : state.isCalculatedNotOverrideValue; const newStateActiveValues = newState.values[newState.activeScope].values; @@ -442,7 +512,9 @@ const standardFieldReducer = ( const newState = { ...state, isInheritedOverrideValue: state.isInheritedValue ? false : state.isInheritedOverrideValue, - isInheritedNotOverrideValue: state.isInheritedValue ? true : state.isInheritedNotOverrideValue + isInheritedNotOverrideValue: state.isInheritedValue ? true : state.isInheritedNotOverrideValue, + isCalculatedOverrideValue: state.isCalculatedValue ? false : state.isCalculatedOverrideValue, + isCalculatedNotOverrideValue: state.isCalculatedValue ? true : state.isCalculatedNotOverrideValue }; const newStateActiveValues = newState.values[newState.activeScope].values; @@ -479,7 +551,9 @@ const standardFieldReducer = ( const newState = { ...state, isInheritedOverrideValue: state.isInheritedValue ? false : state.isInheritedOverrideValue, - isInheritedNotOverrideValue: state.isInheritedValue ? true : state.isInheritedNotOverrideValue + isInheritedNotOverrideValue: state.isInheritedValue ? true : state.isInheritedNotOverrideValue, + isCalculatedOverrideValue: state.isCalculatedValue ? false : state.isCalculatedOverrideValue, + isCalculatedNotOverrideValue: state.isCalculatedValue ? true : state.isCalculatedNotOverrideValue }; delete newState.values[newState.activeScope].values[newValueId]; diff --git a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.test.tsx b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.test.tsx index 88a54f9ea..42aa697de 100644 --- a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.test.tsx +++ b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.test.tsx @@ -5,6 +5,7 @@ import {render, screen} from '_ui/_tests/testUtils'; import {AntForm} from 'aristid-ds'; import {DSBooleanWrapper} from './DSBooleanWrapper'; import { + CalculatedFlags, InheritedFlags, IStandardFieldReducerState, StandardFieldValueState @@ -67,6 +68,33 @@ const inheritedOverrideValue: InheritedFlags = { inheritedValue: {raw_value: inheritedValues[1].raw_value} }; +const calculatedValues = [ + { + isCalculated: null, + value: false, + raw_value: false + }, + { + isCalculated: true, + value: true, + raw_value: true + } +]; + +const calculatedNotOverrideValue: CalculatedFlags = { + isCalculatedValue: true, + isCalculatedOverrideValue: false, + isCalculatedNotOverrideValue: true, + calculatedValue: {raw_value: calculatedValues[1].raw_value} +}; + +const calculatedOverrideValue: CalculatedFlags = { + isCalculatedValue: true, + isCalculatedOverrideValue: true, + isCalculatedNotOverrideValue: false, + calculatedValue: {raw_value: calculatedValues[1].raw_value} +}; + const getInitialState = ({ required, fallbackLang @@ -96,7 +124,11 @@ const getInitialState = ({ inheritedValue: null, isInheritedNotOverrideValue: false, isInheritedOverrideValue: false, - isInheritedValue: false + isInheritedValue: false, + calculatedValue: null, + isCalculatedNotOverrideValue: false, + isCalculatedOverrideValue: false, + isCalculatedValue: false }); describe('DSBooleanWrapper', () => { @@ -297,4 +329,84 @@ describe('DSBooleanWrapper', () => { expect(mockHandleSubmit).toHaveBeenCalledWith('', state.attribute.id); }); }); + + describe('With calculus', () => { + test('Should display calculated value', async () => { + let state = getInitialState({required: false, fallbackLang: false}); + state = { + ...state, + ...calculatedNotOverrideValue, + formElement: {...state.formElement, values: calculatedValues} + }; + + render( + + + + + + ); + + expect(screen.getByText(/yes/)).toBeVisible(); + }); + + test('Should display override value, clear icon and calculated value under it', async () => { + let state = getInitialState({required: false, fallbackLang: false}); + state = { + ...state, + ...calculatedOverrideValue, + formElement: {...state.formElement, values: calculatedValues} + }; + + render( + + + + + + ); + + expect(screen.getByText(/no/)).toBeVisible(); + + const helperText = screen.getByText(/calculated_input_helper/); + expect(helperText).toBeInTheDocument(); + }); + + test('Should allow to clear override value', async () => { + let state = getInitialState({required: false, fallbackLang: false}); + state = { + ...state, + ...calculatedOverrideValue, + formElement: {...state.formElement, values: calculatedValues} + }; + + render( + + + + + + ); + + const clearButton = screen.getByRole('button'); + await user.click(clearButton); + + expect(mockHandleSubmit).toHaveBeenCalledWith('', state.attribute.id); + }); + }); }); diff --git a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.tsx b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.tsx index b754b4aee..1132dab03 100644 --- a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.tsx +++ b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.tsx @@ -39,8 +39,12 @@ export const DSBooleanWrapper: FunctionComponent = ({val const {errors} = Form.Item.useStatus(); const {lang: availableLang} = useLang(); - const _resetOverrideValue = () => { - onChange(state.inheritedValue.raw_value, undefined); + const _resetToInheritedOrCalculatedValue = () => { + if (state.isInheritedValue) { + onChange(state.inheritedValue.raw_value, undefined); + } else if (state.isCalculatedValue) { + onChange(state.calculatedValue.raw_value, undefined); + } handleSubmit('', state.attribute.id); }; @@ -49,18 +53,25 @@ export const DSBooleanWrapper: FunctionComponent = ({val onChange(checked, event); }; + const _getHelper = () => { + if (state.isInheritedOverrideValue) { + return t('record_edition.inherited_input_helper', { + inheritedValue: t(_getBooleanValueAsStringForTranslation(state.inheritedValue.raw_value)) + }); + } else if (state.isCalculatedOverrideValue) { + return t('record_edition.calculated_input_helper', { + calculatedValue: t(_getBooleanValueAsStringForTranslation(state.calculatedValue.raw_value)) + }); + } + return undefined; + }; + const label = localizedTranslation(state.formElement.settings.label, availableLang); return ( 0 ? 'error' : undefined} disabled={state.isReadOnly} > @@ -69,13 +80,13 @@ export const DSBooleanWrapper: FunctionComponent = ({val {t(_getBooleanValueAsStringForTranslation(value))} - {state.isInheritedOverrideValue && ( - + {(state.isInheritedOverrideValue || state.isCalculatedOverrideValue) && ( + )} diff --git a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.test.tsx b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.test.tsx index f7ba25d96..ca60cf18f 100644 --- a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.test.tsx +++ b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.test.tsx @@ -70,7 +70,11 @@ const getInitialState = ({ inheritedValue: null, isInheritedNotOverrideValue: false, isInheritedOverrideValue: false, - isInheritedValue: false + isInheritedValue: false, + calculatedValue: null, + isCalculatedNotOverrideValue: false, + isCalculatedOverrideValue: false, + isCalculatedValue: false }); describe('DSDatePickerWrapper', () => { @@ -352,6 +356,117 @@ describe('DSDatePickerWrapper', () => { ); + expect(screen.queryByRole('button')).toBeNull(); + }); + }); + describe('Calculated values', () => { + test('Should not display helper without calculated value', async () => { + const state = getInitialState({required: false, fallbackLang: false}); + state.calculatedValue = null; + state.isCalculatedOverrideValue = false; + render( +
+ + + +
+ ); + + expect( + screen.queryByText('record_edition.calculated_input_helper', {exact: false}) + ).not.toBeInTheDocument(); + }); + + test('Should display helper with calculated value', async () => { + const state = getInitialState({required: false, fallbackLang: false}); + state.calculatedValue = mockValue.value; + state.isCalculatedOverrideValue = true; + render( +
+ + + +
+ ); + + expect(screen.getByText('record_edition.calculated_input_helper', {exact: false})).toBeVisible(); + }); + + test('Should call onChange/handleSubmit with calculated value on clear', async () => { + const raw_value = '1714138054'; + const state = getInitialState({required: false, fallbackLang: false}); + state.calculatedValue = {...mockValue.value, raw_value}; + state.isCalculatedValue = true; + state.isCalculatedOverrideValue = true; + state.isCalculatedNotOverrideValue = false; + render( +
+ + + +
+ ); + + const clearButton = screen.getByRole('button'); + await user.click(clearButton); + + expect(mockOnChange).toHaveBeenCalledTimes(1); + expect(mockOnChange).toHaveBeenCalledWith(expect.any(Object), raw_value); + expect(mockHandleSubmit).toHaveBeenCalledTimes(1); + expect(mockHandleSubmit).toHaveBeenCalledWith('', state.attribute.id); + }); + + test('Should hide clear icon when value is calculated, but not override', async () => { + const raw_value = '1714138054'; + const state = getInitialState({required: false, fallbackLang: false}); + state.calculatedValue = {...mockValue.value, raw_value}; + state.isCalculatedValue = true; + state.isCalculatedOverrideValue = false; + state.isCalculatedNotOverrideValue = true; + render( +
+ + + +
+ ); + expect(screen.queryByRole('button')).toBeNull(); }); }); diff --git a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.tsx b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.tsx index e69c2fb55..2bc583563 100644 --- a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.tsx +++ b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.tsx @@ -56,13 +56,21 @@ export const DSDatePickerWrapper: FunctionComponent = } }, [fieldValue.isEditing]); + const _resetToInheritedOrCalculatedValue = () => { + if (state.isInheritedValue) { + onChange(dayjs.unix(Number(state.inheritedValue.raw_value)), state.inheritedValue.raw_value); + } else if (state.isCalculatedValue) { + onChange(dayjs.unix(Number(state.calculatedValue.raw_value)), state.calculatedValue.raw_value); + } + handleSubmit('', state.attribute.id); + }; + const _handleDateChange: (datePickerDate: dayjs.Dayjs | null, antOnChangeParams: string | string[]) => void = ( datePickerDate, ...antOnChangeParams ) => { - if (state.isInheritedValue && datePickerDate === null) { - onChange(dayjs.unix(Number(state.inheritedValue.raw_value)), state.inheritedValue.raw_value); - handleSubmit('', state.attribute.id); + if ((state.isInheritedValue || state.isCalculatedValue) && datePickerDate === null) { + _resetToInheritedOrCalculatedValue(); return; } @@ -81,6 +89,19 @@ export const DSDatePickerWrapper: FunctionComponent = handleSubmit(dateToSave, state.attribute.id); }; + const _getHelper = () => { + if (state.isInheritedOverrideValue) { + return t('record_edition.inherited_input_helper', { + inheritedValue: state.inheritedValue.value + }); + } else if (state.isCalculatedOverrideValue) { + return t('record_edition.calculated_input_helper', { + calculatedValue: state.calculatedValue.value + }); + } + return; + }; + const label = localizedTranslation(state.formElement.settings.label, availableLangs); return ( @@ -91,18 +112,12 @@ export const DSDatePickerWrapper: FunctionComponent = label={label} required={state.formElement.settings.required} disabled={state.isReadOnly} - allowClear={!state.isInheritedNotOverrideValue} + allowClear={!state.isInheritedNotOverrideValue && !state.isCalculatedNotOverrideValue} status={errors.length > 0 ? 'error' : undefined} onInfoClick={shouldShowValueDetailsButton ? onValueDetailsButtonClick : null} - helper={ - state.isInheritedOverrideValue - ? t('record_edition.inherited_input_helper', { - inheritedValue: state.inheritedValue.value - }) - : undefined - } + helper={_getHelper()} onBlur={handleBlur} - $shouldHighlightColor={state.isInheritedNotOverrideValue} + $shouldHighlightColor={state.isInheritedNotOverrideValue || state.isCalculatedNotOverrideValue} /> ); }; diff --git a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputEncryptedWrapper.test.tsx b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputEncryptedWrapper.test.tsx index 7525ca919..5e4077292 100644 --- a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputEncryptedWrapper.test.tsx +++ b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputEncryptedWrapper.test.tsx @@ -5,6 +5,7 @@ import {render, screen} from '_ui/_tests/testUtils'; import {DSInputEncryptedWrapper} from './DSInputEncryptedWrapper'; import {VersionFieldScope} from '../../../_types'; import { + CalculatedFlags, InheritedFlags, IStandardFieldReducerState, StandardFieldValueState @@ -71,7 +72,11 @@ const getInitialState = ({ inheritedValue: null, isInheritedNotOverrideValue: false, isInheritedOverrideValue: false, - isInheritedValue: false + isInheritedValue: false, + calculatedValue: null, + isCalculatedNotOverrideValue: false, + isCalculatedOverrideValue: false, + isCalculatedValue: false }); const inheritedValues: RecordFormElementsValueStandardValue[] = [ @@ -101,6 +106,33 @@ const inheritedOverrideValue: InheritedFlags = { inheritedValue: {raw_value: inheritedValues[1].raw_value} }; +const calculatedValues: RecordFormElementsValueStandardValue[] = [ + { + isCalculated: null, + value: 'override value', + raw_value: 'override value' + }, + { + isCalculated: true, + value: 'calculated value', + raw_value: 'calculated value' + } +]; + +const calculatedNotOverrideValue: CalculatedFlags = { + isCalculatedValue: true, + isCalculatedOverrideValue: false, + isCalculatedNotOverrideValue: true, + calculatedValue: {raw_value: calculatedValues[1].raw_value} +}; + +const calculatedOverrideValue: CalculatedFlags = { + isCalculatedValue: true, + isCalculatedOverrideValue: true, + isCalculatedNotOverrideValue: false, + calculatedValue: {raw_value: calculatedValues[1].raw_value} +}; + describe('DSInputEncryptedWrapper', () => { const mockHandleSubmit = jest.fn(); const mockOnChange = jest.fn(); @@ -303,4 +335,98 @@ describe('DSInputEncryptedWrapper', () => { expect(mockHandleSubmit).toHaveBeenCalledWith('', state.attribute.id); }); }); + + describe('With calculation', () => { + test("Should display the calculated value by default and not save if we don't change it", async () => { + let state = getInitialState({required: false, fallbackLang: false}); + state = { + ...state, + ...calculatedNotOverrideValue, + formElement: {...state.formElement, values: calculatedValues} + }; + render( + + + + + + ); + const input = screen.getByTestId('kit-input-password'); + expect(input).toHaveValue(calculatedValues[1].raw_value); + + expect(screen.queryByRole('button')).toBeNull(); + + await user.click(input); + await user.tab(); + + expect(mockHandleSubmit).not.toHaveBeenCalled(); + }); + + test('Should display the override value in the input and calculated value under it', async () => { + let state = getInitialState({required: false, fallbackLang: false}); + state = { + ...state, + ...calculatedOverrideValue, + formElement: {...state.formElement, values: calculatedValues} + }; + + render( + + + + + + ); + + const input = screen.getByTestId('kit-input-password'); + const helperText = screen.getByText(/calculated value/); + expect(input).toHaveValue(calculatedValues[0].raw_value); + expect(helperText).toBeInTheDocument(); + }); + + test("Should allow to clear input when it's override", async () => { + let state = getInitialState({required: false, fallbackLang: false}); + state = { + ...state, + ...calculatedOverrideValue, + formElement: {...state.formElement, values: calculatedValues} + }; + render( + + + + + + ); + const clearButton = screen.getByRole('button'); + + await user.click(clearButton); + + expect(mockHandleSubmit).toHaveBeenCalledWith('', state.attribute.id); + }); + }); }); diff --git a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputEncryptedWrapper.tsx b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputEncryptedWrapper.tsx index e1f599bc7..d1ec3c8d4 100644 --- a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputEncryptedWrapper.tsx +++ b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputEncryptedWrapper.tsx @@ -62,9 +62,13 @@ export const DSInputEncryptedWrapper: FunctionComponent { + const _resetToInheritedOrCalculatedValue = () => { setHasChanged(false); - onChange(state.inheritedValue.raw_value); + if (state.isInheritedValue) { + onChange(state.inheritedValue.raw_value); + } else if (state.isCalculatedValue) { + onChange(state.calculatedValue.raw_value); + } handleSubmit('', state.attribute.id); }; @@ -75,12 +79,12 @@ export const DSInputEncryptedWrapper: FunctionComponent) => { setHasChanged(true); const inputValue = event.target.value; - if (state.isInheritedValue && inputValue === '' && event.type === 'click') { - _resetToInheritedValue(); + if ((state.isInheritedValue || state.isCalculatedValue) && inputValue === '' && event.type === 'click') { + _resetToInheritedOrCalculatedValue(); return; } onChange(event); }; + const _getHelper = () => { + if (state.isInheritedOverrideValue) { + return t('record_edition.inherited_input_helper', { + inheritedValue: state.inheritedValue.raw_value + }); + } else if (state.isCalculatedOverrideValue) { + return t('record_edition.calculated_input_helper', { + calculatedValue: state.calculatedValue.raw_value + }); + } + return; + }; + const label = localizedTranslation(state.formElement.settings.label, availableLang); return ( @@ -109,19 +126,15 @@ export const DSInputEncryptedWrapper: FunctionComponent 0 ? 'error' : undefined} onInfoClick={shouldShowValueDetailsButton ? onValueDetailsButtonClick : null} - helper={ - state.isInheritedOverrideValue - ? t('record_edition.inherited_input_helper', { - inheritedValue: state.inheritedValue.raw_value - }) - : undefined - } + helper={_getHelper()} value={value} disabled={state.isReadOnly} - allowClear={!state.isInheritedNotOverrideValue} + allowClear={!state.isInheritedNotOverrideValue && !state.isCalculatedNotOverrideValue} onBlur={_handleOnBlur} onChange={_handleOnChange} - $shouldHighlightColor={!hasChanged && state.isInheritedNotOverrideValue} + $shouldHighlightColor={ + !hasChanged && (state.isInheritedNotOverrideValue || state.isCalculatedNotOverrideValue) + } /> ); }; diff --git a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.test.tsx b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.test.tsx index 65ad8e091..25093000b 100644 --- a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.test.tsx +++ b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.test.tsx @@ -5,6 +5,7 @@ import {render, screen} from '_ui/_tests/testUtils'; import {DSInputNumberWrapper} from './DSInputNumberWrapper'; import {VersionFieldScope} from '../../../_types'; import { + CalculatedFlags, InheritedFlags, IStandardFieldReducerState, StandardFieldValueState @@ -66,7 +67,11 @@ const getInitialState = (required: boolean, fallbackLang = false): IStandardFiel inheritedValue: null, isInheritedNotOverrideValue: false, isInheritedOverrideValue: false, - isInheritedValue: false + isInheritedValue: false, + calculatedValue: null, + isCalculatedNotOverrideValue: false, + isCalculatedOverrideValue: false, + isCalculatedValue: false }); const inheritedValues = [ @@ -96,6 +101,33 @@ const inheritedOverrideValue: InheritedFlags = { inheritedValue: {raw_value: inheritedValues[1].raw_value} }; +const calculatedValues = [ + { + isCalculated: null, + value: '8', + raw_value: '8' + }, + { + isCalculated: true, + value: '3.5', + raw_value: '3.5' + } +]; + +const calculatedNotOverrideValue: CalculatedFlags = { + isCalculatedValue: true, + isCalculatedOverrideValue: false, + isCalculatedNotOverrideValue: true, + calculatedValue: {raw_value: calculatedValues[1].raw_value} +}; + +const calculatedOverrideValue: CalculatedFlags = { + isCalculatedValue: true, + isCalculatedOverrideValue: true, + isCalculatedNotOverrideValue: false, + calculatedValue: {raw_value: calculatedValues[1].raw_value} +}; + describe('DSInputNumberWrapper', () => { const mockHandleSubmit = jest.fn(); const mockOnChange = jest.fn(); @@ -355,4 +387,130 @@ describe('DSInputNumberWrapper', () => { expect(helperText).toBeVisible(); }); }); + + describe('With calculation', () => { + test("Should display the calculated value by default and not save if we don't change it", async () => { + let state = getInitialState(false); + state = { + ...state, + ...calculatedNotOverrideValue, + formElement: {...state.formElement, values: calculatedValues} + }; + render( + + + + + + ); + const input = screen.getByRole('spinbutton'); + expect(input).toHaveValue(calculatedValues[1].raw_value); + + await user.click(input); + await user.tab(); + + expect(mockHandleSubmit).not.toHaveBeenCalled(); + }); + + test('Should display the override value in the input and calculated value under it', async () => { + let state = getInitialState(false); + state = { + ...state, + ...calculatedOverrideValue, + formElement: {...state.formElement, values: calculatedValues} + }; + + render( + + + + + + ); + + const input = screen.getByRole('spinbutton'); + const helperText = screen.getByText(/3.5/); + expect(input).toHaveValue(calculatedValues[0].raw_value); + expect(helperText).toBeVisible(); + }); + }); + + describe('With required and calculation', () => { + test("Should display the calculated value by default and not save if we don't change it", async () => { + let state = getInitialState(true); + state = { + ...state, + ...calculatedNotOverrideValue, + formElement: {...state.formElement, values: calculatedValues} + }; + render( + + + + + + ); + const input = screen.getByRole('spinbutton'); + expect(input).toHaveValue(calculatedValues[1].raw_value); + + await user.click(input); + await user.tab(); + + expect(mockHandleSubmit).not.toHaveBeenCalled(); + }); + + test('Should display the override value in the input and calculated value under it', async () => { + let state = getInitialState(false); + state = { + ...state, + ...calculatedOverrideValue, + formElement: {...state.formElement, values: calculatedValues} + }; + + render( + + + + + + ); + + const input = screen.getByRole('spinbutton'); + const helperText = screen.getByText(/3.5/); + expect(input).toHaveValue(calculatedValues[0].raw_value); + expect(helperText).toBeVisible(); + }); + }); }); diff --git a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.tsx b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.tsx index 24d654bac..1c3b37aef 100644 --- a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.tsx +++ b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.tsx @@ -64,9 +64,13 @@ export const DSInputNumberWrapper: FunctionComponent = ({ } }, [fieldValue.isEditing]); - const _resetToInheritedValue = () => { + const _resetToInheritedOrCalculatedValue = () => { setHasChanged(false); - onChange(state.inheritedValue.raw_value); + if (state.isInheritedValue) { + onChange(state.inheritedValue.raw_value); + } else if (state.isCalculatedValue) { + onChange(state.calculatedValue.raw_value); + } handleSubmit('', state.attribute.id); }; @@ -77,12 +81,12 @@ export const DSInputNumberWrapper: FunctionComponent = ({ } const valueToSubmit = event.target.value; - if (valueToSubmit === '' && state.isInheritedValue) { - _resetToInheritedValue(); + if (valueToSubmit === '' && (state.isInheritedValue || state.isCalculatedValue)) { + _resetToInheritedOrCalculatedValue(); return; } - if (hasChanged || !state.isInheritedValue) { + if (hasChanged || (!state.isInheritedValue && !state.isCalculatedValue)) { handleSubmit(valueToSubmit, state.attribute.id); } @@ -94,6 +98,19 @@ export const DSInputNumberWrapper: FunctionComponent = ({ onChange(inputValue); }; + const _getHelper = () => { + if (state.isInheritedOverrideValue) { + return t('record_edition.inherited_input_helper', { + inheritedValue: state.inheritedValue.raw_value + }); + } else if (state.isCalculatedOverrideValue) { + return t('record_edition.calculated_input_helper', { + calculatedValue: state.calculatedValue.raw_value + }); + } + return; + }; + const label = localizedTranslation(state.formElement.settings.label, lang); return ( @@ -103,18 +120,14 @@ export const DSInputNumberWrapper: FunctionComponent = ({ label={label} onInfoClick={shouldShowValueDetailsButton ? onValueDetailsButtonClick : null} status={errors.length > 0 ? 'error' : undefined} - helper={ - state.isInheritedOverrideValue - ? t('record_edition.inherited_input_helper', { - inheritedValue: state.inheritedValue.raw_value - }) - : undefined - } + helper={_getHelper()} value={value} onChange={_handleOnChange} disabled={state.isReadOnly} onBlur={_handleOnBlur} - $shouldHighlightColor={!hasChanged && state.isInheritedNotOverrideValue} + $shouldHighlightColor={ + !hasChanged && (state.isInheritedNotOverrideValue || state.isCalculatedNotOverrideValue) + } /> ); }; diff --git a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.test.tsx b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.test.tsx index 6b8605b66..f198b2158 100644 --- a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.test.tsx +++ b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.test.tsx @@ -5,6 +5,7 @@ import {render, screen} from '_ui/_tests/testUtils'; import {DSInputWrapper} from './DSInputWrapper'; import {VersionFieldScope} from '../../../_types'; import { + CalculatedFlags, InheritedFlags, IStandardFieldReducerState, StandardFieldValueState @@ -64,7 +65,11 @@ const getInitialState = (required: boolean, fallbackLang = false): IStandardFiel inheritedValue: null, isInheritedNotOverrideValue: false, isInheritedOverrideValue: false, - isInheritedValue: false + isInheritedValue: false, + calculatedValue: null, + isCalculatedNotOverrideValue: false, + isCalculatedOverrideValue: false, + isCalculatedValue: false }); const inheritedValues = [ @@ -94,6 +99,33 @@ const inheritedOverrideValue: InheritedFlags = { inheritedValue: {raw_value: inheritedValues[1].raw_value} }; +const calculatedValues = [ + { + isCalculated: null, + value: 'override value', + raw_value: 'override value' + }, + { + isCalculated: true, + value: 'calculated value', + raw_value: 'calculated value' + } +]; + +const calculatedNotOverrideValue: CalculatedFlags = { + isCalculatedValue: true, + isCalculatedOverrideValue: false, + isCalculatedNotOverrideValue: true, + calculatedValue: {raw_value: calculatedValues[1].raw_value} +}; + +const calculatedOverrideValue: CalculatedFlags = { + isCalculatedValue: true, + isCalculatedOverrideValue: true, + isCalculatedNotOverrideValue: false, + calculatedValue: {raw_value: calculatedValues[1].raw_value} +}; + describe('DSInputWrapper', () => { const mockHandleSubmit = jest.fn(); const mockOnChange = jest.fn(); @@ -295,4 +327,98 @@ describe('DSInputWrapper', () => { expect(mockHandleSubmit).toHaveBeenCalledWith('', state.attribute.id); }); }); + + describe('With calculation', () => { + test("Should display the calculated value by default and not save if we don't change it", async () => { + let state = getInitialState(false); + state = { + ...state, + ...calculatedNotOverrideValue, + formElement: {...state.formElement, values: calculatedValues} + }; + render( + + + + + + ); + const input = screen.getByRole('textbox'); + expect(input).toHaveValue(calculatedValues[1].raw_value); + + expect(screen.queryByRole('button')).toBeNull(); + + await user.click(input); + await user.tab(); + + expect(mockHandleSubmit).not.toHaveBeenCalled(); + }); + + test('Should display the override value in the input and calculated value under it', async () => { + let state = getInitialState(false); + state = { + ...state, + ...calculatedOverrideValue, + formElement: {...state.formElement, values: calculatedValues} + }; + + render( + + + + + + ); + + const input = screen.getByRole('textbox'); + const helperText = screen.getByText(/calculated value/); + expect(input).toHaveValue(calculatedValues[0].raw_value); + expect(helperText).toBeInTheDocument(); + }); + + test("Should allow to clear input when it's override", async () => { + let state = getInitialState(false); + state = { + ...state, + ...calculatedOverrideValue, + formElement: {...state.formElement, values: calculatedValues} + }; + render( + + + + + + ); + const clearButton = screen.getByRole('button'); + + await user.click(clearButton); + + expect(mockHandleSubmit).toHaveBeenCalledWith('', state.attribute.id); + }); + }); }); diff --git a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.tsx b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.tsx index bcfa19e7e..a6cb7f508 100644 --- a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.tsx +++ b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.tsx @@ -55,9 +55,13 @@ export const DSInputWrapper: FunctionComponent = ({ } }, [fieldValue.isEditing]); - const _resetToInheritedValue = () => { + const _resetToInheritedOrCalculatedValue = () => { setHasChanged(false); - onChange(state.inheritedValue.raw_value); + if (state.isInheritedValue) { + onChange(state.inheritedValue.raw_value); + } else if (state.isCalculatedValue) { + onChange(state.calculatedValue.raw_value); + } handleSubmit('', state.attribute.id); }; @@ -68,21 +72,21 @@ export const DSInputWrapper: FunctionComponent = ({ } const valueToSubmit = event.target.value; - if (valueToSubmit === '' && state.isInheritedValue) { - _resetToInheritedValue(); + if (valueToSubmit === '' && (state.isInheritedValue || state.isCalculatedValue)) { + _resetToInheritedOrCalculatedValue(); return; } - - handleSubmit(valueToSubmit, state.attribute.id); - + if (hasChanged || (!state.isInheritedValue && !state.isCalculatedValue)) { + handleSubmit(valueToSubmit, state.attribute.id); + } onChange(event); }; const _handleOnChange = (event: ChangeEvent) => { setHasChanged(true); const inputValue = event.target.value; - if (state.isInheritedValue && inputValue === '' && event.type === 'click') { - _resetToInheritedValue(); + if ((state.isInheritedValue || state.isCalculatedValue) && inputValue === '' && event.type === 'click') { + _resetToInheritedOrCalculatedValue(); return; } @@ -93,6 +97,19 @@ export const DSInputWrapper: FunctionComponent = ({ onChange(event); }; + const _getHelper = () => { + if (state.isInheritedOverrideValue) { + return t('record_edition.inherited_input_helper', { + inheritedValue: state.inheritedValue.raw_value + }); + } else if (state.isCalculatedOverrideValue) { + return t('record_edition.calculated_input_helper', { + calculatedValue: state.calculatedValue.raw_value + }); + } + return; + }; + const label = localizedTranslation(state.formElement.settings.label, availableLang); return ( @@ -102,19 +119,15 @@ export const DSInputWrapper: FunctionComponent = ({ label={label} onInfoClick={shouldShowValueDetailsButton ? onValueDetailsButtonClick : null} status={errors.length > 0 ? 'error' : undefined} - helper={ - state.isInheritedOverrideValue - ? t('record_edition.inherited_input_helper', { - inheritedValue: state.inheritedValue.raw_value - }) - : undefined - } + helper={_getHelper()} value={value} disabled={state.isReadOnly} - allowClear={!state.isInheritedNotOverrideValue} + allowClear={!state.isInheritedNotOverrideValue && !state.isCalculatedNotOverrideValue} onBlur={_handleOnBlur} onChange={_handleOnChange} - $shouldHighlightColor={!hasChanged && state.isInheritedNotOverrideValue} + $shouldHighlightColor={ + !hasChanged && (state.isInheritedNotOverrideValue || state.isCalculatedNotOverrideValue) + } /> ); }; diff --git a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.test.tsx b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.test.tsx index 0dd865ea1..29882c8c1 100644 --- a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.test.tsx +++ b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.test.tsx @@ -64,7 +64,11 @@ const getInitialState = (required: boolean, fallbackLang = false): IStandardFiel inheritedValue: null, isInheritedNotOverrideValue: false, isInheritedOverrideValue: false, - isInheritedValue: false + isInheritedValue: false, + calculatedValue: null, + isCalculatedNotOverrideValue: false, + isCalculatedOverrideValue: false, + isCalculatedValue: false }); describe('DSRangePickerWrapper', () => { @@ -379,4 +383,124 @@ describe('DSRangePickerWrapper', () => { expect(clearButton).toBeNull(); }); }); + + describe('Calculated values', () => { + test('Should not display helper without calculated value', async () => { + const state = getInitialState(false); + state.calculatedValue = null; + state.isCalculatedOverrideValue = false; + render( +
+ + + +
+ ); + + expect( + screen.queryByText('record_edition.calculated_input_helper', {exact: false}) + ).not.toBeInTheDocument(); + }); + + test('Should display helper with calculated value', async () => { + const state = getInitialState(false); + state.calculatedValue = mockValue.value; + state.isCalculatedOverrideValue = true; + render( +
+ + + +
+ ); + + expect(screen.getByText('record_edition.calculated_input_helper', {exact: false})).toBeVisible(); + }); + + test('Should call onChange/handleSubmit with calculated value on clear', async () => { + const raw_value = { + from: '1714138054', + to: '1714138054' + }; + const state = getInitialState(false); + state.calculatedValue = {...mockValue.value, raw_value}; + state.isCalculatedValue = true; + state.isCalculatedOverrideValue = true; + state.isCalculatedNotOverrideValue = false; + render( +
+ + + +
+ ); + + // TODO : target clear button when DS add html attribute - Ticket DS-219 + const clearButton = screen.getByRole('button'); + await user.click(clearButton); + + expect(mockOnChange).toHaveBeenCalledTimes(1); + expect(mockOnChange).toHaveBeenCalledWith([expect.any(Object), expect.any(Object)], raw_value); + expect(mockHandleSubmit).toHaveBeenCalledTimes(1); + expect(mockHandleSubmit).toHaveBeenCalledWith('', state.attribute.id); + }); + + test('Should hide clear icon when value is calculated, but not override', async () => { + const raw_value = { + from: '1714138054', + to: '1714138054' + }; + const state = getInitialState(false); + state.calculatedValue = {...mockValue.value, raw_value}; + state.isCalculatedValue = true; + state.isCalculatedOverrideValue = false; + state.isCalculatedNotOverrideValue = true; + render( +
+ + + +
+ ); + + const clearButton = screen.queryByRole('button'); + expect(clearButton).toBeNull(); + }); + }); }); diff --git a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.tsx b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.tsx index f68eca449..f70f49d54 100644 --- a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.tsx +++ b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.tsx @@ -57,11 +57,8 @@ export const DSRangePickerWrapper: FunctionComponent } }, [fieldValue.isEditing]); - const _handleDateChange: ( - rangePickerDates: [from: dayjs.Dayjs, to: dayjs.Dayjs] | null, - antOnChangeParams: [from: string, to: string] | null - ) => void = (rangePickerDates, ...antOnChangeParams) => { - if (state.isInheritedValue && rangePickerDates === null) { + const _resetToInheritedOrCalculatedValue = () => { + if (state.isInheritedValue) { onChange( [ dayjs.unix(Number(state.inheritedValue.raw_value.from)), @@ -69,7 +66,24 @@ export const DSRangePickerWrapper: FunctionComponent ], state.inheritedValue.raw_value ); - handleSubmit('', state.attribute.id); + } else if (state.isCalculatedValue) { + onChange( + [ + dayjs.unix(Number(state.calculatedValue.raw_value.from)), + dayjs.unix(Number(state.calculatedValue.raw_value.to)) + ], + state.calculatedValue.raw_value + ); + } + handleSubmit('', state.attribute.id); + }; + + const _handleDateChange: ( + rangePickerDates: [from: dayjs.Dayjs, to: dayjs.Dayjs] | null, + antOnChangeParams: [from: string, to: string] | null + ) => void = (rangePickerDates, ...antOnChangeParams) => { + if ((state.isInheritedValue || state.isCalculatedValue) && rangePickerDates === null) { + _resetToInheritedOrCalculatedValue(); return; } @@ -96,6 +110,25 @@ export const DSRangePickerWrapper: FunctionComponent } }; + const _getHelper = () => { + if (state.isInheritedOverrideValue) { + return t('record_edition.inherited_input_helper', { + inheritedValue: t('record_edition.date_range_from_to', { + from: state.inheritedValue.value.from, + to: state.inheritedValue.value.to + }) + }); + } else if (state.isCalculatedOverrideValue) { + return t('record_edition.calculated_input_helper', { + calculatedValue: t('record_edition.date_range_from_to', { + from: state.calculatedValue.value.from, + to: state.calculatedValue.value.to + }) + }); + } + return; + }; + const label = localizedTranslation(state.formElement.settings.label, availableLangs); return ( @@ -107,21 +140,12 @@ export const DSRangePickerWrapper: FunctionComponent label={label} required={state.formElement.settings.required} disabled={state.isReadOnly} - allowClear={!state.isInheritedNotOverrideValue} + allowClear={!state.isInheritedNotOverrideValue && !state.isCalculatedNotOverrideValue} status={errors.length > 0 ? 'error' : undefined} onInfoClick={shouldShowValueDetailsButton ? onValueDetailsButtonClick : null} - helper={ - state.isInheritedOverrideValue - ? t('record_edition.inherited_input_helper', { - inheritedValue: t('record_edition.date_range_from_to', { - from: state.inheritedValue.value.from, - to: state.inheritedValue.value.to - }) - }) - : undefined - } onOpenChange={_handleOpenChange} - $shouldHighlightColor={state.isInheritedNotOverrideValue} + helper={_getHelper()} + $shouldHighlightColor={state.isInheritedNotOverrideValue || state.isCalculatedNotOverrideValue} /> ); }; diff --git a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.test.tsx b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.test.tsx index f9910cedc..7297de546 100644 --- a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.test.tsx +++ b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.test.tsx @@ -5,6 +5,7 @@ import {mockBrowserFunctionsForTiptap, render, screen} from '_ui/_tests/testUtil import {DSRichTextWrapper} from './DSRichTextWrapper'; import {VersionFieldScope} from '../../../_types'; import { + CalculatedFlags, InheritedFlags, IStandardFieldReducerState, StandardFieldValueState @@ -64,7 +65,11 @@ const getInitialState = (required: boolean, fallbackLang = false): IStandardFiel inheritedValue: null, isInheritedNotOverrideValue: false, isInheritedOverrideValue: false, - isInheritedValue: false + isInheritedValue: false, + calculatedValue: null, + isCalculatedNotOverrideValue: false, + isCalculatedOverrideValue: false, + isCalculatedValue: false }); const inheritedValues = [ @@ -94,6 +99,33 @@ const inheritedOverrideValue: InheritedFlags = { inheritedValue: {raw_value: inheritedValues[1].raw_value} }; +const calculatedValues = [ + { + isCalculated: null, + value: 'override value', + raw_value: 'override value' + }, + { + isCalculated: true, + value: 'calculated value', + raw_value: 'calculated value' + } +]; + +const calculatedNotOverrideValue: CalculatedFlags = { + isCalculatedValue: true, + isCalculatedOverrideValue: false, + isCalculatedNotOverrideValue: true, + calculatedValue: {raw_value: calculatedValues[1].raw_value} +}; + +const calculatedOverrideValue: CalculatedFlags = { + isCalculatedValue: true, + isCalculatedOverrideValue: true, + isCalculatedNotOverrideValue: false, + calculatedValue: {raw_value: calculatedValues[1].raw_value} +}; + const tiptapCleanup = mockBrowserFunctionsForTiptap(); describe('DSRichTextWrapper', () => { @@ -270,4 +302,68 @@ describe('DSRichTextWrapper', () => { expect(helperText).toBeInTheDocument(); }); }); + + describe('With calculation', () => { + test("Should display the calculated value by default and not save if we don't change it", async () => { + let state = getInitialState(false); + state = { + ...state, + ...calculatedNotOverrideValue, + formElement: {...state.formElement, values: calculatedValues} + }; + render( + + + + + + ); + + const input = screen.getByRole('textbox'); + expect(input).toContainHTML(calculatedValues[1].raw_value); + + await user.click(input); + await user.click(document.body); + + expect(mockHandleSubmit).not.toHaveBeenCalled(); + }); + + test('Should display the override value in the input and calculated value under it', async () => { + let state = getInitialState(false); + state = { + ...state, + ...calculatedOverrideValue, + formElement: {...state.formElement, values: calculatedValues} + }; + + render( + + + + + + ); + + const input = screen.getByRole('textbox'); + const helperText = screen.getByText(/calculated value/); + expect(input).toContainHTML(calculatedValues[0].raw_value); + expect(helperText).toBeInTheDocument(); + }); + }); }); diff --git a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.tsx b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.tsx index 4426013cb..cbb1cbb92 100644 --- a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.tsx +++ b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.tsx @@ -57,9 +57,13 @@ export const DSRichTextWrapper: FunctionComponent = ({ } }, [fieldValue.isEditing]); - const _resetToInheritedValue = () => { + const _resetToInheritedOrCalculatedValue = () => { setHasChanged(false); - onChange(state.inheritedValue.raw_value); + if (state.isInheritedValue) { + onChange(state.inheritedValue.raw_value); + } else if (state.isCalculatedValue) { + onChange(state.calculatedValue.raw_value); + } handleSubmit('', state.attribute.id); }; @@ -71,11 +75,11 @@ export const DSRichTextWrapper: FunctionComponent = ({ const valueToSubmit = isEmptyValue(inputValue) ? '' : inputValue; - if (valueToSubmit === '' && state.isInheritedValue) { - _resetToInheritedValue(); + if (valueToSubmit === '' && (state.isInheritedValue || state.isCalculatedValue)) { + _resetToInheritedOrCalculatedValue(); return; } - if (hasChanged || !state.isInheritedValue) { + if (hasChanged || (!state.isInheritedValue && !state.isCalculatedValue)) { handleSubmit(valueToSubmit, state.attribute.id); } onChange(valueToSubmit); @@ -85,12 +89,25 @@ export const DSRichTextWrapper: FunctionComponent = ({ const _handleOnChange = inputValue => { setHasChanged(true); if (state.isInheritedValue && isEmptyValue(inputValue)) { - _resetToInheritedValue(); + _resetToInheritedOrCalculatedValue(); return; } onChange(inputValue); }; + const _getHelper = () => { + if (state.isInheritedOverrideValue) { + return t('record_edition.inherited_input_helper', { + inheritedValue: state.inheritedValue.raw_value + }); + } else if (state.isCalculatedOverrideValue) { + return t('record_edition.calculated_input_helper', { + calculatedValue: state.calculatedValue.raw_value + }); + } + return; + }; + const label = localizedTranslation(state.formElement.settings.label, availableLang); return ( @@ -100,18 +117,14 @@ export const DSRichTextWrapper: FunctionComponent = ({ label={label} onInfoClick={shouldShowValueDetailsButton ? onValueDetailsButtonClick : null} status={errors.length > 0 ? 'error' : undefined} - helper={ - state.isInheritedOverrideValue - ? t('record_edition.inherited_input_helper', { - inheritedValue: state.inheritedValue.raw_value - }) - : undefined - } + helper={_getHelper()} value={value as string} disabled={state.isReadOnly} onChange={_handleOnChange} onBlur={_handleOnBlur} - $shouldHighlightColor={!hasChanged && state.isInheritedNotOverrideValue} + $shouldHighlightColor={ + (!hasChanged && state.isInheritedNotOverrideValue) || state.isCalculatedNotOverrideValue + } /> ); }; diff --git a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValueDisplayHandler/StandardFieldValueRead/StandardFieldValueRead.tsx b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValueDisplayHandler/StandardFieldValueRead/StandardFieldValueRead.tsx index 2a4fac85d..a47aae81c 100644 --- a/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValueDisplayHandler/StandardFieldValueRead/StandardFieldValueRead.tsx +++ b/libs/ui/src/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValueDisplayHandler/StandardFieldValueRead/StandardFieldValueRead.tsx @@ -66,6 +66,20 @@ export const StandardFieldValueRead: FunctionComponent { + switch (state.attribute.format) { + case AttributeFormat.date_range: + return t('record_edition.date_range_from_to', { + from: calculatedValue.value.from, + to: calculatedValue.value.to + }); + case AttributeFormat.encrypted: + return calculatedValue.value ? '●●●●●●●' : ''; + default: + return calculatedValue.value; + } + }; + const _handleFocus = (e: SyntheticEvent) => { if (state.isReadOnly) { return; @@ -95,7 +109,20 @@ export const StandardFieldValueRead: FunctionComponent { + if (state.isInheritedOverrideValue) { + return t('record_edition.inherited_input_helper', { + inheritedValue: _getInheritedValueForHelper(state.inheritedValue) + }); + } else if (state.isCalculatedOverrideValue) { + return t('record_edition.calculated_input_helper', { + calculatedValue: _getCalculatedValueForHelper(state.calculatedValue) + }); + } + return; + }; + + const isValueHighlighted = state.isInheritedNotOverrideValue || state.isCalculatedNotOverrideValue; return (