1
0
Fork 0
mirror of synced 2024-10-02 10:08:09 +13:00
This commit is contained in:
Martin McKeaveney 2020-03-26 21:22:32 +00:00
parent d48c311564
commit ee4972a030
2 changed files with 19 additions and 12 deletions

View file

@ -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>

View file

@ -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