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 16let TextModifier; 17if (globalThis.__hasUIFramework__) { 18 TextModifier = requireNapi('arkui.modifier').TextModifier; 19} else { 20 TextModifier = requireNapi('arkui.mock').TextModifier; 21} 22 23var _a; 24if (!('finalizeConstruction' in ViewPU.prototype)) { 25 Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => { 26 }); 27} 28 29const arkuiNode = requireNapi('arkui.node'); 30const LengthMetrics = arkuiNode.LengthMetrics; 31const ColorMetrics = arkuiNode.ColorMetrics; 32const LengthUnit = arkuiNode.LengthUnit; 33const resourceManager = requireNapi('resourceManager'); 34const BusinessError = requireNapi('base'); 35const common = requireNapi('app.ability.common'); 36const hilog = requireNapi('hilog'); 37const HashMap = requireNapi('util.HashMap'); 38const KeyCode = requireNapi('multimodalInput.keyCode').KeyCode; 39 40const INDEX_ZERO = 0; 41const INDEX_ONE = 1; 42const INDEX_TWO = 2; 43const DEFAULT_FONT_SCALE = 1; 44const SINGLE_LINE_NUM = 1; 45const DOUBLE_LINE_NUM = 2; 46const RESOURCE_TYPE_SYMBOL = 40000; 47const LEFT_ICON_SIZE_NUMBER = 16; 48const LEFT_TEXT_NUMBER = 8; 49const OPERATE_ITEM_LENGTH = 24; 50const ARROW_ICON_WIDTH = 12; 51const SINGLE_ICON_ZONE_SIZE = 28; 52const RIGHT_SINGLE_ICON_SIZE = '24vp'; 53const PADDING_LEVEL_2 = 4; 54const MAX_RIGHT_WIDTH = '34%'; 55const MIN_FONT_SIZE = 1.75; 56const MIN_HOT_AREA_LENGTH = 40; 57const MULTI_ICON_REGION_WIDTH = 37; 58const ICON_REGION_X = -9; 59const ICON_REGION_Y = -6; 60const SINGLE_ICON_REGION_X = -12; 61const SINGLE_ICON_NUMBER = 1; 62const PADDING_LEFT = 2; 63 64export var OperationType; 65(function (l16) { 66 l16[l16['TEXT_ARROW'] = 0] = 'TEXT_ARROW'; 67 l16[l16['BUTTON'] = 1] = 'BUTTON'; 68 l16[l16['ICON_GROUP'] = 2] = 'ICON_GROUP'; 69 l16[l16['LOADING'] = 3] = 'LOADING'; 70})(OperationType || (OperationType = {})); 71 72class IconOptions { 73} 74 75class ContentIconOption { 76} 77 78class FontStyle { 79 constructor() { 80 this.maxLines = 0; 81 this.fontWeight = 0; 82 } 83} 84 85class SubHeaderTheme { 86 constructor() { 87 this.fontPrimaryColor = { 88 'id': -1, 89 'type': 10001, 90 params: ['sys.color.font_primary'], 91 'bundleName': '__harDefaultBundleName__', 92 'moduleName': '__harDefaultModuleName__', 93 }; 94 this.fontSecondaryColor = { 95 'id': -1, 96 'type': 10001, 97 params: ['sys.color.font_secondary'], 98 'bundleName': '__harDefaultBundleName__', 99 'moduleName': '__harDefaultModuleName__', 100 }; 101 this.fontButtonColor = { 102 'id': -1, 103 'type': 10001, 104 params: ['sys.color.font_emphasize'], 105 'bundleName': '__harDefaultBundleName__', 106 'moduleName': '__harDefaultModuleName__', 107 }; 108 this.iconArrowColor = { 109 'id': -1, 110 'type': 10001, 111 params: ['sys.color.icon_tertiary'], 112 'bundleName': '__harDefaultBundleName__', 113 'moduleName': '__harDefaultModuleName__', 114 }; 115 this.textArrowHoverBgColor = { 116 'id': -1, 117 'type': 10001, 118 params: ['sys.color.interactive_hover'], 119 'bundleName': '__harDefaultBundleName__', 120 'moduleName': '__harDefaultModuleName__', 121 }; 122 this.borderFocusColor = { 123 'id': -1, 124 'type': 10001, 125 params: ['sys.color.interactive_focus'], 126 'bundleName': '__harDefaultBundleName__', 127 'moduleName': '__harDefaultModuleName__', 128 }; 129 this.leftIconColor = { 130 'id': -1, 131 'type': 10001, 132 params: ['sys.color.icon_secondary'], 133 'bundleName': '__harDefaultBundleName__', 134 'moduleName': '__harDefaultModuleName__', 135 }; 136 this.rightIconColor = { 137 'id': -1, 138 'type': 10001, 139 params: ['sys.color.icon_primary'], 140 'bundleName': '__harDefaultBundleName__', 141 'moduleName': '__harDefaultModuleName__', 142 }; 143 } 144} 145 146function __Text__secondaryTitleStyles(k16) { 147 Text.fontSize(`${getResourceValue('sys.float.Subtitle_S')}fp`); 148 Text.fontColor(k16?.fontColor ?? { 149 'id': -1, 150 'type': 10001, 151 params: ['sys.color.font_secondary'], 152 'bundleName': '__harDefaultBundleName__', 153 'moduleName': '__harDefaultModuleName__', 154 }); 155 Text.fontWeight(k16?.fontWeight); 156 Text.maxLines(k16?.maxLines); 157 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 158 Text.align(k16?.alignment); 159} 160 161function __Text__primaryTitleStyles(j16) { 162 Text.fontSize(`${getResourceValue('sys.float.subheader_title_font_size')}fp`); 163 Text.fontColor(j16?.fontColor ?? { 164 'id': -1, 165 'type': 10001, 166 params: ['sys.color.font_primary'], 167 'bundleName': '__harDefaultBundleName__', 168 'moduleName': '__harDefaultModuleName__', 169 }); 170 Text.fontWeight(j16?.fontWeight); 171 Text.maxLines(j16?.maxLines); 172 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 173 Text.align(j16?.alignment); 174} 175 176class SubHeaderModifier { 177 constructor() { 178 this.isAgeing = false; 179 } 180 181 applyNormalAttribute(i16) { 182 if (this.isAgeing) { 183 i16.width('100%'); 184 } else { 185 } 186 } 187} 188 189const RESOURCE_CACHE_MAP = new HashMap(); 190RESOURCE_CACHE_MAP.set('sys.float.padding_level0', { resourceId: 125830919, defaultValue: 0 }); 191RESOURCE_CACHE_MAP.set('sys.float.padding_level1', { resourceId: 125830920, defaultValue: 2 }); 192RESOURCE_CACHE_MAP.set('sys.float.padding_level2', { resourceId: 125830921, defaultValue: 4 }); 193RESOURCE_CACHE_MAP.set('sys.float.padding_level3', { resourceId: 125830922, defaultValue: 6 }); 194RESOURCE_CACHE_MAP.set('sys.float.padding_level4', { resourceId: 125830923, defaultValue: 8 }); 195RESOURCE_CACHE_MAP.set('sys.float.padding_level6', { resourceId: 125830925, defaultValue: 12 }); 196RESOURCE_CACHE_MAP.set('sys.float.padding_level8', { resourceId: 125830927, defaultValue: 16 }); 197RESOURCE_CACHE_MAP.set('sys.float.margin_left', { resourceId: 125830936, defaultValue: 16 }); 198RESOURCE_CACHE_MAP.set('sys.float.margin_right', { resourceId: 125830937, defaultValue: 16 }); 199RESOURCE_CACHE_MAP.set('sys.float.outline_extra_larger', { resourceId: 125830951, defaultValue: 2 }); 200RESOURCE_CACHE_MAP.set('sys.float.corner_radius_level4', { resourceId: 125830909, defaultValue: 8 }); 201RESOURCE_CACHE_MAP.set('sys.float.Subtitle_S', { resourceId: 125830969, defaultValue: 14 }); 202RESOURCE_CACHE_MAP.set('sys.float.subheader_title_font_size', { resourceId: 125834265, defaultValue: 18 }); 203RESOURCE_CACHE_MAP.set('sys.float.Body_L', { resourceId: 125830970, defaultValue: 16 }); 204RESOURCE_CACHE_MAP.set('sys.float.interactive_disable', { resourceId: 125831067, defaultValue: 0.4 }); 205RESOURCE_CACHE_MAP.set('sys.float.subheader_single_title_height', { resourceId: 125834252, defaultValue: 56 }); 206RESOURCE_CACHE_MAP.set('sys.float.subheader_single_subtitle_height', { resourceId: 125834253, defaultValue: 56 }); 207RESOURCE_CACHE_MAP.set('sys.float.subheader_double_height', { resourceId: 125834254, defaultValue: 72 }); 208RESOURCE_CACHE_MAP.set('sys.float.subheader_title_font_weight', { resourceId: 125834255, defaultValue: 700 }); 209RESOURCE_CACHE_MAP.set('sys.float.subheader_left_icon_size', { resourceId: 125835678, defaultValue: 16 }); 210RESOURCE_CACHE_MAP.set('sys.float.subheader_content_margin_start', { resourceId: 125835679, defaultValue: 16 }); 211RESOURCE_CACHE_MAP.set('sys.float.subheader_content_margin_end', { resourceId: 125835680, defaultValue: 16 }); 212RESOURCE_CACHE_MAP.set('sys.float.subheader_content_padding', { resourceId: 125835681, defaultValue: 8 }); 213RESOURCE_CACHE_MAP.set('sys.float.subheader_single_subtitle_padding', { resourceId: 125835682, defaultValue: 12 }); 214RESOURCE_CACHE_MAP.set('sys.float.subheader_select_padding', { resourceId: 125835683, defaultValue: 4 }); 215RESOURCE_CACHE_MAP.set('sys.float.subheader_left_icon_end_margin', { resourceId: 125835684, defaultValue: 8 }); 216RESOURCE_CACHE_MAP.set('sys.float.subheader_subtitle_font_weight', { resourceId: 125835685, defaultValue: 400 }); 217RESOURCE_CACHE_MAP.set('sys.float.subheader_titles_space', { resourceId: 125835686, defaultValue: 2 }); 218 219export class SubHeader extends ViewPU { 220 constructor(c16, d16, e16, f16 = -1, g16 = undefined, h16) { 221 super(c16, e16, f16, h16); 222 if (typeof g16 === 'function') { 223 this.paramsGenerator_ = g16; 224 } 225 this.__icon = new SynchedPropertyObjectOneWayPU(d16.icon, this, 'icon'); 226 this.iconSymbolOptions = null; 227 this.__primaryTitle = new SynchedPropertyObjectOneWayPU(d16.primaryTitle, this, 'primaryTitle'); 228 this.__primaryTitleModifier = new ObservedPropertyObjectPU(new TextModifier(), this, 'primaryTitleModifier'); 229 this.__secondaryTitle = new SynchedPropertyObjectOneWayPU(d16.secondaryTitle, this, 'secondaryTitle'); 230 this.__secondaryTitleModifier = 231 new ObservedPropertyObjectPU(new TextModifier(), this, 'secondaryTitleModifier'); 232 this.__subHeaderModifier = new ObservedPropertyObjectPU(new SubHeaderModifier(), this, 'subHeaderModifier'); 233 this.select = null; 234 this.__operationType = new SynchedPropertySimpleOneWayPU(d16.operationType, this, 'operationType'); 235 this.operationItem = null; 236 this.operationSymbolOptions = null; 237 this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize'); 238 this.__ageing = new ObservedPropertySimplePU(true, this, 'ageing'); 239 this.__textArrowBgColor = new ObservedPropertyObjectPU({ 240 'id': -1, 241 'type': 10001, 242 params: ['sys.color.ohos_id_color_sub_background_transparent'], 243 'bundleName': '__harDefaultBundleName__', 244 'moduleName': '__harDefaultModuleName__', 245 }, this, 'textArrowBgColor'); 246 this.__buttonBgColor = new ObservedPropertyObjectPU({ 247 'id': -1, 248 'type': 10001, 249 params: ['sys.color.ohos_id_color_sub_background_transparent'], 250 'bundleName': '__harDefaultBundleName__', 251 'moduleName': '__harDefaultModuleName__', 252 }, this, 'buttonBgColor'); 253 this.__selectedIndex = new ObservedPropertyObjectPU(-1, this, 'selectedIndex'); 254 this.__selectValue = new ObservedPropertyObjectPU('', this, 'selectValue'); 255 this.titleBuilder = undefined; 256 this.__contentMargin = new SynchedPropertyObjectOneWayPU(d16.contentMargin, this, 'contentMargin'); 257 this.__contentPadding = new SynchedPropertyObjectOneWayPU(d16.contentPadding, this, 'contentPadding'); 258 this.subHeaderMargin = { 259 start: LengthMetrics.vp(getResourceValue('sys.float.subheader_content_margin_start')), 260 end: LengthMetrics.vp(getResourceValue('sys.float.subheader_content_margin_end')), 261 }; 262 this.__subHeaderTheme = new ObservedPropertyObjectPU(new SubHeaderTheme(), this, 'subHeaderTheme'); 263 this.addProvidedVar('subHeaderTheme', this.__subHeaderTheme, false); 264 this.isFollowingSystemFontScale = false; 265 this.appMaxFontScale = 3.2; 266 this.setInitiallyProvidedValue(d16); 267 this.finalizeConstruction(); 268 } 269 270 setInitiallyProvidedValue(b16) { 271 if (b16.icon === undefined) { 272 this.__icon.set(null); 273 } 274 if (b16.iconSymbolOptions !== undefined) { 275 this.iconSymbolOptions = b16.iconSymbolOptions; 276 } 277 if (b16.primaryTitle === undefined) { 278 this.__primaryTitle.set(null); 279 } 280 if (b16.primaryTitleModifier !== undefined) { 281 this.primaryTitleModifier = b16.primaryTitleModifier; 282 } 283 if (b16.secondaryTitle === undefined) { 284 this.__secondaryTitle.set(null); 285 } 286 if (b16.secondaryTitleModifier !== undefined) { 287 this.secondaryTitleModifier = b16.secondaryTitleModifier; 288 } 289 if (b16.subHeaderModifier !== undefined) { 290 this.subHeaderModifier = b16.subHeaderModifier; 291 } 292 if (b16.select !== undefined) { 293 this.select = b16.select; 294 } 295 if (b16.operationType === undefined) { 296 this.__operationType.set(OperationType.BUTTON); 297 } 298 if (b16.operationItem !== undefined) { 299 this.operationItem = b16.operationItem; 300 } 301 if (b16.operationSymbolOptions !== undefined) { 302 this.operationSymbolOptions = b16.operationSymbolOptions; 303 } 304 if (b16.fontSize !== undefined) { 305 this.fontSize = b16.fontSize; 306 } 307 if (b16.ageing !== undefined) { 308 this.ageing = b16.ageing; 309 } 310 if (b16.textArrowBgColor !== undefined) { 311 this.textArrowBgColor = b16.textArrowBgColor; 312 } 313 if (b16.buttonBgColor !== undefined) { 314 this.buttonBgColor = b16.buttonBgColor; 315 } 316 if (b16.selectedIndex !== undefined) { 317 this.selectedIndex = b16.selectedIndex; 318 } 319 if (b16.selectValue !== undefined) { 320 this.selectValue = b16.selectValue; 321 } 322 if (b16.titleBuilder !== undefined) { 323 this.titleBuilder = b16.titleBuilder; 324 } 325 if (b16.subHeaderMargin !== undefined) { 326 this.subHeaderMargin = b16.subHeaderMargin; 327 } 328 if (b16.subHeaderTheme !== undefined) { 329 this.subHeaderTheme = b16.subHeaderTheme; 330 } 331 if (b16.isFollowingSystemFontScale !== undefined) { 332 this.isFollowingSystemFontScale = b16.isFollowingSystemFontScale; 333 } 334 if (b16.appMaxFontScale !== undefined) { 335 this.appMaxFontScale = b16.appMaxFontScale; 336 } 337 } 338 339 updateStateVars(a16) { 340 this.__icon.reset(a16.icon); 341 this.__primaryTitle.reset(a16.primaryTitle); 342 this.__secondaryTitle.reset(a16.secondaryTitle); 343 this.__operationType.reset(a16.operationType); 344 this.__contentMargin.reset(a16.contentMargin); 345 this.__contentPadding.reset(a16.contentPadding); 346 } 347 348 purgeVariableDependenciesOnElmtId(z15) { 349 this.__icon.purgeDependencyOnElmtId(z15); 350 this.__primaryTitle.purgeDependencyOnElmtId(z15); 351 this.__primaryTitleModifier.purgeDependencyOnElmtId(z15); 352 this.__secondaryTitle.purgeDependencyOnElmtId(z15); 353 this.__secondaryTitleModifier.purgeDependencyOnElmtId(z15); 354 this.__subHeaderModifier.purgeDependencyOnElmtId(z15); 355 this.__operationType.purgeDependencyOnElmtId(z15); 356 this.__fontSize.purgeDependencyOnElmtId(z15); 357 this.__ageing.purgeDependencyOnElmtId(z15); 358 this.__textArrowBgColor.purgeDependencyOnElmtId(z15); 359 this.__buttonBgColor.purgeDependencyOnElmtId(z15); 360 this.__selectedIndex.purgeDependencyOnElmtId(z15); 361 this.__selectValue.purgeDependencyOnElmtId(z15); 362 this.__contentMargin.purgeDependencyOnElmtId(z15); 363 this.__contentPadding.purgeDependencyOnElmtId(z15); 364 this.__subHeaderTheme.purgeDependencyOnElmtId(z15); 365 } 366 367 aboutToBeDeleted() { 368 this.__icon.aboutToBeDeleted(); 369 this.__primaryTitle.aboutToBeDeleted(); 370 this.__primaryTitleModifier.aboutToBeDeleted(); 371 this.__secondaryTitle.aboutToBeDeleted(); 372 this.__secondaryTitleModifier.aboutToBeDeleted(); 373 this.__subHeaderModifier.aboutToBeDeleted(); 374 this.__operationType.aboutToBeDeleted(); 375 this.__fontSize.aboutToBeDeleted(); 376 this.__ageing.aboutToBeDeleted(); 377 this.__textArrowBgColor.aboutToBeDeleted(); 378 this.__buttonBgColor.aboutToBeDeleted(); 379 this.__selectedIndex.aboutToBeDeleted(); 380 this.__selectValue.aboutToBeDeleted(); 381 this.__contentMargin.aboutToBeDeleted(); 382 this.__contentPadding.aboutToBeDeleted(); 383 this.__subHeaderTheme.aboutToBeDeleted(); 384 SubscriberManager.Get().delete(this.id__()); 385 this.aboutToBeDeletedInternal(); 386 } 387 388 get icon() { 389 return this.__icon.get(); 390 } 391 392 set icon(y15) { 393 this.__icon.set(y15); 394 } 395 396 get primaryTitle() { 397 return this.__primaryTitle.get(); 398 } 399 400 set primaryTitle(x15) { 401 this.__primaryTitle.set(x15); 402 } 403 404 get primaryTitleModifier() { 405 return this.__primaryTitleModifier.get(); 406 } 407 408 set primaryTitleModifier(w15) { 409 this.__primaryTitleModifier.set(w15); 410 } 411 412 get secondaryTitle() { 413 return this.__secondaryTitle.get(); 414 } 415 416 set secondaryTitle(v15) { 417 this.__secondaryTitle.set(v15); 418 } 419 420 get secondaryTitleModifier() { 421 return this.__secondaryTitleModifier.get(); 422 } 423 424 set secondaryTitleModifier(u15) { 425 this.__secondaryTitleModifier.set(u15); 426 } 427 428 get subHeaderModifier() { 429 return this.__subHeaderModifier.get(); 430 } 431 432 set subHeaderModifier(t15) { 433 this.__subHeaderModifier.set(t15); 434 } 435 436 get operationType() { 437 return this.__operationType.get(); 438 } 439 440 set operationType(s15) { 441 this.__operationType.set(s15); 442 } 443 444 get fontSize() { 445 return this.__fontSize.get(); 446 } 447 448 set fontSize(r15) { 449 this.__fontSize.set(r15); 450 } 451 452 get ageing() { 453 return this.__ageing.get(); 454 } 455 456 set ageing(q15) { 457 this.__ageing.set(q15); 458 } 459 460 get textArrowBgColor() { 461 return this.__textArrowBgColor.get(); 462 } 463 464 set textArrowBgColor(p15) { 465 this.__textArrowBgColor.set(p15); 466 } 467 468 get buttonBgColor() { 469 return this.__buttonBgColor.get(); 470 } 471 472 set buttonBgColor(o15) { 473 this.__buttonBgColor.set(o15); 474 } 475 476 get selectedIndex() { 477 return this.__selectedIndex.get(); 478 } 479 480 set selectedIndex(n15) { 481 this.__selectedIndex.set(n15); 482 } 483 484 get selectValue() { 485 return this.__selectValue.get(); 486 } 487 488 set selectValue(m15) { 489 this.__selectValue.set(m15); 490 } 491 492 get contentMargin() { 493 return this.__contentMargin.get(); 494 } 495 496 set contentMargin(l15) { 497 this.__contentMargin.set(l15); 498 } 499 500 get contentPadding() { 501 return this.__contentPadding.get(); 502 } 503 504 set contentPadding(k15) { 505 this.__contentPadding.set(k15); 506 } 507 508 get subHeaderTheme() { 509 return this.__subHeaderTheme.get(); 510 } 511 512 set subHeaderTheme(j15) { 513 this.__subHeaderTheme.set(j15); 514 } 515 516 onWillApplyTheme(i15) { 517 this.subHeaderTheme.fontPrimaryColor = i15.colors.fontPrimary; 518 this.subHeaderTheme.fontSecondaryColor = i15.colors.fontSecondary; 519 this.subHeaderTheme.fontButtonColor = i15.colors.fontEmphasize; 520 this.subHeaderTheme.iconArrowColor = i15.colors.iconTertiary; 521 this.subHeaderTheme.textArrowHoverBgColor = i15.colors.interactiveHover; 522 this.subHeaderTheme.borderFocusColor = i15.colors.interactiveFocus; 523 this.subHeaderTheme.leftIconColor = i15.colors.iconSecondary; 524 this.subHeaderTheme.rightIconColor = i15.colors.iconPrimary; 525 } 526 527 updateFontScale() { 528 try { 529 let g15 = this.getUIContext(); 530 let h15 = g15?.getHostContext()?.config?.fontSizeScale ?? 1; 531 if (!this.isFollowingSystemFontScale) { 532 return 1; 533 } 534 return Math.min(h15, this.appMaxFontScale); 535 } catch (d15) { 536 let e15 = d15.code; 537 let f15 = d15.message; 538 hilog.error(0x3900, 'Ace', `Faild to init fontsizescale info,cause, code: ${e15}, message: ${f15}`); 539 return 1; 540 } 541 } 542 543 async aboutToAppear() { 544 let c15 = this.getUIContext(); 545 this.isFollowingSystemFontScale = c15.isFollowingSystemFontScale(); 546 this.appMaxFontScale = c15.getMaxFontScale(); 547 this.fontSize = this.updateFontScale(); 548 if (this.isSuitableAging()) { 549 this.ageing = true; 550 this.subHeaderModifier.isAgeing = this.ageing; 551 } else { 552 this.ageing = false; 553 this.subHeaderModifier.isAgeing = this.ageing; 554 } 555 if (this.select) { 556 this.selectedIndex = this.select.selected; 557 this.selectValue = this.select.value; 558 } 559 } 560 561 isSuitableAging() { 562 return (this.fontSize >= MIN_FONT_SIZE) && ((this.operationType === OperationType.TEXT_ARROW) || 563 this.operationType === OperationType.BUTTON) && this.operationItem && 564 (this.operationItem?.length > 0) && this.operationItem[0].value !== ''; 565 } 566 567 isLeftAreaAccessibilityGroup() { 568 if (this.titleBuilder || this.secondaryTitle) { 569 return true; 570 } 571 if (this.select) { 572 return false; 573 } 574 return true; 575 } 576 577 initialRender() { 578 this.observeComponentCreation2((c14, d14) => { 579 If.create(); 580 if (this.isSuitableAging()) { 581 this.ifElseBranchUpdateFunction(0, () => { 582 this.observeComponentCreation2((a15, b15) => { 583 Column.create(); 584 Column.constraintSize({ minHeight: this.getMinHeight() }); 585 Column.padding(this.getAreaPadding()); 586 Column.alignItems(HorizontalAlign.Start); 587 }, Column); 588 this.observeComponentCreation2((y14, z14) => { 589 Row.create(); 590 Row.margin({ 591 top: LengthMetrics.vp(getResourceValue('sys.float.padding_level8')), 592 bottom: LengthMetrics.vp(getResourceValue('sys.float.padding_level1')), 593 }); 594 Row.padding({ 595 start: this.contentMargin ? this.contentMargin.start : 596 LengthMetrics.vp(getResourceValue('sys.float.margin_left')), 597 end: this.contentMargin ? this.contentMargin.end : 598 LengthMetrics.vp(getResourceValue('sys.float.margin_right')), 599 }); 600 Row.width('100%'); 601 Row.accessibilityGroup(this.isLeftAreaAccessibilityGroup()); 602 Row.accessibilityRole(this.select ? undefined : AccessibilityRoleType.TITLE_BAR); 603 }, Row); 604 this.leftArea.bind(this)(); 605 Row.pop(); 606 this.observeComponentCreation2((u14, v14) => { 607 If.create(); 608 if (this.isRightAreaExists()) { 609 this.ifElseBranchUpdateFunction(0, () => { 610 this.rightAreaParentAging.bind(this)(); 611 }); 612 } else { 613 this.ifElseBranchUpdateFunction(1, () => { 614 }); 615 } 616 }, If); 617 If.pop(); 618 Column.pop(); 619 }); 620 } else { 621 this.ifElseBranchUpdateFunction(1, () => { 622 this.observeComponentCreation2((o14, p14) => { 623 Flex.create({ direction: FlexDirection.Row, alignItems: ItemAlign.End }); 624 Flex.constraintSize({ minHeight: this.getMinHeight() }); 625 Flex.margin(this.contentMargin ?? this.subHeaderMargin); 626 Flex.padding(this.getAreaPadding()); 627 }, Flex); 628 this.observeComponentCreation2((m14, n14) => { 629 Row.create(); 630 Row.margin({ 631 top: this.fontSize >= MIN_FONT_SIZE ? getResourceValue('sys.float.padding_level8') : '', 632 bottom: this.fontSize >= MIN_FONT_SIZE ? getResourceValue('sys.float.padding_level4') : '', 633 }); 634 Row.width('100%'); 635 Row.flexShrink(1); 636 Row.accessibilityGroup(this.isLeftAreaAccessibilityGroup()); 637 Row.accessibilityRole(this.select ? undefined : AccessibilityRoleType.TITLE_BAR); 638 }, Row); 639 this.leftArea.bind(this)(); 640 Row.pop(); 641 this.observeComponentCreation2((i14, j14) => { 642 If.create(); 643 if (this.isRightAreaExists()) { 644 this.ifElseBranchUpdateFunction(0, () => { 645 this.rightAreaParent.bind(this)(); 646 }); 647 } else { 648 this.ifElseBranchUpdateFunction(1, () => { 649 }); 650 } 651 }, If); 652 If.pop(); 653 Flex.pop(); 654 }); 655 } 656 }, If); 657 If.pop(); 658 } 659 660 isRightAreaExists() { 661 if (this.operationItem && this.operationItem.length > 0) { 662 return true; 663 } 664 if (this.operationType === OperationType.LOADING) { 665 return true; 666 } 667 return false; 668 } 669 670 getRightAreaAccessibilityLevel() { 671 if (this.operationItem[0].accessibilityLevel && this.operationItem[0].accessibilityLevel !== '') { 672 return this.operationItem[0].accessibilityLevel; 673 } 674 return 'yes'; 675 } 676 677 getRightAreaAccessibilityText() { 678 if (!this.operationItem || this.operationItem.length <= 0) { 679 return ''; 680 } 681 if (this.operationItem[0].accessibilityText && this.operationItem[0].accessibilityText !== '') { 682 return this.operationItem[0].accessibilityText; 683 } else { 684 if (this.operationType === OperationType.TEXT_ARROW && this.operationItem[0].value.toString().length <= 0) { 685 return Util.getStringByResource(125833704, ''); 686 } 687 } 688 return ''; 689 } 690 691 getAccessibilityDescription() { 692 if (!this.operationItem || this.operationItem.length <= 0) { 693 return ''; 694 } 695 if (this.operationItem[0].accessibilityDescription && this.operationItem[0].accessibilityDescription !== '') { 696 return this.operationItem[0].accessibilityDescription; 697 } 698 return ''; 699 } 700 701 rightAreaParentAging(f13 = null) { 702 this.observeComponentCreation2((h13, i13) => { 703 If.create(); 704 if (this.operationType === OperationType.BUTTON || this.operationType === OperationType.TEXT_ARROW) { 705 this.ifElseBranchUpdateFunction(0, () => { 706 this.observeComponentCreation2((u13, v13) => { 707 Button.createWithChild({ type: ButtonType.Normal, stateEffect: false }); 708 Button.focusable(this.operationItem ? true : false); 709 Button.align(Alignment.Start); 710 Button.onKeyEvent((a14) => { 711 if (!a14) { 712 return; 713 } 714 if ((a14.keyCode === KeyCode.KEYCODE_SPACE || a14.keyCode === KeyCode.KEYCODE_ENTER) && 715 a14.type === KeyType.Down) { 716 if ((this.operationType === OperationType.TEXT_ARROW || 717 this.operationType === OperationType.BUTTON) && 718 this.operationItem && this.operationItem.length > 0 && this.operationItem[0].action) { 719 this.operationItem[0].action(); 720 } 721 a14.stopPropagation(); 722 } 723 }); 724 Button.onClick(() => { 725 if ((this.operationType === OperationType.TEXT_ARROW || 726 this.operationType === OperationType.BUTTON) && 727 this.operationItem && this.operationItem.length > 0 && this.operationItem[0].action) { 728 this.operationItem[0].action(); 729 } 730 }); 731 Button.onTouch((z13) => { 732 if (z13.type === TouchType.Down) { 733 if (this.operationType === OperationType.TEXT_ARROW) { 734 this.textArrowBgColor = { 735 'id': -1, 736 'type': 10001, 737 params: ['sys.color.interactive_pressed'], 738 'bundleName': '__harDefaultBundleName__', 739 'moduleName': '__harDefaultModuleName__', 740 }; 741 } 742 if (this.operationType === OperationType.BUTTON) { 743 this.buttonBgColor = { 744 'id': -1, 745 'type': 10001, 746 params: ['sys.color.interactive_pressed'], 747 'bundleName': '__harDefaultBundleName__', 748 'moduleName': '__harDefaultModuleName__', 749 }; 750 } 751 } 752 if (z13.type === TouchType.Up || z13.type === TouchType.Cancel) { 753 if (this.operationType === OperationType.TEXT_ARROW) { 754 this.textArrowBgColor = { 755 'id': -1, 756 'type': 10001, 757 params: ['sys.color.ohos_id_color_sub_background_transparent'], 758 'bundleName': '__harDefaultBundleName__', 759 'moduleName': '__harDefaultModuleName__', 760 }; 761 } 762 if (this.operationType === OperationType.BUTTON) { 763 this.buttonBgColor = { 764 'id': -1, 765 'type': 10001, 766 params: ['sys.color.ohos_id_color_sub_background_transparent'], 767 'bundleName': '__harDefaultBundleName__', 768 'moduleName': '__harDefaultModuleName__', 769 }; 770 } 771 } 772 }); 773 Button.margin({ 774 bottom: getResourceValue('sys.float.padding_level4'), 775 }); 776 Button.padding({ 777 start: LengthMetrics.vp((this.contentMargin ? 778 (this.contentMargin.start ? this.contentMargin.start.value : 0) : 779 getResourceValue('sys.float.margin_left')) - PADDING_LEFT), 780 end: this.contentMargin ? this.contentMargin.end : 781 LengthMetrics.vp(getResourceValue('sys.float.margin_right')), 782 }); 783 Button.accessibilityLevel(this.operationType === OperationType.BUTTON || 784 this.operationType === OperationType.TEXT_ARROW ? 785 this.getRightAreaAccessibilityLevel() : 'no'); 786 Button.backgroundColor({ 787 'id': -1, 788 'type': 10001, 789 params: ['sys.color.ohos_id_color_sub_background_transparent'], 790 'bundleName': '__harDefaultBundleName__', 791 'moduleName': '__harDefaultModuleName__', 792 }); 793 Button.hoverEffect(HoverEffect.None); 794 Button.accessibilityGroup(true); 795 Button.accessibilityText(this.getRightAreaAccessibilityText()); 796 Button.accessibilityDescription(this.getAccessibilityDescription()); 797 }, Button); 798 this.rightArea.bind(this)(); 799 Button.pop(); 800 }); 801 } else { 802 this.ifElseBranchUpdateFunction(1, () => { 803 this.observeComponentCreation2((l13, m13) => { 804 Row.create(); 805 Row.focusable(this.operationItem && this.operationType !== OperationType.LOADING ? true : 806 false); 807 Row.justifyContent(FlexAlign.Start); 808 Row.onKeyEvent((r13) => { 809 if (!r13) { 810 return; 811 } 812 if ((r13.keyCode === KeyCode.KEYCODE_SPACE || r13.keyCode === KeyCode.KEYCODE_ENTER) && 813 r13.type === KeyType.Down) { 814 if ((this.operationType === OperationType.TEXT_ARROW || 815 this.operationType === OperationType.BUTTON) && 816 this.operationItem && this.operationItem.length > 0 && this.operationItem[0].action) { 817 this.operationItem[0].action(); 818 } 819 r13.stopPropagation(); 820 } 821 }); 822 Row.onClick(() => { 823 if ((this.operationType === OperationType.TEXT_ARROW || 824 this.operationType === OperationType.BUTTON) && 825 this.operationItem && this.operationItem.length > 0 && this.operationItem[0].action) { 826 this.operationItem[0].action(); 827 } 828 }); 829 Row.onTouch((q13) => { 830 if (q13.type === TouchType.Down) { 831 if (this.operationType === OperationType.TEXT_ARROW) { 832 this.textArrowBgColor = { 833 'id': -1, 834 'type': 10001, 835 params: ['sys.color.interactive_pressed'], 836 'bundleName': '__harDefaultBundleName__', 837 'moduleName': '__harDefaultModuleName__', 838 }; 839 } 840 if (this.operationType === OperationType.BUTTON) { 841 this.buttonBgColor = { 842 'id': -1, 843 'type': 10001, 844 params: ['sys.color.interactive_pressed'], 845 'bundleName': '__harDefaultBundleName__', 846 'moduleName': '__harDefaultModuleName__', 847 }; 848 } 849 } 850 if (q13.type === TouchType.Up || q13.type === TouchType.Cancel) { 851 if (this.operationType === OperationType.TEXT_ARROW) { 852 this.textArrowBgColor = { 853 'id': -1, 854 'type': 10001, 855 params: ['sys.color.ohos_id_color_sub_background_transparent'], 856 'bundleName': '__harDefaultBundleName__', 857 'moduleName': '__harDefaultModuleName__', 858 }; 859 } 860 if (this.operationType === OperationType.BUTTON) { 861 this.buttonBgColor = { 862 'id': -1, 863 'type': 10001, 864 params: ['sys.color.ohos_id_color_sub_background_transparent'], 865 'bundleName': '__harDefaultBundleName__', 866 'moduleName': '__harDefaultModuleName__', 867 }; 868 } 869 } 870 }); 871 Row.margin({ 872 bottom: getResourceValue('sys.float.padding_level4'), 873 }); 874 Row.padding({ 875 start: LengthMetrics.vp((this.contentMargin ? 876 (this.contentMargin.start ? this.contentMargin.start.value : 0) : 877 getResourceValue('sys.float.margin_left')) - PADDING_LEFT), 878 end: this.contentMargin ? this.contentMargin.end : 879 LengthMetrics.vp(getResourceValue('sys.float.margin_right')), 880 }); 881 Row.accessibilityLevel(this.operationType === OperationType.BUTTON || 882 this.operationType === OperationType.TEXT_ARROW ? 883 this.getRightAreaAccessibilityLevel() : 'no'); 884 }, Row); 885 this.rightArea.bind(this)(); 886 Row.pop(); 887 }); 888 } 889 }, If); 890 If.pop(); 891 } 892 893 rightAreaParent(j12 = null) { 894 this.observeComponentCreation2((l12, m12) => { 895 If.create(); 896 if (this.operationType === OperationType.BUTTON || this.operationType === OperationType.TEXT_ARROW) { 897 this.ifElseBranchUpdateFunction(0, () => { 898 this.observeComponentCreation2((y12, z12) => { 899 Button.createWithChild({ 900 type: ButtonType.Normal, 901 buttonStyle: ButtonStyleMode.TEXTUAL, 902 stateEffect: false 903 }); 904 Button.focusable(this.operationItem ? true : false); 905 Button.margin(INDEX_ZERO); 906 Button.padding(INDEX_ZERO); 907 Button.align(Alignment.BottomEnd); 908 Button.onKeyEvent((e13) => { 909 if (!e13) { 910 return; 911 } 912 if ((e13.keyCode === KeyCode.KEYCODE_SPACE || e13.keyCode === KeyCode.KEYCODE_ENTER) && 913 e13.type === KeyType.Down) { 914 if ((this.operationType === OperationType.TEXT_ARROW || 915 this.operationType === OperationType.BUTTON) && 916 this.operationItem && this.operationItem.length > 0 && this.operationItem[0].action) { 917 this.operationItem[0].action(); 918 } 919 e13.stopPropagation(); 920 } 921 }); 922 Button.onClick(() => { 923 if ((this.operationType === OperationType.TEXT_ARROW || 924 this.operationType === OperationType.BUTTON) && 925 this.operationItem && this.operationItem.length > 0 && this.operationItem[0].action) { 926 this.operationItem[0].action(); 927 } 928 }); 929 Button.onTouch((d13) => { 930 if (d13.type === TouchType.Down) { 931 if (this.operationType === OperationType.TEXT_ARROW) { 932 this.textArrowBgColor = { 933 'id': -1, 934 'type': 10001, 935 params: ['sys.color.interactive_pressed'], 936 'bundleName': '__harDefaultBundleName__', 937 'moduleName': '__harDefaultModuleName__', 938 }; 939 } 940 if (this.operationType === OperationType.BUTTON) { 941 this.buttonBgColor = { 942 'id': -1, 943 'type': 10001, 944 params: ['sys.color.interactive_pressed'], 945 'bundleName': '__harDefaultBundleName__', 946 'moduleName': '__harDefaultModuleName__', 947 }; 948 } 949 } 950 if (d13.type === TouchType.Up || d13.type === TouchType.Cancel) { 951 if (this.operationType === OperationType.TEXT_ARROW) { 952 this.textArrowBgColor = { 953 'id': -1, 954 'type': 10001, 955 params: ['sys.color.ohos_id_color_sub_background_transparent'], 956 'bundleName': '__harDefaultBundleName__', 957 'moduleName': '__harDefaultModuleName__', 958 }; 959 } 960 if (this.operationType === OperationType.BUTTON) { 961 this.buttonBgColor = { 962 'id': -1, 963 'type': 10001, 964 params: ['sys.color.ohos_id_color_sub_background_transparent'], 965 'bundleName': '__harDefaultBundleName__', 966 'moduleName': '__harDefaultModuleName__', 967 }; 968 } 969 } 970 }); 971 Button.constraintSize({ 972 maxWidth: this.getRightAreaMaxWidth(), 973 minWidth: this.getRightAreaMinWidth(), 974 minHeight: MIN_HOT_AREA_LENGTH, 975 }); 976 Button.flexShrink(0); 977 Button.accessibilityLevel(this.operationType === OperationType.BUTTON || 978 this.operationType === OperationType.TEXT_ARROW ? 979 this.getRightAreaAccessibilityLevel() : 'no'); 980 Button.hoverEffect(HoverEffect.None); 981 Button.backgroundColor({ 982 'id': -1, 983 'type': 10001, 984 params: ['sys.color.ohos_id_color_sub_background_transparent'], 985 'bundleName': '__harDefaultBundleName__', 986 'moduleName': '__harDefaultModuleName__', 987 }); 988 Button.accessibilityGroup(true); 989 Button.accessibilityText(this.getRightAreaAccessibilityText()); 990 Button.accessibilityDescription(this.getAccessibilityDescription()); 991 }, Button); 992 this.rightArea.bind(this)(); 993 Button.pop(); 994 }); 995 } else { 996 this.ifElseBranchUpdateFunction(1, () => { 997 this.observeComponentCreation2((p12, q12) => { 998 Row.create(); 999 Row.focusable(this.operationItem && this.operationType !== OperationType.LOADING ? true : 1000 false); 1001 Row.justifyContent(FlexAlign.End); 1002 Row.alignItems(VerticalAlign.Bottom); 1003 Row.onKeyEvent((v12) => { 1004 if (!v12) { 1005 return; 1006 } 1007 if ((v12.keyCode === KeyCode.KEYCODE_SPACE || v12.keyCode === KeyCode.KEYCODE_ENTER) && 1008 v12.type === KeyType.Down) { 1009 if ((this.operationType === OperationType.TEXT_ARROW || 1010 this.operationType === OperationType.BUTTON) && 1011 this.operationItem && this.operationItem.length > 0 && this.operationItem[0].action) { 1012 this.operationItem[0].action(); 1013 } 1014 v12.stopPropagation(); 1015 } 1016 }); 1017 Row.onClick(() => { 1018 if ((this.operationType === OperationType.TEXT_ARROW || 1019 this.operationType === OperationType.BUTTON) && 1020 this.operationItem && this.operationItem.length > 0 && this.operationItem[0].action) { 1021 this.operationItem[0].action(); 1022 } 1023 }); 1024 Row.onTouch((u12) => { 1025 if (u12.type === TouchType.Down) { 1026 if (this.operationType === OperationType.TEXT_ARROW) { 1027 this.textArrowBgColor = { 1028 'id': -1, 1029 'type': 10001, 1030 params: ['sys.color.interactive_pressed'], 1031 'bundleName': '__harDefaultBundleName__', 1032 'moduleName': '__harDefaultModuleName__', 1033 }; 1034 } 1035 if (this.operationType === OperationType.BUTTON) { 1036 this.buttonBgColor = { 1037 'id': -1, 1038 'type': 10001, 1039 params: ['sys.color.interactive_pressed'], 1040 'bundleName': '__harDefaultBundleName__', 1041 'moduleName': '__harDefaultModuleName__', 1042 }; 1043 } 1044 } 1045 if (u12.type === TouchType.Up || u12.type === TouchType.Cancel) { 1046 if (this.operationType === OperationType.TEXT_ARROW) { 1047 this.textArrowBgColor = { 1048 'id': -1, 1049 'type': 10001, 1050 params: ['sys.color.ohos_id_color_sub_background_transparent'], 1051 'bundleName': '__harDefaultBundleName__', 1052 'moduleName': '__harDefaultModuleName__', 1053 }; 1054 } 1055 if (this.operationType === OperationType.BUTTON) { 1056 this.buttonBgColor = { 1057 'id': -1, 1058 'type': 10001, 1059 params: ['sys.color.ohos_id_color_sub_background_transparent'], 1060 'bundleName': '__harDefaultBundleName__', 1061 'moduleName': '__harDefaultModuleName__', 1062 }; 1063 } 1064 } 1065 }); 1066 Row.constraintSize({ 1067 maxWidth: this.getRightAreaMaxWidth(), 1068 minWidth: this.getRightAreaMinWidth(), 1069 minHeight: MIN_HOT_AREA_LENGTH, 1070 }); 1071 Row.flexShrink(0); 1072 Row.accessibilityLevel(this.operationType === OperationType.BUTTON || 1073 this.operationType === OperationType.TEXT_ARROW ? 1074 this.getRightAreaAccessibilityLevel() : 'no'); 1075 }, Row); 1076 this.rightArea.bind(this)(); 1077 Row.pop(); 1078 }); 1079 } 1080 }, If); 1081 If.pop(); 1082 } 1083 1084 onMeasureSize(c12, d12, e12) { 1085 let f12 = { width: c12.width, height: c12.height }; 1086 let g12 = this.getUIContext()?.getHostContext(); 1087 this.fontSize = this.updateFontScale(); 1088 if (this.isSuitableAging()) { 1089 this.ageing = true; 1090 this.subHeaderModifier.isAgeing = this.ageing; 1091 } else { 1092 this.ageing = false; 1093 this.subHeaderModifier.isAgeing = this.ageing; 1094 } 1095 d12.forEach((i12) => { 1096 e12.minHeight = Math.min(Number(this.getMinHeight()), Number(e12.maxHeight)); 1097 f12.height = i12?.measure(e12).height; 1098 f12.width = Number(e12.maxWidth); 1099 }); 1100 return f12; 1101 } 1102 1103 onPlaceChildren(x11, y11, z11) { 1104 y11.forEach((b12) => { 1105 b12.layout({ x: 0, y: 0 }); 1106 }); 1107 } 1108 1109 getRightAreaMaxWidth() { 1110 if (this.operationType === OperationType.ICON_GROUP && (this.operationItem && this.operationItem.length > 0)) { 1111 return '100%'; 1112 } 1113 return MAX_RIGHT_WIDTH; 1114 } 1115 1116 getRightAreaMinWidth() { 1117 if (this.operationItem && this.operationItem.length > 0) { 1118 return MIN_HOT_AREA_LENGTH; 1119 } 1120 return 0; 1121 } 1122 1123 getMinHeight() { 1124 if (this.secondaryTitle && this.icon) { 1125 return getResourceValue('sys.float.subheader_single_subtitle_height'); 1126 } else if (this.secondaryTitle && this.primaryTitle) { 1127 return getResourceValue('sys.float.subheader_double_height'); 1128 } else if (this.primaryTitle || this.select) { 1129 return getResourceValue('sys.float.subheader_single_title_height'); 1130 } 1131 return getResourceValue('sys.float.subheader_single_subtitle_height'); 1132 } 1133 1134 getTextArrowPaddingLeft() { 1135 if (this.operationItem && this.operationItem.length > 0 && this.operationItem[0].value) { 1136 return LengthMetrics.vp(getResourceValue('sys.float.padding_level1')); 1137 } 1138 return LengthMetrics.vp(getResourceValue('sys.float.padding_level0')); 1139 } 1140 1141 getTextArrowMarginRight() { 1142 if (this.operationItem && this.operationItem.length > 0 && this.operationItem[0].value) { 1143 return LengthMetrics.vp(PADDING_LEVEL_2 + ARROW_ICON_WIDTH); 1144 } 1145 return LengthMetrics.vp(ARROW_ICON_WIDTH); 1146 } 1147 1148 getAreaPadding() { 1149 if (this.contentPadding) { 1150 return this.contentPadding; 1151 } 1152 let w11 = {}; 1153 if (!this.titleBuilder && ((this.secondaryTitle && this.icon) || 1154 (!this.primaryTitle && this.secondaryTitle))) { 1155 w11 = { 1156 start: LengthMetrics.vp(getResourceValue('sys.float.subheader_single_subtitle_padding')), 1157 end: LengthMetrics.vp(getResourceValue('sys.float.subheader_single_subtitle_padding')), 1158 }; 1159 } else if (this.select) { 1160 w11 = { 1161 top: LengthMetrics.vp(getResourceValue('sys.float.subheader_select_padding')), 1162 bottom: LengthMetrics.vp(getResourceValue('sys.float.subheader_select_padding')), 1163 }; 1164 } 1165 return w11; 1166 } 1167 1168 leftArea(l11 = null) { 1169 this.observeComponentCreation2((n11, o11) => { 1170 If.create(); 1171 if (this.titleBuilder) { 1172 this.ifElseBranchUpdateFunction(0, () => { 1173 this.titleBuilder.bind(this)(); 1174 }); 1175 } else if (this.secondaryTitle && this.icon) { 1176 this.ifElseBranchUpdateFunction(1, () => { 1177 this.IconSecondaryTitleStyle.bind(this)(makeBuilderParameterProxy('IconSecondaryTitleStyle', { 1178 content: () => (this['__secondaryTitle'] ? this['__secondaryTitle'] : this['secondaryTitle']), 1179 iconOptions: () => ({ 1180 icon: this.icon, 1181 symbolicIconOption: this.iconSymbolOptions, 1182 }) 1183 })); 1184 }); 1185 } else if (this.secondaryTitle && this.primaryTitle) { 1186 this.ifElseBranchUpdateFunction(2, () => { 1187 this.SubTitleStyle.bind(this)(makeBuilderParameterProxy('SubTitleStyle', { 1188 content: () => (this['__primaryTitle'] ? this['__primaryTitle'] : this['primaryTitle']), 1189 subContent: () => (this['__secondaryTitle'] ? this['__secondaryTitle'] : this['secondaryTitle']) 1190 })); 1191 }); 1192 } else if (this.secondaryTitle) { 1193 this.ifElseBranchUpdateFunction(3, () => { 1194 this.SecondTitleStyle.bind(this)(makeBuilderParameterProxy('SecondTitleStyle', { 1195 content: () => (this['__secondaryTitle'] ? this['__secondaryTitle'] : this['secondaryTitle']) 1196 })); 1197 }); 1198 } else if (this.select) { 1199 this.ifElseBranchUpdateFunction(4, () => { 1200 this.SelectStyle.bind(this)(this.select); 1201 }); 1202 } else if (this.primaryTitle) { 1203 this.ifElseBranchUpdateFunction(5, () => { 1204 this.PrimaryTitleStyle.bind(this)(makeBuilderParameterProxy('PrimaryTitleStyle', 1205 { content: () => (this['__primaryTitle'] ? this['__primaryTitle'] : this['primaryTitle']) })); 1206 }); 1207 } else { 1208 this.ifElseBranchUpdateFunction(6, () => { 1209 this.dummyFunction.bind(this)(); 1210 }); 1211 } 1212 }, If); 1213 If.pop(); 1214 } 1215 1216 rightArea(l10 = null) { 1217 this.observeComponentCreation2((h11, i11) => { 1218 If.create(); 1219 if (this.operationType === OperationType.BUTTON && (this.operationItem && this.operationItem.length > 0)) { 1220 this.ifElseBranchUpdateFunction(0, () => { 1221 this.ButtonStyle.bind(this)(this.operationItem[0]); 1222 }); 1223 } else { 1224 this.ifElseBranchUpdateFunction(1, () => { 1225 }); 1226 } 1227 }, If); 1228 If.pop(); 1229 this.observeComponentCreation2((d11, e11) => { 1230 If.create(); 1231 if (this.operationType === OperationType.TEXT_ARROW && 1232 (this.operationItem && this.operationItem.length > 0)) { 1233 this.ifElseBranchUpdateFunction(0, () => { 1234 this.TextArrowStyle.bind(this)(this.operationItem[0]); 1235 }); 1236 } else { 1237 this.ifElseBranchUpdateFunction(1, () => { 1238 }); 1239 } 1240 }, If); 1241 If.pop(); 1242 this.observeComponentCreation2((z10, a11) => { 1243 If.create(); 1244 if (this.operationType === OperationType.ICON_GROUP && 1245 (this.operationItem && this.operationItem.length > 0)) { 1246 this.ifElseBranchUpdateFunction(0, () => { 1247 this.IconGroupStyle.bind(this)(this.operationItem); 1248 }); 1249 } else { 1250 this.ifElseBranchUpdateFunction(1, () => { 1251 }); 1252 } 1253 }, If); 1254 If.pop(); 1255 this.observeComponentCreation2((v10, w10) => { 1256 If.create(); 1257 if (this.operationType === OperationType.LOADING) { 1258 this.ifElseBranchUpdateFunction(0, () => { 1259 this.LoadingProcessStyle.bind(this)(); 1260 }); 1261 } else { 1262 this.ifElseBranchUpdateFunction(1, () => { 1263 }); 1264 } 1265 }, If); 1266 If.pop(); 1267 this.observeComponentCreation2((r10, s10) => { 1268 If.create(); 1269 if (this.operationType === undefined && (this.operationItem && this.operationItem.length > 0)) { 1270 this.ifElseBranchUpdateFunction(0, () => { 1271 this.ButtonStyle.bind(this)(this.operationItem[0]); 1272 }); 1273 } else { 1274 this.ifElseBranchUpdateFunction(1, () => { 1275 }); 1276 } 1277 }, If); 1278 If.pop(); 1279 } 1280 1281 IconSecondaryTitleStyle(s9, t9 = null) { 1282 this.observeComponentCreation2((j10, k10) => { 1283 Flex.create({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }); 1284 Flex.padding({ 1285 end: LengthMetrics.vp(getResourceValue('sys.float.padding_level6')), 1286 top: this.fontSize >= MIN_FONT_SIZE ? LengthMetrics.vp(getResourceValue('sys.float.padding_level0')) 1287 : LengthMetrics.vp(getResourceValue('sys.float.subheader_content_padding')), 1288 bottom: this.fontSize >= MIN_FONT_SIZE ? LengthMetrics.vp(getResourceValue('sys.float.padding_level0')) 1289 : LengthMetrics.vp(getResourceValue('sys.float.subheader_content_padding')), 1290 }); 1291 }, Flex); 1292 this.observeComponentCreation2((z9, a10) => { 1293 If.create(); 1294 if (Util.isSymbolResource(s9.iconOptions?.icon)) { 1295 this.ifElseBranchUpdateFunction(0, () => { 1296 this.observeComponentCreation2((h10, i10) => { 1297 SymbolGlyph.create(s9.iconOptions?.icon); 1298 SymbolGlyph.fontSize(s9.iconOptions?.symbolicIconOption?.fontSize ? 1299 Util.symbolFontSize(s9.iconOptions?.symbolicIconOption?.fontSize) : 1300 getResourceValue('sys.float.subheader_left_icon_size')); 1301 SymbolGlyph.fontColor(s9.iconOptions?.symbolicIconOption?.fontColor ?? 1302 [this.subHeaderTheme.leftIconColor]); 1303 SymbolGlyph.fontWeight(s9.iconOptions?.symbolicIconOption?.fontWeight); 1304 SymbolGlyph.renderingStrategy(s9.iconOptions?.symbolicIconOption?.renderingStrategy); 1305 SymbolGlyph.effectStrategy(s9.iconOptions?.symbolicIconOption?.effectStrategy); 1306 SymbolGlyph.margin({ end: LengthMetrics.vp(getResourceValue('sys.float.subheader_left_icon_end_margin')) }); 1307 SymbolGlyph.flexShrink(0); 1308 }, SymbolGlyph); 1309 }); 1310 } else { 1311 this.ifElseBranchUpdateFunction(1, () => { 1312 this.observeComponentCreation2((d10, e10) => { 1313 Image.create(s9.iconOptions?.icon); 1314 Image.fillColor(this.subHeaderTheme.leftIconColor); 1315 Image.width(getResourceValue('sys.float.subheader_left_icon_size')); 1316 Image.height(getResourceValue('sys.float.subheader_left_icon_size')); 1317 Image.margin({ end: LengthMetrics.vp(getResourceValue('sys.float.subheader_left_icon_end_margin')) }); 1318 Image.draggable(false); 1319 Image.flexShrink(0); 1320 }, Image); 1321 }); 1322 } 1323 }, If); 1324 If.pop(); 1325 this.observeComponentCreation2((x9, y9) => { 1326 Text.create(s9.content); 1327 __Text__secondaryTitleStyles({ 1328 maxLines: DOUBLE_LINE_NUM, 1329 fontWeight: FontWeight.Medium, 1330 alignment: Alignment.Start, 1331 fontColor: this.subHeaderTheme.fontSecondaryColor, 1332 }); 1333 Text.attributeModifier.bind(this)(ObservedObject.GetRawObject(this.secondaryTitleModifier)); 1334 Text.flexShrink(1); 1335 }, Text); 1336 Text.pop(); 1337 Flex.pop(); 1338 } 1339 1340 SubTitleStyle(h9, i9 = null) { 1341 this.observeComponentCreation2((q9, r9) => { 1342 Column.create(); 1343 Column.width('100%'); 1344 Column.padding({ 1345 end: LengthMetrics.vp(getResourceValue('sys.float.padding_level0')), 1346 top: this.fontSize >= MIN_FONT_SIZE ? LengthMetrics.vp(getResourceValue('sys.float.padding_level0')) 1347 : LengthMetrics.vp(getResourceValue('sys.float.subheader_content_padding')), 1348 bottom: this.fontSize >= MIN_FONT_SIZE ? LengthMetrics.vp(getResourceValue('sys.float.padding_level0')) 1349 : LengthMetrics.vp(getResourceValue('sys.float.subheader_content_padding')), 1350 }); 1351 Column.alignItems(HorizontalAlign.Start); 1352 }, Column); 1353 this.observeComponentCreation2((o9, p9) => { 1354 Text.create(h9.content); 1355 __Text__primaryTitleStyles({ 1356 fontWeight: getResourceValue('sys.float.subheader_title_font_weight'), 1357 maxLines: DOUBLE_LINE_NUM, 1358 alignment: Alignment.Start, 1359 fontColor: this.subHeaderTheme.fontPrimaryColor, 1360 }); 1361 Text.attributeModifier.bind(this)(ObservedObject.GetRawObject(this.primaryTitleModifier)); 1362 }, Text); 1363 Text.pop(); 1364 this.observeComponentCreation2((m9, n9) => { 1365 Text.create(h9.subContent); 1366 __Text__secondaryTitleStyles({ 1367 maxLines: DOUBLE_LINE_NUM, 1368 fontWeight: getResourceValue('sys.float.subheader_subtitle_font_weight'), 1369 alignment: Alignment.Start, 1370 fontColor: this.subHeaderTheme.fontSecondaryColor, 1371 }); 1372 Text.margin({ 1373 top: getResourceValue('sys.float.subheader_titles_space'), 1374 }); 1375 Text.attributeModifier.bind(this)(ObservedObject.GetRawObject(this.secondaryTitleModifier)); 1376 }, Text); 1377 Text.pop(); 1378 Column.pop(); 1379 } 1380 1381 SecondTitleStyle(c9, d9 = null) { 1382 this.observeComponentCreation2((f9, g9) => { 1383 Text.create(c9.content); 1384 __Text__secondaryTitleStyles({ 1385 maxLines: DOUBLE_LINE_NUM, 1386 fontWeight: FontWeight.Medium, 1387 alignment: Alignment.Start, 1388 fontColor: this.subHeaderTheme.fontSecondaryColor, 1389 }); 1390 Text.attributeModifier.bind(this)(ObservedObject.GetRawObject(this.secondaryTitleModifier)); 1391 Text.padding({ 1392 end: LengthMetrics.vp(getResourceValue('sys.float.padding_level6')), 1393 top: this.fontSize >= MIN_FONT_SIZE ? LengthMetrics.vp(getResourceValue('sys.float.padding_level0')) 1394 : LengthMetrics.vp(getResourceValue('sys.float.subheader_content_padding')), 1395 bottom: this.fontSize >= MIN_FONT_SIZE ? LengthMetrics.vp(getResourceValue('sys.float.padding_level0')) 1396 : LengthMetrics.vp(getResourceValue('sys.float.subheader_content_padding')), 1397 }); 1398 }, Text); 1399 Text.pop(); 1400 } 1401 1402 SelectStyle(u8, v8 = null) { 1403 this.observeComponentCreation2((x8, y8) => { 1404 Select.create(u8.options); 1405 Select.height('auto'); 1406 Select.width('auto'); 1407 Select.selected(ObservedObject.GetRawObject(this.selectedIndex)); 1408 Select.value(ObservedObject.GetRawObject(this.selectValue)); 1409 Select.defaultFocus(u8.defaultFocus); 1410 Select.onSelect((a9, b9) => { 1411 this.selectedIndex = a9; 1412 if (b9) { 1413 this.selectValue = b9; 1414 } 1415 if (u8.onSelect) { 1416 u8.onSelect(a9, b9); 1417 } 1418 }); 1419 Select.font({ 1420 size: `${getResourceValue('sys.float.Body_L')}fp`, 1421 weight: FontWeight.Medium, 1422 }); 1423 }, Select); 1424 Select.pop(); 1425 } 1426 1427 PrimaryTitleStyle(p8, q8 = null) { 1428 this.observeComponentCreation2((s8, t8) => { 1429 Text.create(p8.content); 1430 __Text__primaryTitleStyles({ 1431 fontWeight: getResourceValue('sys.float.subheader_title_font_weight'), 1432 maxLines: DOUBLE_LINE_NUM, 1433 alignment: Alignment.Start, 1434 fontColor: this.subHeaderTheme.fontPrimaryColor, 1435 }); 1436 Text.attributeModifier.bind(this)(ObservedObject.GetRawObject(this.primaryTitleModifier)); 1437 Text.padding({ 1438 end: LengthMetrics.vp(getResourceValue('sys.float.padding_level0')), 1439 top: this.fontSize >= MIN_FONT_SIZE ? LengthMetrics.vp(getResourceValue('sys.float.padding_level0')) 1440 : LengthMetrics.vp(getResourceValue('sys.float.subheader_content_padding')), 1441 bottom: this.fontSize >= MIN_FONT_SIZE ? LengthMetrics.vp(getResourceValue('sys.float.padding_level0')) 1442 : LengthMetrics.vp(getResourceValue('sys.float.subheader_content_padding')), 1443 }); 1444 }, Text); 1445 Text.pop(); 1446 } 1447 1448 ButtonStyle(a8, b8 = null) { 1449 this.observeComponentCreation2((d8, e8) => { 1450 If.create(); 1451 if (a8) { 1452 this.ifElseBranchUpdateFunction(0, () => { 1453 this.observeComponentCreation2((l8, m8) => { 1454 Button.createWithChild({ type: ButtonType.Normal, stateEffect: false }); 1455 Button.focusable(true); 1456 Button.focusBox({ 1457 margin: { value: INDEX_ZERO, unit: LengthUnit.VP }, 1458 strokeColor: ColorMetrics.resourceColor(this.subHeaderTheme.borderFocusColor), 1459 strokeWidth: LengthMetrics.vp(getResourceValue('sys.float.outline_extra_larger')), 1460 }); 1461 Button.padding({ 1462 start: LengthMetrics.vp(getResourceValue('sys.float.padding_level1')), 1463 end: LengthMetrics.vp(getResourceValue('sys.float.padding_level1')), 1464 top: LengthMetrics.vp(getResourceValue('sys.float.padding_level2')), 1465 bottom: LengthMetrics.vp(getResourceValue('sys.float.padding_level2')), 1466 }); 1467 Button.margin({ 1468 start: this.ageing ? 1469 LengthMetrics.vp(LengthMetrics.vp(getResourceValue('sys.float.padding_level0')).value + 1470 this.leftIconMargin().value) : 1471 LengthMetrics.vp(LengthMetrics.vp(getResourceValue('sys.float.padding_level4')).value + 1472 this.leftIconMargin().value), 1473 bottom: LengthMetrics.vp(this.ageing ? getResourceValue('sys.float.padding_level0') : 1474 getResourceValue('sys.float.padding_level2')), 1475 }); 1476 Button.backgroundColor(ObservedObject.GetRawObject(this.buttonBgColor)); 1477 Button.constraintSize({ minHeight: OPERATE_ITEM_LENGTH }); 1478 Button.align(Alignment.End); 1479 Button.borderRadius(getResourceValue('sys.float.corner_radius_level4')); 1480 Button.onHover((o8) => { 1481 if (o8) { 1482 this.buttonBgColor = this.subHeaderTheme.textArrowHoverBgColor; 1483 } else { 1484 this.buttonBgColor = { 1485 'id': -1, 1486 'type': 10001, 1487 params: ['sys.color.ohos_id_color_sub_background_transparent'], 1488 'bundleName': '__harDefaultBundleName__', 1489 'moduleName': '__harDefaultModuleName__', 1490 }; 1491 } 1492 }); 1493 ViewStackProcessor.visualState('disabled'); 1494 Button.opacity(getResourceValue('sys.float.interactive_disable')); 1495 ViewStackProcessor.visualState('pressed'); 1496 Button.backgroundColor({ 1497 'id': -1, 1498 'type': 10001, 1499 params: ['sys.color.interactive_pressed'], 1500 'bundleName': '__harDefaultBundleName__', 1501 'moduleName': '__harDefaultModuleName__', 1502 }); 1503 ViewStackProcessor.visualState(); 1504 }, Button); 1505 this.observeComponentCreation2((j8, k8) => { 1506 Text.create(a8.value); 1507 __Text__secondaryTitleStyles({ 1508 fontWeight: FontWeight.Medium, 1509 maxLines: DOUBLE_LINE_NUM, 1510 fontColor: this.subHeaderTheme.fontButtonColor, 1511 }); 1512 Text.defaultFocus(a8.defaultFocus); 1513 Text.focusable(true); 1514 }, Text); 1515 Text.pop(); 1516 Button.pop(); 1517 }); 1518 } else { 1519 this.ifElseBranchUpdateFunction(1, () => { 1520 }); 1521 } 1522 }, If); 1523 If.pop(); 1524 } 1525 1526 leftIconMargin() { 1527 if (this.titleBuilder) { 1528 return LengthMetrics.vp(0); 1529 } 1530 if (this.icon && Util.isSymbolResource(this.icon)) { 1531 return this.ageing ? LengthMetrics.vp((this.iconSymbolOptions?.fontSize ? 1532 Util.numberToSize(this.iconSymbolOptions?.fontSize) : LEFT_ICON_SIZE_NUMBER) + 1533 LEFT_TEXT_NUMBER) : LengthMetrics.vp(0); 1534 } else { 1535 return (this.ageing && this.icon) ? LengthMetrics.vp(LEFT_ICON_SIZE_NUMBER + 1536 LEFT_TEXT_NUMBER) : LengthMetrics.vp(0); 1537 } 1538 } 1539 1540 TextStyle(n7, o7 = null) { 1541 this.observeComponentCreation2((y7, z7) => { 1542 Row.create(); 1543 Row.attributeModifier.bind(this)(ObservedObject.GetRawObject(this.subHeaderModifier)); 1544 Row.alignItems(VerticalAlign.Center); 1545 Row.focusable(true); 1546 Row.constraintSize({ minHeight: OPERATE_ITEM_LENGTH }); 1547 Row.padding({ 1548 start: this.getTextArrowPaddingLeft(), 1549 top: this.ageing ? LengthMetrics.vp(0) : LengthMetrics.vp(getResourceValue('sys.float.padding_level2')), 1550 bottom: this.ageing ? LengthMetrics.vp(0) : 1551 LengthMetrics.vp(getResourceValue('sys.float.padding_level2')), 1552 }); 1553 }, Row); 1554 this.observeComponentCreation2((r7, s7) => { 1555 If.create(); 1556 if (n7) { 1557 this.ifElseBranchUpdateFunction(0, () => { 1558 this.observeComponentCreation2((w7, x7) => { 1559 Text.create(n7.value); 1560 __Text__secondaryTitleStyles({ 1561 maxLines: DOUBLE_LINE_NUM, 1562 fontWeight: FontWeight.Regular, 1563 alignment: Alignment.End, 1564 fontColor: this.subHeaderTheme.fontSecondaryColor, 1565 }); 1566 Text.focusable(true); 1567 Text.defaultFocus(n7.defaultFocus); 1568 Text.margin({ 1569 end: this.getTextArrowMarginRight(), 1570 }); 1571 }, Text); 1572 Text.pop(); 1573 }); 1574 } else { 1575 this.ifElseBranchUpdateFunction(1, () => { 1576 }); 1577 } 1578 }, If); 1579 If.pop(); 1580 Row.pop(); 1581 } 1582 1583 ArrowStyle(g7 = null) { 1584 this.observeComponentCreation2((l7, m7) => { 1585 Row.create(); 1586 Row.justifyContent(FlexAlign.End); 1587 }, Row); 1588 this.observeComponentCreation2((j7, k7) => { 1589 SymbolGlyph.create({ 1590 'id': -1, 1591 'type': 40000, 1592 params: ['sys.symbol.chevron_right'], 1593 'bundleName': '__harDefaultBundleName__', 1594 'moduleName': '__harDefaultModuleName__', 1595 }); 1596 SymbolGlyph.fontSize(RIGHT_SINGLE_ICON_SIZE); 1597 SymbolGlyph.fontColor([this.subHeaderTheme.iconArrowColor]); 1598 SymbolGlyph.draggable(false); 1599 SymbolGlyph.width(ARROW_ICON_WIDTH); 1600 SymbolGlyph.height(OPERATE_ITEM_LENGTH); 1601 }, SymbolGlyph); 1602 Row.pop(); 1603 } 1604 1605 TextArrowStyle(b5, c5 = null) { 1606 this.observeComponentCreation2((e5, f5) => { 1607 If.create(); 1608 if (b5 && b5.value && b5.value.toString().length > 0) { 1609 this.ifElseBranchUpdateFunction(0, () => { 1610 this.observeComponentCreation2((e7, f7) => { 1611 Stack.create(); 1612 Stack.focusable(true); 1613 Stack.align(this.ageing ? Alignment.Start : Alignment.End); 1614 Stack.margin({ 1615 start: LengthMetrics.vp(this.ageing ? getResourceValue('sys.float.padding_level0') : 1616 getResourceValue('sys.float.padding_level4')), 1617 bottom: LengthMetrics.vp(this.ageing ? getResourceValue('sys.float.padding_level0') : 1618 getResourceValue('sys.float.padding_level2')), 1619 }); 1620 }, Stack); 1621 this.observeComponentCreation2((a7, b7) => { 1622 Button.createWithChild({ 1623 type: ButtonType.Normal, 1624 buttonStyle: ButtonStyleMode.TEXTUAL, 1625 stateEffect: false 1626 }); 1627 Button.padding(INDEX_ZERO); 1628 Button.margin({ start: this.leftIconMargin() }); 1629 Button.backgroundColor(ObservedObject.GetRawObject(this.textArrowBgColor)); 1630 Button.focusBox({ 1631 margin: { value: INDEX_ZERO, unit: LengthUnit.VP }, 1632 strokeColor: ColorMetrics.resourceColor(this.subHeaderTheme.borderFocusColor), 1633 strokeWidth: LengthMetrics.vp(getResourceValue('sys.float.outline_extra_larger')), 1634 }); 1635 Button.borderRadius(getResourceValue('sys.float.corner_radius_level4')); 1636 ViewStackProcessor.visualState('disabled'); 1637 Button.opacity(getResourceValue('sys.float.interactive_disable')); 1638 ViewStackProcessor.visualState('pressed'); 1639 Button.backgroundColor({ 1640 'id': -1, 1641 'type': 10001, 1642 params: ['sys.color.interactive_pressed'], 1643 'bundleName': '__harDefaultBundleName__', 1644 'moduleName': '__harDefaultModuleName__', 1645 }); 1646 ViewStackProcessor.visualState(); 1647 Button.onHover((d7) => { 1648 if (d7) { 1649 this.textArrowBgColor = this.subHeaderTheme.textArrowHoverBgColor; 1650 } else { 1651 this.textArrowBgColor = { 1652 'id': -1, 1653 'type': 10001, 1654 params: ['sys.color.ohos_id_color_sub_background_transparent'], 1655 'bundleName': '__harDefaultBundleName__', 1656 'moduleName': '__harDefaultModuleName__', 1657 }; 1658 } 1659 }); 1660 }, Button); 1661 { 1662 this.observeComponentCreation2((w5, x5) => { 1663 if (x5) { 1664 let y5 = new TextArrowLayout(this, { 1665 textArrowBuilder: () => { 1666 this.observeComponentCreation2((p6, q6) => { 1667 ForEach.create(); 1668 const r6 = t6 => { 1669 const u6 = t6; 1670 this.observeComponentCreation2((w6, x6) => { 1671 If.create(); 1672 if (u6 === INDEX_ZERO) { 1673 this.ifElseBranchUpdateFunction(0, () => { 1674 this.TextStyle.bind(this)(b5); 1675 }); 1676 } else { 1677 this.ifElseBranchUpdateFunction(1, () => { 1678 this.ArrowStyle.bind(this)(); 1679 }); 1680 } 1681 }, If); 1682 If.pop(); 1683 }; 1684 this.forEachUpdateFunction(p6, [INDEX_ZERO, INDEX_ONE], r6); 1685 }, ForEach); 1686 ForEach.pop(); 1687 } 1688 }, undefined, w5, () => { 1689 }, { page: 'library/src/main/ets/components/MainPage.ets', line: 896, col: 11 }); 1690 ViewPU.create(y5); 1691 let z5 = () => { 1692 return { 1693 textArrowBuilder: () => { 1694 this.observeComponentCreation2((d6, e6) => { 1695 ForEach.create(); 1696 const f6 = h6 => { 1697 const i6 = h6; 1698 this.observeComponentCreation2((k6, l6) => { 1699 If.create(); 1700 if (i6 === INDEX_ZERO) { 1701 this.ifElseBranchUpdateFunction(0, () => { 1702 this.TextStyle.bind(this)(b5); 1703 }); 1704 } else { 1705 this.ifElseBranchUpdateFunction(1, () => { 1706 this.ArrowStyle.bind(this)(); 1707 }); 1708 } 1709 }, If); 1710 If.pop(); 1711 }; 1712 this.forEachUpdateFunction(d6, [INDEX_ZERO, INDEX_ONE], f6); 1713 }, ForEach); 1714 ForEach.pop(); 1715 } 1716 }; 1717 }; 1718 y5.paramsGenerator_ = z5; 1719 } else { 1720 this.updateStateVarsOfChildByElmtId(w5, {}); 1721 } 1722 }, { name: 'TextArrowLayout' }); 1723 } 1724 Button.pop(); 1725 Stack.pop(); 1726 }); 1727 } else { 1728 this.ifElseBranchUpdateFunction(1, () => { 1729 this.observeComponentCreation2((q5, r5) => { 1730 Row.create(); 1731 Row.focusable(true); 1732 Row.constraintSize({ minWidth: this.getRightAreaMinWidth() }); 1733 Row.justifyContent(FlexAlign.End); 1734 }, Row); 1735 this.observeComponentCreation2((m5, n5) => { 1736 Button.createWithChild({ type: ButtonType.Normal, stateEffect: false }); 1737 Button.width(ARROW_ICON_WIDTH); 1738 Button.height(OPERATE_ITEM_LENGTH); 1739 Button.backgroundColor(ObservedObject.GetRawObject(this.textArrowBgColor)); 1740 Button.focusBox({ 1741 margin: { value: INDEX_ZERO, unit: LengthUnit.VP }, 1742 strokeColor: ColorMetrics.resourceColor(this.subHeaderTheme.borderFocusColor), 1743 strokeWidth: LengthMetrics.vp(getResourceValue('sys.float.outline_extra_larger')), 1744 }); 1745 Button.borderRadius(getResourceValue('sys.float.corner_radius_level4')); 1746 ViewStackProcessor.visualState('disabled'); 1747 Button.opacity(getResourceValue('sys.float.interactive_disable')); 1748 ViewStackProcessor.visualState('pressed'); 1749 Button.backgroundColor({ 1750 'id': -1, 1751 'type': 10001, 1752 params: ['sys.color.interactive_pressed'], 1753 'bundleName': '__harDefaultBundleName__', 1754 'moduleName': '__harDefaultModuleName__', 1755 }); 1756 ViewStackProcessor.visualState(); 1757 Button.onHover((p5) => { 1758 if (p5) { 1759 this.textArrowBgColor = this.subHeaderTheme.textArrowHoverBgColor; 1760 } else { 1761 this.textArrowBgColor = { 1762 'id': -1, 1763 'type': 10001, 1764 params: ['sys.color.ohos_id_color_sub_background_transparent'], 1765 'bundleName': '__harDefaultBundleName__', 1766 'moduleName': '__harDefaultModuleName__', 1767 }; 1768 } 1769 }); 1770 Button.focusable(true); 1771 Button.margin({ 1772 start: LengthMetrics.vp(this.ageing ? getResourceValue('sys.float.padding_level0') : 1773 getResourceValue('sys.float.padding_level4')), 1774 bottom: LengthMetrics.vp(this.ageing ? getResourceValue('sys.float.padding_level0') : 1775 getResourceValue('sys.float.padding_level2')), 1776 }); 1777 }, Button); 1778 this.observeComponentCreation2((k5, l5) => { 1779 SymbolGlyph.create({ 1780 'id': -1, 1781 'type': 40000, 1782 params: ['sys.symbol.chevron_right'], 1783 'bundleName': '__harDefaultBundleName__', 1784 'moduleName': '__harDefaultModuleName__', 1785 }); 1786 SymbolGlyph.fontSize(RIGHT_SINGLE_ICON_SIZE); 1787 SymbolGlyph.fontColor([this.subHeaderTheme.iconArrowColor]); 1788 SymbolGlyph.draggable(false); 1789 SymbolGlyph.focusable(true); 1790 SymbolGlyph.width(ARROW_ICON_WIDTH); 1791 SymbolGlyph.height(OPERATE_ITEM_LENGTH); 1792 }, SymbolGlyph); 1793 Button.pop(); 1794 Row.pop(); 1795 }); 1796 } 1797 }, If); 1798 If.pop(); 1799 } 1800 1801 IconGroupStyle(z3, a4 = null) { 1802 this.observeComponentCreation2((z4, a5) => { 1803 Row.create(); 1804 Row.justifyContent(FlexAlign.End); 1805 Row.focusable(true); 1806 }, Row); 1807 this.observeComponentCreation2((d4, e4) => { 1808 ForEach.create(); 1809 const f4 = (h4, i4) => { 1810 const j4 = h4; 1811 this.observeComponentCreation2((l4, m4) => { 1812 If.create(); 1813 if (i4 <= INDEX_TWO) { 1814 this.ifElseBranchUpdateFunction(0, () => { 1815 this.observeComponentCreation2((x4, y4) => { 1816 __Common__.create(); 1817 __Common__.margin({ 1818 start: LengthMetrics.vp(getResourceValue('sys.float.padding_level4')), 1819 bottom: LengthMetrics.vp(getResourceValue('sys.float.padding_level3')), 1820 }); 1821 }, __Common__); 1822 { 1823 this.observeComponentCreation2((r4, s4) => { 1824 if (s4) { 1825 let t4 = new SingleIconStyle(this, { 1826 item: { 1827 iconOptions: { 1828 icon: j4.value, 1829 symbolicIconOption: this.operationSymbolOptions && 1830 this.operationSymbolOptions.length > i4 ? 1831 this.operationSymbolOptions[i4] : null, 1832 }, 1833 action: j4.action, 1834 defaultFocus: j4.defaultFocus, 1835 accessibilityLevel: j4.accessibilityLevel, 1836 accessibilityText: j4.accessibilityText, 1837 accessibilityDescription: j4.accessibilityDescription, 1838 }, 1839 isSingleIcon: this.operationItem?.length === SINGLE_ICON_NUMBER, 1840 }, undefined, r4, () => { 1841 }, { 1842 page: 'library/src/main/ets/components/MainPage.ets', 1843 line: 985, 1844 col: 13 1845 }); 1846 ViewPU.create(t4); 1847 let u4 = () => { 1848 return { 1849 item: { 1850 iconOptions: { 1851 icon: j4.value, 1852 symbolicIconOption: this.operationSymbolOptions && 1853 this.operationSymbolOptions.length > i4 ? 1854 this.operationSymbolOptions[i4] : null, 1855 }, 1856 action: j4.action, 1857 defaultFocus: j4.defaultFocus, 1858 accessibilityLevel: j4.accessibilityLevel, 1859 accessibilityText: j4.accessibilityText, 1860 accessibilityDescription: j4.accessibilityDescription, 1861 }, 1862 isSingleIcon: this.operationItem?.length === SINGLE_ICON_NUMBER 1863 }; 1864 }; 1865 t4.paramsGenerator_ = u4; 1866 } else { 1867 this.updateStateVarsOfChildByElmtId(r4, {}); 1868 } 1869 }, { name: 'SingleIconStyle' }); 1870 } 1871 __Common__.pop(); 1872 }); 1873 } else { 1874 this.ifElseBranchUpdateFunction(1, () => { 1875 }); 1876 } 1877 }, If); 1878 If.pop(); 1879 }; 1880 this.forEachUpdateFunction(d4, z3, f4, undefined, true, false); 1881 }, ForEach); 1882 ForEach.pop(); 1883 Row.pop(); 1884 } 1885 1886 LoadingProcessStyle(s3 = null) { 1887 this.observeComponentCreation2((x3, y3) => { 1888 Row.create(); 1889 Row.justifyContent(FlexAlign.End); 1890 Row.padding({ 1891 top: getResourceValue('sys.float.padding_level2'), 1892 bottom: getResourceValue('sys.float.padding_level2'), 1893 }); 1894 Row.margin({ 1895 start: LengthMetrics.vp(getResourceValue('sys.float.padding_level4')), 1896 }); 1897 }, Row); 1898 this.observeComponentCreation2((v3, w3) => { 1899 LoadingProgress.create(); 1900 LoadingProgress.width(OPERATE_ITEM_LENGTH); 1901 LoadingProgress.height(OPERATE_ITEM_LENGTH); 1902 LoadingProgress.color({ 1903 'id': -1, 1904 'type': 10001, 1905 params: ['sys.color.icon_secondary'], 1906 'bundleName': '__harDefaultBundleName__', 1907 'moduleName': '__harDefaultModuleName__', 1908 }); 1909 }, LoadingProgress); 1910 Row.pop(); 1911 } 1912 1913 dummyFunction(o3 = null) { 1914 this.observeComponentCreation2((q3, r3) => { 1915 Row.create(); 1916 }, Row); 1917 Row.pop(); 1918 } 1919 1920 rerender() { 1921 this.updateDirtyElements(); 1922 } 1923} 1924 1925class SingleIconStyle extends ViewPU { 1926 constructor(i3, j3, k3, l3 = -1, m3 = undefined, n3) { 1927 super(i3, k3, l3, n3); 1928 if (typeof m3 === 'function') { 1929 this.paramsGenerator_ = m3; 1930 } 1931 this.__bgColor = new ObservedPropertyObjectPU({ 1932 'id': -1, 1933 'type': 10001, 1934 params: ['sys.color.ohos_id_color_sub_background_transparent'], 1935 'bundleName': '__harDefaultBundleName__', 1936 'moduleName': '__harDefaultModuleName__', 1937 }, this, 'bgColor'); 1938 this.__isFocus = new ObservedPropertySimplePU(false, this, 'isFocus'); 1939 this.item = null; 1940 this.__subHeaderTheme = this.initializeConsume('subHeaderTheme', 'subHeaderTheme'); 1941 this.isSingleIcon = true; 1942 this.setInitiallyProvidedValue(j3); 1943 this.finalizeConstruction(); 1944 } 1945 1946 setInitiallyProvidedValue(h3) { 1947 if (h3.bgColor !== undefined) { 1948 this.bgColor = h3.bgColor; 1949 } 1950 if (h3.isFocus !== undefined) { 1951 this.isFocus = h3.isFocus; 1952 } 1953 if (h3.item !== undefined) { 1954 this.item = h3.item; 1955 } 1956 if (h3.isSingleIcon !== undefined) { 1957 this.isSingleIcon = h3.isSingleIcon; 1958 } 1959 } 1960 1961 updateStateVars(g3) { 1962 } 1963 1964 purgeVariableDependenciesOnElmtId(f3) { 1965 this.__bgColor.purgeDependencyOnElmtId(f3); 1966 this.__isFocus.purgeDependencyOnElmtId(f3); 1967 this.__subHeaderTheme.purgeDependencyOnElmtId(f3); 1968 } 1969 1970 aboutToBeDeleted() { 1971 this.__bgColor.aboutToBeDeleted(); 1972 this.__isFocus.aboutToBeDeleted(); 1973 this.__subHeaderTheme.aboutToBeDeleted(); 1974 SubscriberManager.Get().delete(this.id__()); 1975 this.aboutToBeDeletedInternal(); 1976 } 1977 1978 get bgColor() { 1979 return this.__bgColor.get(); 1980 } 1981 1982 set bgColor(e3) { 1983 this.__bgColor.set(e3); 1984 } 1985 1986 get isFocus() { 1987 return this.__isFocus.get(); 1988 } 1989 1990 set isFocus(d3) { 1991 this.__isFocus.set(d3); 1992 } 1993 1994 get subHeaderTheme() { 1995 return this.__subHeaderTheme.get(); 1996 } 1997 1998 set subHeaderTheme(c3) { 1999 this.__subHeaderTheme.set(c3); 2000 } 2001 2002 getRightIconAccessibilityText() { 2003 if (this.item?.accessibilityText) { 2004 return this.item.accessibilityText; 2005 } 2006 return ''; 2007 } 2008 2009 getRightIconAccessibilityLevel() { 2010 if (this.item?.accessibilityLevel && this.item?.accessibilityLevel !== '') { 2011 return this.item.accessibilityLevel; 2012 } 2013 return 'auto'; 2014 } 2015 2016 getRightIconAccessibilityDescription() { 2017 if (this.item?.accessibilityDescription && this.item?.accessibilityDescription !== '') { 2018 return this.item?.accessibilityDescription; 2019 } 2020 return ''; 2021 } 2022 2023 initialRender() { 2024 this.observeComponentCreation2((o2, p2) => { 2025 If.create(); 2026 if (this.item && this.item.iconOptions) { 2027 this.ifElseBranchUpdateFunction(0, () => { 2028 this.observeComponentCreation2((t2, u2) => { 2029 Button.createWithChild({ type: ButtonType.Normal, stateEffect: false }); 2030 Button.focusable(true); 2031 Button.defaultFocus(this.item.defaultFocus); 2032 Button.width(SINGLE_ICON_ZONE_SIZE); 2033 Button.height(SINGLE_ICON_ZONE_SIZE); 2034 Button.align(Alignment.Center); 2035 Button.backgroundColor(ObservedObject.GetRawObject(this.bgColor)); 2036 Button.borderRadius(getResourceValue('sys.float.corner_radius_level4')); 2037 Button.accessibilityLevel(this.getRightIconAccessibilityLevel()); 2038 Button.accessibilityText(this.getRightIconAccessibilityText()); 2039 Button.accessibilityDescription(this.getRightIconAccessibilityDescription()); 2040 Button.focusBox({ 2041 margin: { value: INDEX_ZERO, unit: LengthUnit.VP }, 2042 strokeColor: ColorMetrics.resourceColor(this.subHeaderTheme.borderFocusColor), 2043 strokeWidth: LengthMetrics.vp(getResourceValue('sys.float.outline_extra_larger')), 2044 }); 2045 ViewStackProcessor.visualState('disabled'); 2046 Button.opacity(getResourceValue('sys.float.interactive_disable')); 2047 ViewStackProcessor.visualState('pressed'); 2048 Button.backgroundColor({ 2049 'id': -1, 2050 'type': 10001, 2051 params: ['sys.color.interactive_pressed'], 2052 'bundleName': '__harDefaultBundleName__', 2053 'moduleName': '__harDefaultModuleName__', 2054 }); 2055 ViewStackProcessor.visualState(); 2056 Button.onTouch((a3) => { 2057 if (a3.type === TouchType.Down || TouchType.Cancel) { 2058 this.bgColor = { 2059 'id': -1, 2060 'type': 10001, 2061 params: ['sys.color.interactive_pressed'], 2062 'bundleName': '__harDefaultBundleName__', 2063 'moduleName': '__harDefaultModuleName__', 2064 }; 2065 } 2066 if (a3.type === TouchType.Up) { 2067 this.bgColor = { 2068 'id': -1, 2069 'type': 10001, 2070 params: ['sys.color.ohos_id_color_sub_background_transparent'], 2071 'bundleName': '__harDefaultBundleName__', 2072 'moduleName': '__harDefaultModuleName__', 2073 }; 2074 } 2075 }); 2076 Button.onHover((z2) => { 2077 if (z2) { 2078 this.bgColor = { 2079 'id': -1, 2080 'type': 10001, 2081 params: ['sys.color.interactive_hover'], 2082 'bundleName': '__harDefaultBundleName__', 2083 'moduleName': '__harDefaultModuleName__', 2084 }; 2085 } else { 2086 this.bgColor = { 2087 'id': -1, 2088 'type': 10001, 2089 params: ['sys.color.ohos_id_color_sub_background_transparent'], 2090 'bundleName': '__harDefaultBundleName__', 2091 'moduleName': '__harDefaultModuleName__', 2092 }; 2093 } 2094 }); 2095 Button.responseRegion(this.iconResponseRegion()); 2096 Button.onClick((y2) => { 2097 if (this.item?.action) { 2098 this.item?.action(); 2099 } 2100 }); 2101 }, Button); 2102 this.IconZone.bind(this)(); 2103 Button.pop(); 2104 }); 2105 } else { 2106 this.ifElseBranchUpdateFunction(1, () => { 2107 }); 2108 } 2109 }, If); 2110 If.pop(); 2111 } 2112 2113 iconResponseRegion() { 2114 if (this.isSingleIcon) { 2115 return { 2116 x: SINGLE_ICON_REGION_X, 2117 y: ICON_REGION_Y, 2118 width: MIN_HOT_AREA_LENGTH, 2119 height: MIN_HOT_AREA_LENGTH, 2120 }; 2121 } 2122 return { 2123 x: ICON_REGION_X, 2124 y: ICON_REGION_Y, 2125 width: MULTI_ICON_REGION_WIDTH, 2126 height: MIN_HOT_AREA_LENGTH, 2127 }; 2128 } 2129 2130 fontSizeValue(m2) { 2131 return m2.iconOptions?.symbolicIconOption?.fontSize ? 2132 Util.symbolFontSize(m2.iconOptions?.symbolicIconOption?.fontSize) : RIGHT_SINGLE_ICON_SIZE; 2133 } 2134 2135 IconZone(v1 = null) { 2136 this.observeComponentCreation2((x1, y1) => { 2137 If.create(); 2138 if (this.item && this.item.iconOptions) { 2139 this.ifElseBranchUpdateFunction(0, () => { 2140 this.observeComponentCreation2((c2, d2) => { 2141 If.create(); 2142 if (Util.isSymbolResource(this.item.iconOptions.icon)) { 2143 this.ifElseBranchUpdateFunction(0, () => { 2144 this.observeComponentCreation2((k2, l2) => { 2145 SymbolGlyph.create(this.item.iconOptions?.icon); 2146 SymbolGlyph.focusable(true); 2147 SymbolGlyph.fontSize(this.fontSizeValue(this.item)); 2148 SymbolGlyph.fontColor(this.item.iconOptions?.symbolicIconOption?.fontColor ?? 2149 [this.subHeaderTheme.rightIconColor]); 2150 SymbolGlyph.fontWeight(this.item.iconOptions?.symbolicIconOption?.fontWeight); 2151 SymbolGlyph.renderingStrategy(this.item.iconOptions?.symbolicIconOption?.renderingStrategy); 2152 SymbolGlyph.effectStrategy(this.item.iconOptions?.symbolicIconOption?.effectStrategy); 2153 }, SymbolGlyph); 2154 }); 2155 } else { 2156 this.ifElseBranchUpdateFunction(1, () => { 2157 this.observeComponentCreation2((g2, h2) => { 2158 Image.create(this.item?.iconOptions?.icon); 2159 Image.fillColor(this.subHeaderTheme.rightIconColor); 2160 Image.width(RIGHT_SINGLE_ICON_SIZE); 2161 Image.height(RIGHT_SINGLE_ICON_SIZE); 2162 Image.focusable(true); 2163 Image.draggable(false); 2164 }, Image); 2165 }); 2166 } 2167 }, If); 2168 If.pop(); 2169 }); 2170 } else { 2171 this.ifElseBranchUpdateFunction(1, () => { 2172 }); 2173 } 2174 }, If); 2175 If.pop(); 2176 } 2177 2178 rerender() { 2179 this.updateDirtyElements(); 2180 } 2181} 2182 2183class Util { 2184 static isSymbolResource(t1) { 2185 if (!Util.isResourceType(t1)) { 2186 return false; 2187 } 2188 let u1 = t1; 2189 return u1?.type === RESOURCE_TYPE_SYMBOL; 2190 } 2191 2192 static isResourceType(s1) { 2193 if (!s1) { 2194 return false; 2195 } 2196 if (typeof s1 === 'string' || typeof s1 === 'undefined') { 2197 return false; 2198 } 2199 return true; 2200 } 2201 2202 static getNumberByResource(m1, n1) { 2203 try { 2204 let r1 = resourceManager.getSystemResourceManager().getNumber(m1); 2205 if (r1 === 0) { 2206 return n1; 2207 } else { 2208 return r1; 2209 } 2210 } catch (o1) { 2211 let p1 = o1.code; 2212 let q1 = o1.message; 2213 hilog.error(0x3900, 'Ace', `SubHeader getNumberByResource error, code: ${p1}, message: ${q1}`); 2214 return n1; 2215 } 2216 } 2217 2218 static getStringByResource(g1, h1) { 2219 try { 2220 let l1 = getContext().resourceManager.getStringSync(g1); 2221 if (l1 === '') { 2222 return h1; 2223 } else { 2224 return l1; 2225 } 2226 } catch (i1) { 2227 let j1 = i1.code; 2228 let k1 = i1.message; 2229 hilog.error(0x3900, 'Ace', `SubHeader getStringByResource error, code: ${j1}, message: ${k1}`); 2230 return ''; 2231 } 2232 } 2233 2234 static numberToSize(e1) { 2235 if (typeof e1 === 'string') { 2236 const f1 = parseInt(e1); 2237 return f1; 2238 } else if (typeof e1 === 'number') { 2239 return e1; 2240 } else { 2241 return getContext().resourceManager.getNumber(e1); 2242 } 2243 } 2244 2245 static symbolFontSize(d1) { 2246 return Util.numberToSize(d1) + 'vp'; 2247 } 2248} 2249 2250function getResourceValue(b1) { 2251 if (RESOURCE_CACHE_MAP.hasKey(b1)) { 2252 let c1 = RESOURCE_CACHE_MAP.get(b1).resourceValue; 2253 if (typeof c1 === 'number') { 2254 return c1; 2255 } else { 2256 c1 = Util.getNumberByResource(RESOURCE_CACHE_MAP.get(b1).resourceId, 2257 RESOURCE_CACHE_MAP.get(b1).defaultValue); 2258 RESOURCE_CACHE_MAP.get(b1).resourceValue = c1; 2259 return c1; 2260 } 2261 } 2262 return 0; 2263} 2264 2265class TextArrowLayout extends ViewPU { 2266 constructor(v, w, x, y = -1, z = undefined, a1) { 2267 super(v, x, y, a1); 2268 if (typeof z === 'function') { 2269 this.paramsGenerator_ = z; 2270 } 2271 this.textArrowBuilder = this.doNothingBuilder; 2272 this.setInitiallyProvidedValue(w); 2273 this.finalizeConstruction(); 2274 } 2275 2276 setInitiallyProvidedValue(u) { 2277 if (u.textArrowBuilder !== undefined) { 2278 this.textArrowBuilder = u.textArrowBuilder; 2279 } 2280 } 2281 2282 updateStateVars(t) { 2283 } 2284 2285 purgeVariableDependenciesOnElmtId(s) { 2286 } 2287 2288 aboutToBeDeleted() { 2289 SubscriberManager.Get().delete(this.id__()); 2290 this.aboutToBeDeletedInternal(); 2291 } 2292 2293 doNothingBuilder(r = null) { 2294 } 2295 2296 onPlaceChildren(k, l, m) { 2297 let n = 0; 2298 let o = 0; 2299 for (let p = 0; p < l.length; p++) { 2300 let q = l[p]; 2301 q.layout({ x: n, y: o }); 2302 } 2303 } 2304 2305 onMeasureSize(a, b, c) { 2306 let d = ARROW_ICON_WIDTH; 2307 let e = OPERATE_ITEM_LENGTH; 2308 let f = b[INDEX_ZERO]; 2309 let g = { 2310 minWidth: Math.max(d, Number(c.minWidth)), 2311 maxWidth: c.maxWidth, 2312 minHeight: Math.max(e, Number(c.minHeight)), 2313 maxHeight: c.maxHeight, 2314 }; 2315 let h = f.measure(g); 2316 d = Math.max(d, h.width); 2317 e = Math.max(e, h.height); 2318 let i = b[INDEX_ONE]; 2319 let j = { 2320 minWidth: d, 2321 maxWidth: d, 2322 minHeight: e, 2323 maxHeight: e, 2324 }; 2325 i?.measure(j); 2326 return { width: d, height: e }; 2327 } 2328 2329 initialRender() { 2330 this.textArrowBuilder.bind(this)(); 2331 } 2332 2333 rerender() { 2334 this.updateDirtyElements(); 2335 } 2336} 2337 2338export default { 2339 OperationType, SubHeader 2340};