1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 44× 44× 44× 1× 44× 1× 147× 1× 149× 1× 149× 149× 1× 149× 149× 8× 8× 8× 149× 2× 147× 55× 147× 147× 147× 4995× 147× 1× 298× 1634× 298× 4× 4× 4× 2× 2× 2× 2× 294× 153× 153× 153× 298× 1× 1× | /* istanbul ignore next */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); define(["require", "exports", "@syncfusion/ej2-grids", "../base/constant", "@syncfusion/ej2-base", "@syncfusion/ej2-data", "../utils"], function (require, exports, ej2_grids_1, events, ej2_base_1, ej2_data_1, utils_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var TreeVirtualRowModelGenerator = (function (_super) { __extends(TreeVirtualRowModelGenerator, _super); function TreeVirtualRowModelGenerator(parent) { var _this = _super.call(this, parent) || this; _this.addEventListener(); return _this; } TreeVirtualRowModelGenerator.prototype.addEventListener = function () { this.parent.on(events.dataListener, this.getDatas, this); }; TreeVirtualRowModelGenerator.prototype.getDatas = function (args) { this.visualData = args.data; }; TreeVirtualRowModelGenerator.prototype.getDataInfo = function () { return _super.prototype.getData.call(this); }; TreeVirtualRowModelGenerator.prototype.generateRows = function (data, notifyArgs) { Iif (!ej2_base_1.isNullOrUndefined(notifyArgs.virtualInfo) && notifyArgs.virtualInfo.loadNext && notifyArgs.virtualInfo.nextInfo.page !== this.parent.pageSettings.currentPage) { this.parent.setProperties({ pageSettings: { currentPage: notifyArgs.virtualInfo.nextInfo.page } }, true); } else if (!ej2_base_1.isNullOrUndefined(notifyArgs.virtualInfo) && !notifyArgs.virtualInfo.loadNext && notifyArgs.virtualInfo.page !== this.parent.pageSettings.currentPage) { this.parent.setProperties({ pageSettings: { currentPage: notifyArgs.virtualInfo.page } }, true); } var info = this.getDataInfo(); if (!ej2_base_1.isNullOrUndefined(notifyArgs.virtualInfo)) { Eif (notifyArgs.virtualInfo.direction !== 'right' && notifyArgs.virtualInfo.direction !== 'left') { Eif (!((this.parent.dataSource instanceof ej2_data_1.DataManager && this.parent.dataSource.dataSource.url !== undefined && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || utils_1.isCountRequired(this.parent)) || notifyArgs.virtualInfo.blockIndexes.length === 1) { notifyArgs.virtualInfo.blockIndexes = info.blockIndexes; } } else { notifyArgs.virtualInfo.blockIndexes = this.getBlockIndexes(notifyArgs.virtualInfo.page); } } if ((this.parent.dataSource instanceof ej2_data_1.DataManager && this.parent.dataSource.dataSource.url !== undefined && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || utils_1.isCountRequired(this.parent)) { return _super.prototype.generateRows.call(this, data, notifyArgs); } else { if (!ej2_base_1.isNullOrUndefined(notifyArgs.requestType) && notifyArgs.requestType.toString() === 'collapseAll') { notifyArgs.requestType = 'refresh'; } var rows = _super.prototype.generateRows.call(this, data, notifyArgs); Eif (!ej2_base_1.isNullOrUndefined((this.visualData))) { for (var r = 0; r < rows.length; r++) { rows[parseInt(r.toString(), 10)].index = (this.visualData).indexOf(rows[parseInt(r.toString(), 10)].data); } } return rows; } }; TreeVirtualRowModelGenerator.prototype.checkAndResetCache = function (action) { var clear = ['paging', 'refresh', 'sorting', 'filtering', 'searching', 'reorder', 'save', 'delete'].some(function (value) { return action === value; }); if ((this.parent.dataSource instanceof ej2_data_1.DataManager && this.parent.dataSource.dataSource.url !== undefined && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || utils_1.isCountRequired(this.parent)) { var model = 'model'; var currentPage = this["" + model].currentPage; if (clear) { this.cache = {}; this.data = {}; this.groups = {}; } else Iif (action === 'virtualscroll' && this.cache[parseInt(currentPage.toString(), 10)] && this.cache[parseInt(currentPage.toString(), 10)].length > (this.parent.contentModule).getBlockSize()) { delete this.cache[parseInt(currentPage.toString(), 10)]; } } else { if (clear || action === 'virtualscroll') { this.cache = {}; this.data = {}; this.groups = {}; } } return clear; }; return TreeVirtualRowModelGenerator; }(ej2_grids_1.VirtualRowModelGenerator)); exports.TreeVirtualRowModelGenerator = TreeVirtualRowModelGenerator; }); |