Browse Source

Merge pull request #4099 from nocodb/fix/dark-mode-survey

pull/4181/head
Braks 2 years ago committed by GitHub
parent
commit
ef96178dd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      packages/nc-gui/components/smartsheet/toolbar/ShareView.vue
  2. 2
      packages/nc-gui/composables/useMultiSelect/index.ts
  3. 3
      packages/nc-gui/composables/useViewData.ts
  4. 33
      packages/nc-gui/pages/[projectType]/form/[viewId]/index.vue
  5. 10
      packages/nc-gui/pages/[projectType]/form/[viewId]/index/survey.vue

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

@ -43,7 +43,7 @@ const shared = ref<SharedView>({ id: '', meta: {}, password: undefined })
const transitionDuration = computed({ const transitionDuration = computed({
get: () => shared.value.meta.transitionDuration || 250, get: () => shared.value.meta.transitionDuration || 250,
set: (duration) => { set: (duration) => {
shared.value.meta = { ...shared.value.meta, transitionDuration: duration } shared.value.meta = { ...shared.value.meta, transitionDuration: duration > 5000 ? 5000 : duration }
}, },
}) })

2
packages/nc-gui/composables/useMultiSelect/index.ts

@ -14,7 +14,7 @@ export function useMultiSelect(
fields: MaybeRef<any[]>, fields: MaybeRef<any[]>,
data: MaybeRef<any[]>, data: MaybeRef<any[]>,
editEnabled: MaybeRef<boolean>, editEnabled: MaybeRef<boolean>,
isPkAvail: MaybeRef<boolean>, isPkAvail: MaybeRef<boolean | undefined>,
clearCell: Function, clearCell: Function,
makeEditable: Function, makeEditable: Function,
scrollToActiveCell?: (row?: number | null, col?: number | null) => void, scrollToActiveCell?: (row?: number | null, col?: number | null) => void,

3
packages/nc-gui/composables/useViewData.ts

@ -202,7 +202,6 @@ export function useViewData(
async function insertRow( async function insertRow(
currentRow: Row, currentRow: Row,
_rowIndex = formattedData.value?.length,
ltarState: Record<string, any> = {}, ltarState: Record<string, any> = {},
{ metaValue = meta.value, viewMetaValue = viewMeta.value }: { metaValue?: TableType; viewMetaValue?: ViewType } = {}, { metaValue = meta.value, viewMetaValue = viewMeta.value }: { metaValue?: TableType; viewMetaValue?: ViewType } = {},
) { ) {
@ -301,7 +300,7 @@ export function useViewData(
await until(() => !(row.rowMeta?.new && row.rowMeta?.saving)).toMatch((v) => v) await until(() => !(row.rowMeta?.new && row.rowMeta?.saving)).toMatch((v) => v)
if (row.rowMeta.new) { if (row.rowMeta.new) {
return await insertRow(row, formattedData.value.indexOf(row), ltarState, args) return await insertRow(row, ltarState, args)
} else { } else {
await updateRowProperty(row, property!, args) await updateRowProperty(row, property!, args)
} }

33
packages/nc-gui/pages/[projectType]/form/[viewId]/index.vue

@ -69,6 +69,8 @@ p {
.nc-form-view { .nc-form-view {
.nc-cell { .nc-cell {
@apply bg-white dark:bg-slate-500;
&.nc-cell-checkbox { &.nc-cell-checkbox {
@apply color-transition !border-0; @apply color-transition !border-0;
@ -91,7 +93,20 @@ p {
&.nc-input { &.nc-input {
@apply w-full rounded p-2 min-h-[40px] flex items-center border-solid border-1 border-gray-300 dark:border-slate-200; @apply w-full rounded p-2 min-h-[40px] flex items-center border-solid border-1 border-gray-300 dark:border-slate-200;
.duration-cell-wrapper {
@apply w-full;
input {
@apply !outline-none;
&::placeholder {
@apply text-gray-400 dark:text-slate-300;
}
}
}
input, input,
textarea,
&.nc-virtual-cell, &.nc-virtual-cell,
> div { > div {
@apply bg-white dark:(bg-slate-500 text-white); @apply bg-white dark:(bg-slate-500 text-white);
@ -104,12 +119,24 @@ p {
@apply dark:(bg-slate-700 text-white); @apply dark:(bg-slate-700 text-white);
} }
} }
}
.nc-attachment-cell > div { &.nc-cell-longtext {
@apply dark:(bg-slate-100); @apply !p-0 pb-2px pr-2px;
}
textarea {
@apply px-4 py-2 rounded;
&:focus {
box-shadow: none !important;
}
}
} }
} }
.nc-attachment-cell > div {
@apply dark:(bg-slate-100);
}
} }
} }

10
packages/nc-gui/pages/[projectType]/form/[viewId]/index/survey.vue

@ -159,6 +159,12 @@ function resetForm() {
goTo(steps.value[0]) goTo(steps.value[0])
} }
function submit() {
if (submitted.value) return
submitForm()
}
onReset(resetForm) onReset(resetForm)
onKeyStroke(['ArrowLeft', 'ArrowDown'], () => { onKeyStroke(['ArrowLeft', 'ArrowDown'], () => {
@ -169,7 +175,7 @@ onKeyStroke(['ArrowRight', 'ArrowUp'], () => {
}) })
onKeyStroke(['Enter', 'Space'], () => { onKeyStroke(['Enter', 'Space'], () => {
if (isLast.value) { if (isLast.value) {
submitForm() submit()
} else { } else {
goNext(AnimationTarget.OkButton) goNext(AnimationTarget.OkButton)
} }
@ -289,7 +295,7 @@ onMounted(() => {
type="submit" type="submit"
class="uppercase scaling-btn prose-sm" class="uppercase scaling-btn prose-sm"
data-cy="nc-survey-form__btn-submit" data-cy="nc-survey-form__btn-submit"
@click="submitForm" @click="submit"
> >
{{ $t('general.submit') }} {{ $t('general.submit') }}
</button> </button>

Loading…
Cancel
Save