@syncfusion/ej2-filemanager 27.2.3 → 27.2.5

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.
@@ -949,6 +949,23 @@ function getModule(parent, element) {
949
949
  }
950
950
  }
951
951
  }
952
+ /**
953
+ * Get all child items
954
+ *
955
+ * @param {IFileManager} parent - specifies the parent element.
956
+ * @param {string | number} parentId - specifies the parent ID.
957
+ * @returns {Object[]} An array of child items
958
+ * @private
959
+ */
960
+ function getAllChildItems(parent, parentId) {
961
+ const children = parent.fileSystemData.filter((item) => String(item.parentId) === String(parentId));
962
+ let allChildren = [...children];
963
+ children.forEach((child) => {
964
+ const childId = child.id;
965
+ allChildren = allChildren.concat(getAllChildItems(parent, childId));
966
+ });
967
+ return allChildren;
968
+ }
952
969
  /**
953
970
  * Gets module name
954
971
  *
@@ -970,7 +987,9 @@ function searchWordHandler(parent, value, isLayoutChange) {
970
987
  }
971
988
  else {
972
989
  parent.searchSettings.filterType = isNullOrUndefined(parent.searchSettings.filterType) ? 'contains' : parent.searchSettings.filterType;
973
- const filteredData = parent.fileSystemData.filter((obj) => obj.parentId !== null);
990
+ const currData = getValue(parent.pathId[parent.pathId.length - 1], parent.feParent);
991
+ const parentId = getValue('id', currData);
992
+ const filteredData = getAllChildItems(parent, parentId);
974
993
  const data = new DataManager(filteredData).
975
994
  executeLocal(new Query().where('name', parent.searchSettings.filterType, value, parent.searchSettings.ignoreCase));
976
995
  const searchValue = parent.searchSettings.ignoreCase ? value.toLowerCase() : value;
@@ -1736,6 +1755,7 @@ function doPasteUpdate(parent, operation, result) {
1736
1755
  else {
1737
1756
  parent.isDropEnd = false;
1738
1757
  }
1758
+ parent.trigger('success', { action: operation, result: result });
1739
1759
  if (!parent.isDragDrop || (parent.path === parent.dragPath) || (parent.path === parent.dropPath)
1740
1760
  || parent.isSearchDrag) {
1741
1761
  parent.isPathDrag = false;
@@ -1744,7 +1764,6 @@ function doPasteUpdate(parent, operation, result) {
1744
1764
  else {
1745
1765
  readDropPath(parent);
1746
1766
  }
1747
- parent.trigger('success', { action: operation, result: result });
1748
1767
  }
1749
1768
  /**
1750
1769
  * Reads the drop path
@@ -2535,7 +2554,7 @@ function isFileExists(fileSystemData, name) {
2535
2554
  * @private
2536
2555
  */
2537
2556
  function findIndexById(parent, id) {
2538
- const index = parent.fileSystemData.findIndex((item) => String(item.id) === String(id));
2557
+ const index = parent.fileSystemData.findIndex((item) => !isNullOrUndefined(item) && String(item.id) === String(id));
2539
2558
  return index;
2540
2559
  }
