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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141 | 1×
1×
1×
1×
975×
975×
1×
53×
53×
1×
484×
484×
33×
451×
451×
451×
451×
6×
6×
445×
445×
445×
445×
445×
445×
425×
3×
3×
3×
422×
2×
420×
5×
5×
415×
415×
415×
415×
406×
403×
406×
12×
12×
394×
9×
9×
20×
20×
12×
12×
1×
150×
150×
150×
150×
8×
142×
142×
142×
142×
1×
141×
132×
1×
66×
66×
66×
48×
48×
1×
687×
20×
667×
40×
627×
627×
627×
627×
1×
626×
1×
975×
1×
1×
| define(["require", "exports", "@syncfusion/ej2-base", "../base/constant", "../base/css-constant"], function (require, exports, ej2_base_1, event, cls) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var WorkCellInteraction = (function () {
function WorkCellInteraction(parent) {
this.parent = parent;
ej2_base_1.EventHandler.add(this.parent.element, 'mouseover', this.onHover, this);
}
WorkCellInteraction.prototype.cellMouseDown = function (e) {
Iif (this.isPreventAction(e)) {
return;
}
this.parent.notify(event.cellMouseDown, { event: e });
};
WorkCellInteraction.prototype.cellClick = function (e) {
var _this = this;
if (this.isPreventAction(e)) {
return;
}
var queryStr = '.' + cls.WORK_CELLS_CLASS + ',.' + cls.ALLDAY_CELLS_CLASS + ',.' + cls.HEADER_CELLS_CLASS;
var target = ej2_base_1.closest(e.target, queryStr);
Iif (ej2_base_1.isNullOrUndefined(target)) {
return;
}
if (!ej2_base_1.isNullOrUndefined(ej2_base_1.closest(e.target, '.' + cls.NEW_EVENT_CLASS))) {
this.parent.eventWindow.openEditor(this.parent.activeCellsData, 'Add');
return;
}
var isWorkCell = target.classList.contains(cls.WORK_CELLS_CLASS) ||
target.classList.contains(cls.ALLDAY_CELLS_CLASS);
Iif (this.parent.uiStateValues.isTapHold && !this.parent.uiStateValues.action && isWorkCell) {
this.parent.uiStateValues.isTapHold = false;
this.parent.eventBase.removeSelectedAppointmentClass();
this.parent.selectedElements = [];
}
var navigateEle = ej2_base_1.closest(e.target, '.' + cls.NAVIGATE_CLASS);
var navigateView = this.parent.getNavigateView();
var sameView = this.parent.currentView === navigateView;
if (ej2_base_1.isNullOrUndefined(navigateEle) || sameView ||
ej2_base_1.isNullOrUndefined(this.parent.viewOptions[navigateView.charAt(0).toLowerCase() + navigateView.slice(1)])) {
if (this.parent.activeViewOptions.readonly && this.parent.currentView !== 'MonthAgenda') {
Eif (this.parent.quickPopup) {
this.parent.quickPopup.quickPopupHide();
}
return;
}
if (this.parent.isAdaptive && (e.target.classList.contains(cls.MORE_INDICATOR_CLASS) ||
ej2_base_1.closest(e.target, '.' + cls.MORE_INDICATOR_CLASS))) {
return;
}
if (isWorkCell && e.shiftKey && e.which === 1 && this.parent.keyboardInteractionModule) {
this.parent.keyboardInteractionModule.onMouseSelection(e);
return;
}
this.parent.activeCellsData = this.parent.getCellDetails(target);
var args = ej2_base_1.extend(this.parent.activeCellsData, { cancel: false, event: e, name: 'cellClick' });
this.parent.trigger(event.cellClick, args, function (clickArgs) {
if (!clickArgs.cancel) {
if (isWorkCell) {
_this.parent.selectCell(target);
}
if (_this.parent.allowInline) {
var inlineArgs = {
element: clickArgs.element,
groupIndex: clickArgs.groupIndex, type: 'Cell'
};
_this.parent.notify(event.inlineClick, inlineArgs);
}
else {
_this.parent.notify(event.cellClick, clickArgs);
}
}
else {
Eif (_this.parent.quickPopup) {
_this.parent.quickPopup.quickPopupHide();
}
}
});
}
else {
var date = this.parent.getDateFromElement(target);
if (!ej2_base_1.isNullOrUndefined(date) && this.parent.isMinMaxDate(date)) {
this.parent.setProperties({ selectedDate: date }, true);
this.parent.changeView(this.parent.getNavigateView(), e);
}
}
};
WorkCellInteraction.prototype.cellDblClick = function (e) {
var _this = this;
var queryStr = '.' + cls.WORK_CELLS_CLASS + ',.' + cls.ALLDAY_CELLS_CLASS + ',.' + cls.HEADER_CELLS_CLASS;
var target = ej2_base_1.closest(e.target, queryStr);
if (this.parent.activeViewOptions.readonly || this.isPreventAction(e) || ej2_base_1.isNullOrUndefined(target)) {
return;
}
var args = ej2_base_1.extend(this.parent.activeCellsData, { cancel: false, event: e, name: 'cellDoubleClick' });
this.parent.trigger(event.cellDoubleClick, args, function (clickArgs) {
var date = new Date(clickArgs.startTime.getTime());
if (!_this.parent.isMinMaxDate(new Date(date.setHours(0, 0, 0, 0)))) {
return;
}
if (!clickArgs.cancel) {
_this.parent.eventWindow.openEditor(_this.parent.activeCellsData, 'Add');
}
});
};
WorkCellInteraction.prototype.onHover = function (e) {
var targetSelector = '.' + cls.WORK_CELLS_CLASS + ',.' + cls.TIME_SLOT_CLASS + ',.' + cls.ALLDAY_CELLS_CLASS + ',.' +
cls.HEADER_CELLS_CLASS + ',.' + cls.RESOURCE_CELLS_CLASS + ',.' + cls.APPOINTMENT_CLASS + ',.' + cls.WEEK_NUMBER_CLASS +
',.' + cls.MONTH_HEADER_CLASS;
var hoverTarget = ej2_base_1.closest(e.target, targetSelector);
if (hoverTarget) {
var hoverArgs = { element: hoverTarget, event: e };
this.parent.trigger(event.hover, hoverArgs);
}
};
WorkCellInteraction.prototype.isPreventAction = function (e) {
if (ej2_base_1.closest(e.target, '.' + cls.NAVIGATE_CLASS)) {
return false;
}
if (ej2_base_1.closest(e.target, '.' + cls.APPOINTMENT_WRAPPER_CLASS) &&
!ej2_base_1.closest(e.target, '.' + cls.MORE_INDICATOR_CLASS)) {
return true;
}
var target = ej2_base_1.closest(e.target, '.' + cls.APPOINTMENT_CLASS + ',.' + cls.RESOURCE_GROUP_CELLS_CLASS);
Iif (!ej2_base_1.isNullOrUndefined(target)) {
return true;
}
target = ej2_base_1.closest(e.target, '.' + cls.HEADER_CELLS_CLASS);
if (this.parent.activeView && this.parent.activeView.isTimelineView() && !ej2_base_1.isNullOrUndefined(target)) {
return true;
}
return false;
};
WorkCellInteraction.prototype.destroy = function () {
ej2_base_1.EventHandler.remove(this.parent.element, 'mouseover', this.onHover);
};
return WorkCellInteraction;
}());
exports.WorkCellInteraction = WorkCellInteraction;
});
|