1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | "use strict";
|
8 | var __extends = (this && this.__extends) || (function () {
|
9 | var extendStatics = Object.setPrototypeOf ||
|
10 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
11 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
12 | return function (d, b) {
|
13 | extendStatics(d, b);
|
14 | function __() { this.constructor = d; }
|
15 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
16 | };
|
17 | })();
|
18 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
19 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
20 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
21 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
22 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
23 | };
|
24 | var __metadata = (this && this.__metadata) || function (k, v) {
|
25 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
26 | };
|
27 | Object.defineProperty(exports, "__esModule", { value: true });
|
28 | var context_1 = require("../context/context");
|
29 | var gridOptionsWrapper_1 = require("../gridOptionsWrapper");
|
30 | var changedPath_1 = require("../rowModels/clientSide/changedPath");
|
31 | var rowRenderer_1 = require("../rendering/rowRenderer");
|
32 | var eventService_1 = require("../eventService");
|
33 | var constants_1 = require("../constants");
|
34 | var beanStub_1 = require("../context/beanStub");
|
35 | var events_1 = require("../events");
|
36 | var ChangeDetectionService = (function (_super) {
|
37 | __extends(ChangeDetectionService, _super);
|
38 | function ChangeDetectionService() {
|
39 | return _super !== null && _super.apply(this, arguments) || this;
|
40 | }
|
41 | ChangeDetectionService.prototype.init = function () {
|
42 | if (this.rowModel.getType() === constants_1.Constants.ROW_MODEL_TYPE_CLIENT_SIDE) {
|
43 | this.clientSideRowModel = this.rowModel;
|
44 | }
|
45 | this.addDestroyableEventListener(this.eventService, events_1.Events.EVENT_CELL_VALUE_CHANGED, this.onCellValueChanged.bind(this));
|
46 | };
|
47 | ChangeDetectionService.prototype.onCellValueChanged = function (event) {
|
48 | this.doChangeDetection(event.node, event.column);
|
49 | };
|
50 | ChangeDetectionService.prototype.doChangeDetection = function (rowNode, column) {
|
51 | if (this.gridOptionsWrapper.isSuppressChangeDetection()) {
|
52 | return;
|
53 | }
|
54 |
|
55 | if (this.clientSideRowModel && !rowNode.isRowPinned()) {
|
56 | var onlyChangedColumns = this.gridOptionsWrapper.isAggregateOnlyChangedColumns();
|
57 | var changedPath = new changedPath_1.ChangedPath(onlyChangedColumns);
|
58 | changedPath.addParentNode(rowNode.parent, [column]);
|
59 | this.clientSideRowModel.doAggregate(changedPath);
|
60 | }
|
61 |
|
62 | this.rowRenderer.refreshCells();
|
63 | };
|
64 | __decorate([
|
65 | context_1.Autowired('gridOptionsWrapper'),
|
66 | __metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
|
67 | ], ChangeDetectionService.prototype, "gridOptionsWrapper", void 0);
|
68 | __decorate([
|
69 | context_1.Autowired('rowModel'),
|
70 | __metadata("design:type", Object)
|
71 | ], ChangeDetectionService.prototype, "rowModel", void 0);
|
72 | __decorate([
|
73 | context_1.Autowired('rowRenderer'),
|
74 | __metadata("design:type", rowRenderer_1.RowRenderer)
|
75 | ], ChangeDetectionService.prototype, "rowRenderer", void 0);
|
76 | __decorate([
|
77 | context_1.Autowired('eventService'),
|
78 | __metadata("design:type", eventService_1.EventService)
|
79 | ], ChangeDetectionService.prototype, "eventService", void 0);
|
80 | __decorate([
|
81 | context_1.PostConstruct,
|
82 | __metadata("design:type", Function),
|
83 | __metadata("design:paramtypes", []),
|
84 | __metadata("design:returntype", void 0)
|
85 | ], ChangeDetectionService.prototype, "init", null);
|
86 | ChangeDetectionService = __decorate([
|
87 | context_1.Bean('changeDetectionService')
|
88 | ], ChangeDetectionService);
|
89 | return ChangeDetectionService;
|
90 | }(beanStub_1.BeanStub));
|
91 | exports.ChangeDetectionService = ChangeDetectionService;
|