@leav/ui 1.6.0-dfb71145 → 1.6.0-e751f378
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_gqlTypes/index.d.ts +889 -686
- package/dist/_gqlTypes/index.js +98 -43
- package/dist/_gqlTypes/index.js.map +1 -1
- package/dist/_queries/trees/treeNodeChildrenQuery.js +2 -0
- package/dist/_queries/trees/treeNodeChildrenQuery.js.map +1 -1
- package/dist/_queries/views/viewDetailsFragment.js +1 -0
- package/dist/_queries/views/viewDetailsFragment.js.map +1 -1
- package/dist/components/AttributesSelectionList/sharedComponents.d.ts +159 -153
- package/dist/components/Explorer/Explorer.js +5 -3
- package/dist/components/Explorer/Explorer.js.map +1 -1
- package/dist/components/Explorer/ExplorerFiltersAndSorts.js +1 -1
- package/dist/components/Explorer/ExplorerFiltersAndSorts.js.map +1 -1
- package/dist/components/Explorer/TableCell.js +6 -7
- package/dist/components/Explorer/TableCell.js.map +1 -1
- package/dist/components/Explorer/TableNameCell.js +3 -2
- package/dist/components/Explorer/TableNameCell.js.map +1 -1
- package/dist/components/Explorer/_queries/useExplorerData.d.ts +7 -7
- package/dist/components/Explorer/actions-item/useEditStatusItemAction.js +3 -2
- package/dist/components/Explorer/actions-item/useEditStatusItemAction.js.map +1 -1
- package/dist/components/Explorer/actions-item/useReplaceItemAction.d.ts +2 -1
- package/dist/components/Explorer/actions-item/useReplaceItemAction.js +5 -4
- package/dist/components/Explorer/actions-item/useReplaceItemAction.js.map +1 -1
- package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.d.ts +10 -0
- package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.js +46 -0
- package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.js.map +1 -0
- package/dist/components/Explorer/actions-mass/export/content/NoProfiles.d.ts +1 -0
- package/dist/components/Explorer/actions-mass/export/content/NoProfiles.js +17 -0
- package/dist/components/Explorer/actions-mass/export/content/NoProfiles.js.map +1 -0
- package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.d.ts +8 -0
- package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.js +49 -0
- package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.js.map +1 -0
- package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.d.ts +27 -0
- package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.js +48 -0
- package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.js.map +1 -0
- package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js +3 -2
- package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js.map +1 -1
- package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js +3 -2
- package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js.map +1 -1
- package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js +3 -2
- package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js.map +1 -1
- package/dist/components/Explorer/actions-mass/useExportMassAction.d.ts +7 -4
- package/dist/components/Explorer/actions-mass/useExportMassAction.js +80 -73
- package/dist/components/Explorer/actions-mass/useExportMassAction.js.map +1 -1
- package/dist/components/Explorer/actions-mass/useMassActions.js +3 -2
- package/dist/components/Explorer/actions-mass/useMassActions.js.map +1 -1
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js +3 -2
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js.map +1 -1
- package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.d.ts +2 -1
- package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js +5 -4
- package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js.map +1 -1
- package/dist/components/Explorer/link-item/LinkModal.d.ts +1 -0
- package/dist/components/Explorer/link-item/LinkModal.js +2 -2
- package/dist/components/Explorer/link-item/LinkModal.js.map +1 -1
- package/dist/components/Explorer/list-saved-views/SavedViews.js +4 -3
- package/dist/components/Explorer/list-saved-views/SavedViews.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.js +5 -8
- package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.js +3 -2
- package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js +7 -6
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.js +3 -2
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js +4 -3
- package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/router-menu/SettingItem.js +3 -2
- package/dist/components/Explorer/manage-view-settings/router-menu/SettingItem.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js +3 -2
- package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js +3 -2
- package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js +3 -0
- package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js +3 -2
- package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js +4 -3
- package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.js +3 -2
- package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js +3 -2
- package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js +3 -2
- package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/useUpdateView.js +3 -2
- package/dist/components/Explorer/manage-view-settings/save-view/useUpdateView.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.js +7 -6
- package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.js +3 -2
- package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.js.map +1 -1
- package/dist/components/Filters/FiltersProvider.d.ts +2 -2
- package/dist/components/Filters/FiltersProvider.js.map +1 -1
- package/dist/components/Filters/_types.d.ts +3 -0
- package/dist/components/Filters/_types.js.map +1 -1
- package/dist/components/Filters/context/filtersReducer.js +5 -1
- package/dist/components/Filters/context/filtersReducer.js.map +1 -1
- package/dist/components/Filters/filter-items/CommonFilterItem.d.ts +1 -0
- package/dist/components/Filters/filter-items/CommonFilterItem.js +28 -8
- package/dist/components/Filters/filter-items/CommonFilterItem.js.map +1 -1
- package/dist/components/Filters/filter-items/EmptyValueCheckbox.d.ts +8 -0
- package/dist/components/Filters/filter-items/EmptyValueCheckbox.js +16 -0
- package/dist/components/Filters/filter-items/EmptyValueCheckbox.js.map +1 -0
- package/dist/components/Filters/filter-items/filter-type/BooleanAttributeDropdown.js +23 -9
- package/dist/components/Filters/filter-items/filter-type/BooleanAttributeDropdown.js.map +1 -1
- package/dist/components/Filters/filter-items/filter-type/ColorAttributeDropDown.js +9 -8
- package/dist/components/Filters/filter-items/filter-type/ColorAttributeDropDown.js.map +1 -1
- package/dist/components/Filters/filter-items/filter-type/FilterDropDown.js +4 -3
- package/dist/components/Filters/filter-items/filter-type/FilterDropDown.js.map +1 -1
- package/dist/components/Filters/filter-items/filter-type/FilterDropdownContent.js +1 -1
- package/dist/components/Filters/filter-items/filter-type/FilterDropdownContent.js.map +1 -1
- package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.d.ts +0 -1
- package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js +17 -23
- package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js.map +1 -1
- package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js +10 -12
- package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js.map +1 -1
- package/dist/components/Filters/filter-items/filter-type/useConditionOptionsByType.js +3 -13
- package/dist/components/Filters/filter-items/filter-type/useConditionOptionsByType.js.map +1 -1
- package/dist/components/Filters/index.d.ts +1 -0
- package/dist/components/Filters/index.js +1 -0
- package/dist/components/Filters/index.js.map +1 -1
- package/dist/components/Filters/prepareFiltersForRequest.js +36 -3
- package/dist/components/Filters/prepareFiltersForRequest.js.map +1 -1
- package/dist/components/Filters/useFilters.d.ts +5 -0
- package/dist/components/Filters/useTransformFilters.js +4 -0
- package/dist/components/Filters/useTransformFilters.js.map +1 -1
- package/dist/components/LibraryItemsList/FiltersPanel/FiltersOptions.js +1 -8
- package/dist/components/LibraryItemsList/FiltersPanel/FiltersOptions.js.map +1 -1
- package/dist/components/LibraryItemsList/MenuView/MenuView.js +4 -4
- package/dist/components/LibraryItemsList/MenuView/MenuView.js.map +1 -1
- package/dist/components/LibraryItemsList/ViewPanel/View/View.js +3 -2
- package/dist/components/LibraryItemsList/ViewPanel/View/View.js.map +1 -1
- package/dist/components/Notifications/hooks/useNotificationSubscription.js +3 -2
- package/dist/components/Notifications/hooks/useNotificationSubscription.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/ValuesVersionBtn.js +5 -20
- package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/ValuesVersionBtn.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js +4 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.d.ts +53 -51
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +4 -3
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js +9 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeFieldWrapper.d.ts +53 -51
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js +3 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.d.ts +2 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js +4 -7
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.d.ts +3 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js +2 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js +3 -2
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.js +3 -2
- package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js +4 -3
- package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js +3 -2
- package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js.map +1 -1
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.d.ts +1 -0
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js +7 -7
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js.map +1 -1
- package/dist/components/SelectTreeNode/SelectTreeNode.d.ts +2 -1
- package/dist/components/SelectTreeNode/SelectTreeNode.js +3 -3
- package/dist/components/SelectTreeNode/SelectTreeNode.js.map +1 -1
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.d.ts +2 -1
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.js +6 -2
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.js.map +1 -1
- package/dist/components/SelectTreeNode/TreeNodeTitle.js +3 -2
- package/dist/components/SelectTreeNode/TreeNodeTitle.js.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/constants.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/messageHandlers.d.ts +2 -1
- package/dist/hooks/useIFrameMessenger/messageHandlers.js +8 -0
- package/dist/hooks/useIFrameMessenger/messageHandlers.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/schema.d.ts +3 -0
- package/dist/hooks/useIFrameMessenger/schema.js +1 -0
- package/dist/hooks/useIFrameMessenger/schema.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/types.d.ts +12 -2
- package/dist/hooks/useIFrameMessenger/types.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/useIFrameMessenger.d.ts +1 -0
- package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js +15 -0
- package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js.map +1 -1
- package/dist/hooks/useIFrameMessengerClient/iFrameMessengerClientContext.d.ts +1 -0
- package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.d.ts +1 -0
- package/dist/locales/en/shared.json +15 -3
- package/dist/locales/fr/shared.json +15 -3
- package/package.json +12 -10
|
@@ -3,9 +3,10 @@ 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, useState } from 'react';
|
|
6
|
-
import { FaExchangeAlt } from 'react-icons/fa';
|
|
7
6
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
8
7
|
import { LinkModal } from '../link-item/LinkModal';
|
|
8
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
9
|
+
import { faExchangeAlt } from '@fortawesome/free-solid-svg-icons';
|
|
9
10
|
/**
|
|
10
11
|
* Hook used to get the action for `<DataView />` component.
|
|
11
12
|
*
|
|
@@ -18,13 +19,13 @@ import { LinkModal } from '../link-item/LinkModal';
|
|
|
18
19
|
* @param onReplace - callback to let outside world know about replacing feedback
|
|
19
20
|
* @param canReplaceLinkValues - check permission to delete link values
|
|
20
21
|
*/
|
|
21
|
-
export const useReplaceItemAction = ({ isEnabled, onReplace, isMultivalue, canReplaceLinkValues, }) => {
|
|
22
|
+
export const useReplaceItemAction = ({ isEnabled, onReplace, isMultivalue, canReplaceLinkValues, columnsToDisplay, }) => {
|
|
22
23
|
const { t } = useSharedTranslation();
|
|
23
24
|
const [isReplaceModalOpen, setIsReplaceModalOpen] = useState(false);
|
|
24
25
|
const [linkIdSelected, setLinkIdSelected] = useState();
|
|
25
26
|
const _replaceItemAction = useMemo(() => ({
|
|
26
27
|
label: t('explorer.replace-item'),
|
|
27
|
-
icon: _jsx(
|
|
28
|
+
icon: _jsx(FontAwesomeIcon, { icon: faExchangeAlt }),
|
|
28
29
|
disabled: !canReplaceLinkValues,
|
|
29
30
|
callback: item => {
|
|
30
31
|
setLinkIdSelected(item.id_value);
|
|
@@ -35,7 +36,7 @@ export const useReplaceItemAction = ({ isEnabled, onReplace, isMultivalue, canRe
|
|
|
35
36
|
replaceItemAction: isEnabled ? _replaceItemAction : null,
|
|
36
37
|
replaceItemModal: isEnabled && isReplaceModalOpen ? (_jsx(LinkModal, { open: true, linkId: linkIdSelected, isMultivalue: isMultivalue, onReplace: onReplace, onClose: () => {
|
|
37
38
|
setIsReplaceModalOpen(false);
|
|
38
|
-
} })) : null,
|
|
39
|
+
}, columnsToDisplay: columnsToDisplay })) : null,
|
|
39
40
|
}), [isEnabled, isReplaceModalOpen, _replaceItemAction]);
|
|
40
41
|
return replaceAction;
|
|
41
42
|
};
|
|
@@ -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,
|
|
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,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,aAAa,EAAC,MAAM,mCAAmC,CAAC;AAEhE;;;;;;;;;;;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E,kBAAkB,CAAC,CACtD,CAAC;IAEF,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {useMemo, useState} from 'react';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type FeatureHook, type IItemAction} from '../_types';\nimport {LinkModal} from '../link-item/LinkModal';\nimport {type ISubmitMultipleResult} from '_ui/components/RecordEdition/EditRecordContent/_types';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faExchangeAlt} from '@fortawesome/free-solid-svg-icons';\n\n/**\n * Hook used to get the action for `<DataView />` component.\n *\n * When the mutation for replaceing is done, the Apollo cache will be refreshed (`Record` and `RecordIdentity`)\n * from only replaceed record.\n *\n * It returns also two parts : one for the action button call - one for displaying the modal required by the action.\n *\n * @param isEnabled - whether the action is present\n * @param onReplace - callback to let outside world know about replacing feedback\n * @param canReplaceLinkValues - check permission to delete link values\n */\nexport const useReplaceItemAction = ({\n isEnabled,\n onReplace,\n isMultivalue,\n canReplaceLinkValues,\n columnsToDisplay,\n}: FeatureHook<{\n isMultivalue: boolean;\n onReplace?: (replaceValuesResult: ISubmitMultipleResult) => void;\n canReplaceLinkValues: boolean;\n columnsToDisplay: string[];\n}>) => {\n const {t} = useSharedTranslation();\n const [isReplaceModalOpen, setIsReplaceModalOpen] = useState(false);\n const [linkIdSelected, setLinkIdSelected] = useState<string | undefined>();\n\n const _replaceItemAction: IItemAction = useMemo(\n () => ({\n label: t('explorer.replace-item')!,\n icon: <FontAwesomeIcon icon={faExchangeAlt} />,\n disabled: !canReplaceLinkValues,\n callback: item => {\n setLinkIdSelected(item.id_value);\n setIsReplaceModalOpen(!isReplaceModalOpen);\n },\n }),\n [canReplaceLinkValues],\n );\n\n const replaceAction = useMemo(\n () => ({\n replaceItemAction: isEnabled ? _replaceItemAction : null,\n replaceItemModal:\n isEnabled && isReplaceModalOpen ? (\n <LinkModal\n open\n linkId={linkIdSelected}\n isMultivalue={isMultivalue}\n onReplace={onReplace}\n onClose={() => {\n setIsReplaceModalOpen(false);\n }}\n columnsToDisplay={columnsToDisplay}\n />\n ) : null,\n }),\n [isEnabled, isReplaceModalOpen, _replaceItemAction],\n );\n\n return replaceAction;\n};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type FunctionComponent } from 'react';
|
|
2
|
+
interface IExportProfileSelectionModalProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
libraryId: string;
|
|
5
|
+
isLoading?: boolean;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
onConfirm: (profileLabel: string) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const ExportProfileSelectionModal: FunctionComponent<IExportProfileSelectionModalProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
|
|
3
|
+
// This file is released under LGPL V3
|
|
4
|
+
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
|
+
import { KitButton, KitSpace, KitModal, KitLoader } from 'aristid-ds';
|
|
7
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
8
|
+
import { faXmark, faPlay } from '@fortawesome/free-solid-svg-icons';
|
|
9
|
+
import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
|
|
10
|
+
import { useGetLibraryExportProfiles } from './useGetLibraryExportProfiles';
|
|
11
|
+
import styled from 'styled-components';
|
|
12
|
+
import { NoProfiles } from './content/NoProfiles';
|
|
13
|
+
import { ProfilesSelection } from './content/ProfilesSelection';
|
|
14
|
+
const LoaderWrapper = styled.div `
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
align-items: center;
|
|
18
|
+
height: 100%;
|
|
19
|
+
`;
|
|
20
|
+
export const ExportProfileSelectionModal = ({ open, libraryId, isLoading = false, onClose, onConfirm, }) => {
|
|
21
|
+
const { t } = useSharedTranslation();
|
|
22
|
+
const [selectedProfile, setSelectedProfile] = useState('');
|
|
23
|
+
const { profiles, defaultProfile, loading: queryLoading, } = useGetLibraryExportProfiles({
|
|
24
|
+
libraryId,
|
|
25
|
+
skip: !open,
|
|
26
|
+
});
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (profiles.length > 0) {
|
|
29
|
+
setSelectedProfile(defaultProfile || profiles[0]?.label || '');
|
|
30
|
+
}
|
|
31
|
+
}, [profiles, defaultProfile]);
|
|
32
|
+
const _handleConfirm = () => {
|
|
33
|
+
if (selectedProfile) {
|
|
34
|
+
onConfirm(selectedProfile);
|
|
35
|
+
onClose();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const _handleClose = () => {
|
|
39
|
+
onClose();
|
|
40
|
+
};
|
|
41
|
+
const selectedProfileData = profiles.find(p => p.label === selectedProfile);
|
|
42
|
+
const noProfiles = !queryLoading && !profiles?.length;
|
|
43
|
+
const hasProfiles = !queryLoading && profiles?.length;
|
|
44
|
+
return (_jsxs(KitModal, { appElement: document.getElementById('root'), isOpen: open, close: _handleClose, title: t('explorer.export_profile_modal.title'), height: "60vh", width: "70vw", closeIcon: _jsx(FontAwesomeIcon, { icon: faXmark }), showCloseIcon: true, destroyOnClose: true, footer: _jsxs(KitSpace, { children: [_jsx(KitButton, { size: "m", icon: _jsx(FontAwesomeIcon, { icon: faXmark }), onClick: _handleClose, children: t('global.cancel') }), _jsx(KitButton, { type: "primary", size: "m", icon: _jsx(FontAwesomeIcon, { icon: faPlay }), loading: isLoading, disabled: !selectedProfile || !!selectedProfileData?.error || isLoading, onClick: _handleConfirm, children: t('explorer.export_profile_modal.export_button') })] }), children: [queryLoading && (_jsx(LoaderWrapper, { children: _jsx(KitLoader, {}) })), noProfiles && _jsx(NoProfiles, {}), hasProfiles && (_jsx(ProfilesSelection, { profiles: profiles, selectedProfile: selectedProfile, setSelectedProfile: setSelectedProfile }))] }));
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=ExportProfileSelectionModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExportProfileSelectionModal.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/export/ExportProfileSelectionModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAClE,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AACpE,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,OAAO,EAAE,MAAM,EAAC,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,2BAA2B,EAAC,MAAM,+BAA+B,CAAC;AAC1E,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAU9D,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;CAK/B,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAyD,CAAC,EAC9F,IAAI,EACJ,SAAS,EACT,SAAS,GAAG,KAAK,EACjB,OAAO,EACP,SAAS,GACZ,EAAE,EAAE;IACD,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAE3D,MAAM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,IAAC,IAAI,EAAC,GAAG,EAAC,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,OAAO,GAAI,EAAE,OAAO,EAAE,YAAY,YAC9E,CAAC,CAAC,eAAe,CAAC,GACX,EACZ,KAAC,SAAS,IACN,IAAI,EAAC,SAAS,EACd,IAAI,EAAC,GAAG,EACR,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,MAAM,GAAI,EACvC,OAAO,EAAE,SAAS,EAClB,QAAQ,EAAE,CAAC,eAAe,IAAI,CAAC,CAAC,mBAAmB,EAAE,KAAK,IAAI,SAAS,EACvE,OAAO,EAAE,cAAc,YAEtB,CAAC,CAAC,6CAA6C,CAAC,GACzC,IACL,aAGd,YAAY,IAAI,CACb,KAAC,aAAa,cACV,KAAC,SAAS,KAAG,GACD,CACnB,EACA,UAAU,IAAI,KAAC,UAAU,KAAG,EAC5B,WAAW,IAAI,CACZ,KAAC,iBAAiB,IACd,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAChC,kBAAkB,EAAE,kBAAkB,GACxC,CACL,IACM,CACd,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type FunctionComponent, useEffect, useState} from 'react';\nimport {KitButton, KitSpace, KitModal, KitLoader} from 'aristid-ds';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faXmark, faPlay} from '@fortawesome/free-solid-svg-icons';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {useGetLibraryExportProfiles} from './useGetLibraryExportProfiles';\nimport styled from 'styled-components';\nimport {NoProfiles} from './content/NoProfiles';\nimport {ProfilesSelection} from './content/ProfilesSelection';\n\ninterface IExportProfileSelectionModalProps {\n open: boolean;\n libraryId: string;\n isLoading?: boolean;\n onClose: () => void;\n onConfirm: (profileLabel: string) => void;\n}\n\nconst LoaderWrapper = styled.div`\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n`;\n\nexport const ExportProfileSelectionModal: FunctionComponent<IExportProfileSelectionModalProps> = ({\n open,\n libraryId,\n isLoading = false,\n onClose,\n onConfirm,\n}) => {\n const {t} = useSharedTranslation();\n const [selectedProfile, setSelectedProfile] = useState('');\n\n const {\n profiles,\n defaultProfile,\n loading: queryLoading,\n } = useGetLibraryExportProfiles({\n libraryId,\n skip: !open,\n });\n\n useEffect(() => {\n if (profiles.length > 0) {\n setSelectedProfile(defaultProfile || profiles[0]?.label || '');\n }\n }, [profiles, defaultProfile]);\n\n const _handleConfirm = () => {\n if (selectedProfile) {\n onConfirm(selectedProfile);\n onClose();\n }\n };\n\n const _handleClose = () => {\n onClose();\n };\n\n const selectedProfileData = profiles.find(p => p.label === selectedProfile);\n\n const noProfiles = !queryLoading && !profiles?.length;\n const hasProfiles = !queryLoading && profiles?.length;\n\n return (\n <KitModal\n appElement={document.getElementById('root')}\n isOpen={open}\n close={_handleClose}\n title={t('explorer.export_profile_modal.title')}\n height=\"60vh\"\n width=\"70vw\"\n closeIcon={<FontAwesomeIcon icon={faXmark} />}\n showCloseIcon\n destroyOnClose\n footer={\n <KitSpace>\n <KitButton size=\"m\" icon={<FontAwesomeIcon icon={faXmark} />} onClick={_handleClose}>\n {t('global.cancel')}\n </KitButton>\n <KitButton\n type=\"primary\"\n size=\"m\"\n icon={<FontAwesomeIcon icon={faPlay} />}\n loading={isLoading}\n disabled={!selectedProfile || !!selectedProfileData?.error || isLoading}\n onClick={_handleConfirm}\n >\n {t('explorer.export_profile_modal.export_button')}\n </KitButton>\n </KitSpace>\n }\n >\n {queryLoading && (\n <LoaderWrapper>\n <KitLoader />\n </LoaderWrapper>\n )}\n {noProfiles && <NoProfiles />}\n {hasProfiles && (\n <ProfilesSelection\n profiles={profiles}\n selectedProfile={selectedProfile}\n setSelectedProfile={setSelectedProfile}\n />\n )}\n </KitModal>\n );\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const NoProfiles: () => JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
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 { KitEmpty, KitSpace } from 'aristid-ds';
|
|
6
|
+
import { useSharedTranslation } from '../../../../../hooks/useSharedTranslation';
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
const NoProfilesSpacer = styled(KitSpace) `
|
|
9
|
+
justify-content: center;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
`;
|
|
13
|
+
export const NoProfiles = () => {
|
|
14
|
+
const { t } = useSharedTranslation();
|
|
15
|
+
return (_jsx(NoProfilesSpacer, { direction: "vertical", size: "m", children: _jsx(KitEmpty, { image: KitEmpty.ASSET_LIST, title: t('explorer.export_profile_modal.no_profiles'), description: t('explorer.export_profile_modal.contact_admin') }) }));
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=NoProfiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoProfiles.js","sourceRoot":"","sources":["../../../../../../src/components/Explorer/actions-mass/export/content/NoProfiles.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,gBAAgB,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;;;;CAIxC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC3B,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,OAAO,CACH,KAAC,gBAAgB,IAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,GAAG,YAC3C,KAAC,QAAQ,IACL,KAAK,EAAE,QAAQ,CAAC,UAAU,EAC1B,KAAK,EAAE,CAAC,CAAC,2CAA2C,CAAC,EACrD,WAAW,EAAE,CAAC,CAAC,6CAA6C,CAAC,GAC/D,GACa,CACtB,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {KitEmpty, KitSpace} from 'aristid-ds';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport styled from 'styled-components';\n\nconst NoProfilesSpacer = styled(KitSpace)`\n justify-content: center;\n width: 100%;\n height: 100%;\n`;\n\nexport const NoProfiles = () => {\n const {t} = useSharedTranslation();\n\n return (\n <NoProfilesSpacer direction=\"vertical\" size=\"m\">\n <KitEmpty\n image={KitEmpty.ASSET_LIST}\n title={t('explorer.export_profile_modal.no_profiles')}\n description={t('explorer.export_profile_modal.contact_admin')}\n />\n </NoProfilesSpacer>\n );\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type IExportProfile } from '../useGetLibraryExportProfiles';
|
|
2
|
+
interface IProfilesSelectionProps {
|
|
3
|
+
profiles: IExportProfile[];
|
|
4
|
+
selectedProfile: string;
|
|
5
|
+
setSelectedProfile: (profile: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const ProfilesSelection: ({ profiles, selectedProfile, setSelectedProfile }: IProfilesSelectionProps) => JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
|
|
3
|
+
// This file is released under LGPL V3
|
|
4
|
+
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
5
|
+
import { KitEmpty, KitGrid, KitInput, KitItemList, KitRadio, KitSpace, KitTypography } from 'aristid-ds';
|
|
6
|
+
import styled from 'styled-components';
|
|
7
|
+
import { useSharedTranslation } from '../../../../../hooks/useSharedTranslation';
|
|
8
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
9
|
+
import { faMagnifyingGlass } from '@fortawesome/free-solid-svg-icons';
|
|
10
|
+
import { useState } from 'react';
|
|
11
|
+
const ExportSpacer = styled(KitSpace) `
|
|
12
|
+
width: 100%;
|
|
13
|
+
`;
|
|
14
|
+
const ExportTitle = styled(KitTypography.Title) `
|
|
15
|
+
&.ant-typography {
|
|
16
|
+
margin-bottom: 0;
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
const ExportProfileOptionGroup = styled(KitRadio.Group) `
|
|
20
|
+
width: 100%;
|
|
21
|
+
`;
|
|
22
|
+
const ExportProfileOption = styled(KitRadio) `
|
|
23
|
+
width: 100%;
|
|
24
|
+
padding: calc(var(--general-spacing-xs) * 1px);
|
|
25
|
+
border-radius: calc(var(--general-border-radius-s) * 1px);
|
|
26
|
+
|
|
27
|
+
&.ant-radio-wrapper-checked {
|
|
28
|
+
background-color: var(--general-utilities-main-light);
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
const ExportProfileInError = styled(KitEmpty) `
|
|
32
|
+
.ant-empty-description .ant-space {
|
|
33
|
+
width: 100%;
|
|
34
|
+
word-break: break-word;
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
export const ProfilesSelection = ({ profiles, selectedProfile, setSelectedProfile }) => {
|
|
38
|
+
const { t } = useSharedTranslation();
|
|
39
|
+
const [searchTerm, setSearchTerm] = useState('');
|
|
40
|
+
const filteredProfiles = profiles.filter(profile => profile.label.toLowerCase().includes(searchTerm.toLowerCase()));
|
|
41
|
+
const selectedProfileData = profiles.find(p => p.label === selectedProfile);
|
|
42
|
+
return (_jsxs(KitGrid.KitRow, { gutter: 48, children: [_jsx(KitGrid.KitCol, { span: 12, children: _jsxs(ExportSpacer, { direction: "vertical", size: "s", children: [_jsx(ExportTitle, { level: "h4", children: t('explorer.export_profile_modal.profile_label') }), _jsx(KitInput, { prefix: _jsx(FontAwesomeIcon, { icon: faMagnifyingGlass }), placeholder: t('explorer.export_profile_modal.search_placeholder') ?? '', value: searchTerm, onChange: e => setSearchTerm(e.target.value), size: "middle", allowClear: true }), _jsx(ExportProfileOptionGroup, { value: selectedProfile, onChange: e => setSelectedProfile(e.target.value), children: _jsx(ExportSpacer, { direction: "vertical", size: "xxs", children: filteredProfiles.map(profile => (_jsx(ExportProfileOption, { value: profile.label, children: profile.label }, profile.label))) }) })] }) }), _jsx(KitGrid.KitCol, { span: 12, children: _jsxs(ExportSpacer, { direction: "vertical", size: "s", children: [_jsx(ExportTitle, { level: "h4", children: t('explorer.export_profile_modal.preview_label') }), selectedProfileData?.error?.message && (_jsx(ExportProfileInError, { image: KitEmpty.ASSET_RESULT_ERROR, title: t('explorer.export_profile_modal.error_title'), description: selectedProfileData.error.message })), selectedProfileData?.columns && (_jsx(ExportSpacer, { direction: "vertical", size: "xxs", children: selectedProfileData.columns.map(column => (_jsx(KitItemList, { idCardProps: {
|
|
43
|
+
title: column.columnLabel,
|
|
44
|
+
description: column.attribute === ''
|
|
45
|
+
? t('explorer.export_profile_modal.empty_columns')
|
|
46
|
+
: column.attribute,
|
|
47
|
+
} }, column.attribute))) }))] }) })] }));
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=ProfilesSelection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProfilesSelection.js","sourceRoot":"","sources":["../../../../../../src/components/Explorer/actions-mass/export/content/ProfilesSelection.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AAC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6CAA6C,CAAC,GAAe,EACvF,mBAAmB,EAAE,KAAK,EAAE,OAAO,IAAI,CACpC,KAAC,oBAAoB,IACjB,KAAK,EAAE,QAAQ,CAAC,kBAAkB,EAClC,KAAK,EAAE,CAAC,CAAC,2CAA2C,CAAC,EACrD,WAAW,EAAE,mBAAmB,CAAC,KAAK,CAAC,OAAO,GAChD,CACL,EACA,mBAAmB,EAAE,OAAO,IAAI,CAC7B,KAAC,YAAY,IAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,KAAK,YACxC,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CACvC,KAAC,WAAW,IAER,WAAW,EAAE;oCACT,KAAK,EAAE,MAAM,CAAC,WAAW;oCACzB,WAAW,EACP,MAAM,CAAC,SAAS,KAAK,EAAE;wCACnB,CAAC,CAAC,CAAC,CAAC,6CAA6C,CAAC;wCAClD,CAAC,CAAC,MAAM,CAAC,SAAS;iCAC7B,IAPI,MAAM,CAAC,SAAS,CAQvB,CACL,CAAC,GACS,CAClB,IACU,GACF,IACJ,CACpB,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {KitEmpty, KitGrid, KitInput, KitItemList, KitRadio, KitSpace, KitTypography} from 'aristid-ds';\nimport styled from 'styled-components';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faMagnifyingGlass} from '@fortawesome/free-solid-svg-icons';\nimport {useState} from 'react';\nimport {type IExportProfile} from '../useGetLibraryExportProfiles';\n\nconst ExportSpacer = styled(KitSpace)`\n width: 100%;\n`;\n\nconst ExportTitle = styled(KitTypography.Title)`\n &.ant-typography {\n margin-bottom: 0;\n }\n`;\n\nconst ExportProfileOptionGroup = styled(KitRadio.Group)`\n width: 100%;\n`;\n\nconst ExportProfileOption = styled(KitRadio)`\n width: 100%;\n padding: calc(var(--general-spacing-xs) * 1px);\n border-radius: calc(var(--general-border-radius-s) * 1px);\n\n &.ant-radio-wrapper-checked {\n background-color: var(--general-utilities-main-light);\n }\n`;\n\nconst ExportProfileInError = styled(KitEmpty)`\n .ant-empty-description .ant-space {\n width: 100%;\n word-break: break-word;\n }\n`;\n\ninterface IProfilesSelectionProps {\n profiles: IExportProfile[];\n selectedProfile: string;\n setSelectedProfile: (profile: string) => void;\n}\n\nexport const ProfilesSelection = ({profiles, selectedProfile, setSelectedProfile}: IProfilesSelectionProps) => {\n const {t} = useSharedTranslation();\n\n const [searchTerm, setSearchTerm] = useState('');\n\n const filteredProfiles = profiles.filter(profile => profile.label.toLowerCase().includes(searchTerm.toLowerCase()));\n const selectedProfileData = profiles.find(p => p.label === selectedProfile);\n\n return (\n <KitGrid.KitRow gutter={48}>\n <KitGrid.KitCol span={12}>\n <ExportSpacer direction=\"vertical\" size=\"s\">\n <ExportTitle level=\"h4\">{t('explorer.export_profile_modal.profile_label')}</ExportTitle>\n <KitInput\n prefix={<FontAwesomeIcon icon={faMagnifyingGlass} />}\n placeholder={t('explorer.export_profile_modal.search_placeholder') ?? ''}\n value={searchTerm}\n onChange={e => setSearchTerm(e.target.value)}\n size=\"middle\"\n allowClear\n />\n <ExportProfileOptionGroup\n value={selectedProfile}\n onChange={e => setSelectedProfile(e.target.value)}\n >\n <ExportSpacer direction=\"vertical\" size=\"xxs\">\n {filteredProfiles.map(profile => (\n <ExportProfileOption key={profile.label} value={profile.label}>\n {profile.label}\n </ExportProfileOption>\n ))}\n </ExportSpacer>\n </ExportProfileOptionGroup>\n </ExportSpacer>\n </KitGrid.KitCol>\n <KitGrid.KitCol span={12}>\n <ExportSpacer direction=\"vertical\" size=\"s\">\n <ExportTitle level=\"h4\">{t('explorer.export_profile_modal.preview_label')}</ExportTitle>\n {selectedProfileData?.error?.message && (\n <ExportProfileInError\n image={KitEmpty.ASSET_RESULT_ERROR}\n title={t('explorer.export_profile_modal.error_title')}\n description={selectedProfileData.error.message}\n />\n )}\n {selectedProfileData?.columns && (\n <ExportSpacer direction=\"vertical\" size=\"xxs\">\n {selectedProfileData.columns.map(column => (\n <KitItemList\n key={column.attribute}\n idCardProps={{\n title: column.columnLabel,\n description:\n column.attribute === ''\n ? t('explorer.export_profile_modal.empty_columns')\n : column.attribute,\n }}\n />\n ))}\n </ExportSpacer>\n )}\n </ExportSpacer>\n </KitGrid.KitCol>\n </KitGrid.KitRow>\n );\n};\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
interface IExportProfileColumn {
|
|
2
|
+
columnLabel: string;
|
|
3
|
+
attribute: string;
|
|
4
|
+
}
|
|
5
|
+
export interface IExportProfile {
|
|
6
|
+
label: string;
|
|
7
|
+
columns: IExportProfileColumn[];
|
|
8
|
+
error?: {
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
interface IGetLibraryExportProfilesResult {
|
|
13
|
+
profiles: IExportProfile[];
|
|
14
|
+
defaultProfile: string;
|
|
15
|
+
loading: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface IUseGetLibraryExportProfilesParams {
|
|
18
|
+
libraryId: string;
|
|
19
|
+
skip?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Fetch and validate export profiles for a library
|
|
23
|
+
* @param params - The library ID and optional skip flag
|
|
24
|
+
* @returns Validated export profiles, default profile, loading state, and validation status
|
|
25
|
+
*/
|
|
26
|
+
export declare const useGetLibraryExportProfiles: ({ libraryId, skip, }: IUseGetLibraryExportProfilesParams) => IGetLibraryExportProfilesResult;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
|
|
2
|
+
// This file is released under LGPL V3
|
|
3
|
+
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { useLibraryExportProfilesQuery } from '../../../../_gqlTypes';
|
|
6
|
+
/**
|
|
7
|
+
* Fetch and validate export profiles for a library
|
|
8
|
+
* @param params - The library ID and optional skip flag
|
|
9
|
+
* @returns Validated export profiles, default profile, loading state, and validation status
|
|
10
|
+
*/
|
|
11
|
+
export const useGetLibraryExportProfiles = ({ libraryId, skip = false, }) => {
|
|
12
|
+
const { data, loading } = useLibraryExportProfilesQuery({
|
|
13
|
+
skip,
|
|
14
|
+
fetchPolicy: 'no-cache',
|
|
15
|
+
variables: { libraryId: [libraryId] },
|
|
16
|
+
});
|
|
17
|
+
const exportProfiles = data?.libraries?.list?.[0]?.exportProfiles;
|
|
18
|
+
return useMemo(() => {
|
|
19
|
+
if (loading) {
|
|
20
|
+
return {
|
|
21
|
+
profiles: [],
|
|
22
|
+
defaultProfile: '',
|
|
23
|
+
loading,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
if (!exportProfiles) {
|
|
27
|
+
return {
|
|
28
|
+
profiles: [],
|
|
29
|
+
defaultProfile: '',
|
|
30
|
+
loading,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const { defaultProfile, profiles } = exportProfiles;
|
|
34
|
+
if (!Array.isArray(profiles) || profiles.length === 0) {
|
|
35
|
+
return {
|
|
36
|
+
profiles: [],
|
|
37
|
+
defaultProfile: '',
|
|
38
|
+
loading,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
profiles: profiles,
|
|
43
|
+
defaultProfile: typeof defaultProfile === 'string' ? defaultProfile : '',
|
|
44
|
+
loading,
|
|
45
|
+
};
|
|
46
|
+
}, [exportProfiles, loading]);
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=useGetLibraryExportProfiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetLibraryExportProfiles.js","sourceRoot":"","sources":["../../../../../src/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,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;YACxE,OAAO;SACV,CAAC;IACN,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;AAClC,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {useMemo} from 'react';\nimport {useLibraryExportProfilesQuery} from '_ui/_gqlTypes';\n\ninterface IExportProfileColumn {\n columnLabel: string;\n attribute: string;\n}\n\nexport interface IExportProfile {\n label: string;\n columns: IExportProfileColumn[];\n error?: {message: string};\n}\n\ninterface IGetLibraryExportProfilesResult {\n profiles: IExportProfile[];\n defaultProfile: string;\n loading: boolean;\n}\n\ninterface IUseGetLibraryExportProfilesParams {\n libraryId: string;\n skip?: boolean;\n}\n\n/**\n * Fetch and validate export profiles for a library\n * @param params - The library ID and optional skip flag\n * @returns Validated export profiles, default profile, loading state, and validation status\n */\nexport const useGetLibraryExportProfiles = ({\n libraryId,\n skip = false,\n}: IUseGetLibraryExportProfilesParams): IGetLibraryExportProfilesResult => {\n const {data, loading} = useLibraryExportProfilesQuery({\n skip,\n fetchPolicy: 'no-cache',\n variables: {libraryId: [libraryId]},\n });\n\n const exportProfiles = data?.libraries?.list?.[0]?.exportProfiles;\n\n return useMemo(() => {\n if (loading) {\n return {\n profiles: [],\n defaultProfile: '',\n loading,\n };\n }\n\n if (!exportProfiles) {\n return {\n profiles: [],\n defaultProfile: '',\n loading,\n };\n }\n\n const {defaultProfile, profiles} = exportProfiles;\n\n if (!Array.isArray(profiles) || profiles.length === 0) {\n return {\n profiles: [],\n defaultProfile: '',\n loading,\n };\n }\n\n return {\n profiles: profiles as IExportProfile[],\n defaultProfile: typeof defaultProfile === 'string' ? defaultProfile : '',\n loading,\n };\n }, [exportProfiles, loading]);\n};\n"]}
|
|
@@ -3,13 +3,14 @@ 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';
|
|
7
6
|
import { KitAlert, KitModal } from 'aristid-ds';
|
|
8
7
|
import { useDeactivateRecordsMutation } from '../../../_gqlTypes';
|
|
9
8
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
10
9
|
import { ViewSettingsActionTypes } from '../manage-view-settings';
|
|
11
10
|
import { BREAK_TWO_LINES, MASS_SELECTION_ALL } from '../_constants';
|
|
12
11
|
import { SUCCESS_ALERT_DURATION } from '../../../constants';
|
|
12
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
13
|
+
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
|
13
14
|
/**
|
|
14
15
|
* Hook used to get the action for mass actions only available on selection.
|
|
15
16
|
*
|
|
@@ -28,7 +29,7 @@ export const useDeactivateMassAction = ({ isEnabled, store: { view, dispatch },
|
|
|
28
29
|
const [deactivateRecordsMutation] = useDeactivateRecordsMutation();
|
|
29
30
|
const _deactivateMassAction = useMemo(() => ({
|
|
30
31
|
label: t('explorer.massAction.deactivate'),
|
|
31
|
-
icon: _jsx(
|
|
32
|
+
icon: _jsx(FontAwesomeIcon, { icon: faTrash }),
|
|
32
33
|
deselectAll: true,
|
|
33
34
|
callback: massSelectionFilter => {
|
|
34
35
|
KitModal.confirm({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeactivateMassAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/useDeactivateMassAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAgB,OAAO,EAAC,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"useDeactivateMassAction.js","sourceRoot":"","sources":["../../../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;wBACF,QAAQ,EAAE,IAAI;qBACjB,CAAC,CAAC;oBACH,IACI,IAAI,CAAC,aAAa,KAAK,kBAAkB;wBACzC,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAC/D,CAAC;wBACC,MAAM,OAAO,CAAC;4BACV,UAAU,EAAE;gCACR,KAAK,EAAE,IAAI,CAAC,QAAQ;gCACpB,MAAM,EAAE,CAAC;6BACZ;yBACJ,CAAC,CAAC;oBACP,CAAC;yBAAM,CAAC;wBACJ,MAAM,OAAO,EAAE,CAAC;oBACpB,CAAC;oBACD,YAAY,EAAE,CAAC,mBAAmB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;oBACxD,QAAQ,CAAC;wBACL,IAAI,EAAE,uBAAuB,CAAC,iBAAiB;wBAC/C,OAAO,EAAE,EAAE;qBACd,CAAC,CAAC;gBACP,CAAC;aACJ,CAAC,CAAC;QACP,CAAC;KACJ,CAAC,EACF,CAAC,CAAC,EAAE,yBAAyB,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,cAAc,EAAE,OAAO,CAAC,CACxG,CAAC;IAEF,OAAO;QACH,oBAAoB,EAAE,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI;KACjE,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type Dispatch, useMemo} from 'react';\nimport {KitAlert, KitModal} from 'aristid-ds';\nimport {useDeactivateRecordsMutation} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type FeatureHook, type IMassActions} from '../_types';\nimport {type IViewSettingsAction, type IViewSettingsState, ViewSettingsActionTypes} from '../manage-view-settings';\nimport {BREAK_TWO_LINES, MASS_SELECTION_ALL} from '../_constants';\nimport {type useExplorerData} from '../_queries/useExplorerData';\nimport {SUCCESS_ALERT_DURATION} from '_ui/constants';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faTrash} from '@fortawesome/free-solid-svg-icons';\n\n/**\n * Hook used to get the action for mass actions only available on selection.\n *\n * When the mutation for deactivation is done, the Apollo cache will be clean (`Record` and `RecordIdentity`)\n * from deactivated record.\n *\n * @param isEnabled - whether the action is present\n * @param view - represent the current view\n * @param dispatch - method to change the current view\n * @param libraryId - concerned library\n * @param allVisibleKeys - list of all visible keys used to know if we need to change page\n * @param refetch - method to get fresh data when we delete last page\n */\nexport const useDeactivateMassAction = ({\n isEnabled,\n store: {view, dispatch},\n allVisibleKeys,\n totalCount,\n onDeactivate,\n refetch,\n}: FeatureHook<{\n store: {\n view: IViewSettingsState;\n dispatch: Dispatch<IViewSettingsAction>;\n };\n allVisibleKeys: string[];\n totalCount: number;\n onDeactivate?: IMassActions['callback'];\n refetch: ReturnType<typeof useExplorerData>['refetch'];\n}>) => {\n const {t} = useSharedTranslation();\n\n const [deactivateRecordsMutation] = useDeactivateRecordsMutation();\n\n const _deactivateMassAction: IMassActions = useMemo(\n () => ({\n label: t('explorer.massAction.deactivate'),\n icon: <FontAwesomeIcon icon={faTrash} />,\n deselectAll: true,\n callback: massSelectionFilter => {\n KitModal.confirm({\n width: '100%',\n style: {content: {width: '90vw', maxWidth: '656px'}},\n type: 'confirm',\n icon: false,\n title:\n t('explorer.deactivate_item', {\n count: view.massSelection === MASS_SELECTION_ALL ? Infinity : view.massSelection.length,\n }) ?? undefined,\n content:\n t('explorer.deactivate_item_description', {\n count: view.massSelection === MASS_SELECTION_ALL ? Infinity : view.massSelection.length,\n }) +\n BREAK_TWO_LINES +\n t('global.are_you_sure'),\n okText: t('global.confirm') ?? undefined,\n cancelText: t('global.cancel') ?? undefined,\n onOk: async () => {\n const {data} = await deactivateRecordsMutation({\n variables: {\n libraryId: view.libraryId,\n filters: massSelectionFilter,\n },\n });\n const total =\n view.massSelection === MASS_SELECTION_ALL ? totalCount : view.massSelection.length;\n KitAlert.success({\n showIcon: true,\n duration: SUCCESS_ALERT_DURATION,\n message: t('explorer.massAction.deactivate_message'),\n description: t('explorer.massAction.deactivate_description', {\n count: data?.deactivateRecords.length,\n total,\n }),\n closable: true,\n });\n if (\n view.massSelection === MASS_SELECTION_ALL ||\n allVisibleKeys.every(key => view.massSelection.includes(key))\n ) {\n await refetch({\n pagination: {\n limit: view.pageSize,\n offset: 0,\n },\n });\n } else {\n await refetch();\n }\n onDeactivate?.(massSelectionFilter, view.massSelection);\n dispatch({\n type: ViewSettingsActionTypes.SET_SELECTED_KEYS,\n payload: [],\n });\n },\n });\n },\n }),\n [t, deactivateRecordsMutation, view.massSelection, dispatch, view.libraryId, allVisibleKeys, refetch],\n );\n\n return {\n deactivateMassAction: isEnabled ? _deactivateMassAction : null,\n };\n};\n"]}
|
|
@@ -6,10 +6,11 @@ import useSaveValueBatchMutation from '../../../components/RecordEdition/EditRec
|
|
|
6
6
|
import { ViewSettingsActionTypes } from '../manage-view-settings';
|
|
7
7
|
import { useMemo } from 'react';
|
|
8
8
|
import { useExplorerData } from '../_queries/useExplorerData';
|
|
9
|
-
import { FaTrash } from 'react-icons/fa';
|
|
10
9
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
11
10
|
import { KitModal } from 'aristid-ds';
|
|
12
11
|
import { BREAK_TWO_LINES, MASS_SELECTION_ALL } from '../_constants';
|
|
12
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
13
|
+
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
|
13
14
|
export const useDeleteLinkValues = ({ isEnabled, store: { view, dispatch }, filtersStore: { filters, filtersOperator }, pagination, allVisibleKeys, onDelete, refetch, }) => {
|
|
14
15
|
const { t } = useSharedTranslation();
|
|
15
16
|
const { saveValues } = useSaveValueBatchMutation();
|
|
@@ -27,7 +28,7 @@ export const useDeleteLinkValues = ({ isEnabled, store: { view, dispatch }, filt
|
|
|
27
28
|
});
|
|
28
29
|
const _unlinkMassAction = useMemo(() => ({
|
|
29
30
|
label: t('explorer.massAction.deactivate'),
|
|
30
|
-
icon: _jsx(
|
|
31
|
+
icon: _jsx(FontAwesomeIcon, { icon: faTrash }),
|
|
31
32
|
deselectAll: true,
|
|
32
33
|
callback: massSelectionFilter => {
|
|
33
34
|
KitModal.confirm({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeleteLinkValues.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/useDeleteLinkValues.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,yBAAyB,MAAM,uFAAuF,CAAC;AAE9H,OAAO,EAAoD,uBAAuB,EAAC,MAAM,yBAAyB,CAAC;AACnH,OAAO,EAA0B,OAAO,EAAC,MAAM,OAAO,CAAC;AACvD,OAAO,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"useDeleteLinkValues.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/useDeleteLinkValues.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,yBAAyB,MAAM,uFAAuF,CAAC;AAE9H,OAAO,EAAoD,uBAAuB,EAAC,MAAM,yBAAyB,CAAC;AACnH,OAAO,EAA0B,OAAO,EAAC,MAAM,OAAO,CAAC;AACvD,OAAO,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAGlE,OAAO,EAAC,e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Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport useSaveValueBatchMutation from '_ui/components/RecordEdition/EditRecordContent/hooks/useExecuteSaveValueBatchMutation';\nimport {type FeatureHook, type IEntrypointLink, type IMassActions} from '../_types';\nimport {type IViewSettingsAction, type IViewSettingsState, ViewSettingsActionTypes} from '../manage-view-settings';\nimport {type Dispatch, type Key, useMemo} from 'react';\nimport {useExplorerData} from '../_queries/useExplorerData';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {KitModal} from 'aristid-ds';\nimport {BREAK_TWO_LINES, MASS_SELECTION_ALL} from '../_constants';\nimport {type IValueToSubmit} from '_ui/components/RecordEdition/EditRecordContent/_types';\nimport {type IUIFiltersState} from '_ui/components/Filters/context/filtersReducer';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faTrash} from '@fortawesome/free-solid-svg-icons';\n\nexport const useDeleteLinkValues = ({\n isEnabled,\n store: {view, dispatch},\n filtersStore: {filters, filtersOperator},\n pagination,\n allVisibleKeys,\n onDelete,\n refetch,\n}: FeatureHook<{\n pagination: null | {limit: number; offset: number};\n store: {\n view: IViewSettingsState;\n dispatch: Dispatch<IViewSettingsAction>;\n };\n filtersStore: IUIFiltersState;\n allVisibleKeys: string[];\n onDelete?: IMassActions['callback'];\n refetch: ReturnType<typeof useExplorerData>['refetch'];\n}>) => {\n const {t} = useSharedTranslation();\n const {saveValues} = useSaveValueBatchMutation();\n\n const isLink = view.entrypoint.type === 'link';\n const {data: linkData, canEditLinkAttributeValues: canUnlinkValues} = useExplorerData({\n entrypoint: view.entrypoint,\n libraryId: view.libraryId,\n attributeIds: view.attributesIds,\n fulltextSearch: view.fulltextSearch,\n pagination,\n sorts: view.sort,\n filtersOperator,\n filters,\n skip: !isLink,\n });\n\n const _unlinkMassAction: IMassActions = useMemo(\n () => ({\n label: t('explorer.massAction.deactivate'),\n icon: <FontAwesomeIcon icon={faTrash} />,\n deselectAll: true,\n callback: massSelectionFilter => {\n KitModal.confirm({\n width: '100%',\n style: {content: {width: '90vw', maxWidth: '656px'}},\n type: 'confirm',\n icon: false,\n title:\n t('explorer.delete_link', {\n count: view.massSelection === MASS_SELECTION_ALL ? Infinity : view.massSelection.length,\n }) ?? undefined,\n content:\n t('explorer.delete_link_description', {\n count: view.massSelection === MASS_SELECTION_ALL ? Infinity : view.massSelection.length,\n }) +\n BREAK_TWO_LINES +\n t('global.are_you_sure'),\n okText: t('global.submit') ?? undefined,\n cancelText: t('global.cancel') ?? undefined,\n onOk: async () => {\n const entrypoint = view.entrypoint as IEntrypointLink;\n let values: IValueToSubmit[];\n if (\n view.massSelection === MASS_SELECTION_ALL ||\n allVisibleKeys.every(key => view.massSelection.includes(key))\n ) {\n values =\n (linkData?.records ?? []).map(({id_value}) => ({\n attribute: entrypoint.linkAttributeId,\n idValue: id_value ?? null,\n value: null,\n })) ?? [];\n } else {\n values = (linkData?.records ?? []).reduce<IValueToSubmit[]>((acc, {id_value, key}) => {\n if (view.massSelection.includes(key)) {\n acc.push({\n attribute: entrypoint.linkAttributeId,\n idValue: id_value ?? null,\n value: null,\n });\n }\n return acc;\n }, []);\n }\n\n if (values.length > 0) {\n await saveValues(\n {\n id: entrypoint.parentRecordId,\n library: {\n id: entrypoint.parentLibraryId,\n },\n },\n values,\n undefined,\n true,\n );\n\n onDelete?.(\n massSelectionFilter,\n values.map(({idValue}) => idValue as Key),\n );\n await refetch();\n }\n dispatch({\n type: ViewSettingsActionTypes.SET_SELECTED_KEYS,\n payload: [],\n });\n },\n });\n },\n }),\n [t, saveValues, view.massSelection, dispatch, view.libraryId, allVisibleKeys],\n );\n\n return {\n unlinkMassAction: isEnabled && canUnlinkValues ? _unlinkMassAction : null,\n };\n};\n"]}
|
|
@@ -5,7 +5,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
import { AttributeType, useSaveValueBulkMutation, } from '../../../_gqlTypes';
|
|
6
6
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
7
7
|
import { useEffect, useMemo, useState } from 'react';
|
|
8
|
-
import { FaEdit } from 'react-icons/fa';
|
|
9
8
|
import { MASS_SELECTION_ALL } from '../_constants';
|
|
10
9
|
import { EditTreeAttributeValuesMapping } from './edit-attribute/EditTreeAttributeValuesMapping';
|
|
11
10
|
import { EditAttributeMassActionModal } from './edit-attribute/EditAttributeMassActionModal';
|
|
@@ -14,6 +13,8 @@ import { useCountValuesOccurrencesHook } from './edit-attribute/useCountValuesOc
|
|
|
14
13
|
import { KitAlert, KitNotification } from 'aristid-ds';
|
|
15
14
|
import { ERROR_ALERT_DURATION, INFO_NOTIFICATION_DURATION } from '../../../constants';
|
|
16
15
|
import { Loading } from '../../../components/Loading';
|
|
16
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
17
|
+
import { faEdit } from '@fortawesome/free-solid-svg-icons';
|
|
17
18
|
export const useEditAttributeMassAction = ({ isEnabled, store: { view }, totalCount, }) => {
|
|
18
19
|
if (!isEnabled) {
|
|
19
20
|
return {
|
|
@@ -38,7 +39,7 @@ export const useEditAttributeMassAction = ({ isEnabled, store: { view }, totalCo
|
|
|
38
39
|
}, [selectedAttribute]);
|
|
39
40
|
const _editAttributeMassAction = useMemo(() => ({
|
|
40
41
|
label: t('explorer.massAction.editAttribute'),
|
|
41
|
-
icon: _jsx(
|
|
42
|
+
icon: _jsx(FontAwesomeIcon, { icon: faEdit }),
|
|
42
43
|
deselectAll: false,
|
|
43
44
|
callback: _massSelectionFilter => {
|
|
44
45
|
setMassSelectionFilter(_massSelectionFilter);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditAttributeMassAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/useEditAttributeMassAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAEH,aAAa,EAEb,w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AAgD,CAAC;gBAChE,QAAQ,EAAE,IAAI;aACjB,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC;IAEF,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClC,OAAO;YACH,uBAAuB,EAAE,IAAI;YAC7B,4BAA4B,EAAE,IAAI;SACrC,CAAC;IACN,CAAC;IAED,OAAO;QACH,uBAAuB,EAAE,wBAAwB;QACjD,4BAA4B,EAAE,CAC1B,MAAC,4BAA4B,IACzB,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,kBAAkB,EAC9B,oBAAoB,EAAE,oBAAoB,EAC1C,mBAAmB,EAAE,mBAAmB,EACxC,aAAa,EAAE,WAAW,EAC1B,eAAe,EAAE,CAAC,kBAAkB,EACpC,eAAe,EAAE,eAAe,EAChC,mBAAmB,EAAE,UAAU,aAE9B,iBAAiB,IAAI,IAAI,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,KAAC,OAAO,KAAG,CAAC,CAAC,CAAC,IAAI,EAC3E,iBAAiB,EAAE,IAAI,KAAK,aAAa,CAAC,IAAI,IAAI,CAC/C,KAAC,8BAA8B,IAC3B,iBAAiB,EAAE,iBAAiB,EACpC,iBAAiB,EAAE,iBAAiB,EACpC,mBAAmB,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;wBACnC,iBAAiB,CACb,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,EAAC,MAAM,EAAE,KAAK,EAAC,CAAC,CAAC,CACxF,CAAC;oBACN,CAAC,GACH,CACL,IAC0B,CAClC;KACJ,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {\n type AttributeDetailsFragment,\n AttributeType,\n type RecordFilterInput,\n useSaveValueBulkMutation,\n} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {useEffect, useMemo, useState} from 'react';\nimport {FaEdit} from 'react-icons/fa';\nimport {MASS_SELECTION_ALL} from '../_constants';\nimport {type FeatureHook, type IMassActions} from '../_types';\nimport {type IViewSettingsState} from '../manage-view-settings';\nimport {EditTreeAttributeValuesMapping} from './edit-attribute/EditTreeAttributeValuesMapping';\nimport {EditAttributeMassActionModal} from './edit-attribute/EditAttributeMassActionModal';\nimport {useListEditableAttributeHook} from './edit-attribute/useListEditableAttributeHook';\nimport {useCountValuesOccurrencesHook} from './edit-attribute/useCountValuesOccurrencesHook';\nimport {KitAlert, KitNotification} from 'aristid-ds';\nimport {ERROR_ALERT_DURATION, INFO_NOTIFICATION_DURATION} from '_ui/constants';\nimport {Loading} from '_ui/components/Loading';\n\nexport const useEditAttributeMassAction = ({\n isEnabled,\n store: {view},\n totalCount,\n}: FeatureHook<{\n store: {\n view: IViewSettingsState;\n };\n totalCount: number;\n}>) => {\n if (!isEnabled) {\n return {\n editAttributeMassAction: null,\n editAttributeMassActionModal: null,\n };\n }\n\n const {t} = useSharedTranslation();\n\n const [selectedAttribute, setSelectedAttribute] = useState<AttributeDetailsFragment | undefined>(undefined);\n const [massSelectionFilter, setMassSelectionFilter] = useState<RecordFilterInput[]>([]);\n const [openModal, setOpenModal] = useState<boolean>(false);\n const [editionMapping, setEditionMapping] = useState<Array<{before: string | null; after: string | null}>>([]);\n\n const editableAttributes = useListEditableAttributeHook({libraryId: view.libraryId});\n const valuesOccurrences = useCountValuesOccurrencesHook({\n attributeId: selectedAttribute?.id,\n libraryId: view.libraryId,\n recordFilters: massSelectionFilter,\n });\n\n const [executeSaveValueBulk] = useSaveValueBulkMutation();\n\n useEffect(() => {\n setEditionMapping([]);\n }, [selectedAttribute]);\n\n const _editAttributeMassAction: IMassActions = useMemo(\n () => ({\n label: t('explorer.massAction.editAttribute'),\n icon: <FaEdit />,\n deselectAll: false,\n callback: _massSelectionFilter => {\n setMassSelectionFilter(_massSelectionFilter);\n setEditionMapping([]);\n setOpenModal(true);\n },\n }),\n [t, view.massSelection],\n );\n\n const closeModal = () => {\n setOpenModal(false);\n setMassSelectionFilter([]);\n setSelectedAttribute(undefined);\n setEditionMapping([]);\n };\n\n const isMappingCompleted = useMemo(\n () =>\n valuesOccurrences.noValueCount === 0\n ? editionMapping.length === valuesOccurrences.occurrences.length\n : editionMapping.length === valuesOccurrences.occurrences.length + 1, // for undefined values\n [editionMapping, valuesOccurrences],\n );\n\n const bulkCounter = useMemo(\n () => (view.massSelection === MASS_SELECTION_ALL ? totalCount : view.massSelection.length),\n [view.massSelection, totalCount],\n );\n\n const onOkButtonClick = async () => {\n if (!selectedAttribute || !isMappingCompleted) {\n return;\n }\n try {\n await executeSaveValueBulk({\n variables: {\n libraryId: view.libraryId,\n recordsFilters: massSelectionFilter,\n attributeId: selectedAttribute.id,\n mapValues: editionMapping,\n },\n });\n\n closeModal();\n KitNotification.info({\n message: t('explorer.massAction.editAttribute_submit_notification_title'),\n description: t('explorer.massAction.editAttribute_submit_notification_description', {\n counter: bulkCounter,\n }),\n duration: INFO_NOTIFICATION_DURATION,\n closable: true,\n });\n } catch (error) {\n KitAlert.error({\n showIcon: true,\n duration: ERROR_ALERT_DURATION,\n message: t('error.error_occurred'),\n description: t('explorer.massAction.editAttribute_submit_error'),\n closable: true,\n });\n }\n };\n\n if (editableAttributes.length === 0) {\n return {\n editAttributeMassAction: null,\n editAttributeMassActionModal: null,\n };\n }\n\n return {\n editAttributeMassAction: _editAttributeMassAction,\n editAttributeMassActionModal: (\n <EditAttributeMassActionModal\n isOpen={openModal}\n attributes={editableAttributes}\n setSelectedAttribute={setSelectedAttribute}\n massSelectionFilter={massSelectionFilter}\n elementsCount={bulkCounter}\n disableOkButton={!isMappingCompleted}\n onOkButtonClick={onOkButtonClick}\n onCancelButtonClick={closeModal}\n >\n {selectedAttribute != null && valuesOccurrences.loading ? <Loading /> : null}\n {selectedAttribute?.type === AttributeType.tree && (\n <EditTreeAttributeValuesMapping\n selectedAttribute={selectedAttribute}\n valuesOccurrences={valuesOccurrences}\n setAttributeMapping={(before, after) => {\n setEditionMapping(\n editionMapping.filter(mapping => mapping.before !== before).concat([{before, after}]),\n );\n }}\n />\n )}\n </EditAttributeMassActionModal>\n ),\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"useEditAttributeMassAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/useEditAttributeMassAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAEH,aAAa,EAEb,wBAAwB,GAC3B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACnD,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAGjD,OAAO,EAAC,8BAA8B,EAAC,MAAM,iDAAiD,CAAC;AAC/F,OAAO,EAAC,4BAA4B,EAAC,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EAAC,4BAA4B,EAAC,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EAAC,6BAA6B,EAAC,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,YAAY,CAAC;AACrD,OAAO,EAAC,oBAAoB,EAAE,0BAA0B,EAAC,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAC,OAAO,EAAC,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,MAAM,EAAC,MAAM,mCAAmC,CAAC;AAEzD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EACvC,SAAS,EACT,KAAK,EAAE,EAAC,IAA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AA8B,IAC3B,iBAAiB,EAAE,iBAAiB,EACpC,iBAAiB,EAAE,iBAAiB,EACpC,mBAAmB,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;wBACnC,iBAAiB,CACb,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,EAAC,MAAM,EAAE,KAAK,EAAC,CAAC,CAAC,CACxF,CAAC;oBACN,CAAC,GACH,CACL,IAC0B,CAClC;KACJ,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {\n type AttributeDetailsFragment,\n AttributeType,\n type RecordFilterInput,\n useSaveValueBulkMutation,\n} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {useEffect, useMemo, useState} from 'react';\nimport {MASS_SELECTION_ALL} from '../_constants';\nimport {type FeatureHook, type IMassActions} from '../_types';\nimport {type IViewSettingsState} from '../manage-view-settings';\nimport {EditTreeAttributeValuesMapping} from './edit-attribute/EditTreeAttributeValuesMapping';\nimport {EditAttributeMassActionModal} from './edit-attribute/EditAttributeMassActionModal';\nimport {useListEditableAttributeHook} from './edit-attribute/useListEditableAttributeHook';\nimport {useCountValuesOccurrencesHook} from './edit-attribute/useCountValuesOccurrencesHook';\nimport {KitAlert, KitNotification} from 'aristid-ds';\nimport {ERROR_ALERT_DURATION, INFO_NOTIFICATION_DURATION} from '_ui/constants';\nimport {Loading} from '_ui/components/Loading';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faEdit} from '@fortawesome/free-solid-svg-icons';\n\nexport const useEditAttributeMassAction = ({\n isEnabled,\n store: {view},\n totalCount,\n}: FeatureHook<{\n store: {\n view: IViewSettingsState;\n };\n totalCount: number;\n}>) => {\n if (!isEnabled) {\n return {\n editAttributeMassAction: null,\n editAttributeMassActionModal: null,\n };\n }\n\n const {t} = useSharedTranslation();\n\n const [selectedAttribute, setSelectedAttribute] = useState<AttributeDetailsFragment | undefined>(undefined);\n const [massSelectionFilter, setMassSelectionFilter] = useState<RecordFilterInput[]>([]);\n const [openModal, setOpenModal] = useState<boolean>(false);\n const [editionMapping, setEditionMapping] = useState<Array<{before: string | null; after: string | null}>>([]);\n\n const editableAttributes = useListEditableAttributeHook({libraryId: view.libraryId});\n const valuesOccurrences = useCountValuesOccurrencesHook({\n attributeId: selectedAttribute?.id,\n libraryId: view.libraryId,\n recordFilters: massSelectionFilter,\n });\n\n const [executeSaveValueBulk] = useSaveValueBulkMutation();\n\n useEffect(() => {\n setEditionMapping([]);\n }, [selectedAttribute]);\n\n const _editAttributeMassAction: IMassActions = useMemo(\n () => ({\n label: t('explorer.massAction.editAttribute'),\n icon: <FontAwesomeIcon icon={faEdit} />,\n deselectAll: false,\n callback: _massSelectionFilter => {\n setMassSelectionFilter(_massSelectionFilter);\n setEditionMapping([]);\n setOpenModal(true);\n },\n }),\n [t, view.massSelection],\n );\n\n const closeModal = () => {\n setOpenModal(false);\n setMassSelectionFilter([]);\n setSelectedAttribute(undefined);\n setEditionMapping([]);\n };\n\n const isMappingCompleted = useMemo(\n () =>\n valuesOccurrences.noValueCount === 0\n ? editionMapping.length === valuesOccurrences.occurrences.length\n : editionMapping.length === valuesOccurrences.occurrences.length + 1, // for undefined values\n [editionMapping, valuesOccurrences],\n );\n\n const bulkCounter = useMemo(\n () => (view.massSelection === MASS_SELECTION_ALL ? totalCount : view.massSelection.length),\n [view.massSelection, totalCount],\n );\n\n const onOkButtonClick = async () => {\n if (!selectedAttribute || !isMappingCompleted) {\n return;\n }\n try {\n await executeSaveValueBulk({\n variables: {\n libraryId: view.libraryId,\n recordsFilters: massSelectionFilter,\n attributeId: selectedAttribute.id,\n mapValues: editionMapping,\n },\n });\n\n closeModal();\n KitNotification.info({\n message: t('explorer.massAction.editAttribute_submit_notification_title'),\n description: t('explorer.massAction.editAttribute_submit_notification_description', {\n counter: bulkCounter,\n }),\n duration: INFO_NOTIFICATION_DURATION,\n closable: true,\n });\n } catch (error) {\n KitAlert.error({\n showIcon: true,\n duration: ERROR_ALERT_DURATION,\n message: t('error.error_occurred'),\n description: t('explorer.massAction.editAttribute_submit_error'),\n closable: true,\n });\n }\n };\n\n if (editableAttributes.length === 0) {\n return {\n editAttributeMassAction: null,\n editAttributeMassActionModal: null,\n };\n }\n\n return {\n editAttributeMassAction: _editAttributeMassAction,\n editAttributeMassActionModal: (\n <EditAttributeMassActionModal\n isOpen={openModal}\n attributes={editableAttributes}\n setSelectedAttribute={setSelectedAttribute}\n massSelectionFilter={massSelectionFilter}\n elementsCount={bulkCounter}\n disableOkButton={!isMappingCompleted}\n onOkButtonClick={onOkButtonClick}\n onCancelButtonClick={closeModal}\n >\n {selectedAttribute != null && valuesOccurrences.loading ? <Loading /> : null}\n {selectedAttribute?.type === AttributeType.tree && (\n <EditTreeAttributeValuesMapping\n selectedAttribute={selectedAttribute}\n valuesOccurrences={valuesOccurrences}\n setAttributeMapping={(before, after) => {\n setEditionMapping(\n editionMapping.filter(mapping => mapping.before !== before).concat([{before, after}]),\n );\n }}\n />\n )}\n </EditAttributeMassActionModal>\n ),\n };\n};\n"]}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { type Dispatch } from 'react';
|
|
1
|
+
import { type Dispatch, type ReactElement } from 'react';
|
|
2
2
|
import { type FeatureHook, type IMassActions } from '../_types';
|
|
3
3
|
import { type IViewSettingsAction, type IViewSettingsState } from '../manage-view-settings';
|
|
4
|
+
interface IUseExportMassActionReturn {
|
|
5
|
+
exportMassAction: IMassActions | null;
|
|
6
|
+
ExportModal: ReactElement | null;
|
|
7
|
+
}
|
|
4
8
|
/**
|
|
5
9
|
* Hook that provides a mass action configuration for exporting selected or all items
|
|
6
10
|
* from a view/data set
|
|
@@ -12,6 +16,5 @@ export declare const useExportMassAction: ({ isEnabled, store: { view, dispatch
|
|
|
12
16
|
};
|
|
13
17
|
totalCount: number;
|
|
14
18
|
onExport?: IMassActions["callback"];
|
|
15
|
-
}>) =>
|
|
16
|
-
|
|
17
|
-
};
|
|
19
|
+
}>) => IUseExportMassActionReturn;
|
|
20
|
+
export {};
|