@leav/ui 0.4.0-2c820e6 → 0.4.0-33efeeca
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 +1479 -257
- package/dist/_gqlTypes/index.js +411 -45
- package/dist/_gqlTypes/index.js.map +1 -1
- package/dist/_queries/records/activateRecordsMutation.d.ts +1 -0
- package/dist/_queries/records/activateRecordsMutation.js +15 -0
- package/dist/_queries/records/activateRecordsMutation.js.map +1 -0
- package/dist/_queries/records/getRecordFormQuery.js +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.d.ts +2 -1
- package/dist/components/Explorer/DataView.js +14 -11
- package/dist/components/Explorer/DataView.js.map +1 -1
- package/dist/components/Explorer/Explorer.d.ts +8 -6
- package/dist/components/Explorer/Explorer.js +21 -8
- package/dist/components/Explorer/Explorer.js.map +1 -1
- package/dist/components/Explorer/ExplorerToolbar.d.ts +2 -1
- package/dist/components/Explorer/ExplorerToolbar.js +15 -5
- 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 +99 -31
- package/dist/components/Explorer/_queries/prepareFiltersForRequest.js.map +1 -1
- package/dist/components/Explorer/_queries/useExplorerData.js +35 -26
- package/dist/components/Explorer/_queries/useExplorerData.js.map +1 -1
- package/dist/components/Explorer/_types.d.ts +74 -9
- package/dist/components/Explorer/_types.js +5 -0
- package/dist/components/Explorer/_types.js.map +1 -1
- package/dist/components/Explorer/actions-item/{useRemoveItemAction.d.ts → useEditStatusItemAction.d.ts} +2 -2
- package/dist/components/Explorer/actions-item/{useRemoveItemAction.js → useEditStatusItemAction.js} +71 -24
- package/dist/components/Explorer/actions-item/useEditStatusItemAction.js.map +1 -0
- package/dist/components/Explorer/actions-item/useReplaceItemAction.d.ts +2 -1
- package/dist/components/Explorer/actions-item/useReplaceItemAction.js +2 -2
- package/dist/components/Explorer/actions-item/useReplaceItemAction.js.map +1 -1
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.d.ts +5 -1
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js +20 -22
- 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 +44 -4
- package/dist/components/Explorer/link-item/LinkModal.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/_shared/CommonFilterItem.js +4 -4
- package/dist/components/Explorer/manage-view-settings/_shared/CommonFilterItem.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/_shared/useTransformFilters.d.ts +9 -3
- package/dist/components/Explorer/manage-view-settings/_shared/useTransformFilters.js +81 -12
- package/dist/components/Explorer/manage-view-settings/_shared/useTransformFilters.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js +21 -8
- 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 +9 -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/FilterValueListDropDown.d.ts +9 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterValueListDropDown.js +131 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterValueListDropDown.js.map +1 -0
- 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 +3 -0
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/useConditionOptionsByType.js +43 -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 +29 -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 +57 -14
- 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/FiltersDropdown/FiltersDropdown.js +1 -12
- package/dist/components/LibraryItemsList/FiltersDropdown/FiltersDropdown.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/LibraryItemsList/FiltersPanel/Filter/Filter.utils.js +2 -2
- package/dist/components/LibraryItemsList/FiltersPanel/Filter/Filter.utils.js.map +1 -1
- package/dist/components/RecordEdition/EditRecord/EditRecord.d.ts +2 -1
- package/dist/components/RecordEdition/EditRecord/EditRecord.js +33 -214
- package/dist/components/RecordEdition/EditRecord/EditRecord.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.d.ts +3 -3
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js +15 -22
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/_types.d.ts +6 -16
- package/dist/components/RecordEdition/EditRecordContent/_types.js.map +1 -1
- 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/FormTabs/FormTabs.d.ts +2 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/FormTabs/FormTabs.js +6 -9
- package/dist/components/RecordEdition/EditRecordContent/uiElements/FormTabs/FormTabs.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/Frame.js +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/Frame.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.d.ts +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js +11 -35
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/ActionButton.d.ts +3 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/ActionButton.js +9 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/ActionButton.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/{link-record-in-edition/useLinkRecords.d.ts → link-record/useExplorerLinkRecords.d.ts} +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/{link-record-in-edition/useLinkRecords.js → link-record/useExplorerLinkRecords.js} +3 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useExplorerLinkRecords.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.d.ts +24 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/{link-record-in-edition/useLinkRecordsInEdition.js → link-record/useLinkRecords.js} +18 -47
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +27 -22
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/DSListSelect.js +3 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/DSListSelect.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TextBlock/TextBlock.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.d.ts +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js +19 -24
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.d.ts +2 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/{useDisplayTreeNode.d.ts → TreeNodeList.d.ts} +4 -4
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeList.js +5 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeList.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.d.ts +16 -4
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js +12 -13
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.d.ts +4 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js +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.d.ts +1 -0
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js +24 -6
- 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/editRecordReducer/editRecordReducer.d.ts +2 -5
- package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.js +1 -1
- package/dist/components/RecordEdition/editRecordReducer/editRecordReducer.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/{RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList → 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/contexts/LangContext/LangContext.d.ts +1 -2
- package/dist/contexts/LangContext/LangContext.js +2 -2
- package/dist/contexts/LangContext/LangContext.js.map +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useGetRecordForm/useGetRecordForm.d.ts +1 -1
- package/dist/hooks/useGetRecordForm/useGetRecordForm.js +3 -3
- package/dist/hooks/useGetRecordForm/useGetRecordForm.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/messageHandlers.d.ts +4 -2
- package/dist/hooks/useIFrameMessenger/messageHandlers.js +15 -5
- 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 +52 -10
- package/dist/hooks/useIFrameMessenger/types.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/useIFrameMessenger.d.ts +11 -1
- package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js +66 -11
- 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/hooks/useRedirectToLogin/useRedirectToLogin.js +1 -1
- package/dist/hooks/useRedirectToLogin/useRedirectToLogin.js.map +1 -1
- package/dist/locales/en/shared.json +7 -1
- package/dist/locales/fr/shared.json +6 -0
- package/dist/types/attributes.d.ts +2 -1
- package/package.json +22 -7
- package/dist/components/Explorer/actions-item/useRemoveItemAction.js.map +0 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterValueList.d.ts +0 -10
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterValueList.js +0 -75
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterValueList.js.map +0 -1
- package/dist/components/RecordEdition/EditRecord/creationErrorContext.d.ts +0 -6
- package/dist/components/RecordEdition/EditRecord/creationErrorContext.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/hooks/useCreateRecordMutation.d.ts +0 -5
- package/dist/components/RecordEdition/EditRecordContent/hooks/useCreateRecordMutation.js +0 -28
- package/dist/components/RecordEdition/EditRecordContent/hooks/useCreateRecordMutation.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/hooks/useRunActionsListAndFormatOnValue.d.ts +0 -121
- package/dist/components/RecordEdition/EditRecordContent/hooks/useRunActionsListAndFormatOnValue.js +0 -31
- package/dist/components/RecordEdition/EditRecordContent/hooks/useRunActionsListAndFormatOnValue.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useEditRecord.d.ts +0 -5
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useEditRecord.js +0 -39
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useEditRecord.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useUnselectRecord.d.ts +0 -8
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useUnselectRecord.js +0 -23
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-item/useUnselectRecord.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-mass/useUnselectAllRecords.d.ts +0 -9
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-mass/useUnselectAllRecords.js +0 -23
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-mass/useUnselectAllRecords.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useCreateRecord.d.ts +0 -8
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useCreateRecord.js +0 -26
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useCreateRecord.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useRecordSelector.d.ts +0 -12
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useRecordSelector.js +0 -24
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/action-primary/useRecordSelector.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecords.d.ts +0 -19
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecords.js +0 -103
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecords.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.d.ts +0 -22
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.js +0 -104
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-creation/useLinkRecordsInCreation.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecords.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.d.ts +0 -26
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record-in-edition/useLinkRecordsInEdition.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/LinkActionsButtons.d.ts +0 -9
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/LinkActionsButtons.js +0 -15
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/LinkActionsButtons.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/utils.d.ts +0 -4
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/utils.js +0 -22
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/utils.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/ValuesList.d.ts +0 -16
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/ValuesList.js +0 -35
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/ValuesList.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/index.d.ts +0 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardFieldValue/ValuesList/index.js.map +0 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/useDisplayTreeNode.js +0 -8
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/useDisplayTreeNode.js.map +0 -1
- package/dist/components/SelectTreeNodeModal/SelectTreeNodeModal.js.map +0 -1
- package/dist/components/SelectTreeNodeModal/index.d.ts +0 -1
- package/dist/components/SelectTreeNodeModal/index.js +0 -5
- package/dist/components/SelectTreeNodeModal/index.js.map +0 -1
package/dist/components/Explorer/actions-item/{useRemoveItemAction.js → useEditStatusItemAction.js}
RENAMED
|
@@ -3,9 +3,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
// This file is released under LGPL V3
|
|
4
4
|
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
|
-
import { FaTrash } from 'react-icons/fa';
|
|
6
|
+
import { FaTrash, FaTrashRestore } from 'react-icons/fa';
|
|
7
7
|
import { KitModal } from 'aristid-ds';
|
|
8
|
-
import { useDeactivateRecordsMutation, useDeleteValueMutation } from '../../../_gqlTypes';
|
|
8
|
+
import { useActivateRecordsMutation, useDeactivateRecordsMutation, useDeleteValueMutation } from '../../../_gqlTypes';
|
|
9
9
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
10
10
|
import { useValuesCacheUpdate } from '../../../hooks/useValuesCacheUpdate';
|
|
11
11
|
import { ViewSettingsActionTypes } from '../manage-view-settings';
|
|
@@ -22,7 +22,7 @@ import { MASS_SELECTION_ALL } from '../_constants';
|
|
|
22
22
|
* @param entrypoint - represent the current entrypoint
|
|
23
23
|
* @param canDeleteLinkValues - check permission to delete link values
|
|
24
24
|
*/
|
|
25
|
-
export const
|
|
25
|
+
export const useEditStatusItemAction = ({ isEnabled, canDeleteLinkValues, store: { view, dispatch }, onRemove, entrypoint }) => {
|
|
26
26
|
const { t } = useSharedTranslation();
|
|
27
27
|
const updateValuesCache = useValuesCacheUpdate();
|
|
28
28
|
const [deactivateRecordsMutation] = useDeactivateRecordsMutation({
|
|
@@ -44,6 +44,25 @@ export const useRemoveItemAction = ({ isEnabled, canDeleteLinkValues, store: { v
|
|
|
44
44
|
cache.gc();
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
|
+
const [activateRecordsMutation] = useActivateRecordsMutation({
|
|
48
|
+
update(cache, activatedRecords) {
|
|
49
|
+
activatedRecords.data?.activateRecords.forEach(record => {
|
|
50
|
+
cache.evict({
|
|
51
|
+
id: cache.identify(record)
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
cache.modify({
|
|
55
|
+
fields: {
|
|
56
|
+
records: prev => ({
|
|
57
|
+
...prev,
|
|
58
|
+
totalCount: prev.totalCount - 1
|
|
59
|
+
})
|
|
60
|
+
},
|
|
61
|
+
broadcast: false
|
|
62
|
+
});
|
|
63
|
+
cache.gc();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
47
66
|
const [deleteRecordLinkMutation] = useDeleteValueMutation({
|
|
48
67
|
update: (_, deletedRecord) => {
|
|
49
68
|
const parentRecord = {
|
|
@@ -55,38 +74,65 @@ export const useRemoveItemAction = ({ isEnabled, canDeleteLinkValues, store: { v
|
|
|
55
74
|
updateValuesCache(parentRecord, deletedRecord.data?.deleteValue ?? []);
|
|
56
75
|
}
|
|
57
76
|
});
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
77
|
+
const _deactivateItem = async (item) => {
|
|
78
|
+
const libRes = await deactivateRecordsMutation({
|
|
79
|
+
variables: {
|
|
80
|
+
libraryId: item.libraryId,
|
|
81
|
+
recordsIds: [item.itemId]
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
if (view.massSelection !== MASS_SELECTION_ALL) {
|
|
85
|
+
dispatch({
|
|
86
|
+
type: ViewSettingsActionTypes.SET_SELECTED_KEYS,
|
|
87
|
+
payload: view.massSelection.filter(key => key !== item.itemId)
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
onRemove?.(item);
|
|
91
|
+
return libRes;
|
|
92
|
+
};
|
|
93
|
+
const _activateItem = async (item) => {
|
|
94
|
+
const libRes = await activateRecordsMutation({
|
|
95
|
+
variables: {
|
|
96
|
+
libraryId: item.libraryId,
|
|
97
|
+
recordsIds: [item.itemId]
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
if (view.massSelection !== MASS_SELECTION_ALL) {
|
|
101
|
+
dispatch({
|
|
102
|
+
type: ViewSettingsActionTypes.SET_SELECTED_KEYS,
|
|
103
|
+
payload: view.massSelection.filter(key => key !== item.itemId)
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return libRes;
|
|
107
|
+
};
|
|
108
|
+
const _editStatusItemAction = useMemo(() => ({
|
|
109
|
+
label: (item) => entrypoint.type === 'library'
|
|
110
|
+
? item.active
|
|
111
|
+
? t('explorer.deactivate-item')
|
|
112
|
+
: t('explorer.activate-item')
|
|
113
|
+
: t('explorer.delete-item'),
|
|
114
|
+
icon: (item) => entrypoint.type === 'library' ? item.active ? _jsx(FaTrash, {}) : _jsx(FaTrashRestore, {}) : _jsx(FaTrash, {}),
|
|
61
115
|
isDanger: true,
|
|
62
|
-
disabled: (item) =>
|
|
116
|
+
disabled: (item) => entrypoint.type === 'link' ? !canDeleteLinkValues : item.active ? !item.canDelete : !item.canActivate,
|
|
63
117
|
callback: item => {
|
|
64
|
-
const { itemId,
|
|
118
|
+
const { itemId, id_value } = item;
|
|
65
119
|
KitModal.confirm({
|
|
66
120
|
type: 'confirm',
|
|
67
121
|
dangerConfirm: true,
|
|
68
122
|
content: entrypoint.type === 'library'
|
|
69
|
-
?
|
|
123
|
+
? item.active
|
|
124
|
+
? t('records_deactivation.confirm_one')
|
|
125
|
+
: t('records_activation.confirm_one')
|
|
70
126
|
: t('record_edition.delete_link_confirm'),
|
|
71
127
|
okText: t('global.submit') ?? undefined,
|
|
72
128
|
cancelText: t('global.cancel') ?? undefined,
|
|
73
129
|
onOk: async () => {
|
|
74
130
|
switch (entrypoint.type) {
|
|
75
131
|
case 'library':
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
libraryId,
|
|
79
|
-
recordsIds: [itemId]
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
if (view.massSelection !== MASS_SELECTION_ALL) {
|
|
83
|
-
dispatch({
|
|
84
|
-
type: ViewSettingsActionTypes.SET_SELECTED_KEYS,
|
|
85
|
-
payload: view.massSelection.filter(key => key !== itemId)
|
|
86
|
-
});
|
|
132
|
+
if (item.active) {
|
|
133
|
+
return _deactivateItem(item);
|
|
87
134
|
}
|
|
88
|
-
|
|
89
|
-
return libRes;
|
|
135
|
+
return _activateItem(item);
|
|
90
136
|
case 'link':
|
|
91
137
|
const linkRes = await deleteRecordLinkMutation({
|
|
92
138
|
variables: {
|
|
@@ -111,13 +157,14 @@ export const useRemoveItemAction = ({ isEnabled, canDeleteLinkValues, store: { v
|
|
|
111
157
|
t,
|
|
112
158
|
deactivateRecordsMutation,
|
|
113
159
|
deleteRecordLinkMutation,
|
|
160
|
+
activateRecordsMutation,
|
|
114
161
|
canDeleteLinkValues,
|
|
115
162
|
entrypoint.type,
|
|
116
163
|
view.massSelection,
|
|
117
164
|
dispatch
|
|
118
165
|
]);
|
|
119
166
|
return {
|
|
120
|
-
|
|
167
|
+
editStatusItemAction: isEnabled ? _editStatusItemAction : null
|
|
121
168
|
};
|
|
122
169
|
};
|
|
123
|
-
//# sourceMappingURL=
|
|
170
|
+
//# sourceMappingURL=useEditStatusItemAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEditStatusItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useEditStatusItemAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;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,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;wBAC/B,KAAK,MAAM;4BACP,MAAM,OAAO,GAAG,MAAM,wBAAwB,CAAC;gCAC3C,SAAS,EAAE;oCACP,OAAO,EAAE,UAAU,CAAC,eAAe;oCACnC,SAAS,EAAE,UAAU,CAAC,eAAe;oCACrC,QAAQ,EAAE,UAAU,CAAC,cAAc;oCACnC,KAAK,EAAE;wCACH,OAAO,EAAE,MAAM;wCACf,QAAQ;qCACX;iCACJ;6BACJ,CAAC,CAAC;4BACH,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC;4BACjB,OAAO,OAAO,CAAC;wBACnB;4BACI,OAAO;oBACf,CAAC;gBACL,CAAC;aACJ,CAAC,CAAC;QACP,CAAC;KACJ,CAAC,EACF;QACI,CAAC;QACD,yBAAyB;QACzB,wBAAwB;QACxB,uBAAuB;QACvB,mBAAmB;QACnB,UAAU,CAAC,IAAI;QACf,IAAI,CAAC,aAAa;QAClB,QAAQ;KACX,CACJ,CAAC;IAEF,OAAO;QACH,oBAAoB,EAAE,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI;KACjE,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -12,7 +12,8 @@ import { ISubmitMultipleResult } from '../../../components/RecordEdition/EditRec
|
|
|
12
12
|
* @param onReplace - callback to let outside world know about replacing feedback
|
|
13
13
|
* @param canReplaceLinkValues - check permission to delete link values
|
|
14
14
|
*/
|
|
15
|
-
export declare const useReplaceItemAction: ({ isEnabled, onReplace, canReplaceLinkValues }: FeatureHook<{
|
|
15
|
+
export declare const useReplaceItemAction: ({ isEnabled, onReplace, isMultivalue, canReplaceLinkValues }: FeatureHook<{
|
|
16
|
+
isMultivalue: boolean;
|
|
16
17
|
onReplace?: (replaceValuesResult: ISubmitMultipleResult) => void;
|
|
17
18
|
canReplaceLinkValues: boolean;
|
|
18
19
|
}>) => {
|
|
@@ -18,7 +18,7 @@ import { LinkModal } from '../link-item/LinkModal';
|
|
|
18
18
|
* @param onReplace - callback to let outside world know about replacing feedback
|
|
19
19
|
* @param canReplaceLinkValues - check permission to delete link values
|
|
20
20
|
*/
|
|
21
|
-
export const useReplaceItemAction = ({ isEnabled, onReplace, canReplaceLinkValues }) => {
|
|
21
|
+
export const useReplaceItemAction = ({ isEnabled, onReplace, isMultivalue, canReplaceLinkValues }) => {
|
|
22
22
|
const { t } = useSharedTranslation();
|
|
23
23
|
const [isReplaceModalOpen, setIsReplaceModalOpen] = useState(false);
|
|
24
24
|
const [linkIdSelected, setLinkIdSelected] = useState();
|
|
@@ -33,7 +33,7 @@ export const useReplaceItemAction = ({ isEnabled, onReplace, canReplaceLinkValue
|
|
|
33
33
|
}), [canReplaceLinkValues]);
|
|
34
34
|
const replaceAction = useMemo(() => ({
|
|
35
35
|
replaceItemAction: isEnabled ? _replaceItemAction : null,
|
|
36
|
-
replaceItemModal: isEnabled && isReplaceModalOpen ? (_jsx(LinkModal, { open: true, linkId: linkIdSelected, onReplace: onReplace, onClose: () => {
|
|
36
|
+
replaceItemModal: isEnabled && isReplaceModalOpen ? (_jsx(LinkModal, { open: true, linkId: linkIdSelected, isMultivalue: isMultivalue, onReplace: onReplace, onClose: () => {
|
|
37
37
|
setIsReplaceModalOpen(false);
|
|
38
38
|
} })) : null
|
|
39
39
|
}), [isEnabled, isReplaceModalOpen, _replaceItemAction]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReplaceItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useReplaceItemAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAGjD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACjC,SAAS,EACT,SAAS,EACT,oBAAoB,
|
|
1
|
+
{"version":3,"file":"useReplaceItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useReplaceItemAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAGjD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACjC,SAAS,EACT,SAAS,EACT,YAAY,EACZ,oBAAoB,EAKtB,EAAE,EAAE;IACF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,EAAsB,CAAC;IAE3E,MAAM,kBAAkB,GAAgB,OAAO,CAC3C,GAAG,EAAE,CAAC,CAAC;QACH,KAAK,EAAE,CAAC,CAAC,uBAAuB,CAAE;QAClC,IAAI,EAAE,KAAC,aAAa,KAAG;QACvB,QAAQ,EAAE,CAAC,oBAAoB;QAC/B,QAAQ,EAAE,IAAI,CAAC,EAAE;YACb,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACjC,qBAAqB,CAAC,CAAC,kBAAkB,CAAC,CAAC;QAC/C,CAAC;KACJ,CAAC,EACF,CAAC,oBAAoB,CAAC,CACzB,CAAC;IAEF,MAAM,aAAa,GAAG,OAAO,CACzB,GAAG,EAAE,CAAC,CAAC;QACH,iBAAiB,EAAE,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI;QACxD,gBAAgB,EACZ,SAAS,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAC9B,KAAC,SAAS,IACN,IAAI,QACJ,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,GAAG,EAAE;gBACV,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC,GACH,CACL,CAAC,CAAC,CAAC,IAAI;KACf,CAAC,EACF,CAAC,SAAS,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CACtD,CAAC;IAEF,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { ISubmitMultipleResult } from '../../../components/RecordEdition/EditRecordContent/_types';
|
|
3
|
+
import { JoinLibraryContextFragment } from '../../../_gqlTypes';
|
|
3
4
|
import { FeatureHook, Entrypoint, IPrimaryAction } from '../_types';
|
|
4
5
|
/**
|
|
5
6
|
* Hook used to get the action for `<DataView />` component.
|
|
@@ -9,21 +10,24 @@ import { FeatureHook, Entrypoint, IPrimaryAction } from '../_types';
|
|
|
9
10
|
* It returns also two parts : one for the call action button - one for displayed the modal required by the action.
|
|
10
11
|
*
|
|
11
12
|
* @param isEnabled - whether the action is present
|
|
13
|
+
* @param isVisible - wether the button should be visible or not
|
|
12
14
|
* @param libraryId - the library's id to add new item
|
|
13
15
|
* @param entrypoint - represent the current entrypoint
|
|
14
16
|
* @param totalCount - used for display purpose only
|
|
15
17
|
* @param onCreate - callback to let outside world known about creating item (and linking)
|
|
16
18
|
* @param refetch - method to call to refresh the list. New item will be visible if it matches filters and sorts
|
|
17
19
|
*/
|
|
18
|
-
export declare const useCreatePrimaryAction: ({ isEnabled, libraryId, entrypoint, totalCount, canCreateAndLinkValue, onCreate, formId, refetch }: FeatureHook<{
|
|
20
|
+
export declare const useCreatePrimaryAction: ({ isEnabled, isVisible, libraryId, entrypoint, totalCount, canCreateAndLinkValue, isMultivalue, onCreate, formId, joinLibraryContext, refetch }: FeatureHook<{
|
|
19
21
|
libraryId: string;
|
|
20
22
|
entrypoint: Entrypoint;
|
|
21
23
|
totalCount: number;
|
|
22
24
|
canCreateAndLinkValue: boolean;
|
|
25
|
+
isMultivalue: boolean;
|
|
23
26
|
onCreate?: ({ recordIdCreated, saveValuesResultOnLink }: {
|
|
24
27
|
recordIdCreated: string;
|
|
25
28
|
saveValuesResultOnLink?: ISubmitMultipleResult;
|
|
26
29
|
}) => void;
|
|
30
|
+
joinLibraryContext?: JoinLibraryContextFragment;
|
|
27
31
|
formId?: string;
|
|
28
32
|
refetch: () => void;
|
|
29
33
|
}>) => {
|
|
@@ -8,7 +8,7 @@ import { useKitNotification } from 'aristid-ds';
|
|
|
8
8
|
import { CreateDirectory, EditRecordModal, UploadFiles } from '../../../components';
|
|
9
9
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
10
10
|
import useSaveValueBatchMutation from '../../../components/RecordEdition/EditRecordContent/hooks/useExecuteSaveValueBatchMutation';
|
|
11
|
-
import { LibraryBehavior, useExplorerLibraryDetailsQuery
|
|
11
|
+
import { AttributeType, 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,41 +18,38 @@ 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;
|
|
51
|
-
if (
|
|
45
|
+
if (joinLibraryContext?.mandatoryAttribute?.type === AttributeType.tree) {
|
|
46
|
+
canCreateRecord = false;
|
|
47
|
+
}
|
|
48
|
+
else if (entrypoint.type === 'library') {
|
|
52
49
|
canCreateRecord = true;
|
|
53
50
|
}
|
|
54
51
|
else {
|
|
55
|
-
canCreateRecord = canCreateAndLinkValue && (
|
|
52
|
+
canCreateRecord = canCreateAndLinkValue && (isMultivalue || totalCount === 0);
|
|
56
53
|
}
|
|
57
54
|
const _createPrimaryAction = {
|
|
58
55
|
callback: () => {
|
|
@@ -71,21 +68,22 @@ export const useCreatePrimaryAction = ({ isEnabled, libraryId, entrypoint, total
|
|
|
71
68
|
let _createModal = null;
|
|
72
69
|
switch (data?.libraries?.list[0]?.behavior) {
|
|
73
70
|
case LibraryBehavior.files:
|
|
74
|
-
_createModal = (_jsx(UploadFiles, { libraryId:
|
|
71
|
+
_createModal = (_jsx(UploadFiles, { libraryId: _getLibraryId(), multiple: true, onClose: () => setIsModalCreationVisible(false), onCompleted: () => {
|
|
75
72
|
refetch();
|
|
76
73
|
_notifyNewCreation();
|
|
77
74
|
setIsModalCreationVisible(false);
|
|
78
75
|
} }));
|
|
79
76
|
break;
|
|
80
77
|
case LibraryBehavior.directories:
|
|
81
|
-
_createModal = (_jsx(CreateDirectory, { libraryId:
|
|
78
|
+
_createModal = (_jsx(CreateDirectory, { libraryId: _getLibraryId(), onClose: () => setIsModalCreationVisible(false), onCompleted: () => {
|
|
82
79
|
refetch();
|
|
83
80
|
_notifyNewCreation();
|
|
84
81
|
setIsModalCreationVisible(false);
|
|
85
82
|
} }));
|
|
86
83
|
break;
|
|
87
84
|
case LibraryBehavior.standard:
|
|
88
|
-
|
|
85
|
+
case LibraryBehavior.join:
|
|
86
|
+
_createModal = (_jsx(EditRecordModal, { className: CREATE_RECORD_MODAL_CLASSNAME, open: true, record: null, library: _getLibraryId(), creationFormId: formId, onClose: () => {
|
|
89
87
|
setIsModalCreationVisible(false);
|
|
90
88
|
}, onCreate: newRecord => {
|
|
91
89
|
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,EACH,aAAa,EAEb,eAAe,EACf,8BAA8B,EACjC,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,6BAA6B,EAAC,MAAM,eAAe,CAAC;AAE5D;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACnC,SAAS,EACT,SA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AAC,CAAC,CAAC,IAAI;KAC5D,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ISubmitMultipleResult } 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
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLinkPrimaryAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-primary/useLinkPrimaryAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"useLinkPrimaryAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-primary/useLinkPrimaryAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAGjD;;;;;;;;;;;GA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import { FunctionComponent } from 'react';
|
|
2
|
+
import { JoinLibraryContextFragment } from '../../../_gqlTypes';
|
|
2
3
|
import { ISubmitMultipleResult } from '../../../components/RecordEdition/EditRecordContent/_types';
|
|
3
4
|
interface ILinkModalProps {
|
|
4
5
|
open: boolean;
|
|
5
6
|
linkId?: string;
|
|
7
|
+
joinLibraryContext?: JoinLibraryContextFragment;
|
|
8
|
+
isMultivalue: boolean;
|
|
6
9
|
onClose: () => void;
|
|
7
10
|
onLink?: (saveValuesResult: ISubmitMultipleResult) => void;
|
|
8
11
|
onReplace?: (replaceValuesResult: ISubmitMultipleResult) => void;
|
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
import { jsx as _jsx } 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 { useMemo } from 'react';
|
|
2
6
|
import { useExplorerLinkAttributeQuery } from '../../../_gqlTypes';
|
|
3
7
|
import { SelectRecordForLinkModal } from '../../../components/SelectRecordForLinkModal';
|
|
4
8
|
import { useAddLinkMassAction } from './useAddLinkMassAction';
|
|
5
9
|
import { useViewSettingsContext } from '../manage-view-settings/store-view-settings/useViewSettingsContext';
|
|
6
10
|
import { useReplaceLinkMassAction } from './useReplaceLinkMassAction';
|
|
7
11
|
import { LINK_RECORDS_MODAL_CLASSNAME } from '../_constants';
|
|
8
|
-
|
|
12
|
+
import { SelectTreeNodeModal } from '../../../components';
|
|
13
|
+
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
14
|
+
export const LinkModal = ({ open, linkId, joinLibraryContext, isMultivalue, onLink, onReplace, onClose }) => {
|
|
15
|
+
const { t } = useSharedTranslation();
|
|
9
16
|
const { view } = useViewSettingsContext();
|
|
17
|
+
const linkedLibraryId = joinLibraryContext &&
|
|
18
|
+
'linked_library' in joinLibraryContext.mandatoryAttribute &&
|
|
19
|
+
joinLibraryContext.mandatoryAttribute.linked_library?.id;
|
|
20
|
+
const linkedTreeId = joinLibraryContext &&
|
|
21
|
+
'linked_tree' in joinLibraryContext.mandatoryAttribute &&
|
|
22
|
+
joinLibraryContext.mandatoryAttribute.linked_tree?.id;
|
|
23
|
+
const isReplacement = !!linkId;
|
|
10
24
|
const { data: attributeData } = useExplorerLinkAttributeQuery({
|
|
11
25
|
skip: view.entrypoint.type !== 'link',
|
|
12
26
|
variables: {
|
|
13
27
|
id: view.entrypoint.linkAttributeId
|
|
14
28
|
}
|
|
15
29
|
});
|
|
16
|
-
const isMultiple = attributeData?.attributes?.list?.[0]?.multiple_values;
|
|
17
|
-
const isReplacement = !!linkId;
|
|
18
30
|
const { createLinks } = useAddLinkMassAction({
|
|
19
31
|
store: { view },
|
|
20
32
|
linkAttributeId: view.entrypoint.linkAttributeId,
|
|
@@ -28,6 +40,34 @@ export const LinkModal = ({ open, linkId, onLink, onReplace, onClose }) => {
|
|
|
28
40
|
onReplace,
|
|
29
41
|
closeModal: onClose
|
|
30
42
|
});
|
|
31
|
-
|
|
43
|
+
const linkAttributeData = attributeData?.attributes?.list[0];
|
|
44
|
+
const isValuesListEnabled = linkAttributeData && 'valuesList' in linkAttributeData && linkAttributeData.valuesList?.enable;
|
|
45
|
+
const valuesList = useMemo(() => (isValuesListEnabled ? linkAttributeData.valuesList?.linkedValues?.map(value => value.id) : undefined), [isValuesListEnabled, linkAttributeData]);
|
|
46
|
+
const allowFreeEntry = useMemo(() => (isValuesListEnabled ? Boolean(linkAttributeData.valuesList?.allowFreeEntry) : false), [isValuesListEnabled, linkAttributeData]);
|
|
47
|
+
return linkedTreeId ? (_jsx(SelectTreeNodeModal, { open: true, attribute: {
|
|
48
|
+
multiple_values: isMultivalue,
|
|
49
|
+
linked_tree: {
|
|
50
|
+
id: linkedTreeId
|
|
51
|
+
}
|
|
52
|
+
}, title: t(isMultivalue ? 'tree-node-selection.title_many' : 'tree-node-selection.title'),
|
|
53
|
+
// We can select new node(s), ignoring current value(s).
|
|
54
|
+
// Selected element might be duplicated in link attribute in backend for now.
|
|
55
|
+
backendValues: [], onClose: onClose, onConfirm: selectedNodes => {
|
|
56
|
+
const nodeIds = selectedNodes.map(node => node.id);
|
|
57
|
+
if (isReplacement) {
|
|
58
|
+
replaceLink({
|
|
59
|
+
records: {
|
|
60
|
+
list: nodeIds.map(id => ({ id }))
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
createLinks({
|
|
66
|
+
records: {
|
|
67
|
+
list: nodeIds.map(id => ({ id }))
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
} })) : (_jsx(SelectRecordForLinkModal, { className: LINK_RECORDS_MODAL_CLASSNAME, open: open, childLibraryId: linkedLibraryId || view.libraryId, onSelectionCompleted: isReplacement ? replaceLink : createLinks, replacementMode: isReplacement, selectionMode: isReplacement || !isMultivalue ? 'simple' : 'multiple', hideSelectAllAction: (isReplacement || !isMultivalue) && view.entrypoint.type === 'link', valuesList: valuesList, allowFreeEntry: allowFreeEntry, onClose: onClose }));
|
|
32
72
|
};
|
|
33
73
|
//# sourceMappingURL=LinkModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkModal.js","sourceRoot":"","sources":["../../../../src/components/Explorer/link-item/LinkModal.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"LinkModal.js","sourceRoot":"","sources":["../../../../src/components/Explorer/link-item/LinkModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAoB,OAAO,EAAC,MAAM,OAAO,CAAC;AACjD,OAAO,EAA6B,6BAA6B,EAAC,MAAM,eAAe,CAAC;AAExF,OAAO,EAAC,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AAEjF,OAAO,EAAC,oBAAoB,EAAC,MAAM,w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8
|
`;
|
|
9
|
-
const
|
|
10
|
-
if (nullValueConditions.includes(filter.condition)) {
|
|
9
|
+
const getFilterValues = (filter) => {
|
|
10
|
+
if (filter.condition && nullValueConditions.includes(filter.condition)) {
|
|
11
11
|
return [filter.condition];
|
|
12
12
|
}
|
|
13
|
-
return filter.value ? [filter.value] : [];
|
|
13
|
+
return Array.isArray(filter.value) ? filter.value : filter.value ? [filter.value] : [];
|
|
14
14
|
};
|
|
15
|
-
export const CommonFilterItem = ({ filter, disabled }) => (_jsx(FilterStyled, { expandable: true, disabled: disabled, label: filter.attribute.label, values:
|
|
15
|
+
export const CommonFilterItem = ({ filter, disabled }) => (_jsx(FilterStyled, { expandable: true, disabled: disabled, label: filter.attribute.label, values: getFilterValues(filter), dropDownProps: {
|
|
16
16
|
placement: 'bottomLeft',
|
|
17
17
|
dropdownRender: () => _jsx(FilterDropDown, { filter: filter })
|
|
18
18
|
} }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonFilterItem.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/_shared/CommonFilterItem.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,cAAc,EAAC,MAAM,4CAA4C,CAAC;AAC1E,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAErC,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAE3D,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;;CAErC,CAAC;AAEF,MAAM,
|
|
1
|
+
{"version":3,"file":"CommonFilterItem.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/_shared/CommonFilterItem.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,cAAc,EAAC,MAAM,4CAA4C,CAAC;AAC1E,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAErC,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAE3D,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;;CAErC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,MAAsB,EAAE,EAAE;IAC/C,IAAI,MAAM,CAAC,SAAS,IAAI,mBAAmB,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;QACrE,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3F,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAoE,CAAC,EAC9F,MAAM,EACN,QAAQ,EACX,EAAE,EAAE,CAAC,CACF,KAAC,YAAY,IACT,UAAU,QACV,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK,EAC7B,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC,EAC/B,aAAa,EAAE;QACX,SAAS,EAAE,YAAY;QACvB,cAAc,EAAE,GAAG,EAAE,CAAC,KAAC,cAAc,IAAC,MAAM,EAAE,MAAM,GAAI;KAC3D,GACH,CACL,CAAC"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { ExplorerAttributesQuery, ExplorerLinkAttributeQuery, GetViewsListQuery, LinkAttributeDetailsFragment, ViewDetailsFilterFragment } from '../../../../_gqlTypes';
|
|
2
|
-
import { ExplorerFilter, ValidFieldFilter, ValidFieldFilterThrough, validFilter } from '../../_types';
|
|
1
|
+
import { ExplorerAttributesQuery, ExplorerLinkAttributeQuery, GetViewsListQuery, LinkAttributeDetailsFragment, StandardAttributeDetailsFragment, ViewDetailsFilterFragment } from '../../../../_gqlTypes';
|
|
2
|
+
import { ExplorerFilter, ValidFieldFilter, ValidFieldFilterLinkValuesList, ValidFieldFilterStandardValuesList, ValidFieldFilterThrough, validFilter } from '../../_types';
|
|
3
3
|
export declare const _isValidFieldFilter: (filter: ViewDetailsFilterFragment | ExplorerFilter) => filter is ValidFieldFilter;
|
|
4
|
-
export declare const _isValidFieldFilterThrough: (filter:
|
|
4
|
+
export declare const _isValidFieldFilterThrough: (filter: validFilter) => filter is ValidFieldFilterThrough;
|
|
5
|
+
export declare const _isValidFieldFilterStandardValuesList: (filter: validFilter, attribute: NonNullable<ExplorerAttributesQuery["attributes"]>["list"][number]) => filter is ValidFieldFilterStandardValuesList & {
|
|
6
|
+
attribute: StandardAttributeDetailsFragment;
|
|
7
|
+
};
|
|
8
|
+
export declare const _isValidFieldFilterLinkValuesList: (filter: validFilter, attribute: NonNullable<ExplorerAttributesQuery["attributes"]>["list"][number]) => filter is ValidFieldFilterLinkValuesList & {
|
|
9
|
+
attribute: LinkAttributeDetailsFragment;
|
|
10
|
+
};
|
|
5
11
|
export declare const _isLinkAttributeDetails: (linkAttributeData: NonNullable<ExplorerLinkAttributeQuery["attributes"]>["list"][number]) => linkAttributeData is LinkAttributeDetailsFragment & {
|
|
6
12
|
id: string;
|
|
7
13
|
multiple_values: boolean;
|