@syncfusion/ej2-treegrid 21.1.41 → 21.2.4

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.
@@ -1503,10 +1503,12 @@ class Render {
1503
1503
  const collapsed$$1 = (this.parent.initialRender && (!(isNullOrUndefined(parentData[this.parent.expandStateMapping]) ||
1504
1504
  parentData[this.parent.expandStateMapping]) || this.parent.enableCollapseAll)) ||
1505
1505
  !getExpandStatus(this.parent, args.data, this.parent.grid.getCurrentViewRecords());
1506
- if (collapsed$$1) {
1506
+ if (collapsed$$1 && !isNullOrUndefined(args.row)) {
1507
1507
  args.row.style.display = 'none';
1508
1508
  const rowsObj = this.parent.grid.getRowsObject();
1509
- rowsObj.filter((e) => e.uid === args.row.getAttribute('data-uid'))[0].visible = false;
1509
+ if (!isNullOrUndefined(args.row.getAttribute('data-uid'))) {
1510
+ rowsObj.filter((e) => e.uid === args.row.getAttribute('data-uid'))[0].visible = false;
1511
+ }
1510
1512
  }
1511
1513
  }
1512
1514
  if (isRemoteData(this.parent) && !isOffline(this.parent)) {
@@ -1514,7 +1516,7 @@ class Render {
1514
1516
  const parentrec = this.parent.getCurrentViewRecords().filter((rec) => {
1515
1517
  return getValue(proxy.idMapping, rec) === getValue(proxy.parentIdMapping, data);
1516
1518
  });
1517
- if (parentrec.length > 0 && !parentrec[0].isSummaryRow) {
1519
+ if (parentrec.length > 0 && !parentrec[0].isSummaryRow && !isNullOrUndefined(args.row)) {
1518
1520
  const display = parentrec[0].expanded ? 'table-row' : 'none';
1519
1521
  args.row.setAttribute('style', 'display: ' + display + ';');
1520
1522
  }
@@ -1524,15 +1526,17 @@ class Render {
1524
1526
  if (summaryRow) {
1525
1527
  addClass([args.row], 'e-summaryrow');
1526
1528
  }
1527
- if (args.row.querySelector('.e-treegridexpand')) {
1528
- args.row.setAttribute('aria-expanded', 'true');
1529
- }
1530
- else if (args.row.querySelector('.e-treegridcollapse')) {
1531
- args.row.setAttribute('aria-expanded', 'false');
1532
- }
1533
- if (this.parent.enableCollapseAll && this.parent.initialRender) {
1534
- if (!isNullOrUndefined(data.parentItem)) {
1535
- args.row.style.display = 'none';
1529
+ if (!isNullOrUndefined(args.row)) {
1530
+ if (args.row.querySelector('.e-treegridexpand')) {
1531
+ args.row.setAttribute('aria-expanded', 'true');
1532
+ }
1533
+ else if (args.row.querySelector('.e-treegridcollapse')) {
1534
+ args.row.setAttribute('aria-expanded', 'false');
1535
+ }
1536
+ if (this.parent.enableCollapseAll && this.parent.initialRender) {
1537
+ if (!isNullOrUndefined(data.parentItem)) {
1538
+ args.row.style.display = 'none';
1539
+ }
1536
1540
  }
1537
1541
  }
1538
1542
  const dragStartData = 'dragStartData';
@@ -3534,7 +3538,12 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3534
3538
  break;
3535
3539
  case 'downArrow':
3536
3540
  if (!this.enableVirtualization) {
3537
- parentTarget = e.target.parentElement;
3541
+ target = e.target;
3542
+ parentTarget = target.parentElement;
3543
+ const cellIndex = parentTarget.cellIndex;
3544
+ if (this.grid.getColumnByIndex(cellIndex).editType === 'dropdownedit' && isNullOrUndefined(this.grid.getColumnByIndex(cellIndex).edit[`obj`])) {
3545
+ parentTarget = target;
3546
+ }
3538
3547
  summaryElement = this.findnextRowElement(parentTarget);
3539
3548
  if (summaryElement !== null) {
3540
3549
  const rowIndex = summaryElement.rowIndex;
@@ -3551,7 +3560,12 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3551
3560
  break;
3552
3561
  case 'upArrow':
3553
3562
  if (!this.enableVirtualization) {
3554
- parentTarget = e.target.parentElement;
3563
+ target = e.target;
3564
+ parentTarget = target.parentElement;
3565
+ const cellIndex = parentTarget.cellIndex;
3566
+ if (this.grid.getColumnByIndex(cellIndex).editType === 'dropdownedit' && isNullOrUndefined(this.grid.getColumnByIndex(cellIndex).edit[`obj`])) {
3567
+ parentTarget = target;
3568
+ }
3555
3569
  summaryElement = this.findPreviousRowElement(parentTarget);
3556
3570
  if (summaryElement !== null) {
3557
3571
  const rIndex = summaryElement.rowIndex;
@@ -4285,7 +4299,24 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4285
4299
  };
4286
4300
  }
4287
4301
  updateRowTemplate() {
4288
- this.treeColumnRowTemplate();
4302
+ if (this.rowTemplate) {
4303
+ if (this.isReact && this.getContentTable().rows.length === 0) {
4304
+ setTimeout(() => {
4305
+ this.treeColumnRowTemplate();
4306
+ if (this.enableCollapseAll) {
4307
+ const currentData = this.getCurrentViewRecords();
4308
+ const rows = this.getContentTable().rows;
4309
+ for (let i = 0; i < rows.length; i++) {
4310
+ let args = { data: currentData[parseInt(i.toString(), 10)], row: rows[parseInt(i.toString(), 10)] };
4311
+ this.renderModule.RowModifier(args);
4312
+ }
4313
+ }
4314
+ }, 0);
4315
+ }
4316
+ else {
4317
+ this.treeColumnRowTemplate();
4318
+ }
4319
+ }
4289
4320
  }
4290
4321
  bindedDataSource() {
4291
4322
  const dataSource = 'dataSource';
@@ -4327,22 +4358,6 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4327
4358
  if (requestType === 'reorder') {
4328
4359
  this.notify('getColumnIndex', {});
4329
4360
  }
4330
- if (requestType === 'filterbeforeopen' && args.columnName && this.filterSettings.hierarchyMode !== 'None') {
4331
- for (let j = 0; j < this.columns.length; j++) {
4332
- const fields = 'field';
4333
- if (this.columns[parseInt(j.toString(), 10)][`${fields}`] === args.columnName) {
4334
- const taskFields = [];
4335
- for (let i = 0; i < this.grid.currentViewData.length; i++) {
4336
- const fieldValue = this.grid.currentViewData[parseInt(i.toString(), 10)][args.columnName];
4337
- if (taskFields.indexOf(fieldValue) === -1) {
4338
- taskFields.push(fieldValue);
4339
- }
4340
- }
4341
- args['filterModel'].options.dataSource = taskFields.map((name) => ({ [args.columnName]: name }));
4342
- args['filterModel'].options.filteredColumns = args['filterModel'].options.filteredColumns.filter((col) => col.field === args.columnName);
4343
- }
4344
- }
4345
- }
4346
4361
  if (isRemoteData(this) && this.enableVirtualization) {
4347
4362
  if (args.requestType === 'virtualscroll') {
4348
4363
  this.query.expand('VirtualScrollingAction');
@@ -6443,17 +6458,15 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6443
6458
  }
6444
6459
  }
6445
6460
  treeColumnRowTemplate() {
6446
- if (this.rowTemplate) {
6447
- let rows = this.getContentTable().rows;
6448
- rows = [].slice.call(rows);
6449
- for (let i = 0; i < rows.length; i++) {
6450
- const rcell = this.grid.getContentTable().rows[parseInt(i.toString(), 10)]
6451
- .cells[this.treeColumnIndex];
6452
- const row = rows[parseInt(i.toString(), 10)];
6453
- const rowData = this.grid.getRowsObject()[parseInt(i.toString(), 10)].data;
6454
- const arg = { data: rowData, row: row, cell: rcell, column: this.getColumns()[this.treeColumnIndex] };
6455
- this.renderModule.cellRender(arg);
6456
- }
6461
+ let rows = this.getContentTable().rows;
6462
+ rows = [].slice.call(rows);
6463
+ for (let i = 0; i < rows.length; i++) {
6464
+ const rcell = this.grid.getContentTable().rows[parseInt(i.toString(), 10)]
6465
+ .cells[this.treeColumnIndex];
6466
+ const row = rows[parseInt(i.toString(), 10)];
6467
+ const rowData = this.grid.getRowsObject()[parseInt(i.toString(), 10)].data;
6468
+ const arg = { data: rowData, row: row, cell: rcell, column: this.getColumns()[this.treeColumnIndex] };
6469
+ this.renderModule.cellRender(arg);
6457
6470
  }
6458
6471
  }
6459
6472
  collapseRemoteChild(rowDetails, isChild) {