@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 @@ class Column {
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
  setProperties(column) {
87
87
  //Angular two way binding
88
88
  const keys = Object.keys(column);
@@ -1661,10 +1661,10 @@ class Render {
1661
1661
  }
1662
1662
  }
1663
1663
  /**
1664
- * @param {string} columnUid - Defines column uid
1665
- * @returns {void}
1666
- * @hidden
1667
- */
1664
+ * @param {string} columnUid - Defines column uid
1665
+ * @returns {void}
1666
+ * @hidden
1667
+ */
1668
1668
  refreshReactColumnTemplateByUid(columnUid) {
1669
1669
  if (this.parent.isReact) {
1670
1670
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -2335,6 +2335,8 @@ var ContextMenuItems;
2335
2335
  ContextMenuItems[ContextMenuItems["LastPage"] = 13] = "LastPage";
2336
2336
  ContextMenuItems[ContextMenuItems["NextPage"] = 14] = "NextPage";
2337
2337
  ContextMenuItems[ContextMenuItems["AddRow"] = 15] = "AddRow";
2338
+ ContextMenuItems[ContextMenuItems["RowIndent"] = 16] = "RowIndent";
2339
+ ContextMenuItems[ContextMenuItems["RowOutdent"] = 17] = "RowOutdent";
2338
2340
  })(ContextMenuItems || (ContextMenuItems = {}));
2339
2341
 
2340
2342
  var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
@@ -3396,7 +3398,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3396
3398
  }
