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 component_1 = require("../../widgets/component");
|
29 | var context_1 = require("../../context/context");
|
30 | var gridOptionsWrapper_1 = require("../../gridOptionsWrapper");
|
31 | var PopupEditorWrapper = (function (_super) {
|
32 | __extends(PopupEditorWrapper, _super);
|
33 | function PopupEditorWrapper(cellEditor) {
|
34 | var _this = _super.call(this, "<div class=\"ag-popup-editor\" tabindex=\"-1\"/>") || this;
|
35 | _this.getGuiCalledOnChild = false;
|
36 | _this.cellEditor = cellEditor;
|
37 | return _this;
|
38 | }
|
39 | PopupEditorWrapper.prototype.onKeyDown = function (event) {
|
40 | this.params.onKeyDown(event);
|
41 | };
|
42 | PopupEditorWrapper.prototype.getGui = function () {
|
43 |
|
44 |
|
45 | if (!this.getGuiCalledOnChild) {
|
46 | this.appendChild(this.cellEditor.getGui());
|
47 | this.getGuiCalledOnChild = true;
|
48 | }
|
49 | return _super.prototype.getGui.call(this);
|
50 | };
|
51 | PopupEditorWrapper.prototype.init = function (params) {
|
52 | var _this = this;
|
53 | this.params = params;
|
54 | this.gridOptionsWrapper.setDomData(this.getGui(), PopupEditorWrapper.DOM_KEY_POPUP_EDITOR_WRAPPER, true);
|
55 | this.addDestroyFunc(function () {
|
56 | if (_this.cellEditor.destroy) {
|
57 | _this.cellEditor.destroy();
|
58 | }
|
59 | });
|
60 | this.addDestroyableEventListener(
|
61 |
|
62 |
|
63 |
|
64 | _super.prototype.getGui.call(this), 'keydown', this.onKeyDown.bind(this));
|
65 | };
|
66 | PopupEditorWrapper.prototype.afterGuiAttached = function () {
|
67 | if (this.cellEditor.afterGuiAttached) {
|
68 | this.cellEditor.afterGuiAttached();
|
69 | }
|
70 | };
|
71 | PopupEditorWrapper.prototype.getValue = function () {
|
72 | return this.cellEditor.getValue();
|
73 | };
|
74 | PopupEditorWrapper.prototype.isPopup = function () {
|
75 | return true;
|
76 | };
|
77 | PopupEditorWrapper.prototype.isCancelBeforeStart = function () {
|
78 | if (this.cellEditor.isCancelBeforeStart) {
|
79 | return this.cellEditor.isCancelBeforeStart();
|
80 | }
|
81 | };
|
82 | PopupEditorWrapper.prototype.isCancelAfterEnd = function () {
|
83 | if (this.cellEditor.isCancelAfterEnd) {
|
84 | return this.cellEditor.isCancelAfterEnd();
|
85 | }
|
86 | };
|
87 | PopupEditorWrapper.prototype.focusIn = function () {
|
88 | if (this.cellEditor.focusIn) {
|
89 | this.cellEditor.focusIn();
|
90 | }
|
91 | };
|
92 | PopupEditorWrapper.prototype.focusOut = function () {
|
93 | if (this.cellEditor.focusOut) {
|
94 | this.cellEditor.focusOut();
|
95 | }
|
96 | };
|
97 | PopupEditorWrapper.DOM_KEY_POPUP_EDITOR_WRAPPER = 'popupEditorWrapper';
|
98 | __decorate([
|
99 | context_1.Autowired('gridOptionsWrapper'),
|
100 | __metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
|
101 | ], PopupEditorWrapper.prototype, "gridOptionsWrapper", void 0);
|
102 | return PopupEditorWrapper;
|
103 | }(component_1.Component));
|
104 | exports.PopupEditorWrapper = PopupEditorWrapper;
|