feat: support for insert more elements into control #306

This commit is contained in:
Hufe921
2023-11-03 21:23:52 +08:00
parent 7fb0150635
commit d2d649b011
12 changed files with 38 additions and 44 deletions
+10 -4
View File
@@ -538,7 +538,7 @@ export function zipElementList(payload: IElement[]): IElement[] {
}
dateElement.valueList = zipElementList(valueList)
element = dateElement
} else if (element.type === ElementType.CONTROL) {
} else if (element.controlId) {
// 控件处理
const controlId = element.controlId
const control = element.control!
@@ -555,8 +555,8 @@ export function zipElementList(payload: IElement[]): IElement[] {
break
}
if (controlE.controlComponent === ControlComponent.VALUE) {
delete controlE.type
delete controlE.control
delete controlE.controlId
valueList.push(controlE)
}
e++
@@ -837,8 +837,14 @@ export function createDomFromElementList(
TEXTLIKE_ELEMENT_TYPE.includes(element.type)
) {
let text = ''
if (element.type === ElementType.CONTROL) {
text = element.control!.value?.[0]?.value || ''
if (element.controlId) {
text =
element
.control!.value?.filter(
v => !v.type || TEXTLIKE_ELEMENT_TYPE.includes(v.type)
)
.map(v => v.value)
.join('') || ''
} else if (element.type === ElementType.DATE) {
text = element.valueList?.map(v => v.value).join('') || ''
} else {