@syncfusion/ej2-treegrid 19.4.50 → 19.4.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.
@@ -2893,6 +2893,11 @@ function updateParentRow(key, record, action, control, isSelfReference, child) {
2893
2893
  column: control.grid.getColumns()[control.treeColumnIndex],
2894
2894
  requestType: action
2895
2895
  });
2896
+ if (control.enableImmutableMode && control['action'] === 'indenting' || control['action'] === 'outdenting') {
2897
+ control.renderModule.RowModifier({
2898
+ data: record, row: row
2899
+ });
2900
+ }
2896
2901
  }
2897
2902
  }
2898
2903
  }
@@ -3613,6 +3618,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3613
3618
  };
3614
3619
  this.grid.rowDeselected = (args) => {
3615
3620
  this.selectedRowIndex = this.grid.selectedRowIndex;
3621
+ if (!isNullOrUndefined(args.data)) {
3622
+ this.notify(rowDeselected, args);
3623
+ }
3616
3624
  this.trigger(rowDeselected, args);
3617
3625
  };
3618
3626
  this.grid.resizeStop = (args) => {
@@ -3927,14 +3935,16 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3927
3935
  this.grid.query = this.grid.query instanceof Query ? this.grid.query : new Query();
3928
3936
  }
3929
3937
  }
3930
- const callBackPromise = new Deferred();
3931
- this.trigger(actionBegin, args, (actionArgs) => {
3932
- if (!actionArgs.cancel) {
3933
- this.notify(beginEdit, actionArgs);
3934
- }
3935
- callBackPromise.resolve(actionArgs);
3936
- });
3937
- return callBackPromise;
3938
+ if (this.action !== 'indenting' && this.action !== 'outdenting') {
3939
+ const callBackPromise = new Deferred();
3940
+ this.trigger(actionBegin, args, (actionArgs) => {
3941
+ if (!actionArgs.cancel) {
3942
+ this.notify(beginEdit, actionArgs);
3943
+ }
3944
+ callBackPromise.resolve(actionArgs);
3945
+ });
3946
+ return callBackPromise;
3947
+ }
3938
3948
  };
3939
3949
  this.grid.actionComplete = (args) => {
3940
3950
  this.notify('actioncomplete', args);
@@ -3954,7 +3964,20 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3954
3964
  if (args.requestType === 'save' && this.aggregates.map((ag) => ag.showChildSummary === true).length) {
3955
3965
  this.grid.refresh();
3956
3966
  }
3957
- this.trigger(actionComplete, args);
3967
+ if (this.action === 'indenting' || this.action === 'outdenting') {
3968
+ this.action = this.action === 'indenting' ? 'indented' : 'outdented';
3969
+ const actionArgs = {
3970
+ requestType: this.action,
3971
+ data: this.selectedRecords,
3972
+ row: this.selectedRows
3973
+ };
3974
+ this.trigger(actionComplete, actionArgs);
3975
+ this.action = '';
3976
+ this.selectedRecords = this.selectedRows = [];
3977
+ }
3978
+ else {
3979
+ this.trigger(actionComplete, args);
3980
+ }
3958
3981
  };
3959
3982
  }
3960
3983
  extendedGridEvents() {
@@ -4152,7 +4175,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4152
4175
  case ToolbarItem.RowIndent:
4153
4176
  tooltipText = this.l10n.getConstant('RowIndent');
4154
4177
  items.push({
4155
- text: tooltipText, tooltipText: tooltipText,
4178
+ text: tooltipText, tooltipText: tooltipText, disabled: true,
4156
4179
  prefixIcon: 'e-indent', id: this.element.id + '_gridcontrol_indent'
4157
4180
  });
4158
4181
  break;
@@ -4160,7 +4183,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4160
4183
  case ToolbarItem.RowOutdent:
4161
4184
  tooltipText = this.l10n.getConstant('RowOutdent');
4162
4185
  items.push({
4163
- text: tooltipText, tooltipText: tooltipText,
4186
+ text: tooltipText, tooltipText: tooltipText, disabled: true,
4164
4187
  prefixIcon: 'e-outdent', id: this.element.id + '_gridcontrol_outdent'
4165
4188
  });
4166
4189
  break;
@@ -4758,6 +4781,10 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4758
4781
  rowData.parentUniqueID = record.parentUniqueID;
4759
4782
  rowData.expanded = record.expanded;
4760
4783
  this.grid.setRowData(key, rowData);
4784
+ const table = this.getContentTable();
4785
+ const sHeight = table.scrollHeight;
4786
+ const clientHeight = this.getContent().clientHeight;
4787
+ this.lastRowBorder(this.getRows()[record.index], sHeight <= clientHeight);
4761
4788
  }
