removed sortable list
parent
951015c543
commit
576d61b0e2
|
|
@ -6,11 +6,6 @@ import {
|
|||
Input,
|
||||
Image
|
||||
} from 'semantic-ui-react';
|
||||
import {
|
||||
SortableContainer,
|
||||
SortableElement,
|
||||
arrayMove
|
||||
} from 'react-sortable-hoc';
|
||||
|
||||
class LexSingleInput extends React.Component<any, any> {
|
||||
public render() {
|
||||
|
|
@ -94,34 +89,12 @@ export function imagePreview(params: any) {
|
|||
) : textInput(params);
|
||||
}
|
||||
|
||||
const SortableItem = SortableElement<any>(({ value }) =>
|
||||
<li>{value}</li>
|
||||
);
|
||||
|
||||
const SortableList = SortableContainer<any>(({ items }) => {
|
||||
return (
|
||||
<ul>
|
||||
{items.map((value: any, index: any) => (
|
||||
<SortableItem key={`item-${index}`} index={index} value={value.value} />
|
||||
))}
|
||||
</ul>
|
||||
);
|
||||
});
|
||||
|
||||
export function listInput(params: any) {
|
||||
let { field, value, changed } = params;
|
||||
let sortEndHandler = (idxs: any) => {
|
||||
let { oldIndex, newIndex } = idxs;
|
||||
arrayMove(value, oldIndex, newIndex);
|
||||
};
|
||||
console.log('field: ', field, 'value: ', value);
|
||||
return (
|
||||
<LexSingleInput key={field} label={changedLabel(changed, field)}>
|
||||
<SortableList
|
||||
items={value}
|
||||
onSortEnd={sortEndHandler}
|
||||
helperClass="SortableHelper"
|
||||
/>
|
||||
<pre>{JSON.stringify(value)}</pre>
|
||||
</LexSingleInput>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue