@leav/ui 1.6.0-46547e6c → 1.6.0-4fe8c6ba

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.
Files changed (33) hide show
  1. package/dist/_gqlTypes/index.d.ts +624 -701
  2. package/dist/_gqlTypes/index.js +46 -166
  3. package/dist/_gqlTypes/index.js.map +1 -1
  4. package/dist/components/Explorer/Explorer.js +2 -2
  5. package/dist/components/Explorer/Explorer.js.map +1 -1
  6. package/dist/components/Explorer/_queries/useExplorerData.d.ts +7 -7
  7. package/dist/components/Explorer/_queries/useExplorerData.js +19 -7
  8. package/dist/components/Explorer/_queries/useExplorerData.js.map +1 -1
  9. package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.d.ts +10 -0
  10. package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.js +46 -0
  11. package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.js.map +1 -0
  12. package/dist/components/Explorer/actions-mass/export/content/NoProfiles.d.ts +1 -0
  13. package/dist/components/Explorer/actions-mass/export/content/NoProfiles.js +17 -0
  14. package/dist/components/Explorer/actions-mass/export/content/NoProfiles.js.map +1 -0
  15. package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.d.ts +8 -0
  16. package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.js +49 -0
  17. package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.js.map +1 -0
  18. package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.d.ts +27 -0
  19. package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.js +48 -0
  20. package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.js.map +1 -0
  21. package/dist/components/Explorer/actions-mass/useExportMassAction.d.ts +7 -4
  22. package/dist/components/Explorer/actions-mass/useExportMassAction.js +76 -71
  23. package/dist/components/Explorer/actions-mass/useExportMassAction.js.map +1 -1
  24. package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js.map +1 -1
  25. package/dist/components/Explorer/useSearchInput.js +6 -2
  26. package/dist/components/Explorer/useSearchInput.js.map +1 -1
  27. package/dist/components/Filters/context/filtersReducer.js +2 -3
  28. package/dist/components/Filters/context/filtersReducer.js.map +1 -1
  29. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js +1 -2
  30. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js.map +1 -1
  31. package/dist/locales/en/shared.json +11 -0
  32. package/dist/locales/fr/shared.json +11 -0
  33. package/package.json +14 -17
@@ -120,7 +120,7 @@ export const Explorer = forwardRef(({ entrypoint, itemActions = [], primaryActio
120
120
  maxItemsLeft: null, // TODO: use KitTable.row
121
121
  });
122
122
  const allVisibleKeys = data?.records.map(({ key }) => key) ?? [];
123
- const { exportMassAction } = useExportMassAction({
123
+ const { exportMassAction, ExportModal } = useExportMassAction({
124
124
  isEnabled: !isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('export'),
125
125
  store: { view, dispatch: viewSettingsDispatch },
126
126
  totalCount,
@@ -201,6 +201,6 @@ export const Explorer = forwardRef(({ entrypoint, itemActions = [], primaryActio
201
201
  ? data?.records.map(({ whoAmI }) => whoAmI.id)
202
202
  : view.massSelection,
203
203
  mode: selectionMode,
204
- } }))] }), settingsPanelElement && createPortal(_jsx(SidePanel, {}), settingsPanelElement?.() ?? document.body), replaceItemModal, createModal, linkModal, editAttributeMassActionModal] }) }), _jsx(KitSnackBarProvider, { id: massActionSnackbarId })] }));
204
+ } }))] }), settingsPanelElement && createPortal(_jsx(SidePanel, {}), settingsPanelElement?.() ?? document.body), replaceItemModal, createModal, linkModal, editAttributeMassActionModal, ExportModal] }) }), _jsx(KitSnackBarProvider, { id: massActionSnackbarId })] }));
205
205
  });
206
206
  //# sourceMappingURL=Explorer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Explorer.js","sourceRoot":"","sources":["../../../src/components/Explorer/Explorer.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,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;wCAClB,YAAY,EAAE,kBAAkB;4CAC5B,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;4CAC5C,CAAC,CAAE,IAAI,CAAC,aAA0B;wCACtC,IAAI,EAAE,aAAa;qCACtB,GACH,CACL,IACmB,EACvB,oBAAoB,IAAI,YAAY,CAAC,KAAC,SAAS,KAAG,EAAE,oBAAoB,EAAE,EAAE,IAAI,QAAQ,CAAC,IAAI,CAAC,EAC9F,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,4BAA4B,IACF,GACT,EAC1B,KAAC,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 });\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,s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D,kBAAkB;wCAClB,YAAY,EAAE,kBAAkB;4CAC5B,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;4CAC5C,CAAC,CAAE,IAAI,CAAC,aAA0B;wCACtC,IAAI,EAAE,aAAa;qCACtB,GACH,CACL,IACmB,EACvB,oBAAoB,IAAI,YAAY,CAAC,KAAC,SAAS,KAAG,EAAE,oBAAoB,EAAE,EAAE,IAAI,QAAQ,CAAC,IAAI,CAAC,EAC9F,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,4BAA4B,EAC5B,WAAW,IACe,GACT,EAC1B,KAAC,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 });\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, 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"]}
@@ -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
  };
@@ -4,8 +4,9 @@
4
4
  import { localizedTranslation } from '@leav/utils';
5
5
  import { useEffect, useMemo } from 'react';
6
6
  import { useGetRecordUpdatesSubscription, useLang } from '../../../hooks';
7
- import { useExplorerLibraryDataQuery, useExplorerLinkAttributeQuery, useExplorerLinkDataQuery, } from '../../../_gqlTypes';
7
+ import { useExplorerLibraryDataLazyQuery, useExplorerLibraryDataQuery, useExplorerLinkAttributeQuery, useExplorerLinkDataQuery, } from '../../../_gqlTypes';
8
8
  import { prepareFiltersForRequest } from '../../../components/Filters';
9
+ import { AttributeConditionFilter } from '../../../types';
9
10
  export const dateValuesSeparator = '\n';
10
11
  const _mappingLibrary = (data, libraryId, availableLangs) => {
11
12
  const attributes = data.records.list.length
@@ -118,6 +119,7 @@ export const useExplorerData = ({ entrypoint, libraryId, attributeIds, fulltextS
118
119
  filters: preparedFilters,
119
120
  },
120
121
  });
122
+ const [fetchLibraryRecord] = useExplorerLibraryDataLazyQuery();
121
123
  const isMultivalue = !!attributeData?.attributes?.list?.[0]?.multiple_values;
122
124
  const canEditLinkAttributeValues = !!attributeData?.attributes?.list?.[0]?.permissions?.edit_value;
