@syncfusion/ej2-treegrid 19.4.50 → 19.4.52

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.
@@ -3927,14 +3927,16 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3927
3927
  this.grid.query = this.grid.query instanceof Query ? this.grid.query : new Query();
3928
3928
  }
3929
3929
  }
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;
3930
+ if (this.action !== 'indent' && this.action !== 'outdent') {
3931
+ const callBackPromise = new Deferred();
3932
+ this.trigger(actionBegin, args, (actionArgs) => {
3933
+ if (!actionArgs.cancel) {
3934
+ this.notify(beginEdit, actionArgs);
3935
+ }
3936
+ callBackPromise.resolve(actionArgs);
3937
+ });
3938
+ return callBackPromise;
3939
+ }
3938
3940
  };
3939
3941
  this.grid.actionComplete = (args) => {
3940
3942
  this.notify('actioncomplete', args);
@@ -3954,7 +3956,19 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3954
3956
  if (args.requestType === 'save' && this.aggregates.map((ag) => ag.showChildSummary === true).length) {
3955
3957
  this.grid.refresh();
3956
3958
  }
3957
- this.trigger(actionComplete, args);
3959
+ if (this.action === 'indent' || this.action === 'outdent') {
3960
+ const actionArgs = {
3961
+ requestType: this.action,
3962
+ data: this.selectedRecords,
3963
+ row: this.selectedRows
3964
+ };
3965
+ this.trigger(actionComplete, actionArgs);
3966
+ this.action = '';
3967
+ this.selectedRecords = this.selectedRows = [];
3968
+ }
3969
+ else {
3970
+ this.trigger(actionComplete, args);
3971
+ }
3958
3972
  };
3959
3973
  }
3960
3974
  extendedGridEvents() {
@@ -4758,6 +4772,10 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4758
4772
  rowData.parentUniqueID = record.parentUniqueID;
4759
4773
  rowData.expanded = record.expanded;
4760
4774
  this.grid.setRowData(key, rowData);
4775
+ const table = this.getContentTable();
4776
+ const sHeight = table.scrollHeight;
4777
+ const clientHeight = this.getContent().clientHeight;
4778
+ this.lastRowBorder(this.getRows()[record.index], sHeight <= clientHeight);
4761
4779
  }