4762
4789
  /**
4763
4790
  * Navigates to the specified target page.
@@ -5513,7 +5540,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5513
5540
  }
5514
5541
  this.isExpandAll = true;
5515
5542
  this.isCollapseAll = true;
5516
- if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization) && !isRemoteData(this)) {
5543
+ if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization || this.enableInfiniteScrolling) && !isRemoteData(this)) {
5517
5544
  this.flatData.filter((e) => {
5518
5545
  if (e.hasChildRecords) {
5519
5546
  e.expanded = action === 'collapse' ? false : true;
@@ -5572,7 +5599,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5572
5599
  if (!isNullOrUndefined(row)) {
5573
5600
  row.setAttribute('aria-expanded', action === 'expand' ? 'true' : 'false');
5574
5601
  }
5575
- if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization) && !isRemoteData(this)
5602
+ if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization || this.enableInfiniteScrolling) && !isRemoteData(this)
5576
5603
  && !isCountRequired(this)) {
5577
5604
  this.notify(localPagedExpandCollapse, { action: action, row: row, record: record });
5578
5605
  }
@@ -5633,7 +5660,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5633
5660
  let totalRows = this.getRows();
5634
5661
  const rows = this.getContentTable().rows;
5635
5662
  totalRows = [].slice.call(rows);
5636
- for (let i = totalRows.length - 1; i > 0; i--) {
5663
+ for (let i = totalRows.length - 1; i >= 0; i--) {
5637
5664
  if (!isHidden(totalRows[i])) {
5638
5665
  const table = this.getContentTable();
5639
5666
  const sHeight = table.scrollHeight;
@@ -6777,6 +6804,7 @@ class RowDD$1 {
6777
6804
  */
