@syncfusion/ej2-filemanager 27.1.48 → 27.1.51
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/.eslintrc.json +4 -2
- 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 +195 -154
- package/dist/es6/ej2-filemanager.es2015.js.map +1 -1
- package/dist/es6/ej2-filemanager.es5.js +195 -154
- 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 +15 -15
- package/src/file-manager/common/operations.js +189 -144
- package/src/file-manager/layout/details-view.js +2 -4
- package/src/file-manager/layout/navigation-pane.js +3 -5
- package/tslint.json +111 -0
@@ -3320,14 +3320,7 @@ function readSuccess(parent, result, event) {
|
|
3320
3320
|
}
|
3321
3321
|
}
|
3322
3322
|
catch (error) {
|
3323
|
-
|
3324
|
-
files: null,
|
3325
|
-
error: {
|
3326
|
-
message: error.message,
|
3327
|
-
fileExists: null
|
3328
|
-
}
|
3329
|
-
};
|
3330
|
-
onFailure(parent, errorResult, 'read');
|
3323
|
+
handleCatchError(parent, error, 'read');
|
3331
3324
|
parent.setProperties({ path: parent.oldPath }, true);
|
3332
3325
|
parent.pathNames.pop();
|
3333
3326
|
}
|
@@ -3426,61 +3419,69 @@ function createSuccess(parent, result, itemName) {
|
|
3426
3419
|
* @private
|
3427
3420
|
*/
|
3428
3421
|
function renameSuccess(parent, result) {
|
3429
|
-
|
3430
|
-
if (!isNullOrUndefined(
|
3431
|
-
parent.dialogObj
|
3432
|
-
|
3433
|
-
|
3434
|
-
|
3435
|
-
|
3436
|
-
|
3437
|
-
|
3438
|
-
|
3439
|
-
|
3440
|
-
|
3441
|
-
|
3442
|
-
|
3443
|
-
parent.
|
3444
|
-
|
3445
|
-
|
3446
|
-
|
3447
|
-
|
3448
|
-
parent.
|
3449
|
-
|
3450
|
-
|
3451
|
-
|
3452
|
-
|
3453
|
-
else {
|
3454
|
-
parent.itemData = [getPathObject(parent)];
|
3455
|
-
if (parent.breadcrumbbarModule.searchObj.value !== '') {
|
3456
|
-
Search(parent, renameEnd, parent.path, parent.searchWord, parent.showHiddenItems, !parent.searchSettings.ignoreCase);
|
3422
|
+
try {
|
3423
|
+
if (!isNullOrUndefined(result.files)) {
|
3424
|
+
if (!isNullOrUndefined(parent.dialogObj)) {
|
3425
|
+
parent.dialogObj.hide();
|
3426
|
+
}
|
3427
|
+
var args = { action: 'rename', result: result };
|
3428
|
+
parent.trigger('success', args);
|
3429
|
+
parent.renamedItem = Array.isArray(result.files) ? result.files[0] : result.files;
|
3430
|
+
var renameEventArgs = {
|
3431
|
+
newName: parent.renamedItem.name,
|
3432
|
+
itemData: parent.renamedItem,
|
3433
|
+
path: parent.path
|
3434
|
+
};
|
3435
|
+
parent.trigger('rename', renameEventArgs);
|
3436
|
+
if (parent.activeModule === 'navigationpane') {
|
3437
|
+
parent.pathId.pop();
|
3438
|
+
parent.itemData = [getValue(parent.pathId[parent.pathId.length - 1], parent.feParent)];
|
3439
|
+
read(parent, renameEndParent, getValue('filterPath', parent.renamedItem).replace(/\\/g, '/'));
|
3440
|
+
parent.itemData[0] = parent.renamedItem;
|
3441
|
+
if (getValue('filterPath', parent.renamedItem) === getValue('filterPath', parent.itemData[0]) && parent.pathNames.length > 1) {
|
3442
|
+
parent.pathNames[parent.pathNames.length - 1] = parent.renameText;
|
3443
|
+
}
|
3444
|
+
read(parent, pathChanged, parent.path === '/' ? parent.path : getValue('filterPath', parent.renamedItem).replace(/\\/g, '/') + parent.renamedItem.name + '/');
|
3445
|
+
parent.renamedItem = null;
|
3457
3446
|
}
|
3458
3447
|
else {
|
3459
|
-
|
3460
|
-
|
3448
|
+
parent.itemData = [getPathObject(parent)];
|
3449
|
+
if (parent.breadcrumbbarModule.searchObj.value !== '') {
|
3450
|
+
Search(parent, renameEnd, parent.path, parent.searchWord, parent.showHiddenItems, !parent.searchSettings.ignoreCase);
|
3461
3451
|
}
|
3462
3452
|
else {
|
3463
|
-
|
3453
|
+
if (parent.isFiltered) {
|
3454
|
+
filter(parent, renameEnd);
|
3455
|
+
}
|
3456
|
+
else {
|
3457
|
+
read(parent, renameEnd, parent.path);
|
3458
|
+
}
|
3464
3459
|
}
|
3465
3460
|
}
|
3466
3461
|
}
|
3467
|
-
}
|
3468
|
-
else {
|
3469
|
-
if (result.error.code === '400' && parent.dialogObj && parent.dialogObj.visible) {
|
3470
|
-
var ele = select('#rename', parent.dialogObj.element);
|
3471
|
-
var error = getLocaleText(parent, 'Validation-Rename-Exists').replace('{0}', '"' + parent.currentItemText + '"');
|
3472
|
-
error = error.replace('{1}', '"' + ele.value + '"');
|
3473
|
-
ele.parentElement.nextElementSibling.innerHTML = error;
|
3474
|
-
var args = { action: 'rename', error: result.error };
|
3475
|
-
parent.trigger('failure', args);
|
3476
|
-
}
|
3477
3462
|
else {
|
3478
|
-
if (
|
3479
|
-
parent.dialogObj.
|
3463
|
+
if (result.error.code === '400' && parent.dialogObj && parent.dialogObj.visible) {
|
3464
|
+
var ele = select('#rename', parent.dialogObj.element);
|
3465
|
+
var error = getLocaleText(parent, 'Validation-Rename-Exists').replace('{0}', '"' + parent.currentItemText + '"');
|
3466
|
+
error = error.replace('{1}', '"' + ele.value + '"');
|
3467
|
+
ele.parentElement.nextElementSibling.innerHTML = error;
|
3468
|
+
var args = { action: 'rename', error: result.error };
|
3469
|
+
parent.trigger('failure', args);
|
3470
|
+
}
|
3471
|
+
else {
|
3472
|
+
if (!isNullOrUndefined(parent.dialogObj)) {
|
3473
|
+
parent.dialogObj.hide();
|
3474
|
+
}
|
3475
|
+
onFailure(parent, result, 'rename');
|
3480
3476
|
}
|
3481
|
-
onFailure(parent, result, 'rename');
|
3482
3477
|
}
|
3483
3478
|
}
|
3479
|
+
catch (error) {
|
3480
|
+
if (!isNullOrUndefined(parent.dialogObj)) {
|
3481
|
+
parent.dialogObj.hide();
|
3482
|
+
}
|
3483
|
+
handleCatchError(parent, error, 'rename');
|
3484
|
+
}
|
3484
3485
|
}
|
3485
3486
|
/* istanbul ignore next */
|
3486
3487
|
/**
|
@@ -3494,36 +3495,41 @@ function renameSuccess(parent, result) {
|
|
3494
3495
|
* @private
|
3495
3496
|
*/
|
3496
3497
|
function pasteSuccess(parent, result, path, operation) {
|
3497
|
-
|
3498
|
-
|
3499
|
-
|
3500
|
-
|
3501
|
-
|
3502
|
-
|
3503
|
-
|
3504
|
-
|
3505
|
-
|
3506
|
-
|
3507
|
-
|
3508
|
-
|
3498
|
+
try {
|
3499
|
+
var moveorcopyEventArgs = {
|
3500
|
+
itemData: result.files,
|
3501
|
+
isCopy: operation === 'copy' ? true : false,
|
3502
|
+
path: path,
|
3503
|
+
targetData: parent.itemData[0],
|
3504
|
+
targetPath: parent.path
|
3505
|
+
};
|
3506
|
+
parent.trigger('move', moveorcopyEventArgs);
|
3507
|
+
if (result.error && result.error.fileExists) {
|
3508
|
+
parent.fileLength = 0;
|
3509
|
+
if (!isNullOrUndefined(result.files)) {
|
3510
|
+
parent.isPasteError = true;
|
3511
|
+
doPasteUpdate(parent, operation, result);
|
3512
|
+
}
|
3513
|
+
createExtDialog(parent, 'DuplicateItems', result.error.fileExists);
|
3514
|
+
if (result.error.code === '404') {
|
3515
|
+
createDialog(parent, 'Error', result);
|
3516
|
+
}
|
3517
|
+
}
|
3518
|
+
else if (!result.error && !isNullOrUndefined(result.files)) {
|
3519
|
+
parent.isPasteError = false;
|
3509
3520
|
doPasteUpdate(parent, operation, result);
|
3510
3521
|
}
|
3511
|
-
|
3512
|
-
|
3522
|
+
else if (result.error && !isNullOrUndefined(result.files)) {
|
3523
|
+
parent.isPasteError = true;
|
3524
|
+
doPasteUpdate(parent, operation, result);
|
3513
3525
|
createDialog(parent, 'Error', result);
|
3514
3526
|
}
|
3527
|
+
else {
|
3528
|
+
onFailure(parent, result, operation);
|
3529
|
+
}
|
3515
3530
|
}
|
3516
|
-
|
3517
|
-
parent
|
3518
|
-
doPasteUpdate(parent, operation, result);
|
3519
|
-
}
|
3520
|
-
else if (result.error && !isNullOrUndefined(result.files)) {
|
3521
|
-
parent.isPasteError = true;
|
3522
|
-
doPasteUpdate(parent, operation, result);
|
3523
|
-
createDialog(parent, 'Error', result);
|
3524
|
-
}
|
3525
|
-
else {
|
3526
|
-
onFailure(parent, result, operation);
|
3531
|
+
catch (error) {
|
3532
|
+
handleCatchError(parent, error, operation);
|
3527
3533
|
}
|
3528
3534
|
}
|
3529
3535
|
/**
|
@@ -3536,25 +3542,30 @@ function pasteSuccess(parent, result, path, operation) {
|
|
3536
3542
|
* @private
|
3537
3543
|
*/
|
3538
3544
|
function deleteSuccess(parent, result, path) {
|
3539
|
-
|
3540
|
-
|
3541
|
-
|
3542
|
-
|
3543
|
-
|
3544
|
-
|
3545
|
-
|
3546
|
-
|
3547
|
-
|
3548
|
-
|
3549
|
-
|
3545
|
+
try {
|
3546
|
+
var deleteEventArgs = {
|
3547
|
+
itemData: result.files,
|
3548
|
+
path: path
|
3549
|
+
};
|
3550
|
+
parent.trigger('delete', deleteEventArgs);
|
3551
|
+
if (!isNullOrUndefined(result.files)) {
|
3552
|
+
parent.setProperties({ path: path }, true);
|
3553
|
+
parent.itemData = [getPathObject(parent)];
|
3554
|
+
read(parent, deleteEnd, parent.path);
|
3555
|
+
if (result.error) {
|
3556
|
+
onFailure(parent, result, 'delete');
|
3557
|
+
}
|
3558
|
+
else {
|
3559
|
+
var args = { action: 'delete', result: result };
|
3560
|
+
parent.trigger('success', args);
|
3561
|
+
}
|
3550
3562
|
}
|
3551
3563
|
else {
|
3552
|
-
|
3553
|
-
parent.trigger('success', args);
|
3564
|
+
onFailure(parent, result, 'delete');
|
3554
3565
|
}
|
3555
3566
|
}
|
3556
|
-
|
3557
|
-
|
3567
|
+
catch (error) {
|
3568
|
+
handleCatchError(parent, error, 'delete');
|
3558
3569
|
}
|
3559
3570
|
}
|
3560
3571
|
/**
|
@@ -3570,13 +3581,18 @@ function deleteSuccess(parent, result, path) {
|
|
3570
3581
|
function detailsSuccess(
|
3571
3582
|
// eslint:disable-next-line
|
3572
3583
|
parent, result, path, operation) {
|
3573
|
-
|
3574
|
-
|
3575
|
-
|
3576
|
-
|
3584
|
+
try {
|
3585
|
+
if (!isNullOrUndefined(result.details)) {
|
3586
|
+
createDialog(parent, operation, null, result.details);
|
3587
|
+
var args = { action: 'details', result: result };
|
3588
|
+
parent.trigger('success', args);
|
3589
|
+
}
|
3590
|
+
else {
|
3591
|
+
onFailure(parent, result, 'details');
|
3592
|
+
}
|
3577
3593
|
}
|
3578
|
-
|
3579
|
-
|
3594
|
+
catch (error) {
|
3595
|
+
handleCatchError(parent, error, 'details');
|
3580
3596
|
}
|
3581
3597
|
}
|
3582
3598
|
/**
|
@@ -3623,13 +3639,18 @@ function Search(parent, event, path, searchString, showHiddenItems, caseSensitiv
|
|
3623
3639
|
* @private
|
3624
3640
|
*/
|
3625
3641
|
function searchSuccess(parent, result, event) {
|
3626
|
-
|
3627
|
-
|
3628
|
-
|
3629
|
-
|
3642
|
+
try {
|
3643
|
+
if (!isNullOrUndefined(result.files)) {
|
3644
|
+
parent.notify(event, result);
|
3645
|
+
var args = { action: 'search', result: result };
|
3646
|
+
parent.trigger('success', args);
|
3647
|
+
}
|
3648
|
+
else {
|
3649
|
+
onFailure(parent, result, 'search');
|
3650
|
+
}
|
3630
3651
|
}
|
3631
|
-
|
3632
|
-
|
3652
|
+
catch (error) {
|
3653
|
+
handleCatchError(parent, error, 'search');
|
3633
3654
|
}
|
3634
3655
|
}
|
3635
3656
|
/* istanbul ignore next */
|
@@ -3673,52 +3694,76 @@ function Download(parent, path, items) {
|
|
3673
3694
|
parent.element.removeChild(form);
|
3674
3695
|
}
|
3675
3696
|
else {
|
3676
|
-
|
3677
|
-
|
3678
|
-
|
3679
|
-
|
3680
|
-
|
3681
|
-
|
3682
|
-
|
3683
|
-
|
3684
|
-
|
3685
|
-
|
3686
|
-
|
3687
|
-
|
3688
|
-
|
3689
|
-
|
3690
|
-
|
3691
|
-
else {
|
3692
|
-
fileName_1 = parent.itemData.length > 1 ? 'files.zip' : getValue('isFile', parent.itemData[0]) ? getValue('name', parent.itemData[0]) : getValue('name', parent.itemData[0]) + '.zip';
|
3693
|
-
}
|
3694
|
-
},
|
3695
|
-
onSuccess: function (e) {
|
3696
|
-
parent.trigger('success', downloadArgs);
|
3697
|
-
var blob = e;
|
3698
|
-
var blobUrl = URL.createObjectURL(blob);
|
3699
|
-
var link = document.createElement('a');
|
3700
|
-
link.href = blobUrl;
|
3701
|
-
link.download = fileName_1;
|
3702
|
-
document.body.appendChild(link);
|
3703
|
-
link.click();
|
3704
|
-
document.body.removeChild(link);
|
3705
|
-
},
|
3706
|
-
onFailure: function (e) {
|
3707
|
-
var result = {
|
3708
|
-
error: {
|
3709
|
-
code: e.status.toString(),
|
3710
|
-
message: getLocaleText(parent, 'Network-Error') + ' ' + parent.ajaxSettings.downloadUrl
|
3697
|
+
try {
|
3698
|
+
var contentDisposition_1;
|
3699
|
+
var fileName_1;
|
3700
|
+
var fetch_1 = new Fetch({
|
3701
|
+
url: getValue('url', downloadArgs.ajaxSettings),
|
3702
|
+
type: getValue('type', downloadArgs.ajaxSettings),
|
3703
|
+
contentType: getValue('contentType', downloadArgs.ajaxSettings),
|
3704
|
+
responseType: getValue('responseType', downloadArgs.ajaxSettings),
|
3705
|
+
beforeSend: getValue('beforeSend', downloadArgs.ajaxSettings),
|
3706
|
+
onLoad: function (e) {
|
3707
|
+
contentDisposition_1 = e.headers.get('Content-Disposition');
|
3708
|
+
if (contentDisposition_1) {
|
3709
|
+
var filenameMatch = contentDisposition_1.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);
|
3710
|
+
var extractedFilename = filenameMatch && filenameMatch[1];
|
3711
|
+
fileName_1 = extractedFilename ? extractedFilename.replace(/['"]/g, '') : fileName_1;
|
3711
3712
|
}
|
3712
|
-
|
3713
|
-
|
3714
|
-
|
3715
|
-
|
3716
|
-
|
3717
|
-
|
3713
|
+
else {
|
3714
|
+
fileName_1 = parent.itemData.length > 1 ? 'files.zip' : getValue('isFile', parent.itemData[0]) ? getValue('name', parent.itemData[0]) : getValue('name', parent.itemData[0]) + '.zip';
|
3715
|
+
}
|
3716
|
+
},
|
3717
|
+
onSuccess: function (e) {
|
3718
|
+
parent.trigger('success', downloadArgs);
|
3719
|
+
var blob = e;
|
3720
|
+
var blobUrl = URL.createObjectURL(blob);
|
3721
|
+
var link = document.createElement('a');
|
3722
|
+
link.href = blobUrl;
|
3723
|
+
link.download = fileName_1;
|
3724
|
+
document.body.appendChild(link);
|
3725
|
+
link.click();
|
3726
|
+
document.body.removeChild(link);
|
3727
|
+
},
|
3728
|
+
onFailure: function (e) {
|
3729
|
+
var result = {
|
3730
|
+
error: {
|
3731
|
+
code: e.status.toString(),
|
3732
|
+
message: getLocaleText(parent, 'Network-Error') + ' ' + parent.ajaxSettings.downloadUrl
|
3733
|
+
}
|
3734
|
+
};
|
3735
|
+
createDialog(parent, 'Error', result);
|
3736
|
+
parent.trigger('failure', downloadArgs);
|
3737
|
+
}
|
3738
|
+
});
|
3739
|
+
fetch_1.send(JSON.stringify(downloadArgs.data));
|
3740
|
+
}
|
3741
|
+
catch (error) {
|
3742
|
+
handleCatchError(parent, error, 'download');
|
3743
|
+
}
|
3718
3744
|
}
|
3719
3745
|
}
|
3720
3746
|
});
|
3721
3747
|
}
|
3748
|
+
/**
|
3749
|
+
* Function for on catch handler in File Manager.
|
3750
|
+
*
|
3751
|
+
* @param {IFileManager} parent - specifies the parent element.
|
3752
|
+
* @param {any} error - specifies the catch error.
|
3753
|
+
* @param {string} action - specifies the action.
|
3754
|
+
* @returns {void}
|
3755
|
+
* @private
|
3756
|
+
*/
|
3757
|
+
function handleCatchError(parent, error, action) {
|
3758
|
+
var errorResult = {
|
3759
|
+
files: null,
|
3760
|
+
error: {
|
3761
|
+
message: error.message,
|
3762
|
+
fileExists: null
|
3763
|
+
}
|
3764
|
+
};
|
3765
|
+
onFailure(parent, errorResult, action);
|
3766
|
+
}
|
3722
3767
|
|
3723
3768
|
/**
|
3724
3769
|
*
|
@@ -9889,10 +9934,7 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
|
|
9889
9934
|
NavigationPane.prototype.addDragDrop = function () {
|
9890
9935
|
var _this = this;
|
9891
9936
|
if (!this.parent.isMobile && this.treeObj) {
|
9892
|
-
if (this.parent.allowDragAndDrop) {
|
9893
|
-
if (this.dragObj) {
|
9894
|
-
this.dragObj.destroy();
|
9895
|
-
}
|
9937
|
+
if (this.parent.allowDragAndDrop && isNullOrUndefined(this.dragObj)) {
|
9896
9938
|
this.dragObj = new Draggable(this.treeObj.element, {
|
9897
9939
|
cursorAt: this.parent.dragCursorPosition,
|
9898
9940
|
dragTarget: '.' + FULLROW,
|
@@ -9910,6 +9952,7 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
|
|
9910
9952
|
}
|
9911
9953
|
else if (!this.parent.allowDragAndDrop && this.dragObj) {
|
9912
9954
|
this.dragObj.destroy();
|
9955
|
+
this.dragObj = null;
|
9913
9956
|
}
|
9914
9957
|
}
|
9915
9958
|
};
|
@@ -10419,7 +10462,7 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
|
|
10419
10462
|
};
|
10420
10463
|
/* istanbul ignore next */
|
10421
10464
|
NavigationPane.prototype.checkDropPath = function (args) {
|
10422
|
-
if (isFileSystemData(this.parent) && this.parent.path === this.parent.dropPath || this.parent.targetModule === 'navigationpane') {
|
10465
|
+
if (isFileSystemData(this.parent) && (this.parent.path === this.parent.dropPath || this.parent.targetModule === 'navigationpane')) {
|
10423
10466
|
return;
|
10424
10467
|
}
|
10425
10468
|
if (this.parent.hasId) {
|
@@ -11692,10 +11735,7 @@ var DetailsView = /** @__PURE__ @class */ (function () {
|
|
11692
11735
|
DetailsView.prototype.createDragObj = function () {
|
11693
11736
|
var _this = this;
|
11694
11737
|
if (this.gridObj) {
|
11695
|
-
if (this.parent.allowDragAndDrop) {
|
11696
|
-
if (this.dragObj) {
|
11697
|
-
this.dragObj.destroy();
|
11698
|
-
}
|
11738
|
+
if (this.parent.allowDragAndDrop && isNullOrUndefined(this.dragObj)) {
|
11699
11739
|
this.dragObj = new Draggable(this.gridObj.element, {
|
11700
11740
|
cursorAt: this.parent.dragCursorPosition,
|
11701
11741
|
distance: 5,
|
@@ -11713,6 +11753,7 @@ var DetailsView = /** @__PURE__ @class */ (function () {
|
|
11713
11753
|
}
|
11714
11754
|
else if (!this.parent.allowDragAndDrop && this.dragObj) {
|
11715
11755
|
this.dragObj.destroy();
|
11756
|
+
this.dragObj = null;
|
11716
11757
|
}
|
11717
11758
|
}
|
11718
11759
|
};
|