1/* 2 * Copyright (c) 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 __decorate = (this && this.__decorate) || function (c28, d28, e28, f28) { 24 var g28 = arguments.length, h28 = g28 < 3 ? d28 : f28 === null ? f28 = Object.getOwnPropertyDescriptor(d28, e28) : f28, i28; 25 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") 26 h28 = Reflect.decorate(c28, d28, e28, f28); 27 else 28 for (var j28 = c28.length - 1; j28 >= 0; j28--) 29 if (i28 = c28[j28]) 30 h28 = (g28 < 3 ? i28(h28) : g28 > 3 ? i28(d28, e28, h28) : i28(d28, e28)) || h28; 31 return g28 > 3 && h28 && Object.defineProperty(d28, e28, h28), h28; 32}; 33if (!("finalizeConstruction" in ViewPU.prototype)) { 34 Reflect.set(ViewPU.prototype, "finalizeConstruction", () => { }); 35} 36 37const arkuiNode = requireNapi('arkui.node'); 38const LengthMetrics = arkuiNode.LengthMetrics; 39const ColorMetrics = arkuiNode.ColorMetrics; 40const LengthUnit = arkuiNode.LengthUnit; 41const resourceManager = requireNapi('resourceManager'); 42const BusinessError = requireNapi('base'); 43const common = requireNapi('app.ability.common'); 44const hilog = requireNapi('hilog'); 45const HashMap = requireNapi('util.HashMap'); 46const SymbolGlyphModifier = requireNapi('arkui.modifier').SymbolGlyphModifier; 47const KeyCode = requireNapi('multimodalInput.keyCode').KeyCode; 48 49const INDEX_ZERO = 0; 50const INDEX_ONE = 1; 51const INDEX_TWO = 2; 52const SINGLE_LINE_NUM = 1; 53const DOUBLE_LINE_NUM = 2; 54const RESOURCE_TYPE_SYMBOL = 40000; 55const LEFT_ICON_SIZE = '16vp'; 56const LEFT_ICON_SIZE_NUMBER = 16; 57const LEFT_TEXT_NUMBER = 8; 58const OPERATE_ITEM_LENGTH = 24; 59const ARROW_ICON_WIDTH = 12; 60const SINGLE_ICON_ZONE_SIZE = 28; 61const RIGHT_SINGLE_ICON_SIZE = '24vp'; 62const PADDING_LEVEL_2 = 4; 63const MAX_RIGHT_WIDTH = '34%'; 64const MIN_FONT_SIZE = 1.75; 65const MIN_HOT_AREA_LENGTH = 40; 66const MULTI_ICON_REGION_WIDTH = 37; 67const ICON_REGION_X = -9; 68const ICON_REGION_Y = -6; 69const SINGLE_ICON_REGION_X = -12; 70const SINGLE_ICON_NUMBER = 1; 71const PADDING_LEFT = 2; 72let SubHeaderV2Title = class SubHeaderV2Title { 73 constructor(a28) { 74 this.primaryTitle = a28.primaryTitle; 75 this.primaryTitleModifier = a28.primaryTitleModifier; 76 this.secondaryTitle = a28.secondaryTitle; 77 this.secondaryTitleModifier = a28.secondaryTitleModifier; 78 } 79}; 80__decorate([ 81 Trace 82], SubHeaderV2Title.prototype, "primaryTitle", void 0); 83__decorate([ 84 Trace 85], SubHeaderV2Title.prototype, "primaryTitleModifier", void 0); 86__decorate([ 87 Trace 88], SubHeaderV2Title.prototype, "secondaryTitle", void 0); 89__decorate([ 90 Trace 91], SubHeaderV2Title.prototype, "secondaryTitleModifier", void 0); 92SubHeaderV2Title = __decorate([ 93 ObservedV2 94], SubHeaderV2Title); 95export { SubHeaderV2Title }; 96let SubHeaderV2Select = class SubHeaderV2Select { 97 constructor(z27) { 98 this.options = z27.options; 99 this.selectedIndex = z27.selectedIndex; 100 this.selectedContent = z27.selectedContent; 101 this.onSelect = z27.onSelect; 102 this.defaultFocus = z27.defaultFocus; 103 } 104}; 105__decorate([ 106 Trace 107], SubHeaderV2Select.prototype, "options", void 0); 108__decorate([ 109 Trace 110], SubHeaderV2Select.prototype, "selectedIndex", void 0); 111__decorate([ 112 Trace 113], SubHeaderV2Select.prototype, "selectedContent", void 0); 114__decorate([ 115 Trace 116], SubHeaderV2Select.prototype, "onSelect", void 0); 117__decorate([ 118 Trace 119], SubHeaderV2Select.prototype, "defaultFocus", void 0); 120SubHeaderV2Select = __decorate([ 121 ObservedV2 122], SubHeaderV2Select); 123export { SubHeaderV2Select }; 124export var SubHeaderV2OperationType; 125(function (y27) { 126 y27[y27["TEXT_ARROW"] = 0] = "TEXT_ARROW"; 127 y27[y27["BUTTON"] = 1] = "BUTTON"; 128 y27[y27["ICON_GROUP"] = 2] = "ICON_GROUP"; 129 y27[y27["LOADING"] = 3] = "LOADING"; 130})(SubHeaderV2OperationType || (SubHeaderV2OperationType = {})); 131let SubHeaderV2OperationItem = class SubHeaderV2OperationItem { 132 constructor(x27) { 133 this.content = x27.content; 134 this.action = x27.action; 135 this.accessibilityText = x27.accessibilityText; 136 this.accessibilityDescription = x27.accessibilityDescription; 137 this.accessibilityLevel = x27.accessibilityLevel; 138 this.defaultFocus = x27.defaultFocus; 139 } 140}; 141__decorate([ 142 Trace 143], SubHeaderV2OperationItem.prototype, "content", void 0); 144__decorate([ 145 Trace 146], SubHeaderV2OperationItem.prototype, "action", void 0); 147__decorate([ 148 Trace 149], SubHeaderV2OperationItem.prototype, "accessibilityText", void 0); 150__decorate([ 151 Trace 152], SubHeaderV2OperationItem.prototype, "accessibilityDescription", void 0); 153__decorate([ 154 Trace 155], SubHeaderV2OperationItem.prototype, "accessibilityLevel", void 0); 156__decorate([ 157 Trace 158], SubHeaderV2OperationItem.prototype, "defaultFocus", void 0); 159SubHeaderV2OperationItem = __decorate([ 160 ObservedV2 161], SubHeaderV2OperationItem); 162export { SubHeaderV2OperationItem }; 163let ContentIconOption = class ContentIconOption { 164}; 165__decorate([ 166 Trace 167], ContentIconOption.prototype, "content", void 0); 168__decorate([ 169 Trace 170], ContentIconOption.prototype, "subContent", void 0); 171__decorate([ 172 Trace 173], ContentIconOption.prototype, "iconOptions", void 0); 174__decorate([ 175 Trace 176], ContentIconOption.prototype, "action", void 0); 177__decorate([ 178 Trace 179], ContentIconOption.prototype, "accessibilityLevel", void 0); 180__decorate([ 181 Trace 182], ContentIconOption.prototype, "accessibilityText", void 0); 183__decorate([ 184 Trace 185], ContentIconOption.prototype, "accessibilityDescription", void 0); 186__decorate([ 187 Trace 188], ContentIconOption.prototype, "defaultFocus", void 0); 189ContentIconOption = __decorate([ 190 ObservedV2 191], ContentIconOption); 192let FontStyle = class FontStyle { 193 constructor() { 194 this.maxLines = 0; 195 this.fontWeight = 0; 196 } 197}; 198__decorate([ 199 Trace 200], FontStyle.prototype, "maxLines", void 0); 201__decorate([ 202 Trace 203], FontStyle.prototype, "fontWeight", void 0); 204__decorate([ 205 Trace 206], FontStyle.prototype, "fontColor", void 0); 207__decorate([ 208 Trace 209], FontStyle.prototype, "alignment", void 0); 210FontStyle = __decorate([ 211 ObservedV2 212], FontStyle); 213let SubHeaderTheme = class SubHeaderTheme { 214 constructor() { 215 this.fontPrimaryColor = { "id": -1, "type": 10001, params: ['sys.color.font_primary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 216 this.fontSecondaryColor = { "id": -1, "type": 10001, params: ['sys.color.font_secondary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 217 this.fontButtonColor = { "id": -1, "type": 10001, params: ['sys.color.font_emphasize'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 218 this.iconArrowColor = { "id": -1, "type": 10001, params: ['sys.color.icon_tertiary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 219 this.textArrowHoverBgColor = { "id": -1, "type": 10001, params: ['sys.color.interactive_hover'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 220 this.borderFocusColor = { "id": -1, "type": 10001, params: ['sys.color.interactive_focus'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 221 this.leftIconColor = { "id": -1, "type": 10001, params: ['sys.color.icon_secondary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 222 this.rightIconColor = { "id": -1, "type": 10001, params: ['sys.color.icon_primary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 223 } 224}; 225__decorate([ 226 Trace 227], SubHeaderTheme.prototype, "fontPrimaryColor", void 0); 228__decorate([ 229 Trace 230], SubHeaderTheme.prototype, "fontSecondaryColor", void 0); 231__decorate([ 232 Trace 233], SubHeaderTheme.prototype, "fontButtonColor", void 0); 234__decorate([ 235 Trace 236], SubHeaderTheme.prototype, "iconArrowColor", void 0); 237__decorate([ 238 Trace 239], SubHeaderTheme.prototype, "textArrowHoverBgColor", void 0); 240__decorate([ 241 Trace 242], SubHeaderTheme.prototype, "borderFocusColor", void 0); 243__decorate([ 244 Trace 245], SubHeaderTheme.prototype, "leftIconColor", void 0); 246__decorate([ 247 Trace 248], SubHeaderTheme.prototype, "rightIconColor", void 0); 249SubHeaderTheme = __decorate([ 250 ObservedV2 251], SubHeaderTheme); 252function __Text__secondaryTitleStyles(k16) { 253 Text.fontSize(`${getResourceValue('sys.float.Subtitle_S')}fp`); 254 Text.fontColor(k16?.fontColor ?? { "id": -1, "type": 10001, params: ['sys.color.font_secondary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 255 Text.fontWeight(k16?.fontWeight); 256 Text.maxLines(k16?.maxLines); 257 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 258 Text.align(k16?.alignment); 259} 260function __Text__primaryTitleStyles(j16) { 261 Text.fontSize(`${getResourceValue('sys.float.subheader_title_font_size')}fp`); 262 Text.fontColor(j16?.fontColor ?? { "id": -1, "type": 10001, params: ['sys.color.font_primary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 263 Text.fontWeight(j16?.fontWeight); 264 Text.maxLines(j16?.maxLines); 265 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 266 Text.align(j16?.alignment); 267} 268class SubHeaderModifier { 269 constructor() { 270 this.isAgeing = false; 271 } 272 applyNormalAttribute(i16) { 273 if (this.isAgeing) { 274 i16.width('100%'); 275 } 276 else { 277 } 278 } 279} 280export class SubHeaderV2 extends ViewV2 { 281 constructor(r27, s27, t27, u27 = -1, v27, w27) { 282 super(r27, u27, w27); 283 this.initParam("icon", (s27 && "icon" in s27) ? s27.icon : undefined); 284 this.initParam("title", (s27 && "title" in s27) ? s27.title : undefined); 285 this.initParam("select", (s27 && "select" in s27) ? s27.select : undefined); 286 this.initParam("operationType", (s27 && "operationType" in s27) ? s27.operationType : SubHeaderV2OperationType.BUTTON); 287 this.initParam("operationItems", (s27 && "operationItems" in s27) ? s27.operationItems : undefined); 288 this.titleBuilder = "titleBuilder" in s27 ? s27.titleBuilder : undefined; 289 this.fontSize = 1; 290 this.ageing = true; 291 this.textArrowBgColor = { "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 292 this.buttonBgColor = { "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 293 this.selectedIndex = -1; 294 this.selectedContent = ''; 295 this.symbolWidth = LEFT_ICON_SIZE_NUMBER + LEFT_TEXT_NUMBER; 296 this.subHeaderModifier = new SubHeaderModifier(); 297 this.isFollowingSystemFontScale = false; 298 this.appMaxFontScale = 3.2; 299 this.subHeaderV2Theme = new SubHeaderTheme(); 300 this.subHeaderMargin = { 301 start: LengthMetrics.vp(getResourceValue('sys.float.margin_left')), 302 end: LengthMetrics.vp(getResourceValue('sys.float.margin_right')), 303 }; 304 this.finalizeConstruction(); 305 } 306 onWillApplyTheme(q27) { 307 this.subHeaderV2Theme.fontPrimaryColor = q27.colors.fontPrimary; 308 this.subHeaderV2Theme.fontSecondaryColor = q27.colors.fontSecondary; 309 this.subHeaderV2Theme.fontButtonColor = q27.colors.fontEmphasize; 310 this.subHeaderV2Theme.iconArrowColor = q27.colors.iconTertiary; 311 this.subHeaderV2Theme.textArrowHoverBgColor = q27.colors.interactiveHover; 312 this.subHeaderV2Theme.borderFocusColor = q27.colors.interactiveFocus; 313 this.subHeaderV2Theme.leftIconColor = q27.colors.iconSecondary; 314 this.subHeaderV2Theme.rightIconColor = q27.colors.iconPrimary; 315 } 316 async aboutToAppear() { 317 let p27 = this.getUIContext(); 318 this.isFollowingSystemFontScale = p27.isFollowingSystemFontScale(); 319 this.appMaxFontScale = p27.getMaxFontScale(); 320 this.fontSize = this.updateFontScale(); 321 if (this.isSuitableAging()) { 322 this.ageing = true; 323 this.subHeaderModifier.isAgeing = this.ageing; 324 } 325 else { 326 this.ageing = false; 327 this.subHeaderModifier.isAgeing = this.ageing; 328 } 329 if (this.select) { 330 this.selectedIndex = this.select.selectedIndex; 331 this.selectedContent = this.select.selectedContent; 332 } 333 } 334 updateFontScale() { 335 try { 336 let n27 = this.getUIContext(); 337 let o27 = n27.getHostContext()?.config?.fontSizeScale ?? 1; 338 if (!this.isFollowingSystemFontScale) { 339 return 1; 340 } 341 return Math.min(o27, this.appMaxFontScale); 342 } 343 catch (k27) { 344 let l27 = k27.code; 345 let m27 = k27.message; 346 hilog.error(0x3900, 'Ace', `Faild to init fontsizescale info,cause, code: ${l27}, message: ${m27}`); 347 return 1; 348 } 349 } 350 IconSecondaryTitleStyle(l26, m26 = null) { 351 this.observeComponentCreation2((i27, j27) => { 352 Flex.create({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }); 353 Flex.padding({ 354 end: LengthMetrics.vp(getResourceValue('sys.float.padding_level6')), 355 top: this.fontSize >= MIN_FONT_SIZE ? LengthMetrics.vp(getResourceValue('sys.float.padding_level0')) 356 : LengthMetrics.vp(getResourceValue('sys.float.padding_level4')), 357 bottom: this.fontSize >= MIN_FONT_SIZE ? LengthMetrics.vp(getResourceValue('sys.float.padding_level0')) 358 : LengthMetrics.vp(getResourceValue('sys.float.padding_level4')), 359 }); 360 }, Flex); 361 this.observeComponentCreation2((s26, t26) => { 362 If.create(); 363 if (Util.isSymbolResource(l26.iconOptions)) { 364 this.ifElseBranchUpdateFunction(0, () => { 365 { 366 this.observeComponentCreation2((a27, b27) => { 367 if (b27) { 368 let c27 = new SymbolGlyphChild(this, { 369 icon: l26.iconOptions, 370 fontColor: [this.subHeaderV2Theme.leftIconColor], 371 changeSymbolWidth: (h27) => { 372 this.symbolWidth = h27.width; 373 } 374 }, undefined, a27, () => { }, { page: "library/src/main/ets/components/MainPage.ets", line: 331, col: 9 }); 375 ViewV2.create(c27); 376 let d27 = () => { 377 return { 378 icon: l26.iconOptions, 379 fontColor: [this.subHeaderV2Theme.leftIconColor], 380 changeSymbolWidth: (g27) => { 381 this.symbolWidth = g27.width; 382 } 383 }; 384 }; 385 c27.paramsGenerator_ = d27; 386 } 387 else { 388 this.updateStateVarsOfChildByElmtId(a27, { 389 icon: l26.iconOptions, 390 fontColor: [this.subHeaderV2Theme.leftIconColor] 391 }); 392 } 393 }, { name: "SymbolGlyphChild" }); 394 } 395 }); 396 } 397 else { 398 this.ifElseBranchUpdateFunction(1, () => { 399 this.observeComponentCreation2((w26, x26) => { 400 Image.create(l26.iconOptions); 401 Image.fillColor(this.subHeaderV2Theme.leftIconColor); 402 Image.width(LEFT_ICON_SIZE); 403 Image.height(LEFT_ICON_SIZE); 404 Image.margin({ end: LengthMetrics.vp(getResourceValue('sys.float.padding_level4')) }); 405 Image.draggable(false); 406 Image.flexShrink(0); 407 }, Image); 408 }); 409 } 410 }, If); 411 If.pop(); 412 this.observeComponentCreation2((q26, r26) => { 413 Text.create(l26.content); 414 __Text__secondaryTitleStyles({ 415 maxLines: DOUBLE_LINE_NUM, 416 fontWeight: FontWeight.Medium, 417 alignment: Alignment.Start, 418 fontColor: this.subHeaderV2Theme.fontSecondaryColor, 419 }); 420 Text.attributeModifier.bind(this)(this.title?.secondaryTitleModifier); 421 Text.flexShrink(1); 422 }, Text); 423 Text.pop(); 424 Flex.pop(); 425 } 426 isSuitableAging() { 427 return (this.fontSize >= MIN_FONT_SIZE) && ((this.operationType === SubHeaderV2OperationType.TEXT_ARROW) || 428 this.operationType === SubHeaderV2OperationType.BUTTON) && this.operationItems !== undefined && 429 (this.operationItems?.length > 0) && this.operationItems[0].content !== ''; 430 } 431 isLeftAreaAccessibilityGroup() { 432 if (this.titleBuilder || this.title?.secondaryTitle) { 433 return true; 434 } 435 if (this.select) { 436 return false; 437 } 438 return true; 439 } 440 SelectStyle(d26, e26 = null) { 441 this.observeComponentCreation2((g26, h26) => { 442 Select.create(d26.options); 443 Select.height('auto'); 444 Select.width('auto'); 445 Select.selected(this.selectedIndex); 446 Select.value(this.selectedContent); 447 Select.defaultFocus(this.select?.defaultFocus); 448 Select.onSelect((j26, k26) => { 449 this.selectedIndex = j26; 450 if (k26) { 451 this.selectedContent = k26; 452 } 453 if (d26.onSelect) { 454 d26.onSelect(j26, k26); 455 } 456 }); 457 Select.font({ 458 size: `${getResourceValue('sys.float.Body_L')}fp`, 459 weight: FontWeight.Medium, 460 }); 461 }, Select); 462 Select.pop(); 463 } 464 SubTitleStyle(s25, t25 = null) { 465 this.observeComponentCreation2((b26, c26) => { 466 Column.create(); 467 Column.width('100%'); 468 Column.padding({ 469 end: LengthMetrics.vp(getResourceValue('sys.float.padding_level0')), 470 top: this.fontSize >= MIN_FONT_SIZE ? LengthMetrics.vp(getResourceValue('sys.float.padding_level0')) 471 : LengthMetrics.vp(getResourceValue('sys.float.padding_level4')), 472 bottom: this.fontSize >= MIN_FONT_SIZE ? LengthMetrics.vp(getResourceValue('sys.float.padding_level0')) 473 : LengthMetrics.vp(getResourceValue('sys.float.padding_level4')), 474 }); 475 Column.alignItems(HorizontalAlign.Start); 476 }, Column); 477 this.observeComponentCreation2((z25, a26) => { 478 Text.create(s25.content); 479 __Text__primaryTitleStyles({ 480 fontWeight: getResourceValue('sys.float.subheader_title_font_weight'), 481 maxLines: DOUBLE_LINE_NUM, 482 alignment: Alignment.Start, 483 fontColor: this.subHeaderV2Theme.fontPrimaryColor, 484 }); 485 Text.attributeModifier.bind(this)(this.title?.primaryTitleModifier); 486 }, Text); 487 Text.pop(); 488 this.observeComponentCreation2((x25, y25) => { 489 Text.create(s25.subContent); 490 __Text__secondaryTitleStyles({ 491 maxLines: DOUBLE_LINE_NUM, 492 fontWeight: FontWeight.Regular, 493 alignment: Alignment.Start, 494 fontColor: this.subHeaderV2Theme.fontSecondaryColor, 495 }); 496 Text.margin({ 497 top: getResourceValue('sys.float.padding_level1'), 498 }); 499 Text.attributeModifier.bind(this)(this.title?.secondaryTitleModifier); 500 }, Text); 501 Text.pop(); 502 Column.pop(); 503 } 504 SecondTitleStyle(n25, o25 = null) { 505 this.observeComponentCreation2((q25, r25) => { 506 Text.create(n25.content); 507 __Text__secondaryTitleStyles({ 508 maxLines: DOUBLE_LINE_NUM, 509 fontWeight: FontWeight.Medium, 510 alignment: Alignment.Start, 511 fontColor: this.subHeaderV2Theme.fontSecondaryColor, 512 }); 513 Text.attributeModifier.bind(this)(this.title?.secondaryTitleModifier); 514 Text.padding({ 515 end: LengthMetrics.vp(getResourceValue('sys.float.padding_level6')), 516 top: this.fontSize >= MIN_FONT_SIZE ? LengthMetrics.vp(getResourceValue('sys.float.padding_level0')) 517 : LengthMetrics.vp(getResourceValue('sys.float.padding_level4')), 518 bottom: this.fontSize >= MIN_FONT_SIZE ? LengthMetrics.vp(getResourceValue('sys.float.padding_level0')) 519 : LengthMetrics.vp(getResourceValue('sys.float.padding_level4')), 520 }); 521 }, Text); 522 Text.pop(); 523 } 524 PrimaryTitleStyle(i25, j25 = null) { 525 this.observeComponentCreation2((l25, m25) => { 526 Text.create(i25.content); 527 __Text__primaryTitleStyles({ 528 fontWeight: getResourceValue('sys.float.subheader_title_font_weight'), 529 maxLines: DOUBLE_LINE_NUM, 530 alignment: Alignment.Start, 531 fontColor: this.subHeaderV2Theme.fontPrimaryColor, 532 }); 533 Text.attributeModifier.bind(this)(this.title?.primaryTitleModifier); 534 Text.padding({ 535 end: LengthMetrics.vp(getResourceValue('sys.float.padding_level0')), 536 top: this.fontSize >= MIN_FONT_SIZE ? LengthMetrics.vp(getResourceValue('sys.float.padding_level0')) 537 : LengthMetrics.vp(getResourceValue('sys.float.padding_level4')), 538 bottom: this.fontSize >= MIN_FONT_SIZE ? LengthMetrics.vp(getResourceValue('sys.float.padding_level0')) 539 : LengthMetrics.vp(getResourceValue('sys.float.padding_level4')), 540 }); 541 }, Text); 542 Text.pop(); 543 } 544 leftArea(x24 = null) { 545 this.observeComponentCreation2((z24, a25) => { 546 If.create(); 547 if (this.titleBuilder) { 548 this.ifElseBranchUpdateFunction(0, () => { 549 this.titleBuilder.bind(this)(); 550 }); 551 } 552 else if (this.title?.secondaryTitle && this.icon) { 553 this.ifElseBranchUpdateFunction(1, () => { 554 this.IconSecondaryTitleStyle.bind(this)(makeBuilderParameterProxy("IconSecondaryTitleStyle", { content: () => this.title?.secondaryTitle, iconOptions: () => (this["__icon"] ? this["__icon"] : this["icon"]) })); 555 }); 556 } 557 else if (this.title?.secondaryTitle && this.title?.primaryTitle) { 558 this.ifElseBranchUpdateFunction(2, () => { 559 this.SubTitleStyle.bind(this)(makeBuilderParameterProxy("SubTitleStyle", { content: () => this.title?.primaryTitle, subContent: () => this.title?.secondaryTitle })); 560 }); 561 } 562 else if (this.title?.secondaryTitle) { 563 this.ifElseBranchUpdateFunction(3, () => { 564 this.SecondTitleStyle.bind(this)(makeBuilderParameterProxy("SecondTitleStyle", { content: () => this.title?.secondaryTitle })); 565 }); 566 } 567 else if (this.select) { 568 this.ifElseBranchUpdateFunction(4, () => { 569 this.SelectStyle.bind(this)(this.select); 570 }); 571 } 572 else if (this.title?.primaryTitle) { 573 this.ifElseBranchUpdateFunction(5, () => { 574 this.PrimaryTitleStyle.bind(this)(makeBuilderParameterProxy("PrimaryTitleStyle", { content: () => this.title?.primaryTitle })); 575 }); 576 } 577 else { 578 this.ifElseBranchUpdateFunction(6, () => { 579 this.dummyFunction.bind(this)(); 580 }); 581 } 582 }, If); 583 If.pop(); 584 } 585 isRightAreaExists() { 586 if (this.operationItems && this.operationItems.length > 0) { 587 return true; 588 } 589 if (this.operationType === SubHeaderV2OperationType.LOADING) { 590 return true; 591 } 592 return false; 593 } 594 getRightAreaMaxWidth() { 595 if (this.operationType === SubHeaderV2OperationType.ICON_GROUP && 596 (this.operationItems && this.operationItems.length > 0)) { 597 return '100%'; 598 } 599 return MAX_RIGHT_WIDTH; 600 } 601 getRightAreaMinWidth() { 602 if (this.operationItems && this.operationItems.length > 0) { 603 return MIN_HOT_AREA_LENGTH; 604 } 605 return 0; 606 } 607 getAccessibilityDescription() { 608 if (!this.operationItems || this.operationItems.length <= 0) { 609 return ''; 610 } 611 if (this.operationItems[0]?.accessibilityDescription && this.operationItems[0]?.accessibilityDescription !== '') { 612 return this.operationItems[0]?.accessibilityDescription; 613 } 614 return ''; 615 } 616 leftIconMargin() { 617 if (this.titleBuilder) { 618 return LengthMetrics.vp(0); 619 } 620 if (this.icon && Util.isSymbolResource(this.icon)) { 621 return this.ageing ? 622 LengthMetrics.vp(this.symbolWidth) : 623 LengthMetrics.vp(0); 624 } 625 else { 626 return (this.ageing && this.icon) ? LengthMetrics.vp(LEFT_ICON_SIZE_NUMBER + 627 LEFT_TEXT_NUMBER) : LengthMetrics.vp(0); 628 } 629 } 630 onMeasureSize(q24, r24, s24) { 631 let t24 = { width: q24.width, height: q24.height }; 632 let u24 = this.getUIContext().getHostContext(); 633 this.fontSize = this.updateFontScale(); 634 if (this.isSuitableAging()) { 635 this.ageing = true; 636 this.subHeaderModifier.isAgeing = this.ageing; 637 } 638 else { 639 this.ageing = false; 640 this.subHeaderModifier.isAgeing = this.ageing; 641 } 642 r24.forEach((w24) => { 643 s24.minHeight = Math.min(Number(this.getMinHeight()), Number(s24.maxHeight)); 644 t24.height = w24.measure(s24).height; 645 t24.width = Number(s24.maxWidth); 646 }); 647 return t24; 648 } 649 ButtonStyle(c24 = null) { 650 this.observeComponentCreation2((e24, f24) => { 651 If.create(); 652 if (this.operationItems) { 653 this.ifElseBranchUpdateFunction(0, () => { 654 this.observeComponentCreation2((m24, n24) => { 655 Button.createWithChild({ type: ButtonType.Normal, stateEffect: false }); 656 Button.focusable(true); 657 Button.focusBox({ 658 margin: { value: INDEX_ZERO, unit: LengthUnit.VP }, 659 strokeColor: ColorMetrics.resourceColor(this.subHeaderV2Theme.borderFocusColor), 660 strokeWidth: LengthMetrics.vp(getResourceValue('sys.float.outline_extra_larger')), 661 }); 662 Button.padding({ 663 start: LengthMetrics.vp(getResourceValue('sys.float.padding_level1')), 664 end: LengthMetrics.vp(getResourceValue('sys.float.padding_level1')), 665 top: LengthMetrics.vp(getResourceValue('sys.float.padding_level2')), 666 bottom: LengthMetrics.vp(getResourceValue('sys.float.padding_level2')), 667 }); 668 Button.margin({ 669 start: this.ageing ? 670 LengthMetrics.vp(LengthMetrics.vp(getResourceValue('sys.float.padding_level0')).value + 671 this.leftIconMargin().value) : 672 LengthMetrics.vp(LengthMetrics.vp(getResourceValue('sys.float.padding_level4')).value + 673 this.leftIconMargin().value), 674 bottom: LengthMetrics.vp(this.ageing ? getResourceValue('sys.float.padding_level0') : 675 getResourceValue('sys.float.padding_level2')), 676 }); 677 Button.backgroundColor(this.buttonBgColor); 678 Button.constraintSize({ minHeight: OPERATE_ITEM_LENGTH }); 679 Button.align(Alignment.End); 680 Button.borderRadius(getResourceValue('sys.float.corner_radius_level4')); 681 Button.onHover((p24) => { 682 if (p24) { 683 this.buttonBgColor = this.subHeaderV2Theme.textArrowHoverBgColor; 684 } 685 else { 686 this.buttonBgColor = { "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 687 } 688 }); 689 ViewStackProcessor.visualState("disabled"); 690 Button.opacity(getResourceValue('sys.float.interactive_disable')); 691 ViewStackProcessor.visualState("pressed"); 692 Button.backgroundColor({ "id": -1, "type": 10001, params: ['sys.color.interactive_pressed'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 693 ViewStackProcessor.visualState(); 694 }, Button); 695 this.observeComponentCreation2((k24, l24) => { 696 Text.create(this.operationItems[0].content); 697 __Text__secondaryTitleStyles({ 698 fontWeight: FontWeight.Medium, 699 maxLines: DOUBLE_LINE_NUM, 700 fontColor: this.subHeaderV2Theme.fontButtonColor, 701 }); 702 Text.defaultFocus(this.operationItems[0].defaultFocus); 703 Text.focusable(true); 704 }, Text); 705 Text.pop(); 706 Button.pop(); 707 }); 708 } 709 else { 710 this.ifElseBranchUpdateFunction(1, () => { 711 }); 712 } 713 }, If); 714 If.pop(); 715 } 716 getTextArrowPaddingLeft() { 717 if (this.operationItems && this.operationItems.length > 0 && this.operationItems[0].content) { 718 return LengthMetrics.vp(getResourceValue('sys.float.padding_level1')); 719 } 720 return LengthMetrics.vp(getResourceValue('sys.float.padding_level0')); 721 } 722 getTextArrowMarginRight() { 723 if (this.operationItems && this.operationItems.length > 0 && this.operationItems[0].content) { 724 return LengthMetrics.vp(PADDING_LEVEL_2 + ARROW_ICON_WIDTH); 725 } 726 return LengthMetrics.vp(ARROW_ICON_WIDTH); 727 } 728 TextStyle(q23 = null) { 729 this.observeComponentCreation2((a24, b24) => { 730 Row.create(); 731 Row.attributeModifier.bind(this)(this.subHeaderModifier); 732 Row.alignItems(VerticalAlign.Center); 733 Row.focusable(true); 734 Row.constraintSize({ minHeight: OPERATE_ITEM_LENGTH }); 735 Row.padding({ 736 start: this.getTextArrowPaddingLeft(), 737 top: this.ageing ? LengthMetrics.vp(0) : LengthMetrics.vp(getResourceValue('sys.float.padding_level2')), 738 bottom: this.ageing ? LengthMetrics.vp(0) : LengthMetrics.vp(getResourceValue('sys.float.padding_level2')), 739 }); 740 }, Row); 741 this.observeComponentCreation2((t23, u23) => { 742 If.create(); 743 if (this.operationItems?.[0]) { 744 this.ifElseBranchUpdateFunction(0, () => { 745 this.observeComponentCreation2((y23, z23) => { 746 Text.create(this.operationItems[0].content); 747 __Text__secondaryTitleStyles({ 748 maxLines: DOUBLE_LINE_NUM, 749 fontWeight: FontWeight.Regular, 750 alignment: Alignment.End, 751 fontColor: this.subHeaderV2Theme.fontSecondaryColor, 752 }); 753 Text.focusable(true); 754 Text.defaultFocus(this.operationItems[0].defaultFocus); 755 Text.margin({ 756 end: this.getTextArrowMarginRight(), 757 }); 758 }, Text); 759 Text.pop(); 760 }); 761 } 762 else { 763 this.ifElseBranchUpdateFunction(1, () => { 764 }); 765 } 766 }, If); 767 If.pop(); 768 Row.pop(); 769 } 770 ArrowStyle(j23 = null) { 771 this.observeComponentCreation2((o23, p23) => { 772 Row.create(); 773 Row.justifyContent(FlexAlign.End); 774 }, Row); 775 this.observeComponentCreation2((m23, n23) => { 776 SymbolGlyph.create({ "id": -1, "type": 40000, params: ['sys.symbol.chevron_right'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 777 SymbolGlyph.fontSize(RIGHT_SINGLE_ICON_SIZE); 778 SymbolGlyph.fontColor([this.subHeaderV2Theme.iconArrowColor]); 779 SymbolGlyph.draggable(false); 780 SymbolGlyph.width(ARROW_ICON_WIDTH); 781 SymbolGlyph.height(OPERATE_ITEM_LENGTH); 782 }, SymbolGlyph); 783 Row.pop(); 784 } 785 TextArrowStyle(f21 = null) { 786 this.observeComponentCreation2((h21, i21) => { 787 If.create(); 788 if (this.operationItems?.[0] && this.operationItems[0] && this.operationItems[0].content && 789 this.operationItems[0].content.toString().length > 0) { 790 this.ifElseBranchUpdateFunction(0, () => { 791 this.observeComponentCreation2((h23, i23) => { 792 Stack.create(); 793 Stack.focusable(true); 794 Stack.align(this.ageing ? Alignment.Start : Alignment.End); 795 Stack.margin({ 796 start: LengthMetrics.vp(this.ageing ? getResourceValue('sys.float.padding_level0') : 797 getResourceValue('sys.float.padding_level4')), 798 bottom: LengthMetrics.vp(this.ageing ? getResourceValue('sys.float.padding_level0') : 799 getResourceValue('sys.float.padding_level2')), 800 }); 801 }, Stack); 802 this.observeComponentCreation2((d23, e23) => { 803 Button.createWithChild({ type: ButtonType.Normal, stateEffect: false }); 804 Button.padding(INDEX_ZERO); 805 Button.margin({ start: this.leftIconMargin() }); 806 Button.backgroundColor(this.textArrowBgColor); 807 Button.focusBox({ 808 margin: { value: INDEX_ZERO, unit: LengthUnit.VP }, 809 strokeColor: ColorMetrics.resourceColor(this.subHeaderV2Theme.borderFocusColor), 810 strokeWidth: LengthMetrics.vp(getResourceValue('sys.float.outline_extra_larger')), 811 }); 812 Button.borderRadius(getResourceValue('sys.float.corner_radius_level4')); 813 ViewStackProcessor.visualState("disabled"); 814 Button.opacity(getResourceValue('sys.float.interactive_disable')); 815 ViewStackProcessor.visualState("pressed"); 816 Button.backgroundColor({ "id": -1, "type": 10001, params: ['sys.color.interactive_pressed'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 817 ViewStackProcessor.visualState(); 818 Button.onHover((g23) => { 819 if (g23) { 820 this.textArrowBgColor = this.subHeaderV2Theme.textArrowHoverBgColor; 821 } 822 else { 823 this.textArrowBgColor = { "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 824 } 825 }); 826 }, Button); 827 { 828 this.observeComponentCreation2((z21, a22) => { 829 if (a22) { 830 let b22 = new TextArrowLayout(this, { 831 textArrowBuilder: () => { 832 this.observeComponentCreation2((s22, t22) => { 833 ForEach.create(); 834 const u22 = w22 => { 835 const x22 = w22; 836 this.observeComponentCreation2((z22, a23) => { 837 If.create(); 838 if (x22 === INDEX_ZERO) { 839 this.ifElseBranchUpdateFunction(0, () => { 840 this.TextStyle.bind(this)(); 841 }); 842 } 843 else { 844 this.ifElseBranchUpdateFunction(1, () => { 845 this.ArrowStyle.bind(this)(); 846 }); 847 } 848 }, If); 849 If.pop(); 850 }; 851 this.forEachUpdateFunction(s22, [INDEX_ZERO, INDEX_ONE], u22); 852 }, ForEach); 853 ForEach.pop(); 854 } 855 }, undefined, z21, () => { }, { page: "library/src/main/ets/components/MainPage.ets", line: 736, col: 11 }); 856 ViewPU.create(b22); 857 let c22 = () => { 858 return { 859 textArrowBuilder: () => { 860 this.observeComponentCreation2((g22, h22) => { 861 ForEach.create(); 862 const i22 = k22 => { 863 const l22 = k22; 864 this.observeComponentCreation2((n22, o22) => { 865 If.create(); 866 if (l22 === INDEX_ZERO) { 867 this.ifElseBranchUpdateFunction(0, () => { 868 this.TextStyle.bind(this)(); 869 }); 870 } 871 else { 872 this.ifElseBranchUpdateFunction(1, () => { 873 this.ArrowStyle.bind(this)(); 874 }); 875 } 876 }, If); 877 If.pop(); 878 }; 879 this.forEachUpdateFunction(g22, [INDEX_ZERO, INDEX_ONE], i22); 880 }, ForEach); 881 ForEach.pop(); 882 } 883 }; 884 }; 885 b22.paramsGenerator_ = c22; 886 } 887 else { 888 this.updateStateVarsOfChildByElmtId(z21, {}); 889 } 890 }, { name: "TextArrowLayout" }); 891 } 892 Button.pop(); 893 Stack.pop(); 894 }); 895 } 896 else { 897 this.ifElseBranchUpdateFunction(1, () => { 898 this.observeComponentCreation2((t21, u21) => { 899 Row.create(); 900 Row.focusable(true); 901 Row.constraintSize({ minWidth: this.getRightAreaMinWidth() }); 902 Row.justifyContent(FlexAlign.End); 903 }, Row); 904 this.observeComponentCreation2((p21, q21) => { 905 Button.createWithChild({ type: ButtonType.Normal, stateEffect: false }); 906 Button.width(ARROW_ICON_WIDTH); 907 Button.height(OPERATE_ITEM_LENGTH); 908 Button.backgroundColor(this.textArrowBgColor); 909 Button.focusBox({ 910 margin: { value: INDEX_ZERO, unit: LengthUnit.VP }, 911 strokeColor: ColorMetrics.resourceColor(this.subHeaderV2Theme.borderFocusColor), 912 strokeWidth: LengthMetrics.vp(getResourceValue('sys.float.outline_extra_larger')), 913 }); 914 Button.borderRadius(getResourceValue('sys.float.corner_radius_level4')); 915 ViewStackProcessor.visualState("disabled"); 916 Button.opacity(getResourceValue('sys.float.interactive_disable')); 917 ViewStackProcessor.visualState("pressed"); 918 Button.backgroundColor({ "id": -1, "type": 10001, params: ['sys.color.interactive_pressed'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 919 ViewStackProcessor.visualState(); 920 Button.onHover((s21) => { 921 if (s21) { 922 this.textArrowBgColor = this.subHeaderV2Theme.textArrowHoverBgColor; 923 } 924 else { 925 this.textArrowBgColor = { "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 926 } 927 }); 928 Button.focusable(true); 929 Button.margin({ 930 start: LengthMetrics.vp(this.ageing ? getResourceValue('sys.float.padding_level0') : 931 getResourceValue('sys.float.padding_level4')), 932 bottom: LengthMetrics.vp(this.ageing ? getResourceValue('sys.float.padding_level0') : 933 getResourceValue('sys.float.padding_level2')), 934 }); 935 }, Button); 936 this.observeComponentCreation2((n21, o21) => { 937 SymbolGlyph.create({ "id": -1, "type": 40000, params: ['sys.symbol.chevron_right'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 938 SymbolGlyph.fontSize(RIGHT_SINGLE_ICON_SIZE); 939 SymbolGlyph.fontColor([this.subHeaderV2Theme.iconArrowColor]); 940 SymbolGlyph.draggable(false); 941 SymbolGlyph.focusable(true); 942 SymbolGlyph.width(ARROW_ICON_WIDTH); 943 SymbolGlyph.height(OPERATE_ITEM_LENGTH); 944 }, SymbolGlyph); 945 Button.pop(); 946 Row.pop(); 947 }); 948 } 949 }, If); 950 If.pop(); 951 } 952 IconGroupStyle(b20 = null) { 953 this.observeComponentCreation2((d21, e21) => { 954 Row.create(); 955 Row.justifyContent(FlexAlign.End); 956 Row.focusable(true); 957 }, Row); 958 this.observeComponentCreation2((e20, f20) => { 959 ForEach.create(); 960 const g20 = (l20, m20) => { 961 const n20 = l20; 962 this.observeComponentCreation2((p20, q20) => { 963 If.create(); 964 if (m20 <= INDEX_TWO) { 965 this.ifElseBranchUpdateFunction(0, () => { 966 this.observeComponentCreation2((b21, c21) => { 967 __Common__.create(); 968 __Common__.margin({ 969 start: LengthMetrics.vp(getResourceValue('sys.float.padding_level4')), 970 bottom: LengthMetrics.vp(getResourceValue('sys.float.padding_level3')), 971 }); 972 }, __Common__); 973 { 974 this.observeComponentCreation2((v20, w20) => { 975 if (w20) { 976 let x20 = new SingleIconStyle(this, { 977 item: { 978 iconOptions: this.operationItems?.[m20].content, 979 action: this.operationItems?.[m20].action, 980 defaultFocus: this.operationItems?.[m20].defaultFocus, 981 accessibilityLevel: this.operationItems?.[m20].accessibilityLevel, 982 accessibilityText: this.operationItems?.[m20].accessibilityText, 983 accessibilityDescription: this.operationItems?.[m20].accessibilityDescription, 984 }, 985 isSingleIcon: this.operationItems?.length === SINGLE_ICON_NUMBER, 986 }, undefined, v20, () => { }, { page: "library/src/main/ets/components/MainPage.ets", line: 825, col: 13 }); 987 ViewV2.create(x20); 988 let y20 = () => { 989 return { 990 item: { 991 iconOptions: this.operationItems?.[m20].content, 992 action: this.operationItems?.[m20].action, 993 defaultFocus: this.operationItems?.[m20].defaultFocus, 994 accessibilityLevel: this.operationItems?.[m20].accessibilityLevel, 995 accessibilityText: this.operationItems?.[m20].accessibilityText, 996 accessibilityDescription: this.operationItems?.[m20].accessibilityDescription, 997 }, 998 isSingleIcon: this.operationItems?.length === SINGLE_ICON_NUMBER 999 }; 1000 }; 1001 x20.paramsGenerator_ = y20; 1002 } 1003 else { 1004 this.updateStateVarsOfChildByElmtId(v20, { 1005 item: { 1006 iconOptions: this.operationItems?.[m20].content, 1007 action: this.operationItems?.[m20].action, 1008 defaultFocus: this.operationItems?.[m20].defaultFocus, 1009 accessibilityLevel: this.operationItems?.[m20].accessibilityLevel, 1010 accessibilityText: this.operationItems?.[m20].accessibilityText, 1011 accessibilityDescription: this.operationItems?.[m20].accessibilityDescription, 1012 }, 1013 isSingleIcon: this.operationItems?.length === SINGLE_ICON_NUMBER 1014 }); 1015 } 1016 }, { name: "SingleIconStyle" }); 1017 } 1018 __Common__.pop(); 1019 }); 1020 } 1021 else { 1022 this.ifElseBranchUpdateFunction(1, () => { 1023 }); 1024 } 1025 }, If); 1026 If.pop(); 1027 }; 1028 this.forEachUpdateFunction(e20, this.operationItems, g20, (j20, k20) => { 1029 return `${k20}`; 1030 }, true, true); 1031 }, ForEach); 1032 ForEach.pop(); 1033 Row.pop(); 1034 } 1035 rightArea(b19 = null) { 1036 this.observeComponentCreation2((x19, y19) => { 1037 If.create(); 1038 if (this.operationType === SubHeaderV2OperationType.BUTTON && 1039 (this.operationItems && this.operationItems.length > 0)) { 1040 this.ifElseBranchUpdateFunction(0, () => { 1041 this.ButtonStyle.bind(this)(); 1042 }); 1043 } 1044 else { 1045 this.ifElseBranchUpdateFunction(1, () => { 1046 }); 1047 } 1048 }, If); 1049 If.pop(); 1050 this.observeComponentCreation2((t19, u19) => { 1051 If.create(); 1052 if (this.operationType === SubHeaderV2OperationType.TEXT_ARROW && 1053 (this.operationItems && this.operationItems.length > 0)) { 1054 this.ifElseBranchUpdateFunction(0, () => { 1055 this.TextArrowStyle.bind(this)(); 1056 }); 1057 } 1058 else { 1059 this.ifElseBranchUpdateFunction(1, () => { 1060 }); 1061 } 1062 }, If); 1063 If.pop(); 1064 this.observeComponentCreation2((p19, q19) => { 1065 If.create(); 1066 if (this.operationType === SubHeaderV2OperationType.ICON_GROUP && 1067 (this.operationItems && this.operationItems.length > 0)) { 1068 this.ifElseBranchUpdateFunction(0, () => { 1069 this.IconGroupStyle.bind(this)(); 1070 }); 1071 } 1072 else { 1073 this.ifElseBranchUpdateFunction(1, () => { 1074 }); 1075 } 1076 }, If); 1077 If.pop(); 1078 this.observeComponentCreation2((l19, m19) => { 1079 If.create(); 1080 if (this.operationType === SubHeaderV2OperationType.LOADING) { 1081 this.ifElseBranchUpdateFunction(0, () => { 1082 this.LoadingProcessStyle.bind(this)(); 1083 }); 1084 } 1085 else { 1086 this.ifElseBranchUpdateFunction(1, () => { 1087 }); 1088 } 1089 }, If); 1090 If.pop(); 1091 this.observeComponentCreation2((h19, i19) => { 1092 If.create(); 1093 if (this.operationType === undefined && (this.operationItems && this.operationItems.length > 0)) { 1094 this.ifElseBranchUpdateFunction(0, () => { 1095 this.ButtonStyle.bind(this)(); 1096 }); 1097 } 1098 else { 1099 this.ifElseBranchUpdateFunction(1, () => { 1100 }); 1101 } 1102 }, If); 1103 If.pop(); 1104 } 1105 rightAreaParent(f18 = null) { 1106 this.observeComponentCreation2((h18, i18) => { 1107 If.create(); 1108 if (this.operationType === SubHeaderV2OperationType.BUTTON || 1109 this.operationType === SubHeaderV2OperationType.TEXT_ARROW) { 1110 this.ifElseBranchUpdateFunction(0, () => { 1111 this.observeComponentCreation2((u18, v18) => { 1112 Button.createWithChild({ type: ButtonType.Normal, stateEffect: false }); 1113 Button.focusable(this.operationItems ? true : false); 1114 Button.margin(INDEX_ZERO); 1115 Button.padding(INDEX_ZERO); 1116 Button.align(Alignment.BottomEnd); 1117 Button.onKeyEvent((a19) => { 1118 if (!a19) { 1119 return; 1120 } 1121 if ((a19.keyCode === KeyCode.KEYCODE_SPACE || a19.keyCode === KeyCode.KEYCODE_ENTER) && 1122 a19.type === KeyType.Down) { 1123 if ((this.operationType === SubHeaderV2OperationType.TEXT_ARROW || 1124 this.operationType === SubHeaderV2OperationType.BUTTON) && 1125 this.operationItems && this.operationItems.length > 0 && this.operationItems[0].action) { 1126 this.operationItems[0].action(); 1127 } 1128 a19.stopPropagation(); 1129 } 1130 }); 1131 Button.onClick(() => { 1132 if ((this.operationType === SubHeaderV2OperationType.TEXT_ARROW || 1133 this.operationType === SubHeaderV2OperationType.BUTTON) && 1134 this.operationItems && this.operationItems.length > 0 && this.operationItems[0].action) { 1135 this.operationItems[0].action(); 1136 } 1137 }); 1138 Button.onTouch((z18) => { 1139 if (z18.type === TouchType.Down) { 1140 if (this.operationType === SubHeaderV2OperationType.TEXT_ARROW) { 1141 this.textArrowBgColor = { "id": -1, "type": 10001, params: ['sys.color.interactive_pressed'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1142 } 1143 if (this.operationType === SubHeaderV2OperationType.BUTTON) { 1144 this.buttonBgColor = { "id": -1, "type": 10001, params: ['sys.color.interactive_pressed'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1145 } 1146 } 1147 if (z18.type === TouchType.Up || z18.type === TouchType.Cancel) { 1148 if (this.operationType === SubHeaderV2OperationType.TEXT_ARROW) { 1149 this.textArrowBgColor = { "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1150 } 1151 if (this.operationType === SubHeaderV2OperationType.BUTTON) { 1152 this.buttonBgColor = { "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1153 } 1154 } 1155 }); 1156 Button.constraintSize({ 1157 maxWidth: this.getRightAreaMaxWidth(), 1158 minWidth: this.getRightAreaMinWidth(), 1159 minHeight: MIN_HOT_AREA_LENGTH, 1160 }); 1161 Button.flexShrink(0); 1162 Button.accessibilityLevel(this.operationType === SubHeaderV2OperationType.BUTTON || 1163 this.operationType === SubHeaderV2OperationType.TEXT_ARROW ? 1164 this.getRightAreaAccessibilityLevel() : 'no'); 1165 Button.hoverEffect(HoverEffect.None); 1166 Button.backgroundColor({ "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 1167 Button.accessibilityGroup(true); 1168 Button.accessibilityText(this.getRightAreaAccessibilityText()); 1169 Button.accessibilityDescription(this.getAccessibilityDescription()); 1170 }, Button); 1171 this.rightArea.bind(this)(); 1172 Button.pop(); 1173 }); 1174 } 1175 else { 1176 this.ifElseBranchUpdateFunction(1, () => { 1177 this.observeComponentCreation2((l18, m18) => { 1178 Row.create(); 1179 Row.focusable(this.operationItems && this.operationType !== SubHeaderV2OperationType.LOADING ? true : false); 1180 Row.justifyContent(FlexAlign.End); 1181 Row.alignItems(VerticalAlign.Bottom); 1182 Row.onKeyEvent((r18) => { 1183 if (!r18) { 1184 return; 1185 } 1186 if ((r18.keyCode === KeyCode.KEYCODE_SPACE || r18.keyCode === KeyCode.KEYCODE_ENTER) && 1187 r18.type === KeyType.Down) { 1188 if ((this.operationType === SubHeaderV2OperationType.TEXT_ARROW || 1189 this.operationType === SubHeaderV2OperationType.BUTTON) && 1190 this.operationItems && this.operationItems.length > 0 && this.operationItems[0].action) { 1191 this.operationItems[0].action(); 1192 } 1193 r18.stopPropagation(); 1194 } 1195 }); 1196 Row.onClick(() => { 1197 if ((this.operationType === SubHeaderV2OperationType.TEXT_ARROW || 1198 this.operationType === SubHeaderV2OperationType.BUTTON) && 1199 this.operationItems && this.operationItems.length > 0 && this.operationItems[0].action) { 1200 this.operationItems[0].action(); 1201 } 1202 }); 1203 Row.onTouch((q18) => { 1204 if (q18.type === TouchType.Down) { 1205 if (this.operationType === SubHeaderV2OperationType.TEXT_ARROW) { 1206 this.textArrowBgColor = { "id": -1, "type": 10001, params: ['sys.color.interactive_pressed'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1207 } 1208 if (this.operationType === SubHeaderV2OperationType.BUTTON) { 1209 this.buttonBgColor = { "id": -1, "type": 10001, params: ['sys.color.interactive_pressed'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1210 } 1211 } 1212 if (q18.type === TouchType.Up || q18.type === TouchType.Cancel) { 1213 if (this.operationType === SubHeaderV2OperationType.TEXT_ARROW) { 1214 this.textArrowBgColor = { "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1215 } 1216 if (this.operationType === SubHeaderV2OperationType.BUTTON) { 1217 this.buttonBgColor = { "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1218 } 1219 } 1220 }); 1221 Row.constraintSize({ 1222 maxWidth: this.getRightAreaMaxWidth(), 1223 minWidth: this.getRightAreaMinWidth(), 1224 minHeight: MIN_HOT_AREA_LENGTH, 1225 }); 1226 Row.flexShrink(0); 1227 Row.accessibilityLevel(this.operationType === SubHeaderV2OperationType.BUTTON || 1228 this.operationType === SubHeaderV2OperationType.TEXT_ARROW ? 1229 this.getRightAreaAccessibilityLevel() : 'no'); 1230 }, Row); 1231 this.rightArea.bind(this)(); 1232 Row.pop(); 1233 }); 1234 } 1235 }, If); 1236 If.pop(); 1237 } 1238 rightAreaParentAging(j17 = null) { 1239 this.observeComponentCreation2((l17, m17) => { 1240 If.create(); 1241 if (this.operationType === SubHeaderV2OperationType.BUTTON || 1242 this.operationType === SubHeaderV2OperationType.TEXT_ARROW) { 1243 this.ifElseBranchUpdateFunction(0, () => { 1244 this.observeComponentCreation2((y17, z17) => { 1245 Button.createWithChild({ type: ButtonType.Normal, stateEffect: false }); 1246 Button.focusable(this.operationItems ? true : false); 1247 Button.align(Alignment.Start); 1248 Button.onKeyEvent((e18) => { 1249 if (!e18) { 1250 return; 1251 } 1252 if ((e18.keyCode === KeyCode.KEYCODE_SPACE || e18.keyCode === KeyCode.KEYCODE_ENTER) && 1253 e18.type === KeyType.Down) { 1254 if ((this.operationType === SubHeaderV2OperationType.TEXT_ARROW || 1255 this.operationType === SubHeaderV2OperationType.BUTTON) && 1256 this.operationItems && this.operationItems.length > 0 && this.operationItems[0].action) { 1257 this.operationItems[0].action(); 1258 } 1259 e18.stopPropagation(); 1260 } 1261 }); 1262 Button.onClick(() => { 1263 if ((this.operationType === SubHeaderV2OperationType.TEXT_ARROW || 1264 this.operationType === SubHeaderV2OperationType.BUTTON) && 1265 this.operationItems && this.operationItems.length > 0 && this.operationItems[0].action) { 1266 this.operationItems[0].action(); 1267 } 1268 }); 1269 Button.onTouch((d18) => { 1270 if (d18.type === TouchType.Down) { 1271 if (this.operationType === SubHeaderV2OperationType.TEXT_ARROW) { 1272 this.textArrowBgColor = { "id": -1, "type": 10001, params: ['sys.color.interactive_pressed'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1273 } 1274 if (this.operationType === SubHeaderV2OperationType.BUTTON) { 1275 this.buttonBgColor = { "id": -1, "type": 10001, params: ['sys.color.interactive_pressed'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1276 } 1277 } 1278 if (d18.type === TouchType.Up || d18.type === TouchType.Cancel) { 1279 if (this.operationType === SubHeaderV2OperationType.TEXT_ARROW) { 1280 this.textArrowBgColor = { "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1281 } 1282 if (this.operationType === SubHeaderV2OperationType.BUTTON) { 1283 this.buttonBgColor = { "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1284 } 1285 } 1286 }); 1287 Button.margin({ 1288 bottom: getResourceValue('sys.float.padding_level4'), 1289 }); 1290 Button.padding({ 1291 start: LengthMetrics.vp(getResourceValue('sys.float.margin_left') - PADDING_LEFT), 1292 end: LengthMetrics.vp(getResourceValue('sys.float.margin_right')), 1293 }); 1294 Button.accessibilityLevel(this.operationType === SubHeaderV2OperationType.BUTTON || 1295 this.operationType === SubHeaderV2OperationType.TEXT_ARROW ? this.getRightAreaAccessibilityLevel() : 'no'); 1296 Button.backgroundColor({ "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 1297 Button.hoverEffect(HoverEffect.None); 1298 Button.accessibilityGroup(true); 1299 Button.accessibilityText(this.getRightAreaAccessibilityText()); 1300 Button.accessibilityDescription(this.getAccessibilityDescription()); 1301 }, Button); 1302 this.rightArea.bind(this)(); 1303 Button.pop(); 1304 }); 1305 } 1306 else { 1307 this.ifElseBranchUpdateFunction(1, () => { 1308 this.observeComponentCreation2((p17, q17) => { 1309 Row.create(); 1310 Row.focusable(this.operationItems && this.operationType !== SubHeaderV2OperationType.LOADING ? true : false); 1311 Row.justifyContent(FlexAlign.Start); 1312 Row.onKeyEvent((v17) => { 1313 if (!v17) { 1314 return; 1315 } 1316 if ((v17.keyCode === KeyCode.KEYCODE_SPACE || v17.keyCode === KeyCode.KEYCODE_ENTER) && 1317 v17.type === KeyType.Down) { 1318 if ((this.operationType === SubHeaderV2OperationType.TEXT_ARROW || 1319 this.operationType === SubHeaderV2OperationType.BUTTON) && 1320 this.operationItems && this.operationItems.length > 0 && this.operationItems[0].action) { 1321 this.operationItems[0].action(); 1322 } 1323 v17.stopPropagation(); 1324 } 1325 }); 1326 Row.onClick(() => { 1327 if ((this.operationType === SubHeaderV2OperationType.TEXT_ARROW || 1328 this.operationType === SubHeaderV2OperationType.BUTTON) && 1329 this.operationItems && this.operationItems.length > 0 && this.operationItems[0].action) { 1330 this.operationItems[0].action(); 1331 } 1332 }); 1333 Row.onTouch((u17) => { 1334 if (u17.type === TouchType.Down) { 1335 if (this.operationType === SubHeaderV2OperationType.TEXT_ARROW) { 1336 this.textArrowBgColor = { "id": -1, "type": 10001, params: ['sys.color.interactive_pressed'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1337 } 1338 if (this.operationType === SubHeaderV2OperationType.BUTTON) { 1339 this.buttonBgColor = { "id": -1, "type": 10001, params: ['sys.color.interactive_pressed'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1340 } 1341 } 1342 if (u17.type === TouchType.Up || u17.type === TouchType.Cancel) { 1343 if (this.operationType === SubHeaderV2OperationType.TEXT_ARROW) { 1344 this.textArrowBgColor = { "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1345 } 1346 if (this.operationType === SubHeaderV2OperationType.BUTTON) { 1347 this.buttonBgColor = { "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1348 } 1349 } 1350 }); 1351 Row.margin({ 1352 bottom: getResourceValue('sys.float.padding_level4'), 1353 }); 1354 Row.padding({ 1355 start: LengthMetrics.vp(getResourceValue('sys.float.margin_left') - PADDING_LEFT), 1356 end: LengthMetrics.vp(getResourceValue('sys.float.margin_right')), 1357 }); 1358 Row.accessibilityLevel(this.operationType === SubHeaderV2OperationType.BUTTON || 1359 this.operationType === SubHeaderV2OperationType.TEXT_ARROW ? this.getRightAreaAccessibilityLevel() : 'no'); 1360 }, Row); 1361 this.rightArea.bind(this)(); 1362 Row.pop(); 1363 }); 1364 } 1365 }, If); 1366 If.pop(); 1367 } 1368 getRightAreaAccessibilityText() { 1369 if (!this.operationItems || this.operationItems?.length <= 0) { 1370 return ''; 1371 } 1372 if (this.operationItems[0]?.accessibilityText && this.operationItems[0]?.accessibilityText !== '') { 1373 return this.operationItems[0].accessibilityText; 1374 } 1375 else { 1376 if (this.operationType === SubHeaderV2OperationType.TEXT_ARROW && 1377 this.operationItems[0]?.content.toString().length <= 0) { 1378 return Util.getStringByResource(125833704, ''); 1379 } 1380 } 1381 return ''; 1382 } 1383 getMinHeight() { 1384 if (this.title?.secondaryTitle && this.icon) { 1385 return getResourceValue('sys.float.subheader_single_subtitle_height'); 1386 } 1387 else if (this.title?.secondaryTitle && this.title?.primaryTitle) { 1388 return getResourceValue('sys.float.subheader_double_height'); 1389 } 1390 else if (this.title?.primaryTitle || this.select) { 1391 return getResourceValue('sys.float.subheader_single_title_height'); 1392 } 1393 return getResourceValue('sys.float.subheader_single_subtitle_height'); 1394 } 1395 getAreaPadding() { 1396 let i17 = {}; 1397 if (!this.titleBuilder && ((this.title?.secondaryTitle && this.icon) || 1398 (!this.title?.primaryTitle && this.title?.secondaryTitle))) { 1399 i17 = { 1400 start: LengthMetrics.vp(getResourceValue('sys.float.padding_level6')), 1401 end: LengthMetrics.vp(getResourceValue('sys.float.padding_level6')), 1402 }; 1403 } 1404 else if (this.select) { 1405 i17 = { 1406 top: LengthMetrics.vp(getResourceValue('sys.float.padding_level2')), 1407 bottom: LengthMetrics.vp(getResourceValue('sys.float.padding_level2')), 1408 }; 1409 } 1410 return i17; 1411 } 1412 initialRender() { 1413 this.observeComponentCreation2((x13, f14) => { 1414 If.create(); 1415 if (this.isSuitableAging()) { 1416 this.ifElseBranchUpdateFunction(0, () => { 1417 this.observeComponentCreation2((g17, h17) => { 1418 Column.create(); 1419 Column.constraintSize({ minHeight: this.getMinHeight() }); 1420 Column.padding(this.getAreaPadding()); 1421 Column.alignItems(HorizontalAlign.Start); 1422 }, Column); 1423 this.observeComponentCreation2((e17, f17) => { 1424 Row.create(); 1425 Row.margin({ 1426 top: LengthMetrics.vp(getResourceValue('sys.float.padding_level8')), 1427 bottom: LengthMetrics.vp(getResourceValue('sys.float.padding_level1')), 1428 }); 1429 Row.padding({ 1430 start: LengthMetrics.vp(getResourceValue('sys.float.margin_left')), 1431 end: LengthMetrics.vp(getResourceValue('sys.float.margin_right')), 1432 }); 1433 Row.width('100%'); 1434 Row.accessibilityGroup(this.isLeftAreaAccessibilityGroup()); 1435 Row.accessibilityDescription(this.select ? '' : Util.getStringByResource(125834353, '')); 1436 }, Row); 1437 this.leftArea.bind(this)(); 1438 Row.pop(); 1439 this.observeComponentCreation2((a17, b17) => { 1440 If.create(); 1441 if (this.isRightAreaExists()) { 1442 this.ifElseBranchUpdateFunction(0, () => { 1443 this.rightAreaParentAging.bind(this)(); 1444 }); 1445 } 1446 else { 1447 this.ifElseBranchUpdateFunction(1, () => { 1448 }); 1449 } 1450 }, If); 1451 If.pop(); 1452 Column.pop(); 1453 }); 1454 } 1455 else { 1456 this.ifElseBranchUpdateFunction(1, () => { 1457 this.observeComponentCreation2((u16, v16) => { 1458 Flex.create({ direction: FlexDirection.Row, alignItems: ItemAlign.End }); 1459 Flex.constraintSize({ minHeight: this.getMinHeight() }); 1460 Flex.margin(this.subHeaderMargin); 1461 Flex.padding(this.getAreaPadding()); 1462 }, Flex); 1463 this.observeComponentCreation2((s16, t16) => { 1464 Row.create(); 1465 Row.margin({ 1466 top: this.fontSize >= MIN_FONT_SIZE ? getResourceValue('sys.float.padding_level8') : '', 1467 bottom: this.fontSize >= MIN_FONT_SIZE ? getResourceValue('sys.float.padding_level4') : '', 1468 }); 1469 Row.width('100%'); 1470 Row.flexShrink(1); 1471 Row.accessibilityGroup(this.isLeftAreaAccessibilityGroup()); 1472 Row.accessibilityDescription(this.select ? '' : Util.getStringByResource(125834353, '')); 1473 }, Row); 1474 this.leftArea.bind(this)(); 1475 Row.pop(); 1476 this.observeComponentCreation2((o16, p16) => { 1477 If.create(); 1478 if (this.isRightAreaExists()) { 1479 this.ifElseBranchUpdateFunction(0, () => { 1480 this.rightAreaParent.bind(this)(); 1481 }); 1482 } 1483 else { 1484 this.ifElseBranchUpdateFunction(1, () => { 1485 }); 1486 } 1487 }, If); 1488 If.pop(); 1489 Flex.pop(); 1490 }); 1491 } 1492 }, If); 1493 If.pop(); 1494 } 1495 getRightAreaAccessibilityLevel() { 1496 if (this.operationItems[0].accessibilityLevel && this.operationItems[0].accessibilityLevel !== '') { 1497 return this.operationItems[0].accessibilityLevel; 1498 } 1499 return 'yes'; 1500 } 1501 LoadingProcessStyle(p10 = null) { 1502 this.observeComponentCreation2((n13, o13) => { 1503 Row.create(); 1504 Row.justifyContent(FlexAlign.End); 1505 Row.padding({ 1506 top: getResourceValue('sys.float.padding_level2'), 1507 bottom: getResourceValue('sys.float.padding_level2'), 1508 }); 1509 Row.margin({ 1510 start: LengthMetrics.vp(getResourceValue('sys.float.padding_level4')), 1511 }); 1512 }, Row); 1513 this.observeComponentCreation2((a13, b13) => { 1514 LoadingProgress.create(); 1515 LoadingProgress.width(OPERATE_ITEM_LENGTH); 1516 LoadingProgress.height(OPERATE_ITEM_LENGTH); 1517 LoadingProgress.color({ "id": -1, "type": 10001, params: ['sys.color.icon_secondary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 1518 }, LoadingProgress); 1519 Row.pop(); 1520 } 1521 dummyFunction(v9 = null) { 1522 this.observeComponentCreation2((n10, o10) => { 1523 Row.create(); 1524 }, Row); 1525 Row.pop(); 1526 } 1527 updateStateVars(u9) { 1528 if (u9 === undefined) { 1529 return; 1530 } 1531 if ("icon" in u9) { 1532 this.updateParam("icon", u9.icon); 1533 } 1534 if ("title" in u9) { 1535 this.updateParam("title", u9.title); 1536 } 1537 if ("select" in u9) { 1538 this.updateParam("select", u9.select); 1539 } 1540 if ("operationType" in u9) { 1541 this.updateParam("operationType", u9.operationType); 1542 } 1543 if ("operationItems" in u9) { 1544 this.updateParam("operationItems", u9.operationItems); 1545 } 1546 } 1547 rerender() { 1548 this.updateDirtyElements(); 1549 } 1550} 1551__decorate([ 1552 Param 1553], SubHeaderV2.prototype, "icon", void 0); 1554__decorate([ 1555 Param 1556], SubHeaderV2.prototype, "title", void 0); 1557__decorate([ 1558 Param 1559], SubHeaderV2.prototype, "select", void 0); 1560__decorate([ 1561 Param 1562], SubHeaderV2.prototype, "operationType", void 0); 1563__decorate([ 1564 Param 1565], SubHeaderV2.prototype, "operationItems", void 0); 1566__decorate([ 1567 Local 1568], SubHeaderV2.prototype, "fontSize", void 0); 1569__decorate([ 1570 Local 1571], SubHeaderV2.prototype, "ageing", void 0); 1572__decorate([ 1573 Local 1574], SubHeaderV2.prototype, "textArrowBgColor", void 0); 1575__decorate([ 1576 Local 1577], SubHeaderV2.prototype, "buttonBgColor", void 0); 1578__decorate([ 1579 Local 1580], SubHeaderV2.prototype, "selectedIndex", void 0); 1581__decorate([ 1582 Local 1583], SubHeaderV2.prototype, "selectedContent", void 0); 1584__decorate([ 1585 Local 1586], SubHeaderV2.prototype, "symbolWidth", void 0); 1587__decorate([ 1588 Local 1589], SubHeaderV2.prototype, "subHeaderModifier", void 0); 1590__decorate([ 1591 Provider('subHeaderV2Theme') 1592], SubHeaderV2.prototype, "subHeaderV2Theme", void 0); 1593class SymbolGlyphChild extends ViewV2 { 1594 constructor(f6, r6, h7, p7 = -1, h8, j9) { 1595 super(f6, p7, j9); 1596 this.initParam("icon", (r6 && "icon" in r6) ? r6.icon : undefined); 1597 this.initParam("fontColor", (r6 && "fontColor" in r6) ? r6.fontColor : undefined); 1598 this.changeSymbolWidth = "changeSymbolWidth" in r6 ? r6.changeSymbolWidth : () => { 1599 }; 1600 this.result = { 1601 width: 0, 1602 height: 0 1603 }; 1604 this.finalizeConstruction(); 1605 } 1606 onMeasureSize(h5, i5, t5) { 1607 i5.forEach((a6) => { 1608 this.result = a6.measure(t5); 1609 }); 1610 console.log(`zzzz Child onMeasureSize ${JSON.stringify(this.result)}`); 1611 this.changeSymbolWidth(this.result); 1612 return this.result; 1613 } 1614 initialRender() { 1615 this.observeComponentCreation2((u4, v4) => { 1616 Column.create(); 1617 }, Column); 1618 this.observeComponentCreation2((b4, f4) => { 1619 SymbolGlyph.create(this.icon); 1620 SymbolGlyph.fontSize(LEFT_ICON_SIZE); 1621 SymbolGlyph.fontColor(this.fontColor); 1622 SymbolGlyph.attributeModifier.bind(this)(this.icon); 1623 SymbolGlyph.margin({ end: LengthMetrics.vp(getResourceValue('sys.float.padding_level4')) }); 1624 SymbolGlyph.flexShrink(0); 1625 }, SymbolGlyph); 1626 Column.pop(); 1627 } 1628 updateStateVars(v2) { 1629 if (v2 === undefined) { 1630 return; 1631 } 1632 if ("icon" in v2) { 1633 this.updateParam("icon", v2.icon); 1634 } 1635 if ("fontColor" in v2) { 1636 this.updateParam("fontColor", v2.fontColor); 1637 } 1638 } 1639 rerender() { 1640 this.updateDirtyElements(); 1641 } 1642} 1643__decorate([ 1644 Param 1645], SymbolGlyphChild.prototype, "icon", void 0); 1646__decorate([ 1647 Param 1648], SymbolGlyphChild.prototype, "fontColor", void 0); 1649__decorate([ 1650 Event 1651], SymbolGlyphChild.prototype, "changeSymbolWidth", void 0); 1652class SingleIconStyle extends ViewV2 { 1653 constructor(i3, j3, k3, l3 = -1, m3, n3) { 1654 super(i3, l3, n3); 1655 this.bgColor = { "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1656 this.isFocus = false; 1657 this.initParam("item", (j3 && "item" in j3) ? j3.item : null); 1658 this.subHeaderTheme = new SubHeaderTheme(); 1659 this.initParam("isSingleIcon", (j3 && "isSingleIcon" in j3) ? j3.isSingleIcon : true); 1660 this.finalizeConstruction(); 1661 } 1662 getRightIconAccessibilityText() { 1663 if (this.item?.accessibilityText) { 1664 return this.item.accessibilityText; 1665 } 1666 return ''; 1667 } 1668 getRightIconAccessibilityLevel() { 1669 if (this.item?.accessibilityLevel && this.item?.accessibilityLevel !== '') { 1670 return this.item.accessibilityLevel; 1671 } 1672 return 'auto'; 1673 } 1674 getRightIconAccessibilityDescription() { 1675 if (this.item?.accessibilityDescription && this.item?.accessibilityDescription !== '') { 1676 return this.item?.accessibilityDescription; 1677 } 1678 return ''; 1679 } 1680 initialRender() { 1681 this.observeComponentCreation2((o2, p2) => { 1682 If.create(); 1683 if (this.item && this.item.iconOptions) { 1684 this.ifElseBranchUpdateFunction(0, () => { 1685 this.observeComponentCreation2((t2, u2) => { 1686 Button.createWithChild({ type: ButtonType.Normal, stateEffect: false }); 1687 Button.focusable(true); 1688 Button.defaultFocus(this.item.defaultFocus); 1689 Button.width(SINGLE_ICON_ZONE_SIZE); 1690 Button.height(SINGLE_ICON_ZONE_SIZE); 1691 Button.align(Alignment.Center); 1692 Button.backgroundColor(this.bgColor); 1693 Button.borderRadius(getResourceValue('sys.float.corner_radius_level4')); 1694 Button.accessibilityLevel(this.getRightIconAccessibilityLevel()); 1695 Button.accessibilityText(this.getRightIconAccessibilityText()); 1696 Button.accessibilityDescription(this.getRightIconAccessibilityDescription()); 1697 Button.focusBox({ 1698 margin: { value: INDEX_ZERO, unit: LengthUnit.VP }, 1699 strokeColor: ColorMetrics.resourceColor(this.subHeaderTheme.borderFocusColor), 1700 strokeWidth: LengthMetrics.vp(getResourceValue('sys.float.outline_extra_larger')), 1701 }); 1702 ViewStackProcessor.visualState("disabled"); 1703 Button.opacity(getResourceValue('sys.float.interactive_disable')); 1704 ViewStackProcessor.visualState("pressed"); 1705 Button.backgroundColor({ "id": -1, "type": 10001, params: ['sys.color.interactive_pressed'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 1706 ViewStackProcessor.visualState(); 1707 Button.onTouch((a3) => { 1708 if (a3.type === TouchType.Down || TouchType.Cancel) { 1709 this.bgColor = { "id": -1, "type": 10001, params: ['sys.color.interactive_pressed'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1710 } 1711 if (a3.type === TouchType.Up) { 1712 this.bgColor = { "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1713 } 1714 }); 1715 Button.onHover((z2) => { 1716 if (z2) { 1717 this.bgColor = { "id": -1, "type": 10001, params: ['sys.color.interactive_hover'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1718 } 1719 else { 1720 this.bgColor = { "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }; 1721 } 1722 }); 1723 Button.responseRegion(this.iconResponseRegion()); 1724 Button.onClick((y2) => { 1725 if (this.item?.action) { 1726 this.item?.action(); 1727 } 1728 }); 1729 }, Button); 1730 this.IconZone.bind(this)(); 1731 Button.pop(); 1732 }); 1733 } 1734 else { 1735 this.ifElseBranchUpdateFunction(1, () => { 1736 }); 1737 } 1738 }, If); 1739 If.pop(); 1740 } 1741 iconResponseRegion() { 1742 if (this.isSingleIcon) { 1743 return { 1744 x: SINGLE_ICON_REGION_X, 1745 y: ICON_REGION_Y, 1746 width: MIN_HOT_AREA_LENGTH, 1747 height: MIN_HOT_AREA_LENGTH, 1748 }; 1749 } 1750 return { 1751 x: ICON_REGION_X, 1752 y: ICON_REGION_Y, 1753 width: MULTI_ICON_REGION_WIDTH, 1754 height: MIN_HOT_AREA_LENGTH, 1755 }; 1756 } 1757 IconZone(v1 = null) { 1758 this.observeComponentCreation2((x1, y1) => { 1759 If.create(); 1760 if (this.item && this.item.iconOptions) { 1761 this.ifElseBranchUpdateFunction(0, () => { 1762 this.observeComponentCreation2((c2, d2) => { 1763 If.create(); 1764 if (Util.isSymbolResource(this.item.iconOptions)) { 1765 this.ifElseBranchUpdateFunction(0, () => { 1766 this.observeComponentCreation2((k2, l2) => { 1767 SymbolGlyph.create(this.item.iconOptions); 1768 SymbolGlyph.fontSize(RIGHT_SINGLE_ICON_SIZE); 1769 SymbolGlyph.fontColor([this.subHeaderTheme.rightIconColor]); 1770 SymbolGlyph.attributeModifier.bind(this)(this.item.iconOptions); 1771 SymbolGlyph.focusable(true); 1772 }, SymbolGlyph); 1773 }); 1774 } 1775 else { 1776 this.ifElseBranchUpdateFunction(1, () => { 1777 this.observeComponentCreation2((g2, h2) => { 1778 Image.create(this.item?.iconOptions); 1779 Image.fillColor(this.subHeaderTheme.rightIconColor); 1780 Image.width(RIGHT_SINGLE_ICON_SIZE); 1781 Image.height(RIGHT_SINGLE_ICON_SIZE); 1782 Image.focusable(true); 1783 Image.draggable(false); 1784 }, Image); 1785 }); 1786 } 1787 }, If); 1788 If.pop(); 1789 }); 1790 } 1791 else { 1792 this.ifElseBranchUpdateFunction(1, () => { 1793 }); 1794 } 1795 }, If); 1796 If.pop(); 1797 } 1798 updateStateVars(g3) { 1799 if (g3 === undefined) { 1800 return; 1801 } 1802 if ("item" in g3) { 1803 this.updateParam("item", g3.item); 1804 } 1805 if ("isSingleIcon" in g3) { 1806 this.updateParam("isSingleIcon", g3.isSingleIcon); 1807 } 1808 } 1809 rerender() { 1810 this.updateDirtyElements(); 1811 } 1812} 1813__decorate([ 1814 Local 1815], SingleIconStyle.prototype, "bgColor", void 0); 1816__decorate([ 1817 Local 1818], SingleIconStyle.prototype, "isFocus", void 0); 1819__decorate([ 1820 Param 1821], SingleIconStyle.prototype, "item", void 0); 1822__decorate([ 1823 Consumer('subHeaderV2Theme') 1824], SingleIconStyle.prototype, "subHeaderTheme", void 0); 1825__decorate([ 1826 Param 1827], SingleIconStyle.prototype, "isSingleIcon", void 0); 1828class Util { 1829 static isSymbolResource(t1) { 1830 if (!Util.isResourceType(t1)) { 1831 return false; 1832 } 1833 if (t1 instanceof SymbolGlyphModifier) { 1834 return t1 instanceof SymbolGlyphModifier; 1835 } 1836 let u1 = t1; 1837 return u1.type === RESOURCE_TYPE_SYMBOL; 1838 } 1839 static isResourceType(s1) { 1840 if (!s1) { 1841 return false; 1842 } 1843 if (typeof s1 === 'string' || typeof s1 === 'undefined') { 1844 return false; 1845 } 1846 return true; 1847 } 1848 static getNumberByResource(m1, n1) { 1849 try { 1850 let r1 = resourceManager.getSystemResourceManager().getNumber(m1); 1851 if (r1 === 0) { 1852 return n1; 1853 } 1854 else { 1855 return r1; 1856 } 1857 } 1858 catch (o1) { 1859 let p1 = o1.code; 1860 let q1 = o1.message; 1861 hilog.error(0x3900, 'Ace', `SubHeader getNumberByResource error, code: ${p1}, message: ${q1}`); 1862 return 0; 1863 } 1864 } 1865 static getStringByResource(g1, h1) { 1866 try { 1867 let l1 = getContext().resourceManager.getStringSync(g1); 1868 if (l1 === '') { 1869 return h1; 1870 } 1871 else { 1872 return l1; 1873 } 1874 } 1875 catch (i1) { 1876 let j1 = i1.code; 1877 let k1 = i1.message; 1878 hilog.error(0x3900, 'Ace', `SubHeader getStringByResource error, code: ${j1}, message: ${k1}`); 1879 return ''; 1880 } 1881 } 1882 static numberToSize(e1) { 1883 if (typeof e1 === 'string') { 1884 const f1 = parseInt(e1); 1885 return f1; 1886 } 1887 else if (typeof e1 === 'number') { 1888 return e1; 1889 } 1890 else { 1891 return getContext().resourceManager.getNumber(e1); 1892 } 1893 } 1894 static symbolFontSize(d1) { 1895 return Util.numberToSize(d1) + 'vp'; 1896 } 1897} 1898const RESOURCE_CACHE_MAP = new HashMap(); 1899RESOURCE_CACHE_MAP.set('sys.float.padding_level0', { resourceId: 125830919, defaultValue: 0 }); 1900RESOURCE_CACHE_MAP.set('sys.float.padding_level1', { resourceId: 125830920, defaultValue: 2 }); 1901RESOURCE_CACHE_MAP.set('sys.float.padding_level2', { resourceId: 125830921, defaultValue: 4 }); 1902RESOURCE_CACHE_MAP.set('sys.float.padding_level3', { resourceId: 125830922, defaultValue: 6 }); 1903RESOURCE_CACHE_MAP.set('sys.float.padding_level4', { resourceId: 125830923, defaultValue: 8 }); 1904RESOURCE_CACHE_MAP.set('sys.float.padding_level6', { resourceId: 125830925, defaultValue: 12 }); 1905RESOURCE_CACHE_MAP.set('sys.float.padding_level8', { resourceId: 125830927, defaultValue: 16 }); 1906RESOURCE_CACHE_MAP.set('sys.float.margin_left', { resourceId: 125830936, defaultValue: 16 }); 1907RESOURCE_CACHE_MAP.set('sys.float.margin_right', { resourceId: 125830937, defaultValue: 16 }); 1908RESOURCE_CACHE_MAP.set('sys.float.outline_extra_larger', { resourceId: 125830951, defaultValue: 2 }); 1909RESOURCE_CACHE_MAP.set('sys.float.corner_radius_level4', { resourceId: 125830909, defaultValue: 8 }); 1910RESOURCE_CACHE_MAP.set('sys.float.Subtitle_S', { resourceId: 125830969, defaultValue: 14 }); 1911RESOURCE_CACHE_MAP.set('sys.float.subheader_title_font_size', { resourceId: 125834265, defaultValue: 18 }); 1912RESOURCE_CACHE_MAP.set('sys.float.Body_L', { resourceId: 125830970, defaultValue: 16 }); 1913RESOURCE_CACHE_MAP.set('sys.float.interactive_disable', { resourceId: 125831067, defaultValue: 0.4 }); 1914RESOURCE_CACHE_MAP.set('sys.float.subheader_single_title_height', { resourceId: 125834252, defaultValue: 56 }); 1915RESOURCE_CACHE_MAP.set('sys.float.subheader_single_subtitle_height', { resourceId: 125834253, defaultValue: 56 }); 1916RESOURCE_CACHE_MAP.set('sys.float.subheader_double_height', { resourceId: 125834254, defaultValue: 72 }); 1917RESOURCE_CACHE_MAP.set('sys.float.subheader_title_font_weight', { resourceId: 125834255, defaultValue: 700 }); 1918function getResourceValue(b1) { 1919 if (RESOURCE_CACHE_MAP.hasKey(b1)) { 1920 let c1 = RESOURCE_CACHE_MAP.get(b1).resourceValue; 1921 if (typeof c1 === 'number') { 1922 return c1; 1923 } 1924 else { 1925 c1 = Util.getNumberByResource(RESOURCE_CACHE_MAP.get(b1).resourceId, RESOURCE_CACHE_MAP.get(b1).defaultValue); 1926 RESOURCE_CACHE_MAP.get(b1).resourceValue = c1; 1927 return c1; 1928 } 1929 } 1930 return 0; 1931} 1932class TextArrowLayout extends ViewPU { 1933 constructor(v, w, x, y = -1, z = undefined, a1) { 1934 super(v, x, y, a1); 1935 if (typeof z === "function") { 1936 this.paramsGenerator_ = z; 1937 } 1938 this.textArrowBuilder = this.doNothingBuilder; 1939 this.setInitiallyProvidedValue(w); 1940 this.finalizeConstruction(); 1941 } 1942 setInitiallyProvidedValue(u) { 1943 if (u.textArrowBuilder !== undefined) { 1944 this.textArrowBuilder = u.textArrowBuilder; 1945 } 1946 } 1947 updateStateVars(t) { 1948 } 1949 purgeVariableDependenciesOnElmtId(s) { 1950 } 1951 aboutToBeDeleted() { 1952 SubscriberManager.Get().delete(this.id__()); 1953 this.aboutToBeDeletedInternal(); 1954 } 1955 doNothingBuilder(r = null) { 1956 } 1957 onPlaceChildren(k, l, m) { 1958 let n = 0; 1959 let o = 0; 1960 for (let p = 0; p < l.length; p++) { 1961 let q = l[p]; 1962 q.layout({ x: n, y: o }); 1963 } 1964 } 1965 onMeasureSize(a, b, c) { 1966 let d = ARROW_ICON_WIDTH; 1967 let e = OPERATE_ITEM_LENGTH; 1968 let f = b[INDEX_ZERO]; 1969 let g = { 1970 minWidth: Math.max(d, Number(c.minWidth)), 1971 maxWidth: c.maxWidth, 1972 minHeight: Math.max(e, Number(c.minHeight)), 1973 maxHeight: c.maxHeight, 1974 }; 1975 let h = f.measure(g); 1976 d = Math.max(d, h.width); 1977 e = Math.max(e, h.height); 1978 let i = b[INDEX_ONE]; 1979 let j = { 1980 minWidth: d, 1981 maxWidth: d, 1982 minHeight: e, 1983 maxHeight: e, 1984 }; 1985 i.measure(j); 1986 return { width: d, height: e }; 1987 } 1988 initialRender() { 1989 this.textArrowBuilder.bind(this)(); 1990 } 1991 rerender() { 1992 this.updateDirtyElements(); 1993 } 1994} 1995 1996export default { 1997 SubHeaderV2Title, SubHeaderV2Select, 1998 SubHeaderV2, SubHeaderV2OperationType, SubHeaderV2OperationItem 1999};