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