Browse Source

feat(gui): focus first input in expanded form

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4445/head
Pranav C 2 years ago
parent
commit
8072c40c06
  1. 10
      packages/nc-gui/assets/style.scss
  2. 4
      packages/nc-gui/components/cell/Text.vue
  3. 2
      packages/nc-gui/components/dlg/ViewCreate.vue
  4. 13
      packages/nc-gui/components/smartsheet/Grid.vue
  5. 10
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  6. 9
      packages/nc-gui/components/smartsheet/toolbar/ShareView.vue
  7. 6
      packages/nc-gui/pages/index/index/index.vue

10
packages/nc-gui/assets/style.scss

@ -214,17 +214,13 @@ a {
@apply z-1 relative color-transition rounded-md px-4 py-2 text-white; @apply z-1 relative color-transition rounded-md px-4 py-2 text-white;
&::after { &::after {
@apply ring-opacity-100 ring-[2px] ring-slate-300 rounded absolute top-0 left-0 right-0 bottom-0 transition-all duration-150 ease-in-out bg-primary bg-opacity-100; @apply rounded absolute top-0 left-0 right-0 bottom-0 transition-all duration-150 ease-in-out bg-primary bg-opacity-100;
content: ''; content: '';
z-index: -1; z-index: -1;
} }
&:hover::after { &:hover::after {
@apply transform scale-110 ring ring-accent; @apply transform scale-110 ;
}
&:active::after {
@apply ring ring-accent;
} }
} }
@ -261,7 +257,7 @@ a {
} }
.ant-dropdown-menu-item, .ant-menu-item { .ant-dropdown-menu-item, .ant-menu-item {
@apply !py-0 active:(ring ring-accent ring-opacity-100); @apply !py-0;
} }
.ant-dropdown-menu-title-content, .ant-dropdown-menu-title-content,

4
packages/nc-gui/components/cell/Text.vue

@ -16,7 +16,9 @@ const readonly = inject(ReadonlyInj, ref(false))
const vModel = useVModel(props, 'modelValue', emits) const vModel = useVModel(props, 'modelValue', emits)
const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus() const focus: VNodeRef = (el) => {
;(el as HTMLInputElement)?.focus()
}
</script> </script>
<template> <template>

2
packages/nc-gui/components/dlg/ViewCreate.vue

