@syncfusion/ej2-treegrid 19.4.52 → 19.4.56

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.
@@ -723,7 +723,8 @@ function findChildrenRecords(records) {
723
723
  }
724
724
  if (!isNullOrUndefined(records.childRecords)) {
725
725
  const childRecords = records.childRecords;
726
- for (let i = 0, len = Object.keys(childRecords).length; i < len; i++) {
726
+ const keys = Object.keys(childRecords);
727
+ for (let i = 0, len = keys.length; i < len; i++) {
727
728
  datas.push(childRecords[i]);
728
729
  if (childRecords[i].hasChildRecords || (!isNullOrUndefined(childRecords[i].childRecords) &&
729
730
  childRecords[i].childRecords.length)) {
@@ -1795,7 +1796,8 @@ class DataManipulation {
1795
1796
  this.hierarchyData = data;
1796
1797
  }
1797
1798
  else {
1798
- for (let i = 0; i < Object.keys(data).length; i++) {
1799
+ const keys = Object.keys(data);
1800
+ for (let i = 0; i < keys.length; i++) {
1799
1801
  const tempData = data[i];
1800
1802
  this.hierarchyData.push(extend({}, tempData));
1801
1803
  if (!isNullOrUndefined(tempData[this.parent.idMapping])) {
@@ -2032,7 +2034,8 @@ class DataManipulation {
2032
2034
  }
2033
2035
  createRecords(data, parentRecords) {
2034
2036
  const treeGridData = [];
2035
- for (let i = 0, len = Object.keys(data).length; i < len; i++) {
2037
+ const keys = Object.keys(data);
2038
+ for (let i = 0, len = keys.length; i < len; i++) {
2036
2039
  const currentData = extend({}, data[i]);
2037
2040
  currentData.taskData = data[i];
2038
2041
  let level = 0;
@@ -2893,6 +2896,11 @@ function updateParentRow(key, record, action, control, isSelfReference, child) {
2893
2896
  column: control.grid.getColumns()[control.treeColumnIndex],
2894
2897
  requestType: action
2895
2898
  });
2899
+ if (control.enableImmutableMode && control['action'] === 'indenting' || control['action'] === 'outdenting') {
2900
+ control.renderModule.RowModifier({
2901
+ data: record, row: row
2902
+ });
2903
+ }
2896
2904
  }
2897
2905
  }
2898
2906
  }
@@ -3613,6 +3621,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3613
3621
  };
3614
3622
  this.grid.rowDeselected = (args) => {
3615
3623
  this.selectedRowIndex = this.grid.selectedRowIndex;
3624
+ if (!isNullOrUndefined(args.data)) {
3625
+ this.notify(rowDeselected, args);
3626
+ }
3616
3627
  this.trigger(rowDeselected, args);
3617
3628
  };
3618
3629
  this.grid.resizeStop = (args) => {
@@ -3927,7 +3938,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3927
3938
  this.grid.query = this.grid.query instanceof Query ? this.grid.query : new Query();
3928
3939
  }
3929
3940
  }
3930
- if (this.action !== 'indent' && this.action !== 'outdent') {
3941
+ if (this.action !== 'indenting' && this.action !== 'outdenting') {
3931
3942
  const callBackPromise = new Deferred();
3932
3943
  this.trigger(actionBegin, args, (actionArgs) => {
3933
3944
  if (!actionArgs.cancel) {
@@ -3956,7 +3967,8 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3956
3967
  if (args.requestType === 'save' && this.aggregates.map((ag) => ag.showChildSummary === true).length) {
3957
3968
  this.grid.refresh();
3958
3969
  }
3959
- if (this.action === 'indent' || this.action === 'outdent') {
3970
+ if (this.action === 'indenting' || this.action === 'outdenting') {
3971
+ this.action = this.action === 'indenting' ? 'indented' : 'outdented';
3960
3972
  const actionArgs = {
3961
3973
  requestType: this.action,
3962
3974
  data: this.selectedRecords,
@@ -4166,7 +4178,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4166
4178
  case ToolbarItem.RowIndent:
4167
4179
  tooltipText = this.l10n.getConstant('RowIndent');
4168
4180
  items.push({
4169
- text: tooltipText, tooltipText: tooltipText,
4181
+ text: tooltipText, tooltipText: tooltipText, disabled: true,
4170
4182
  prefixIcon: 'e-indent', id: this.element.id + '_gridcontrol_indent'
4171
4183
  });
4172
4184
  break;
@@ -4174,7 +4186,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4174
4186
  case ToolbarItem.RowOutdent:
4175
4187
  tooltipText = this.l10n.getConstant('RowOutdent');
4176
4188
  items.push({
4177
- text: tooltipText, tooltipText: tooltipText,
4189
+ text: tooltipText, tooltipText: tooltipText, disabled: true,
4178
4190
  prefixIcon: 'e-outdent', id: this.element.id + '_gridcontrol_outdent'
4179
4191
  });
4180
4192
  break;
@@ -4215,7 +4227,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4215
4227
  gridColumn[prop] = this.getGridColumns(column[i][prop], false, index);
4216
4228
  treeGridColumn[prop] = column[i][prop];
4217
4229
  }
4218
- else {
4230
+ else if (!(treeColumn) || prop !== 'sortComparer') {
4219
4231
  gridColumn[prop] = treeGridColumn[prop] = column[i][prop];
4220
4232
  }
4221
4233
  }
@@ -6795,6 +6807,7 @@ class RowDD$1 {
6795
6807
  */
6796
6808
  reorderRows(fromIndexes, toIndex, position) {
6797
6809
  const tObj = this.parent;
6810
+ const action = 'action';
6798
6811
  if (fromIndexes[0] !== toIndex && ['above', 'below', 'child'].indexOf(position) !== -1) {
6799
6812
  if (position === 'above') {
6800
6813
  this.dropPosition = 'topSegment';
@@ -6821,6 +6834,11 @@ class RowDD$1 {
6821
6834
  if (tObj.isLocalData) {
6822
6835
  tObj.flatData = this.orderToIndex(tObj.flatData);
6823
6836
  }
6837
+ if (this.parent[action] === 'outdenting') {
6838
+ if (!isNullOrUndefined(data[0].parentItem)) {
6839
+ data[0].level = data[0].parentItem.level + 1;
6840
+ }
6841
+ }
6824
6842
  this.parent.grid.refresh();
6825
6843
  if (this.parent.enableImmutableMode && this.dropPosition === 'middleSegment') {
6826
6844
  const index = this.parent.treeColumnIndex + 1;
@@ -6841,6 +6859,11 @@ class RowDD$1 {
6841
6859
  column: this.parent.grid.getColumns()[this.parent.treeColumnIndex],
6842
6860
  requestType: 'rowDragAndDrop'
6843
6861
  });
6862
+ if (this.parent[action] === 'indenting' || this.parent[action] === 'outdenting') {
6863
+ this.parent.renderModule.RowModifier({
6864
+ data: totalRecord[i], row: rows[i]
6865
+ });
6866
+ }
6844
6867
  }
6845
6868
  }
6846
6869
  }
@@ -6986,7 +7009,8 @@ class RowDD$1 {
6986
7009
  }
6987
7010
  // eslint-disable-next-line max-len
6988
7011
  if (tempDataSource && (!isNullOrUndefined(droppedRecord) && !droppedRecord.parentItem) && !isNullOrUndefined(droppedRecord.taskData)) {
6989
- for (let i = 0; i < Object.keys(tempDataSource).length; i++) {
7012
+ const keys = Object.keys(tempDataSource);
7013
+ for (let i = 0; i < keys.length; i++) {
6990
7014
  if (tempDataSource[i][this.parent.childMapping] === droppedRecord.taskData[this.parent.childMapping]) {
6991
7015
  idx = i;
6992
7016
  }
@@ -8799,6 +8823,7 @@ class Toolbar$1 {
8799
8823
  */
8800
8824
  addEventListener() {
8801
8825
  this.parent.on(rowSelected, this.refreshToolbar, this);
8826
+ this.parent.on(rowDeselected, this.refreshToolbar, this);
8802
8827
  this.parent.on(toolbarClick, this.toolbarClickHandler, this);
8803
8828
  }
8804
8829
  /**
@@ -8810,6 +8835,7 @@ class Toolbar$1 {
8810
8835
  return;
8811
8836
  }
8812
8837
  this.parent.off(rowSelected, this.refreshToolbar);
8838
+ this.parent.off(rowDeselected, this.refreshToolbar);
8813
8839
  this.parent.off(toolbarClick, this.toolbarClickHandler);
8814
8840
  }
8815
8841
  refreshToolbar(args) {
@@ -8817,7 +8843,7 @@ class Toolbar$1 {
8817
8843
  if (args.row.rowIndex === 0 || tObj.getSelectedRecords().length > 1) {
8818
8844
  this.enableItems([tObj.element.id + '_gridcontrol_indent', tObj.element.id + '_gridcontrol_outdent'], false);
8819
8845
  }
8820
- else {
8846
+ else if (args['name'] !== "rowDeselected") {
8821
8847
  if (!isNullOrUndefined(tObj.getCurrentViewRecords()[args.row.rowIndex])) {
8822
8848
  if (!isNullOrUndefined(tObj.getCurrentViewRecords()[args.row.rowIndex]) &&
8823
8849
  (tObj.getCurrentViewRecords()[args.row.rowIndex].level >
@@ -8839,6 +8865,14 @@ class Toolbar$1 {
8839
8865
  }
8840
8866
  }
8841
8867
  }
8868
+ if (args['name'] === "rowDeselected") {
8869
+ if (this.parent.toolbar['includes']('Indent')) {
8870
+ this.enableItems([tObj.element.id + '_gridcontrol_indent'], false);
8871
+ }
8872
+ if (this.parent.toolbar['includes']('Outdent')) {
8873
+ this.enableItems([tObj.element.id + '_gridcontrol_outdent'], false);
8874
+ }
8875
+ }
8842
8876
  if (args.row.rowIndex === 0 && !isNullOrUndefined(args.data.parentItem)) {
8843
8877
  this.enableItems([tObj.element.id + '_gridcontrol_outdent'], true);
8844
8878
  }
@@ -8870,8 +8904,8 @@ class Toolbar$1 {
8870
8904
  else {
8871
8905
  dropIndex = tObj.getSelectedRowIndexes()[0] - 1;
8872
8906
  }
8873
- this.parent[action] = 'indent';
8874
- this.eventTrigger('indent', dropIndex);
8907
+ this.parent[action] = 'indenting';
8908
+ this.eventTrigger('indenting', dropIndex);
8875
8909
  }
8876
8910
  if (args.item.id === tObj.grid.element.id + '_outdent' && tObj.getSelectedRecords().length) {
8877
8911
  let dropIndex;
@@ -8881,8 +8915,8 @@ class Toolbar$1 {
8881
8915
  dropIndex = i;
8882
8916
  }
8883
8917
  }
8884
- this.parent[action] = 'outdent';
8885
- this.eventTrigger('outdent', dropIndex);
8918
+ this.parent[action] = 'outdenting';
8919
+ this.eventTrigger('outdenting', dropIndex);
8886
8920
  }
8887
8921
  }
8888
8922
  eventTrigger(action, dropIndex) {
@@ -8898,10 +8932,10 @@ class Toolbar$1 {
8898
8932
  };
8899
8933
  this.parent.trigger(actionBegin, actionArgs, (actionArgs) => {
8900
8934
  if (!actionArgs.cancel) {
8901
- if (actionArgs.requestType === 'indent') {
8935
+ if (actionArgs.requestType === 'indenting') {
8902
8936
  this.parent.reorderRows([this.parent.getSelectedRowIndexes()[0]], dropIndex, 'child');
8903
8937
  }
8904
- else if (actionArgs.requestType === 'outdent') {
8938
+ else if (actionArgs.requestType === 'outdenting') {
8905
8939
  this.parent.reorderRows([this.parent.getSelectedRowIndexes()[0]], dropIndex, 'below');
8906
8940
  }
8907
8941
  }
@@ -10263,7 +10297,7 @@ class Edit$1 {
10263
10297
  const promise = 'promise';
10264
10298
  const prom = args[promise];
10265
10299
  delete args[promise];
10266
- if (this.parent.enableVirtualization && !isNullOrUndefined(this.prevAriaRowIndex)) {
10300
+ if (this.parent.enableVirtualization && !isNullOrUndefined(this.prevAriaRowIndex) && this.prevAriaRowIndex !== '-1') {
10267
10301
  args.row.setAttribute('aria-rowindex', this.prevAriaRowIndex);
10268
10302
  this.prevAriaRowIndex = undefined;
10269
10303
  }