3397
3399
  extendRequiredModules(modules) {
3398
3400
  const IsRowDDInjected = this.injectedModules.filter((e) => {
3399
- return e.name === 'RowDD';
3401
+ return e.prototype.getModuleName() === 'rowDragAndDrop';
3400
3402
  });
3401
3403
  if (this.allowRowDragAndDrop || IsRowDDInjected.length) {
3402
3404
  if ((!isNullOrUndefined(this.toolbar) && (this.toolbar['includes']('Indent') ||
@@ -4199,6 +4201,16 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4199
4201
  target: '.e-content', id: this.element.id + '_gridcontrol_cmenu_AddRow',
4200
4202
  items: [{ text: this.l10n.getConstant('Above'), id: 'Above' }, { text: this.l10n.getConstant('Below'), id: 'Below' }, { text: this.l10n.getConstant('Child'), id: 'Child' }] });
4201
4203
  break;
4204
+ case 'Indent':
4205
+ case ContextMenuItems.RowIndent:
4206
+ items.push({ text: this.l10n.getConstant('RowIndent'),
4207
+ target: '.e-content', iconCss: 'e-indent e-icons', id: this.element.id + '_gridcontrol_cmenu_Indent' });
4208
+ break;
4209
+ case 'Outdent':
4210
+ case ContextMenuItems.RowOutdent:
4211
+ items.push({ text: this.l10n.getConstant('RowOutdent'),
4212
+ target: '.e-content', iconCss: 'e-outdent e-icons', id: this.element.id + '_gridcontrol_cmenu_Outdent' });
4213
+ break;
4202
4214
  default:
4203
4215
  items.push(this.contextMenuItems[i]);
4204
4216
  }
@@ -4217,6 +4229,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4217
4229
  */
4218
4230
  getGridToolbar() {
4219
4231
  if (this.toolbar) {
4232
+ this.l10n = new L10n('treegrid', this.defaultLocale, this.locale);
4220
4233
  const items = [];
4221
4234
  let tooltipText;
4222
4235
  for (let i = 0; i < this.toolbar.length; i++) {
@@ -4458,6 +4471,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4458
4471
  break;
4459
4472
  case 'locale':
4460
4473
  this.grid.locale = this.locale;
4474
+ this.TreeGridLocale();
4475
+ this.grid.toolbar = this.getGridToolbar();
4476
+ this.grid.contextMenuItems = this.getContextMenu();
4461
4477
  break;
4462
4478
  case 'selectedRowIndex':
4463
4479
  this.grid.selectedRowIndex = this.selectedRowIndex;
@@ -7730,8 +7746,8 @@ class RowDD$1 {
7730
7746
  if (this.dropPosition === 'bottomSegment') {
7731
7747
  const primaryKeyField = this.parent.getPrimaryKeyFieldNames()[0];
7732
7748
  const rowIndex = selectedItemIndex === -1 ?
7733
- (this.parent.grid.getRowIndexByPrimaryKey(data[0][primaryKeyField])) - 1
7734
- : this.parent.getSelectedRowIndexes()[0] - 1;
7749
+ (this.parent.grid.getRowIndexByPrimaryKey(data[0][primaryKeyField]))
7750
+ : this.parent.getSelectedRowIndexes()[0];
7735
7751
  const selectedRecord = this.parent.getCurrentViewRecords()[rowIndex];
7736
7752
  this.droppedRecord = getParentData(this.parent, selectedRecord.parentItem.uniqueID);
7737
7753
  }
@@ -9040,6 +9056,16 @@ class Page$1 {
9040
9056
  }
9041
9057
  return newResults;
9042
9058
  }
9059
+ updatePageSize(pageingDetails) {
9060
+ const updateSize = pageingDetails.result.length;
9061
+ const gridPagerModule = this.parent.grid.pagerModule;
9062
+ if (this.parent.pageSettings.pageSizes === true) {
9063
+ if (gridPagerModule.pagerObj.pagerdropdownModule['dropDownListObject'].value === gridPagerModule.pagerObj.getLocalizedLabel('All')) {
9064
+ gridPagerModule['pagerObj'].totalRecordsCount = updateSize;
9065
+ this.parent.grid.pageSettings.pageSize = updateSize;
9066
+ }
9067
+ }
9068
+ }
9043
9069
  pageAction(pageingDetails) {
9044
9070
  const dm = new DataManager(pageingDetails.result);
9045
9071
  if (this.parent.pageSettings.pageSizeMode === 'Root') {
@@ -9075,6 +9101,7 @@ class Page$1 {
9075
9101
  pageingDetails.count = visualData.length;
9076
9102
  let query = new Query();
9077
9103
  const size = this.parent.grid.pageSettings.pageSize;
9104
+ this.updatePageSize(pageingDetails);
9078
9105
  let current = this.parent.grid.pageSettings.currentPage;
9079
9106
  if (visualData.length < (current * size)) {
9080
9107
  current = (Math.floor(visualData.length / size)) + ((visualData.length % size) ? 1 : 0);
@@ -9653,6 +9680,8 @@ class ContextMenu$1 {
9653
9680
  contextMenuOpen(args) {
9654
9681
  const addRow = select('#' + this.parent.element.id + '_gridcontrol_cmenu_AddRow', args.element);
9655
9682
  const editRecord = select('#' + this.parent.element.id + '_gridcontrol_cmenu_Edit', args.element);
9683
+ const indent = select('#' + this.parent.element.id + '_gridcontrol_cmenu_Indent', args.element);
9684
+ const outdent = select('#' + this.parent.element.id + '_gridcontrol_cmenu_Outdent', args.element);
9656
9685
  if (addRow) {
9657
9686
  if (this.parent.grid.editSettings.allowAdding === false) {
9658
9687
  addRow.style.display = 'none';
@@ -9665,6 +9694,47 @@ class ContextMenu$1 {
9665
9694
  && !(isNullOrUndefined(editRecord)) && !(editRecord.classList.contains('e-menu-hide'))) {
9666
9695
  editRecord.style.display = 'none';
9667
9696
  }
9697
+ if (indent || outdent) {
9698
+ const tObj = this.parent;
9699
+ const selectedrow = tObj.getSelectedRows()[0];
9700
+ const targetElement = args.event.target.closest('td');
9701
+ if (isNullOrUndefined(targetElement) || (!isNullOrUndefined(targetElement) && !targetElement.classList.contains('e-rowcell'))) {
9702
+ indent.style.display = outdent.style.display = 'none';
9703
+ }
9704
+ else {
9705
+ if (selectedrow.rowIndex === 0 || tObj.getSelectedRowIndexes().length > 1) {
9706
+ indent.style.display = outdent.style.display = 'none';
9707
+ }
9708
+ else if (args['name'] !== 'rowDeselected' || (!isNullOrUndefined(selectedrow) && tObj.grid.isCheckBoxSelection)) {
9709
+ const selectedItem = tObj.getCurrentViewRecords()[selectedrow.rowIndex];
9710
+ if (!isNullOrUndefined(selectedItem)) {
9711
+ if ((selectedItem.level > tObj.getCurrentViewRecords()[selectedrow.rowIndex - 1].level)) {
9712
+ indent.style.display = 'none';
9713
+ }
9714
+ else {
9715
+ indent.style.display = 'block';
9716
+ }
9717
+ if (selectedItem.level === tObj.getCurrentViewRecords()[selectedrow.rowIndex - 1].level) {
9718
+ indent.style.display = 'block';
9719
+ }
9720
+ if (selectedItem.level === 0) {
9721
+ outdent.style.display = 'none';
9722
+ }
9723
+ if (selectedItem.level !== 0) {
9724
+ outdent.style.display = 'block';
9725
+ }
9726
+ }
9727
+ }
9728
+ if (args['name'] === 'rowDeselected' && isNullOrUndefined(selectedrow) && !tObj.grid.isCheckBoxSelection) {
9729
+ if (this.parent.toolbar['includes']('Indent')) {
9730
+ indent.style.display = 'none';
9731
+ }
9732
+ if (this.parent.toolbar['includes']('Outdent')) {
9733
+ outdent.style.display = 'none';
9734
+ }
9735
+ }
9736
+ }
9737
+ }
9668
9738
  }
9669
9739
  contextMenuClick(args) {
9670
9740
  if (args.item.id === 'Above' || args.item.id === 'Below' || args.item.id === 'Child') {
@@ -9672,6 +9742,13 @@ class ContextMenu$1 {
9672
9742
  this.parent.setProperties({ editSettings: { newRowPosition: args.item.id } }, true);
9673
9743
  this.parent.addRecord();
9674
9744
  }
9745
+ if (args.item.id === this.parent.element.id + '_gridcontrol_cmenu_Indent' || args.item.id === this.parent.element.id + '_gridcontrol_cmenu_Outdent') {
9746
+ if (!isNullOrUndefined(this.parent.rowDragAndDropModule)) {
9747
+ const indentOutdentAction = 'indentOutdentAction';
9748
+ const action = args.item.id === this.parent.element.id + '_gridcontrol_cmenu_Indent' ? 'indent' : 'outdent';
9749
+ this.parent.rowDragAndDropModule[indentOutdentAction](null, action);
9750
+ }
9751
+ }
9675
9752
  }
9676
9753
  /**
9677
9754
  * For internal use only - Get the module name.