@topconsultnpm/sdkui-react-beta 6.13.64 → 6.13.66
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/lib/components/features/archive/TMArchive.js +130 -44
- package/lib/components/features/documents/TMDcmtForm.d.ts +1 -0
- package/lib/components/features/documents/TMDcmtForm.js +156 -154
- package/lib/components/features/documents/TMDcmtPreview.d.ts +2 -0
- package/lib/components/features/documents/TMDcmtPreview.js +6 -6
- package/lib/components/features/documents/TMFileUploader.d.ts +1 -0
- package/lib/components/features/documents/TMFileUploader.js +2 -2
- package/lib/components/features/documents/TMMasterDetailDcmts.js +60 -22
- package/lib/components/features/search/TMSavedQuerySelector.js +1 -1
- package/lib/components/features/search/TMSearch.js +2 -2
- package/lib/components/features/search/TMSearchResult.d.ts +0 -1
- package/lib/components/features/search/TMSearchResult.js +3 -8
- package/lib/components/grids/TMRecentsManager.js +1 -1
- package/lib/components/index.d.ts +0 -3
- package/lib/components/index.js +0 -3
- package/lib/components/layout/panelManager/TMPanelManagerToolbar.js +2 -2
- package/lib/components/layout/panelManager/TMPanelWrapper.js +4 -1
- package/lib/components/layout/panelManager/types.d.ts +2 -0
- package/package.json +1 -1
- package/lib/components/base/TMPanelManager.d.ts +0 -11
- package/lib/components/base/TMPanelManager.js +0 -478
- package/lib/components/base/TMPanelManagerToolbar.d.ts +0 -23
- package/lib/components/base/TMPanelManagerToolbar.js +0 -109
- package/lib/components/base/TMPanelManagerUtils.d.ts +0 -37
- package/lib/components/base/TMPanelManagerUtils.js +0 -27
@@ -1,22 +1,23 @@
|
|
1
|
-
import { jsx as _jsx,
|
2
|
-
import {
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
3
3
|
import Logo from '../../../assets/Toppy-generico.png';
|
4
|
-
import { LayoutModes } from '@topconsultnpm/sdk-ts-beta';
|
5
|
-
import { IconTree,
|
4
|
+
import { DcmtTypeListCacheService, LayoutModes, SDK_Localizator } from '@topconsultnpm/sdk-ts-beta';
|
5
|
+
import { IconTree, SDKUI_Globals, SDKUI_Localizator, IconRecentlyViewed, IconPreview, IconShow, IconBoard, IconDcmtTypeSys } from '../../../helper';
|
6
6
|
import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
|
7
|
-
import TMLayoutContainer, {
|
7
|
+
import TMLayoutContainer, { TMLayoutItem } from '../../base/TMLayout';
|
8
8
|
import TMRecentsManager from '../../grids/TMRecentsManager';
|
9
9
|
import TMDcmtForm from '../documents/TMDcmtForm';
|
10
10
|
import { StyledToppyTextContainer, StyledToppyText } from '../search/TMSearchQueryPanel';
|
11
11
|
import TMTreeSelector from '../search/TMTreeSelector';
|
12
12
|
import TMPanel from '../../base/TMPanel';
|
13
|
-
import
|
13
|
+
import { TMPanelManagerProvider, useTMPanelManagerContext } from '../../layout/panelManager/TMPanelManagerContext';
|
14
|
+
import TMPanelManagerContainer from '../../layout/panelManager/TMPanelManagerContainer';
|
14
15
|
const TMArchive = ({ inputTID }) => {
|
15
16
|
const TIDs = SDKUI_Globals.userSettings.archivingSettings.mruTIDs;
|
16
17
|
const [currentTID, setCurrentTID] = useState(0);
|
17
18
|
const [mruTIDs, setMruTIDs] = useState(TIDs);
|
18
|
-
const [
|
19
|
-
const [
|
19
|
+
const [currentMruTID, setCurrentMruTID] = useState(0);
|
20
|
+
const [fromDTD, setFromDTD] = useState();
|
20
21
|
const deviceType = useDeviceType();
|
21
22
|
useEffect(() => { setMruTIDs(TIDs); }, []);
|
22
23
|
useEffect(() => {
|
@@ -24,43 +25,128 @@ const TMArchive = ({ inputTID }) => {
|
|
24
25
|
return;
|
25
26
|
setCurrentTID(inputTID);
|
26
27
|
}, [inputTID]);
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
return ['0%', '100%'];
|
31
|
-
}
|
32
|
-
return showTreesPanel ? ['20%', '80%'] : ['0', '100%'];
|
33
|
-
}, [deviceType, showTreesPanel]);
|
34
|
-
const getSecondarySplitterStartValues = useCallback(() => {
|
35
|
-
if (deviceType === DeviceType.MOBILE) {
|
36
|
-
return currentTID ? ['0', '100%'] : ['100%', '0%'];
|
28
|
+
useEffect(() => {
|
29
|
+
if (!currentTID || currentTID <= 0) {
|
30
|
+
return;
|
37
31
|
}
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
{ icon: _jsx(IconProgressReady, {}), selected: showRecentsPanel, onClick: () => { setShowRecentsPanel(!showRecentsPanel); } }
|
44
|
-
]);
|
45
|
-
}, [showTreesPanel, showRecentsPanel]);
|
32
|
+
DcmtTypeListCacheService.GetAsync(currentTID).then(async (dtd) => {
|
33
|
+
setFromDTD(dtd);
|
34
|
+
});
|
35
|
+
}, [currentTID]);
|
36
|
+
const setSearchByTID = (tid) => { setCurrentTID(tid); };
|
46
37
|
const isMobile = deviceType === DeviceType.MOBILE;
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
38
|
+
const tmTreeSelectorElement = useMemo(() => _jsx(TMTreeSelectorWrapper, { isMobile: isMobile, onSelectedTIDChanged: (tid) => {
|
39
|
+
setSearchByTID(tid);
|
40
|
+
if (tid && mruTIDs.includes(tid))
|
41
|
+
setCurrentMruTID(tid);
|
42
|
+
else
|
43
|
+
setCurrentMruTID(0);
|
44
|
+
} }), [isMobile]);
|
45
|
+
const tmRecentsManagerElement = useMemo(() => _jsx(TMRecentsManagerWrapper, { mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => {
|
46
|
+
setCurrentMruTID(tid);
|
47
|
+
setCurrentTID(tid);
|
48
|
+
}, onDeletedTID: (tid) => {
|
49
|
+
let newMruTIDS = mruTIDs.slice();
|
50
|
+
let index = newMruTIDS.findIndex(o => o == tid);
|
51
|
+
if (index >= 0)
|
52
|
+
newMruTIDS.splice(index, 1);
|
53
|
+
SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS.filter(tid => tid != undefined && tid != null);
|
54
|
+
setMruTIDs(newMruTIDS);
|
55
|
+
} }), [mruTIDs, currentMruTID, deviceType]);
|
56
|
+
const tmFormElement = useMemo(() => currentTID ?
|
57
|
+
_jsx(TMDcmtForm, { TID: currentTID, DID: undefined, groupId: 'tmForm', layoutMode: LayoutModes.Ark, showPreview: deviceType !== DeviceType.MOBILE, onClose: deviceType === DeviceType.MOBILE ? () => setCurrentTID(undefined) : undefined, onSaveRecents: (TIDs) => setMruTIDs(TIDs), showDcmtFormSidebar: false })
|
58
|
+
:
|
59
|
+
_jsx(TMPanel, { title: 'Archiviazione', children: _jsxs(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: [_jsxs(TMLayoutItem, { width: 'max-content', height: 'max-content', children: [" ", _jsxs(StyledToppyTextContainer, { children: [" ", _jsxs(StyledToppyText, { children: [" ", 'Selezionare un tipo documento', " "] }), " "] }), " "] }), _jsxs(TMLayoutItem, { width: 'max-content', height: 'max-content', children: [" ", _jsx("img", { src: Logo, width: 120, alt: '' }), " "] })] }) }), [currentTID, deviceType, mruTIDs]);
|
60
|
+
const allInitialPanelVisibility = {
|
61
|
+
'tmTreeSelector': true,
|
62
|
+
'tmRecentsManager': true,
|
63
|
+
'tmForm': true,
|
64
|
+
'tmDcmtForm': true,
|
65
|
+
'tmBlog': false,
|
66
|
+
'tmSysMetadata': false,
|
67
|
+
'tmDcmtPreview': true,
|
68
|
+
};
|
69
|
+
const initialPanelDimensions = {
|
70
|
+
'tmTreeSelector': { width: '20%', height: '100%' },
|
71
|
+
'tmRecentsManager': { width: '20%', height: '100%' },
|
72
|
+
'tmForm': { width: '60%', height: '100%' },
|
73
|
+
'tmDcmtForm': { width: '25%', height: '100%' },
|
74
|
+
'tmBlog': { width: '25%', height: '100%' },
|
75
|
+
'tmSysMetadata': { width: '25%', height: '100%' },
|
76
|
+
'tmDcmtPreview': { width: '25%', height: '100%' },
|
77
|
+
};
|
78
|
+
const initialPanels = useMemo(() => [
|
79
|
+
{
|
80
|
+
id: 'tmTreeSelector',
|
81
|
+
name: SDK_Localizator.Trees,
|
82
|
+
contentOptions: { component: tmTreeSelectorElement },
|
83
|
+
toolbarOptions: { icon: _jsx(IconTree, { fontSize: 24 }), visible: true, orderNumber: 1, isActive: allInitialPanelVisibility['tmTreeSelector'] }
|
84
|
+
},
|
85
|
+
{
|
86
|
+
id: 'tmRecentsManager',
|
87
|
+
name: SDKUI_Localizator.Shortcuts,
|
88
|
+
contentOptions: { component: tmRecentsManagerElement, panelContainer: { title: SDKUI_Localizator.Shortcuts, totalItems: mruTIDs.length } },
|
89
|
+
toolbarOptions: { icon: _jsx(IconRecentlyViewed, { fontSize: 24 }), visible: true, orderNumber: 2, isActive: allInitialPanelVisibility['tmRecentsManager'] }
|
90
|
+
},
|
91
|
+
{
|
92
|
+
id: 'tmForm',
|
93
|
+
name: fromDTD?.nameLoc ?? SDK_Localizator.Metadatas,
|
94
|
+
contentOptions: { component: tmFormElement },
|
95
|
+
toolbarOptions: { icon: _jsx(IconPreview, { fontSize: 24 }), visible: false, orderNumber: 3, isActive: allInitialPanelVisibility['tmForm'] },
|
96
|
+
children: [
|
97
|
+
{
|
98
|
+
id: 'tmDcmtForm',
|
99
|
+
name: SDK_Localizator.Metadatas,
|
100
|
+
toolbarOptions: { icon: _jsx(IconPreview, { fontSize: 24 }), visible: false, orderNumber: 4, isActive: allInitialPanelVisibility['tmDcmtForm'] }
|
101
|
+
},
|
102
|
+
{
|
103
|
+
id: 'tmBlog',
|
104
|
+
name: SDKUI_Localizator.BlogCase,
|
105
|
+
toolbarOptions: { icon: _jsx(IconBoard, { fontSize: 24 }), visible: false, orderNumber: 5, isActive: allInitialPanelVisibility['tmBlog'] }
|
106
|
+
},
|
107
|
+
{
|
108
|
+
id: 'tmSysMetadata',
|
109
|
+
name: SDKUI_Localizator.MetadataSystem,
|
110
|
+
toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible: false, orderNumber: 6, isActive: allInitialPanelVisibility['tmSysMetadata'] }
|
111
|
+
},
|
112
|
+
{
|
113
|
+
id: 'tmDcmtPreview',
|
114
|
+
name: SDKUI_Localizator.PreviewDocument,
|
115
|
+
toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), visible: false, orderNumber: 7, isActive: allInitialPanelVisibility['tmDcmtPreview'] }
|
116
|
+
}
|
117
|
+
]
|
118
|
+
},
|
119
|
+
], [tmTreeSelectorElement, tmRecentsManagerElement, tmFormElement, currentTID, mruTIDs]);
|
120
|
+
return (_jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmRecentsManager', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true }) }));
|
65
121
|
};
|
66
122
|
export default TMArchive;
|
123
|
+
const TMTreeSelectorWrapper = ({ isMobile, onSelectedTIDChanged }) => {
|
124
|
+
const { setPanelVisibilityById, toggleMaximize, setToolbarButtonVisibility } = useTMPanelManagerContext();
|
125
|
+
return (_jsx(TMTreeSelector, { onClosePanel: () => setPanelVisibilityById('tmTreeSelector', false), onMaximizePanel: () => toggleMaximize('tmTreeSelector'), onSelectedTIDChanged: (tid) => {
|
126
|
+
onSelectedTIDChanged?.(tid);
|
127
|
+
if (isMobile)
|
128
|
+
setPanelVisibilityById('tmForm', true);
|
129
|
+
else {
|
130
|
+
setPanelVisibilityById('tmDcmtForm', true);
|
131
|
+
setPanelVisibilityById('tmDcmtPreview', true);
|
132
|
+
}
|
133
|
+
setToolbarButtonVisibility('tmDcmtPreview', true);
|
134
|
+
setToolbarButtonVisibility('tmDcmtForm', true);
|
135
|
+
} }));
|
136
|
+
};
|
137
|
+
const TMRecentsManagerWrapper = ({ mruTIDs, currentMruTID, deviceType, onSelectedTID, onDeletedTID }) => {
|
138
|
+
const { setPanelVisibilityById, setToolbarButtonVisibility } = useTMPanelManagerContext();
|
139
|
+
return (_jsx(TMRecentsManager, { mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => {
|
140
|
+
onSelectedTID?.(tid);
|
141
|
+
if (deviceType === DeviceType.MOBILE)
|
142
|
+
setPanelVisibilityById('tmForm', true);
|
143
|
+
else {
|
144
|
+
setPanelVisibilityById('tmDcmtForm', true);
|
145
|
+
setPanelVisibilityById('tmDcmtPreview', true);
|
146
|
+
}
|
147
|
+
setToolbarButtonVisibility('tmDcmtPreview', true);
|
148
|
+
setToolbarButtonVisibility('tmDcmtForm', true);
|
149
|
+
}, onDeletedTID: (tid) => {
|
150
|
+
onDeletedTID?.(tid);
|
151
|
+
} }));
|
152
|
+
};
|