|
|
@ -7,6 +7,7 @@ import type { |
|
|
|
FormColumnType, |
|
|
|
FormColumnType, |
|
|
|
FormType, |
|
|
|
FormType, |
|
|
|
LinkToAnotherRecordType, |
|
|
|
LinkToAnotherRecordType, |
|
|
|
|
|
|
|
SelectOptionsType, |
|
|
|
StringOrNullType, |
|
|
|
StringOrNullType, |
|
|
|
TableType, |
|
|
|
TableType, |
|
|
|
} from 'nocodb-sdk' |
|
|
|
} from 'nocodb-sdk' |
|
|
@ -254,9 +255,7 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share |
|
|
|
if (Object.keys(route.query).length && sharedViewMeta.value.preFilledMode !== PreFilledMode.Disabled) { |
|
|
|
if (Object.keys(route.query).length && sharedViewMeta.value.preFilledMode !== PreFilledMode.Disabled) { |
|
|
|
console.log('router', route.query) |
|
|
|
console.log('router', route.query) |
|
|
|
columns.value = columns.value?.map((c) => { |
|
|
|
columns.value = columns.value?.map((c) => { |
|
|
|
if ((c.label || c.title) && route.query?.[c.label!] === undefined && route.query?.[c.title!] === undefined) { |
|
|
|
if (!c.title || !route.query?.[c.title]) return c |
|
|
|
return c |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (sharedViewMeta.value.preFilledMode) { |
|
|
|
switch (sharedViewMeta.value.preFilledMode) { |
|
|
|
case PreFilledMode.Hidden: { |
|
|
|
case PreFilledMode.Hidden: { |
|
|
@ -269,22 +268,32 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share |
|
|
|
switch (c.uidt) { |
|
|
|
switch (c.uidt) { |
|
|
|
case UITypes.SingleSelect: |
|
|
|
case UITypes.SingleSelect: |
|
|
|
case UITypes.MultiSelect: { |
|
|
|
case UITypes.MultiSelect: { |
|
|
|
const allValues = (c.dtxp as string)?.split(',').map((o) => o?.replace(/^['"]|['"]$/g, '')) |
|
|
|
const limitOptions = Array.isArray(parseProp(c.meta).limitOptions) |
|
|
|
let options = ((route.query?.[c.label!] || route.query?.[c.title!]) as string)?.split(',').filter((op) => { |
|
|
|
? parseProp(c.meta).limitOptions.reduce((ac, op) => { |
|
|
|
console.log('options', op, allValues, allValues.includes(op)) |
|
|
|
if (op?.id) { |
|
|
|
if (allValues.includes(op)) return true |
|
|
|
ac[op.id] = op |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ac |
|
|
|
|
|
|
|
}, {}) |
|
|
|
|
|
|
|
: {} |
|
|
|
|
|
|
|
const queryOptions = (route.query?.[c.title] as string)?.split(',') |
|
|
|
|
|
|
|
let options = ((c.colOptions || []) as SelectOptionsType).options |
|
|
|
|
|
|
|
.filter((op) => { |
|
|
|
|
|
|
|
if (queryOptions.includes(op?.title!) && (limitOptions[op?.id!] ? limitOptions[op?.id!]?.show : true)) return true |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
.map((op) => op.title) |
|
|
|
console.log('c', options, c) |
|
|
|
console.log('c', options, c) |
|
|
|
if (options.length) { |
|
|
|
if (options.length) { |
|
|
|
formState.value[c.title!] = c.uidt === UITypes.SingleSelect ? options[0] : options.join(',') |
|
|
|
formState.value[c.title] = c.uidt === UITypes.SingleSelect ? options[0] : options.join(',') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
console.log('form state', formState.value[c.title]) |
|
|
|
break |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
case UITypes.User: { |
|
|
|
case UITypes.User: { |
|
|
|
break |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
default: { |
|
|
|
default: { |
|
|
|
formState.value[c.title!] = route.query?.[c.label!] || route.query?.[c.title!] |
|
|
|
formState.value[c.title] = route.query?.[c.title] |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|