Browse Source

chore(gui-v2): fix types in Decimal, Integer, DeleteTable & SearchData

pull/3044/head
braks 2 years ago
parent
commit
3fa93d0354
  1. 9
      packages/nc-gui-v2/components/cell/Decimal.vue
  2. 3
      packages/nc-gui-v2/components/cell/Integer.vue
  3. 25
      packages/nc-gui-v2/components/smartsheet-toolbar/SearchData.vue
  4. 5
      packages/nc-gui-v2/components/smartsheet/sidebar/toolbar/DeleteTable.vue

9
packages/nc-gui-v2/components/cell/Decimal.vue

@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, inject, onMounted, ref } from '#imports' import type { VNodeRef } from '@vue/runtime-core'
import { inject, ref, useVModel } from '#imports'
import { EditModeInj } from '~/context' import { EditModeInj } from '~/context'
interface Props { interface Props {
@ -14,13 +15,11 @@ const props = defineProps<Props>()
const emits = defineEmits<Emits>() const emits = defineEmits<Emits>()
const editEnabled = inject<boolean>(EditModeInj) const editEnabled = inject(EditModeInj, ref(false))
const root = ref<HTMLInputElement>()
const vModel = useVModel(props, 'modelValue', emits) const vModel = useVModel(props, 'modelValue', emits)
const focus = (el: HTMLInputElement) => el?.focus() const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus()
</script> </script>
<template> <template>

3
packages/nc-gui-v2/components/cell/Integer.vue

@ -1,4 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import type { VNodeRef } from '@vue/runtime-core'
import { inject, ref, useVModel } from '#imports' import { inject, ref, useVModel } from '#imports'
import { EditModeInj } from '~/context' import { EditModeInj } from '~/context'
@ -18,7 +19,7 @@ const editEnabled = inject(EditModeInj, ref(false))
const vModel = useVModel(props, 'modelValue', emits) const vModel = useVModel(props, 'modelValue', emits)
const focus = (el: HTMLInputElement) => el?.focus() const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus()
function onKeyDown(evt: KeyboardEvent) { function onKeyDown(evt: KeyboardEvent) {
return evt.key === '.' && evt.preventDefault() return evt.key === '.' && evt.preventDefault()

25
packages/nc-gui-v2/components/smartsheet-toolbar/SearchData.vue

@ -1,14 +1,16 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useProvideSmartsheetStore, useSmartsheetStoreOrThrow } from '~/composables/useSmartsheetStore' import { computed, inject, ref, useArrayMap, useSmartsheetStoreOrThrow } from '#imports'
import { MetaInj, ReloadViewDataHookInj } from '~/context' import { ReloadViewDataHookInj } from '~/context'
import MdiSearchIcon from '~icons/mdi/magnify'
import MdiMenuDownIcon from '~icons/mdi/menu-down'
const reloadData = inject(ReloadViewDataHookInj) const reloadData = inject(ReloadViewDataHookInj)!
const { search, meta } = useSmartsheetStoreOrThrow()
const { search, meta } = useSmartsheetStoreOrThrow()!
// todo: where is this value supposed to come from? it's not in the store
const isDropdownOpen = ref(false)
const columns = computed(() => const columns = computed(() =>
meta?.value?.columns?.map((c) => ({ meta.value.columns?.map((c) => ({
value: c.id, value: c.id,
label: c.title, label: c.title,
})), })),
@ -21,12 +23,13 @@ const columns = computed(() =>
size="small" size="small"
class="max-w-[200px]" class="max-w-[200px]"
placeholder="Filter query" placeholder="Filter query"
@press-enter="reloadData.trigger()" @press-enter="reloadData.trigger(null)"
> >
<template #addonBefore> <template #addonBefore>
<div class="flex align-center relative" @click="isDropdownOpen = true"> <div class="flex align-center relative" @click="isDropdownOpen = true">
<MdiSearchIcon class="text-grey" /> <MdiMagnify class="text-grey" />
<MdiMenuDownIcon class="text-grey" /> <MdiMenuDown class="text-grey" />
<a-select <a-select
v-model:value="search.field" v-model:value="search.field"
size="small" size="small"
@ -39,5 +42,3 @@ const columns = computed(() =>
</template> </template>
</a-input> </a-input>
</template> </template>
<style scoped></style>

5
packages/nc-gui-v2/components/smartsheet/sidebar/toolbar/DeleteTable.vue

@ -1,9 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { inject, ref, useTable } from '#imports' import { inject, ref, useTable } from '#imports'
import { MetaInj, RightSidebarInj } from '~/context' import { MetaInj, RightSidebarInj } from '~/context'
import MdiDeleteIcon from '~icons/mdi/delete-outline'
const meta = inject(MetaInj) const meta = inject(MetaInj)!
const { deleteTable } = useTable() const { deleteTable } = useTable()
@ -15,7 +14,7 @@ const sidebarOpen = inject(RightSidebarInj, ref(true))
<template #title> {{ $t('activity.deleteTable') }} </template> <template #title> {{ $t('activity.deleteTable') }} </template>
<div class="nc-sidebar-right-item hover:after:bg-red-500 group"> <div class="nc-sidebar-right-item hover:after:bg-red-500 group">
<MdiDeleteIcon class="group-hover:(!text-white)" @click="deleteTable(meta)" /> <MdiDeleteOutline class="group-hover:(!text-white)" @click="deleteTable(meta)" />
</div> </div>
</a-tooltip> </a-tooltip>
</template> </template>

Loading…
Cancel
Save