Skip to content

Commit

Permalink
Merge pull request smeup#2273 from smeup/INP-height-considering-table…
Browse files Browse the repository at this point in the history
…-height

fix/Inp absolute height considering table height
  • Loading branch information
Leonardo-Signorelli authored Dec 6, 2024
2 parents 60ed8db + 7f2d237 commit 205211e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { KupInputPanelLayout } from './kup-input-panel-declarations';

export const CHAR_WIDTH = 12;
export const ROW_HEIGHT = 22;

Expand Down Expand Up @@ -40,3 +42,19 @@ export const getAbsoluteLeft = (col: number) => {

return col * CHAR_WIDTH;
};

export const getInpComponentAbsoluteHeight = (layout: KupInputPanelLayout) => {
let inpRowHeight = 0;
layout.sections.forEach((section) => {
section.content.forEach((layoutField) => {
if (layoutField.absoluteRow > inpRowHeight) {
inpRowHeight =
layoutField.absoluteRow +
(layoutField.absoluteHeight > 1
? layoutField.absoluteHeight
: 0);
}
});
});
return inpRowHeight;
};
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ import {
getAbsoluteLeft,
getAbsoluteTop,
getAbsoluteWidth,
getInpComponentAbsoluteHeight,
ROW_HEIGHT,
} from './kup-input-panel-utils';
import { FTypography } from '../../f-components/f-typography/f-typography';
Expand Down Expand Up @@ -402,12 +403,9 @@ export class KupInputPanel {
} else {
if (layout.absolute) {
rowContent = this.#renderAbsoluteLayout(inputPanelCell, layout);
const maxAbsoluteRow = Math.max(
...layout.sections.flatMap((sec) =>
sec.content.map((cont) => cont.absoluteRow || 0)
)
);
styleObj.height = `${maxAbsoluteRow * ROW_HEIGHT}px`;
styleObj.height = `${
getInpComponentAbsoluteHeight(layout) * ROW_HEIGHT
}px`;
} else {
if (!layout.sectionsType) {
const hasDim = layout.sections.some((sec) => sec.dim);
Expand Down

0 comments on commit 205211e

Please sign in to comment.