@topconsultnpm/sdkui-react-beta 6.10.51 → 6.10.52
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,15 +23,30 @@ export class TMFileSystemItem {
|
|
|
23
23
|
}
|
|
24
24
|
let abortController = new AbortController();
|
|
25
25
|
const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false }) => {
|
|
26
|
-
|
|
27
|
-
const [
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
// State to store the instance of CustomFileSystemProvider. It is initialized once and used for managing file system operations.
|
|
27
|
+
const [areaProvider, setAreaProvider] = useState();
|
|
28
|
+
// LEFT PANEL = PARENT DIR | RIGHT PANEL = File Sytem Item
|
|
29
|
+
// State to maintain the selected parent dir (Support area - left panel)
|
|
30
30
|
const [parentDir, setParentDir] = useState(null);
|
|
31
|
+
// State to maintain the selected parent path (Support area - left panel)
|
|
32
|
+
const [currentRoute, setCurrentRoute] = useState('');
|
|
33
|
+
// State to maintain the Area Descriptor Array (Support area - left panel)
|
|
31
34
|
const [areas, setAreas] = useState([]);
|
|
35
|
+
// State to maintain the Area Descriptor Name Set (Support area - left panel)
|
|
36
|
+
const [areasRoots, setAreasRoots] = useState(new Set());
|
|
37
|
+
// State to maintain the selected area file (File System Item - right panel)
|
|
38
|
+
const [areaFile, setAreaFile] = useState('');
|
|
39
|
+
// State to maintain the selected area folder (File System Item - right panel)
|
|
40
|
+
const [areaFolder, setAreaFolder] = useState('');
|
|
41
|
+
// State to maintain the focused/clicked file system item (File System Item - right panel)
|
|
42
|
+
const [focusedFileSystemItem, setFocusedFileSystemItem] = useState(undefined);
|
|
43
|
+
// State to maintain the number of total item into selected support area
|
|
44
|
+
const [counter, setCounter] = useState(0);
|
|
45
|
+
// State to maintain the number of selected items)
|
|
32
46
|
const [selectedItemsCount, setSelectedItemsCount] = useState(0);
|
|
33
|
-
|
|
47
|
+
// State to maintain the selection mode (File System Item - right panel)
|
|
34
48
|
const [selectionMode, setSelectionMode] = useState('single');
|
|
49
|
+
/* State to manage the Wait Panel */
|
|
35
50
|
const [showWaitPanel, setShowWaitPanel] = useState(false);
|
|
36
51
|
const [waitPanelTitle, setWaitPanelTitle] = useState('');
|
|
37
52
|
const [showPrimary, setShowPrimary] = useState(false);
|
|
@@ -42,29 +57,37 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
|
|
|
42
57
|
const [waitPanelTextSecondary, setWaitPanelTextSecondary] = useState('');
|
|
43
58
|
const [waitPanelValueSecondary, setWaitPanelValueSecondary] = useState(0);
|
|
44
59
|
const [waitPanelMaxValueSecondary, setWaitPanelMaxValueSecondary] = useState(0);
|
|
45
|
-
|
|
46
|
-
const [focusedFileSystemItem, setFocusedFileSystemItem] = useState(undefined);
|
|
60
|
+
// Timer ID to store reference for any scheduled operation
|
|
47
61
|
let timerId = null;
|
|
62
|
+
// Prefix for area folder names
|
|
48
63
|
const AreaFolderNamePrefix = "AID_";
|
|
64
|
+
// Prefix for area paths, indicating a specific file system location
|
|
49
65
|
const AreaPathPrefix = "tmarea:\\\\";
|
|
66
|
+
// Arrays to store resolve functions for existing and non-existing files
|
|
50
67
|
let resolvesForExistingFiles = [];
|
|
51
68
|
let resolvesForNonExistingFiles = [];
|
|
69
|
+
// Promise to store the directory content for a destination folder
|
|
52
70
|
let destinationDirectoryContentPromise = null;
|
|
71
|
+
// Reference to the file manager component
|
|
53
72
|
const fileManagerRef = useRef(null);
|
|
73
|
+
// Cache for uploaded file IDs, mapping file paths to their corresponding IDs
|
|
54
74
|
let _cacheUploadFileId = new Map();
|
|
55
75
|
useEffect(() => {
|
|
76
|
+
// If areaProvider is already set, exit early to prevent reinitialization
|
|
56
77
|
if (areaProvider)
|
|
57
78
|
return;
|
|
79
|
+
// Initialize a new instance of CustomFileSystemProvider with necessary methods
|
|
58
80
|
setAreaProvider(new CustomFileSystemProvider({
|
|
59
|
-
copyItem,
|
|
60
|
-
getItems,
|
|
61
|
-
moveItem,
|
|
62
|
-
renameItem,
|
|
63
|
-
deleteItem,
|
|
64
|
-
downloadItems,
|
|
65
|
-
uploadFileChunk,
|
|
66
|
-
createDirectory
|
|
81
|
+
copyItem, // Function to copy an item
|
|
82
|
+
getItems, // Function to retrieve items
|
|
83
|
+
moveItem, // Function to move an item
|
|
84
|
+
renameItem, // Function to rename an item
|
|
85
|
+
deleteItem, // Function to delete an item
|
|
86
|
+
downloadItems, // Function to download items
|
|
87
|
+
uploadFileChunk, // Function to upload file chunks
|
|
88
|
+
createDirectory // Function to create a directory
|
|
67
89
|
}));
|
|
90
|
+
// Load localization messages for different languages
|
|
68
91
|
loadMessages({
|
|
69
92
|
"it": {
|
|
70
93
|
"dxFileManager-dialogDeleteItemSingleItemConfirmation": "Sei sicuro di voler eliminare {0}?",
|
|
@@ -97,10 +120,7 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
|
|
|
97
120
|
"dxFileManager-dialogDirectoryChooserMoveButtonText": "Move"
|
|
98
121
|
}
|
|
99
122
|
});
|
|
100
|
-
}, []);
|
|
101
|
-
useEffect(() => {
|
|
102
|
-
setAreaRoots(new Set(areas.map(area => area.name).filter(name => name !== undefined)));
|
|
103
|
-
}, [areas]);
|
|
123
|
+
}, []); // Empty dependency array ensures this effect runs only once when the component mounts
|
|
104
124
|
useEffect(() => {
|
|
105
125
|
const btnNewDir = document.querySelector(".dx-filemanager-wrapper [aria-label='Nuova cartella']");
|
|
106
126
|
const instanceBtnNewDir = Button.getInstance(btnNewDir);
|
|
@@ -384,38 +404,56 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
|
|
|
384
404
|
setShowWaitPanel(false);
|
|
385
405
|
}
|
|
386
406
|
};
|
|
407
|
+
// Asynchronous function to retrieve the items in a given directory (parentDirectory)
|
|
387
408
|
const getItems = async (parentDirectory) => {
|
|
409
|
+
// Set the parent directory to the current state
|
|
388
410
|
setParentDir(parentDirectory);
|
|
411
|
+
// Initialize an empty array to hold the file system items
|
|
389
412
|
const fileSystem = [];
|
|
413
|
+
// Retrieve the current session or use the global session if not available
|
|
390
414
|
const tms = props.tmSession ?? SDK_Globals.tmSession;
|
|
415
|
+
// Check if the parent directory is the root (empty name)
|
|
391
416
|
if (parentDirectory.name === "") {
|
|
417
|
+
// Retrieve all area descriptors asynchronously
|
|
392
418
|
const adlist = await tms?.NewAreaEngine().RetrieveAllAsync().catch((err) => TMExceptionBoxManager.show({ exception: err }));
|
|
393
|
-
|
|
419
|
+
const areasRootsName = new Set();
|
|
420
|
+
// Iterate over each area descriptor and create corresponding file system items
|
|
394
421
|
for (const ad of adlist) {
|
|
422
|
+
// Localize the name of the area
|
|
395
423
|
ad.name = ad?.nameLoc;
|
|
424
|
+
if (ad.name)
|
|
425
|
+
areasRootsName.add(ad.name);
|
|
426
|
+
// Create a new file system item for each area descriptor
|
|
396
427
|
const fsi = new TMFileSystemItem();
|
|
397
|
-
fsi.name = ad.name ?? '';
|
|
398
|
-
fsi.dataItem = ad;
|
|
399
|
-
fsi.dateModified = ad.lastUpdateTime;
|
|
400
|
-
fsi.isDirectory = true;
|
|
401
|
-
fileSystem.push(fsi);
|
|
428
|
+
fsi.name = ad.name ?? ''; // Use the localized name or an empty string if undefined
|
|
429
|
+
fsi.dataItem = ad; // Store the area descriptor as data
|
|
430
|
+
fsi.dateModified = ad.lastUpdateTime; // Store the last update time
|
|
431
|
+
fsi.isDirectory = true; // Since this represents a directory, mark it as a directory
|
|
432
|
+
fileSystem.push(fsi); // Add the file system item to the list
|
|
402
433
|
}
|
|
434
|
+
// Set the areas
|
|
435
|
+
setAreas(adlist);
|
|
436
|
+
setAreasRoots(areasRootsName);
|
|
403
437
|
}
|
|
404
438
|
else {
|
|
439
|
+
// If the parent directory is not the root, retrieve files within the area
|
|
405
440
|
const ad = parentDirectory.dataItem.dataItem;
|
|
406
|
-
const aid = ad?.id;
|
|
407
|
-
const path = parentDirectory.pathKeys.length === 1 ? "" : parentDirectory.path;
|
|
441
|
+
const aid = ad?.id; // Get the area ID
|
|
442
|
+
const path = parentDirectory.pathKeys.length === 1 ? "" : parentDirectory.path; // Determine the path
|
|
443
|
+
// Retrieve all files in the area, based on the path, asynchronously
|
|
408
444
|
const files = await tms?.NewAreaEngine().RetrieveAllFilesAsync(aid, path.replace(ad.name + '/', '')).catch((err) => TMExceptionBoxManager.show({ exception: err }));
|
|
445
|
+
// Iterate over each file descriptor and create corresponding file system items
|
|
409
446
|
files.forEach((file) => {
|
|
410
447
|
const fsi = new TMFileSystemItem();
|
|
411
|
-
fsi.name = file.name ?? '';
|
|
412
|
-
fsi.dataItem = ad;
|
|
413
|
-
fsi.dateModified = file.lastUpdateTime;
|
|
414
|
-
fsi.isDirectory = file.isFld == 1;
|
|
415
|
-
fsi.size = file.size;
|
|
416
|
-
fileSystem.push(fsi);
|
|
448
|
+
fsi.name = file.name ?? ''; // Set the file name, defaulting to an empty string if undefined
|
|
449
|
+
fsi.dataItem = ad; // Store the area descriptor as data
|
|
450
|
+
fsi.dateModified = file.lastUpdateTime; // Store the file's last modified time
|
|
451
|
+
fsi.isDirectory = file.isFld == 1; // Mark as a directory if the 'isFld' field is 1 (directory)
|
|
452
|
+
fsi.size = file.size; // Store the file size
|
|
453
|
+
fileSystem.push(fsi); // Add the file system item to the list
|
|
417
454
|
});
|
|
418
455
|
}
|
|
456
|
+
// Return the constructed list of file system items (directories or files)
|
|
419
457
|
return fileSystem;
|
|
420
458
|
};
|
|
421
459
|
const renameItem = async (item, newName) => {
|
|
@@ -595,6 +633,6 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
|
|
|
595
633
|
}
|
|
596
634
|
};
|
|
597
635
|
const counters = [{ icon: _jsx(IconAll, {}), text: counter.toString(), tooltip: SDKUI_Localizator.AllItems }, { icon: _jsx(IconSelected, {}), text: selectedItemsCount.toString(), tooltip: SDKUI_Localizator.SelectedItems }];
|
|
598
|
-
return (_jsxs(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: [_jsxs(FileManager, { width: props.width, ref: fileManagerRef, height: props.height, onItemMoving: onItemCopying, onItemCopying: onItemCopying, onFileUploading: onFileUploading, fileSystemProvider: areaProvider, customizeThumbnail: customizeIcon, rootFolderName: SDK_Localizator.Areas, onSelectionChanged: onSelectionChanged, onDirectoryCreating: onDirectoryCreating, onFocusedItemChanged: onFocusedItemChanged, onSelectedFileOpened: onSelectedFileOpened, onContextMenuItemClick: onContextMenuItemClick, onItemMoved: () => setCounter(counter => counter + 1), onItemCopied: () => setCounter(counter => counter + 1), onItemDeleted: () => setCounter(counter => counter - 1), onFileUploaded: () => setCounter(counter => counter + 1), onCurrentDirectoryChanged: onCurrentDirectoryChanged, selectionMode: props.selectionMode === 'single' ? 'single' : selectionMode, children: [_jsxs(Toolbar, { children: [_jsx(Item, { name: "showNavPane", visible: true }), _jsx(Item, { name: "create", visible: true }), _jsx(Item, { name: "upload", visible: true }), _jsx(Item, { name: "separator", location: 'after' }), _jsx(Item, { name: "switchView", visible: true }), _jsx(Item, { name: "refresh", visible: true })] }), _jsx(ContextMenu, { items: ["create", "upload", "rename", "move", "copy", "delete", "refresh", "download"] }), _jsx(Permissions, { copy: focusedFileSystemItem && focusedFileSystemItem.name !== "" && !
|
|
636
|
+
return (_jsxs(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: [_jsxs(FileManager, { width: props.width, ref: fileManagerRef, height: props.height, onItemMoving: onItemCopying, onItemCopying: onItemCopying, onFileUploading: onFileUploading, fileSystemProvider: areaProvider, customizeThumbnail: customizeIcon, rootFolderName: SDK_Localizator.Areas, onSelectionChanged: onSelectionChanged, onDirectoryCreating: onDirectoryCreating, onFocusedItemChanged: onFocusedItemChanged, onSelectedFileOpened: onSelectedFileOpened, onContextMenuItemClick: onContextMenuItemClick, onItemMoved: () => setCounter(counter => counter + 1), onItemCopied: () => setCounter(counter => counter + 1), onItemDeleted: () => setCounter(counter => counter - 1), onFileUploaded: () => setCounter(counter => counter + 1), onCurrentDirectoryChanged: onCurrentDirectoryChanged, selectionMode: props.selectionMode === 'single' ? 'single' : selectionMode, children: [_jsxs(Toolbar, { children: [_jsx(Item, { name: "showNavPane", visible: true }), _jsx(Item, { name: "create", visible: true }), _jsx(Item, { name: "upload", visible: true }), _jsx(Item, { name: "separator", location: 'after' }), _jsx(Item, { name: "switchView", visible: true }), _jsx(Item, { name: "refresh", visible: true })] }), _jsx(ContextMenu, { items: ["create", "upload", "rename", "move", "copy", "delete", "refresh", "download"] }), _jsx(Permissions, { copy: focusedFileSystemItem && focusedFileSystemItem.name !== "" && !areasRoots.has(focusedFileSystemItem.name), move: focusedFileSystemItem && focusedFileSystemItem.name !== "" && !areasRoots.has(focusedFileSystemItem.name), create: focusedFileSystemItem && focusedFileSystemItem.name !== "", upload: focusedFileSystemItem && focusedFileSystemItem.name !== "", rename: focusedFileSystemItem && focusedFileSystemItem.name !== "" && !areasRoots.has(focusedFileSystemItem.name), delete: focusedFileSystemItem && focusedFileSystemItem.name !== "" && !areasRoots.has(focusedFileSystemItem.name), download: true }), _jsx(ItemView, { children: _jsxs(Details, { children: [_jsx(Column, { dataField: "thumbnail", cssClass: 'file-thumbnail' }, "thumbnail"), _jsx(Column, { dataField: "name", caption: SDKUI_Localizator.Name }, "name"), _jsx(Column, { dataField: 'size', width: '120px', alignment: 'center', dataType: 'number', caption: SDKUI_Localizator.File_Size }, "size"), _jsx(Column, { dataField: 'dateModified', width: '160px', alignment: 'center', dataType: 'datetime', caption: SDKUI_Localizator.Date_Modified }, "dateModified")] }) }), _jsx(Notifications, { showPopup: false })] }), _jsx(TMCounterBar, { items: counters })] }));
|
|
599
637
|
};
|
|
600
638
|
export default TMAreaManager;
|
|
@@ -16,9 +16,10 @@ export declare class SDKUI_Localizator {
|
|
|
16
16
|
static get AddDefinition(): "Definition hinzufügen" | "Add definition" | "Añadir definición" | "Ajoute la définition" | "Adicionar definição" | "Aggiungi definizione";
|
|
17
17
|
static get AddOrSubstFile(): "Dateien hinzufügen/ersetzen" | "Add/substitute file" | "Añadir/sustituir archivo" | "Ajoute/Remplace le fichier" | "Adicionar / substituir arquivos" | "Aggiungi/sostituisci file";
|
|
18
18
|
static get All(): "Alle" | "All" | "Todos" | "Tous" | "Tutti";
|
|
19
|
-
static get
|
|
20
|
-
static get Alls2(): "Alle" | "All" | "Todos" | "Tous" | "Tutte";
|
|
19
|
+
static get AllFilesAndFoldersInSupportArea(): "Alle Dateien und Ordner im Support-Bereich" | "All files and folders within the support area" | "Todos los archivos y carpetas dentro del área de soporte" | "Tous les fichiers et dossiers dans la zone de support" | "Todos os arquivos e pastas na área de apoio" | "Tutti i file e le cartelle all'interno dell'area di appoggio";
|
|
21
20
|
static get AllItems(): "alle Artikel" | "All items" | "Todos los artículos" | "tous les articles" | "todos os artigos" | "tutti gli elementi";
|
|
21
|
+
static get Alls2(): "Alle" | "All" | "Todos" | "Tous" | "Tutte";
|
|
22
|
+
static get Alphabetic(): "Alphabetisch" | "Alphabetic" | "Alfabético" | "Alphabétique" | "Alfabética" | "Alfabetico";
|
|
22
23
|
static get Applied(): string;
|
|
23
24
|
static get Apply(): "Anwenden" | "Apply" | "Aplicar" | "Applique" | "Applica";
|
|
24
25
|
static get ApplyAndClose(): "Anwenden und Schließen" | "Apply and close" | "Aplicar y cerrar" | "Applique et ferme" | "Aplicar e fechar" | "Applica e chiudi";
|
|
@@ -108,14 +108,24 @@ export class SDKUI_Localizator {
|
|
|
108
108
|
default: return "Tutti";
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
static get
|
|
111
|
+
static get AllFilesAndFoldersInSupportArea() {
|
|
112
112
|
switch (this._cultureID) {
|
|
113
|
-
case CultureIDs.De_DE: return "
|
|
114
|
-
case CultureIDs.En_US: return "
|
|
115
|
-
case CultureIDs.Es_ES: return "
|
|
116
|
-
case CultureIDs.Fr_FR: return "
|
|
117
|
-
case CultureIDs.Pt_PT: return "
|
|
118
|
-
default: return "
|
|
113
|
+
case CultureIDs.De_DE: return "Alle Dateien und Ordner im Support-Bereich";
|
|
114
|
+
case CultureIDs.En_US: return "All files and folders within the support area";
|
|
115
|
+
case CultureIDs.Es_ES: return "Todos los archivos y carpetas dentro del área de soporte";
|
|
116
|
+
case CultureIDs.Fr_FR: return "Tous les fichiers et dossiers dans la zone de support";
|
|
117
|
+
case CultureIDs.Pt_PT: return "Todos os arquivos e pastas na área de apoio";
|
|
118
|
+
default: return "Tutti i file e le cartelle all'interno dell'area di appoggio";
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
static get AllItems() {
|
|
122
|
+
switch (this._cultureID) {
|
|
123
|
+
case CultureIDs.De_DE: return "alle Artikel";
|
|
124
|
+
case CultureIDs.En_US: return "All items";
|
|
125
|
+
case CultureIDs.Es_ES: return "Todos los artículos";
|
|
126
|
+
case CultureIDs.Fr_FR: return "tous les articles";
|
|
127
|
+
case CultureIDs.Pt_PT: return "todos os artigos";
|
|
128
|
+
default: return "tutti gli elementi";
|
|
119
129
|
}
|
|
120
130
|
}
|
|
121
131
|
static get Alls2() {
|
|
@@ -128,14 +138,14 @@ export class SDKUI_Localizator {
|
|
|
128
138
|
default: return "Tutte";
|
|
129
139
|
}
|
|
130
140
|
}
|
|
131
|
-
static get
|
|
141
|
+
static get Alphabetic() {
|
|
132
142
|
switch (this._cultureID) {
|
|
133
|
-
case CultureIDs.De_DE: return "
|
|
134
|
-
case CultureIDs.En_US: return "
|
|
135
|
-
case CultureIDs.Es_ES: return "
|
|
136
|
-
case CultureIDs.Fr_FR: return "
|
|
137
|
-
case CultureIDs.Pt_PT: return "
|
|
138
|
-
default: return "
|
|
143
|
+
case CultureIDs.De_DE: return "Alphabetisch";
|
|
144
|
+
case CultureIDs.En_US: return "Alphabetic";
|
|
145
|
+
case CultureIDs.Es_ES: return "Alfabético";
|
|
146
|
+
case CultureIDs.Fr_FR: return "Alphabétique";
|
|
147
|
+
case CultureIDs.Pt_PT: return "Alfabética";
|
|
148
|
+
default: return "Alfabetico";
|
|
139
149
|
}
|
|
140
150
|
}
|
|
141
151
|
static get Applied() {
|