@syncfusion/ej2-treegrid 20.3.61 → 20.4.40

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 (46) hide show
  1. package/.eslintrc.json +16 -1
  2. package/CHANGELOG.md +9 -60
  3. package/README.md +64 -51
  4. package/dist/ej2-treegrid.min.js +2 -2
  5. package/dist/ej2-treegrid.umd.min.js +2 -2
  6. package/dist/ej2-treegrid.umd.min.js.map +1 -1
  7. package/dist/es6/ej2-treegrid.es2015.js +1198 -910
  8. package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
  9. package/dist/es6/ej2-treegrid.es5.js +1256 -946
  10. package/dist/es6/ej2-treegrid.es5.js.map +1 -1
  11. package/dist/global/ej2-treegrid.min.js +2 -2
  12. package/dist/global/ej2-treegrid.min.js.map +1 -1
  13. package/dist/global/index.d.ts +1 -1
  14. package/package.json +17 -11
  15. package/src/treegrid/actions/batch-edit.js +82 -82
  16. package/src/treegrid/actions/clipboard.js +34 -33
  17. package/src/treegrid/actions/context-menu.js +1 -1
  18. package/src/treegrid/actions/crud-actions.js +62 -55
  19. package/src/treegrid/actions/detail-row.js +7 -7
  20. package/src/treegrid/actions/edit.js +61 -60
  21. package/src/treegrid/actions/excel-export.js +2 -2
  22. package/src/treegrid/actions/filter.js +13 -13
  23. package/src/treegrid/actions/freeze-column.js +9 -8
  24. package/src/treegrid/actions/infinite-scroll.js +19 -19
  25. package/src/treegrid/actions/logger.js +10 -10
  26. package/src/treegrid/actions/page.js +8 -8
  27. package/src/treegrid/actions/reorder.js +2 -2
  28. package/src/treegrid/actions/rowdragdrop.js +88 -82
  29. package/src/treegrid/actions/selection.js +34 -32
  30. package/src/treegrid/actions/sort.js +7 -6
  31. package/src/treegrid/actions/summary.js +24 -24
  32. package/src/treegrid/actions/toolbar.js +2 -2
  33. package/src/treegrid/base/data.js +242 -55
  34. package/src/treegrid/base/treegrid-model.d.ts +20 -4
  35. package/src/treegrid/base/treegrid.d.ts +24 -5
  36. package/src/treegrid/base/treegrid.js +232 -192
  37. package/src/treegrid/models/column.js +3 -3
  38. package/src/treegrid/models/index.d.ts +2 -0
  39. package/src/treegrid/models/index.js +1 -0
  40. package/src/treegrid/models/loading-indicator-model.d.ts +19 -0
  41. package/src/treegrid/models/loading-indicator.d.ts +16 -0
  42. package/src/treegrid/models/loading-indicator.js +34 -0
  43. package/src/treegrid/renderer/render.js +20 -19
  44. package/src/treegrid/renderer/virtual-row-model-generator.js +6 -5
  45. package/src/treegrid/renderer/virtual-tree-content-render.js +128 -99
  46. package/src/treegrid/utils.js +12 -11
@@ -33,7 +33,7 @@ export function editAction(details, control, isSelfReference, addRowIndex, selec
33
33
  batchChanges = control.grid.editModule.getBatchChanges();
34
34
  }
