@syncfusion/ej2-schedule 31.1.17 → 31.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ej2-schedule.min.js +2 -2
- package/dist/ej2-schedule.umd.min.js +2 -2
- package/dist/ej2-schedule.umd.min.js.map +1 -1
- package/dist/es6/ej2-schedule.es2015.js +1 -1
- package/dist/es6/ej2-schedule.es2015.js.map +1 -1
- package/dist/es6/ej2-schedule.es5.js +1 -1
- package/dist/es6/ej2-schedule.es5.js.map +1 -1
- package/dist/global/ej2-schedule.min.js +2 -2
- package/dist/global/ej2-schedule.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +17 -52
- package/src/schedule/event-renderer/event-base.js +1 -1
- package/styles/bootstrap4-lite.css +8 -0
- package/styles/bootstrap4.css +8 -0
- package/styles/recurrence-editor/bootstrap4.css +8 -0
- package/styles/schedule/bootstrap4.css +8 -0
- package/dist/ts/common/calendar-util.d.ts +0 -92
- package/dist/ts/common/calendar-util.ts +0 -261
- package/dist/ts/common/index.d.ts +0 -4
- package/dist/ts/common/index.ts +0 -4
- package/dist/ts/components.d.ts +0 -5
- package/dist/ts/components.ts +0 -5
- package/dist/ts/index.d.ts +0 -6
- package/dist/ts/index.ts +0 -7
- package/dist/ts/recurrence-editor/date-generator.d.ts +0 -76
- package/dist/ts/recurrence-editor/date-generator.ts +0 -1699
- package/dist/ts/recurrence-editor/index.d.ts +0 -6
- package/dist/ts/recurrence-editor/index.ts +0 -6
- package/dist/ts/recurrence-editor/recurrence-editor-model.d.ts +0 -112
- package/dist/ts/recurrence-editor/recurrence-editor.d.ts +0 -245
- package/dist/ts/recurrence-editor/recurrence-editor.ts +0 -1257
- package/dist/ts/schedule/actions/action-base.d.ts +0 -44
- package/dist/ts/schedule/actions/action-base.ts +0 -493
- package/dist/ts/schedule/actions/crud.d.ts +0 -41
- package/dist/ts/schedule/actions/crud.ts +0 -784
- package/dist/ts/schedule/actions/data.d.ts +0 -63
- package/dist/ts/schedule/actions/data.ts +0 -128
- package/dist/ts/schedule/actions/drag.d.ts +0 -75
- package/dist/ts/schedule/actions/drag.ts +0 -1401
- package/dist/ts/schedule/actions/keyboard.d.ts +0 -100
- package/dist/ts/schedule/actions/keyboard.ts +0 -1435
- package/dist/ts/schedule/actions/resize.d.ts +0 -27
- package/dist/ts/schedule/actions/resize.ts +0 -602
- package/dist/ts/schedule/actions/scroll.d.ts +0 -69
- package/dist/ts/schedule/actions/scroll.ts +0 -105
- package/dist/ts/schedule/actions/touch.d.ts +0 -32
- package/dist/ts/schedule/actions/touch.ts +0 -314
- package/dist/ts/schedule/actions/virtual-scroll.d.ts +0 -55
- package/dist/ts/schedule/actions/virtual-scroll.ts +0 -596
- package/dist/ts/schedule/actions/work-cells.d.ts +0 -14
- package/dist/ts/schedule/actions/work-cells.ts +0 -151
- package/dist/ts/schedule/base/constant.d.ts +0 -102
- package/dist/ts/schedule/base/constant.ts +0 -103
- package/dist/ts/schedule/base/css-constant.d.ts +0 -475
- package/dist/ts/schedule/base/css-constant.ts +0 -475
- package/dist/ts/schedule/base/interface.d.ts +0 -673
- package/dist/ts/schedule/base/interface.ts +0 -738
- package/dist/ts/schedule/base/resource.d.ts +0 -59
- package/dist/ts/schedule/base/resource.ts +0 -1091
- package/dist/ts/schedule/base/schedule-model.d.ts +0 -930
- package/dist/ts/schedule/base/schedule.d.ts +0 -1967
- package/dist/ts/schedule/base/schedule.ts +0 -4221
- package/dist/ts/schedule/base/type.d.ts +0 -134
- package/dist/ts/schedule/base/type.ts +0 -142
- package/dist/ts/schedule/base/util.d.ts +0 -266
- package/dist/ts/schedule/base/util.ts +0 -492
- package/dist/ts/schedule/event-renderer/agenda-base.d.ts +0 -15
- package/dist/ts/schedule/event-renderer/agenda-base.ts +0 -423
- package/dist/ts/schedule/event-renderer/event-base.d.ts +0 -101
- package/dist/ts/schedule/event-renderer/event-base.ts +0 -1501
- package/dist/ts/schedule/event-renderer/inline-edit.d.ts +0 -23
- package/dist/ts/schedule/event-renderer/inline-edit.ts +0 -287
- package/dist/ts/schedule/event-renderer/month.d.ts +0 -60
- package/dist/ts/schedule/event-renderer/month.ts +0 -760
- package/dist/ts/schedule/event-renderer/timeline-view.d.ts +0 -51
- package/dist/ts/schedule/event-renderer/timeline-view.ts +0 -606
- package/dist/ts/schedule/event-renderer/vertical-view.d.ts +0 -57
- package/dist/ts/schedule/event-renderer/vertical-view.ts +0 -898
- package/dist/ts/schedule/event-renderer/year.d.ts +0 -27
- package/dist/ts/schedule/event-renderer/year.ts +0 -623
- package/dist/ts/schedule/exports/calendar-export.d.ts +0 -16
- package/dist/ts/schedule/exports/calendar-export.ts +0 -160
- package/dist/ts/schedule/exports/calendar-import.d.ts +0 -18
- package/dist/ts/schedule/exports/calendar-import.ts +0 -277
- package/dist/ts/schedule/exports/excel-export.d.ts +0 -14
- package/dist/ts/schedule/exports/excel-export.ts +0 -89
- package/dist/ts/schedule/exports/index.d.ts +0 -7
- package/dist/ts/schedule/exports/index.ts +0 -7
- package/dist/ts/schedule/exports/print.d.ts +0 -20
- package/dist/ts/schedule/exports/print.ts +0 -233
- package/dist/ts/schedule/index.d.ts +0 -26
- package/dist/ts/schedule/index.ts +0 -26
- package/dist/ts/schedule/models/event-settings-model.d.ts +0 -165
- package/dist/ts/schedule/models/event-settings.d.ts +0 -149
- package/dist/ts/schedule/models/event-settings.ts +0 -187
- package/dist/ts/schedule/models/field-options-model.d.ts +0 -37
- package/dist/ts/schedule/models/field-options.d.ts +0 -31
- package/dist/ts/schedule/models/field-options.ts +0 -41
- package/dist/ts/schedule/models/fields-model.d.ts +0 -129
- package/dist/ts/schedule/models/fields.d.ts +0 -117
- package/dist/ts/schedule/models/fields.ts +0 -149
- package/dist/ts/schedule/models/group-model.d.ts +0 -69
- package/dist/ts/schedule/models/group.d.ts +0 -60
- package/dist/ts/schedule/models/group.ts +0 -75
- package/dist/ts/schedule/models/header-rows-model.d.ts +0 -33
- package/dist/ts/schedule/models/header-rows.d.ts +0 -30
- package/dist/ts/schedule/models/header-rows.ts +0 -35
- package/dist/ts/schedule/models/models.d.ts +0 -14
- package/dist/ts/schedule/models/models.ts +0 -15
- package/dist/ts/schedule/models/quick-info-templates-model.d.ts +0 -52
- package/dist/ts/schedule/models/quick-info-templates.d.ts +0 -47
- package/dist/ts/schedule/models/quick-info-templates.ts +0 -56
- package/dist/ts/schedule/models/resources-model.d.ts +0 -122
- package/dist/ts/schedule/models/resources.d.ts +0 -106
- package/dist/ts/schedule/models/resources.ts +0 -138
- package/dist/ts/schedule/models/time-scale-model.d.ts +0 -57
- package/dist/ts/schedule/models/time-scale.d.ts +0 -50
- package/dist/ts/schedule/models/time-scale.ts +0 -61
- package/dist/ts/schedule/models/toolbar-model.d.ts +0 -196
- package/dist/ts/schedule/models/toolbar.d.ts +0 -176
- package/dist/ts/schedule/models/toolbar.ts +0 -196
- package/dist/ts/schedule/models/views-model.d.ts +0 -370
- package/dist/ts/schedule/models/views.d.ts +0 -335
- package/dist/ts/schedule/models/views.ts +0 -408
- package/dist/ts/schedule/models/work-hours-model.d.ts +0 -29
- package/dist/ts/schedule/models/work-hours.d.ts +0 -24
- package/dist/ts/schedule/models/work-hours.ts +0 -31
- package/dist/ts/schedule/popups/event-tooltip.d.ts +0 -16
- package/dist/ts/schedule/popups/event-tooltip.ts +0 -203
- package/dist/ts/schedule/popups/event-window.d.ts +0 -118
- package/dist/ts/schedule/popups/event-window.ts +0 -2055
- package/dist/ts/schedule/popups/form-validator.d.ts +0 -16
- package/dist/ts/schedule/popups/form-validator.ts +0 -110
- package/dist/ts/schedule/popups/quick-popups.d.ts +0 -78
- package/dist/ts/schedule/popups/quick-popups.ts +0 -1470
- package/dist/ts/schedule/renderer/agenda.d.ts +0 -45
- package/dist/ts/schedule/renderer/agenda.ts +0 -497
- package/dist/ts/schedule/renderer/day.d.ts +0 -20
- package/dist/ts/schedule/renderer/day.ts +0 -28
- package/dist/ts/schedule/renderer/header-renderer.d.ts +0 -48
- package/dist/ts/schedule/renderer/header-renderer.ts +0 -736
- package/dist/ts/schedule/renderer/month-agenda.d.ts +0 -29
- package/dist/ts/schedule/renderer/month-agenda.ts +0 -184
- package/dist/ts/schedule/renderer/month.d.ts +0 -61
- package/dist/ts/schedule/renderer/month.ts +0 -766
- package/dist/ts/schedule/renderer/renderer.d.ts +0 -13
- package/dist/ts/schedule/renderer/renderer.ts +0 -165
- package/dist/ts/schedule/renderer/timeline-header-row.d.ts +0 -15
- package/dist/ts/schedule/renderer/timeline-header-row.ts +0 -132
- package/dist/ts/schedule/renderer/timeline-month.d.ts +0 -29
- package/dist/ts/schedule/renderer/timeline-month.ts +0 -184
- package/dist/ts/schedule/renderer/timeline-view.d.ts +0 -31
- package/dist/ts/schedule/renderer/timeline-view.ts +0 -308
- package/dist/ts/schedule/renderer/timeline-year.d.ts +0 -22
- package/dist/ts/schedule/renderer/timeline-year.ts +0 -450
- package/dist/ts/schedule/renderer/vertical-view.d.ts +0 -63
- package/dist/ts/schedule/renderer/vertical-view.ts +0 -911
- package/dist/ts/schedule/renderer/view-base.d.ts +0 -83
- package/dist/ts/schedule/renderer/view-base.ts +0 -709
- package/dist/ts/schedule/renderer/week.d.ts +0 -22
- package/dist/ts/schedule/renderer/week.ts +0 -35
- package/dist/ts/schedule/renderer/work-week.d.ts +0 -22
- package/dist/ts/schedule/renderer/work-week.ts +0 -36
- package/dist/ts/schedule/renderer/year.d.ts +0 -46
- package/dist/ts/schedule/renderer/year.ts +0 -470
- package/dist/ts/schedule/timezone/timezone.d.ts +0 -16
- package/dist/ts/schedule/timezone/timezone.ts +0 -313
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ActionBase } from '../actions/action-base';
|
|
2
|
-
/**
|
|
3
|
-
* Schedule events resize actions
|
|
4
|
-
*/
|
|
5
|
-
export declare class Resize extends ActionBase {
|
|
6
|
-
wireResizeEvent(element: HTMLElement): void;
|
|
7
|
-
private resizeHelper;
|
|
8
|
-
resizeStart(e: MouseEvent & TouchEvent): void;
|
|
9
|
-
private resizing;
|
|
10
|
-
updateResizingDirection(e: MouseEvent & TouchEvent): void;
|
|
11
|
-
private monthResizing;
|
|
12
|
-
private yearEventsRendering;
|
|
13
|
-
private getMonthDiff;
|
|
14
|
-
private getEventCount;
|
|
15
|
-
private resizeStop;
|
|
16
|
-
private verticalResizing;
|
|
17
|
-
private horizontalResizing;
|
|
18
|
-
private getTopBottomStyles;
|
|
19
|
-
private getLeftRightStyles;
|
|
20
|
-
private resizeValidation;
|
|
21
|
-
/**
|
|
22
|
-
* Get module name
|
|
23
|
-
*
|
|
24
|
-
* @returns {string} Returns the module name..
|
|
25
|
-
*/
|
|
26
|
-
protected getModuleName(): string;
|
|
27
|
-
}
|
|
@@ -1,602 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { addClass, Browser, EventHandler, remove, closest, extend, formatUnit, setStyleAttribute, isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
3
|
-
import { ResizeEventArgs } from '../base/interface';
|
|
4
|
-
import { ActionBase } from '../actions/action-base';
|
|
5
|
-
import { MonthEvent } from '../event-renderer/month';
|
|
6
|
-
import * as util from '../base/util';
|
|
7
|
-
import * as event from '../base/constant';
|
|
8
|
-
import * as cls from '../base/css-constant';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Schedule events resize actions
|
|
12
|
-
*/
|
|
13
|
-
export class Resize extends ActionBase {
|
|
14
|
-
public wireResizeEvent(element: HTMLElement): void {
|
|
15
|
-
const resizeElement: HTMLElement[] = [].slice.call(element.querySelectorAll('.' + cls.EVENT_RESIZE_CLASS));
|
|
16
|
-
for (const element of resizeElement) {
|
|
17
|
-
EventHandler.add(element, Browser.touchStartEvent, this.resizeStart, this);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
private resizeHelper(): void {
|
|
22
|
-
if (this.parent.activeViewOptions.group.resources.length > 0 && this.parent.activeViewOptions.group.allowGroupEdit) {
|
|
23
|
-
for (let i: number = 0, len: number = this.actionObj.originalElement.length; i < len; i++) {
|
|
24
|
-
const cloneElement: HTMLElement = this.createCloneElement(this.actionObj.originalElement[parseInt(i.toString(), 10)]);
|
|
25
|
-
this.actionObj.cloneElement[parseInt(i.toString(), 10)] = cloneElement;
|
|
26
|
-
if (this.actionObj.element === this.actionObj.originalElement[parseInt(i.toString(), 10)]) {
|
|
27
|
-
this.actionObj.clone = cloneElement;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
} else {
|
|
31
|
-
if (this.actionObj.element) {
|
|
32
|
-
this.actionObj.clone = this.createCloneElement(this.actionObj.element);
|
|
33
|
-
}
|
|
34
|
-
this.actionObj.cloneElement = [this.actionObj.clone];
|
|
35
|
-
this.actionObj.originalElement = [this.actionObj.element];
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
public resizeStart(e: MouseEvent & TouchEvent): void {
|
|
40
|
-
if ((e && e.type === 'touchstart' && (!this.parent.uiStateValues.isTapHold ||
|
|
41
|
-
!closest(e.target as Element, '.' + cls.APPOINTMENT_BORDER))) || closest(e.target as Element, '.' + cls.INLINE_EDIT_CLASS)) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const resizeTarget: HTMLElement = closest(e.target as Element, '.' + cls.EVENT_RESIZE_CLASS) as HTMLElement;
|
|
45
|
-
this.actionObj.element = closest(resizeTarget, '.' + cls.APPOINTMENT_CLASS) as HTMLElement;
|
|
46
|
-
this.actionObj.event = this.parent.eventBase.getEventByGuid(this.actionObj.element.getAttribute('data-guid')) as Record<string, any>;
|
|
47
|
-
if (isNullOrUndefined(this.actionObj.event)) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
this.parent.eventBase.removeSelectedAppointmentClass();
|
|
51
|
-
this.actionObj.action = 'resize';
|
|
52
|
-
this.actionObj.slotInterval = this.parent.activeViewOptions.timeScale.interval / this.parent.activeViewOptions.timeScale.slotCount;
|
|
53
|
-
this.actionObj.interval = this.actionObj.slotInterval;
|
|
54
|
-
const eventObj: Record<string, any> = extend({}, this.actionObj.event, null, true) as Record<string, any>;
|
|
55
|
-
const resizeArgs: ResizeEventArgs = {
|
|
56
|
-
cancel: false,
|
|
57
|
-
data: eventObj,
|
|
58
|
-
element: this.actionObj.element,
|
|
59
|
-
event: e,
|
|
60
|
-
interval: this.actionObj.interval,
|
|
61
|
-
scroll: { enable: true, scrollBy: 30, timeDelay: 100 }
|
|
62
|
-
};
|
|
63
|
-
this.parent.trigger(event.resizeStart, resizeArgs, (resizeEventArgs: ResizeEventArgs) => {
|
|
64
|
-
if (resizeEventArgs.cancel) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
this.actionClass('addClass');
|
|
68
|
-
this.parent.uiStateValues.action = true;
|
|
69
|
-
this.resizeEdges = {
|
|
70
|
-
left: resizeTarget.classList.contains(cls.LEFT_RESIZE_HANDLER),
|
|
71
|
-
right: resizeTarget.classList.contains(cls.RIGHT_RESIZE_HANDLER),
|
|
72
|
-
top: resizeTarget.classList.contains(cls.TOP_RESIZE_HANDLER),
|
|
73
|
-
bottom: resizeTarget.classList.contains(cls.BOTTOM_RESIZE_HANDLER)
|
|
74
|
-
};
|
|
75
|
-
this.actionObj.groupIndex = this.parent.uiStateValues.isGroupAdaptive ? this.parent.uiStateValues.groupIndex : 0;
|
|
76
|
-
const workCell: HTMLElement = this.parent.element.querySelector('.' + cls.WORK_CELLS_CLASS);
|
|
77
|
-
this.actionObj.cellWidth = this.parent.getElementWidth(workCell);
|
|
78
|
-
this.actionObj.cellHeight = this.parent.getElementHeight(workCell);
|
|
79
|
-
const hRows: string[] = this.parent.activeViewOptions.headerRows.map((row: Record<string, any>) => row.option as string);
|
|
80
|
-
if (this.parent.activeView.isTimelineView() && hRows.length > 0 && ['Date', 'Hour'].indexOf(hRows.slice(-1)[0]) < 0) {
|
|
81
|
-
const tr: HTMLTableRowElement = this.parent.getContentTable().querySelector('tr') as HTMLTableRowElement;
|
|
82
|
-
let noOfDays: number = 0;
|
|
83
|
-
const tdCollections: HTMLElement[] = [].slice.call(tr.children);
|
|
84
|
-
for (const td of tdCollections) {
|
|
85
|
-
noOfDays += parseInt(td.getAttribute('colspan'), 10);
|
|
86
|
-
}
|
|
87
|
-
const trRect: ClientRect = tr.getBoundingClientRect();
|
|
88
|
-
this.actionObj.cellWidth = trRect.width / noOfDays;
|
|
89
|
-
this.actionObj.cellHeight = trRect.height;
|
|
90
|
-
}
|
|
91
|
-
const pages: (MouseEvent & TouchEvent) | Touch = this.parent.eventBase.getPageCoordinates(e);
|
|
92
|
-
this.actionObj.X = pages.pageX;
|
|
93
|
-
this.actionObj.Y = pages.pageY;
|
|
94
|
-
this.actionObj.groupIndex = parseInt(this.actionObj.element.getAttribute('data-group-index') || '0', 10);
|
|
95
|
-
this.actionObj.interval = resizeEventArgs.interval;
|
|
96
|
-
this.actionObj.scroll = resizeEventArgs.scroll;
|
|
97
|
-
this.actionObj.start = new Date((eventObj[this.parent.eventFields.startTime] as Date).getTime());
|
|
98
|
-
this.actionObj.end = new Date((eventObj[this.parent.eventFields.endTime] as Date).getTime());
|
|
99
|
-
this.actionObj.originalElement = this.getOriginalElement(this.actionObj.element);
|
|
100
|
-
if (this.parent.currentView === 'Month') {
|
|
101
|
-
this.daysVariation = -1;
|
|
102
|
-
this.monthEvent = new MonthEvent(this.parent);
|
|
103
|
-
}
|
|
104
|
-
const viewElement: HTMLElement = this.parent.element.querySelector('.' + cls.CONTENT_WRAP_CLASS) as HTMLElement;
|
|
105
|
-
this.scrollArgs = { element: viewElement, width: viewElement.scrollWidth, height: viewElement.scrollHeight };
|
|
106
|
-
// 883565 - To fix the resizing not working issue at the last column of the timeline view
|
|
107
|
-
if (['Month', 'TimelineYear'].indexOf(this.parent.currentView) < 0) {
|
|
108
|
-
const scrollWidth: number = Math.round(this.scrollArgs.width / this.actionObj.cellWidth) * this.actionObj.cellWidth;
|
|
109
|
-
this.scrollArgs.width = this.scrollArgs.width < scrollWidth ? scrollWidth : this.scrollArgs.width;
|
|
110
|
-
}
|
|
111
|
-
EventHandler.add(document, Browser.touchMoveEvent, this.resizing, this);
|
|
112
|
-
EventHandler.add(document, Browser.touchEndEvent, this.resizeStop, this);
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
private resizing(e: MouseEvent & TouchEvent): void {
|
|
117
|
-
if (e && e.type === 'touchmove') {
|
|
118
|
-
e.preventDefault();
|
|
119
|
-
}
|
|
120
|
-
if (this.parent.quickPopup) {
|
|
121
|
-
this.parent.quickPopup.quickPopupHide();
|
|
122
|
-
}
|
|
123
|
-
if (this.parent.element.querySelectorAll('.' + cls.RESIZE_CLONE_CLASS).length === 0) {
|
|
124
|
-
this.resizeHelper();
|
|
125
|
-
}
|
|
126
|
-
if ((!isNullOrUndefined(e.target)) && (e.target as HTMLElement).classList.contains(cls.DISABLE_DATES)) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
const pages: (MouseEvent & TouchEvent) | Touch = this.parent.eventBase.getPageCoordinates(e);
|
|
130
|
-
if (this.parent.currentView === 'Month' || this.parent.currentView === 'TimelineYear') {
|
|
131
|
-
const doc: HTMLElement = document.documentElement;
|
|
132
|
-
const left: number = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);
|
|
133
|
-
const top: number = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
|
|
134
|
-
this.actionObj.pageX = pages.pageX - left;
|
|
135
|
-
this.actionObj.pageY = pages.pageY - top;
|
|
136
|
-
} else {
|
|
137
|
-
this.actionObj.pageX = pages.pageX;
|
|
138
|
-
this.actionObj.pageY = pages.pageY;
|
|
139
|
-
}
|
|
140
|
-
this.updateScrollPosition(e);
|
|
141
|
-
this.updateResizingDirection(e);
|
|
142
|
-
const eventObj: Record<string, any> = extend({}, this.actionObj.event, null, true) as Record<string, any>;
|
|
143
|
-
const resizeArgs: ResizeEventArgs = {
|
|
144
|
-
cancel: false,
|
|
145
|
-
data: eventObj,
|
|
146
|
-
element: this.actionObj.element,
|
|
147
|
-
event: e,
|
|
148
|
-
startTime: this.actionObj.start,
|
|
149
|
-
endTime: this.actionObj.end
|
|
150
|
-
};
|
|
151
|
-
if (this.parent.group.resources.length > 0) {
|
|
152
|
-
resizeArgs.groupIndex = this.actionObj.groupIndex;
|
|
153
|
-
}
|
|
154
|
-
this.parent.trigger(event.resizing, resizeArgs);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
public updateResizingDirection(e: MouseEvent & TouchEvent): void {
|
|
158
|
-
if (this.parent.currentView === 'Month' || this.parent.currentView === 'TimelineYear') {
|
|
159
|
-
this.monthResizing();
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
const resizeValidation: boolean = this.resizeValidation(e);
|
|
163
|
-
if (this.resizeEdges.left) {
|
|
164
|
-
if (resizeValidation) {
|
|
165
|
-
const leftStyles: Record<string, any> = this.getLeftRightStyles(e, true);
|
|
166
|
-
if (parseInt(leftStyles.width as string, 10) < 1) {
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
for (const cloneElement of this.actionObj.cloneElement) {
|
|
170
|
-
setStyleAttribute(cloneElement, leftStyles);
|
|
171
|
-
addClass([cloneElement], cls.LEFT_RESIZE_HANDLER);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
this.horizontalResizing(!this.parent.enableRtl);
|
|
175
|
-
}
|
|
176
|
-
if (this.resizeEdges.right) {
|
|
177
|
-
if (resizeValidation) {
|
|
178
|
-
const rightStyles: Record<string, any> = this.getLeftRightStyles(e, false);
|
|
179
|
-
if (parseInt(rightStyles.width as string, 10) < 1) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
for (const cloneElement of this.actionObj.cloneElement) {
|
|
183
|
-
setStyleAttribute(cloneElement, rightStyles);
|
|
184
|
-
addClass([cloneElement], cls.RIGHT_RESIZE_HANDLER);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
this.horizontalResizing(this.parent.enableRtl);
|
|
188
|
-
}
|
|
189
|
-
if (this.resizeEdges.top) {
|
|
190
|
-
if (resizeValidation) {
|
|
191
|
-
const topStyles: Record<string, any> = this.getTopBottomStyles(e, true);
|
|
192
|
-
if (parseInt(topStyles.height as string, 10) < 1) {
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
for (const cloneElement of this.actionObj.cloneElement) {
|
|
196
|
-
setStyleAttribute(cloneElement, topStyles);
|
|
197
|
-
addClass([cloneElement], cls.TOP_RESIZE_HANDLER);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
this.verticalResizing(true);
|
|
201
|
-
}
|
|
202
|
-
if (this.resizeEdges.bottom) {
|
|
203
|
-
if (resizeValidation) {
|
|
204
|
-
const bottomStyles: Record<string, any> = this.getTopBottomStyles(e, false);
|
|
205
|
-
if (parseInt(bottomStyles.height as string, 10) < 1) {
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
for (const cloneElement of this.actionObj.cloneElement) {
|
|
209
|
-
setStyleAttribute(cloneElement, bottomStyles);
|
|
210
|
-
addClass([cloneElement], cls.BOTTOM_RESIZE_HANDLER);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
this.verticalResizing(false);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
private monthResizing(): void {
|
|
218
|
-
this.removeCloneElement();
|
|
219
|
-
if (isNullOrUndefined(this.actionObj.pageX) || isNullOrUndefined(this.actionObj.pageY)) {
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
const td: HTMLTableCellElement = document.elementFromPoint(this.actionObj.pageX, this.actionObj.pageY) as HTMLTableCellElement;
|
|
223
|
-
if (isNullOrUndefined(td)) {
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
const resizeTime: Date = this.parent.getDateFromElement(td);
|
|
227
|
-
const isSameCell: boolean = this.parent.activeViewOptions.group.resources.length > 0 ?
|
|
228
|
-
parseInt(td.getAttribute('data-group-index'), 10) === this.actionObj.groupIndex : true;
|
|
229
|
-
let startTime: Date = new Date((<Date>this.actionObj.event[this.parent.eventFields.startTime]).getTime());
|
|
230
|
-
let endTime: Date = new Date((<Date>this.actionObj.event[this.parent.eventFields.endTime]).getTime());
|
|
231
|
-
if ((!this.parent.enableRtl && this.resizeEdges.left) || (this.parent.enableRtl && this.resizeEdges.right)
|
|
232
|
-
|| this.resizeEdges.top) {
|
|
233
|
-
startTime = resizeTime;
|
|
234
|
-
} else if ((!this.parent.enableRtl && this.resizeEdges.right) || (this.parent.enableRtl && this.resizeEdges.left)
|
|
235
|
-
|| this.resizeEdges.bottom) {
|
|
236
|
-
endTime = util.addDays(resizeTime, 1);
|
|
237
|
-
}
|
|
238
|
-
if (isSameCell && startTime < endTime) {
|
|
239
|
-
this.actionObj.start = startTime;
|
|
240
|
-
this.actionObj.end = endTime;
|
|
241
|
-
const event: Record<string, any> = this.getUpdatedEvent(this.actionObj.start, this.actionObj.end, this.actionObj.event);
|
|
242
|
-
if (this.parent.currentView === 'TimelineYear') {
|
|
243
|
-
this.yearEventsRendering(event);
|
|
244
|
-
} else {
|
|
245
|
-
this.dynamicEventsRendering(event);
|
|
246
|
-
}
|
|
247
|
-
this.updateOriginalElement(this.actionObj.clone);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
private yearEventsRendering(event: Record<string, any>): void {
|
|
252
|
-
const eventWrappers: HTMLElement[] = [].slice.call(this.parent.element.querySelectorAll('.' + cls.CLONE_ELEMENT_CLASS));
|
|
253
|
-
for (const wrapper of eventWrappers) {
|
|
254
|
-
remove(wrapper);
|
|
255
|
-
}
|
|
256
|
-
let endDate: Date = new Date(event[this.parent.eventFields.endTime] as Date);
|
|
257
|
-
let monthDiff: number = 0;
|
|
258
|
-
if (this.parent.activeViewOptions.group.resources.length === 0) {
|
|
259
|
-
monthDiff = this.getMonthDiff(event[this.parent.eventFields.startTime] as Date, util.addDays(endDate, -1));
|
|
260
|
-
}
|
|
261
|
-
for (let i: number = 0; i <= monthDiff; i++) {
|
|
262
|
-
let eventObj: Record<string, any>;
|
|
263
|
-
if (this.parent.activeViewOptions.group.resources.length === 0) {
|
|
264
|
-
eventObj = this.getEventCount(event, this.actionObj.start.getMonth() + i);
|
|
265
|
-
} else {
|
|
266
|
-
eventObj = extend({}, event, null, true) as Record<string, any>;
|
|
267
|
-
endDate = this.resizeEdges.left || this.resizeEdges.right ? util.addDays(endDate, -1) : endDate;
|
|
268
|
-
eventObj.count = this.getMonthDiff(event[this.parent.eventFields.startTime] as Date, endDate) + 1;
|
|
269
|
-
}
|
|
270
|
-
this.dynamicYearlyEventsRendering(eventObj, true);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
private getMonthDiff(startDate: Date, endDate: Date): number {
|
|
275
|
-
let months: number;
|
|
276
|
-
months = (endDate.getFullYear() - startDate.getFullYear()) * 12;
|
|
277
|
-
months -= startDate.getMonth();
|
|
278
|
-
months += endDate.getMonth();
|
|
279
|
-
return months <= 0 ? 0 : months;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
private getEventCount(eventObj: Record<string, any>, month: number): Record<string, any> {
|
|
283
|
-
const eventData: Record<string, any> = extend({}, eventObj, null, true) as Record<string, any>;
|
|
284
|
-
const eventStart: Date = eventData[this.parent.eventFields.startTime] as Date;
|
|
285
|
-
const eventEnd: Date = eventData[this.parent.eventFields.endTime] as Date;
|
|
286
|
-
const monthStart: Date = new Date(this.parent.selectedDate.getFullYear(), month, 1);
|
|
287
|
-
const monthEnd: Date = util.addDays(new Date(this.parent.selectedDate.getFullYear(), month + 1, 0), 1);
|
|
288
|
-
let count: number = 1;
|
|
289
|
-
if (eventStart.getTime() < monthStart.getTime()) {
|
|
290
|
-
eventData[this.parent.eventFields.startTime] = monthStart;
|
|
291
|
-
}
|
|
292
|
-
if (eventEnd.getTime() > monthEnd.getTime()) {
|
|
293
|
-
eventData[this.parent.eventFields.endTime] = monthEnd;
|
|
294
|
-
}
|
|
295
|
-
if (this.parent.activeViewOptions.group.resources.length === 0) {
|
|
296
|
-
count = Math.ceil(((eventData[this.parent.eventFields.endTime] as Date).getTime() -
|
|
297
|
-
(eventData[this.parent.eventFields.startTime] as Date).getTime()) / util.MS_PER_DAY);
|
|
298
|
-
}
|
|
299
|
-
eventData.count = count;
|
|
300
|
-
return eventData;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
private resizeStop(e: MouseEvent): void {
|
|
304
|
-
EventHandler.remove(document, Browser.touchMoveEvent, this.resizing);
|
|
305
|
-
EventHandler.remove(document, Browser.touchEndEvent, this.resizeStop);
|
|
306
|
-
clearInterval(this.actionObj.scrollInterval);
|
|
307
|
-
this.actionObj.scrollInterval = null;
|
|
308
|
-
this.actionObj.action = null;
|
|
309
|
-
this.removeCloneElementClasses();
|
|
310
|
-
this.removeCloneElement();
|
|
311
|
-
this.actionClass('removeClass');
|
|
312
|
-
this.parent.uiStateValues.action = this.parent.uiStateValues.isTapHold = false;
|
|
313
|
-
const resizeArgs: ResizeEventArgs = { cancel: false, data: this.getChangedData(), element: this.actionObj.element, event: e };
|
|
314
|
-
this.parent.trigger(event.resizeStop, resizeArgs, (resizeEventArgs: ResizeEventArgs) => {
|
|
315
|
-
if (resizeEventArgs.cancel) {
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
318
|
-
if (this.parent.eventBase.checkOverlap(resizeEventArgs.data)) {
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
if (this.parent.isSpecificResourceEvents()) {
|
|
322
|
-
this.parent.crudModule.crudObj.sourceEvent =
|
|
323
|
-
[this.parent.resourceBase.lastResourceLevel[parseInt(resizeEventArgs.element.getAttribute('data-group-index'), 10)]];
|
|
324
|
-
this.parent.crudModule.crudObj.targetEvent = this.parent.crudModule.crudObj.sourceEvent;
|
|
325
|
-
this.parent.crudModule.crudObj.isCrudAction = true;
|
|
326
|
-
}
|
|
327
|
-
this.saveChangedData(resizeEventArgs);
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
private verticalResizing(isTop: boolean): void {
|
|
332
|
-
let offsetValue: number = this.actionObj.clone.offsetTop;
|
|
333
|
-
if (!isTop) {
|
|
334
|
-
offsetValue += this.actionObj.clone.offsetHeight;
|
|
335
|
-
}
|
|
336
|
-
const minutes: number = (offsetValue / Math.round(this.actionObj.cellHeight)) * this.actionObj.slotInterval;
|
|
337
|
-
const element: Element = this.actionObj.clone.offsetParent;
|
|
338
|
-
if (isNullOrUndefined(element)) {
|
|
339
|
-
return;
|
|
340
|
-
}
|
|
341
|
-
const resizeTime: Date = util.resetTime(this.parent.getDateFromElement(element));
|
|
342
|
-
resizeTime.setHours(this.parent.activeView.getStartHour().getHours());
|
|
343
|
-
resizeTime.setMinutes(minutes + this.parent.activeView.getStartHour().getMinutes());
|
|
344
|
-
if (isTop) {
|
|
345
|
-
this.actionObj.start = this.calculateIntervalTime(resizeTime);
|
|
346
|
-
} else {
|
|
347
|
-
this.actionObj.end = this.calculateIntervalTime(resizeTime);
|
|
348
|
-
}
|
|
349
|
-
this.updateTimePosition(resizeTime);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
private horizontalResizing(isLeft: boolean): void {
|
|
353
|
-
const eventStart: Date = new Date((<Date>this.actionObj.event[this.parent.eventFields.startTime]).getTime());
|
|
354
|
-
const eventEnd: Date = new Date((<Date>this.actionObj.event[this.parent.eventFields.endTime]).getTime());
|
|
355
|
-
let resizeTime: Date;
|
|
356
|
-
let headerName: string = this.parent.currentView;
|
|
357
|
-
const isTimelineMonth: boolean = this.parent.currentView === 'TimelineMonth';
|
|
358
|
-
if (this.parent.activeView.isTimelineView()) {
|
|
359
|
-
const tr: HTMLTableRowElement = this.parent.getContentTable().querySelector('tr') as HTMLTableRowElement;
|
|
360
|
-
if (this.parent.activeViewOptions.headerRows.length > 0) {
|
|
361
|
-
const rows: string[] = this.parent.activeViewOptions.headerRows.map((row: Record<string, any>) => row.option as string);
|
|
362
|
-
headerName = rows.slice(-1)[0];
|
|
363
|
-
if (isTimelineMonth && headerName === 'Hour') {
|
|
364
|
-
headerName = rows.slice(-2)[0] || 'Month';
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
resizeTime = isLeft ? eventStart : eventEnd;
|
|
368
|
-
let cellIndex: number = 0;
|
|
369
|
-
const tdCollections: HTMLElement[] = [].slice.call(tr.children);
|
|
370
|
-
let isLastCell: boolean = false;
|
|
371
|
-
const pixelsPerMinute: number = this.actionObj.cellWidth / (this.parent.activeViewOptions.timeScale.interval /
|
|
372
|
-
this.parent.activeViewOptions.timeScale.slotCount);
|
|
373
|
-
let offset: number = parseFloat(this.parent.enableRtl ? this.actionObj.clone.style.right :
|
|
374
|
-
this.actionObj.clone.style.left);
|
|
375
|
-
offset = Math.round(offset / pixelsPerMinute) * pixelsPerMinute;
|
|
376
|
-
if (['Year', 'Month', 'Week', 'Date'].indexOf(headerName) !== -1) {
|
|
377
|
-
let noOfDays: number = 0;
|
|
378
|
-
for (const td of tdCollections) {
|
|
379
|
-
noOfDays += parseInt(td.getAttribute('colspan'), 10);
|
|
380
|
-
}
|
|
381
|
-
let offsetValue: number = this.parent.enableRtl ? parseInt(this.actionObj.clone.style.right, 10) :
|
|
382
|
-
parseInt(this.actionObj.clone.style.left, 10);
|
|
383
|
-
offsetValue = Math.round(offsetValue / this.actionObj.cellWidth) * this.actionObj.cellWidth;
|
|
384
|
-
if (!isLeft) {
|
|
385
|
-
offsetValue += (this.parent.getElementWidth(this.actionObj.clone) - this.actionObj.cellWidth);
|
|
386
|
-
}
|
|
387
|
-
cellIndex = !isTimelineMonth ? Math.round(offsetValue / (this.parent.getElementWidth(tr) / noOfDays)) :
|
|
388
|
-
Math.floor(offsetValue / Math.floor(this.parent.getElementWidth(tr) / noOfDays));
|
|
389
|
-
cellIndex = isLeft ? cellIndex : isTimelineMonth ? cellIndex + 1 : cellIndex;
|
|
390
|
-
isLastCell = cellIndex === tdCollections.length;
|
|
391
|
-
cellIndex = (cellIndex < 0) ? 0 : (cellIndex >= noOfDays) ? noOfDays - 1 : cellIndex;
|
|
392
|
-
} else {
|
|
393
|
-
const cellWidth: number = this.actionObj.cellWidth;
|
|
394
|
-
cellIndex = isLeft ? Math.round(offset / this.actionObj.cellWidth) :
|
|
395
|
-
Math.ceil((offset + (this.parent.getElementWidth(this.actionObj.clone) - cellWidth)) / this.actionObj.cellWidth);
|
|
396
|
-
if (this.parent.enableRtl) {
|
|
397
|
-
const offsetWidth: number = (Math.round(offset / this.actionObj.cellWidth) *
|
|
398
|
-
this.actionObj.cellWidth) + (isLeft ? 0 : (this.parent.getElementWidth(this.actionObj.clone) -
|
|
399
|
-
this.actionObj.cellWidth));
|
|
400
|
-
cellIndex = Math.floor(offsetWidth / this.actionObj.cellWidth);
|
|
401
|
-
}
|
|
402
|
-
isLastCell = cellIndex === tdCollections.length;
|
|
403
|
-
cellIndex = this.getIndex(cellIndex);
|
|
404
|
-
}
|
|
405
|
-
let resizeDate: Date;
|
|
406
|
-
if (['Year', 'Month', 'Week', 'Date'].indexOf(headerName) !== -1) {
|
|
407
|
-
resizeDate = new Date(this.parent.activeView.renderDates[parseInt(cellIndex.toString(), 10)].getTime());
|
|
408
|
-
} else {
|
|
409
|
-
resizeDate = this.parent.getDateFromElement(<HTMLElement>tr.children[parseInt(cellIndex.toString(), 10)]);
|
|
410
|
-
}
|
|
411
|
-
if (['TimelineMonth', 'Year', 'Month', 'Week', 'Date'].indexOf(headerName) !== -1 ||
|
|
412
|
-
!this.parent.activeViewOptions.timeScale.enable) {
|
|
413
|
-
resizeTime = new Date(resizeDate.setHours(resizeTime.getHours(), resizeTime.getMinutes(), resizeTime.getSeconds()));
|
|
414
|
-
} else {
|
|
415
|
-
if (!isLeft) {
|
|
416
|
-
offset += this.parent.getElementWidth(this.actionObj.clone);
|
|
417
|
-
}
|
|
418
|
-
let spanMinutes: number = Math.floor((this.actionObj.slotInterval / this.actionObj.cellWidth) *
|
|
419
|
-
(offset - Math.floor(offset / this.actionObj.cellWidth) * this.actionObj.cellWidth));
|
|
420
|
-
spanMinutes = (isLastCell || (!isLeft && spanMinutes === 0)) ? this.actionObj.slotInterval : spanMinutes;
|
|
421
|
-
resizeTime = new Date(resizeDate.getTime());
|
|
422
|
-
resizeTime = new Date(resizeDate.getTime() + (spanMinutes * util.MS_PER_MINUTE));
|
|
423
|
-
this.updateTimePosition(resizeTime);
|
|
424
|
-
}
|
|
425
|
-
} else {
|
|
426
|
-
const cloneIndex: number = (closest(this.actionObj.clone, 'td') as HTMLTableCellElement).cellIndex;
|
|
427
|
-
const originalWidth: number = Math.ceil((isLeft ? this.parent.getElementWidth(this.actionObj.element) : 0) /
|
|
428
|
-
this.actionObj.cellWidth) * this.actionObj.cellWidth;
|
|
429
|
-
const noOfDays: number = Math.ceil((this.parent.getElementWidth(this.actionObj.clone) - originalWidth) /
|
|
430
|
-
this.actionObj.cellWidth);
|
|
431
|
-
const tr: HTMLTableRowElement = closest(this.actionObj.clone, 'tr') as HTMLTableRowElement;
|
|
432
|
-
let dayIndex: number = isLeft ? cloneIndex - noOfDays : cloneIndex + noOfDays - 1;
|
|
433
|
-
dayIndex = this.getIndex(dayIndex);
|
|
434
|
-
resizeTime = this.parent.getDateFromElement(<HTMLElement>tr.children[parseInt(dayIndex.toString(), 10)]);
|
|
435
|
-
if (isLeft) {
|
|
436
|
-
resizeTime.setHours(eventStart.getHours(), eventStart.getMinutes(), eventStart.getSeconds());
|
|
437
|
-
} else {
|
|
438
|
-
resizeTime.setHours(eventEnd.getHours(), eventEnd.getMinutes(), eventEnd.getSeconds());
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
const isNotHourSlot: boolean = ['TimelineMonth', 'Year', 'Month', 'Week', 'WorkWeek', 'Date', 'Day'].indexOf(headerName) !== -1 ||
|
|
442
|
-
!this.parent.activeViewOptions.timeScale.enable;
|
|
443
|
-
if (isLeft) {
|
|
444
|
-
if ((eventEnd.getTime() - resizeTime.getTime()) <= 0) {
|
|
445
|
-
resizeTime = isNotHourSlot ? util.resetTime(eventEnd) : eventStart;
|
|
446
|
-
}
|
|
447
|
-
this.actionObj.start = !isNotHourSlot ? this.calculateIntervalTime(resizeTime) : resizeTime;
|
|
448
|
-
} else {
|
|
449
|
-
let resizeEnd: Date = (isNotHourSlot && resizeTime.getHours() === 0 && resizeTime.getMinutes() === 0) ?
|
|
450
|
-
util.addDays(resizeTime, 1) : resizeTime;
|
|
451
|
-
if (isNotHourSlot && (resizeEnd.getTime() - eventStart.getTime()) <= 0) {
|
|
452
|
-
resizeEnd = util.addDays(util.resetTime(eventStart), 1);
|
|
453
|
-
}
|
|
454
|
-
this.actionObj.end = !isNotHourSlot ? this.calculateIntervalTime(resizeEnd) : resizeEnd;
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
private getTopBottomStyles(e: MouseEvent & TouchEvent, isTop: boolean): Record<string, any> {
|
|
459
|
-
const viewElement: HTMLElement = this.parent.element.querySelector('.' + cls.CONTENT_WRAP_CLASS) as HTMLElement;
|
|
460
|
-
const slotInterval: number = (this.actionObj.cellHeight / this.actionObj.slotInterval) * this.actionObj.interval;
|
|
461
|
-
let clnHeight: number = isTop ? this.actionObj.element.offsetHeight + (this.actionObj.Y - this.actionObj.pageY) :
|
|
462
|
-
this.actionObj.element.offsetHeight + (this.actionObj.pageY - this.actionObj.Y);
|
|
463
|
-
let clnTop: number = isTop ? this.actionObj.element.offsetTop -
|
|
464
|
-
(this.actionObj.Y - this.actionObj.pageY) : this.actionObj.clone.offsetTop;
|
|
465
|
-
clnHeight = (clnTop < 0) ? this.actionObj.clone.offsetHeight :
|
|
466
|
-
(this.actionObj.clone.offsetTop + this.actionObj.clone.offsetHeight) > this.scrollArgs.height ?
|
|
467
|
-
this.actionObj.clone.offsetHeight : clnHeight;
|
|
468
|
-
clnTop = (clnTop < 0) ? 0 : clnTop;
|
|
469
|
-
clnTop = isTop ? Math.floor(clnTop / slotInterval) * slotInterval : clnTop;
|
|
470
|
-
clnHeight = clnTop + clnHeight >= viewElement.scrollHeight ? viewElement.scrollHeight - clnTop :
|
|
471
|
-
Math.ceil(clnHeight / slotInterval) * slotInterval;
|
|
472
|
-
if (!isTop && this.actionObj.clone.offsetTop + clnHeight >= this.parent.getContentTable().offsetHeight) {
|
|
473
|
-
clnHeight = this.parent.getContentTable().offsetHeight - this.actionObj.clone.offsetTop;
|
|
474
|
-
}
|
|
475
|
-
const styles: Record<string, any> = {
|
|
476
|
-
height: formatUnit(clnHeight < this.actionObj.cellHeight ? Math.floor(clnHeight / slotInterval) * slotInterval : clnHeight),
|
|
477
|
-
top: formatUnit((clnHeight < this.actionObj.cellHeight && isTop) ? Math.ceil(clnTop / slotInterval) * slotInterval : clnTop),
|
|
478
|
-
left: '0px', right: '0px', width: '100%'
|
|
479
|
-
};
|
|
480
|
-
return styles;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
private getLeftRightStyles(e: MouseEvent & TouchEvent, isLeft: boolean): Record<string, any> {
|
|
484
|
-
const styles: Record<string, any> = {};
|
|
485
|
-
const isTimelineView: boolean = this.parent.activeView.isTimelineView();
|
|
486
|
-
const isTimeViews: boolean = ['TimelineDay', 'TimelineWeek', 'TimelineWorkWeek'].indexOf(this.parent.currentView) > -1 &&
|
|
487
|
-
this.parent.activeViewOptions.timeScale.enable;
|
|
488
|
-
const slotInterval: number = (this.actionObj.cellWidth / this.actionObj.slotInterval) * this.actionObj.interval;
|
|
489
|
-
const pageWidth: number = isLeft ? (this.actionObj.X - this.actionObj.pageX) : (this.actionObj.pageX - this.actionObj.X);
|
|
490
|
-
const targetWidth: number = isTimelineView ?
|
|
491
|
-
Math.round(this.parent.getElementWidth(this.actionObj.element) / this.actionObj.cellWidth) * this.actionObj.cellWidth :
|
|
492
|
-
this.parent.currentView === 'Month' ? this.parent.getElementWidth(this.actionObj.element) :
|
|
493
|
-
Math.ceil(this.parent.getElementWidth(this.actionObj.element) / this.actionObj.cellWidth) * this.actionObj.cellWidth;
|
|
494
|
-
let offsetWidth: number = targetWidth + (Math.ceil(pageWidth / this.actionObj.cellWidth) * this.actionObj.cellWidth);
|
|
495
|
-
let left: number = (this.parent.enableRtl) ? parseInt(this.actionObj.element.style.right, 10) : this.actionObj.clone.offsetLeft;
|
|
496
|
-
left = Math.round(left / slotInterval) * slotInterval;
|
|
497
|
-
if (isTimeViews) {
|
|
498
|
-
offsetWidth = targetWidth + (Math.ceil(pageWidth / slotInterval) * slotInterval);
|
|
499
|
-
if (!isLeft) {
|
|
500
|
-
const roundedLeft: string = (+parseFloat(this.actionObj.element.style[this.parent.enableRtl ? 'right' : 'left'])).toFixed(1);
|
|
501
|
-
const roundedWidth: number = Math.round(targetWidth / slotInterval) * slotInterval;
|
|
502
|
-
if (roundedLeft !== left.toFixed(1) || roundedWidth !== targetWidth) {
|
|
503
|
-
offsetWidth = (Math.round((left + offsetWidth) / slotInterval) * slotInterval) - left;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
this.actionObj.event[this.parent.eventFields.isAllDay] = false;
|
|
507
|
-
}
|
|
508
|
-
let width: number = !isLeft && (Math.floor(offsetWidth + this.actionObj.clone.offsetLeft) > this.scrollArgs.width) ?
|
|
509
|
-
this.parent.getElementWidth(this.actionObj.clone) : (offsetWidth < this.actionObj.cellWidth) ? offsetWidth : offsetWidth;
|
|
510
|
-
if (this.parent.enableRtl) {
|
|
511
|
-
let rightValue: number = isTimelineView ? parseInt(this.actionObj.element.style.right, 10) :
|
|
512
|
-
-(offsetWidth - this.actionObj.cellWidth);
|
|
513
|
-
rightValue = isTimelineView ? rightValue : isLeft ? 0 : rightValue > 0 ? 0 : rightValue;
|
|
514
|
-
if (isTimelineView && !isLeft) {
|
|
515
|
-
rightValue = Math.round(rightValue / slotInterval) * slotInterval;
|
|
516
|
-
rightValue = rightValue - (Math.ceil((this.actionObj.pageX - this.actionObj.X) / slotInterval) * slotInterval);
|
|
517
|
-
if (rightValue < 0) {
|
|
518
|
-
rightValue = parseInt(this.actionObj.clone.style.right, 10);
|
|
519
|
-
width = parseInt(this.actionObj.clone.style.width, 10);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
rightValue = rightValue >= this.scrollArgs.width ? this.scrollArgs.width - this.actionObj.cellWidth : rightValue;
|
|
523
|
-
styles.right = formatUnit(rightValue);
|
|
524
|
-
width = width + rightValue > this.scrollArgs.width ? this.parent.getElementWidth(this.actionObj.clone) : width;
|
|
525
|
-
} else {
|
|
526
|
-
let offsetLeft: number = isLeft ? this.actionObj.element.offsetLeft - (this.actionObj.X - this.actionObj.pageX) :
|
|
527
|
-
this.parent.enableRtl ? this.actionObj.element.offsetLeft : 0;
|
|
528
|
-
if (isTimelineView) {
|
|
529
|
-
offsetLeft = isLeft ? offsetLeft : parseInt(this.actionObj.clone.style.left, 10);
|
|
530
|
-
if (this.parent.enableRtl) {
|
|
531
|
-
offsetLeft = !isLeft ? (this.actionObj.pageX < this.actionObj.X - this.parent.getElementWidth(this.actionObj.clone))
|
|
532
|
-
? parseInt(this.actionObj.clone.style.right, 10) : offsetLeft : offsetLeft;
|
|
533
|
-
} else {
|
|
534
|
-
offsetLeft = isLeft ? (this.actionObj.pageX > this.actionObj.X + this.parent.getElementWidth(this.actionObj.clone) &&
|
|
535
|
-
this.parent.getElementWidth(this.actionObj.clone) === this.actionObj.cellWidth) ?
|
|
536
|
-
parseInt(this.actionObj.clone.style.left, 10) : offsetLeft : offsetLeft;
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
const leftValue: number = offsetLeft;
|
|
540
|
-
offsetLeft = isTimelineView ? isTimeViews ? isLeft ? this.actionObj.element.offsetLeft -
|
|
541
|
-
(Math.ceil((this.actionObj.element.offsetLeft - offsetLeft) / slotInterval) * slotInterval) : offsetLeft :
|
|
542
|
-
Math.floor(offsetLeft / this.actionObj.cellWidth) * this.actionObj.cellWidth :
|
|
543
|
-
Math.ceil(Math.abs(offsetLeft) / this.actionObj.cellWidth) * this.actionObj.cellWidth;
|
|
544
|
-
if (offsetLeft < 0) {
|
|
545
|
-
if (isTimelineView && isLeft && (offsetLeft % slotInterval)) {
|
|
546
|
-
offsetLeft = parseInt(this.actionObj.clone.style.left, 10);
|
|
547
|
-
width = parseInt(this.actionObj.clone.style.width, 10);
|
|
548
|
-
} else {
|
|
549
|
-
offsetLeft = 0;
|
|
550
|
-
width = this.parent.getElementWidth(this.actionObj.clone);
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
const cloneWidth: number = Math.ceil(this.parent.getElementWidth(this.actionObj.clone) / this.actionObj.cellWidth) *
|
|
554
|
-
this.actionObj.cellWidth;
|
|
555
|
-
if (isLeft) {
|
|
556
|
-
styles.left = formatUnit(isTimelineView ? offsetLeft : isLeft ? leftValue < 0 ? -offsetLeft :
|
|
557
|
-
(Math.ceil((targetWidth - cloneWidth) / this.actionObj.cellWidth) * this.actionObj.cellWidth) : offsetLeft);
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
width = Math.floor(width);
|
|
561
|
-
styles.width = formatUnit(width);
|
|
562
|
-
return styles;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
private resizeValidation(e: MouseEvent & TouchEvent): boolean {
|
|
566
|
-
const pages: (MouseEvent & TouchEvent) | Touch = this.parent.eventBase.getPageCoordinates(e);
|
|
567
|
-
const viewDimension: Record<string, any> = this.getContentAreaDimension();
|
|
568
|
-
const isTimeScale: boolean = this.parent.activeView.isTimelineView() && this.parent.activeViewOptions.timeScale.enable;
|
|
569
|
-
let cellWidth: number = this.actionObj.cellWidth;
|
|
570
|
-
let resizeValidation: boolean = false;
|
|
571
|
-
if (this.resizeEdges.left) {
|
|
572
|
-
if (pages.pageX < viewDimension.leftOffset && pages.pageX >= viewDimension.left && isTimeScale) {
|
|
573
|
-
cellWidth = 0;
|
|
574
|
-
}
|
|
575
|
-
resizeValidation = (pages.pageX - cellWidth) >= viewDimension.left;
|
|
576
|
-
|
|
577
|
-
}
|
|
578
|
-
if (this.resizeEdges.right) {
|
|
579
|
-
if (pages.pageX > viewDimension.rightOffset && pages.pageX <= viewDimension.right && isTimeScale) {
|
|
580
|
-
cellWidth = 0;
|
|
581
|
-
}
|
|
582
|
-
resizeValidation = (pages.pageX + cellWidth) <= viewDimension.right;
|
|
583
|
-
}
|
|
584
|
-
if (this.resizeEdges.top) {
|
|
585
|
-
resizeValidation = this.actionObj.clone.offsetTop >= viewDimension.top;
|
|
586
|
-
}
|
|
587
|
-
if (this.resizeEdges.bottom) {
|
|
588
|
-
resizeValidation = (this.actionObj.clone.offsetTop + this.actionObj.clone.offsetHeight) <= this.scrollArgs.height;
|
|
589
|
-
}
|
|
590
|
-
return resizeValidation;
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
/**
|
|
594
|
-
* Get module name
|
|
595
|
-
*
|
|
596
|
-
* @returns {string} Returns the module name..
|
|
597
|
-
*/
|
|
598
|
-
protected getModuleName(): string {
|
|
599
|
-
return 'resize';
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
}
|