123
125
  const memoizedData = useMemo(() => {
@@ -133,15 +135,25 @@ export const useExplorerData = ({ entrypoint, libraryId, attributeIds, fulltextS
133
135
  const { data: updatedData } = useGetRecordUpdatesSubscription({ libraries: [libraryId], records: ids }, !libraryId);
134
136
  // TOTO: change to useMemo, and use updatedData to update memoizedData with new Data. Good luck !
135
137
  useEffect(() => {
136
- if (updatedData) {
138
+ if (updatedData && memoizedData) {
137
139
  if (isLibrary) {
138
- libraryRefetch();
139
- }
140
- else {
141
- linkRefetch();
140
+ //fetching updated record will update cache data, and all will be updated automatically
141
+ fetchLibraryRecord({
142
+ variables: {
143
+ libraryId,
144
+ attributeIds,
145
+ filters: [
146
+ {
147
+ field: 'id',
148
+ condition: AttributeConditionFilter.EQUAL,
149
+ value: updatedData.recordUpdate.record.id,
150
+ },
151
+ ],
152
+ },
153
+ });
142
154
  }
143
155
  }
144
- }, [updatedData]);
156
+ }, [updatedData, memoizedData]);
145
157
  return {
146
158
  data: memoizedData,
147
159
  isMultivalue,
@@ -1 +1 @@
1
- {"version":3,"file":"useExplorerData.js","sourceRoot":"","sources":["../../../../src/components/Explorer/_queries/useExplorerData.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAC,SAAS,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AACzC,OAAO,EAAC,+BAA+B,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AAQnE,OAAO,EAKH,2BAA2B,EAC3B,6BAA6B,EAC7B,wBAAwB,GAC3B,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,wBAAwB,EAAC,MAAM,wBAAwB,CAAC;AAEhE,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC,MAAM,eAAe,GAAG,CACpB,IAA8B,EAC9B,SAAiB,EACjB,cAAwB,EACX,EAAE;IACf,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM;QACvC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE;YACrD,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG;gBACxB,GAAG,QAAQ,CAAC,mBAAmB;gBAC/B,KAAK,EAAE,oBAAoB,CAAC,QAAQ,CAAC,mBAAmB,CAAC,KAAK,EAAE,cAAc,CAAC;aAClF,CAAC;YAEF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;QAC/E,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,MAAM,GAAG,GAAG,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/D,MAAM,EAAC,IAAI,EAAE,WAAW,EAAC,GAAG,+BAA+B,CAAC,EAAC,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,EAAC,EAAE,CAAC,SAAS,CAAC,CAAC;IAEhH,iGAAiG;IACjG,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,WAAW,EAAE,CAAC;YACd,IAAI,SAAS,EAAE,CAAC;gBACZ,cAAc,EAAE,CAAC;YACrB,CAAC;iBAAM,CAAC;gBACJ,WAAW,EAAE,CAAC;YAClB,CAAC;QACL,CAAC;IACL,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,OAAO;QACH,IAAI,EAAE,YAAY;QAClB,YAAY;QACZ,0BAA0B;QAC1B,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW;QACjD,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW;KACpD,CAAC;AACN,CAAC,CAAC","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 {localizedTranslation} from '@leav/utils';\nimport {useEffect, useMemo} from 'react';\nimport {useGetRecordUpdatesSubscription, useLang} from '_ui/hooks';\nimport {\n type Entrypoint,\n type IEntrypointLink,\n type IExplorerData,\n type DefaultViewSettings,\n type IEntrypointLibrary,\n} from '../_types';\nimport {\n type ExplorerLibraryDataQuery,\n type ExplorerLinkDataQuery,\n type LinkPropertyLinkValueFragment,\n type SortOrder,\n useExplorerLibraryDataQuery,\n useExplorerLinkAttributeQuery,\n useExplorerLinkDataQuery,\n} from '_ui/_gqlTypes';\nimport {type UIFilter} from '_ui/components/Filters/_types';\nimport {prepareFiltersForRequest} from '_ui/components/Filters';\n\nexport const dateValuesSeparator = '\\n';\n\nconst _mappingLibrary = (\n data: ExplorerLibraryDataQuery,\n libraryId: string,\n availableLangs: string[],\n): IExplorerData => {\n const attributes = data.records.list.length\n ? data.records.list[0].properties.reduce((acc, property) => {\n acc[property.attributeId] = {\n ...property.attributeProperties,\n label: localizedTranslation(property.attributeProperties.label, availableLangs),\n };\n\n return acc;\n }, {})\n : {};\n\n const records = data.records.list.map(({whoAmI, active, permissions, properties}) => ({\n libraryId,\n key: whoAmI.id, // For <KitTable /> only\n itemId: whoAmI.id, // For <KitTable /> only\n active,\n canActivate: permissions.create_record,\n canDelete: permissions.delete_record,\n whoAmI: {\n label: null,\n subLabel: null,\n color: null,\n preview: null,\n ...whoAmI,\n },\n propertiesById: properties.reduce((acc, {attributeId, values}) => ({...acc, [attributeId]: values}), {}),\n }));\n\n return {\n totalCount: data.records.totalCount ?? 0,\n attributes,\n records,\n };\n};\n\nconst _mappingLink = (data: ExplorerLinkDataQuery, libraryId: string, availableLangs: string[]): IExplorerData => {\n const attributes = data.records.list.length\n ? ((data.records.list[0].property[0] as LinkPropertyLinkValueFragment)?.payload?.properties ?? []).reduce(\n (acc, property) => {\n acc[property.attributeId] = {\n ...property.attributeProperties,\n label: localizedTranslation(property.attributeProperties.label, availableLangs),\n };\n\n return acc;\n },\n {},\n )\n : {};\n\n const records =\n (data.records.list.length &&\n data.records.list[0].property\n .map((linkValue: LinkPropertyLinkValueFragment, index: number) => {\n if (!linkValue.payload) {\n return null;\n }\n\n return {\n libraryId,\n // same link id can be duplicated, so we add the index to the key\n key: linkValue.payload.whoAmI.id + index, // For <KitTable /> only\n itemId: linkValue.payload.whoAmI.id, // For <KitTable /> only\n canActivate: true,\n canDelete: true,\n active: true,\n whoAmI: {\n label: null,\n subLabel: null,\n color: null,\n preview: null,\n ...linkValue.payload.whoAmI,\n },\n propertiesById: linkValue.payload.properties.reduce(\n (acc, {attributeId, values}) => ({...acc, [attributeId]: values}),\n {},\n ),\n id_value: linkValue.id_value ?? undefined,\n };\n })\n .filter(Boolean)) ||\n [];\n\n return {\n totalCount: records.length,\n attributes,\n records,\n };\n};\n\nexport const useExplorerData = ({\n entrypoint,\n libraryId,\n attributeIds,\n fulltextSearch,\n sorts,\n pagination,\n filters,\n filtersOperator,\n skip,\n}: {\n entrypoint: Entrypoint;\n libraryId: string;\n attributeIds: string[];\n fulltextSearch: string;\n sorts: Array<{\n field: string;\n order: SortOrder;\n }>;\n pagination: null | {limit: number; offset: number};\n filters: UIFilter[];\n filtersOperator: DefaultViewSettings['filtersOperator'];\n skip: boolean;\n}) => {\n const {lang: availableLangs} = useLang();\n\n const isLibrary = entrypoint.type === 'library';\n const isLink = entrypoint.type === 'link';\n\n const {data: attributeData} = useExplorerLinkAttributeQuery({\n skip: isLibrary,\n variables: {\n id: (entrypoint as IEntrypointLink).linkAttributeId,\n },\n });\n\n const isLinkAttributeAllowed = attributeData?.attributes?.list?.[0]?.permissions?.access_attribute;\n const {\n data: linkData,\n loading: linkLoading,\n refetch: linkRefetch,\n } = useExplorerLinkDataQuery({\n fetchPolicy: 'network-only',\n skip: skip || !isLink || !isLinkAttributeAllowed,\n variables: {\n parentLibraryId: (entrypoint as IEntrypointLink).parentLibraryId,\n parentRecordId: (entrypoint as IEntrypointLink).parentRecordId,\n linkAttributeId: (entrypoint as IEntrypointLink).linkAttributeId,\n attributeIds,\n },\n });\n\n const allowFreeEntry = isLibrary ? (entrypoint as IEntrypointLibrary).allowFreeEntry : undefined;\n const valuesList =\n !isLibrary || (fulltextSearch && allowFreeEntry) ? undefined : (entrypoint as IEntrypointLibrary).valuesList; // Remove values list for free entry values list on search\n const preparedFilters = prepareFiltersForRequest(filters, filtersOperator, valuesList);\n\n const {\n data: libraryData,\n loading: libraryLoading,\n refetch: libraryRefetch,\n } = useExplorerLibraryDataQuery({\n fetchPolicy: 'network-only',\n skip: skip || !isLibrary,\n variables: {\n libraryId,\n attributeIds,\n pagination,\n searchQuery: fulltextSearch,\n multipleSort: sorts,\n filters: preparedFilters,\n },\n });\n\n const isMultivalue = !!attributeData?.attributes?.list?.[0]?.multiple_values;\n const canEditLinkAttributeValues = !!attributeData?.attributes?.list?.[0]?.permissions?.edit_value;\n\n const memoizedData = useMemo(() => {\n if (isLibrary) {\n return libraryData ? _mappingLibrary(libraryData, libraryId, availableLangs) : null;\n }\n\n if (isLink) {\n return linkData ? _mappingLink(linkData, libraryId, availableLangs) : null;\n }\n\n return null;\n }, [libraryData, linkData]);\n\n const ids = memoizedData?.records.map(record => record.itemId);\n const {data: updatedData} = useGetRecordUpdatesSubscription({libraries: [libraryId], records: ids}, !libraryId);\n\n // TOTO: change to useMemo, and use updatedData to update memoizedData with new Data. Good luck !\n useEffect(() => {\n if (updatedData) {\n if (isLibrary) {\n libraryRefetch();\n } else {\n linkRefetch();\n }\n }\n }, [updatedData]);\n\n return {\n data: memoizedData,\n isMultivalue,\n canEditLinkAttributeValues,\n loading: isLibrary ? libraryLoading : linkLoading,\n refetch: isLibrary ? libraryRefetch : linkRefetch,\n };\n};\n"]}
1
+ {"version":3,"file":"useExplorerData.js","sourceRoot":"","sources":["../../../../src/components/Explorer/_queries/useExplorerData.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAC,SAAS,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AACzC,OAAO,EAAC,+BAA+B,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AAQnE,OAAO,EAKH,+BAA+B,EAC/B,2BAA2B,EAC3B,6BAA6B,EAC7B,wBAAwB,GAC3B,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,wBAAwB,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AO,EAAE;4BACL;gCACI,KAAK,EAAE,IAAI;gCACX,SAAS,EAAE,wBAAwB,CAAC,KAAK;gCACzC,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;6BAC5C;yBACJ;qBACJ;iBACJ,CAAC,CAAC;YACP,CAAC;QACL,CAAC;IACL,CAAC,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;IAEhC,OAAO;QACH,IAAI,EAAE,YAAY;QAClB,YAAY;QACZ,0BAA0B;QAC1B,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW;QACjD,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW;KACpD,CAAC;AACN,CAAC,CAAC","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 {localizedTranslation} from '@leav/utils';\nimport {useEffect, useMemo} from 'react';\nimport {useGetRecordUpdatesSubscription, useLang} from '_ui/hooks';\nimport {\n type Entrypoint,\n type IEntrypointLink,\n type IExplorerData,\n type DefaultViewSettings,\n type IEntrypointLibrary,\n} from '../_types';\nimport {\n type ExplorerLibraryDataQuery,\n type ExplorerLinkDataQuery,\n type LinkPropertyLinkValueFragment,\n type SortOrder,\n useExplorerLibraryDataLazyQuery,\n useExplorerLibraryDataQuery,\n useExplorerLinkAttributeQuery,\n useExplorerLinkDataQuery,\n} from '_ui/_gqlTypes';\nimport {type UIFilter} from '_ui/components/Filters/_types';\nimport {prepareFiltersForRequest} from '_ui/components/Filters';\nimport {AttributeConditionFilter} from '_ui/types';\n\nexport const dateValuesSeparator = '\\n';\n\nconst _mappingLibrary = (\n data: ExplorerLibraryDataQuery,\n libraryId: string,\n availableLangs: string[],\n): IExplorerData => {\n const attributes = data.records.list.length\n ? data.records.list[0].properties.reduce((acc, property) => {\n acc[property.attributeId] = {\n ...property.attributeProperties,\n label: localizedTranslation(property.attributeProperties.label, availableLangs),\n };\n\n return acc;\n }, {})\n : {};\n\n const records = data.records.list.map(({whoAmI, active, permissions, properties}) => ({\n libraryId,\n key: whoAmI.id, // For <KitTable /> only\n itemId: whoAmI.id, // For <KitTable /> only\n active,\n canActivate: permissions.create_record,\n canDelete: permissions.delete_record,\n whoAmI: {\n label: null,\n subLabel: null,\n color: null,\n preview: null,\n ...whoAmI,\n },\n propertiesById: properties.reduce((acc, {attributeId, values}) => ({...acc, [attributeId]: values}), {}),\n }));\n\n return {\n totalCount: data.records.totalCount ?? 0,\n attributes,\n records,\n };\n};\n\nconst _mappingLink = (data: ExplorerLinkDataQuery, libraryId: string, availableLangs: string[]): IExplorerData => {\n const attributes = data.records.list.length\n ? ((data.records.list[0].property[0] as LinkPropertyLinkValueFragment)?.payload?.properties ?? []).reduce(\n (acc, property) => {\n acc[property.attributeId] = {\n ...property.attributeProperties,\n label: localizedTranslation(property.attributeProperties.label, availableLangs),\n };\n\n return acc;\n },\n {},\n )\n : {};\n\n const records =\n (data.records.list.length &&\n data.records.list[0].property\n .map((linkValue: LinkPropertyLinkValueFragment, index: number) => {\n if (!linkValue.payload) {\n return null;\n }\n\n return {\n libraryId,\n // same link id can be duplicated, so we add the index to the key\n key: linkValue.payload.whoAmI.id + index, // For <KitTable /> only\n itemId: linkValue.payload.whoAmI.id, // For <KitTable /> only\n canActivate: true,\n canDelete: true,\n active: true,\n whoAmI: {\n label: null,\n subLabel: null,\n color: null,\n preview: null,\n ...linkValue.payload.whoAmI,\n },\n propertiesById: linkValue.payload.properties.reduce(\n (acc, {attributeId, values}) => ({...acc, [attributeId]: values}),\n {},\n ),\n id_value: linkValue.id_value ?? undefined,\n };\n })\n .filter(Boolean)) ||\n [];\n\n return {\n totalCount: records.length,\n attributes,\n records,\n };\n};\n\nexport const useExplorerData = ({\n entrypoint,\n libraryId,\n attributeIds,\n fulltextSearch,\n sorts,\n pagination,\n filters,\n filtersOperator,\n skip,\n}: {\n entrypoint: Entrypoint;\n libraryId: string;\n attributeIds: string[];\n fulltextSearch: string;\n sorts: Array<{\n field: string;\n order: SortOrder;\n }>;\n pagination: null | {limit: number; offset: number};\n filters: UIFilter[];\n filtersOperator: DefaultViewSettings['filtersOperator'];\n skip: boolean;\n}) => {\n const {lang: availableLangs} = useLang();\n\n const isLibrary = entrypoint.type === 'library';\n const isLink = entrypoint.type === 'link';\n\n const {data: attributeData} = useExplorerLinkAttributeQuery({\n skip: isLibrary,\n variables: {\n id: (entrypoint as IEntrypointLink).linkAttributeId,\n },\n });\n\n const isLinkAttributeAllowed = attributeData?.attributes?.list?.[0]?.permissions?.access_attribute;\n const {\n data: linkData,\n loading: linkLoading,\n refetch: linkRefetch,\n } = useExplorerLinkDataQuery({\n fetchPolicy: 'network-only',\n skip: skip || !isLink || !isLinkAttributeAllowed,\n variables: {\n parentLibraryId: (entrypoint as IEntrypointLink).parentLibraryId,\n parentRecordId: (entrypoint as IEntrypointLink).parentRecordId,\n linkAttributeId: (entrypoint as IEntrypointLink).linkAttributeId,\n attributeIds,\n },\n });\n\n const allowFreeEntry = isLibrary ? (entrypoint as IEntrypointLibrary).allowFreeEntry : undefined;\n const valuesList =\n !isLibrary || (fulltextSearch && allowFreeEntry) ? undefined : (entrypoint as IEntrypointLibrary).valuesList; // Remove values list for free entry values list on search\n const preparedFilters = prepareFiltersForRequest(filters, filtersOperator, valuesList);\n\n const {\n data: libraryData,\n loading: libraryLoading,\n refetch: libraryRefetch,\n } = useExplorerLibraryDataQuery({\n fetchPolicy: 'network-only',\n skip: skip || !isLibrary,\n variables: {\n libraryId,\n attributeIds,\n pagination,\n searchQuery: fulltextSearch,\n multipleSort: sorts,\n filters: preparedFilters,\n },\n });\n\n const [fetchLibraryRecord] = useExplorerLibraryDataLazyQuery();\n\n const isMultivalue = !!attributeData?.attributes?.list?.[0]?.multiple_values;\n const canEditLinkAttributeValues = !!attributeData?.attributes?.list?.[0]?.permissions?.edit_value;\n\n const memoizedData = useMemo(() => {\n if (isLibrary) {\n return libraryData ? _mappingLibrary(libraryData, libraryId, availableLangs) : null;\n }\n\n if (isLink) {\n return linkData ? _mappingLink(linkData, libraryId, availableLangs) : null;\n }\n\n return null;\n }, [libraryData, linkData]);\n\n const ids = memoizedData?.records.map(record => record.itemId);\n const {data: updatedData} = useGetRecordUpdatesSubscription({libraries: [libraryId], records: ids}, !libraryId);\n\n // TOTO: change to useMemo, and use updatedData to update memoizedData with new Data. Good luck !\n useEffect(() => {\n if (updatedData && memoizedData) {\n if (isLibrary) {\n //fetching updated record will update cache data, and all will be updated automatically\n fetchLibraryRecord({\n variables: {\n libraryId,\n attributeIds,\n filters: [\n {\n field: 'id',\n condition: AttributeConditionFilter.EQUAL,\n value: updatedData.recordUpdate.record.id,\n },\n ],\n },\n });\n }\n }\n }, [updatedData, memoizedData]);\n\n return {\n data: memoizedData,\n isMultivalue,\n canEditLinkAttributeValues,\n loading: isLibrary ? libraryLoading : linkLoading,\n refetch: isLibrary ? libraryRefetch : linkRefetch,\n };\n};\n"]}
@@ -0,0 +1,10 @@
1
+ import { type FunctionComponent } from 'react';
2
+ interface IExportProfileSelectionModalProps {
3
+ open: boolean;
4
+ libraryId: string;
5
+ isLoading?: boolean;
6
+ onClose: () => void;
7
+ onConfirm: (profileLabel: string) => void;
8
+ }
9
+ export declare const ExportProfileSelectionModal: FunctionComponent<IExportProfileSelectionModalProps>;
10
+ export {};
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
3
+ // This file is released under LGPL V3
4
+ // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
5
+ import { useEffect, useState } from 'react';
6
+ import { KitButton, KitSpace, KitModal, KitLoader } from 'aristid-ds';
7
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
8
+ import { faXmark, faPlay } from '@fortawesome/free-solid-svg-icons';
9
+ import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
10
+ import { useGetLibraryExportProfiles } from './useGetLibraryExportProfiles';
11
+ import styled from 'styled-components';
12
+ import { NoProfiles } from './content/NoProfiles';
13
+ import { ProfilesSelection } from './content/ProfilesSelection';
14
+ const LoaderWrapper = styled.div `
15
+ display: flex;
16
+ justify-content: center;
17
+ align-items: center;
18
+ height: 100%;
19
+ `;
20
+ export const ExportProfileSelectionModal = ({ open, libraryId, isLoading = false, onClose, onConfirm, }) => {
21
+ const { t } = useSharedTranslation();
22
+ const [selectedProfile, setSelectedProfile] = useState('');
23
+ const { profiles, defaultProfile, loading: queryLoading, } = useGetLibraryExportProfiles({
24
+ libraryId,
25
+ skip: !open,
26
+ });
27
+ useEffect(() => {
28
+ if (profiles.length > 0) {
29
+ setSelectedProfile(defaultProfile || profiles[0]?.label || '');
30
+ }
31
+ }, [profiles, defaultProfile]);
32
+ const _handleConfirm = () => {
33
+ if (selectedProfile) {
34
+ onConfirm(selectedProfile);
35
+ onClose();
36
+ }
37
+ };
38
+ const _handleClose = () => {
39
+ onClose();
40
+ };
41
+ const selectedProfileData = profiles.find(p => p.label === selectedProfile);
42
+ const noProfiles = !queryLoading && !profiles?.length;
43
+ const hasProfiles = !queryLoading && profiles?.length;
44
+ return (_jsxs(KitModal, { appElement: document.getElementById('root'), isOpen: open, close: _handleClose, title: t('explorer.export_profile_modal.title'), height: "60vh", width: "70vw", closeIcon: _jsx(FontAwesomeIcon, { icon: faXmark }), showCloseIcon: true, destroyOnClose: true, footer: _jsxs(KitSpace, { children: [_jsx(KitButton, { size: "m", icon: _jsx(FontAwesomeIcon, { icon: faXmark }), onClick: _handleClose, children: t('global.cancel') }), _jsx(KitButton, { type: "primary", size: "m", icon: _jsx(FontAwesomeIcon, { icon: faPlay }), loading: isLoading, disabled: !selectedProfile || !!selectedProfileData?.error || isLoading, onClick: _handleConfirm, children: t('explorer.export_profile_modal.export_button') })] }), children: [queryLoading && (_jsx(LoaderWrapper, { children: _jsx(KitLoader, {}) })), noProfiles && _jsx(NoProfiles, {}), hasProfiles && (_jsx(ProfilesSelection, { profiles: profiles, selectedProfile: selectedProfile, setSelectedProfile: setSelectedProfile }))] }));
45
+ };
46
+ //# sourceMappingURL=ExportProfileSelectionModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExportProfileSelectionModal.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/export/ExportProfileSelectionModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAClE,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AACpE,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,OAAO,EAAE,MAAM,EAAC,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,2BAA2B,EAAC,MAAM,+BAA+B,CAAC;AAC1E,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAU9D,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;CAK/B,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAyD,CAAC,EAC9F,IAAI,EACJ,SAAS,EACT,SAAS,GAAG,KAAK,EACjB,OAAO,EACP,SAAS,GACZ,EAAE,EAAE;IACD,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAE3D,MAAM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,IAAC,IAAI,EAAC,GAAG,EAAC,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,OAAO,GAAI,EAAE,OAAO,EAAE,YAAY,YAC9E,CAAC,CAAC,eAAe,CAAC,GACX,EACZ,KAAC,SAAS,IACN,IAAI,EAAC,SAAS,EACd,IAAI,EAAC,GAAG,EACR,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,MAAM,GAAI,EACvC,OAAO,EAAE,SAAS,EAClB,QAAQ,EAAE,CAAC,eAAe,IAAI,CAAC,CAAC,mBAAmB,EAAE,KAAK,IAAI,SAAS,EACvE,OAAO,EAAE,cAAc,YAEtB,CAAC,CAAC,6CAA6C,CAAC,GACzC,IACL,aAGd,YAAY,IAAI,CACb,KAAC,aAAa,cACV,KAAC,SAAS,KAAG,GACD,CACnB,EACA,UAAU,IAAI,KAAC,UAAU,KAAG,EAC5B,WAAW,IAAI,CACZ,KAAC,iBAAiB,IACd,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAChC,kBAAkB,EAAE,kBAAkB,GACxC,CACL,IACM,CACd,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type FunctionComponent, useEffect, useState} from 'react';\nimport {KitButton, KitSpace, KitModal, KitLoader} from 'aristid-ds';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faXmark, faPlay} from '@fortawesome/free-solid-svg-icons';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {useGetLibraryExportProfiles} from './useGetLibraryExportProfiles';\nimport styled from 'styled-components';\nimport {NoProfiles} from './content/NoProfiles';\nimport {ProfilesSelection} from './content/ProfilesSelection';\n\ninterface IExportProfileSelectionModalProps {\n open: boolean;\n libraryId: string;\n isLoading?: boolean;\n onClose: () => void;\n onConfirm: (profileLabel: string) => void;\n}\n\nconst LoaderWrapper = styled.div`\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n`;\n\nexport const ExportProfileSelectionModal: FunctionComponent<IExportProfileSelectionModalProps> = ({\n open,\n libraryId,\n isLoading = false,\n onClose,\n onConfirm,\n}) => {\n const {t} = useSharedTranslation();\n const [selectedProfile, setSelectedProfile] = useState('');\n\n const {\n profiles,\n defaultProfile,\n loading: queryLoading,\n } = useGetLibraryExportProfiles({\n libraryId,\n skip: !open,\n });\n\n useEffect(() => {\n if (profiles.length > 0) {\n setSelectedProfile(defaultProfile || profiles[0]?.label || '');\n }\n }, [profiles, defaultProfile]);\n\n const _handleConfirm = () => {\n if (selectedProfile) {\n onConfirm(selectedProfile);\n onClose();\n }\n };\n\n const _handleClose = () => {\n onClose();\n };\n\n const selectedProfileData = profiles.find(p => p.label === selectedProfile);\n\n const noProfiles = !queryLoading && !profiles?.length;\n const hasProfiles = !queryLoading && profiles?.length;\n\n return (\n <KitModal\n appElement={document.getElementById('root')}\n isOpen={open}\n close={_handleClose}\n title={t('explorer.export_profile_modal.title')}\n height=\"60vh\"\n width=\"70vw\"\n closeIcon={<FontAwesomeIcon icon={faXmark} />}\n showCloseIcon\n destroyOnClose\n footer={\n <KitSpace>\n <KitButton size=\"m\" icon={<FontAwesomeIcon icon={faXmark} />} onClick={_handleClose}>\n {t('global.cancel')}\n </KitButton>\n <KitButton\n type=\"primary\"\n size=\"m\"\n icon={<FontAwesomeIcon icon={faPlay} />}\n loading={isLoading}\n disabled={!selectedProfile || !!selectedProfileData?.error || isLoading}\n onClick={_handleConfirm}\n >\n {t('explorer.export_profile_modal.export_button')}\n </KitButton>\n </KitSpace>\n }\n >\n {queryLoading && (\n <LoaderWrapper>\n <KitLoader />\n </LoaderWrapper>\n )}\n {noProfiles && <NoProfiles />}\n {hasProfiles && (\n <ProfilesSelection\n profiles={profiles}\n selectedProfile={selectedProfile}\n setSelectedProfile={setSelectedProfile}\n />\n )}\n </KitModal>\n );\n};\n"]}
@@ -0,0 +1 @@
1
+ export declare const NoProfiles: () => JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
3
+ // This file is released under LGPL V3
4
+ // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
5
+ import { KitEmpty, KitSpace } from 'aristid-ds';
6
+ import { useSharedTranslation } from '../../../../../hooks/useSharedTranslation';
7
+ import styled from 'styled-components';
8
+ const NoProfilesSpacer = styled(KitSpace) `
9
+ justify-content: center;
10
+ width: 100%;
11
+ height: 100%;
12
+ `;
13
+ export const NoProfiles = () => {
14
+ const { t } = useSharedTranslation();
15
+ return (_jsx(NoProfilesSpacer, { direction: "vertical", size: "m", children: _jsx(KitEmpty, { image: KitEmpty.ASSET_LIST, title: t('explorer.export_profile_modal.no_profiles'), description: t('explorer.export_profile_modal.contact_admin') }) }));
16
+ };
17
+ //# sourceMappingURL=NoProfiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoProfiles.js","sourceRoot":"","sources":["../../../../../../src/components/Explorer/actions-mass/export/content/NoProfiles.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,gBAAgB,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;;;;CAIxC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC3B,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,OAAO,CACH,KAAC,gBAAgB,IAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,GAAG,YAC3C,KAAC,QAAQ,IACL,KAAK,EAAE,QAAQ,CAAC,UAAU,EAC1B,KAAK,EAAE,CAAC,CAAC,2CAA2C,CAAC,EACrD,WAAW,EAAE,CAAC,CAAC,6CAA6C,CAAC,GAC/D,GACa,CACtB,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {KitEmpty, KitSpace} from 'aristid-ds';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport styled from 'styled-components';\n\nconst NoProfilesSpacer = styled(KitSpace)`\n justify-content: center;\n width: 100%;\n height: 100%;\n`;\n\nexport const NoProfiles = () => {\n const {t} = useSharedTranslation();\n\n return (\n <NoProfilesSpacer direction=\"vertical\" size=\"m\">\n <KitEmpty\n image={KitEmpty.ASSET_LIST}\n title={t('explorer.export_profile_modal.no_profiles')}\n description={t('explorer.export_profile_modal.contact_admin')}\n />\n </NoProfilesSpacer>\n );\n};\n"]}
@@ -0,0 +1,8 @@
1
+ import { type IExportProfile } from '../useGetLibraryExportProfiles';
2
+ interface IProfilesSelectionProps {
3
+ profiles: IExportProfile[];
4
+ selectedProfile: string;
5
+ setSelectedProfile: (profile: string) => void;
6
+ }
7
+ export declare const ProfilesSelection: ({ profiles, selectedProfile, setSelectedProfile }: IProfilesSelectionProps) => JSX.Element;
8
+ export {};
@@ -0,0 +1,49 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
3
+ // This file is released under LGPL V3
4
+ // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
5
+ import { KitEmpty, KitGrid, KitInput, KitItemList, KitRadio, KitSpace, KitTypography } from 'aristid-ds';
6
+ import styled from 'styled-components';
7
+ import { useSharedTranslation } from '../../../../../hooks/useSharedTranslation';
8
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
9
+ import { faMagnifyingGlass } from '@fortawesome/free-solid-svg-icons';
10
+ import { useState } from 'react';
11
+ const ExportSpacer = styled(KitSpace) `
12
+ width: 100%;
13
+ `;
14
+ const ExportTitle = styled(KitTypography.Title) `
15
+ &.ant-typography {
16
+ margin-bottom: 0;
17
+ }
18
+ `;
19
+ const ExportProfileOptionGroup = styled(KitRadio.Group) `
20
+ width: 100%;
21
+ `;
22
+ const ExportProfileOption = styled(KitRadio) `
23
+ width: 100%;
24
+ padding: calc(var(--general-spacing-xs) * 1px);
25
+ border-radius: calc(var(--general-border-radius-s) * 1px);
26
+
27
+ &.ant-radio-wrapper-checked {
28
+ background-color: var(--general-utilities-main-light);
29
+ }
30
+ `;
31
+ const ExportProfileInError = styled(KitEmpty) `
32
+ .ant-empty-description .ant-space {
33
+ width: 100%;
34
+ word-break: break-word;
35
+ }
36
+ `;
37
+ export const ProfilesSelection = ({ profiles, selectedProfile, setSelectedProfile }) => {
38
+ const { t } = useSharedTranslation();
39
+ const [searchTerm, setSearchTerm] = useState('');
40
+ const filteredProfiles = profiles.filter(profile => profile.label.toLowerCase().includes(searchTerm.toLowerCase()));
41
+ const selectedProfileData = profiles.find(p => p.label === selectedProfile);
42
+ return (_jsxs(KitGrid.KitRow, { gutter: 48, children: [_jsx(KitGrid.KitCol, { span: 12, children: _jsxs(ExportSpacer, { direction: "vertical", size: "s", children: [_jsx(ExportTitle, { level: "h4", children: t('explorer.export_profile_modal.profile_label') }), _jsx(KitInput, { prefix: _jsx(FontAwesomeIcon, { icon: faMagnifyingGlass }), placeholder: t('explorer.export_profile_modal.search_placeholder') ?? '', value: searchTerm, onChange: e => setSearchTerm(e.target.value), size: "middle", allowClear: true }), _jsx(ExportProfileOptionGroup, { value: selectedProfile, onChange: e => setSelectedProfile(e.target.value), children: _jsx(ExportSpacer, { direction: "vertical", size: "xxs", children: filteredProfiles.map(profile => (_jsx(ExportProfileOption, { value: profile.label, children: profile.label }, profile.label))) }) })] }) }), _jsx(KitGrid.KitCol, { span: 12, children: _jsxs(ExportSpacer, { direction: "vertical", size: "s", children: [_jsx(ExportTitle, { level: "h4", children: t('explorer.export_profile_modal.preview_label') }), selectedProfileData?.error?.message && (_jsx(ExportProfileInError, { image: KitEmpty.ASSET_RESULT_ERROR, title: t('explorer.export_profile_modal.error_title'), description: selectedProfileData.error.message })), selectedProfileData?.columns && (_jsx(ExportSpacer, { direction: "vertical", size: "xxs", children: selectedProfileData.columns.map(column => (_jsx(KitItemList, { idCardProps: {
43
+ title: column.columnLabel,
44
+ description: column.attribute === ''
45
+ ? t('explorer.export_profile_modal.empty_columns')
46
+ : column.attribute,
47
+ } }, column.attribute))) }))] }) })] }));
48
+ };
49
+ //# sourceMappingURL=ProfilesSelection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProfilesSelection.js","sourceRoot":"","sources":["../../../../../../src/components/Explorer/actions-mass/export/content/ProfilesSelection.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACvG,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,iBAAiB,EAAC,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAG/B,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;;CAEpC,CAAC;AAEF,MAAM,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;;;;CAI9C,CAAC;AAEF,MAAM,wBAAwB,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAA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S;iCAC7B,IAPI,MAAM,CAAC,SAAS,CAQvB,CACL,CAAC,GACS,CAClB,IACU,GACF,IACJ,CACpB,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {KitEmpty, KitGrid, KitInput, KitItemList, KitRadio, KitSpace, KitTypography} from 'aristid-ds';\nimport styled from 'styled-components';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faMagnifyingGlass} from '@fortawesome/free-solid-svg-icons';\nimport {useState} from 'react';\nimport {type IExportProfile} from '../useGetLibraryExportProfiles';\n\nconst ExportSpacer = styled(KitSpace)`\n width: 100%;\n`;\n\nconst ExportTitle = styled(KitTypography.Title)`\n &.ant-typography {\n margin-bottom: 0;\n }\n`;\n\nconst ExportProfileOptionGroup = styled(KitRadio.Group)`\n width: 100%;\n`;\n\nconst ExportProfileOption = styled(KitRadio)`\n width: 100%;\n padding: calc(var(--general-spacing-xs) * 1px);\n border-radius: calc(var(--general-border-radius-s) * 1px);\n\n &.ant-radio-wrapper-checked {\n background-color: var(--general-utilities-main-light);\n }\n`;\n\nconst ExportProfileInError = styled(KitEmpty)`\n .ant-empty-description .ant-space {\n width: 100%;\n word-break: break-word;\n }\n`;\n\ninterface IProfilesSelectionProps {\n profiles: IExportProfile[];\n selectedProfile: string;\n setSelectedProfile: (profile: string) => void;\n}\n\nexport const ProfilesSelection = ({profiles, selectedProfile, setSelectedProfile}: IProfilesSelectionProps) => {\n const {t} = useSharedTranslation();\n\n const [searchTerm, setSearchTerm] = useState('');\n\n const filteredProfiles = profiles.filter(profile => profile.label.toLowerCase().includes(searchTerm.toLowerCase()));\n const selectedProfileData = profiles.find(p => p.label === selectedProfile);\n\n return (\n <KitGrid.KitRow gutter={48}>\n <KitGrid.KitCol span={12}>\n <ExportSpacer direction=\"vertical\" size=\"s\">\n <ExportTitle level=\"h4\">{t('explorer.export_profile_modal.profile_label')}</ExportTitle>\n <KitInput\n prefix={<FontAwesomeIcon icon={faMagnifyingGlass} />}\n placeholder={t('explorer.export_profile_modal.search_placeholder') ?? ''}\n value={searchTerm}\n onChange={e => setSearchTerm(e.target.value)}\n size=\"middle\"\n allowClear\n />\n <ExportProfileOptionGroup\n value={selectedProfile}\n onChange={e => setSelectedProfile(e.target.value)}\n >\n <ExportSpacer direction=\"vertical\" size=\"xxs\">\n {filteredProfiles.map(profile => (\n <ExportProfileOption key={profile.label} value={profile.label}>\n {profile.label}\n </ExportProfileOption>\n ))}\n </ExportSpacer>\n </ExportProfileOptionGroup>\n </ExportSpacer>\n </KitGrid.KitCol>\n <KitGrid.KitCol span={12}>\n <ExportSpacer direction=\"vertical\" size=\"s\">\n <ExportTitle level=\"h4\">{t('explorer.export_profile_modal.preview_label')}</ExportTitle>\n {selectedProfileData?.error?.message && (\n <ExportProfileInError\n image={KitEmpty.ASSET_RESULT_ERROR}\n title={t('explorer.export_profile_modal.error_title')}\n description={selectedProfileData.error.message}\n />\n )}\n {selectedProfileData?.columns && (\n <ExportSpacer direction=\"vertical\" size=\"xxs\">\n {selectedProfileData.columns.map(column => (\n <KitItemList\n key={column.attribute}\n idCardProps={{\n title: column.columnLabel,\n description:\n column.attribute === ''\n ? t('explorer.export_profile_modal.empty_columns')\n : column.attribute,\n }}\n />\n ))}\n </ExportSpacer>\n )}\n </ExportSpacer>\n </KitGrid.KitCol>\n </KitGrid.KitRow>\n );\n};\n"]}
@@ -0,0 +1,27 @@
1
+ interface IExportProfileColumn {
2
+ columnLabel: string;
3
+ attribute: string;
4
+ }
5
+ export interface IExportProfile {
6
+ label: string;
7
+ columns: IExportProfileColumn[];
8
+ error?: {
9
+ message: string;
10
+ };
11
+ }
12
+ interface IGetLibraryExportProfilesResult {
13
+ profiles: IExportProfile[];
14
+ defaultProfile: string;
15
+ loading: boolean;
16
+ }
17
+ interface IUseGetLibraryExportProfilesParams {
18
+ libraryId: string;
19
+ skip?: boolean;
20
+ }
21
+ /**
22
+ * Fetch and validate export profiles for a library
23
+ * @param params - The library ID and optional skip flag
24
+ * @returns Validated export profiles, default profile, loading state, and validation status
25
+ */
26
+ export declare const useGetLibraryExportProfiles: ({ libraryId, skip, }: IUseGetLibraryExportProfilesParams) => IGetLibraryExportProfilesResult;
27
+ export {};
@@ -0,0 +1,48 @@
1
+ // Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
2
+ // This file is released under LGPL V3
3
+ // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
4
+ import { useMemo } from 'react';
5
+ import { useLibraryExportProfilesQuery } from '../../../../_gqlTypes';
6
+ /**
7
+ * Fetch and validate export profiles for a library
8
+ * @param params - The library ID and optional skip flag
9
+ * @returns Validated export profiles, default profile, loading state, and validation status
10
+ */
11
+ export const useGetLibraryExportProfiles = ({ libraryId, skip = false, }) => {
12
+ const { data, loading } = useLibraryExportProfilesQuery({
13
+ skip,
14
+ fetchPolicy: 'no-cache',
15
+ variables: { libraryId: [libraryId] },
16
+ });
17
+ const exportProfiles = data?.libraries?.list?.[0]?.exportProfiles;
18
+ return useMemo(() => {
19
+ if (loading) {
20
+ return {
21
+ profiles: [],
22
+ defaultProfile: '',
23
+ loading,
24
+ };
25
+ }
26
+ if (!exportProfiles) {
27
+ return {
28
+ profiles: [],
29
+ defaultProfile: '',
30
+ loading,
31
+ };
32
+ }
33
+ const { defaultProfile, profiles } = exportProfiles;
34
+ if (!Array.isArray(profiles) || profiles.length === 0) {
35
+ return {
36
+ profiles: [],
37
+ defaultProfile: '',
38
+ loading,
39
+ };
40
+ }
41
+ return {
42
+ profiles: profiles,
43
+ defaultProfile: typeof defaultProfile === 'string' ? defaultProfile : '',
44
+ loading,
45
+ };
46
+ }, [exportProfiles, loading]);
47
+ };
48
+ //# sourceMappingURL=useGetLibraryExportProfiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGetLibraryExportProfiles.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,6BAA6B,EAAC,MAAM,eAAe,CAAC;AAwB5D;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,EACxC,SAAS,EACT,IAAI,GAAG,KAAK,GACqB,EAAmC,EAAE;IACtE,MAAM,EAAC,IAAI,EAAE,OAAO,EAAC,GAAG,6BAA6B,CAAC;QAClD,IAAI;QACJ,WAAW,EAAE,UAAU;QACvB,SAAS,EAAE,EAAC,SAAS,EAAE,CAAC,SAAS,CAAC,EAAC;KACtC,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC;IAElE,OAAO,OAAO,CAAC,GAAG,EAAE;QAChB,IAAI,OAAO,EAAE,CAAC;YACV,OAAO;gBACH,QAAQ,EAAE,EAAE;gBACZ,cAAc,EAAE,EAAE;gBAClB,OAAO;aACV,CAAC;QACN,CAAC;QAED,IAAI,CAAC,cAAc,EAAE,CAAC;YAClB,OAAO;gBACH,QAAQ,EAAE,EAAE;gBACZ,cAAc,EAAE,EAAE;gBAClB,OAAO;aACV,CAAC;QACN,CAAC;QAED,MAAM,EAAC,cAAc,EAAE,QAAQ,EAAC,GAAG,cAAc,CAAC;QAElD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpD,OAAO;gBACH,QAAQ,EAAE,EAAE;gBACZ,cAAc,EAAE,EAAE;gBAClB,OAAO;aACV,CAAC;QACN,CAAC;QAED,OAAO;YACH,QAAQ,EAAE,QAA4B;YACtC,cAAc,EAAE,OAAO,cAAc,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;YACxE,OAAO;SACV,CAAC;IACN,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;AAClC,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {useMemo} from 'react';\nimport {useLibraryExportProfilesQuery} from '_ui/_gqlTypes';\n\ninterface IExportProfileColumn {\n columnLabel: string;\n attribute: string;\n}\n\nexport interface IExportProfile {\n label: string;\n columns: IExportProfileColumn[];\n error?: {message: string};\n}\n\ninterface IGetLibraryExportProfilesResult {\n profiles: IExportProfile[];\n defaultProfile: string;\n loading: boolean;\n}\n\ninterface IUseGetLibraryExportProfilesParams {\n libraryId: string;\n skip?: boolean;\n}\n\n/**\n * Fetch and validate export profiles for a library\n * @param params - The library ID and optional skip flag\n * @returns Validated export profiles, default profile, loading state, and validation status\n */\nexport const useGetLibraryExportProfiles = ({\n libraryId,\n skip = false,\n}: IUseGetLibraryExportProfilesParams): IGetLibraryExportProfilesResult => {\n const {data, loading} = useLibraryExportProfilesQuery({\n skip,\n fetchPolicy: 'no-cache',\n variables: {libraryId: [libraryId]},\n });\n\n const exportProfiles = data?.libraries?.list?.[0]?.exportProfiles;\n\n return useMemo(() => {\n if (loading) {\n return {\n profiles: [],\n defaultProfile: '',\n loading,\n };\n }\n\n if (!exportProfiles) {\n return {\n profiles: [],\n defaultProfile: '',\n loading,\n };\n }\n\n const {defaultProfile, profiles} = exportProfiles;\n\n if (!Array.isArray(profiles) || profiles.length === 0) {\n return {\n profiles: [],\n defaultProfile: '',\n loading,\n };\n }\n\n return {\n profiles: profiles as IExportProfile[],\n defaultProfile: typeof defaultProfile === 'string' ? defaultProfile : '',\n loading,\n };\n }, [exportProfiles, loading]);\n};\n"]}
@@ -1,6 +1,10 @@
1
- import { type Dispatch } from 'react';
1
+ import { type Dispatch, type ReactElement } from 'react';
2
2
  import { type FeatureHook, type IMassActions } from '../_types';
3
3
  import { type IViewSettingsAction, type IViewSettingsState } from '../manage-view-settings';
4
+ interface IUseExportMassActionReturn {
5
+ exportMassAction: IMassActions | null;
6
+ ExportModal: ReactElement | null;
7
+ }
4
8
  /**
5
9
  * Hook that provides a mass action configuration for exporting selected or all items
6
10
  * from a view/data set
@@ -12,6 +16,5 @@ export declare const useExportMassAction: ({ isEnabled, store: { view, dispatch
12
16
  };
13
17
  totalCount: number;
14
18
  onExport?: IMassActions["callback"];
15
- }>) => {
16
- exportMassAction: IMassActions;
17
- };
19
+ }>) => IUseExportMassActionReturn;
20
+ export {};