@syncfusion/ej2-filemanager 27.1.50 → 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 +10 -10
- 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
@@ -3171,14 +3171,7 @@ function readSuccess(parent, result, event) {
|
|
3171
3171
|
}
|
3172
3172
|
}
|
3173
3173
|
catch (error) {
|
3174
|
-
|
3175
|
-
files: null,
|
3176
|
-
error: {
|
3177
|
-
message: error.message,
|
3178
|
-
fileExists: null
|
3179
|
-
}
|
3180
|
-
};
|
3181
|
-
onFailure(parent, errorResult, 'read');
|
3174
|
+
handleCatchError(parent, error, 'read');
|
3182
3175
|
parent.setProperties({ path: parent.oldPath }, true);
|
3183
3176
|
parent.pathNames.pop();
|
3184
3177
|
}
|
@@ -3277,61 +3270,69 @@ function createSuccess(parent, result, itemName) {
|
|
3277
3270
|
* @private
|
3278
3271
|
*/
|
3279
3272
|
function renameSuccess(parent, result) {
|
3280
|
-
|
3281
|
-
if (!isNullOrUndefined(
|
3282
|
-
parent.dialogObj
|
3283
|
-
|
3284
|
-
|
3285
|
-
|
3286
|
-
|
3287
|
-
|
3288
|
-
|
3289
|
-
|
3290
|
-
|
3291
|
-
|
3292
|
-
|
3293
|
-
|
3294
|
-
parent.
|
3295
|
-
|
3296
|
-
|
3297
|
-
|
3298
|
-
|
3299
|
-
parent.
|
3300
|
-
|
3301
|
-
|
3302
|
-
|
3303
|
-
|
3304
|
-
else {
|
3305
|
-
parent.itemData = [getPathObject(parent)];
|
3306
|
-
if (parent.breadcrumbbarModule.searchObj.value !== '') {
|
3307
|
-
Search(parent, renameEnd, parent.path, parent.searchWord, parent.showHiddenItems, !parent.searchSettings.ignoreCase);
|
3273
|
+
try {
|
3274
|
+
if (!isNullOrUndefined(result.files)) {
|
3275
|
+
if (!isNullOrUndefined(parent.dialogObj)) {
|
3276
|
+
parent.dialogObj.hide();
|
3277
|
+
}
|
3278
|
+
const args = { action: 'rename', result: result };
|
3279
|
+
parent.trigger('success', args);
|
3280
|
+
parent.renamedItem = Array.isArray(result.files) ? result.files[0] : result.files;
|
3281
|
+
const renameEventArgs = {
|
3282
|
+
newName: parent.renamedItem.name,
|
3283
|
+
itemData: parent.renamedItem,
|
3284
|
+
path: parent.path
|
3285
|
+
};
|
3286
|
+
parent.trigger('rename', renameEventArgs);
|
3287
|
+
if (parent.activeModule === 'navigationpane') {
|
3288
|
+
parent.pathId.pop();
|
3289
|
+
parent.itemData = [getValue(parent.pathId[parent.pathId.length - 1], parent.feParent)];
|
3290
|
+
read(parent, renameEndParent, getValue('filterPath', parent.renamedItem).replace(/\\/g, '/'));
|
3291
|
+
parent.itemData[0] = parent.renamedItem;
|
3292
|
+
if (getValue('filterPath', parent.renamedItem) === getValue('filterPath', parent.itemData[0]) && parent.pathNames.length > 1) {
|
3293
|
+
parent.pathNames[parent.pathNames.length - 1] = parent.renameText;
|
3294
|
+
}
|
3295
|
+
read(parent, pathChanged, parent.path === '/' ? parent.path : getValue('filterPath', parent.renamedItem).replace(/\\/g, '/') + parent.renamedItem.name + '/');
|
3296
|
+
parent.renamedItem = null;
|
3308
3297
|
}
|
3309
3298
|
else {
|
3310
|
-
|
3311
|
-
|
3299
|
+
parent.itemData = [getPathObject(parent)];
|
3300
|
+
if (parent.breadcrumbbarModule.searchObj.value !== '') {
|
3301
|
+
Search(parent, renameEnd, parent.path, parent.searchWord, parent.showHiddenItems, !parent.searchSettings.ignoreCase);
|
3312
3302
|
}
|
3313
3303
|
else {
|
3314
|
-
|
3304
|
+
if (parent.isFiltered) {
|
3305
|
+
filter(parent, renameEnd);
|
3306
|
+
}
|
3307
|
+
else {
|
3308
|
+
read(parent, renameEnd, parent.path);
|
3309
|
+
}
|
3315
3310
|
}
|
3316
3311
|
}
|
3317
3312
|
}
|
3318
|
-
}
|
3319
|
-
else {
|
3320
|
-
if (result.error.code === '400' && parent.dialogObj && parent.dialogObj.visible) {
|
3321
|
-
const ele = select('#rename', parent.dialogObj.element);
|
3322
|
-
let error = getLocaleText(parent, 'Validation-Rename-Exists').replace('{0}', '"' + parent.currentItemText + '"');
|
3323
|
-
error = error.replace('{1}', '"' + ele.value + '"');
|
3324
|
-
ele.parentElement.nextElementSibling.innerHTML = error;
|
3325
|
-
const args = { action: 'rename', error: result.error };
|
3326
|
-
parent.trigger('failure', args);
|
3327
|
-
}
|
3328
3313
|
else {
|
3329
|
-
if (
|
3330
|
-
parent.dialogObj.
|
3314
|
+
if (result.error.code === '400' && parent.dialogObj && parent.dialogObj.visible) {
|
3315
|
+
const ele = select('#rename', parent.dialogObj.element);
|
3316
|
+
let error = getLocaleText(parent, 'Validation-Rename-Exists').replace('{0}', '"' + parent.currentItemText + '"');
|
3317
|
+
error = error.replace('{1}', '"' + ele.value + '"');
|
3318
|
+
ele.parentElement.nextElementSibling.innerHTML = error;
|
3319
|
+
const args = { action: 'rename', error: result.error };
|
3320
|
+
parent.trigger('failure', args);
|
3321
|
+
}
|
3322
|
+
else {
|
3323
|
+
if (!isNullOrUndefined(parent.dialogObj)) {
|
3324
|
+
parent.dialogObj.hide();
|
3325
|
+
}
|
3326
|
+
onFailure(parent, result, 'rename');
|
3331
3327
|
}
|
3332
|
-
onFailure(parent, result, 'rename');
|
3333
3328
|
}
|
3334
3329
|
}
|
3330
|
+
catch (error) {
|
3331
|
+
if (!isNullOrUndefined(parent.dialogObj)) {
|
3332
|
+
parent.dialogObj.hide();
|
3333
|
+
}
|
3334
|
+
handleCatchError(parent, error, 'rename');
|
3335
|
+
}
|
3335
3336
|
}
|
3336
3337
|
/* istanbul ignore next */
|
3337
3338
|
/**
|
@@ -3345,36 +3346,41 @@ function renameSuccess(parent, result) {
|
|
3345
3346
|
* @private
|
3346
3347
|
*/
|
3347
3348
|
function pasteSuccess(parent, result, path, operation) {
|
3348
|
-
|
3349
|
-
|
3350
|
-
|
3351
|
-
|
3352
|
-
|
3353
|
-
|
3354
|
-
|
3355
|
-
|
3356
|
-
|
3357
|
-
|
3358
|
-
|
3359
|
-
|
3349
|
+
try {
|
3350
|
+
const moveorcopyEventArgs = {
|
3351
|
+
itemData: result.files,
|
3352
|
+
isCopy: operation === 'copy' ? true : false,
|
3353
|
+
path: path,
|
3354
|
+
targetData: parent.itemData[0],
|
3355
|
+
targetPath: parent.path
|
3356
|
+
};
|
3357
|
+
parent.trigger('move', moveorcopyEventArgs);
|
3358
|
+
if (result.error && result.error.fileExists) {
|
3359
|
+
parent.fileLength = 0;
|
3360
|
+
if (!isNullOrUndefined(result.files)) {
|
3361
|
+
parent.isPasteError = true;
|
3362
|
+
doPasteUpdate(parent, operation, result);
|
3363
|
+
}
|
3364
|
+
createExtDialog(parent, 'DuplicateItems', result.error.fileExists);
|
3365
|
+
if (result.error.code === '404') {
|
3366
|
+
createDialog(parent, 'Error', result);
|
3367
|
+
}
|
3368
|
+
}
|
3369
|
+
else if (!result.error && !isNullOrUndefined(result.files)) {
|
3370
|
+
parent.isPasteError = false;
|
3360
3371
|
doPasteUpdate(parent, operation, result);
|
3361
3372
|
}
|
3362
|
-
|
3363
|
-
|
3373
|
+
else if (result.error && !isNullOrUndefined(result.files)) {
|
3374
|
+
parent.isPasteError = true;
|
3375
|
+
doPasteUpdate(parent, operation, result);
|
3364
3376
|
createDialog(parent, 'Error', result);
|
3365
3377
|
}
|
3378
|
+
else {
|
3379
|
+
onFailure(parent, result, operation);
|
3380
|
+
}
|
3366
3381
|
}
|
3367
|
-
|
3368
|
-
parent
|
3369
|
-
doPasteUpdate(parent, operation, result);
|
3370
|
-
}
|
3371
|
-
else if (result.error && !isNullOrUndefined(result.files)) {
|
3372
|
-
parent.isPasteError = true;
|
3373
|
-
doPasteUpdate(parent, operation, result);
|
3374
|
-
createDialog(parent, 'Error', result);
|
3375
|
-
}
|
3376
|
-
else {
|
3377
|
-
onFailure(parent, result, operation);
|
3382
|
+
catch (error) {
|
3383
|
+
handleCatchError(parent, error, operation);
|
3378
3384
|
}
|
3379
3385
|
}
|
3380
3386
|
/**
|
@@ -3387,25 +3393,30 @@ function pasteSuccess(parent, result, path, operation) {
|
|
3387
3393
|
* @private
|
3388
3394
|
*/
|
3389
3395
|
function deleteSuccess(parent, result, path) {
|
3390
|
-
|
3391
|
-
|
3392
|
-
|
3393
|
-
|
3394
|
-
|
3395
|
-
|
3396
|
-
|
3397
|
-
|
3398
|
-
|
3399
|
-
|
3400
|
-
|
3396
|
+
try {
|
3397
|
+
const deleteEventArgs = {
|
3398
|
+
itemData: result.files,
|
3399
|
+
path: path
|
3400
|
+
};
|
3401
|
+
parent.trigger('delete', deleteEventArgs);
|
3402
|
+
if (!isNullOrUndefined(result.files)) {
|
3403
|
+
parent.setProperties({ path: path }, true);
|
3404
|
+
parent.itemData = [getPathObject(parent)];
|
3405
|
+
read(parent, deleteEnd, parent.path);
|
3406
|
+
if (result.error) {
|
3407
|
+
onFailure(parent, result, 'delete');
|
3408
|
+
}
|
3409
|
+
else {
|
3410
|
+
const args = { action: 'delete', result: result };
|
3411
|
+
parent.trigger('success', args);
|
3412
|
+
}
|
3401
3413
|
}
|
3402
3414
|
else {
|
3403
|
-
|
3404
|
-
parent.trigger('success', args);
|
3415
|
+
onFailure(parent, result, 'delete');
|
3405
3416
|
}
|
3406
3417
|
}
|
3407
|
-
|
3408
|
-
|
3418
|
+
catch (error) {
|
3419
|
+
handleCatchError(parent, error, 'delete');
|
3409
3420
|
}
|
3410
3421
|
}
|
3411
3422
|
/**
|
@@ -3421,13 +3432,18 @@ function deleteSuccess(parent, result, path) {
|
|
3421
3432
|
function detailsSuccess(
|
3422
3433
|
// eslint:disable-next-line
|
3423
3434
|
parent, result, path, operation) {
|
3424
|
-
|
3425
|
-
|
3426
|
-
|
3427
|
-
|
3435
|
+
try {
|
3436
|
+
if (!isNullOrUndefined(result.details)) {
|
3437
|
+
createDialog(parent, operation, null, result.details);
|
3438
|
+
const args = { action: 'details', result: result };
|
3439
|
+
parent.trigger('success', args);
|
3440
|
+
}
|
3441
|
+
else {
|
3442
|
+
onFailure(parent, result, 'details');
|
3443
|
+
}
|
3428
3444
|
}
|
3429
|
-
|
3430
|
-
|
3445
|
+
catch (error) {
|
3446
|
+
handleCatchError(parent, error, 'details');
|
3431
3447
|
}
|
3432
3448
|
}
|
3433
3449
|
/**
|
@@ -3474,13 +3490,18 @@ function Search(parent, event, path, searchString, showHiddenItems, caseSensitiv
|
|
3474
3490
|
* @private
|
3475
3491
|
*/
|
3476
3492
|
function searchSuccess(parent, result, event) {
|
3477
|
-
|
3478
|
-
|
3479
|
-
|
3480
|
-
|
3493
|
+
try {
|
3494
|
+
if (!isNullOrUndefined(result.files)) {
|
3495
|
+
parent.notify(event, result);
|
3496
|
+
const args = { action: 'search', result: result };
|
3497
|
+
parent.trigger('success', args);
|
3498
|
+
}
|
3499
|
+
else {
|
3500
|
+
onFailure(parent, result, 'search');
|
3501
|
+
}
|
3481
3502
|
}
|
3482
|
-
|
3483
|
-
|
3503
|
+
catch (error) {
|
3504
|
+
handleCatchError(parent, error, 'search');
|
3484
3505
|
}
|
3485
3506
|
}
|
3486
3507
|
/* istanbul ignore next */
|
@@ -3524,52 +3545,76 @@ function Download(parent, path, items) {
|
|
3524
3545
|
parent.element.removeChild(form);
|
3525
3546
|
}
|
3526
3547
|
else {
|
3527
|
-
|
3528
|
-
|
3529
|
-
|
3530
|
-
|
3531
|
-
|
3532
|
-
|
3533
|
-
|
3534
|
-
|
3535
|
-
|
3536
|
-
|
3537
|
-
|
3538
|
-
|
3539
|
-
|
3540
|
-
|
3541
|
-
|
3542
|
-
else {
|
3543
|
-
fileName = parent.itemData.length > 1 ? 'files.zip' : getValue('isFile', parent.itemData[0]) ? getValue('name', parent.itemData[0]) : getValue('name', parent.itemData[0]) + '.zip';
|
3544
|
-
}
|
3545
|
-
},
|
3546
|
-
onSuccess: (e) => {
|
3547
|
-
parent.trigger('success', downloadArgs);
|
3548
|
-
const blob = e;
|
3549
|
-
const blobUrl = URL.createObjectURL(blob);
|
3550
|
-
const link = document.createElement('a');
|
3551
|
-
link.href = blobUrl;
|
3552
|
-
link.download = fileName;
|
3553
|
-
document.body.appendChild(link);
|
3554
|
-
link.click();
|
3555
|
-
document.body.removeChild(link);
|
3556
|
-
},
|
3557
|
-
onFailure: (e) => {
|
3558
|
-
const result = {
|
3559
|
-
error: {
|
3560
|
-
code: e.status.toString(),
|
3561
|
-
message: getLocaleText(parent, 'Network-Error') + ' ' + parent.ajaxSettings.downloadUrl
|
3548
|
+
try {
|
3549
|
+
let contentDisposition;
|
3550
|
+
let fileName;
|
3551
|
+
const fetch = new Fetch({
|
3552
|
+
url: getValue('url', downloadArgs.ajaxSettings),
|
3553
|
+
type: getValue('type', downloadArgs.ajaxSettings),
|
3554
|
+
contentType: getValue('contentType', downloadArgs.ajaxSettings),
|
3555
|
+
responseType: getValue('responseType', downloadArgs.ajaxSettings),
|
3556
|
+
beforeSend: getValue('beforeSend', downloadArgs.ajaxSettings),
|
3557
|
+
onLoad: (e) => {
|
3558
|
+
contentDisposition = e.headers.get('Content-Disposition');
|
3559
|
+
if (contentDisposition) {
|
3560
|
+
const filenameMatch = contentDisposition.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);
|
3561
|
+
const extractedFilename = filenameMatch && filenameMatch[1];
|
3562
|
+
fileName = extractedFilename ? extractedFilename.replace(/['"]/g, '') : fileName;
|
3562
3563
|
}
|
3563
|
-
|
3564
|
-
|
3565
|
-
|
3566
|
-
|
3567
|
-
|
3568
|
-
|
3564
|
+
else {
|
3565
|
+
fileName = parent.itemData.length > 1 ? 'files.zip' : getValue('isFile', parent.itemData[0]) ? getValue('name', parent.itemData[0]) : getValue('name', parent.itemData[0]) + '.zip';
|
3566
|
+
}
|
3567
|
+
},
|
3568
|
+
onSuccess: (e) => {
|
3569
|
+
parent.trigger('success', downloadArgs);
|
3570
|
+
const blob = e;
|
3571
|
+
const blobUrl = URL.createObjectURL(blob);
|
3572
|
+
const link = document.createElement('a');
|
3573
|
+
link.href = blobUrl;
|
3574
|
+
link.download = fileName;
|
3575
|
+
document.body.appendChild(link);
|
3576
|
+
link.click();
|
3577
|
+
document.body.removeChild(link);
|
3578
|
+
},
|
3579
|
+
onFailure: (e) => {
|
3580
|
+
const result = {
|
3581
|
+
error: {
|
3582
|
+
code: e.status.toString(),
|
3583
|
+
message: getLocaleText(parent, 'Network-Error') + ' ' + parent.ajaxSettings.downloadUrl
|
3584
|
+
}
|
3585
|
+
};
|
3586
|
+
createDialog(parent, 'Error', result);
|
3587
|
+
parent.trigger('failure', downloadArgs);
|
3588
|
+
}
|
3589
|
+
});
|
3590
|
+
fetch.send(JSON.stringify(downloadArgs.data));
|
3591
|
+
}
|
3592
|
+
catch (error) {
|
3593
|
+
handleCatchError(parent, error, 'download');
|
3594
|
+
}
|
3569
3595
|
}
|
3570
3596
|
}
|
3571
3597
|
});
|
3572
3598
|
}
|
3599
|
+
/**
|
3600
|
+
* Function for on catch handler in File Manager.
|
3601
|
+
*
|
3602
|
+
* @param {IFileManager} parent - specifies the parent element.
|
3603
|
+
* @param {any} error - specifies the catch error.
|
3604
|
+
* @param {string} action - specifies the action.
|
3605
|
+
* @returns {void}
|
3606
|
+
* @private
|
3607
|
+
*/
|
3608
|
+
function handleCatchError(parent, error, action) {
|
3609
|
+
const errorResult = {
|
3610
|
+
files: null,
|
3611
|
+
error: {
|
3612
|
+
message: error.message,
|
3613
|
+
fileExists: null
|
3614
|
+
}
|
3615
|
+
};
|
3616
|
+
onFailure(parent, errorResult, action);
|
3617
|
+
}
|
3573
3618
|
|
3574
3619
|
/**
|
3575
3620
|
*
|
@@ -9691,10 +9736,7 @@ class NavigationPane {
|
|
9691
9736
|
}
|
9692
9737
|
addDragDrop() {
|
9693
9738
|
if (!this.parent.isMobile && this.treeObj) {
|
9694
|
-
if (this.parent.allowDragAndDrop) {
|
9695
|
-
if (this.dragObj) {
|
9696
|
-
this.dragObj.destroy();
|
9697
|
-
}
|
9739
|
+
if (this.parent.allowDragAndDrop && isNullOrUndefined(this.dragObj)) {
|
9698
9740
|
this.dragObj = new Draggable(this.treeObj.element, {
|
9699
9741
|
cursorAt: this.parent.dragCursorPosition,
|
9700
9742
|
dragTarget: '.' + FULLROW,
|
@@ -9712,6 +9754,7 @@ class NavigationPane {
|
|
9712
9754
|
}
|
9713
9755
|
else if (!this.parent.allowDragAndDrop && this.dragObj) {
|
9714
9756
|
this.dragObj.destroy();
|
9757
|
+
this.dragObj = null;
|
9715
9758
|
}
|
9716
9759
|
}
|
9717
9760
|
}
|
@@ -10220,7 +10263,7 @@ class NavigationPane {
|
|
10220
10263
|
}
|
10221
10264
|
/* istanbul ignore next */
|
10222
10265
|
checkDropPath(args) {
|
10223
|
-
if (isFileSystemData(this.parent) && this.parent.path === this.parent.dropPath || this.parent.targetModule === 'navigationpane') {
|
10266
|
+
if (isFileSystemData(this.parent) && (this.parent.path === this.parent.dropPath || this.parent.targetModule === 'navigationpane')) {
|
10224
10267
|
return;
|
10225
10268
|
}
|
10226
10269
|
if (this.parent.hasId) {
|
@@ -11484,10 +11527,7 @@ class DetailsView {
|
|
11484
11527
|
}
|
11485
11528
|
createDragObj() {
|
11486
11529
|
if (this.gridObj) {
|
11487
|
-
if (this.parent.allowDragAndDrop) {
|
11488
|
-
if (this.dragObj) {
|
11489
|
-
this.dragObj.destroy();
|
11490
|
-
}
|
11530
|
+
if (this.parent.allowDragAndDrop && isNullOrUndefined(this.dragObj)) {
|
11491
11531
|
this.dragObj = new Draggable(this.gridObj.element, {
|
11492
11532
|
cursorAt: this.parent.dragCursorPosition,
|
11493
11533
|
distance: 5,
|
@@ -11505,6 +11545,7 @@ class DetailsView {
|
|
11505
11545
|
}
|
11506
11546
|
else if (!this.parent.allowDragAndDrop && this.dragObj) {
|
11507
11547
|
this.dragObj.destroy();
|
11548
|
+
this.dragObj = null;
|
11508
11549
|
}
|
11509
11550
|
}
|
11510
11551
|
}
|