107ac75b1Sopenharmony_ci/* 207ac75b1Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 307ac75b1Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 407ac75b1Sopenharmony_ci * you may not use this file except in compliance with the License. 507ac75b1Sopenharmony_ci * You may obtain a copy of the License at 607ac75b1Sopenharmony_ci * 707ac75b1Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 807ac75b1Sopenharmony_ci * 907ac75b1Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1007ac75b1Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1107ac75b1Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1207ac75b1Sopenharmony_ci * See the License for the specific language governing permissions and 1307ac75b1Sopenharmony_ci * limitations under the License. 1407ac75b1Sopenharmony_ci */ 1507ac75b1Sopenharmony_ci 1607ac75b1Sopenharmony_ciexports.source = ` 1707ac75b1Sopenharmony_ciimport { AllStarComponent } from './test/pages/ExportStarComponent' 1807ac75b1Sopenharmony_ciimport TsModule from './test/pages/TsModule' 1907ac75b1Sopenharmony_ci 2007ac75b1Sopenharmony_ci@Entry 2107ac75b1Sopenharmony_ci@Component 2207ac75b1Sopenharmony_cistruct ImportTest { 2307ac75b1Sopenharmony_ci @State myState1: any = new TsModule(1).method(); 2407ac75b1Sopenharmony_ci @State myState2: number = 0 2507ac75b1Sopenharmony_ci @State myState3: boolean = false 2607ac75b1Sopenharmony_ci @State myState4: string = 'ImportTest' 2707ac75b1Sopenharmony_ci 2807ac75b1Sopenharmony_ci build() { 2907ac75b1Sopenharmony_ci Column() { 3007ac75b1Sopenharmony_ci AllStarComponent.ExportComponent({ 3107ac75b1Sopenharmony_ci ExportComponent1Link1: $myState1, 3207ac75b1Sopenharmony_ci ExportComponent1Link2: $myState2, 3307ac75b1Sopenharmony_ci ExportComponent1Link3: $myState3, 3407ac75b1Sopenharmony_ci ExportComponent1Link4: $myState4, 3507ac75b1Sopenharmony_ci indexState1: { count: 1 }, 3607ac75b1Sopenharmony_ci indexState2: 1, 3707ac75b1Sopenharmony_ci indexState3: true, 3807ac75b1Sopenharmony_ci indexState4: 'ExportComponent1' 3907ac75b1Sopenharmony_ci }) 4007ac75b1Sopenharmony_ci AllStarComponent.default({ 4107ac75b1Sopenharmony_ci ExportComponent4Link1: $myState1, 4207ac75b1Sopenharmony_ci ExportComponent4Link2: $myState2, 4307ac75b1Sopenharmony_ci ExportComponent4Link3: $myState3, 4407ac75b1Sopenharmony_ci ExportComponent4Link4: $myState4, 4507ac75b1Sopenharmony_ci indexState1: { count: 1 }, 4607ac75b1Sopenharmony_ci indexState2: 1, 4707ac75b1Sopenharmony_ci indexState3: true, 4807ac75b1Sopenharmony_ci indexState4: 'ExportComponent4' 4907ac75b1Sopenharmony_ci }) 5007ac75b1Sopenharmony_ci } 5107ac75b1Sopenharmony_ci } 5207ac75b1Sopenharmony_ci} 5307ac75b1Sopenharmony_ci` 5407ac75b1Sopenharmony_ci 5507ac75b1Sopenharmony_ciexports.expectResult = 5607ac75b1Sopenharmony_ci`"use strict"; 5707ac75b1Sopenharmony_civar __importDefault = (this && this.__importDefault) || function (mod) { 5807ac75b1Sopenharmony_ci return (mod && mod.__esModule) ? mod : { "default": mod }; 5907ac75b1Sopenharmony_ci}; 6007ac75b1Sopenharmony_ciObject.defineProperty(exports, "__esModule", { value: true }); 6107ac75b1Sopenharmony_cilet __generate__Id = 0; 6207ac75b1Sopenharmony_cifunction generateId() { 6307ac75b1Sopenharmony_ci return "importTs_" + ++__generate__Id; 6407ac75b1Sopenharmony_ci} 6507ac75b1Sopenharmony_ciconst ExportStarComponent_1 = require("./test/pages/ExportStarComponent"); 6607ac75b1Sopenharmony_ciconst TsModule_1 = __importDefault(require("./test/pages/TsModule")); 6707ac75b1Sopenharmony_ciclass ImportTest extends View { 6807ac75b1Sopenharmony_ci constructor(compilerAssignedUniqueChildId, parent, params, localStorage) { 6907ac75b1Sopenharmony_ci super(compilerAssignedUniqueChildId, parent, localStorage); 7007ac75b1Sopenharmony_ci this.__myState1 = new ObservedPropertyObject(new TsModule_1.default(1).method(), this, "myState1"); 7107ac75b1Sopenharmony_ci this.__myState2 = new ObservedPropertySimple(0, this, "myState2"); 7207ac75b1Sopenharmony_ci this.__myState3 = new ObservedPropertySimple(false, this, "myState3"); 7307ac75b1Sopenharmony_ci this.__myState4 = new ObservedPropertySimple('ImportTest', this, "myState4"); 7407ac75b1Sopenharmony_ci this.updateWithValueParams(params); 7507ac75b1Sopenharmony_ci } 7607ac75b1Sopenharmony_ci updateWithValueParams(params) { 7707ac75b1Sopenharmony_ci if (params.myState1 !== undefined) { 7807ac75b1Sopenharmony_ci this.myState1 = params.myState1; 7907ac75b1Sopenharmony_ci } 8007ac75b1Sopenharmony_ci if (params.myState2 !== undefined) { 8107ac75b1Sopenharmony_ci this.myState2 = params.myState2; 8207ac75b1Sopenharmony_ci } 8307ac75b1Sopenharmony_ci if (params.myState3 !== undefined) { 8407ac75b1Sopenharmony_ci this.myState3 = params.myState3; 8507ac75b1Sopenharmony_ci } 8607ac75b1Sopenharmony_ci if (params.myState4 !== undefined) { 8707ac75b1Sopenharmony_ci this.myState4 = params.myState4; 8807ac75b1Sopenharmony_ci } 8907ac75b1Sopenharmony_ci } 9007ac75b1Sopenharmony_ci aboutToBeDeleted() { 9107ac75b1Sopenharmony_ci this.__myState1.aboutToBeDeleted(); 9207ac75b1Sopenharmony_ci this.__myState2.aboutToBeDeleted(); 9307ac75b1Sopenharmony_ci this.__myState3.aboutToBeDeleted(); 9407ac75b1Sopenharmony_ci this.__myState4.aboutToBeDeleted(); 9507ac75b1Sopenharmony_ci SubscriberManager.Get().delete(this.id()); 9607ac75b1Sopenharmony_ci } 9707ac75b1Sopenharmony_ci get myState1() { 9807ac75b1Sopenharmony_ci return this.__myState1.get(); 9907ac75b1Sopenharmony_ci } 10007ac75b1Sopenharmony_ci set myState1(newValue) { 10107ac75b1Sopenharmony_ci this.__myState1.set(newValue); 10207ac75b1Sopenharmony_ci } 10307ac75b1Sopenharmony_ci get myState2() { 10407ac75b1Sopenharmony_ci return this.__myState2.get(); 10507ac75b1Sopenharmony_ci } 10607ac75b1Sopenharmony_ci set myState2(newValue) { 10707ac75b1Sopenharmony_ci this.__myState2.set(newValue); 10807ac75b1Sopenharmony_ci } 10907ac75b1Sopenharmony_ci get myState3() { 11007ac75b1Sopenharmony_ci return this.__myState3.get(); 11107ac75b1Sopenharmony_ci } 11207ac75b1Sopenharmony_ci set myState3(newValue) { 11307ac75b1Sopenharmony_ci this.__myState3.set(newValue); 11407ac75b1Sopenharmony_ci } 11507ac75b1Sopenharmony_ci get myState4() { 11607ac75b1Sopenharmony_ci return this.__myState4.get(); 11707ac75b1Sopenharmony_ci } 11807ac75b1Sopenharmony_ci set myState4(newValue) { 11907ac75b1Sopenharmony_ci this.__myState4.set(newValue); 12007ac75b1Sopenharmony_ci } 12107ac75b1Sopenharmony_ci render() { 12207ac75b1Sopenharmony_ci Column.create(); 12307ac75b1Sopenharmony_ci let earlierCreatedChild_2 = (this && this.findChildById) ? this.findChildById("2") : undefined; 12407ac75b1Sopenharmony_ci if (earlierCreatedChild_2 == undefined) { 12507ac75b1Sopenharmony_ci View.create(new ExportStarComponent_1.AllStarComponent.ExportComponent("2", this, { 12607ac75b1Sopenharmony_ci ExportComponent1Link1: this.__myState1, 12707ac75b1Sopenharmony_ci ExportComponent1Link2: this.__myState2, 12807ac75b1Sopenharmony_ci ExportComponent1Link3: this.__myState3, 12907ac75b1Sopenharmony_ci ExportComponent1Link4: this.__myState4, 13007ac75b1Sopenharmony_ci indexState1: { count: 1 }, 13107ac75b1Sopenharmony_ci indexState2: 1, 13207ac75b1Sopenharmony_ci indexState3: true, 13307ac75b1Sopenharmony_ci indexState4: 'ExportComponent1' 13407ac75b1Sopenharmony_ci })); 13507ac75b1Sopenharmony_ci } 13607ac75b1Sopenharmony_ci else { 13707ac75b1Sopenharmony_ci earlierCreatedChild_2.updateWithValueParams({ 13807ac75b1Sopenharmony_ci indexState1: { count: 1 }, 13907ac75b1Sopenharmony_ci indexState2: 1, 14007ac75b1Sopenharmony_ci indexState3: true, 14107ac75b1Sopenharmony_ci indexState4: 'ExportComponent1' 14207ac75b1Sopenharmony_ci }); 14307ac75b1Sopenharmony_ci View.create(earlierCreatedChild_2); 14407ac75b1Sopenharmony_ci } 14507ac75b1Sopenharmony_ci let earlierCreatedChild_3 = (this && this.findChildById) ? this.findChildById("3") : undefined; 14607ac75b1Sopenharmony_ci if (earlierCreatedChild_3 == undefined) { 14707ac75b1Sopenharmony_ci View.create(new ExportStarComponent_1.AllStarComponent.default("3", this, { 14807ac75b1Sopenharmony_ci ExportComponent4Link1: this.__myState1, 14907ac75b1Sopenharmony_ci ExportComponent4Link2: this.__myState2, 15007ac75b1Sopenharmony_ci ExportComponent4Link3: this.__myState3, 15107ac75b1Sopenharmony_ci ExportComponent4Link4: this.__myState4, 15207ac75b1Sopenharmony_ci indexState1: { count: 1 }, 15307ac75b1Sopenharmony_ci indexState2: 1, 15407ac75b1Sopenharmony_ci indexState3: true, 15507ac75b1Sopenharmony_ci indexState4: 'ExportComponent4' 15607ac75b1Sopenharmony_ci })); 15707ac75b1Sopenharmony_ci } 15807ac75b1Sopenharmony_ci else { 15907ac75b1Sopenharmony_ci earlierCreatedChild_3.updateWithValueParams({ 16007ac75b1Sopenharmony_ci indexState1: { count: 1 }, 16107ac75b1Sopenharmony_ci indexState2: 1, 16207ac75b1Sopenharmony_ci indexState3: true, 16307ac75b1Sopenharmony_ci indexState4: 'ExportComponent4' 16407ac75b1Sopenharmony_ci }); 16507ac75b1Sopenharmony_ci View.create(earlierCreatedChild_3); 16607ac75b1Sopenharmony_ci } 16707ac75b1Sopenharmony_ci Column.pop(); 16807ac75b1Sopenharmony_ci } 16907ac75b1Sopenharmony_ci} 17007ac75b1Sopenharmony_ciloadDocument(new ImportTest("1", undefined, {})); 17107ac75b1Sopenharmony_ci` 172