@topconsultnpm/sdkui-react-beta 6.12.42 → 6.12.44
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/features/archive/TMArchive.d.ts +6 -0
- package/lib/components/features/archive/TMArchive.js +57 -0
- package/lib/components/{query → features/documents}/TMBatchUpdateForm.d.ts +1 -1
- package/lib/components/{query → features/documents}/TMBatchUpdateForm.js +18 -18
- package/lib/components/{query → features/documents}/TMDcmtBlog.js +4 -4
- package/lib/components/{query → features/documents}/TMDcmtForm.d.ts +2 -2
- package/lib/components/{query → features/documents}/TMDcmtForm.js +22 -22
- package/lib/components/{query → features/documents}/TMDcmtIcon.js +2 -2
- package/lib/components/{query → features/documents}/TMDcmtPreview.d.ts +1 -1
- package/lib/components/{query → features/documents}/TMDcmtPreview.js +14 -14
- package/lib/components/{query → features/documents}/TMFileUploader.d.ts +1 -1
- package/lib/components/{query → features/documents}/TMFileUploader.js +10 -10
- package/lib/components/{query → features/documents}/TMMasterDetailDcmts.d.ts +3 -7
- package/lib/components/{query → features/documents}/TMMasterDetailDcmts.js +20 -20
- package/lib/components/features/search/TMSavedQueryForm.d.ts +9 -0
- package/lib/components/features/search/TMSavedQueryForm.js +41 -0
- package/lib/components/features/search/TMSavedQuerySelector.d.ts +16 -0
- package/lib/components/features/search/TMSavedQuerySelector.js +143 -0
- package/lib/components/features/search/TMSearch.d.ts +10 -0
- package/lib/components/features/search/TMSearch.js +188 -0
- package/lib/components/features/search/TMSearchQueryEditor.d.ts +15 -0
- package/lib/components/features/search/TMSearchQueryEditor.js +365 -0
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +20 -0
- package/lib/components/features/search/TMSearchQueryPanel.js +296 -0
- package/lib/components/{search → features/search}/TMSearchResult.d.ts +2 -6
- package/lib/components/{search → features/search}/TMSearchResult.js +31 -31
- package/lib/components/{search → features/search}/TMSearchResultsMenuItems.d.ts +2 -2
- package/lib/components/{search → features/search}/TMSearchResultsMenuItems.js +5 -5
- package/lib/components/features/search/TMTreeSelector.d.ts +9 -0
- package/lib/components/features/search/TMTreeSelector.js +125 -0
- package/lib/components/{query → features/workflow}/TMWorkflowPopup.d.ts +1 -1
- package/lib/components/{query → features/workflow}/TMWorkflowPopup.js +8 -8
- package/lib/components/grids/TMBlogsUtils.d.ts +2 -1
- package/lib/components/grids/TMRecentsManager.d.ts +11 -0
- package/lib/components/grids/TMRecentsManager.js +45 -0
- package/lib/components/index.d.ts +5 -2
- package/lib/components/index.js +8 -2
- package/lib/components/query/TMQueryEditor.js +5 -8
- package/lib/helper/Enum_Localizator.d.ts +2 -1
- package/lib/helper/Enum_Localizator.js +9 -1
- package/lib/helper/SDKUI_Localizator.d.ts +9 -0
- package/lib/helper/SDKUI_Localizator.js +90 -0
- package/lib/ts/types.d.ts +11 -0
- package/package.json +2 -2
- package/lib/components/query/TMQueryResult.d.ts +0 -10
- package/lib/components/query/TMQueryResult.js +0 -42
- package/lib/components/query/TMQueryResultForm.d.ts +0 -17
- package/lib/components/query/TMQueryResultForm.js +0 -318
- /package/lib/components/{query → features/documents}/TMDcmtBlog.d.ts +0 -0
- /package/lib/components/{query → features/documents}/TMDcmtIcon.d.ts +0 -0
@@ -0,0 +1,57 @@
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
3
|
+
import Logo from '../../../assets/Toppy-generico.png';
|
4
|
+
import { LayoutModes, LocalStorageService, SDK_Globals } from '@topconsultnpm/sdk-ts-beta';
|
5
|
+
import { IconTree, IconProgressReady } from '../../../helper';
|
6
|
+
import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
|
7
|
+
import TMLayoutContainer, { TMSplitterLayout, TMLayoutItem } from '../../base/TMLayout';
|
8
|
+
import TMToolbarCard from '../../base/TMToolbarCard';
|
9
|
+
import TMRecentsManager from '../../grids/TMRecentsManager';
|
10
|
+
import TMDcmtForm from '../documents/TMDcmtForm';
|
11
|
+
import { StyledToppyTextContainer, StyledToppyText } from '../search/TMSearchQueryPanel';
|
12
|
+
import TMTreeSelector from '../search/TMTreeSelector';
|
13
|
+
const TMArchive = ({ inputTID }) => {
|
14
|
+
const TIDs = LocalStorageService.getItem(`ARCHIVEPAGE_MRU_TIDS_${SDK_Globals.tmSession?.SessionDescr?.archiveID}_${SDK_Globals.tmSession?.SessionDescr?.userID}`) ?? [];
|
15
|
+
const [currentTID, setCurrentTID] = useState(0);
|
16
|
+
const [mruTIDs, setMruTIDs] = useState(TIDs);
|
17
|
+
const [showRecentsPanel, setShowRecentsPanel] = useState(true);
|
18
|
+
const [showTreesPanel, setShowTreesPanel] = useState(true);
|
19
|
+
const deviceType = useDeviceType();
|
20
|
+
useEffect(() => { setMruTIDs(TIDs); }, []);
|
21
|
+
useEffect(() => {
|
22
|
+
if (!inputTID)
|
23
|
+
return;
|
24
|
+
setCurrentTID(inputTID);
|
25
|
+
}, [inputTID]);
|
26
|
+
const setSearchByTID = (tid) => { setCurrentTID(tid); };
|
27
|
+
const getPrimarySplitterStartValues = useCallback(() => {
|
28
|
+
if (deviceType === DeviceType.MOBILE) {
|
29
|
+
return ['0%', '100%'];
|
30
|
+
}
|
31
|
+
return showTreesPanel ? ['20%', '80%'] : ['0', '100%'];
|
32
|
+
}, [deviceType, showTreesPanel]);
|
33
|
+
const getSecondarySplitterStartValues = useCallback(() => {
|
34
|
+
if (deviceType === DeviceType.MOBILE) {
|
35
|
+
return currentTID ? ['0', '100%'] : ['100%', '0%'];
|
36
|
+
}
|
37
|
+
return showRecentsPanel ? ['25%', '75%'] : ['0', '100%'];
|
38
|
+
}, [deviceType, currentTID, showRecentsPanel]);
|
39
|
+
let customSidebarItems = useMemo(() => {
|
40
|
+
return ([
|
41
|
+
{ icon: _jsx(IconTree, {}), id: 'trees', visibleName: 'Alberi', isActive: showTreesPanel, onClick: () => { setShowTreesPanel(!showTreesPanel); } },
|
42
|
+
{ icon: _jsx(IconProgressReady, {}), id: 'recents', visibleName: 'Recenti', isActive: showRecentsPanel, onClick: () => { setShowRecentsPanel(!showRecentsPanel); } }
|
43
|
+
]);
|
44
|
+
}, [showTreesPanel, showRecentsPanel]);
|
45
|
+
return (_jsxs(TMSplitterLayout, { direction: 'horizontal', separatorSize: 10, showSeparator: deviceType !== DeviceType.MOBILE && showTreesPanel, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: getPrimarySplitterStartValues(), children: [showTreesPanel ? _jsx(TMLayoutItem, { children: deviceType !== DeviceType.MOBILE && _jsx(TMTreeSelector, { onClose: () => setShowTreesPanel(false), layoutMode: LayoutModes.Ark, onSelectedTIDChanged: (tid) => { setSearchByTID(tid); } }) }) : _jsx(_Fragment, {}), _jsx(TMLayoutItem, { children: _jsxs(TMSplitterLayout, { separatorSize: 10, direction: 'horizontal', showSeparator: deviceType !== DeviceType.MOBILE && showRecentsPanel, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: getSecondarySplitterStartValues(), children: [showRecentsPanel ? _jsx(TMLayoutItem, { children: _jsx(TMToolbarCard, { onClose: () => setShowRecentsPanel(false), title: 'Recenti', totalItems: mruTIDs.length, children: _jsx(TMRecentsManager, { mruTIDs: mruTIDs, deviceType: deviceType, onSelectedTID: (tid) => setCurrentTID(tid), onDeletedTID: (tid) => {
|
46
|
+
let newMruTIDS = mruTIDs.slice();
|
47
|
+
let index = newMruTIDS.findIndex(o => o == tid);
|
48
|
+
if (index >= 0)
|
49
|
+
newMruTIDS.splice(index, 1);
|
50
|
+
LocalStorageService.setItem(`ARCHIVEPAGE_MRU_TIDS_${SDK_Globals.tmSession?.SessionDescr?.archiveID}_${SDK_Globals.tmSession?.SessionDescr?.userID}`, newMruTIDS.filter(tid => tid != undefined && tid != null));
|
51
|
+
setMruTIDs(newMruTIDS);
|
52
|
+
} }) }) }) : _jsx(_Fragment, {}), _jsx(TMLayoutItem, { children: currentTID ?
|
53
|
+
_jsx(TMDcmtForm, { TID: currentTID, DID: undefined, layoutMode: LayoutModes.Ark, customRightSidebarItems: customSidebarItems, showPreview: deviceType !== DeviceType.MOBILE, onClose: deviceType === DeviceType.MOBILE ? () => setCurrentTID(undefined) : undefined, onSaveRecents: (TIDs) => setMruTIDs(TIDs) })
|
54
|
+
:
|
55
|
+
_jsx(TMToolbarCard, { items: customSidebarItems, title: 'Archiviazione', children: _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', " "] }), " "] }), " "] }), _jsxs(TMLayoutItem, { width: 'max-content', height: 'max-content', children: [" ", _jsx("img", { src: Logo, width: 120, alt: '' }), " "] })] }) }) })] }) })] }));
|
56
|
+
};
|
57
|
+
export default TMArchive;
|
@@ -1,24 +1,24 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { useEffect, useState } from 'react';
|
3
3
|
import { AccessLevels, DcmtTypeListCacheService, LayoutModes, MetadataDataDomains, ResultTypes, SDK_Globals, ValidationItem } from '@topconsultnpm/sdk-ts-beta';
|
4
|
-
import { searchResultToMetadataValues, getSystemMetadata, calcIsModified, getListMaxItems, SDKUI_Localizator, IconHide, IconShow } from '
|
5
|
-
import { useDcmtOperations } from '
|
6
|
-
import { DcmtOperationTypes, FormModes } from '
|
7
|
-
import { TMColors } from '
|
8
|
-
import { StyledToolbarCardContainer, StyledFormButtonsContainer } from '
|
9
|
-
import TMButton from '
|
10
|
-
import { useDeviceType, DeviceType } from '
|
11
|
-
import { TMSplitterLayout } from '
|
12
|
-
import { TMExceptionBoxManager } from '
|
13
|
-
import TMShowAllOrMaxItemsButton from '
|
14
|
-
import TMSpinner from '
|
15
|
-
import TMToolbarCard from '
|
16
|
-
import { TMLayoutWaitingContainer } from '
|
17
|
-
import TMDistinctValues from '
|
18
|
-
import TMFormulaEditor, { FormulaDescriptor, FormulaHelper, FormulaTargets } from '
|
19
|
-
import { useMetadataEditableList } from '
|
20
|
-
import TMMetadataValues, { ShowCheckBoxesMode, AdvancedMenuButtons } from '
|
21
|
-
import { TMSaveFormButtonSave, TMSaveFormButtonUndo } from '
|
4
|
+
import { searchResultToMetadataValues, getSystemMetadata, calcIsModified, getListMaxItems, SDKUI_Localizator, IconHide, IconShow } from '../../../helper';
|
5
|
+
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
6
|
+
import { DcmtOperationTypes, FormModes } from '../../../ts';
|
7
|
+
import { TMColors } from '../../../utils/theme';
|
8
|
+
import { StyledToolbarCardContainer, StyledFormButtonsContainer } from '../../base/Styled';
|
9
|
+
import TMButton from '../../base/TMButton';
|
10
|
+
import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
|
11
|
+
import { TMSplitterLayout } from '../../base/TMLayout';
|
12
|
+
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
13
|
+
import TMShowAllOrMaxItemsButton from '../../base/TMShowAllOrMaxItemsButton';
|
14
|
+
import TMSpinner from '../../base/TMSpinner';
|
15
|
+
import TMToolbarCard from '../../base/TMToolbarCard';
|
16
|
+
import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
|
17
|
+
import TMDistinctValues from '../../choosers/TMDistinctValues';
|
18
|
+
import TMFormulaEditor, { FormulaDescriptor, FormulaHelper, FormulaTargets } from '../../editors/TMFormulaEditor';
|
19
|
+
import { useMetadataEditableList } from '../../editors/TMMetadataEditor';
|
20
|
+
import TMMetadataValues, { ShowCheckBoxesMode, AdvancedMenuButtons } from '../../editors/TMMetadataValues';
|
21
|
+
import { TMSaveFormButtonSave, TMSaveFormButtonUndo } from '../../forms/TMSaveForm';
|
22
22
|
const TMBatchUpdateForm = ({ inputDcmts, TID, DID, onSavedCallbackAsync, onBack, onStatusChanged }) => {
|
23
23
|
const [metadataValues, setMetadataValues] = useState([]);
|
24
24
|
const [metadataValuesOrig, setMetadataValuesOrig] = useState([]);
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { SDK_Globals } from '@topconsultnpm/sdk-ts-beta';
|
3
2
|
import { useEffect, useState } from 'react';
|
4
3
|
import styled from 'styled-components';
|
5
|
-
import {
|
6
|
-
import
|
7
|
-
import
|
4
|
+
import { SDK_Globals } from '@topconsultnpm/sdk-ts-beta';
|
5
|
+
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
6
|
+
import TMSpinner from '../../base/TMSpinner';
|
7
|
+
import TMBlogs from '../../grids/TMBlogs';
|
8
8
|
const TMDcmtBlog = ({ tid, did }) => {
|
9
9
|
const [blogsDatasource, setBlogsDatasource] = useState([]);
|
10
10
|
useEffect(() => {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { LayoutModes } from '@topconsultnpm/sdk-ts-beta';
|
3
|
-
import { FormModes } from '
|
4
|
-
import { ITMRightSidebarItem } from '
|
3
|
+
import { FormModes } from '../../../ts';
|
4
|
+
import { ITMRightSidebarItem } from '../../base/TMRightSidebar';
|
5
5
|
interface ITMDcmtFormProps {
|
6
6
|
TID?: number;
|
7
7
|
DID?: number;
|
@@ -4,28 +4,28 @@ import styled from 'styled-components';
|
|
4
4
|
import TMDcmtPreview from './TMDcmtPreview';
|
5
5
|
import { ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, LayoutModes, LocalStorageService, MetadataDataTypes, ResultTypes, SDK_Globals, SystemMIDsAsNumber, TemplateTIDs, UpdateEngineByID, ValidationItem } from '@topconsultnpm/sdk-ts-beta';
|
6
6
|
import { ContextMenu } from 'devextreme-react';
|
7
|
-
import { WorkFlowApproveRejectPopUp, WorkFlowOperationButtons, WorkFlowReAssignPopUp } from '
|
8
|
-
import { FormModes } from '
|
9
|
-
import { DeviceType, useDeviceType } from '
|
10
|
-
import { useDcmtOperations } from '
|
11
|
-
import { handleArchiveVisibility, searchResultToMetadataValues } from '
|
12
|
-
import { genUniqueId, IconCloseCircle, IconShow, SDKUI_Localizator, IconBoard, IconDcmtTypeSys, IconDataList, IconDetailDcmts, svgToString, IconDownload, IconHide, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo } from '
|
13
|
-
import { hasDetailRelations, hasMasterRelations } from '
|
14
|
-
import { TMColors } from '
|
15
|
-
import { StyledFormButtonsContainer, StyledModalContainer, StyledToolbarCardContainer } from '
|
16
|
-
import ShowAlert from '
|
17
|
-
import TMButton from '
|
18
|
-
import { TMSplitterLayout, TMLayoutItem } from '
|
19
|
-
import { TMExceptionBoxManager, TMMessageBoxManager, ButtonNames } from '
|
20
|
-
import TMSpinner from '
|
21
|
-
import TMToolbarCard from '
|
22
|
-
import { TMLayoutWaitingContainer } from '
|
23
|
-
import TMDistinctValues from '
|
24
|
-
import TMFormulaEditor, { FormulaDescriptor, FormulaHelper, FormulaTargets } from '
|
25
|
-
import TMMetadataValues, { AdvancedMenuButtons } from '
|
26
|
-
import { TMSaveFormButtonPrevious, TMSaveFormButtonNext, TMSaveFormButtonSave, TMSaveFormButtonUndo } from '
|
27
|
-
import TMShowAllOrMaxItemsButton from '
|
28
|
-
import TMFileUploader from '
|
7
|
+
import { WorkFlowApproveRejectPopUp, WorkFlowOperationButtons, WorkFlowReAssignPopUp } from '../workflow/TMWorkflowPopup';
|
8
|
+
import { FormModes } from '../../../ts';
|
9
|
+
import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
|
10
|
+
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
11
|
+
import { handleArchiveVisibility, searchResultToMetadataValues } from '../../../helper/queryHelper';
|
12
|
+
import { genUniqueId, IconCloseCircle, IconShow, SDKUI_Localizator, IconBoard, IconDcmtTypeSys, IconDataList, IconDetailDcmts, svgToString, IconDownload, IconHide, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo } from '../../../helper';
|
13
|
+
import { hasDetailRelations, hasMasterRelations } from '../../../helper/dcmtsHelper';
|
14
|
+
import { TMColors } from '../../../utils/theme';
|
15
|
+
import { StyledFormButtonsContainer, StyledModalContainer, StyledToolbarCardContainer } from '../../base/Styled';
|
16
|
+
import ShowAlert from '../../base/TMAlert';
|
17
|
+
import TMButton from '../../base/TMButton';
|
18
|
+
import { TMSplitterLayout, TMLayoutItem } from '../../base/TMLayout';
|
19
|
+
import { TMExceptionBoxManager, TMMessageBoxManager, ButtonNames } from '../../base/TMPopUp';
|
20
|
+
import TMSpinner from '../../base/TMSpinner';
|
21
|
+
import TMToolbarCard from '../../base/TMToolbarCard';
|
22
|
+
import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
|
23
|
+
import TMDistinctValues from '../../choosers/TMDistinctValues';
|
24
|
+
import TMFormulaEditor, { FormulaDescriptor, FormulaHelper, FormulaTargets } from '../../editors/TMFormulaEditor';
|
25
|
+
import TMMetadataValues, { AdvancedMenuButtons } from '../../editors/TMMetadataValues';
|
26
|
+
import { TMSaveFormButtonPrevious, TMSaveFormButtonNext, TMSaveFormButtonSave, TMSaveFormButtonUndo } from '../../forms/TMSaveForm';
|
27
|
+
import TMShowAllOrMaxItemsButton from '../../base/TMShowAllOrMaxItemsButton';
|
28
|
+
import TMFileUploader from '../../features/documents/TMFileUploader';
|
29
29
|
import TMMasterDetailDcmts from './TMMasterDetailDcmts';
|
30
30
|
import TMDcmtBlog from './TMDcmtBlog';
|
31
31
|
let abortControllerLocal = new AbortController();
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import styled from 'styled-components';
|
3
|
-
import { getFileIcon } from '
|
4
|
-
import TMTooltip from '
|
3
|
+
import { getFileIcon } from '../../../helper';
|
4
|
+
import TMTooltip from '../../base/TMTooltip';
|
5
5
|
const StyledCellRenderDcmtIcon = styled.div `
|
6
6
|
display: flex;
|
7
7
|
flex-direction: row;
|
@@ -2,20 +2,20 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
3
3
|
import styled from 'styled-components';
|
4
4
|
import { RetrieveFileOptions, DcmtOpers, GeneralRetrieveFormats, FileFormats, InvoiceRetrieveFormats, OrderRetrieveFormats } from '@topconsultnpm/sdk-ts-beta';
|
5
|
-
import { extensionHandler, sleep, getExceptionMessage, formatBytes, IconMenuVertical, IconCloseCircle, IconClear, SDKUI_Localizator, IconCloseOutline, IconPreview } from '
|
6
|
-
import { useDcmtOperations } from '
|
7
|
-
import { FileExtensionHandler, FormModes } from '
|
8
|
-
import { TMColors } from '
|
9
|
-
import ShowAlert from '
|
10
|
-
import TMButton from '
|
11
|
-
import TMDropDownMenu from '
|
12
|
-
import { TMLayoutItem } from '
|
13
|
-
import { TMExceptionBoxManager } from '
|
14
|
-
import TMToolbarCard from '
|
15
|
-
import TMTooltip from '
|
16
|
-
import { TMLayoutWaitingContainer } from '
|
17
|
-
import { TMSaveFormButtonPrevious, TMSaveFormButtonNext } from '
|
18
|
-
import { StyledAnimatedComponentOpacity } from '
|
5
|
+
import { extensionHandler, sleep, getExceptionMessage, formatBytes, IconMenuVertical, IconCloseCircle, IconClear, SDKUI_Localizator, IconCloseOutline, IconPreview } from '../../../helper';
|
6
|
+
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
7
|
+
import { FileExtensionHandler, FormModes } from '../../../ts';
|
8
|
+
import { TMColors } from '../../../utils/theme';
|
9
|
+
import ShowAlert from '../../base/TMAlert';
|
10
|
+
import TMButton from '../../base/TMButton';
|
11
|
+
import TMDropDownMenu from '../../base/TMDropDownMenu';
|
12
|
+
import { TMLayoutItem } from '../../base/TMLayout';
|
13
|
+
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
14
|
+
import TMToolbarCard from '../../base/TMToolbarCard';
|
15
|
+
import TMTooltip from '../../base/TMTooltip';
|
16
|
+
import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
|
17
|
+
import { TMSaveFormButtonPrevious, TMSaveFormButtonNext } from '../../forms/TMSaveForm';
|
18
|
+
import { StyledAnimatedComponentOpacity } from '../../base/Styled';
|
19
19
|
const TMDcmtPreview = ({ dcmtData, onClose, canNext, canPrev, onNext, onPrev }) => {
|
20
20
|
const [dcmtBlob, setDcmtBlob] = useState(undefined);
|
21
21
|
const [showPreview, setShowPreview] = useState(false);
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import styled from 'styled-components';
|
3
2
|
import { useEffect, useRef, useState } from 'react';
|
4
|
-
import
|
5
|
-
import { IconFolderOpen, SDKUI_Localizator, formatBytes, IconClear, extensionHandler, IconCloseOutline } from '
|
6
|
-
import
|
7
|
-
import {
|
8
|
-
import
|
9
|
-
import
|
10
|
-
import
|
11
|
-
import
|
12
|
-
import
|
3
|
+
import styled from 'styled-components';
|
4
|
+
import { IconFolderOpen, SDKUI_Localizator, formatBytes, IconClear, extensionHandler, IconCloseOutline } from '../../../helper';
|
5
|
+
import usePreventFileDrop from '../../../hooks/usePreventFileDrop';
|
6
|
+
import { FileExtensionHandler } from '../../../ts';
|
7
|
+
import { TMColors } from '../../../utils/theme';
|
8
|
+
import TMButton from '../../base/TMButton';
|
9
|
+
import { DeviceType } from '../../base/TMDeviceProvider';
|
10
|
+
import TMToolbarCard from '../../base/TMToolbarCard';
|
11
|
+
import TMTooltip from '../../base/TMTooltip';
|
12
|
+
import { TMFileViewer, StyledHeaderIcon } from './TMDcmtPreview';
|
13
13
|
const TMFileUploader = ({ deviceType = DeviceType.DESKTOP, onClose, onFileUpload, isRequired = false, defaultBlob = null }) => {
|
14
14
|
const [dragOver, setDragOver] = useState(false);
|
15
15
|
const [uploadedFile, setUploadedFile] = useState(defaultBlob);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { DcmtInfo } from '
|
3
|
-
import { DeviceContextProps } from '
|
2
|
+
import { DcmtInfo, TaskContext } from '../../../ts';
|
3
|
+
import { DeviceContextProps } from '../../base/TMDeviceProvider';
|
4
4
|
interface ITMMasterDetailDcmtsProps extends DeviceContextProps {
|
5
5
|
inputDcmts?: DcmtInfo[];
|
6
6
|
isForMaster?: boolean;
|
@@ -12,11 +12,7 @@ interface ITMMasterDetailDcmtsProps extends DeviceContextProps {
|
|
12
12
|
onPrev?: () => void;
|
13
13
|
onBack?: () => void;
|
14
14
|
appendMasterDcmts?: (tid: number | undefined, did: number | undefined) => void;
|
15
|
-
onTaskCreateRequest?: (
|
16
|
-
tid: number;
|
17
|
-
did: number;
|
18
|
-
name: string;
|
19
|
-
} | undefined) => void;
|
15
|
+
onTaskCreateRequest?: (taskContext: TaskContext | undefined) => void;
|
20
16
|
}
|
21
17
|
declare const TMMasterDetailDcmts: React.FC<ITMMasterDetailDcmtsProps>;
|
22
18
|
export default TMMasterDetailDcmts;
|
@@ -1,30 +1,30 @@
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { useCallback, useEffect, useState } from 'react';
|
3
3
|
import { DataColumnTypes, DcmtTypeListCacheService, MetadataDataDomains, MetadataFormats, RelationCacheService, RelationTypes, ResultTypes, SDK_Globals, SystemMIDs } from '@topconsultnpm/sdk-ts-beta';
|
4
|
-
import TMDcmtIcon from './TMDcmtIcon';
|
5
4
|
import { ContextMenu } from 'devextreme-react';
|
6
5
|
import { TMNothingToShow } from './TMDcmtPreview';
|
7
6
|
import TMDcmtForm from './TMDcmtForm';
|
8
7
|
import TMSearchResult from '../search/TMSearchResult';
|
9
|
-
import { genUniqueId, getExceptionMessage, IconFolder, IconShow, IconPreview, IconBoard, IconDcmtTypeSys, IconCheckFile, IconDetailDcmts, SDKUI_Localizator, svgToString, IconMail, IconDcmtTypeOnlyMetadata, IconCopy, IconMultipleSelection, IconMenuVertical } from '
|
10
|
-
import { hasDetailRelations } from '
|
11
|
-
import { FormModes, SearchResultContext } from '
|
12
|
-
import { TMColors } from '
|
13
|
-
import { StyledDivHorizontal, StyledBadge } from '
|
14
|
-
import ShowAlert from '
|
15
|
-
import TMButton from '
|
16
|
-
import { DeviceType } from '
|
17
|
-
import { TMSplitterLayout, TMLayoutItem } from '
|
18
|
-
import { TMExceptionBoxManager } from '
|
19
|
-
import TMSpinner from '
|
20
|
-
import TMToolbarCard from '
|
21
|
-
import { TMLayoutWaitingContainer } from '
|
22
|
-
import { TMUserIdViewer } from '
|
23
|
-
import { TMResultManager } from '
|
24
|
-
import { TMSaveFormButtonPrevious, TMSaveFormButtonNext } from '
|
25
|
-
import TMDataListItemViewer from '
|
26
|
-
import { TMDcmtTypeTooltip } from '
|
27
|
-
import TMTreeView from '
|
8
|
+
import { genUniqueId, getExceptionMessage, IconFolder, IconShow, IconPreview, IconBoard, IconDcmtTypeSys, IconCheckFile, IconDetailDcmts, SDKUI_Localizator, svgToString, IconMail, IconDcmtTypeOnlyMetadata, IconCopy, IconMultipleSelection, IconMenuVertical } from '../../../helper';
|
9
|
+
import { hasDetailRelations } from '../../../helper/dcmtsHelper';
|
10
|
+
import { FormModes, SearchResultContext } from '../../../ts';
|
11
|
+
import { TMColors } from '../../../utils/theme';
|
12
|
+
import { StyledDivHorizontal, StyledBadge } from '../../base/Styled';
|
13
|
+
import ShowAlert from '../../base/TMAlert';
|
14
|
+
import TMButton from '../../base/TMButton';
|
15
|
+
import { DeviceType } from '../../base/TMDeviceProvider';
|
16
|
+
import { TMSplitterLayout, TMLayoutItem } from '../../base/TMLayout';
|
17
|
+
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
18
|
+
import TMSpinner from '../../base/TMSpinner';
|
19
|
+
import TMToolbarCard from '../../base/TMToolbarCard';
|
20
|
+
import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
|
21
|
+
import { TMUserIdViewer } from '../../choosers/TMUserChooser';
|
22
|
+
import { TMResultManager } from '../../forms/TMResultDialog';
|
23
|
+
import { TMSaveFormButtonPrevious, TMSaveFormButtonNext } from '../../forms/TMSaveForm';
|
24
|
+
import TMDataListItemViewer from '../../viewers/TMDataListItemViewer';
|
25
|
+
import { TMDcmtTypeTooltip } from '../../viewers/TMTidViewer';
|
26
|
+
import TMTreeView from '../../base/TMTreeView';
|
27
|
+
import TMDcmtIcon from './TMDcmtIcon';
|
28
28
|
let abortController = new AbortController();
|
29
29
|
const TMMasterDetailDcmts = ({ deviceType, inputDcmts, isForMaster, showCurrentDcmtIndicator = true, allowNavigation, canNext, canPrev, onNext, onPrev, onBack, appendMasterDcmts, onTaskCreateRequest }) => {
|
30
30
|
const [id, setID] = useState('');
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { FC } from 'react';
|
2
|
+
import { QueryDescriptor, SavedQueryDescriptor } from '@topconsultnpm/sdk-ts-beta';
|
3
|
+
import { ITMSaveFormProps } from '../../../ts';
|
4
|
+
interface ISavedQueryFormProps extends ITMSaveFormProps<SavedQueryDescriptor> {
|
5
|
+
qd?: QueryDescriptor;
|
6
|
+
isAdvancedSearch?: boolean;
|
7
|
+
}
|
8
|
+
declare const TMSavedQueryForm: FC<ISavedQueryFormProps>;
|
9
|
+
export default TMSavedQueryForm;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { ObjectClasses, PlatformObjectValidator, SharingModes, SDK_Localizator, ValidationItem, ResultTypes, TMPropertyNames, SearchEngine } from '@topconsultnpm/sdk-ts-beta';
|
3
|
+
import { LocalizeSharingModes } from '../../../helper/Enum_Localizator';
|
4
|
+
import { deepCompare, SDKUI_Localizator } from '../../../helper';
|
5
|
+
import { SaveFormOptions, useSaveForm } from '../../../hooks/useForm';
|
6
|
+
import { FormModes } from '../../../ts';
|
7
|
+
import TMLayoutContainer, { TMLayoutItem } from '../../base/TMLayout';
|
8
|
+
import TMUserChooser from '../../choosers/TMUserChooser';
|
9
|
+
import TMCheckBox from '../../editors/TMCheckBox';
|
10
|
+
import TMRadioButton from '../../editors/TMRadioButton';
|
11
|
+
import TMTextBox from '../../editors/TMTextBox';
|
12
|
+
import TMSaveForm from '../../forms/TMSaveForm';
|
13
|
+
const TMSavedQueryForm = ({ id, qd, isAdvancedSearch = false, title, width, height, onSaved, onCancel, onClose, onStatusChanged, isModal, formMode = FormModes.Update, showBackButton }) => {
|
14
|
+
const validator = async (d) => {
|
15
|
+
let vil = [];
|
16
|
+
if (!d.name)
|
17
|
+
vil.push(new ValidationItem(ResultTypes.ERROR, "name", `${SDK_Localizator.RequiredField}`));
|
18
|
+
else if (!PlatformObjectValidator.IsValidObjectName(d.name))
|
19
|
+
vil.push(new ValidationItem(ResultTypes.ERROR, "name", `${SDK_Localizator.InvalidName}`));
|
20
|
+
return vil;
|
21
|
+
};
|
22
|
+
const sfo = new SaveFormOptions();
|
23
|
+
sfo.objClass = ObjectClasses.SavedQuery;
|
24
|
+
const customizeFormData = (d) => { d.qd = qd; d.isEasyWhere = isAdvancedSearch ? 0 : 1; return d; };
|
25
|
+
const { formData, setFormData, formDataOrig, validationItems, exception, saveDataAsync } = useSaveForm(formMode, id, sfo, validator, onSaved, onStatusChanged, customizeFormData);
|
26
|
+
const isModified = () => {
|
27
|
+
let data = { ...formData };
|
28
|
+
data.qd = SearchEngine.NormalizeQueryDescriptor(data.qd);
|
29
|
+
let dataOrig = { ...formDataOrig };
|
30
|
+
dataOrig.qd = SearchEngine.NormalizeQueryDescriptor(dataOrig.qd);
|
31
|
+
return !deepCompare(data, dataOrig);
|
32
|
+
};
|
33
|
+
return (_jsx(TMSaveForm, { id: id, title: title, isModal: isModal, onClose: onClose, onCancel: onCancel, formMode: formMode, exception: exception, hasNavigation: false, width: width, height: height, showBackButton: showBackButton, validationItems: validationItems, onUndo: () => { setFormData(customizeFormData(formDataOrig)); }, onSaveAsync: async () => { await saveDataAsync(); onClose?.(); }, isModified: isModified(), children: _jsx(TMLayoutContainer, { direction: 'vertical', children: _jsx(TMLayoutItem, { height: 'max-content', children: _jsxs(TMLayoutContainer, { gap: 5, children: [_jsx(TMLayoutItem, { height: 'max-content', children: _jsx(TMTextBox, { value: formData?.name ?? '', label: SDKUI_Localizator.Name, isModifiedWhen: formData?.name !== formDataOrig?.name, validationItems: validationItems?.filter(o => o.PropertyName === TMPropertyNames.entityName), onValueChanged: (e) => { formData && setFormData({ ...formData, name: e.target.value }); } }) }), _jsx(TMLayoutItem, { height: 'max-content', children: _jsx(TMTextBox, { value: formData?.description ?? '', label: SDKUI_Localizator.Description, isModifiedWhen: formData?.description !== formDataOrig?.description, onValueChanged: (e) => { formData && setFormData({ ...formData, description: e.target.value }); } }) }), _jsx(TMLayoutItem, { height: 'max-content', children: _jsx(TMCheckBox, { value: formData?.runSearchWhenSelected ?? 0, label: 'Eseguire immediatamente la ricerca quando viene selezionata', isModifiedWhen: formData?.runSearchWhenSelected !== formDataOrig?.runSearchWhenSelected, onValueChanged: (newValue) => { setFormData({ ...formData, runSearchWhenSelected: newValue }); } }) }), _jsx(TMLayoutItem, { height: 'max-content', children: _jsx(TMRadioButton, { label: 'Condivisione', dataSource: [
|
34
|
+
{ value: SharingModes.Private, display: LocalizeSharingModes(SharingModes.Private) },
|
35
|
+
{ value: SharingModes.Public, display: LocalizeSharingModes(SharingModes.Public) },
|
36
|
+
{ value: SharingModes.Shared, display: LocalizeSharingModes(SharingModes.Shared) }
|
37
|
+
], value: formData?.sharingMode, isModifiedWhen: formData?.sharingMode !== formDataOrig?.sharingMode, onValueChanged: (newValue) => setFormData({ ...formData, sharingMode: newValue }) }) }), _jsx(TMLayoutItem, { children: _jsx(TMUserChooser, { allowMultipleSelection: true, values: formData?.sharingUserIDs, label: SDKUI_Localizator.UserName, placeHolder: SDKUI_Localizator.NoneSelection, disabled: formData?.sharingMode !== SharingModes.Shared,
|
38
|
+
// isModifiedWhen={!MiscHelper.IntArraysAreEquals(value?.tiDs, valueOrig?.tiDs)}
|
39
|
+
onValueChanged: (newValue) => setFormData({ ...formData, sharingUserIDs: newValue }) }) })] }) }) }) }));
|
40
|
+
};
|
41
|
+
export default TMSavedQueryForm;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { SavedQueryDescriptor } from '@topconsultnpm/sdk-ts-beta';
|
3
|
+
export declare const getTooltipBySqd: (sqd: SavedQueryDescriptor | undefined) => import("react/jsx-runtime").JSX.Element | null;
|
4
|
+
interface ITMSavedQuerySelectorProps {
|
5
|
+
height?: string;
|
6
|
+
items?: SavedQueryDescriptor[];
|
7
|
+
selectedId?: number;
|
8
|
+
allowShowSearch?: boolean;
|
9
|
+
manageDefault?: boolean;
|
10
|
+
onItemClick?: (sqd: SavedQueryDescriptor) => void;
|
11
|
+
onDeleted?: (sqd: SavedQueryDescriptor) => void;
|
12
|
+
onFavoritesAdded?: (sqd: SavedQueryDescriptor) => void;
|
13
|
+
onRefreshData?: () => void;
|
14
|
+
}
|
15
|
+
declare const TMSavedQuerySelector: React.MemoExoticComponent<({ items, selectedId, allowShowSearch, height, manageDefault, onItemClick, onDeleted, onFavoritesAdded, onRefreshData }: ITMSavedQuerySelectorProps) => import("react/jsx-runtime").JSX.Element>;
|
16
|
+
export default TMSavedQuerySelector;
|
@@ -0,0 +1,143 @@
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
+
import React, { useEffect, useState } from 'react';
|
3
|
+
import styled from 'styled-components';
|
4
|
+
import { SharingModes, SDK_Globals, SDK_Localizator } from '@topconsultnpm/sdk-ts-beta';
|
5
|
+
import { LocalizeSharingModes } from '../../../helper/Enum_Localizator';
|
6
|
+
import ContextMenu from 'devextreme-react/cjs/context-menu';
|
7
|
+
import { SDKUI_Localizator, Globalization, svgToString, IconStar, IconDelete, IconDashboard, IconSavedQuery, IconAdvanced, IconLightningFill, IconApply } from '../../../helper';
|
8
|
+
import { TMColors } from '../../../utils/theme';
|
9
|
+
import ShowAlert from '../../base/TMAlert';
|
10
|
+
import TMButton from '../../base/TMButton';
|
11
|
+
import { TMMessageBoxManager, ButtonNames, TMExceptionBoxManager } from '../../base/TMPopUp';
|
12
|
+
import TMSpinner from '../../base/TMSpinner';
|
13
|
+
import TMTooltip from '../../base/TMTooltip';
|
14
|
+
import { TMSearchBar } from '../../sidebar/TMHeader';
|
15
|
+
const StyledSavedQueryListItem = styled.div `
|
16
|
+
display: flex;
|
17
|
+
flex-direction: row;
|
18
|
+
align-items: center;
|
19
|
+
background: ${(props) => props.$backgroundColor ?? undefined};
|
20
|
+
border-radius: 8px;
|
21
|
+
border: 1px solid;
|
22
|
+
border-color: lightgray;
|
23
|
+
box-shadow: 1px 1px 7px rgba(0,0,0,0.15);
|
24
|
+
width: 100%;
|
25
|
+
height: max-content;
|
26
|
+
min-height: 45px;
|
27
|
+
padding: 5px;
|
28
|
+
white-space: nowrap;
|
29
|
+
text-overflow: ellipsis;
|
30
|
+
|
31
|
+
&:hover {
|
32
|
+
background: ${(props) => props.$hoverColor ?? undefined};
|
33
|
+
cursor: pointer;
|
34
|
+
}
|
35
|
+
`;
|
36
|
+
const getSharingModeColor = (sharingMode) => {
|
37
|
+
switch (sharingMode) {
|
38
|
+
case SharingModes.Private: return 'rgb(185, 72, 57)';
|
39
|
+
case SharingModes.Public: return 'rgb(56, 126, 28)';
|
40
|
+
case SharingModes.Shared: return 'rgb(224, 194, 43)';
|
41
|
+
default: return 'black';
|
42
|
+
}
|
43
|
+
};
|
44
|
+
export const getTooltipBySqd = (sqd) => {
|
45
|
+
if (!sqd)
|
46
|
+
return null;
|
47
|
+
return (_jsxs("div", { style: { textAlign: "left" }, children: [_jsxs("div", { children: ["ID: ", sqd.id] }), _jsxs("div", { children: ["Master TID: ", sqd.masterTID] }), _jsx("div", { children: sqd.description }), _jsx("hr", {}), _jsxs("div", { children: [SDKUI_Localizator.OwnerName, ": ", sqd.ownerName, " (", sqd.ownerID, ")"] }), _jsx("div", { children: LocalizeSharingModes(sqd.sharingMode) }), _jsxs("div", { children: ["Default: ", sqd.isDefault == 1 ? SDKUI_Localizator.Yes : SDKUI_Localizator.No] }), _jsxs("div", { children: ["Filtro semplice", ": ", sqd.isEasyWhere == 1 ? SDKUI_Localizator.Yes : SDKUI_Localizator.No] }), _jsxs("div", { children: ["Esegui ricerca immediatamente", ": ", sqd.runSearchWhenSelected == 1 ? SDKUI_Localizator.Yes : SDKUI_Localizator.No] }), _jsx("hr", {}), _jsxs("div", { children: [SDKUI_Localizator.CreationTime, ": ", Globalization.getDateTimeDisplayValue(sqd.creationTime)] }), _jsxs("div", { children: [SDKUI_Localizator.LastUpdateTime, ": ", Globalization.getDateTimeDisplayValue(sqd.lastUpdateTime)] })] }));
|
48
|
+
};
|
49
|
+
const initialSQDsMaxItems = 12;
|
50
|
+
const SavedQueryContexMenu = ({ sqd, manageDefault, deleteAsync, favManageAsync, setDefaultAsync }) => _jsx(ContextMenu, { items: manageDefault ? [
|
51
|
+
{ text: SDKUI_Localizator.SetAsDefault2, icon: svgToString(_jsx(IconStar, { color: 'rgb(248, 215, 117)' })) },
|
52
|
+
{ text: SDKUI_Localizator.Delete, disabled: (sqd.id == 1), icon: svgToString(_jsx(IconDelete, {})) },
|
53
|
+
{ text: SDKUI_Localizator.AddToHomePage, disabled: (sqd.id == 1), icon: svgToString(_jsx(IconDashboard, {})) }
|
54
|
+
] : [
|
55
|
+
{ text: SDKUI_Localizator.Delete, disabled: (sqd.id == 1), icon: svgToString(_jsx(IconDelete, {})) },
|
56
|
+
{ text: SDKUI_Localizator.AddToHomePage, disabled: (sqd.id == 1), icon: svgToString(_jsx(IconDashboard, {})) }
|
57
|
+
], target: `#sqd-item-${sqd.id}`, onItemClick: (e) => {
|
58
|
+
if (e.itemIndex == 0)
|
59
|
+
setDefaultAsync?.(sqd);
|
60
|
+
else if (e.itemIndex == 1)
|
61
|
+
deleteAsync?.(sqd);
|
62
|
+
else if (e.itemIndex == 2)
|
63
|
+
favManageAsync?.(sqd);
|
64
|
+
} });
|
65
|
+
const TMSavedQuerySelector = React.memo(({ items, selectedId, allowShowSearch = true, height, manageDefault = true, onItemClick, onDeleted, onFavoritesAdded, onRefreshData }) => {
|
66
|
+
const [dataSource, setDataSource] = useState([]);
|
67
|
+
const [selectedItem, setSelectedItem] = useState();
|
68
|
+
const [searchText, setSearchText] = useState('');
|
69
|
+
const [showAllRoot, setShowAllRoot] = useState(false);
|
70
|
+
useEffect(() => { loadDataAsync(false); }, [items]);
|
71
|
+
useEffect(() => { setSelectedItem(dataSource.find(o => o.id == selectedId)); }, [selectedId, dataSource]);
|
72
|
+
const loadDataAsync = async (refreshCache) => {
|
73
|
+
if (items && items.length > 0)
|
74
|
+
setDataSource(items);
|
75
|
+
};
|
76
|
+
const deleteSQDAsync = (sqd) => {
|
77
|
+
TMMessageBoxManager.show({
|
78
|
+
title: SDKUI_Localizator.Delete, message: SDKUI_Localizator.Delete_ConfirmFor1.replaceParams(sqd?.name ?? ""), buttons: [ButtonNames.YES, ButtonNames.NO],
|
79
|
+
onButtonClick: async (e) => {
|
80
|
+
try {
|
81
|
+
if (e !== ButtonNames.YES)
|
82
|
+
return;
|
83
|
+
TMSpinner.show();
|
84
|
+
await SDK_Globals.tmSession?.NewSavedQueryEngine().DeleteAsync(sqd?.id);
|
85
|
+
await loadDataAsync(true);
|
86
|
+
onDeleted?.(sqd);
|
87
|
+
TMSpinner.hide();
|
88
|
+
}
|
89
|
+
catch (ex) {
|
90
|
+
TMSpinner.hide();
|
91
|
+
TMExceptionBoxManager.show({ exception: ex });
|
92
|
+
}
|
93
|
+
}
|
94
|
+
});
|
95
|
+
};
|
96
|
+
const favManageSQDAsync = async (sqd) => {
|
97
|
+
try {
|
98
|
+
TMSpinner.show();
|
99
|
+
await SDK_Globals.tmSession?.NewSavedQueryEngine().FavoritesAddOrRemoveAsync(sqd?.id, false);
|
100
|
+
onFavoritesAdded?.(sqd);
|
101
|
+
TMSpinner.hide();
|
102
|
+
ShowAlert({ mode: 'success', title: SDK_Localizator.SavedQuery, message: 'Operazione eseguita con successo', duration: 3000 });
|
103
|
+
}
|
104
|
+
catch (ex) {
|
105
|
+
TMSpinner.hide();
|
106
|
+
TMExceptionBoxManager.show({ exception: ex });
|
107
|
+
}
|
108
|
+
};
|
109
|
+
const setDefaultSQDAsync = async (sqd) => {
|
110
|
+
try {
|
111
|
+
TMSpinner.show();
|
112
|
+
await SDK_Globals.tmSession?.NewSavedQueryEngine().DefaultSetOrRemoveAsync(sqd.masterTID, sqd.id);
|
113
|
+
onRefreshData?.();
|
114
|
+
TMSpinner.hide();
|
115
|
+
}
|
116
|
+
catch (ex) {
|
117
|
+
TMSpinner.hide();
|
118
|
+
TMExceptionBoxManager.show({ exception: ex });
|
119
|
+
}
|
120
|
+
};
|
121
|
+
return (_jsxs("div", { style: { height: height ?? '100%', width: '100%', display: 'flex', flexDirection: 'column', gap: '5px', paddingTop: allowShowSearch ? '5px' : undefined }, children: [allowShowSearch &&
|
122
|
+
_jsx("div", { style: { width: '100%', display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '10px', paddingBottom: '10px', paddingTop: '10px' }, children: _jsx(TMSearchBar, { marginLeft: '0px', maxWidth: '300px', searchValue: searchText, onSearchValueChanged: (e) => setSearchText(e) }) }), _jsx("div", { style: { width: '100%', overflow: 'auto', display: 'flex', flexDirection: 'column', justifyContent: 'flex-start', padding: '5px', gap: '3px' }, children: dataSource.slice(0, showAllRoot || searchText.length > 0 ? dataSource.length : initialSQDsMaxItems).filter(o => searchText.length <= 0 || (searchText.length > 0 && o.name?.toLocaleLowerCase().includes(searchText.toLocaleLowerCase())) || o.description?.toLocaleLowerCase().includes(searchText.toLocaleLowerCase())).map((sqd, index) => (_jsxs(StyledSavedQueryListItem, { id: `sqd-item-${sqd.id}`, style: { position: 'relative', gap: '5px', paddingLeft: '5px' }, "$backgroundColor": 'white', "$hoverColor": 'rgba(243, 152, 119, .2)', "$selectedColor": 'rgb(237, 115, 72)', onClick: () => {
|
123
|
+
setSelectedItem(sqd);
|
124
|
+
onItemClick?.(sqd);
|
125
|
+
}, children: [_jsx(TMTooltip, { content: getTooltipBySqd(sqd), children: _jsx("div", { style: { backgroundColor: 'white', minWidth: '24px', minHeight: '24px', borderRadius: '24px', display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: _jsx(IconSavedQuery, { fontSize: 22, color: getSharingModeColor(sqd.sharingMode) }) }) }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', whiteSpace: 'nowrap',
|
126
|
+
overflow: 'hidden',
|
127
|
+
textOverflow: 'ellipsis' }, children: [_jsxs("div", { style: {
|
128
|
+
display: 'flex', justifyContent: 'flex-start', width: '100%', whiteSpace: 'nowrap',
|
129
|
+
overflow: 'hidden',
|
130
|
+
textOverflow: 'ellipsis'
|
131
|
+
}, children: [_jsx("p", { style: {
|
132
|
+
fontSize: '1rem', fontWeight: 600, whiteSpace: 'nowrap',
|
133
|
+
overflow: 'hidden',
|
134
|
+
textOverflow: 'ellipsis', alignItems: 'flex-end', display: 'flex'
|
135
|
+
}, children: sqd.name }), manageDefault && sqd.isDefault == 1 && _jsx(IconStar, { fontSize: 16, color: 'rgb(248, 215, 117)' })] }), _jsx("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'flex-start', width: '100%' }, children: _jsx("p", { style: { fontSize: '0.9rem', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }, children: sqd.description }) })] }), _jsxs("div", { style: { height: '100%', display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'flex-start' }, children: [_jsx("div", { style: { height: '50%', display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: sqd.isEasyWhere != 1 ? _jsx(IconAdvanced, { fontSize: 20 }) : _jsx(_Fragment, {}) }), _jsx("div", { style: { height: '50%', display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: sqd.runSearchWhenSelected ?
|
136
|
+
_jsx("div", { style: { width: '16px', height: '16px', borderRadius: '16px', backgroundColor: TMColors.info, color: 'white', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: '1rem', fontWeight: 'bold' }, children: _jsx(IconLightningFill, { fontSize: 12, color: 'rgb(224, 194, 43)' }) })
|
137
|
+
: _jsx(_Fragment, {}) })] }), selectedItem?.id == sqd.id &&
|
138
|
+
_jsx("div", { style: { width: '24px', height: '24px', borderRadius: '24px', backgroundColor: 'rgba(243, 152, 119, .8)', boxShadow: '1px 2px 2px #00000050', position: 'absolute', top: '-2px', right: '-5px', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: '1rem', fontWeight: 'bold' }, children: _jsx(IconApply, { fontSize: 24, color: 'green' }) }), _jsx(SavedQueryContexMenu, { sqd: sqd, manageDefault: manageDefault, setDefaultAsync: () => setDefaultSQDAsync(sqd), deleteAsync: () => deleteSQDAsync(sqd), favManageAsync: () => favManageSQDAsync(sqd) })] }, sqd.id))) }), dataSource.length > initialSQDsMaxItems && searchText.length <= 0 &&
|
139
|
+
_jsx(TMButton, { elementStyle: { display: 'flex', justifyContent: 'flex-end', padding: '10px' }, btnStyle: 'icon', caption: showAllRoot ? "Mostra meno" : `Mostra tutte le ricerche (+${dataSource.length - initialSQDsMaxItems})`, icon: showAllRoot ?
|
140
|
+
_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: `-${dataSource.length - initialSQDsMaxItems}` }) }) :
|
141
|
+
_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: `+${dataSource.length - initialSQDsMaxItems}` }) }), onClick: () => setShowAllRoot(!showAllRoot) })] }));
|
142
|
+
});
|
143
|
+
export default TMSavedQuerySelector;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { TaskContext } from '../../../ts';
|
3
|
+
interface ITMSearchProps {
|
4
|
+
inputTID?: number;
|
5
|
+
inputSqdID?: number;
|
6
|
+
onRefreshAfterAddDcmtToFavs?: () => void;
|
7
|
+
onTaskCreateRequest?: (taskContext: TaskContext | undefined) => void;
|
8
|
+
}
|
9
|
+
declare const TMSearch: React.FunctionComponent<ITMSearchProps>;
|
10
|
+
export default TMSearch;
|