@syncfusion/ej2-treegrid 26.1.35 → 26.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.
@@ -1,5 +1,5 @@
1
1
  import { merge, Property, ChildProperty, Collection, isNullOrUndefined, Browser, removeClass, addClass, getValue, createElement, setValue, extend as extend$1, Internationalization, getEnumValue, compile, Component, L10n, EventHandler, KeyboardEvents, SanitizeHtmlHelper, Complex, Event, NotifyPropertyChanges, closest, classList, setStyleAttribute, select, debounce, remove } from '@syncfusion/ej2-base';
2
- import { Logger as Logger$1, Grid, detailLists, Clipboard, getObject, parentsUntil, Print as Print$1, templateCompiler, appendChildren, extend, CellRenderer, getUid, CellType, Freeze as Freeze$1, getNumberFormat, getActualProperties, iterateArrayOrObject, RowDropSettings as RowDropSettings$1, Reorder as Reorder$1, Resize as Resize$1, RowDD as RowDD$1, Scroll, VirtualRowModelGenerator, Filter as Filter$1, ExcelExport as ExcelExport$1, PdfExport as PdfExport$1, Page as Page$1, Toolbar as Toolbar$1, Aggregate as Aggregate$1, calculateAggregate, Sort as Sort$1, ColumnMenu as ColumnMenu$1, ContextMenu as ContextMenu$1, Edit as Edit$1, resetRowIndex, CommandColumn as CommandColumn$1, DetailRow as DetailRow$1, VirtualContentRenderer, Cell, InterSectionObserver, getTransformValues, VirtualScroll as VirtualScroll$1, RenderType, VirtualHeaderRenderer, ColumnChooser as ColumnChooser$1, InfiniteScroll as InfiniteScroll$1, RowRenderer } from '@syncfusion/ej2-grids';
2
+ import { Logger as Logger$1, Grid, detailLists, Clipboard, getObject, parentsUntil, Print as Print$1, templateCompiler, appendChildren, extend, CellRenderer, getUid, CellType, Freeze as Freeze$1, getNumberFormat, getActualProperties, iterateArrayOrObject, RowDropSettings as RowDropSettings$1, Reorder as Reorder$1, Resize as Resize$1, RowDD as RowDD$1, Scroll, VirtualRowModelGenerator, Filter as Filter$1, ExcelExport as ExcelExport$1, Data, ExportHelper, PdfExport as PdfExport$1, Page as Page$1, Toolbar as Toolbar$1, Aggregate as Aggregate$1, calculateAggregate, Sort as Sort$1, ColumnMenu as ColumnMenu$1, ContextMenu as ContextMenu$1, Edit as Edit$1, resetRowIndex, CommandColumn as CommandColumn$1, DetailRow as DetailRow$1, VirtualContentRenderer, Cell, InterSectionObserver, getTransformValues, VirtualScroll as VirtualScroll$1, RenderType, VirtualHeaderRenderer, ColumnChooser as ColumnChooser$1, InfiniteScroll as InfiniteScroll$1, RowRenderer } from '@syncfusion/ej2-grids';
3
3
  import { createCheckBox } from '@syncfusion/ej2-buttons';
4
4
  import { DataManager, ODataAdaptor, WebApiAdaptor, WebMethodAdaptor, CacheAdaptor, UrlAdaptor, Query, DataUtil, RemoteSaveAdaptor, Deferred, JsonAdaptor, Predicate as Predicate$1 } from '@syncfusion/ej2-data';
5
5
  import { showSpinner, hideSpinner, createSpinner } from '@syncfusion/ej2-popups';
