1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | "use strict";
|
8 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
9 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
10 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
11 | 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;
|
12 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
13 | };
|
14 | var __metadata = (this && this.__metadata) || function (k, v) {
|
15 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
16 | };
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | var dragAndDropService_1 = require("../dragAndDrop/dragAndDropService");
|
19 | var context_1 = require("../context/context");
|
20 | var moveColumnController_1 = require("./moveColumnController");
|
21 | var column_1 = require("../entities/column");
|
22 | var bodyDropPivotTarget_1 = require("./bodyDropPivotTarget");
|
23 | var columnController_1 = require("../columnController/columnController");
|
24 | var DropType;
|
25 | (function (DropType) {
|
26 | DropType[DropType["ColumnMove"] = 0] = "ColumnMove";
|
27 | DropType[DropType["Pivot"] = 1] = "Pivot";
|
28 | })(DropType || (DropType = {}));
|
29 | var BodyDropTarget = (function () {
|
30 | function BodyDropTarget(pinned, eContainer) {
|
31 | this.dropListeners = {};
|
32 | this.pinned = pinned;
|
33 | this.eContainer = eContainer;
|
34 | }
|
35 | BodyDropTarget.prototype.registerGridComp = function (gridPanel) {
|
36 | this.gridPanel = gridPanel;
|
37 | this.moveColumnController.registerGridComp(gridPanel);
|
38 | switch (this.pinned) {
|
39 | case column_1.Column.PINNED_LEFT:
|
40 | this.eSecondaryContainers = this.gridPanel.getDropTargetLeftContainers();
|
41 | break;
|
42 | case column_1.Column.PINNED_RIGHT:
|
43 | this.eSecondaryContainers = this.gridPanel.getDropTargetRightContainers();
|
44 | break;
|
45 | default:
|
46 | this.eSecondaryContainers = this.gridPanel.getDropTargetBodyContainers();
|
47 | break;
|
48 | }
|
49 | };
|
50 | BodyDropTarget.prototype.isInterestedIn = function (type) {
|
51 |
|
52 | return type === dragAndDropService_1.DragSourceType.HeaderCell || type === dragAndDropService_1.DragSourceType.ToolPanel;
|
53 | };
|
54 | BodyDropTarget.prototype.getSecondaryContainers = function () {
|
55 | return this.eSecondaryContainers;
|
56 | };
|
57 | BodyDropTarget.prototype.getContainer = function () {
|
58 | return this.eContainer;
|
59 | };
|
60 | BodyDropTarget.prototype.init = function () {
|
61 | this.moveColumnController = new moveColumnController_1.MoveColumnController(this.pinned, this.eContainer);
|
62 | this.context.wireBean(this.moveColumnController);
|
63 | var bodyDropPivotTarget = new bodyDropPivotTarget_1.BodyDropPivotTarget(this.pinned);
|
64 | this.context.wireBean(bodyDropPivotTarget);
|
65 | this.dropListeners[DropType.ColumnMove] = this.moveColumnController;
|
66 | this.dropListeners[DropType.Pivot] = bodyDropPivotTarget;
|
67 | this.dragAndDropService.addDropTarget(this);
|
68 | };
|
69 | BodyDropTarget.prototype.getIconName = function () {
|
70 | return this.currentDropListener.getIconName();
|
71 | };
|
72 |
|
73 |
|
74 |
|
75 | BodyDropTarget.prototype.getDropType = function (draggingEvent) {
|
76 | if (this.columnController.isPivotMode()) {
|
77 |
|
78 |
|
79 |
|
80 | if (draggingEvent.dragSource.type === dragAndDropService_1.DragSourceType.ToolPanel) {
|
81 | return DropType.Pivot;
|
82 | }
|
83 | else {
|
84 | return DropType.ColumnMove;
|
85 | }
|
86 | }
|
87 | else {
|
88 |
|
89 | return DropType.ColumnMove;
|
90 | }
|
91 | };
|
92 | BodyDropTarget.prototype.onDragEnter = function (draggingEvent) {
|
93 |
|
94 |
|
95 |
|
96 |
|
97 | var dropType = this.getDropType(draggingEvent);
|
98 | this.currentDropListener = this.dropListeners[dropType];
|
99 | this.currentDropListener.onDragEnter(draggingEvent);
|
100 | };
|
101 | BodyDropTarget.prototype.onDragLeave = function (params) {
|
102 | this.currentDropListener.onDragLeave(params);
|
103 | };
|
104 | BodyDropTarget.prototype.onDragging = function (params) {
|
105 | this.currentDropListener.onDragging(params);
|
106 | };
|
107 | BodyDropTarget.prototype.onDragStop = function (params) {
|
108 | this.currentDropListener.onDragStop(params);
|
109 | };
|
110 | __decorate([
|
111 | context_1.Autowired('context'),
|
112 | __metadata("design:type", context_1.Context)
|
113 | ], BodyDropTarget.prototype, "context", void 0);
|
114 | __decorate([
|
115 | context_1.Autowired('dragAndDropService'),
|
116 | __metadata("design:type", dragAndDropService_1.DragAndDropService)
|
117 | ], BodyDropTarget.prototype, "dragAndDropService", void 0);
|
118 | __decorate([
|
119 | context_1.Autowired('columnController'),
|
120 | __metadata("design:type", columnController_1.ColumnController)
|
121 | ], BodyDropTarget.prototype, "columnController", void 0);
|
122 | __decorate([
|
123 | context_1.PostConstruct,
|
124 | __metadata("design:type", Function),
|
125 | __metadata("design:paramtypes", []),
|
126 | __metadata("design:returntype", void 0)
|
127 | ], BodyDropTarget.prototype, "init", null);
|
128 | return BodyDropTarget;
|
129 | }());
|
130 | exports.BodyDropTarget = BodyDropTarget;
|