@topconsultnpm/sdkui-react-beta 6.10.48 → 6.10.50

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.
@@ -42,6 +42,8 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
42
42
  const [waitPanelTextSecondary, setWaitPanelTextSecondary] = useState('');
43
43
  const [waitPanelValueSecondary, setWaitPanelValueSecondary] = useState(0);
44
44
  const [waitPanelMaxValueSecondary, setWaitPanelMaxValueSecondary] = useState(0);
45
+ const [areaRoots, setAreaRoots] = useState(new Set());
46
+ const [focusedFileSystemItem, setFocusedFileSystemItem] = useState(undefined);
45
47
  let timerId = null;
46
48
  const AreaFolderNamePrefix = "AID_";
47
49
  const AreaPathPrefix = "tmarea:\\\\";
@@ -66,30 +68,39 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
66
68
  loadMessages({
67
69
  "it": {
68
70
  "dxFileManager-dialogDeleteItemSingleItemConfirmation": "Sei sicuro di voler eliminare {0}?",
69
- "dxFileManager-dialogDeleteItemMultipleItemsConfirmation": "Sei sicuro di voler eliminare {0} elementi?"
71
+ "dxFileManager-dialogDeleteItemMultipleItemsConfirmation": "Sei sicuro di voler eliminare {0} elementi?",
72
+ "dxFileManager-dialogDirectoryChooserMoveButtonText": "Sposta"
70
73
  },
71
74
  "fr": {
72
75
  "dxFileManager-dialogDeleteItemSingleItemConfirmation": "Êtes-vous sûr de vouloir supprimer {0}?",
73
- "dxFileManager-dialogDeleteItemMultipleItemsConfirmation": "Êtes-vous sûr de vouloir supprimer {0} éléments?"
76
+ "dxFileManager-dialogDeleteItemMultipleItemsConfirmation": "Êtes-vous sûr de vouloir supprimer {0} éléments?",
77
+ "dxFileManager-dialogDirectoryChooserMoveButtonText": "Déplacer"
74
78
  },
75
79
  "pt": {
76
80
  "dxFileManager-dialogDeleteItemSingleItemConfirmation": "Tem a certeza de que pretende eliminar {0}?",
77
- "dxFileManager-dialogDeleteItemMultipleItemsConfirmation": "Tem a certeza de que pretende eliminar {0} itens?"
81
+ "dxFileManager-dialogDeleteItemMultipleItemsConfirmation": "Tem a certeza de que pretende eliminar {0} itens?",
82
+ "dxFileManager-dialogDirectoryChooserMoveButtonText": "Mover"
78
83
  },
79
84
  "de": {
80
85
  "dxFileManager-dialogDeleteItemSingleItemConfirmation": "Möchten Sie {0} wirklich löschen?",
81
- "dxFileManager-dialogDeleteItemMultipleItemsConfirmation": "Möchten Sie {0} Elemente wirklich löschen?"
86
+ "dxFileManager-dialogDeleteItemMultipleItemsConfirmation": "Möchten Sie {0} Elemente wirklich löschen?",
87
+ "dxFileManager-dialogDirectoryChooserMoveButtonText": "Verschieben"
82
88
  },
83
89
  "es": {
84
90
  "dxFileManager-dialogDeleteItemSingleItemConfirmation": "¿Estás seguro de que quieres eliminar {0}?",
85
- "dxFileManager-dialogDeleteItemMultipleItemsConfirmation": "¿Estás seguro de que quieres eliminar {0} artículos?"
91
+ "dxFileManager-dialogDeleteItemMultipleItemsConfirmation": "¿Estás seguro de que quieres eliminar {0} artículos?",
92
+ "dxFileManager-dialogDirectoryChooserMoveButtonText": "Mover"
86
93
  },
87
94
  "en": {
88
95
  "dxFileManager-dialogDeleteItemSingleItemConfirmation": "Are you sure you want to delete {0}?",
89
- "dxFileManager-dialogDeleteItemMultipleItemsConfirmation": "Are you sure you want to delete {0} items?"
96
+ "dxFileManager-dialogDeleteItemMultipleItemsConfirmation": "Are you sure you want to delete {0} items?",
97
+ "dxFileManager-dialogDirectoryChooserMoveButtonText": "Move"
90
98
  }
91
99
  });
