Browse Source

fix:missing data

pull/9906/head
DarkPhoenix2704 4 days ago
parent
commit
2c18060f50
  1. 21
      packages/nc-gui/components/cell/MultiSelect.vue

21
packages/nc-gui/components/cell/MultiSelect.vue

@ -63,19 +63,17 @@ const { isPg, isMysql } = useBase()
// temporary until it's add the option to column meta // temporary until it's add the option to column meta
const tempSelectedOptsState = reactive<string[]>([]) const tempSelectedOptsState = reactive<string[]>([])
const tempColumn = ref<ColumnType>(column.value)
const options = computed<(SelectOptionType & { value?: string })[]>(() => { const options = computed<(SelectOptionType & { value?: string })[]>(() => {
if (column?.value.colOptions) { if (column?.value.colOptions) {
const opts = tempColumn.value.colOptions const opts = column.value.colOptions
? (tempColumn.value.colOptions as SelectOptionsType).options.filter((el: SelectOptionType) => el.title !== '') || [] ? (column.value.colOptions as SelectOptionsType).options.filter((el: SelectOptionType) => el.title !== '') || []
: [] : []
for (const op of opts.filter((el: SelectOptionType) => el.order === null)) { for (const op of opts.filter((el: SelectOptionType) => el.order === null)) {
op.title = op.title?.replace(/^'/, '').replace(/'$/, '') op.title = op.title?.replace(/^'/, '').replace(/'$/, '')
} }
let order = 1 let order = 1
const limitOptionsById = const limitOptionsById =
((parseProp(tempColumn.value.meta)?.limitOptions || []).reduce( ((parseProp(column.value.meta)?.limitOptions || []).reduce(
(o: Record<string, FormFieldsLimitOptionsType>, f: FormFieldsLimitOptionsType) => { (o: Record<string, FormFieldsLimitOptionsType>, f: FormFieldsLimitOptionsType) => {
if (order < (f?.order ?? 0)) { if (order < (f?.order ?? 0)) {
order = f.order order = f.order
@ -91,8 +89,8 @@ const options = computed<(SelectOptionType & { value?: string })[]>(() => {
if ( if (
!isEditColumn.value && !isEditColumn.value &&
isForm.value && isForm.value &&
parseProp(tempColumn.value.meta)?.isLimitOption && parseProp(column.value.meta)?.isLimitOption &&
(parseProp(tempColumn.value.meta)?.limitOptions || []).length (parseProp(column.value.meta)?.limitOptions || []).length
) { ) {
return opts return opts
.filter((o: SelectOptionType) => { .filter((o: SelectOptionType) => {
@ -148,7 +146,7 @@ const selectedTitles = computed(() =>
modelValue modelValue
? Array.isArray(modelValue) ? Array.isArray(modelValue)
? modelValue ? modelValue
: isMysql(tempColumn.value.source_id) : isMysql(column.value.source_id)
? modelValue ? modelValue
.toString() .toString()
.split(',') .split(',')
@ -282,7 +280,8 @@ async function addIfMissingAndSave() {
updatedColMeta, updatedColMeta,
) )
tempColumn.value = data.columns.find((c) => c.id === column.value.id)
column.value.colOptions = data.columns.find((c) => c.id === column.value.id).colOptions
activeOptCreateInProgress.value-- activeOptCreateInProgress.value--
if (!activeOptCreateInProgress.value) { if (!activeOptCreateInProgress.value) {
@ -492,8 +491,8 @@ const onFocus = () => {
:key="op.id || op.title" :key="op.id || op.title"
:value="op.title" :value="op.title"
class="gap-2" class="gap-2"
:data-testid="`select-option-${tempColumn.title}-${location === 'filter' ? 'filter' : rowIndex}`" :data-testid="`select-option-${column.title}-${location === 'filter' ? 'filter' : rowIndex}`"
:class="`nc-select-option-${tempColumn.title}-${op.title}`" :class="`nc-select-option-${column.title}-${op.title}`"
@click.stop @click.stop
> >
<a-tag class="rounded-tag max-w-full" :color="op.color"> <a-tag class="rounded-tag max-w-full" :color="op.color">

Loading…
Cancel
Save