@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
|
@@ -17,10 +17,12 @@ const _mappingLibrary = (data, libraryId, availableLangs) => {
|
|
|
17
17
|
return acc;
|
|
18
18
|
}, {})
|
|
19
19
|
: {};
|
|
20
|
-
const records = data.records.list.map(({ whoAmI, permissions, properties }) => ({
|
|
20
|
+
const records = data.records.list.map(({ whoAmI, active, permissions, properties }) => ({
|
|
21
21
|
libraryId,
|
|
22
22
|
key: whoAmI.id, // For <KitTable /> only
|
|
23
23
|
itemId: whoAmI.id, // For <KitTable /> only
|
|
24
|
+
active,
|
|
25
|
+
canActivate: permissions.create_record,
|
|
24
26
|
canDelete: permissions.delete_record,
|
|
25
27
|
whoAmI: {
|
|
26
28
|
label: null,
|
|
@@ -47,29 +49,33 @@ const _mappingLink = (data, libraryId, availableLangs) => {
|
|
|
47
49
|
return acc;
|
|
48
50
|
}, {})
|
|
49
51
|
: {};
|
|
50
|
-
const records = data.records.list
|
|
51
|
-
.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
52
|
+
const records = (data.records.list.length &&
|
|
53
|
+
data.records.list[0].property
|
|
54
|
+
.map((linkValue, index) => {
|
|
55
|
+
if (!linkValue.payload) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
libraryId,
|
|
60
|
+
// same link id can be duplicated, so we add the index to the key
|
|
61
|
+
key: linkValue.payload.whoAmI.id + index, // For <KitTable /> only
|
|
62
|
+
itemId: linkValue.payload.whoAmI.id, // For <KitTable /> only
|
|
63
|
+
canActivate: true,
|
|
64
|
+
canDelete: true,
|
|
65
|
+
active: true,
|
|
66
|
+
whoAmI: {
|
|
67
|
+
label: null,
|
|
68
|
+
subLabel: null,
|
|
69
|
+
color: null,
|
|
70
|
+
preview: null,
|
|
71
|
+
...linkValue.payload.whoAmI
|
|
72
|
+
},
|
|
73
|
+
propertiesById: linkValue.payload.properties.reduce((acc, { attributeId, values }) => ({ ...acc, [attributeId]: values }), {}),
|
|
74
|
+
id_value: linkValue.id_value ?? undefined
|
|
75
|
+
};
|
|
76
|
+
})
|
|
77
|
+
.filter(Boolean)) ||
|
|
78
|
+
[];
|
|
73
79
|
return {
|
|
74
80
|
totalCount: records.length,
|
|
75
81
|
attributes,
|
|
@@ -81,7 +87,6 @@ export const useExplorerData = ({ entrypoint, libraryId, attributeIds, fulltextS
|
|
|
81
87
|
const isLibrary = entrypoint.type === 'library';
|
|
82
88
|
const isLink = entrypoint.type === 'link';
|
|
83
89
|
const { data: attributeData } = useExplorerLinkAttributeQuery({
|
|
84
|
-
skip: entrypoint.type !== 'link',
|
|
85
90
|
variables: {
|
|
86
91
|
id: entrypoint.linkAttributeId
|
|
87
92
|
}
|
|
@@ -97,6 +102,9 @@ export const useExplorerData = ({ entrypoint, libraryId, attributeIds, fulltextS
|
|
|
97
102
|
attributeIds
|
|
98
103
|
}
|
|
99
104
|
});
|
|
105
|
+
const allowFreeEntry = isLibrary ? entrypoint.allowFreeEntry : undefined;
|
|
106
|
+
const valuesList = !isLibrary || (fulltextSearch && allowFreeEntry) ? undefined : entrypoint.valuesList; // Remove values list for free entry values list on search
|
|
107
|
+
const preparedFilters = prepareFiltersForRequest(filters, filtersOperator, valuesList);
|
|
100
108
|
const { data: libraryData, loading: libraryLoading, refetch: libraryRefetch } = useExplorerLibraryDataQuery({
|
|
101
109
|
fetchPolicy: 'network-only',
|
|
102
110
|
skip: skip || !isLibrary,
|
|
@@ -106,7 +114,7 @@ export const useExplorerData = ({ entrypoint, libraryId, attributeIds, fulltextS
|
|
|
106
114
|
pagination,
|
|
107
115
|
searchQuery: fulltextSearch,
|
|
108
116
|
multipleSort: sorts,
|
|
109
|
-
filters:
|
|
117
|
+
filters: preparedFilters
|
|
110
118
|
}
|
|
111
119
|
});
|
|
112
120
|
const isMultivalue = !!attributeData?.attributes?.list?.[0]?.multiple_values;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExplorerData.js","sourceRoot":"","sources":["../../../../src/components/Explorer/_queries/useExplorerData.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,+BAA+B,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"useExplorerData.js","sourceRoot":"","sources":["../../../../src/components/Explorer/_queries/useExplorerData.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,+BAA+B,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AASnE,OAAO,EAKH,2BAA2B,EAC3B,6BAA6B,EAC7B,wBAAwB,EAC3B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAC;AAEpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC,MAAM,eAAe,GAAG,CACpB,IAA8B,EAC9B,SAAiB,EACjB,cAAwB,EACX,EAAE;IACf,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM;QACvC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE;YACrD,GAAG,CAAC,QAAQ,CAAC,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,MAAM,EAAE,CAAC;YACT,OAAO,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC/E,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,MAAM,GAAG,GAAG,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/D,+BAA+B,CAAC,EAAC,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,EAAC,EAAE,CAAC,SAAS,CAAC,CAAC;IAEpF,OAAO;QACH,IAAI,EAAE,YAAY;QAClB,YAAY;QACZ,0BAA0B;QAC1B,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW;QACjD,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW;KACpD,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -20,7 +20,9 @@ export interface IItemData {
|
|
|
20
20
|
key: string;
|
|
21
21
|
itemId: string;
|
|
22
22
|
whoAmI: Required<RecordIdentityFragment['whoAmI']>;
|
|
23
|
+
canActivate: boolean;
|
|
23
24
|
canDelete: boolean;
|
|
25
|
+
active: boolean;
|
|
24
26
|
propertiesById: {
|
|
25
27
|
[attributeId: string]: PropertyValueFragment[];
|
|
26
28
|
};
|
|
@@ -31,10 +33,10 @@ export interface IItemData {
|
|
|
31
33
|
}
|
|
32
34
|
export interface IItemAction {
|
|
33
35
|
callback: (item: IItemData) => void;
|
|
34
|
-
icon: ReactElement;
|
|
35
|
-
label: string;
|
|
36
|
+
icon: ReactElement | ((item: IItemData) => ReactElement);
|
|
37
|
+
label: string | ((item: IItemData) => string);
|
|
36
38
|
iconOnly?: boolean;
|
|
37
|
-
isDanger?: boolean;
|
|
39
|
+
isDanger?: boolean | ((item: IItemData) => boolean);
|
|
38
40
|
disabled?: boolean | ((item: IItemData) => boolean);
|
|
39
41
|
}
|
|
40
42
|
export interface IPrimaryAction {
|
|
@@ -50,23 +52,31 @@ export interface IMassActions {
|
|
|
50
52
|
}
|
|
51
53
|
export type FeatureHook<T = {}> = {
|
|
52
54
|
isEnabled: boolean;
|
|
55
|
+
isVisible?: boolean;
|
|
53
56
|
} & T;
|
|
54
57
|
interface IExplorerFilterBaseAttribute {
|
|
55
58
|
type: AttributeType;
|
|
56
59
|
label: string;
|
|
60
|
+
id: string;
|
|
57
61
|
}
|
|
58
62
|
interface IExplorerFilterStandardAttribute extends IExplorerFilterBaseAttribute {
|
|
59
63
|
format: AttributeFormat;
|
|
60
64
|
}
|
|
61
|
-
interface IExplorerFilterLinkAttribute extends IExplorerFilterBaseAttribute {
|
|
65
|
+
export interface IExplorerFilterLinkAttribute extends IExplorerFilterBaseAttribute {
|
|
62
66
|
linkedLibrary?: {
|
|
63
67
|
id: string;
|
|
64
68
|
};
|
|
65
69
|
}
|
|
70
|
+
export interface IExplorerFilterTreeAttribute extends IExplorerFilterBaseAttribute {
|
|
71
|
+
linkedTree?: {
|
|
72
|
+
id: string;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
66
75
|
interface IExplorerBaseFilter {
|
|
67
76
|
id: string;
|
|
68
77
|
field: string;
|
|
69
78
|
value: string | null;
|
|
79
|
+
hidden?: boolean;
|
|
70
80
|
}
|
|
71
81
|
export interface IExplorerFilterStandard extends IExplorerBaseFilter {
|
|
72
82
|
attribute: IExplorerFilterStandardAttribute;
|
|
@@ -82,10 +92,17 @@ export interface IExplorerFilterThrough extends IExplorerBaseFilter {
|
|
|
82
92
|
subCondition: RecordFilterCondition | null;
|
|
83
93
|
subField: string | null;
|
|
84
94
|
}
|
|
85
|
-
export
|
|
95
|
+
export interface IExplorerFilterTree extends Omit<IExplorerBaseFilter, 'value' | 'field'> {
|
|
96
|
+
attribute: IExplorerFilterTreeAttribute;
|
|
97
|
+
condition: RecordFilterCondition | null;
|
|
98
|
+
value: string[] | null;
|
|
99
|
+
field: string[];
|
|
100
|
+
}
|
|
101
|
+
export type ExplorerFilter = IExplorerFilterStandard | IExplorerFilterLink | IExplorerFilterThrough | IExplorerFilterTree;
|
|
86
102
|
export declare const isExplorerFilterStandard: (filter: ExplorerFilter) => filter is IExplorerFilterStandard;
|
|
87
103
|
export declare const isExplorerFilterLink: (filter: ExplorerFilter) => filter is IExplorerFilterLink;
|
|
88
104
|
export declare const isExplorerFilterThrough: (filter: ExplorerFilter) => filter is IExplorerFilterThrough;
|
|
105
|
+
export declare const isExplorerFilterTree: (filter: ExplorerFilter) => filter is IExplorerFilterTree;
|
|
89
106
|
export interface IFilterDropDownProps {
|
|
90
107
|
filter: ExplorerFilter;
|
|
91
108
|
}
|
|
@@ -101,6 +118,8 @@ export interface IEntrypointTree {
|
|
|
101
118
|
export interface IEntrypointLibrary {
|
|
102
119
|
type: 'library';
|
|
103
120
|
libraryId: string;
|
|
121
|
+
valuesList?: string[];
|
|
122
|
+
allowFreeEntry?: boolean;
|
|
104
123
|
}
|
|
105
124
|
export interface IEntrypointLink {
|
|
106
125
|
type: 'link';
|
|
@@ -111,9 +130,11 @@ export interface IEntrypointLink {
|
|
|
111
130
|
export type ValidFieldFilter = Override<ViewDetailsFilterFragment, {
|
|
112
131
|
field: NonNullable<ViewDetailsFilterFragment['field']>;
|
|
113
132
|
condition: NonNullable<ViewDetailsFilterFragment['condition']>;
|
|
133
|
+
hidden: boolean;
|
|
114
134
|
}>;
|
|
115
135
|
export type ValidFieldFilterThrough = Override<ValidFieldFilter, {
|
|
116
136
|
condition: ThroughConditionFilter.THROUGH;
|
|
137
|
+
hidden: boolean;
|
|
117
138
|
}> & {
|
|
118
139
|
subField: NonNullable<ViewDetailsFilterFragment['field']>;
|
|
119
140
|
subCondition?: ViewDetailsFilterFragment['condition'];
|
|
@@ -130,4 +151,5 @@ export interface IDataViewOnAction {
|
|
|
130
151
|
id: string | null;
|
|
131
152
|
label: Record<string, string> | null;
|
|
132
153
|
}
|
|
154
|
+
export type SetNewPage = (newCurrentPage: number, ignoredPageSize: number) => void;
|
|
133
155
|
export {};
|
|
@@ -5,4 +5,5 @@ export const isExplorerFilterLink = (filter) => [AttributeType.simple_link, Attr
|
|
|
5
5
|
filter.condition !== ThroughConditionFilter.THROUGH;
|
|
6
6
|
export const isExplorerFilterThrough = (filter) => [AttributeType.simple_link, AttributeType.advanced_link].includes(filter.attribute.type) &&
|
|
7
7
|
filter.condition === ThroughConditionFilter.THROUGH;
|
|
8
|
+
export const isExplorerFilterTree = (filter) => filter.attribute.type === AttributeType.tree;
|
|
8
9
|
//# sourceMappingURL=_types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_types.js","sourceRoot":"","sources":["../../../src/components/Explorer/_types.ts"],"names":[],"mappings":"AAIA,OAAO,EAGH,aAAa,EAMhB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAC,sBAAsB,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"_types.js","sourceRoot":"","sources":["../../../src/components/Explorer/_types.ts"],"names":[],"mappings":"AAIA,OAAO,EAGH,aAAa,EAMhB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAC,sBAAsB,EAAC,MAAM,kBAAkB,CAAC;AAiHxD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,MAAsB,EAAqC,EAAE,CAClG,CAAC,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAEnF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAsB,EAAiC,EAAE,CAC1F,CAAC,aAAa,CAAC,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;IACxF,MAAM,CAAC,SAAS,KAAK,sBAAsB,CAAC,OAAO,CAAC;AAExD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAAsB,EAAoC,EAAE,CAChG,CAAC,aAAa,CAAC,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;IACxF,MAAM,CAAC,SAAS,KAAK,sBAAsB,CAAC,OAAO,CAAC;AAExD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAsB,EAAiC,EAAE,CAC1F,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,aAAa,CAAC,IAAI,CAAC"}
|
|
@@ -9,9 +9,10 @@ import { FeatureHook, IItemAction } from '../_types';
|
|
|
9
9
|
*
|
|
10
10
|
* @param isEnabled - whether the action is present
|
|
11
11
|
*/
|
|
12
|
-
export declare const useEditItemAction: ({ isEnabled, formId, onEdit }: FeatureHook<{
|
|
12
|
+
export declare const useEditItemAction: ({ isEnabled, formId, onEdit, refetch }: FeatureHook<{
|
|
13
13
|
onEdit?: IItemAction["callback"];
|
|
14
14
|
formId?: string;
|
|
15
|
+
refetch: () => void;
|
|
15
16
|
}>) => {
|
|
16
17
|
editItemAction: IItemAction;
|
|
17
18
|
editItemModal: JSX.Element;
|
|
@@ -18,7 +18,7 @@ import { EDIT_RECORD_MODAL_CLASSNAME } from '../_constants';
|
|
|
18
18
|
*
|
|
19
19
|
* @param isEnabled - whether the action is present
|
|
20
20
|
*/
|
|
21
|
-
export const useEditItemAction = ({ isEnabled, formId, onEdit }) => {
|
|
21
|
+
export const useEditItemAction = ({ isEnabled, formId, onEdit, refetch }) => {
|
|
22
22
|
const { t } = useSharedTranslation();
|
|
23
23
|
const [refreshItem] = useExplorerLibraryDataLazyQuery({ fetchPolicy: 'network-only' });
|
|
24
24
|
const [editingItem, setEditingItem] = useState(null);
|
|
@@ -30,6 +30,7 @@ export const useEditItemAction = ({ isEnabled, formId, onEdit }) => {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
const _handleEditModalClose = (item) => {
|
|
33
|
+
refetch();
|
|
33
34
|
refreshItem({
|
|
34
35
|
variables: {
|
|
35
36
|
libraryId: item.libraryId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useEditItemAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,KAAK,EAAQ,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,eAAe,EAAC,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EAAC,qBAAqB,EAAE,+BAA+B,EAAC,MAAM,eAAe,CAAC;AAErF,OAAO,EAAC,2BAA2B,EAAC,MAAM,eAAe,CAAC;AAE1D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAC9B,SAAS,EACT,MAAM,EACN,MAAM,
|
|
1
|
+
{"version":3,"file":"useEditItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useEditItemAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,KAAK,EAAQ,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,eAAe,EAAC,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EAAC,qBAAqB,EAAE,+BAA+B,EAAC,MAAM,eAAe,CAAC;AAErF,OAAO,EAAC,2BAA2B,EAAC,MAA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S,IAAI,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,CAChC,KAAC,eAAe,IACZ,SAAS,EAAE,2BAA2B,EACtC,IAAI,QACJ,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,WAAW,CAAC,MAAM,EAC1B,OAAO,EAAE,WAAW,CAAC,SAAS,EAC9B,OAAO,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,WAAW,CAAC,GACnD,CACL,CAAC,CAAC,CAAC,IAAI;KACf,CAAC,EACF,CAAC,SAAS,EAAE,WAAW,CAAC,CAC3B,CAAC;IAEF,OAAO,UAAU,CAAC;AACtB,CAAC,CAAC"}
|
|
@@ -13,7 +13,7 @@ import { IViewSettingsAction, IViewSettingsState } from '../manage-view-settings
|
|
|
13
13
|
* @param entrypoint - represent the current entrypoint
|
|
14
14
|
* @param canDeleteLinkValues - check permission to delete link values
|
|
15
15
|
*/
|
|
16
|
-
export declare const
|
|
16
|
+
export declare const useEditStatusItemAction: ({ isEnabled, canDeleteLinkValues, store: { view, dispatch }, onRemove, entrypoint }: FeatureHook<{
|
|
17
17
|
store: {
|
|
18
18
|
view: IViewSettingsState;
|
|
19
19
|
dispatch: Dispatch<IViewSettingsAction>;
|
|
@@ -22,5 +22,5 @@ export declare const useRemoveItemAction: ({ isEnabled, canDeleteLinkValues, sto
|
|
|
22
22
|
onRemove?: IItemAction["callback"];
|
|
23
23
|
entrypoint: Entrypoint;
|
|
24
24
|
}>) => {
|
|
25
|
-
|
|
25
|
+
editStatusItemAction: IItemAction;
|
|
26
26
|
};
|
package/dist/components/Explorer/actions-item/{useRemoveItemAction.js → useEditStatusItemAction.js}
RENAMED
|
@@ -3,9 +3,9 @@ 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 { useMemo } from 'react';
|
|
6
|
-
import { FaTrash } from 'react-icons/fa';
|
|
6
|
+
import { FaTrash, FaTrashRestore } from 'react-icons/fa';
|
|
7
7
|
import { KitModal } from 'aristid-ds';
|
|
8
|
-
import { useDeactivateRecordsMutation, useDeleteValueMutation } from '../../../_gqlTypes';
|
|
8
|
+
import { useActivateRecordsMutation, useDeactivateRecordsMutation, useDeleteValueMutation } from '../../../_gqlTypes';
|
|
9
9
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
10
10
|
import { useValuesCacheUpdate } from '../../../hooks/useValuesCacheUpdate';
|
|
11
11
|
import { ViewSettingsActionTypes } from '../manage-view-settings';
|
|
@@ -22,7 +22,7 @@ import { MASS_SELECTION_ALL } from '../_constants';
|
|
|
22
22
|
* @param entrypoint - represent the current entrypoint
|
|
23
23
|
* @param canDeleteLinkValues - check permission to delete link values
|
|
24
24
|
*/
|
|
25
|
-
export const
|
|
25
|
+
export const useEditStatusItemAction = ({ isEnabled, canDeleteLinkValues, store: { view, dispatch }, onRemove, entrypoint }) => {
|
|
26
26
|
const { t } = useSharedTranslation();
|
|
27
27
|
const updateValuesCache = useValuesCacheUpdate();
|
|
28
28
|
const [deactivateRecordsMutation] = useDeactivateRecordsMutation({
|
|
@@ -44,6 +44,25 @@ export const useRemoveItemAction = ({ isEnabled, canDeleteLinkValues, store: { v
|
|
|
44
44
|
cache.gc();
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
|
+
const [activateRecordsMutation] = useActivateRecordsMutation({
|
|
48
|
+
update(cache, activatedRecords) {
|
|
49
|
+
activatedRecords.data?.activateRecords.forEach(record => {
|
|
50
|
+
cache.evict({
|
|
51
|
+
id: cache.identify(record)
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
cache.modify({
|
|
55
|
+
fields: {
|
|
56
|
+
records: prev => ({
|
|
57
|
+
...prev,
|
|
58
|
+
totalCount: prev.totalCount - 1
|
|
59
|
+
})
|
|
60
|
+
},
|
|
61
|
+
broadcast: false
|
|
62
|
+
});
|
|
63
|
+
cache.gc();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
47
66
|
const [deleteRecordLinkMutation] = useDeleteValueMutation({
|
|
48
67
|
update: (_, deletedRecord) => {
|
|
49
68
|
const parentRecord = {
|
|
@@ -55,38 +74,65 @@ export const useRemoveItemAction = ({ isEnabled, canDeleteLinkValues, store: { v
|
|
|
55
74
|
updateValuesCache(parentRecord, deletedRecord.data?.deleteValue ?? []);
|
|
56
75
|
}
|
|
57
76
|
});
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
77
|
+
const _deactivateItem = async (item) => {
|
|
78
|
+
const libRes = await deactivateRecordsMutation({
|
|
79
|
+
variables: {
|
|
80
|
+
libraryId: item.libraryId,
|
|
81
|
+
recordsIds: [item.itemId]
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
if (view.massSelection !== MASS_SELECTION_ALL) {
|
|
85
|
+
dispatch({
|
|
86
|
+
type: ViewSettingsActionTypes.SET_SELECTED_KEYS,
|
|
87
|
+
payload: view.massSelection.filter(key => key !== item.itemId)
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
onRemove?.(item);
|
|
91
|
+
return libRes;
|
|
92
|
+
};
|
|
93
|
+
const _activateItem = async (item) => {
|
|
94
|
+
const libRes = await activateRecordsMutation({
|
|
95
|
+
variables: {
|
|
96
|
+
libraryId: item.libraryId,
|
|
97
|
+
recordsIds: [item.itemId]
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
if (view.massSelection !== MASS_SELECTION_ALL) {
|
|
101
|
+
dispatch({
|
|
102
|
+
type: ViewSettingsActionTypes.SET_SELECTED_KEYS,
|
|
103
|
+
payload: view.massSelection.filter(key => key !== item.itemId)
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return libRes;
|
|
107
|
+
};
|
|
108
|
+
const _editStatusItemAction = useMemo(() => ({
|
|
109
|
+
label: (item) => entrypoint.type === 'library'
|
|
110
|
+
? item.active
|
|
111
|
+
? t('explorer.deactivate-item')
|
|
112
|
+
: t('explorer.activate-item')
|
|
113
|
+
: t('explorer.delete-item'),
|
|
114
|
+
icon: (item) => entrypoint.type === 'library' ? item.active ? _jsx(FaTrash, {}) : _jsx(FaTrashRestore, {}) : _jsx(FaTrash, {}),
|
|
61
115
|
isDanger: true,
|
|
62
|
-
disabled: (item) =>
|
|
116
|
+
disabled: (item) => entrypoint.type === 'link' ? !canDeleteLinkValues : item.active ? !item.canDelete : !item.canActivate,
|
|
63
117
|
callback: item => {
|
|
64
|
-
const { itemId,
|
|
118
|
+
const { itemId, id_value } = item;
|
|
65
119
|
KitModal.confirm({
|
|
66
120
|
type: 'confirm',
|
|
67
121
|
dangerConfirm: true,
|
|
68
122
|
content: entrypoint.type === 'library'
|
|
69
|
-
?
|
|
123
|
+
? item.active
|
|
124
|
+
? t('records_deactivation.confirm_one')
|
|
125
|
+
: t('records_activation.confirm_one')
|
|
70
126
|
: t('record_edition.delete_link_confirm'),
|
|
71
127
|
okText: t('global.submit') ?? undefined,
|
|
72
128
|
cancelText: t('global.cancel') ?? undefined,
|
|
73
129
|
onOk: async () => {
|
|
74
130
|
switch (entrypoint.type) {
|
|
75
131
|
case 'library':
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
libraryId,
|
|
79
|
-
recordsIds: [itemId]
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
if (view.massSelection !== MASS_SELECTION_ALL) {
|
|
83
|
-
dispatch({
|
|
84
|
-
type: ViewSettingsActionTypes.SET_SELECTED_KEYS,
|
|
85
|
-
payload: view.massSelection.filter(key => key !== itemId)
|
|
86
|
-
});
|
|
132
|
+
if (item.active) {
|
|
133
|
+
return _deactivateItem(item);
|
|
87
134
|
}
|
|
88
|
-
|
|
89
|
-
return libRes;
|
|
135
|
+
return _activateItem(item);
|
|
90
136
|
case 'link':
|
|
91
137
|
const linkRes = await deleteRecordLinkMutation({
|
|
92
138
|
variables: {
|
|
@@ -111,13 +157,14 @@ export const useRemoveItemAction = ({ isEnabled, canDeleteLinkValues, store: { v
|
|
|
111
157
|
t,
|
|
112
158
|
deactivateRecordsMutation,
|
|
113
159
|
deleteRecordLinkMutation,
|
|
160
|
+
activateRecordsMutation,
|
|
114
161
|
canDeleteLinkValues,
|
|
115
162
|
entrypoint.type,
|
|
116
163
|
view.massSelection,
|
|
117
164
|
dispatch
|
|
118
165
|
]);
|
|
119
166
|
return {
|
|
120
|
-
|
|
167
|
+
editStatusItemAction: isEnabled ? _editStatusItemAction : null
|
|
121
168
|
};
|
|
122
169
|
};
|
|
123
|
-
//# sourceMappingURL=
|
|
170
|
+
//# sourceMappingURL=useEditStatusItemAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEditStatusItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useEditStatusItemAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAW,OAAO,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,OAAO,EAAE,cAAc,EAAC,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAGH,0BAA0B,EAC1B,4BAA4B,EAC5B,sBAAsB,EACzB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAA0C,uBAAuB,EAAC,MAAM,yBAAyB,CAAC;AACzG,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAGjD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EACpC,SAAS,EACT,mBAAmB,EACnB,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,EACvB,QAAQ,EACR,UAAU,EASZ,EAAE,EAAE;IACF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,E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;KACjE,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -12,7 +12,8 @@ import { ISubmitMultipleResult } from '../../../components/RecordEdition/EditRec
|
|
|
12
12
|
* @param onReplace - callback to let outside world know about replacing feedback
|
|
13
13
|
* @param canReplaceLinkValues - check permission to delete link values
|
|
14
14
|
*/
|
|
15
|
-
export declare const useReplaceItemAction: ({ isEnabled, onReplace, canReplaceLinkValues }: FeatureHook<{
|
|
15
|
+
export declare const useReplaceItemAction: ({ isEnabled, onReplace, isMultivalue, canReplaceLinkValues }: FeatureHook<{
|
|
16
|
+
isMultivalue: boolean;
|
|
16
17
|
onReplace?: (replaceValuesResult: ISubmitMultipleResult) => void;
|
|
17
18
|
canReplaceLinkValues: boolean;
|
|
18
19
|
}>) => {
|
|
@@ -18,7 +18,7 @@ import { LinkModal } from '../link-item/LinkModal';
|
|
|
18
18
|
* @param onReplace - callback to let outside world know about replacing feedback
|
|
19
19
|
* @param canReplaceLinkValues - check permission to delete link values
|
|
20
20
|
*/
|
|
21
|
-
export const useReplaceItemAction = ({ isEnabled, onReplace, canReplaceLinkValues }) => {
|
|
21
|
+
export const useReplaceItemAction = ({ isEnabled, onReplace, isMultivalue, canReplaceLinkValues }) => {
|
|
22
22
|
const { t } = useSharedTranslation();
|
|
23
23
|
const [isReplaceModalOpen, setIsReplaceModalOpen] = useState(false);
|
|
24
24
|
const [linkIdSelected, setLinkIdSelected] = useState();
|
|
@@ -33,7 +33,7 @@ export const useReplaceItemAction = ({ isEnabled, onReplace, canReplaceLinkValue
|
|
|
33
33
|
}), [canReplaceLinkValues]);
|
|
34
34
|
const replaceAction = useMemo(() => ({
|
|
35
35
|
replaceItemAction: isEnabled ? _replaceItemAction : null,
|
|
36
|
-
replaceItemModal: isEnabled && isReplaceModalOpen ? (_jsx(LinkModal, { open: true, linkId: linkIdSelected, onReplace: onReplace, onClose: () => {
|
|
36
|
+
replaceItemModal: isEnabled && isReplaceModalOpen ? (_jsx(LinkModal, { open: true, linkId: linkIdSelected, isMultivalue: isMultivalue, onReplace: onReplace, onClose: () => {
|
|
37
37
|
setIsReplaceModalOpen(false);
|
|
38
38
|
} })) : null
|
|
39
39
|
}), [isEnabled, isReplaceModalOpen, _replaceItemAction]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReplaceItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useReplaceItemAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAGjD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACjC,SAAS,EACT,SAAS,EACT,oBAAoB,
|
|
1
|
+
{"version":3,"file":"useReplaceItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useReplaceItemAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAGjD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACjC,SAAS,EACT,SAAS,EACT,YAAY,EACZ,oBAAoB,EAKtB,EAAE,EAAE;IACF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,EAAsB,CAAC;IAE3E,MAAM,kBAAkB,GAAgB,OAAO,CAC3C,GAAG,EAAE,CAAC,CAAC;QACH,KAAK,EAAE,CAAC,CAAC,uBAAuB,CAAE;QAClC,IAAI,EAAE,KAAC,aAAa,KAAG;QACvB,QAAQ,EAAE,CAAC,oBAAoB;QAC/B,QAAQ,EAAE,IAAI,CAAC,EAAE;YACb,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACjC,qBAAqB,CAAC,CAAC,kBAAkB,CAAC,CAAC;QAC/C,CAAC;KACJ,CAAC,EACF,CAAC,oBAAoB,CAAC,CACzB,CAAC;IAEF,MAAM,aAAa,GAAG,OAAO,CACzB,GAAG,EAAE,CAAC,CAAC;QACH,iBAAiB,EAAE,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI;QACxD,gBAAgB,EACZ,SAAS,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAC9B,KAAC,SAAS,IACN,IAAI,QACJ,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,GAAG,EAAE;gBACV,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC,GACH,CACL,CAAC,CAAC,CAAC,IAAI;KACf,CAAC,EACF,CAAC,SAAS,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CACtD,CAAC;IAEF,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { ISubmitMultipleResult } from '../../../components/RecordEdition/EditRecordContent/_types';
|
|
3
|
+
import { JoinLibraryContextFragment } from '../../../_gqlTypes';
|
|
3
4
|
import { FeatureHook, Entrypoint, IPrimaryAction } from '../_types';
|
|
4
5
|
/**
|
|
5
6
|
* Hook used to get the action for `<DataView />` component.
|
|
@@ -9,21 +10,24 @@ import { FeatureHook, Entrypoint, IPrimaryAction } from '../_types';
|
|
|
9
10
|
* It returns also two parts : one for the call action button - one for displayed the modal required by the action.
|
|
10
11
|
*
|
|
11
12
|
* @param isEnabled - whether the action is present
|
|
13
|
+
* @param isVisible - wether the button should be visible or not
|
|
12
14
|
* @param libraryId - the library's id to add new item
|
|
13
15
|
* @param entrypoint - represent the current entrypoint
|
|
14
16
|
* @param totalCount - used for display purpose only
|
|
15
17
|
* @param onCreate - callback to let outside world known about creating item (and linking)
|
|
16
18
|
* @param refetch - method to call to refresh the list. New item will be visible if it matches filters and sorts
|
|
17
19
|
*/
|
|
18
|
-
export declare const useCreatePrimaryAction: ({ isEnabled, libraryId, entrypoint, totalCount, canCreateAndLinkValue, onCreate, formId, refetch }: FeatureHook<{
|
|
20
|
+
export declare const useCreatePrimaryAction: ({ isEnabled, isVisible, libraryId, entrypoint, totalCount, canCreateAndLinkValue, isMultivalue, onCreate, formId, joinLibraryContext, refetch }: FeatureHook<{
|
|
19
21
|
libraryId: string;
|
|
20
22
|
entrypoint: Entrypoint;
|
|
21
23
|
totalCount: number;
|
|
22
24
|
canCreateAndLinkValue: boolean;
|
|
25
|
+
isMultivalue: boolean;
|
|
23
26
|
onCreate?: ({ recordIdCreated, saveValuesResultOnLink }: {
|
|
24
27
|
recordIdCreated: string;
|
|
25
28
|
saveValuesResultOnLink?: ISubmitMultipleResult;
|
|
26
29
|
}) => void;
|
|
30
|
+
joinLibraryContext?: JoinLibraryContextFragment;
|
|
27
31
|
formId?: string;
|
|
28
32
|
refetch: () => void;
|
|
29
33
|
}>) => {
|
|
@@ -8,7 +8,7 @@ import { useKitNotification } from 'aristid-ds';
|
|
|
8
8
|
import { CreateDirectory, EditRecordModal, UploadFiles } from '../../../components';
|
|
9
9
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
10
10
|
import useSaveValueBatchMutation from '../../../components/RecordEdition/EditRecordContent/hooks/useExecuteSaveValueBatchMutation';
|
|
11
|
-
import { LibraryBehavior, useExplorerLibraryDetailsQuery
|
|
11
|
+
import { LibraryBehavior, useExplorerLibraryDetailsQuery } from '../../../_gqlTypes';
|
|
12
12
|
import { CREATE_RECORD_MODAL_CLASSNAME } from '../_constants';
|
|
13
13
|
/**
|
|
14
14
|
* Hook used to get the action for `<DataView />` component.
|
|
@@ -18,33 +18,27 @@ import { CREATE_RECORD_MODAL_CLASSNAME } from '../_constants';
|
|
|
18
18
|
* It returns also two parts : one for the call action button - one for displayed the modal required by the action.
|
|
19
19
|
*
|
|
20
20
|
* @param isEnabled - whether the action is present
|
|
21
|
+
* @param isVisible - wether the button should be visible or not
|
|
21
22
|
* @param libraryId - the library's id to add new item
|
|
22
23
|
* @param entrypoint - represent the current entrypoint
|
|
23
24
|
* @param totalCount - used for display purpose only
|
|
24
25
|
* @param onCreate - callback to let outside world known about creating item (and linking)
|
|
25
26
|
* @param refetch - method to call to refresh the list. New item will be visible if it matches filters and sorts
|
|
26
27
|
*/
|
|
27
|
-
export const useCreatePrimaryAction = ({ isEnabled, libraryId, entrypoint, totalCount, canCreateAndLinkValue, onCreate, formId, refetch }) => {
|
|
28
|
+
export const useCreatePrimaryAction = ({ isEnabled, isVisible, libraryId, entrypoint, totalCount, canCreateAndLinkValue, isMultivalue, onCreate, formId, joinLibraryContext, refetch }) => {
|
|
28
29
|
const { t } = useSharedTranslation();
|
|
29
30
|
const [isModalCreationVisible, setIsModalCreationVisible] = useState(false);
|
|
30
|
-
const [multipleValues, setIsMultivalues] = useState(false);
|
|
31
31
|
const { saveValues } = useSaveValueBatchMutation();
|
|
32
32
|
const { kitNotification } = useKitNotification();
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (!attributeData) {
|
|
41
|
-
throw new Error('Unknown link attribute');
|
|
42
|
-
}
|
|
43
|
-
setIsMultivalues(attributeData.multiple_values);
|
|
44
|
-
}
|
|
33
|
+
const _getLibraryId = () => (joinLibraryContext?.mandatoryAttribute &&
|
|
34
|
+
'linked_library' in joinLibraryContext.mandatoryAttribute &&
|
|
35
|
+
joinLibraryContext.mandatoryAttribute.linked_library?.id) ||
|
|
36
|
+
libraryId;
|
|
37
|
+
const { data, loading, error } = useExplorerLibraryDetailsQuery({
|
|
38
|
+
variables: { libraryId: _getLibraryId() },
|
|
39
|
+
skip: !isEnabled
|
|
45
40
|
});
|
|
46
|
-
|
|
47
|
-
if (error || loading) {
|
|
41
|
+
if (error || loading || !isVisible) {
|
|
48
42
|
return { createPrimaryAction: null, createModal: null };
|
|
49
43
|
}
|
|
50
44
|
let canCreateRecord;
|
|
@@ -52,7 +46,7 @@ export const useCreatePrimaryAction = ({ isEnabled, libraryId, entrypoint, total
|
|
|
52
46
|
canCreateRecord = true;
|
|
53
47
|
}
|
|
54
48
|
else {
|
|
55
|
-
canCreateRecord = canCreateAndLinkValue && (
|
|
49
|
+
canCreateRecord = canCreateAndLinkValue && (isMultivalue || totalCount === 0);
|
|
56
50
|
}
|
|
57
51
|
const _createPrimaryAction = {
|
|
58
52
|
callback: () => {
|
|
@@ -71,21 +65,22 @@ export const useCreatePrimaryAction = ({ isEnabled, libraryId, entrypoint, total
|
|
|
71
65
|
let _createModal = null;
|
|
72
66
|
switch (data?.libraries?.list[0]?.behavior) {
|
|
73
67
|
case LibraryBehavior.files:
|
|
74
|
-
_createModal = (_jsx(UploadFiles, { libraryId:
|
|
68
|
+
_createModal = (_jsx(UploadFiles, { libraryId: _getLibraryId(), multiple: true, onClose: () => setIsModalCreationVisible(false), onCompleted: () => {
|
|
75
69
|
refetch();
|
|
76
70
|
_notifyNewCreation();
|
|
77
71
|
setIsModalCreationVisible(false);
|
|
78
72
|
} }));
|
|
79
73
|
break;
|
|
80
74
|
case LibraryBehavior.directories:
|
|
81
|
-
_createModal = (_jsx(CreateDirectory, { libraryId:
|
|
75
|
+
_createModal = (_jsx(CreateDirectory, { libraryId: _getLibraryId(), onClose: () => setIsModalCreationVisible(false), onCompleted: () => {
|
|
82
76
|
refetch();
|
|
83
77
|
_notifyNewCreation();
|
|
84
78
|
setIsModalCreationVisible(false);
|
|
85
79
|
} }));
|
|
86
80
|
break;
|
|
87
81
|
case LibraryBehavior.standard:
|
|
88
|
-
|
|
82
|
+
case LibraryBehavior.join:
|
|
83
|
+
_createModal = (_jsx(EditRecordModal, { className: CREATE_RECORD_MODAL_CLASSNAME, open: true, record: null, library: _getLibraryId(), creationFormId: formId, onClose: () => {
|
|
89
84
|
setIsModalCreationVisible(false);
|
|
90
85
|
}, onCreate: newRecord => {
|
|
91
86
|
refetch();
|