@topconsultnpm/sdkui-react-beta 6.13.37 → 6.13.39

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.
@@ -102,8 +102,12 @@ const TMPanel = ({ allowMaximize = true, color, backgroundColor, backgroundColor
102
102
  ...(minWidth ? { minWidth } : {}),
103
103
  visibility: isVisible ? 'visible' : 'hidden',
104
104
  }, children: [showHeader &&
105
- _jsx(StyledPanelHeader, { "$backgroundColor": backgroundColor, "$color": color, "$isActive": isActive, onDoubleClick: () => { if (onHeaderDoubleClick)
106
- onHeaderDoubleClick(); }, tabIndex: -1, onFocus: handleFocus, onBlur: handleBlur, onClick: handleFocus, children: _jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', width: '100%' }, children: [_jsxs("div", { ref: titleRowRef, style: { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: '8px' }, children: [onBack &&
105
+ _jsx(StyledPanelHeader, { "$backgroundColor": backgroundColor, "$color": color, "$isActive": isActive, onDoubleClick: () => {
106
+ if (onHeaderDoubleClick)
107
+ onHeaderDoubleClick();
108
+ else
109
+ allowMaximize && handleMaximize();
110
+ }, tabIndex: -1, onFocus: handleFocus, onBlur: handleBlur, onClick: handleFocus, children: _jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', width: '100%' }, children: [_jsxs("div", { ref: titleRowRef, style: { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: '8px' }, children: [onBack &&
107
111
  _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconArrowLeft, {}), caption: SDKUI_Localizator.Back, onClick: onBack }), _jsx("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center' }, children: _jsxs("p", { style: {
108
112
  whiteSpace: 'nowrap',
109
113
  overflow: 'hidden',
@@ -3,6 +3,7 @@ type TMPanelManagerProps = {
3
3
  panels: Array<TMPanelItemConfig>;
4
4
  initialMobilePanelId: string;
5
5
  showToolbar?: boolean;
6
+ toolbarMode?: number;
6
7
  gutters?: number;
7
8
  };
8
9
  declare const TMPanelManager: (props: TMPanelManagerProps) => import("react/jsx-runtime").JSX.Element;
@@ -6,7 +6,7 @@ import { useDeviceType, DeviceType } from './TMDeviceProvider';
6
6
  import TMPanel from './TMPanel';
7
7
  import TMPanelManagerToolbar from './TMPanelManagerToolbar';
8
8
  const TMPanelManager = (props) => {
9
- const { panels, initialMobilePanelId, showToolbar = true, gutters = SDKUI_Globals.userSettings.themeSettings.gutters } = props;
9
+ const { panels, initialMobilePanelId, showToolbar = true, toolbarMode = 0, gutters = SDKUI_Globals.userSettings.themeSettings.gutters } = props;
10
10
  const deviceType = useDeviceType();
11
11
  let isMobile = useMemo(() => { return deviceType === DeviceType.MOBILE; }, [deviceType]);
12
12
  const allPanels = useMemo(() => flattenPanels(panels), [panels]);
@@ -82,7 +82,7 @@ const TMPanelManager = (props) => {
82
82
  }
83
83
  else if (maximizedPanelPath.length > 0) {
84
84
  // If at least one panel is maximized, collapse all others to zero size
85
- newState.set(panelId, { ...currentPanel, width: '0', height: '0' });
85
+ newState.set(panelId, { ...currentPanel, width: '0%', height: '0%' });
86
86
  }
87
87
  else {
88
88
  // If no panels are maximized, restore their original dimensions
@@ -431,7 +431,7 @@ const TMPanelManager = (props) => {
431
431
  } }))] }, fullId));
432
432
  });
433
433
  };
