@leav/ui 1.9.0 → 1.10.0-1b7fd090
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_gqlTypes/index.d.ts +291 -120
- package/dist/_gqlTypes/index.js +204 -87
- package/dist/_gqlTypes/index.js.map +1 -1
- package/dist/_queries/records/createRecordMutation.js +2 -2
- package/dist/_queries/records/createRecordMutation.js.map +1 -1
- package/dist/_utils/getFiltersFromRequest.js +5 -6
- package/dist/_utils/getFiltersFromRequest.js.map +1 -1
- package/dist/_utils/index.d.ts +0 -1
- package/dist/_utils/index.js +3 -7
- package/dist/_utils/index.js.map +1 -1
- package/dist/_utils/typeguards.d.ts +5 -0
- package/dist/_utils/typeguards.js +6 -0
- package/dist/_utils/typeguards.js.map +1 -1
- package/dist/components/Explorer/Explorer.d.ts +2 -1
- package/dist/components/Explorer/Explorer.js +31 -13
- package/dist/components/Explorer/Explorer.js.map +1 -1
- package/dist/components/Explorer/ExplorerToolbar.js +2 -1
- package/dist/components/Explorer/ExplorerToolbar.js.map +1 -1
- package/dist/components/Explorer/_queries/useExplorerCountData.d.ts +16 -0
- package/dist/components/Explorer/_queries/useExplorerCountData.js +26 -0
- package/dist/components/Explorer/_queries/useExplorerCountData.js.map +1 -0
- package/dist/components/Explorer/_queries/useExplorerData.js +18 -20
- package/dist/components/Explorer/_queries/useExplorerData.js.map +1 -1
- package/dist/components/Explorer/actions-mass/ResultsCount.d.ts +10 -0
- package/dist/components/Explorer/actions-mass/ResultsCount.js +8 -0
- package/dist/components/Explorer/actions-mass/ResultsCount.js.map +1 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.js +1 -1
- package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.js.map +1 -1
- package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.d.ts +9 -2
- package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.js +18 -4
- package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.js.map +1 -1
- package/dist/components/Explorer/actions-mass/generate-previews/GeneratePreviewsModal.d.ts +10 -0
- package/dist/components/Explorer/actions-mass/generate-previews/GeneratePreviewsModal.js +69 -0
- package/dist/components/Explorer/actions-mass/generate-previews/GeneratePreviewsModal.js.map +1 -0
- package/dist/components/Explorer/actions-mass/generate-previews/useGetPreviewSizesData.d.ts +18 -0
- package/dist/components/Explorer/actions-mass/generate-previews/useGetPreviewSizesData.js +57 -0
- package/dist/components/Explorer/actions-mass/generate-previews/useGetPreviewSizesData.js.map +1 -0
- package/dist/components/Explorer/actions-mass/useGeneratePreviewsMassAction.d.ts +19 -0
- package/dist/components/Explorer/actions-mass/useGeneratePreviewsMassAction.js +94 -0
- package/dist/components/Explorer/actions-mass/useGeneratePreviewsMassAction.js.map +1 -0
- package/dist/components/Explorer/actions-mass/useMassActions.d.ts +5 -3
- package/dist/components/Explorer/actions-mass/useMassActions.js +19 -13
- package/dist/components/Explorer/actions-mass/useMassActions.js.map +1 -1
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.d.ts +3 -1
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js +5 -1
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/configure-display/ConfigureDisplay.js +6 -1
- package/dist/components/Explorer/manage-view-settings/configure-display/ConfigureDisplay.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.d.ts +3 -0
- package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.js +5 -5
- package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/configure-display/view-type/SelectViewType.js +1 -1
- package/dist/components/Explorer/manage-view-settings/configure-display/view-type/SelectViewType.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js +2 -2
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js.map +1 -1
- package/dist/components/Explorer/useViewSettingsReducer.js +11 -8
- package/dist/components/Explorer/useViewSettingsReducer.js.map +1 -1
- package/dist/components/Filters/_queries/treeFiltersDataQuery.d.ts +6 -0
- package/dist/components/Filters/_queries/treeFiltersDataQuery.js +54 -0
- package/dist/components/Filters/_queries/treeFiltersDataQuery.js.map +1 -0
- package/dist/components/Filters/context/useGetTreeFilters.js +24 -40
- package/dist/components/Filters/context/useGetTreeFilters.js.map +1 -1
- package/dist/components/Filters/filter-items/filter-type/tree/TreeAttributeDropDown.js +1 -2
- package/dist/components/Filters/filter-items/filter-type/tree/TreeAttributeDropDown.js.map +1 -1
- package/dist/components/Filters/filter-items/filter-type/tree/_queries/filterTreeDataQuery.d.ts +6 -0
- package/dist/components/Filters/filter-items/filter-type/tree/_queries/filterTreeDataQuery.js +54 -0
- package/dist/components/Filters/filter-items/filter-type/tree/_queries/filterTreeDataQuery.js.map +1 -0
- package/dist/components/Filters/filter-items/filter-type/tree/useGetTreeData.js +22 -41
- package/dist/components/Filters/filter-items/filter-type/tree/useGetTreeData.js.map +1 -1
- package/dist/components/RecordEdition/EditRecord/EditRecord.d.ts +1 -0
- package/dist/components/RecordEdition/EditRecord/EditRecord.js +3 -27
- package/dist/components/RecordEdition/EditRecord/EditRecord.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordButtons/SidebarButton.js +2 -2
- package/dist/components/RecordEdition/EditRecordButtons/SidebarButton.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/_types.d.ts +5 -19
- package/dist/components/RecordEdition/EditRecordContent/_types.js +0 -5
- package/dist/components/RecordEdition/EditRecordContent/_types.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/antdUtils.js +1 -3
- package/dist/components/RecordEdition/EditRecordContent/antdUtils.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/explorer/LinkFieldExplorer.d.ts +0 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/explorer/LinkFieldExplorer.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js +28 -17
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.d.ts +1 -0
- package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.js +30 -18
- package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordPage/ErrorComponent.d.ts +2 -0
- package/dist/components/RecordEdition/EditRecordPage/ErrorComponent.js +11 -0
- package/dist/components/RecordEdition/EditRecordPage/ErrorComponent.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordPage/getInitialRecordValues.d.ts +2 -0
- package/dist/components/RecordEdition/EditRecordPage/getInitialRecordValues.js +35 -0
- package/dist/components/RecordEdition/EditRecordPage/getInitialRecordValues.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordSidebar/EditRecordSidebar.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordSidebar/EditRecordSidebar.js +6 -8
- package/dist/components/RecordEdition/EditRecordSidebar/EditRecordSidebar.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.js +2 -33
- package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/useRecordInformations.js +11 -0
- package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/useRecordInformations.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordSummary.js +2 -19
- package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordSummary.js.map +1 -1
- package/dist/components/RecordEdition/_types.d.ts +1 -1
- package/dist/components/RecordEdition/_types.js.map +1 -1
- package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.js +7 -6
- package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.js.map +1 -1
- package/dist/components/RecordEdition/hooks/useGetSubmitButtons.d.ts +1 -1
- package/dist/components/RecordEdition/hooks/useGetSubmitButtons.js +6 -2
- package/dist/components/RecordEdition/hooks/useGetSubmitButtons.js.map +1 -1
- package/dist/components/SearchModal/SearchModal.js +28 -18
- package/dist/components/SearchModal/SearchModal.js.map +1 -1
- package/dist/components/SelectTreeNode/SelectTreeNode.d.ts +0 -2
- package/dist/components/SelectTreeNode/SelectTreeNode.js +2 -2
- package/dist/components/SelectTreeNode/SelectTreeNode.js.map +1 -1
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.d.ts +0 -2
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.js +60 -114
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.js.map +1 -1
- package/dist/components/SelectTreeNode/TreeNodeTitle.d.ts +0 -1
- package/dist/components/SelectTreeNode/TreeNodeTitle.js +3 -7
- package/dist/components/SelectTreeNode/TreeNodeTitle.js.map +1 -1
- package/dist/components/SelectTreeNode/_queries/treeContentDataQuery.d.ts +6 -0
- package/dist/components/SelectTreeNode/_queries/treeContentDataQuery.js +56 -0
- package/dist/components/SelectTreeNode/_queries/treeContentDataQuery.js.map +1 -0
- package/dist/components/SelectTreeNode/_types.d.ts +0 -1
- package/dist/components/SelectTreeNode/_types.js.map +1 -1
- package/dist/components/index.d.ts +0 -3
- package/dist/components/index.js +0 -3
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/useGetRecordForm/useGetRecordForm.js +24 -22
- package/dist/hooks/useGetRecordForm/useGetRecordForm.js.map +1 -1
- package/dist/hooks/useGetRecordValuesQuery/useGetRecordValuesQuery.js +9 -6
- package/dist/hooks/useGetRecordValuesQuery/useGetRecordValuesQuery.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/schema.d.ts +14 -2
- package/dist/hooks/useIFrameMessenger/schema.js +7 -1
- package/dist/hooks/useIFrameMessenger/schema.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/types.d.ts +5 -0
- package/dist/hooks/useIFrameMessenger/types.js.map +1 -1
- package/dist/hooks/useRecordsConsultationHistory/useRecordsConsultationHistory.d.ts +1 -1
- package/dist/hooks/useRecordsConsultationHistory/useRecordsConsultationHistory.js +14 -6
- package/dist/hooks/useRecordsConsultationHistory/useRecordsConsultationHistory.js.map +1 -1
- package/dist/hooks/useRedirectToLogin/useRedirectToLogin.d.ts +2 -1
- package/dist/hooks/useRedirectToLogin/useRedirectToLogin.js +32 -4
- package/dist/hooks/useRedirectToLogin/useRedirectToLogin.js.map +1 -1
- package/dist/locales/en/shared.json +17 -35
- package/dist/locales/fr/shared.json +17 -35
- package/package.json +11 -20
- package/dist/__mocks__/common/mockSearchContextProvider.d.ts +0 -6
- package/dist/__mocks__/common/mockSearchContextProvider.js +0 -10
- package/dist/__mocks__/common/mockSearchContextProvider.js.map +0 -1
- package/dist/components/AttributesSelectionList/Attribute/Attribute.d.ts +0 -3
- package/dist/components/AttributesSelectionList/Attribute/Attribute.js +0 -50
- package/dist/components/AttributesSelectionList/Attribute/Attribute.js.map +0 -1
- package/dist/components/AttributesSelectionList/Attribute/index.d.ts +0 -2
- package/dist/components/AttributesSelectionList/Attribute/index.js +0 -6
- package/dist/components/AttributesSelectionList/Attribute/index.js.map +0 -1
- package/dist/components/AttributesSelectionList/AttributesSelectionList.d.ts +0 -10
- package/dist/components/AttributesSelectionList/AttributesSelectionList.js +0 -72
- package/dist/components/AttributesSelectionList/AttributesSelectionList.js.map +0 -1
- package/dist/components/AttributesSelectionList/SelectedAttributesList/SelectedAttribute/SelectedAttribute.d.ts +0 -7
- package/dist/components/AttributesSelectionList/SelectedAttributesList/SelectedAttribute/SelectedAttribute.js +0 -39
- package/dist/components/AttributesSelectionList/SelectedAttributesList/SelectedAttribute/SelectedAttribute.js.map +0 -1
- package/dist/components/AttributesSelectionList/SelectedAttributesList/SelectedAttribute/index.d.ts +0 -2
- package/dist/components/AttributesSelectionList/SelectedAttributesList/SelectedAttribute/index.js +0 -6
- package/dist/components/AttributesSelectionList/SelectedAttributesList/SelectedAttribute/index.js.map +0 -1
- package/dist/components/AttributesSelectionList/SelectedAttributesList/SelectedAttributesList.d.ts +0 -2
- package/dist/components/AttributesSelectionList/SelectedAttributesList/SelectedAttributesList.js +0 -63
- package/dist/components/AttributesSelectionList/SelectedAttributesList/SelectedAttributesList.js.map +0 -1
- package/dist/components/AttributesSelectionList/SelectedAttributesList/index.d.ts +0 -2
- package/dist/components/AttributesSelectionList/SelectedAttributesList/index.js +0 -6
- package/dist/components/AttributesSelectionList/SelectedAttributesList/index.js.map +0 -1
- package/dist/components/AttributesSelectionList/_types.d.ts +0 -8
- package/dist/components/AttributesSelectionList/_types.js +0 -2
- package/dist/components/AttributesSelectionList/_types.js.map +0 -1
- package/dist/components/AttributesSelectionList/helpers/attributeToSelectedAttribute.d.ts +0 -3
- package/dist/components/AttributesSelectionList/helpers/attributeToSelectedAttribute.js +0 -9
- package/dist/components/AttributesSelectionList/helpers/attributeToSelectedAttribute.js.map +0 -1
- package/dist/components/AttributesSelectionList/index.d.ts +0 -2
- package/dist/components/AttributesSelectionList/index.js +0 -6
- package/dist/components/AttributesSelectionList/index.js.map +0 -1
- package/dist/components/AttributesSelectionList/reducer/__mocks__/attributesSelectionListStateContext.d.ts +0 -11
- package/dist/components/AttributesSelectionList/reducer/__mocks__/attributesSelectionListStateContext.js +0 -10
- package/dist/components/AttributesSelectionList/reducer/__mocks__/attributesSelectionListStateContext.js.map +0 -1
- package/dist/components/AttributesSelectionList/reducer/attributesSelectionListReducer.d.ts +0 -33
- package/dist/components/AttributesSelectionList/reducer/attributesSelectionListReducer.js +0 -77
- package/dist/components/AttributesSelectionList/reducer/attributesSelectionListReducer.js.map +0 -1
- package/dist/components/AttributesSelectionList/reducer/attributesSelectionListStateContext.d.ts +0 -10
- package/dist/components/AttributesSelectionList/reducer/attributesSelectionListStateContext.js +0 -8
- package/dist/components/AttributesSelectionList/reducer/attributesSelectionListStateContext.js.map +0 -1
- package/dist/components/AttributesSelectionList/sharedComponents.d.ts +0 -809
- package/dist/components/AttributesSelectionList/sharedComponents.js +0 -16
- package/dist/components/AttributesSelectionList/sharedComponents.js.map +0 -1
- package/dist/components/DeactivateRecordsModal/DeactivateRecordsModal.d.ts +0 -10
- package/dist/components/DeactivateRecordsModal/DeactivateRecordsModal.js +0 -39
- package/dist/components/DeactivateRecordsModal/DeactivateRecordsModal.js.map +0 -1
- package/dist/components/DeactivateRecordsModal/index.d.ts +0 -1
- package/dist/components/DeactivateRecordsModal/index.js +0 -5
- package/dist/components/DeactivateRecordsModal/index.js.map +0 -1
- package/dist/components/LibraryItemsList/CreateNewRecordButton/CreateNewRecordButton.d.ts +0 -13
- package/dist/components/LibraryItemsList/CreateNewRecordButton/CreateNewRecordButton.js +0 -50
- package/dist/components/LibraryItemsList/CreateNewRecordButton/CreateNewRecordButton.js.map +0 -1
- package/dist/components/LibraryItemsList/CreateNewRecordButton/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/CreateNewRecordButton/index.js +0 -6
- package/dist/components/LibraryItemsList/CreateNewRecordButton/index.js.map +0 -1
- package/dist/components/LibraryItemsList/DisplayOptions/DisplayOptions.d.ts +0 -2
- package/dist/components/LibraryItemsList/DisplayOptions/DisplayOptions.js +0 -80
- package/dist/components/LibraryItemsList/DisplayOptions/DisplayOptions.js.map +0 -1
- package/dist/components/LibraryItemsList/DisplayOptions/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/DisplayOptions/index.js +0 -6
- package/dist/components/LibraryItemsList/DisplayOptions/index.js.map +0 -1
- package/dist/components/LibraryItemsList/DisplayTypeSelector/DisplayTypeSelector.d.ts +0 -2
- package/dist/components/LibraryItemsList/DisplayTypeSelector/DisplayTypeSelector.js +0 -22
- package/dist/components/LibraryItemsList/DisplayTypeSelector/DisplayTypeSelector.js.map +0 -1
- package/dist/components/LibraryItemsList/DisplayTypeSelector/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/DisplayTypeSelector/index.js +0 -6
- package/dist/components/LibraryItemsList/DisplayTypeSelector/index.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersDropdown/FiltersDropdown.d.ts +0 -13
- package/dist/components/LibraryItemsList/FiltersDropdown/FiltersDropdown.js +0 -229
- package/dist/components/LibraryItemsList/FiltersDropdown/FiltersDropdown.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersDropdown/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/FiltersDropdown/index.js +0 -6
- package/dist/components/LibraryItemsList/FiltersDropdown/index.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.d.ts +0 -11
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.js +0 -328
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterAttributeCondition/FilterAttributeCondition.d.ts +0 -7
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterAttributeCondition/FilterAttributeCondition.js +0 -90
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterAttributeCondition/FilterAttributeCondition.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterAttributeCondition/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterAttributeCondition/index.js +0 -6
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterAttributeCondition/index.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/BooleanFilter/BooleanFilter.d.ts +0 -3
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/BooleanFilter/BooleanFilter.js +0 -13
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/BooleanFilter/BooleanFilter.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/BooleanFilter/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/BooleanFilter/index.js +0 -6
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/BooleanFilter/index.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/DateBetweenFilter/DateBetweenFilter.d.ts +0 -3
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/DateBetweenFilter/DateBetweenFilter.js +0 -26
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/DateBetweenFilter/DateBetweenFilter.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/DateBetweenFilter/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/DateBetweenFilter/index.js +0 -6
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/DateBetweenFilter/index.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/DateFilter/DateFilter.d.ts +0 -3
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/DateFilter/DateFilter.js +0 -22
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/DateFilter/DateFilter.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/DateFilter/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/DateFilter/index.js +0 -6
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/DateFilter/index.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/NumericFilter/NumericFilter.d.ts +0 -3
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/NumericFilter/NumericFilter.js +0 -35
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/NumericFilter/NumericFilter.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/NumericFilter/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/NumericFilter/index.js +0 -6
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/NumericFilter/index.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/TextFilter/TextFilter.d.ts +0 -3
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/TextFilter/TextFilter.js +0 -34
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/TextFilter/TextFilter.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/TextFilter/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/TextFilter/index.js +0 -6
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/FilterInput/TextFilter/index.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/filterUtils.d.ts +0 -2
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/filterUtils.js +0 -16
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/filterUtils.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/index.js +0 -6
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/index.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/FilterDropdownButton/FilterDropdownButton.d.ts +0 -8
- package/dist/components/LibraryItemsList/FiltersPanel/FilterDropdownButton/FilterDropdownButton.js +0 -11
- package/dist/components/LibraryItemsList/FiltersPanel/FilterDropdownButton/FilterDropdownButton.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/FilterDropdownButton/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/FiltersPanel/FilterDropdownButton/index.js +0 -6
- package/dist/components/LibraryItemsList/FiltersPanel/FilterDropdownButton/index.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/FilterTreeCondition/FilterTreeCondition.d.ts +0 -6
- package/dist/components/LibraryItemsList/FiltersPanel/FilterTreeCondition/FilterTreeCondition.js +0 -38
- package/dist/components/LibraryItemsList/FiltersPanel/FilterTreeCondition/FilterTreeCondition.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/FilterTreeCondition/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/FiltersPanel/FilterTreeCondition/index.js +0 -6
- package/dist/components/LibraryItemsList/FiltersPanel/FilterTreeCondition/index.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/FiltersOptions.d.ts +0 -14
- package/dist/components/LibraryItemsList/FiltersPanel/FiltersOptions.js +0 -147
- package/dist/components/LibraryItemsList/FiltersPanel/FiltersOptions.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/FiltersPanel.d.ts +0 -2
- package/dist/components/LibraryItemsList/FiltersPanel/FiltersPanel.js +0 -121
- package/dist/components/LibraryItemsList/FiltersPanel/FiltersPanel.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/FiltersPanel/index.js +0 -6
- package/dist/components/LibraryItemsList/FiltersPanel/index.js.map +0 -1
- package/dist/components/LibraryItemsList/FiltersPanel/mustHideValue.d.ts +0 -3
- package/dist/components/LibraryItemsList/FiltersPanel/mustHideValue.js +0 -17
- package/dist/components/LibraryItemsList/FiltersPanel/mustHideValue.js.map +0 -1
- package/dist/components/LibraryItemsList/IconViewType/IconViewType.d.ts +0 -8
- package/dist/components/LibraryItemsList/IconViewType/IconViewType.js +0 -18
- package/dist/components/LibraryItemsList/IconViewType/IconViewType.js.map +0 -1
- package/dist/components/LibraryItemsList/IconViewType/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/IconViewType/index.js +0 -6
- package/dist/components/LibraryItemsList/IconViewType/index.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsList.d.ts +0 -14
- package/dist/components/LibraryItemsList/LibraryItemsList.js +0 -18
- package/dist/components/LibraryItemsList/LibraryItemsList.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListContent/LibraryItemsListContent.d.ts +0 -16
- package/dist/components/LibraryItemsList/LibraryItemsListContent/LibraryItemsListContent.js +0 -202
- package/dist/components/LibraryItemsList/LibraryItemsListContent/LibraryItemsListContent.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListContent/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/LibraryItemsListContent/index.js +0 -6
- package/dist/components/LibraryItemsList/LibraryItemsListContent/index.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListEmpty/LibraryItemsListEmpty.d.ts +0 -6
- package/dist/components/LibraryItemsList/LibraryItemsListEmpty/LibraryItemsListEmpty.js +0 -32
- package/dist/components/LibraryItemsList/LibraryItemsListEmpty/LibraryItemsListEmpty.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListEmpty/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/LibraryItemsListEmpty/index.js +0 -6
- package/dist/components/LibraryItemsList/LibraryItemsListEmpty/index.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListPagination/LibraryItemsListPagination.d.ts +0 -2
- package/dist/components/LibraryItemsList/LibraryItemsListPagination/LibraryItemsListPagination.js +0 -21
- package/dist/components/LibraryItemsList/LibraryItemsListPagination/LibraryItemsListPagination.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListPagination/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/LibraryItemsListPagination/index.js +0 -6
- package/dist/components/LibraryItemsList/LibraryItemsListPagination/index.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/BodyCell/BodyCell.d.ts +0 -8
- package/dist/components/LibraryItemsList/LibraryItemsListTable/BodyCell/BodyCell.js +0 -56
- package/dist/components/LibraryItemsList/LibraryItemsListTable/BodyCell/BodyCell.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/BodyCell/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/LibraryItemsListTable/BodyCell/index.js +0 -6
- package/dist/components/LibraryItemsList/LibraryItemsListTable/BodyCell/index.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/BodyRow/BodyRow.d.ts +0 -7
- package/dist/components/LibraryItemsList/LibraryItemsListTable/BodyRow/BodyRow.js +0 -54
- package/dist/components/LibraryItemsList/LibraryItemsListTable/BodyRow/BodyRow.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/BodyRow/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/LibraryItemsListTable/BodyRow/index.js +0 -6
- package/dist/components/LibraryItemsList/LibraryItemsListTable/BodyRow/index.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/AllValuesCount/AllValuesCount.d.ts +0 -8
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/AllValuesCount/AllValuesCount.js +0 -66
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/AllValuesCount/AllValuesCount.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/AllValuesCount/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/AllValuesCount/index.js +0 -6
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/AllValuesCount/index.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/Cell.d.ts +0 -8
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/Cell.js +0 -59
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/Cell.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/CellInfos/CellInfos.d.ts +0 -9
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/CellInfos/CellInfos.js +0 -56
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/CellInfos/CellInfos.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/CellInfos/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/CellInfos/index.js +0 -6
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/CellInfos/index.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/CellSelection/CellSelection.d.ts +0 -5
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/CellSelection/CellSelection.js +0 -34
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/CellSelection/CellSelection.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/CellSelection/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/CellSelection/index.js +0 -6
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/CellSelection/index.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/StandardCell/ElementsToDisplay/RichTextDisplay.d.ts +0 -5
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/StandardCell/ElementsToDisplay/RichTextDisplay.js +0 -23
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/StandardCell/ElementsToDisplay/RichTextDisplay.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/StandardCell/StandardCell.d.ts +0 -3
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/StandardCell/StandardCell.js +0 -80
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/StandardCell/StandardCell.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/StandardCell/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/StandardCell/index.js +0 -6
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/StandardCell/index.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/index.js +0 -6
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/index.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/typeGuards.d.ts +0 -12
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/typeGuards.js +0 -11
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/typeGuards.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/types.d.ts +0 -12
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/types.js +0 -2
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/types.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/utils.d.ts +0 -2
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/utils.js +0 -40
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/utils.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/ChooseTableColumns/ChooseTableColumns.d.ts +0 -6
- package/dist/components/LibraryItemsList/LibraryItemsListTable/ChooseTableColumns/ChooseTableColumns.js +0 -81
- package/dist/components/LibraryItemsList/LibraryItemsListTable/ChooseTableColumns/ChooseTableColumns.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/ChooseTableColumns/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/LibraryItemsListTable/ChooseTableColumns/index.js +0 -6
- package/dist/components/LibraryItemsList/LibraryItemsListTable/ChooseTableColumns/index.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Header/Header.d.ts +0 -9
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Header/Header.js +0 -142
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Header/Header.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Header/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Header/index.js +0 -6
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Header/index.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Table.d.ts +0 -2
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Table.js +0 -232
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Table.js.map +0 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/LibraryItemsListTable/index.js +0 -6
- package/dist/components/LibraryItemsList/LibraryItemsListTable/index.js.map +0 -1
- package/dist/components/LibraryItemsList/MenuItemList/MenuItemList.d.ts +0 -9
- package/dist/components/LibraryItemsList/MenuItemList/MenuItemList.js +0 -27
- package/dist/components/LibraryItemsList/MenuItemList/MenuItemList.js.map +0 -1
- package/dist/components/LibraryItemsList/MenuItemList/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/MenuItemList/index.js +0 -6
- package/dist/components/LibraryItemsList/MenuItemList/index.js.map +0 -1
- package/dist/components/LibraryItemsList/MenuItemListSelected/ActionsMenu/ActionsMenu.d.ts +0 -2
- package/dist/components/LibraryItemsList/MenuItemListSelected/ActionsMenu/ActionsMenu.js +0 -62
- package/dist/components/LibraryItemsList/MenuItemListSelected/ActionsMenu/ActionsMenu.js.map +0 -1
- package/dist/components/LibraryItemsList/MenuItemListSelected/ActionsMenu/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/MenuItemListSelected/ActionsMenu/index.js +0 -6
- package/dist/components/LibraryItemsList/MenuItemListSelected/ActionsMenu/index.js.map +0 -1
- package/dist/components/LibraryItemsList/MenuItemListSelected/MenuItemListSelected.d.ts +0 -5
- package/dist/components/LibraryItemsList/MenuItemListSelected/MenuItemListSelected.js +0 -139
- package/dist/components/LibraryItemsList/MenuItemListSelected/MenuItemListSelected.js.map +0 -1
- package/dist/components/LibraryItemsList/MenuItemListSelected/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/MenuItemListSelected/index.js +0 -6
- package/dist/components/LibraryItemsList/MenuItemListSelected/index.js.map +0 -1
- package/dist/components/LibraryItemsList/MenuSelection/MenuSelection.d.ts +0 -2
- package/dist/components/LibraryItemsList/MenuSelection/MenuSelection.js +0 -58
- package/dist/components/LibraryItemsList/MenuSelection/MenuSelection.js.map +0 -1
- package/dist/components/LibraryItemsList/MenuSelection/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/MenuSelection/index.js +0 -6
- package/dist/components/LibraryItemsList/MenuSelection/index.js.map +0 -1
- package/dist/components/LibraryItemsList/MenuView/MenuView.d.ts +0 -6
- package/dist/components/LibraryItemsList/MenuView/MenuView.js +0 -162
- package/dist/components/LibraryItemsList/MenuView/MenuView.js.map +0 -1
- package/dist/components/LibraryItemsList/MenuView/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/MenuView/index.js +0 -6
- package/dist/components/LibraryItemsList/MenuView/index.js.map +0 -1
- package/dist/components/LibraryItemsList/SearchItems/SearchItems.d.ts +0 -2
- package/dist/components/LibraryItemsList/SearchItems/SearchItems.js +0 -21
- package/dist/components/LibraryItemsList/SearchItems/SearchItems.js.map +0 -1
- package/dist/components/LibraryItemsList/SearchItems/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/SearchItems/index.js +0 -6
- package/dist/components/LibraryItemsList/SearchItems/index.js.map +0 -1
- package/dist/components/LibraryItemsList/Sidebar/Sidebar.d.ts +0 -2
- package/dist/components/LibraryItemsList/Sidebar/Sidebar.js +0 -58
- package/dist/components/LibraryItemsList/Sidebar/Sidebar.js.map +0 -1
- package/dist/components/LibraryItemsList/Sidebar/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/Sidebar/index.js +0 -6
- package/dist/components/LibraryItemsList/Sidebar/index.js.map +0 -1
- package/dist/components/LibraryItemsList/TileDisplay/ItemTileDisplay/ItemTileDisplay.d.ts +0 -6
- package/dist/components/LibraryItemsList/TileDisplay/ItemTileDisplay/ItemTileDisplay.js +0 -199
- package/dist/components/LibraryItemsList/TileDisplay/ItemTileDisplay/ItemTileDisplay.js.map +0 -1
- package/dist/components/LibraryItemsList/TileDisplay/ItemTileDisplay/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/TileDisplay/ItemTileDisplay/index.js +0 -6
- package/dist/components/LibraryItemsList/TileDisplay/ItemTileDisplay/index.js.map +0 -1
- package/dist/components/LibraryItemsList/TileDisplay/TileDisplay.d.ts +0 -2
- package/dist/components/LibraryItemsList/TileDisplay/TileDisplay.js +0 -50
- package/dist/components/LibraryItemsList/TileDisplay/TileDisplay.js.map +0 -1
- package/dist/components/LibraryItemsList/TileDisplay/helpers/getItemPreviewSize.d.ts +0 -3
- package/dist/components/LibraryItemsList/TileDisplay/helpers/getItemPreviewSize.js +0 -11
- package/dist/components/LibraryItemsList/TileDisplay/helpers/getItemPreviewSize.js.map +0 -1
- package/dist/components/LibraryItemsList/TileDisplay/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/TileDisplay/index.js +0 -6
- package/dist/components/LibraryItemsList/TileDisplay/index.js.map +0 -1
- package/dist/components/LibraryItemsList/VersionsPanel/VersionsPanel.d.ts +0 -2
- package/dist/components/LibraryItemsList/VersionsPanel/VersionsPanel.js +0 -66
- package/dist/components/LibraryItemsList/VersionsPanel/VersionsPanel.js.map +0 -1
- package/dist/components/LibraryItemsList/VersionsPanel/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/VersionsPanel/index.js +0 -6
- package/dist/components/LibraryItemsList/VersionsPanel/index.js.map +0 -1
- package/dist/components/LibraryItemsList/ViewPanel/EditView/EditView.d.ts +0 -9
- package/dist/components/LibraryItemsList/ViewPanel/EditView/EditView.js +0 -85
- package/dist/components/LibraryItemsList/ViewPanel/EditView/EditView.js.map +0 -1
- package/dist/components/LibraryItemsList/ViewPanel/EditView/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/ViewPanel/EditView/index.js +0 -6
- package/dist/components/LibraryItemsList/ViewPanel/EditView/index.js.map +0 -1
- package/dist/components/LibraryItemsList/ViewPanel/View/View.d.ts +0 -7
- package/dist/components/LibraryItemsList/ViewPanel/View/View.js +0 -152
- package/dist/components/LibraryItemsList/ViewPanel/View/View.js.map +0 -1
- package/dist/components/LibraryItemsList/ViewPanel/View/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/ViewPanel/View/index.js +0 -6
- package/dist/components/LibraryItemsList/ViewPanel/View/index.js.map +0 -1
- package/dist/components/LibraryItemsList/ViewPanel/ViewPanel.d.ts +0 -2
- package/dist/components/LibraryItemsList/ViewPanel/ViewPanel.js +0 -209
- package/dist/components/LibraryItemsList/ViewPanel/ViewPanel.js.map +0 -1
- package/dist/components/LibraryItemsList/ViewPanel/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/ViewPanel/index.js +0 -6
- package/dist/components/LibraryItemsList/ViewPanel/index.js.map +0 -1
- package/dist/components/LibraryItemsList/constants.d.ts +0 -12
- package/dist/components/LibraryItemsList/constants.js +0 -19
- package/dist/components/LibraryItemsList/constants.js.map +0 -1
- package/dist/components/LibraryItemsList/helpers/defaultFilterConditionByAttributeFormat.d.ts +0 -3
- package/dist/components/LibraryItemsList/helpers/defaultFilterConditionByAttributeFormat.js +0 -21
- package/dist/components/LibraryItemsList/helpers/defaultFilterConditionByAttributeFormat.js.map +0 -1
- package/dist/components/LibraryItemsList/helpers/displayTypeToPreviewSize.d.ts +0 -3
- package/dist/components/LibraryItemsList/helpers/displayTypeToPreviewSize.js +0 -18
- package/dist/components/LibraryItemsList/helpers/displayTypeToPreviewSize.js.map +0 -1
- package/dist/components/LibraryItemsList/helpers/extractAttributesFromLibrary.d.ts +0 -4
- package/dist/components/LibraryItemsList/helpers/extractAttributesFromLibrary.js +0 -64
- package/dist/components/LibraryItemsList/helpers/extractAttributesFromLibrary.js.map +0 -1
- package/dist/components/LibraryItemsList/helpers/getFieldFromKey.d.ts +0 -5
- package/dist/components/LibraryItemsList/helpers/getFieldFromKey.js +0 -40
- package/dist/components/LibraryItemsList/helpers/getFieldFromKey.js.map +0 -1
- package/dist/components/LibraryItemsList/helpers/getFieldsFromView.d.ts +0 -6
- package/dist/components/LibraryItemsList/helpers/getFieldsFromView.js +0 -10
- package/dist/components/LibraryItemsList/helpers/getFieldsFromView.js.map +0 -1
- package/dist/components/LibraryItemsList/helpers/getFieldsKeyFromAttribute.d.ts +0 -2
- package/dist/components/LibraryItemsList/helpers/getFieldsKeyFromAttribute.js +0 -13
- package/dist/components/LibraryItemsList/helpers/getFieldsKeyFromAttribute.js.map +0 -1
- package/dist/components/LibraryItemsList/helpers/getSortFieldByAttributeType.d.ts +0 -2
- package/dist/components/LibraryItemsList/helpers/getSortFieldByAttributeType.js +0 -18
- package/dist/components/LibraryItemsList/helpers/getSortFieldByAttributeType.js.map +0 -1
- package/dist/components/LibraryItemsList/hooks/useLibraryView/useLibraryView.d.ts +0 -8
- package/dist/components/LibraryItemsList/hooks/useLibraryView/useLibraryView.js +0 -99
- package/dist/components/LibraryItemsList/hooks/useLibraryView/useLibraryView.js.map +0 -1
- package/dist/components/LibraryItemsList/hooks/useSearchReducer/_types.d.ts +0 -82
- package/dist/components/LibraryItemsList/hooks/useSearchReducer/_types.js +0 -2
- package/dist/components/LibraryItemsList/hooks/useSearchReducer/_types.js.map +0 -1
- package/dist/components/LibraryItemsList/hooks/useSearchReducer/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/hooks/useSearchReducer/index.js +0 -6
- package/dist/components/LibraryItemsList/hooks/useSearchReducer/index.js.map +0 -1
- package/dist/components/LibraryItemsList/hooks/useSearchReducer/searchContext.d.ts +0 -7
- package/dist/components/LibraryItemsList/hooks/useSearchReducer/searchContext.js +0 -7
- package/dist/components/LibraryItemsList/hooks/useSearchReducer/searchContext.js.map +0 -1
- package/dist/components/LibraryItemsList/hooks/useSearchReducer/searchReducer.d.ts +0 -121
- package/dist/components/LibraryItemsList/hooks/useSearchReducer/searchReducer.js +0 -228
- package/dist/components/LibraryItemsList/hooks/useSearchReducer/searchReducer.js.map +0 -1
- package/dist/components/LibraryItemsList/hooks/useSearchReducer/useSearchReducer.d.ts +0 -5
- package/dist/components/LibraryItemsList/hooks/useSearchReducer/useSearchReducer.js +0 -8
- package/dist/components/LibraryItemsList/hooks/useSearchReducer/useSearchReducer.js.map +0 -1
- package/dist/components/LibraryItemsList/hooks/useUpdateViewsOrderMutation.d.ts +0 -7
- package/dist/components/LibraryItemsList/hooks/useUpdateViewsOrderMutation.js +0 -40
- package/dist/components/LibraryItemsList/hooks/useUpdateViewsOrderMutation.js.map +0 -1
- package/dist/components/LibraryItemsList/index.d.ts +0 -1
- package/dist/components/LibraryItemsList/index.js +0 -5
- package/dist/components/LibraryItemsList/index.js.map +0 -1
- package/dist/components/LibraryItemsList/manageItems.d.ts +0 -11
- package/dist/components/LibraryItemsList/manageItems.js +0 -98
- package/dist/components/LibraryItemsList/manageItems.js.map +0 -1
- package/dist/components/LibraryItemsList/shared/DeactivateRecordBtn/DeactivateRecordBtn.d.ts +0 -7
- package/dist/components/LibraryItemsList/shared/DeactivateRecordBtn/DeactivateRecordBtn.js +0 -38
- package/dist/components/LibraryItemsList/shared/DeactivateRecordBtn/DeactivateRecordBtn.js.map +0 -1
- package/dist/components/LibraryItemsList/shared/DeactivateRecordBtn/index.d.ts +0 -2
- package/dist/components/LibraryItemsList/shared/DeactivateRecordBtn/index.js +0 -6
- package/dist/components/LibraryItemsList/shared/DeactivateRecordBtn/index.js.map +0 -1
- package/dist/components/LibraryItemsList/shared/SelectCellsBtn.d.ts +0 -12
- package/dist/components/LibraryItemsList/shared/SelectCellsBtn.js +0 -29
- package/dist/components/LibraryItemsList/shared/SelectCellsBtn.js.map +0 -1
- package/dist/components/LibraryItemsList/shared/sharedUtils.d.ts +0 -4
- package/dist/components/LibraryItemsList/shared/sharedUtils.js +0 -9
- package/dist/components/LibraryItemsList/shared/sharedUtils.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/helpers/getActiveFieldValues/getActiveFieldValues.d.ts +0 -3
- package/dist/components/RecordEdition/EditRecordContent/helpers/getActiveFieldValues/getActiveFieldValues.js +0 -2
- package/dist/components/RecordEdition/EditRecordContent/helpers/getActiveFieldValues/getActiveFieldValues.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/helpers/getActiveFieldValues/index.d.ts +0 -1
- package/dist/components/RecordEdition/EditRecordContent/helpers/getActiveFieldValues/index.js +0 -5
- package/dist/components/RecordEdition/EditRecordContent/helpers/getActiveFieldValues/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/helpers/isCurrentVersion/index.d.ts +0 -1
- package/dist/components/RecordEdition/EditRecordContent/helpers/isCurrentVersion/index.js +0 -5
- package/dist/components/RecordEdition/EditRecordContent/helpers/isCurrentVersion/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/helpers/isCurrentVersion/isCurrentVersion.d.ts +0 -7
- package/dist/components/RecordEdition/EditRecordContent/helpers/isCurrentVersion/isCurrentVersion.js +0 -20
- package/dist/components/RecordEdition/EditRecordContent/helpers/isCurrentVersion/isCurrentVersion.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/hooks/useTabManagement.d.ts +0 -11
- package/dist/components/RecordEdition/EditRecordContent/hooks/useTabManagement.js +0 -35
- package/dist/components/RecordEdition/EditRecordContent/hooks/useTabManagement.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/reducers/linkFieldReducer/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/reducers/linkFieldReducer/index.js +0 -6
- package/dist/components/RecordEdition/EditRecordContent/reducers/linkFieldReducer/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/reducers/linkFieldReducer/linkFieldReducer.d.ts +0 -52
- package/dist/components/RecordEdition/EditRecordContent/reducers/linkFieldReducer/linkFieldReducer.js +0 -144
- package/dist/components/RecordEdition/EditRecordContent/reducers/linkFieldReducer/linkFieldReducer.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/AddValueBtn/AddValueBtn.d.ts +0 -9
- package/dist/components/RecordEdition/EditRecordContent/shared/AddValueBtn/AddValueBtn.js +0 -19
- package/dist/components/RecordEdition/EditRecordContent/shared/AddValueBtn/AddValueBtn.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/AddValueBtn/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/shared/AddValueBtn/index.js +0 -6
- package/dist/components/RecordEdition/EditRecordContent/shared/AddValueBtn/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/DeleteAllValuesBtn/DeleteAllValuesBtn.d.ts +0 -5
- package/dist/components/RecordEdition/EditRecordContent/shared/DeleteAllValuesBtn/DeleteAllValuesBtn.js +0 -21
- package/dist/components/RecordEdition/EditRecordContent/shared/DeleteAllValuesBtn/DeleteAllValuesBtn.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/DeleteAllValuesBtn/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/shared/DeleteAllValuesBtn/index.js +0 -6
- package/dist/components/RecordEdition/EditRecordContent/shared/DeleteAllValuesBtn/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/DeleteValueBtn/DeleteValueBtn.d.ts +0 -6
- package/dist/components/RecordEdition/EditRecordContent/shared/DeleteValueBtn/DeleteValueBtn.js +0 -14
- package/dist/components/RecordEdition/EditRecordContent/shared/DeleteValueBtn/DeleteValueBtn.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/DeleteValueBtn/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/shared/DeleteValueBtn/index.js +0 -6
- package/dist/components/RecordEdition/EditRecordContent/shared/DeleteValueBtn/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/FieldFooter/FieldFooter.d.ts +0 -9
- package/dist/components/RecordEdition/EditRecordContent/shared/FieldFooter/FieldFooter.js +0 -28
- package/dist/components/RecordEdition/EditRecordContent/shared/FieldFooter/FieldFooter.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/FieldFooter/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/shared/FieldFooter/index.js +0 -6
- package/dist/components/RecordEdition/EditRecordContent/shared/FieldFooter/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/InheritedFieldLabel/InheritedFieldLabel.d.ts +0 -6
- package/dist/components/RecordEdition/EditRecordContent/shared/InheritedFieldLabel/InheritedFieldLabel.js +0 -25
- package/dist/components/RecordEdition/EditRecordContent/shared/InheritedFieldLabel/InheritedFieldLabel.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/InheritedFieldLabel/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/shared/InheritedFieldLabel/index.js +0 -6
- package/dist/components/RecordEdition/EditRecordContent/shared/InheritedFieldLabel/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/NoValue/NoValue.d.ts +0 -7
- package/dist/components/RecordEdition/EditRecordContent/shared/NoValue/NoValue.js +0 -33
- package/dist/components/RecordEdition/EditRecordContent/shared/NoValue/NoValue.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/NoValue/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/shared/NoValue/index.js +0 -6
- package/dist/components/RecordEdition/EditRecordContent/shared/NoValue/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/UpdatedFieldIcon/UpdatedFieldIcon.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/shared/UpdatedFieldIcon/UpdatedFieldIcon.js +0 -13
- package/dist/components/RecordEdition/EditRecordContent/shared/UpdatedFieldIcon/UpdatedFieldIcon.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/UpdatedFieldIcon/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/shared/UpdatedFieldIcon/index.js +0 -6
- package/dist/components/RecordEdition/EditRecordContent/shared/UpdatedFieldIcon/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/ValueDetailsBtn/ValueDetailsBtn.d.ts +0 -10
- package/dist/components/RecordEdition/EditRecordContent/shared/ValueDetailsBtn/ValueDetailsBtn.js +0 -24
- package/dist/components/RecordEdition/EditRecordContent/shared/ValueDetailsBtn/ValueDetailsBtn.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/ValueDetailsBtn/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/shared/ValueDetailsBtn/index.js +0 -6
- package/dist/components/RecordEdition/EditRecordContent/shared/ValueDetailsBtn/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/ValuesVersionBtn.d.ts +0 -13
- package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/ValuesVersionBtn.js +0 -41
- package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/ValuesVersionBtn.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/index.js +0 -6
- package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionIndicator/ValuesVersionIndicator.d.ts +0 -8
- package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionIndicator/ValuesVersionIndicator.js +0 -34
- package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionIndicator/ValuesVersionIndicator.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionIndicator/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionIndicator/index.js +0 -6
- package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionIndicator/index.js.map +0 -1
|
@@ -3,10 +3,10 @@ import { jsx as _jsx, jsxs as _jsxs } 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, useRef, useState } from 'react';
|
|
6
|
-
import { KitButton, KitModal, KitSpace, KitTypography } from 'aristid-ds';
|
|
6
|
+
import { KitButton, KitLoader, KitModal, KitSpace, KitTypography } from 'aristid-ds';
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
9
|
-
import { usePurgeRecordMutation } from '../../../_gqlTypes';
|
|
9
|
+
import { useCreateRecordMutation, usePurgeRecordMutation } from '../../../_gqlTypes';
|
|
10
10
|
import { EditRecord } from '../EditRecord';
|
|
11
11
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
12
12
|
import { faXmark } from '@fortawesome/free-solid-svg-icons';
|
|
@@ -14,8 +14,8 @@ import { useGetSubmitButtons } from '../hooks/useGetSubmitButtons';
|
|
|
14
14
|
import { useForm } from 'antd/lib/form/Form';
|
|
15
15
|
import { useCreateCancelConfirm } from '../hooks/useCreateCancelConfirm';
|
|
16
16
|
import { EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS } from '../constants';
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
17
|
+
import { useGetInitialRecordValues } from '../EditRecordPage/getInitialRecordValues';
|
|
18
|
+
import { ErrorComponent } from '../EditRecordPage/ErrorComponent';
|
|
19
19
|
const MODAL_HEIGHT = '80vh';
|
|
20
20
|
const MODAL_WIDTH = '90vw';
|
|
21
21
|
const MODAL_MAX_WIDTH = '656px';
|
|
@@ -60,29 +60,40 @@ export const EditRecordModal = ({ className, open, record, creationFormId, editi
|
|
|
60
60
|
const { t } = useSharedTranslation();
|
|
61
61
|
const [antdForm] = useForm();
|
|
62
62
|
const [currentRecord, setCurrentRecord] = useState(record);
|
|
63
|
-
const
|
|
64
|
-
const
|
|
63
|
+
const clickedSubmitButton = useRef(null);
|
|
64
|
+
const [createRecord] = useCreateRecordMutation();
|
|
65
65
|
const [purgeRecordMutation] = usePurgeRecordMutation();
|
|
66
66
|
const formElementId = useRef(window.crypto.randomUUID());
|
|
67
67
|
const [isCreation, setIsCreation] = useState(!record);
|
|
68
|
+
const [isReady, setIsReady] = useState(!!record);
|
|
69
|
+
const [isError, setIsError] = useState(false);
|
|
68
70
|
const [formId, setFormId] = useState(isCreation ? (creationFormId ?? 'creation') : (editionFormId ?? 'edition'));
|
|
69
71
|
const closeButtonLabel = isCreation ? t('global.cancel') : t('global.close');
|
|
70
72
|
const modalTitle = currentRecord?.label && currentRecord.label.trim() ? currentRecord.label : t('record_edition.new_record');
|
|
71
73
|
useEffect(() => {
|
|
72
74
|
const createEmptyRecordFunction = async () => {
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
const values = useGetInitialRecordValues();
|
|
76
|
+
const { data } = await createRecord({
|
|
77
|
+
variables: {
|
|
78
|
+
library,
|
|
79
|
+
skipActivate: true,
|
|
80
|
+
data: { values },
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
const recordId = data?.createRecord.record?.id;
|
|
84
|
+
setCurrentRecord(data?.createRecord.record.whoAmI ?? null);
|
|
85
|
+
if (!recordId) {
|
|
86
|
+
setIsError(true);
|
|
87
|
+
return;
|
|
77
88
|
}
|
|
78
|
-
|
|
89
|
+
setIsReady(true);
|
|
79
90
|
};
|
|
80
91
|
if (open && isCreation && !currentRecord) {
|
|
81
92
|
createEmptyRecordFunction();
|
|
82
93
|
}
|
|
83
94
|
}, [open, currentRecord]);
|
|
84
95
|
const _handleClickSubmit = (button) => {
|
|
85
|
-
|
|
96
|
+
clickedSubmitButton.current = button;
|
|
86
97
|
};
|
|
87
98
|
const _purgeRecordOnCreationCancel = () => purgeRecordMutation({
|
|
88
99
|
errorPolicy: 'ignore',
|
|
@@ -98,16 +109,15 @@ export const EditRecordModal = ({ className, open, record, creationFormId, editi
|
|
|
98
109
|
return onClose();
|
|
99
110
|
};
|
|
100
111
|
const showCancelConfirm = useCreateCancelConfirm(_closeAfterConfirm);
|
|
101
|
-
const displayedSubmitButtons = useGetSubmitButtons(submitButtons, formElementId.current, isCreation, _handleClickSubmit);
|
|
102
112
|
const _handleCreate = (newRecord) => {
|
|
103
113
|
setCurrentRecord(newRecord);
|
|
104
|
-
if (onCreateAndEdit && clickedSubmitButton === 'createAndEdit') {
|
|
114
|
+
if (onCreateAndEdit && clickedSubmitButton.current === 'createAndEdit') {
|
|
105
115
|
setFormId(editionFormId ?? 'edition');
|
|
106
116
|
setIsCreation(false);
|
|
107
117
|
onCreateAndEdit(newRecord);
|
|
108
118
|
return;
|
|
109
119
|
}
|
|
110
|
-
if (onCreate && clickedSubmitButton === 'create') {
|
|
120
|
+
if (onCreate && clickedSubmitButton.current === 'create') {
|
|
111
121
|
onCreate(newRecord);
|
|
112
122
|
return;
|
|
113
123
|
}
|
|
@@ -123,9 +133,10 @@ export const EditRecordModal = ({ className, open, record, creationFormId, editi
|
|
|
123
133
|
}
|
|
124
134
|
return onClose();
|
|
125
135
|
};
|
|
126
|
-
|
|
136
|
+
const displayedSubmitButtons = useGetSubmitButtons(submitButtons, formElementId.current, isCreation, _handleClickSubmit, _handleClose);
|
|
137
|
+
return (_jsxs(KitModalStyled, { appElement: document.getElementById('root'), 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: modalTitle }), _jsx("div", { id: EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS })] }), footer: _jsx(KitSpace, { children: [
|
|
127
138
|
_jsx(KitButton, { "aria-label": closeButtonLabel, icon: _jsx(FontAwesomeIcon, { icon: faXmark }), onClick: _handleClose, children: closeButtonLabel }, "close"),
|
|
128
139
|
...displayedSubmitButtons,
|
|
129
|
-
] }), closeIcon: _jsx(FontAwesomeIcon, { icon: faXmark }), showCloseIcon: true, destroyOnClose: true, children: _jsx(EditRecord, { antdForm: antdForm, isFormCreationMode: isCreation, formId: formId, formElementId: formElementId.current, record: currentRecord, library: library, onCreate: _handleCreate, valuesVersion: valuesVersion, showSidebar: showSidebar, enableSidebar: enableSidebar, withInfoButton: withInfoButton }) }));
|
|
140
|
+
] }), closeIcon: _jsx(FontAwesomeIcon, { icon: faXmark }), showCloseIcon: true, destroyOnClose: true, children: [isError && _jsx(ErrorComponent, {}), !isReady && _jsx(KitLoader, {}), isReady && (_jsx(EditRecord, { antdForm: antdForm, isFormCreationMode: isCreation, formId: formId, formElementId: formElementId.current, record: currentRecord, library: library, onCreate: _handleCreate, valuesVersion: valuesVersion, showSidebar: showSidebar, enableSidebar: enableSidebar, withInfoButton: withInfoButton }))] }));
|
|
130
141
|
};
|
|
131
142
|
//# 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,EAAyB,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC1E,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;AAEpE,OAAO,EAA8B,sBAAsB,EAAC,MAAM,eAAe,CAAC;AAClF,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,0CAA0C,EAAC,MAAM,cAAc,CAAC;AACxE,OAAO,mCAAmC,MAAM,yDAAyD,CAA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C,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,EAC1C,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,EAChD,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,YAAY,EACnB,KAAK,EACD,MAAC,QAAQ,eACL,KAAC,aAAa,CAAC,KAAK,IAAC,KAAK,EAAC,IAAI,EAAC,KAAK,EAAE,EAAC,MAAM,EAAE,CAAC,EAAC,YAC7C,UAAU,GACO,EACtB,cAAK,EAAE,EAAE,0CAA0C,GAAI,IAChD,EAEf,MAAM,EACF,KAAC,QAAQ,cACJ;gBACG,KAAC,SAAS,kBACM,gBAAgB,EAE5B,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,OAAO,GAAI,EACxC,OAAO,EAAE,YAAY,YAEpB,gBAAgB,IAJb,OAAO,CAKH;gBACZ,GAAG,sBAAsB;aAC5B,GACM,EAEf,SAAS,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,OAAO,GAAI,EAC7C,aAAa,QACb,cAAc,kBAEd,KAAC,UAAU,IACP,QAAQ,EAAE,QAAQ,EAClB,kBAAkB,EAAE,UAAU,EAC9B,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,CAAC,OAAO,EACpC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,aAAa,EACvB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,GAChC,GACW,CACpB,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type FunctionComponent, useEffect, useRef, useState} from 'react';\nimport {KitButton, KitModal, KitSpace, KitTypography} from 'aristid-ds';\nimport styled from 'styled-components';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type IValueVersion} from '_ui/types';\nimport {type RecordIdentityFragment, usePurgeRecordMutation} from '_ui/_gqlTypes';\nimport {EditRecord} from '../EditRecord';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faXmark} from '@fortawesome/free-solid-svg-icons';\nimport {type PossibleSubmitButtons, type SubmitButtonsName} from '../_types';\nimport {useGetSubmitButtons} from '../hooks/useGetSubmitButtons';\nimport {useForm} from 'antd/lib/form/Form';\nimport {useCreateCancelConfirm} from '../hooks/useCreateCancelConfirm';\nimport {EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS} from '../constants';\nimport useExecuteCreateEmptyRecordMutation from '../EditRecordContent/hooks/useCreateEmptyRecordMutation';\nimport {APICallStatus} from '../EditRecordContent/_types';\n\nexport interface IEditRecordModalProps {\n className?: string;\n open: boolean;\n record: RecordIdentityFragment['whoAmI'] | null;\n creationFormId?: string;\n editionFormId?: string;\n library: string;\n onClose: () => void;\n onCreate?: (newRecord: RecordIdentityFragment['whoAmI']) => void; // Called after submitting via the \"create\" button\n onCreateAndEdit?: (newRecord: RecordIdentityFragment['whoAmI']) => void; // Called after submitting via the \"create and edit\" button\n submitButtons?: PossibleSubmitButtons;\n withInfoButton?: boolean;\n valuesVersion?: IValueVersion;\n showSidebar?: boolean;\n enableSidebar?: boolean;\n autoHeight?: boolean;\n}\n\nconst MODAL_HEIGHT = '80vh';\nconst MODAL_WIDTH = '90vw';\nconst MODAL_MAX_WIDTH = '656px';\nconst MODAL_WITH_SIDEBAR_MAX_WIDTH = '900px';\n\nconst KitModalStyled = styled(KitModal)`\n && {\n & > div {\n max-width: ${MODAL_MAX_WIDTH};\n\n &:has(#edit_record_sidebar) {\n max-width: ${MODAL_WITH_SIDEBAR_MAX_WIDTH};\n }\n\n .kit-modal-header {\n border-bottom: 1px solid var(--general-utilities-border);\n\n .kit-modal-title {\n padding-right: calc(var(--general-spacing-xs) * 1px);\n\n .ant-space {\n width: 100%;\n justify-content: space-between;\n }\n }\n }\n\n .kit-modal-content-wrapper {\n padding: 0;\n\n .kit-modal-content {\n height: 100%;\n\n & > div {\n height: 100%;\n }\n }\n }\n }\n }\n`;\n\nexport const EditRecordModal: FunctionComponent<IEditRecordModalProps> = ({\n className,\n open,\n record,\n creationFormId,\n editionFormId,\n library,\n onClose,\n onCreate,\n onCreateAndEdit,\n valuesVersion,\n showSidebar,\n enableSidebar,\n submitButtons = ['create'],\n withInfoButton = true,\n autoHeight = false,\n}) => {\n const {t} = useSharedTranslation();\n const [antdForm] = useForm();\n const [currentRecord, setCurrentRecord] = useState<RecordIdentityFragment['whoAmI'] | null>(record);\n const [clickedSubmitButton, setClickedSubmitButton] = useState<SubmitButtonsName | null>(null);\n const {createEmptyRecord} = useExecuteCreateEmptyRecordMutation();\n const [purgeRecordMutation] = usePurgeRecordMutation();\n\n const formElementId = useRef(window.crypto.randomUUID());\n const [isCreation, setIsCreation] = useState(!record);\n const [formId, setFormId] = useState<string>(\n isCreation ? (creationFormId ?? 'creation') : (editionFormId ?? 'edition'),\n );\n const closeButtonLabel = isCreation ? t('global.cancel') : t('global.close');\n const modalTitle =\n currentRecord?.label && currentRecord.label.trim() ? currentRecord.label : t('record_edition.new_record');\n\n useEffect(() => {\n const createEmptyRecordFunction = async () => {\n const res = await createEmptyRecord(library);\n if (res?.status === APICallStatus.ERROR) {\n // TODO : call KitNotification error\n return null;\n }\n setCurrentRecord(res?.record ?? null);\n };\n\n if (open && isCreation && !currentRecord) {\n createEmptyRecordFunction();\n }\n }, [open, currentRecord]);\n\n const _handleClickSubmit = (button: SubmitButtonsName) => {\n setClickedSubmitButton(button);\n };\n\n const _purgeRecordOnCreationCancel = () =>\n purgeRecordMutation({\n errorPolicy: 'ignore',\n variables: {\n libraryId: currentRecord?.library?.id,\n recordId: currentRecord?.id,\n },\n });\n\n const _closeAfterConfirm = async () => {\n if (currentRecord?.id && currentRecord?.library?.id) {\n _purgeRecordOnCreationCancel();\n }\n return onClose();\n };\n\n const showCancelConfirm = useCreateCancelConfirm(_closeAfterConfirm);\n\n const displayedSubmitButtons = useGetSubmitButtons(\n submitButtons,\n formElementId.current,\n isCreation,\n _handleClickSubmit,\n );\n\n const _handleCreate = (newRecord: RecordIdentityFragment['whoAmI']) => {\n setCurrentRecord(newRecord);\n\n if (onCreateAndEdit && clickedSubmitButton === 'createAndEdit') {\n setFormId(editionFormId ?? 'edition');\n setIsCreation(false);\n onCreateAndEdit(newRecord);\n return;\n }\n\n if (onCreate && clickedSubmitButton === 'create') {\n onCreate(newRecord);\n return;\n }\n };\n\n const _handleClose = () => {\n if (isCreation) {\n if (antdForm.isFieldsTouched()) {\n return showCancelConfirm();\n } else {\n _purgeRecordOnCreationCancel();\n }\n }\n\n return onClose();\n };\n\n return (\n <KitModalStyled\n appElement={document.getElementById('root')}\n className={className}\n height={autoHeight ? 'auto' : MODAL_HEIGHT}\n maxHeight={autoHeight ? MODAL_HEIGHT : undefined}\n width={MODAL_WIDTH}\n isOpen={open}\n close={_handleClose}\n title={\n <KitSpace>\n <KitTypography.Title level=\"h2\" style={{margin: 0}}>\n {modalTitle}\n </KitTypography.Title>\n <div id={EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS} />\n </KitSpace>\n }\n footer={\n <KitSpace>\n {[\n <KitButton\n aria-label={closeButtonLabel}\n key=\"close\"\n icon={<FontAwesomeIcon icon={faXmark} />}\n onClick={_handleClose}\n >\n {closeButtonLabel}\n </KitButton>,\n ...displayedSubmitButtons,\n ]}\n </KitSpace>\n }\n closeIcon={<FontAwesomeIcon icon={faXmark} />}\n showCloseIcon\n destroyOnClose\n >\n <EditRecord\n antdForm={antdForm}\n isFormCreationMode={isCreation}\n formId={formId}\n formElementId={formElementId.current}\n record={currentRecord}\n library={library}\n onCreate={_handleCreate}\n valuesVersion={valuesVersion}\n showSidebar={showSidebar}\n enableSidebar={enableSidebar}\n withInfoButton={withInfoButton}\n />\n </KitModalStyled>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"EditRecordModal.js","sourceRoot":"","sources":["../../../../src/components/RecordEdition/EditRecordModal/EditRecordModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnF,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAA8B,uBAAuB,EAAE,sBAAsB,EAAC,MAAM,eAAe,CAAC;AAC3G,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,0CAA0C,EAAC,MAAM,cAAc,CAAC;AACxE,OAAO,EAAC,yBAAyB,EAAC,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAC,cAAc,EAAC,MAAM,kCAAkC,CAAC;AAoBhE,MAAM,YAAY,GAAG,MAAM,CAAC;AAC5B,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,eAAe,GAAG,OAAO,CAAC;AAChC,MAAM,4BAA4B,GAAG,OAAO,CAAC;AAE7C,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;;;yBAGd,eAAe;;;6BAGX,4BAA4B;;;;;;;;;;;;;;;;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L,IACY,CACpB,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type FunctionComponent, useEffect, useRef, useState} from 'react';\nimport {KitButton, KitLoader, KitModal, KitSpace, KitTypography} from 'aristid-ds';\nimport styled from 'styled-components';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type IValueVersion} from '_ui/types';\nimport {type RecordIdentityFragment, useCreateRecordMutation, usePurgeRecordMutation} from '_ui/_gqlTypes';\nimport {EditRecord} from '../EditRecord';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faXmark} from '@fortawesome/free-solid-svg-icons';\nimport {type PossibleSubmitButtons, type SubmitButtonsName} from '../_types';\nimport {useGetSubmitButtons} from '../hooks/useGetSubmitButtons';\nimport {useForm} from 'antd/lib/form/Form';\nimport {useCreateCancelConfirm} from '../hooks/useCreateCancelConfirm';\nimport {EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS} from '../constants';\nimport {useGetInitialRecordValues} from '../EditRecordPage/getInitialRecordValues';\nimport {ErrorComponent} from '../EditRecordPage/ErrorComponent';\n\nexport interface IEditRecordModalProps {\n className?: string;\n open: boolean;\n record: RecordIdentityFragment['whoAmI'] | null;\n creationFormId?: string;\n editionFormId?: string;\n library: string;\n onClose: () => void;\n onCreate?: (newRecord: RecordIdentityFragment['whoAmI']) => void; // Called after submitting via the \"create\" button\n onCreateAndEdit?: (newRecord: RecordIdentityFragment['whoAmI']) => void; // Called after submitting via the \"create and edit\" button\n submitButtons?: PossibleSubmitButtons;\n withInfoButton?: boolean;\n valuesVersion?: IValueVersion;\n showSidebar?: boolean;\n enableSidebar?: boolean;\n autoHeight?: boolean;\n}\n\nconst MODAL_HEIGHT = '80vh';\nconst MODAL_WIDTH = '90vw';\nconst MODAL_MAX_WIDTH = '656px';\nconst MODAL_WITH_SIDEBAR_MAX_WIDTH = '900px';\n\nconst KitModalStyled = styled(KitModal)`\n && {\n & > div {\n max-width: ${MODAL_MAX_WIDTH};\n\n &:has(#edit_record_sidebar) {\n max-width: ${MODAL_WITH_SIDEBAR_MAX_WIDTH};\n }\n\n .kit-modal-header {\n border-bottom: 1px solid var(--general-utilities-border);\n\n .kit-modal-title {\n padding-right: calc(var(--general-spacing-xs) * 1px);\n\n .ant-space {\n width: 100%;\n justify-content: space-between;\n }\n }\n }\n\n .kit-modal-content-wrapper {\n padding: 0;\n\n .kit-modal-content {\n height: 100%;\n\n & > div {\n height: 100%;\n }\n }\n }\n }\n }\n`;\n\nexport const EditRecordModal: FunctionComponent<IEditRecordModalProps> = ({\n className,\n open,\n record,\n creationFormId,\n editionFormId,\n library,\n onClose,\n onCreate,\n onCreateAndEdit,\n valuesVersion,\n showSidebar,\n enableSidebar,\n submitButtons = ['create'],\n withInfoButton = true,\n autoHeight = false,\n}) => {\n const {t} = useSharedTranslation();\n const [antdForm] = useForm();\n const [currentRecord, setCurrentRecord] = useState<RecordIdentityFragment['whoAmI'] | null>(record);\n const clickedSubmitButton = useRef<SubmitButtonsName | null>(null);\n const [createRecord] = useCreateRecordMutation();\n const [purgeRecordMutation] = usePurgeRecordMutation();\n\n const formElementId = useRef(window.crypto.randomUUID());\n const [isCreation, setIsCreation] = useState(!record);\n const [isReady, setIsReady] = useState(!!record);\n const [isError, setIsError] = useState(false);\n const [formId, setFormId] = useState<string>(\n isCreation ? (creationFormId ?? 'creation') : (editionFormId ?? 'edition'),\n );\n const closeButtonLabel = isCreation ? t('global.cancel') : t('global.close');\n const modalTitle =\n currentRecord?.label && currentRecord.label.trim() ? currentRecord.label : t('record_edition.new_record');\n\n useEffect(() => {\n const createEmptyRecordFunction = async () => {\n const values = useGetInitialRecordValues();\n const {data} = await createRecord({\n variables: {\n library,\n skipActivate: true,\n data: {values},\n },\n });\n\n const recordId = data?.createRecord.record?.id;\n setCurrentRecord(data?.createRecord.record.whoAmI ?? null);\n if (!recordId) {\n setIsError(true);\n return;\n }\n\n setIsReady(true);\n };\n\n if (open && isCreation && !currentRecord) {\n createEmptyRecordFunction();\n }\n }, [open, currentRecord]);\n\n const _handleClickSubmit = (button: SubmitButtonsName) => {\n clickedSubmitButton.current = button;\n };\n\n const _purgeRecordOnCreationCancel = () =>\n purgeRecordMutation({\n errorPolicy: 'ignore',\n variables: {\n libraryId: currentRecord?.library?.id,\n recordId: currentRecord?.id,\n },\n });\n\n const _closeAfterConfirm = async () => {\n if (currentRecord?.id && currentRecord?.library?.id) {\n _purgeRecordOnCreationCancel();\n }\n return onClose();\n };\n\n const showCancelConfirm = useCreateCancelConfirm(_closeAfterConfirm);\n\n const _handleCreate = (newRecord: RecordIdentityFragment['whoAmI']) => {\n setCurrentRecord(newRecord);\n\n if (onCreateAndEdit && clickedSubmitButton.current === 'createAndEdit') {\n setFormId(editionFormId ?? 'edition');\n setIsCreation(false);\n onCreateAndEdit(newRecord);\n return;\n }\n\n if (onCreate && clickedSubmitButton.current === 'create') {\n onCreate(newRecord);\n return;\n }\n };\n\n const _handleClose = () => {\n if (isCreation) {\n if (antdForm.isFieldsTouched()) {\n return showCancelConfirm();\n } else {\n _purgeRecordOnCreationCancel();\n }\n }\n return onClose();\n };\n\n const displayedSubmitButtons = useGetSubmitButtons(\n submitButtons,\n formElementId.current,\n isCreation,\n _handleClickSubmit,\n _handleClose,\n );\n\n return (\n <KitModalStyled\n appElement={document.getElementById('root')}\n className={className}\n height={autoHeight ? 'auto' : MODAL_HEIGHT}\n maxHeight={autoHeight ? MODAL_HEIGHT : undefined}\n width={MODAL_WIDTH}\n isOpen={open}\n close={_handleClose}\n title={\n <KitSpace>\n <KitTypography.Title level=\"h2\" style={{margin: 0}}>\n {modalTitle}\n </KitTypography.Title>\n <div id={EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS} />\n </KitSpace>\n }\n footer={\n <KitSpace>\n {[\n <KitButton\n aria-label={closeButtonLabel}\n key=\"close\"\n icon={<FontAwesomeIcon icon={faXmark} />}\n onClick={_handleClose}\n >\n {closeButtonLabel}\n </KitButton>,\n ...displayedSubmitButtons,\n ]}\n </KitSpace>\n }\n closeIcon={<FontAwesomeIcon icon={faXmark} />}\n showCloseIcon\n destroyOnClose\n >\n {isError && <ErrorComponent />}\n {!isReady && <KitLoader />}\n {isReady && (\n <EditRecord\n antdForm={antdForm}\n isFormCreationMode={isCreation}\n formId={formId}\n formElementId={formElementId.current}\n record={currentRecord}\n library={library}\n onCreate={_handleCreate}\n valuesVersion={valuesVersion}\n showSidebar={showSidebar}\n enableSidebar={enableSidebar}\n withInfoButton={withInfoButton}\n />\n )}\n </KitModalStyled>\n );\n};\n"]}
|
|
@@ -3,10 +3,10 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
// This file is released under LGPL V3
|
|
4
4
|
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
5
5
|
import { useEffect, useRef, useState } from 'react';
|
|
6
|
-
import { KitButton, KitDivider, KitSpace, KitTypography } from 'aristid-ds';
|
|
6
|
+
import { KitButton, KitDivider, KitLoader, KitSpace, KitTypography } from 'aristid-ds';
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
9
|
-
import { usePurgeRecordMutation } from '../../../_gqlTypes';
|
|
9
|
+
import { useCreateRecordMutation, usePurgeRecordMutation } from '../../../_gqlTypes';
|
|
10
10
|
import { EditRecord } from '../EditRecord';
|
|
11
11
|
import { useGetSubmitButtons } from '../hooks/useGetSubmitButtons';
|
|
12
12
|
import { useForm } from 'antd/lib/form/Form';
|
|
@@ -14,10 +14,11 @@ import { useCreateCancelConfirm } from '../hooks/useCreateCancelConfirm';
|
|
|
14
14
|
import { EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS } from '../constants';
|
|
15
15
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
16
16
|
import { faXmark } from '@fortawesome/free-solid-svg-icons';
|
|
17
|
-
import { APICallStatus } from '../EditRecordContent/_types';
|
|
18
|
-
import useExecuteCreateEmptyRecordMutation from '../EditRecordContent/hooks/useCreateEmptyRecordMutation';
|
|
19
17
|
import { createPortal } from 'react-dom';
|
|
20
18
|
import { SUBMIT_BUTTONS_PORTAL } from '../../../constants';
|
|
19
|
+
import { ErrorBoundary } from '../../../components/ErrorBoundary';
|
|
20
|
+
import { ErrorComponent } from './ErrorComponent';
|
|
21
|
+
import { useGetInitialRecordValues } from './getInitialRecordValues';
|
|
21
22
|
const Header = styled.div `
|
|
22
23
|
grid-area: title;
|
|
23
24
|
align-self: center;
|
|
@@ -29,13 +30,15 @@ const Header = styled.div `
|
|
|
29
30
|
align-items: center;
|
|
30
31
|
`;
|
|
31
32
|
const emptyFunction = () => null;
|
|
32
|
-
export const EditRecordPage = ({ record, library, creationFormId, editionFormId, onCreate, onCreateAndEdit, valuesVersion, title, showHeader = true, submitButtons = ['create'], withInfoButton, onClose = emptyFunction, enableSidebar, showSidebar, sidebarContainer, isSubmitButtonsPortal = false, removePadding = false, }) => {
|
|
33
|
+
export const EditRecordPage = ({ record, library, creationFormId, editionFormId, onCreate, onCreateAndEdit, valuesVersion, title, showHeader = true, submitButtons = ['create'], withInfoButton, onClose = emptyFunction, enableSidebar, showSidebar, sidebarContainer, forceDisableSidebarInAppStudio, isSubmitButtonsPortal = false, removePadding = false, }) => {
|
|
33
34
|
const { t } = useSharedTranslation();
|
|
34
35
|
const [currentRecord, setCurrentRecord] = useState(record);
|
|
35
|
-
const
|
|
36
|
+
const clickedSubmitButton = useRef(null);
|
|
36
37
|
const formElementId = useRef(window.crypto.randomUUID());
|
|
37
38
|
const [isCreation, setIsCreation] = useState(!record);
|
|
38
|
-
const
|
|
39
|
+
const [isReady, setIsReady] = useState(!!record);
|
|
40
|
+
const [isError, setIsError] = useState(false);
|
|
41
|
+
const [createRecord] = useCreateRecordMutation();
|
|
39
42
|
const [purgeRecordMutation] = usePurgeRecordMutation();
|
|
40
43
|
const [formId, setFormId] = useState(isCreation ? (creationFormId ?? 'creation') : (editionFormId ?? 'edition'));
|
|
41
44
|
const [formCreateButtonsContainer, setFormCreateButtonsContainer] = useState();
|
|
@@ -49,19 +52,28 @@ export const EditRecordPage = ({ record, library, creationFormId, editionFormId,
|
|
|
49
52
|
}, []);
|
|
50
53
|
useEffect(() => {
|
|
51
54
|
const createEmptyRecordFunction = async () => {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
const values = useGetInitialRecordValues();
|
|
56
|
+
const { data } = await createRecord({
|
|
57
|
+
variables: {
|
|
58
|
+
library,
|
|
59
|
+
skipActivate: true,
|
|
60
|
+
data: { values },
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
const recordId = data?.createRecord.record?.id;
|
|
64
|
+
setCurrentRecord(data?.createRecord.record.whoAmI ?? null);
|
|
65
|
+
if (!recordId) {
|
|
66
|
+
setIsError(true);
|
|
67
|
+
return;
|
|
56
68
|
}
|
|
57
|
-
|
|
69
|
+
setIsReady(true);
|
|
58
70
|
};
|
|
59
|
-
if (isCreation) {
|
|
71
|
+
if (isCreation && !isReady) {
|
|
60
72
|
createEmptyRecordFunction();
|
|
61
73
|
}
|
|
62
74
|
}, []);
|
|
63
75
|
const _handleClickSubmit = (button) => {
|
|
64
|
-
|
|
76
|
+
clickedSubmitButton.current = button;
|
|
65
77
|
};
|
|
66
78
|
const _purgeRecordOnCreationCancel = () => purgeRecordMutation({
|
|
67
79
|
errorPolicy: 'ignore',
|
|
@@ -77,7 +89,6 @@ export const EditRecordPage = ({ record, library, creationFormId, editionFormId,
|
|
|
77
89
|
return onClose();
|
|
78
90
|
};
|
|
79
91
|
const showCancelConfirm = useCreateCancelConfirm(_closeAfterConfirm);
|
|
80
|
-
const displayedSubmitButtons = useGetSubmitButtons(submitButtons, formElementId.current, isCreation, _handleClickSubmit);
|
|
81
92
|
const [antdForm] = useForm();
|
|
82
93
|
const _handleClose = () => {
|
|
83
94
|
if (isCreation) {
|
|
@@ -91,21 +102,22 @@ export const EditRecordPage = ({ record, library, creationFormId, editionFormId,
|
|
|
91
102
|
return onClose();
|
|
92
103
|
};
|
|
93
104
|
const closeButtonLabel = isCreation ? t('global.cancel') : t('global.close');
|
|
105
|
+
const displayedSubmitButtons = useGetSubmitButtons(submitButtons, formElementId.current, isCreation, _handleClickSubmit, _handleClose);
|
|
94
106
|
const _handleCreate = (newRecord) => {
|
|
95
107
|
setCurrentRecord(newRecord);
|
|
96
|
-
if (onCreateAndEdit && clickedSubmitButton === 'createAndEdit') {
|
|
108
|
+
if (onCreateAndEdit && clickedSubmitButton.current === 'createAndEdit') {
|
|
97
109
|
setFormId(editionFormId ?? 'edition');
|
|
98
110
|
setIsCreation(false);
|
|
99
111
|
onCreateAndEdit(newRecord);
|
|
100
112
|
return;
|
|
101
113
|
}
|
|
102
|
-
if (onCreate && clickedSubmitButton === 'create') {
|
|
114
|
+
if (onCreate && clickedSubmitButton.current === 'create') {
|
|
103
115
|
onCreate(newRecord);
|
|
104
116
|
return;
|
|
105
117
|
}
|
|
106
118
|
};
|
|
107
119
|
return (_jsxs(_Fragment, { children: [showHeader && (_jsxs(_Fragment, { children: [_jsxs(Header, { children: [title !== undefined ? (title) : (_jsx(KitTypography.Title, { level: "h2", style: { margin: 0 }, children: currentRecord?.label ?? t('record_edition.new_record') })), _jsx("div", { id: EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS, "data-testid": EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS }), _jsx(KitButton, { onClick: _handleClose, icon: _jsx(FontAwesomeIcon, { icon: faXmark }), children: closeButtonLabel }), _jsx(KitSpace, { children: displayedSubmitButtons })] }), _jsx(KitDivider, { noMargin: true, color: "lightGrey" })] })), isSubmitButtonsPortal &&
|
|
108
120
|
formCreateButtonsContainer &&
|
|
109
|
-
createPortal(displayedSubmitButtons, formCreateButtonsContainer), _jsx(EditRecord, { antdForm: antdForm, formId: formId, isFormCreationMode: isCreation, formElementId: formElementId.current, record: currentRecord, library: library, valuesVersion: valuesVersion, onCreate: _handleCreate, containerStyle: showHeader ? { height: 'calc(100% - 82px)' } : { height: '100%' }, withInfoButton: withInfoButton, enableSidebar: enableSidebar, showSidebar: showSidebar, sidebarContainer: sidebarContainer, removePadding: removePadding })] }));
|
|
121
|
+
createPortal(displayedSubmitButtons, formCreateButtonsContainer), _jsxs(ErrorBoundary, { children: [isError && _jsx(ErrorComponent, {}), !isReady && _jsx(KitLoader, {}), isReady && (_jsx(EditRecord, { antdForm: antdForm, formId: formId, isFormCreationMode: isCreation, formElementId: formElementId.current, record: currentRecord, library: library, valuesVersion: valuesVersion, onCreate: _handleCreate, containerStyle: showHeader ? { height: 'calc(100% - 82px)' } : { height: '100%' }, withInfoButton: withInfoButton, enableSidebar: enableSidebar, forceDisableSidebarInAppStudio: forceDisableSidebarInAppStudio, showSidebar: showSidebar, sidebarContainer: sidebarContainer, removePadding: removePadding }))] })] }));
|
|
110
122
|
};
|
|
111
123
|
//# sourceMappingURL=EditRecordPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditRecordPage.js","sourceRoot":"","sources":["../../../../src/components/RecordEdition/EditRecordPage/EditRecordPage.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC1F,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAC1E,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAA8B,sBAAsB,EAAC,MAAM,eAAe,CAAC;AAClF,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAA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c,EAAE,UAAU,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,mBAAmB,EAAC,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,MAAM,EAAC,EAC7E,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,aAAa,GAC9B,IACH,CACN,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type FunctionComponent, type ReactNode, useEffect, useRef, useState} from 'react';\nimport {KitButton, KitDivider, KitSpace, KitTypography} from 'aristid-ds';\nimport styled from 'styled-components';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type IValueVersion} from '_ui/types';\nimport {type RecordIdentityFragment, usePurgeRecordMutation} from '_ui/_gqlTypes';\nimport {EditRecord} from '../EditRecord';\nimport {type PossibleSubmitButtons, type SubmitButtonsName} from '../_types';\nimport {useGetSubmitButtons} from '../hooks/useGetSubmitButtons';\nimport {useForm} from 'antd/lib/form/Form';\nimport {useCreateCancelConfirm} from '../hooks/useCreateCancelConfirm';\nimport {EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS} from '../constants';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faXmark} from '@fortawesome/free-solid-svg-icons';\nimport {APICallStatus} from '../EditRecordContent/_types';\nimport useExecuteCreateEmptyRecordMutation from '../EditRecordContent/hooks/useCreateEmptyRecordMutation';\nimport {createPortal} from 'react-dom';\nimport {SUBMIT_BUTTONS_PORTAL} from '_ui/constants';\n\ninterface IEditRecordPageProps {\n record: RecordIdentityFragment['whoAmI'] | null;\n creationFormId?: string;\n editionFormId?: string;\n library: string;\n title?: ReactNode;\n onCreate?: (newRecord: RecordIdentityFragment['whoAmI']) => void; // Called after submitting via the \"create\" button\n onCreateAndEdit?: (newRecord: RecordIdentityFragment['whoAmI']) => void; // Called after submitting via the \"create and edit\" button\n submitButtons?: PossibleSubmitButtons;\n valuesVersion?: IValueVersion;\n showRefreshButton?: boolean;\n showHeader?: boolean;\n withInfoButton?: boolean;\n onClose?: () => void;\n showSidebar?: boolean;\n enableSidebar?: boolean;\n sidebarContainer?: HTMLElement;\n isSubmitButtonsPortal?: boolean;\n removePadding?: boolean;\n}\n\nconst Header = styled.div`\n grid-area: title;\n align-self: center;\n font-size: 1rem;\n padding: 16px 32px;\n height: 82px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n`;\n\nconst emptyFunction = () => null;\n\nexport const EditRecordPage: FunctionComponent<IEditRecordPageProps> = ({\n record,\n library,\n creationFormId,\n editionFormId,\n onCreate,\n onCreateAndEdit,\n valuesVersion,\n title,\n showHeader = true,\n submitButtons = ['create'],\n withInfoButton,\n onClose = emptyFunction,\n enableSidebar,\n showSidebar,\n sidebarContainer,\n isSubmitButtonsPortal = false,\n removePadding = false,\n}) => {\n const {t} = useSharedTranslation();\n const [currentRecord, setCurrentRecord] = useState<RecordIdentityFragment['whoAmI'] | null>(record);\n const [clickedSubmitButton, setClickedSubmitButton] = useState<SubmitButtonsName | null>(null);\n const formElementId = useRef(window.crypto.randomUUID());\n const [isCreation, setIsCreation] = useState(!record);\n const {createEmptyRecord} = useExecuteCreateEmptyRecordMutation();\n const [purgeRecordMutation] = usePurgeRecordMutation();\n const [formId, setFormId] = useState<string>(\n isCreation ? (creationFormId ?? 'creation') : (editionFormId ?? 'edition'),\n );\n\n const [formCreateButtonsContainer, setFormCreateButtonsContainer] = useState<HTMLElement>();\n\n useEffect(() => {\n if (isSubmitButtonsPortal) {\n const formCreateButtonsElement = document.getElementById(SUBMIT_BUTTONS_PORTAL);\n if (formCreateButtonsElement) {\n setFormCreateButtonsContainer(formCreateButtonsElement);\n }\n }\n }, []);\n\n useEffect(() => {\n const createEmptyRecordFunction = async () => {\n const res = await createEmptyRecord(library);\n if (res?.status === APICallStatus.ERROR) {\n // TODO : call KitNotification error\n return null;\n }\n setCurrentRecord(res?.record ?? null);\n };\n\n if (isCreation) {\n createEmptyRecordFunction();\n }\n }, []);\n\n const _handleClickSubmit = (button: SubmitButtonsName) => {\n setClickedSubmitButton(button);\n };\n\n const _purgeRecordOnCreationCancel = () =>\n purgeRecordMutation({\n errorPolicy: 'ignore',\n variables: {\n libraryId: currentRecord?.library?.id,\n recordId: currentRecord?.id,\n },\n });\n\n const _closeAfterConfirm = async () => {\n if (currentRecord?.id && currentRecord?.library?.id) {\n _purgeRecordOnCreationCancel();\n }\n return onClose();\n };\n\n const showCancelConfirm = useCreateCancelConfirm(_closeAfterConfirm);\n\n const displayedSubmitButtons = useGetSubmitButtons(\n submitButtons,\n formElementId.current,\n isCreation,\n _handleClickSubmit,\n );\n const [antdForm] = useForm();\n\n const _handleClose = () => {\n if (isCreation) {\n if (antdForm.isFieldsTouched()) {\n return showCancelConfirm();\n } else {\n _purgeRecordOnCreationCancel();\n }\n }\n\n return onClose();\n };\n\n const closeButtonLabel = isCreation ? t('global.cancel') : t('global.close');\n\n const _handleCreate = (newRecord: RecordIdentityFragment['whoAmI']) => {\n setCurrentRecord(newRecord);\n\n if (onCreateAndEdit && clickedSubmitButton === 'createAndEdit') {\n setFormId(editionFormId ?? 'edition');\n setIsCreation(false);\n onCreateAndEdit(newRecord);\n return;\n }\n\n if (onCreate && clickedSubmitButton === 'create') {\n onCreate(newRecord);\n return;\n }\n };\n\n return (\n <>\n {showHeader && (\n <>\n <Header>\n {title !== undefined ? (\n title\n ) : (\n <KitTypography.Title level=\"h2\" style={{margin: 0}}>\n {currentRecord?.label ?? t('record_edition.new_record')}\n </KitTypography.Title>\n )}\n <div\n id={EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS}\n data-testid={EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS}\n />\n <KitButton onClick={_handleClose} icon={<FontAwesomeIcon icon={faXmark} />}>\n {closeButtonLabel}\n </KitButton>\n <KitSpace>{displayedSubmitButtons}</KitSpace>\n </Header>\n <KitDivider noMargin color=\"lightGrey\" />\n </>\n )}\n {isSubmitButtonsPortal &&\n formCreateButtonsContainer &&\n createPortal(displayedSubmitButtons, formCreateButtonsContainer)}\n <EditRecord\n antdForm={antdForm}\n formId={formId}\n isFormCreationMode={isCreation}\n formElementId={formElementId.current}\n record={currentRecord}\n library={library}\n valuesVersion={valuesVersion}\n onCreate={_handleCreate}\n containerStyle={showHeader ? {height: 'calc(100% - 82px)'} : {height: '100%'}}\n withInfoButton={withInfoButton}\n enableSidebar={enableSidebar}\n showSidebar={showSidebar}\n sidebarContainer={sidebarContainer}\n removePadding={removePadding}\n />\n </>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"EditRecordPage.js","sourceRoot":"","sources":["../../../../src/components/RecordEdition/EditRecordPage/EditRecordPage.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyC,SAAS,EAAW,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACnG,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACrF,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAA8B,uBAAuB,EAAE,sBAAsB,EAAC,MAAM,eAAe,CAAC;AAC3G,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAEzC,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,0CAA0C,EAAC,MAAM,cAAc,CAAC;AACxE,OAAO,EAAC,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,qBAAqB;gBAClB,0BAA0B;gBAC1B,YAAY,CAAC,sBAAsB,EAAE,0BAA0B,CAAC,EACpE,MAAC,aAAa,eACT,OAAO,IAAI,KAAC,cAAc,KAAG,EAC7B,CAAC,OAAO,IAAI,KAAC,SAAS,KAAG,EACzB,OAAO,IAAI,CACR,KAAC,UAAU,IACP,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,UAAU,EAC9B,aAAa,EAAE,aAAa,CAAC,OAAO,EACpC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,aAAa,EACvB,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,mBAAmB,EAAC,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,MAAM,EAAC,EAC7E,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,8BAA8B,EAAE,8BAA8B,EAC9D,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,aAAa,GAC9B,CACL,IACW,IACjB,CACN,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type FunctionComponent, type ReactNode, useEffect, useMemo, useRef, useState} from 'react';\nimport {KitButton, KitDivider, KitLoader, KitSpace, KitTypography} from 'aristid-ds';\nimport styled from 'styled-components';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type IValueVersion} from '_ui/types';\nimport {type RecordIdentityFragment, useCreateRecordMutation, usePurgeRecordMutation} from '_ui/_gqlTypes';\nimport {EditRecord} from '../EditRecord';\nimport {type PossibleSubmitButtons, type SubmitButtonsName} from '../_types';\nimport {useGetSubmitButtons} from '../hooks/useGetSubmitButtons';\nimport {useForm} from 'antd/lib/form/Form';\nimport {useCreateCancelConfirm} from '../hooks/useCreateCancelConfirm';\nimport {EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS} from '../constants';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faXmark} from '@fortawesome/free-solid-svg-icons';\nimport {createPortal} from 'react-dom';\nimport {SUBMIT_BUTTONS_PORTAL} from '_ui/constants';\nimport {ErrorBoundary} from '_ui/components/ErrorBoundary';\nimport {ErrorComponent} from './ErrorComponent';\nimport {useGetInitialRecordValues} from './getInitialRecordValues';\n\ninterface IEditRecordPageProps {\n record: RecordIdentityFragment['whoAmI'] | null;\n creationFormId?: string;\n editionFormId?: string;\n library: string;\n title?: ReactNode;\n onCreate?: (newRecord: RecordIdentityFragment['whoAmI']) => void; // Called after submitting via the \"create\" button\n onCreateAndEdit?: (newRecord: RecordIdentityFragment['whoAmI']) => void; // Called after submitting via the \"create and edit\" button\n submitButtons?: PossibleSubmitButtons;\n valuesVersion?: IValueVersion;\n showRefreshButton?: boolean;\n showHeader?: boolean;\n withInfoButton?: boolean;\n onClose?: () => void;\n showSidebar?: boolean; // TODO: Should be removed when sidebar is fully removed from EditRecordPage\n enableSidebar?: boolean; // TODO: Should be removed when sidebar is fully removed from EditRecordPage\n sidebarContainer?: HTMLElement; // TODO: Should be removed when sidebar is fully removed from EditRecordPage\n forceDisableSidebarInAppStudio?: boolean; // TODO: Should be removed when sidebar is fully removed from EditRecordPage\n isSubmitButtonsPortal?: boolean;\n removePadding?: boolean;\n}\n\nconst Header = styled.div`\n grid-area: title;\n align-self: center;\n font-size: 1rem;\n padding: 16px 32px;\n height: 82px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n`;\n\nconst emptyFunction = () => null;\n\nexport const EditRecordPage: FunctionComponent<IEditRecordPageProps> = ({\n record,\n library,\n creationFormId,\n editionFormId,\n onCreate,\n onCreateAndEdit,\n valuesVersion,\n title,\n showHeader = true,\n submitButtons = ['create'],\n withInfoButton,\n onClose = emptyFunction,\n enableSidebar,\n showSidebar,\n sidebarContainer,\n forceDisableSidebarInAppStudio,\n isSubmitButtonsPortal = false,\n removePadding = false,\n}) => {\n const {t} = useSharedTranslation();\n const [currentRecord, setCurrentRecord] = useState<RecordIdentityFragment['whoAmI'] | null>(record);\n const clickedSubmitButton = useRef<SubmitButtonsName | null>(null);\n const formElementId = useRef(window.crypto.randomUUID());\n const [isCreation, setIsCreation] = useState(!record);\n const [isReady, setIsReady] = useState(!!record);\n const [isError, setIsError] = useState(false);\n const [createRecord] = useCreateRecordMutation();\n const [purgeRecordMutation] = usePurgeRecordMutation();\n const [formId, setFormId] = useState<string>(\n isCreation ? (creationFormId ?? 'creation') : (editionFormId ?? 'edition'),\n );\n const [formCreateButtonsContainer, setFormCreateButtonsContainer] = useState<HTMLElement>();\n\n useEffect(() => {\n if (isSubmitButtonsPortal) {\n const formCreateButtonsElement = document.getElementById(SUBMIT_BUTTONS_PORTAL);\n if (formCreateButtonsElement) {\n setFormCreateButtonsContainer(formCreateButtonsElement);\n }\n }\n }, []);\n\n useEffect(() => {\n const createEmptyRecordFunction = async () => {\n const values = useGetInitialRecordValues();\n const {data} = await createRecord({\n variables: {\n library,\n skipActivate: true,\n data: {values},\n },\n });\n const recordId = data?.createRecord.record?.id;\n setCurrentRecord(data?.createRecord.record.whoAmI ?? null);\n if (!recordId) {\n setIsError(true);\n return;\n }\n\n setIsReady(true);\n };\n\n if (isCreation && !isReady) {\n createEmptyRecordFunction();\n }\n }, []);\n\n const _handleClickSubmit = (button: SubmitButtonsName) => {\n clickedSubmitButton.current = button;\n };\n\n const _purgeRecordOnCreationCancel = () =>\n purgeRecordMutation({\n errorPolicy: 'ignore',\n variables: {\n libraryId: currentRecord?.library?.id,\n recordId: currentRecord?.id,\n },\n });\n\n const _closeAfterConfirm = async () => {\n if (currentRecord?.id && currentRecord?.library?.id) {\n _purgeRecordOnCreationCancel();\n }\n return onClose();\n };\n\n const showCancelConfirm = useCreateCancelConfirm(_closeAfterConfirm);\n\n const [antdForm] = useForm();\n\n const _handleClose = () => {\n if (isCreation) {\n if (antdForm.isFieldsTouched()) {\n return showCancelConfirm();\n } else {\n _purgeRecordOnCreationCancel();\n }\n }\n\n return onClose();\n };\n const closeButtonLabel = isCreation ? t('global.cancel') : t('global.close');\n\n const displayedSubmitButtons = useGetSubmitButtons(\n submitButtons,\n formElementId.current,\n isCreation,\n _handleClickSubmit,\n _handleClose,\n );\n\n const _handleCreate = (newRecord: RecordIdentityFragment['whoAmI']) => {\n setCurrentRecord(newRecord);\n\n if (onCreateAndEdit && clickedSubmitButton.current === 'createAndEdit') {\n setFormId(editionFormId ?? 'edition');\n setIsCreation(false);\n onCreateAndEdit(newRecord);\n return;\n }\n\n if (onCreate && clickedSubmitButton.current === 'create') {\n onCreate(newRecord);\n return;\n }\n };\n\n return (\n <>\n {showHeader && (\n <>\n <Header>\n {title !== undefined ? (\n title\n ) : (\n <KitTypography.Title level=\"h2\" style={{margin: 0}}>\n {currentRecord?.label ?? t('record_edition.new_record')}\n </KitTypography.Title>\n )}\n <div\n id={EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS}\n data-testid={EDIT_RECORD_MODAL_HEADER_CONTAINER_BUTTONS}\n />\n <KitButton onClick={_handleClose} icon={<FontAwesomeIcon icon={faXmark} />}>\n {closeButtonLabel}\n </KitButton>\n <KitSpace>{displayedSubmitButtons}</KitSpace>\n </Header>\n <KitDivider noMargin color=\"lightGrey\" />\n </>\n )}\n {isSubmitButtonsPortal &&\n formCreateButtonsContainer &&\n createPortal(displayedSubmitButtons, formCreateButtonsContainer)}\n <ErrorBoundary>\n {isError && <ErrorComponent />}\n {!isReady && <KitLoader />}\n {isReady && (\n <EditRecord\n antdForm={antdForm}\n formId={formId}\n isFormCreationMode={isCreation}\n formElementId={formElementId.current}\n record={currentRecord}\n library={library}\n valuesVersion={valuesVersion}\n onCreate={_handleCreate}\n containerStyle={showHeader ? {height: 'calc(100% - 82px)'} : {height: '100%'}}\n withInfoButton={withInfoButton}\n enableSidebar={enableSidebar}\n forceDisableSidebarInAppStudio={forceDisableSidebarInAppStudio}\n showSidebar={showSidebar}\n sidebarContainer={sidebarContainer}\n removePadding={removePadding}\n />\n )}\n </ErrorBoundary>\n </>\n );\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
|
|
2
|
+
// This file is released under LGPL V3
|
|
3
|
+
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
4
|
+
import { useEffect } from 'react';
|
|
5
|
+
export const ErrorComponent = () => {
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
throw new Error();
|
|
8
|
+
}, []);
|
|
9
|
+
return null;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=ErrorComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorComponent.js","sourceRoot":"","sources":["../../../../src/components/RecordEdition/EditRecordPage/ErrorComponent.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,SAAS,EAAC,MAAM,OAAO,CAAC;AAExD,MAAM,CAAC,MAAM,cAAc,GAAsB,GAAG,EAAE;IAClD,SAAS,CAAC,GAAG,EAAE;QACX,MAAM,IAAI,KAAK,EAAE,CAAC;IACtB,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type FunctionComponent, useEffect} from 'react';\n\nexport const ErrorComponent: FunctionComponent = () => {\n useEffect(() => {\n throw new Error();\n }, []);\n return null;\n};\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
|
|
2
|
+
// This file is released under LGPL V3
|
|
3
|
+
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
4
|
+
export const INITIAL_VALUES_QUERY_PARAMS = 'formInitialValues';
|
|
5
|
+
const removeFromQueryParams = (paramToRemove) => {
|
|
6
|
+
const searchParams = new URLSearchParams(location.search);
|
|
7
|
+
if (searchParams.get(paramToRemove)) {
|
|
8
|
+
searchParams.delete(paramToRemove);
|
|
9
|
+
const queryParams = searchParams.size > 0 ? `?${searchParams.toString()}` : '';
|
|
10
|
+
history.replaceState({}, '', `${location.pathname}${queryParams}`);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export const useGetInitialRecordValues = () => {
|
|
14
|
+
const searchParams = new URLSearchParams(location.search);
|
|
15
|
+
const decodedParams = decodeURIComponent(searchParams.get(INITIAL_VALUES_QUERY_PARAMS) ?? '{}');
|
|
16
|
+
let initialValues = null;
|
|
17
|
+
try {
|
|
18
|
+
initialValues = JSON.parse(decodedParams);
|
|
19
|
+
removeFromQueryParams(INITIAL_VALUES_QUERY_PARAMS);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
if (!initialValues || Object.keys(initialValues).length === 0) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
const values = [];
|
|
28
|
+
Object.keys(initialValues).forEach(attributeId => {
|
|
29
|
+
initialValues[attributeId].forEach(val => {
|
|
30
|
+
values.push({ attribute: attributeId, payload: val });
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
return values;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=getInitialRecordValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getInitialRecordValues.js","sourceRoot":"","sources":["../../../../src/components/RecordEdition/EditRecordPage/getInitialRecordValues.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,s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AAC,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QAC7C,aAAa,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACrC,MAAM,CAAC,IAAI,CAAC,EAAC,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,EAAC,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nexport const INITIAL_VALUES_QUERY_PARAMS = 'formInitialValues';\n\nconst removeFromQueryParams = (paramToRemove: string) => {\n const searchParams = new URLSearchParams(location.search);\n if (searchParams.get(paramToRemove)) {\n searchParams.delete(paramToRemove);\n const queryParams = searchParams.size > 0 ? `?${searchParams.toString()}` : '';\n history.replaceState({}, '', `${location.pathname}${queryParams}`);\n }\n};\n\nexport const useGetInitialRecordValues = () => {\n const searchParams = new URLSearchParams(location.search);\n const decodedParams = decodeURIComponent(searchParams.get(INITIAL_VALUES_QUERY_PARAMS) ?? '{}');\n let initialValues = null;\n try {\n initialValues = JSON.parse(decodedParams);\n removeFromQueryParams(INITIAL_VALUES_QUERY_PARAMS);\n } catch {\n return [];\n }\n\n if (!initialValues || Object.keys(initialValues).length === 0) {\n return [];\n }\n\n const values = [];\n Object.keys(initialValues).forEach(attributeId => {\n initialValues[attributeId].forEach(val => {\n values.push({attribute: attributeId, payload: val});\n });\n });\n\n return values;\n};\n"]}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { type FunctionComponent } from 'react';
|
|
2
|
-
import { type MetadataSubmitValueFunc } from '../EditRecordContent/_types';
|
|
3
2
|
interface IEditRecordSidebarProps {
|
|
4
|
-
onMetadataSubmit: MetadataSubmitValueFunc;
|
|
5
3
|
sidebarContainer?: HTMLElement;
|
|
6
4
|
}
|
|
7
5
|
export declare const EditRecordSidebar: FunctionComponent<IEditRecordSidebarProps>;
|
|
@@ -9,7 +9,6 @@ import ValuesVersions from './ValuesVersions';
|
|
|
9
9
|
import { createPortal } from 'react-dom';
|
|
10
10
|
import { EditRecordSidebarContentTypeMap } from '../editRecordReducer/editRecordReducer';
|
|
11
11
|
import { KitSidePanel } from 'aristid-ds';
|
|
12
|
-
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
13
12
|
import { EDIT_RECORD_SIDEBAR_ID } from '../../../constants';
|
|
14
13
|
import Breadcrumb from './Breacrumb';
|
|
15
14
|
import AttributeSummary from './AttributeSummary';
|
|
@@ -23,7 +22,7 @@ const StyledDivContentWrapper = styled.div `
|
|
|
23
22
|
gap: calc(var(--general-spacing-s) * 1px);
|
|
24
23
|
height: 100%;
|
|
25
24
|
`;
|
|
26
|
-
const _getRecordSidebarContent = (state
|
|
25
|
+
const _getRecordSidebarContent = (state) => {
|
|
27
26
|
// TODO: ValuesVersions should be removed or refactored later
|
|
28
27
|
switch (state.sidebarContent) {
|
|
29
28
|
case 'none':
|
|
@@ -44,15 +43,14 @@ const StyledKitSidePanel = styled(KitSidePanel) `
|
|
|
44
43
|
grid-area: sidebar;
|
|
45
44
|
display: ${({ $isOpen }) => ($isOpen ? 'block' : 'none')};
|
|
46
45
|
`;
|
|
47
|
-
export const EditRecordSidebar = ({
|
|
48
|
-
const { t } = useSharedTranslation();
|
|
46
|
+
export const EditRecordSidebar = ({ sidebarContainer }) => {
|
|
49
47
|
const { lang } = useLang();
|
|
50
48
|
const { state } = useEditRecordReducer();
|
|
51
49
|
const sidePanelRef = useRef(null);
|
|
52
|
-
const
|
|
53
|
-
? localizedTranslation(state.activeAttribute?.attribute.label, lang)
|
|
54
|
-
:
|
|
55
|
-
const editRecordSidebarContent = (_jsx(StyledKitSidePanel, { ref: sidePanelRef, initialOpen: state.isOpenSidebar && state.enableSidebar, idCardProps:
|
|
50
|
+
const idCardProps = state.sidebarContent === EditRecordSidebarContentTypeMap.VALUE_DETAILS
|
|
51
|
+
? { title: localizedTranslation(state.activeAttribute?.attribute.label, lang) }
|
|
52
|
+
: undefined;
|
|
53
|
+
const editRecordSidebarContent = (_jsx(StyledKitSidePanel, { ref: sidePanelRef, initialOpen: state.isOpenSidebar && state.enableSidebar, idCardProps: idCardProps, id: EDIT_RECORD_SIDEBAR_ID, headerExtra: _jsx(Breadcrumb, {}), "$hideBoxShadow": !sidebarContainer, "$isOpen": state.isOpenSidebar, children: _getRecordSidebarContent(state) }));
|
|
56
54
|
useEffect(() => {
|
|
57
55
|
if (sidePanelRef.current && state.enableSidebar) {
|
|
58
56
|
if (state.isOpenSidebar) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditRecordSidebar.js","sourceRoot":"","sources":["../../../../src/components/RecordEdition/EditRecordSidebar/EditRecordSidebar.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,SAAS,
|
|
1
|
+
{"version":3,"file":"EditRecordSidebar.js","sourceRoot":"","sources":["../../../../src/components/RecordEdition/EditRecordSidebar/EditRecordSidebar.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,SAAS,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAChE,OAAO,EAAC,oBAAoB,EAAC,MAAM,2CAA2C,CAAC;AAC/E,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,EAAC,+BAA+B,EAA+B,MAAM,wCAAwC,CAAC;AACrH,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,OAAO,EAAC,sBAAsB,EAAC,MAAM,eAAe,CAAC;AACrD,OAAO,UAAU,MAAM,aAAa,CAAC;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,CAAC;IAED,OAAO,gBAAgB,KAAK,SAAS;QACjC,CAAC,CAAC,wBAAwB;QAC1B,CAAC,CAAC,YAAY,CAAC,wBAAwB,EAAE,gBAAgB,CAAC,CAAC;AACnE,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type FunctionComponent, useEffect, useRef} from 'react';\nimport {useEditRecordReducer} from '../editRecordReducer/useEditRecordReducer';\nimport RecordSummary from './RecordSummary';\nimport ValuesVersions from './ValuesVersions';\nimport {createPortal} from 'react-dom';\nimport {EditRecordSidebarContentTypeMap, type IEditRecordReducerState} from '../editRecordReducer/editRecordReducer';\nimport {KitSidePanel} from 'aristid-ds';\nimport {type KitSidePanelRef} from 'aristid-ds/dist/Kit/Navigation/SidePanel/types';\nimport {EDIT_RECORD_SIDEBAR_ID} from '_ui/constants';\nimport Breadcrumb from './Breacrumb';\nimport AttributeSummary from './AttributeSummary';\nimport ValuesSummary from './ValuesSummary';\nimport styled from 'styled-components';\nimport {useLang} from '_ui/hooks';\nimport {localizedTranslation} from '@leav/utils';\n\ninterface IEditRecordSidebarProps {\n sidebarContainer?: HTMLElement;\n}\n\nconst StyledDivContentWrapper = styled.div`\n display: flex;\n flex-direction: column;\n gap: calc(var(--general-spacing-s) * 1px);\n height: 100%;\n`;\n\nconst _getRecordSidebarContent = (state: IEditRecordReducerState) => {\n // TODO: ValuesVersions should be removed or refactored later\n switch (state.sidebarContent) {\n case 'none':\n return null;\n case 'valueDetails':\n return (\n <StyledDivContentWrapper>\n <AttributeSummary attribute={state.activeAttribute.attribute} />\n <ValuesSummary\n record={state.record}\n attributeId={state.activeAttribute.attribute.id}\n globalValues={state.activeAttribute.globalValues}\n calculatedValues={state.activeAttribute.calculatedValues}\n />\n </StyledDivContentWrapper>\n );\n case 'valuesVersions':\n return <ValuesVersions />;\n default:\n return <RecordSummary record={state.record} />;\n }\n};\n\nconst StyledKitSidePanel = styled(KitSidePanel)<{$hideBoxShadow: boolean; $isOpen: boolean}>`\n ${({$hideBoxShadow}) =>\n $hideBoxShadow &&\n `&&& section {\n box-shadow: none;\n }`}\n grid-area: sidebar;\n display: ${({$isOpen}) => ($isOpen ? 'block' : 'none')};\n`;\n\nexport const EditRecordSidebar: FunctionComponent<IEditRecordSidebarProps> = ({sidebarContainer}) => {\n const {lang} = useLang();\n const {state} = useEditRecordReducer();\n const sidePanelRef = useRef<KitSidePanelRef | null>(null);\n const idCardProps =\n state.sidebarContent === EditRecordSidebarContentTypeMap.VALUE_DETAILS\n ? {title: localizedTranslation(state.activeAttribute?.attribute.label, lang)}\n : undefined;\n\n const editRecordSidebarContent = (\n <StyledKitSidePanel\n ref={sidePanelRef}\n initialOpen={state.isOpenSidebar && state.enableSidebar}\n idCardProps={idCardProps}\n id={EDIT_RECORD_SIDEBAR_ID}\n headerExtra={<Breadcrumb />}\n $hideBoxShadow={!sidebarContainer}\n $isOpen={state.isOpenSidebar}\n >\n {_getRecordSidebarContent(state)}\n </StyledKitSidePanel>\n );\n\n useEffect(() => {\n if (sidePanelRef.current && state.enableSidebar) {\n if (state.isOpenSidebar) {\n sidePanelRef.current.open();\n } else {\n sidePanelRef.current.close();\n }\n }\n }, [state.enableSidebar, state.isOpenSidebar, sidePanelRef.current]);\n\n if (!state.enableSidebar) {\n return null;\n }\n\n return sidebarContainer === undefined\n ? editRecordSidebarContent\n : createPortal(editRecordSidebarContent, sidebarContainer);\n};\n\nexport default EditRecordSidebar;\n"]}
|
|
@@ -1,43 +1,12 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
|
|
3
|
-
// This file is released under LGPL V3
|
|
4
|
-
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
5
|
-
import { useState } from 'react';
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
2
|
import styled from 'styled-components';
|
|
7
|
-
import { KitButton, KitTooltip } from 'aristid-ds';
|
|
8
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
9
|
-
import { faExpand } from '@fortawesome/free-solid-svg-icons';
|
|
10
3
|
import PropertiesList from '../../PropertiesList';
|
|
11
|
-
import { useSharedTranslation } from '../../../../../hooks/useSharedTranslation';
|
|
12
4
|
import { useRecordInformations } from './useRecordInformations';
|
|
13
|
-
import FileModal from '../../../../../components/RecordPreviewWithModal/FileModal';
|
|
14
|
-
import { EntityPreview } from '../../../../../components/EntityPreview';
|
|
15
|
-
import { TOOLTIP_DEFAULT_DELAY_IN_SECONDS } from '../../../../../constants';
|
|
16
5
|
const InformationsWrapper = styled.div `
|
|
17
6
|
margin-top: calc(var(--general-spacing-s) * 1px);
|
|
18
7
|
`;
|
|
19
|
-
const PreviewWrapper = styled.div `
|
|
20
|
-
position: relative;
|
|
21
|
-
width: 100%;
|
|
22
|
-
height: 162px;
|
|
23
|
-
background-color: var(--general-colors-primary-50);
|
|
24
|
-
border-radius: calc(var(--general-border-radius-s) * 1px);
|
|
25
|
-
padding: calc(var(--general-spacing-xs) * 1px);
|
|
26
|
-
`;
|
|
27
|
-
const ExpandImageButton = styled(KitButton) `
|
|
28
|
-
position: absolute;
|
|
29
|
-
right: 0;
|
|
30
|
-
top: 0;
|
|
31
|
-
`;
|
|
32
|
-
const ContentWrapper = styled.div `
|
|
33
|
-
margin-top: calc(var(--general-spacing-s) * 1px);
|
|
34
|
-
`;
|
|
35
8
|
export const RecordInformations = ({ record, recordData }) => {
|
|
36
|
-
const { t } = useSharedTranslation();
|
|
37
9
|
const recordInformations = useRecordInformations(record, recordData);
|
|
38
|
-
|
|
39
|
-
const previewFile = record?.preview?.file;
|
|
40
|
-
const preview = record?.preview?.medium ? String(record?.preview?.medium) : null;
|
|
41
|
-
return (_jsxs(InformationsWrapper, { children: [_jsxs(PreviewWrapper, { children: [_jsx(EntityPreview, { label: record?.label ?? record?.id, color: record?.color, image: preview, imageStyle: { border: 'none' }, placeholderStyle: { height: '100%', width: 'fit-content', margin: 'auto', borderRadius: '0' }, style: { height: '100%', background: 'initial' }, tile: true }), previewFile !== undefined && (_jsx(KitTooltip, { title: t('record_summary.open_preview_modal'), mouseEnterDelay: TOOLTIP_DEFAULT_DELAY_IN_SECONDS, children: _jsx(ExpandImageButton, { "aria-label": t('record_summary.open_preview_modal'), type: "tertiary", icon: _jsx(FontAwesomeIcon, { icon: faExpand }), onClick: () => setFilePreviewModalOpen(true) }) }))] }), isFilePreviewModalOpen && (_jsx(FileModal, { open: isFilePreviewModalOpen, fileId: previewFile?.id, libraryId: previewFile?.library, onClose: () => setFilePreviewModalOpen(false) })), _jsx(ContentWrapper, { children: _jsx(PropertiesList, { items: recordInformations }) })] }));
|
|
10
|
+
return (_jsx(InformationsWrapper, { children: _jsx(PropertiesList, { items: recordInformations }) }));
|
|
42
11
|
};
|
|
43
12
|
//# sourceMappingURL=RecordInformations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordInformations.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"RecordInformations.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.tsx"],"names":[],"mappings":";AAMA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAO9D,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAErC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAA0C,CAAC,EAAC,MAAM,EAAE,UAAU,EAAC,EAAE,EAAE;IAC9F,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAErE,OAAO,CACH,KAAC,mBAAmB,cAChB,KAAC,cAAc,IAAC,KAAK,EAAE,kBAAkB,GAAI,GAC3B,CACzB,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type FunctionComponent} from 'react';\nimport {type IRecordIdentityWhoAmI} from '_ui/types';\nimport {type GetRecordColumnsValuesRecord} from '_ui/_queries/records/getRecordColumnsValues';\nimport styled from 'styled-components';\nimport PropertiesList from '../../PropertiesList';\nimport {useRecordInformations} from './useRecordInformations';\n\ninterface IInformationsProps {\n record: IRecordIdentityWhoAmI;\n recordData: GetRecordColumnsValuesRecord;\n}\n\nconst InformationsWrapper = styled.div`\n margin-top: calc(var(--general-spacing-s) * 1px);\n`;\n\nexport const RecordInformations: FunctionComponent<IInformationsProps> = ({record, recordData}) => {\n const recordInformations = useRecordInformations(record, recordData);\n\n return (\n <InformationsWrapper>\n <PropertiesList items={recordInformations} />\n </InformationsWrapper>\n );\n};\n"]}
|