Skip to content

Commit

Permalink
* kanban: support to set col title alignment.
Browse files Browse the repository at this point in the history
  • Loading branch information
catouse committed Jan 2, 2024
1 parent 07dfa00 commit 34b6de2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/kanban/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ onPageLoad(() => {
},
editLinks: true,
colProps: {
titleAlign: 'left',
/* 通过 actions 自定义列操作按钮(actions 还可以为一个回调函数动态返回操作按钮设置)。 */
actions: () => {
return [{
Expand Down
3 changes: 2 additions & 1 deletion lib/kanban/src/component/kanban-header-col.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class KanbanHeaderCol extends HElement<KanbanColProps> {
prefixClass,
title,
titleClass,
titleAlign = 'center',
subtitle,
subtitleClass,
icon,
Expand All @@ -44,7 +45,7 @@ export class KanbanHeaderCol extends HElement<KanbanColProps> {
} = props;

return [
<div key="wrapper" className="kanban-header-col-wrapper">
<div key="wrapper" className={`kanban-header-col-wrapper is-align-${titleAlign}`}>
<div key="title" className="kanban-header-title">
{icon ? <Icon key="icon" className="as-leading-icon" icon={icon} /> : null}
{prefix ? <span key="prefix" className={classes('as-prefix', prefixClass)}><CustomContent content={prefix} /></span> : null}
Expand Down
6 changes: 6 additions & 0 deletions lib/kanban/src/style/kanban.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
.kanban-header-col-wrapper {
@apply -bg-surface -relative -px-14 -w-full -flex-1 -flex -flex-row -items-center;
}
.kanban-header-col-wrapper.is-align-left {
@apply -justify-start -pl-2;
}
.kanban-header-col-wrapper.is-align-left > .kanban-header-title {
@apply -justify-start;
}
.kanban-header-title {
@apply -flex -flex-row -items-center -flex-auto -justify-center -overflow-hidden;
}
Expand Down
1 change: 1 addition & 0 deletions lib/kanban/src/types/kanban-col-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface KanbanColOptions extends HElementProps {
prefixClass?: ClassNameLike;
title?: CustomContentType;
titleClass?: ClassNameLike;
titleAlign?: 'left' | 'center',
subtitle?: CustomContentType;
subtitleClass?: ClassNameLike;
icon?: IconType;
Expand Down

0 comments on commit 34b6de2

Please sign in to comment.