diff --git a/packages/nc-gui/components/cell/Decimal.vue b/packages/nc-gui/components/cell/Decimal.vue index 92930c82fb..0263273dbd 100644 --- a/packages/nc-gui/components/cell/Decimal.vue +++ b/packages/nc-gui/components/cell/Decimal.vue @@ -35,14 +35,21 @@ const meta = computed(() => { const _vModel = useVModel(props, 'modelValue', emits) +function roundUpToPrecision(value: number, precision = 1) { + const factor = Math.pow(10, precision) + const roundedValue = Math.round(value * factor) / factor + + return roundedValue.toFixed(precision) +} + const displayValue = computed(() => { if (_vModel.value === null) return null if (isNaN(Number(_vModel.value))) return null - if (meta.value.isLocaleString) return (+Number(_vModel.value).toFixed(meta.value.precision ?? 1)).toLocaleString() + if (meta.value.isLocaleString) return roundUpToPrecision(Number(_vModel.value), meta.value.precision ?? 1).toLocaleString() - return Number(_vModel.value).toFixed(meta.value.precision ?? 1) + return roundUpToPrecision(Number(_vModel.value), meta.value.precision ?? 1) }) const vModel = computed({ diff --git a/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue b/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue index aca4c7b6f2..9a8570e40d 100644 --- a/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue +++ b/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue @@ -57,6 +57,8 @@ const isEditing = ref(false) const isCommentMode = ref(false) +const hoveredCommentId = ref(null) + async function onEditComment() { if (!isEditing.value || !editCommentValue.value?.comment) return @@ -196,6 +198,10 @@ watch(commentsWrapperEl, () => { }, }) scrollToComment(commentId as string) + + hoveredCommentId.value = commentId as string + + onClickOutside(document.querySelector(`.${hoveredCommentId.value}`)! as HTMLDivElement, handleResetHoverEffect) } else { scrollComments() } @@ -233,6 +239,12 @@ const editedAt = (comment: CommentType) => { } return '' } + +function handleResetHoverEffect() { + if (!hoveredCommentId.value) return + + hoveredCommentId.value = null +}