From a9c19fed40bd5eb0d558ec298e5044e0a78155cf Mon Sep 17 00:00:00 2001 From: yanminxing <1194474469@qq.com> Date: Mon, 9 Oct 2023 10:16:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20GanttColumnSize=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A=E4=B9=89=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/root/rootProps.ts | 4 ++-- src/composables/useGanttWidth.ts | 1 + src/typings/size.d.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/root/rootProps.ts b/src/components/root/rootProps.ts index 87dc173..151d7c5 100644 --- a/src/components/root/rootProps.ts +++ b/src/components/root/rootProps.ts @@ -134,10 +134,10 @@ export default { * 甘特图表的每一列宽度 */ ganttColumnSize: { - type: String as PropType, + type: String as PropType | number, default: 'normal', validator: (v: GanttColumnSize) => { - return ['small', 'normal', 'large'].includes(v); + return typeof v === 'number' || ['small', 'normal', 'large'].includes(v); } }, diff --git a/src/composables/useGanttWidth.ts b/src/composables/useGanttWidth.ts index 915d434..ee1063a 100644 --- a/src/composables/useGanttWidth.ts +++ b/src/composables/useGanttWidth.ts @@ -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]; }); diff --git a/src/typings/size.d.ts b/src/typings/size.d.ts index 16c6c3f..0f524a6 100644 --- a/src/typings/size.d.ts +++ b/src/typings/size.d.ts @@ -1 +1 @@ -declare type GanttColumnSize = 'small' | 'normal' | 'large'; +declare type GanttColumnSize = 'small' | 'normal' | 'large' | number;