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 hilog = requireNapi('hilog'); 21const PUBLIC_MORE = { 'id': -1, 'type': 40000, params: ['sys.symbol.dot_grid_2x2'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 22const PUBLIC_BACK = { 'id': -1, 'type': 40000, params: ['sys.symbol.arrow_left'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 23const TEXT_EDITABLE_DIALOG = '18.3fp'; 24const IMAGE_SIZE = '64vp'; 25const MAX_DIALOG = '256vp'; 26const MIN_DIALOG = '216vp'; 27const RESOURCE_TYPE_SYMBOL = 40000; 28class Util { 29 static isSymbolResource(q21) { 30 if (!Util.isResourceType(q21)) { 31 return false; 32 } 33 let r21 = q21; 34 return r21.type === RESOURCE_TYPE_SYMBOL; 35 } 36 static isResourceType(p21) { 37 if (!p21) { 38 return false; 39 } 40 if (typeof p21 === 'string' || typeof p21 === 'undefined') { 41 return false; 42 } 43 return true; 44 } 45} 46class ButtonGestureModifier { 47 constructor(o21) { 48 this.fontSize = 1; 49 this.controller = null; 50 this.controller = o21; 51 } 52 applyGesture(n21) { 53 if (this.fontSize >= ButtonGestureModifier.minFontSize) { 54 n21.addGesture(new LongPressGestureHandler({ repeat: false, duration: ButtonGestureModifier.longPressTime }) 55 .onAction(() => { 56 if (n21) { 57 this.controller?.open(); 58 } 59 }) 60 .onActionEnd(() => { 61 this.controller?.close(); 62 })); 63 } 64 else { 65 n21.clearGestures(); 66 } 67 } 68} 69ButtonGestureModifier.longPressTime = 500; 70ButtonGestureModifier.minFontSize = 1.75; 71class ComposeTitleBar extends ViewPU { 72 constructor(h21, i21, j21, k21 = -1, l21 = undefined, m21) { 73 super(h21, j21, k21, m21); 74 if (typeof l21 === 'function') { 75 this.paramsGenerator_ = l21; 76 } 77 this.item = undefined; 78 this.title = ''; 79 this.subtitle = ''; 80 this.menuItems = []; 81 this.__titleMaxWidth = new ObservedPropertySimplePU(0, this, 'titleMaxWidth'); 82 this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize'); 83 this.__uniqueId = new ObservedPropertySimplePU(-1, this, 'uniqueId'); 84 this.addProvidedVar('uniqueId', this.__uniqueId, false); 85 this.setInitiallyProvidedValue(i21); 86 this.finalizeConstruction(); 87 } 88 setInitiallyProvidedValue(g21) { 89 if (g21.item !== undefined) { 90 this.item = g21.item; 91 } 92 if (g21.title !== undefined) { 93 this.title = g21.title; 94 } 95 if (g21.subtitle !== undefined) { 96 this.subtitle = g21.subtitle; 97 } 98 if (g21.menuItems !== undefined) { 99 this.menuItems = g21.menuItems; 100 } 101 if (g21.titleMaxWidth !== undefined) { 102 this.titleMaxWidth = g21.titleMaxWidth; 103 } 104 if (g21.fontSize !== undefined) { 105 this.fontSize = g21.fontSize; 106 } 107 if (g21.uniqueId !== undefined) { 108 this.uniqueId = g21.uniqueId; 109 } 110 } 111 updateStateVars(f21) { 112 } 113 purgeVariableDependenciesOnElmtId(e21) { 114 this.__titleMaxWidth.purgeDependencyOnElmtId(e21); 115 this.__fontSize.purgeDependencyOnElmtId(e21); 116 this.__uniqueId.purgeDependencyOnElmtId(e21); 117 } 118 aboutToBeDeleted() { 119 this.__titleMaxWidth.aboutToBeDeleted(); 120 this.__fontSize.aboutToBeDeleted(); 121 this.__uniqueId.aboutToBeDeleted(); 122 SubscriberManager.Get().delete(this.id__()); 123 this.aboutToBeDeletedInternal(); 124 } 125 get titleMaxWidth() { 126 return this.__titleMaxWidth.get(); 127 } 128 set titleMaxWidth(d21) { 129 this.__titleMaxWidth.set(d21); 130 } 131 get fontSize() { 132 return this.__fontSize.get(); 133 } 134 set fontSize(c21) { 135 this.__fontSize.set(c21); 136 } 137 get uniqueId() { 138 return this.__uniqueId.get(); 139 } 140 set uniqueId(b21) { 141 this.__uniqueId.set(b21); 142 } 143 initialRender() { 144 this.observeComponentCreation2((v20, w20) => { 145 Flex.create({ 146 justifyContent: FlexAlign.SpaceBetween, 147 alignItems: ItemAlign.Stretch 148 }); 149 Flex.onAppear(() => { 150 try { 151 this.uniqueId = 152 this.getUIContext().getFrameNodeByUniqueId(this.getUniqueId())?.getFirstChild()?.getUniqueId(); 153 } catch (u18) { 154 let v18 = u18?.code; 155 let w18 = u18?.message; 156 hilog.error(0x3900, 'ComposeTitleBar', 157 `Failed to init getFrameNodeByUniqueId info, cause, code: ${v18}, message: ${w18}`); 158 } 159 }); 160 Flex.width('100%'); 161 Flex.height(ComposeTitleBar.totalHeight); 162 Flex.backgroundColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_background'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 163 Flex.onAreaChange((x20, y20) => { 164 let z20 = Number(y20.width); 165 if (this.menuItems !== undefined) { 166 let a21 = this.menuItems.length; 167 if (a21 >= CollapsibleMenuSection.maxCountOfVisibleItems) { 168 z20 = z20 - ImageMenuItem.imageHotZoneWidth * CollapsibleMenuSection.maxCountOfVisibleItems; 169 } 170 else if (a21 > 0) { 171 z20 = z20 - ImageMenuItem.imageHotZoneWidth * a21; 172 } 173 } 174 this.titleMaxWidth = z20; 175 this.titleMaxWidth -= ComposeTitleBar.leftPadding; 176 this.titleMaxWidth -= ImageMenuItem.imageHotZoneWidth; 177 if (this.item !== undefined) { 178 this.titleMaxWidth -= ComposeTitleBar.portraitImageLeftPadding + 179 ComposeTitleBar.portraitImageSize + 180 ComposeTitleBar.portraitImageRightPadding; 181 } 182 this.titleMaxWidth -= ComposeTitleBar.rightPadding; 183 }); 184 }, Flex); 185 this.observeComponentCreation2((t20, u20) => { 186 Row.create(); 187 Row.margin({ left: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_default_padding_start'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } }); 188 }, Row); 189 { 190 this.observeComponentCreation2((p20, q20) => { 191 if (q20) { 192 let r20 = new ImageMenuItem(this, { 193 item: { 194 value: PUBLIC_BACK, 195 isEnabled: true, 196 action: () => this.getUIContext()?.getRouter()?.back() 197 }, 198 index: -1, 199 itemIndex: -1 200 }, undefined, p20, () => { }, { page: 'library/src/main/ets/components/ComposeTitleBar.ets', line: 113, col: 9 }); 201 ViewPU.create(r20); 202 let j = () => { 203 return { 204 item: { 205 value: PUBLIC_BACK, 206 isEnabled: true, 207 action: () => this.getUIContext()?.getRouter()?.back() 208 }, 209 index: -1, 210 itemIndex: -1 211 }; 212 }; 213 r20.paramsGenerator_ = j; 214 } 215 else { 216 this.updateStateVarsOfChildByElmtId(p20, {}); 217 } 218 }, { name: 'ImageMenuItem' }); 219 } 220 this.observeComponentCreation2((n20, o20) => { 221 Row.create(); 222 Row.accessibilityGroup(true); 223 Row.accessibilityDescription({ 224 'id': -1, 225 'type': 10003, 226 params: ['sys.string.subheader_accessibility_title'], 227 'bundleName': '__harDefaultBundleName__', 228 'moduleName': '__harDefaultModuleName__' 229 }); 230 }, Row); 231 this.observeComponentCreation2((j20, k20) => { 232 If.create(); 233 if (this.item !== undefined) { 234 this.ifElseBranchUpdateFunction(0, () => { 235 this.observeComponentCreation2((l20, m20) => { 236 Image.create(this.item.value); 237 Image.width(ComposeTitleBar.portraitImageSize); 238 Image.height(ComposeTitleBar.portraitImageSize); 239 Image.margin({ 240 left: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_paragraph_margin_xs'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 241 right: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_paragraph_margin_m'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } 242 }); 243 Image.focusable(false); 244 Image.borderRadius(ImageMenuItem.buttonBorderRadius); 245 }, Image); 246 }); 247 } 248 else { 249 this.ifElseBranchUpdateFunction(1, () => { 250 }); 251 } 252 }, If); 253 If.pop(); 254 this.observeComponentCreation2((h20, i20) => { 255 Column.create(); 256 Column.justifyContent(FlexAlign.Start); 257 Column.alignItems(HorizontalAlign.Start); 258 Column.constraintSize({ maxWidth: this.titleMaxWidth }); 259 }, Column); 260 this.observeComponentCreation2((b20, c20) => { 261 If.create(); 262 if (this.title !== undefined) { 263 this.ifElseBranchUpdateFunction(0, () => { 264 this.observeComponentCreation2((f20, g20) => { 265 Row.create(); 266 Row.justifyContent(FlexAlign.Start); 267 }, Row); 268 this.observeComponentCreation2((d20, e20) => { 269 Text.create(this.title); 270 Text.fontWeight(FontWeight.Medium); 271 Text.fontSize({ 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_headline8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 272 Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_text'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 273 Text.maxLines(this.subtitle !== undefined ? 1 : 2); 274 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 275 Text.constraintSize({ maxWidth: this.titleMaxWidth }); 276 }, Text); 277 Text.pop(); 278 Row.pop(); 279 }); 280 } 281 else { 282 this.ifElseBranchUpdateFunction(1, () => { 283 }); 284 } 285 }, If); 286 If.pop(); 287 this.observeComponentCreation2((v19, w19) => { 288 If.create(); 289 if (this.subtitle !== undefined) { 290 this.ifElseBranchUpdateFunction(0, () => { 291 this.observeComponentCreation2((z19, a20) => { 292 Row.create(); 293 Row.justifyContent(FlexAlign.Start); 294 }, Row); 295 this.observeComponentCreation2((x19, y19) => { 296 Text.create(this.subtitle); 297 Text.fontSize({ 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_over_line'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 298 Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_subtitle_text'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 299 Text.maxLines(1); 300 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 301 Text.constraintSize({ maxWidth: this.titleMaxWidth }); 302 }, Text); 303 Text.pop(); 304 Row.pop(); 305 }); 306 } 307 else { 308 this.ifElseBranchUpdateFunction(1, () => { 309 }); 310 } 311 }, If); 312 If.pop(); 313 Column.pop(); 314 Row.pop(); 315 Row.pop(); 316 this.observeComponentCreation2((p19, q19) => { 317 If.create(); 318 if (this.menuItems !== undefined && this.menuItems.length > 0) { 319 this.ifElseBranchUpdateFunction(0, () => { 320 { 321 this.observeComponentCreation2((r19, s19) => { 322 if (s19) { 323 let t19 = new CollapsibleMenuSection(this, { menuItems: this.menuItems, index: 1 + ComposeTitleBar.instanceCount++ }, undefined, r19, () => { }, { page: 'library/src/main/ets/components/ComposeTitleBar.ets', line: 170, col: 9 }); 324 ViewPU.create(t19); 325 let i = () => { 326 return { 327 menuItems: this.menuItems, 328 index: 1 + ComposeTitleBar.instanceCount++ 329 }; 330 }; 331 t19.paramsGenerator_ = i; 332 } 333 else { 334 this.updateStateVarsOfChildByElmtId(r19, {}); 335 } 336 }, { name: 'CollapsibleMenuSection' }); 337 } 338 }); 339 } 340 else { 341 this.ifElseBranchUpdateFunction(1, () => { 342 }); 343 } 344 }, If); 345 If.pop(); 346 Flex.pop(); 347 } 348 rerender() { 349 this.updateDirtyElements(); 350 } 351} 352ComposeTitleBar.totalHeight = 56; 353ComposeTitleBar.leftPadding = 12; 354ComposeTitleBar.rightPadding = 12; 355ComposeTitleBar.portraitImageSize = 40; 356ComposeTitleBar.portraitImageLeftPadding = 4; 357ComposeTitleBar.portraitImageRightPadding = 16; 358ComposeTitleBar.instanceCount = 0; 359class CollapsibleMenuSection extends ViewPU { 360 constructor(h19, i19, j19, k19 = -1, l19 = undefined, m19) { 361 super(h19, j19, k19, m19); 362 if (typeof l19 === 'function') { 363 this.paramsGenerator_ = l19; 364 } 365 this.menuItems = []; 366 this.item = { 367 value: PUBLIC_MORE, 368 label: { 'id': -1, 'type': 10003, params: ['sys.string.ohos_toolbar_more'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 369 }; 370 this.index = 0; 371 this.minFontSize = 1.75; 372 this.isFollowingSystemFontScale = false; 373 this.maxFontScale = 1; 374 this.systemFontScale = 1; 375 this.firstFocusableIndex = -1; 376 this.__isPopupShown = new ObservedPropertySimplePU(false, this, 'isPopupShown'); 377 this.__isMoreIconOnFocus = new ObservedPropertySimplePU(false, this, 'isMoreIconOnFocus'); 378 this.__isMoreIconOnHover = new ObservedPropertySimplePU(false, this, 'isMoreIconOnHover'); 379 this.__isMoreIconOnClick = new ObservedPropertySimplePU(false, this, 'isMoreIconOnClick'); 380 this.__fontSize = new SynchedPropertySimpleOneWayPU(i19.fontSize, this, 'fontSize'); 381 this.dialogController = new CustomDialogController({ 382 builder: () => { 383 let n19 = new ComposeTitleBarDialog(this, { 384 cancel: () => { 385 }, 386 confirm: () => { 387 }, 388 itemComposeTitleDialog: this.item, 389 composeTitleBarDialog: this.item.label ? this.item.label : '', 390 fontSize: this.fontSize, 391 }, undefined, -1, () => { }, { page: 'library/src/main/ets/components/ComposeTitleBar.ets', line: 224, col: 14 }); 392 n19.setController(this.dialogController); 393 ViewPU.create(n19); 394 let h = () => { 395 return { 396 cancel: () => { 397 }, 398 confirm: () => { 399 }, 400 itemComposeTitleDialog: this.item, 401 composeTitleBarDialog: this.item.label ? this.item.label : '', 402 fontSize: this.fontSize 403 }; 404 }; 405 n19.paramsGenerator_ = h; 406 }, 407 maskColor: Color.Transparent, 408 isModal: true, 409 customStyle: true 410 }, this); 411 this.__buttonGestureModifier = new ObservedPropertyObjectPU(new ButtonGestureModifier(this.dialogController), this, 'buttonGestureModifier'); 412 this.setInitiallyProvidedValue(i19); 413 this.declareWatch('fontSize', this.onFontSizeUpdated); 414 this.finalizeConstruction(); 415 } 416 setInitiallyProvidedValue(g19) { 417 if (g19.menuItems !== undefined) { 418 this.menuItems = g19.menuItems; 419 } 420 if (g19.item !== undefined) { 421 this.item = g19.item; 422 } 423 if (g19.index !== undefined) { 424 this.index = g19.index; 425 } 426 if (g19.minFontSize !== undefined) { 427 this.minFontSize = g19.minFontSize; 428 } 429 if (g19.isFollowingSystemFontScale !== undefined) { 430 this.isFollowingSystemFontScale = g19.isFollowingSystemFontScale; 431 } 432 if (g19.maxFontScale !== undefined) { 433 this.maxFontScale = g19.maxFontScale; 434 } 435 if (g19.systemFontScale !== undefined) { 436 this.systemFontScale = g19.systemFontScale; 437 } 438 if (g19.firstFocusableIndex !== undefined) { 439 this.firstFocusableIndex = g19.firstFocusableIndex; 440 } 441 if (g19.isPopupShown !== undefined) { 442 this.isPopupShown = g19.isPopupShown; 443 } 444 if (g19.isMoreIconOnFocus !== undefined) { 445 this.isMoreIconOnFocus = g19.isMoreIconOnFocus; 446 } 447 if (g19.isMoreIconOnHover !== undefined) { 448 this.isMoreIconOnHover = g19.isMoreIconOnHover; 449 } 450 if (g19.isMoreIconOnClick !== undefined) { 451 this.isMoreIconOnClick = g19.isMoreIconOnClick; 452 } 453 if (g19.fontSize === undefined) { 454 this.__fontSize.set(1); 455 } 456 if (g19.dialogController !== undefined) { 457 this.dialogController = g19.dialogController; 458 } 459 if (g19.buttonGestureModifier !== undefined) { 460 this.buttonGestureModifier = g19.buttonGestureModifier; 461 } 462 } 463 updateStateVars(f19) { 464 this.__fontSize.reset(f19.fontSize); 465 } 466 purgeVariableDependenciesOnElmtId(e19) { 467 this.__isPopupShown.purgeDependencyOnElmtId(e19); 468 this.__isMoreIconOnFocus.purgeDependencyOnElmtId(e19); 469 this.__isMoreIconOnHover.purgeDependencyOnElmtId(e19); 470 this.__isMoreIconOnClick.purgeDependencyOnElmtId(e19); 471 this.__fontSize.purgeDependencyOnElmtId(e19); 472 this.__buttonGestureModifier.purgeDependencyOnElmtId(e19); 473 } 474 aboutToBeDeleted() { 475 this.__isPopupShown.aboutToBeDeleted(); 476 this.__isMoreIconOnFocus.aboutToBeDeleted(); 477 this.__isMoreIconOnHover.aboutToBeDeleted(); 478 this.__isMoreIconOnClick.aboutToBeDeleted(); 479 this.__fontSize.aboutToBeDeleted(); 480 this.__buttonGestureModifier.aboutToBeDeleted(); 481 SubscriberManager.Get().delete(this.id__()); 482 this.aboutToBeDeletedInternal(); 483 } 484 get isPopupShown() { 485 return this.__isPopupShown.get(); 486 } 487 set isPopupShown(d19) { 488 this.__isPopupShown.set(d19); 489 } 490 get isMoreIconOnFocus() { 491 return this.__isMoreIconOnFocus.get(); 492 } 493 set isMoreIconOnFocus(c19) { 494 this.__isMoreIconOnFocus.set(c19); 495 } 496 get isMoreIconOnHover() { 497 return this.__isMoreIconOnHover.get(); 498 } 499 set isMoreIconOnHover(b19) { 500 this.__isMoreIconOnHover.set(b19); 501 } 502 get isMoreIconOnClick() { 503 return this.__isMoreIconOnClick.get(); 504 } 505 set isMoreIconOnClick(a19) { 506 this.__isMoreIconOnClick.set(a19); 507 } 508 get fontSize() { 509 return this.__fontSize.get(); 510 } 511 set fontSize(z18) { 512 this.__fontSize.set(z18); 513 } 514 get buttonGestureModifier() { 515 return this.__buttonGestureModifier.get(); 516 } 517 set buttonGestureModifier(y18) { 518 this.__buttonGestureModifier.set(y18); 519 } 520 getMoreIconFgColor() { 521 return this.isMoreIconOnClick ? { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon_pressed'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 522 } 523 getMoreIconBgColor() { 524 if (this.isMoreIconOnClick) { 525 return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_click_effect'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 526 } 527 else if (this.isMoreIconOnHover) { 528 return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_hover'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 529 } 530 else { 531 return Color.Transparent; 532 } 533 } 534 aboutToAppear() { 535 try { 536 let x18 = this.getUIContext(); 537 this.isFollowingSystemFontScale = x18.isFollowingSystemFontScale(); 538 this.maxFontScale = x18.getMaxFontScale(); 539 } 540 catch (u18) { 541 let v18 = u18?.code; 542 let w18 = u18?.message; 543 hilog.error(0x3900, 'ComposeTitleBar', `Failed to init fontsizescale info, cause, code: ${v18}, message: ${w18}`); 544 } 545 if (this.menuItems) { 546 this.menuItems.forEach((s18, t18) => { 547 if (s18.isEnabled && this.firstFocusableIndex === -1 && 548 t18 > CollapsibleMenuSection.maxCountOfVisibleItems - 2) { 549 this.firstFocusableIndex = this.index * 1000 + t18 + 1; 550 } 551 }); 552 } 553 this.fontSize = this.decideFontScale(); 554 } 555 decideFontScale() { 556 try { 557 let r18 = this.getUIContext(); 558 this.systemFontScale = r18.getHostContext()?.config?.fontSizeScale ?? 1; 559 if (!this.isFollowingSystemFontScale) { 560 return 1; 561 } 562 return Math.min(this.systemFontScale, this.maxFontScale); 563 } 564 catch (o18) { 565 let p18 = o18?.code; 566 let q18 = o18?.message; 567 hilog.error(0x3900, 'ComposeTitleBar', `Faild to decideFontScale,cause, code: ${p18}, message: ${q18}`); 568 return 1; 569 } 570 } 571 onFontSizeUpdated() { 572 this.buttonGestureModifier.fontSize = this.fontSize; 573 } 574 initialRender() { 575 this.observeComponentCreation2((m18, n18) => { 576 Column.create(); 577 Column.height('100%'); 578 Column.margin({ right: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_default_padding_end'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } }); 579 Column.justifyContent(FlexAlign.Center); 580 }, Column); 581 this.observeComponentCreation2((k18, l18) => { 582 Row.create(); 583 }, Row); 584 this.observeComponentCreation2((e17, f17) => { 585 If.create(); 586 if (this.menuItems) { 587 this.ifElseBranchUpdateFunction(0, () => { 588 this.observeComponentCreation2((g17, h17) => { 589 If.create(); 590 if (this.menuItems.length <= CollapsibleMenuSection.maxCountOfVisibleItems) { 591 this.ifElseBranchUpdateFunction(0, () => { 592 this.observeComponentCreation2((a18, b18) => { 593 ForEach.create(); 594 const f = (d18, e18) => { 595 const f18 = d18; 596 { 597 this.observeComponentCreation2((g18, h18) => { 598 if (h18) { 599 let i18 = new ImageMenuItem(this, { item: f18, index: this.index * 1000 + e18 + 1, itemIndex: e18 }, undefined, g18, () => { }, { page: 'library/src/main/ets/components/ComposeTitleBar.ets', line: 304, col: 15 }); 600 ViewPU.create(i18); 601 let g = () => { 602 return { 603 item: f18, 604 index: this.index * 1000 + e18 + 1, 605 itemIndex: e18 606 }; 607 }; 608 i18.paramsGenerator_ = g; 609 } 610 else { 611 this.updateStateVarsOfChildByElmtId(g18, {}); 612 } 613 }, { name: 'ImageMenuItem' }); 614 } 615 }; 616 this.forEachUpdateFunction(a18, this.menuItems, f, undefined, true, false); 617 }, ForEach); 618 ForEach.pop(); 619 }); 620 } 621 else { 622 this.ifElseBranchUpdateFunction(1, () => { 623 this.observeComponentCreation2((q17, r17) => { 624 ForEach.create(); 625 const d = (t17, u17) => { 626 const v17 = t17; 627 { 628 this.observeComponentCreation2((w17, x17) => { 629 if (x17) { 630 let y17 = new ImageMenuItem(this, { item: v17, index: this.index * 1000 + u17 + 1, itemIndex: u17 }, undefined, w17, () => { }, { page: 'library/src/main/ets/components/ComposeTitleBar.ets', line: 309, col: 17 }); 631 ViewPU.create(y17); 632 let e = () => { 633 return { 634 item: v17, 635 index: this.index * 1000 + u17 + 1, 636 itemIndex: u17 637 }; 638 }; 639 y17.paramsGenerator_ = e; 640 } 641 else { 642 this.updateStateVarsOfChildByElmtId(w17, {}); 643 } 644 }, { name: 'ImageMenuItem' }); 645 } 646 }; 647 this.forEachUpdateFunction(q17, this.menuItems.slice(0, CollapsibleMenuSection.maxCountOfVisibleItems - 1), d, undefined, true, false); 648 }, ForEach); 649 ForEach.pop(); 650 this.observeComponentCreation2((k17, l17) => { 651 Button.createWithChild({ type: ButtonType.Normal, stateEffect: true }); 652 Button.accessibilityText({ 'id': -1, 'type': 10003, params: ['sys.string.ohos_toolbar_more'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 653 Button.width(ImageMenuItem.imageHotZoneWidth); 654 Button.height(ImageMenuItem.imageHotZoneWidth); 655 Button.borderRadius(ImageMenuItem.buttonBorderRadius); 656 Button.foregroundColor(this.getMoreIconFgColor()); 657 Button.backgroundColor(this.getMoreIconBgColor()); 658 ViewStackProcessor.visualState('focused'); 659 Button.border({ 660 radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 661 width: ImageMenuItem.focusBorderWidth, 662 color: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 663 style: BorderStyle.Solid 664 }); 665 ViewStackProcessor.visualState('normal'); 666 Button.border({ 667 radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 668 width: 0 669 }); 670 ViewStackProcessor.visualState(); 671 Button.onFocus(() => this.isMoreIconOnFocus = true); 672 Button.onBlur(() => this.isMoreIconOnFocus = false); 673 Button.onHover((p17) => this.isMoreIconOnHover = p17); 674 Button.onKeyEvent((o17) => { 675 if (o17.keyCode !== KeyCode.KEYCODE_ENTER && 676 o17.keyCode !== KeyCode.KEYCODE_SPACE) { 677 return; 678 } 679 if (o17.type === KeyType.Down) { 680 this.isMoreIconOnClick = true; 681 } 682 if (o17.type === KeyType.Up) { 683 this.isMoreIconOnClick = false; 684 } 685 }); 686 Button.onTouch((n17) => { 687 if (n17.type === TouchType.Down) { 688 this.isMoreIconOnClick = true; 689 } 690 if (n17.type === TouchType.Up || n17.type === TouchType.Cancel) { 691 this.isMoreIconOnClick = false; 692 if (this.fontSize >= this.minFontSize) { 693 this.dialogController?.close(); 694 } 695 } 696 }); 697 Button.onClick(() => this.isPopupShown = true); 698 Button.gestureModifier(ObservedObject.GetRawObject(this.buttonGestureModifier)); 699 Button.bindPopup(this.isPopupShown, { 700 builder: { builder: this.popupBuilder.bind(this) }, 701 placement: Placement.Bottom, 702 popupColor: Color.White, 703 enableArrow: false, 704 onStateChange: (m17) => { 705 this.isPopupShown = m17.isVisible; 706 if (!m17.isVisible) { 707 this.isMoreIconOnClick = false; 708 } 709 } 710 }); 711 }, Button); 712 this.observeComponentCreation2((i17, j17) => { 713 SymbolGlyph.create(PUBLIC_MORE); 714 SymbolGlyph.fontSize(`${ImageMenuItem.imageSize}vp`); 715 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 716 SymbolGlyph.draggable(false); 717 SymbolGlyph.focusable(true); 718 }, SymbolGlyph); 719 Button.pop(); 720 }); 721 } 722 }, If); 723 If.pop(); 724 }); 725 } 726 else { 727 this.ifElseBranchUpdateFunction(1, () => { 728 }); 729 } 730 }, If); 731 If.pop(); 732 Row.pop(); 733 Column.pop(); 734 } 735 onPlaceChildren(a17, b17, c17) { 736 b17.forEach((d17) => { 737 d17.layout({ x: 0, y: 0 }); 738 }); 739 this.fontSize = this.decideFontScale(); 740 } 741 popupBuilder(l16 = null) { 742 this.observeComponentCreation2((y16, z16) => { 743 Column.create(); 744 Column.width(ImageMenuItem.imageHotZoneWidth + 745 CollapsibleMenuSection.focusPadding * CollapsibleMenuSection.marginsNum); 746 Column.margin({ top: CollapsibleMenuSection.focusPadding, bottom: CollapsibleMenuSection.focusPadding }); 747 Column.onAppear(() => { 748 focusControl.requestFocus(ImageMenuItem.focusablePrefix + 749 this.firstFocusableIndex); 750 }); 751 }, Column); 752 this.observeComponentCreation2((m16, n16) => { 753 If.create(); 754 if (this.menuItems) { 755 this.ifElseBranchUpdateFunction(0, () => { 756 this.observeComponentCreation2((o16, p16) => { 757 ForEach.create(); 758 const b = (r16, s16) => { 759 const t16 = r16; 760 { 761 this.observeComponentCreation2((u16, v16) => { 762 if (v16) { 763 let w16 = new ImageMenuItem(this, { 764 item: t16, index: this.index * 1000 + 765 CollapsibleMenuSection.maxCountOfVisibleItems + s16, 766 isPopup: false 767 }, undefined, u16, () => { }, { page: 'library/src/main/ets/components/ComposeTitleBar.ets', line: 404, col: 13 }); 768 ViewPU.create(w16); 769 let c = () => { 770 return { 771 item: t16, 772 index: this.index * 1000 + 773 CollapsibleMenuSection.maxCountOfVisibleItems + s16, 774 isPopup: false 775 }; 776 }; 777 w16.paramsGenerator_ = c; 778 } 779 else { 780 this.updateStateVarsOfChildByElmtId(u16, {}); 781 } 782 }, { name: 'ImageMenuItem' }); 783 } 784 }; 785 this.forEachUpdateFunction(o16, this.menuItems.slice(CollapsibleMenuSection.maxCountOfVisibleItems - 1, this.menuItems.length), b, undefined, true, false); 786 }, ForEach); 787 ForEach.pop(); 788 }); 789 } 790 else { 791 this.ifElseBranchUpdateFunction(1, () => { 792 }); 793 } 794 }, If); 795 If.pop(); 796 Column.pop(); 797 } 798 rerender() { 799 this.updateDirtyElements(); 800 } 801} 802CollapsibleMenuSection.maxCountOfVisibleItems = 3; 803CollapsibleMenuSection.focusPadding = 4; 804CollapsibleMenuSection.marginsNum = 2; 805class ImageMenuItem extends ViewPU { 806 constructor(d16, e16, f16, g16 = -1, h16 = undefined, i16) { 807 super(d16, f16, g16, i16); 808 if (typeof h16 === 'function') { 809 this.paramsGenerator_ = h16; 810 } 811 this.item = {}; 812 this.index = 0; 813 this.itemIndex = 0; 814 this.minFontSize = 1.75; 815 this.isFollowingSystemFontScale = false; 816 this.maxFontScale = 1; 817 this.systemFontScale = 1; 818 this.isPopup = true; 819 this.__isOnFocus = new ObservedPropertySimplePU(false, this, 'isOnFocus'); 820 this.__isOnHover = new ObservedPropertySimplePU(false, this, 'isOnHover'); 821 this.__isOnClick = new ObservedPropertySimplePU(false, this, 'isOnClick'); 822 this.__fontSize = new SynchedPropertySimpleOneWayPU(e16.fontSize, this, 'fontSize'); 823 this.__parentParentUniqueId = this.initializeConsume('uniqueId', 'parentParentUniqueId'); 824 this.dialogController = new CustomDialogController({ 825 builder: () => { 826 let j16 = new ComposeTitleBarDialog(this, { 827 cancel: () => { 828 }, 829 confirm: () => { 830 }, 831 itemComposeTitleDialog: this.item, 832 composeTitleBarDialog: this.item.label ? this.item.label : this.textDialog(), 833 fontSize: this.fontSize, 834 }, undefined, -1, () => { }, { page: 'library/src/main/ets/components/ComposeTitleBar.ets', line: 442, col: 14 }); 835 j16.setController(this.dialogController); 836 ViewPU.create(j16); 837 let a = () => { 838 return { 839 cancel: () => { 840 }, 841 confirm: () => { 842 }, 843 itemComposeTitleDialog: this.item, 844 composeTitleBarDialog: this.item.label ? this.item.label : this.textDialog(), 845 fontSize: this.fontSize 846 }; 847 }; 848 j16.paramsGenerator_ = a; 849 }, 850 maskColor: Color.Transparent, 851 isModal: true, 852 customStyle: true 853 }, this); 854 this.__buttonGestureModifier = new ObservedPropertyObjectPU(new ButtonGestureModifier(this.dialogController), this, 'buttonGestureModifier'); 855 this.setInitiallyProvidedValue(e16); 856 this.declareWatch('fontSize', this.onFontSizeUpdated); 857 this.finalizeConstruction(); 858 } 859 setInitiallyProvidedValue(c16) { 860 if (c16.item !== undefined) { 861 this.item = c16.item; 862 } 863 if (c16.index !== undefined) { 864 this.index = c16.index; 865 } 866 if (c16.itemIndex !== undefined) { 867 this.itemIndex = c16.itemIndex; 868 } 869 if (c16.minFontSize !== undefined) { 870 this.minFontSize = c16.minFontSize; 871 } 872 if (c16.isFollowingSystemFontScale !== undefined) { 873 this.isFollowingSystemFontScale = c16.isFollowingSystemFontScale; 874 } 875 if (c16.maxFontScale !== undefined) { 876 this.maxFontScale = c16.maxFontScale; 877 } 878 if (c16.systemFontScale !== undefined) { 879 this.systemFontScale = c16.systemFontScale; 880 } 881 if (c16.isPopup !== undefined) { 882 this.isPopup = c16.isPopup; 883 } 884 if (c16.isOnFocus !== undefined) { 885 this.isOnFocus = c16.isOnFocus; 886 } 887 if (c16.isOnHover !== undefined) { 888 this.isOnHover = c16.isOnHover; 889 } 890 if (c16.isOnClick !== undefined) { 891 this.isOnClick = c16.isOnClick; 892 } 893 if (c16.fontSize === undefined) { 894 this.__fontSize.set(1); 895 } 896 if (c16.dialogController !== undefined) { 897 this.dialogController = c16.dialogController; 898 } 899 if (c16.buttonGestureModifier !== undefined) { 900 this.buttonGestureModifier = c16.buttonGestureModifier; 901 } 902 } 903 updateStateVars(b16) { 904 this.__fontSize.reset(b16.fontSize); 905 } 906 purgeVariableDependenciesOnElmtId(a16) { 907 this.__isOnFocus.purgeDependencyOnElmtId(a16); 908 this.__isOnHover.purgeDependencyOnElmtId(a16); 909 this.__isOnClick.purgeDependencyOnElmtId(a16); 910 this.__fontSize.purgeDependencyOnElmtId(a16); 911 this.__parentParentUniqueId.purgeDependencyOnElmtId(a16); 912 this.__buttonGestureModifier.purgeDependencyOnElmtId(a16); 913 } 914 aboutToBeDeleted() { 915 this.__isOnFocus.aboutToBeDeleted(); 916 this.__isOnHover.aboutToBeDeleted(); 917 this.__isOnClick.aboutToBeDeleted(); 918 this.__fontSize.aboutToBeDeleted(); 919 this.__parentParentUniqueId.aboutToBeDeleted(); 920 this.__buttonGestureModifier.aboutToBeDeleted(); 921 SubscriberManager.Get().delete(this.id__()); 922 this.aboutToBeDeletedInternal(); 923 } 924 get isOnFocus() { 925 return this.__isOnFocus.get(); 926 } 927 set isOnFocus(z15) { 928 this.__isOnFocus.set(z15); 929 } 930 get isOnHover() { 931 return this.__isOnHover.get(); 932 } 933 set isOnHover(y15) { 934 this.__isOnHover.set(y15); 935 } 936 get isOnClick() { 937 return this.__isOnClick.get(); 938 } 939 set isOnClick(x15) { 940 this.__isOnClick.set(x15); 941 } 942 get fontSize() { 943 return this.__fontSize.get(); 944 } 945 set fontSize(w15) { 946 this.__fontSize.set(w15); 947 } 948 get parentParentUniqueId() { 949 return this.__parentParentUniqueId.get(); 950 } 951 set parentParentUniqueId(v15) { 952 this.__parentParentUniqueId.set(v15); 953 } 954 get buttonGestureModifier() { 955 return this.__buttonGestureModifier.get(); 956 } 957 set buttonGestureModifier(u15) { 958 this.__buttonGestureModifier.set(u15); 959 } 960 textDialog() { 961 if (this.item.value === PUBLIC_MORE) { 962 return { 'id': -1, 'type': 10003, params: ['sys.string.ohos_toolbar_more'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 963 } 964 else if (this.item.value === PUBLIC_BACK) { 965 return { 'id': -1, 'type': 10003, params: ['sys.string.icon_back'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 966 } 967 else { 968 return this.item.label ? this.item.label : ''; 969 } 970 } 971 toStringFormat(p15) { 972 if (typeof p15 === 'string') { 973 return p15; 974 } 975 else if (typeof p15 === 'undefined') { 976 return ''; 977 } 978 else { 979 let q15 = ''; 980 try { 981 if (p15.id === -1) { 982 q15 = getContext()?.resourceManager?.getStringByNameSync(p15.params?.[0].split('.').pop()); 983 } 984 else { 985 q15 = getContext()?.resourceManager?.getStringSync(p15); 986 } 987 } 988 catch (r15) { 989 let s15 = r15?.code; 990 let t15 = r15?.message; 991 hilog.error(0x3900, 'Ace', `Faild to ComposeTitleBar toStringFormat,code: ${s15},message:${t15}`); 992 } 993 return q15; 994 } 995 } 996 getAccessibilityReadText() { 997 if (this.item.value === PUBLIC_BACK) { 998 return getContext()?.resourceManager?.getStringByNameSync('icon_back'); 999 } 1000 else if (this.item.value === PUBLIC_MORE) { 1001 return getContext()?.resourceManager?.getStringByNameSync('ohos_toolbar_more'); 1002 } 1003 else if (this.item.accessibilityText) { 1004 return this.item.accessibilityText; 1005 } 1006 else if (this.item.label) { 1007 return this.item.label; 1008 } 1009 return ' '; 1010 } 1011 onPlaceChildren(l15, m15, n15) { 1012 m15.forEach((o15) => { 1013 o15.layout({ x: 0, y: 0 }); 1014 }); 1015 this.fontSize = this.decideFontScale(); 1016 } 1017 getFgColor() { 1018 return this.isOnClick 1019 ? { '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__' }; 1020 } 1021 getBgColor() { 1022 if (this.isOnClick) { 1023 return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_click_effect'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 1024 } 1025 else if (this.isOnHover) { 1026 return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_hover'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 1027 } 1028 else { 1029 return Color.Transparent; 1030 } 1031 } 1032 aboutToAppear() { 1033 try { 1034 let k15 = this.getUIContext(); 1035 this.isFollowingSystemFontScale = k15.isFollowingSystemFontScale(); 1036 this.maxFontScale = k15.getMaxFontScale(); 1037 } 1038 catch (h15) { 1039 let i15 = h15?.code; 1040 let j15 = h15?.message; 1041 hilog.error(0x3900, 'ComposeTitleBar', `Failed to init fontsizescale info, cause, code: ${i15}, message: ${j15}`); 1042 } 1043 this.fontSize = this.decideFontScale(); 1044 } 1045 onFontSizeUpdated() { 1046 this.buttonGestureModifier.fontSize = this.fontSize; 1047 } 1048 decideFontScale() { 1049 try { 1050 let g15 = this.getUIContext(); 1051 this.systemFontScale = g15.getHostContext()?.config?.fontSizeScale ?? 1; 1052 if (!this.isFollowingSystemFontScale) { 1053 return 1; 1054 } 1055 return Math.min(this.systemFontScale, this.maxFontScale); 1056 } 1057 catch (d15) { 1058 let e15 = d15?.code; 1059 let f15 = d15?.message; 1060 hilog.error(0x3900, 'ComposeTitleBar', `Faild to decideFontScale,cause, code: ${e15}, message: ${f15}`); 1061 return 1; 1062 } 1063 } 1064 initialRender() { 1065 this.observeComponentCreation2((x13, y13) => { 1066 If.create(); 1067 if (this.isPopup) { 1068 this.ifElseBranchUpdateFunction(0, () => { 1069 if (!If.canRetake(`ComposeTitleBar_ImageMenuItem_${this.parentParentUniqueId}_${this.itemIndex}`)) { 1070 this.observeComponentCreation2((y14, z14) => { 1071 Button.createWithChild({ type: ButtonType.Normal, stateEffect: this.item.isEnabled }); 1072 Button.id(`ComposeTitleBar_ImageMenuItem_${this.parentParentUniqueId}_${this.itemIndex}`); 1073 Button.accessibilityText(this.getAccessibilityReadText()); 1074 Button.accessibilityLevel(this.item?.accessibilityLevel ?? 'auto'); 1075 Button.accessibilityDescription(this.item?.accessibilityDescription); 1076 Button.enabled(this.item.isEnabled ? this.item.isEnabled : false); 1077 Button.width(ImageMenuItem.imageHotZoneWidth); 1078 Button.height(ImageMenuItem.imageHotZoneWidth); 1079 Button.borderRadius(ImageMenuItem.buttonBorderRadius); 1080 Button.foregroundColor(this.getFgColor()); 1081 Button.backgroundColor(this.getBgColor()); 1082 ViewStackProcessor.visualState('focused'); 1083 Button.border({ 1084 radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1085 width: ImageMenuItem.focusBorderWidth, 1086 color: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1087 style: BorderStyle.Solid 1088 }); 1089 ViewStackProcessor.visualState('normal'); 1090 Button.border({ 1091 radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1092 width: 0 1093 }); 1094 ViewStackProcessor.visualState(); 1095 Button.onFocus(() => { 1096 if (!this.item?.isEnabled) { 1097 return; 1098 } 1099 this.isOnFocus = true; 1100 }); 1101 Button.onBlur(() => this.isOnFocus = false); 1102 Button.onHover((c15) => { 1103 if (!this.item?.isEnabled) { 1104 return; 1105 } 1106 this.isOnHover = c15; 1107 }); 1108 Button.onKeyEvent((b15) => { 1109 if (!this.item?.isEnabled) { 1110 return; 1111 } 1112 if (b15.keyCode !== KeyCode.KEYCODE_ENTER && 1113 b15.keyCode !== KeyCode.KEYCODE_SPACE) { 1114 return; 1115 } 1116 if (b15.type === KeyType.Down) { 1117 this.isOnClick = true; 1118 } 1119 if (b15.type === KeyType.Up) { 1120 this.isOnClick = false; 1121 } 1122 }); 1123 Button.onTouch((a15) => { 1124 if (!this.item?.isEnabled) { 1125 return; 1126 } 1127 if (a15.type === TouchType.Down) { 1128 this.isOnClick = true; 1129 } 1130 if (a15.type === TouchType.Up || a15.type === TouchType.Cancel) { 1131 this.isOnClick = false; 1132 if (this.fontSize >= this.minFontSize) { 1133 this.dialogController?.close(); 1134 } 1135 } 1136 }); 1137 Button.onClick(() => { 1138 if (this.item) { 1139 return this.item.isEnabled && this.item.action?.(); 1140 } 1141 }); 1142 Button.gestureModifier(ObservedObject.GetRawObject(this.buttonGestureModifier)); 1143 }, Button); 1144 this.observeComponentCreation2((o14, p14) => { 1145 If.create(); 1146 if (this.item?.symbolStyle) { 1147 this.ifElseBranchUpdateFunction(0, () => { 1148 this.observeComponentCreation2((w14, x14) => { 1149 SymbolGlyph.create(); 1150 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1151 SymbolGlyph.attributeModifier.bind(this)(this.item?.symbolStyle); 1152 SymbolGlyph.fontSize(`${ImageMenuItem.imageSize}vp`); 1153 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1154 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1155 SymbolGlyph.draggable(false); 1156 SymbolGlyph.focusable(this.item?.isEnabled); 1157 SymbolGlyph.key(ImageMenuItem.focusablePrefix + this.index); 1158 }, SymbolGlyph); 1159 }); 1160 } 1161 else { 1162 this.ifElseBranchUpdateFunction(1, () => { 1163 this.observeComponentCreation2((q14, r14) => { 1164 If.create(); 1165 if (Util.isSymbolResource(this.item.value)) { 1166 this.ifElseBranchUpdateFunction(0, () => { 1167 this.observeComponentCreation2((u14, v14) => { 1168 SymbolGlyph.create(this.item.value); 1169 SymbolGlyph.fontSize(`${ImageMenuItem.imageSize}vp`); 1170 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1171 SymbolGlyph.draggable(false); 1172 SymbolGlyph.focusable(this.item?.isEnabled); 1173 SymbolGlyph.key(ImageMenuItem.focusablePrefix + this.index); 1174 }, SymbolGlyph); 1175 }); 1176 } 1177 else { 1178 this.ifElseBranchUpdateFunction(1, () => { 1179 this.observeComponentCreation2((s14, t14) => { 1180 Image.create(this.item?.value); 1181 Image.matchTextDirection(this.item?.value === PUBLIC_BACK ? true : false); 1182 Image.width(ImageMenuItem.imageSize); 1183 Image.draggable(false); 1184 Image.height(ImageMenuItem.imageSize); 1185 Image.focusable(this.item?.isEnabled); 1186 Image.key(ImageMenuItem.focusablePrefix + this.index); 1187 Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1188 }, Image); 1189 }); 1190 } 1191 }, If); 1192 If.pop(); 1193 }); 1194 } 1195 }, If); 1196 If.pop(); 1197 Button.pop(); 1198 } 1199 }); 1200 } 1201 else { 1202 this.ifElseBranchUpdateFunction(1, () => { 1203 if (!If.canRetake(`ComposeTitleBar_ImageMenuItem_${this.parentParentUniqueId}_${this.itemIndex}`)) { 1204 this.observeComponentCreation2((j14, k14) => { 1205 Button.createWithChild({ type: ButtonType.Normal, stateEffect: this.item.isEnabled }); 1206 Button.id(`ComposeTitleBar_ImageMenuItem_${this.parentParentUniqueId}_${this.itemIndex}`); 1207 Button.accessibilityText(this.getAccessibilityReadText()); 1208 Button.accessibilityLevel(this.item?.accessibilityLevel ?? 'auto'); 1209 Button.accessibilityDescription(this.item?.accessibilityDescription); 1210 Button.enabled(this.item.isEnabled ? this.item.isEnabled : false); 1211 Button.width(ImageMenuItem.imageHotZoneWidth); 1212 Button.height(ImageMenuItem.imageHotZoneWidth); 1213 Button.borderRadius(ImageMenuItem.buttonBorderRadius); 1214 Button.foregroundColor(this.getFgColor()); 1215 Button.backgroundColor(this.getBgColor()); 1216 ViewStackProcessor.visualState('focused'); 1217 Button.border({ 1218 radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1219 width: ImageMenuItem.focusBorderWidth, 1220 color: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1221 style: BorderStyle.Solid 1222 }); 1223 ViewStackProcessor.visualState('normal'); 1224 Button.border({ 1225 radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1226 width: 0 1227 }); 1228 ViewStackProcessor.visualState(); 1229 Button.onFocus(() => { 1230 if (!this.item?.isEnabled) { 1231 return; 1232 } 1233 this.isOnFocus = true; 1234 }); 1235 Button.onBlur(() => this.isOnFocus = false); 1236 Button.onHover((n14) => { 1237 if (!this.item?.isEnabled) { 1238 return; 1239 } 1240 this.isOnHover = n14; 1241 }); 1242 Button.onKeyEvent((m14) => { 1243 if (!this.item?.isEnabled) { 1244 return; 1245 } 1246 if (m14.keyCode !== KeyCode.KEYCODE_ENTER && 1247 m14.keyCode !== KeyCode.KEYCODE_SPACE) { 1248 return; 1249 } 1250 if (m14.type === KeyType.Down) { 1251 this.isOnClick = true; 1252 } 1253 if (m14.type === KeyType.Up) { 1254 this.isOnClick = false; 1255 } 1256 }); 1257 Button.onTouch((l14) => { 1258 if (!this.item?.isEnabled) { 1259 return; 1260 } 1261 if (l14.type === TouchType.Down) { 1262 this.isOnClick = true; 1263 } 1264 if (l14.type === TouchType.Up || l14.type === TouchType.Cancel) { 1265 this.isOnClick = false; 1266 if (this.fontSize >= this.minFontSize) { 1267 this.dialogController?.close(); 1268 } 1269 } 1270 }); 1271 Button.onClick(() => { 1272 if (this.item) { 1273 return this.item.isEnabled && this.item.action?.(); 1274 } 1275 }); 1276 }, Button); 1277 this.observeComponentCreation2((z13, a14) => { 1278 If.create(); 1279 if (this.item?.symbolStyle) { 1280 this.ifElseBranchUpdateFunction(0, () => { 1281 this.observeComponentCreation2((h14, i14) => { 1282 SymbolGlyph.create(); 1283 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1284 SymbolGlyph.attributeModifier.bind(this)(this.item?.symbolStyle); 1285 SymbolGlyph.fontSize(`${ImageMenuItem.imageSize}vp`); 1286 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1287 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1288 SymbolGlyph.draggable(false); 1289 SymbolGlyph.focusable(this.item?.isEnabled); 1290 SymbolGlyph.key(ImageMenuItem.focusablePrefix + this.index); 1291 }, SymbolGlyph); 1292 }); 1293 } 1294 else { 1295 this.ifElseBranchUpdateFunction(1, () => { 1296 this.observeComponentCreation2((b14, c14) => { 1297 If.create(); 1298 if (Util.isSymbolResource(this.item.value)) { 1299 this.ifElseBranchUpdateFunction(0, () => { 1300 this.observeComponentCreation2((f14, g14) => { 1301 SymbolGlyph.create(this.item.value); 1302 SymbolGlyph.fontSize(`${ImageMenuItem.imageSize}vp`); 1303 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1304 SymbolGlyph.draggable(false); 1305 SymbolGlyph.focusable(this.item?.isEnabled); 1306 SymbolGlyph.key(ImageMenuItem.focusablePrefix + this.index); 1307 }, SymbolGlyph); 1308 }); 1309 } 1310 else { 1311 this.ifElseBranchUpdateFunction(1, () => { 1312 this.observeComponentCreation2((d14, e14) => { 1313 Image.create(this.item?.value); 1314 Image.matchTextDirection(this.item?.value === PUBLIC_BACK ? true : false); 1315 Image.width(ImageMenuItem.imageSize); 1316 Image.draggable(false); 1317 Image.height(ImageMenuItem.imageSize); 1318 Image.focusable(this.item?.isEnabled); 1319 Image.key(ImageMenuItem.focusablePrefix + this.index); 1320 Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1321 }, Image); 1322 }); 1323 } 1324 }, If); 1325 If.pop(); 1326 }); 1327 } 1328 }, If); 1329 If.pop(); 1330 Button.pop(); 1331 } 1332 }); 1333 } 1334 }, If); 1335 If.pop(); 1336 } 1337 rerender() { 1338 this.updateDirtyElements(); 1339 } 1340} 1341ImageMenuItem.imageSize = 24; 1342ImageMenuItem.imageHotZoneWidth = 48; 1343ImageMenuItem.buttonBorderRadius = 8; 1344ImageMenuItem.focusBorderWidth = 2; 1345ImageMenuItem.focusablePrefix = 'Id-ComposeTitleBar-ImageMenuItem-'; 1346class ComposeTitleBarDialog extends ViewPU { 1347 constructor(r13, s13, t13, u13 = -1, v13 = undefined, w13) { 1348 super(r13, t13, u13, w13); 1349 if (typeof v13 === 'function') { 1350 this.paramsGenerator_ = v13; 1351 } 1352 this.itemComposeTitleDialog = {}; 1353 this.callbackId = undefined; 1354 this.composeTitleBarDialog = ''; 1355 this.mainWindowStage = undefined; 1356 this.controller = undefined; 1357 this.minFontSize = 1.75; 1358 this.maxFontSize = 3.2; 1359 this.screenWidth = 640; 1360 this.verticalScreenLines = 6; 1361 this.horizontalsScreenLines = 1; 1362 this.__mainWindow = this.createStorageLink('mainWindow', undefined, 'mainWindow'); 1363 this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize'); 1364 this.__maxLines = new ObservedPropertySimplePU(1, this, 'maxLines'); 1365 this.__windowStandardHeight = this.createStorageProp('windowStandardHeight', 0, 'windowStandardHeight'); 1366 this.cancel = () => { 1367 }; 1368 this.confirm = () => { 1369 }; 1370 this.setInitiallyProvidedValue(s13); 1371 this.finalizeConstruction(); 1372 } 1373 setInitiallyProvidedValue(q13) { 1374 if (q13.itemComposeTitleDialog !== undefined) { 1375 this.itemComposeTitleDialog = q13.itemComposeTitleDialog; 1376 } 1377 if (q13.callbackId !== undefined) { 1378 this.callbackId = q13.callbackId; 1379 } 1380 if (q13.composeTitleBarDialog !== undefined) { 1381 this.composeTitleBarDialog = q13.composeTitleBarDialog; 1382 } 1383 if (q13.mainWindowStage !== undefined) { 1384 this.mainWindowStage = q13.mainWindowStage; 1385 } 1386 if (q13.controller !== undefined) { 1387 this.controller = q13.controller; 1388 } 1389 if (q13.minFontSize !== undefined) { 1390 this.minFontSize = q13.minFontSize; 1391 } 1392 if (q13.maxFontSize !== undefined) { 1393 this.maxFontSize = q13.maxFontSize; 1394 } 1395 if (q13.screenWidth !== undefined) { 1396 this.screenWidth = q13.screenWidth; 1397 } 1398 if (q13.verticalScreenLines !== undefined) { 1399 this.verticalScreenLines = q13.verticalScreenLines; 1400 } 1401 if (q13.horizontalsScreenLines !== undefined) { 1402 this.horizontalsScreenLines = q13.horizontalsScreenLines; 1403 } 1404 if (q13.fontSize !== undefined) { 1405 this.fontSize = q13.fontSize; 1406 } 1407 if (q13.maxLines !== undefined) { 1408 this.maxLines = q13.maxLines; 1409 } 1410 if (q13.cancel !== undefined) { 1411 this.cancel = q13.cancel; 1412 } 1413 if (q13.confirm !== undefined) { 1414 this.confirm = q13.confirm; 1415 } 1416 } 1417 updateStateVars(p13) { 1418 } 1419 purgeVariableDependenciesOnElmtId(o13) { 1420 this.__mainWindow.purgeDependencyOnElmtId(o13); 1421 this.__fontSize.purgeDependencyOnElmtId(o13); 1422 this.__maxLines.purgeDependencyOnElmtId(o13); 1423 this.__windowStandardHeight.purgeDependencyOnElmtId(o13); 1424 } 1425 aboutToBeDeleted() { 1426 this.__mainWindow.aboutToBeDeleted(); 1427 this.__fontSize.aboutToBeDeleted(); 1428 this.__maxLines.aboutToBeDeleted(); 1429 this.__windowStandardHeight.aboutToBeDeleted(); 1430 SubscriberManager.Get().delete(this.id__()); 1431 this.aboutToBeDeletedInternal(); 1432 } 1433 setController(n13) { 1434 this.controller = n13; 1435 } 1436 get mainWindow() { 1437 return this.__mainWindow.get(); 1438 } 1439 set mainWindow(m13) { 1440 this.__mainWindow.set(m13); 1441 } 1442 get fontSize() { 1443 return this.__fontSize.get(); 1444 } 1445 set fontSize(l13) { 1446 this.__fontSize.set(l13); 1447 } 1448 get maxLines() { 1449 return this.__maxLines.get(); 1450 } 1451 set maxLines(k13) { 1452 this.__maxLines.set(k13); 1453 } 1454 get windowStandardHeight() { 1455 return this.__windowStandardHeight.get(); 1456 } 1457 set windowStandardHeight(j13) { 1458 this.__windowStandardHeight.set(j13); 1459 } 1460 initialRender() { 1461 this.observeComponentCreation2((f12, g12) => { 1462 If.create(); 1463 if (this.composeTitleBarDialog) { 1464 this.ifElseBranchUpdateFunction(0, () => { 1465 this.observeComponentCreation2((h13, i13) => { 1466 Column.create(); 1467 Column.width(this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG); 1468 Column.constraintSize({ minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG }); 1469 Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK, undefined, { disableSystemAdaptation: true }); 1470 Column.shadow(ShadowStyle.OUTER_DEFAULT_LG); 1471 Column.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.corner_radius_level10'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1472 }, Column); 1473 this.observeComponentCreation2((x12, y12) => { 1474 If.create(); 1475 if (this.itemComposeTitleDialog.symbolStyle) { 1476 this.ifElseBranchUpdateFunction(0, () => { 1477 this.observeComponentCreation2((f13, g13) => { 1478 SymbolGlyph.create(); 1479 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1480 SymbolGlyph.attributeModifier.bind(this)(this.itemComposeTitleDialog.symbolStyle); 1481 SymbolGlyph.fontSize(IMAGE_SIZE); 1482 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1483 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1484 SymbolGlyph.margin({ 1485 top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level24'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1486 bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1487 }); 1488 }, SymbolGlyph); 1489 }); 1490 } 1491 else { 1492 this.ifElseBranchUpdateFunction(1, () => { 1493 this.observeComponentCreation2((z12, a13) => { 1494 If.create(); 1495 if (Util.isSymbolResource(this.itemComposeTitleDialog.value)) { 1496 this.ifElseBranchUpdateFunction(0, () => { 1497 this.observeComponentCreation2((d13, e13) => { 1498 SymbolGlyph.create(this.itemComposeTitleDialog.value); 1499 SymbolGlyph.fontSize(IMAGE_SIZE); 1500 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1501 SymbolGlyph.margin({ 1502 top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level24'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1503 bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1504 }); 1505 }, SymbolGlyph); 1506 }); 1507 } 1508 else { 1509 this.ifElseBranchUpdateFunction(1, () => { 1510 this.observeComponentCreation2((b13, c13) => { 1511 Image.create(this.itemComposeTitleDialog.value); 1512 Image.width(IMAGE_SIZE); 1513 Image.height(IMAGE_SIZE); 1514 Image.margin({ 1515 top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level24'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1516 bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1517 }); 1518 Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1519 }, Image); 1520 }); 1521 } 1522 }, If); 1523 If.pop(); 1524 }); 1525 } 1526 }, If); 1527 If.pop(); 1528 this.observeComponentCreation2((v12, w12) => { 1529 Column.create(); 1530 Column.width('100%'); 1531 Column.padding({ 1532 left: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level4'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1533 right: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level4'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1534 bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level12'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1535 }); 1536 }, Column); 1537 this.observeComponentCreation2((t12, u12) => { 1538 Text.create(this.composeTitleBarDialog); 1539 Text.fontSize(TEXT_EDITABLE_DIALOG); 1540 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 1541 Text.maxLines(this.maxLines); 1542 Text.width('100%'); 1543 Text.textAlign(TextAlign.Center); 1544 Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1545 }, Text); 1546 Text.pop(); 1547 Column.pop(); 1548 Column.pop(); 1549 }); 1550 } 1551 else { 1552 this.ifElseBranchUpdateFunction(1, () => { 1553 this.observeComponentCreation2((r12, s12) => { 1554 Column.create(); 1555 Column.width(this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG); 1556 Column.constraintSize({ minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG }); 1557 Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK, undefined, { disableSystemAdaptation: true }); 1558 Column.shadow(ShadowStyle.OUTER_DEFAULT_LG); 1559 Column.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.corner_radius_level10'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1560 Column.justifyContent(FlexAlign.Center); 1561 }, Column); 1562 this.observeComponentCreation2((h12, i12) => { 1563 If.create(); 1564 if (this.itemComposeTitleDialog.symbolStyle) { 1565 this.ifElseBranchUpdateFunction(0, () => { 1566 this.observeComponentCreation2((p12, q12) => { 1567 SymbolGlyph.create(); 1568 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1569 SymbolGlyph.attributeModifier.bind(this)(this.itemComposeTitleDialog.symbolStyle); 1570 SymbolGlyph.fontSize(IMAGE_SIZE); 1571 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1572 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1573 }, SymbolGlyph); 1574 }); 1575 } 1576 else { 1577 this.ifElseBranchUpdateFunction(1, () => { 1578 this.observeComponentCreation2((j12, k12) => { 1579 If.create(); 1580 if (Util.isSymbolResource(this.itemComposeTitleDialog.value)) { 1581 this.ifElseBranchUpdateFunction(0, () => { 1582 this.observeComponentCreation2((n12, o12) => { 1583 SymbolGlyph.create(this.itemComposeTitleDialog.value); 1584 SymbolGlyph.fontSize(IMAGE_SIZE); 1585 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1586 }, SymbolGlyph); 1587 }); 1588 } 1589 else { 1590 this.ifElseBranchUpdateFunction(1, () => { 1591 this.observeComponentCreation2((l12, m12) => { 1592 Image.create(this.itemComposeTitleDialog.value); 1593 Image.width(IMAGE_SIZE); 1594 Image.height(IMAGE_SIZE); 1595 Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1596 }, Image); 1597 }); 1598 } 1599 }, If); 1600 If.pop(); 1601 }); 1602 } 1603 }, If); 1604 If.pop(); 1605 Column.pop(); 1606 }); 1607 } 1608 }, If); 1609 If.pop(); 1610 } 1611 async aboutToAppear() { 1612 try { 1613 let c12 = this.getUIContext().getHostContext(); 1614 this.mainWindowStage = c12.windowStage.getMainWindowSync(); 1615 let d12 = this.mainWindowStage.getWindowProperties(); 1616 let e12 = d12.windowRect; 1617 if (px2vp(e12.height) > this.screenWidth) { 1618 this.maxLines = this.verticalScreenLines; 1619 } else { 1620 this.maxLines = this.horizontalsScreenLines; 1621 } 1622 } catch (u18) { 1623 let v18 = u18?.code; 1624 let w18 = u18?.message; 1625 hilog.error(0x3900, 'ComposeTitleBar', 1626 `Failed to init getMainWindowSync info, cause, code: ${v18}, message: ${w18}`); 1627 } 1628 } 1629 rerender() { 1630 this.updateDirtyElements(); 1631 } 1632} 1633export default { ComposeTitleBar };