@syncfusion/ej2-treegrid 26.1.35 → 26.1.39

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) {
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':
@@ -9831,14 +9842,19 @@ class ExcelExport {
9831
9842
  /* eslint-disable-next-line */
9832
9843
  isMultipleExport, workbook, isBlob, isCsv) {
9833
9844
  const dataSource = this.parent.dataSource;
9845
+ const data = new Data(this.parent.grid);
9834
9846
  const property = Object();
9835
9847
  setValue('isCsv', isCsv, property);
9836
9848
  setValue('cancel', false, property);
9837
9849
  if (!isNullOrUndefined(excelExportProperties)) {
9838
9850
  this.isCollapsedStatePersist = excelExportProperties.isCollapsedStatePersist;
9839
9851
  }
9840
- if (!isNullOrUndefined(excelExportProperties) && !isNullOrUndefined(excelExportProperties.dataSource)) {
9841
- if (!excelExportProperties.dataSource['dataSource']) {
9852
+ if (!isNullOrUndefined(excelExportProperties)) {
9853
+ if (!isNullOrUndefined(excelExportProperties.dataSource) && !excelExportProperties.dataSource['dataSource']) {
9854
+ return this.parent.grid.excelExportModule.Map(this.parent.grid, excelExportProperties, isMultipleExport, workbook, isCsv, isBlob);
9855
+ }
9856
+ if (excelExportProperties.exportType === 'CurrentPage') {
9857
+ excelExportProperties.dataSource = this.parent.getCurrentViewRecords();
9842
9858
  return this.parent.grid.excelExportModule.Map(this.parent.grid, excelExportProperties, isMultipleExport, workbook, isCsv, isBlob);
9843
9859
  }
9844
9860
  }
@@ -9849,6 +9865,11 @@ class ExcelExport {
9849
9865
  if (!this.isLocal()) {
9850
9866
  query = this.generateQuery(query);
9851
9867
  query.queries = this.parent.grid.getDataModule().generateQuery().queries;
9868
+ query = ExportHelper.getQuery(this.parent.grid, data);
9869
+ if (isNullOrUndefined(this.parent.filterModule)) {
9870
+ query.queries = query.queries.slice(1, 2);
9871
+ query.params = query.params.slice(0, 0);
9872
+ }
9852
9873
  setValue('query', query, property);
9853
9874
  }
9854
9875
  this.parent.trigger(beforeExcelExport, extend$1(property, excelExportProperties));
@@ -13012,6 +13033,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13012
13033
  rowSelectedEvent(args) {
13013
13034
  const rowSelected = 'rowSelected';
13014
13035
  super[`${rowSelected}`](args);
13036
+ this.parent.notify('virtualTransform', { requestType: 'transformChange' });
13015
13037
  }
13016
13038
  toSelectVirtualRow(args) {
13017
13039
  if (this.parent.isEdit) {
@@ -13180,7 +13202,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13180
13202
  const outBuffer = this.parent.pageSettings.pageSize - Math.ceil(this.parent.pageSettings.pageSize / 2);
13181
13203
  const content = this.parent.getContent().querySelector('.e-content');
13182
13204
  const scrollHeight = outBuffer * rowHeight;
13183
- const upScroll = (scrollArgs.offset.top - this.translateY) < 0;
13205
+ const upScroll = (scrollArgs.offset.top - this.translateY) <= 0;
13184
13206
  const downScroll = Math.ceil(scrollArgs.offset.top - this.translateY) + rowHeight >= scrollHeight;
13185
13207
  const selectedRowIndex = 'selectedRowIndex';
13186
13208
  const currentViewData = this.parent.currentViewData;
@@ -13192,7 +13214,8 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13192
13214
  + Math.ceil(vHeight / rowHeight))
13193
13215
  - this.parent.pageSettings.pageSize;
13194
13216
  index = (index > 0) ? index : 0;
13195
- if (!isNullOrUndefined(this[`${selectedRowIndex}`]) && this[`${selectedRowIndex}`] !== -1 && index !== this[`${selectedRowIndex}`]) {
13217
+ if (!isNullOrUndefined(this[`${selectedRowIndex}`]) && this[`${selectedRowIndex}`] !== -1 && index !== this[`${selectedRowIndex}`] &&
13218
+ ((this.parent.rowHeight * this.parent.pageSettings.pageSize) < content.scrollTop)) {
13196
13219
  index = this[`${selectedRowIndex}`];
13197
13220
  }
13198
13221
  this.startIndex = index;