Skip to content

Commit

Permalink
feat: GanttColumnSize添加支持自定义宽度
Browse files Browse the repository at this point in the history
  • Loading branch information
yanminxing committed Oct 9, 2023
1 parent d778d36 commit a9c19fe
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/root/rootProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ export default {
* 甘特图表的每一列宽度
*/
ganttColumnSize: {
type: String as PropType<GanttColumnSize>,
type: String as PropType<GanttColumnSize> | number,
default: 'normal',
validator: (v: GanttColumnSize) => {
return ['small', 'normal', 'large'].includes(v);
return typeof v === 'number' || ['small', 'normal', 'large'].includes(v);
}
},

Expand Down
1 change: 1 addition & 0 deletions src/composables/useGanttWidth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default () => {

const ganttColumnWidth = computed(() => {
const size = store.$styleBox.ganttColumnSize;
if (typeof size === 'number') return size;
return Variables.size.ganttColumnWidth[size][store.ganttHeader.unit];
});

Expand Down
2 changes: 1 addition & 1 deletion src/typings/size.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
declare type GanttColumnSize = 'small' | 'normal' | 'large';
declare type GanttColumnSize = 'small' | 'normal' | 'large' | number;

0 comments on commit a9c19fe

Please sign in to comment.