@topconsultnpm/sdkui-react-beta 6.15.10 → 6.15.12
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.
|
@@ -18,10 +18,10 @@ const TMDataGridExportForm = (props) => {
|
|
|
18
18
|
const { searchResult, dataSource, dataColumns, selectedRowKeys, onCloseExportForm } = props;
|
|
19
19
|
// State to track the selected export format (default: 'xlsx')
|
|
20
20
|
const [formatSelected, setFormatSelected] = useState('csv');
|
|
21
|
+
// Boolean state to indicate whether to export only the selected items
|
|
22
|
+
const [exportSelectedOnly, setExportSelectedOnly] = useState(selectedRowKeys.length > 0 ? true : false);
|
|
21
23
|
// Boolean state to indicate whether to export the "description" fields in data lists
|
|
22
24
|
const [exportDescriptionsForDataLists, setExportDescriptionsForDataLists] = useState(true);
|
|
23
|
-
// Boolean state to indicate whether to export only the selected items
|
|
24
|
-
const [exportSelectedOnly, setExportSelectedOnly] = useState(false);
|
|
25
25
|
// Boolean state to indicate whether to hide the selection during export
|
|
26
26
|
const [hideSelection, setHideSelection] = useState(false);
|
|
27
27
|
const onStatusValueChange = (e) => {
|
|
@@ -30,10 +30,12 @@ const TMDataGridExportForm = (props) => {
|
|
|
30
30
|
setFormatSelected(e.target.value);
|
|
31
31
|
};
|
|
32
32
|
const downloadFile = (blob, extension) => {
|
|
33
|
-
const
|
|
33
|
+
const formatNumber = (n) => n.toString().padStart(2, '0');
|
|
34
34
|
const getTimestamp = () => {
|
|
35
35
|
const now = new Date();
|
|
36
|
-
|
|
36
|
+
const date = `${now.getFullYear()}-${formatNumber(now.getMonth() + 1)}-${formatNumber(now.getDate())}`;
|
|
37
|
+
const time = `${formatNumber(now.getHours())}-${formatNumber(now.getMinutes())}-${formatNumber(now.getSeconds())}`;
|
|
38
|
+
return `${date}_${time}`;
|
|
37
39
|
};
|
|
38
40
|
const url = URL.createObjectURL(blob);
|
|
39
41
|
const a = document.createElement('a');
|
|
@@ -45,12 +47,12 @@ const TMDataGridExportForm = (props) => {
|
|
|
45
47
|
URL.revokeObjectURL(url);
|
|
46
48
|
};
|
|
47
49
|
const handleExport = async () => {
|
|
50
|
+
if (!dataSource || !dataColumns)
|
|
51
|
+
return;
|
|
48
52
|
let result = [];
|
|
49
53
|
try {
|
|
50
54
|
TMSpinner.show({ description: SDKUI_Localizator.Loading });
|
|
51
55
|
// Exit early if dataSource or dataColumns are not defined to avoid errors
|
|
52
|
-
if (!dataSource || !dataColumns)
|
|
53
|
-
return;
|
|
54
56
|
const columns = searchResult?.dtdResult?.columns ?? [];
|
|
55
57
|
const valueToNameMap = exportDescriptionsForDataLists ? await buildValueToLabelMapFromDataColumns(columns) : new Map();
|
|
56
58
|
const selectedSet = new Set(selectedRowKeys);
|
|
@@ -61,17 +63,14 @@ const TMDataGridExportForm = (props) => {
|
|
|
61
63
|
if (col.dataType === 'datetime' && result) {
|
|
62
64
|
const parsedDate = new Date(result);
|
|
63
65
|
if (!isNaN(parsedDate.getTime())) {
|
|
64
|
-
result = parsedDate.toLocaleDateString(
|
|
66
|
+
result = parsedDate.toLocaleDateString();
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
|
-
// Converte undefined/null in stringa vuota e rimuove eventuali virgolette doppie
|
|
68
69
|
return (result ?? '').toString().replace(/"/g, '');
|
|
69
70
|
};
|
|
70
71
|
switch (formatSelected) {
|
|
71
72
|
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)];
|
|
73
|
+
const headers = hideSelection ? visibleColumns.map(col => col.caption !== undefined ? col.caption : col.dataField) : [SDKUI_Localizator.SelectedSingular, ...visibleColumns.map(col => col.caption !== undefined ? col.caption : col.dataField)];
|
|
75
74
|
const csvRows = [];
|
|
76
75
|
csvRows.push(headers.join(';'));
|
|
77
76
|
rowsToExport.forEach((item, idx) => {
|
|
@@ -98,9 +97,9 @@ const TMDataGridExportForm = (props) => {
|
|
|
98
97
|
const workbook = new Workbook();
|
|
99
98
|
const worksheet = workbook.addWorksheet(SDKUI_Localizator.SearchResult);
|
|
100
99
|
// Map visible columns to worksheet column definitions
|
|
101
|
-
const baseColumns = visibleColumns.map(col => ({ header: col.caption
|
|
100
|
+
const baseColumns = visibleColumns.map(col => ({ header: col.caption !== undefined ? col.caption : col.dataField, key: col.dataField, width: 10, style: { numFmt: '@' } }));
|
|
102
101
|
// 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];
|
|
102
|
+
worksheet.columns = hideSelection ? baseColumns : [{ header: SDKUI_Localizator.SelectedSingular, key: '_selected', width: 10, style: { numFmt: '@' } }, ...baseColumns];
|
|
104
103
|
// Style the header row cells: font, fill color, and border
|
|
105
104
|
worksheet.getRow(1).eachCell({ includeEmpty: true }, cell => {
|
|
106
105
|
cell.font = { name: 'Segoe UI', size: 9 };
|
|
@@ -168,7 +167,10 @@ const TMDataGridExportForm = (props) => {
|
|
|
168
167
|
onCloseExportForm();
|
|
169
168
|
}
|
|
170
169
|
};
|
|
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 }) }),
|
|
170
|
+
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 }) }), _jsx("div", { style: { display: 'flex', alignItems: 'center', gap: '12px' }, children: _jsx(TMCheckBox, { elementStyle: {
|
|
171
|
+
opacity: selectedRowKeys.length === 0 ? 0.5 : 1,
|
|
172
|
+
cursor: selectedRowKeys.length === 0 ? 'not-allowed' : 'pointer'
|
|
173
|
+
}, 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.HideSelectionColumnsAndIcons, value: hideSelection, onValueChanged: () => { setHideSelection(prev => !prev); } }) }), _jsx("div", { style: {
|
|
172
174
|
display: 'flex',
|
|
173
175
|
justifyContent: 'center',
|
|
174
176
|
gap: '10px',
|
|
@@ -197,7 +197,7 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
197
197
|
switch (context) {
|
|
198
198
|
case SearchResultContext.MASTER_DETAIL:
|
|
199
199
|
case SearchResultContext.METADATA_SEARCH:
|
|
200
|
-
titleHeader = `${searchResults?.length > 1 ? selectedSearchResult?.fromName : searchResults[0]?.fromName}`;
|
|
200
|
+
titleHeader = `${searchResults?.length > 1 ? selectedSearchResult?.fromName ?? 'Ricerca per metadati' : searchResults[0]?.fromName ?? 'Ricerca per metadati'}`;
|
|
201
201
|
break;
|
|
202
202
|
case SearchResultContext.FAVORITES_AND_RECENTS:
|
|
203
203
|
titleHeader = SDKUI_Localizator.FavoritesAndRecentDcmts;
|
|
@@ -644,8 +644,8 @@ const TMSearchResultGrid = ({ inputFocusedItem, allowMultipleSelection = true, s
|
|
|
644
644
|
}, [onDblClick]);
|
|
645
645
|
const dataColumns = useMemo(() => {
|
|
646
646
|
return [
|
|
647
|
-
{ dataType: "object", visible: true, width: 50, cellRender: (cellData) => renderDcmtIcon(cellData, onDownloadDcmtsAsync), allowResizing: false, },
|
|
648
|
-
...columns
|
|
647
|
+
{ dataType: "object", dataField: 'FILEEXT', caption: '', visible: true, width: 50, cellRender: (cellData) => renderDcmtIcon(cellData, onDownloadDcmtsAsync), allowResizing: false, },
|
|
648
|
+
...columns.filter(col => col.dataField !== 'FILEEXT')
|
|
649
649
|
];
|
|
650
650
|
}, [columns]);
|
|
651
651
|
const onContentReady = useCallback((e) => {
|
|
@@ -151,7 +151,7 @@ export declare class SDKUI_Localizator {
|
|
|
151
151
|
static get Error(): "Fehler" | "Error" | "Erreur" | "Erro" | "Errore";
|
|
152
152
|
static get ErrorLoadingDocument(): string;
|
|
153
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
|
|
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 la \"Descrizione\" delle liste dati";
|
|
155
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";
|
|
156
156
|
static get ExtractedBy(): "Ausgezogen von" | "Extracted by" | "Extraído por" | "Extrait par" | "Estratto da";
|
|
157
157
|
static get ExtractedFromOtherUser(): string;
|
|
@@ -215,7 +215,7 @@ export declare class SDKUI_Localizator {
|
|
|
215
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";
|
|
216
216
|
static get HideMetadata(): string;
|
|
217
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" | "
|
|
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" | "Non esportare le colonne di selezione e formato";
|
|
219
219
|
static get HistoryActionLabel(): string;
|
|
220
220
|
static get HistoryLabel(): string;
|
|
221
221
|
static get ID_Hide(): "Ausblenden ID" | "Hide ID" | "Ocultar ID" | "Masquer ID" | "Nascondi ID";
|
|
@@ -412,7 +412,7 @@ export declare class SDKUI_Localizator {
|
|
|
412
412
|
static get Search_Free(): "Kostenlose Suche" | "Free search" | "Búsqueda libre" | "Recherche libre" | "Pesquisa livre" | "Ricerca libera";
|
|
413
413
|
static get Search_Metadata(): "Suche nach Metadaten" | "Search by metadata" | "Búsqueda por metadatos" | "Recherche par métadonnées" | "Pesquisar por metadados" | "Ricerca per metadati";
|
|
414
414
|
static get Search_Special(): "Spezielle Suchanfragen" | "Special searches" | "Búsquedas especiales" | "Recherches spéciales" | "Pesquisas especiais" | "Ricerche speciali";
|
|
415
|
-
static get SearchResult(): "Suchergebnis" | "Search result" | "Resultado búsqueda" | "Résultat de la recherche" | "Resultados da pesquisa" | "Risultato ricerca";
|
|
415
|
+
static get SearchResult(): "Suchergebnis" | "Search result" | "Resultado de la búsqueda" | "Résultat de la recherche" | "Resultados da pesquisa" | "Risultato della ricerca";
|
|
416
416
|
static get Seconds(): "Sekunden" | "Seconds" | "Segundos" | "Secondes" | "Segundas" | "Secondi";
|
|
417
417
|
static get Select(): "Wählen Sie Ihre" | "Select" | "Seleccionar" | "Sélectionne" | "Selecione" | "Seleziona";
|
|
418
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";
|
|
@@ -1484,7 +1484,7 @@ export class SDKUI_Localizator {
|
|
|
1484
1484
|
case CultureIDs.Es_ES: return 'Exportar los campos "descripción" de las listas de datos';
|
|
1485
1485
|
case CultureIDs.Fr_FR: return 'Exporter les champs "description" des listes de données';
|
|
1486
1486
|
case CultureIDs.Pt_PT: return 'Exportar os campos "descrição" das listas de dados';
|
|
1487
|
-
default: return 'Esporta
|
|
1487
|
+
default: return 'Esporta la "Descrizione" delle liste dati';
|
|
1488
1488
|
}
|
|
1489
1489
|
}
|
|
1490
1490
|
static get ExportOnlySelectedDocuments() {
|
|
@@ -2123,7 +2123,7 @@ export class SDKUI_Localizator {
|
|
|
2123
2123
|
case CultureIDs.Es_ES: return "Ocultar columnas de selección e iconos";
|
|
2124
2124
|
case CultureIDs.Fr_FR: return "Masquer les colonnes de sélection et les icônes";
|
|
2125
2125
|
case CultureIDs.Pt_PT: return "Ocultar colunas de seleção e ícones";
|
|
2126
|
-
default: return "
|
|
2126
|
+
default: return "Non esportare le colonne di selezione e formato";
|
|
2127
2127
|
}
|
|
2128
2128
|
}
|
|
2129
2129
|
static get HistoryActionLabel() {
|
|
@@ -4088,10 +4088,10 @@ export class SDKUI_Localizator {
|
|
|
4088
4088
|
switch (this._cultureID) {
|
|
4089
4089
|
case CultureIDs.De_DE: return "Suchergebnis";
|
|
4090
4090
|
case CultureIDs.En_US: return "Search result";
|
|
4091
|
-
case CultureIDs.Es_ES: return "Resultado búsqueda";
|
|
4091
|
+
case CultureIDs.Es_ES: return "Resultado de la búsqueda";
|
|
4092
4092
|
case CultureIDs.Fr_FR: return "Résultat de la recherche";
|
|
4093
4093
|
case CultureIDs.Pt_PT: return "Resultados da pesquisa";
|
|
4094
|
-
default: return "Risultato ricerca";
|
|
4094
|
+
default: return "Risultato della ricerca";
|
|
4095
4095
|
}
|
|
4096
4096
|
}
|
|
4097
4097
|
static get Seconds() {
|