@leav/ui 0.4.0-9b47d86 → 0.4.0-9d2fc695
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/README.md +1 -0
- package/dist/__mocks__/common/form.js +5 -1
- package/dist/__mocks__/common/form.js.map +1 -1
- package/dist/_gqlTypes/index.d.ts +1434 -327
- package/dist/_gqlTypes/index.js +349 -42
- package/dist/_gqlTypes/index.js.map +1 -1
- package/dist/_queries/attributes/attributeDetailsFragment.js +1 -0
- package/dist/_queries/attributes/attributeDetailsFragment.js.map +1 -1
- package/dist/_queries/records/activateRecordsMutation.d.ts +1 -0
- package/dist/_queries/records/activateRecordsMutation.js +15 -0
- package/dist/_queries/records/activateRecordsMutation.js.map +1 -0
- package/dist/_queries/records/getRecordFormQuery.js +13 -0
- package/dist/_queries/records/getRecordFormQuery.js.map +1 -1
- package/dist/_queries/trees/treeNodeChildrenQuery.js +12 -2
- package/dist/_queries/trees/treeNodeChildrenQuery.js.map +1 -1
- package/dist/_utils/attributeType.d.ts +2 -1
- package/dist/_utils/attributeType.js +2 -1
- package/dist/_utils/attributeType.js.map +1 -1
- package/dist/components/CreateDirectory/CreateDirectory.js +3 -3
- package/dist/components/CreateDirectory/CreateDirectory.js.map +1 -1
- package/dist/components/EditLibraryModal/EditLibrary/EditLibraryAttributes/AttributesList/DeleteButton/DeleteButton.js +3 -2
- package/dist/components/EditLibraryModal/EditLibrary/EditLibraryAttributes/AttributesList/DeleteButton/DeleteButton.js.map +1 -1
- package/dist/components/EditTreeModal/EditTree/EditTreeInfo/EditTreeInfoForm/TreeLibrariesForm/TreeLibrariesForm.js +8 -1
- package/dist/components/EditTreeModal/EditTree/EditTreeInfo/EditTreeInfoForm/TreeLibrariesForm/TreeLibrariesForm.js.map +1 -1
- package/dist/components/ErrorBoundary/ErrorBoundaryContent/ErrorBoundaryContent.d.ts +2 -2
- package/dist/components/ErrorBoundary/ErrorBoundaryContent/ErrorBoundaryContent.js +4 -3
- package/dist/components/ErrorBoundary/ErrorBoundaryContent/ErrorBoundaryContent.js.map +1 -1
- package/dist/components/Explorer/DataView.d.ts +2 -1
- package/dist/components/Explorer/DataView.js +21 -12
- package/dist/components/Explorer/DataView.js.map +1 -1
- package/dist/components/Explorer/Explorer.d.ts +9 -6
- package/dist/components/Explorer/Explorer.js +22 -11
- package/dist/components/Explorer/Explorer.js.map +1 -1
- package/dist/components/Explorer/ExplorerToolbar.d.ts +2 -1
- package/dist/components/Explorer/ExplorerToolbar.js +5 -4
- package/dist/components/Explorer/ExplorerToolbar.js.map +1 -1
- package/dist/components/Explorer/TableCell.js +22 -11
- package/dist/components/Explorer/TableCell.js.map +1 -1
- package/dist/components/Explorer/_queries/prepareFiltersForRequest.d.ts +1 -1
- package/dist/components/Explorer/_queries/prepareFiltersForRequest.js +82 -31
- package/dist/components/Explorer/_queries/prepareFiltersForRequest.js.map +1 -1
- package/dist/components/Explorer/_queries/useExplorerData.js +34 -26
- package/dist/components/Explorer/_queries/useExplorerData.js.map +1 -1
- package/dist/components/Explorer/_types.d.ts +27 -5
- package/dist/components/Explorer/_types.js +1 -0
- package/dist/components/Explorer/_types.js.map +1 -1
- package/dist/components/Explorer/actions-item/useEditItemAction.d.ts +2 -1
- package/dist/components/Explorer/actions-item/useEditItemAction.js +2 -1
- package/dist/components/Explorer/actions-item/useEditItemAction.js.map +1 -1
- package/dist/components/Explorer/actions-item/{useRemoveItemAction.d.ts → useEditStatusItemAction.d.ts} +2 -2
- package/dist/components/Explorer/actions-item/{useRemoveItemAction.js → useEditStatusItemAction.js} +71 -24
- package/dist/components/Explorer/actions-item/useEditStatusItemAction.js.map +1 -0
- package/dist/components/Explorer/actions-item/useReplaceItemAction.d.ts +2 -1
- package/dist/components/Explorer/actions-item/useReplaceItemAction.js +2 -2
- package/dist/components/Explorer/actions-item/useReplaceItemAction.js.map +1 -1
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.d.ts +5 -1
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js +16 -21
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js.map +1 -1
- package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.d.ts +6 -3
- package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js +5 -19
- package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js.map +1 -1
- package/dist/components/Explorer/link-item/LinkModal.d.ts +3 -0
- package/dist/components/Explorer/link-item/LinkModal.js +14 -4
- package/dist/components/Explorer/link-item/LinkModal.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/_shared/CommonFilterItem.js +1 -1
- package/dist/components/Explorer/manage-view-settings/_shared/CommonFilterItem.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/_shared/useTransformFilters.js +26 -2
- package/dist/components/Explorer/manage-view-settings/_shared/useTransformFilters.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js +10 -7
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropDown.js +2 -2
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropDown.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropdownContent.js +5 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropdownContent.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/TreeAttributeDropDown.d.ts +3 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/TreeAttributeDropDown.js +69 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/TreeAttributeDropDown.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/_types.d.ts +6 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/useConditionOptionsByType.d.ts +2 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/useConditionOptionsByType.js +31 -4
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/useConditionOptionsByType.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js +19 -8
- package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsInitialState.js +3 -2
- 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 +3 -2
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js +38 -12
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js.map +1 -1
- package/dist/components/Explorer/useColumnWidth.js +2 -1
- package/dist/components/Explorer/useColumnWidth.js.map +1 -1
- package/dist/components/Explorer/useLoadView.d.ts +1 -1
- package/dist/components/Explorer/useLoadView.js +32 -38
- package/dist/components/Explorer/useLoadView.js.map +1 -1
- package/dist/components/Explorer/usePagination.d.ts +2 -1
- package/dist/components/Explorer/usePagination.js.map +1 -1
- package/dist/components/Explorer/useSearchInput.d.ts +3 -1
- package/dist/components/Explorer/useSearchInput.js +3 -1
- package/dist/components/Explorer/useSearchInput.js.map +1 -1
- package/dist/components/Explorer/useViewSettingsReducer.d.ts +1 -1
- package/dist/components/Explorer/useViewSettingsReducer.js +31 -16
- package/dist/components/Explorer/useViewSettingsReducer.js.map +1 -1
- package/dist/components/ImportModal/ImportModalConfigStep/ImportModalConfigStep.js +1 -1
- package/dist/components/ImportModal/ImportModalConfigStep/ImportModalConfigStep.js.map +1 -1
- package/dist/components/LibraryItemsList/CreateNewRecordButton/CreateNewRecordButton.js +1 -0
- package/dist/components/LibraryItemsList/CreateNewRecordButton/CreateNewRecordButton.js.map +1 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.js +3 -3
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.js.map +1 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.utils.js +2 -2
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.utils.js.map +1 -1
- package/dist/components/LibraryItemsList/shared/DeactivateRecordBtn/DeactivateRecordBtn.js +3 -3
- package/dist/components/LibraryItemsList/shared/DeactivateRecordBtn/DeactivateRecordBtn.js.map +1 -1
- package/dist/components/RecordEdition/EditRecord/EditRecord.d.ts +3 -5
- package/dist/components/RecordEdition/EditRecord/EditRecord.js +84 -249
- package/dist/components/RecordEdition/EditRecord/EditRecord.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordButtons/EditRecordButtons.d.ts +2 -0
- package/dist/components/RecordEdition/EditRecordButtons/EditRecordButtons.js +43 -0
- package/dist/components/RecordEdition/EditRecordButtons/EditRecordButtons.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordButtons/SidebarButton.d.ts +2 -0
- package/dist/components/RecordEdition/EditRecordButtons/SidebarButton.js +25 -0
- package/dist/components/RecordEdition/EditRecordButtons/SidebarButton.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordButtons/index.d.ts +2 -0
- package/dist/components/{SelectTreeNodeModal → RecordEdition/EditRecordButtons}/index.js +2 -1
- package/dist/components/RecordEdition/EditRecordButtons/index.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.d.ts +2 -2
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js +13 -11
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/_types.d.ts +2 -5
- package/dist/components/RecordEdition/EditRecordContent/hooks/useCreateEmptyRecordMutation.d.ts +5 -0
- package/dist/components/RecordEdition/EditRecordContent/hooks/useCreateEmptyRecordMutation.js +28 -0
- package/dist/components/RecordEdition/EditRecordContent/hooks/useCreateEmptyRecordMutation.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/hooks/useTabManagement.d.ts +11 -0
- package/dist/components/RecordEdition/EditRecordContent/hooks/useTabManagement.js +35 -0
- package/dist/components/RecordEdition/EditRecordContent/hooks/useTabManagement.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.d.ts +1 -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/FormDivider/FormDivider.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/Frame.js +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/Frame.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.d.ts +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js +11 -35
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/ActionButton.d.ts +3 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/ActionButton.js +9 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/ActionButton.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/{link-record-in-edition/useLinkRecords.d.ts → link-record/useExplorerLinkRecords.d.ts} +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/{link-record-in-edition/useLinkRecords.js → link-record/useExplorerLinkRecords.js} +3 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useExplorerLinkRecords.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.d.ts +24 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/{link-record-in-edition/useLinkRecordsInEdition.js → link-record/useLinkRecords.js} +19 -49
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/utils.js +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/utils.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +7 -10
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/DSListSelect.js +3 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/DSListSelect.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TextBlock/TextBlock.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.d.ts +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js +19 -24
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.d.ts +2 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/{useDisplayTreeNode.d.ts → TreeNodeList.d.ts} +4 -4
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeList.js +5 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeList.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.d.ts +16 -4
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js +12 -13
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.d.ts +4 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js +50 -62
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/useOutsideInteractionDetector.d.ts +1 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/useOutsideInteractionDetector.js +6 -10
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/useOutsideInteractionDetector.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.d.ts +3 -0
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js +68 -52
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.d.ts +3 -1
- package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.js +27 -9
- package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordSidebar/Breacrumb/Breadcrumb.js +2 -2
- package/dist/components/RecordEdition/EditRecordSidebar/Breacrumb/Breadcrumb.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordSidebar/EditRecordSidebar.d.ts +0 -1
- package/dist/components/RecordEdition/EditRecordSidebar/EditRecordSidebar.js +13 -12
- package/dist/components/RecordEdition/EditRecordSidebar/EditRecordSidebar.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js +2 -2
- package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js.map +1 -1
- package/dist/components/RecordEdition/constants.d.ts +2 -0
- package/dist/components/RecordEdition/constants.js +6 -0
- package/dist/components/RecordEdition/constants.js.map +1 -0
- package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.d.ts +27 -1
- package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.js +43 -2
- package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.js.map +1 -1
- package/dist/components/RecordEdition/index.d.ts +3 -0
- package/dist/components/RecordEdition/index.js +3 -0
- package/dist/components/RecordEdition/index.js.map +1 -1
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.d.ts +4 -1
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js +6 -4
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js.map +1 -1
- package/dist/components/SelectTreeNode/SelectTreeNode.d.ts +7 -3
- package/dist/components/SelectTreeNode/SelectTreeNode.js +2 -3
- package/dist/components/SelectTreeNode/SelectTreeNode.js.map +1 -1
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.d.ts +5 -1
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.js +60 -54
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.js.map +1 -1
- package/dist/components/SelectTreeNode/_types.d.ts +18 -0
- package/dist/components/SelectTreeNode/_types.js +2 -0
- package/dist/components/SelectTreeNode/_types.js.map +1 -0
- package/dist/components/{SelectTreeNodeModal/SelectTreeNodeModal.d.ts → SelectTreeNodeModalOld/SelectTreeNodeModalOld.d.ts} +1 -1
- package/dist/components/{SelectTreeNodeModal/SelectTreeNodeModal.js → SelectTreeNodeModalOld/SelectTreeNodeModalOld.js} +4 -2
- package/dist/components/SelectTreeNodeModalOld/SelectTreeNodeModalOld.js.map +1 -0
- package/dist/components/SelectTreeNodeModalOld/index.d.ts +1 -0
- package/dist/components/{RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList → SelectTreeNodeModalOld}/index.js +1 -2
- package/dist/components/SelectTreeNodeModalOld/index.js.map +1 -0
- package/dist/components/SimpleErrorBoundary/SimpleErrorBoundary.d.ts +1 -1
- package/dist/components/SimpleErrorBoundary/SimpleErrorBoundary.js.map +1 -1
- package/dist/components/SimpleErrorBoundary/SimpleErrorBoundaryContent/SimpleErrorBoundaryContent.d.ts +2 -2
- package/dist/components/SimpleErrorBoundary/SimpleErrorBoundaryContent/SimpleErrorBoundaryContent.js +6 -3
- package/dist/components/SimpleErrorBoundary/SimpleErrorBoundaryContent/SimpleErrorBoundaryContent.js.map +1 -1
- package/dist/components/UploadFiles/UploadFiles.js +3 -3
- 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/components/index.d.ts +1 -2
- package/dist/components/index.js +1 -2
- package/dist/components/index.js.map +1 -1
- package/dist/contexts/LangContext/LangContext.d.ts +1 -2
- package/dist/contexts/LangContext/LangContext.js +2 -2
- package/dist/contexts/LangContext/LangContext.js.map +1 -1
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +3 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useAppLang/useAppLang.js.map +1 -1
- package/dist/hooks/useGetRecordForm/useGetRecordForm.js +1 -1
- package/dist/hooks/useGetRecordForm/useGetRecordForm.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/messageHandlers.d.ts +15 -0
- package/dist/hooks/useIFrameMessenger/messageHandlers.js +121 -0
- package/dist/hooks/useIFrameMessenger/messageHandlers.js.map +1 -0
- package/dist/hooks/useIFrameMessenger/schema.d.ts +21 -0
- package/dist/hooks/useIFrameMessenger/schema.js +76 -0
- package/dist/hooks/useIFrameMessenger/schema.js.map +1 -0
- package/dist/hooks/useIFrameMessenger/types.d.ts +120 -0
- package/dist/hooks/useIFrameMessenger/types.js +2 -0
- package/dist/hooks/useIFrameMessenger/types.js.map +1 -0
- package/dist/hooks/useIFrameMessenger/useIFrameMessenger.d.ts +19 -0
- package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js +108 -0
- package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js.map +1 -0
- package/dist/hooks/useIFrameMessengerClient/IFrameMessengerClient.d.ts +7 -0
- package/dist/hooks/useIFrameMessengerClient/IFrameMessengerClient.js +13 -0
- package/dist/hooks/useIFrameMessengerClient/IFrameMessengerClient.js.map +1 -0
- package/dist/hooks/useIFrameMessengerClient/iFrameMessengerClientContext.d.ts +13 -0
- package/dist/{components/RecordEdition/EditRecord/creationErrorContext.js → hooks/useIFrameMessengerClient/iFrameMessengerClientContext.js} +2 -3
- package/dist/hooks/useIFrameMessengerClient/iFrameMessengerClientContext.js.map +1 -0
- package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.d.ts +13 -0
- package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.js +13 -0
- package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.js.map +1 -0
- package/dist/hooks/useRedirectToLogin/useRedirectToLogin.js +1 -1
- package/dist/hooks/useRedirectToLogin/useRedirectToLogin.js.map +1 -1
- package/dist/locales/en/shared.json +9 -1
- package/dist/locales/fr/shared.json +9 -1
- package/dist/types/attributes.d.ts +2 -1
- package/package.json +23 -8
- package/dist/components/Explorer/actions-item/useRemoveItemAction.js.map +0 -1
- package/dist/components/RecordEdition/EditRecord/creationErrorContext.d.ts +0 -6
- package/dist/components/RecordEdition/EditRecord/creationErrorContext.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/hooks/useCreateRecordMutation.d.ts +0 -5
- package/dist/components/RecordEdition/EditRecordContent/hooks/useCreateRecordMutation.js +0 -28
- package/dist/components/RecordEdition/EditRecordContent/hooks/useCreateRecordMutation.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/hooks/useRunActionsListAndFormatOnValue.d.ts +0 -121
- package/dist/components/RecordEdition/EditRecordContent/hooks/useRunActionsListAndFormatOnValue.js +0 -31
- package/dist/components/RecordEdition/EditRecordContent/hooks/useRunActionsListAndFormatOnValue.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useEditRecord.d.ts +0 -5
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useEditRecord.js +0 -39
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useEditRecord.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useUnselectRecord.d.ts +0 -8
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useUnselectRecord.js +0 -23
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useUnselectRecord.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-mass/useUnselectAllRecords.d.ts +0 -9
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-mass/useUnselectAllRecords.js +0 -23
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-mass/useUnselectAllRecords.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useCreateRecord.d.ts +0 -8
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useCreateRecord.js +0 -26
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useCreateRecord.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useRecordSelector.d.ts +0 -12
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useRecordSelector.js +0 -24
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useRecordSelector.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecords.d.ts +0 -19
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecords.js +0 -103
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecords.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.d.ts +0 -22
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.js +0 -104
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecords.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.d.ts +0 -26
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/LinkActionsButtons.d.ts +0 -9
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/LinkActionsButtons.js +0 -15
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/LinkActionsButtons.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/ValuesList.d.ts +0 -16
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/ValuesList.js +0 -35
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/ValuesList.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/useDisplayTreeNode.js +0 -8
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/useDisplayTreeNode.js.map +0 -1
- package/dist/components/SelectTreeNodeModal/SelectTreeNodeModal.js.map +0 -1
- package/dist/components/SelectTreeNodeModal/index.d.ts +0 -1
- package/dist/components/SelectTreeNodeModal/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectTreeNodeModal.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,
|
|
1
|
+
{"version":3,"file":"SelectTreeNodeModal.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAoC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAClE,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAC,OAAO,EAAC,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAE/C,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,MAAM,6BAA6B,GAAG,OAAO,CAAC;AAC9C,MAAM,4BAA4B,GAAG,OAAO,CAAC;AA8B7C,MAAM,CAAC,MAAM,mBAAmB,GAAiD,CAAC,EAC9E,KAAK,EACL,IAAI,EACJ,SAAS,EACT,aAAa,EACb,SAAS,EACT,OAAO,EACP,qCAAqC,EACrC,SAAS,EACZ,EAAE,EAAE;IACD,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,CAAC,aAAa,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAwB,EAAE,CAAC,CAAC;IAC7E,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,QAAQ,CAAC,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AAC,WAAW,CAAC,EAAE,EAChC,QAAQ,CAAC,2HAA2H;oBACpI,aAAa,EAAE;gBACX,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrC,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;aAClF,EACD,qCAAqC,EAAE,qCAAqC,EAC5E,aAAa,EAAE,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,EAC9F,QAAQ,EAAE,eAAe,GAC3B,GACK,CACd,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
import { RecordFormAttributeTreeAttributeFragment } from '../../../../../../_gqlTypes';
|
|
2
|
+
import { ChildrenAsRecordValuePermissionFilterInput, RecordFormAttributeTreeAttributeFragment } from '../../../../../../_gqlTypes';
|
|
3
3
|
import { RecordFormElementsValueTreeValue } from '../../../../../../hooks/useGetRecordForm';
|
|
4
4
|
import { DeleteMultipleValuesFunc, DeleteValueFunc, SubmitValueFunc } from '../../../_types';
|
|
5
5
|
interface IUseManageTreeNodeSelectionProps {
|
|
6
6
|
modaleTitle: string;
|
|
7
7
|
attribute: RecordFormAttributeTreeAttributeFragment;
|
|
8
|
+
isFormCreationMode: boolean;
|
|
8
9
|
backendValues: RecordFormElementsValueTreeValue[];
|
|
9
10
|
setBackendValues: Dispatch<SetStateAction<RecordFormElementsValueTreeValue[]>>;
|
|
10
11
|
onValueSubmit: SubmitValueFunc;
|
|
@@ -12,8 +13,9 @@ interface IUseManageTreeNodeSelectionProps {
|
|
|
12
13
|
onDeleteMultipleValues: DeleteMultipleValuesFunc;
|
|
13
14
|
isReadOnly: boolean;
|
|
14
15
|
isFieldInError: boolean;
|
|
16
|
+
childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;
|
|
15
17
|
}
|
|
16
|
-
export declare const useManageTreeNodeSelection: ({ modaleTitle, attribute, backendValues, setBackendValues, onValueSubmit, onValueDelete, onDeleteMultipleValues, isReadOnly, isFieldInError }: IUseManageTreeNodeSelectionProps) => {
|
|
18
|
+
export declare const useManageTreeNodeSelection: ({ modaleTitle, attribute, isFormCreationMode, backendValues, setBackendValues, onValueSubmit, onValueDelete, onDeleteMultipleValues, isReadOnly, isFieldInError, childrenAsRecordValuePermissionFilter }: IUseManageTreeNodeSelectionProps) => {
|
|
17
19
|
openModal: () => void;
|
|
18
20
|
removeTreeNode: (nodeValue: RecordFormElementsValueTreeValue, skipAfterRemove?: boolean) => Promise<void>;
|
|
19
21
|
actionButtonLabel: string;
|
|
@@ -3,45 +3,35 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
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 { useEffect, useState } from 'react';
|
|
6
|
-
import { SelectTreeNodeModal } from './SelectTreeNodeModal';
|
|
7
|
-
import { APICallStatus } from '../../../_types';
|
|
8
|
-
import { arrayValueVersionToObject } from '../../../../../../_utils';
|
|
9
|
-
import { DeleteAllValuesButton } from '../../shared/DeleteAllValuesButton';
|
|
10
6
|
import { AntForm } from 'aristid-ds';
|
|
7
|
+
import { arrayValueVersionToObject } from '../../../../../../_utils';
|
|
11
8
|
import { useSharedTranslation } from '../../../../../../hooks/useSharedTranslation';
|
|
12
|
-
|
|
9
|
+
import { APICallStatus } from '../../../_types';
|
|
10
|
+
import { DeleteAllValuesButton } from '../../shared/DeleteAllValuesButton';
|
|
11
|
+
import { SelectTreeNodeModal } from './SelectTreeNodeModal';
|
|
12
|
+
import { Form } from 'antd';
|
|
13
|
+
export const useManageTreeNodeSelection = ({ modaleTitle, attribute, isFormCreationMode, backendValues, setBackendValues, onValueSubmit, onValueDelete, onDeleteMultipleValues, isReadOnly, isFieldInError, childrenAsRecordValuePermissionFilter }) => {
|
|
13
14
|
const { t } = useSharedTranslation();
|
|
14
15
|
const form = AntForm.useFormInstance();
|
|
15
|
-
|
|
16
|
+
// Used to force the input error display when a value is set
|
|
17
|
+
const treeNodeValue = Form.useWatch(attribute.id, form);
|
|
18
|
+
const [isModalHidden, setIsModalHidden] = useState(true);
|
|
16
19
|
useEffect(() => {
|
|
17
|
-
if (backendValues.length === 0 && attribute.required) {
|
|
18
|
-
|
|
19
|
-
form.setFields([
|
|
20
|
-
{
|
|
21
|
-
name: attribute.id,
|
|
22
|
-
errors: [t('errors.standard_field_required')]
|
|
23
|
-
}
|
|
24
|
-
]);
|
|
20
|
+
if (!isFormCreationMode && backendValues.length === 0 && attribute.required) {
|
|
21
|
+
form.setFields([{ name: attribute.id, errors: [t('errors.standard_field_required')] }]);
|
|
25
22
|
}
|
|
26
23
|
}, []);
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
};
|
|
30
|
-
const closeModal = () => {
|
|
31
|
-
setIsModalVisible(false);
|
|
24
|
+
const _closeModal = () => {
|
|
25
|
+
setIsModalHidden(true);
|
|
32
26
|
};
|
|
33
|
-
const
|
|
27
|
+
const _addTreeNodes = async (selectedNodes) => {
|
|
34
28
|
const valuesToSave = selectedNodes.map(node => ({
|
|
35
29
|
attribute,
|
|
36
|
-
idValue: null,
|
|
30
|
+
idValue: !attribute.multiple_values && backendValues.length > 0 ? backendValues[0].id_value : null,
|
|
37
31
|
value: node
|
|
38
32
|
}));
|
|
39
33
|
// When we will handle computed values, we will need to passe the active version (if still needed)
|
|
40
34
|
const result = await onValueSubmit(valuesToSave, null);
|
|
41
|
-
if (!attribute.multiple_values && backendValues.length > 0) {
|
|
42
|
-
// As we can't replace a single value, we need to remove the previous one
|
|
43
|
-
await removeTreeNode(backendValues[0], true);
|
|
44
|
-
}
|
|
45
35
|
if (result.status === APICallStatus.SUCCESS) {
|
|
46
36
|
const formattedValues = result.values.map(value => ({
|
|
47
37
|
...value,
|
|
@@ -80,32 +70,7 @@ export const useManageTreeNodeSelection = ({ modaleTitle, attribute, backendValu
|
|
|
80
70
|
]);
|
|
81
71
|
}
|
|
82
72
|
};
|
|
83
|
-
const
|
|
84
|
-
const result = await onValueDelete({ id_value: nodeValue.id_value }, attribute.id);
|
|
85
|
-
if (skipAfterRemove) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
if (result.status === APICallStatus.SUCCESS) {
|
|
89
|
-
const newBackendValues = backendValues.filter(value => value.id_value !== nodeValue.id_value);
|
|
90
|
-
form.setFieldValue(attribute.id, newBackendValues.map(({ treeValue }) => treeValue.id));
|
|
91
|
-
form.setFields([
|
|
92
|
-
{
|
|
93
|
-
name: attribute.id,
|
|
94
|
-
errors: attribute.required && newBackendValues.length === 0 ? [t('errors.standard_field_required')] : []
|
|
95
|
-
}
|
|
96
|
-
]);
|
|
97
|
-
setBackendValues(newBackendValues);
|
|
98
|
-
}
|
|
99
|
-
if (result.status === APICallStatus.ERROR) {
|
|
100
|
-
form.setFields([
|
|
101
|
-
{
|
|
102
|
-
name: attribute.id,
|
|
103
|
-
errors: [t('error.error_occurred')]
|
|
104
|
-
}
|
|
105
|
-
]);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
const removeAllTreeNodes = async () => {
|
|
73
|
+
const _removeAllTreeNodes = async () => {
|
|
109
74
|
// When we will handle computed values, we will need to passe the active version (if still needed)
|
|
110
75
|
const result = await onDeleteMultipleValues(attribute.id, backendValues, null);
|
|
111
76
|
if (result.status === APICallStatus.SUCCESS) {
|
|
@@ -128,18 +93,41 @@ export const useManageTreeNodeSelection = ({ modaleTitle, attribute, backendValu
|
|
|
128
93
|
]);
|
|
129
94
|
}
|
|
130
95
|
};
|
|
131
|
-
const
|
|
132
|
-
if (!attribute.multiple_values && backendValues.length > 0) {
|
|
133
|
-
return `${t('global.replace')} ${modaleTitle}`;
|
|
134
|
-
}
|
|
135
|
-
return `${t('global.add')} ${modaleTitle}`;
|
|
136
|
-
};
|
|
96
|
+
const label = `${t(!attribute.multiple_values && backendValues.length > 0 ? 'global.replace' : 'global.add')} ${modaleTitle}`;
|
|
137
97
|
return {
|
|
138
|
-
openModal
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
98
|
+
openModal: () => {
|
|
99
|
+
setIsModalHidden(false);
|
|
100
|
+
},
|
|
101
|
+
removeTreeNode: async (nodeValue, skipAfterRemove = false) => {
|
|
102
|
+
const result = await onValueDelete({ id_value: nodeValue.id_value }, attribute.id);
|
|
103
|
+
if (skipAfterRemove) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (result.status === APICallStatus.SUCCESS) {
|
|
107
|
+
const newBackendValues = backendValues.filter(value => value.id_value !== nodeValue.id_value);
|
|
108
|
+
form.setFieldValue(attribute.id, newBackendValues.map(({ treeValue }) => treeValue.id));
|
|
109
|
+
form.setFields([
|
|
110
|
+
{
|
|
111
|
+
name: attribute.id,
|
|
112
|
+
errors: attribute.required && newBackendValues.length === 0
|
|
113
|
+
? [t('errors.standard_field_required')]
|
|
114
|
+
: []
|
|
115
|
+
}
|
|
116
|
+
]);
|
|
117
|
+
setBackendValues(newBackendValues);
|
|
118
|
+
}
|
|
119
|
+
if (result.status === APICallStatus.ERROR) {
|
|
120
|
+
form.setFields([
|
|
121
|
+
{
|
|
122
|
+
name: attribute.id,
|
|
123
|
+
errors: [t('error.error_occurred')]
|
|
124
|
+
}
|
|
125
|
+
]);
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
actionButtonLabel: label,
|
|
129
|
+
SelectTreeNodeModal: isModalHidden ? null : (_jsx(SelectTreeNodeModal, { open: true, title: label, attribute: attribute, backendValues: backendValues, onConfirm: _addTreeNodes, onClose: _closeModal, childrenAsRecordValuePermissionFilter: childrenAsRecordValuePermissionFilter })),
|
|
130
|
+
RemoveAllTreeNodes: backendValues.length > 1 && attribute.multiple_values && !attribute.required ? (_jsx(DeleteAllValuesButton, { handleDelete: _removeAllTreeNodes, disabled: isReadOnly, danger: isFieldInError })) : null
|
|
143
131
|
};
|
|
144
132
|
};
|
|
145
133
|
//# sourceMappingURL=useManageTreeNodeSelection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useManageTreeNodeSelection.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,
|
|
1
|
+
{"version":3,"file":"useManageTreeNodeSelection.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAA2C,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACpF,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AAGnC,OAAO,EAAC,yBAAyB,EAAC,MAAM,YAAY,CAAC;AACrD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,aAAa,EAA6D,MAAM,iBAAiB,CAAC;AAC1G,OAAO,EAAC,qBAAqB,EAAC,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAgB1B,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EACvC,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,a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C,EAAE;wBAClB,MAAM,EACF,SAAS,CAAC,QAAQ,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC;4BAC/C,CAAC,CAAC,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC;4BACvC,CAAC,CAAC,EAAE;qBACf;iBACJ,CAAC,CAAC;gBAEH,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;YACvC,CAAC;YAED,IAAI,MAAM,CAAC,MAAM,KAAK,aAAa,CAAC,KAAK,EAAE,CAAC;gBACxC,IAAI,CAAC,SAAS,CAAC;oBACX;wBACI,IAAI,EAAE,SAAS,CAAC,EAAE;wBAClB,MAAM,EAAE,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC;qBACtC;iBACJ,CAAC,CAAC;YACP,CAAC;QACL,CAAC;QACD,iBAAiB,EAAE,KAAK;QACxB,mBAAmB,EAAE,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACxC,KAAC,mBAAmB,IAChB,IAAI,QACJ,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,WAAW,EACpB,qCAAqC,EAAE,qCAAqC,GAC9E,CACL;QACD,kBAAkB,EACd,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,CAAC,eAAe,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAC3E,KAAC,qBAAqB,IAClB,YAAY,EAAE,mBAAmB,EACjC,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,cAAc,GACxB,CACL,CAAC,CAAC,CAAC,IAAI;KACf,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -7,11 +7,9 @@ interface IUseOutsideInteractionDetectorProps {
|
|
|
7
7
|
attribute: RecordFormElementFragment['attribute'];
|
|
8
8
|
activeAttribute: IRecordPropertyWithAttribute | null;
|
|
9
9
|
dispatch: Dispatch<IEditRecordReducerActions>;
|
|
10
|
-
formIdToLoad: string | 'edition' | 'creation';
|
|
11
10
|
backendValues: RecordFormElementsValue[];
|
|
12
|
-
pendingValues: RecordFormElementsValue[];
|
|
13
11
|
allowedSelectors?: string[];
|
|
14
12
|
attributePrefix?: typeof LINK_FIELD_ID_PREFIX | typeof STANDARD_FIELD_ID_PREFIX | typeof TREE_FIELD_ID_PREFIX;
|
|
15
13
|
}
|
|
16
|
-
export declare const useOutsideInteractionDetector: ({ attribute, activeAttribute, attributePrefix, dispatch,
|
|
14
|
+
export declare const useOutsideInteractionDetector: ({ attribute, activeAttribute, attributePrefix, dispatch, backendValues, allowedSelectors }: IUseOutsideInteractionDetectorProps) => void;
|
|
17
15
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EditRecordReducerActionsTypes } from '../../../../../components/RecordEdition/editRecordReducer/editRecordReducer';
|
|
2
2
|
import { EDIT_RECORD_SIDEBAR_ID } from '../../../../../constants';
|
|
3
3
|
import { useEffect, useRef } from 'react';
|
|
4
|
-
export const useOutsideInteractionDetector = ({ attribute, activeAttribute, attributePrefix, dispatch,
|
|
4
|
+
export const useOutsideInteractionDetector = ({ attribute, activeAttribute, attributePrefix, dispatch, backendValues, allowedSelectors = [] }) => {
|
|
5
5
|
// Use a ref to store the current props to access them in the event handlers
|
|
6
6
|
// This will prevent issue when multiple event handlers are attached to the document
|
|
7
7
|
const hookPropsRef = useRef({
|
|
@@ -9,9 +9,7 @@ export const useOutsideInteractionDetector = ({ attribute, activeAttribute, attr
|
|
|
9
9
|
activeAttribute,
|
|
10
10
|
attributePrefix,
|
|
11
11
|
allowedSelectors,
|
|
12
|
-
|
|
13
|
-
backendValues,
|
|
14
|
-
pendingValues
|
|
12
|
+
backendValues
|
|
15
13
|
});
|
|
16
14
|
useEffect(() => {
|
|
17
15
|
hookPropsRef.current = {
|
|
@@ -19,11 +17,9 @@ export const useOutsideInteractionDetector = ({ attribute, activeAttribute, attr
|
|
|
19
17
|
activeAttribute,
|
|
20
18
|
attributePrefix,
|
|
21
19
|
allowedSelectors,
|
|
22
|
-
|
|
23
|
-
backendValues,
|
|
24
|
-
pendingValues
|
|
20
|
+
backendValues
|
|
25
21
|
};
|
|
26
|
-
}, [attribute, activeAttribute, attributePrefix, allowedSelectors,
|
|
22
|
+
}, [attribute, activeAttribute, attributePrefix, allowedSelectors, backendValues]);
|
|
27
23
|
useEffect(() => {
|
|
28
24
|
const handleClick = (event) => {
|
|
29
25
|
const currentProps = hookPropsRef.current;
|
|
@@ -34,7 +30,7 @@ export const useOutsideInteractionDetector = ({ attribute, activeAttribute, attr
|
|
|
34
30
|
dispatch({
|
|
35
31
|
type: EditRecordReducerActionsTypes.SET_ACTIVE_VALUE,
|
|
36
32
|
attribute: currentProps.attribute,
|
|
37
|
-
values:
|
|
33
|
+
values: currentProps.backendValues
|
|
38
34
|
});
|
|
39
35
|
return;
|
|
40
36
|
}
|
|
@@ -61,7 +57,7 @@ export const useOutsideInteractionDetector = ({ attribute, activeAttribute, attr
|
|
|
61
57
|
dispatch({
|
|
62
58
|
type: EditRecordReducerActionsTypes.SET_ACTIVE_VALUE,
|
|
63
59
|
attribute: currentProps.attribute,
|
|
64
|
-
values:
|
|
60
|
+
values: currentProps.backendValues
|
|
65
61
|
});
|
|
66
62
|
}
|
|
67
63
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOutsideInteractionDetector.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/shared/useOutsideInteractionDetector.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,6BAA6B,EAGhC,MAAM,kEAAkE,CAAC;AAC1E,OAAO,EACH,sBAAsB,EAIzB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAW,SAAS,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useOutsideInteractionDetector.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/shared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C;QACL,CAAC,CAAC;QAEF,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QACpD,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAElD,OAAO,GAAG,EAAE;YACR,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YACvD,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QACzD,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACnB,CAAC,CAAC"}
|
|
@@ -15,5 +15,8 @@ export interface IEditRecordModalProps {
|
|
|
15
15
|
submitButtons?: possibleSubmitButtons;
|
|
16
16
|
withInfoButton?: boolean;
|
|
17
17
|
valuesVersion?: IValueVersion;
|
|
18
|
+
showSidebar?: boolean;
|
|
19
|
+
enableSidebar?: boolean;
|
|
20
|
+
autoHeight?: boolean;
|
|
18
21
|
}
|
|
19
22
|
export declare const EditRecordModal: FunctionComponent<IEditRecordModalProps>;
|
|
@@ -2,77 +2,88 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
|
|
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
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { KitButton, KitSpace, KitTypography } from 'aristid-ds';
|
|
5
|
+
import { useEffect, useRef, useState } from 'react';
|
|
6
|
+
import { KitButton, KitModal, KitSpace, KitTypography } from 'aristid-ds';
|
|
8
7
|
import styled from 'styled-components';
|
|
9
8
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
10
9
|
import { EditRecord } from '../EditRecord';
|
|
11
10
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
12
|
-
import { faXmark
|
|
11
|
+
import { faXmark } from '@fortawesome/free-solid-svg-icons';
|
|
13
12
|
import { useGetSubmitButtons } from '../hooks/useGetSubmitButtons';
|
|
14
13
|
import { useForm } from 'antd/lib/form/Form';
|
|
15
14
|
import { useCreateCancelConfirm } from '../hooks/useCreateCancelConfirm';
|
|
16
15
|
import { v4 as uuidv4 } from 'uuid';
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
import { EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS } from '../constants';
|
|
17
|
+
import useExecuteCreateEmptyRecordMutation from '../EditRecordContent/hooks/useCreateEmptyRecordMutation';
|
|
18
|
+
import { APICallStatus } from '../EditRecordContent/_types';
|
|
19
|
+
const MODAL_HEIGHT = '80vh';
|
|
20
|
+
const MODAL_WIDTH = '90vw';
|
|
21
|
+
const MODAL_MAX_WIDTH = '1200px';
|
|
22
|
+
const KitModalStyled = styled(KitModal) `
|
|
19
23
|
&& {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
& > div {
|
|
25
|
+
max-width: ${MODAL_MAX_WIDTH};
|
|
26
|
+
|
|
27
|
+
.kit-modal-header {
|
|
28
|
+
border-bottom: 1px solid var(--general-utilities-border);
|
|
29
|
+
|
|
30
|
+
.kit-modal-title {
|
|
31
|
+
padding-right: calc(var(--general-spacing-xs) * 1px);
|
|
32
|
+
|
|
33
|
+
.ant-space {
|
|
34
|
+
width: 100%;
|
|
35
|
+
justify-content: space-between;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
23
39
|
|
|
24
|
-
|
|
25
|
-
|
|
40
|
+
.kit-modal-content-wrapper {
|
|
41
|
+
padding: 0;
|
|
42
|
+
|
|
43
|
+
.kit-modal-content {
|
|
44
|
+
height: 100%;
|
|
45
|
+
|
|
46
|
+
& > div {
|
|
47
|
+
height: 100%;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
26
51
|
}
|
|
27
52
|
}
|
|
28
53
|
`;
|
|
29
|
-
const
|
|
30
|
-
height: 3.5rem;
|
|
31
|
-
grid-area: title;
|
|
32
|
-
align-self: center;
|
|
33
|
-
font-size: 1rem;
|
|
34
|
-
padding: 10px 50px 10px 10px;
|
|
35
|
-
border-bottom: 1px solid var(--general-utilities-border);
|
|
36
|
-
display: flex;
|
|
37
|
-
justify-content: space-between;
|
|
38
|
-
align-items: center;
|
|
39
|
-
`;
|
|
40
|
-
const ModalFooter = styled.div `
|
|
41
|
-
display: flex;
|
|
42
|
-
justify-content: flex-end;
|
|
43
|
-
padding: 0.5rem 1rem;
|
|
44
|
-
border-top: 1px solid var(--general-utilities-border);
|
|
45
|
-
`;
|
|
46
|
-
export const EditRecordModal = ({ className, open, record, creationFormId, editionFormId, library, onClose, onCreate, onCreateAndEdit, submitButtons = ['create'], valuesVersion, withInfoButton = true }) => {
|
|
54
|
+
export const EditRecordModal = ({ className, open, record, creationFormId, editionFormId, library, onClose, onCreate, onCreateAndEdit, valuesVersion, showSidebar, enableSidebar, submitButtons = ['create'], withInfoButton = true, autoHeight = false }) => {
|
|
47
55
|
const { t } = useSharedTranslation();
|
|
48
|
-
const
|
|
56
|
+
const [antdForm] = useForm();
|
|
49
57
|
const [currentRecord, setCurrentRecord] = useState(record);
|
|
50
58
|
const [clickedSubmitButton, setClickedSubmitButton] = useState(null);
|
|
59
|
+
const { createEmptyRecord } = useExecuteCreateEmptyRecordMutation();
|
|
51
60
|
const formElementId = useRef(uuidv4());
|
|
52
|
-
const isCreation = !
|
|
61
|
+
const [isCreation, setIsCreation] = useState(!record);
|
|
62
|
+
const [formId, setFormId] = useState(isCreation ? (creationFormId ?? 'creation') : (editionFormId ?? 'edition'));
|
|
63
|
+
const closeButtonLabel = isCreation ? t('global.cancel') : t('global.close');
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
const createEmptyRecordFunction = async () => {
|
|
66
|
+
const res = await createEmptyRecord(library);
|
|
67
|
+
if (res?.status === APICallStatus.ERROR) {
|
|
68
|
+
// TODO : call KitNotification error
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
setCurrentRecord(res?.record ?? null);
|
|
72
|
+
};
|
|
73
|
+
if (open && isCreation && !currentRecord) {
|
|
74
|
+
createEmptyRecordFunction();
|
|
75
|
+
}
|
|
76
|
+
}, [open, currentRecord]);
|
|
53
77
|
const _handleClickSubmit = (button) => {
|
|
54
78
|
setClickedSubmitButton(button);
|
|
55
79
|
};
|
|
80
|
+
const showCancelConfirm = useCreateCancelConfirm(onClose);
|
|
56
81
|
const displayedSubmitButtons = useGetSubmitButtons(submitButtons, formElementId.current, isCreation, _handleClickSubmit);
|
|
57
|
-
const [antdForm] = useForm();
|
|
58
|
-
const _handleClose = () => {
|
|
59
|
-
if (isCreation && antdForm.isFieldsTouched()) {
|
|
60
|
-
return showCancelConfirm();
|
|
61
|
-
}
|
|
62
|
-
return onClose();
|
|
63
|
-
};
|
|
64
|
-
// Create refs for the buttons to pass them to the EditRecord component
|
|
65
|
-
const refreshButtonRef = useRef(null);
|
|
66
|
-
const valuesVersionsButtonRef = useRef(null);
|
|
67
|
-
const closeButtonLabel = isCreation ? t('global.cancel') : t('global.close');
|
|
68
|
-
const footerButtons = [
|
|
69
|
-
_jsx(KitButton, { "aria-label": closeButtonLabel, icon: _jsx(FontAwesomeIcon, { icon: faXmark }), onClick: _handleClose, children: closeButtonLabel }, "close"),
|
|
70
|
-
...displayedSubmitButtons
|
|
71
|
-
];
|
|
72
|
-
const footer = (_jsx(ModalFooter, { children: _jsx(KitSpace, { children: footerButtons }) }));
|
|
73
82
|
const _handleCreate = (newRecord) => {
|
|
74
83
|
setCurrentRecord(newRecord);
|
|
75
84
|
if (onCreateAndEdit && clickedSubmitButton === 'createAndEdit') {
|
|
85
|
+
setFormId(editionFormId ?? 'edition');
|
|
86
|
+
setIsCreation(false);
|
|
76
87
|
onCreateAndEdit(newRecord);
|
|
77
88
|
return;
|
|
78
89
|
}
|
|
@@ -81,10 +92,15 @@ export const EditRecordModal = ({ className, open, record, creationFormId, editi
|
|
|
81
92
|
return;
|
|
82
93
|
}
|
|
83
94
|
};
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
95
|
+
const _handleClose = () => {
|
|
96
|
+
if (isCreation && antdForm.isFieldsTouched()) {
|
|
97
|
+
return showCancelConfirm();
|
|
98
|
+
}
|
|
99
|
+
return onClose();
|
|
100
|
+
};
|
|
101
|
+
return (_jsx(KitModalStyled, { className: className, height: autoHeight ? 'auto' : MODAL_HEIGHT, maxHeight: autoHeight ? MODAL_HEIGHT : undefined, width: MODAL_WIDTH, isOpen: open, close: _handleClose, title: _jsxs(KitSpace, { children: [_jsx(KitTypography.Title, { level: "h2", style: { margin: 0 }, children: currentRecord?.label ?? t('record_edition.new_record') }), _jsx("div", { id: EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS })] }), footer: _jsx(KitSpace, { children: [
|
|
102
|
+
_jsx(KitButton, { "aria-label": closeButtonLabel, icon: _jsx(FontAwesomeIcon, { icon: faXmark }), onClick: _handleClose, children: closeButtonLabel }, "close"),
|
|
103
|
+
...displayedSubmitButtons
|
|
104
|
+
] }), closeIcon: _jsx(FontAwesomeIcon, { icon: faXmark }), showCloseIcon: true, destroyOnClose: true, children: _jsx(EditRecord, { antdForm: antdForm, isFormCreationMode: isCreation, formId: formId, formElementId: formElementId.current, record: currentRecord, library: library, onCreate: _handleCreate, valuesVersion: valuesVersion, showSidebar: showSidebar, enableSidebar: enableSidebar, withInfoButton: withInfoButton }) }));
|
|
89
105
|
};
|
|
90
106
|
//# sourceMappingURL=EditRecordModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditRecordModal.js","sourceRoot":"","sources":["../../../../src/components/RecordEdition/EditRecordModal/EditRecordModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,
|
|
1
|
+
{"version":3,"file":"EditRecordModal.js","sourceR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C,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,EAChD,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,YAAY,EACnB,KAAK,EACD,MAAC,QAAQ,eACL,KAAC,aAAa,CAAC,KAAK,IAAC,KAAK,EAAC,IAAI,EAAC,KAAK,EAAE,EAAC,MAAM,EAAE,CAAC,EAAC,YAC7C,aAAa,EAAE,KAAK,IAAI,CAAC,CAAC,2BAA2B,CAAC,GACrC,EACtB,cAAK,EAAE,EAAE,0CAA0C,GAAI,IAChD,EAEf,MAAM,EACF,KAAC,QAAQ,cACJ;gBACG,KAAC,SAAS,kBACM,gBAAgB,EAE5B,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,OAAO,GAAI,EACxC,OAAO,EAAE,YAAY,YAEpB,gBAAgB,IAJb,OAAO,CAKH;gBACZ,GAAG,sBAAsB;aAC5B,GACM,EAEf,SAAS,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,OAAO,GAAI,EAC7C,aAAa,QACb,cAAc,kBAEd,KAAC,UAAU,IACP,QAAQ,EAAE,QAAQ,EAClB,kBAAkB,EAAE,UAAU,EAC9B,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,CAAC,OAAO,EACpC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,aAAa,EACvB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,GAChC,GACW,CACpB,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -13,9 +13,11 @@ interface IEditRecordPageProps {
|
|
|
13
13
|
submitButtons?: possibleSubmitButtons;
|
|
14
14
|
valuesVersion?: IValueVersion;
|
|
15
15
|
showRefreshButton?: boolean;
|
|
16
|
+
showHeader?: boolean;
|
|
16
17
|
withInfoButton?: boolean;
|
|
17
|
-
onClose
|
|
18
|
+
onClose?: () => void;
|
|
18
19
|
showSidebar?: boolean;
|
|
20
|
+
enableSidebar?: boolean;
|
|
19
21
|
sidebarContainer?: HTMLElement;
|
|
20
22
|
}
|
|
21
23
|
export declare const EditRecordPage: FunctionComponent<IEditRecordPageProps>;
|
|
@@ -2,17 +2,20 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
|
|
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
|
-
import { useRef, useState } from 'react';
|
|
5
|
+
import { useEffect, useRef, useState } from 'react';
|
|
6
6
|
import { KitButton, KitDivider, KitSpace, KitTypography } from 'aristid-ds';
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
9
9
|
import { EditRecord } from '../EditRecord';
|
|
10
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
11
|
-
import { faXmark, faRotateRight } from '@fortawesome/free-solid-svg-icons';
|
|
12
10
|
import { useGetSubmitButtons } from '../hooks/useGetSubmitButtons';
|
|
13
11
|
import { useForm } from 'antd/lib/form/Form';
|
|
14
12
|
import { useCreateCancelConfirm } from '../hooks/useCreateCancelConfirm';
|
|
15
13
|
import { v4 as uuidv4 } from 'uuid';
|
|
14
|
+
import { EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS } from '../constants';
|
|
15
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
16
|
+
import { faXmark } from '@fortawesome/free-solid-svg-icons';
|
|
17
|
+
import { APICallStatus } from '../EditRecordContent/_types';
|
|
18
|
+
import useExecuteCreateEmptyRecordMutation from '../EditRecordContent/hooks/useCreateEmptyRecordMutation';
|
|
16
19
|
const Header = styled.div `
|
|
17
20
|
grid-area: title;
|
|
18
21
|
align-self: center;
|
|
@@ -23,13 +26,29 @@ const Header = styled.div `
|
|
|
23
26
|
justify-content: space-between;
|
|
24
27
|
align-items: center;
|
|
25
28
|
`;
|
|
26
|
-
|
|
29
|
+
const emptyFunction = () => null;
|
|
30
|
+
export const EditRecordPage = ({ record, library, creationFormId, editionFormId, onCreate, onCreateAndEdit, valuesVersion, title, showHeader = true, submitButtons = ['create'], withInfoButton, onClose = emptyFunction, enableSidebar, showSidebar, sidebarContainer }) => {
|
|
27
31
|
const { t } = useSharedTranslation();
|
|
28
32
|
const [currentRecord, setCurrentRecord] = useState(record);
|
|
29
33
|
const [clickedSubmitButton, setClickedSubmitButton] = useState(null);
|
|
30
34
|
const showCancelConfirm = useCreateCancelConfirm(onClose);
|
|
31
35
|
const formElementId = useRef(uuidv4());
|
|
32
|
-
const isCreation = !
|
|
36
|
+
const [isCreation, setIsCreation] = useState(!record);
|
|
37
|
+
const { createEmptyRecord } = useExecuteCreateEmptyRecordMutation();
|
|
38
|
+
const [formId, setFormId] = useState(isCreation ? (creationFormId ?? 'creation') : (editionFormId ?? 'edition'));
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
const createEmptyRecordFunction = async () => {
|
|
41
|
+
const res = await createEmptyRecord(library);
|
|
42
|
+
if (res?.status === APICallStatus.ERROR) {
|
|
43
|
+
// TODO : call KitNotification error
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
setCurrentRecord(res?.record ?? null);
|
|
47
|
+
};
|
|
48
|
+
if (isCreation) {
|
|
49
|
+
createEmptyRecordFunction();
|
|
50
|
+
}
|
|
51
|
+
}, []);
|
|
33
52
|
const _handleClickSubmit = (button) => {
|
|
34
53
|
setClickedSubmitButton(button);
|
|
35
54
|
};
|
|
@@ -41,12 +60,12 @@ export const EditRecordPage = ({ record, library, creationFormId, editionFormId,
|
|
|
41
60
|
}
|
|
42
61
|
return onClose();
|
|
43
62
|
};
|
|
44
|
-
// Create refs for the buttons to pass them to the EditRecord component
|
|
45
|
-
const refreshButtonRef = useRef(null);
|
|
46
63
|
const closeButtonLabel = isCreation ? t('global.cancel') : t('global.close');
|
|
47
64
|
const _handleCreate = (newRecord) => {
|
|
48
65
|
setCurrentRecord(newRecord);
|
|
49
66
|
if (onCreateAndEdit && clickedSubmitButton === 'createAndEdit') {
|
|
67
|
+
setFormId(editionFormId ?? 'edition');
|
|
68
|
+
setIsCreation(false);
|
|
50
69
|
onCreateAndEdit(newRecord);
|
|
51
70
|
return;
|
|
52
71
|
}
|
|
@@ -55,7 +74,6 @@ export const EditRecordPage = ({ record, library, creationFormId, editionFormId,
|
|
|
55
74
|
return;
|
|
56
75
|
}
|
|
57
76
|
};
|
|
58
|
-
|
|
59
|
-
return (_jsxs(_Fragment, { children: [_jsxs(Header, { children: [title !== undefined ? (title) : (_jsx(KitTypography.Title, { level: "h2", style: { margin: 0 }, children: currentRecord?.label ?? t('record_edition.new_record') })), _jsxs(KitSpace, { children: [showRefreshButton && (_jsx(KitButton, { ref: refreshButtonRef, "aria-label": "refresh", type: "tertiary", icon: _jsx(FontAwesomeIcon, { icon: faRotateRight }) })), _jsx(KitButton, { onClick: _handleClose, icon: _jsx(FontAwesomeIcon, { icon: faXmark }), children: closeButtonLabel }), _jsx(KitSpace, { children: displayedSubmitButtons })] })] }), _jsx(KitDivider, { noMargin: true, color: "lightGrey" }), _jsx(EditRecord, { antdForm: antdForm, formId: formId, formElementId: formElementId.current, record: currentRecord, library: library, valuesVersion: valuesVersion, onCreate: _handleCreate, buttonsRefs: { refresh: refreshButtonRef }, containerStyle: { height: 'calc(100% - 82px)' }, withInfoButton: withInfoButton, showSidebar: showSidebar, sidebarContainer: sidebarContainer })] }));
|
|
77
|
+
return (_jsxs(_Fragment, { children: [showHeader && (_jsxs(_Fragment, { children: [_jsxs(Header, { children: [title !== undefined ? (title) : (_jsx(KitTypography.Title, { level: "h2", style: { margin: 0 }, children: currentRecord?.label ?? t('record_edition.new_record') })), _jsx("div", { id: EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS, "data-testid": EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS }), _jsx(KitButton, { onClick: _handleClose, icon: _jsx(FontAwesomeIcon, { icon: faXmark }), children: closeButtonLabel }), _jsx(KitSpace, { children: displayedSubmitButtons })] }), _jsx(KitDivider, { noMargin: true, color: "lightGrey" })] })), _jsx(EditRecord, { antdForm: antdForm, formId: formId, isFormCreationMode: isCreation, formElementId: formElementId.current, record: currentRecord, library: library, valuesVersion: valuesVersion, onCreate: _handleCreate, containerStyle: { height: 'calc(100% - 82px)' }, withInfoButton: withInfoButton, enableSidebar: enableSidebar, showSidebar: showSidebar, sidebarContainer: sidebarContainer })] }));
|
|
60
78
|
};
|
|
61
79
|
//# sourceMappingURL=EditRecordPage.js.map
|