@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 { Property, merge, ChildProperty, Collection, isNullOrUndefined, Browser, removeClass, addClass, getValue, createElement, setValue, extend as extend$1, Internationalization, getEnumValue, compile, L10n, EventHandler, KeyboardEvents, SanitizeHtmlHelper, Complex, Event, NotifyPropertyChanges, Component, closest, classList, setStyleAttribute, select, debounce, remove } from '@syncfusion/ej2-base';
2
- import { Grid, Logger as Logger$1, 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, Scroll, RowDD as RowDD$1, VirtualRowModelGenerator, Filter as Filter$1, ExcelExport as ExcelExport$1, PdfExport as PdfExport$1, Page as Page$1, Toolbar as Toolbar$1, calculateAggregate, Aggregate as Aggregate$1, Sort as Sort$1, ColumnMenu as ColumnMenu$1, ContextMenu as ContextMenu$1, resetRowIndex, Edit as Edit$1, CommandColumn as CommandColumn$1, DetailRow as DetailRow$1, Cell, VirtualContentRenderer, InterSectionObserver, getTransformValues, RenderType, VirtualHeaderRenderer, VirtualScroll as VirtualScroll$1, ColumnChooser as ColumnChooser$1, RowRenderer, InfiniteScroll as InfiniteScroll$1 } from '@syncfusion/ej2-grids';
2
+ import { Grid, Logger as Logger$1, 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, Scroll, RowDD as RowDD$1, VirtualRowModelGenerator, Filter as Filter$1, Data, ExportHelper, ExcelExport as ExcelExport$1, PdfExport as PdfExport$1, Page as Page$1, Toolbar as Toolbar$1, calculateAggregate, Aggregate as Aggregate$1, Sort as Sort$1, ColumnMenu as ColumnMenu$1, ContextMenu as ContextMenu$1, resetRowIndex, Edit as Edit$1, CommandColumn as CommandColumn$1, DetailRow as DetailRow$1, Cell, VirtualContentRenderer, InterSectionObserver, getTransformValues, RenderType, VirtualHeaderRenderer, VirtualScroll as VirtualScroll$1, ColumnChooser as ColumnChooser$1, RowRenderer, InfiniteScroll as InfiniteScroll$1 } 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';
@@ -2373,16 +2373,20 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2373
2373
  var clonequries = qry.queries.filter(function (e) { return e.fn !== 'onPage' && e.fn !== 'onWhere'; });
2374
2374
  qry.queries = clonequries;
2375
2375
  qry.isCountRequired = true;
2376
+ var idMappingValue = parseInt(rowDetails.record[this.parent.idMapping], 10);
2377
+ if (isNaN(idMappingValue)) {
2378
+ idMappingValue = rowDetails.record[this.parent.idMapping].toString();
2379
+ }
2376
2380
  if (this.parent.enableVirtualization && rowDetails.action === 'remoteExpand') {
2377
2381
  qry.take(this.parent.pageSettings.pageSize);
2378
2382
  var expandDetail = [];
2379
- expandDetail.push('ExpandingAction', parseInt(rowDetails.record[this.parent.idMapping], 10).toString());
2383
+ expandDetail.push('ExpandingAction', idMappingValue.toString());
2380
2384
  qry.expand(expandDetail);
2381
2385
  }
2382
2386
  else if (this.parent.enableVirtualization && rowDetails.action === 'collapse') {
2383
2387
  qry.take(this.parent.grid.pageSettings.pageSize);
2384
2388
  var expandDetail = [];
2385
- expandDetail.push('CollapsingAction', parseInt(rowDetails.record[this.parent.idMapping], 10).toString());
2389
+ expandDetail.push('CollapsingAction', idMappingValue.toString());
2386
2390
  qry.expand(expandDetail);
2387
2391
  }
2388
2392
  qry.where(this.parent.parentIdMapping, 'equal', rowDetails.record[this.parent.idMapping]);
