@syncfusion/ej2-treegrid 20.1.55 → 20.1.56-97113
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.
- package/.eslintrc.json +16 -1
- package/CHANGELOG.md +15 -32
- package/README.md +64 -51
- package/dist/ej2-treegrid.min.js +1 -0
- package/dist/ej2-treegrid.umd.min.js +1 -10
- package/dist/ej2-treegrid.umd.min.js.map +1 -1
- package/dist/es6/ej2-treegrid.es2015.js +2046 -1076
- package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
- package/dist/es6/ej2-treegrid.es5.js +2131 -1113
- package/dist/es6/ej2-treegrid.es5.js.map +1 -1
- package/dist/global/ej2-treegrid.min.js +1 -10
- package/dist/global/ej2-treegrid.min.js.map +1 -1
- package/dist/global/index.d.ts +0 -9
- package/helpers/e2e/index.js +8 -6
- package/helpers/e2e/treegridhelper.js +82 -65
- package/package.json +64 -64
- package/src/treegrid/actions/batch-edit.js +115 -87
- package/src/treegrid/actions/clipboard.d.ts +3 -2
- package/src/treegrid/actions/clipboard.js +37 -35
- package/src/treegrid/actions/context-menu.js +53 -1
- package/src/treegrid/actions/crud-actions.js +67 -56
- package/src/treegrid/actions/detail-row.js +7 -7
- package/src/treegrid/actions/edit.d.ts +1 -0
- package/src/treegrid/actions/edit.js +168 -115
- package/src/treegrid/actions/excel-export.js +2 -2
- package/src/treegrid/actions/filter.js +13 -16
- package/src/treegrid/actions/freeze-column.d.ts +1 -0
- package/src/treegrid/actions/freeze-column.js +48 -11
- package/src/treegrid/actions/infinite-scroll.js +25 -22
- package/src/treegrid/actions/logger.js +10 -10
- package/src/treegrid/actions/page.d.ts +1 -0
- package/src/treegrid/actions/page.js +21 -8
- package/src/treegrid/actions/reorder.js +2 -2
- package/src/treegrid/actions/rowdragdrop.js +142 -86
- package/src/treegrid/actions/selection.d.ts +1 -0
- package/src/treegrid/actions/selection.js +71 -39
- package/src/treegrid/actions/sort.js +17 -5
- package/src/treegrid/actions/summary.js +24 -24
- package/src/treegrid/actions/toolbar.js +45 -43
- package/src/treegrid/actions/virtual-scroll.js +7 -4
- package/src/treegrid/base/constant.d.ts +30 -0
- package/src/treegrid/base/constant.js +30 -0
- package/src/treegrid/base/data.d.ts +1 -0
- package/src/treegrid/base/data.js +257 -57
- package/src/treegrid/base/treegrid-model.d.ts +50 -34
- package/src/treegrid/base/treegrid.d.ts +57 -35
- package/src/treegrid/base/treegrid.js +363 -200
- package/src/treegrid/enum.d.ts +8 -2
- package/src/treegrid/enum.js +2 -0
- package/src/treegrid/models/column.d.ts +6 -6
- package/src/treegrid/models/column.js +9 -9
- package/src/treegrid/models/index.d.ts +2 -0
- package/src/treegrid/models/index.js +1 -0
- package/src/treegrid/models/loading-indicator-model.d.ts +20 -0
- package/src/treegrid/models/loading-indicator.d.ts +17 -0
- package/src/treegrid/models/loading-indicator.js +34 -0
- package/src/treegrid/renderer/render.d.ts +4 -4
- package/src/treegrid/renderer/render.js +33 -24
- package/src/treegrid/renderer/virtual-row-model-generator.js +15 -6
- package/src/treegrid/renderer/virtual-tree-content-render.d.ts +5 -2
- package/src/treegrid/renderer/virtual-tree-content-render.js +224 -106
- package/src/treegrid/renderer/virtual-tree-freeze-render.d.ts +59 -0
- package/src/treegrid/renderer/virtual-tree-freeze-render.js +163 -0
- package/src/treegrid/utils.js +13 -12
- package/styles/bootstrap-dark.css +14 -1
- package/styles/bootstrap.css +14 -1
- package/styles/bootstrap4.css +14 -1
- package/styles/bootstrap5-dark.css +16 -2
- package/styles/bootstrap5.css +16 -2
- package/styles/fabric-dark.css +14 -1
- package/styles/fabric.css +14 -1
- package/styles/fluent-dark.css +15 -2
- package/styles/fluent.css +15 -2
- package/styles/highcontrast-light.css +14 -1
- package/styles/highcontrast.css +14 -1
- package/styles/material-dark.css +14 -1
- package/styles/material.css +14 -1
- package/styles/tailwind-dark.css +14 -1
- package/styles/tailwind.css +14 -1
- package/styles/treegrid/_all.scss +1 -1
- package/styles/treegrid/_bootstrap-dark-definition.scss +1 -1
- package/styles/treegrid/_bootstrap-definition.scss +1 -2
- package/styles/treegrid/_bootstrap4-definition.scss +0 -1
- package/styles/treegrid/_bootstrap5-definition.scss +0 -1
- package/styles/treegrid/_fabric-dark-definition.scss +1 -2
- package/styles/treegrid/_fabric-definition.scss +1 -2
- package/styles/treegrid/_fluent-definition.scss +0 -1
- package/styles/treegrid/_fusionnew-definition.scss +28 -0
- package/styles/treegrid/_highcontrast-definition.scss +0 -1
- package/styles/treegrid/_highcontrast-light-definition.scss +0 -2
- package/styles/treegrid/_icons.scss +12 -1
- package/styles/treegrid/_layout.scss +4 -4
- package/styles/treegrid/_material-definition.scss +0 -1
- package/styles/treegrid/_material3-definition.scss +28 -0
- package/styles/treegrid/_tailwind-definition.scss +0 -1
- package/styles/treegrid/_theme.scss +1 -0
- package/styles/treegrid/bootstrap-dark.css +14 -1
- package/styles/treegrid/bootstrap.css +14 -1
- package/styles/treegrid/bootstrap4.css +14 -1
- package/styles/treegrid/bootstrap5-dark.css +16 -2
- package/styles/treegrid/bootstrap5.css +16 -2
- package/styles/treegrid/fabric-dark.css +14 -1
- package/styles/treegrid/fabric.css +14 -1
- package/styles/treegrid/fluent-dark.css +15 -2
- package/styles/treegrid/fluent.css +15 -2
- package/styles/treegrid/highcontrast-light.css +14 -1
- package/styles/treegrid/highcontrast.css +14 -1
- package/styles/treegrid/icons/_bootstrap-dark.scss +12 -1
- package/styles/treegrid/icons/_bootstrap.scss +12 -1
- package/styles/treegrid/icons/_bootstrap4.scss +12 -1
- package/styles/treegrid/icons/_bootstrap5.scss +11 -0
- package/styles/treegrid/icons/_fabric-dark.scss +12 -1
- package/styles/treegrid/icons/_fabric.scss +12 -1
- package/styles/treegrid/icons/_fluent.scss +11 -0
- package/styles/treegrid/icons/_fusionnew.scss +26 -0
- package/styles/treegrid/icons/_highcontrast-light.scss +12 -1
- package/styles/treegrid/icons/_highcontrast.scss +11 -0
- package/styles/treegrid/icons/_material-dark.scss +12 -1
- package/styles/treegrid/icons/_material.scss +11 -0
- package/styles/treegrid/icons/_material3.scss +26 -0
- package/styles/treegrid/icons/_tailwind-dark.scss +11 -0
- package/styles/treegrid/icons/_tailwind.scss +11 -0
- package/styles/treegrid/material-dark.css +14 -1
- package/styles/treegrid/material.css +14 -1
- package/styles/treegrid/tailwind-dark.css +14 -1
- package/styles/treegrid/tailwind.css +14 -1
|
@@ -129,7 +129,7 @@ var DataManipulation = /** @class */ (function () {
|
|
|
129
129
|
else {
|
|
130
130
|
var keys = Object.keys(data);
|
|
131
131
|
for (var i = 0; i < keys.length; i++) {
|
|
132
|
-
var tempData = data[i];
|
|
132
|
+
var tempData = data[parseInt(i.toString(), 10)];
|
|
133
133
|
this.hierarchyData.push(extend({}, tempData));
|
|
134
134
|
if (!isNullOrUndefined(tempData[this.parent.idMapping])) {
|
|
135
135
|
this.taskIds.push(tempData[this.parent.idMapping]);
|
|
@@ -141,12 +141,12 @@ var DataManipulation = /** @class */ (function () {
|
|
|
141
141
|
var mappingData = new DataManager(this.hierarchyData).executeLocal(new Query()
|
|
142
142
|
.group(this.parent.parentIdMapping));
|
|
143
143
|
for (var i = 0; i < mappingData.length; i++) {
|
|
144
|
-
var groupData = mappingData[i];
|
|
144
|
+
var groupData = mappingData[parseInt(i.toString(), 10)];
|
|
145
145
|
var index = this.taskIds.indexOf(groupData.key);
|
|
146
146
|
if (!isNullOrUndefined(groupData.key)) {
|
|
147
147
|
if (index > -1) {
|
|
148
148
|
var childData = (groupData.items);
|
|
149
|
-
this.hierarchyData[index][this.parent.childMapping] = childData;
|
|
149
|
+
this.hierarchyData[parseInt(index.toString(), 10)][this.parent.childMapping] = childData;
|
|
150
150
|
continue;
|
|
151
151
|
}
|
|
152
152
|
}
|
|
@@ -156,7 +156,7 @@ var DataManipulation = /** @class */ (function () {
|
|
|
156
156
|
}
|
|
157
157
|
if (!Object.keys(this.hierarchyData).length) {
|
|
158
158
|
var isGantt = 'isGantt';
|
|
159
|
-
var referenceData = !(this.parent.dataSource instanceof DataManager) && this.parent[isGantt];
|
|
159
|
+
var referenceData = !(this.parent.dataSource instanceof DataManager) && this.parent["" + isGantt];
|
|
160
160
|
this.parent.flatData = referenceData ? (this.parent.dataSource) : [];
|
|
161
161
|
}
|
|
162
162
|
else {
|
|
@@ -196,7 +196,14 @@ var DataManipulation = /** @class */ (function () {
|
|
|
196
196
|
* @returns {void}
|
|
197
197
|
*/
|
|
198
198
|
DataManipulation.prototype.updateParentRemoteData = function (args) {
|
|
199
|
+
var actionArgs = 'actionArgs';
|
|
200
|
+
if (isRemoteData(this.parent) && this.parent.enableVirtualization && args["" + actionArgs].requestType === 'virtualscroll') {
|
|
201
|
+
this.parent.hideSpinner();
|
|
202
|
+
}
|
|
199
203
|
var records = args.result;
|
|
204
|
+
if (isRemoteData(this.parent) && this.parent.enableVirtualization && (args["" + actionArgs].requestType === 'virtualscroll' || args["" + actionArgs].action === 'clearFilter' || args["" + actionArgs].searchString === '')) {
|
|
205
|
+
this.parent.query.expands = [];
|
|
206
|
+
}
|
|
200
207
|
if (!this.parent.hasChildMapping && !this.parentItems.length &&
|
|
201
208
|
(!this.parent.loadChildOnDemand)) {
|
|
202
209
|
this.zerothLevelData = args;
|
|
@@ -204,31 +211,72 @@ var DataManipulation = /** @class */ (function () {
|
|
|
204
211
|
}
|
|
205
212
|
else {
|
|
206
213
|
if (!this.parent.loadChildOnDemand) {
|
|
207
|
-
|
|
208
|
-
if (isCountRequired(
|
|
209
|
-
|
|
214
|
+
var _loop_1 = function (rec) {
|
|
215
|
+
if (isCountRequired(this_1.parent) && records[parseInt(rec.toString(), 10)].hasChildRecords &&
|
|
216
|
+
this_1.parent.initialRender) {
|
|
217
|
+
records[parseInt(rec.toString(), 10)].expanded = false;
|
|
218
|
+
}
|
|
219
|
+
if (isRemoteData(this_1.parent) && this_1.parent.enableVirtualization) {
|
|
220
|
+
var childRecords_1 = [];
|
|
221
|
+
var parent_1 = this_1.parent;
|
|
222
|
+
records.filter(function (e) {
|
|
223
|
+
if (e["" + parent_1.parentIdMapping] === records[parseInt(rec.toString(), 10)]["" + parent_1.idMapping]) {
|
|
224
|
+
childRecords_1.push(e);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
if (childRecords_1.length) {
|
|
228
|
+
records[parseInt(rec.toString(), 10)].expanded = true;
|
|
229
|
+
}
|
|
230
|
+
else if (records[parseInt(rec.toString(), 10)].hasChildRecords) {
|
|
231
|
+
records[parseInt(rec.toString(), 10)].expanded = false;
|
|
232
|
+
}
|
|
210
233
|
}
|
|
211
|
-
if (isNullOrUndefined(records[rec].index)) {
|
|
212
|
-
records[rec].taskData = extend({}, records[rec]);
|
|
213
|
-
records[rec].uniqueID = getUid(
|
|
214
|
-
setValue('uniqueIDCollection.' + records[rec].uniqueID, records[rec],
|
|
215
|
-
records[rec].level = 0;
|
|
216
|
-
records[rec].
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
234
|
+
if (isNullOrUndefined(records[parseInt(rec.toString(), 10)].index)) {
|
|
235
|
+
records[parseInt(rec.toString(), 10)].taskData = extend({}, records[parseInt(rec.toString(), 10)]);
|
|
236
|
+
records[parseInt(rec.toString(), 10)].uniqueID = getUid(this_1.parent.element.id + '_data_');
|
|
237
|
+
setValue('uniqueIDCollection.' + records[parseInt(rec.toString(), 10)].uniqueID, records[parseInt(rec.toString(), 10)], this_1.parent);
|
|
238
|
+
records[parseInt(rec.toString(), 10)].level = 0;
|
|
239
|
+
if (isRemoteData(this_1.parent) && this_1.parent.enableVirtualization && records[parseInt(rec.toString(), 10)]["" + this_1.parent.parentIdMapping] && records[parseInt(rec.toString(), 10)].level === 0) {
|
|
240
|
+
records[parseInt(rec.toString(), 10)].level = records[parseInt(rec.toString(), 10)].level + 1;
|
|
241
|
+
}
|
|
242
|
+
records[parseInt(rec.toString(), 10)].index = Math.ceil(Math.random() * 1000);
|
|
243
|
+
if ((records[parseInt(rec.toString(), 10)][this_1.parent.hasChildMapping] ||
|
|
244
|
+
this_1.parentItems.indexOf(records[parseInt(rec.toString(), 10)][this_1.parent.idMapping]) !== -1)) {
|
|
245
|
+
records[parseInt(rec.toString(), 10)].hasChildRecords = true;
|
|
220
246
|
}
|
|
221
|
-
records[rec].checkboxState = 'uncheck';
|
|
247
|
+
records[parseInt(rec.toString(), 10)].checkboxState = 'uncheck';
|
|
222
248
|
}
|
|
249
|
+
};
|
|
250
|
+
var this_1 = this;
|
|
251
|
+
for (var rec = 0; rec < records.length; rec++) {
|
|
252
|
+
_loop_1(rec);
|
|
223
253
|
}
|
|
224
254
|
}
|
|
225
255
|
else {
|
|
226
|
-
|
|
256
|
+
var dataResults = 'dataResults';
|
|
257
|
+
var expandRecord = 'expandRecord';
|
|
258
|
+
if (!isNullOrUndefined(records) && !((this.parent.loadChildOnDemand) && isCountRequired(this.parent) && !isNullOrUndefined(this.parent["" + dataResults]["" + expandRecord])) &&
|
|
259
|
+
!(isRemoteData(this.parent) && this.parent.loadChildOnDemand && args["" + actionArgs].isExpandCollapse && this.parent.enableVirtualization)) {
|
|
227
260
|
this.convertToFlatData(records);
|
|
228
261
|
}
|
|
229
262
|
}
|
|
230
263
|
}
|
|
231
|
-
|
|
264
|
+
if (isRemoteData(this.parent) && this.parent.loadChildOnDemand && args["" + actionArgs].isExpandCollapse && this.parent.enableVirtualization) {
|
|
265
|
+
args.result = records;
|
|
266
|
+
}
|
|
267
|
+
else if (isRemoteData(this.parent) && this.parent.enableVirtualization && !this.parent.loadChildOnDemand) {
|
|
268
|
+
args.result = records;
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
args.result = this.parent.loadChildOnDemand ? this.parent.flatData : records;
|
|
272
|
+
}
|
|
273
|
+
if (isRemoteData(this.parent) && this.parent.enableVirtualization && this.parent.loadChildOnDemand
|
|
274
|
+
&& this.parent.grid.aggregates.length && this.parent.grid.sortSettings.columns.length === 0
|
|
275
|
+
&& this.parent.grid.filterSettings.columns.length === 0 && !this.parent.grid.searchSettings.key.length) {
|
|
276
|
+
var query = 'query';
|
|
277
|
+
var summaryQuery = args["" + query].queries.filter(function (q) { return q.fn === 'onAggregates'; });
|
|
278
|
+
args.result = this.parent.summaryModule.calculateSummaryValue(summaryQuery, this.parent.flatData, true);
|
|
279
|
+
}
|
|
232
280
|
this.parent.notify('updateResults', args);
|
|
233
281
|
};
|
|
234
282
|
/**
|
|
@@ -244,6 +292,7 @@ var DataManipulation = /** @class */ (function () {
|
|
|
244
292
|
*/
|
|
245
293
|
DataManipulation.prototype.collectExpandingRecs = function (rowDetails, isChild) {
|
|
246
294
|
var gridRows = this.parent.getRows();
|
|
295
|
+
var name = 'name';
|
|
247
296
|
if (this.parent.rowTemplate) {
|
|
248
297
|
var rows = this.parent.getContentTable().rows;
|
|
249
298
|
gridRows = [].slice.call(rows);
|
|
@@ -254,11 +303,12 @@ var DataManipulation = /** @class */ (function () {
|
|
|
254
303
|
rowDetails.record.expanded = true;
|
|
255
304
|
}
|
|
256
305
|
for (var i = 0; i < rowDetails.rows.length; i++) {
|
|
257
|
-
rowDetails.rows[i].style.display = 'table-row';
|
|
306
|
+
rowDetails.rows[parseInt(i.toString(), 10)].style.display = 'table-row';
|
|
258
307
|
if (this.parent.loadChildOnDemand) {
|
|
259
|
-
var targetEle = rowDetails.rows[i].getElementsByClassName('e-treegridcollapse')[0];
|
|
260
|
-
childRecord = this.parent.rowTemplate ?
|
|
261
|
-
this.parent.grid.
|
|
308
|
+
var targetEle = rowDetails.rows[parseInt(i.toString(), 10)].getElementsByClassName('e-treegridcollapse')[0];
|
|
309
|
+
childRecord = this.parent.rowTemplate ?
|
|
310
|
+
this.parent.grid.getCurrentViewRecords()[rowDetails.rows[parseInt(i.toString(), 10)].rowIndex] :
|
|
311
|
+
this.parent.grid.getRowObjectFromUID(rowDetails.rows[parseInt(i.toString(), 10)].getAttribute('data-Uid')).data;
|
|
262
312
|
if (!isNullOrUndefined(targetEle) && childRecord.expanded) {
|
|
263
313
|
addClass([targetEle], 'e-treegridexpand');
|
|
264
314
|
removeClass([targetEle], 'e-treegridcollapse');
|
|
@@ -271,14 +321,14 @@ var DataManipulation = /** @class */ (function () {
|
|
|
271
321
|
this.collectExpandingRecs({ record: childRecord, rows: childRows, parentRow: rowDetails.parentRow }, true);
|
|
272
322
|
}
|
|
273
323
|
}
|
|
274
|
-
var expandingTd = rowDetails.rows[i].querySelector('.e-detailrowcollapse');
|
|
324
|
+
var expandingTd = rowDetails.rows[parseInt(i.toString(), 10)].querySelector('.e-detailrowcollapse');
|
|
275
325
|
if (!isNullOrUndefined(expandingTd)) {
|
|
276
326
|
this.parent.grid.detailRowModule.expand(expandingTd);
|
|
277
327
|
}
|
|
278
328
|
}
|
|
279
329
|
}
|
|
280
330
|
else {
|
|
281
|
-
this.fetchRemoteChildData({ record: rowDetails.record, rows: rowDetails.rows, parentRow: rowDetails.parentRow });
|
|
331
|
+
this.fetchRemoteChildData({ action: rowDetails["" + name], record: rowDetails.record, rows: rowDetails.rows, parentRow: rowDetails.parentRow });
|
|
282
332
|
}
|
|
283
333
|
};
|
|
284
334
|
DataManipulation.prototype.fetchRemoteChildData = function (rowDetails) {
|
|
@@ -289,11 +339,32 @@ var DataManipulation = /** @class */ (function () {
|
|
|
289
339
|
var clonequries = qry.queries.filter(function (e) { return e.fn !== 'onPage' && e.fn !== 'onWhere'; });
|
|
290
340
|
qry.queries = clonequries;
|
|
291
341
|
qry.isCountRequired = true;
|
|
342
|
+
if (this.parent.enableVirtualization && rowDetails.action === 'remoteExpand') {
|
|
343
|
+
qry.take(this.parent.pageSettings.pageSize);
|
|
344
|
+
var expandDetail = [];
|
|
345
|
+
expandDetail.push('ExpandingAction', rowDetails.record[this.parent.idMapping]);
|
|
346
|
+
qry.expand(expandDetail);
|
|
347
|
+
}
|
|
348
|
+
else if (this.parent.enableVirtualization && rowDetails.action === 'collapse') {
|
|
349
|
+
qry.take(this.parent.grid.pageSettings.pageSize);
|
|
350
|
+
var expandDetail = [];
|
|
351
|
+
expandDetail.push('CollapsingAction', rowDetails.record[this.parent.idMapping]);
|
|
352
|
+
qry.expand(expandDetail);
|
|
353
|
+
}
|
|
292
354
|
qry.where(this.parent.parentIdMapping, 'equal', rowDetails.record[this.parent.idMapping]);
|
|
293
355
|
showSpinner(this.parent.element);
|
|
294
356
|
dm.executeQuery(qry).then(function (e) {
|
|
357
|
+
var remoteExpandedData = 'remoteExpandedData';
|
|
358
|
+
var remoteCollapsedData = 'remoteCollapsedData';
|
|
359
|
+
var level = 'level';
|
|
295
360
|
var datas = _this.parent.grid.currentViewData.slice();
|
|
296
361
|
var inx = datas.indexOf(rowDetails.record);
|
|
362
|
+
if (_this.parent.enableVirtualization && (rowDetails.action === 'collapse' || rowDetails.action === 'remoteExpand')) {
|
|
363
|
+
datas = [];
|
|
364
|
+
for (var i = 0; i < inx; i++) {
|
|
365
|
+
datas.push(_this.parent.grid.currentViewData[parseInt(i.toString(), 10)]);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
297
368
|
if (inx === -1) {
|
|
298
369
|
_this.parent.grid.getRowsObject().forEach(function (rows) {
|
|
299
370
|
if (rows.data.uniqueID === rowDetails.record.uniqueID) {
|
|
@@ -305,23 +376,107 @@ var DataManipulation = /** @class */ (function () {
|
|
|
305
376
|
var result = e.result;
|
|
306
377
|
rowDetails.record.childRecords = result;
|
|
307
378
|
for (var r = 0; r < result.length; r++) {
|
|
308
|
-
result[r
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
379
|
+
if (_this.parent.enableVirtualization && result[parseInt(r.toString(), 10)]["" + _this.parent.idMapping] === rowDetails.record["" + _this.parent.idMapping] && rowDetails.action === 'remoteExpand') {
|
|
380
|
+
_this.parent["" + remoteExpandedData].push(rowDetails.record);
|
|
381
|
+
}
|
|
382
|
+
else if (_this.parent.enableVirtualization && result[parseInt(r.toString(), 10)]["" + _this.parent.idMapping] === rowDetails.record["" + _this.parent.idMapping] && rowDetails.action === 'collapse') {
|
|
383
|
+
for (var i = 0; i < _this.parent["" + remoteExpandedData].length; i++) {
|
|
384
|
+
if (rowDetails.record["" + _this.parent.idMapping] === _this.parent["" + remoteExpandedData][parseInt(i.toString(), 10)]["" + _this.parent.idMapping]) {
|
|
385
|
+
_this.parent["" + remoteExpandedData].splice(i, 1);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
result[parseInt(r.toString(), 10)].taskData = extend({}, result[parseInt(r.toString(), 10)]);
|
|
390
|
+
if (result[parseInt(r.toString(), 10)]["" + _this.parent.parentIdMapping] && _this.parent.enableVirtualization && _this.parent["" + remoteExpandedData].length) {
|
|
391
|
+
for (var i = 0; i < _this.parent["" + remoteExpandedData].length; i++) {
|
|
392
|
+
if (result[parseInt(r.toString(), 10)]["" + _this.parent.parentIdMapping] === _this.parent["" + remoteExpandedData][parseInt(i.toString(), 10)]["" + _this.parent.idMapping]) {
|
|
393
|
+
result[parseInt(r.toString(), 10)].level = _this.parent["" + remoteExpandedData][parseInt(i.toString(), 10)]["" + level] + 1;
|
|
394
|
+
var parentData = _this.parent["" + remoteExpandedData][parseInt(i.toString(), 10)];
|
|
395
|
+
result[parseInt(r.toString(), 10)].parentItem = parentData;
|
|
396
|
+
result[parseInt(r.toString(), 10)].parentUniqueID = rowDetails.record.uniqueID;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
else if (_this.parent.enableVirtualization) {
|
|
401
|
+
if ((result[parseInt(r.toString(), 10)]["" + _this.parent.hasChildMapping] ||
|
|
402
|
+
_this.parentItems.indexOf(result[parseInt(r.toString(), 10)]["" + _this.parent.idMapping]) !== -1)
|
|
403
|
+
&& !(haveChild && !haveChild[parseInt(r.toString(), 10)])) {
|
|
404
|
+
if (isNullOrUndefined(result[parseInt(r.toString(), 10)]["" + _this.parent.parentIdMapping])) {
|
|
405
|
+
result[parseInt(r.toString(), 10)].level = 0;
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
result[parseInt(r.toString(), 10)].level = rowDetails.record.level;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
var parentData = extend({}, rowDetails.record);
|
|
413
|
+
delete parentData.childRecords;
|
|
414
|
+
result[parseInt(r.toString(), 10)].parentItem = parentData;
|
|
415
|
+
result[parseInt(r.toString(), 10)].parentUniqueID = rowDetails.record.uniqueID;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
result[parseInt(r.toString(), 10)].level = rowDetails.record.level + 1;
|
|
420
|
+
var parentData = extend({}, rowDetails.record);
|
|
421
|
+
delete parentData.childRecords;
|
|
422
|
+
result[parseInt(r.toString(), 10)].parentItem = parentData;
|
|
423
|
+
result[parseInt(r.toString(), 10)].parentUniqueID = rowDetails.record.uniqueID;
|
|
424
|
+
}
|
|
425
|
+
result[parseInt(r.toString(), 10)].index = Math.ceil(Math.random() * 1000);
|
|
426
|
+
result[parseInt(r.toString(), 10)].uniqueID = getUid(_this.parent.element.id + '_data_');
|
|
427
|
+
result[parseInt(r.toString(), 10)].checkboxState = 'uncheck';
|
|
428
|
+
if (_this.parent.enableVirtualization && isNullOrUndefined(result[parseInt(r.toString(), 10)].level)) {
|
|
429
|
+
for (var p = 0; p < _this.parent.grid.currentViewData.length; p++) {
|
|
430
|
+
if (_this.parent.grid.currentViewData[parseInt(p.toString(), 10)]["" + _this.parent.idMapping] === result[parseInt(r.toString(), 10)]["" + _this.parent.parentIdMapping]) {
|
|
431
|
+
result[parseInt(r.toString(), 10)].level = _this.parent.grid.currentViewData[parseInt(p.toString(), 10)]['level'] + 1;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
setValue('uniqueIDCollection.' + result[parseInt(r.toString(), 10)].uniqueID, result[parseInt(r.toString(), 10)], _this.parent);
|
|
318
436
|
// delete result[r].parentItem.childRecords;
|
|
319
|
-
if ((result[r][_this.parent.hasChildMapping] ||
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
result[r].
|
|
437
|
+
if ((result[parseInt(r.toString(), 10)]["" + _this.parent.hasChildMapping] ||
|
|
438
|
+
_this.parentItems.indexOf(result[parseInt(r.toString(), 10)]["" + _this.parent.idMapping]) !== -1)
|
|
439
|
+
&& !(haveChild && !haveChild[parseInt(r.toString(), 10)])) {
|
|
440
|
+
result[parseInt(r.toString(), 10)].hasChildRecords = true;
|
|
441
|
+
if (_this.parent.enableVirtualization && _this.parent.loadChildOnDemand) {
|
|
442
|
+
for (var i = 0; i < _this.parent["" + remoteCollapsedData].length; i++) {
|
|
443
|
+
if (result[parseInt(r.toString(), 10)]["" + _this.parent.idMapping] === _this.parent["" + remoteCollapsedData][parseInt(i.toString(), 10)]["" + _this.parent.idMapping]) {
|
|
444
|
+
result[parseInt(r.toString(), 10)].expanded = _this.parent["" + remoteCollapsedData][parseInt(i.toString(), 10)]['expanded'];
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
if (rowDetails.action === 'collapse' && result[parseInt(r.toString(), 10)]["" + _this.parent.idMapping] !== rowDetails.record["" + _this.parent.idMapping] && result[parseInt(r.toString(), 10)].expanded !== false) {
|
|
448
|
+
result[parseInt(r.toString(), 10)].expanded = true;
|
|
449
|
+
}
|
|
450
|
+
else if (rowDetails.action === 'collapse' && result[parseInt(r.toString(), 10)]["" + _this.parent.idMapping] === rowDetails.record["" + _this.parent.idMapping]) {
|
|
451
|
+
result[parseInt(r.toString(), 10)].expanded = false;
|
|
452
|
+
_this.parent["" + remoteCollapsedData].push(rowDetails.record);
|
|
453
|
+
}
|
|
454
|
+
else if (rowDetails.action === 'remoteExpand') {
|
|
455
|
+
for (var i = 0; i < _this.parent.grid.currentViewData.length; i++) {
|
|
456
|
+
if (_this.parent.grid.currentViewData[parseInt(i.toString(), 10)]["" + _this.parent.idMapping] === result[parseInt(r.toString(), 10)]["" + _this.parent.idMapping]) {
|
|
457
|
+
result.splice(r, 1, _this.parent.grid.currentViewData[parseInt(i.toString(), 10)]);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
if (result[parseInt(r.toString(), 10)][_this.parent.idMapping] === rowDetails.record["" + _this.parent.idMapping]) {
|
|
461
|
+
for (var i = 0; i < _this.parent["" + remoteCollapsedData].length; i++) {
|
|
462
|
+
if (rowDetails.record["" + _this.parent.idMapping] === _this.parent["" + remoteCollapsedData][parseInt(i.toString(), 10)]["" + _this.parent.idMapping]) {
|
|
463
|
+
_this.parent["" + remoteCollapsedData].splice(i, 1);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
if (result[parseInt(r.toString(), 10)].expanded !== false) {
|
|
468
|
+
result[parseInt(r.toString(), 10)].expanded = true;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
else if (_this.parent.enableVirtualization && result[parseInt(r.toString(), 10)]["" + _this.parent.idMapping] === rowDetails.record["" + _this.parent.idMapping] && rowDetails.action !== 'collapse') {
|
|
473
|
+
result[parseInt(r.toString(), 10)].expanded = true;
|
|
474
|
+
}
|
|
475
|
+
else if (!(_this.parent.enableVirtualization && _this.parent.loadChildOnDemand)) {
|
|
476
|
+
result[parseInt(r.toString(), 10)].expanded = false;
|
|
477
|
+
}
|
|
323
478
|
}
|
|
324
|
-
datas.splice(inx + r + 1, 0, result[r]);
|
|
479
|
+
datas.splice(inx + r + 1, 0, result[parseInt(r.toString(), 10)]);
|
|
325
480
|
}
|
|
326
481
|
setValue('result', datas, e);
|
|
327
482
|
setValue('action', 'beforecontentrender', e);
|
|
@@ -335,9 +490,12 @@ var DataManipulation = /** @class */ (function () {
|
|
|
335
490
|
}
|
|
336
491
|
if (!isNullOrUndefined(gridQuery)) {
|
|
337
492
|
var summaryQuery = gridQuery.queries.filter(function (q) { return q.fn === 'onAggregates'; });
|
|
338
|
-
e[result_1] = _this.parent.summaryModule.calculateSummaryValue(summaryQuery, e[result_1], true);
|
|
493
|
+
e["" + result_1] = _this.parent.summaryModule.calculateSummaryValue(summaryQuery, e["" + result_1], true);
|
|
339
494
|
}
|
|
340
495
|
}
|
|
496
|
+
if (_this.parent.enableVirtualization) {
|
|
497
|
+
_this.parent.grid.pageSettings.totalRecordsCount = e.count;
|
|
498
|
+
}
|
|
341
499
|
e.count = _this.parent.grid.pageSettings.totalRecordsCount;
|
|
342
500
|
var virtualArgs = {};
|
|
343
501
|
if (_this.parent.enableVirtualization) {
|
|
@@ -365,20 +523,29 @@ var DataManipulation = /** @class */ (function () {
|
|
|
365
523
|
};
|
|
366
524
|
DataManipulation.prototype.beginSorting = function () {
|
|
367
525
|
this.isSortAction = true;
|
|
526
|
+
if (isRemoteData(this.parent) && this.parent.enableVirtualization) {
|
|
527
|
+
var index = this.parent.query.queries.indexOf(this.parent.query.queries.filter(function (q) { return q.fn === 'onSortBy'; })[0]);
|
|
528
|
+
if (index !== -1) {
|
|
529
|
+
this.parent.query.queries.splice(index, 1);
|
|
530
|
+
}
|
|
531
|
+
if (this.parent.grid.sortSettings.columns.length === 0) {
|
|
532
|
+
this.parent.query.sortBy(null, null);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
368
535
|
};
|
|
369
536
|
DataManipulation.prototype.createRecords = function (data, parentRecords) {
|
|
370
537
|
var treeGridData = [];
|
|
371
538
|
var keys = Object.keys(data);
|
|
372
539
|
for (var i = 0, len = keys.length; i < len; i++) {
|
|
373
|
-
var currentData = extend({}, data[i]);
|
|
374
|
-
currentData.taskData = data[i];
|
|
540
|
+
var currentData = extend({}, data[parseInt(i.toString(), 10)]);
|
|
541
|
+
currentData.taskData = data[parseInt(i.toString(), 10)];
|
|
375
542
|
var level = 0;
|
|
376
543
|
this.storedIndex++;
|
|
377
544
|
if (!Object.prototype.hasOwnProperty.call(currentData, 'index')) {
|
|
378
545
|
currentData.index = this.storedIndex;
|
|
379
546
|
}
|
|
380
|
-
if (!isNullOrUndefined(currentData[this.parent.childMapping]) ||
|
|
381
|
-
(currentData[this.parent.hasChildMapping] && isCountRequired(this.parent))) {
|
|
547
|
+
if ((!isNullOrUndefined(currentData[this.parent.childMapping]) && !isCountRequired(this.parent)) ||
|
|
548
|
+
((currentData[this.parent.hasChildMapping]) && isCountRequired(this.parent))) {
|
|
382
549
|
currentData.hasChildRecords = true;
|
|
383
550
|
if (this.parent.enableCollapseAll || !isNullOrUndefined(this.parent.dataStateChange)
|
|
384
551
|
&& isNullOrUndefined(currentData[this.parent.childMapping])) {
|
|
@@ -412,8 +579,29 @@ var DataManipulation = /** @class */ (function () {
|
|
|
412
579
|
currentData.level = level;
|
|
413
580
|
}
|
|
414
581
|
currentData.checkboxState = 'uncheck';
|
|
415
|
-
|
|
582
|
+
var remoteCollapsedData = 'remoteCollapsedData';
|
|
583
|
+
if (this.parent.enableVirtualization && this.parent.loadChildOnDemand && isRemoteData(this.parent)
|
|
584
|
+
&& !this.parent.initialRender) {
|
|
585
|
+
if (!currentData.hasChildRecords && isNullOrUndefined(currentData["" + this.parent.parentIdMapping])) {
|
|
586
|
+
currentData.hasChildRecords = true;
|
|
587
|
+
for (var c = 0; c < this.parent["" + remoteCollapsedData].length; c++) {
|
|
588
|
+
if (this.parent["" + remoteCollapsedData][parseInt(c.toString(), 10)]["" + this.parent.idMapping] === currentData["" + this.parent.idMapping]) {
|
|
589
|
+
currentData.expanded = false;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
else if (currentData.level === 0 && isNullOrUndefined(parentRecords) && !currentData.hasChildRecords) {
|
|
594
|
+
currentData.level = currentData.level + 1;
|
|
595
|
+
}
|
|
596
|
+
if (currentData["" + this.parent.hasChildMapping] && !isNullOrUndefined(currentData["" + this.parent.expandStateMapping])) {
|
|
597
|
+
currentData.expanded = currentData["" + this.parent.expandStateMapping];
|
|
598
|
+
currentData.hasChildRecords = true;
|
|
599
|
+
}
|
|
600
|
+
this.parent.flatData.push(currentData);
|
|
601
|
+
}
|
|
602
|
+
else if (isNullOrUndefined(currentData["" + this.parent.parentIdMapping]) || currentData.parentItem) {
|
|
416
603
|
this.parent.flatData.push(currentData);
|
|
604
|
+
this.parent['infiniteScrollData'].push(currentData);
|
|
417
605
|
}
|
|
418
606
|
if (!this.isSelfReference && currentData.level === 0) {
|
|
419
607
|
this.parent.parentData.push(currentData);
|
|
@@ -447,9 +635,9 @@ var DataManipulation = /** @class */ (function () {
|
|
|
447
635
|
var primaryKeyColumnName = this.parent.getPrimaryKeyFieldNames()[0];
|
|
448
636
|
var dataValue = getObject('data', actionAddArgs);
|
|
449
637
|
if ((!isNullOrUndefined(actionAddArgs)) && (!isNullOrUndefined(actionAddArgs.action)) && (actionAddArgs.action === 'add')
|
|
450
|
-
&& (!isNullOrUndefined(actionAddArgs.data)) && isNullOrUndefined(actionAddArgs.data[primaryKeyColumnName])) {
|
|
451
|
-
actionAddArgs.data[primaryKeyColumnName] = args.result[actionAddArgs.index][primaryKeyColumnName];
|
|
452
|
-
dataValue.taskData[primaryKeyColumnName] = args.result[actionAddArgs.index][primaryKeyColumnName];
|
|
638
|
+
&& (!isNullOrUndefined(actionAddArgs.data)) && isNullOrUndefined(actionAddArgs.data["" + primaryKeyColumnName])) {
|
|
639
|
+
actionAddArgs.data["" + primaryKeyColumnName] = args.result[actionAddArgs.index]["" + primaryKeyColumnName];
|
|
640
|
+
dataValue.taskData["" + primaryKeyColumnName] = args.result[actionAddArgs.index]["" + primaryKeyColumnName];
|
|
453
641
|
}
|
|
454
642
|
if ((!isNullOrUndefined(actionArgs) && Object.keys(actionArgs).length) || requestType === 'save') {
|
|
455
643
|
requestType = requestType ? requestType : actionArgs.requestType;
|
|
@@ -522,14 +710,26 @@ var DataManipulation = /** @class */ (function () {
|
|
|
522
710
|
var srtQry = new Query();
|
|
523
711
|
for (var srt = this.parent.grid.sortSettings.columns.length - 1; srt >= 0; srt--) {
|
|
524
712
|
var getColumnByField = 'getColumnByField';
|
|
525
|
-
var col = this.parent.grid.renderModule.data[getColumnByField](this.parent.grid.
|
|
526
|
-
sortSettings.columns[srt].field);
|
|
713
|
+
var col = this.parent.grid.renderModule.data["" + getColumnByField](this.parent.grid.
|
|
714
|
+
sortSettings.columns[parseInt(srt.toString(), 10)].field);
|
|
527
715
|
var compFun = col.sortComparer && isOffline(this.parent) ?
|
|
528
716
|
col.sortComparer.bind(col) :
|
|
529
|
-
this.parent.grid.sortSettings.columns[srt].direction;
|
|
530
|
-
srtQry.sortBy(this.parent.grid.sortSettings.columns[srt].field, compFun);
|
|
717
|
+
this.parent.grid.sortSettings.columns[parseInt(srt.toString(), 10)].direction;
|
|
718
|
+
srtQry.sortBy(this.parent.grid.sortSettings.columns[parseInt(srt.toString(), 10)].field, compFun);
|
|
531
719
|
}
|
|
532
720
|
var modifiedData = new DataManager(parentData).executeLocal(srtQry);
|
|
721
|
+
if (this.parent.allowRowDragAndDrop && !isNullOrUndefined(this.parent.rowDragAndDropModule['draggedRecord']) &&
|
|
722
|
+
this.parent.rowDragAndDropModule['droppedRecord'].hasChildRecords && this.parent.rowDragAndDropModule['dropPosition'] !== 'middleSegment') {
|
|
723
|
+
var dragdIndex = modifiedData.indexOf(this.parent.rowDragAndDropModule['draggedRecord']);
|
|
724
|
+
modifiedData.splice(dragdIndex, 1);
|
|
725
|
+
var dropdIndex = modifiedData.indexOf(this.parent.rowDragAndDropModule['droppedRecord']);
|
|
726
|
+
if (this.parent.rowDragAndDropModule['droppedRecord'].hasChildRecords && this.parent.rowDragAndDropModule['dropPosition'] === 'topSegment') {
|
|
727
|
+
modifiedData.splice(dropdIndex, 0, this.parent.rowDragAndDropModule['draggedRecord']);
|
|
728
|
+
}
|
|
729
|
+
else if (this.parent.rowDragAndDropModule['dropPosition'] === 'bottomSegment') {
|
|
730
|
+
modifiedData.splice(dropdIndex + 1, 0, this.parent.rowDragAndDropModule['draggedRecord']);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
533
733
|
var sortArgs = { modifiedData: modifiedData, filteredData: results, srtQry: srtQry };
|
|
534
734
|
this.parent.notify('createSort', sortArgs);
|
|
535
735
|
results = sortArgs.modifiedData;
|
|
@@ -569,13 +769,13 @@ var DataManipulation = /** @class */ (function () {
|
|
|
569
769
|
}
|
|
570
770
|
var isPdfExport = 'isPdfExport';
|
|
571
771
|
var isCollapsedStatePersist = 'isCollapsedStatePersist';
|
|
572
|
-
if ((isPrinting === true || (args[isPdfExport] && (isNullOrUndefined(args[isCollapsedStatePersist])
|
|
573
|
-
|| args[isCollapsedStatePersist]))) && this.parent.printMode === 'AllPages') {
|
|
772
|
+
if ((isPrinting === true || (args["" + isPdfExport] && (isNullOrUndefined(args["" + isCollapsedStatePersist])
|
|
773
|
+
|| args["" + isCollapsedStatePersist]))) && this.parent.printMode === 'AllPages') {
|
|
574
774
|
var actualResults = [];
|
|
575
775
|
for (var i = 0; i < results.length; i++) {
|
|
576
|
-
var expandStatus = getExpandStatus(this.parent, results[i], this.parent.parentData);
|
|
776
|
+
var expandStatus = getExpandStatus(this.parent, results[parseInt(i.toString(), 10)], this.parent.parentData);
|
|
577
777
|
if (expandStatus) {
|
|
578
|
-
actualResults.push(results[i]);
|
|
778
|
+
actualResults.push(results[parseInt(i.toString(), 10)]);
|
|
579
779
|
}
|
|
580
780
|
}
|
|
581
781
|
results = actualResults;
|