Reorder api update (#2319)

* Added 'reorder' function to composition API

* Re-implemented reordering in Elements

* Make LAD table editable

* Remove test spec focus

* Fixing bugs with event listeners

* Clean up listeners properly in Elements pool

* Fixed race condition on drag-and-drop to initiate edit

* Implement reordering in LAD tables

* Reorder events emit full reorder plan

* Fixed failing specs
This commit is contained in:
Andrew Henry
2019-03-21 10:59:08 -07:00
committed by Deep Tailor
parent a14f628ca3
commit 019d108bb2
5 changed files with 50 additions and 23 deletions

View File

@ -66,10 +66,11 @@ export default {
this.items.splice(index, 1);
},
reorder(oldIndex, newIndex) {
let objectAtOldIndex = this.items[oldIndex];
this.$set(this.items, oldIndex, this.items[newIndex]);
this.$set(this.items, newIndex, objectAtOldIndex);
reorder(reorderPlan) {
let oldItems = this.items.slice();
reorderPlan.forEach((reorderEvent) => {
this.$set(this.items, reorderEvent.newIndex, oldItems[reorderEvent.oldIndex]);
});
}
},
mounted() {

View File

@ -93,11 +93,11 @@
this.primaryTelemetryObjects.splice(index,1);
primary = undefined;
},
reorderPrimary(oldIndex, newIndex) {
let objectAtOldIndex = this.primaryTelemetryObjects[oldIndex];
this.$set(this.primaryTelemetryObjects, oldIndex, this.primaryTelemetryObjects[newIndex]);
this.$set(this.primaryTelemetryObjects, newIndex, objectAtOldIndex);
reorderPrimary(reorderPlan) {
let oldComposition = this.primaryTelemetryObjects.slice();
reorderPlan.forEach(reorderEvent => {
this.$set(this.primaryTelemetryObjects, reorderEvent.newIndex, oldComposition[reorderEvent.oldIndex]);
});
},
addSecondary(primary) {
return (domainObject) => {