@syncfusion/ej2-treegrid 25.2.5 → 26.1.35

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.
Files changed (103) hide show
  1. package/.eslintrc.json +3 -2
  2. package/dist/ej2-treegrid.min.js +2 -2
  3. package/dist/ej2-treegrid.umd.min.js +2 -2
  4. package/dist/ej2-treegrid.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-treegrid.es2015.js +629 -464
  6. package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
  7. package/dist/es6/ej2-treegrid.es5.js +929 -763
  8. package/dist/es6/ej2-treegrid.es5.js.map +1 -1
  9. package/dist/global/ej2-treegrid.min.js +2 -2
  10. package/dist/global/ej2-treegrid.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +10 -10
  13. package/src/treegrid/actions/edit.js +8 -7
  14. package/src/treegrid/actions/excel-export.js +4 -3
  15. package/src/treegrid/actions/page.js +4 -0
  16. package/src/treegrid/actions/rowdragdrop.js +17 -11
  17. package/src/treegrid/actions/selection.js +4 -1
  18. package/src/treegrid/base/constant.d.ts +2 -0
  19. package/src/treegrid/base/constant.js +2 -0
  20. package/src/treegrid/base/data.js +2 -1
  21. package/src/treegrid/base/interface.js +0 -1
  22. package/src/treegrid/base/treegrid-model.d.ts +1 -1
  23. package/src/treegrid/base/treegrid.d.ts +3 -0
  24. package/src/treegrid/base/treegrid.js +230 -62
  25. package/src/treegrid/renderer/render.js +3 -1
  26. package/src/treegrid/renderer/virtual-row-model-generator.js +2 -2
  27. package/src/treegrid/renderer/virtual-tree-content-render.js +2 -1
  28. package/styles/bootstrap-dark.css +76 -48
  29. package/styles/bootstrap-dark.scss +18 -1
  30. package/styles/bootstrap.css +76 -49
  31. package/styles/bootstrap.scss +18 -1
  32. package/styles/bootstrap4.css +77 -48
  33. package/styles/bootstrap4.scss +18 -1
  34. package/styles/bootstrap5-dark.css +77 -49
  35. package/styles/bootstrap5-dark.scss +18 -1
  36. package/styles/bootstrap5.css +77 -49
  37. package/styles/bootstrap5.scss +18 -1
  38. package/styles/fabric-dark.css +74 -47
  39. package/styles/fabric-dark.scss +18 -1
  40. package/styles/fabric.css +74 -47
  41. package/styles/fabric.scss +18 -1
  42. package/styles/fluent-dark.css +77 -49
  43. package/styles/fluent-dark.scss +18 -1
  44. package/styles/fluent.css +77 -49
  45. package/styles/fluent.scss +18 -1
  46. package/styles/fluent2.css +1721 -0
  47. package/styles/fluent2.scss +18 -0
  48. package/styles/highcontrast-light.css +74 -47
  49. package/styles/highcontrast-light.scss +18 -1
  50. package/styles/highcontrast.css +74 -47
  51. package/styles/highcontrast.scss +18 -1
  52. package/styles/material-dark.css +111 -54
  53. package/styles/material-dark.scss +18 -1
  54. package/styles/material.css +125 -57
  55. package/styles/material.scss +18 -1
  56. package/styles/material3-dark.css +111 -56
  57. package/styles/material3-dark.scss +18 -1
  58. package/styles/material3.css +111 -56
  59. package/styles/material3.scss +18 -1
  60. package/styles/tailwind-dark.css +87 -51
  61. package/styles/tailwind-dark.scss +18 -1
  62. package/styles/tailwind.css +87 -51
  63. package/styles/tailwind.scss +18 -1
  64. package/styles/treegrid/_bds-definition.scss +0 -4
  65. package/styles/treegrid/_bootstrap-dark-definition.scss +0 -1
  66. package/styles/treegrid/_bootstrap-definition.scss +0 -1
  67. package/styles/treegrid/_bootstrap4-definition.scss +0 -1
  68. package/styles/treegrid/_bootstrap5-definition.scss +0 -4
  69. package/styles/treegrid/_bootstrap5.3-definition.scss +24 -0
  70. package/styles/treegrid/_fabric-dark-definition.scss +0 -1
  71. package/styles/treegrid/_fabric-definition.scss +0 -1
  72. package/styles/treegrid/_fluent-definition.scss +0 -4
  73. package/styles/treegrid/_fluent2-definition.scss +24 -0
  74. package/styles/treegrid/_fusionnew-definition.scss +0 -4
  75. package/styles/treegrid/_highcontrast-definition.scss +0 -1
  76. package/styles/treegrid/_highcontrast-light-definition.scss +0 -1
  77. package/styles/treegrid/_layout.scss +81 -85
  78. package/styles/treegrid/_material-dark-definition.scss +0 -1
  79. package/styles/treegrid/_material-definition.scss +0 -1
  80. package/styles/treegrid/_material3-definition.scss +0 -4
  81. package/styles/treegrid/_tailwind-definition.scss +0 -4
  82. package/styles/treegrid/bootstrap-dark.css +76 -48
  83. package/styles/treegrid/bootstrap.css +76 -49
  84. package/styles/treegrid/bootstrap4.css +77 -48
  85. package/styles/treegrid/bootstrap5-dark.css +77 -49
  86. package/styles/treegrid/bootstrap5.css +77 -49
  87. package/styles/treegrid/fabric-dark.css +74 -47
  88. package/styles/treegrid/fabric.css +74 -47
  89. package/styles/treegrid/fluent-dark.css +77 -49
  90. package/styles/treegrid/fluent.css +77 -49
  91. package/styles/treegrid/fluent2.css +1721 -0
  92. package/styles/treegrid/fluent2.scss +18 -0
  93. package/styles/treegrid/highcontrast-light.css +74 -47
  94. package/styles/treegrid/highcontrast.css +74 -47
  95. package/styles/treegrid/icons/_bootstrap5.3.scss +37 -0
  96. package/styles/treegrid/icons/_fluent2.scss +37 -0
  97. package/styles/treegrid/material-dark.css +111 -54
  98. package/styles/treegrid/material.css +125 -57
  99. package/styles/treegrid/material3-dark.css +111 -56
  100. package/styles/treegrid/material3.css +111 -56
  101. package/styles/treegrid/tailwind-dark.css +87 -51
  102. package/styles/treegrid/tailwind.css +87 -51
  103. package/CHANGELOG.md +0 -250
