Skip to content

Commit

Permalink
* kanban: support to set global kanban lane height.
Browse files Browse the repository at this point in the history
  • Loading branch information
catouse committed Oct 17, 2023
1 parent 07bb80d commit f9c34e0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
20 changes: 18 additions & 2 deletions lib/kanban/src/component/kanban.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,21 @@ export class Kanban<P extends KanbanProps = KanbanProps, S extends KanbanState =
return cols;
}

protected _layoutLanes(lanes: KanbanLaneOptions[], props: RenderableProps<P>): KanbanLaneOptions[] {
const {laneHeight, maxLaneHeight, minLaneHeight} = props;
if (!laneHeight && !maxLaneHeight && !minLaneHeight) {
return lanes;
}
return lanes.map(lane => {
return {
height: laneHeight,
maxHeight: maxLaneHeight,
minHeight: minLaneHeight,
...lane,
};
});
}

protected _getClassName(props: RenderableProps<P>): ClassNameLike {
return ['kanban', props.className, props.sticky ? 'kanban-sticky' : '', this.data.hasSubCols ? 'has-sub-cols' : ''];
}
Expand All @@ -593,14 +608,15 @@ export class Kanban<P extends KanbanProps = KanbanProps, S extends KanbanState =
const {cols, lanes, items, links = []} = data;
const {editLinks} = props;
const layoutCols = this._layoutCols(cols, props);
console.log('> Kanban.render', {...data, layoutCols, props, kanban: this});
const layoutLanes = this._layoutLanes(lanes, props);
console.log('> Kanban.render', {...data, layoutCols, layoutLanes, props, kanban: this});
return [
<KanbanHeader key="header" cols={layoutCols} />,
<KanbanBody
key="body"
itemRender={props.itemRender}
cols={layoutCols}
lanes={lanes}
lanes={layoutLanes}
items={items}
/>,
links.length ? <KanbanLinks key="links" links={links} onDeleteLink={editLinks ? (this._onDeleteLink as (link: KanbanLinkOptions) => void) : undefined} /> : null,
Expand Down
3 changes: 3 additions & 0 deletions lib/kanban/src/types/kanban-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export interface KanbanProps extends HElementProps {
colWidth?: number | 'auto' | ((col: KanbanColOptions) => number | 'auto');
minColWidth?: number;
maxColWidth?: number;
laneHeight?: SizeSetting | ((lane: KanbanLaneOptions) => SizeSetting);
minLaneHeight?: SizeSetting;
maxLaneHeight?: SizeSetting;
itemCountPerRow?: number;
itemProps?: Partial<KanbanItem>;
editLinks?: boolean;
Expand Down

0 comments on commit f9c34e0

Please sign in to comment.