@syncfusion/ej2-treegrid 19.3.48 → 19.4.38

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 (56) hide show
  1. package/.github/PULL_REQUEST_TEMPLATE/Bug.md +60 -0
  2. package/.github/PULL_REQUEST_TEMPLATE/feature.md +37 -0
  3. package/CHANGELOG.md +5 -38
  4. package/dist/ej2-treegrid.umd.min.js +2 -2
  5. package/dist/ej2-treegrid.umd.min.js.map +1 -1
  6. package/dist/es6/ej2-treegrid.es2015.js +204 -26
  7. package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
  8. package/dist/es6/ej2-treegrid.es5.js +218 -29
  9. package/dist/es6/ej2-treegrid.es5.js.map +1 -1
  10. package/dist/global/ej2-treegrid.min.js +2 -2
  11. package/dist/global/ej2-treegrid.min.js.map +1 -1
  12. package/dist/global/index.d.ts +1 -1
  13. package/package.json +9 -9
  14. package/src/treegrid/actions/batch-edit.js +5 -5
  15. package/src/treegrid/actions/edit.js +24 -5
  16. package/src/treegrid/actions/virtual-scroll.js +5 -0
  17. package/src/treegrid/base/data.js +3 -1
  18. package/src/treegrid/base/interface.d.ts +4 -0
  19. package/src/treegrid/base/treegrid-model.d.ts +16 -1
  20. package/src/treegrid/base/treegrid.d.ts +43 -2
  21. package/src/treegrid/base/treegrid.js +154 -18
  22. package/src/treegrid/models/column.d.ts +9 -0
  23. package/src/treegrid/models/column.js +19 -0
  24. package/src/treegrid/renderer/virtual-row-model-generator.js +6 -0
  25. package/src/treegrid/renderer/virtual-tree-content-render.js +4 -1
  26. package/styles/bootstrap-dark.css +5 -0
  27. package/styles/bootstrap.css +5 -0
  28. package/styles/bootstrap4.css +5 -0
  29. package/styles/bootstrap5-dark.css +32 -26
  30. package/styles/bootstrap5.css +32 -26
  31. package/styles/fabric-dark.css +5 -0
  32. package/styles/fabric.css +5 -0
  33. package/styles/highcontrast-light.css +5 -0
  34. package/styles/highcontrast.css +5 -0
  35. package/styles/material-dark.css +5 -0
  36. package/styles/material.css +5 -0
  37. package/styles/tailwind-dark.css +31 -26
  38. package/styles/tailwind.css +5 -0
  39. package/styles/treegrid/_bootstrap5-definition.scss +4 -4
  40. package/styles/treegrid/_fluent-definition.scss +31 -0
  41. package/styles/treegrid/_layout.scss +8 -0
  42. package/styles/treegrid/_tailwind-definition.scss +4 -4
  43. package/styles/treegrid/bootstrap-dark.css +5 -0
  44. package/styles/treegrid/bootstrap.css +5 -0
  45. package/styles/treegrid/bootstrap4.css +5 -0
  46. package/styles/treegrid/bootstrap5-dark.css +32 -26
  47. package/styles/treegrid/bootstrap5.css +32 -26
  48. package/styles/treegrid/fabric-dark.css +5 -0
  49. package/styles/treegrid/fabric.css +5 -0
  50. package/styles/treegrid/highcontrast-light.css +5 -0
  51. package/styles/treegrid/highcontrast.css +5 -0
  52. package/styles/treegrid/icons/_fluent.scss +26 -0
  53. package/styles/treegrid/material-dark.css +5 -0
  54. package/styles/treegrid/material.css +5 -0
  55. package/styles/treegrid/tailwind-dark.css +31 -26
  56. package/styles/treegrid/tailwind.css +5 -0
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 19.3.48
3
+ * version : 19.4.38
4
4
  * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-treegrid@*",
3
- "_id": "@syncfusion/ej2-treegrid@19.3.47",
3
+ "_id": "@syncfusion/ej2-treegrid@18.14.6",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-1qAa8qD3pixiqbAaV3Iqu5V6+3NzXa8G+EHL6QLhJF0fo/Fgj4DOuEUXSnQCy602s3YVzqSSPSAboKUvBNe4gg==",
5
+ "_integrity": "sha512-FF+bVQpk5aFcgaANgPCKaUlxd4OCgYruD3nQ/qGuuFVJ7C3hrvGE/hmg2lQqqJc8B9ny1ot/2LfXk0iY5BsSng==",
6
6
  "_location": "/@syncfusion/ej2-treegrid",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -24,8 +24,8 @@
24
24
  "/@syncfusion/ej2-react-treegrid",
25
25
  "/@syncfusion/ej2-vue-treegrid"
26
26
  ],
27
- "_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix/@syncfusion/ej2-treegrid/-/ej2-treegrid-19.3.47.tgz",
28
- "_shasum": "9d3509b03b5ef89e7c2517ecea267f4908255bb6",
27
+ "_resolved": "http://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-treegrid/-/ej2-treegrid-18.14.6.tgz",
28
+ "_shasum": "e9c2f8a7f15fa517e7ec122b609297bd7e1604b3",
29
29
  "_spec": "@syncfusion/ej2-treegrid@*",
30
30
  "_where": "/jenkins/workspace/automation_release_19.1.0.1-ZPMUBNQ6AUYH6YGEFBPVYMEQLRRW2SLD4XCZ6GATNZJFYJ3RIAOA/packages/included",
31
31
  "author": {
@@ -36,10 +36,10 @@
36
36
  },
37
37
  "bundleDependencies": false,
38
38
  "dependencies": {
39
- "@syncfusion/ej2-base": "~19.3.47",
40
- "@syncfusion/ej2-data": "~19.3.47",
41
- "@syncfusion/ej2-grids": "~19.3.48",
42
- "@syncfusion/ej2-popups": "~19.3.47"
39
+ "@syncfusion/ej2-base": "~19.4.38",
40
+ "@syncfusion/ej2-data": "~19.4.38",
41
+ "@syncfusion/ej2-grids": "~19.4.38",
42
+ "@syncfusion/ej2-popups": "~19.4.38"
43
43
  },
44
44
  "deprecated": false,
45
45
  "description": "Essential JS 2 TreeGrid Component",
