Skip to content

Commit

Permalink
Typescript fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
knsv committed Oct 30, 2024
1 parent c1ca351 commit 8ef5d32
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function kanbanItem<T extends SVGGraphicsElement>(
{ config }: ShapeRenderOptions
) {
const { labelStyles, nodeStyles } = styles2String(kanbanNode);
kanbanNode.labelStyle = labelStyles;
kanbanNode.labelStyle = labelStyles || '';

const labelPaddingX = 10;
const orgWidth = kanbanNode.width;
Expand All @@ -54,11 +54,10 @@ export async function kanbanItem<T extends SVGGraphicsElement>(

const options = {
useHtmlLabels: kanbanNode.useHtmlLabels,
labelStyle: kanbanNode.labelStyle,
labelStyle: kanbanNode.labelStyle || '',
width: kanbanNode.width,
icon: kanbanNode.icon,
img: kanbanNode.img,
padding: kanbanNode.padding,
padding: kanbanNode.padding || 8,
centerLabel: false,
};
let labelEl, bbox2;
Expand Down Expand Up @@ -121,23 +120,23 @@ export async function kanbanItem<T extends SVGGraphicsElement>(
: rc.rectangle(x, y, totalWidth, totalHeight, options);

rect = shapeSvg.insert(() => roughNode, ':first-child');
rect.attr('class', 'basic label-container').attr('style', cssStyles);
rect.attr('class', 'basic label-container').attr('style', cssStyles ? cssStyles : null);
} else {
rect = shapeSvg.insert('rect', ':first-child');

rect
.attr('class', 'basic label-container __APA__')
.attr('style', nodeStyles)
.attr('rx', rx)
.attr('ry', ry)
.attr('rx', rx ?? 5)
.attr('ry', ry ?? 5)
.attr('x', x)
.attr('y', y)
.attr('width', totalWidth)
.attr('height', totalHeight);

const priority = 'priority' in kanbanNode && kanbanNode.priority;
if (priority) {
const line = shapeSvg.append('line', ':first-child');
const line = shapeSvg.append('line');
const lineX = x + 2;

const y1 = y + Math.floor((rx ?? 0) / 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ export const insertLabel = async <T extends SVGGraphicsElement>(
const useHtmlLabels = options.useHtmlLabels || evaluate(getConfig()?.flowchart?.htmlLabels);

// Create the label and insert it after the rect
const labelEl = parent.insert('g').attr('class', 'label').attr('style', options.labelStyle);
const labelEl = parent
.insert('g')
.attr('class', 'label')
.attr('style', options.labelStyle || '');

const text = await createText(labelEl, sanitizeText(decodeEntities(label), getConfig()), {
useHtmlLabels,
Expand Down

0 comments on commit 8ef5d32

Please sign in to comment.