Browse Source

chore(gui-v2): lint

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3025/head
Pranav C 2 years ago
parent
commit
df9fb1f3ee
  1. 1
      packages/nc-gui-v2/components.d.ts
  2. 1
      packages/nc-gui-v2/components/smartsheet/expanded-form/index.vue
  3. 3
      packages/nc-gui-v2/components/virtual-cell/BelongsTo.vue
  4. 3
      packages/nc-gui-v2/components/virtual-cell/HasMany.vue
  5. 3
      packages/nc-gui-v2/components/virtual-cell/ManyToMany.vue
  6. 5
      packages/nc-gui-v2/components/virtual-cell/components/ItemChip.vue
  7. 3
      packages/nc-gui-v2/components/virtual-cell/components/ListChildItems.vue
  8. 4
      packages/nc-gui-v2/components/virtual-cell/components/ListItems.vue
  9. 15
      packages/nc-gui-v2/composables/useExpandedFormStore.ts
  10. 9
      packages/nc-gui-v2/composables/useSmartsheetRowStore.ts

1
packages/nc-gui-v2/components.d.ts vendored

@ -90,6 +90,7 @@ declare module '@vue/runtime-core' {
MdiCheck: typeof import('~icons/mdi/check')['default']
MdiChevronDown: typeof import('~icons/mdi/chevron-down')['default']
MdiCloseCircle: typeof import('~icons/mdi/close-circle')['default']
MdiCloseThick: typeof import('~icons/mdi/close-thick')['default']
MdiContentCopy: typeof import('~icons/mdi/content-copy')['default']
MdiContentSave: typeof import('~icons/mdi/content-save')['default']
MdiDatabase: typeof import('~icons/mdi/database')['default']

1
packages/nc-gui-v2/components/smartsheet/expanded-form/index.vue

@ -17,7 +17,6 @@ interface Props {
state?: Record<string, any> | null
meta: TableType
loadRow?: boolean
useMetaFields?: boolean
}

3
packages/nc-gui-v2/components/virtual-cell/BelongsTo.vue

@ -3,8 +3,7 @@ import type { ColumnType } from 'nocodb-sdk'
import type { Ref } from 'vue'
import ItemChip from './components/ItemChip.vue'
import ListItems from './components/ListItems.vue'
import { useSmartsheetRowStoreOrThrow } from '~/composables/useSmartsheetRowStore'
import { inject, ref, useProvideLTARStore } from '#imports'
import { inject, ref, useProvideLTARStore, useSmartsheetRowStoreOrThrow } from '#imports'
import { CellValueInj, ColumnInj, ReloadViewDataHookInj, RowInj } from '~/context'
const column = inject(ColumnInj)

3
packages/nc-gui-v2/components/virtual-cell/HasMany.vue

@ -4,8 +4,7 @@ import type { Ref } from 'vue'
import ItemChip from './components/ItemChip.vue'
import ListChildItems from './components/ListChildItems.vue'
import ListItems from './components/ListItems.vue'
import { useSmartsheetRowStoreOrThrow } from '~/composables/useSmartsheetRowStore'
import { computed, inject, ref, useProvideLTARStore } from '#imports'
import { computed, inject, ref, useProvideLTARStore, useSmartsheetRowStoreOrThrow } from '#imports'
import { CellValueInj, ColumnInj, IsFormInj, ReloadViewDataHookInj, RowInj } from '~/context'
const column = inject(ColumnInj)!

3
packages/nc-gui-v2/components/virtual-cell/ManyToMany.vue

@ -4,8 +4,7 @@ import type { Ref } from 'vue'
import ItemChip from './components/ItemChip.vue'
import ListChildItems from './components/ListChildItems.vue'
import ListItems from './components/ListItems.vue'
import { useSmartsheetRowStoreOrThrow } from '~/composables/useSmartsheetRowStore'
import { computed, inject, ref, useProvideLTARStore } from '#imports'
import { computed, inject, ref, useProvideLTARStore, useSmartsheetRowStoreOrThrow } from '#imports'
import { CellValueInj, ColumnInj, IsFormInj, ReloadViewDataHookInj, RowInj } from '~/context'
const column = inject(ColumnInj)!

5
packages/nc-gui-v2/components/virtual-cell/components/ItemChip.vue

@ -1,7 +1,6 @@
<script setup lang="ts">
import { useLTARStoreOrThrow } from '~/composables'
import { useLTARStoreOrThrow } from '#imports'
import { ActiveCellInj, IsFormInj, ReadonlyInj } from '~/context'
import MdiCloseThickIcon from '~icons/mdi/close-thick'
interface Props {
value?: string | number | boolean
@ -29,7 +28,7 @@ const expandedFormDlg = ref(false)
>
<span class="name">{{ value }}</span>
<div v-show="active || isForm" v-if="!readonly" class="flex align-center">
<MdiCloseThickIcon class="unlink-icon text-xs text-gray-500/50 group-hover:text-gray-500" @click.stop="emit('unlink')" />
<MdiCloseThick class="unlink-icon text-xs text-gray-500/50 group-hover:text-gray-500" @click.stop="emit('unlink')" />
</div>
<SmartsheetExpandedForm

3
packages/nc-gui-v2/components/virtual-cell/components/ListChildItems.vue

@ -1,8 +1,7 @@
<script lang="ts" setup>
import { Modal } from 'ant-design-vue'
import type { ColumnType } from 'nocodb-sdk'
import { useLTARStoreOrThrow, useVModel, watch } from '#imports'
import { useSmartsheetRowStoreOrThrow } from '~/composables/useSmartsheetRowStore'
import { useLTARStoreOrThrow, useSmartsheetRowStoreOrThrow, useVModel, watch } from '#imports'
import { ColumnInj, IsFormInj } from '~/context'
const props = defineProps<{ modelValue?: boolean }>()

4
packages/nc-gui-v2/components/virtual-cell/components/ListItems.vue

@ -1,9 +1,7 @@
<script lang="ts" setup>
import { RelationTypes, UITypes } from 'nocodb-sdk'
import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk'
import { computed } from 'vue'
import { useLTARStoreOrThrow, useVModel } from '#imports'
import { useSmartsheetRowStoreOrThrow } from '~/composables/useSmartsheetRowStore'
import { computed, useLTARStoreOrThrow, useSmartsheetRowStoreOrThrow, useVModel } from '#imports'
import { ColumnInj } from '~/context'
const props = defineProps<{ modelValue: boolean }>()

15
packages/nc-gui-v2/composables/useExpandedFormStore.ts

@ -3,12 +3,9 @@ import type { ColumnType, TableType } from 'nocodb-sdk'
import type { Ref } from 'vue'
import { message, notification } from 'ant-design-vue'
import dayjs from 'dayjs'
import getPlainText from '../../nc-gui/components/project/spreadsheet/helpers/getPlainText'
import { useProvideSmartsheetRowStore } from '~/composables/useSmartsheetRowStore'
import { useApi, useInjectionState, useProject, useProvideSmartsheetRowStore } from '#imports'
import { NOCO } from '~/lib'
import { useNuxtApp } from '#app'
import { useInjectionState, useProject } from '#imports'
import { useApi } from '~/composables/useApi'
import type { Row } from '~/composables/useViewData'
import { extractPkFromRow, extractSdkResponseErrorMsg } from '~/utils'
@ -87,8 +84,9 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
await api.utils.commentRow({
fk_model_id: meta.value?.id as string,
row_id: rowId,
// todo: swagger type correction
description: comment.value,
})
} as any)
comment.value = ''
message.success('Comment added successfully')
@ -202,3 +200,10 @@ export function useExpandedFormStoreOrThrow() {
if (expandedFormStore == null) throw new Error('Please call `useExpandedFormStore` on the appropriate parent component')
return expandedFormStore
}
// todo: move to utils
function getPlainText(htmlString: string) {
const div = document.createElement('div')
div.textContent = htmlString || ''
return div.innerHTML
}

