devexpress-gantt
Advanced tools
Comparing version 4.1.43 to 4.1.44
{ | ||
"name": "devexpress-gantt", | ||
"version": "4.1.43", | ||
"version": "4.1.44", | ||
"description": "DevExpress Gantt Control", | ||
@@ -5,0 +5,0 @@ "main": "dist/dx-gantt.min.js", |
@@ -98,3 +98,4 @@ import { Point } from "@devexpress/utils/lib/geometry/point"; | ||
destroyTemplate: (container: HTMLElement) => { this.settings.destroyTemplate(container); }, | ||
formatDate: (date: Date) => { return this.settings.formatDate(date); } | ||
formatDate: (date: Date) => { return this.settings.formatDate(date); }, | ||
getTaskAreaContainer: () => { return this.settings.getRenderHelper().taskAreaContainer; } | ||
}); | ||
@@ -101,0 +102,0 @@ |
@@ -5,2 +5,3 @@ import { DomUtils } from "@devexpress/utils/lib/utils/dom"; | ||
import { ElementTextHelperCultureInfo } from "../Utils/ElementTextHelperCultureInfo"; | ||
import { ITaskAreaContainer } from "../../Interfaces/ITaskAreaContainer"; | ||
@@ -17,2 +18,6 @@ export class TaskEditTooltip { | ||
} | ||
public static defaultArrowHeight: number = 5; | ||
public static defaultHeightOffset: number = 15; | ||
private parentElement: HTMLElement; | ||
@@ -40,2 +45,5 @@ private _baseElement: HTMLElement; | ||
} | ||
private get taskAreaContainer(): ITaskAreaContainer { | ||
return this.tooltipSettings.getTaskAreaContainer(); | ||
} | ||
@@ -153,20 +161,11 @@ private get taskTooltipContentTemplate(): (container: HTMLElement, model: any, ...args) => any { | ||
public show(posX: number, autoHide: boolean = true): void { | ||
const arrowHeight = 5; | ||
const heightOffset = 15; | ||
this.defaultTooltip?.classList.remove(TaskEditTooltip.CLASSNAMES.TASK_EDIT_TOOLTIP_ARROW_AFTER); | ||
this.defaultTooltip?.classList.remove(TaskEditTooltip.CLASSNAMES.TASK_EDIT_TOOLTIP_ARROW_BEFORE); | ||
this.baseElement.style.display = "block"; | ||
const absolutePositionY = DomUtils.getAbsolutePositionY(this.parentElement); | ||
const absoluteX = DomUtils.getAbsolutePositionX(this.parentElement); | ||
const leftPosition = posX - absoluteX - 2 * arrowHeight; | ||
const absoluteDistance = absolutePositionY - this.headerHeight - DomUtils.getDocumentScrollTop() - heightOffset; | ||
const isShowingDown = this.baseElement.clientHeight > absoluteDistance || this.baseElement.clientHeight > this.parentElement.offsetTop; | ||
let topPosition = -this.baseElement.clientHeight - arrowHeight; | ||
if(isShowingDown) { | ||
topPosition = this.parentElement.clientHeight + arrowHeight; | ||
this.defaultTooltip?.classList.add(TaskEditTooltip.CLASSNAMES.TASK_EDIT_TOOLTIP_ARROW_AFTER); | ||
} | ||
else | ||
this.defaultTooltip?.classList.add(TaskEditTooltip.CLASSNAMES.TASK_EDIT_TOOLTIP_ARROW_BEFORE); | ||
const leftPosition = this.getLeftPosition(posX); | ||
const isShowingUnder = this.needToShowUnderParent(); | ||
const topPosition = this.getTopPosition(isShowingUnder); | ||
const arrowClassName = isShowingUnder ? TaskEditTooltip.CLASSNAMES.TASK_EDIT_TOOLTIP_ARROW_AFTER : TaskEditTooltip.CLASSNAMES.TASK_EDIT_TOOLTIP_ARROW_BEFORE; | ||
this.defaultTooltip?.classList.add(arrowClassName); | ||
@@ -214,2 +213,23 @@ this.baseElement.style.left = leftPosition + "px"; | ||
} | ||
private getLeftPosition(absolutePosition: number): number { | ||
const parentAbsoluteX = DomUtils.getAbsolutePositionX(this.parentElement); | ||
let leftPosition = absolutePosition - parentAbsoluteX - 2 * TaskEditTooltip.defaultArrowHeight; | ||
if(this.taskAreaContainer) { | ||
const rightBorder = DomUtils.getAbsolutePositionX(this.taskAreaContainer.getElement()) + this.taskAreaContainer.getWidth(); | ||
const rightOverflow = absolutePosition + this.baseElement.clientWidth - rightBorder; | ||
if(rightOverflow > 0) | ||
leftPosition -= rightOverflow; | ||
} | ||
return leftPosition; | ||
} | ||
private getTopPosition(isShowingUnder: boolean): number { | ||
return isShowingUnder ? this.parentElement.clientHeight + TaskEditTooltip.defaultArrowHeight : -this.baseElement.clientHeight - TaskEditTooltip.defaultArrowHeight; | ||
} | ||
private needToShowUnderParent(): boolean { | ||
const absolutePositionY = DomUtils.getAbsolutePositionY(this.parentElement); | ||
const distanceToScreenTop = absolutePositionY - this.headerHeight - DomUtils.getDocumentScrollTop() - TaskEditTooltip.defaultHeightOffset; | ||
const taskAreaContScrollTop = this.taskAreaContainer?.scrollTop || 0; | ||
const distanceToTaskAreaTop = this.parentElement.offsetTop - taskAreaContScrollTop; | ||
return this.baseElement.clientHeight > distanceToScreenTop || this.baseElement.clientHeight > distanceToTaskAreaTop; | ||
} | ||
} |
import { isDefined } from "@devexpress/utils/lib/utils/common"; | ||
import { ITaskAreaContainer } from "../../../Interfaces/ITaskAreaContainer"; | ||
export class TooltipSettings { | ||
getHeaderHeight: number; | ||
getTaskAreaContainer: () => ITaskAreaContainer; | ||
getTaskTooltipContentTemplate: (container: HTMLElement, model: any, ...args) => void; | ||
@@ -26,2 +28,4 @@ getTaskProgressTooltipContentTemplate: (container: HTMLElement, model: any, ...args) => void; | ||
result.formatDate = settings.formatDate; | ||
if(isDefined(settings.getTaskAreaContainer)) | ||
result.getTaskAreaContainer = settings.getTaskAreaContainer; | ||
} | ||
@@ -28,0 +32,0 @@ return result; |
{ | ||
"name": "devexpress-gantt", | ||
"version": "4.1.43", | ||
"version": "4.1.44", | ||
"description": "DevExpress Gantt Control", | ||
@@ -5,0 +5,0 @@ "main": "dist/dx-gantt.min.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2199563
35033