@leav/ui 0.3.6-530c9f4 → 0.3.6-54b6589
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 +143 -5
- package/dist/_gqlTypes/index.js +65 -3
- package/dist/_gqlTypes/index.js.map +1 -1
- package/dist/components/CreateDirectory/CreateDirectory.js +0 -2
- package/dist/components/CreateDirectory/CreateDirectory.js.map +1 -1
- package/dist/components/Explorer/DataView.d.ts +2 -0
- package/dist/components/Explorer/DataView.js +7 -3
- package/dist/components/Explorer/DataView.js.map +1 -1
- package/dist/components/Explorer/Explorer.d.ts +33 -2
- package/dist/components/Explorer/Explorer.js +52 -17
- package/dist/components/Explorer/Explorer.js.map +1 -1
- package/dist/components/Explorer/ExplorerToolbar.d.ts +1 -0
- package/dist/components/Explorer/ExplorerToolbar.js +8 -4
- package/dist/components/Explorer/ExplorerToolbar.js.map +1 -1
- package/dist/components/Explorer/TableCell.js +1 -1
- package/dist/components/Explorer/TableCell.js.map +1 -1
- package/dist/components/Explorer/_queries/useExecuteUpdateViewMutation.d.ts +6 -0
- package/dist/components/Explorer/_queries/useExecuteUpdateViewMutation.js +12 -0
- package/dist/components/Explorer/_queries/useExecuteUpdateViewMutation.js.map +1 -0
- package/dist/components/Explorer/_queries/useExplorerData.d.ts +1 -0
- package/dist/components/Explorer/_queries/useExplorerData.js +9 -1
- package/dist/components/Explorer/_queries/useExplorerData.js.map +1 -1
- package/dist/components/Explorer/_types.d.ts +5 -2
- package/dist/components/Explorer/_types.js.map +1 -1
- package/dist/components/Explorer/actions-item/useEditItemAction.d.ts +4 -1
- package/dist/components/Explorer/actions-item/useEditItemAction.js +3 -2
- package/dist/components/Explorer/actions-item/useEditItemAction.js.map +1 -1
- package/dist/components/Explorer/actions-item/useRemoveItemAction.d.ts +2 -1
- package/dist/components/Explorer/actions-item/useRemoveItemAction.js +9 -5
- package/dist/components/Explorer/actions-item/useRemoveItemAction.js.map +1 -1
- package/dist/components/Explorer/actions-mass/useDeactivateMassAction.d.ts +2 -1
- package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js +2 -1
- package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js.map +1 -1
- package/dist/components/Explorer/actions-mass/useDeleteLinkValues.d.ts +19 -0
- package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js +85 -0
- package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js.map +1 -0
- package/dist/components/Explorer/actions-mass/useMassActions.d.ts +1 -2
- package/dist/components/Explorer/actions-mass/useMassActions.js +1 -1
- package/dist/components/Explorer/actions-mass/useMassActions.js.map +1 -1
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.d.ts +10 -2
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js +64 -25
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js.map +1 -1
- package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.d.ts +4 -1
- package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js +3 -2
- package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js.map +1 -1
- package/dist/components/Explorer/actions-primary/usePrimaryActions.d.ts +7 -2
- package/dist/components/Explorer/actions-primary/usePrimaryActions.js +6 -4
- package/dist/components/Explorer/actions-primary/usePrimaryActions.js.map +1 -1
- package/dist/components/Explorer/link-item/LinkModal.d.ts +4 -2
- package/dist/components/Explorer/link-item/LinkModal.js +14 -64
- package/dist/components/Explorer/link-item/LinkModal.js.map +1 -1
- package/dist/components/Explorer/link-item/useLinkMassAction.d.ts +10 -13
- package/dist/components/Explorer/link-item/useLinkMassAction.js +8 -31
- package/dist/components/Explorer/link-item/useLinkMassAction.js.map +1 -1
- package/dist/components/Explorer/list-saved-views/SavedViews.js +63 -39
- package/dist/components/Explorer/list-saved-views/SavedViews.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropDown.js +1 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropDown.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js +5 -3
- package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.d.ts +9 -0
- package/dist/components/Explorer/manage-view-settings/save-view/{SaveViewModal.js → LabelViewFormModal.js} +14 -18
- package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/save-view/ViewActionsButtons.js +4 -6
- package/dist/components/Explorer/manage-view-settings/save-view/ViewActionsButtons.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js +3 -2
- package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/useShareView.d.ts +3 -0
- package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js +64 -0
- package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js.map +1 -0
- package/dist/components/Explorer/manage-view-settings/save-view/useUpdateView.js +30 -13
- package/dist/components/Explorer/manage-view-settings/save-view/useUpdateView.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.d.ts +12 -6
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js +11 -2
- package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js.map +1 -1
- package/dist/components/Explorer/useLoadView.js +3 -1
- package/dist/components/Explorer/useLoadView.js.map +1 -1
- package/dist/components/Explorer/useSearchInput.js +2 -1
- package/dist/components/Explorer/useSearchInput.js.map +1 -1
- package/dist/components/Explorer/useViewSettingsReducer.js +4 -5
- package/dist/components/Explorer/useViewSettingsReducer.js.map +1 -1
- package/dist/components/RecordEdition/EditRecord/EditRecord.d.ts +1 -0
- package/dist/components/RecordEdition/EditRecord/EditRecord.js +2 -2
- package/dist/components/RecordEdition/EditRecord/EditRecord.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.d.ts +1 -0
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js +11 -4
- package/dist/components/RecordEdition/EditRecordContent/EditRecordContent.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/hooks/useExecuteSaveValueBatchMutation.js +3 -8
- package/dist/components/RecordEdition/EditRecordContent/hooks/useExecuteSaveValueBatchMutation.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.js +2 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Container/Container.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/FormTabs/FormTabs.js +5 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/FormTabs/FormTabs.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/Frame.d.ts +4 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/Frame.js +25 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/Frame.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/index.d.ts +2 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/index.js +6 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/Frame/index.js.map +1 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +4 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/useGetPresentationValues.js +2 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/useGetPresentationValues.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/index.js +3 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/index.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.d.ts +2 -0
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js +3 -2
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.d.ts +2 -0
- package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.js +3 -2
- package/dist/components/RecordEdition/EditRecordPage/EditRecordPage.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js +19 -11
- package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js.map +1 -1
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.d.ts +13 -0
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js +81 -0
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js.map +1 -0
- package/dist/components/SelectRecordForLinkModal/index.d.ts +1 -0
- package/dist/components/SelectRecordForLinkModal/index.js +5 -0
- package/dist/components/SelectRecordForLinkModal/index.js.map +1 -0
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.js +2 -1
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.js.map +1 -1
- package/dist/locales/en/shared.json +8 -1
- package/dist/locales/fr/shared.json +10 -3
- package/package.json +3 -3
- package/dist/components/Explorer/manage-view-settings/save-view/SaveViewModal.d.ts +0 -8
- package/dist/components/Explorer/manage-view-settings/save-view/SaveViewModal.js.map +0 -1
|
@@ -1,57 +1,34 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
|
|
3
2
|
// This file is released under LGPL V3
|
|
4
3
|
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
5
|
-
import { useMemo } from 'react';
|
|
6
|
-
import { FaTrash } from 'react-icons/fa';
|
|
7
|
-
import { useExplorerSelectionIdsLazyQuery } from '../../../_gqlTypes';
|
|
8
|
-
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
9
4
|
import useSaveValueBatchMutation from '../../../components/RecordEdition/EditRecordContent/hooks/useExecuteSaveValueBatchMutation';
|
|
10
5
|
/**
|
|
11
6
|
* Hook used to link records
|
|
12
7
|
*
|
|
13
|
-
* @param isEnabled - whether the action is present
|
|
14
8
|
* @param view - represent the current view
|
|
15
|
-
* @param
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
* @param closeModal
|
|
9
|
+
* @param linkAttributeId - attribute that represent the link
|
|
10
|
+
* @param onLink - callback to let outside world know about linking feedback
|
|
11
|
+
* @param closeModal - callback to close the link modal
|
|
19
12
|
*/
|
|
20
|
-
export const useLinkMassAction = ({
|
|
21
|
-
const { t } = useSharedTranslation();
|
|
13
|
+
export const useLinkMassAction = ({ store: { view }, linkAttributeId, onLink, closeModal }) => {
|
|
22
14
|
const { saveValues } = useSaveValueBatchMutation();
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
onCompleted: data => {
|
|
15
|
+
return {
|
|
16
|
+
createLinks: async (data) => {
|
|
26
17
|
const entrypoint = view.entrypoint;
|
|
27
18
|
const values = data.records.list.map(({ id }) => ({
|
|
28
19
|
attribute: linkAttributeId,
|
|
29
20
|
idValue: null,
|
|
30
21
|
value: id
|
|
31
22
|
}));
|
|
32
|
-
saveValues({
|
|
23
|
+
const saveValuesResult = await saveValues({
|
|
33
24
|
id: entrypoint.parentRecordId,
|
|
34
25
|
library: {
|
|
35
26
|
id: entrypoint.parentLibraryId
|
|
36
27
|
}
|
|
37
28
|
}, values);
|
|
29
|
+
onLink?.(saveValuesResult);
|
|
38
30
|
closeModal();
|
|
39
31
|
}
|
|
40
|
-
});
|
|
41
|
-
const _addLinkMassAction = useMemo(() => ({
|
|
42
|
-
label: t('explorer.massAction.add-link'),
|
|
43
|
-
icon: _jsx(FaTrash, {}),
|
|
44
|
-
callback: massSelectionFilter => {
|
|
45
|
-
fetch({
|
|
46
|
-
variables: {
|
|
47
|
-
libraryId,
|
|
48
|
-
filters: massSelectionFilter
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}), [t, fetch, view.massSelection, dispatch, libraryId]);
|
|
53
|
-
return {
|
|
54
|
-
addLinkMassAction: isEnabled ? _addLinkMassAction : null
|
|
55
32
|
};
|
|
56
33
|
};
|
|
57
34
|
//# sourceMappingURL=useLinkMassAction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLinkMassAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/link-item/useLinkMassAction.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLinkMassAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/link-item/useLinkMassAction.tsx"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,yBAAyB,MAAM,uFAAuF,CAAC;AAM9H;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAC9B,KAAK,EAAE,EAAC,IAAI,EAAC,EACb,eAAe,EACf,MAAM,EACN,UAAU,EAQb,EAAE,EAAE;IACD,MAAM,EAAC,UAAU,EAAC,GAAG,yBAAyB,EAAE,CAAC;IAEjD,OAAO;QACH,WAAW,EAAE,KAAK,EAAE,IAA+B,EAAE,EAAE;YACnD,MAAM,UAAU,GAAG,IAAI,CAAC,UAA6B,CAAC;YACtD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAC,EAAE,EAAC,EAAE,EAAE,CAAC,CAAC;gBAC5C,SAAS,EAAE,eAAe;gBAC1B,OAAO,EAAE,IAAI;gBACb,KAAK,EAAE,EAAE;aACZ,CAAC,CAAC,CAAC;YAEJ,MAAM,gBAAgB,GAAG,MAAM,UAAU,CACrC;gBACI,EAAE,EAAE,UAAU,CAAC,cAAc;gBAC7B,OAAO,EAAE;oBACL,EAAE,EAAE,UAAU,CAAC,eAAe;iBACjC;aACJ,EACD,MAAM,CACT,CAAC;YACF,MAAM,EAAE,CAAC,gBAAgB,CAAC,CAAC;YAC3B,UAAU,EAAE,CAAC;QACjB,CAAC;KACJ,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,74 +1,98 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
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
|
+
import { useEffect, useState } from 'react';
|
|
2
6
|
import styled from 'styled-components';
|
|
3
|
-
import { KitTypography } from 'aristid-ds';
|
|
7
|
+
import { KitRadio, KitTypography } from 'aristid-ds';
|
|
4
8
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
5
9
|
import { useViewSettingsContext } from '../manage-view-settings/store-view-settings/useViewSettingsContext';
|
|
6
10
|
import { localizedTranslation } from '@leav/utils';
|
|
7
11
|
import { useLang } from '../../../hooks';
|
|
8
|
-
import {
|
|
12
|
+
import { FaEdit } from 'react-icons/fa';
|
|
9
13
|
import { ViewActionsButtons } from '../manage-view-settings/save-view/ViewActionsButtons';
|
|
10
14
|
import { useLoadView } from '../useLoadView';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
import { useMeQuery } from '../../../_gqlTypes';
|
|
16
|
+
import { LabelViewFormModal } from '../manage-view-settings/save-view/LabelViewFormModal';
|
|
17
|
+
import { ViewSettingsActionTypes } from '../manage-view-settings';
|
|
18
|
+
import useExecuteUpdateViewMutation from '../_queries/useExecuteUpdateViewMutation';
|
|
15
19
|
const ContentWrapperStyledDiv = styled.div `
|
|
16
20
|
display: flex;
|
|
17
21
|
flex-direction: column;
|
|
18
22
|
justify-content: space-between;
|
|
19
23
|
height: 100%;
|
|
20
24
|
`;
|
|
21
|
-
const
|
|
25
|
+
const StyledListViewsDiv = styled.div `
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
`;
|
|
29
|
+
const StyleKitRadioGroup = styled(KitRadio.Group) `
|
|
22
30
|
padding: calc(var(--general-spacing-s) * 1px) 0;
|
|
23
31
|
margin: 0 0 calc(var(--general-spacing-xs) * 1px) 0;
|
|
24
|
-
list-style: none;
|
|
25
32
|
color: var(--general-utilities-text-primary);
|
|
26
|
-
display: flex;
|
|
27
|
-
flex-direction: column;
|
|
28
33
|
gap: calc(var(--general-spacing-xs) * 1px);
|
|
29
34
|
`;
|
|
30
|
-
const
|
|
35
|
+
const StyledViewDiv = styled.div `
|
|
31
36
|
display: flex;
|
|
32
|
-
justify-content: space-between;
|
|
33
37
|
align-items: center;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
border-radius: calc(var(--general-border-radius-s) * 1px);
|
|
37
|
-
height: calc(var(--general-spacing-l) * 1px);
|
|
38
|
-
cursor: pointer;
|
|
39
|
-
|
|
40
|
-
&:hover {
|
|
41
|
-
border-color: var(--general-utilities-main-default);
|
|
42
|
-
background-color: var(--general-utilities-light);
|
|
43
|
-
}
|
|
38
|
+
justify-content: space-between;
|
|
39
|
+
padding: calc(var(--general-spacing-xs) * 1px) 0;
|
|
44
40
|
|
|
45
|
-
.
|
|
41
|
+
.edit {
|
|
46
42
|
color: var(--general-utilities-main-default);
|
|
47
|
-
margin-left: calc(var(--general-spacing-xs) * 1px);
|
|
48
43
|
font-size: calc(var(--general-typography-fontSize5) * 1px);
|
|
49
44
|
flex: 0 0 auto;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
&.selected {
|
|
54
|
-
background: var(--general-utilities-main-light);
|
|
55
|
-
|
|
56
|
-
.check {
|
|
57
|
-
display: inline-block;
|
|
58
|
-
}
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
display: inline-block;
|
|
59
47
|
}
|
|
60
48
|
`;
|
|
61
49
|
export const SavedViews = () => {
|
|
62
50
|
const { t } = useSharedTranslation();
|
|
63
|
-
const { view } = useViewSettingsContext();
|
|
64
51
|
const { availableLangs } = useLang();
|
|
52
|
+
const { view, dispatch } = useViewSettingsContext();
|
|
53
|
+
const { updateView } = useExecuteUpdateViewMutation();
|
|
65
54
|
const { loadView } = useLoadView();
|
|
55
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
56
|
+
const [dataViewToEdit, setDataViewToEdit] = useState({ id: null, label: null });
|
|
57
|
+
const [currentView, setCurrentView] = useState(view.savedViews.find(viewItem => view.viewId === viewItem.id) ?? undefined);
|
|
58
|
+
const { data: userData } = useMeQuery();
|
|
59
|
+
const isOwnerView = (ownerId) => ownerId === userData?.me?.whoAmI?.id;
|
|
66
60
|
const sharedViews = view.savedViews.filter(viewItem => viewItem.shared);
|
|
67
61
|
const myViews = view.savedViews.filter(viewItem => !viewItem.shared);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
setCurrentView(view.savedViews.find(viewItem => view.viewId === viewItem.id) ?? undefined);
|
|
64
|
+
}, [view.viewId]);
|
|
65
|
+
const _handleViewClick = (e) => {
|
|
66
|
+
loadView(e.target.value);
|
|
67
|
+
};
|
|
68
|
+
const _onClickEdit = (id, label) => {
|
|
69
|
+
setDataViewToEdit({ id, label });
|
|
70
|
+
_toggleModal();
|
|
71
|
+
};
|
|
72
|
+
const _toggleModal = () => {
|
|
73
|
+
setIsModalOpen(!isModalOpen);
|
|
74
|
+
};
|
|
75
|
+
const _onEditName = async (label) => {
|
|
76
|
+
if (!dataViewToEdit.id) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const mappedView = {
|
|
80
|
+
id: dataViewToEdit.id,
|
|
81
|
+
label
|
|
82
|
+
};
|
|
83
|
+
const { data } = await updateView({
|
|
84
|
+
view: mappedView
|
|
85
|
+
});
|
|
86
|
+
if (data) {
|
|
87
|
+
dispatch({
|
|
88
|
+
type: ViewSettingsActionTypes.RENAME_VIEW,
|
|
89
|
+
payload: {
|
|
90
|
+
id: data.updateView.id,
|
|
91
|
+
label: data.updateView.label
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
71
95
|
};
|
|
72
|
-
return (_jsxs(
|
|
96
|
+
return (_jsxs(_Fragment, { children: [isModalOpen && (_jsx(LabelViewFormModal, { viewData: dataViewToEdit.label, isOpen: true, onSubmit: _onEditName, onClose: _toggleModal })), _jsxs(ContentWrapperStyledDiv, { children: [_jsxs(StyledListViewsDiv, { children: [_jsxs(StyleKitRadioGroup, { onChange: _handleViewClick, value: currentView?.id, children: [_jsx(KitTypography.Title, { level: "h4", children: t('explorer.my-views') }), _jsx(StyledViewDiv, { children: _jsx(KitRadio, { value: undefined, children: t('explorer.default-view') }) }), myViews.map(viewItem => (_jsxs(StyledViewDiv, { children: [_jsx(KitRadio, { value: viewItem.id, children: localizedTranslation(viewItem.label, availableLangs) }), _jsx(FaEdit, { className: "edit", onClick: () => _onClickEdit(viewItem.id, viewItem.label) })] }, viewItem.id)))] }), _jsxs(StyleKitRadioGroup, { onChange: _handleViewClick, value: currentView?.id, children: [_jsx(KitTypography.Title, { level: "h4", children: t('explorer.shared-views') }), sharedViews.length === 0 ? (_jsx(KitTypography.Text, { size: "fontSize5", children: t('explorer.no-shared-views') })) : (sharedViews.map(viewItem => (_jsxs(StyledViewDiv, { children: [_jsx(KitRadio, { value: viewItem.id, children: localizedTranslation(viewItem.label, availableLangs) }), isOwnerView(viewItem.ownerId) ? (_jsx(FaEdit, { className: "edit", onClick: () => _onClickEdit(viewItem.id, viewItem.label) })) : null] }, viewItem.id))))] })] }), _jsx(ViewActionsButtons, {})] })] }));
|
|
73
97
|
};
|
|
74
98
|
//# sourceMappingURL=SavedViews.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SavedViews.js","sourceRoot":"","sources":["../../../../src/components/Explorer/list-saved-views/SavedViews.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"SavedViews.js","sourceRoot":"","sources":["../../../../src/components/Explorer/list-saved-views/SavedViews.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAoB,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC7D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,sBAAsB,EAAC,MAAM,oEAAoE,CAAC;AAC1G,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAC,kBAAkB,EAAC,MAAM,sDAAsD,CAAC;AACxF,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,kBAAkB,EAAC,MAAM,sDAAsD,CAAC;AACxF,OAAO,EAAC,uBAAuB,EAAC,MAAM,yBAAyB,CAAC;AAChE,OAAO,4BAA4B,MAAM,0CAA0C,CAAC;AAEpF,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;CAKzC,CAAC;AAEF,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAGpC,CAAC;AAEF,MAAM,kBAAkB,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;;;;;CAKhD,CAAC;AAEF,MAAM,aAAa,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Q,CAAC,EAAE,CAAC,CACxB,MAAC,aAAa,eACV,KAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,YACvB,oBAAoB,CAAC,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,GAC9C,EACV,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAC7B,KAAC,MAAM,IACH,SAAS,EAAC,MAAM,EAChB,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC,GAC1D,CACL,CAAC,CAAC,CAAC,IAAI,KATQ,QAAQ,CAAC,EAAE,CAUf,CACnB,CAAC,CACL,IACgB,IACJ,EACrB,KAAC,kBAAkB,KAAG,IACA,IAC3B,CACN,CAAC;AACN,CAAC,CAAC"}
|
package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropDown.js
CHANGED
|
@@ -35,6 +35,6 @@ export const FilterDropDown = ({ filter }) => {
|
|
|
35
35
|
id: filter.id
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
-
return (_jsxs(FilterDropDownStyledDiv, { children: [_jsx(FilterDropdownContent, { filter: filter, onFilterChange: onFilterChange, selectDropDownRef: selectDropDownRef }), _jsx("div", { ref: selectDropDownRef }), _jsx(KitDivider, { noMargin: true }), _jsx(KitButton, { type: "
|
|
38
|
+
return (_jsxs(FilterDropDownStyledDiv, { children: [_jsx(FilterDropdownContent, { filter: filter, onFilterChange: onFilterChange, selectDropDownRef: selectDropDownRef }), _jsx("div", { ref: selectDropDownRef }), _jsx(KitDivider, { noMargin: true }), _jsx(KitButton, { type: "action", icon: _jsx(FaClock, {}), onClick: _onResetFilter, children: t('explorer.reset-filter') }), _jsx(KitButton, { type: "action", icon: _jsx(FaTrash, {}), onClick: _onDeleteFilter, children: t('global.delete') })] }));
|
|
39
39
|
};
|
|
40
40
|
//# sourceMappingURL=FilterDropDown.js.map
|
package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropDown.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterDropDown.js","sourceRoot":"","sources":["../../../../../../src/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropDown.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAoC,MAAM,EAAC,MAAM,OAAO,CAAC;AAChE,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAC,uBAAuB,EAAC,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAC,sBAAsB,EAAC,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAE9D,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIzC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAA4C,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE;IAChF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,EAAC,QAAQ,EAAC,GAAG,sBAAsB,EAAE,CAAC;IAC5C,MAAM,iBAAiB,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAEvD,MAAM,cAAc,GAAmE,CACnF,UAA0B,EAC5B,EAAE,CACA,QAAQ,CAAC;QACL,IAAI,EAAE,uBAAuB,CAAC,oBAAoB;QAClD,OAAO,EAAE,UAAU;KACtB,CAAC,CAAC;IAEP,MAAM,cAAc,GAAgD,GAAG,EAAE,CACrE,QAAQ,CAAC;QACL,IAAI,EAAE,uBAAuB,CAAC,YAAY;QAC1C,OAAO,EAAE;YACL,EAAE,EAAE,MAAM,CAAC,EAAE;SAChB;KACJ,CAAC,CAAC;IAEP,MAAM,eAAe,GAAgD,GAAG,EAAE,CACtE,QAAQ,CAAC;QACL,IAAI,EAAE,uBAAuB,CAAC,aAAa;QAC3C,OAAO,EAAE;YACL,EAAE,EAAE,MAAM,CAAC,EAAE;SAChB;KACJ,CAAC,CAAC;IAEP,OAAO,CACH,MAAC,uBAAuB,eACpB,KAAC,qBAAqB,IAClB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,iBAAiB,GACtC,EACF,cAAK,GAAG,EAAE,iBAAiB,GAAI,EAC/B,KAAC,UAAU,IAAC,QAAQ,SAAG,EACvB,KAAC,SAAS,IAAC,IAAI,EAAC,
|
|
1
|
+
{"version":3,"file":"FilterDropDown.js","sourceRoot":"","sources":["../../../../../../src/components/Explorer/manage-view-settings/filter-items/filter-type/FilterDropDown.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAoC,MAAM,EAAC,MAAM,OAAO,CAAC;AAChE,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAC,uBAAuB,EAAC,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAC,sBAAsB,EAAC,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAE9D,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIzC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAA4C,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE;IAChF,MAAM,EAAC,CAAC,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
|
@@ -11,6 +11,7 @@ import { localizedTranslation } from '@leav/utils';
|
|
|
11
11
|
import { useLang } from '../../../../hooks';
|
|
12
12
|
import { useEffect, useState } from 'react';
|
|
13
13
|
import styled from 'styled-components';
|
|
14
|
+
import { MASS_SELECTION_ALL } from '../../_constants';
|
|
14
15
|
const ModifiedStyledKitTag = styled(KitTag) `
|
|
15
16
|
margin: 0;
|
|
16
17
|
`;
|
|
@@ -50,10 +51,11 @@ export const useOpenViewSettings = ({ view, isEnabled = true }) => {
|
|
|
50
51
|
_changePanelPage(chanelPageParams);
|
|
51
52
|
};
|
|
52
53
|
const viewName = localizedTranslation(view?.viewLabels ?? {}, lang);
|
|
54
|
+
const isMassSelectionAll = view.massSelection === MASS_SELECTION_ALL;
|
|
53
55
|
useEffect(() => {
|
|
54
|
-
setButton(_jsx(KitButton, { type: "secondary", icon: _jsx(FaSlidersH, {}), onClick: () => _openSettingsPanel(), title: String(t('explorer.settings')) /* TODO: avoid transform null to 'null' */ }));
|
|
55
|
-
setViewListButton(_jsxs(KitButton, { type: "secondary", icon: _jsx(FaBars, {}), onClick: () => _openSettingsPanel('my-views'), title: String(t('explorer.manage-views')) /* TODO: avoid transform null to 'null' */, children: [viewName === '' ? t('explorer.manage-views') : viewName, view.viewModified && (_jsx(ModifiedStyledKitTag, { type: "error", idCardProps: { description: String(t('explorer.modified')) } }))] }));
|
|
56
|
-
}, [view.viewModified, viewName]);
|
|
56
|
+
setButton(_jsx(KitButton, { type: "secondary", icon: _jsx(FaSlidersH, {}), onClick: () => _openSettingsPanel(), disabled: isMassSelectionAll, title: String(t('explorer.settings')) /* TODO: avoid transform null to 'null' */ }));
|
|
57
|
+
setViewListButton(_jsxs(KitButton, { type: "secondary", icon: _jsx(FaBars, {}), onClick: () => _openSettingsPanel('my-views'), disabled: isMassSelectionAll, title: String(t('explorer.manage-views')) /* TODO: avoid transform null to 'null' */, children: [viewName === '' ? t('explorer.manage-views') : viewName, view.viewModified && (_jsx(ModifiedStyledKitTag, { type: "error", idCardProps: { description: String(t('explorer.modified')) } }))] }));
|
|
58
|
+
}, [view.viewModified, viewName, isMassSelectionAll]);
|
|
57
59
|
return {
|
|
58
60
|
openSettingsPanel: _openSettingsPanel,
|
|
59
61
|
viewSettingsButton: button,
|
package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOpenViewSettings.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,SAAS,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,aAAa,EAAC,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAe,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAExD,OAAO,MAAM,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"useOpenViewSettings.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,SAAS,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,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B,CAAC,UAAU,CAAC,EAC7C,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,0CAA0C,aAEnF,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,QAAQ,EACvD,IAAI,CAAC,YAAY,IAAI,CAClB,KAAC,oBAAoB,IAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAE,EAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,EAAC,GAAI,CACpG,IACO,CACf,CAAC;IACN,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAEtD,OAAO;QACH,iBAAiB,EAAE,kBAAkB;QACrC,kBAAkB,EAAE,MAAM;QAC1B,cAAc;QACd,QAAQ,EAAE,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,QAAQ;KACpE,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
interface ISaveViewProps {
|
|
3
|
+
viewData?: Record<string, string> | null;
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
onSubmit: (label: Record<string, string>, id?: string | undefined) => void;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const LabelViewFormModal: FunctionComponent<ISaveViewProps>;
|
|
9
|
+
export {};
|
|
@@ -4,37 +4,33 @@ import { KitModal, KitButton, AntForm, KitInputWrapper, KitInput } from 'aristid
|
|
|
4
4
|
import { useLang } from '../../../../hooks';
|
|
5
5
|
import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
|
|
6
6
|
import { useViewSettingsContext } from '../store-view-settings/useViewSettingsContext';
|
|
7
|
-
|
|
7
|
+
const sortWithDefaultAtFirst = defaultLang => (a, b) => (b === defaultLang ? 1 : 0) - (a === defaultLang ? 1 : 0);
|
|
8
|
+
export const LabelViewFormModal = ({ viewData, isOpen, onSubmit, onClose }) => {
|
|
8
9
|
const { t } = useSharedTranslation();
|
|
9
10
|
const { defaultLang, availableLangs } = useLang();
|
|
10
11
|
const { view } = useViewSettingsContext();
|
|
11
12
|
const [form] = AntForm.useForm();
|
|
13
|
+
const initialValues = viewData ? viewData : view.viewId ? view.viewLabels : {};
|
|
12
14
|
const _toggleModal = () => {
|
|
13
|
-
if (isOpen) {
|
|
14
|
-
form.resetFields();
|
|
15
|
-
}
|
|
16
15
|
onClose();
|
|
17
16
|
};
|
|
18
17
|
const _handleSaveView = () => {
|
|
19
|
-
form.
|
|
20
|
-
const hasError = form.getFieldsError().some(field => field.errors.length > 0);
|
|
21
|
-
const hasOnlyEmptyField = Object.entries(form.getFieldsValue()).some(([language, value]) => language === defaultLang && !value);
|
|
22
|
-
if (hasError || hasOnlyEmptyField) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
onSave(form.getFieldsValue());
|
|
26
|
-
onClose();
|
|
18
|
+
form.submit();
|
|
27
19
|
};
|
|
28
|
-
const
|
|
29
|
-
|
|
20
|
+
const _onSubmit = values => {
|
|
21
|
+
onSubmit(values);
|
|
22
|
+
onClose();
|
|
30
23
|
};
|
|
31
24
|
const _preventCloseSettingsPanel = e => e.stopPropagation();
|
|
32
25
|
return (_jsx(KitModal
|
|
33
26
|
// TODO: remove appElement and put in the test : "KitModal.setAppElement(document.body) once exposed"
|
|
34
27
|
, {
|
|
35
28
|
// TODO: remove appElement and put in the test : "KitModal.setAppElement(document.body) once exposed"
|
|
36
|
-
appElement: document.body, title: t('explorer.save-view-as'), showCloseIcon: false, close: _toggleModal, isOpen: isOpen, footer: _jsxs(_Fragment, { children: [_jsx(KitButton, { type: "secondary", onClick: _toggleModal, icon: _jsx(FaTimes, {}), children: t('global.close') }), _jsx(KitButton, { type: "primary", onClick: _handleSaveView, icon: _jsx(FaSave, {}), children: t('global.save') })] }), children: _jsx(AntForm, { name: "label", form: form, initialValues:
|
|
37
|
-
{
|
|
38
|
-
|
|
29
|
+
appElement: document.body, title: t('explorer.save-view-as'), showCloseIcon: false, close: _toggleModal, isOpen: isOpen, footer: _jsxs(_Fragment, { children: [_jsx(KitButton, { type: "secondary", onClick: _toggleModal, icon: _jsx(FaTimes, {}), children: t('global.close') }), _jsx(KitButton, { type: "primary", onClick: _handleSaveView, icon: _jsx(FaSave, {}), children: t('global.save') })] }), children: _jsx(AntForm, { name: "label", form: form, initialValues: initialValues, onFinish: _onSubmit, children: _jsx(KitInputWrapper, { label: String(t('explorer.view-name')), children: [...availableLangs].sort(sortWithDefaultAtFirst(defaultLang)).map(lang => (_jsx(AntForm.Item, { name: lang, validateTrigger: "onBlur", rules: [
|
|
30
|
+
{
|
|
31
|
+
required: lang === defaultLang,
|
|
32
|
+
message: String(t('errors.standard_field_required'))
|
|
33
|
+
}
|
|
34
|
+
], children: _jsx(KitInput, { label: lang, required: lang === defaultLang, onMouseDown: _preventCloseSettingsPanel }) }, lang))) }) }) }));
|
|
39
35
|
};
|
|
40
|
-
//# sourceMappingURL=
|
|
36
|
+
//# sourceMappingURL=LabelViewFormModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LabelViewFormModal.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,OAAO,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AACnF,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,sBAAs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|
+
import { jsxs as _jsxs } 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
|
-
import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
|
|
6
|
-
import { KitButton } from 'aristid-ds';
|
|
7
|
-
import { FaShare } from 'react-icons/fa';
|
|
8
5
|
import { useCreateNewView } from './useCreateNewView';
|
|
9
6
|
import styled from 'styled-components';
|
|
10
7
|
import { useUpdateView } from './useUpdateView';
|
|
11
8
|
import { useResetView } from './useResetView';
|
|
9
|
+
import { useShareView } from './useShareView';
|
|
12
10
|
const StyledFooter = styled.footer `
|
|
13
11
|
display: flex;
|
|
14
12
|
flex-direction: column;
|
|
15
13
|
padding-bottom: calc(var(--general-spacing-xs) * 1px);
|
|
16
14
|
`;
|
|
17
15
|
export const ViewActionsButtons = () => {
|
|
18
|
-
const { t } = useSharedTranslation();
|
|
19
16
|
const { updateViewButton } = useUpdateView();
|
|
20
17
|
const { createNewViewButton } = useCreateNewView();
|
|
18
|
+
const { shareViewButton } = useShareView();
|
|
21
19
|
const { resetViewButton } = useResetView();
|
|
22
|
-
return (_jsxs(StyledFooter, { children: [updateViewButton, createNewViewButton,
|
|
20
|
+
return (_jsxs(StyledFooter, { children: [updateViewButton, createNewViewButton, shareViewButton, resetViewButton] }));
|
|
23
21
|
};
|
|
24
22
|
//# sourceMappingURL=ViewActionsButtons.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewActionsButtons.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/save-view/ViewActionsButtons.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"ViewActionsButtons.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/save-view/ViewActionsButtons.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAA;;;;CAIjC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACnC,MAAM,EAAC,gBAAgB,EAAC,GAAG,aAAa,EAAE,CAAC;IAC3C,MAAM,EAAC,mBAAmB,EAAC,GAAG,gBAAgB,EAAE,CAAC;IACjD,MAAM,EAAC,eAAe,EAAC,GAAG,YAAY,EAAE,CAAC;IACzC,MAAM,EAAC,eAAe,EAAC,GAAG,YAAY,EAAE,CAAC;IAEzC,OAAO,CACH,MAAC,YAAY,eACR,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,eAAe,IACL,CAClB,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
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 { useState } from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import { LabelViewFormModal } from './LabelViewFormModal';
|
|
7
7
|
import { KitButton } from 'aristid-ds';
|
|
8
8
|
import { FaSdCard } from 'react-icons/fa';
|
|
9
9
|
import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
|
|
@@ -32,6 +32,7 @@ export const useCreateNewView = () => {
|
|
|
32
32
|
type: ViewSettingsActionTypes.UPDATE_VIEWS,
|
|
33
33
|
payload: {
|
|
34
34
|
id: data.saveView.id,
|
|
35
|
+
ownerId: data.saveView.created_by.id,
|
|
35
36
|
label: data.saveView.label,
|
|
36
37
|
shared: data.saveView.shared,
|
|
37
38
|
filters: toValidFilters(data.saveView.filters),
|
|
@@ -45,7 +46,7 @@ export const useCreateNewView = () => {
|
|
|
45
46
|
}
|
|
46
47
|
};
|
|
47
48
|
return {
|
|
48
|
-
createNewViewButton: (_jsxs(_Fragment, { children: [_jsx(
|
|
49
|
+
createNewViewButton: (_jsxs(_Fragment, { children: [_jsx(LabelViewFormModal, { isOpen: isModalOpen, onSubmit: _createView, onClose: _toggleModal }), _jsx(KitButton, { type: "action", icon: _jsx(FaSdCard, {}), onClick: _toggleModal, children: t('explorer.save-view-as') })] }))
|
|
49
50
|
};
|
|
50
51
|
};
|
|
51
52
|
//# sourceMappingURL=useCreateNewView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateNewView.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/save-view/useCreateNewView.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"useCreateNewView.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/save-view/useCreateNewView.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AACrC,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAA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IAAI,CAAC,QAAQ,CAAC,KAAK;oBAC1B,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM;oBAC5B,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;oBAC9C,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE;oBAC9B,OAAO,EAAG,IAAI,CAAC,QAAQ,CAAC,OAAwB,IAAI;wBAChD,IAAI,EAAE,+BAA+B,CAAC,IAAI,CAAC,QAAQ,CAAC;qBACvD;oBACD,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC,EAAC,EAAE,EAAC,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE;iBACjE;aACJ,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC;IAEF,OAAO;QACH,mBAAmB,EAAE,CACjB,8BACI,KAAC,kBAAkB,IAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,GAAI,EACzF,KAAC,SAAS,IAAC,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAE,KAAC,QAAQ,KAAG,EAAE,OAAO,EAAE,YAAY,YAC7D,CAAC,CAAC,uBAAuB,CAAC,GACnB,IACb,CACN;KACJ,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -14,7 +14,7 @@ export const useResetView = () => {
|
|
|
14
14
|
dispatch({ type: ViewSettingsActionTypes.RESTORE_INITIAL_VIEW_SETTINGS });
|
|
15
15
|
};
|
|
16
16
|
return {
|
|
17
|
-
resetViewButton: (_jsx(KitButton, { type: "
|
|
17
|
+
resetViewButton: (_jsx(KitButton, { type: "action", icon: _jsx(FaUndo, {}), onClick: _resetView, children: t('explorer.reinit-view') }))
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
//# sourceMappingURL=useResetView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResetView.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/save-view/useResetView.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AACrC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,sBAAsB,EAAC,MAAM,+CAA+C,CAAC;AACrF,OAAO,EAAC,uBAAuB,EAAC,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAEtC,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE;IAC7B,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,EAAC,QAAQ,EAAC,GAAG,sBAAsB,EAAE,CAAC;IAE5C,MAAM,UAAU,GAAG,GAAG,EAAE;QACpB,QAAQ,CAAC,EAAC,IAAI,EAAE,uBAAuB,CAAC,6BAA6B,EAAC,CAAC,CAAC;IAC5E,CAAC,CAAC;IAEF,OAAO;QACH,eAAe,EAAE,CACb,KAAC,SAAS,IAAC,IAAI,EAAC,
|
|
1
|
+
{"version":3,"file":"useResetView.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/save-view/useResetView.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AACrC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,sBAAsB,EAAC,MAAM,+CAA+C,CAAC;AACrF,OAAO,EAAC,uBAAuB,EAAC,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAEtC,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE;IAC7B,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,EAAC,QAAQ,EAAC,GAAG,sBAAsB,EAAE,CAAC;IAE5C,MAAM,UAAU,GAAG,GAAG,EAAE;QACpB,QAAQ,CAAC,EAAC,IAAI,EAAE,uBAAuB,CAAC,6BAA6B,EAAC,CAAC,CAAC;IAC5E,CAAC,CAAC;IAEF,OAAO;QACH,eAAe,EAAE,CACb,KAAC,SAAS,IAAC,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAE,KAAC,MAAM,KAAG,EAAE,OAAO,EAAE,UAAU,YACzD,CAAC,CAAC,sBAAsB,CAAC,GAClB,CACf;KACJ,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
|
|
3
|
+
// This file is released under LGPL V3
|
|
4
|
+
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
5
|
+
import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
|
|
6
|
+
import { KitButton } from 'aristid-ds';
|
|
7
|
+
import { FaShare } from 'react-icons/fa';
|
|
8
|
+
import { useViewSettingsContext } from '../store-view-settings/useViewSettingsContext';
|
|
9
|
+
import { useEffect, useState } from 'react';
|
|
10
|
+
import useExecuteSaveViewMutation from '../../../../hooks/useExecuteSaveViewMutation';
|
|
11
|
+
import { ViewSettingsActionTypes } from '../store-view-settings/viewSettingsReducer';
|
|
12
|
+
import { prepareViewForRequest } from './prepareViewForRequest';
|
|
13
|
+
import { mapViewTypeFromExplorerToLegacy } from '../../_constants';
|
|
14
|
+
import { useTransformFilters } from '../_shared/useTransformFilters';
|
|
15
|
+
import { useMeQuery } from '../../../../_gqlTypes';
|
|
16
|
+
export const useShareView = () => {
|
|
17
|
+
const { t } = useSharedTranslation();
|
|
18
|
+
const { view, dispatch } = useViewSettingsContext();
|
|
19
|
+
const { saveView } = useExecuteSaveViewMutation();
|
|
20
|
+
const { toValidFilters } = useTransformFilters();
|
|
21
|
+
const [isSharedView, setIsSharedView] = useState(false);
|
|
22
|
+
const [isOwnerView, setIsOwnerView] = useState(false);
|
|
23
|
+
const { data: userData } = useMeQuery();
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const currentView = view.savedViews.find(v => v.id === view.viewId);
|
|
26
|
+
if (currentView === undefined) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
setIsSharedView(currentView.shared ?? false);
|
|
30
|
+
setIsOwnerView(currentView.ownerId === userData?.me?.whoAmI?.id);
|
|
31
|
+
}, [view.viewId]);
|
|
32
|
+
const _toggleShareView = async () => {
|
|
33
|
+
const mappedView = {
|
|
34
|
+
...prepareViewForRequest(view, view.viewLabels),
|
|
35
|
+
shared: !isSharedView,
|
|
36
|
+
id: view.viewId
|
|
37
|
+
};
|
|
38
|
+
const { data } = await saveView({
|
|
39
|
+
view: mappedView
|
|
40
|
+
});
|
|
41
|
+
setIsSharedView(!isSharedView);
|
|
42
|
+
if (data) {
|
|
43
|
+
dispatch({
|
|
44
|
+
type: ViewSettingsActionTypes.UPDATE_VIEWS,
|
|
45
|
+
payload: {
|
|
46
|
+
id: data.saveView.id,
|
|
47
|
+
ownerId: data.saveView.created_by.id,
|
|
48
|
+
label: data.saveView.label,
|
|
49
|
+
shared: data.saveView.shared,
|
|
50
|
+
filters: toValidFilters(data.saveView.filters),
|
|
51
|
+
sort: data.saveView.sort ?? [],
|
|
52
|
+
display: data.saveView.display ?? {
|
|
53
|
+
type: mapViewTypeFromExplorerToLegacy[view.viewType]
|
|
54
|
+
},
|
|
55
|
+
attributes: data.saveView?.attributes?.map(({ id }) => id) ?? []
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
shareViewButton: !view.viewId || (isSharedView && !isOwnerView) ? null : (_jsx(KitButton, { type: "action", icon: _jsx(FaShare, {}), onClick: _toggleShareView, children: isSharedView ? t('explorer.unshare-view') : t('explorer.share-view') }))
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=useShareView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useShareView.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/save-view/useShareView.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AACrC,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAC,sBAAsB,EAAC,MAAM,+CAA+C,CAAC;AACrF,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC1C,OAAO,0BAA0B,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAC,uBAAuB,EAAC,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAC,+BAA+B,EAAC,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAC,mBAAmB,EAAC,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAEzC,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE;IAC7B,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,EAAC,IAAI,EAAE,QAAQ,EAAC,GAAG,sBAAsB,EAAE,CAAC;IAClD,MAAM,EAAC,QAAQ,EAAC,GAAG,0BAA0B,EAAE,CAAC;IAChD,MAAM,EAAC,cAAc,EAAC,GAAG,mBAAmB,EAAE,CAAC;IAC/C,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC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