Browse Source

fix:missing data

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

Loading…
Cancel
Save