6778
6805
  reorderRows(fromIndexes, toIndex, position) {
6779
6806
  const tObj = this.parent;
6807
+ const action = 'action';
6780
6808
  if (fromIndexes[0] !== toIndex && ['above', 'below', 'child'].indexOf(position) !== -1) {
6781
6809
  if (position === 'above') {
6782
6810
  this.dropPosition = 'topSegment';
@@ -6803,6 +6831,11 @@ class RowDD$1 {
6803
6831
  if (tObj.isLocalData) {
6804
6832
  tObj.flatData = this.orderToIndex(tObj.flatData);
6805
6833
  }
6834
+ if (this.parent[action] === 'outdenting') {
6835
+ if (!isNullOrUndefined(data[0].parentItem)) {
6836
+ data[0].level = data[0].parentItem.level + 1;
6837
+ }
6838
+ }
6806
6839
  this.parent.grid.refresh();
6807
6840
  if (this.parent.enableImmutableMode && this.dropPosition === 'middleSegment') {
6808
6841
  const index = this.parent.treeColumnIndex + 1;
@@ -6823,6 +6856,11 @@ class RowDD$1 {
6823
6856
  column: this.parent.grid.getColumns()[this.parent.treeColumnIndex],
6824
6857
  requestType: 'rowDragAndDrop'
6825
6858
  });
6859
+ if (this.parent[action] === 'indenting' || this.parent[action] === 'outdenting') {
6860
+ this.parent.renderModule.RowModifier({
6861
+ data: totalRecord[i], row: rows[i]
6862
+ });
6863
+ }
6826
6864
  }
6827
6865
  }
6828
6866
  }
@@ -8781,6 +8819,7 @@ class Toolbar$1 {
8781
8819
  */
8782
8820
  addEventListener() {
8783
8821
  this.parent.on(rowSelected, this.refreshToolbar, this);
8822
+ this.parent.on(rowDeselected, this.refreshToolbar, this);
8784
8823
  this.parent.on(toolbarClick, this.toolbarClickHandler, this);
8785
8824
  }
8786
8825
  /**
@@ -8792,6 +8831,7 @@ class Toolbar$1 {
8792
8831
  return;
8793
8832
  }
8794
8833
  this.parent.off(rowSelected, this.refreshToolbar);
8834
+ this.parent.off(rowDeselected, this.refreshToolbar);
8795
8835
  this.parent.off(toolbarClick, this.toolbarClickHandler);
8796
8836
  }
8797
8837
  refreshToolbar(args) {
@@ -8799,7 +8839,7 @@ class Toolbar$1 {
8799
8839
  if (args.row.rowIndex === 0 || tObj.getSelectedRecords().length > 1) {
8800
8840
  this.enableItems([tObj.element.id + '_gridcontrol_indent', tObj.element.id + '_gridcontrol_outdent'], false);
8801
8841
  }
8802
- else {
8842
+ else if (args['name'] !== "rowDeselected") {
8803
8843
  if (!isNullOrUndefined(tObj.getCurrentViewRecords()[args.row.rowIndex])) {
8804
8844
  if (!isNullOrUndefined(tObj.getCurrentViewRecords()[args.row.rowIndex]) &&
8805
8845
  (tObj.getCurrentViewRecords()[args.row.rowIndex].level >
@@ -8821,12 +8861,21 @@ class Toolbar$1 {
8821
8861
  }
8822
8862
  }
8823
8863
  }
8864
+ if (args['name'] === "rowDeselected") {
8865
+ if (this.parent.toolbar['includes']('Indent')) {
8866
+ this.enableItems([tObj.element.id + '_gridcontrol_indent'], false);
8867
+ }
8868
+ if (this.parent.toolbar['includes']('Outdent')) {
8869
+ this.enableItems([tObj.element.id + '_gridcontrol_outdent'], false);
8870
+ }
8871
+ }
8824
8872
  if (args.row.rowIndex === 0 && !isNullOrUndefined(args.data.parentItem)) {
8825
8873
  this.enableItems([tObj.element.id + '_gridcontrol_outdent'], true);
8826
8874
  }
8827
8875
  }
8828
8876
  toolbarClickHandler(args) {
8829
8877
  const tObj = this.parent;
8878
+ const action = 'action';
8830
8879
  if (this.parent.editSettings.mode === 'Cell' && this.parent.grid.editSettings.mode === 'Batch' &&
8831
8880
  args.item.id === this.parent.grid.element.id + '_update') {
8832
8881
  args.cancel = true;
@@ -8851,10 +8900,10 @@ class Toolbar$1 {
8851
8900
  else {
8852
8901
  dropIndex = tObj.getSelectedRowIndexes()[0] - 1;
8853
8902
  }
8854
- tObj.reorderRows([tObj.getSelectedRowIndexes()[0]], dropIndex, 'child');
8903
+ this.parent[action] = 'indenting';
8904
+ this.eventTrigger('indenting', dropIndex);
8855
8905
  }
8856
8906
  if (args.item.id === tObj.grid.element.id + '_outdent' && tObj.getSelectedRecords().length) {
8857
- const index = tObj.getSelectedRowIndexes()[0];
8858
8907
  let dropIndex;
8859
8908
  const parentItem = tObj.getSelectedRecords()[0].parentItem;
8860
8909
  for (let i = 0; i < tObj.getCurrentViewRecords().length; i++) {
@@ -8862,9 +8911,32 @@ class Toolbar$1 {
8862
8911
  dropIndex = i;
8863
8912
  }
8864
8913
  }
8865
- tObj.reorderRows([index], dropIndex, 'below');
8914
+ this.parent[action] = 'outdenting';
8915
+ this.eventTrigger('outdenting', dropIndex);
8866
8916
  }
8867
8917
  }
8918
+ eventTrigger(action, dropIndex) {
8919
+ const selectedRecords = 'selectedRecords';
8920
+ const selectedRows = 'selectedRows';
8921
+ this.parent[selectedRows] = this.parent.getSelectedRows();
8922
+ this.parent[selectedRecords] = this.parent.getSelectedRecords();
8923
+ const actionArgs = {
8924
+ requestType: action,
8925
+ data: this.parent.getSelectedRecords(),
8926
+ row: this.parent.getSelectedRows(),
8927
+ cancel: false
8928
+ };
8929
+ this.parent.trigger(actionBegin, actionArgs, (actionArgs) => {
8930
+ if (!actionArgs.cancel) {
8931
+ if (actionArgs.requestType === 'indenting') {
8932
+ this.parent.reorderRows([this.parent.getSelectedRowIndexes()[0]], dropIndex, 'child');
8933
+ }
8934
+ else if (actionArgs.requestType === 'outdenting') {
8935
+ this.parent.reorderRows([this.parent.getSelectedRowIndexes()[0]], dropIndex, 'below');
8936
+ }
8937
+ }
8938
+ });
8939
+ }
8868
8940
  /**
8869
8941
  * Gets the toolbar of the TreeGrid.
8870
8942
  *
@@ -11986,6 +12058,7 @@ class InfiniteScroll$1 {
11986
12058
  this.parent.grid.on('infinite-edit-handler', this.infiniteEditHandler, this);
11987
12059
  this.parent.grid.on('infinite-crud-cancel', this.createRows, this);
11988
12060
  this.parent.grid.on('content-ready', this.contentready, this);
12061
+ this.parent.on(localPagedExpandCollapse, this.collapseExpandInfinitechilds, this);
11989
12062
  }
11990
12063
  /**
11991
12064
  * @hidden
@@ -12001,6 +12074,7 @@ class InfiniteScroll$1 {
12001
12074
  this.parent.off(pagingActions, this.infinitePageAction);
12002
12075
  this.parent.grid.off('infinite-crud-cancel', this.createRows);
12003
12076
  this.parent.grid.off('content-ready', this.contentready);
12077
+ this.parent.off(localPagedExpandCollapse, this.collapseExpandInfinitechilds);
12004
12078
  }
12005
12079
  /**
12006
12080
  * Handles the Expand Collapse action for Remote data with infinite scrolling.
@@ -12050,6 +12124,18 @@ class InfiniteScroll$1 {
12050
12124
  }
12051
12125
  }
12052
12126
  }
12127
+ collapseExpandInfinitechilds(row) {
12128
+ row.record.expanded = row.action === 'collapse' ? false : true;
12129
+ const ret = {
12130
+ result: this.parent.flatData,
12131
+ row: row.row,
12132
+ action: row.action,
12133
+ record: row.record,
12134
+ count: this.parent.flatData.length
12135
+ };
12136
+ const requestType = getValue('isCollapseAll', this.parent) ? 'collapseAll' : 'refresh';
12137
+ getValue('grid.renderModule', this.parent).dataManagerSuccess(ret, { requestType: requestType });
12138
+ }
12053
12139
  /**
12054
12140
  * Handles the page query for Data operations and CRUD actions.
12055
12141
  *
@@ -12062,7 +12148,10 @@ class InfiniteScroll$1 {
12062
12148
  infinitePageAction(pageingDetails) {
12063
12149
  const dm = new DataManager(pageingDetails.result);
12064
12150
  const expanded$$1 = new Predicate('expanded', 'notequal', null).or('expanded', 'notequal', undefined);
12065
- const visualData = dm.executeLocal(new Query().where(expanded$$1));
12151
+ const infiniteParents = dm.executeLocal(new Query().where(expanded$$1));
12152
+ const visualData = infiniteParents.filter((e) => {
12153
+ return getExpandStatus(this.parent, e, infiniteParents);
12154
+ });
12066
12155
  const actionArgs = getValue('actionArgs', pageingDetails.actionArgs);
12067
12156
  const actions = getValue('actions', this.parent.grid.infiniteScrollModule);
12068
12157
  const initial = actions.some((value) => { return value === actionArgs.requestType; });
@@ -12078,10 +12167,10 @@ class InfiniteScroll$1 {
12078
12167
  if (isCache && this.parent.infiniteScrollSettings.initialBlocks > this.parent.infiniteScrollSettings.maxBlocks) {
12079
12168
  this.parent.infiniteScrollSettings.initialBlocks = this.parent.infiniteScrollSettings.maxBlocks;
12080
12169
  }
12081
- const size = initialRender ?
12170
+ let size = initialRender ?
12082
12171
  this.parent.pageSettings.pageSize * this.parent.infiniteScrollSettings.initialBlocks :
12083
12172
  this.parent.pageSettings.pageSize;
12084
- const current = this.parent.grid.pageSettings.currentPage;
12173
+ let current = this.parent.grid.pageSettings.currentPage;
12085
12174
  if (!isNullOrUndefined(actionArgs)) {
12086
12175
  const lastIndex = getValue('lastIndex', this.parent.grid.infiniteScrollModule);
12087
12176
  const firstIndex = getValue('firstIndex', this.parent.grid.infiniteScrollModule);
@@ -12096,6 +12185,10 @@ class InfiniteScroll$1 {
12096
12185
  query = query.take(this.parent.infiniteScrollSettings.initialBlocks * this.parent.pageSettings.pageSize);
12097
12186
  }
12098
12187
  else {
12188
+ if ((pageingDetails.actionArgs['action'] === 'expand' || pageingDetails.actionArgs['action'] === 'collapse') && this.parent.grid.pageSettings.currentPage !== 1) {
12189
+ current = 1;
12190
+ size = this.parent.pageSettings.pageSize * this.parent.grid.pageSettings.currentPage;
12191
+ }
12099
12192
  query = query.page(current, size);
12100
12193
  }
12101
12194
  }