@leav/ui 0.4.0-58529dc → 0.4.0-5c1d9113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/_gqlTypes/index.d.ts +1256 -250
- package/dist/_gqlTypes/index.js +285 -42
- package/dist/_gqlTypes/index.js.map +1 -1
- package/dist/_queries/records/getRecordFormQuery.js +9 -0
- package/dist/_queries/records/getRecordFormQuery.js.map +1 -1
- package/dist/_queries/trees/treeNodeChildrenQuery.js +12 -2
- package/dist/_queries/trees/treeNodeChildrenQuery.js.map +1 -1
- package/dist/_utils/attributeType.d.ts +2 -1
- package/dist/_utils/attributeType.js +2 -1
- package/dist/_utils/attributeType.js.map +1 -1
- package/dist/components/Explorer/DataView.js +4 -4
- package/dist/components/Explorer/DataView.js.map +1 -1
- package/dist/components/Explorer/Explorer.d.ts +6 -4
- package/dist/components/Explorer/Explorer.js +13 -4
- package/dist/components/Explorer/Explorer.js.map +1 -1
- package/dist/components/Explorer/ExplorerToolbar.d.ts +2 -1
- package/dist/components/Explorer/ExplorerToolbar.js +5 -4
- package/dist/components/Explorer/ExplorerToolbar.js.map +1 -1
- package/dist/components/Explorer/_queries/prepareFiltersForRequest.d.ts +1 -1
- package/dist/components/Explorer/_queries/prepareFiltersForRequest.js +82 -31
- package/dist/components/Explorer/_queries/prepareFiltersForRequest.js.map +1 -1
- package/dist/components/Explorer/_queries/useExplorerData.js +31 -27
- package/dist/components/Explorer/_queries/useExplorerData.js.map +1 -1
- package/dist/components/Explorer/_types.d.ts +22 -3
- package/dist/components/Explorer/_types.js +1 -0
- package/dist/components/Explorer/_types.js.map +1 -1
- package/dist/components/Explorer/actions-item/useReplaceItemAction.d.ts +2 -1
- package/dist/components/Explorer/actions-item/useReplaceItemAction.js +2 -2
- package/dist/components/Explorer/actions-item/useReplaceItemAction.js.map +1 -1
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.d.ts +5 -1
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js +16 -21
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js.map +1 -1
- package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.d.ts +6 -3
- package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js +5 -19
- package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js.map +1 -1
- package/dist/components/Explorer/link-item/LinkModal.d.ts +3 -0
- package/dist/components/Explorer/link-item/LinkModal.js +14 -4
- package/dist/components/Explorer/link-item/LinkModal.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/_shared/CommonFilterItem.js +1 -1
- package/dist/components/Explorer/manage-view-settings/_shared/CommonFilterItem.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/_shared/useTransformFilters.js +26 -2
- package/dist/components/Explorer/manage-view-settings/_shared/useTransformFilters.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js +10 -7
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropDown.js +2 -2
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropDown.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropdownContent.js +5 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropdownContent.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/TreeAttributeDropDown.d.ts +3 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/TreeAttributeDropDown.js +69 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/TreeAttributeDropDown.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/_types.d.ts +6 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/useConditionOptionsByType.d.ts +2 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/useConditionOptionsByType.js +31 -4
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/useConditionOptionsByType.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js +19 -8
- package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsInitialState.js +2 -1
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsInitialState.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.d.ts +3 -2
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js +38 -12
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js.map +1 -1
- package/dist/components/Explorer/useLoadView.d.ts +1 -1
- package/dist/components/Explorer/useLoadView.js +32 -38
- package/dist/components/Explorer/useLoadView.js.map +1 -1
- package/dist/components/Explorer/useSearchInput.js +2 -0
- package/dist/components/Explorer/useSearchInput.js.map +1 -1
- package/dist/components/Explorer/useViewSettingsReducer.js +6 -2
- package/dist/components/Explorer/useViewSettingsReducer.js.map +1 -1
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.js +2 -2
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.js.map +1 -1
- package/dist/components/RecordEdition/EditRecord/EditRecord.d.ts +2 -1
- package/dist/components/RecordEdition/EditRecord/EditRecord.js +72 -224
- package/dist/components/RecordEdition/EditRecord/EditRecord.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.d.ts +2 -2
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js +4 -11
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/_types.d.ts +2 -5
- package/dist/components/RecordEdition/EditRecordContent/hooks/useCreateEmptyRecordMutation.d.ts +5 -0
- package/dist/components/RecordEdition/EditRecordContent/hooks/useCreateEmptyRecordMutation.js +28 -0
- package/dist/components/RecordEdition/EditRecordContent/hooks/useCreateEmptyRecordMutation.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/hooks/useTabManagement.d.ts +11 -0
- package/dist/components/RecordEdition/EditRecordContent/hooks/useTabManagement.js +35 -0
- package/dist/components/RecordEdition/EditRecordContent/hooks/useTabManagement.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.d.ts +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.js +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/FormDivider/FormDivider.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/Frame.js +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/Frame.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js +11 -36
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/ActionButton.d.ts +3 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/ActionButton.js +9 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/ActionButton.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/{link-record-in-edition/useLinkRecords.d.ts → link-record/useExplorerLinkRecords.d.ts} +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/{link-record-in-edition/useLinkRecords.js → link-record/useExplorerLinkRecords.js} +3 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useExplorerLinkRecords.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.d.ts +24 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js +76 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/utils.js +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/utils.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +19 -15
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TextBlock/TextBlock.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.d.ts +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js +19 -24
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.d.ts +2 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/{useDisplayTreeNode.d.ts → TreeNodeList.d.ts} +4 -4
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeList.js +5 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeList.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.d.ts +16 -4
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js +12 -13
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.d.ts +4 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js +49 -62
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/useOutsideInteractionDetector.d.ts +1 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/useOutsideInteractionDetector.js +6 -10
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/useOutsideInteractionDetector.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js +22 -4
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.js +23 -5
- package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.js.map +1 -1
- package/dist/components/RecordEdition/index.d.ts +2 -1
- package/dist/components/RecordEdition/index.js +2 -1
- package/dist/components/RecordEdition/index.js.map +1 -1
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.d.ts +4 -1
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js +6 -4
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js.map +1 -1
- package/dist/components/SelectTreeNode/SelectTreeNode.d.ts +7 -3
- package/dist/components/SelectTreeNode/SelectTreeNode.js +2 -3
- package/dist/components/SelectTreeNode/SelectTreeNode.js.map +1 -1
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.d.ts +5 -1
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.js +70 -56
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.js.map +1 -1
- package/dist/components/SelectTreeNode/_types.d.ts +18 -0
- package/dist/components/SelectTreeNode/_types.js +2 -0
- package/dist/components/SelectTreeNode/_types.js.map +1 -0
- package/dist/components/{SelectTreeNodeModal/SelectTreeNodeModal.d.ts → SelectTreeNodeModalOld/SelectTreeNodeModalOld.d.ts} +1 -1
- package/dist/components/{SelectTreeNodeModal/SelectTreeNodeModal.js → SelectTreeNodeModalOld/SelectTreeNodeModalOld.js} +4 -2
- package/dist/components/SelectTreeNodeModalOld/SelectTreeNodeModalOld.js.map +1 -0
- package/dist/components/SelectTreeNodeModalOld/index.d.ts +1 -0
- package/dist/components/{LinkSelect → SelectTreeNodeModalOld}/index.js +1 -2
- package/dist/components/SelectTreeNodeModalOld/index.js.map +1 -0
- package/dist/components/ValuesVersionConfigurator/VersionTree/VersionTree.js +2 -2
- package/dist/components/ValuesVersionConfigurator/VersionTree/VersionTree.js.map +1 -1
- package/dist/components/index.d.ts +1 -2
- package/dist/components/index.js +1 -2
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useGetRecordForm/useGetRecordForm.js +1 -1
- package/dist/hooks/useGetRecordForm/useGetRecordForm.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/messageHandlers.d.ts +3 -1
- package/dist/hooks/useIFrameMessenger/messageHandlers.js +13 -2
- package/dist/hooks/useIFrameMessenger/messageHandlers.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/schema.d.ts +21 -0
- package/dist/hooks/useIFrameMessenger/schema.js +76 -0
- package/dist/hooks/useIFrameMessenger/schema.js.map +1 -0
- package/dist/hooks/useIFrameMessenger/types.d.ts +41 -6
- package/dist/hooks/useIFrameMessenger/types.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/useIFrameMessenger.d.ts +10 -1
- package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js +55 -20
- package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js.map +1 -1
- package/dist/hooks/useIFrameMessengerClient/IFrameMessengerClient.d.ts +7 -0
- package/dist/hooks/useIFrameMessengerClient/IFrameMessengerClient.js +13 -0
- package/dist/hooks/useIFrameMessengerClient/IFrameMessengerClient.js.map +1 -0
- package/dist/hooks/useIFrameMessengerClient/iFrameMessengerClientContext.d.ts +13 -0
- package/dist/{components/RecordEdition/EditRecord/creationErrorContext.js → hooks/useIFrameMessengerClient/iFrameMessengerClientContext.js} +2 -3
- package/dist/hooks/useIFrameMessengerClient/iFrameMessengerClientContext.js.map +1 -0
- package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.d.ts +13 -0
- package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.js +13 -0
- package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.js.map +1 -0
- package/dist/types/attributes.d.ts +2 -1
- package/package.json +22 -6
- package/dist/components/LinkSelect/LinkSelect.d.ts +0 -12
- package/dist/components/LinkSelect/LinkSelect.js +0 -44
- package/dist/components/LinkSelect/LinkSelect.js.map +0 -1
- package/dist/components/LinkSelect/index.d.ts +0 -2
- package/dist/components/LinkSelect/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecord/creationErrorContext.d.ts +0 -6
- package/dist/components/RecordEdition/EditRecord/creationErrorContext.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/hooks/useCreateRecordMutation.d.ts +0 -5
- package/dist/components/RecordEdition/EditRecordContent/hooks/useCreateRecordMutation.js +0 -28
- package/dist/components/RecordEdition/EditRecordContent/hooks/useCreateRecordMutation.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/hooks/useRunActionsListAndFormatOnValue.d.ts +0 -121
- package/dist/components/RecordEdition/EditRecordContent/hooks/useRunActionsListAndFormatOnValue.js +0 -31
- package/dist/components/RecordEdition/EditRecordContent/hooks/useRunActionsListAndFormatOnValue.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useEditRecord.d.ts +0 -5
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useEditRecord.js +0 -39
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useEditRecord.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useUnselectRecord.d.ts +0 -8
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useUnselectRecord.js +0 -23
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useUnselectRecord.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-mass/useUnselectAllRecords.d.ts +0 -9
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-mass/useUnselectAllRecords.js +0 -23
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-mass/useUnselectAllRecords.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useCreateRecord.d.ts +0 -8
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useCreateRecord.js +0 -26
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useCreateRecord.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useRecordSelector.d.ts +0 -12
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useRecordSelector.js +0 -24
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useRecordSelector.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecords.d.ts +0 -19
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecords.js +0 -103
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecords.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.d.ts +0 -22
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.js +0 -104
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecords.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.d.ts +0 -27
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.js +0 -124
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/LinkActionsButtons.d.ts +0 -9
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/LinkActionsButtons.js +0 -15
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/LinkActionsButtons.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/ValuesList.d.ts +0 -16
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/ValuesList.js +0 -35
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/ValuesList.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/index.js +0 -6
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/useDisplayTreeNode.js +0 -8
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/useDisplayTreeNode.js.map +0 -1
- package/dist/components/SelectTreeNodeModal/SelectTreeNodeModal.js.map +0 -1
- package/dist/components/SelectTreeNodeModal/index.d.ts +0 -1
- package/dist/components/SelectTreeNodeModal/index.js +0 -5
- package/dist/components/SelectTreeNodeModal/index.js.map +0 -1
|
@@ -5,7 +5,7 @@ import dayjs from 'dayjs';
|
|
|
5
5
|
import { AttributeFormat, RecordFilterCondition, RecordFilterOperator } from '../../../_gqlTypes';
|
|
6
6
|
import { interleaveElement } from '../../../_utils/interleaveElement';
|
|
7
7
|
import { AttributeConditionFilter } from '../../../types';
|
|
8
|
-
import { isExplorerFilterStandard, isExplorerFilterThrough } from '../_types';
|
|
8
|
+
import { isExplorerFilterStandard, isExplorerFilterThrough, isExplorerFilterTree } from '../_types';
|
|
9
9
|
import { nullValueConditions } from '../conditionsHelper';
|
|
10
10
|
export const dateValuesSeparator = '\n';
|
|
11
11
|
const _getDateAtNoon = (date) => dayjs.unix(Number(date)).add(12, 'hour').unix().toString();
|
|
@@ -61,39 +61,90 @@ const _getBooleanRequestFilters = (filter) => {
|
|
|
61
61
|
}
|
|
62
62
|
return [{ field: filter.field, condition: filter.condition, value: filter.value }];
|
|
63
63
|
};
|
|
64
|
-
|
|
65
|
-
.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return filter.value !== null || (filter.condition && nullValueConditions.includes(filter.condition));
|
|
72
|
-
})
|
|
73
|
-
.map(filter => {
|
|
74
|
-
const condition = filter.condition === AttributeConditionFilter.THROUGH ? filter.subCondition : filter.condition;
|
|
75
|
-
const field = filter.condition === AttributeConditionFilter.THROUGH
|
|
76
|
-
? `${filter.field}.${filter.subField}`
|
|
77
|
-
: filter.field;
|
|
78
|
-
return { ...filter, condition, field };
|
|
79
|
-
})
|
|
80
|
-
.map(filter => {
|
|
81
|
-
if (isExplorerFilterStandard(filter)) {
|
|
82
|
-
switch (filter.attribute.format) {
|
|
83
|
-
case AttributeFormat.date:
|
|
84
|
-
return _getDateRequestFilters(filter);
|
|
85
|
-
case AttributeFormat.boolean:
|
|
86
|
-
return _getBooleanRequestFilters(filter);
|
|
87
|
-
default:
|
|
88
|
-
break;
|
|
64
|
+
const _addValuesListForFilters = (valuesList) => [
|
|
65
|
+
{ operator: RecordFilterOperator.OPEN_BRACKET },
|
|
66
|
+
...interleaveElement({ operator: RecordFilterOperator.OR }, valuesList.map(value => [
|
|
67
|
+
{
|
|
68
|
+
field: 'id',
|
|
69
|
+
condition: AttributeConditionFilter.EQUAL,
|
|
70
|
+
value
|
|
89
71
|
}
|
|
72
|
+
])),
|
|
73
|
+
{ operator: RecordFilterOperator.CLOSE_BRACKET }
|
|
74
|
+
];
|
|
75
|
+
const _getTreeRequestFilters = (filter) => {
|
|
76
|
+
if (!filter.value || filter.value.length === 0) {
|
|
77
|
+
return [];
|
|
90
78
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
79
|
+
const filtersWithOperators = [];
|
|
80
|
+
filter.value.forEach((recordId, idx) => {
|
|
81
|
+
if (idx === 0 && filter.value && filter.value.length > 1) {
|
|
82
|
+
filtersWithOperators.push({ operator: RecordFilterOperator.OPEN_BRACKET });
|
|
83
|
+
}
|
|
84
|
+
filtersWithOperators.push({
|
|
85
|
+
value: recordId,
|
|
94
86
|
condition: filter.condition,
|
|
95
|
-
|
|
87
|
+
field: filter.field[idx]
|
|
88
|
+
});
|
|
89
|
+
if (filter.value && idx < filter.value.length - 1) {
|
|
90
|
+
filtersWithOperators.push({
|
|
91
|
+
operator: filter.condition === RecordFilterCondition.NOT_EQUAL
|
|
92
|
+
? RecordFilterOperator.AND
|
|
93
|
+
: RecordFilterOperator.OR
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
if (filter.value && filter.value.length > 1 && idx >= filter.value.length - 1) {
|
|
97
|
+
filtersWithOperators.push({ operator: RecordFilterOperator.CLOSE_BRACKET });
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
return filtersWithOperators;
|
|
101
|
+
};
|
|
102
|
+
export const prepareFiltersForRequest = (filters, filtersOperator, valuesList) => {
|
|
103
|
+
const interleaveFilter = interleaveElement({ operator: filtersOperator === 'OR' ? RecordFilterOperator.OR : RecordFilterOperator.AND }, filters
|
|
104
|
+
.filter(filter => {
|
|
105
|
+
if (isExplorerFilterThrough(filter)) {
|
|
106
|
+
return (filter.subField &&
|
|
107
|
+
filter.subCondition &&
|
|
108
|
+
(filter.value !== null || nullValueConditions.includes(filter.subCondition)));
|
|
109
|
+
}
|
|
110
|
+
return filter.value !== null || (filter.condition && nullValueConditions.includes(filter.condition));
|
|
111
|
+
})
|
|
112
|
+
.map(filter => {
|
|
113
|
+
if (isExplorerFilterTree(filter)) {
|
|
114
|
+
return filter;
|
|
115
|
+
}
|
|
116
|
+
const condition = filter.condition === AttributeConditionFilter.THROUGH ? filter.subCondition : filter.condition;
|
|
117
|
+
const field = filter.condition === AttributeConditionFilter.THROUGH
|
|
118
|
+
? `${filter.field}.${filter.subField}`
|
|
119
|
+
: filter.field;
|
|
120
|
+
return { ...filter, condition, field };
|
|
121
|
+
})
|
|
122
|
+
.map(filter => {
|
|
123
|
+
if (isExplorerFilterTree(filter)) {
|
|
124
|
+
return _getTreeRequestFilters(filter);
|
|
96
125
|
}
|
|
126
|
+
if (isExplorerFilterStandard(filter)) {
|
|
127
|
+
switch (filter.attribute.format) {
|
|
128
|
+
case AttributeFormat.date:
|
|
129
|
+
return _getDateRequestFilters(filter);
|
|
130
|
+
case AttributeFormat.boolean:
|
|
131
|
+
return _getBooleanRequestFilters(filter);
|
|
132
|
+
default:
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return [
|
|
137
|
+
{
|
|
138
|
+
field: filter.field,
|
|
139
|
+
condition: filter.condition,
|
|
140
|
+
value: filter.value
|
|
141
|
+
}
|
|
142
|
+
];
|
|
143
|
+
}));
|
|
144
|
+
return [
|
|
145
|
+
...interleaveFilter,
|
|
146
|
+
...(interleaveFilter.length > 0 && valuesList ? [{ operator: RecordFilterOperator.AND }] : []),
|
|
147
|
+
...(valuesList ? _addValuesListForFilters(valuesList) : [])
|
|
97
148
|
];
|
|
98
|
-
}
|
|
149
|
+
};
|
|
99
150
|
//# sourceMappingURL=prepareFiltersForRequest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareFiltersForRequest.js","sourceRoot":"","sources":["../../../../src/components/Explorer/_queries/prepareFiltersForRequest.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,eAAe,EAAE,qBAAqB,EAAqB,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAC9G,OAAO,EAAC,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAC,wBAAwB,EAAC,MAAM,WAAW,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"prepareFiltersForRequest.js","sourceRoot":"","sources":["../../../../src/components/Explorer/_queries/prepareFiltersForRequest.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,eAAe,EAAE,qBAAqB,EAAqB,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAC9G,OAAO,EAAC,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAC,wBAAwB,EAAC,MAAM,WAAW,CAAC;AACnD,OAAO,EAKH,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACvB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AAExD,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC;AAE5G,MAAM,sBAAsB,GAAG,CAAC,EAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAA0B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E,CAAC;QAC5F,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9D,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -49,31 +49,33 @@ const _mappingLink = (data, libraryId, availableLangs) => {
|
|
|
49
49
|
return acc;
|
|
50
50
|
}, {})
|
|
51
51
|
: {};
|
|
52
|
-
const records = data.records.list
|
|
53
|
-
.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
52
|
+
const records = (data.records.list.length &&
|
|
53
|
+
data.records.list[0].property
|
|
54
|
+
.map((linkValue, index) => {
|
|
55
|
+
if (!linkValue.payload) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
libraryId,
|
|
60
|
+
// same link id can be duplicated, so we add the index to the key
|
|
61
|
+
key: linkValue.payload.whoAmI.id + index, // For <KitTable /> only
|
|
62
|
+
itemId: linkValue.payload.whoAmI.id, // For <KitTable /> only
|
|
63
|
+
canActivate: true,
|
|
64
|
+
canDelete: true,
|
|
65
|
+
active: true,
|
|
66
|
+
whoAmI: {
|
|
67
|
+
label: null,
|
|
68
|
+
subLabel: null,
|
|
69
|
+
color: null,
|
|
70
|
+
preview: null,
|
|
71
|
+
...linkValue.payload.whoAmI
|
|
72
|
+
},
|
|
73
|
+
propertiesById: linkValue.payload.properties.reduce((acc, { attributeId, values }) => ({ ...acc, [attributeId]: values }), {}),
|
|
74
|
+
id_value: linkValue.id_value ?? undefined
|
|
75
|
+
};
|
|
76
|
+
})
|
|
77
|
+
.filter(Boolean)) ||
|
|
78
|
+
[];
|
|
77
79
|
return {
|
|
78
80
|
totalCount: records.length,
|
|
79
81
|
attributes,
|
|
@@ -85,7 +87,6 @@ export const useExplorerData = ({ entrypoint, libraryId, attributeIds, fulltextS
|
|
|
85
87
|
const isLibrary = entrypoint.type === 'library';
|
|
86
88
|
const isLink = entrypoint.type === 'link';
|
|
87
89
|
const { data: attributeData } = useExplorerLinkAttributeQuery({
|
|
88
|
-
skip: entrypoint.type !== 'link',
|
|
89
90
|
variables: {
|
|
90
91
|
id: entrypoint.linkAttributeId
|
|
91
92
|
}
|
|
@@ -101,6 +102,9 @@ export const useExplorerData = ({ entrypoint, libraryId, attributeIds, fulltextS
|
|
|
101
102
|
attributeIds
|
|
102
103
|
}
|
|
103
104
|
});
|
|
105
|
+
const allowFreeEntry = isLibrary ? entrypoint.allowFreeEntry : undefined;
|
|
106
|
+
const valuesList = !isLibrary || (fulltextSearch && allowFreeEntry) ? undefined : entrypoint.valuesList; // Remove values list for free entry values list on search
|
|
107
|
+
const preparedFilters = prepareFiltersForRequest(filters, filtersOperator, valuesList);
|
|
104
108
|
const { data: libraryData, loading: libraryLoading, refetch: libraryRefetch } = useExplorerLibraryDataQuery({
|
|
105
109
|
fetchPolicy: 'network-only',
|
|
106
110
|
skip: skip || !isLibrary,
|
|
@@ -110,7 +114,7 @@ export const useExplorerData = ({ entrypoint, libraryId, attributeIds, fulltextS
|
|
|
110
114
|
pagination,
|
|
111
115
|
searchQuery: fulltextSearch,
|
|
112
116
|
multipleSort: sorts,
|
|
113
|
-
filters:
|
|
117
|
+
filters: preparedFilters
|
|
114
118
|
}
|
|
115
119
|
});
|
|
116
120
|
const isMultivalue = !!attributeData?.attributes?.list?.[0]?.multiple_values;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExplorerData.js","sourceRoot":"","sources":["../../../../src/components/Explorer/_queries/useExplorerData.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,+BAA+B,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"useExplorerData.js","sourceRoot":"","sources":["../../../../src/components/Explorer/_queries/useExplorerData.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,+BAA+B,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AASnE,OAAO,EAKH,2BAA2B,EAC3B,6BAA6B,EAC7B,wBAAwB,EAC3B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAC;AAEpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC,MAAM,eAAe,GAAG,CACpB,IAA8B,EAC9B,SAAiB,EACjB,cAAwB,EACX,EAAE;IACf,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM;QACvC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE;YACrD,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG;gBACxB,GAAG,QAAQ,CAAC,mBAAmB;gBAC/B,KAAK,EAAE,oBAAoB,CAAC,QAAQ,CAAC,mBAAmB,CAAC,KAAK,EAAE,cAAc,CAAC;aAClF,CAAC;YAEF,OAAO,GAAG,CAAC;QACf,CAAC,EAAE,EAAE,CAAC;QACR,CAAC,CAAC,EAAE,CAAC;IAET,MAAM,OAAO,GAAG,IAA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AY,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/D,+BAA+B,CAAC,EAAC,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,EAAC,EAAE,CAAC,SAAS,CAAC,CAAC;IAEpF,OAAO;QACH,IAAI,EAAE,YAAY;QAClB,YAAY;QACZ,0BAA0B;QAC1B,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW;QACjD,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW;KACpD,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -36,7 +36,7 @@ export interface IItemAction {
|
|
|
36
36
|
icon: ReactElement | ((item: IItemData) => ReactElement);
|
|
37
37
|
label: string | ((item: IItemData) => string);
|
|
38
38
|
iconOnly?: boolean;
|
|
39
|
-
isDanger?: boolean;
|
|
39
|
+
isDanger?: boolean | ((item: IItemData) => boolean);
|
|
40
40
|
disabled?: boolean | ((item: IItemData) => boolean);
|
|
41
41
|
}
|
|
42
42
|
export interface IPrimaryAction {
|
|
@@ -52,23 +52,31 @@ export interface IMassActions {
|
|
|
52
52
|
}
|
|
53
53
|
export type FeatureHook<T = {}> = {
|
|
54
54
|
isEnabled: boolean;
|
|
55
|
+
isVisible?: boolean;
|
|
55
56
|
} & T;
|
|
56
57
|
interface IExplorerFilterBaseAttribute {
|
|
57
58
|
type: AttributeType;
|
|
58
59
|
label: string;
|
|
60
|
+
id: string;
|
|
59
61
|
}
|
|
60
62
|
interface IExplorerFilterStandardAttribute extends IExplorerFilterBaseAttribute {
|
|
61
63
|
format: AttributeFormat;
|
|
62
64
|
}
|
|
63
|
-
interface IExplorerFilterLinkAttribute extends IExplorerFilterBaseAttribute {
|
|
65
|
+
export interface IExplorerFilterLinkAttribute extends IExplorerFilterBaseAttribute {
|
|
64
66
|
linkedLibrary?: {
|
|
65
67
|
id: string;
|
|
66
68
|
};
|
|
67
69
|
}
|
|
70
|
+
export interface IExplorerFilterTreeAttribute extends IExplorerFilterBaseAttribute {
|
|
71
|
+
linkedTree?: {
|
|
72
|
+
id: string;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
68
75
|
interface IExplorerBaseFilter {
|
|
69
76
|
id: string;
|
|
70
77
|
field: string;
|
|
71
78
|
value: string | null;
|
|
79
|
+
hidden?: boolean;
|
|
72
80
|
}
|
|
73
81
|
export interface IExplorerFilterStandard extends IExplorerBaseFilter {
|
|
74
82
|
attribute: IExplorerFilterStandardAttribute;
|
|
@@ -84,10 +92,17 @@ export interface IExplorerFilterThrough extends IExplorerBaseFilter {
|
|
|
84
92
|
subCondition: RecordFilterCondition | null;
|
|
85
93
|
subField: string | null;
|
|
86
94
|
}
|
|
87
|
-
export
|
|
95
|
+
export interface IExplorerFilterTree extends Omit<IExplorerBaseFilter, 'value' | 'field'> {
|
|
96
|
+
attribute: IExplorerFilterTreeAttribute;
|
|
97
|
+
condition: RecordFilterCondition | null;
|
|
98
|
+
value: string[] | null;
|
|
99
|
+
field: string[];
|
|
100
|
+
}
|
|
101
|
+
export type ExplorerFilter = IExplorerFilterStandard | IExplorerFilterLink | IExplorerFilterThrough | IExplorerFilterTree;
|
|
88
102
|
export declare const isExplorerFilterStandard: (filter: ExplorerFilter) => filter is IExplorerFilterStandard;
|
|
89
103
|
export declare const isExplorerFilterLink: (filter: ExplorerFilter) => filter is IExplorerFilterLink;
|
|
90
104
|
export declare const isExplorerFilterThrough: (filter: ExplorerFilter) => filter is IExplorerFilterThrough;
|
|
105
|
+
export declare const isExplorerFilterTree: (filter: ExplorerFilter) => filter is IExplorerFilterTree;
|
|
91
106
|
export interface IFilterDropDownProps {
|
|
92
107
|
filter: ExplorerFilter;
|
|
93
108
|
}
|
|
@@ -103,6 +118,8 @@ export interface IEntrypointTree {
|
|
|
103
118
|
export interface IEntrypointLibrary {
|
|
104
119
|
type: 'library';
|
|
105
120
|
libraryId: string;
|
|
121
|
+
valuesList?: string[];
|
|
122
|
+
allowFreeEntry?: boolean;
|
|
106
123
|
}
|
|
107
124
|
export interface IEntrypointLink {
|
|
108
125
|
type: 'link';
|
|
@@ -113,9 +130,11 @@ export interface IEntrypointLink {
|
|
|
113
130
|
export type ValidFieldFilter = Override<ViewDetailsFilterFragment, {
|
|
114
131
|
field: NonNullable<ViewDetailsFilterFragment['field']>;
|
|
115
132
|
condition: NonNullable<ViewDetailsFilterFragment['condition']>;
|
|
133
|
+
hidden: boolean;
|
|
116
134
|
}>;
|
|
117
135
|
export type ValidFieldFilterThrough = Override<ValidFieldFilter, {
|
|
118
136
|
condition: ThroughConditionFilter.THROUGH;
|
|
137
|
+
hidden: boolean;
|
|
119
138
|
}> & {
|
|
120
139
|
subField: NonNullable<ViewDetailsFilterFragment['field']>;
|
|
121
140
|
subCondition?: ViewDetailsFilterFragment['condition'];
|
|
@@ -5,4 +5,5 @@ export const isExplorerFilterLink = (filter) => [AttributeType.simple_link, Attr
|
|
|
5
5
|
filter.condition !== ThroughConditionFilter.THROUGH;
|
|
6
6
|
export const isExplorerFilterThrough = (filter) => [AttributeType.simple_link, AttributeType.advanced_link].includes(filter.attribute.type) &&
|
|
7
7
|
filter.condition === ThroughConditionFilter.THROUGH;
|
|
8
|
+
export const isExplorerFilterTree = (filter) => filter.attribute.type === AttributeType.tree;
|
|
8
9
|
//# sourceMappingURL=_types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_types.js","sourceRoot":"","sources":["../../../src/components/Explorer/_types.ts"],"names":[],"mappings":"AAIA,OAAO,EAGH,aAAa,EAMhB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAC,sBAAsB,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"_types.js","sourceRoot":"","sources":["../../../src/components/Explorer/_types.ts"],"names":[],"mappings":"AAIA,OAAO,EAGH,aAAa,EAMhB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAC,sBAAsB,EAAC,MAAM,kBAAkB,CAAC;AAiHxD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,MAAsB,EAAqC,EAAE,CAClG,CAAC,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAEnF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAsB,EAAiC,EAAE,CAC1F,CAAC,aAAa,CAAC,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;IACxF,MAAM,CAAC,SAAS,KAAK,sBAAsB,CAAC,OAAO,CAAC;AAExD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAAsB,EAAoC,EAAE,CAChG,CAAC,aAAa,CAAC,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;IACxF,MAAM,CAAC,SAAS,KAAK,sBAAsB,CAAC,OAAO,CAAC;AAExD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAsB,EAAiC,EAAE,CAC1F,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,aAAa,CAAC,IAAI,CAAC"}
|
|
@@ -12,7 +12,8 @@ import { ISubmitMultipleResult } from '../../../components/RecordEdition/EditRec
|
|
|
12
12
|
* @param onReplace - callback to let outside world know about replacing feedback
|
|
13
13
|
* @param canReplaceLinkValues - check permission to delete link values
|
|
14
14
|
*/
|
|
15
|
-
export declare const useReplaceItemAction: ({ isEnabled, onReplace, canReplaceLinkValues }: FeatureHook<{
|
|
15
|
+
export declare const useReplaceItemAction: ({ isEnabled, onReplace, isMultivalue, canReplaceLinkValues }: FeatureHook<{
|
|
16
|
+
isMultivalue: boolean;
|
|
16
17
|
onReplace?: (replaceValuesResult: ISubmitMultipleResult) => void;
|
|
17
18
|
canReplaceLinkValues: boolean;
|
|
18
19
|
}>) => {
|
|
@@ -18,7 +18,7 @@ import { LinkModal } from '../link-item/LinkModal';
|
|
|
18
18
|
* @param onReplace - callback to let outside world know about replacing feedback
|
|
19
19
|
* @param canReplaceLinkValues - check permission to delete link values
|
|
20
20
|
*/
|
|
21
|
-
export const useReplaceItemAction = ({ isEnabled, onReplace, canReplaceLinkValues }) => {
|
|
21
|
+
export const useReplaceItemAction = ({ isEnabled, onReplace, isMultivalue, canReplaceLinkValues }) => {
|
|
22
22
|
const { t } = useSharedTranslation();
|
|
23
23
|
const [isReplaceModalOpen, setIsReplaceModalOpen] = useState(false);
|
|
24
24
|
const [linkIdSelected, setLinkIdSelected] = useState();
|
|
@@ -33,7 +33,7 @@ export const useReplaceItemAction = ({ isEnabled, onReplace, canReplaceLinkValue
|
|
|
33
33
|
}), [canReplaceLinkValues]);
|
|
34
34
|
const replaceAction = useMemo(() => ({
|
|
35
35
|
replaceItemAction: isEnabled ? _replaceItemAction : null,
|
|
36
|
-
replaceItemModal: isEnabled && isReplaceModalOpen ? (_jsx(LinkModal, { open: true, linkId: linkIdSelected, onReplace: onReplace, onClose: () => {
|
|
36
|
+
replaceItemModal: isEnabled && isReplaceModalOpen ? (_jsx(LinkModal, { open: true, linkId: linkIdSelected, isMultivalue: isMultivalue, onReplace: onReplace, onClose: () => {
|
|
37
37
|
setIsReplaceModalOpen(false);
|
|
38
38
|
} })) : null
|
|
39
39
|
}), [isEnabled, isReplaceModalOpen, _replaceItemAction]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReplaceItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useReplaceItemAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAGjD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACjC,SAAS,EACT,SAAS,EACT,oBAAoB,
|
|
1
|
+
{"version":3,"file":"useReplaceItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useReplaceItemAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAGjD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACjC,SAAS,EACT,SAAS,EACT,YAAY,EACZ,oBAAoB,EAKtB,EAAE,EAAE;IACF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,EAAsB,CAAC;IAE3E,MAAM,kBAAkB,GAAgB,OAAO,CAC3C,GAAG,EAAE,CAAC,CAAC;QACH,KAAK,EAAE,CAAC,CAAC,uBAAuB,CAAE;QAClC,IAAI,EAAE,KAAC,aAAa,KAAG;QACvB,QAAQ,EAAE,CAAC,oBAAoB;QAC/B,QAAQ,EAAE,IAAI,CAAC,EAAE;YACb,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACjC,qBAAqB,CAAC,CAAC,kBAAkB,CAAC,CAAC;QAC/C,CAAC;KACJ,CAAC,EACF,CAAC,oBAAoB,CAAC,CACzB,CAAC;IAEF,MAAM,aAAa,GAAG,OAAO,CACzB,GAAG,EAAE,CAAC,CAAC;QACH,iBAAiB,EAAE,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI;QACxD,gBAAgB,EACZ,SAAS,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAC9B,KAAC,SAAS,IACN,IAAI,QACJ,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,GAAG,EAAE;gBACV,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC,GACH,CACL,CAAC,CAAC,CAAC,IAAI;KACf,CAAC,EACF,CAAC,SAAS,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CACtD,CAAC;IAEF,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { ISubmitMultipleResult } from '../../../components/RecordEdition/EditRecordContent/_types';
|
|
3
|
+
import { JoinLibraryContextFragment } from '../../../_gqlTypes';
|
|
3
4
|
import { FeatureHook, Entrypoint, IPrimaryAction } from '../_types';
|
|
4
5
|
/**
|
|
5
6
|
* Hook used to get the action for `<DataView />` component.
|
|
@@ -9,21 +10,24 @@ import { FeatureHook, Entrypoint, IPrimaryAction } from '../_types';
|
|
|
9
10
|
* It returns also two parts : one for the call action button - one for displayed the modal required by the action.
|
|
10
11
|
*
|
|
11
12
|
* @param isEnabled - whether the action is present
|
|
13
|
+
* @param isVisible - wether the button should be visible or not
|
|
12
14
|
* @param libraryId - the library's id to add new item
|
|
13
15
|
* @param entrypoint - represent the current entrypoint
|
|
14
16
|
* @param totalCount - used for display purpose only
|
|
15
17
|
* @param onCreate - callback to let outside world known about creating item (and linking)
|
|
16
18
|
* @param refetch - method to call to refresh the list. New item will be visible if it matches filters and sorts
|
|
17
19
|
*/
|
|
18
|
-
export declare const useCreatePrimaryAction: ({ isEnabled, libraryId, entrypoint, totalCount, canCreateAndLinkValue, onCreate, formId, refetch }: FeatureHook<{
|
|
20
|
+
export declare const useCreatePrimaryAction: ({ isEnabled, isVisible, libraryId, entrypoint, totalCount, canCreateAndLinkValue, isMultivalue, onCreate, formId, joinLibraryContext, refetch }: FeatureHook<{
|
|
19
21
|
libraryId: string;
|
|
20
22
|
entrypoint: Entrypoint;
|
|
21
23
|
totalCount: number;
|
|
22
24
|
canCreateAndLinkValue: boolean;
|
|
25
|
+
isMultivalue: boolean;
|
|
23
26
|
onCreate?: ({ recordIdCreated, saveValuesResultOnLink }: {
|
|
24
27
|
recordIdCreated: string;
|
|
25
28
|
saveValuesResultOnLink?: ISubmitMultipleResult;
|
|
26
29
|
}) => void;
|
|
30
|
+
joinLibraryContext?: JoinLibraryContextFragment;
|
|
27
31
|
formId?: string;
|
|
28
32
|
refetch: () => void;
|
|
29
33
|
}>) => {
|
|
@@ -8,7 +8,7 @@ import { useKitNotification } from 'aristid-ds';
|
|
|
8
8
|
import { CreateDirectory, EditRecordModal, UploadFiles } from '../../../components';
|
|
9
9
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
10
10
|
import useSaveValueBatchMutation from '../../../components/RecordEdition/EditRecordContent/hooks/useExecuteSaveValueBatchMutation';
|
|
11
|
-
import { LibraryBehavior, useExplorerLibraryDetailsQuery
|
|
11
|
+
import { LibraryBehavior, useExplorerLibraryDetailsQuery } from '../../../_gqlTypes';
|
|
12
12
|
import { CREATE_RECORD_MODAL_CLASSNAME } from '../_constants';
|
|
13
13
|
/**
|
|
14
14
|
* Hook used to get the action for `<DataView />` component.
|
|
@@ -18,33 +18,27 @@ import { CREATE_RECORD_MODAL_CLASSNAME } from '../_constants';
|
|
|
18
18
|
* It returns also two parts : one for the call action button - one for displayed the modal required by the action.
|
|
19
19
|
*
|
|
20
20
|
* @param isEnabled - whether the action is present
|
|
21
|
+
* @param isVisible - wether the button should be visible or not
|
|
21
22
|
* @param libraryId - the library's id to add new item
|
|
22
23
|
* @param entrypoint - represent the current entrypoint
|
|
23
24
|
* @param totalCount - used for display purpose only
|
|
24
25
|
* @param onCreate - callback to let outside world known about creating item (and linking)
|
|
25
26
|
* @param refetch - method to call to refresh the list. New item will be visible if it matches filters and sorts
|
|
26
27
|
*/
|
|
27
|
-
export const useCreatePrimaryAction = ({ isEnabled, libraryId, entrypoint, totalCount, canCreateAndLinkValue, onCreate, formId, refetch }) => {
|
|
28
|
+
export const useCreatePrimaryAction = ({ isEnabled, isVisible, libraryId, entrypoint, totalCount, canCreateAndLinkValue, isMultivalue, onCreate, formId, joinLibraryContext, refetch }) => {
|
|
28
29
|
const { t } = useSharedTranslation();
|
|
29
30
|
const [isModalCreationVisible, setIsModalCreationVisible] = useState(false);
|
|
30
|
-
const [multipleValues, setIsMultivalues] = useState(false);
|
|
31
31
|
const { saveValues } = useSaveValueBatchMutation();
|
|
32
32
|
const { kitNotification } = useKitNotification();
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (!attributeData) {
|
|
41
|
-
throw new Error('Unknown link attribute');
|
|
42
|
-
}
|
|
43
|
-
setIsMultivalues(attributeData.multiple_values);
|
|
44
|
-
}
|
|
33
|
+
const _getLibraryId = () => (joinLibraryContext?.mandatoryAttribute &&
|
|
34
|
+
'linked_library' in joinLibraryContext.mandatoryAttribute &&
|
|
35
|
+
joinLibraryContext.mandatoryAttribute.linked_library?.id) ||
|
|
36
|
+
libraryId;
|
|
37
|
+
const { data, loading, error } = useExplorerLibraryDetailsQuery({
|
|
38
|
+
variables: { libraryId: _getLibraryId() },
|
|
39
|
+
skip: !isEnabled
|
|
45
40
|
});
|
|
46
|
-
|
|
47
|
-
if (error || loading) {
|
|
41
|
+
if (error || loading || !isVisible) {
|
|
48
42
|
return { createPrimaryAction: null, createModal: null };
|
|
49
43
|
}
|
|
50
44
|
let canCreateRecord;
|
|
@@ -52,7 +46,7 @@ export const useCreatePrimaryAction = ({ isEnabled, libraryId, entrypoint, total
|
|
|
52
46
|
canCreateRecord = true;
|
|
53
47
|
}
|
|
54
48
|
else {
|
|
55
|
-
canCreateRecord = canCreateAndLinkValue && (
|
|
49
|
+
canCreateRecord = canCreateAndLinkValue && (isMultivalue || totalCount === 0);
|
|
56
50
|
}
|
|
57
51
|
const _createPrimaryAction = {
|
|
58
52
|
callback: () => {
|
|
@@ -71,21 +65,22 @@ export const useCreatePrimaryAction = ({ isEnabled, libraryId, entrypoint, total
|
|
|
71
65
|
let _createModal = null;
|
|
72
66
|
switch (data?.libraries?.list[0]?.behavior) {
|
|
73
67
|
case LibraryBehavior.files:
|
|
74
|
-
_createModal = (_jsx(UploadFiles, { libraryId:
|
|
68
|
+
_createModal = (_jsx(UploadFiles, { libraryId: _getLibraryId(), multiple: true, onClose: () => setIsModalCreationVisible(false), onCompleted: () => {
|
|
75
69
|
refetch();
|
|
76
70
|
_notifyNewCreation();
|
|
77
71
|
setIsModalCreationVisible(false);
|
|
78
72
|
} }));
|
|
79
73
|
break;
|
|
80
74
|
case LibraryBehavior.directories:
|
|
81
|
-
_createModal = (_jsx(CreateDirectory, { libraryId:
|
|
75
|
+
_createModal = (_jsx(CreateDirectory, { libraryId: _getLibraryId(), onClose: () => setIsModalCreationVisible(false), onCompleted: () => {
|
|
82
76
|
refetch();
|
|
83
77
|
_notifyNewCreation();
|
|
84
78
|
setIsModalCreationVisible(false);
|
|
85
79
|
} }));
|
|
86
80
|
break;
|
|
87
81
|
case LibraryBehavior.standard:
|
|
88
|
-
|
|
82
|
+
case LibraryBehavior.join:
|
|
83
|
+
_createModal = (_jsx(EditRecordModal, { className: CREATE_RECORD_MODAL_CLASSNAME, open: true, record: null, library: _getLibraryId(), creationFormId: formId, onClose: () => {
|
|
89
84
|
setIsModalCreationVisible(false);
|
|
90
85
|
}, onCreate: newRecord => {
|
|
91
86
|
refetch();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreatePrimaryAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-primary/useCreatePrimaryAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAe,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAC,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAE,eAAe,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,yBAAyB,MAAM,uFAAuF,CAAC;AAE9H,OAAO,
|
|
1
|
+
{"version":3,"file":"useCreatePrimaryAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-primary/useCreatePrimaryAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAe,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAC,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAE,eAAe,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,yBAAyB,MAAM,uFAAuF,CAAC;AAE9H,OAAO,EAEH,eAAe,EACf,8BAA8B,EACjC,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,6BAA6B,EAAC,MAAM,eAAe,CAAC;AAE5D;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,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Result } from '../../../components/RecordEdition/EditRecordContent/_types';
|
|
2
|
-
import {
|
|
2
|
+
import { FeatureHook, IPrimaryAction } from '../_types';
|
|
3
|
+
import { JoinLibraryContextFragment } from '../../../_gqlTypes';
|
|
3
4
|
/**
|
|
4
5
|
* Hook used to get the action for `<DataView />` component.
|
|
5
6
|
*
|
|
@@ -8,14 +9,16 @@ import { Entrypoint, FeatureHook, IPrimaryAction } from '../_types';
|
|
|
8
9
|
* It returns also two parts : one for the call action button - one for displaying the modal required by the action.
|
|
9
10
|
*
|
|
10
11
|
* @param isEnabled - whether the action is present
|
|
12
|
+
* @param isVisible - wether the button should be visible or not
|
|
11
13
|
* @param maxItemsLeft - the number of items that can be added
|
|
12
14
|
* @param onLink - callback to let outside world know about linking feedback
|
|
13
15
|
*/
|
|
14
|
-
export declare const useLinkPrimaryAction: ({ isEnabled,
|
|
15
|
-
entrypoint: Entrypoint;
|
|
16
|
+
export declare const useLinkPrimaryAction: ({ isEnabled, isVisible, maxItemsLeft, linkId, canAddLinkValue, joinLibraryContext, isMultivalue, onLink }: FeatureHook<{
|
|
16
17
|
linkId?: string;
|
|
17
18
|
maxItemsLeft: number | null;
|
|
18
19
|
canAddLinkValue: boolean;
|
|
20
|
+
joinLibraryContext?: JoinLibraryContextFragment;
|
|
21
|
+
isMultivalue: boolean;
|
|
19
22
|
onLink?: (saveValuesResult: ISubmitMultipleResult) => void;
|
|
20
23
|
}>) => {
|
|
21
24
|
linkPrimaryAction: IPrimaryAction;
|
|
@@ -6,7 +6,6 @@ import { useState } from 'react';
|
|
|
6
6
|
import { FaPlus } from 'react-icons/fa';
|
|
7
7
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
8
8
|
import { LinkModal } from '../link-item/LinkModal';
|
|
9
|
-
import { useExplorerLinkAttributeQuery } from '../../../_gqlTypes';
|
|
10
9
|
/**
|
|
11
10
|
* Hook used to get the action for `<DataView />` component.
|
|
12
11
|
*
|
|
@@ -15,28 +14,15 @@ import { useExplorerLinkAttributeQuery } from '../../../_gqlTypes';
|
|
|
15
14
|
* It returns also two parts : one for the call action button - one for displaying the modal required by the action.
|
|
16
15
|
*
|
|
17
16
|
* @param isEnabled - whether the action is present
|
|
17
|
+
* @param isVisible - wether the button should be visible or not
|
|
18
18
|
* @param maxItemsLeft - the number of items that can be added
|
|
19
19
|
* @param onLink - callback to let outside world know about linking feedback
|
|
20
20
|
*/
|
|
21
|
-
export const useLinkPrimaryAction = ({ isEnabled,
|
|
21
|
+
export const useLinkPrimaryAction = ({ isEnabled, isVisible, maxItemsLeft, linkId, canAddLinkValue, joinLibraryContext, isMultivalue, onLink }) => {
|
|
22
22
|
const { t } = useSharedTranslation();
|
|
23
23
|
const [isLinkModalVisible, setIsLinkModalVisible] = useState(false);
|
|
24
|
-
const [multipleValues, setIsMultivalues] = useState(false);
|
|
25
24
|
const disableAddItemAction = maxItemsLeft === 0 || !canAddLinkValue;
|
|
26
|
-
|
|
27
|
-
skip: entrypoint.type !== 'link',
|
|
28
|
-
variables: {
|
|
29
|
-
id: entrypoint.linkAttributeId
|
|
30
|
-
},
|
|
31
|
-
onCompleted: data => {
|
|
32
|
-
const attributeData = data?.attributes?.list?.[0];
|
|
33
|
-
if (!attributeData) {
|
|
34
|
-
throw new Error('Unknown link attribute');
|
|
35
|
-
}
|
|
36
|
-
setIsMultivalues(attributeData.multiple_values);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
const replacementMode = linkId && !multipleValues;
|
|
25
|
+
const replacementMode = linkId && !isMultivalue;
|
|
40
26
|
const _linkPrimaryAction = {
|
|
41
27
|
callback: () => {
|
|
42
28
|
setIsLinkModalVisible(true);
|
|
@@ -46,8 +32,8 @@ export const useLinkPrimaryAction = ({ isEnabled, maxItemsLeft, entrypoint, link
|
|
|
46
32
|
label: replacementMode ? t('record_edition.replace-by-existing-item') : t('explorer.add-existing-item')
|
|
47
33
|
};
|
|
48
34
|
return {
|
|
49
|
-
linkPrimaryAction: isEnabled ? _linkPrimaryAction : null,
|
|
50
|
-
linkModal: isLinkModalVisible ? (_jsx(LinkModal, { open: true, onLink: onLink, linkId: replacementMode ? linkId : undefined, onClose: () => {
|
|
35
|
+
linkPrimaryAction: isEnabled && isVisible ? _linkPrimaryAction : null,
|
|
36
|
+
linkModal: isLinkModalVisible ? (_jsx(LinkModal, { open: true, onLink: onLink, joinLibraryContext: joinLibraryContext, isMultivalue: isMultivalue, linkId: replacementMode ? linkId : undefined, onClose: () => {
|
|
51
37
|
setIsLinkModalVisible(false);
|
|
52
38
|
} })) : null
|
|
53
39
|
};
|