@leav/ui 0.4.0-049caba → 0.4.0-083a2b3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__mocks__/common/value.d.ts +1 -2
- package/dist/__mocks__/common/value.js +0 -11
- package/dist/__mocks__/common/value.js.map +1 -1
- package/dist/components/Explorer/DataView.js +10 -3
- package/dist/components/Explorer/DataView.js.map +1 -1
- package/dist/components/Explorer/Explorer.js +2 -0
- package/dist/components/Explorer/Explorer.js.map +1 -1
- package/dist/components/Explorer/TableTagGroup.d.ts +0 -1
- package/dist/components/Explorer/TableTagGroup.js +3 -16
- package/dist/components/Explorer/TableTagGroup.js.map +1 -1
- package/dist/components/Explorer/_constants.d.ts +3 -0
- package/dist/components/Explorer/_constants.js +3 -0
- package/dist/components/Explorer/_constants.js.map +1 -1
- package/dist/components/Explorer/actions-item/useEditItemAction.js +2 -1
- package/dist/components/Explorer/actions-item/useEditItemAction.js.map +1 -1
- package/dist/components/Explorer/actions-item/useReplaceItemAction.js +1 -1
- package/dist/components/Explorer/actions-item/useReplaceItemAction.js.map +1 -1
- package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js +3 -3
- package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js.map +1 -1
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js +2 -1
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js.map +1 -1
- package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.d.ts +4 -2
- package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js +19 -3
- package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js.map +1 -1
- package/dist/components/Explorer/link-item/LinkModal.js +2 -1
- package/dist/components/Explorer/link-item/LinkModal.js.map +1 -1
- package/dist/components/Explorer/useViewSettingsReducer.js +9 -6
- package/dist/components/Explorer/useViewSettingsReducer.js.map +1 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/typeGuards.d.ts +4 -0
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/typeGuards.js +4 -1
- package/dist/components/LibraryItemsList/LibraryItemsListTable/Cell/typeGuards.js.map +1 -1
- package/dist/components/RecordEdition/EditRecord/EditRecord.d.ts +1 -0
- package/dist/components/RecordEdition/EditRecord/EditRecord.js +24 -13
- package/dist/components/RecordEdition/EditRecord/EditRecord.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.d.ts +3 -1
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js +3 -3
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/_types.d.ts +5 -0
- package/dist/components/RecordEdition/EditRecordContent/_types.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.d.ts +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.js +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.d.ts +7 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js +100 -92
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useEditRecord.d.ts +5 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useEditRecord.js +39 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useEditRecord.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useUnselectRecord.d.ts +8 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useUnselectRecord.js +23 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useUnselectRecord.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-mass/useUnselectAllRecords.d.ts +9 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-mass/useUnselectAllRecords.js +23 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-mass/useUnselectAllRecords.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useCreateRecord.d.ts +8 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useCreateRecord.js +26 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useCreateRecord.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useRecordSelector.d.ts +12 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useRecordSelector.js +24 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useRecordSelector.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecords.d.ts +19 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecords.js +103 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecords.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.d.ts +22 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.js +104 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecords.d.ts +22 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecords.js +85 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecords.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.d.ts +26 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.js +106 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.d.ts +265 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.js +12 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/LinkActionsButtons.d.ts +9 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/LinkActionsButtons.js +15 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/LinkActionsButtons.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/utils.d.ts +4 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/utils.js +22 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/utils.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +32 -46
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.js +1 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSBooleanWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSColorPickerWrapper.js +1 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSColorPickerWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.js +1 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSDatePickerWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputEncryptedWrapper.js +2 -5
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputEncryptedWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.js +1 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputNumberWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.js +1 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSInputWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.js +1 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRangePickerWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.js +1 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/DSRichTextWrapper.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.d.ts +2 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.js +2 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/StandardFieldValue.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/DSListSelect.js +2 -5
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/DSListSelect.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/_types.d.ts +1 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/{StandardField → shared}/ComputeIndicator.d.ts +4 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/DeleteAllValuesButton.d.ts +8 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/{StandardField → shared}/DeleteAllValuesButton.js +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/DeleteAllValuesButton.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/calculatedInheritedFlags.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/useOutsideInteractionDetector.d.ts +17 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/useOutsideInteractionDetector.js +76 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/useOutsideInteractionDetector.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.d.ts +1 -0
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js +5 -3
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.js +4 -2
- package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js +3 -0
- package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js.map +1 -1
- package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.d.ts +2 -2
- package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.js +22 -3
- 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 +3 -3
- package/dist/components/RecordEdition/hooks/useGetSubmitButtons.js.map +1 -1
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.d.ts +1 -0
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js +3 -3
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js.map +1 -1
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +2 -1
- package/dist/constants.js.map +1 -1
- package/dist/locales/en/shared.json +2 -1
- package/dist/locales/fr/shared.json +2 -1
- package/package.json +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/FloatingMenuHandler/FloatingMenuHandler.d.ts +0 -14
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/FloatingMenuHandler/FloatingMenuHandler.js +0 -29
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/FloatingMenuHandler/FloatingMenuHandler.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/FloatingMenuHandler/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/FloatingMenuHandler/index.js +0 -6
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/FloatingMenuHandler/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/MonoValueSelect.d.ts +0 -20
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/MonoValueSelect.js +0 -53
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/MonoValueSelect.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/useGetOptionsQuery.d.ts +0 -19
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/useGetOptionsQuery.js +0 -111
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MonoValueSelect/useGetOptionsQuery.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/MultiValueSelect.d.ts +0 -20
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/MultiValueSelect.js +0 -71
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/MultiValueSelect.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/useGetOptionsQuery.d.ts +0 -14
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/useGetOptionsQuery.js +0 -58
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/MultiValueSelect/useGetOptionsQuery.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/RecordIdentityCell/RecordIdentityCell.d.ts +0 -6
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/RecordIdentityCell/RecordIdentityCell.js +0 -11
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/RecordIdentityCell/RecordIdentityCell.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/RecordIdentityCell/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/RecordIdentityCell/index.js +0 -6
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/RecordIdentityCell/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/QuickSearch/QuickSearch.d.ts +0 -13
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/QuickSearch/QuickSearch.js +0 -50
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/QuickSearch/QuickSearch.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/QuickSearch/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/QuickSearch/index.js +0 -6
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/QuickSearch/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/ValuesAdd.d.ts +0 -9
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/ValuesAdd.js +0 -215
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/ValuesAdd.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/index.js +0 -6
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/ValuesAdd/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/ComputeIndicator.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/DeleteAllValuesButton.d.ts +0 -4
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/DeleteAllValuesButton.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/calculatedInheritedFlags.js.map +0 -1
- /package/dist/components/RecordEdition/EditRecordContent/uiElements/{StandardField → shared}/ComputeIndicator.js +0 -0
- /package/dist/components/RecordEdition/EditRecordContent/uiElements/{StandardField → shared}/calculatedInheritedFlags.d.ts +0 -0
- /package/dist/components/RecordEdition/EditRecordContent/uiElements/{StandardField → shared}/calculatedInheritedFlags.js +0 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
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 { Explorer } from '../../../../../../components/Explorer';
|
|
6
|
+
import { useEffect, useState } from 'react';
|
|
7
|
+
import { FaList } from 'react-icons/fa';
|
|
8
|
+
import { useSharedTranslation } from '../../../../../../hooks/useSharedTranslation';
|
|
9
|
+
import { ExplorerWrapper } from '../shared/ExplorerWrapper';
|
|
10
|
+
import { LinkActionsButtons } from '../shared/LinkActionsButtons';
|
|
11
|
+
import { DeleteAllValuesButton } from '../../shared/DeleteAllValuesButton';
|
|
12
|
+
import { AntForm } from 'aristid-ds';
|
|
13
|
+
import { EditRecordReducerActionsTypes } from '../../../../../../components/RecordEdition/editRecordReducer/editRecordReducer';
|
|
14
|
+
import { useLinkRecords } from './useLinkRecords';
|
|
15
|
+
const _shouldUpdateExplorerActions = (ref, explorerActions) => ref?.createAction?.disabled !== explorerActions?.createAction?.disabled ||
|
|
16
|
+
ref?.linkAction?.disabled !== explorerActions?.linkAction?.disabled ||
|
|
17
|
+
ref?.totalCount !== explorerActions?.totalCount;
|
|
18
|
+
export const useLinkRecordsInEdition = ({ libraryId, recordId, attribute, columnsToDisplay, backendValues, setBackendValues, activeAttribute, dispatch, isHookUsed, isReadOnly, isFieldInError, hasNoValue, onDeleteMultipleValues }) => {
|
|
19
|
+
const { t } = useSharedTranslation();
|
|
20
|
+
const [explorerActions, setExplorerActions] = useState(null);
|
|
21
|
+
const form = AntForm.useFormInstance();
|
|
22
|
+
const { handleDeleteAllValues, handleExplorerCreateValue, handleExplorerLinkValue, handleExplorerMassDeactivateValues, handleExplorerRemoveValue } = useLinkRecords({
|
|
23
|
+
attribute,
|
|
24
|
+
backendValues,
|
|
25
|
+
setBackendValues,
|
|
26
|
+
onDeleteMultipleValues
|
|
27
|
+
});
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (isHookUsed && backendValues.length === 0 && attribute.required) {
|
|
30
|
+
// Set field in error when LinkField is displayed for the first time. Otherwise, errors will be handled by _removeValues() or _handleExplorerLinkValue()
|
|
31
|
+
form.setFields([
|
|
32
|
+
{
|
|
33
|
+
name: attribute.id,
|
|
34
|
+
errors: [t('errors.standard_field_required')]
|
|
35
|
+
}
|
|
36
|
+
]);
|
|
37
|
+
}
|
|
38
|
+
}, []);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (isHookUsed && activeAttribute?.attribute.id === attribute.id) {
|
|
41
|
+
// Update active value used in the sidebar when backendValues change
|
|
42
|
+
dispatch({
|
|
43
|
+
type: EditRecordReducerActionsTypes.SET_ACTIVE_VALUE,
|
|
44
|
+
values: backendValues
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}, [backendValues]);
|
|
48
|
+
const _handleExplorerRef = (ref) => {
|
|
49
|
+
if (_shouldUpdateExplorerActions(ref, explorerActions)) {
|
|
50
|
+
setExplorerActions({
|
|
51
|
+
createAction: ref?.createAction,
|
|
52
|
+
linkAction: ref?.linkAction,
|
|
53
|
+
totalCount: ref?.totalCount
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const _getExplorerItemActions = () => {
|
|
58
|
+
if (isReadOnly) {
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
if (!attribute.multiple_values ||
|
|
62
|
+
attribute.required ||
|
|
63
|
+
(attribute.multiple_values && backendValues.length === 1 && attribute.required)) {
|
|
64
|
+
return ['edit'];
|
|
65
|
+
}
|
|
66
|
+
return ['edit', 'remove'];
|
|
67
|
+
};
|
|
68
|
+
return {
|
|
69
|
+
UnlinkAllRecordsInEdition: isHookUsed &&
|
|
70
|
+
backendValues.length > 1 &&
|
|
71
|
+
attribute.multiple_values &&
|
|
72
|
+
!attribute.required && (_jsx(DeleteAllValuesButton, { handleDelete: handleDeleteAllValues, disabled: isReadOnly, danger: isFieldInError })),
|
|
73
|
+
LinkRecordsInEditionExplorer: isHookUsed && recordId && (_jsxs(_Fragment, { children: [_jsx(ExplorerWrapper, { children: _jsx(Explorer, { ref: _handleExplorerRef, defaultViewSettings: {
|
|
74
|
+
attributesIds: columnsToDisplay
|
|
75
|
+
}, entrypoint: {
|
|
76
|
+
type: 'link',
|
|
77
|
+
parentLibraryId: libraryId,
|
|
78
|
+
parentRecordId: recordId,
|
|
79
|
+
linkAttributeId: attribute.id
|
|
80
|
+
}, defaultCallbacks: {
|
|
81
|
+
item: {
|
|
82
|
+
remove: handleExplorerRemoveValue
|
|
83
|
+
},
|
|
84
|
+
mass: {
|
|
85
|
+
deactivate: handleExplorerMassDeactivateValues
|
|
86
|
+
},
|
|
87
|
+
primary: {
|
|
88
|
+
link: handleExplorerLinkValue,
|
|
89
|
+
create: handleExplorerCreateValue
|
|
90
|
+
}
|
|
91
|
+
}, showTitle: false, showSearch: false, selectionMode: attribute.multiple_values ? 'multiple' : 'simple', disableSelection: isReadOnly ||
|
|
92
|
+
!attribute.multiple_values ||
|
|
93
|
+
(attribute.required && attribute.multiple_values && backendValues.length === 1), defaultActionsForItem: _getExplorerItemActions(), hidePrimaryActions: true, hideTableHeader: true, iconsOnlyItemActions: true }) }), _jsx(LinkActionsButtons, { createButtonProps: {
|
|
94
|
+
icon: explorerActions?.createAction?.icon,
|
|
95
|
+
label: explorerActions?.createAction?.label,
|
|
96
|
+
callback: explorerActions?.createAction?.callback,
|
|
97
|
+
disabled: isReadOnly || explorerActions?.createAction?.disabled
|
|
98
|
+
}, linkButtonProps: {
|
|
99
|
+
icon: _jsx(FaList, {}),
|
|
100
|
+
label: explorerActions?.linkAction?.label,
|
|
101
|
+
callback: explorerActions?.linkAction?.callback,
|
|
102
|
+
disabled: isReadOnly || (attribute.multiple_values && explorerActions?.linkAction?.disabled)
|
|
103
|
+
}, hasNoValue: hasNoValue })] }))
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
//# sourceMappingURL=useLinkRecordsInEdition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLinkRecordsInEdition.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
export declare const ExplorerWrapper: import("styled-components").IStyledComponent<"web", {
|
|
2
|
+
ref?: import("react").LegacyRef<HTMLDivElement>;
|
|
3
|
+
key?: import("react").Key | null | undefined;
|
|
4
|
+
defaultChecked?: boolean | undefined;
|
|
5
|
+
defaultValue?: string | number | ReadonlyArray<string> | undefined;
|
|
6
|
+
suppressContentEditableWarning?: boolean | undefined;
|
|
7
|
+
suppressHydrationWarning?: boolean | undefined;
|
|
8
|
+
accessKey?: string | undefined;
|
|
9
|
+
autoFocus?: boolean | undefined;
|
|
10
|
+
className?: string | undefined;
|
|
11
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
|
|
12
|
+
contextMenu?: string | undefined;
|
|
13
|
+
dir?: string | undefined;
|
|
14
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
15
|
+
hidden?: boolean | undefined;
|
|
16
|
+
id?: string | undefined;
|
|
17
|
+
lang?: string | undefined;
|
|
18
|
+
nonce?: string | undefined;
|
|
19
|
+
placeholder?: string | undefined;
|
|
20
|
+
slot?: string | undefined;
|
|
21
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
22
|
+
style?: import("react").CSSProperties | undefined;
|
|
23
|
+
tabIndex?: number | undefined;
|
|
24
|
+
title?: string | undefined;
|
|
25
|
+
translate?: "yes" | "no" | undefined;
|
|
26
|
+
radioGroup?: string | undefined;
|
|
27
|
+
role?: import("react").AriaRole | undefined;
|
|
28
|
+
about?: string | undefined;
|
|
29
|
+
content?: string | undefined;
|
|
30
|
+
datatype?: string | undefined;
|
|
31
|
+
inlist?: any;
|
|
32
|
+
prefix?: string | undefined;
|
|
33
|
+
property?: string | undefined;
|
|
34
|
+
rel?: string | undefined;
|
|
35
|
+
resource?: string | undefined;
|
|
36
|
+
rev?: string | undefined;
|
|
37
|
+
typeof?: string | undefined;
|
|
38
|
+
vocab?: string | undefined;
|
|
39
|
+
autoCapitalize?: string | undefined;
|
|
40
|
+
autoCorrect?: string | undefined;
|
|
41
|
+
autoSave?: string | undefined;
|
|
42
|
+
color?: string | undefined;
|
|
43
|
+
itemProp?: string | undefined;
|
|
44
|
+
itemScope?: boolean | undefined;
|
|
45
|
+
itemType?: string | undefined;
|
|
46
|
+
itemID?: string | undefined;
|
|
47
|
+
itemRef?: string | undefined;
|
|
48
|
+
results?: number | undefined;
|
|
49
|
+
security?: string | undefined;
|
|
50
|
+
unselectable?: "on" | "off" | undefined;
|
|
51
|
+
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
|
52
|
+
is?: string | undefined;
|
|
53
|
+
children?: import("react").ReactNode;
|
|
54
|
+
'aria-activedescendant'?: string | undefined;
|
|
55
|
+
'aria-atomic'?: boolean | "false" | "true" | undefined;
|
|
56
|
+
'aria-autocomplete'?: "none" | "inline" | "list" | "both" | undefined;
|
|
57
|
+
'aria-busy'?: boolean | "false" | "true" | undefined;
|
|
58
|
+
'aria-checked'?: boolean | "false" | "mixed" | "true" | undefined;
|
|
59
|
+
'aria-colcount'?: number | undefined;
|
|
60
|
+
'aria-colindex'?: number | undefined;
|
|
61
|
+
'aria-colspan'?: number | undefined;
|
|
62
|
+
'aria-controls'?: string | undefined;
|
|
63
|
+
'aria-current'?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
|
|
64
|
+
'aria-describedby'?: string | undefined;
|
|
65
|
+
'aria-details'?: string | undefined;
|
|
66
|
+
'aria-disabled'?: boolean | "false" | "true" | undefined;
|
|
67
|
+
'aria-dropeffect'?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
|
|
68
|
+
'aria-errormessage'?: string | undefined;
|
|
69
|
+
'aria-expanded'?: boolean | "false" | "true" | undefined;
|
|
70
|
+
'aria-flowto'?: string | undefined;
|
|
71
|
+
'aria-grabbed'?: boolean | "false" | "true" | undefined;
|
|
72
|
+
'aria-haspopup'?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
|
|
73
|
+
'aria-hidden'?: boolean | "false" | "true" | undefined;
|
|
74
|
+
'aria-invalid'?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
|
|
75
|
+
'aria-keyshortcuts'?: string | undefined;
|
|
76
|
+
'aria-label'?: string | undefined;
|
|
77
|
+
'aria-labelledby'?: string | undefined;
|
|
78
|
+
'aria-level'?: number | undefined;
|
|
79
|
+
'aria-live'?: "off" | "assertive" | "polite" | undefined;
|
|
80
|
+
'aria-modal'?: boolean | "false" | "true" | undefined;
|
|
81
|
+
'aria-multiline'?: boolean | "false" | "true" | undefined;
|
|
82
|
+
'aria-multiselectable'?: boolean | "false" | "true" | undefined;
|
|
83
|
+
'aria-orientation'?: "horizontal" | "vertical" | undefined;
|
|
84
|
+
'aria-owns'?: string | undefined;
|
|
85
|
+
'aria-placeholder'?: string | undefined;
|
|
86
|
+
'aria-posinset'?: number | undefined;
|
|
87
|
+
'aria-pressed'?: boolean | "false" | "mixed" | "true" | undefined;
|
|
88
|
+
'aria-readonly'?: boolean | "false" | "true" | undefined;
|
|
89
|
+
'aria-relevant'?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
|
|
90
|
+
'aria-required'?: boolean | "false" | "true" | undefined;
|
|
91
|
+
'aria-roledescription'?: string | undefined;
|
|
92
|
+
'aria-rowcount'?: number | undefined;
|
|
93
|
+
'aria-rowindex'?: number | undefined;
|
|
94
|
+
'aria-rowspan'?: number | undefined;
|
|
95
|
+
'aria-selected'?: boolean | "false" | "true" | undefined;
|
|
96
|
+
'aria-setsize'?: number | undefined;
|
|
97
|
+
'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
98
|
+
'aria-valuemax'?: number | undefined;
|
|
99
|
+
'aria-valuemin'?: number | undefined;
|
|
100
|
+
'aria-valuenow'?: number | undefined;
|
|
101
|
+
'aria-valuetext'?: string | undefined;
|
|
102
|
+
dangerouslySetInnerHTML?: {
|
|
103
|
+
__html: string | TrustedHTML;
|
|
104
|
+
} | undefined;
|
|
105
|
+
onCopy?: import("react").ClipboardEventHandler<HTMLDivElement>;
|
|
106
|
+
onCopyCapture?: import("react").ClipboardEventHandler<HTMLDivElement>;
|
|
107
|
+
onCut?: import("react").ClipboardEventHandler<HTMLDivElement>;
|
|
108
|
+
onCutCapture?: import("react").ClipboardEventHandler<HTMLDivElement>;
|
|
109
|
+
onPaste?: import("react").ClipboardEventHandler<HTMLDivElement>;
|
|
110
|
+
onPasteCapture?: import("react").ClipboardEventHandler<HTMLDivElement>;
|
|
111
|
+
onCompositionEnd?: import("react").CompositionEventHandler<HTMLDivElement>;
|
|
112
|
+
onCompositionEndCapture?: import("react").CompositionEventHandler<HTMLDivElement>;
|
|
113
|
+
onCompositionStart?: import("react").CompositionEventHandler<HTMLDivElement>;
|
|
114
|
+
onCompositionStartCapture?: import("react").CompositionEventHandler<HTMLDivElement>;
|
|
115
|
+
onCompositionUpdate?: import("react").CompositionEventHandler<HTMLDivElement>;
|
|
116
|
+
onCompositionUpdateCapture?: import("react").CompositionEventHandler<HTMLDivElement>;
|
|
117
|
+
onFocus?: import("react").FocusEventHandler<HTMLDivElement>;
|
|
118
|
+
onFocusCapture?: import("react").FocusEventHandler<HTMLDivElement>;
|
|
119
|
+
onBlur?: import("react").FocusEventHandler<HTMLDivElement>;
|
|
120
|
+
onBlurCapture?: import("react").FocusEventHandler<HTMLDivElement>;
|
|
121
|
+
onChange?: import("react").FormEventHandler<HTMLDivElement>;
|
|
122
|
+
onChangeCapture?: import("react").FormEventHandler<HTMLDivElement>;
|
|
123
|
+
onBeforeInput?: import("react").FormEventHandler<HTMLDivElement>;
|
|
124
|
+
onBeforeInputCapture?: import("react").FormEventHandler<HTMLDivElement>;
|
|
125
|
+
onInput?: import("react").FormEventHandler<HTMLDivElement>;
|
|
126
|
+
onInputCapture?: import("react").FormEventHandler<HTMLDivElement>;
|
|
127
|
+
onReset?: import("react").FormEventHandler<HTMLDivElement>;
|
|
128
|
+
onResetCapture?: import("react").FormEventHandler<HTMLDivElement>;
|
|
129
|
+
onSubmit?: import("react").FormEventHandler<HTMLDivElement>;
|
|
130
|
+
onSubmitCapture?: import("react").FormEventHandler<HTMLDivElement>;
|
|
131
|
+
onInvalid?: import("react").FormEventHandler<HTMLDivElement>;
|
|
132
|
+
onInvalidCapture?: import("react").FormEventHandler<HTMLDivElement>;
|
|
133
|
+
onLoad?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
134
|
+
onLoadCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
135
|
+
onError?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
136
|
+
onErrorCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
137
|
+
onKeyDown?: import("react").KeyboardEventHandler<HTMLDivElement>;
|
|
138
|
+
onKeyDownCapture?: import("react").KeyboardEventHandler<HTMLDivElement>;
|
|
139
|
+
onKeyPress?: import("react").KeyboardEventHandler<HTMLDivElement>;
|
|
140
|
+
onKeyPressCapture?: import("react").KeyboardEventHandler<HTMLDivElement>;
|
|
141
|
+
onKeyUp?: import("react").KeyboardEventHandler<HTMLDivElement>;
|
|
142
|
+
onKeyUpCapture?: import("react").KeyboardEventHandler<HTMLDivElement>;
|
|
143
|
+
onAbort?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
144
|
+
onAbortCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
145
|
+
onCanPlay?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
146
|
+
onCanPlayCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
147
|
+
onCanPlayThrough?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
148
|
+
onCanPlayThroughCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
149
|
+
onDurationChange?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
150
|
+
onDurationChangeCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
151
|
+
onEmptied?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
152
|
+
onEmptiedCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
153
|
+
onEncrypted?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
154
|
+
onEncryptedCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
155
|
+
onEnded?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
156
|
+
onEndedCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
157
|
+
onLoadedData?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
158
|
+
onLoadedDataCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
159
|
+
onLoadedMetadata?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
160
|
+
onLoadedMetadataCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
161
|
+
onLoadStart?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
162
|
+
onLoadStartCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
163
|
+
onPause?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
164
|
+
onPauseCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
165
|
+
onPlay?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
166
|
+
onPlayCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
167
|
+
onPlaying?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
168
|
+
onPlayingCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
169
|
+
onProgress?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
170
|
+
onProgressCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
171
|
+
onRateChange?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
172
|
+
onRateChangeCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
173
|
+
onSeeked?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
174
|
+
onSeekedCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
175
|
+
onSeeking?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
176
|
+
onSeekingCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
177
|
+
onStalled?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
178
|
+
onStalledCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
179
|
+
onSuspend?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
180
|
+
onSuspendCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
181
|
+
onTimeUpdate?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
182
|
+
onTimeUpdateCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
183
|
+
onVolumeChange?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
184
|
+
onVolumeChangeCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
185
|
+
onWaiting?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
186
|
+
onWaitingCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
187
|
+
onAuxClick?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
188
|
+
onAuxClickCapture?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
189
|
+
onClick?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
190
|
+
onClickCapture?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
191
|
+
onContextMenu?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
192
|
+
onContextMenuCapture?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
193
|
+
onDoubleClick?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
194
|
+
onDoubleClickCapture?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
195
|
+
onDrag?: import("react").DragEventHandler<HTMLDivElement>;
|
|
196
|
+
onDragCapture?: import("react").DragEventHandler<HTMLDivElement>;
|
|
197
|
+
onDragEnd?: import("react").DragEventHandler<HTMLDivElement>;
|
|
198
|
+
onDragEndCapture?: import("react").DragEventHandler<HTMLDivElement>;
|
|
199
|
+
onDragEnter?: import("react").DragEventHandler<HTMLDivElement>;
|
|
200
|
+
onDragEnterCapture?: import("react").DragEventHandler<HTMLDivElement>;
|
|
201
|
+
onDragExit?: import("react").DragEventHandler<HTMLDivElement>;
|
|
202
|
+
onDragExitCapture?: import("react").DragEventHandler<HTMLDivElement>;
|
|
203
|
+
onDragLeave?: import("react").DragEventHandler<HTMLDivElement>;
|
|
204
|
+
onDragLeaveCapture?: import("react").DragEventHandler<HTMLDivElement>;
|
|
205
|
+
onDragOver?: import("react").DragEventHandler<HTMLDivElement>;
|
|
206
|
+
onDragOverCapture?: import("react").DragEventHandler<HTMLDivElement>;
|
|
207
|
+
onDragStart?: import("react").DragEventHandler<HTMLDivElement>;
|
|
208
|
+
onDragStartCapture?: import("react").DragEventHandler<HTMLDivElement>;
|
|
209
|
+
onDrop?: import("react").DragEventHandler<HTMLDivElement>;
|
|
210
|
+
onDropCapture?: import("react").DragEventHandler<HTMLDivElement>;
|
|
211
|
+
onMouseDown?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
212
|
+
onMouseDownCapture?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
213
|
+
onMouseEnter?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
214
|
+
onMouseLeave?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
215
|
+
onMouseMove?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
216
|
+
onMouseMoveCapture?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
217
|
+
onMouseOut?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
218
|
+
onMouseOutCapture?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
219
|
+
onMouseOver?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
220
|
+
onMouseOverCapture?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
221
|
+
onMouseUp?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
222
|
+
onMouseUpCapture?: import("react").MouseEventHandler<HTMLDivElement>;
|
|
223
|
+
onSelect?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
224
|
+
onSelectCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
225
|
+
onTouchCancel?: import("react").TouchEventHandler<HTMLDivElement>;
|
|
226
|
+
onTouchCancelCapture?: import("react").TouchEventHandler<HTMLDivElement>;
|
|
227
|
+
onTouchEnd?: import("react").TouchEventHandler<HTMLDivElement>;
|
|
228
|
+
onTouchEndCapture?: import("react").TouchEventHandler<HTMLDivElement>;
|
|
229
|
+
onTouchMove?: import("react").TouchEventHandler<HTMLDivElement>;
|
|
230
|
+
onTouchMoveCapture?: import("react").TouchEventHandler<HTMLDivElement>;
|
|
231
|
+
onTouchStart?: import("react").TouchEventHandler<HTMLDivElement>;
|
|
232
|
+
onTouchStartCapture?: import("react").TouchEventHandler<HTMLDivElement>;
|
|
233
|
+
onPointerDown?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
234
|
+
onPointerDownCapture?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
235
|
+
onPointerMove?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
236
|
+
onPointerMoveCapture?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
237
|
+
onPointerUp?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
238
|
+
onPointerUpCapture?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
239
|
+
onPointerCancel?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
240
|
+
onPointerCancelCapture?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
241
|
+
onPointerEnter?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
242
|
+
onPointerEnterCapture?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
243
|
+
onPointerLeave?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
244
|
+
onPointerLeaveCapture?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
245
|
+
onPointerOver?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
246
|
+
onPointerOverCapture?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
247
|
+
onPointerOut?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
248
|
+
onPointerOutCapture?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
249
|
+
onGotPointerCapture?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
250
|
+
onGotPointerCaptureCapture?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
251
|
+
onLostPointerCapture?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
252
|
+
onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
253
|
+
onScroll?: import("react").UIEventHandler<HTMLDivElement>;
|
|
254
|
+
onScrollCapture?: import("react").UIEventHandler<HTMLDivElement>;
|
|
255
|
+
onWheel?: import("react").WheelEventHandler<HTMLDivElement>;
|
|
256
|
+
onWheelCapture?: import("react").WheelEventHandler<HTMLDivElement>;
|
|
257
|
+
onAnimationStart?: import("react").AnimationEventHandler<HTMLDivElement>;
|
|
258
|
+
onAnimationStartCapture?: import("react").AnimationEventHandler<HTMLDivElement>;
|
|
259
|
+
onAnimationEnd?: import("react").AnimationEventHandler<HTMLDivElement>;
|
|
260
|
+
onAnimationEndCapture?: import("react").AnimationEventHandler<HTMLDivElement>;
|
|
261
|
+
onAnimationIteration?: import("react").AnimationEventHandler<HTMLDivElement>;
|
|
262
|
+
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLDivElement>;
|
|
263
|
+
onTransitionEnd?: import("react").TransitionEventHandler<HTMLDivElement>;
|
|
264
|
+
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLDivElement>;
|
|
265
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
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 styled from 'styled-components';
|
|
5
|
+
export const ExplorerWrapper = styled.div `
|
|
6
|
+
max-height: 322px;
|
|
7
|
+
|
|
8
|
+
> div {
|
|
9
|
+
max-height: 322px;
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
//# sourceMappingURL=ExplorerWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExplorerWrapper.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;CAMxC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IPrimaryAction } from '../../../../../../components/Explorer/_types';
|
|
2
|
+
import { FunctionComponent } from 'react';
|
|
3
|
+
interface ILinkActionsButtonsProps {
|
|
4
|
+
createButtonProps: IPrimaryAction;
|
|
5
|
+
linkButtonProps: IPrimaryAction;
|
|
6
|
+
hasNoValue: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const LinkActionsButtons: FunctionComponent<ILinkActionsButtonsProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { KitButton, KitSpace } from 'aristid-ds';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
const ActionButton = styled(KitButton) `
|
|
5
|
+
margin-top: ${props => (props.$hasNoValue ? 0 : 'calc((var(--general-spacing-xs)) * 1px)')};
|
|
6
|
+
`;
|
|
7
|
+
export const LinkActionsButtons = ({ createButtonProps, linkButtonProps, hasNoValue }) => {
|
|
8
|
+
const actionButtonCommonProps = {
|
|
9
|
+
type: 'secondary',
|
|
10
|
+
size: 'm',
|
|
11
|
+
$hasNoValue: hasNoValue
|
|
12
|
+
};
|
|
13
|
+
return (_jsxs(KitSpace, { size: "xs", children: [_jsx(ActionButton, { ...actionButtonCommonProps, icon: createButtonProps.icon, disabled: createButtonProps.disabled, onClick: createButtonProps.callback, children: createButtonProps.label }), _jsx(ActionButton, { ...actionButtonCommonProps, icon: linkButtonProps.icon, disabled: linkButtonProps.disabled, onClick: linkButtonProps.callback, children: linkButtonProps.label })] }));
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=LinkActionsButtons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkActionsButtons.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/LinkActionsButtons.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAG/C,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,CAAwB;kBAC5C,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,yCAAyC,CAAC;CAC7F,CAAC;AAUF,MAAM,CAAC,MAAM,kBAAkB,GAAgD,CAAC,EAC5E,iBAAiB,EACjB,eAAe,EACf,UAAU,EACb,EAAE,EAAE;IACD,MAAM,uBAAuB,GAA4B;QACrD,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,UAAU;KAC1B,CAAC;IAEF,OAAO,CACH,MAAC,QAAQ,IAAC,IAAI,EAAC,IAAI,aACf,KAAC,YAAY,OACL,uBAAuB,EAC3B,IAAI,EAAE,iBAAiB,CAAC,IAAI,EAC5B,QAAQ,EAAE,iBAAiB,CAAC,QAAQ,EACpC,OAAO,EAAE,iBAAiB,CAAC,QAAQ,YAElC,iBAAiB,CAAC,KAAK,GACb,EACf,KAAC,YAAY,OACL,uBAAuB,EAC3B,IAAI,EAAE,eAAe,CAAC,IAAI,EAC1B,QAAQ,EAAE,eAAe,CAAC,QAAQ,EAClC,OAAO,EAAE,eAAe,CAAC,QAAQ,YAEhC,eAAe,CAAC,KAAK,GACX,IACR,CACd,CAAC;AACN,CAAC,CAAC"}
|
package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/utils.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IExplorerFilterStandard } from '../../../../../../components/Explorer/_types';
|
|
2
|
+
export declare const FILTER_ON_ID_DEFAULT_FIELDS: Omit<IExplorerFilterStandard, 'value'>;
|
|
3
|
+
export declare const NO_RECORD_FILTERS: IExplorerFilterStandard[];
|
|
4
|
+
export declare const ACTION_ITEM_EMPTY_LABEL = "";
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { AttributeFormat, AttributeType, RecordFilterCondition } from '../../../../../../_gqlTypes';
|
|
5
|
+
export const FILTER_ON_ID_DEFAULT_FIELDS = {
|
|
6
|
+
id: '',
|
|
7
|
+
attribute: {
|
|
8
|
+
format: AttributeFormat.text,
|
|
9
|
+
label: 'id',
|
|
10
|
+
type: AttributeType.simple
|
|
11
|
+
},
|
|
12
|
+
field: 'id',
|
|
13
|
+
condition: RecordFilterCondition.EQUAL
|
|
14
|
+
};
|
|
15
|
+
export const NO_RECORD_FILTERS = [
|
|
16
|
+
{
|
|
17
|
+
...FILTER_ON_ID_DEFAULT_FIELDS,
|
|
18
|
+
value: 'NO_RECORD'
|
|
19
|
+
}
|
|
20
|
+
];
|
|
21
|
+
export const ACTION_ITEM_EMPTY_LABEL = '';
|
|
22
|
+
//# sourceMappingURL=utils.js.map
|
package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/utils.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/utils.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,eAAe,EAAE,aAAa,EAAE,qBAAqB,EAAC,MAAM,eAAe,CAAC;AAGpF,MAAM,CAAC,MAAM,2BAA2B,GAA2C;IAC/E,EAAE,EAAE,EAAE;IACN,SAAS,EAAE;QACP,MAAM,EAAE,eAAe,CAAC,IAAI;QAC5B,KAAK,EAAE,IAAI;QACX,IAAI,EAAE,aAAa,CAAC,MAAM;KAC7B;IACD,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,qBAAqB,CAAC,KAAK;CACzC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAA8B;IACxD;QACI,GAAG,2BAA2B;QAC9B,KAAK,EAAE,WAAW;KACrB;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC"}
|
package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js
CHANGED
|
@@ -13,15 +13,16 @@ import { Form } from 'antd';
|
|
|
13
13
|
import { KitButton, KitInputWrapper, KitTooltip } from 'aristid-ds';
|
|
14
14
|
import { useLang } from '../../../../../hooks';
|
|
15
15
|
import { FaPlus, FaTrash } from 'react-icons/fa';
|
|
16
|
-
import { DeleteAllValuesButton } from '
|
|
17
|
-
import { computeCalculatedFlags, computeInheritedFlags } from '
|
|
16
|
+
import { DeleteAllValuesButton } from '../shared/DeleteAllValuesButton';
|
|
17
|
+
import { computeCalculatedFlags, computeInheritedFlags } from '../shared/calculatedInheritedFlags';
|
|
18
18
|
import { useGetPresentationValues } from './useGetPresentationValues';
|
|
19
19
|
import { useSharedTranslation } from '../../../../../hooks/useSharedTranslation';
|
|
20
|
-
import { ComputeIndicator } from './ComputeIndicator';
|
|
21
20
|
import { getAntdDisplayedValue, getEmptyInitialValue } from '../../antdUtils';
|
|
22
21
|
import { useEditRecordReducer } from '../../../../../components/RecordEdition/editRecordReducer/useEditRecordReducer';
|
|
22
|
+
import { STANDARD_FIELD_ID_PREFIX } from '../../../../../constants';
|
|
23
|
+
import { ComputeIndicator } from '../shared/ComputeIndicator';
|
|
24
|
+
import { useOutsideInteractionDetector } from '../shared/useOutsideInteractionDetector';
|
|
23
25
|
import { EditRecordReducerActionsTypes } from '../../../../../components/RecordEdition/editRecordReducer/editRecordReducer';
|
|
24
|
-
import { EDIT_RECORD_SIDEBAR_ID, STANDARDFIELD_ID_PREFIX } from '../../../../../constants';
|
|
25
26
|
const Wrapper = styled.div `
|
|
26
27
|
margin-bottom: ${props => (props.$metadataEdit ? 0 : '1.5em')};
|
|
27
28
|
`;
|
|
@@ -56,9 +57,9 @@ const KitAddValueButton = styled(KitButton) `
|
|
|
56
57
|
margin-top: calc((var(--general-spacing-xs) - 3) * 1px);
|
|
57
58
|
margin-bottom: 3px;
|
|
58
59
|
`;
|
|
59
|
-
const StandardField = ({ element, computedValues, antdForm, readonly, onValueSubmit, onValueDelete, onDeleteMultipleValues, metadataEdit = false }) => {
|
|
60
|
+
const StandardField = ({ element, computedValues, antdForm, readonly, formIdToLoad, pendingValues, onValueSubmit, onValueDelete, onDeleteMultipleValues, metadataEdit = false }) => {
|
|
60
61
|
const { t } = useSharedTranslation();
|
|
61
|
-
const { lang
|
|
62
|
+
const { lang } = useLang();
|
|
62
63
|
const antdListFieldsRef = useRef(null);
|
|
63
64
|
const { attribute } = element;
|
|
64
65
|
useEffect(() => {
|
|
@@ -71,37 +72,16 @@ const StandardField = ({ element, computedValues, antdForm, readonly, onValueSub
|
|
|
71
72
|
return _jsx(ErrorDisplay, { message: t('record_edition.missing_attribute') });
|
|
72
73
|
}
|
|
73
74
|
const { state, dispatch } = useEditRecordReducer();
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
const _handleClickOutside = (event) => {
|
|
76
|
-
if (state.activeAttribute?.attribute?.id !== attribute.id) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
const target = event.target;
|
|
80
|
-
const sideBarSelector = '#' + EDIT_RECORD_SIDEBAR_ID;
|
|
81
|
-
const inputWrapperSelector = '#' + STANDARDFIELD_ID_PREFIX + attribute.id;
|
|
82
|
-
const colorDropdownSelector = '.ant-popover.ant-color-picker';
|
|
83
|
-
const pickerDropdownSelector = '.ant-picker-dropdown';
|
|
84
|
-
const richTextModalSelector = '.kit-modal-wrapper.link-modal';
|
|
85
|
-
const allowedElementsToKeepValueDetailsDisplayed = target.closest(`${sideBarSelector}, ${inputWrapperSelector}, ${colorDropdownSelector}, ${pickerDropdownSelector}, ${richTextModalSelector}`);
|
|
86
|
-
if (!allowedElementsToKeepValueDetailsDisplayed) {
|
|
87
|
-
dispatch({
|
|
88
|
-
type: EditRecordReducerActionsTypes.SET_ACTIVE_VALUE,
|
|
89
|
-
attribute: null
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
document.addEventListener('mousedown', _handleClickOutside);
|
|
94
|
-
return () => {
|
|
95
|
-
document.removeEventListener('mousedown', _handleClickOutside);
|
|
96
|
-
};
|
|
97
|
-
}, [state.activeAttribute, attribute.id, dispatch]);
|
|
98
75
|
const [backendValues, setBackendValues] = useState(element.values);
|
|
99
76
|
const calculatedFlags = computeCalculatedFlags(backendValues);
|
|
100
77
|
const inheritedFlags = computeInheritedFlags(backendValues);
|
|
101
78
|
const defaultValueToAddInAntdForm = getEmptyInitialValue(attribute);
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
79
|
+
const [attributePendingValues, setAttributePendingValues] = useState([]);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
setAttributePendingValues(pendingValues?.[attribute.id]
|
|
82
|
+
? Object.values(pendingValues?.[attribute.id])
|
|
83
|
+
: []);
|
|
84
|
+
}, [pendingValues, attribute.id]);
|
|
105
85
|
useEffect(() => {
|
|
106
86
|
if (state.activeAttribute?.attribute.id === attribute.id) {
|
|
107
87
|
dispatch({
|
|
@@ -110,6 +90,19 @@ const StandardField = ({ element, computedValues, antdForm, readonly, onValueSub
|
|
|
110
90
|
});
|
|
111
91
|
}
|
|
112
92
|
}, [backendValues]);
|
|
93
|
+
useOutsideInteractionDetector({
|
|
94
|
+
attribute,
|
|
95
|
+
activeAttribute: state.activeAttribute,
|
|
96
|
+
attributePrefix: STANDARD_FIELD_ID_PREFIX,
|
|
97
|
+
dispatch,
|
|
98
|
+
formIdToLoad,
|
|
99
|
+
backendValues,
|
|
100
|
+
pendingValues: attributePendingValues,
|
|
101
|
+
allowedSelectors: ['.ant-popover.ant-color-picker', '.ant-picker-dropdown', '.kit-modal-wrapper.link-modal']
|
|
102
|
+
});
|
|
103
|
+
const backendWithoutCalculatedOrInheritedValues = backendValues
|
|
104
|
+
.filter(backendValue => !backendValue.isCalculated && !backendValue.isInherited)
|
|
105
|
+
.sort((a, b) => Number(a.id_value) - Number(b.id_value));
|
|
113
106
|
const { presentationValues } = useGetPresentationValues({
|
|
114
107
|
//TODO fix type
|
|
115
108
|
values: backendWithoutCalculatedOrInheritedValues,
|
|
@@ -207,13 +200,6 @@ const StandardField = ({ element, computedValues, antdForm, readonly, onValueSub
|
|
|
207
200
|
return;
|
|
208
201
|
}
|
|
209
202
|
};
|
|
210
|
-
const setActiveValue = () => {
|
|
211
|
-
dispatch({
|
|
212
|
-
type: EditRecordReducerActionsTypes.SET_ACTIVE_VALUE,
|
|
213
|
-
attribute,
|
|
214
|
-
values: backendValues
|
|
215
|
-
});
|
|
216
|
-
};
|
|
217
203
|
let isFieldInError = false;
|
|
218
204
|
if (antdForm) {
|
|
219
205
|
const hasErrorsInFormList = backendValues.some((_, index) => {
|
|
@@ -231,16 +217,16 @@ const StandardField = ({ element, computedValues, antdForm, readonly, onValueSub
|
|
|
231
217
|
!isFieldInError &&
|
|
232
218
|
attribute.format !== AttributeFormat.boolean &&
|
|
233
219
|
attribute.format !== AttributeFormat.encrypted;
|
|
234
|
-
const canDeleteAllValues =
|
|
235
|
-
const label = localizedTranslation(element.settings.label,
|
|
220
|
+
const canDeleteAllValues = hasValue && backendValues.length > 1 && !attribute.required;
|
|
221
|
+
const label = localizedTranslation(element.settings.label, lang);
|
|
236
222
|
const isReadOnly = attribute.readonly || readonly;
|
|
237
|
-
return (_jsx(Wrapper, { "$metadataEdit": metadataEdit, children: _jsxs(KitInputWrapperStyled, { id:
|
|
223
|
+
return (_jsx(Wrapper, { "$metadataEdit": metadataEdit, children: _jsxs(KitInputWrapperStyled, { id: STANDARD_FIELD_ID_PREFIX + attribute.id, label: label, required: attribute.required, disabled: isReadOnly, bordered: attribute.multiple_values, status: isFieldInError ? 'error' : undefined, extra: _jsxs(_Fragment, { children: [_jsx(KitInputExtraAlignLeft, { children: _jsx(ComputeIndicator, { calculatedFlags: calculatedFlags, inheritedFlags: inheritedFlags }) }), canDeleteAllValues && (_jsx(DeleteAllValuesButton, { handleDelete: _handleDeleteAllValues, disabled: isReadOnly, danger: isFieldInError }))] }), htmlFor: attribute.id, children: [!attribute.multiple_values && (_jsx(StandardFieldValue, { presentationValue: presentationValues[0] ?? '', handleSubmit: _handleSubmit(backendWithoutCalculatedOrInheritedValues[0]?.id_value), attribute: attribute, readonly: isReadOnly, label: label, calculatedFlags: calculatedFlags, inheritedFlags: inheritedFlags })), attribute.multiple_values && (_jsx(Form.List, { name: attribute.id, children: (fields, { add, remove }) => {
|
|
238
224
|
antdListFieldsRef.current = { add, remove, indexes: fields.map((_, index) => index) };
|
|
239
225
|
const shouldDisabledAddValueButton = fields.length > backendWithoutCalculatedOrInheritedValues.length;
|
|
240
|
-
return (_jsxs(_Fragment, { children: [_jsx(KitFieldsWrapper, { children: fields.map((field, index) => (_jsxs(RowValueWrapper, { children: [_jsx(StandardFieldValueWrapper, { children: _jsx(StandardFieldValue, { listField: field, presentationValue: presentationValues[index] ?? '', handleSubmit: _handleSubmit(backendWithoutCalculatedOrInheritedValues[index]?.id_value, field.name), attribute: attribute, label: label, readonly: isReadOnly, calculatedFlags: calculatedFlags, inheritedFlags: inheritedFlags, isLastValueOfMultivalues: index === fields.length - 1 && index !== 0, removeLastValueOfMultivalues: () => remove(index)
|
|
241
|
-
?.id_value, remove, index) }))] }, field.key))) }), canAddAnotherValue && (_jsx(KitTooltip, { title: shouldDisabledAddValueButton
|
|
226
|
+
return (_jsxs(_Fragment, { children: [_jsx(KitFieldsWrapper, { children: fields.map((field, index) => (_jsxs(RowValueWrapper, { children: [_jsx(StandardFieldValueWrapper, { children: _jsx(StandardFieldValue, { listField: field, presentationValue: presentationValues[index] ?? '', handleSubmit: _handleSubmit(backendWithoutCalculatedOrInheritedValues[index]?.id_value, field.name), attribute: attribute, label: label, readonly: isReadOnly, calculatedFlags: calculatedFlags, inheritedFlags: inheritedFlags, isLastValueOfMultivalues: index === fields.length - 1 && index !== 0, removeLastValueOfMultivalues: () => remove(index) }) }), fields.length > 1 && (_jsx(KitDeleteValueButton, { type: "tertiary", title: t('record_edition.delete_value'), icon: _jsx(FaTrash, {}), onClick: () => _handleDeleteValue(backendWithoutCalculatedOrInheritedValues[index]
|
|
227
|
+
?.id_value, remove, index), disabled: isReadOnly }))] }, field.key))) }), canAddAnotherValue && (_jsx(KitTooltip, { title: shouldDisabledAddValueButton
|
|
242
228
|
? t('record_edition.please_select_value_before_adding')
|
|
243
|
-
: undefined, children: _jsx(KitAddValueButton, { type: "secondary", size: "m", icon: _jsx(FaPlus, {}), onClick: () => add(defaultValueToAddInAntdForm), disabled: shouldDisabledAddValueButton, children: t('record_edition.add_value') }) }))] }));
|
|
229
|
+
: undefined, children: _jsx(KitAddValueButton, { type: "secondary", size: "m", icon: _jsx(FaPlus, {}), onClick: () => add(defaultValueToAddInAntdForm), disabled: isReadOnly || shouldDisabledAddValueButton, children: t('record_edition.add_value') }) }))] }));
|
|
244
230
|
} }))] }) }));
|
|
245
231
|
};
|
|
246
232
|
export default StandardField;
|