@syncfusion/ej2-schedule 30.2.7 → 31.1.17

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.
Files changed (304) hide show
  1. package/dist/ej2-schedule.min.js +2 -2
  2. package/dist/ej2-schedule.umd.min.js +2 -2
  3. package/dist/ej2-schedule.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-schedule.es2015.js +110 -36
  5. package/dist/es6/ej2-schedule.es2015.js.map +1 -1
  6. package/dist/es6/ej2-schedule.es5.js +110 -36
  7. package/dist/es6/ej2-schedule.es5.js.map +1 -1
  8. package/dist/global/ej2-schedule.min.js +2 -2
  9. package/dist/global/ej2-schedule.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/dist/ts/common/calendar-util.d.ts +92 -0
  12. package/dist/ts/common/calendar-util.ts +261 -0
  13. package/dist/ts/common/index.d.ts +4 -0
  14. package/dist/ts/common/index.ts +4 -0
  15. package/dist/ts/components.d.ts +5 -0
  16. package/dist/ts/components.ts +5 -0
  17. package/dist/ts/index.d.ts +6 -0
  18. package/dist/ts/index.ts +7 -0
  19. package/dist/ts/recurrence-editor/date-generator.d.ts +76 -0
  20. package/dist/ts/recurrence-editor/date-generator.ts +1699 -0
  21. package/dist/ts/recurrence-editor/index.d.ts +6 -0
  22. package/dist/ts/recurrence-editor/index.ts +6 -0
  23. package/dist/ts/recurrence-editor/recurrence-editor-model.d.ts +112 -0
  24. package/dist/ts/recurrence-editor/recurrence-editor.d.ts +245 -0
  25. package/dist/ts/recurrence-editor/recurrence-editor.ts +1257 -0
  26. package/dist/ts/schedule/actions/action-base.d.ts +44 -0
  27. package/dist/ts/schedule/actions/action-base.ts +493 -0
  28. package/dist/ts/schedule/actions/crud.d.ts +41 -0
  29. package/dist/ts/schedule/actions/crud.ts +784 -0
  30. package/dist/ts/schedule/actions/data.d.ts +63 -0
  31. package/dist/ts/schedule/actions/data.ts +128 -0
  32. package/dist/ts/schedule/actions/drag.d.ts +75 -0
  33. package/dist/ts/schedule/actions/drag.ts +1401 -0
  34. package/dist/ts/schedule/actions/keyboard.d.ts +100 -0
  35. package/dist/ts/schedule/actions/keyboard.ts +1435 -0
  36. package/dist/ts/schedule/actions/resize.d.ts +27 -0
  37. package/dist/ts/schedule/actions/resize.ts +602 -0
  38. package/dist/ts/schedule/actions/scroll.d.ts +69 -0
  39. package/dist/ts/schedule/actions/scroll.ts +105 -0
  40. package/dist/ts/schedule/actions/touch.d.ts +32 -0
  41. package/dist/ts/schedule/actions/touch.ts +314 -0
  42. package/dist/ts/schedule/actions/virtual-scroll.d.ts +55 -0
  43. package/dist/ts/schedule/actions/virtual-scroll.ts +596 -0
  44. package/dist/ts/schedule/actions/work-cells.d.ts +14 -0
  45. package/dist/ts/schedule/actions/work-cells.ts +151 -0
  46. package/dist/ts/schedule/base/constant.d.ts +102 -0
  47. package/dist/ts/schedule/base/constant.ts +103 -0
  48. package/dist/ts/schedule/base/css-constant.d.ts +475 -0
  49. package/dist/ts/schedule/base/css-constant.ts +475 -0
  50. package/dist/ts/schedule/base/interface.d.ts +673 -0
  51. package/dist/ts/schedule/base/interface.ts +738 -0
  52. package/dist/ts/schedule/base/resource.d.ts +59 -0
  53. package/dist/ts/schedule/base/resource.ts +1091 -0
  54. package/dist/ts/schedule/base/schedule-model.d.ts +930 -0
  55. package/dist/ts/schedule/base/schedule.d.ts +1967 -0
  56. package/dist/ts/schedule/base/schedule.ts +4221 -0
  57. package/dist/ts/schedule/base/type.d.ts +134 -0
  58. package/dist/ts/schedule/base/type.ts +142 -0
  59. package/dist/ts/schedule/base/util.d.ts +266 -0
  60. package/dist/ts/schedule/base/util.ts +492 -0
  61. package/dist/ts/schedule/event-renderer/agenda-base.d.ts +15 -0
  62. package/dist/ts/schedule/event-renderer/agenda-base.ts +423 -0
  63. package/dist/ts/schedule/event-renderer/event-base.d.ts +101 -0
  64. package/dist/ts/schedule/event-renderer/event-base.ts +1501 -0
  65. package/dist/ts/schedule/event-renderer/inline-edit.d.ts +23 -0
  66. package/dist/ts/schedule/event-renderer/inline-edit.ts +287 -0
  67. package/dist/ts/schedule/event-renderer/month.d.ts +60 -0
  68. package/dist/ts/schedule/event-renderer/month.ts +760 -0
  69. package/dist/ts/schedule/event-renderer/timeline-view.d.ts +51 -0
  70. package/dist/ts/schedule/event-renderer/timeline-view.ts +606 -0
  71. package/dist/ts/schedule/event-renderer/vertical-view.d.ts +57 -0
  72. package/dist/ts/schedule/event-renderer/vertical-view.ts +898 -0
  73. package/dist/ts/schedule/event-renderer/year.d.ts +27 -0
  74. package/dist/ts/schedule/event-renderer/year.ts +623 -0
  75. package/dist/ts/schedule/exports/calendar-export.d.ts +16 -0
  76. package/dist/ts/schedule/exports/calendar-export.ts +160 -0
  77. package/dist/ts/schedule/exports/calendar-import.d.ts +18 -0
  78. package/dist/ts/schedule/exports/calendar-import.ts +277 -0
  79. package/dist/ts/schedule/exports/excel-export.d.ts +14 -0
  80. package/dist/ts/schedule/exports/excel-export.ts +89 -0
  81. package/dist/ts/schedule/exports/index.d.ts +7 -0
  82. package/dist/ts/schedule/exports/index.ts +7 -0
  83. package/dist/ts/schedule/exports/print.d.ts +20 -0
  84. package/dist/ts/schedule/exports/print.ts +233 -0
  85. package/dist/ts/schedule/index.d.ts +26 -0
  86. package/dist/ts/schedule/index.ts +26 -0
  87. package/dist/ts/schedule/models/event-settings-model.d.ts +165 -0
  88. package/dist/ts/schedule/models/event-settings.d.ts +149 -0
  89. package/dist/ts/schedule/models/event-settings.ts +187 -0
  90. package/dist/ts/schedule/models/field-options-model.d.ts +37 -0
  91. package/dist/ts/schedule/models/field-options.d.ts +31 -0
  92. package/dist/ts/schedule/models/field-options.ts +41 -0
  93. package/dist/ts/schedule/models/fields-model.d.ts +129 -0
  94. package/dist/ts/schedule/models/fields.d.ts +117 -0
  95. package/dist/ts/schedule/models/fields.ts +149 -0
  96. package/dist/ts/schedule/models/group-model.d.ts +69 -0
  97. package/dist/ts/schedule/models/group.d.ts +60 -0
  98. package/dist/ts/schedule/models/group.ts +75 -0
  99. package/dist/ts/schedule/models/header-rows-model.d.ts +33 -0
  100. package/dist/ts/schedule/models/header-rows.d.ts +30 -0
  101. package/dist/ts/schedule/models/header-rows.ts +35 -0
  102. package/dist/ts/schedule/models/models.d.ts +14 -0
  103. package/dist/ts/schedule/models/models.ts +15 -0
  104. package/dist/ts/schedule/models/quick-info-templates-model.d.ts +52 -0
  105. package/dist/ts/schedule/models/quick-info-templates.d.ts +47 -0
  106. package/dist/ts/schedule/models/quick-info-templates.ts +56 -0
  107. package/dist/ts/schedule/models/resources-model.d.ts +122 -0
  108. package/dist/ts/schedule/models/resources.d.ts +106 -0
  109. package/dist/ts/schedule/models/resources.ts +138 -0
  110. package/dist/ts/schedule/models/time-scale-model.d.ts +57 -0
  111. package/dist/ts/schedule/models/time-scale.d.ts +50 -0
  112. package/dist/ts/schedule/models/time-scale.ts +61 -0
  113. package/dist/ts/schedule/models/toolbar-model.d.ts +196 -0
  114. package/dist/ts/schedule/models/toolbar.d.ts +176 -0
  115. package/dist/ts/schedule/models/toolbar.ts +196 -0
  116. package/dist/ts/schedule/models/views-model.d.ts +370 -0
  117. package/dist/ts/schedule/models/views.d.ts +335 -0
  118. package/dist/ts/schedule/models/views.ts +408 -0
  119. package/dist/ts/schedule/models/work-hours-model.d.ts +29 -0
  120. package/dist/ts/schedule/models/work-hours.d.ts +24 -0
  121. package/dist/ts/schedule/models/work-hours.ts +31 -0
  122. package/dist/ts/schedule/popups/event-tooltip.d.ts +16 -0
  123. package/dist/ts/schedule/popups/event-tooltip.ts +203 -0
  124. package/dist/ts/schedule/popups/event-window.d.ts +118 -0
  125. package/dist/ts/schedule/popups/event-window.ts +2055 -0
  126. package/dist/ts/schedule/popups/form-validator.d.ts +16 -0
  127. package/dist/ts/schedule/popups/form-validator.ts +110 -0
  128. package/dist/ts/schedule/popups/quick-popups.d.ts +78 -0
  129. package/dist/ts/schedule/popups/quick-popups.ts +1470 -0
  130. package/dist/ts/schedule/renderer/agenda.d.ts +45 -0
  131. package/dist/ts/schedule/renderer/agenda.ts +497 -0
  132. package/dist/ts/schedule/renderer/day.d.ts +20 -0
  133. package/dist/ts/schedule/renderer/day.ts +28 -0
  134. package/dist/ts/schedule/renderer/header-renderer.d.ts +48 -0
  135. package/dist/ts/schedule/renderer/header-renderer.ts +736 -0
  136. package/dist/ts/schedule/renderer/month-agenda.d.ts +29 -0
  137. package/dist/ts/schedule/renderer/month-agenda.ts +184 -0
  138. package/dist/ts/schedule/renderer/month.d.ts +61 -0
  139. package/dist/ts/schedule/renderer/month.ts +766 -0
  140. package/dist/ts/schedule/renderer/renderer.d.ts +13 -0
  141. package/dist/ts/schedule/renderer/renderer.ts +165 -0
  142. package/dist/ts/schedule/renderer/timeline-header-row.d.ts +15 -0
  143. package/dist/ts/schedule/renderer/timeline-header-row.ts +132 -0
  144. package/dist/ts/schedule/renderer/timeline-month.d.ts +29 -0
  145. package/dist/ts/schedule/renderer/timeline-month.ts +184 -0
  146. package/dist/ts/schedule/renderer/timeline-view.d.ts +31 -0
  147. package/dist/ts/schedule/renderer/timeline-view.ts +308 -0
  148. package/dist/ts/schedule/renderer/timeline-year.d.ts +22 -0
  149. package/dist/ts/schedule/renderer/timeline-year.ts +450 -0
  150. package/dist/ts/schedule/renderer/vertical-view.d.ts +63 -0
  151. package/dist/ts/schedule/renderer/vertical-view.ts +911 -0
  152. package/dist/ts/schedule/renderer/view-base.d.ts +83 -0
  153. package/dist/ts/schedule/renderer/view-base.ts +709 -0
  154. package/dist/ts/schedule/renderer/week.d.ts +22 -0
  155. package/dist/ts/schedule/renderer/week.ts +35 -0
  156. package/dist/ts/schedule/renderer/work-week.d.ts +22 -0
  157. package/dist/ts/schedule/renderer/work-week.ts +36 -0
  158. package/dist/ts/schedule/renderer/year.d.ts +46 -0
  159. package/dist/ts/schedule/renderer/year.ts +470 -0
  160. package/dist/ts/schedule/timezone/timezone.d.ts +16 -0
  161. package/dist/ts/schedule/timezone/timezone.ts +313 -0
  162. package/package.json +56 -21
  163. package/src/schedule/actions/action-base.js +3 -0
  164. package/src/schedule/actions/drag.js +11 -4
  165. package/src/schedule/actions/keyboard.js +1 -1
  166. package/src/schedule/actions/resize.js +8 -5
  167. package/src/schedule/base/css-constant.d.ts +2 -0
  168. package/src/schedule/base/css-constant.js +2 -0
  169. package/src/schedule/base/schedule.js +15 -1
  170. package/src/schedule/event-renderer/agenda-base.d.ts +1 -1
  171. package/src/schedule/event-renderer/agenda-base.js +5 -4
  172. package/src/schedule/event-renderer/inline-edit.js +11 -6
  173. package/src/schedule/event-renderer/month.js +5 -3
  174. package/src/schedule/event-renderer/vertical-view.js +3 -0
  175. package/src/schedule/event-renderer/year.d.ts +2 -0
  176. package/src/schedule/event-renderer/year.js +28 -4
  177. package/src/schedule/popups/event-tooltip.js +4 -0
  178. package/src/schedule/popups/event-window.js +2 -2
  179. package/src/schedule/popups/quick-popups.js +5 -1
  180. package/src/schedule/renderer/agenda.js +3 -2
  181. package/src/schedule/renderer/vertical-view.js +1 -1
  182. package/src/schedule/renderer/year.js +3 -2
  183. package/styles/bds-lite.css +11 -8
  184. package/styles/bds.css +11 -8
  185. package/styles/bootstrap-dark-lite.css +12 -9
  186. package/styles/bootstrap-dark.css +12 -9
  187. package/styles/bootstrap-lite.css +12 -9
  188. package/styles/bootstrap.css +12 -9
  189. package/styles/bootstrap4-lite.css +11 -8
  190. package/styles/bootstrap4.css +11 -8
  191. package/styles/bootstrap5-dark-lite.css +11 -8
  192. package/styles/bootstrap5-dark.css +11 -8
  193. package/styles/bootstrap5-lite.css +11 -8
  194. package/styles/bootstrap5.3-lite.css +11 -8
  195. package/styles/bootstrap5.3.css +11 -8
  196. package/styles/bootstrap5.css +11 -8
  197. package/styles/fabric-dark-lite.css +12 -9
  198. package/styles/fabric-dark.css +12 -9
  199. package/styles/fabric-lite.css +12 -9
  200. package/styles/fabric.css +12 -9
  201. package/styles/fluent-dark-lite.css +13 -10
  202. package/styles/fluent-dark.css +13 -10
  203. package/styles/fluent-lite.css +13 -10
  204. package/styles/fluent.css +13 -10
  205. package/styles/fluent2-lite.css +11 -8
  206. package/styles/fluent2.css +11 -8
  207. package/styles/highcontrast-light-lite.css +12 -9
  208. package/styles/highcontrast-light.css +12 -9
  209. package/styles/highcontrast-lite.css +12 -9
  210. package/styles/highcontrast.css +12 -9
  211. package/styles/material-dark-lite.css +12 -9
  212. package/styles/material-dark.css +12 -9
  213. package/styles/material-lite.css +12 -9
  214. package/styles/material.css +12 -9
  215. package/styles/material3-dark-lite.css +11 -8
  216. package/styles/material3-dark.css +11 -8
  217. package/styles/material3-lite.css +11 -8
  218. package/styles/material3.css +11 -8
  219. package/styles/recurrence-editor/_bds-definition.scss +1 -0
  220. package/styles/recurrence-editor/_bootstrap-dark-definition.scss +1 -0
  221. package/styles/recurrence-editor/_bootstrap-definition.scss +1 -0
  222. package/styles/recurrence-editor/_bootstrap4-definition.scss +1 -0
  223. package/styles/recurrence-editor/_bootstrap5-definition.scss +1 -0
  224. package/styles/recurrence-editor/_bootstrap5.3-definition.scss +1 -0
  225. package/styles/recurrence-editor/_fabric-dark-definition.scss +1 -0
  226. package/styles/recurrence-editor/_fabric-definition.scss +1 -0
  227. package/styles/recurrence-editor/_fluent-definition.scss +1 -0
  228. package/styles/recurrence-editor/_fluent2-definition.scss +1 -0
  229. package/styles/recurrence-editor/_fusionnew-definition.scss +1 -0
  230. package/styles/recurrence-editor/_highcontrast-definition.scss +1 -0
  231. package/styles/recurrence-editor/_highcontrast-light-definition.scss +1 -0
  232. package/styles/recurrence-editor/_layout.scss +5 -1
  233. package/styles/recurrence-editor/_material-dark-definition.scss +1 -0
  234. package/styles/recurrence-editor/_material-definition.scss +1 -0
  235. package/styles/recurrence-editor/_material3-definition.scss +1 -0
  236. package/styles/recurrence-editor/_tailwind-definition.scss +1 -0
  237. package/styles/recurrence-editor/_tailwind3-definition.scss +1 -0
  238. package/styles/recurrence-editor/bds.css +3 -0
  239. package/styles/recurrence-editor/bootstrap-dark.css +4 -1
  240. package/styles/recurrence-editor/bootstrap.css +4 -1
  241. package/styles/recurrence-editor/bootstrap4.css +3 -0
  242. package/styles/recurrence-editor/bootstrap5-dark.css +3 -0
  243. package/styles/recurrence-editor/bootstrap5.3.css +3 -0
  244. package/styles/recurrence-editor/bootstrap5.css +3 -0
  245. package/styles/recurrence-editor/fabric-dark.css +4 -1
  246. package/styles/recurrence-editor/fabric.css +4 -1
  247. package/styles/recurrence-editor/fluent-dark.css +4 -1
  248. package/styles/recurrence-editor/fluent.css +4 -1
  249. package/styles/recurrence-editor/fluent2.css +3 -0
  250. package/styles/recurrence-editor/highcontrast-light.css +4 -1
  251. package/styles/recurrence-editor/highcontrast.css +4 -1
  252. package/styles/recurrence-editor/material-dark.css +4 -1
  253. package/styles/recurrence-editor/material.css +4 -1
  254. package/styles/recurrence-editor/material3-dark.css +3 -0
  255. package/styles/recurrence-editor/material3.css +3 -0
  256. package/styles/recurrence-editor/tailwind-dark.css +3 -0
  257. package/styles/recurrence-editor/tailwind.css +3 -0
  258. package/styles/recurrence-editor/tailwind3.css +3 -0
  259. package/styles/schedule/_bds-definition.scss +2 -0
  260. package/styles/schedule/_bootstrap-dark-definition.scss +2 -0
  261. package/styles/schedule/_bootstrap-definition.scss +2 -0
  262. package/styles/schedule/_bootstrap4-definition.scss +2 -0
  263. package/styles/schedule/_bootstrap5-definition.scss +2 -0
  264. package/styles/schedule/_bootstrap5.3-definition.scss +2 -0
  265. package/styles/schedule/_fabric-dark-definition.scss +2 -0
  266. package/styles/schedule/_fabric-definition.scss +2 -0
  267. package/styles/schedule/_fluent-definition.scss +3 -1
  268. package/styles/schedule/_fluent2-definition.scss +2 -0
  269. package/styles/schedule/_fusionnew-definition.scss +2 -0
  270. package/styles/schedule/_highcontrast-definition.scss +2 -0
  271. package/styles/schedule/_highcontrast-light-definition.scss +2 -0
  272. package/styles/schedule/_layout.scss +12 -11
  273. package/styles/schedule/_material-dark-definition.scss +2 -0
  274. package/styles/schedule/_material-definition.scss +2 -0
  275. package/styles/schedule/_material3-definition.scss +2 -0
  276. package/styles/schedule/_tailwind-definition.scss +2 -0
  277. package/styles/schedule/_tailwind3-definition.scss +2 -0
  278. package/styles/schedule/bds.css +8 -8
  279. package/styles/schedule/bootstrap-dark.css +8 -8
  280. package/styles/schedule/bootstrap.css +8 -8
  281. package/styles/schedule/bootstrap4.css +8 -8
  282. package/styles/schedule/bootstrap5-dark.css +8 -8
  283. package/styles/schedule/bootstrap5.3.css +8 -8
  284. package/styles/schedule/bootstrap5.css +8 -8
  285. package/styles/schedule/fabric-dark.css +8 -8
  286. package/styles/schedule/fabric.css +8 -8
  287. package/styles/schedule/fluent-dark.css +9 -9
  288. package/styles/schedule/fluent.css +9 -9
  289. package/styles/schedule/fluent2.css +8 -8
  290. package/styles/schedule/highcontrast-light.css +8 -8
  291. package/styles/schedule/highcontrast.css +8 -8
  292. package/styles/schedule/material-dark.css +8 -8
  293. package/styles/schedule/material.css +8 -8
  294. package/styles/schedule/material3-dark.css +8 -8
  295. package/styles/schedule/material3.css +8 -8
  296. package/styles/schedule/tailwind-dark.css +8 -8
  297. package/styles/schedule/tailwind.css +8 -8
  298. package/styles/schedule/tailwind3.css +8 -8
  299. package/styles/tailwind-dark-lite.css +11 -8
  300. package/styles/tailwind-dark.css +11 -8
  301. package/styles/tailwind-lite.css +11 -8
  302. package/styles/tailwind.css +11 -8
  303. package/styles/tailwind3-lite.css +11 -8
  304. package/styles/tailwind3.css +11 -8
@@ -0,0 +1,27 @@
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
+ }
@@ -0,0 +1,602 @@
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
+ }