Browse Source

fix: update after reorder in fields tab

pull/6540/head
DarkPhoenix2704 1 year ago
parent
commit
39c1a3169e
  1. 17
      packages/nc-gui/components/smartsheet/details/Fields.vue

17
packages/nc-gui/components/smartsheet/details/Fields.vue

@ -258,13 +258,25 @@ const onFieldUpdate = (state: TableExplorerColumn) => {
ops.value = ops.value.filter((op) => op.op === 'add' || !compareCols(op.column, state))
} else {
const field = ops.value.find((op) => compareCols(op.column, state))
if (field) {
const movField = moveOps.value.find((op) => compareCols(op.column, state))
if (field && !movField) {
field.column = state
} else {
} else if (!field && movField) {
ops.value.push({
op: 'update',
column: state,
})
} else {
ops.value.push({
op: 'update',
column: {
...state,
column_order: {
order: movField?.order || getFieldOrder(state),
view_id: view.value?.id as string,
},
},
})
}
}
}
@ -371,6 +383,7 @@ const recoverField = (state: TableExplorerColumn) => {
ops.value = ops.value.filter((op) => !compareCols(op.column, state))
} else if (field.op === 'update') {
ops.value = ops.value.filter((op) => !compareCols(op.column, state))
moveOps.value = moveOps.value.filter((op) => !compareCols(op.column, state))
}
activeField.value = null
changeField(fields.value.filter((fiel) => fiel.id === state.id)[0])

Loading…
Cancel
Save