@leav/ui 1.6.0-dfb71145 → 1.6.0-eb8e0390
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 +640 -701
- package/dist/_gqlTypes/index.js +50 -167
- 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/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/_types.d.ts +2 -0
- package/dist/components/Filters/_types.js.map +1 -1
- package/dist/components/Filters/context/filtersReducer.js +1 -1
- package/dist/components/Filters/context/filtersReducer.js.map +1 -1
- package/dist/components/Filters/filter-items/CommonFilterItem.js +10 -3
- 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 +3 -2
- 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/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/locales/en/shared.json +15 -3
- package/dist/locales/fr/shared.json +15 -3
- package/package.json +8 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Explorer.js","sourceRoot":"","sources":["../../../src/components/Explorer/Explorer.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,UAAU,EAAkB,mBAAmB,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,EAAC,QAAQ,EAAE,mBAAmB,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACxE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,OAAO,EAAC,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AASpE,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAA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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 {forwardRef, type ReactNode, useImperativeHandle, useMemo} from 'react';\nimport {createPortal} from 'react-dom';\nimport {KitEmpty, KitSnackBarProvider, KitTypography} from 'aristid-ds';\nimport styled from 'styled-components';\nimport {Loading} from '_ui/components/Loading';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type ISubmitMultipleResult} from '_ui/components/RecordEdition/EditRecordContent/_types';\nimport {\n type DefaultViewSettings,\n type Entrypoint,\n type IItemAction,\n type IMassActions,\n type IPrimaryAction,\n} from './_types';\nimport {useExplorerData} from './_queries/useExplorerData';\nimport {DataView} from './DataView';\nimport {ExplorerTitle} from './ExplorerTitle';\nimport {ExplorerToolbar} from './ExplorerToolbar';\nimport {useEditStatusItemAction} from './actions-item/useEditStatusItemAction';\nimport {usePrimaryActionsButton} from './actions-primary/usePrimaryActions';\nimport {useCreatePrimaryAction} from './actions-primary/useCreatePrimaryAction';\nimport {useLinkPrimaryAction} from './actions-primary/useLinkPrimaryAction';\nimport {useMassActions} from './actions-mass/useMassActions';\nimport {useDeactivateMassAction} from './actions-mass/useDeactivateMassAction';\nimport {\n defaultPageSizeOptions,\n SidePanel,\n useEditSettings,\n useOpenViewSettings,\n ViewSettingsContext,\n} from './manage-view-settings';\nimport {useSearchInput} from './useSearchInput';\nimport {usePagination} from './usePagination';\nimport {useViewSettingsReducer} from './useViewSettingsReducer';\nimport {MASS_SELECTION_ALL, SNACKBAR_MASS_ID, WHO_AM_I_COLUMN} from './_constants';\nimport {useDeleteLinkValues} from './actions-mass/useDeleteLinkValues';\nimport {useReplaceItemAction} from './actions-item/useReplaceItemAction';\nimport {type JoinLibraryContextFragment} from '_ui/_gqlTypes';\nimport {useFiltersReducer} from '_ui/components/Filters/context/useFiltersReducer';\nimport {FiltersContext} from '_ui/components/Filters/context/filtersContext';\nimport {useExportMassAction} from './actions-mass/useExportMassAction';\nimport {useEditAttributeMassAction} from './actions-mass/useEditAttributeMassAction';\n\nconst isNotEmpty = <T extends unknown[]>(union: T): union is Exclude<T, []> => union.length > 0;\n\nconst emptyArray = [];\nconst emptyObject = {};\n\nconst ExplorerHeaderDivStyled = styled.div`\n display: flex;\n align-items: flex-start;\n padding: calc(var(--general-spacing-xs) * 1px);\n`;\n\nconst ExplorerPageDivStyled = styled.div`\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n`;\n\nconst ExplorerEmptyDataStyled = styled.div`\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n`;\n\nexport interface IExplorerProps {\n entrypoint: Entrypoint;\n noPagination?: true;\n itemActions?: IItemAction[];\n primaryActions?: IPrimaryAction[];\n massActions?: IMassActions[];\n title?: string;\n selectionMode?: 'multiple' | 'simple';\n emptyPlaceholder?: ReactNode;\n defaultActionsForItem?: Array<'replaceLink' | 'remove' | 'activate'>;\n defaultPrimaryActions?: Array<'create'>;\n defaultMassActions?: Array<'deactivate' | 'export' | 'editAttribute'>;\n defaultViewSettings?: DefaultViewSettings;\n defaultCallbacks?: {\n item?: {\n edit?: IItemAction['callback'];\n replaceLink?: (replaceValuesResult: ISubmitMultipleResult) => void;\n remove?: IItemAction['callback'];\n select?: IItemAction['callback'];\n };\n primary?: {\n create?: ({\n recordIdCreated,\n saveValuesResultOnLink,\n }: {\n recordIdCreated: string;\n saveValuesResultOnLink?: ISubmitMultipleResult;\n }) => void;\n link?: (saveValuesResult: ISubmitMultipleResult) => void;\n };\n mass?: {\n deactivate?: IMassActions['callback'];\n export?: IMassActions['callback'];\n };\n };\n showCreateOnNoResultOnly?: boolean;\n showFilters?: boolean;\n showSorts?: boolean;\n hideFirstActionLabel?: boolean;\n /**\n * Optional to `false` load the last added view when `props.defaultViewSettings.viewId` is `undefined`,\n * if set to `true` load default view.\n */\n ignoreViewByDefault?: boolean;\n showTitle?: boolean;\n showSearch?: boolean;\n disableSelection?: boolean;\n hideSelectAllAction?: boolean;\n hidePrimaryActions?: boolean;\n hideTableHeader?: boolean;\n creationFormId?: string;\n joinLibraryContext?: JoinLibraryContextFragment;\n}\n\nexport interface IExplorerRef {\n createAction: IPrimaryAction | null;\n linkAction: IPrimaryAction | null;\n totalCount: number;\n}\n\nexport const Explorer = forwardRef<IExplorerRef, IExplorerProps>(\n (\n {\n entrypoint,\n itemActions = [],\n primaryActions = [],\n massActions = [],\n title,\n selectionMode = 'multiple',\n emptyPlaceholder,\n noPagination,\n creationFormId,\n showCreateOnNoResultOnly = false,\n showFilters = false,\n showSorts = false,\n hideFirstActionLabel = false,\n disableSelection = false,\n hideSelectAllAction = false,\n showTitle = false,\n showSearch = false,\n hidePrimaryActions = false,\n hideTableHeader = false,\n ignoreViewByDefault = false,\n defaultActionsForItem = ['replaceLink', 'remove', 'activate'],\n defaultPrimaryActions = ['create'],\n defaultMassActions = ['deactivate', 'editAttribute'],\n defaultCallbacks,\n defaultViewSettings,\n joinLibraryContext,\n },\n ref,\n ) => {\n const {t} = useSharedTranslation();\n\n const {panelElement: settingsPanelElement} = useEditSettings();\n\n const {\n loading: viewSettingsLoading,\n view,\n dispatch: viewSettingsDispatch,\n } = useViewSettingsReducer(entrypoint, defaultViewSettings, ignoreViewByDefault);\n\n const {filtersData, dispatch: filtersDispatch} = useFiltersReducer({\n libraryId: view.libraryId,\n viewId: view.viewId ?? undefined,\n filters: defaultViewSettings?.filters ?? undefined,\n filtersOperator: defaultViewSettings?.filtersOperator ?? undefined,\n ignoreViewByDefault,\n skip: viewSettingsLoading,\n });\n\n const {currentPage, setNewPageSize, setNewPage} = usePagination(viewSettingsDispatch);\n\n const {\n data,\n isMultivalue,\n canEditLinkAttributeValues,\n loading: loadingData,\n refetch,\n } = useExplorerData({\n entrypoint,\n libraryId: view.libraryId,\n attributeIds: view.attributesIds,\n fulltextSearch: view.fulltextSearch,\n pagination: noPagination ? null : {limit: view.pageSize, offset: view.pageSize * (currentPage - 1)},\n sorts: view.sort,\n filters: filtersData.filters,\n filtersOperator: filtersData.filtersOperator,\n skip: viewSettingsLoading,\n }); // TODO: refresh when go back on page\n const isMassSelectionAll = view.massSelection === MASS_SELECTION_ALL;\n const isLink = entrypoint.type === 'link';\n\n const {editStatusItemAction} = useEditStatusItemAction({\n isEnabled:\n isNotEmpty(defaultActionsForItem) &&\n (defaultActionsForItem.includes('remove') || defaultActionsForItem.includes('activate')),\n onRemove: defaultCallbacks?.item?.remove,\n canDeleteLinkValues: canEditLinkAttributeValues,\n store: {view, dispatch: viewSettingsDispatch},\n entrypoint,\n });\n\n const {replaceItemAction, replaceItemModal} = useReplaceItemAction({\n isEnabled: isLink && isNotEmpty(defaultActionsForItem) && defaultActionsForItem.includes('replaceLink'),\n isMultivalue,\n onReplace: defaultCallbacks?.item?.replaceLink,\n canReplaceLinkValues: canEditLinkAttributeValues,\n });\n\n const totalCount = data?.totalCount ?? 0;\n\n const hasNoResults = data === null || data.totalCount === 0;\n\n const isAllowedFreeEntry = !(entrypoint.type === 'library' && !entrypoint.allowFreeEntry);\n\n const showCreatePrimaryButton = showCreateOnNoResultOnly\n ? !hidePrimaryActions && !loadingData && hasNoResults && isAllowedFreeEntry\n : true;\n\n const {createPrimaryAction, createModal} = useCreatePrimaryAction({\n isEnabled: isNotEmpty(defaultPrimaryActions) && defaultPrimaryActions.includes('create'),\n isVisible: showCreatePrimaryButton,\n libraryId: view.libraryId,\n canCreateAndLinkValue: canEditLinkAttributeValues,\n onCreate: defaultCallbacks?.primary?.create,\n joinLibraryContext,\n entrypoint,\n isMultivalue,\n totalCount,\n formId: creationFormId,\n refetch,\n });\n const {linkPrimaryAction, linkModal} = useLinkPrimaryAction({\n isEnabled: isLink,\n joinLibraryContext,\n isVisible: showCreatePrimaryButton,\n canAddLinkValue: canEditLinkAttributeValues,\n onLink: defaultCallbacks?.primary?.link,\n linkId: data?.totalCount === 0 ? undefined : data?.records[0]?.id_value,\n isMultivalue,\n maxItemsLeft: null, // TODO: use KitTable.row\n });\n\n const allVisibleKeys = data?.records.map(({key}) => key) ?? [];\n\n const {exportMassAction} = useExportMassAction({\n isEnabled: !isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('export'),\n store: {view, dispatch: viewSettingsDispatch},\n totalCount,\n onExport: defaultCallbacks?.mass?.export,\n });\n\n const {editAttributeMassAction, editAttributeMassActionModal} = useEditAttributeMassAction({\n isEnabled: !isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('editAttribute'),\n store: {view},\n totalCount,\n });\n\n const {deactivateMassAction} = useDeactivateMassAction({\n isEnabled: !isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('deactivate'),\n store: {view, dispatch: viewSettingsDispatch},\n allVisibleKeys,\n totalCount,\n onDeactivate: defaultCallbacks?.mass?.deactivate,\n refetch,\n });\n\n const {unlinkMassAction} = useDeleteLinkValues({\n isEnabled: isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('deactivate'),\n store: {view, dispatch: viewSettingsDispatch},\n filtersStore: filtersData,\n pagination: noPagination ? null : {limit: view.pageSize, offset: view.pageSize * (currentPage - 1)},\n allVisibleKeys,\n onDelete: defaultCallbacks?.mass?.deactivate,\n refetch,\n });\n\n const _isSelectionDisable = disableSelection || (isLink && !isMultivalue && totalCount > 0);\n\n const massActionSnackbarId = useMemo(() => `${SNACKBAR_MASS_ID}_${Date.now()}`, []);\n\n const {setSelectedKeys, selectAllButton} = useMassActions({\n isEnabled:\n totalCount > 0 &&\n !_isSelectionDisable &&\n (isNotEmpty(defaultMassActions) || isNotEmpty(massActions) || !!defaultCallbacks?.item?.select),\n store: {view, dispatch: viewSettingsDispatch},\n filtersStore: filtersData,\n totalCount,\n allVisibleKeys,\n massActions: [\n exportMassAction,\n editAttributeMassAction,\n deactivateMassAction,\n unlinkMassAction,\n ...massActions,\n ].filter(Boolean),\n snackbarId: massActionSnackbarId,\n });\n\n const {primaryButton} = usePrimaryActionsButton({\n view,\n actions: [createPrimaryAction, linkPrimaryAction, ...primaryActions].filter(Boolean),\n hideFirstActionLabel,\n });\n\n const {viewSettingsButton, viewListButton} = useOpenViewSettings({view, isEnabled: !isMassSelectionAll});\n\n const {searchInput} = useSearchInput({view, dispatch: viewSettingsDispatch, setNewPage});\n\n useImperativeHandle(\n ref,\n () => ({\n createAction: createPrimaryAction,\n linkAction: linkPrimaryAction,\n totalCount,\n }),\n [createPrimaryAction?.disabled, linkPrimaryAction?.disabled, totalCount],\n );\n\n return (\n <>\n <FiltersContext.Provider value={{filtersData, dispatch: filtersDispatch}}>\n <ViewSettingsContext.Provider value={{view, dispatch: viewSettingsDispatch}}>\n <ExplorerPageDivStyled>\n {showTitle && (\n <ExplorerHeaderDivStyled>\n <KitTypography.Title level=\"h3\">\n {\n !viewSettingsLoading && (\n <ExplorerTitle\n library={view.libraryId}\n title={title}\n entrypoint={entrypoint}\n />\n ) /*TODO: manage loading*/\n }\n </KitTypography.Title>\n </ExplorerHeaderDivStyled>\n )}\n <ExplorerToolbar\n showFilters={showFilters}\n showSorts={showSorts}\n isMassSelectionAll={isMassSelectionAll}\n headless={hideTableHeader}\n canRemoveFilters={view?.enableConfigureView ?? false}\n selectAllButton={hideSelectAllAction ? null : selectAllButton}\n viewSettingsLoading={viewSettingsLoading}\n >\n {view?.enableConfigureView ? viewListButton : null}\n {showSearch ? searchInput : null}\n {view?.enableConfigureView ? viewSettingsButton : null}\n {hidePrimaryActions ? null : primaryButton}\n </ExplorerToolbar>\n {loadingData || viewSettingsLoading ? (\n <Loading />\n ) : hasNoResults ? (\n <ExplorerEmptyDataStyled>\n {emptyPlaceholder || <KitEmpty title={t('explorer.empty-data')} />}\n </ExplorerEmptyDataStyled>\n ) : (\n <DataView\n dataGroupedFilteredSorted={data?.records ?? emptyArray}\n attributesProperties={data?.attributes ?? emptyObject}\n attributesToDisplay={[WHO_AM_I_COLUMN, ...view.attributesIds]}\n hideTableHeader={hideTableHeader}\n paginationProps={\n entrypoint.type === 'library' && !noPagination\n ? {\n pageSizeOptions: defaultPageSizeOptions,\n currentPage,\n pageSize: view.pageSize,\n setNewPageSize,\n setNewPage,\n totalCount,\n }\n : undefined\n }\n itemActions={[...itemActions, replaceItemAction, editStatusItemAction]\n .filter(Boolean)\n .map(action => ({\n ...action,\n disabled: isMassSelectionAll || action.disabled,\n }))}\n selection={{\n onSelectItem: _isSelectionDisable ? null : defaultCallbacks?.item?.select,\n onSelectionChange: _isSelectionDisable ? null : setSelectedKeys,\n isMassSelectionAll,\n selectedKeys: isMassSelectionAll\n ? data?.records.map(({whoAmI}) => whoAmI.id)\n : (view.massSelection as string[]),\n mode: selectionMode,\n }}\n />\n )}\n </ExplorerPageDivStyled>\n {settingsPanelElement && createPortal(<SidePanel />, settingsPanelElement?.() ?? document.body)}\n {replaceItemModal}\n {createModal}\n {linkModal}\n {editAttributeMassActionModal}\n </ViewSettingsContext.Provider>\n </FiltersContext.Provider>\n <KitSnackBarProvider id={massActionSnackbarId} />\n </>\n );\n },\n);\n"]}
|
|
1
|
+
{"version":3,"file":"Explorer.js","sourceRoot":"","sources":["../../../src/components/Explorer/Explorer.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,UAAU,EAAkB,mBAAmB,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,EAAC,QAAQ,EAAE,mBAAmB,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACxE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,OAAO,EAAC,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AASpE,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9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,mBAAmB,IAAC,EAAE,EAAE,oBAAoB,GAAI,IAClD,CACN,CAAC;AACN,CAAC,CACJ,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 {forwardRef, type ReactNode, useImperativeHandle, useMemo} from 'react';\nimport {createPortal} from 'react-dom';\nimport {KitEmpty, KitSnackBarProvider, KitTypography} from 'aristid-ds';\nimport styled from 'styled-components';\nimport {Loading} from '_ui/components/Loading';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type ISubmitMultipleResult} from '_ui/components/RecordEdition/EditRecordContent/_types';\nimport {\n type DefaultViewSettings,\n type Entrypoint,\n type IItemAction,\n type IMassActions,\n type IPrimaryAction,\n} from './_types';\nimport {useExplorerData} from './_queries/useExplorerData';\nimport {DataView} from './DataView';\nimport {ExplorerTitle} from './ExplorerTitle';\nimport {ExplorerToolbar} from './ExplorerToolbar';\nimport {useEditStatusItemAction} from './actions-item/useEditStatusItemAction';\nimport {usePrimaryActionsButton} from './actions-primary/usePrimaryActions';\nimport {useCreatePrimaryAction} from './actions-primary/useCreatePrimaryAction';\nimport {useLinkPrimaryAction} from './actions-primary/useLinkPrimaryAction';\nimport {useMassActions} from './actions-mass/useMassActions';\nimport {useDeactivateMassAction} from './actions-mass/useDeactivateMassAction';\nimport {\n defaultPageSizeOptions,\n SidePanel,\n useEditSettings,\n useOpenViewSettings,\n ViewSettingsContext,\n} from './manage-view-settings';\nimport {useSearchInput} from './useSearchInput';\nimport {usePagination} from './usePagination';\nimport {useViewSettingsReducer} from './useViewSettingsReducer';\nimport {MASS_SELECTION_ALL, SNACKBAR_MASS_ID, WHO_AM_I_COLUMN} from './_constants';\nimport {useDeleteLinkValues} from './actions-mass/useDeleteLinkValues';\nimport {useReplaceItemAction} from './actions-item/useReplaceItemAction';\nimport {type JoinLibraryContextFragment} from '_ui/_gqlTypes';\nimport {useFiltersReducer} from '_ui/components/Filters/context/useFiltersReducer';\nimport {FiltersContext} from '_ui/components/Filters/context/filtersContext';\nimport {useExportMassAction} from './actions-mass/useExportMassAction';\nimport {useEditAttributeMassAction} from './actions-mass/useEditAttributeMassAction';\n\nconst isNotEmpty = <T extends unknown[]>(union: T): union is Exclude<T, []> => union.length > 0;\n\nconst emptyArray = [];\nconst emptyObject = {};\n\nconst ExplorerHeaderDivStyled = styled.div`\n display: flex;\n align-items: flex-start;\n padding: calc(var(--general-spacing-xs) * 1px);\n`;\n\nconst ExplorerPageDivStyled = styled.div`\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n`;\n\nconst ExplorerEmptyDataStyled = styled.div`\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n`;\n\nexport interface IExplorerProps {\n entrypoint: Entrypoint;\n noPagination?: true;\n itemActions?: IItemAction[];\n primaryActions?: IPrimaryAction[];\n massActions?: IMassActions[];\n title?: string;\n selectionMode?: 'multiple' | 'simple';\n emptyPlaceholder?: ReactNode;\n defaultActionsForItem?: Array<'replaceLink' | 'remove' | 'activate'>;\n defaultPrimaryActions?: Array<'create'>;\n defaultMassActions?: Array<'deactivate' | 'export' | 'editAttribute'>;\n defaultViewSettings?: DefaultViewSettings;\n defaultCallbacks?: {\n item?: {\n edit?: IItemAction['callback'];\n replaceLink?: (replaceValuesResult: ISubmitMultipleResult) => void;\n remove?: IItemAction['callback'];\n select?: IItemAction['callback'];\n };\n primary?: {\n create?: ({\n recordIdCreated,\n saveValuesResultOnLink,\n }: {\n recordIdCreated: string;\n saveValuesResultOnLink?: ISubmitMultipleResult;\n }) => void;\n link?: (saveValuesResult: ISubmitMultipleResult) => void;\n };\n mass?: {\n deactivate?: IMassActions['callback'];\n export?: IMassActions['callback'];\n };\n };\n showCreateOnNoResultOnly?: boolean;\n showFilters?: boolean;\n showSorts?: boolean;\n hideFirstActionLabel?: boolean;\n /**\n * Optional to `false` load the last added view when `props.defaultViewSettings.viewId` is `undefined`,\n * if set to `true` load default view.\n */\n ignoreViewByDefault?: boolean;\n showTitle?: boolean;\n showSearch?: boolean;\n disableSelection?: boolean;\n hideSelectAllAction?: boolean;\n hidePrimaryActions?: boolean;\n hideTableHeader?: boolean;\n creationFormId?: string;\n joinLibraryContext?: JoinLibraryContextFragment;\n}\n\nexport interface IExplorerRef {\n createAction: IPrimaryAction | null;\n linkAction: IPrimaryAction | null;\n totalCount: number;\n}\n\nexport const Explorer = forwardRef<IExplorerRef, IExplorerProps>(\n (\n {\n entrypoint,\n itemActions = [],\n primaryActions = [],\n massActions = [],\n title,\n selectionMode = 'multiple',\n emptyPlaceholder,\n noPagination,\n creationFormId,\n showCreateOnNoResultOnly = false,\n showFilters = false,\n showSorts = false,\n hideFirstActionLabel = false,\n disableSelection = false,\n hideSelectAllAction = false,\n showTitle = false,\n showSearch = false,\n hidePrimaryActions = false,\n hideTableHeader = false,\n ignoreViewByDefault = false,\n defaultActionsForItem = ['replaceLink', 'remove', 'activate'],\n defaultPrimaryActions = ['create'],\n defaultMassActions = ['deactivate', 'editAttribute'],\n defaultCallbacks,\n defaultViewSettings,\n joinLibraryContext,\n },\n ref,\n ) => {\n const {t} = useSharedTranslation();\n\n const {panelElement: settingsPanelElement} = useEditSettings();\n\n const {\n loading: viewSettingsLoading,\n view,\n dispatch: viewSettingsDispatch,\n } = useViewSettingsReducer(entrypoint, defaultViewSettings, ignoreViewByDefault);\n\n const {filtersData, dispatch: filtersDispatch} = useFiltersReducer({\n libraryId: view.libraryId,\n viewId: view.viewId ?? undefined,\n filters: defaultViewSettings?.filters ?? undefined,\n filtersOperator: defaultViewSettings?.filtersOperator ?? undefined,\n ignoreViewByDefault,\n skip: viewSettingsLoading,\n });\n\n const {currentPage, setNewPageSize, setNewPage} = usePagination(viewSettingsDispatch);\n\n const {\n data,\n isMultivalue,\n canEditLinkAttributeValues,\n loading: loadingData,\n refetch,\n } = useExplorerData({\n entrypoint,\n libraryId: view.libraryId,\n attributeIds: view.attributesIds,\n fulltextSearch: view.fulltextSearch,\n pagination: noPagination ? null : {limit: view.pageSize, offset: view.pageSize * (currentPage - 1)},\n sorts: view.sort,\n filters: filtersData.filters,\n filtersOperator: filtersData.filtersOperator,\n skip: viewSettingsLoading,\n }); // TODO: refresh when go back on page\n const isMassSelectionAll = view.massSelection === MASS_SELECTION_ALL;\n const isLink = entrypoint.type === 'link';\n\n const {editStatusItemAction} = useEditStatusItemAction({\n isEnabled:\n isNotEmpty(defaultActionsForItem) &&\n (defaultActionsForItem.includes('remove') || defaultActionsForItem.includes('activate')),\n onRemove: defaultCallbacks?.item?.remove,\n canDeleteLinkValues: canEditLinkAttributeValues,\n store: {view, dispatch: viewSettingsDispatch},\n entrypoint,\n });\n\n const {replaceItemAction, replaceItemModal} = useReplaceItemAction({\n isEnabled: isLink && isNotEmpty(defaultActionsForItem) && defaultActionsForItem.includes('replaceLink'),\n isMultivalue,\n onReplace: defaultCallbacks?.item?.replaceLink,\n canReplaceLinkValues: canEditLinkAttributeValues,\n columnsToDisplay: view.attributesIds,\n });\n\n const totalCount = data?.totalCount ?? 0;\n\n const hasNoResults = data === null || data.totalCount === 0;\n\n const isAllowedFreeEntry = !(entrypoint.type === 'library' && !entrypoint.allowFreeEntry);\n\n const showCreatePrimaryButton = showCreateOnNoResultOnly\n ? !hidePrimaryActions && !loadingData && hasNoResults && isAllowedFreeEntry\n : true;\n\n const {createPrimaryAction, createModal} = useCreatePrimaryAction({\n isEnabled: isNotEmpty(defaultPrimaryActions) && defaultPrimaryActions.includes('create'),\n isVisible: showCreatePrimaryButton,\n libraryId: view.libraryId,\n canCreateAndLinkValue: canEditLinkAttributeValues,\n onCreate: defaultCallbacks?.primary?.create,\n joinLibraryContext,\n entrypoint,\n isMultivalue,\n totalCount,\n formId: creationFormId,\n refetch,\n });\n const {linkPrimaryAction, linkModal} = useLinkPrimaryAction({\n isEnabled: isLink,\n joinLibraryContext,\n isVisible: showCreatePrimaryButton,\n canAddLinkValue: canEditLinkAttributeValues,\n onLink: defaultCallbacks?.primary?.link,\n linkId: data?.totalCount === 0 ? undefined : data?.records[0]?.id_value,\n isMultivalue,\n maxItemsLeft: null, // TODO: use KitTable.row,\n columnsToDisplay: view.attributesIds,\n });\n\n const allVisibleKeys = data?.records.map(({key}) => key) ?? [];\n\n const {exportMassAction, ExportModal} = useExportMassAction({\n isEnabled: !isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('export'),\n store: {view, dispatch: viewSettingsDispatch},\n totalCount,\n onExport: defaultCallbacks?.mass?.export,\n });\n\n const {editAttributeMassAction, editAttributeMassActionModal} = useEditAttributeMassAction({\n isEnabled: !isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('editAttribute'),\n store: {view},\n totalCount,\n });\n\n const {deactivateMassAction} = useDeactivateMassAction({\n isEnabled: !isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('deactivate'),\n store: {view, dispatch: viewSettingsDispatch},\n allVisibleKeys,\n totalCount,\n onDeactivate: defaultCallbacks?.mass?.deactivate,\n refetch,\n });\n\n const {unlinkMassAction} = useDeleteLinkValues({\n isEnabled: isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('deactivate'),\n store: {view, dispatch: viewSettingsDispatch},\n filtersStore: filtersData,\n pagination: noPagination ? null : {limit: view.pageSize, offset: view.pageSize * (currentPage - 1)},\n allVisibleKeys,\n onDelete: defaultCallbacks?.mass?.deactivate,\n refetch,\n });\n\n const _isSelectionDisable = disableSelection || (isLink && !isMultivalue && totalCount > 0);\n\n const massActionSnackbarId = useMemo(() => `${SNACKBAR_MASS_ID}_${Date.now()}`, []);\n\n const {setSelectedKeys, selectAllButton} = useMassActions({\n isEnabled:\n totalCount > 0 &&\n !_isSelectionDisable &&\n (isNotEmpty(defaultMassActions) || isNotEmpty(massActions) || !!defaultCallbacks?.item?.select),\n store: {view, dispatch: viewSettingsDispatch},\n filtersStore: filtersData,\n totalCount,\n allVisibleKeys,\n massActions: [\n exportMassAction,\n editAttributeMassAction,\n deactivateMassAction,\n unlinkMassAction,\n ...massActions,\n ].filter(Boolean),\n snackbarId: massActionSnackbarId,\n });\n\n const {primaryButton} = usePrimaryActionsButton({\n view,\n actions: [createPrimaryAction, linkPrimaryAction, ...primaryActions].filter(Boolean),\n hideFirstActionLabel,\n });\n\n const {viewSettingsButton, viewListButton} = useOpenViewSettings({view, isEnabled: !isMassSelectionAll});\n\n const {searchInput} = useSearchInput({view, dispatch: viewSettingsDispatch, setNewPage});\n\n useImperativeHandle(\n ref,\n () => ({\n createAction: createPrimaryAction,\n linkAction: linkPrimaryAction,\n totalCount,\n }),\n [createPrimaryAction?.disabled, linkPrimaryAction?.disabled, totalCount],\n );\n\n return (\n <>\n <FiltersContext.Provider value={{filtersData, dispatch: filtersDispatch}}>\n <ViewSettingsContext.Provider value={{view, dispatch: viewSettingsDispatch}}>\n <ExplorerPageDivStyled>\n {showTitle && (\n <ExplorerHeaderDivStyled>\n <KitTypography.Title level=\"h3\">\n {\n !viewSettingsLoading && (\n <ExplorerTitle\n library={view.libraryId}\n title={title}\n entrypoint={entrypoint}\n />\n ) /*TODO: manage loading*/\n }\n </KitTypography.Title>\n </ExplorerHeaderDivStyled>\n )}\n <ExplorerToolbar\n showFilters={showFilters}\n showSorts={showSorts}\n isMassSelectionAll={isMassSelectionAll}\n headless={hideTableHeader}\n canRemoveFilters={view?.enableConfigureView ?? false}\n selectAllButton={hideSelectAllAction ? null : selectAllButton}\n viewSettingsLoading={viewSettingsLoading}\n >\n {view?.enableConfigureView ? viewListButton : null}\n {showSearch ? searchInput : null}\n {view?.enableConfigureView ? viewSettingsButton : null}\n {hidePrimaryActions ? null : primaryButton}\n </ExplorerToolbar>\n {loadingData || viewSettingsLoading ? (\n <Loading />\n ) : hasNoResults ? (\n <ExplorerEmptyDataStyled>\n {emptyPlaceholder || <KitEmpty title={t('explorer.empty-data')} />}\n </ExplorerEmptyDataStyled>\n ) : (\n <DataView\n dataGroupedFilteredSorted={data?.records ?? emptyArray}\n attributesProperties={data?.attributes ?? emptyObject}\n attributesToDisplay={[WHO_AM_I_COLUMN, ...view.attributesIds]}\n hideTableHeader={hideTableHeader}\n paginationProps={\n entrypoint.type === 'library' && !noPagination\n ? {\n pageSizeOptions: defaultPageSizeOptions,\n currentPage,\n pageSize: view.pageSize,\n setNewPageSize,\n setNewPage,\n totalCount,\n }\n : undefined\n }\n itemActions={[...itemActions, replaceItemAction, editStatusItemAction]\n .filter(Boolean)\n .map(action => ({\n ...action,\n disabled: isMassSelectionAll || action.disabled,\n }))}\n selection={{\n onSelectItem: _isSelectionDisable ? null : defaultCallbacks?.item?.select,\n onSelectionChange: _isSelectionDisable ? null : setSelectedKeys,\n isMassSelectionAll,\n selectedKeys: isMassSelectionAll\n ? data?.records.map(({whoAmI}) => whoAmI.id)\n : (view.massSelection as string[]),\n mode: selectionMode,\n }}\n />\n )}\n </ExplorerPageDivStyled>\n {settingsPanelElement && createPortal(<SidePanel />, settingsPanelElement?.() ?? document.body)}\n {replaceItemModal}\n {createModal}\n {linkModal}\n {editAttributeMassActionModal}\n {ExportModal}\n </ViewSettingsContext.Provider>\n </FiltersContext.Provider>\n <KitSnackBarProvider id={massActionSnackbarId} />\n </>\n );\n },\n);\n"]}
|
|
@@ -5,13 +5,14 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
5
5
|
import { useCallback } from 'react';
|
|
6
6
|
import { AttributeFormat, AttributeType, MultiDisplayOption, } from '../../_gqlTypes';
|
|
7
7
|
import { useSharedTranslation } from '../../hooks/useSharedTranslation';
|
|
8
|
-
import { FaArrowRight, FaCalendar, FaListAlt } from 'react-icons/fa';
|
|
9
8
|
import DOMPurify from 'dompurify';
|
|
10
9
|
import { KitAvatar, KitBadge, KitSpace, KitTag, KitTypography } from 'aristid-ds';
|
|
11
10
|
import styled from 'styled-components';
|
|
12
11
|
import { IdCard } from './IdCard';
|
|
13
12
|
import { multiColorTagAvatarClassName, TableTagGroup } from './TableTagGroup';
|
|
14
13
|
import { AggregationColor } from 'antd/es/color-picker/color';
|
|
14
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
15
|
+
import { faArrowRight, faCalendar, faListAlt } from '@fortawesome/free-solid-svg-icons';
|
|
15
16
|
const isStandardValue = (v, attribute) => [AttributeType.simple, AttributeType.advanced].includes(attribute.type);
|
|
16
17
|
const isStandardValues = (values, attribute) => values.every(value => isStandardValue(value, attribute));
|
|
17
18
|
const isLinkValue = (v, attribute) => [AttributeType.simple_link, AttributeType.advanced_link].includes(attribute.type);
|
|
@@ -30,10 +31,7 @@ const StyledColorChip = styled.div `
|
|
|
30
31
|
border-radius: calc(var(--general-border-radius-xs) * 1px);
|
|
31
32
|
background-color: ${props => props.$colorTextContent};
|
|
32
33
|
`;
|
|
33
|
-
const
|
|
34
|
-
flex-shrink: 0;
|
|
35
|
-
`;
|
|
36
|
-
const StyledFaCalendar = styled(FaCalendar) `
|
|
34
|
+
const RightIcon = styled(FontAwesomeIcon) `
|
|
37
35
|
flex-shrink: 0;
|
|
38
36
|
`;
|
|
39
37
|
export const TableCell = ({ values, attributeProperties }) => {
|
|
@@ -42,7 +40,7 @@ export const TableCell = ({ values, attributeProperties }) => {
|
|
|
42
40
|
if (!isDateRangeValue(value)) {
|
|
43
41
|
return t('explorer.invalid-value');
|
|
44
42
|
}
|
|
45
|
-
return (_jsxs(KitSpace, { size: "xxs", children: [_jsx(
|
|
43
|
+
return (_jsxs(KitSpace, { size: "xxs", children: [_jsx(RightIcon, { icon: faCalendar }), value.from, " ", _jsx(FontAwesomeIcon, { icon: faArrowRight }), " ", value.to] }));
|
|
46
44
|
}, []);
|
|
47
45
|
const _getFirstValue = useCallback((value, attribute) => {
|
|
48
46
|
if (isStandardValue(value, attribute) && attribute.format === AttributeFormat.boolean) {
|
|
@@ -152,7 +150,7 @@ export const TableCell = ({ values, attributeProperties }) => {
|
|
|
152
150
|
const tmp = document.createElement('div');
|
|
153
151
|
tmp.innerHTML = DOMPurify.sanitize(value.valuePayload);
|
|
154
152
|
const textContent = tmp.textContent;
|
|
155
|
-
content = (_jsxs(_Fragment, { children: [_jsx(
|
|
153
|
+
content = (_jsxs(_Fragment, { children: [_jsx(RightIcon, { icon: faListAlt }), _jsx(KitTypography.AdvancedText, { ellipsis: { tooltip: textContent }, children: textContent }, attributeProperties.id)] }));
|
|
156
154
|
break;
|
|
157
155
|
case AttributeFormat.color:
|
|
158
156
|
const color = new AggregationColor(value.valueRawPayload);
|
|
@@ -175,5 +173,6 @@ export const TableCell = ({ values, attributeProperties }) => {
|
|
|
175
173
|
}
|
|
176
174
|
return _jsx(StyledCenteringWrapper, { children: content });
|
|
177
175
|
}
|
|
176
|
+
return null;
|
|
178
177
|
};
|
|
179
178
|
//# sourceMappingURL=TableCell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCell.js","sourceRoot":"","sources":["../../../src/components/Explorer/TableCell.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyC,WAAW,EAAC,MAAM,OAAO,CAAC;AAC1E,OAAO,EACH,eAAe,EAEf,aAAa,EAKb,kBAAkB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,YAAY,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACnE,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAEhF,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,4BAA4B,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAC,gBAAgB,EAAC,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,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAClC,KAAC,MAAM,IAA8B,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,MAAM,IAAtD,mBAAmB,CAAC,EAAE,CAAoC,CAC1E,CAAC,CAAC,CAAC,IAAI,CAAC;QACb,CAAC;QAED,OAAO,KAAC,sBAAsB,cAAE,OAAO,GAA0B,CAAC;IACtE,CAAC;AACL,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type FunctionComponent, type ReactNode, useCallback} from 'react';\nimport {\n AttributeFormat,\n type AttributePropertiesFragment,\n AttributeType,\n type PropertyValueFragment,\n type PropertyValueLinkValueFragment,\n type PropertyValueTreeValueFragment,\n type PropertyValueValueFragment,\n MultiDisplayOption,\n} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {FaArrowRight, FaCalendar, FaListAlt} from 'react-icons/fa';\nimport DOMPurify from 'dompurify';\nimport {KitAvatar, KitBadge, KitSpace, KitTag, KitTypography} from 'aristid-ds';\nimport {type IKitTag, type IKitTagConfig} from 'aristid-ds/dist/Kit/DataDisplay/Tag/types';\nimport styled from 'styled-components';\nimport {IdCard} from './IdCard';\nimport {multiColorTagAvatarClassName, TableTagGroup} from './TableTagGroup';\nimport {AggregationColor} from 'antd/es/color-picker/color';\n\nconst isStandardValue = (\n v: PropertyValueFragment,\n attribute: AttributePropertiesFragment,\n): v is PropertyValueValueFragment => [AttributeType.simple, AttributeType.advanced].includes(attribute.type);\nconst isStandardValues = (\n values: PropertyValueFragment[],\n attribute: AttributePropertiesFragment,\n): values is PropertyValueValueFragment[] => values.every(value => isStandardValue(value, attribute));\n\nconst isLinkValue = (\n v: PropertyValueFragment,\n attribute: AttributePropertiesFragment,\n): v is PropertyValueLinkValueFragment =>\n [AttributeType.simple_link, AttributeType.advanced_link].includes(attribute.type);\nconst isLinkValues = (\n values: PropertyValueFragment[],\n attribute: AttributePropertiesFragment,\n): values is PropertyValueLinkValueFragment[] => values.every(value => isLinkValue(value, attribute));\n\nconst isTreeValue = (\n v: PropertyValueFragment,\n attribute: AttributePropertiesFragment,\n): v is PropertyValueTreeValueFragment => [AttributeType.tree].includes(attribute.type);\nconst isTreeValues = (\n values: PropertyValueFragment[],\n attribute: AttributePropertiesFragment,\n): values is PropertyValueTreeValueFragment[] => values.every(value => isTreeValue(value, attribute));\n\nconst isDateRangeValue = (v: PropertyValueValueFragment['valuePayload']): v is {from: string; to: string} =>\n 'from' in v && 'to' in v;\n\nconst StyledCenteringWrapper = styled.div`\n display: flex;\n align-items: center;\n gap: calc(var(--general-spacing-xs) * 1px);\n`;\n\nconst StyledColorChip = styled.div<{$colorTextContent: string}>`\n height: calc(var(--general-spacing-s) * 1px);\n width: calc(var(--general-spacing-s) * 1px);\n border-radius: calc(var(--general-border-radius-xs) * 1px);\n background-color: ${props => props.$colorTextContent};\n`;\n\nconst StyledFaListAlt = styled(FaListAlt)`\n flex-shrink: 0;\n`;\n\nconst StyledFaCalendar = styled(FaCalendar)`\n flex-shrink: 0;\n`;\n\ninterface ITableCellProps {\n values: PropertyValueFragment[];\n attributeProperties: AttributePropertiesFragment;\n}\n\nexport const TableCell: FunctionComponent<ITableCellProps> = ({values, attributeProperties}) => {\n const {t} = useSharedTranslation();\n\n const _getDateRangeValueContent = useCallback((value: PropertyValueValueFragment['valuePayload']) => {\n if (!isDateRangeValue(value)) {\n return t('explorer.invalid-value');\n }\n\n return (\n <KitSpace size=\"xxs\">\n <StyledFaCalendar />\n {value.from} <FaArrowRight /> {value.to}\n </KitSpace>\n );\n }, []);\n\n const _getFirstValue = useCallback(\n (value: PropertyValueValueFragment['valuePayload'], attribute: AttributePropertiesFragment) => {\n if (isStandardValue(value, attribute) && attribute.format === AttributeFormat.boolean) {\n if (!value || value.valuePayload === null) {\n return {valuePayload: false};\n }\n }\n return value;\n },\n [],\n );\n\n if (attributeProperties.multiple_values) {\n if (isStandardValues(values, attributeProperties)) {\n const tags = values.map<IKitTagConfig>(value => {\n switch (attributeProperties.format) {\n case AttributeFormat.boolean:\n return {\n idCardProps: {\n description: value.valuePayload ? String(t('global.yes')) : String(t('global.no')),\n },\n type: value.valuePayload ? 'primary' : ('neutral' as IKitTag['type']),\n };\n case AttributeFormat.color:\n const color = new AggregationColor(value.valueRawPayload);\n return {\n idCardProps: {\n description: value.valuePayload,\n avatarProps: {\n color: color.toHexString(),\n shape: 'square',\n className: multiColorTagAvatarClassName,\n },\n },\n };\n case AttributeFormat.date_range:\n return {\n idCardProps: {\n description: _getDateRangeValueContent(value.valuePayload),\n },\n type: 'primary',\n };\n default:\n const valueContent =\n attributeProperties.format === AttributeFormat.encrypted\n ? '●●●●●●●●●●●●'\n : value.valuePayload;\n return {\n idCardProps: {description: valueContent},\n type: 'primary',\n };\n }\n });\n return <TableTagGroup tags={tags} />;\n } else if (isLinkValues(values, attributeProperties)) {\n switch (attributeProperties.multi_link_display_option) {\n case MultiDisplayOption.tag:\n return (\n <TableTagGroup\n tags={values.map(value => ({\n type: 'primary',\n idCardProps: {description: value.linkPayload?.whoAmI.label ?? undefined},\n }))}\n />\n );\n\n case MultiDisplayOption.badge_qty:\n return <KitBadge overflowCount={Infinity} count={values.length} color=\"primary\" />;\n\n case MultiDisplayOption.avatar:\n default:\n return (\n <KitAvatar.Group max={{count: 5}}>\n {values.map((value, index) => {\n if (!isLinkValue(value, attributeProperties)) {\n return null;\n }\n\n return (\n <KitAvatar\n key={index}\n label={String(value.linkPayload?.whoAmI.label)}\n src={value.linkPayload?.whoAmI.preview?.small}\n color=\"primary\"\n secondaryColorInvert\n />\n );\n })}\n </KitAvatar.Group>\n );\n }\n } else if (isTreeValues(values, attributeProperties)) {\n switch (attributeProperties.multi_tree_display_option) {\n case MultiDisplayOption.tag:\n return (\n <TableTagGroup\n tags={values.map(value => ({\n type: 'primary',\n idCardProps: {description: value.treePayload?.record.whoAmI.label ?? undefined},\n }))}\n />\n );\n case MultiDisplayOption.badge_qty:\n return <KitBadge overflowCount={Infinity} count={values.length} color=\"primary\" />;\n case MultiDisplayOption.avatar:\n default:\n return (\n <KitAvatar.Group max={{count: 5}}>\n {values.map((value, index) => {\n if (!isTreeValue(value, attributeProperties)) {\n return null;\n }\n\n return (\n <KitAvatar\n key={index}\n label={String(value.treePayload?.record.whoAmI.label)}\n src={value.treePayload?.record.whoAmI.preview?.small}\n color=\"primary\"\n secondaryColorInvert\n />\n );\n })}\n </KitAvatar.Group>\n );\n }\n }\n } else {\n const value = _getFirstValue(values[0], attributeProperties); // Not multiple_values attribute should not have more than one value\n if (!value) {\n return null;\n }\n\n let content: ReactNode = null;\n if (isStandardValue(value, attributeProperties)) {\n if (value.valuePayload === null) {\n return null;\n }\n\n switch (attributeProperties.format) {\n case AttributeFormat.boolean:\n const valueToDisplay = value.valuePayload ? t('global.yes') : t('global.no');\n content = (\n <KitTag\n key={attributeProperties.id}\n type={!!value.valuePayload ? 'primary' : 'neutral'}\n idCardProps={{description: valueToDisplay}}\n />\n );\n break;\n case AttributeFormat.rich_text:\n const tmp = document.createElement('div');\n tmp.innerHTML = DOMPurify.sanitize(value.valuePayload);\n const textContent = tmp.textContent;\n content = (\n <>\n <StyledFaListAlt />\n <KitTypography.AdvancedText key={attributeProperties.id} ellipsis={{tooltip: textContent}}>\n {textContent}\n </KitTypography.AdvancedText>\n </>\n );\n break;\n case AttributeFormat.color:\n const color = new AggregationColor(value.valueRawPayload);\n content = (\n <>\n <StyledColorChip $colorTextContent={color.toHexString()} />\n <KitTypography.AdvancedText\n key={attributeProperties.id}\n ellipsis={{tooltip: value.valuePayload}}\n >\n {value.valuePayload}\n </KitTypography.AdvancedText>\n </>\n );\n break;\n case AttributeFormat.date_range:\n content = _getDateRangeValueContent(value.valuePayload);\n break;\n default:\n const valueContent =\n attributeProperties.format === AttributeFormat.encrypted ? '●●●●●●●●●●●●' : value.valuePayload;\n content = (\n <KitTypography.AdvancedText key={attributeProperties.id} ellipsis={{tooltip: valueContent}}>\n {valueContent}\n </KitTypography.AdvancedText>\n );\n break;\n }\n }\n\n if (isTreeValue(value, attributeProperties)) {\n content = value.treePayload?.record.whoAmI.label ? (\n <IdCard key={attributeProperties.id} item={value.treePayload.record.whoAmI} />\n ) : null;\n }\n\n if (isLinkValue(value, attributeProperties)) {\n content = value.linkPayload?.whoAmI ? (\n <IdCard key={attributeProperties.id} item={value.linkPayload.whoAmI} />\n ) : null;\n }\n\n return <StyledCenteringWrapper>{content}</StyledCenteringWrapper>;\n }\n};\n"]}
|
|
1
|
+
{"version":3,"file":"TableCell.js","sourceRoot":"","sources":["../../../src/components/Explorer/TableCell.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyC,WAAW,EAAC,MAAM,OAAO,CAAC;AAC1E,OAAO,EACH,eAAe,EAEf,aAAa,EAKb,kBAAkB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAEhF,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,4BAA4B,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,YAAY,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,mCAAmC,CAAC;AAEtF,MAAM,eAAe,GAAG,CACpB,CAAwB,EACxB,SAAsC,EACP,EAAE,CAA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AAC,WAAW,CAAC,MAAM,IAAtD,mBAAmB,CAAC,EAAE,CAAoC,CAC1E,CAAC,CAAC,CAAC,IAAI,CAAC;QACb,CAAC;QAED,OAAO,KAAC,sBAAsB,cAAE,OAAO,GAA0B,CAAC;IACtE,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type FunctionComponent, type ReactNode, useCallback} from 'react';\nimport {\n AttributeFormat,\n type AttributePropertiesFragment,\n AttributeType,\n type PropertyValueFragment,\n type PropertyValueLinkValueFragment,\n type PropertyValueTreeValueFragment,\n type PropertyValueValueFragment,\n MultiDisplayOption,\n} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport DOMPurify from 'dompurify';\nimport {KitAvatar, KitBadge, KitSpace, KitTag, KitTypography} from 'aristid-ds';\nimport {type IKitTag} from 'aristid-ds/dist/Kit/DataDisplay/Tag/types';\nimport styled from 'styled-components';\nimport {IdCard} from './IdCard';\nimport {multiColorTagAvatarClassName, TableTagGroup} from './TableTagGroup';\nimport {AggregationColor} from 'antd/es/color-picker/color';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faArrowRight, faCalendar, faListAlt} from '@fortawesome/free-solid-svg-icons';\n\nconst isStandardValue = (\n v: PropertyValueFragment,\n attribute: AttributePropertiesFragment,\n): v is PropertyValueValueFragment => [AttributeType.simple, AttributeType.advanced].includes(attribute.type);\nconst isStandardValues = (\n values: PropertyValueFragment[],\n attribute: AttributePropertiesFragment,\n): values is PropertyValueValueFragment[] => values.every(value => isStandardValue(value, attribute));\n\nconst isLinkValue = (\n v: PropertyValueFragment,\n attribute: AttributePropertiesFragment,\n): v is PropertyValueLinkValueFragment =>\n [AttributeType.simple_link, AttributeType.advanced_link].includes(attribute.type);\nconst isLinkValues = (\n values: PropertyValueFragment[],\n attribute: AttributePropertiesFragment,\n): values is PropertyValueLinkValueFragment[] => values.every(value => isLinkValue(value, attribute));\n\nconst isTreeValue = (\n v: PropertyValueFragment,\n attribute: AttributePropertiesFragment,\n): v is PropertyValueTreeValueFragment => [AttributeType.tree].includes(attribute.type);\nconst isTreeValues = (\n values: PropertyValueFragment[],\n attribute: AttributePropertiesFragment,\n): values is PropertyValueTreeValueFragment[] => values.every(value => isTreeValue(value, attribute));\n\nconst isDateRangeValue = (v: PropertyValueValueFragment['valuePayload']): v is {from: string; to: string} =>\n 'from' in v && 'to' in v;\n\nconst StyledCenteringWrapper = styled.div`\n display: flex;\n align-items: center;\n gap: calc(var(--general-spacing-xs) * 1px);\n`;\n\nconst StyledColorChip = styled.div<{$colorTextContent: string}>`\n height: calc(var(--general-spacing-s) * 1px);\n width: calc(var(--general-spacing-s) * 1px);\n border-radius: calc(var(--general-border-radius-xs) * 1px);\n background-color: ${props => props.$colorTextContent};\n`;\n\nconst RightIcon = styled(FontAwesomeIcon)`\n flex-shrink: 0;\n`;\n\ninterface ITableCellProps {\n values: PropertyValueFragment[];\n attributeProperties: AttributePropertiesFragment;\n}\n\nexport const TableCell: FunctionComponent<ITableCellProps> = ({values, attributeProperties}) => {\n const {t} = useSharedTranslation();\n\n const _getDateRangeValueContent = useCallback((value: PropertyValueValueFragment['valuePayload']) => {\n if (!isDateRangeValue(value)) {\n return t('explorer.invalid-value');\n }\n\n return (\n <KitSpace size=\"xxs\">\n <RightIcon icon={faCalendar} />\n {value.from} <FontAwesomeIcon icon={faArrowRight} /> {value.to}\n </KitSpace>\n );\n }, []);\n\n const _getFirstValue = useCallback(\n (value: PropertyValueValueFragment['valuePayload'], attribute: AttributePropertiesFragment) => {\n if (isStandardValue(value, attribute) && attribute.format === AttributeFormat.boolean) {\n if (!value || value.valuePayload === null) {\n return {valuePayload: false};\n }\n }\n return value;\n },\n [],\n );\n\n if (attributeProperties.multiple_values) {\n if (isStandardValues(values, attributeProperties)) {\n const tags = values.map<IKitTag>(value => {\n switch (attributeProperties.format) {\n case AttributeFormat.boolean:\n return {\n idCardProps: {\n description: value.valuePayload ? String(t('global.yes')) : String(t('global.no')),\n },\n type: value.valuePayload ? 'primary' : ('neutral' as IKitTag['type']),\n };\n case AttributeFormat.color:\n const color = new AggregationColor(value.valueRawPayload);\n return {\n idCardProps: {\n description: value.valuePayload,\n avatarProps: {\n color: color.toHexString(),\n shape: 'square',\n className: multiColorTagAvatarClassName,\n },\n },\n };\n case AttributeFormat.date_range:\n return {\n idCardProps: {\n description: _getDateRangeValueContent(value.valuePayload),\n },\n type: 'primary',\n };\n default:\n const valueContent =\n attributeProperties.format === AttributeFormat.encrypted\n ? '●●●●●●●●●●●●'\n : value.valuePayload;\n return {\n idCardProps: {description: valueContent},\n type: 'primary',\n };\n }\n });\n return <TableTagGroup tags={tags} />;\n } else if (isLinkValues(values, attributeProperties)) {\n switch (attributeProperties.multi_link_display_option) {\n case MultiDisplayOption.tag:\n return (\n <TableTagGroup\n tags={values.map(value => ({\n type: 'primary',\n idCardProps: {description: value.linkPayload?.whoAmI.label ?? undefined},\n }))}\n />\n );\n\n case MultiDisplayOption.badge_qty:\n return <KitBadge overflowCount={Infinity} count={values.length} color=\"primary\" />;\n\n case MultiDisplayOption.avatar:\n default:\n return (\n <KitAvatar.Group max={{count: 5}}>\n {values.map((value, index) => {\n if (!isLinkValue(value, attributeProperties)) {\n return null;\n }\n\n return (\n <KitAvatar\n key={index}\n label={String(value.linkPayload?.whoAmI.label)}\n src={value.linkPayload?.whoAmI.preview?.small}\n color=\"primary\"\n secondaryColorInvert\n />\n );\n })}\n </KitAvatar.Group>\n );\n }\n } else if (isTreeValues(values, attributeProperties)) {\n switch (attributeProperties.multi_tree_display_option) {\n case MultiDisplayOption.tag:\n return (\n <TableTagGroup\n tags={values.map(value => ({\n type: 'primary',\n idCardProps: {description: value.treePayload?.record.whoAmI.label ?? undefined},\n }))}\n />\n );\n case MultiDisplayOption.badge_qty:\n return <KitBadge overflowCount={Infinity} count={values.length} color=\"primary\" />;\n case MultiDisplayOption.avatar:\n default:\n return (\n <KitAvatar.Group max={{count: 5}}>\n {values.map((value, index) => {\n if (!isTreeValue(value, attributeProperties)) {\n return null;\n }\n\n return (\n <KitAvatar\n key={index}\n label={String(value.treePayload?.record.whoAmI.label)}\n src={value.treePayload?.record.whoAmI.preview?.small}\n color=\"primary\"\n secondaryColorInvert\n />\n );\n })}\n </KitAvatar.Group>\n );\n }\n }\n } else {\n const value = _getFirstValue(values[0], attributeProperties); // Not multiple_values attribute should not have more than one value\n if (!value) {\n return null;\n }\n\n let content: ReactNode = null;\n if (isStandardValue(value, attributeProperties)) {\n if (value.valuePayload === null) {\n return null;\n }\n\n switch (attributeProperties.format) {\n case AttributeFormat.boolean:\n const valueToDisplay = value.valuePayload ? t('global.yes') : t('global.no');\n content = (\n <KitTag\n key={attributeProperties.id}\n type={!!value.valuePayload ? 'primary' : 'neutral'}\n idCardProps={{description: valueToDisplay}}\n />\n );\n break;\n case AttributeFormat.rich_text:\n const tmp = document.createElement('div');\n tmp.innerHTML = DOMPurify.sanitize(value.valuePayload);\n const textContent = tmp.textContent;\n content = (\n <>\n <RightIcon icon={faListAlt} />\n <KitTypography.AdvancedText key={attributeProperties.id} ellipsis={{tooltip: textContent}}>\n {textContent}\n </KitTypography.AdvancedText>\n </>\n );\n break;\n case AttributeFormat.color:\n const color = new AggregationColor(value.valueRawPayload);\n content = (\n <>\n <StyledColorChip $colorTextContent={color.toHexString()} />\n <KitTypography.AdvancedText\n key={attributeProperties.id}\n ellipsis={{tooltip: value.valuePayload}}\n >\n {value.valuePayload}\n </KitTypography.AdvancedText>\n </>\n );\n break;\n case AttributeFormat.date_range:\n content = _getDateRangeValueContent(value.valuePayload);\n break;\n default:\n const valueContent =\n attributeProperties.format === AttributeFormat.encrypted ? '●●●●●●●●●●●●' : value.valuePayload;\n content = (\n <KitTypography.AdvancedText key={attributeProperties.id} ellipsis={{tooltip: valueContent}}>\n {valueContent}\n </KitTypography.AdvancedText>\n );\n break;\n }\n }\n\n if (isTreeValue(value, attributeProperties)) {\n content = value.treePayload?.record.whoAmI.label ? (\n <IdCard key={attributeProperties.id} item={value.treePayload.record.whoAmI} />\n ) : null;\n }\n\n if (isLinkValue(value, attributeProperties)) {\n content = value.linkPayload?.whoAmI ? (\n <IdCard key={attributeProperties.id} item={value.linkPayload.whoAmI} />\n ) : null;\n }\n\n return <StyledCenteringWrapper>{content}</StyledCenteringWrapper>;\n }\n\n return null;\n};\n"]}
|
|
@@ -6,9 +6,10 @@ import { IdCard } from './IdCard';
|
|
|
6
6
|
import { cloneElement, useRef } from 'react';
|
|
7
7
|
import { KitButton, KitDropDown, KitTooltip } from 'aristid-ds';
|
|
8
8
|
import styled from 'styled-components';
|
|
9
|
-
import { FaEllipsisH } from 'react-icons/fa';
|
|
10
9
|
import { useSharedTranslation } from '../../hooks/useSharedTranslation';
|
|
11
10
|
import { TOOLTIP_DEFAULT_DELAY_IN_SECONDS } from '../../constants';
|
|
11
|
+
import { faEllipsisH } from '@fortawesome/free-solid-svg-icons';
|
|
12
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
12
13
|
const StyledTableNameCellContainer = styled.div `
|
|
13
14
|
position: relative;
|
|
14
15
|
display: inline-flex;
|
|
@@ -65,6 +66,6 @@ export const TableNameCell = ({ item, itemActions }) => {
|
|
|
65
66
|
: null, // TODO: find better tuning
|
|
66
67
|
onClick: callback,
|
|
67
68
|
})),
|
|
68
|
-
}, children: _jsx(KitTooltip, { title: t('explorer.more-actions'), mouseEnterDelay: TOOLTIP_DEFAULT_DELAY_IN_SECONDS, children: _jsx(KitButton, { size: "m", "aria-label": t('explorer.more-actions') ?? undefined, icon: _jsx(
|
|
69
|
+
}, children: _jsx(KitTooltip, { title: t('explorer.more-actions'), mouseEnterDelay: TOOLTIP_DEFAULT_DELAY_IN_SECONDS, children: _jsx(KitButton, { size: "m", "aria-label": t('explorer.more-actions') ?? undefined, icon: _jsx(FontAwesomeIcon, { icon: faEllipsisH }), onClick: event => event.stopPropagation() }) }) }))] })] }));
|
|
69
70
|
};
|
|
70
71
|
//# sourceMappingURL=TableNameCell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableNameCell.js","sourceRoot":"","sources":["../../../src/components/Explorer/TableNameCell.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"TableNameCell.js","sourceRoot":"","sources":["../../../src/components/Explorer/TableNameCell.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAC,YAAY,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAC,SAAS,EAAE,WAAW,EAAE,UAAU,EAAC,MAAM,YAAY,CAAC;AAC9D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,gCAAgC,EAAC,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAC,WAAW,EAAC,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAE/D,MAAM,4BAA4B,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;CAK9C,CAAC;AAEF,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;CASnC,CAAC;AAEF,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;;CAE9B,CAAC;AAIF,MAAM,qBAAqB,GAAG,CAC1B,QAAmB,EACnB,cAAiB,EACQ,EAAE,CAC3B,CAAC,OAAO,cAAc,KAA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AAC,IAAI,EAAE,IAAI,CAAC,EAAE;wCAC5C,IAAI,EAAE,KAAK;qCACd,CAAC;oCACJ,CAAC,CAAC,IAAI,EAAE,2BAA2B;gCACvC,OAAO,EAAE,QAAQ;6BACpB,CAAC,CAAC;yBACV,YAED,KAAC,UAAU,IACP,KAAK,EAAE,CAAC,CAAC,uBAAuB,CAAC,EACjC,eAAe,EAAE,gCAAgC,YAEjD,KAAC,SAAS,IACN,IAAI,EAAC,GAAG,gBACI,CAAC,CAAC,uBAAuB,CAAC,IAAI,SAAS,EACnD,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,WAAW,GAAI,EAC5C,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,EAAE,GAC3C,GACO,GACH,CACjB,IACe,IACO,CAClC,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 {IdCard} from './IdCard';\nimport {type IItemAction, type IItemData} from './_types';\nimport {cloneElement, useRef} from 'react';\nimport {KitButton, KitDropDown, KitTooltip} from 'aristid-ds';\nimport styled from 'styled-components';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {TOOLTIP_DEFAULT_DELAY_IN_SECONDS} from '_ui/constants';\nimport {faEllipsisH} from '@fortawesome/free-solid-svg-icons';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\n\nconst StyledTableNameCellContainer = styled.div`\n position: relative;\n display: inline-flex;\n align-items: center;\n width: 100%;\n`;\n\nconst StyledActionsList = styled.div`\n /* Action are displayed when the user hover the table row (CSS in DataView.tsx) */\n display: none;\n gap: calc(var(--general-spacing-xxs) * 1px);\n transition:\n display 0.2s ease-in-out,\n align-items: center;\n justify-content: center;\n margin-left: calc(var(--general-spacing-xs) * 1px);\n`;\n\nconst StyledIdCard = styled.div`\n flex: 1;\n`;\n\ntype ResolvedItemActionProp<T> = T extends (item: IItemData) => infer R ? R : T;\n\nconst resolveItemActionProp = <T extends IItemAction[keyof IItemAction]>(\n itemData: IItemData,\n itemActionProp: T,\n): ResolvedItemActionProp<T> =>\n (typeof itemActionProp === 'function' ? itemActionProp(itemData) : itemActionProp) as ResolvedItemActionProp<T>;\n\ninterface ITableNameCellProps {\n item: IItemData;\n itemActions: IItemAction[];\n}\n\nexport const TableNameCell = ({item, itemActions}: ITableNameCellProps) => {\n const {t} = useSharedTranslation();\n const containerRef = useRef<HTMLDivElement>(null);\n\n const itemActionsWithCallback = itemActions.map(action => ({\n ...action,\n callback: () => action.callback(item),\n }));\n\n const isMoreThanThreeActions = itemActionsWithCallback.length > 3;\n\n const itemsActionsWithCallbackToDisplay = isMoreThanThreeActions\n ? itemActionsWithCallback.slice(0, 2)\n : itemActionsWithCallback;\n\n const _handleButtonClick = (event: MouseEvent, callback: () => void) => {\n // Stop event propagation to avoid the row click event to be triggered\n event.stopPropagation();\n callback();\n };\n\n return (\n <StyledTableNameCellContainer ref={containerRef}>\n <StyledIdCard>\n <IdCard item={item.whoAmI} />\n </StyledIdCard>\n <StyledActionsList className=\"actions-list\">\n {itemsActionsWithCallbackToDisplay.map(\n ({label, icon, isDanger, callback, disabled, useItemDeletePermission}, actionIndex) => {\n const disabledButton = useItemDeletePermission\n ? !item.canDelete\n : resolveItemActionProp(item, disabled);\n\n return (\n <KitTooltip\n key={actionIndex}\n title={resolveItemActionProp(item, label)}\n mouseEnterDelay={TOOLTIP_DEFAULT_DELAY_IN_SECONDS}\n >\n <KitButton\n size=\"m\"\n aria-label={resolveItemActionProp(item, label)}\n icon={resolveItemActionProp(item, icon)}\n onClick={event => _handleButtonClick(event, callback)}\n danger={resolveItemActionProp(item, isDanger)}\n disabled={disabledButton}\n />\n </KitTooltip>\n );\n },\n )}\n {isMoreThanThreeActions && (\n <KitDropDown\n placement=\"bottomRight\"\n getPopupContainer={() => containerRef.current || document.body}\n destroyPopupOnHide={true}\n menu={{\n items: itemActionsWithCallback\n .slice(2)\n .map(({callback, icon, label, isDanger, disabled}) => ({\n key: resolveItemActionProp(item, label),\n danger: resolveItemActionProp(item, isDanger),\n disabled: resolveItemActionProp(item, disabled),\n label: resolveItemActionProp(item, label),\n icon: icon\n ? cloneElement(resolveItemActionProp(item, icon), {\n size: '2em',\n })\n : null, // TODO: find better tuning\n onClick: callback,\n })),\n }}\n >\n <KitTooltip\n title={t('explorer.more-actions')}\n mouseEnterDelay={TOOLTIP_DEFAULT_DELAY_IN_SECONDS}\n >\n <KitButton\n size=\"m\"\n aria-label={t('explorer.more-actions') ?? undefined}\n icon={<FontAwesomeIcon icon={faEllipsisH} />}\n onClick={event => event.stopPropagation()}\n />\n </KitTooltip>\n </KitDropDown>\n )}\n </StyledActionsList>\n </StyledTableNameCellContainer>\n );\n};\n"]}
|
|
@@ -24,16 +24,16 @@ export declare const useExplorerData: ({ entrypoint, libraryId, attributeIds, fu
|
|
|
24
24
|
canEditLinkAttributeValues: boolean;
|
|
25
25
|
loading: boolean;
|
|
26
26
|
refetch: ((variables?: Partial<import("../../../_gqlTypes").Exact<{
|
|
27
|
-
libraryId: import("../../../_gqlTypes").Scalars["ID"];
|
|
28
|
-
attributeIds: Array<import("../../../_gqlTypes").Scalars["ID"]> | import("../../../_gqlTypes").Scalars["ID"];
|
|
27
|
+
libraryId: import("../../../_gqlTypes").Scalars["ID"]["input"];
|
|
28
|
+
attributeIds: Array<import("../../../_gqlTypes").Scalars["ID"]["input"]> | import("../../../_gqlTypes").Scalars["ID"]["input"];
|
|
29
29
|
pagination?: import("../../../_gqlTypes").InputMaybe<import("../../../_gqlTypes").RecordsPagination>;
|
|
30
30
|
filters?: import("../../../_gqlTypes").InputMaybe<Array<import("../../../_gqlTypes").InputMaybe<import("../../../_gqlTypes").RecordFilterInput>> | import("../../../_gqlTypes").InputMaybe<import("../../../_gqlTypes").RecordFilterInput>>;
|
|
31
31
|
multipleSort?: import("../../../_gqlTypes").InputMaybe<Array<import("../../../_gqlTypes").RecordSortInput> | import("../../../_gqlTypes").RecordSortInput>;
|
|
32
|
-
searchQuery?: import("../../../_gqlTypes").InputMaybe<import("../../../_gqlTypes").Scalars["String"]>;
|
|
32
|
+
searchQuery?: import("../../../_gqlTypes").InputMaybe<import("../../../_gqlTypes").Scalars["String"]["input"]>;
|
|
33
33
|
}>>) => Promise<import("@apollo/client").ApolloQueryResult<ExplorerLibraryDataQuery>>) | ((variables?: Partial<import("../../../_gqlTypes").Exact<{
|
|
34
|
-
attributeIds: Array<import("../../../_gqlTypes").Scalars["ID"]> | import("../../../_gqlTypes").Scalars["ID"];
|
|
35
|
-
parentLibraryId: import("../../../_gqlTypes").Scalars["ID"];
|
|
36
|
-
parentRecordId?: import("../../../_gqlTypes").InputMaybe<import("../../../_gqlTypes").Scalars["String"]>;
|
|
37
|
-
linkAttributeId: import("../../../_gqlTypes").Scalars["ID"];
|
|
34
|
+
attributeIds: Array<import("../../../_gqlTypes").Scalars["ID"]["input"]> | import("../../../_gqlTypes").Scalars["ID"]["input"];
|
|
35
|
+
parentLibraryId: import("../../../_gqlTypes").Scalars["ID"]["input"];
|
|
36
|
+
parentRecordId?: import("../../../_gqlTypes").InputMaybe<import("../../../_gqlTypes").Scalars["String"]["input"]>;
|
|
37
|
+
linkAttributeId: import("../../../_gqlTypes").Scalars["ID"]["input"];
|
|
38
38
|
}>>) => Promise<import("@apollo/client").ApolloQueryResult<ExplorerLinkDataQuery>>);
|
|
39
39
|
};
|
|
@@ -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, FaTrashRestore } from 'react-icons/fa';
|
|
7
6
|
import { KitModal } from 'aristid-ds';
|
|
8
7
|
import { useActivateRecordsMutation, useDeactivateRecordsMutation, useDeleteValueMutation, } from '../../../_gqlTypes';
|
|
9
8
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
10
9
|
import { useValuesCacheUpdate } from '../../../hooks/useValuesCacheUpdate';
|
|
11
10
|
import { ViewSettingsActionTypes } from '../manage-view-settings';
|
|
12
11
|
import { BREAK_TWO_LINES, MASS_SELECTION_ALL } from '../_constants';
|
|
12
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
13
|
+
import { faTrash, faTrashRestore } from '@fortawesome/free-solid-svg-icons';
|
|
13
14
|
/**
|
|
14
15
|
* Hook used to get the action for `<DataView />` component.
|
|
15
16
|
*
|
|
@@ -111,7 +112,7 @@ export const useEditStatusItemAction = ({ isEnabled, canDeleteLinkValues, store:
|
|
|
111
112
|
? t('explorer.deactivate-item')
|
|
112
113
|
: t('explorer.activate-item')
|
|
113
114
|
: t('explorer.delete-item'),
|
|
114
|
-
icon: (item) => entrypoint.type === 'library'
|
|
115
|
+
icon: (item) => (_jsx(FontAwesomeIcon, { icon: entrypoint.type === 'library' && !item.active ? faTrashRestore : faTrash })),
|
|
115
116
|
isDanger: true,
|
|
116
117
|
disabled: (item) => entrypoint.type === 'link' ? !canDeleteLinkValues : item.active ? !item.canDelete : !item.canActivate,
|
|
117
118
|
callback: item => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditStatusItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useEditStatusItemAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAgB,OAAO,EAAC,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAC,OAAO,EAAE,cAAc,EAAC,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAGH,0BAA0B,EAC1B,4BAA4B,EAC5B,sBAAsB,GACzB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,oBA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,EAAE;oBACb,QAAQ,UAAU,CAAC,IAAI,EAAE,CAAC;wBACtB,KAAK,SAAS;4BACV,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gCACd,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;4BACjC,CAAC;4BAED,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","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 {FaTrash, FaTrashRestore} from 'react-icons/fa';\nimport {KitModal} from 'aristid-ds';\nimport {\n type ActivateRecordsMutation,\n type DeactivateRecordsMutation,\n useActivateRecordsMutation,\n useDeactivateRecordsMutation,\n useDeleteValueMutation,\n} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {useValuesCacheUpdate} from '_ui/hooks/useValuesCacheUpdate';\nimport {type FeatureHook, type Entrypoint, type IEntrypointLink, type IItemAction, type IItemData} from '../_types';\nimport {type IViewSettingsAction, type IViewSettingsState, ViewSettingsActionTypes} from '../manage-view-settings';\nimport {BREAK_TWO_LINES, MASS_SELECTION_ALL} from '../_constants';\nimport {type FetchResult} from '@apollo/client';\n\n/**\n * Hook used to get the action for `<DataView />` component.\n *\n * When the mutation for removing is done, the Apollo cache will be clean (`Record` and `RecordIdentity`)\n * from removed 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 entrypoint - represent the current entrypoint\n * @param canDeleteLinkValues - check permission to delete link values\n */\nexport const useEditStatusItemAction = ({\n isEnabled,\n canDeleteLinkValues,\n store: {view, dispatch},\n onRemove,\n entrypoint,\n}: FeatureHook<{\n store: {\n view: IViewSettingsState;\n dispatch: Dispatch<IViewSettingsAction>;\n };\n canDeleteLinkValues: boolean;\n onRemove?: IItemAction['callback'];\n entrypoint: Entrypoint;\n}>) => {\n const {t} = useSharedTranslation();\n const updateValuesCache = useValuesCacheUpdate();\n\n const [deactivateRecordsMutation] = useDeactivateRecordsMutation({\n update(cache, deactivatedRecords) {\n deactivatedRecords.data?.deactivateRecords.forEach(record => {\n cache.evict({\n id: cache.identify(record),\n });\n });\n cache.modify({\n fields: {\n records: prev => ({\n ...prev,\n totalCount: prev.totalCount - 1,\n }),\n },\n broadcast: false,\n });\n cache.gc();\n },\n });\n\n const [activateRecordsMutation] = useActivateRecordsMutation({\n update(cache, activatedRecords) {\n activatedRecords.data?.activateRecords.forEach(record => {\n cache.evict({\n id: cache.identify(record),\n });\n });\n cache.modify({\n fields: {\n records: prev => ({\n ...prev,\n totalCount: prev.totalCount - 1,\n }),\n },\n broadcast: false,\n });\n cache.gc();\n },\n });\n\n const [deleteRecordLinkMutation] = useDeleteValueMutation({\n update: (_, deletedRecord) => {\n const parentRecord = {\n id: (entrypoint as IEntrypointLink).parentRecordId,\n library: {\n id: (entrypoint as IEntrypointLink).parentLibraryId,\n },\n };\n updateValuesCache(parentRecord, deletedRecord.data?.deleteValue ?? []);\n },\n });\n\n const _deactivateItem = async (item: IItemData): Promise<FetchResult<DeactivateRecordsMutation>> => {\n const libRes = await deactivateRecordsMutation({\n variables: {\n libraryId: item.libraryId,\n recordsIds: [item.itemId],\n },\n });\n\n if (view.massSelection !== MASS_SELECTION_ALL) {\n dispatch({\n type: ViewSettingsActionTypes.SET_SELECTED_KEYS,\n payload: view.massSelection.filter(key => key !== item.itemId),\n });\n }\n\n onRemove?.(item);\n\n return libRes;\n };\n\n const _activateItem = async (item: IItemData): Promise<FetchResult<ActivateRecordsMutation>> => {\n const libRes = await activateRecordsMutation({\n variables: {\n libraryId: item.libraryId,\n recordsIds: [item.itemId],\n },\n });\n\n if (view.massSelection !== MASS_SELECTION_ALL) {\n dispatch({\n type: ViewSettingsActionTypes.SET_SELECTED_KEYS,\n payload: view.massSelection.filter(key => key !== item.itemId),\n });\n }\n\n return libRes;\n };\n\n const _editStatusItemAction: IItemAction = useMemo(\n () => ({\n label: (item: IItemData) =>\n entrypoint.type === 'library'\n ? item.active\n ? t('explorer.deactivate-item')\n : t('explorer.activate-item')\n : t('explorer.delete-item'),\n icon: (item: IItemData) =>\n entrypoint.type === 'library' ? item.active ? <FaTrash /> : <FaTrashRestore /> : <FaTrash />,\n isDanger: true,\n disabled: (item: IItemData) =>\n entrypoint.type === 'link' ? !canDeleteLinkValues : item.active ? !item.canDelete : !item.canActivate,\n callback: item => {\n const {itemId, id_value} = item;\n\n const title =\n entrypoint.type === 'library'\n ? item.active\n ? t('explorer.deactivate_item_one')\n : t('explorer.activate_item_one')\n : t('explorer.delete_link_one');\n\n const content =\n entrypoint.type === 'library'\n ? item.active\n ? t('explorer.deactivate_item_description_one')\n : t('explorer.activate_item_description_one')\n : t('explorer.delete_link_description_one');\n\n KitModal.confirm({\n width: '100%',\n style: {content: {width: '90vw', maxWidth: '656px'}},\n type: 'confirm',\n icon: false,\n title,\n content: content + BREAK_TWO_LINES + t('global.are_you_sure'),\n okText: t('global.confirm') ?? undefined,\n cancelText: t('global.cancel') ?? undefined,\n onOk: async () => {\n switch (entrypoint.type) {\n case 'library':\n if (item.active) {\n return _deactivateItem(item);\n }\n\n return _activateItem(item);\n case 'link':\n const linkRes = await deleteRecordLinkMutation({\n variables: {\n library: entrypoint.parentLibraryId,\n attribute: entrypoint.linkAttributeId,\n recordId: entrypoint.parentRecordId,\n value: {\n payload: itemId,\n id_value,\n },\n },\n });\n onRemove?.(item);\n return linkRes;\n default:\n return;\n }\n },\n });\n },\n }),\n [\n t,\n deactivateRecordsMutation,\n deleteRecordLinkMutation,\n activateRecordsMutation,\n canDeleteLinkValues,\n entrypoint.type,\n view.massSelection,\n dispatch,\n ],\n );\n\n return {\n editStatusItemAction: isEnabled ? _editStatusItemAction : null,\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"useEditStatusItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useEditStatusItemAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAgB,OAAO,EAAC,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAGH,0BAA0B,EAC1B,4BAA4B,EAC5B,sBAAsB,GACzB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAoD,uBAAuB,EAAC,MAAM,yBAAyB,CAAC;AACnH,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAElE,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAA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BAED,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","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 {KitModal} from 'aristid-ds';\nimport {\n type ActivateRecordsMutation,\n type DeactivateRecordsMutation,\n useActivateRecordsMutation,\n useDeactivateRecordsMutation,\n useDeleteValueMutation,\n} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {useValuesCacheUpdate} from '_ui/hooks/useValuesCacheUpdate';\nimport {type FeatureHook, type Entrypoint, type IEntrypointLink, type IItemAction, type IItemData} from '../_types';\nimport {type IViewSettingsAction, type IViewSettingsState, ViewSettingsActionTypes} from '../manage-view-settings';\nimport {BREAK_TWO_LINES, MASS_SELECTION_ALL} from '../_constants';\nimport {type FetchResult} from '@apollo/client';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faTrash, faTrashRestore} from '@fortawesome/free-solid-svg-icons';\n\n/**\n * Hook used to get the action for `<DataView />` component.\n *\n * When the mutation for removing is done, the Apollo cache will be clean (`Record` and `RecordIdentity`)\n * from removed 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 entrypoint - represent the current entrypoint\n * @param canDeleteLinkValues - check permission to delete link values\n */\nexport const useEditStatusItemAction = ({\n isEnabled,\n canDeleteLinkValues,\n store: {view, dispatch},\n onRemove,\n entrypoint,\n}: FeatureHook<{\n store: {\n view: IViewSettingsState;\n dispatch: Dispatch<IViewSettingsAction>;\n };\n canDeleteLinkValues: boolean;\n onRemove?: IItemAction['callback'];\n entrypoint: Entrypoint;\n}>) => {\n const {t} = useSharedTranslation();\n const updateValuesCache = useValuesCacheUpdate();\n\n const [deactivateRecordsMutation] = useDeactivateRecordsMutation({\n update(cache, deactivatedRecords) {\n deactivatedRecords.data?.deactivateRecords.forEach(record => {\n cache.evict({\n id: cache.identify(record),\n });\n });\n cache.modify({\n fields: {\n records: prev => ({\n ...prev,\n totalCount: prev.totalCount - 1,\n }),\n },\n broadcast: false,\n });\n cache.gc();\n },\n });\n\n const [activateRecordsMutation] = useActivateRecordsMutation({\n update(cache, activatedRecords) {\n activatedRecords.data?.activateRecords.forEach(record => {\n cache.evict({\n id: cache.identify(record),\n });\n });\n cache.modify({\n fields: {\n records: prev => ({\n ...prev,\n totalCount: prev.totalCount - 1,\n }),\n },\n broadcast: false,\n });\n cache.gc();\n },\n });\n\n const [deleteRecordLinkMutation] = useDeleteValueMutation({\n update: (_, deletedRecord) => {\n const parentRecord = {\n id: (entrypoint as IEntrypointLink).parentRecordId,\n library: {\n id: (entrypoint as IEntrypointLink).parentLibraryId,\n },\n };\n updateValuesCache(parentRecord, deletedRecord.data?.deleteValue ?? []);\n },\n });\n\n const _deactivateItem = async (item: IItemData): Promise<FetchResult<DeactivateRecordsMutation>> => {\n const libRes = await deactivateRecordsMutation({\n variables: {\n libraryId: item.libraryId,\n recordsIds: [item.itemId],\n },\n });\n\n if (view.massSelection !== MASS_SELECTION_ALL) {\n dispatch({\n type: ViewSettingsActionTypes.SET_SELECTED_KEYS,\n payload: view.massSelection.filter(key => key !== item.itemId),\n });\n }\n\n onRemove?.(item);\n\n return libRes;\n };\n\n const _activateItem = async (item: IItemData): Promise<FetchResult<ActivateRecordsMutation>> => {\n const libRes = await activateRecordsMutation({\n variables: {\n libraryId: item.libraryId,\n recordsIds: [item.itemId],\n },\n });\n\n if (view.massSelection !== MASS_SELECTION_ALL) {\n dispatch({\n type: ViewSettingsActionTypes.SET_SELECTED_KEYS,\n payload: view.massSelection.filter(key => key !== item.itemId),\n });\n }\n\n return libRes;\n };\n\n const _editStatusItemAction: IItemAction = useMemo(\n () => ({\n label: (item: IItemData) =>\n entrypoint.type === 'library'\n ? item.active\n ? t('explorer.deactivate-item')\n : t('explorer.activate-item')\n : t('explorer.delete-item'),\n icon: (item: IItemData) => (\n <FontAwesomeIcon icon={entrypoint.type === 'library' && !item.active ? faTrashRestore : faTrash} />\n ),\n isDanger: true,\n disabled: (item: IItemData) =>\n entrypoint.type === 'link' ? !canDeleteLinkValues : item.active ? !item.canDelete : !item.canActivate,\n callback: item => {\n const {itemId, id_value} = item;\n\n const title =\n entrypoint.type === 'library'\n ? item.active\n ? t('explorer.deactivate_item_one')\n : t('explorer.activate_item_one')\n : t('explorer.delete_link_one');\n\n const content =\n entrypoint.type === 'library'\n ? item.active\n ? t('explorer.deactivate_item_description_one')\n : t('explorer.activate_item_description_one')\n : t('explorer.delete_link_description_one');\n\n KitModal.confirm({\n width: '100%',\n style: {content: {width: '90vw', maxWidth: '656px'}},\n type: 'confirm',\n icon: false,\n title,\n content: content + BREAK_TWO_LINES + t('global.are_you_sure'),\n okText: t('global.confirm') ?? undefined,\n cancelText: t('global.cancel') ?? undefined,\n onOk: async () => {\n switch (entrypoint.type) {\n case 'library':\n if (item.active) {\n return _deactivateItem(item);\n }\n\n return _activateItem(item);\n case 'link':\n const linkRes = await deleteRecordLinkMutation({\n variables: {\n library: entrypoint.parentLibraryId,\n attribute: entrypoint.linkAttributeId,\n recordId: entrypoint.parentRecordId,\n value: {\n payload: itemId,\n id_value,\n },\n },\n });\n onRemove?.(item);\n return linkRes;\n default:\n return;\n }\n },\n });\n },\n }),\n [\n t,\n deactivateRecordsMutation,\n deleteRecordLinkMutation,\n activateRecordsMutation,\n canDeleteLinkValues,\n entrypoint.type,\n view.massSelection,\n dispatch,\n ],\n );\n\n return {\n editStatusItemAction: isEnabled ? _editStatusItemAction : null,\n };\n};\n"]}
|
|
@@ -12,10 +12,11 @@ import { type ISubmitMultipleResult } from '../../../components/RecordEdition/Ed
|
|
|
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, isMultivalue, canReplaceLinkValues, }: FeatureHook<{
|
|
15
|
+
export declare const useReplaceItemAction: ({ isEnabled, onReplace, isMultivalue, canReplaceLinkValues, columnsToDisplay, }: FeatureHook<{
|
|
16
16
|
isMultivalue: boolean;
|
|
17
17
|
onReplace?: (replaceValuesResult: ISubmitMultipleResult) => void;
|
|
18
18
|
canReplaceLinkValues: boolean;
|
|
19
|
+
columnsToDisplay: string[];
|
|
19
20
|
}>) => {
|
|
20
21
|
replaceItemAction: IItemAction;
|
|
21
22
|
replaceItemModal: JSX.Element;
|
|
@@ -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;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACjC,SAAS,EACT,SAAS,EACT,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,GAMlB,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,eAAe,IAAC,IAAI,EAAE,aAAa,GAAI;QAC9C,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,EACD,gBAAgB,EAAE,gBAAgB,GACpC,CACL,CAAC,CAAC,CAAC,IAAI;KACf,CAAC,EACF,CAAC,SAAS,EAAE,kBAAkB,EAAE,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 {};
|