@leav/ui 0.4.0-d1519cc → 0.4.0-daf9f384
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.d.ts +632 -0
- package/dist/__mocks__/common/form.js +32 -23
- package/dist/__mocks__/common/form.js.map +1 -1
- package/dist/_gqlTypes/index.d.ts +3274 -2037
- package/dist/_gqlTypes/index.js +1579 -1209
- 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 +14 -5
- 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/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 +8 -5
- package/dist/components/Explorer/Explorer.js +12 -9
- 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/useExplorerData.js +7 -3
- package/dist/components/Explorer/_queries/useExplorerData.js.map +1 -1
- package/dist/components/Explorer/_types.d.ts +9 -3
- 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-primary/useCreatePrimaryAction.d.ts +3 -1
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js +14 -6
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/_shared/useTransformFilters.js +4 -0
- package/dist/components/Explorer/manage-view-settings/_shared/useTransformFilters.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsInitialState.js +1 -1
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsInitialState.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/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 +2 -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/LinkSelect/LinkSelect.d.ts +15 -0
- package/dist/components/LinkSelect/LinkSelect.js +88 -0
- package/dist/components/LinkSelect/LinkSelect.js.map +1 -0
- package/dist/components/LinkSelect/index.d.ts +2 -0
- package/dist/components/{SelectTreeNodeModal → LinkSelect}/index.js +2 -1
- package/dist/components/LinkSelect/index.js.map +1 -0
- package/dist/components/RecordEdition/EditRecord/EditRecord.d.ts +1 -4
- package/dist/components/RecordEdition/EditRecord/EditRecord.js +15 -28
- 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/RecordEdition/EditRecordButtons/index.js +6 -0
- package/dist/components/RecordEdition/EditRecordButtons/index.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js +64 -27
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/_types.d.ts +13 -7
- package/dist/components/RecordEdition/EditRecordContent/_types.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/antdUtils.d.ts +6 -0
- package/dist/components/RecordEdition/EditRecordContent/antdUtils.js +7 -1
- package/dist/components/RecordEdition/EditRecordContent/antdUtils.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/helpers/extractFormElements/extractFormElements.d.ts +15 -2
- package/dist/components/RecordEdition/EditRecordContent/helpers/extractFormElements/extractFormElements.js +47 -24
- package/dist/components/RecordEdition/EditRecordContent/helpers/extractFormElements/extractFormElements.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/hooks/useFetchVisibleFormValue.d.ts +13 -0
- package/dist/components/RecordEdition/EditRecordContent/hooks/useFetchVisibleFormValue.js +115 -0
- package/dist/components/RecordEdition/EditRecordContent/hooks/useFetchVisibleFormValue.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/hooks/useTabManagement.d.ts +12 -0
- package/dist/components/RecordEdition/EditRecordContent/hooks/useTabManagement.js +39 -0
- package/dist/components/RecordEdition/EditRecordContent/hooks/useTabManagement.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.d.ts +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.js +3 -5
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/FormTabs/FormTabs.js +25 -5
- package/dist/components/RecordEdition/EditRecordContent/uiElements/FormTabs/FormTabs.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/Frame.d.ts +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/Frame.js +1 -3
- 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 +8 -5
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.js +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.d.ts +4 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.js +258 -53
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +62 -71
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.js +2 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.d.ts +2 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.js +2 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.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/StandardField/StandardFieldValue/_types.d.ts +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.d.ts +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js +22 -17
- 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 +3 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js +46 -55
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/calculatedInheritedFlags.js +4 -4
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/calculatedInheritedFlags.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/useOutsideInteractionDetector.d.ts +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/useOutsideInteractionDetector.js +6 -6
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.d.ts +3 -0
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js +48 -50
- 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 +6 -6
- 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 +18 -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 +33 -2
- package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.js +48 -3
- 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 +2 -1
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js +2 -2
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js.map +1 -1
- package/dist/components/SelectTreeNode/SelectTreeNode.d.ts +5 -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 +3 -1
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.js +18 -23
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.js.map +1 -1
- package/dist/components/SelectTreeNode/_types.d.ts +17 -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/SelectTreeNodeModalOld/index.js +5 -0
- 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.d.ts +2 -1
- package/dist/hooks/useGetRecordForm/useGetRecordForm.js +3 -14
- 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 +118 -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 +104 -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/hooks/useIFrameMessengerClient/iFrameMessengerClientContext.js +6 -0
- 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/EditRecordContent/hooks/useRecordEditionContext.d.ts +0 -3
- package/dist/components/RecordEdition/EditRecordContent/hooks/useRecordEditionContext.js +0 -7
- package/dist/components/RecordEdition/EditRecordContent/hooks/useRecordEditionContext.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,11 +1,11 @@
|
|
|
1
|
+
import { type FunctionComponent } from 'react';
|
|
1
2
|
import { RecordFormElementsValueTreeValue } from '../../../../../../hooks/useGetRecordForm';
|
|
2
3
|
import { RecordFormAttributeTreeAttributeFragment } from '../../../../../../_gqlTypes';
|
|
3
|
-
interface
|
|
4
|
+
interface IDisplayTreeNodeProps {
|
|
4
5
|
attribute: RecordFormAttributeTreeAttributeFragment;
|
|
5
6
|
backendValues: RecordFormElementsValueTreeValue[];
|
|
6
7
|
removeTreeNode: (nodeValue: RecordFormElementsValueTreeValue) => void;
|
|
8
|
+
isReadOnly: boolean;
|
|
7
9
|
}
|
|
8
|
-
export declare const
|
|
9
|
-
TreeNodeList: JSX.Element;
|
|
10
|
-
};
|
|
10
|
+
export declare const TreeNodeList: FunctionComponent<IDisplayTreeNodeProps>;
|
|
11
11
|
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import TreeNodeItem from './TreeNodeItem';
|
|
3
|
+
import { TreeFieldWrapper } from './TreeFieldWrapper';
|
|
4
|
+
export const TreeNodeList = ({ attribute, backendValues, removeTreeNode, isReadOnly }) => (_jsx(TreeFieldWrapper, { children: backendValues.map((value, index) => (_jsx(TreeNodeItem, { isReadOnly: isReadOnly, color: value.treeValue.record.whoAmI.color, label: value.treeValue.record.whoAmI.label, ancestors: value.treeValue.ancestors, canDelete: (attribute.required && attribute.multiple_values && backendValues.length > 1) || !attribute.required, onClickToDelete: () => removeTreeNode(value) }, index))) }));
|
|
5
|
+
//# sourceMappingURL=TreeNodeList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeNodeList.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeList.tsx"],"names":[],"mappings":";AAMA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AASpD,MAAM,CAAC,MAAM,YAAY,GAA6C,CAAC,EACnE,SAAS,EACT,aAAa,EACb,cAAc,EACd,UAAU,EACb,EAAE,EAAE,CAAC,CACF,KAAC,gBAAgB,cACZ,aAAa,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CACjC,KAAC,YAAY,IAET,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAC1C,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAC1C,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,EACpC,SAAS,EACL,CAAC,SAAS,CAAC,QAAQ,IAAI,SAAS,CAAC,eAAe,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAExG,eAAe,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,IARvC,KAAK,CASZ,CACL,CAAC,GACa,CACtB,CAAC"}
|
|
@@ -1,14 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { ChildrenAsRecordValuePermissionFilterInput, RecordFormAttributeTreeAttributeFragment } from '../../../../../../_gqlTypes';
|
|
2
3
|
import { RecordFormElementsValueTreeValue } from '../../../../../../hooks/useGetRecordForm';
|
|
3
4
|
import { ITreeNodeWithRecord } from '../../../../../../types';
|
|
4
|
-
|
|
5
|
+
type SelectTreeNodeModalBackendValue = RecordFormElementsValueTreeValue | {
|
|
6
|
+
treeValue: {
|
|
7
|
+
id: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
type SelectTreeNodeModalAttribute = RecordFormAttributeTreeAttributeFragment | {
|
|
11
|
+
multiple_values: boolean;
|
|
12
|
+
linked_tree: {
|
|
13
|
+
id: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
5
16
|
interface ISelectTreeNodeModalProps {
|
|
6
17
|
title: string;
|
|
7
18
|
open: boolean;
|
|
8
|
-
attribute:
|
|
9
|
-
backendValues:
|
|
19
|
+
attribute: SelectTreeNodeModalAttribute;
|
|
20
|
+
backendValues: SelectTreeNodeModalBackendValue[];
|
|
10
21
|
onConfirm: (selectedNodes: ITreeNodeWithRecord[]) => void;
|
|
11
22
|
onClose: () => void;
|
|
23
|
+
childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;
|
|
12
24
|
className?: string;
|
|
13
25
|
}
|
|
14
26
|
export declare const SelectTreeNodeModal: FunctionComponent<ISelectTreeNodeModalProps>;
|
|
@@ -2,21 +2,23 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } 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 { useState } from 'react';
|
|
6
|
+
import { FaCheck } from 'react-icons/fa';
|
|
5
7
|
import { faXmark } from '@fortawesome/free-solid-svg-icons';
|
|
6
8
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
9
|
+
import { KitButton, KitModal } from 'aristid-ds';
|
|
7
10
|
import { SelectTreeNode } from '../../../../../../components/SelectTreeNode';
|
|
8
11
|
import { useSharedTranslation } from '../../../../../../hooks/useSharedTranslation';
|
|
9
|
-
import { KitButton, KitModal } from 'aristid-ds';
|
|
10
|
-
import { useState } from 'react';
|
|
11
|
-
import { FaCheck } from 'react-icons/fa';
|
|
12
12
|
const SELECT_TREE_NODE_MODAL_HEIGHT = '563px';
|
|
13
13
|
const SELECT_TREE_NODE_MODAL_WIDTH = '656px';
|
|
14
|
-
export const SelectTreeNodeModal = ({ title, open, attribute, backendValues, onConfirm, onClose, className }) => {
|
|
14
|
+
export const SelectTreeNodeModal = ({ title, open, attribute, backendValues, onConfirm, onClose, childrenAsRecordValuePermissionFilter, className }) => {
|
|
15
15
|
const { t } = useSharedTranslation();
|
|
16
16
|
const [selectedNodes, setSelectedNode] = useState([]);
|
|
17
|
+
const [isMonoValueToReplace, setIsMonoValueToReplace] = useState(false);
|
|
17
18
|
const _handleOnSelect = (node, selected) => {
|
|
18
19
|
if (!attribute.multiple_values) {
|
|
19
20
|
setSelectedNode(selected ? [node] : []);
|
|
21
|
+
setIsMonoValueToReplace(true);
|
|
20
22
|
return;
|
|
21
23
|
}
|
|
22
24
|
if (selected) {
|
|
@@ -26,19 +28,16 @@ export const SelectTreeNodeModal = ({ title, open, attribute, backendValues, onC
|
|
|
26
28
|
setSelectedNode(selectedNodes.filter(selectedValue => selectedValue.id !== node.id));
|
|
27
29
|
}
|
|
28
30
|
};
|
|
29
|
-
const _handleOnCheck = (selection) => {
|
|
30
|
-
setSelectedNode(selection.map(node => node).filter(node => !node?.disabled));
|
|
31
|
-
};
|
|
32
31
|
const _handleOnConfirm = () => {
|
|
33
32
|
onConfirm(selectedNodes);
|
|
34
33
|
onClose();
|
|
35
34
|
};
|
|
36
|
-
return (_jsx(KitModal, { className: className, width: SELECT_TREE_NODE_MODAL_WIDTH, height: SELECT_TREE_NODE_MODAL_HEIGHT, title: title, isOpen: open, close: onClose, footer: _jsxs(_Fragment, { children: [_jsx(KitButton, { icon:
|
|
35
|
+
return (_jsx(KitModal, { className: className, showCloseIcon: true, width: SELECT_TREE_NODE_MODAL_WIDTH, height: SELECT_TREE_NODE_MODAL_HEIGHT, title: title, isOpen: open, close: onClose, footer: _jsxs(_Fragment, { children: [_jsx(KitButton, { icon:
|
|
37
36
|
// We can't used react-icons here because it's doesn't have the faXmark icon
|
|
38
|
-
_jsx(FontAwesomeIcon, { icon: faXmark }), onClick: onClose, children: t('global.close') }), _jsx(KitButton, { type: "primary", icon: _jsx(FaCheck, {}), onClick: _handleOnConfirm, children: t('global.confirm') })] }),
|
|
39
|
-
|
|
40
|
-
...selectedNodes.map(node => node.id)
|
|
41
|
-
|
|
42
|
-
:
|
|
37
|
+
_jsx(FontAwesomeIcon, { icon: faXmark }), onClick: onClose, children: t('global.close') }), _jsx(KitButton, { type: "primary", icon: _jsx(FaCheck, {}), onClick: _handleOnConfirm, children: t('global.confirm') })] }), children: _jsx(SelectTreeNode, { treeId: attribute.linked_tree.id, multiple // We want to be able to set as selected in the tree components, the nodes that are already selected and the disabled nodes
|
|
38
|
+
: true, selectedNodes: [
|
|
39
|
+
...selectedNodes.map(node => node.id),
|
|
40
|
+
...(isMonoValueToReplace ? [] : backendValues.map(value => value.treeValue.id))
|
|
41
|
+
], childrenAsRecordValuePermissionFilter: childrenAsRecordValuePermissionFilter, disabledNodes: backendValues.map(value => value.treeValue.id).concat(attribute.linked_tree.id), onSelect: _handleOnSelect }) }));
|
|
43
42
|
};
|
|
44
43
|
//# sourceMappingURL=SelectTreeNodeModal.js.map
|
|
@@ -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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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 {
|
|
@@ -12,8 +12,9 @@ interface IUseManageTreeNodeSelectionProps {
|
|
|
12
12
|
onDeleteMultipleValues: DeleteMultipleValuesFunc;
|
|
13
13
|
isReadOnly: boolean;
|
|
14
14
|
isFieldInError: boolean;
|
|
15
|
+
childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;
|
|
15
16
|
}
|
|
16
|
-
export declare const useManageTreeNodeSelection: ({ modaleTitle, attribute, backendValues, setBackendValues, onValueSubmit, onValueDelete, onDeleteMultipleValues, isReadOnly, isFieldInError }: IUseManageTreeNodeSelectionProps) => {
|
|
17
|
+
export declare const useManageTreeNodeSelection: ({ modaleTitle, attribute, backendValues, setBackendValues, onValueSubmit, onValueDelete, onDeleteMultipleValues, isReadOnly, isFieldInError, childrenAsRecordValuePermissionFilter }: IUseManageTreeNodeSelectionProps) => {
|
|
17
18
|
openModal: () => void;
|
|
18
19
|
removeTreeNode: (nodeValue: RecordFormElementsValueTreeValue, skipAfterRemove?: boolean) => Promise<void>;
|
|
19
20
|
actionButtonLabel: string;
|
|
@@ -3,19 +3,19 @@ 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
|
+
export const useManageTreeNodeSelection = ({ modaleTitle, attribute, backendValues, setBackendValues, onValueSubmit, onValueDelete, onDeleteMultipleValues, isReadOnly, isFieldInError, childrenAsRecordValuePermissionFilter }) => {
|
|
13
13
|
const { t } = useSharedTranslation();
|
|
14
14
|
const form = AntForm.useFormInstance();
|
|
15
|
-
const [
|
|
15
|
+
const [isModalHidden, setIsModalHidden] = useState(true);
|
|
16
16
|
useEffect(() => {
|
|
17
17
|
if (backendValues.length === 0 && attribute.required) {
|
|
18
|
-
// Set field in error when TreeField is displayed for the first time. Otherwise, errors will be handled by other functions in this file.
|
|
18
|
+
// Set the field in error when TreeField is displayed for the first time. Otherwise, errors will be handled by other functions in this file.
|
|
19
19
|
form.setFields([
|
|
20
20
|
{
|
|
21
21
|
name: attribute.id,
|
|
@@ -24,24 +24,17 @@ export const useManageTreeNodeSelection = ({ modaleTitle, attribute, backendValu
|
|
|
24
24
|
]);
|
|
25
25
|
}
|
|
26
26
|
}, []);
|
|
27
|
-
const
|
|
28
|
-
|
|
27
|
+
const _closeModal = () => {
|
|
28
|
+
setIsModalHidden(true);
|
|
29
29
|
};
|
|
30
|
-
const
|
|
31
|
-
setIsModalVisible(false);
|
|
32
|
-
};
|
|
33
|
-
const addTreeNodes = async (selectedNodes) => {
|
|
30
|
+
const _addTreeNodes = async (selectedNodes) => {
|
|
34
31
|
const valuesToSave = selectedNodes.map(node => ({
|
|
35
32
|
attribute,
|
|
36
|
-
idValue: null,
|
|
33
|
+
idValue: !attribute.multiple_values && backendValues.length > 0 ? backendValues[0].id_value : null,
|
|
37
34
|
value: node
|
|
38
35
|
}));
|
|
39
36
|
// When we will handle computed values, we will need to passe the active version (if still needed)
|
|
40
37
|
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
38
|
if (result.status === APICallStatus.SUCCESS) {
|
|
46
39
|
const formattedValues = result.values.map(value => ({
|
|
47
40
|
...value,
|
|
@@ -80,32 +73,7 @@ export const useManageTreeNodeSelection = ({ modaleTitle, attribute, backendValu
|
|
|
80
73
|
]);
|
|
81
74
|
}
|
|
82
75
|
};
|
|
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 () => {
|
|
76
|
+
const _removeAllTreeNodes = async () => {
|
|
109
77
|
// When we will handle computed values, we will need to passe the active version (if still needed)
|
|
110
78
|
const result = await onDeleteMultipleValues(attribute.id, backendValues, null);
|
|
111
79
|
if (result.status === APICallStatus.SUCCESS) {
|
|
@@ -128,18 +96,41 @@ export const useManageTreeNodeSelection = ({ modaleTitle, attribute, backendValu
|
|
|
128
96
|
]);
|
|
129
97
|
}
|
|
130
98
|
};
|
|
131
|
-
const
|
|
132
|
-
if (!attribute.multiple_values && backendValues.length > 0) {
|
|
133
|
-
return `${t('global.replace')} ${modaleTitle}`;
|
|
134
|
-
}
|
|
135
|
-
return `${t('global.add')} ${modaleTitle}`;
|
|
136
|
-
};
|
|
99
|
+
const label = `${t(!attribute.multiple_values && backendValues.length > 0 ? 'global.replace' : 'global.add')} ${modaleTitle}`;
|
|
137
100
|
return {
|
|
138
|
-
openModal
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
101
|
+
openModal: () => {
|
|
102
|
+
setIsModalHidden(false);
|
|
103
|
+
},
|
|
104
|
+
removeTreeNode: async (nodeValue, skipAfterRemove = false) => {
|
|
105
|
+
const result = await onValueDelete({ id_value: nodeValue.id_value }, attribute.id);
|
|
106
|
+
if (skipAfterRemove) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (result.status === APICallStatus.SUCCESS) {
|
|
110
|
+
const newBackendValues = backendValues.filter(value => value.id_value !== nodeValue.id_value);
|
|
111
|
+
form.setFieldValue(attribute.id, newBackendValues.map(({ treeValue }) => treeValue.id));
|
|
112
|
+
form.setFields([
|
|
113
|
+
{
|
|
114
|
+
name: attribute.id,
|
|
115
|
+
errors: attribute.required && newBackendValues.length === 0
|
|
116
|
+
? [t('errors.standard_field_required')]
|
|
117
|
+
: []
|
|
118
|
+
}
|
|
119
|
+
]);
|
|
120
|
+
setBackendValues(newBackendValues);
|
|
121
|
+
}
|
|
122
|
+
if (result.status === APICallStatus.ERROR) {
|
|
123
|
+
form.setFields([
|
|
124
|
+
{
|
|
125
|
+
name: attribute.id,
|
|
126
|
+
errors: [t('error.error_occurred')]
|
|
127
|
+
}
|
|
128
|
+
]);
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
actionButtonLabel: label,
|
|
132
|
+
SelectTreeNodeModal: isModalHidden ? null : (_jsx(SelectTreeNodeModal, { open: true, title: label, attribute: attribute, backendValues: backendValues, onConfirm: _addTreeNodes, onClose: _closeModal, childrenAsRecordValuePermissionFilter: childrenAsRecordValuePermissionFilter })),
|
|
133
|
+
RemoveAllTreeNodes: backendValues.length > 1 && attribute.multiple_values && !attribute.required ? (_jsx(DeleteAllValuesButton, { handleDelete: _removeAllTreeNodes, disabled: isReadOnly, danger: isFieldInError })) : null
|
|
143
134
|
};
|
|
144
135
|
};
|
|
145
136
|
//# 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,E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|
export const computeInheritedFlags = (fieldValues) => {
|
|
2
|
-
const inheritedValue = fieldValues
|
|
3
|
-
const overrideValue = fieldValues
|
|
2
|
+
const inheritedValue = fieldValues?.find(fieldValue => fieldValue.isInherited);
|
|
3
|
+
const overrideValue = fieldValues?.find(fieldValue => !fieldValue.isInherited && !fieldValue.isCalculated);
|
|
4
4
|
if (inheritedValue === undefined) {
|
|
5
5
|
return {
|
|
6
6
|
inheritedValue: null,
|
|
@@ -26,8 +26,8 @@ export const computeInheritedFlags = (fieldValues) => {
|
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
export const computeCalculatedFlags = (fieldValues) => {
|
|
29
|
-
const calculatedValue = fieldValues
|
|
30
|
-
const overrideValue = fieldValues
|
|
29
|
+
const calculatedValue = fieldValues?.find(fieldValue => fieldValue.isCalculated !== null && fieldValue.isCalculated !== undefined);
|
|
30
|
+
const overrideValue = fieldValues?.find(fieldValue => (fieldValue.isCalculated === null || fieldValue.isCalculated === undefined) &&
|
|
31
31
|
(fieldValue.isInherited === null || fieldValue.isInherited === undefined));
|
|
32
32
|
if (calculatedValue === undefined) {
|
|
33
33
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculatedInheritedFlags.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/shared/calculatedInheritedFlags.ts"],"names":[],"mappings":"AA4BA,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,WAAmD,EAAkB,EAAE;IACzG,MAAM,cAAc,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"calculatedInheritedFlags.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/shared/calculatedInheritedFlags.ts"],"names":[],"mappings":"AA4BA,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,WAAmD,EAAkB,EAAE;IACzG,MAAM,cAAc,GAAG,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,C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iBAAiB,EAAE,KAAK;YACxB,yBAAyB,EAAE,KAAK;YAChC,4BAA4B,EAAE,KAAK;SACtC,CAAC;IACN,CAAC;IAED,MAAM,iBAAiB,GAAG,IAAI,CAAC;IAE/B,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QACnD,OAAO;YACH,eAAe;YACf,iBAAiB;YACjB,4BAA4B,EAAE,IAAI;YAClC,yBAAyB,EAAE,KAAK;SACnC,CAAC;IACN,CAAC;IAED,OAAO;QACH,eAAe;QACf,iBAAiB;QACjB,4BAA4B,EAAE,KAAK;QACnC,yBAAyB,EAAE,IAAI;KAClC,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -8,10 +8,10 @@ interface IUseOutsideInteractionDetectorProps {
|
|
|
8
8
|
activeAttribute: IRecordPropertyWithAttribute | null;
|
|
9
9
|
dispatch: Dispatch<IEditRecordReducerActions>;
|
|
10
10
|
formIdToLoad: string | 'edition' | 'creation';
|
|
11
|
-
|
|
11
|
+
elementValues: RecordFormElementsValue[];
|
|
12
12
|
pendingValues: RecordFormElementsValue[];
|
|
13
13
|
allowedSelectors?: string[];
|
|
14
14
|
attributePrefix?: typeof LINK_FIELD_ID_PREFIX | typeof STANDARD_FIELD_ID_PREFIX | typeof TREE_FIELD_ID_PREFIX;
|
|
15
15
|
}
|
|
16
|
-
export declare const useOutsideInteractionDetector: ({ attribute, activeAttribute, attributePrefix, dispatch, formIdToLoad,
|
|
16
|
+
export declare const useOutsideInteractionDetector: ({ attribute, activeAttribute, attributePrefix, dispatch, formIdToLoad, elementValues, pendingValues, allowedSelectors }: IUseOutsideInteractionDetectorProps) => void;
|
|
17
17
|
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, formIdToLoad,
|
|
4
|
+
export const useOutsideInteractionDetector = ({ attribute, activeAttribute, attributePrefix, dispatch, formIdToLoad, elementValues, pendingValues, 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({
|
|
@@ -10,7 +10,7 @@ export const useOutsideInteractionDetector = ({ attribute, activeAttribute, attr
|
|
|
10
10
|
attributePrefix,
|
|
11
11
|
allowedSelectors,
|
|
12
12
|
formIdToLoad,
|
|
13
|
-
|
|
13
|
+
elementValues,
|
|
14
14
|
pendingValues
|
|
15
15
|
});
|
|
16
16
|
useEffect(() => {
|
|
@@ -20,10 +20,10 @@ export const useOutsideInteractionDetector = ({ attribute, activeAttribute, attr
|
|
|
20
20
|
attributePrefix,
|
|
21
21
|
allowedSelectors,
|
|
22
22
|
formIdToLoad,
|
|
23
|
-
|
|
23
|
+
elementValues,
|
|
24
24
|
pendingValues
|
|
25
25
|
};
|
|
26
|
-
}, [attribute, activeAttribute, attributePrefix, allowedSelectors, formIdToLoad,
|
|
26
|
+
}, [attribute, activeAttribute, attributePrefix, allowedSelectors, formIdToLoad, elementValues, pendingValues]);
|
|
27
27
|
useEffect(() => {
|
|
28
28
|
const handleClick = (event) => {
|
|
29
29
|
const currentProps = hookPropsRef.current;
|
|
@@ -34,7 +34,7 @@ export const useOutsideInteractionDetector = ({ attribute, activeAttribute, attr
|
|
|
34
34
|
dispatch({
|
|
35
35
|
type: EditRecordReducerActionsTypes.SET_ACTIVE_VALUE,
|
|
36
36
|
attribute: currentProps.attribute,
|
|
37
|
-
values: formIdToLoad === 'creation' ? currentProps.pendingValues : currentProps.
|
|
37
|
+
values: formIdToLoad === 'creation' ? currentProps.pendingValues : currentProps.elementValues
|
|
38
38
|
});
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
@@ -61,7 +61,7 @@ export const useOutsideInteractionDetector = ({ attribute, activeAttribute, attr
|
|
|
61
61
|
dispatch({
|
|
62
62
|
type: EditRecordReducerActionsTypes.SET_ACTIVE_VALUE,
|
|
63
63
|
attribute: currentProps.attribute,
|
|
64
|
-
values: formIdToLoad === 'creation' ? currentProps.pendingValues : currentProps.
|
|
64
|
+
values: formIdToLoad === 'creation' ? currentProps.pendingValues : currentProps.elementValues
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
};
|
|
@@ -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,74 +2,67 @@ 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 { Modal } from 'antd';
|
|
6
5
|
import { useRef, useState } from 'react';
|
|
7
|
-
import { KitButton, KitSpace, KitTypography } from 'aristid-ds';
|
|
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
|
-
const
|
|
16
|
+
import { EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS } from '../constants';
|
|
17
|
+
const MODAL_HEIGHT = '80vh';
|
|
18
|
+
const MODAL_WIDTH = '90vw';
|
|
19
|
+
const MODAL_MAX_WIDTH = '1200px';
|
|
20
|
+
const KitModalStyled = styled(KitModal) `
|
|
19
21
|
&& {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
& > div {
|
|
23
|
+
max-width: ${MODAL_MAX_WIDTH};
|
|
24
|
+
|
|
25
|
+
.kit-modal-header {
|
|
26
|
+
border-bottom: 1px solid var(--general-utilities-border);
|
|
27
|
+
|
|
28
|
+
.kit-modal-title {
|
|
29
|
+
padding-right: calc(var(--general-spacing-xs) * 1px);
|
|
30
|
+
|
|
31
|
+
.ant-space {
|
|
32
|
+
width: 100%;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
23
37
|
|
|
24
|
-
|
|
25
|
-
|
|
38
|
+
.kit-modal-content-wrapper {
|
|
39
|
+
padding: 0;
|
|
40
|
+
|
|
41
|
+
.kit-modal-content {
|
|
42
|
+
height: 100%;
|
|
43
|
+
|
|
44
|
+
& > div {
|
|
45
|
+
height: 100%;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
26
49
|
}
|
|
27
50
|
}
|
|
28
51
|
`;
|
|
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 }) => {
|
|
52
|
+
export const EditRecordModal = ({ className, open, record, creationFormId, editionFormId, library, onClose, onCreate, onCreateAndEdit, valuesVersion, showSidebar, enableSidebar, submitButtons = ['create'], withInfoButton = true, autoHeight = false }) => {
|
|
47
53
|
const { t } = useSharedTranslation();
|
|
48
|
-
const
|
|
54
|
+
const [antdForm] = useForm();
|
|
49
55
|
const [currentRecord, setCurrentRecord] = useState(record);
|
|
50
56
|
const [clickedSubmitButton, setClickedSubmitButton] = useState(null);
|
|
51
57
|
const formElementId = useRef(uuidv4());
|
|
52
58
|
const isCreation = !currentRecord;
|
|
59
|
+
const closeButtonLabel = isCreation ? t('global.cancel') : t('global.close');
|
|
60
|
+
const formId = isCreation ? creationFormId : editionFormId;
|
|
53
61
|
const _handleClickSubmit = (button) => {
|
|
54
62
|
setClickedSubmitButton(button);
|
|
55
63
|
};
|
|
64
|
+
const showCancelConfirm = useCreateCancelConfirm(onClose);
|
|
56
65
|
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
66
|
const _handleCreate = (newRecord) => {
|
|
74
67
|
setCurrentRecord(newRecord);
|
|
75
68
|
if (onCreateAndEdit && clickedSubmitButton === 'createAndEdit') {
|
|
@@ -81,10 +74,15 @@ export const EditRecordModal = ({ className, open, record, creationFormId, editi
|
|
|
81
74
|
return;
|
|
82
75
|
}
|
|
83
76
|
};
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
77
|
+
const _handleClose = () => {
|
|
78
|
+
if (isCreation && antdForm.isFieldsTouched()) {
|
|
79
|
+
return showCancelConfirm();
|
|
80
|
+
}
|
|
81
|
+
return onClose();
|
|
82
|
+
};
|
|
83
|
+
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: [
|
|
84
|
+
_jsx(KitButton, { "aria-label": closeButtonLabel, icon: _jsx(FontAwesomeIcon, { icon: faXmark }), onClick: _handleClose, children: closeButtonLabel }, "close"),
|
|
85
|
+
...displayedSubmitButtons
|
|
86
|
+
] }), closeIcon: _jsx(FontAwesomeIcon, { icon: faXmark }), showCloseIcon: true, destroyOnClose: true, children: _jsx(EditRecord, { antdForm: antdForm, formId: formId, formElementId: formElementId.current, record: currentRecord, library: library, onCreate: _handleCreate, valuesVersion: valuesVersion, showSidebar: showSidebar, enableSidebar: enableSidebar, withInfoButton: withInfoButton }) }));
|
|
89
87
|
};
|
|
90
88
|
//# 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","sourceRoot":"","sources":["../../../../src/components/RecordEdition/EditRecordModal/EditRecordModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAoB,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACxE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,OAAO,EAAC,MAAM,mCAAmC,CAAC;AAE1D,OAAO,EAAC,mBAAmB,EAAC,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAC,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAC,sBAAsB,EAAC,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAC,EAAE,IAAI,MAAM,EAAC,MAAM,MAAM,CAAC;AAClC,OAAO,EAAC,0CAA0C,EAAC,MAAM,cAAc,CAAC;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