From c347878f237ef1e6fe5c47a2d7cd157f1826d89c Mon Sep 17 00:00:00 2001 From: QiShaoXuan Date: Wed, 3 Aug 2022 18:02:28 +0800 Subject: [PATCH] refactor: improves readability --- libs/components/editor-core/src/kanban/atom.ts | 8 ++++---- .../editor-core/src/recast-block/property.ts | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libs/components/editor-core/src/kanban/atom.ts b/libs/components/editor-core/src/kanban/atom.ts index cc69aff7e8..1a2db8ea90 100644 --- a/libs/components/editor-core/src/kanban/atom.ts +++ b/libs/components/editor-core/src/kanban/atom.ts @@ -57,15 +57,15 @@ const isValueBelongOption = ( option: KanbanGroup ) => { switch (propertyValue.type) { - case PropertyType.Select: { + case PropertyType.Select || PropertyType.Status: { return propertyValue.value === option.id; } case PropertyType.MultiSelect: { return propertyValue.value.some(i => i === option.id); } - case PropertyType.Status: { - return propertyValue.value === option.id; - } + // case PropertyType.Status: { + // return propertyValue.value === option.id; + // } // case PropertyType.Text: { // TOTODO:DO support this type // } diff --git a/libs/components/editor-core/src/recast-block/property.ts b/libs/components/editor-core/src/recast-block/property.ts index 7d63eeff4c..e6a5caa6de 100644 --- a/libs/components/editor-core/src/recast-block/property.ts +++ b/libs/components/editor-core/src/recast-block/property.ts @@ -276,12 +276,12 @@ export const getRecastItemValue = (block: RecastItem | AsyncBlock) => { const isSelectLikeProperty = ( metaProperty?: RecastMetaProperty -): metaProperty is SelectProperty | MultiSelectProperty => { - return !( - !metaProperty || - (metaProperty.type !== PropertyType.Status && - metaProperty.type !== PropertyType.Select && - metaProperty.type !== PropertyType.MultiSelect) +): metaProperty is SelectProperty | MultiSelectProperty | StatusProperty => { + return ( + metaProperty && + (metaProperty.type === PropertyType.Status || + metaProperty.type === PropertyType.Select || + metaProperty.type === PropertyType.MultiSelect) ); };