@topconsultnpm/sdkui-react 6.21.0-dev1.24 → 6.21.0-dev1.26
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/forms/Login/TMLoginForm.js +15 -5
- package/lib/components/query/TMQueryCountButton.d.ts +11 -0
- package/lib/components/query/TMQueryCountButton.js +32 -0
- package/lib/components/query/TMQueryEditor.js +3 -21
- package/lib/components/query/TMQuerySummary.js +3 -2
- package/lib/hooks/useDocumentOperations.js +5 -0
- package/lib/hooks/useQueryParametersDialog.js +5 -5
- package/package.json +1 -1
|
@@ -328,8 +328,8 @@ const TMLoginForm = (props) => {
|
|
|
328
328
|
const nextStepHandler = async () => {
|
|
329
329
|
if (!endpoint || (!dcmtArchive && !manualArchiveID))
|
|
330
330
|
return;
|
|
331
|
-
if (loginStep === 1 &&
|
|
332
|
-
const isValid = await
|
|
331
|
+
if (loginStep === 1 && manualArchiveID) {
|
|
332
|
+
const isValid = await fetchManualArchiveByIdAsync();
|
|
333
333
|
if (!isValid)
|
|
334
334
|
return;
|
|
335
335
|
}
|
|
@@ -359,17 +359,27 @@ const TMLoginForm = (props) => {
|
|
|
359
359
|
return;
|
|
360
360
|
setLoginStep(prev => prev - 1);
|
|
361
361
|
}, [loginStep]);
|
|
362
|
-
|
|
363
|
-
|
|
362
|
+
/** Retrieves and sets the archive descriptor from server using the manually entered ID. */
|
|
363
|
+
const fetchManualArchiveByIdAsync = async () => {
|
|
364
|
+
// Early exit if session or manual archive ID is not available
|
|
365
|
+
if (!tmSession || !manualArchiveID) {
|
|
366
|
+
setDcmtArchive(undefined);
|
|
364
367
|
return false;
|
|
368
|
+
}
|
|
369
|
+
;
|
|
365
370
|
try {
|
|
366
371
|
TMSpinner.show({ description: '' });
|
|
372
|
+
// Create archive engine and retrieve archive descriptor by ID
|
|
367
373
|
const archiveEngine = tmSession.NewArchiveEngine();
|
|
368
|
-
await archiveEngine.RetrieveAsync(manualArchiveID);
|
|
374
|
+
const result = await archiveEngine.RetrieveAsync(manualArchiveID);
|
|
375
|
+
// Update state with retrieved archive if valid
|
|
376
|
+
setDcmtArchive(result);
|
|
369
377
|
return true;
|
|
370
378
|
}
|
|
371
379
|
catch (e) {
|
|
380
|
+
// Display error to user if retrieval fails
|
|
372
381
|
TMExceptionBoxManager.show({ exception: e });
|
|
382
|
+
setDcmtArchive(undefined);
|
|
373
383
|
return false;
|
|
374
384
|
}
|
|
375
385
|
finally {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { QueryDescriptor, QueryParameterDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
interface ITMQueryCountButton {
|
|
4
|
+
qd?: QueryDescriptor;
|
|
5
|
+
lastparams: QueryParameterDescriptor[] | undefined;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
showSpinner: boolean;
|
|
8
|
+
onLastQueryParamsChanged?: (params: QueryParameterDescriptor[]) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const TMQueryCountButton: React.FunctionComponent<ITMQueryCountButton>;
|
|
11
|
+
export default TMQueryCountButton;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import TMButton from '../base/TMButton';
|
|
3
|
+
import { getQueryCountAsync, IconCount, IsParametricQuery, SDKUI_Localizator } from '../../helper';
|
|
4
|
+
import { useQueryParametersDialog } from '../../hooks/useQueryParametersDialog';
|
|
5
|
+
const TMQueryCountButton = ({ qd, lastparams, disabled, showSpinner, onLastQueryParamsChanged }) => {
|
|
6
|
+
const [confirmQueryParams, ConfirmQueryParamsDialog] = useQueryParametersDialog();
|
|
7
|
+
const getQueryCountLocalAsync = async () => {
|
|
8
|
+
if (qd == undefined)
|
|
9
|
+
return;
|
|
10
|
+
let qdLocal = { ...qd };
|
|
11
|
+
const whereCopy = qdLocal.where?.map((curItem) => ({ ...curItem }));
|
|
12
|
+
if (IsParametricQuery(qd)) {
|
|
13
|
+
const qdParams = await confirmQueryParams(qdLocal, lastparams);
|
|
14
|
+
if (!qdParams || qdParams.length <= 0)
|
|
15
|
+
return;
|
|
16
|
+
for (const qpd of qdParams) {
|
|
17
|
+
let wi = whereCopy?.find(o => o.value1 == qpd.name);
|
|
18
|
+
if (wi)
|
|
19
|
+
wi.value1 = wi.value1?.replace(wi.value1, !qpd.value ? '' : qpd.value.toString());
|
|
20
|
+
else {
|
|
21
|
+
wi = whereCopy?.find(o => o.value2 == qpd.name);
|
|
22
|
+
if (wi)
|
|
23
|
+
wi.value2 = wi.value2?.replace(wi.value2, !qpd.value ? '' : qpd.value.toString());
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
onLastQueryParamsChanged?.(qdParams ?? []);
|
|
27
|
+
}
|
|
28
|
+
await getQueryCountAsync({ ...qdLocal, where: whereCopy }, showSpinner);
|
|
29
|
+
};
|
|
30
|
+
return (_jsxs(_Fragment, { children: [_jsx(TMButton, { btnStyle: 'toolbar', caption: SDKUI_Localizator.Count, icon: _jsx(IconCount, {}), disabled: disabled, onClick: async () => await getQueryCountLocalAsync() }), _jsx(ConfirmQueryParamsDialog, {})] }));
|
|
31
|
+
};
|
|
32
|
+
export default TMQueryCountButton;
|
|
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useState } from 'react';
|
|
|
3
3
|
import { SDK_Localizator, AccessLevels, OnJoinItem, JoinTypes, PlatformObjectValidator, MetadataDataDomains, DcmtTypeListCacheService, JoinItem, MetadataDataTypes, OrderByItem, QueryFunctions, QueryOperators, ResultTypes, SelectItem, SDK_Globals, UserListCacheService, WhereItem, SearchEngine, SelectItemVisibilities, DataListCacheService, QueryValidatorOptions, TMPropertyNames, AppModules, LayoutModes } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import Accordion, { Item } from 'devextreme-react/accordion';
|
|
6
|
-
import { SDKUI_Localizator, IconSearch,
|
|
6
|
+
import { SDKUI_Localizator, IconSearch, calcIsModified, IconClear, IconAddCircleOutline, IconDotsVerticalCircleOutline, IconHide, IconShow, IconDraggabledots, genUniqueId, LocalizeQueryOperators, LocalizeQueryFunctions, LocalizeQueryJoinTypes, IconArchiveDoc, IconArrowRight, SDKUI_Globals } from '../../helper';
|
|
7
7
|
import { displayMetadataValue, getDcmtTypesByQdAsync, getTIDsByQd, IsParametricQuery, prepareQdForSearchAsync } from '../../helper/queryHelper';
|
|
8
8
|
import { useOutsideClick } from '../../hooks/useOutsideClick';
|
|
9
9
|
import { FormModes, SearchResultContext } from '../../ts';
|
|
@@ -30,6 +30,7 @@ import TMMetadataEditor from '../editors/TMMetadataEditor';
|
|
|
30
30
|
import { ContextMenu } from '../NewComponents/ContextMenu';
|
|
31
31
|
import { useQueryParametersDialog } from '../../hooks/useQueryParametersDialog';
|
|
32
32
|
import TMSearchResult from '../features/search/TMSearchResult';
|
|
33
|
+
import TMQueryCountButton from './TMQueryCountButton';
|
|
33
34
|
export const StyledRowItem = styled.div ` display: flex; flex-direction: row; align-items: center; justify-content: flex-start; margin-bottom: 5px; gap: 3px; `;
|
|
34
35
|
export const StyledItemWrapper = styled.div ` border-radius: ${props => props.$borderRadius ?? '4px'}; padding: 4px; font-size: 1rem; user-select: none; width: max-content; `;
|
|
35
36
|
export const StyledAccordionItemContainer = styled.div ` width: 100%; padding: 2px; display: flex; flex-direction: column; overflow-x: auto; align-items: flex-start; margin-left: 5px; gap: 3px; max-height: 300px; `;
|
|
@@ -732,26 +733,7 @@ const TMQueryEditor = ({ formMode, inputData, onQDChanged, isExpertMode, showDis
|
|
|
732
733
|
}
|
|
733
734
|
};
|
|
734
735
|
// #endregion
|
|
735
|
-
|
|
736
|
-
if (IsParametricQuery(qd)) {
|
|
737
|
-
const qdParams = await confirmQueryParams(qd, lastQdParams);
|
|
738
|
-
setLastQdParams(qdParams);
|
|
739
|
-
if (!qdParams || qdParams.length <= 0)
|
|
740
|
-
return;
|
|
741
|
-
for (const qpd of qdParams) {
|
|
742
|
-
let wi = qd.where?.find(o => o.value1 == qpd.name);
|
|
743
|
-
if (wi)
|
|
744
|
-
wi.value1 = wi.value1?.replace(wi.value1, !qpd.value ? '' : qpd.value.toString());
|
|
745
|
-
else {
|
|
746
|
-
wi = qd.where?.find(o => o.value2 == qpd.name);
|
|
747
|
-
if (wi)
|
|
748
|
-
wi.value2 = wi.value2?.replace(wi.value2, !qpd.value ? '' : qpd.value.toString());
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
await getQueryCountAsync(qd, showSpinner);
|
|
753
|
-
};
|
|
754
|
-
return (_jsxs(_Fragment, { children: [_jsxs(TMApplyForm, { isModal: false, formMode: formMode, isModified: calcIsModified(formData, formDataOrig), exception: exception, validationItems: validationItems, hasNavigation: false, customToolbarElements: _jsxs(_Fragment, { children: [_jsx(TMButton, { btnStyle: 'toolbar', caption: SDKUI_Localizator.Search, color: 'tertiary', icon: _jsx(IconSearch, {}), disabled: errorsCount > 0, onClick: async () => await onSearchAsync(formData) }), _jsx(TMButton, { btnStyle: 'toolbar', caption: SDKUI_Localizator.Count, icon: _jsx(IconCount, {}), disabled: errorsCount > 0, onClick: () => getQueryCountLocalAsync(formData, true) }), SDK_Globals.tmSession?.SessionDescr?.appModuleID == AppModules.SURFER && _jsx(TMButton, { caption: "Passa ad archiviazione", icon: _jsx(IconArchiveDoc, {}), btnStyle: 'toolbar', fontSize: '1.3rem', onClick: () => { ShowAlert({ message: "TODO Passa ad archiviazione", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } }), SDK_Globals.tmSession?.SessionDescr?.appModuleID == AppModules.SURFER && _jsx(TMButton, { caption: "Vai a risultato", icon: _jsx(IconArrowRight, {}), btnStyle: 'toolbar', fontSize: '1.3rem', onClick: () => { ShowAlert({ message: "TODO Vai a risultato", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } })] }), showToolbar: showToolbar, showApply: showApply, showUndo: showUndo, showBack: showBack, onApply: () => applyData(), onClose: () => onClose?.(), onUndo: () => setFormData(formDataOrig), children: [_jsxs(Accordion, { elementAttr: { class: 'tm-query-dx-accordion' }, height: height, multiple: true, collapsible: true, repaintChangesOnly: true, deferRendering: false, animationDuration: 0, onContentReady: (e) => {
|
|
736
|
+
return (_jsxs(_Fragment, { children: [_jsxs(TMApplyForm, { isModal: false, formMode: formMode, isModified: calcIsModified(formData, formDataOrig), exception: exception, validationItems: validationItems, hasNavigation: false, customToolbarElements: _jsxs(_Fragment, { children: [_jsx(TMButton, { btnStyle: 'toolbar', caption: SDKUI_Localizator.Search, color: 'tertiary', icon: _jsx(IconSearch, {}), disabled: errorsCount > 0, onClick: async () => await onSearchAsync(formData) }), _jsx(TMQueryCountButton, { qd: { ...formData }, lastparams: lastQdParams, onLastQueryParamsChanged: (params) => { setLastQdParams(params); }, disabled: errorsCount > 0, showSpinner: true }), SDK_Globals.tmSession?.SessionDescr?.appModuleID == AppModules.SURFER && _jsx(TMButton, { caption: "Passa ad archiviazione", icon: _jsx(IconArchiveDoc, {}), btnStyle: 'toolbar', fontSize: '1.3rem', onClick: () => { ShowAlert({ message: "TODO Passa ad archiviazione", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } }), SDK_Globals.tmSession?.SessionDescr?.appModuleID == AppModules.SURFER && _jsx(TMButton, { caption: "Vai a risultato", icon: _jsx(IconArrowRight, {}), btnStyle: 'toolbar', fontSize: '1.3rem', onClick: () => { ShowAlert({ message: "TODO Vai a risultato", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } })] }), showToolbar: showToolbar, showApply: showApply, showUndo: showUndo, showBack: showBack, onApply: () => applyData(), onClose: () => onClose?.(), onUndo: () => setFormData(formDataOrig), children: [_jsxs(Accordion, { elementAttr: { class: 'tm-query-dx-accordion' }, height: height, multiple: true, collapsible: true, repaintChangesOnly: true, deferRendering: false, animationDuration: 0, onContentReady: (e) => {
|
|
755
737
|
let items = e.component.option("items");
|
|
756
738
|
if (items && items.length > 0) {
|
|
757
739
|
for (let i = 0; i < items.length; i++) {
|
|
@@ -5,10 +5,11 @@ import { QueryDescriptor, ResultTypes, TMScopeNames } from '@topconsultnpm/sdk-t
|
|
|
5
5
|
import { FontSize } from '../../utils/theme';
|
|
6
6
|
import TMQueryEditor from './TMQueryEditor';
|
|
7
7
|
import TMButton from '../base/TMButton';
|
|
8
|
-
import {
|
|
8
|
+
import { IconEraser, IconPencil, SDKUI_Localizator } from '../../helper';
|
|
9
9
|
import TMVilViewer from '../base/TMVilViewer';
|
|
10
10
|
import { FormModes } from '../../ts';
|
|
11
11
|
import TMModal from '../base/TMModal';
|
|
12
|
+
import TMQueryCountButton from './TMQueryCountButton';
|
|
12
13
|
// #region Style
|
|
13
14
|
const StyledWrapper = styled.div `
|
|
14
15
|
display: flex;
|
|
@@ -28,7 +29,7 @@ const TMQuerySummary = ({ children, qd, validateSelect = true, validateOrderBy =
|
|
|
28
29
|
const [showEditor, setShowEditor] = useState(false);
|
|
29
30
|
const validationItemsQd = validationItems.filter(o => o.PropertyScopes.includes(TMScopeNames.qd) || o.PropertyName == TMScopeNames.qd);
|
|
30
31
|
const useInternalEditor = onEditClick === undefined;
|
|
31
|
-
return (_jsxs(StyledWrapper, { children: [_jsxs(StyledQueryToolbar, { children: [_jsx(TMButton, { caption: SDKUI_Localizator.QueryDefine, icon: _jsx(IconPencil, { fontSize: 16 }), btnStyle: 'toolbar', onClick: () => onEditClick ? onEditClick() : setShowEditor(true) }), _jsx(
|
|
32
|
+
return (_jsxs(StyledWrapper, { children: [_jsxs(StyledQueryToolbar, { children: [_jsx(TMButton, { caption: SDKUI_Localizator.QueryDefine, icon: _jsx(IconPencil, { fontSize: 16 }), btnStyle: 'toolbar', onClick: () => onEditClick ? onEditClick() : setShowEditor(true) }), _jsx(TMQueryCountButton, { qd: { ...qd }, lastparams: [], disabled: validationItemsQd.filter(o => o.ResultType == ResultTypes.ERROR).length > 0, showSpinner: true }), _jsx(TMButton, { caption: SDKUI_Localizator.QueryClear, icon: _jsx(IconEraser, { fontSize: 16 }), btnStyle: 'toolbar', onClick: () => onValueChanged?.(new QueryDescriptor()) }), children] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', width: '100%', overflowX: 'auto' }, children: [qd && qd.from &&
|
|
32
33
|
_jsx(TMQueryEditor, { formMode: FormModes.ReadOnly, inputData: qd, showDistinct: showDistinct, isModal: false, showToolbar: false, validateSelect: validateSelect, validateOrderBy: validateOrderBy, raiseWarningForOnlyMetadataDcmtTypes: raiseWarningForOnlyMetadataDcmtTypes }), _jsx("div", { style: { padding: '0px 5px' }, children: _jsx(TMVilViewer, { vil: validationItemsQd }) })] }), useInternalEditor && showEditor &&
|
|
33
34
|
_jsx(TMModal, { title: SDKUI_Localizator.QueryDefine, children: _jsx(TMQueryEditor, { formMode: FormModes.Update, inputData: qd, isModal: true, showDistinct: showDistinct, raiseWarningForOnlyMetadataDcmtTypes: raiseWarningForOnlyMetadataDcmtTypes, validateSelect: validateSelect, validateOrderBy: validateOrderBy, onApplied: (newValue) => onValueChanged?.(newValue), onClose: () => { setShowEditor(false); } }) })] }));
|
|
34
35
|
};
|
|
@@ -1060,8 +1060,13 @@ export const useDocumentOperations = (props) => {
|
|
|
1060
1060
|
disabled: isDisabledForSingleRow() && isDisabledForMultiRow(),
|
|
1061
1061
|
submenu: [
|
|
1062
1062
|
addToFavoriteOperation(),
|
|
1063
|
+
addReplaceFileOperation(),
|
|
1064
|
+
fileCheckMenuItem(),
|
|
1065
|
+
fileConversionsMenuItem(),
|
|
1066
|
+
...(SDK_Globals.tmSession?.SessionDescr?.appModuleID === AppModules.SURFER ? [createContextualTaskMenuItem()] : []),
|
|
1063
1067
|
downloadFileMenuItem(),
|
|
1064
1068
|
downloadXMLAttachmentsMenuItem(),
|
|
1069
|
+
...(selectedDcmtInfos.length > 0 && isPdfEditorAvailable(dtd, selectedDcmtInfos[0]?.FILEEXT) && onOpenPdfEditorRequest ? [pdfEditorMenuItem(onOpenPdfEditorRequest)] : []),
|
|
1065
1070
|
]
|
|
1066
1071
|
},
|
|
1067
1072
|
signatureMenuItem(),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
import { QueryParameterDescriptor } from '@topconsultnpm/sdk-ts';
|
|
4
|
-
import { TMModal, TMTextBox, TMButton } from "../components";
|
|
4
|
+
import { TMModal, TMTextBox, TMButton, TMCard, StyledDivHorizontal } from "../components";
|
|
5
5
|
import { IconApply, IconCloseOutline, SDKUI_Localizator } from "../helper";
|
|
6
|
-
import { TMColors } from "../utils/theme";
|
|
6
|
+
import { TMColors, TMMargin } from "../utils/theme";
|
|
7
7
|
const paramPrefix = "{@QueryParam";
|
|
8
8
|
export const useQueryParametersDialog = () => {
|
|
9
9
|
const [promise, setPromise] = useState(null);
|
|
@@ -56,15 +56,15 @@ export const useQueryParametersDialog = () => {
|
|
|
56
56
|
};
|
|
57
57
|
const ConfirmQueryParamsDialog = () => {
|
|
58
58
|
return (open ?
|
|
59
|
-
_jsx(TMModal, { title: SDKUI_Localizator.QueryParamBind, height:
|
|
60
|
-
return (_jsx(TMTextBox, { placeHolder: `${SDKUI_Localizator.EnterValue} ...`, label: qdp.name, autoFocus: index == 0, value: qdp.value ?? '', onValueChanged: (e) => {
|
|
59
|
+
_jsx(TMModal, { title: SDKUI_Localizator.QueryParamBind, height: `${qdParams.length > 0 ? (qdParams.length * 73) + 73 : 100}px`, width: "400px", onClose: handleClose, children: _jsxs(TMCard, { scrollX: true, height: "100%", children: [qdParams.map((qdp, index) => {
|
|
60
|
+
return (_jsx(TMTextBox, { elementStyle: { marginBottom: TMMargin.smallMargin }, placeHolder: `${SDKUI_Localizator.EnterValue} ...`, label: qdp.name, autoFocus: index == 0, value: qdp.value ?? '', onValueChanged: (e) => {
|
|
61
61
|
let newQdp = qdParamsOut.find(o => o.id == qdp.id);
|
|
62
62
|
if (newQdp)
|
|
63
63
|
newQdp.value = e.target.value;
|
|
64
64
|
else
|
|
65
65
|
qdParamsOut.push({ id: qdp.id, name: qdp.name, value: e.target.value });
|
|
66
66
|
} }, qdp.id));
|
|
67
|
-
}), _jsxs(
|
|
67
|
+
}), _jsxs(StyledDivHorizontal, { style: { gap: 10, marginBottom: TMMargin.smallMargin, width: '100%', alignItems: 'center' }, children: [_jsx(TMButton, { btnStyle: "advanced", showTooltip: false, icon: _jsx(IconApply, {}), caption: "OK", advancedColor: TMColors.tertiary, onClick: handleConfirm }), _jsx(TMButton, { btnStyle: "advanced", showTooltip: false, icon: _jsx(IconCloseOutline, {}), caption: SDKUI_Localizator.Cancel, onClick: handleCancel })] })] }) })
|
|
68
68
|
: _jsx(_Fragment, {}));
|
|
69
69
|
};
|
|
70
70
|
return [confirmQueryParams, ConfirmQueryParamsDialog];
|