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

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

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

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

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

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

@ -1,9 +1,8 @@
<script setup lang="ts">
import { inject, ref, useTable } from '#imports'
import { MetaInj, RightSidebarInj } from '~/context'
import MdiDeleteIcon from '~icons/mdi/delete-outline'
const meta = inject(MetaInj)
const meta = inject(MetaInj)!
const { deleteTable } = useTable()
@ -15,7 +14,7 @@ const sidebarOpen = inject(RightSidebarInj, ref(true))
<template #title> {{ $t('activity.deleteTable') }} </template>
<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>
</a-tooltip>
</template>

Loading…
Cancel
Save