9
packages/nc-gui-v2/composables/useSmartsheetRowStore.ts

@ -1,13 +1,10 @@
import { notification } from 'ant-design-vue'
import { UITypes } from 'nocodb-sdk'
import type { ColumnType, LinkToAnotherRecordType, TableType } from 'nocodb-sdk'
import type { ColumnType, LinkToAnotherRecordType, RelationTypes, TableType } from 'nocodb-sdk'
import type { Ref } from 'vue'
import { useNuxtApp } from '#app'
import { useInjectionState } from '#imports'
import { useMetas } from '~/composables/useMetas'
import { useProject } from '~/composables/useProject'
import { useInjectionState, useMetas, useProject, useVirtualCell } from '#imports'
import type { Row } from '~/composables/useViewData'
import { useVirtualCell } from '~/composables/useVirtualCell'
import { NOCO } from '~/lib'
import { extractPkFromRow, extractSdkResponseErrorMsg } from '~/utils'
@ -43,7 +40,7 @@ const [useProvideSmartsheetRowStore, useSmartsheetRowStore] = useInjectionState(
}
}
const linkRecord = async (rowId: string, relatedRowId: string, column: ColumnType, type) => {
const linkRecord = async (rowId: string, relatedRowId: string, column: ColumnType, type: RelationTypes) => {
try {
await $api.dbTableRow.nestedAdd(
NOCO,

Loading…
Cancel
Save