35
35
  if (action === 'add' || (action === 'batchsave' && (control.editSettings.mode === 'Batch'
36
- && batchChanges[addedRecords].length))) {
36
+ && batchChanges["" + addedRecords].length))) {
37
37
  var addAct = addAction(details, treeData, control, isSelfReference, addRowIndex, selectedIndex, addRowRecord);
38
38
  value = addAct.value;
39
39
  isSkip = addAct.isSkip;
@@ -47,25 +47,26 @@ export function editAction(details, control, isSelfReference, addRowIndex, selec
47
47
  if (!isSkip && (action !== 'add' ||
48
48
  (control.editSettings.newRowPosition !== 'Top' && control.editSettings.newRowPosition !== 'Bottom'))) {
49
49
  for (var k = 0; k < modifiedData.length; k++) {
50
- if (typeof (modifiedData[k][key]) === 'object') {
51
- modifiedData[k] = modifiedData[k][key];
50
+ if (typeof (modifiedData[parseInt(k.toString(), 10)]["" + key]) === 'object') {
51
+ modifiedData[parseInt(k.toString(), 10)] = modifiedData[parseInt(k.toString(), 10)]["" + key];
52
52
  }
53
- var keys = modifiedData[k].taskData ? Object.keys(modifiedData[k].taskData) :
54
- Object.keys(modifiedData[k]);
53
+ var keys = modifiedData[parseInt(k.toString(), 10)].taskData ?
54
+ Object.keys(modifiedData[parseInt(k.toString(), 10)].taskData) :
55
+ Object.keys(modifiedData[parseInt(k.toString(), 10)]);
55
56
  i = treeData.length;
56
57
  var _loop_1 = function () {
57
- if (treeData[i][key] === modifiedData[k][key]) {
58
+ if (treeData[parseInt(i.toString(), 10)]["" + key] === modifiedData[parseInt(k.toString(), 10)]["" + key]) {
58
59
  if (action === 'delete') {
59
- var currentData_1 = treeData[i];
60
+ var currentData_1 = treeData[parseInt(i.toString(), 10)];
60
61
  treeData.splice(i, 1);
61
62
  if (isSelfReference) {
62
- if (!isNullOrUndefined(currentData_1[control.parentIdMapping])) {
63
+ if (!isNullOrUndefined(currentData_1["" + control.parentIdMapping])) {
63
64
  var parentData = control.flatData.filter(function (e) {
64
- return e[control.idMapping] === currentData_1[control.parentIdMapping];
65
+ return e["" + control.idMapping] === currentData_1["" + control.parentIdMapping];
65
66
  })[0];
66
- var childRecords = parentData ? parentData[control.childMapping] : [];
67
+ var childRecords = parentData ? parentData["" + control.childMapping] : [];
67
68
  for (var p = childRecords.length - 1; p >= 0; p--) {
68
- if (childRecords[p][control.idMapping] === currentData_1[control.idMapping]) {
69
+ if (childRecords[parseInt(p.toString(), 10)]["" + control.idMapping] === currentData_1["" + control.idMapping]) {
69
70
  if (!control.enableImmutableMode && parentData.childRecords.length === parentData['Children'].length) {
70
71
  parentData['childRecords'].splice(p, 1);
71
72
  }
@@ -84,13 +85,15 @@ export function editAction(details, control, isSelfReference, addRowIndex, selec
84
85
  else {
85
86
  if (action === 'edit') {
86
87
  for (j = 0; j < keys.length; j++) {
87
- if (Object.prototype.hasOwnProperty.call(treeData[i], keys[j]) && ((control.editSettings.mode !== 'Cell'
88
- || (!isNullOrUndefined(batchChanges) && batchChanges[changedRecords].length === 0))
89
- || keys[j] === columnName)) {
90
- var editedData = getParentData(control, modifiedData[k].uniqueID);
91
- treeData[i][keys[j]] = modifiedData[k][keys[j]];
88
+ if (Object.prototype.hasOwnProperty.call(treeData[parseInt(i.toString(), 10)], keys[parseInt(j.toString(), 10)]) && ((control.editSettings.mode !== 'Cell'
89
+ || (!isNullOrUndefined(batchChanges) && batchChanges["" + changedRecords].length === 0))
90
+ || keys[parseInt(j.toString(), 10)] === columnName)) {
91
+ var editedData = getParentData(control, modifiedData[parseInt(k.toString(), 10)].uniqueID);
92
+ treeData[parseInt(i.toString(), 10)][keys[parseInt(j.toString(), 10)]] =
93
+ modifiedData[parseInt(k.toString(), 10)][keys[parseInt(j.toString(), 10)]];
92
94
  if (editedData && editedData.taskData) {
93
- editedData.taskData[keys[j]] = editedData[keys[j]] = treeData[i][keys[j]];
95
+ editedData.taskData[keys[parseInt(j.toString(), 10)]] = editedData[keys[parseInt(j.toString(), 10)]]
96
+ = treeData[parseInt(i.toString(), 10)][keys[parseInt(j.toString(), 10)]];
94
97
  }
95
98
  }
96
99
  }
@@ -99,15 +102,15 @@ export function editAction(details, control, isSelfReference, addRowIndex, selec
99
102
  var index = void 0;
100
103
  if (control.editSettings.newRowPosition === 'Child') {
101
104
  if (isSelfReference) {
102
- originalData.taskData[control.parentIdMapping] = treeData[i][control.idMapping];
105
+ originalData.taskData["" + control.parentIdMapping] = treeData[parseInt(i.toString(), 10)]["" + control.idMapping];
103
106
  treeData.splice(i + 1, 0, originalData.taskData);
104
107
  }
105
108
  else {
106
- if (!Object.prototype.hasOwnProperty.call(treeData[i], control.childMapping)) {
107
- treeData[i][control.childMapping] = [];
109
+ if (!Object.prototype.hasOwnProperty.call(treeData[parseInt(i.toString(), 10)], control.childMapping)) {
110
+ treeData[parseInt(i.toString(), 10)]["" + control.childMapping] = [];
108
111
  }
109
- treeData[i][control.childMapping].push(originalData.taskData);
110
- updateParentRow(key, treeData[i], action, control, isSelfReference, originalData);
112
+ treeData[parseInt(i.toString(), 10)]["" + control.childMapping].push(originalData.taskData);
113
+ updateParentRow(key, treeData[parseInt(i.toString(), 10)], action, control, isSelfReference, originalData);
111
114
  }
112
115
  }
113
116
  else if (control.editSettings.newRowPosition === 'Below') {
@@ -123,16 +126,16 @@ export function editAction(details, control, isSelfReference, addRowIndex, selec
123
126
  else if (control.editSettings.newRowPosition === 'Above') {
124
127
  treeData.splice(i, 0, originalData.taskData);
125
128
  if (!isNullOrUndefined(originalData.parentItem)) {
126
- updateParentRow(key, treeData[i], action, control, isSelfReference, originalData);
129
+ updateParentRow(key, treeData[parseInt(i.toString(), 10)], action, control, isSelfReference, originalData);
127
130
  }
128
131
  }
129
132
  }
130
133
  return "break";
131
134
  }
132
135
  }
133
- else if (!isNullOrUndefined(treeData[i][control.childMapping])) {
134
- if (removeChildRecords(treeData[i][control.childMapping], modifiedData[k], action, key, control, isSelfReference, originalData, columnName)) {
135
- updateParentRow(key, treeData[i], action, control, isSelfReference);
136
+ else if (!isNullOrUndefined(treeData[parseInt(i.toString(), 10)]["" + control.childMapping])) {
137
+ if (removeChildRecords(treeData[parseInt(i.toString(), 10)]["" + control.childMapping], modifiedData[parseInt(k.toString(), 10)], action, key, control, isSelfReference, originalData, columnName)) {
138
+ updateParentRow(key, treeData[parseInt(i.toString(), 10)], action, control, isSelfReference);
136
139
  }
137
140
  }
138
141
  };
@@ -191,8 +194,8 @@ export function addAction(details, treeData, control, isSelfReference, addRowInd
191
194
  }
192
195
  else {
193
196
  var primaryKeys = control.grid.getPrimaryKeyFieldNames()[0];
194
- var currentdata = currentViewRecords[addRowIndex];
195
- if (!isNullOrUndefined(currentdata) && currentdata[primaryKeys] === details.value[primaryKeys] || selectedIndex !== -1) {
197
+ var currentdata = currentViewRecords[parseInt(addRowIndex.toString(), 10)];
198
+ if (!isNullOrUndefined(currentdata) && currentdata["" + primaryKeys] === details.value["" + primaryKeys] || selectedIndex !== -1) {
196
199
  value = extend({}, currentdata);
197
200
  }
198
201
  else {
@@ -200,7 +203,7 @@ export function addAction(details, treeData, control, isSelfReference, addRowInd
200
203
  }
201
204
  value = getPlainData(value);
202
205
  var internalProperty = 'internalProperties';
203
- control.editModule[internalProperty].taskData = value;
206
+ control.editModule["" + internalProperty].taskData = value;
204
207
  }
205
208
  if (selectedIndex === -1) {
206
209
  treeData.unshift(value);
@@ -224,18 +227,22 @@ export function removeChildRecords(childRecords, modifiedData, action, key, cont
224
227
  var isChildAll = false;
225
228
  var j = childRecords.length;
226
229
  while (j-- && j >= 0) {
227
- if (childRecords[j][key] === modifiedData[key] ||
228
- (isSelfReference && childRecords[j][control.parentIdMapping] === modifiedData[control.idMapping])) {
230
+ if (childRecords[parseInt(j.toString(), 10)]["" + key] === modifiedData["" + key] ||
231
+ (isSelfReference && childRecords[parseInt(j.toString(), 10)][control.parentIdMapping] === modifiedData[control.idMapping])) {
229
232
  if (action === 'edit') {
230
233
  var keys = Object.keys(modifiedData);
231
234
  var editedData = getParentData(control, modifiedData.uniqueID);
232
235
  for (var i = 0; i < keys.length; i++) {
233
- if (Object.prototype.hasOwnProperty.call(childRecords[j], keys[i]) && (control.editSettings.mode !== 'Cell' || keys[i] === columnName)) {
234
- editedData[keys[i]] = editedData.taskData[keys[i]] = childRecords[j][keys[i]] = modifiedData[keys[i]];
236
+ if (Object.prototype.hasOwnProperty.call(childRecords[parseInt(j.toString(), 10)], keys[parseInt(i.toString(), 10)]) &&
237
+ (control.editSettings.mode !== 'Cell' || keys[parseInt(i.toString(), 10)] === columnName)) {
238
+ editedData[keys[parseInt(i.toString(), 10)]] =
239
+ editedData.taskData[keys[parseInt(i.toString(), 10)]] =
240
+ childRecords[parseInt(j.toString(), 10)][keys[parseInt(i.toString(), 10)]] =
241
+ modifiedData[keys[parseInt(i.toString(), 10)]];
235
242
  if (control.grid.editSettings.mode === 'Normal' && control.editSettings.mode === 'Cell') {
236
243
  var editModule = 'editModule';
237
- control.grid.editModule[editModule].editRowIndex = modifiedData.index;
238
- control.grid.editModule[editModule].updateCurrentViewData(modifiedData);
244
+ control.grid.editModule["" + editModule].editRowIndex = modifiedData.index;
245
+ control.grid.editModule["" + editModule].updateCurrentViewData(modifiedData);
239
246
  }
240
247
  }
241
248
  }
@@ -244,28 +251,28 @@ export function removeChildRecords(childRecords, modifiedData, action, key, cont
244
251
  else if (action === 'add' || action === 'batchsave') {
245
252
  if (control.editSettings.newRowPosition === 'Child') {
246
253
  if (isSelfReference) {
247
- originalData[control.parentIdMapping] = childRecords[j][control.idMapping];
254
+ originalData["" + control.parentIdMapping] = childRecords[parseInt(j.toString(), 10)][control.idMapping];
248
255
  childRecords.splice(j + 1, 0, originalData);
249
- updateParentRow(key, childRecords[j], action, control, isSelfReference, originalData);
256
+ updateParentRow(key, childRecords[parseInt(j.toString(), 10)], action, control, isSelfReference, originalData);
250
257
  }
251
258
  else {
252
- if (!Object.prototype.hasOwnProperty.call(childRecords[j], control.childMapping)) {
253
- childRecords[j][control.childMapping] = [];
259
+ if (!Object.prototype.hasOwnProperty.call(childRecords[parseInt(j.toString(), 10)], control.childMapping)) {
260
+ childRecords[parseInt(j.toString(), 10)][control.childMapping] = [];
254
261
  }
255
- childRecords[j][control.childMapping].push(originalData.taskData);
256
- updateParentRow(key, childRecords[j], action, control, isSelfReference, originalData);
262
+ childRecords[parseInt(j.toString(), 10)][control.childMapping].push(originalData.taskData);
263
+ updateParentRow(key, childRecords[parseInt(j.toString(), 10)], action, control, isSelfReference, originalData);
257
264
  }
258
265
  }
259
266
  else if (control.editSettings.newRowPosition === 'Above') {
260
267
  childRecords.splice(j, 0, originalData.taskData);
261
268
  if (!isNullOrUndefined(originalData.parentItem)) {
262
- updateParentRow(key, childRecords[j], action, control, isSelfReference, originalData);
269
+ updateParentRow(key, childRecords[parseInt(j.toString(), 10)], action, control, isSelfReference, originalData);
263
270
  }
264
271
  }
265
272
  else if (control.editSettings.newRowPosition === 'Below') {
266
273
  childRecords.splice(j + 1, 0, originalData.taskData);
267
274
  if (!isNullOrUndefined(originalData.parentItem)) {
268
- updateParentRow(key, childRecords[j], action, control, isSelfReference, originalData);
275
+ updateParentRow(key, childRecords[parseInt(j.toString(), 10)], action, control, isSelfReference, originalData);
269
276
  }
270
277
  }
271
278
  }
@@ -276,9 +283,9 @@ export function removeChildRecords(childRecords, modifiedData, action, key, cont
276
283
  }
277
284
  }
278
285
  }
279
- else if (!isNullOrUndefined(childRecords[j][control.childMapping])) {
280
- if (removeChildRecords(childRecords[j][control.childMapping], modifiedData, action, key, control, isSelfReference, originalData, columnName)) {
281
- updateParentRow(key, childRecords[j], action, control, isSelfReference);
286
+ else if (!isNullOrUndefined(childRecords[parseInt(j.toString(), 10)][control.childMapping])) {
287
+ if (removeChildRecords(childRecords[parseInt(j.toString(), 10)][control.childMapping], modifiedData, action, key, control, isSelfReference, originalData, columnName)) {
288
+ updateParentRow(key, childRecords[parseInt(j.toString(), 10)], action, control, isSelfReference);
282
289
  }
283
290
  }
284
291
  }
@@ -302,7 +309,7 @@ export function updateParentRow(key, record, action, control, isSelfReference, c
302
309
  else {
303
310
  var currentRecords = control.grid.getCurrentViewRecords();
304
311
  var index_1;
305
- currentRecords.map(function (e, i) { if (e[key] === record[key]) {
312
+ currentRecords.map(function (e, i) { if (e["" + key] === record["" + key]) {
306
313
  index_1 = i;
307
314
  return;
308
315
  } });
@@ -311,7 +318,7 @@ export function updateParentRow(key, record, action, control, isSelfReference, c
311
318
  record = updatedParent;
312
319
  }
313
320
  if (!isNullOrUndefined(index_1)) {
314
- record = currentRecords[index_1];
321
+ record = currentRecords[parseInt(index_1.toString(), 10)];
315
322
  }
316
323
  if (control.enableVirtualization && isNullOrUndefined(record) && !isNullOrUndefined(child)) {
317
324
  record = getValue('uniqueIDCollection.' + child.parentUniqueID, control);
@@ -341,18 +348,18 @@ export function updateParentRow(key, record, action, control, isSelfReference, c
341
348
  record.childRecords = [];
342
349
  }
343
350
  else {
344
- if (!isNullOrUndefined(child) && record[key] !== child[key]) {
351
+ if (!isNullOrUndefined(child) && record["" + key] !== child["" + key]) {
345
352
  record.childRecords.push(child);
346
353
  }
347
354
  }
348
- if (record.childRecords.indexOf(childRecords) === -1 && record[key] !== child[key]) {
355
+ if (record.childRecords.indexOf(childRecords) === -1 && record["" + key] !== child["" + key]) {
349
356
  record.childRecords.unshift(childRecords);
350
357
  }
351
358
  if (isSelfReference) {
352
359
  if (!Object.prototype.hasOwnProperty.call(record, control.childMapping)) {
353
360
  record[control.childMapping] = [];
354
361
  }
355
- if (record[control.childMapping].indexOf(childRecords) === -1 && record[key] !== child[key]) {
362
+ if (record["" + control.childMapping].indexOf(childRecords) === -1 && record["" + key] !== child["" + key]) {
356
363
  record[control.childMapping].unshift(childRecords);
357
364
  }
358
365
  }
@@ -362,8 +369,8 @@ export function updateParentRow(key, record, action, control, isSelfReference, c
362
369
  var data = control.grid.dataSource instanceof DataManager ?
363
370
  control.grid.dataSource.dataSource.json : control.grid.dataSource;
364
371
  for (var i = 0; i < data.length; i++) {
365
- if (data[i][primaryKeys] === record[primaryKeys]) {
366
- data[i] = record;
372
+ if (data[parseInt(i.toString(), 10)]["" + primaryKeys] === record["" + primaryKeys]) {
373
+ data[parseInt(i.toString(), 10)] = record;
367
374
  break;
368
375
  }
369
376
  }
@@ -374,7 +381,7 @@ export function updateParentRow(key, record, action, control, isSelfReference, c
374
381
  row = control.getRows()[control.grid.getCurrentViewRecords().indexOf(record)];
375
382
  }
376
383
  else {
377
- row = control.getRows()[control.grid.getRowIndexByPrimaryKey(record[key])];
384
+ row = control.getRows()[control.grid.getRowIndexByPrimaryKey(record["" + key])];
378
385
  }
379
386
  }
380
387
  var movableRow = void 0;
@@ -387,7 +394,7 @@ export function updateParentRow(key, record, action, control, isSelfReference, c
387
394
  index_2 = index_2 + 1;
388
395
  }
389
396
  control.renderModule.cellRender({
390
- data: record, cell: row.cells[index_2] ? row.cells[index_2]
397
+ data: record, cell: row.cells[parseInt(index_2.toString(), 10)] ? row.cells[parseInt(index_2.toString(), 10)]
391
398
  : movableRow.cells[index_2 - control.getFrozenColumns()],
392
399
  column: control.grid.getColumns()[control.treeColumnIndex],
393
400
  requestType: action
@@ -50,16 +50,16 @@ var DetailRow = /** @class */ (function () {
50
50
  };
51
51
  DetailRow.prototype.setIndentVisibility = function (args) {
52
52
  var visible = 'visible';
53
- args[visible] = false;
53
+ args["" + visible] = false;
54
54
  };
55
55
  DetailRow.prototype.dataBoundArg = function () {
56
56
  var detailele = this.parent.getRows().filter(function (e) {
57
57
  return !e.classList.contains('e-detailrow');
58
58
  });
59
59
  for (var i = 0; i < detailele.length; i++) {
60
- var elements = detailele[i].getElementsByClassName('e-detailrowcollapse');
61
- var detailData = this.parent.grid.getRowObjectFromUID(detailele[i].getAttribute('data-Uid'));
62
- var parentItem = getObject('parentItem', this.parent.grid.getCurrentViewRecords()[i]);
60
+ var elements = detailele[parseInt(i.toString(), 10)].getElementsByClassName('e-detailrowcollapse');
61
+ var detailData = this.parent.grid.getRowObjectFromUID(detailele[parseInt(i.toString(), 10)].getAttribute('data-Uid'));
62
+ var parentItem = getObject('parentItem', this.parent.grid.getCurrentViewRecords()[parseInt(i.toString(), 10)]);
63
63
  if (isNullOrUndefined(parentItem) || !isNullOrUndefined(parentItem) &&
64
64
  getExpandStatus(this.parent, detailData.data, this.parent.grid.getCurrentViewRecords())) {
65
65
  this.parent.grid.detailRowModule.expand(elements[0]);
@@ -77,7 +77,7 @@ var DetailRow = /** @class */ (function () {
77
77
  return;
78
78
  }
79
79
  for (var i = 0; i < args.detailrows.length; i++) {
80
- args.detailrows[i].style.display = args.action;
80
+ args.detailrows[parseInt(i.toString(), 10)].style.display = args.action;
81
81
  }
82
82
  };
83
83
  DetailRow.prototype.detaildataBound = function (args) {
@@ -101,11 +101,11 @@ var DetailRow = /** @class */ (function () {
101
101
  }
102
102
  var focusElement = this.parent.grid.contentModule.getRows();
103
103
  for (var i = 0; i < focusElement.length; i++) {
104
- focusElement[i].cells[0].visible = false;
104
+ focusElement[parseInt(i.toString(), 10)].cells[0].visible = false;
105
105
  }
106
106
  var focusModule = getObject('focusModule', this.parent.grid);
107
107
  var matrix = 'refreshMatrix';
108
- focusModule[matrix](true)({ rows: this.parent.grid.contentModule.getRows() });
108
+ focusModule["" + matrix](true)({ rows: this.parent.grid.contentModule.getRows() });
109
109
  };
110
110
  /**
111
111
  * Destroys the DetailModule.