@topconsultnpm/sdkui-react 6.20.0-dev1.34 → 6.20.0-dev1.35
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.
|
@@ -11,8 +11,9 @@ import TMRecentsManager from '../../grids/TMRecentsManager';
|
|
|
11
11
|
import { SearchResultContext } from '../../../ts';
|
|
12
12
|
import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
|
|
13
13
|
import { StyledMultiViewPanel } from '../../base/Styled';
|
|
14
|
-
import {
|
|
14
|
+
import { useTMPanelManagerContext } from '../../layout/panelManager/TMPanelManagerContext';
|
|
15
15
|
import TMPanelManagerContainer from '../../layout/panelManager/TMPanelManagerContainer';
|
|
16
|
+
import { TMPanelManagerWithPersistenceProvider } from '../../layout/panelManager/TMPanelManagerWithPersistenceProvider';
|
|
16
17
|
var TMSearchViews;
|
|
17
18
|
(function (TMSearchViews) {
|
|
18
19
|
TMSearchViews[TMSearchViews["Search"] = 0] = "Search";
|
|
@@ -141,15 +142,16 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
|
|
|
141
142
|
console.error("Error refreshing search:", error);
|
|
142
143
|
}
|
|
143
144
|
};
|
|
144
|
-
const isMobile = deviceType === DeviceType.
|
|
145
|
+
const isMobile = deviceType === DeviceType.MOBILE;
|
|
146
|
+
const isTabletOrMobile = deviceType === DeviceType.TABLET || deviceType === DeviceType.MOBILE;
|
|
145
147
|
// --- JSX WRAPPERS ---
|
|
146
|
-
const tmTreeSelectorElement = useMemo(() => _jsx(TMTreeSelectorWrapper, { isMobile:
|
|
148
|
+
const tmTreeSelectorElement = useMemo(() => _jsx(TMTreeSelectorWrapper, { isMobile: isTabletOrMobile, onSelectedTIDChanged: (tid) => {
|
|
147
149
|
setCurrentTID(tid);
|
|
148
150
|
if (tid && mruTIDs.includes(tid))
|
|
149
151
|
setCurrentMruTID(tid);
|
|
150
152
|
else
|
|
151
153
|
setCurrentMruTID(0);
|
|
152
|
-
} }), [
|
|
154
|
+
} }), [isTabletOrMobile, mruTIDs]);
|
|
153
155
|
const tmRecentsManagerElement = useMemo(() => _jsx(TMRecentsManagerWrapper, { mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => {
|
|
154
156
|
setCurrentMruTID(tid);
|
|
155
157
|
setCurrentTID(tid);
|
|
@@ -180,6 +182,29 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
|
|
|
180
182
|
}, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? filteredByTIDSQDs.find(o => o.id == 1) : currentSQD, setSQDAsync) }) }) : _jsx(_Fragment, {}), _jsx(Item, { title: SDKUI_Localizator.AllFemale, children: _jsx(TMSavedQuerySelectorWrapper, { allowShowSearch: true, items: allSQDs, manageDefault: false, onItemClick: (sqd) => {
|
|
181
183
|
onSQDItemClick(sqd, setSQDAsync);
|
|
182
184
|
}, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? undefined : currentSQD, setSQDAsync) }) })] }), [currentSQDMode, currentTID, currentSQD, fromDTD, filteredByTIDSQDs, allSQDs]);
|
|
185
|
+
// Returns the current panelLayout from user settings, falling back to an empty object if not present.
|
|
186
|
+
const getPanelLayoutSetting = () => {
|
|
187
|
+
return SDKUI_Globals.userSettings.searchSettings.panelLayout ?? {};
|
|
188
|
+
};
|
|
189
|
+
// Checks whether a persisted panel layout exists and is not empty.
|
|
190
|
+
const hasSavedLayout = () => {
|
|
191
|
+
const panelLayout = getPanelLayoutSetting();
|
|
192
|
+
return Object.keys(panelLayout).length > 0;
|
|
193
|
+
};
|
|
194
|
+
// Persists the current panel states into user settings. Each panel must contain: visible, width and height.
|
|
195
|
+
const persistPanelStates = (state) => {
|
|
196
|
+
if (!state || Object.keys(state).length === 0)
|
|
197
|
+
return;
|
|
198
|
+
SDKUI_Globals.userSettings.searchSettings.panelLayout = {
|
|
199
|
+
...state
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
// Retrieves the persisted panel layout. Returns undefined on mobile devices.
|
|
203
|
+
const getPersistedPanelStates = () => {
|
|
204
|
+
if (isMobile)
|
|
205
|
+
return undefined;
|
|
206
|
+
return getPanelLayoutSetting();
|
|
207
|
+
};
|
|
183
208
|
// --- PANEL DEFINITIONS ---
|
|
184
209
|
const allInitialPanelVisibility = {
|
|
185
210
|
'TMTreeSelector': true,
|
|
@@ -219,7 +244,7 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
|
|
|
219
244
|
toolbarOptions: { icon: _jsx(IconSavedQuery, { fontSize: 24 }), visible: true, orderNumber: 4, isActive: allInitialPanelVisibility['TMSavedQuerySelector'] }
|
|
220
245
|
}
|
|
221
246
|
], [tmTreeSelectorElement, showSearchResults, tmRecentsManagerElement, tmSearchQueryPanelElement, tmSavedQuerySelectorElement, fromDTD, mruTIDs]);
|
|
222
|
-
return (_jsxs(_Fragment, { children: [showSearchResults ? _jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.Search, children: _jsx(
|
|
247
|
+
return (_jsxs(_Fragment, { children: [showSearchResults ? _jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.Search, children: _jsx(TMPanelManagerWithPersistenceProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'TMRecentsManager', isPersistenceEnabled: !isMobile ? hasSavedLayout() : false, persistPanelStates: !isMobile ? (state) => persistPanelStates(state) : undefined, persistedPanelStates: getPersistedPanelStates(), children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true, minPanelSizePx: !isMobile ? 250 : 150 }) }) }) : tmSearchQueryPanelElement, showSearchResults && _jsx(TMSearchResult, { isVisible: isVisible && currentSearchView === TMSearchViews.Result, context: SearchResultContext.METADATA_SEARCH, searchResults: searchResult, floatingActionConfig: floatingActionConfig, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, openInOffice: openInOffice, onRefreshSearchAsync: onRefreshSearchAsync, onClose: () => { onlyShowSearchQueryPanel ? setShowSearchResults(false) : setCurrentSearchView(TMSearchViews.Search); }, onFileOpened: onFileOpened, onTaskCreateRequest: onTaskCreateRequest, openWGsCopyMoveForm: openWGsCopyMoveForm, openEditPdf: openEditPdf, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, passToArchiveCallback: passToArchiveCallback, onSelectedTIDChanged: onCurrentTIDChangedCallback, showTodoDcmtForm: showTodoDcmtForm, onReferenceClick: onReferenceClick, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers })] }));
|
|
223
248
|
};
|
|
224
249
|
export default TMSearch;
|
|
225
250
|
const TMTreeSelectorWrapper = ({ isMobile, onSelectedTIDChanged }) => {
|
|
@@ -55,6 +55,13 @@ export declare class SearchSettings {
|
|
|
55
55
|
defaultTree: number;
|
|
56
56
|
previewThreshold: number;
|
|
57
57
|
floatingMenuBar: FloatingMenuBarSettings;
|
|
58
|
+
panelLayout: {
|
|
59
|
+
[id: string]: {
|
|
60
|
+
visible: boolean;
|
|
61
|
+
width: string;
|
|
62
|
+
height: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
58
65
|
}
|
|
59
66
|
export declare class FloatingMenuBarSettings {
|
|
60
67
|
orientation: 'horizontal' | 'vertical';
|