434
- return (_jsxs("div", { style: { display: 'flex', flexDirection: isMobile ? 'column' : 'row', height: '100%', width: '100%' }, children: [_jsx("div", { style: {
434
+ return (_jsxs("div", { style: { display: 'flex', flexDirection: isMobile ? 'column' : 'row', height: '100%', width: '100%', gap: gutters }, children: [_jsx("div", { style: {
435
435
  display: 'flex',
436
436
  flexGrow: 1,
437
437
  width: isAtLeastOnePanelVisible(activeButtons) ? `calc(100% - ${showToolbar ? (isMobile ? 0 : 60) : 0}px)` : '0%',
@@ -450,7 +450,7 @@ const TMPanelManager = (props) => {
450
450
  textAlign: 'center',
451
451
  color: '#555',
452
452
  fontSize: '18px',
453
- }, children: [_jsx(IconInfo, { style: { fontSize: 50 } }), _jsx("div", { children: SDKUI_Localizator.NoPanelSelected })] })), showToolbar && _jsx("div", { style: {
453
+ }, children: [_jsx(IconInfo, { style: { fontSize: 50 } }), _jsx("div", { children: SDKUI_Localizator.NoPanelSelected })] })), showToolbar && _jsx("div", { style: toolbarMode === 0 ? {
454
454
  width: isMobile ? '100%' : '60px',
455
455
  height: isMobile ? '60px' : '100%',
456
456
  borderLeft: '1px solid #ccc',
@@ -460,6 +460,16 @@ const TMPanelManager = (props) => {
460
460
  boxSizing: 'border-box',
461
461
  gap: '6px',
462
462
  backgroundColor: '#f9f9f9',
463
- }, children: _jsx(TMPanelManagerToolbar, { allPanels: allPanels, activeButtons: activeButtons, handleTogglePanel: handleTogglePanel, updatedDisabledButton: updatedDisabledButton, updatedVisibleButton: updatedVisibleButton }) })] }));
463
+ } : {
464
+ display: 'flex',
465
+ flexDirection: isMobile ? 'row' : 'column',
466
+ alignItems: 'center',
467
+ width: isMobile ? '100%' : '50px',
468
+ height: isMobile ? '50px' : 'max-content',
469
+ background: 'transparent linear-gradient(90deg, #CCE0F4 0%, #7EC1E7 14%, #39A6DB 28%, #1E9CD7 35%, #0075BE 78%, #005B97 99%) 0% 0% no-repeat padding-box',
470
+ borderRadius: isMobile ? '10px' : '10px 0px 0px 10px',
471
+ padding: '10px',
472
+ gap: '10px'
473
+ }, children: _jsx(TMPanelManagerToolbar, { allPanels: allPanels, activeButtons: activeButtons, handleTogglePanel: handleTogglePanel, updatedDisabledButton: updatedDisabledButton, updatedVisibleButton: updatedVisibleButton, toolbarMode: toolbarMode }) })] }));
464
474
  };
465
475
  export default TMPanelManager;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { TMPanelEntry } from './TMPanelManagerUtils';
2
3
  interface TNPanelManagerToolbarProps {
3
4
  allPanels: Array<TMPanelEntry>;
@@ -11,6 +12,12 @@ interface TNPanelManagerToolbarProps {
11
12
  id: string;
12
13
  value: boolean;
13
14
  };
15
+ toolbarMode?: number;
14
16
  }
15
17
  declare const TMPanelManagerToolbar: (props: TNPanelManagerToolbarProps) => import("react/jsx-runtime").JSX.Element;
16
18
  export default TMPanelManagerToolbar;
19
+ export declare const StyledToolbarButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
20
+ $toolbarMode?: number;
21
+ $isActive?: boolean;
22
+ $isDisabled?: boolean;
23
+ }>> & string;
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useEffect, useMemo, useState } from 'react';
3
+ import styled from 'styled-components';
3
4
  import { useDeviceType, DeviceType } from './TMDeviceProvider';
4
5
  import TMTooltip from './TMTooltip';
5
6
  const TMPanelManagerToolbar = (props) => {
6
- const { allPanels, activeButtons, handleTogglePanel, updatedDisabledButton, updatedVisibleButton } = props;
7
+ const { allPanels, activeButtons, handleTogglePanel, updatedDisabledButton, updatedVisibleButton, toolbarMode = 0 } = props;
7
8
  const deviceType = useDeviceType();
8
9
  let isMobile = useMemo(() => { return deviceType === DeviceType.MOBILE; }, [deviceType]);
9
10
  const [filteredPanels, setFilteredPanels] = useState([]);
@@ -57,7 +58,8 @@ const TMPanelManagerToolbar = (props) => {
57
58
  display: 'flex',
58
59
  flexDirection: isMobile ? 'row' : 'column',
59
60
  gap: '6px',
60
- alignItems: isMobile ? 'center' : 'flex-start',
61
+ // alignItems: isMobile ? 'center' : 'flex-start',
62
+ alignItems: 'center',
61
63
  justifyContent: isMobile ? 'center' : 'flex-start',
62
64
  width: '100%',
63
65
  height: '100%',
@@ -74,23 +76,8 @@ const TMPanelManagerToolbar = (props) => {
74
76
  alignSelf: 'center',
75
77
  } }, `sep-${p.fullId}`)) : null;
