Skip to content

Commit

Permalink
fix(nc-gui): hide form field label if field title & label is same
Browse files Browse the repository at this point in the history
  • Loading branch information
rameshmane7218 committed Mar 27, 2024
1 parent 1ec1745 commit fad61b1
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/nc-gui/components/smartsheet/Form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ function setFormData() {
localColumns.value = col
.filter((f) => !hiddenColTypes.includes(f.uidt) && !systemFieldsIds.value.includes(f.fk_column_id))
.sort((a, b) => a.order - b.order)
.map((c) => ({ ...c, label: c.label || c.title, required: !!c.required }))
.map((c) => ({ ...c, required: !!c.required }))
}
function isRequired(_columnObj: Record<string, any>, required = false) {
Expand Down Expand Up @@ -643,6 +643,16 @@ const onFocusActiveFieldLabel = (e: FocusEvent) => {
;(e.target as HTMLTextAreaElement).select()
}
const updateFieldTitle = (value: string) => {
if (!activeField.value) return
if (activeField.value.title === value) {
activeField.value.label = null
} else {
activeField.value.label = value
}
}
const updateSelectFieldLayout = (value: boolean) => {
if (!activeField.value) return
Expand Down Expand Up @@ -1360,7 +1370,7 @@ useEventListener(
<a-textarea
ref="focusLabel"
v-model:value="activeField.label"
:value="activeField.label || activeField.title"
:rows="1"
auto-size
hide-details
Expand All @@ -1369,6 +1379,7 @@ useEventListener(
:placeholder="$t('msg.info.formInput')"
@focus="onFocusActiveFieldLabel"
@keydown.enter.prevent
@update:value="updateFieldTitle"
@change="updateColMeta(activeField)"
/>
Expand Down

1 comment on commit fad61b1

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR changes have been deployed. Please run the following command to verify:

docker run -d -p 8888:8080 nocodb/nocodb-timely:0.204.9-pr-7979-20240327-0600

Please sign in to comment.