|
|
@ -30,11 +30,14 @@ export function getDefaultValue(item, data) { |
|
|
|
return typeof getValue === "function" ? getValue(item) : null; |
|
|
|
} |
|
|
|
|
|
|
|
export function reduceDefaultValue(formList, data) { |
|
|
|
export function reduceDefaultValue(formList, data, total = {}) { |
|
|
|
if (!Array.isArray(formList)) return null; |
|
|
|
|
|
|
|
return formList.reduce((prev, cur) => { |
|
|
|
if (cur?.key) |
|
|
|
if (cur?.type === "MultipleLabelItem") |
|
|
|
Array.isArray(cur.options?.options) && |
|
|
|
reduceDefaultValue(cur.options.options, data, prev); |
|
|
|
else if (cur?.key) |
|
|
|
pathSet( |
|
|
|
prev, |
|
|
|
cur.key, |
|
|
@ -43,5 +46,5 @@ export function reduceDefaultValue(formList, data) { |
|
|
|
// prev[cur.key] = getDefaultValue(cur, pathGet(data || {}, cur.key));
|
|
|
|
|
|
|
|
return prev; |
|
|
|
}, {}); |
|
|
|
}, total); |
|
|
|
} |
|
|
|