Browse Source

chore: gui lint and cleanup

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5848/head
Pranav C 1 year ago
parent
commit
6c42571119
  1. 2
      packages/nc-gui/components/smartsheet/Pagination.vue
  2. 2
      packages/nc-gui/components/smartsheet/column/LookupOptions.vue
  3. 9
      packages/nc-gui/components/tabs/Smartsheet.vue
  4. 19
      packages/nc-gui/components/virtual-cell/Links.vue
  5. 3
      packages/nc-gui/components/virtual-cell/components/ListChildItems.vue
  6. 5
      packages/nc-gui/components/virtual-cell/components/ListItems.vue
  7. 2
      packages/nc-gui/composables/useColumnCreateStore.ts
  8. 4
      packages/nc-gui/composables/useMultiSelect/index.ts
  9. 2
      packages/nc-gui/utils/filterUtils.ts

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

@ -5,6 +5,8 @@ const props = defineProps<{
alignCountOnRight?: boolean
}>()
const { alignCountOnRight } = props
const paginatedData = inject(PaginationDataInj)!
const changePage = inject(ChangePageInj)!

2
packages/nc-gui/components/smartsheet/column/LookupOptions.vue

@ -1,7 +1,7 @@
<script setup lang="ts">
import { onMounted } from '@vue/runtime-core'
import type { ColumnType, LinkToAnotherRecordType, TableType } from 'nocodb-sdk'
import { RelationTypes, UITypes, isLinksOrLTAR, isSystemColumn, isVirtualCol } from 'nocodb-sdk'
import { UITypes, isLinksOrLTAR, isSystemColumn, isVirtualCol } from 'nocodb-sdk'
import { MetaInj, inject, ref, storeToRefs, useColumnCreateStoreOrThrow, useMetas, useProject, useVModel } from '#imports'
const props = defineProps<{

9
packages/nc-gui/components/tabs/Smartsheet.vue

@ -71,8 +71,13 @@ const grid = ref()
const onDrop = async (event: DragEvent) => {
event.preventDefault()
try {
// Access the dropped data
const data = JSON.parse(event.dataTransfer?.getData('text/json')!)
// extract the data from the event's data transfer object
const textData = event.dataTransfer?.getData('text/json')
if (!textData) return
// parse the data
const data = JSON.parse(textData)
// Do something with the received data
// if dragged item is not from the same base, return

19
packages/nc-gui/components/virtual-cell/Links.vue

@ -3,25 +3,12 @@ import { computed } from '@vue/reactivity'
import type { ColumnType } from 'nocodb-sdk'
import { ref } from 'vue'
import type { Ref } from 'vue'
import {
ActiveCellInj,
CellValueInj,
ColumnInj,
EditModeInj,
IsUnderLookupInj,
MetaInj,
inject,
useSelectedCellKeyupListener,
} from '#imports'
import { ActiveCellInj, CellValueInj, ColumnInj, IsUnderLookupInj, inject, useSelectedCellKeyupListener } from '#imports'
const value = inject(CellValueInj, ref(0))
const column = inject(ColumnInj)!
const meta = inject(MetaInj, ref())
const cellValue = inject(CellValueInj)!
const row = inject(RowInj)!
const reloadRowTrigger = inject(ReloadRowDataHookInj, createEventHook())
@ -34,10 +21,6 @@ const isLocked = inject(IsLockedInj, ref(false))
const isUnderLookup = inject(IsUnderLookupInj, ref(false))
const active = inject(ActiveCellInj, ref(false))
const editable = inject(EditModeInj, ref(false))
const listItemsDlg = ref(false)
const childListDlg = ref(false)

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

@ -13,7 +13,6 @@ import {
iconMap,
inject,
ref,
renderValue,
useLTARStoreOrThrow,
useSmartsheetRowStoreOrThrow,
useVModel,
@ -40,7 +39,6 @@ const {
childrenListPagination,
relatedTableDisplayValueProp,
unlink,
getRelatedTableRowId,
relatedTableMeta,
} = useLTARStoreOrThrow()
@ -153,7 +151,6 @@ const onClick = (row: Row) => {
:value="row[relatedTableDisplayValueProp]"
:column="props.column"
/>
<!-- <span class="text-gray-400 text-[11px] ml-1">(Primary key : {{ getRelatedTableRowId(row) }})</span> -->
</div>
<div v-if="!readonly" class="flex gap-2">

5
packages/nc-gui/components/virtual-cell/components/ListItems.vue

@ -12,7 +12,6 @@ import {
inject,
isDrawerExist,
ref,
renderValue,
useLTARStoreOrThrow,
useSelectedCellKeyupListener,
useSmartsheetRowStoreOrThrow,
@ -35,7 +34,6 @@ const {
childrenExcludedListPagination,
relatedTableDisplayValueProp,
link,
getRelatedTableRowId,
relatedTableMeta,
meta,
row,
@ -236,9 +234,6 @@ watch(vModel, (nextVal) => {
:border="false"
readonly
/>
<!-- <span class="hidden group-hover:(inline) text-gray-400 text-[11px] ml-1"> -->
<!-- ({{ $t('labels.primaryKey') }} : {{ getRelatedTableRowId(refRow) }}) -->
<!-- </span> -->
</a-card>
</div>

2
packages/nc-gui/composables/useColumnCreateStore.ts

@ -32,7 +32,7 @@ const [useProvideColumnCreateStore, useColumnCreateStore] = createInjectionState
(meta: Ref<TableType | undefined>, column: Ref<ColumnType | undefined>) => {
const projectStore = useProject()
const { isMysql: isMysqlFunc, isPg: isPgFunc, isMssql: isMssqlFunc, isXcdbBase: isXcdbBaseFunc, getBaseType } = projectStore
const { project, sqlUis } = storeToRefs(projectStore)
const { sqlUis } = storeToRefs(projectStore)
const { $api } = useNuxtApp()

4
packages/nc-gui/composables/useMultiSelect/index.ts

@ -26,7 +26,6 @@ import {
useI18n,
useMetas,
useProject,
useUIPermission,
} from '#imports'
const MAIN_MOUSE_PRESSED = 0
@ -75,9 +74,6 @@ export function useMultiSelect(
() => !(activeCell.row === null || activeCell.col === null || isNaN(activeCell.row) || isNaN(activeCell.col)),
)
const { isUIAllowed } = useUIPermission()
const hasEditPermission = $computed(() => isUIAllowed('xcDatatableEditable'))
function makeActive(row: number, col: number) {
if (activeCell.row === row && activeCell.col === col) {
return

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

@ -1,4 +1,4 @@
import { isNumericCol, numericUITypes, UITypes } from 'nocodb-sdk'
import { UITypes, isNumericCol, numericUITypes } from 'nocodb-sdk'
const getEqText = (fieldUiType: UITypes) => {
if (isNumericCol(fieldUiType) || fieldUiType === UITypes.Time) {

Loading…
Cancel
Save