feat: add getControlList api #455
This commit is contained in:
@@ -212,6 +212,16 @@ const {
|
|||||||
} = await instance.command.getControlValue(payload: IGetControlValueOption)
|
} = await instance.command.getControlValue(payload: IGetControlValueOption)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## getControlList
|
||||||
|
|
||||||
|
Feature: Get control list
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const controlList = await instance.command.getControlList()
|
||||||
|
```
|
||||||
|
|
||||||
## getContainer
|
## getContainer
|
||||||
|
|
||||||
Feature: Get editor container
|
Feature: Get editor container
|
||||||
|
|||||||
@@ -212,6 +212,16 @@ const {
|
|||||||
} = await instance.command.getControlValue(payload: IGetControlValueOption)
|
} = await instance.command.getControlValue(payload: IGetControlValueOption)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## getControlList
|
||||||
|
|
||||||
|
功能:获取所有控件
|
||||||
|
|
||||||
|
用法:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const controlList = await instance.command.getControlList()
|
||||||
|
```
|
||||||
|
|
||||||
## getContainer
|
## getContainer
|
||||||
|
|
||||||
功能:获取编辑器容器
|
功能:获取编辑器容器
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ export class Command {
|
|||||||
public getLocale: CommandAdapt['getLocale']
|
public getLocale: CommandAdapt['getLocale']
|
||||||
public getGroupIds: CommandAdapt['getGroupIds']
|
public getGroupIds: CommandAdapt['getGroupIds']
|
||||||
public getControlValue: CommandAdapt['getControlValue']
|
public getControlValue: CommandAdapt['getControlValue']
|
||||||
|
public getControlList: CommandAdapt['getControlList']
|
||||||
public getContainer: CommandAdapt['getContainer']
|
public getContainer: CommandAdapt['getContainer']
|
||||||
|
|
||||||
constructor(adapt: CommandAdapt) {
|
constructor(adapt: CommandAdapt) {
|
||||||
@@ -228,5 +229,6 @@ export class Command {
|
|||||||
this.executeSetControlProperties = adapt.setControlProperties.bind(adapt)
|
this.executeSetControlProperties = adapt.setControlProperties.bind(adapt)
|
||||||
this.executeSetControlHighlight = adapt.setControlHighlight.bind(adapt)
|
this.executeSetControlHighlight = adapt.setControlHighlight.bind(adapt)
|
||||||
this.getControlValue = adapt.getControlValue.bind(adapt)
|
this.getControlValue = adapt.getControlValue.bind(adapt)
|
||||||
|
this.getControlList = adapt.getControlList.bind(adapt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2388,6 +2388,10 @@ export class CommandAdapt {
|
|||||||
this.draw.getControl().setHighlightList(payload)
|
this.draw.getControl().setHighlightList(payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getControlList(): IElement[] {
|
||||||
|
return this.draw.getControl().getList()
|
||||||
|
}
|
||||||
|
|
||||||
public getContainer(): HTMLDivElement {
|
public getContainer(): HTMLDivElement {
|
||||||
return this.draw.getContainer()
|
return this.draw.getContainer()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -752,4 +752,22 @@ export class Control {
|
|||||||
isSetCursor: false
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user