@topconsultnpm/sdkui-react-beta 6.13.24 → 6.13.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/base/TMListView.js +5 -5
- package/lib/components/features/archive/TMArchive.js +22 -14
- package/lib/components/features/documents/TMBatchUpdateForm.js +4 -5
- package/lib/components/features/documents/TMDcmtForm.d.ts +2 -2
- package/lib/components/features/documents/TMDcmtForm.js +76 -53
- package/lib/components/features/documents/TMDcmtPreview.js +7 -8
- package/lib/components/features/documents/TMFileUploader.js +2 -2
- package/lib/components/features/documents/TMMasterDetailDcmts.js +26 -18
- package/lib/components/features/search/TMSearch.js +85 -156
- package/lib/components/features/search/TMSearchResult.js +63 -41
- package/lib/components/grids/TMRecentsManager.js +1 -1
- package/lib/components/sidebar/TMCommandsPanel.d.ts +16 -0
- package/lib/components/sidebar/TMCommandsPanel.js +25 -0
- package/lib/helper/helpers.d.ts +4 -0
- package/lib/helper/helpers.js +36 -0
- package/package.json +2 -2
@@ -6,9 +6,9 @@ import TMContextMenu, { useTMContextMenu } from './TMContextMenu';
|
|
6
6
|
import { IconApply, IconCloseCircle, IconColumns, IconDown, IconHide, IconShow, IconUp, IconVisible } from '../../helper/TMIcons';
|
7
7
|
import { TMSearchBar } from '../sidebar/TMHeader';
|
8
8
|
import TMTooltip from './TMTooltip';
|
9
|
-
import { SDKUI_Localizator } from '../../helper';
|
9
|
+
import { getContrastColor, SDKUI_Localizator } from '../../helper';
|
10
10
|
import { TMColors } from '../../utils/theme';
|
11
|
-
const StyledListItem = styled.div ` width: 100%; height: max-content; border-bottom: 1px solid #e5e5e5; background-color: ${props => props.$isSelected ? props.$color ? `${props.$color}99` : '#00000030' : 'transparent'} ; color: ${props => props.$isSelected ? props.$
|
11
|
+
const StyledListItem = styled.div ` width: 100%; height: max-content; border-bottom: 1px solid #e5e5e5; background-color: ${props => props.$isSelected ? props.$color ? `${props.$color}99` : '#00000030' : 'transparent'} ; color: ${props => props.$isSelected ? props.$textColor : '#000000'} ; &:hover{ background-color: ${props => props.$color ? props.$isSelected ? `${props.$color}99` : `${props.$color}40` : props.$isSelected ? '#00000030' : '#00000010'};} `;
|
12
12
|
const StyledListViewContainer = styled.div ` position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; width: 100%; height: 100%; `;
|
13
13
|
const StyledSearchContainer = styled.div ` width: 100%; height: max-content; padding: 5px; border-bottom: 1px solid #e5e5e5; display: flex; align-items: center; gap: 10px; `;
|
14
14
|
const StyledListViewFooter = styled.div ` background-color: ${props => props.$bgColor}; width: 100%; height: 25px; padding: 5px 15px; border-top: 1px solid #e5e5e5; display: flex; align-items: center; gap: 10px; `;
|
@@ -257,7 +257,7 @@ const TMListView = ({ customGroupingHeaders, headerBackGroundColor, header, show
|
|
257
257
|
}
|
258
258
|
// map memo
|
259
259
|
const memoList = useMemo(() => currentDataSource.map((data, index) => {
|
260
|
-
return (_jsx(StyledListItem, { "$isSelected": isSelected(data), "$color": customColor, onClick: () => { onSelectionChanged && onSelectionChanged(data); onItemClick && onItemClick(data); }, onDoubleClick: () => onItemDblClick && onItemDblClick(data), children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'flex-start', justifyContent: 'flex-start', gap: 5, padding: '5px 5px' }, children: [localShowId && _jsxs("p", { style: { color: isSelected(data) ? '
|
260
|
+
return (_jsx(StyledListItem, { "$isSelected": isSelected(data), "$color": getContrastColor(customColor).bgColor, "$textColor": getContrastColor(customColor).textColor, onClick: () => { onSelectionChanged && onSelectionChanged(data); onItemClick && onItemClick(data); }, onDoubleClick: () => onItemDblClick && onItemDblClick(data), children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'flex-start', justifyContent: 'flex-start', gap: 5, padding: '5px 5px' }, children: [localShowId && _jsxs("p", { style: { color: isSelected(data) ? 'red' : 'black', backgroundColor: `${customColor}20`, width: '100%', padding: '2px 5px', borderRadius: '5px', height: 'max-content', textAlign: 'left' }, children: [" ", exprKey + ' : ' + data[exprKey], " "] }), _jsxs("div", { style: { width: '100%', height: '100%' }, children: [" ", itemTemplate ? itemTemplate(data) : _jsx("div", {})] })] }) }, index));
|
261
261
|
}), [currentDataSource, selectedItem, localShowId, customColor]);
|
262
262
|
const groupedMemoList = useMemo(() => groupKeys.map((key, index) => {
|
263
263
|
const groupingText = () => {
|
@@ -282,9 +282,9 @@ const TMListView = ({ customGroupingHeaders, headerBackGroundColor, header, show
|
|
282
282
|
customGroupingHeaders[index] ?
|
283
283
|
_jsx("div", { style: { width: '100%', height: '100%', display: 'flex', alignItems: 'center' }, children: customGroupingHeaders[index] })
|
284
284
|
:
|
285
|
-
_jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 10 }, children: [_jsx("p", { children: groupingText() }), _jsx("div", { style: { width: '16px', height: '16px', display: 'flex', alignItems: 'center', justifyContent: 'center', backgroundColor: customColor, color:
|
285
|
+
_jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 10 }, children: [_jsx("p", { children: groupingText() }), _jsx("div", { style: { width: '16px', height: '16px', display: 'flex', alignItems: 'center', justifyContent: 'center', backgroundColor: getContrastColor(customColor).textColor, color: getContrastColor(customColor).bgColor, boxShadow: '1px 1px 2px #00000020', borderRadius: '30px', fontWeight: 'bold' }, children: groupByKey(currentDataSource, grouping)[key].length })] })
|
286
286
|
:
|
287
|
-
_jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 10 }, children: [_jsx("p", { children: groupingText() }), _jsx("div", { style: { width: '16px', height: '16px', display: 'flex', alignItems: 'center', justifyContent: 'center', backgroundColor: customColor, color:
|
287
|
+
_jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 10 }, children: [_jsx("p", { children: groupingText() }), _jsx("div", { style: { width: '16px', height: '16px', display: 'flex', alignItems: 'center', justifyContent: 'center', backgroundColor: getContrastColor(customColor).textColor, color: getContrastColor(customColor).bgColor, boxShadow: '1px 1px 2px #00000020', borderRadius: '30px', fontWeight: 'bold' }, children: groupByKey(currentDataSource, grouping)[key].length })] }), _jsxs("div", { style: { cursor: 'pointer' }, onClick: () => { let arr = [...openList]; arr[index] = !arr[index]; setOpenList(arr); }, children: [" ", openList[index] ? _jsx(IconUp, { fontSize: 12 }) : _jsx(IconDown, { fontSize: 12 }), " "] })] }) }), openList[index] && _jsx("div", { style: { width: '100%', height: '100%' }, children: groupByKey(currentDataSource, grouping)[key].map((data, index2) => (_jsx(StyledListItem, { "$isSelected": data === selectedItem, "$color": getContrastColor(customColor).bgColor, "$textColor": getContrastColor(customColor).textColor, onClick: () => { onSelectionChanged && onSelectionChanged(data); onItemClick && onItemClick(data); }, onDoubleClick: () => { onItemDblClick && onItemDblClick(data); }, children: _jsxs("div", { style: { width: '100%', height: 'max-content', display: 'flex', flexDirection: 'column', padding: '5px 5px' }, children: [localShowId && _jsxs("p", { style: { color: data === selectedItem ? 'red' : 'black', backgroundColor: `${customColor}20`, width: '100%', padding: '2px 5px', borderRadius: '5px', height: 'max-content', textAlign: 'left' }, children: [" ", 'ID: ' + data.id, " "] }), _jsxs("div", { style: { width: '100%', height: '100%' }, children: [" ", itemTemplate ? itemTemplate(data) : _jsx("div", {})] })] }) }, index2))) })] }, index));
|
288
288
|
}), [currentDataSource, selectedItem, localShowId, customColor, openList, grouping, customGroupingHeaders]);
|
289
289
|
// List height
|
290
290
|
const listHeight = () => {
|
@@ -10,7 +10,7 @@ import TMDcmtForm from '../documents/TMDcmtForm';
|
|
10
10
|
import { StyledToppyTextContainer, StyledToppyText } from '../search/TMSearchQueryPanel';
|
11
11
|
import TMTreeSelector from '../search/TMTreeSelector';
|
12
12
|
import TMPanel from '../../base/TMPanel';
|
13
|
-
import
|
13
|
+
import TMCommandsPanel from '../../sidebar/TMCommandsPanel';
|
14
14
|
const TMArchive = ({ inputTID }) => {
|
15
15
|
const TIDs = SDKUI_Globals.userSettings.archivingSettings.mruTIDs;
|
16
16
|
const [currentTID, setCurrentTID] = useState(0);
|
@@ -39,20 +39,28 @@ const TMArchive = ({ inputTID }) => {
|
|
39
39
|
}, [deviceType, currentTID, showRecentsPanel]);
|
40
40
|
let customSidebarItems = useMemo(() => {
|
41
41
|
return ([
|
42
|
-
{ icon: _jsx(IconTree, {}),
|
43
|
-
{ icon: _jsx(IconProgressReady, {}),
|
42
|
+
{ icon: _jsx(IconTree, {}), selected: showTreesPanel, onClick: () => { setShowTreesPanel(!showTreesPanel); } },
|
43
|
+
{ icon: _jsx(IconProgressReady, {}), selected: showRecentsPanel, onClick: () => { setShowRecentsPanel(!showRecentsPanel); } }
|
44
44
|
]);
|
45
45
|
}, [showTreesPanel, showRecentsPanel]);
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
46
|
+
const isMobile = deviceType === DeviceType.MOBILE;
|
47
|
+
return (_jsxs("div", { style: {
|
48
|
+
display: 'flex',
|
49
|
+
flexDirection: isMobile ? 'column' : 'row',
|
50
|
+
justifyContent: 'space-between',
|
51
|
+
gap: SDKUI_Globals.userSettings.themeSettings.gutters,
|
52
|
+
width: '100%',
|
53
|
+
height: '100%',
|
54
|
+
}, children: [_jsx("div", { style: { flex: 1, minWidth: 0, height: '100%' }, children: _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, 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: SDKUI_Globals.userSettings.themeSettings.gutters, direction: 'horizontal', overflow: 'visible', showSeparator: deviceType !== DeviceType.MOBILE && showRecentsPanel, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: getSecondarySplitterStartValues(), children: [showRecentsPanel ? _jsx(TMLayoutItem, { children: _jsx(TMPanel, { title: 'Recenti', onClose: () => setShowRecentsPanel(false), totalItems: mruTIDs.length, children: _jsx(TMRecentsManager, { mruTIDs: mruTIDs, deviceType: deviceType, onSelectedTID: (tid) => setCurrentTID(tid), onDeletedTID: (tid) => {
|
55
|
+
let newMruTIDS = mruTIDs.slice();
|
56
|
+
let index = newMruTIDS.findIndex(o => o == tid);
|
57
|
+
if (index >= 0)
|
58
|
+
newMruTIDS.splice(index, 1);
|
59
|
+
SDKUI_Globals.userSettings.archivingSettings.mruTIDs = newMruTIDS.filter(tid => tid != undefined && tid != null);
|
60
|
+
setMruTIDs(newMruTIDS);
|
61
|
+
} }) }) }) : _jsx(_Fragment, {}), _jsx(TMLayoutItem, { children: currentTID ?
|
62
|
+
_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) })
|
63
|
+
:
|
64
|
+
_jsx(TMPanel, { 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: '' }), " "] })] }) }) })] }) })] }) }), !currentTID ? _jsx(TMCommandsPanel, { isMobile: isMobile, items: customSidebarItems }) : _jsx(_Fragment, {})] }));
|
57
65
|
};
|
58
66
|
export default TMArchive;
|
@@ -4,20 +4,19 @@ import { AccessLevels, DcmtTypeListCacheService, LayoutModes, MetadataDataDomain
|
|
4
4
|
import { searchResultToMetadataValues, getSystemMetadata, calcIsModified, getListMaxItems, SDKUI_Localizator, SDKUI_Globals } from '../../../helper';
|
5
5
|
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
6
6
|
import { DcmtOperationTypes, FormModes } from '../../../ts';
|
7
|
-
import { TMColors } from '../../../utils/theme';
|
8
7
|
import { StyledToolbarCardContainer, StyledFormButtonsContainer } from '../../base/Styled';
|
9
8
|
import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
|
10
9
|
import { TMSplitterLayout } from '../../base/TMLayout';
|
11
10
|
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
12
11
|
import TMShowAllOrMaxItemsButton from '../../base/TMShowAllOrMaxItemsButton';
|
13
12
|
import TMSpinner from '../../base/TMSpinner';
|
14
|
-
import TMToolbarCard from '../../base/TMToolbarCard';
|
15
13
|
import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
|
16
14
|
import TMDistinctValues from '../../choosers/TMDistinctValues';
|
17
15
|
import TMFormulaEditor, { FormulaDescriptor, FormulaHelper, FormulaTargets } from '../../editors/TMFormulaEditor';
|
18
16
|
import { useMetadataEditableList } from '../../editors/TMMetadataEditor';
|
19
17
|
import TMMetadataValues, { ShowCheckBoxesMode, AdvancedMenuButtons } from '../../editors/TMMetadataValues';
|
20
18
|
import { TMSaveFormButtonSave, TMSaveFormButtonUndo } from '../../forms/TMSaveForm';
|
19
|
+
import TMPanel from '../../base/TMPanel';
|
21
20
|
const TMBatchUpdateForm = ({ inputDcmts, TID, DID, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, onSavedCallbackAsync, onBack, onStatusChanged }) => {
|
22
21
|
const [metadataValues, setMetadataValues] = useState([]);
|
23
22
|
const [metadataValuesOrig, setMetadataValuesOrig] = useState([]);
|
@@ -113,7 +112,7 @@ const TMBatchUpdateForm = ({ inputDcmts, TID, DID, isExpertMode = SDKUI_Globals.
|
|
113
112
|
const totalItems = metadataValues.filter(o => o.mid && o.mid > 100).length;
|
114
113
|
const metadataValuesSource = metadataValues.filter(o => o.mid && o.mid > 100).slice(0, showAll ? metadataValues.filter(o => o.mid && o.mid > 100).length : listMaxItems);
|
115
114
|
const metadataValuesSourceOrig = metadataValuesOrig.filter(o => o.mid && o.mid > 100).slice(0, showAll ? metadataValuesOrig.filter(o => o.mid && o.mid > 100).length : listMaxItems);
|
116
|
-
return (_jsx(TMLayoutWaitingContainer, { showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, isCancelable: true, abortController: abortController, children: _jsxs(TMSplitterLayout, { separatorSize:
|
115
|
+
return (_jsx(TMLayoutWaitingContainer, { showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, isCancelable: true, abortController: abortController, children: _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorColor: 'transparent', showSeparator: showFormulaEditor, start: showFormulaEditor ? ['50%', '50%'] : ['100%', '0%'], min: ['0', '0'], children: [_jsx(TMPanel, { title: `${SDKUI_Localizator.BatchUpdate} (${inputDcmts.length} documenti selezionati)`, onBack: deviceType === DeviceType.MOBILE ? onBack : undefined, onClose: deviceType !== DeviceType.MOBILE ? onBack : undefined, children: _jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, isExpertMode: isExpertMode, showCheckBoxes: ShowCheckBoxesMode.Always, showNullValueCheckBoxes: true, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, validationItems: validationItems, isOpenDistinctValues: showDistinctValuesPanel, selectedMID: focusedMetadataValue?.mid, onFocusedItemChanged: (item) => { setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
|
117
116
|
setMetadataValues((prevItems) => prevItems.map((item) => {
|
118
117
|
const newItem = newItems.find((newItem) => newItem.tid === item.tid && newItem.mid === item.mid);
|
119
118
|
return newItem ? { ...item, ...newItem } : item;
|
@@ -128,12 +127,12 @@ const TMBatchUpdateForm = ({ inputDcmts, TID, DID, isExpertMode = SDKUI_Globals.
|
|
128
127
|
break;
|
129
128
|
}
|
130
129
|
} }), _jsxs(StyledFormButtonsContainer, { children: [_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: 10 }, children: _jsxs("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '8px' }, children: [_jsx(TMSaveFormButtonSave, { showTooltip: false, btnStyle: 'advanced', advancedColor: '#f09c0a', isModified: errors.length <= 0 && isModified, formMode: FormModes.Update, errorsCount: errors.length, onSaveAsync: onSavedAsync }), _jsx(TMSaveFormButtonUndo, { btnStyle: 'toolbar', showTooltip: true, color: 'primary', isModified: isModified, formMode: FormModes.Update, onUndo: onUndoHandler })] }) }), totalItems > listMaxItems && _jsx(TMShowAllOrMaxItemsButton, { showAll: showAll, dataSourceLength: totalItems, onClick: () => { setShowAll(!showAll); } })] })] }) }), showDistinctValuesPanel && focusedMetadataValue &&
|
131
|
-
_jsx(TMDistinctValues, { tid: TID, mid: focusedMetadataValue?.mid, separator: ', ', allowAppendMode: false, onClosePanelCallback: () => setShowDistinctValuesPanel(false), onSelectionChanged: (e) => {
|
130
|
+
_jsx(TMDistinctValues, { isModal: true, tid: TID, mid: focusedMetadataValue?.mid, separator: ', ', allowAppendMode: false, onClosePanelCallback: () => setShowDistinctValuesPanel(false), onSelectionChanged: (e) => {
|
132
131
|
if (!e)
|
133
132
|
return;
|
134
133
|
setMetadataValues((prevItems) => prevItems.map((item) => item.tid == e.tid && item.mid === e.mid ? { ...item, value: e.newValue, isSelected: true } : item));
|
135
134
|
} }), showFormulaEditor && focusedMetadataValue &&
|
136
|
-
_jsx(
|
135
|
+
_jsx(TMPanel, { title: SDKUI_Localizator.FormulaEditorTitle + (focusedMetadataValue?.md?.nameLoc ? ` (${focusedMetadataValue?.md?.nameLoc})` : ''), onClose: () => setShowFormulaEditor(false), children: _jsx(TMFormulaEditor, { isModal: false, formMode: FormModes.Update, inputData: getFormula(), showBack: false, onClose: () => setShowFormulaEditor(false), onApplied: (newFormula) => {
|
137
136
|
setMetadataValues((prevItems) => prevItems.map((item) => item.tid == newFormula.tid && item.mid === newFormula.mid ? { ...item, value: FormulaHelper.addFormulaTag(newFormula.expression), isSelected: true, isEditable: true } : item));
|
138
137
|
setFocusedMetadataValue(prevState => ({
|
139
138
|
...prevState,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { LayoutModes } from '@topconsultnpm/sdk-ts-beta';
|
3
3
|
import { FormModes } from '../../../ts';
|
4
|
-
import {
|
4
|
+
import { TMCommandItemProps } from '../../sidebar/TMCommandsPanel';
|
5
5
|
interface ITMDcmtFormProps {
|
6
6
|
TID?: number;
|
7
7
|
DID?: number;
|
@@ -14,7 +14,7 @@ interface ITMDcmtFormProps {
|
|
14
14
|
showPreview?: boolean;
|
15
15
|
showBoard?: boolean;
|
16
16
|
showSysMetadata?: boolean;
|
17
|
-
customRightSidebarItems?:
|
17
|
+
customRightSidebarItems?: TMCommandItemProps[];
|
18
18
|
showDcmtFormSidebar?: boolean;
|
19
19
|
isExpertMode?: boolean;
|
20
20
|
count?: number;
|
@@ -18,7 +18,6 @@ import TMButton from '../../base/TMButton';
|
|
18
18
|
import { TMSplitterLayout, TMLayoutItem } from '../../base/TMLayout';
|
19
19
|
import { TMExceptionBoxManager, TMMessageBoxManager, ButtonNames } from '../../base/TMPopUp';
|
20
20
|
import TMSpinner from '../../base/TMSpinner';
|
21
|
-
import TMToolbarCard from '../../base/TMToolbarCard';
|
22
21
|
import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
|
23
22
|
import TMDistinctValues from '../../choosers/TMDistinctValues';
|
24
23
|
import TMFormulaEditor, { FormulaDescriptor, FormulaHelper, FormulaTargets } from '../../editors/TMFormulaEditor';
|
@@ -30,6 +29,8 @@ import TMMasterDetailDcmts from './TMMasterDetailDcmts';
|
|
30
29
|
import TMDcmtBlog from './TMDcmtBlog';
|
31
30
|
import { useInputAttachmentsDialog } from '../../../hooks/useInputDialog';
|
32
31
|
import TMModal from '../../base/TMModal';
|
32
|
+
import TMPanel from '../../base/TMPanel';
|
33
|
+
import TMCommandsPanel from '../../sidebar/TMCommandsPanel';
|
33
34
|
let abortControllerLocal = new AbortController();
|
34
35
|
//#endregion
|
35
36
|
const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes.Update, onClose, onSavedAsyncCallback, TID, DID, formMode = FormModes.Update, canNext, canPrev, count, itemIndex, onNext, onPrev, customRightSidebarItems = [], allowNavigation = true, allowRelations = true, isClosable = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, showDcmtForm = true, showDcmtFormSidebar = true, showPreview = false, showBoard = false, showSysMetadata = false, onClosePreview, titleModal, isModal = false, widthModal = "100%", heightModal = "100%" }) => {
|
@@ -142,18 +143,6 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
142
143
|
}
|
143
144
|
return _jsx(IconShow, {});
|
144
145
|
}, [layoutMode, fileIsNotValid]);
|
145
|
-
const sideBarItems = useMemo(() => {
|
146
|
-
let fixedItems = [
|
147
|
-
{ icon: fileManagerIcon, id: 'Preview', visibleName: (layoutMode === LayoutModes.Ark && fileIsNotValid) ? SDKUI_Localizator.RequiredField : layoutMode === LayoutModes.Ark ? SDKUI_Localizator.UploadFile : 'Anteprima', isActive: isOpenPreview, onClick: () => { setIsOpenPreview(!isOpenPreview); }, disabled: layoutMode === LayoutModes.Ark && fromDTD?.archiveConstraint === ArchiveConstraints.OnlyMetadata },
|
148
|
-
{ icon: _jsx(IconBoard, {}), id: 'Board', visibleName: 'Bacheca', disabled: layoutMode !== LayoutModes.Update, beginGroup: true, isActive: isOpenBoard, visible: layoutMode !== LayoutModes.Ark, onClick: () => { closeMiddlePanel(); setIsOpenBoard(!isOpenBoard); } },
|
149
|
-
{ icon: _jsx(IconDcmtTypeSys, {}), id: 'SystemMetadata', visibleName: 'Metadati di sistema', disabled: layoutMode !== LayoutModes.Update, isActive: isOpenSysMetadata, visible: layoutMode !== LayoutModes.Ark, onClick: () => { closeMiddlePanel(); setIsOpenSysMetadata(!isOpenSysMetadata); } },
|
150
|
-
{ icon: _jsx(IconDetailDcmts, { fontSize: 20, transform: 'scale(-1, 1)' }), id: 'Master', beginGroup: true, visible: layoutMode !== LayoutModes.Ark && allowRelations && currentTIDHasMasterRelations, visibleName: SDKUI_Localizator.DcmtsMaster, disabled: layoutMode !== LayoutModes.Update || !DID, isActive: isOpenMaster, onClick: () => { setIsOpenMaster(!isOpenMaster); } },
|
151
|
-
{ icon: _jsx(IconDetailDcmts, { fontSize: 20 }), id: 'Details', visibleName: SDKUI_Localizator.DcmtsDetail, disabled: layoutMode !== LayoutModes.Update || !DID, isActive: isOpenDetails, visible: layoutMode !== LayoutModes.Ark && allowRelations && currentTIDHasDetailRelations, onClick: () => { setIsOpenDetails(!isOpenDetails); } },
|
152
|
-
];
|
153
|
-
return customRightSidebarItems.length === 0
|
154
|
-
? fixedItems
|
155
|
-
: [...fixedItems.filter(item => item.id !== 'DistinctValues'), ...customRightSidebarItems, ...fixedItems.filter(item => item.id === 'DistinctValues')];
|
156
|
-
}, [customRightSidebarItems, layoutMode, isOpenPreview, focusedMetadataValue, fromDTD?.archiveConstraint]);
|
157
146
|
const closeMiddlePanel = () => {
|
158
147
|
setIsOpenBoard(false);
|
159
148
|
setIsOpenSysMetadata(false);
|
@@ -449,50 +438,84 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
449
438
|
fd.tid = TID;
|
450
439
|
return fd;
|
451
440
|
};
|
441
|
+
const isPreviewDisabled = layoutMode === LayoutModes.Ark && fromDTD?.archiveConstraint === ArchiveConstraints.OnlyMetadata;
|
442
|
+
const isBoardDisabled = layoutMode !== LayoutModes.Update;
|
443
|
+
const isSysMetadataDisabled = layoutMode !== LayoutModes.Update;
|
444
|
+
const isDetailsDisabled = layoutMode !== LayoutModes.Update || !DID;
|
445
|
+
const isMasterDisabled = layoutMode !== LayoutModes.Update || !DID;
|
452
446
|
const renderDcmtForm = () => {
|
453
|
-
return (_jsxs(
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
447
|
+
return (_jsxs("div", { style: {
|
448
|
+
display: 'flex',
|
449
|
+
flexDirection: deviceType === DeviceType.MOBILE ? 'column' : 'row',
|
450
|
+
justifyContent: 'space-between',
|
451
|
+
gap: SDKUI_Globals.userSettings.themeSettings.gutters,
|
452
|
+
width: '100%',
|
453
|
+
height: '100%',
|
454
|
+
}, children: [_jsx("div", { style: { flex: 1, minWidth: 0, height: '100%' }, children: _jsxs(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: useWaitPanelLocalState ? showWaitPanelLocal : showWaitPanel, showWaitPanelPrimary: useWaitPanelLocalState ? showPrimaryLocal : showPrimary, showWaitPanelSecondary: useWaitPanelLocalState ? showSecondaryLocal : showSecondary, waitPanelTitle: useWaitPanelLocalState ? waitPanelTitleLocal : waitPanelTitle, waitPanelTextPrimary: useWaitPanelLocalState ? waitPanelTextPrimaryLocal : waitPanelTextPrimary, waitPanelValuePrimary: useWaitPanelLocalState ? waitPanelValuePrimaryLocal : waitPanelValuePrimary, waitPanelMaxValuePrimary: useWaitPanelLocalState ? waitPanelMaxValuePrimaryLocal : waitPanelMaxValuePrimary, waitPanelTextSecondary: useWaitPanelLocalState ? waitPanelTextSecondaryLocal : waitPanelTextSecondary, waitPanelValueSecondary: useWaitPanelLocalState ? waitPanelValueSecondaryLocal : waitPanelValueSecondary, waitPanelMaxValueSecondary: useWaitPanelLocalState ? waitPanelMaxValueSecondaryLocal : waitPanelMaxValueSecondary, isCancelable: useWaitPanelLocalState ? dcmtFile ? dcmtFile.size >= 1000000 : false : true, abortController: useWaitPanelLocalState ? abortControllerLocal : abortController, children: [_jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorColor: 'transparent', showSeparator: (isOpenPreview || isOpenMiddlePanel()) && deviceType !== DeviceType.MOBILE && isOpenDcmtForm, start: getPrimarySplitterStartLayout(), min: deviceType !== DeviceType.MOBILE && isOpenDcmtForm ? ['150px', '0'] : ['0', '0'], children: [_jsx(TMLayoutItem, { children: _jsx(TMPanel, { showHeader: showHeader, title: fromDTD?.nameLoc, toolbar: allowNavigation ? formToolbar : _jsx(_Fragment, {}), onBack: isClosable ? undefined : handleClose, onClose: isClosable ? handleClose : undefined, children: metadataValuesSource.length > 0 && _jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, isExpertMode: isExpertMode, isOpenDistinctValues: isOpenDistinctValues, openChooserBySingleClick: !isOpenDistinctValues, selectedMID: focusedMetadataValue?.mid, layoutMode: layoutMode, deviceType: deviceType, validationItems: validationItems, onFocusedItemChanged: (item) => { (item?.mid !== focusedMetadataValue?.mid) && setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
|
455
|
+
setFormData((prevItems) => prevItems.map((item) => {
|
456
|
+
const newItem = newItems.find((newItem) => newItem.tid === item.tid && newItem.mid === item.mid);
|
457
|
+
return newItem ? { ...item, ...newItem } : item;
|
458
|
+
}));
|
459
|
+
}, onAdvancedMenuClick: (e) => {
|
460
|
+
switch (e.button) {
|
461
|
+
case AdvancedMenuButtons.DistinctValues:
|
462
|
+
setIsOpenDistinctValues(!isOpenDistinctValues);
|
463
|
+
break;
|
464
|
+
case AdvancedMenuButtons.FormulaEditor:
|
465
|
+
setIsOpenFormulaEditor(!isOpenFormulaEditor);
|
466
|
+
break;
|
467
|
+
}
|
468
|
+
} }), _jsxs(StyledFormButtonsContainer, { children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 10 }, children: [fromDTD?.templateTID === TemplateTIDs.WF_WIApprView && _jsx(WorkFlowOperationButtons, { onApprove: () => setShowApprovePopup(true), onReject: () => setShowRejectPopup(true), onReAssign: () => setShowReAssignPopup(true), isInDcmtForm: true }), _jsx("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '8px' }, children: layoutMode === LayoutModes.Update ? _jsxs(_Fragment, { children: [_jsx(TMSaveFormButtonSave, { showTooltip: false, btnStyle: 'advanced', advancedColor: '#f09c0a', isModified: isModified, formMode: formMode, errorsCount: validationItems.filter(o => o.ResultType == ResultTypes.ERROR).length, onSaveAsync: confirmActionPopup }), _jsx(TMSaveFormButtonUndo, { btnStyle: 'toolbar', showTooltip: true, color: 'primary', isModified: isModified, formMode: formMode, onUndo: onUndoHandler })] }) :
|
469
|
+
_jsxs(_Fragment, { children: [_jsx(TMButton, { disabled: archiveBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconBoxArchiveIn, {}), showTooltip: false, caption: 'Archivia', advancedColor: TMColors.success, onClick: confirmActionPopup }), _jsx(TMButton, { disabled: !clearFormBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconClear, {}), showTooltip: false, caption: 'Pulisci', advancedColor: TMColors.tertiary, onClick: clearFormHandler }), DID && _jsx(TMButton, { disabled: undoBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconUndo, {}), width: '150px', showTooltip: false, caption: 'Annulla modifiche', advancedColor: TMColors.tertiary, onClick: onUndoHandler })] }) })] }), totalItems > listMaxItems && _jsx(TMShowAllOrMaxItemsButton, { showAll: showAll, dataSourceLength: totalItems, onClick: () => { setShowAll(!showAll); } })] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, TID: TID, DID: DID, op: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, TID: TID, DID: DID, op: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, TID: TID, DID: DID, onClose: () => setShowReAssignPopup(false) }), _jsx(ConfirmAttachmentsDialog, {})] }) }) }), isOpenPreview || isOpenMiddlePanel() ?
|
470
|
+
_jsx(TMLayoutItem, { children: _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, showSeparator: deviceType !== DeviceType.MOBILE && (isOpenPreview && isOpenMiddlePanel()), start: getSecondarySplitterStartLayout(), min: ['0', '0'], separatorColor: 'transparent', children: [isOpenMiddlePanel()
|
471
|
+
? _jsx(TMLayoutItem, { children: _jsx(TMPanel, { showHeader: !(isOpenDetails && layoutMode === LayoutModes.Update), color: TMColors.primaryColor, backgroundColor: `${TMColors.primaryColor}25`, title: titleText(), toolbar: middlePanelToolbar, onClose: () => { closeMiddlePanel(); }, children: _jsx(StyledToolbarCardContainer, { children: _jsx(StyledSectionContainer, { children: _jsxs(StyledSidebarItemsContentContainer, { children: [isOpenBoard && layoutMode === LayoutModes.Update &&
|
472
|
+
_jsx(TMDcmtBlog, { tid: TID, did: DID }), isOpenSysMetadata && layoutMode === LayoutModes.Update &&
|
473
|
+
_jsx(TMMetadataValues, { layoutMode: layoutMode, openChooserBySingleClick: !isOpenDistinctValues, TID: TID, isReadOnly: true, deviceType: deviceType, metadataValues: formData.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: formData.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [] }), isOpenFormulaEditor &&
|
474
|
+
_jsx(TMFormulaEditor, { isModal: false, formMode: FormModes.Update, inputData: getFormula(), showBack: false, onClose: () => setIsOpenFormulaEditor(false), onApplied: (newFormula) => {
|
475
|
+
setFormData((prevItems) => prevItems.map((item) => item.tid == newFormula.tid && item.mid === newFormula.mid ? { ...item, value: FormulaHelper.addFormulaTag(newFormula.expression), isSelected: true, isEditable: true } : item));
|
476
|
+
setFocusedMetadataValue(prevState => ({
|
477
|
+
...prevState,
|
478
|
+
isSelected: true,
|
479
|
+
isEditable: true,
|
480
|
+
value: FormulaHelper.addFormulaTag(newFormula.expression)
|
481
|
+
}));
|
482
|
+
} })] }) }) }) }) })
|
483
|
+
: _jsx(_Fragment, {}), isOpenPreview
|
484
|
+
? _jsxs(TMLayoutItem, { children: [layoutMode === LayoutModes.Update ?
|
485
|
+
_jsx(TMDcmtPreview, { onClose: () => { setIsOpenPreview(false); onClosePreview?.(); }, dcmtData: currentDcmt, canNext: canNext, canPrev: canPrev, onNext: onNext, onPrev: onPrev }) :
|
486
|
+
_jsx(TMFileUploader, { onFileUpload: (file) => setDcmtFile(file), onClose: () => setIsOpenPreview(false), isRequired: fromDTD?.archiveConstraint === ArchiveConstraints.ContentCompulsory && dcmtFile === null, defaultBlob: dcmtFile, deviceType: deviceType }), " "] })
|
487
|
+
: _jsx(_Fragment, {})] }) }) : _jsx(_Fragment, {})] }), isOpenDistinctValues &&
|
488
|
+
_jsx(TMDistinctValues, { tid: TID, mid: focusedMetadataValue?.mid, isModal: true, showHeader: false, layoutMode: layoutMode, onSelectionChanged: (e) => {
|
489
|
+
if (!e)
|
490
|
+
return;
|
491
|
+
setFormData((prevItems) => prevItems.map((item) => item.tid == e.tid && item.mid === e.mid ? { ...item, value: e.newValue } : item));
|
492
|
+
} }), (isModal && onClose) && _jsx("div", { id: "TMDcmtFormShowConfirmForClose-" + id })] }) }), showDcmtFormSidebar && _jsx(TMCommandsPanel, { isMobile: deviceType === DeviceType.MOBILE, items: [
|
493
|
+
...(layoutMode === LayoutModes.Ark ? [
|
494
|
+
{ icon: _jsx(IconRoundFileUpload, { fontSize: 20 }), selected: isOpenPreview, disabled: isPreviewDisabled, onClick: () => { if (!isPreviewDisabled)
|
495
|
+
setIsOpenPreview(!isOpenPreview); } }
|
496
|
+
] : []),
|
497
|
+
...(layoutMode !== LayoutModes.Ark ? [
|
498
|
+
{ icon: _jsx(IconShow, { fontSize: 20 }), selected: isOpenPreview, disabled: isPreviewDisabled, onClick: () => { if (!isPreviewDisabled)
|
499
|
+
setIsOpenPreview(!isOpenPreview); } },
|
500
|
+
{ icon: _jsx(IconBoard, { fontSize: 20 }), selected: isOpenBoard, disabled: isBoardDisabled, onClick: () => { if (!isBoardDisabled) {
|
501
|
+
closeMiddlePanel();
|
502
|
+
setIsOpenBoard(!isOpenBoard);
|
503
|
+
} } },
|
504
|
+
{ icon: _jsx(IconDcmtTypeSys, { fontSize: 20 }), selected: isOpenSysMetadata, disabled: isSysMetadataDisabled, onClick: () => { if (!isSysMetadataDisabled) {
|
505
|
+
closeMiddlePanel();
|
506
|
+
setIsOpenSysMetadata(!isOpenSysMetadata);
|
507
|
+
} } },
|
508
|
+
] : []),
|
509
|
+
...(currentTIDHasMasterRelations ? [{ icon: _jsx(IconDetailDcmts, { fontSize: 20 }), selected: isOpenMaster, disabled: isMasterDisabled, onClick: () => { if (!isMasterDisabled)
|
510
|
+
setIsOpenMaster(!isOpenMaster); } }] : []),
|
511
|
+
...(currentTIDHasDetailRelations ? [{ icon: _jsx(IconDetailDcmts, { fontSize: 20, transform: 'scale(-1, 1)' }), selected: isOpenDetails, disabled: isDetailsDisabled, onClick: () => { if (!isDetailsDisabled)
|
512
|
+
setIsOpenDetails(!isOpenDetails); } }] : []),
|
513
|
+
...customRightSidebarItems
|
514
|
+
] }), isOpenDetails &&
|
492
515
|
_jsx(StyledModalContainer, { style: { backgroundColor: 'white' }, children: _jsx(TMMasterDetailDcmts, { deviceType: deviceType, isForMaster: false, inputDcmts: getSelectionDcmtInfo(), allowNavigation: allowNavigation, canNext: canNext, canPrev: canPrev, onNext: onNext, onPrev: onPrev, onBack: () => setIsOpenDetails(false) }) }), isOpenMaster &&
|
493
516
|
_jsxs(StyledModalContainer, { style: { backgroundColor: 'white' }, children: [_jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: getSelectionDcmtInfo(), isForMaster: true, allowNavigation: allowNavigation, canNext: canNext, canPrev: canPrev, onNext: onNext, onPrev: onPrev, onBack: () => setIsOpenMaster(false), appendMasterDcmts: handleAddItem }), secondaryMasterDcmts.length > 0 && secondaryMasterDcmts.map((dcmt, index) => {
|
494
517
|
return (_jsx(StyledModalContainer, { style: { backgroundColor: 'white' }, children: _jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: [dcmt], isForMaster: true, allowNavigation: false, onBack: () => handleRemoveItem(dcmt.TID, dcmt.DID), appendMasterDcmts: handleAddItem }) }, `${index}-${dcmt.DID}`));
|
495
|
-
})] })
|
518
|
+
})] })] }));
|
496
519
|
};
|
497
520
|
const handleClose = () => {
|
498
521
|
if (!isModified) {
|
@@ -9,13 +9,12 @@ import { TMColors } from '../../../utils/theme';
|
|
9
9
|
import ShowAlert from '../../base/TMAlert';
|
10
10
|
import TMButton from '../../base/TMButton';
|
11
11
|
import TMDropDownMenu from '../../base/TMDropDownMenu';
|
12
|
-
import { TMLayoutItem } from '../../base/TMLayout';
|
13
12
|
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
14
|
-
import TMToolbarCard from '../../base/TMToolbarCard';
|
15
13
|
import TMTooltip from '../../base/TMTooltip';
|
16
14
|
import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
|
17
15
|
import { TMSaveFormButtonPrevious, TMSaveFormButtonNext } from '../../forms/TMSaveForm';
|
18
16
|
import { StyledAnimatedComponentOpacity } from '../../base/Styled';
|
17
|
+
import TMPanel from '../../base/TMPanel';
|
19
18
|
const TMDcmtPreview = ({ dcmtData, onClose, canNext, canPrev, onNext, onPrev }) => {
|
20
19
|
const [dcmtBlob, setDcmtBlob] = useState(undefined);
|
21
20
|
const [showPreview, setShowPreview] = useState(false);
|
@@ -86,12 +85,12 @@ const TMDcmtPreview = ({ dcmtData, onClose, canNext, canPrev, onNext, onPrev })
|
|
86
85
|
}
|
87
86
|
return title;
|
88
87
|
};
|
89
|
-
return (_jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsx(
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
88
|
+
return (_jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsx(TMPanel, { padding: '0', title: titleHandler(), toolbar: _jsxs("div", { style: { width: 'max-content', display: 'flex', alignItems: 'center', gap: '10px' }, children: [_jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', isModified: false, formMode: FormModes.ReadOnly, canPrev: canPrev, onPrev: onPrev }), _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', isModified: false, formMode: FormModes.ReadOnly, canNext: canNext, onNext: onNext }), _jsx(StyledHeaderIcon, { "$color": TMColors.primaryColor, children: _jsx(TMDropDownMenu, { backgroundColor: 'white', borderRadius: '3px', content: _jsx(TMButton, { btnStyle: 'icon', caption: 'Altro', icon: _jsx(IconMenuVertical, {}), showTooltip: false }), items: [
|
89
|
+
{ icon: _jsx(IconCloseCircle, {}), text: "Rimuovi elemento dalla cache", onClick: () => { removeDcmtsFileCache(cacheKey); setIsFromCache(false); } },
|
90
|
+
{ icon: _jsx(IconClear, {}), text: "Cancella la cache", onClick: () => { clearDcmtsFileCache(); setIsFromCache(false); } },
|
91
|
+
] }, "btn13") }), _jsx(StyledHeaderIcon, { onClick: onClose, "$color": TMColors.primaryColor, children: _jsx(TMTooltip, { content: SDKUI_Localizator.Close, children: _jsx(IconCloseOutline, {}) }) })] }), children: error
|
92
|
+
? _jsx(TMNothingToShow, { icon: _jsx(IconCloseOutline, { fontSize: 92, color: TMColors.error }), text: error })
|
93
|
+
: renderedPreview(dcmtData?.tid, dcmtData?.did, dcmtData?.fileExt, dcmtData?.fileSize, dcmtData?.fileCount, extensionHandler(dcmtData?.fileExt), showPreview, () => { loadDocumentWithCache(); setShowPreview(true); }, dcmtBlob) }) }));
|
95
94
|
};
|
96
95
|
export default TMDcmtPreview;
|
97
96
|
export const TMFileViewer = ({ fileBlob }) => {
|
@@ -7,9 +7,9 @@ import { FileExtensionHandler } from '../../../ts';
|
|
7
7
|
import { TMColors } from '../../../utils/theme';
|
8
8
|
import TMButton from '../../base/TMButton';
|
9
9
|
import { DeviceType } from '../../base/TMDeviceProvider';
|
10
|
-
import TMToolbarCard from '../../base/TMToolbarCard';
|
11
10
|
import TMTooltip from '../../base/TMTooltip';
|
12
11
|
import { TMFileViewer, StyledHeaderIcon } from './TMDcmtPreview';
|
12
|
+
import TMPanel from '../../base/TMPanel';
|
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);
|
@@ -73,7 +73,7 @@ const TMFileUploader = ({ deviceType = DeviceType.DESKTOP, onClose, onFileUpload
|
|
73
73
|
_jsx("div", { style: { display: 'flex', gap: 10, width: '100%', height: '100%' }, children: _jsxs(UploadContainer, { ref: uploaderRef, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, style: { backgroundColor: dragOver ? '#76b1e6' : 'white' }, onDoubleClick: browseHandler, "$isRequired": isRequired, children: [_jsx("div", { style: { display: 'flex', gap: '10px', flexDirection: 'column', position: 'absolute', right: 5, top: 5 }, children: _jsx(TMButton, { btnStyle: 'icon', caption: 'Sfoglia', color: isRequired && !uploadedFile ? 'error' : 'primary', onClick: browseHandler, icon: _jsx(IconFolderOpen, { fontSize: 22 }) }) }), _jsx("p", { style: { fontSize: '1.2rem', fontWeight: 'bold' }, children: deviceType === DeviceType.MOBILE ? 'Clicca per sfogliare il tuo file' : 'Trascina il tuo file qui o fai doppio click per sfogliarlo' }), isRequired && _jsxs("p", { style: { fontWeight: 'bold' }, children: [" ", SDKUI_Localizator.RequiredField, " "] })] }) }) :
|
74
74
|
_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 10, width: '100%', height: '100%' }, children: [_jsxs("div", { style: { backgroundColor: 'white', padding: '5px 10px', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'space-between', color: TMColors.primaryColor }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 5 }, children: [_jsx("p", { children: "File name:" }), _jsxs("div", { style: { fontWeight: 'bold' }, children: [fileName, " ", _jsxs("span", { children: [" ", ` (${formatBytes(fileSize)})`, " "] })] })] }), uploadedFile && _jsx(TMButton, { btnStyle: 'icon', color: 'error', caption: 'Pulisci', onClick: clearFile, icon: _jsx(IconClear, { fontSize: 22 }) })] }), extensionHandler(fileExt) === FileExtensionHandler.READY_TO_SHOW ? _jsx(TMFileViewer, { fileBlob: uploadedFile }) :
|
75
75
|
_jsx("div", { style: { backgroundColor: '#f6dbdb', padding: '5px 10px', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'space-between', color: TMColors.error }, children: _jsxs("div", { children: [" ", 'Anteprima non disponibile.', fileExt && _jsx("b", { children: ` (*.${fileExt})` })] }) })] });
|
76
|
-
return (_jsx(
|
76
|
+
return (_jsx(TMPanel, { title: 'Caricamento File', onBack: deviceType === DeviceType.MOBILE ? () => onClose?.() : undefined, toolbar: deviceType !== DeviceType.MOBILE ? _jsx(StyledHeaderIcon, { onClick: onClose, "$color": 'white', children: _jsx(TMTooltip, { content: SDKUI_Localizator.Close, children: _jsx(IconCloseOutline, {}) }) }) : undefined, children: _jsxs("div", { style: { width: '100%', height: '100%', padding: '2px', display: 'flex', flexDirection: 'column', gap: 10 }, children: [_jsx(HiddenInput, { id: "fileInput", type: "file", onChange: handleInputChange }), content] }) }));
|
77
77
|
};
|
78
78
|
const UploadContainer = styled.div `
|
79
79
|
position: relative;
|
@@ -5,7 +5,7 @@ import { ContextMenu } from 'devextreme-react';
|
|
5
5
|
import { TMNothingToShow } from './TMDcmtPreview';
|
6
6
|
import TMDcmtForm from './TMDcmtForm';
|
7
7
|
import TMSearchResult from '../search/TMSearchResult';
|
8
|
-
import { genUniqueId, getExceptionMessage, IconFolder, IconShow, IconPreview, IconBoard, IconDcmtTypeSys, IconCheckFile, IconDetailDcmts, SDKUI_Localizator, svgToString, IconMail, IconDcmtTypeOnlyMetadata, IconCopy, IconMultipleSelection, IconMenuVertical } from '../../../helper';
|
8
|
+
import { genUniqueId, getExceptionMessage, IconFolder, IconShow, IconPreview, IconBoard, IconDcmtTypeSys, IconCheckFile, IconDetailDcmts, SDKUI_Localizator, svgToString, IconMail, IconDcmtTypeOnlyMetadata, IconCopy, IconMultipleSelection, IconMenuVertical, SDKUI_Globals } from '../../../helper';
|
9
9
|
import { hasDetailRelations } from '../../../helper/dcmtsHelper';
|
10
10
|
import { FormModes, SearchResultContext } from '../../../ts';
|
11
11
|
import { TMColors } from '../../../utils/theme';
|
@@ -16,7 +16,6 @@ import { DeviceType } from '../../base/TMDeviceProvider';
|
|
16
16
|
import { TMSplitterLayout, TMLayoutItem } from '../../base/TMLayout';
|
17
17
|
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
18
18
|
import TMSpinner from '../../base/TMSpinner';
|
19
|
-
import TMToolbarCard from '../../base/TMToolbarCard';
|
20
19
|
import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
|
21
20
|
import { TMUserIdViewer } from '../../choosers/TMUserChooser';
|
22
21
|
import { TMResultManager } from '../../forms/TMResultDialog';
|
@@ -25,6 +24,8 @@ import TMDataListItemViewer from '../../viewers/TMDataListItemViewer';
|
|
25
24
|
import { TMDcmtTypeTooltip } from '../../viewers/TMTidViewer';
|
26
25
|
import TMTreeView from '../../base/TMTreeView';
|
27
26
|
import TMDcmtIcon from './TMDcmtIcon';
|
27
|
+
import TMPanel from '../../base/TMPanel';
|
28
|
+
import TMCommandsPanel from '../../sidebar/TMCommandsPanel';
|
28
29
|
let abortController = new AbortController();
|
29
30
|
const TMMasterDetailDcmts = ({ deviceType, inputDcmts, isForMaster, showCurrentDcmtIndicator = true, allowNavigation, canNext, canPrev, onNext, onPrev, onBack, appendMasterDcmts, onTaskCreateRequest }) => {
|
30
31
|
const [id, setID] = useState('');
|
@@ -287,14 +288,6 @@ const TMMasterDetailDcmts = ({ deviceType, inputDcmts, isForMaster, showCurrentD
|
|
287
288
|
const handleSelectedItemsChanged = useCallback((items) => {
|
288
289
|
setSelectedItems(items);
|
289
290
|
}, []);
|
290
|
-
const sideBarItems = [
|
291
|
-
{ icon: _jsx(IconShow, {}), id: 'Preview', visibleName: 'Anteprima', isActive: showPreview, onClick: () => { setShowPreview(!showPreview); } },
|
292
|
-
{ icon: _jsx(IconPreview, {}), id: 'DcmtForm', visibleName: 'Form', isActive: showDcmtForm, onClick: () => { setShowDcmtForm(!showDcmtForm); } },
|
293
|
-
{ icon: _jsx(IconBoard, {}), id: 'Board', visibleName: 'Bacheca', beginGroup: true, isActive: showBoard, onClick: () => { setShowSysMetadata(false); setShowBoard(!showBoard); } },
|
294
|
-
{ icon: _jsx(IconDcmtTypeSys, {}), id: 'SystemMetadata', visibleName: 'Metadati di sistema', isActive: showSysMetadata, onClick: () => { setShowBoard(false); setShowSysMetadata(!showSysMetadata); } },
|
295
|
-
{ icon: _jsx(IconCheckFile, {}), id: 'allowZeroRelations', visibleName: 'Consenti dettagli con 0 documenti', beginGroup: true, isActive: showZeroDcmts, onClick: () => { setShowZeroDcmts(!showZeroDcmts); } },
|
296
|
-
{ icon: _jsx(IconDetailDcmts, { fontSize: 20, transform: 'scale(-1, 1)' }), id: 'Master', beginGroup: true, visible: isForMaster, disabled: !focusedItem?.isDcmt, visibleName: SDKUI_Localizator.DcmtsMaster, onClick: () => { appendMasterDcmts?.(focusedItem?.tid, focusedItem?.did); } }
|
297
|
-
];
|
298
291
|
const commandsMenuItems = [
|
299
292
|
{
|
300
293
|
icon: svgToString(_jsx(IconMail, {})),
|
@@ -386,14 +379,29 @@ const TMMasterDetailDcmts = ({ deviceType, inputDcmts, isForMaster, showCurrentD
|
|
386
379
|
];
|
387
380
|
const toolbar = _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '10px' }, children: [allowMultipleSelection && _jsx("p", { style: { color: TMColors.colorHeader, textAlign: 'center', padding: '1px 4px', borderRadius: '3px', display: 'flex' }, children: `${selectedItems.length} selezionati` }), _jsx(TMButton, { btnStyle: 'icon', caption: 'Selezione multipla', icon: _jsx(IconMultipleSelection, { fontSize: 16, color: allowMultipleSelection ? TMColors.tertiary : 'white' }), onClick: () => setAllowMultipleSelection(!allowMultipleSelection) }), allowNavigation && canPrev != undefined && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', iconColor: 'white', isModified: false, formMode: FormModes.ReadOnly, canPrev: canPrev, onPrev: onPrev }), allowNavigation && canNext != undefined && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', iconColor: 'white', isModified: false, formMode: FormModes.ReadOnly, canNext: canNext, onNext: onNext }), _jsx(IconMenuVertical, { id: `commands-detail-${id}`, color: 'white', cursor: 'pointer' }), _jsx(ContextMenu, { showEvent: 'click', dataSource: commandsMenuItems, target: `#commands-detail-${id}` })] });
|
388
381
|
const getTitle = () => isForMaster ? `${SDKUI_Localizator.DcmtsMaster} - ${dtdMaster?.nameLoc}` : SDKUI_Localizator.DcmtsDetail;
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
382
|
+
const isMobile = deviceType === DeviceType.MOBILE;
|
383
|
+
return (_jsxs("div", { style: {
|
384
|
+
display: 'flex',
|
385
|
+
flexDirection: isMobile ? 'column' : 'row',
|
386
|
+
justifyContent: 'space-between',
|
387
|
+
gap: SDKUI_Globals.userSettings.themeSettings.gutters,
|
388
|
+
width: '100%',
|
389
|
+
height: '100%',
|
390
|
+
}, children: [_jsx("div", { style: { flex: 1, minWidth: 0, height: '100%' }, children: _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, isCancelable: true, abortController: abortController, children: _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorColor: 'transparent', showSeparator: focusedItem != undefined, separatorActiveColor: 'transparent', min: ['0', '0'], start: focusedItem && (showDcmtForm || showPreview || showBoard || showSysMetadata) ? deviceType != DeviceType.MOBILE ? ["40%", "60%"] : ["0%", "100%"] : ["100%", "0%"], children: [_jsx(TMPanel, { title: getTitle(), toolbar: toolbar, onBack: onBack, children: isLoading ? _jsx(_Fragment, {}) :
|
391
|
+
data.length <= 0
|
392
|
+
?
|
393
|
+
_jsx(TMNothingToShow, { text: getTitle(), secondText: SDKUI_Localizator.NoDataToDisplay, icon: isForMaster ? _jsx(IconDetailDcmts, { fontSize: 96, transform: 'scale(-1, 1)' }) : _jsx(IconDetailDcmts, { fontSize: 96 }) })
|
394
|
+
:
|
395
|
+
_jsx(TMTreeView, { dataSource: data, allowMultipleSelection: allowMultipleSelection, calculateItemsForNode: calculateItemsForNode, itemRender: renderItem, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectionChanged: handleSelectedItemsChanged, onDataChanged: (items) => setData(updateHiddenProperty(items)) }) }), _jsx(TMLayoutItem, { children: focusedItem?.isDcmt ?
|
396
|
+
_jsx(TMDcmtForm, { TID: focusedItem?.tid, DID: focusedItem.did, isClosable: deviceType !== DeviceType.MOBILE, allowNavigation: false, allowRelations: deviceType !== DeviceType.MOBILE, showDcmtFormSidebar: deviceType === DeviceType.MOBILE, showPreview: showPreview, showBoard: showBoard, showSysMetadata: showSysMetadata, showDcmtForm: showDcmtForm, onClose: () => { setShowDcmtForm(false); }, onClosePreview: () => { setShowPreview(false); } }) :
|
397
|
+
_jsx(TMSearchResult, { context: SearchResultContext.METADATA_SEARCH, searchResults: focusedItem?.searchResult ?? [], showSearchResultSidebar: false, onClose: () => { setShowDcmtForm(false); }, onClosePreview: () => { setShowPreview(false); }, onTaskCreateRequest: onTaskCreateRequest }) })] }, "TMDetails-panel") }) }), _jsx(TMCommandsPanel, { isMobile: isMobile, items: [
|
398
|
+
{ icon: _jsx(IconShow, { fontSize: 20 }), selected: showPreview, onClick: () => { setShowPreview(!showPreview); } },
|
399
|
+
{ icon: _jsx(IconPreview, { fontSize: 20 }), selected: showDcmtForm, onClick: () => { setShowDcmtForm(!showDcmtForm); } },
|
400
|
+
{ icon: _jsx(IconBoard, { fontSize: 20 }), selected: showBoard, onClick: () => { setShowSysMetadata(false); setShowBoard(!showBoard); } },
|
401
|
+
{ icon: _jsx(IconDcmtTypeSys, { fontSize: 20 }), selected: showSysMetadata, onClick: () => { setShowBoard(false); setShowSysMetadata(!showSysMetadata); } },
|
402
|
+
{ icon: _jsx(IconCheckFile, { fontSize: 20 }), selected: showZeroDcmts, onClick: () => { setShowZeroDcmts(!showZeroDcmts); } },
|
403
|
+
{ icon: _jsx(IconDetailDcmts, { fontSize: 20, transform: 'scale(-1, 1)' }), disabled: !focusedItem?.isDcmt, onClick: () => { appendMasterDcmts?.(focusedItem?.tid, focusedItem?.did); } }
|
404
|
+
] })] }));
|
397
405
|
};
|
398
406
|
export default TMMasterDetailDcmts;
|
399
407
|
function getMetadataKeys(obj) {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { jsx as _jsx,
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
2
|
import { useCallback, useEffect, useState } from 'react';
|
3
3
|
import { SavedQueryCacheService, DcmtTypeListCacheService, SDK_Localizator } from '@topconsultnpm/sdk-ts-beta';
|
4
4
|
import TMSavedQuerySelector from './TMSavedQuerySelector';
|
@@ -6,12 +6,14 @@ import TMTreeSelector from './TMTreeSelector';
|
|
6
6
|
import { TabPanel, Item } from 'devextreme-react/tab-panel';
|
7
7
|
import TMSearchQueryPanel, { refreshLastSearch } from './TMSearchQueryPanel';
|
8
8
|
import { getSysAllDcmtsSQD, IconProgressReady, IconSavedQuery, IconSearch, IconTree, SDKUI_Globals, SDKUI_Localizator } from '../../../helper';
|
9
|
+
import { TMLayoutItem, TMSplitterLayout } from '../../base/TMLayout';
|
10
|
+
import TMPanel from '../../base/TMPanel';
|
9
11
|
import TMSearchResult from './TMSearchResult';
|
10
12
|
import TMRecentsManager from '../../grids/TMRecentsManager';
|
11
13
|
import { SearchResultContext } from '../../../ts';
|
12
14
|
import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
|
13
15
|
import { StyledMultiViewPanel } from '../../base/Styled';
|
14
|
-
import
|
16
|
+
import TMCommandsPanel from '../../sidebar/TMCommandsPanel';
|
15
17
|
var TMSearchViews;
|
16
18
|
(function (TMSearchViews) {
|
17
19
|
TMSearchViews[TMSearchViews["None"] = 0] = "None";
|
@@ -27,158 +29,13 @@ const TMSearch = ({ inputTID, inputSqdID, isExpertMode = SDKUI_Globals.userSetti
|
|
27
29
|
const [searchResult, setSearchResult] = useState([]);
|
28
30
|
const [mruTIDs, setMruTIDs] = useState([]);
|
29
31
|
const [currentSearchView, setCurrentSearchView] = useState(TMSearchViews.None);
|
32
|
+
const [showDistinctValuesPanel, setShowDistinctValuesPanel] = useState(false);
|
33
|
+
const [showTreesPanel, setShowTreesPanel] = useState(true);
|
34
|
+
const [showRecentsPanel, setShowRecentsPanel] = useState(true);
|
35
|
+
const [showSavedQueryPanel, setShowSavedQueryPanel] = useState(true);
|
30
36
|
const [currentSQDMode, setCurrentSQDMode] = useState(1);
|
31
37
|
const [lastQdSearched, setLastQdSearched] = useState();
|
32
38
|
const deviceType = useDeviceType();
|
33
|
-
const panelMatrixMap = new Map([
|
34
|
-
[
|
35
|
-
"column-0",
|
36
|
-
{
|
37
|
-
width: "20%",
|
38
|
-
rows: [
|
39
|
-
{
|
40
|
-
id: 'treeSelector',
|
41
|
-
height: '100%',
|
42
|
-
width: '100%',
|
43
|
-
content: (togglePanelVisibility) => _jsx(TMTreeSelector, { onClose: () => togglePanelVisibility({
|
44
|
-
id: 'toolbar-item-treeSelector',
|
45
|
-
icon: 'optionsgear',
|
46
|
-
tooltipName: SDK_Localizator.Trees,
|
47
|
-
panelManagerMatrixRowId: 'treeSelector',
|
48
|
-
}), onSelectedTIDChanged: (tid) => {
|
49
|
-
setCurrentTID(tid);
|
50
|
-
if (tid && mruTIDs.includes(tid))
|
51
|
-
setCurrentMruTID(tid);
|
52
|
-
else
|
53
|
-
setCurrentMruTID(0);
|
54
|
-
} }),
|
55
|
-
hidden: false
|
56
|
-
}
|
57
|
-
],
|
58
|
-
}
|
59
|
-
],
|
60
|
-
[
|
61
|
-
"column-1",
|
62
|
-
{
|
63
|
-
width: "20%",
|
64
|
-
rows: [
|
65
|
-
{
|
66
|
-
id: 'recentsManager',
|
67
|
-
height: '100%',
|
68
|
-
width: '100%',
|
69
|
-
content: (togglePanelVisibility) => _jsx(TMRecentsManager, { mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => {
|
70
|
-
setCurrentMruTID(tid);
|
71
|
-
setCurrentTID(tid);
|
72
|
-
togglePanelVisibility({
|
73
|
-
id: 'toolbar-item-searchQueryPanel',
|
74
|
-
icon: _jsx(IconSearch, {}),
|
75
|
-
tooltipName: SDKUI_Localizator.Search,
|
76
|
-
panelManagerMatrixRowId: 'searchQueryPanel',
|
77
|
-
// visible: deviceType === DeviceType.MOBILE
|
78
|
-
});
|
79
|
-
}, onDeletedTID: (tid) => {
|
80
|
-
let newMruTIDS = mruTIDs.slice();
|
81
|
-
let index = newMruTIDS.findIndex(o => o == tid);
|
82
|
-
if (index >= 0)
|
83
|
-
newMruTIDS.splice(index, 1);
|
84
|
-
SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS.filter(tid => tid != undefined && tid != null);
|
85
|
-
setMruTIDs(newMruTIDS);
|
86
|
-
} }),
|
87
|
-
hidden: false,
|
88
|
-
panel: {
|
89
|
-
title: "Scorciatoie",
|
90
|
-
totalItems: mruTIDs.length
|
91
|
-
}
|
92
|
-
}
|
93
|
-
],
|
94
|
-
}
|
95
|
-
],
|
96
|
-
[
|
97
|
-
"column-2",
|
98
|
-
{
|
99
|
-
width: "40%",
|
100
|
-
rows: [
|
101
|
-
{
|
102
|
-
id: 'searchQueryPanel',
|
103
|
-
height: '100%',
|
104
|
-
width: '100%',
|
105
|
-
content: _jsx(TMSearchQueryPanel, { isExpertMode: isExpertMode, fromDTD: fromDTD, SQD: currentSQD, onBack: deviceType !== DeviceType.DESKTOP ? () => { setCurrentTID(0); } : undefined, onSearchCompleted: (searchResult, qd) => {
|
106
|
-
setSearchResult(searchResult);
|
107
|
-
if (searchResult.length <= 0)
|
108
|
-
return;
|
109
|
-
setLastQdSearched(qd);
|
110
|
-
setCurrentSearchView(TMSearchViews.Result);
|
111
|
-
// Salvataggio ultimi 10 TIDs
|
112
|
-
let fromTID = searchResult?.[0].fromTID;
|
113
|
-
let newMruTIDS = mruTIDs.slice();
|
114
|
-
let index = newMruTIDS.findIndex(o => o == fromTID);
|
115
|
-
if (index >= 0)
|
116
|
-
newMruTIDS.splice(index, 1);
|
117
|
-
if (newMruTIDS.length >= 10)
|
118
|
-
newMruTIDS.splice(0, 1);
|
119
|
-
newMruTIDS.push(fromTID);
|
120
|
-
setMruTIDs(newMruTIDS);
|
121
|
-
setCurrentMruTID(fromTID);
|
122
|
-
SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS.filter(tid => tid != undefined && tid != null);
|
123
|
-
}, onSqdSaved: async (newSqd) => {
|
124
|
-
await loadDataSQDsAsync(true, newSqd.masterTID);
|
125
|
-
await setSQDAsync(newSqd);
|
126
|
-
} }),
|
127
|
-
hidden: false
|
128
|
-
}
|
129
|
-
],
|
130
|
-
}
|
131
|
-
],
|
132
|
-
[
|
133
|
-
"column-4",
|
134
|
-
{
|
135
|
-
width: "20%",
|
136
|
-
rows: [
|
137
|
-
{
|
138
|
-
id: 'savedQuery',
|
139
|
-
height: '100%',
|
140
|
-
width: '100%',
|
141
|
-
content: _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,
|
142
|
-
// selectedId={currentSQD?.id}
|
143
|
-
onItemClick: (sqd) => onSQDItemClick(sqd, setSQDAsync), onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? undefined : currentSQD, setSQDAsync) }) })] }),
|
144
|
-
hidden: false,
|
145
|
-
panel: {
|
146
|
-
title: SDK_Localizator.SavedQueries
|
147
|
-
}
|
148
|
-
}
|
149
|
-
],
|
150
|
-
}
|
151
|
-
]
|
152
|
-
]);
|
153
|
-
const toolbar = {
|
154
|
-
items: [
|
155
|
-
{
|
156
|
-
id: 'toolbar-item-treeSelector',
|
157
|
-
icon: _jsx(IconTree, {}),
|
158
|
-
tooltipName: SDK_Localizator.Trees,
|
159
|
-
panelManagerMatrixRowId: 'treeSelector',
|
160
|
-
},
|
161
|
-
{
|
162
|
-
id: 'toolbar-item-recentsManager',
|
163
|
-
icon: _jsx(IconProgressReady, {}),
|
164
|
-
tooltipName: "Scorciatoie",
|
165
|
-
panelManagerMatrixRowId: 'recentsManager',
|
166
|
-
},
|
167
|
-
{
|
168
|
-
id: 'toolbar-item-searchQueryPanel',
|
169
|
-
icon: _jsx(IconSearch, {}),
|
170
|
-
tooltipName: SDKUI_Localizator.Search,
|
171
|
-
panelManagerMatrixRowId: 'searchQueryPanel',
|
172
|
-
visible: deviceType === DeviceType.MOBILE
|
173
|
-
},
|
174
|
-
{
|
175
|
-
id: 'toolbar-item-savedQuery',
|
176
|
-
icon: _jsx(IconSavedQuery, {}),
|
177
|
-
tooltipName: SDK_Localizator.SavedQueries,
|
178
|
-
panelManagerMatrixRowId: 'savedQuery',
|
179
|
-
}
|
180
|
-
]
|
181
|
-
};
|
182
39
|
useEffect(() => {
|
183
40
|
setMruTIDs(SDKUI_Globals.userSettings.searchSettings.mruTIDs);
|
184
41
|
loadDataSQDsAsync(false);
|
@@ -266,10 +123,82 @@ const TMSearch = ({ inputTID, inputSqdID, isExpertMode = SDKUI_Globals.userSetti
|
|
266
123
|
if (sqdToBeSet)
|
267
124
|
await setSqdAsync?.(sqdToBeSet);
|
268
125
|
}, []);
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
126
|
+
const isMobile = deviceType === DeviceType.MOBILE;
|
127
|
+
return (_jsxs(_Fragment, { children: [_jsxs(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.None, style: {
|
128
|
+
display: 'flex',
|
129
|
+
flexDirection: isMobile ? 'column' : 'row',
|
130
|
+
justifyContent: 'space-between',
|
131
|
+
gap: SDKUI_Globals.userSettings.themeSettings.gutters,
|
132
|
+
width: '100%',
|
133
|
+
height: '100%',
|
134
|
+
}, children: [_jsx("div", { style: { flex: 1, minWidth: 0, height: '100%' }, children: _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorActiveColor: 'transparent', separatorColor: 'transparent', showSeparator: deviceType !== DeviceType.MOBILE && showTreesPanel, min: ['0', '0'], start: (deviceType === DeviceType.MOBILE) ? ['100%', '0%'] : showTreesPanel ? ['20%', '80%'] : ['0%', '100%'], children: [deviceType !== DeviceType.MOBILE &&
|
135
|
+
_jsx(TMTreeSelector, { onClose: () => setShowTreesPanel(false), onSelectedTIDChanged: (tid) => {
|
136
|
+
setCurrentTID(tid);
|
137
|
+
if (tid && mruTIDs.includes(tid))
|
138
|
+
setCurrentMruTID(tid);
|
139
|
+
else
|
140
|
+
setCurrentMruTID(0);
|
141
|
+
} }), _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', showSeparator: deviceType !== DeviceType.MOBILE && showSavedQueryPanel && !showDistinctValuesPanel, separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, 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', overflow: 'visible', showSeparator: deviceType !== DeviceType.MOBILE && showRecentsPanel, separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: deviceType === DeviceType.DESKTOP ? (showRecentsPanel ? ['30%', '70%'] : ['0%', '100%']) : (currentTID ? ['0%', '100%'] : ['100%', '0%']), children: [_jsx(TMPanel, { 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) => {
|
142
|
+
let newMruTIDS = mruTIDs.slice();
|
143
|
+
let index = newMruTIDS.findIndex(o => o == tid);
|
144
|
+
if (index >= 0)
|
145
|
+
newMruTIDS.splice(index, 1);
|
146
|
+
SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS.filter(tid => tid != undefined && tid != null);
|
147
|
+
setMruTIDs(newMruTIDS);
|
148
|
+
} }) }), _jsx(TMSearchQueryPanel, { isExpertMode: isExpertMode, fromDTD: fromDTD, SQD: currentSQD, onBack: deviceType !== DeviceType.DESKTOP ? () => { setCurrentTID(0); } : undefined, onSearchCompleted: (searchResult, qd) => {
|
149
|
+
setSearchResult(searchResult);
|
150
|
+
if (searchResult.length <= 0)
|
151
|
+
return;
|
152
|
+
setLastQdSearched(qd);
|
153
|
+
setCurrentSearchView(TMSearchViews.Result);
|
154
|
+
// Salvataggio ultimi 10 TIDs
|
155
|
+
let fromTID = searchResult?.[0].fromTID;
|
156
|
+
let newMruTIDS = mruTIDs.slice();
|
157
|
+
let index = newMruTIDS.findIndex(o => o == fromTID);
|
158
|
+
if (index >= 0)
|
159
|
+
newMruTIDS.splice(index, 1);
|
160
|
+
if (newMruTIDS.length >= 10)
|
161
|
+
newMruTIDS.splice(0, 1);
|
162
|
+
newMruTIDS.push(fromTID);
|
163
|
+
setMruTIDs(newMruTIDS);
|
164
|
+
setCurrentMruTID(fromTID);
|
165
|
+
SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS.filter(tid => tid != undefined && tid != null);
|
166
|
+
}, onSqdSaved: async (newSqd) => {
|
167
|
+
await loadDataSQDsAsync(true, newSqd.masterTID);
|
168
|
+
await setSQDAsync(newSqd);
|
169
|
+
} })] }) }), _jsx(StyledMultiViewPanel, { "$isVisible": showSavedQueryPanel, children: _jsx(TMPanel, { 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,
|
170
|
+
// selectedId={currentSQD?.id}
|
171
|
+
onItemClick: (sqd) => onSQDItemClick(sqd, setSQDAsync), onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? undefined : currentSQD, setSQDAsync) }) })] }) }) })] })] }) }), _jsx(TMCommandsPanel, { isMobile: isMobile, items: [
|
172
|
+
{
|
173
|
+
icon: _jsx(IconTree, { fontSize: 20 }),
|
174
|
+
selected: showTreesPanel,
|
175
|
+
onClick: () => setShowTreesPanel(!showTreesPanel),
|
176
|
+
},
|
177
|
+
{
|
178
|
+
icon: _jsx(IconProgressReady, { fontSize: 20 }),
|
179
|
+
selected: showRecentsPanel,
|
180
|
+
onClick: () => setShowRecentsPanel(!showRecentsPanel),
|
181
|
+
},
|
182
|
+
{
|
183
|
+
icon: _jsx(IconSavedQuery, { fontSize: 20 }),
|
184
|
+
selected: showSavedQueryPanel,
|
185
|
+
onClick: () => setShowSavedQueryPanel(!showSavedQueryPanel),
|
186
|
+
},
|
187
|
+
...(searchResult.length > 0 ? [{
|
188
|
+
icon: _jsx(IconSearch, { fontSize: 20 }),
|
189
|
+
disabled: searchResult.length <= 0,
|
190
|
+
onClick: () => {
|
191
|
+
if (searchResult.length > 0) {
|
192
|
+
setCurrentSearchView(currentSearchView === TMSearchViews.None
|
193
|
+
? TMSearchViews.Result
|
194
|
+
: TMSearchViews.None);
|
195
|
+
}
|
196
|
+
},
|
197
|
+
}] : []),
|
198
|
+
] })] }), searchResult.length > 0 &&
|
199
|
+
_jsx(TMSearchResult, { isVisible: currentSearchView === TMSearchViews.Result, context: SearchResultContext.METADATA_SEARCH, searchResults: searchResult, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, onRefreshSearchAsync: async () => {
|
200
|
+
// setSearchResult([]);
|
201
|
+
setSearchResult(await refreshLastSearch(lastQdSearched) ?? []);
|
202
|
+
}, onTaskCreateRequest: onTaskCreateRequest, onClose: () => { setCurrentSearchView(TMSearchViews.None); } })] }));
|
274
203
|
};
|
275
204
|
export default TMSearch;
|
@@ -4,7 +4,7 @@ import { SDK_Globals, DataColumnTypes, MetadataDataDomains, DataListViewModes, M
|
|
4
4
|
import styled from 'styled-components';
|
5
5
|
import { getCommandsMenuItems, 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, deepCompare, getDataColumnName, searchResultDescriptorToSimpleArray, IconArchive, IconActivityLog, IconStar, IconFreeSearch, IconChevronDown, searchResultToMetadataValues } from '../../../helper';
|
7
|
+
import { genUniqueId, IconShow, IconBoard, IconDcmtTypeSys, IconDetailDcmts, SDKUI_Localizator, IconTag, IconDetails, IconCommand, IconDelete, IconRefresh, IconMenuVertical, IconDownload, IconSignature, deepCompare, getDataColumnName, searchResultDescriptorToSimpleArray, IconArchive, IconActivityLog, IconStar, IconFreeSearch, IconChevronDown, searchResultToMetadataValues, SDKUI_Globals } from '../../../helper';
|
8
8
|
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
9
9
|
import { useInputAttachmentsDialog, useInputCvtFormatDialog } from '../../../hooks/useInputDialog';
|
10
10
|
import { DcmtOperationTypes, FormModes, SearchResultContext, DownloadTypes } from '../../../ts';
|
@@ -17,7 +17,6 @@ import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
|
|
17
17
|
import { TMSplitterLayout, TMLayoutItem } from '../../base/TMLayout';
|
18
18
|
import { CustomListViewHeader } from '../../base/TMListView';
|
19
19
|
import { TMMessageBoxManager, ButtonNames } from '../../base/TMPopUp';
|
20
|
-
import TMToolbarCard from '../../base/TMToolbarCard';
|
21
20
|
import TMTooltip from '../../base/TMTooltip';
|
22
21
|
import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
|
23
22
|
import { TMUserIdViewer } from '../../choosers/TMUserChooser';
|
@@ -34,6 +33,8 @@ import TMBatchUpdateForm from '../../features/documents/TMBatchUpdateForm';
|
|
34
33
|
import TMDcmtForm from '../documents/TMDcmtForm';
|
35
34
|
import TMDcmtBlog from '../documents/TMDcmtBlog';
|
36
35
|
import TMDcmtIcon from '../documents/TMDcmtIcon';
|
36
|
+
import TMPanel from '../../base/TMPanel';
|
37
|
+
import TMCommandsPanel from '../../sidebar/TMCommandsPanel';
|
37
38
|
//#endregion region Interfaces, Types and Enums
|
38
39
|
//#region Styled Components
|
39
40
|
const StyledContainer = styled.div ` overflow: hidden; background-color: #ffffff; width: calc(100%); height: calc(100%); display: flex; gap: 10px; `;
|
@@ -82,7 +83,6 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
82
83
|
const [currentDcmt, setCurrentDcmt] = useState();
|
83
84
|
const [currentMetadataValues, setCurrentMetadataValues] = useState([]);
|
84
85
|
const [dcmtFormLayoutMode, setDcmtFormLayoutMode] = useState(LayoutModes.Update);
|
85
|
-
// const [allowMultipleSelection, setAllowMultipleSelection] = useState<boolean>(false);
|
86
86
|
const [isModifiedBatchUpdate, setIsModifiedBatchUpdate] = useState(false);
|
87
87
|
const [confirmFormat, ConfirmFormatDialog] = useInputCvtFormatDialog();
|
88
88
|
const { openConfirmAttachmentsDialog, ConfirmAttachmentsDialog } = useInputAttachmentsDialog();
|
@@ -140,14 +140,6 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
140
140
|
useEffect(() => { setIsOpenSysMetadata(showSysMetadata); }, [showSysMetadata]);
|
141
141
|
useEffect(() => { setIsOpenDcmtForm(showDcmtForm); }, [showDcmtForm]);
|
142
142
|
useEffect(() => { setIsOpenPreview(showPreview); }, [showPreview]);
|
143
|
-
const sideBarItems = [
|
144
|
-
{ icon: _jsx(IconShow, {}), id: 'Preview', visibleName: 'Anteprima', isActive: isOpenPreview, onClick: () => { setIsOpenPreview(!isOpenPreview); }, disabled: isOpenBatchUpdate || fromDTD?.archiveConstraint === ArchiveConstraints.OnlyMetadata },
|
145
|
-
{ icon: _jsx(IconBoard, {}), id: 'Board', visibleName: 'Bacheca', beginGroup: true, isActive: isOpenBoard, disabled: isOpenBatchUpdate, onClick: () => { closeMiddlePanel(); setIsOpenBoard(!isOpenBoard); } },
|
146
|
-
{ icon: _jsx(IconDcmtTypeSys, {}), id: 'SystemMetadata', visibleName: 'Metadati di sistema', isActive: isOpenSysMetadata, disabled: isOpenBatchUpdate, onClick: () => { closeMiddlePanel(); setIsOpenSysMetadata(!isOpenSysMetadata); } },
|
147
|
-
{ icon: _jsx(IconDetailDcmts, { fontSize: 20, transform: 'scale(-1, 1)' }), id: 'Master', beginGroup: true, visible: currentTIDHasMasterRelations, visibleName: SDKUI_Localizator.DcmtsMaster, disabled: isOpenBatchUpdate || !focusedItem?.DID, isActive: isOpenMaster, onClick: () => { setIsOpenMaster(!isOpenMaster); } },
|
148
|
-
{ icon: _jsx(IconDetailDcmts, { fontSize: 20 }), id: 'Details', visibleName: SDKUI_Localizator.DcmtsDetail, disabled: isOpenBatchUpdate || (!focusedItem?.DID && selectedItems.length <= 0), isActive: isOpenDetails, visible: currentTIDHasDetailRelations, onClick: () => { setIsOpenDetails(!isOpenDetails); } },
|
149
|
-
// { icon: <IconBatchUpdate fontSize={18} />, id: 'BatchUpdate', visibleName: "Modifica multipla", disabled: selectedItems.length <= 0, isActive: isOpenBatchUpdate, onClick: () => { setIsOpenBatchUpdate(!isOpenBatchUpdate) } }
|
150
|
-
];
|
151
143
|
const openFormHandler = (layoutMode) => { setIsOpenDcmtForm(true); setDcmtFormLayoutMode(layoutMode); };
|
152
144
|
const openTaskFormHandler = (value) => {
|
153
145
|
if (selectedItems.length > 1)
|
@@ -430,37 +422,67 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
430
422
|
};
|
431
423
|
if (!searchResults || searchResults.length <= 0)
|
432
424
|
return _jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%' }, children: [_jsx(IconBoard, { fontSize: 96 }), _jsx("div", { style: { fontSize: "15px", marginTop: "10px" }, children: SDKUI_Localizator.NoDcmtFound })] });
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
? _jsx(TMLayoutItem, { children: _jsx(TMToolbarCard, { padding: '0',
|
452
|
-
// color={TMColors.primaryColor}
|
453
|
-
// backgroundColor={`${TMColors.primaryColor}25`}
|
454
|
-
title: titleText(), toolbar: middlePanelToolbar, onClose: () => closeMiddlePanel(), children: (!focusedItem?.DID)
|
455
|
-
?
|
456
|
-
_jsx(TMNothingToShow, { text: 'Nessun documento selezionato.', secondText: notAvalableMsg, icon: notAvalableIcon })
|
425
|
+
const isPreviewDisabled = isOpenBatchUpdate || fromDTD?.archiveConstraint === ArchiveConstraints.OnlyMetadata;
|
426
|
+
const isBoardDisabled = isOpenBatchUpdate;
|
427
|
+
const isSysMetadataDisabled = isOpenBatchUpdate || !focusedItem?.DID;
|
428
|
+
const isDetailsDisabled = isOpenBatchUpdate || !focusedItem?.DID;
|
429
|
+
const isMasterDisabled = isOpenBatchUpdate || (!focusedItem?.DID && selectedItems.length <= 0);
|
430
|
+
const isMobile = deviceType === DeviceType.MOBILE;
|
431
|
+
return (_jsx(StyledMultiViewPanel, { "$isVisible": isVisible, children: _jsxs("div", { style: {
|
432
|
+
display: 'flex',
|
433
|
+
flexDirection: isMobile ? 'column' : 'row',
|
434
|
+
justifyContent: 'space-between',
|
435
|
+
gap: SDKUI_Globals.userSettings.themeSettings.gutters,
|
436
|
+
width: '100%',
|
437
|
+
height: '100%',
|
438
|
+
}, children: [_jsx("div", { style: { flex: 1, minWidth: 0, height: '100%' }, children: _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorActiveColor: 'transparent', separatorColor: 'transparent', showSeparator: (isOpenPreview || isOpenMiddlePanel() || isOpenBatchUpdate) && deviceType !== DeviceType.MOBILE, start: getPrimarySplitterStartLayout(), min: deviceType !== DeviceType.MOBILE && isOpenDcmtForm ? ['150px', '0'] : ['0', '0'], children: [_jsx(TMLayoutItem, { children: _jsxs(TMPanel, { toolbar: _jsxs(_Fragment, { children: [context !== SearchResultContext.METADATA_SEARCH && fromDTD?.templateTID === TemplateTIDs.WF_WIApprView && _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => setShowApprovePopup(true), onReject: () => setShowRejectPopup(true), onReAssign: () => setShowReAssignPopup(true), approveDisable: disable, rejectDisable: disable, reassignDisable: disable, infoDisable: getSelectedDcmtsOrFocused(selectedItems, focusedItem).length !== 1 }), (dcmtsReturned != dcmtsFound) && _jsx("p", { style: { backgroundColor: `white`, color: TMColors.primaryColor, textAlign: 'center', padding: '1px 4px', borderRadius: '3px', display: 'flex' }, children: `${dcmtsReturned}/${dcmtsFound} restituiti` }), context === SearchResultContext.FAVORITES_AND_RECENTS &&
|
439
|
+
_jsx("div", { style: { display: 'flex', alignItems: 'center', gap: '5px' }, children: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconDelete, { color: 'white' }), caption: "Rimuovi da " + (selectedSearchResult?.category === "Favorites" ? '"Preferiti"' : '"Recenti"'), disabled: getSelectedDcmtsOrFocused(selectedItems, focusedItem).length <= 0, onClick: removeDcmtFromFavsOrRecents }) }), _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconRefresh, { color: 'white' }), caption: SDKUI_Localizator.Refresh, onClick: onRefreshSearchAsync }), _jsx(IconMenuVertical, { id: `commands-header-${id}`, color: 'white', cursor: 'pointer' }), _jsx(CommandsContextMenu, { target: `#commands-header-${id}`, menuItems: getCommandsMenuItems(fromDTD, selectedItems, focusedItem, context, showFloatingBar, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler) })] }), onBack: !isClosable && allowBackButton() ? onBack : undefined, onClose: isClosable && allowBackButton() ? onBack : undefined,
|
440
|
+
// items={showSearchResultSidebar ? sideBarItems : undefined}
|
441
|
+
title: getTitleHeader(), showHeader: showToolbarHeader, children: [_jsxs(TMLayoutItem, { height: '100%', children: [_jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorActiveColor: 'transparent', separatorColor: 'transparent', min: ['0', '0'], showSeparator: showSelector && deviceType !== DeviceType.MOBILE, start: showSelector ? deviceType !== DeviceType.MOBILE ? ['25%', '75%'] : splitterSize : ['0%', '100%'], children: [showSelector ?
|
442
|
+
_jsx(TMLayoutItem, { children: _jsx(TMSearchResultSelector, { searchResults: currentSearchResults, onSelectionChanged: onSearchResultSelectionChanged }) })
|
457
443
|
:
|
458
|
-
_jsxs(
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
444
|
+
_jsx(_Fragment, {}), _jsxs(TMLayoutItem, { children: [_jsx(TMSearchResultGrid
|
445
|
+
// allowMultipleSelection={allowMultipleSelection}
|
446
|
+
, {
|
447
|
+
// allowMultipleSelection={allowMultipleSelection}
|
448
|
+
inputFocusedItem: focusedItem, inputSelectedItems: selectedItems, searchResult: searchResults.length > 1 ? selectedSearchResult : searchResults[0], lastUpdateSearchTime: lastUpdateSearchTime, onDblClick: () => openFormHandler(LayoutModes.Update), onContextMenuPreparing: onContextMenuPreparing, onSelectionChanged: (items) => { setSelectedItems(items); }, onVisibleItemChanged: setVisibleItems, onFocusedItemChanged: setFocusedItem }), allowFloatingBar && showFloatingBar && deviceType !== DeviceType.MOBILE &&
|
449
|
+
_jsxs(TMFloatingToolbar, { backgroundColor: TMColors.primaryColor, initialLeft: '10px', initialTop: 'calc(100% - 75px)', children: [fromDTD?.perm?.canRetrieveFile === AccessLevels.Yes && _jsx(TMButton, { btnStyle: 'icon', caption: "Download file", disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes, icon: _jsx(IconDownload, { color: 'white' }), onClick: () => { downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Dcmt); } }), _jsx(TMButton, { btnStyle: 'icon', caption: 'Firma e marca', icon: _jsx(IconSignature, { color: 'white' }), onClick: () => { ShowAlert({ message: "TODO Firma e marca ", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } }), _jsx(IconMenuVertical, { id: `commands-floating-${id}`, color: 'white', cursor: 'pointer' }), _jsx(CommandsContextMenu, { target: `#commands-floating-${id}`, menuItems: getCommandsMenuItems(fromDTD, selectedItems, focusedItem, context, showFloatingBar, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler) })] })] })] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onUpdate: onUpdate, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), op: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onUpdate: onUpdate, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), op: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onUpdate: onUpdate, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), onClose: () => setShowReAssignPopup(false) })] }), _jsx(ConfirmFormatDialog, {}), _jsx(ConfirmAttachmentsDialog, {})] }) }), isOpenBatchUpdate ?
|
450
|
+
_jsx(StyledModalContainer, { style: { backgroundColor: 'white' }, children: _jsx(TMBatchUpdateForm, { inputDcmts: getSelectionDcmtInfo(), TID: focusedItem ? focusedItem?.TID : selectedItems[0]?.TID, DID: focusedItem ? focusedItem?.DID : selectedItems[0]?.DID, onBack: () => setIsOpenBatchUpdate(false), onSavedCallbackAsync: async () => {
|
451
|
+
setIsOpenBatchUpdate(false);
|
452
|
+
setIsModifiedBatchUpdate(false);
|
453
|
+
await refreshSelectionDataRowsAsync();
|
454
|
+
}, onStatusChanged: (isModified) => { setIsModifiedBatchUpdate(isModified); } }) })
|
455
|
+
:
|
456
|
+
isOpenPreview || isOpenMiddlePanel()
|
457
|
+
? _jsx(TMLayoutItem, { children: _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorActiveColor: 'transparent', separatorColor: 'transparent', showSeparator: deviceType !== DeviceType.MOBILE && (isOpenPreview && isOpenMiddlePanel()), start: getSecondarySplitterStartLayout(), min: ['0', '0'], children: [isOpenMiddlePanel()
|
458
|
+
? _jsx(TMLayoutItem, { children: _jsx(TMPanel, { padding: '0',
|
459
|
+
// color={TMColors.primaryColor}
|
460
|
+
// backgroundColor={`${TMColors.primaryColor}25`}
|
461
|
+
title: titleText(), toolbar: middlePanelToolbar, onClose: () => closeMiddlePanel(), children: (!focusedItem?.DID)
|
462
|
+
?
|
463
|
+
_jsx(TMNothingToShow, { text: 'Nessun documento selezionato.', secondText: notAvalableMsg, icon: notAvalableIcon })
|
464
|
+
:
|
465
|
+
_jsxs(StyledContainer, { children: [isOpenBoard && _jsx(TMDcmtBlog, { tid: focusedItem?.TID, did: focusedItem?.DID }), isOpenSysMetadata &&
|
466
|
+
_jsx(TMMetadataValues, { layoutMode: LayoutModes.Update, openChooserBySingleClick: !isOpenDistinctValues, TID: focusedItem?.TID, isReadOnly: true, deviceType: deviceType, metadataValues: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [] })] }) }) })
|
467
|
+
: _jsx(_Fragment, {}), isOpenPreview
|
468
|
+
? _jsx(TMLayoutItem, { children: _jsx(TMDcmtPreview, { onClose: () => { setIsOpenPreview(false); onClosePreview?.(); }, dcmtData: currentDcmt, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev') }) })
|
469
|
+
: _jsx(_Fragment, {})] }) })
|
470
|
+
: _jsx(_Fragment, {})] }) }) }), showSearchResultSidebar && _jsx(TMCommandsPanel, { isMobile: deviceType === DeviceType.MOBILE, items: [
|
471
|
+
{ icon: _jsx(IconShow, { fontSize: 20 }), selected: isOpenPreview, disabled: isPreviewDisabled, onClick: () => { if (!isPreviewDisabled)
|
472
|
+
setIsOpenPreview(!isOpenPreview); } },
|
473
|
+
{ icon: _jsx(IconBoard, { fontSize: 20 }), selected: isOpenBoard, disabled: isBoardDisabled, onClick: () => { if (!isBoardDisabled) {
|
474
|
+
closeMiddlePanel();
|
475
|
+
setIsOpenBoard(!isOpenBoard);
|
476
|
+
} } },
|
477
|
+
{ icon: _jsx(IconDcmtTypeSys, { fontSize: 20 }), selected: isOpenSysMetadata, disabled: isSysMetadataDisabled, onClick: () => { if (!isSysMetadataDisabled) {
|
478
|
+
closeMiddlePanel();
|
479
|
+
setIsOpenSysMetadata(!isOpenSysMetadata);
|
480
|
+
} } },
|
481
|
+
...(currentTIDHasMasterRelations ? [{ icon: _jsx(IconDetailDcmts, { fontSize: 20 }), selected: isOpenMaster, disabled: isMasterDisabled, onClick: () => { if (!isMasterDisabled)
|
482
|
+
setIsOpenMaster(!isOpenMaster); } }] : []),
|
483
|
+
...(currentTIDHasDetailRelations ? [{ icon: _jsx(IconDetailDcmts, { fontSize: 20, transform: 'scale(-1, 1)' }), selected: isOpenDetails, disabled: isDetailsDisabled, onClick: () => { if (!isDetailsDisabled)
|
484
|
+
setIsOpenDetails(!isOpenDetails); } }] : []),
|
485
|
+
] }), isOpenDetails &&
|
464
486
|
_jsx(StyledModalContainer, { style: { backgroundColor: 'white' }, children: _jsx(TMMasterDetailDcmts, { deviceType: deviceType, isForMaster: false, inputDcmts: getSelectionDcmtInfo(), allowNavigation: focusedItem && selectedItems.length <= 0, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onBack: () => setIsOpenDetails(false) }) }), isOpenMaster &&
|
465
487
|
_jsxs(StyledModalContainer, { style: { backgroundColor: 'white' }, children: [_jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: getSelectionDcmtInfo(), isForMaster: true, allowNavigation: focusedItem && selectedItems.length <= 0, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onBack: () => setIsOpenMaster(false), appendMasterDcmts: handleAddItem }), secondaryMasterDcmts.length > 0 && secondaryMasterDcmts.map((dcmt, index) => {
|
466
488
|
return (_jsx(StyledModalContainer, { style: { backgroundColor: 'white' }, children: _jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: [dcmt], isForMaster: true, allowNavigation: false, onBack: () => handleRemoveItem(dcmt.TID, dcmt.DID), appendMasterDcmts: handleAddItem }) }, `${index}-${dcmt.DID}`));
|
@@ -30,7 +30,7 @@ const StyledRecentTidItem = styled.div `
|
|
30
30
|
const iconDelete = () => ReactDOMServer.renderToString(_jsx(IconDelete, {}));
|
31
31
|
const TMRecentsManager = ({ deviceType, mruTIDs, currentMruTID, onSelectedTID, onDeletedTID }) => {
|
32
32
|
const [showDcmtTypeChooser, setShowDcmtTypeChooser] = useState(false);
|
33
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { style: { overflowY: deviceType === DeviceType.MOBILE ? 'auto' : undefined, display: 'flex', flexDirection: 'column', padding: '5px' }, children: [_jsx(StyledRecentTidItem, { id: `tid-${0}`, onClick: () => { setShowDcmtTypeChooser(true); }, children: _jsx("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'center', width: '100%' }, children: _jsx("p", { style: {
|
33
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { style: { overflowY: deviceType === DeviceType.MOBILE ? 'auto' : undefined, display: 'flex', flexDirection: 'column', padding: '5px', width: '100%' }, children: [_jsx(StyledRecentTidItem, { id: `tid-${0}`, onClick: () => { setShowDcmtTypeChooser(true); }, children: _jsx("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'center', width: '100%' }, children: _jsx("p", { style: {
|
34
34
|
color: TMColors.primaryColor,
|
35
35
|
fontSize: '1rem',
|
36
36
|
fontWeight: 600,
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
export declare const StyledCommandsPanel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
3
|
+
$isMobile?: boolean;
|
4
|
+
}>> & string;
|
5
|
+
export interface TMCommandItemProps {
|
6
|
+
icon: React.ReactNode;
|
7
|
+
selected?: boolean;
|
8
|
+
disabled?: boolean;
|
9
|
+
onClick?: () => void;
|
10
|
+
}
|
11
|
+
interface TMCommandsPanelProps {
|
12
|
+
isMobile?: boolean;
|
13
|
+
items: TMCommandItemProps[];
|
14
|
+
}
|
15
|
+
declare const TMCommandsPanel: React.FC<TMCommandsPanelProps>;
|
16
|
+
export default TMCommandsPanel;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import styled from 'styled-components';
|
3
|
+
export const StyledCommandsPanel = styled.div `
|
4
|
+
display: flex;
|
5
|
+
flex-direction: ${({ $isMobile }) => ($isMobile ? 'row' : 'column')};
|
6
|
+
width: ${({ $isMobile }) => ($isMobile ? '100%' : '40px')};
|
7
|
+
height: ${({ $isMobile }) => ($isMobile ? '40px' : 'max-content')};
|
8
|
+
background: transparent linear-gradient(90deg, #E03A8B 9%, #C2388B 34%, #A63B8D 60%, #943C8D 83%, #8F3C8D 100%) 0% 0% no-repeat padding-box;
|
9
|
+
border-radius: ${({ $isMobile }) => ($isMobile ? '10px 10px 0 0' : '10px 0px 0px 10px')};
|
10
|
+
padding: 10px;
|
11
|
+
gap: 10px;
|
12
|
+
`;
|
13
|
+
const TMCommandsPanel = ({ isMobile, items }) => (_jsx(StyledCommandsPanel, { "$isMobile": isMobile, children: items.map((iconProps, idx) => (_jsx("span", { style: {
|
14
|
+
background: iconProps.selected ? 'white' : 'transparent',
|
15
|
+
borderRadius: '6px',
|
16
|
+
color: iconProps.selected ? '#E03A8B' : 'white',
|
17
|
+
opacity: iconProps.disabled ? 0.4 : 1,
|
18
|
+
cursor: iconProps.disabled ? 'not-allowed' : 'pointer',
|
19
|
+
display: 'flex',
|
20
|
+
alignItems: 'center',
|
21
|
+
justifyContent: 'center',
|
22
|
+
height: '24px',
|
23
|
+
width: '24px',
|
24
|
+
}, onClick: iconProps.disabled ? undefined : iconProps.onClick, children: iconProps.icon }, idx))) }));
|
25
|
+
export default TMCommandsPanel;
|
package/lib/helper/helpers.d.ts
CHANGED
@@ -40,3 +40,7 @@ export declare function isPositiveNumber(val: unknown): val is number;
|
|
40
40
|
export declare function sleep(ms: number): Promise<void>;
|
41
41
|
export declare const dialogConfirmOperation: (title: string, msg: string, operationAsync: () => Promise<void>) => void;
|
42
42
|
export declare function getExceptionMessage(ex: any): string;
|
43
|
+
export declare function getContrastColor(inputColor: string): {
|
44
|
+
bgColor: string;
|
45
|
+
textColor: string;
|
46
|
+
};
|
package/lib/helper/helpers.js
CHANGED
@@ -664,3 +664,39 @@ export function getExceptionMessage(ex) {
|
|
664
664
|
let msg = ex.isApiException ? ex.response.title : ex.message;
|
665
665
|
return msg ?? ex.toString();
|
666
666
|
}
|
667
|
+
export function getContrastColor(inputColor) {
|
668
|
+
let hex = inputColor;
|
669
|
+
if (!/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(inputColor)) {
|
670
|
+
const temp = document.createElement('div');
|
671
|
+
temp.style.color = inputColor;
|
672
|
+
document.body.appendChild(temp);
|
673
|
+
const rgb = getComputedStyle(temp).color;
|
674
|
+
document.body.removeChild(temp);
|
675
|
+
const regex = /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/;
|
676
|
+
const match = regex.exec(rgb);
|
677
|
+
if (match) {
|
678
|
+
const r = parseInt(match[1]).toString(16).padStart(2, '0');
|
679
|
+
const g = parseInt(match[2]).toString(16).padStart(2, '0');
|
680
|
+
const b = parseInt(match[3]).toString(16).padStart(2, '0');
|
681
|
+
hex = `#${r}${g}${b}`;
|
682
|
+
}
|
683
|
+
else {
|
684
|
+
hex = '#000000';
|
685
|
+
}
|
686
|
+
}
|
687
|
+
const color = hex.replace('#', '');
|
688
|
+
const r = parseInt(color.substring(0, 2), 16);
|
689
|
+
const g = parseInt(color.substring(2, 4), 16);
|
690
|
+
const b = parseInt(color.substring(4, 6), 16);
|
691
|
+
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
692
|
+
if (inputColor === 'transparent' || inputColor === 'rgba(255, 255, 255, 0)' || inputColor === 'none' || inputColor === 'white' || inputColor === '#ffffff' || inputColor === '#fff') {
|
693
|
+
return {
|
694
|
+
bgColor: '#aeaeae',
|
695
|
+
textColor: '#393939'
|
696
|
+
};
|
697
|
+
}
|
698
|
+
return {
|
699
|
+
bgColor: hex,
|
700
|
+
textColor: luminance > 0.6 ? '#000000' : '#FFFFFF'
|
701
|
+
};
|
702
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@topconsultnpm/sdkui-react-beta",
|
3
|
-
"version": "6.13.
|
3
|
+
"version": "6.13.26",
|
4
4
|
"description": "",
|
5
5
|
"scripts": {
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
@@ -42,7 +42,7 @@
|
|
42
42
|
"lib"
|
43
43
|
],
|
44
44
|
"dependencies": {
|
45
|
-
"@topconsultnpm/sdk-ts-beta": "
|
45
|
+
"@topconsultnpm/sdk-ts-beta": "6.13.4",
|
46
46
|
"buffer": "^6.0.3",
|
47
47
|
"devextreme": "24.2.6",
|
48
48
|
"devextreme-react": "24.2.6",
|