76
78
  // Button JSX
77
- const button = (_jsx(TMTooltip, { content: p.config.name, position: isMobile ? 'top' : 'left', children: _jsx("button", { disabled: isToolbarDisabled, onClick: () => { handleTogglePanel(p.fullId); if (handleClick)
78
- handleClick(); }, style: {
79
- display: 'flex',
80
- alignItems: 'center',
81
- justifyContent: 'center',
82
- height: '40px',
83
- width: '40px',
84
- border: 'none',
85
- borderRadius: '10px',
86
- fontSize: '18px',
87
- padding: '8px 10px',
88
- color: '#fff',
89
- transition: 'transform 0.2s ease, box-shadow 0.2s ease',
90
- cursor: isToolbarDisabled ? 'not-allowed' : 'pointer',
91
- opacity: isToolbarDisabled ? 0.6 : 1,
92
- backgroundColor: isActive || p.config.toolbarOptions?.alwaysActiveColor ? '#81c784' : '#e57373',
93
- }, onMouseEnter: (e) => { if (!isToolbarDisabled) {
79
+ const button = (_jsx(TMTooltip, { content: p.config.name, position: isMobile ? 'top' : 'left', children: _jsx(StyledToolbarButton, { "$toolbarMode": toolbarMode, "$isActive": isActive || p.config.toolbarOptions?.alwaysActiveColor, "$isDisabled": isToolbarDisabled, disabled: isToolbarDisabled, onClick: () => { handleTogglePanel(p.fullId); if (handleClick)
80
+ handleClick(); }, onMouseEnter: (e) => { if (!isToolbarDisabled && toolbarMode === 0) {
94
81
  e.currentTarget.style.transform = 'scale(1.1)';
95
82
  } }, onMouseLeave: (e) => { e.currentTarget.style.transform = 'scale(1)'; }, children: typeof p.config.toolbarOptions?.icon === 'string' ? (_jsx("i", { className: `dx-icon dx-icon-${p.config.toolbarOptions?.icon}` })) : (p.config.toolbarOptions?.icon) }) }, p.fullId));
96
83
  // Return separator first, then button
@@ -98,3 +85,25 @@ const TMPanelManagerToolbar = (props) => {
98
85
  }) }));
99
86
  };
100
87
  export default TMPanelManagerToolbar;
88
+ export const StyledToolbarButton = styled.button `
89
+ display: flex;
90
+ align-items: center;
91
+ justify-content: center;
92
+ height: ${({ $toolbarMode }) => ($toolbarMode === 0 ? '40px' : '32px')};
93
+ width: ${({ $toolbarMode }) => ($toolbarMode === 0 ? '40px' : '32px')};
94
+ border: none;
95
+ border-radius: ${({ $toolbarMode }) => ($toolbarMode === 0 ? '10px' : '8px')};
96
+ font-size: 18px;
97
+ padding: ${({ $toolbarMode }) => ($toolbarMode === 0 ? '8px 10px' : '0px')}; ;
98
+ color: #fff;
99
+ transition: transform 0.2s ease, box-shadow 0.2s ease;
100
+ cursor: ${({ $isDisabled }) => ($isDisabled ? 'not-allowed' : 'pointer')};
101
+ opacity: ${({ $isDisabled }) => ($isDisabled ? 0.6 : 1)};
102
+ background: ${({ $toolbarMode, $isActive }) => $toolbarMode === 0
103
+ ? ($isActive ? '#81c784' : '#e57373')
104
+ : ($isActive ? 'rgba(255,255,255,0.35)' : 'transparent')};
105
+
106
+ &:hover {
107
+ background: ${({ $toolbarMode, $isDisabled }) => $toolbarMode !== 0 && !$isDisabled ? 'rgba(255,255,255,0.35)' : undefined};
108
+ }
109
+ `;
@@ -51,7 +51,7 @@ const TMArchive = ({ inputTID }) => {
51
51
  gap: SDKUI_Globals.userSettings.themeSettings.gutters,
52
52
  width: '100%',
53
53
  height: '100%',
54
- }, children: [_jsx("div", { style: { flex: 1, minWidth: 0, height: '100%' }, children: _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, showSeparator: deviceType !== DeviceType.MOBILE && showTreesPanel, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: getPrimarySplitterStartValues(), children: [showTreesPanel ? _jsx(TMLayoutItem, { children: deviceType !== DeviceType.MOBILE && _jsx(TMTreeSelector, { onClose: () => setShowTreesPanel(false), layoutMode: LayoutModes.Ark, onSelectedTIDChanged: (tid) => { setSearchByTID(tid); } }) }) : _jsx(_Fragment, {}), _jsx(TMLayoutItem, { children: _jsxs(TMSplitterLayout, { separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, direction: 'horizontal', overflow: 'visible', showSeparator: deviceType !== DeviceType.MOBILE && showRecentsPanel, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: getSecondarySplitterStartValues(), children: [showRecentsPanel ? _jsx(TMLayoutItem, { children: _jsx(TMPanel, { title: 'Recenti', onClose: () => setShowRecentsPanel(false), totalItems: mruTIDs.length, children: _jsx(TMRecentsManager, { mruTIDs: mruTIDs, deviceType: deviceType, onSelectedTID: (tid) => setCurrentTID(tid), onDeletedTID: (tid) => {
54
+ }, children: [_jsx("div", { style: { flex: 1, minWidth: 0, height: '100%' }, children: _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, showSeparator: deviceType !== DeviceType.MOBILE && showTreesPanel, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: getPrimarySplitterStartValues(), children: [showTreesPanel ? _jsx(TMLayoutItem, { children: deviceType !== DeviceType.MOBILE && _jsx(TMTreeSelector, { onClosePanel: () => setShowTreesPanel(false), layoutMode: LayoutModes.Ark, onSelectedTIDChanged: (tid) => { setSearchByTID(tid); } }) }) : _jsx(_Fragment, {}), _jsx(TMLayoutItem, { children: _jsxs(TMSplitterLayout, { separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, direction: 'horizontal', overflow: 'visible', showSeparator: deviceType !== DeviceType.MOBILE && showRecentsPanel, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: getSecondarySplitterStartValues(), children: [showRecentsPanel ? _jsx(TMLayoutItem, { children: _jsx(TMPanel, { title: 'Recenti', onClose: () => setShowRecentsPanel(false), totalItems: mruTIDs.length, children: _jsx(TMRecentsManager, { mruTIDs: mruTIDs, deviceType: deviceType, onSelectedTID: (tid) => setCurrentTID(tid), onDeletedTID: (tid) => {
55
55
  let newMruTIDS = mruTIDs.slice();
56
56
  let index = newMruTIDS.findIndex(o => o == tid);
57
57
  if (index >= 0)
@@ -1,22 +1,20 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, 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, IconArrowRight, IconProgressReady, IconSavedQuery, IconTree, SDKUI_Globals, SDKUI_Localizator } from '../../../helper';
9
- import { TMLayoutItem, TMSplitterLayout } from '../../base/TMLayout';
10
- import TMPanel from '../../base/TMPanel';
8
+ import { getSysAllDcmtsSQD, IconArrowRight, IconFilter, IconRecentlyViewed, IconSavedQuery, IconTree, SDKUI_Globals, SDKUI_Localizator } from '../../../helper';
11
9
  import TMSearchResult from './TMSearchResult';
12
10
  import TMRecentsManager from '../../grids/TMRecentsManager';
13
11
  import { SearchResultContext } from '../../../ts';
14
12
  import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
15
13
  import { StyledMultiViewPanel } from '../../base/Styled';
16
- import TMCommandsPanel from '../../sidebar/TMCommandsPanel';
14
+ import TMPanelManager from '../../base/TMPanelManager';
17
15
  var TMSearchViews;
18
16
  (function (TMSearchViews) {
19
- TMSearchViews[TMSearchViews["None"] = 0] = "None";
17
+ TMSearchViews[TMSearchViews["Search"] = 0] = "Search";
20
18
  TMSearchViews[TMSearchViews["Result"] = 1] = "Result";
21
19
  })(TMSearchViews || (TMSearchViews = {}));
22
20
  const TMSearch = ({ inputTID, inputSqdID, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, onRefreshAfterAddDcmtToFavs, onTaskCreateRequest }) => {
@@ -28,11 +26,7 @@ const TMSearch = ({ inputTID, inputSqdID, isExpertMode = SDKUI_Globals.userSetti
28
26
  const [fromDTD, setFromDTD] = useState();
29
27
  const [searchResult, setSearchResult] = useState([]);
30
28
  const [mruTIDs, setMruTIDs] = useState([]);
31
- const [currentSearchView, setCurrentSearchView] = useState(TMSearchViews.None);
32
- const [showTreesPanel, setShowTreesPanel] = useState(true);
33
- const [showRecentsPanel, setShowRecentsPanel] = useState(true);
34
- const [showSearchPanel, setShowSearchPanel] = useState(true);
35
- const [showSavedQueryPanel, setShowSavedQueryPanel] = useState(true);
29
+ const [currentSearchView, setCurrentSearchView] = useState(TMSearchViews.Search);
36
30
  const [currentSQDMode, setCurrentSQDMode] = useState(1);
37
31
  const [lastQdSearched, setLastQdSearched] = useState();
38
32
  const deviceType = useDeviceType();
@@ -54,7 +48,6 @@ const TMSearch = ({ inputTID, inputSqdID, isExpertMode = SDKUI_Globals.userSetti
54
48
  }, [inputSqdID]);
55
49
  useEffect(() => {
56
50
  if (!currentTID || currentTID <= 0) {
57
- setShowSearchPanel(false);
58
51
  setSearchResult([]);
59
52
  return;
60
53
  }
@@ -64,7 +57,6 @@ const TMSearch = ({ inputTID, inputSqdID, isExpertMode = SDKUI_Globals.userSetti
64
57
  setFilteredByTIDSQDs(sqds);
65
58
  setCurrentSQDMode(0);
66
59
  await setDefaultSQDAsync(sqds);
67
- setShowSearchPanel(true);
68
60
  });
69
61
  }, [currentTID]);
70
62
  useEffect(() => {
@@ -126,82 +118,134 @@ const TMSearch = ({ inputTID, inputSqdID, isExpertMode = SDKUI_Globals.userSetti
126
118
  await setSqdAsync?.(sqdToBeSet);
127
119
  }, []);
128
120
  const isMobile = deviceType === DeviceType.MOBILE;
129
- return (_jsxs(_Fragment, { children: [_jsxs(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.None, style: {
130
- display: 'flex',
131
- flexDirection: isMobile ? 'column' : 'row',
132
- justifyContent: 'space-between',
133
- gap: SDKUI_Globals.userSettings.themeSettings.gutters,
134
- width: '100%',
135
- height: '100%',
136
- }, children: [_jsx("div", { style: { flex: 1, minWidth: 0, height: '100%' }, children: _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorActiveColor: 'transparent', separatorColor: 'transparent', showSeparator: deviceType !== DeviceType.MOBILE && showTreesPanel, min: ['0', '0'], start: isMobile ? ['100%', '0%'] : showTreesPanel ? ['20%', '80%'] : ['0%', '100%'], children: [!isMobile &&
137
- _jsx(TMTreeSelector, { onClose: () => setShowTreesPanel(false), onSelectedTIDChanged: (tid) => {
138
- setCurrentTID(tid);
139
- if (tid && mruTIDs.includes(tid))
140
- setCurrentMruTID(tid);
141
- else
142
- setCurrentMruTID(0);
143
- } }), _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', showSeparator: deviceType !== DeviceType.MOBILE && showSavedQueryPanel, separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: isMobile ? ['100%', '0%'] : ((showSavedQueryPanel) ? ['70%', '30%'] : ['100%', '0%']), children: [_jsx(TMLayoutItem, { children: _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', showSeparator: deviceType !== DeviceType.MOBILE && showRecentsPanel, separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: deviceType === DeviceType.DESKTOP ? (showRecentsPanel ? ['30%', '70%'] : ['0%', '100%']) : (currentTID ? ['0%', '100%'] : ['100%', '0%']), children: [_jsx(TMPanel, { title: "Scorciatoie", totalItems: mruTIDs.length, allowMaximize: !isMobile, onClose: isMobile ? undefined : () => setShowRecentsPanel(false), children: _jsx(TMRecentsManager, { mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => { setCurrentMruTID(tid); setCurrentTID(tid); }, onDeletedTID: (tid) => {
144
- let newMruTIDS = mruTIDs.slice();
145
- let index = newMruTIDS.findIndex(o => o == tid);
146
- if (index >= 0)
147
- newMruTIDS.splice(index, 1);
148
- SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS.filter(tid => tid != undefined && tid != null);
149
- setMruTIDs(newMruTIDS);
150
- } }) }), _jsx(StyledMultiViewPanel, { "$isVisible": showSearchPanel || !isMobile, children: _jsx(TMSearchQueryPanel, { isExpertMode: isExpertMode, fromDTD: fromDTD, SQD: currentSQD, onBack: deviceType !== DeviceType.DESKTOP ? () => { setCurrentTID(0); } : undefined, onSearchCompleted: (searchResult, qd) => {
151
- setSearchResult(searchResult);
152
- if (searchResult.length <= 0)
153
- return;
154
- setLastQdSearched(qd);
155
- setCurrentSearchView(TMSearchViews.Result);
156
- // Salvataggio ultimi 10 TIDs
157
- let fromTID = searchResult?.[0].fromTID;
158
- let newMruTIDS = mruTIDs.slice();
159
- let index = newMruTIDS.findIndex(o => o == fromTID);
160
- if (index >= 0)
161
- newMruTIDS.splice(index, 1);
162
- if (newMruTIDS.length >= 10)
163
- newMruTIDS.splice(0, 1);
164
- newMruTIDS.push(fromTID);
165
- setMruTIDs(newMruTIDS);
166
- setCurrentMruTID(fromTID);
167
- SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS.filter(tid => tid != undefined && tid != null);
168
- }, onSqdSaved: async (newSqd) => {
169
- await loadDataSQDsAsync(true, newSqd.masterTID);
170
- await setSQDAsync(newSqd);
171
- } }) })] }) }), _jsx(StyledMultiViewPanel, { "$isVisible": showSavedQueryPanel && !isMobile, children: _jsx(TMPanel, { title: SDK_Localizator.SavedQueries, allowMaximize: !isMobile, onClose: isMobile ? undefined : () => setShowSavedQueryPanel(false), children: _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) => onSQDItemClick(sqd, setSQDAsync), 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,
172
- // selectedId={currentSQD?.id}
173
- onItemClick: (sqd) => onSQDItemClick(sqd, setSQDAsync), onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? undefined : currentSQD, setSQDAsync) }) })] }) }) })] })] }) }), !isMobile &&
174
- _jsx(TMCommandsPanel, { isMobile: isMobile, items: [
175
- {
176
- icon: _jsx(IconTree, {}),
177
- selected: showTreesPanel,
178
- onClick: () => setShowTreesPanel(!showTreesPanel),
179
- },
180
- {
181
- icon: _jsx(IconProgressReady, {}),
182
- selected: showRecentsPanel,
183
- onClick: () => setShowRecentsPanel(!showRecentsPanel),
184
- },
185
- {
186
- icon: _jsx(IconSavedQuery, {}),
187
- selected: showSavedQueryPanel,
188
- onClick: () => setShowSavedQueryPanel(!showSavedQueryPanel),
189
- },
190
- ...(searchResult.length > 0 ? [{
191
- icon: _jsx(IconArrowRight, {}),
192
- disabled: searchResult.length <= 0,
193
- onClick: () => {
194
- if (searchResult.length > 0) {
195
- setCurrentSearchView(currentSearchView === TMSearchViews.None
196
- ? TMSearchViews.Result
197
- : TMSearchViews.None);
198
- }
199
- },
200
- }] : []),
201
- ] })] }), searchResult.length > 0 &&
121
+ const renderTMTreeSelector = (handleTogglePanel) => _jsx(TMTreeSelector, { onClosePanel: () => handleTogglePanel('TMTreeSelector'), onSelectedTIDChanged: (tid) => {
122
+ setCurrentTID(tid);
123
+ if (tid && mruTIDs.includes(tid))
124
+ setCurrentMruTID(tid);
125
+ else
126
+ setCurrentMruTID(0);
127
+ isMobile && handleTogglePanel('TMSearchQueryPanel');
128
+ } });
129
+ const renderTMRecentsManager = (handleTogglePanel) => _jsx(TMRecentsManager, { mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => {
130
+ setCurrentMruTID(tid);
131
+ setCurrentTID(tid);
132
+ isMobile && handleTogglePanel('TMSearchQueryPanel');
133
+ }, onDeletedTID: (tid) => {
134
+ let newMruTIDS = mruTIDs.slice();
135
+ let index = newMruTIDS.findIndex(o => o == tid);
136
+ if (index >= 0)
137
+ newMruTIDS.splice(index, 1);
138
+ SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS.filter(tid => tid != undefined && tid != null);
139
+ setMruTIDs(newMruTIDS);
140
+ } });
141
+ const renderTMSearchQueryPanel = () => _jsx(TMSearchQueryPanel, { isExpertMode: isExpertMode, fromDTD: fromDTD, SQD: currentSQD, onSearchCompleted: (searchResult, qd) => {
142
+ setSearchResult(searchResult);
143
+ if (searchResult.length <= 0)
144
+ return;
145
+ setLastQdSearched(qd);
146
+ setCurrentSearchView(TMSearchViews.Result);
147
+ // Salvataggio ultimi 10 TIDs
148
+ let fromTID = searchResult?.[0].fromTID;
149
+ let newMruTIDS = mruTIDs.slice();
150
+ let index = newMruTIDS.findIndex(o => o == fromTID);
151
+ if (index >= 0)
152
+ newMruTIDS.splice(index, 1);
153
+ if (newMruTIDS.length >= 10)
154
+ newMruTIDS.splice(0, 1);
155
+ newMruTIDS.push(fromTID);
156
+ setMruTIDs(newMruTIDS);
157
+ setCurrentMruTID(fromTID);
158
+ SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS.filter(tid => tid != undefined && tid != null);
159
+ }, onSqdSaved: async (newSqd) => {
160
+ await loadDataSQDsAsync(true, newSqd.masterTID);
161
+ await setSQDAsync(newSqd);
162
+ } });
163
+ 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
+ onSQDItemClick(sqd, setSQDAsync);
165
+ isMobile && handleTogglePanel('TMSearchQueryPanel');
166
+ }, 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
+ // selectedId={currentSQD?.id}
168
+ onItemClick: (sqd) => {
169
+ onSQDItemClick(sqd, setSQDAsync);
170
+ isMobile && handleTogglePanel('TMSearchQueryPanel');
171
+ }, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? undefined : currentSQD, setSQDAsync) }) })] });
172
+ const panels = [
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: panels, initialMobilePanelId: 'TMRecentsManager', toolbarMode: 1 }) }), searchResult.length > 0 &&
202
247
  _jsx(TMSearchResult, { isVisible: currentSearchView === TMSearchViews.Result, context: SearchResultContext.METADATA_SEARCH, searchResults: searchResult, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, onRefreshSearchAsync: async () => {
203
- // setSearchResult([]);
204
248
  setSearchResult(await refreshLastSearch(lastQdSearched) ?? []);
205
- }, onTaskCreateRequest: onTaskCreateRequest, onClose: () => { setCurrentSearchView(TMSearchViews.None); } })] }));
249
+ }, onTaskCreateRequest: onTaskCreateRequest, onClose: () => { setCurrentSearchView(TMSearchViews.Search); } })] }));
206
250
  };