@ -184,7 +184,7 @@ async function onSubmit() {
<template> <template>
<a-modal v-model:visible="vModel" class="!top-[35%]" :confirm-loading="loading" wrap-class-name="nc-modal-view-create"> <a-modal v-model:visible="vModel" class="!top-[35%]" :confirm-loading="loading" wrap-class-name="nc-modal-view-create">
<template #title> <template #title>
{{ $t(`general.${selectedViewId ? 'duplicate' : 'create'}`) }} <span class="text-capitalize">{{ typeAlias }}</span> {{ $t(`general.${selectedViewId ? 'duplicate' : 'create'}`) }} <span class="capitalize">{{ typeAlias }}</span>
{{ $t('objects.view') }} {{ $t('objects.view') }}
</template> </template>

13
packages/nc-gui/components/smartsheet/Grid.vue

@ -850,8 +850,7 @@ watch(
text-overflow: ellipsis; text-overflow: ellipsis;
} }
td.active::after, td.active::after {
td.active::before {
content: ''; content: '';
position: absolute; position: absolute;
z-index: 3; z-index: 3;
@ -864,12 +863,14 @@ watch(
// todo: replace with css variable // todo: replace with css variable
td.active::after { td.active::after {
@apply border-2 border-solid border-primary; @apply border-2 border-solid text-primary border-current bg-primary bg-opacity-5;
} }
td.active::before { //td.active::before {
@apply bg-primary bg-opacity-5; // content: '';
} // z-index:4;
// @apply absolute !w-[10px] !h-[10px] !right-[-5px] !bottom-[-5px] bg-primary;
//}
} }
:deep { :deep {

10
packages/nc-gui/components/smartsheet/expanded-form/index.vue

@ -121,6 +121,12 @@ if (isKanban.value) {
} }
} }
} }
const cellWrapperEl = (wrapperEl: HTMLElement) => {
nextTick(() => {
;(wrapperEl?.querySelector('input,select,textarea') as HTMLInputElement)?.focus()
})
}
</script> </script>
<script lang="ts"> <script lang="ts">
@ -146,7 +152,7 @@ export default {
<div class="flex-1 overflow-auto scrollbar-thin-dull nc-form-fields-container"> <div class="flex-1 overflow-auto scrollbar-thin-dull nc-form-fields-container">
<div class="w-[500px] mx-auto"> <div class="w-[500px] mx-auto">
<div <div
v-for="col of fields" v-for="(col, i) of fields"
v-show="!isVirtualCol(col) || !isNew || col.uidt === UITypes.LinkToAnotherRecord" v-show="!isVirtualCol(col) || !isNew || col.uidt === UITypes.LinkToAnotherRecord"
:key="col.title" :key="col.title"
class="mt-2 py-2" class="mt-2 py-2"
@ -157,7 +163,7 @@ export default {
<LazySmartsheetHeaderCell v-else :column="col" /> <LazySmartsheetHeaderCell v-else :column="col" />
<div class="!bg-white rounded px-1 min-h-[35px] flex items-center mt-2"> <div :ref="i ? null : cellWrapperEl" class="!bg-white rounded px-1 min-h-[35px] flex items-center mt-2">
<LazySmartsheetVirtualCell v-if="isVirtualCol(col)" v-model="row.row[col.title]" :row="row" :column="col" /> <LazySmartsheetVirtualCell v-if="isVirtualCol(col)" v-model="row.row[col.title]" :row="row" :column="col" />
<LazySmartsheetCell <LazySmartsheetCell

9
packages/nc-gui/components/smartsheet/toolbar/ShareView.vue

@ -5,12 +5,12 @@ import tinycolor from 'tinycolor2'
import { import {
computed, computed,
extractSdkResponseErrorMsg, extractSdkResponseErrorMsg,
isRtlLang,
message, message,
projectThemeColors, projectThemeColors,
ref, ref,
useCopy, useCopy,
useDashboard, useDashboard,
isRtlLang,
useI18n, useI18n,
useNuxtApp, useNuxtApp,
useProject, useProject,
@ -196,7 +196,6 @@ watch(passwordProtected, (value) => {
const { locale } = useI18n() const { locale } = useI18n()
const isRtl = computed(() => isRtlLang(locale.value as any)) const isRtl = computed(() => isRtlLang(locale.value as any))
</script> </script>
<template> <template>
@ -234,8 +233,7 @@ const isRtl = computed(() => isRtlLang(locale.value as any))
<MdiOpenInNew class="text-sm text-gray-500 mt-2" /> <MdiOpenInNew class="text-sm text-gray-500 mt-2" />
</a> </a>
<MdiContentCopy v-e="['c:view:share:copy-url']" class="text-gray-500 text-sm cursor-pointer" <MdiContentCopy v-e="['c:view:share:copy-url']" class="text-gray-500 text-sm cursor-pointer" @click="copyLink" />
@click="copyLink" />
</div> </div>
<div class="px-1 mt-2 flex flex-col gap-3"> <div class="px-1 mt-2 flex flex-col gap-3">
@ -312,8 +310,7 @@ const isRtl = computed(() => isRtlLang(locale.value as any))
" "
> >
<!-- Allow Download --> <!-- Allow Download -->
<a-checkbox v-model:checked="allowCSVDownload" data-testid="nc-modal-share-view__with-csv-download" <a-checkbox v-model:checked="allowCSVDownload" data-testid="nc-modal-share-view__with-csv-download" class="!text-sm">
class="!text-sm">
{{ $t('labels.downloadAllowed') }} {{ $t('labels.downloadAllowed') }}
</a-checkbox> </a-checkbox>
</div> </div>

6
packages/nc-gui/pages/index/index/index.vue

@ -316,11 +316,7 @@ const copyProjectMeta = async () => {
} }
&:hover::after { &:hover::after {
@apply transform scale-110 ring ring-accent; @apply transform scale-110;
}
&:active::after {
@apply ring ring-accent;
} }
} }

Loading…
Cancel
Save