Browse Source

QR code type: adress PR feedback

pull/4142/head
Daniel Spaude 2 years ago
parent
commit
7015e19775
No known key found for this signature in database
GPG Key ID: 654A3D1FA4F35FFE
  1. 12
      packages/nc-gui/components/smartsheet/Form.vue
  2. 7
      packages/nc-gui/components/smartsheet/column/QrCodeOptions.vue
  3. 10
      packages/nc-gui/composables/useViewData.ts

12
packages/nc-gui/components/smartsheet/Form.vue

@ -257,7 +257,7 @@ async function checkSMTPStatus() {
}
function setFormData() {
const col = (formColumnData as Record<string, any>)?.value.filter((c: Record<string, any>) => c.uidt !== UITypes.QrCode)
const col = formColumnData?.value?.filter((c: Record<string, any>) => c.uidt !== UITypes.QrCode) || []
formViewData.value = {
...formViewData.value,
@ -275,20 +275,20 @@ function setFormData() {
localColumns.value = col
.filter(
(f: Record<string, any>) =>
(f) =>
f.show &&
f.uidt !== UITypes.Rollup &&
f.uidt !== UITypes.Lookup &&
f.uidt !== UITypes.Formula &&
f.uidt !== UITypes.SpecificDBType,
)
.sort((a: Record<string, any>, b: Record<string, any>) => a.order - b.order)
.map((c: Record<string, any>) => ({ ...c, required: !!(c.required || 0) }))
.sort((a, b) => a.order - b.order)
.map((c) => ({ ...c, required: !!(c.required || 0) }))
systemFieldsIds.value = getSystemColumns(col).map((c: Record<string, any>) => c.fk_column_id)
systemFieldsIds.value = getSystemColumns(col).map((c) => c.fk_column_id)
hiddenColumns.value = col.filter(
(f: Record<string, any>) =>
(f) =>
!f.show &&
!systemFieldsIds.value.includes(f.fk_column_id) &&
f.uidt !== UITypes.Rollup &&

7
packages/nc-gui/components/smartsheet/column/QrCodeOptions.vue

@ -1,7 +1,7 @@
<script setup lang="ts">
import { UITypes } from 'nocodb-sdk'
import type { SelectProps } from 'ant-design-vue'
import { useVModel } from '#imports'
import { useVModel, onMounted } from '#imports'
const props = defineProps<{
value: any
@ -41,7 +41,10 @@ const columnsAllowedAsQrValue = computed<SelectProps['options']>(() => {
})
// set default value
vModel.value.fk_qr_value_column_id = (column?.value?.colOptions as Record<string, any>)?.fk_qr_value_column_id || ''
onMounted(() => {
vModel.value.fk_qr_value_column_id = (column?.value?.colOptions as Record<string, any>)?.fk_qr_value_column_id || ''
})
setAdditionalValidations({
fk_qr_value_column_id: [{ required: true, message: 'Required' }],

10
packages/nc-gui/composables/useViewData.ts

@ -1,5 +1,5 @@
import { UITypes, ViewTypes } from 'nocodb-sdk'
import type { Api, ColumnType, FormType, GalleryType, PaginatedType, TableType, ViewType } from 'nocodb-sdk'
import type { Api, ColumnType, FormColumnType, FormType, GalleryType, PaginatedType, TableType, ViewType } from 'nocodb-sdk'
import type { ComputedRef, Ref } from 'vue'
import {
IsPublicInj,
@ -54,7 +54,7 @@ export function useViewData(
const galleryData = ref<GalleryType>()
const formColumnData = ref<FormType>()
const formColumnData = ref<Record<string, any>[]>()
const formViewData = ref<FormType>()
@ -395,14 +395,14 @@ export function useViewData(
async function loadFormView() {
if (!viewMeta?.value?.id) return
try {
const { columns, ...view } = (await $api.dbView.formRead(viewMeta.value.id)) as Record<string, any>
const { columns, ...view } = await $api.dbView.formRead(viewMeta.value.id)
const fieldById = columns.reduce(
const fieldById = (columns || []).reduce(
(o: Record<string, any>, f: Record<string, any>) => ({
...o,
[f.fk_column_id]: f,
}),
{},
{} as Record<string, FormColumnType>,
)
let order = 1

Loading…
Cancel
Save