@syncfusion/ej2-treegrid 20.1.55 → 20.1.56

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.
@@ -77,12 +77,12 @@ var Column = /** @__PURE__ @class */ (function () {
77
77
  merge(this, options);
78
78
  }
79
79
  /**
80
- * Update the State changes reflected for TreeGrid columndirective in react platform.
81
- *
82
- * @param {Column} column - specifies the column
83
- * @returns {void}
84
- * @hidden
85
- */
80
+ * Update the State changes reflected for TreeGrid columndirective in react platform.
81
+ *
82
+ * @param {Column} column - specifies the column
83
+ * @returns {void}
84
+ * @hidden
85
+ */
86
86
  Column.prototype.setProperties = function (column) {
87
87
  //Angular two way binding
88
88
  var keys = Object.keys(column);
@@ -1777,10 +1777,10 @@ var Render = /** @__PURE__ @class */ (function () {
1777
1777
  }
1778
1778
  };
1779
1779
  /**
1780
- * @param {string} columnUid - Defines column uid
1781
- * @returns {void}
1782
- * @hidden
1783
- */
1780
+ * @param {string} columnUid - Defines column uid
1781
+ * @returns {void}
1782
+ * @hidden
1783
+ */
1784
1784
  Render.prototype.refreshReactColumnTemplateByUid = function (columnUid) {
1785
1785
  var _this = this;
1786
1786
  if (this.parent.isReact) {
@@ -2458,6 +2458,8 @@ var ContextMenuItems;
2458
2458
  ContextMenuItems[ContextMenuItems["LastPage"] = 13] = "LastPage";
2459
2459
  ContextMenuItems[ContextMenuItems["NextPage"] = 14] = "NextPage";
2460
2460
  ContextMenuItems[ContextMenuItems["AddRow"] = 15] = "AddRow";
2461
+ ContextMenuItems[ContextMenuItems["RowIndent"] = 16] = "RowIndent";
2462
+ ContextMenuItems[ContextMenuItems["RowOutdent"] = 17] = "RowOutdent";
2461
2463
  })(ContextMenuItems || (ContextMenuItems = {}));
2462
2464
 
2463
2465
  var __extends$7 = (undefined && undefined.__extends) || (function () {
@@ -3640,7 +3642,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
3640
3642
  };
3641
3643
  TreeGrid.prototype.extendRequiredModules = function (modules) {
3642
3644
  var IsRowDDInjected = this.injectedModules.filter(function (e) {
3643
- return e.name === 'RowDD';
3645
+ return e.prototype.getModuleName() === 'rowDragAndDrop';
3644
3646
  });
3645
3647
  if (this.allowRowDragAndDrop || IsRowDDInjected.length) {
3646
3648
  if ((!isNullOrUndefined(this.toolbar) && (this.toolbar['includes']('Indent') ||
@@ -4453,6 +4455,16 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4453
4455
  target: '.e-content', id: this.element.id + '_gridcontrol_cmenu_AddRow',
4454
4456
  items: [{ text: this.l10n.getConstant('Above'), id: 'Above' }, { text: this.l10n.getConstant('Below'), id: 'Below' }, { text: this.l10n.getConstant('Child'), id: 'Child' }] });
4455
4457
  break;
4458
+ case 'Indent':
4459
+ case ContextMenuItems.RowIndent:
4460
+ items.push({ text: this.l10n.getConstant('RowIndent'),
4461
+ target: '.e-content', iconCss: 'e-indent e-icons', id: this.element.id + '_gridcontrol_cmenu_Indent' });
4462
+ break;
4463
+ case 'Outdent':
4464
+ case ContextMenuItems.RowOutdent:
4465
+ items.push({ text: this.l10n.getConstant('RowOutdent'),
4466
+ target: '.e-content', iconCss: 'e-outdent e-icons', id: this.element.id + '_gridcontrol_cmenu_Outdent' });
4467
+ break;
4456
4468
  default:
4457
4469
  items.push(this.contextMenuItems[i]);
4458
4470
  }
@@ -4471,6 +4483,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4471
4483
  */
4472
4484
  TreeGrid.prototype.getGridToolbar = function () {
4473
4485
  if (this.toolbar) {
4486
+ this.l10n = new L10n('treegrid', this.defaultLocale, this.locale);
4474
4487
  var items = [];
4475
4488
  var tooltipText = void 0;
4476
4489
  for (var i = 0; i < this.toolbar.length; i++) {
@@ -4716,6 +4729,9 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4716
4729
  break;
4717
4730
  case 'locale':
4718
4731
  this.grid.locale = this.locale;
4732
+ this.TreeGridLocale();
4733
+ this.grid.toolbar = this.getGridToolbar();
4734
+ this.grid.contextMenuItems = this.getContextMenu();
4719
4735
  break;
4720
4736
  case 'selectedRowIndex':
4721
4737
  this.grid.selectedRowIndex = this.selectedRowIndex;
@@ -8018,8 +8034,8 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
8018
8034
  if (this.dropPosition === 'bottomSegment') {
8019
8035
  var primaryKeyField = this.parent.getPrimaryKeyFieldNames()[0];
8020
8036
  var rowIndex = selectedItemIndex === -1 ?
8021
- (this.parent.grid.getRowIndexByPrimaryKey(data[0][primaryKeyField])) - 1
8022
- : this.parent.getSelectedRowIndexes()[0] - 1;
8037
+ (this.parent.grid.getRowIndexByPrimaryKey(data[0][primaryKeyField]))
8038
+ : this.parent.getSelectedRowIndexes()[0];
8023
8039
  var selectedRecord = this.parent.getCurrentViewRecords()[rowIndex];
8024
8040
  this.droppedRecord = getParentData(this.parent, selectedRecord.parentItem.uniqueID);
8025
8041
  }
@@ -9377,6 +9393,16 @@ var Page$1 = /** @__PURE__ @class */ (function () {
9377
9393
  }
9378
9394
  return newResults;
9379
9395
  };
9396
+ Page$$1.prototype.updatePageSize = function (pageingDetails) {
9397
+ var updateSize = pageingDetails.result.length;
9398
+ var gridPagerModule = this.parent.grid.pagerModule;
9399
+ if (this.parent.pageSettings.pageSizes === true) {
9400
+ if (gridPagerModule.pagerObj.pagerdropdownModule['dropDownListObject'].value === gridPagerModule.pagerObj.getLocalizedLabel('All')) {
9401
+ gridPagerModule['pagerObj'].totalRecordsCount = updateSize;
9402
+ this.parent.grid.pageSettings.pageSize = updateSize;
9403
+ }
9404
+ }
9405
+ };
9380
9406
  Page$$1.prototype.pageAction = function (pageingDetails) {
9381
9407
  var _this = this;
9382
9408
  var dm = new DataManager(pageingDetails.result);
@@ -9413,6 +9439,7 @@ var Page$1 = /** @__PURE__ @class */ (function () {
9413
9439
  pageingDetails.count = visualData.length;
9414
9440
  var query = new Query();
9415
9441
  var size = this.parent.grid.pageSettings.pageSize;
9442
+ this.updatePageSize(pageingDetails);
9416
9443
  var current = this.parent.grid.pageSettings.currentPage;
9417
9444
  if (visualData.length < (current * size)) {
9418
9445
  current = (Math.floor(visualData.length / size)) + ((visualData.length % size) ? 1 : 0);
@@ -10001,6 +10028,8 @@ var ContextMenu$1 = /** @__PURE__ @class */ (function () {
10001
10028
  ContextMenu$$1.prototype.contextMenuOpen = function (args) {
10002
10029
  var addRow = select('#' + this.parent.element.id + '_gridcontrol_cmenu_AddRow', args.element);
10003
10030
  var editRecord = select('#' + this.parent.element.id + '_gridcontrol_cmenu_Edit', args.element);
10031
+ var indent = select('#' + this.parent.element.id + '_gridcontrol_cmenu_Indent', args.element);
10032
+ var outdent = select('#' + this.parent.element.id + '_gridcontrol_cmenu_Outdent', args.element);
10004
10033
  if (addRow) {
10005
10034
  if (this.parent.grid.editSettings.allowAdding === false) {
10006
10035
  addRow.style.display = 'none';
@@ -10013,6 +10042,47 @@ var ContextMenu$1 = /** @__PURE__ @class */ (function () {
10013
10042
  && !(isNullOrUndefined(editRecord)) && !(editRecord.classList.contains('e-menu-hide'))) {
10014
10043
  editRecord.style.display = 'none';
10015
10044
  }
10045
+ if (indent || outdent) {
10046
+ var tObj = this.parent;
10047
+ var selectedrow = tObj.getSelectedRows()[0];
10048
+ var targetElement = args.event.target.closest('td');
10049
+ if (isNullOrUndefined(targetElement) || (!isNullOrUndefined(targetElement) && !targetElement.classList.contains('e-rowcell'))) {
10050
+ indent.style.display = outdent.style.display = 'none';
10051
+ }
10052
+ else {
10053
+ if (selectedrow.rowIndex === 0 || tObj.getSelectedRowIndexes().length > 1) {
10054
+ indent.style.display = outdent.style.display = 'none';
10055
+ }
10056
+ else if (args['name'] !== 'rowDeselected' || (!isNullOrUndefined(selectedrow) && tObj.grid.isCheckBoxSelection)) {
10057
+ var selectedItem = tObj.getCurrentViewRecords()[selectedrow.rowIndex];
10058
+ if (!isNullOrUndefined(selectedItem)) {
10059
+ if ((selectedItem.level > tObj.getCurrentViewRecords()[selectedrow.rowIndex - 1].level)) {
10060
+ indent.style.display = 'none';
10061
+ }
10062
+ else {
10063
+ indent.style.display = 'block';
10064
+ }
10065
+ if (selectedItem.level === tObj.getCurrentViewRecords()[selectedrow.rowIndex - 1].level) {
10066
+ indent.style.display = 'block';
10067
+ }
10068
+ if (selectedItem.level === 0) {
10069
+ outdent.style.display = 'none';
10070
+ }
10071
+ if (selectedItem.level !== 0) {
10072
+ outdent.style.display = 'block';
10073
+ }
10074
+ }
10075
+ }
10076
+ if (args['name'] === 'rowDeselected' && isNullOrUndefined(selectedrow) && !tObj.grid.isCheckBoxSelection) {
10077
+ if (this.parent.toolbar['includes']('Indent')) {
10078
+ indent.style.display = 'none';
10079
+ }
10080
+ if (this.parent.toolbar['includes']('Outdent')) {
10081
+ outdent.style.display = 'none';
10082
+ }
10083
+ }
10084
+ }
10085
+ }
10016
10086
  };
10017
10087
  ContextMenu$$1.prototype.contextMenuClick = function (args) {
10018
10088
  if (args.item.id === 'Above' || args.item.id === 'Below' || args.item.id === 'Child') {
@@ -10020,6 +10090,13 @@ var ContextMenu$1 = /** @__PURE__ @class */ (function () {
10020
10090
  this.parent.setProperties({ editSettings: { newRowPosition: args.item.id } }, true);
10021
10091
  this.parent.addRecord();
10022
10092
  }
10093
+ if (args.item.id === this.parent.element.id + '_gridcontrol_cmenu_Indent' || args.item.id === this.parent.element.id + '_gridcontrol_cmenu_Outdent') {
10094
+ if (!isNullOrUndefined(this.parent.rowDragAndDropModule)) {
10095
+ var indentOutdentAction = 'indentOutdentAction';
10096
+ var action = args.item.id === this.parent.element.id + '_gridcontrol_cmenu_Indent' ? 'indent' : 'outdent';
10097
+ this.parent.rowDragAndDropModule[indentOutdentAction](null, action);
10098
+ }
10099
+ }
10023
10100
  };
10024
10101
  /**
10025
10102
  * For internal use only - Get the module name.