Browse Source

refactor(gui-v2): import composables from `#imports` path

pull/2803/head
braks 2 years ago
parent
commit
f8d95aa966
  1. 5
      packages/nc-gui-v2/components/cell/Attachment.vue
  2. 2
      packages/nc-gui-v2/components/cell/Checkbox.vue
  3. 3
      packages/nc-gui-v2/components/cell/DateTimePicker.vue
  4. 2
      packages/nc-gui-v2/components/cell/Duration.vue
  5. 2
      packages/nc-gui-v2/components/cell/MultiSelect.vue
  6. 2
      packages/nc-gui-v2/components/cell/Rating.vue
  7. 2
      packages/nc-gui-v2/components/cell/SingleSelect.vue
  8. 2
      packages/nc-gui-v2/components/cell/Url.vue
  9. 3
      packages/nc-gui-v2/components/dashboard/TreeView.vue
  10. 4
      packages/nc-gui-v2/components/dlg/TableCreate.vue
  11. 2
      packages/nc-gui-v2/components/dlg/ViewCreate.vue
  12. 2
      packages/nc-gui-v2/components/smartsheet-header/Cell.vue
  13. 2
      packages/nc-gui-v2/components/smartsheet-header/CellIcon.vue
  14. 2
      packages/nc-gui-v2/components/smartsheet-header/VirtualCell.vue
  15. 2
      packages/nc-gui-v2/components/smartsheet-header/VirtualCellIcon.vue
  16. 2
      packages/nc-gui-v2/components/smartsheet-toolbar/ColumnFilter.vue
  17. 2
      packages/nc-gui-v2/components/smartsheet-toolbar/ColumnFilterMenu.vue
  18. 2
      packages/nc-gui-v2/components/smartsheet-toolbar/FieldListAutoCompleteDropdown.vue
  19. 2
      packages/nc-gui-v2/components/smartsheet-toolbar/FieldsMenu.vue
  20. 2
      packages/nc-gui-v2/components/smartsheet-toolbar/SortListMenu.vue
  21. 2
      packages/nc-gui-v2/components/smartsheet/Cell.vue
  22. 2
      packages/nc-gui-v2/components/smartsheet/Gallery.vue
  23. 2
      packages/nc-gui-v2/components/smartsheet/Grid.vue
  24. 2
      packages/nc-gui-v2/components/smartsheet/Pagination.vue
  25. 2
      packages/nc-gui-v2/components/smartsheet/Sidebar.vue
  26. 2
      packages/nc-gui-v2/components/smartsheet/VirtualCell.vue
  27. 2
      packages/nc-gui-v2/components/tabs/Smartsheet.vue
  28. 2
      packages/nc-gui-v2/components/virtual-cell/BelongsTo.vue
  29. 5
      packages/nc-gui-v2/components/virtual-cell/Formula.vue
  30. 2
      packages/nc-gui-v2/components/virtual-cell/HasMany.vue
  31. 2
      packages/nc-gui-v2/components/virtual-cell/ManyToMany.vue
  32. 2
      packages/nc-gui-v2/components/virtual-cell/components/ItemChip.vue
  33. 2
      packages/nc-gui-v2/composables/useColumn.ts
  34. 2
      packages/nc-gui-v2/composables/useMetas.ts
  35. 1
      packages/nc-gui-v2/composables/useTableCreate.ts
  36. 2
      packages/nc-gui-v2/composables/useViewData.ts
  37. 12
      packages/nc-gui-v2/pages/nc/[projectId].vue

5
packages/nc-gui-v2/components/cell/Attachment.vue

@ -1,9 +1,8 @@
<script setup lang="ts">
import { useToast } from 'vue-toastification'
import { inject, ref, watchEffect } from '#imports'
import { inject, ref, useProject, watchEffect } from '#imports'
import { useNuxtApp } from '#app'
import { ColumnInj, MetaInj } from '~/components'
import useProject from '~/composables/useProject'
import { ColumnInj, MetaInj } from '~/context'
import { NOCO } from '~/lib/constants'
import { isImage } from '~/utils/fileUtils'
import MaterialPlusIcon from '~icons/mdi/plus'

