@leav/ui 1.12.0-1 → 1.12.0-1ebb8ba2
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/__mocks__/utils.d.ts +3 -0
- package/dist/__mocks__/utils.js +2 -0
- package/dist/__mocks__/utils.js.map +1 -0
- package/dist/_gqlTypes/index.d.ts +361 -116
- package/dist/_gqlTypes/index.js +261 -51
- 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/DataView.js +39 -11
- package/dist/components/Explorer/DataView.js.map +1 -1
- package/dist/components/Explorer/Explorer.js +3 -2
- package/dist/components/Explorer/Explorer.js.map +1 -1
- package/dist/components/Explorer/TableNameCell.js +1 -4
- package/dist/components/Explorer/TableNameCell.js.map +1 -1
- package/dist/components/Explorer/_constants.d.ts +0 -1
- package/dist/components/Explorer/_constants.js +0 -1
- package/dist/components/Explorer/_constants.js.map +1 -1
- package/dist/components/Explorer/actions-item/useEditStatusItemAction.js +5 -9
- package/dist/components/Explorer/actions-item/useEditStatusItemAction.js.map +1 -1
- package/dist/components/Explorer/actions-mass/ResultsCount.js +2 -2
- package/dist/components/Explorer/actions-mass/ResultsCount.js.map +1 -1
- package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.d.ts +4 -9
- package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.js +3 -11
- package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.js.map +1 -1
- package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.d.ts +8 -8
- package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js +26 -13
- package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js.map +1 -1
- package/dist/components/Explorer/actions-mass/edit-attribute/TreeNodeRemap.d.ts +7 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/TreeNodeRemap.js +30 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/TreeNodeRemap.js.map +1 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/_types.d.ts +23 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/_types.js +2 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/_types.js.map +1 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useMassEditableAttributes.d.ts +4 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useMassEditableAttributes.js +46 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useMassEditableAttributes.js.map +1 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useTreeNodeRemapping.d.ts +12 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useTreeNodeRemapping.js +24 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useTreeNodeRemapping.js.map +1 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useValuesDistribution.d.ts +13 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useValuesDistribution.js +28 -0
- package/dist/components/Explorer/actions-mass/edit-attribute/useValuesDistribution.js.map +1 -0
- package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js +6 -10
- package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js.map +1 -1
- package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js +5 -8
- package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js.map +1 -1
- package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.d.ts +8 -2
- package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js +104 -72
- package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js.map +1 -1
- package/dist/components/Explorer/actions-mass/useMassActions.js +30 -19
- package/dist/components/Explorer/actions-mass/useMassActions.js.map +1 -1
- package/dist/components/Explorer/conditionsHelper.d.ts +2 -1
- package/dist/components/Explorer/conditionsHelper.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js +6 -4
- package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js.map +1 -1
- package/dist/components/Filters/_types.d.ts +3 -0
- package/dist/components/Filters/_types.js.map +1 -1
- package/dist/components/Filters/conditionsHelper.d.ts +2 -1
- package/dist/components/Filters/conditionsHelper.js.map +1 -1
- package/dist/components/Filters/context/filtersReducer.js +14 -1
- package/dist/components/Filters/context/filtersReducer.js.map +1 -1
- package/dist/components/Filters/filter-items/CommonFilterItem.js.map +1 -1
- package/dist/components/Filters/filter-items/filter-type/useConditionOptionsByType.js.map +1 -1
- package/dist/components/Filters/useFilters.d.ts +198 -0
- package/dist/components/Filters/useTransformFilters.js +4 -2
- package/dist/components/Filters/useTransformFilters.js.map +1 -1
- package/dist/components/RecordEdition/EditRecord/EditRecord.js +8 -1
- package/dist/components/RecordEdition/EditRecord/EditRecord.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/unlink-record/useUnlinkRecord.d.ts +1 -4
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/unlink-record/useUnlinkRecord.js +5 -9
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/tag/unlink-record/useUnlinkRecord.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/DeleteAllValuesButton.js +4 -8
- package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/DeleteAllValuesButton.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js +1 -1
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js.map +1 -1
- package/dist/components/RecordEdition/hooks/useCreateCancelConfirm/useCreateCancelConfirm.js +4 -8
- package/dist/components/RecordEdition/hooks/useCreateCancelConfirm/useCreateCancelConfirm.js.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/constants.js.map +1 -1
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useConfirmModal/__mocks__/index.d.ts +1 -0
- package/dist/hooks/useConfirmModal/__mocks__/index.js +5 -0
- package/dist/hooks/useConfirmModal/__mocks__/index.js.map +1 -0
- package/dist/hooks/useConfirmModal/__mocks__/useConfirmModal.d.ts +3 -0
- package/dist/hooks/useConfirmModal/__mocks__/useConfirmModal.js +7 -0
- package/dist/hooks/useConfirmModal/__mocks__/useConfirmModal.js.map +1 -0
- package/dist/hooks/useConfirmModal/index.d.ts +1 -0
- package/dist/hooks/useConfirmModal/index.js +5 -0
- package/dist/hooks/useConfirmModal/index.js.map +1 -0
- package/dist/hooks/useConfirmModal/useConfirmModal.d.ts +7 -0
- package/dist/hooks/useConfirmModal/useConfirmModal.js +25 -0
- package/dist/hooks/useConfirmModal/useConfirmModal.js.map +1 -0
- package/dist/hooks/useGetRecordIdCard/index.d.ts +1 -0
- package/dist/hooks/useGetRecordIdCard/index.js +5 -0
- package/dist/hooks/useGetRecordIdCard/index.js.map +1 -0
- package/dist/hooks/useGetRecordIdCard/useGetRecordIdCard.d.ts +18 -0
- package/dist/hooks/useGetRecordIdCard/useGetRecordIdCard.js +20 -0
- package/dist/hooks/useGetRecordIdCard/useGetRecordIdCard.js.map +1 -0
- package/dist/hooks/useIFrameMessenger/iFrameMessengerContext.d.ts +6 -0
- package/dist/hooks/useIFrameMessenger/iFrameMessengerContext.js +8 -0
- package/dist/hooks/useIFrameMessenger/iFrameMessengerContext.js.map +1 -0
- package/dist/hooks/useIFrameMessenger/types.d.ts +10 -3
- package/dist/hooks/useIFrameMessenger/types.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/useIFrameMessenger.d.ts +11 -2
- package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js +31 -10
- package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/useIFrameMessengerContext.d.ts +13 -0
- package/dist/hooks/useIFrameMessenger/useIFrameMessengerContext.js +59 -0
- package/dist/hooks/useIFrameMessenger/useIFrameMessengerContext.js.map +1 -0
- package/dist/hooks/useIFrameMessenger/useIFrameMessengerHandlers.d.ts +13 -0
- package/dist/hooks/useIFrameMessenger/useIFrameMessengerHandlers.js +29 -0
- package/dist/hooks/useIFrameMessenger/useIFrameMessengerHandlers.js.map +1 -0
- package/dist/hooks/useIFrameMessengerClient/IFrameMessengerClient.js +3 -0
- package/dist/hooks/useIFrameMessengerClient/IFrameMessengerClient.js.map +1 -1
- package/dist/hooks/useIFrameMessengerClient/iFrameMessengerClientContext.d.ts +1 -0
- package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.d.ts +1 -0
- package/dist/hooks/useSharedTranslation/__mocks__/useSharedTranslation.js.map +1 -1
- package/dist/locales/en/shared.json +6 -4
- package/dist/locales/fr/shared.json +8 -6
- package/package.json +16 -16
- package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.d.ts +0 -8
- package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.js +0 -40
- package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValueLine.js.map +0 -1
- package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.d.ts +0 -17
- package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.js +0 -42
- package/dist/components/Explorer/actions-mass/edit-attribute/useCountValuesOccurrencesHook.js.map +0 -1
- package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.d.ts +0 -5
- package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.js +0 -20
- package/dist/components/Explorer/actions-mass/edit-attribute/useListEditableAttributeHook.js.map +0 -1
- package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.d.ts +0 -12
- package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.js +0 -30
- package/dist/components/Explorer/actions-mass/edit-attribute/useListTreeAttributeValuesHook.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultsCount.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/ResultsCount.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ResultsCount.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/ResultsCount.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAUnD,MAAM,CAAC,MAAM,YAAY,GAAyC,CAAC,EAC/D,CAAC,EACD,UAAU,EACV,kBAAkB,EAClB,iBAAiB,GACpB,EAAE,EAAE,CAAC,CACF,MAAC,QAAQ,IAAC,SAAS,EAAC,YAAY,EAAC,IAAI,EAAC,KAAK,aACvC,KAAC,aAAa,CAAC,IAAI,IAAC,MAAM,EAAC,MAAM,EAAC,IAAI,EAAC,WAAW,YAC7C,UAAU;gBACP,CAAC,CAAC,GAAG,iBAAiB,GAAG;gBACzB,CAAC,CAAC,kBAAkB,KAAK,iBAAiB;oBACxC,CAAC,CAAC,GAAG,iBAAiB,GAAG;oBACzB,CAAC,CAAC,GAAG,kBAAkB,MAAM,iBAAiB,GAAG,GACtC,EACrB,KAAC,aAAa,CAAC,IAAI,IAAC,MAAM,EAAC,QAAQ,EAAC,IAAI,EAAC,WAAW,YAC/C,CAAC,CAAC,6BAA6B,EAAE,EAAC,KAAK,EAAE,iBAAiB,EAAC,CAAC,GAC5C,IACd,CACd,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 useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {KitSpace, KitTypography} from 'aristid-ds';\nimport {type FunctionComponent} from 'react';\n\ninterface IResultCountProps {\n t: ReturnType<typeof useSharedTranslation>['t'];\n isInactive: boolean;\n totalCountFiltered: number;\n totalCountLibrary: number;\n}\n\nexport const ResultsCount: FunctionComponent<IResultCountProps> = ({\n t,\n isInactive,\n totalCountFiltered,\n totalCountLibrary,\n}) => (\n <KitSpace direction=\"horizontal\" size=\"xxs\">\n <KitTypography.Text weight=\"bold\" size=\"fontSize7\">\n {isInactive\n ? `${totalCountLibrary} `\n : totalCountFiltered === totalCountLibrary\n ? `${totalCountLibrary} `\n : `${totalCountFiltered} / ${totalCountLibrary} `}\n </KitTypography.Text>\n <KitTypography.Text weight=\"medium\" size=\"fontSize7\">\n {t('explorer.massAction.results', {count: totalCountLibrary})}\n </KitTypography.Text>\n </KitSpace>\n);\n"]}
|
package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
export declare const EditAttributeMassActionModal: FunctionComponent<{
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export declare const EditAttributeMassActionModal: ({ isOpen, children, bulkCount, onOkButtonClick, onCancelButtonClick, }: {
|
|
4
3
|
isOpen: boolean;
|
|
5
4
|
children: ReactNode;
|
|
6
|
-
|
|
7
|
-
setSelectedAttribute: (attr: AttributeDetailsFragment | undefined) => void;
|
|
8
|
-
massSelectionFilter: RecordFilterInput[];
|
|
9
|
-
elementsCount: number;
|
|
10
|
-
disableOkButton: boolean;
|
|
5
|
+
bulkCount: number;
|
|
11
6
|
onOkButtonClick: () => void;
|
|
12
7
|
onCancelButtonClick: () => void;
|
|
13
|
-
}
|
|
8
|
+
}) => JSX.Element;
|
package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.js
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } 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
2
|
import { faCheck, faXmark } from '@fortawesome/free-solid-svg-icons';
|
|
6
3
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
4
|
+
import { KitButton, KitModal, KitSpace, KitTypography } from 'aristid-ds';
|
|
7
5
|
import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
|
|
8
|
-
import { KitButton, KitModal, KitSelect, KitSpace, KitTypography } from 'aristid-ds';
|
|
9
6
|
const MODAL_WIDTH = '90vw';
|
|
10
7
|
const MODAL_MAX_WIDTH = '656px';
|
|
11
|
-
export const EditAttributeMassActionModal = ({ isOpen, children,
|
|
8
|
+
export const EditAttributeMassActionModal = ({ isOpen, children, bulkCount, onOkButtonClick, onCancelButtonClick, }) => {
|
|
12
9
|
const { t } = useSharedTranslation();
|
|
13
|
-
return (_jsx(KitModal, { isOpen: isOpen, appElement: document.getElementById('root'), style: { content: { width: MODAL_WIDTH, maxWidth: MODAL_MAX_WIDTH } }, width: "100%", height: "auto", icon: false, title: _jsxs(KitSpace, { direction: "vertical", size: "none", children: [_jsx(KitTypography.Title, { level: "h2", children: t('explorer.massAction.editAttribute') }), _jsx(KitTypography.Text, { size: "fontSize7", children: t('explorer.massAction.editAttribute_description', { count:
|
|
14
|
-
label: attr.label || attr.id,
|
|
15
|
-
value: attr.id,
|
|
16
|
-
})), size: "large", allowClear: false, onChange: value => {
|
|
17
|
-
setSelectedAttribute(attributes.find(att => att.id === value));
|
|
18
|
-
}, placeholder: t('explorer.massAction.editAttribute_attribute_select_placeholder') })] }), children] }) }));
|
|
10
|
+
return (_jsx(KitModal, { isOpen: isOpen, appElement: document.getElementById('root'), style: { content: { width: MODAL_WIDTH, maxWidth: MODAL_MAX_WIDTH } }, width: "100%", height: "auto", icon: false, title: _jsxs(KitSpace, { direction: "vertical", size: "none", children: [_jsx(KitTypography.Title, { level: "h2", children: t('explorer.massAction.editAttribute') }), _jsx(KitTypography.Text, { size: "fontSize7", children: t('explorer.massAction.editAttribute_description', { count: bulkCount }) })] }), footer: _jsxs(_Fragment, { children: [_jsx(KitButton, { size: "m", icon: _jsx(FontAwesomeIcon, { icon: faXmark }), onClick: onCancelButtonClick, children: t('global.cancel') }), _jsx(KitButton, { type: "primary", onClick: onOkButtonClick, size: "m", icon: _jsx(FontAwesomeIcon, { icon: faCheck }), children: t('global.edit') })] }), children: _jsx(KitSpace, { direction: "vertical", size: "s", style: { display: 'flex' }, children: children }) }));
|
|
19
11
|
};
|
|
20
12
|
//# sourceMappingURL=EditAttributeMassActionModal.js.map
|
package/dist/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditAttributeMassActionModal.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"EditAttributeMassActionModal.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/EditAttributeMassActionModal.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAExE,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,eAAe,GAAG,OAAO,CAAC;AAEhC,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EACzC,MAAM,EACN,QAAQ,EACR,SAAS,EACT,eAAe,EACf,mBAAmB,GAOtB,EAAE,EAAE;IACD,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,OAAO,CACH,KAAC,QAAQ,IACL,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,EAC3C,KAAK,EAAE,EAAC,OAAO,EAAE,EAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAC,EAAC,EACjE,KAAK,EAAC,MAAM,EACZ,MAAM,EAAC,MAAM,EACb,IAAI,EAAE,KAAK,EACX,KAAK,EACD,MAAC,QAAQ,IAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,MAAM,aACtC,KAAC,aAAa,CAAC,KAAK,IAAC,KAAK,EAAC,IAAI,YAAE,CAAC,CAAC,mCAAmC,CAAC,GAAuB,EAC9F,KAAC,aAAa,CAAC,IAAI,IAAC,IAAI,EAAC,WAAW,YAC/B,CAAC,CAAC,+CAA+C,EAAE,EAAC,KAAK,EAAE,SAAS,EAAC,CAAC,GACtD,IACd,EAEf,MAAM,EACF,8BACI,KAAC,SAAS,IAAC,IAAI,EAAC,GAAG,EAAC,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,OAAO,GAAI,EAAE,OAAO,EAAE,mBAAmB,YACrF,CAAC,CAAC,eAAe,CAAC,GACX,EACZ,KAAC,SAAS,IACN,IAAI,EAAC,SAAS,EACd,OAAO,EAAE,eAAe,EACxB,IAAI,EAAC,GAAG,EACR,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,OAAO,GAAI,YAEvC,CAAC,CAAC,aAAa,CAAC,GACT,IACb,YAGP,KAAC,QAAQ,IAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,GAAG,EAAC,KAAK,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC,YAC3D,QAAQ,GACF,GACJ,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 ReactNode} from 'react';\nimport {faCheck, faXmark} from '@fortawesome/free-solid-svg-icons';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {KitButton, KitModal, KitSpace, KitTypography} from 'aristid-ds';\nimport {type RecordFilterInput} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\n\nconst MODAL_WIDTH = '90vw';\nconst MODAL_MAX_WIDTH = '656px';\n\nexport const EditAttributeMassActionModal = ({\n isOpen,\n children,\n bulkCount,\n onOkButtonClick,\n onCancelButtonClick,\n}: {\n isOpen: boolean;\n children: ReactNode;\n bulkCount: number;\n onOkButtonClick: () => void;\n onCancelButtonClick: () => void;\n}) => {\n const {t} = useSharedTranslation();\n\n return (\n <KitModal\n isOpen={isOpen}\n appElement={document.getElementById('root')}\n style={{content: {width: MODAL_WIDTH, maxWidth: MODAL_MAX_WIDTH}}}\n width=\"100%\"\n height=\"auto\"\n icon={false}\n title={\n <KitSpace direction=\"vertical\" size=\"none\">\n <KitTypography.Title level=\"h2\">{t('explorer.massAction.editAttribute')}</KitTypography.Title>\n <KitTypography.Text size=\"fontSize7\">\n {t('explorer.massAction.editAttribute_description', {count: bulkCount})}\n </KitTypography.Text>\n </KitSpace>\n }\n footer={\n <>\n <KitButton size=\"m\" icon={<FontAwesomeIcon icon={faXmark} />} onClick={onCancelButtonClick}>\n {t('global.cancel')}\n </KitButton>\n <KitButton\n type=\"primary\"\n onClick={onOkButtonClick}\n size=\"m\"\n icon={<FontAwesomeIcon icon={faCheck} />}\n >\n {t('global.edit')}\n </KitButton>\n </>\n }\n >\n <KitSpace direction=\"vertical\" size=\"s\" style={{display: 'flex'}}>\n {children}\n </KitSpace>\n </KitModal>\n );\n};\n"]}
|
package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
import { type RecordFilterInput } from '../../../../_gqlTypes';
|
|
2
|
+
import { type MassEditableAttribute, type SetAttributeMapping } from './_types';
|
|
3
|
+
export declare const EditTreeAttributeValuesMapping: ({ libraryId, attribute, setAttributeMapping, massSelectionFilters, }: {
|
|
4
|
+
libraryId: string;
|
|
5
|
+
attribute: MassEditableAttribute;
|
|
6
|
+
setAttributeMapping: SetAttributeMapping;
|
|
7
|
+
massSelectionFilters: RecordFilterInput[];
|
|
8
|
+
}) => JSX.Element;
|
package/dist/components/Explorer/actions-mass/edit-attribute/EditTreeAttributeValuesMapping.js
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 { KitLoader, KitSpace } from 'aristid-ds';
|
|
6
|
+
import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
|
|
7
|
+
import { useValuesDistribution } from './useValuesDistribution';
|
|
8
|
+
import { useTreeNodeRemapping } from './useTreeNodeRemapping';
|
|
9
|
+
import { TreeNodeRemap } from './TreeNodeRemap';
|
|
10
|
+
const UNDEFINED_NODE_ID = null;
|
|
11
|
+
export const EditTreeAttributeValuesMapping = ({ libraryId, attribute, setAttributeMapping, massSelectionFilters, }) => {
|
|
12
|
+
const { t } = useSharedTranslation();
|
|
13
|
+
const { distribution, noValueCount, loading } = useValuesDistribution({
|
|
14
|
+
attributeId: attribute.id,
|
|
15
|
+
libraryId,
|
|
16
|
+
recordFilters: massSelectionFilters,
|
|
17
|
+
});
|
|
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
|
+
if (loading) {
|
|
22
|
+
return _jsx(KitLoader, {});
|
|
23
|
+
}
|
|
24
|
+
return (_jsxs(KitSpace, { direction: "vertical", size: "xs", style: { display: 'flex' }, children: [remappingList.map(remapping => (_jsx(TreeNodeRemap, { ...remapping, setAttributeMapping: setAttributeMapping }, remapping.currentNode.id))), noValueCount > 0 && noValueNode !== null && (_jsx(TreeNodeRemap, { currentNode: noValueNode, occurrenceCount: noValueCount, candidateNodes: [
|
|
25
|
+
{ id: UNDEFINED_NODE_ID, label: t('explorer.massAction.editAttribute_value_do_not_change') },
|
|
26
|
+
...editableNodes,
|
|
27
|
+
], setAttributeMapping: setAttributeMapping }))] }));
|
|
15
28
|
};
|
|
16
29
|
//# 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":";
|
|
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,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAG9C,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAE/B,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,EAC3C,SAAS,EACT,SAAS,EACT,mBAAmB,EACnB,oBAAoB,GAMvB,EAAE,EAAE;IACD,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,EAAC,YAAY,EAAE,YAAY,EAAE,OAAO,EAAC,GAAG,qBAAqB,CAAC;QAChE,WAAW,EAAE,SAAS,CAAC,EAAE;QACzB,SAAS;QACT,aAAa,EAAE,oBAAoB;KACtC,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAC,EAAE,EAAC,EAAE,EAAE,CAAC,EAAE,KAAK,iBAAiB,CAAC,IAAI,IAAI,CAAC;IACzF,MAAM,aAAa,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAC,EAAE,EAAC,EAAE,EAAE,CAAC,EAAE,KAAK,iBAAiB,CAAC,CAAC;IAErF,MAAM,aAAa,GAAG,oBAAoB,CAAC,EAAC,YAAY,EAAE,aAAa,EAAC,CAAC,CAAC;IAE1E,IAAI,OAAO,EAAE,CAAC;QACV,OAAO,KAAC,SAAS,KAAG,CAAC;IACzB,CAAC;IAED,OAAO,CACH,MAAC,QAAQ,IAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,IAAI,EAAC,KAAK,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC,aAC5D,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAC5B,KAAC,aAAa,OAEN,SAAS,EACb,mBAAmB,EAAE,mBAAmB,IAFnC,SAAS,CAAC,WAAW,CAAC,EAAE,CAG/B,CACL,CAAC,EACD,YAAY,GAAG,CAAC,IAAI,WAAW,KAAK,IAAI,IAAI,CACzC,KAAC,aAAa,IACV,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,YAAY,EAC7B,cAAc,EAAE;oBACZ,EAAC,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC,CAAC,uDAAuD,CAAC,EAAC;oBAC1F,GAAG,aAAa;iBACnB,EACD,mBAAmB,EAAE,mBAAmB,GAC1C,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 {KitLoader, KitSpace} from 'aristid-ds';\nimport {type RecordFilterInput} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {useValuesDistribution} from './useValuesDistribution';\nimport {useTreeNodeRemapping} from './useTreeNodeRemapping';\nimport {TreeNodeRemap} from './TreeNodeRemap';\nimport {type MassEditableAttribute, type SetAttributeMapping} from './_types';\n\nconst UNDEFINED_NODE_ID = null;\n\nexport const EditTreeAttributeValuesMapping = ({\n libraryId,\n attribute,\n setAttributeMapping,\n massSelectionFilters,\n}: {\n libraryId: string;\n attribute: MassEditableAttribute;\n setAttributeMapping: SetAttributeMapping;\n massSelectionFilters: RecordFilterInput[];\n}) => {\n const {t} = useSharedTranslation();\n\n const {distribution, noValueCount, loading} = useValuesDistribution({\n attributeId: attribute.id,\n libraryId,\n recordFilters: massSelectionFilters,\n });\n\n const noValueNode = attribute.treeNodes.find(({id}) => id === UNDEFINED_NODE_ID) ?? null;\n const editableNodes = attribute.treeNodes.filter(({id}) => id !== UNDEFINED_NODE_ID);\n\n const remappingList = useTreeNodeRemapping({distribution, editableNodes});\n\n if (loading) {\n return <KitLoader />;\n }\n\n return (\n <KitSpace direction=\"vertical\" size=\"xs\" style={{display: 'flex'}}>\n {remappingList.map(remapping => (\n <TreeNodeRemap\n key={remapping.currentNode.id}\n {...remapping}\n setAttributeMapping={setAttributeMapping}\n />\n ))}\n {noValueCount > 0 && noValueNode !== null && (\n <TreeNodeRemap\n currentNode={noValueNode}\n occurrenceCount={noValueCount}\n candidateNodes={[\n {id: UNDEFINED_NODE_ID, label: t('explorer.massAction.editAttribute_value_do_not_change')},\n ...editableNodes,\n ]}\n setAttributeMapping={setAttributeMapping}\n />\n )}\n </KitSpace>\n );\n};\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type MassEditTreeNode, type SetAttributeMapping } from './_types';
|
|
2
|
+
export declare const TreeNodeRemap: ({ currentNode, occurrenceCount, candidateNodes, setAttributeMapping, }: {
|
|
3
|
+
currentNode: MassEditTreeNode;
|
|
4
|
+
occurrenceCount: number;
|
|
5
|
+
candidateNodes: MassEditTreeNode[];
|
|
6
|
+
setAttributeMapping: SetAttributeMapping;
|
|
7
|
+
}) => JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { KitIdCard, KitSelect, KitTypography } from 'aristid-ds';
|
|
4
|
+
import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
|
|
5
|
+
const DivContainer = styled.div `
|
|
6
|
+
display: grid;
|
|
7
|
+
align-items: center;
|
|
8
|
+
grid-template-columns: repeat(3, 1fr);
|
|
9
|
+
grid-column-gap: calc(var(--general-spacing-l) * 1px);
|
|
10
|
+
`;
|
|
11
|
+
const UNDEFINED_VALUE = '__null__';
|
|
12
|
+
const DEFAULT_ID_CARD_COLOR = 'rgba(200, 200, 200, 1)';
|
|
13
|
+
export const TreeNodeRemap = ({ currentNode, occurrenceCount, candidateNodes, setAttributeMapping, }) => {
|
|
14
|
+
const { t } = useSharedTranslation();
|
|
15
|
+
const selectOptions = candidateNodes.map(node => ({
|
|
16
|
+
label: node.label,
|
|
17
|
+
value: node.id ?? UNDEFINED_VALUE,
|
|
18
|
+
}));
|
|
19
|
+
const doNotChangeOption = selectOptions[0];
|
|
20
|
+
return (_jsxs(DivContainer, { children: [_jsx(KitIdCard, { title: currentNode.label, color: currentNode.color ?? DEFAULT_ID_CARD_COLOR }), _jsx(KitTypography.Text, { children: t('explorer.massAction.editAttribute_value_occurrences_to_edit', {
|
|
21
|
+
count: occurrenceCount,
|
|
22
|
+
}) }), _jsx(KitSelect, { defaultValue: doNotChangeOption.value, options: selectOptions, size: "middle", allowClear: false, onChange: value => {
|
|
23
|
+
setAttributeMapping({
|
|
24
|
+
before: currentNode.id,
|
|
25
|
+
after: value === UNDEFINED_VALUE ? null : value,
|
|
26
|
+
occurrenceCount,
|
|
27
|
+
});
|
|
28
|
+
} })] }));
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=TreeNodeRemap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeNodeRemap.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/TreeNodeRemap.tsx"],"names":[],"mappings":";AAIA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,SAAS,EAAE,SAAS,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;CAK9B,CAAC;AAEF,MAAM,eAAe,GAAG,UAAU,CAAC;AACnC,MAAM,qBAAqB,GAAG,wBAAwB,CAAC;AAEvD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAC1B,WAAW,EACX,eAAe,EACf,cAAc,EACd,mBAAmB,GAMtB,EAAE,EAAE;IACD,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,aAAa,GAAgD,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3F,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,eAAe;KACpC,CAAC,CAAC,CAAC;IAEJ,MAAM,iBAAiB,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;IAE3C,OAAO,CACH,MAAC,YAAY,eACT,KAAC,SAAS,IAAC,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,IAAI,qBAAqB,GAAI,EAC1F,KAAC,aAAa,CAAC,IAAI,cACd,CAAC,CAAC,6DAA6D,EAAE;oBAC9D,KAAK,EAAE,eAAe;iBACzB,CAAC,GACe,EACrB,KAAC,SAAS,IACN,YAAY,EAAE,iBAAiB,CAAC,KAAK,EACrC,OAAO,EAAE,aAAa,EACtB,IAAI,EAAC,QAAQ,EACb,UAAU,EAAE,KAAK,EACjB,QAAQ,EAAE,KAAK,CAAC,EAAE;oBACd,mBAAmB,CAAC;wBAChB,MAAM,EAAE,WAAW,CAAC,EAAE;wBACtB,KAAK,EAAE,KAAK,KAAK,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;wBAC/C,eAAe;qBAClB,CAAC,CAAC;gBACP,CAAC,GACH,IACS,CAClB,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 ComponentProps} from 'react';\nimport styled from 'styled-components';\nimport {KitIdCard, KitSelect, KitTypography} from 'aristid-ds';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type MassEditTreeNode, type SetAttributeMapping} from './_types';\n\nconst DivContainer = styled.div`\n display: grid;\n align-items: center;\n grid-template-columns: repeat(3, 1fr);\n grid-column-gap: calc(var(--general-spacing-l) * 1px);\n`;\n\nconst UNDEFINED_VALUE = '__null__';\nconst DEFAULT_ID_CARD_COLOR = 'rgba(200, 200, 200, 1)';\n\nexport const TreeNodeRemap = ({\n currentNode,\n occurrenceCount,\n candidateNodes,\n setAttributeMapping,\n}: {\n currentNode: MassEditTreeNode;\n occurrenceCount: number;\n candidateNodes: MassEditTreeNode[];\n setAttributeMapping: SetAttributeMapping;\n}) => {\n const {t} = useSharedTranslation();\n\n const selectOptions: ComponentProps<typeof KitSelect>['options'] = candidateNodes.map(node => ({\n label: node.label,\n value: node.id ?? UNDEFINED_VALUE,\n }));\n\n const doNotChangeOption = selectOptions[0];\n\n return (\n <DivContainer>\n <KitIdCard title={currentNode.label} color={currentNode.color ?? DEFAULT_ID_CARD_COLOR} />\n <KitTypography.Text>\n {t('explorer.massAction.editAttribute_value_occurrences_to_edit', {\n count: occurrenceCount,\n })}\n </KitTypography.Text>\n <KitSelect\n defaultValue={doNotChangeOption.value}\n options={selectOptions}\n size=\"middle\"\n allowClear={false}\n onChange={value => {\n setAttributeMapping({\n before: currentNode.id,\n after: value === UNDEFINED_VALUE ? null : value,\n occurrenceCount,\n });\n }}\n />\n </DivContainer>\n );\n};\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type SystemTranslation } from '../../../../types';
|
|
2
|
+
import { type SaveValueBulkMappingValueInput } from '../../../../_gqlTypes';
|
|
3
|
+
export type MassEditableAttribute = {
|
|
4
|
+
id: string;
|
|
5
|
+
label?: SystemTranslation;
|
|
6
|
+
dependencies: Array<{
|
|
7
|
+
id: string;
|
|
8
|
+
label?: SystemTranslation;
|
|
9
|
+
}>;
|
|
10
|
+
hasEmptyDependency: boolean;
|
|
11
|
+
isSimpleWorkflow: boolean;
|
|
12
|
+
isMonoDependencyWorkflow: boolean;
|
|
13
|
+
treeNodes: MassEditTreeNode[];
|
|
14
|
+
};
|
|
15
|
+
export type MassEditTreeNode = {
|
|
16
|
+
id: string | null;
|
|
17
|
+
label: string;
|
|
18
|
+
color?: string | null;
|
|
19
|
+
allowedDependentNodeIds?: string[];
|
|
20
|
+
};
|
|
21
|
+
export type SetAttributeMapping = (mapping: SaveValueBulkMappingValueInput & {
|
|
22
|
+
occurrenceCount: number;
|
|
23
|
+
}) => void;
|
|
@@ -0,0 +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 treeNodes: MassEditTreeNode[];\n};\n\nexport type MassEditTreeNode = {\n id: string | null;\n label: string;\n color?: string | null;\n allowedDependentNodeIds?: string[];\n};\n\nexport type SetAttributeMapping = (mapping: SaveValueBulkMappingValueInput & {occurrenceCount: number}) => void;\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 { useMassEditableAttributesQuery } from '../../../../_gqlTypes';
|
|
5
|
+
import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
|
|
6
|
+
export const useMassEditableAttributes = ({ libraryId }) => {
|
|
7
|
+
const { t } = useSharedTranslation();
|
|
8
|
+
const { data } = useMassEditableAttributesQuery({
|
|
9
|
+
variables: { libraryId },
|
|
10
|
+
skip: libraryId.length === 0,
|
|
11
|
+
});
|
|
12
|
+
return (data?.attributes?.list
|
|
13
|
+
.map(treeAttribute => {
|
|
14
|
+
let dependencies = [];
|
|
15
|
+
if ('permissions_conf_dependent_values' in treeAttribute) {
|
|
16
|
+
dependencies = treeAttribute.permissions_conf_dependent_values?.dependenciesTreeAttributes ?? [];
|
|
17
|
+
}
|
|
18
|
+
const hasEmptyDependency = dependencies.length === 0;
|
|
19
|
+
const isSimpleWorkflow = dependencies.length === 1 && dependencies[0].id === treeAttribute.id;
|
|
20
|
+
const isMonoDependencyWorkflow = dependencies.length === 2 &&
|
|
21
|
+
dependencies.filter(attribute => attribute.id === treeAttribute.id).length === 1;
|
|
22
|
+
let treeNodes = [];
|
|
23
|
+
if ('tree_values' in treeAttribute) {
|
|
24
|
+
treeNodes =
|
|
25
|
+
treeAttribute.tree_values?.map(treeValue => ({
|
|
26
|
+
id: treeValue.node?.id ?? null,
|
|
27
|
+
label: treeValue.node?.record.whoAmI.label ??
|
|
28
|
+
treeValue.node?.record.id ??
|
|
29
|
+
t('explorer.massAction.editAttribute_value_undefined'),
|
|
30
|
+
color: treeValue.node?.record.whoAmI.color,
|
|
31
|
+
allowedDependentNodeIds: treeValue.allowedDependentValues?.map(({ nodeId }) => nodeId) ?? [],
|
|
32
|
+
})) ?? [];
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
id: treeAttribute.id,
|
|
36
|
+
label: treeAttribute.label,
|
|
37
|
+
dependencies,
|
|
38
|
+
hasEmptyDependency,
|
|
39
|
+
isSimpleWorkflow,
|
|
40
|
+
isMonoDependencyWorkflow,
|
|
41
|
+
treeNodes,
|
|
42
|
+
};
|
|
43
|
+
})
|
|
44
|
+
.filter(({ hasEmptyDependency, isSimpleWorkflow, isMonoDependencyWorkflow }) => hasEmptyDependency || isSimpleWorkflow /*|| isMonoDependencyWorkflow*/) ?? []);
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=useMassEditableAttributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMassEditableAttributes.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/useMassEditableAttributes.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,8BAA8B,EAAC,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EAAC,SAAS,EAAsB,EAA2B,EAAE;IACnG,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,EAAC,IAAI,EAAC,GAAG,8BAA8B,CAAC;QAC1C,SAAS,EAAE,EAAC,SAAS,EAAC;QACtB,IAAI,EAAE,SAAS,CAAC,MAAM,KAAK,CAAC;KAC/B,CAAC,CAAC;IAEH,OAAO,CACH,IAAI,EAAE,UAAU,EAAE,IAAI;SACjB,GAAG,CAAC,aAAa,CAAC,EAAE;QACjB,IAAI,YAAY,GAA0C,EAAE,CAAC;QAC7D,IAAI,mCAAmC,IAAI,aAAa,EAAE,CAAC;YACvD,YAAY,GAAG,aAAa,CAAC,iCAAiC,EAAE,0BAA0B,IAAI,EAAE,CAAC;QACrG,CAAC;QAED,MAAM,kBAAkB,GAAG,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC;QACrD,MAAM,gBAAgB,GAAG,YAAY,CAAC,MAAM,KAAK,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,aAAa,CAAC,EAAE,CAAC;QAC9F,MAAM,wBAAwB,GAC1B,YAAY,CAAC,MAAM,KAAK,CAAC;YACzB,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,aAAa,CAAC,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;QAErF,IAAI,SAAS,GAAuC,EAAE,CAAC;QACvD,IAAI,aAAa,IAAI,aAAa,EAAE,CAAC;YACjC,SAAS;gBACL,aAAa,CAAC,WAAW,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;oBACzC,EAAE,EAAE,SAAS,CAAC,IAAI,EAAE,EAAE,IAAI,IAAI;oBAC9B,KAAK,EACD,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;wBACnC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE;wBACzB,CAAC,CAAC,mDAAmD,CAAC;oBAC1D,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;oBAC1C,uBAAuB,EAAE,SAAS,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,MAAO,CAAC,IAAI,EAAE;iBAC9F,CAAC,CAAC,IAAI,EAAE,CAAC;QAClB,CAAC;QAED,OAAO;YACH,EAAE,EAAE,aAAa,CAAC,EAAE;YACpB,KAAK,EAAE,aAAa,CAAC,KAAK;YAC1B,YAAY;YACZ,kBAAkB;YAClB,gBAAgB;YAChB,wBAAwB;YACxB,SAAS;SACZ,CAAC;IACN,CAAC,CAAC;SACD,MAAM,CACH,CAAC,EAAC,kBAAkB,EAAE,gBAAgB,EAAE,wBAAwB,EAAC,EAAE,EAAE,CACjE,kBAAkB,IAAI,gBAAgB,CAAC,+BAA+B,CAC7E,IAAI,EAAE,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 {useMassEditableAttributesQuery} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type MassEditableAttribute} from './_types';\n\nexport const useMassEditableAttributes = ({libraryId}: {libraryId: string}): MassEditableAttribute[] => {\n const {t} = useSharedTranslation();\n\n const {data} = useMassEditableAttributesQuery({\n variables: {libraryId},\n skip: libraryId.length === 0,\n });\n\n return (\n data?.attributes?.list\n .map(treeAttribute => {\n let dependencies: MassEditableAttribute['dependencies'] = [];\n if ('permissions_conf_dependent_values' in treeAttribute) {\n dependencies = treeAttribute.permissions_conf_dependent_values?.dependenciesTreeAttributes ?? [];\n }\n\n const hasEmptyDependency = dependencies.length === 0;\n const isSimpleWorkflow = dependencies.length === 1 && dependencies[0].id === treeAttribute.id;\n const isMonoDependencyWorkflow =\n dependencies.length === 2 &&\n dependencies.filter(attribute => attribute.id === treeAttribute.id).length === 1;\n\n let treeNodes: MassEditableAttribute['treeNodes'] = [];\n if ('tree_values' in treeAttribute) {\n treeNodes =\n treeAttribute.tree_values?.map(treeValue => ({\n id: treeValue.node?.id ?? null,\n label:\n treeValue.node?.record.whoAmI.label ??\n treeValue.node?.record.id ??\n t('explorer.massAction.editAttribute_value_undefined'),\n color: treeValue.node?.record.whoAmI.color,\n allowedDependentNodeIds: treeValue.allowedDependentValues?.map(({nodeId}) => nodeId!) ?? [],\n })) ?? [];\n }\n\n return {\n id: treeAttribute.id,\n label: treeAttribute.label,\n dependencies,\n hasEmptyDependency,\n isSimpleWorkflow,\n isMonoDependencyWorkflow,\n treeNodes,\n };\n })\n .filter(\n ({hasEmptyDependency, isSimpleWorkflow, isMonoDependencyWorkflow}) =>\n hasEmptyDependency || isSimpleWorkflow /*|| isMonoDependencyWorkflow*/,\n ) ?? []\n );\n};\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type MassEditTreeNode } from './_types';
|
|
2
|
+
export declare const useTreeNodeRemapping: ({ distribution, editableNodes, }: {
|
|
3
|
+
distribution: Array<{
|
|
4
|
+
count: number;
|
|
5
|
+
treeNodeId: string;
|
|
6
|
+
}>;
|
|
7
|
+
editableNodes: MassEditTreeNode[];
|
|
8
|
+
}) => Array<{
|
|
9
|
+
currentNode: MassEditTreeNode;
|
|
10
|
+
occurrenceCount: number;
|
|
11
|
+
candidateNodes: MassEditTreeNode[];
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
|
|
5
|
+
export const useTreeNodeRemapping = ({ distribution, editableNodes, }) => {
|
|
6
|
+
const { t } = useSharedTranslation();
|
|
7
|
+
return distribution.map(occurrence => {
|
|
8
|
+
const currentNode = editableNodes.find(({ id }) => id === occurrence.treeNodeId);
|
|
9
|
+
const filteredCandidates = editableNodes
|
|
10
|
+
.filter(({ id }) => id !== currentNode.id)
|
|
11
|
+
.filter(candidate => currentNode.allowedDependentNodeIds &&
|
|
12
|
+
(currentNode.allowedDependentNodeIds.length === 0 ||
|
|
13
|
+
currentNode.allowedDependentNodeIds.includes(candidate.id)));
|
|
14
|
+
return {
|
|
15
|
+
currentNode,
|
|
16
|
+
occurrenceCount: occurrence.count,
|
|
17
|
+
candidateNodes: [
|
|
18
|
+
{ id: occurrence.treeNodeId, label: t('explorer.massAction.editAttribute_value_do_not_change') },
|
|
19
|
+
...filteredCandidates,
|
|
20
|
+
],
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=useTreeNodeRemapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTreeNodeRemapping.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/useTreeNodeRemapping.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACjC,YAAY,EACZ,aAAa,GAIhB,EAIE,EAAE;IACD,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,OAAO,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;QACjC,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,EAAC,EAAE,EAAC,EAAE,EAAE,CAAC,EAAE,KAAK,UAAU,CAAC,UAAU,CAAE,CAAC;QAEhF,MAAM,kBAAkB,GAAG,aAAa;aACnC,MAAM,CAAC,CAAC,EAAC,EAAE,EAAC,EAAE,EAAE,CAAC,EAAE,KAAK,WAAW,CAAC,EAAE,CAAC;aACvC,MAAM,CACH,SAAS,CAAC,EAAE,CACR,WAAW,CAAC,uBAAuB;YACnC,CAAC,WAAW,CAAC,uBAAuB,CAAC,MAAM,KAAK,CAAC;gBAC7C,WAAW,CAAC,uBAAuB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAG,CAAC,CAAC,CACvE,CAAC;QAEN,OAAO;YACH,WAAW;YACX,eAAe,EAAE,UAAU,CAAC,KAAK;YACjC,cAAc,EAAE;gBACZ,EAAC,EAAE,EAAE,UAAU,CAAC,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,uDAAuD,CAAC,EAAC;gBAC9F,GAAG,kBAAkB;aACxB;SACJ,CAAC;IACN,CAAC,CAAC,CAAC;AACP,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 {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type MassEditTreeNode} from './_types';\n\nexport const useTreeNodeRemapping = ({\n distribution,\n editableNodes,\n}: {\n distribution: Array<{count: number; treeNodeId: string}>;\n editableNodes: MassEditTreeNode[];\n}): Array<{\n currentNode: MassEditTreeNode;\n occurrenceCount: number;\n candidateNodes: MassEditTreeNode[];\n}> => {\n const {t} = useSharedTranslation();\n\n return distribution.map(occurrence => {\n const currentNode = editableNodes.find(({id}) => id === occurrence.treeNodeId)!;\n\n const filteredCandidates = editableNodes\n .filter(({id}) => id !== currentNode.id)\n .filter(\n candidate =>\n currentNode.allowedDependentNodeIds &&\n (currentNode.allowedDependentNodeIds.length === 0 ||\n currentNode.allowedDependentNodeIds.includes(candidate.id!)),\n );\n\n return {\n currentNode,\n occurrenceCount: occurrence.count,\n candidateNodes: [\n {id: occurrence.treeNodeId, label: t('explorer.massAction.editAttribute_value_do_not_change')},\n ...filteredCandidates,\n ],\n };\n });\n};\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type RecordFilterInput } from '../../../../_gqlTypes';
|
|
2
|
+
export declare const useValuesDistribution: ({ attributeId, libraryId, recordFilters, }: {
|
|
3
|
+
attributeId: string;
|
|
4
|
+
libraryId: string;
|
|
5
|
+
recordFilters: RecordFilterInput[];
|
|
6
|
+
}) => {
|
|
7
|
+
noValueCount: number;
|
|
8
|
+
distribution: Array<{
|
|
9
|
+
count: number;
|
|
10
|
+
treeNodeId: string;
|
|
11
|
+
}>;
|
|
12
|
+
loading: boolean;
|
|
13
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { useValuesOccurrencesQuery } from '../../../../_gqlTypes';
|
|
5
|
+
export const useValuesDistribution = ({ attributeId, libraryId, recordFilters, }) => {
|
|
6
|
+
const { data: valuesOccurrences, loading } = useValuesOccurrencesQuery({
|
|
7
|
+
variables: {
|
|
8
|
+
attributeId,
|
|
9
|
+
libraryId,
|
|
10
|
+
recordFilters,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
const noValueCount = valuesOccurrences?.listDistinctValues?.find(treeOccurrence => !('treeNode' in treeOccurrence && treeOccurrence.treeNode))?.count ?? 0;
|
|
14
|
+
const distribution = valuesOccurrences?.listDistinctValues
|
|
15
|
+
?.map(treeOccurrence => 'treeNode' in treeOccurrence && treeOccurrence.treeNode
|
|
16
|
+
? {
|
|
17
|
+
count: treeOccurrence.count,
|
|
18
|
+
treeNodeId: treeOccurrence.treeNode.id,
|
|
19
|
+
}
|
|
20
|
+
: null)
|
|
21
|
+
.filter(Boolean) ?? [];
|
|
22
|
+
return {
|
|
23
|
+
distribution,
|
|
24
|
+
noValueCount,
|
|
25
|
+
loading,
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=useValuesDistribution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useValuesDistribution.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/actions-mass/edit-attribute/useValuesDistribution.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,yBAAyB,EAAC,MAAM,eAAe,CAAC;AAEhF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EAClC,WAAW,EACX,SAAS,EACT,aAAa,GAKhB,EAOC,EAAE;IACA,MAAM,EAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAC,GAAG,yBAAyB,CAAC;QACjE,SAAS,EAAE;YACP,WAAW;YACX,SAAS;YACT,aAAa;SAChB;KACJ,CAAC,CAAC;IAEH,MAAM,YAAY,GACd,iBAAiB,EAAE,kBAAkB,EAAE,IAAI,CACvC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,IAAI,cAAc,IAAI,cAAc,CAAC,QAAQ,CAAC,CAC/E,EAAE,KAAK,IAAI,CAAC,CAAC;IAElB,MAAM,YAAY,GACd,iBAAiB,EAAE,kBAAkB;QACjC,EAAE,GAAG,CAAC,cAAc,CAAC,EAAE,CACnB,UAAU,IAAI,cAAc,IAAI,cAAc,CAAC,QAAQ;QACnD,CAAC,CAAC;YACI,KAAK,EAAE,cAAc,CAAC,KAAK;YAC3B,UAAU,EAAE,cAAc,CAAC,QAAQ,CAAC,EAAE;SACzC;QACH,CAAC,CAAC,IAAI,CACb;SACA,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IAE/B,OAAO;QACH,YAAY;QACZ,YAAY;QACZ,OAAO;KACV,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, useValuesOccurrencesQuery} from '_ui/_gqlTypes';\n\nexport const useValuesDistribution = ({\n attributeId,\n libraryId,\n recordFilters,\n}: {\n attributeId: string;\n libraryId: string;\n recordFilters: RecordFilterInput[];\n}): {\n noValueCount: number;\n distribution: Array<{\n count: number;\n treeNodeId: string;\n }>;\n loading: boolean;\n} => {\n const {data: valuesOccurrences, loading} = useValuesOccurrencesQuery({\n variables: {\n attributeId,\n libraryId,\n recordFilters,\n },\n });\n\n const noValueCount =\n valuesOccurrences?.listDistinctValues?.find(\n treeOccurrence => !('treeNode' in treeOccurrence && treeOccurrence.treeNode),\n )?.count ?? 0;\n\n const distribution =\n valuesOccurrences?.listDistinctValues\n ?.map(treeOccurrence =>\n 'treeNode' in treeOccurrence && treeOccurrence.treeNode\n ? {\n count: treeOccurrence.count,\n treeNodeId: treeOccurrence.treeNode.id,\n }\n : null,\n )\n .filter(Boolean) ?? [];\n\n return {\n distribution,\n noValueCount,\n loading,\n };\n};\n"]}
|
|
@@ -3,12 +3,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
// This file is released under LGPL V3
|
|
4
4
|
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
|
-
import { KitAlert
|
|
6
|
+
import { KitAlert } from 'aristid-ds';
|
|
7
7
|
import { useDeactivateRecordsMutation } from '../../../_gqlTypes';
|
|
8
8
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
9
|
+
import { useConfirmModal } from '../../../hooks/useConfirmModal';
|
|
9
10
|
import { ViewSettingsActionTypes } from '../manage-view-settings';
|
|
10
|
-
import {
|
|
11
|
-
import { SUCCESS_ALERT_DURATION } from '../../../constants';
|
|
11
|
+
import { MASS_SELECTION_ALL } from '../_constants';
|
|
12
|
+
import { SUCCESS_ALERT_DURATION, BREAK_TWO_LINES } from '../../../constants';
|
|
12
13
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
13
14
|
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
|
14
15
|
/**
|
|
@@ -26,17 +27,14 @@ import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
|
|
26
27
|
*/
|
|
27
28
|
export const useDeactivateMassAction = ({ isEnabled, store: { view, dispatch }, allVisibleKeys, totalCount, onDeactivate, refetch, }) => {
|
|
28
29
|
const { t } = useSharedTranslation();
|
|
30
|
+
const { openConfirmModal } = useConfirmModal();
|
|
29
31
|
const [deactivateRecordsMutation] = useDeactivateRecordsMutation();
|
|
30
32
|
const _deactivateMassAction = useMemo(() => ({
|
|
31
33
|
label: t('explorer.massAction.deactivate'),
|
|
32
34
|
icon: _jsx(FontAwesomeIcon, { icon: faTrash }),
|
|
33
35
|
deselectAll: true,
|
|
34
36
|
callback: massSelectionFilter => {
|
|
35
|
-
|
|
36
|
-
width: '100%',
|
|
37
|
-
style: { content: { width: '90vw', maxWidth: '656px' } },
|
|
38
|
-
type: 'confirm',
|
|
39
|
-
icon: false,
|
|
37
|
+
openConfirmModal({
|
|
40
38
|
title: t('explorer.deactivate_item', {
|
|
41
39
|
count: view.massSelection === MASS_SELECTION_ALL ? Infinity : view.massSelection.length,
|
|
42
40
|
}) ?? undefined,
|
|
@@ -45,8 +43,6 @@ export const useDeactivateMassAction = ({ isEnabled, store: { view, dispatch },
|
|
|
45
43
|
}) +
|
|
46
44
|
BREAK_TWO_LINES +
|
|
47
45
|
t('global.are_you_sure'),
|
|
48
|
-
okText: t('global.confirm') ?? undefined,
|
|
49
|
-
cancelText: t('global.cancel') ?? undefined,
|
|
50
46
|
onOk: async () => {
|
|
51
47
|
const { data } = await deactivateRecordsMutation({
|
|
52
48
|
variables: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeactivateMassAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/useDeactivateMassAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAgB,OAAO,EAAC,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"useDeactivateMassAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/useDeactivateMassAction.tsx"],"names":[],"mappings":"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","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type Dispatch, useMemo} from 'react';\nimport {KitAlert} from 'aristid-ds';\nimport {useDeactivateRecordsMutation} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {useConfirmModal} from '_ui/hooks/useConfirmModal';\nimport {type FeatureHook, type IMassActions} from '../_types';\nimport {type IViewSettingsAction, type IViewSettingsState, ViewSettingsActionTypes} from '../manage-view-settings';\nimport {MASS_SELECTION_ALL} from '../_constants';\nimport {type useExplorerData} from '../_queries/useExplorerData';\nimport {SUCCESS_ALERT_DURATION, BREAK_TWO_LINES} from '_ui/constants';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faTrash} from '@fortawesome/free-solid-svg-icons';\n\n/**\n * Hook used to get the action for mass actions only available on selection.\n *\n * When the mutation for deactivation is done, the Apollo cache will be clean (`Record` and `RecordIdentity`)\n * from deactivated record.\n *\n * @param isEnabled - whether the action is present\n * @param view - represent the current view\n * @param dispatch - method to change the current view\n * @param libraryId - concerned library\n * @param allVisibleKeys - list of all visible keys used to know if we need to change page\n * @param refetch - method to get fresh data when we delete last page\n */\nexport const useDeactivateMassAction = ({\n isEnabled,\n store: {view, dispatch},\n allVisibleKeys,\n totalCount,\n onDeactivate,\n refetch,\n}: FeatureHook<{\n store: {\n view: IViewSettingsState;\n dispatch: Dispatch<IViewSettingsAction>;\n };\n allVisibleKeys: string[];\n totalCount: number;\n onDeactivate?: IMassActions['callback'];\n refetch: ReturnType<typeof useExplorerData>['refetch'];\n}>) => {\n const {t} = useSharedTranslation();\n const {openConfirmModal} = useConfirmModal();\n\n const [deactivateRecordsMutation] = useDeactivateRecordsMutation();\n\n const _deactivateMassAction: IMassActions = useMemo(\n () => ({\n label: t('explorer.massAction.deactivate'),\n icon: <FontAwesomeIcon icon={faTrash} />,\n deselectAll: true,\n callback: massSelectionFilter => {\n openConfirmModal({\n title:\n t('explorer.deactivate_item', {\n count: view.massSelection === MASS_SELECTION_ALL ? Infinity : view.massSelection.length,\n }) ?? undefined,\n content:\n t('explorer.deactivate_item_description', {\n count: view.massSelection === MASS_SELECTION_ALL ? Infinity : view.massSelection.length,\n }) +\n BREAK_TWO_LINES +\n t('global.are_you_sure'),\n onOk: async () => {\n const {data} = await deactivateRecordsMutation({\n variables: {\n libraryId: view.libraryId,\n filters: massSelectionFilter,\n },\n });\n const total =\n view.massSelection === MASS_SELECTION_ALL ? totalCount : view.massSelection.length;\n KitAlert.success({\n showIcon: true,\n duration: SUCCESS_ALERT_DURATION,\n message: t('explorer.massAction.deactivate_message'),\n description: t('explorer.massAction.deactivate_description', {\n count: data?.deactivateRecords.length,\n total,\n }),\n closable: true,\n });\n if (\n view.massSelection === MASS_SELECTION_ALL ||\n allVisibleKeys.every(key => view.massSelection.includes(key))\n ) {\n await refetch({\n pagination: {\n limit: view.pageSize,\n offset: 0,\n },\n });\n } else {\n await refetch();\n }\n onDeactivate?.(massSelectionFilter, view.massSelection);\n dispatch({\n type: ViewSettingsActionTypes.SET_SELECTED_KEYS,\n payload: [],\n });\n },\n });\n },\n }),\n [t, deactivateRecordsMutation, view.massSelection, dispatch, view.libraryId, allVisibleKeys, refetch],\n );\n\n return {\n deactivateMassAction: isEnabled ? _deactivateMassAction : null,\n };\n};\n"]}
|
|
@@ -7,12 +7,14 @@ import { ViewSettingsActionTypes } from '../manage-view-settings';
|
|
|
7
7
|
import { useMemo } from 'react';
|
|
8
8
|
import { useExplorerData } from '../_queries/useExplorerData';
|
|
9
9
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { useConfirmModal } from '../../../hooks/useConfirmModal';
|
|
11
|
+
import { MASS_SELECTION_ALL } from '../_constants';
|
|
12
|
+
import { BREAK_TWO_LINES } from '../../../constants';
|
|
12
13
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
13
14
|
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
|
14
15
|
export const useDeleteLinkValues = ({ isEnabled, store: { view, dispatch }, filtersStore: { filters, filtersOperator }, pagination, allVisibleKeys, onDelete, refetch, }) => {
|
|
15
16
|
const { t } = useSharedTranslation();
|
|
17
|
+
const { openConfirmModal } = useConfirmModal();
|
|
16
18
|
const { saveValues } = useSaveValueBatchMutation();
|
|
17
19
|
const isLink = view.entrypoint.type === 'link';
|
|
18
20
|
const { data: linkData, canEditLinkAttributeValues: canUnlinkValues } = useExplorerData({
|
|
@@ -31,11 +33,7 @@ export const useDeleteLinkValues = ({ isEnabled, store: { view, dispatch }, filt
|
|
|
31
33
|
icon: _jsx(FontAwesomeIcon, { icon: faTrash }),
|
|
32
34
|
deselectAll: true,
|
|
33
35
|
callback: massSelectionFilter => {
|
|
34
|
-
|
|
35
|
-
width: '100%',
|
|
36
|
-
style: { content: { width: '90vw', maxWidth: '656px' } },
|
|
37
|
-
type: 'confirm',
|
|
38
|
-
icon: false,
|
|
36
|
+
openConfirmModal({
|
|
39
37
|
title: t('explorer.delete_link', {
|
|
40
38
|
count: view.massSelection === MASS_SELECTION_ALL ? Infinity : view.massSelection.length,
|
|
41
39
|
}) ?? undefined,
|
|
@@ -45,7 +43,6 @@ export const useDeleteLinkValues = ({ isEnabled, store: { view, dispatch }, filt
|
|
|
45
43
|
BREAK_TWO_LINES +
|
|
46
44
|
t('global.are_you_sure'),
|
|
47
45
|
okText: t('global.submit') ?? undefined,
|
|
48
|
-
cancelText: t('global.cancel') ?? undefined,
|
|
49
46
|
onOk: async () => {
|
|
50
47
|
const entrypoint = view.entrypoint;
|
|
51
48
|
let values;
|