@syncfusion/ej2-treegrid 19.4.42 → 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.
@@ -3054,7 +3054,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3054
3054
  * @returns {void}
3055
3055
  */
3056
3056
  sortByColumn(columnName, direction, isMultiSort) {
3057
- this.sortModule.sortColumn(columnName, direction, isMultiSort);
3057
+ if (this.sortModule) {
3058
+ this.sortModule.sortColumn(columnName, direction, isMultiSort);
3059
+ }
3058
3060
  }
3059
3061
  /**
3060
3062
  * Clears all the sorted columns of the TreeGrid.
@@ -3074,7 +3076,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3074
3076
  * @hidden
3075
3077
  */
3076
3078
  removeSortColumn(field) {
3077
- this.sortModule.removeSortColumn(field);
3079
+ if (this.sortModule) {
3080
+ this.sortModule.removeSortColumn(field);
3081
+ }
3078
3082
  }
3079
3083
  /**
3080
3084
  * Searches TreeGrid records using the given key.
@@ -3431,6 +3435,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3431
3435
  this.grid.isReact = true;
3432
3436
  this.grid.portals = [];
3433
3437
  }
3438
+ if (this.isVue) {
3439
+ this.grid.isVue = true;
3440
+ }
3434
3441
  createSpinner({ target: this.element }, this.createElement);
3435
3442
  this.log(['mapping_fields_missing']);
3436
3443
  this.renderModule = new Render(this);
@@ -3920,14 +3927,16 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3920
3927
  this.grid.query = this.grid.query instanceof Query ? this.grid.query : new Query();
3921
3928
  }
3922
3929
  }
3923
- const callBackPromise = new Deferred();
3924
- this.trigger(actionBegin, args, (actionArgs) => {
3925
- if (!actionArgs.cancel) {
3926
- this.notify(beginEdit, actionArgs);
3927
- }
3928
- callBackPromise.resolve(actionArgs);
3929
- });
3930
- 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
+ }
3931
3940
  };
3932
3941
  this.grid.actionComplete = (args) => {
3933
3942
  this.notify('actioncomplete', args);
@@ -3947,7 +3956,19 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3947
3956
  if (args.requestType === 'save' && this.aggregates.map((ag) => ag.showChildSummary === true).length) {
3948
3957
  this.grid.refresh();
3949
3958
  }
3950
- 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
+ }
3951
3972
  };
3952
3973
  }
3953
3974
  extendedGridEvents() {
@@ -4751,6 +4772,10 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4751
4772
  rowData.parentUniqueID = record.parentUniqueID;
4752
4773
  rowData.expanded = record.expanded;
4753
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);
4754
4779
  }
4755
4780
  /**
4756
4781
  * Navigates to the specified target page.
@@ -5304,7 +5329,12 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5304
5329
  });
5305
5330
  }
5306
5331
  else if (isNullOrUndefined(record)) {
5307
- record = this.grid.getCurrentViewRecords()[row.rowIndex];
5332
+ if (this.detailTemplate) {
5333
+ record = this.grid.getCurrentViewRecords()[row.getAttribute('aria-rowindex')];
5334
+ }
5335
+ else {
5336
+ record = this.grid.getCurrentViewRecords()[row.rowIndex];
5337
+ }
5308
5338
  }
5309
5339
  return record;
5310
5340
  }
@@ -5501,7 +5531,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5501
5531
  }
5502
5532
  this.isExpandAll = true;
5503
5533
  this.isCollapseAll = true;
5504
- 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)) {
5505
5535
  this.flatData.filter((e) => {
5506
5536
  if (e.hasChildRecords) {
5507
5537
  e.expanded = action === 'collapse' ? false : true;
@@ -5560,7 +5590,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5560
5590
  if (!isNullOrUndefined(row)) {
5561
5591
  row.setAttribute('aria-expanded', action === 'expand' ? 'true' : 'false');
5562
5592
  }
5563
- 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)
5564
5594
  && !isCountRequired(this)) {
5565
5595
  this.notify(localPagedExpandCollapse, { action: action, row: row, record: record });
5566
5596
  }
@@ -5621,7 +5651,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5621
5651
  let totalRows = this.getRows();
5622
5652
  const rows = this.getContentTable().rows;
5623
5653
  totalRows = [].slice.call(rows);
5624
- for (let i = totalRows.length - 1; i > 0; i--) {
5654
+ for (let i = totalRows.length - 1; i >= 0; i--) {
5625
5655
  if (!isHidden(totalRows[i])) {
5626
5656
  const table = this.getContentTable();
5627
5657
  const sHeight = table.scrollHeight;
@@ -8815,6 +8845,7 @@ class Toolbar$1 {
8815
8845
  }
8816
8846
  toolbarClickHandler(args) {
8817
8847
  const tObj = this.parent;
8848
+ const action = 'action';
8818
8849
  if (this.parent.editSettings.mode === 'Cell' && this.parent.grid.editSettings.mode === 'Batch' &&
8819
8850
  args.item.id === this.parent.grid.element.id + '_update') {
8820
8851
  args.cancel = true;
@@ -8839,10 +8870,10 @@ class Toolbar$1 {
8839
8870
  else {
8840
8871
  dropIndex = tObj.getSelectedRowIndexes()[0] - 1;
8841
8872
  }
8842
- tObj.reorderRows([tObj.getSelectedRowIndexes()[0]], dropIndex, 'child');
8873
+ this.parent[action] = 'indent';
8874
+ this.eventTrigger('indent', dropIndex);
8843
8875
  }
8844
8876
  if (args.item.id === tObj.grid.element.id + '_outdent' && tObj.getSelectedRecords().length) {
8845
- const index = tObj.getSelectedRowIndexes()[0];
8846
8877
  let dropIndex;
8847
8878
  const parentItem = tObj.getSelectedRecords()[0].parentItem;
8848
8879
  for (let i = 0; i < tObj.getCurrentViewRecords().length; i++) {
@@ -8850,9 +8881,32 @@ class Toolbar$1 {
8850
8881
  dropIndex = i;
8851
8882
  }
8852
8883
  }
8853
- tObj.reorderRows([index], dropIndex, 'below');
8884
+ this.parent[action] = 'outdent';
8885
+ this.eventTrigger('outdent', dropIndex);
8854
8886
  }
8855
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
+ }
8856
8910
  /**
8857
8911
  * Gets the toolbar of the TreeGrid.
8858
8912
  *
@@ -11741,7 +11795,7 @@ class VirtualScroll$1 {
11741
11795
  if (pageingDetails.count < this.parent.getRows()[0].getBoundingClientRect().height) {
11742
11796
  startIndex = 0;
11743
11797
  }
11744
- else {
11798
+ else if (!this.parent['isExpandAll']) {
11745
11799
  startIndex = this.prevstartIndex === -1 ? 0 : this.prevstartIndex;
11746
11800
  }
11747
11801
  }
@@ -11974,6 +12028,7 @@ class InfiniteScroll$1 {
11974
12028
  this.parent.grid.on('infinite-edit-handler', this.infiniteEditHandler, this);
11975
12029
  this.parent.grid.on('infinite-crud-cancel', this.createRows, this);
11976
12030
  this.parent.grid.on('content-ready', this.contentready, this);
12031
+ this.parent.on(localPagedExpandCollapse, this.collapseExpandInfinitechilds, this);
11977
12032
  }
11978
12033
  /**
11979
12034
  * @hidden
@@ -11989,6 +12044,7 @@ class InfiniteScroll$1 {
11989
12044
  this.parent.off(pagingActions, this.infinitePageAction);
11990
12045
  this.parent.grid.off('infinite-crud-cancel', this.createRows);
11991
12046
  this.parent.grid.off('content-ready', this.contentready);
12047
+ this.parent.off(localPagedExpandCollapse, this.collapseExpandInfinitechilds);
11992
12048
  }
11993
12049
  /**
11994
12050
  * Handles the Expand Collapse action for Remote data with infinite scrolling.
@@ -12038,6 +12094,18 @@ class InfiniteScroll$1 {
12038
12094
  }
12039
12095
  }
12040
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
+ }
12041
12109
  /**
12042
12110
  * Handles the page query for Data operations and CRUD actions.
12043
12111
  *
@@ -12050,7 +12118,10 @@ class InfiniteScroll$1 {
12050
12118
  infinitePageAction(pageingDetails) {
12051
12119
  const dm = new DataManager(pageingDetails.result);
12052
12120
  const expanded$$1 = new Predicate('expanded', 'notequal', null).or('expanded', 'notequal', undefined);
12053
- 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
+ });
12054
12125
  const actionArgs = getValue('actionArgs', pageingDetails.actionArgs);
12055
12126
  const actions = getValue('actions', this.parent.grid.infiniteScrollModule);
12056
12127
  const initial = actions.some((value) => { return value === actionArgs.requestType; });
@@ -12066,10 +12137,10 @@ class InfiniteScroll$1 {
12066
12137
  if (isCache && this.parent.infiniteScrollSettings.initialBlocks > this.parent.infiniteScrollSettings.maxBlocks) {
12067
12138
  this.parent.infiniteScrollSettings.initialBlocks = this.parent.infiniteScrollSettings.maxBlocks;
12068
12139
  }
12069
- const size = initialRender ?
12140
+ let size = initialRender ?
12070
12141
  this.parent.pageSettings.pageSize * this.parent.infiniteScrollSettings.initialBlocks :
12071
12142
  this.parent.pageSettings.pageSize;
12072
- const current = this.parent.grid.pageSettings.currentPage;
12143
+ let current = this.parent.grid.pageSettings.currentPage;
12073
12144
  if (!isNullOrUndefined(actionArgs)) {
12074
12145
  const lastIndex = getValue('lastIndex', this.parent.grid.infiniteScrollModule);
12075
12146
  const firstIndex = getValue('firstIndex', this.parent.grid.infiniteScrollModule);
@@ -12084,6 +12155,10 @@ class InfiniteScroll$1 {
12084
12155
  query = query.take(this.parent.infiniteScrollSettings.initialBlocks * this.parent.pageSettings.pageSize);
12085
12156
  }
12086
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
+ }
12087
12162
  query = query.page(current, size);
12088
12163
  }
12089
12164
  }