|
@@ -287,11 +287,9 @@ const ForeignAutocomplete = ({models={}, children:value, onChange, model, exclud
|
|
|
}}
|
|
|
value={value && {value: value._id, label: shortName(value), record: value}}
|
|
|
onChange={(obj) => {
|
|
|
- debugger;
|
|
|
onChange(obj.record._id ? obj.record : null)
|
|
|
}}
|
|
|
/>
|
|
|
-
|
|
|
)
|
|
|
}
|
|
|
|
|
@@ -344,20 +342,23 @@ const defaultAdminOptions =
|
|
|
return model.fields[0].name === '_id' ? <ObjectShortEdit children={children} model={model} {...props}/> : <EditForm models={models} record={children} options={options} />
|
|
|
},
|
|
|
Array: ({children, onChange, ...props}) => {
|
|
|
- return (<><SortableContainer onSortEnd={({newIndex, oldIndex}) => {
|
|
|
- onChange(arrayMove(children, newIndex, oldIndex))
|
|
|
+ return (<><SortableContainer
|
|
|
+ pressDelay={200}
|
|
|
+ onSortEnd={({newIndex, oldIndex}) => {
|
|
|
+ onChange(arrayMove(children, newIndex, oldIndex))
|
|
|
}}>{children.map((child, i) =>
|
|
|
- <SortableCell onDelete={() => onChange(children.filter((item, j) => j !== i))}
|
|
|
- onAdd={() => onChange([...children.slice(0, i),null,...children.slice(i)])}
|
|
|
- index={i} key={(child && (child._id || child.key)) || i} {...props} children={child} selected
|
|
|
- onCh={data => {
|
|
|
- const copy = [...children]
|
|
|
- debugger;
|
|
|
- copy[i] = (data && data.target && data.target.value) || data
|
|
|
- onChange(copy)
|
|
|
- }}
|
|
|
- />)}
|
|
|
- </SortableContainer><button onClick={() => onChange([...children, null])}>+</button></>)
|
|
|
+ <SortableCell onDelete={() => onChange(children.filter((item, j) => j !== i))}
|
|
|
+ onAdd={() => onChange([...children.slice(0, i),null,...children.slice(i)])}
|
|
|
+ index={i} key={(child && (child._id || child.key)) || i} {...props} children={child} selected
|
|
|
+ onCh={data => {
|
|
|
+ const copy = [...children]
|
|
|
+ debugger;
|
|
|
+ copy[i] = (data && data.target && data.target.value) || data
|
|
|
+ onChange(copy)
|
|
|
+ }}
|
|
|
+ />)}
|
|
|
+ </SortableContainer>
|
|
|
+ <button onClick={() => onChange([...children, null])}>+</button></>)
|
|
|
}
|
|
|
},
|
|
|
fields:{
|