2
packages/nc-gui-v2/components/cell/Checkbox.vue

@ -1,6 +1,6 @@
<script setup lang="ts">
import { computed, inject } from '#imports'
import { ColumnInj, IsFormInj } from '~/components'
import { ColumnInj, IsFormInj } from '~/context'
interface Props {
modelValue?: boolean | undefined | number

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

@ -1,7 +1,6 @@
<script setup lang="ts">
import dayjs from 'dayjs'
import { computed, ref } from '#imports'
import useProject from '~/composables/useProject'
import { computed, ref, useProject } from '#imports'
interface Props {
modelValue?: string

2
packages/nc-gui-v2/components/cell/Duration.vue

@ -1,6 +1,6 @@
<script setup lang="ts">
import { computed, inject, ref } from '#imports'
import { ColumnInj } from '~/components'
import { ColumnInj } from '~/context'
import { convertDurationToSeconds, convertMS2Duration, durationOptions } from '~/utils/durationHelper'
interface Props {

2
packages/nc-gui-v2/components/cell/MultiSelect.vue

@ -1,6 +1,6 @@
<script lang="ts" setup>
import { computed, inject } from '#imports'
import { ColumnInj } from '~/components'
import { ColumnInj } from '~/context'
interface Props {
modelValue: string

2
packages/nc-gui-v2/components/cell/Rating.vue

@ -1,6 +1,6 @@
<script setup lang="ts">
import { computed, inject } from '#imports'
import { ColumnInj, IsFormInj } from '~/components'
import { ColumnInj, IsFormInj } from '~/context'
import MdiStarIcon from '~icons/mdi/star'
import MdiStarOutlineIcon from '~icons/mdi/star-outline'

2
packages/nc-gui-v2/components/cell/SingleSelect.vue

@ -1,6 +1,6 @@
<script lang="ts" setup>
import { computed, inject } from '#imports'
import { ColumnInj } from '~/components'
import { ColumnInj } from '~/context'
interface Props {
modelValue: string

2
packages/nc-gui-v2/components/cell/Url.vue

@ -1,6 +1,6 @@
<script setup lang="ts">
import { computed, ref } from '#imports'
import { ColumnInj } from '~/components'
import { ColumnInj } from '~/context'
import { isValidURL } from '~/utils/urlUtils'
interface Props {

3
packages/nc-gui-v2/components/dashboard/TreeView.vue

@ -1,6 +1,5 @@
<script setup lang="ts">
import useProject from '~/composables/useProject'
import useTabs from '~/composables/useTabs'
import { useProject, useTabs } from '#imports'
import MdiSettingIcon from '~icons/mdi/cog'
const { tables } = useProject()

4
packages/nc-gui-v2/components/dlg/TableCreate.vue

@ -1,8 +1,6 @@
<script setup lang="ts">
import { onMounted } from '@vue/runtime-core'
import useTableCreate from '../../composables/useTableCreate'
import useProject from '~/composables/useProject'
import useTabs from '~/composables/useTabs'
import { useProject, useTableCreate, useTabs } from '#imports'
import { validateTableName } from '~/utils/validation'
const { modelValue = false } = defineProps<{ modelValue?: boolean }>()

2
packages/nc-gui-v2/components/dlg/ViewCreate.vue

@ -3,7 +3,7 @@ import { inject } from '@vue/runtime-core'
import type { TableType } from 'nocodb-sdk'
import { ViewTypes } from 'nocodb-sdk'
import type { Ref } from '#imports'
import { ActiveViewInj, MetaInj, ViewListInj } from '~/components'
import { ActiveViewInj, MetaInj, ViewListInj } from '~/context'
import useViewCreate from '~/composables/useViewCreate'
const { modelValue, type } = defineProps<{ type: ViewTypes; modelValue: boolean }>()

2
packages/nc-gui-v2/components/smartsheet-header/Cell.vue

@ -1,6 +1,6 @@
<script setup lang="ts">
import type { ColumnType } from 'nocodb-sdk'
import { ColumnInj } from '../index'
import { ColumnInj } from '../../context'
const { column } = defineProps<{ column: ColumnType & { meta: any } }>()
provide(ColumnInj, column)

2
packages/nc-gui-v2/components/smartsheet-header/CellIcon.vue

@ -1,6 +1,6 @@
<script setup lang="ts">
import type { ColumnType } from 'nocodb-sdk'
import { ColumnInj } from '~/components'
import { ColumnInj } from '~/context'
import useColumn from '~/composables/useColumn'
import KeyIcon from '~icons/mdi/key-variant'
import JSONIcon from '~icons/mdi/code-json'

2
packages/nc-gui-v2/components/smartsheet-header/VirtualCell.vue

@ -1,6 +1,6 @@
<script setup lang="ts">
import type { ColumnType } from 'nocodb-sdk'
import { ColumnInj } from '../index'
import { ColumnInj } from '../../context'
import { provide } from '#imports'
const { column } = defineProps<{ column: ColumnType & { meta: any } }>()

2
packages/nc-gui-v2/components/smartsheet-header/VirtualCellIcon.vue

@ -1,6 +1,6 @@
<script setup lang="ts">
import { LinkToAnotherRecordType, RelationTypes, UITypes } from "nocodb-sdk";
import { ColumnInj } from '~/components'
import { ColumnInj } from '~/context'
import GenericIcon from '~icons/mdi/square-rounded'
import HMIcon from '~icons/mdi/table-arrow-right'
import BTIcon from '~icons/mdi/table-arrow-left'

2
packages/nc-gui-v2/components/smartsheet-toolbar/ColumnFilter.vue

@ -4,7 +4,7 @@ import FieldListAutoCompleteDropdown from './FieldListAutoCompleteDropdown.vue'
import { useNuxtApp } from '#app'
import { inject } from '#imports'
import { comparisonOpList } from '~/utils/filterUtils'
import { ActiveViewInj, MetaInj, ReloadViewDataHookInj } from '~/components'
import { ActiveViewInj, MetaInj, ReloadViewDataHookInj } from '~/context'
import useViewFilters from '~/composables/useViewFilters'
import MdiDeleteIcon from '~icons/mdi/close-box'

2
packages/nc-gui-v2/components/smartsheet-toolbar/ColumnFilterMenu.vue

@ -1,7 +1,7 @@
<script setup lang="ts">
// todo: move to persisted state
import { useState } from '#app'
import { IsLockedInj } from '~/components'
import { IsLockedInj } from '~/context'
import MdiFilterIcon from '~icons/mdi/filter-outline'
import MdiMenuDownIcon from '~icons/mdi/menu-down'

2
packages/nc-gui-v2/components/smartsheet-toolbar/FieldListAutoCompleteDropdown.vue

@ -1,5 +1,5 @@
<script setup lang="ts">
import { MetaInj } from '~/components'
import { MetaInj } from '~/context'
interface Props {
modelValue?: string

2
packages/nc-gui-v2/components/smartsheet-toolbar/FieldsMenu.vue

@ -1,6 +1,6 @@
<script setup lang="ts">
import { computed, inject } from 'vue'
import { ActiveViewInj, FieldsInj, IsLockedInj, MetaInj, ReloadViewDataHookInj } from '~/components'
import { ActiveViewInj, FieldsInj, IsLockedInj, MetaInj, ReloadViewDataHookInj } from '~/context'
import useViewColumns from '~/composables/useViewColumns'
import MdiMenuDownIcon from '~icons/mdi/menu-down'
import MdiEyeIcon from '~icons/mdi/eye-off-outline'

2
packages/nc-gui-v2/components/smartsheet-toolbar/SortListMenu.vue

@ -1,7 +1,7 @@
<script setup lang="ts">
import FieldListAutoCompleteDropdown from './FieldListAutoCompleteDropdown.vue'
import { computed, inject } from '#imports'
import { ActiveViewInj, IsLockedInj, MetaInj, ReloadViewDataHookInj } from '~/components'
import { ActiveViewInj, IsLockedInj, MetaInj, ReloadViewDataHookInj } from '~/context'
import useViewSorts from '~/composables/useViewSorts'
import MdiMenuDownIcon from '~icons/mdi/menu-down'
import MdiSortIcon from '~icons/mdi/sort'

2
packages/nc-gui-v2/components/smartsheet/Cell.vue

@ -2,7 +2,7 @@
import type { ColumnType } from 'nocodb-sdk'
import { provide } from 'vue'
import { computed } from '#imports'
import { ColumnInj } from '~/components'
import { ColumnInj } from '~/context'
import useColumn from '~/composables/useColumn'
interface Props {

2
packages/nc-gui-v2/components/smartsheet/Gallery.vue

@ -1,7 +1,7 @@
<script lang="ts" setup>
import { isVirtualCol } from 'nocodb-sdk'
import { inject, onKeyStroke, onMounted, provide } from '#imports'
import { ActiveViewInj, ChangePageInj, IsFormInj, IsGridInj, MetaInj, PaginationDataInj, ReadonlyInj } from '~/components'
import { ActiveViewInj, ChangePageInj, IsFormInj, IsGridInj, MetaInj, PaginationDataInj, ReadonlyInj } from '~/context'
import useViewData from '~/composables/useViewData'
const meta = inject(MetaInj)

2
packages/nc-gui-v2/components/smartsheet/Grid.vue

@ -11,7 +11,7 @@ import {
MetaInj,
PaginationDataInj,
ReloadViewDataHookInj,
} from '~/components'
} from '~/context'
import useViewData from '~/composables/useViewData'
const meta = inject(MetaInj)

2
packages/nc-gui-v2/components/smartsheet/Pagination.vue

@ -1,6 +1,6 @@
<script setup lang="ts">
import { computed, inject } from 'vue'
import { ChangePageInj, PaginationDataInj } from '~/components'
import { ChangePageInj, PaginationDataInj } from '~/context'
import MdiKeyboardIcon from '~icons/mdi/keyboard-return'
const paginatedData = inject(PaginationDataInj)

2
packages/nc-gui-v2/components/smartsheet/Sidebar.vue

@ -3,7 +3,7 @@ import { ViewTypes } from 'nocodb-sdk'
import type { TableType } from 'nocodb-sdk'
import type { Ref } from 'vue'
import { inject, ref } from '#imports'
import { ActiveViewInj, MetaInj, ViewListInj } from '~/components'
import { ActiveViewInj, MetaInj, ViewListInj } from '~/context'
import useViews from '~/composables/useViews'
import { viewIcons } from '~/utils/viewUtils'
import MdiPlusIcon from '~icons/mdi/plus'

2
packages/nc-gui-v2/components/smartsheet/VirtualCell.vue

@ -1,7 +1,7 @@
<script setup lang="ts">
import type { ColumnType } from 'nocodb-sdk'
import { provide } from '#imports'
import { ColumnInj } from '~/components'
import { ColumnInj } from '~/context'
import useVirtualCell from '~/composables/useVirtualCell'
interface Props {

2
packages/nc-gui-v2/components/tabs/Smartsheet.vue

@ -3,7 +3,7 @@ import { useEventBus } from '@vueuse/core'
import type { ColumnType, FormType, GalleryType, GridType, KanbanType } from 'nocodb-sdk'
import { ViewTypes } from 'nocodb-sdk'
import { computed, onMounted, provide, watch } from '#imports'
import { ActiveViewInj, FieldsInj, IsLockedInj, MetaInj, ReloadViewDataHookInj, TabMetaInj } from '~/components'
import { ActiveViewInj, FieldsInj, IsLockedInj, MetaInj, ReloadViewDataHookInj, TabMetaInj } from '~/context'
import useMetas from '~/composables/useMetas'
const { tabMeta } = defineProps({

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

@ -1,7 +1,7 @@
<script setup lang="ts">
import type { ColumnType } from 'nocodb-sdk'
import ItemChip from './components/ItemChip.vue'
import { ColumnInj } from '~/components'
import { ColumnInj } from '~/context'
import useBelongsTo from '~/composables/useBelongsTo'
const column = inject(ColumnInj)

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

@ -1,8 +1,9 @@
<script lang="ts" setup>
import { computed } from '#imports'
import { ColumnInj } from '~/components'
import { computed, useProject } from '#imports'
import { ColumnInj } from '~/context'
import { handleTZ } from '~/utils/dateTimeUtils'
import { replaceUrlsWithLink } from '~/utils/urlUtils'
const column = inject(ColumnInj)
const value = inject('value')

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

@ -1,7 +1,7 @@
<script setup lang="ts">
import type { ColumnType } from 'nocodb-sdk'
import ItemChip from './components/ItemChip.vue'
import { ColumnInj } from '~/components'
import { ColumnInj } from '~/context'
import useHasMany from '~/composables/useHasMany'
const column = inject(ColumnInj)
const value = inject('value')

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

@ -1,7 +1,7 @@
<script setup lang="ts">
import type { ColumnType } from 'nocodb-sdk'
import ItemChip from './components/ItemChip.vue'
import { ColumnInj } from '~/components'
import { ColumnInj } from '~/context'
import useManyToMany from '~/composables/useManyToMany'
const column = inject(ColumnInj)
const value = inject('value')

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

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ReadonlyInj } from '~/components'
import { ReadonlyInj } from '~/context'
import MdiCloseThickIcon from '~icons/mdi/close-thick'
interface Props {

2
packages/nc-gui-v2/composables/useColumn.ts

@ -1,6 +1,6 @@
import type { ColumnType } from 'nocodb-sdk'
import { SqlUiFactory, UITypes, isVirtualCol } from 'nocodb-sdk'
import useProject from '~/composables/useProject'
import { useProject } from '#imports'
export default (column: ColumnType) => {
const { project } = useProject()

2
packages/nc-gui-v2/composables/useMetas.ts

@ -1,6 +1,6 @@
import type { TableType } from 'nocodb-sdk'
import { useNuxtApp, useState } from '#app'
import useProject from '~/composables/useProject'
import { useProject } from '#imports'
export default () => {
const { $api } = useNuxtApp()

1
packages/nc-gui-v2/composables/useTableCreate.ts

@ -1,6 +1,7 @@
import type { TableType } from 'nocodb-sdk'
import { UITypes } from 'nocodb-sdk'
import { useNuxtApp } from '#app'
import { useProject } from '#imports'
export default (onTableCreate?: (tableMeta: TableType) => void) => {
const table = reactive<{ title: string; table_name: string; columns: string[] }>({

2
packages/nc-gui-v2/composables/useViewData.ts

@ -1,7 +1,7 @@
import type { Api, FormType, GalleryType, GridType, PaginatedType, TableType } from 'nocodb-sdk'
import type { ComputedRef, Ref } from 'vue'
import { useNuxtApp } from '#app'
import useProject from '~/composables/useProject'
import { useProject } from '#imports'
import { NOCO } from '~/lib/constants'
const formatData = (list: Record<string, any>[]) =>

12
packages/nc-gui-v2/pages/nc/[projectId].vue

@ -1,17 +1,9 @@
<script setup lang="ts">
import { watch } from 'vue'
import useProject from '~/composables/useProject'
import useTabs from '~/composables/useTabs'
const route = useRoute()
const { loadProject, loadTables } = useProject()
const { loadProject, loadTables } = useProject(route.params.projectId as string)
const { clearTabs, addTab } = useTabs()
onMounted(async () => {
await loadProject(route.params.projectId as string)
await loadTables()
addTab({ type: 'auth', title: 'Team & Auth' })
})
addTab({ type: 'auth', title: 'Team & Auth' })
watch(
() => route.params.projectId,

Loading…
Cancel
Save