@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,296 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
+
import { useEffect, useState } from 'react';
|
3
|
+
import { PlatformObjectValidator, WhereItem, SDK_Localizator, OrderByItem, SelectItem, SelectItemVisibilities, SDK_Globals, SystemMIDsAsNumber, SavedQueryCacheService, SearchEngine, QueryOperators } from '@topconsultnpm/sdk-ts-beta';
|
4
|
+
import styled from 'styled-components';
|
5
|
+
import TMSearchQueryEditor from './TMSearchQueryEditor';
|
6
|
+
import Logo from '../../assets/Toppy-generico.png';
|
7
|
+
import { getDcmtTypesByQdAsync, SDKUI_Localizator, getQD, IconMenuVertical, IconAddCircleOutline, IconEdit, IconArchiveDoc, IconEasy, IconAdvanced, IconHide, IconShow, deepCompare, IconSearch, IconClear, getDefaultOperator, prepareQdForSearchAsync, IsParametricQuery } from '../../../helper';
|
8
|
+
import { useQueryParametersDialog } from '../../../hooks/useQueryParametersDialog';
|
9
|
+
import { FormModes } from '../../../ts';
|
10
|
+
import { TMColors } from '../../../utils/theme';
|
11
|
+
import { StyledModalContainer } from '../../base/Styled';
|
12
|
+
import ShowAlert from '../../base/TMAlert';
|
13
|
+
import TMButton from '../../base/TMButton';
|
14
|
+
import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
|
15
|
+
import TMDropDownMenu from '../../base/TMDropDownMenu';
|
16
|
+
import TMLayoutContainer, { 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 TMDistinctValues from '../../choosers/TMDistinctValues';
|
21
|
+
import { TMMetadataChooserForm } from '../../choosers/TMMetadataChooser';
|
22
|
+
import TMQueryEditor from '../../query/TMQueryEditor';
|
23
|
+
import TMSavedQueryForm from './TMSavedQueryForm';
|
24
|
+
const TMSearchQueryPanel = ({ fromDTD, rightSidebarItems, isOpenDistinctValuesPanel = false, SQD, onRightSidebarItemClick, onSearchCompleted, onFocusedMetadataChanged, onCloseDistinctValuesPanel, onSqdSaved }) => {
|
25
|
+
const [confirmQueryParams, ConfirmQueryParamsDialog] = useQueryParametersDialog();
|
26
|
+
const [qd, setQd] = useState();
|
27
|
+
const [lastQdParams, setLastQdParams] = useState([]);
|
28
|
+
const [dcmtTypesList, setDcmtTypesList] = useState([]);
|
29
|
+
const [showSqdForm, setShowSqdForm] = useState(false);
|
30
|
+
const [formModeSqdForm, setFormModeSqdForm] = useState(FormModes.Update);
|
31
|
+
const [showAdvancedMenu, setShowAdvancedMenu] = useState(false);
|
32
|
+
const [showAllMdWhere, setShowAllMdWhere] = useState(false);
|
33
|
+
const [showAdvancedSearch, setShowAdvancedSearch] = useState(false);
|
34
|
+
const [showFiltersConfig, setShowFiltersConfig] = useState(false);
|
35
|
+
const [showOutputConfig, setShowOutputConfig] = useState(false);
|
36
|
+
const [showOrderByConfig, setShowOrderByConfig] = useState(false);
|
37
|
+
const [focusedTidMid, setFocusedTidMid] = useState();
|
38
|
+
const deviceType = useDeviceType();
|
39
|
+
let initialMaxItems = deviceType === DeviceType.MOBILE ? 8 : 12;
|
40
|
+
useEffect(() => {
|
41
|
+
if (!SQD)
|
42
|
+
return;
|
43
|
+
setDataAsync(SQD);
|
44
|
+
}, [SQD]);
|
45
|
+
useEffect(() => { onFocusedMetadataChanged?.(focusedTidMid); }, [focusedTidMid]);
|
46
|
+
const setDataAsync = async (sqd) => {
|
47
|
+
let newSqd = (sqd?.id == 1) ? sqd : await SavedQueryCacheService.GetAsync(sqd?.id);
|
48
|
+
let newQd = SearchEngine.NormalizeQueryDescriptor(newSqd?.qd);
|
49
|
+
setQd(newQd);
|
50
|
+
if (newQd)
|
51
|
+
getDcmtTypesByQdAsync(newQd).then((dtdl) => setDcmtTypesList(dtdl)).catch((err) => { TMExceptionBoxManager.show({ exception: err }); });
|
52
|
+
setLastQdParams([]);
|
53
|
+
if (newSqd?.runSearchWhenSelected == 1)
|
54
|
+
await searchAsync?.(newQd, newSqd?.isEasyWhere != 1);
|
55
|
+
setShowAdvancedSearch(newSqd?.isEasyWhere != 1);
|
56
|
+
};
|
57
|
+
const clearFilters = () => {
|
58
|
+
const newWhere = qd?.where?.map((curItem, curIndex) => {
|
59
|
+
let newWi = new WhereItem();
|
60
|
+
newWi.init({ ...curItem, value1: undefined, value2: undefined });
|
61
|
+
return newWi;
|
62
|
+
});
|
63
|
+
setQd({ ...qd, where: newWhere });
|
64
|
+
};
|
65
|
+
const searchAsync = async (qdInput, isAdvancedSearch) => {
|
66
|
+
let searchParams = { isAdvancedSearch: isAdvancedSearch, lastQdParams: lastQdParams, confirmQueryParams: confirmQueryParams, setLastQdParamsCallback: setLastQdParams };
|
67
|
+
let searchResult = await searchByQdAsync(qdInput, searchParams);
|
68
|
+
let dcmtsFound = searchResult?.result?.dcmtsFound ?? 0;
|
69
|
+
if (dcmtsFound <= 0)
|
70
|
+
ShowAlert({ message: SDKUI_Localizator.NoDcmtFound, mode: 'info', title: SDKUI_Localizator.SearchResult, duration: 3000 });
|
71
|
+
else {
|
72
|
+
let results = [];
|
73
|
+
if (searchResult?.result)
|
74
|
+
results.push(searchResult?.result);
|
75
|
+
onSearchCompleted?.(results, searchResult?.qd);
|
76
|
+
}
|
77
|
+
};
|
78
|
+
const openSqdForm = (formMode) => { setFormModeSqdForm(formMode); setShowSqdForm(true); };
|
79
|
+
const changeAdvancedSearchAsync = async (show) => {
|
80
|
+
setShowAdvancedSearch(show);
|
81
|
+
if (show)
|
82
|
+
setQd({ ...qd, where: qd?.where?.filter(o => PlatformObjectValidator.WhereItemHasValues(o)) });
|
83
|
+
else {
|
84
|
+
let qdEasy = SQD?.qd ?? await getQD(fromDTD?.id, false);
|
85
|
+
if (qdEasy && qd?.where) {
|
86
|
+
for (const wi of qd.where) {
|
87
|
+
let wiEasy = qdEasy.where?.find(o => o.mid == wi.mid);
|
88
|
+
if (wiEasy) {
|
89
|
+
wiEasy.or = false;
|
90
|
+
wiEasy.leftBrackets = "(";
|
91
|
+
wiEasy.operator = wi.operator;
|
92
|
+
wiEasy.value1 = wi.value1;
|
93
|
+
wiEasy.value2 = wi.value2;
|
94
|
+
wiEasy.rightBrackets = ")";
|
95
|
+
}
|
96
|
+
}
|
97
|
+
setQd({ ...qd, where: qdEasy?.where });
|
98
|
+
}
|
99
|
+
}
|
100
|
+
};
|
101
|
+
return (_jsxs(TMSplitterLayout, { direction: 'horizontal', showSeparator: deviceType !== DeviceType.MOBILE && isOpenDistinctValuesPanel, separatorSize: 8, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: deviceType === DeviceType.MOBILE ? ['100%', '0%'] : (isOpenDistinctValuesPanel ? ['55%', '45%'] : ['100%', '0%']), children: [_jsxs(TMToolbarCard, { title: fromDTD?.nameLoc ?? SDKUI_Localizator.Search_Metadata, items: rightSidebarItems, onItemClick: onRightSidebarItemClick,
|
102
|
+
// onBack={deviceType !== DeviceType.DESKTOP ? () => { setCurrentTID(0) } : undefined}
|
103
|
+
toolbar: _jsx(_Fragment, { children: (SQD && !showSqdForm) ?
|
104
|
+
_jsx(TMDropDownMenu, { backgroundColor: 'white', borderRadius: '3px', content: _jsx(TMButton, { btnStyle: 'icon', caption: 'Altro', icon: _jsx(IconMenuVertical, { color: 'white' }), showTooltip: false }), items: [
|
105
|
+
{ icon: _jsx(IconAddCircleOutline, {}), text: SDKUI_Localizator.SavedQueryNew, onClick: () => { openSqdForm(FormModes.Create); } },
|
106
|
+
{ icon: _jsx(IconEdit, {}), text: SDKUI_Localizator.SavedQueryUpdate, disabled: (SQD && SQD.id == 1), onClick: () => { openSqdForm(FormModes.Update); } },
|
107
|
+
{ icon: _jsx(IconArchiveDoc, {}), beginGroup: true, text: "Passa ad archiviazione", onClick: () => ShowAlert({ message: "TODO", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
|
108
|
+
{ icon: showAdvancedSearch ? _jsx(IconEasy, {}) : _jsx(IconAdvanced, {}), text: showAdvancedSearch ? SDKUI_Localizator.Search_Easy : SDKUI_Localizator.Search_Advanced, onClick: () => { changeAdvancedSearchAsync(!showAdvancedSearch); } },
|
109
|
+
{ icon: _jsx(IconEdit, {}), beginGroup: true, text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryWhere}`, onClick: () => { setShowFiltersConfig(true); } },
|
110
|
+
{ icon: _jsx(IconEdit, {}), text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QuerySelect}`, onClick: () => { setShowOutputConfig(true); } },
|
111
|
+
{ icon: _jsx(IconEdit, {}), text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryOrderBy}`, onClick: () => { setShowOrderByConfig(true); } },
|
112
|
+
{ icon: showAdvancedMenu ? _jsx(IconHide, {}) : _jsx(IconShow, {}), beginGroup: true, operationType: 'singleRow', text: showAdvancedMenu ? SDKUI_Localizator.StandardMode : SDKUI_Localizator.ExpertMode, onClick: () => setShowAdvancedMenu(!showAdvancedMenu) },
|
113
|
+
] })
|
114
|
+
: _jsx(_Fragment, {}) }), children: [_jsx(ConfirmQueryParamsDialog, {}), SQD
|
115
|
+
? _jsxs("div", { style: { height: '100%', width: '100%', position: 'relative', display: 'flex', flexDirection: 'column', gap: 5 }, children: [showAdvancedSearch
|
116
|
+
? _jsx(TMQueryEditor, { formMode: FormModes.Update, showToolbar: false, inputData: qd, validateSelect: true, showApply: false, onQDChanged: (newQd) => { if (!deepCompare(qd, newQd))
|
117
|
+
setQd(newQd); } })
|
118
|
+
: _jsx(TMSearchQueryEditor, { qd: qd, fromDTD: fromDTD, dcmtTypesList: dcmtTypesList, isOpenDistinctValuesPanel: isOpenDistinctValuesPanel, showAdvancedMenu: showAdvancedMenu, showAllMdWhere: showAllMdWhere, onFocusedMetadataChanged: setFocusedTidMid, onQdChanged: (newQd) => { if (!deepCompare(qd, newQd))
|
119
|
+
setQd(newQd); } }), _jsxs("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '80px', padding: '15px', position: 'relative' }, children: [_jsxs("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '8px' }, children: [_jsx(TMButton, { btnStyle: 'advanced', icon: _jsx(IconSearch, {}), showTooltip: false, caption: SDKUI_Localizator.Search, onClick: async () => await searchAsync(qd, showAdvancedSearch), advancedColor: '#f09c0a' }), _jsx(TMButton, { btnStyle: 'advanced', showTooltip: false, caption: SDKUI_Localizator.Clear, icon: _jsx(IconClear, {}), advancedColor: TMColors.primaryColor, onClick: clearFilters })] }), (!showAdvancedSearch && qd?.where && qd?.where?.length > initialMaxItems) && _jsx(TMButton, { elementStyle: { position: 'absolute', right: '10px' }, btnStyle: 'icon', caption: showAllMdWhere ? "Mostra meno" : `Mostra tutti i metadati (+${qd?.where?.length - initialMaxItems})`, icon: showAllMdWhere ?
|
120
|
+
_jsx("div", { style: { backgroundColor: TMColors.primaryColor, minWidth: '30px', minHeight: '30px', borderRadius: '10px', display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: _jsx("p", { style: { color: 'white' }, children: `-${qd?.where?.length - initialMaxItems}` }) }) :
|
121
|
+
_jsx("div", { style: { backgroundColor: TMColors.primaryColor, minWidth: '30px', minHeight: '30px', borderRadius: '10px', display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: _jsx("p", { style: { color: 'white' }, children: `+${qd?.where?.length - initialMaxItems}` }) }), onClick: () => setShowAllMdWhere(!showAllMdWhere) })] }), showFiltersConfig &&
|
122
|
+
_jsx(TMMetadataChooserForm, { allowMultipleSelection: true, height: '500px', width: '600px', allowSysMetadata: true, qd: qd, selectedIDs: qd?.where?.map((w) => ({ tid: w.tid, mid: w.mid })), onClose: () => setShowFiltersConfig(false), onChoose: (tid_mids) => {
|
123
|
+
if (!fromDTD?.metadata)
|
124
|
+
return;
|
125
|
+
if (!tid_mids)
|
126
|
+
return;
|
127
|
+
// copia dei whereItem senza i rimossi
|
128
|
+
let newWhere = qd?.where?.filter(wi => tid_mids?.some(tm => tm.mid == wi.mid)) ?? [];
|
129
|
+
// aggiungiamo i nuovi
|
130
|
+
for (const tm of tid_mids.filter(tm => !qd?.where?.some(wi => wi.mid == tm.mid))) {
|
131
|
+
let md = fromDTD?.metadata.find(o => o.id == tm.mid);
|
132
|
+
let wi = new WhereItem();
|
133
|
+
wi.or = false;
|
134
|
+
wi.leftBrackets = "(";
|
135
|
+
wi.tid = SQD.masterTID;
|
136
|
+
wi.mid = tm.mid;
|
137
|
+
wi.operator = getDefaultOperator(md?.dataDomain, md?.dataType);
|
138
|
+
wi.rightBrackets = ")";
|
139
|
+
let indexMD = 0;
|
140
|
+
for (const m of fromDTD?.metadata ?? []) {
|
141
|
+
if (m.id == wi.mid)
|
142
|
+
break;
|
143
|
+
if (newWhere.findIndex(o => o.mid == m.id && o.tid == SQD.masterTID) < 0)
|
144
|
+
continue;
|
145
|
+
indexMD++;
|
146
|
+
}
|
147
|
+
newWhere.splice(indexMD, 0, wi);
|
148
|
+
}
|
149
|
+
setQd({ ...qd, where: newWhere });
|
150
|
+
} }), showOutputConfig &&
|
151
|
+
_jsx(TMMetadataChooserForm, { allowMultipleSelection: true, height: '500px', width: '600px', allowSysMetadata: true, qd: qd, selectedIDs: qd?.select?.map((item) => ({ tid: item.tid, mid: item.mid })), onClose: () => setShowOutputConfig(false), onChoose: (tid_mids) => {
|
152
|
+
if (!fromDTD?.metadata)
|
153
|
+
return;
|
154
|
+
if (!tid_mids)
|
155
|
+
return;
|
156
|
+
// copia dei SelectItems senza i rimossi
|
157
|
+
let newSelect = qd?.select?.filter(item => tid_mids?.some(tm => tm.mid == item.mid)) ?? [];
|
158
|
+
// aggiungiamo i nuovi
|
159
|
+
for (const tm of tid_mids.filter(tm => !qd?.select?.some(item => item.mid == tm.mid))) {
|
160
|
+
let md = fromDTD?.metadata.find(o => o.id == tm.mid);
|
161
|
+
let si = new SelectItem();
|
162
|
+
si.visibility = SelectItemVisibilities.Visible;
|
163
|
+
si.tid = SQD.masterTID;
|
164
|
+
si.mid = md?.id;
|
165
|
+
let indexMD = 0;
|
166
|
+
for (const m of fromDTD?.metadata ?? []) {
|
167
|
+
if (m.id == si.mid)
|
168
|
+
break;
|
169
|
+
if (newSelect.findIndex(o => o.mid == m.id && o.tid == SQD.masterTID) < 0)
|
170
|
+
continue;
|
171
|
+
indexMD++;
|
172
|
+
}
|
173
|
+
newSelect.splice(indexMD, 0, si);
|
174
|
+
}
|
175
|
+
setQd({ ...qd, select: newSelect });
|
176
|
+
} }), showOrderByConfig &&
|
177
|
+
_jsx(TMMetadataChooserForm, { allowMultipleSelection: true, height: '500px', width: '600px', allowSysMetadata: true, qd: qd, selectedIDs: qd?.orderBy?.map((item) => ({ tid: item.tid, mid: item.mid })), onClose: () => setShowOrderByConfig(false), onChoose: (tid_mids) => {
|
178
|
+
if (!fromDTD?.metadata)
|
179
|
+
return;
|
180
|
+
if (!tid_mids)
|
181
|
+
return;
|
182
|
+
// copia dei OrderByItems senza i rimossi
|
183
|
+
let newOrderBy = qd?.orderBy?.filter(item => tid_mids?.some(tm => tm.mid == item.mid)) ?? [];
|
184
|
+
// aggiungiamo i nuovi
|
185
|
+
for (const tm of tid_mids.filter(tm => !qd?.orderBy?.some(item => item.mid == tm.mid))) {
|
186
|
+
let md = fromDTD?.metadata.find(o => o.id == tm.mid);
|
187
|
+
let oi = new OrderByItem();
|
188
|
+
oi.tid = SQD.masterTID;
|
189
|
+
oi.mid = md?.id;
|
190
|
+
oi.asc = true;
|
191
|
+
newOrderBy.push(oi);
|
192
|
+
}
|
193
|
+
setQd({ ...qd, orderBy: newOrderBy });
|
194
|
+
} })] })
|
195
|
+
:
|
196
|
+
_jsxs(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: [_jsxs(TMLayoutItem, { width: 'max-content', height: 'max-content', children: [" ", _jsxs(StyledToppyTextContainer, { children: [" ", _jsxs(StyledToppyText, { children: [" ", 'Selezionare un tipo documento o ricerca rapida', " "] }), " "] }), " "] }), _jsxs(TMLayoutItem, { width: 'max-content', height: 'max-content', children: [" ", _jsx("img", { src: Logo, width: 120, alt: '' }), " "] })] }), showSqdForm &&
|
197
|
+
_jsx(StyledModalContainer, { style: { backgroundColor: `${TMColors.backgroundColorHeader}12` }, children: _jsx(TMSavedQueryForm, { height: '50%', width: '50%', id: formModeSqdForm === FormModes.Create ? -1 : SQD?.id, title: 'Ricerca rapida', formMode: formModeSqdForm, showBackButton: true, qd: qd, isAdvancedSearch: showAdvancedSearch, isModal: false, onClose: () => { setShowSqdForm(false); }, onSaved: onSqdSaved }) })] }), _jsx(TMDistinctValues, { tid: focusedTidMid?.tid, mid: focusedTidMid?.mid, separator: ',', onClosePanelCallback: onCloseDistinctValuesPanel, onSelectionChanged: (e) => {
|
198
|
+
if (!e)
|
199
|
+
return;
|
200
|
+
let wi = qd?.where?.find(o => o.tid === focusedTidMid?.tid && o.mid === focusedTidMid?.mid);
|
201
|
+
if (!wi)
|
202
|
+
return;
|
203
|
+
wi.value1 = e.newValue;
|
204
|
+
let md = fromDTD?.metadata?.find(o => o.id === focusedTidMid?.mid);
|
205
|
+
wi.operator = e.isAppendMode ? QueryOperators.In : getDefaultOperator(md?.dataDomain, md?.dataType);
|
206
|
+
const whereCopy = qd?.where?.map((curItem) => {
|
207
|
+
if (curItem.mid != wi.mid)
|
208
|
+
return curItem;
|
209
|
+
return wi;
|
210
|
+
});
|
211
|
+
setQd({ ...qd, where: whereCopy });
|
212
|
+
} })] }));
|
213
|
+
};
|
214
|
+
export default TMSearchQueryPanel;
|
215
|
+
const searchByQdAsync = async (qdInput, searchParams) => {
|
216
|
+
let result;
|
217
|
+
let qdSearch;
|
218
|
+
try {
|
219
|
+
qdSearch = await prepareQdForSearchAsync(qdInput);
|
220
|
+
let fromTID = qdSearch?.from?.tid;
|
221
|
+
// In modalità easy rimuovi filtri non valorizzati
|
222
|
+
if (!searchParams.isAdvancedSearch) {
|
223
|
+
qdSearch.where = qdSearch?.where?.filter(o => PlatformObjectValidator.WhereItemHasValues(o));
|
224
|
+
qdSearch.where?.forEach(o => o.or = false); // props.easyOr
|
225
|
+
}
|
226
|
+
qdSearch.select?.forEach(o => { o.visibility ??= SelectItemVisibilities.Visible; });
|
227
|
+
if (qdSearch.orderBy && qdSearch.orderBy.length <= 0) {
|
228
|
+
let obi = new OrderByItem();
|
229
|
+
obi.tid = fromTID;
|
230
|
+
obi.mid = SystemMIDsAsNumber.DID;
|
231
|
+
obi.asc = false;
|
232
|
+
qdSearch.orderBy.push(obi);
|
233
|
+
}
|
234
|
+
if (IsParametricQuery(qdSearch)) {
|
235
|
+
const qdParams = await searchParams.confirmQueryParams?.(qdSearch, searchParams.lastQdParams) ?? [];
|
236
|
+
searchParams.setLastQdParamsCallback?.(qdParams);
|
237
|
+
if (!qdParams || qdParams.length <= 0)
|
238
|
+
return;
|
239
|
+
for (const qpd of qdParams) {
|
240
|
+
let wi = qdSearch.where?.find(o => o.value1 == qpd.name);
|
241
|
+
if (wi)
|
242
|
+
wi.value1 = wi.value1?.replace(wi.value1, !qpd.value ? '' : qpd.value.toString());
|
243
|
+
else {
|
244
|
+
wi = qdSearch.where?.find(o => o.value2 == qpd.name);
|
245
|
+
if (wi)
|
246
|
+
wi.value2 = wi.value2?.replace(wi.value2, !qpd.value ? '' : qpd.value.toString());
|
247
|
+
}
|
248
|
+
}
|
249
|
+
}
|
250
|
+
TMSpinner.show({ description: `${SDKUI_Localizator.Search} ...`, backgroundColor: 'transparent' });
|
251
|
+
result = await SDK_Globals.tmSession?.NewSearchEngine().SearchByIDAsync(qdSearch);
|
252
|
+
}
|
253
|
+
catch (ex) {
|
254
|
+
TMExceptionBoxManager.show({ title: SDKUI_Localizator.Search, exception: ex });
|
255
|
+
}
|
256
|
+
finally {
|
257
|
+
TMSpinner.hide();
|
258
|
+
}
|
259
|
+
return { result: result, qd: qdSearch };
|
260
|
+
};
|
261
|
+
export const refreshLastSearch = async (qd) => {
|
262
|
+
if (!qd)
|
263
|
+
return;
|
264
|
+
let searchResults = [];
|
265
|
+
try {
|
266
|
+
TMSpinner.show({ description: `${SDKUI_Localizator.Search} ...`, backgroundColor: 'transparent' });
|
267
|
+
let result = await SDK_Globals.tmSession?.NewSearchEngine().SearchByIDAsync(qd);
|
268
|
+
let dcmtsFound = result?.dcmtsFound ?? 0;
|
269
|
+
if (dcmtsFound <= 0)
|
270
|
+
ShowAlert({ message: SDKUI_Localizator.NoDcmtFound, mode: 'info', title: SDKUI_Localizator.SearchResult, duration: 3000 });
|
271
|
+
else if (result)
|
272
|
+
searchResults.push(result);
|
273
|
+
}
|
274
|
+
catch (ex) {
|
275
|
+
TMExceptionBoxManager.show({ title: SDKUI_Localizator.Search, exception: ex });
|
276
|
+
}
|
277
|
+
finally {
|
278
|
+
TMSpinner.hide();
|
279
|
+
}
|
280
|
+
return searchResults;
|
281
|
+
};
|
282
|
+
export const StyledToppyTextContainer = styled.div `
|
283
|
+
padding: 30px 50px;
|
284
|
+
max-width: 345px;
|
285
|
+
border: 1px solid #8D2F88;
|
286
|
+
border-radius: 30px;
|
287
|
+
display: flex;
|
288
|
+
align-items: center;
|
289
|
+
justify-content: center;
|
290
|
+
`;
|
291
|
+
export const StyledToppyText = styled.p `
|
292
|
+
text-align: center;
|
293
|
+
color: #8d2f88;
|
294
|
+
font-size: 30px;
|
295
|
+
user-select: none;
|
296
|
+
`;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { SearchResultDescriptor } from '@topconsultnpm/sdk-ts-beta';
|
3
|
-
import { SearchResultContext } from '
|
3
|
+
import { SearchResultContext, TaskContext } from '../../../ts';
|
4
4
|
interface ITMSearchResultProps {
|
5
5
|
context?: SearchResultContext;
|
6
6
|
title?: string;
|
@@ -21,11 +21,7 @@ interface ITMSearchResultProps {
|
|
21
21
|
onRefreshSearchAsync?: () => Promise<void>;
|
22
22
|
onRefreshAfterAddDcmtToFavs?: () => void;
|
23
23
|
onClosePreview?: () => void;
|
24
|
-
onTaskCreateRequest?: (
|
25
|
-
tid: number;
|
26
|
-
did: number;
|
27
|
-
name: string;
|
28
|
-
} | undefined) => void;
|
24
|
+
onTaskCreateRequest?: (taskContext: TaskContext | undefined) => void;
|
29
25
|
}
|
30
26
|
declare const TMSearchResult: React.FC<ITMSearchResultProps>;
|
31
27
|
export default TMSearchResult;
|
@@ -4,36 +4,36 @@ import { SDK_Globals, DataColumnTypes, MetadataDataDomains, DataListViewModes, M
|
|
4
4
|
import styled from 'styled-components';
|
5
5
|
import { commandsMenuItems, getSelectedDcmtsOrFocused } from './TMSearchResultsMenuItems';
|
6
6
|
import { ContextMenu } from 'devextreme-react';
|
7
|
-
import { genUniqueId, IconShow, IconBoard, IconDcmtTypeSys, IconDetailDcmts, SDKUI_Localizator, IconTag, IconDetails, IconCommand, IconDelete, IconRefresh, IconMenuVertical, IconDownload, IconSignature, IconSave, deepCompare, getDataColumnName, searchResultDescriptorToSimpleArray, SDKUI_Globals, IconArchive, IconActivityLog, IconStar, IconFreeSearch, IconChevronDown, searchResultToMetadataValues } from '
|
8
|
-
import { useDcmtOperations } from '
|
9
|
-
import { useInputCvtFormatDialog } from '
|
10
|
-
import { DcmtOperationTypes, FormModes, SearchResultContext } from '
|
11
|
-
import { TMColors } from '
|
12
|
-
import { StyledModalContainer, StyledBadge, StyledMultiViewPanel } from '
|
13
|
-
import ShowAlert from '
|
14
|
-
import TMButton from '
|
15
|
-
import TMDataGrid, { TMDataGridPageSize } from '
|
16
|
-
import { useDeviceType, DeviceType } from '
|
17
|
-
import { TMSplitterLayout, TMLayoutItem } from '
|
18
|
-
import { CustomListViewHeader } from '
|
19
|
-
import { TMMessageBoxManager, ButtonNames } from '
|
20
|
-
import TMToolbarCard from '
|
21
|
-
import TMTooltip from '
|
22
|
-
import { TMLayoutWaitingContainer } from '
|
23
|
-
import { TMUserIdViewer } from '
|
24
|
-
import TMMetadataValues from '
|
25
|
-
import { TMSaveFormButtonPrevious, TMSaveFormButtonNext } from '
|
26
|
-
import TMDataListItemViewer from '
|
27
|
-
import TMTidViewer from '
|
28
|
-
import
|
29
|
-
import {
|
30
|
-
import
|
31
|
-
import
|
32
|
-
import
|
33
|
-
import
|
34
|
-
import
|
35
|
-
import
|
36
|
-
import
|
7
|
+
import { genUniqueId, IconShow, IconBoard, IconDcmtTypeSys, IconDetailDcmts, SDKUI_Localizator, IconTag, IconDetails, IconCommand, IconDelete, IconRefresh, IconMenuVertical, IconDownload, IconSignature, IconSave, deepCompare, getDataColumnName, searchResultDescriptorToSimpleArray, SDKUI_Globals, IconArchive, IconActivityLog, IconStar, IconFreeSearch, IconChevronDown, searchResultToMetadataValues } from '../../../helper';
|
8
|
+
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
9
|
+
import { useInputCvtFormatDialog } from '../../../hooks/useInputDialog';
|
10
|
+
import { DcmtOperationTypes, FormModes, SearchResultContext } from '../../../ts';
|
11
|
+
import { TMColors } from '../../../utils/theme';
|
12
|
+
import { StyledModalContainer, StyledBadge, StyledMultiViewPanel } from '../../base/Styled';
|
13
|
+
import ShowAlert from '../../base/TMAlert';
|
14
|
+
import TMButton from '../../base/TMButton';
|
15
|
+
import TMDataGrid, { TMDataGridPageSize } from '../../base/TMDataGrid';
|
16
|
+
import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
|
17
|
+
import { TMSplitterLayout, TMLayoutItem } from '../../base/TMLayout';
|
18
|
+
import { CustomListViewHeader } from '../../base/TMListView';
|
19
|
+
import { TMMessageBoxManager, ButtonNames } from '../../base/TMPopUp';
|
20
|
+
import TMToolbarCard from '../../base/TMToolbarCard';
|
21
|
+
import TMTooltip from '../../base/TMTooltip';
|
22
|
+
import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
|
23
|
+
import { TMUserIdViewer } from '../../choosers/TMUserChooser';
|
24
|
+
import TMMetadataValues from '../../editors/TMMetadataValues';
|
25
|
+
import { TMSaveFormButtonPrevious, TMSaveFormButtonNext } from '../../forms/TMSaveForm';
|
26
|
+
import TMDataListItemViewer from '../../viewers/TMDataListItemViewer';
|
27
|
+
import TMTidViewer from '../../viewers/TMTidViewer';
|
28
|
+
import { hasDetailRelations, hasMasterRelations } from '../../../helper/dcmtsHelper';
|
29
|
+
import TMDcmtPreview, { TMNothingToShow } from '../documents/TMDcmtPreview';
|
30
|
+
import TMFloatingToolbar from '../../base/TMFloatingToolbar';
|
31
|
+
import { WorkFlowApproveRejectPopUp, WorkFlowOperationButtons, WorkFlowReAssignPopUp } from '../workflow/TMWorkflowPopup';
|
32
|
+
import TMMasterDetailDcmts from '../documents/TMMasterDetailDcmts';
|
33
|
+
import TMBatchUpdateForm from '../../features/documents/TMBatchUpdateForm';
|
34
|
+
import TMDcmtForm from '../documents/TMDcmtForm';
|
35
|
+
import TMDcmtBlog from '../documents/TMDcmtBlog';
|
36
|
+
import TMDcmtIcon from '../documents/TMDcmtIcon';
|
37
37
|
//#endregion region Interfaces, Types and Enums
|
38
38
|
//#region Styled Components
|
39
39
|
const StyledContainer = styled.div ` overflow: hidden; background-color: #ffffff; width: calc(100%); height: calc(100%); display: flex; gap: 10px; `;
|
@@ -156,7 +156,7 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
156
156
|
const dtd = await DcmtTypeListCacheService.GetAsync(item.TID);
|
157
157
|
if (dtd) {
|
158
158
|
const name = `${dtd.name ?? '-'} (DID: ${item.DID})`;
|
159
|
-
onTaskCreateRequest?.({ tid: item.TID, did: item.DID, name });
|
159
|
+
onTaskCreateRequest?.({ document: { tid: item.TID, did: item.DID, name } });
|
160
160
|
}
|
161
161
|
}
|
162
162
|
catch (error) {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { DcmtTypeDescriptor, FileFormats, LayoutModes, RecentCategories } from '@topconsultnpm/sdk-ts-beta';
|
3
|
-
import { TMDataGridContextMenuItem } from '
|
4
|
-
import { DcmtInfo, DcmtOperationTypes, SearchResultContext } from '
|
3
|
+
import { TMDataGridContextMenuItem } from '../../base/TMDataGrid';
|
4
|
+
import { DcmtInfo, DcmtOperationTypes, SearchResultContext } from '../../../ts';
|
5
5
|
export declare const getSelectedDcmtsOrFocused: (selectedItems: Array<any>, focusedItem: any, category?: RecentCategories, fileFormat?: FileFormats) => DcmtInfo[];
|
6
6
|
export declare const commandsMenuItems: (dtd: DcmtTypeDescriptor | undefined, selectedItems: Array<any>, focusedItem: any, context: SearchResultContext, showFloatingBar: boolean, setShowFloatingBar: React.Dispatch<React.SetStateAction<boolean>>, openFormHandler: (layoutMode: LayoutModes) => void, downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined) => Promise<void>, runOperationAsync: (inputDcmts: DcmtInfo[] | undefined, dcmtOperationType: DcmtOperationTypes, actionAfterOperationAsync?: () => Promise<void>) => Promise<void>, onRefreshSearchAsync: (() => Promise<void>) | undefined, onRefreshDataRowsAsync: (() => Promise<void>) | undefined, onRefreshAfterAddDcmtToFavs: (() => void) | undefined, confirmFormat: () => Promise<FileFormats>, openTaskFormHandler: (value: boolean) => void, openDetailDcmtsFormHandler: (value: boolean) => void, openMasterDcmtsFormHandler: (value: boolean) => void, openBatchUpdateFormHandler: (value: boolean) => void, fromDatagrid: boolean, showDetailDcmts: boolean) => Array<TMDataGridContextMenuItem>;
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { AccessLevels, AccessLevelsEx, FileFormats, LayoutModes, SDK_Globals } from '@topconsultnpm/sdk-ts-beta';
|
3
|
-
import { IconActivity, IconArchiveDoc, IconBatchUpdate, IconCheckFile, IconCheckIn, IconCloseCircle, IconConvertFilePdf, IconDelete, IconDotsVerticalCircleOutline, IconDownload, IconExportTo, IconFileDots, IconHide, IconInfo, IconPreview, IconRelation, IconSave, IconSearch, IconShare, IconSharedDcmt, IconShow, IconSignature, IconStar, IconSubstFile, IconUndo, SDKUI_Localizator, svgToString } from '
|
4
|
-
import ShowAlert from '
|
5
|
-
import { TMMessageBoxManager, ButtonNames, TMExceptionBoxManager } from '
|
6
|
-
import TMSpinner from '
|
7
|
-
import { DcmtOperationTypes, SearchResultContext } from '
|
3
|
+
import { IconActivity, IconArchiveDoc, IconBatchUpdate, IconCheckFile, IconCheckIn, IconCloseCircle, IconConvertFilePdf, IconDelete, IconDotsVerticalCircleOutline, IconDownload, IconExportTo, IconFileDots, IconHide, IconInfo, IconPreview, IconRelation, IconSave, IconSearch, IconShare, IconSharedDcmt, IconShow, IconSignature, IconStar, IconSubstFile, IconUndo, SDKUI_Localizator, svgToString } from '../../../helper';
|
4
|
+
import ShowAlert from '../../base/TMAlert';
|
5
|
+
import { TMMessageBoxManager, ButtonNames, TMExceptionBoxManager } from '../../base/TMPopUp';
|
6
|
+
import TMSpinner from '../../base/TMSpinner';
|
7
|
+
import { DcmtOperationTypes, SearchResultContext } from '../../../ts';
|
8
8
|
const disabledForSingleRow = (selectedItems, focusedItem) => {
|
9
9
|
return selectedItems.length > 1 || focusedItem === undefined;
|
10
10
|
};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { LayoutModes } from '@topconsultnpm/sdk-ts-beta';
|
3
|
+
interface ITMTreeSelectorProps {
|
4
|
+
layoutMode?: LayoutModes;
|
5
|
+
onSelectedTIDChanged?: (tid: number | undefined, treeId?: number | undefined) => void;
|
6
|
+
onClose?: () => void;
|
7
|
+
}
|
8
|
+
declare const TMTreeSelector: React.FC<ITMTreeSelectorProps>;
|
9
|
+
export default TMTreeSelector;
|
@@ -0,0 +1,125 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useCallback, useEffect, useState } from 'react';
|
3
|
+
import { LayoutModes, LocalStorageService, SDK_Globals, SDK_Localizator, TreeCacheService, TreeItemTypes } from '@topconsultnpm/sdk-ts-beta';
|
4
|
+
import { TreeList, Column, Scrolling, Selection } from 'devextreme-react/tree-list';
|
5
|
+
import { DropDownBox } from 'devextreme-react';
|
6
|
+
import { IconStarRemove, IconStar, SDKUI_Localizator, SDKUI_Globals } from '../../../helper';
|
7
|
+
import { StyledDivHorizontal } from '../../base/Styled';
|
8
|
+
import TMButton from '../../base/TMButton';
|
9
|
+
import TMDataGrid from '../../base/TMDataGrid';
|
10
|
+
import TMLayoutContainer, { TMLayoutItem } from '../../base/TMLayout';
|
11
|
+
import TMToolbarCard from '../../base/TMToolbarCard';
|
12
|
+
import TMTidViewer from '../../viewers/TMTidViewer';
|
13
|
+
const TMTreeSelector = ({ layoutMode = LayoutModes.Update, onSelectedTIDChanged, onClose }) => {
|
14
|
+
const [trees, setTrees] = useState([]);
|
15
|
+
const [treeItems, setTreeItems] = useState([]);
|
16
|
+
const [selectedTreeId, setSelectedTreeId] = useState(0);
|
17
|
+
// State to store selected row keys
|
18
|
+
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
19
|
+
// State hook to store the currently focused row key, initially set to undefined
|
20
|
+
const [focusedRowKey, setFocusedRowKey] = useState(undefined);
|
21
|
+
const [isGridBoxOpened, setIsGridBoxOpened] = useState(false);
|
22
|
+
const [defaultTreeId, setDefaultTreeId] = useState(-1);
|
23
|
+
const DEFAULT_TREE_KEY_NAME = `DEFAULT_TREE_${SDK_Globals.tmSession?.SessionDescr?.archiveID}_${SDK_Globals.tmSession?.SessionDescr?.userID}`;
|
24
|
+
useEffect(() => {
|
25
|
+
if (treeItems.length > 0 && treeItems[0].id) {
|
26
|
+
setSelectedRowKeys([treeItems[0].id]);
|
27
|
+
}
|
28
|
+
}, [treeItems]);
|
29
|
+
useEffect(() => {
|
30
|
+
const setResultCache = (result) => {
|
31
|
+
if (result && result.length > 0) {
|
32
|
+
setTrees(result);
|
33
|
+
let defaultTree = Number(LocalStorageService.getItem(DEFAULT_TREE_KEY_NAME) ?? -1);
|
34
|
+
if (defaultTree > 0) {
|
35
|
+
setDefaultTreeId(defaultTree);
|
36
|
+
setSelectedTreeId(defaultTree);
|
37
|
+
const treeItemDescriptor = result.find(o => o.id == defaultTree);
|
38
|
+
if (treeItemDescriptor?.id)
|
39
|
+
setSelectedRowKeys([treeItemDescriptor.id]);
|
40
|
+
}
|
41
|
+
else {
|
42
|
+
setSelectedTreeId(result?.[0].id ?? 0);
|
43
|
+
const treeItemDescriptor = result?.[0];
|
44
|
+
if (treeItemDescriptor?.id)
|
45
|
+
setSelectedRowKeys([treeItemDescriptor.id]);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
};
|
49
|
+
if (layoutMode == LayoutModes.Update) {
|
50
|
+
TreeCacheService.GetAllSearchAsync().then((result) => { setResultCache(result); });
|
51
|
+
}
|
52
|
+
else {
|
53
|
+
TreeCacheService.GetAllArchiveAsync().then((result) => { setResultCache(result); });
|
54
|
+
}
|
55
|
+
}, []);
|
56
|
+
useEffect(() => {
|
57
|
+
let newTreeItems = trees.find(o => o.id == selectedTreeId)?.items ?? [];
|
58
|
+
setTreeItems(newTreeItems);
|
59
|
+
}, [selectedTreeId]);
|
60
|
+
const renderCell = (data) => {
|
61
|
+
let treeItem = data.data;
|
62
|
+
if (treeItem.type == TreeItemTypes.DcmtType)
|
63
|
+
return (_jsx(TMTidViewer, { tid: treeItem.tid, showIcon: true }));
|
64
|
+
else
|
65
|
+
return (_jsxs(StyledDivHorizontal, { style: { gap: 5 }, children: [_jsx(IconFolder, { fontSize: 18 }), _jsx("p", { children: treeItem.nameLoc })] }));
|
66
|
+
};
|
67
|
+
// Handles selection change in the data grid
|
68
|
+
const onSelectionChanged = useCallback((e) => {
|
69
|
+
const selectedKeys = e.component.getSelectedRowKeys() ?? [];
|
70
|
+
if (selectedKeys.length === 0)
|
71
|
+
return;
|
72
|
+
if (selectedKeys[0] === undefined)
|
73
|
+
return;
|
74
|
+
if (selectedKeys.length > 0)
|
75
|
+
setSelectedTreeId(selectedKeys[0]);
|
76
|
+
setSelectedRowKeys(selectedKeys);
|
77
|
+
setIsGridBoxOpened(false);
|
78
|
+
}, []);
|
79
|
+
// Handles focus change in the data grid
|
80
|
+
const onFocusedRowChanged = useCallback((e) => {
|
81
|
+
setFocusedRowKey(e.row?.key);
|
82
|
+
}, []);
|
83
|
+
const syncDataGridSelection = useCallback((e) => {
|
84
|
+
const treeItemDescriptor = e.value;
|
85
|
+
if (treeItemDescriptor?.id)
|
86
|
+
setSelectedRowKeys([treeItemDescriptor.id]);
|
87
|
+
}, []);
|
88
|
+
const onGridBoxOpened = useCallback((e) => {
|
89
|
+
if (e.name === 'opened') {
|
90
|
+
setIsGridBoxOpened(e.value);
|
91
|
+
}
|
92
|
+
;
|
93
|
+
}, []);
|
94
|
+
return (_jsx(TMToolbarCard, { title: SDK_Localizator.Trees, totalItems: trees.length, onClose: onClose, toolbar: _jsx(TMButton, { btnStyle: 'icon', caption: defaultTreeId == selectedTreeId ? SDKUI_Localizator.TreeRemoveDefault : SDKUI_Localizator.SetAsDefault, icon: defaultTreeId == selectedTreeId ? _jsx(IconStarRemove, { color: 'rgb(243, 114, 92)' }) : _jsx(IconStar, { color: 'rgb(248, 215, 117)' }), onClick: () => {
|
95
|
+
if (defaultTreeId == selectedTreeId) {
|
96
|
+
LocalStorageService.deleteItem(DEFAULT_TREE_KEY_NAME);
|
97
|
+
setDefaultTreeId(-1);
|
98
|
+
}
|
99
|
+
else {
|
100
|
+
LocalStorageService.setItem(DEFAULT_TREE_KEY_NAME, selectedTreeId.toString());
|
101
|
+
setDefaultTreeId(selectedTreeId);
|
102
|
+
}
|
103
|
+
} }), children: trees.length > 0
|
104
|
+
?
|
105
|
+
_jsxs(TMLayoutContainer, { gap: 20, children: [_jsx(TMLayoutItem, { height: '30px', children: _jsx(DropDownBox, { dropDownOptions: {
|
106
|
+
resizeEnabled: true,
|
107
|
+
minWidth: "100%",
|
108
|
+
height: trees.length <= 10 ? 300 : 500,
|
109
|
+
maxWidth: "100%"
|
110
|
+
}, value: selectedTreeId, opened: isGridBoxOpened, valueExpr: "id", displayExpr: "nameLoc", deferRendering: false, dataSource: trees, onValueChanged: syncDataGridSelection, onOptionChanged: onGridBoxOpened, children: _jsx(TMDataGrid, { height: "100%", width: "100%", dataSource: trees, dataColumns: [
|
111
|
+
{ dataField: 'nameLoc', caption: SDKUI_Localizator.Name, width: 'auto' },
|
112
|
+
{ dataField: 'description', caption: SDKUI_Localizator.Description, width: 'auto' },
|
113
|
+
], selection: { mode: 'single', showCheckBoxesMode: "none" },
|
114
|
+
// scrolling={{ mode: 'virtual', useNative: SDKUI_Globals.dataGridUseNativeScrollbar }}
|
115
|
+
showRowLines: SDKUI_Globals.dataGridShowRowLines, showColumnLines: SDKUI_Globals.dataGridShowColumnLines, showHeaderFilter: false, selectedRowKeys: selectedRowKeys, onSelectionChanged: onSelectionChanged, focusedRowKey: focusedRowKey, onFocusedRowChanged: onFocusedRowChanged }) }) }), _jsx(TMLayoutItem, { height: 'calc(100% - 50px)', children: _jsxs(TreeList, { height: "100%", elementAttr: { class: 'tm-dx-treelist' }, dataSource: treeItems, showRowLines: SDKUI_Globals.dataGridShowRowLines, showColumnLines: SDKUI_Globals.dataGridShowColumnLines, showBorders: false, columnAutoWidth: true, keyExpr: "id", parentIdExpr: "parentID", dataStructure: "plain", showColumnHeaders: false, onContentReady: (e) => e.component.clearSelection(), onSelectionChanged: (e) => {
|
116
|
+
if (e.selectedRowsData[0] && e.selectedRowsData[0].type == TreeItemTypes.DcmtType) {
|
117
|
+
onSelectedTIDChanged?.(e.selectedRowsData[0].tid, selectedTreeId);
|
118
|
+
}
|
119
|
+
}, children: [_jsx(Column, { dataField: "nameLoc", caption: SDKUI_Localizator.Name, cellRender: renderCell }), _jsx(Scrolling, { mode: "virtual", useNative: SDKUI_Globals.dataGridUseNativeScrollbar }), _jsx(Selection, { mode: "single" })] }) })] })
|
120
|
+
: _jsx("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', width: '100%', fontSize: '1.5rem' }, children: SDKUI_Localizator.TreesNoAvailable }) }));
|
121
|
+
};
|
122
|
+
export default TMTreeSelector;
|
123
|
+
function IconFolder(props) {
|
124
|
+
return (_jsx("svg", { viewBox: "0 0 512 512", height: "1em", width: "1em", ...props, children: _jsx("g", { id: "Icon", children: _jsx("g", { id: "_10", children: _jsxs("g", { id: "Folder", children: [_jsx("path", { d: "m214.2 107-40.2-29.9c-9.5-7-20.9-10.8-32.7-10.8h-110.2c-16.6 0-30 13.4-30 30v349.5h404.1c15.2 0 27.4-12.3 27.4-27.4v-270.6c0-16.6-13.4-30-30-30h-155.6c-11.8 0-23.3-3.8-32.8-10.8z", fill: "#f6c012" }), _jsxs("g", { children: [_jsx("path", { d: "m76.9 143.7h300c8.3 0 15 6.7 15 15v200c0 8.3-6.7 15-15 15h-300c-8.3 0-15-6.7-15-15v-200c0-8.3 6.7-15 15-15z", fill: "#ffeac5" }), _jsx("path", { d: "m56.9 163.7h300c8.3 0 15 6.7 15 15v200c0 8.3-6.7 15-15 15h-300c-8.3 0-15-6.7-15-15v-200c0-8.3 6.7-15 15-15z", fill: "#fff7e6" })] }), _jsx("path", { d: "m85.2 220.1-84.1 225.6h410.8c12.5 0 23.7-7.8 28.1-19.5l69-185.2c7.3-19.6-7.2-40.5-28.1-40.5h-367.6c-12.5.1-23.7 7.8-28.1 19.6z", fill: "#fbd87c" })] }) }) }) }));
|
125
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { DeviceType } from "
|
1
|
+
import { DeviceType } from "../../base/TMDeviceProvider";
|
2
2
|
export declare const WorkFlowOperationButtons: ({ isInDcmtForm, deviceType, onApprove, onReAssign, onReject, approveDisable, reassignDisable, rejectDisable, infoDisable }: {
|
3
3
|
isInDcmtForm?: boolean;
|
4
4
|
onApprove?: () => void;
|
@@ -3,14 +3,14 @@ import { useMemo, useState } from "react";
|
|
3
3
|
import { SDK_Globals } from '@topconsultnpm/sdk-ts-beta';
|
4
4
|
import { Menu } from "devextreme-react";
|
5
5
|
import styled from "styled-components";
|
6
|
-
import { SDKUI_Localizator, IconApply, IconCloseOutline, IconUser, IconInfo } from "
|
7
|
-
import { TMColors } from "
|
8
|
-
import TMButton from "
|
9
|
-
import { DeviceType } from "
|
10
|
-
import TMModal from "
|
11
|
-
import { TMExceptionBoxManager } from "
|
12
|
-
import TMSpinner from "
|
13
|
-
import TMUserChooser from "
|
6
|
+
import { SDKUI_Localizator, IconApply, IconCloseOutline, IconUser, IconInfo } from "../../../helper";
|
7
|
+
import { TMColors } from "../../../utils/theme";
|
8
|
+
import TMButton from "../../base/TMButton";
|
9
|
+
import { DeviceType } from "../../base/TMDeviceProvider";
|
10
|
+
import TMModal from "../../base/TMModal";
|
11
|
+
import { TMExceptionBoxManager } from "../../base/TMPopUp";
|
12
|
+
import TMSpinner from "../../base/TMSpinner";
|
13
|
+
import TMUserChooser from "../../choosers/TMUserChooser";
|
14
14
|
const StyledWorkFlowOperationButtonsContainer = styled.div `
|
15
15
|
display: flex;
|
16
16
|
align-items: center;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { BlogPost, BlogPostAttachment, DcmtTypeDescriptor, HomeBlogPost } from "@topconsultnpm/sdk-ts-beta";
|
3
3
|
import { FileItem } from '../base/TMFileManager';
|
4
|
+
import { DcmtInfo } from '../../ts';
|
4
5
|
export declare const DRAFT_TYPE_TID = 6;
|
5
6
|
export declare const colors: {
|
6
7
|
DARK_BLUE: string;
|
@@ -71,7 +72,7 @@ export declare const AttachmentElement: (attachment: BlogPostAttachment, treeFs:
|
|
71
72
|
did: number;
|
72
73
|
fileExt: string;
|
73
74
|
fileSize: string;
|
74
|
-
}> | undefined, dcmtTypeDescriptors: Map<number, DcmtTypeDescriptor>, isSelected: boolean, searchText: string, color: string, handleClickAttachmentFolderFileCallback: ((folderId: number, draftId: number) => void) | undefined, downloadDcmtsAsync: (inputDcmts: Array<
|
75
|
+
}> | undefined, dcmtTypeDescriptors: Map<number, DcmtTypeDescriptor>, isSelected: boolean, searchText: string, color: string, handleClickAttachmentFolderFileCallback: ((folderId: number, draftId: number) => void) | undefined, downloadDcmtsAsync: (inputDcmts: Array<DcmtInfo> | undefined) => Promise<void>) => import("react/jsx-runtime").JSX.Element;
|
75
76
|
export declare const OwnerInitialsBadge: (blogPost: BlogPost | HomeBlogPost) => import("react/jsx-runtime").JSX.Element;
|
76
77
|
export declare const IconAndHeaderElement: (blogPost: BlogPost | HomeBlogPost, iconColor: string, isSelected: boolean, headerClickCallback: () => void, searchText: string) => import("react/jsx-runtime").JSX.Element;
|
77
78
|
export declare const findFileItemByDraftID: (tree: FileItem | undefined, draftID: number | undefined) => FileItem | null;
|