@syncfusion/ej2-filemanager 28.1.33 → 28.1.39
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/README.md +1 -1
- package/dist/ej2-filemanager.min.js +2 -2
- package/dist/ej2-filemanager.umd.min.js +2 -2
- package/dist/ej2-filemanager.umd.min.js.map +1 -1
- package/dist/es6/ej2-filemanager.es2015.js +42 -11
- package/dist/es6/ej2-filemanager.es2015.js.map +1 -1
- package/dist/es6/ej2-filemanager.es5.js +50 -19
- package/dist/es6/ej2-filemanager.es5.js.map +1 -1
- package/dist/global/ej2-filemanager.min.js +2 -2
- package/dist/global/ej2-filemanager.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +12 -12
- 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 +11 -6
@@ -1863,9 +1863,9 @@ function getDirectoryPath(parent, args) {
|
|
1863
1863
|
var fPath = getValue(parent.hasId && !isNullOrUndefined(parent.ajaxSettings.url) ? 'filterId' : 'filterPath', args.cwd);
|
1864
1864
|
if (!isNullOrUndefined(fPath)) {
|
1865
1865
|
if (fPath === '') {
|
1866
|
-
return
|
1866
|
+
return '/';
|
1867
1867
|
}
|
1868
|
-
return fPath.replace(/\\/g, '/') + filePath;
|
1868
|
+
return fPath.replace(/\\/g, '/').replace(/^.*?(?=\/)/, '') + filePath;
|
1869
1869
|
}
|
1870
1870
|
else {
|
1871
1871
|
return isFileSystemData(parent) ? filePath : parent.path + filePath;
|
@@ -2772,7 +2772,7 @@ function createNewItem(data, target, itemName, isCopy) {
|
|
2772
2772
|
}
|
2773
2773
|
}
|
2774
2774
|
var currentDate = new Date();
|
2775
|
-
var folderPath = target.id !== 0 ? target.filterPath + target.name : '\\';
|
2775
|
+
var folderPath = String(target.id) !== String(0) && !isNullOrUndefined(target.parentId) ? target.filterPath + target.name + '\\' : '\\';
|
2776
2776
|
Object.assign(newItem, {
|
2777
2777
|
dateCreated: currentDate,
|
2778
2778
|
dateModified: currentDate,
|
@@ -2906,7 +2906,9 @@ function triggerRenameOperation(parent, data, eventArgs) {
|
|
2906
2906
|
if (isFileSystemData(parent)) {
|
2907
2907
|
if (!isFileExists(parent.fileSystemData, args.newName)) {
|
2908
2908
|
var fileData = filterById(parent, args.itemData[0].id);
|
2909
|
+
var oldName = fileData.name;
|
2909
2910
|
fileData.name = args.newName;
|
2911
|
+
updateChildrenFilterPath(parent, fileData.id, oldName, args.newName);
|
2910
2912
|
}
|
2911
2913
|
else {
|
2912
2914
|
var message = 'Cannot rename' + args.itemData[0].name + 'to' + args.newName + ': destination already exists.';
|
@@ -2915,6 +2917,26 @@ function triggerRenameOperation(parent, data, eventArgs) {
|
|
2915
2917
|
}
|
2916
2918
|
});
|
2917
2919
|
}
|
2920
|
+
/**
|
2921
|
+
* Function to update child item filter path.
|
2922
|
+
*
|
2923
|
+
* @param {IFileManager} parent - specifies the parent element.
|
2924
|
+
* @param {string | number} parentId - specifies the parent id.
|
2925
|
+
* @param {string} oldName - specifies the previous name.
|
2926
|
+
* @param {string} newName - specifies the new name.
|
2927
|
+
* @returns {void}
|
2928
|
+
* @private
|
2929
|
+
*/
|
2930
|
+
function updateChildrenFilterPath(parent, parentId, oldName, newName) {
|
2931
|
+
parent.fileSystemData.forEach(function (item) {
|
2932
|
+
if (String(item.parentId) === String(parentId)) {
|
2933
|
+
var oldPath = item.filterPath;
|
2934
|
+
var newPath = oldPath.replace(oldName + '\\', newName + '\\');
|
2935
|
+
item.filterPath = newPath;
|
2936
|
+
updateChildrenFilterPath(parent, item.id, oldName, newName);
|
2937
|
+
}
|
2938
|
+
});
|
2939
|
+
}
|
2918
2940
|
/**
|
2919
2941
|
* Function to trigger move or copy operation.
|
2920
2942
|
*
|
@@ -2970,18 +2992,23 @@ function triggerMoveOrCopyOperation(parent, data, eventArgs) {
|
|
2970
2992
|
}
|
2971
2993
|
return;
|
2972
2994
|
}
|
2973
|
-
var
|
2974
|
-
var getTargetFiles = filterByParent(parent,
|
2995
|
+
var target_1 = args.targetData;
|
2996
|
+
var getTargetFiles = filterByParent(parent, target_1.id);
|
2975
2997
|
for (var i = 0; i < args.itemData.length; i++) {
|
2976
2998
|
var currItem = args.itemData[i];
|
2977
2999
|
if (!isFileExists(getTargetFiles, currItem.name) || getValue('renameFiles', data).length > 0) {
|
2978
|
-
if (!
|
2979
|
-
|
3000
|
+
if (!target_1.hasChild) {
|
3001
|
+
target_1.hasChild = !currItem.isFile;
|
3002
|
+
var targetItem = parent.fileSystemData
|
3003
|
+
.filter(function (item) { return String(item.id) === String(target_1.id); });
|
3004
|
+
if (targetItem.length > 0) {
|
3005
|
+
targetItem[0].hasChild = target_1.hasChild;
|
3006
|
+
}
|
2980
3007
|
}
|
2981
3008
|
if (!currItem.isFile) {
|
2982
3009
|
//Check whether the source folder include other sub folders or not.
|
2983
3010
|
var subItems = currItem.parentId !== 0
|
2984
|
-
? filterByParent(parent, currItem.
|
3011
|
+
? filterByParent(parent, currItem.parentId) : [];
|
2985
3012
|
var itemData = filterById(parent, currItem.parentId);
|
2986
3013
|
itemData.hasChild = subItems.length > 1 ? true : false;
|
2987
3014
|
}
|
@@ -2992,13 +3019,13 @@ function triggerMoveOrCopyOperation(parent, data, eventArgs) {
|
|
2992
3019
|
fileData.name = currItem.name;
|
2993
3020
|
parent.responseData.error = null;
|
2994
3021
|
parent.existingFileCount++;
|
2995
|
-
parent.dropData =
|
3022
|
+
parent.dropData = target_1;
|
2996
3023
|
parent.dropPath = args.path;
|
2997
3024
|
var pathArray = args.targetPath.replace(/^\/|\/$/g, '').split('/');
|
2998
|
-
|
3025
|
+
target_1 = filterById(parent, pathArray[pathArray.length - 1]);
|
2999
3026
|
}
|
3000
|
-
fileData.parentId =
|
3001
|
-
fileData.filterPath =
|
3027
|
+
fileData.parentId = target_1.id;
|
3028
|
+
fileData.filterPath = target_1.id === 0 ? '\\' : target_1.filterPath + target_1.name + '\\';
|
3002
3029
|
}
|
3003
3030
|
else {
|
3004
3031
|
file_1.push(currItem.name);
|
@@ -3104,7 +3131,6 @@ function createAjax(parent, data, fn, event, operation, targetPath) {
|
|
3104
3131
|
? getValue('path', data) : parent.path;
|
3105
3132
|
var pathArray = filePath.replace(/^\/|\/$/g, '').split('/');
|
3106
3133
|
var idValue = event === 'rename-end-parent' || (event === 'path-changed' && getValue('data', data).length !== 0 && isNullOrUndefined(parent.renamedItem))
|
3107
|
-
|| (event === 'paste-end' && (parent.targetModule === 'largeiconsview' || parent.targetModule === 'detailsview'))
|
3108
3134
|
? getValue('data', data)[0].id : pathArray[pathArray.length - 1];
|
3109
3135
|
var action = getValue('action', data);
|
3110
3136
|
var isFileOperation = (action === 'move' || action === 'rename' || action === 'copy' || action === 'delete' || action === 'search') && event !== 'rename-end';
|
@@ -10175,7 +10201,7 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
|
|
10175
10201
|
if (!this.renameParent) {
|
10176
10202
|
this.parent.activeModule = 'navigationpane';
|
10177
10203
|
var nodeData = this.getTreeData(getValue('id', args.nodeData));
|
10178
|
-
if (args.node.getAttribute('data-uid') !== this.parent.pathId[this.parent.pathId.length - 1] && !this.isRightClick && !this.isNodeClickCalled || this.isSameNodeClicked) {
|
10204
|
+
if (args.node.getAttribute('data-uid') !== this.parent.pathId[this.parent.pathId.length - 1] && !this.isRightClick && !this.isNodeClickCalled || this.isSameNodeClicked || this.isPathDragged) {
|
10179
10205
|
this.isNodeClickCalled = false;
|
10180
10206
|
if (!this.isSameNodeClicked) {
|
10181
10207
|
this.isSameNodeClicked = true;
|
@@ -10191,6 +10217,7 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
|
|
10191
10217
|
this.restrictSelecting = this.isNodeClickCalled ? this.previousSelected[0] !== args.node.getAttribute('data-uid') : false;
|
10192
10218
|
this.isNodeClickCalled = true;
|
10193
10219
|
this.isSameNodeClicked = false;
|
10220
|
+
this.isPathDragged = false;
|
10194
10221
|
this.previousSelected = this.treeObj.selectedNodes;
|
10195
10222
|
this.treeObj.setProperties({ selectedNodes: [args.node.getAttribute('data-uid')] });
|
10196
10223
|
}
|
@@ -10501,6 +10528,15 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
|
|
10501
10528
|
this.removeChildNodes(e.selectedNode);
|
10502
10529
|
};
|
10503
10530
|
NavigationPane.prototype.onDragEnd = function (args) {
|
10531
|
+
if (isFileSystemData(this.parent)) {
|
10532
|
+
this.moveNames = [];
|
10533
|
+
var obj = this.parent.dragData;
|
10534
|
+
for (var i = 0; i < obj.length; i++) {
|
10535
|
+
if (getValue('isFile', obj[i]) === false) {
|
10536
|
+
this.moveNames.push(getValue('_fm_id', obj[i]));
|
10537
|
+
}
|
10538
|
+
}
|
10539
|
+
}
|
10504
10540
|
var moveNames = [];
|
10505
10541
|
if (this.parent.isPasteError || this.parent.isSearchDrag) {
|
10506
10542
|
moveNames = this.getMoveNames(args.files, this.parent.isSearchDrag, this.parent.dragPath);
|
@@ -10606,11 +10642,6 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
|
|
10606
10642
|
if (isFileSystemData(this.parent) && (this.parent.path === this.parent.dropPath || this.parent.targetModule === 'navigationpane')) {
|
10607
10643
|
return;
|
10608
10644
|
}
|
10609
|
-
if (this.parent.hasId) {
|
10610
|
-
this.parent.isDropEnd = !this.parent.isPasteError;
|
10611
|
-
readDropPath(this.parent);
|
10612
|
-
return;
|
10613
|
-
}
|
10614
10645
|
if ((this.parent.dropPath.indexOf(getDirectoryPath(this.parent, args)) === -1)) {
|
10615
10646
|
this.parent.isDropEnd = false;
|
10616
10647
|
readDropPath(this.parent);
|