207
251
  export default TMSearch;
@@ -4,7 +4,7 @@ interface ITMTreeSelectorProps {
4
4
  layoutMode?: LayoutModes;
5
5
  isVisible?: boolean;
6
6
  onSelectedTIDChanged?: (tid: number | undefined, treeId?: number | undefined) => void;
7
- onClose?: () => void;
7
+ onClosePanel?: () => void;
8
8
  }
9
9
  declare const TMTreeSelector: React.FC<ITMTreeSelectorProps>;
10
10
  export default TMTreeSelector;
@@ -12,7 +12,7 @@ import TMPanel from '../../base/TMPanel';
12
12
  import TMTidViewer from '../../viewers/TMTidViewer';
13
13
  import { TMColors } from '../../../utils/theme';
14
14
  import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
15
- const TMTreeSelector = ({ layoutMode = LayoutModes.Update, isVisible, onSelectedTIDChanged, onClose }) => {
15
+ const TMTreeSelector = ({ layoutMode = LayoutModes.Update, isVisible, onSelectedTIDChanged, onClosePanel }) => {
16
16
  const deviceType = useDeviceType();
17
17
  const isMobile = deviceType === DeviceType.MOBILE;
18
18
  const [trees, setTrees] = useState([]);
@@ -24,7 +24,6 @@ const TMTreeSelector = ({ layoutMode = LayoutModes.Update, isVisible, onSelected
24
24
  const [focusedRowKey, setFocusedRowKey] = useState(undefined);
25
25
  const [isGridBoxOpened, setIsGridBoxOpened] = useState(false);
26
26
  const [defaultTreeId, setDefaultTreeId] = useState(-1);
27
- // const DEFAULT_TREE_KEY_NAME = `DEFAULT_TREE_${SDK_Globals.tmSession?.SessionDescr?.archiveID}_${SDK_Globals.tmSession?.SessionDescr?.userID}`;
28
27
  useEffect(() => {
29
28
  if (treeItems.length > 0 && treeItems[0].id) {
30
29
  setSelectedRowKeys([treeItems[0].id]);
@@ -95,7 +94,7 @@ const TMTreeSelector = ({ layoutMode = LayoutModes.Update, isVisible, onSelected
95
94
  }
96
95
  ;
97
96
  }, []);
98
- return (_jsx(TMPanel, { title: SDK_Localizator.Trees, isVisible: isVisible, totalItems: trees.length, onClose: isMobile ? undefined : onClose, allowMaximize: !isMobile, toolbar: _jsx(TMButton, { btnStyle: 'icon', caption: defaultTreeId == selectedTreeId ? SDKUI_Localizator.TreeRemoveDefault : SDKUI_Localizator.SetAsDefault, icon: defaultTreeId == selectedTreeId ? _jsx(IconStarRemove, { color: 'rgb(243, 114, 92)' }) : _jsx(IconStar, { color: 'rgb(248, 215, 117)' }), onClick: () => {
97
+ return (_jsx(TMPanel, { title: SDK_Localizator.Trees, isVisible: isVisible, totalItems: trees.length, onClose: isMobile ? undefined : onClosePanel, allowMaximize: !isMobile, toolbar: _jsx(TMButton, { btnStyle: 'icon', caption: defaultTreeId == selectedTreeId ? SDKUI_Localizator.TreeRemoveDefault : SDKUI_Localizator.SetAsDefault, icon: defaultTreeId == selectedTreeId ? _jsx(IconStarRemove, { color: 'rgb(243, 114, 92)' }) : _jsx(IconStar, { color: 'rgb(248, 215, 117)' }), onClick: () => {
99
98
  if (defaultTreeId == selectedTreeId) {
100
99
  SDKUI_Globals.userSettings.searchSettings.defaultTree = -1;
101
100
  setDefaultTreeId(-1);
@@ -27,9 +27,9 @@ const StyledRecentTidItem = styled.div `
27
27
  left: -7px;
28
28
  top: 50%;
29
29
  transform: translateY(-50%);
30
- opacity: 0;
30
+ opacity: ${({ $isMobile }) => ($isMobile ? 1 : 0)};
31
31
  transition: opacity 0.2s;
32
- pointer-events: none;
32
+ pointer-events: ${({ $isMobile }) => ($isMobile ? 'auto' : 'none')};
33
33
  }
34
34
 
35
35
  &:hover .info-icon {
@@ -52,7 +52,7 @@ const TMRecentsManager = ({ deviceType, mruTIDs, currentMruTID, onSelectedTID, o
52
52
  setRecentDcmtTypes(filtered);
53
53
  });
54
54
  }, [mruTIDs]);
55
- return (_jsxs(_Fragment, { children: [_jsxs("div", { style: { overflowY: deviceType === DeviceType.MOBILE ? 'auto' : undefined, display: 'flex', flexDirection: 'column', padding: '5px', width: '100%' }, children: [_jsx(StyledRecentTidItem, { id: `tid-${0}`, onClick: () => { setShowDcmtTypeChooser(true); }, children: _jsx("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'center', width: '100%' }, children: _jsx("p", { style: {
55
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { style: { overflowY: deviceType === DeviceType.MOBILE ? 'auto' : undefined, display: 'flex', flexDirection: 'column', padding: '5px', width: '100%' }, children: [_jsx(StyledRecentTidItem, { id: `tid-${0}`, "$isMobile": deviceType === DeviceType.MOBILE, onClick: () => { setShowDcmtTypeChooser(true); }, children: _jsx("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'center', width: '100%' }, children: _jsx("p", { style: {
56
56
  color: TMColors.primaryColor,
57
57
  fontSize: '1rem',
58
58
  fontWeight: 600,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.13.37",
3
+ "version": "6.13.39",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",