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