@topconsultnpm/sdkui-react-beta 6.13.43 → 6.13.44
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/documents/TMDcmtForm.js +1 -1
- package/lib/components/features/search/TMSearch.js +153 -83
- package/lib/components/layout/panel/TMPanelContext.d.ts +1 -1
- package/lib/components/layout/panel/TMPanelContext.js +2 -2
- package/lib/components/layout/panel/TMPanelToolbar.js +2 -2
- package/lib/components/layout/panel/useResizablePanels.js +2 -2
- package/package.json +2 -2
@@ -454,7 +454,7 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
454
454
|
gap: SDKUI_Globals.userSettings.themeSettings.gutters,
|
455
455
|
width: '100%',
|
456
456
|
height: '100%',
|
457
|
-
}, children: [_jsx("div", { style: { flex: 1, minWidth: 0, height: '100%' }, children: _jsxs(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: useWaitPanelLocalState ? showWaitPanelLocal : showWaitPanel, showWaitPanelPrimary: useWaitPanelLocalState ? showPrimaryLocal : showPrimary, showWaitPanelSecondary: useWaitPanelLocalState ? showSecondaryLocal : showSecondary, waitPanelTitle: useWaitPanelLocalState ? waitPanelTitleLocal : waitPanelTitle, waitPanelTextPrimary: useWaitPanelLocalState ? waitPanelTextPrimaryLocal : waitPanelTextPrimary, waitPanelValuePrimary: useWaitPanelLocalState ? waitPanelValuePrimaryLocal : waitPanelValuePrimary, waitPanelMaxValuePrimary: useWaitPanelLocalState ? waitPanelMaxValuePrimaryLocal : waitPanelMaxValuePrimary, waitPanelTextSecondary: useWaitPanelLocalState ? waitPanelTextSecondaryLocal : waitPanelTextSecondary, waitPanelValueSecondary: useWaitPanelLocalState ? waitPanelValueSecondaryLocal : waitPanelValueSecondary, waitPanelMaxValueSecondary: useWaitPanelLocalState ? waitPanelMaxValueSecondaryLocal : waitPanelMaxValueSecondary, isCancelable: useWaitPanelLocalState ? dcmtFile ? dcmtFile.size >= 1000000 : false : true, abortController: useWaitPanelLocalState ? abortControllerLocal : abortController, children: [_jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorColor: 'transparent', showSeparator: (isOpenPreview || isOpenMiddlePanel()) && deviceType !== DeviceType.MOBILE && isOpenDcmtForm, start: getPrimarySplitterStartLayout(), min: deviceType !== DeviceType.MOBILE && isOpenDcmtForm ? ['150px', '0'] : ['0', '0'], children: [_jsx(TMLayoutItem, { children: _jsx(TMPanel, { showHeader: showHeader, title: fromDTD?.nameLoc, toolbar: allowNavigation ? formToolbar : _jsx(_Fragment, {}), onBack: isClosable && deviceType !== DeviceType.MOBILE ? undefined : handleClose, onClose: isClosable ? handleClose : undefined, children: metadataValuesSource.length > 0 && _jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, isExpertMode: isExpertMode, isOpenDistinctValues: isOpenDistinctValues, openChooserBySingleClick: !isOpenDistinctValues, selectedMID: focusedMetadataValue?.mid, layoutMode: layoutMode, deviceType: deviceType, validationItems: validationItems, onFocusedItemChanged: (item) => { (item?.mid !== focusedMetadataValue?.mid) && setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
|
457
|
+
}, children: [_jsx("div", { style: { flex: 1, minWidth: 0, height: '100%' }, children: _jsxs(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: useWaitPanelLocalState ? showWaitPanelLocal : showWaitPanel, showWaitPanelPrimary: useWaitPanelLocalState ? showPrimaryLocal : showPrimary, showWaitPanelSecondary: useWaitPanelLocalState ? showSecondaryLocal : showSecondary, waitPanelTitle: useWaitPanelLocalState ? waitPanelTitleLocal : waitPanelTitle, waitPanelTextPrimary: useWaitPanelLocalState ? waitPanelTextPrimaryLocal : waitPanelTextPrimary, waitPanelValuePrimary: useWaitPanelLocalState ? waitPanelValuePrimaryLocal : waitPanelValuePrimary, waitPanelMaxValuePrimary: useWaitPanelLocalState ? waitPanelMaxValuePrimaryLocal : waitPanelMaxValuePrimary, waitPanelTextSecondary: useWaitPanelLocalState ? waitPanelTextSecondaryLocal : waitPanelTextSecondary, waitPanelValueSecondary: useWaitPanelLocalState ? waitPanelValueSecondaryLocal : waitPanelValueSecondary, waitPanelMaxValueSecondary: useWaitPanelLocalState ? waitPanelMaxValueSecondaryLocal : waitPanelMaxValueSecondary, isCancelable: useWaitPanelLocalState ? dcmtFile ? dcmtFile.size >= 1000000 : false : true, abortController: useWaitPanelLocalState ? abortControllerLocal : abortController, children: [_jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorColor: 'transparent', showSeparator: (isOpenPreview || isOpenMiddlePanel()) && deviceType !== DeviceType.MOBILE && isOpenDcmtForm, start: getPrimarySplitterStartLayout(), min: deviceType !== DeviceType.MOBILE && isOpenDcmtForm ? ['150px', '0'] : ['0', '0'], children: [_jsx(TMLayoutItem, { children: _jsx(TMPanel, { showHeader: showHeader, title: fromDTD?.nameLoc, toolbar: allowNavigation ? formToolbar : _jsx(_Fragment, {}), onBack: (isClosable && deviceType !== DeviceType.MOBILE) ? undefined : handleClose, onClose: isClosable ? handleClose : undefined, children: metadataValuesSource.length > 0 && _jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, isExpertMode: isExpertMode, isOpenDistinctValues: isOpenDistinctValues, openChooserBySingleClick: !isOpenDistinctValues, selectedMID: focusedMetadataValue?.mid, layoutMode: layoutMode, deviceType: deviceType, validationItems: validationItems, onFocusedItemChanged: (item) => { (item?.mid !== focusedMetadataValue?.mid) && setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
|
458
458
|
setFormData((prevItems) => prevItems.map((item) => {
|
459
459
|
const newItem = newItems.find((newItem) => newItem.tid === item.tid && newItem.mid === item.mid);
|
460
460
|
return newItem ? { ...item, ...newItem } : item;
|
@@ -1,17 +1,21 @@
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import { useCallback, useEffect, useState } from 'react';
|
2
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
3
3
|
import { SavedQueryCacheService, DcmtTypeListCacheService, SDK_Localizator } from '@topconsultnpm/sdk-ts-beta';
|
4
4
|
import TMSavedQuerySelector from './TMSavedQuerySelector';
|
5
5
|
import TMTreeSelector from './TMTreeSelector';
|
6
6
|
import { TabPanel, Item } from 'devextreme-react/tab-panel';
|
7
7
|
import TMSearchQueryPanel, { refreshLastSearch } from './TMSearchQueryPanel';
|
8
|
-
import { getSysAllDcmtsSQD,
|
8
|
+
import { getSysAllDcmtsSQD, IconFilter, IconInfo, IconRecentlyViewed, IconSavedQuery, IconTree, SDKUI_Globals, SDKUI_Localizator } from '../../../helper';
|
9
9
|
import TMSearchResult from './TMSearchResult';
|
10
10
|
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 { TMPanelManagerContextProvider, useTMPanelContext } from '../../layout/panel/TMPanelContext';
|
15
|
+
import { TMPanelToolbar } from '../../layout/panel/TMPanelToolbar';
|
16
|
+
import { useResizablePanels } from '../../layout/panel/useResizablePanels';
|
17
|
+
import TMPanel from '../../base/TMPanel';
|
18
|
+
import { Gutters } from '../../../utils/theme';
|
15
19
|
var TMSearchViews;
|
16
20
|
(function (TMSearchViews) {
|
17
21
|
TMSearchViews[TMSearchViews["Search"] = 0] = "Search";
|
@@ -118,18 +122,18 @@ const TMSearch = ({ inputTID, inputSqdID, isExpertMode = SDKUI_Globals.userSetti
|
|
118
122
|
await setSqdAsync?.(sqdToBeSet);
|
119
123
|
}, []);
|
120
124
|
const isMobile = deviceType === DeviceType.MOBILE;
|
121
|
-
const renderTMTreeSelector = (handleTogglePanel) => _jsx(TMTreeSelector, { onClosePanel: () => handleTogglePanel('TMTreeSelector'), onSelectedTIDChanged: (tid) => {
|
125
|
+
const renderTMTreeSelector = (handleTogglePanel) => _jsx(TMTreeSelector, { onClosePanel: () => handleTogglePanel?.('TMTreeSelector'), onSelectedTIDChanged: (tid) => {
|
122
126
|
setCurrentTID(tid);
|
123
127
|
if (tid && mruTIDs.includes(tid))
|
124
128
|
setCurrentMruTID(tid);
|
125
129
|
else
|
126
130
|
setCurrentMruTID(0);
|
127
|
-
isMobile && handleTogglePanel('TMSearchQueryPanel');
|
131
|
+
isMobile && handleTogglePanel?.('TMSearchQueryPanel');
|
128
132
|
} });
|
129
133
|
const renderTMRecentsManager = (handleTogglePanel) => _jsx(TMRecentsManager, { mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => {
|
130
134
|
setCurrentMruTID(tid);
|
131
135
|
setCurrentTID(tid);
|
132
|
-
isMobile && handleTogglePanel('TMSearchQueryPanel');
|
136
|
+
isMobile && handleTogglePanel?.('TMSearchQueryPanel');
|
133
137
|
}, onDeletedTID: (tid) => {
|
134
138
|
let newMruTIDS = mruTIDs.slice();
|
135
139
|
let index = newMruTIDS.findIndex(o => o == tid);
|
@@ -162,90 +166,156 @@ const TMSearch = ({ inputTID, inputSqdID, isExpertMode = SDKUI_Globals.userSetti
|
|
162
166
|
} });
|
163
167
|
const renderTMSavedQuerySelector = (handleTogglePanel) => _jsxs(TabPanel, { width: "100%", height: "100%", showNavButtons: true, repaintChangesOnly: true, selectedIndex: currentSQDMode, onSelectedIndexChange: (index) => setCurrentSQDMode(index), children: [(currentTID || currentSQD) ? _jsx(Item, { title: fromDTD?.nameLoc, children: _jsx(TMSavedQuerySelector, { allowShowSearch: false, items: filteredByTIDSQDs, selectedId: currentSQD?.id, onRefreshData: () => { loadDataSQDsAsync(true); }, onItemClick: (sqd) => {
|
164
168
|
onSQDItemClick(sqd, setSQDAsync);
|
165
|
-
isMobile && handleTogglePanel('TMSearchQueryPanel');
|
169
|
+
isMobile && handleTogglePanel?.('TMSearchQueryPanel');
|
166
170
|
}, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? filteredByTIDSQDs.find(o => o.id == 1) : currentSQD, setSQDAsync) }) }) : _jsx(_Fragment, {}), _jsx(Item, { title: SDKUI_Localizator.Alls2, children: _jsx(TMSavedQuerySelector, { allowShowSearch: true, items: allSQDs, manageDefault: false,
|
167
171
|
// selectedId={currentSQD?.id}
|
168
172
|
onItemClick: (sqd) => {
|
169
173
|
onSQDItemClick(sqd, setSQDAsync);
|
170
|
-
isMobile && handleTogglePanel('TMSearchQueryPanel');
|
174
|
+
isMobile && handleTogglePanel?.('TMSearchQueryPanel');
|
171
175
|
}, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? undefined : currentSQD, setSQDAsync) }) })] });
|
172
|
-
|
173
|
-
{
|
174
|
-
id: 'TMTreeSelector',
|
175
|
-
name: SDK_Localizator.Trees,
|
176
|
-
toolbarOptions: { icon: _jsx(IconTree, { fontSize: 24 }), visible: true, isActive: true, orderNumber: 1 },
|
177
|
-
type: 'content',
|
178
|
-
contentOptions: {
|
179
|
-
visible: true,
|
180
|
-
height: '100%',
|
181
|
-
width: '20%',
|
182
|
-
content: renderTMTreeSelector,
|
183
|
-
},
|
184
|
-
},
|
185
|
-
{
|
186
|
-
id: 'TMRecentsManager',
|
187
|
-
name: "Scorciatoie",
|
188
|
-
toolbarOptions: { icon: _jsx(IconRecentlyViewed, { fontSize: 24 }), visible: true, isActive: true, orderNumber: 2 },
|
189
|
-
type: 'content',
|
190
|
-
contentOptions: {
|
191
|
-
visible: true,
|
192
|
-
height: '100%',
|
193
|
-
width: '20%',
|
194
|
-
content: (handleTogglePanel) => renderTMRecentsManager(handleTogglePanel),
|
195
|
-
panelContainer: {
|
196
|
-
title: "Scorciatoie",
|
197
|
-
totalItems: mruTIDs.length,
|
198
|
-
allowMaximize: !isMobile
|
199
|
-
},
|
200
|
-
},
|
201
|
-
},
|
202
|
-
{
|
203
|
-
id: 'TMSearchQueryPanel',
|
204
|
-
name: SDK_Localizator.QueryWhere,
|
205
|
-
toolbarOptions: { icon: _jsx(IconFilter, { fontSize: 24 }), visible: true, isActive: true, orderNumber: 3 },
|
206
|
-
type: 'content',
|
207
|
-
contentOptions: {
|
208
|
-
visible: true,
|
209
|
-
height: '100%',
|
210
|
-
width: '40%',
|
211
|
-
content: renderTMSearchQueryPanel,
|
212
|
-
},
|
213
|
-
},
|
214
|
-
{
|
215
|
-
id: 'TMSavedQuerySelector',
|
216
|
-
name: SDK_Localizator.SavedQueries,
|
217
|
-
toolbarOptions: { icon: _jsx(IconSavedQuery, { fontSize: 24 }), visible: true, isActive: true, orderNumber: 4 },
|
218
|
-
type: 'content',
|
219
|
-
contentOptions: {
|
220
|
-
visible: true,
|
221
|
-
height: '100%',
|
222
|
-
width: '20%',
|
223
|
-
content: renderTMSavedQuerySelector,
|
224
|
-
panelContainer: {
|
225
|
-
title: SDK_Localizator.SavedQueries,
|
226
|
-
allowMaximize: !isMobile
|
227
|
-
},
|
228
|
-
},
|
229
|
-
},
|
230
|
-
{
|
231
|
-
id: 'goToResult',
|
232
|
-
name: 'Vai a risultato',
|
233
|
-
toolbarOptions: {
|
234
|
-
icon: _jsx(IconArrowRight, { fontSize: 24 }),
|
235
|
-
visible: searchResult.length > 0,
|
236
|
-
isActive: searchResult.length > 0,
|
237
|
-
orderNumber: 5,
|
238
|
-
beginGroup: true
|
239
|
-
},
|
240
|
-
type: 'button',
|
241
|
-
buttonOptions: {
|
242
|
-
onClick: () => setCurrentSearchView(TMSearchViews.Result),
|
243
|
-
},
|
244
|
-
},
|
245
|
-
];
|
246
|
-
return (_jsxs(_Fragment, { children: [_jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.Search, children: _jsx(TMPanelManager, { panels: panelsConfig, initialMobilePanelId: 'TMRecentsManager', toolbarMode: 1 }) }), searchResult.length > 0 &&
|
176
|
+
return (_jsxs(_Fragment, { children: [_jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.Search, children: _jsx(TMPanelManagerContextProvider, { panels: panels, initialMobilePanelId: "TMRecentsManager", children: _jsx(TMSearchPanelContent, { isMobile: isMobile, panelTMTreeSelector: renderTMTreeSelector, panelTMRecentsManager: renderTMRecentsManager, panelTMSearchQueryPanel: renderTMSearchQueryPanel(), panelTMSavedQuerySelector: renderTMSavedQuerySelector }) }) }), searchResult.length > 0 &&
|
247
177
|
_jsx(TMSearchResult, { isVisible: currentSearchView === TMSearchViews.Result, context: SearchResultContext.METADATA_SEARCH, searchResults: searchResult, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, onRefreshSearchAsync: async () => {
|
248
178
|
setSearchResult(await refreshLastSearch(lastQdSearched) ?? []);
|
249
179
|
}, onTaskCreateRequest: onTaskCreateRequest, onClose: () => { setCurrentSearchView(TMSearchViews.Search); } })] }));
|
250
180
|
};
|
181
|
+
const TMSearchPanelContent = ({ isMobile, panelTMTreeSelector, panelTMRecentsManager, panelTMSearchQueryPanel, panelTMSavedQuerySelector }) => {
|
182
|
+
const gutters = Gutters.getGutters();
|
183
|
+
console.log('TMSearchPanelContent gutters', gutters);
|
184
|
+
const { visibility, maximizedPanelId, getPanelDimensions, togglePanel, toggleMaximizePanel, setPanelDisabledById, setPanelVisibility, hasVisiblePanels } = useTMPanelContext();
|
185
|
+
const containerRef = useRef(null);
|
186
|
+
const { onMouseDown } = useResizablePanels(containerRef);
|
187
|
+
const { width: widthPanel1, height: heightPanel1 } = getPanelDimensions('TMTreeSelector');
|
188
|
+
const { width: widthPanel2, height: heightPanel2 } = getPanelDimensions('TMRecentsManager');
|
189
|
+
const { width: widthPanel3, height: heightPanel3 } = getPanelDimensions('TMSearchQueryPanel');
|
190
|
+
const { width: widthPanel4, height: heightPanel4 } = getPanelDimensions('TMSavedQuerySelector');
|
191
|
+
return (_jsxs("div", { style: { display: 'flex', height: '100%', width: '100%', flexDirection: isMobile ? 'column' : 'row', gap: gutters }, children: [_jsx("div", { style: {
|
192
|
+
display: 'flex',
|
193
|
+
flexGrow: 1,
|
194
|
+
width: `calc(100% - ${isMobile ? 0 : 70}px)`,
|
195
|
+
height: `calc(100% - ${isMobile ? 55 : 0}px)`,
|
196
|
+
flexDirection: 'row'
|
197
|
+
}, children: _jsxs("div", { style: { width: '100%', height: '100%' }, children: [_jsxs("div", { ref: containerRef, style: {
|
198
|
+
display: hasVisiblePanels() ? 'flex' : 'none',
|
199
|
+
width: '100%',
|
200
|
+
height: '100%',
|
201
|
+
}, children: [_jsx("div", { style: {
|
202
|
+
display: visibility.TMTreeSelector ? 'block' : 'none',
|
203
|
+
width: widthPanel1,
|
204
|
+
height: heightPanel1,
|
205
|
+
overflow: 'hidden',
|
206
|
+
}, children: panelTMTreeSelector(() => togglePanel('TMSearchQueryPanel')) }), visibility.TMTreeSelector && visibility.TMRecentsManager && maximizedPanelId === null && (_jsx("div", { style: {
|
207
|
+
background: 'transparent',
|
208
|
+
cursor: 'col-resize',
|
209
|
+
width: `${gutters}px`,
|
210
|
+
height: '100%',
|
211
|
+
userSelect: 'none',
|
212
|
+
}, onMouseDown: (e) => onMouseDown(e, 'TMTreeSelector', 'TMRecentsManager', true) })), _jsx("div", { style: {
|
213
|
+
display: visibility.TMRecentsManager ? 'block' : 'none',
|
214
|
+
width: widthPanel2,
|
215
|
+
height: heightPanel2,
|
216
|
+
overflow: 'hidden',
|
217
|
+
}, children: _jsx(TMPanel, { title: 'Scorciatoie', onClose: () => togglePanel('TMRecentsManager'), onMaximize: () => toggleMaximizePanel('TMRecentsManager'), onHeaderDoubleClick: () => toggleMaximizePanel('TMRecentsManager'), allowMaximize: !isMobile, children: panelTMRecentsManager(() => togglePanel('TMSearchQueryPanel')) }) }), visibility.TMRecentsManager && visibility.TMSearchQueryPanel && maximizedPanelId === null && (_jsx("div", { style: {
|
218
|
+
background: 'transparent',
|
219
|
+
cursor: 'col-resize',
|
220
|
+
width: `${gutters}px`,
|
221
|
+
height: '100%',
|
222
|
+
userSelect: 'none',
|
223
|
+
}, onMouseDown: (e) => onMouseDown(e, 'TMRecentsManager', 'TMSearchQueryPanel', true) })), _jsx("div", { style: {
|
224
|
+
display: visibility.TMSearchQueryPanel ? 'block' : 'none',
|
225
|
+
width: widthPanel3,
|
226
|
+
height: heightPanel3,
|
227
|
+
overflow: 'hidden',
|
228
|
+
}, children: panelTMSearchQueryPanel }), visibility.TMSearchQueryPanel && visibility.TMSavedQuerySelector && maximizedPanelId === null && (_jsx("div", { style: {
|
229
|
+
background: 'transparent',
|
230
|
+
cursor: 'col-resize',
|
231
|
+
width: `${gutters}px`,
|
232
|
+
height: '100%',
|
233
|
+
userSelect: 'none',
|
234
|
+
}, onMouseDown: (e) => onMouseDown(e, 'TMSearchQueryPanel', 'TMSavedQuerySelector', true) })), _jsx("div", { style: {
|
235
|
+
display: visibility.TMSavedQuerySelector ? 'block' : 'none',
|
236
|
+
width: widthPanel4,
|
237
|
+
height: heightPanel4,
|
238
|
+
overflow: 'hidden',
|
239
|
+
}, children: _jsx(TMPanel, { title: SDK_Localizator.SavedQueries, onClose: () => togglePanel('TMSavedQuerySelector'), onMaximize: () => toggleMaximizePanel('TMSavedQuerySelector'), onHeaderDoubleClick: () => toggleMaximizePanel('TMSavedQuerySelector'), allowMaximize: !isMobile, children: panelTMSavedQuerySelector(() => togglePanel('TMSearchQueryPanel')) }) })] }), _jsxs("div", { style: {
|
240
|
+
display: hasVisiblePanels() ? 'none' : 'flex',
|
241
|
+
flexDirection: 'column',
|
242
|
+
width: '100%',
|
243
|
+
height: '100%',
|
244
|
+
justifyContent: 'center',
|
245
|
+
alignItems: 'center',
|
246
|
+
fontSize: '1.5rem',
|
247
|
+
fontWeight: 'bold',
|
248
|
+
color: '#888',
|
249
|
+
backgroundColor: '#fff',
|
250
|
+
borderRadius: '10px'
|
251
|
+
}, children: [_jsx(IconInfo, { style: { fontSize: 50 } }), _jsx("div", { children: SDKUI_Localizator.NoPanelSelected })] })] }) }), _jsx("div", { style: {
|
252
|
+
display: 'flex',
|
253
|
+
flexDirection: isMobile ? 'row' : 'column',
|
254
|
+
alignItems: 'center',
|
255
|
+
width: isMobile ? '100%' : '50px',
|
256
|
+
height: isMobile ? '50px' : 'max-content',
|
257
|
+
background: 'transparent linear-gradient(90deg, #CCE0F4 0%, #7EC1E7 14%, #39A6DB 28%, #1E9CD7 35%, #0075BE 78%, #005B97 99%) 0% 0% no-repeat padding-box',
|
258
|
+
borderRadius: isMobile ? '10px' : '10px 0px 0px 10px',
|
259
|
+
padding: '10px',
|
260
|
+
gap: '10px'
|
261
|
+
}, children: _jsx(TMPanelToolbar, {}) })] }));
|
262
|
+
};
|
251
263
|
export default TMSearch;
|
264
|
+
const panels = [
|
265
|
+
{
|
266
|
+
id: 'TMTreeSelector',
|
267
|
+
name: SDK_Localizator.Trees,
|
268
|
+
children: [],
|
269
|
+
contentOptions: {
|
270
|
+
width: '20%',
|
271
|
+
height: '100%',
|
272
|
+
},
|
273
|
+
toolbarOptions: {
|
274
|
+
icon: _jsx(IconTree, { fontSize: 24 }),
|
275
|
+
visible: true,
|
276
|
+
isActive: true
|
277
|
+
}
|
278
|
+
},
|
279
|
+
{
|
280
|
+
id: 'TMRecentsManager',
|
281
|
+
name: 'Scorciatoie',
|
282
|
+
children: [],
|
283
|
+
contentOptions: {
|
284
|
+
width: '20%',
|
285
|
+
height: '100%',
|
286
|
+
},
|
287
|
+
toolbarOptions: {
|
288
|
+
icon: _jsx(IconRecentlyViewed, { fontSize: 24 }),
|
289
|
+
visible: true,
|
290
|
+
isActive: true
|
291
|
+
}
|
292
|
+
},
|
293
|
+
{
|
294
|
+
id: 'TMSearchQueryPanel',
|
295
|
+
name: SDK_Localizator.QueryWhere,
|
296
|
+
children: [],
|
297
|
+
contentOptions: {
|
298
|
+
width: '40%',
|
299
|
+
height: '100%',
|
300
|
+
},
|
301
|
+
toolbarOptions: {
|
302
|
+
icon: _jsx(IconFilter, { fontSize: 24 }),
|
303
|
+
visible: false,
|
304
|
+
isActive: true
|
305
|
+
}
|
306
|
+
},
|
307
|
+
{
|
308
|
+
id: 'TMSavedQuerySelector',
|
309
|
+
name: SDK_Localizator.SavedQueries,
|
310
|
+
children: [],
|
311
|
+
contentOptions: {
|
312
|
+
width: '20%',
|
313
|
+
height: '100%',
|
314
|
+
},
|
315
|
+
toolbarOptions: {
|
316
|
+
icon: _jsx(IconSavedQuery, { fontSize: 24 }),
|
317
|
+
visible: true,
|
318
|
+
isActive: true
|
319
|
+
}
|
320
|
+
},
|
321
|
+
];
|
@@ -35,7 +35,7 @@ interface ITMPanelManagerContext {
|
|
35
35
|
setPanelDisabledById: (id: string, disabled: boolean) => void;
|
36
36
|
hasVisiblePanels: () => boolean;
|
37
37
|
}
|
38
|
-
export declare function
|
38
|
+
export declare function useTMPanelContext(): ITMPanelManagerContext;
|
39
39
|
interface TMPanelContextProviderProps {
|
40
40
|
panels: Array<TMPanelManagerItemContext>;
|
41
41
|
initialMobilePanelId: string;
|
@@ -4,10 +4,10 @@ import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
|
|
4
4
|
// Creazione del context
|
5
5
|
const TMPanelManagerContext = createContext(undefined);
|
6
6
|
// Hook custom per accedere al context
|
7
|
-
export function
|
7
|
+
export function useTMPanelContext() {
|
8
8
|
const context = useContext(TMPanelManagerContext);
|
9
9
|
if (!context) {
|
10
|
-
throw new Error('
|
10
|
+
throw new Error('useTMPanelContext must be used within a TMPanelContextProvider');
|
11
11
|
}
|
12
12
|
return context;
|
13
13
|
}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { useMemo } from 'react';
|
3
|
-
import {
|
3
|
+
import { useTMPanelContext } from './TMPanelContext';
|
4
4
|
import styled from 'styled-components';
|
5
5
|
import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
|
6
6
|
import TMTooltip from '../../base/TMTooltip';
|
7
7
|
export const TMPanelToolbar = () => {
|
8
|
-
const { panelTree, togglePanel, calculateEffectiveVisibility } =
|
8
|
+
const { panelTree, togglePanel, calculateEffectiveVisibility } = useTMPanelContext();
|
9
9
|
const deviceType = useDeviceType();
|
10
10
|
let isMobile = useMemo(() => { return deviceType === DeviceType.MOBILE; }, [deviceType]);
|
11
11
|
// Ricorsivamente trova tutti i pannelli parent (hanno figli)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { useRef, useCallback } from 'react';
|
2
|
-
import {
|
2
|
+
import { useTMPanelContext } from './TMPanelContext';
|
3
3
|
export function useResizablePanels(containerRef) {
|
4
|
-
const { getPanelDimensions, updatePanelSize } =
|
4
|
+
const { getPanelDimensions, updatePanelSize } = useTMPanelContext();
|
5
5
|
const resizingRef = useRef(null);
|
6
6
|
const getSizePercent = useCallback((panelId, isRow) => {
|
7
7
|
const dim = getPanelDimensions(panelId);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@topconsultnpm/sdkui-react-beta",
|
3
|
-
"version": "6.13.
|
3
|
+
"version": "6.13.44",
|
4
4
|
"description": "",
|
5
5
|
"scripts": {
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
@@ -42,7 +42,7 @@
|
|
42
42
|
"lib"
|
43
43
|
],
|
44
44
|
"dependencies": {
|
45
|
-
"@topconsultnpm/sdk-ts-beta": "6.13.
|
45
|
+
"@topconsultnpm/sdk-ts-beta": "6.13.8",
|
46
46
|
"buffer": "^6.0.3",
|
47
47
|
"devextreme": "24.2.6",
|
48
48
|
"devextreme-react": "24.2.6",
|