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_ciconst KeyCode = requireNapi('multimodalInput.keyCode').KeyCode; 2023b3eb3cSopenharmony_ciconst MeasureText = requireNapi('measure'); 2123b3eb3cSopenharmony_ciconst hilog = requireNapi('hilog'); 2223b3eb3cSopenharmony_ciconst PUBLIC_MORE = { 'id': -1, 'type': 20000, params: ['sys.media.ohos_ic_public_more'], 2323b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 2423b3eb3cSopenharmony_ciconst TEXT_EDITABLE_DIALOG = '18.3fp'; 2523b3eb3cSopenharmony_ciconst IMAGE_SIZE = '64vp'; 2623b3eb3cSopenharmony_ciconst MAX_DIALOG = '256vp'; 2723b3eb3cSopenharmony_ciconst MIN_DIALOG = '216vp'; 2823b3eb3cSopenharmony_ciexport class TabTitleBar extends ViewPU { 2923b3eb3cSopenharmony_ci constructor(g9, h9, i9, j9 = -1, k9 = undefined, l9) { 3023b3eb3cSopenharmony_ci super(g9, i9, j9, l9); 3123b3eb3cSopenharmony_ci if (typeof k9 === 'function') { 3223b3eb3cSopenharmony_ci this.paramsGenerator_ = k9; 3323b3eb3cSopenharmony_ci } 3423b3eb3cSopenharmony_ci this.tabItems = []; 3523b3eb3cSopenharmony_ci this.menuItems = []; 3623b3eb3cSopenharmony_ci this.swiperContent = undefined; 3723b3eb3cSopenharmony_ci this.__tabWidth = new ObservedPropertySimplePU(0, this, 'tabWidth'); 3823b3eb3cSopenharmony_ci this.__currentIndex = new ObservedPropertySimplePU(0, this, 'currentIndex'); 3923b3eb3cSopenharmony_ci this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize'); 4023b3eb3cSopenharmony_ci this.menuSectionWidth = 0; 4123b3eb3cSopenharmony_ci this.tabOffsets = []; 4223b3eb3cSopenharmony_ci this.imageWidths = []; 4323b3eb3cSopenharmony_ci this.scroller = new Scroller(); 4423b3eb3cSopenharmony_ci this.swiperController = new SwiperController(); 4523b3eb3cSopenharmony_ci this.settings = new RenderingContextSettings(true); 4623b3eb3cSopenharmony_ci this.leftContext2D = new CanvasRenderingContext2D(this.settings); 4723b3eb3cSopenharmony_ci this.rightContext2D = new CanvasRenderingContext2D(this.settings); 4823b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(h9); 4923b3eb3cSopenharmony_ci this.finalizeConstruction(); 5023b3eb3cSopenharmony_ci } 5123b3eb3cSopenharmony_ci setInitiallyProvidedValue(f9) { 5223b3eb3cSopenharmony_ci if (f9.tabItems !== undefined) { 5323b3eb3cSopenharmony_ci this.tabItems = f9.tabItems; 5423b3eb3cSopenharmony_ci } 5523b3eb3cSopenharmony_ci if (f9.menuItems !== undefined) { 5623b3eb3cSopenharmony_ci this.menuItems = f9.menuItems; 5723b3eb3cSopenharmony_ci } 5823b3eb3cSopenharmony_ci if (f9.swiperContent !== undefined) { 5923b3eb3cSopenharmony_ci this.swiperContent = f9.swiperContent; 6023b3eb3cSopenharmony_ci } 6123b3eb3cSopenharmony_ci if (f9.tabWidth !== undefined) { 6223b3eb3cSopenharmony_ci this.tabWidth = f9.tabWidth; 6323b3eb3cSopenharmony_ci } 6423b3eb3cSopenharmony_ci if (f9.currentIndex !== undefined) { 6523b3eb3cSopenharmony_ci this.currentIndex = f9.currentIndex; 6623b3eb3cSopenharmony_ci } 6723b3eb3cSopenharmony_ci if (f9.fontSize !== undefined) { 6823b3eb3cSopenharmony_ci this.fontSize = f9.fontSize; 6923b3eb3cSopenharmony_ci } 7023b3eb3cSopenharmony_ci if (f9.menuSectionWidth !== undefined) { 7123b3eb3cSopenharmony_ci this.menuSectionWidth = f9.menuSectionWidth; 7223b3eb3cSopenharmony_ci } 7323b3eb3cSopenharmony_ci if (f9.tabOffsets !== undefined) { 7423b3eb3cSopenharmony_ci this.tabOffsets = f9.tabOffsets; 7523b3eb3cSopenharmony_ci } 7623b3eb3cSopenharmony_ci if (f9.imageWidths !== undefined) { 7723b3eb3cSopenharmony_ci this.imageWidths = f9.imageWidths; 7823b3eb3cSopenharmony_ci } 7923b3eb3cSopenharmony_ci if (f9.scroller !== undefined) { 8023b3eb3cSopenharmony_ci this.scroller = f9.scroller; 8123b3eb3cSopenharmony_ci } 8223b3eb3cSopenharmony_ci if (f9.swiperController !== undefined) { 8323b3eb3cSopenharmony_ci this.swiperController = f9.swiperController; 8423b3eb3cSopenharmony_ci } 8523b3eb3cSopenharmony_ci if (f9.settings !== undefined) { 8623b3eb3cSopenharmony_ci this.settings = f9.settings; 8723b3eb3cSopenharmony_ci } 8823b3eb3cSopenharmony_ci if (f9.leftContext2D !== undefined) { 8923b3eb3cSopenharmony_ci this.leftContext2D = f9.leftContext2D; 9023b3eb3cSopenharmony_ci } 9123b3eb3cSopenharmony_ci if (f9.rightContext2D !== undefined) { 9223b3eb3cSopenharmony_ci this.rightContext2D = f9.rightContext2D; 9323b3eb3cSopenharmony_ci } 9423b3eb3cSopenharmony_ci } 9523b3eb3cSopenharmony_ci updateStateVars(e9) { 9623b3eb3cSopenharmony_ci } 9723b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(d9) { 9823b3eb3cSopenharmony_ci this.__tabWidth.purgeDependencyOnElmtId(d9); 9923b3eb3cSopenharmony_ci this.__currentIndex.purgeDependencyOnElmtId(d9); 10023b3eb3cSopenharmony_ci this.__fontSize.purgeDependencyOnElmtId(d9); 10123b3eb3cSopenharmony_ci } 10223b3eb3cSopenharmony_ci aboutToBeDeleted() { 10323b3eb3cSopenharmony_ci this.__tabWidth.aboutToBeDeleted(); 10423b3eb3cSopenharmony_ci this.__currentIndex.aboutToBeDeleted(); 10523b3eb3cSopenharmony_ci this.__fontSize.aboutToBeDeleted(); 10623b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 10723b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 10823b3eb3cSopenharmony_ci } 10923b3eb3cSopenharmony_ci get tabWidth() { 11023b3eb3cSopenharmony_ci return this.__tabWidth.get(); 11123b3eb3cSopenharmony_ci } 11223b3eb3cSopenharmony_ci set tabWidth(c9) { 11323b3eb3cSopenharmony_ci this.__tabWidth.set(c9); 11423b3eb3cSopenharmony_ci } 11523b3eb3cSopenharmony_ci get currentIndex() { 11623b3eb3cSopenharmony_ci return this.__currentIndex.get(); 11723b3eb3cSopenharmony_ci } 11823b3eb3cSopenharmony_ci set currentIndex(b9) { 11923b3eb3cSopenharmony_ci this.__currentIndex.set(b9); 12023b3eb3cSopenharmony_ci } 12123b3eb3cSopenharmony_ci get fontSize() { 12223b3eb3cSopenharmony_ci return this.__fontSize.get(); 12323b3eb3cSopenharmony_ci } 12423b3eb3cSopenharmony_ci set fontSize(a9) { 12523b3eb3cSopenharmony_ci this.__fontSize.set(a9); 12623b3eb3cSopenharmony_ci } 12723b3eb3cSopenharmony_ci GradientMask(p8, q8, r8, s8, t8, u8 = null) { 12823b3eb3cSopenharmony_ci this.observeComponentCreation2((y8, z8) => { 12923b3eb3cSopenharmony_ci Column.create(); 13023b3eb3cSopenharmony_ci Column.blendMode(BlendMode.DST_OUT); 13123b3eb3cSopenharmony_ci Column.width(TabTitleBar.gradientMaskWidth); 13223b3eb3cSopenharmony_ci Column.height(TabTitleBar.totalHeight); 13323b3eb3cSopenharmony_ci }, Column); 13423b3eb3cSopenharmony_ci this.observeComponentCreation2((v8, w8) => { 13523b3eb3cSopenharmony_ci Canvas.create(p8); 13623b3eb3cSopenharmony_ci Canvas.width(TabTitleBar.gradientMaskWidth); 13723b3eb3cSopenharmony_ci Canvas.height(TabTitleBar.totalHeight); 13823b3eb3cSopenharmony_ci Canvas.onReady(() => { 13923b3eb3cSopenharmony_ci let x8 = p8.createLinearGradient(q8, r8, s8, t8); 14023b3eb3cSopenharmony_ci x8.addColorStop(0.0, '#ffffffff'); 14123b3eb3cSopenharmony_ci x8.addColorStop(1, '#00ffffff'); 14223b3eb3cSopenharmony_ci p8.fillStyle = x8; 14323b3eb3cSopenharmony_ci p8.fillRect(0, 0, TabTitleBar.gradientMaskWidth, TabTitleBar.totalHeight); 14423b3eb3cSopenharmony_ci }); 14523b3eb3cSopenharmony_ci }, Canvas); 14623b3eb3cSopenharmony_ci Canvas.pop(); 14723b3eb3cSopenharmony_ci Column.pop(); 14823b3eb3cSopenharmony_ci } 14923b3eb3cSopenharmony_ci emptyBuilder(o8 = null) { 15023b3eb3cSopenharmony_ci } 15123b3eb3cSopenharmony_ci aboutToAppear() { 15223b3eb3cSopenharmony_ci if (!this.swiperContent) { 15323b3eb3cSopenharmony_ci this.swiperContent = this.emptyBuilder; 15423b3eb3cSopenharmony_ci } 15523b3eb3cSopenharmony_ci this.tabItems.forEach((n8) => { 15623b3eb3cSopenharmony_ci this.imageWidths.push(0); 15723b3eb3cSopenharmony_ci }); 15823b3eb3cSopenharmony_ci this.loadOffsets(); 15923b3eb3cSopenharmony_ci } 16023b3eb3cSopenharmony_ci loadOffsets() { 16123b3eb3cSopenharmony_ci this.tabOffsets.length = 0; 16223b3eb3cSopenharmony_ci let k8 = 0; 16323b3eb3cSopenharmony_ci this.tabOffsets.push(k8); 16423b3eb3cSopenharmony_ci k8 += TabContentItem.marginFirst; 16523b3eb3cSopenharmony_ci this.tabItems.forEach((l8, m8) => { 16623b3eb3cSopenharmony_ci if (l8.icon !== undefined) { 16723b3eb3cSopenharmony_ci if (Math.abs(this.imageWidths[m8]) > TabContentItem.imageHotZoneWidth) { 16823b3eb3cSopenharmony_ci k8 += this.imageWidths[m8]; 16923b3eb3cSopenharmony_ci } else { 17023b3eb3cSopenharmony_ci k8 += TabContentItem.imageHotZoneWidth; 17123b3eb3cSopenharmony_ci } 17223b3eb3cSopenharmony_ci } else { 17323b3eb3cSopenharmony_ci k8 += TabContentItem.paddingLeft; 17423b3eb3cSopenharmony_ci k8 += px2vp(MeasureText.measureText({ 17523b3eb3cSopenharmony_ci textContent: l8.title.toString(), 17623b3eb3cSopenharmony_ci fontSize: 18, 17723b3eb3cSopenharmony_ci fontWeight: FontWeight.Medium, 17823b3eb3cSopenharmony_ci })); 17923b3eb3cSopenharmony_ci k8 += TabContentItem.paddingRight; 18023b3eb3cSopenharmony_ci } 18123b3eb3cSopenharmony_ci this.tabOffsets.push(k8); 18223b3eb3cSopenharmony_ci }); 18323b3eb3cSopenharmony_ci } 18423b3eb3cSopenharmony_ci initialRender() { 18523b3eb3cSopenharmony_ci this.observeComponentCreation2((i8, j8) => { 18623b3eb3cSopenharmony_ci Column.create(); 18723b3eb3cSopenharmony_ci }, Column); 18823b3eb3cSopenharmony_ci this.observeComponentCreation2((e8, f8) => { 18923b3eb3cSopenharmony_ci Flex.create({ 19023b3eb3cSopenharmony_ci justifyContent: FlexAlign.SpaceBetween, 19123b3eb3cSopenharmony_ci alignItems: ItemAlign.Stretch 19223b3eb3cSopenharmony_ci }); 19323b3eb3cSopenharmony_ci Flex.backgroundColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_background'], 19423b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 19523b3eb3cSopenharmony_ci Flex.margin({ right: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_max_padding_end'], 19623b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } }); 19723b3eb3cSopenharmony_ci Flex.onAreaChange((g8, h8) => { 19823b3eb3cSopenharmony_ci this.tabWidth = Number(h8.width) - this.menuSectionWidth; 19923b3eb3cSopenharmony_ci }); 20023b3eb3cSopenharmony_ci }, Flex); 20123b3eb3cSopenharmony_ci this.observeComponentCreation2((c8, d8) => { 20223b3eb3cSopenharmony_ci Stack.create({ alignContent: Alignment.End }); 20323b3eb3cSopenharmony_ci Stack.blendMode(BlendMode.SRC_OVER, BlendApplyType.OFFSCREEN); 20423b3eb3cSopenharmony_ci }, Stack); 20523b3eb3cSopenharmony_ci this.observeComponentCreation2((a8, b8) => { 20623b3eb3cSopenharmony_ci Stack.create({ alignContent: Alignment.Start }); 20723b3eb3cSopenharmony_ci }, Stack); 20823b3eb3cSopenharmony_ci this.observeComponentCreation2((y7, z7) => { 20923b3eb3cSopenharmony_ci Column.create(); 21023b3eb3cSopenharmony_ci }, Column); 21123b3eb3cSopenharmony_ci this.observeComponentCreation2((w7, x7) => { 21223b3eb3cSopenharmony_ci List.create({ initialIndex: 0, scroller: this.scroller, space: 0 }); 21323b3eb3cSopenharmony_ci List.width('100%'); 21423b3eb3cSopenharmony_ci List.height(TabTitleBar.totalHeight); 21523b3eb3cSopenharmony_ci List.constraintSize({ maxWidth: this.tabWidth }); 21623b3eb3cSopenharmony_ci List.edgeEffect(EdgeEffect.Spring); 21723b3eb3cSopenharmony_ci List.listDirection(Axis.Horizontal); 21823b3eb3cSopenharmony_ci List.scrollBar(BarState.Off); 21923b3eb3cSopenharmony_ci }, List); 22023b3eb3cSopenharmony_ci this.observeComponentCreation2((z6, a7) => { 22123b3eb3cSopenharmony_ci ForEach.create(); 22223b3eb3cSopenharmony_ci const b7 = (c7, d7) => { 22323b3eb3cSopenharmony_ci const e7 = c7; 22423b3eb3cSopenharmony_ci { 22523b3eb3cSopenharmony_ci const f7 = (u7, v7) => { 22623b3eb3cSopenharmony_ci ViewStackProcessor.StartGetAccessRecordingFor(u7); 22723b3eb3cSopenharmony_ci g7(u7, v7); 22823b3eb3cSopenharmony_ci if (!v7) { 22923b3eb3cSopenharmony_ci ListItem.pop(); 23023b3eb3cSopenharmony_ci } 23123b3eb3cSopenharmony_ci ViewStackProcessor.StopGetAccessRecording(); 23223b3eb3cSopenharmony_ci }; 23323b3eb3cSopenharmony_ci const g7 = (s7, t7) => { 23423b3eb3cSopenharmony_ci ListItem.create(h7, true); 23523b3eb3cSopenharmony_ci }; 23623b3eb3cSopenharmony_ci const h7 = (i7, j7) => { 23723b3eb3cSopenharmony_ci f7(i7, j7); 23823b3eb3cSopenharmony_ci { 23923b3eb3cSopenharmony_ci this.observeComponentCreation2((k7, l7) => { 24023b3eb3cSopenharmony_ci if (l7) { 24123b3eb3cSopenharmony_ci let m7 = new TabContentItem(this, { 24223b3eb3cSopenharmony_ci item: e7, 24323b3eb3cSopenharmony_ci index: d7, 24423b3eb3cSopenharmony_ci maxIndex: this.tabItems.length - 1, 24523b3eb3cSopenharmony_ci currentIndex: this.currentIndex, 24623b3eb3cSopenharmony_ci onCustomClick: (r7) => this.currentIndex = r7, 24723b3eb3cSopenharmony_ci onImageComplete: (q7) => { 24823b3eb3cSopenharmony_ci this.imageWidths[d7] = q7; 24923b3eb3cSopenharmony_ci this.loadOffsets(); 25023b3eb3cSopenharmony_ci } 25123b3eb3cSopenharmony_ci }, undefined, k7, () => { }, { page: 'library/src/main/ets/components/MainPage.ets', 25223b3eb3cSopenharmony_ci line: 138, col: 21 }); 25323b3eb3cSopenharmony_ci ViewPU.create(m7); 25423b3eb3cSopenharmony_ci let n7 = () => { 25523b3eb3cSopenharmony_ci return { 25623b3eb3cSopenharmony_ci item: e7, 25723b3eb3cSopenharmony_ci index: d7, 25823b3eb3cSopenharmony_ci maxIndex: this.tabItems.length - 1, 25923b3eb3cSopenharmony_ci currentIndex: this.currentIndex, 26023b3eb3cSopenharmony_ci onCustomClick: (p7) => this.currentIndex = p7, 26123b3eb3cSopenharmony_ci onImageComplete: (o7) => { 26223b3eb3cSopenharmony_ci this.imageWidths[d7] = o7; 26323b3eb3cSopenharmony_ci this.loadOffsets(); 26423b3eb3cSopenharmony_ci } 26523b3eb3cSopenharmony_ci }; 26623b3eb3cSopenharmony_ci }; 26723b3eb3cSopenharmony_ci m7.paramsGenerator_ = n7; 26823b3eb3cSopenharmony_ci } 26923b3eb3cSopenharmony_ci else { 27023b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(k7, { 27123b3eb3cSopenharmony_ci currentIndex: this.currentIndex 27223b3eb3cSopenharmony_ci }); 27323b3eb3cSopenharmony_ci } 27423b3eb3cSopenharmony_ci }, { name: 'TabContentItem' }); 27523b3eb3cSopenharmony_ci } 27623b3eb3cSopenharmony_ci ListItem.pop(); 27723b3eb3cSopenharmony_ci }; 27823b3eb3cSopenharmony_ci this.observeComponentCreation2(g7, ListItem); 27923b3eb3cSopenharmony_ci ListItem.pop(); 28023b3eb3cSopenharmony_ci } 28123b3eb3cSopenharmony_ci }; 28223b3eb3cSopenharmony_ci this.forEachUpdateFunction(z6, this.tabItems, b7, undefined, true, false); 28323b3eb3cSopenharmony_ci }, ForEach); 28423b3eb3cSopenharmony_ci ForEach.pop(); 28523b3eb3cSopenharmony_ci List.pop(); 28623b3eb3cSopenharmony_ci Column.pop(); 28723b3eb3cSopenharmony_ci this.GradientMask.bind(this)(this.leftContext2D, 0, TabTitleBar.totalHeight / 2, TabTitleBar.gradientMaskWidth, 28823b3eb3cSopenharmony_ci TabTitleBar.totalHeight / 2); 28923b3eb3cSopenharmony_ci Stack.pop(); 29023b3eb3cSopenharmony_ci this.GradientMask.bind(this)(this.rightContext2D, TabTitleBar.gradientMaskWidth, TabTitleBar.totalHeight / 2, 0, 29123b3eb3cSopenharmony_ci TabTitleBar.totalHeight / 2); 29223b3eb3cSopenharmony_ci Stack.pop(); 29323b3eb3cSopenharmony_ci this.observeComponentCreation2((p6, q6) => { 29423b3eb3cSopenharmony_ci If.create(); 29523b3eb3cSopenharmony_ci if (this.menuItems !== undefined && this.menuItems.length > 0) { 29623b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 29723b3eb3cSopenharmony_ci this.observeComponentCreation2((v6, w6) => { 29823b3eb3cSopenharmony_ci __Common__.create(); 29923b3eb3cSopenharmony_ci __Common__.height(TabTitleBar.totalHeight); 30023b3eb3cSopenharmony_ci __Common__.onAreaChange((x6, y6) => { 30123b3eb3cSopenharmony_ci this.menuSectionWidth = Number(y6.width); 30223b3eb3cSopenharmony_ci }); 30323b3eb3cSopenharmony_ci }, __Common__); 30423b3eb3cSopenharmony_ci { 30523b3eb3cSopenharmony_ci this.observeComponentCreation2((r6, s6) => { 30623b3eb3cSopenharmony_ci if (s6) { 30723b3eb3cSopenharmony_ci let t6 = new CollapsibleMenuSection(this, { menuItems: this.menuItems, 30823b3eb3cSopenharmony_ci index: 1 + TabTitleBar.instanceCount++ }, undefined, r6, () => { }, 30923b3eb3cSopenharmony_ci { page: 'library/src/main/ets/components/MainPage.ets', line: 168, col: 11 }); 31023b3eb3cSopenharmony_ci ViewPU.create(t6); 31123b3eb3cSopenharmony_ci let u6 = () => { 31223b3eb3cSopenharmony_ci return { 31323b3eb3cSopenharmony_ci menuItems: this.menuItems, 31423b3eb3cSopenharmony_ci index: 1 + TabTitleBar.instanceCount++ 31523b3eb3cSopenharmony_ci }; 31623b3eb3cSopenharmony_ci }; 31723b3eb3cSopenharmony_ci t6.paramsGenerator_ = u6; 31823b3eb3cSopenharmony_ci } else { 31923b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(r6, {}); 32023b3eb3cSopenharmony_ci } 32123b3eb3cSopenharmony_ci }, { name: 'CollapsibleMenuSection' }); 32223b3eb3cSopenharmony_ci } 32323b3eb3cSopenharmony_ci __Common__.pop(); 32423b3eb3cSopenharmony_ci }); 32523b3eb3cSopenharmony_ci } else { 32623b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 32723b3eb3cSopenharmony_ci }); 32823b3eb3cSopenharmony_ci } 32923b3eb3cSopenharmony_ci }, If); 33023b3eb3cSopenharmony_ci If.pop(); 33123b3eb3cSopenharmony_ci Flex.pop(); 33223b3eb3cSopenharmony_ci this.observeComponentCreation2((n6, o6) => { 33323b3eb3cSopenharmony_ci Column.create(); 33423b3eb3cSopenharmony_ci }, Column); 33523b3eb3cSopenharmony_ci this.observeComponentCreation2((j6, k6) => { 33623b3eb3cSopenharmony_ci Swiper.create(this.swiperController); 33723b3eb3cSopenharmony_ci Swiper.index(this.currentIndex); 33823b3eb3cSopenharmony_ci Swiper.itemSpace(0); 33923b3eb3cSopenharmony_ci Swiper.indicator(false); 34023b3eb3cSopenharmony_ci Swiper.width('100%'); 34123b3eb3cSopenharmony_ci Swiper.height('100%'); 34223b3eb3cSopenharmony_ci Swiper.curve(Curve.Friction); 34323b3eb3cSopenharmony_ci Swiper.onChange((l6) => { 34423b3eb3cSopenharmony_ci const m6 = this.tabOffsets[l6] + TabTitleBar.correctionOffset; 34523b3eb3cSopenharmony_ci this.currentIndex = l6; 34623b3eb3cSopenharmony_ci this.scroller.scrollTo({ 34723b3eb3cSopenharmony_ci xOffset: m6 > 0 ? m6 : 0, 34823b3eb3cSopenharmony_ci yOffset: 0, 34923b3eb3cSopenharmony_ci animation: { 35023b3eb3cSopenharmony_ci duration: 300, 35123b3eb3cSopenharmony_ci curve: Curve.EaseInOut 35223b3eb3cSopenharmony_ci } 35323b3eb3cSopenharmony_ci }); 35423b3eb3cSopenharmony_ci }); 35523b3eb3cSopenharmony_ci Swiper.onAppear(() => { 35623b3eb3cSopenharmony_ci this.scroller.scrollToIndex(this.currentIndex); 35723b3eb3cSopenharmony_ci this.scroller.scrollBy(TabTitleBar.correctionOffset, 0); 35823b3eb3cSopenharmony_ci }); 35923b3eb3cSopenharmony_ci }, Swiper); 36023b3eb3cSopenharmony_ci this.swiperContent.bind(this)(); 36123b3eb3cSopenharmony_ci Swiper.pop(); 36223b3eb3cSopenharmony_ci Column.pop(); 36323b3eb3cSopenharmony_ci Column.pop(); 36423b3eb3cSopenharmony_ci } 36523b3eb3cSopenharmony_ci rerender() { 36623b3eb3cSopenharmony_ci this.updateDirtyElements(); 36723b3eb3cSopenharmony_ci } 36823b3eb3cSopenharmony_ci} 36923b3eb3cSopenharmony_ciTabTitleBar.totalHeight = 56; 37023b3eb3cSopenharmony_ciTabTitleBar.correctionOffset = -40.0; 37123b3eb3cSopenharmony_ciTabTitleBar.gradientMaskWidth = 24; 37223b3eb3cSopenharmony_ciTabTitleBar.instanceCount = 0; 37323b3eb3cSopenharmony_ciclass CollapsibleMenuSection extends ViewPU { 37423b3eb3cSopenharmony_ci constructor(b6, c6, d6, e6 = -1, f6 = undefined, g6) { 37523b3eb3cSopenharmony_ci super(b6, d6, e6, g6); 37623b3eb3cSopenharmony_ci if (typeof f6 === 'function') { 37723b3eb3cSopenharmony_ci this.paramsGenerator_ = f6; 37823b3eb3cSopenharmony_ci } 37923b3eb3cSopenharmony_ci this.menuItems = []; 38023b3eb3cSopenharmony_ci this.index = 0; 38123b3eb3cSopenharmony_ci this.item = { 38223b3eb3cSopenharmony_ci value: PUBLIC_MORE, 38323b3eb3cSopenharmony_ci label: { 'id': -1, 'type': 10003, params: ['sys.string.ohos_toolbar_more'], 38423b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 38523b3eb3cSopenharmony_ci }; 38623b3eb3cSopenharmony_ci this.longPressTime = 500; 38723b3eb3cSopenharmony_ci this.minFontSize = 1.75; 38823b3eb3cSopenharmony_ci this.isFollowingSystemFontScale = false; 38923b3eb3cSopenharmony_ci this.maxFontScale = 1; 39023b3eb3cSopenharmony_ci this.systemFontScale = 1; 39123b3eb3cSopenharmony_ci this.firstFocusableIndex = -1; 39223b3eb3cSopenharmony_ci this.__isPopupShown = new ObservedPropertySimplePU(false, this, 'isPopupShown'); 39323b3eb3cSopenharmony_ci this.__isMoreIconOnFocus = new ObservedPropertySimplePU(false, this, 'isMoreIconOnFocus'); 39423b3eb3cSopenharmony_ci this.__isMoreIconOnHover = new ObservedPropertySimplePU(false, this, 'isMoreIconOnHover'); 39523b3eb3cSopenharmony_ci this.__isMoreIconOnClick = new ObservedPropertySimplePU(false, this, 'isMoreIconOnClick'); 39623b3eb3cSopenharmony_ci this.__fontSize = new SynchedPropertySimpleOneWayPU(c6.fontSize, this, 'fontSize'); 39723b3eb3cSopenharmony_ci this.dialogController = new CustomDialogController({ 39823b3eb3cSopenharmony_ci builder: () => { 39923b3eb3cSopenharmony_ci let h6 = new TabTitleBarDialog(this, { 40023b3eb3cSopenharmony_ci cancel: () => { 40123b3eb3cSopenharmony_ci }, 40223b3eb3cSopenharmony_ci confirm: () => { 40323b3eb3cSopenharmony_ci }, 40423b3eb3cSopenharmony_ci tabTitleDialog: this.item, 40523b3eb3cSopenharmony_ci tabTitleBarDialog: this.item.label ? this.item.label : '', 40623b3eb3cSopenharmony_ci fontSize: this.fontSize, 40723b3eb3cSopenharmony_ci }, undefined, -1, () => { }, { page: 'library/src/main/ets/components/MainPage.ets', line: 237, col: 14 }); 40823b3eb3cSopenharmony_ci h6.setController(this.dialogController); 40923b3eb3cSopenharmony_ci ViewPU.create(h6); 41023b3eb3cSopenharmony_ci let i6 = () => { 41123b3eb3cSopenharmony_ci return { 41223b3eb3cSopenharmony_ci cancel: () => { 41323b3eb3cSopenharmony_ci }, 41423b3eb3cSopenharmony_ci confirm: () => { 41523b3eb3cSopenharmony_ci }, 41623b3eb3cSopenharmony_ci tabTitleDialog: this.item, 41723b3eb3cSopenharmony_ci tabTitleBarDialog: this.item.label ? this.item.label : '', 41823b3eb3cSopenharmony_ci fontSize: this.fontSize 41923b3eb3cSopenharmony_ci }; 42023b3eb3cSopenharmony_ci }; 42123b3eb3cSopenharmony_ci h6.paramsGenerator_ = i6; 42223b3eb3cSopenharmony_ci }, 42323b3eb3cSopenharmony_ci maskColor: Color.Transparent, 42423b3eb3cSopenharmony_ci isModal: true, 42523b3eb3cSopenharmony_ci customStyle: true 42623b3eb3cSopenharmony_ci }, this); 42723b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(c6); 42823b3eb3cSopenharmony_ci this.finalizeConstruction(); 42923b3eb3cSopenharmony_ci } 43023b3eb3cSopenharmony_ci setInitiallyProvidedValue(a6) { 43123b3eb3cSopenharmony_ci if (a6.menuItems !== undefined) { 43223b3eb3cSopenharmony_ci this.menuItems = a6.menuItems; 43323b3eb3cSopenharmony_ci } 43423b3eb3cSopenharmony_ci if (a6.index !== undefined) { 43523b3eb3cSopenharmony_ci this.index = a6.index; 43623b3eb3cSopenharmony_ci } 43723b3eb3cSopenharmony_ci if (a6.item !== undefined) { 43823b3eb3cSopenharmony_ci this.item = a6.item; 43923b3eb3cSopenharmony_ci } 44023b3eb3cSopenharmony_ci if (a6.longPressTime !== undefined) { 44123b3eb3cSopenharmony_ci this.longPressTime = a6.longPressTime; 44223b3eb3cSopenharmony_ci } 44323b3eb3cSopenharmony_ci if (a6.minFontSize !== undefined) { 44423b3eb3cSopenharmony_ci this.minFontSize = a6.minFontSize; 44523b3eb3cSopenharmony_ci } 44623b3eb3cSopenharmony_ci if (a6.isFollowingSystemFontScale !== undefined) { 44723b3eb3cSopenharmony_ci this.isFollowingSystemFontScale = a6.isFollowingSystemFontScale; 44823b3eb3cSopenharmony_ci } 44923b3eb3cSopenharmony_ci if (a6.maxFontScale !== undefined) { 45023b3eb3cSopenharmony_ci this.maxFontScale = a6.maxFontScale; 45123b3eb3cSopenharmony_ci } 45223b3eb3cSopenharmony_ci if (a6.systemFontScale !== undefined) { 45323b3eb3cSopenharmony_ci this.systemFontScale = a6.systemFontScale; 45423b3eb3cSopenharmony_ci } 45523b3eb3cSopenharmony_ci if (a6.firstFocusableIndex !== undefined) { 45623b3eb3cSopenharmony_ci this.firstFocusableIndex = a6.firstFocusableIndex; 45723b3eb3cSopenharmony_ci } 45823b3eb3cSopenharmony_ci if (a6.isPopupShown !== undefined) { 45923b3eb3cSopenharmony_ci this.isPopupShown = a6.isPopupShown; 46023b3eb3cSopenharmony_ci } 46123b3eb3cSopenharmony_ci if (a6.isMoreIconOnFocus !== undefined) { 46223b3eb3cSopenharmony_ci this.isMoreIconOnFocus = a6.isMoreIconOnFocus; 46323b3eb3cSopenharmony_ci } 46423b3eb3cSopenharmony_ci if (a6.isMoreIconOnHover !== undefined) { 46523b3eb3cSopenharmony_ci this.isMoreIconOnHover = a6.isMoreIconOnHover; 46623b3eb3cSopenharmony_ci } 46723b3eb3cSopenharmony_ci if (a6.isMoreIconOnClick !== undefined) { 46823b3eb3cSopenharmony_ci this.isMoreIconOnClick = a6.isMoreIconOnClick; 46923b3eb3cSopenharmony_ci } 47023b3eb3cSopenharmony_ci if (a6.fontSize === undefined) { 47123b3eb3cSopenharmony_ci this.__fontSize.set(1); 47223b3eb3cSopenharmony_ci } 47323b3eb3cSopenharmony_ci if (a6.dialogController !== undefined) { 47423b3eb3cSopenharmony_ci this.dialogController = a6.dialogController; 47523b3eb3cSopenharmony_ci } 47623b3eb3cSopenharmony_ci } 47723b3eb3cSopenharmony_ci updateStateVars(z5) { 47823b3eb3cSopenharmony_ci this.__fontSize.reset(z5.fontSize); 47923b3eb3cSopenharmony_ci } 48023b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(y5) { 48123b3eb3cSopenharmony_ci this.__isPopupShown.purgeDependencyOnElmtId(y5); 48223b3eb3cSopenharmony_ci this.__isMoreIconOnFocus.purgeDependencyOnElmtId(y5); 48323b3eb3cSopenharmony_ci this.__isMoreIconOnHover.purgeDependencyOnElmtId(y5); 48423b3eb3cSopenharmony_ci this.__isMoreIconOnClick.purgeDependencyOnElmtId(y5); 48523b3eb3cSopenharmony_ci this.__fontSize.purgeDependencyOnElmtId(y5); 48623b3eb3cSopenharmony_ci } 48723b3eb3cSopenharmony_ci aboutToBeDeleted() { 48823b3eb3cSopenharmony_ci this.__isPopupShown.aboutToBeDeleted(); 48923b3eb3cSopenharmony_ci this.__isMoreIconOnFocus.aboutToBeDeleted(); 49023b3eb3cSopenharmony_ci this.__isMoreIconOnHover.aboutToBeDeleted(); 49123b3eb3cSopenharmony_ci this.__isMoreIconOnClick.aboutToBeDeleted(); 49223b3eb3cSopenharmony_ci this.__fontSize.aboutToBeDeleted(); 49323b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 49423b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 49523b3eb3cSopenharmony_ci } 49623b3eb3cSopenharmony_ci get isPopupShown() { 49723b3eb3cSopenharmony_ci return this.__isPopupShown.get(); 49823b3eb3cSopenharmony_ci } 49923b3eb3cSopenharmony_ci set isPopupShown(x5) { 50023b3eb3cSopenharmony_ci this.__isPopupShown.set(x5); 50123b3eb3cSopenharmony_ci } 50223b3eb3cSopenharmony_ci get isMoreIconOnFocus() { 50323b3eb3cSopenharmony_ci return this.__isMoreIconOnFocus.get(); 50423b3eb3cSopenharmony_ci } 50523b3eb3cSopenharmony_ci set isMoreIconOnFocus(w5) { 50623b3eb3cSopenharmony_ci this.__isMoreIconOnFocus.set(w5); 50723b3eb3cSopenharmony_ci } 50823b3eb3cSopenharmony_ci get isMoreIconOnHover() { 50923b3eb3cSopenharmony_ci return this.__isMoreIconOnHover.get(); 51023b3eb3cSopenharmony_ci } 51123b3eb3cSopenharmony_ci set isMoreIconOnHover(v5) { 51223b3eb3cSopenharmony_ci this.__isMoreIconOnHover.set(v5); 51323b3eb3cSopenharmony_ci } 51423b3eb3cSopenharmony_ci get isMoreIconOnClick() { 51523b3eb3cSopenharmony_ci return this.__isMoreIconOnClick.get(); 51623b3eb3cSopenharmony_ci } 51723b3eb3cSopenharmony_ci set isMoreIconOnClick(u5) { 51823b3eb3cSopenharmony_ci this.__isMoreIconOnClick.set(u5); 51923b3eb3cSopenharmony_ci } 52023b3eb3cSopenharmony_ci get fontSize() { 52123b3eb3cSopenharmony_ci return this.__fontSize.get(); 52223b3eb3cSopenharmony_ci } 52323b3eb3cSopenharmony_ci set fontSize(t5) { 52423b3eb3cSopenharmony_ci this.__fontSize.set(t5); 52523b3eb3cSopenharmony_ci } 52623b3eb3cSopenharmony_ci getMoreIconFgColor() { 52723b3eb3cSopenharmony_ci return this.isMoreIconOnClick 52823b3eb3cSopenharmony_ci ? { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon_pressed'], 52923b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : 53023b3eb3cSopenharmony_ci { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon'], 53123b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 53223b3eb3cSopenharmony_ci } 53323b3eb3cSopenharmony_ci getMoreIconBgColor() { 53423b3eb3cSopenharmony_ci if (this.isMoreIconOnClick) { 53523b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_click_effect'], 53623b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 53723b3eb3cSopenharmony_ci } 53823b3eb3cSopenharmony_ci else if (this.isMoreIconOnHover) { 53923b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_hover'], 54023b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 54123b3eb3cSopenharmony_ci } 54223b3eb3cSopenharmony_ci else { 54323b3eb3cSopenharmony_ci return Color.Transparent; 54423b3eb3cSopenharmony_ci } 54523b3eb3cSopenharmony_ci } 54623b3eb3cSopenharmony_ci aboutToAppear() { 54723b3eb3cSopenharmony_ci try { 54823b3eb3cSopenharmony_ci let s5 = this.getUIContext(); 54923b3eb3cSopenharmony_ci this.isFollowingSystemFontScale = s5.isFollowingSystemFontScale(); 55023b3eb3cSopenharmony_ci this.maxFontScale = s5.getMaxFontScale(); 55123b3eb3cSopenharmony_ci } 55223b3eb3cSopenharmony_ci catch (p5) { 55323b3eb3cSopenharmony_ci let q5 = p5.code; 55423b3eb3cSopenharmony_ci let r5 = p5.message; 55523b3eb3cSopenharmony_ci hilog.error(0x3900, 'Ace', `Faild to decideFontScale,cause, code: ${q5}, message: ${r5}`); 55623b3eb3cSopenharmony_ci } 55723b3eb3cSopenharmony_ci this.menuItems.forEach((n5, o5) => { 55823b3eb3cSopenharmony_ci if (n5.isEnabled && this.firstFocusableIndex === -1 && 55923b3eb3cSopenharmony_ci o5 > CollapsibleMenuSection.maxCountOfVisibleItems - 2) { 56023b3eb3cSopenharmony_ci this.firstFocusableIndex = this.index * 1000 + o5 + 1; 56123b3eb3cSopenharmony_ci } 56223b3eb3cSopenharmony_ci }); 56323b3eb3cSopenharmony_ci } 56423b3eb3cSopenharmony_ci decideFontScale() { 56523b3eb3cSopenharmony_ci let m5 = this.getUIContext(); 56623b3eb3cSopenharmony_ci this.systemFontScale = m5.getHostContext()?.config?.fontSizeScale ?? 1; 56723b3eb3cSopenharmony_ci if (!this.isFollowingSystemFontScale) { 56823b3eb3cSopenharmony_ci return 1; 56923b3eb3cSopenharmony_ci } 57023b3eb3cSopenharmony_ci return Math.min(this.systemFontScale, this.maxFontScale); 57123b3eb3cSopenharmony_ci } 57223b3eb3cSopenharmony_ci initialRender() { 57323b3eb3cSopenharmony_ci this.observeComponentCreation2((k5, l5) => { 57423b3eb3cSopenharmony_ci Column.create(); 57523b3eb3cSopenharmony_ci Column.height('100%'); 57623b3eb3cSopenharmony_ci Column.justifyContent(FlexAlign.Center); 57723b3eb3cSopenharmony_ci }, Column); 57823b3eb3cSopenharmony_ci this.observeComponentCreation2((i5, j5) => { 57923b3eb3cSopenharmony_ci Row.create(); 58023b3eb3cSopenharmony_ci }, Row); 58123b3eb3cSopenharmony_ci this.observeComponentCreation2((d4, e4) => { 58223b3eb3cSopenharmony_ci If.create(); 58323b3eb3cSopenharmony_ci if (this.menuItems.length <= CollapsibleMenuSection.maxCountOfVisibleItems) { 58423b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 58523b3eb3cSopenharmony_ci this.observeComponentCreation2((y4, z4) => { 58623b3eb3cSopenharmony_ci ForEach.create(); 58723b3eb3cSopenharmony_ci const a5 = (b5, c5) => { 58823b3eb3cSopenharmony_ci const d5 = b5; 58923b3eb3cSopenharmony_ci { 59023b3eb3cSopenharmony_ci this.observeComponentCreation2((e5, f5) => { 59123b3eb3cSopenharmony_ci if (f5) { 59223b3eb3cSopenharmony_ci let g5 = new ImageMenuItem(this, { item: d5, index: this.index * 1000 + c5 + 1 }, 59323b3eb3cSopenharmony_ci undefined, e5, () => { }, { page: 'library/src/main/ets/components/MainPage.ets', 59423b3eb3cSopenharmony_ci line: 299, col: 13 }); 59523b3eb3cSopenharmony_ci ViewPU.create(g5); 59623b3eb3cSopenharmony_ci let h5 = () => { 59723b3eb3cSopenharmony_ci return { 59823b3eb3cSopenharmony_ci item: d5, 59923b3eb3cSopenharmony_ci index: this.index * 1000 + c5 + 1 60023b3eb3cSopenharmony_ci }; 60123b3eb3cSopenharmony_ci }; 60223b3eb3cSopenharmony_ci g5.paramsGenerator_ = h5; 60323b3eb3cSopenharmony_ci } else { 60423b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(e5, {}); 60523b3eb3cSopenharmony_ci } 60623b3eb3cSopenharmony_ci }, { name: 'ImageMenuItem' }); 60723b3eb3cSopenharmony_ci } 60823b3eb3cSopenharmony_ci }; 60923b3eb3cSopenharmony_ci this.forEachUpdateFunction(y4, this.menuItems, a5, undefined, true, false); 61023b3eb3cSopenharmony_ci }, ForEach); 61123b3eb3cSopenharmony_ci ForEach.pop(); 61223b3eb3cSopenharmony_ci }); 61323b3eb3cSopenharmony_ci } else { 61423b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 61523b3eb3cSopenharmony_ci this.observeComponentCreation2((o4, p4) => { 61623b3eb3cSopenharmony_ci ForEach.create(); 61723b3eb3cSopenharmony_ci const q4 = (r4, s4) => { 61823b3eb3cSopenharmony_ci const t4 = r4; 61923b3eb3cSopenharmony_ci { 62023b3eb3cSopenharmony_ci this.observeComponentCreation2((u4, v4) => { 62123b3eb3cSopenharmony_ci if (v4) { 62223b3eb3cSopenharmony_ci let w4 = new ImageMenuItem(this, { item: t4, index: this.index * 1000 + s4 + 1 }, undefined, u4, 62323b3eb3cSopenharmony_ci () => { }, { page: 'library/src/main/ets/components/MainPage.ets', line: 304, col: 15 }); 62423b3eb3cSopenharmony_ci ViewPU.create(w4); 62523b3eb3cSopenharmony_ci let x4 = () => { 62623b3eb3cSopenharmony_ci return { 62723b3eb3cSopenharmony_ci item: t4, 62823b3eb3cSopenharmony_ci index: this.index * 1000 + s4 + 1 62923b3eb3cSopenharmony_ci }; 63023b3eb3cSopenharmony_ci }; 63123b3eb3cSopenharmony_ci w4.paramsGenerator_ = x4; 63223b3eb3cSopenharmony_ci } else { 63323b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(u4, {}); 63423b3eb3cSopenharmony_ci } 63523b3eb3cSopenharmony_ci }, { name: 'ImageMenuItem' }); 63623b3eb3cSopenharmony_ci } 63723b3eb3cSopenharmony_ci }; 63823b3eb3cSopenharmony_ci this.forEachUpdateFunction(o4, this.menuItems.slice(0, CollapsibleMenuSection.maxCountOfVisibleItems - 1), 63923b3eb3cSopenharmony_ci q4, undefined, true, false); 64023b3eb3cSopenharmony_ci }, ForEach); 64123b3eb3cSopenharmony_ci ForEach.pop(); 64223b3eb3cSopenharmony_ci this.observeComponentCreation2((h4, i4) => { 64323b3eb3cSopenharmony_ci Row.create(); 64423b3eb3cSopenharmony_ci Row.width(ImageMenuItem.imageHotZoneWidth); 64523b3eb3cSopenharmony_ci Row.height(ImageMenuItem.imageHotZoneWidth); 64623b3eb3cSopenharmony_ci Row.borderRadius(ImageMenuItem.buttonBorderRadius); 64723b3eb3cSopenharmony_ci Row.foregroundColor(this.getMoreIconFgColor()); 64823b3eb3cSopenharmony_ci Row.backgroundColor(this.getMoreIconBgColor()); 64923b3eb3cSopenharmony_ci Row.justifyContent(FlexAlign.Center); 65023b3eb3cSopenharmony_ci ViewStackProcessor.visualState('focused'); 65123b3eb3cSopenharmony_ci Row.border({ 65223b3eb3cSopenharmony_ci radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 65323b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 65423b3eb3cSopenharmony_ci width: ImageMenuItem.focusBorderWidth, 65523b3eb3cSopenharmony_ci color: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'], 65623b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 65723b3eb3cSopenharmony_ci style: BorderStyle.Solid 65823b3eb3cSopenharmony_ci }); 65923b3eb3cSopenharmony_ci ViewStackProcessor.visualState('normal'); 66023b3eb3cSopenharmony_ci Row.border({ 66123b3eb3cSopenharmony_ci radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 66223b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 66323b3eb3cSopenharmony_ci width: 0 66423b3eb3cSopenharmony_ci }); 66523b3eb3cSopenharmony_ci ViewStackProcessor.visualState(); 66623b3eb3cSopenharmony_ci Row.onFocus(() => this.isMoreIconOnFocus = true); 66723b3eb3cSopenharmony_ci Row.onBlur(() => this.isMoreIconOnFocus = false); 66823b3eb3cSopenharmony_ci Row.onHover((n4) => this.isMoreIconOnHover = n4); 66923b3eb3cSopenharmony_ci Row.onKeyEvent((m4) => { 67023b3eb3cSopenharmony_ci if (m4.keyCode !== KeyCode.KEYCODE_ENTER && m4.keyCode !== KeyCode.KEYCODE_SPACE) { 67123b3eb3cSopenharmony_ci return; 67223b3eb3cSopenharmony_ci } 67323b3eb3cSopenharmony_ci if (m4.type === KeyType.Down) { 67423b3eb3cSopenharmony_ci this.isMoreIconOnClick = true; 67523b3eb3cSopenharmony_ci } 67623b3eb3cSopenharmony_ci if (m4.type === KeyType.Up) { 67723b3eb3cSopenharmony_ci this.isMoreIconOnClick = false; 67823b3eb3cSopenharmony_ci } 67923b3eb3cSopenharmony_ci }); 68023b3eb3cSopenharmony_ci Row.onTouch((l4) => { 68123b3eb3cSopenharmony_ci if (l4.type === TouchType.Down) { 68223b3eb3cSopenharmony_ci this.isMoreIconOnClick = true; 68323b3eb3cSopenharmony_ci } 68423b3eb3cSopenharmony_ci if (l4.type === TouchType.Up || l4.type === TouchType.Cancel) { 68523b3eb3cSopenharmony_ci this.isMoreIconOnClick = false; 68623b3eb3cSopenharmony_ci if (this.fontSize >= this.minFontSize) { 68723b3eb3cSopenharmony_ci this.dialogController?.close(); 68823b3eb3cSopenharmony_ci } 68923b3eb3cSopenharmony_ci } 69023b3eb3cSopenharmony_ci }); 69123b3eb3cSopenharmony_ci Row.onClick(() => this.isPopupShown = true); 69223b3eb3cSopenharmony_ci Gesture.create(GesturePriority.Low); 69323b3eb3cSopenharmony_ci LongPressGesture.create({ repeat: false, duration: this.longPressTime }); 69423b3eb3cSopenharmony_ci LongPressGesture.onAction((k4) => { 69523b3eb3cSopenharmony_ci this.fontSize = this.decideFontScale(); 69623b3eb3cSopenharmony_ci if (k4) { 69723b3eb3cSopenharmony_ci if (this.fontSize >= this.minFontSize) { 69823b3eb3cSopenharmony_ci this.dialogController?.open(); 69923b3eb3cSopenharmony_ci } 70023b3eb3cSopenharmony_ci } 70123b3eb3cSopenharmony_ci }); 70223b3eb3cSopenharmony_ci LongPressGesture.pop(); 70323b3eb3cSopenharmony_ci Gesture.pop(); 70423b3eb3cSopenharmony_ci Row.bindPopup(this.isPopupShown, { 70523b3eb3cSopenharmony_ci builder: { builder: this.popupBuilder.bind(this) }, 70623b3eb3cSopenharmony_ci placement: Placement.Bottom, 70723b3eb3cSopenharmony_ci popupColor: Color.White, 70823b3eb3cSopenharmony_ci enableArrow: false, 70923b3eb3cSopenharmony_ci onStateChange: (j4) => { 71023b3eb3cSopenharmony_ci this.isPopupShown = j4.isVisible; 71123b3eb3cSopenharmony_ci if (!j4.isVisible) { 71223b3eb3cSopenharmony_ci this.isMoreIconOnClick = false; 71323b3eb3cSopenharmony_ci } 71423b3eb3cSopenharmony_ci } 71523b3eb3cSopenharmony_ci }); 71623b3eb3cSopenharmony_ci }, Row); 71723b3eb3cSopenharmony_ci this.observeComponentCreation2((f4, g4) => { 71823b3eb3cSopenharmony_ci Image.create(PUBLIC_MORE); 71923b3eb3cSopenharmony_ci Image.width(ImageMenuItem.imageSize); 72023b3eb3cSopenharmony_ci Image.height(ImageMenuItem.imageSize); 72123b3eb3cSopenharmony_ci Image.focusable(true); 72223b3eb3cSopenharmony_ci Image.draggable(false); 72323b3eb3cSopenharmony_ci Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 72423b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 72523b3eb3cSopenharmony_ci }, Image); 72623b3eb3cSopenharmony_ci Row.pop(); 72723b3eb3cSopenharmony_ci }); 72823b3eb3cSopenharmony_ci } 72923b3eb3cSopenharmony_ci }, If); 73023b3eb3cSopenharmony_ci If.pop(); 73123b3eb3cSopenharmony_ci Row.pop(); 73223b3eb3cSopenharmony_ci Column.pop(); 73323b3eb3cSopenharmony_ci } 73423b3eb3cSopenharmony_ci popupBuilder(q3 = null) { 73523b3eb3cSopenharmony_ci this.observeComponentCreation2((b4, c4) => { 73623b3eb3cSopenharmony_ci Column.create(); 73723b3eb3cSopenharmony_ci Column.width(ImageMenuItem.imageHotZoneWidth + CollapsibleMenuSection.focusPadding * CollapsibleMenuSection.marginsNum); 73823b3eb3cSopenharmony_ci Column.margin({ top: CollapsibleMenuSection.focusPadding, bottom: CollapsibleMenuSection.focusPadding }); 73923b3eb3cSopenharmony_ci Column.onAppear(() => { 74023b3eb3cSopenharmony_ci focusControl.requestFocus(ImageMenuItem.focusablePrefix + this.firstFocusableIndex); 74123b3eb3cSopenharmony_ci }); 74223b3eb3cSopenharmony_ci }, Column); 74323b3eb3cSopenharmony_ci this.observeComponentCreation2((r3, s3) => { 74423b3eb3cSopenharmony_ci ForEach.create(); 74523b3eb3cSopenharmony_ci const t3 = (u3, v3) => { 74623b3eb3cSopenharmony_ci const w3 = u3; 74723b3eb3cSopenharmony_ci { 74823b3eb3cSopenharmony_ci this.observeComponentCreation2((x3, y3) => { 74923b3eb3cSopenharmony_ci if (y3) { 75023b3eb3cSopenharmony_ci let z3 = new ImageMenuItem(this, { item: w3, 75123b3eb3cSopenharmony_ci index: this.index * 1000 + CollapsibleMenuSection.maxCountOfVisibleItems + v3 }, undefined, x3, 75223b3eb3cSopenharmony_ci () => { }, { page: 'library/src/main/ets/components/MainPage.ets', line: 397, col: 11 }); 75323b3eb3cSopenharmony_ci ViewPU.create(z3); 75423b3eb3cSopenharmony_ci let a4 = () => { 75523b3eb3cSopenharmony_ci return { 75623b3eb3cSopenharmony_ci item: w3, 75723b3eb3cSopenharmony_ci index: this.index * 1000 + CollapsibleMenuSection.maxCountOfVisibleItems + v3 75823b3eb3cSopenharmony_ci }; 75923b3eb3cSopenharmony_ci }; 76023b3eb3cSopenharmony_ci z3.paramsGenerator_ = a4; 76123b3eb3cSopenharmony_ci } 76223b3eb3cSopenharmony_ci else { 76323b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(x3, {}); 76423b3eb3cSopenharmony_ci } 76523b3eb3cSopenharmony_ci }, { name: 'ImageMenuItem' }); 76623b3eb3cSopenharmony_ci } 76723b3eb3cSopenharmony_ci }; 76823b3eb3cSopenharmony_ci this.forEachUpdateFunction(r3, this.menuItems.slice(CollapsibleMenuSection.maxCountOfVisibleItems - 1, 76923b3eb3cSopenharmony_ci this.menuItems.length), t3, undefined, true, false); 77023b3eb3cSopenharmony_ci }, ForEach); 77123b3eb3cSopenharmony_ci ForEach.pop(); 77223b3eb3cSopenharmony_ci Column.pop(); 77323b3eb3cSopenharmony_ci } 77423b3eb3cSopenharmony_ci rerender() { 77523b3eb3cSopenharmony_ci this.updateDirtyElements(); 77623b3eb3cSopenharmony_ci } 77723b3eb3cSopenharmony_ci} 77823b3eb3cSopenharmony_ciCollapsibleMenuSection.maxCountOfVisibleItems = 1; 77923b3eb3cSopenharmony_ciCollapsibleMenuSection.focusPadding = 4; 78023b3eb3cSopenharmony_ciCollapsibleMenuSection.marginsNum = 2; 78123b3eb3cSopenharmony_ciclass TabContentItem extends ViewPU { 78223b3eb3cSopenharmony_ci constructor(k3, l3, m3, n3 = -1, o3 = undefined, p3) { 78323b3eb3cSopenharmony_ci super(k3, m3, n3, p3); 78423b3eb3cSopenharmony_ci if (typeof o3 === 'function') { 78523b3eb3cSopenharmony_ci this.paramsGenerator_ = o3; 78623b3eb3cSopenharmony_ci } 78723b3eb3cSopenharmony_ci this.item = { title: '' }; 78823b3eb3cSopenharmony_ci this.index = 0; 78923b3eb3cSopenharmony_ci this.maxIndex = 0; 79023b3eb3cSopenharmony_ci this.onCustomClick = undefined; 79123b3eb3cSopenharmony_ci this.onImageComplete = undefined; 79223b3eb3cSopenharmony_ci this.__currentIndex = new SynchedPropertySimpleOneWayPU(l3.currentIndex, this, 'currentIndex'); 79323b3eb3cSopenharmony_ci this.__isOnFocus = new ObservedPropertySimplePU(false, this, 'isOnFocus'); 79423b3eb3cSopenharmony_ci this.__isOnHover = new ObservedPropertySimplePU(false, this, 'isOnHover'); 79523b3eb3cSopenharmony_ci this.__isOnClick = new ObservedPropertySimplePU(false, this, 'isOnClick'); 79623b3eb3cSopenharmony_ci this.__tabWidth = new ObservedPropertySimplePU(0, this, 'tabWidth'); 79723b3eb3cSopenharmony_ci this.__imageWidth = new ObservedPropertySimplePU(24, this, 'imageWidth'); 79823b3eb3cSopenharmony_ci this.__imageHeight = new ObservedPropertySimplePU(24, this, 'imageHeight'); 79923b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(l3); 80023b3eb3cSopenharmony_ci this.finalizeConstruction(); 80123b3eb3cSopenharmony_ci } 80223b3eb3cSopenharmony_ci setInitiallyProvidedValue(j3) { 80323b3eb3cSopenharmony_ci if (j3.item !== undefined) { 80423b3eb3cSopenharmony_ci this.item = j3.item; 80523b3eb3cSopenharmony_ci } 80623b3eb3cSopenharmony_ci if (j3.index !== undefined) { 80723b3eb3cSopenharmony_ci this.index = j3.index; 80823b3eb3cSopenharmony_ci } 80923b3eb3cSopenharmony_ci if (j3.maxIndex !== undefined) { 81023b3eb3cSopenharmony_ci this.maxIndex = j3.maxIndex; 81123b3eb3cSopenharmony_ci } 81223b3eb3cSopenharmony_ci if (j3.onCustomClick !== undefined) { 81323b3eb3cSopenharmony_ci this.onCustomClick = j3.onCustomClick; 81423b3eb3cSopenharmony_ci } 81523b3eb3cSopenharmony_ci if (j3.onImageComplete !== undefined) { 81623b3eb3cSopenharmony_ci this.onImageComplete = j3.onImageComplete; 81723b3eb3cSopenharmony_ci } 81823b3eb3cSopenharmony_ci if (j3.isOnFocus !== undefined) { 81923b3eb3cSopenharmony_ci this.isOnFocus = j3.isOnFocus; 82023b3eb3cSopenharmony_ci } 82123b3eb3cSopenharmony_ci if (j3.isOnHover !== undefined) { 82223b3eb3cSopenharmony_ci this.isOnHover = j3.isOnHover; 82323b3eb3cSopenharmony_ci } 82423b3eb3cSopenharmony_ci if (j3.isOnClick !== undefined) { 82523b3eb3cSopenharmony_ci this.isOnClick = j3.isOnClick; 82623b3eb3cSopenharmony_ci } 82723b3eb3cSopenharmony_ci if (j3.tabWidth !== undefined) { 82823b3eb3cSopenharmony_ci this.tabWidth = j3.tabWidth; 82923b3eb3cSopenharmony_ci } 83023b3eb3cSopenharmony_ci if (j3.imageWidth !== undefined) { 83123b3eb3cSopenharmony_ci this.imageWidth = j3.imageWidth; 83223b3eb3cSopenharmony_ci } 83323b3eb3cSopenharmony_ci if (j3.imageHeight !== undefined) { 83423b3eb3cSopenharmony_ci this.imageHeight = j3.imageHeight; 83523b3eb3cSopenharmony_ci } 83623b3eb3cSopenharmony_ci } 83723b3eb3cSopenharmony_ci updateStateVars(i3) { 83823b3eb3cSopenharmony_ci this.__currentIndex.reset(i3.currentIndex); 83923b3eb3cSopenharmony_ci } 84023b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(h3) { 84123b3eb3cSopenharmony_ci this.__currentIndex.purgeDependencyOnElmtId(h3); 84223b3eb3cSopenharmony_ci this.__isOnFocus.purgeDependencyOnElmtId(h3); 84323b3eb3cSopenharmony_ci this.__isOnHover.purgeDependencyOnElmtId(h3); 84423b3eb3cSopenharmony_ci this.__isOnClick.purgeDependencyOnElmtId(h3); 84523b3eb3cSopenharmony_ci this.__tabWidth.purgeDependencyOnElmtId(h3); 84623b3eb3cSopenharmony_ci this.__imageWidth.purgeDependencyOnElmtId(h3); 84723b3eb3cSopenharmony_ci this.__imageHeight.purgeDependencyOnElmtId(h3); 84823b3eb3cSopenharmony_ci } 84923b3eb3cSopenharmony_ci aboutToBeDeleted() { 85023b3eb3cSopenharmony_ci this.__currentIndex.aboutToBeDeleted(); 85123b3eb3cSopenharmony_ci this.__isOnFocus.aboutToBeDeleted(); 85223b3eb3cSopenharmony_ci this.__isOnHover.aboutToBeDeleted(); 85323b3eb3cSopenharmony_ci this.__isOnClick.aboutToBeDeleted(); 85423b3eb3cSopenharmony_ci this.__tabWidth.aboutToBeDeleted(); 85523b3eb3cSopenharmony_ci this.__imageWidth.aboutToBeDeleted(); 85623b3eb3cSopenharmony_ci this.__imageHeight.aboutToBeDeleted(); 85723b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 85823b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 85923b3eb3cSopenharmony_ci } 86023b3eb3cSopenharmony_ci get currentIndex() { 86123b3eb3cSopenharmony_ci return this.__currentIndex.get(); 86223b3eb3cSopenharmony_ci } 86323b3eb3cSopenharmony_ci set currentIndex(g3) { 86423b3eb3cSopenharmony_ci this.__currentIndex.set(g3); 86523b3eb3cSopenharmony_ci } 86623b3eb3cSopenharmony_ci get isOnFocus() { 86723b3eb3cSopenharmony_ci return this.__isOnFocus.get(); 86823b3eb3cSopenharmony_ci } 86923b3eb3cSopenharmony_ci set isOnFocus(f3) { 87023b3eb3cSopenharmony_ci this.__isOnFocus.set(f3); 87123b3eb3cSopenharmony_ci } 87223b3eb3cSopenharmony_ci get isOnHover() { 87323b3eb3cSopenharmony_ci return this.__isOnHover.get(); 87423b3eb3cSopenharmony_ci } 87523b3eb3cSopenharmony_ci set isOnHover(e3) { 87623b3eb3cSopenharmony_ci this.__isOnHover.set(e3); 87723b3eb3cSopenharmony_ci } 87823b3eb3cSopenharmony_ci get isOnClick() { 87923b3eb3cSopenharmony_ci return this.__isOnClick.get(); 88023b3eb3cSopenharmony_ci } 88123b3eb3cSopenharmony_ci set isOnClick(d3) { 88223b3eb3cSopenharmony_ci this.__isOnClick.set(d3); 88323b3eb3cSopenharmony_ci } 88423b3eb3cSopenharmony_ci get tabWidth() { 88523b3eb3cSopenharmony_ci return this.__tabWidth.get(); 88623b3eb3cSopenharmony_ci } 88723b3eb3cSopenharmony_ci set tabWidth(c3) { 88823b3eb3cSopenharmony_ci this.__tabWidth.set(c3); 88923b3eb3cSopenharmony_ci } 89023b3eb3cSopenharmony_ci get imageWidth() { 89123b3eb3cSopenharmony_ci return this.__imageWidth.get(); 89223b3eb3cSopenharmony_ci } 89323b3eb3cSopenharmony_ci set imageWidth(b3) { 89423b3eb3cSopenharmony_ci this.__imageWidth.set(b3); 89523b3eb3cSopenharmony_ci } 89623b3eb3cSopenharmony_ci get imageHeight() { 89723b3eb3cSopenharmony_ci return this.__imageHeight.get(); 89823b3eb3cSopenharmony_ci } 89923b3eb3cSopenharmony_ci set imageHeight(a3) { 90023b3eb3cSopenharmony_ci this.__imageHeight.set(a3); 90123b3eb3cSopenharmony_ci } 90223b3eb3cSopenharmony_ci getBgColor() { 90323b3eb3cSopenharmony_ci if (this.isOnClick) { 90423b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_click_effect'], 90523b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 90623b3eb3cSopenharmony_ci } else if (this.isOnHover) { 90723b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_hover'], 90823b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 90923b3eb3cSopenharmony_ci } else { 91023b3eb3cSopenharmony_ci return Color.Transparent; 91123b3eb3cSopenharmony_ci } 91223b3eb3cSopenharmony_ci } 91323b3eb3cSopenharmony_ci getBorderAttr() { 91423b3eb3cSopenharmony_ci if (this.isOnFocus) { 91523b3eb3cSopenharmony_ci return { 91623b3eb3cSopenharmony_ci radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 91723b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 91823b3eb3cSopenharmony_ci width: TabContentItem.focusBorderWidth, 91923b3eb3cSopenharmony_ci color: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'], 92023b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 92123b3eb3cSopenharmony_ci style: BorderStyle.Solid 92223b3eb3cSopenharmony_ci }; 92323b3eb3cSopenharmony_ci } 92423b3eb3cSopenharmony_ci return { width: 0 }; 92523b3eb3cSopenharmony_ci } 92623b3eb3cSopenharmony_ci getImageScaleFactor() { 92723b3eb3cSopenharmony_ci return this.index === this.currentIndex ? TabContentItem.imageMagnificationFactor : 1; 92823b3eb3cSopenharmony_ci } 92923b3eb3cSopenharmony_ci getImageLayoutWidth() { 93023b3eb3cSopenharmony_ci return TabContentItem.imageSize / Math.max(this.imageHeight, 1.0) * this.imageWidth; 93123b3eb3cSopenharmony_ci } 93223b3eb3cSopenharmony_ci initialRender() { 93323b3eb3cSopenharmony_ci this.observeComponentCreation2((y2, z2) => { 93423b3eb3cSopenharmony_ci Stack.create(); 93523b3eb3cSopenharmony_ci Stack.margin({ 93623b3eb3cSopenharmony_ci left: this.index === 0 ? TabContentItem.marginFirst : 0, 93723b3eb3cSopenharmony_ci right: this.index === this.maxIndex ? 12 : 0 93823b3eb3cSopenharmony_ci }); 93923b3eb3cSopenharmony_ci }, Stack); 94023b3eb3cSopenharmony_ci this.observeComponentCreation2((u2, v2) => { 94123b3eb3cSopenharmony_ci Row.create(); 94223b3eb3cSopenharmony_ci Row.height(TabTitleBar.totalHeight); 94323b3eb3cSopenharmony_ci Row.alignItems(VerticalAlign.Center); 94423b3eb3cSopenharmony_ci Row.justifyContent(FlexAlign.Center); 94523b3eb3cSopenharmony_ci Row.borderRadius(TabContentItem.buttonBorderRadius); 94623b3eb3cSopenharmony_ci Row.backgroundColor(this.getBgColor()); 94723b3eb3cSopenharmony_ci Row.onAreaChange((w2, x2) => { 94823b3eb3cSopenharmony_ci this.tabWidth = Number(x2.width); 94923b3eb3cSopenharmony_ci }); 95023b3eb3cSopenharmony_ci }, Row); 95123b3eb3cSopenharmony_ci this.observeComponentCreation2((s2, t2) => { 95223b3eb3cSopenharmony_ci Column.create(); 95323b3eb3cSopenharmony_ci Column.justifyContent(FlexAlign.Center); 95423b3eb3cSopenharmony_ci }, Column); 95523b3eb3cSopenharmony_ci this.observeComponentCreation2((c2, d2) => { 95623b3eb3cSopenharmony_ci If.create(); 95723b3eb3cSopenharmony_ci if (this.item.icon === undefined) { 95823b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 95923b3eb3cSopenharmony_ci this.observeComponentCreation2((n2, o2) => { 96023b3eb3cSopenharmony_ci Text.create(this.item.title); 96123b3eb3cSopenharmony_ci Context.animation({ duration: 300 }); 96223b3eb3cSopenharmony_ci Text.fontSize(this.index === this.currentIndex ? 96323b3eb3cSopenharmony_ci { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_headline7'], 96423b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : 96523b3eb3cSopenharmony_ci { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_headline9'], 96623b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 96723b3eb3cSopenharmony_ci Text.fontColor(this.index === this.currentIndex ? 96823b3eb3cSopenharmony_ci { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_text'], 96923b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : 97023b3eb3cSopenharmony_ci { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_text_off'], 97123b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 97223b3eb3cSopenharmony_ci Text.fontWeight(FontWeight.Medium); 97323b3eb3cSopenharmony_ci Text.focusable(true); 97423b3eb3cSopenharmony_ci Context.animation(null); 97523b3eb3cSopenharmony_ci Text.padding({ 97623b3eb3cSopenharmony_ci top: this.index === this.currentIndex ? 6 : 10, 97723b3eb3cSopenharmony_ci left: TabContentItem.paddingLeft, 97823b3eb3cSopenharmony_ci bottom: 2, 97923b3eb3cSopenharmony_ci right: TabContentItem.paddingRight 98023b3eb3cSopenharmony_ci }); 98123b3eb3cSopenharmony_ci Text.onFocus(() => this.isOnFocus = true); 98223b3eb3cSopenharmony_ci Text.onBlur(() => this.isOnFocus = false); 98323b3eb3cSopenharmony_ci Text.onHover((r2) => this.isOnHover = r2); 98423b3eb3cSopenharmony_ci Text.onKeyEvent((q2) => { 98523b3eb3cSopenharmony_ci if (q2.keyCode !== KeyCode.KEYCODE_ENTER && q2.keyCode !== KeyCode.KEYCODE_SPACE) { 98623b3eb3cSopenharmony_ci return; 98723b3eb3cSopenharmony_ci } 98823b3eb3cSopenharmony_ci if (q2.type === KeyType.Down) { 98923b3eb3cSopenharmony_ci this.isOnClick = true; 99023b3eb3cSopenharmony_ci } 99123b3eb3cSopenharmony_ci if (q2.type === KeyType.Up) { 99223b3eb3cSopenharmony_ci this.isOnClick = false; 99323b3eb3cSopenharmony_ci } 99423b3eb3cSopenharmony_ci }); 99523b3eb3cSopenharmony_ci Text.onTouch((p2) => { 99623b3eb3cSopenharmony_ci if (p2.type === TouchType.Down) { 99723b3eb3cSopenharmony_ci this.isOnClick = true; 99823b3eb3cSopenharmony_ci } 99923b3eb3cSopenharmony_ci if (p2.type === TouchType.Up || p2.type === TouchType.Cancel) { 100023b3eb3cSopenharmony_ci this.isOnClick = false; 100123b3eb3cSopenharmony_ci } 100223b3eb3cSopenharmony_ci }); 100323b3eb3cSopenharmony_ci Text.onClick(() => this.onCustomClick && this.onCustomClick(this.index)); 100423b3eb3cSopenharmony_ci }, Text); 100523b3eb3cSopenharmony_ci Text.pop(); 100623b3eb3cSopenharmony_ci }); 100723b3eb3cSopenharmony_ci } 100823b3eb3cSopenharmony_ci else { 100923b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 101023b3eb3cSopenharmony_ci this.observeComponentCreation2((i2, j2) => { 101123b3eb3cSopenharmony_ci Row.create(); 101223b3eb3cSopenharmony_ci Context.animation({ duration: 300 }); 101323b3eb3cSopenharmony_ci Row.width(this.getImageLayoutWidth() * this.getImageScaleFactor() + 101423b3eb3cSopenharmony_ci TabContentItem.paddingLeft + TabContentItem.paddingRight); 101523b3eb3cSopenharmony_ci Row.constraintSize({ 101623b3eb3cSopenharmony_ci minWidth: TabContentItem.imageHotZoneWidth, 101723b3eb3cSopenharmony_ci minHeight: TabContentItem.imageHotZoneWidth 101823b3eb3cSopenharmony_ci }); 101923b3eb3cSopenharmony_ci Context.animation(null); 102023b3eb3cSopenharmony_ci Row.justifyContent(FlexAlign.Center); 102123b3eb3cSopenharmony_ci Row.onFocus(() => this.isOnFocus = true); 102223b3eb3cSopenharmony_ci Row.onBlur(() => this.isOnFocus = false); 102323b3eb3cSopenharmony_ci Row.onHover((m2) => this.isOnHover = m2); 102423b3eb3cSopenharmony_ci Row.onKeyEvent((l2) => { 102523b3eb3cSopenharmony_ci if (l2.keyCode !== KeyCode.KEYCODE_ENTER && l2.keyCode !== KeyCode.KEYCODE_SPACE) { 102623b3eb3cSopenharmony_ci return; 102723b3eb3cSopenharmony_ci } 102823b3eb3cSopenharmony_ci if (l2.type === KeyType.Down) { 102923b3eb3cSopenharmony_ci this.isOnClick = true; 103023b3eb3cSopenharmony_ci } 103123b3eb3cSopenharmony_ci if (l2.type === KeyType.Up) { 103223b3eb3cSopenharmony_ci this.isOnClick = false; 103323b3eb3cSopenharmony_ci } 103423b3eb3cSopenharmony_ci }); 103523b3eb3cSopenharmony_ci Row.onTouch((k2) => { 103623b3eb3cSopenharmony_ci if (k2.type === TouchType.Down) { 103723b3eb3cSopenharmony_ci this.isOnClick = true; 103823b3eb3cSopenharmony_ci } 103923b3eb3cSopenharmony_ci if (k2.type === TouchType.Up || k2.type === TouchType.Cancel) { 104023b3eb3cSopenharmony_ci this.isOnClick = false; 104123b3eb3cSopenharmony_ci } 104223b3eb3cSopenharmony_ci }); 104323b3eb3cSopenharmony_ci Row.onClick(() => this.onCustomClick && this.onCustomClick(this.index)); 104423b3eb3cSopenharmony_ci }, Row); 104523b3eb3cSopenharmony_ci this.observeComponentCreation2((e2, f2) => { 104623b3eb3cSopenharmony_ci Image.create(this.item.icon); 104723b3eb3cSopenharmony_ci Context.animation({ duration: 300 }); 104823b3eb3cSopenharmony_ci Image.alt(this.item.title); 104923b3eb3cSopenharmony_ci Image.width(this.getImageLayoutWidth()); 105023b3eb3cSopenharmony_ci Image.height(TabContentItem.imageSize); 105123b3eb3cSopenharmony_ci Image.objectFit(ImageFit.Fill); 105223b3eb3cSopenharmony_ci Image.scale({ 105323b3eb3cSopenharmony_ci x: this.getImageScaleFactor(), 105423b3eb3cSopenharmony_ci y: this.getImageScaleFactor() 105523b3eb3cSopenharmony_ci }); 105623b3eb3cSopenharmony_ci Context.animation(null); 105723b3eb3cSopenharmony_ci Image.hitTestBehavior(HitTestMode.None); 105823b3eb3cSopenharmony_ci Image.focusable(true); 105923b3eb3cSopenharmony_ci Image.onComplete((h2) => { 106023b3eb3cSopenharmony_ci if (!this.onImageComplete) { 106123b3eb3cSopenharmony_ci return; 106223b3eb3cSopenharmony_ci } 106323b3eb3cSopenharmony_ci this.imageWidth = px2vp(h2?.width); 106423b3eb3cSopenharmony_ci this.imageHeight = px2vp(h2?.height); 106523b3eb3cSopenharmony_ci this.onImageComplete(px2vp(h2?.componentWidth) + 106623b3eb3cSopenharmony_ci TabContentItem.paddingLeft + TabContentItem.paddingRight); 106723b3eb3cSopenharmony_ci }); 106823b3eb3cSopenharmony_ci Image.onError((g2) => { 106923b3eb3cSopenharmony_ci if (!this.onImageComplete) { 107023b3eb3cSopenharmony_ci return; 107123b3eb3cSopenharmony_ci } 107223b3eb3cSopenharmony_ci this.onImageComplete(px2vp(g2.componentWidth) + 107323b3eb3cSopenharmony_ci TabContentItem.paddingLeft + TabContentItem.paddingRight); 107423b3eb3cSopenharmony_ci }); 107523b3eb3cSopenharmony_ci }, Image); 107623b3eb3cSopenharmony_ci Row.pop(); 107723b3eb3cSopenharmony_ci }); 107823b3eb3cSopenharmony_ci } 107923b3eb3cSopenharmony_ci }, If); 108023b3eb3cSopenharmony_ci If.pop(); 108123b3eb3cSopenharmony_ci Column.pop(); 108223b3eb3cSopenharmony_ci Row.pop(); 108323b3eb3cSopenharmony_ci this.observeComponentCreation2((y1, z1) => { 108423b3eb3cSopenharmony_ci If.create(); 108523b3eb3cSopenharmony_ci if (this.isOnFocus && this.tabWidth > 0) { 108623b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 108723b3eb3cSopenharmony_ci this.observeComponentCreation2((a2, b2) => { 108823b3eb3cSopenharmony_ci Row.create(); 108923b3eb3cSopenharmony_ci Row.width(this.tabWidth); 109023b3eb3cSopenharmony_ci Row.height(TabTitleBar.totalHeight); 109123b3eb3cSopenharmony_ci Row.hitTestBehavior(HitTestMode.None); 109223b3eb3cSopenharmony_ci Row.borderRadius(TabContentItem.buttonBorderRadius); 109323b3eb3cSopenharmony_ci ViewStackProcessor.visualState('focused'); 109423b3eb3cSopenharmony_ci Row.border(this.getBorderAttr()); 109523b3eb3cSopenharmony_ci ViewStackProcessor.visualState('normal'); 109623b3eb3cSopenharmony_ci Row.border({ 109723b3eb3cSopenharmony_ci radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 109823b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 109923b3eb3cSopenharmony_ci width: 0 110023b3eb3cSopenharmony_ci }); 110123b3eb3cSopenharmony_ci ViewStackProcessor.visualState(); 110223b3eb3cSopenharmony_ci }, Row); 110323b3eb3cSopenharmony_ci Row.pop(); 110423b3eb3cSopenharmony_ci }); 110523b3eb3cSopenharmony_ci } 110623b3eb3cSopenharmony_ci else { 110723b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 110823b3eb3cSopenharmony_ci }); 110923b3eb3cSopenharmony_ci } 111023b3eb3cSopenharmony_ci }, If); 111123b3eb3cSopenharmony_ci If.pop(); 111223b3eb3cSopenharmony_ci Stack.pop(); 111323b3eb3cSopenharmony_ci } 111423b3eb3cSopenharmony_ci rerender() { 111523b3eb3cSopenharmony_ci this.updateDirtyElements(); 111623b3eb3cSopenharmony_ci } 111723b3eb3cSopenharmony_ci} 111823b3eb3cSopenharmony_ciTabContentItem.imageSize = 24; 111923b3eb3cSopenharmony_ciTabContentItem.imageHotZoneWidth = 48; 112023b3eb3cSopenharmony_ciTabContentItem.imageMagnificationFactor = 1.4; 112123b3eb3cSopenharmony_ciTabContentItem.buttonBorderRadius = 8; 112223b3eb3cSopenharmony_ciTabContentItem.focusBorderWidth = 2; 112323b3eb3cSopenharmony_ciTabContentItem.paddingLeft = 8; 112423b3eb3cSopenharmony_ciTabContentItem.paddingRight = 8; 112523b3eb3cSopenharmony_ciTabContentItem.marginFirst = 16; 112623b3eb3cSopenharmony_ciclass ImageMenuItem extends ViewPU { 112723b3eb3cSopenharmony_ci constructor(s1, t1, u1, v1 = -1, w1 = undefined, x1) { 112823b3eb3cSopenharmony_ci super(s1, u1, v1, x1); 112923b3eb3cSopenharmony_ci if (typeof w1 === 'function') { 113023b3eb3cSopenharmony_ci this.paramsGenerator_ = w1; 113123b3eb3cSopenharmony_ci } 113223b3eb3cSopenharmony_ci this.item = { value: '' }; 113323b3eb3cSopenharmony_ci this.index = 0; 113423b3eb3cSopenharmony_ci this.__isOnFocus = new ObservedPropertySimplePU(false, this, 'isOnFocus'); 113523b3eb3cSopenharmony_ci this.__isOnHover = new ObservedPropertySimplePU(false, this, 'isOnHover'); 113623b3eb3cSopenharmony_ci this.__isOnClick = new ObservedPropertySimplePU(false, this, 'isOnClick'); 113723b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(t1); 113823b3eb3cSopenharmony_ci this.finalizeConstruction(); 113923b3eb3cSopenharmony_ci } 114023b3eb3cSopenharmony_ci setInitiallyProvidedValue(r1) { 114123b3eb3cSopenharmony_ci if (r1.item !== undefined) { 114223b3eb3cSopenharmony_ci this.item = r1.item; 114323b3eb3cSopenharmony_ci } 114423b3eb3cSopenharmony_ci if (r1.index !== undefined) { 114523b3eb3cSopenharmony_ci this.index = r1.index; 114623b3eb3cSopenharmony_ci } 114723b3eb3cSopenharmony_ci if (r1.isOnFocus !== undefined) { 114823b3eb3cSopenharmony_ci this.isOnFocus = r1.isOnFocus; 114923b3eb3cSopenharmony_ci } 115023b3eb3cSopenharmony_ci if (r1.isOnHover !== undefined) { 115123b3eb3cSopenharmony_ci this.isOnHover = r1.isOnHover; 115223b3eb3cSopenharmony_ci } 115323b3eb3cSopenharmony_ci if (r1.isOnClick !== undefined) { 115423b3eb3cSopenharmony_ci this.isOnClick = r1.isOnClick; 115523b3eb3cSopenharmony_ci } 115623b3eb3cSopenharmony_ci } 115723b3eb3cSopenharmony_ci updateStateVars(q1) { 115823b3eb3cSopenharmony_ci } 115923b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(p1) { 116023b3eb3cSopenharmony_ci this.__isOnFocus.purgeDependencyOnElmtId(p1); 116123b3eb3cSopenharmony_ci this.__isOnHover.purgeDependencyOnElmtId(p1); 116223b3eb3cSopenharmony_ci this.__isOnClick.purgeDependencyOnElmtId(p1); 116323b3eb3cSopenharmony_ci } 116423b3eb3cSopenharmony_ci aboutToBeDeleted() { 116523b3eb3cSopenharmony_ci this.__isOnFocus.aboutToBeDeleted(); 116623b3eb3cSopenharmony_ci this.__isOnHover.aboutToBeDeleted(); 116723b3eb3cSopenharmony_ci this.__isOnClick.aboutToBeDeleted(); 116823b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 116923b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 117023b3eb3cSopenharmony_ci } 117123b3eb3cSopenharmony_ci get isOnFocus() { 117223b3eb3cSopenharmony_ci return this.__isOnFocus.get(); 117323b3eb3cSopenharmony_ci } 117423b3eb3cSopenharmony_ci set isOnFocus(o1) { 117523b3eb3cSopenharmony_ci this.__isOnFocus.set(o1); 117623b3eb3cSopenharmony_ci } 117723b3eb3cSopenharmony_ci get isOnHover() { 117823b3eb3cSopenharmony_ci return this.__isOnHover.get(); 117923b3eb3cSopenharmony_ci } 118023b3eb3cSopenharmony_ci set isOnHover(n1) { 118123b3eb3cSopenharmony_ci this.__isOnHover.set(n1); 118223b3eb3cSopenharmony_ci } 118323b3eb3cSopenharmony_ci get isOnClick() { 118423b3eb3cSopenharmony_ci return this.__isOnClick.get(); 118523b3eb3cSopenharmony_ci } 118623b3eb3cSopenharmony_ci set isOnClick(m1) { 118723b3eb3cSopenharmony_ci this.__isOnClick.set(m1); 118823b3eb3cSopenharmony_ci } 118923b3eb3cSopenharmony_ci getFgColor() { 119023b3eb3cSopenharmony_ci return this.isOnClick ? 119123b3eb3cSopenharmony_ci { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon_pressed'], 119223b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : 119323b3eb3cSopenharmony_ci { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon'], 119423b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 119523b3eb3cSopenharmony_ci } 119623b3eb3cSopenharmony_ci getBgColor() { 119723b3eb3cSopenharmony_ci if (this.isOnClick) { 119823b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_click_effect'], 119923b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 120023b3eb3cSopenharmony_ci } else if (this.isOnHover) { 120123b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_hover'], 120223b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 120323b3eb3cSopenharmony_ci } else { 120423b3eb3cSopenharmony_ci return Color.Transparent; 120523b3eb3cSopenharmony_ci } 120623b3eb3cSopenharmony_ci } 120723b3eb3cSopenharmony_ci initialRender() { 120823b3eb3cSopenharmony_ci this.observeComponentCreation2((h1, i1) => { 120923b3eb3cSopenharmony_ci Row.create(); 121023b3eb3cSopenharmony_ci Row.width(ImageMenuItem.imageHotZoneWidth); 121123b3eb3cSopenharmony_ci Row.height(ImageMenuItem.imageHotZoneWidth); 121223b3eb3cSopenharmony_ci Row.borderRadius(ImageMenuItem.buttonBorderRadius); 121323b3eb3cSopenharmony_ci Row.foregroundColor(this.getFgColor()); 121423b3eb3cSopenharmony_ci Row.backgroundColor(this.getBgColor()); 121523b3eb3cSopenharmony_ci Row.justifyContent(FlexAlign.Center); 121623b3eb3cSopenharmony_ci Row.opacity(this.item.isEnabled ? 1 : ImageMenuItem.disabledImageOpacity); 121723b3eb3cSopenharmony_ci ViewStackProcessor.visualState('focused'); 121823b3eb3cSopenharmony_ci Row.border({ 121923b3eb3cSopenharmony_ci radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 122023b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 122123b3eb3cSopenharmony_ci width: ImageMenuItem.focusBorderWidth, 122223b3eb3cSopenharmony_ci color: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'], 122323b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 122423b3eb3cSopenharmony_ci style: BorderStyle.Solid 122523b3eb3cSopenharmony_ci }); 122623b3eb3cSopenharmony_ci ViewStackProcessor.visualState('normal'); 122723b3eb3cSopenharmony_ci Row.border({ 122823b3eb3cSopenharmony_ci radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 122923b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 123023b3eb3cSopenharmony_ci width: 0 123123b3eb3cSopenharmony_ci }); 123223b3eb3cSopenharmony_ci ViewStackProcessor.visualState(); 123323b3eb3cSopenharmony_ci Row.onFocus(() => { 123423b3eb3cSopenharmony_ci if (!this.item.isEnabled) { 123523b3eb3cSopenharmony_ci return; 123623b3eb3cSopenharmony_ci } 123723b3eb3cSopenharmony_ci this.isOnFocus = true; 123823b3eb3cSopenharmony_ci }); 123923b3eb3cSopenharmony_ci Row.onBlur(() => this.isOnFocus = false); 124023b3eb3cSopenharmony_ci Row.onHover((l1) => { 124123b3eb3cSopenharmony_ci if (!this.item.isEnabled) { 124223b3eb3cSopenharmony_ci return; 124323b3eb3cSopenharmony_ci } 124423b3eb3cSopenharmony_ci this.isOnHover = l1; 124523b3eb3cSopenharmony_ci }); 124623b3eb3cSopenharmony_ci Row.onKeyEvent((k1) => { 124723b3eb3cSopenharmony_ci if (!this.item.isEnabled) { 124823b3eb3cSopenharmony_ci return; 124923b3eb3cSopenharmony_ci } 125023b3eb3cSopenharmony_ci if (k1.keyCode !== KeyCode.KEYCODE_ENTER && k1.keyCode !== KeyCode.KEYCODE_SPACE) { 125123b3eb3cSopenharmony_ci return; 125223b3eb3cSopenharmony_ci } 125323b3eb3cSopenharmony_ci if (k1.type === KeyType.Down) { 125423b3eb3cSopenharmony_ci this.isOnClick = true; 125523b3eb3cSopenharmony_ci } 125623b3eb3cSopenharmony_ci if (k1.type === KeyType.Up) { 125723b3eb3cSopenharmony_ci this.isOnClick = false; 125823b3eb3cSopenharmony_ci } 125923b3eb3cSopenharmony_ci }); 126023b3eb3cSopenharmony_ci Row.onTouch((j1) => { 126123b3eb3cSopenharmony_ci if (!this.item.isEnabled) { 126223b3eb3cSopenharmony_ci return; 126323b3eb3cSopenharmony_ci } 126423b3eb3cSopenharmony_ci if (j1.type === TouchType.Down) { 126523b3eb3cSopenharmony_ci this.isOnClick = true; 126623b3eb3cSopenharmony_ci } 126723b3eb3cSopenharmony_ci if (j1.type === TouchType.Up || j1.type === TouchType.Cancel) { 126823b3eb3cSopenharmony_ci this.isOnClick = false; 126923b3eb3cSopenharmony_ci } 127023b3eb3cSopenharmony_ci }); 127123b3eb3cSopenharmony_ci Row.onClick(() => this.item.isEnabled && this.item.action && this.item.action()); 127223b3eb3cSopenharmony_ci }, Row); 127323b3eb3cSopenharmony_ci this.observeComponentCreation2((f1, g1) => { 127423b3eb3cSopenharmony_ci Image.create(this.item.value); 127523b3eb3cSopenharmony_ci Image.width(ImageMenuItem.imageSize); 127623b3eb3cSopenharmony_ci Image.height(ImageMenuItem.imageSize); 127723b3eb3cSopenharmony_ci Image.focusable(this.item.isEnabled); 127823b3eb3cSopenharmony_ci Image.key(ImageMenuItem.focusablePrefix + this.index); 127923b3eb3cSopenharmony_ci Image.draggable(false); 128023b3eb3cSopenharmony_ci }, Image); 128123b3eb3cSopenharmony_ci Row.pop(); 128223b3eb3cSopenharmony_ci } 128323b3eb3cSopenharmony_ci rerender() { 128423b3eb3cSopenharmony_ci this.updateDirtyElements(); 128523b3eb3cSopenharmony_ci } 128623b3eb3cSopenharmony_ci} 128723b3eb3cSopenharmony_ciImageMenuItem.imageSize = 24; 128823b3eb3cSopenharmony_ciImageMenuItem.imageHotZoneWidth = 48; 128923b3eb3cSopenharmony_ciImageMenuItem.buttonBorderRadius = 8; 129023b3eb3cSopenharmony_ciImageMenuItem.focusBorderWidth = 2; 129123b3eb3cSopenharmony_ciImageMenuItem.disabledImageOpacity = 0.4; 129223b3eb3cSopenharmony_ciImageMenuItem.focusablePrefix = 'Id-TabTitleBar-ImageMenuItem-'; 129323b3eb3cSopenharmony_ciclass TabTitleBarDialog extends ViewPU { 129423b3eb3cSopenharmony_ci constructor(z, a1, b1, c1 = -1, d1 = undefined, e1) { 129523b3eb3cSopenharmony_ci super(z, b1, c1, e1); 129623b3eb3cSopenharmony_ci if (typeof d1 === 'function') { 129723b3eb3cSopenharmony_ci this.paramsGenerator_ = d1; 129823b3eb3cSopenharmony_ci } 129923b3eb3cSopenharmony_ci this.tabTitleDialog = { value: '' }; 130023b3eb3cSopenharmony_ci this.callbackId = undefined; 130123b3eb3cSopenharmony_ci this.tabTitleBarDialog = ''; 130223b3eb3cSopenharmony_ci this.mainWindowStage = undefined; 130323b3eb3cSopenharmony_ci this.controller = undefined; 130423b3eb3cSopenharmony_ci this.minFontSize = 1.75; 130523b3eb3cSopenharmony_ci this.maxFontSize = 3.2; 130623b3eb3cSopenharmony_ci this.screenWidth = 640; 130723b3eb3cSopenharmony_ci this.verticalScreenLines = 6; 130823b3eb3cSopenharmony_ci this.horizontalsScreenLines = 1; 130923b3eb3cSopenharmony_ci this.__mainWindow = this.createStorageLink('mainWindow', undefined, 'mainWindow'); 131023b3eb3cSopenharmony_ci this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize'); 131123b3eb3cSopenharmony_ci this.__maxLines = new ObservedPropertySimplePU(1, this, 'maxLines'); 131223b3eb3cSopenharmony_ci this.__windowStandardHeight = this.createStorageProp('windowStandardHeight', 0, 'windowStandardHeight'); 131323b3eb3cSopenharmony_ci this.cancel = () => { 131423b3eb3cSopenharmony_ci }; 131523b3eb3cSopenharmony_ci this.confirm = () => { 131623b3eb3cSopenharmony_ci }; 131723b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(a1); 131823b3eb3cSopenharmony_ci this.finalizeConstruction(); 131923b3eb3cSopenharmony_ci } 132023b3eb3cSopenharmony_ci setInitiallyProvidedValue(y) { 132123b3eb3cSopenharmony_ci if (y.tabTitleDialog !== undefined) { 132223b3eb3cSopenharmony_ci this.tabTitleDialog = y.tabTitleDialog; 132323b3eb3cSopenharmony_ci } 132423b3eb3cSopenharmony_ci if (y.callbackId !== undefined) { 132523b3eb3cSopenharmony_ci this.callbackId = y.callbackId; 132623b3eb3cSopenharmony_ci } 132723b3eb3cSopenharmony_ci if (y.tabTitleBarDialog !== undefined) { 132823b3eb3cSopenharmony_ci this.tabTitleBarDialog = y.tabTitleBarDialog; 132923b3eb3cSopenharmony_ci } 133023b3eb3cSopenharmony_ci if (y.mainWindowStage !== undefined) { 133123b3eb3cSopenharmony_ci this.mainWindowStage = y.mainWindowStage; 133223b3eb3cSopenharmony_ci } 133323b3eb3cSopenharmony_ci if (y.controller !== undefined) { 133423b3eb3cSopenharmony_ci this.controller = y.controller; 133523b3eb3cSopenharmony_ci } 133623b3eb3cSopenharmony_ci if (y.minFontSize !== undefined) { 133723b3eb3cSopenharmony_ci this.minFontSize = y.minFontSize; 133823b3eb3cSopenharmony_ci } 133923b3eb3cSopenharmony_ci if (y.maxFontSize !== undefined) { 134023b3eb3cSopenharmony_ci this.maxFontSize = y.maxFontSize; 134123b3eb3cSopenharmony_ci } 134223b3eb3cSopenharmony_ci if (y.screenWidth !== undefined) { 134323b3eb3cSopenharmony_ci this.screenWidth = y.screenWidth; 134423b3eb3cSopenharmony_ci } 134523b3eb3cSopenharmony_ci if (y.verticalScreenLines !== undefined) { 134623b3eb3cSopenharmony_ci this.verticalScreenLines = y.verticalScreenLines; 134723b3eb3cSopenharmony_ci } 134823b3eb3cSopenharmony_ci if (y.horizontalsScreenLines !== undefined) { 134923b3eb3cSopenharmony_ci this.horizontalsScreenLines = y.horizontalsScreenLines; 135023b3eb3cSopenharmony_ci } 135123b3eb3cSopenharmony_ci if (y.fontSize !== undefined) { 135223b3eb3cSopenharmony_ci this.fontSize = y.fontSize; 135323b3eb3cSopenharmony_ci } 135423b3eb3cSopenharmony_ci if (y.maxLines !== undefined) { 135523b3eb3cSopenharmony_ci this.maxLines = y.maxLines; 135623b3eb3cSopenharmony_ci } 135723b3eb3cSopenharmony_ci if (y.cancel !== undefined) { 135823b3eb3cSopenharmony_ci this.cancel = y.cancel; 135923b3eb3cSopenharmony_ci } 136023b3eb3cSopenharmony_ci if (y.confirm !== undefined) { 136123b3eb3cSopenharmony_ci this.confirm = y.confirm; 136223b3eb3cSopenharmony_ci } 136323b3eb3cSopenharmony_ci } 136423b3eb3cSopenharmony_ci updateStateVars(x) { 136523b3eb3cSopenharmony_ci } 136623b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(w) { 136723b3eb3cSopenharmony_ci this.__mainWindow.purgeDependencyOnElmtId(w); 136823b3eb3cSopenharmony_ci this.__fontSize.purgeDependencyOnElmtId(w); 136923b3eb3cSopenharmony_ci this.__maxLines.purgeDependencyOnElmtId(w); 137023b3eb3cSopenharmony_ci this.__windowStandardHeight.purgeDependencyOnElmtId(w); 137123b3eb3cSopenharmony_ci } 137223b3eb3cSopenharmony_ci aboutToBeDeleted() { 137323b3eb3cSopenharmony_ci this.__mainWindow.aboutToBeDeleted(); 137423b3eb3cSopenharmony_ci this.__fontSize.aboutToBeDeleted(); 137523b3eb3cSopenharmony_ci this.__maxLines.aboutToBeDeleted(); 137623b3eb3cSopenharmony_ci this.__windowStandardHeight.aboutToBeDeleted(); 137723b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 137823b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 137923b3eb3cSopenharmony_ci } 138023b3eb3cSopenharmony_ci setController(v) { 138123b3eb3cSopenharmony_ci this.controller = v; 138223b3eb3cSopenharmony_ci } 138323b3eb3cSopenharmony_ci get mainWindow() { 138423b3eb3cSopenharmony_ci return this.__mainWindow.get(); 138523b3eb3cSopenharmony_ci } 138623b3eb3cSopenharmony_ci set mainWindow(u) { 138723b3eb3cSopenharmony_ci this.__mainWindow.set(u); 138823b3eb3cSopenharmony_ci } 138923b3eb3cSopenharmony_ci get fontSize() { 139023b3eb3cSopenharmony_ci return this.__fontSize.get(); 139123b3eb3cSopenharmony_ci } 139223b3eb3cSopenharmony_ci set fontSize(t) { 139323b3eb3cSopenharmony_ci this.__fontSize.set(t); 139423b3eb3cSopenharmony_ci } 139523b3eb3cSopenharmony_ci get maxLines() { 139623b3eb3cSopenharmony_ci return this.__maxLines.get(); 139723b3eb3cSopenharmony_ci } 139823b3eb3cSopenharmony_ci set maxLines(s) { 139923b3eb3cSopenharmony_ci this.__maxLines.set(s); 140023b3eb3cSopenharmony_ci } 140123b3eb3cSopenharmony_ci get windowStandardHeight() { 140223b3eb3cSopenharmony_ci return this.__windowStandardHeight.get(); 140323b3eb3cSopenharmony_ci } 140423b3eb3cSopenharmony_ci set windowStandardHeight(r) { 140523b3eb3cSopenharmony_ci this.__windowStandardHeight.set(r); 140623b3eb3cSopenharmony_ci } 140723b3eb3cSopenharmony_ci initialRender() { 140823b3eb3cSopenharmony_ci this.observeComponentCreation2((d, e) => { 140923b3eb3cSopenharmony_ci If.create(); 141023b3eb3cSopenharmony_ci if (this.tabTitleBarDialog) { 141123b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 141223b3eb3cSopenharmony_ci this.observeComponentCreation2((p, q) => { 141323b3eb3cSopenharmony_ci Column.create(); 141423b3eb3cSopenharmony_ci Column.width(this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG); 141523b3eb3cSopenharmony_ci Column.constraintSize({ minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG }); 141623b3eb3cSopenharmony_ci Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK); 141723b3eb3cSopenharmony_ci Column.shadow(ShadowStyle.OUTER_DEFAULT_LG); 141823b3eb3cSopenharmony_ci Column.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.corner_radius_level10'], 141923b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 142023b3eb3cSopenharmony_ci }, Column); 142123b3eb3cSopenharmony_ci this.observeComponentCreation2((n, o) => { 142223b3eb3cSopenharmony_ci Image.create(this.tabTitleDialog.value); 142323b3eb3cSopenharmony_ci Image.width(IMAGE_SIZE); 142423b3eb3cSopenharmony_ci Image.height(IMAGE_SIZE); 142523b3eb3cSopenharmony_ci Image.margin({ 142623b3eb3cSopenharmony_ci top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level24'], 142723b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 142823b3eb3cSopenharmony_ci bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 142923b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 143023b3eb3cSopenharmony_ci }); 143123b3eb3cSopenharmony_ci Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 143223b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 143323b3eb3cSopenharmony_ci }, Image); 143423b3eb3cSopenharmony_ci this.observeComponentCreation2((l, m) => { 143523b3eb3cSopenharmony_ci Column.create(); 143623b3eb3cSopenharmony_ci Column.width('100%'); 143723b3eb3cSopenharmony_ci Column.padding({ 143823b3eb3cSopenharmony_ci left: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level4'], 143923b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 144023b3eb3cSopenharmony_ci right: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level4'], 144123b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 144223b3eb3cSopenharmony_ci bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level12'], 144323b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 144423b3eb3cSopenharmony_ci }); 144523b3eb3cSopenharmony_ci }, Column); 144623b3eb3cSopenharmony_ci this.observeComponentCreation2((j, k) => { 144723b3eb3cSopenharmony_ci Text.create(this.tabTitleBarDialog); 144823b3eb3cSopenharmony_ci Text.fontSize(TEXT_EDITABLE_DIALOG); 144923b3eb3cSopenharmony_ci Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 145023b3eb3cSopenharmony_ci Text.maxLines(this.maxLines); 145123b3eb3cSopenharmony_ci Text.width('100%'); 145223b3eb3cSopenharmony_ci Text.textAlign(TextAlign.Center); 145323b3eb3cSopenharmony_ci Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 145423b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 145523b3eb3cSopenharmony_ci }, Text); 145623b3eb3cSopenharmony_ci Text.pop(); 145723b3eb3cSopenharmony_ci Column.pop(); 145823b3eb3cSopenharmony_ci Column.pop(); 145923b3eb3cSopenharmony_ci }); 146023b3eb3cSopenharmony_ci } 146123b3eb3cSopenharmony_ci else { 146223b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 146323b3eb3cSopenharmony_ci this.observeComponentCreation2((h, i) => { 146423b3eb3cSopenharmony_ci Column.create(); 146523b3eb3cSopenharmony_ci Column.width(this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG); 146623b3eb3cSopenharmony_ci Column.constraintSize({ minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG }); 146723b3eb3cSopenharmony_ci Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK); 146823b3eb3cSopenharmony_ci Column.shadow(ShadowStyle.OUTER_DEFAULT_LG); 146923b3eb3cSopenharmony_ci Column.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.corner_radius_level10'], 147023b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 147123b3eb3cSopenharmony_ci Column.justifyContent(FlexAlign.Center); 147223b3eb3cSopenharmony_ci }, Column); 147323b3eb3cSopenharmony_ci this.observeComponentCreation2((f, g) => { 147423b3eb3cSopenharmony_ci Image.create(this.tabTitleDialog.value); 147523b3eb3cSopenharmony_ci Image.width(IMAGE_SIZE); 147623b3eb3cSopenharmony_ci Image.height(IMAGE_SIZE); 147723b3eb3cSopenharmony_ci Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 147823b3eb3cSopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 147923b3eb3cSopenharmony_ci }, Image); 148023b3eb3cSopenharmony_ci Column.pop(); 148123b3eb3cSopenharmony_ci }); 148223b3eb3cSopenharmony_ci } 148323b3eb3cSopenharmony_ci }, If); 148423b3eb3cSopenharmony_ci If.pop(); 148523b3eb3cSopenharmony_ci } 148623b3eb3cSopenharmony_ci async aboutToAppear() { 148723b3eb3cSopenharmony_ci let a = this.getUIContext().getHostContext(); 148823b3eb3cSopenharmony_ci this.mainWindowStage = a.windowStage.getMainWindowSync(); 148923b3eb3cSopenharmony_ci let b = this.mainWindowStage.getWindowProperties(); 149023b3eb3cSopenharmony_ci let c = b.windowRect; 149123b3eb3cSopenharmony_ci if (px2vp(c.height) > this.screenWidth) { 149223b3eb3cSopenharmony_ci this.maxLines = this.verticalScreenLines; 149323b3eb3cSopenharmony_ci } else { 149423b3eb3cSopenharmony_ci this.maxLines = this.horizontalsScreenLines; 149523b3eb3cSopenharmony_ci } 149623b3eb3cSopenharmony_ci } 149723b3eb3cSopenharmony_ci rerender() { 149823b3eb3cSopenharmony_ci this.updateDirtyElements(); 149923b3eb3cSopenharmony_ci } 150023b3eb3cSopenharmony_ci} 150123b3eb3cSopenharmony_ciexport default { 150223b3eb3cSopenharmony_ci TabTitleBar: TabTitleBar 150323b3eb3cSopenharmony_ci};