1/* 2 * Copyright (c) 2023-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16if (!('finalizeConstruction' in ViewPU.prototype)) { 17 Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => { }); 18} 19const KeyCode = requireNapi('multimodalInput.keyCode').KeyCode; 20const MeasureText = requireNapi('measure'); 21const hilog = requireNapi('hilog'); 22const SymbolGlyphModifier = requireNapi('arkui.modifier').SymbolGlyphModifier; 23const PUBLIC_MORE = { 'id': -1, 'type': 40000, params: ['sys.symbol.dot_grid_2x2'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 24const TEXT_EDITABLE_DIALOG = '18.3fp'; 25const IMAGE_SIZE = '64vp'; 26const MAX_DIALOG = '256vp'; 27const MIN_DIALOG = '216vp'; 28const RESOURCE_TYPE_SYMBOL = 40000; 29class ButtonGestureModifier { 30 constructor(y47) { 31 this.fontSize = 1; 32 this.controller = null; 33 this.controller = y47; 34 } 35 applyGesture(x47) { 36 if (this.fontSize >= ButtonGestureModifier.minFontSize) { 37 x47.addGesture(new LongPressGestureHandler({ repeat: false, duration: ButtonGestureModifier.longPressTime }) 38 .onAction(() => { 39 if (x47) { 40 this.controller?.open(); 41 } 42 }) 43 .onActionEnd(() => { 44 this.controller?.close(); 45 })); 46 } 47 else { 48 x47.clearGestures(); 49 } 50 } 51} 52ButtonGestureModifier.longPressTime = 500; 53ButtonGestureModifier.minFontSize = 1.75; 54export class TabTitleBar extends ViewPU { 55 constructor(r47, s47, t47, u47 = -1, v47 = undefined, w47) { 56 super(r47, t47, u47, w47); 57 if (typeof v47 === 'function') { 58 this.paramsGenerator_ = v47; 59 } 60 this.tabItems = []; 61 this.menuItems = []; 62 this.swiperContent = undefined; 63 this.__tabWidth = new ObservedPropertySimplePU(0, this, 'tabWidth'); 64 this.__currentIndex = new ObservedPropertySimplePU(0, this, 'currentIndex'); 65 this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize'); 66 this.menuSectionWidth = 0; 67 this.tabOffsets = []; 68 this.imageWidths = []; 69 this.scroller = new Scroller(); 70 this.swiperController = new SwiperController(); 71 this.settings = new RenderingContextSettings(true); 72 this.leftContext2D = new CanvasRenderingContext2D(this.settings); 73 this.rightContext2D = new CanvasRenderingContext2D(this.settings); 74 this.setInitiallyProvidedValue(s47); 75 this.finalizeConstruction(); 76 } 77 setInitiallyProvidedValue(q47) { 78 if (q47.tabItems !== undefined) { 79 this.tabItems = q47.tabItems; 80 } 81 if (q47.menuItems !== undefined) { 82 this.menuItems = q47.menuItems; 83 } 84 if (q47.swiperContent !== undefined) { 85 this.swiperContent = q47.swiperContent; 86 } 87 if (q47.tabWidth !== undefined) { 88 this.tabWidth = q47.tabWidth; 89 } 90 if (q47.currentIndex !== undefined) { 91 this.currentIndex = q47.currentIndex; 92 } 93 if (q47.fontSize !== undefined) { 94 this.fontSize = q47.fontSize; 95 } 96 if (q47.menuSectionWidth !== undefined) { 97 this.menuSectionWidth = q47.menuSectionWidth; 98 } 99 if (q47.tabOffsets !== undefined) { 100 this.tabOffsets = q47.tabOffsets; 101 } 102 if (q47.imageWidths !== undefined) { 103 this.imageWidths = q47.imageWidths; 104 } 105 if (q47.scroller !== undefined) { 106 this.scroller = q47.scroller; 107 } 108 if (q47.swiperController !== undefined) { 109 this.swiperController = q47.swiperController; 110 } 111 if (q47.settings !== undefined) { 112 this.settings = q47.settings; 113 } 114 if (q47.leftContext2D !== undefined) { 115 this.leftContext2D = q47.leftContext2D; 116 } 117 if (q47.rightContext2D !== undefined) { 118 this.rightContext2D = q47.rightContext2D; 119 } 120 } 121 updateStateVars(p47) { 122 } 123 purgeVariableDependenciesOnElmtId(o47) { 124 this.__tabWidth.purgeDependencyOnElmtId(o47); 125 this.__currentIndex.purgeDependencyOnElmtId(o47); 126 this.__fontSize.purgeDependencyOnElmtId(o47); 127 } 128 aboutToBeDeleted() { 129 this.__tabWidth.aboutToBeDeleted(); 130 this.__currentIndex.aboutToBeDeleted(); 131 this.__fontSize.aboutToBeDeleted(); 132 SubscriberManager.Get().delete(this.id__()); 133 this.aboutToBeDeletedInternal(); 134 } 135 get tabWidth() { 136 return this.__tabWidth.get(); 137 } 138 set tabWidth(n47) { 139 this.__tabWidth.set(n47); 140 } 141 get currentIndex() { 142 return this.__currentIndex.get(); 143 } 144 set currentIndex(m47) { 145 this.__currentIndex.set(m47); 146 } 147 get fontSize() { 148 return this.__fontSize.get(); 149 } 150 set fontSize(l47) { 151 this.__fontSize.set(l47); 152 } 153 GradientMask(a47, b47, c47, d47, e47, f47 = null) { 154 this.observeComponentCreation2((j47, k47) => { 155 Column.create(); 156 Column.blendMode(BlendMode.DST_OUT); 157 Column.width(TabTitleBar.gradientMaskWidth); 158 Column.height(TabTitleBar.totalHeight); 159 }, Column); 160 this.observeComponentCreation2((g47, h47) => { 161 Canvas.create(a47); 162 Canvas.width(TabTitleBar.gradientMaskWidth); 163 Canvas.height(TabTitleBar.totalHeight); 164 Canvas.onReady(() => { 165 let i47 = a47.createLinearGradient(b47, c47, d47, e47); 166 i47.addColorStop(0.0, '#ffffffff'); 167 i47.addColorStop(1, '#00ffffff'); 168 a47.fillStyle = i47; 169 a47.fillRect(0, 0, TabTitleBar.gradientMaskWidth, TabTitleBar.totalHeight); 170 }); 171 }, Canvas); 172 Canvas.pop(); 173 Column.pop(); 174 } 175 emptyBuilder(z46 = null) { 176 } 177 aboutToAppear() { 178 if (!this.swiperContent) { 179 this.swiperContent = this.emptyBuilder; 180 } 181 this.tabItems.forEach((y46) => { 182 this.imageWidths.push(0); 183 }); 184 this.loadOffsets(); 185 } 186 loadOffsets() { 187 this.tabOffsets.length = 0; 188 let v46 = 0; 189 this.tabOffsets.push(v46); 190 v46 += TabContentItem.marginFirst; 191 this.tabItems.forEach((w46, x46) => { 192 if (w46.icon !== undefined || w46.symbolStyle !== undefined) { 193 if (Math.abs(this.imageWidths[x46]) > TabContentItem.imageHotZoneWidth) { 194 v46 += this.imageWidths[x46]; 195 } 196 else { 197 v46 += TabContentItem.imageHotZoneWidth; 198 } 199 } 200 else { 201 v46 += TabContentItem.paddingLeft; 202 v46 += px2vp(MeasureText.measureText({ 203 textContent: w46.title.toString(), 204 fontSize: 18, 205 fontWeight: FontWeight.Medium, 206 })); 207 v46 += TabContentItem.paddingRight; 208 } 209 this.tabOffsets.push(v46); 210 }); 211 } 212 initialRender() { 213 this.observeComponentCreation2((t46, u46) => { 214 Column.create(); 215 }, Column); 216 this.observeComponentCreation2((p46, q46) => { 217 Flex.create({ 218 justifyContent: FlexAlign.SpaceBetween, 219 alignItems: ItemAlign.Stretch 220 }); 221 Flex.backgroundColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_background'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 222 Flex.margin({ right: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_max_padding_end'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } }); 223 Flex.onAreaChange((r46, s46) => { 224 this.tabWidth = Number(s46.width) - this.menuSectionWidth; 225 }); 226 }, Flex); 227 this.observeComponentCreation2((n46, o46) => { 228 Stack.create({ alignContent: Alignment.End }); 229 Stack.blendMode(BlendMode.SRC_OVER, BlendApplyType.OFFSCREEN); 230 }, Stack); 231 this.observeComponentCreation2((l46, m46) => { 232 Stack.create({ alignContent: Alignment.Start }); 233 }, Stack); 234 this.observeComponentCreation2((j46, k46) => { 235 Column.create(); 236 }, Column); 237 this.observeComponentCreation2((h46, i46) => { 238 List.create({ initialIndex: 0, scroller: this.scroller, space: 0 }); 239 List.width('100%'); 240 List.height(TabTitleBar.totalHeight); 241 List.constraintSize({ maxWidth: this.tabWidth }); 242 List.edgeEffect(EdgeEffect.Spring); 243 List.listDirection(Axis.Horizontal); 244 List.scrollBar(BarState.Off); 245 }, List); 246 this.observeComponentCreation2((k45, l45) => { 247 ForEach.create(); 248 const a18 = (n45, o45) => { 249 const p45 = n45; 250 { 251 const b18 = (f46, g46) => { 252 ViewStackProcessor.StartGetAccessRecordingFor(f46); 253 c18(f46, g46); 254 if (!g46) { 255 ListItem.pop(); 256 } 257 ViewStackProcessor.StopGetAccessRecording(); 258 }; 259 const c18 = (d46, e46) => { 260 ListItem.create(d18, true); 261 }; 262 const d18 = (t45, u45) => { 263 b18(t45, u45); 264 { 265 this.observeComponentCreation2((v45, w45) => { 266 if (w45) { 267 let x45 = new TabContentItem(this, { 268 item: p45, 269 index: o45, 270 maxIndex: this.tabItems.length - 1, 271 currentIndex: this.currentIndex, 272 onCustomClick: (c46) => this.currentIndex = c46, 273 onImageComplete: (b46) => { 274 this.imageWidths[o45] = b46; 275 this.loadOffsets(); 276 } 277 }, undefined, v45, () => { }, { page: 'library/src/main/ets/components/tabtitlebar.ets', line: 174, col: 21 }); 278 ViewPU.create(x45); 279 let e18 = () => { 280 return { 281 item: p45, 282 index: o45, 283 maxIndex: this.tabItems.length - 1, 284 currentIndex: this.currentIndex, 285 onCustomClick: (a46) => this.currentIndex = a46, 286 onImageComplete: (z45) => { 287 this.imageWidths[o45] = z45; 288 this.loadOffsets(); 289 } 290 }; 291 }; 292 x45.paramsGenerator_ = e18; 293 } 294 else { 295 this.updateStateVarsOfChildByElmtId(v45, { 296 currentIndex: this.currentIndex 297 }); 298 } 299 }, { name: 'TabContentItem' }); 300 } 301 ListItem.pop(); 302 }; 303 this.observeComponentCreation2(c18, ListItem); 304 ListItem.pop(); 305 } 306 }; 307 this.forEachUpdateFunction(k45, this.tabItems, a18, undefined, true, false); 308 }, ForEach); 309 ForEach.pop(); 310 List.pop(); 311 Column.pop(); 312 this.GradientMask.bind(this)(this.leftContext2D, 0, TabTitleBar.totalHeight / 2, TabTitleBar.gradientMaskWidth, TabTitleBar.totalHeight / 2); 313 Stack.pop(); 314 this.GradientMask.bind(this)(this.rightContext2D, TabTitleBar.gradientMaskWidth, TabTitleBar.totalHeight / 2, 0, TabTitleBar.totalHeight / 2); 315 Stack.pop(); 316 this.observeComponentCreation2((a45, b45) => { 317 If.create(); 318 if (this.menuItems !== undefined && this.menuItems.length > 0) { 319 this.ifElseBranchUpdateFunction(0, () => { 320 this.observeComponentCreation2((g45, h45) => { 321 __Common__.create(); 322 __Common__.height(TabTitleBar.totalHeight); 323 __Common__.onAreaChange((i45, j45) => { 324 this.menuSectionWidth = Number(j45.width); 325 }); 326 }, __Common__); 327 { 328 this.observeComponentCreation2((c45, d45) => { 329 if (d45) { 330 let e45 = new CollapsibleMenuSection(this, { menuItems: this.menuItems, index: 1 + TabTitleBar.instanceCount++ }, undefined, c45, () => { }, { page: 'library/src/main/ets/components/tabtitlebar.ets', line: 204, col: 11 }); 331 ViewPU.create(e45); 332 let z17 = () => { 333 return { 334 menuItems: this.menuItems, 335 index: 1 + TabTitleBar.instanceCount++ 336 }; 337 }; 338 e45.paramsGenerator_ = z17; 339 } 340 else { 341 this.updateStateVarsOfChildByElmtId(c45, {}); 342 } 343 }, { name: 'CollapsibleMenuSection' }); 344 } 345 __Common__.pop(); 346 }); 347 } 348 else { 349 this.ifElseBranchUpdateFunction(1, () => { 350 }); 351 } 352 }, If); 353 If.pop(); 354 Flex.pop(); 355 this.observeComponentCreation2((y44, z44) => { 356 Column.create(); 357 }, Column); 358 this.observeComponentCreation2((u44, v44) => { 359 Swiper.create(this.swiperController); 360 Swiper.index(this.currentIndex); 361 Swiper.itemSpace(0); 362 Swiper.indicator(false); 363 Swiper.width('100%'); 364 Swiper.height('100%'); 365 Swiper.curve(Curve.Friction); 366 Swiper.onChange((w44) => { 367 const x44 = this.tabOffsets[w44] + TabTitleBar.correctionOffset; 368 this.currentIndex = w44; 369 this.scroller.scrollTo({ 370 xOffset: x44 > 0 ? x44 : 0, 371 yOffset: 0, 372 animation: { 373 duration: 300, 374 curve: Curve.EaseInOut 375 } 376 }); 377 }); 378 Swiper.onAppear(() => { 379 this.scroller.scrollToIndex(this.currentIndex); 380 this.scroller.scrollBy(TabTitleBar.correctionOffset, 0); 381 }); 382 }, Swiper); 383 this.swiperContent.bind(this)(); 384 Swiper.pop(); 385 Column.pop(); 386 Column.pop(); 387 } 388 rerender() { 389 this.updateDirtyElements(); 390 } 391} 392TabTitleBar.totalHeight = 56; 393TabTitleBar.correctionOffset = -40.0; 394TabTitleBar.gradientMaskWidth = 24; 395TabTitleBar.instanceCount = 0; 396class CollapsibleMenuSection extends ViewPU { 397 constructor(m44, n44, o44, p44 = -1, q44 = undefined, r44) { 398 super(m44, o44, p44, r44); 399 if (typeof q44 === 'function') { 400 this.paramsGenerator_ = q44; 401 } 402 this.menuItems = []; 403 this.index = 0; 404 this.item = { 405 value: PUBLIC_MORE, 406 symbolStyle: new SymbolGlyphModifier(PUBLIC_MORE), 407 label: { 'id': -1, 'type': 10003, params: ['sys.string.ohos_toolbar_more'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 408 }; 409 this.minFontSize = 1.75; 410 this.isFollowingSystemFontScale = false; 411 this.maxFontScale = 1; 412 this.systemFontScale = 1; 413 this.firstFocusableIndex = -1; 414 this.__isPopupShown = new ObservedPropertySimplePU(false, this, 'isPopupShown'); 415 this.__isMoreIconOnFocus = new ObservedPropertySimplePU(false, this, 'isMoreIconOnFocus'); 416 this.__isMoreIconOnHover = new ObservedPropertySimplePU(false, this, 'isMoreIconOnHover'); 417 this.__isMoreIconOnClick = new ObservedPropertySimplePU(false, this, 'isMoreIconOnClick'); 418 this.__fontSize = new SynchedPropertySimpleOneWayPU(n44.fontSize, this, 'fontSize'); 419 this.dialogController = new CustomDialogController({ 420 builder: () => { 421 let s44 = new TabTitleBarDialog(this, { 422 cancel: () => { 423 }, 424 confirm: () => { 425 }, 426 tabTitleDialog: this.item, 427 tabTitleBarDialog: this.item.label ? this.item.label : '', 428 fontSize: this.fontSize, 429 }, undefined, -1, () => { }, { page: 'library/src/main/ets/components/tabtitlebar.ets', line: 273, col: 14 }); 430 s44.setController(this.dialogController); 431 ViewPU.create(s44); 432 let y17 = () => { 433 return { 434 cancel: () => { 435 }, 436 confirm: () => { 437 }, 438 tabTitleDialog: this.item, 439 tabTitleBarDialog: this.item.label ? this.item.label : '', 440 fontSize: this.fontSize 441 }; 442 }; 443 s44.paramsGenerator_ = y17; 444 }, 445 maskColor: Color.Transparent, 446 isModal: true, 447 customStyle: true 448 }, this); 449 this.__buttonGestureModifier = new ObservedPropertyObjectPU(new ButtonGestureModifier(this.dialogController), this, 'buttonGestureModifier'); 450 this.setInitiallyProvidedValue(n44); 451 this.declareWatch('fontSize', this.onFontSizeUpdated); 452 this.finalizeConstruction(); 453 } 454 setInitiallyProvidedValue(l44) { 455 if (l44.menuItems !== undefined) { 456 this.menuItems = l44.menuItems; 457 } 458 if (l44.index !== undefined) { 459 this.index = l44.index; 460 } 461 if (l44.item !== undefined) { 462 this.item = l44.item; 463 } 464 if (l44.minFontSize !== undefined) { 465 this.minFontSize = l44.minFontSize; 466 } 467 if (l44.isFollowingSystemFontScale !== undefined) { 468 this.isFollowingSystemFontScale = l44.isFollowingSystemFontScale; 469 } 470 if (l44.maxFontScale !== undefined) { 471 this.maxFontScale = l44.maxFontScale; 472 } 473 if (l44.systemFontScale !== undefined) { 474 this.systemFontScale = l44.systemFontScale; 475 } 476 if (l44.firstFocusableIndex !== undefined) { 477 this.firstFocusableIndex = l44.firstFocusableIndex; 478 } 479 if (l44.isPopupShown !== undefined) { 480 this.isPopupShown = l44.isPopupShown; 481 } 482 if (l44.isMoreIconOnFocus !== undefined) { 483 this.isMoreIconOnFocus = l44.isMoreIconOnFocus; 484 } 485 if (l44.isMoreIconOnHover !== undefined) { 486 this.isMoreIconOnHover = l44.isMoreIconOnHover; 487 } 488 if (l44.isMoreIconOnClick !== undefined) { 489 this.isMoreIconOnClick = l44.isMoreIconOnClick; 490 } 491 if (l44.fontSize === undefined) { 492 this.__fontSize.set(1); 493 } 494 if (l44.dialogController !== undefined) { 495 this.dialogController = l44.dialogController; 496 } 497 if (l44.buttonGestureModifier !== undefined) { 498 this.buttonGestureModifier = l44.buttonGestureModifier; 499 } 500 } 501 updateStateVars(k44) { 502 this.__fontSize.reset(k44.fontSize); 503 } 504 purgeVariableDependenciesOnElmtId(j44) { 505 this.__isPopupShown.purgeDependencyOnElmtId(j44); 506 this.__isMoreIconOnFocus.purgeDependencyOnElmtId(j44); 507 this.__isMoreIconOnHover.purgeDependencyOnElmtId(j44); 508 this.__isMoreIconOnClick.purgeDependencyOnElmtId(j44); 509 this.__fontSize.purgeDependencyOnElmtId(j44); 510 this.__buttonGestureModifier.purgeDependencyOnElmtId(j44); 511 } 512 aboutToBeDeleted() { 513 this.__isPopupShown.aboutToBeDeleted(); 514 this.__isMoreIconOnFocus.aboutToBeDeleted(); 515 this.__isMoreIconOnHover.aboutToBeDeleted(); 516 this.__isMoreIconOnClick.aboutToBeDeleted(); 517 this.__fontSize.aboutToBeDeleted(); 518 this.__buttonGestureModifier.aboutToBeDeleted(); 519 SubscriberManager.Get().delete(this.id__()); 520 this.aboutToBeDeletedInternal(); 521 } 522 get isPopupShown() { 523 return this.__isPopupShown.get(); 524 } 525 set isPopupShown(i44) { 526 this.__isPopupShown.set(i44); 527 } 528 get isMoreIconOnFocus() { 529 return this.__isMoreIconOnFocus.get(); 530 } 531 set isMoreIconOnFocus(h44) { 532 this.__isMoreIconOnFocus.set(h44); 533 } 534 get isMoreIconOnHover() { 535 return this.__isMoreIconOnHover.get(); 536 } 537 set isMoreIconOnHover(g44) { 538 this.__isMoreIconOnHover.set(g44); 539 } 540 get isMoreIconOnClick() { 541 return this.__isMoreIconOnClick.get(); 542 } 543 set isMoreIconOnClick(f44) { 544 this.__isMoreIconOnClick.set(f44); 545 } 546 get fontSize() { 547 return this.__fontSize.get(); 548 } 549 set fontSize(e44) { 550 this.__fontSize.set(e44); 551 } 552 get buttonGestureModifier() { 553 return this.__buttonGestureModifier.get(); 554 } 555 set buttonGestureModifier(d44) { 556 this.__buttonGestureModifier.set(d44); 557 } 558 getMoreIconFgColor() { 559 return this.isMoreIconOnClick 560 ? { '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__' }; 561 } 562 getMoreIconBgColor() { 563 if (this.isMoreIconOnClick) { 564 return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_click_effect'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 565 } 566 else if (this.isMoreIconOnHover) { 567 return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_hover'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 568 } 569 else { 570 return Color.Transparent; 571 } 572 } 573 aboutToAppear() { 574 try { 575 let c44 = this.getUIContext(); 576 this.isFollowingSystemFontScale = c44.isFollowingSystemFontScale(); 577 this.maxFontScale = c44.getMaxFontScale(); 578 } 579 catch (z43) { 580 let a44 = z43.code; 581 let b44 = z43.message; 582 hilog.error(0x3900, 'Ace', `Faild to decideFontScale,cause, code: ${a44}, message: ${b44}`); 583 } 584 this.menuItems.forEach((x43, y43) => { 585 if (x43.isEnabled && this.firstFocusableIndex === -1 && 586 y43 > CollapsibleMenuSection.maxCountOfVisibleItems - 2) { 587 this.firstFocusableIndex = this.index * 1000 + y43 + 1; 588 } 589 }); 590 this.fontSize = this.decideFontScale(); 591 } 592 decideFontScale() { 593 let w43 = this.getUIContext(); 594 this.systemFontScale = w43.getHostContext()?.config?.fontSizeScale ?? 1; 595 if (!this.isFollowingSystemFontScale) { 596 return 1; 597 } 598 return Math.min(this.systemFontScale, this.maxFontScale); 599 } 600 onFontSizeUpdated() { 601 this.buttonGestureModifier.fontSize = this.fontSize; 602 } 603 initialRender() { 604 this.observeComponentCreation2((u43, v43) => { 605 Column.create(); 606 Column.height('100%'); 607 Column.justifyContent(FlexAlign.Center); 608 }, Column); 609 this.observeComponentCreation2((s43, t43) => { 610 Row.create(); 611 }, Row); 612 this.observeComponentCreation2((o42, p42) => { 613 If.create(); 614 if (this.menuItems.length <= CollapsibleMenuSection.maxCountOfVisibleItems) { 615 this.ifElseBranchUpdateFunction(0, () => { 616 this.observeComponentCreation2((i43, j43) => { 617 ForEach.create(); 618 const w17 = (l43, m43) => { 619 const n43 = l43; 620 { 621 this.observeComponentCreation2((o43, p43) => { 622 if (p43) { 623 let q43 = new ImageMenuItem(this, { item: n43, index: this.index * 1000 + m43 + 1 }, undefined, o43, () => { }, { page: 'library/src/main/ets/components/tabtitlebar.ets', line: 342, col: 13 }); 624 ViewPU.create(q43); 625 let x17 = () => { 626 return { 627 item: n43, 628 index: this.index * 1000 + m43 + 1 629 }; 630 }; 631 q43.paramsGenerator_ = x17; 632 } 633 else { 634 this.updateStateVarsOfChildByElmtId(o43, {}); 635 } 636 }, { name: 'ImageMenuItem' }); 637 } 638 }; 639 this.forEachUpdateFunction(i43, this.menuItems, w17, undefined, true, false); 640 }, ForEach); 641 ForEach.pop(); 642 }); 643 } 644 else { 645 this.ifElseBranchUpdateFunction(1, () => { 646 this.observeComponentCreation2((y42, z42) => { 647 ForEach.create(); 648 const u17 = (b43, c43) => { 649 const d43 = b43; 650 { 651 this.observeComponentCreation2((e43, f43) => { 652 if (f43) { 653 let g43 = new ImageMenuItem(this, { item: d43, index: this.index * 1000 + c43 + 1 }, undefined, e43, () => { }, { page: 'library/src/main/ets/components/tabtitlebar.ets', line: 347, col: 15 }); 654 ViewPU.create(g43); 655 let v17 = () => { 656 return { 657 item: d43, 658 index: this.index * 1000 + c43 + 1 659 }; 660 }; 661 g43.paramsGenerator_ = v17; 662 } 663 else { 664 this.updateStateVarsOfChildByElmtId(e43, {}); 665 } 666 }, { name: 'ImageMenuItem' }); 667 } 668 }; 669 this.forEachUpdateFunction(y42, this.menuItems.slice(0, CollapsibleMenuSection.maxCountOfVisibleItems - 1), u17, undefined, true, false); 670 }, ForEach); 671 ForEach.pop(); 672 this.observeComponentCreation2((s42, t42) => { 673 Button.createWithChild({ type: ButtonType.Normal, stateEffect: true }); 674 Button.accessibilityText({ 'id': -1, 'type': 10003, params: ['sys.string.ohos_toolbar_more'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 675 Button.width(ImageMenuItem.imageHotZoneWidth); 676 Button.height(ImageMenuItem.imageHotZoneWidth); 677 Button.borderRadius(ImageMenuItem.buttonBorderRadius); 678 Button.foregroundColor(this.getMoreIconFgColor()); 679 Button.backgroundColor(this.getMoreIconBgColor()); 680 ViewStackProcessor.visualState('focused'); 681 Button.border({ 682 radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 683 width: ImageMenuItem.focusBorderWidth, 684 color: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 685 style: BorderStyle.Solid 686 }); 687 ViewStackProcessor.visualState('normal'); 688 Button.border({ 689 radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 690 width: 0 691 }); 692 ViewStackProcessor.visualState(); 693 Button.onFocus(() => this.isMoreIconOnFocus = true); 694 Button.onBlur(() => this.isMoreIconOnFocus = false); 695 Button.onHover((x42) => this.isMoreIconOnHover = x42); 696 Button.onKeyEvent((w42) => { 697 if (w42.keyCode !== KeyCode.KEYCODE_ENTER && w42.keyCode !== KeyCode.KEYCODE_SPACE) { 698 return; 699 } 700 if (w42.type === KeyType.Down) { 701 this.isMoreIconOnClick = true; 702 } 703 if (w42.type === KeyType.Up) { 704 this.isMoreIconOnClick = false; 705 } 706 }); 707 Button.onTouch((v42) => { 708 if (v42.type === TouchType.Down) { 709 this.isMoreIconOnClick = true; 710 } 711 if (v42.type === TouchType.Up || v42.type === TouchType.Cancel) { 712 this.isMoreIconOnClick = false; 713 if (this.fontSize >= this.minFontSize) { 714 this.dialogController?.close(); 715 } 716 } 717 }); 718 Button.onClick(() => this.isPopupShown = true); 719 Button.gestureModifier(ObservedObject.GetRawObject(this.buttonGestureModifier)); 720 Button.bindPopup(this.isPopupShown, { 721 builder: { builder: this.popupBuilder.bind(this) }, 722 placement: Placement.Bottom, 723 popupColor: Color.White, 724 enableArrow: false, 725 onStateChange: (u42) => { 726 this.isPopupShown = u42.isVisible; 727 if (!u42.isVisible) { 728 this.isMoreIconOnClick = false; 729 } 730 } 731 }); 732 }, Button); 733 this.observeComponentCreation2((q42, r42) => { 734 SymbolGlyph.create(PUBLIC_MORE); 735 SymbolGlyph.fontSize(TabContentItem.symbolSize); 736 SymbolGlyph.draggable(false); 737 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 738 SymbolGlyph.focusable(true); 739 }, SymbolGlyph); 740 Button.pop(); 741 }); 742 } 743 }, If); 744 If.pop(); 745 Row.pop(); 746 Column.pop(); 747 } 748 onPlaceChildren(k42, l42, m42) { 749 l42.forEach((n42) => { 750 n42.layout({ x: 0, y: 0 }); 751 }); 752 this.fontSize = this.decideFontScale(); 753 } 754 popupBuilder(x41 = null) { 755 this.observeComponentCreation2((i42, j42) => { 756 Column.create(); 757 Column.width(ImageMenuItem.imageHotZoneWidth + CollapsibleMenuSection.focusPadding * CollapsibleMenuSection.marginsNum); 758 Column.margin({ top: CollapsibleMenuSection.focusPadding, bottom: CollapsibleMenuSection.focusPadding }); 759 Column.onAppear(() => { 760 focusControl.requestFocus(ImageMenuItem.focusablePrefix + this.firstFocusableIndex); 761 }); 762 }, Column); 763 this.observeComponentCreation2((y41, z41) => { 764 ForEach.create(); 765 const s17 = (b42, c42) => { 766 const d42 = b42; 767 { 768 this.observeComponentCreation2((e42, f42) => { 769 if (f42) { 770 let g42 = new ImageMenuItem(this, { item: d42, index: this.index * 1000 + 771 CollapsibleMenuSection.maxCountOfVisibleItems + c42 }, undefined, e42, () => { }, { page: 'library/src/main/ets/components/tabtitlebar.ets', line: 437, col: 11 }); 772 ViewPU.create(g42); 773 let t17 = () => { 774 return { 775 item: d42, 776 index: this.index * 1000 + 777 CollapsibleMenuSection.maxCountOfVisibleItems + c42 778 }; 779 }; 780 g42.paramsGenerator_ = t17; 781 } 782 else { 783 this.updateStateVarsOfChildByElmtId(e42, {}); 784 } 785 }, { name: 'ImageMenuItem' }); 786 } 787 }; 788 this.forEachUpdateFunction(y41, this.menuItems.slice(CollapsibleMenuSection.maxCountOfVisibleItems - 1, this.menuItems.length), s17, undefined, true, false); 789 }, ForEach); 790 ForEach.pop(); 791 Column.pop(); 792 } 793 rerender() { 794 this.updateDirtyElements(); 795 } 796} 797CollapsibleMenuSection.maxCountOfVisibleItems = 1; 798CollapsibleMenuSection.focusPadding = 4; 799CollapsibleMenuSection.marginsNum = 2; 800class TabContentItem extends ViewPU { 801 constructor(r41, s41, t41, u41 = -1, v41 = undefined, w41) { 802 super(r41, t41, u41, w41); 803 if (typeof v41 === 'function') { 804 this.paramsGenerator_ = v41; 805 } 806 this.item = { title: '' }; 807 this.index = 0; 808 this.maxIndex = 0; 809 this.onCustomClick = undefined; 810 this.onImageComplete = undefined; 811 this.__currentIndex = new SynchedPropertySimpleOneWayPU(s41.currentIndex, this, 'currentIndex'); 812 this.__isOnFocus = new ObservedPropertySimplePU(false, this, 'isOnFocus'); 813 this.__isOnHover = new ObservedPropertySimplePU(false, this, 'isOnHover'); 814 this.__isOnClick = new ObservedPropertySimplePU(false, this, 'isOnClick'); 815 this.__tabWidth = new ObservedPropertySimplePU(0, this, 'tabWidth'); 816 this.__imageWidth = new ObservedPropertySimplePU(24, this, 'imageWidth'); 817 this.__imageHeight = new ObservedPropertySimplePU(24, this, 'imageHeight'); 818 this.setInitiallyProvidedValue(s41); 819 this.finalizeConstruction(); 820 } 821 setInitiallyProvidedValue(q41) { 822 if (q41.item !== undefined) { 823 this.item = q41.item; 824 } 825 if (q41.index !== undefined) { 826 this.index = q41.index; 827 } 828 if (q41.maxIndex !== undefined) { 829 this.maxIndex = q41.maxIndex; 830 } 831 if (q41.onCustomClick !== undefined) { 832 this.onCustomClick = q41.onCustomClick; 833 } 834 if (q41.onImageComplete !== undefined) { 835 this.onImageComplete = q41.onImageComplete; 836 } 837 if (q41.isOnFocus !== undefined) { 838 this.isOnFocus = q41.isOnFocus; 839 } 840 if (q41.isOnHover !== undefined) { 841 this.isOnHover = q41.isOnHover; 842 } 843 if (q41.isOnClick !== undefined) { 844 this.isOnClick = q41.isOnClick; 845 } 846 if (q41.tabWidth !== undefined) { 847 this.tabWidth = q41.tabWidth; 848 } 849 if (q41.imageWidth !== undefined) { 850 this.imageWidth = q41.imageWidth; 851 } 852 if (q41.imageHeight !== undefined) { 853 this.imageHeight = q41.imageHeight; 854 } 855 } 856 updateStateVars(p41) { 857 this.__currentIndex.reset(p41.currentIndex); 858 } 859 purgeVariableDependenciesOnElmtId(o41) { 860 this.__currentIndex.purgeDependencyOnElmtId(o41); 861 this.__isOnFocus.purgeDependencyOnElmtId(o41); 862 this.__isOnHover.purgeDependencyOnElmtId(o41); 863 this.__isOnClick.purgeDependencyOnElmtId(o41); 864 this.__tabWidth.purgeDependencyOnElmtId(o41); 865 this.__imageWidth.purgeDependencyOnElmtId(o41); 866 this.__imageHeight.purgeDependencyOnElmtId(o41); 867 } 868 aboutToBeDeleted() { 869 this.__currentIndex.aboutToBeDeleted(); 870 this.__isOnFocus.aboutToBeDeleted(); 871 this.__isOnHover.aboutToBeDeleted(); 872 this.__isOnClick.aboutToBeDeleted(); 873 this.__tabWidth.aboutToBeDeleted(); 874 this.__imageWidth.aboutToBeDeleted(); 875 this.__imageHeight.aboutToBeDeleted(); 876 SubscriberManager.Get().delete(this.id__()); 877 this.aboutToBeDeletedInternal(); 878 } 879 get currentIndex() { 880 return this.__currentIndex.get(); 881 } 882 set currentIndex(n41) { 883 this.__currentIndex.set(n41); 884 } 885 get isOnFocus() { 886 return this.__isOnFocus.get(); 887 } 888 set isOnFocus(m41) { 889 this.__isOnFocus.set(m41); 890 } 891 get isOnHover() { 892 return this.__isOnHover.get(); 893 } 894 set isOnHover(l41) { 895 this.__isOnHover.set(l41); 896 } 897 get isOnClick() { 898 return this.__isOnClick.get(); 899 } 900 set isOnClick(k41) { 901 this.__isOnClick.set(k41); 902 } 903 get tabWidth() { 904 return this.__tabWidth.get(); 905 } 906 set tabWidth(j41) { 907 this.__tabWidth.set(j41); 908 } 909 get imageWidth() { 910 return this.__imageWidth.get(); 911 } 912 set imageWidth(i41) { 913 this.__imageWidth.set(i41); 914 } 915 get imageHeight() { 916 return this.__imageHeight.get(); 917 } 918 set imageHeight(h41) { 919 this.__imageHeight.set(h41); 920 } 921 getBgColor() { 922 if (this.isOnClick) { 923 return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_click_effect'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 924 } 925 else if (this.isOnHover) { 926 return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_hover'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 927 } 928 else { 929 return Color.Transparent; 930 } 931 } 932 getBorderAttr() { 933 if (this.isOnFocus) { 934 return { 935 radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 936 width: TabContentItem.focusBorderWidth, 937 color: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 938 style: BorderStyle.Solid 939 }; 940 } 941 return { width: 0 }; 942 } 943 getImageScaleFactor() { 944 return this.index === this.currentIndex ? TabContentItem.imageMagnificationFactor : 1; 945 } 946 getImageLayoutWidth() { 947 return TabContentItem.imageSize / Math.max(this.imageHeight, 1.0) * this.imageWidth; 948 } 949 toStringFormat(c41) { 950 if (typeof c41 === 'string') { 951 return c41; 952 } 953 else if (typeof c41 === 'undefined') { 954 return ''; 955 } 956 else { 957 let d41 = ''; 958 try { 959 d41 = getContext()?.resourceManager?.getStringSync(c41); 960 } 961 catch (e41) { 962 let f41 = e41?.code; 963 let g41 = e41?.message; 964 hilog.error(0x3900, 'Ace', `Faild to TabTitleBar toStringFormat,code: ${f41},message:${g41}`); 965 } 966 return d41; 967 } 968 } 969 initialRender() { 970 this.observeComponentCreation2((a41, b41) => { 971 Stack.create(); 972 Stack.margin({ 973 left: this.index === 0 ? TabContentItem.marginFirst : 0, 974 right: this.index === this.maxIndex ? 12 : 0 975 }); 976 }, Stack); 977 this.observeComponentCreation2((w40, x40) => { 978 Row.create(); 979 Row.height(TabTitleBar.totalHeight); 980 Row.alignItems(VerticalAlign.Center); 981 Row.justifyContent(FlexAlign.Center); 982 Row.borderRadius(TabContentItem.buttonBorderRadius); 983 Row.backgroundColor(this.getBgColor()); 984 Row.onAreaChange((y40, z40) => { 985 this.tabWidth = Number(z40.width); 986 }); 987 }, Row); 988 this.observeComponentCreation2((u40, v40) => { 989 Column.create(); 990 Column.justifyContent(FlexAlign.Center); 991 }, Column); 992 this.observeComponentCreation2((w39, x39) => { 993 If.create(); 994 if (this.item.icon === undefined && this.item.symbolStyle === undefined) { 995 this.ifElseBranchUpdateFunction(0, () => { 996 this.observeComponentCreation2((p40, q40) => { 997 Text.create(this.item.title); 998 Context.animation({ duration: 300 }); 999 Text.fontSize(this.index === this.currentIndex 1000 ? { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_headline7'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_headline9'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1001 Text.fontColor(this.index === this.currentIndex 1002 ? { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_text'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_text_off'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1003 Text.fontWeight(FontWeight.Medium); 1004 Text.focusable(true); 1005 Context.animation(null); 1006 Text.padding({ 1007 top: this.index === this.currentIndex ? 6 : 10, 1008 left: TabContentItem.paddingLeft, 1009 bottom: 2, 1010 right: TabContentItem.paddingRight 1011 }); 1012 Text.onFocus(() => this.isOnFocus = true); 1013 Text.onBlur(() => this.isOnFocus = false); 1014 Text.onHover((t40) => this.isOnHover = t40); 1015 Text.onKeyEvent((s40) => { 1016 if (s40.keyCode !== KeyCode.KEYCODE_ENTER && s40.keyCode !== KeyCode.KEYCODE_SPACE) { 1017 return; 1018 } 1019 if (s40.type === KeyType.Down) { 1020 this.isOnClick = true; 1021 } 1022 if (s40.type === KeyType.Up) { 1023 this.isOnClick = false; 1024 } 1025 }); 1026 Text.onTouch((r40) => { 1027 if (r40.type === TouchType.Down) { 1028 this.isOnClick = true; 1029 } 1030 if (r40.type === TouchType.Up || r40.type === TouchType.Cancel) { 1031 this.isOnClick = false; 1032 } 1033 }); 1034 Text.onClick(() => this.onCustomClick && this.onCustomClick(this.index)); 1035 Text.accessibilitySelected(this.index === this.currentIndex); 1036 }, Text); 1037 Text.pop(); 1038 }); 1039 } 1040 else { 1041 this.ifElseBranchUpdateFunction(1, () => { 1042 this.observeComponentCreation2((k40, l40) => { 1043 Row.create(); 1044 Context.animation({ duration: 300 }); 1045 Row.width(this.getImageLayoutWidth() * this.getImageScaleFactor() + 1046 TabContentItem.paddingLeft + TabContentItem.paddingRight); 1047 Row.constraintSize({ 1048 minWidth: TabContentItem.imageHotZoneWidth, 1049 minHeight: TabContentItem.imageHotZoneWidth 1050 }); 1051 Context.animation(null); 1052 Row.justifyContent(FlexAlign.Center); 1053 Row.onFocus(() => this.isOnFocus = true); 1054 Row.onBlur(() => this.isOnFocus = false); 1055 Row.onHover((o40) => this.isOnHover = o40); 1056 Row.onKeyEvent((n40) => { 1057 if (n40.keyCode !== KeyCode.KEYCODE_ENTER && n40.keyCode !== KeyCode.KEYCODE_SPACE) { 1058 return; 1059 } 1060 if (n40.type === KeyType.Down) { 1061 this.isOnClick = true; 1062 } 1063 if (n40.type === KeyType.Up) { 1064 this.isOnClick = false; 1065 } 1066 }); 1067 Row.onTouch((m40) => { 1068 if (m40.type === TouchType.Down) { 1069 this.isOnClick = true; 1070 } 1071 if (m40.type === TouchType.Up || m40.type === TouchType.Cancel) { 1072 this.isOnClick = false; 1073 } 1074 }); 1075 Row.onClick(() => this.onCustomClick && this.onCustomClick(this.index)); 1076 Row.accessibilitySelected(this.index === this.currentIndex); 1077 }, Row); 1078 this.observeComponentCreation2((y39, z39) => { 1079 If.create(); 1080 if (this.item.symbolStyle) { 1081 this.ifElseBranchUpdateFunction(0, () => { 1082 this.observeComponentCreation2((i40, j40) => { 1083 SymbolGlyph.create(); 1084 Context.animation({ duration: 300 }); 1085 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1086 SymbolGlyph.attributeModifier.bind(this)(this.item.symbolStyle); 1087 SymbolGlyph.fontSize(TabContentItem.symbolSize); 1088 SymbolGlyph.width(this.getImageLayoutWidth()); 1089 SymbolGlyph.height(TabContentItem.imageSize); 1090 SymbolGlyph.accessibilityText(this.toStringFormat(this.item.title)); 1091 SymbolGlyph.scale({ 1092 x: this.getImageScaleFactor(), 1093 y: this.getImageScaleFactor() 1094 }); 1095 Context.animation(null); 1096 SymbolGlyph.hitTestBehavior(HitTestMode.None); 1097 SymbolGlyph.focusable(true); 1098 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1099 }, SymbolGlyph); 1100 }); 1101 } 1102 else { 1103 this.ifElseBranchUpdateFunction(1, () => { 1104 this.observeComponentCreation2((a40, b40) => { 1105 If.create(); 1106 if (Util.isSymbolResource(this.item.icon)) { 1107 this.ifElseBranchUpdateFunction(0, () => { 1108 this.observeComponentCreation2((g40, h40) => { 1109 SymbolGlyph.create(this.item.icon); 1110 Context.animation({ duration: 300 }); 1111 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1112 SymbolGlyph.fontSize(TabContentItem.symbolSize); 1113 SymbolGlyph.width(this.getImageLayoutWidth()); 1114 SymbolGlyph.height(TabContentItem.imageSize); 1115 SymbolGlyph.accessibilityText(this.toStringFormat(this.item.title)); 1116 SymbolGlyph.scale({ 1117 x: this.getImageScaleFactor(), 1118 y: this.getImageScaleFactor() 1119 }); 1120 Context.animation(null); 1121 SymbolGlyph.hitTestBehavior(HitTestMode.None); 1122 SymbolGlyph.focusable(true); 1123 }, SymbolGlyph); 1124 }); 1125 } 1126 else { 1127 this.ifElseBranchUpdateFunction(1, () => { 1128 this.observeComponentCreation2((c40, d40) => { 1129 Image.create(this.item.icon); 1130 Context.animation({ duration: 300 }); 1131 Image.alt(this.item.title); 1132 Image.width(this.getImageLayoutWidth()); 1133 Image.height(TabContentItem.imageSize); 1134 Image.objectFit(ImageFit.Fill); 1135 Image.accessibilityText(this.toStringFormat(this.item.title)); 1136 Image.scale({ 1137 x: this.getImageScaleFactor(), 1138 y: this.getImageScaleFactor() 1139 }); 1140 Context.animation(null); 1141 Image.hitTestBehavior(HitTestMode.None); 1142 Image.focusable(true); 1143 Image.onComplete((f40) => { 1144 if (!this.onImageComplete) { 1145 return; 1146 } 1147 this.imageWidth = px2vp(f40?.width); 1148 this.imageHeight = px2vp(f40?.height); 1149 this.onImageComplete(px2vp(f40?.componentWidth) + 1150 TabContentItem.paddingLeft + TabContentItem.paddingRight); 1151 }); 1152 Image.onError((e40) => { 1153 if (!this.onImageComplete) { 1154 return; 1155 } 1156 this.onImageComplete(px2vp(e40.componentWidth) + 1157 TabContentItem.paddingLeft + TabContentItem.paddingRight); 1158 }); 1159 }, Image); 1160 }); 1161 } 1162 }, If); 1163 If.pop(); 1164 }); 1165 } 1166 }, If); 1167 If.pop(); 1168 Row.pop(); 1169 }); 1170 } 1171 }, If); 1172 If.pop(); 1173 Column.pop(); 1174 Row.pop(); 1175 this.observeComponentCreation2((s39, t39) => { 1176 If.create(); 1177 if (this.isOnFocus && this.tabWidth > 0) { 1178 this.ifElseBranchUpdateFunction(0, () => { 1179 this.observeComponentCreation2((u39, v39) => { 1180 Row.create(); 1181 Row.width(this.tabWidth); 1182 Row.height(TabTitleBar.totalHeight); 1183 Row.hitTestBehavior(HitTestMode.None); 1184 Row.borderRadius(TabContentItem.buttonBorderRadius); 1185 ViewStackProcessor.visualState('focused'); 1186 Row.border(this.getBorderAttr()); 1187 ViewStackProcessor.visualState('normal'); 1188 Row.border({ 1189 radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1190 width: 0 1191 }); 1192 ViewStackProcessor.visualState(); 1193 }, Row); 1194 Row.pop(); 1195 }); 1196 } 1197 else { 1198 this.ifElseBranchUpdateFunction(1, () => { 1199 }); 1200 } 1201 }, If); 1202 If.pop(); 1203 Stack.pop(); 1204 } 1205 rerender() { 1206 this.updateDirtyElements(); 1207 } 1208} 1209TabContentItem.imageSize = 24; 1210TabContentItem.symbolSize = '24vp'; 1211TabContentItem.imageHotZoneWidth = 48; 1212TabContentItem.imageMagnificationFactor = 1.4; 1213TabContentItem.buttonBorderRadius = 8; 1214TabContentItem.focusBorderWidth = 2; 1215TabContentItem.paddingLeft = 8; 1216TabContentItem.paddingRight = 8; 1217TabContentItem.marginFirst = 16; 1218class ImageMenuItem extends ViewPU { 1219 constructor(m39, n39, o39, p39 = -1, q39 = undefined, r39) { 1220 super(m39, o39, p39, r39); 1221 if (typeof q39 === 'function') { 1222 this.paramsGenerator_ = q39; 1223 } 1224 this.item = { value: '' }; 1225 this.index = 0; 1226 this.__isOnFocus = new ObservedPropertySimplePU(false, this, 'isOnFocus'); 1227 this.__isOnHover = new ObservedPropertySimplePU(false, this, 'isOnHover'); 1228 this.__isOnClick = new ObservedPropertySimplePU(false, this, 'isOnClick'); 1229 this.setInitiallyProvidedValue(n39); 1230 this.finalizeConstruction(); 1231 } 1232 setInitiallyProvidedValue(l39) { 1233 if (l39.item !== undefined) { 1234 this.item = l39.item; 1235 } 1236 if (l39.index !== undefined) { 1237 this.index = l39.index; 1238 } 1239 if (l39.isOnFocus !== undefined) { 1240 this.isOnFocus = l39.isOnFocus; 1241 } 1242 if (l39.isOnHover !== undefined) { 1243 this.isOnHover = l39.isOnHover; 1244 } 1245 if (l39.isOnClick !== undefined) { 1246 this.isOnClick = l39.isOnClick; 1247 } 1248 } 1249 updateStateVars(k39) { 1250 } 1251 purgeVariableDependenciesOnElmtId(j39) { 1252 this.__isOnFocus.purgeDependencyOnElmtId(j39); 1253 this.__isOnHover.purgeDependencyOnElmtId(j39); 1254 this.__isOnClick.purgeDependencyOnElmtId(j39); 1255 } 1256 aboutToBeDeleted() { 1257 this.__isOnFocus.aboutToBeDeleted(); 1258 this.__isOnHover.aboutToBeDeleted(); 1259 this.__isOnClick.aboutToBeDeleted(); 1260 SubscriberManager.Get().delete(this.id__()); 1261 this.aboutToBeDeletedInternal(); 1262 } 1263 get isOnFocus() { 1264 return this.__isOnFocus.get(); 1265 } 1266 set isOnFocus(i39) { 1267 this.__isOnFocus.set(i39); 1268 } 1269 get isOnHover() { 1270 return this.__isOnHover.get(); 1271 } 1272 set isOnHover(h39) { 1273 this.__isOnHover.set(h39); 1274 } 1275 get isOnClick() { 1276 return this.__isOnClick.get(); 1277 } 1278 set isOnClick(g39) { 1279 this.__isOnClick.set(g39); 1280 } 1281 getFgColor() { 1282 return this.isOnClick 1283 ? { '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__' }; 1284 } 1285 getBgColor() { 1286 if (this.isOnClick) { 1287 return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_click_effect'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 1288 } 1289 else if (this.isOnHover) { 1290 return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_hover'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 1291 } 1292 else { 1293 return Color.Transparent; 1294 } 1295 } 1296 toStringFormat(b39) { 1297 if (typeof b39 === 'string') { 1298 return b39; 1299 } 1300 else if (typeof b39 === 'undefined') { 1301 return ''; 1302 } 1303 else { 1304 let c39 = ''; 1305 try { 1306 c39 = getContext()?.resourceManager?.getStringSync(b39); 1307 } 1308 catch (d39) { 1309 let e39 = d39?.code; 1310 let f39 = d39?.message; 1311 hilog.error(0x3900, 'Ace', `Faild to TabTitleBar toStringFormat,code: ${e39},message:${f39}`); 1312 } 1313 return c39; 1314 } 1315 } 1316 getAccessibilityReadText() { 1317 if (this.item.value === PUBLIC_MORE) { 1318 return getContext()?.resourceManager?.getStringByNameSync('ohos_toolbar_more'); 1319 } 1320 else if (this.item.accessibilityText) { 1321 return this.toStringFormat(this.item.accessibilityText); 1322 } 1323 else if (this.item.label) { 1324 return this.toStringFormat(this.item.label); 1325 } 1326 return ' '; 1327 } 1328 initialRender() { 1329 this.observeComponentCreation2((w38, x38) => { 1330 Button.createWithChild({ type: ButtonType.Normal, stateEffect: this.item.isEnabled }); 1331 Button.accessibilityText(this.getAccessibilityReadText()); 1332 Button.accessibilityLevel(this.item?.accessibilityLevel ?? 'auto'); 1333 Button.accessibilityDescription(this.toStringFormat(this.item?.accessibilityDescription)); 1334 Button.width(ImageMenuItem.imageHotZoneWidth); 1335 Button.height(ImageMenuItem.imageHotZoneWidth); 1336 Button.borderRadius(ImageMenuItem.buttonBorderRadius); 1337 Button.foregroundColor(this.getFgColor()); 1338 Button.backgroundColor(this.getBgColor()); 1339 Button.enabled(this.item.isEnabled ? this.item.isEnabled : false); 1340 ViewStackProcessor.visualState('focused'); 1341 Button.border({ 1342 radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1343 width: ImageMenuItem.focusBorderWidth, 1344 color: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1345 style: BorderStyle.Solid 1346 }); 1347 ViewStackProcessor.visualState('normal'); 1348 Button.border({ 1349 radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1350 width: 0 1351 }); 1352 ViewStackProcessor.visualState(); 1353 Button.onFocus(() => { 1354 if (!this.item.isEnabled) { 1355 return; 1356 } 1357 this.isOnFocus = true; 1358 }); 1359 Button.onBlur(() => this.isOnFocus = false); 1360 Button.onHover((a39) => { 1361 if (!this.item.isEnabled) { 1362 return; 1363 } 1364 this.isOnHover = a39; 1365 }); 1366 Button.onKeyEvent((z38) => { 1367 if (!this.item.isEnabled) { 1368 return; 1369 } 1370 if (z38.keyCode !== KeyCode.KEYCODE_ENTER && z38.keyCode !== KeyCode.KEYCODE_SPACE) { 1371 return; 1372 } 1373 if (z38.type === KeyType.Down) { 1374 this.isOnClick = true; 1375 } 1376 if (z38.type === KeyType.Up) { 1377 this.isOnClick = false; 1378 } 1379 }); 1380 Button.onTouch((y38) => { 1381 if (!this.item.isEnabled) { 1382 return; 1383 } 1384 if (y38.type === TouchType.Down) { 1385 this.isOnClick = true; 1386 } 1387 if (y38.type === TouchType.Up || y38.type === TouchType.Cancel) { 1388 this.isOnClick = false; 1389 } 1390 }); 1391 Button.onClick(() => this.item.isEnabled && this.item.action && this.item.action()); 1392 }, Button); 1393 this.observeComponentCreation2((m38, n38) => { 1394 If.create(); 1395 if (this.item.symbolStyle) { 1396 this.ifElseBranchUpdateFunction(0, () => { 1397 this.observeComponentCreation2((u38, v38) => { 1398 SymbolGlyph.create(); 1399 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1400 SymbolGlyph.attributeModifier.bind(this)(this.item.symbolStyle); 1401 SymbolGlyph.fontSize(TabContentItem.symbolSize); 1402 SymbolGlyph.draggable(false); 1403 SymbolGlyph.focusable(this.item?.isEnabled); 1404 SymbolGlyph.key(ImageMenuItem.focusablePrefix + this.index); 1405 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1406 }, SymbolGlyph); 1407 }); 1408 } 1409 else { 1410 this.ifElseBranchUpdateFunction(1, () => { 1411 this.observeComponentCreation2((o38, p38) => { 1412 If.create(); 1413 if (Util.isSymbolResource(this.item.value)) { 1414 this.ifElseBranchUpdateFunction(0, () => { 1415 this.observeComponentCreation2((s38, t38) => { 1416 SymbolGlyph.create(this.item.value); 1417 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1418 SymbolGlyph.fontSize(TabContentItem.symbolSize); 1419 SymbolGlyph.draggable(false); 1420 SymbolGlyph.focusable(this.item?.isEnabled); 1421 SymbolGlyph.key(ImageMenuItem.focusablePrefix + this.index); 1422 }, SymbolGlyph); 1423 }); 1424 } 1425 else { 1426 this.ifElseBranchUpdateFunction(1, () => { 1427 this.observeComponentCreation2((q38, r38) => { 1428 Image.create(this.item.value); 1429 Image.width(ImageMenuItem.imageSize); 1430 Image.height(ImageMenuItem.imageSize); 1431 Image.focusable(this.item.isEnabled); 1432 Image.key(ImageMenuItem.focusablePrefix + this.index); 1433 Image.draggable(false); 1434 }, Image); 1435 }); 1436 } 1437 }, If); 1438 If.pop(); 1439 }); 1440 } 1441 }, If); 1442 If.pop(); 1443 Button.pop(); 1444 } 1445 rerender() { 1446 this.updateDirtyElements(); 1447 } 1448} 1449ImageMenuItem.imageSize = 24; 1450ImageMenuItem.imageHotZoneWidth = 48; 1451ImageMenuItem.buttonBorderRadius = 8; 1452ImageMenuItem.focusBorderWidth = 2; 1453ImageMenuItem.disabledImageOpacity = 0.4; 1454ImageMenuItem.focusablePrefix = 'Id-TabTitleBar-ImageMenuItem-'; 1455class TabTitleBarDialog extends ViewPU { 1456 constructor(g38, h38, i38, j38 = -1, k38 = undefined, l38) { 1457 super(g38, i38, j38, l38); 1458 if (typeof k38 === 'function') { 1459 this.paramsGenerator_ = k38; 1460 } 1461 this.tabTitleDialog = { value: '' }; 1462 this.callbackId = undefined; 1463 this.tabTitleBarDialog = ''; 1464 this.mainWindowStage = undefined; 1465 this.controller = undefined; 1466 this.minFontSize = 1.75; 1467 this.maxFontSize = 3.2; 1468 this.screenWidth = 640; 1469 this.verticalScreenLines = 6; 1470 this.horizontalsScreenLines = 1; 1471 this.__mainWindow = this.createStorageLink('mainWindow', undefined, 'mainWindow'); 1472 this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize'); 1473 this.__maxLines = new ObservedPropertySimplePU(1, this, 'maxLines'); 1474 this.__windowStandardHeight = this.createStorageProp('windowStandardHeight', 0, 'windowStandardHeight'); 1475 this.cancel = () => { 1476 }; 1477 this.confirm = () => { 1478 }; 1479 this.setInitiallyProvidedValue(h38); 1480 this.finalizeConstruction(); 1481 } 1482 setInitiallyProvidedValue(f38) { 1483 if (f38.tabTitleDialog !== undefined) { 1484 this.tabTitleDialog = f38.tabTitleDialog; 1485 } 1486 if (f38.callbackId !== undefined) { 1487 this.callbackId = f38.callbackId; 1488 } 1489 if (f38.tabTitleBarDialog !== undefined) { 1490 this.tabTitleBarDialog = f38.tabTitleBarDialog; 1491 } 1492 if (f38.mainWindowStage !== undefined) { 1493 this.mainWindowStage = f38.mainWindowStage; 1494 } 1495 if (f38.controller !== undefined) { 1496 this.controller = f38.controller; 1497 } 1498 if (f38.minFontSize !== undefined) { 1499 this.minFontSize = f38.minFontSize; 1500 } 1501 if (f38.maxFontSize !== undefined) { 1502 this.maxFontSize = f38.maxFontSize; 1503 } 1504 if (f38.screenWidth !== undefined) { 1505 this.screenWidth = f38.screenWidth; 1506 } 1507 if (f38.verticalScreenLines !== undefined) { 1508 this.verticalScreenLines = f38.verticalScreenLines; 1509 } 1510 if (f38.horizontalsScreenLines !== undefined) { 1511 this.horizontalsScreenLines = f38.horizontalsScreenLines; 1512 } 1513 if (f38.fontSize !== undefined) { 1514 this.fontSize = f38.fontSize; 1515 } 1516 if (f38.maxLines !== undefined) { 1517 this.maxLines = f38.maxLines; 1518 } 1519 if (f38.cancel !== undefined) { 1520 this.cancel = f38.cancel; 1521 } 1522 if (f38.confirm !== undefined) { 1523 this.confirm = f38.confirm; 1524 } 1525 } 1526 updateStateVars(e38) { 1527 } 1528 purgeVariableDependenciesOnElmtId(d38) { 1529 this.__mainWindow.purgeDependencyOnElmtId(d38); 1530 this.__fontSize.purgeDependencyOnElmtId(d38); 1531 this.__maxLines.purgeDependencyOnElmtId(d38); 1532 this.__windowStandardHeight.purgeDependencyOnElmtId(d38); 1533 } 1534 aboutToBeDeleted() { 1535 this.__mainWindow.aboutToBeDeleted(); 1536 this.__fontSize.aboutToBeDeleted(); 1537 this.__maxLines.aboutToBeDeleted(); 1538 this.__windowStandardHeight.aboutToBeDeleted(); 1539 SubscriberManager.Get().delete(this.id__()); 1540 this.aboutToBeDeletedInternal(); 1541 } 1542 setController(c38) { 1543 this.controller = c38; 1544 } 1545 get mainWindow() { 1546 return this.__mainWindow.get(); 1547 } 1548 set mainWindow(b38) { 1549 this.__mainWindow.set(b38); 1550 } 1551 get fontSize() { 1552 return this.__fontSize.get(); 1553 } 1554 set fontSize(a38) { 1555 this.__fontSize.set(a38); 1556 } 1557 get maxLines() { 1558 return this.__maxLines.get(); 1559 } 1560 set maxLines(z37) { 1561 this.__maxLines.set(z37); 1562 } 1563 get windowStandardHeight() { 1564 return this.__windowStandardHeight.get(); 1565 } 1566 set windowStandardHeight(y37) { 1567 this.__windowStandardHeight.set(y37); 1568 } 1569 initialRender() { 1570 this.observeComponentCreation2((u36, v36) => { 1571 If.create(); 1572 if (this.tabTitleBarDialog) { 1573 this.ifElseBranchUpdateFunction(0, () => { 1574 this.observeComponentCreation2((w37, x37) => { 1575 Column.create(); 1576 Column.width(this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG); 1577 Column.constraintSize({ minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG }); 1578 Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK); 1579 Column.shadow(ShadowStyle.OUTER_DEFAULT_LG); 1580 Column.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.corner_radius_level10'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1581 }, Column); 1582 this.observeComponentCreation2((m37, n37) => { 1583 If.create(); 1584 if (this.tabTitleDialog.symbolStyle) { 1585 this.ifElseBranchUpdateFunction(0, () => { 1586 this.observeComponentCreation2((u37, v37) => { 1587 SymbolGlyph.create(); 1588 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1589 SymbolGlyph.attributeModifier.bind(this)(this.tabTitleDialog.symbolStyle); 1590 SymbolGlyph.fontSize(IMAGE_SIZE); 1591 SymbolGlyph.draggable(false); 1592 SymbolGlyph.focusable(this.tabTitleDialog?.isEnabled); 1593 SymbolGlyph.margin({ 1594 top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level24'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1595 bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1596 }); 1597 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1598 }, SymbolGlyph); 1599 }); 1600 } 1601 else if (this.tabTitleDialog.value) { 1602 this.ifElseBranchUpdateFunction(1, () => { 1603 this.observeComponentCreation2((o37, p37) => { 1604 If.create(); 1605 if (Util.isSymbolResource(this.tabTitleDialog.value)) { 1606 this.ifElseBranchUpdateFunction(0, () => { 1607 this.observeComponentCreation2((s37, t37) => { 1608 SymbolGlyph.create(this.tabTitleDialog.value); 1609 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1610 SymbolGlyph.fontSize(IMAGE_SIZE); 1611 SymbolGlyph.draggable(false); 1612 SymbolGlyph.focusable(this.tabTitleDialog?.isEnabled); 1613 SymbolGlyph.margin({ 1614 top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level24'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1615 bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1616 }); 1617 }, SymbolGlyph); 1618 }); 1619 } 1620 else { 1621 this.ifElseBranchUpdateFunction(1, () => { 1622 this.observeComponentCreation2((q37, r37) => { 1623 Image.create(this.tabTitleDialog.value); 1624 Image.width(IMAGE_SIZE); 1625 Image.height(IMAGE_SIZE); 1626 Image.margin({ 1627 top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level24'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1628 bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1629 }); 1630 Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1631 }, Image); 1632 }); 1633 } 1634 }, If); 1635 If.pop(); 1636 }); 1637 } 1638 else { 1639 this.ifElseBranchUpdateFunction(2, () => { 1640 }); 1641 } 1642 }, If); 1643 If.pop(); 1644 this.observeComponentCreation2((k37, l37) => { 1645 Column.create(); 1646 Column.width('100%'); 1647 Column.padding({ 1648 left: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level4'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1649 right: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level4'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1650 bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level12'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1651 }); 1652 }, Column); 1653 this.observeComponentCreation2((i37, j37) => { 1654 Text.create(this.tabTitleBarDialog); 1655 Text.fontSize(TEXT_EDITABLE_DIALOG); 1656 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 1657 Text.maxLines(this.maxLines); 1658 Text.width('100%'); 1659 Text.textAlign(TextAlign.Center); 1660 Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1661 }, Text); 1662 Text.pop(); 1663 Column.pop(); 1664 Column.pop(); 1665 }); 1666 } 1667 else { 1668 this.ifElseBranchUpdateFunction(1, () => { 1669 this.observeComponentCreation2((g37, h37) => { 1670 Column.create(); 1671 Column.width(this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG); 1672 Column.constraintSize({ minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG }); 1673 Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK); 1674 Column.shadow(ShadowStyle.OUTER_DEFAULT_LG); 1675 Column.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.corner_radius_level10'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1676 Column.justifyContent(FlexAlign.Center); 1677 }, Column); 1678 this.observeComponentCreation2((w36, x36) => { 1679 If.create(); 1680 if (this.tabTitleDialog.symbolStyle) { 1681 this.ifElseBranchUpdateFunction(0, () => { 1682 this.observeComponentCreation2((e37, f37) => { 1683 SymbolGlyph.create(); 1684 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1685 SymbolGlyph.attributeModifier.bind(this)(this.tabTitleDialog.symbolStyle); 1686 SymbolGlyph.fontSize(IMAGE_SIZE); 1687 SymbolGlyph.draggable(false); 1688 SymbolGlyph.focusable(this.tabTitleDialog?.isEnabled); 1689 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1690 }, SymbolGlyph); 1691 }); 1692 } 1693 else if (this.tabTitleDialog.value) { 1694 this.ifElseBranchUpdateFunction(1, () => { 1695 this.observeComponentCreation2((y36, z36) => { 1696 If.create(); 1697 if (Util.isSymbolResource(this.tabTitleDialog.value)) { 1698 this.ifElseBranchUpdateFunction(0, () => { 1699 this.observeComponentCreation2((c37, d37) => { 1700 SymbolGlyph.create(this.tabTitleDialog.value); 1701 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1702 SymbolGlyph.fontSize(IMAGE_SIZE); 1703 SymbolGlyph.draggable(false); 1704 SymbolGlyph.focusable(this.tabTitleDialog?.isEnabled); 1705 SymbolGlyph.margin({ 1706 top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level24'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1707 bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1708 }); 1709 }, SymbolGlyph); 1710 }); 1711 } 1712 else { 1713 this.ifElseBranchUpdateFunction(1, () => { 1714 this.observeComponentCreation2((a37, b37) => { 1715 Image.create(this.tabTitleDialog.value); 1716 Image.width(IMAGE_SIZE); 1717 Image.height(IMAGE_SIZE); 1718 Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1719 }, Image); 1720 }); 1721 } 1722 }, If); 1723 If.pop(); 1724 }); 1725 } 1726 else { 1727 this.ifElseBranchUpdateFunction(2, () => { 1728 }); 1729 } 1730 }, If); 1731 If.pop(); 1732 Column.pop(); 1733 }); 1734 } 1735 }, If); 1736 If.pop(); 1737 } 1738 async aboutToAppear() { 1739 let r36 = this.getUIContext().getHostContext(); 1740 this.mainWindowStage = r36.windowStage.getMainWindowSync(); 1741 let s36 = this.mainWindowStage.getWindowProperties(); 1742 let t36 = s36.windowRect; 1743 if (px2vp(t36.height) > this.screenWidth) { 1744 this.maxLines = this.verticalScreenLines; 1745 } 1746 else { 1747 this.maxLines = this.horizontalsScreenLines; 1748 } 1749 } 1750 rerender() { 1751 this.updateDirtyElements(); 1752 } 1753} 1754class Util { 1755 static isSymbolResource(p36) { 1756 if (!Util.isResourceType(p36)) { 1757 return false; 1758 } 1759 let q36 = p36; 1760 return q36.type === RESOURCE_TYPE_SYMBOL; 1761 } 1762 static isResourceType(o36) { 1763 if (!o36) { 1764 return false; 1765 } 1766 if (typeof o36 === 'string' || typeof o36 === 'undefined') { 1767 return false; 1768 } 1769 return true; 1770 } 1771} 1772 1773export default { 1774 TabTitleBar: TabTitleBar 1775};