@syncfusion/ej2-filemanager 28.1.33 → 28.1.36
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/dist/ej2-filemanager.min.js +1 -10
- package/dist/ej2-filemanager.umd.min.js +1 -10
- package/dist/ej2-filemanager.umd.min.js.map +1 -1
- package/dist/es6/ej2-filemanager.es2015.js +40 -10
- package/dist/es6/ej2-filemanager.es2015.js.map +1 -1
- package/dist/es6/ej2-filemanager.es5.js +48 -18
- package/dist/es6/ej2-filemanager.es5.js.map +1 -1
- package/dist/global/ej2-filemanager.min.js +1 -10
- package/dist/global/ej2-filemanager.min.js.map +1 -1
- package/dist/global/index.d.ts +0 -9
- package/package.json +8 -9
- package/src/file-manager/common/operations.js +37 -11
- package/src/file-manager/common/utility.js +2 -2
- package/src/file-manager/layout/navigation-pane.js +9 -5
@@ -1712,9 +1712,9 @@ function getDirectoryPath(parent, args) {
|
|
1712
1712
|
const fPath = getValue(parent.hasId && !isNullOrUndefined(parent.ajaxSettings.url) ? 'filterId' : 'filterPath', args.cwd);
|
1713
1713
|
if (!isNullOrUndefined(fPath)) {
|
1714
1714
|
if (fPath === '') {
|
1715
|
-
return
|
1715
|
+
return '/';
|
1716
1716
|
}
|
1717
|
-
return fPath.replace(/\\/g, '/') + filePath;
|
1717
|
+
return fPath.replace(/\\/g, '/').replace(/^.*?(?=\/)/, '') + filePath;
|
1718
1718
|
}
|
1719
1719
|
else {
|
1720
1720
|
return isFileSystemData(parent) ? filePath : parent.path + filePath;
|
@@ -2619,7 +2619,7 @@ function createNewItem(data, target, itemName, isCopy) {
|
|
2619
2619
|
}
|
2620
2620
|
}
|
2621
2621
|
const currentDate = new Date();
|
2622
|
-
const folderPath = target.id !== 0 ? target.filterPath + target.name : '\\';
|
2622
|
+
const folderPath = String(target.id) !== String(0) && !isNullOrUndefined(target.parentId) ? target.filterPath + target.name + '\\' : '\\';
|
2623
2623
|
Object.assign(newItem, {
|
2624
2624
|
dateCreated: currentDate,
|
2625
2625
|
dateModified: currentDate,
|
@@ -2753,7 +2753,9 @@ function triggerRenameOperation(parent, data, eventArgs) {
|
|
2753
2753
|
if (isFileSystemData(parent)) {
|
2754
2754
|
if (!isFileExists(parent.fileSystemData, args.newName)) {
|
2755
2755
|
const fileData = filterById(parent, args.itemData[0].id);
|
2756
|
+
const oldName = fileData.name;
|
2756
2757
|
fileData.name = args.newName;
|
2758
|
+
updateChildrenFilterPath(parent, fileData.id, oldName, args.newName);
|
2757
2759
|
}
|
2758
2760
|
else {
|
2759
2761
|
const message = 'Cannot rename' + args.itemData[0].name + 'to' + args.newName + ': destination already exists.';
|
@@ -2762,6 +2764,26 @@ function triggerRenameOperation(parent, data, eventArgs) {
|
|
2762
2764
|
}
|
2763
2765
|
});
|
2764
2766
|
}
|
2767
|
+
/**
|
2768
|
+
* Function to update child item filter path.
|
2769
|
+
*
|
2770
|
+
* @param {IFileManager} parent - specifies the parent element.
|
2771
|
+
* @param {string | number} parentId - specifies the parent id.
|
2772
|
+
* @param {string} oldName - specifies the previous name.
|
2773
|
+
* @param {string} newName - specifies the new name.
|
2774
|
+
* @returns {void}
|
2775
|
+
* @private
|
2776
|
+
*/
|
2777
|
+
function updateChildrenFilterPath(parent, parentId, oldName, newName) {
|
2778
|
+
parent.fileSystemData.forEach((item) => {
|
2779
|
+
if (String(item.parentId) === String(parentId)) {
|
2780
|
+
const oldPath = item.filterPath;
|
2781
|
+
const newPath = oldPath.replace(oldName + '\\', newName + '\\');
|
2782
|
+
item.filterPath = newPath;
|
2783
|
+
updateChildrenFilterPath(parent, item.id, oldName, newName);
|
2784
|
+
}
|
2785
|
+
});
|
2786
|
+
}
|
2765
2787
|
/**
|
2766
2788
|
* Function to trigger move or copy operation.
|
2767
2789
|
*
|
@@ -2824,11 +2846,16 @@ function triggerMoveOrCopyOperation(parent, data, eventArgs) {
|
|
2824
2846
|
if (!isFileExists(getTargetFiles, currItem.name) || getValue('renameFiles', data).length > 0) {
|
2825
2847
|
if (!target.hasChild) {
|
2826
2848
|
target.hasChild = !currItem.isFile;
|
2849
|
+
const targetItem = parent.fileSystemData
|
2850
|
+
.filter((item) => String(item.id) === String(target.id));
|
2851
|
+
if (targetItem.length > 0) {
|
2852
|
+
targetItem[0].hasChild = target.hasChild;
|
2853
|
+
}
|
2827
2854
|
}
|
2828
2855
|
if (!currItem.isFile) {
|
2829
2856
|
//Check whether the source folder include other sub folders or not.
|
2830
2857
|
const subItems = currItem.parentId !== 0
|
2831
|
-
? filterByParent(parent, currItem.
|
2858
|
+
? filterByParent(parent, currItem.parentId) : [];
|
2832
2859
|
const itemData = filterById(parent, currItem.parentId);
|
2833
2860
|
itemData.hasChild = subItems.length > 1 ? true : false;
|
2834
2861
|
}
|
@@ -2951,7 +2978,6 @@ function createAjax(parent, data, fn, event, operation, targetPath) {
|
|
2951
2978
|
? getValue('path', data) : parent.path;
|
2952
2979
|
const pathArray = filePath.replace(/^\/|\/$/g, '').split('/');
|
2953
2980
|
const idValue = event === 'rename-end-parent' || (event === 'path-changed' && getValue('data', data).length !== 0 && isNullOrUndefined(parent.renamedItem))
|
2954
|
-
|| (event === 'paste-end' && (parent.targetModule === 'largeiconsview' || parent.targetModule === 'detailsview'))
|
2955
2981
|
? getValue('data', data)[0].id : pathArray[pathArray.length - 1];
|
2956
2982
|
const action = getValue('action', data);
|
2957
2983
|
const isFileOperation = (action === 'move' || action === 'rename' || action === 'copy' || action === 'delete' || action === 'search') && event !== 'rename-end';
|
@@ -10297,6 +10323,15 @@ class NavigationPane {
|
|
10297
10323
|
this.removeChildNodes(e.selectedNode);
|
10298
10324
|
}
|
10299
10325
|
onDragEnd(args) {
|
10326
|
+
if (isFileSystemData(this.parent)) {
|
10327
|
+
this.moveNames = [];
|
10328
|
+
const obj = this.parent.dragData;
|
10329
|
+
for (let i = 0; i < obj.length; i++) {
|
10330
|
+
if (getValue('isFile', obj[i]) === false) {
|
10331
|
+
this.moveNames.push(getValue('_fm_id', obj[i]));
|
10332
|
+
}
|
10333
|
+
}
|
10334
|
+
}
|
10300
10335
|
let moveNames = [];
|
10301
10336
|
if (this.parent.isPasteError || this.parent.isSearchDrag) {
|
10302
10337
|
moveNames = this.getMoveNames(args.files, this.parent.isSearchDrag, this.parent.dragPath);
|
@@ -10402,11 +10437,6 @@ class NavigationPane {
|
|
10402
10437
|
if (isFileSystemData(this.parent) && (this.parent.path === this.parent.dropPath || this.parent.targetModule === 'navigationpane')) {
|
10403
10438
|
return;
|
10404
10439
|
}
|
10405
|
-
if (this.parent.hasId) {
|
10406
|
-
this.parent.isDropEnd = !this.parent.isPasteError;
|
10407
|
-
readDropPath(this.parent);
|
10408
|
-
return;
|
10409
|
-
}
|
10410
10440
|
if ((this.parent.dropPath.indexOf(getDirectoryPath(this.parent, args)) === -1)) {
|
10411
10441
|
this.parent.isDropEnd = false;
|
10412
10442
|
readDropPath(this.parent);
|