|
|
@ -193,17 +193,21 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** Swap column in either direction (+1 or -1) */ |
|
|
|
/** Move a column (dir is positive or negative) */ |
|
|
|
move (pos1, dir) { |
|
|
|
move (pos1, dir) { |
|
|
|
let pos2 = pos1 + dir |
|
|
|
let pos2 = pos1 + dir |
|
|
|
if (pos2 < 0 || pos2 >= this.columns.length) { |
|
|
|
|
|
|
|
console.warn(`Attempted to move out of bounds (${pos1} -> ${pos2})`) |
|
|
|
// clamp |
|
|
|
return; |
|
|
|
if (pos2 < 0) { |
|
|
|
|
|
|
|
pos2 = 0 |
|
|
|
|
|
|
|
} else if (pos2 >= this.columns.length) { |
|
|
|
|
|
|
|
pos2 = this.columns.length - 1 |
|
|
|
} |
|
|
|
} |
|
|
|
let col1 = this.columns[pos1] |
|
|
|
|
|
|
|
let col2 = this.columns[pos2] |
|
|
|
let columns = this.columns |
|
|
|
this.$set(this.columns, pos1, col2) |
|
|
|
let col1 = columns.splice(pos1, 1)[0] // unwrap returned 1-element array |
|
|
|
this.$set(this.columns, pos2, col1) |
|
|
|
columns.splice(pos2, 0, col1) |
|
|
|
|
|
|
|
this.columns = columns |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** Indicate a column is dirty and needs saving */ |
|
|
|
/** Indicate a column is dirty and needs saving */ |
|
|
|