Browse Source

Merge pull request #3931 from nocodb/chore/typefix

pull/4072/head
Braks 2 years ago committed by GitHub
parent
commit
e7982022c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      packages/nc-gui/components/cell/Decimal.vue
  2. 2
      packages/nc-gui/components/cell/Float.vue
  3. 2
      packages/nc-gui/components/cell/Integer.vue
  4. 9
      packages/nc-gui/components/cell/MultiSelect.vue
  5. 2
      packages/nc-gui/components/cell/Percent.vue
  6. 2
      packages/nc-gui/components/general/ShareBaseButton.vue
  7. 2
      packages/nc-gui/components/shared-view/Grid.vue
  8. 6
      packages/nc-gui/components/smartsheet/sidebar/toolbar/DebugMeta.vue
  9. 4
      packages/nc-gui/components/smartsheet/sidebar/toolbar/DeleteTable.vue
  10. 7
      packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue
  11. 7
      packages/nc-gui/lib/types.ts
  12. 2
      packages/nc-gui/utils/viewUtils.ts

2
packages/nc-gui/components/cell/Decimal.vue

@ -3,7 +3,7 @@ import type { VNodeRef } from '@vue/runtime-core'
import { EditModeInj, inject, useVModel } from '#imports'
interface Props {
modelValue: number | null | string | undefined
modelValue?: number | null | string
}
interface Emits {

2
packages/nc-gui/components/cell/Float.vue

@ -3,7 +3,7 @@ import type { VNodeRef } from '@vue/runtime-core'
import { EditModeInj, inject, useVModel } from '#imports'
interface Props {
modelValue: number | null | undefined
modelValue?: number | null
}
interface Emits {

2
packages/nc-gui/components/cell/Integer.vue

@ -3,7 +3,7 @@ import type { VNodeRef } from '@vue/runtime-core'
import { EditModeInj, inject, useVModel } from '#imports'
interface Props {
modelValue: number | null | undefined
modelValue?: number | null
}
interface Emits {

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

@ -56,7 +56,14 @@ const options = computed<SelectOptionType[]>(() => {
})
const vModel = computed({
get: () => selectedIds.value.map((el) => options.value.find((op) => op.id === el)?.title) as string[],
get: () =>
selectedIds.value.reduce((acc, id) => {
const title = options.value.find((op) => op.id === id)?.title
if (title) acc.push(title)
return acc
}, [] as string[]),
set: (val) => emit('update:modelValue', val.length === 0 ? null : val.join(',')),
})

2
packages/nc-gui/components/cell/Percent.vue

@ -2,7 +2,7 @@
import { EditModeInj, inject, useVModel } from '#imports'
interface Props {
modelValue: number | string | null | undefined
modelValue?: number | string | null
}
const props = defineProps<Props>()

2
packages/nc-gui/components/general/ShareBaseButton.vue

@ -26,6 +26,6 @@ const { isUIAllowed } = useUIPermission()
</div>
</div>
<LazyTabsAuthUserManagementUsersModal :key="showUserModal" :show="showUserModal" @closed="showUserModal = false" />
<LazyTabsAuthUserManagementUsersModal :show="showUserModal" @closed="showUserModal = false" />
</div>
</template>

2
packages/nc-gui/components/shared-view/Grid.vue

@ -21,7 +21,7 @@ const { sharedView, meta, sorts, nestedFilters } = useSharedView()
const { signedIn } = useGlobal()
const { loadProject } = useProject(meta.value?.project_id)
const { loadProject } = useProject()
useProvideSmartsheetStore(sharedView, meta, true, sorts, nestedFilters)

6
packages/nc-gui/components/smartsheet/sidebar/toolbar/DebugMeta.vue

@ -1,4 +1,6 @@
<script setup lang="ts">
import { computed, ref, useMetas, useTable } from '#imports'
const editorOpen = ref(false)
const tabKey = ref()
@ -7,7 +9,9 @@ const { metas } = $(useMetas())
const { tables } = useTable()
const localTables = tables.value.filter((t) => metas[t.id as string])
const localTables = computed(
() => tables.value.filter((t) => metas[t.id as string]) as (typeof tables.value[number] & { id: string })[],
)
</script>
<template>

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

@ -1,7 +1,7 @@
<script setup lang="ts">
import { MetaInj, inject, ref, useSidebar, useTable } from '#imports'
import { MetaInj, inject, useSidebar, useTable } from '#imports'
const meta = inject(MetaInj, ref())
const meta = inject(MetaInj)!
const { deleteTable } = useTable()

7
packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue

@ -218,10 +218,13 @@ defineExpose({
</a-select-option>
</a-select>
<span v-if="['null', 'notnull', 'empty', 'notempty'].includes(filter.comparison_op)" :key="`span${i}`" />
<span
v-if="filter.comparison_op && ['null', 'notnull', 'empty', 'notempty'].includes(filter.comparison_op)"
:key="`span${i}`"
/>
<a-checkbox
v-else-if="types[filter.field] === 'boolean'"
v-else-if="filter.field && types[filter.field] === 'boolean'"
v-model:checked="filter.value"
dense
:disabled="filter.readOnly"

7
packages/nc-gui/lib/types.ts

@ -35,7 +35,12 @@ export interface Field {
export type Roles<T extends Role | ProjectRole = Role | ProjectRole> = Record<T | string, boolean>
export type Filter = FilterType & { status?: 'update' | 'delete' | 'create'; parentId?: string; readOnly?: boolean }
export type Filter = FilterType & {
field?: string
status?: 'update' | 'delete' | 'create'
parentId?: string
readOnly?: boolean
}
export type NocoI18n = I18n<{}, unknown, unknown, string, false>

2
packages/nc-gui/utils/viewUtils.ts

@ -8,7 +8,7 @@ import MdiGalleryIcon from '~icons/mdi/camera-image'
import MdiKanbanIcon from '~icons/mdi/tablet-dashboard'
import MdiEyeIcon from '~icons/mdi/eye-circle-outline'
export const viewIcons = {
export const viewIcons: Record<number | string, { icon: any; color: string }> = {
[ViewTypes.GRID]: { icon: MdiGridIcon, color: '#8f96f2' },
[ViewTypes.FORM]: { icon: MdiFormIcon, color: themeV2Colors.pink['500'] },
calendar: { icon: MdiCalendarIcon, color: 'purple' },

Loading…
Cancel
Save