@leav/ui 1.13.0-b8abd53d → 1.13.0-fd41c66e
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 +224 -72
- package/dist/_gqlTypes/index.js +143 -61
- package/dist/_gqlTypes/index.js.map +1 -1
- package/dist/_queries/attributes/attributeDetailsFragment.js +3 -0
- package/dist/_queries/attributes/attributeDetailsFragment.js.map +1 -1
- package/dist/components/Explorer/Explorer.d.ts +5 -1
- package/dist/components/Explorer/Explorer.js +7 -0
- package/dist/components/Explorer/Explorer.js.map +1 -1
- package/dist/components/Explorer/_types.d.ts +6 -0
- package/dist/components/Explorer/_types.js.map +1 -1
- package/dist/components/Explorer/actions-mass/edit-attribute/EditMonoDependencyWorkflowTreeAttribute.d.ts +8 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/EditMonoDependencyWorkflowTreeAttribute.js +34 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/EditMonoDependencyWorkflowTreeAttribute.js.map +1 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.d.ts +3 -1
- package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js +12 -14
- package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js.map +1 -1
- package/dist/components/Explorer/actions-mass/edit-attribute/_types.d.ts +15 -3
- package/dist/components/Explorer/actions-mass/edit-attribute/_types.js.map +1 -1
- package/dist/components/Explorer/actions-mass/edit-attribute/useDependencyValues.d.ts +13 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useDependencyValues.js +47 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useDependencyValues.js.map +1 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useEditionMappingState.d.ts +13 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useEditionMappingState.js +73 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useEditionMappingState.js.map +1 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useMassEditableAttributes.js +14 -17
- package/dist/components/Explorer/actions-mass/edit-attribute/useMassEditableAttributes.js.map +1 -1
- package/dist/components/Explorer/actions-mass/edit-attribute/useTreeNodesCandidates.d.ts +23 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useTreeNodesCandidates.js +68 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useTreeNodesCandidates.js.map +1 -0
- package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js +16 -50
- package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js +6 -6
- package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.d.ts +7 -31
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js +9 -20
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js.map +1 -1
- package/dist/components/Explorer/useNotifyFiltersChange.d.ts +15 -0
- package/dist/components/Explorer/useNotifyFiltersChange.js +26 -0
- package/dist/components/Explorer/useNotifyFiltersChange.js.map +1 -0
- package/dist/components/Filters/_types.d.ts +6 -0
- package/dist/components/Filters/_types.js +2 -1
- package/dist/components/Filters/_types.js.map +1 -1
- package/dist/components/Filters/context/filtersReducer.d.ts +14 -1
- package/dist/components/Filters/context/filtersReducer.js +17 -4
- package/dist/components/Filters/context/filtersReducer.js.map +1 -1
- package/dist/components/Filters/filter-items/filter-type/smart-filter/SmartFilterAttributeDropdown.js +2 -3
- package/dist/components/Filters/filter-items/filter-type/smart-filter/SmartFilterAttributeDropdown.js.map +1 -1
- package/dist/components/Filters/filter-items/filter-type/smart-filter/useGetSmartFilterData.d.ts +2 -4
- package/dist/components/Filters/filter-items/filter-type/smart-filter/useGetSmartFilterData.js +22 -16
- package/dist/components/Filters/filter-items/filter-type/smart-filter/useGetSmartFilterData.js.map +1 -1
- package/dist/components/Filters/useFilters.d.ts +306 -0
- package/dist/components/Filters/useTransformFilters.js +1 -0
- package/dist/components/Filters/useTransformFilters.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useDelayedLoading/index.d.ts +1 -0
- package/dist/hooks/useDelayedLoading/index.js +5 -0
- package/dist/hooks/useDelayedLoading/index.js.map +1 -0
- package/dist/hooks/useDelayedLoading/useDelayedLoading.d.ts +17 -0
- package/dist/hooks/useDelayedLoading/useDelayedLoading.js +54 -0
- package/dist/hooks/useDelayedLoading/useDelayedLoading.js.map +1 -0
- package/dist/hooks/useIFrameMessenger/iFrameMessengerContext.d.ts +3 -1
- package/dist/hooks/useIFrameMessenger/iFrameMessengerContext.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/messageHandlers.d.ts +2 -1
- package/dist/hooks/useIFrameMessenger/messageHandlers.js +9 -0
- package/dist/hooks/useIFrameMessenger/messageHandlers.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/types.d.ts +21 -2
- package/dist/hooks/useIFrameMessenger/types.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/useIFrameMessenger.d.ts +1 -0
- package/dist/hooks/useIFrameMessenger/useIFrameMessengerContext.js +29 -7
- package/dist/hooks/useIFrameMessenger/useIFrameMessengerContext.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/useNativePanelMessengerHandlers.d.ts +14 -0
- package/dist/hooks/useIFrameMessenger/useNativePanelMessengerHandlers.js +22 -0
- package/dist/hooks/useIFrameMessenger/useNativePanelMessengerHandlers.js.map +1 -0
- package/dist/hooks/useIFrameMessengerClient/iFrameMessengerClientContext.d.ts +1 -0
- package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.d.ts +1 -0
- package/dist/locales/en/shared.json +1 -0
- package/dist/locales/fr/shared.json +1 -0
- package/package.json +4 -4
- package/dist/components/Explorer/actions-mass/edit-attribute/useTreeNodeRemapping.d.ts +0 -12
- package/dist/components/Explorer/actions-mass/edit-attribute/useTreeNodeRemapping.js +0 -24
- package/dist/components/Explorer/actions-mass/edit-attribute/useTreeNodeRemapping.js.map +0 -1
- package/dist/components/Explorer/actions-mass/edit-attribute/useValuesDistribution.d.ts +0 -13
- package/dist/components/Explorer/actions-mass/edit-attribute/useValuesDistribution.js +0 -28
- package/dist/components/Explorer/actions-mass/edit-attribute/useValuesDistribution.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributeDetailsFragment.js","sourceRoot":"","sources":["../../../src/_queries/attributes/attributeDetailsFragment.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,GAAG,EAAC,MAAM,gBAAgB,CAAC;AAEnC,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"attributeDetailsFragment.js","sourceRoot":"","sources":["../../../src/_queries/attributes/attributeDetailsFragment.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,GAAG,EAAC,MAAM,gBAAgB,CAAC;AAEnC,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoE1C,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 {gql} from '@apollo/client';\n\nexport const attributeDetailsFragment = gql`\n fragment AttributeDetails on Attribute {\n id\n type\n format\n system\n readonly\n label\n description\n required\n multiple_values\n multi_link_display_option\n multi_tree_display_option\n metadata_fields {\n id\n label\n type\n format\n }\n versions_conf {\n versionable\n mode\n profile {\n id\n label\n trees {\n id\n label\n }\n }\n }\n libraries {\n id\n label\n }\n\n ... on StandardAttribute {\n unique\n smart_filter {\n enable\n }\n }\n\n ... on LinkAttribute {\n linked_library {\n id\n label\n }\n reverse_link\n smart_filter {\n enable\n through {\n id\n }\n }\n }\n ... on TreeAttribute {\n linked_tree {\n id\n label\n }\n permissions_conf_dependent_values {\n dependenciesTreeAttributes {\n id\n }\n }\n }\n }\n`;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type ISubmitMultipleResult } from '../../components/RecordEdition/EditRecordContent/_types';
|
|
3
|
-
import { type DefaultViewSettings, type Entrypoint, type IItemAction, type IMassActions, type IPrimaryAction } from './_types';
|
|
3
|
+
import { type DefaultViewSettings, type Entrypoint, type FiltersChangePayload, type IItemAction, type IMassActions, type IPrimaryAction, type ViewConfigTab } from './_types';
|
|
4
4
|
import { type JoinLibraryContextFragment } from '../../_gqlTypes';
|
|
5
5
|
export interface IExplorerProps {
|
|
6
6
|
entrypoint: Entrypoint;
|
|
@@ -34,6 +34,10 @@ export interface IExplorerProps {
|
|
|
34
34
|
export?: IMassActions['callback'];
|
|
35
35
|
generatePreviews?: IMassActions['callback'];
|
|
36
36
|
};
|
|
37
|
+
viewConfig?: {
|
|
38
|
+
onFiltersChange?: (payload: FiltersChangePayload) => void;
|
|
39
|
+
onViewConfigTabClick?: (tab: ViewConfigTab) => void;
|
|
40
|
+
};
|
|
37
41
|
};
|
|
38
42
|
showCreateOnNoResultOnly?: boolean;
|
|
39
43
|
showFilters?: boolean;
|
|
@@ -31,6 +31,7 @@ import { useExportMassAction } from './actions-mass/useExportMassAction';
|
|
|
31
31
|
import { useEditAttributeMassAction } from './actions-mass/useEditAttributeMassAction';
|
|
32
32
|
import { useExplorerCountData } from './_queries/useExplorerCountData';
|
|
33
33
|
import { useGeneratePreviewsMassAction } from './actions-mass/useGeneratePreviewsMassAction';
|
|
34
|
+
import { useNotifyFiltersChange } from './useNotifyFiltersChange';
|
|
34
35
|
const isNotEmpty = (union) => union.length > 0;
|
|
35
36
|
const emptyArray = [];
|
|
36
37
|
const emptyObject = {};
|
|
@@ -64,6 +65,12 @@ export const Explorer = forwardRef(({ entrypoint, itemActions = [], primaryActio
|
|
|
64
65
|
ignoreViewByDefault,
|
|
65
66
|
skip: viewSettingsLoading,
|
|
66
67
|
});
|
|
68
|
+
useNotifyFiltersChange({
|
|
69
|
+
isLoading: viewSettingsLoading,
|
|
70
|
+
filters: filtersData.filters,
|
|
71
|
+
filtersOperator: filtersData.filtersOperator,
|
|
72
|
+
onFiltersChange: defaultCallbacks?.viewConfig?.onFiltersChange,
|
|
73
|
+
});
|
|
67
74
|
const { currentPage, setNewPageSize, setNewPage } = usePagination(viewSettingsDispatch);
|
|
68
75
|
const { data, isMultivalue, canEditLinkAttributeValues, loading: loadingData, refetch, } = useExplorerData({
|
|
69
76
|
entrypoint,
|
|
@@ -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,OAAO,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AAQ,EAAE,IAAI,CAAC,QAAQ;4CACvB,cAAc;4CACd,UAAU;4CACV,UAAU,EAAE,kBAAkB;yCACjC;wCACH,CAAC,CAAC,SAAS,EAEnB,WAAW,EAAE,CAAC,GAAG,WAAW,EAAE,iBAAiB,EAAE,oBAAoB,CAAC;yCACjE,MAAM,CAAC,OAAO,CAAC;yCACf,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;wCACZ,GAAG,MAAM;wCACT,QAAQ,EAAE,kBAAkB,IAAI,MAAM,CAAC,QAAQ;qCAClD,CAAC,CAAC,EACP,SAAS,EAAE;wCACP,YAAY,EAAE,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,EAAE,IAAI,EAAE,MAAM;wCACzE,iBAAiB,EAAE,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe;wCAC/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,EACD,eAAe,EAAE,eAAe,GAClC,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,EACX,qBAAqB,IACK,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} 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';\nimport {useExplorerCountData} from './_queries/useExplorerCountData';\nimport {useGeneratePreviewsMassAction} from './actions-mass/useGeneratePreviewsMassAction';\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' | 'generatePreviews'>;\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 generatePreviews?: 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 useSmallHeaderSize?: boolean;\n tableBodyHeight?: string;\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 useSmallHeaderSize = false,\n tableBodyHeight,\n ignoreViewByDefault = false,\n defaultActionsForItem = ['replaceLink', 'remove', 'activate'],\n defaultPrimaryActions = ['create'],\n defaultMassActions = ['deactivate', 'editAttribute', 'export', 'generatePreviews'],\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: !joinLibraryContext ? view.attributesIds : [],\n });\n\n const totalCountFiltered = data?.totalCount ?? 0;\n\n const {countData: totalCountLibrary, refetchCount} = useExplorerCountData({\n entrypoint,\n libraryId: view.libraryId,\n defaultFilters: defaultViewSettings?.filters ?? [],\n filters: filtersData.filters,\n skip: viewSettingsLoading,\n });\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: totalCountFiltered,\n formId: creationFormId,\n refetch,\n refetchCount,\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: !joinLibraryContext ? view.attributesIds : [],\n });\n\n const allVisibleKeys = data?.records.map(({key}) => key) ?? [];\n\n const {generatePreviewsMassAction, GeneratePreviewsModal} = useGeneratePreviewsMassAction({\n isEnabled: !isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('generatePreviews'),\n store: {view},\n totalCount: totalCountFiltered,\n onGeneratePreviews: defaultCallbacks?.mass?.generatePreviews,\n });\n\n const {exportMassAction, ExportModal} = useExportMassAction({\n isEnabled: !isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('export'),\n store: {view, dispatch: viewSettingsDispatch},\n totalCount: totalCountFiltered,\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: totalCountFiltered,\n });\n\n const {deactivateMassAction} = useDeactivateMassAction({\n isEnabled: !isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('deactivate'),\n store: {view, dispatch: viewSettingsDispatch},\n allVisibleKeys,\n totalCount: totalCountFiltered,\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 && totalCountFiltered > 0);\n\n const massActionSnackbarId = useMemo(() => `${SNACKBAR_MASS_ID}_${Date.now()}`, []);\n\n const {setSelectedKeys, selectAllButton} = useMassActions({\n isEnabled:\n totalCountFiltered > 0 &&\n !_isSelectionDisable &&\n (isNotEmpty(defaultMassActions) || isNotEmpty(massActions) || !!defaultCallbacks?.item?.select),\n store: {view, dispatch: viewSettingsDispatch},\n filtersStore: filtersData,\n totalCountFiltered,\n totalCountLibrary,\n allVisibleKeys,\n massActions: [\n generatePreviewsMassAction,\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: totalCountFiltered,\n }),\n [createPrimaryAction?.disabled, linkPrimaryAction?.disabled, totalCountFiltered],\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={\n /* ⚠️ whoAmI column will always be displayed first*/ view.attributesIds\n }\n hideTableHeader={hideTableHeader}\n useSmallHeaderSize={useSmallHeaderSize}\n paginationProps={\n entrypoint.type === 'library' && !noPagination\n ? {\n pageSizeOptions: defaultPageSizeOptions,\n currentPage,\n pageSize: view.pageSize,\n setNewPageSize,\n setNewPage,\n totalCount: totalCountFiltered,\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 tableBodyHeight={tableBodyHeight}\n />\n )}\n </ExplorerPageDivStyled>\n {settingsPanelElement && createPortal(<SidePanel />, settingsPanelElement?.() ?? document.body)}\n {replaceItemModal}\n {createModal}\n {linkModal}\n {editAttributeMassActionModal}\n {ExportModal}\n {GeneratePreviewsModal}\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;AAWpE,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,uBAAuB,EAAC,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAC,uBAAuB,EAAC,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAC,sBAAsB,EAAC,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAC,uBAAuB,EAAC,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EACH,sBAAsB,EACtB,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,mBAAmB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,cAAc,E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CAAC,EAAE,CAAC,CAAC;wCACZ,GAAG,MAAM;wCACT,QAAQ,EAAE,kBAAkB,IAAI,MAAM,CAAC,QAAQ;qCAClD,CAAC,CAAC,EACP,SAAS,EAAE;wCACP,YAAY,EAAE,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,EAAE,IAAI,EAAE,MAAM;wCACzE,iBAAiB,EAAE,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe;wCAC/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,EACD,eAAe,EAAE,eAAe,GAClC,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,EACX,qBAAqB,IACK,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 FiltersChangePayload,\n type IItemAction,\n type IMassActions,\n type IPrimaryAction,\n type ViewConfigTab,\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} 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';\nimport {useExplorerCountData} from './_queries/useExplorerCountData';\nimport {useGeneratePreviewsMassAction} from './actions-mass/useGeneratePreviewsMassAction';\nimport {useNotifyFiltersChange} from './useNotifyFiltersChange';\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' | 'generatePreviews'>;\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 generatePreviews?: IMassActions['callback'];\n };\n viewConfig?: {\n onFiltersChange?: (payload: FiltersChangePayload) => void;\n onViewConfigTabClick?: (tab: ViewConfigTab) => void;\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 useSmallHeaderSize?: boolean;\n tableBodyHeight?: string;\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 useSmallHeaderSize = false,\n tableBodyHeight,\n ignoreViewByDefault = false,\n defaultActionsForItem = ['replaceLink', 'remove', 'activate'],\n defaultPrimaryActions = ['create'],\n defaultMassActions = ['deactivate', 'editAttribute', 'export', 'generatePreviews'],\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 useNotifyFiltersChange({\n isLoading: viewSettingsLoading,\n filters: filtersData.filters,\n filtersOperator: filtersData.filtersOperator,\n onFiltersChange: defaultCallbacks?.viewConfig?.onFiltersChange,\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: !joinLibraryContext ? view.attributesIds : [],\n });\n\n const totalCountFiltered = data?.totalCount ?? 0;\n\n const {countData: totalCountLibrary, refetchCount} = useExplorerCountData({\n entrypoint,\n libraryId: view.libraryId,\n defaultFilters: defaultViewSettings?.filters ?? [],\n filters: filtersData.filters,\n skip: viewSettingsLoading,\n });\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: totalCountFiltered,\n formId: creationFormId,\n refetch,\n refetchCount,\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: !joinLibraryContext ? view.attributesIds : [],\n });\n\n const allVisibleKeys = data?.records.map(({key}) => key) ?? [];\n\n const {generatePreviewsMassAction, GeneratePreviewsModal} = useGeneratePreviewsMassAction({\n isEnabled: !isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('generatePreviews'),\n store: {view},\n totalCount: totalCountFiltered,\n onGeneratePreviews: defaultCallbacks?.mass?.generatePreviews,\n });\n\n const {exportMassAction, ExportModal} = useExportMassAction({\n isEnabled: !isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('export'),\n store: {view, dispatch: viewSettingsDispatch},\n totalCount: totalCountFiltered,\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: totalCountFiltered,\n });\n\n const {deactivateMassAction} = useDeactivateMassAction({\n isEnabled: !isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('deactivate'),\n store: {view, dispatch: viewSettingsDispatch},\n allVisibleKeys,\n totalCount: totalCountFiltered,\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 && totalCountFiltered > 0);\n\n const massActionSnackbarId = useMemo(() => `${SNACKBAR_MASS_ID}_${Date.now()}`, []);\n\n const {setSelectedKeys, selectAllButton} = useMassActions({\n isEnabled:\n totalCountFiltered > 0 &&\n !_isSelectionDisable &&\n (isNotEmpty(defaultMassActions) || isNotEmpty(massActions) || !!defaultCallbacks?.item?.select),\n store: {view, dispatch: viewSettingsDispatch},\n filtersStore: filtersData,\n totalCountFiltered,\n totalCountLibrary,\n allVisibleKeys,\n massActions: [\n generatePreviewsMassAction,\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: totalCountFiltered,\n }),\n [createPrimaryAction?.disabled, linkPrimaryAction?.disabled, totalCountFiltered],\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={\n /* ⚠️ whoAmI column will always be displayed first*/ view.attributesIds\n }\n hideTableHeader={hideTableHeader}\n useSmallHeaderSize={useSmallHeaderSize}\n paginationProps={\n entrypoint.type === 'library' && !noPagination\n ? {\n pageSizeOptions: defaultPageSizeOptions,\n currentPage,\n pageSize: view.pageSize,\n setNewPageSize,\n setNewPage,\n totalCount: totalCountFiltered,\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 tableBodyHeight={tableBodyHeight}\n />\n )}\n </ExplorerPageDivStyled>\n {settingsPanelElement && createPortal(<SidePanel />, settingsPanelElement?.() ?? document.body)}\n {replaceItemModal}\n {createModal}\n {linkModal}\n {editAttributeMassActionModal}\n {ExportModal}\n {GeneratePreviewsModal}\n </ViewSettingsContext.Provider>\n </FiltersContext.Provider>\n <KitSnackBarProvider id={massActionSnackbarId} />\n </>\n );\n },\n);\n"]}
|
|
@@ -60,6 +60,12 @@ export type DefaultViewSettings = Override<Partial<IViewSettingsState>, {
|
|
|
60
60
|
filtersOperator?: 'AND' | 'OR';
|
|
61
61
|
filters?: UIFilter[];
|
|
62
62
|
}>;
|
|
63
|
+
export type SerializedView = DefaultViewSettings;
|
|
64
|
+
export type ViewConfigTab = 'display' | 'filters' | 'sorts' | 'catalogue';
|
|
65
|
+
export type FiltersChangePayload = {
|
|
66
|
+
filters: UIFilter[];
|
|
67
|
+
filtersOperator: 'AND' | 'OR';
|
|
68
|
+
};
|
|
63
69
|
export interface IEntrypointTree {
|
|
64
70
|
type: 'tree';
|
|
65
71
|
treeId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_types.js","sourceRoot":"","sources":["../../../src/components/Explorer/_types.ts"],"names":[],"mappings":"","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 Override} from '@leav/utils';\nimport {\n type AttributePropertiesFragment,\n type PropertyValueFragment,\n type RecordFilterInput,\n type RecordIdentityFragment,\n} from '_ui/_gqlTypes';\nimport {type Key, type ReactElement} from 'react';\nimport {type IViewSettingsState} from './manage-view-settings';\nimport {type IView} from '_ui/types';\nimport {type MASS_SELECTION_ALL} from './_constants';\nimport {type UIFilter, type ValidFilter} from '../Filters/_types';\n\nexport type MassSelection = Key[] | typeof MASS_SELECTION_ALL;\n\nexport interface IExplorerData {\n totalCount: number;\n attributes: {\n [attributeId: string]: Override<AttributePropertiesFragment, {label: string}>;\n };\n records: IItemData[];\n}\n\nexport interface IItemData {\n libraryId: string;\n key: string;\n itemId: string;\n whoAmI: Required<RecordIdentityFragment['whoAmI']>;\n canActivate: boolean;\n canDelete: boolean;\n active: boolean;\n propertiesById: {\n [attributeId: string]: PropertyValueFragment[];\n };\n /**\n * Can be named `linkId` too, but for historical reason we keep old name 👴🏼.\n */\n id_value?: string;\n}\n\nexport interface IItemAction {\n callback: (item: IItemData) => void;\n icon: ReactElement | ((item: IItemData) => ReactElement);\n label: string | ((item: IItemData) => string);\n isDanger?: boolean | ((item: IItemData) => boolean);\n disabled?: boolean | ((item: IItemData) => boolean);\n useItemActionOnRowClick?: boolean;\n useItemDeletePermission?: boolean; //TODO: Add for PanelAttributeExplorer custom action (should be deleted later)\n}\n\nexport interface IPrimaryAction {\n callback: () => void;\n disabled?: boolean;\n icon: ReactElement;\n label: string;\n}\n\nexport interface IMassActions {\n callback: (massSelectedFilter: RecordFilterInput[], massSelection: MassSelection) => void | Promise<void>;\n deselectAll: boolean;\n icon: ReactElement;\n label: string;\n}\n\nexport type FeatureHook<T = {}> = {isEnabled: boolean; isVisible?: boolean} & T;\n\nexport type DefaultViewSettings = Override<\n Partial<IViewSettingsState>,\n {\n filtersOperator?: 'AND' | 'OR';\n filters?: UIFilter[];\n }\n>;\n\nexport interface IEntrypointTree {\n type: 'tree';\n treeId: string;\n nodeId: string;\n}\n\nexport interface IEntrypointLibrary {\n type: 'library';\n libraryId: string;\n /**\n * Used to display a list of values instead of all library records when adding a link\n */\n valuesList?: string[];\n /**\n * Used to allow free entry when adding a link with values list\n */\n allowFreeEntry?: boolean;\n}\n\nexport interface IEntrypointLink {\n type: 'link';\n parentLibraryId: string;\n parentRecordId: string;\n linkAttributeId: string;\n}\n\nexport type Entrypoint = IEntrypointTree | IEntrypointLibrary | IEntrypointLink;\n\nexport interface IUserView extends Pick<IView, 'shared' | 'display' | 'sort' | 'attributes'> {\n label: Record<string, string>;\n id: IView['id'] | null;\n filters: ValidFilter[];\n ownerId: string | null;\n}\n\nexport interface IDataViewOnAction {\n id: string | null;\n label: Record<string, string> | null;\n}\n\nexport type SetNewPage = (newCurrentPage: number, ignoredPageSize: number) => void;\n"]}
|
|
1
|
+
{"version":3,"file":"_types.js","sourceRoot":"","sources":["../../../src/components/Explorer/_types.ts"],"names":[],"mappings":"","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 Override} from '@leav/utils';\nimport {\n type AttributePropertiesFragment,\n type PropertyValueFragment,\n type RecordFilterInput,\n type RecordIdentityFragment,\n} from '_ui/_gqlTypes';\nimport {type Key, type ReactElement} from 'react';\nimport {type IViewSettingsState} from './manage-view-settings';\nimport {type IView} from '_ui/types';\nimport {type MASS_SELECTION_ALL} from './_constants';\nimport {type UIFilter, type ValidFilter} from '../Filters/_types';\n\nexport type MassSelection = Key[] | typeof MASS_SELECTION_ALL;\n\nexport interface IExplorerData {\n totalCount: number;\n attributes: {\n [attributeId: string]: Override<AttributePropertiesFragment, {label: string}>;\n };\n records: IItemData[];\n}\n\nexport interface IItemData {\n libraryId: string;\n key: string;\n itemId: string;\n whoAmI: Required<RecordIdentityFragment['whoAmI']>;\n canActivate: boolean;\n canDelete: boolean;\n active: boolean;\n propertiesById: {\n [attributeId: string]: PropertyValueFragment[];\n };\n /**\n * Can be named `linkId` too, but for historical reason we keep old name 👴🏼.\n */\n id_value?: string;\n}\n\nexport interface IItemAction {\n callback: (item: IItemData) => void;\n icon: ReactElement | ((item: IItemData) => ReactElement);\n label: string | ((item: IItemData) => string);\n isDanger?: boolean | ((item: IItemData) => boolean);\n disabled?: boolean | ((item: IItemData) => boolean);\n useItemActionOnRowClick?: boolean;\n useItemDeletePermission?: boolean; //TODO: Add for PanelAttributeExplorer custom action (should be deleted later)\n}\n\nexport interface IPrimaryAction {\n callback: () => void;\n disabled?: boolean;\n icon: ReactElement;\n label: string;\n}\n\nexport interface IMassActions {\n callback: (massSelectedFilter: RecordFilterInput[], massSelection: MassSelection) => void | Promise<void>;\n deselectAll: boolean;\n icon: ReactElement;\n label: string;\n}\n\nexport type FeatureHook<T = {}> = {isEnabled: boolean; isVisible?: boolean} & T;\n\nexport type DefaultViewSettings = Override<\n Partial<IViewSettingsState>,\n {\n filtersOperator?: 'AND' | 'OR';\n filters?: UIFilter[];\n }\n>;\n\nexport type SerializedView = DefaultViewSettings;\n\nexport type ViewConfigTab = 'display' | 'filters' | 'sorts' | 'catalogue';\n\nexport type FiltersChangePayload = {\n filters: UIFilter[];\n filtersOperator: 'AND' | 'OR';\n};\n\nexport interface IEntrypointTree {\n type: 'tree';\n treeId: string;\n nodeId: string;\n}\n\nexport interface IEntrypointLibrary {\n type: 'library';\n libraryId: string;\n /**\n * Used to display a list of values instead of all library records when adding a link\n */\n valuesList?: string[];\n /**\n * Used to allow free entry when adding a link with values list\n */\n allowFreeEntry?: boolean;\n}\n\nexport interface IEntrypointLink {\n type: 'link';\n parentLibraryId: string;\n parentRecordId: string;\n linkAttributeId: string;\n}\n\nexport type Entrypoint = IEntrypointTree | IEntrypointLibrary | IEntrypointLink;\n\nexport interface IUserView extends Pick<IView, 'shared' | 'display' | 'sort' | 'attributes'> {\n label: Record<string, string>;\n id: IView['id'] | null;\n filters: ValidFilter[];\n ownerId: string | null;\n}\n\nexport interface IDataViewOnAction {\n id: string | null;\n label: Record<string, string> | null;\n}\n\nexport type SetNewPage = (newCurrentPage: number, ignoredPageSize: number) => void;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type RecordFilterInput } from '../../../../_gqlTypes';
|
|
2
|
+
import { type MassEditableAttribute, type SetAttributeMappingWithDependency } from './_types';
|
|
3
|
+
export declare const EditMonoDependencyWorkflowTreeAttribute: ({ libraryId, attribute, massSelectionFilters, setAttributeMapping, }: {
|
|
4
|
+
libraryId: string;
|
|
5
|
+
attribute: MassEditableAttribute;
|
|
6
|
+
massSelectionFilters: RecordFilterInput[];
|
|
7
|
+
setAttributeMapping: SetAttributeMappingWithDependency;
|
|
8
|
+
}) => JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { KitCollapse, KitLoader, KitSpace, KitTag, KitTypography } from 'aristid-ds';
|
|
3
|
+
import { useDelayedLoading } from '../../../../hooks/useDelayedLoading';
|
|
4
|
+
import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
|
|
5
|
+
import { EditTreeAttributeValuesMapping } from './EditTreeAttributeValuesMapping';
|
|
6
|
+
import { useDependencyValues } from './useDependencyValues';
|
|
7
|
+
export const EditMonoDependencyWorkflowTreeAttribute = ({ libraryId, attribute, massSelectionFilters, setAttributeMapping, }) => {
|
|
8
|
+
const { t } = useSharedTranslation();
|
|
9
|
+
const [monoDependencyAttribute, _ignoredCurrentAttribute] = attribute.dependencies.toSorted((a, _b) => a.id === attribute.id ? 1 : -1);
|
|
10
|
+
const { dependencyValues, loading } = useDependencyValues({
|
|
11
|
+
libraryId,
|
|
12
|
+
monoDependencyAttribute,
|
|
13
|
+
massSelectionFilters,
|
|
14
|
+
});
|
|
15
|
+
const isLoaderVisible = useDelayedLoading(loading);
|
|
16
|
+
if (isLoaderVisible) {
|
|
17
|
+
return _jsx(KitLoader, {});
|
|
18
|
+
}
|
|
19
|
+
return (_jsxs(KitSpace, { direction: "vertical", style: { width: '100%' }, children: [_jsx(KitTypography.Text, { style: { paddingTop: 'calc(var(--general-spacing-s) * 1px)' }, children: t('explorer.massAction.editAttribute_mono_dependency_workflow_notice') }), dependencyValues.map(({ key, label, dependencyAttributeId, dependencyAttributeNodeId, filtersWithDependency, dependencyFilter, }) => (_jsx(KitCollapse, { items: [
|
|
20
|
+
{
|
|
21
|
+
key: '1',
|
|
22
|
+
label: _jsx(KitTag, { type: "secondary", children: label }),
|
|
23
|
+
children: (_jsx(EditTreeAttributeValuesMapping, { libraryId: libraryId, attribute: attribute, dependencyAttributeId: dependencyAttributeId, dependencyAttributeNodeId: dependencyAttributeNodeId, massSelectionFilters: filtersWithDependency, setAttributeMapping: ({ before, after, occurrenceCount }) => {
|
|
24
|
+
setAttributeMapping({
|
|
25
|
+
before,
|
|
26
|
+
after,
|
|
27
|
+
occurrenceCount,
|
|
28
|
+
dependencyFilter,
|
|
29
|
+
});
|
|
30
|
+
} })),
|
|
31
|
+
},
|
|
32
|
+
] }, key)))] }));
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=EditMonoDependencyWorkflowTreeAttribute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditMonoDependencyWorkflowTreeAttribute.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/EditMonoDependencyWorkflowTreeAttribute.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnF,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAC,8BAA8B,EAAC,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAE1D,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC,EACpD,SAAS,EACT,SAAS,EACT,oBAAoB,EACpB,mBAAmB,GAMtB,EAAE,EAAE;IACD,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,CAAC,uBAAuB,EAAE,wBAAwB,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAClG,CAAC,CAAC,EAAE,KAAK,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACjC,CAAC;IAEF,MAAM,EAAC,gBAAgB,EAAE,OAAO,EAAC,GAAG,mBAAmB,CAAC;QACpD,SAAS;QACT,uBAAuB;QACvB,oBAAoB;KACvB,CAAC,CAAC;IAEH,MAAM,eAAe,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAEnD,IAAI,eAAe,EAAE,CAAC;QAClB,OAAO,KAAC,SAAS,KAAG,CAAC;IACzB,CAAC;IAED,OAAO,CACH,MAAC,QAAQ,IAAC,SAAS,EAAC,UAAU,EAAC,KAAK,EAAE,EAAC,KAAK,EAAE,MAAM,EAAC,aACjD,KAAC,aAAa,CAAC,IAAI,IAAC,KAAK,EAAE,EAAC,UAAU,EAAE,sCAAsC,EAAC,YAC1E,CAAC,CAAC,mEAAmE,CAAC,GACtD,EACpB,gBAAgB,CAAC,GAAG,CACjB,CAAC,EACG,GAAG,EACH,KAAK,EACL,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,gBAAgB,GACnB,EAAE,EAAE,CAAC,CACF,KAAC,WAAW,IAER,KAAK,EAAE;oBACH;wBACI,GAAG,EAAE,GAAG;wBACR,KAAK,EAAE,KAAC,MAAM,IAAC,IAAI,EAAC,WAAW,YAAE,KAAK,GAAU;wBAChD,QAAQ,EAAE,CACN,KAAC,8BAA8B,IAC3B,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,qBAAqB,EAAE,qBAAqB,EAC5C,yBAAyB,EAAE,yBAAyB,EACpD,oBAAoB,EAAE,qBAAqB,EAC3C,mBAAmB,EAAE,CAAC,EAAC,MAAM,EAAE,KAAK,EAAE,eAAe,EAAC,EAAE,EAAE;gCACtD,mBAAmB,CAAC;oCAChB,MAAM;oCACN,KAAK;oCACL,eAAe;oCACf,gBAAgB;iCACnB,CAAC,CAAC;4BACP,CAAC,GACH,CACL;qBACJ;iBACJ,IAvBI,GAAG,CAwBV,CACL,CACJ,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 RecordFilterInput} from '_ui/_gqlTypes';\nimport {KitCollapse, KitLoader, KitSpace, KitTag, KitTypography} from 'aristid-ds';\nimport {useDelayedLoading} from '_ui/hooks/useDelayedLoading';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type MassEditableAttribute, type SetAttributeMappingWithDependency} from './_types';\nimport {EditTreeAttributeValuesMapping} from './EditTreeAttributeValuesMapping';\nimport {useDependencyValues} from './useDependencyValues';\n\nexport const EditMonoDependencyWorkflowTreeAttribute = ({\n libraryId,\n attribute,\n massSelectionFilters,\n setAttributeMapping,\n}: {\n libraryId: string;\n attribute: MassEditableAttribute;\n massSelectionFilters: RecordFilterInput[];\n setAttributeMapping: SetAttributeMappingWithDependency;\n}) => {\n const {t} = useSharedTranslation();\n\n const [monoDependencyAttribute, _ignoredCurrentAttribute] = attribute.dependencies.toSorted((a, _b) =>\n a.id === attribute.id ? 1 : -1,\n );\n\n const {dependencyValues, loading} = useDependencyValues({\n libraryId,\n monoDependencyAttribute,\n massSelectionFilters,\n });\n\n const isLoaderVisible = useDelayedLoading(loading);\n\n if (isLoaderVisible) {\n return <KitLoader />;\n }\n\n return (\n <KitSpace direction=\"vertical\" style={{width: '100%'}}>\n <KitTypography.Text style={{paddingTop: 'calc(var(--general-spacing-s) * 1px)'}}>\n {t('explorer.massAction.editAttribute_mono_dependency_workflow_notice')}\n </KitTypography.Text>\n {dependencyValues.map(\n ({\n key,\n label,\n dependencyAttributeId,\n dependencyAttributeNodeId,\n filtersWithDependency,\n dependencyFilter,\n }) => (\n <KitCollapse\n key={key}\n items={[\n {\n key: '1',\n label: <KitTag type=\"secondary\">{label}</KitTag>,\n children: (\n <EditTreeAttributeValuesMapping\n libraryId={libraryId}\n attribute={attribute}\n dependencyAttributeId={dependencyAttributeId}\n dependencyAttributeNodeId={dependencyAttributeNodeId}\n massSelectionFilters={filtersWithDependency}\n setAttributeMapping={({before, after, occurrenceCount}) => {\n setAttributeMapping({\n before,\n after,\n occurrenceCount,\n dependencyFilter,\n });\n }}\n />\n ),\n },\n ]}\n />\n ),\n )}\n </KitSpace>\n );\n};\n"]}
|
package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type RecordFilterInput } from '../../../../_gqlTypes';
|
|
2
2
|
import { type MassEditableAttribute, type SetAttributeMapping } from './_types';
|
|
3
|
-
export declare const EditTreeAttributeValuesMapping: ({ libraryId, attribute, setAttributeMapping, massSelectionFilters, }: {
|
|
3
|
+
export declare const EditTreeAttributeValuesMapping: ({ libraryId, attribute, dependencyAttributeId, dependencyAttributeNodeId, setAttributeMapping, massSelectionFilters, }: {
|
|
4
4
|
libraryId: string;
|
|
5
5
|
attribute: MassEditableAttribute;
|
|
6
|
+
dependencyAttributeId?: string;
|
|
7
|
+
dependencyAttributeNodeId?: string;
|
|
6
8
|
setAttributeMapping: SetAttributeMapping;
|
|
7
9
|
massSelectionFilters: RecordFilterInput[];
|
|
8
10
|
}) => JSX.Element;
|
package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
|
|
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 { KitLoader, KitSpace } from 'aristid-ds';
|
|
6
6
|
import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
|
|
7
|
-
import {
|
|
8
|
-
import { useTreeNodeRemapping } from './useTreeNodeRemapping';
|
|
7
|
+
import { useTreeNodesCandidates } from './useTreeNodesCandidates';
|
|
9
8
|
import { TreeNodeRemap } from './TreeNodeRemap';
|
|
10
|
-
const
|
|
11
|
-
export const EditTreeAttributeValuesMapping = ({ libraryId, attribute, setAttributeMapping, massSelectionFilters, }) => {
|
|
9
|
+
const EMPTY_VALUE_NODE_ID = null;
|
|
10
|
+
export const EditTreeAttributeValuesMapping = ({ libraryId, attribute, dependencyAttributeId, dependencyAttributeNodeId, setAttributeMapping, massSelectionFilters, }) => {
|
|
12
11
|
const { t } = useSharedTranslation();
|
|
13
|
-
const {
|
|
12
|
+
const { candidateNodes, loading } = useTreeNodesCandidates({
|
|
14
13
|
attributeId: attribute.id,
|
|
14
|
+
dependencyAttributeId,
|
|
15
|
+
dependencyAttributeNodeId,
|
|
15
16
|
libraryId,
|
|
16
|
-
|
|
17
|
+
massSelectionFilters,
|
|
17
18
|
});
|
|
18
|
-
const noValueNode = attribute.treeNodes.find(({ id }) => id === UNDEFINED_NODE_ID) ?? null;
|
|
19
|
-
const editableNodes = attribute.treeNodes.filter(({ id }) => id !== UNDEFINED_NODE_ID);
|
|
20
|
-
const remappingList = useTreeNodeRemapping({ distribution, editableNodes });
|
|
21
19
|
if (loading) {
|
|
22
20
|
return _jsx(KitLoader, {});
|
|
23
21
|
}
|
|
24
|
-
return (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
return (_jsx(KitSpace, { direction: "vertical", size: "xs", style: { display: 'flex' }, children: candidateNodes.map(remapping => (_jsx(TreeNodeRemap, { currentNode: remapping.currentNode, occurrenceCount: remapping.occurrenceCount, candidateNodes: [
|
|
23
|
+
{ id: EMPTY_VALUE_NODE_ID, label: t('explorer.massAction.editAttribute_value_do_not_change') },
|
|
24
|
+
...remapping.allowedDependentValues,
|
|
25
|
+
], setAttributeMapping: setAttributeMapping }, remapping.currentNode.id ?? 'empty'))) }));
|
|
28
26
|
};
|
|
29
27
|
//# sourceMappingURL=EditTreeAttributeValuesMapping.js.map
|
package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditTreeAttributeValuesMapping.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAE/C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"EditTreeAttributeValuesMapping.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAE/C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAG9C,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,EAC3C,SAAS,EACT,SAAS,EACT,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,GAQvB,EAAE,EAAE;IACD,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,EAAC,cAAc,EAAE,OAAO,EAAC,GAAG,sBAAsB,CAAC;QACrD,WAAW,EAAE,SAAS,CAAC,EAAE;QACzB,qBAAqB;QACrB,yBAAyB;QACzB,SAAS;QACT,oBAAoB;KACvB,CAAC,CAAC;IAEH,IAAI,OAAO,EAAE,CAAC;QACV,OAAO,KAAC,SAAS,KAAG,CAAC;IACzB,CAAC;IAED,OAAO,CACH,KAAC,QAAQ,IAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,IAAI,EAAC,KAAK,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC,YAC5D,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAC7B,KAAC,aAAa,IAEV,WAAW,EAAE,SAAS,CAAC,WAAW,EAClC,eAAe,EAAE,SAAS,CAAC,eAAe,EAC1C,cAAc,EAAE;gBACZ,EAAC,EAAE,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC,CAAC,uDAAuD,CAAC,EAAC;gBAC5F,GAAG,SAAS,CAAC,sBAAsB;aACtC,EACD,mBAAmB,EAAE,mBAAmB,IAPnC,SAAS,CAAC,WAAW,CAAC,EAAE,IAAI,OAAO,CAQ1C,CACL,CAAC,GACK,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 {KitLoader, KitSpace} from 'aristid-ds';\nimport {type RecordFilterInput} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {useTreeNodesCandidates} from './useTreeNodesCandidates';\nimport {TreeNodeRemap} from './TreeNodeRemap';\nimport {type MassEditableAttribute, type SetAttributeMapping} from './_types';\n\nconst EMPTY_VALUE_NODE_ID = null;\n\nexport const EditTreeAttributeValuesMapping = ({\n libraryId,\n attribute,\n dependencyAttributeId,\n dependencyAttributeNodeId,\n setAttributeMapping,\n massSelectionFilters,\n}: {\n libraryId: string;\n attribute: MassEditableAttribute;\n dependencyAttributeId?: string;\n dependencyAttributeNodeId?: string;\n setAttributeMapping: SetAttributeMapping;\n massSelectionFilters: RecordFilterInput[];\n}) => {\n const {t} = useSharedTranslation();\n\n const {candidateNodes, loading} = useTreeNodesCandidates({\n attributeId: attribute.id,\n dependencyAttributeId,\n dependencyAttributeNodeId,\n libraryId,\n massSelectionFilters,\n });\n\n if (loading) {\n return <KitLoader />;\n }\n\n return (\n <KitSpace direction=\"vertical\" size=\"xs\" style={{display: 'flex'}}>\n {candidateNodes.map(remapping => (\n <TreeNodeRemap\n key={remapping.currentNode.id ?? 'empty'}\n currentNode={remapping.currentNode}\n occurrenceCount={remapping.occurrenceCount}\n candidateNodes={[\n {id: EMPTY_VALUE_NODE_ID, label: t('explorer.massAction.editAttribute_value_do_not_change')},\n ...remapping.allowedDependentValues,\n ]}\n setAttributeMapping={setAttributeMapping}\n />\n ))}\n </KitSpace>\n );\n};\n"]}
|
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
import { type SystemTranslation } from '../../../../types';
|
|
2
|
-
import { type SaveValueBulkMappingValueInput } from '../../../../_gqlTypes';
|
|
2
|
+
import { type RecordFilterInput, type SaveValueBulkMappingValueInput } from '../../../../_gqlTypes';
|
|
3
3
|
export type MassEditableAttribute = {
|
|
4
4
|
id: string;
|
|
5
5
|
label?: SystemTranslation;
|
|
6
6
|
dependencies: Array<{
|
|
7
7
|
id: string;
|
|
8
8
|
label?: SystemTranslation;
|
|
9
|
+
linkedTreeLibraryId: string;
|
|
9
10
|
}>;
|
|
10
11
|
hasEmptyDependency: boolean;
|
|
11
12
|
isSimpleWorkflow: boolean;
|
|
12
13
|
isMonoDependencyWorkflow: boolean;
|
|
13
|
-
treeNodes: MassEditTreeNode[];
|
|
14
14
|
};
|
|
15
15
|
export type MassEditTreeNode = {
|
|
16
16
|
id: string | null;
|
|
17
17
|
label: string;
|
|
18
18
|
color?: string | null;
|
|
19
|
-
allowedDependentNodeIds?: string[];
|
|
20
19
|
};
|
|
21
20
|
export type SetAttributeMapping = (mapping: SaveValueBulkMappingValueInput & {
|
|
22
21
|
occurrenceCount: number;
|
|
23
22
|
}) => void;
|
|
23
|
+
export type SetAttributeMappingWithDependency = (mapping: SaveValueBulkMappingValueInput & {
|
|
24
|
+
occurrenceCount: number;
|
|
25
|
+
} & {
|
|
26
|
+
dependencyFilter: RecordFilterInput;
|
|
27
|
+
}) => void;
|
|
28
|
+
export type DependencyValue = {
|
|
29
|
+
key: string;
|
|
30
|
+
label: string;
|
|
31
|
+
dependencyFilter: RecordFilterInput;
|
|
32
|
+
filtersWithDependency: RecordFilterInput[];
|
|
33
|
+
dependencyAttributeId?: string;
|
|
34
|
+
dependencyAttributeNodeId?: string;
|
|
35
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_types.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/_types.ts"],"names":[],"mappings":"","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 SystemTranslation} from '_ui/types';\nimport {type SaveValueBulkMappingValueInput} from '_ui/_gqlTypes';\n\nexport type MassEditableAttribute = {\n id: string;\n label?: SystemTranslation;\n dependencies: Array<{id: string; label?: SystemTranslation}>;\n hasEmptyDependency: boolean;\n isSimpleWorkflow: boolean;\n isMonoDependencyWorkflow: boolean;\n
|
|
1
|
+
{"version":3,"file":"_types.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/_types.ts"],"names":[],"mappings":"","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 SystemTranslation} from '_ui/types';\nimport {type RecordFilterInput, type SaveValueBulkMappingValueInput} from '_ui/_gqlTypes';\n\nexport type MassEditableAttribute = {\n id: string;\n label?: SystemTranslation;\n dependencies: Array<{id: string; label?: SystemTranslation; linkedTreeLibraryId: string}>;\n hasEmptyDependency: boolean;\n isSimpleWorkflow: boolean;\n isMonoDependencyWorkflow: boolean;\n};\n\nexport type MassEditTreeNode = {\n id: string | null;\n label: string;\n color?: string | null;\n};\n\nexport type SetAttributeMapping = (mapping: SaveValueBulkMappingValueInput & {occurrenceCount: number}) => void;\n\nexport type SetAttributeMappingWithDependency = (\n mapping: SaveValueBulkMappingValueInput & {occurrenceCount: number} & {dependencyFilter: RecordFilterInput},\n) => void;\n\nexport type DependencyValue = {\n key: string;\n label: string;\n dependencyFilter: RecordFilterInput;\n filtersWithDependency: RecordFilterInput[];\n dependencyAttributeId?: string;\n dependencyAttributeNodeId?: string;\n};\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type RecordFilterInput } from '../../../../_gqlTypes';
|
|
2
|
+
import { type DependencyValue } from './_types';
|
|
3
|
+
export declare const useDependencyValues: ({ libraryId, monoDependencyAttribute, massSelectionFilters, }: {
|
|
4
|
+
libraryId: string;
|
|
5
|
+
monoDependencyAttribute: {
|
|
6
|
+
id: string;
|
|
7
|
+
linkedTreeLibraryId: string;
|
|
8
|
+
};
|
|
9
|
+
massSelectionFilters: RecordFilterInput[];
|
|
10
|
+
}) => {
|
|
11
|
+
dependencyValues: DependencyValue[];
|
|
12
|
+
loading: boolean;
|
|
13
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
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 { RecordFilterCondition, RecordFilterOperator, useValuesOccurrencesForDependencyQuery, } from '../../../../_gqlTypes';
|
|
5
|
+
import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
|
|
6
|
+
export const useDependencyValues = ({ libraryId, monoDependencyAttribute, massSelectionFilters, }) => {
|
|
7
|
+
const { t } = useSharedTranslation();
|
|
8
|
+
const { data, loading } = useValuesOccurrencesForDependencyQuery({
|
|
9
|
+
variables: {
|
|
10
|
+
libraryId,
|
|
11
|
+
dependencyAttributeId: monoDependencyAttribute.id,
|
|
12
|
+
recordFilters: massSelectionFilters,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
const dependencyValues = (data?.listDistinctValues ?? []).map(occurrence => {
|
|
16
|
+
const dependencyFilter = occurrence.treeNode
|
|
17
|
+
? {
|
|
18
|
+
field: `${monoDependencyAttribute.id}.${monoDependencyAttribute.linkedTreeLibraryId}.id`,
|
|
19
|
+
condition: RecordFilterCondition.EQUAL,
|
|
20
|
+
value: occurrence.treeNode.record.id,
|
|
21
|
+
}
|
|
22
|
+
: {
|
|
23
|
+
field: monoDependencyAttribute.id,
|
|
24
|
+
condition: RecordFilterCondition.IS_EMPTY,
|
|
25
|
+
};
|
|
26
|
+
const filtersWithDependency = massSelectionFilters.length > 0
|
|
27
|
+
? [
|
|
28
|
+
dependencyFilter,
|
|
29
|
+
{ operator: RecordFilterOperator.AND },
|
|
30
|
+
{ operator: RecordFilterOperator.OPEN_BRACKET },
|
|
31
|
+
...massSelectionFilters,
|
|
32
|
+
{ operator: RecordFilterOperator.CLOSE_BRACKET },
|
|
33
|
+
]
|
|
34
|
+
: [dependencyFilter];
|
|
35
|
+
return {
|
|
36
|
+
key: occurrence.treeNode?.id ?? 'no-dependency',
|
|
37
|
+
label: occurrence.treeNode?.record.whoAmI.label ??
|
|
38
|
+
String(t('explorer.massAction.editAttribute_value_undefined')),
|
|
39
|
+
dependencyFilter,
|
|
40
|
+
filtersWithDependency,
|
|
41
|
+
dependencyAttributeId: occurrence.treeNode ? monoDependencyAttribute.id : undefined,
|
|
42
|
+
dependencyAttributeNodeId: occurrence.treeNode?.id,
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
return { dependencyValues, loading };
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=useDependencyValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDependencyValues.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/useDependencyValues.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EACH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AC,gBAAgB,CAAC,CAAC;QAE7B,OAAO;YACH,GAAG,EAAE,UAAU,CAAC,QAAQ,EAAE,EAAE,IAAI,eAAe;YAC/C,KAAK,EACD,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;gBACxC,MAAM,CAAC,CAAC,CAAC,mDAAmD,CAAC,CAAC;YAClE,gBAAgB;YAChB,qBAAqB;YACrB,qBAAqB,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;YACnF,yBAAyB,EAAE,UAAU,CAAC,QAAQ,EAAE,EAAE;SACrD,CAAC;IACN,CAAC,CAAC,CAAC;IAEH,OAAO,EAAC,gBAAgB,EAAE,OAAO,EAAC,CAAC;AACvC,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {\n RecordFilterCondition,\n type RecordFilterInput,\n RecordFilterOperator,\n useValuesOccurrencesForDependencyQuery,\n} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type DependencyValue} from './_types';\n\nexport const useDependencyValues = ({\n libraryId,\n monoDependencyAttribute,\n massSelectionFilters,\n}: {\n libraryId: string;\n monoDependencyAttribute: {id: string; linkedTreeLibraryId: string};\n massSelectionFilters: RecordFilterInput[];\n}): {dependencyValues: DependencyValue[]; loading: boolean} => {\n const {t} = useSharedTranslation();\n\n const {data, loading} = useValuesOccurrencesForDependencyQuery({\n variables: {\n libraryId,\n dependencyAttributeId: monoDependencyAttribute.id,\n recordFilters: massSelectionFilters,\n },\n });\n\n const dependencyValues = (data?.listDistinctValues ?? []).map(occurrence => {\n const dependencyFilter: RecordFilterInput = occurrence.treeNode\n ? {\n field: `${monoDependencyAttribute.id}.${monoDependencyAttribute.linkedTreeLibraryId}.id`,\n condition: RecordFilterCondition.EQUAL,\n value: occurrence.treeNode.record.id,\n }\n : {\n field: monoDependencyAttribute.id,\n condition: RecordFilterCondition.IS_EMPTY,\n };\n\n const filtersWithDependency: RecordFilterInput[] =\n massSelectionFilters.length > 0\n ? [\n dependencyFilter,\n {operator: RecordFilterOperator.AND},\n {operator: RecordFilterOperator.OPEN_BRACKET},\n ...massSelectionFilters,\n {operator: RecordFilterOperator.CLOSE_BRACKET},\n ]\n : [dependencyFilter];\n\n return {\n key: occurrence.treeNode?.id ?? 'no-dependency',\n label:\n occurrence.treeNode?.record.whoAmI.label ??\n String(t('explorer.massAction.editAttribute_value_undefined')),\n dependencyFilter,\n filtersWithDependency,\n dependencyAttributeId: occurrence.treeNode ? monoDependencyAttribute.id : undefined,\n dependencyAttributeNodeId: occurrence.treeNode?.id,\n };\n });\n\n return {dependencyValues, loading};\n};\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type SaveValueBulkMappingInput } from '../../../../_gqlTypes';
|
|
2
|
+
import { type SetAttributeMapping, type SetAttributeMappingWithDependency } from './_types';
|
|
3
|
+
type EditionMapping = {
|
|
4
|
+
count: number;
|
|
5
|
+
mapping: SaveValueBulkMappingInput[];
|
|
6
|
+
};
|
|
7
|
+
export declare const useEditionMappingState: () => {
|
|
8
|
+
editionMapping: EditionMapping;
|
|
9
|
+
resetEditionMapping: () => void;
|
|
10
|
+
applyMappingChange: SetAttributeMapping;
|
|
11
|
+
applyMonoDependencyWorkflowChange: SetAttributeMappingWithDependency;
|
|
12
|
+
};
|
|
13
|
+
export {};
|