@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.
- package/lib/components/base/TMPanel.js +6 -2
- package/lib/components/base/TMPanelManager.d.ts +1 -0
- package/lib/components/base/TMPanelManager.js +15 -5
- package/lib/components/base/TMPanelManagerToolbar.d.ts +7 -0
- package/lib/components/base/TMPanelManagerToolbar.js +28 -19
- package/lib/components/features/archive/TMArchive.js +1 -1
- package/lib/components/features/search/TMSearch.js +132 -88
- package/lib/components/features/search/TMTreeSelector.d.ts +1 -1
- package/lib/components/features/search/TMTreeSelector.js +2 -3
- package/lib/components/grids/TMRecentsManager.js +3 -3
- package/package.json +1 -1
@@ -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: () => {
|
106
|
-
onHeaderDoubleClick
|
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
|
-
}
|
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("
|
78
|
-
handleClick(); },
|
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, {
|
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,
|
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,
|
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
|
14
|
+
import TMPanelManager from '../../base/TMPanelManager';
|
17
15
|
var TMSearchViews;
|
18
16
|
(function (TMSearchViews) {
|
19
|
-
TMSearchViews[TMSearchViews["
|
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.
|
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
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
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.
|
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
|
-
|
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,
|
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 :
|
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,
|