@topconsultnpm/sdkui-react-beta 6.12.41 → 6.12.43
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/grids/TMRecentsManager.d.ts +11 -0
- package/lib/components/grids/TMRecentsManager.js +45 -0
- package/lib/components/query/TMMasterDetailDcmts.d.ts +2 -6
- package/lib/components/search/TMSavedQueryForm.d.ts +9 -0
- package/lib/components/search/TMSavedQueryForm.js +41 -0
- package/lib/components/search/TMSavedQuerySelector.d.ts +16 -0
- package/lib/components/search/TMSavedQuerySelector.js +143 -0
- package/lib/components/search/TMSearch.d.ts +10 -0
- package/lib/components/search/TMSearch.js +188 -0
- package/lib/components/search/TMSearchQueryEditor.d.ts +15 -0
- package/lib/components/search/TMSearchQueryEditor.js +365 -0
- package/lib/components/search/TMSearchQueryPanel.d.ts +20 -0
- package/lib/components/search/TMSearchQueryPanel.js +296 -0
- package/lib/components/search/TMSearchResult.d.ts +2 -6
- package/lib/components/search/TMSearchResult.js +1 -1
- package/lib/components/search/TMTreeSelector.d.ts +9 -0
- package/lib/components/search/TMTreeSelector.js +125 -0
- 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 +1 -1
@@ -0,0 +1,11 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { DeviceType } from '../base/TMDeviceProvider';
|
3
|
+
interface ITMRecentsProps {
|
4
|
+
mruTIDs: number[];
|
5
|
+
currentMruTID?: number;
|
6
|
+
deviceType?: DeviceType;
|
7
|
+
onSelectedTID?: (tid: number) => void;
|
8
|
+
onDeletedTID?: (tid: number) => void;
|
9
|
+
}
|
10
|
+
declare const TMRecentsManager: React.FunctionComponent<ITMRecentsProps>;
|
11
|
+
export default TMRecentsManager;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
+
import styled from 'styled-components';
|
3
|
+
import { useState } from 'react';
|
4
|
+
import ReactDOMServer from 'react-dom/server';
|
5
|
+
import { DcmtTypeListCacheService } from '@topconsultnpm/sdk-ts-beta';
|
6
|
+
import ContextMenu from 'devextreme-react/cjs/context-menu';
|
7
|
+
import { IconDelete, IconFolderSearch, SDKUI_Localizator, IconApply } from '../../helper';
|
8
|
+
import { TMColors } from '../../utils/theme';
|
9
|
+
import { StyledBadge } from '../base/Styled';
|
10
|
+
import { DeviceType } from '../base/TMDeviceProvider';
|
11
|
+
import { TMDcmtTypeChooserForm } from '../choosers/TMDcmtTypeChooser';
|
12
|
+
import TMTidViewer from '../viewers/TMTidViewer';
|
13
|
+
const StyledRecentCardItem = styled.div `
|
14
|
+
display: flex;
|
15
|
+
flex-direction: row;
|
16
|
+
background: ${(props) => props.$backgroundColor ?? undefined};
|
17
|
+
border-radius: 8px;
|
18
|
+
border: ${(props) => props.$showBorder ? '1px solid lightgray' : undefined};
|
19
|
+
width: 100%;
|
20
|
+
height: 40px;
|
21
|
+
padding: 3px;
|
22
|
+
position: relative;
|
23
|
+
white-space: nowrap;
|
24
|
+
text-overflow: ellipsis;
|
25
|
+
|
26
|
+
&:hover {
|
27
|
+
background: ${(props) => props.$hoverColor ?? undefined};
|
28
|
+
cursor: pointer;
|
29
|
+
}
|
30
|
+
`;
|
31
|
+
const iconDelete = () => ReactDOMServer.renderToString(_jsx(IconDelete, {}));
|
32
|
+
const TMRecentsManager = ({ deviceType, mruTIDs, currentMruTID, onSelectedTID, onDeletedTID }) => {
|
33
|
+
const [showDcmtTypeChooser, setShowDcmtTypeChooser] = useState(false);
|
34
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { style: { overflowY: deviceType === DeviceType.MOBILE ? 'auto' : undefined, display: 'flex', flexDirection: 'column-reverse', padding: '5px', gap: '5px' }, children: [_jsxs(StyledRecentCardItem, { "$backgroundColor": 'white', "$hoverColor": 'rgba(217, 37, 136, 0.3)', "$showBorder": true, onClick: () => { setShowDcmtTypeChooser(true); }, children: [_jsx("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: _jsx(IconFolderSearch, { fontSize: 24, color: 'rgb(217, 37, 136)' }) }), _jsx("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'flex-start', width: '100%' }, children: _jsx("p", { style: { fontSize: '1rem', fontWeight: 600, textOverflow: 'ellipsis' }, children: SDKUI_Localizator.AllDcmtTypes }) }), _jsx(StyledBadge, { style: { height: 'max-content' }, "$backgroundColor": TMColors.info, children: _jsx("p", { children: DcmtTypeListCacheService.CacheCount(true) }) })] }), mruTIDs.map((tid) => {
|
35
|
+
return (_jsxs(StyledRecentCardItem, { id: `tid-${tid}`, "$backgroundColor": `${TMColors.primaryColor}33`, "$hoverColor": `${TMColors.primaryColor}66`, onClick: async () => {
|
36
|
+
onSelectedTID?.(tid);
|
37
|
+
}, children: [_jsx("div", { style: {
|
38
|
+
display: 'flex', alignItems: 'center', paddingRight: '5px', fontSize: '1rem', fontWeight: 600, whiteSpace: 'nowrap',
|
39
|
+
overflow: 'hidden',
|
40
|
+
textOverflow: 'ellipsis'
|
41
|
+
}, children: _jsx(TMTidViewer, { tid: tid, showIcon: true }) }), _jsx(ContextMenu, { dataSource: [{ text: SDKUI_Localizator.Remove, icon: iconDelete(), }], target: `#tid-${tid}`, onItemClick: () => { onDeletedTID?.(tid); } }), currentMruTID == tid &&
|
42
|
+
_jsx("div", { style: { width: '24px', height: '24px', borderRadius: '24px', backgroundColor: 'rgba(243, 152, 119, .8)', boxShadow: '1px 2px 2px #00000050', position: 'absolute', top: '-4px', right: '-5px', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: '1rem', fontWeight: 'bold' }, children: _jsx(IconApply, { fontSize: 24, color: 'green' }) })] }, tid));
|
43
|
+
})] }), showDcmtTypeChooser && _jsx(TMDcmtTypeChooserForm, { onClose: () => setShowDcmtTypeChooser(false), onChoose: (tids) => { onSelectedTID?.(tids?.[0] ?? 0); } })] }));
|
44
|
+
};
|
45
|
+
export default TMRecentsManager;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { DcmtInfo } from '../../ts';
|
2
|
+
import { DcmtInfo, TaskContext } from '../../ts';
|
3
3
|
import { DeviceContextProps } from '../base/TMDeviceProvider';
|
4
4
|
interface ITMMasterDetailDcmtsProps extends DeviceContextProps {
|
5
5
|
inputDcmts?: DcmtInfo[];
|
@@ -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;
|
@@ -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;
|
@@ -0,0 +1,188 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
+
import { useCallback, useEffect, useState } from 'react';
|
3
|
+
import { SavedQueryCacheService, SDK_Globals, DcmtTypeListCacheService, SDK_Localizator, LocalStorageService } from '@topconsultnpm/sdk-ts-beta';
|
4
|
+
import TMSavedQuerySelector from './TMSavedQuerySelector';
|
5
|
+
import TMTreeSelector from './TMTreeSelector';
|
6
|
+
import { TabPanel, Item } from 'devextreme-react/tab-panel';
|
7
|
+
import TMSearchQueryPanel, { refreshLastSearch } from './TMSearchQueryPanel';
|
8
|
+
import { getSysAllDcmtsSQD, IconDataList, IconProgressReady, IconSavedQuery, IconTree, SDKUI_Globals, SDKUI_Localizator } from '../../helper';
|
9
|
+
import TMLayoutContainer, { TMLayoutItem, TMSplitterLayout } from '../base/TMLayout';
|
10
|
+
import TMToolbarCard from '../base/TMToolbarCard';
|
11
|
+
import TMSearchResult from './TMSearchResult';
|
12
|
+
import TMRecentsManager from '../grids/TMRecentsManager';
|
13
|
+
import { SearchResultContext } from '../../ts';
|
14
|
+
import { useDeviceType, DeviceType } from '../base/TMDeviceProvider';
|
15
|
+
var TMSearchViews;
|
16
|
+
(function (TMSearchViews) {
|
17
|
+
TMSearchViews[TMSearchViews["None"] = 0] = "None";
|
18
|
+
TMSearchViews[TMSearchViews["Result"] = 1] = "Result";
|
19
|
+
})(TMSearchViews || (TMSearchViews = {}));
|
20
|
+
const TMSearch = ({ inputTID, inputSqdID, onRefreshAfterAddDcmtToFavs, onTaskCreateRequest }) => {
|
21
|
+
const [allSQDs, setAllSQDs] = useState([]);
|
22
|
+
const [filteredByTIDSQDs, setFilteredByTIDSQDs] = useState([]);
|
23
|
+
const [currentSQD, setCurrentSQD] = useState();
|
24
|
+
const [currentTID, setCurrentTID] = useState(0);
|
25
|
+
const [currentMruTID, setCurrentMruTID] = useState(0);
|
26
|
+
const [fromDTD, setFromDTD] = useState();
|
27
|
+
const [searchResult, setSearchResult] = useState([]);
|
28
|
+
const [mruTIDs, setMruTIDs] = useState([]);
|
29
|
+
const [currentSearchView, setCurrentSearchView] = useState(TMSearchViews.None);
|
30
|
+
const [showDistinctValuesPanel, setShowDistinctValuesPanel] = useState(false);
|
31
|
+
const [showTreesPanel, setShowTreesPanel] = useState(true);
|
32
|
+
const [showRecentsPanel, setShowRecentsPanel] = useState(true);
|
33
|
+
const [showSavedQueryPanel, setShowSavedQueryPanel] = useState(true);
|
34
|
+
const [currentSQDMode, setCurrentSQDMode] = useState(1);
|
35
|
+
const [focusedTidMid, setFocusedTidMid] = useState();
|
36
|
+
const [lastQdSearched, setLastQdSearched] = useState();
|
37
|
+
const deviceType = useDeviceType();
|
38
|
+
useEffect(() => {
|
39
|
+
setMruTIDs(LocalStorageService.getItem(`SEARCHPAGE_MRU_TIDS_${SDK_Globals.tmSession?.SessionDescr?.archiveID}_${SDK_Globals.tmSession?.SessionDescr?.userID}`) ?? []);
|
40
|
+
loadDataSQDsAsync(false);
|
41
|
+
}, []);
|
42
|
+
useEffect(() => {
|
43
|
+
if (!inputTID)
|
44
|
+
return;
|
45
|
+
setCurrentTID(inputTID);
|
46
|
+
}, [inputTID]);
|
47
|
+
useEffect(() => {
|
48
|
+
if (inputSqdID) {
|
49
|
+
SavedQueryCacheService.GetAsync(inputSqdID).then(async (resultSqd) => {
|
50
|
+
await setSQDAsync(resultSqd);
|
51
|
+
});
|
52
|
+
}
|
53
|
+
}, [inputSqdID]);
|
54
|
+
useEffect(() => {
|
55
|
+
if (!currentTID || currentTID <= 0) {
|
56
|
+
setSearchResult([]);
|
57
|
+
return;
|
58
|
+
}
|
59
|
+
DcmtTypeListCacheService.GetAsync(currentTID).then(async (dtd) => {
|
60
|
+
setFromDTD(dtd);
|
61
|
+
let sqds = await getSQDsByTIDAsync(currentTID, allSQDs) ?? [];
|
62
|
+
setFilteredByTIDSQDs(sqds);
|
63
|
+
setCurrentSQDMode(0);
|
64
|
+
await setDefaultSQDAsync(sqds);
|
65
|
+
});
|
66
|
+
}, [currentTID]);
|
67
|
+
useEffect(() => {
|
68
|
+
if (currentSQD && currentSQD.masterTID != currentTID) {
|
69
|
+
DcmtTypeListCacheService.GetAsync(currentSQD.masterTID).then(async (dtd) => {
|
70
|
+
setFromDTD(dtd);
|
71
|
+
let sqds = await getSQDsByTIDAsync(currentSQD.masterTID, allSQDs) ?? [];
|
72
|
+
setFilteredByTIDSQDs(sqds);
|
73
|
+
setCurrentSQDMode(0);
|
74
|
+
});
|
75
|
+
}
|
76
|
+
}, [currentSQD]);
|
77
|
+
const loadDataSQDsAsync = async (refreshCache, curTID) => {
|
78
|
+
if (refreshCache) {
|
79
|
+
SavedQueryCacheService.RemoveAll();
|
80
|
+
SavedQueryCacheService.Remove();
|
81
|
+
}
|
82
|
+
let sqdCache = await SavedQueryCacheService.GetAllAsync() ?? [];
|
83
|
+
setAllSQDs(sqdCache);
|
84
|
+
let sqds = await getSQDsByTIDAsync(curTID ?? currentTID, allSQDs) ?? [];
|
85
|
+
setFilteredByTIDSQDs(sqds);
|
86
|
+
setCurrentSQDMode(0);
|
87
|
+
};
|
88
|
+
const getSQDsByTIDAsync = async (tid, allSQDList) => {
|
89
|
+
if (!tid)
|
90
|
+
return;
|
91
|
+
let sqds = allSQDList ? allSQDList.slice() : allSQDs.slice();
|
92
|
+
sqds = sqds.filter(o => o.masterTID == tid);
|
93
|
+
sqds.unshift(await getSysAllDcmtsSQD(tid, false));
|
94
|
+
return sqds;
|
95
|
+
};
|
96
|
+
const setDefaultSQDAsync = async (sqds) => {
|
97
|
+
let defaultSQD = sqds.find(o => o.isDefault == 1);
|
98
|
+
defaultSQD ??= sqds.find(o => o.id == 1);
|
99
|
+
if (defaultSQD)
|
100
|
+
defaultSQD.isDefault = 1;
|
101
|
+
if (defaultSQD) {
|
102
|
+
await setSQDAsync(defaultSQD);
|
103
|
+
}
|
104
|
+
};
|
105
|
+
const setSQDAsync = async (sqd) => {
|
106
|
+
let newSqd = (sqd?.id == 1) ? sqd : await SavedQueryCacheService.GetAsync(sqd?.id);
|
107
|
+
setCurrentSQD(newSqd);
|
108
|
+
if (!newSqd?.masterTID)
|
109
|
+
return;
|
110
|
+
if (newSqd?.masterTID !== currentTID)
|
111
|
+
setCurrentTID(0);
|
112
|
+
if (mruTIDs.includes(newSqd.masterTID))
|
113
|
+
setCurrentMruTID(newSqd.masterTID);
|
114
|
+
else
|
115
|
+
setCurrentMruTID(0);
|
116
|
+
};
|
117
|
+
const onSQDItemClick = useCallback(async (sqd, setSqdAsync) => {
|
118
|
+
await setSqdAsync(sqd);
|
119
|
+
}, []);
|
120
|
+
const onSQDDeleted = useCallback(async (sqd, sqdToBeSet, setSqdAsync) => {
|
121
|
+
await loadDataSQDsAsync(true, sqd.masterTID);
|
122
|
+
if (sqdToBeSet)
|
123
|
+
await setSqdAsync?.(sqdToBeSet);
|
124
|
+
}, []);
|
125
|
+
const rightSidebarItems = [
|
126
|
+
{ icon: _jsx(IconTree, {}), id: 'trees', visibleName: 'Alberi', isActive: showTreesPanel, visible: true },
|
127
|
+
{ icon: _jsx(IconProgressReady, {}), id: 'recents', visibleName: 'Recenti', isActive: showRecentsPanel, visible: true, },
|
128
|
+
{ icon: _jsx(IconSavedQuery, {}), id: 'savedquery', visibleName: 'Ricerche rapide', isActive: showSavedQueryPanel, visible: true },
|
129
|
+
{ icon: _jsx(IconDataList, {}), id: 'DistinctValues', visibleName: 'Valori distiniti', isActive: showDistinctValuesPanel, disabled: !focusedTidMid, visible: true }
|
130
|
+
];
|
131
|
+
const rightSidebarItemClickHandler = (item) => {
|
132
|
+
switch (item.toLowerCase()) {
|
133
|
+
case 'trees':
|
134
|
+
setShowTreesPanel(!showTreesPanel);
|
135
|
+
break;
|
136
|
+
case 'recents':
|
137
|
+
setShowRecentsPanel(!showRecentsPanel);
|
138
|
+
break;
|
139
|
+
case 'savedquery':
|
140
|
+
setShowSavedQueryPanel(!showSavedQueryPanel);
|
141
|
+
break;
|
142
|
+
case 'distinctvalues':
|
143
|
+
setShowDistinctValuesPanel(!showDistinctValuesPanel);
|
144
|
+
break;
|
145
|
+
default: break;
|
146
|
+
}
|
147
|
+
};
|
148
|
+
return (_jsxs(TMLayoutContainer, { direction: 'vertical', children: [_jsx("div", { style: { position: (currentSearchView === TMSearchViews.None) ? 'relative' : 'absolute', left: (currentSearchView === TMSearchViews.None) ? '0px' : '-9999px', top: (currentSearchView === TMSearchViews.None) ? '0px' : '-9999px', visibility: (currentSearchView === TMSearchViews.None) ? 'visible' : 'hidden', display: "flex", flexDirection: "column", height: "100%", width: '100%' }, children: _jsxs(TMSplitterLayout, { direction: 'horizontal', showSeparator: deviceType !== DeviceType.MOBILE && showTreesPanel, separatorSize: 8, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: (deviceType === DeviceType.MOBILE) ? ['100%', '0%'] : showTreesPanel ? [SDKUI_Globals.userAppSettings?.searchSettings?.filterPageSettings?.treePanel?.size ?? '50px', '80%'] : ['0%', '100%'], children: [deviceType !== DeviceType.MOBILE && _jsx(TMTreeSelector, { onClose: () => setShowTreesPanel(false), onSelectedTIDChanged: (tid) => {
|
149
|
+
setCurrentTID(tid);
|
150
|
+
if (tid && mruTIDs.includes(tid))
|
151
|
+
setCurrentMruTID(tid);
|
152
|
+
else
|
153
|
+
setCurrentMruTID(0);
|
154
|
+
} }), _jsxs(TMSplitterLayout, { direction: 'horizontal', showSeparator: deviceType !== DeviceType.MOBILE && showSavedQueryPanel && !showDistinctValuesPanel, separatorSize: 8, 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', showSeparator: deviceType !== DeviceType.MOBILE && showRecentsPanel, separatorSize: 8, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: deviceType === DeviceType.DESKTOP ? (showRecentsPanel ? ['30%', '70%'] : ['0%', '100%']) : (currentTID ? ['0%', '100%'] : ['100%', '0%']), children: [_jsx(TMToolbarCard, { 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) => {
|
155
|
+
let newMruTIDS = mruTIDs.slice();
|
156
|
+
let index = newMruTIDS.findIndex(o => o == tid);
|
157
|
+
if (index >= 0)
|
158
|
+
newMruTIDS.splice(index, 1);
|
159
|
+
LocalStorageService.setItem(`SEARCHPAGE_MRU_TIDS_${SDK_Globals.tmSession?.SessionDescr?.archiveID}_${SDK_Globals.tmSession?.SessionDescr?.userID}`, newMruTIDS.filter(tid => tid != undefined && tid != null));
|
160
|
+
setMruTIDs(newMruTIDS);
|
161
|
+
} }) }), _jsx(TMSearchQueryPanel, { fromDTD: fromDTD, SQD: currentSQD, isOpenDistinctValuesPanel: showDistinctValuesPanel, rightSidebarItems: rightSidebarItems, onFocusedMetadataChanged: setFocusedTidMid, onRightSidebarItemClick: rightSidebarItemClickHandler, onCloseDistinctValuesPanel: () => setShowDistinctValuesPanel(false), onSearchCompleted: (searchResult, qd) => {
|
162
|
+
setSearchResult(searchResult);
|
163
|
+
setLastQdSearched(qd);
|
164
|
+
setCurrentSearchView(TMSearchViews.Result);
|
165
|
+
// Salvataggio ultimi 10 TIDs
|
166
|
+
let fromTID = searchResult?.[0].fromTID;
|
167
|
+
let newMruTIDS = mruTIDs.slice();
|
168
|
+
let index = newMruTIDS.findIndex(o => o == fromTID);
|
169
|
+
if (index >= 0)
|
170
|
+
newMruTIDS.splice(index, 1);
|
171
|
+
if (newMruTIDS.length >= 10)
|
172
|
+
newMruTIDS.splice(0, 1);
|
173
|
+
newMruTIDS.push(fromTID);
|
174
|
+
setMruTIDs(newMruTIDS);
|
175
|
+
setCurrentMruTID(fromTID);
|
176
|
+
LocalStorageService.setItem(`SEARCHPAGE_MRU_TIDS_${SDK_Globals.tmSession?.SessionDescr?.archiveID}_${SDK_Globals.tmSession?.SessionDescr?.userID}`, newMruTIDS.filter(tid => tid != undefined && tid != null));
|
177
|
+
}, onSqdSaved: async (newSqd) => {
|
178
|
+
await loadDataSQDsAsync(true, newSqd.masterTID);
|
179
|
+
await setSQDAsync(newSqd);
|
180
|
+
} })] }) }), _jsx(TMLayoutItem, { children: _jsx(TMToolbarCard, { 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,
|
181
|
+
// selectedId={currentSQD?.id}
|
182
|
+
onItemClick: (sqd) => onSQDItemClick(sqd, setSQDAsync), onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? undefined : currentSQD, setSQDAsync) }) })] }) }) })] })] }) }, 'div-1'), _jsx("div", { style: { position: (currentSearchView === TMSearchViews.Result) ? 'relative' : 'absolute', left: (currentSearchView === TMSearchViews.Result) ? '0px' : '-9999px', top: (currentSearchView === TMSearchViews.Result) ? '0px' : '-9999px', visibility: (currentSearchView === TMSearchViews.Result) ? 'visible' : 'hidden', display: "flex", flexDirection: "column", height: "100%", width: '100%' }, children: searchResult.length > 0 &&
|
183
|
+
_jsx(TMSearchResult, { context: SearchResultContext.METADATA_SEARCH, searchResults: searchResult, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, onRefreshSearchAsync: async () => {
|
184
|
+
// setSearchResult([]);
|
185
|
+
setSearchResult(await refreshLastSearch(lastQdSearched) ?? []);
|
186
|
+
}, onTaskCreateRequest: onTaskCreateRequest, onClose: () => { setCurrentSearchView(TMSearchViews.None); } }) }, 'div-2')] }));
|
187
|
+
};
|
188
|
+
export default TMSearch;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { DcmtTypeDescriptor, QueryDescriptor } from '@topconsultnpm/sdk-ts-beta';
|
3
|
+
import { TID_MID } from '../../ts';
|
4
|
+
interface ITMSearchQueryEditorProps {
|
5
|
+
qd: QueryDescriptor | undefined;
|
6
|
+
fromDTD?: DcmtTypeDescriptor;
|
7
|
+
dcmtTypesList?: DcmtTypeDescriptor[];
|
8
|
+
showAdvancedMenu?: boolean;
|
9
|
+
showAllMdWhere?: boolean;
|
10
|
+
isOpenDistinctValuesPanel: boolean;
|
11
|
+
onQdChanged?: (qd: QueryDescriptor) => void;
|
12
|
+
onFocusedMetadataChanged?: (tid_mid: TID_MID | undefined) => void;
|
13
|
+
}
|
14
|
+
declare const TMSearchQueryEditor: React.FunctionComponent<ITMSearchQueryEditorProps>;
|
15
|
+
export default TMSearchQueryEditor;
|