@@ -23,7 +23,7 @@ import { Event, Property, NotifyPropertyChanges, setValue, KeyboardEvents, L10n
23
23
  import { Column } from '../models/column';
24
24
  import { getNumberFormat } from '@syncfusion/ej2-grids';
25
25
  import { Freeze as FreezeColumn } from '@syncfusion/ej2-grids';
26
- import { RowDropSettings, getUid } from '@syncfusion/ej2-grids';
26
+ import { RowDropSettings, getUid, parentsUntil } from '@syncfusion/ej2-grids';
27
27
  import { LoadingIndicator } from '../models/loading-indicator';
28
28
  import { FilterSettings } from '../models/filter-settings';
29
29
  import { TextWrapSettings } from '../models/textwrap-settings';
@@ -184,6 +184,7 @@ var TreeGrid = /** @class */ (function (_super) {
184
184
  };
185
185
  /**
186
186
  * Exports the TreeGrid data to the specified URL using a POST request.
187
+ *
187
188
  * @param {string} url - Defines exporting url
188
189
  * @returns {void}
189
190
  */
@@ -214,6 +215,7 @@ var TreeGrid = /** @class */ (function (_super) {
214
215
  };
215
216
  /**
216
217
  * Sets the header text and other properties for an array of columns based on specified criteria.
218
+ *
217
219
  * @param {Column[]} columns - Defines array of columns
218
220
  * @param {string[]} include - Defines array of sting
219
221
  * @returns {Column[]} returns array of columns
@@ -300,6 +302,10 @@ var TreeGrid = /** @class */ (function (_super) {
300
302
  * @returns {void}
301
303
  */
302
304
  TreeGrid.prototype.sortByColumn = function (columnName, direction, isMultiSort) {
305
+ if (isNullOrUndefined(columnName) && isNullOrUndefined(direction)) {
306
+ var error = 'The provided value for the columnName and direction is undefined. Please ensure the columnName and direction contains string.';
307
+ this.trigger(events.actionFailure, { error: error });
308
+ }
303
309
  if (this.sortModule) {
304
310
  this.sortModule.sortColumn(columnName, direction, isMultiSort);
305
311
  }
@@ -360,21 +366,27 @@ var TreeGrid = /** @class */ (function (_super) {
360
366
  * @returns {void}
361
367
  */
362
368
  TreeGrid.prototype.reorderColumns = function (fromFName, toFName) {
369
+ if (isNullOrUndefined(fromFName) && isNullOrUndefined(toFName)) {
370
+ var error = 'The provided value for the fromFName and toFName is undefined. Please ensure the fromFName and toFName contains string.';
371
+ this.trigger(events.actionFailure, { error: error });
372
+ }
363
373
  this.grid.reorderColumns(fromFName, toFName);
364
374
  };
365
375
  TreeGrid.prototype.TreeGridLocale = function () {
366
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
367
- var locale = L10n.locale;
368
- var localeObject = {};
369
- setValue(this.locale, {}, localeObject);
370
- var gridLocale;
371
- gridLocale = {};
372
- gridLocale = getObject(this.locale, locale);
373
- var treeGridLocale;
374
- treeGridLocale = {};
375
- treeGridLocale = getObject(this.getModuleName(), gridLocale);
376
- setValue('grid', treeGridLocale, getObject(this.locale, localeObject));
377
- L10n.load(localeObject);
376
+ if (!isNullOrUndefined(this.locale)) {
377
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
378
+ var locale = L10n.locale;
379
+ var localeObject = {};
380
+ setValue(this.locale, {}, localeObject);
381
+ var gridLocale = void 0;
382
+ gridLocale = {};
383
+ gridLocale = getObject(this.locale, locale);
384
+ var treeGridLocale = void 0;
385
+ treeGridLocale = {};
386
+ treeGridLocale = getObject(this.getModuleName(), gridLocale);
387
+ setValue('grid', treeGridLocale, getObject(this.locale, localeObject));
388
+ L10n.load(localeObject);
389
+ }
378
390
  };
379
391
  /**
380
392
  * By default, prints all the pages of the TreeGrid and hides the pager.
@@ -421,45 +433,57 @@ var TreeGrid = /** @class */ (function (_super) {
421
433
  }
422
434
  break;
423
435
  case 'downArrow':
424
- if (!this.enableVirtualization) {
436
+ if (!this.enableVirtualization && isNullOrUndefined(this.rowTemplate)) {
425
437
  target = e.target;
426
- parentTarget = target.parentElement;
427
- if (!isNullOrUndefined(parentTarget)) {
428
- var cellIndex = parentTarget.cellIndex;
429
- if (this.grid.getColumnByIndex(cellIndex).editType === 'dropdownedit' && isNullOrUndefined(this.grid.getColumnByIndex(cellIndex).edit['obj'])) {
430
- parentTarget = target;
431
- }
432
- summaryElement = this.findnextRowElement(parentTarget);
433
- if (summaryElement !== null) {
434
- var cellIndex_1 = e.target.cellIndex;
435
- var row_1 = summaryElement.children[parseInt(cellIndex_1.toString(), 10)];
436
- addClass([row_1], 'e-focused');
437
- addClass([row_1], 'e-focus');
438
- }
439
- else {
440
- this.clearSelection();
438
+ if (!isNullOrUndefined(target.querySelectorAll('.e-rowcell'))) {
439
+ target = parentsUntil(target, 'e-rowcell');
440
+ }
441
+ if (!isNullOrUndefined(target)) {
442
+ parentTarget = target.parentElement;
443
+ if (!isNullOrUndefined(parentTarget)) {
444
+ var cellIndex = parentTarget.cellIndex;
445
+ if (this.grid.getColumnByIndex(cellIndex).editType === 'dropdownedit' && isNullOrUndefined(this.grid.getColumnByIndex(cellIndex).edit['obj'])) {
446
+ parentTarget = target;
447
+ }
448
+ summaryElement = this.findnextRowElement(parentTarget);
449
+ if (summaryElement !== null) {
450
+ var cellIndex_1 = target.cellIndex;
451
+ var row_1 = summaryElement.children[parseInt(cellIndex_1.toString(), 10)];
452
+ addClass([row_1], 'e-focused');
453
+ addClass([row_1], 'e-focus');
454
+ }
455
+ else {
456
+ this.clearSelection();
457
+ }
441
458
  }
442
459
  }
443
460
  }
444
461
  break;
445
462
  case 'upArrow':
446
- if (!this.enableVirtualization) {
463
+ if (!this.enableVirtualization && isNullOrUndefined(this.rowTemplate)) {
447
464
  target = e.target;
448
- parentTarget = target.parentElement;
449
- if (!isNullOrUndefined(parentTarget)) {
450
- var cellIndex = parentTarget.cellIndex;
451
- if (this.grid.getColumnByIndex(cellIndex).editType === 'dropdownedit' && isNullOrUndefined(this.grid.getColumnByIndex(cellIndex).edit['obj'])) {
452
- parentTarget = target;
453
- }
454
- summaryElement = this.findPreviousRowElement(parentTarget);
455
- if (summaryElement !== null) {
456
- var cIndex = e.target.cellIndex;
457
- var rows = summaryElement.children[parseInt(cIndex.toString(), 10)];
458
- addClass([rows], 'e-focused');
459
- addClass([rows], 'e-focus');
460
- }
461
- else {
462
- this.clearSelection();
465
+ if (!isNullOrUndefined(target.querySelectorAll('.e-rowcell'))) {
466
+ target = parentsUntil(target, 'e-rowcell');
467
+ }
468
+ if (!isNullOrUndefined(target)) {
469
+ parentTarget = target.parentElement;
470
+ if (!isNullOrUndefined(parentTarget)) {
471
+ var cellIndex = parentTarget.cellIndex;
472
+ if (this.grid.getColumnByIndex(cellIndex).editType === 'dropdownedit' && isNullOrUndefined(this.grid.getColumnByIndex(cellIndex).edit['obj'])) {
473
+ parentTarget = target;
474
+ }
475
+ summaryElement = this.findPreviousRowElement(parentTarget);
476
+ if (summaryElement !== null) {
477
+ var cellIndex_2 = target.cellIndex;
478
+ if (!isNullOrUndefined(cellIndex_2)) {
479
+ var row_2 = summaryElement.children[parseInt(cellIndex_2.toString(), 10)];
480
+ addClass([row_2], 'e-focused');
481
+ addClass([row_2], 'e-focus');
482
+ }
483
+ }
484
+ else {
485
+ this.clearSelection();
486
+ }
463
487
  }
464
488
  }
465
489
  }
@@ -653,7 +677,7 @@ var TreeGrid = /** @class */ (function (_super) {
653
677
  name: 'Edit'
654
678
  });
655
679
  }
656
- if (this.isCommandColumn(this.columns)) {
680
+ if (!isNullOrUndefined(this.columns) && this.isCommandColumn(this.columns)) {
657
681
  modules.push({
658
682
  member: 'commandColumn',
659
683
  args: [this],
@@ -786,6 +810,7 @@ var TreeGrid = /** @class */ (function (_super) {
786
810
  var root = 'root';
787
811
  this.grid["" + root] = this["" + root] ? this["" + root] : this;
788
812
  this.grid.appendTo(gridContainer);
813
+ this.actionFailureHandler();
789
814
  var gridContent = this.element.getElementsByClassName('e-gridcontent')[0].childNodes[0];
790
815
  gridContent.setAttribute('tabindex', '0');
791
816
  var contentTable = this.element.getElementsByClassName('e-content')[0].querySelector('.e-table');
@@ -808,6 +833,85 @@ var TreeGrid = /** @class */ (function (_super) {
808
833
  }
809
834
  };
810
835
  };
836
+ TreeGrid.prototype.actionFailureHandler = function () {
837
+ var _this = this;
838
+ var failureCases = [];
839
+ var primaryKeyFieldNames = this.getPrimaryKeyFieldNames();
840
+ var RecordsCount = this.flatData.length;
841
+ if ((this.editSettings.allowAdding || this.editSettings.allowDeleting || this.editSettings.allowEditing)
842
+ && primaryKeyFieldNames.length === 0 && RecordsCount !== 0) {
843
+ failureCases.push('For the CRUD actions, it is necessary to enable Primary Key field for the unique data column.');
844
+ }
845
+ if (this.allowRowDragAndDrop && primaryKeyFieldNames.length === 0 && RecordsCount !== 0) {
846
+ failureCases.push('For the Row Drag and Drop actions, it is necessary to enable Primary Key field for the unique data column.');
847
+ }
848
+ if (this.allowPaging && this.enableVirtualization) {
849
+ failureCases.push('Paging is not allowed in virtualization case.');
850
+ }
851
+ if (RecordsCount === 0 && this.columns.length === 0) {
852
+ failureCases.push('Either of the Data source or columns should be given.');
853
+ }
854
+ if (this.frozenColumns > 0 && this.columnModel.filter(function (col) { return col.isFrozen; })) {
855
+ failureCases.push('Use only one attribute for Frozen either IsFrozen or FrozenColumns.');
856
+ }
857
+ if (this.enableVirtualization && !isNullOrUndefined(this.detailTemplate)) {
858
+ failureCases.push('Virtual scrolling is not compatible with the detail template');
859
+ }
860
+ if (this.stackedHeader && !isNullOrUndefined(this.detailTemplate)) {
861
+ failureCases.push('Virtual scrolling is not compatible with the detail template');
862
+ }
863
+ if ((this.frozenColumns > 0 || this.columnModel.filter(function (col) { return col.isFrozen; }) || this.frozenRows > 0)
864
+ && (!isNullOrUndefined(this.detailTemplate) || !isNullOrUndefined(this.rowTemplate))) {
865
+ failureCases.push('Frozen rows and columns are not supported with the Detail template and row template.');
866
+ }
867
+ if ((this.frozenColumns > 0 || this.columnModel.filter(function (col) { return col.isFrozen; }).length > 0 || this.frozenRows > 0) && this.editSettings.mode === 'Cell') {
868
+ failureCases.push('Frozen rows and columns are not supported with cell editing.');
869
+ }
870
+ if (this.allowSelection && !isNullOrUndefined(this.rowTemplate)) {
871
+ failureCases.push('Selection is not supported in RowTemplate');
872
+ }
873
+ if (this.treeColumnIndex < 0) {
874
+ failureCases.push('For showing tree structure it is must to set the TreeColumnIndex value.');
875
+ }
876
+ if (this.treeColumnIndex >= this.columns.length) {
877
+ failureCases.push('TreeColumnIndex value should not exceed the total column count.');
878
+ }
879
+ if (this.enableVirtualization && (!/[0-9]$/.test(this.columnModel.filter(function (col) { return col.width; }).toString())
880
+ && !/[px]$/.test(this.columnModel.filter(function (col) { return col.width; }).toString()))
881
+ || (/[0-9]$/.test(this.height.toString()) && /[px]$/.test(this.height.toString()))) {
882
+ failureCases.push('column width and height should be in pixels');
883
+ }
884
+ if (!isNullOrUndefined(this.childMapping) && !isNullOrUndefined(this.idMapping)) {
885
+ failureCases.push('Both IdMapping and ChildMapping should not be used together for tree grid rendering.');
886
+ }
887
+ if ((!isNullOrUndefined(this.idMapping) && (isNullOrUndefined(this.parentIdMapping))) ||
888
+ ((isNullOrUndefined(this.idMapping) && (!isNullOrUndefined(this.parentIdMapping))))) {
889
+ failureCases.push('IdMapping and ParentIdMapping properties should be defined and vice versa.');
890
+ }
891
+ var checkboxColumn = this.columnModel.filter(function (col) { return col.showCheckbox; });
892
+ var treeColumn = this.columns[this.treeColumnIndex];
893
+ if (checkboxColumn.length !== 0) {
894
+ if (checkboxColumn !== treeColumn) {
895
+ failureCases.push('ShowCheckbox column should not be defined other than the tree column.');
896
+ }
897
+ if (checkboxColumn.length > 1) {
898
+ failureCases.push('Only one column can have the ShowCheckbox option enabled.');
899
+ }
900
+ }
901
+ var alignColumn = this.columnModel.filter(function (col) { return col.textAlign === 'Right' && col.field === _this.columnModel[_this.treeColumnIndex].field; });
902
+ if (alignColumn.length !== 0) {
903
+ failureCases.push('TextAlign right for the tree column is not applicable.');
904
+ }
905
+ if (failureCases.length > 0) {
906
+ var failureEventArgs_1 = {
907
+ error: {}
908
+ };
909
+ failureCases.forEach(function (failureCase, index) {
910
+ failureEventArgs_1.error[parseInt(index.toString(), 10)] = failureCase;
911
+ });
912
+ this.trigger(events.actionFailure, failureEventArgs_1);
913
+ }
914
+ };
811
915
  TreeGrid.prototype.refreshToolbarItems = function () {
812
916
  var toolbarElement = this.toolbarModule.getToolbar();
813
917
  var indentID = this.element.id + '_gridcontrol_indent';
@@ -1019,7 +1123,9 @@ var TreeGrid = /** @class */ (function (_super) {
1019
1123
  }
1020
1124
  };
1021
1125
  this.grid.printComplete = this.triggerEvents.bind(this);
1022
- this.grid.actionFailure = this.triggerEvents.bind(this);
1126
+ this.grid.actionFailure = function (args) {
1127
+ _this.trigger(events.actionFailure, args);
1128
+ };
1023
1129
  this.extendedGridDataBoundEvent();
1024
1130
  this.extendedGridEvents();
1025
1131
  this.extendedGridActionEvents();
@@ -2132,6 +2238,10 @@ var TreeGrid = /** @class */ (function (_super) {
2132
2238
  * @returns {void}
2133
2239
  */
2134
2240
  TreeGrid.prototype.deleteRecord = function (fieldName, data) {
2241
+ if ((isNullOrUndefined(fieldName) && (isNullOrUndefined(data)) || (this.getSelectedRecords().length <= 0))) {
2242
+ var error = 'The provided value for the fieldName and data is undefined. Please ensure the fieldName and data contains number.';
2243
+ this.trigger(events.actionFailure, { error: error });
2244
+ }
2135
2245
  if (this.grid.editModule) {
2136
2246
  this.grid.editModule.deleteRecord(fieldName, data);
2137
2247
  }
@@ -2200,6 +2310,10 @@ var TreeGrid = /** @class */ (function (_super) {
2200
2310
  * @returns {void}
2201
2311
  */
2202
2312
  TreeGrid.prototype.deleteRow = function (tr) {
2313
+ if (isNullOrUndefined(tr)) {
2314
+ var error = 'The provided value for the tr is undefined. Please ensure the tr contains HTMLTableRowElement.';
2315
+ this.trigger(events.actionFailure, { error: error });
2316
+ }
2203
2317
  if (this.grid.editModule) {
2204
2318
  this.grid.editModule.deleteRow(tr);
2205
2319
  }
@@ -2225,9 +2339,11 @@ var TreeGrid = /** @class */ (function (_super) {
2225
2339
  this.grid.setCellValue(key, field, value);
2226
2340
  var rowIndex = this.grid.getRowIndexByPrimaryKey(key);
2227
2341
  var record = this.getCurrentViewRecords()[parseInt(rowIndex.toString(), 10)];
2228
- if (!isNullOrUndefined(record)) {
2229
- editAction({ value: record, action: 'edit' }, this, this.isSelfReference, record.index, this.grid.selectedRowIndex, field);
2342
+ if (isNullOrUndefined(record)) {
2343
+ var error = 'The provided value for the record is undefined. Please ensure the record contains ITreeData.';
2344
+ this.trigger(events.actionFailure, { error: error });
2230
2345
  }
2346
+ editAction({ value: record, action: 'edit' }, this, this.isSelfReference, record.index, this.grid.selectedRowIndex, field);
2231
2347
  };
2232
2348
  /**
2233
2349
  * Updates and refresh the particular row values based on the given primary key value.
@@ -2278,6 +2394,10 @@ var TreeGrid = /** @class */ (function (_super) {
2278
2394
  * @returns {void}
2279
2395
  */
2280
2396
  TreeGrid.prototype.goToPage = function (pageNo) {
2397
+ if (isNullOrUndefined(pageNo)) {
2398
+ var error = 'The provided value for the pageNo is undefined. Please ensure the pageNo contains number.';
2399
+ this.trigger(events.actionFailure, { error: error });
2400
+ }
2281
2401
  if (this.grid.pagerModule) {
2282
2402
  this.grid.pagerModule.goToPage(pageNo);
2283
2403
  }
@@ -2379,6 +2499,10 @@ var TreeGrid = /** @class */ (function (_super) {
2379
2499
  * @returns {void}
2380
2500
  */
2381
2501
  TreeGrid.prototype.hideColumns = function (keys, hideBy) {
2502
+ if (isNullOrUndefined(keys)) {
2503
+ var error = 'The provided value for the keys is undefined. Please ensure the keys contains string.';
2504
+ this.trigger(events.actionFailure, { error: error });
2505
+ }
2382
2506
  this.grid.hideColumns(keys, hideBy);
2383
2507
  this.updateColumnModel();
2384
2508
  };
@@ -2476,10 +2600,10 @@ var TreeGrid = /** @class */ (function (_super) {
2476
2600
  if (this.grid.columns.length !== this.columnModel.length) {
2477
2601
  this.stackedHeader = true;
2478
2602
  }
2479
- if (this.stackedHeader && this.allowResizing) {
2603
+ if (this.stackedHeader && this.allowResizing && !isNullOrUndefined(this.columns)) {
2480
2604
  this.updateColumnsWidth(this.columns);
2481
2605
  }
2482
- if (!this.stackedHeader) {
2606
+ if (!this.stackedHeader && !isNullOrUndefined(this.columns)) {
2483
2607
  merge(this.columns, this.columnModel);
2484
2608
  }
2485
2609
  this["" + deepMerge] = undefined; // Workaround for blazor updateModel
@@ -2488,10 +2612,10 @@ var TreeGrid = /** @class */ (function (_super) {
2488
2612
  TreeGrid.prototype.updateColumnsWidth = function (columns) {
2489
2613
  var _this = this;
2490
2614
  columns.forEach(function (column) {
2491
- if (column.columns) {
2615
+ if (!isNullOrUndefined(column) && column.columns) {
2492
2616
  _this.updateColumnsWidth(column.columns);
2493
2617
  }
2494
- else if (column.field) {
2618
+ else if (!isNullOrUndefined(column) && column.field) {
2495
2619
  var currentColumn = _this.grid.getColumnByField(column.field);
2496
2620
  if (!isNullOrUndefined(currentColumn)) {
2497
2621
  column.width = currentColumn.width;
@@ -2796,6 +2920,10 @@ var TreeGrid = /** @class */ (function (_super) {
2796
2920
  */
2797
2921
  TreeGrid.prototype.expandRow = function (row, record, key, level) {
2798
2922
  var _this = this;
2923
+ if (isNullOrUndefined(row) && isNullOrUndefined(record) && isNullOrUndefined(key) && isNullOrUndefined(level)) {
2924
+ var error = 'The provided value for the row is undefined. Please ensure the row contains row element.';
2925
+ this.trigger(events.actionFailure, { error: error });
2926
+ }
2799
2927
  var parentRec = this.parentData;
2800
2928
  if (!this.enableVirtualization) {
2801
2929
  parentRec = this.flatData.filter(function (e) {
@@ -2819,13 +2947,13 @@ var TreeGrid = /** @class */ (function (_super) {
2819
2947
  if (expandingArgs.expandAll) {
2820
2948
  _this.expandCollapseAllChildren(record, 'expand', key, level);
2821
2949
  }
2822
- _this.expandRows(row, record, parentRec, key, level);
2950
+ _this.expandRows(row, record, parentRec);
2823
2951
  }
2824
2952
  });
2825
2953
  }
2826
2954
  else if ((!this.allowPaging || (pagerValuePresent && this.grid.pagerModule.pagerObj.pagerdropdownModule['dropDownListObject'].value === 'All')) &&
2827
2955
  !this.expandAllPrevent && this.isExpandingEventTriggered) {
2828
- this.expandRows(row, record, parentRec, key, level);
2956
+ this.expandRows(row, record, parentRec);
2829
2957
  }
2830
2958
  this.isExpandingEventTriggered = true;
2831
2959
  }
@@ -2836,13 +2964,13 @@ var TreeGrid = /** @class */ (function (_super) {
2836
2964
  if (expandingArgs.expandAll) {
2837
2965
  _this.expandCollapseAllChildren(record, 'expand', key, level);
2838
2966
  }
2839
- _this.expandRows(row, record, parentRec, key, level);
2967
+ _this.expandRows(row, record, parentRec);
2840
2968
  }
2841
2969
  });
2842
2970
  }
2843
2971
  };
2844
2972
  // Internal method to handle the rows expand
2845
- TreeGrid.prototype.expandRows = function (row, record, parentRec, key, level) {
2973
+ TreeGrid.prototype.expandRows = function (row, record, parentRec) {
2846
2974
  this.expandCollapse('expand', row, record);
2847
2975
  var children = 'Children';
2848
2976
  if (!(isRemoteData(this) && !isOffline(this)) && (!isCountRequired(this) || !isNullOrUndefined(record["" + children]))) {
@@ -2913,6 +3041,10 @@ var TreeGrid = /** @class */ (function (_super) {
2913
3041
  */
2914
3042
  TreeGrid.prototype.collapseRow = function (row, record, key) {
2915
3043
  var _this = this;
3044
+ if (isNullOrUndefined(row) && isNullOrUndefined(record) && isNullOrUndefined(key)) {
3045
+ var error = 'The provided value for the row is undefined. Please ensure the row contains row element.';
3046
+ this.trigger(events.actionFailure, { error: error });
3047
+ }
2916
3048
  var parentRec = this.parentData;
2917
3049
  if (!this.enableVirtualization) {
2918
3050
  parentRec = this.flatData.filter(function (e) {
@@ -2929,12 +3061,12 @@ var TreeGrid = /** @class */ (function (_super) {
2929
3061
  if (collapsingArgs.collapseAll) {
2930
3062
  _this.expandCollapseAllChildren(record, 'collapse', key);
2931
3063
  }
2932
- _this.collapseRows(row, record, parentRec, key);
3064
+ _this.collapseRows(row, record, parentRec);
2933
3065
  }
2934
3066
  });
2935
3067
  }
2936
3068
  else if (!this.allowPaging && !this.collapseAllPrevent && this.isCollapsingEventTriggered) {
2937
- this.collapseRows(row, record, parentRec, key);
3069
+ this.collapseRows(row, record, parentRec);
2938
3070
  }
2939
3071
  this.isCollapsingEventTriggered = true;
2940
3072
  }
@@ -2942,13 +3074,13 @@ var TreeGrid = /** @class */ (function (_super) {
2942
3074
  var args = { data: record, row: row, cancel: false };
2943
3075
  this.trigger(events.collapsing, args, function (collapsingArgs) {
2944
3076
  if (!collapsingArgs.cancel && !isNullOrUndefined(record)) {
2945
- _this.collapseRows(row, record, parentRec, key);
3077
+ _this.collapseRows(row, record, parentRec);
2946
3078
  }
2947
3079
  });
2948
3080
  }
2949
3081
  };
2950
3082
  // Internal method for handling the rows collapse
2951
- TreeGrid.prototype.collapseRows = function (row, record, parentRec, key) {
3083
+ TreeGrid.prototype.collapseRows = function (row, record, parentRec) {
2952
3084
  this.expandCollapse('collapse', row, record);
2953
3085
  var collapseArgs = { data: record, row: row };
2954
3086
  if (!isRemoteData(this)) {
@@ -2992,6 +3124,10 @@ var TreeGrid = /** @class */ (function (_super) {
2992
3124
  * @returns {void}
2993
3125
  */
2994
3126
  TreeGrid.prototype.expandAtLevel = function (level) {
3127
+ if (isNullOrUndefined(level)) {
3128
+ var error = 'The provided value for the level is undefined. Please ensure the level contains number.';
3129
+ this.trigger(events.actionFailure, { error: error });
3130
+ }
2995
3131
  if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization) && !isRemoteData(this)) {
2996
3132
  var rec = this.grid.dataSource.filter(function (e) {
2997
3133
  if (e.hasChildRecords && e.level === level) {
@@ -3014,6 +3150,10 @@ var TreeGrid = /** @class */ (function (_super) {
3014
3150
  * @returns {void}
3015
3151
  */
3016
3152
  TreeGrid.prototype.expandByKey = function (key) {
3153
+ if (isNullOrUndefined(key)) {
3154
+ var error = 'The provided value for the key is undefined. Please ensure the key contains number.';
3155
+ this.trigger(events.actionFailure, { error: error });
3156
+ }
3017
3157
  this.expandCollapseActionByKey(key, 'Expand');
3018
3158
  };
3019
3159
  TreeGrid.prototype.expandAction = function (record, key, level, isPaging) {
@@ -3071,6 +3211,10 @@ var TreeGrid = /** @class */ (function (_super) {
3071
3211
  * @returns {void}
3072
3212
  */
3073
3213
  TreeGrid.prototype.collapseAtLevel = function (level) {
3214
+ if (isNullOrUndefined(level)) {
3215
+ var error = 'The provided value for the level is undefined. Please ensure the level contains number.';
3216
+ this.trigger(events.actionFailure, { error: error });
3217
+ }
3074
3218
  if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization) && !isRemoteData(this)) {
3075
3219
  var record = this.grid.dataSource.filter(function (e) {
3076
3220
  if (e.hasChildRecords && e.level === level) {
@@ -3093,6 +3237,10 @@ var TreeGrid = /** @class */ (function (_super) {
3093
3237
  * @returns {void}
3094
3238
  */
3095
3239
  TreeGrid.prototype.collapseByKey = function (key) {
3240
+ if (isNullOrUndefined(key)) {
3241
+ var error = 'The provided value for the key is undefined. Please ensure the key contains number.';
3242
+ this.trigger(events.actionFailure, { error: error });
3243
+ }
3096
3244
  this.expandCollapseActionByKey(key, 'Collapse');
3097
3245
  };
3098
3246
  TreeGrid.prototype.expandCollapseActionByKey = function (key, action) {
@@ -3133,6 +3281,10 @@ var TreeGrid = /** @class */ (function (_super) {
3133
3281
  * @returns {void}
3134
3282
  */
3135
3283
  TreeGrid.prototype.expandAll = function () {
3284
+ if (this.getCurrentViewRecords().length === 0) {
3285
+ var error = 'The provided value for the datasource is undefined. Please ensure to add the dataSource.';
3286
+ this.trigger(events.actionFailure, { error: error });
3287
+ }
3136
3288
  this.isExpandedEventTriggered = false;
3137
3289
  this.isExpandingEventTriggered = false;
3138
3290
  this.expandCollapseAll('expand');
@@ -3143,6 +3295,10 @@ var TreeGrid = /** @class */ (function (_super) {
3143
3295
  * @returns {void}
3144
3296
  */
3145
3297
  TreeGrid.prototype.collapseAll = function () {
3298
+ if (this.getCurrentViewRecords().length === 0) {
3299
+ var error = 'The provided value for the datasource is undefined. Please ensure to add the dataSource.';
3300
+ this.trigger(events.actionFailure, { error: error });
3301
+ }
3146
3302
  this.isCollapsedEventTriggered = false;
3147
3303
  this.isCollapsingEventTriggered = false;
3148
3304
  this.expandCollapseAll('collapse');
@@ -3702,6 +3858,10 @@ var TreeGrid = /** @class */ (function (_super) {
3702
3858
  * @returns {void}
3703
3859
  */
3704
3860
  TreeGrid.prototype.filterByColumn = function (fieldName, filterOperator, filterValue, predicate, matchCase, ignoreAccent, actualFilterValue, actualOperator) {
3861
+ if (isNullOrUndefined(fieldName) && isNullOrUndefined(filterOperator) && isNullOrUndefined(filterValue)) {
3862
+ var error = 'The provided value for the fieldName, filterOperator and filterValue are undefined. Please ensure the fieldName, filterOperator and filterValue.';
3863
+ this.trigger(events.actionFailure, { error: error });
3864
+ }
3705
3865
  this.grid.filterByColumn(fieldName, filterOperator, filterValue, predicate, matchCase, ignoreAccent, actualFilterValue, actualOperator);
3706
3866
  };
3707
3867
  /**
@@ -3768,6 +3928,10 @@ var TreeGrid = /** @class */ (function (_super) {
3768
3928
  * @returns {void}
3769
3929
  */
3770
3930
  TreeGrid.prototype.paste = function (data, rowIndex, colIndex) {
3931
+ if (isNullOrUndefined(data) && isNullOrUndefined(rowIndex) && isNullOrUndefined(colIndex)) {
3932
+ var error = 'The provided value for the index is undefined. Please ensure the index contains number.';
3933
+ this.trigger(events.actionFailure, { error: error });
3934
+ }
3771
3935
  this.clipboardModule.paste(data, rowIndex, colIndex);
3772
3936
  };
3773
3937
  /**
@@ -3979,7 +4143,7 @@ var TreeGrid = /** @class */ (function (_super) {
3979
4143
  * @returns {number} - Returns frozen column count
3980
4144
  */
3981
4145
  TreeGrid.prototype.getFrozenColumns = function () {
3982
- return this.getFrozenCount(this.columns, 0) + this.frozenColumns;
4146
+ return this.getFrozenCount(!isNullOrUndefined(this.columns) && this.columns, 0) + this.frozenColumns;
3983
4147
  };
3984
4148
  TreeGrid.prototype.getFrozenCount = function (cols, cnt) {
3985
4149
  for (var j = 0, len = cols.length; j < len; j++) {
@@ -4036,6 +4200,10 @@ var TreeGrid = /** @class */ (function (_super) {
4036
4200
  * @returns {void}
4037
4201
  */
4038
4202
  TreeGrid.prototype.reorderRows = function (fromIndexes, toIndex, position) {
4203
+ if (isNullOrUndefined(fromIndexes) && isNullOrUndefined(toIndex) && isNullOrUndefined(position)) {
4204
+ var error = 'The provided value for the fromIndexes, toIndex and position is undefined. Please ensure the fromIndexes and toIndex contains number and position contains string.';
4205
+ this.trigger(events.actionFailure, { error: error });
4206
+ }
4039
4207
  this.rowDragAndDropModule.reorderRows(fromIndexes, toIndex, position);
4040
4208
  };
4041
4209
  /**
@@ -357,7 +357,9 @@ var Render = /** @class */ (function () {
357
357
  && !isNullOrUndefined(rowsObj[parseInt(j.toString(), 10)].index)) {
358
358
  var cell = rowsObj[parseInt(j.toString(), 10)]["" + cells][parseInt(cellIndex.toString(), 10)];
359
359
  var cellRenderer = new CellRenderer(_this.parent.grid, _this.parent.grid.serviceLocator);
360
- var td = _this.parent.getCellFromIndex(rowsObj[parseInt(j.toString(), 10)].index, cellIndex - indent);
360
+ var td = rows.length >= rowsObj.length
361
+ ? _this.parent.getCellFromIndex(rowsObj[parseInt(j.toString(), 10)].index, cellIndex - indent)
362
+ : _this.parent.getRows()[rowsObj[parseInt(j.toString(), 10)].index].querySelector('.e-templatecell');
361
363
  cellRenderer.refreshTD(td, cell, rowsObj[parseInt(j.toString(), 10)].data, { index: rowsObj[parseInt(j.toString(), 10)]["" + rowIdx] });
362
364
  var treecell = _this.parent.getRows()[parseInt(j.toString(), 10)]
363
365
  .cells[parseInt(cellIndex.toString(), 10)];
@@ -70,8 +70,8 @@ var TreeVirtualRowModelGenerator = /** @class */ (function (_super) {
70
70
  var rows = _super.prototype.generateRows.call(this, data, notifyArgs);
71
71
  if (!isNullOrUndefined((this.visualData))) {
72
72
  for (var r = 0; r < rows.length; r++) {
73
- rows[parseInt(r.toString(), 10)].index =
74
- (this.visualData).indexOf(rows[parseInt(r.toString(), 10)].data);
73
+ rows[parseInt(r.toString(), 10)].index
74
+ = (this.visualData).indexOf(rows[parseInt(r.toString(), 10)].data);
75
75
  }
76
76
  }
77
77
  return rows;
@@ -52,6 +52,7 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
52
52
  VirtualTreeContentRenderer.prototype.getFrozenRightVirtualRowByIndex = function (index) {
53
53
  return this.getRowCollection(index, false, false, true);
54
54
  };
55
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
55
56
  VirtualTreeContentRenderer.prototype.getRowCollection = function (index, isMovable, isRowObject, isFrozenRight) {
56
57
  var startIdx = parseInt(this.parent.getRows()[0].getAttribute(literals.dataRowIndex), 10);
57
58
  var rowCollection = this.parent.getDataRows();
@@ -489,10 +490,10 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
489
490
  this.previousInfo = viewInfo;
490
491
  this.parent.setColumnIndexesInView(this.parent.enableColumnVirtualization ? viewInfo.columnIndexes : []);
491
492
  var page = viewInfo.loadNext && !viewInfo.loadSelf ? viewInfo.nextInfo.page : viewInfo.page;
493
+ this.parent.setProperties({ pageSettings: { currentPage: page } }, true);
492
494
  if (downScroll && this.endIndex === this.totalRecords && viewInfo.loadNext) {
493
495
  viewInfo.loadNext = false;
494
496
  }
495
- this.parent.setProperties({ pageSettings: { currentPage: page } }, true);
496
497
  this.requestType = 'virtualscroll';
497
498
  if (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left') {
498
499
  viewInfo.event = viewInfo.event === 'refresh-virtual-block' ? 'model-changed' : viewInfo.event;