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. 80
      packages/nc-gui/components/smartsheet/column/LinkedToAnotherRecordOptions.vue
  3. 2
      packages/nc-gui/components/smartsheet/column/LookupOptions.vue
  4. 9
      packages/nc-gui/components/tabs/Smartsheet.vue
  5. 19
      packages/nc-gui/components/virtual-cell/Links.vue
  6. 3
      packages/nc-gui/components/virtual-cell/components/ListChildItems.vue
  7. 5
      packages/nc-gui/components/virtual-cell/components/ListItems.vue
  8. 2
      packages/nc-gui/composables/useColumnCreateStore.ts
  9. 4
      packages/nc-gui/composables/useMultiSelect/index.ts
  10. 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)!

80
packages/nc-gui/components/smartsheet/column/LinkedToAnotherRecordOptions.vue

@ -99,46 +99,46 @@ const isLinks = $computed(() => vModel.value.uidt === UITypes.Links)
</div>
<div v-if="advancedOptions" class="flex flex-col p-6 gap-4 border-2 mt-2">
<LazySmartsheetColumnLinkOptions v-model:value="vModel" class="-my-2" />
<template v-if="!isXcdbBase">
<div class="flex flex-row space-x-2">
<a-form-item class="flex w-1/2" :label="$t('labels.onUpdate')">
<a-select
v-model:value="vModel.onUpdate"
:disabled="vModel.virtual"
name="onUpdate"
dropdown-class-name="nc-dropdown-on-update"
@change="onDataTypeChange"
>
<a-select-option v-for="(option, i) of onUpdateDeleteOptions" :key="i" :value="option">
{{ option }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item class="flex w-1/2" :label="$t('labels.onDelete')">
<a-select
v-model:value="vModel.onDelete"
:disabled="vModel.virtual"
name="onDelete"
dropdown-class-name="nc-dropdown-on-delete"
@change="onDataTypeChange"
>
<a-select-option v-for="(option, i) of onUpdateDeleteOptions" :key="i" :value="option">
{{ option }}
</a-select-option>
</a-select>
</a-form-item>
</div>
<div class="flex flex-row">
<a-form-item>
<a-checkbox v-model:checked="vModel.virtual" :disabled="appInfo.isCloud" name="virtual" @change="onDataTypeChange"
>Virtual Relation
</a-checkbox>
</a-form-item>
</div>
</template>
<LazySmartsheetColumnLinkOptions v-model:value="vModel" class="-my-2" />
<template v-if="!isXcdbBase">
<div class="flex flex-row space-x-2">
<a-form-item class="flex w-1/2" :label="$t('labels.onUpdate')">
<a-select
v-model:value="vModel.onUpdate"
:disabled="vModel.virtual"
name="onUpdate"
dropdown-class-name="nc-dropdown-on-update"
@change="onDataTypeChange"
>
<a-select-option v-for="(option, i) of onUpdateDeleteOptions" :key="i" :value="option">
{{ option }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item class="flex w-1/2" :label="$t('labels.onDelete')">
<a-select
v-model:value="vModel.onDelete"
:disabled="vModel.virtual"
name="onDelete"
dropdown-class-name="nc-dropdown-on-delete"
@change="onDataTypeChange"
>
<a-select-option v-for="(option, i) of onUpdateDeleteOptions" :key="i" :value="option">
{{ option }}
</a-select-option>
</a-select>
</a-form-item>
</div>
<div class="flex flex-row">
<a-form-item>
<a-checkbox v-model:checked="vModel.virtual" :disabled="appInfo.isCloud" name="virtual" @change="onDataTypeChange"
>Virtual Relation
</a-checkbox>
</a-form-item>
</div>
</template>
</div>
</template>
</div>

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