Browse Source

fix(nc-gui): hide system columns in shared form

pull/7786/head
Ramesh Mane 9 months ago
parent
commit
b9bfbeab57
  1. 30
      packages/nc-gui/composables/useSharedFormViewStore.ts
  2. 2
      packages/nc-gui/composables/useViewData.ts

30
packages/nc-gui/composables/useSharedFormViewStore.ts

@ -104,7 +104,7 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
helpers.withMessage(t('msg.error.fieldRequired', { value: fieldName }), required) helpers.withMessage(t('msg.error.fieldRequired', { value: fieldName }), required)
const formColumns = computed(() => const formColumns = computed(() =>
columns.value?.filter((c) => c.show).filter((col) => !isVirtualCol(col) || isLinksOrLTAR(col.uidt)), columns.value?.filter((c) => c.show).filter((col) => !isSystemColumn(col) && (!isVirtualCol(col) || isLinksOrLTAR(col.uidt))),
) )
const loadSharedView = async () => { const loadSharedView = async () => {
@ -313,7 +313,7 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
case UITypes.SingleSelect: case UITypes.SingleSelect:
case UITypes.MultiSelect: case UITypes.MultiSelect:
case UITypes.User: { case UITypes.User: {
const limitOptions = (parseProp(c.meta).limitOptions || []).reduce((ac, op) => { const limitOptions = (parseProp(c.meta).isLimitOption ? parseProp(c.meta).limitOptions || [] : []).reduce((ac, op) => {
if (op?.id) { if (op?.id) {
ac[op.id] = op ac[op.id] = op
} }
@ -331,7 +331,11 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
op?.id && op?.id &&
op?.title && op?.title &&
queryOptions.includes(op.title) && queryOptions.includes(op.title) &&
(limitOptions[op.id] ? limitOptions[op.id]?.show : !(parseProp(c.meta).limitOptions || []).length) (limitOptions[op.id]
? limitOptions[op.id]?.show
: parseProp(c.meta).isLimitOption
? !(parseProp(c.meta).limitOptions || []).length
: true)
) { ) {
return true return true
} }
@ -349,7 +353,11 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
user?.id && user?.id &&
user?.email && user?.email &&
queryOptions.includes(user.email) && queryOptions.includes(user.email) &&
(limitOptions[user.id] ? limitOptions[user.id]?.show : !(parseProp(c.meta).limitOptions || []).length) (limitOptions[user.id]
? limitOptions[user.id]?.show
: parseProp(c.meta).isLimitOption
? !(parseProp(c.meta).limitOptions || []).length
: true)
) { ) {
return true return true
} }
@ -421,8 +429,22 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
if (parsedTime.isValid()) { if (parsedTime.isValid()) {
preFillValue = parsedTime.format(baseStore.isMysql(c.source_id) ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm:ssZ') preFillValue = parsedTime.format(baseStore.isMysql(c.source_id) ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm:ssZ')
} }
break
} }
case UITypes.LinkToAnotherRecord: { case UITypes.LinkToAnotherRecord: {
if (isBt(c)) {
const queryOptions = value.split(',')
// console.log('column bt', queryOptions, c)
}
break
}
case UITypes.Links: {
if (isMm(c)) {
const queryOptions = value.split(',')
// console.log('column mm', queryOptions, c)
}
break break
} }
default: { default: {

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

@ -297,7 +297,7 @@ export function useViewData(
fk_column_id: c.id, fk_column_id: c.id,
fk_view_id: viewMeta.value?.id, fk_view_id: viewMeta.value?.id,
...(fieldById[c.id!] ? fieldById[c.id!] : {}), ...(fieldById[c.id!] ? fieldById[c.id!] : {}),
meta: { ...parseProp(fieldById[c.id!]?.meta), ...parseProp(c.meta) }, // TODO: discuss with @pranav meta: { ...parseProp(fieldById[c.id!]?.meta), ...parseProp(c.meta) },
order: (fieldById[c.id!] && fieldById[c.id!].order) || order++, order: (fieldById[c.id!] && fieldById[c.id!].order) || order++,
id: fieldById[c.id!] && fieldById[c.id!].id, id: fieldById[c.id!] && fieldById[c.id!].id,
})) }))

Loading…
Cancel
Save