123b3eb3cSopenharmony_ci/* 223b3eb3cSopenharmony_ci * Copyright (c) 2023-2024 Huawei Device Co., Ltd. 323b3eb3cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the 'License'); 423b3eb3cSopenharmony_ci * you may not use this file except in compliance with the License. 523b3eb3cSopenharmony_ci * You may obtain a copy of the License at 623b3eb3cSopenharmony_ci * 723b3eb3cSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 823b3eb3cSopenharmony_ci * 923b3eb3cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1023b3eb3cSopenharmony_ci * distributed under the License is distributed on an 'AS IS' BASIS, 1123b3eb3cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1223b3eb3cSopenharmony_ci * See the License for the specific language governing permissions and 1323b3eb3cSopenharmony_ci * limitations under the License. 1423b3eb3cSopenharmony_ci */ 1523b3eb3cSopenharmony_ci 1623b3eb3cSopenharmony_ciif (!('finalizeConstruction' in ViewPU.prototype)) { 1723b3eb3cSopenharmony_ci Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => { }); 1823b3eb3cSopenharmony_ci} 1923b3eb3cSopenharmony_ciif (PUV2ViewBase.contextStack === undefined) { 2023b3eb3cSopenharmony_ci Reflect.set(PUV2ViewBase, 'contextStack', []); 2123b3eb3cSopenharmony_ci} 2223b3eb3cSopenharmony_ciconst KeyCode = requireNapi('multimodalInput.keyCode').KeyCode; 2323b3eb3cSopenharmony_ciconst hilog = requireNapi('ohos.hilog'); 2423b3eb3cSopenharmony_ciconst PUBLIC_MORE = { 'id': -1, 'type': 20000, params: ['sys.media.ohos_ic_public_more'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 2523b3eb3cSopenharmony_ciconst PUBLIC_BACK = { 'id': -1, 'type': 20000, params: ['sys.media.ohos_ic_back'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 2623b3eb3cSopenharmony_ciconst TEXT_EDITABLE_DIALOG = '18.3fp'; 2723b3eb3cSopenharmony_ciconst IMAGE_SIZE = '64vp'; 2823b3eb3cSopenharmony_ciconst MAX_DIALOG = '256vp'; 2923b3eb3cSopenharmony_ciconst MIN_DIALOG = '216vp'; 3023b3eb3cSopenharmony_ciclass ComposeTitleBar extends ViewPU { 3123b3eb3cSopenharmony_ci constructor(o10, p10, q10, r10 = -1, s10 = undefined, t10) { 3223b3eb3cSopenharmony_ci super(o10, q10, r10, t10); 3323b3eb3cSopenharmony_ci if (typeof s10 === 'function') { 3423b3eb3cSopenharmony_ci this.paramsGenerator_ = s10; 3523b3eb3cSopenharmony_ci } 3623b3eb3cSopenharmony_ci this.item = undefined; 3723b3eb3cSopenharmony_ci this.title = ''; 3823b3eb3cSopenharmony_ci this.subtitle = ''; 3923b3eb3cSopenharmony_ci this.menuItems = []; 4023b3eb3cSopenharmony_ci this.__titleMaxWidth = new ObservedPropertySimplePU(0, this, 'titleMaxWidth'); 4123b3eb3cSopenharmony_ci this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize'); 4223b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(p10); 4323b3eb3cSopenharmony_ci this.finalizeConstruction(); 4423b3eb3cSopenharmony_ci } 4523b3eb3cSopenharmony_ci setInitiallyProvidedValue(n10) { 4623b3eb3cSopenharmony_ci if (n10.item !== undefined) { 4723b3eb3cSopenharmony_ci this.item = n10.item; 4823b3eb3cSopenharmony_ci } 4923b3eb3cSopenharmony_ci if (n10.title !== undefined) { 5023b3eb3cSopenharmony_ci this.title = n10.title; 5123b3eb3cSopenharmony_ci } 5223b3eb3cSopenharmony_ci if (n10.subtitle !== undefined) { 5323b3eb3cSopenharmony_ci this.subtitle = n10.subtitle; 5423b3eb3cSopenharmony_ci } 5523b3eb3cSopenharmony_ci if (n10.menuItems !== undefined) { 5623b3eb3cSopenharmony_ci this.menuItems = n10.menuItems; 5723b3eb3cSopenharmony_ci } 5823b3eb3cSopenharmony_ci if (n10.titleMaxWidth !== undefined) { 5923b3eb3cSopenharmony_ci this.titleMaxWidth = n10.titleMaxWidth; 6023b3eb3cSopenharmony_ci } 6123b3eb3cSopenharmony_ci if (n10.fontSize !== undefined) { 6223b3eb3cSopenharmony_ci this.fontSize = n10.fontSize; 6323b3eb3cSopenharmony_ci } 6423b3eb3cSopenharmony_ci } 6523b3eb3cSopenharmony_ci updateStateVars(m10) { 6623b3eb3cSopenharmony_ci } 6723b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(l10) { 6823b3eb3cSopenharmony_ci this.__titleMaxWidth.purgeDependencyOnElmtId(l10); 6923b3eb3cSopenharmony_ci this.__fontSize.purgeDependencyOnElmtId(l10); 7023b3eb3cSopenharmony_ci } 7123b3eb3cSopenharmony_ci aboutToBeDeleted() { 7223b3eb3cSopenharmony_ci this.__titleMaxWidth.aboutToBeDeleted(); 7323b3eb3cSopenharmony_ci this.__fontSize.aboutToBeDeleted(); 7423b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 7523b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 7623b3eb3cSopenharmony_ci } 7723b3eb3cSopenharmony_ci get titleMaxWidth() { 7823b3eb3cSopenharmony_ci return this.__titleMaxWidth.get(); 7923b3eb3cSopenharmony_ci } 8023b3eb3cSopenharmony_ci set titleMaxWidth(k10) { 8123b3eb3cSopenharmony_ci this.__titleMaxWidth.set(k10); 8223b3eb3cSopenharmony_ci } 8323b3eb3cSopenharmony_ci get fontSize() { 8423b3eb3cSopenharmony_ci return this.__fontSize.get(); 8523b3eb3cSopenharmony_ci } 8623b3eb3cSopenharmony_ci set fontSize(i10) { 8723b3eb3cSopenharmony_ci this.__fontSize.set(i10); 8823b3eb3cSopenharmony_ci } 8923b3eb3cSopenharmony_ci initialRender() { 9023b3eb3cSopenharmony_ci PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this); 9123b3eb3cSopenharmony_ci this.observeComponentCreation((b10, c10) => { 9223b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(b10); 9323b3eb3cSopenharmony_ci Flex.create({ 9423b3eb3cSopenharmony_ci justifyContent: FlexAlign.SpaceBetween, 9523b3eb3cSopenharmony_ci alignItems: ItemAlign.Stretch 9623b3eb3cSopenharmony_ci }); 9723b3eb3cSopenharmony_ci Flex.width('100%'); 9823b3eb3cSopenharmony_ci Flex.height(ComposeTitleBar.totalHeight); 9923b3eb3cSopenharmony_ci Flex.backgroundColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_background'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 10023b3eb3cSopenharmony_ci Flex.onAreaChange((e10, f10) => { 10123b3eb3cSopenharmony_ci let g10 = Number(f10.width); 10223b3eb3cSopenharmony_ci if (this.menuItems !== undefined) { 10323b3eb3cSopenharmony_ci let h10 = this.menuItems.length; 10423b3eb3cSopenharmony_ci if (h10 >= CollapsibleMenuSection.maxCountOfVisibleItems) { 10523b3eb3cSopenharmony_ci g10 = g10 - ImageMenuItem.imageHotZoneWidth * CollapsibleMenuSection.maxCountOfVisibleItems; 10623b3eb3cSopenharmony_ci } 10723b3eb3cSopenharmony_ci else if (h10 > 0) { 10823b3eb3cSopenharmony_ci g10 = g10 - ImageMenuItem.imageHotZoneWidth * h10; 10923b3eb3cSopenharmony_ci } 11023b3eb3cSopenharmony_ci } 11123b3eb3cSopenharmony_ci this.titleMaxWidth = g10; 11223b3eb3cSopenharmony_ci this.titleMaxWidth -= ComposeTitleBar.leftPadding; 11323b3eb3cSopenharmony_ci this.titleMaxWidth -= ImageMenuItem.imageHotZoneWidth; 11423b3eb3cSopenharmony_ci if (this.item !== undefined) { 11523b3eb3cSopenharmony_ci this.titleMaxWidth -= ComposeTitleBar.portraitImageLeftPadding + 11623b3eb3cSopenharmony_ci ComposeTitleBar.portraitImageSize + 11723b3eb3cSopenharmony_ci ComposeTitleBar.portraitImageRightPadding; 11823b3eb3cSopenharmony_ci } 11923b3eb3cSopenharmony_ci this.titleMaxWidth -= ComposeTitleBar.rightPadding; 12023b3eb3cSopenharmony_ci }); 12123b3eb3cSopenharmony_ci if (!c10) { 12223b3eb3cSopenharmony_ci Flex.pop(); 12323b3eb3cSopenharmony_ci } 12423b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 12523b3eb3cSopenharmony_ci }); 12623b3eb3cSopenharmony_ci this.observeComponentCreation((z9, a10) => { 12723b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(z9); 12823b3eb3cSopenharmony_ci Row.create(); 12923b3eb3cSopenharmony_ci Row.margin({ left: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_default_padding_start'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } }); 13023b3eb3cSopenharmony_ci if (!a10) { 13123b3eb3cSopenharmony_ci Row.pop(); 13223b3eb3cSopenharmony_ci } 13323b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 13423b3eb3cSopenharmony_ci }); 13523b3eb3cSopenharmony_ci { 13623b3eb3cSopenharmony_ci this.observeComponentCreation((r9, s9) => { 13723b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(r9); 13823b3eb3cSopenharmony_ci if (s9) { 13923b3eb3cSopenharmony_ci let t9 = new ImageMenuItem(this, { item: { 14023b3eb3cSopenharmony_ci value: PUBLIC_BACK, 14123b3eb3cSopenharmony_ci isEnabled: true, 14223b3eb3cSopenharmony_ci action: () => this.getUIContext()?.getRouter()?.back() 14323b3eb3cSopenharmony_ci }, index: -1 }, undefined, r9, () => { }, { page: 'library/src/main/ets/components/mainpage/MainPage.ets', line: 64, col: 9 }); 14423b3eb3cSopenharmony_ci ViewPU.create(t9); 14523b3eb3cSopenharmony_ci let u9 = () => { 14623b3eb3cSopenharmony_ci return { 14723b3eb3cSopenharmony_ci item: { 14823b3eb3cSopenharmony_ci value: PUBLIC_BACK, 14923b3eb3cSopenharmony_ci isEnabled: true, 15023b3eb3cSopenharmony_ci action: () => this.getUIContext()?.getRouter()?.back() 15123b3eb3cSopenharmony_ci }, 15223b3eb3cSopenharmony_ci index: -1 15323b3eb3cSopenharmony_ci }; 15423b3eb3cSopenharmony_ci }; 15523b3eb3cSopenharmony_ci t9.paramsGenerator_ = u9; 15623b3eb3cSopenharmony_ci } 15723b3eb3cSopenharmony_ci else { 15823b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(r9, {}); 15923b3eb3cSopenharmony_ci } 16023b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 16123b3eb3cSopenharmony_ci }); 16223b3eb3cSopenharmony_ci } 16323b3eb3cSopenharmony_ci this.observeComponentCreation((j9, k9) => { 16423b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(j9); 16523b3eb3cSopenharmony_ci If.create(); 16623b3eb3cSopenharmony_ci if (this.item !== undefined) { 16723b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 16823b3eb3cSopenharmony_ci this.observeComponentCreation((o9, p9) => { 16923b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(o9); 17023b3eb3cSopenharmony_ci Image.create(this.item.value); 17123b3eb3cSopenharmony_ci Image.width(ComposeTitleBar.portraitImageSize); 17223b3eb3cSopenharmony_ci Image.height(ComposeTitleBar.portraitImageSize); 17323b3eb3cSopenharmony_ci Image.margin({ 17423b3eb3cSopenharmony_ci left: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_paragraph_margin_xs'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 17523b3eb3cSopenharmony_ci right: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_paragraph_margin_m'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } 17623b3eb3cSopenharmony_ci }); 17723b3eb3cSopenharmony_ci Image.focusable(false); 17823b3eb3cSopenharmony_ci Image.borderRadius(ImageMenuItem.buttonBorderRadius); 17923b3eb3cSopenharmony_ci if (!p9) { 18023b3eb3cSopenharmony_ci Image.pop(); 18123b3eb3cSopenharmony_ci } 18223b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 18323b3eb3cSopenharmony_ci }); 18423b3eb3cSopenharmony_ci }); 18523b3eb3cSopenharmony_ci } 18623b3eb3cSopenharmony_ci else { 18723b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 18823b3eb3cSopenharmony_ci }); 18923b3eb3cSopenharmony_ci } 19023b3eb3cSopenharmony_ci if (!k9) { 19123b3eb3cSopenharmony_ci If.pop(); 19223b3eb3cSopenharmony_ci } 19323b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 19423b3eb3cSopenharmony_ci }); 19523b3eb3cSopenharmony_ci If.pop(); 19623b3eb3cSopenharmony_ci this.observeComponentCreation((h9, i9) => { 19723b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(h9); 19823b3eb3cSopenharmony_ci Column.create(); 19923b3eb3cSopenharmony_ci Column.justifyContent(FlexAlign.Start); 20023b3eb3cSopenharmony_ci Column.alignItems(HorizontalAlign.Start); 20123b3eb3cSopenharmony_ci Column.constraintSize({ maxWidth: this.titleMaxWidth }); 20223b3eb3cSopenharmony_ci if (!i9) { 20323b3eb3cSopenharmony_ci Column.pop(); 20423b3eb3cSopenharmony_ci } 20523b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 20623b3eb3cSopenharmony_ci }); 20723b3eb3cSopenharmony_ci this.observeComponentCreation((x8, y8) => { 20823b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(x8); 20923b3eb3cSopenharmony_ci If.create(); 21023b3eb3cSopenharmony_ci if (this.title !== undefined) { 21123b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 21223b3eb3cSopenharmony_ci this.observeComponentCreation((f9, g9) => { 21323b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(f9); 21423b3eb3cSopenharmony_ci Row.create(); 21523b3eb3cSopenharmony_ci Row.justifyContent(FlexAlign.Start); 21623b3eb3cSopenharmony_ci if (!g9) { 21723b3eb3cSopenharmony_ci Row.pop(); 21823b3eb3cSopenharmony_ci } 21923b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 22023b3eb3cSopenharmony_ci }); 22123b3eb3cSopenharmony_ci this.observeComponentCreation((d9, e9) => { 22223b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(d9); 22323b3eb3cSopenharmony_ci Text.create(this.title); 22423b3eb3cSopenharmony_ci Text.fontWeight(FontWeight.Medium); 22523b3eb3cSopenharmony_ci Text.fontSize({ 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_headline8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 22623b3eb3cSopenharmony_ci Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_text'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 22723b3eb3cSopenharmony_ci Text.maxLines(this.subtitle !== undefined ? 1 : 2); 22823b3eb3cSopenharmony_ci Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 22923b3eb3cSopenharmony_ci Text.constraintSize({ maxWidth: this.titleMaxWidth }); 23023b3eb3cSopenharmony_ci if (!e9) { 23123b3eb3cSopenharmony_ci Text.pop(); 23223b3eb3cSopenharmony_ci } 23323b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 23423b3eb3cSopenharmony_ci }); 23523b3eb3cSopenharmony_ci Text.pop(); 23623b3eb3cSopenharmony_ci Row.pop(); 23723b3eb3cSopenharmony_ci }); 23823b3eb3cSopenharmony_ci } 23923b3eb3cSopenharmony_ci else { 24023b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 24123b3eb3cSopenharmony_ci }); 24223b3eb3cSopenharmony_ci } 24323b3eb3cSopenharmony_ci if (!y8) { 24423b3eb3cSopenharmony_ci If.pop(); 24523b3eb3cSopenharmony_ci } 24623b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 24723b3eb3cSopenharmony_ci }); 24823b3eb3cSopenharmony_ci If.pop(); 24923b3eb3cSopenharmony_ci this.observeComponentCreation((n8, o8) => { 25023b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(n8); 25123b3eb3cSopenharmony_ci If.create(); 25223b3eb3cSopenharmony_ci if (this.subtitle !== undefined) { 25323b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 25423b3eb3cSopenharmony_ci this.observeComponentCreation((v8, w8) => { 25523b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(v8); 25623b3eb3cSopenharmony_ci Row.create(); 25723b3eb3cSopenharmony_ci Row.justifyContent(FlexAlign.Start); 25823b3eb3cSopenharmony_ci if (!w8) { 25923b3eb3cSopenharmony_ci Row.pop(); 26023b3eb3cSopenharmony_ci } 26123b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 26223b3eb3cSopenharmony_ci }); 26323b3eb3cSopenharmony_ci this.observeComponentCreation((t8, u8) => { 26423b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(t8); 26523b3eb3cSopenharmony_ci Text.create(this.subtitle); 26623b3eb3cSopenharmony_ci Text.fontSize({ 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_over_line'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 26723b3eb3cSopenharmony_ci Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_subtitle_text'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 26823b3eb3cSopenharmony_ci Text.maxLines(1); 26923b3eb3cSopenharmony_ci Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 27023b3eb3cSopenharmony_ci Text.constraintSize({ maxWidth: this.titleMaxWidth }); 27123b3eb3cSopenharmony_ci if (!u8) { 27223b3eb3cSopenharmony_ci Text.pop(); 27323b3eb3cSopenharmony_ci } 27423b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 27523b3eb3cSopenharmony_ci }); 27623b3eb3cSopenharmony_ci Text.pop(); 27723b3eb3cSopenharmony_ci Row.pop(); 27823b3eb3cSopenharmony_ci }); 27923b3eb3cSopenharmony_ci } 28023b3eb3cSopenharmony_ci else { 28123b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 28223b3eb3cSopenharmony_ci }); 28323b3eb3cSopenharmony_ci } 28423b3eb3cSopenharmony_ci if (!o8) { 28523b3eb3cSopenharmony_ci If.pop(); 28623b3eb3cSopenharmony_ci } 28723b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 28823b3eb3cSopenharmony_ci }); 28923b3eb3cSopenharmony_ci If.pop(); 29023b3eb3cSopenharmony_ci Column.pop(); 29123b3eb3cSopenharmony_ci Row.pop(); 29223b3eb3cSopenharmony_ci this.observeComponentCreation((c8, d8) => { 29323b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(c8); 29423b3eb3cSopenharmony_ci If.create(); 29523b3eb3cSopenharmony_ci if (this.menuItems !== undefined && this.menuItems.length > 0) { 29623b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 29723b3eb3cSopenharmony_ci { 29823b3eb3cSopenharmony_ci this.observeComponentCreation((h8, i8) => { 29923b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(h8); 30023b3eb3cSopenharmony_ci if (i8) { 30123b3eb3cSopenharmony_ci let j8 = new CollapsibleMenuSection(this, { menuItems: this.menuItems, index: 1 + ComposeTitleBar.instanceCount++ }, undefined, h8, () => { }, { page: 'library/src/main/ets/components/mainpage/MainPage.ets', line: 114, col: 9 }); 30223b3eb3cSopenharmony_ci ViewPU.create(j8); 30323b3eb3cSopenharmony_ci let k8 = () => { 30423b3eb3cSopenharmony_ci return { 30523b3eb3cSopenharmony_ci menuItems: this.menuItems, 30623b3eb3cSopenharmony_ci index: 1 + ComposeTitleBar.instanceCount++ 30723b3eb3cSopenharmony_ci }; 30823b3eb3cSopenharmony_ci }; 30923b3eb3cSopenharmony_ci j8.paramsGenerator_ = k8; 31023b3eb3cSopenharmony_ci } 31123b3eb3cSopenharmony_ci else { 31223b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(h8, {}); 31323b3eb3cSopenharmony_ci } 31423b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 31523b3eb3cSopenharmony_ci }); 31623b3eb3cSopenharmony_ci } 31723b3eb3cSopenharmony_ci }); 31823b3eb3cSopenharmony_ci } 31923b3eb3cSopenharmony_ci else { 32023b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 32123b3eb3cSopenharmony_ci }); 32223b3eb3cSopenharmony_ci } 32323b3eb3cSopenharmony_ci if (!d8) { 32423b3eb3cSopenharmony_ci If.pop(); 32523b3eb3cSopenharmony_ci } 32623b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 32723b3eb3cSopenharmony_ci }); 32823b3eb3cSopenharmony_ci If.pop(); 32923b3eb3cSopenharmony_ci Flex.pop(); 33023b3eb3cSopenharmony_ci PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop(); 33123b3eb3cSopenharmony_ci } 33223b3eb3cSopenharmony_ci rerender() { 33323b3eb3cSopenharmony_ci PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this); 33423b3eb3cSopenharmony_ci this.updateDirtyElements(); 33523b3eb3cSopenharmony_ci PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop(); 33623b3eb3cSopenharmony_ci } 33723b3eb3cSopenharmony_ci} 33823b3eb3cSopenharmony_ciComposeTitleBar.totalHeight = 56; 33923b3eb3cSopenharmony_ciComposeTitleBar.leftPadding = 12; 34023b3eb3cSopenharmony_ciComposeTitleBar.rightPadding = 12; 34123b3eb3cSopenharmony_ciComposeTitleBar.portraitImageSize = 40; 34223b3eb3cSopenharmony_ciComposeTitleBar.portraitImageLeftPadding = 4; 34323b3eb3cSopenharmony_ciComposeTitleBar.portraitImageRightPadding = 16; 34423b3eb3cSopenharmony_ciComposeTitleBar.instanceCount = 0; 34523b3eb3cSopenharmony_ciclass CollapsibleMenuSection extends ViewPU { 34623b3eb3cSopenharmony_ci constructor(k7, l7, m7, n7 = -1, o7 = undefined, p7) { 34723b3eb3cSopenharmony_ci super(k7, m7, n7, p7); 34823b3eb3cSopenharmony_ci if (typeof o7 === 'function') { 34923b3eb3cSopenharmony_ci this.paramsGenerator_ = o7; 35023b3eb3cSopenharmony_ci } 35123b3eb3cSopenharmony_ci this.menuItems = []; 35223b3eb3cSopenharmony_ci this.item = { 35323b3eb3cSopenharmony_ci value: PUBLIC_MORE, 35423b3eb3cSopenharmony_ci label: { 'id': -1, 'type': 10003, params: ['sys.string.ohos_toolbar_more'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 35523b3eb3cSopenharmony_ci }; 35623b3eb3cSopenharmony_ci this.index = 0; 35723b3eb3cSopenharmony_ci this.longPressTime = 500; 35823b3eb3cSopenharmony_ci this.minFontSize = 1.75; 35923b3eb3cSopenharmony_ci this.isFollowingSystemFontScale = false; 36023b3eb3cSopenharmony_ci this.maxFontScale = 1; 36123b3eb3cSopenharmony_ci this.systemFontScale = 1; 36223b3eb3cSopenharmony_ci this.firstFocusableIndex = -1; 36323b3eb3cSopenharmony_ci this.__isPopupShown = new ObservedPropertySimplePU(false, this, 'isPopupShown'); 36423b3eb3cSopenharmony_ci this.__isMoreIconOnFocus = new ObservedPropertySimplePU(false, this, 'isMoreIconOnFocus'); 36523b3eb3cSopenharmony_ci this.__isMoreIconOnHover = new ObservedPropertySimplePU(false, this, 'isMoreIconOnHover'); 36623b3eb3cSopenharmony_ci this.__isMoreIconOnClick = new ObservedPropertySimplePU(false, this, 'isMoreIconOnClick'); 36723b3eb3cSopenharmony_ci this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize'); 36823b3eb3cSopenharmony_ci this.dialogController = new CustomDialogController({ 36923b3eb3cSopenharmony_ci builder: () => { 37023b3eb3cSopenharmony_ci let q7 = new ComposeTitleBarDialog(this, { 37123b3eb3cSopenharmony_ci cancel: () => { 37223b3eb3cSopenharmony_ci }, 37323b3eb3cSopenharmony_ci confirm: () => { 37423b3eb3cSopenharmony_ci }, 37523b3eb3cSopenharmony_ci itemComposeTitleDialog: this.item, 37623b3eb3cSopenharmony_ci composeTitleBarDialog: this.item.label ? this.item.label : '', 37723b3eb3cSopenharmony_ci fontSize: this.fontSize, 37823b3eb3cSopenharmony_ci }, undefined, -1, () => { }, { page: 'library/src/main/ets/components/mainpage/MainPage.ets', line: 166, col: 14 }); 37923b3eb3cSopenharmony_ci q7.setController(this.dialogController); 38023b3eb3cSopenharmony_ci ViewPU.create(q7); 38123b3eb3cSopenharmony_ci let r7 = () => { 38223b3eb3cSopenharmony_ci return { 38323b3eb3cSopenharmony_ci cancel: () => { 38423b3eb3cSopenharmony_ci }, 38523b3eb3cSopenharmony_ci confirm: () => { 38623b3eb3cSopenharmony_ci }, 38723b3eb3cSopenharmony_ci itemComposeTitleDialog: this.item, 38823b3eb3cSopenharmony_ci composeTitleBarDialog: this.item.label ? this.item.label : '', 38923b3eb3cSopenharmony_ci fontSize: this.fontSize 39023b3eb3cSopenharmony_ci }; 39123b3eb3cSopenharmony_ci }; 39223b3eb3cSopenharmony_ci q7.paramsGenerator_ = r7; 39323b3eb3cSopenharmony_ci }, 39423b3eb3cSopenharmony_ci maskColor: Color.Transparent, 39523b3eb3cSopenharmony_ci isModal: true, 39623b3eb3cSopenharmony_ci customStyle: true 39723b3eb3cSopenharmony_ci }, this); 39823b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(l7); 39923b3eb3cSopenharmony_ci this.finalizeConstruction(); 40023b3eb3cSopenharmony_ci } 40123b3eb3cSopenharmony_ci setInitiallyProvidedValue(j7) { 40223b3eb3cSopenharmony_ci if (j7.menuItems !== undefined) { 40323b3eb3cSopenharmony_ci this.menuItems = j7.menuItems; 40423b3eb3cSopenharmony_ci } 40523b3eb3cSopenharmony_ci if (j7.item !== undefined) { 40623b3eb3cSopenharmony_ci this.item = j7.item; 40723b3eb3cSopenharmony_ci } 40823b3eb3cSopenharmony_ci if (j7.index !== undefined) { 40923b3eb3cSopenharmony_ci this.index = j7.index; 41023b3eb3cSopenharmony_ci } 41123b3eb3cSopenharmony_ci if (j7.longPressTime !== undefined) { 41223b3eb3cSopenharmony_ci this.longPressTime = j7.longPressTime; 41323b3eb3cSopenharmony_ci } 41423b3eb3cSopenharmony_ci if (j7.minFontSize !== undefined) { 41523b3eb3cSopenharmony_ci this.minFontSize = j7.minFontSize; 41623b3eb3cSopenharmony_ci } 41723b3eb3cSopenharmony_ci if (j7.isFollowingSystemFontScale !== undefined) { 41823b3eb3cSopenharmony_ci this.isFollowingSystemFontScale = j7.isFollowingSystemFontScale; 41923b3eb3cSopenharmony_ci } 42023b3eb3cSopenharmony_ci if (j7.maxFontScale !== undefined) { 42123b3eb3cSopenharmony_ci this.maxFontScale = j7.maxFontScale; 42223b3eb3cSopenharmony_ci } 42323b3eb3cSopenharmony_ci if (j7.systemFontScale !== undefined) { 42423b3eb3cSopenharmony_ci this.systemFontScale = j7.systemFontScale; 42523b3eb3cSopenharmony_ci } 42623b3eb3cSopenharmony_ci if (j7.firstFocusableIndex !== undefined) { 42723b3eb3cSopenharmony_ci this.firstFocusableIndex = j7.firstFocusableIndex; 42823b3eb3cSopenharmony_ci } 42923b3eb3cSopenharmony_ci if (j7.isPopupShown !== undefined) { 43023b3eb3cSopenharmony_ci this.isPopupShown = j7.isPopupShown; 43123b3eb3cSopenharmony_ci } 43223b3eb3cSopenharmony_ci if (j7.isMoreIconOnFocus !== undefined) { 43323b3eb3cSopenharmony_ci this.isMoreIconOnFocus = j7.isMoreIconOnFocus; 43423b3eb3cSopenharmony_ci } 43523b3eb3cSopenharmony_ci if (j7.isMoreIconOnHover !== undefined) { 43623b3eb3cSopenharmony_ci this.isMoreIconOnHover = j7.isMoreIconOnHover; 43723b3eb3cSopenharmony_ci } 43823b3eb3cSopenharmony_ci if (j7.isMoreIconOnClick !== undefined) { 43923b3eb3cSopenharmony_ci this.isMoreIconOnClick = j7.isMoreIconOnClick; 44023b3eb3cSopenharmony_ci } 44123b3eb3cSopenharmony_ci if (j7.fontSize !== undefined) { 44223b3eb3cSopenharmony_ci this.fontSize = j7.fontSize; 44323b3eb3cSopenharmony_ci } 44423b3eb3cSopenharmony_ci if (j7.dialogController !== undefined) { 44523b3eb3cSopenharmony_ci this.dialogController = j7.dialogController; 44623b3eb3cSopenharmony_ci } 44723b3eb3cSopenharmony_ci } 44823b3eb3cSopenharmony_ci updateStateVars(i7) { 44923b3eb3cSopenharmony_ci } 45023b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(h7) { 45123b3eb3cSopenharmony_ci this.__isPopupShown.purgeDependencyOnElmtId(h7); 45223b3eb3cSopenharmony_ci this.__isMoreIconOnFocus.purgeDependencyOnElmtId(h7); 45323b3eb3cSopenharmony_ci this.__isMoreIconOnHover.purgeDependencyOnElmtId(h7); 45423b3eb3cSopenharmony_ci this.__isMoreIconOnClick.purgeDependencyOnElmtId(h7); 45523b3eb3cSopenharmony_ci this.__fontSize.purgeDependencyOnElmtId(h7); 45623b3eb3cSopenharmony_ci } 45723b3eb3cSopenharmony_ci aboutToBeDeleted() { 45823b3eb3cSopenharmony_ci this.__isPopupShown.aboutToBeDeleted(); 45923b3eb3cSopenharmony_ci this.__isMoreIconOnFocus.aboutToBeDeleted(); 46023b3eb3cSopenharmony_ci this.__isMoreIconOnHover.aboutToBeDeleted(); 46123b3eb3cSopenharmony_ci this.__isMoreIconOnClick.aboutToBeDeleted(); 46223b3eb3cSopenharmony_ci this.__fontSize.aboutToBeDeleted(); 46323b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 46423b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 46523b3eb3cSopenharmony_ci } 46623b3eb3cSopenharmony_ci get isPopupShown() { 46723b3eb3cSopenharmony_ci return this.__isPopupShown.get(); 46823b3eb3cSopenharmony_ci } 46923b3eb3cSopenharmony_ci set isPopupShown(g7) { 47023b3eb3cSopenharmony_ci this.__isPopupShown.set(g7); 47123b3eb3cSopenharmony_ci } 47223b3eb3cSopenharmony_ci get isMoreIconOnFocus() { 47323b3eb3cSopenharmony_ci return this.__isMoreIconOnFocus.get(); 47423b3eb3cSopenharmony_ci } 47523b3eb3cSopenharmony_ci set isMoreIconOnFocus(f7) { 47623b3eb3cSopenharmony_ci this.__isMoreIconOnFocus.set(f7); 47723b3eb3cSopenharmony_ci } 47823b3eb3cSopenharmony_ci get isMoreIconOnHover() { 47923b3eb3cSopenharmony_ci return this.__isMoreIconOnHover.get(); 48023b3eb3cSopenharmony_ci } 48123b3eb3cSopenharmony_ci set isMoreIconOnHover(e7) { 48223b3eb3cSopenharmony_ci this.__isMoreIconOnHover.set(e7); 48323b3eb3cSopenharmony_ci } 48423b3eb3cSopenharmony_ci get isMoreIconOnClick() { 48523b3eb3cSopenharmony_ci return this.__isMoreIconOnClick.get(); 48623b3eb3cSopenharmony_ci } 48723b3eb3cSopenharmony_ci set isMoreIconOnClick(d7) { 48823b3eb3cSopenharmony_ci this.__isMoreIconOnClick.set(d7); 48923b3eb3cSopenharmony_ci } 49023b3eb3cSopenharmony_ci get fontSize() { 49123b3eb3cSopenharmony_ci return this.__fontSize.get(); 49223b3eb3cSopenharmony_ci } 49323b3eb3cSopenharmony_ci set fontSize(c7) { 49423b3eb3cSopenharmony_ci this.__fontSize.set(c7); 49523b3eb3cSopenharmony_ci } 49623b3eb3cSopenharmony_ci getMoreIconFgColor() { 49723b3eb3cSopenharmony_ci return this.isMoreIconOnClick ? { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon_pressed'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 49823b3eb3cSopenharmony_ci } 49923b3eb3cSopenharmony_ci getMoreIconBgColor() { 50023b3eb3cSopenharmony_ci if (this.isMoreIconOnClick) { 50123b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_click_effect'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 50223b3eb3cSopenharmony_ci } 50323b3eb3cSopenharmony_ci else if (this.isMoreIconOnHover) { 50423b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_hover'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 50523b3eb3cSopenharmony_ci } 50623b3eb3cSopenharmony_ci else { 50723b3eb3cSopenharmony_ci return Color.Transparent; 50823b3eb3cSopenharmony_ci } 50923b3eb3cSopenharmony_ci } 51023b3eb3cSopenharmony_ci aboutToAppear() { 51123b3eb3cSopenharmony_ci try { 51223b3eb3cSopenharmony_ci let b7 = this.getUIContext(); 51323b3eb3cSopenharmony_ci this.isFollowingSystemFontScale = b7.isFollowingSystemFontScale(); 51423b3eb3cSopenharmony_ci this.maxFontScale = b7.getMaxFontScale(); 51523b3eb3cSopenharmony_ci } 51623b3eb3cSopenharmony_ci catch (y6) { 51723b3eb3cSopenharmony_ci let z6 = y6.code; 51823b3eb3cSopenharmony_ci let a7 = y6.message; 51923b3eb3cSopenharmony_ci hilog.error(0x3900, 'ComposeTitleBar', `Failed to init fontsizescale info, cause, code: ${z6}, message: ${a7}`); 52023b3eb3cSopenharmony_ci } 52123b3eb3cSopenharmony_ci if (this.menuItems) { 52223b3eb3cSopenharmony_ci this.menuItems.forEach((w6, x6) => { 52323b3eb3cSopenharmony_ci if (w6.isEnabled && this.firstFocusableIndex == -1 && 52423b3eb3cSopenharmony_ci x6 > CollapsibleMenuSection.maxCountOfVisibleItems - 2) { 52523b3eb3cSopenharmony_ci this.firstFocusableIndex = this.index * 1000 + x6 + 1; 52623b3eb3cSopenharmony_ci } 52723b3eb3cSopenharmony_ci }); 52823b3eb3cSopenharmony_ci } 52923b3eb3cSopenharmony_ci } 53023b3eb3cSopenharmony_ci decideFontScale() { 53123b3eb3cSopenharmony_ci try { 53223b3eb3cSopenharmony_ci let u6 = this.getUIContext(); 53323b3eb3cSopenharmony_ci this.systemFontScale = u6.getHostContext()?.config?.fontSizeScale ?? 1; 53423b3eb3cSopenharmony_ci if (!this.isFollowingSystemFontScale) { 53523b3eb3cSopenharmony_ci return 1; 53623b3eb3cSopenharmony_ci } 53723b3eb3cSopenharmony_ci return Math.min(this.systemFontScale, this.maxFontScale); 53823b3eb3cSopenharmony_ci } 53923b3eb3cSopenharmony_ci catch (r6) { 54023b3eb3cSopenharmony_ci let s6 = r6.code; 54123b3eb3cSopenharmony_ci let t6 = r6.message; 54223b3eb3cSopenharmony_ci hilog.error(0x3900, 'ComposeTitleBar', `Faild to decideFontScale,cause, code: ${s6}, message: ${t6}`); 54323b3eb3cSopenharmony_ci return 1; 54423b3eb3cSopenharmony_ci } 54523b3eb3cSopenharmony_ci } 54623b3eb3cSopenharmony_ci initialRender() { 54723b3eb3cSopenharmony_ci PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this); 54823b3eb3cSopenharmony_ci this.observeComponentCreation((p6, q6) => { 54923b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(p6); 55023b3eb3cSopenharmony_ci Column.create(); 55123b3eb3cSopenharmony_ci Column.height('100%'); 55223b3eb3cSopenharmony_ci Column.margin({ right: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_default_padding_end'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } }); 55323b3eb3cSopenharmony_ci Column.justifyContent(FlexAlign.Center); 55423b3eb3cSopenharmony_ci if (!q6) { 55523b3eb3cSopenharmony_ci Column.pop(); 55623b3eb3cSopenharmony_ci } 55723b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 55823b3eb3cSopenharmony_ci }); 55923b3eb3cSopenharmony_ci this.observeComponentCreation((n6, o6) => { 56023b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(n6); 56123b3eb3cSopenharmony_ci Row.create(); 56223b3eb3cSopenharmony_ci if (!o6) { 56323b3eb3cSopenharmony_ci Row.pop(); 56423b3eb3cSopenharmony_ci } 56523b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 56623b3eb3cSopenharmony_ci }); 56723b3eb3cSopenharmony_ci this.observeComponentCreation((i4, j4) => { 56823b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(i4); 56923b3eb3cSopenharmony_ci If.create(); 57023b3eb3cSopenharmony_ci if (this.menuItems) { 57123b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 57223b3eb3cSopenharmony_ci this.observeComponentCreation((n4, o4) => { 57323b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(n4); 57423b3eb3cSopenharmony_ci If.create(); 57523b3eb3cSopenharmony_ci if (this.menuItems.length <= CollapsibleMenuSection.maxCountOfVisibleItems) { 57623b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 57723b3eb3cSopenharmony_ci this.observeComponentCreation((z5, a6) => { 57823b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(z5); 57923b3eb3cSopenharmony_ci ForEach.create(); 58023b3eb3cSopenharmony_ci const b6 = (d6, e6) => { 58123b3eb3cSopenharmony_ci const f6 = d6; 58223b3eb3cSopenharmony_ci { 58323b3eb3cSopenharmony_ci this.observeComponentCreation((h6, i6) => { 58423b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(h6); 58523b3eb3cSopenharmony_ci if (i6) { 58623b3eb3cSopenharmony_ci let j6 = new ImageMenuItem(this, { item: f6, index: this.index * 1000 + e6 + 1 }, undefined, h6, () => { }, { page: 'library/src/main/ets/components/mainpage/MainPage.ets', line: 238, col: 15 }); 58723b3eb3cSopenharmony_ci ViewPU.create(j6); 58823b3eb3cSopenharmony_ci let k6 = () => { 58923b3eb3cSopenharmony_ci return { 59023b3eb3cSopenharmony_ci item: f6, 59123b3eb3cSopenharmony_ci index: this.index * 1000 + e6 + 1 59223b3eb3cSopenharmony_ci }; 59323b3eb3cSopenharmony_ci }; 59423b3eb3cSopenharmony_ci j6.paramsGenerator_ = k6; 59523b3eb3cSopenharmony_ci } 59623b3eb3cSopenharmony_ci else { 59723b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(h6, {}); 59823b3eb3cSopenharmony_ci } 59923b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 60023b3eb3cSopenharmony_ci }); 60123b3eb3cSopenharmony_ci } 60223b3eb3cSopenharmony_ci }; 60323b3eb3cSopenharmony_ci this.forEachUpdateFunction(z5, this.menuItems, b6, undefined, true, false); 60423b3eb3cSopenharmony_ci if (!a6) { 60523b3eb3cSopenharmony_ci ForEach.pop(); 60623b3eb3cSopenharmony_ci } 60723b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 60823b3eb3cSopenharmony_ci }); 60923b3eb3cSopenharmony_ci ForEach.pop(); 61023b3eb3cSopenharmony_ci }); 61123b3eb3cSopenharmony_ci } 61223b3eb3cSopenharmony_ci else { 61323b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 61423b3eb3cSopenharmony_ci this.observeComponentCreation((j5, k5) => { 61523b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(j5); 61623b3eb3cSopenharmony_ci ForEach.create(); 61723b3eb3cSopenharmony_ci const l5 = (n5, o5) => { 61823b3eb3cSopenharmony_ci const p5 = n5; 61923b3eb3cSopenharmony_ci { 62023b3eb3cSopenharmony_ci this.observeComponentCreation((r5, s5) => { 62123b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(r5); 62223b3eb3cSopenharmony_ci if (s5) { 62323b3eb3cSopenharmony_ci let t5 = new ImageMenuItem(this, { item: p5, index: this.index * 1000 + o5 + 1 }, undefined, r5, () => { }, { page: 'library/src/main/ets/components/mainpage/MainPage.ets', line: 243, col: 17 }); 62423b3eb3cSopenharmony_ci ViewPU.create(t5); 62523b3eb3cSopenharmony_ci let u5 = () => { 62623b3eb3cSopenharmony_ci return { 62723b3eb3cSopenharmony_ci item: p5, 62823b3eb3cSopenharmony_ci index: this.index * 1000 + o5 + 1 62923b3eb3cSopenharmony_ci }; 63023b3eb3cSopenharmony_ci }; 63123b3eb3cSopenharmony_ci t5.paramsGenerator_ = u5; 63223b3eb3cSopenharmony_ci } 63323b3eb3cSopenharmony_ci else { 63423b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(r5, {}); 63523b3eb3cSopenharmony_ci } 63623b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 63723b3eb3cSopenharmony_ci }); 63823b3eb3cSopenharmony_ci } 63923b3eb3cSopenharmony_ci }; 64023b3eb3cSopenharmony_ci this.forEachUpdateFunction(j5, this.menuItems.slice(0, CollapsibleMenuSection.maxCountOfVisibleItems - 1), l5, undefined, true, false); 64123b3eb3cSopenharmony_ci if (!k5) { 64223b3eb3cSopenharmony_ci ForEach.pop(); 64323b3eb3cSopenharmony_ci } 64423b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 64523b3eb3cSopenharmony_ci }); 64623b3eb3cSopenharmony_ci ForEach.pop(); 64723b3eb3cSopenharmony_ci this.observeComponentCreation((v4, w4) => { 64823b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(v4); 64923b3eb3cSopenharmony_ci Row.create(); 65023b3eb3cSopenharmony_ci Row.width(ImageMenuItem.imageHotZoneWidth); 65123b3eb3cSopenharmony_ci Row.height(ImageMenuItem.imageHotZoneWidth); 65223b3eb3cSopenharmony_ci Row.borderRadius(ImageMenuItem.buttonBorderRadius); 65323b3eb3cSopenharmony_ci Row.foregroundColor(this.getMoreIconFgColor()); 65423b3eb3cSopenharmony_ci Row.backgroundColor(this.getMoreIconBgColor()); 65523b3eb3cSopenharmony_ci Row.justifyContent(FlexAlign.Center); 65623b3eb3cSopenharmony_ci ViewStackProcessor.visualState('focused'); 65723b3eb3cSopenharmony_ci Row.border({ 65823b3eb3cSopenharmony_ci radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 65923b3eb3cSopenharmony_ci width: ImageMenuItem.focusBorderWidth, 66023b3eb3cSopenharmony_ci color: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 66123b3eb3cSopenharmony_ci style: BorderStyle.Solid 66223b3eb3cSopenharmony_ci }); 66323b3eb3cSopenharmony_ci ViewStackProcessor.visualState('normal'); 66423b3eb3cSopenharmony_ci Row.border({ 66523b3eb3cSopenharmony_ci radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 66623b3eb3cSopenharmony_ci width: 0 66723b3eb3cSopenharmony_ci }); 66823b3eb3cSopenharmony_ci ViewStackProcessor.visualState(); 66923b3eb3cSopenharmony_ci Row.onFocus(() => this.isMoreIconOnFocus = true); 67023b3eb3cSopenharmony_ci Row.onBlur(() => this.isMoreIconOnFocus = false); 67123b3eb3cSopenharmony_ci Row.onHover((i5) => this.isMoreIconOnHover = i5); 67223b3eb3cSopenharmony_ci Row.onKeyEvent((h5) => { 67323b3eb3cSopenharmony_ci if (h5.keyCode !== KeyCode.KEYCODE_ENTER && 67423b3eb3cSopenharmony_ci h5.keyCode !== KeyCode.KEYCODE_SPACE) { 67523b3eb3cSopenharmony_ci return; 67623b3eb3cSopenharmony_ci } 67723b3eb3cSopenharmony_ci if (h5.type === KeyType.Down) { 67823b3eb3cSopenharmony_ci this.isMoreIconOnClick = true; 67923b3eb3cSopenharmony_ci } 68023b3eb3cSopenharmony_ci if (h5.type === KeyType.Up) { 68123b3eb3cSopenharmony_ci this.isMoreIconOnClick = false; 68223b3eb3cSopenharmony_ci } 68323b3eb3cSopenharmony_ci }); 68423b3eb3cSopenharmony_ci Row.onTouch((g5) => { 68523b3eb3cSopenharmony_ci if (g5.type === TouchType.Down) { 68623b3eb3cSopenharmony_ci this.isMoreIconOnClick = true; 68723b3eb3cSopenharmony_ci } 68823b3eb3cSopenharmony_ci if (g5.type === TouchType.Up || g5.type === TouchType.Cancel) { 68923b3eb3cSopenharmony_ci this.isMoreIconOnClick = false; 69023b3eb3cSopenharmony_ci if (this.fontSize >= this.minFontSize) { 69123b3eb3cSopenharmony_ci this.dialogController?.close(); 69223b3eb3cSopenharmony_ci } 69323b3eb3cSopenharmony_ci } 69423b3eb3cSopenharmony_ci }); 69523b3eb3cSopenharmony_ci Row.onClick(() => this.isPopupShown = true); 69623b3eb3cSopenharmony_ci Gesture.create(GesturePriority.Low); 69723b3eb3cSopenharmony_ci LongPressGesture.create({ repeat: false, duration: this.longPressTime }); 69823b3eb3cSopenharmony_ci LongPressGesture.onAction((f5) => { 69923b3eb3cSopenharmony_ci this.fontSize = this.decideFontScale(); 70023b3eb3cSopenharmony_ci if (f5) { 70123b3eb3cSopenharmony_ci if (this.fontSize >= this.minFontSize) { 70223b3eb3cSopenharmony_ci this.dialogController?.open(); 70323b3eb3cSopenharmony_ci } 70423b3eb3cSopenharmony_ci } 70523b3eb3cSopenharmony_ci }); 70623b3eb3cSopenharmony_ci LongPressGesture.pop(); 70723b3eb3cSopenharmony_ci Gesture.pop(); 70823b3eb3cSopenharmony_ci Row.bindPopup(this.isPopupShown, { 70923b3eb3cSopenharmony_ci builder: { builder: this.popupBuilder.bind(this) }, 71023b3eb3cSopenharmony_ci placement: Placement.Bottom, 71123b3eb3cSopenharmony_ci popupColor: Color.White, 71223b3eb3cSopenharmony_ci enableArrow: false, 71323b3eb3cSopenharmony_ci onStateChange: (e5) => { 71423b3eb3cSopenharmony_ci this.isPopupShown = e5.isVisible; 71523b3eb3cSopenharmony_ci if (!e5.isVisible) { 71623b3eb3cSopenharmony_ci this.isMoreIconOnClick = false; 71723b3eb3cSopenharmony_ci } 71823b3eb3cSopenharmony_ci } 71923b3eb3cSopenharmony_ci }); 72023b3eb3cSopenharmony_ci if (!w4) { 72123b3eb3cSopenharmony_ci Row.pop(); 72223b3eb3cSopenharmony_ci } 72323b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 72423b3eb3cSopenharmony_ci }); 72523b3eb3cSopenharmony_ci this.observeComponentCreation((t4, u4) => { 72623b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(t4); 72723b3eb3cSopenharmony_ci Image.create(PUBLIC_MORE); 72823b3eb3cSopenharmony_ci Image.width(ImageMenuItem.imageSize); 72923b3eb3cSopenharmony_ci Image.draggable(false); 73023b3eb3cSopenharmony_ci Image.height(ImageMenuItem.imageSize); 73123b3eb3cSopenharmony_ci Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 73223b3eb3cSopenharmony_ci Image.focusable(true); 73323b3eb3cSopenharmony_ci if (!u4) { 73423b3eb3cSopenharmony_ci Image.pop(); 73523b3eb3cSopenharmony_ci } 73623b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 73723b3eb3cSopenharmony_ci }); 73823b3eb3cSopenharmony_ci Row.pop(); 73923b3eb3cSopenharmony_ci }); 74023b3eb3cSopenharmony_ci } 74123b3eb3cSopenharmony_ci if (!o4) { 74223b3eb3cSopenharmony_ci If.pop(); 74323b3eb3cSopenharmony_ci } 74423b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 74523b3eb3cSopenharmony_ci }); 74623b3eb3cSopenharmony_ci If.pop(); 74723b3eb3cSopenharmony_ci }); 74823b3eb3cSopenharmony_ci } 74923b3eb3cSopenharmony_ci else { 75023b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 75123b3eb3cSopenharmony_ci }); 75223b3eb3cSopenharmony_ci } 75323b3eb3cSopenharmony_ci if (!j4) { 75423b3eb3cSopenharmony_ci If.pop(); 75523b3eb3cSopenharmony_ci } 75623b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 75723b3eb3cSopenharmony_ci }); 75823b3eb3cSopenharmony_ci If.pop(); 75923b3eb3cSopenharmony_ci Row.pop(); 76023b3eb3cSopenharmony_ci Column.pop(); 76123b3eb3cSopenharmony_ci PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop(); 76223b3eb3cSopenharmony_ci } 76323b3eb3cSopenharmony_ci popupBuilder(g3 = null) { 76423b3eb3cSopenharmony_ci this.observeComponentCreation((c4, d4) => { 76523b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(c4); 76623b3eb3cSopenharmony_ci Column.create(); 76723b3eb3cSopenharmony_ci Column.width(ImageMenuItem.imageHotZoneWidth + 76823b3eb3cSopenharmony_ci CollapsibleMenuSection.focusPadding * CollapsibleMenuSection.marginsNum); 76923b3eb3cSopenharmony_ci Column.margin({ top: CollapsibleMenuSection.focusPadding, bottom: CollapsibleMenuSection.focusPadding }); 77023b3eb3cSopenharmony_ci Column.onAppear(() => { 77123b3eb3cSopenharmony_ci focusControl.requestFocus(ImageMenuItem.focusablePrefix + 77223b3eb3cSopenharmony_ci this.firstFocusableIndex); 77323b3eb3cSopenharmony_ci }); 77423b3eb3cSopenharmony_ci if (!d4) { 77523b3eb3cSopenharmony_ci Column.pop(); 77623b3eb3cSopenharmony_ci } 77723b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 77823b3eb3cSopenharmony_ci }); 77923b3eb3cSopenharmony_ci this.observeComponentCreation((j3, k3) => { 78023b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(j3); 78123b3eb3cSopenharmony_ci If.create(); 78223b3eb3cSopenharmony_ci if (this.menuItems) { 78323b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 78423b3eb3cSopenharmony_ci this.observeComponentCreation((o3, p3) => { 78523b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(o3); 78623b3eb3cSopenharmony_ci ForEach.create(); 78723b3eb3cSopenharmony_ci const q3 = (s3, t3) => { 78823b3eb3cSopenharmony_ci const u3 = s3; 78923b3eb3cSopenharmony_ci { 79023b3eb3cSopenharmony_ci this.observeComponentCreation((w3, x3) => { 79123b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(w3); 79223b3eb3cSopenharmony_ci if (x3) { 79323b3eb3cSopenharmony_ci let y3 = new ImageMenuItem(this, { item: u3, index: this.index * 1000 + 79423b3eb3cSopenharmony_ci CollapsibleMenuSection.maxCountOfVisibleItems + t3, isPopup: true }, undefined, w3, () => { }, { page: 'library/src/main/ets/components/mainpage/MainPage.ets', line: 341, col: 13 }); 79523b3eb3cSopenharmony_ci ViewPU.create(y3); 79623b3eb3cSopenharmony_ci let z3 = () => { 79723b3eb3cSopenharmony_ci return { 79823b3eb3cSopenharmony_ci item: u3, 79923b3eb3cSopenharmony_ci index: this.index * 1000 + 80023b3eb3cSopenharmony_ci CollapsibleMenuSection.maxCountOfVisibleItems + t3, 80123b3eb3cSopenharmony_ci isPopup: true 80223b3eb3cSopenharmony_ci }; 80323b3eb3cSopenharmony_ci }; 80423b3eb3cSopenharmony_ci y3.paramsGenerator_ = z3; 80523b3eb3cSopenharmony_ci } 80623b3eb3cSopenharmony_ci else { 80723b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(w3, {}); 80823b3eb3cSopenharmony_ci } 80923b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 81023b3eb3cSopenharmony_ci }); 81123b3eb3cSopenharmony_ci } 81223b3eb3cSopenharmony_ci }; 81323b3eb3cSopenharmony_ci this.forEachUpdateFunction(o3, this.menuItems.slice(CollapsibleMenuSection.maxCountOfVisibleItems - 1, this.menuItems.length), q3, undefined, true, false); 81423b3eb3cSopenharmony_ci if (!p3) { 81523b3eb3cSopenharmony_ci ForEach.pop(); 81623b3eb3cSopenharmony_ci } 81723b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 81823b3eb3cSopenharmony_ci }); 81923b3eb3cSopenharmony_ci ForEach.pop(); 82023b3eb3cSopenharmony_ci }); 82123b3eb3cSopenharmony_ci } 82223b3eb3cSopenharmony_ci else { 82323b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 82423b3eb3cSopenharmony_ci }); 82523b3eb3cSopenharmony_ci } 82623b3eb3cSopenharmony_ci if (!k3) { 82723b3eb3cSopenharmony_ci If.pop(); 82823b3eb3cSopenharmony_ci } 82923b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 83023b3eb3cSopenharmony_ci }); 83123b3eb3cSopenharmony_ci If.pop(); 83223b3eb3cSopenharmony_ci Column.pop(); 83323b3eb3cSopenharmony_ci } 83423b3eb3cSopenharmony_ci rerender() { 83523b3eb3cSopenharmony_ci PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this); 83623b3eb3cSopenharmony_ci this.updateDirtyElements(); 83723b3eb3cSopenharmony_ci PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop(); 83823b3eb3cSopenharmony_ci } 83923b3eb3cSopenharmony_ci} 84023b3eb3cSopenharmony_ciCollapsibleMenuSection.maxCountOfVisibleItems = 3; 84123b3eb3cSopenharmony_ciCollapsibleMenuSection.focusPadding = 4; 84223b3eb3cSopenharmony_ciCollapsibleMenuSection.marginsNum = 2; 84323b3eb3cSopenharmony_ciclass ImageMenuItem extends ViewPU { 84423b3eb3cSopenharmony_ci constructor(w2, x2, y2, z2 = -1, a3 = undefined, b3) { 84523b3eb3cSopenharmony_ci super(w2, y2, z2, b3); 84623b3eb3cSopenharmony_ci if (typeof a3 === 'function') { 84723b3eb3cSopenharmony_ci this.paramsGenerator_ = a3; 84823b3eb3cSopenharmony_ci } 84923b3eb3cSopenharmony_ci this.item = {}; 85023b3eb3cSopenharmony_ci this.index = 0; 85123b3eb3cSopenharmony_ci this.longPressTime = 500; 85223b3eb3cSopenharmony_ci this.minFontSize = 1.75; 85323b3eb3cSopenharmony_ci this.isFollowingSystemFontScale = false; 85423b3eb3cSopenharmony_ci this.maxFontScale = 1; 85523b3eb3cSopenharmony_ci this.systemFontScale = 1; 85623b3eb3cSopenharmony_ci this.isPopup = false; 85723b3eb3cSopenharmony_ci this.__isOnFocus = new ObservedPropertySimplePU(false, this, 'isOnFocus'); 85823b3eb3cSopenharmony_ci this.__isOnHover = new ObservedPropertySimplePU(false, this, 'isOnHover'); 85923b3eb3cSopenharmony_ci this.__isOnClick = new ObservedPropertySimplePU(false, this, 'isOnClick'); 86023b3eb3cSopenharmony_ci this.__fontSize = new SynchedPropertySimpleOneWayPU(x2.fontSize, this, 'fontSize'); 86123b3eb3cSopenharmony_ci this.dialogController = new CustomDialogController({ 86223b3eb3cSopenharmony_ci builder: () => { 86323b3eb3cSopenharmony_ci let c3 = new ComposeTitleBarDialog(this, { 86423b3eb3cSopenharmony_ci cancel: () => { 86523b3eb3cSopenharmony_ci }, 86623b3eb3cSopenharmony_ci confirm: () => { 86723b3eb3cSopenharmony_ci }, 86823b3eb3cSopenharmony_ci itemComposeTitleDialog: this.item, 86923b3eb3cSopenharmony_ci composeTitleBarDialog: this.item.label ? this.item.label : this.textDialog(), 87023b3eb3cSopenharmony_ci fontSize: this.fontSize, 87123b3eb3cSopenharmony_ci }, undefined, -1, () => { }, { page: 'library/src/main/ets/components/mainpage/MainPage.ets', line: 378, col: 14 }); 87223b3eb3cSopenharmony_ci c3.setController(this.dialogController); 87323b3eb3cSopenharmony_ci ViewPU.create(c3); 87423b3eb3cSopenharmony_ci let d3 = () => { 87523b3eb3cSopenharmony_ci return { 87623b3eb3cSopenharmony_ci cancel: () => { 87723b3eb3cSopenharmony_ci }, 87823b3eb3cSopenharmony_ci confirm: () => { 87923b3eb3cSopenharmony_ci }, 88023b3eb3cSopenharmony_ci itemComposeTitleDialog: this.item, 88123b3eb3cSopenharmony_ci composeTitleBarDialog: this.item.label ? this.item.label : this.textDialog(), 88223b3eb3cSopenharmony_ci fontSize: this.fontSize 88323b3eb3cSopenharmony_ci }; 88423b3eb3cSopenharmony_ci }; 88523b3eb3cSopenharmony_ci c3.paramsGenerator_ = d3; 88623b3eb3cSopenharmony_ci }, 88723b3eb3cSopenharmony_ci maskColor: Color.Transparent, 88823b3eb3cSopenharmony_ci isModal: true, 88923b3eb3cSopenharmony_ci customStyle: true 89023b3eb3cSopenharmony_ci }, this); 89123b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(x2); 89223b3eb3cSopenharmony_ci this.finalizeConstruction(); 89323b3eb3cSopenharmony_ci } 89423b3eb3cSopenharmony_ci setInitiallyProvidedValue(v2) { 89523b3eb3cSopenharmony_ci if (v2.item !== undefined) { 89623b3eb3cSopenharmony_ci this.item = v2.item; 89723b3eb3cSopenharmony_ci } 89823b3eb3cSopenharmony_ci if (v2.index !== undefined) { 89923b3eb3cSopenharmony_ci this.index = v2.index; 90023b3eb3cSopenharmony_ci } 90123b3eb3cSopenharmony_ci if (v2.longPressTime !== undefined) { 90223b3eb3cSopenharmony_ci this.longPressTime = v2.longPressTime; 90323b3eb3cSopenharmony_ci } 90423b3eb3cSopenharmony_ci if (v2.minFontSize !== undefined) { 90523b3eb3cSopenharmony_ci this.minFontSize = v2.minFontSize; 90623b3eb3cSopenharmony_ci } 90723b3eb3cSopenharmony_ci if (v2.isFollowingSystemFontScale !== undefined) { 90823b3eb3cSopenharmony_ci this.isFollowingSystemFontScale = v2.isFollowingSystemFontScale; 90923b3eb3cSopenharmony_ci } 91023b3eb3cSopenharmony_ci if (v2.maxFontScale !== undefined) { 91123b3eb3cSopenharmony_ci this.maxFontScale = v2.maxFontScale; 91223b3eb3cSopenharmony_ci } 91323b3eb3cSopenharmony_ci if (v2.systemFontScale !== undefined) { 91423b3eb3cSopenharmony_ci this.systemFontScale = v2.systemFontScale; 91523b3eb3cSopenharmony_ci } 91623b3eb3cSopenharmony_ci if (v2.isPopup !== undefined) { 91723b3eb3cSopenharmony_ci this.isPopup = v2.isPopup; 91823b3eb3cSopenharmony_ci } 91923b3eb3cSopenharmony_ci if (v2.isOnFocus !== undefined) { 92023b3eb3cSopenharmony_ci this.isOnFocus = v2.isOnFocus; 92123b3eb3cSopenharmony_ci } 92223b3eb3cSopenharmony_ci if (v2.isOnHover !== undefined) { 92323b3eb3cSopenharmony_ci this.isOnHover = v2.isOnHover; 92423b3eb3cSopenharmony_ci } 92523b3eb3cSopenharmony_ci if (v2.isOnClick !== undefined) { 92623b3eb3cSopenharmony_ci this.isOnClick = v2.isOnClick; 92723b3eb3cSopenharmony_ci } 92823b3eb3cSopenharmony_ci if (v2.fontSize === undefined) { 92923b3eb3cSopenharmony_ci this.__fontSize.set(1); 93023b3eb3cSopenharmony_ci } 93123b3eb3cSopenharmony_ci if (v2.dialogController !== undefined) { 93223b3eb3cSopenharmony_ci this.dialogController = v2.dialogController; 93323b3eb3cSopenharmony_ci } 93423b3eb3cSopenharmony_ci } 93523b3eb3cSopenharmony_ci updateStateVars(u2) { 93623b3eb3cSopenharmony_ci this.__fontSize.reset(u2.fontSize); 93723b3eb3cSopenharmony_ci } 93823b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(t2) { 93923b3eb3cSopenharmony_ci this.__isOnFocus.purgeDependencyOnElmtId(t2); 94023b3eb3cSopenharmony_ci this.__isOnHover.purgeDependencyOnElmtId(t2); 94123b3eb3cSopenharmony_ci this.__isOnClick.purgeDependencyOnElmtId(t2); 94223b3eb3cSopenharmony_ci this.__fontSize.purgeDependencyOnElmtId(t2); 94323b3eb3cSopenharmony_ci } 94423b3eb3cSopenharmony_ci aboutToBeDeleted() { 94523b3eb3cSopenharmony_ci this.__isOnFocus.aboutToBeDeleted(); 94623b3eb3cSopenharmony_ci this.__isOnHover.aboutToBeDeleted(); 94723b3eb3cSopenharmony_ci this.__isOnClick.aboutToBeDeleted(); 94823b3eb3cSopenharmony_ci this.__fontSize.aboutToBeDeleted(); 94923b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 95023b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 95123b3eb3cSopenharmony_ci } 95223b3eb3cSopenharmony_ci get isOnFocus() { 95323b3eb3cSopenharmony_ci return this.__isOnFocus.get(); 95423b3eb3cSopenharmony_ci } 95523b3eb3cSopenharmony_ci set isOnFocus(s2) { 95623b3eb3cSopenharmony_ci this.__isOnFocus.set(s2); 95723b3eb3cSopenharmony_ci } 95823b3eb3cSopenharmony_ci get isOnHover() { 95923b3eb3cSopenharmony_ci return this.__isOnHover.get(); 96023b3eb3cSopenharmony_ci } 96123b3eb3cSopenharmony_ci set isOnHover(r2) { 96223b3eb3cSopenharmony_ci this.__isOnHover.set(r2); 96323b3eb3cSopenharmony_ci } 96423b3eb3cSopenharmony_ci get isOnClick() { 96523b3eb3cSopenharmony_ci return this.__isOnClick.get(); 96623b3eb3cSopenharmony_ci } 96723b3eb3cSopenharmony_ci set isOnClick(q2) { 96823b3eb3cSopenharmony_ci this.__isOnClick.set(q2); 96923b3eb3cSopenharmony_ci } 97023b3eb3cSopenharmony_ci get fontSize() { 97123b3eb3cSopenharmony_ci return this.__fontSize.get(); 97223b3eb3cSopenharmony_ci } 97323b3eb3cSopenharmony_ci set fontSize(p2) { 97423b3eb3cSopenharmony_ci this.__fontSize.set(p2); 97523b3eb3cSopenharmony_ci } 97623b3eb3cSopenharmony_ci textDialog() { 97723b3eb3cSopenharmony_ci if (this.item.value === PUBLIC_MORE) { 97823b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10003, params: ['sys.string.ohos_toolbar_more'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 97923b3eb3cSopenharmony_ci } 98023b3eb3cSopenharmony_ci else if (this.item.value === PUBLIC_BACK) { 98123b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10003, params: ['sys.string.icon_back'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 98223b3eb3cSopenharmony_ci } 98323b3eb3cSopenharmony_ci else { 98423b3eb3cSopenharmony_ci return this.item.label ? this.item.label : ''; 98523b3eb3cSopenharmony_ci } 98623b3eb3cSopenharmony_ci } 98723b3eb3cSopenharmony_ci getFgColor() { 98823b3eb3cSopenharmony_ci return this.isOnClick 98923b3eb3cSopenharmony_ci ? { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon_pressed'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 99023b3eb3cSopenharmony_ci } 99123b3eb3cSopenharmony_ci getBgColor() { 99223b3eb3cSopenharmony_ci if (this.isOnClick) { 99323b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_click_effect'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 99423b3eb3cSopenharmony_ci } 99523b3eb3cSopenharmony_ci else if (this.isOnHover) { 99623b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_hover'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 99723b3eb3cSopenharmony_ci } 99823b3eb3cSopenharmony_ci else { 99923b3eb3cSopenharmony_ci return Color.Transparent; 100023b3eb3cSopenharmony_ci } 100123b3eb3cSopenharmony_ci } 100223b3eb3cSopenharmony_ci aboutToAppear() { 100323b3eb3cSopenharmony_ci try { 100423b3eb3cSopenharmony_ci let o2 = this.getUIContext(); 100523b3eb3cSopenharmony_ci this.isFollowingSystemFontScale = o2.isFollowingSystemFontScale(); 100623b3eb3cSopenharmony_ci this.maxFontScale = o2.getMaxFontScale(); 100723b3eb3cSopenharmony_ci } 100823b3eb3cSopenharmony_ci catch (l2) { 100923b3eb3cSopenharmony_ci let m2 = l2.code; 101023b3eb3cSopenharmony_ci let n2 = l2.message; 101123b3eb3cSopenharmony_ci hilog.error(0x3900, 'ComposeTitleBar', `Failed to init fontsizescale info, cause, code: ${m2}, message: ${n2}`); 101223b3eb3cSopenharmony_ci } 101323b3eb3cSopenharmony_ci } 101423b3eb3cSopenharmony_ci decideFontScale() { 101523b3eb3cSopenharmony_ci try { 101623b3eb3cSopenharmony_ci let k2 = this.getUIContext(); 101723b3eb3cSopenharmony_ci this.systemFontScale = k2.getHostContext()?.config?.fontSizeScale ?? 1; 101823b3eb3cSopenharmony_ci if (!this.isFollowingSystemFontScale) { 101923b3eb3cSopenharmony_ci return 1; 102023b3eb3cSopenharmony_ci } 102123b3eb3cSopenharmony_ci return Math.min(this.systemFontScale, this.maxFontScale); 102223b3eb3cSopenharmony_ci } 102323b3eb3cSopenharmony_ci catch (h2) { 102423b3eb3cSopenharmony_ci let i2 = h2.code; 102523b3eb3cSopenharmony_ci let j2 = h2.message; 102623b3eb3cSopenharmony_ci hilog.error(0x3900, 'ComposeTitleBar', `Faild to decideFontScale,cause, code: ${i2}, message: ${j2}`); 102723b3eb3cSopenharmony_ci return 1; 102823b3eb3cSopenharmony_ci } 102923b3eb3cSopenharmony_ci } 103023b3eb3cSopenharmony_ci initialRender() { 103123b3eb3cSopenharmony_ci PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this); 103223b3eb3cSopenharmony_ci this.observeComponentCreation((u1, v1) => { 103323b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(u1); 103423b3eb3cSopenharmony_ci Row.create(); 103523b3eb3cSopenharmony_ci Row.width(ImageMenuItem.imageHotZoneWidth); 103623b3eb3cSopenharmony_ci Row.height(ImageMenuItem.imageHotZoneWidth); 103723b3eb3cSopenharmony_ci Row.borderRadius(ImageMenuItem.buttonBorderRadius); 103823b3eb3cSopenharmony_ci Row.foregroundColor(this.getFgColor()); 103923b3eb3cSopenharmony_ci Row.backgroundColor(this.getBgColor()); 104023b3eb3cSopenharmony_ci Row.justifyContent(FlexAlign.Center); 104123b3eb3cSopenharmony_ci Row.opacity(this.item?.isEnabled ? 1 : ImageMenuItem.disabledImageOpacity); 104223b3eb3cSopenharmony_ci ViewStackProcessor.visualState('focused'); 104323b3eb3cSopenharmony_ci Row.border({ 104423b3eb3cSopenharmony_ci radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 104523b3eb3cSopenharmony_ci width: ImageMenuItem.focusBorderWidth, 104623b3eb3cSopenharmony_ci color: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 104723b3eb3cSopenharmony_ci style: BorderStyle.Solid 104823b3eb3cSopenharmony_ci }); 104923b3eb3cSopenharmony_ci ViewStackProcessor.visualState('normal'); 105023b3eb3cSopenharmony_ci Row.border({ 105123b3eb3cSopenharmony_ci radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 105223b3eb3cSopenharmony_ci width: 0 105323b3eb3cSopenharmony_ci }); 105423b3eb3cSopenharmony_ci ViewStackProcessor.visualState(); 105523b3eb3cSopenharmony_ci Row.onFocus(() => { 105623b3eb3cSopenharmony_ci if (!this.item?.isEnabled) { 105723b3eb3cSopenharmony_ci return; 105823b3eb3cSopenharmony_ci } 105923b3eb3cSopenharmony_ci this.isOnFocus = true; 106023b3eb3cSopenharmony_ci }); 106123b3eb3cSopenharmony_ci Row.onBlur(() => this.isOnFocus = false); 106223b3eb3cSopenharmony_ci Row.onHover((g2) => { 106323b3eb3cSopenharmony_ci if (!this.item?.isEnabled) { 106423b3eb3cSopenharmony_ci return; 106523b3eb3cSopenharmony_ci } 106623b3eb3cSopenharmony_ci this.isOnHover = g2; 106723b3eb3cSopenharmony_ci }); 106823b3eb3cSopenharmony_ci Row.onKeyEvent((f2) => { 106923b3eb3cSopenharmony_ci if (!this.item?.isEnabled) { 107023b3eb3cSopenharmony_ci return; 107123b3eb3cSopenharmony_ci } 107223b3eb3cSopenharmony_ci if (f2.keyCode !== KeyCode.KEYCODE_ENTER && 107323b3eb3cSopenharmony_ci f2.keyCode !== KeyCode.KEYCODE_SPACE) { 107423b3eb3cSopenharmony_ci return; 107523b3eb3cSopenharmony_ci } 107623b3eb3cSopenharmony_ci if (f2.type === KeyType.Down) { 107723b3eb3cSopenharmony_ci this.isOnClick = true; 107823b3eb3cSopenharmony_ci } 107923b3eb3cSopenharmony_ci if (f2.type === KeyType.Up) { 108023b3eb3cSopenharmony_ci this.isOnClick = false; 108123b3eb3cSopenharmony_ci } 108223b3eb3cSopenharmony_ci }); 108323b3eb3cSopenharmony_ci Row.onTouch((e2) => { 108423b3eb3cSopenharmony_ci if (!this.item?.isEnabled) { 108523b3eb3cSopenharmony_ci return; 108623b3eb3cSopenharmony_ci } 108723b3eb3cSopenharmony_ci if (e2.type === TouchType.Down) { 108823b3eb3cSopenharmony_ci this.isOnClick = true; 108923b3eb3cSopenharmony_ci } 109023b3eb3cSopenharmony_ci if (e2.type === TouchType.Up || e2.type === TouchType.Cancel) { 109123b3eb3cSopenharmony_ci this.isOnClick = false; 109223b3eb3cSopenharmony_ci if (this.fontSize >= this.minFontSize && this.isPopup === false) { 109323b3eb3cSopenharmony_ci this.dialogController?.close(); 109423b3eb3cSopenharmony_ci } 109523b3eb3cSopenharmony_ci } 109623b3eb3cSopenharmony_ci }); 109723b3eb3cSopenharmony_ci Row.onClick(() => { 109823b3eb3cSopenharmony_ci if (this.item) { 109923b3eb3cSopenharmony_ci return this.item.isEnabled && this.item.action?.(); 110023b3eb3cSopenharmony_ci } 110123b3eb3cSopenharmony_ci }); 110223b3eb3cSopenharmony_ci Gesture.create(GesturePriority.Low); 110323b3eb3cSopenharmony_ci LongPressGesture.create({ repeat: false, duration: this.longPressTime }); 110423b3eb3cSopenharmony_ci LongPressGesture.onAction((d2) => { 110523b3eb3cSopenharmony_ci this.fontSize = this.decideFontScale(); 110623b3eb3cSopenharmony_ci if (d2) { 110723b3eb3cSopenharmony_ci if (this.fontSize >= this.minFontSize && this.isPopup === false) { 110823b3eb3cSopenharmony_ci this.dialogController?.open(); 110923b3eb3cSopenharmony_ci } 111023b3eb3cSopenharmony_ci } 111123b3eb3cSopenharmony_ci }); 111223b3eb3cSopenharmony_ci LongPressGesture.pop(); 111323b3eb3cSopenharmony_ci Gesture.pop(); 111423b3eb3cSopenharmony_ci if (!v1) { 111523b3eb3cSopenharmony_ci Row.pop(); 111623b3eb3cSopenharmony_ci } 111723b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 111823b3eb3cSopenharmony_ci }); 111923b3eb3cSopenharmony_ci this.observeComponentCreation((s1, t1) => { 112023b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(s1); 112123b3eb3cSopenharmony_ci Image.create(this.item?.value); 112223b3eb3cSopenharmony_ci Image.matchTextDirection(this.item?.value === PUBLIC_BACK ? true : false); 112323b3eb3cSopenharmony_ci Image.width(ImageMenuItem.imageSize); 112423b3eb3cSopenharmony_ci Image.draggable(false); 112523b3eb3cSopenharmony_ci Image.height(ImageMenuItem.imageSize); 112623b3eb3cSopenharmony_ci Image.focusable(this.item?.isEnabled); 112723b3eb3cSopenharmony_ci Image.key(ImageMenuItem.focusablePrefix + this.index); 112823b3eb3cSopenharmony_ci Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 112923b3eb3cSopenharmony_ci if (!t1) { 113023b3eb3cSopenharmony_ci Image.pop(); 113123b3eb3cSopenharmony_ci } 113223b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 113323b3eb3cSopenharmony_ci }); 113423b3eb3cSopenharmony_ci Row.pop(); 113523b3eb3cSopenharmony_ci PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop(); 113623b3eb3cSopenharmony_ci } 113723b3eb3cSopenharmony_ci rerender() { 113823b3eb3cSopenharmony_ci PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this); 113923b3eb3cSopenharmony_ci this.updateDirtyElements(); 114023b3eb3cSopenharmony_ci PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop(); 114123b3eb3cSopenharmony_ci } 114223b3eb3cSopenharmony_ci} 114323b3eb3cSopenharmony_ciImageMenuItem.imageSize = 24; 114423b3eb3cSopenharmony_ciImageMenuItem.imageHotZoneWidth = 48; 114523b3eb3cSopenharmony_ciImageMenuItem.buttonBorderRadius = 8; 114623b3eb3cSopenharmony_ciImageMenuItem.focusBorderWidth = 2; 114723b3eb3cSopenharmony_ciImageMenuItem.disabledImageOpacity = 0.4; 114823b3eb3cSopenharmony_ciImageMenuItem.focusablePrefix = 'Id-ComposeTitleBar-ImageMenuItem-'; 114923b3eb3cSopenharmony_ciclass ComposeTitleBarDialog extends ViewPU { 115023b3eb3cSopenharmony_ci constructor(i1, j1, k1, l1 = -1, m1 = undefined, n1) { 115123b3eb3cSopenharmony_ci super(i1, k1, l1, n1); 115223b3eb3cSopenharmony_ci if (typeof m1 === 'function') { 115323b3eb3cSopenharmony_ci this.paramsGenerator_ = m1; 115423b3eb3cSopenharmony_ci } 115523b3eb3cSopenharmony_ci this.itemComposeTitleDialog = {}; 115623b3eb3cSopenharmony_ci this.callbackId = undefined; 115723b3eb3cSopenharmony_ci this.composeTitleBarDialog = ''; 115823b3eb3cSopenharmony_ci this.mainWindowStage = undefined; 115923b3eb3cSopenharmony_ci this.controller = undefined; 116023b3eb3cSopenharmony_ci this.minFontSize = 1.75; 116123b3eb3cSopenharmony_ci this.maxFontSize = 3.2; 116223b3eb3cSopenharmony_ci this.screenWidth = 640; 116323b3eb3cSopenharmony_ci this.verticalScreenLines = 6; 116423b3eb3cSopenharmony_ci this.horizontalsScreenLines = 1; 116523b3eb3cSopenharmony_ci this.__mainWindow = this.createStorageLink('mainWindow', undefined, 'mainWindow'); 116623b3eb3cSopenharmony_ci this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize'); 116723b3eb3cSopenharmony_ci this.__maxLines = new ObservedPropertySimplePU(1, this, 'maxLines'); 116823b3eb3cSopenharmony_ci this.__windowStandardHeight = this.createStorageProp('windowStandardHeight', 0, 'windowStandardHeight'); 116923b3eb3cSopenharmony_ci this.cancel = () => { 117023b3eb3cSopenharmony_ci }; 117123b3eb3cSopenharmony_ci this.confirm = () => { 117223b3eb3cSopenharmony_ci }; 117323b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(j1); 117423b3eb3cSopenharmony_ci this.finalizeConstruction(); 117523b3eb3cSopenharmony_ci } 117623b3eb3cSopenharmony_ci setInitiallyProvidedValue(h1) { 117723b3eb3cSopenharmony_ci if (h1.itemComposeTitleDialog !== undefined) { 117823b3eb3cSopenharmony_ci this.itemComposeTitleDialog = h1.itemComposeTitleDialog; 117923b3eb3cSopenharmony_ci } 118023b3eb3cSopenharmony_ci if (h1.callbackId !== undefined) { 118123b3eb3cSopenharmony_ci this.callbackId = h1.callbackId; 118223b3eb3cSopenharmony_ci } 118323b3eb3cSopenharmony_ci if (h1.composeTitleBarDialog !== undefined) { 118423b3eb3cSopenharmony_ci this.composeTitleBarDialog = h1.composeTitleBarDialog; 118523b3eb3cSopenharmony_ci } 118623b3eb3cSopenharmony_ci if (h1.mainWindowStage !== undefined) { 118723b3eb3cSopenharmony_ci this.mainWindowStage = h1.mainWindowStage; 118823b3eb3cSopenharmony_ci } 118923b3eb3cSopenharmony_ci if (h1.controller !== undefined) { 119023b3eb3cSopenharmony_ci this.controller = h1.controller; 119123b3eb3cSopenharmony_ci } 119223b3eb3cSopenharmony_ci if (h1.minFontSize !== undefined) { 119323b3eb3cSopenharmony_ci this.minFontSize = h1.minFontSize; 119423b3eb3cSopenharmony_ci } 119523b3eb3cSopenharmony_ci if (h1.maxFontSize !== undefined) { 119623b3eb3cSopenharmony_ci this.maxFontSize = h1.maxFontSize; 119723b3eb3cSopenharmony_ci } 119823b3eb3cSopenharmony_ci if (h1.screenWidth !== undefined) { 119923b3eb3cSopenharmony_ci this.screenWidth = h1.screenWidth; 120023b3eb3cSopenharmony_ci } 120123b3eb3cSopenharmony_ci if (h1.verticalScreenLines !== undefined) { 120223b3eb3cSopenharmony_ci this.verticalScreenLines = h1.verticalScreenLines; 120323b3eb3cSopenharmony_ci } 120423b3eb3cSopenharmony_ci if (h1.horizontalsScreenLines !== undefined) { 120523b3eb3cSopenharmony_ci this.horizontalsScreenLines = h1.horizontalsScreenLines; 120623b3eb3cSopenharmony_ci } 120723b3eb3cSopenharmony_ci if (h1.fontSize !== undefined) { 120823b3eb3cSopenharmony_ci this.fontSize = h1.fontSize; 120923b3eb3cSopenharmony_ci } 121023b3eb3cSopenharmony_ci if (h1.maxLines !== undefined) { 121123b3eb3cSopenharmony_ci this.maxLines = h1.maxLines; 121223b3eb3cSopenharmony_ci } 121323b3eb3cSopenharmony_ci if (h1.cancel !== undefined) { 121423b3eb3cSopenharmony_ci this.cancel = h1.cancel; 121523b3eb3cSopenharmony_ci } 121623b3eb3cSopenharmony_ci if (h1.confirm !== undefined) { 121723b3eb3cSopenharmony_ci this.confirm = h1.confirm; 121823b3eb3cSopenharmony_ci } 121923b3eb3cSopenharmony_ci } 122023b3eb3cSopenharmony_ci updateStateVars(g1) { 122123b3eb3cSopenharmony_ci } 122223b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(f1) { 122323b3eb3cSopenharmony_ci this.__mainWindow.purgeDependencyOnElmtId(f1); 122423b3eb3cSopenharmony_ci this.__fontSize.purgeDependencyOnElmtId(f1); 122523b3eb3cSopenharmony_ci this.__maxLines.purgeDependencyOnElmtId(f1); 122623b3eb3cSopenharmony_ci this.__windowStandardHeight.purgeDependencyOnElmtId(f1); 122723b3eb3cSopenharmony_ci } 122823b3eb3cSopenharmony_ci aboutToBeDeleted() { 122923b3eb3cSopenharmony_ci this.__mainWindow.aboutToBeDeleted(); 123023b3eb3cSopenharmony_ci this.__fontSize.aboutToBeDeleted(); 123123b3eb3cSopenharmony_ci this.__maxLines.aboutToBeDeleted(); 123223b3eb3cSopenharmony_ci this.__windowStandardHeight.aboutToBeDeleted(); 123323b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 123423b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 123523b3eb3cSopenharmony_ci } 123623b3eb3cSopenharmony_ci setController(e1) { 123723b3eb3cSopenharmony_ci this.controller = e1; 123823b3eb3cSopenharmony_ci } 123923b3eb3cSopenharmony_ci get mainWindow() { 124023b3eb3cSopenharmony_ci return this.__mainWindow.get(); 124123b3eb3cSopenharmony_ci } 124223b3eb3cSopenharmony_ci set mainWindow(d1) { 124323b3eb3cSopenharmony_ci this.__mainWindow.set(d1); 124423b3eb3cSopenharmony_ci } 124523b3eb3cSopenharmony_ci get fontSize() { 124623b3eb3cSopenharmony_ci return this.__fontSize.get(); 124723b3eb3cSopenharmony_ci } 124823b3eb3cSopenharmony_ci set fontSize(c1) { 124923b3eb3cSopenharmony_ci this.__fontSize.set(c1); 125023b3eb3cSopenharmony_ci } 125123b3eb3cSopenharmony_ci get maxLines() { 125223b3eb3cSopenharmony_ci return this.__maxLines.get(); 125323b3eb3cSopenharmony_ci } 125423b3eb3cSopenharmony_ci set maxLines(b1) { 125523b3eb3cSopenharmony_ci this.__maxLines.set(b1); 125623b3eb3cSopenharmony_ci } 125723b3eb3cSopenharmony_ci get windowStandardHeight() { 125823b3eb3cSopenharmony_ci return this.__windowStandardHeight.get(); 125923b3eb3cSopenharmony_ci } 126023b3eb3cSopenharmony_ci set windowStandardHeight(a1) { 126123b3eb3cSopenharmony_ci this.__windowStandardHeight.set(a1); 126223b3eb3cSopenharmony_ci } 126323b3eb3cSopenharmony_ci initialRender() { 126423b3eb3cSopenharmony_ci PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this); 126523b3eb3cSopenharmony_ci this.observeComponentCreation((e, f) => { 126623b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(e); 126723b3eb3cSopenharmony_ci If.create(); 126823b3eb3cSopenharmony_ci if (this.composeTitleBarDialog) { 126923b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 127023b3eb3cSopenharmony_ci this.observeComponentCreation((y, z) => { 127123b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(y); 127223b3eb3cSopenharmony_ci Column.create(); 127323b3eb3cSopenharmony_ci Column.width(this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG); 127423b3eb3cSopenharmony_ci Column.constraintSize({ minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG }); 127523b3eb3cSopenharmony_ci Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK); 127623b3eb3cSopenharmony_ci Column.shadow(ShadowStyle.OUTER_DEFAULT_LG); 127723b3eb3cSopenharmony_ci Column.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.corner_radius_level10'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 127823b3eb3cSopenharmony_ci if (!z) { 127923b3eb3cSopenharmony_ci Column.pop(); 128023b3eb3cSopenharmony_ci } 128123b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 128223b3eb3cSopenharmony_ci }); 128323b3eb3cSopenharmony_ci this.observeComponentCreation((w, x) => { 128423b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(w); 128523b3eb3cSopenharmony_ci Image.create(this.itemComposeTitleDialog.value); 128623b3eb3cSopenharmony_ci Image.width(IMAGE_SIZE); 128723b3eb3cSopenharmony_ci Image.height(IMAGE_SIZE); 128823b3eb3cSopenharmony_ci Image.margin({ 128923b3eb3cSopenharmony_ci top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level24'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 129023b3eb3cSopenharmony_ci bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 129123b3eb3cSopenharmony_ci }); 129223b3eb3cSopenharmony_ci Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 129323b3eb3cSopenharmony_ci if (!x) { 129423b3eb3cSopenharmony_ci Image.pop(); 129523b3eb3cSopenharmony_ci } 129623b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 129723b3eb3cSopenharmony_ci }); 129823b3eb3cSopenharmony_ci this.observeComponentCreation((u, v) => { 129923b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(u); 130023b3eb3cSopenharmony_ci Column.create(); 130123b3eb3cSopenharmony_ci Column.width('100%'); 130223b3eb3cSopenharmony_ci Column.padding({ 130323b3eb3cSopenharmony_ci left: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level4'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 130423b3eb3cSopenharmony_ci right: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level4'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 130523b3eb3cSopenharmony_ci bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level12'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 130623b3eb3cSopenharmony_ci }); 130723b3eb3cSopenharmony_ci if (!v) { 130823b3eb3cSopenharmony_ci Column.pop(); 130923b3eb3cSopenharmony_ci } 131023b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 131123b3eb3cSopenharmony_ci }); 131223b3eb3cSopenharmony_ci this.observeComponentCreation((s, t) => { 131323b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(s); 131423b3eb3cSopenharmony_ci Text.create(this.composeTitleBarDialog); 131523b3eb3cSopenharmony_ci Text.fontSize(TEXT_EDITABLE_DIALOG); 131623b3eb3cSopenharmony_ci Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 131723b3eb3cSopenharmony_ci Text.maxLines(this.maxLines); 131823b3eb3cSopenharmony_ci Text.width('100%'); 131923b3eb3cSopenharmony_ci Text.textAlign(TextAlign.Center); 132023b3eb3cSopenharmony_ci Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 132123b3eb3cSopenharmony_ci if (!t) { 132223b3eb3cSopenharmony_ci Text.pop(); 132323b3eb3cSopenharmony_ci } 132423b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 132523b3eb3cSopenharmony_ci }); 132623b3eb3cSopenharmony_ci Text.pop(); 132723b3eb3cSopenharmony_ci Column.pop(); 132823b3eb3cSopenharmony_ci Column.pop(); 132923b3eb3cSopenharmony_ci }); 133023b3eb3cSopenharmony_ci } 133123b3eb3cSopenharmony_ci else { 133223b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 133323b3eb3cSopenharmony_ci this.observeComponentCreation((l, m) => { 133423b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(l); 133523b3eb3cSopenharmony_ci Column.create(); 133623b3eb3cSopenharmony_ci Column.width(this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG); 133723b3eb3cSopenharmony_ci Column.constraintSize({ minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG }); 133823b3eb3cSopenharmony_ci Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK); 133923b3eb3cSopenharmony_ci Column.shadow(ShadowStyle.OUTER_DEFAULT_LG); 134023b3eb3cSopenharmony_ci Column.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.corner_radius_level10'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 134123b3eb3cSopenharmony_ci Column.justifyContent(FlexAlign.Center); 134223b3eb3cSopenharmony_ci if (!m) { 134323b3eb3cSopenharmony_ci Column.pop(); 134423b3eb3cSopenharmony_ci } 134523b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 134623b3eb3cSopenharmony_ci }); 134723b3eb3cSopenharmony_ci this.observeComponentCreation((j, k) => { 134823b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(j); 134923b3eb3cSopenharmony_ci Image.create(this.itemComposeTitleDialog.value); 135023b3eb3cSopenharmony_ci Image.width(IMAGE_SIZE); 135123b3eb3cSopenharmony_ci Image.height(IMAGE_SIZE); 135223b3eb3cSopenharmony_ci Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 135323b3eb3cSopenharmony_ci if (!k) { 135423b3eb3cSopenharmony_ci Image.pop(); 135523b3eb3cSopenharmony_ci } 135623b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 135723b3eb3cSopenharmony_ci }); 135823b3eb3cSopenharmony_ci Column.pop(); 135923b3eb3cSopenharmony_ci }); 136023b3eb3cSopenharmony_ci } 136123b3eb3cSopenharmony_ci if (!f) { 136223b3eb3cSopenharmony_ci If.pop(); 136323b3eb3cSopenharmony_ci } 136423b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 136523b3eb3cSopenharmony_ci }); 136623b3eb3cSopenharmony_ci If.pop(); 136723b3eb3cSopenharmony_ci PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop(); 136823b3eb3cSopenharmony_ci } 136923b3eb3cSopenharmony_ci async aboutToAppear() { 137023b3eb3cSopenharmony_ci let a = this.getUIContext().getHostContext(); 137123b3eb3cSopenharmony_ci this.mainWindowStage = a.windowStage.getMainWindowSync(); 137223b3eb3cSopenharmony_ci let b = this.mainWindowStage.getWindowProperties(); 137323b3eb3cSopenharmony_ci let c = b.windowRect; 137423b3eb3cSopenharmony_ci if (px2vp(c.height) > this.screenWidth) { 137523b3eb3cSopenharmony_ci this.maxLines = this.verticalScreenLines; 137623b3eb3cSopenharmony_ci } 137723b3eb3cSopenharmony_ci else { 137823b3eb3cSopenharmony_ci this.maxLines = this.horizontalsScreenLines; 137923b3eb3cSopenharmony_ci } 138023b3eb3cSopenharmony_ci } 138123b3eb3cSopenharmony_ci rerender() { 138223b3eb3cSopenharmony_ci PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this); 138323b3eb3cSopenharmony_ci this.updateDirtyElements(); 138423b3eb3cSopenharmony_ci PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop(); 138523b3eb3cSopenharmony_ci } 138623b3eb3cSopenharmony_ci} 138723b3eb3cSopenharmony_ciexport default { 138823b3eb3cSopenharmony_ci ComposeTitleBar: ComposeTitleBar 138923b3eb3cSopenharmony_ci}; 1390