@topconsultnpm/sdkui-react-beta 6.13.14 → 6.13.16
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/TMFileManager.js +1 -5
- package/lib/components/base/TMPanel.d.ts +1 -0
- package/lib/components/base/TMPanel.js +13 -3
- package/lib/components/base/TMPanelManagerMatrix.js +11 -10
- package/lib/components/base/TMPanelManagerMatrixUtils.js +2 -2
- package/lib/components/choosers/TMDistinctValues.d.ts +1 -0
- package/lib/components/choosers/TMDistinctValues.js +11 -5
- package/lib/components/editors/TMMetadataValues.d.ts +1 -1
- package/lib/components/features/search/TMSearch.js +147 -71
- package/lib/components/features/search/TMSearchQueryEditor.d.ts +2 -0
- package/lib/components/features/search/TMSearchQueryEditor.js +24 -6
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +0 -2
- package/lib/components/features/search/TMSearchQueryPanel.js +14 -7
- package/package.json +1 -1
@@ -210,11 +210,7 @@ const TMFileManager = (props) => {
|
|
210
210
|
}
|
211
211
|
};
|
212
212
|
// Main render of the file manager component with a split layout
|
213
|
-
return _jsxs("div", { style: { height: "100%", width: "100%" }, children: [!isMobile &&
|
214
|
-
display: "flex",
|
215
|
-
flexGrow: 1,
|
216
|
-
height: "calc(100% - 40px)"
|
217
|
-
}, children: _jsxs(TMSplitterLayout, { direction: 'horizontal', showSeparator: true, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: [isLeftPanelCollapsed ? '0%' : "50%", isLeftPanelCollapsed ? '100%' : "50%"], children: [_jsxs("div", { style: { height: "100%", width: "100%" }, onContextMenu: onTreeViewContextMenu, children: [_jsx(TreeView, { style: { marginTop: "10px" }, dataSource: treeViewData, displayExpr: "text", itemRender: renderTreeViewItem, onItemClick: handleTreeViewItemClick, onItemContextMenu: handleTreeViewContextMenu }), treeViewAnchor && _jsx(ContextMenu, { id: 'treeViewContextMenuDesktop', dataSource: folderContextMenuItems, target: treeViewAnchor, onHiding: closeTreeViewContextMenu })] }), _jsxs("div", { style: { backgroundColor: "#fff", width: "100%", height: "100%" }, children: [_jsxs(Toolbar, { style: { backgroundColor: '#f4f4f4', height: "40px", paddingLeft: "5px", paddingRight: '5px' }, children: [_jsx(ToolbarItem, { location: "before", children: _jsx(TMButton, { caption: viewMode === 'details' ? SDKUI_Localizator.PreviewView : SDKUI_Localizator.DetailsView, btnStyle: 'toolbar', color: 'primaryOutline', icon: viewMode === 'details' ? _jsx(IconDashboard, {}) : _jsx(IconList, {}), onClick: toggleViewMode }) }), _jsx(ToolbarItem, { location: "before", children: _jsx(TMSearchBar, { marginLeft: '0px', maxWidth: '160px', searchValue: searchText, onSearchValueChanged: (e) => handleSearchChange(e) }) })] }), _jsxs("div", { onDrop: handleDrop, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onContextMenu: onContextMenu, style: { width: "100%", height: "calc(100% - 40px)", border: isDragging ? '2px solid red' : '2px solid transparent' }, children: [viewMode === 'thumbnails' && _jsx(ThumbnailsView, { userID: userID, items: filteredFileItems, focusedFile: focusedFile, selectedFiles: selectedFiles, searchText: searchText, handleSelectedFiles: handleSelectedFiles, handleFocusedFile: handleFocusedFile, onDoubleClickHandler: onDoubleClickHandler, setViewAnchor: setViewAnchor }), viewMode === 'details' && _jsx(DetailsView, { userID: userID, items: filteredFileItems, selectedFiles: selectedFiles, searchText: searchText, focusedFile: focusedFile, handleSelectedFiles: handleSelectedFiles, handleFocusedFile: handleFocusedFile, onDoubleClickHandler: onDoubleClickHandler, fileContextMenuItems: fileContextMenuItems }), viewAnchor && _jsx(ContextMenu, { id: 'fileContextMenuDesktop', dataSource: fileContextMenuItems, target: viewAnchor, onHiding: closeViewContextMenu })] })] })] }, "TMWGs-panels-treeView") })] }), isMobile && _jsx("div", { style: { height: "100%", width: "100%" }, children: _jsxs(TMToolbarCard, { onBack: openDraftList ? onBackCallback : undefined, title: SDKUI_Localizator.Drafts, totalItems: dcmtsFound ?? 0, children: [_jsxs("div", { style: { display: openDraftList ? 'none' : 'block', transition: 'opacity 0.3s ease-in-out' }, children: [_jsx(TreeView, { style: { marginTop: "10px", }, dataSource: treeViewData, displayExpr: "text", itemRender: renderTreeViewItem, onItemClick: handleTreeViewItemClick }), treeViewAnchor && _jsx(ContextMenu, { id: 'treeViewContextMenuMobile', dataSource: folderContextMenuItems, target: treeViewAnchor, onHiding: closeTreeViewContextMenu })] }), _jsxs("div", { style: { backgroundColor: "#fff", width: "100%", height: "100%", display: openDraftList ? 'block' : 'none', transition: 'opacity 0.3s ease-in-out' }, children: [_jsxs(Toolbar, { style: { backgroundColor: '#f4f4f4', height: "40px", paddingLeft: "5px", paddingRight: '5px' }, children: [_jsx(ToolbarItem, { location: "before", children: _jsx(TMButton, { caption: viewMode === 'details' ? SDKUI_Localizator.PreviewView : SDKUI_Localizator.DetailsView, btnStyle: 'toolbar', color: 'primaryOutline', icon: viewMode === 'details' ? _jsx(IconDashboard, {}) : _jsx(IconList, {}), onClick: toggleViewMode }) }), _jsx(ToolbarItem, { location: "before", children: _jsx(TMSearchBar, { marginLeft: '0px', maxWidth: '160px', searchValue: searchText, onSearchValueChanged: (e) => handleSearchChange(e) }) })] }), _jsxs("div", { onDrop: handleDrop, onDragOver: handleDragOver, onDragLeave: handleDragLeave, style: { width: "100%", height: "calc(100% - 40px)", border: isDragging ? '2px solid red' : '2px solid transparent' }, children: [viewMode === 'thumbnails' && _jsx(ThumbnailsView, { userID: userID, items: filteredFileItems, focusedFile: focusedFile, selectedFiles: selectedFiles, searchText: searchText, handleSelectedFiles: handleSelectedFiles, handleFocusedFile: handleFocusedFile, onDoubleClickHandler: onDoubleClickHandler, setViewAnchor: setViewAnchor }), viewMode === 'details' && _jsx(DetailsView, { items: filteredFileItems, selectedFiles: selectedFiles, searchText: searchText, focusedFile: focusedFile, handleSelectedFiles: handleSelectedFiles, handleFocusedFile: handleFocusedFile, onDoubleClickHandler: onDoubleClickHandler }), viewAnchor && _jsx(ContextMenu, { id: 'fileViewContextMenuMobile', dataSource: fileContextMenuItems, target: viewAnchor, onHiding: closeViewContextMenu })] })] })] }) })] });
|
213
|
+
return _jsxs("div", { style: { height: "100%", width: "100%" }, children: [!isMobile && _jsx("div", { style: { flexDirection: "column", height: "100%", width: "100%", }, children: _jsx("div", { style: { display: "flex", flexGrow: 1, height: "100%" }, children: _jsxs(TMSplitterLayout, { direction: 'horizontal', showSeparator: true, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: [isLeftPanelCollapsed ? '0%' : "50%", isLeftPanelCollapsed ? '100%' : "50%"], children: [_jsxs("div", { style: { height: "100%", width: "100%" }, onContextMenu: onTreeViewContextMenu, children: [_jsx(TreeView, { style: { marginTop: "10px" }, dataSource: treeViewData, displayExpr: "text", itemRender: renderTreeViewItem, onItemClick: handleTreeViewItemClick, onItemContextMenu: handleTreeViewContextMenu }), treeViewAnchor && _jsx(ContextMenu, { id: 'treeViewContextMenuDesktop', dataSource: folderContextMenuItems, target: treeViewAnchor, onHiding: closeTreeViewContextMenu })] }), _jsxs("div", { style: { backgroundColor: "#fff", width: "100%", height: "100%" }, children: [_jsxs(Toolbar, { style: { backgroundColor: '#f4f4f4', height: "40px", paddingLeft: "5px", paddingRight: '5px' }, children: [_jsx(ToolbarItem, { location: "before", children: _jsx(TMButton, { caption: isLeftPanelCollapsed ? SDKUI_Localizator.ShowLeftPanel : SDKUI_Localizator.HideLeftPanel, btnStyle: 'toolbar', color: 'primaryOutline', icon: isLeftPanelCollapsed ? _jsx(IconHide, {}) : _jsx(IconShow, {}), onClick: () => setIsLeftPanelCollapsed(prev => !prev) }) }), _jsx(ToolbarItem, { location: "before", children: _jsx(TMButton, { caption: viewMode === 'details' ? SDKUI_Localizator.PreviewView : SDKUI_Localizator.DetailsView, btnStyle: 'toolbar', color: 'primaryOutline', icon: viewMode === 'details' ? _jsx(IconDashboard, {}) : _jsx(IconList, {}), onClick: toggleViewMode }) }), _jsx(ToolbarItem, { location: "before", children: _jsx(TMSearchBar, { marginLeft: '0px', maxWidth: '160px', searchValue: searchText, onSearchValueChanged: (e) => handleSearchChange(e) }) })] }), _jsxs("div", { onDrop: handleDrop, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onContextMenu: onContextMenu, style: { width: "100%", height: "calc(100% - 40px)", border: isDragging ? '2px solid red' : '2px solid transparent' }, children: [viewMode === 'thumbnails' && _jsx(ThumbnailsView, { userID: userID, items: filteredFileItems, focusedFile: focusedFile, selectedFiles: selectedFiles, searchText: searchText, handleSelectedFiles: handleSelectedFiles, handleFocusedFile: handleFocusedFile, onDoubleClickHandler: onDoubleClickHandler, setViewAnchor: setViewAnchor }), viewMode === 'details' && _jsx(DetailsView, { userID: userID, items: filteredFileItems, selectedFiles: selectedFiles, searchText: searchText, focusedFile: focusedFile, handleSelectedFiles: handleSelectedFiles, handleFocusedFile: handleFocusedFile, onDoubleClickHandler: onDoubleClickHandler, fileContextMenuItems: fileContextMenuItems }), viewAnchor && _jsx(ContextMenu, { id: 'fileContextMenuDesktop', dataSource: fileContextMenuItems, target: viewAnchor, onHiding: closeViewContextMenu })] })] })] }, "TMWGs-panels-treeView") }) }), isMobile && _jsx("div", { style: { height: "100%", width: "100%" }, children: _jsxs(TMToolbarCard, { onBack: openDraftList ? onBackCallback : undefined, title: SDKUI_Localizator.Drafts, totalItems: dcmtsFound ?? 0, children: [_jsxs("div", { style: { display: openDraftList ? 'none' : 'block', transition: 'opacity 0.3s ease-in-out' }, children: [_jsx(TreeView, { style: { marginTop: "10px", }, dataSource: treeViewData, displayExpr: "text", itemRender: renderTreeViewItem, onItemClick: handleTreeViewItemClick }), treeViewAnchor && _jsx(ContextMenu, { id: 'treeViewContextMenuMobile', dataSource: folderContextMenuItems, target: treeViewAnchor, onHiding: closeTreeViewContextMenu })] }), _jsxs("div", { style: { backgroundColor: "#fff", width: "100%", height: "100%", display: openDraftList ? 'block' : 'none', transition: 'opacity 0.3s ease-in-out' }, children: [_jsxs(Toolbar, { style: { backgroundColor: '#f4f4f4', height: "40px", paddingLeft: "5px", paddingRight: '5px' }, children: [_jsx(ToolbarItem, { location: "before", children: _jsx(TMButton, { caption: viewMode === 'details' ? SDKUI_Localizator.PreviewView : SDKUI_Localizator.DetailsView, btnStyle: 'toolbar', color: 'primaryOutline', icon: viewMode === 'details' ? _jsx(IconDashboard, {}) : _jsx(IconList, {}), onClick: toggleViewMode }) }), _jsx(ToolbarItem, { location: "before", children: _jsx(TMSearchBar, { marginLeft: '0px', maxWidth: '160px', searchValue: searchText, onSearchValueChanged: (e) => handleSearchChange(e) }) })] }), _jsxs("div", { onDrop: handleDrop, onDragOver: handleDragOver, onDragLeave: handleDragLeave, style: { width: "100%", height: "calc(100% - 40px)", border: isDragging ? '2px solid red' : '2px solid transparent' }, children: [viewMode === 'thumbnails' && _jsx(ThumbnailsView, { userID: userID, items: filteredFileItems, focusedFile: focusedFile, selectedFiles: selectedFiles, searchText: searchText, handleSelectedFiles: handleSelectedFiles, handleFocusedFile: handleFocusedFile, onDoubleClickHandler: onDoubleClickHandler, setViewAnchor: setViewAnchor }), viewMode === 'details' && _jsx(DetailsView, { items: filteredFileItems, selectedFiles: selectedFiles, searchText: searchText, focusedFile: focusedFile, handleSelectedFiles: handleSelectedFiles, handleFocusedFile: handleFocusedFile, onDoubleClickHandler: onDoubleClickHandler }), viewAnchor && _jsx(ContextMenu, { id: 'fileViewContextMenuMobile', dataSource: fileContextMenuItems, target: viewAnchor, onHiding: closeViewContextMenu })] })] })] }) })] });
|
218
214
|
};
|
219
215
|
export default TMFileManager;
|
220
216
|
const highlightText = (text, searchText, isSelected) => {
|
@@ -15,6 +15,7 @@ export interface ITMPanelProps extends ITMRightSidebarProps {
|
|
15
15
|
onBack?: () => void;
|
16
16
|
onClose?: () => void;
|
17
17
|
onHeaderDoubleClick?: () => void;
|
18
|
+
onMaximize?: (isMaximized: boolean) => void;
|
18
19
|
}
|
19
20
|
declare const TMPanel: React.FC<ITMPanelProps>;
|
20
21
|
export default TMPanel;
|
@@ -69,7 +69,7 @@ const StyledInnerPanelDiv = styled.div `
|
|
69
69
|
outline: none;
|
70
70
|
}
|
71
71
|
`;
|
72
|
-
const TMPanel = ({ allowMaximize = true, items = [], onItemClick, selectedItem, showPanel, color, backgroundColor, backgroundColorContainer, children, showHeader = true, title, totalItems, displayedItemsCount, toolbar, padding = '5px', onBack, onClose, onHeaderDoubleClick }) => {
|
72
|
+
const TMPanel = ({ allowMaximize = true, items = [], onItemClick, selectedItem, showPanel, color, backgroundColor, backgroundColorContainer, children, showHeader = true, title, totalItems, displayedItemsCount, toolbar, padding = '5px', onBack, onClose, onHeaderDoubleClick, onMaximize }) => {
|
73
73
|
const [isActive, setIsActive] = useState(false);
|
74
74
|
const [isMaximized, setIsMaximized] = useState(false);
|
75
75
|
const [minWidth, setMinWidth] = useState(undefined);
|
@@ -79,7 +79,17 @@ const TMPanel = ({ allowMaximize = true, items = [], onItemClick, selectedItem,
|
|
79
79
|
setMinWidth(titleRowRef.current.offsetWidth);
|
80
80
|
}
|
81
81
|
}, [title, displayedItemsCount, totalItems, onBack]);
|
82
|
-
|
82
|
+
// handler for external maximize management
|
83
|
+
const handleMaximize = () => {
|
84
|
+
setIsMaximized(prevState => {
|
85
|
+
const newValue = !prevState;
|
86
|
+
if (onMaximize) {
|
87
|
+
onMaximize(newValue);
|
88
|
+
}
|
89
|
+
return newValue;
|
90
|
+
});
|
91
|
+
};
|
92
|
+
return (_jsxs(StyledPanelContainer, { "$isMaximized": onMaximize ? false : isMaximized, style: minWidth ? { minWidth } : undefined, children: [showHeader &&
|
83
93
|
_jsx(StyledPanelHeader, { "$backgroundColor": backgroundColor, "$color": color, "$isActive": isActive, onDoubleClick: () => { if (onHeaderDoubleClick)
|
84
94
|
onHeaderDoubleClick(); }, tabIndex: -1, onFocus: () => setIsActive(true), onBlur: () => setIsActive(false), onClick: () => setIsActive(true), 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 &&
|
85
95
|
_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: {
|
@@ -93,7 +103,7 @@ const TMPanel = ({ allowMaximize = true, items = [], onItemClick, selectedItem,
|
|
93
103
|
? ` (${totalItems})`
|
94
104
|
: ''] }) })] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: '5px' }, children: [toolbar, allowMaximize && _jsx(TMButton, { color: 'primaryOutline', caption: isMaximized ? SDKUI_Localizator.Minimize : SDKUI_Localizator.Maximize, icon: isMaximized
|
95
105
|
? _jsx(IconWindowMinimize, { fontSize: 16 })
|
96
|
-
: _jsx(IconWindowMaximize, { fontSize: 16 }), btnStyle: 'icon', onClick:
|
106
|
+
: _jsx(IconWindowMaximize, { fontSize: 16 }), btnStyle: 'icon', onClick: handleMaximize }), onClose && _jsx(TMButton, { color: 'primaryOutline', caption: SDKUI_Localizator.Close, icon: _jsx(IconClearButton, {}), btnStyle: 'icon', onClick: () => { setIsMaximized(false); onClose?.(); } })] })] }) }), _jsxs(StyledPanelContent, { "$height": showHeader ? "calc(100% - 40px)" : "100%", "$padding": padding, "$backgroundColor": backgroundColorContainer ?? `#FFFFFF`, tabIndex: -1, onFocus: () => setIsActive(true), onBlur: () => setIsActive(false), onClick: () => setIsActive(true), children: [_jsx(StyledInnerPanelDiv, { style: { width: items.length > 0 ? 'calc(100% - 30px)' : '100%' }, tabIndex: -1, onFocus: () => setIsActive(true), onBlur: () => setIsActive(false), onClick: () => setIsActive(true), children: children }), items.length > 0 &&
|
97
107
|
_jsx(TMRightSidebar, { items: items, onItemClick: onItemClick, selectedItem: selectedItem, showPanel: showPanel })] })] }));
|
98
108
|
};
|
99
109
|
export default TMPanel;
|
@@ -152,9 +152,8 @@ const TMPanelManagerMatrix = (props) => {
|
|
152
152
|
}, children: [_jsx("div", { style: {
|
153
153
|
display: 'flex',
|
154
154
|
flexDirection: 'row',
|
155
|
-
width: (toolbarState && toolbarState.items.length > 0) ? `calc(100% - ${isMobile ? "0px" : "
|
155
|
+
width: (toolbarState && toolbarState.items.length > 0) ? `calc(100% - ${isMobile ? "0px" : "60px"})` : '100%',
|
156
156
|
height: `calc(100% - ${isMobile ? "60px" : "0px"})`,
|
157
|
-
columnGap: maximizedPanelId ? '0px' : `${gutters}px`,
|
158
157
|
}, children: visibleColumns.length > 0 ? visibleColumns.map((column, colIndex) => {
|
159
158
|
// Retrieve the column data from the panelMatrixMap using the current column key
|
160
159
|
const col = panelMatrixMap.get(column);
|
@@ -162,7 +161,13 @@ const TMPanelManagerMatrix = (props) => {
|
|
162
161
|
const hasMaximized = !!col?.rows?.some(row => row.id === maximizedPanelId);
|
163
162
|
const isLastColumn = colIndex === visibleColumns.length - 1;
|
164
163
|
// Define the base style for all columns with flex layout, full height, smooth width transition, and no minimum width
|
165
|
-
const columnBaseStyle = {
|
164
|
+
const columnBaseStyle = {
|
165
|
+
display: 'flex',
|
166
|
+
flexDirection: 'column',
|
167
|
+
height: '100%',
|
168
|
+
transition: isMobile ? 'none' : 'width 0.3s',
|
169
|
+
paddingRight: (!maximizedPanelId && !isLastColumn) ? `${gutters}px` : '0px'
|
170
|
+
};
|
166
171
|
// Declare a variable to hold the final computed style for the column
|
167
172
|
let columnStyle;
|
168
173
|
if (maximizedPanelId) {
|
@@ -180,11 +185,10 @@ const TMPanelManagerMatrix = (props) => {
|
|
180
185
|
const isLastVisible = visibleRows.length > 0 && visibleRows[visibleRows.length - 1].id === row.id;
|
181
186
|
const isMaximized = maximizedPanelId === row.id;
|
182
187
|
const baseStyle = {
|
183
|
-
backgroundColor: '#f5f5f5',
|
184
188
|
borderRadius: '8px',
|
185
189
|
display: 'block',
|
186
190
|
transition: isMobile ? 'none' : 'all 0.3s ease',
|
187
|
-
|
191
|
+
paddingBottom: (isHiddenPanel || isLastVisible || isMaximized) ? '0px' : `${gutters}px`,
|
188
192
|
};
|
189
193
|
const hiddenStyle = {
|
190
194
|
minWidth: '0px',
|
@@ -192,7 +196,6 @@ const TMPanelManagerMatrix = (props) => {
|
|
192
196
|
height: '0px',
|
193
197
|
visibility: 'hidden',
|
194
198
|
opacity: 0,
|
195
|
-
marginBottom: '0px',
|
196
199
|
};
|
197
200
|
const maximizedStyle = {
|
198
201
|
minWidth: '50px',
|
@@ -200,7 +203,6 @@ const TMPanelManagerMatrix = (props) => {
|
|
200
203
|
height: '100%',
|
201
204
|
visibility: 'visible',
|
202
205
|
opacity: 1,
|
203
|
-
marginBottom: '0px',
|
204
206
|
};
|
205
207
|
const defaultStyle = {
|
206
208
|
minWidth: isHiddenPanel ? '0px' : '50px',
|
@@ -208,11 +210,10 @@ const TMPanelManagerMatrix = (props) => {
|
|
208
210
|
height: isHiddenPanel ? '0px' : panelHeights.get(row.id)?.height ?? '100%',
|
209
211
|
visibility: isHiddenPanel ? 'hidden' : 'visible',
|
210
212
|
opacity: isHiddenPanel ? 0 : 1,
|
211
|
-
marginBottom: (isHiddenPanel || isLastVisible) ? '0px' : `${gutters}px`,
|
212
213
|
};
|
213
214
|
const panelStyle = maximizedPanelId ? (isMaximized ? { ...baseStyle, ...maximizedStyle } : hiddenStyle) : { ...baseStyle, ...defaultStyle };
|
214
|
-
return _jsx("div", { style: panelStyle, children: row.panel ? _jsx(TMPanel, { title: row.panel.title, totalItems: row.panel.totalItems ?? undefined, displayedItemsCount: row.panel.displayedItemsCount ?? undefined, onHeaderDoubleClick: () => maximizeMinimizePanelCallback(isMaximized, row.id), onClose: (!isMobile && toolbarState) ? () => togglePanelVisibility(toolbarState.items.find(item => item.panelManagerMatrixRowId === row.id)) : undefined, allowMaximize: false, toolbar: _jsx("div", { style: { width: '
|
215
|
-
: typeof row.content === "function" ? row.content(togglePanelVisibility, toggleToolbarItemDisabled, toggleToolbarItemVisibility) : row.content }, "TMPanelManagerMatrix-r-" + row.id);
|
215
|
+
return _jsx("div", { style: panelStyle, children: row.panel ? _jsx(TMPanel, { title: row.panel.title, totalItems: row.panel.totalItems ?? undefined, displayedItemsCount: row.panel.displayedItemsCount ?? undefined, onHeaderDoubleClick: () => maximizeMinimizePanelCallback(isMaximized, row.id), onClose: (!isMobile && toolbarState) ? () => togglePanelVisibility(toolbarState.items.find(item => item.panelManagerMatrixRowId === row.id)) : undefined, allowMaximize: false, toolbar: _jsx("div", { style: { width: '100%', display: 'flex', alignItems: 'center', gap: '10px' }, children: ((row.panel?.showCustomMaximizeMinimizeButton ?? true) && !isMobile && totalVisiblePanels > 1) && _jsx(TMButton, { caption: isMaximized ? SDKUI_Localizator.Minimize : SDKUI_Localizator.Maximize, icon: isMaximized ? _jsx(IconWindowMinimize, {}) : _jsx(IconWindowMaximize, {}), btnStyle: 'icon', onClick: () => maximizeMinimizePanelCallback(isMaximized, row.id) }) }), children: _jsx("div", { style: { width: '100%', height: '100%' }, children: typeof row.content === "function" ? row.content(togglePanelVisibility, toggleToolbarItemDisabled, toggleToolbarItemVisibility) : row.content }) })
|
216
|
+
: _jsx("div", { style: { width: '100%', height: '100%' }, children: typeof row.content === "function" ? row.content(togglePanelVisibility, toggleToolbarItemDisabled, toggleToolbarItemVisibility) : row.content }) }, "TMPanelManagerMatrix-r-" + row.id);
|
216
217
|
}) }) }, "TMPanelManagerMatrix-c-" + column));
|
217
218
|
}) : _jsxs("div", { style: {
|
218
219
|
width: '100%',
|
@@ -130,11 +130,11 @@ export const MobileToolbar = (toolbar, hiddenPanelIds, togglePanelVisibility) =>
|
|
130
130
|
};
|
131
131
|
export const getDynamicColumnWidth = (col, hiddenPanelIds, allColumns) => {
|
132
132
|
if (!col)
|
133
|
-
return '
|
133
|
+
return '100%';
|
134
134
|
// If all rows in the column are hidden, return width 0%
|
135
135
|
const allRowsHidden = col.rows.every(row => hiddenPanelIds.has(row.id));
|
136
136
|
if (allRowsHidden)
|
137
|
-
return '
|
137
|
+
return '100%';
|
138
138
|
// Calculate which columns are visible (at least one row not hidden)
|
139
139
|
const visibleColumns = allColumns.filter(c => c.rows.some(r => !hiddenPanelIds.has(r.id)));
|
140
140
|
const visibleCount = visibleColumns.length;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
2
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
3
3
|
import { LayoutModes, MetadataDataDomains, AccessLevels, MetadataDataTypes, SDK_Globals, DcmtTypeListCacheService, DataColumnTypes } from '@topconsultnpm/sdk-ts-beta';
|
4
4
|
import styled from 'styled-components';
|
@@ -9,9 +9,10 @@ import { TMExceptionBoxManager } from '../base/TMPopUp';
|
|
9
9
|
import TMSpinner from '../base/TMSpinner';
|
10
10
|
import TMCheckBox from '../editors/TMCheckBox';
|
11
11
|
import TMPanel from '../base/TMPanel';
|
12
|
+
import TMModal from '../base/TMModal';
|
12
13
|
const StyledDistinctValues = styled.div `display: flex; flex-direction: column; height: 100%; overflow: hidden; gap: 10px;`;
|
13
14
|
const StyledPanelContainer = styled.div ` width: 100%; height: 100%; padding: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; `;
|
14
|
-
const TMDistinctValues = ({ tid, mid, layoutMode = LayoutModes.None, allowAppendMode = true, showHeader = true, separator = " ", onSelectionChanged, onClosePanelCallback }) => {
|
15
|
+
const TMDistinctValues = ({ tid, mid, layoutMode = LayoutModes.None, allowAppendMode = true, showHeader = true, isModal, separator = " ", onSelectionChanged, onClosePanelCallback }) => {
|
15
16
|
const [focusedItem, setFocusedItem] = useState();
|
16
17
|
const [dataSource, setDataSource] = useState([]);
|
17
18
|
const [isAppendMode, setIsAppendMode] = useState(false);
|
@@ -141,8 +142,13 @@ const TMDistinctValues = ({ tid, mid, layoutMode = LayoutModes.None, allowAppend
|
|
141
142
|
return false;
|
142
143
|
return md.dataDomain === undefined || md.dataDomain === MetadataDataDomains.None;
|
143
144
|
};
|
144
|
-
|
145
|
-
|
146
|
-
|
145
|
+
const renderContent = () => {
|
146
|
+
return (_jsx(_Fragment, { children: showPrompt
|
147
|
+
? _jsxs(StyledPanelContainer, { children: [_jsx(IconDataList, { fontSize: 96 }), _jsxs("p", { children: ["Caricare i valori distinti di ", _jsx("strong", { children: `"${md?.nameLoc}" ` }), "? "] }), _jsx(TMButton, { caption: SDKUI_Localizator.Yes, onClick: handleLoadData, showTooltip: false })] })
|
148
|
+
: _jsxs(StyledDistinctValues, { children: [isVisibleAppend() && _jsx(TMCheckBox, { elementStyle: { position: 'absolute', right: '15px', top: '15px', zIndex: 10000 }, label: 'Accoda', value: isAppendMode, onValueChanged: () => { setIsAppendMode(!isAppendMode); } }), _jsx(TMDataGrid, { focusedRowKey: focusedItem ? focusedItem.rowIndex : undefined, selection: { showCheckBoxesMode: 'none' }, searchPanel: { highlightCaseSensitive: true, visible: true }, dataColumns: customColumns, dataSource: dataSource, keyExpr: 'rowIndex', height: 'calc(100%)', onFocusedRowChanged: onFocusedRowChanged, paging: { pageSize: 30 }, summary: customSummary })] }) }));
|
149
|
+
};
|
150
|
+
return (_jsx(_Fragment, { children: isModal
|
151
|
+
? _jsx(TMModal, { title: SDKUI_Localizator.DistinctValues + (md?.nameLoc ? ` (${md?.nameLoc})` : ''), height: '600px', width: '500px', resizable: true, onClose: onClosePanelCallback, children: renderContent() })
|
152
|
+
: _jsx(TMPanel, { title: SDKUI_Localizator.DistinctValues + (md?.nameLoc ? ` (${md?.nameLoc})` : ''), showHeader: showHeader, onClose: onClosePanelCallback, children: renderContent() }) }));
|
147
153
|
};
|
148
154
|
export default TMDistinctValues;
|
@@ -13,7 +13,7 @@ export declare enum AdvancedMenuButtons {
|
|
13
13
|
FormulaEditor = 2,
|
14
14
|
DistinctValues = 3
|
15
15
|
}
|
16
|
-
type AdvancedMenuClickEventArgs = {
|
16
|
+
export type AdvancedMenuClickEventArgs = {
|
17
17
|
tid: number | undefined;
|
18
18
|
mid: number | undefined;
|
19
19
|
button: AdvancedMenuButtons;
|
@@ -1,18 +1,17 @@
|
|
1
|
-
import { jsx as _jsx,
|
2
|
-
import { useCallback, useEffect, useState } from 'react';
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useCallback, useEffect, useMemo, 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,
|
9
|
-
import { TMLayoutItem, TMSplitterLayout } from '../../base/TMLayout';
|
10
|
-
import TMPanel from '../../base/TMPanel';
|
8
|
+
import { getSysAllDcmtsSQD, IconProgressReady, 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';
|
14
|
+
import TMPanelManagerMatrix from '../../base/TMPanelManagerMatrix';
|
16
15
|
var TMSearchViews;
|
17
16
|
(function (TMSearchViews) {
|
18
17
|
TMSearchViews[TMSearchViews["None"] = 0] = "None";
|
@@ -28,14 +27,151 @@ const TMSearch = ({ inputTID, inputSqdID, isExpertMode = SDKUI_Globals.userSetti
|
|
28
27
|
const [searchResult, setSearchResult] = useState([]);
|
29
28
|
const [mruTIDs, setMruTIDs] = useState([]);
|
30
29
|
const [currentSearchView, setCurrentSearchView] = useState(TMSearchViews.None);
|
31
|
-
const [showDistinctValuesPanel, setShowDistinctValuesPanel] = useState(false);
|
32
|
-
const [showTreesPanel, setShowTreesPanel] = useState(true);
|
33
|
-
const [showRecentsPanel, setShowRecentsPanel] = useState(true);
|
34
|
-
const [showSavedQueryPanel, setShowSavedQueryPanel] = useState(true);
|
35
30
|
const [currentSQDMode, setCurrentSQDMode] = useState(1);
|
36
|
-
const [focusedTidMid, setFocusedTidMid] = useState();
|
37
31
|
const [lastQdSearched, setLastQdSearched] = useState();
|
38
32
|
const deviceType = useDeviceType();
|
33
|
+
const panelMatrixMap = new Map([
|
34
|
+
[
|
35
|
+
"column-0",
|
36
|
+
{
|
37
|
+
width: "20%",
|
38
|
+
rows: [
|
39
|
+
{
|
40
|
+
id: 'treeSelector',
|
41
|
+
height: '100%',
|
42
|
+
width: '100%',
|
43
|
+
content: (togglePanelVisibility) => _jsx(TMTreeSelector, { onClose: () => togglePanelVisibility({
|
44
|
+
id: 'toolbar-item-treeSelector',
|
45
|
+
icon: 'optionsgear',
|
46
|
+
tooltipName: 'treeSelector',
|
47
|
+
panelManagerMatrixRowId: 'treeSelector',
|
48
|
+
}), onSelectedTIDChanged: (tid) => {
|
49
|
+
setCurrentTID(tid);
|
50
|
+
if (tid && mruTIDs.includes(tid))
|
51
|
+
setCurrentMruTID(tid);
|
52
|
+
else
|
53
|
+
setCurrentMruTID(0);
|
54
|
+
} }),
|
55
|
+
hidden: false
|
56
|
+
}
|
57
|
+
],
|
58
|
+
}
|
59
|
+
],
|
60
|
+
[
|
61
|
+
"column-1",
|
62
|
+
{
|
63
|
+
width: "20%",
|
64
|
+
rows: [
|
65
|
+
{
|
66
|
+
id: 'recentsManager',
|
67
|
+
height: '100%',
|
68
|
+
width: '100%',
|
69
|
+
content: _jsx(TMRecentsManager, { mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => { setCurrentMruTID(tid); setCurrentTID(tid); }, onDeletedTID: (tid) => {
|
70
|
+
let newMruTIDS = mruTIDs.slice();
|
71
|
+
let index = newMruTIDS.findIndex(o => o == tid);
|
72
|
+
if (index >= 0)
|
73
|
+
newMruTIDS.splice(index, 1);
|
74
|
+
SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS.filter(tid => tid != undefined && tid != null);
|
75
|
+
setMruTIDs(newMruTIDS);
|
76
|
+
} }),
|
77
|
+
hidden: false,
|
78
|
+
panel: {
|
79
|
+
title: "Scorciatoie",
|
80
|
+
totalItems: mruTIDs.length
|
81
|
+
}
|
82
|
+
}
|
83
|
+
],
|
84
|
+
}
|
85
|
+
],
|
86
|
+
[
|
87
|
+
"column-2",
|
88
|
+
{
|
89
|
+
width: "40%",
|
90
|
+
rows: [
|
91
|
+
{
|
92
|
+
id: 'searchQueryPanel',
|
93
|
+
height: '100%',
|
94
|
+
width: '100%',
|
95
|
+
content: _jsx(TMSearchQueryPanel, { isExpertMode: isExpertMode, fromDTD: fromDTD, SQD: currentSQD, onBack: deviceType !== DeviceType.DESKTOP ? () => { setCurrentTID(0); } : undefined, onSearchCompleted: (searchResult, qd) => {
|
96
|
+
setSearchResult(searchResult);
|
97
|
+
if (searchResult.length <= 0)
|
98
|
+
return;
|
99
|
+
setLastQdSearched(qd);
|
100
|
+
setCurrentSearchView(TMSearchViews.Result);
|
101
|
+
// Salvataggio ultimi 10 TIDs
|
102
|
+
let fromTID = searchResult?.[0].fromTID;
|
103
|
+
let newMruTIDS = mruTIDs.slice();
|
104
|
+
let index = newMruTIDS.findIndex(o => o == fromTID);
|
105
|
+
if (index >= 0)
|
106
|
+
newMruTIDS.splice(index, 1);
|
107
|
+
if (newMruTIDS.length >= 10)
|
108
|
+
newMruTIDS.splice(0, 1);
|
109
|
+
newMruTIDS.push(fromTID);
|
110
|
+
setMruTIDs(newMruTIDS);
|
111
|
+
setCurrentMruTID(fromTID);
|
112
|
+
SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS.filter(tid => tid != undefined && tid != null);
|
113
|
+
}, onSqdSaved: async (newSqd) => {
|
114
|
+
await loadDataSQDsAsync(true, newSqd.masterTID);
|
115
|
+
await setSQDAsync(newSqd);
|
116
|
+
} }),
|
117
|
+
hidden: false
|
118
|
+
}
|
119
|
+
],
|
120
|
+
}
|
121
|
+
],
|
122
|
+
[
|
123
|
+
"column-4",
|
124
|
+
{
|
125
|
+
width: "20%",
|
126
|
+
rows: [
|
127
|
+
{
|
128
|
+
id: 'savedQuery',
|
129
|
+
height: '100%',
|
130
|
+
width: '100%',
|
131
|
+
content: _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,
|
132
|
+
// selectedId={currentSQD?.id}
|
133
|
+
onItemClick: (sqd) => onSQDItemClick(sqd, setSQDAsync), onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? undefined : currentSQD, setSQDAsync) }) })] }),
|
134
|
+
hidden: false,
|
135
|
+
panel: {
|
136
|
+
title: SDK_Localizator.SavedQueries
|
137
|
+
}
|
138
|
+
}
|
139
|
+
],
|
140
|
+
}
|
141
|
+
]
|
142
|
+
]);
|
143
|
+
const toolbar = useMemo(() => {
|
144
|
+
return {
|
145
|
+
items: [
|
146
|
+
{
|
147
|
+
id: 'toolbar-item-treeSelector',
|
148
|
+
icon: _jsx(IconTree, {}),
|
149
|
+
tooltipName: 'treeSelector',
|
150
|
+
panelManagerMatrixRowId: 'treeSelector',
|
151
|
+
},
|
152
|
+
{
|
153
|
+
id: 'toolbar-item-recentsManager',
|
154
|
+
icon: _jsx(IconProgressReady, {}),
|
155
|
+
tooltipName: 'recentsManager',
|
156
|
+
panelManagerMatrixRowId: 'recentsManager',
|
157
|
+
},
|
158
|
+
{
|
159
|
+
id: 'toolbar-item-searchQueryPanel',
|
160
|
+
icon: _jsx(IconProgressReady, {}),
|
161
|
+
tooltipName: 'searchQueryPanel',
|
162
|
+
panelManagerMatrixRowId: 'searchQueryPanel',
|
163
|
+
visible: deviceType === DeviceType.MOBILE
|
164
|
+
},
|
165
|
+
{
|
166
|
+
id: 'toolbar-item-savedQuery',
|
167
|
+
icon: _jsx(IconSavedQuery, {}),
|
168
|
+
tooltipName: 'savedQuery',
|
169
|
+
panelManagerMatrixRowId: 'savedQuery',
|
170
|
+
// alternativePanelManagerMatrixRowId: ['distinctValues']
|
171
|
+
}
|
172
|
+
]
|
173
|
+
};
|
174
|
+
}, [deviceType]);
|
39
175
|
useEffect(() => {
|
40
176
|
setMruTIDs(SDKUI_Globals.userSettings.searchSettings.mruTIDs);
|
41
177
|
loadDataSQDsAsync(false);
|
@@ -123,67 +259,7 @@ const TMSearch = ({ inputTID, inputSqdID, isExpertMode = SDKUI_Globals.userSetti
|
|
123
259
|
if (sqdToBeSet)
|
124
260
|
await setSqdAsync?.(sqdToBeSet);
|
125
261
|
}, []);
|
126
|
-
|
127
|
-
{ icon: _jsx(IconTree, {}), id: 'trees', visibleName: 'Alberi', isActive: showTreesPanel, visible: true },
|
128
|
-
{ icon: _jsx(IconProgressReady, {}), id: 'recents', visibleName: 'Recenti', isActive: showRecentsPanel, visible: true, },
|
129
|
-
{ icon: _jsx(IconSavedQuery, {}), id: 'savedquery', visibleName: 'Ricerche rapide', isActive: showSavedQueryPanel, visible: true },
|
130
|
-
{ icon: _jsx(IconDataList, {}), id: 'DistinctValues', visibleName: 'Valori distiniti', isActive: showDistinctValuesPanel, disabled: !focusedTidMid, visible: true }
|
131
|
-
];
|
132
|
-
const rightSidebarItemClickHandler = (item) => {
|
133
|
-
switch (item.toLowerCase()) {
|
134
|
-
case 'trees':
|
135
|
-
setShowTreesPanel(!showTreesPanel);
|
136
|
-
break;
|
137
|
-
case 'recents':
|
138
|
-
setShowRecentsPanel(!showRecentsPanel);
|
139
|
-
break;
|
140
|
-
case 'savedquery':
|
141
|
-
setShowSavedQueryPanel(!showSavedQueryPanel);
|
142
|
-
break;
|
143
|
-
case 'distinctvalues':
|
144
|
-
setShowDistinctValuesPanel(!showDistinctValuesPanel);
|
145
|
-
break;
|
146
|
-
default: break;
|
147
|
-
}
|
148
|
-
};
|
149
|
-
return (_jsxs(_Fragment, { children: [_jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.None, children: _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', showSeparator: deviceType !== DeviceType.MOBILE && showTreesPanel, separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: (deviceType === DeviceType.MOBILE) ? ['100%', '0%'] : showTreesPanel ? ['20%', '80%'] : ['0%', '100%'], children: [deviceType !== DeviceType.MOBILE &&
|
150
|
-
_jsx(TMTreeSelector, { onClose: () => setShowTreesPanel(false), onSelectedTIDChanged: (tid) => {
|
151
|
-
setCurrentTID(tid);
|
152
|
-
if (tid && mruTIDs.includes(tid))
|
153
|
-
setCurrentMruTID(tid);
|
154
|
-
else
|
155
|
-
setCurrentMruTID(0);
|
156
|
-
} }), _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', showSeparator: deviceType !== DeviceType.MOBILE && showSavedQueryPanel && !showDistinctValuesPanel, separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: (deviceType === DeviceType.MOBILE || showDistinctValuesPanel) ? ['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, onClose: () => setShowRecentsPanel(false), children: _jsx(TMRecentsManager, { mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => { setCurrentMruTID(tid); setCurrentTID(tid); }, onDeletedTID: (tid) => {
|
157
|
-
let newMruTIDS = mruTIDs.slice();
|
158
|
-
let index = newMruTIDS.findIndex(o => o == tid);
|
159
|
-
if (index >= 0)
|
160
|
-
newMruTIDS.splice(index, 1);
|
161
|
-
SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS.filter(tid => tid != undefined && tid != null);
|
162
|
-
setMruTIDs(newMruTIDS);
|
163
|
-
} }) }), _jsx(TMSearchQueryPanel, { isExpertMode: isExpertMode, fromDTD: fromDTD, SQD: currentSQD, isOpenDistinctValuesPanel: showDistinctValuesPanel, rightSidebarItems: rightSidebarItems, onBack: deviceType !== DeviceType.DESKTOP ? () => { setCurrentTID(0); } : undefined, onFocusedMetadataChanged: setFocusedTidMid, onRightSidebarItemClick: rightSidebarItemClickHandler, onCloseDistinctValuesPanel: () => setShowDistinctValuesPanel(false), onSearchCompleted: (searchResult, qd) => {
|
164
|
-
setSearchResult(searchResult);
|
165
|
-
if (searchResult.length <= 0)
|
166
|
-
return;
|
167
|
-
setLastQdSearched(qd);
|
168
|
-
setCurrentSearchView(TMSearchViews.Result);
|
169
|
-
// Salvataggio ultimi 10 TIDs
|
170
|
-
let fromTID = searchResult?.[0].fromTID;
|
171
|
-
let newMruTIDS = mruTIDs.slice();
|
172
|
-
let index = newMruTIDS.findIndex(o => o == fromTID);
|
173
|
-
if (index >= 0)
|
174
|
-
newMruTIDS.splice(index, 1);
|
175
|
-
if (newMruTIDS.length >= 10)
|
176
|
-
newMruTIDS.splice(0, 1);
|
177
|
-
newMruTIDS.push(fromTID);
|
178
|
-
setMruTIDs(newMruTIDS);
|
179
|
-
setCurrentMruTID(fromTID);
|
180
|
-
SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS.filter(tid => tid != undefined && tid != null);
|
181
|
-
}, onSqdSaved: async (newSqd) => {
|
182
|
-
await loadDataSQDsAsync(true, newSqd.masterTID);
|
183
|
-
await setSQDAsync(newSqd);
|
184
|
-
} })] }) }), _jsx(StyledMultiViewPanel, { "$isVisible": !showDistinctValuesPanel, children: _jsx(TMLayoutItem, { children: _jsx(TMPanel, { title: SDK_Localizator.SavedQueries, onClose: () => 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,
|
185
|
-
// selectedId={currentSQD?.id}
|
186
|
-
onItemClick: (sqd) => onSQDItemClick(sqd, setSQDAsync), onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? undefined : currentSQD, setSQDAsync) }) })] }) }) }) })] })] }) }), _jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.Result, children: searchResult.length > 0 &&
|
262
|
+
return (_jsxs(_Fragment, { children: [_jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.None, children: _jsx(TMPanelManagerMatrix, { panelMatrixMap: panelMatrixMap, toolbar: toolbar, initialMobilePanelID: "recentsManager" }) }), _jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.Result, children: searchResult.length > 0 &&
|
187
263
|
_jsx(TMSearchResult, { context: SearchResultContext.METADATA_SEARCH, searchResults: searchResult, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, onRefreshSearchAsync: async () => {
|
188
264
|
// setSearchResult([]);
|
189
265
|
setSearchResult(await refreshLastSearch(lastQdSearched) ?? []);
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { DcmtTypeDescriptor, QueryDescriptor } from '@topconsultnpm/sdk-ts-beta';
|
3
3
|
import { TID_MID } from '../../../ts';
|
4
|
+
import { AdvancedMenuClickEventArgs } from '../../editors/TMMetadataValues';
|
4
5
|
interface ITMSearchQueryEditorProps {
|
5
6
|
qd: QueryDescriptor | undefined;
|
6
7
|
fromDTD?: DcmtTypeDescriptor;
|
@@ -9,6 +10,7 @@ interface ITMSearchQueryEditorProps {
|
|
9
10
|
showAllMdWhere?: boolean;
|
10
11
|
isOpenDistinctValuesPanel: boolean;
|
11
12
|
onQdChanged?: (qd: QueryDescriptor) => void;
|
13
|
+
onAdvancedMenuClick?: (e: AdvancedMenuClickEventArgs) => void;
|
12
14
|
onFocusedMetadataChanged?: (tid_mid: TID_MID | undefined) => void;
|
13
15
|
}
|
14
16
|
declare const TMSearchQueryEditor: React.FunctionComponent<ITMSearchQueryEditorProps>;
|
@@ -13,6 +13,7 @@ import { FormulaHelper } from '../../editors/TMFormulaEditor';
|
|
13
13
|
import TMMetadataEditor, { useMetadataEditableList } from '../../editors/TMMetadataEditor';
|
14
14
|
import { colorOperator, StyledItemWrapper, StyledRowItem } from '../../query/TMQueryEditor';
|
15
15
|
import { TMMidViewer } from '../../viewers/TMMidViewer';
|
16
|
+
import { AdvancedMenuButtons } from '../../editors/TMMetadataValues';
|
16
17
|
const StyledMetadataListItem = styled.div `
|
17
18
|
padding: 5px;
|
18
19
|
border-radius: 8px;
|
@@ -27,7 +28,7 @@ const StyledMetadataListItem = styled.div `
|
|
27
28
|
cursor: pointer;
|
28
29
|
}
|
29
30
|
`;
|
30
|
-
const TMSearchQueryEditor = ({ qd, fromDTD, dcmtTypesList = [], isOpenDistinctValuesPanel, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, showAllMdWhere, onQdChanged, onFocusedMetadataChanged }) => {
|
31
|
+
const TMSearchQueryEditor = ({ qd, fromDTD, dcmtTypesList = [], isOpenDistinctValuesPanel, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, showAllMdWhere, onQdChanged, onFocusedMetadataChanged, onAdvancedMenuClick }) => {
|
31
32
|
const [dynDataListsToBeRefreshed, setDynDataListsToBeRefreshed] = useState([]);
|
32
33
|
const [showDistinctValuesPanel, setShowDistinctValuesPanel] = useState(false);
|
33
34
|
const [currentEditingMID, setCurrentEditingMID] = useState(0);
|
@@ -134,10 +135,27 @@ const TMSearchQueryEditor = ({ qd, fromDTD, dcmtTypesList = [], isOpenDistinctVa
|
|
134
135
|
let md = dtd.metadata?.find(o => o.id == mid);
|
135
136
|
if (!md)
|
136
137
|
return [];
|
137
|
-
let menu = [
|
138
|
-
|
139
|
-
|
140
|
-
|
138
|
+
let menu = [];
|
139
|
+
// Show MakeEditable/Restore only if isExpertMode is true
|
140
|
+
if (isExpertMode) {
|
141
|
+
menu.push({
|
142
|
+
text: isEditable ? SDKUI_Localizator.Restore : SDKUI_Localizator.MakeEditable,
|
143
|
+
icon: isEditable ? _jsx(IconUndo, {}) : _jsx(IconPencil, {}),
|
144
|
+
onClick: () => {
|
145
|
+
addOrRemoveEditableList(mid);
|
146
|
+
onAdvancedMenuClick?.({ tid: tid, mid: mid, button: AdvancedMenuButtons.MakeEditable });
|
147
|
+
}
|
148
|
+
});
|
149
|
+
}
|
150
|
+
menu.push({
|
151
|
+
text: SDKUI_Localizator.DistinctValues,
|
152
|
+
icon: _jsx(IconDataList, {}),
|
153
|
+
onClick: () => {
|
154
|
+
handleMetadataSelection(tid, mid);
|
155
|
+
setShowDistinctValuesPanel(!showDistinctValuesPanel);
|
156
|
+
onAdvancedMenuClick?.({ tid: tid, mid: mid, button: AdvancedMenuButtons.DistinctValues });
|
157
|
+
}
|
158
|
+
});
|
141
159
|
return menu;
|
142
160
|
};
|
143
161
|
return (_jsx(_Fragment, { children: deviceType === DeviceType.MOBILE ?
|
@@ -202,7 +220,7 @@ const TMSearchQueryEditor = ({ qd, fromDTD, dcmtTypesList = [], isOpenDistinctVa
|
|
202
220
|
? _jsx(IconFunction, { color: "#1a89d3", fontSize: 14, style: { position: "absolute", top: '-5px', left: '-10px' } })
|
203
221
|
: (isEditableList(whereItem.mid))
|
204
222
|
? _jsx(IconPencil, { color: "#138603", fontSize: 14, style: { position: "absolute", top: '-5px', left: '-10px' } })
|
205
|
-
: _jsx(_Fragment, {})] }),
|
223
|
+
: _jsx(_Fragment, {})] }), _jsx("div", { style: { gridColumn: 4 }, children: _jsx(TMDropDownMenu, { backgroundColor: 'white', color: TMColors.button_icon, borderRadius: '3px', content: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconMenuVertical, {}), showTooltip: false }), items: getAdvancedMenuItems(whereItem.tid, whereItem.mid) }) })] }, `${whereItem.tid}_${whereItem.mid}_${index}`));
|
206
224
|
}) }) }));
|
207
225
|
};
|
208
226
|
export default TMSearchQueryEditor;
|
@@ -5,14 +5,12 @@ import { ITMRightSidebarItem } from '../../base/TMRightSidebar';
|
|
5
5
|
interface ITMSearchQueryPanelProps {
|
6
6
|
fromDTD?: DcmtTypeDescriptor;
|
7
7
|
SQD?: SavedQueryDescriptor;
|
8
|
-
isOpenDistinctValuesPanel?: boolean;
|
9
8
|
rightSidebarItems?: ITMRightSidebarItem[];
|
10
9
|
isExpertMode?: boolean;
|
11
10
|
onBack?: () => void;
|
12
11
|
onRightSidebarItemClick?: (item: string) => void;
|
13
12
|
onSqdSaved?: (newSqd: SavedQueryDescriptor) => void;
|
14
13
|
onFocusedMetadataChanged?: (tid_mid: TID_MID | undefined) => void;
|
15
|
-
onCloseDistinctValuesPanel?: () => void;
|
16
14
|
onSearchCompleted?: (searchResult: SearchResultDescriptor[], qd: QueryDescriptor | undefined) => void;
|
17
15
|
}
|
18
16
|
declare const TMSearchQueryPanel: React.FunctionComponent<ITMSearchQueryPanelProps>;
|
@@ -8,12 +8,12 @@ import { getDcmtTypesByQdAsync, SDKUI_Localizator, getQD, IconMenuVertical, Icon
|
|
8
8
|
import { useQueryParametersDialog } from '../../../hooks/useQueryParametersDialog';
|
9
9
|
import { FormModes } from '../../../ts';
|
10
10
|
import { TMColors } from '../../../utils/theme';
|
11
|
-
import { StyledModalContainer
|
11
|
+
import { StyledModalContainer } from '../../base/Styled';
|
12
12
|
import ShowAlert from '../../base/TMAlert';
|
13
13
|
import TMButton from '../../base/TMButton';
|
14
14
|
import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
|
15
15
|
import TMDropDownMenu from '../../base/TMDropDownMenu';
|
16
|
-
import TMLayoutContainer, {
|
16
|
+
import TMLayoutContainer, { TMLayoutItem } from '../../base/TMLayout';
|
17
17
|
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
18
18
|
import TMSpinner from '../../base/TMSpinner';
|
19
19
|
import TMPanel from '../../base/TMPanel';
|
@@ -21,7 +21,8 @@ import TMDistinctValues from '../../choosers/TMDistinctValues';
|
|
21
21
|
import { TMMetadataChooserForm } from '../../choosers/TMMetadataChooser';
|
22
22
|
import TMQueryEditor from '../../query/TMQueryEditor';
|
23
23
|
import TMSavedQueryForm from './TMSavedQueryForm';
|
24
|
-
|
24
|
+
import { AdvancedMenuButtons } from '../../editors/TMMetadataValues';
|
25
|
+
const TMSearchQueryPanel = ({ fromDTD, rightSidebarItems, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, SQD, onRightSidebarItemClick, onSearchCompleted, onFocusedMetadataChanged, onSqdSaved, onBack }) => {
|
25
26
|
const [confirmQueryParams, ConfirmQueryParamsDialog] = useQueryParametersDialog();
|
26
27
|
const [qd, setQd] = useState();
|
27
28
|
const [lastQdParams, setLastQdParams] = useState([]);
|
@@ -33,6 +34,7 @@ const TMSearchQueryPanel = ({ fromDTD, rightSidebarItems, isExpertMode = SDKUI_G
|
|
33
34
|
const [showFiltersConfig, setShowFiltersConfig] = useState(false);
|
34
35
|
const [showOutputConfig, setShowOutputConfig] = useState(false);
|
35
36
|
const [showOrderByConfig, setShowOrderByConfig] = useState(false);
|
37
|
+
const [showDistinctValuesPanel, setShowDistinctValuesPanel] = useState(false);
|
36
38
|
const [focusedTidMid, setFocusedTidMid] = useState();
|
37
39
|
const deviceType = useDeviceType();
|
38
40
|
let initialMaxItems = deviceType === DeviceType.MOBILE ? 8 : 12;
|
@@ -98,7 +100,7 @@ const TMSearchQueryPanel = ({ fromDTD, rightSidebarItems, isExpertMode = SDKUI_G
|
|
98
100
|
}
|
99
101
|
}
|
100
102
|
};
|
101
|
-
return (_jsxs(
|
103
|
+
return (_jsxs(_Fragment, { children: [_jsxs(TMPanel, { title: fromDTD?.nameLoc ?? SDKUI_Localizator.Search_Metadata, items: rightSidebarItems, onItemClick: onRightSidebarItemClick, onBack: onBack, toolbar: _jsx(_Fragment, { children: (SQD && !showSqdForm) ?
|
102
104
|
_jsx(TMDropDownMenu, { backgroundColor: 'white', borderRadius: '3px', content: _jsx(TMButton, { btnStyle: 'icon', caption: 'Altro', icon: _jsx(IconMenuVertical, { color: 'white' }), showTooltip: false }), items: [
|
103
105
|
{ icon: _jsx(IconAddCircleOutline, {}), text: SDKUI_Localizator.SavedQueryNew, onClick: () => { openSqdForm(FormModes.Create); } },
|
104
106
|
{ icon: _jsx(IconEdit, {}), text: SDKUI_Localizator.SavedQueryUpdate, disabled: (SQD && SQD.id == 1), onClick: () => { openSqdForm(FormModes.Update); } },
|
@@ -112,7 +114,11 @@ const TMSearchQueryPanel = ({ fromDTD, rightSidebarItems, isExpertMode = SDKUI_G
|
|
112
114
|
? _jsxs("div", { style: { height: '100%', width: '100%', position: 'relative', display: 'flex', flexDirection: 'column', gap: 5 }, children: [showAdvancedSearch
|
113
115
|
? _jsx(TMQueryEditor, { formMode: FormModes.Update, showToolbar: false, inputData: qd, validateSelect: true, showApply: false, onQDChanged: (newQd) => { if (!deepCompare(qd, newQd))
|
114
116
|
setQd(newQd); } })
|
115
|
-
: _jsx(TMSearchQueryEditor, { qd: qd, fromDTD: fromDTD, dcmtTypesList: dcmtTypesList, isOpenDistinctValuesPanel:
|
117
|
+
: _jsx(TMSearchQueryEditor, { qd: qd, fromDTD: fromDTD, dcmtTypesList: dcmtTypesList, isOpenDistinctValuesPanel: showDistinctValuesPanel, isExpertMode: isExpertMode, showAllMdWhere: showAllMdWhere, onFocusedMetadataChanged: setFocusedTidMid, onAdvancedMenuClick: (e) => {
|
118
|
+
if (e.button === AdvancedMenuButtons.DistinctValues) {
|
119
|
+
setShowDistinctValuesPanel(true);
|
120
|
+
}
|
121
|
+
}, onQdChanged: (newQd) => { if (!deepCompare(qd, newQd))
|
116
122
|
setQd(newQd); } }), _jsxs("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '80px', padding: '15px', position: 'relative' }, children: [_jsxs("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '8px' }, children: [_jsx(TMButton, { btnStyle: 'advanced', icon: _jsx(IconSearch, {}), showTooltip: false, caption: SDKUI_Localizator.Search, onClick: async () => await searchAsync(qd, showAdvancedSearch), advancedColor: '#f09c0a' }), _jsx(TMButton, { btnStyle: 'advanced', showTooltip: false, caption: SDKUI_Localizator.Clear, icon: _jsx(IconClear, {}), advancedColor: TMColors.primaryColor, onClick: clearFilters })] }), (!showAdvancedSearch && qd?.where && qd?.where?.length > initialMaxItems) && _jsx(TMButton, { elementStyle: { position: 'absolute', right: '10px' }, btnStyle: 'icon', caption: showAllMdWhere ? "Mostra meno" : `Mostra tutti i metadati (+${qd?.where?.length - initialMaxItems})`, icon: showAllMdWhere ?
|
117
123
|
_jsx("div", { style: { backgroundColor: TMColors.primaryColor, minWidth: '30px', minHeight: '30px', borderRadius: '10px', display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: _jsx("p", { style: { color: 'white' }, children: `-${qd?.where?.length - initialMaxItems}` }) }) :
|
118
124
|
_jsx("div", { style: { backgroundColor: TMColors.primaryColor, minWidth: '30px', minHeight: '30px', borderRadius: '10px', display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: _jsx("p", { style: { color: 'white' }, children: `+${qd?.where?.length - initialMaxItems}` }) }), onClick: () => setShowAllMdWhere(!showAllMdWhere) })] }), showFiltersConfig &&
|
@@ -191,7 +197,8 @@ const TMSearchQueryPanel = ({ fromDTD, rightSidebarItems, isExpertMode = SDKUI_G
|
|
191
197
|
} })] })
|
192
198
|
:
|
193
199
|
_jsxs(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: [_jsxs(TMLayoutItem, { width: 'max-content', height: 'max-content', children: [" ", _jsxs(StyledToppyTextContainer, { children: [" ", _jsxs(StyledToppyText, { children: [" ", 'Selezionare un tipo documento o ricerca rapida', " "] }), " "] }), " "] }), _jsxs(TMLayoutItem, { width: 'max-content', height: 'max-content', children: [" ", _jsx("img", { src: Logo, width: 120, alt: '' }), " "] })] }), showSqdForm &&
|
194
|
-
_jsx(StyledModalContainer, { style: { backgroundColor: `${TMColors.backgroundColorHeader}12` }, children: _jsx(TMSavedQueryForm, { height: '50%', width: '50%', id: formModeSqdForm === FormModes.Create ? -1 : SQD?.id, title: 'Ricerca rapida', formMode: formModeSqdForm, showBackButton: true, qd: qd, isAdvancedSearch: showAdvancedSearch, isModal: false, onClose: () => { setShowSqdForm(false); }, onSaved: onSqdSaved }) })] }),
|
200
|
+
_jsx(StyledModalContainer, { style: { backgroundColor: `${TMColors.backgroundColorHeader}12` }, children: _jsx(TMSavedQueryForm, { height: '50%', width: '50%', id: formModeSqdForm === FormModes.Create ? -1 : SQD?.id, title: 'Ricerca rapida', formMode: formModeSqdForm, showBackButton: true, qd: qd, isAdvancedSearch: showAdvancedSearch, isModal: false, onClose: () => { setShowSqdForm(false); }, onSaved: onSqdSaved }) })] }), showDistinctValuesPanel &&
|
201
|
+
_jsx(TMDistinctValues, { isModal: true, tid: focusedTidMid?.tid, mid: focusedTidMid?.mid, separator: ',', onClosePanelCallback: () => setShowDistinctValuesPanel(false), onSelectionChanged: (e) => {
|
195
202
|
if (!e)
|
196
203
|
return;
|
197
204
|
let wi = qd?.where?.find(o => o.tid === focusedTidMid?.tid && o.mid === focusedTidMid?.mid);
|
@@ -206,7 +213,7 @@ const TMSearchQueryPanel = ({ fromDTD, rightSidebarItems, isExpertMode = SDKUI_G
|
|
206
213
|
return wi;
|
207
214
|
});
|
208
215
|
setQd({ ...qd, where: whereCopy });
|
209
|
-
} })
|
216
|
+
} })] }));
|
210
217
|
};
|
211
218
|
export default TMSearchQueryPanel;
|
212
219
|
const searchByQdAsync = async (qdInput, searchParams) => {
|