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