@leav/ui 0.3.6-7338b86 → 0.3.6-75eae8d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__mocks__/common/attribute.d.ts +1 -0
- package/dist/__mocks__/common/attribute.js +8 -1
- package/dist/__mocks__/common/attribute.js.map +1 -1
- package/dist/__mocks__/common/form.d.ts +1 -0
- package/dist/__mocks__/common/form.js +18 -2
- package/dist/__mocks__/common/form.js.map +1 -1
- package/dist/__mocks__/common/value.js +2 -1
- package/dist/__mocks__/common/value.js.map +1 -1
- package/dist/_gqlTypes/index.d.ts +102 -4
- package/dist/_gqlTypes/index.js +83 -2
- package/dist/_gqlTypes/index.js.map +1 -1
- package/dist/_queries/records/getRecordColumnsValues.d.ts +4 -2
- package/dist/_queries/records/getRecordColumnsValues.js +4 -1
- package/dist/_queries/records/getRecordColumnsValues.js.map +1 -1
- package/dist/_queries/records/recordFormAttributeFragment.js +1 -0
- package/dist/_queries/records/recordFormAttributeFragment.js.map +1 -1
- package/dist/_utils/interleaveElement.d.ts +1 -0
- package/dist/{components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducerContext.js → _utils/interleaveElement.js} +2 -6
- package/dist/_utils/interleaveElement.js.map +1 -0
- package/dist/components/CreateDirectory/CreateDirectory.js +1 -1
- package/dist/components/CreateDirectory/CreateDirectory.js.map +1 -1
- package/dist/components/EditApplication/EditApplication.js +2 -2
- package/dist/components/EditApplication/EditApplication.js.map +1 -1
- package/dist/components/EditApplication/_types.d.ts +2 -2
- package/dist/components/Explorer/DataView.d.ts +8 -0
- package/dist/components/Explorer/DataView.js +33 -7
- package/dist/components/Explorer/DataView.js.map +1 -1
- package/dist/components/Explorer/Explorer.d.ts +3 -3
- package/dist/components/Explorer/Explorer.js +42 -19
- package/dist/components/Explorer/Explorer.js.map +1 -1
- package/dist/components/Explorer/TableCell.d.ts +1 -1
- package/dist/components/Explorer/TableCell.js +116 -36
- package/dist/components/Explorer/TableCell.js.map +1 -1
- package/dist/components/Explorer/TableTagGroup.d.ts +1 -0
- package/dist/components/Explorer/TableTagGroup.js +9 -1
- package/dist/components/Explorer/TableTagGroup.js.map +1 -1
- package/dist/components/Explorer/_queries/useExplorerData.d.ts +22 -4
- package/dist/components/Explorer/_queries/useExplorerData.js +88 -4
- package/dist/components/Explorer/_queries/useExplorerData.js.map +1 -1
- package/dist/components/Explorer/_types.d.ts +23 -1
- package/dist/components/Explorer/display-view-filters/ExplorerFilterBar.d.ts +2 -0
- package/dist/components/Explorer/display-view-filters/ExplorerFilterBar.js +37 -0
- package/dist/components/Explorer/display-view-filters/ExplorerFilterBar.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.d.ts +1 -1
- package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.js +11 -4
- package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/_shared/CommonFilterItem.d.ts +5 -0
- package/dist/components/Explorer/manage-view-settings/_shared/CommonFilterItem.js +12 -0
- package/dist/components/Explorer/manage-view-settings/_shared/CommonFilterItem.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/_shared/useAttributeDetailsData.d.ts +11 -0
- package/dist/components/Explorer/manage-view-settings/_shared/useAttributeDetailsData.js +61 -0
- package/dist/components/Explorer/manage-view-settings/_shared/useAttributeDetailsData.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.js +19 -52
- package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.d.ts +4 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js +76 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.d.ts +9 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.js +33 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/BooleanAttributeDropdown.d.ts +3 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/BooleanAttributeDropdown.js +37 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/BooleanAttributeDropdown.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/DateAttributeDropDown.d.ts +3 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/DateAttributeDropDown.js +89 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/DateAttributeDropDown.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropDown.d.ts +3 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropDown.js +23 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropDown.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterValueList.d.ts +10 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterValueList.js +75 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterValueList.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/NumericAttributeDropDown.d.ts +3 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/NumericAttributeDropDown.js +44 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/NumericAttributeDropDown.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/SimpleFilterDropDown.d.ts +3 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/SimpleFilterDropDown.js +72 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/SimpleFilterDropDown.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/TextAttributeDropDown.d.ts +3 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/TextAttributeDropDown.js +53 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/TextAttributeDropDown.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/useConditionOptionsByType.d.ts +15 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/useConditionOptionsByType.js +114 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/useConditionOptionsByType.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/index.d.ts +4 -4
- package/dist/components/Explorer/manage-view-settings/index.js +3 -3
- package/dist/components/Explorer/manage-view-settings/index.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/open-view-settings/SidePanel.js +1 -1
- package/dist/components/Explorer/manage-view-settings/open-view-settings/SidePanel.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.d.ts +3 -0
- package/dist/components/Explorer/manage-view-settings/open-view-settings/{useOpenSettings.js → useOpenViewSettings.js} +5 -3
- package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.d.ts +1 -1
- package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js +5 -5
- package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.d.ts +4 -0
- package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.js +109 -0
- package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.d.ts +10 -0
- package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.js +32 -0
- package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsInitialState.d.ts +2 -0
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsInitialState.js +9 -1
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsInitialState.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.d.ts +111 -16
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js +161 -24
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js.map +1 -1
- package/dist/components/Explorer/useDeactivateAction.js +3 -2
- package/dist/components/Explorer/useDeactivateAction.js.map +1 -1
- package/dist/components/Explorer/useEditAction.js +5 -3
- package/dist/components/Explorer/useEditAction.js.map +1 -1
- package/dist/components/Explorer/usePagination.d.ts +7 -0
- package/dist/components/Explorer/usePagination.js +25 -0
- package/dist/components/Explorer/usePagination.js.map +1 -0
- package/dist/components/Explorer/usePrimaryActions.d.ts +1 -9
- package/dist/components/Explorer/usePrimaryActions.js +4 -12
- package/dist/components/Explorer/usePrimaryActions.js.map +1 -1
- package/dist/components/Explorer/useSearchInput.d.ts +10 -0
- package/dist/components/Explorer/useSearchInput.js +31 -0
- package/dist/components/Explorer/useSearchInput.js.map +1 -0
- package/dist/components/Explorer/useTableScrollableHeight.d.ts +5 -0
- package/dist/components/Explorer/useTableScrollableHeight.js +15 -0
- package/dist/components/Explorer/useTableScrollableHeight.js.map +1 -0
- package/dist/components/Explorer/useViewSettingsReducer.d.ts +7 -0
- package/dist/components/Explorer/useViewSettingsReducer.js +60 -0
- package/dist/components/Explorer/useViewSettingsReducer.js.map +1 -0
- package/dist/components/ExportModal/ExportModal.js +2 -2
- package/dist/components/ExportModal/ExportModal.js.map +1 -1
- package/dist/components/ImportModal/ImportModalConfigStep/ImportModalConfigStep.js +5 -5
- package/dist/components/ImportModal/ImportModalConfigStep/ImportModalConfigStep.js.map +1 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.js +2 -2
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js +15 -2
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/_types.d.ts +5 -16
- package/dist/components/RecordEdition/EditRecordContent/_types.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/antdUtils.d.ts +5 -1
- package/dist/components/RecordEdition/EditRecordContent/antdUtils.js +15 -8
- package/dist/components/RecordEdition/EditRecordContent/antdUtils.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.d.ts +3 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.js +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/MonoValueSelect.d.ts +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/MonoValueSelect.js +2 -7
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/MonoValueSelect.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/MultiValueSelect.d.ts +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/MultiValueSelect.js +2 -9
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/MultiValueSelect.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/ComputeIndicator.d.ts +6 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/ComputeIndicator.js +18 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/ComputeIndicator.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.d.ts +4 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +94 -294
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.js +8 -9
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSColorPickerWrapper.js +28 -22
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSColorPickerWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.js +26 -18
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputEncryptedWrapper.js +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputEncryptedWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.js +16 -13
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.js +22 -19
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.js +44 -42
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.js +19 -19
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.d.ts +13 -9
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.js +25 -402
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/{MonoValueSelect.d.ts → DSListSelect.d.ts} +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/{MonoValueSelect.js → DSListSelect.js} +32 -13
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/DSListSelect.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/_types.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/_types.d.ts +10 -4
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/calculatedInheritedFlags.d.ts +42 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/calculatedInheritedFlags.js +55 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/calculatedInheritedFlags.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/useGetPresentationValues.d.ts +12 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/useGetPresentationValues.js +37 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/useGetPresentationValues.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/ValuesAdd/ValuesAdd.js +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/ValuesAdd/ValuesAdd.js.map +1 -1
- package/dist/components/SelectTreeNode/SelectTreeNode.d.ts +4 -7
- package/dist/components/SelectTreeNode/SelectTreeNode.js +17 -135
- package/dist/components/SelectTreeNode/SelectTreeNode.js.map +1 -1
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.d.ts +16 -0
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.js +131 -0
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.js.map +1 -0
- package/dist/components/SelectTreeNode/index.d.ts +1 -1
- package/dist/components/SelectTreeNode/index.js +1 -1
- package/dist/components/SelectTreeNode/index.js.map +1 -1
- package/dist/components/SelectTreeNodeModal/SelectTreeNodeModal.d.ts +4 -7
- package/dist/components/SelectTreeNodeModal/SelectTreeNodeModal.js +10 -10
- package/dist/components/SelectTreeNodeModal/SelectTreeNodeModal.js.map +1 -1
- package/dist/components/SelectTreeNodeModal/index.d.ts +1 -2
- package/dist/components/SelectTreeNodeModal/index.js +1 -2
- package/dist/components/SelectTreeNodeModal/index.js.map +1 -1
- package/dist/components/UploadFiles/UploadFiles.js +1 -1
- package/dist/components/UploadFiles/UploadFiles.js.map +1 -1
- package/dist/components/ValuesVersionConfigurator/VersionTree/VersionTree.js +2 -2
- package/dist/components/ValuesVersionConfigurator/VersionTree/VersionTree.js.map +1 -1
- package/dist/hooks/useDebouncedValue/index.d.ts +1 -0
- package/dist/{components/RecordEdition/EditRecordContent/reducers/standardFieldReducer → hooks/useDebouncedValue}/index.js +1 -2
- package/dist/hooks/useDebouncedValue/index.js.map +1 -0
- package/dist/locales/en/shared.json +34 -6
- package/dist/locales/fr/shared.json +34 -6
- package/package.json +5 -2
- package/dist/components/Explorer/manage-view-settings/_shared/useGetLibraryColumns.d.ts +0 -10
- package/dist/components/Explorer/manage-view-settings/_shared/useGetLibraryColumns.js +0 -24
- package/dist/components/Explorer/manage-view-settings/_shared/useGetLibraryColumns.js.map +0 -1
- package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenSettings.d.ts +0 -1
- package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenSettings.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducer.d.ts +0 -138
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducer.js +0 -361
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducer.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducerContext.d.ts +0 -7
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/standardFieldReducerContext.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/useStandardFieldReducer.d.ts +0 -1
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/useStandardFieldReducer.js +0 -7
- package/dist/components/RecordEdition/EditRecordContent/reducers/standardFieldReducer/useStandardFieldReducer.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/CheckboxInput.d.ts +0 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/CheckboxInput.js +0 -14
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/CheckboxInput.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/ColorInput.d.ts +0 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/ColorInput.js +0 -22
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/ColorInput.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/DateInput.d.ts +0 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/DateInput.js +0 -22
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/DateInput.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/EncryptedInput.d.ts +0 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/EncryptedInput.js +0 -19
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/EncryptedInput.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/NumberInput.d.ts +0 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/NumberInput.js +0 -32
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/NumberInput.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/RichTextEditorInput.d.ts +0 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/RichTextEditorInput.js +0 -51
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/RichTextEditorInput.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/TextInput.d.ts +0 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/TextInput.js +0 -26
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/Inputs/TextInput.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/MonoValueSelect.js.map +0 -1
|
@@ -8,11 +8,10 @@ import useSharedTranslation from '../../../../../../hooks/useSharedTranslation/u
|
|
|
8
8
|
import { useGetOptionsQuery } from './useGetOptionsQuery';
|
|
9
9
|
import { useDebouncedValue } from '../../../../../../hooks/useDebouncedValue/useDebouncedValue';
|
|
10
10
|
import styled from 'styled-components';
|
|
11
|
-
import { useValueDetailsButton } from '../../../../../../components/RecordEdition/EditRecordContent/shared/ValueDetailsBtn/useValueDetailsButton';
|
|
12
11
|
const ResultsCount = styled(KitTypography.Text) `
|
|
13
12
|
margin-bottom: calc(var(--general-spacing-s) * 1px);
|
|
14
13
|
`;
|
|
15
|
-
export const MonoValueSelect = ({ value, onChange, activeValue, attribute, label, onSelectChange, onSelectClear, required = false
|
|
14
|
+
export const MonoValueSelect = ({ value, onChange, activeValue, attribute, label, onSelectChange, onSelectClear, required = false }) => {
|
|
16
15
|
if (!onChange) {
|
|
17
16
|
throw Error('MonoValueSelect should be used inside a antd Form.Item');
|
|
18
17
|
}
|
|
@@ -26,10 +25,6 @@ export const MonoValueSelect = ({ value, onChange, activeValue, attribute, label
|
|
|
26
25
|
linkedLibraryId: attribute.linked_library.id,
|
|
27
26
|
onSelectChange
|
|
28
27
|
});
|
|
29
|
-
const { onValueDetailsButtonClick } = useValueDetailsButton({
|
|
30
|
-
value: null,
|
|
31
|
-
attribute
|
|
32
|
-
});
|
|
33
28
|
const handleSelect = async (optionValue, ...antOnChangeParams) => {
|
|
34
29
|
onChange(optionValue, antOnChangeParams);
|
|
35
30
|
await form.validateFields([attribute.id]);
|
|
@@ -43,7 +38,7 @@ export const MonoValueSelect = ({ value, onChange, activeValue, attribute, label
|
|
|
43
38
|
useEffect(() => {
|
|
44
39
|
runFullTextSearch(debouncedSearchInput);
|
|
45
40
|
}, [debouncedSearchInput]);
|
|
46
|
-
return (_jsx(KitSelect, { loading: loading, value: value, required: required, label: label, options: selectOptions, status: errors.length > 0 && 'error', showSearch: true, optionFilterProp: "label", placeholder: t('record_edition.placeholder.record_select'), onSelect: handleSelect, onChange: onChange, onClear: required ? undefined : handleClear, allowClear: !required,
|
|
41
|
+
return (_jsx(KitSelect, { htmlFor: attribute.id, loading: loading, value: value, required: required, label: label, options: selectOptions, status: errors.length > 0 && 'error', showSearch: true, optionFilterProp: "label", placeholder: t('record_edition.placeholder.record_select'), onSelect: handleSelect, onChange: onChange, onClear: required ? undefined : handleClear, allowClear: !required, onSearch: handleSearch, filterOption: false, dropdownRender: menu => {
|
|
47
42
|
if (loading) {
|
|
48
43
|
return menu;
|
|
49
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonoValueSelect.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/MonoValueSelect.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAoB,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAE7D,OAAO,oBAAoB,MAAM,qDAAqD,CAAC;AAIvF,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAGxD,OAAO,EAAC,iBAAiB,EAAC,MAAM,+CAA+C,CAAC;AAChF,OAAO,MAAM,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"MonoValueSelect.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/MonoValueSelect.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAoB,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAE7D,OAAO,oBAAoB,MAAM,qDAAqD,CAAC;AAIvF,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAGxD,OAAO,EAAC,iBAAiB,EAAC,MAAM,+CAA+C,CAAC;AAChF,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,MAAM,YAAY,GAAG,MAAM,C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AAC,KAAK,EAAE,gBAAgB,EAAC,CAAC,GAC3D,EACd,IAAI,IACN,CACN,CAAC;QACN,CAAC,GACH,CACL,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -15,7 +15,6 @@ interface IMultiValueSelectProps extends IProvidedByAntFormItem<SelectProps<stri
|
|
|
15
15
|
idValue: string;
|
|
16
16
|
}>) => void;
|
|
17
17
|
required?: boolean;
|
|
18
|
-
shouldShowValueDetailsButton?: boolean;
|
|
19
18
|
}
|
|
20
19
|
export declare const MultiValueSelect: FunctionComponent<IMultiValueSelectProps>;
|
|
21
20
|
export {};
|
|
@@ -6,8 +6,7 @@ import { useState } from 'react';
|
|
|
6
6
|
import { AntForm, KitSelect } from 'aristid-ds';
|
|
7
7
|
import useSharedTranslation from '../../../../../../hooks/useSharedTranslation/useSharedTranslation';
|
|
8
8
|
import { useGetOptionsQuery } from './useGetOptionsQuery';
|
|
9
|
-
|
|
10
|
-
export const MultiValueSelect = ({ value, onChange, activeValues, attribute, label, onValueDeselect, onSelectChange, required = false, shouldShowValueDetailsButton = false }) => {
|
|
9
|
+
export const MultiValueSelect = ({ value, onChange, activeValues, attribute, label, onValueDeselect, onSelectChange, required = false }) => {
|
|
11
10
|
if (!onChange) {
|
|
12
11
|
throw Error('MultiValueSelect should be used inside a antd Form.Item');
|
|
13
12
|
}
|
|
@@ -19,10 +18,6 @@ export const MultiValueSelect = ({ value, onChange, activeValues, attribute, lab
|
|
|
19
18
|
attribute,
|
|
20
19
|
onSelectChange
|
|
21
20
|
});
|
|
22
|
-
const { onValueDetailsButtonClick } = useValueDetailsButton({
|
|
23
|
-
value: null,
|
|
24
|
-
attribute
|
|
25
|
-
});
|
|
26
21
|
const _handleSelect = (optionValue, ...antOnChangeParams) => {
|
|
27
22
|
const newValues = Array.isArray(value) ? [...value, optionValue] : [optionValue];
|
|
28
23
|
onChange(newValues, antOnChangeParams);
|
|
@@ -71,8 +66,6 @@ export const MultiValueSelect = ({ value, onChange, activeValues, attribute, lab
|
|
|
71
66
|
onValueDeselect(activeLinkValueToDeselect);
|
|
72
67
|
}
|
|
73
68
|
};
|
|
74
|
-
return (_jsx(KitSelect, { loading: loading, value: value, required: required, mode: "multiple", label: label, options: selectOptions, showSearch: true, optionFilterProp: "label", placeholder: t('record_edition.placeholder.record_select'), onSelect: _handleSelect, onClear: _clearValues, onBlur: _handleBlur,
|
|
75
|
-
// @ts-expect-error
|
|
76
|
-
onDeselect: _handleDeselect, onChange: onChange, onInfoClick: shouldShowValueDetailsButton ? onValueDetailsButtonClick : null }));
|
|
69
|
+
return (_jsx(KitSelect, { htmlFor: attribute.id, loading: loading, value: value, required: required, mode: "multiple", label: label, options: selectOptions, showSearch: true, optionFilterProp: "label", placeholder: t('record_edition.placeholder.record_select'), onSelect: _handleSelect, onClear: _clearValues, onBlur: _handleBlur, onDeselect: _handleDeselect, onChange: onChange }));
|
|
77
70
|
};
|
|
78
71
|
//# sourceMappingURL=MultiValueSelect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiValueSelect.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/MultiValueSelect.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAoB,QAAQ,EAAC,MAAM,OAAO,CAAC;AAClD,OAAO,EAAC,OAAO,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAE9C,OAAO,oBAAoB,MAAM,qDAAqD,CAAC;AAIvF,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"MultiValueSelect.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/MultiValueSelect.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAoB,QAAQ,EAAC,MAAM,OAAO,C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AAC,GAAG,CAAC,SAAS,CAAC,EAAE,KAAK,eAAe,CAAC,CAAC;QACjG,IAAI,yBAAyB,EAAE,CAAC;YAC5B,eAAe,CAAC,yBAAyB,CAAC,CAAC;QAC/C,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,CACH,KAAC,SAAS,IACN,OAAO,EAAE,SAAS,CAAC,EAAE,EACrB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,UAAU,EACf,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,aAAa,EACtB,UAAU,QACV,gBAAgB,EAAC,OAAO,EACxB,WAAW,EAAE,CAAC,CAAC,0CAA0C,CAAC,EAC1D,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,eAAe,EAC3B,QAAQ,EAAE,QAAQ,GACpB,CACL,CAAC;AACN,CAAC,CAAC"}
|
package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/ComputeIndicator.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { KitTooltip } from 'aristid-ds';
|
|
3
|
+
import { FaLayerGroup, FaSquareRootAlt } from 'react-icons/fa';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { useSharedTranslation } from '../../../../../hooks/useSharedTranslation';
|
|
6
|
+
const ComputeIndicatorWrapper = styled.div `
|
|
7
|
+
font-size: calc(var(--general-typography-fontSize7) * 1px);
|
|
8
|
+
`;
|
|
9
|
+
const TOOLTIP_DEFAULT_DELAY_IN_SECONDS = 0.5;
|
|
10
|
+
export const ComputeIndicator = ({ calculatedFlags, inheritedFlags }) => {
|
|
11
|
+
const { t } = useSharedTranslation();
|
|
12
|
+
const shouldDisplayComputedIcon = calculatedFlags.isCalculatedNotOverrideValue || inheritedFlags.isInheritedNotOverrideValue;
|
|
13
|
+
const shouldDisplayOverridedIcon = calculatedFlags.isCalculatedOverrideValue || inheritedFlags.isInheritedOverrideValue;
|
|
14
|
+
return (_jsxs(ComputeIndicatorWrapper, { children: [shouldDisplayComputedIcon && (_jsx(KitTooltip, { title: calculatedFlags.isCalculatedValue
|
|
15
|
+
? t('record_edition.calculated_value')
|
|
16
|
+
: t('record_edition.inherited_value'), mouseEnterDelay: TOOLTIP_DEFAULT_DELAY_IN_SECONDS, children: _jsx(FaSquareRootAlt, {}) })), shouldDisplayOverridedIcon && (_jsx(KitTooltip, { title: t('record_edition.overrided_value'), mouseEnterDelay: TOOLTIP_DEFAULT_DELAY_IN_SECONDS, children: _jsx(FaLayerGroup, {}) }))] }));
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=ComputeIndicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComputeIndicator.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/StandardField/ComputeIndicator.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,YAAY,EAAE,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAC7D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAEzC,CAAC;AAEF,MAAM,gCAAgC,GAAG,GAAG,CAAC;AAE7C,MAAM,CAAC,MAAM,gBAAgB,GAGxB,CAAC,EAAC,eAAe,EAAE,cAAc,EAAC,EAAE,EAAE;IACvC,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,yBAAyB,GAC3B,eAAe,CAAC,4BAA4B,IAAI,cAAc,CAAC,2BAA2B,CAAC;IAC/F,MAAM,0BAA0B,GAC5B,eAAe,CAAC,yBAAyB,IAAI,cAAc,CAAC,wBAAwB,CAAC;IAEzF,OAAO,CACH,MAAC,uBAAuB,eACnB,yBAAyB,IAAI,CAC1B,KAAC,UAAU,IACP,KAAK,EACD,eAAe,CAAC,iBAAiB;oBAC7B,CAAC,CAAC,CAAC,CAAC,iCAAiC,CAAC;oBACtC,CAAC,CAAC,CAAC,CAAC,gCAAgC,CAAC,EAE7C,eAAe,EAAE,gCAAgC,YAEjD,KAAC,eAAe,KAAG,GACV,CAChB,EACA,0BAA0B,IAAI,CAC3B,KAAC,UAAU,IACP,KAAK,EAAE,CAAC,CAAC,gCAAgC,CAAC,EAC1C,eAAe,EAAE,gCAAgC,YAEjD,KAAC,YAAY,KAAG,GACP,CAChB,IACqB,CAC7B,CAAC;AACN,CAAC,CAAC"}
|
package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IRequiredFieldsSettings } from '@leav/utils';
|
|
2
2
|
import { FunctionComponent } from 'react';
|
|
3
3
|
import { RecordFormElementsValueStandardValue } from '../../../../../hooks/useGetRecordForm/useGetRecordForm';
|
|
4
4
|
import { IFormElementProps } from '../../_types';
|
|
5
5
|
import { FormInstance } from 'antd';
|
|
6
|
-
|
|
6
|
+
import { GetRecordColumnsValuesRecord, IRecordColumnValueStandard } from '../../../../../_queries/records/getRecordColumnsValues';
|
|
7
|
+
declare const StandardField: FunctionComponent<IFormElementProps<IRequiredFieldsSettings, RecordFormElementsValueStandardValue> & {
|
|
7
8
|
antdForm?: FormInstance;
|
|
9
|
+
computedValues?: GetRecordColumnsValuesRecord<IRecordColumnValueStandard>;
|
|
8
10
|
}>;
|
|
9
11
|
export default StandardField;
|
package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js
CHANGED
|
@@ -3,28 +3,22 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
// This file is released under LGPL V3
|
|
4
4
|
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
5
5
|
import { ErrorTypes, localizedTranslation } from '@leav/utils';
|
|
6
|
-
import {
|
|
7
|
-
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { useEffect, useRef, useState } from 'react';
|
|
8
7
|
import styled from 'styled-components';
|
|
9
8
|
import { ErrorDisplay } from '../../../../../components';
|
|
10
|
-
import CreationErrorContext from '../../../../../components/RecordEdition/EditRecord/creationErrorContext';
|
|
11
|
-
import { EditRecordReducerActionsTypes } from '../../../../../components/RecordEdition/editRecordReducer/editRecordReducer';
|
|
12
|
-
import { useEditRecordReducer } from '../../../../../components/RecordEdition/editRecordReducer/useEditRecordReducer';
|
|
13
|
-
import { useRefreshFieldValues } from '../../../../../hooks/useRefreshFieldValues';
|
|
14
9
|
import { AttributeFormat } from '../../../../../_gqlTypes';
|
|
15
|
-
import {
|
|
16
|
-
import standardFieldReducer, { computeInitialState, newValueId, StandardFieldReducerActionsTypes } from '../../reducers/standardFieldReducer/standardFieldReducer';
|
|
17
|
-
import FieldFooter from '../../shared/FieldFooter';
|
|
18
|
-
import ValuesVersionBtn from '../../shared/ValuesVersionBtn';
|
|
19
|
-
import { APICallStatus, VersionFieldScope } from '../../_types';
|
|
10
|
+
import { APICallStatus } from '../../_types';
|
|
20
11
|
import StandardFieldValue from './StandardFieldValue';
|
|
21
12
|
import { Form } from 'antd';
|
|
22
|
-
import {
|
|
23
|
-
import { KitButton, KitInputWrapper } from 'aristid-ds';
|
|
13
|
+
import { KitButton, KitInputWrapper, KitTooltip } from 'aristid-ds';
|
|
24
14
|
import { useLang } from '../../../../../hooks';
|
|
25
|
-
import { useValueDetailsButton } from '../../shared/ValueDetailsBtn/useValueDetailsButton';
|
|
26
15
|
import { FaPlus, FaTrash } from 'react-icons/fa';
|
|
27
16
|
import { DeleteAllValuesButton } from './DeleteAllValuesButton';
|
|
17
|
+
import { computeCalculatedFlags, computeInheritedFlags } from './calculatedInheritedFlags';
|
|
18
|
+
import { useGetPresentationValues } from './useGetPresentationValues';
|
|
19
|
+
import { useSharedTranslation } from '../../../../../hooks/useSharedTranslation';
|
|
20
|
+
import { ComputeIndicator } from './ComputeIndicator';
|
|
21
|
+
import { getAntdDisplayedValue, getEmptyInitialValue } from '../../antdUtils';
|
|
28
22
|
const Wrapper = styled.div `
|
|
29
23
|
margin-bottom: ${props => (props.$metadataEdit ? 0 : '1.5em')};
|
|
30
24
|
`;
|
|
@@ -48,6 +42,10 @@ const KitInputWrapperStyled = styled(KitInputWrapper) `
|
|
|
48
42
|
}
|
|
49
43
|
}
|
|
50
44
|
`;
|
|
45
|
+
const KitInputExtraAlignLeft = styled.div `
|
|
46
|
+
margin-right: auto;
|
|
47
|
+
line-height: 12px;
|
|
48
|
+
`;
|
|
51
49
|
const KitDeleteValueButton = styled(KitButton) `
|
|
52
50
|
margin: 3px;
|
|
53
51
|
`;
|
|
@@ -55,329 +53,131 @@ const KitAddValueButton = styled(KitButton) `
|
|
|
55
53
|
margin-top: calc((var(--general-spacing-xs) - 3) * 1px);
|
|
56
54
|
margin-bottom: 3px;
|
|
57
55
|
`;
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
let presentationValue = value || calculatedValue?.payload || inheritedValue?.payload || '';
|
|
61
|
-
switch (format) {
|
|
62
|
-
case AttributeFormat.date_range:
|
|
63
|
-
if (!_isDateRangeValue(presentationValue)) {
|
|
64
|
-
presentationValue = '';
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
const { from, to } = presentationValue;
|
|
68
|
-
presentationValue = t('record_edition.date_range_value', { from, to });
|
|
69
|
-
}
|
|
70
|
-
break;
|
|
71
|
-
case AttributeFormat.color:
|
|
72
|
-
if (!presentationValue) {
|
|
73
|
-
presentationValue = '#00000000';
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
presentationValue = '#' + presentationValue;
|
|
77
|
-
}
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
return presentationValue;
|
|
81
|
-
};
|
|
82
|
-
const StandardField = ({ element, antdForm, onValueSubmit, onValueDelete, onDeleteMultipleValues, metadataEdit = false }) => {
|
|
83
|
-
const { t } = useTranslation();
|
|
56
|
+
const StandardField = ({ element, computedValues, antdForm, readonly, onValueSubmit, onValueDelete, onDeleteMultipleValues, metadataEdit = false }) => {
|
|
57
|
+
const { t } = useSharedTranslation();
|
|
84
58
|
const { lang: availableLang } = useLang();
|
|
85
|
-
const { readOnly: isRecordReadOnly, record } = useRecordEditionContext();
|
|
86
|
-
const { state: editRecordState, dispatch: editRecordDispatch } = useEditRecordReducer();
|
|
87
59
|
const antdListFieldsRef = useRef(null);
|
|
88
|
-
const { fetchValues } = useRefreshFieldValues(editRecordState.record?.library?.id, element.attribute?.id, editRecordState.record?.id);
|
|
89
|
-
const isMultipleValues = element.attribute.multiple_values;
|
|
90
60
|
const { attribute } = element;
|
|
91
|
-
const creationErrors = useContext(CreationErrorContext);
|
|
92
|
-
const isInCreationMode = record === null;
|
|
93
|
-
const initialState = useMemo(() => computeInitialState({
|
|
94
|
-
element,
|
|
95
|
-
record,
|
|
96
|
-
isRecordReadOnly,
|
|
97
|
-
formVersion: editRecordState.valuesVersion,
|
|
98
|
-
metadataEdit
|
|
99
|
-
}), []);
|
|
100
|
-
const [state, dispatch] = useReducer(standardFieldReducer, initialState);
|
|
101
|
-
const [presentationValues, setPresentationValues] = useState(element.values.map(value => _getPresentationValue({
|
|
102
|
-
t,
|
|
103
|
-
format: attribute.format,
|
|
104
|
-
value: value.payload,
|
|
105
|
-
calculatedValue: state.calculatedValue,
|
|
106
|
-
inheritedValue: state.inheritedValue
|
|
107
|
-
})));
|
|
108
61
|
useEffect(() => {
|
|
109
|
-
if (
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const idValue = fieldError.id_value ?? null;
|
|
113
|
-
dispatch({
|
|
114
|
-
type: StandardFieldReducerActionsTypes.SET_ERROR,
|
|
115
|
-
idValue,
|
|
116
|
-
error: fieldError.message
|
|
117
|
-
});
|
|
118
|
-
}
|
|
62
|
+
if (computedValues && computedValues[attribute.id]) {
|
|
63
|
+
setBackendValues(computedValues[attribute.id]);
|
|
64
|
+
antdForm.setFieldValue(attribute.id, getAntdDisplayedValue(computedValues[attribute.id], attribute));
|
|
119
65
|
}
|
|
120
|
-
}, [
|
|
121
|
-
|
|
66
|
+
}, [computedValues]);
|
|
67
|
+
if (!attribute) {
|
|
68
|
+
return _jsx(ErrorDisplay, { message: t('record_edition.missing_attribute') });
|
|
69
|
+
}
|
|
70
|
+
const [backendValues, setBackendValues] = useState(element.values);
|
|
71
|
+
const calculatedFlags = computeCalculatedFlags(backendValues);
|
|
72
|
+
const inheritedFlags = computeInheritedFlags(backendValues);
|
|
73
|
+
const defaultValueToAddInAntdForm = getEmptyInitialValue(attribute);
|
|
74
|
+
const backendWithoutCalculatedOrInheritedValues = backendValues
|
|
75
|
+
.filter(backendValue => !backendValue.isCalculated && !backendValue.isInherited)
|
|
76
|
+
.sort((a, b) => Number(a.id_value) - Number(b.id_value));
|
|
77
|
+
const { presentationValues } = useGetPresentationValues({
|
|
78
|
+
//TODO fix type
|
|
79
|
+
values: backendWithoutCalculatedOrInheritedValues,
|
|
80
|
+
format: attribute.format,
|
|
81
|
+
calculatedValue: calculatedFlags.calculatedValue,
|
|
82
|
+
inheritedValue: inheritedFlags.inheritedValue
|
|
83
|
+
});
|
|
84
|
+
const _handleSubmit = (idValue, fieldName) => async (valueToSave) => {
|
|
85
|
+
const submitRes = await onValueSubmit([{ value: valueToSave, idValue: idValue ?? null, attribute }], null);
|
|
122
86
|
const shouldSpecifyFieldName = attribute.multiple_values && fieldName !== undefined;
|
|
123
87
|
const name = shouldSpecifyFieldName ? [attribute.id, fieldName] : attribute.id;
|
|
124
|
-
antdForm.setFields([
|
|
125
|
-
{
|
|
126
|
-
name,
|
|
127
|
-
errors: error ? [error] : null
|
|
128
|
-
}
|
|
129
|
-
]);
|
|
130
|
-
};
|
|
131
|
-
const _handleSubmit = async (idValue, valueToSave, fieldName) => {
|
|
132
|
-
const isSavingNewValue = idValue === newValueId;
|
|
133
|
-
dispatch({
|
|
134
|
-
type: StandardFieldReducerActionsTypes.CLEAR_ERROR,
|
|
135
|
-
idValue
|
|
136
|
-
});
|
|
137
|
-
const valueVersion = state.values[state.activeScope].version;
|
|
138
|
-
const submitRes = await onValueSubmit([{ value: valueToSave, idValue: isSavingNewValue ? null : idValue, attribute }], valueVersion);
|
|
139
88
|
if (submitRes.status === APICallStatus.SUCCESS) {
|
|
140
89
|
if (antdForm) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
id_value: submitResValue.id_value,
|
|
148
|
-
created_at: null,
|
|
149
|
-
modified_at: null,
|
|
150
|
-
created_by: null,
|
|
151
|
-
modified_by: null,
|
|
152
|
-
version: null,
|
|
153
|
-
raw_payload: '',
|
|
154
|
-
payload: '',
|
|
155
|
-
metadata: null,
|
|
156
|
-
attribute
|
|
157
|
-
};
|
|
158
|
-
if (state.metadataEdit) {
|
|
159
|
-
const metadataValue = (submitResValue.metadata ?? []).find(({ name }) => name === element.attribute.id)?.value ?? null;
|
|
160
|
-
resultValue.raw_payload = metadataValue.raw_payload ?? metadataValue.payload;
|
|
161
|
-
resultValue.payload = metadataValue.payload;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
resultValue = submitResValue;
|
|
90
|
+
antdForm.setFields([
|
|
91
|
+
{
|
|
92
|
+
name,
|
|
93
|
+
errors: null
|
|
94
|
+
}
|
|
95
|
+
]);
|
|
166
96
|
}
|
|
167
|
-
if (
|
|
168
|
-
|
|
169
|
-
type: StandardFieldReducerActionsTypes.UPDATE_AFTER_DELETE,
|
|
170
|
-
idValue
|
|
171
|
-
});
|
|
97
|
+
if (!attribute.multiple_values) {
|
|
98
|
+
setBackendValues(submitRes.values);
|
|
172
99
|
}
|
|
173
100
|
else {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
101
|
+
setBackendValues(previousBackendValues => {
|
|
102
|
+
const newBackendValues = [...previousBackendValues, ...submitRes.values].reduce((acc, backendValue) => {
|
|
103
|
+
const existingValue = acc.find(o => o.id_value === backendValue.id_value &&
|
|
104
|
+
o.isCalculated === backendValue.isCalculated &&
|
|
105
|
+
o.isInherited === backendValue.isInherited);
|
|
106
|
+
if (existingValue) {
|
|
107
|
+
Object.assign(existingValue, backendValue);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
acc.push(backendValue);
|
|
111
|
+
}
|
|
112
|
+
return acc;
|
|
113
|
+
}, []);
|
|
114
|
+
return newBackendValues;
|
|
178
115
|
});
|
|
179
116
|
}
|
|
180
|
-
const index = fieldName ?? 0;
|
|
181
|
-
setPresentationValues(previousPresentationValues => {
|
|
182
|
-
const nextPresentationValues = [...previousPresentationValues];
|
|
183
|
-
nextPresentationValues[index] = _getPresentationValue({
|
|
184
|
-
t,
|
|
185
|
-
format: attribute.format,
|
|
186
|
-
value: resultValue.payload,
|
|
187
|
-
calculatedValue: state.calculatedValue,
|
|
188
|
-
inheritedValue: state.inheritedValue
|
|
189
|
-
});
|
|
190
|
-
return nextPresentationValues;
|
|
191
|
-
});
|
|
192
|
-
const newActiveValue = state.metadataEdit
|
|
193
|
-
? {
|
|
194
|
-
...editRecordState.activeValue,
|
|
195
|
-
value: {
|
|
196
|
-
...editRecordState.activeValue.value,
|
|
197
|
-
metadata: [
|
|
198
|
-
...(editRecordState.activeValue?.value?.metadata ?? []),
|
|
199
|
-
{
|
|
200
|
-
name: element.attribute.id,
|
|
201
|
-
value: {
|
|
202
|
-
...resultValue,
|
|
203
|
-
version: null,
|
|
204
|
-
metadata: null
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
]
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
: null;
|
|
211
|
-
editRecordDispatch({
|
|
212
|
-
type: EditRecordReducerActionsTypes.SET_ACTIVE_VALUE,
|
|
213
|
-
value: newActiveValue
|
|
214
|
-
});
|
|
215
117
|
return submitRes;
|
|
216
118
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
const attributeError = (submitRes?.errors ?? []).filter(err => err.attribute === attribute.id)?.[0];
|
|
119
|
+
if (!submitRes.error && submitRes.errors) {
|
|
120
|
+
const attributeError = submitRes.errors.filter(err => err.attribute === attribute.id)?.[0];
|
|
220
121
|
if (attributeError) {
|
|
221
|
-
|
|
122
|
+
submitRes.error =
|
|
222
123
|
attributeError.type === ErrorTypes.VALIDATION_ERROR
|
|
223
124
|
? attributeError.message
|
|
224
125
|
: t(`errors.${attributeError.type}`);
|
|
225
|
-
if (antdForm) {
|
|
226
|
-
setAntdErrorField(errorMessage, fieldName);
|
|
227
|
-
}
|
|
228
126
|
}
|
|
229
127
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
const _handleDelete = async (idValue) => {
|
|
238
|
-
dispatch({
|
|
239
|
-
type: StandardFieldReducerActionsTypes.UNEDIT_FIELD,
|
|
240
|
-
idValue
|
|
241
|
-
});
|
|
242
|
-
const deleteRes = await onValueDelete({ id_value: idValue }, attribute.id);
|
|
243
|
-
if (deleteRes.status === APICallStatus.SUCCESS) {
|
|
244
|
-
dispatch({
|
|
245
|
-
type: StandardFieldReducerActionsTypes.UPDATE_AFTER_DELETE,
|
|
246
|
-
idValue
|
|
247
|
-
});
|
|
248
|
-
if (!isInCreationMode) {
|
|
249
|
-
const freshValues = await fetchValues(state.values[state.activeScope].version);
|
|
250
|
-
dispatch({
|
|
251
|
-
type: StandardFieldReducerActionsTypes.REFRESH_VALUES,
|
|
252
|
-
formVersion: editRecordState.valuesVersion,
|
|
253
|
-
values: freshValues
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
return;
|
|
128
|
+
if (submitRes.error && antdForm) {
|
|
129
|
+
antdForm.setFields([
|
|
130
|
+
{
|
|
131
|
+
name,
|
|
132
|
+
errors: [submitRes.error]
|
|
133
|
+
}
|
|
134
|
+
]);
|
|
257
135
|
}
|
|
258
|
-
|
|
259
|
-
type: StandardFieldReducerActionsTypes.SET_ERROR,
|
|
260
|
-
idValue,
|
|
261
|
-
error: deleteRes.error
|
|
262
|
-
});
|
|
263
|
-
};
|
|
264
|
-
const _handleAddValue = async (antdAdd) => {
|
|
265
|
-
dispatch({
|
|
266
|
-
type: StandardFieldReducerActionsTypes.ADD_VALUE
|
|
267
|
-
});
|
|
268
|
-
antdAdd();
|
|
136
|
+
return submitRes;
|
|
269
137
|
};
|
|
270
|
-
const _handleDeleteValue = async (
|
|
271
|
-
if (
|
|
272
|
-
await onValueDelete({ id_value:
|
|
138
|
+
const _handleDeleteValue = async (idValue, antdRemove, deletedFieldIndex) => {
|
|
139
|
+
if (idValue) {
|
|
140
|
+
await onValueDelete({ id_value: idValue }, attribute.id);
|
|
141
|
+
setBackendValues(previousBackendValues => previousBackendValues.filter(backendValue => backendValue.id_value !== idValue));
|
|
273
142
|
}
|
|
274
143
|
antdRemove(deletedFieldIndex);
|
|
275
|
-
setPresentationValues(previousPresentationValues => previousPresentationValues.filter((_, index) => index !== deletedFieldIndex));
|
|
276
|
-
dispatch({
|
|
277
|
-
type: StandardFieldReducerActionsTypes.UPDATE_AFTER_DELETE,
|
|
278
|
-
idValue: field.idValue
|
|
279
|
-
});
|
|
280
|
-
};
|
|
281
|
-
const _handleScopeChange = (scope) => {
|
|
282
|
-
dispatch({
|
|
283
|
-
type: StandardFieldReducerActionsTypes.CHANGE_VERSION_SCOPE,
|
|
284
|
-
scope
|
|
285
|
-
});
|
|
286
144
|
};
|
|
287
145
|
const _handleDeleteAllValues = async () => {
|
|
288
|
-
const deleteRes = await onDeleteMultipleValues(attribute.id,
|
|
146
|
+
const deleteRes = await onDeleteMultipleValues(attribute.id, backendValues.filter(b => b.id_value), null);
|
|
289
147
|
if (deleteRes.status === APICallStatus.SUCCESS) {
|
|
290
148
|
antdListFieldsRef.current.remove(antdListFieldsRef.current.indexes);
|
|
291
|
-
antdListFieldsRef.current.add();
|
|
292
|
-
|
|
293
|
-
dispatch({
|
|
294
|
-
type: StandardFieldReducerActionsTypes.UPDATE_AFTER_DELETE,
|
|
295
|
-
allDeleted: true
|
|
296
|
-
});
|
|
297
|
-
if (!isInCreationMode) {
|
|
298
|
-
const freshValues = await fetchValues(state.values[state.activeScope].version);
|
|
299
|
-
dispatch({
|
|
300
|
-
type: StandardFieldReducerActionsTypes.REFRESH_VALUES,
|
|
301
|
-
formVersion: editRecordState.valuesVersion,
|
|
302
|
-
values: freshValues
|
|
303
|
-
});
|
|
304
|
-
}
|
|
149
|
+
antdListFieldsRef.current.add(defaultValueToAddInAntdForm);
|
|
150
|
+
setBackendValues(previousBackendValues => previousBackendValues.filter(backendValue => !backendValue.id_value));
|
|
305
151
|
return;
|
|
306
152
|
}
|
|
307
|
-
dispatch({
|
|
308
|
-
type: StandardFieldReducerActionsTypes.SET_ERROR,
|
|
309
|
-
idValue: state.values[state.activeScope].values[0]?.idValue,
|
|
310
|
-
error: deleteRes.error
|
|
311
|
-
});
|
|
312
153
|
};
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
const valuesToDisplay = Object.values(state.values[state.activeScope].values).sort((valueA, valueB) => valueA.index - valueB.index);
|
|
317
|
-
const hasValue = valuesToDisplay[0].idValue !== newValueId && valuesToDisplay[0].idValue !== null;
|
|
318
|
-
const canAddAnotherValue = !state.isReadOnly &&
|
|
154
|
+
const isMultipleValues = element.attribute.multiple_values;
|
|
155
|
+
const hasValue = isMultipleValues && backendValues.length > 0;
|
|
156
|
+
const canAddAnotherValue = !readonly &&
|
|
319
157
|
isMultipleValues &&
|
|
320
158
|
attribute.format !== AttributeFormat.boolean &&
|
|
321
159
|
attribute.format !== AttributeFormat.encrypted;
|
|
322
|
-
const canDeleteAllValues = !
|
|
323
|
-
const
|
|
324
|
-
const versions = {
|
|
325
|
-
[VersionFieldScope.CURRENT]: state.values[VersionFieldScope.CURRENT]?.version ?? null,
|
|
326
|
-
[VersionFieldScope.INHERITED]: state.values[VersionFieldScope.INHERITED]?.version ?? null
|
|
327
|
-
};
|
|
328
|
-
const label = localizedTranslation(state.formElement.settings.label, availableLang);
|
|
329
|
-
const { onValueDetailsButtonClick } = useValueDetailsButton({
|
|
330
|
-
value: valuesToDisplay[0]?.value,
|
|
331
|
-
attribute: state.attribute
|
|
332
|
-
});
|
|
333
|
-
const shouldShowValueDetailsButton = editRecordState.withInfoButton;
|
|
334
|
-
const _getFormattedValueForHelper = (valueToFormat) => {
|
|
335
|
-
switch (state.attribute.format) {
|
|
336
|
-
case AttributeFormat.date_range:
|
|
337
|
-
return t('record_edition.date_range_from_to', {
|
|
338
|
-
from: valueToFormat.payload.from,
|
|
339
|
-
to: valueToFormat.payload.to
|
|
340
|
-
});
|
|
341
|
-
case AttributeFormat.encrypted:
|
|
342
|
-
return valueToFormat.payload ? '●●●●●●●' : '';
|
|
343
|
-
case AttributeFormat.color:
|
|
344
|
-
return '#' + valueToFormat.payload;
|
|
345
|
-
default:
|
|
346
|
-
return valueToFormat.payload;
|
|
347
|
-
}
|
|
348
|
-
};
|
|
349
|
-
const _getHelper = () => {
|
|
350
|
-
if (attribute.multiple_values) {
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
if (state.isInheritedOverrideValue) {
|
|
354
|
-
return t('record_edition.inherited_input_helper', {
|
|
355
|
-
inheritedValue: _getFormattedValueForHelper(state.inheritedValue)
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
if (state.isCalculatedOverrideValue) {
|
|
359
|
-
return t('record_edition.calculated_input_helper', {
|
|
360
|
-
calculatedValue: _getFormattedValueForHelper(state.calculatedValue)
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
return;
|
|
364
|
-
};
|
|
160
|
+
const canDeleteAllValues = !readonly && hasValue && backendValues.length > 1;
|
|
161
|
+
const label = localizedTranslation(element.settings.label, availableLang);
|
|
365
162
|
let isFieldInError = false;
|
|
366
163
|
if (antdForm) {
|
|
367
|
-
const hasErrorsInFormList =
|
|
164
|
+
const hasErrorsInFormList = backendValues.some((_, index) => {
|
|
368
165
|
const errors = antdForm.getFieldError([attribute.id, index]);
|
|
369
166
|
return errors.length > 0;
|
|
370
167
|
});
|
|
371
168
|
isFieldInError = antdForm.getFieldError(attribute.id).length > 0 || hasErrorsInFormList;
|
|
372
169
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
170
|
+
const isReadOnly = attribute.readonly || readonly;
|
|
171
|
+
return (_jsx(Wrapper, { "$metadataEdit": metadataEdit, children: _jsxs(KitInputWrapperStyled, { label: label, required: element.settings.required, disabled: isReadOnly, bordered: attribute.multiple_values, status: isFieldInError ? 'error' : undefined, actions: [
|
|
172
|
+
_jsxs(_Fragment, { children: [_jsx(KitInputExtraAlignLeft, { children: _jsx(ComputeIndicator, { calculatedFlags: calculatedFlags, inheritedFlags: inheritedFlags }) }), canDeleteAllValues && _jsx(DeleteAllValuesButton, { handleDelete: _handleDeleteAllValues })] })
|
|
173
|
+
], htmlFor: attribute.id, children: [!attribute.multiple_values && (_jsx(StandardFieldValue, { presentationValue: presentationValues[0], handleSubmit: _handleSubmit(backendWithoutCalculatedOrInheritedValues[0]?.id_value), attribute: attribute, required: element.settings.required, readonly: isReadOnly, label: label, calculatedFlags: calculatedFlags, inheritedFlags: inheritedFlags })), attribute.multiple_values && (_jsx(Form.List, { name: attribute.id, children: (fields, { add, remove }) => {
|
|
174
|
+
antdListFieldsRef.current = { add, remove, indexes: fields.map((_, index) => index) };
|
|
175
|
+
const shouldDisabledAddValueButton = fields.length > backendWithoutCalculatedOrInheritedValues.length;
|
|
176
|
+
return (_jsxs(_Fragment, { children: [_jsx(KitFieldsWrapper, { children: fields.map((field, index) => (_jsxs(RowValueWrapper, { children: [_jsx(StandardFieldValueWrapper, { children: _jsx(StandardFieldValue, { listField: field, presentationValue: presentationValues[index] ?? '', handleSubmit: _handleSubmit(backendWithoutCalculatedOrInheritedValues[index]?.id_value, field.name), attribute: attribute, label: label, required: element.settings.required, readonly: isReadOnly, calculatedFlags: calculatedFlags, inheritedFlags: inheritedFlags, isLastValueOfMultivalues: index === fields.length - 1 && index !== 0, removeLastValueOfMultivalues: () => remove(index) }) }), fields.length > 1 && (_jsx(KitDeleteValueButton, { type: "tertiary", title: t('record_edition.delete_value'), icon: _jsx(FaTrash, {}), onClick: () => _handleDeleteValue(backendWithoutCalculatedOrInheritedValues[index]
|
|
177
|
+
?.id_value, remove, index) }))] }, field.key))) }), canAddAnotherValue && (_jsx(KitTooltip, { title: shouldDisabledAddValueButton
|
|
178
|
+
? t('record_edition.please_select_value_before_adding')
|
|
179
|
+
: undefined, children: _jsx(KitAddValueButton, { type: "secondary", size: "m", icon: _jsx(FaPlus, {}), onClick: () => add(defaultValueToAddInAntdForm), disabled: shouldDisabledAddValueButton, children: t('record_edition.add_value') }) }))] }));
|
|
180
|
+
} }))] }) }));
|
|
381
181
|
};
|
|
382
182
|
export default StandardField;
|
|
383
183
|
//# sourceMappingURL=StandardField.js.map
|