Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kup-planner: fixed incorrectly placed horizontal scrollbar + style. #1776

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading