tidy up
This commit is contained in:
parent
d48c311564
commit
ee4972a030
|
@ -11,7 +11,6 @@
|
|||
import DatePicker from "../common/DatePicker.svelte"
|
||||
import {
|
||||
cloneDeep,
|
||||
assign,
|
||||
keys,
|
||||
isNumber,
|
||||
includes,
|
||||
|
@ -60,7 +59,7 @@
|
|||
errors = validate.field(allFields)(clonedField)
|
||||
if (errors.length > 0) return
|
||||
field.typeOptions = cloneDeep(clonedField.typeOptions)
|
||||
onFinished(assign(field)(clonedField))
|
||||
onFinished({ ...clonedField, ...field })
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -7,7 +7,17 @@
|
|||
import getIcon from "../common/icon"
|
||||
import FieldView from "./FieldView.svelte"
|
||||
import Modal from "../common/Modal.svelte"
|
||||
import { map, join, filter, some, find, keys, isDate } from "lodash/fp"
|
||||
import {
|
||||
get,
|
||||
compose,
|
||||
map,
|
||||
join,
|
||||
filter,
|
||||
some,
|
||||
find,
|
||||
keys,
|
||||
isDate,
|
||||
} from "lodash/fp"
|
||||
import { store, backendUiStore } from "../builderStore"
|
||||
import { common, hierarchy } from "../../../core/src"
|
||||
import { getNode } from "../common/core"
|
||||
|
@ -37,15 +47,13 @@
|
|||
store.subscribe($store => {
|
||||
record = $store.currentNode
|
||||
const flattened = hierarchy.getFlattenedHierarchy($store.hierarchy)
|
||||
getIndexAllowedRecords = index =>
|
||||
pipe(
|
||||
index.allowedRecordNodeIds,
|
||||
[
|
||||
filter(id => some(n => n.nodeId === id)(flattened)),
|
||||
map(id => find(n => n.nodeId === id)(flattened).name),
|
||||
join(", "),
|
||||
]
|
||||
)
|
||||
|
||||
getIndexAllowedRecords = compose(
|
||||
join(", "),
|
||||
map(id => flattened.find(n => n.nodeId === id).name),
|
||||
filter(id => flattened.some(n => n.nodeId === id)),
|
||||
get("allowedRecordNodeIds")
|
||||
)
|
||||
|
||||
newField = () => {
|
||||
isNewField = true
|
||||
|
|
Loading…
Reference in New Issue