@@ -2206,16 +2206,20 @@ class DataManipulation {
2206
2206
  const clonequries = qry.queries.filter((e) => e.fn !== 'onPage' && e.fn !== 'onWhere');
2207
2207
  qry.queries = clonequries;
2208
2208
  qry.isCountRequired = true;
2209
+ let idMappingValue = parseInt(rowDetails.record[this.parent.idMapping], 10);
2210
+ if (isNaN(idMappingValue)) {
2211
+ idMappingValue = rowDetails.record[this.parent.idMapping].toString();
2212
+ }
2209
2213
  if (this.parent.enableVirtualization && rowDetails.action === 'remoteExpand') {
2210
2214
  qry.take(this.parent.pageSettings.pageSize);
2211
2215
  const expandDetail = [];
2212
- expandDetail.push('ExpandingAction', parseInt(rowDetails.record[this.parent.idMapping], 10).toString());
2216
+ expandDetail.push('ExpandingAction', idMappingValue.toString());
2213
2217
  qry.expand(expandDetail);
2214
2218
  }
2215
2219
  else if (this.parent.enableVirtualization && rowDetails.action === 'collapse') {
2216
2220
  qry.take(this.parent.grid.pageSettings.pageSize);
2217
2221
  const expandDetail = [];
2218
- expandDetail.push('CollapsingAction', parseInt(rowDetails.record[this.parent.idMapping], 10).toString());
2222
+ expandDetail.push('CollapsingAction', idMappingValue.toString());
2219
2223
  qry.expand(expandDetail);
2220
2224
  }
2221
2225
  qry.where(this.parent.parentIdMapping, 'equal', rowDetails.record[this.parent.idMapping]);
@@ -3907,7 +3911,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3907
3911
  requiredModules() {
3908
3912
  const modules = [];
3909
3913
  const splitFrozenCount = 'splitFrozenCount';
3910
- this.grid[`${splitFrozenCount}`](this.getColumns());
3914
+ if (!this.isReact && isNullOrUndefined(this['changedProperties'].columns)) {
3915
+ this.grid[`${splitFrozenCount}`](this.getColumns());
3916
+ }
3911
3917
  if (this.isDestroyed) {
3912
3918
  return modules;
3913
3919
  }
@@ -5137,6 +5143,11 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5137
5143
  onPropertyChanged(newProp) {
5138
5144
  const properties = Object.keys(newProp);
5139
5145
  let requireRefresh = false;
5146
+ if (properties.indexOf('columns') > -1 && !isNullOrUndefined(newProp.columns)) {
5147
+ this.grid.columns = this.getGridColumns(newProp.columns);
5148
+ this.grid['updateColumnObject']();
5149
+ requireRefresh = true;
5150
+ }
5140
5151
  for (const prop of properties) {
5141
5152
  switch (prop) {
5142
5153
  case 'treeColumnIndex':
@@ -6250,6 +6261,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6250
6261
  * @returns {void}
6251
6262
  */
6252
6263
  expandRow(row, record, key, level) {
6264
+ this.isCollapseAll = false;
6253
6265
  if (isNullOrUndefined(row) && isNullOrUndefined(record) && isNullOrUndefined(key) && isNullOrUndefined(level)) {
6254
6266
  const error = 'The provided value for the row is undefined. Please ensure the row contains row element.';
6255
6267
  this.trigger(actionFailure, { error: error });
@@ -6370,6 +6382,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6370
6382
  * @returns {void}
6371
6383
  */
6372
6384
  collapseRow(row, record, key) {
6385
+ this.isExpandAll = false;
6373
6386
  if (isNullOrUndefined(row) && isNullOrUndefined(record) && isNullOrUndefined(key)) {
6374
6387
  const error = 'The provided value for the row is undefined. Please ensure the row contains row element.';
6375
6388
  this.trigger(actionFailure, { error: error });
@@ -6638,6 +6651,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6638
6651
  return e.querySelector('.e-treegrid' + (action === 'expand' ? 'collapse' : 'expand'));
6639
6652
  });
6640
6653
  }
6654
+ if (!rows.length && this.getRows().length) {
6655
+ rows.push(this.getRows()[0]);
6656
+ }
6641
6657
  this.isExpandAll = true;
6642
6658
  this.isCollapseAll = true;
6643
6659
  if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization || this.enableInfiniteScrolling) && !isRemoteData(this)) {
@@ -9831,14 +9847,19 @@ class ExcelExport {
9831
9847
  /* eslint-disable-next-line */
9832
9848
  isMultipleExport, workbook, isBlob, isCsv) {
9833
9849
  const dataSource = this.parent.dataSource;
9850
+ const data = new Data(this.parent.grid);
9834
9851
  const property = Object();
9835
9852
  setValue('isCsv', isCsv, property);
9836
9853
  setValue('cancel', false, property);
9837
9854
  if (!isNullOrUndefined(excelExportProperties)) {
9838
9855
  this.isCollapsedStatePersist = excelExportProperties.isCollapsedStatePersist;
9839
9856
  }
9840
- if (!isNullOrUndefined(excelExportProperties) && !isNullOrUndefined(excelExportProperties.dataSource)) {
9841
- if (!excelExportProperties.dataSource['dataSource']) {
9857
+ if (!isNullOrUndefined(excelExportProperties)) {
9858
+ if (!isNullOrUndefined(excelExportProperties.dataSource) && !excelExportProperties.dataSource['dataSource']) {
9859
+ return this.parent.grid.excelExportModule.Map(this.parent.grid, excelExportProperties, isMultipleExport, workbook, isCsv, isBlob);
9860
+ }
9861
+ if (excelExportProperties.exportType === 'CurrentPage') {
9862
+ excelExportProperties.dataSource = this.parent.getCurrentViewRecords();
9842
9863
  return this.parent.grid.excelExportModule.Map(this.parent.grid, excelExportProperties, isMultipleExport, workbook, isCsv, isBlob);
9843
9864
  }
9844
9865
  }
@@ -9849,6 +9870,11 @@ class ExcelExport {
9849
9870
  if (!this.isLocal()) {
9850
9871
  query = this.generateQuery(query);
9851
9872
  query.queries = this.parent.grid.getDataModule().generateQuery().queries;
9873
+ query = ExportHelper.getQuery(this.parent.grid, data);
9874
+ if (isNullOrUndefined(this.parent.filterModule)) {
9875
+ query.queries = query.queries.slice(1, 2);
9876
+ query.params = query.params.slice(0, 0);
9877
+ }
9852
9878
  setValue('query', query, property);
9853
9879
  }
9854
9880
  this.parent.trigger(beforeExcelExport, extend$1(property, excelExportProperties));
@@ -13012,6 +13038,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13012
13038
  rowSelectedEvent(args) {
13013
13039
  const rowSelected = 'rowSelected';
13014
13040
  super[`${rowSelected}`](args);
13041
+ this.parent.notify('virtualTransform', { requestType: 'transformChange' });
13015
13042
  }
13016
13043
  toSelectVirtualRow(args) {
13017
13044
  if (this.parent.isEdit) {
@@ -13180,7 +13207,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13180
13207
  const outBuffer = this.parent.pageSettings.pageSize - Math.ceil(this.parent.pageSettings.pageSize / 2);
13181
13208
  const content = this.parent.getContent().querySelector('.e-content');
13182
13209
  const scrollHeight = outBuffer * rowHeight;
13183
- const upScroll = (scrollArgs.offset.top - this.translateY) < 0;
13210
+ const upScroll = (scrollArgs.offset.top - this.translateY) <= 0;
13184
13211
  const downScroll = Math.ceil(scrollArgs.offset.top - this.translateY) + rowHeight >= scrollHeight;
13185
13212
  const selectedRowIndex = 'selectedRowIndex';
13186
13213
  const currentViewData = this.parent.currentViewData;
@@ -13192,7 +13219,8 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13192
13219
  + Math.ceil(vHeight / rowHeight))
13193
13220
  - this.parent.pageSettings.pageSize;
13194
13221
  index = (index > 0) ? index : 0;
13195
- if (!isNullOrUndefined(this[`${selectedRowIndex}`]) && this[`${selectedRowIndex}`] !== -1 && index !== this[`${selectedRowIndex}`]) {
13222
+ if (!isNullOrUndefined(this[`${selectedRowIndex}`]) && this[`${selectedRowIndex}`] !== -1 && index !== this[`${selectedRowIndex}`] &&
13223
+ ((this.parent.rowHeight * this.parent.pageSettings.pageSize) < content.scrollTop)) {
13196
13224
  index = this[`${selectedRowIndex}`];
13197
13225
  }
13198
13226
  this.startIndex = index;
@@ -13618,6 +13646,11 @@ class VirtualScroll {
13618
13646
  }
13619
13647
  }
13620
13648
  //}
13649
+ if (this.prevrequestType === 'collapseAll' && pageingDetails.actionArgs.requestType === 'virtualscroll') {
13650
+ startIndex = 0;
13651
+ endIndex = this.parent.grid.pageSettings.pageSize - 1;
13652
+ this.parent.grid.notify(virtualActionArgs, { setTop: true });
13653
+ }
13621
13654
  if ((this.parent.enableCollapseAll || this.parent.expandStateMapping) && !isNullOrUndefined(this.expandCollapseRec)) {
13622
13655
  if (pageingDetails.count < this.parent.getRows()[0].getBoundingClientRect().height) {
13623
13656
  startIndex = 0;
@@ -13636,6 +13669,7 @@ class VirtualScroll {
13636
13669
  }
13637
13670
  this.prevstartIndex = startIndex;
13638
13671
  this.prevendIndex = endIndex;
13672
+ this.prevrequestType = pageingDetails.actionArgs.requestType;
13639
13673
  }
13640
13674
  this.parent.notify('updateAction', pageingDetails);
13641
13675
  }