4762
4780
  /**
4763
4781
  * Navigates to the specified target page.
@@ -5513,7 +5531,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5513
5531
  }
5514
5532
  this.isExpandAll = true;
5515
5533
  this.isCollapseAll = true;
5516
- if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization) && !isRemoteData(this)) {
5534
+ if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization || this.enableInfiniteScrolling) && !isRemoteData(this)) {
5517
5535
  this.flatData.filter((e) => {
5518
5536
  if (e.hasChildRecords) {
5519
5537
  e.expanded = action === 'collapse' ? false : true;
@@ -5572,7 +5590,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5572
5590
  if (!isNullOrUndefined(row)) {
5573
5591
  row.setAttribute('aria-expanded', action === 'expand' ? 'true' : 'false');
5574
5592
  }
5575
- if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization) && !isRemoteData(this)
5593
+ if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization || this.enableInfiniteScrolling) && !isRemoteData(this)
5576
5594
  && !isCountRequired(this)) {
5577
5595
  this.notify(localPagedExpandCollapse, { action: action, row: row, record: record });
5578
5596
  }
@@ -5633,7 +5651,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5633
5651
  let totalRows = this.getRows();
5634
5652
  const rows = this.getContentTable().rows;
5635
5653
  totalRows = [].slice.call(rows);
5636
- for (let i = totalRows.length - 1; i > 0; i--) {
5654
+ for (let i = totalRows.length - 1; i >= 0; i--) {
5637
5655
  if (!isHidden(totalRows[i])) {
5638
5656
  const table = this.getContentTable();
5639
5657
  const sHeight = table.scrollHeight;
@@ -8827,6 +8845,7 @@ class Toolbar$1 {
8827
8845
  }
8828
8846
  toolbarClickHandler(args) {
8829
8847
  const tObj = this.parent;
8848
+ const action = 'action';
8830
8849
  if (this.parent.editSettings.mode === 'Cell' && this.parent.grid.editSettings.mode === 'Batch' &&
8831
8850
  args.item.id === this.parent.grid.element.id + '_update') {
8832
8851
  args.cancel = true;
@@ -8851,10 +8870,10 @@ class Toolbar$1 {
8851
8870
  else {
8852
8871
  dropIndex = tObj.getSelectedRowIndexes()[0] - 1;
8853
8872
  }
8854
- tObj.reorderRows([tObj.getSelectedRowIndexes()[0]], dropIndex, 'child');
8873
+ this.parent[action] = 'indent';
8874
+ this.eventTrigger('indent', dropIndex);
8855
8875
  }
8856
8876
  if (args.item.id === tObj.grid.element.id + '_outdent' && tObj.getSelectedRecords().length) {
8857
- const index = tObj.getSelectedRowIndexes()[0];
8858
8877
  let dropIndex;
8859
8878
  const parentItem = tObj.getSelectedRecords()[0].parentItem;
8860
8879
  for (let i = 0; i < tObj.getCurrentViewRecords().length; i++) {
@@ -8862,9 +8881,32 @@ class Toolbar$1 {
8862
8881
  dropIndex = i;
8863
8882
  }
8864
8883
  }
8865
- tObj.reorderRows([index], dropIndex, 'below');
8884
+ this.parent[action] = 'outdent';
8885
+ this.eventTrigger('outdent', dropIndex);
8866
8886
  }
8867
8887
  }
8888
+ eventTrigger(action, dropIndex) {
8889
+ const selectedRecords = 'selectedRecords';
8890
+ const selectedRows = 'selectedRows';
8891
+ this.parent[selectedRows] = this.parent.getSelectedRows();
8892
+ this.parent[selectedRecords] = this.parent.getSelectedRecords();
8893
+ const actionArgs = {
8894
+ requestType: action,
8895
+ data: this.parent.getSelectedRecords(),
8896
+ row: this.parent.getSelectedRows(),
8897
+ cancel: false
8898
+ };
8899
+ this.parent.trigger(actionBegin, actionArgs, (actionArgs) => {
8900
+ if (!actionArgs.cancel) {
8901
+ if (actionArgs.requestType === 'indent') {
8902
+ this.parent.reorderRows([this.parent.getSelectedRowIndexes()[0]], dropIndex, 'child');
8903
+ }
8904
+ else if (actionArgs.requestType === 'outdent') {
8905
+ this.parent.reorderRows([this.parent.getSelectedRowIndexes()[0]], dropIndex, 'below');
8906
+ }
8907
+ }
8908
+ });
8909
+ }
8868
8910
  /**
8869
8911
  * Gets the toolbar of the TreeGrid.
8870
8912
  *
@@ -11986,6 +12028,7 @@ class InfiniteScroll$1 {
11986
12028
  this.parent.grid.on('infinite-edit-handler', this.infiniteEditHandler, this);
11987
12029
  this.parent.grid.on('infinite-crud-cancel', this.createRows, this);
11988
12030
  this.parent.grid.on('content-ready', this.contentready, this);
12031
+ this.parent.on(localPagedExpandCollapse, this.collapseExpandInfinitechilds, this);
11989
12032
  }
11990
12033
  /**
11991
12034
  * @hidden
@@ -12001,6 +12044,7 @@ class InfiniteScroll$1 {
12001
12044
  this.parent.off(pagingActions, this.infinitePageAction);
12002
12045
  this.parent.grid.off('infinite-crud-cancel', this.createRows);
12003
12046
  this.parent.grid.off('content-ready', this.contentready);
12047
+ this.parent.off(localPagedExpandCollapse, this.collapseExpandInfinitechilds);
12004
12048
  }
12005
12049
  /**
12006
12050
  * Handles the Expand Collapse action for Remote data with infinite scrolling.
@@ -12050,6 +12094,18 @@ class InfiniteScroll$1 {
12050
12094
  }
12051
12095
  }
12052
12096
  }
12097
+ collapseExpandInfinitechilds(row) {
12098
+ row.record.expanded = row.action === 'collapse' ? false : true;
12099
+ const ret = {
12100
+ result: this.parent.flatData,
12101
+ row: row.row,
12102
+ action: row.action,
12103
+ record: row.record,
12104
+ count: this.parent.flatData.length
12105
+ };
12106
+ const requestType = getValue('isCollapseAll', this.parent) ? 'collapseAll' : 'refresh';
12107
+ getValue('grid.renderModule', this.parent).dataManagerSuccess(ret, { requestType: requestType });
12108
+ }
12053
12109
  /**
12054
12110
  * Handles the page query for Data operations and CRUD actions.
12055
12111
  *
@@ -12062,7 +12118,10 @@ class InfiniteScroll$1 {
12062
12118
  infinitePageAction(pageingDetails) {
12063
12119
  const dm = new DataManager(pageingDetails.result);
12064
12120
  const expanded$$1 = new Predicate('expanded', 'notequal', null).or('expanded', 'notequal', undefined);
12065
- const visualData = dm.executeLocal(new Query().where(expanded$$1));
12121
+ const infiniteParents = dm.executeLocal(new Query().where(expanded$$1));
12122
+ const visualData = infiniteParents.filter((e) => {
12123
+ return getExpandStatus(this.parent, e, infiniteParents);
12124
+ });
12066
12125
  const actionArgs = getValue('actionArgs', pageingDetails.actionArgs);
12067
12126
  const actions = getValue('actions', this.parent.grid.infiniteScrollModule);
12068
12127
  const initial = actions.some((value) => { return value === actionArgs.requestType; });
@@ -12078,10 +12137,10 @@ class InfiniteScroll$1 {
12078
12137
  if (isCache && this.parent.infiniteScrollSettings.initialBlocks > this.parent.infiniteScrollSettings.maxBlocks) {
12079
12138
  this.parent.infiniteScrollSettings.initialBlocks = this.parent.infiniteScrollSettings.maxBlocks;
12080
12139
  }
12081
- const size = initialRender ?
12140
+ let size = initialRender ?
12082
12141
  this.parent.pageSettings.pageSize * this.parent.infiniteScrollSettings.initialBlocks :
12083
12142
  this.parent.pageSettings.pageSize;
12084
- const current = this.parent.grid.pageSettings.currentPage;
12143
+ let current = this.parent.grid.pageSettings.currentPage;
12085
12144
  if (!isNullOrUndefined(actionArgs)) {
12086
12145
  const lastIndex = getValue('lastIndex', this.parent.grid.infiniteScrollModule);
12087
12146
  const firstIndex = getValue('firstIndex', this.parent.grid.infiniteScrollModule);
@@ -12096,6 +12155,10 @@ class InfiniteScroll$1 {
12096
12155
  query = query.take(this.parent.infiniteScrollSettings.initialBlocks * this.parent.pageSettings.pageSize);
12097
12156
  }
12098
12157
  else {
12158
+ if ((pageingDetails.actionArgs['action'] === 'expand' || pageingDetails.actionArgs['action'] === 'collapse') && this.parent.grid.pageSettings.currentPage !== 1) {
12159
+ current = 1;
12160
+ size = this.parent.pageSettings.pageSize * this.parent.grid.pageSettings.currentPage;
12161
+ }
12099
12162
  query = query.page(current, size);
12100
12163
  }
12101
12164
  }