@topconsultnpm/sdkui-react 6.20.0-dev2.21 → 6.20.0-dev2.23
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import Logo from '../../../assets/Toppy-generico.png';
|
|
4
|
-
import { DcmtTypeListCacheService, LayoutModes, SDK_Localizator } from '@topconsultnpm/sdk-ts';
|
|
4
|
+
import { ArchiveConstraints, DcmtTypeListCacheService, LayoutModes, SDK_Localizator } from '@topconsultnpm/sdk-ts';
|
|
5
5
|
import { IconTree, SDKUI_Globals, SDKUI_Localizator, IconRecentlyViewed, IconPreview, IconShow, IconBoard, IconDcmtTypeSys, removeMruTid, getMoreInfoTasksForDocument } from '../../../helper';
|
|
6
6
|
import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
|
|
7
7
|
import TMLayoutContainer from '../../base/TMLayout';
|
|
@@ -145,49 +145,36 @@ const TMArchive = ({ onDcmtTypeSelect = undefined, inputTID, inputFile = null, c
|
|
|
145
145
|
export default TMArchive;
|
|
146
146
|
const TMTreeSelectorWrapper = ({ isMobile, isSharedArchive, onSelectedTIDChanged }) => {
|
|
147
147
|
const { setPanelVisibilityById, toggleMaximize, setToolbarButtonVisibility, countVisibleLeafPanels } = useTMPanelManagerContext();
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
setToolbarButtonVisibility('tmDcmtForm', true);
|
|
162
|
-
} }));
|
|
148
|
+
const updatePanelsVisibility = async (tid) => {
|
|
149
|
+
if (!tid)
|
|
150
|
+
return;
|
|
151
|
+
const dtd = await DcmtTypeListCacheService.GetAsync(tid);
|
|
152
|
+
const isOnlyMetadata = dtd?.archiveConstraint === ArchiveConstraints.OnlyMetadata;
|
|
153
|
+
const previewVisible = !isSharedArchive && !isOnlyMetadata;
|
|
154
|
+
setPanelVisibilityById('tmDcmtPreview', previewVisible);
|
|
155
|
+
setToolbarButtonVisibility('tmDcmtPreview', previewVisible);
|
|
156
|
+
setPanelVisibilityById('tmDcmtForm', true);
|
|
157
|
+
setToolbarButtonVisibility('tmDcmtForm', true);
|
|
158
|
+
};
|
|
159
|
+
return (_jsx(TMTreeSelector, { layoutMode: LayoutModes.Ark, onClosePanel: !isMobile && countVisibleLeafPanels() > 1 ? () => setPanelVisibilityById('tmTreeSelector', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: !isMobile && countVisibleLeafPanels() > 1 ? () => toggleMaximize("tmTreeSelector") : undefined, onSelectedTIDChanged: async (tid) => { updatePanelsVisibility(tid); onSelectedTIDChanged?.(tid); } }));
|
|
163
160
|
};
|
|
164
161
|
const TMRecentsManagerWrapper = ({ mruTIDs, currentTID, currentMruTID, deviceType, isSharedArchive, onSelectedTID, onDeletedTID }) => {
|
|
165
162
|
const { setPanelVisibilityById, setToolbarButtonVisibility } = useTMPanelManagerContext();
|
|
163
|
+
// This avoids unnecessary re-renders by only recalculating when deviceType changes.
|
|
164
|
+
let isMobile = useMemo(() => { return deviceType === DeviceType.MOBILE; }, [deviceType]);
|
|
165
|
+
const updatePanelsVisibility = async (tid) => {
|
|
166
|
+
if (!tid)
|
|
167
|
+
return;
|
|
168
|
+
const dtd = await DcmtTypeListCacheService.GetAsync(tid);
|
|
169
|
+
const isOnlyMetadata = dtd?.archiveConstraint === ArchiveConstraints.OnlyMetadata;
|
|
170
|
+
const previewVisible = !isSharedArchive && !isOnlyMetadata;
|
|
171
|
+
setPanelVisibilityById('tmDcmtPreview', previewVisible);
|
|
172
|
+
setToolbarButtonVisibility('tmDcmtPreview', previewVisible);
|
|
173
|
+
setPanelVisibilityById('tmDcmtForm', true);
|
|
174
|
+
setToolbarButtonVisibility('tmDcmtForm', true);
|
|
175
|
+
};
|
|
166
176
|
useEffect(() => {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
setToolbarButtonVisibility('tmDcmtPreview', true);
|
|
171
|
-
}
|
|
172
|
-
setToolbarButtonVisibility('tmDcmtForm', true);
|
|
173
|
-
}
|
|
174
|
-
}, [currentTID, isSharedArchive]);
|
|
175
|
-
return (_jsx(TMRecentsManager, { accessFilter: 'canArchive', mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => {
|
|
176
|
-
onSelectedTID?.(tid);
|
|
177
|
-
if (deviceType === DeviceType.MOBILE) {
|
|
178
|
-
setPanelVisibilityById('tmDcmtForm', true);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
setPanelVisibilityById('tmDcmtForm', true);
|
|
182
|
-
if (!isSharedArchive) {
|
|
183
|
-
setPanelVisibilityById('tmDcmtPreview', true);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
if (!isSharedArchive) {
|
|
187
|
-
setToolbarButtonVisibility('tmDcmtPreview', true);
|
|
188
|
-
}
|
|
189
|
-
setToolbarButtonVisibility('tmDcmtForm', true);
|
|
190
|
-
}, onDeletedTID: (tid) => {
|
|
191
|
-
onDeletedTID?.(tid);
|
|
192
|
-
} }));
|
|
177
|
+
updatePanelsVisibility(currentTID);
|
|
178
|
+
}, [currentTID, isSharedArchive, isMobile]);
|
|
179
|
+
return (_jsx(TMRecentsManager, { accessFilter: "canArchive", mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: async (tid) => { await updatePanelsVisibility(tid); onSelectedTID?.(tid); }, onDeletedTID: onDeletedTID }));
|
|
193
180
|
};
|
|
@@ -115,7 +115,7 @@ const TMLoginForm = (props) => {
|
|
|
115
115
|
const [dcmtArchive, setDcmtArchive] = useState();
|
|
116
116
|
const [manualArchiveID, setManualArchiveID] = useState('');
|
|
117
117
|
const [authMode, setAuthMode] = useState(AuthenticationModes.TopMedia);
|
|
118
|
-
const [username, setUsername] = useState('
|
|
118
|
+
const [username, setUsername] = useState('');
|
|
119
119
|
const [password, setPassword] = useState('');
|
|
120
120
|
const [authDomain, setAuthDomain] = useState('');
|
|
121
121
|
const [usernameOnBehalf, setUsernameOnBehalf] = useState('');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topconsultnpm/sdkui-react",
|
|
3
|
-
"version": "6.20.0-dev2.
|
|
3
|
+
"version": "6.20.0-dev2.23",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"lib"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@topconsultnpm/sdk-ts": "6.20.0-dev2.
|
|
43
|
+
"@topconsultnpm/sdk-ts": "6.20.0-dev2.4",
|
|
44
44
|
"buffer": "^6.0.3",
|
|
45
45
|
"devextreme": "25.2.4",
|
|
46
46
|
"devextreme-react": "25.2.4",
|