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)) ops.value = ops.value.filter((op) => op.op === 'add' || !compareCols(op.column, state))
} else { } else {
const field = ops.value.find((op) => compareCols(op.column, state)) 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 field.column = state
} else { } else if (!field && movField) {
ops.value.push({ ops.value.push({
op: 'update', op: 'update',
column: state, 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)) ops.value = ops.value.filter((op) => !compareCols(op.column, state))
} else if (field.op === 'update') { } else if (field.op === 'update') {
ops.value = ops.value.filter((op) => !compareCols(op.column, state)) ops.value = ops.value.filter((op) => !compareCols(op.column, state))
moveOps.value = moveOps.value.filter((op) => !compareCols(op.column, state))
} }
activeField.value = null activeField.value = null
changeField(fields.value.filter((fiel) => fiel.id === state.id)[0]) changeField(fields.value.filter((fiel) => fiel.id === state.id)[0])

Loading…
Cancel
Save