@@ -60,6 +60,6 @@
60
60
  "url": "git+https://github.com/syncfusion/ej2-treegrid.git"
61
61
  },
62
62
  "typings": "index.d.ts",
63
- "version": "19.3.48",
63
+ "version": "19.4.38",
64
64
  "sideEffects": false
65
65
  }
@@ -404,11 +404,6 @@ var BatchEdit = /** @class */ (function () {
404
404
  var data = (this.parent.grid.dataSource instanceof DataManager ?
405
405
  this.parent.grid.dataSource.dataSource.json : this.parent.grid.dataSource);
406
406
  var primaryKey = this.parent.grid.getPrimaryKeyFieldNames()[0];
407
- if (!isNullOrUndefined(this.parent[targetElement])) {
408
- var row = this.parent[targetElement].closest('tr');
409
- this.parent.collapseRow(row);
410
- this.parent[targetElement] = null;
411
- }
412
407
  if (!isNullOrUndefined(this.batchAddedRecords)) {
413
408
  for (var i = 0; i < this.batchAddedRecords.length; i++) {
414
409
  index = data.map(function (e) { return e[primaryKey]; }).indexOf(this.batchAddedRecords[i][primaryKey]);
@@ -428,6 +423,11 @@ var BatchEdit = /** @class */ (function () {
428
423
  }
429
424
  }
430
425
  }
426
+ if (!isNullOrUndefined(this.parent[targetElement])) {
427
+ var row = this.parent[targetElement].closest('tr');
428
+ this.parent.collapseRow(row);
429
+ this.parent[targetElement] = null;
430
+ }
431
431
  if (!isNullOrUndefined(this.batchDeletedRecords)) {
432
432
  for (var i = 0; i < this.batchDeletedRecords.length; i++) {
433
433
  if (!isNullOrUndefined(this.batchDeletedRecords[i][parentItem])) {
@@ -712,14 +712,28 @@ var Edit = /** @class */ (function () {
712
712
  return;
713
713
  }
714
714
  if (args.requestType === 'delete') {
715
- var data = args.data;
716
- for (var i = 0; i < data.length; i++) {
717
- this.deleteUniqueID(data[i].uniqueID);
718
- var childs = findChildrenRecords(data[i]);
715
+ var data_1 = args.data;
716
+ if (isNullOrUndefined(args.data[0].uniqueID)) {
717
+ var primaryKeys_2 = this.parent.getPrimaryKeyFieldNames();
718
+ var _loop_1 = function (i) {
719
+ this_1.parent.flatData.filter(function (e) {
720
+ if (e[primaryKeys_2[0]] === args.data[i][primaryKeys_2[0]]) {
721
+ data_1[i] = e;
722
+ }
723
+ });
724
+ };
725
+ var this_1 = this;
726
+ for (var i = 0; i < data_1.length; i++) {
727
+ _loop_1(i);
728
+ }
729
+ }
730
+ for (var i = 0; i < data_1.length; i++) {
731
+ this.deleteUniqueID(data_1[i].uniqueID);
732
+ var childs = findChildrenRecords(data_1[i]);
719
733
  for (var c = 0; c < childs.length; c++) {
720
734
  this.deleteUniqueID(childs[c].uniqueID);
721
735
  }
722
- args.data = data.concat(childs);
736
+ args.data = args.data.concat(childs);
723
737
  }
724
738
  }
725
739
  if (args.requestType === 'add' || (this.isAddedRowByMethod && (this.parent.enableVirtualization || this.parent.enableInfiniteScrolling))) {
@@ -764,6 +778,7 @@ var Edit = /** @class */ (function () {
764
778
  }
765
779
  if (this.isAddedRowByMethod && args.index !== 0) {
766
780
  this.addRowRecord = this.parent.flatData[args.index];
781
+ this.addRowIndex = args.index;
767
782
  }
768
783
  if (this.parent.editSettings.newRowPosition === 'Child' && isNullOrUndefined(this.addRowRecord)
769
784
  && !isNullOrUndefined(this.parent.getSelectedRecords()[0])) {
@@ -792,6 +807,10 @@ var Edit = /** @class */ (function () {
792
807
  var position = null;
793
808
  value.taskData = isNullOrUndefined(value.taskData) ? extend({}, args.data) : value.taskData;
794
809
  var currentData = this.parent.grid.getCurrentViewRecords();
810
+ if (this.parent.enableVirtualization && args.index !== 0) {
811
+ this.addRowIndex = this.parent.grid.getCurrentViewRecords().indexOf(this.addRowRecord);
812
+ this.selectedIndex = parseInt(this.parent.getRows()[this.addRowIndex].getAttribute('aria-rowindex'), 10);
813
+ }
795
814
  var index = this.addRowIndex;
796
815
  value.uniqueID = getUid(this.parent.element.id + '_data_');
797
816
  setValue('uniqueIDCollection.' + value.uniqueID, value, this.parent);
@@ -123,6 +123,11 @@ var VirtualScroll = /** @class */ (function () {
123
123
  }
124
124
  //if ((this.prevendIndex !== -1 && this.prevstartIndex !== -1) &&
125
125
  //this.prevendIndex === endIndex && this.prevstartIndex === startIndex) {
126
+ if (!isNullOrUndefined(this.expandCollapseRec) && (pageingDetails.actionArgs.requestType === 'virtualscroll' ||
127
+ (pageingDetails.actionArgs.requestType === 'refresh' && startIndex !== this.prevstartIndex)) &&
128
+ (startIndex < this.parent.getRows().length && endIndex <= startIndex + this.parent.getRows().length)) {
129
+ startIndex = 0;
130
+ }
126
131
  if (!isNullOrUndefined(this.expandCollapseRec)) {
127
132
  var resourceCount = this.parent.getRows();
128
133
  var sIndex = visualData.indexOf(this.expandCollapseRec);
@@ -519,7 +519,9 @@ var DataManipulation = /** @class */ (function () {
519
519
  var query = getObject('query', args);
520
520
  var srtQry = new Query();
521
521
  for (var srt = this.parent.grid.sortSettings.columns.length - 1; srt >= 0; srt--) {
522
- var col = this.parent.grid.getColumnByField(this.parent.grid.sortSettings.columns[srt].field);
522
+ var getColumnByField = 'getColumnByField';
523
+ var col = this.parent.grid.renderModule.data[getColumnByField](this.parent.grid.
524
+ sortSettings.columns[srt].field);
523
525
  var compFun = col.sortComparer && isOffline(this.parent) ?
524
526
  col.sortComparer.bind(col) :
525
527
  this.parent.grid.sortSettings.columns[srt].direction;
@@ -128,6 +128,8 @@ export interface RowExpandingEventArgs {
128
128
  row?: HTMLTableRowElement;
129
129
  /** Cancel the row expanding action */
130
130
  cancel?: boolean;
131
+ /** Provides an option to ExpandAll the nested parent rows of the current row. */
132
+ expandAll?: boolean;
131
133
  }
132
134
  export interface RowCollapsedEventArgs {
133
135
  /**
@@ -150,6 +152,8 @@ export interface RowCollapsingEventArgs {
150
152
  row?: HTMLTableRowElement;
151
153
  /** Cancel the row collapsing action */
152
154
  cancel?: boolean;
155
+ /** Provides an option to CollapseAll the nested parent rows of the current row. */
156
+ collapseAll?: boolean;
153
157
  }
154
158
  export interface CellSaveEventArgs extends SaveEventArgs {
155
159
  /** Defines edited column */
@@ -1,4 +1,4 @@
1
- import { Component, addClass, createElement, EventHandler, isNullOrUndefined, Ajax, ModuleDeclaration, extend} from '@syncfusion/ej2-base';import { removeClass, EmitType, Complex, Collection, KeyboardEventArgs, getValue } from '@syncfusion/ej2-base';import {Event, Property, NotifyPropertyChanges, INotifyPropertyChanged, setValue, KeyboardEvents, L10n } from '@syncfusion/ej2-base';import { Column, ColumnModel } from '../models/column';import { BeforeBatchSaveArgs, BeforeBatchAddArgs, BatchDeleteArgs, BeforeBatchDeleteArgs } from '@syncfusion/ej2-grids';import { GridModel, ColumnQueryModeType, HeaderCellInfoEventArgs, EditSettingsModel as GridEditModel } from '@syncfusion/ej2-grids';import {RowDragEventArgs, RowDropEventArgs, RowDropSettingsModel, RowDropSettings, getUid } from '@syncfusion/ej2-grids';import { ActionEventArgs } from'@syncfusion/ej2-grids';import { DetailDataBoundEventArgs, ClipMode, ColumnChooser} from '@syncfusion/ej2-grids';import { SearchEventArgs, AddEventArgs, EditEventArgs, DeleteEventArgs} from '@syncfusion/ej2-grids';import { SaveEventArgs, CellSaveArgs, BatchAddArgs, BatchCancelArgs, BeginEditArgs, CellEditArgs} from '@syncfusion/ej2-grids';import { FilterSettings } from '../models/filter-settings';import { TextWrapSettings } from '../models/textwrap-settings';import { TextWrapSettingsModel } from '../models/textwrap-settings-model';import {Filter} from '../actions/filter';import { Logger as TreeLogger } from '../actions/logger';import { BeforeCopyEventArgs, BeforePasteEventArgs } from '@syncfusion/ej2-grids';import { TreeClipboard } from '../actions/clipboard';import {Aggregate} from '../actions/summary';import { Reorder } from '../actions/reorder';import { Resize } from '../actions/resize';import { Selection as TreeGridSelection } from '../actions/selection';import { ColumnMenu } from '../actions/column-menu';import { DetailRow } from '../actions/detail-row';import { Freeze } from '../actions/freeze-column';import { Print } from '../actions/print';import * as events from '../base/constant';import { FilterSettingsModel } from '../models/filter-settings-model';import { SearchSettings} from '../models/search-settings';import { SearchSettingsModel } from '../models/search-settings-model';import {RowInfo, RowDataBoundEventArgs, PageEventArgs, FilterEventArgs, FailureEventArgs, SortEventArgs } from '@syncfusion/ej2-grids';import { RowSelectingEventArgs, RowSelectEventArgs, RowDeselectEventArgs, IIndex, ISelectedCell } from '@syncfusion/ej2-grids';import {ColumnModel as GridColumnModel, Column as GridColumn, CellSelectEventArgs, CellDeselectEventArgs } from '@syncfusion/ej2-grids';import { SelectionSettings } from '../models/selection-settings';import { SelectionSettingsModel } from '../models/selection-settings-model';import {getActualProperties, SortDirection, getObject, ColumnDragEventArgs } from '@syncfusion/ej2-grids';import { PrintMode, Data, IGrid, ContextMenuItemModel } from '@syncfusion/ej2-grids';import { ColumnMenuItem, ColumnMenuItemModel, CheckBoxChangeEventArgs } from '@syncfusion/ej2-grids';import { ExcelExportCompleteArgs, ExcelHeaderQueryCellInfoEventArgs, ExcelQueryCellInfoEventArgs } from '@syncfusion/ej2-grids';import { PdfExportCompleteArgs, PdfHeaderQueryCellInfoEventArgs, PdfQueryCellInfoEventArgs } from '@syncfusion/ej2-grids';import { ExcelExportProperties, PdfExportProperties, CellSelectingEventArgs, PrintEventArgs } from '@syncfusion/ej2-grids';import { ColumnMenuOpenEventArgs } from '@syncfusion/ej2-grids';import {BeforeDataBoundArgs} from '@syncfusion/ej2-grids';import { DataManager, ReturnOption, RemoteSaveAdaptor, Query, JsonAdaptor, Deferred } from '@syncfusion/ej2-data';import { createSpinner, hideSpinner, showSpinner, Dialog } from '@syncfusion/ej2-popups';import { isRemoteData, isOffline, extendArray, isCountRequired, findChildrenRecords } from '../utils';import { Grid, QueryCellInfoEventArgs, Logger } from '@syncfusion/ej2-grids';import { Render } from '../renderer/render';import { VirtualTreeContentRenderer } from '../renderer/virtual-tree-content-render';import { DataManipulation } from './data';import { RowDD } from '../actions/rowdragdrop';import { Sort } from '../actions/sort';import { ITreeData, RowExpandedEventArgs, RowCollapsedEventArgs, RowCollapsingEventArgs, TreeGridExcelExportProperties } from './interface';import { CellSaveEventArgs, DataStateChangeEventArgs, RowExpandingEventArgs, TreeGridPdfExportProperties } from './interface';import { iterateArrayOrObject, GridLine } from '@syncfusion/ej2-grids';import { DataSourceChangedEventArgs, RecordDoubleClickEventArgs, ResizeArgs } from '@syncfusion/ej2-grids';import { ToolbarItems, ToolbarItem, ContextMenuItem, ContextMenuItems, RowPosition, CopyHierarchyType } from '../enum';import { ItemModel, ClickEventArgs, BeforeOpenCloseMenuEventArgs, MenuEventArgs } from '@syncfusion/ej2-navigations';import { PageSettings } from '../models/page-settings';import { PageSettingsModel } from '../models/page-settings-model';import { AggregateRow } from '../models/summary';import { AggregateRowModel } from '../models/summary-model';import { ExcelExport } from '../actions/excel-export';import { PdfExport } from '../actions/pdf-export';import { Toolbar } from '../actions/toolbar';import { Page } from '../actions/page';import { ContextMenu } from '../actions/context-menu';import { EditSettings } from '../models/edit-settings';import { EditSettingsModel } from '../models/edit-settings-model';import { Edit} from '../actions/edit';import { SortSettings } from '../models/sort-settings';import { SortSettingsModel } from '../models/sort-settings-model';import { isHidden } from '../utils';import { editAction } from '../actions/crud-actions';import { InfiniteScrollSettings } from '../models/infinite-scroll-settings';import { InfiniteScrollSettingsModel } from '../models/infinite-scroll-settings-model';
1
+ import { Component, addClass, createElement, EventHandler, isNullOrUndefined, Ajax, ModuleDeclaration, extend} from '@syncfusion/ej2-base';import { removeClass, EmitType, Complex, Collection, KeyboardEventArgs, getValue } from '@syncfusion/ej2-base';import {Event, Property, NotifyPropertyChanges, INotifyPropertyChanged, setValue, KeyboardEvents, L10n } from '@syncfusion/ej2-base';import { Column, ColumnModel } from '../models/column';import { BeforeBatchSaveArgs, BeforeBatchAddArgs, BatchDeleteArgs, BeforeBatchDeleteArgs, Row, CellRenderer, Cell } from '@syncfusion/ej2-grids';import { GridModel, ColumnQueryModeType, HeaderCellInfoEventArgs, EditSettingsModel as GridEditModel } from '@syncfusion/ej2-grids';import {RowDragEventArgs, RowDropEventArgs, RowDropSettingsModel, RowDropSettings, getUid } from '@syncfusion/ej2-grids';import { ActionEventArgs } from'@syncfusion/ej2-grids';import { DetailDataBoundEventArgs, ClipMode, ColumnChooser} from '@syncfusion/ej2-grids';import { SearchEventArgs, AddEventArgs, EditEventArgs, DeleteEventArgs} from '@syncfusion/ej2-grids';import { SaveEventArgs, CellSaveArgs, BatchAddArgs, BatchCancelArgs, BeginEditArgs, CellEditArgs} from '@syncfusion/ej2-grids';import { FilterSettings } from '../models/filter-settings';import { TextWrapSettings } from '../models/textwrap-settings';import { TextWrapSettingsModel } from '../models/textwrap-settings-model';import {Filter} from '../actions/filter';import { Logger as TreeLogger } from '../actions/logger';import { BeforeCopyEventArgs, BeforePasteEventArgs } from '@syncfusion/ej2-grids';import { TreeClipboard } from '../actions/clipboard';import {Aggregate} from '../actions/summary';import { Reorder } from '../actions/reorder';import { Resize } from '../actions/resize';import { Selection as TreeGridSelection } from '../actions/selection';import { ColumnMenu } from '../actions/column-menu';import { DetailRow } from '../actions/detail-row';import { Freeze } from '../actions/freeze-column';import { Print } from '../actions/print';import * as events from '../base/constant';import { FilterSettingsModel } from '../models/filter-settings-model';import { SearchSettings} from '../models/search-settings';import { SearchSettingsModel } from '../models/search-settings-model';import {RowInfo, RowDataBoundEventArgs, PageEventArgs, FilterEventArgs, FailureEventArgs, SortEventArgs } from '@syncfusion/ej2-grids';import { RowSelectingEventArgs, RowSelectEventArgs, RowDeselectEventArgs, IIndex, ISelectedCell } from '@syncfusion/ej2-grids';import {ColumnModel as GridColumnModel, Column as GridColumn, CellSelectEventArgs, CellDeselectEventArgs } from '@syncfusion/ej2-grids';import { SelectionSettings } from '../models/selection-settings';import { SelectionSettingsModel } from '../models/selection-settings-model';import {getActualProperties, SortDirection, getObject, ColumnDragEventArgs } from '@syncfusion/ej2-grids';import { PrintMode, Data, IGrid, ContextMenuItemModel } from '@syncfusion/ej2-grids';import { ColumnMenuItem, ColumnMenuItemModel, CheckBoxChangeEventArgs } from '@syncfusion/ej2-grids';import { ExcelExportCompleteArgs, ExcelHeaderQueryCellInfoEventArgs, ExcelQueryCellInfoEventArgs } from '@syncfusion/ej2-grids';import { PdfExportCompleteArgs, PdfHeaderQueryCellInfoEventArgs, PdfQueryCellInfoEventArgs } from '@syncfusion/ej2-grids';import { ExcelExportProperties, PdfExportProperties, CellSelectingEventArgs, PrintEventArgs } from '@syncfusion/ej2-grids';import { ColumnMenuOpenEventArgs } from '@syncfusion/ej2-grids';import {BeforeDataBoundArgs} from '@syncfusion/ej2-grids';import { DataManager, ReturnOption, RemoteSaveAdaptor, Query, JsonAdaptor, Deferred } from '@syncfusion/ej2-data';import { createSpinner, hideSpinner, showSpinner, Dialog } from '@syncfusion/ej2-popups';import { isRemoteData, isOffline, extendArray, isCountRequired, findChildrenRecords } from '../utils';import { Grid, QueryCellInfoEventArgs, Logger } from '@syncfusion/ej2-grids';import { Render } from '../renderer/render';import { VirtualTreeContentRenderer } from '../renderer/virtual-tree-content-render';import { DataManipulation } from './data';import { RowDD } from '../actions/rowdragdrop';import { Sort } from '../actions/sort';import { ITreeData, RowExpandedEventArgs, RowCollapsedEventArgs, RowCollapsingEventArgs, TreeGridExcelExportProperties } from './interface';import { CellSaveEventArgs, DataStateChangeEventArgs, RowExpandingEventArgs, TreeGridPdfExportProperties } from './interface';import { iterateArrayOrObject, GridLine } from '@syncfusion/ej2-grids';import { DataSourceChangedEventArgs, RecordDoubleClickEventArgs, ResizeArgs } from '@syncfusion/ej2-grids';import { ToolbarItems, ToolbarItem, ContextMenuItem, ContextMenuItems, RowPosition, CopyHierarchyType } from '../enum';import { ItemModel, ClickEventArgs, BeforeOpenCloseMenuEventArgs, MenuEventArgs } from '@syncfusion/ej2-navigations';import { PageSettings } from '../models/page-settings';import { PageSettingsModel } from '../models/page-settings-model';import { AggregateRow } from '../models/summary';import { AggregateRowModel } from '../models/summary-model';import { ExcelExport } from '../actions/excel-export';import { PdfExport } from '../actions/pdf-export';import { Toolbar } from '../actions/toolbar';import { Page } from '../actions/page';import { ContextMenu } from '../actions/context-menu';import { EditSettings } from '../models/edit-settings';import { EditSettingsModel } from '../models/edit-settings-model';import { Edit} from '../actions/edit';import { SortSettings } from '../models/sort-settings';import { SortSettingsModel } from '../models/sort-settings-model';import { isHidden, getExpandStatus } from '../utils';import { editAction } from '../actions/crud-actions';import { InfiniteScrollSettings } from '../models/infinite-scroll-settings';import { InfiniteScrollSettingsModel } from '../models/infinite-scroll-settings-model';
2
2
  import {ComponentModel} from '@syncfusion/ej2-base';
3
3
 
4
4
  /**
@@ -432,6 +432,21 @@ export interface TreeGridModel extends ComponentModel{
432
432
  */
433
433
  enableAutoFill?: boolean;
434
434
 
435
+ /**
436
+ * If `enableAdaptiveUI` is set to true, the pop-up UI will become adaptive to small screens,
437
+ * and be used for filtering and other features.
438
+ * ```html
439
+ * <div id='treegrid'></div>
440
+ * <script>
441
+ * var treegridObj = new TreeGrid({ enableAdaptiveUI: true });
442
+ * treegridObj.appendTo('#treegrid');
443
+ * </script>
444
+ * ```
445
+ *
446
+ * @default false
447
+ */
448
+ enableAdaptiveUI?: boolean;
449
+
435
450
  /**
436
451
  * If `enableImmutableMode` is set to true, the TreeGrid will reuse old rows if it exists in the new result instead of
437
452
  * full refresh while performing the TreeGrid actions.
@@ -540,6 +540,20 @@ export declare class TreeGrid extends Component<HTMLElement> implements INotifyP
540
540
  * @default false
541
541
  */
542
542
  enableAutoFill: boolean;
543
+ /**
544
+ * If `enableAdaptiveUI` is set to true, the pop-up UI will become adaptive to small screens,
545
+ * and be used for filtering and other features.
546
+ * ```html
547
+ * <div id='treegrid'></div>
548
+ * <script>
549
+ * var treegridObj = new TreeGrid({ enableAdaptiveUI: true });
550
+ * treegridObj.appendTo('#treegrid');
551
+ * </script>
552
+ * ```
553
+ *
554
+ * @default false
555
+ */
556
+ enableAdaptiveUI: boolean;
543
557
  /**
544
558
  * If `enableImmutableMode` is set to true, the TreeGrid will reuse old rows if it exists in the new result instead of
545
559
  * full refresh while performing the TreeGrid actions.
@@ -1514,6 +1528,12 @@ export declare class TreeGrid extends Component<HTMLElement> implements INotifyP
1514
1528
  */
1515
1529
  getColumns(isRefresh?: boolean): Column[];
1516
1530
  private updateColumnModel;
1531
+ /**
1532
+ * @param {string} columnUid - Defines column uid
1533
+ * @returns {void}
1534
+ * @hidden
1535
+ */
1536
+ private refreshReactColumnTemplateByUid;
1517
1537
  /**
1518
1538
  * Gets the content div of the TreeGrid.
1519
1539
  *
@@ -1658,9 +1678,12 @@ export declare class TreeGrid extends Component<HTMLElement> implements INotifyP
1658
1678
  *
1659
1679
  * @param {HTMLTableRowElement} row - Expands the given row
1660
1680
  * @param {Object} record - Expands the given record
1681
+ * @param {Object} key - Primary key value
1682
+ * @param {number} level - Specifies the hierarchical level of the record
1661
1683
  * @returns {void}
1662
1684
  */
1663
- expandRow(row: HTMLTableRowElement, record?: Object): void;
1685
+ expandRow(row: HTMLTableRowElement, record?: Object, key?: Object, level?: number): void;
1686
+ private expandCollapseAllChildren;
1664
1687
  private setHeightForFrozenContent;
1665
1688
  private getCollapseExpandRecords;
1666
1689
  /**
@@ -1668,9 +1691,10 @@ export declare class TreeGrid extends Component<HTMLElement> implements INotifyP
1668
1691
  *
1669
1692
  * @param {HTMLTableRowElement} row - Collapse the given row
1670
1693
  * @param {Object} record - Collapse the given record
1694
+ * @param {Object} key - Primary key value
1671
1695
  * @returns {void}
1672
1696
  */
1673
- collapseRow(row: HTMLTableRowElement, record?: Object): void;
1697
+ collapseRow(row: HTMLTableRowElement, record?: Object, key?: Object): void;
1674
1698
  /**
1675
1699
  * Expands the records at specific hierarchical level
1676
1700
  *
@@ -1678,6 +1702,14 @@ export declare class TreeGrid extends Component<HTMLElement> implements INotifyP
1678
1702
  * @returns {void}
1679
1703
  */
1680
1704
  expandAtLevel(level: number): void;
1705
+ /**
1706
+ * Expands the records by given primary key value
1707
+ *
1708
+ * @param {Object} key - Expands the parent rows with given primary key value
1709
+ * @returns {void}
1710
+ */
1711
+ expandByKey(key: Object): void;
1712
+ private expandAction;
1681
1713
  private getRecordDetails;
1682
1714
  /**
1683
1715
  * Collapses the records at specific hierarchical level
@@ -1686,6 +1718,15 @@ export declare class TreeGrid extends Component<HTMLElement> implements INotifyP
1686
1718
  * @returns {void}
1687
1719
  */
1688
1720
  collapseAtLevel(level: number): void;
1721
+ /**
1722
+ * Collapses the records by given primary key value
1723
+ *
1724
+ * @param {Object} key - Collapses the parent rows with given primary key value
1725
+ * @returns {void}
1726
+ */
1727
+ collapseByKey(key: Object): void;
1728
+ private expandCollapseActionByKey;
1729
+ private collapseAction;
1689
1730
  /**
1690
1731
  * Expands All the rows
1691
1732
  *
@@ -21,6 +21,7 @@ import { Component, addClass, createElement, EventHandler, isNullOrUndefined, ex
21
21
  import { removeClass, Complex, Collection, getValue } from '@syncfusion/ej2-base';
22
22
  import { Event, Property, NotifyPropertyChanges, setValue, KeyboardEvents, L10n } from '@syncfusion/ej2-base';
23
23
  import { Column } from '../models/column';
24
+ import { CellRenderer } from '@syncfusion/ej2-grids';
24
25
  import { RowDropSettings, getUid } from '@syncfusion/ej2-grids';
25
26
  import { FilterSettings } from '../models/filter-settings';
26
27
  import { TextWrapSettings } from '../models/textwrap-settings';
@@ -32,7 +33,7 @@ import * as events from '../base/constant';
32
33
  import { SearchSettings } from '../models/search-settings';
33
34
  import { SelectionSettings } from '../models/selection-settings';
34
35
  import { getActualProperties, getObject } from '@syncfusion/ej2-grids';
35
- import { DataManager, RemoteSaveAdaptor, JsonAdaptor, Deferred } from '@syncfusion/ej2-data';
36
+ import { DataManager, RemoteSaveAdaptor, Query, JsonAdaptor, Deferred } from '@syncfusion/ej2-data';
36
37
  import { createSpinner, hideSpinner, showSpinner } from '@syncfusion/ej2-popups';
37
38
  import { isRemoteData, isOffline, extendArray, isCountRequired, findChildrenRecords } from '../utils';
38
39
  import { Grid, Logger } from '@syncfusion/ej2-grids';
@@ -44,7 +45,7 @@ import { PageSettings } from '../models/page-settings';
44
45
  import { AggregateRow } from '../models/summary';
45
46
  import { EditSettings } from '../models/edit-settings';
46
47
  import { SortSettings } from '../models/sort-settings';
47
- import { isHidden } from '../utils';
48
+ import { isHidden, getExpandStatus } from '../utils';
48
49
  import { editAction } from '../actions/crud-actions';
49
50
  import { InfiniteScrollSettings } from '../models/infinite-scroll-settings';
50
51
  /**
@@ -674,6 +675,7 @@ var TreeGrid = /** @class */ (function (_super) {
674
675
  this.grid.allowResizing = this.allowResizing;
675
676
  this.grid.enableHover = this.enableHover;
676
677
  this.grid.enableAutoFill = this.enableAutoFill;
678
+ this.grid.enableAdaptiveUI = this.enableAdaptiveUI;
677
679
  this.grid.enableImmutableMode = this.enableImmutableMode;
678
680
  this.grid.allowRowDragAndDrop = this.allowRowDragAndDrop;
679
681
  this.grid.rowDropSettings = getActualProperties(this.rowDropSettings);
@@ -719,6 +721,15 @@ var TreeGrid = /** @class */ (function (_super) {
719
721
  _this.trigger(events.rowSelecting, args);
720
722
  };
721
723
  this.grid.rowSelected = function (args) {
724
+ if (_this.enableVirtualization && args.isHeaderCheckboxClicked &&
725
+ _this.grid.currentViewData.length !== _this.grid.selectionModule.selectedRowIndexes.length) {
726
+ var updateRowSelection = 'updateRowSelection';
727
+ for (var i = 0; i < _this.getRows().length; i++) {
728
+ if (_this.getRows()[i].getElementsByClassName('e-frame e-icons e-uncheck').length) {
729
+ _this.grid.selectionModule[updateRowSelection](_this.getRows()[i], _this.getCurrentViewRecords()[i].index);
730
+ }
731
+ }
732
+ }
722
733
  _this.selectedRowIndex = _this.grid.selectedRowIndex;
723
734
  _this.notify(events.rowSelected, args);
724
735
  _this.trigger(events.rowSelected, args);
@@ -1026,8 +1037,11 @@ var TreeGrid = /** @class */ (function (_super) {
1026
1037
  _this.notify('clearFilters', { flatData: _this.grid.dataSource });
1027
1038
  _this.grid.setProperties({ dataSource: _this.dataResults.result }, true);
1028
1039
  if (isNullOrUndefined(_this.grid['changedProperties'].dataSource)) {
1029
- _this.grid.renderModule.data.dataManager = _this.grid.dataSource instanceof DataManager ? _this.grid.dataSource :
1040
+ _this.grid.renderModule.data.dataManager = _this.grid.dataSource instanceof DataManager ?
1041
+ _this.grid.dataSource :
1030
1042
  (isNullOrUndefined(_this.grid.dataSource) ? new DataManager() : new DataManager(_this.grid.dataSource));
1043
+ _this.grid.renderModule.data.isQueryInvokedFromData = true;
1044
+ _this.grid.query = _this.grid.query instanceof Query ? _this.grid.query : new Query();
1031
1045
  }
1032
1046
  }
1033
1047
  var callBackPromise = new Deferred();
@@ -1477,6 +1491,9 @@ var TreeGrid = /** @class */ (function (_super) {
1477
1491
  case 'enableAutoFill':
1478
1492
  this.grid.enableAutoFill = this.enableAutoFill;
1479
1493
  break;
1494
+ case 'enableAdaptiveUI':
1495
+ this.grid.enableAdaptiveUI = this.enableAdaptiveUI;
1496
+ break;
1480
1497
  case 'enableImmutableMode':
1481
1498
  this.grid.enableImmutableMode = this.enableImmutableMode;
1482
1499
  break;
@@ -2073,6 +2090,32 @@ var TreeGrid = /** @class */ (function (_super) {
2073
2090
  this[merge] = undefined; // Workaround for blazor updateModel
2074
2091
  return this.columnModel;
2075
2092
  };
2093
+ /**
2094
+ * @param {string} columnUid - Defines column uid
2095
+ * @returns {void}
2096
+ * @hidden
2097
+ */
2098
+ TreeGrid.prototype.refreshReactColumnTemplateByUid = function (columnUid) {
2099
+ var _this = this;
2100
+ if (this.isReact) {
2101
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2102
+ this.clearTemplate(['columnTemplate'], undefined, function () {
2103
+ var cells = 'cells';
2104
+ var rowIdx = 'index';
2105
+ var rowsObj = _this.grid.getRowsObject();
2106
+ var indent = _this.grid.getIndentCount();
2107
+ var cellIndex = _this.grid.getNormalizedColumnIndex(columnUid);
2108
+ for (var j = 0; j < rowsObj.length; j++) {
2109
+ if (rowsObj[j].isDataRow && !isNullOrUndefined(rowsObj[j].index)) {
2110
+ var cell = rowsObj[j][cells][cellIndex];
2111
+ var cellRenderer = new CellRenderer(_this.grid, _this.grid.serviceLocator);
2112
+ var td = _this.getCellFromIndex(rowsObj[j].index, cellIndex - indent);
2113
+ cellRenderer.refreshTD(td, cell, rowsObj[j].data, { index: rowsObj[j][rowIdx] });
2114
+ }
2115
+ }
2116
+ });
2117
+ }
2118
+ };
2076
2119
  /**
2077
2120
  * Gets the content div of the TreeGrid.
2078
2121
  *
@@ -2342,9 +2385,11 @@ var TreeGrid = /** @class */ (function (_super) {
2342
2385
  *
2343
2386
  * @param {HTMLTableRowElement} row - Expands the given row
2344
2387
  * @param {Object} record - Expands the given record
2388
+ * @param {Object} key - Primary key value
2389
+ * @param {number} level - Specifies the hierarchical level of the record
2345
2390
  * @returns {void}
2346
2391
  */
2347
- TreeGrid.prototype.expandRow = function (row, record) {
2392
+ TreeGrid.prototype.expandRow = function (row, record, key, level) {
2348
2393
  var _this = this;
2349
2394
  record = this.getCollapseExpandRecords(row, record);
2350
2395
  if (!isNullOrUndefined(row) && row.cells[0].classList.contains('e-lastrowcell')) {
@@ -2354,6 +2399,9 @@ var TreeGrid = /** @class */ (function (_super) {
2354
2399
  this.trigger(events.expanding, args, function (expandingArgs) {
2355
2400
  if (!expandingArgs.cancel) {
2356
2401
  _this.expandCollapse('expand', row, record);
2402
+ if (expandingArgs.expandAll) {
2403
+ _this.expandCollapseAllChildren(record, 'expand', key, level);
2404
+ }
2357
2405
  var children = 'Children';
2358
2406
  if (!(isRemoteData(_this) && !isOffline(_this)) && (!isCountRequired(_this) || !isNullOrUndefined(record[children]))) {
2359
2407
  var collapseArgs = { data: record, row: row };
@@ -2363,6 +2411,19 @@ var TreeGrid = /** @class */ (function (_super) {
2363
2411
  }
2364
2412
  });
2365
2413
  };
2414
+ TreeGrid.prototype.expandCollapseAllChildren = function (record, action, key, level) {
2415
+ if ((!isNullOrUndefined(key) && record[this.getPrimaryKeyFieldNames()[0]] !== key) ||
2416
+ (!isNullOrUndefined(level) && level !== record.level)) {
2417
+ return;
2418
+ }
2419
+ var records = findChildrenRecords(record).filter(function (e) {
2420
+ return e.hasChildRecords;
2421
+ });
2422
+ records.unshift(record);
2423
+ for (var i = 0; i < records.length; i++) {
2424
+ this.expandCollapse(action, null, records[i]);
2425
+ }
2426
+ };
2366
2427
  TreeGrid.prototype.setHeightForFrozenContent = function () {
2367
2428
  var freeze = (this.grid.getFrozenLeftColumnsCount() > 0 || this.grid.getFrozenRightColumnsCount() > 0) ? true : false;
2368
2429
  if (this.grid.getFrozenColumns() > 0 || freeze) {
@@ -2386,14 +2447,18 @@ var TreeGrid = /** @class */ (function (_super) {
2386
2447
  *
2387
2448
  * @param {HTMLTableRowElement} row - Collapse the given row
2388
2449
  * @param {Object} record - Collapse the given record
2450
+ * @param {Object} key - Primary key value
2389
2451
  * @returns {void}
2390
2452
  */
2391
- TreeGrid.prototype.collapseRow = function (row, record) {
2453
+ TreeGrid.prototype.collapseRow = function (row, record, key) {
2392
2454
  var _this = this;
2393
2455
  record = this.getCollapseExpandRecords(row, record);
2394
2456
  var args = { data: record, row: row, cancel: false };
2395
2457
  this.trigger(events.collapsing, args, function (collapsingArgs) {
2396
2458
  if (!collapsingArgs.cancel) {
2459
+ if (collapsingArgs.collapseAll) {
2460
+ _this.expandCollapseAllChildren(record, 'collapse', key);
2461
+ }
2397
2462
  _this.expandCollapse('collapse', row, record);
2398
2463
  var collapseArgs = { data: record, row: row };
2399
2464
  if (!isRemoteData(_this)) {
@@ -2424,22 +2489,58 @@ var TreeGrid = /** @class */ (function (_super) {
2424
2489
  }
2425
2490
  return e.hasChildRecords && e.level === level;
2426
2491
  });
2427
- this.expandRow(null, rec);
2492
+ this.expandAction(rec, null, level, true);
2428
2493
  }
2429
2494
  else {
2430
2495
  var rec = this.getRecordDetails(level);
2431
- var row = getObject('rows', rec);
2432
2496
  var record = getObject('records', rec);
2433
- for (var i = 0; i < record.length; i++) {
2434
- if (record[i].parentItem !== undefined) {
2435
- var pindex = this.flatData[record[i].parentItem.index].index;
2436
- if (this.flatData[pindex].expanded === false) {
2437
- record.push(this.flatData[pindex]);
2438
- this.flatData[pindex].expanded = true;
2497
+ this.expandAction(record, null, level);
2498
+ }
2499
+ };
2500
+ /**
2501
+ * Expands the records by given primary key value
2502
+ *
2503
+ * @param {Object} key - Expands the parent rows with given primary key value
2504
+ * @returns {void}
2505
+ */
2506
+ TreeGrid.prototype.expandByKey = function (key) {
2507
+ this.expandCollapseActionByKey(key, 'Expand');
2508
+ };
2509
+ TreeGrid.prototype.expandAction = function (record, key, level, isPaging) {
2510
+ if (isPaging === void 0) { isPaging = false; }
2511
+ var _loop_1 = function (i) {
2512
+ if (!isNullOrUndefined(record[i].parentItem)) {
2513
+ var puniqueID_1 = record[i].parentItem.uniqueID;
2514
+ var parentItem = this_1.flatData.filter(function (e) {
2515
+ return e.uniqueID === puniqueID_1;
2516
+ });
2517
+ if (isRemoteData(this_1)) {
2518
+ parentItem = this_1.getCurrentViewRecords().filter(function (e) {
2519
+ return e.uniqueID === puniqueID_1;
2520
+ });
2521
+ }
2522
+ if (parentItem[0].expanded === false) {
2523
+ record.push(parentItem[0]);
2524
+ parentItem[0].expanded = true;
2525
+ }
2526
+ else {
2527
+ if (!getExpandStatus(this_1, parentItem[0], this_1.parentData)) {
2528
+ if (parentItem[0].expanded && parentItem[0].parentItem !== undefined) {
2529
+ record.push(parentItem[0]);
2530
+ }
2439
2531
  }
2440
2532
  }
2441
- this.expandRow(row[i], record[i]);
2442
2533
  }
2534
+ if (!isPaging) {
2535
+ this_1.expandRow(null, record[i], key, level);
2536
+ }
2537
+ };
2538
+ var this_1 = this;
2539
+ for (var i = 0; i < record.length; i++) {
2540
+ _loop_1(i);
2541
+ }
2542
+ if (isPaging) {
2543
+ this.expandRow(null, record, key, level);
2443
2544
  }
2444
2545
  };
2445
2546
  TreeGrid.prototype.getRecordDetails = function (level) {
@@ -2467,14 +2568,46 @@ var TreeGrid = /** @class */ (function (_super) {
2467
2568
  }
2468
2569
  return e.hasChildRecords && e.level === level;
2469
2570
  });
2470
- this.collapseRow(null, record);
2571
+ this.collapseAction(record, null, true);
2471
2572
  }
2472
2573
  else {
2473
2574
  var rec = this.getRecordDetails(level);
2474
- var rows = getObject('rows', rec);
2475
2575
  var records = getObject('records', rec);
2476
- for (var i = 0; i < records.length; i++) {
2477
- this.collapseRow(rows[i], records[i]);
2576
+ this.collapseAction(records);
2577
+ }
2578
+ };
2579
+ /**
2580
+ * Collapses the records by given primary key value
2581
+ *
2582
+ * @param {Object} key - Collapses the parent rows with given primary key value
2583
+ * @returns {void}
2584
+ */
2585
+ TreeGrid.prototype.collapseByKey = function (key) {
2586
+ this.expandCollapseActionByKey(key, 'Collapse');
2587
+ };
2588
+ TreeGrid.prototype.expandCollapseActionByKey = function (key, action) {
2589
+ var primaryKeyField = this.getPrimaryKeyFieldNames()[0];
2590
+ var dataSource = isRemoteData(this) ? this.getCurrentViewRecords() : this.grid.dataSource;
2591
+ if (!isNullOrUndefined(primaryKeyField)) {
2592
+ var rec = dataSource.filter(function (e) {
2593
+ return e[primaryKeyField].toString() === key.toString();
2594
+ });
2595
+ if (action === 'Expand') {
2596
+ this.expandAction(rec, key, null);
2597
+ }
2598
+ else {
2599
+ this.collapseAction(rec, key);
2600
+ }
2601
+ }
2602
+ };
2603
+ TreeGrid.prototype.collapseAction = function (record, key, isPaging) {
2604
+ if (isPaging === void 0) { isPaging = false; }
2605
+ if (isPaging) {
2606
+ this.collapseRow(null, record);
2607
+ }
2608
+ else {
2609
+ for (var i = 0; i < record.length; i++) {
2610
+ this.collapseRow(null, record[i], key);
2478
2611
  }
2479
2612
  }
2480
2613
  if (!this.grid.contentModule.isDataSourceChanged && this.enableVirtualization && this.getRows()
@@ -3384,6 +3517,9 @@ var TreeGrid = /** @class */ (function (_super) {
3384
3517
  __decorate([
3385
3518
  Property(false)
3386
3519
  ], TreeGrid.prototype, "enableAutoFill", void 0);
3520
+ __decorate([
3521
+ Property(false)
3522
+ ], TreeGrid.prototype, "enableAdaptiveUI", void 0);
3387
3523
  __decorate([
3388
3524
  Property(false)
3389
3525
  ], TreeGrid.prototype, "enableImmutableMode", void 0);
@@ -326,7 +326,16 @@ export declare class Column {
326
326
  * @default null
327
327
  */
328
328
  freeze: freezeDirection;
329
+ private parent;
329
330
  constructor(options: ColumnModel);
331
+ /**
332
+ * Update the State changes reflected for TreeGrid columndirective in react platform.
333
+ *
334
+ * @param {Column} column - specifies the column
335
+ * @returns {void}
336
+ * @hidden
337
+ */
338
+ private setProperties;
330
339
  }
331
340
  /**
332
341
  * Interface for a TreeGrid class Column