Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/expanded record ux #7298

Merged
merged 22 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e40ed4e
fix: disable input field after Enter key is pressed
rameshmane7218 Dec 25, 2023
e8424af
fix: tab navigation and focus outline issue
rameshmane7218 Dec 25, 2023
ffcf847
fix: number input up-down button should be hidden
rameshmane7218 Dec 25, 2023
4bce0c5
fix: form view double border issue
rameshmane7218 Dec 25, 2023
cba6af4
fix: input field double border issue of shared form
rameshmane7218 Dec 25, 2023
e6a60e9
fix: long/rich text field default value issue in form view
rameshmane7218 Dec 25, 2023
8e7aaf8
fix: field alignment issue in expanded form
rameshmane7218 Dec 26, 2023
e3e3e7d
fix: lint errors
rameshmane7218 Dec 26, 2023
04b55f5
fix: form field alignment issue
rameshmane7218 Dec 26, 2023
5309785
Merge branch 'develop' into fix/expanded-record-ux
rameshmane7218 Dec 27, 2023
9116bb7
fix: comment input focus issue after saving comment
rameshmane7218 Dec 27, 2023
c17860b
fix: checkbox toggle issue on pressing enter key
rameshmane7218 Dec 27, 2023
4f4a071
fix: percent field text select on focus issue
rameshmane7218 Dec 27, 2023
291532a
fix: review changes
rameshmane7218 Dec 27, 2023
42fcaa4
fix: text area exapnd on enter keypress in form
rameshmane7218 Dec 28, 2023
44754e1
fix: tab focus issue in shared form and expanded form
rameshmane7218 Dec 28, 2023
466049f
fix: expanded comment input focus issue
rameshmane7218 Dec 28, 2023
a5fd82d
fix: review changes
rameshmane7218 Dec 28, 2023
d12a187
fix: review changes of select dropdown fields
rameshmane7218 Dec 29, 2023
51954f1
fix: form submit button focus css issue
rameshmane7218 Dec 29, 2023
937ac53
fix: review changes
rameshmane7218 Dec 29, 2023
37ab476
fix: added missing line break
rameshmane7218 Dec 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/nc-gui/components/cell/Checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ useSelectedCellKeyupListener(active, (e) => {

<template>
<div
class="flex cursor-pointer w-full h-full items-center focus:outline-transparent"
class="flex cursor-pointer w-full h-full items-center focus:outline-none"
:class="{
'w-full flex-start pl-2': isForm || isGallery || isExpandedFormOpen,
'w-full justify-center': !isForm && !isGallery && !isExpandedFormOpen,
Expand All @@ -97,7 +97,7 @@ useSelectedCellKeyupListener(active, (e) => {
}"
tabindex="0"
@click="onClick(false, $event)"
@keydown.enter.stop="onClick(false, $event)"
@keydown.enter.stop="onClick(true, $event)"
>
<div
class="flex items-center"
Expand Down
19 changes: 18 additions & 1 deletion packages/nc-gui/components/cell/Currency.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ onMounted(() => {
:ref="focus"
v-model="vModel"
type="number"
class="w-full h-full text-sm border-none rounded-md outline-none focus:outline-transparent focus:ring-0"
class="w-full h-full text-sm border-none rounded-md px-0 py-1 outline-none focus:outline-none focus:ring-0"
:class="{
'!px-2': isExpandedFormOpen,
}"
wingkwong marked this conversation as resolved.
Show resolved Hide resolved
:placeholder="isEditColumn ? $t('labels.optional') : ''"
@blur="submitCurrency"
@keydown.down.stop
Expand All @@ -99,3 +102,17 @@ onMounted(() => {
<!-- possibly unexpected string / null with showNull == false -->
<span v-else />
</template>

<style lang="scss" scoped>
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}

/* Firefox */
input[type='number'] {
-moz-appearance: textfield;
}
</style>
7 changes: 5 additions & 2 deletions packages/nc-gui/components/cell/DatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
ColumnInj,
EditColumnInj,
EditModeInj,
IsExpandedFormOpenInj,
ReadonlyInj,
computed,
inject,
Expand Down Expand Up @@ -41,6 +42,8 @@ const readOnly = inject(ReadonlyInj, ref(false))

const isEditColumn = inject(EditColumnInj, ref(false))

const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))

const active = inject(ActiveCellInj, ref(false))

const editable = inject(EditModeInj, ref(false))
Expand Down Expand Up @@ -240,8 +243,8 @@ const clickHandler = () => {
:picker="picker"
tabindex="0"
:bordered="false"
class="!w-full !px-1 !border-none"
:class="{ 'nc-null': modelValue === null && showNull }"
class="!w-full !py-1 !border-none"
:class="{ 'nc-null': modelValue === null && showNull, '!px-2': isExpandedFormOpen, '!px-0': !isExpandedFormOpen }"
:format="dateFormat"
:placeholder="placeholder"
:allow-clear="!readOnly && !localState && !isPk"
Expand Down
7 changes: 5 additions & 2 deletions packages/nc-gui/components/cell/DateTimePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
CellClickHookInj,
ColumnInj,
EditColumnInj,
IsExpandedFormOpenInj,
ReadonlyInj,
inject,
isDrawerOrModalExist,
Expand Down Expand Up @@ -39,6 +40,8 @@ const { t } = useI18n()

const isEditColumn = inject(EditColumnInj, ref(false))

const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))

const column = inject(ColumnInj)!

const isDateInvalid = ref(false)
Expand Down Expand Up @@ -293,8 +296,8 @@ const isColDisabled = computed(() => {
:disabled="isColDisabled"
:show-time="true"
:bordered="false"
class="!w-full !px-0 !py-1 !border-none"
:class="{ 'nc-null': modelValue === null && showNull }"
class="!w-full !py-1 !border-none"
:class="{ 'nc-null': modelValue === null && showNull, '!px-2': isExpandedFormOpen, '!px-0': !isExpandedFormOpen }"
:format="dateTimeFormat"
:placeholder="placeholder"
:allow-clear="!readOnly && !localState && !isPk"
Expand Down
5 changes: 4 additions & 1 deletion packages/nc-gui/components/cell/Decimal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ watch(isExpandedFormOpen, () => {
v-if="editEnabled"
:ref="focus"
v-model="vModel"
class="outline-none !py-2 !px-1 border-none rounded-md w-full h-full !text-sm"
class="outline-none px-0 py-1 border-none rounded-md w-full h-full !text-sm"
:class="{
'!px-2': isExpandedFormOpen,
}"
type="number"
:step="precision"
:placeholder="isEditColumn ? $t('labels.optional') : ''"
Expand Down
6 changes: 4 additions & 2 deletions packages/nc-gui/components/cell/Duration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ const focus: VNodeRef = (el) => !isExpandedFormOpen.value && !isEditColumn.value
v-if="editEnabled"
:ref="focus"
v-model="localState"
class="w-full !border-none !outline-none p-0"
:class="{ '!px-2 !py-1': editEnabled }"
class="w-full !border-none !outline-none px-0 py-1"
:class="{
'!px-2': isExpandedFormOpen,
}"
:placeholder="durationPlaceholder"
@blur="submitDuration"
@keypress="checkDurationFormat($event)"
Expand Down
5 changes: 4 additions & 1 deletion packages/nc-gui/components/cell/Email.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ watch(
v-if="editEnabled"
:ref="focus"
v-model="vModel"
class="w-full outline-none text-sm px-1 py-2"
class="w-full outline-none text-sm px-0 py-1"
:class="{
'!px-2': isExpandedFormOpen,
}"
:placeholder="isEditColumn ? $t('labels.optional') : ''"
@blur="editEnabled = false"
@keydown.down.stop
Expand Down
19 changes: 16 additions & 3 deletions packages/nc-gui/components/cell/GeoData.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import type { GeoLocationType } from 'nocodb-sdk'
import { Modal as AModal, iconMap, latLongToJoinedString, useVModel } from '#imports'
import { Modal as AModal, IsExpandedFormOpenInj, iconMap, latLongToJoinedString, useVModel } from '#imports'

interface Props {
modelValue?: string | null
Expand All @@ -16,6 +16,8 @@ const emits = defineEmits<Emits>()

const vModel = useVModel(props, 'modelValue', emits)

const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))

const isExpanded = ref(false)

const isLoading = ref(false)
Expand Down Expand Up @@ -86,7 +88,8 @@ const openInOSM = () => {
<a-dropdown :is="isExpanded ? AModal : 'div'" v-model:visible="isExpanded" :trigger="['click']">
<div
v-if="!isLocationSet"
class="group cursor-pointer flex gap-1 items-center mx-auto max-w-64 justify-center active:(ring ring-accent ring-opacity-100) rounded border-1 p-1 shadow-sm hover:(bg-primary bg-opacity-10) dark:(!bg-slate-500)"
class="group cursor-pointer flex gap-1 items-center mx-auto max-w-64 justify-center active:(ring ring-accent ring-opacity-100) rounded border-1 p-1 shadow-sm hover:(bg-primary bg-opacity-10) dark:(!bg-slate-500) my-1"
tabindex="0"
>
<div class="flex items-center gap-2" data-testid="nc-geo-data-set-location-button">
<component
Expand All @@ -98,7 +101,17 @@ const openInOSM = () => {
</div>
</div>
</div>
<div v-else data-testid="nc-geo-data-lat-long-set">{{ latLongStr }}</div>
<div
v-else
data-testid="nc-geo-data-lat-long-set"
tabindex="0"
class="h-full w-full flex items-center py-1 focus-visible:!outline-none focus:!outline-none"
:class="{
'px-2': isExpandedFormOpen,
}"
>
{{ latLongStr }}
</div>
<template #overlay>
<a-form :model="formState" class="flex flex-col w-max-64 border-1 border-gray-200" @finish="handleFinish">
<a-form-item>
Expand Down
6 changes: 3 additions & 3 deletions packages/nc-gui/components/cell/Integer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ function onKeyDown(e: any) {
v-if="editEnabled"
:ref="focus"
v-model="vModel"
class="outline-none py-2 px-1 border-none w-full h-full text-sm"
type="number"
class="outline-none px-0 py-1 border-none w-full h-full text-sm"
:class="{
'pl-2': isExpandedFormOpen,
'!px-2': isExpandedFormOpen,
}"
type="number"
style="letter-spacing: 0.06rem"
:placeholder="isEditColumn ? $t('labels.optional') : ''"
@blur="editEnabled = false"
Expand Down
8 changes: 7 additions & 1 deletion packages/nc-gui/components/cell/MultiSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ColumnInj,
EditColumnInj,
EditModeInj,
IsExpandedFormOpenInj,
IsKanbanInj,
ReadonlyInj,
RowHeightInj,
Expand Down Expand Up @@ -63,6 +64,8 @@ const isEditColumn = inject(EditColumnInj, ref(false))

const rowHeight = inject(RowHeightInj, ref(undefined))

const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))!

const selectedIds = ref<string[]>([])

const aselect = ref<typeof AntSelect>()
Expand Down Expand Up @@ -355,6 +358,9 @@ const onFocus = () => {
<div
v-if="!active"
class="flex flex-wrap"
:class="{
'!px-2': isExpandedFormOpen,
}"
:style="{
'display': '-webkit-box',
'max-width': '100%',
Expand Down Expand Up @@ -407,7 +413,7 @@ const onFocus = () => {
:show-arrow="editAllowed && !readOnly"
:open="isOpen && editAllowed"
:disabled="readOnly || !editAllowed"
:class="{ 'caret-transparent': !hasEditRoles }"
:class="{ 'caret-transparent': !hasEditRoles, '!px-2': isExpandedFormOpen }"
:dropdown-class-name="`nc-dropdown-multi-select-cell !min-w-200px ${isOpen ? 'active' : ''}`"
@search="search"
@keydown="onKeyDown"
Expand Down
23 changes: 20 additions & 3 deletions packages/nc-gui/components/cell/Percent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const onWrapperFocus = () => {

nextTick(() => {
wrapperRef.value?.querySelector('input')?.focus()
wrapperRef.value?.querySelector('input')?.select()
})
}

Expand Down Expand Up @@ -117,11 +118,13 @@ const onTabPress = (e: KeyboardEvent) => {
@focus="onWrapperFocus"
>
<input
v-if="(!isExpandedFormOpen && editEnabled) || (isExpandedFormOpen && expandedEditEnabled)"
v-if="editEnabled"
:ref="focus"
v-model="vModel"
class="w-full !text-sm !border-none !outline-none focus:ring-0 text-base p-1"
:class="{ '!px-2': editEnabled }"
class="w-full !text-sm !border-none !outline-none focus:ring-0 text-base px-0 py-1"
:class="{
'!px-2': isExpandedFormOpen,
}"
type="number"
:placeholder="isEditColumn ? $t('labels.optional') : ''"
@blur="onBlur"
Expand Down Expand Up @@ -150,3 +153,17 @@ const onTabPress = (e: KeyboardEvent) => {
<span v-else>{{ vModel }}&nbsp;</span>
</div>
</template>

<style lang="scss" scoped>
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}

/* Firefox */
input[type='number'] {
-moz-appearance: textfield;
}
</style>
5 changes: 4 additions & 1 deletion packages/nc-gui/components/cell/PhoneNumber.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ watch(
v-if="editEnabled"
:ref="focus"
v-model="vModel"
class="w-full outline-none text-sm px-1 py-2"
class="w-full outline-none text-sm px-0 py-1"
:class="{
'!px-2': isExpandedFormOpen,
}"
:placeholder="isEditColumn ? $t('labels.optional') : ''"
@blur="editEnabled = false"
@keydown.down.stop
Expand Down
14 changes: 12 additions & 2 deletions packages/nc-gui/components/cell/Rating.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<script setup lang="ts">
import { ActiveCellInj, ColumnInj, computed, inject, parseProp, useSelectedCellKeyupListener } from '#imports'
import {
ActiveCellInj,
ColumnInj,
IsExpandedFormOpenInj,
computed,
inject,
parseProp,
useSelectedCellKeyupListener,
} from '#imports'

interface Props {
modelValue?: number | null | undefined
Expand All @@ -13,6 +21,8 @@ const column = inject(ColumnInj)!

const readonly = inject(ReadonlyInj, ref(false))

const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))!

const ratingMeta = computed(() => {
return {
icon: {
Expand Down Expand Up @@ -65,7 +75,7 @@ watch(rateDomRef, () => {
v-model:value="vModel"
:disabled="readonly"
:count="ratingMeta.max"
:style="`color: ${ratingMeta.color}; padding: 0px 5px`"
:style="`color: ${ratingMeta.color}; padding: ${isExpandedFormOpen ? '0px 8px' : '0px 5px'};`"
@keydown="onKeyPress"
>
<template #character>
Expand Down
3 changes: 2 additions & 1 deletion packages/nc-gui/components/cell/RichText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,12 @@ watch(editorDom, () => {

<template>
<div
class="h-full"
class="h-full focus:!outline-none focus-visible:!outline-none"
wingkwong marked this conversation as resolved.
Show resolved Hide resolved
:class="{
'flex flex-col flex-grow nc-rich-text-full': props.fullMode,
'nc-rich-text-embed flex flex-col pl-1 w-full': !props.fullMode,
}"
tabindex="0"
>
<div v-if="props.showMenu" class="absolute top-0 right-0.5">
<CellRichTextSelectedBubbleMenu v-if="editor" :editor="editor" embed-mode />
Expand Down
13 changes: 11 additions & 2 deletions packages/nc-gui/components/cell/SingleSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ColumnInj,
EditColumnInj,
EditModeInj,
IsExpandedFormOpenInj,
IsFormInj,
IsKanbanInj,
ReadonlyInj,
Expand Down Expand Up @@ -47,6 +48,8 @@ const activeCell = inject(ActiveCellInj, ref(false))

const isForm = inject(IsFormInj, ref(false))

const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))!

// use both ActiveCellInj or EditModeInj to determine the active state
// since active will be false in case of form view
const active = computed(() => activeCell.value || isEditable.value || isForm.value)
Expand Down Expand Up @@ -276,7 +279,13 @@ const onFocus = () => {
@click="toggleMenu"
@keydown.enter.stop.prevent="toggleMenu"
>
<div v-if="!(active || isEditable)" class="w-full">
<div
v-if="!(active || isEditable)"
class="w-full"
:class="{
'!px-2': isExpandedFormOpen,
Copy link
Member

Choose a reason for hiding this comment

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

most of the time, you don't need ! for div. please double check. (apply to all)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

}"
>
<a-tag v-if="selectedOpt" class="rounded-tag max-w-full" :color="selectedOpt.color">
<span
:style="{
Expand Down Expand Up @@ -311,7 +320,7 @@ const onFocus = () => {
ref="aselect"
v-model:value="vModel"
class="w-full overflow-hidden xs:min-h-12"
:class="{ 'caret-transparent': !hasEditRoles }"
:class="{ 'caret-transparent': !hasEditRoles, '!px-2': isExpandedFormOpen }"
:placeholder="isEditColumn ? $t('labels.optional') : ''"
:allow-clear="!column.rqd && editAllowed"
:bordered="false"
Expand Down
6 changes: 3 additions & 3 deletions packages/nc-gui/components/cell/Text.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ const focus: VNodeRef = (el) => !isExpandedFormOpen.value && !isEditColumn.value
v-if="!readonly && editEnabled"
:ref="focus"
v-model="vModel"
class="h-full w-full outline-none p-2 bg-transparent"
:placeholder="isEditColumn ? $t('labels.optional') : ''"
class="h-full w-full outline-none py-1 bg-transparent"
:class="{
'px-1': isExpandedFormOpen,
'px-2': isExpandedFormOpen,
}"
:placeholder="isEditColumn ? $t('labels.optional') : ''"
@blur="editEnabled = false"
@keydown.down.stop
@keydown.left.stop
Expand Down