@progress/kendo-angular-gantt 0.2.1-dev.202112101349 → 0.3.0-dev.202201190830
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/cdn/js/kendo-angular-gantt.js +2 -2
- package/dist/cdn/main.js +4 -4
- package/dist/es/common/touch-enabled.js +9 -0
- package/dist/es/dependencies/utils.js +40 -5
- package/dist/es/dragging/dependency-drag-create.directive.js +347 -0
- package/dist/es/dragging/drag-validation-tooltip.component.js +27 -0
- package/dist/es/editing/add-task.component.js +94 -0
- package/dist/es/editing/dependencies-table.component.js +131 -0
- package/dist/es/editing/edit-dialog.component.js +39 -8
- package/dist/es/editing/edit.service.js +92 -8
- package/dist/es/editing/task-fields.component.js +43 -0
- package/dist/es/editing/{util.js → utils.js} +0 -0
- package/dist/es/gantt.component.js +408 -56
- package/dist/es/gantt.module.js +37 -9
- package/dist/es/index.js +9 -0
- package/dist/es/localization/gantt-localization.service.js +26 -0
- package/dist/es/localization/messages.js +45 -1
- package/dist/es/main.js +1 -0
- package/dist/es/models/dependency-type.enum.js +16 -0
- package/dist/es/models/events/{add-event.interface.js → dependency-add-event.interface.js} +0 -0
- package/dist/es/models/events/{edit-event.interface.js → task-add-event.interface.js} +0 -0
- package/dist/es/models/events/{remove-event.interface.js → task-delete-event.interface.js} +0 -0
- package/dist/es/models/models.js +1 -0
- package/dist/es/models/{toolbar-position.js → toolbar-settings.js} +0 -0
- package/dist/{es2015/models/events/add-event.interface.js → es/models/view-item.interface.js} +0 -0
- package/dist/{es2015/models/events/edit-event.interface.js → es/navigation/navigation-models.js} +0 -0
- package/dist/es/navigation/navigation.service.js +390 -0
- package/dist/es/navigation/utils.js +77 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/rendering/gantt-milestone-task.component.js +12 -6
- package/dist/es/rendering/gantt-summary-task.component.js +27 -6
- package/dist/es/rendering/gantt-task-base.js +84 -22
- package/dist/es/rendering/gantt-task.component.js +13 -8
- package/dist/es/rendering/gantt-tasks-table-body.component.js +13 -5
- package/dist/es/scrolling/drag-scroll-settings.js +20 -0
- package/dist/es/scrolling/timeline-scroll.directive.js +89 -0
- package/dist/es/scrolling/timeline-scroll.service.js +39 -0
- package/dist/es/scrolling/utils.js +80 -0
- package/dist/es/timeline/gantt-timeline.component.js +50 -4
- package/dist/es/toolbar/toolbar.component.js +20 -13
- package/dist/es/toolbar/view-selector.component.js +1 -1
- package/dist/es/utils.js +153 -12
- package/dist/es2015/common/touch-enabled.d.ts +9 -0
- package/dist/es2015/common/touch-enabled.js +9 -0
- package/dist/es2015/dependencies/utils.d.ts +15 -0
- package/dist/es2015/dependencies/utils.js +40 -5
- package/dist/es2015/dragging/dependency-drag-create.directive.d.ts +72 -0
- package/dist/es2015/dragging/dependency-drag-create.directive.js +324 -0
- package/dist/es2015/dragging/drag-validation-tooltip.component.d.ts +29 -0
- package/dist/es2015/dragging/drag-validation-tooltip.component.js +76 -0
- package/dist/es2015/editing/add-task.component.d.ts +45 -0
- package/dist/es2015/editing/add-task.component.js +102 -0
- package/dist/es2015/editing/dependencies-table.component.d.ts +39 -0
- package/dist/es2015/editing/dependencies-table.component.js +160 -0
- package/dist/es2015/editing/edit-dialog.component.d.ts +11 -4
- package/dist/es2015/editing/edit-dialog.component.js +66 -36
- package/dist/es2015/editing/edit.service.d.ts +24 -4
- package/dist/es2015/editing/edit.service.js +81 -11
- package/dist/es2015/editing/task-fields.component.d.ts +22 -0
- package/dist/es2015/editing/task-fields.component.js +67 -0
- package/dist/es2015/editing/{util.d.ts → utils.d.ts} +2 -2
- package/dist/es2015/editing/{util.js → utils.js} +0 -0
- package/dist/es2015/gantt.component.d.ts +134 -31
- package/dist/es2015/gantt.component.js +419 -61
- package/dist/es2015/gantt.module.js +37 -9
- package/dist/es2015/index.d.ts +9 -0
- package/dist/es2015/index.js +9 -0
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/{models/events/edit-event.interface.d.ts → localization/gantt-localization.service.d.ts} +6 -10
- package/dist/es2015/localization/gantt-localization.service.js +25 -0
- package/dist/es2015/localization/messages.d.ts +46 -2
- package/dist/es2015/localization/messages.js +45 -1
- package/dist/es2015/main.d.ts +1 -0
- package/dist/es2015/main.js +1 -0
- package/dist/es2015/models/dependency-type.enum.d.ts +1 -1
- package/dist/es2015/models/dependency-type.enum.js +16 -0
- package/dist/es2015/models/events/dependency-add-event.interface.d.ts +26 -0
- package/dist/es2015/models/events/{remove-event.interface.js → dependency-add-event.interface.js} +0 -0
- package/dist/es2015/models/events/task-add-event.interface.d.ts +31 -0
- package/dist/es2015/models/{toolbar-position.js → events/task-add-event.interface.js} +0 -0
- package/dist/es2015/models/events/task-click-event.interface.d.ts +3 -3
- package/dist/es2015/models/events/task-delete-event.interface.d.ts +21 -0
- package/dist/es2015/models/events/task-delete-event.interface.js +4 -0
- package/dist/es2015/models/events/task-edit-event.interface.d.ts +36 -6
- package/dist/es2015/models/models.d.ts +6 -3
- package/dist/es2015/models/models.js +1 -0
- package/dist/es2015/models/toolbar-settings.d.ts +29 -0
- package/dist/es2015/models/toolbar-settings.js +4 -0
- package/dist/es2015/models/view-item.interface.d.ts +35 -0
- package/dist/es2015/models/view-item.interface.js +4 -0
- package/dist/es2015/navigation/navigation-models.d.ts +34 -0
- package/dist/es2015/navigation/navigation-models.js +4 -0
- package/dist/es2015/navigation/navigation.service.d.ts +126 -0
- package/dist/es2015/navigation/navigation.service.js +355 -0
- package/dist/es2015/navigation/utils.d.ts +26 -0
- package/dist/es2015/navigation/utils.js +69 -0
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/rendering/gantt-milestone-task.component.d.ts +3 -1
- package/dist/es2015/rendering/gantt-milestone-task.component.js +35 -8
- package/dist/es2015/rendering/gantt-summary-task.component.d.ts +5 -1
- package/dist/es2015/rendering/gantt-summary-task.component.js +47 -8
- package/dist/es2015/rendering/gantt-task-base.d.ts +20 -6
- package/dist/es2015/rendering/gantt-task-base.js +75 -22
- package/dist/es2015/rendering/gantt-task.component.d.ts +4 -2
- package/dist/es2015/rendering/gantt-task.component.js +47 -13
- package/dist/es2015/rendering/gantt-tasks-table-body.component.d.ts +6 -3
- package/dist/es2015/rendering/gantt-tasks-table-body.component.js +27 -9
- package/dist/es2015/scrolling/drag-scroll-settings.d.ts +47 -0
- package/dist/es2015/scrolling/drag-scroll-settings.js +20 -0
- package/dist/es2015/scrolling/scroll-sync.service.d.ts +1 -1
- package/dist/es2015/scrolling/timeline-scroll.directive.d.ts +24 -0
- package/dist/es2015/scrolling/timeline-scroll.directive.js +78 -0
- package/dist/es2015/scrolling/timeline-scroll.service.d.ts +20 -0
- package/dist/es2015/scrolling/timeline-scroll.service.js +44 -0
- package/dist/es2015/scrolling/utils.d.ts +29 -0
- package/dist/es2015/scrolling/utils.js +80 -0
- package/dist/es2015/timeline/gantt-timeline.component.d.ts +29 -4
- package/dist/es2015/timeline/gantt-timeline.component.js +67 -5
- package/dist/es2015/toolbar/toolbar-template.directive.d.ts +1 -1
- package/dist/es2015/toolbar/toolbar.component.d.ts +6 -5
- package/dist/es2015/toolbar/toolbar.component.js +22 -13
- package/dist/es2015/toolbar/view-selector.component.js +3 -1
- package/dist/es2015/utils.d.ts +77 -8
- package/dist/es2015/utils.js +153 -12
- package/dist/fesm2015/index.js +5258 -3012
- package/dist/fesm5/index.js +2862 -733
- package/dist/npm/common/touch-enabled.js +11 -0
- package/dist/npm/dependencies/utils.js +40 -5
- package/dist/npm/dragging/dependency-drag-create.directive.js +349 -0
- package/dist/npm/dragging/drag-validation-tooltip.component.js +29 -0
- package/dist/npm/editing/add-task.component.js +96 -0
- package/dist/npm/editing/dependencies-table.component.js +133 -0
- package/dist/npm/editing/edit-dialog.component.js +38 -7
- package/dist/npm/editing/edit.service.js +91 -7
- package/dist/npm/editing/task-fields.component.js +45 -0
- package/dist/npm/editing/{util.js → utils.js} +0 -0
- package/dist/npm/gantt.component.js +409 -57
- package/dist/npm/gantt.module.js +35 -7
- package/dist/npm/index.js +18 -0
- package/dist/npm/localization/gantt-localization.service.js +28 -0
- package/dist/npm/localization/messages.js +45 -1
- package/dist/npm/main.js +2 -0
- package/dist/npm/models/dependency-type.enum.js +16 -0
- package/dist/npm/models/events/{add-event.interface.js → dependency-add-event.interface.js} +0 -0
- package/dist/npm/models/events/{edit-event.interface.js → task-add-event.interface.js} +0 -0
- package/dist/npm/models/events/{remove-event.interface.js → task-delete-event.interface.js} +0 -0
- package/dist/npm/models/models.js +2 -0
- package/dist/npm/models/{toolbar-position.js → toolbar-settings.js} +0 -0
- package/dist/npm/models/view-item.interface.js +6 -0
- package/dist/npm/navigation/navigation-models.js +6 -0
- package/dist/npm/navigation/navigation.service.js +392 -0
- package/dist/npm/navigation/utils.js +79 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/rendering/gantt-milestone-task.component.js +11 -5
- package/dist/npm/rendering/gantt-summary-task.component.js +26 -5
- package/dist/npm/rendering/gantt-task-base.js +84 -22
- package/dist/npm/rendering/gantt-task.component.js +12 -7
- package/dist/npm/rendering/gantt-tasks-table-body.component.js +13 -5
- package/dist/npm/scrolling/drag-scroll-settings.js +22 -0
- package/dist/npm/scrolling/timeline-scroll.directive.js +91 -0
- package/dist/npm/scrolling/timeline-scroll.service.js +41 -0
- package/dist/npm/scrolling/utils.js +83 -0
- package/dist/npm/timeline/gantt-timeline.component.js +49 -3
- package/dist/npm/toolbar/toolbar.component.js +18 -11
- package/dist/npm/toolbar/view-selector.component.js +1 -1
- package/dist/npm/utils.js +153 -12
- package/dist/systemjs/kendo-angular-gantt.js +1 -1
- package/package.json +7 -4
- package/dist/es2015/models/events/add-event.interface.d.ts +0 -16
- package/dist/es2015/models/events/remove-event.interface.d.ts +0 -16
- package/dist/es2015/models/toolbar-position.d.ts +0 -9
package/dist/es2015/utils.d.ts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { Day } from '@progress/kendo-date-math';
|
|
6
6
|
import { GanttColumnBase, GanttColumnGroupComponent } from './columns/columns';
|
|
7
|
+
import { DependencyType } from './models/dependency-type.enum';
|
|
8
|
+
import { ViewItem } from './models/view-item.interface';
|
|
7
9
|
/**
|
|
8
10
|
* @hidden
|
|
9
11
|
*/
|
|
@@ -66,32 +68,99 @@ export declare const isString: (contender: any) => contender is string;
|
|
|
66
68
|
* Native Omit appears in TS v3.5, we can use it when we drop Angular 8 (requires v3.4)
|
|
67
69
|
*/
|
|
68
70
|
export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
71
|
+
/**
|
|
72
|
+
* @hidden
|
|
73
|
+
*
|
|
74
|
+
* Gets the closest timeline task wrapper element from an event target.
|
|
75
|
+
* Restricts the search up to the provided parent element from the second param.
|
|
76
|
+
*/
|
|
77
|
+
export declare const getClosestTaskWrapper: (element: Element, parentScope: Element) => Element;
|
|
78
|
+
/**
|
|
79
|
+
* @hidden
|
|
80
|
+
*
|
|
81
|
+
* Checks whether the queried item or its parent items has a `k-task-wrap` selector.
|
|
82
|
+
* Restricts the search up to the provided parent element from the second param.
|
|
83
|
+
*/
|
|
84
|
+
export declare const isTaskWrapper: (contender: Element, parentScope: Element) => boolean;
|
|
69
85
|
/**
|
|
70
86
|
* @hidden
|
|
71
87
|
*
|
|
72
88
|
* Gets the closest timeline task element from an event target.
|
|
73
|
-
* Restricts the search up to the provided
|
|
89
|
+
* Restricts the search up to the provided parent element from the second param.
|
|
74
90
|
*/
|
|
75
|
-
export declare const getClosestTask: (element: Element,
|
|
91
|
+
export declare const getClosestTask: (element: Element, parentScope: Element) => Element;
|
|
76
92
|
/**
|
|
77
93
|
* @hidden
|
|
78
94
|
*
|
|
79
95
|
* Gets the closest timeline task element index from an event target.
|
|
80
96
|
* Uses the `data-task-index` attribute assigned to each task.
|
|
81
|
-
* Restricts the search up to the provided
|
|
97
|
+
* Restricts the search up to the provided parent element from the second param.
|
|
82
98
|
*/
|
|
83
|
-
export declare const getClosestTaskIndex: (element: Element,
|
|
99
|
+
export declare const getClosestTaskIndex: (element: EventTarget | Element, parentScope: Element) => number;
|
|
84
100
|
/**
|
|
85
101
|
* @hidden
|
|
86
102
|
*
|
|
87
103
|
* Checks whether the queried item or its parent items has a `k-task` selector.
|
|
88
|
-
* Restricts the search up to the provided
|
|
104
|
+
* Restricts the search up to the provided parent element from the second param.
|
|
105
|
+
*/
|
|
106
|
+
export declare const isTask: (contender: EventTarget | Element, parentScope: Element) => boolean;
|
|
107
|
+
/**
|
|
108
|
+
* @hidden
|
|
109
|
+
*
|
|
110
|
+
* Checks whether the queried item or its parent items has a `k-toolbar` selector.
|
|
111
|
+
* Restricts the search up to the provided parent element from the second param.
|
|
89
112
|
*/
|
|
90
|
-
export declare const
|
|
113
|
+
export declare const isToolbar: (contender: EventTarget | Element, parentScope: Element) => boolean;
|
|
91
114
|
/**
|
|
92
115
|
* @hidden
|
|
93
116
|
*
|
|
94
117
|
* Checks whether the queried item or its parent items has a `k-task-actions` selector - used for the clear button.
|
|
95
|
-
* Restricts the search up to the provided
|
|
118
|
+
* Restricts the search up to the provided parent element from the second param.
|
|
119
|
+
*/
|
|
120
|
+
export declare const isClearButton: (contender: EventTarget | Element, parentScope: Element) => boolean;
|
|
121
|
+
/**
|
|
122
|
+
* @hidden
|
|
123
|
+
*
|
|
124
|
+
* Checks whether the queried item has a `k-task-dot` selector - used for the dependency drag clues.
|
|
125
|
+
*/
|
|
126
|
+
export declare const isDependencyDragClue: (element: Element) => boolean;
|
|
127
|
+
/**
|
|
128
|
+
* @hidden
|
|
129
|
+
*
|
|
130
|
+
* Checks whether the queried item has a `k-task-dot` & `k-task-start` selector - used for the dependency drag start clues.
|
|
131
|
+
*/
|
|
132
|
+
export declare const isDependencyDragStartClue: (element: Element) => boolean;
|
|
133
|
+
/**
|
|
134
|
+
* @hidden
|
|
135
|
+
*
|
|
136
|
+
* Gets the `DependencyType` for an attempted dependency create from the provided two elements.
|
|
137
|
+
* The two linked drag clue HTML elements are used to extract this data (via their CSS classes).
|
|
138
|
+
*/
|
|
139
|
+
export declare const getDependencyTypeFromTargetTasks: (fromTaskClue: Element, toTaskClue: Element) => DependencyType;
|
|
140
|
+
/**
|
|
141
|
+
* @hidden
|
|
142
|
+
*
|
|
143
|
+
* Checks whether the two provided drag clues belong to the same task element.
|
|
144
|
+
*/
|
|
145
|
+
export declare const sameTaskClues: (fromTaskClue: Element, toTaskClue: Element, parentScope: Element) => boolean;
|
|
146
|
+
/**
|
|
147
|
+
* @hidden
|
|
148
|
+
*
|
|
149
|
+
* Fits a contender number between a min and max range.
|
|
150
|
+
* If the contender is below the min value, the min value is returned.
|
|
151
|
+
* If the contender is above the max value, the max value is returned.
|
|
152
|
+
*/
|
|
153
|
+
export declare const fitToRange: (contender: number, min: number, max: number) => number;
|
|
154
|
+
/**
|
|
155
|
+
* @hidden
|
|
156
|
+
*
|
|
157
|
+
* Checks whether either of the two provided tasks is a parent of the other.
|
|
158
|
+
*/
|
|
159
|
+
export declare const areParentChild: (taskA: ViewItem, taskB: ViewItem) => boolean;
|
|
160
|
+
/**
|
|
161
|
+
* @hidden
|
|
162
|
+
*
|
|
163
|
+
* Extracts an element from the provided client coords.
|
|
164
|
+
* Using the `event.target` is not reliable under mobile devices with the current implementation of the draggable, so use this instead.
|
|
96
165
|
*/
|
|
97
|
-
export declare const
|
|
166
|
+
export declare const elementFromPoint: (clientX: number, clientY: number) => HTMLElement;
|
package/dist/es2015/utils.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { isDocumentAvailable, closestInScope, matchesClasses } from '@progress/kendo-angular-common';
|
|
6
6
|
import { addDays, addWeeks, cloneDate, firstDayInWeek } from '@progress/kendo-date-math';
|
|
7
|
+
import { DependencyType } from './models/dependency-type.enum';
|
|
7
8
|
/**
|
|
8
9
|
* @hidden
|
|
9
10
|
*/
|
|
@@ -107,24 +108,43 @@ export const isNumber = (contender) => typeof contender === 'number' && !isNaN(c
|
|
|
107
108
|
* @hidden
|
|
108
109
|
*/
|
|
109
110
|
export const isString = (contender) => typeof contender === 'string';
|
|
111
|
+
/**
|
|
112
|
+
* @hidden
|
|
113
|
+
*
|
|
114
|
+
* Gets the closest timeline task wrapper element from an event target.
|
|
115
|
+
* Restricts the search up to the provided parent element from the second param.
|
|
116
|
+
*/
|
|
117
|
+
export const getClosestTaskWrapper = (element, parentScope) => {
|
|
118
|
+
return closestInScope(element, matchesClasses('k-task-wrap'), parentScope);
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* @hidden
|
|
122
|
+
*
|
|
123
|
+
* Checks whether the queried item or its parent items has a `k-task-wrap` selector.
|
|
124
|
+
* Restricts the search up to the provided parent element from the second param.
|
|
125
|
+
*/
|
|
126
|
+
export const isTaskWrapper = (contender, parentScope) => {
|
|
127
|
+
const taskWrapper = closestInScope(contender, matchesClasses('k-task-wrap'), parentScope);
|
|
128
|
+
return isPresent(taskWrapper);
|
|
129
|
+
};
|
|
110
130
|
/**
|
|
111
131
|
* @hidden
|
|
112
132
|
*
|
|
113
133
|
* Gets the closest timeline task element from an event target.
|
|
114
|
-
* Restricts the search up to the provided
|
|
134
|
+
* Restricts the search up to the provided parent element from the second param.
|
|
115
135
|
*/
|
|
116
|
-
export const getClosestTask = (element,
|
|
117
|
-
return closestInScope(element, matchesClasses('k-task'),
|
|
136
|
+
export const getClosestTask = (element, parentScope) => {
|
|
137
|
+
return closestInScope(element, matchesClasses('k-task'), parentScope);
|
|
118
138
|
};
|
|
119
139
|
/**
|
|
120
140
|
* @hidden
|
|
121
141
|
*
|
|
122
142
|
* Gets the closest timeline task element index from an event target.
|
|
123
143
|
* Uses the `data-task-index` attribute assigned to each task.
|
|
124
|
-
* Restricts the search up to the provided
|
|
144
|
+
* Restricts the search up to the provided parent element from the second param.
|
|
125
145
|
*/
|
|
126
|
-
export const getClosestTaskIndex = (element,
|
|
127
|
-
const task = closestInScope(element, matchesClasses('k-task'),
|
|
146
|
+
export const getClosestTaskIndex = (element, parentScope) => {
|
|
147
|
+
const task = closestInScope(element, matchesClasses('k-task-wrap'), parentScope);
|
|
128
148
|
if (!isPresent(task)) {
|
|
129
149
|
return null;
|
|
130
150
|
}
|
|
@@ -134,19 +154,140 @@ export const getClosestTaskIndex = (element, gantt) => {
|
|
|
134
154
|
* @hidden
|
|
135
155
|
*
|
|
136
156
|
* Checks whether the queried item or its parent items has a `k-task` selector.
|
|
137
|
-
* Restricts the search up to the provided
|
|
157
|
+
* Restricts the search up to the provided parent element from the second param.
|
|
138
158
|
*/
|
|
139
|
-
export const isTask = (contender,
|
|
140
|
-
const task = closestInScope(contender, matchesClasses('k-task'),
|
|
159
|
+
export const isTask = (contender, parentScope) => {
|
|
160
|
+
const task = closestInScope(contender, matchesClasses('k-task'), parentScope);
|
|
141
161
|
return isPresent(task);
|
|
142
162
|
};
|
|
163
|
+
/**
|
|
164
|
+
* @hidden
|
|
165
|
+
*
|
|
166
|
+
* Checks whether the queried item or its parent items has a `k-toolbar` selector.
|
|
167
|
+
* Restricts the search up to the provided parent element from the second param.
|
|
168
|
+
*/
|
|
169
|
+
export const isToolbar = (contender, parentScope) => {
|
|
170
|
+
const toolbar = closestInScope(contender, matchesClasses('k-gantt-toolbar'), parentScope);
|
|
171
|
+
return isPresent(toolbar);
|
|
172
|
+
};
|
|
143
173
|
/**
|
|
144
174
|
* @hidden
|
|
145
175
|
*
|
|
146
176
|
* Checks whether the queried item or its parent items has a `k-task-actions` selector - used for the clear button.
|
|
147
|
-
* Restricts the search up to the provided
|
|
177
|
+
* Restricts the search up to the provided parent element from the second param.
|
|
148
178
|
*/
|
|
149
|
-
export const isClearButton = (contender,
|
|
150
|
-
const clearButtonContainer = closestInScope(contender, matchesClasses('k-task-actions'),
|
|
179
|
+
export const isClearButton = (contender, parentScope) => {
|
|
180
|
+
const clearButtonContainer = closestInScope(contender, matchesClasses('k-task-actions'), parentScope);
|
|
151
181
|
return isPresent(clearButtonContainer);
|
|
152
182
|
};
|
|
183
|
+
/**
|
|
184
|
+
* @hidden
|
|
185
|
+
*
|
|
186
|
+
* Checks whether the queried item has a `k-task-dot` selector - used for the dependency drag clues.
|
|
187
|
+
*/
|
|
188
|
+
export const isDependencyDragClue = (element) => {
|
|
189
|
+
if (!isPresent(element)) {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
return element.classList.contains('k-task-dot');
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* @hidden
|
|
196
|
+
*
|
|
197
|
+
* Checks whether the queried item has a `k-task-dot` & `k-task-start` selector - used for the dependency drag start clues.
|
|
198
|
+
*/
|
|
199
|
+
export const isDependencyDragStartClue = (element) => {
|
|
200
|
+
if (!isPresent(element)) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
return element.classList.contains('k-task-dot') && element.classList.contains('k-task-start');
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* @hidden
|
|
207
|
+
*
|
|
208
|
+
* Gets the `DependencyType` for an attempted dependency create from the provided two elements.
|
|
209
|
+
* The two linked drag clue HTML elements are used to extract this data (via their CSS classes).
|
|
210
|
+
*/
|
|
211
|
+
export const getDependencyTypeFromTargetTasks = (fromTaskClue, toTaskClue) => {
|
|
212
|
+
if (!isDependencyDragClue(fromTaskClue) || !isDependencyDragClue(toTaskClue)) {
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
const fromTaskType = isDependencyDragStartClue(fromTaskClue) ? 'S' : 'F';
|
|
216
|
+
const toTaskType = isDependencyDragStartClue(toTaskClue) ? 'S' : 'F';
|
|
217
|
+
const dependencyTypeName = `${fromTaskType}${toTaskType}`;
|
|
218
|
+
switch (dependencyTypeName) {
|
|
219
|
+
case 'FF': return DependencyType.FF;
|
|
220
|
+
case 'FS': return DependencyType.FS;
|
|
221
|
+
case 'SF': return DependencyType.SF;
|
|
222
|
+
case 'SS': return DependencyType.SS;
|
|
223
|
+
default: return null;
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* @hidden
|
|
228
|
+
*
|
|
229
|
+
* Checks whether the two provided drag clues belong to the same task element.
|
|
230
|
+
*/
|
|
231
|
+
export const sameTaskClues = (fromTaskClue, toTaskClue, parentScope) => {
|
|
232
|
+
if (!isPresent(fromTaskClue) || !isPresent(toTaskClue)) {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
const fromTaskWrapper = getClosestTaskWrapper(fromTaskClue, parentScope);
|
|
236
|
+
const toTaskWrapper = getClosestTaskWrapper(toTaskClue, parentScope);
|
|
237
|
+
return fromTaskWrapper === toTaskWrapper;
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* @hidden
|
|
241
|
+
*
|
|
242
|
+
* Fits a contender number between a min and max range.
|
|
243
|
+
* If the contender is below the min value, the min value is returned.
|
|
244
|
+
* If the contender is above the max value, the max value is returned.
|
|
245
|
+
*/
|
|
246
|
+
export const fitToRange = (contender, min, max) => {
|
|
247
|
+
if (!isPresent(contender) || contender < min) {
|
|
248
|
+
return min;
|
|
249
|
+
}
|
|
250
|
+
else if (contender > max) {
|
|
251
|
+
return max;
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
return contender;
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* @hidden
|
|
259
|
+
*
|
|
260
|
+
* Checks whether either of the two provided tasks is a parent of the other.
|
|
261
|
+
*/
|
|
262
|
+
export const areParentChild = (taskA, taskB) => {
|
|
263
|
+
let parentChildRelationship = false;
|
|
264
|
+
let taskAParent = taskA;
|
|
265
|
+
while (isPresent(taskAParent) && isPresent(taskAParent.data)) {
|
|
266
|
+
if (taskAParent.data === taskB.data) {
|
|
267
|
+
parentChildRelationship = true;
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
taskAParent = taskAParent.parent;
|
|
271
|
+
}
|
|
272
|
+
let taskBParent = taskB;
|
|
273
|
+
while (!parentChildRelationship && isPresent(taskBParent) && isPresent(taskBParent.data)) {
|
|
274
|
+
if (taskBParent.data === taskA.data) {
|
|
275
|
+
parentChildRelationship = true;
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
taskBParent = taskBParent.parent;
|
|
279
|
+
}
|
|
280
|
+
return parentChildRelationship;
|
|
281
|
+
};
|
|
282
|
+
/**
|
|
283
|
+
* @hidden
|
|
284
|
+
*
|
|
285
|
+
* Extracts an element from the provided client coords.
|
|
286
|
+
* Using the `event.target` is not reliable under mobile devices with the current implementation of the draggable, so use this instead.
|
|
287
|
+
*/
|
|
288
|
+
export const elementFromPoint = (clientX, clientY) => {
|
|
289
|
+
if (!isDocumentAvailable()) {
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
return document.elementFromPoint(clientX, clientY);
|
|
293
|
+
};
|