@syncfusion/ej2-filemanager 25.1.38 → 25.1.40

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.
@@ -748,8 +748,8 @@ function updatePath(node, data, instance) {
748
748
  */
749
749
  function getPath(element, text, hasId) {
750
750
  const matched = getParents(element, text, false, hasId);
751
- let path = hasId ? '' : '/';
752
- const len = matched.length - (hasId ? 1 : 2);
751
+ let path = '/';
752
+ const len = matched.length - (2);
753
753
  for (let i = len; i >= 0; i--) {
754
754
  path += matched[i] + '/';
755
755
  }
@@ -821,8 +821,8 @@ function getParents(element, text, isId, hasId) {
821
821
  */
822
822
  function generatePath(parent) {
823
823
  const key = parent.hasId ? 'id' : 'name';
824
- let newPath = parent.hasId ? '' : '/';
825
- let i = parent.hasId ? 0 : 1;
824
+ let newPath = '/';
825
+ let i = 1;
826
826
  for (i; i < parent.pathId.length; i++) {
827
827
  // eslint-disable-next-line
828
828
  const data = getValue(parent.pathId[i], parent.feParent);
@@ -1490,11 +1490,16 @@ function setNextPath(parent, path) {
1490
1490
  const newPath = (folders[i] === '') ? '/' : (parent.path + folders[i] + '/');
1491
1491
  // eslint-disable-next-line
1492
1492
  const data = getObject(parent, key, folders[i]);
1493
- const id = getValue('_fm_id', data);
1494
- parent.setProperties({ path: newPath }, true);
1495
- parent.pathId.push(id);
1496
- parent.itemData = [data];
1497
- parent.pathNames.push(getValue('name', data));
1493
+ if (!isNullOrUndefined(data)) {
1494
+ const id = getValue('_fm_id', data);
1495
+ parent.setProperties({ path: newPath }, true);
1496
+ parent.pathId.push(id);
1497
+ parent.itemData = [data];
1498
+ parent.pathNames.push(getValue('name', data));
1499
+ }
1500
+ else {
1501
+ parent.originalPath = newPath;
1502
+ }
1498
1503
  read(parent, eventName, parent.path);
1499
1504
  break;
1500
1505
  }
@@ -6067,7 +6072,6 @@ class ContextMenu$2 {
6067
6072
  }
6068
6073
  /* istanbul ignore next */
6069
6074
  onBeforeOpen(args) {
6070
- this.disabledItems = [];
6071
6075
  let selected = false;
6072
6076
  let uid;
6073
6077
  // eslint-disable-next-line
@@ -6159,7 +6163,15 @@ class ContextMenu$2 {
6159
6163
  const pasteEle = select('#' + this.getMenuId('Paste'), this.contextMenu.element);
6160
6164
  if (!args.cancel && !this.parent.enablePaste &&
6161
6165
  pasteEle && !pasteEle.classList.contains('e-disabled')) {
6162
- this.disabledItems.push('Paste');
6166
+ if (this.disabledItems.indexOf('Paste') === -1) {
6167
+ this.disabledItems.push('Paste');
6168
+ }
6169
+ }
6170
+ else {
6171
+ const pasteIndex = this.disabledItems.indexOf('Paste');
6172
+ if (pasteIndex !== -1) {
6173
+ this.disabledItems.splice(pasteIndex, 1);
6174
+ }
6163
6175
  }
6164
6176
  if (args.cancel) {
6165
6177
  this.menuTarget = this.currentElement = null;
@@ -6273,7 +6285,9 @@ class ContextMenu$2 {
6273
6285
  this.disabledItems.push('SelectAll');
6274
6286
  }
6275
6287
  if (this.parent.selectedNodes.length === 0) {
6276
- this.disabledItems.push('Paste');
6288
+ if (this.disabledItems.indexOf('Paste') === -1) {
6289
+ this.disabledItems.push('Paste');
6290
+ }
6277
6291
  }
6278
6292
  this.contextMenu.dataBind();
6279
6293
  }
@@ -6612,7 +6626,7 @@ class ContextMenu$2 {
6612
6626
  return items;
6613
6627
  }
6614
6628
  getMenuId(id) {
6615
- return this.parent.element.id + '_cm_' + id.toLowerCase();
6629
+ return this.parent.element.id + '_cm_' + id.split(' ').join('').toLowerCase();
6616
6630
  }
6617
6631
  }
6618
6632