feat: add getControlList api #455

This commit is contained in:
Hufe921
2024-03-14 20:38:47 +08:00
parent 788f96aa89
commit 0523fc257a
5 changed files with 44 additions and 0 deletions
+2
View File
@@ -108,6 +108,7 @@ export class Command {
public getLocale: CommandAdapt['getLocale']
public getGroupIds: CommandAdapt['getGroupIds']
public getControlValue: CommandAdapt['getControlValue']
public getControlList: CommandAdapt['getControlList']
public getContainer: CommandAdapt['getContainer']
constructor(adapt: CommandAdapt) {
@@ -228,5 +229,6 @@ export class Command {
this.executeSetControlProperties = adapt.setControlProperties.bind(adapt)
this.executeSetControlHighlight = adapt.setControlHighlight.bind(adapt)
this.getControlValue = adapt.getControlValue.bind(adapt)
this.getControlList = adapt.getControlList.bind(adapt)
}
}
+4
View File
@@ -2388,6 +2388,10 @@ export class CommandAdapt {
this.draw.getControl().setHighlightList(payload)
}
public getControlList(): IElement[] {
return this.draw.getControl().getList()
}
public getContainer(): HTMLDivElement {
return this.draw.getContainer()
}
+18
View File
@@ -752,4 +752,22 @@ export class Control {
isSetCursor: false
})
}
public getList(): IElement[] {
const data = [
this.draw.getHeader().getElementList(),
this.draw.getOriginalMainElementList(),
this.draw.getFooter().getElementList()
]
const controlElementList: IElement[] = []
for (const elementList of data) {
for (let e = 0; e < elementList.length; e++) {
const element = elementList[e]
if (element.controlId) {
controlElementList.push(element)
}
}
}
return zipElementList(controlElementList)
}
}