@topconsultnpm/sdkui-react 6.20.0-dev1.3 → 6.20.0-dev1.30
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/NewComponents/ContextMenu/TMContextMenu.js +3 -3
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +1 -0
- package/lib/components/NewComponents/ContextMenu/hooks.js +8 -4
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +4 -1
- package/lib/components/NewComponents/ContextMenu/styles.js +41 -8
- package/lib/components/NewComponents/ContextMenu/types.d.ts +1 -0
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +38 -30
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +8 -0
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +30 -19
- package/lib/components/base/TMAccordion.js +2 -2
- package/lib/components/base/TMCustomButton.js +41 -5
- package/lib/components/base/TMDataGrid.d.ts +2 -2
- package/lib/components/base/TMDataGrid.js +16 -5
- package/lib/components/editors/TMHtmlEditor.js +1 -1
- package/lib/components/editors/TMMetadataValues.js +20 -2
- package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -7
- package/lib/components/features/documents/TMDcmtBlog.js +29 -2
- package/lib/components/features/documents/TMDcmtForm.js +268 -168
- package/lib/components/features/documents/TMDcmtPreview.js +37 -66
- package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +8 -0
- package/lib/components/features/search/{TMSearchResultCheckoutInfoForm.js → TMDcmtCheckoutInfoForm.js} +6 -11
- package/lib/components/features/search/TMSearchQueryPanel.js +13 -12
- package/lib/components/features/search/TMSearchResult.js +74 -111
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
- package/lib/components/features/search/TMSearchResultsMenuItems.js +26 -43
- package/lib/components/features/search/TMSignatureInfoContent.d.ts +6 -0
- package/lib/components/features/search/TMSignatureInfoContent.js +140 -0
- package/lib/components/forms/Login/LoginValidatorService.d.ts +2 -0
- package/lib/components/forms/Login/LoginValidatorService.js +7 -2
- package/lib/components/forms/Login/TMLoginForm.js +34 -6
- package/lib/css/tm-sdkui.css +1 -1
- package/lib/helper/SDKUI_Globals.d.ts +13 -14
- package/lib/helper/SDKUI_Globals.js +9 -0
- package/lib/helper/SDKUI_Localizator.d.ts +8 -0
- package/lib/helper/SDKUI_Localizator.js +98 -0
- package/lib/helper/TMPdfViewer.d.ts +8 -0
- package/lib/helper/TMPdfViewer.js +187 -0
- package/lib/helper/TMUtils.d.ts +3 -1
- package/lib/helper/TMUtils.js +51 -0
- package/lib/helper/checkinCheckoutManager.d.ts +85 -0
- package/lib/helper/checkinCheckoutManager.js +348 -0
- package/lib/helper/devextremeCustomMessages.d.ts +30 -0
- package/lib/helper/devextremeCustomMessages.js +30 -0
- package/lib/helper/helpers.js +7 -1
- package/lib/helper/index.d.ts +2 -0
- package/lib/helper/index.js +2 -0
- package/lib/helper/queryHelper.js +29 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
- package/lib/hooks/useCheckInOutOperations.js +223 -0
- package/lib/services/platform_services.d.ts +1 -1
- package/package.json +5 -2
- package/lib/components/NewComponents/Notification/Notification.d.ts +0 -4
- package/lib/components/NewComponents/Notification/Notification.js +0 -60
- package/lib/components/NewComponents/Notification/NotificationContainer.d.ts +0 -8
- package/lib/components/NewComponents/Notification/NotificationContainer.js +0 -33
- package/lib/components/NewComponents/Notification/index.d.ts +0 -2
- package/lib/components/NewComponents/Notification/index.js +0 -2
- package/lib/components/NewComponents/Notification/styles.d.ts +0 -21
- package/lib/components/NewComponents/Notification/styles.js +0 -180
- package/lib/components/NewComponents/Notification/types.d.ts +0 -18
- package/lib/components/NewComponents/Notification/types.js +0 -1
- package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
- package/lib/helper/cicoHelper.d.ts +0 -31
- package/lib/helper/cicoHelper.js +0 -155
|
@@ -8,13 +8,14 @@ import { FileExtensionHandler, FormModes } from '../../../ts';
|
|
|
8
8
|
import { TMColors } from '../../../utils/theme';
|
|
9
9
|
import ShowAlert from '../../base/TMAlert';
|
|
10
10
|
import TMButton from '../../base/TMButton';
|
|
11
|
-
import TMDropDownMenu from '../../base/TMDropDownMenu';
|
|
12
11
|
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
|
13
12
|
import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
|
|
14
13
|
import { TMSaveFormButtonPrevious, TMSaveFormButtonNext } from '../../forms/TMSaveForm';
|
|
15
14
|
import { StyledAnimatedComponentOpacity } from '../../base/Styled';
|
|
16
15
|
import TMPanel from '../../base/TMPanel';
|
|
17
16
|
import TMTooltip from '../../base/TMTooltip';
|
|
17
|
+
import { ContextMenu } from '../../NewComponents/ContextMenu';
|
|
18
|
+
import TMPdfViewer from '../../../helper/TMPdfViewer';
|
|
18
19
|
const ErrorContent = ({ error, isAbortError, onRetry }) => {
|
|
19
20
|
if (isAbortError) {
|
|
20
21
|
return (_jsx(StyledAnimatedComponentOpacity, { style: { width: '100%', height: '100%' }, children: _jsxs(StyledPanelStatusContainer, { children: [_jsx(IconCloseOutline, { fontSize: 92, color: TMColors.error }), _jsxs(StyledPreviewNotAvailable, { children: [_jsx("div", { children: error }), _jsx("div", { children: SDKUI_Localizator.PreviewNotAvailable })] }), _jsx(TMButton, { caption: SDKUI_Localizator.TryAgain, onClick: onRetry, showTooltip: false })] }) }));
|
|
@@ -124,10 +125,11 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
|
|
|
124
125
|
console.error('Error reopening document:', error);
|
|
125
126
|
}
|
|
126
127
|
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
const cacheMenuItems = useMemo(() => [
|
|
129
|
+
{ icon: _jsx(IconCloseCircle, {}), name: SDKUI_Localizator.RemoveFromCache, onClick: () => { removeDcmtsFileCache(cacheKey); setIsFromCache(false); } },
|
|
130
|
+
{ icon: _jsx(IconClear, {}), name: SDKUI_Localizator.ClearCache, onClick: () => { clearDcmtsFileCache(); setIsFromCache(false); } },
|
|
131
|
+
], [cacheKey, removeDcmtsFileCache, clearDcmtsFileCache, setIsFromCache]);
|
|
132
|
+
return (_jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsx(TMPanel, { padding: '0', title: titleHandler(), onClose: onClosePanel, allowMaximize: allowMaximize, onMaximize: onMaximizePanel, onHeaderDoubleClick: onMaximizePanel, toolbar: _jsxs("div", { style: { width: 'max-content', display: 'flex', alignItems: 'center', gap: '10px' }, children: [onPrev && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', isModified: false, formMode: FormModes.ReadOnly, canPrev: canPrev, onPrev: onPrev }), onNext && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', isModified: false, formMode: FormModes.ReadOnly, canNext: canNext, onNext: onNext }), _jsx(StyledHeaderIcon, { "$color": TMColors.primaryColor, children: _jsx(ContextMenu, { items: cacheMenuItems, trigger: "left", children: _jsx(IconMenuVertical, {}) }) }), _jsx(StyledHeaderIcon, { onClick: reOpenDcmt, "$color": TMColors.primaryColor, children: _jsx(TMTooltip, { content: SDKUI_Localizator.ReopenDocument, children: _jsx(IconRefresh, {}) }) })] }), children: error
|
|
131
133
|
? _jsx(ErrorContent, { error: error, isAbortError: isAbortError, onRetry: reOpenDcmt })
|
|
132
134
|
: renderedPreview(dcmtData?.tid, dcmtData?.did, dcmtData?.fileExt, dcmtData?.fileSize, dcmtData?.fileCount, extensionHandler(dcmtData?.fileExt), showPreview, isResizingActive, () => { loadDocumentWithCache(); setShowPreview(true); }, dcmtBlob) }) }));
|
|
133
135
|
};
|
|
@@ -136,35 +138,10 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
|
|
|
136
138
|
const [blobUrl, setBlobUrl] = useState(undefined);
|
|
137
139
|
const [fileType, setFileType] = useState(undefined);
|
|
138
140
|
const [formattedXml, setFormattedXml] = useState(undefined);
|
|
139
|
-
const [isMobile, setIsMobile] = useState(false);
|
|
140
|
-
useEffect(() => {
|
|
141
|
-
const checkIsMobile = () => {
|
|
142
|
-
const userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
143
|
-
// Only detect actual mobile/tablet devices, NOT desktop browsers
|
|
144
|
-
const isMobileDevice =
|
|
145
|
-
// Traditional mobile detection (phones and tablets)
|
|
146
|
-
/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) ||
|
|
147
|
-
// Additional Android tablet detection (covers tablets in landscape)
|
|
148
|
-
/android.*tablet|android.*mobile/i.test(userAgent) ||
|
|
149
|
-
// Touch-only devices (excludes laptops with touchscreen)
|
|
150
|
-
(('ontouchstart' in window || navigator.maxTouchPoints > 0) &&
|
|
151
|
-
!/Windows NT|Macintosh|Linux/.test(userAgent)) ||
|
|
152
|
-
// Small screen mobile devices only
|
|
153
|
-
(window.screen.width <= 768 && /Mobi|Android/i.test(userAgent));
|
|
154
|
-
setIsMobile(isMobileDevice);
|
|
155
|
-
};
|
|
156
|
-
checkIsMobile();
|
|
157
|
-
// Listen for orientation changes (important for tablets)
|
|
158
|
-
window.addEventListener('orientationchange', checkIsMobile);
|
|
159
|
-
window.addEventListener('resize', checkIsMobile);
|
|
160
|
-
return () => {
|
|
161
|
-
window.removeEventListener('orientationchange', checkIsMobile);
|
|
162
|
-
window.removeEventListener('resize', checkIsMobile);
|
|
163
|
-
};
|
|
164
|
-
}, []);
|
|
165
141
|
useEffect(() => {
|
|
166
142
|
if (fileBlob) {
|
|
167
|
-
|
|
143
|
+
const blobType = fileBlob.type;
|
|
144
|
+
setFileType(blobType);
|
|
168
145
|
setFormattedXml(undefined);
|
|
169
146
|
const fileName = fileBlob.name || '';
|
|
170
147
|
const fileExtension = fileName.split('.').pop()?.toLowerCase() || '';
|
|
@@ -222,41 +199,10 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
|
|
|
222
199
|
if (fileBlob.type.includes('image')) {
|
|
223
200
|
return (_jsx(ImageViewer, { fileBlob: fileBlob, alt: '' }));
|
|
224
201
|
}
|
|
225
|
-
if (fileType === 'application/pdf'
|
|
226
|
-
return
|
|
227
|
-
border: 'none',
|
|
228
|
-
zIndex: 0,
|
|
229
|
-
pointerEvents: isResizingActive === true ? "none" : "auto"
|
|
230
|
-
}, children: _jsxs("div", { style: {
|
|
231
|
-
padding: '40px',
|
|
232
|
-
textAlign: 'center',
|
|
233
|
-
display: 'flex',
|
|
234
|
-
flexDirection: 'column',
|
|
235
|
-
alignItems: 'center',
|
|
236
|
-
justifyContent: 'center',
|
|
237
|
-
height: '100%',
|
|
238
|
-
gap: '20px'
|
|
239
|
-
}, children: [_jsx(IconPreview, { fontSize: 96 }), _jsxs("div", { children: [_jsx("h3", { children: SDKUI_Localizator.PDFDocument }), _jsx("p", { children: SDKUI_Localizator.PreviewNotAvailableOnDevice })] }), _jsxs("div", { style: { display: 'flex', gap: '10px', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'center' }, children: [_jsx("a", { href: blobUrl, download: "document.pdf", style: {
|
|
240
|
-
minWidth: '180px',
|
|
241
|
-
padding: '12px 24px',
|
|
242
|
-
backgroundColor: TMColors.primaryColor,
|
|
243
|
-
color: 'white',
|
|
244
|
-
textDecoration: 'none',
|
|
245
|
-
borderRadius: '4px',
|
|
246
|
-
display: 'inline-block'
|
|
247
|
-
}, children: SDKUI_Localizator.DownloadFile }), _jsx("a", { href: blobUrl, target: "_blank", rel: "noopener noreferrer", style: {
|
|
248
|
-
minWidth: '180px',
|
|
249
|
-
padding: '12px 24px',
|
|
250
|
-
backgroundColor: TMColors.primaryColor,
|
|
251
|
-
color: 'white',
|
|
252
|
-
textDecoration: 'none',
|
|
253
|
-
borderRadius: '4px',
|
|
254
|
-
display: 'inline-block'
|
|
255
|
-
}, children: SDKUI_Localizator.OpenInNewTab })] })] }) }, blobUrl));
|
|
202
|
+
if (fileType === 'application/pdf') {
|
|
203
|
+
return _jsx(TMPdfViewer, { pdfBlob: fileBlob, isResizingActive: isResizingActive, enableFitToWidth: true });
|
|
256
204
|
}
|
|
257
|
-
return (_jsx("iframe", { srcDoc: formattedXml ? `<html><body>${formattedXml}</body></html>` : undefined, src: !formattedXml
|
|
258
|
-
? (fileType === 'application/pdf' ? `${blobUrl}#view=FitH&scrollbar=1` : blobUrl)
|
|
259
|
-
: undefined, title: "File Viewer", width: "100%", height: "100%", style: { border: 'none', zIndex: 0, pointerEvents: isResizingActive === true ? "none" : "auto" } }, blobUrl));
|
|
205
|
+
return (_jsx("iframe", { srcDoc: formattedXml ? `<html><body>${formattedXml}</body></html>` : undefined, src: !formattedXml ? blobUrl : undefined, title: "File Viewer", width: "100%", height: "100%", style: { border: 'none', zIndex: 0, pointerEvents: isResizingActive === true ? "none" : "auto" } }, blobUrl));
|
|
260
206
|
};
|
|
261
207
|
const ImageViewer = ({ fileBlob, alt = 'Image', className }) => {
|
|
262
208
|
const containerRef = useRef(null);
|
|
@@ -475,3 +421,28 @@ const StyledImage = styled.img.attrs(props => ({
|
|
|
475
421
|
pointer-events: none;
|
|
476
422
|
position: absolute;
|
|
477
423
|
`;
|
|
424
|
+
const PDFViewerContainer = styled.div `
|
|
425
|
+
width: 100%;
|
|
426
|
+
height: 100%;
|
|
427
|
+
overflow-y: auto;
|
|
428
|
+
overflow-x: hidden;
|
|
429
|
+
background-color: #f5f5f5;
|
|
430
|
+
|
|
431
|
+
.react-pdf__Document {
|
|
432
|
+
display: flex;
|
|
433
|
+
flex-direction: column;
|
|
434
|
+
align-items: center;
|
|
435
|
+
gap: 10px;
|
|
436
|
+
padding: 10px 0;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
.react-pdf__Page {
|
|
440
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
441
|
+
margin: 0 auto;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.react-pdf__Page__canvas {
|
|
445
|
+
max-width: 100%;
|
|
446
|
+
height: auto !important;
|
|
447
|
+
}
|
|
448
|
+
`;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DcmtInfo } from "../../../ts";
|
|
2
|
+
interface TMDcmtCheckoutInfoFormProps {
|
|
3
|
+
dtdName: string;
|
|
4
|
+
selectedDcmtOrFocused: DcmtInfo;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
}
|
|
7
|
+
declare const TMDcmtCheckoutInfoForm: (props: TMDcmtCheckoutInfoFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default TMDcmtCheckoutInfoForm;
|
|
@@ -5,14 +5,14 @@ import { IconBxInfo, IconFileDots, IconFolder, SDKUI_Globals, SDKUI_Localizator
|
|
|
5
5
|
import { FormModes } from "../../../ts";
|
|
6
6
|
import { ResultTypes, ValidationItem } from "@topconsultnpm/sdk-ts";
|
|
7
7
|
import { SaveFormOptions, useSaveForm } from "../../../hooks/useForm";
|
|
8
|
-
import { getCicoDownloadFileName,
|
|
8
|
+
import { getCicoDownloadFileName, updateCicoCheckoutStorageItem } from "../../../helper/checkinCheckoutManager";
|
|
9
9
|
import { TMColors } from "../../../utils/theme";
|
|
10
10
|
import TMLayoutContainer, { TMLayoutItem } from "../../base/TMLayout";
|
|
11
11
|
import TMTooltip from "../../base/TMTooltip";
|
|
12
12
|
import TMTextBox from "../../editors/TMTextBox";
|
|
13
13
|
import ShowAlert from "../../base/TMAlert";
|
|
14
14
|
import { TMExceptionBoxManager } from "../../base/TMPopUp";
|
|
15
|
-
const
|
|
15
|
+
const TMDcmtCheckoutInfoForm = (props) => {
|
|
16
16
|
const { dtdName, selectedDcmtOrFocused, onClose } = props;
|
|
17
17
|
const [initialDcmtCheckoutFolder, setInitialDcmtCheckoutFolder] = useState("");
|
|
18
18
|
const [initialDcmtCheckoutName, setInitialDcmtCheckoutName] = useState("");
|
|
@@ -31,7 +31,7 @@ const TMSearchResultCheckoutInfoForm = (props) => {
|
|
|
31
31
|
const dcmtCheckoutInfoCurrentItems = [...SDKUI_Globals.userSettings.dcmtCheckoutInfo];
|
|
32
32
|
const existingItem = dcmtCheckoutInfoCurrentItems.find((item) => item.TID === selectedDcmtOrFocused.TID.toString() && item.DID === selectedDcmtOrFocused.DID.toString());
|
|
33
33
|
const folder = existingItem?.checkoutFolder ?? "";
|
|
34
|
-
const name = existingItem?.checkoutName ?? getCicoDownloadFileName(dtdName ?? SDKUI_Localizator.SearchResult
|
|
34
|
+
const name = existingItem?.checkoutName ?? getCicoDownloadFileName({ type: 'dcmtInfo', dcmtInfo: selectedDcmtOrFocused, originalFileName: dtdName ?? SDKUI_Localizator.SearchResult }, true, false);
|
|
35
35
|
// Set form data
|
|
36
36
|
setFormData({
|
|
37
37
|
...formData,
|
|
@@ -57,13 +57,8 @@ const TMSearchResultCheckoutInfoForm = (props) => {
|
|
|
57
57
|
// Check: formData must exist, selectedDcmtOrFocused.TID and selectedDcmtOrFocused.DID must exist, and at least one of checkoutFolder or checkoutName must be filled
|
|
58
58
|
if (formData && selectedDcmtOrFocused.TID && selectedDcmtOrFocused.DID) {
|
|
59
59
|
// Create a new draft checkout item with TID, DID, and folder/name values
|
|
60
|
-
const newItem = {
|
|
61
|
-
|
|
62
|
-
DID: selectedDcmtOrFocused.DID.toString(),
|
|
63
|
-
checkoutFolder: formData.checkoutFolder ?? "",
|
|
64
|
-
checkoutName: formData.checkoutName ?? ""
|
|
65
|
-
};
|
|
66
|
-
updateDcmtCheckoutItem(newItem, "addOrUpdate");
|
|
60
|
+
const newItem = { TID: selectedDcmtOrFocused.TID.toString(), DID: selectedDcmtOrFocused.DID.toString(), checkoutFolder: formData.checkoutFolder ?? "", checkoutName: formData.checkoutName ?? "" };
|
|
61
|
+
updateCicoCheckoutStorageItem(newItem, "dcmtInfo", "addOrUpdate");
|
|
67
62
|
onClose();
|
|
68
63
|
ShowAlert({ mode: 'success', title: SDKUI_Localizator.CheckoutInfo, message: SDKUI_Localizator.OperationSuccess, duration: 3000 });
|
|
69
64
|
}
|
|
@@ -131,4 +126,4 @@ const TMSearchResultCheckoutInfoForm = (props) => {
|
|
|
131
126
|
e.currentTarget.style.color = TMColors.primary;
|
|
132
127
|
}, children: SDKUI_Localizator.Cancel })] })] }) }) }) }) });
|
|
133
128
|
};
|
|
134
|
-
export default
|
|
129
|
+
export default TMDcmtCheckoutInfoForm;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { PlatformObjectValidator, WhereItem, SDK_Localizator, OrderByItem, SelectItem, SelectItemVisibilities, SDK_Globals, SavedQueryCacheService, SearchEngine, QueryOperators } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import TMSearchQueryEditor from './TMSearchQueryEditor';
|
|
@@ -11,7 +11,6 @@ import { StyledModalContainer } from '../../base/Styled';
|
|
|
11
11
|
import ShowAlert from '../../base/TMAlert';
|
|
12
12
|
import TMButton from '../../base/TMButton';
|
|
13
13
|
import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
|
|
14
|
-
import TMDropDownMenu from '../../base/TMDropDownMenu';
|
|
15
14
|
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
|
16
15
|
import TMSpinner from '../../base/TMSpinner';
|
|
17
16
|
import TMPanel from '../../base/TMPanel';
|
|
@@ -19,6 +18,7 @@ import TMDistinctValues from '../../choosers/TMDistinctValues';
|
|
|
19
18
|
import { TMMetadataChooserForm } from '../../choosers/TMMetadataChooser';
|
|
20
19
|
import TMQueryEditor from '../../query/TMQueryEditor';
|
|
21
20
|
import TMSavedQueryForm from './TMSavedQueryForm';
|
|
21
|
+
import { ContextMenu } from '../../NewComponents/ContextMenu';
|
|
22
22
|
import { AdvancedMenuButtons } from '../../editors/TMMetadataValues';
|
|
23
23
|
import TMToppyMessage from '../../../helper/TMToppyMessage';
|
|
24
24
|
const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, SQD, inputMids, onSearchCompleted, onSqdSaved, onBack, onClosePanel, allowMaximize = true, onMaximizePanel, onBackToResult, passToArchiveCallback }) => {
|
|
@@ -299,20 +299,21 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
299
299
|
}
|
|
300
300
|
setQd({ ...qd, orderBy: newOrderBy });
|
|
301
301
|
}, [qd, fromDTD?.metadata, SQD?.masterTID]);
|
|
302
|
+
const contextMenuItems = useMemo(() => [
|
|
303
|
+
...(showBackToResultButton ? [{ icon: _jsx(IconArrowRight, {}), name: "Vai a risultato", onClick: () => { onBackToResult?.(); } }] : []),
|
|
304
|
+
{ icon: _jsx(IconAddCircleOutline, {}), name: SDKUI_Localizator.SavedQueryNew, beginGroup: showBackToResultButton, onClick: () => { openSqdForm(FormModes.Create); } },
|
|
305
|
+
{ icon: _jsx(IconEdit, {}), name: SDKUI_Localizator.SavedQueryUpdate, disabled: (SQD && SQD.id == 1), onClick: () => { openSqdForm(FormModes.Update); } },
|
|
306
|
+
{ icon: showAdvancedSearch ? _jsx(IconEasy, {}) : _jsx(IconAdvanced, {}), beginGroup: true, name: showAdvancedSearch ? SDKUI_Localizator.Search_Easy : SDKUI_Localizator.Search_Advanced, onClick: () => { changeAdvancedSearchAsync(!showAdvancedSearch); } },
|
|
307
|
+
{ icon: _jsx(IconEdit, {}), name: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryWhere}`, beginGroup: true, onClick: () => { setShowFiltersConfig(true); } },
|
|
308
|
+
{ icon: _jsx(IconEdit, {}), name: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QuerySelect}`, onClick: () => { setShowOutputConfig(true); } },
|
|
309
|
+
{ icon: _jsx(IconEdit, {}), name: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryOrderBy}`, onClick: () => { setShowOrderByConfig(true); } },
|
|
310
|
+
{ icon: _jsx(IconMenuCAArchive, { viewBox: '11 11.5 26 27', fontSize: 16, strokeWidth: 2, color: 'black' }), beginGroup: true, name: SDKUI_Localizator.PassToArchive, onClick: handlePassToArchive }
|
|
311
|
+
], [showBackToResultButton, showAdvancedSearch, SQD, onBackToResult, openSqdForm, changeAdvancedSearchAsync, setShowFiltersConfig, setShowOutputConfig, setShowOrderByConfig, handlePassToArchive]);
|
|
302
312
|
const captionText = showAllMdWhere ? SDKUI_Localizator.ShowLess : SDKUI_Localizator.ShowAll;
|
|
303
313
|
let maxItems = getListMaxItems(deviceType ?? DeviceType.DESKTOP);
|
|
304
314
|
const diff = (qd?.where?.length ?? 0) - maxItems;
|
|
305
315
|
return (_jsxs(_Fragment, { children: [_jsxs(TMPanel, { title: fromDTD?.nameLoc ?? SDKUI_Localizator.Search_Metadata, allowMaximize: allowMaximize, onMaximize: onMaximizePanel, onHeaderDoubleClick: onMaximizePanel, onBack: onBack, onActiveChanged: handlePanelActiveChanged, toolbar: _jsx(_Fragment, { children: (SQD && !showSqdForm) ?
|
|
306
|
-
_jsx(
|
|
307
|
-
...(showBackToResultButton ? [{ icon: _jsx(IconArrowRight, {}), text: "Vai a risultato", onClick: () => { onBackToResult?.(); } }] : []),
|
|
308
|
-
{ icon: _jsx(IconAddCircleOutline, {}), beginGroup: true, text: SDKUI_Localizator.SavedQueryNew, onClick: () => { openSqdForm(FormModes.Create); } },
|
|
309
|
-
{ icon: _jsx(IconEdit, {}), text: SDKUI_Localizator.SavedQueryUpdate, disabled: (SQD && SQD.id == 1), onClick: () => { openSqdForm(FormModes.Update); } },
|
|
310
|
-
{ icon: showAdvancedSearch ? _jsx(IconEasy, {}) : _jsx(IconAdvanced, {}), beginGroup: true, text: showAdvancedSearch ? SDKUI_Localizator.Search_Easy : SDKUI_Localizator.Search_Advanced, onClick: () => { changeAdvancedSearchAsync(!showAdvancedSearch); } },
|
|
311
|
-
{ icon: _jsx(IconEdit, {}), beginGroup: true, text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryWhere}`, onClick: () => { setShowFiltersConfig(true); } },
|
|
312
|
-
{ icon: _jsx(IconEdit, {}), text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QuerySelect}`, onClick: () => { setShowOutputConfig(true); } },
|
|
313
|
-
{ icon: _jsx(IconEdit, {}), text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryOrderBy}`, onClick: () => { setShowOrderByConfig(true); } },
|
|
314
|
-
{ icon: _jsx(IconMenuCAArchive, { viewBox: '11 11.5 26 27', fontSize: 16, strokeWidth: 2, color: 'black' }), beginGroup: true, text: SDKUI_Localizator.PassToArchive, onClick: handlePassToArchive }
|
|
315
|
-
], onMenuShown: () => setIsQueryPanelActive(true) })
|
|
316
|
+
_jsx(ContextMenu, { items: contextMenuItems, trigger: "left", children: _jsx(TMButton, { btnStyle: 'icon', caption: 'Altro', icon: _jsx(IconMenuVertical, { color: 'white' }), showTooltip: false, onClick: () => setIsQueryPanelActive(true) }) })
|
|
316
317
|
: _jsx(_Fragment, {}) }), children: [_jsx(ConfirmQueryParamsDialog, {}), SQD
|
|
317
318
|
? _jsxs("div", { onContextMenu: (e) => e.preventDefault(), style: { height: '100%', width: '100%', position: 'relative', display: 'flex', flexDirection: 'column', gap: 5 }, children: [showAdvancedSearch
|
|
318
319
|
? _jsx(TMQueryEditor, { formMode: FormModes.Update, showToolbar: false, inputData: qd, validateSelect: true, showApply: false, onQDChanged: handleQdChanged })
|