@topconsultnpm/sdkui-react 6.22.0-dev2.51 → 6.22.0-dev2.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/features/documents/TMDcmtForm.js +18 -4
- package/lib/components/features/search/TMSearchResult.js +15 -17
- package/lib/components/features/search/TMTreeSelector.js +11 -2
- package/lib/helper/SDKUI_Localizator.d.ts +2 -0
- package/lib/helper/SDKUI_Localizator.js +20 -0
- package/package.json +1 -1
|
@@ -1076,18 +1076,32 @@ const TMDcmtForm = ({ TID, DID, groupId, layoutMode = LayoutModes.Update, formMo
|
|
|
1076
1076
|
setUseWaitPanelLocalState(false);
|
|
1077
1077
|
}
|
|
1078
1078
|
}, [TID, connectorFileSave, onSavedAsyncCallback, onSaveRecents, onClose, DID, setMetadataList, handleReset, layoutMode, isSharedDcmt]);
|
|
1079
|
+
// Messaggio di conferma dell'archiviazione in base al vincolo del tipo documento (ArchiveConstraints).
|
|
1080
|
+
const getArchiveConfirmMessage = useCallback(() => {
|
|
1081
|
+
// Con connectorFileSave il file viene prodotto dal connettore solo alla conferma: si assume che ci sarà.
|
|
1082
|
+
const hasFile = !!connectorFileSave || !!dcmtFileRef.current;
|
|
1083
|
+
switch (fromDTDRef.current?.archiveConstraint) {
|
|
1084
|
+
// Solo metadati: il file non è previsto.
|
|
1085
|
+
case ArchiveConstraints.OnlyMetadata: return SDKUI_Localizator.ArchiveDocument_Confirm;
|
|
1086
|
+
// File obbligatorio: senza file il pulsante Archivia è disabilitato, quindi qui il file c'è.
|
|
1087
|
+
case ArchiveConstraints.ContentCompulsory: return SDKUI_Localizator.ArchiveDocument_Confirm;
|
|
1088
|
+
// Metadati e/o file: se il file manca lo segnala, come in v5.
|
|
1089
|
+
default: return hasFile ? SDKUI_Localizator.ArchiveDocument_Confirm : SDKUI_Localizator.ArchiveOnlyMetadata_Confirm;
|
|
1090
|
+
}
|
|
1091
|
+
}, [connectorFileSave]);
|
|
1079
1092
|
const handleConfirmAction = useCallback(async () => {
|
|
1093
|
+
const isUpdate = layoutMode === LayoutModes.Update;
|
|
1080
1094
|
TMMessageBoxManager.show({
|
|
1081
1095
|
parentId: isModal ? "TMDcmtFormShowConfirmForClose-" + id : undefined,
|
|
1082
1096
|
buttons: [ButtonNames.YES, ButtonNames.NO],
|
|
1083
|
-
message:
|
|
1084
|
-
onButtonClick(e) {
|
|
1097
|
+
message: isUpdate ? SDKUI_Localizator.SaveQuestion : getArchiveConfirmMessage(),
|
|
1098
|
+
onButtonClick: (e) => {
|
|
1085
1099
|
if (e !== ButtonNames.YES)
|
|
1086
1100
|
return;
|
|
1087
|
-
|
|
1101
|
+
isUpdate ? handleSave() : handleArchiveCompleted();
|
|
1088
1102
|
},
|
|
1089
1103
|
});
|
|
1090
|
-
}, [isModal, id, layoutMode, handleSave, handleArchiveCompleted]);
|
|
1104
|
+
}, [isModal, id, layoutMode, getArchiveConfirmMessage, handleSave, handleArchiveCompleted]);
|
|
1091
1105
|
// Azione secondaria del form di archiviazione: archivia il master e, subito dopo,
|
|
1092
1106
|
// apre il modale di archiviazione dei documenti di dettaglio multipli usando il master appena creato.
|
|
1093
1107
|
const handleArchiveMasterAndDetails = useCallback(async () => {
|
|
@@ -1491,23 +1491,21 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, i
|
|
|
1491
1491
|
setVisibleItems(visibleData);
|
|
1492
1492
|
}, []);
|
|
1493
1493
|
useEffect(() => { onVisibleItemChanged?.(visibleItems); }, [visibleItems]);
|
|
1494
|
-
const
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
return { ...counterConfig, show: true, items: counterConfig?.items ?? defaultItems };
|
|
1510
|
-
}, [showCounterConfig, counterConfig, dcmtsReturned, dcmtsFound]);
|
|
1494
|
+
const defaultCounterItems = dcmtsReturned !== undefined && dcmtsFound !== undefined
|
|
1495
|
+
? new Map([
|
|
1496
|
+
[CounterItemKey.allItems, {
|
|
1497
|
+
key: CounterItemKey.allItems,
|
|
1498
|
+
show: true,
|
|
1499
|
+
caption: `${dcmtsReturned} restituiti su ${dcmtsFound} trovati`,
|
|
1500
|
+
value: `${dcmtsReturned}/${dcmtsFound}`,
|
|
1501
|
+
icon: _jsx(IconAll, {}),
|
|
1502
|
+
order: -1
|
|
1503
|
+
}]
|
|
1504
|
+
])
|
|
1505
|
+
: undefined;
|
|
1506
|
+
const gridCounterConfig = showCounterConfig
|
|
1507
|
+
? { ...counterConfig, show: true, items: counterConfig?.items ?? defaultCounterItems }
|
|
1508
|
+
: { show: false };
|
|
1511
1509
|
return _jsxs("div", { style: { width: "100%", height: "100%" }, children: [!isDataGridReady && (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', width: '100%', gap: '10px' }, children: [_jsx(LoadIndicator, { height: 60, width: 60 }), _jsx("div", { children: SDKUI_Localizator.Loading })] })), isDataGridReady && _jsx(TMDataGrid, { ref: dataGridRef, id: "tm-search-result", keyExpr: "rowIndex", dataColumns: dataColumns, dataSource: dataSource, customizeColumns: customizeColumns, repaintChangesOnly: true, selectedRowKeys: selectedRowKeys, focusedRowKey: disableAutoFocus ? undefined : Number(focusedItem?.rowIndex ?? 0), showSearchPanel: showSearchTMDatagrid, showFilterPanel: true, sorting: { mode: "multiple" }, selection: { mode: allowMultipleSelection ? 'multiple' : 'single' }, pageSize: pageSize, compactPager: compactPager, onSelectionChanged: handleSelectionChange, onFocusedRowChanged: handleFocusedRowChange, onRowDblClick: onRowDblClick, onContentReady: onContentReady, showHeaderColumnChooser: true, onKeyDown: onKeyDown, customContextMenuItems: operationItems, counterConfig: gridCounterConfig })] });
|
|
1512
1510
|
};
|
|
1513
1511
|
//#region TMSearchResultSelector
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { DcmtTypeListCacheService, LayoutModes, SDK_Localizator, TreeCacheService, TreeItemTypes } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import { TreeList, Column, Scrolling, Selection } from 'devextreme-react/tree-list';
|
|
5
5
|
import { DropDownBox } from 'devextreme-react';
|
|
@@ -31,6 +31,9 @@ const TMTreeSelector = ({ layoutMode = LayoutModes.Update, isVisible, onSelected
|
|
|
31
31
|
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
|
32
32
|
// State hook to store the currently focused row key, initially set to undefined
|
|
33
33
|
const [focusedRowKey, setFocusedRowKey] = useState(undefined);
|
|
34
|
+
// Elemento selezionato nell'albero: dopo un refresh va riproposto se esiste ancora
|
|
35
|
+
const [selectedTreeItemKey, setSelectedTreeItemKey] = useState(undefined);
|
|
36
|
+
const selectedTreeItemKeys = useMemo(() => selectedTreeItemKey !== undefined ? [selectedTreeItemKey] : [], [selectedTreeItemKey]);
|
|
34
37
|
const [isGridBoxOpened, setIsGridBoxOpened] = useState(false);
|
|
35
38
|
const [defaultTreeId, setDefaultTreeId] = useState(-1);
|
|
36
39
|
const deviceType = useDeviceType();
|
|
@@ -90,6 +93,8 @@ const TMTreeSelector = ({ layoutMode = LayoutModes.Update, isVisible, onSelected
|
|
|
90
93
|
useEffect(() => {
|
|
91
94
|
let newTreeItems = trees.find(o => o.id == selectedTreeId)?.items ?? [];
|
|
92
95
|
setTreeItems(newTreeItems);
|
|
96
|
+
// Mantiene la selezione dopo il refresh solo se l'elemento e' ancora presente (al cambio albero si azzera)
|
|
97
|
+
setSelectedTreeItemKey(prev => prev !== undefined && newTreeItems.some(o => o.id == prev) ? prev : undefined);
|
|
93
98
|
}, [selectedTreeId, trees]);
|
|
94
99
|
const renderCell = useCallback((data) => {
|
|
95
100
|
const treeItem = data.data;
|
|
@@ -178,6 +183,10 @@ const TMTreeSelector = ({ layoutMode = LayoutModes.Update, isVisible, onSelected
|
|
|
178
183
|
onSelectedTIDChanged?.(treeItem.tid, selectedTreeId);
|
|
179
184
|
}
|
|
180
185
|
}, [onSelectedTIDChanged, selectedTreeId]);
|
|
186
|
+
// La selezione la decide il widget (click, ctrl+click che deseleziona, barra spaziatrice): qui si allinea solo lo stato
|
|
187
|
+
const onSelectionChangedTreeView = useCallback((e) => {
|
|
188
|
+
setSelectedTreeItemKey(e.selectedRowKeys?.[0]);
|
|
189
|
+
}, []);
|
|
181
190
|
return (_jsx(TMPanel, { title: SDK_Localizator.Trees, isVisible: isVisible, totalItems: trees.length, onClose: onClosePanel, allowMaximize: allowMaximize, onMaximize: onMaximizePanel, onHeaderDoubleClick: onMaximizePanel, onRefresh: () => loadTreesAsync(true), toolbar: _jsx(TMButton, { btnStyle: 'icon', caption: defaultTreeId == selectedTreeId ? SDKUI_Localizator.TreeRemoveDefault : SDKUI_Localizator.SetAsDefault, icon: defaultTreeId == selectedTreeId ? _jsx(IconStarRemove, { color: 'rgb(243, 114, 92)' }) : _jsx(IconStar, { color: 'rgb(248, 215, 117)' }), onClick: () => {
|
|
182
191
|
if (defaultTreeId == selectedTreeId) {
|
|
183
192
|
if (layoutMode == LayoutModes.Update)
|
|
@@ -210,7 +219,7 @@ const TMTreeSelector = ({ layoutMode = LayoutModes.Update, isVisible, onSelected
|
|
|
210
219
|
}, value: selectedTreeId, opened: isGridBoxOpened, valueExpr: "id", displayExpr: "nameLoc", deferRendering: false, dataSource: trees, onValueChanged: syncDataGridSelection, onOptionChanged: onGridBoxOpened, style: { height: 30, padding: '5px' }, children: _jsx(TMDataGrid, { height: "100%", width: "100%", dataSource: trees, dataColumns: [
|
|
211
220
|
{ dataField: 'nameLoc', caption: SDKUI_Localizator.Name, width: 'auto' },
|
|
212
221
|
{ dataField: 'description', caption: SDKUI_Localizator.Description, width: 'auto' },
|
|
213
|
-
], selection: { mode: 'single', showCheckBoxesMode: "none" }, showHeaderFilter: false, selectedRowKeys: selectedRowKeys, onSelectionChanged: onSelectionChanged, onRowClick: onRowClickTrees, focusedRowKey: focusedRowKey, onFocusedRowChanged: onFocusedRowChanged }) }) }), _jsxs(StyledTreeListWrapper, { children: [_jsxs(TreeList, { height: "100%", dataSource: treeItems, showRowLines: false, showColumnLines: false, showBorders: false, columnAutoWidth: false, keyExpr: "id", parentIdExpr: "parentID", dataStructure: "plain", showColumnHeaders: false,
|
|
222
|
+
], selection: { mode: 'single', showCheckBoxesMode: "none" }, showHeaderFilter: false, selectedRowKeys: selectedRowKeys, onSelectionChanged: onSelectionChanged, onRowClick: onRowClickTrees, focusedRowKey: focusedRowKey, onFocusedRowChanged: onFocusedRowChanged }) }) }), _jsxs(StyledTreeListWrapper, { children: [_jsxs(TreeList, { height: "100%", dataSource: treeItems, showRowLines: false, showColumnLines: false, showBorders: false, columnAutoWidth: false, keyExpr: "id", parentIdExpr: "parentID", dataStructure: "plain", showColumnHeaders: false, selectedRowKeys: selectedTreeItemKeys, onSelectionChanged: onSelectionChangedTreeView, onCellDblClick: onCellDblClickTreeView, onRowClick: onRowClickTreeView, children: [_jsx(Column, { dataField: "nameLoc", caption: SDKUI_Localizator.Name, cellRender: renderCell, width: "100%" }), _jsx(Scrolling, { mode: "virtual", useNative: Number(SDKUI_Globals.userSettings?.themeSettings.gridSettings.useNativeScrollbar) === 1 }), _jsx(Selection, { mode: "single" })] }), _jsxs(StyledOffCanvasPanel, { ref: panelRef, "$isOpen": isMobile && infoDTD !== undefined, children: [_jsxs(StyledDivHorizontal, { style: { gap: 10, padding: '10px 8px', width: '100%', alignItems: 'center' }, children: [_jsx("p", { style: { fontSize: '1.1rem', fontWeight: 'bold' }, children: `${SDKUI_Localizator.DcmtType} - ${SDKUI_Localizator.About}` }), _jsx(IconCloseOutline, { style: { marginLeft: 'auto', cursor: 'pointer' }, onClick: () => setInfoDTD(undefined) })] }), renderDTDTooltipContent(infoDTD)] })] })] })
|
|
214
223
|
: _jsx("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', width: '100%', fontSize: '1.5rem' }, children: SDKUI_Localizator.TreesNoAvailable }) }));
|
|
215
224
|
};
|
|
216
225
|
export default TMTreeSelector;
|
|
@@ -61,6 +61,8 @@ export declare class SDKUI_Localizator {
|
|
|
61
61
|
static get ArchiveMultipleDetailDocuments(): "Mehrere Details archivieren" | "Archive multiple details" | "Archivar múltiples detalles" | "Archiver plusieurs détails" | "Arquivar múltiplos detalhes" | "Archivia dettagli multipli";
|
|
62
62
|
static get ArchiveMasterAndMultipleDetailDocuments(): "Master mit mehreren Details archivieren" | "Archive master with multiple details" | "Archivar maestro con múltiples detalles" | "Archiver le maître avec plusieurs détails" | "Arquivar mestre com múltiplos detalhes" | "Archivia master con dettagli multipli";
|
|
63
63
|
static get ArchiveMasterAndDetails_Confirm(): "Master archivieren und mit den Details fortfahren?" | "Archive the master and proceed with the details?" | "¿Archivar el maestro y continuar con los detalles?" | "Archiver le maître et poursuivre avec les détails ?" | "Arquivar o mestre e prosseguir com os detalhes?" | "Archiviare il master e proseguire con i dettagli?";
|
|
64
|
+
static get ArchiveDocument_Confirm(): "Möchten Sie dieses Dokument wirklich archivieren?" | "Are you sure you want to archive this document?" | "¿Está seguro de que desea archivar este documento?" | "Êtes-vous sûr de vouloir archiver ce document ?" | "Tem a certeza de que pretende arquivar este documento?" | "Sei sicuro di voler archiviare questo documento?";
|
|
65
|
+
static get ArchiveOnlyMetadata_Confirm(): "Keine Datei ausgewählt.<br>Mit einer Archivierung von nur Metadaten fortfahren?" | "No file selected.<br>Proceed with a metadata-only archiving?" | "Ningún archivo seleccionado.<br>¿Continuar con un archivado de solo metadatos?" | "Aucun fichier sélectionné.<br>Poursuivre avec un archivage de métadonnées uniquement ?" | "Nenhum ficheiro selecionado.<br>Prosseguir com um arquivamento apenas de metadados?" | "Nessun file selezionato.<br>Procedere con una archiviazione di soli metadati?";
|
|
64
66
|
static get ExitWithoutArchiving_Confirm(): "Möchten Sie wirklich beenden? Die eingegebenen Dokumente werden nicht archiviert. Fortfahren?" | "Are you sure you want to exit? The entered documents will not be archived. Continue?" | "¿Está seguro de que desea salir? Los documentos introducidos no se archivarán. ¿Continuar?" | "Êtes-vous sûr de vouloir quitter ? Les documents saisis ne seront pas archivés. Continuer ?" | "Tem a certeza de que pretende sair? Os documentos introduzidos não serão arquivados. Continuar?" | "Sei sicuro di voler uscire? I documenti inseriti non verranno archiviati. Continuare?";
|
|
65
67
|
static get Archiving(): string;
|
|
66
68
|
static get ArchivingCompletionInProgress(): string;
|
|
@@ -564,6 +564,26 @@ export class SDKUI_Localizator {
|
|
|
564
564
|
default: return "Archiviare il master e proseguire con i dettagli?";
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
|
+
static get ArchiveDocument_Confirm() {
|
|
568
|
+
switch (this._cultureID) {
|
|
569
|
+
case CultureIDs.De_DE: return "Möchten Sie dieses Dokument wirklich archivieren?";
|
|
570
|
+
case CultureIDs.En_US: return "Are you sure you want to archive this document?";
|
|
571
|
+
case CultureIDs.Es_ES: return "¿Está seguro de que desea archivar este documento?";
|
|
572
|
+
case CultureIDs.Fr_FR: return "Êtes-vous sûr de vouloir archiver ce document ?";
|
|
573
|
+
case CultureIDs.Pt_PT: return "Tem a certeza de que pretende arquivar este documento?";
|
|
574
|
+
default: return "Sei sicuro di voler archiviare questo documento?";
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
static get ArchiveOnlyMetadata_Confirm() {
|
|
578
|
+
switch (this._cultureID) {
|
|
579
|
+
case CultureIDs.De_DE: return "Keine Datei ausgewählt.<br>Mit einer Archivierung von nur Metadaten fortfahren?";
|
|
580
|
+
case CultureIDs.En_US: return "No file selected.<br>Proceed with a metadata-only archiving?";
|
|
581
|
+
case CultureIDs.Es_ES: return "Ningún archivo seleccionado.<br>¿Continuar con un archivado de solo metadatos?";
|
|
582
|
+
case CultureIDs.Fr_FR: return "Aucun fichier sélectionné.<br>Poursuivre avec un archivage de métadonnées uniquement ?";
|
|
583
|
+
case CultureIDs.Pt_PT: return "Nenhum ficheiro selecionado.<br>Prosseguir com um arquivamento apenas de metadados?";
|
|
584
|
+
default: return "Nessun file selezionato.<br>Procedere con una archiviazione di soli metadati?";
|
|
585
|
+
}
|
|
586
|
+
}
|
|
567
587
|
static get ExitWithoutArchiving_Confirm() {
|
|
568
588
|
switch (this._cultureID) {
|
|
569
589
|
case CultureIDs.De_DE: return "Möchten Sie wirklich beenden? Die eingegebenen Dokumente werden nicht archiviert. Fortfahren?";
|