@topconsultnpm/sdkui-react-beta 6.15.8 → 6.15.10
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/assets/icomoon.svg +96 -96
- package/lib/assets/italy.svg +16 -16
- package/lib/assets/topmedia-six.svg +65 -65
- package/lib/assets/topmeida-six-bianco.svg +65 -65
- package/lib/components/base/TMDataGrid.js +2 -2
- package/lib/components/base/TMDataGridExportForm.d.ts +15 -0
- package/lib/components/base/TMDataGridExportForm.js +178 -0
- package/lib/components/features/search/TMSearch.d.ts +1 -1
- package/lib/components/features/search/TMSearch.js +2 -2
- package/lib/components/features/search/TMSearchResult.d.ts +1 -1
- package/lib/components/features/search/TMSearchResult.js +38 -11
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
- package/lib/components/features/search/TMSearchResultsMenuItems.js +2 -2
- package/lib/helper/SDKUI_Localizator.d.ts +8 -1
- package/lib/helper/SDKUI_Localizator.js +76 -0
- package/lib/helper/TMUtils.d.ts +1 -0
- package/lib/helper/TMUtils.js +17 -0
- package/lib/services/platform_services.d.ts +1 -1
- package/package.json +2 -1
|
@@ -18,7 +18,7 @@ const TMDataGrid = React.forwardRef((props, ref) => {
|
|
|
18
18
|
// custom options
|
|
19
19
|
dataColumns = [], pageSize = TMDataGridPageSize.Large, showHeaderFilter = true, showFilterPanel = false, showLoadPanel = true, showSearchPanel = true, searchPanelToolbarPosition = 'before', counterConfig = { show: false, items: new Map() },
|
|
20
20
|
// events and callbacks
|
|
21
|
-
onSelectionChanged, onFocusedRowChanged, onRowDblClick, onRowClick, onCellClick, onOptionChanged, onContentReady, onContextMenuPreparing, onInitialized, onEditorPreparing, onCellPrepared, onRowPrepared, onRowUpdating, onRowExpanded, onRowCollapsed, onRowUpdated, onSaved, onEditCanceled, onEditingStart, onEditingChange, customizeColumns, scrolling = { mode: 'standard', useNative: SDKUI_Globals.userSettings?.themeSettings.gridSettings.useNativeScrollbar === 1 }, paging = { enabled: true, pageSize: pageSize }, pager = { visible: true, showInfo: true, showNavigationButtons: true }, selection = { mode: 'multiple', showCheckBoxesMode: "always", selectAllMode: "allPages" }, sorting, summary, stateStoring, columnChooser, grouping, groupPanel, filterRow, headerFilter, editing, rowDragging, masterDetail,
|
|
21
|
+
onSelectionChanged, onFocusedRowChanged, onRowDblClick, onRowClick, onCellClick, onOptionChanged, onContentReady, onContextMenuPreparing, onInitialized, onEditorPreparing, onCellPrepared, onRowPrepared, onRowUpdating, onRowExpanded, onRowCollapsed, onRowUpdated, onSaved, onEditCanceled, onEditingStart, onEditingChange, customizeColumns, onKeyDown, scrolling = { mode: 'standard', useNative: SDKUI_Globals.userSettings?.themeSettings.gridSettings.useNativeScrollbar === 1 }, paging = { enabled: true, pageSize: pageSize }, pager = { visible: true, showInfo: true, showNavigationButtons: true }, selection = { mode: 'multiple', showCheckBoxesMode: "always", selectAllMode: "allPages" }, sorting, summary, stateStoring, columnChooser, grouping, groupPanel, filterRow, headerFilter, editing, rowDragging, masterDetail,
|
|
22
22
|
// other properties
|
|
23
23
|
disabled = false, autoNavigateToFocusedRow = true, columnResizingMode = 'widget', columnHidingEnabled = true, columnAutoWidth = true, allowColumnResizing = true, allowColumnReordering = true, showBorders = true, showRowLines = SDKUI_Globals.userSettings?.themeSettings.gridSettings.showRowLines === 1, showColumnLines = SDKUI_Globals.userSettings?.themeSettings.gridSettings.showColumnLines === 1, showColumnHeaders = true, rowAlternationEnabled = false, wordWrapEnabled = false, noDataText,
|
|
24
24
|
// styles
|
|
@@ -155,7 +155,7 @@ const TMDataGrid = React.forwardRef((props, ref) => {
|
|
|
155
155
|
// main properties
|
|
156
156
|
keyExpr: keyExpr, dataSource: dataSource, selectedRowKeys: selectedRowKeys, focusedRowEnabled: focusedRowEnabled, hoverStateEnabled: hoverStateEnabled,
|
|
157
157
|
// events and callbacks
|
|
158
|
-
onSelectionChanged: onSelectionChangedCallback, onRowDblClick: onRowDblClickCallback, onRowPrepared: onRowPrepared, onContextMenuPreparing: onContextMenuPreparingCallback, onToolbarPreparing: onToolbarPreparingCallback, onFocusedRowChanged: onFocusedRowChanged, onRowClick: onRowClick, onCellClick: onCellClick, onOptionChanged: onOptionChanged, onContentReady: onContentReady, onInitialized: onInitialized, customizeColumns: customizeColumns, onEditorPreparing: onEditorPreparing, onCellPrepared: onCellPrepared, onRowUpdating: onRowUpdating, onRowExpanded: onRowExpanded, onRowCollapsed: onRowCollapsed, onRowUpdated: onRowUpdated, onSaved: onSaved, onEditCanceled: onEditCanceled, onEditingStart: onEditingStart, onEditingChange: onEditingChange,
|
|
158
|
+
onSelectionChanged: onSelectionChangedCallback, onRowDblClick: onRowDblClickCallback, onRowPrepared: onRowPrepared, onContextMenuPreparing: onContextMenuPreparingCallback, onToolbarPreparing: onToolbarPreparingCallback, onFocusedRowChanged: onFocusedRowChanged, onRowClick: onRowClick, onCellClick: onCellClick, onOptionChanged: onOptionChanged, onContentReady: onContentReady, onInitialized: onInitialized, customizeColumns: customizeColumns, onEditorPreparing: onEditorPreparing, onCellPrepared: onCellPrepared, onRowUpdating: onRowUpdating, onRowExpanded: onRowExpanded, onRowCollapsed: onRowCollapsed, onRowUpdated: onRowUpdated, onSaved: onSaved, onEditCanceled: onEditCanceled, onEditingStart: onEditingStart, onEditingChange: onEditingChange, onKeyDown: onKeyDown,
|
|
159
159
|
// other properties
|
|
160
160
|
disabled: disabled, autoNavigateToFocusedRow: autoNavigateToFocusedRow, focusedRowKey: focusedRowKey, columnHidingEnabled: columnHidingEnabled, columnResizingMode: columnResizingMode, columnAutoWidth: columnAutoWidth, allowColumnResizing: allowColumnResizing, allowColumnReordering: allowColumnReordering, showBorders: showBorders, showRowLines: showRowLines, showColumnLines: showColumnLines, showColumnHeaders: showColumnHeaders, rowAlternationEnabled: rowAlternationEnabled, wordWrapEnabled: wordWrapEnabled, noDataText: noDataText,
|
|
161
161
|
// styles
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IColumnProps } from 'devextreme-react/cjs/data-grid';
|
|
2
|
+
import { SearchResultDescriptor } from '@topconsultnpm/sdk-ts-beta';
|
|
3
|
+
export type FormatOption = {
|
|
4
|
+
value: 'csv' | 'xlsx' | 'xls' | 'txt';
|
|
5
|
+
display: string;
|
|
6
|
+
};
|
|
7
|
+
interface TMDataGridExportFormProps {
|
|
8
|
+
searchResult: SearchResultDescriptor;
|
|
9
|
+
dataSource: Array<any> | undefined;
|
|
10
|
+
dataColumns: Array<IColumnProps>;
|
|
11
|
+
selectedRowKeys: Array<number>;
|
|
12
|
+
onCloseExportForm: () => void;
|
|
13
|
+
}
|
|
14
|
+
declare const TMDataGridExportForm: (props: TMDataGridExportFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default TMDataGridExportForm;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Workbook } from 'exceljs';
|
|
4
|
+
import { buildValueToLabelMapFromDataColumns, getExceptionMessage, SDKUI_Localizator } from '../../helper';
|
|
5
|
+
import TMCheckBox from '../editors/TMCheckBox';
|
|
6
|
+
import TMButton from './TMButton';
|
|
7
|
+
import TMDropDown from './TMDropDown';
|
|
8
|
+
import TMModal from './TMModal';
|
|
9
|
+
import { TMExceptionBoxManager } from './TMPopUp';
|
|
10
|
+
import { ResultTypes } from '@topconsultnpm/sdk-ts-beta';
|
|
11
|
+
import TMSpinner from './TMSpinner';
|
|
12
|
+
import { TMResultManager } from '../forms/TMResultDialog';
|
|
13
|
+
const formatDataSource = [
|
|
14
|
+
{ value: 'csv', display: 'CSV' },
|
|
15
|
+
{ value: 'xlsx', display: 'XLSX' },
|
|
16
|
+
];
|
|
17
|
+
const TMDataGridExportForm = (props) => {
|
|
18
|
+
const { searchResult, dataSource, dataColumns, selectedRowKeys, onCloseExportForm } = props;
|
|
19
|
+
// State to track the selected export format (default: 'xlsx')
|
|
20
|
+
const [formatSelected, setFormatSelected] = useState('csv');
|
|
21
|
+
// Boolean state to indicate whether to export the "description" fields in data lists
|
|
22
|
+
const [exportDescriptionsForDataLists, setExportDescriptionsForDataLists] = useState(true);
|
|
23
|
+
// Boolean state to indicate whether to export only the selected items
|
|
24
|
+
const [exportSelectedOnly, setExportSelectedOnly] = useState(false);
|
|
25
|
+
// Boolean state to indicate whether to hide the selection during export
|
|
26
|
+
const [hideSelection, setHideSelection] = useState(false);
|
|
27
|
+
const onStatusValueChange = (e) => {
|
|
28
|
+
if (!e?.target?.value)
|
|
29
|
+
return;
|
|
30
|
+
setFormatSelected(e.target.value);
|
|
31
|
+
};
|
|
32
|
+
const downloadFile = (blob, extension) => {
|
|
33
|
+
const pad = (n) => n.toString().padStart(2, '0');
|
|
34
|
+
const getTimestamp = () => {
|
|
35
|
+
const now = new Date();
|
|
36
|
+
return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}_${pad(now.getHours())}-${pad(now.getMinutes())}-${pad(now.getSeconds())}`;
|
|
37
|
+
};
|
|
38
|
+
const url = URL.createObjectURL(blob);
|
|
39
|
+
const a = document.createElement('a');
|
|
40
|
+
a.href = url;
|
|
41
|
+
a.download = `${SDKUI_Localizator.SearchResult}_${getTimestamp()}.${extension}`;
|
|
42
|
+
document.body.appendChild(a);
|
|
43
|
+
a.click();
|
|
44
|
+
document.body.removeChild(a);
|
|
45
|
+
URL.revokeObjectURL(url);
|
|
46
|
+
};
|
|
47
|
+
const handleExport = async () => {
|
|
48
|
+
let result = [];
|
|
49
|
+
try {
|
|
50
|
+
TMSpinner.show({ description: SDKUI_Localizator.Loading });
|
|
51
|
+
// Exit early if dataSource or dataColumns are not defined to avoid errors
|
|
52
|
+
if (!dataSource || !dataColumns)
|
|
53
|
+
return;
|
|
54
|
+
const columns = searchResult?.dtdResult?.columns ?? [];
|
|
55
|
+
const valueToNameMap = exportDescriptionsForDataLists ? await buildValueToLabelMapFromDataColumns(columns) : new Map();
|
|
56
|
+
const selectedSet = new Set(selectedRowKeys);
|
|
57
|
+
const rowsToExport = exportSelectedOnly ? dataSource.filter((_, idx) => selectedSet.has(idx)) : dataSource;
|
|
58
|
+
const visibleColumns = dataColumns.filter(col => hideSelection ? col.visible !== false && col.dataType !== 'object' : col.visible !== false);
|
|
59
|
+
const getValue = (col, value) => {
|
|
60
|
+
let result = exportDescriptionsForDataLists ? valueToNameMap.get(value) ?? value : value;
|
|
61
|
+
if (col.dataType === 'datetime' && result) {
|
|
62
|
+
const parsedDate = new Date(result);
|
|
63
|
+
if (!isNaN(parsedDate.getTime())) {
|
|
64
|
+
result = parsedDate.toLocaleDateString('it-IT');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// Converte undefined/null in stringa vuota e rimuove eventuali virgolette doppie
|
|
68
|
+
return (result ?? '').toString().replace(/"/g, '');
|
|
69
|
+
};
|
|
70
|
+
switch (formatSelected) {
|
|
71
|
+
case 'csv': {
|
|
72
|
+
const headers = hideSelection
|
|
73
|
+
? visibleColumns.map(col => col.caption || col.dataField)
|
|
74
|
+
: [SDKUI_Localizator.SelectedSingular, ...visibleColumns.map(col => col.caption || col.dataField)];
|
|
75
|
+
const csvRows = [];
|
|
76
|
+
csvRows.push(headers.join(';'));
|
|
77
|
+
rowsToExport.forEach((item, idx) => {
|
|
78
|
+
const originalIndex = exportSelectedOnly ? selectedRowKeys[idx] : dataSource.indexOf(item);
|
|
79
|
+
const rowValues = [];
|
|
80
|
+
if (!hideSelection) {
|
|
81
|
+
const status = selectedSet.has(originalIndex) ? SDKUI_Localizator.SelectedSingular : SDKUI_Localizator.Deselected;
|
|
82
|
+
rowValues.push(status || '');
|
|
83
|
+
}
|
|
84
|
+
visibleColumns.forEach(col => {
|
|
85
|
+
if (col.dataField) {
|
|
86
|
+
rowValues.push(getValue(col, item[col.dataField]));
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
csvRows.push(rowValues.join(';'));
|
|
90
|
+
});
|
|
91
|
+
const blob = new Blob([csvRows.join('\r\n')], { type: 'text/csv;charset=utf-8;' });
|
|
92
|
+
downloadFile(blob, formatSelected);
|
|
93
|
+
result.push({ rowIndex: 1, id1: 1, id2: 0, description: SDKUI_Localizator.OperationSuccess, resultType: ResultTypes.SUCCESS });
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
case 'xlsx': {
|
|
97
|
+
// Create a new Excel workbook and add a worksheet with localized name
|
|
98
|
+
const workbook = new Workbook();
|
|
99
|
+
const worksheet = workbook.addWorksheet(SDKUI_Localizator.SearchResult);
|
|
100
|
+
// Map visible columns to worksheet column definitions
|
|
101
|
+
const baseColumns = visibleColumns.map(col => ({ header: col.caption || col.dataField, key: col.dataField, width: 10 }));
|
|
102
|
+
// Add a selection status column at the beginning if hideSelection is false
|
|
103
|
+
worksheet.columns = hideSelection ? baseColumns : [{ header: SDKUI_Localizator.SelectedSingular, key: '_selected', width: 10 }, ...baseColumns];
|
|
104
|
+
// Style the header row cells: font, fill color, and border
|
|
105
|
+
worksheet.getRow(1).eachCell({ includeEmpty: true }, cell => {
|
|
106
|
+
cell.font = { name: 'Segoe UI', size: 9 };
|
|
107
|
+
cell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'C0C0C0' } };
|
|
108
|
+
cell.border = { top: { style: 'thin' }, left: { style: 'thin' }, bottom: { style: 'thin' }, right: { style: 'thin' } };
|
|
109
|
+
});
|
|
110
|
+
// Add rows to worksheet
|
|
111
|
+
rowsToExport.forEach((item, idx) => {
|
|
112
|
+
// Get original index of the item in dataSource
|
|
113
|
+
const originalIndex = exportSelectedOnly ? selectedRowKeys[idx] : dataSource.indexOf(item);
|
|
114
|
+
const rowObj = {};
|
|
115
|
+
// Add selection status if hideSelection is false
|
|
116
|
+
if (!hideSelection) {
|
|
117
|
+
rowObj._selected = selectedSet.has(originalIndex) ? SDKUI_Localizator.SelectedSingular : SDKUI_Localizator.Deselected;
|
|
118
|
+
}
|
|
119
|
+
// Add data for each visible column
|
|
120
|
+
visibleColumns.forEach(col => {
|
|
121
|
+
if (col.dataField) {
|
|
122
|
+
rowObj[col.dataField] = getValue(col, item[col.dataField]);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
worksheet.addRow(rowObj);
|
|
126
|
+
});
|
|
127
|
+
// Adjust column widths based on header and cell contents without iterating each cell manually
|
|
128
|
+
worksheet.columns.forEach(col => {
|
|
129
|
+
if (!col || !col.header || !col.key)
|
|
130
|
+
return;
|
|
131
|
+
const headerLength = col.header.toString().length;
|
|
132
|
+
// 'getColumn' accetta solo string | number, col.key è garantito perché controllato sopra
|
|
133
|
+
const maxDataLength = worksheet.getColumn(col.key).values.reduce((max, val) => {
|
|
134
|
+
const strVal = val !== undefined && val !== null ? val.toString() : '';
|
|
135
|
+
const length = strVal.length;
|
|
136
|
+
return length > max ? length : max;
|
|
137
|
+
}, 0);
|
|
138
|
+
col.width = Math.max(headerLength, maxDataLength) + 2;
|
|
139
|
+
});
|
|
140
|
+
// Apply font and border styling to all cells in all rows in a single pass
|
|
141
|
+
worksheet.eachRow((row) => {
|
|
142
|
+
row.eachCell({ includeEmpty: true }, cell => {
|
|
143
|
+
cell.font = { name: 'Segoe UI', size: 9 };
|
|
144
|
+
cell.border = { top: { style: 'thin' }, left: { style: 'thin' }, bottom: { style: 'thin' }, right: { style: 'thin' } };
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
// Generate Excel file as a buffer
|
|
148
|
+
const buffer = await workbook.xlsx.writeBuffer();
|
|
149
|
+
// Create a Blob from the buffer for downloading
|
|
150
|
+
const blob = new Blob([buffer], { type: 'application/octet-stream' });
|
|
151
|
+
// Trigger the file download with extension 'xlsx'
|
|
152
|
+
downloadFile(blob, formatSelected);
|
|
153
|
+
result.push({ rowIndex: 1, id1: 1, id2: 0, description: SDKUI_Localizator.OperationSuccess, resultType: ResultTypes.SUCCESS });
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
default:
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
result.push({ rowIndex: 1, id1: 1, id2: 0, resultType: ResultTypes.ERROR, description: getExceptionMessage(error) });
|
|
162
|
+
// Show any exceptions in a custom exception box
|
|
163
|
+
TMExceptionBoxManager.show({ exception: error });
|
|
164
|
+
}
|
|
165
|
+
finally {
|
|
166
|
+
TMSpinner.hide();
|
|
167
|
+
TMResultManager.show(result, SDKUI_Localizator.Export, "ID", undefined);
|
|
168
|
+
onCloseExportForm();
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
return _jsx(TMModal, { title: `${SDKUI_Localizator.Export}`, width: '400px', height: '230px', 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 }) }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '12px' }, children: [_jsx(TMCheckBox, { value: exportDescriptionsForDataLists, onValueChanged: () => { setExportDescriptionsForDataLists(prev => !prev); } }), _jsx("span", { children: SDKUI_Localizator.ExportDataListsDescriptionField })] }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '12px' }, children: [_jsx(TMCheckBox, { value: exportSelectedOnly, disabled: selectedRowKeys.length === 0, onValueChanged: () => { setExportSelectedOnly(prev => !prev); } }), _jsxs("span", { children: [SDKUI_Localizator.ExportOnlySelectedDocuments, " (", selectedRowKeys.length, ")"] })] }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '12px' }, children: [_jsx(TMCheckBox, { value: hideSelection, onValueChanged: () => { setHideSelection(prev => !prev); } }), _jsx("span", { children: SDKUI_Localizator.HideSelectionColumnsAndIcons })] }), _jsx("div", { style: {
|
|
172
|
+
display: 'flex',
|
|
173
|
+
justifyContent: 'center',
|
|
174
|
+
gap: '10px',
|
|
175
|
+
marginTop: '5px'
|
|
176
|
+
}, children: _jsx(TMButton, { caption: SDKUI_Localizator.Export, btnStyle: 'normal', color: 'success', showTooltip: false, onClick: handleExport }) })] }) });
|
|
177
|
+
};
|
|
178
|
+
export default TMDataGridExportForm;
|
|
@@ -11,7 +11,7 @@ interface ITMSearchProps {
|
|
|
11
11
|
focusedWorkingGroupId?: number;
|
|
12
12
|
fetchTreeFileSystemForWorkingGroup?: (workingGroupId: number | undefined) => Promise<void>;
|
|
13
13
|
fetchArchivedDocumentsForWorkingGroup?: (workingGroupId: number | undefined) => Promise<void>;
|
|
14
|
-
|
|
14
|
+
onFocusedItemChanged?: (tid?: number, did?: number) => void;
|
|
15
15
|
}
|
|
16
16
|
declare const TMSearch: React.FunctionComponent<ITMSearchProps>;
|
|
17
17
|
export default TMSearch;
|
|
@@ -18,7 +18,7 @@ var TMSearchViews;
|
|
|
18
18
|
TMSearchViews[TMSearchViews["Search"] = 0] = "Search";
|
|
19
19
|
TMSearchViews[TMSearchViews["Result"] = 1] = "Result";
|
|
20
20
|
})(TMSearchViews || (TMSearchViews = {}));
|
|
21
|
-
const TMSearch = ({
|
|
21
|
+
const TMSearch = ({ onFocusedItemChanged = undefined, inputTID, inputSqdID, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, onFileOpened, onRefreshAfterAddDcmtToFavs, onTaskCreateRequest, focusedWorkingGroupId = undefined, fetchTreeFileSystemForWorkingGroup, fetchArchivedDocumentsForWorkingGroup }) => {
|
|
22
22
|
const [allSQDs, setAllSQDs] = useState([]);
|
|
23
23
|
const [filteredByTIDSQDs, setFilteredByTIDSQDs] = useState([]);
|
|
24
24
|
const [currentSQD, setCurrentSQD] = useState();
|
|
@@ -202,7 +202,7 @@ const TMSearch = ({ onSearchCompleted = undefined, inputTID, inputSqdID, isExper
|
|
|
202
202
|
if (newResult.length <= 0) {
|
|
203
203
|
setCurrentSearchView(TMSearchViews.Search);
|
|
204
204
|
}
|
|
205
|
-
}, onTaskCreateRequest: onTaskCreateRequest, onClose: () => { setCurrentSearchView(TMSearchViews.Search); }, onFileOpened: onFileOpened, focusedWorkingGroupId: focusedWorkingGroupId, fetchTreeFileSystemForWorkingGroup: fetchTreeFileSystemForWorkingGroup, fetchArchivedDocumentsForWorkingGroup: fetchArchivedDocumentsForWorkingGroup,
|
|
205
|
+
}, onTaskCreateRequest: onTaskCreateRequest, onClose: () => { setCurrentSearchView(TMSearchViews.Search); }, onFileOpened: onFileOpened, focusedWorkingGroupId: focusedWorkingGroupId, fetchTreeFileSystemForWorkingGroup: fetchTreeFileSystemForWorkingGroup, fetchArchivedDocumentsForWorkingGroup: fetchArchivedDocumentsForWorkingGroup, onFocusedItemChanged: onFocusedItemChanged })] }));
|
|
206
206
|
};
|
|
207
207
|
export default TMSearch;
|
|
208
208
|
const TMTreeSelectorWrapper = ({ isMobile, onSelectedTIDChanged }) => {
|
|
@@ -28,7 +28,7 @@ interface ITMSearchResultProps {
|
|
|
28
28
|
focusedWorkingGroupId?: number;
|
|
29
29
|
fetchTreeFileSystemForWorkingGroup?: (workingGroupId: number | undefined) => Promise<void>;
|
|
30
30
|
fetchArchivedDocumentsForWorkingGroup?: (workingGroupId: number | undefined) => Promise<void>;
|
|
31
|
-
|
|
31
|
+
onFocusedItemChanged?: (tid?: number, did?: number) => void;
|
|
32
32
|
}
|
|
33
33
|
declare const TMSearchResult: React.FC<ITMSearchResultProps>;
|
|
34
34
|
export default TMSearchResult;
|
|
@@ -37,6 +37,7 @@ import ShowAlert from '../../base/TMAlert';
|
|
|
37
37
|
import TMWGsCopyMoveForm from '../wg/TMWGsCopyMoveForm';
|
|
38
38
|
import ToppyHelpCenter from '../assistant/ToppyHelpCenter';
|
|
39
39
|
import TMAccordion from '../../base/TMAccordion';
|
|
40
|
+
import TMDataGridExportForm from '../../base/TMDataGridExportForm';
|
|
40
41
|
//#region Internal Components
|
|
41
42
|
const CommandsContextMenu = React.memo(({ target, menuItems, allowPin }) => {
|
|
42
43
|
return (_jsx(ContextMenu, { showEvent: 'click', dataSource: menuItems, target: `${target}` }));
|
|
@@ -59,7 +60,7 @@ const orderByName = (array) => {
|
|
|
59
60
|
return 1;
|
|
60
61
|
} return 0; });
|
|
61
62
|
};
|
|
62
|
-
const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisible = true, allowRelations = true, openDcmtFormAsModal = false, searchResults = [], showSearchResultSidebar = true, showSelector = false, groupId, title, isClosable = false, allowFloatingBar = true, showToolbarHeader = true, selectedSearchResultTID, workingGroupContext = undefined, disableAccordionIfSingleCategory = false, onRefreshAfterAddDcmtToFavs, onRefreshSearchAsync, onSelectedTIDChanged, onWFOperationCompleted, onClose, onTaskCreateRequest, onFileOpened, focusedWorkingGroupId = undefined, fetchTreeFileSystemForWorkingGroup, fetchArchivedDocumentsForWorkingGroup,
|
|
63
|
+
const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisible = true, allowRelations = true, openDcmtFormAsModal = false, searchResults = [], showSearchResultSidebar = true, showSelector = false, groupId, title, isClosable = false, allowFloatingBar = true, showToolbarHeader = true, selectedSearchResultTID, workingGroupContext = undefined, disableAccordionIfSingleCategory = false, onRefreshAfterAddDcmtToFavs, onRefreshSearchAsync, onSelectedTIDChanged, onWFOperationCompleted, onClose, onTaskCreateRequest, onFileOpened, focusedWorkingGroupId = undefined, fetchTreeFileSystemForWorkingGroup, fetchArchivedDocumentsForWorkingGroup, onFocusedItemChanged = undefined }) => {
|
|
63
64
|
const [id, setID] = useState('');
|
|
64
65
|
const [showApprovePopup, setShowApprovePopup] = useState(false);
|
|
65
66
|
const [showRejectPopup, setShowRejectPopup] = useState(false);
|
|
@@ -85,6 +86,8 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
85
86
|
const [currentMetadataValues, setCurrentMetadataValues] = useState([]);
|
|
86
87
|
const [dcmtFormLayoutMode, setDcmtFormLayoutMode] = useState(LayoutModes.Update);
|
|
87
88
|
const [isModifiedBatchUpdate, setIsModifiedBatchUpdate] = useState(false);
|
|
89
|
+
// State to control whether the export form (for exporting to Excel/CSV/txt and others) should be shown
|
|
90
|
+
const [showExportForm, setShowExportForm] = useState(false);
|
|
88
91
|
const [confirmFormat, ConfirmFormatDialog] = useInputCvtFormatDialog();
|
|
89
92
|
const { openConfirmAttachmentsDialog, ConfirmAttachmentsDialog } = useInputAttachmentsDialog();
|
|
90
93
|
const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, runOperationAsync } = useDcmtOperations();
|
|
@@ -110,10 +113,10 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
110
113
|
}, [searchResults]);
|
|
111
114
|
//Added for connector
|
|
112
115
|
useEffect(() => {
|
|
113
|
-
if (!
|
|
116
|
+
if (!onFocusedItemChanged || !currentDcmt)
|
|
114
117
|
return;
|
|
115
|
-
|
|
116
|
-
}, [currentDcmt,
|
|
118
|
+
onFocusedItemChanged(currentDcmt.did, currentDcmt.tid);
|
|
119
|
+
}, [currentDcmt, onFocusedItemChanged]);
|
|
117
120
|
useEffect(() => {
|
|
118
121
|
setFocusedItem(undefined);
|
|
119
122
|
setSelectedItems([]);
|
|
@@ -180,6 +183,12 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
180
183
|
const openDetailDcmtsFormHandler = (value) => { setIsOpenDetails(value); };
|
|
181
184
|
const openMasterDcmtsFormHandler = (value) => { setIsOpenMaster(value); };
|
|
182
185
|
const openBatchUpdateFormHandler = (value) => { setIsOpenBatchUpdate(value); };
|
|
186
|
+
const openExportForm = useCallback(() => {
|
|
187
|
+
setShowExportForm(true);
|
|
188
|
+
}, []);
|
|
189
|
+
const onCloseExportForm = useCallback(() => {
|
|
190
|
+
setShowExportForm(false);
|
|
191
|
+
}, []);
|
|
183
192
|
const getTitleHeader = () => {
|
|
184
193
|
let counters = (showSelector && disableAccordionIfSingleCategory && searchResults.length > 1) ? getSearchResultCountersSingleCategory(searchResults) : "";
|
|
185
194
|
if (title)
|
|
@@ -227,7 +236,7 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
227
236
|
return;
|
|
228
237
|
if (e.target === 'content') {
|
|
229
238
|
e.items = e.items || [];
|
|
230
|
-
const menuItems = getCommandsMenuItems(fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, showCopyMoveFormCallback);
|
|
239
|
+
const menuItems = getCommandsMenuItems(fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, showCopyMoveFormCallback, openExportForm);
|
|
231
240
|
e.items.push(...menuItems);
|
|
232
241
|
}
|
|
233
242
|
};
|
|
@@ -354,7 +363,7 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
354
363
|
}
|
|
355
364
|
};
|
|
356
365
|
const searchResutlToolbar = _jsxs(_Fragment, { children: [(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 &&
|
|
357
|
-
_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, workingGroupContext, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, showCopyMoveFormCallback) })] });
|
|
366
|
+
_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, workingGroupContext, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, showCopyMoveFormCallback, openExportForm) })] });
|
|
358
367
|
const middlePanelToolbar = _jsxs("div", { style: { width: 'max-content', display: 'flex', alignItems: 'center', gap: '10px' }, children: [_jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', isModified: false, iconColor: TMColors.default_background, formMode: FormModes.ReadOnly, canPrev: canNavigateHandler('prev'), onPrev: () => onNavigateHandler('prev') }), _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', isModified: false, iconColor: TMColors.default_background, formMode: FormModes.ReadOnly, canNext: canNavigateHandler('next'), onNext: () => onNavigateHandler('next') })] });
|
|
359
368
|
const handleAddItem = (tid, did) => {
|
|
360
369
|
let newItem = { TID: tid ?? 0, DID: did ?? 0 };
|
|
@@ -371,8 +380,8 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
371
380
|
_jsxs(_Fragment, { 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 ? ['30%', '70%'] : splitterSize : ['0%', '100%'], children: [showSelector ?
|
|
372
381
|
_jsx(TMLayoutItem, { children: _jsx(TMSearchResultSelector, { searchResults: currentSearchResults, disableAccordionIfSingleCategory: disableAccordionIfSingleCategory, selectedTID: selectedSearchResultTID, onSelectionChanged: onSearchResultSelectionChanged }) })
|
|
373
382
|
:
|
|
374
|
-
_jsx(_Fragment, {}), _jsxs(TMLayoutItem, { children: [_jsx(TMSearchResultGrid, { 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, onDownloadDcmtsAsync: async (inputDcmts, downloadType, downloadMode, _y, confirmAttachments) => await downloadDcmtsAsync(inputDcmts, downloadType, downloadMode, onFileOpened, confirmAttachments) }), allowFloatingBar && showFloatingBar && deviceType !== DeviceType.MOBILE &&
|
|
375
|
-
_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 || !focusedItem?.DID, icon: _jsx(IconDownload, { color: 'white' }), onClick: () => { downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Dcmt, "download"); } }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasDetailRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white' }), caption: SDKUI_Localizator.DcmtsDetail, onClick: () => setIsOpenDetails(true) }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasMasterRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white', transform: 'scale(-1, 1)' }), caption: SDKUI_Localizator.DcmtsMaster, onClick: () => setIsOpenMaster(true) }), _jsx(IconMenuVertical, { id: `commands-floating-${id}`, color: 'white', cursor: 'pointer' }), _jsx(CommandsContextMenu, { target: `#commands-floating-${id}`, menuItems: getCommandsMenuItems(fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, showCopyMoveFormCallback) })] })] }), "m"] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), onClose: () => setShowReAssignPopup(false) }), showMoreInfoPopup && _jsx(WorkFlowMoreInfoPopUp, { TID: focusedItem?.TID, DID: focusedItem?.DID, deviceType: deviceType, onCompleted: onWFOperationCompleted, onClose: () => setShowMoreInfoPopup(false) }), isOpenBatchUpdate && _jsx(TMBatchUpdateForm, { isModal: true, titleModal: `${SDKUI_Localizator.BatchUpdate} (${getSelectionDcmtInfo().length} documenti selezionati)`, inputDcmts: getSelectionDcmtInfo(), TID: focusedItem ? focusedItem?.TID : selectedItems[0]?.TID, DID: focusedItem ? focusedItem?.DID : selectedItems[0]?.DID, onBack: () => {
|
|
383
|
+
_jsx(_Fragment, {}), _jsxs(TMLayoutItem, { children: [_jsx(TMSearchResultGrid, { 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, onDownloadDcmtsAsync: async (inputDcmts, downloadType, downloadMode, _y, confirmAttachments) => await downloadDcmtsAsync(inputDcmts, downloadType, downloadMode, onFileOpened, confirmAttachments), showExportForm: showExportForm, onCloseExportForm: onCloseExportForm }), allowFloatingBar && showFloatingBar && deviceType !== DeviceType.MOBILE &&
|
|
384
|
+
_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 || !focusedItem?.DID, icon: _jsx(IconDownload, { color: 'white' }), onClick: () => { downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Dcmt, "download"); } }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasDetailRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white' }), caption: SDKUI_Localizator.DcmtsDetail, onClick: () => setIsOpenDetails(true) }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasMasterRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white', transform: 'scale(-1, 1)' }), caption: SDKUI_Localizator.DcmtsMaster, onClick: () => setIsOpenMaster(true) }), _jsx(IconMenuVertical, { id: `commands-floating-${id}`, color: 'white', cursor: 'pointer' }), _jsx(CommandsContextMenu, { target: `#commands-floating-${id}`, menuItems: getCommandsMenuItems(fromDTD, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, showCopyMoveFormCallback, openExportForm) })] })] }), "m"] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), onClose: () => setShowReAssignPopup(false) }), showMoreInfoPopup && _jsx(WorkFlowMoreInfoPopUp, { TID: focusedItem?.TID, DID: focusedItem?.DID, deviceType: deviceType, onCompleted: onWFOperationCompleted, onClose: () => setShowMoreInfoPopup(false) }), isOpenBatchUpdate && _jsx(TMBatchUpdateForm, { isModal: true, titleModal: `${SDKUI_Localizator.BatchUpdate} (${getSelectionDcmtInfo().length} documenti selezionati)`, inputDcmts: getSelectionDcmtInfo(), TID: focusedItem ? focusedItem?.TID : selectedItems[0]?.TID, DID: focusedItem ? focusedItem?.DID : selectedItems[0]?.DID, onBack: () => {
|
|
376
385
|
setIsOpenBatchUpdate(false);
|
|
377
386
|
}, onSavedCallbackAsync: async () => {
|
|
378
387
|
setIsOpenBatchUpdate(false);
|
|
@@ -468,7 +477,7 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
468
477
|
};
|
|
469
478
|
export default TMSearchResult;
|
|
470
479
|
const renderDcmtIcon = (cellData, onDownloadDcmtsAsync) => _jsx(TMDcmtIcon, { tid: cellData.data.TID, did: cellData.data.DID, fileExtension: cellData.data.FILEEXT, fileCount: cellData.data.FILECOUNT, isLexProt: cellData.data.IsLexProt, isMail: cellData.data.ISMAIL, isShared: cellData.data.ISSHARED, isSigned: cellData.data.ISSIGNED, downloadMode: 'openInNewWindow', onDownloadDcmtsAsync: onDownloadDcmtsAsync });
|
|
471
|
-
const TMSearchResultGrid = ({ inputFocusedItem, allowMultipleSelection = true, onFocusedItemChanged, onDownloadDcmtsAsync, onVisibleItemChanged, inputSelectedItems = [], lastUpdateSearchTime, searchResult, onContextMenuPreparing, onSelectionChanged, onDblClick }) => {
|
|
480
|
+
const TMSearchResultGrid = ({ inputFocusedItem, allowMultipleSelection = true, showExportForm = false, onCloseExportForm, onFocusedItemChanged, onDownloadDcmtsAsync, onVisibleItemChanged, inputSelectedItems = [], lastUpdateSearchTime, searchResult, onContextMenuPreparing, onSelectionChanged, onDblClick }) => {
|
|
472
481
|
const [dataSource, setDataSource] = useState();
|
|
473
482
|
const [showFilterPanel, setShowFilterPanel] = useState(false);
|
|
474
483
|
const [columns, setColumns] = useState([]);
|
|
@@ -487,6 +496,24 @@ const TMSearchResultGrid = ({ inputFocusedItem, allowMultipleSelection = true, o
|
|
|
487
496
|
return;
|
|
488
497
|
setSelectedRowKeys(inputSelectedItemsRowIndex);
|
|
489
498
|
}, [inputSelectedItems]);
|
|
499
|
+
const onKeyDown = useCallback((e) => {
|
|
500
|
+
if (e.event?.key === 'Delete') {
|
|
501
|
+
TMMessageBoxManager.show({
|
|
502
|
+
buttons: [ButtonNames.YES, ButtonNames.NO],
|
|
503
|
+
title: SDKUI_Localizator.RemoveFromList,
|
|
504
|
+
message: `${SDKUI_Localizator.ConfirmSelectedDocumentsMessage.replaceParams(selectedRowKeys.length)}`,
|
|
505
|
+
onButtonClick(e) {
|
|
506
|
+
if (e !== ButtonNames.YES)
|
|
507
|
+
return;
|
|
508
|
+
if (selectedRowKeys.length === 0)
|
|
509
|
+
return;
|
|
510
|
+
setDataSource((prevDataSource = []) => prevDataSource.filter((data) => !selectedRowKeys.includes(data.rowIndex)));
|
|
511
|
+
setSelectedRowKeys([]);
|
|
512
|
+
setFocusedItem(undefined);
|
|
513
|
+
},
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
}, [selectedRowKeys]);
|
|
490
517
|
const cellRender = useCallback((cellData, dataDomain, dataListID, dataListViewMode) => {
|
|
491
518
|
if (!cellData || cellData.value === undefined)
|
|
492
519
|
return null;
|
|
@@ -571,7 +598,7 @@ const TMSearchResultGrid = ({ inputFocusedItem, allowMultipleSelection = true, o
|
|
|
571
598
|
visible: isVisible,
|
|
572
599
|
cellRender: (cellData) => cellRender(cellData, dataDomain, dataListID, dataListViewMode),
|
|
573
600
|
caption: col.caption,
|
|
574
|
-
format: getDisplayFormat(col)
|
|
601
|
+
format: getDisplayFormat(col),
|
|
575
602
|
});
|
|
576
603
|
});
|
|
577
604
|
setColumns(cols);
|
|
@@ -637,7 +664,7 @@ const TMSearchResultGrid = ({ inputFocusedItem, allowMultipleSelection = true, o
|
|
|
637
664
|
setShowFilterPanel(!!e.value);
|
|
638
665
|
}
|
|
639
666
|
}, []);
|
|
640
|
-
return _jsx(TMDataGrid, { id: "tm-search-result", keyExpr: "rowIndex", dataColumns: dataColumns, dataSource: dataSource, repaintChangesOnly: true, selectedRowKeys: selectedRowKeys, focusedRowKey: focusedItem?.rowIndex, showSearchPanel: false, showFilterPanel: showFilterPanel, sorting: { mode: "multiple" }, selection: { mode: allowMultipleSelection ? 'multiple' : 'single' }, pageSize: TMDataGridPageSize.Small, onSelectionChanged: handleSelectionChange, onFocusedRowChanged: handleFocusedRowChange, onRowDblClick: onRowDblClick, onContentReady: onContentReady, onOptionChanged: onOptionChanged, onContextMenuPreparing: onContextMenuPreparing, counterConfig: { show: true } });
|
|
667
|
+
return _jsxs("div", { style: { width: "100%", height: "100%" }, children: [_jsx(TMDataGrid, { id: "tm-search-result", keyExpr: "rowIndex", dataColumns: dataColumns, dataSource: dataSource, repaintChangesOnly: true, selectedRowKeys: selectedRowKeys, focusedRowKey: focusedItem?.rowIndex, showSearchPanel: false, showFilterPanel: showFilterPanel, sorting: { mode: "multiple" }, selection: { mode: allowMultipleSelection ? 'multiple' : 'single' }, pageSize: TMDataGridPageSize.Small, onSelectionChanged: handleSelectionChange, onFocusedRowChanged: handleFocusedRowChange, onRowDblClick: onRowDblClick, onContentReady: onContentReady, onOptionChanged: onOptionChanged, onContextMenuPreparing: onContextMenuPreparing, onKeyDown: onKeyDown, counterConfig: { show: true } }), (showExportForm && searchResult && onCloseExportForm) && _jsx(TMDataGridExportForm, { dataColumns: dataColumns, dataSource: dataSource, selectedRowKeys: selectedRowKeys, onCloseExportForm: onCloseExportForm, searchResult: searchResult })] });
|
|
641
668
|
};
|
|
642
669
|
//#region TMSearchResultSelector
|
|
643
670
|
const StyledItemTemplate = styled.div `
|
|
@@ -3,4 +3,4 @@ import { DcmtTypeDescriptor, FileDescriptor, FileFormats, LayoutModes, WorkingGr
|
|
|
3
3
|
import { TMDataGridContextMenuItem } from '../../base/TMDataGrid';
|
|
4
4
|
import { DcmtInfo, DcmtOperationTypes, DownloadModes, DownloadTypes, SearchResultContext } from '../../../ts';
|
|
5
5
|
export declare const getSelectedDcmtsOrFocused: (selectedItems: Array<any>, focusedItem: any, fileFormat?: FileFormats) => DcmtInfo[];
|
|
6
|
-
export declare const getCommandsMenuItems: (dtd: DcmtTypeDescriptor | undefined, selectedItems: Array<any>, focusedItem: any, context: SearchResultContext, showFloatingBar: boolean, workingGroupContext: WorkingGroupDescriptor | undefined, setShowFloatingBar: React.Dispatch<React.SetStateAction<boolean>>, openFormHandler: (layoutMode: LayoutModes) => void, downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType: DownloadTypes, downloadMode: DownloadModes, onFileDownloaded?: (dcmtFile: File | undefined) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>) => Promise<void>, runOperationAsync: (inputDcmts: DcmtInfo[] | undefined, dcmtOperationType: DcmtOperationTypes, actionAfterOperationAsync?: () => Promise<void>) => Promise<void>, onRefreshSearchAsync: (() => Promise<void>) | undefined, onRefreshDataRowsAsync: (() => Promise<void>) | undefined, onRefreshAfterAddDcmtToFavs: (() => void) | undefined, confirmFormat: () => Promise<FileFormats>, confirmAttachments: (list: FileDescriptor[]) => Promise<string[] | undefined>, openTaskFormHandler: () => void, openDetailDcmtsFormHandler: (value: boolean) => void, openMasterDcmtsFormHandler: (value: boolean) => void, openBatchUpdateFormHandler: (value: boolean) => void, showCopyMoveFormCallback: (mode: "copyToWgDraft" | "copyToWgArchivedDoc") => void) => Array<TMDataGridContextMenuItem>;
|
|
6
|
+
export declare const getCommandsMenuItems: (dtd: DcmtTypeDescriptor | undefined, selectedItems: Array<any>, focusedItem: any, context: SearchResultContext, showFloatingBar: boolean, workingGroupContext: WorkingGroupDescriptor | undefined, setShowFloatingBar: React.Dispatch<React.SetStateAction<boolean>>, openFormHandler: (layoutMode: LayoutModes) => void, downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType: DownloadTypes, downloadMode: DownloadModes, onFileDownloaded?: (dcmtFile: File | undefined) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>) => Promise<void>, runOperationAsync: (inputDcmts: DcmtInfo[] | undefined, dcmtOperationType: DcmtOperationTypes, actionAfterOperationAsync?: () => Promise<void>) => Promise<void>, onRefreshSearchAsync: (() => Promise<void>) | undefined, onRefreshDataRowsAsync: (() => Promise<void>) | undefined, onRefreshAfterAddDcmtToFavs: (() => void) | undefined, confirmFormat: () => Promise<FileFormats>, confirmAttachments: (list: FileDescriptor[]) => Promise<string[] | undefined>, openTaskFormHandler: () => void, openDetailDcmtsFormHandler: (value: boolean) => void, openMasterDcmtsFormHandler: (value: boolean) => void, openBatchUpdateFormHandler: (value: boolean) => void, showCopyMoveFormCallback: (mode: "copyToWgDraft" | "copyToWgArchivedDoc") => void, openExportForm: () => void) => Array<TMDataGridContextMenuItem>;
|
|
@@ -24,7 +24,7 @@ export const getSelectedDcmtsOrFocused = (selectedItems, focusedItem, fileFormat
|
|
|
24
24
|
}
|
|
25
25
|
return [];
|
|
26
26
|
};
|
|
27
|
-
export const getCommandsMenuItems = (dtd, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, onRefreshDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, confirmAttachments, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, showCopyMoveFormCallback) => {
|
|
27
|
+
export const getCommandsMenuItems = (dtd, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, onRefreshDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, confirmAttachments, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, showCopyMoveFormCallback, openExportForm) => {
|
|
28
28
|
// let ftExplanations = focusedItem?.FTExplanations;
|
|
29
29
|
return [
|
|
30
30
|
{
|
|
@@ -385,7 +385,7 @@ export const getCommandsMenuItems = (dtd, selectedItems, focusedItem, context, s
|
|
|
385
385
|
text: SDKUI_Localizator.ExportTo,
|
|
386
386
|
operationType: 'multiRow',
|
|
387
387
|
disabled: false,
|
|
388
|
-
onClick:
|
|
388
|
+
onClick: openExportForm
|
|
389
389
|
},
|
|
390
390
|
// {
|
|
391
391
|
// icon: svgToString(<IconShow />),
|
|
@@ -83,6 +83,7 @@ export declare class SDKUI_Localizator {
|
|
|
83
83
|
static get ConfirmDownload(): string;
|
|
84
84
|
static get ConfirmPassword(): "Bestätige das Passwort" | "Confirm password" | "Confirmar Contraseña" | "Confirmez le mot de passe" | "Confirme sua senha" | "Conferma password";
|
|
85
85
|
static get ConfirmOnCancel(): "Wenn wir fortfahren, gehen die vorgenommenen Änderungen verloren. Fortfahren?" | "All modifications will be lost. Continue?" | "Si sigue adelante, se perderán las modificaciones aportadas. ¿Seguir?" | "Continuant, les changements seront perdus. Continuer?" | "Continuando as alterações feitas serão perdidas. Continuar?" | "Proseguendo le modifiche apportate andranno perse. Proseguire?";
|
|
86
|
+
static get ConfirmSelectedDocumentsMessage(): string;
|
|
86
87
|
static get Continue(): string;
|
|
87
88
|
static get ContinueOperation(): "Fortfahren?" | "Continue ?" | "¿Continuar?" | "Continuer?" | "Continuar?" | "Continuare?";
|
|
88
89
|
static get CopiedSuccessfully(): "In die Zwischenablage kopieren" | "Copied in clipboard successfully" | "Copiado en el portapapeles con éxito" | "Copié dans le presse-papiers avec succès" | "CCopiado na área de transferência com sucesso" | "Copiato negli appunti con successo";
|
|
@@ -119,6 +120,7 @@ export declare class SDKUI_Localizator {
|
|
|
119
120
|
static get DescriptionTooLongMessage(): "Die Beschreibung ist zu lang: Maximal {{0}' Zeichen" | "Description is too long: Max {{0}} characters" | "La descripción es demasiado larga: Máximo {{0}} caracteres" | "La description est trop longue : Maximum {{0}} caractères" | "A descrição é demasiado longa: Máximo {{0}} caracteres" | "La descrizione è troppo lunga: Massimo {{0}} caratteri";
|
|
120
121
|
static get Destination(): "Bestimmung" | "Destination" | "Destino" | "Destinazione";
|
|
121
122
|
static get DetailsView(): string;
|
|
123
|
+
static get Deselected(): string;
|
|
122
124
|
static get Disabled(): "Deaktiviert" | "Disabled" | "Deshabilitado" | "Désactivé" | "Desabilitado" | "Disabilitato";
|
|
123
125
|
static get DisplayFormat(): string;
|
|
124
126
|
static get DistinctValues(): "Unterschiedliche Werte" | "Distinct values" | "Valores distintos" | "Valeurs distinctes" | "Valori distinti";
|
|
@@ -149,6 +151,8 @@ export declare class SDKUI_Localizator {
|
|
|
149
151
|
static get Error(): "Fehler" | "Error" | "Erreur" | "Erro" | "Errore";
|
|
150
152
|
static get ErrorLoadingDocument(): string;
|
|
151
153
|
static get ErrorParsingFileContent(): "Fehler beim Parsen des Dateiinhalts. Stellen Sie sicher, dass die Datei im richtigen Format vorliegt." | "Error parsing the file content. Ensure the file is in the correct format." | "Error al analizar el contenido del archivo. Asegúrese de que el archivo esté en el formato correcto." | "Erreur lors de l'analyse du contenu du fichier. Assurez-vous que le fichier est dans le bon format." | "Erro ao analisar o conteúdo do arquivo. Certifique-se de que o arquivo está no formato correto." | "Errore durante l'analisi del contenuto del file. Assicurati che il file sia nel formato corretto.";
|
|
154
|
+
static get ExportDataListsDescriptionField(): "Exportiere die \"Beschreibung\"-Felder der Datenlisten" | "Export the \"description\" fields of data lists" | "Exportar los campos \"descripción\" de las listas de datos" | "Exporter les champs \"description\" des listes de données" | "Exportar os campos \"descrição\" das listas de dados" | "Esporta i campi \"descrizione\" delle liste dati";
|
|
155
|
+
static get ExportOnlySelectedDocuments(): "Nur ausgewählte Dokumente exportieren" | "Export only selected documents" | "Exportar solo los documentos seleccionados" | "Exporter uniquement les documents sélectionnés" | "Exportar apenas os documentos selecionados" | "Esporta solo i documenti selezionati";
|
|
152
156
|
static get ExtractedBy(): "Ausgezogen von" | "Extracted by" | "Extraído por" | "Extrait par" | "Estratto da";
|
|
153
157
|
static get ExtractedFromOtherUser(): string;
|
|
154
158
|
static get ExtractedOn(): "Ausgezogen am" | "Extracted on" | "Extraído el" | "Extrait le" | "Extraído em" | "Estratto il";
|
|
@@ -211,6 +215,7 @@ export declare class SDKUI_Localizator {
|
|
|
211
215
|
static get HideFormattingOptions(): "Formatierungsoptionen ausblenden" | "Hide formatting options" | "Ocultar opciones de formato" | "Masquer les options de formatage" | "Ocultar opções de formatação" | "Nascondi opzioni di formattazione";
|
|
212
216
|
static get HideMetadata(): string;
|
|
213
217
|
static get HideSearch(): "Suche ausblenden" | "Hide search" | "Ocultar búsqueda" | "Masquer la recherche" | "Ocultar pesquisa" | "Nascondi ricerca";
|
|
218
|
+
static get HideSelectionColumnsAndIcons(): "Auswahlspalten und Symbole ausblenden" | "Hide selection columns and icons" | "Ocultar columnas de selección e iconos" | "Masquer les colonnes de sélection et les icônes" | "Ocultar colunas de seleção e ícones" | "Nascondi le colonne di selezione e icone";
|
|
214
219
|
static get HistoryActionLabel(): string;
|
|
215
220
|
static get HistoryLabel(): string;
|
|
216
221
|
static get ID_Hide(): "Ausblenden ID" | "Hide ID" | "Ocultar ID" | "Masquer ID" | "Nascondi ID";
|
|
@@ -374,6 +379,7 @@ export declare class SDKUI_Localizator {
|
|
|
374
379
|
static get Relations(): "Korrelationen" | "Correlations" | "Correlaciones" | "Relations" | "Correlacionados" | "Correlazioni";
|
|
375
380
|
static get RelationManyToMany(): "Folge viele mit vielen" | "Relation many to many" | "Correlación muchos a muchos" | "Corrélation plusieurs à plusieurs" | "Muitos para muitos relação" | "Correlazione molti a molti";
|
|
376
381
|
static get RelationType(): "Art der Beziehung" | "Relation type" | "Tipo de relación" | "Type de relation" | "Tipo de relacionamento" | "Tipo di relazione";
|
|
382
|
+
static get RemoveFromList(): string;
|
|
377
383
|
static get RemoveFromWorkgroup(): string;
|
|
378
384
|
static get RemoveNamedPreferredCredentials(): "Möchten Sie die Anmeldedaten '{{0}}' entfernen, die als bevorzugt festgelegt wurden?" | "Do you want to remove the '{{0}}' credentials set as preferred?" | "¿Quieres eliminar las credenciales '{{0}}' configuradas como preferidas?" | "Voulez-vous supprimer les identifiants '{{0}}' définis comme préférés ?" | "Deseja remover as credenciais '{{0}}' definidas como preferidas?" | "Vuoi rimuovere le credenziali '{{0}}' impostate come preferite?";
|
|
379
385
|
static get RememberCredentials(): "Anmeldedaten merken" | "Remember credentials" | "Recordar credenciales" | "Se souvenir des identifiants" | "Lembrar credenciais" | "Ricorda credenziali";
|
|
@@ -410,7 +416,8 @@ export declare class SDKUI_Localizator {
|
|
|
410
416
|
static get Seconds(): "Sekunden" | "Seconds" | "Segundos" | "Secondes" | "Segundas" | "Secondi";
|
|
411
417
|
static get Select(): "Wählen Sie Ihre" | "Select" | "Seleccionar" | "Sélectionne" | "Selecione" | "Seleziona";
|
|
412
418
|
static get SelectSupportAreaMessage(): "Wählen Sie einen Ablagebereich aus" | "Select a support area" | "Seleccione un área de apoyo" | "Sélectionnez une zone de support" | "Selecione uma área de apoio" | "Selezionare un'area di appoggio";
|
|
413
|
-
static get
|
|
419
|
+
static get SelectedSingular(): string;
|
|
420
|
+
static get Selected(): "Ausgewählt" | "Selected" | "Sélectionné" | "Selecionado" | "Seleccionados" | "Selezionati";
|
|
414
421
|
static get SelectDesiredFilters(): "Wählen Sie die gewünschten Filter aus" | "Select the desired filters" | "Selecciona los filtros deseados" | "Sélectionnez les filtres souhaités" | "Selecione os filtros desejados" | "Seleziona i filtri desiderati";
|
|
415
422
|
static get SelectedItems(): "Ausgewählte Artikel" | "Selected items" | "Artículos seleccionados" | "Articles sélectionnés" | "Itens selecionados" | "Elementi selezionati";
|
|
416
423
|
static get Send(): "Senden" | "Send" | "Enviar" | "Envoyer" | "Invia";
|