|
1 | 1 | import React, { Component } from 'react'; |
2 | 2 | import { Spring } from 'react-spring/renderprops'; |
3 | | -import { SortableContainer, SortableElement, SortableHandle, arrayMove } from 'react-sortable-hoc'; |
| 3 | +import { SortableContainer, SortableElement, SortableHandle } from 'react-sortable-hoc'; |
| 4 | +import arrayMove from 'array-move'; |
4 | 5 | import { mappingState } from './state'; |
5 | 6 | import { environment } from '#store/environment'; |
6 | 7 | import { observer } from 'mobx-react'; |
@@ -110,20 +111,26 @@ const SortableMappingItem = SortableElement(observer(({mapping, mappingIndex}) = |
110 | 111 | </div> |
111 | 112 | ))); |
112 | 113 |
|
113 | | -const SortableMappingList = SortableContainer(observer(({items}) => { |
114 | | - return ( |
115 | | - <div> |
116 | | - {items.map((mapping, index) => ( |
117 | | - <SortableMappingItem |
118 | | - key={`item-${index}`} |
119 | | - index={index} |
120 | | - mapping={mapping} |
121 | | - mappingIndex={index} |
122 | | - /> |
123 | | - ))} |
124 | | - </div> |
125 | | - ); |
126 | | -}), {withRef: true}); |
| 114 | +const SortableMappingList = SortableContainer( |
| 115 | + observer(class extends Component { |
| 116 | + render() { |
| 117 | + const { items } = this.props; |
| 118 | + return ( |
| 119 | + <div> |
| 120 | + {items.map((mapping, index) => ( |
| 121 | + <SortableMappingItem |
| 122 | + key={`item-${index}`} |
| 123 | + index={index} |
| 124 | + mapping={mapping} |
| 125 | + mappingIndex={index} |
| 126 | + /> |
| 127 | + ))} |
| 128 | + </div> |
| 129 | + ); |
| 130 | + } |
| 131 | + }), |
| 132 | + {withRef: true} |
| 133 | +); |
127 | 134 |
|
128 | 135 | // dplcs |
129 | 136 |
|
@@ -172,20 +179,26 @@ const SortableDPLCItem = SortableElement(observer(({dplc, dplcIndex}) => ( |
172 | 179 | </div> |
173 | 180 | ))); |
174 | 181 |
|
175 | | -const SortableDPLCList = SortableContainer(observer(({items}) => { |
176 | | - return ( |
177 | | - <div> |
178 | | - {items.map((dplc, index) => ( |
179 | | - <SortableDPLCItem |
180 | | - key={`item-${index}`} |
181 | | - index={index} |
182 | | - dplc={dplc} |
183 | | - dplcIndex={index} |
184 | | - /> |
185 | | - ))} |
186 | | - </div> |
187 | | - ); |
188 | | -}), {withRef: true}); |
| 182 | +const SortableDPLCList = SortableContainer( |
| 183 | + observer(class extends Component { |
| 184 | + render() { |
| 185 | + const { items } = this.props; |
| 186 | + return ( |
| 187 | + <div> |
| 188 | + {items.map((dplc, index) => ( |
| 189 | + <SortableDPLCItem |
| 190 | + key={`item-${index}`} |
| 191 | + index={index} |
| 192 | + dplc={dplc} |
| 193 | + dplcIndex={index} |
| 194 | + /> |
| 195 | + ))} |
| 196 | + </div> |
| 197 | + ); |
| 198 | + } |
| 199 | + }), |
| 200 | + {withRef: true} |
| 201 | +); |
189 | 202 |
|
190 | 203 | @observer |
191 | 204 | export class RawEditor extends Component { |
|
0 commit comments