Skip to content

Commit

Permalink
Merge pull request #1776 from smeup/planner-fix
Browse files Browse the repository at this point in the history
kup-planner: fixed incorrectly placed horizontal scrollbar + style.
  • Loading branch information
pasere-smeup authored Feb 7, 2024
2 parents 7a0b951 + 3f67944 commit 557ef2f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
4 changes: 2 additions & 2 deletions packages/ketchup/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2279,7 +2279,7 @@ export namespace Components {
"rtl": boolean;
"scrollNumber": number;
"svgWidth": number;
"taskGanttRef": HTMLDivElement;
"taskListTrueRef": HTMLKupTaskListElement;
"taskListWidth": number;
}
interface KupIframe {
Expand Down Expand Up @@ -6854,7 +6854,7 @@ declare namespace LocalJSX {
"rtl"?: boolean;
"scrollNumber"?: number;
"svgWidth"?: number;
"taskGanttRef"?: HTMLDivElement;
"taskListTrueRef"?: HTMLKupTaskListElement;
"taskListWidth"?: number;
}
interface KupIframe {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ export class KupGantt {
*/

@Element() rootElement: HTMLElement;

taskListTrueRef: HTMLKupTaskListElement = null;
//---- Lifecycle hooks ----

componentWillLoad() {
Expand Down Expand Up @@ -980,6 +980,7 @@ export class KupGantt {
setDoubleView={this.setDoubleView}
{...tableProps}
class="tasks"
ref={(el) => (this.taskListTrueRef = el)}
/>
)}
<kup-task-gantt
Expand Down Expand Up @@ -1022,7 +1023,7 @@ export class KupGantt {
{this.taskGanttRef && (
<kup-horizontal-scroll
svgWidth={this.svgWidth}
taskGanttRef={this.taskGanttRef}
taskListTrueRef={this.taskListTrueRef}
taskListWidth={this.taskListWidth}
scrollNumber={this.scrollX}
rtl={this.rtl}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
.scrollWrapper {
overflow: auto;
max-width: 100%;
/*firefox*/
scrollbar-width: thin;
/*iPad*/
height: 1.2rem;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class HorizontalScroll {
svgWidth: number;

@Prop()
taskGanttRef: HTMLDivElement;
taskListTrueRef: HTMLKupTaskListElement;

@Prop()
rtl: boolean;
Expand Down Expand Up @@ -62,20 +62,17 @@ export class HorizontalScroll {
}

render() {
const rect = this.taskGanttRef.getBoundingClientRect();
const w =
this.taskListTrueRef?.getBoundingClientRect().width + 24 * 1.5 ?? 0; // 24 * 2 is the sum of padding and margin for both list and gantt, multiplied by 1.5 cause we need to add the other half to the right

return (
<div
dir="ltr"
style={
rect
? {
margin: this.rtl
? `0px ${rect.x}px 0px 0px`
: `0px 0px 0px ${rect.x}px`,
}
: undefined
}
style={{
margin: this.rtl
? `0px ${w}px 0px 12px`
: `0px 12px 0px ${w}px`,
}}
class="scrollWrapper"
data-scrollx="true"
onScroll={this.horizontalScroll}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
overflow: hidden auto;
width: 1rem;
flex-shrink: 0;
/*firefox*/
scrollbar-width: thin;
}

.scroll::-webkit-scrollbar {
Expand Down

0 comments on commit 557ef2f

Please sign in to comment.