@syncfusion/ej2-filemanager 27.1.52 → 27.1.55
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 +106 -64
- package/dist/es6/ej2-filemanager.es2015.js.map +1 -1
- package/dist/es6/ej2-filemanager.es5.js +108 -64
- 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/base/file-manager-model.d.ts +1 -1
- package/src/file-manager/base/file-manager.js +28 -5
- package/src/file-manager/common/operations.js +59 -46
- package/src/file-manager/common/utility.d.ts +1 -2
- package/src/file-manager/common/utility.js +9 -10
- package/src/file-manager/layout/details-view.js +8 -2
- package/src/file-manager/layout/large-icons-view.js +4 -1
- package/tslint.json +111 -0
@@ -1281,9 +1281,8 @@ function getSortedData(parent, items) {
|
|
1281
1281
|
*/
|
1282
1282
|
function getObject(parent, key, value) {
|
1283
1283
|
const currFiles = getValue(parent.pathId[parent.pathId.length - 1], parent.feFiles);
|
1284
|
-
const
|
1285
|
-
|
1286
|
-
return lists[0];
|
1284
|
+
const result = currFiles.filter((data) => data[key].toString() === value);
|
1285
|
+
return result.length > 0 ? result[0] : null;
|
1287
1286
|
}
|
1288
1287
|
/**
|
1289
1288
|
* Creates empty element
|
@@ -1527,7 +1526,8 @@ function setNextPath(parent, path) {
|
|
1527
1526
|
function openSearchFolder(parent, data) {
|
1528
1527
|
parent.originalPath = getFullPath(parent, data, parent.path);
|
1529
1528
|
const root = getValue(parent.pathId[0], parent.feParent);
|
1530
|
-
const
|
1529
|
+
const navData = parent.feParent[getValue('_fm_id', parent.itemData[0])];
|
1530
|
+
const isRoot = isNullOrUndefined(navData) || getValue('_fm_id', navData) === 'fe_tree';
|
1531
1531
|
const key = isNullOrUndefined(getValue('id', root)) ? 'name' : 'id';
|
1532
1532
|
const searchData = getObject(parent, key, isFileSystemData(parent) ? getValue('id', data) : getValue('name', data));
|
1533
1533
|
if (isNullOrUndefined(searchData)) {
|
@@ -1968,16 +1968,15 @@ function removeItemClass(parent, value) {
|
|
1968
1968
|
* @param {Element} scrollParent - specifies the scrolling target.
|
1969
1969
|
* @param {IFileManager} parent - specifies the parent.
|
1970
1970
|
* @param {string} nodeClass - specifies the node class.
|
1971
|
-
* @param {number} screenY - specifies the vertical (Y) coordinate of the mouse cursor position relative to the entire screen.
|
1972
1971
|
* @param {number} clientY - specifies the vertical (Y) coordinate of the mouse cursor position relative to the target element.
|
1973
1972
|
* @returns {void}
|
1974
1973
|
* @private
|
1975
1974
|
*/
|
1976
|
-
function scrollHandler(scrollParent, parent, nodeClass,
|
1975
|
+
function scrollHandler(scrollParent, parent, nodeClass, clientY) {
|
1977
1976
|
let position;
|
1978
1977
|
const elementData = scrollParent.getBoundingClientRect();
|
1979
1978
|
const node = select('.' + nodeClass, scrollParent);
|
1980
|
-
if ((
|
1979
|
+
if ((clientY >= (elementData.top + scrollParent.clientHeight - 30)) && !isNullOrUndefined(node)) {
|
1981
1980
|
position = (parent.targetModule === 'navigationpane' || parent.targetModule === 'detailsview') ? node.offsetHeight / 2.5 : node.offsetHeight / 4.5;
|
1982
1981
|
scrollParent.scrollBy(0, position);
|
1983
1982
|
}
|
@@ -2014,7 +2013,7 @@ function draggingHandler(parent, args) {
|
|
2014
2013
|
/* istanbul ignore next */
|
2015
2014
|
parent.treeExpandTimer = window.setTimeout(() => { parent.notify(dragging, args); }, 800);
|
2016
2015
|
scrollParent = parent.navigationpaneModule.treeObj.element.parentElement;
|
2017
|
-
scrollHandler(scrollParent, parent, 'e-level-2', args.event.
|
2016
|
+
scrollHandler(scrollParent, parent, 'e-level-2', args.event.y);
|
2018
2017
|
}
|
2019
2018
|
else if (parent.targetModule === 'detailsview') {
|
2020
2019
|
node = closest(args.target, 'tr');
|
@@ -2026,7 +2025,7 @@ function draggingHandler(parent, args) {
|
|
2026
2025
|
}
|
2027
2026
|
canDrop = true;
|
2028
2027
|
scrollParent = parent.detailsviewModule.gridObj.element.querySelector('.e-content');
|
2029
|
-
scrollHandler(scrollParent, parent, 'e-row', args.event.
|
2028
|
+
scrollHandler(scrollParent, parent, 'e-row', args.event.y);
|
2030
2029
|
}
|
2031
2030
|
else if (parent.targetModule === 'largeiconsview') {
|
2032
2031
|
node = closest(args.target, 'li');
|
@@ -2035,7 +2034,7 @@ function draggingHandler(parent, args) {
|
|
2035
2034
|
}
|
2036
2035
|
canDrop = true;
|
2037
2036
|
scrollParent = parent.largeiconsviewModule.element.firstElementChild;
|
2038
|
-
scrollHandler(scrollParent, parent, 'e-large-icon', args.event.
|
2037
|
+
scrollHandler(scrollParent, parent, 'e-large-icon', args.event.y);
|
2039
2038
|
/* istanbul ignore next */
|
2040
2039
|
}
|
2041
2040
|
else if (parent.targetModule === 'breadcrumbbar') {
|
@@ -3073,7 +3072,7 @@ function performReadOperation(parent, result, fn, data, event, operation, target
|
|
3073
3072
|
const item = result.files[i];
|
3074
3073
|
setValue('_fm_iconClass', fileType(item), item);
|
3075
3074
|
}
|
3076
|
-
if (getValue('action', data) === 'read'
|
3075
|
+
if (getValue('action', data) === 'read') {
|
3077
3076
|
setNodeId(result, id);
|
3078
3077
|
setValue(id, result.files, parent.feFiles);
|
3079
3078
|
}
|
@@ -3194,13 +3193,18 @@ function readSuccess(parent, result, event) {
|
|
3194
3193
|
* @private
|
3195
3194
|
*/
|
3196
3195
|
function filterSuccess(parent, result, event, action) {
|
3197
|
-
|
3198
|
-
|
3199
|
-
|
3200
|
-
|
3196
|
+
try {
|
3197
|
+
if (!isNullOrUndefined(result.files)) {
|
3198
|
+
parent.notify(event, result);
|
3199
|
+
const args = { action: action, result: result };
|
3200
|
+
parent.trigger('success', args);
|
3201
|
+
}
|
3202
|
+
else {
|
3203
|
+
onFailure(parent, result, action);
|
3204
|
+
}
|
3201
3205
|
}
|
3202
|
-
|
3203
|
-
|
3206
|
+
catch (error) {
|
3207
|
+
handleCatchError(parent, error, action);
|
3204
3208
|
}
|
3205
3209
|
}
|
3206
3210
|
/* istanbul ignore next */
|
@@ -3214,51 +3218,59 @@ function filterSuccess(parent, result, event, action) {
|
|
3214
3218
|
* @private
|
3215
3219
|
*/
|
3216
3220
|
function createSuccess(parent, result, itemName) {
|
3217
|
-
|
3218
|
-
if (
|
3219
|
-
parent.dialogObj.hide();
|
3220
|
-
}
|
3221
|
-
parent.createdItem = isFileSystemData(parent) ? result.files[result.files.length - 1] : result.files[0];
|
3222
|
-
parent.breadcrumbbarModule.searchObj.value = '';
|
3223
|
-
const createEventArgs = {
|
3224
|
-
folderName: itemName,
|
3225
|
-
path: parent.path,
|
3226
|
-
parentFolder: parent.itemData
|
3227
|
-
};
|
3228
|
-
parent.trigger('folderCreate', createEventArgs);
|
3229
|
-
const args = { action: 'create', result: result };
|
3230
|
-
parent.trigger('success', args);
|
3231
|
-
parent.itemData = [getPathObject(parent)];
|
3232
|
-
read(parent, createEnd, parent.path);
|
3233
|
-
}
|
3234
|
-
else {
|
3235
|
-
if (result.error.code === '400') {
|
3221
|
+
try {
|
3222
|
+
if (!isNullOrUndefined(result.files)) {
|
3236
3223
|
if (parent.dialogObj && parent.dialogObj.visible) {
|
3237
|
-
|
3238
|
-
const error = getLocaleText(parent, 'Validation-NewFolder-Exists').replace('{0}', '"' + ele.value + '"');
|
3239
|
-
ele.parentElement.nextElementSibling.innerHTML = error;
|
3240
|
-
}
|
3241
|
-
else {
|
3242
|
-
const result = {
|
3243
|
-
files: null,
|
3244
|
-
error: {
|
3245
|
-
code: '400',
|
3246
|
-
message: getLocaleText(parent, 'Validation-NewFolder-Exists').replace('{0}', '"' + itemName + '"'),
|
3247
|
-
fileExists: null
|
3248
|
-
}
|
3249
|
-
};
|
3250
|
-
createDialog(parent, 'Error', result);
|
3224
|
+
parent.dialogObj.hide();
|
3251
3225
|
}
|
3252
|
-
|
3253
|
-
parent.
|
3226
|
+
parent.createdItem = isFileSystemData(parent) ? result.files[result.files.length - 1] : result.files[0];
|
3227
|
+
parent.breadcrumbbarModule.searchObj.value = '';
|
3228
|
+
const createEventArgs = {
|
3229
|
+
folderName: itemName,
|
3230
|
+
path: parent.path,
|
3231
|
+
parentFolder: parent.itemData
|
3232
|
+
};
|
3233
|
+
parent.trigger('folderCreate', createEventArgs);
|
3234
|
+
const args = { action: 'create', result: result };
|
3235
|
+
parent.trigger('success', args);
|
3236
|
+
parent.itemData = [getPathObject(parent)];
|
3237
|
+
read(parent, createEnd, parent.path);
|
3254
3238
|
}
|
3255
3239
|
else {
|
3256
|
-
if (
|
3257
|
-
parent.dialogObj.
|
3240
|
+
if (result.error.code === '400') {
|
3241
|
+
if (parent.dialogObj && parent.dialogObj.visible) {
|
3242
|
+
const ele = select('#newname', parent.dialogObj.element);
|
3243
|
+
const error = getLocaleText(parent, 'Validation-NewFolder-Exists').replace('{0}', '"' + ele.value + '"');
|
3244
|
+
ele.parentElement.nextElementSibling.innerHTML = error;
|
3245
|
+
}
|
3246
|
+
else {
|
3247
|
+
const result = {
|
3248
|
+
files: null,
|
3249
|
+
error: {
|
3250
|
+
code: '400',
|
3251
|
+
message: getLocaleText(parent, 'Validation-NewFolder-Exists').replace('{0}', '"' + itemName + '"'),
|
3252
|
+
fileExists: null
|
3253
|
+
}
|
3254
|
+
};
|
3255
|
+
createDialog(parent, 'Error', result);
|
3256
|
+
}
|
3257
|
+
const args = { action: 'create', error: result.error };
|
3258
|
+
parent.trigger('failure', args);
|
3259
|
+
}
|
3260
|
+
else {
|
3261
|
+
if (parent.dialogObj && parent.dialogObj.visible) {
|
3262
|
+
parent.dialogObj.hide();
|
3263
|
+
}
|
3264
|
+
onFailure(parent, result, 'create');
|
3258
3265
|
}
|
3259
|
-
onFailure(parent, result, 'create');
|
3260
3266
|
}
|
3261
3267
|
}
|
3268
|
+
catch (error) {
|
3269
|
+
if (parent.dialogObj && parent.dialogObj.visible) {
|
3270
|
+
parent.dialogObj.hide();
|
3271
|
+
}
|
3272
|
+
handleCatchError(parent, error, 'create');
|
3273
|
+
}
|
3262
3274
|
}
|
3263
3275
|
/* istanbul ignore next */
|
3264
3276
|
/**
|
@@ -3280,7 +3292,7 @@ function renameSuccess(parent, result) {
|
|
3280
3292
|
parent.renamedItem = Array.isArray(result.files) ? result.files[0] : result.files;
|
3281
3293
|
const renameEventArgs = {
|
3282
3294
|
newName: parent.renamedItem.name,
|
3283
|
-
itemData: parent.renamedItem,
|
3295
|
+
itemData: [parent.renamedItem],
|
3284
3296
|
path: parent.path
|
3285
3297
|
};
|
3286
3298
|
parent.trigger('rename', renameEventArgs);
|
@@ -4850,7 +4862,9 @@ class LargeIconsView {
|
|
4850
4862
|
const textEle = args.item.querySelector('.' + LIST_TEXT);
|
4851
4863
|
const txt = getValue('name', args.curData);
|
4852
4864
|
const type = getValue('type', args.curData);
|
4853
|
-
|
4865
|
+
if (txt.indexOf(type) !== -1) {
|
4866
|
+
textEle.innerHTML = txt.substr(0, txt.length - type.length);
|
4867
|
+
}
|
4854
4868
|
}
|
4855
4869
|
this.renderCheckbox(args);
|
4856
4870
|
const eventArgs = {
|
@@ -5217,6 +5231,7 @@ class LargeIconsView {
|
|
5217
5231
|
read(this.parent, pathChanged, this.parent.path);
|
5218
5232
|
break;
|
5219
5233
|
case 'allowMultiSelection':
|
5234
|
+
case 'showItemCheckBoxes':
|
5220
5235
|
if (this.parent.view !== 'LargeIcons') {
|
5221
5236
|
break;
|
5222
5237
|
}
|
@@ -8108,6 +8123,7 @@ let FileManager = FileManager_1 = class FileManager extends Component {
|
|
8108
8123
|
/* istanbul ignore next */
|
8109
8124
|
onPropertyChanged(newProp, oldProp) {
|
8110
8125
|
let height;
|
8126
|
+
let requiresRefresh = false;
|
8111
8127
|
for (const prop of Object.keys(newProp)) {
|
8112
8128
|
switch (prop) {
|
8113
8129
|
case 'ajaxSettings':
|
@@ -8117,6 +8133,14 @@ let FileManager = FileManager_1 = class FileManager extends Component {
|
|
8117
8133
|
this.allowDragAndDrop = newProp.allowDragAndDrop;
|
8118
8134
|
this.notify(modelChanged, { module: 'common', newProp: newProp, oldProp: oldProp });
|
8119
8135
|
break;
|
8136
|
+
case 'showItemCheckBoxes':
|
8137
|
+
this.showItemCheckBoxes = newProp.showItemCheckBoxes;
|
8138
|
+
this.notify(modelChanged, { module: 'common', newProp: newProp, oldProp: oldProp });
|
8139
|
+
break;
|
8140
|
+
case 'enableVirtualization':
|
8141
|
+
this.enableVirtualization = newProp.enableVirtualization;
|
8142
|
+
requiresRefresh = true;
|
8143
|
+
break;
|
8120
8144
|
case 'allowMultiSelection':
|
8121
8145
|
if (this.allowMultiSelection) {
|
8122
8146
|
addClass([this.element], CHECK_SELECT);
|
@@ -8144,11 +8168,11 @@ let FileManager = FileManager_1 = class FileManager extends Component {
|
|
8144
8168
|
break;
|
8145
8169
|
case 'enableRtl':
|
8146
8170
|
this.enableRtl = newProp.enableRtl;
|
8147
|
-
|
8171
|
+
requiresRefresh = true;
|
8148
8172
|
break;
|
8149
8173
|
case 'rootAliasName':
|
8150
8174
|
this.rootAliasName = newProp.rootAliasName;
|
8151
|
-
|
8175
|
+
requiresRefresh = true;
|
8152
8176
|
break;
|
8153
8177
|
case 'height':
|
8154
8178
|
height = !isNullOrUndefined(newProp.height) ? formatUnit(newProp.height) : newProp.height;
|
@@ -8223,11 +8247,21 @@ let FileManager = FileManager_1 = class FileManager extends Component {
|
|
8223
8247
|
this.notify(sortByChange, {});
|
8224
8248
|
break;
|
8225
8249
|
case 'sortBy':
|
8226
|
-
refresh(this);
|
8227
|
-
this.notify(sortByChange, {});
|
8228
8250
|
if (this.view === 'Details') {
|
8251
|
+
const columns = this.detailsViewSettings.columns;
|
8252
|
+
const isValidSortField = !isNullOrUndefined(columns) &&
|
8253
|
+
columns.findIndex((col) => col.field === this.sortBy) !== -1;
|
8254
|
+
if (!isValidSortField) {
|
8255
|
+
return;
|
8256
|
+
}
|
8257
|
+
refresh(this);
|
8258
|
+
this.notify(sortByChange, {});
|
8229
8259
|
this.notify(sortColumn, {});
|
8230
8260
|
}
|
8261
|
+
else {
|
8262
|
+
refresh(this);
|
8263
|
+
this.notify(sortByChange, {});
|
8264
|
+
}
|
8231
8265
|
break;
|
8232
8266
|
case 'popupTarget':
|
8233
8267
|
if (this.uploadDialogObj) {
|
@@ -8245,10 +8279,13 @@ let FileManager = FileManager_1 = class FileManager extends Component {
|
|
8245
8279
|
break;
|
8246
8280
|
case 'fileSystemData':
|
8247
8281
|
this.fileSystemData = newProp.fileSystemData;
|
8248
|
-
|
8282
|
+
requiresRefresh = true;
|
8249
8283
|
break;
|
8250
8284
|
}
|
8251
8285
|
}
|
8286
|
+
if (requiresRefresh) {
|
8287
|
+
this.refresh();
|
8288
|
+
}
|
8252
8289
|
}
|
8253
8290
|
/* istanbul ignore next */
|
8254
8291
|
ajaxSettingSetModel(newProp) {
|
@@ -10590,7 +10627,9 @@ class DetailsView {
|
|
10590
10627
|
this.checkNameWidth();
|
10591
10628
|
const columns = this.getColumns();
|
10592
10629
|
let sortSettings;
|
10593
|
-
|
10630
|
+
const isValidSortField = !isNullOrUndefined(columns) &&
|
10631
|
+
columns.findIndex((col) => col.field === this.parent.sortBy) !== -1;
|
10632
|
+
if (this.parent.isMobile || !isValidSortField) {
|
10594
10633
|
sortSettings = [];
|
10595
10634
|
}
|
10596
10635
|
else {
|
@@ -10797,7 +10836,9 @@ class DetailsView {
|
|
10797
10836
|
if (textEle) {
|
10798
10837
|
const name = getValue('name', args.data);
|
10799
10838
|
const type = getValue('type', args.data);
|
10800
|
-
|
10839
|
+
if (name.indexOf(type) !== -1) {
|
10840
|
+
textEle.innerHTML = name.substr(0, name.length - type.length);
|
10841
|
+
}
|
10801
10842
|
}
|
10802
10843
|
}
|
10803
10844
|
if (getValue('size', args.data) !== undefined && args.row.querySelector('.e-fe-size')) {
|
@@ -11058,6 +11099,7 @@ class DetailsView {
|
|
11058
11099
|
case 'showHiddenItems':
|
11059
11100
|
read(this.parent, pathChanged, this.parent.path);
|
11060
11101
|
break;
|
11102
|
+
case 'showItemCheckBoxes':
|
11061
11103
|
case 'allowMultiSelection':
|
11062
11104
|
if (!isNullOrUndefined(this.gridObj)) {
|
11063
11105
|
this.currentSelectedItem = this.parent.selectedItems;
|