Browse Source

chore(nc-gui): lint

pull/4031/head
braks 2 years ago
parent
commit
e57eae722c
  1. 3
      packages/nc-gui/components/cell/MultiSelect.vue
  2. 6
      packages/nc-gui/components/smartsheet/sidebar/MenuBottom.vue
  3. 7
      packages/nc-gui/components/smartsheet/sidebar/index.vue
  4. 13
      packages/nc-gui/composables/useDialog/index.ts
  5. 14
      packages/nc-gui/composables/useViews.ts

3
packages/nc-gui/components/cell/MultiSelect.vue

@ -1,8 +1,7 @@
<script lang="ts" setup>
import tinycolor from 'tinycolor2'
import type { Select as AntSelect } from 'ant-design-vue'
import { SelectOptionType } from 'nocodb-sdk'
import type { SelectOptionsType } from 'nocodb-sdk'
import type { SelectOptionType, SelectOptionsType } from 'nocodb-sdk'
import {
ActiveCellInj,
ColumnInj,

6
packages/nc-gui/components/smartsheet/sidebar/MenuBottom.vue

@ -1,6 +1,6 @@
<script lang="ts" setup>
import { ViewTypes } from 'nocodb-sdk'
import { useNuxtApp, useSmartsheetStoreOrThrow, useUIPermission, viewIcons } from '#imports'
import { useNuxtApp, useSmartsheetStoreOrThrow, viewIcons } from '#imports'
interface Emits {
(event: 'openModal', data: { type: ViewTypes; title?: string }): void
@ -10,8 +10,6 @@ const emits = defineEmits<Emits>()
const { $e } = useNuxtApp()
const { isUIAllowed } = useUIPermission()
const { isSqlView } = useSmartsheetStoreOrThrow()
function onOpenModal(type: ViewTypes, title = '') {
@ -22,7 +20,7 @@ function onOpenModal(type: ViewTypes, title = '') {
<template>
<a-menu :selected-keys="[]" class="flex flex-col">
<div v-if="isUIAllowed('virtualViewsCreateOrEdit')">
<div>
<h3 class="px-3 py-1 text-xs font-semibold flex items-center gap-4 text-gray-500">
{{ $t('activity.createView') }}
</h3>

7
packages/nc-gui/components/smartsheet/sidebar/index.vue

@ -133,11 +133,14 @@ function openCreateDialog({
<a-spin />
</div>
</GeneralOverlay>
<LazySmartsheetSidebarMenuTop :views="views" @open-modal="openCreateDialog" @deleted="loadViews" />
<div v-if="isUIAllowed('virtualViewsCreateOrEdit')" class="!my-3 w-full border-b-1" />
<template v-if="isUIAllowed('virtualViewsCreateOrEdit')">
<div class="!my-3 w-full border-b-1" />
<LazySmartsheetSidebarMenuBottom @open-modal="openCreateDialog" />
<LazySmartsheetSidebarMenuBottom @open-modal="openCreateDialog" />
</template>
</div>
</a-layout-sider>
</template>

13
packages/nc-gui/composables/useDialog/index.ts

@ -3,18 +3,7 @@ import { isVNode, render } from '@vue/runtime-dom'
import type { ComponentPublicInstance } from '@vue/runtime-core'
import type { MaybeRef } from '@vueuse/core'
import { isClient } from '@vueuse/core'
import {
createEventHook,
getCurrentInstance,
getCurrentScope,
h,
ref,
toReactive,
tryOnScopeDispose,
unref,
useNuxtApp,
watch,
} from '#imports'
import { createEventHook, h, ref, toReactive, tryOnScopeDispose, unref, useNuxtApp, watch } from '#imports'
/**
* Programmatically create a component and attach it to the body (or a specific mount target), like a dialog or modal.

14
packages/nc-gui/composables/useViews.ts

@ -1,28 +1,28 @@
import type { TableType, ViewType } from 'nocodb-sdk'
import type { MaybeRef } from '@vueuse/core'
import { unref, useNuxtApp, watch } from '#imports'
import { ref, unref, useNuxtApp, watch } from '#imports'
export function useViews(meta: MaybeRef<TableType | undefined>) {
let views = $ref<ViewType[]>([])
let isLoading = $ref(false)
const views = ref<ViewType[]>([])
const isLoading = ref(false)
const { $api } = useNuxtApp()
const loadViews = async () => {
isLoading = true
isLoading.value = true
const _meta = unref(meta)
if (_meta && _meta.id) {
const response = (await $api.dbView.list(_meta.id)).list as ViewType[]
if (response) {
views = response.sort((a, b) => a.order! - b.order!)
views.value = response.sort((a, b) => a.order! - b.order!)
}
}
isLoading = false
isLoading.value = false
}
watch(() => meta, loadViews, { immediate: true })
return { views: $$(views), isLoading: $$(isLoading), loadViews }
return { views, isLoading, loadViews }
}

Loading…
Cancel
Save