@syncfusion/ej2-treegrid 20.3.60 → 20.4.38
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 +8 -53
- package/README.md +64 -51
- package/dist/ej2-treegrid.min.js +2 -2
- package/dist/ej2-treegrid.umd.min.js +2 -2
- package/dist/ej2-treegrid.umd.min.js.map +1 -1
- package/dist/es6/ej2-treegrid.es2015.js +1191 -908
- package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
- package/dist/es6/ej2-treegrid.es5.js +1249 -944
- package/dist/es6/ej2-treegrid.es5.js.map +1 -1
- package/dist/global/ej2-treegrid.min.js +2 -2
- package/dist/global/ej2-treegrid.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +16 -10
- package/src/treegrid/actions/batch-edit.js +82 -82
- package/src/treegrid/actions/clipboard.js +34 -33
- package/src/treegrid/actions/context-menu.js +1 -1
- package/src/treegrid/actions/crud-actions.js +62 -55
- package/src/treegrid/actions/detail-row.js +7 -7
- package/src/treegrid/actions/edit.js +61 -60
- package/src/treegrid/actions/excel-export.js +2 -2
- package/src/treegrid/actions/filter.js +13 -13
- package/src/treegrid/actions/freeze-column.js +9 -8
- package/src/treegrid/actions/infinite-scroll.js +19 -19
- package/src/treegrid/actions/logger.js +10 -10
- package/src/treegrid/actions/page.js +8 -8
- package/src/treegrid/actions/reorder.js +2 -2
- package/src/treegrid/actions/rowdragdrop.js +88 -82
- package/src/treegrid/actions/selection.js +34 -32
- package/src/treegrid/actions/sort.js +7 -6
- package/src/treegrid/actions/summary.js +24 -24
- package/src/treegrid/actions/toolbar.js +2 -2
- package/src/treegrid/base/data.js +242 -55
- package/src/treegrid/base/treegrid-model.d.ts +20 -4
- package/src/treegrid/base/treegrid.d.ts +24 -5
- package/src/treegrid/base/treegrid.js +226 -191
- package/src/treegrid/models/column.js +3 -3
- 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 +19 -0
- package/src/treegrid/models/loading-indicator.d.ts +16 -0
- package/src/treegrid/models/loading-indicator.js +34 -0
- package/src/treegrid/renderer/render.js +20 -19
- package/src/treegrid/renderer/virtual-row-model-generator.js +6 -5
- package/src/treegrid/renderer/virtual-tree-content-render.js +128 -99
- package/src/treegrid/utils.js +12 -11
|
@@ -58,11 +58,12 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
58
58
|
var selectedRow = collection[index - startIdx];
|
|
59
59
|
if (this.parent.frozenRows && this.parent.pageSettings.currentPage > 1) {
|
|
60
60
|
if (!isRowObject) {
|
|
61
|
-
selectedRow = index <= this.parent.frozenRows ? rowCollection[index]
|
|
61
|
+
selectedRow = index <= this.parent.frozenRows ? rowCollection[parseInt(index.toString(), 10)]
|
|
62
62
|
: rowCollection[(index - startIdx) + this.parent.frozenRows];
|
|
63
63
|
}
|
|
64
64
|
else {
|
|
65
|
-
selectedRow = index <= this.parent.frozenRows ?
|
|
65
|
+
selectedRow = index <= this.parent.frozenRows ?
|
|
66
|
+
this.parent.getRowsObject()[parseInt(index.toString(), 10)].data : selectedRow;
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
return selectedRow;
|
|
@@ -111,26 +112,26 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
111
112
|
var _this = this;
|
|
112
113
|
if (!(this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
|
|
113
114
|
&& this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || !isCountRequired(this.parent)) {
|
|
114
|
-
this.parent[action]('data-ready', this.onDataReady, this);
|
|
115
|
-
this.parent[action]('refresh-virtual-block', this.refreshContentRows, this);
|
|
115
|
+
this.parent["" + action]('data-ready', this.onDataReady, this);
|
|
116
|
+
this.parent["" + action]('refresh-virtual-block', this.refreshContentRows, this);
|
|
116
117
|
this.fn = function () {
|
|
117
118
|
_this.observers.observes(function (scrollArgs) { return _this.scrollListeners(scrollArgs); }, _this.onEnteredAction(), _this.parent);
|
|
118
119
|
_this.parent.off('content-ready', _this.fn);
|
|
119
120
|
};
|
|
120
121
|
this.parent.addEventListener('dataBound', this.dataBoundEvent.bind(this));
|
|
121
122
|
this.parent.addEventListener('rowSelected', this.rowSelectedEvent.bind(this));
|
|
122
|
-
this.parent[action]('select-virtual-Row', this.toSelectVirtualRow, this);
|
|
123
|
+
this.parent["" + action]('select-virtual-Row', this.toSelectVirtualRow, this);
|
|
123
124
|
this.parent.on('content-ready', this.fn, this);
|
|
124
125
|
this.parent.addEventListener(events.actionComplete, this.onActionComplete.bind(this));
|
|
125
|
-
this.parent[action]('virtual-scroll-edit-action-begin', this.beginEdit, this);
|
|
126
|
-
this.parent[action]('virtual-scroll-add-action-begin', this.beginAdd, this);
|
|
127
|
-
this.parent[action]('virtual-scroll-edit-success', this.virtualEditSuccess, this);
|
|
128
|
-
this.parent[action]('edit-reset', this.resetIseditValue, this);
|
|
129
|
-
this.parent[action]('get-virtual-data', this.getData, this);
|
|
130
|
-
this.parent[action]('virtual-scroll-edit-cancel', this.cancelEdit, this);
|
|
131
|
-
this.parent[action]('select-row-on-context-open', this.toSelectRowOnContextOpen, this);
|
|
132
|
-
this.parent[action]('refresh-virtual-editform-cells', this.refreshCell, this);
|
|
133
|
-
this.parent[action]('virtaul-cell-focus', this.cellFocus, this);
|
|
126
|
+
this.parent["" + action]('virtual-scroll-edit-action-begin', this.beginEdit, this);
|
|
127
|
+
this.parent["" + action]('virtual-scroll-add-action-begin', this.beginAdd, this);
|
|
128
|
+
this.parent["" + action]('virtual-scroll-edit-success', this.virtualEditSuccess, this);
|
|
129
|
+
this.parent["" + action]('edit-reset', this.resetIseditValue, this);
|
|
130
|
+
this.parent["" + action]('get-virtual-data', this.getData, this);
|
|
131
|
+
this.parent["" + action]('virtual-scroll-edit-cancel', this.cancelEdit, this);
|
|
132
|
+
this.parent["" + action]('select-row-on-context-open', this.toSelectRowOnContextOpen, this);
|
|
133
|
+
this.parent["" + action]('refresh-virtual-editform-cells', this.refreshCell, this);
|
|
134
|
+
this.parent["" + action]('virtaul-cell-focus', this.cellFocus, this);
|
|
134
135
|
}
|
|
135
136
|
else {
|
|
136
137
|
_super.prototype.eventListener.call(this, 'on');
|
|
@@ -138,7 +139,7 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
138
139
|
};
|
|
139
140
|
VirtualTreeContentRenderer.prototype.cellFocus = function (e) {
|
|
140
141
|
var virtualCellFocus = 'virtualCellFocus';
|
|
141
|
-
_super.prototype[virtualCellFocus].call(this, e);
|
|
142
|
+
_super.prototype["" + virtualCellFocus].call(this, e);
|
|
142
143
|
};
|
|
143
144
|
VirtualTreeContentRenderer.prototype.onDataReady = function (e) {
|
|
144
145
|
_super.prototype.onDataReady.call(this, e);
|
|
@@ -192,22 +193,22 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
192
193
|
VirtualTreeContentRenderer.prototype.dataBoundEvent = function () {
|
|
193
194
|
var dataBoundEve = 'dataBound';
|
|
194
195
|
var initialRowTop = 'initialRowTop';
|
|
195
|
-
if (this.parent.getRows().length && !this[initialRowTop]
|
|
196
|
+
if (!isNullOrUndefined(this.parent.getRowByIndex(0)) && this.parent.getRows().length && !this["" + initialRowTop]) {
|
|
196
197
|
var rowTop = this.parent.getRowByIndex(0).getBoundingClientRect().top;
|
|
197
198
|
var gridTop = this.parent.element.getBoundingClientRect().top;
|
|
198
199
|
if (rowTop > 0) {
|
|
199
|
-
this[initialRowTop] = this.parent.getRowByIndex(0).getBoundingClientRect().top - gridTop;
|
|
200
|
+
this["" + initialRowTop] = this.parent.getRowByIndex(0).getBoundingClientRect().top - gridTop;
|
|
200
201
|
}
|
|
201
202
|
else {
|
|
202
|
-
this[initialRowTop] = this.content.getBoundingClientRect().top -
|
|
203
|
+
this["" + initialRowTop] = this.content.getBoundingClientRect().top -
|
|
203
204
|
this.parent.getRowByIndex(0).getBoundingClientRect().height;
|
|
204
205
|
}
|
|
205
206
|
}
|
|
206
|
-
_super.prototype[dataBoundEve].call(this);
|
|
207
|
+
_super.prototype["" + dataBoundEve].call(this);
|
|
207
208
|
};
|
|
208
209
|
VirtualTreeContentRenderer.prototype.rowSelectedEvent = function (args) {
|
|
209
210
|
var rowSelected = 'rowSelected';
|
|
210
|
-
_super.prototype[rowSelected].call(this, args);
|
|
211
|
+
_super.prototype["" + rowSelected].call(this, args);
|
|
211
212
|
};
|
|
212
213
|
VirtualTreeContentRenderer.prototype.toSelectVirtualRow = function (args) {
|
|
213
214
|
if (this.parent.isEdit) {
|
|
@@ -215,12 +216,12 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
215
216
|
}
|
|
216
217
|
var selectVirtualRow = 'selectVirtualRow';
|
|
217
218
|
var containerRect = 'containerRect';
|
|
218
|
-
if (isNullOrUndefined(this.observer[containerRect])) {
|
|
219
|
-
this.observer[containerRect] = this.observers[containerRect];
|
|
219
|
+
if (isNullOrUndefined(this.observer["" + containerRect])) {
|
|
220
|
+
this.observer["" + containerRect] = this.observers["" + containerRect];
|
|
220
221
|
}
|
|
221
222
|
if (isNullOrUndefined(this.parent['clipboardModule'].treeGridParent.editModule) || args.selectedIndex !== 0 ||
|
|
222
223
|
isNullOrUndefined(this.parent['clipboardModule'].treeGridParent.editModule['addRowIndex'])) {
|
|
223
|
-
_super.prototype[selectVirtualRow].call(this, args);
|
|
224
|
+
_super.prototype["" + selectVirtualRow].call(this, args);
|
|
224
225
|
}
|
|
225
226
|
};
|
|
226
227
|
VirtualTreeContentRenderer.prototype.refreshCell = function (rowObj) {
|
|
@@ -229,7 +230,7 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
229
230
|
VirtualTreeContentRenderer.prototype.generateCells = function () {
|
|
230
231
|
var cells = [];
|
|
231
232
|
for (var i = 0; i < this.parent.columns.length; i++) {
|
|
232
|
-
cells.push(this.generateCell(this.parent.columns[i]));
|
|
233
|
+
cells.push(this.generateCell(this.parent.columns[parseInt(i.toString(), 10)]));
|
|
233
234
|
}
|
|
234
235
|
return cells;
|
|
235
236
|
};
|
|
@@ -255,7 +256,7 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
255
256
|
this['editedRowIndex'] = e.index;
|
|
256
257
|
var selector = '.e-row[data-rowindex="' + e.index + '"]';
|
|
257
258
|
var index = this.parent.getContent().querySelector(selector).rowIndex;
|
|
258
|
-
var rowData = this.parent.getCurrentViewRecords()[index];
|
|
259
|
+
var rowData = this.parent.getCurrentViewRecords()[parseInt(index.toString(), 10)];
|
|
259
260
|
e.data = rowData;
|
|
260
261
|
};
|
|
261
262
|
VirtualTreeContentRenderer.prototype.beginAdd = function (args) {
|
|
@@ -271,51 +272,51 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
271
272
|
var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
|
|
272
273
|
var withInRange = this.parent.selectedRowIndex >= firstAriaIndex && this.parent.selectedRowIndex <= lastAriaIndex;
|
|
273
274
|
if (!(this.rowPosition === 'Top' || this.rowPosition === 'Bottom')) {
|
|
274
|
-
this[isAdd] = true;
|
|
275
|
+
this["" + isAdd] = true;
|
|
275
276
|
}
|
|
276
277
|
if (this.rowPosition === 'Top' || this.rowPosition === 'Bottom' ||
|
|
277
278
|
((!this.addRowIndex || this.addRowIndex === -1) && (this.parent.selectedRowIndex === -1 || !withInRange))) {
|
|
278
|
-
_super.prototype[addAction].call(this, args);
|
|
279
|
+
_super.prototype["" + addAction].call(this, args);
|
|
279
280
|
}
|
|
280
281
|
};
|
|
281
282
|
VirtualTreeContentRenderer.prototype.restoreEditState = function () {
|
|
282
283
|
var restoreEdit = 'restoreEdit';
|
|
283
|
-
_super.prototype[restoreEdit].call(this);
|
|
284
|
+
_super.prototype["" + restoreEdit].call(this);
|
|
284
285
|
};
|
|
285
286
|
VirtualTreeContentRenderer.prototype.resetIseditValue = function () {
|
|
286
287
|
var resetIsEdit = 'resetIsedit';
|
|
287
288
|
var isAdd = 'isAdd';
|
|
288
289
|
this.parent.notify('reset-edit-props', {});
|
|
289
|
-
if ((this.rowPosition === 'Top' || this.rowPosition === 'Bottom') && this[isAdd]) {
|
|
290
|
-
_super.prototype[resetIsEdit].call(this);
|
|
290
|
+
if ((this.rowPosition === 'Top' || this.rowPosition === 'Bottom') && this["" + isAdd]) {
|
|
291
|
+
_super.prototype["" + resetIsEdit].call(this);
|
|
291
292
|
}
|
|
292
293
|
};
|
|
293
294
|
VirtualTreeContentRenderer.prototype.virtualEditSuccess = function () {
|
|
294
295
|
var isAdd = 'isAdd';
|
|
295
296
|
var content = this.parent.getContent().querySelector('.e-content');
|
|
296
|
-
if (this[isAdd] && content.querySelector('.e-addedrow')) {
|
|
297
|
+
if (this["" + isAdd] && content.querySelector('.e-addedrow')) {
|
|
297
298
|
this.recordAdded = true;
|
|
298
299
|
}
|
|
299
300
|
};
|
|
300
301
|
VirtualTreeContentRenderer.prototype.cancelEdit = function (args) {
|
|
301
302
|
var editCancel = 'editCancel';
|
|
302
|
-
_super.prototype[editCancel].call(this, args);
|
|
303
|
+
_super.prototype["" + editCancel].call(this, args);
|
|
303
304
|
};
|
|
304
305
|
VirtualTreeContentRenderer.prototype.toSelectRowOnContextOpen = function (args) {
|
|
305
306
|
var selectRowOnContextOpen = 'selectRowOnContextOpen';
|
|
306
|
-
_super.prototype[selectRowOnContextOpen].call(this, args);
|
|
307
|
+
_super.prototype["" + selectRowOnContextOpen].call(this, args);
|
|
307
308
|
};
|
|
308
309
|
VirtualTreeContentRenderer.prototype.restoreNewRow = function () {
|
|
309
310
|
var isAdd = 'isAdd';
|
|
310
311
|
var content = this.parent.getContent().querySelector('.e-content');
|
|
311
|
-
if (this[isAdd] && !content.querySelector('.e-addedrow')) {
|
|
312
|
+
if (this["" + isAdd] && !content.querySelector('.e-addedrow')) {
|
|
312
313
|
this.parent.isEdit = false;
|
|
313
314
|
this.parent.editModule.addRecord(null, this.parent.root.editModule.selectedIndex);
|
|
314
315
|
}
|
|
315
316
|
};
|
|
316
317
|
VirtualTreeContentRenderer.prototype.getData = function (data) {
|
|
317
318
|
var getVirtualData = 'getVirtualData';
|
|
318
|
-
_super.prototype[getVirtualData].call(this, data);
|
|
319
|
+
_super.prototype["" + getVirtualData].call(this, data);
|
|
319
320
|
};
|
|
320
321
|
VirtualTreeContentRenderer.prototype.onActionComplete = function (args) {
|
|
321
322
|
if (args.requestType === 'add') {
|
|
@@ -326,17 +327,25 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
326
327
|
this.dataRowIndex = this.parent.root.editModule.selectedIndex;
|
|
327
328
|
}
|
|
328
329
|
var actionComplete = 'actionComplete';
|
|
329
|
-
_super.prototype[actionComplete].call(this, args);
|
|
330
|
+
_super.prototype["" + actionComplete].call(this, args);
|
|
330
331
|
};
|
|
331
332
|
VirtualTreeContentRenderer.prototype.onEnteredAction = function () {
|
|
332
333
|
var _this = this;
|
|
333
334
|
return function (element, current, direction, e, isWheel, check) {
|
|
334
335
|
var directVirtualRender = 'directVirtualRender';
|
|
335
|
-
if (!_this.parent[directVirtualRender]) { // with this property, columns are rendered without debouncing on horizontal scroll.
|
|
336
|
+
if (!_this.parent["" + directVirtualRender]) { // with this property, columns are rendered without debouncing on horizontal scroll.
|
|
336
337
|
var preventEvent = 'preventEvent';
|
|
337
|
-
if (Browser.isIE && !isWheel && check && !_this[preventEvent]) {
|
|
338
|
+
if (Browser.isIE && !isWheel && check && !_this["" + preventEvent] && !_this.parent.enableVirtualMaskRow) {
|
|
338
339
|
_this.parent.showSpinner();
|
|
339
340
|
}
|
|
341
|
+
if (_this.parent.enableVirtualMaskRow && !_this["" + preventEvent]) {
|
|
342
|
+
setTimeout(function () {
|
|
343
|
+
_this.parent.showMaskRow(current.axis);
|
|
344
|
+
_this.parent.notify('showGanttShimmer', { requestType: 'showShimmer' });
|
|
345
|
+
}, 0);
|
|
346
|
+
}
|
|
347
|
+
var height = _this.content.getBoundingClientRect().height;
|
|
348
|
+
var top_1 = _this.prevInfo.offsets ? _this.prevInfo.offsets.top : null;
|
|
340
349
|
var xAxis = current.axis === 'X';
|
|
341
350
|
var x = _this.getColumnOffset(xAxis ? _this.vgenerator.getColumnIndexes()[0] - 1 : _this.prevInfo.columnIndexes[0]
|
|
342
351
|
- 1);
|
|
@@ -345,8 +354,16 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
345
354
|
var maxLeft = _this.vgenerator.cOffsets[idx - 1];
|
|
346
355
|
x = x > maxLeft ? maxLeft : x; //TODO: This fix horizontal scrollbar jumping issue in column virtualization.
|
|
347
356
|
}
|
|
348
|
-
|
|
349
|
-
|
|
357
|
+
var y = _this.getTranslateY(e.top, height, xAxis && top_1 === e.top ? _this.prevInfo : undefined, true);
|
|
358
|
+
if (!_this.parent.isFrozenGrid() || _this.parent.enableVirtualMaskRow) {
|
|
359
|
+
if (_this.parent.enableVirtualMaskRow) {
|
|
360
|
+
var upScroll = (e.top - _this.translateY) < 0;
|
|
361
|
+
y = (Math.round(_this.translateY) > y && !upScroll) ? Math.round(_this.translateY) : y;
|
|
362
|
+
_this.virtualEle.adjustTable(x, y);
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
_this.virtualEle.adjustTable(x, _this.translateY);
|
|
366
|
+
}
|
|
350
367
|
if (_this.parent.enableColumnVirtualization) {
|
|
351
368
|
_this.header.virtualEle.adjustTable(x, 0);
|
|
352
369
|
}
|
|
@@ -357,23 +374,24 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
357
374
|
VirtualTreeContentRenderer.prototype.scrollListeners = function (scrollArgs) {
|
|
358
375
|
this['scrollAfterEdit']();
|
|
359
376
|
var info = scrollArgs.sentinel;
|
|
377
|
+
var rowHeight = this.parent.getRowHeight();
|
|
360
378
|
var outBuffer = this.parent.pageSettings.pageSize - Math.ceil(this.parent.pageSettings.pageSize / 2);
|
|
361
379
|
var content = this.parent.getContent().querySelector('.e-content');
|
|
362
|
-
var scrollHeight = outBuffer *
|
|
380
|
+
var scrollHeight = outBuffer * rowHeight;
|
|
363
381
|
var upScroll = (scrollArgs.offset.top - this.translateY) < 0;
|
|
364
|
-
var downScroll = Math.ceil(scrollArgs.offset.top - this.translateY) >= scrollHeight;
|
|
382
|
+
var downScroll = Math.ceil(scrollArgs.offset.top - this.translateY) + rowHeight >= scrollHeight;
|
|
365
383
|
var selectedRowIndex = 'selectedRowIndex';
|
|
366
384
|
var currentViewData = this.parent.currentViewData;
|
|
367
385
|
var indexValue = 'index';
|
|
368
386
|
if (upScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left')) {
|
|
369
387
|
var vHeight = +(this.parent.height.toString().indexOf('%') < 0 ? this.parent.height :
|
|
370
388
|
this.parent.element.getBoundingClientRect().height);
|
|
371
|
-
var index = (~~(content.scrollTop /
|
|
372
|
-
+ Math.ceil(vHeight /
|
|
389
|
+
var index = (~~(content.scrollTop / rowHeight)
|
|
390
|
+
+ Math.ceil(vHeight / rowHeight))
|
|
373
391
|
- this.parent.pageSettings.pageSize;
|
|
374
392
|
index = (index > 0) ? index : 0;
|
|
375
|
-
if (!isNullOrUndefined(this[selectedRowIndex]) && this[selectedRowIndex] !== -1 && index !== this[selectedRowIndex]) {
|
|
376
|
-
index = this[selectedRowIndex];
|
|
393
|
+
if (!isNullOrUndefined(this["" + selectedRowIndex]) && this["" + selectedRowIndex] !== -1 && index !== this["" + selectedRowIndex]) {
|
|
394
|
+
index = this["" + selectedRowIndex];
|
|
377
395
|
}
|
|
378
396
|
this.startIndex = index;
|
|
379
397
|
this.endIndex = index + this.parent.pageSettings.pageSize;
|
|
@@ -383,41 +401,40 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
383
401
|
this.endIndex = lastInx;
|
|
384
402
|
this.startIndex = (this.startIndex - remains) < 0 ? 0 : (this.startIndex - remains);
|
|
385
403
|
}
|
|
386
|
-
if (currentViewData.length && (currentViewData[0][indexValue] >= this.parent.pageSettings.pageSize / 2) &&
|
|
387
|
-
((currentViewData[0][indexValue] - this.startIndex) < (this.parent.pageSettings.pageSize / 2))) {
|
|
388
|
-
this.startIndex = currentViewData[0][indexValue] - (this.parent.pageSettings.pageSize / 2);
|
|
404
|
+
if (currentViewData.length && (currentViewData[0]["" + indexValue] >= this.parent.pageSettings.pageSize / 2) &&
|
|
405
|
+
((currentViewData[0]["" + indexValue] - this.startIndex) < (this.parent.pageSettings.pageSize / 2))) {
|
|
406
|
+
this.startIndex = currentViewData[0]["" + indexValue] - (this.parent.pageSettings.pageSize / 2);
|
|
389
407
|
this.endIndex = this.startIndex + this.parent.pageSettings.pageSize;
|
|
390
408
|
}
|
|
391
409
|
//var firsttdinx = parseInt(this.parent.getContent().querySelector('.e-content td').getAttribute('index'), 0);
|
|
392
|
-
var rowPt = Math.ceil(scrollArgs.offset.top /
|
|
410
|
+
var rowPt = Math.ceil(scrollArgs.offset.top / rowHeight);
|
|
393
411
|
rowPt = rowPt % this.parent.pageSettings.pageSize;
|
|
394
412
|
var firsttdinx = 0;
|
|
395
|
-
if (!isNullOrUndefined(this.parent.getRows()[rowPt]) &&
|
|
396
|
-
!isNullOrUndefined(this.parent.getContent().querySelectorAll('.e-content tr')[rowPt])) {
|
|
397
|
-
var attr = this.parent.getContent().querySelectorAll('.e-content tr')[rowPt]
|
|
413
|
+
if (!isNullOrUndefined(this.parent.getRows()[parseInt(rowPt.toString(), 10)]) &&
|
|
414
|
+
!isNullOrUndefined(this.parent.getContent().querySelectorAll('.e-content tr')[parseInt(rowPt.toString(), 10)])) {
|
|
415
|
+
var attr = this.parent.getContent().querySelectorAll('.e-content tr')[parseInt(rowPt.toString(), 10)]
|
|
398
416
|
.querySelector('td').getAttribute('index');
|
|
399
417
|
firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('data-rowindex');
|
|
400
418
|
}
|
|
401
419
|
if (firsttdinx === 0) {
|
|
402
420
|
if (this.parent.allowRowDragAndDrop) {
|
|
403
|
-
this.translateY = scrollArgs.offset.top -
|
|
421
|
+
this.translateY = scrollArgs.offset.top - rowHeight * 2;
|
|
404
422
|
}
|
|
405
423
|
else {
|
|
406
424
|
this.translateY = scrollArgs.offset.top;
|
|
407
425
|
}
|
|
408
426
|
}
|
|
409
427
|
else {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
scrollArgs.offset.top - (outBuffer * height) + 10 : 0;
|
|
428
|
+
this.translateY = (scrollArgs.offset.top - (outBuffer * rowHeight) > 0) ?
|
|
429
|
+
scrollArgs.offset.top - (outBuffer * rowHeight) + 10 : 0;
|
|
413
430
|
}
|
|
414
431
|
}
|
|
415
432
|
else if (downScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left')) {
|
|
416
|
-
var nextSetResIndex = ~~(content.scrollTop /
|
|
417
|
-
var isLastBlock = (this[selectedRowIndex] + this.parent.pageSettings.pageSize) < this.totalRecords ? false : true;
|
|
418
|
-
if (!isNullOrUndefined(this[selectedRowIndex]) && this[selectedRowIndex] !== -1 &&
|
|
419
|
-
nextSetResIndex !== this[selectedRowIndex] && !isLastBlock) {
|
|
420
|
-
nextSetResIndex = this[selectedRowIndex];
|
|
433
|
+
var nextSetResIndex = ~~(content.scrollTop / rowHeight);
|
|
434
|
+
var isLastBlock = (this["" + selectedRowIndex] + this.parent.pageSettings.pageSize) < this.totalRecords ? false : true;
|
|
435
|
+
if (!isNullOrUndefined(this["" + selectedRowIndex]) && this["" + selectedRowIndex] !== -1 &&
|
|
436
|
+
nextSetResIndex !== this["" + selectedRowIndex] && !isLastBlock) {
|
|
437
|
+
nextSetResIndex = this["" + selectedRowIndex];
|
|
421
438
|
}
|
|
422
439
|
var lastIndex = nextSetResIndex + this.parent.pageSettings.pageSize;
|
|
423
440
|
if (lastIndex > this.totalRecords) {
|
|
@@ -426,26 +443,26 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
426
443
|
}
|
|
427
444
|
this.startIndex = !isLastBlock ? lastIndex - this.parent.pageSettings.pageSize : nextSetResIndex;
|
|
428
445
|
this.endIndex = lastIndex;
|
|
429
|
-
if (currentViewData.length && this.startIndex > currentViewData[0][indexValue] &&
|
|
430
|
-
((this.startIndex - currentViewData[0][indexValue]) < (this.parent.pageSettings.pageSize / 2))) {
|
|
431
|
-
this.startIndex = currentViewData[0][indexValue] + (this.parent.pageSettings.pageSize / 2);
|
|
446
|
+
if (currentViewData.length && this.startIndex > currentViewData[0]["" + indexValue] &&
|
|
447
|
+
((this.startIndex - currentViewData[0]["" + indexValue]) < (this.parent.pageSettings.pageSize / 2))) {
|
|
448
|
+
this.startIndex = currentViewData[0]["" + indexValue] + (this.parent.pageSettings.pageSize / 2);
|
|
432
449
|
}
|
|
433
|
-
if (scrollArgs.offset.top > (
|
|
450
|
+
if (scrollArgs.offset.top > (rowHeight * this.totalRecords)) {
|
|
434
451
|
this.translateY = this.getTranslateY(scrollArgs.offset.top, content.getBoundingClientRect().height);
|
|
435
452
|
}
|
|
436
453
|
else {
|
|
437
454
|
if (this.parent.allowRowDragAndDrop) {
|
|
438
|
-
this.translateY = scrollArgs.offset.top -
|
|
455
|
+
this.translateY = scrollArgs.offset.top - rowHeight * 2;
|
|
439
456
|
}
|
|
440
457
|
else {
|
|
441
458
|
this.translateY = scrollArgs.offset.top;
|
|
442
459
|
}
|
|
443
460
|
}
|
|
444
461
|
}
|
|
445
|
-
if (((downScroll && (scrollArgs.offset.top < (
|
|
462
|
+
if (((downScroll && (scrollArgs.offset.top < (rowHeight * this.totalRecords)))
|
|
446
463
|
|| (upScroll)) || (scrollArgs.direction === 'right' || scrollArgs.direction === 'left') ||
|
|
447
464
|
((this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
|
|
448
|
-
&& !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || isCountRequired(this.parent))) {
|
|
465
|
+
&& !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') && (downScroll || upScroll) || isCountRequired(this.parent))) {
|
|
449
466
|
var viewInfo = this.currentInfo = getValue('getInfoFromView', this).apply(this, [scrollArgs.direction, info, scrollArgs.offset]);
|
|
450
467
|
this.previousInfo = viewInfo;
|
|
451
468
|
this.parent.setColumnIndexesInView(this.parent.enableColumnVirtualization ? viewInfo.columnIndexes : []);
|
|
@@ -455,8 +472,19 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
455
472
|
if (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left') {
|
|
456
473
|
viewInfo.event = viewInfo.event === 'refresh-virtual-block' ? 'model-changed' : viewInfo.event;
|
|
457
474
|
}
|
|
475
|
+
if (this.parent.enableVirtualMaskRow) {
|
|
476
|
+
this.parent.showMaskRow(info.axis);
|
|
477
|
+
this.parent.addShimmerEffect();
|
|
478
|
+
this.parent.notify('showGanttShimmer', { requestType: 'showShimmer' });
|
|
479
|
+
}
|
|
458
480
|
this.parent.notify(viewInfo.event, { requestType: 'virtualscroll', virtualInfo: viewInfo, focusElement: scrollArgs.focusElement });
|
|
459
481
|
}
|
|
482
|
+
else {
|
|
483
|
+
if (this.parent.enableVirtualMaskRow) {
|
|
484
|
+
this.parent.removeMaskRow();
|
|
485
|
+
this.parent.notify('removeGanttShimmer', { requestType: 'hideShimmer' });
|
|
486
|
+
}
|
|
487
|
+
}
|
|
460
488
|
};
|
|
461
489
|
VirtualTreeContentRenderer.prototype.appendContent = function (target, newChild, e) {
|
|
462
490
|
var isFrozen = this.parent.isFrozenGrid();
|
|
@@ -465,7 +493,8 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
465
493
|
if (getValue('isExpandCollapse', e)) {
|
|
466
494
|
this.isRemoteExpand = true;
|
|
467
495
|
}
|
|
468
|
-
if (isFrozen && isNullOrUndefined(this.requestType) && getValue('requestTypes', this).indexOf('isFrozen') === -1)
|
|
496
|
+
if (isFrozen && ((isNullOrUndefined(this.requestType) && getValue('requestTypes', this).indexOf('isFrozen') === -1) ||
|
|
497
|
+
(this.parent.enableVirtualMaskRow && this.requestType === 'virtualscroll'))) {
|
|
469
498
|
getValue('requestTypes', this).push('isFrozen');
|
|
470
499
|
this.requestType = 'isFrozen';
|
|
471
500
|
}
|
|
@@ -499,7 +528,7 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
499
528
|
target = this.parent.createElement('tbody');
|
|
500
529
|
target.appendChild(newChild);
|
|
501
530
|
var replace = 'replaceWith';
|
|
502
|
-
this.getTable().querySelector('tbody')[replace](target);
|
|
531
|
+
this.getTable().querySelector('tbody')["" + replace](target);
|
|
503
532
|
if (!this.isExpandCollapse || this.translateY === 0) {
|
|
504
533
|
this.translateY = this.translateY < 0 ? 0 : this.translateY;
|
|
505
534
|
getValue('virtualEle', this).adjustTable(cOffset, this.translateY);
|
|
@@ -514,22 +543,22 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
514
543
|
var focusCell = 'focusCell';
|
|
515
544
|
var restoreAdd = 'restoreAdd';
|
|
516
545
|
var ensureSelectedRowPosition = 'ensureSelectedRowPosition';
|
|
517
|
-
_super.prototype[focusCell].call(this, e);
|
|
546
|
+
_super.prototype["" + focusCell].call(this, e);
|
|
518
547
|
var isAdd = 'isAdd';
|
|
519
|
-
if (this[isAdd] && !this.parent.getContent().querySelector('.e-content').querySelector('.e-addedrow')) {
|
|
548
|
+
if (this["" + isAdd] && !this.parent.getContent().querySelector('.e-content').querySelector('.e-addedrow')) {
|
|
520
549
|
if (!(this.rowPosition === 'Top' || this.rowPosition === 'Bottom')) {
|
|
521
550
|
if (this.dataRowIndex >= this.startIndex) {
|
|
522
551
|
this.restoreNewRow();
|
|
523
552
|
}
|
|
524
553
|
else if (this.addRowIndex && this.addRowIndex > -1) {
|
|
525
|
-
this[isAdd] = false;
|
|
554
|
+
this["" + isAdd] = false;
|
|
526
555
|
this.parent.isEdit = false;
|
|
527
556
|
}
|
|
528
557
|
}
|
|
529
558
|
}
|
|
530
559
|
this.restoreEditState();
|
|
531
|
-
_super.prototype[restoreAdd].call(this);
|
|
532
|
-
_super.prototype[ensureSelectedRowPosition].call(this);
|
|
560
|
+
_super.prototype["" + restoreAdd].call(this);
|
|
561
|
+
_super.prototype["" + ensureSelectedRowPosition].call(this);
|
|
533
562
|
}
|
|
534
563
|
};
|
|
535
564
|
VirtualTreeContentRenderer.prototype.removeEventListener = function () {
|
|
@@ -568,11 +597,11 @@ var TreeInterSectionObserver = /** @class */ (function (_super) {
|
|
|
568
597
|
}
|
|
569
598
|
TreeInterSectionObserver.prototype.observes = function (callback, onEnterCallback, instance) {
|
|
570
599
|
var containerRect = 'containerRect';
|
|
571
|
-
_super.prototype[containerRect] = getValue('options', this).container.getBoundingClientRect();
|
|
600
|
+
_super.prototype["" + containerRect] = getValue('options', this).container.getBoundingClientRect();
|
|
572
601
|
EventHandler.add(getValue('options', this).container, 'scroll', this.virtualScrollHandlers(callback, onEnterCallback, instance), this);
|
|
573
602
|
if (getValue('options', this).movableContainer) {
|
|
574
603
|
var movableContainerRect = 'movableContainerRect';
|
|
575
|
-
_super.prototype[movableContainerRect] = getValue('options', this).movableContainer.getBoundingClientRect();
|
|
604
|
+
_super.prototype["" + movableContainerRect] = getValue('options', this).movableContainer.getBoundingClientRect();
|
|
576
605
|
EventHandler.add(getValue('options', this).movableContainer, 'scroll', this.virtualScrollHandlers(callback, onEnterCallback, instance), this);
|
|
577
606
|
}
|
|
578
607
|
};
|
|
@@ -581,22 +610,22 @@ var TreeInterSectionObserver = /** @class */ (function (_super) {
|
|
|
581
610
|
};
|
|
582
611
|
TreeInterSectionObserver.prototype.virtualScrollHandlers = function (callback, onEnterCallback, instance) {
|
|
583
612
|
var _this = this;
|
|
584
|
-
|
|
613
|
+
var delay = Browser.info.name === 'chrome' ? 200 : 100;
|
|
585
614
|
var options = 'options';
|
|
586
615
|
var movableEle = 'movableEle';
|
|
587
616
|
var element = 'element';
|
|
588
617
|
var fromWheel = 'fromWheel';
|
|
589
|
-
|
|
618
|
+
var debounced100 = debounce(callback, delay);
|
|
590
619
|
var debounced50 = debounce(callback, 50);
|
|
591
|
-
this[options].prevTop = this[options].prevLeft = 0;
|
|
620
|
+
this["" + options].prevTop = this["" + options].prevLeft = 0;
|
|
592
621
|
return function (e) {
|
|
593
|
-
var top = _this[options].movableContainer ? _this[options].container.scrollTop : e.target.scrollTop;
|
|
594
|
-
var left = _this[options].movableContainer ? _this[options].scrollbar.scrollLeft : e.target.scrollLeft;
|
|
595
|
-
var direction = _this[options].prevTop < top ? 'down' : 'up';
|
|
596
|
-
direction = _this[options].prevLeft === left ? direction : _this[options].prevLeft < left ? 'right' : 'left';
|
|
597
|
-
_this[options].prevTop = top;
|
|
598
|
-
_this[options].prevLeft = left;
|
|
599
|
-
var current = _this.sentinelInfo[direction];
|
|
622
|
+
var top = _this["" + options].movableContainer ? _this["" + options].container.scrollTop : e.target.scrollTop;
|
|
623
|
+
var left = _this["" + options].movableContainer ? _this["" + options].scrollbar.scrollLeft : e.target.scrollLeft;
|
|
624
|
+
var direction = _this["" + options].prevTop < top ? 'down' : 'up';
|
|
625
|
+
direction = _this["" + options].prevLeft === left ? direction : _this["" + options].prevLeft < left ? 'right' : 'left';
|
|
626
|
+
_this["" + options].prevTop = top;
|
|
627
|
+
_this["" + options].prevLeft = left;
|
|
628
|
+
var current = _this.sentinelInfo["" + direction];
|
|
600
629
|
var delta = 0;
|
|
601
630
|
_this.newPos = top;
|
|
602
631
|
if (_this.lastPos != null) { // && newPos < maxScroll
|
|
@@ -611,16 +640,16 @@ var TreeInterSectionObserver = /** @class */ (function (_super) {
|
|
|
611
640
|
e.returnValue = false;
|
|
612
641
|
e.preventDefault();
|
|
613
642
|
}
|
|
614
|
-
if (_this[options].axes.indexOf(current.axis) === -1) {
|
|
643
|
+
if (_this["" + options].axes.indexOf(current.axis) === -1) {
|
|
615
644
|
return;
|
|
616
645
|
}
|
|
617
646
|
var check = _this.check(direction);
|
|
618
|
-
if (current.entered && current.axis === 'X') {
|
|
619
|
-
if (_this[movableEle] && (direction === 'right' || direction === 'left')) {
|
|
620
|
-
onEnterCallback(_this[movableEle], current, direction, { top: top, left: left }, _this[fromWheel], check);
|
|
647
|
+
if (current.entered && (current.axis === 'X' || instance.enableVirtualMaskRow)) {
|
|
648
|
+
if (_this["" + movableEle] && (direction === 'right' || direction === 'left')) {
|
|
649
|
+
onEnterCallback(_this["" + movableEle], current, direction, { top: top, left: left }, _this["" + fromWheel], check);
|
|
621
650
|
}
|
|
622
651
|
else {
|
|
623
|
-
onEnterCallback(_this[element], current, direction, { top: top, left: left }, _this[fromWheel], check);
|
|
652
|
+
onEnterCallback(_this["" + element], current, direction, { top: top, left: left }, _this["" + fromWheel], check);
|
|
624
653
|
}
|
|
625
654
|
}
|
|
626
655
|
if (check) {
|
|
@@ -631,19 +660,19 @@ var TreeInterSectionObserver = /** @class */ (function (_super) {
|
|
|
631
660
|
}
|
|
632
661
|
else {
|
|
633
662
|
if ((instance.dataSource instanceof DataManager && instance.dataSource.dataSource.url !== undefined
|
|
634
|
-
&& !instance.dataSource.dataSource.offline && instance.dataSource.dataSource.url !== '') || isCountRequired(instance)
|
|
663
|
+
&& !instance.dataSource.dataSource.offline && instance.dataSource.dataSource.url !== '') || isCountRequired(instance)
|
|
664
|
+
|| instance.enableVirtualMaskRow) {
|
|
665
|
+
fn = instance.enableVirtualMaskRow ? debounced100 : fn;
|
|
635
666
|
fn({ direction: direction, sentinel: current, offset: { top: top, left: left },
|
|
636
667
|
focusElement: document.activeElement });
|
|
637
668
|
}
|
|
638
669
|
else {
|
|
639
|
-
callback({
|
|
640
|
-
|
|
641
|
-
focusElement: document.activeElement
|
|
642
|
-
});
|
|
670
|
+
callback({ direction: direction, sentinel: current, offset: { top: top, left: left },
|
|
671
|
+
focusElement: document.activeElement });
|
|
643
672
|
}
|
|
644
673
|
}
|
|
645
674
|
}
|
|
646
|
-
_this[fromWheel] = false;
|
|
675
|
+
_this["" + fromWheel] = false;
|
|
647
676
|
};
|
|
648
677
|
};
|
|
649
678
|
return TreeInterSectionObserver;
|
package/src/treegrid/utils.js
CHANGED
|
@@ -31,7 +31,7 @@ export function isCountRequired(parent) {
|
|
|
31
31
|
*/
|
|
32
32
|
export function isCheckboxcolumn(parent) {
|
|
33
33
|
for (var i = 0; i < parent.columns.length; i++) {
|
|
34
|
-
if (parent.columns[i].showCheckbox) {
|
|
34
|
+
if (parent.columns[parseInt(i.toString(), 10)].showCheckbox) {
|
|
35
35
|
return true;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -59,9 +59,9 @@ export function findParentRecords(records) {
|
|
|
59
59
|
var datas = [];
|
|
60
60
|
var recordsLength = Object.keys(records).length;
|
|
61
61
|
for (var i = 0, len = recordsLength; i < len; i++) {
|
|
62
|
-
var hasChild = getObject('hasChildRecords', records[i]);
|
|
62
|
+
var hasChild = getObject('hasChildRecords', records[parseInt(i.toString(), 10)]);
|
|
63
63
|
if (hasChild) {
|
|
64
|
-
datas.push(records[i]);
|
|
64
|
+
datas.push(records[parseInt(i.toString(), 10)]);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
return datas;
|
|
@@ -124,10 +124,11 @@ export function findChildrenRecords(records) {
|
|
|
124
124
|
var childRecords = records.childRecords.filter(function (item) { return !item.isSummaryRow; });
|
|
125
125
|
var keys = Object.keys(childRecords);
|
|
126
126
|
for (var i = 0, len = keys.length; i < len; i++) {
|
|
127
|
-
datas.push(childRecords[i]);
|
|
128
|
-
if (childRecords[i].hasChildRecords ||
|
|
129
|
-
childRecords[i].childRecords
|
|
130
|
-
|
|
127
|
+
datas.push(childRecords[parseInt(i.toString(), 10)]);
|
|
128
|
+
if (childRecords[parseInt(i.toString(), 10)].hasChildRecords ||
|
|
129
|
+
(!isNullOrUndefined(childRecords[parseInt(i.toString(), 10)].childRecords) &&
|
|
130
|
+
childRecords[parseInt(i.toString(), 10)].childRecords.length)) {
|
|
131
|
+
datas = datas.concat(findChildrenRecords(childRecords[parseInt(i.toString(), 10)]));
|
|
131
132
|
}
|
|
132
133
|
}
|
|
133
134
|
}
|
|
@@ -153,10 +154,10 @@ export function extendArray(array) {
|
|
|
153
154
|
var obj;
|
|
154
155
|
var keys;
|
|
155
156
|
for (var i = 0; array && i < array.length; i++) {
|
|
156
|
-
keys = Object.keys(array[i]);
|
|
157
|
+
keys = Object.keys(array[parseInt(i.toString(), 10)]);
|
|
157
158
|
obj = {};
|
|
158
159
|
for (var j = 0; j < keys.length; j++) {
|
|
159
|
-
obj[keys[j]] = array[i][keys[j]];
|
|
160
|
+
obj[keys[parseInt(j.toString(), 10)]] = array[parseInt(i.toString(), 10)][keys[parseInt(j.toString(), 10)]];
|
|
160
161
|
}
|
|
161
162
|
objArr.push(obj);
|
|
162
163
|
}
|
|
@@ -185,11 +186,11 @@ export function getPlainData(value) {
|
|
|
185
186
|
export function getParentData(parent, value, requireFilter) {
|
|
186
187
|
if (requireFilter) {
|
|
187
188
|
var idFilter = 'uniqueIDFilterCollection';
|
|
188
|
-
return parent[idFilter][value];
|
|
189
|
+
return parent["" + idFilter]["" + value];
|
|
189
190
|
}
|
|
190
191
|
else {
|
|
191
192
|
var id = 'uniqueIDCollection';
|
|
192
|
-
return parent[id][value];
|
|
193
|
+
return parent["" + id]["" + value];
|
|
193
194
|
}
|
|
194
195
|
}
|
|
195
196
|
/**
|