2541
2560
  /**
@@ -2909,9 +2928,10 @@ function createAjax(parent, data, fn, event, operation, targetPath) {
2909
2928
  if (!beforeSendArgs.cancel) {
2910
2929
  parent.notify(beforeRequest, {});
2911
2930
  if (isFileSystemData(parent)) {
2912
- const filePath = event === 'node-expand' || event === 'finalize-end' ? getValue('path', data) : parent.path;
2931
+ const filePath = event === 'node-expand' || event === 'finalize-end' || event === 'rename-end-parent'
2932
+ ? getValue('path', data) : parent.path;
2913
2933
  const pathArray = filePath.replace(/^\/|\/$/g, '').split('/');
2914
- const idValue = event === 'rename-end-parent' || (event === 'path-changed' && getValue('data', data).length !== 0)
2934
+ const idValue = event === 'rename-end-parent' || (event === 'path-changed' && getValue('data', data).length !== 0 && isNullOrUndefined(parent.renamedItem))
2915
2935
  || (event === 'paste-end' && (parent.targetModule === 'largeiconsview' || parent.targetModule === 'detailsview'))
2916
2936
  ? getValue('data', data)[0].id : pathArray[pathArray.length - 1];
2917
2937
  const action = getValue('action', data);
@@ -2937,7 +2957,12 @@ function createAjax(parent, data, fn, event, operation, targetPath) {
2937
2957
  else if (isFileOperation && parent.responseData.error === null) {
2938
2958
  let itemData = action === 'search' || action === 'delete' ? getValue('data', data) : [];
2939
2959
  if (itemData.length === 0) {
2940
- itemData = getValue('data', data).map((item) => filterById(parent, item.id));
2960
+ if (action === 'copy') {
2961
+ itemData = parent.pasteNodes.map((item) => filterById(parent, item));
2962
+ }
2963
+ else {
2964
+ itemData = getValue('data', data).map((item) => filterById(parent, item.id));
2965
+ }
2941
2966
  }
2942
2967
  parent.responseData = {
2943
2968
  cwd: null,
@@ -3297,14 +3322,21 @@ function renameSuccess(parent, result) {
3297
3322
  };
3298
3323
  parent.trigger('rename', renameEventArgs);
3299
3324
  if (parent.activeModule === 'navigationpane') {
3325
+ const pathObject = getPathObject(parent);
3326
+ const pathLevel = parent.pathId[parent.pathId.length - 1].split('_').length - 2;
3300
3327
  parent.pathId.pop();
3301
3328
  parent.itemData = [getValue(parent.pathId[parent.pathId.length - 1], parent.feParent)];
3302
3329
  read(parent, renameEndParent, getValue('filterPath', parent.renamedItem).replace(/\\/g, '/'));
3303
- parent.itemData[0] = parent.renamedItem;
3304
- if (getValue('filterPath', parent.renamedItem) === getValue('filterPath', parent.itemData[0]) && parent.pathNames.length > 1) {
3305
- parent.pathNames[parent.pathNames.length - 1] = parent.renameText;
3330
+ if (!isNullOrUndefined(pathObject) && parent.pathNames.length > 1 && pathLevel <= parent.pathNames.length - 1) {
3331
+ parent.pathNames[pathLevel] = parent.renameText;
3332
+ if (!parent.hasId) {
3333
+ parent.setProperties({ path: `/${parent.pathNames.slice(1).join('/')}/` }, true);
3334
+ }
3306
3335
  }
3307
- read(parent, pathChanged, parent.path === '/' ? parent.path : getValue('filterPath', parent.renamedItem).replace(/\\/g, '/') + parent.renamedItem.name + '/');
3336
+ parent.itemData = parent.navigationpaneModule.previousSelected.length > 0
3337
+ ? parent.navigationpaneModule.treeObj.getTreeData(parent.navigationpaneModule.previousSelected[0]) : parent.itemData;
3338
+ read(parent, pathChanged, parent.path);
3339
+ parent.itemData[0] = parent.renamedItem;
3308
3340
  parent.renamedItem = null;
3309
3341
  }
3310
3342
  else {
@@ -5005,7 +5037,7 @@ class LargeIconsView {
5005
5037
  removeBlur(this.parent);
5006
5038
  this.parent.setProperties({ selectedItems: [] }, true);
5007
5039
  this.onLayoutChange(args);
5008
- if (this.parent.renamedItem) {
5040
+ if (this.parent.renamedItem && this.parent.activeModule === 'largeiconsview') {
5009
5041
  this.clearSelect();
5010
5042
  this.addSelection(this.parent.renamedItem);
5011
5043
  }
@@ -9704,6 +9736,8 @@ class NavigationPane {
9704
9736
  constructor(parent) {
9705
9737
  this.removeNodes = [];
9706
9738
  this.moveNames = [];
9739
+ // Specifies the previously selected nodes in the treeview control.
9740
+ this.previousSelected = [];
9707
9741
  this.expandTree = false;
9708
9742
  this.isDrag = false;
9709
9743
  this.isPathDragged = false;
@@ -9712,8 +9746,6 @@ class NavigationPane {
9712
9746
  this.isSameNodeClicked = false;
9713
9747
  this.isNodeExpandCalled = false;
9714
9748
  this.renameParent = null;
9715
- // Specifies the previously selected nodes in the treeview control.
9716
- this.previousSelected = null;
9717
9749
  // Specifies whether the nodeClicked event of the treeview control is triggered or not.
9718
9750
  this.isNodeClickCalled = false;
9719
9751
  // Specifies whether to restrict node selection in the treeview control.
@@ -10133,9 +10165,11 @@ class NavigationPane {
10133
10165
  }
10134
10166
  }
10135
10167
  if (resultData.length > 0) {
10136
- const id = getValue(this.treeObj.fields.id, resultData[0]);
10168
+ const id = this.previousSelected.length > 0 && this.treeObj.getTreeData(this.previousSelected[0]).length !== 0
10169
+ ? this.previousSelected[0] : getValue(this.treeObj.fields.id, resultData[0]);
10137
10170
  this.treeObj.selectedNodes = [id];
10138
10171
  this.treeObj.dataBind();
10172
+ this.updateItemData();
10139
10173
  }
10140
10174
  }
10141
10175
  }
@@ -10533,6 +10567,8 @@ class NavigationPane {
10533
10567
  }
10534
10568
  updateActionData() {
10535
10569
  this.updateItemData();
10570
+ const node = select('[data-uid="' + this.parent.pathId[this.parent.pathId.length - 1] + '"]', this.treeObj.element);
10571
+ updatePath(node, this.parent.itemData[0], this.parent);
10536
10572
  const newPath = getParentPath(this.parent.path);
10537
10573
  this.parent.setProperties({ path: newPath }, true);
10538
10574
  this.parent.pathId.pop();
@@ -12482,5 +12518,5 @@ class DetailsView {
12482
12518
  }
12483
12519
  }
12484
12520
 
12485
- export { ACTIVE, ALT_DIALOG_ID, AjaxSettings, BLUR, BREADCRUMBBAR_ID, BREADCRUMBS, BreadCrumbBar, CB_WRAP, CHECK, CHECK_SELECT, CLONE, COLLAPSED, CONTENT_ID, CONTEXT_MENU_ID, CONTROL, Column, ContextMenu, ContextMenuSettings, DETAILS_LABEL, DIALOG_ID, DISPLAY_NONE, DROP_FILE, DROP_FOLDER, Delete, DetailsView, DetailsViewSettings, Download, EMPTY, EMPTY_CONTENT, EMPTY_INNER_CONTENT, ERROR_CONTENT, EXTN_DIALOG_ID, FILTER, FOCUS, FOCUSED, FOLDER, FRAME, FULLROW, FileManager, GRID_CONTENT, GRID_HEADER, GRID_ID, GRID_VIEW, GetDetails, HEADER_CHECK, HOVER, ICONS, ICON_BREADCRUMB, ICON_CLEAR, ICON_COLLAPSIBLE, ICON_COPY, ICON_CUT, ICON_DELETE, ICON_DETAILS, ICON_DOWNLOAD, ICON_DROP_IN, ICON_DROP_OUT, ICON_GRID, ICON_IMAGE, ICON_LARGE, ICON_MUSIC, ICON_NEWFOLDER, ICON_NO_DROP, ICON_OPEN, ICON_OPTIONS, ICON_PASTE, ICON_REFRESH, ICON_RENAME, ICON_SELECTALL, ICON_SHORTBY, ICON_UPLOAD, ICON_VIDEO, ICON_VIEW, IMG_DIALOG_ID, LARGEICON_ID, LARGE_EMPTY_FOLDER, LARGE_EMPTY_FOLDER_TWO, LARGE_ICON, LARGE_ICONS, LARGE_ICON_FOLDER, LAYOUT, LAYOUT_CONTENT, LAYOUT_ID, LIST_ITEM, LIST_PARENT, LIST_TEXT, LargeIconsView, MENU_ICON, MENU_ITEM, MOBILE, MOB_POPUP, MULTI_SELECT, NAVIGATION, NAVIGATION_ID, NavigationPane, NavigationPaneSettings, OVERLAY, RETRY_DIALOG_ID, RETRY_ID, ROOT, ROOT_POPUP, ROW, ROWCELL, RTL, SEARCH_ID, SELECTED_ITEMS, SORTBY_ID, SPLITTER_ID, SPLIT_BAR, STATUS, SUBMENU_ICON, Search, SearchSettings, TB_ITEM, TB_OPTION_DOT, TB_OPTION_TICK, TEMPLATE_CELL, TEXT_CONTENT, TOOLBAR_ID, TREE_ID, TREE_VIEW, Toolbar, ToolbarItem, ToolbarSettings, UPLOAD_DIALOG_ID, UPLOAD_ID, UploadSettings, VALUE, VIEW_ID, Virtualization, actionFailure, activeElement, addBlur, afterRequest, beforeDelete, beforeDownload, beforeRequest, clearAllInit, clearPathInit, closePopup, columnArray, copyFiles, createDeniedDialog, createDialog, createEmptyElement, createEnd, createExtDialog, createFolder, createImageDialog, createNewFolder, createVirtualDragElement, cutCopyInit, cutEnd, cutFiles, defaultToolbarItems, deleteEnd, deleteInit, destroy, detailsInit, doDeleteFiles, doDownload, doDownloadFiles, doPasteUpdate, doRename, download, downloadInit, dragCancel, dragEnd, dragHelper, dragStartHandler, dragStopHandler, dragging, draggingHandler, dropHandler, dropInit, dropPath, fileItems, fileType, filter, filterEnd, finalizeEnd, folderItems, generatePath, getAccessClass, getAccessDetails, getCssClass, getDirectories, getDirectoryPath, getDuplicateData, getFullPath, getImageUrl, getItemName, getLocaleText, getModule, getName, getObject, getParentPath, getParents, getPath, getPathId, getPathNames, getPathObject, getSortField, getSortedData, getTargetModule, hasContentAccess, hasDownloadAccess, hasEditAccess, hasReadAccess, hasUploadAccess, hideLayout, hidePaste, initialEnd, isFile, isFileSystemData, layoutChange, layoutItems, layoutRefresh, menuItemData, methodCall, modelChanged, nodeExpand, objectToString, openAction, openEnd, openInit, openSearchFolder, paste, pasteEnd, pasteHandler, pasteInit, pathChanged, pathColumn, pathDrag, permissionCopy, permissionDownload, permissionEdit, permissionEditContents, permissionRead, permissionUpload, read, readDropPath, refresh, refreshEnd, removeActive, removeBlur, removeDropTarget, removeItemClass, rename, renameEnd, renameEndParent, renameInit, resizeEnd, scrollHandler, search, searchTextChange, searchWordHandler, selectAllInit, selectedData, selectionChanged, setDateObject, setNextPath, setNodeId, showPaste, skipUpload, sortByChange, sortColumn, sortComparer, sortbyClickHandler, splitterResize, treeSelect, updateLayout, updatePath, updateRenamingData, updateSelectionData, updateTreeSelection, upload, uploadItem, validateSubFolder };
12521
+ export { ACTIVE, ALT_DIALOG_ID, AjaxSettings, BLUR, BREADCRUMBBAR_ID, BREADCRUMBS, BreadCrumbBar, CB_WRAP, CHECK, CHECK_SELECT, CLONE, COLLAPSED, CONTENT_ID, CONTEXT_MENU_ID, CONTROL, Column, ContextMenu, ContextMenuSettings, DETAILS_LABEL, DIALOG_ID, DISPLAY_NONE, DROP_FILE, DROP_FOLDER, Delete, DetailsView, DetailsViewSettings, Download, EMPTY, EMPTY_CONTENT, EMPTY_INNER_CONTENT, ERROR_CONTENT, EXTN_DIALOG_ID, FILTER, FOCUS, FOCUSED, FOLDER, FRAME, FULLROW, FileManager, GRID_CONTENT, GRID_HEADER, GRID_ID, GRID_VIEW, GetDetails, HEADER_CHECK, HOVER, ICONS, ICON_BREADCRUMB, ICON_CLEAR, ICON_COLLAPSIBLE, ICON_COPY, ICON_CUT, ICON_DELETE, ICON_DETAILS, ICON_DOWNLOAD, ICON_DROP_IN, ICON_DROP_OUT, ICON_GRID, ICON_IMAGE, ICON_LARGE, ICON_MUSIC, ICON_NEWFOLDER, ICON_NO_DROP, ICON_OPEN, ICON_OPTIONS, ICON_PASTE, ICON_REFRESH, ICON_RENAME, ICON_SELECTALL, ICON_SHORTBY, ICON_UPLOAD, ICON_VIDEO, ICON_VIEW, IMG_DIALOG_ID, LARGEICON_ID, LARGE_EMPTY_FOLDER, LARGE_EMPTY_FOLDER_TWO, LARGE_ICON, LARGE_ICONS, LARGE_ICON_FOLDER, LAYOUT, LAYOUT_CONTENT, LAYOUT_ID, LIST_ITEM, LIST_PARENT, LIST_TEXT, LargeIconsView, MENU_ICON, MENU_ITEM, MOBILE, MOB_POPUP, MULTI_SELECT, NAVIGATION, NAVIGATION_ID, NavigationPane, NavigationPaneSettings, OVERLAY, RETRY_DIALOG_ID, RETRY_ID, ROOT, ROOT_POPUP, ROW, ROWCELL, RTL, SEARCH_ID, SELECTED_ITEMS, SORTBY_ID, SPLITTER_ID, SPLIT_BAR, STATUS, SUBMENU_ICON, Search, SearchSettings, TB_ITEM, TB_OPTION_DOT, TB_OPTION_TICK, TEMPLATE_CELL, TEXT_CONTENT, TOOLBAR_ID, TREE_ID, TREE_VIEW, Toolbar, ToolbarItem, ToolbarSettings, UPLOAD_DIALOG_ID, UPLOAD_ID, UploadSettings, VALUE, VIEW_ID, Virtualization, actionFailure, activeElement, addBlur, afterRequest, beforeDelete, beforeDownload, beforeRequest, clearAllInit, clearPathInit, closePopup, columnArray, copyFiles, createDeniedDialog, createDialog, createEmptyElement, createEnd, createExtDialog, createFolder, createImageDialog, createNewFolder, createVirtualDragElement, cutCopyInit, cutEnd, cutFiles, defaultToolbarItems, deleteEnd, deleteInit, destroy, detailsInit, doDeleteFiles, doDownload, doDownloadFiles, doPasteUpdate, doRename, download, downloadInit, dragCancel, dragEnd, dragHelper, dragStartHandler, dragStopHandler, dragging, draggingHandler, dropHandler, dropInit, dropPath, fileItems, fileType, filter, filterEnd, finalizeEnd, folderItems, generatePath, getAccessClass, getAccessDetails, getAllChildItems, getCssClass, getDirectories, getDirectoryPath, getDuplicateData, getFullPath, getImageUrl, getItemName, getLocaleText, getModule, getName, getObject, getParentPath, getParents, getPath, getPathId, getPathNames, getPathObject, getSortField, getSortedData, getTargetModule, hasContentAccess, hasDownloadAccess, hasEditAccess, hasReadAccess, hasUploadAccess, hideLayout, hidePaste, initialEnd, isFile, isFileSystemData, layoutChange, layoutItems, layoutRefresh, menuItemData, methodCall, modelChanged, nodeExpand, objectToString, openAction, openEnd, openInit, openSearchFolder, paste, pasteEnd, pasteHandler, pasteInit, pathChanged, pathColumn, pathDrag, permissionCopy, permissionDownload, permissionEdit, permissionEditContents, permissionRead, permissionUpload, read, readDropPath, refresh, refreshEnd, removeActive, removeBlur, removeDropTarget, removeItemClass, rename, renameEnd, renameEndParent, renameInit, resizeEnd, scrollHandler, search, searchTextChange, searchWordHandler, selectAllInit, selectedData, selectionChanged, setDateObject, setNextPath, setNodeId, showPaste, skipUpload, sortByChange, sortColumn, sortComparer, sortbyClickHandler, splitterResize, treeSelect, updateLayout, updatePath, updateRenamingData, updateSelectionData, updateTreeSelection, upload, uploadItem, validateSubFolder };
12486
12522
  //# sourceMappingURL=ej2-filemanager.es2015.js.map