@@ -4196,7 +4200,9 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4196
4200
  TreeGrid.prototype.requiredModules = function () {
4197
4201
  var modules = [];
4198
4202
  var splitFrozenCount = 'splitFrozenCount';
4199
- this.grid["" + splitFrozenCount](this.getColumns());
4203
+ if (!this.isReact && isNullOrUndefined(this['changedProperties'].columns)) {
4204
+ this.grid["" + splitFrozenCount](this.getColumns());
4205
+ }
4200
4206
  if (this.isDestroyed) {
4201
4207
  return modules;
4202
4208
  }
@@ -5441,6 +5447,11 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5441
5447
  TreeGrid.prototype.onPropertyChanged = function (newProp) {
5442
5448
  var properties = Object.keys(newProp);
5443
5449
  var requireRefresh = false;
5450
+ if (properties.indexOf('columns') > -1 && !isNullOrUndefined(newProp.columns)) {
5451
+ this.grid.columns = this.getGridColumns(newProp.columns);
5452
+ this.grid['updateColumnObject']();
5453
+ requireRefresh = true;
5454
+ }
5444
5455
  for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) {
5445
5456
  var prop = properties_1[_i];
5446
5457
  switch (prop) {
@@ -6559,6 +6570,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
6559
6570
  */
6560
6571
  TreeGrid.prototype.expandRow = function (row, record, key, level) {
6561
6572
  var _this = this;
6573
+ this.isCollapseAll = false;
6562
6574
  if (isNullOrUndefined(row) && isNullOrUndefined(record) && isNullOrUndefined(key) && isNullOrUndefined(level)) {
6563
6575
  var error = 'The provided value for the row is undefined. Please ensure the row contains row element.';
6564
6576
  this.trigger(actionFailure, { error: error });
@@ -6680,6 +6692,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
6680
6692
  */
6681
6693
  TreeGrid.prototype.collapseRow = function (row, record, key) {
6682
6694
  var _this = this;
6695
+ this.isExpandAll = false;
6683
6696
  if (isNullOrUndefined(row) && isNullOrUndefined(record) && isNullOrUndefined(key)) {
6684
6697
  var error = 'The provided value for the row is undefined. Please ensure the row contains row element.';
6685
6698
  this.trigger(actionFailure, { error: error });
@@ -6954,6 +6967,9 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
6954
6967
  return e.querySelector('.e-treegrid' + (action === 'expand' ? 'collapse' : 'expand'));
6955
6968
  });
6956
6969
  }
6970
+ if (!rows.length && this.getRows().length) {
6971
+ rows.push(this.getRows()[0]);
6972
+ }
6957
6973
  this.isExpandAll = true;
6958
6974
  this.isCollapseAll = true;
6959
6975
  if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization || this.enableInfiniteScrolling) && !isRemoteData(this)) {
@@ -10212,14 +10228,19 @@ var ExcelExport = /** @__PURE__ @class */ (function () {
10212
10228
  isMultipleExport, workbook, isBlob, isCsv) {
10213
10229
  var _this = this;
10214
10230
  var dataSource = this.parent.dataSource;
10231
+ var data = new Data(this.parent.grid);
10215
10232
  var property = Object();
10216
10233
  setValue('isCsv', isCsv, property);
10217
10234
  setValue('cancel', false, property);
10218
10235
  if (!isNullOrUndefined(excelExportProperties)) {
10219
10236
  this.isCollapsedStatePersist = excelExportProperties.isCollapsedStatePersist;
10220
10237
  }
10221
- if (!isNullOrUndefined(excelExportProperties) && !isNullOrUndefined(excelExportProperties.dataSource)) {
10222
- if (!excelExportProperties.dataSource['dataSource']) {
10238
+ if (!isNullOrUndefined(excelExportProperties)) {
10239
+ if (!isNullOrUndefined(excelExportProperties.dataSource) && !excelExportProperties.dataSource['dataSource']) {
10240
+ return this.parent.grid.excelExportModule.Map(this.parent.grid, excelExportProperties, isMultipleExport, workbook, isCsv, isBlob);
10241
+ }
10242
+ if (excelExportProperties.exportType === 'CurrentPage') {
10243
+ excelExportProperties.dataSource = this.parent.getCurrentViewRecords();
10223
10244
  return this.parent.grid.excelExportModule.Map(this.parent.grid, excelExportProperties, isMultipleExport, workbook, isCsv, isBlob);
10224
10245
  }
10225
10246
  }
@@ -10230,6 +10251,11 @@ var ExcelExport = /** @__PURE__ @class */ (function () {
10230
10251
  if (!_this.isLocal()) {
10231
10252
  query = _this.generateQuery(query);
10232
10253
  query.queries = _this.parent.grid.getDataModule().generateQuery().queries;
10254
+ query = ExportHelper.getQuery(_this.parent.grid, data);
10255
+ if (isNullOrUndefined(_this.parent.filterModule)) {
10256
+ query.queries = query.queries.slice(1, 2);
10257
+ query.params = query.params.slice(0, 0);
10258
+ }
10233
10259
  setValue('query', query, property);
10234
10260
  }
10235
10261
  _this.parent.trigger(beforeExcelExport, extend$1(property, excelExportProperties));
@@ -13441,6 +13467,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13441
13467
  VirtualTreeContentRenderer.prototype.rowSelectedEvent = function (args) {
13442
13468
  var rowSelected = 'rowSelected';
13443
13469
  _super.prototype["" + rowSelected].call(this, args);
13470
+ this.parent.notify('virtualTransform', { requestType: 'transformChange' });
13444
13471
  };
13445
13472
  VirtualTreeContentRenderer.prototype.toSelectVirtualRow = function (args) {
13446
13473
  if (this.parent.isEdit) {
@@ -13610,7 +13637,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13610
13637
  var outBuffer = this.parent.pageSettings.pageSize - Math.ceil(this.parent.pageSettings.pageSize / 2);
13611
13638
  var content = this.parent.getContent().querySelector('.e-content');
13612
13639
  var scrollHeight = outBuffer * rowHeight;
13613
- var upScroll = (scrollArgs.offset.top - this.translateY) < 0;
13640
+ var upScroll = (scrollArgs.offset.top - this.translateY) <= 0;
13614
13641
  var downScroll = Math.ceil(scrollArgs.offset.top - this.translateY) + rowHeight >= scrollHeight;
13615
13642
  var selectedRowIndex = 'selectedRowIndex';
13616
13643
  var currentViewData = this.parent.currentViewData;
@@ -13622,7 +13649,8 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13622
13649
  + Math.ceil(vHeight / rowHeight))
13623
13650
  - this.parent.pageSettings.pageSize;
13624
13651
  index = (index > 0) ? index : 0;
13625
- if (!isNullOrUndefined(this["" + selectedRowIndex]) && this["" + selectedRowIndex] !== -1 && index !== this["" + selectedRowIndex]) {
13652
+ if (!isNullOrUndefined(this["" + selectedRowIndex]) && this["" + selectedRowIndex] !== -1 && index !== this["" + selectedRowIndex] &&
13653
+ ((this.parent.rowHeight * this.parent.pageSettings.pageSize) < content.scrollTop)) {
13626
13654
  index = this["" + selectedRowIndex];
13627
13655
  }
13628
13656
  this.startIndex = index;
@@ -14067,6 +14095,11 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
14067
14095
  }
14068
14096
  }
14069
14097
  //}
14098
+ if (this.prevrequestType === 'collapseAll' && pageingDetails.actionArgs.requestType === 'virtualscroll') {
14099
+ startIndex = 0;
14100
+ endIndex = this.parent.grid.pageSettings.pageSize - 1;
14101
+ this.parent.grid.notify(virtualActionArgs, { setTop: true });
14102
+ }
14070
14103
  if ((this.parent.enableCollapseAll || this.parent.expandStateMapping) && !isNullOrUndefined(this.expandCollapseRec)) {
14071
14104
  if (pageingDetails.count < this.parent.getRows()[0].getBoundingClientRect().height) {
14072
14105
  startIndex = 0;
@@ -14085,6 +14118,7 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
14085
14118
  }
14086
14119
  this.prevstartIndex = startIndex;
14087
14120
  this.prevendIndex = endIndex;
14121
+ this.prevrequestType = pageingDetails.actionArgs.requestType;
14088
14122
  }
14089
14123
  this.parent.notify('updateAction', pageingDetails);
14090
14124
  };