92
100
  }, []);
101
+ useEffect(() => {
102
+ setAreaRoots(new Set(areas.map(area => area.name).filter(name => name !== undefined)));
103
+ }, [areas]);
93
104
  useEffect(() => {
94
105
  const btnNewDir = document.querySelector(".dx-filemanager-wrapper [aria-label='Nuova cartella']");
95
106
  const instanceBtnNewDir = Button.getInstance(btnNewDir);
@@ -456,6 +467,7 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
456
467
  };
457
468
  const onCurrentDirectoryChanged = (e) => {
458
469
  setCurrentRoute(e.directory.path);
470
+ setFocusedFileSystemItem(e.directory);
459
471
  if (e.directory.path === '' && e.directory.name === '')
460
472
  return;
461
473
  let ad = e.directory.dataItem.dataItem;
@@ -487,6 +499,7 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
487
499
  setAreaFolder('');
488
500
  setAreaFile(getAreaPath(aid, path));
489
501
  }
502
+ setFocusedFileSystemItem(e.item);
490
503
  };
491
504
  const customizeIcon = useCallback((fileSystemItem) => {
492
505
  if (fileSystemItem.isDirectory) {
@@ -563,13 +576,17 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
563
576
  }
564
577
  };
565
578
  const getSubFolders = async (dir) => {
566
- const ad = dir.dataItem.dataItem;
579
+ const ad = dir?.dataItem?.dataItem;
567
580
  const aid = ad?.id;
568
581
  const tms = props.tmSession ?? SDK_Globals.tmSession;
569
582
  const path = dir.pathKeys.length === 1 ? "" : dir.path;
570
- const allFilesAndFolders = await tms?.NewAreaEngine().RetrieveAllFilesAsync(aid, path.replace(ad.name + '/', ''));
571
- const folders = allFilesAndFolders?.filter(item => item.isFld === 1).map(item => item.name);
572
- return folders;
583
+ return tms?.NewAreaEngine()
584
+ .RetrieveAllFilesAsync(aid, path.replace(ad?.name + '/', ''))
585
+ .then(allFilesAndFolders => {
586
+ const folders = allFilesAndFolders?.filter(item => item.isFld === 1).map(item => item.name);
587
+ return folders;
588
+ })
589
+ .catch(err => TMExceptionBoxManager.show({ exception: err }));
573
590
  };
574
591
  const onDirectoryCreating = async (e) => {
575
592
  const folders = await getSubFolders(e.parentDirectory);
@@ -578,6 +595,6 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
578
595
  }
579
596
  };
580
597
  const counters = [{ icon: _jsx(IconAll, {}), text: counter.toString(), tooltip: SDKUI_Localizator.AllItems }, { icon: _jsx(IconSelected, {}), text: selectedItemsCount.toString(), tooltip: SDKUI_Localizator.SelectedItems }];
581
- 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: true, move: true, create: true, upload: true, rename: true, delete: true, 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 })] }));
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 !== "" && !areaRoots.has(focusedFileSystemItem.name), move: focusedFileSystemItem && focusedFileSystemItem.name !== "" && !areaRoots.has(focusedFileSystemItem.name), create: focusedFileSystemItem && focusedFileSystemItem.name !== "", upload: focusedFileSystemItem && focusedFileSystemItem.name !== "", rename: focusedFileSystemItem && focusedFileSystemItem.name !== "" && !areaRoots.has(focusedFileSystemItem.name), delete: focusedFileSystemItem && focusedFileSystemItem.name !== "" && !areaRoots.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 })] }));
582
599
  };
583
600
  export default TMAreaManager;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.10.48",
3
+ "version": "6.10.50",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -42,7 +42,7 @@
42
42
  "lib"
43
43
  ],
44
44
  "dependencies": {
45
- "@topconsultnpm/sdk-ts-beta": "^6.10.7",
45
+ "@topconsultnpm/sdk-ts-beta": "^6.10.8",
46
46
  "buffer": "^6.0.3",
47
47
  "devextreme": "24.2.3",
48
48
  "devextreme-react": "24.2.3",