@topconsultnpm/sdkui-react-beta 6.16.53 → 6.16.55
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.
|
@@ -23,7 +23,7 @@ const TMDataGridExportForm = (props) => {
|
|
|
23
23
|
// Boolean state to indicate whether to export the "description" fields in data lists
|
|
24
24
|
const [exportDescriptionsForDataLists, setExportDescriptionsForDataLists] = useState(true);
|
|
25
25
|
// Boolean state to indicate whether to hide the selection and format during export
|
|
26
|
-
const [exportSelectedFormatColumns, setExportSelectedFormatColumns] = useState(
|
|
26
|
+
const [exportSelectedFormatColumns, setExportSelectedFormatColumns] = useState(false);
|
|
27
27
|
const onStatusValueChange = (e) => {
|
|
28
28
|
if (!e?.target?.value)
|
|
29
29
|
return;
|
|
@@ -70,7 +70,14 @@ const TMDataGridExportForm = (props) => {
|
|
|
70
70
|
// If exporting only selected rows, filter the dataSource accordingly; otherwise use the full dataSource
|
|
71
71
|
const rowsToExport = exportSelectedOnly ? dataSource.filter((_, idx) => selectedSet.has(idx)) : dataSource;
|
|
72
72
|
// Filter columns to only those that are visible; optionally hide 'object' data types based on the `hideSelection` flag
|
|
73
|
-
|
|
73
|
+
let visibleColumns = dataColumns.filter(col => {
|
|
74
|
+
if (!exportSelectedFormatColumns) {
|
|
75
|
+
return col.visible !== false && col.dataField !== "FILEEXT";
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
return col.visible !== false;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
74
81
|
// Function to get the value for a column and its value in a row
|
|
75
82
|
const getValue = (col, value) => {
|
|
76
83
|
// Replace raw value with corresponding label from the map if applicable
|
|
@@ -87,13 +94,14 @@ const TMDataGridExportForm = (props) => {
|
|
|
87
94
|
};
|
|
88
95
|
switch (formatSelected) {
|
|
89
96
|
case 'csv': {
|
|
90
|
-
const
|
|
97
|
+
const getHeaderName = (col) => col.caption ?? col.dataField;
|
|
98
|
+
const headers = !exportSelectedFormatColumns ? visibleColumns.map(getHeaderName) : [SDKUI_Localizator.SelectedSingular, ...visibleColumns.map(getHeaderName)];
|
|
91
99
|
const csvRows = [];
|
|
92
100
|
csvRows.push(headers.join(';'));
|
|
93
101
|
rowsToExport.forEach((item, idx) => {
|
|
94
102
|
const originalIndex = exportSelectedOnly ? selectedRowKeys[idx] : dataSource.indexOf(item);
|
|
95
103
|
const rowValues = [];
|
|
96
|
-
if (
|
|
104
|
+
if (exportSelectedFormatColumns) {
|
|
97
105
|
const status = selectedSet.has(originalIndex) ? SDKUI_Localizator.SelectedSingular : SDKUI_Localizator.Deselected;
|
|
98
106
|
rowValues.push(status || '');
|
|
99
107
|
}
|
|
@@ -116,7 +124,8 @@ const TMDataGridExportForm = (props) => {
|
|
|
116
124
|
// Map visible columns to worksheet column definitions
|
|
117
125
|
const baseColumns = visibleColumns.map(col => ({ header: col.caption !== undefined ? col.caption : col.dataField, key: col.dataField, width: 10, style: { numFmt: '@' } }));
|
|
118
126
|
// Add a selection status column at the beginning if hideSelection is false
|
|
119
|
-
|
|
127
|
+
const headers = !exportSelectedFormatColumns ? baseColumns : [{ header: SDKUI_Localizator.SelectedSingular, key: '_selected', width: 10, style: { numFmt: '@' } }, ...baseColumns];
|
|
128
|
+
worksheet.columns = headers;
|
|
120
129
|
// Style the header row cells: font, fill color, and border
|
|
121
130
|
worksheet.getRow(1).eachCell({ includeEmpty: true }, cell => {
|
|
122
131
|
cell.font = { name: 'Segoe UI', size: 9 };
|
|
@@ -129,7 +138,7 @@ const TMDataGridExportForm = (props) => {
|
|
|
129
138
|
const originalIndex = exportSelectedOnly ? selectedRowKeys[idx] : dataSource.indexOf(item);
|
|
130
139
|
const rowObj = {};
|
|
131
140
|
// Add selection status if hideSelection is false
|
|
132
|
-
if (
|
|
141
|
+
if (exportSelectedFormatColumns) {
|
|
133
142
|
rowObj._selected = selectedSet.has(originalIndex) ? SDKUI_Localizator.SelectedSingular : SDKUI_Localizator.Deselected;
|
|
134
143
|
}
|
|
135
144
|
// Add data for each visible column
|
|
@@ -184,7 +193,7 @@ const TMDataGridExportForm = (props) => {
|
|
|
184
193
|
onCloseExportForm();
|
|
185
194
|
}
|
|
186
195
|
};
|
|
187
|
-
return _jsx(TMModal, { title: `${SDKUI_Localizator.Export}`, width: '400px', height: '
|
|
196
|
+
return _jsx(TMModal, { title: `${SDKUI_Localizator.Export}`, width: '400px', height: '250px', onClose: onCloseExportForm, children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '16px', padding: '6px 12px', height: '100%', width: '100%' }, children: [_jsx("div", { style: { display: 'flex', alignItems: 'center', gap: '12px' }, children: _jsx(TMDropDown, { label: SDKUI_Localizator.Format, value: formatSelected, dataSource: formatDataSource, onValueChanged: onStatusValueChange }) }), _jsx("div", { style: { display: 'flex', alignItems: 'center', gap: '12px' }, children: _jsx(TMCheckBox, { elementStyle: {
|
|
188
197
|
opacity: selectedRowKeys.length === 0 ? 0.5 : 1,
|
|
189
198
|
cursor: selectedRowKeys.length === 0 ? 'not-allowed' : 'pointer'
|
|
190
199
|
}, label: `${SDKUI_Localizator.ExportOnlySelectedDocuments} (${selectedRowKeys.length})`, value: exportSelectedOnly, disabled: selectedRowKeys.length === 0, onValueChanged: () => { setExportSelectedOnly(prev => !prev); } }) }), _jsx("div", { style: { display: 'flex', alignItems: 'center', gap: '12px' }, children: _jsx(TMCheckBox, { label: SDKUI_Localizator.ExportDataListsDescriptionField, value: exportDescriptionsForDataLists, onValueChanged: () => { setExportDescriptionsForDataLists(prev => !prev); } }) }), _jsx("div", { style: { display: 'flex', alignItems: 'center', gap: '12px' }, children: _jsx(TMCheckBox, { label: SDKUI_Localizator.ExportSelectedColumnsAndFormatLabel, value: exportSelectedFormatColumns, onValueChanged: () => { setExportSelectedFormatColumns(prev => !prev); } }) }), _jsx("div", { style: {
|
|
@@ -189,7 +189,7 @@ const TMFileManager = (props) => {
|
|
|
189
189
|
const handleDragLeave = (e) => {
|
|
190
190
|
setIsDragging(false);
|
|
191
191
|
};
|
|
192
|
-
return _jsx(TMPanel, { title: SDKUI_Localizator.Drafts, totalItems: dcmtsFound ?? 0, showHeader: showPanel, onBack: (isMobile && openDraftList) ? onBackCallback : undefined, onClose: onClosePanel, allowMaximize: !isMobile ? allowMaximize : false, onMaximize: !isMobile ? onMaximizePanel : undefined, onHeaderDoubleClick: !isMobile ? onMaximizePanel : undefined, toolbar: toolbar, children: _jsx("div", { style: { flexDirection: "column", height: "100%", width: "100%", }, children: _jsxs(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: "flex", flexGrow: 1, height: "100%" }, children: _jsx(TMSplitterLayout, { direction: 'horizontal', showSeparator: true, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: [isLeftPanelCollapsed ? '0%' : "
|
|
192
|
+
return _jsx(TMPanel, { title: SDKUI_Localizator.Drafts, totalItems: dcmtsFound ?? 0, showHeader: showPanel, onBack: (isMobile && openDraftList) ? onBackCallback : undefined, onClose: onClosePanel, allowMaximize: !isMobile ? allowMaximize : false, onMaximize: !isMobile ? onMaximizePanel : undefined, onHeaderDoubleClick: !isMobile ? onMaximizePanel : undefined, toolbar: toolbar, children: _jsx("div", { style: { flexDirection: "column", height: "100%", width: "100%", }, children: _jsxs(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: "flex", flexGrow: 1, height: "100%" }, children: _jsx(TMSplitterLayout, { direction: 'horizontal', showSeparator: true, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: [isLeftPanelCollapsed ? '0%' : "30%", isLeftPanelCollapsed ? '100%' : "70%"], children: children }, "TMWGs-panels-treeView") }), children: [_jsxs("div", { style: {
|
|
193
193
|
height: "100%",
|
|
194
194
|
width: "100%",
|
|
195
195
|
...(isMobile && { display: openDraftList ? 'none' : 'block', transition: "opacity 0.3s ease-in-out" }),
|
|
@@ -389,6 +389,12 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
|
|
|
389
389
|
Value2asInt: newValue
|
|
390
390
|
}));
|
|
391
391
|
}, []);
|
|
392
|
+
const handleValue3asIntChange = useCallback((newValue) => {
|
|
393
|
+
setLocalItem(prevLocalItem => ({
|
|
394
|
+
...prevLocalItem,
|
|
395
|
+
Value3asInt: newValue
|
|
396
|
+
}));
|
|
397
|
+
}, []);
|
|
392
398
|
const handleTruncChange = useCallback((newValue) => {
|
|
393
399
|
setLocalItem(prevLocalItem => ({
|
|
394
400
|
...prevLocalItem,
|
|
@@ -645,8 +651,7 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
|
|
|
645
651
|
const newTos = actorsToTos(updatedRecipients);
|
|
646
652
|
handleTos2Change(newTos);
|
|
647
653
|
}, [localItem.Tos2, handleTos2Change]);
|
|
648
|
-
return (_jsxs(_Fragment, { children: [_jsx(TMTextExpression, { label: `${SDKUI_Localizator.Name} (${SDKUI_Localizator.WorkGroup})`, value: localItem.PlatformObjName, valueOrig: localItemOrig.PlatformObjName, tid: wf?.MTID, isModifiedWhen: (localItem.PlatformObjName ?? '') !== (localItemOrig.PlatformObjName ?? ''), onValueChanged: handlePlatformObjNameChange }), localItem.
|
|
649
|
-
_jsx(TMDropDown, { dataSource: dossierTypes, label: `${SDKUI_Localizator.Description} (${SDKUI_Localizator.WorkGroup})`, value: localItem.Value3asInt ?? 0, isModifiedWhen: (localItem.Value3asInt ?? 0) !== (localItemOrig.Value3asInt ?? 0) }), _jsx(TMTextExpression, { label: `${SDKUI_Localizator.Description} (${SDKUI_Localizator.WorkGroup})`, value: localItem.PlatformObjDescr, valueOrig: localItemOrig.PlatformObjDescr, tid: wf?.MTID, isModifiedWhen: (localItem.PlatformObjDescr ?? '') !== (localItemOrig.PlatformObjDescr ?? ''), onValueChanged: handlePlatformObjDescrChange }), _jsx(TMCultureIDPicker, { label: SDKUI_Localizator.Format, selectedValue: localItem.FormatCultureID, isModifiedWhen: localItem.FormatCultureID !== localItemOrig.FormatCultureID, openChooserBySingleClick: true, onSelectCultureID: handleFormatCultureIDChange }), _jsx(TMTextExpression, { label: `${SDKUI_Localizator.CommentText} (${SDKUI_Localizator.BlogCase})`, placeHolder: 'Inserisci il valore', rows: 2, value: localItem.Value1asString, valueOrig: localItemOrig.Value1asString, tid: wf?.MTID, isModifiedWhen: (localItem.Value1asString ?? '') !== (localItemOrig.Value1asString ?? ''), onValueChanged: handleValue1asStringChange }), _jsx(TMCheckBox, { value: localItem.Value1asInt ?? 0, label: SDKUI_Localizator.WorkflowAddDraftToWg, isModifiedWhen: localItem.Value1asInt !== localItemOrig.Value1asInt, onValueChanged: handleValue1asIntChange }), _jsx(TMCheckBox, { value: localItem.Value2asInt ?? 0, label: SDKUI_Localizator.WorkflowAddDcmtToWg, isModifiedWhen: localItem.Value2asInt !== localItemOrig.Value2asInt, onValueChanged: handleValue2asIntChange }), _jsx(TMCheckBox, { value: localItem.Trunc ?? 0, label: SDKUI_Localizator.TruncateString, isModifiedWhen: localItem.Trunc !== localItemOrig.Trunc, onValueChanged: handleTruncChange }), _jsxs(RecipientsContainer, { children: [_jsx(RecipientList, { recipients: tosRecipients, title: SDKUI_Localizator.OwnerName, tid: wf?.MTID, onAdd: (newRecipients) => handleAddTosRecipients(newRecipients, 0), onRemove: handleRemoveTosRecipient }), _jsx(RecipientList, { recipients: tos2Recipients, title: SDKUI_Localizator.Participants, tid: wf?.MTID, onAdd: (newRecipients) => handleAddTos2Recipients(newRecipients, 0), onRemove: handleRemoveTos2Recipient })] })] }));
|
|
654
|
+
return (_jsxs(_Fragment, { children: [_jsx(TMTextExpression, { label: `${SDKUI_Localizator.Name} (${SDKUI_Localizator.WorkGroup})`, value: localItem.PlatformObjName, valueOrig: localItemOrig.PlatformObjName, tid: wf?.MTID, isModifiedWhen: (localItem.PlatformObjName ?? '') !== (localItemOrig.PlatformObjName ?? ''), onValueChanged: handlePlatformObjNameChange }), _jsx(TMDropDown, { dataSource: dossierTypes, label: `${SDKUI_Localizator.Description} (${SDKUI_Localizator.WorkGroup})`, value: localItem.Value3asInt, isModifiedWhen: (localItem.Value3asInt ?? 0) !== (localItemOrig.Value3asInt ?? 0), onValueChanged: (e) => { handleValue3asIntChange(e.target.value); } }), _jsx(TMTextExpression, { label: `${SDKUI_Localizator.Description} (${SDKUI_Localizator.WorkGroup})`, value: localItem.PlatformObjDescr, valueOrig: localItemOrig.PlatformObjDescr, tid: wf?.MTID, isModifiedWhen: (localItem.PlatformObjDescr ?? '') !== (localItemOrig.PlatformObjDescr ?? ''), onValueChanged: handlePlatformObjDescrChange }), _jsx(TMCultureIDPicker, { label: SDKUI_Localizator.Format, selectedValue: localItem.FormatCultureID, isModifiedWhen: localItem.FormatCultureID !== localItemOrig.FormatCultureID, openChooserBySingleClick: true, onSelectCultureID: handleFormatCultureIDChange }), _jsx(TMTextExpression, { label: `${SDKUI_Localizator.CommentText} (${SDKUI_Localizator.BlogCase})`, placeHolder: 'Inserisci il valore', rows: 2, value: localItem.Value1asString, valueOrig: localItemOrig.Value1asString, tid: wf?.MTID, isModifiedWhen: (localItem.Value1asString ?? '') !== (localItemOrig.Value1asString ?? ''), onValueChanged: handleValue1asStringChange }), _jsx(TMCheckBox, { value: localItem.Value1asInt ?? 0, label: SDKUI_Localizator.WorkflowAddDraftToWg, isModifiedWhen: localItem.Value1asInt !== localItemOrig.Value1asInt, onValueChanged: handleValue1asIntChange }), _jsx(TMCheckBox, { value: localItem.Value2asInt ?? 0, label: SDKUI_Localizator.WorkflowAddDcmtToWg, isModifiedWhen: localItem.Value2asInt !== localItemOrig.Value2asInt, onValueChanged: handleValue2asIntChange }), _jsx(TMCheckBox, { value: localItem.Trunc ?? 0, label: SDKUI_Localizator.TruncateString, isModifiedWhen: localItem.Trunc !== localItemOrig.Trunc, onValueChanged: handleTruncChange }), _jsxs(RecipientsContainer, { children: [_jsx(RecipientList, { recipients: tosRecipients, title: SDKUI_Localizator.OwnerName, tid: wf?.MTID, onAdd: (newRecipients) => handleAddTosRecipients(newRecipients, 0), onRemove: handleRemoveTosRecipient }), _jsx(RecipientList, { recipients: tos2Recipients, title: SDKUI_Localizator.Participants, tid: wf?.MTID, onAdd: (newRecipients) => handleAddTos2Recipients(newRecipients, 0), onRemove: handleRemoveTos2Recipient })] })] }));
|
|
650
655
|
};
|
|
651
656
|
const renderAddPartsFields = () => {
|
|
652
657
|
const { andRecipients: tosRecipients } = useMemo(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useState } from 'react';
|
|
2
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import TMButton from '../../../base/TMButton';
|
|
5
5
|
import { IconAdd, IconDelete, SDKUI_Localizator } from '../../../../helper';
|
|
@@ -42,6 +42,11 @@ const RecipientItem = styled.div `
|
|
|
42
42
|
display: flex;
|
|
43
43
|
align-items: center;
|
|
44
44
|
gap: 5px;
|
|
45
|
+
padding: 2px 5px;
|
|
46
|
+
border-radius: 3px;
|
|
47
|
+
|
|
48
|
+
background-color: ${props => props.$isSelected ? '#e6f7ff' : 'transparent'};
|
|
49
|
+
border: ${props => props.$isSelected ? '1px solid #91d5ff' : '1px solid transparent'};
|
|
45
50
|
`;
|
|
46
51
|
const FloatingMenu = styled.div `
|
|
47
52
|
position: absolute;
|
|
@@ -70,6 +75,7 @@ const RecipientList = ({ recipients, title, tid, qd, onAdd, onRemove, onQDChange
|
|
|
70
75
|
showGroupChooser: false,
|
|
71
76
|
showMetadataChooser: false,
|
|
72
77
|
showQdEditor: false,
|
|
78
|
+
selectedRecipientIndex: null,
|
|
73
79
|
});
|
|
74
80
|
const menuRef = useOutsideClick(() => setUiState(prevState => ({ ...prevState, isMenuOpen: false })));
|
|
75
81
|
const handleQdChosen = useCallback((newQd) => {
|
|
@@ -120,6 +126,21 @@ const RecipientList = ({ recipients, title, tid, qd, onAdd, onRemove, onQDChange
|
|
|
120
126
|
const handleAddClick = () => {
|
|
121
127
|
setUiState(prevState => ({ ...prevState, isMenuOpen: !prevState.isMenuOpen }));
|
|
122
128
|
};
|
|
129
|
+
const handleRecipientClick = useCallback((index) => {
|
|
130
|
+
setUiState(prevState => ({
|
|
131
|
+
...prevState,
|
|
132
|
+
selectedRecipientIndex: prevState.selectedRecipientIndex === index ? null : index // Deseleziona se già selezionato, altrimenti seleziona
|
|
133
|
+
}));
|
|
134
|
+
}, []);
|
|
135
|
+
const handleKeyPress = useCallback((event) => {
|
|
136
|
+
if (event.key === 'Delete' && uiState.selectedRecipientIndex !== null) {
|
|
137
|
+
const recipientToRemove = recipients[uiState.selectedRecipientIndex];
|
|
138
|
+
if (recipientToRemove) {
|
|
139
|
+
onRemove(recipientToRemove);
|
|
140
|
+
setUiState(prevState => ({ ...prevState, selectedRecipientIndex: null })); // Resetta la selezione dopo la rimozione
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}, [uiState.selectedRecipientIndex, recipients, onRemove]);
|
|
123
144
|
const openChooser = useCallback((chooser) => {
|
|
124
145
|
setUiState(prevState => ({
|
|
125
146
|
...prevState,
|
|
@@ -166,7 +187,17 @@ const RecipientList = ({ recipients, title, tid, qd, onAdd, onRemove, onQDChange
|
|
|
166
187
|
];
|
|
167
188
|
return (_jsx(FloatingMenu, { ref: menuRef, children: menuItems.map((item, index) => (_jsx(FloatingMenuButton, { btnStyle: 'text', caption: item.caption, onClick: item.onClick }, index))) }));
|
|
168
189
|
};
|
|
169
|
-
|
|
190
|
+
useEffect(() => {
|
|
191
|
+
document.addEventListener('keydown', handleKeyPress);
|
|
192
|
+
return () => {
|
|
193
|
+
document.removeEventListener('keydown', handleKeyPress);
|
|
194
|
+
};
|
|
195
|
+
}, [handleKeyPress]);
|
|
196
|
+
return (_jsxs(RecipientsColumn, { children: [_jsxs(HeaderContainer, { children: [_jsx("p", { style: { fontWeight: 600 }, children: title }), _jsx(TMButton, { btnStyle: 'icon', caption: 'Aggiungi destinatario', icon: _jsx(IconAdd, {}), onClick: handleAddClick }), uiState.isMenuOpen && renderFloatingMenu()] }), _jsx("div", { style: { height: '150px', overflowY: 'auto', gap: '5px', display: 'flex', flexDirection: 'column' }, children: recipients.map((recipient, index) => (_jsxs(RecipientItem, { "$isSelected": uiState.selectedRecipientIndex === index, onClick: () => handleRecipientClick(index), tabIndex: 0, children: [_jsx(IconDelete, { color: '#c00', cursor: 'pointer', onClick: (e) => {
|
|
197
|
+
e.stopPropagation();
|
|
198
|
+
onRemove(recipient);
|
|
199
|
+
setUiState(prevState => ({ ...prevState, selectedRecipientIndex: null })); // Resetta la selezione
|
|
200
|
+
} }), renderActorViewer(recipient)] }, index))) }), uiState.showUserChooser && _jsx(TMUserChooserForm, { allowMultipleSelection: true, allowSorting: true, onClose: () => setUiState(prevState => ({ ...prevState, showUserChooser: false })), onChoose: (IDs) => handleUserChosen(IDs) }), uiState.showGroupChooser && _jsx(TMGroupChooserForm, { allowMultipleSelection: true, allowSorting: true, onClose: () => setUiState(prevState => ({ ...prevState, showGroupChooser: false })), onChoose: (IDs) => handleGroupChosen(IDs) }), uiState.showMetadataChooser && tid && _jsx(TMMetadataChooserForm, { allowMultipleSelection: true, allowSorting: true, tids: [tid], onClose: () => setUiState(prevState => ({ ...prevState, showMetadataChooser: false })), onChoose: (IDs) => handleMetadataChosen(IDs) }), uiState.showQdEditor &&
|
|
170
201
|
_jsx(TMModal, { title: SDKUI_Localizator.QueryDefine, onClose: () => setUiState(prevState => ({ ...prevState, showQdEditor: false })), children: _jsx(TMQueryEditor, { inputData: qd, formMode: FormModes.Update, onApplied: handleQdChosen, onClose: () => setUiState(prevState => ({ ...prevState, showQdEditor: false })) }) })] }));
|
|
171
202
|
};
|
|
172
203
|
export default RecipientList;
|