mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-21 03:55:23 -04:00
@@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import DefaultComponent from "./test/pages/DefaultComponent.ets"
|
||||
import DefaultComponent from "./DefaultComponent.ets"
|
||||
|
||||
@Component
|
||||
struct ExportComponent1 {
|
||||
|
||||
@@ -13,4 +13,4 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * as AllStarComponent from './test/pages/ExportComponent';
|
||||
export * as AllStarComponent from './ExportComponent';
|
||||
|
||||
@@ -14,73 +14,135 @@
|
||||
*/
|
||||
|
||||
exports.source = `
|
||||
@Builder
|
||||
function SquareText(label: string, size: number) {
|
||||
Text(label)
|
||||
.width(1 * size).height(1 * size)
|
||||
}
|
||||
|
||||
@Builder
|
||||
function bb() {
|
||||
Text("label")
|
||||
}
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct HomeComponent {
|
||||
size = 1
|
||||
|
||||
@Builder aa(label: string) {
|
||||
Text(label)
|
||||
struct CompA {
|
||||
size: number = 100;
|
||||
@State customPopupArrow: boolean = false
|
||||
@Builder SquareText(label: string){
|
||||
Text(label)
|
||||
.width(1 * this.size)
|
||||
.height(1 * this.size)
|
||||
}
|
||||
@Builder RowOfSquareTexts (label1: string, label2: string){
|
||||
Row(){
|
||||
this.SquareText(label1)
|
||||
this.SquareText(label2)
|
||||
}
|
||||
.width(1 * this.size)
|
||||
.height(1 * this.size)
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
bb()
|
||||
SquareText("A", this.size)
|
||||
this.aa("A")
|
||||
@Builder popupBuilder() {
|
||||
Flex({direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItem: ItemAlign.Center}){
|
||||
Text('Content of CustomPopup')
|
||||
.fontSize(20)
|
||||
}
|
||||
.width(100)
|
||||
.height(50)
|
||||
}
|
||||
|
||||
build(){
|
||||
Column(){
|
||||
Row(){
|
||||
this.SquareText("A")
|
||||
this.SquareText("B")
|
||||
}
|
||||
.width(2 * this.size)
|
||||
.height(1 * this.size)
|
||||
.bindPopup(this.customPopupArrow, {
|
||||
builder: this.popupBuilder,
|
||||
placement: Placement.Bottom,
|
||||
maskColor: 0x01000000,
|
||||
popupColor: Color.Red,
|
||||
enableArrow: true,
|
||||
onStateChange: (e) => {
|
||||
if(!e.isVisible){
|
||||
this.customPopupArrow = false
|
||||
}
|
||||
}
|
||||
})
|
||||
this.RowOfSquareTexts("C", "D")
|
||||
}
|
||||
.height(500)
|
||||
.width(2 * this.size)
|
||||
.height(2 * this.size)
|
||||
}
|
||||
}`
|
||||
|
||||
exports.expectResult =
|
||||
`function SquareText(label, size) {
|
||||
Text.create(label);
|
||||
Text.width(1 * size);
|
||||
Text.height(1 * size);
|
||||
Text.pop();
|
||||
}
|
||||
function bb() {
|
||||
Text.create("label");
|
||||
Text.pop();
|
||||
}
|
||||
class HomeComponent extends View {
|
||||
`class CompA extends View {
|
||||
constructor(compilerAssignedUniqueChildId, parent, params) {
|
||||
super(compilerAssignedUniqueChildId, parent);
|
||||
this.size = 1;
|
||||
this.size = 100;
|
||||
this.__customPopupArrow = new ObservedPropertySimple(false, this, "customPopupArrow");
|
||||
this.updateWithValueParams(params);
|
||||
}
|
||||
updateWithValueParams(params) {
|
||||
if (params.size !== undefined) {
|
||||
this.size = params.size;
|
||||
}
|
||||
if (params.customPopupArrow !== undefined) {
|
||||
this.customPopupArrow = params.customPopupArrow;
|
||||
}
|
||||
}
|
||||
aboutToBeDeleted() {
|
||||
this.__customPopupArrow.aboutToBeDeleted();
|
||||
SubscriberManager.Get().delete(this.id());
|
||||
}
|
||||
aa(label) {
|
||||
get customPopupArrow() {
|
||||
return this.__customPopupArrow.get();
|
||||
}
|
||||
set customPopupArrow(newValue) {
|
||||
this.__customPopupArrow.set(newValue);
|
||||
}
|
||||
SquareText(label) {
|
||||
Text.create(label);
|
||||
Text.width(1 * this.size);
|
||||
Text.height(1 * this.size);
|
||||
Text.pop();
|
||||
}
|
||||
RowOfSquareTexts(label1, label2) {
|
||||
Row.create();
|
||||
Row.width(1 * this.size);
|
||||
Row.height(1 * this.size);
|
||||
this.SquareText(label1);
|
||||
this.SquareText(label2);
|
||||
Row.pop();
|
||||
}
|
||||
popupBuilder() {
|
||||
Flex.create({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItem: ItemAlign.Center });
|
||||
Flex.width(100);
|
||||
Flex.height(50);
|
||||
Text.create('Content of CustomPopup');
|
||||
Text.fontSize(20);
|
||||
Text.pop();
|
||||
Flex.pop();
|
||||
}
|
||||
render() {
|
||||
Column.create();
|
||||
Column.height(500);
|
||||
bb();
|
||||
SquareText("A", this.size);
|
||||
this.aa("A");
|
||||
Column.width(2 * this.size);
|
||||
Column.height(2 * this.size);
|
||||
Row.create();
|
||||
Row.width(2 * this.size);
|
||||
Row.height(1 * this.size);
|
||||
Row.bindPopup(this.customPopupArrow, {
|
||||
builder: { builder: this.popupBuilder.bind(this) },
|
||||
placement: Placement.Bottom,
|
||||
maskColor: 0x01000000,
|
||||
popupColor: Color.Red,
|
||||
enableArrow: true,
|
||||
onStateChange: (e) => {
|
||||
if (!e.isVisible) {
|
||||
this.customPopupArrow = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
this.SquareText("A");
|
||||
this.SquareText("B");
|
||||
Row.pop();
|
||||
this.RowOfSquareTexts("C", "D");
|
||||
Column.pop();
|
||||
}
|
||||
}
|
||||
loadDocument(new HomeComponent("1", undefined, {}));
|
||||
loadDocument(new CompA("1", undefined, {}));
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user