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