1/* 2 * Copyright (c) 2023-2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16if (!('finalizeConstruction' in ViewPU.prototype)) { 17 Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => { 18 }); 19} 20const LengthMetrics = requireNapi('arkui.node').LengthMetrics; 21const hilog = requireNapi('hilog'); 22const measure = requireNapi('measure'); 23 24export var IconType; 25(function (IconType) { 26 IconType[IconType['BADGE'] = 1] = 'BADGE'; 27 IconType[IconType['NORMAL_ICON'] = 2] = 'NORMAL_ICON'; 28 IconType[IconType['SYSTEM_ICON'] = 3] = 'SYSTEM_ICON'; 29 IconType[IconType['HEAD_SCULPTURE'] = 4] = 'HEAD_SCULPTURE'; 30 IconType[IconType['APP_ICON'] = 5] = 'APP_ICON'; 31 IconType[IconType['PREVIEW'] = 6] = 'PREVIEW'; 32 IconType[IconType['LONGITUDINAL'] = 7] = 'LONGITUDINAL'; 33 IconType[IconType['VERTICAL'] = 8] = 'VERTICAL'; 34})(IconType || (IconType = {})); 35var m; 36(function (j4) { 37 j4[j4['LEVEL1'] = 1.75] = 'LEVEL1'; 38 j4[j4['LEVEL2'] = 2] = 'LEVEL2'; 39 j4[j4['LEVEL3'] = 3.2] = 'LEVEL3'; 40})(m || (m = {})); 41var o; 42(function (i4) { 43 i4[i4['FIRST_HEIGHT'] = 48] = 'FIRST_HEIGHT'; 44 i4[i4['SECOND_HEIGHT'] = 56] = 'SECOND_HEIGHT'; 45 i4[i4['THIRD_HEIGHT'] = 64] = 'THIRD_HEIGHT'; 46 i4[i4['FOURTH_HEIGHT'] = 72] = 'FOURTH_HEIGHT'; 47 i4[i4['FIFTH_HEIGHT'] = 96] = 'FIFTH_HEIGHT'; 48})(o || (o = {})); 49const t = 1; 50const u = 2; 51const a1 = 4; 52const b1 = 8; 53const c1 = 6; 54const d1 = 4; 55const e1 = 4; 56const f1 = 8; 57const g1 = 16; 58const h1 = 24; 59const i1 = 32; 60const j1 = 32; 61const l1 = 40; 62const m1 = 28; 63const n1 = 64; 64const o1 = 96; 65const q1 = 96; 66const s1 = 96; 67const t1 = 16; 68const u1 = 0; 69const v1 = 0; 70const w1 = 0; 71const z1 = 4; 72const a2 = 24; 73const b2 = 2; 74const c2 = 12; 75const d2 = 40; 76const e2 = 48; 77const f2 = '0vp'; 78const g2 = 'calc(66% - 16vp)'; 79const h2 = '34%'; 80const i2 = '24vp'; 81const j2 = '54vp'; 82const l2 = '40vp'; 83const m2 = '80vp'; 84const n2 = '30vp'; 85const o2 = '30vp'; 86const q2 = '44vp'; 87const s2 = 'auto'; 88const t2 = 'yes'; 89const u2 = 'no'; 90const v2 = 40000; 91const w2 = new Map([ 92 [IconType.BADGE, f1], 93 [IconType.NORMAL_ICON, g1], 94 [IconType.SYSTEM_ICON, h1], 95 [IconType.HEAD_SCULPTURE, l1], 96 [IconType.APP_ICON, n1], 97 [IconType.PREVIEW, o1], 98 [IconType.LONGITUDINAL, q1], 99 [IconType.VERTICAL, s1] 100]); 101const z2 = LengthMetrics.resource({ 102 'id': -1, 103 'type': 10002, 104 params: ['sys.float.composeListItem_focus_dynamic_effect'], 105 'bundleName': '__harDefaultBundleName__', 106 'moduleName': '__harDefaultModuleName__' 107}).value !== 1; 108const a3 = 1; 109const b3 = -1; 110const c3 = 50; 111const d3 = { 112 'id': -1, 113 'type': 10001, 114 params: ['sys.color.ohos_id_color_switch_outline_off'], 115 'bundleName': '__harDefaultBundleName__', 116 'moduleName': '__harDefaultModuleName__' 117}; 118const e3 = 1; 119const f3 = LengthMetrics.resource({ 120 'id': -1, 121 'type': 10002, 122 params: ['sys.float.composeListItem_right_textOverflow'], 123 'bundleName': '__harDefaultBundleName__', 124 'moduleName': '__harDefaultModuleName__' 125}).value; 126const g3 = -1; 127const h3 = { 128 'id': -1, 129 'type': 10001, 130 params: ['sys.color.composeListItem_container_focus_color'], 131 'bundleName': '__harDefaultBundleName__', 132 'moduleName': '__harDefaultModuleName__' 133}; 134const i3 = { 135 'id': -1, 136 'type': 10001, 137 params: ['sys.color.composeListItem_container_normal_color'], 138 'bundleName': '__harDefaultBundleName__', 139 'moduleName': '__harDefaultModuleName__' 140}; 141const j3 = LengthMetrics.resource({ 142 'id': -1, 143 'type': 10002, 144 params: ['sys.float.composeListItem_focus_magnification'], 145 'bundleName': '__harDefaultBundleName__', 146 'moduleName': '__harDefaultModuleName__' 147}).value; 148const l3 = LengthMetrics.resource({ 149 'id': -1, 150 'type': 10002, 151 params: ['sys.float.composeListItem_focus_shadow_attribute'], 152 'bundleName': '__harDefaultBundleName__', 153 'moduleName': '__harDefaultModuleName__' 154}) 155 .value; 156const m3 = LengthMetrics.resource({ 157 'id': -1, 158 'type': 10002, 159 params: ['sys.float.composeListItem_normal_shadow_attribute'], 160 'bundleName': '__harDefaultBundleName__', 161 'moduleName': '__harDefaultModuleName__' 162}) 163 .value; 164const n3 = { 165 'id': -1, 166 'type': 10002, 167 params: ['sys.float.composeListItem_padding'], 168 'bundleName': '__harDefaultBundleName__', 169 'moduleName': '__harDefaultModuleName__' 170}; 171const o3 = LengthMetrics.resource({ 172 'id': -1, 173 'type': 10002, 174 params: ['sys.float.composeListItem_arrow_margin'], 175 'bundleName': '__harDefaultBundleName__', 176 'moduleName': '__harDefaultModuleName__' 177}).value; 178const q3 = LengthMetrics.resource({ 179 'id': -1, 180 'type': 10002, 181 params: ['sys.float.composeListItem_AppIcon_ItemLength'], 182 'bundleName': '__harDefaultBundleName__', 183 'moduleName': '__harDefaultModuleName__' 184}).value; 185 186class Util { 187 static l4(h4) { 188 if (!Util.m4(h4)) { 189 return false; 190 } 191 let resource = h4; 192 return resource.type === v2; 193 } 194 195 static m4(resource) { 196 if (!resource) { 197 return false; 198 } 199 if (typeof resource === 'string' || typeof resource === 'undefined') { 200 return false; 201 } 202 return true; 203 } 204} 205 206class r3 extends ViewPU { 207 constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) { 208 super(parent, __localStorage, elmtId, extraInfo); 209 if (typeof paramsLambda === 'function') { 210 this.paramsGenerator_ = paramsLambda; 211 } 212 this.__iconStyle = new SynchedPropertySimpleOneWayPU(params.iconStyle, this, 'iconStyle'); 213 this.__icon = new SynchedPropertyObjectOneWayPU(params.icon, this, 'icon'); 214 this.__symbolStyle = new SynchedPropertyObjectOneWayPU(params.symbolStyle, this, 'symbolStyle'); 215 this.__primaryText = new SynchedPropertyObjectOneWayPU(params.primaryText, this, 'primaryText'); 216 this.__secondaryText = new SynchedPropertyObjectOneWayPU(params.secondaryText, this, 'secondaryText'); 217 this.__description = new SynchedPropertyObjectOneWayPU(params.description, this, 'description'); 218 this.__itemRowSpace = new ObservedPropertySimplePU(t1, this, 'itemRowSpace'); 219 this.__leftWidth = new SynchedPropertySimpleOneWayPU(params.leftWidth, this, 'leftWidth'); 220 this.__primaryTextColor = new ObservedPropertyObjectPU({ 221 'id': -1, 222 'type': 10001, 223 params: ['sys.color.ohos_id_color_text_primary'], 224 'bundleName': '__harDefaultBundleName__', 225 'moduleName': '__harDefaultModuleName__' 226 }, this, 'primaryTextColor'); 227 this.__secondaryTextColor = new ObservedPropertyObjectPU({ 228 'id': -1, 229 'type': 10001, 230 params: ['sys.color.ohos_id_color_text_secondary'], 231 'bundleName': '__harDefaultBundleName__', 232 'moduleName': '__harDefaultModuleName__' 233 }, this, 'secondaryTextColor'); 234 this.__descriptionColor = new ObservedPropertyObjectPU({ 235 'id': -1, 236 'type': 10001, 237 params: ['sys.color.ohos_id_color_text_secondary'], 238 'bundleName': '__harDefaultBundleName__', 239 'moduleName': '__harDefaultModuleName__' 240 }, this, 'descriptionColor'); 241 this.__fontSizeScale = new SynchedPropertySimpleOneWayPU(params.fontSizeScale, this, 'fontSizeScale'); 242 this.__parentDirection = new SynchedPropertySimpleOneWayPU(params.parentDirection, this, 'parentDirection'); 243 this.__itemDirection = new SynchedPropertySimpleOneWayPU(params.itemDirection, this, 'itemDirection'); 244 this.__isFocus = new SynchedPropertySimpleOneWayPU(params.isFocus, this, 'isFocus'); 245 this.__primaryTextSize = new ObservedPropertyObjectPU({ 246 'id': -1, 247 'type': 10002, 248 params: ['sys.float.ohos_id_text_size_body1'], 249 'bundleName': '__harDefaultBundleName__', 250 'moduleName': '__harDefaultModuleName__' 251 }, this, 'primaryTextSize'); 252 this.__primaryTextColors = new ObservedPropertyObjectPU({ 253 'id': -1, 254 'type': 10001, 255 params: ['sys.color.font_primary'], 256 'bundleName': '__harDefaultBundleName__', 257 'moduleName': '__harDefaultModuleName__' 258 }, this, 'primaryTextColors'); 259 this.__itemHeight = new SynchedPropertyObjectOneWayPU(params.itemHeight, this, 'itemHeight'); 260 this.__iconColor = new ObservedPropertyObjectPU(null, this, 'iconColor'); 261 this.__secondaryTextColors = new ObservedPropertyObjectPU({ 262 'id': -1, 263 'type': 10001, 264 params: ['sys.color.font_secondary'], 265 'bundleName': '__harDefaultBundleName__', 266 'moduleName': '__harDefaultModuleName__' 267 }, this, 'secondaryTextColors'); 268 this.__secondaryThirdTextSize = new ObservedPropertyObjectPU({ 269 'id': -1, 270 'type': 10002, 271 params: ['sys.float.composeListItem_left_secondary_tertiary_text_size'], 272 'bundleName': '__harDefaultBundleName__', 273 'moduleName': '__harDefaultModuleName__' 274 }, this, 'secondaryThirdTextSize'); 275 this.__descriptionColors = new ObservedPropertyObjectPU({ 276 'id': -1, 277 'type': 10001, 278 params: ['sys.color.font_tertiary'], 279 'bundleName': '__harDefaultBundleName__', 280 'moduleName': '__harDefaultModuleName__' 281 }, this, 'descriptionColors'); 282 this.__isWrapText = new SynchedPropertyObjectTwoWayPU(params.isWrapText, this, 'isWrapText'); 283 this.__isWrapFirstText = new ObservedPropertyObjectPU(false, this, 'isWrapFirstText'); 284 this.__isWrapSecondText = new ObservedPropertyObjectPU(false, this, 'isWrapSecondText'); 285 this.__isWrapThirdText = new ObservedPropertyObjectPU(false, this, 'isWrapThirdText'); 286 this.setInitiallyProvidedValue(params); 287 this.declareWatch('iconStyle', this.onPropChange); 288 this.declareWatch('icon', this.onPropChange); 289 this.declareWatch('symbolStyle', this.onPropChange); 290 this.declareWatch('primaryText', this.onPropChange); 291 this.declareWatch('secondaryText', this.onPropChange); 292 this.declareWatch('description', this.onPropChange); 293 this.declareWatch('primaryTextColor', this.onPropChange); 294 this.declareWatch('secondaryTextColor', this.onPropChange); 295 this.declareWatch('descriptionColor', this.onPropChange); 296 this.declareWatch('isFocus', this.onPropChange); 297 this.declareWatch('isWrapFirstText', this.onWrapChange); 298 this.declareWatch('isWrapSecondText', this.onWrapChange); 299 this.declareWatch('isWrapThirdText', this.onWrapChange); 300 this.finalizeConstruction(); 301 } 302 303 setInitiallyProvidedValue(params) { 304 if (params.iconStyle === undefined) { 305 this.__iconStyle.set(null); 306 } 307 if (params.icon === undefined) { 308 this.__icon.set(null); 309 } 310 if (params.symbolStyle === undefined) { 311 this.__symbolStyle.set(null); 312 } 313 if (params.primaryText === undefined) { 314 this.__primaryText.set(null); 315 } 316 if (params.secondaryText === undefined) { 317 this.__secondaryText.set(null); 318 } 319 if (params.description === undefined) { 320 this.__description.set(null); 321 } 322 if (params.itemRowSpace !== undefined) { 323 this.itemRowSpace = params.itemRowSpace; 324 } 325 if (params.leftWidth === undefined) { 326 this.__leftWidth.set(g2); 327 } 328 if (params.primaryTextColor !== undefined) { 329 this.primaryTextColor = params.primaryTextColor; 330 } 331 if (params.secondaryTextColor !== undefined) { 332 this.secondaryTextColor = params.secondaryTextColor; 333 } 334 if (params.descriptionColor !== undefined) { 335 this.descriptionColor = params.descriptionColor; 336 } 337 if (params.isFocus === undefined) { 338 this.__isFocus.set(false); 339 } 340 if (params.primaryTextSize !== undefined) { 341 this.primaryTextSize = params.primaryTextSize; 342 } 343 if (params.primaryTextColors !== undefined) { 344 this.primaryTextColors = params.primaryTextColors; 345 } 346 if (params.itemHeight === undefined) { 347 this.__itemHeight.set(null); 348 } 349 if (params.iconColor !== undefined) { 350 this.iconColor = params.iconColor; 351 } 352 if (params.secondaryTextColors !== undefined) { 353 this.secondaryTextColors = params.secondaryTextColors; 354 } 355 if (params.secondaryThirdTextSize !== undefined) { 356 this.secondaryThirdTextSize = params.secondaryThirdTextSize; 357 } 358 if (params.descriptionColors !== undefined) { 359 this.descriptionColors = params.descriptionColors; 360 } 361 if (params.isWrapFirstText !== undefined) { 362 this.isWrapFirstText = params.isWrapFirstText; 363 } 364 if (params.isWrapSecondText !== undefined) { 365 this.isWrapSecondText = params.isWrapSecondText; 366 } 367 if (params.isWrapThirdText !== undefined) { 368 this.isWrapThirdText = params.isWrapThirdText; 369 } 370 } 371 372 updateStateVars(params) { 373 this.__iconStyle.reset(params.iconStyle); 374 this.__icon.reset(params.icon); 375 this.__symbolStyle.reset(params.symbolStyle); 376 this.__primaryText.reset(params.primaryText); 377 this.__secondaryText.reset(params.secondaryText); 378 this.__description.reset(params.description); 379 this.__leftWidth.reset(params.leftWidth); 380 this.__fontSizeScale.reset(params.fontSizeScale); 381 this.__parentDirection.reset(params.parentDirection); 382 this.__itemDirection.reset(params.itemDirection); 383 this.__isFocus.reset(params.isFocus); 384 this.__itemHeight.reset(params.itemHeight); 385 } 386 387 purgeVariableDependenciesOnElmtId(rmElmtId) { 388 this.__iconStyle.purgeDependencyOnElmtId(rmElmtId); 389 this.__icon.purgeDependencyOnElmtId(rmElmtId); 390 this.__symbolStyle.purgeDependencyOnElmtId(rmElmtId); 391 this.__primaryText.purgeDependencyOnElmtId(rmElmtId); 392 this.__secondaryText.purgeDependencyOnElmtId(rmElmtId); 393 this.__description.purgeDependencyOnElmtId(rmElmtId); 394 this.__itemRowSpace.purgeDependencyOnElmtId(rmElmtId); 395 this.__leftWidth.purgeDependencyOnElmtId(rmElmtId); 396 this.__primaryTextColor.purgeDependencyOnElmtId(rmElmtId); 397 this.__secondaryTextColor.purgeDependencyOnElmtId(rmElmtId); 398 this.__descriptionColor.purgeDependencyOnElmtId(rmElmtId); 399 this.__fontSizeScale.purgeDependencyOnElmtId(rmElmtId); 400 this.__parentDirection.purgeDependencyOnElmtId(rmElmtId); 401 this.__itemDirection.purgeDependencyOnElmtId(rmElmtId); 402 this.__isFocus.purgeDependencyOnElmtId(rmElmtId); 403 this.__primaryTextSize.purgeDependencyOnElmtId(rmElmtId); 404 this.__primaryTextColors.purgeDependencyOnElmtId(rmElmtId); 405 this.__itemHeight.purgeDependencyOnElmtId(rmElmtId); 406 this.__iconColor.purgeDependencyOnElmtId(rmElmtId); 407 this.__secondaryTextColors.purgeDependencyOnElmtId(rmElmtId); 408 this.__secondaryThirdTextSize.purgeDependencyOnElmtId(rmElmtId); 409 this.__descriptionColors.purgeDependencyOnElmtId(rmElmtId); 410 this.__isWrapText.purgeDependencyOnElmtId(rmElmtId); 411 this.__isWrapFirstText.purgeDependencyOnElmtId(rmElmtId); 412 this.__isWrapSecondText.purgeDependencyOnElmtId(rmElmtId); 413 this.__isWrapThirdText.purgeDependencyOnElmtId(rmElmtId); 414 } 415 416 aboutToBeDeleted() { 417 this.__iconStyle.aboutToBeDeleted(); 418 this.__icon.aboutToBeDeleted(); 419 this.__symbolStyle.aboutToBeDeleted(); 420 this.__primaryText.aboutToBeDeleted(); 421 this.__secondaryText.aboutToBeDeleted(); 422 this.__description.aboutToBeDeleted(); 423 this.__itemRowSpace.aboutToBeDeleted(); 424 this.__leftWidth.aboutToBeDeleted(); 425 this.__primaryTextColor.aboutToBeDeleted(); 426 this.__secondaryTextColor.aboutToBeDeleted(); 427 this.__descriptionColor.aboutToBeDeleted(); 428 this.__fontSizeScale.aboutToBeDeleted(); 429 this.__parentDirection.aboutToBeDeleted(); 430 this.__itemDirection.aboutToBeDeleted(); 431 this.__isFocus.aboutToBeDeleted(); 432 this.__primaryTextSize.aboutToBeDeleted(); 433 this.__primaryTextColors.aboutToBeDeleted(); 434 this.__itemHeight.aboutToBeDeleted(); 435 this.__iconColor.aboutToBeDeleted(); 436 this.__secondaryTextColors.aboutToBeDeleted(); 437 this.__secondaryThirdTextSize.aboutToBeDeleted(); 438 this.__descriptionColors.aboutToBeDeleted(); 439 this.__isWrapText.aboutToBeDeleted(); 440 this.__isWrapFirstText.aboutToBeDeleted(); 441 this.__isWrapSecondText.aboutToBeDeleted(); 442 this.__isWrapThirdText.aboutToBeDeleted(); 443 SubscriberManager.Get().delete(this.id__()); 444 this.aboutToBeDeletedInternal(); 445 } 446 447 get iconStyle() { 448 return this.__iconStyle.get(); 449 } 450 451 set iconStyle(newValue) { 452 this.__iconStyle.set(newValue); 453 } 454 455 get icon() { 456 return this.__icon.get(); 457 } 458 459 set icon(newValue) { 460 this.__icon.set(newValue); 461 } 462 463 get symbolStyle() { 464 return this.__symbolStyle.get(); 465 } 466 467 set symbolStyle(newValue) { 468 this.__symbolStyle.set(newValue); 469 } 470 471 get primaryText() { 472 return this.__primaryText.get(); 473 } 474 475 set primaryText(newValue) { 476 this.__primaryText.set(newValue); 477 } 478 479 get secondaryText() { 480 return this.__secondaryText.get(); 481 } 482 483 set secondaryText(newValue) { 484 this.__secondaryText.set(newValue); 485 } 486 487 get description() { 488 return this.__description.get(); 489 } 490 491 set description(newValue) { 492 this.__description.set(newValue); 493 } 494 495 get itemRowSpace() { 496 return this.__itemRowSpace.get(); 497 } 498 499 set itemRowSpace(newValue) { 500 this.__itemRowSpace.set(newValue); 501 } 502 503 get leftWidth() { 504 return this.__leftWidth.get(); 505 } 506 507 set leftWidth(newValue) { 508 this.__leftWidth.set(newValue); 509 } 510 511 get primaryTextColor() { 512 return this.__primaryTextColor.get(); 513 } 514 515 set primaryTextColor(newValue) { 516 this.__primaryTextColor.set(newValue); 517 } 518 519 get secondaryTextColor() { 520 return this.__secondaryTextColor.get(); 521 } 522 523 set secondaryTextColor(newValue) { 524 this.__secondaryTextColor.set(newValue); 525 } 526 527 get descriptionColor() { 528 return this.__descriptionColor.get(); 529 } 530 531 set descriptionColor(newValue) { 532 this.__descriptionColor.set(newValue); 533 } 534 535 get fontSizeScale() { 536 return this.__fontSizeScale.get(); 537 } 538 539 set fontSizeScale(newValue) { 540 this.__fontSizeScale.set(newValue); 541 } 542 543 get parentDirection() { 544 return this.__parentDirection.get(); 545 } 546 547 set parentDirection(newValue) { 548 this.__parentDirection.set(newValue); 549 } 550 551 get itemDirection() { 552 return this.__itemDirection.get(); 553 } 554 555 set itemDirection(newValue) { 556 this.__itemDirection.set(newValue); 557 } 558 559 get isFocus() { 560 return this.__isFocus.get(); 561 } 562 563 set isFocus(newValue) { 564 this.__isFocus.set(newValue); 565 } 566 567 get primaryTextSize() { 568 return this.__primaryTextSize.get(); 569 } 570 571 set primaryTextSize(newValue) { 572 this.__primaryTextSize.set(newValue); 573 } 574 575 get primaryTextColors() { 576 return this.__primaryTextColors.get(); 577 } 578 579 set primaryTextColors(newValue) { 580 this.__primaryTextColors.set(newValue); 581 } 582 583 get itemHeight() { 584 return this.__itemHeight.get(); 585 } 586 587 set itemHeight(newValue) { 588 this.__itemHeight.set(newValue); 589 } 590 591 get iconColor() { 592 return this.__iconColor.get(); 593 } 594 595 set iconColor(newValue) { 596 this.__iconColor.set(newValue); 597 } 598 599 get secondaryTextColors() { 600 return this.__secondaryTextColors.get(); 601 } 602 603 set secondaryTextColors(newValue) { 604 this.__secondaryTextColors.set(newValue); 605 } 606 607 get secondaryThirdTextSize() { 608 return this.__secondaryThirdTextSize.get(); 609 } 610 611 set secondaryThirdTextSize(newValue) { 612 this.__secondaryThirdTextSize.set(newValue); 613 } 614 615 get descriptionColors() { 616 return this.__descriptionColors.get(); 617 } 618 619 set descriptionColors(newValue) { 620 this.__descriptionColors.set(newValue); 621 } 622 623 get isWrapText() { 624 return this.__isWrapText.get(); 625 } 626 627 set isWrapText(newValue) { 628 this.__isWrapText.set(newValue); 629 } 630 631 get isWrapFirstText() { 632 return this.__isWrapFirstText.get(); 633 } 634 635 set isWrapFirstText(newValue) { 636 this.__isWrapFirstText.set(newValue); 637 } 638 639 get isWrapSecondText() { 640 return this.__isWrapSecondText.get(); 641 } 642 643 set isWrapSecondText(newValue) { 644 this.__isWrapSecondText.set(newValue); 645 } 646 647 get isWrapThirdText() { 648 return this.__isWrapThirdText.get(); 649 } 650 651 set isWrapThirdText(newValue) { 652 this.__isWrapThirdText.set(newValue); 653 } 654 655 onWillApplyTheme(theme) { 656 this.primaryTextColor = theme.colors.fontPrimary; 657 this.secondaryTextColor = theme.colors.fontSecondary; 658 this.descriptionColor = theme.colors.fontTertiary; 659 } 660 661 onPropChange() { 662 if (this.icon == null && this.symbolStyle == null && this.iconStyle == null) { 663 this.itemRowSpace = u1; 664 } else { 665 this.itemRowSpace = t1; 666 } 667 if (!z2 && this.isFocus) { 668 this.primaryTextColors = { 669 'id': -1, 670 'type': 10001, 671 params: ['sys.color.composeListItem_left_text_focus_color'], 672 'bundleName': '__harDefaultBundleName__', 673 'moduleName': '__harDefaultModuleName__' 674 }; 675 this.secondaryTextColors = { 676 'id': -1, 677 'type': 10001, 678 params: ['sys.color.composeListItem_left_secondary_text_focus_color'], 679 'bundleName': '__harDefaultBundleName__', 680 'moduleName': '__harDefaultModuleName__' 681 }; 682 this.descriptionColors = { 683 'id': -1, 684 'type': 10001, 685 params: ['sys.color.composeListItem_left_secondary_text_focus_color'], 686 'bundleName': '__harDefaultBundleName__', 687 'moduleName': '__harDefaultModuleName__' 688 }; 689 } else { 690 this.primaryTextColors = this.primaryTextColor; 691 this.secondaryTextColors = this.secondaryTextColor; 692 this.descriptionColors = this.descriptionColor; 693 } 694 } 695 696 onWrapChange() { 697 this.isWrapText = this.isWrapFirstText || this.isWrapSecondText || this.isWrapThirdText; 698 } 699 700 getContentItemIconFillColor() { 701 switch (this.iconStyle) { 702 case IconType.BADGE: 703 return { 704 'id': -1, 705 'type': 10001, 706 params: ['sys.color.composeListItem_badge_color'], 707 'bundleName': '__harDefaultBundleName__', 708 'moduleName': '__harDefaultModuleName__' 709 }; 710 case IconType.SYSTEM_ICON: 711 return { 712 'id': -1, 713 'type': 10001, 714 params: ['sys.color.composeListItem_icon_normal_color'], 715 'bundleName': '__harDefaultBundleName__', 716 'moduleName': '__harDefaultModuleName__' 717 }; 718 default: 719 return { 720 'id': -1, 721 'type': 10001, 722 params: ['sys.color.ohos_id_color_secondary'], 723 'bundleName': '__harDefaultBundleName__', 724 'moduleName': '__harDefaultModuleName__' 725 }; 726 } 727 } 728 729 judgeIsWrap(text, e4, f4) { 730 let g4 = this.getSingleRowTextHeight(text, e4); 731 return f4 > g4; 732 } 733 734 getSingleRowTextHeight(text, c4) { 735 if (text && c4) { 736 let d4 = px2vp(measure.measureTextSize({ 737 textContent: text, 738 fontSize: c4, 739 maxLines: t 740 }).height); 741 return d4; 742 } 743 return 0; 744 } 745 746 aboutToAppear() { 747 this.onPropChange(); 748 } 749 750 createIcon(parent = null) { 751 this.observeComponentCreation2((elmtId, isInitialRender) => { 752 If.create(); 753 if (this.iconStyle != null && w2.has(this.iconStyle)) { 754 this.ifElseBranchUpdateFunction(0, () => { 755 this.observeComponentCreation2((elmtId, isInitialRender) => { 756 If.create(); 757 if (this.symbolStyle != null) { 758 this.ifElseBranchUpdateFunction(0, () => { 759 this.observeComponentCreation2((elmtId, isInitialRender) => { 760 SymbolGlyph.create(); 761 SymbolGlyph.fontColor([this.getContentItemIconFillColor()]); 762 SymbolGlyph.attributeModifier.bind(this)(ObservedObject.GetRawObject(this.symbolStyle)); 763 SymbolGlyph.fontSize(`${w2.get(this.iconStyle)}vp`); 764 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 765 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 766 SymbolGlyph.borderRadius({ 767 'id': -1, 768 'type': 10002, 769 params: ['sys.float.composeListItem_Image_Radius'], 770 'bundleName': '__harDefaultBundleName__', 771 'moduleName': '__harDefaultModuleName__' 772 }); 773 SymbolGlyph.focusable(false); 774 SymbolGlyph.draggable(false); 775 SymbolGlyph.flexShrink(0); 776 }, SymbolGlyph); 777 }); 778 } else if (this.icon != null) { 779 this.ifElseBranchUpdateFunction(1, () => { 780 this.observeComponentCreation2((elmtId, isInitialRender) => { 781 If.create(); 782 if (Util.l4(ObservedObject.GetRawObject(this.icon))) { 783 this.ifElseBranchUpdateFunction(0, () => { 784 this.observeComponentCreation2((elmtId, isInitialRender) => { 785 SymbolGlyph.create(this.icon); 786 SymbolGlyph.fontSize(`${w2.get(this.iconStyle)}vp`); 787 SymbolGlyph.fontColor([this.getContentItemIconFillColor()]); 788 SymbolGlyph.borderRadius({ 789 'id': -1, 790 'type': 10002, 791 params: ['sys.float.composeListItem_Image_Radius'], 792 'bundleName': '__harDefaultBundleName__', 793 'moduleName': '__harDefaultModuleName__' 794 }); 795 SymbolGlyph.focusable(false); 796 SymbolGlyph.draggable(false); 797 SymbolGlyph.flexShrink(0); 798 }, SymbolGlyph); 799 }); 800 } else { 801 this.ifElseBranchUpdateFunction(1, () => { 802 this.observeComponentCreation2((elmtId, isInitialRender) => { 803 If.create(); 804 if (this.iconStyle <= IconType.PREVIEW) { 805 this.ifElseBranchUpdateFunction(0, () => { 806 this.observeComponentCreation2((elmtId, isInitialRender) => { 807 Image.create(this.icon); 808 Image.objectFit(ImageFit.Contain); 809 Image.width(w2.get(this.iconStyle)); 810 Image.height(w2.get(this.iconStyle)); 811 Image.borderRadius({ 812 'id': -1, 813 'type': 10002, 814 params: ['sys.float.composeListItem_Image_Radius'], 815 'bundleName': '__harDefaultBundleName__', 816 'moduleName': '__harDefaultModuleName__' 817 }); 818 Image.focusable(false); 819 Image.draggable(false); 820 Image.fillColor(this.getContentItemIconFillColor()); 821 Image.flexShrink(0); 822 }, Image); 823 }); 824 } else { 825 this.ifElseBranchUpdateFunction(1, () => { 826 this.observeComponentCreation2((elmtId, isInitialRender) => { 827 Image.create(this.icon); 828 Image.objectFit(ImageFit.Contain); 829 Image.constraintSize({ 830 minWidth: v1, 831 maxWidth: w2.get(this.iconStyle), 832 minHeight: v1, 833 maxHeight: w2.get(this.iconStyle) 834 }); 835 Image.borderRadius({ 836 'id': -1, 837 'type': 10002, 838 params: ['sys.float.composeListItem_Image_Radius'], 839 'bundleName': '__harDefaultBundleName__', 840 'moduleName': '__harDefaultModuleName__' 841 }); 842 Image.focusable(false); 843 Image.draggable(false); 844 Image.fillColor(this.getContentItemIconFillColor()); 845 Image.flexShrink(0); 846 }, Image); 847 }); 848 } 849 }, If); 850 If.pop(); 851 }); 852 } 853 }, If); 854 If.pop(); 855 }); 856 } else { 857 this.ifElseBranchUpdateFunction(2, () => { 858 }); 859 } 860 }, If); 861 If.pop(); 862 }); 863 } else { 864 this.ifElseBranchUpdateFunction(1, () => { 865 }); 866 } 867 }, If); 868 If.pop(); 869 } 870 871 createText(parent = null) { 872 this.observeComponentCreation2((elmtId, isInitialRender) => { 873 Column.create({ space: a1 }); 874 Column.flexShrink(1); 875 Column.margin(this.fontSizeScale >= m.LEVEL1 ? undefined : { 876 top: b1, 877 bottom: b1 878 }); 879 Column.alignItems(HorizontalAlign.Start); 880 }, Column); 881 this.observeComponentCreation2((elmtId, isInitialRender) => { 882 Text.create(this.primaryText); 883 Text.fontSize(ObservedObject.GetRawObject(this.primaryTextSize)); 884 Text.fontColor(ObservedObject.GetRawObject(this.primaryTextColors)); 885 Text.textOverflow({ 886 overflow: f3 === e3 ? TextOverflow.None : 887 TextOverflow.Ellipsis 888 }); 889 Text.fontWeight(FontWeight.Medium); 890 Text.focusable(true); 891 Text.draggable(false); 892 Text.onSizeChange((oldValue, newValue) => { 893 if (!z2) { 894 this.isWrapFirstText = this.judgeIsWrap(ObservedObject.GetRawObject(this.primaryText), 895 ObservedObject.GetRawObject(this.primaryTextSize), newValue.height); 896 } 897 }); 898 }, Text); 899 Text.pop(); 900 this.observeComponentCreation2((elmtId, isInitialRender) => { 901 If.create(); 902 if (this.secondaryText != null) { 903 this.ifElseBranchUpdateFunction(0, () => { 904 this.observeComponentCreation2((elmtId, isInitialRender) => { 905 Text.create(this.secondaryText); 906 Text.fontSize(ObservedObject.GetRawObject(this.secondaryThirdTextSize)); 907 Text.fontColor(ObservedObject.GetRawObject(this.secondaryTextColors)); 908 Text.textOverflow({ 909 overflow: f3 === e3 ? TextOverflow.None : 910 TextOverflow.Ellipsis 911 }); 912 Text.draggable(false); 913 Text.onSizeChange((oldValue, newValue) => { 914 if (!z2) { 915 this.isWrapSecondText = 916 this.judgeIsWrap(ObservedObject.GetRawObject(this.secondaryText), 917 ObservedObject.GetRawObject(this.secondaryThirdTextSize), newValue.height); 918 } 919 }); 920 }, Text); 921 Text.pop(); 922 }); 923 } else { 924 this.ifElseBranchUpdateFunction(1, () => { 925 }); 926 } 927 }, If); 928 If.pop(); 929 this.observeComponentCreation2((elmtId, isInitialRender) => { 930 If.create(); 931 if (this.description != null) { 932 this.ifElseBranchUpdateFunction(0, () => { 933 this.observeComponentCreation2((elmtId, isInitialRender) => { 934 Text.create(this.description); 935 Text.fontSize(ObservedObject.GetRawObject(this.secondaryThirdTextSize)); 936 Text.fontColor(ObservedObject.GetRawObject(this.descriptionColors)); 937 Text.textOverflow({ 938 overflow: f3 === e3 ? TextOverflow.None : 939 TextOverflow.Ellipsis 940 }); 941 Text.draggable(false); 942 Text.onSizeChange((oldValue, newValue) => { 943 if (!z2) { 944 this.isWrapThirdText = this.judgeIsWrap(ObservedObject.GetRawObject(this.description), 945 ObservedObject.GetRawObject(this.secondaryThirdTextSize), newValue.height); 946 } 947 }); 948 }, Text); 949 Text.pop(); 950 }); 951 } else { 952 this.ifElseBranchUpdateFunction(1, () => { 953 }); 954 } 955 }, If); 956 If.pop(); 957 Column.pop(); 958 } 959 960 isColumnDirection() { 961 return this.itemDirection === FlexDirection.Column; 962 } 963 964 isParentColumnDirection() { 965 return this.parentDirection === FlexDirection.Column; 966 } 967 968 getItemSpace() { 969 if (this.isColumnDirection()) { 970 return LengthMetrics.resource({ 971 'id': -1, 972 'type': 10002, 973 params: ['sys.float.padding_level1'], 974 'bundleName': '__harDefaultBundleName__', 975 'moduleName': '__harDefaultModuleName__' 976 }); 977 } 978 return LengthMetrics.vp(this.itemRowSpace); 979 } 980 981 initialRender() { 982 this.observeComponentCreation2((elmtId, isInitialRender) => { 983 Flex.create({ 984 space: { main: this.getItemSpace() }, 985 direction: this.itemDirection, 986 justifyContent: FlexAlign.Start, 987 alignItems: this.isColumnDirection() ? ItemAlign.Start : ItemAlign.Center, 988 }); 989 Flex.height(this.itemDirection === FlexDirection.Column ? 'auto' : undefined); 990 Flex.margin({ 991 end: this.isParentColumnDirection() ? 992 LengthMetrics.vp(0) : 993 LengthMetrics.vp(16) 994 }); 995 Flex.padding({ start: LengthMetrics.vp(c1) }); 996 Flex.flexShrink(this.isParentColumnDirection() ? 0 : 1); 997 }, Flex); 998 this.createIcon.bind(this)(); 999 this.createText.bind(this)(); 1000 Flex.pop(); 1001 } 1002 1003 rerender() { 1004 this.updateDirtyElements(); 1005 } 1006} 1007 1008class s3 { 1009} 1010 1011class t3 { 1012 constructor() { 1013 this.changeRadioState = () => { 1014 }; 1015 this.changeCheckboxState = () => { 1016 }; 1017 this.changeSwitchState = () => { 1018 }; 1019 } 1020} 1021 1022class u3 extends ViewPU { 1023 constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) { 1024 super(parent, __localStorage, elmtId, extraInfo); 1025 if (typeof paramsLambda === 'function') { 1026 this.paramsGenerator_ = paramsLambda; 1027 } 1028 this.__arrow = new SynchedPropertyObjectOneWayPU(params.arrow, this, 'arrow'); 1029 this.__icon = new SynchedPropertyObjectOneWayPU(params.icon, this, 'icon'); 1030 this.__subIcon = new SynchedPropertyObjectOneWayPU(params.subIcon, this, 'subIcon'); 1031 this.__button = new SynchedPropertyObjectOneWayPU(params.button, this, 'button'); 1032 this.__switch = new SynchedPropertyObjectOneWayPU(params.switch, this, 'switch'); 1033 this.__checkBox = new SynchedPropertyObjectOneWayPU(params.checkBox, this, 'checkBox'); 1034 this.__radio = new SynchedPropertyObjectOneWayPU(params.radio, this, 'radio'); 1035 this.__image = new SynchedPropertyObjectOneWayPU(params.image, this, 'image'); 1036 this.__symbolStyle = new SynchedPropertyObjectOneWayPU(params.symbolStyle, this, 'symbolStyle'); 1037 this.__text = new SynchedPropertyObjectOneWayPU(params.text, this, 'text'); 1038 this.__switchState = new ObservedPropertySimplePU(false, this, 'switchState'); 1039 this.__radioState = new ObservedPropertySimplePU(false, this, 'radioState'); 1040 this.__checkBoxState = new ObservedPropertySimplePU(false, this, 'checkBoxState'); 1041 this.__rightWidth = new SynchedPropertySimpleOneWayPU(params.rightWidth, this, 'rightWidth'); 1042 this.__secondaryTextColor = new ObservedPropertyObjectPU({ 1043 'id': -1, 1044 'type': 10001, 1045 params: ['sys.color.ohos_id_color_text_secondary'], 1046 'bundleName': '__harDefaultBundleName__', 1047 'moduleName': '__harDefaultModuleName__' 1048 }, this, 'secondaryTextColor'); 1049 this.__hoveringColor = new ObservedPropertyObjectPU('#0d000000', this, 'hoveringColor'); 1050 this.__activedColor = new ObservedPropertyObjectPU('#1a0a59f7', this, 'activedColor'); 1051 this.__parentCanFocus = new SynchedPropertySimpleTwoWayPU(params.parentCanFocus, this, 'parentCanFocus'); 1052 this.__parentCanTouch = new SynchedPropertySimpleTwoWayPU(params.parentCanTouch, this, 'parentCanTouch'); 1053 this.__parentIsHover = new SynchedPropertySimpleTwoWayPU(params.parentIsHover, this, 'parentIsHover'); 1054 this.__parentCanHover = new SynchedPropertySimpleTwoWayPU(params.parentCanHover, this, 'parentCanHover'); 1055 this.__parentIsActive = new SynchedPropertySimpleTwoWayPU(params.parentIsActive, this, 'parentIsActive'); 1056 this.__parentFrontColor = new SynchedPropertyObjectTwoWayPU(params.parentFrontColor, this, 'parentFrontColor'); 1057 this.__parentDirection = new SynchedPropertySimpleTwoWayPU(params.parentDirection, this, 'parentDirection'); 1058 this.__rowSpace = new ObservedPropertySimplePU(w1, this, 'rowSpace'); 1059 this.__isFocus = new SynchedPropertySimpleTwoWayPU(params.isFocus, this, 'isFocus'); 1060 this.__secondaryTextSize = new ObservedPropertyObjectPU({ 1061 'id': -1, 1062 'type': 10002, 1063 params: ['sys.float.ohos_id_text_size_body2'], 1064 'bundleName': '__harDefaultBundleName__', 1065 'moduleName': '__harDefaultModuleName__' 1066 }, this, 'secondaryTextSize'); 1067 this.__secondaryTextColors = new ObservedPropertyObjectPU({ 1068 'id': -1, 1069 'type': 10001, 1070 params: ['sys.color.font_secondary'], 1071 'bundleName': '__harDefaultBundleName__', 1072 'moduleName': '__harDefaultModuleName__' 1073 }, this, 'secondaryTextColors'); 1074 this.__iconColor = new ObservedPropertyObjectPU({ 1075 'id': -1, 1076 'type': 10001, 1077 params: ['sys.color.composeListItem_right_icon_normal_color'], 1078 'bundleName': '__harDefaultBundleName__', 1079 'moduleName': '__harDefaultModuleName__' 1080 }, this, 'iconColor'); 1081 this.controller = new t3(); 1082 this.changeRadioState = () => { 1083 this.radioState = !this.radioState; 1084 }; 1085 this.changeCheckboxState = () => { 1086 this.checkBoxState = !this.checkBoxState; 1087 }; 1088 this.changeSwitchState = () => { 1089 this.switchState = !this.switchState; 1090 }; 1091 this.setInitiallyProvidedValue(params); 1092 this.declareWatch('arrow', this.onPropChange); 1093 this.declareWatch('icon', this.onPropChange); 1094 this.declareWatch('subIcon', this.onPropChange); 1095 this.declareWatch('button', this.onPropChange); 1096 this.declareWatch('switch', this.onPropChange); 1097 this.declareWatch('checkBox', this.onPropChange); 1098 this.declareWatch('radio', this.onPropChange); 1099 this.declareWatch('image', this.onPropChange); 1100 this.declareWatch('symbolStyle', this.onPropChange); 1101 this.declareWatch('text', this.onPropChange); 1102 this.declareWatch('secondaryTextColor', this.onFocusChange); 1103 this.declareWatch('isFocus', this.onFocusChange); 1104 this.finalizeConstruction(); 1105 } 1106 1107 setInitiallyProvidedValue(params) { 1108 if (params.arrow === undefined) { 1109 this.__arrow.set(null); 1110 } 1111 if (params.icon === undefined) { 1112 this.__icon.set(null); 1113 } 1114 if (params.subIcon === undefined) { 1115 this.__subIcon.set(null); 1116 } 1117 if (params.button === undefined) { 1118 this.__button.set(null); 1119 } 1120 if (params.switch === undefined) { 1121 this.__switch.set(null); 1122 } 1123 if (params.checkBox === undefined) { 1124 this.__checkBox.set(null); 1125 } 1126 if (params.radio === undefined) { 1127 this.__radio.set(null); 1128 } 1129 if (params.image === undefined) { 1130 this.__image.set(null); 1131 } 1132 if (params.symbolStyle === undefined) { 1133 this.__symbolStyle.set(null); 1134 } 1135 if (params.text === undefined) { 1136 this.__text.set(null); 1137 } 1138 if (params.switchState !== undefined) { 1139 this.switchState = params.switchState; 1140 } 1141 if (params.radioState !== undefined) { 1142 this.radioState = params.radioState; 1143 } 1144 if (params.checkBoxState !== undefined) { 1145 this.checkBoxState = params.checkBoxState; 1146 } 1147 if (params.rightWidth === undefined) { 1148 this.__rightWidth.set(h2); 1149 } 1150 if (params.secondaryTextColor !== undefined) { 1151 this.secondaryTextColor = params.secondaryTextColor; 1152 } 1153 if (params.hoveringColor !== undefined) { 1154 this.hoveringColor = params.hoveringColor; 1155 } 1156 if (params.activedColor !== undefined) { 1157 this.activedColor = params.activedColor; 1158 } 1159 if (params.rowSpace !== undefined) { 1160 this.rowSpace = params.rowSpace; 1161 } 1162 if (params.secondaryTextSize !== undefined) { 1163 this.secondaryTextSize = params.secondaryTextSize; 1164 } 1165 if (params.secondaryTextColors !== undefined) { 1166 this.secondaryTextColors = params.secondaryTextColors; 1167 } 1168 if (params.iconColor !== undefined) { 1169 this.iconColor = params.iconColor; 1170 } 1171 if (params.controller !== undefined) { 1172 this.controller = params.controller; 1173 } 1174 if (params.changeRadioState !== undefined) { 1175 this.changeRadioState = params.changeRadioState; 1176 } 1177 if (params.changeCheckboxState !== undefined) { 1178 this.changeCheckboxState = params.changeCheckboxState; 1179 } 1180 if (params.changeSwitchState !== undefined) { 1181 this.changeSwitchState = params.changeSwitchState; 1182 } 1183 } 1184 1185 updateStateVars(params) { 1186 this.__arrow.reset(params.arrow); 1187 this.__icon.reset(params.icon); 1188 this.__subIcon.reset(params.subIcon); 1189 this.__button.reset(params.button); 1190 this.__switch.reset(params.switch); 1191 this.__checkBox.reset(params.checkBox); 1192 this.__radio.reset(params.radio); 1193 this.__image.reset(params.image); 1194 this.__symbolStyle.reset(params.symbolStyle); 1195 this.__text.reset(params.text); 1196 this.__rightWidth.reset(params.rightWidth); 1197 } 1198 1199 purgeVariableDependenciesOnElmtId(rmElmtId) { 1200 this.__arrow.purgeDependencyOnElmtId(rmElmtId); 1201 this.__icon.purgeDependencyOnElmtId(rmElmtId); 1202 this.__subIcon.purgeDependencyOnElmtId(rmElmtId); 1203 this.__button.purgeDependencyOnElmtId(rmElmtId); 1204 this.__switch.purgeDependencyOnElmtId(rmElmtId); 1205 this.__checkBox.purgeDependencyOnElmtId(rmElmtId); 1206 this.__radio.purgeDependencyOnElmtId(rmElmtId); 1207 this.__image.purgeDependencyOnElmtId(rmElmtId); 1208 this.__symbolStyle.purgeDependencyOnElmtId(rmElmtId); 1209 this.__text.purgeDependencyOnElmtId(rmElmtId); 1210 this.__switchState.purgeDependencyOnElmtId(rmElmtId); 1211 this.__radioState.purgeDependencyOnElmtId(rmElmtId); 1212 this.__checkBoxState.purgeDependencyOnElmtId(rmElmtId); 1213 this.__rightWidth.purgeDependencyOnElmtId(rmElmtId); 1214 this.__secondaryTextColor.purgeDependencyOnElmtId(rmElmtId); 1215 this.__hoveringColor.purgeDependencyOnElmtId(rmElmtId); 1216 this.__activedColor.purgeDependencyOnElmtId(rmElmtId); 1217 this.__parentCanFocus.purgeDependencyOnElmtId(rmElmtId); 1218 this.__parentCanTouch.purgeDependencyOnElmtId(rmElmtId); 1219 this.__parentIsHover.purgeDependencyOnElmtId(rmElmtId); 1220 this.__parentCanHover.purgeDependencyOnElmtId(rmElmtId); 1221 this.__parentIsActive.purgeDependencyOnElmtId(rmElmtId); 1222 this.__parentFrontColor.purgeDependencyOnElmtId(rmElmtId); 1223 this.__parentDirection.purgeDependencyOnElmtId(rmElmtId); 1224 this.__rowSpace.purgeDependencyOnElmtId(rmElmtId); 1225 this.__isFocus.purgeDependencyOnElmtId(rmElmtId); 1226 this.__secondaryTextSize.purgeDependencyOnElmtId(rmElmtId); 1227 this.__secondaryTextColors.purgeDependencyOnElmtId(rmElmtId); 1228 this.__iconColor.purgeDependencyOnElmtId(rmElmtId); 1229 } 1230 1231 aboutToBeDeleted() { 1232 this.__arrow.aboutToBeDeleted(); 1233 this.__icon.aboutToBeDeleted(); 1234 this.__subIcon.aboutToBeDeleted(); 1235 this.__button.aboutToBeDeleted(); 1236 this.__switch.aboutToBeDeleted(); 1237 this.__checkBox.aboutToBeDeleted(); 1238 this.__radio.aboutToBeDeleted(); 1239 this.__image.aboutToBeDeleted(); 1240 this.__symbolStyle.aboutToBeDeleted(); 1241 this.__text.aboutToBeDeleted(); 1242 this.__switchState.aboutToBeDeleted(); 1243 this.__radioState.aboutToBeDeleted(); 1244 this.__checkBoxState.aboutToBeDeleted(); 1245 this.__rightWidth.aboutToBeDeleted(); 1246 this.__secondaryTextColor.aboutToBeDeleted(); 1247 this.__hoveringColor.aboutToBeDeleted(); 1248 this.__activedColor.aboutToBeDeleted(); 1249 this.__parentCanFocus.aboutToBeDeleted(); 1250 this.__parentCanTouch.aboutToBeDeleted(); 1251 this.__parentIsHover.aboutToBeDeleted(); 1252 this.__parentCanHover.aboutToBeDeleted(); 1253 this.__parentIsActive.aboutToBeDeleted(); 1254 this.__parentFrontColor.aboutToBeDeleted(); 1255 this.__parentDirection.aboutToBeDeleted(); 1256 this.__rowSpace.aboutToBeDeleted(); 1257 this.__isFocus.aboutToBeDeleted(); 1258 this.__secondaryTextSize.aboutToBeDeleted(); 1259 this.__secondaryTextColors.aboutToBeDeleted(); 1260 this.__iconColor.aboutToBeDeleted(); 1261 SubscriberManager.Get().delete(this.id__()); 1262 this.aboutToBeDeletedInternal(); 1263 } 1264 1265 get arrow() { 1266 return this.__arrow.get(); 1267 } 1268 1269 set arrow(newValue) { 1270 this.__arrow.set(newValue); 1271 } 1272 1273 get icon() { 1274 return this.__icon.get(); 1275 } 1276 1277 set icon(newValue) { 1278 this.__icon.set(newValue); 1279 } 1280 1281 get subIcon() { 1282 return this.__subIcon.get(); 1283 } 1284 1285 set subIcon(newValue) { 1286 this.__subIcon.set(newValue); 1287 } 1288 1289 get button() { 1290 return this.__button.get(); 1291 } 1292 1293 set button(newValue) { 1294 this.__button.set(newValue); 1295 } 1296 1297 get switch() { 1298 return this.__switch.get(); 1299 } 1300 1301 set switch(newValue) { 1302 this.__switch.set(newValue); 1303 } 1304 1305 get checkBox() { 1306 return this.__checkBox.get(); 1307 } 1308 1309 set checkBox(newValue) { 1310 this.__checkBox.set(newValue); 1311 } 1312 1313 get radio() { 1314 return this.__radio.get(); 1315 } 1316 1317 set radio(newValue) { 1318 this.__radio.set(newValue); 1319 } 1320 1321 get image() { 1322 return this.__image.get(); 1323 } 1324 1325 set image(newValue) { 1326 this.__image.set(newValue); 1327 } 1328 1329 get symbolStyle() { 1330 return this.__symbolStyle.get(); 1331 } 1332 1333 set symbolStyle(newValue) { 1334 this.__symbolStyle.set(newValue); 1335 } 1336 1337 get text() { 1338 return this.__text.get(); 1339 } 1340 1341 set text(newValue) { 1342 this.__text.set(newValue); 1343 } 1344 1345 get switchState() { 1346 return this.__switchState.get(); 1347 } 1348 1349 set switchState(newValue) { 1350 this.__switchState.set(newValue); 1351 } 1352 1353 get radioState() { 1354 return this.__radioState.get(); 1355 } 1356 1357 set radioState(newValue) { 1358 this.__radioState.set(newValue); 1359 } 1360 1361 get checkBoxState() { 1362 return this.__checkBoxState.get(); 1363 } 1364 1365 set checkBoxState(newValue) { 1366 this.__checkBoxState.set(newValue); 1367 } 1368 1369 get rightWidth() { 1370 return this.__rightWidth.get(); 1371 } 1372 1373 set rightWidth(newValue) { 1374 this.__rightWidth.set(newValue); 1375 } 1376 1377 get secondaryTextColor() { 1378 return this.__secondaryTextColor.get(); 1379 } 1380 1381 set secondaryTextColor(newValue) { 1382 this.__secondaryTextColor.set(newValue); 1383 } 1384 1385 get hoveringColor() { 1386 return this.__hoveringColor.get(); 1387 } 1388 1389 set hoveringColor(newValue) { 1390 this.__hoveringColor.set(newValue); 1391 } 1392 1393 get activedColor() { 1394 return this.__activedColor.get(); 1395 } 1396 1397 set activedColor(newValue) { 1398 this.__activedColor.set(newValue); 1399 } 1400 1401 get parentCanFocus() { 1402 return this.__parentCanFocus.get(); 1403 } 1404 1405 set parentCanFocus(newValue) { 1406 this.__parentCanFocus.set(newValue); 1407 } 1408 1409 get parentCanTouch() { 1410 return this.__parentCanTouch.get(); 1411 } 1412 1413 set parentCanTouch(newValue) { 1414 this.__parentCanTouch.set(newValue); 1415 } 1416 1417 get parentIsHover() { 1418 return this.__parentIsHover.get(); 1419 } 1420 1421 set parentIsHover(newValue) { 1422 this.__parentIsHover.set(newValue); 1423 } 1424 1425 get parentCanHover() { 1426 return this.__parentCanHover.get(); 1427 } 1428 1429 set parentCanHover(newValue) { 1430 this.__parentCanHover.set(newValue); 1431 } 1432 1433 get parentIsActive() { 1434 return this.__parentIsActive.get(); 1435 } 1436 1437 set parentIsActive(newValue) { 1438 this.__parentIsActive.set(newValue); 1439 } 1440 1441 get parentFrontColor() { 1442 return this.__parentFrontColor.get(); 1443 } 1444 1445 set parentFrontColor(newValue) { 1446 this.__parentFrontColor.set(newValue); 1447 } 1448 1449 get parentDirection() { 1450 return this.__parentDirection.get(); 1451 } 1452 1453 set parentDirection(newValue) { 1454 this.__parentDirection.set(newValue); 1455 } 1456 1457 get rowSpace() { 1458 return this.__rowSpace.get(); 1459 } 1460 1461 set rowSpace(newValue) { 1462 this.__rowSpace.set(newValue); 1463 } 1464 1465 get isFocus() { 1466 return this.__isFocus.get(); 1467 } 1468 1469 set isFocus(newValue) { 1470 this.__isFocus.set(newValue); 1471 } 1472 1473 get secondaryTextSize() { 1474 return this.__secondaryTextSize.get(); 1475 } 1476 1477 set secondaryTextSize(newValue) { 1478 this.__secondaryTextSize.set(newValue); 1479 } 1480 1481 get secondaryTextColors() { 1482 return this.__secondaryTextColors.get(); 1483 } 1484 1485 set secondaryTextColors(newValue) { 1486 this.__secondaryTextColors.set(newValue); 1487 } 1488 1489 get iconColor() { 1490 return this.__iconColor.get(); 1491 } 1492 1493 set iconColor(newValue) { 1494 this.__iconColor.set(newValue); 1495 } 1496 1497 onWillApplyTheme(theme) { 1498 this.secondaryTextColor = theme.colors.fontSecondary; 1499 this.hoveringColor = theme.colors.interactiveHover; 1500 this.activedColor = theme.colors.interactiveActive; 1501 } 1502 1503 onFocusChange() { 1504 if (!z2 && this.isFocus) { 1505 this.secondaryTextColors = { 1506 'id': -1, 1507 'type': 10001, 1508 params: ['sys.color.composeListItem_right_text_focus_color'], 1509 'bundleName': '__harDefaultBundleName__', 1510 'moduleName': '__harDefaultModuleName__' 1511 }; 1512 } else { 1513 this.secondaryTextColors = this.secondaryTextColor; 1514 } 1515 this.iconColor = this.isFocus ? { 1516 'id': -1, 1517 'type': 10001, 1518 params: ['sys.color.composeListItem_right_icon_focus_color'], 1519 'bundleName': '__harDefaultBundleName__', 1520 'moduleName': '__harDefaultModuleName__' 1521 } : { 1522 'id': -1, 1523 'type': 10001, 1524 params: ['sys.color.composeListItem_right_icon_normal_color'], 1525 'bundleName': '__harDefaultBundleName__', 1526 'moduleName': '__harDefaultModuleName__' 1527 }; 1528 } 1529 1530 onPropChange() { 1531 if (this.switch != null) { 1532 this.switchState = this.switch.isCheck; 1533 } 1534 if (this.radio != null) { 1535 this.radioState = this.radio.isCheck; 1536 } 1537 if (this.checkBox != null) { 1538 this.checkBoxState = this.checkBox.isCheck; 1539 } 1540 if ((this.button == null && this.image == null && this.symbolStyle == null && this.text != null) && 1541 ((this.icon != null) || (this.icon == null && this.arrow != null))) { 1542 this.rowSpace = z1; 1543 } else { 1544 this.rowSpace = w1; 1545 } 1546 } 1547 1548 aboutToAppear() { 1549 this.onPropChange(); 1550 this.onFocusChange(); 1551 if (this.controller) { 1552 this.controller.changeRadioState = this.changeRadioState; 1553 this.controller.changeCheckboxState = this.changeCheckboxState; 1554 this.controller.changeSwitchState = this.changeSwitchState; 1555 } 1556 } 1557 1558 createButton(parent = null) { 1559 this.observeComponentCreation2((elmtId, isInitialRender) => { 1560 Button.createWithChild(); 1561 Button.padding({ top: 0, bottom: 0 }); 1562 Button.margin({ end: LengthMetrics.vp(c1) }); 1563 Button.hitTestBehavior(z2 ? HitTestMode.Block : HitTestMode.None); 1564 Button.fontSize({ 1565 'id': -1, 1566 'type': 10002, 1567 params: ['sys.float.ohos_id_text_size_button3'], 1568 'bundleName': '__harDefaultBundleName__', 1569 'moduleName': '__harDefaultModuleName__' 1570 }); 1571 Button.fontColor({ 1572 'id': -1, 1573 'type': 10001, 1574 params: ['sys.color.ohos_id_color_text_primary_activated_transparent'], 1575 'bundleName': '__harDefaultBundleName__', 1576 'moduleName': '__harDefaultModuleName__' 1577 }); 1578 Button.constraintSize({ 1579 minHeight: m1 1580 }); 1581 Button.backgroundColor({ 1582 'id': -1, 1583 'type': 10001, 1584 params: ['sys.color.ohos_id_color_button_normal'], 1585 'bundleName': '__harDefaultBundleName__', 1586 'moduleName': '__harDefaultModuleName__' 1587 }); 1588 Button.labelStyle({ 1589 maxLines: t 1590 }); 1591 Button.onFocus(() => { 1592 this.parentCanFocus = false; 1593 }); 1594 Button.onHover((isHover) => { 1595 this.parentCanHover = false; 1596 if (isHover && this.parentFrontColor === this.hoveringColor && z2) { 1597 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 1598 } 1599 if (!isHover) { 1600 this.parentCanHover = true; 1601 if (this.parentIsHover) { 1602 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 1603 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 1604 } 1605 } 1606 }); 1607 Button.accessibilityLevel(this.button?.accessibilityLevel ?? s2); 1608 Button.accessibilityText(getAccessibilityText(this.button?.accessibilityText ?? '')); 1609 Button.accessibilityDescription(getAccessibilityText(this.button?.accessibilityDescription ?? '')); 1610 }, Button); 1611 this.observeComponentCreation2((elmtId, isInitialRender) => { 1612 Row.create(); 1613 Row.padding({ 1614 left: b1, 1615 right: b1 1616 }); 1617 }, Row); 1618 this.observeComponentCreation2((elmtId, isInitialRender) => { 1619 Text.create(this.button?.text); 1620 Text.focusable(true); 1621 }, Text); 1622 Text.pop(); 1623 Row.pop(); 1624 Button.pop(); 1625 } 1626 1627 createIcon(param, parent = null) { 1628 this.observeComponentCreation2((elmtId, isInitialRender) => { 1629 Button.createWithChild({ type: ButtonType.Normal }); 1630 Button.shadow(b3); 1631 Button.hitTestBehavior(z2 ? HitTestMode.Block : HitTestMode.None); 1632 Button.backgroundColor(Color.Transparent); 1633 Button.height(d2); 1634 Button.width(d2); 1635 Button.borderRadius({ 1636 'id': -1, 1637 'type': 10002, 1638 params: ['sys.float.ohos_id_corner_radius_clicked'], 1639 'bundleName': '__harDefaultBundleName__', 1640 'moduleName': '__harDefaultModuleName__' 1641 }); 1642 Button.onFocus(() => { 1643 this.parentCanFocus = false; 1644 }); 1645 Button.onHover((isHover) => { 1646 this.parentCanHover = false; 1647 if (isHover && this.parentFrontColor === this.hoveringColor && z2) { 1648 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 1649 } 1650 if (!isHover) { 1651 this.parentCanHover = true; 1652 if (this.parentIsHover) { 1653 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 1654 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 1655 } 1656 } 1657 }); 1658 Button.onClick(param.icon?.action); 1659 Button.accessibilityLevel(j(param.icon?.accessibilityLevel, param.icon?.action)); 1660 Button.accessibilityText(getAccessibilityText(param.icon?.accessibilityText ?? '')); 1661 Button.accessibilityDescription(getAccessibilityText(param.icon?.accessibilityDescription ?? '')); 1662 Button.flexShrink(0); 1663 }, Button); 1664 this.observeComponentCreation2((elmtId, isInitialRender) => { 1665 If.create(); 1666 if (param.icon?.symbolStyle) { 1667 this.ifElseBranchUpdateFunction(0, () => { 1668 this.observeComponentCreation2((elmtId, isInitialRender) => { 1669 SymbolGlyph.create(); 1670 SymbolGlyph.fontColor([this.iconColor]); 1671 SymbolGlyph.attributeModifier.bind(this)(param.icon?.symbolStyle); 1672 SymbolGlyph.fontSize(`${a2}vp`); 1673 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1674 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1675 SymbolGlyph.focusable(true); 1676 SymbolGlyph.draggable(false); 1677 }, SymbolGlyph); 1678 }); 1679 } else { 1680 this.ifElseBranchUpdateFunction(1, () => { 1681 this.observeComponentCreation2((elmtId, isInitialRender) => { 1682 If.create(); 1683 if (Util.l4(param.icon?.value)) { 1684 this.ifElseBranchUpdateFunction(0, () => { 1685 this.observeComponentCreation2((elmtId, isInitialRender) => { 1686 SymbolGlyph.create(param.icon?.value); 1687 SymbolGlyph.fontSize(`${a2}vp`); 1688 SymbolGlyph.fontColor([this.iconColor]); 1689 SymbolGlyph.focusable(true); 1690 SymbolGlyph.draggable(false); 1691 }, SymbolGlyph); 1692 }); 1693 } else { 1694 this.ifElseBranchUpdateFunction(1, () => { 1695 this.observeComponentCreation2((elmtId, isInitialRender) => { 1696 Image.create(param.icon?.value); 1697 Image.height(a2); 1698 Image.width(a2); 1699 Image.focusable(true); 1700 Image.fillColor(ObservedObject.GetRawObject(this.iconColor)); 1701 Image.draggable(false); 1702 }, Image); 1703 }); 1704 } 1705 }, If); 1706 If.pop(); 1707 }); 1708 } 1709 }, If); 1710 If.pop(); 1711 Button.pop(); 1712 } 1713 1714 createImage(parent = null) { 1715 this.observeComponentCreation2((elmtId, isInitialRender) => { 1716 If.create(); 1717 if (Util.l4(ObservedObject.GetRawObject(this.image))) { 1718 this.ifElseBranchUpdateFunction(0, () => { 1719 this.observeComponentCreation2((elmtId, isInitialRender) => { 1720 SymbolGlyph.create(this.image); 1721 SymbolGlyph.fontSize(`${e2}vp`); 1722 SymbolGlyph.draggable(false); 1723 SymbolGlyph.margin({ end: LengthMetrics.vp(c1) }); 1724 }, SymbolGlyph); 1725 }); 1726 } else { 1727 this.ifElseBranchUpdateFunction(1, () => { 1728 this.observeComponentCreation2((elmtId, isInitialRender) => { 1729 Image.create(this.image); 1730 Image.height(e2); 1731 Image.width(e2); 1732 Image.draggable(false); 1733 Image.margin({ end: LengthMetrics.vp(c1) }); 1734 }, Image); 1735 }); 1736 } 1737 }, If); 1738 If.pop(); 1739 } 1740 1741 createSymbol(parent = null) { 1742 this.observeComponentCreation2((elmtId, isInitialRender) => { 1743 SymbolGlyph.create(); 1744 SymbolGlyph.attributeModifier.bind(this)(ObservedObject.GetRawObject(this.symbolStyle)); 1745 SymbolGlyph.fontSize(`${e2}vp`); 1746 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1747 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1748 SymbolGlyph.draggable(false); 1749 SymbolGlyph.margin({ end: LengthMetrics.vp(c1) }); 1750 }, SymbolGlyph); 1751 } 1752 1753 createText(parent = null) { 1754 this.observeComponentCreation2((elmtId, isInitialRender) => { 1755 Text.create(this.text); 1756 Text.margin({ end: LengthMetrics.vp(c1) }); 1757 Text.fontSize(ObservedObject.GetRawObject(this.secondaryTextSize)); 1758 Text.fontColor(ObservedObject.GetRawObject(this.secondaryTextColors)); 1759 Text.textOverflow({ 1760 overflow: f3 === e3 ? TextOverflow.MARQUEE : 1761 TextOverflow.None 1762 }); 1763 Text.marqueeOptions({ 1764 start: this.isFocus || this.parentIsHover, 1765 fadeout: true, 1766 marqueeStartPolicy: MarqueeStartPolicy.DEFAULT 1767 }); 1768 Text.maxLines(LengthMetrics.resource({ 1769 'id': -1, 1770 'type': 10002, 1771 params: ['sys.float.composeListItem_maxLines_right'], 1772 'bundleName': '__harDefaultBundleName__', 1773 'moduleName': '__harDefaultModuleName__' 1774 }).value); 1775 Text.draggable(false); 1776 Text.flexShrink(1); 1777 }, Text); 1778 Text.pop(); 1779 } 1780 1781 createArrow(parent = null) { 1782 this.observeComponentCreation2((elmtId, isInitialRender) => { 1783 Button.createWithChild({ type: ButtonType.Normal }); 1784 Button.shadow(b3); 1785 Button.margin({ end: LengthMetrics.vp(c1) }); 1786 Button.hitTestBehavior(z2 ? 1787 (this.arrow?.action !== undefined ? HitTestMode.Block : HitTestMode.Transparent) : HitTestMode.None); 1788 Button.backgroundColor(Color.Transparent); 1789 Button.height(a2); 1790 Button.width(c2); 1791 Button.onFocus(() => { 1792 this.parentCanFocus = false; 1793 }); 1794 Button.stateEffect(this.arrow?.action !== undefined); 1795 Button.hoverEffect(this.arrow?.action !== undefined ? HoverEffect.Auto : HoverEffect.None); 1796 Button.onHover((isHover) => { 1797 if (this.arrow?.action === undefined) { 1798 return; 1799 } 1800 if (isHover && z2) { 1801 this.parentCanHover = false; 1802 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 1803 } else { 1804 this.parentCanHover = true; 1805 if (this.parentIsHover) { 1806 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 1807 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 1808 } 1809 } 1810 }); 1811 Button.onClick(this.arrow?.action); 1812 Button.accessibilityLevel(j(this.arrow?.accessibilityLevel, this.arrow?.action)); 1813 Button.accessibilityText(getAccessibilityText(this.arrow?.accessibilityText ?? '')); 1814 Button.accessibilityDescription(getAccessibilityText(this.arrow?.accessibilityDescription ?? '')); 1815 }, Button); 1816 this.observeComponentCreation2((elmtId, isInitialRender) => { 1817 If.create(); 1818 if (this.arrow?.symbolStyle) { 1819 this.ifElseBranchUpdateFunction(0, () => { 1820 this.observeComponentCreation2((elmtId, isInitialRender) => { 1821 SymbolGlyph.create(); 1822 SymbolGlyph.fontColor([z2 ? { 1823 'id': -1, 1824 'type': 10001, 1825 params: ['sys.color.ohos_id_color_fourth'], 1826 'bundleName': '__harDefaultBundleName__', 1827 'moduleName': '__harDefaultModuleName__' 1828 } : this.iconColor]); 1829 SymbolGlyph.attributeModifier.bind(this)(this.arrow?.symbolStyle); 1830 SymbolGlyph.fontSize(`${a2}vp`); 1831 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1832 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1833 SymbolGlyph.focusable(true); 1834 SymbolGlyph.draggable(false); 1835 }, SymbolGlyph); 1836 }); 1837 } else { 1838 this.ifElseBranchUpdateFunction(1, () => { 1839 this.observeComponentCreation2((elmtId, isInitialRender) => { 1840 If.create(); 1841 if (Util.l4(this.arrow?.value)) { 1842 this.ifElseBranchUpdateFunction(0, () => { 1843 this.observeComponentCreation2((elmtId, isInitialRender) => { 1844 SymbolGlyph.create(this.arrow?.value); 1845 SymbolGlyph.fontSize(`${a2}vp`); 1846 SymbolGlyph.fontColor([z2 ? { 1847 'id': -1, 1848 'type': 10001, 1849 params: ['sys.color.ohos_id_color_fourth'], 1850 'bundleName': '__harDefaultBundleName__', 1851 'moduleName': '__harDefaultModuleName__' 1852 } : this.iconColor]); 1853 SymbolGlyph.focusable(true); 1854 SymbolGlyph.draggable(false); 1855 }, SymbolGlyph); 1856 }); 1857 } else { 1858 this.ifElseBranchUpdateFunction(1, () => { 1859 this.observeComponentCreation2((elmtId, isInitialRender) => { 1860 Image.create(this.arrow?.value); 1861 Image.height(a2); 1862 Image.width(c2); 1863 Image.focusable(true); 1864 Image.fillColor(z2 ? { 1865 'id': -1, 1866 'type': 10001, 1867 params: ['sys.color.ohos_id_color_fourth'], 1868 'bundleName': '__harDefaultBundleName__', 1869 'moduleName': '__harDefaultModuleName__' 1870 } : this.iconColor); 1871 Image.draggable(false); 1872 Image.matchTextDirection(true); 1873 }, Image); 1874 }); 1875 } 1876 }, If); 1877 If.pop(); 1878 }); 1879 } 1880 }, If); 1881 If.pop(); 1882 Button.pop(); 1883 } 1884 1885 createRadio(parent = null) { 1886 this.observeComponentCreation2((elmtId, isInitialRender) => { 1887 Radio.create({ value: '', group: '' }); 1888 Radio.margin({ end: LengthMetrics.vp(c1) }); 1889 Radio.checked(this.radioState); 1890 Radio.radioStyle({ 1891 uncheckedBorderColor: d3 1892 }); 1893 Radio.backgroundColor(Color.Transparent); 1894 Radio.borderRadius(c3); 1895 Radio.onChange((isCheck) => { 1896 if (!z2) { 1897 this.radioState = isCheck; 1898 } 1899 if (this.radio?.onChange) { 1900 this.radio?.onChange(isCheck); 1901 } 1902 }); 1903 Radio.height(a2); 1904 Radio.width(a2); 1905 Radio.padding(b2); 1906 Radio.onFocus(() => { 1907 this.parentCanFocus = false; 1908 }); 1909 Radio.hitTestBehavior(z2 ? HitTestMode.Block : HitTestMode.None); 1910 Radio.flexShrink(0); 1911 Radio.onHover((isHover) => { 1912 this.parentCanHover = false; 1913 if (isHover && this.parentFrontColor === this.hoveringColor && z2) { 1914 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 1915 } 1916 if (!isHover) { 1917 this.parentCanHover = true; 1918 if (this.parentIsHover) { 1919 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 1920 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 1921 } 1922 } 1923 }); 1924 Radio.accessibilityLevel(i(this.radio?.accessibilityLevel, this.radio?.onChange)); 1925 Radio.accessibilityText(getAccessibilityText(this.radio?.accessibilityText ?? '')); 1926 Radio.accessibilityDescription(getAccessibilityText(this.radio?.accessibilityDescription ?? '')); 1927 }, Radio); 1928 } 1929 1930 createCheckBox(parent = null) { 1931 this.observeComponentCreation2((elmtId, isInitialRender) => { 1932 Checkbox.create(); 1933 Checkbox.borderRadius(z2 ? g3 : c3); 1934 Checkbox.unselectedColor(d3); 1935 Checkbox.backgroundColor(Color.Transparent); 1936 Checkbox.margin({ end: LengthMetrics.vp(c1) }); 1937 Checkbox.select(this.checkBoxState); 1938 Checkbox.onChange((isCheck) => { 1939 if (!z2) { 1940 this.checkBoxState = isCheck; 1941 } 1942 if (this.checkBox?.onChange) { 1943 this.checkBox?.onChange(isCheck); 1944 } 1945 }); 1946 Checkbox.height(a2); 1947 Checkbox.width(a2); 1948 Checkbox.padding(b2); 1949 Checkbox.onFocus(() => { 1950 this.parentCanFocus = false; 1951 }); 1952 Checkbox.hitTestBehavior(z2 ? HitTestMode.Block : HitTestMode.None); 1953 Checkbox.flexShrink(0); 1954 Checkbox.onHover((isHover) => { 1955 this.parentCanHover = false; 1956 if (isHover && this.parentFrontColor === this.hoveringColor && z2) { 1957 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 1958 } 1959 if (!isHover) { 1960 this.parentCanHover = true; 1961 if (this.parentIsHover) { 1962 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 1963 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 1964 } 1965 } 1966 }); 1967 Checkbox.accessibilityLevel(i(this.checkBox?.accessibilityLevel, this.checkBox?.onChange)); 1968 Checkbox.accessibilityText(getAccessibilityText(this.checkBox?.accessibilityText ?? '')); 1969 Checkbox.accessibilityDescription(getAccessibilityText(this.checkBox?.accessibilityDescription ?? '')); 1970 }, Checkbox); 1971 Checkbox.pop(); 1972 } 1973 1974 createSwitch(parent = null) { 1975 this.observeComponentCreation2((elmtId, isInitialRender) => { 1976 Row.create(); 1977 Row.margin({ end: LengthMetrics.vp(d1) }); 1978 Row.height(d2); 1979 Row.width(d2); 1980 Row.justifyContent(FlexAlign.Center); 1981 Row.onFocus(() => { 1982 this.parentCanFocus = false; 1983 }); 1984 Row.onHover((isHover) => { 1985 this.parentCanHover = false; 1986 if (isHover && this.parentFrontColor === this.hoveringColor && z2) { 1987 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 1988 } 1989 if (!isHover) { 1990 this.parentCanHover = true; 1991 if (this.parentIsHover) { 1992 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 1993 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 1994 } 1995 } 1996 }); 1997 }, Row); 1998 this.observeComponentCreation2((elmtId, isInitialRender) => { 1999 Toggle.create({ type: ToggleType.Switch, isOn: this.switchState }); 2000 Toggle.borderRadius(z2 ? g3 : c3); 2001 Toggle.backgroundColor(Color.Transparent); 2002 Toggle.onChange((isCheck) => { 2003 this.switchState = isCheck; 2004 if (this.switch?.onChange) { 2005 this.switch?.onChange(isCheck); 2006 } 2007 }); 2008 Toggle.onClick(() => { 2009 this.switchState = !this.switchState; 2010 }); 2011 Toggle.hitTestBehavior(z2 ? HitTestMode.Block : HitTestMode.None); 2012 Toggle.accessibilityLevel(i(this.switch?.accessibilityLevel, this.switch?.onChange)); 2013 Toggle.accessibilityText(getAccessibilityText(this.switch?.accessibilityText ?? '')); 2014 Toggle.accessibilityDescription(getAccessibilityText(this.switch?.accessibilityDescription ?? '')); 2015 }, Toggle); 2016 Toggle.pop(); 2017 Row.pop(); 2018 } 2019 2020 createTextArrow(parent = null) { 2021 this.observeComponentCreation2((elmtId, isInitialRender) => { 2022 Button.createWithChild({ type: ButtonType.Normal }); 2023 Button.shadow(b3); 2024 Button.hitTestBehavior(z2 ? 2025 (this.arrow?.action !== undefined ? HitTestMode.Block : HitTestMode.Transparent) : HitTestMode.None); 2026 Button.labelStyle({ 2027 maxLines: t 2028 }); 2029 Button.backgroundColor(Color.Transparent); 2030 Button.constraintSize({ minHeight: i1 }); 2031 Button.borderRadius({ 2032 'id': -1, 2033 'type': 10002, 2034 params: ['sys.float.ohos_id_corner_radius_clicked'], 2035 'bundleName': '__harDefaultBundleName__', 2036 'moduleName': '__harDefaultModuleName__' 2037 }); 2038 Button.onFocus(() => { 2039 this.parentCanFocus = false; 2040 }); 2041 Button.padding({ 2042 top: 0, 2043 bottom: 0, 2044 left: 0, 2045 right: 0 2046 }); 2047 Button.stateEffect(this.arrow?.action !== undefined); 2048 Button.hoverEffect(this.arrow?.action !== undefined ? HoverEffect.Auto : HoverEffect.None); 2049 Button.onHover((isHover) => { 2050 if (this.arrow?.action === undefined) { 2051 return; 2052 } 2053 if (isHover && z2) { 2054 this.parentCanHover = false; 2055 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 2056 } else { 2057 this.parentCanHover = true; 2058 if (this.parentIsHover) { 2059 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 2060 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 2061 } 2062 } 2063 }); 2064 Button.onClick(this.arrow?.action); 2065 Button.accessibilityLevel(j(this.arrow?.accessibilityLevel, this.arrow?.action)); 2066 Button.accessibilityText(`${this.text} ${getAccessibilityText(this.arrow?.accessibilityText ?? '')}`); 2067 Button.accessibilityDescription(getAccessibilityText(this.arrow?.accessibilityDescription ?? '')); 2068 }, Button); 2069 this.observeComponentCreation2((elmtId, isInitialRender) => { 2070 If.create(); 2071 if (this.parentDirection === FlexDirection.Column) { 2072 this.ifElseBranchUpdateFunction(0, () => { 2073 this.observeComponentCreation2((elmtId, isInitialRender) => { 2074 Flex.create({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }); 2075 Flex.padding({ 2076 start: LengthMetrics.vp(b1), 2077 end: LengthMetrics.vp(c1) 2078 }); 2079 }, Flex); 2080 this.observeComponentCreation2((elmtId, isInitialRender) => { 2081 Text.create(this.text); 2082 Text.fontSize({ 2083 'id': -1, 2084 'type': 10002, 2085 params: ['sys.float.ohos_id_text_size_body2'], 2086 'bundleName': '__harDefaultBundleName__', 2087 'moduleName': '__harDefaultModuleName__' 2088 }); 2089 Text.fontColor(ObservedObject.GetRawObject(this.secondaryTextColor)); 2090 Text.focusable(true); 2091 Text.draggable(false); 2092 Text.constraintSize({ 2093 maxWidth: `calc(100% - ${c2}vp)` 2094 }); 2095 }, Text); 2096 Text.pop(); 2097 this.observeComponentCreation2((elmtId, isInitialRender) => { 2098 If.create(); 2099 if (this.arrow?.symbolStyle) { 2100 this.ifElseBranchUpdateFunction(0, () => { 2101 this.observeComponentCreation2((elmtId, isInitialRender) => { 2102 SymbolGlyph.create(); 2103 SymbolGlyph.fontColor([{ 2104 'id': -1, 2105 'type': 10001, 2106 params: ['sys.color.ohos_id_color_fourth'], 2107 'bundleName': '__harDefaultBundleName__', 2108 'moduleName': '__harDefaultModuleName__' 2109 }]); 2110 SymbolGlyph.attributeModifier.bind(this)(this.arrow?.symbolStyle); 2111 SymbolGlyph.fontSize(`${a2}vp`); 2112 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 2113 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 2114 SymbolGlyph.focusable(false); 2115 SymbolGlyph.draggable(false); 2116 }, SymbolGlyph); 2117 }); 2118 } else { 2119 this.ifElseBranchUpdateFunction(1, () => { 2120 this.observeComponentCreation2((elmtId, isInitialRender) => { 2121 If.create(); 2122 if (Util.l4(this.arrow?.value)) { 2123 this.ifElseBranchUpdateFunction(0, () => { 2124 this.observeComponentCreation2((elmtId, isInitialRender) => { 2125 SymbolGlyph.create(this.arrow?.value); 2126 SymbolGlyph.fontSize(`${a2}vp`); 2127 SymbolGlyph.fontColor([{ 2128 'id': -1, 2129 'type': 10001, 2130 params: ['sys.color.ohos_id_color_fourth'], 2131 'bundleName': '__harDefaultBundleName__', 2132 'moduleName': '__harDefaultModuleName__' 2133 }]); 2134 SymbolGlyph.focusable(false); 2135 SymbolGlyph.draggable(false); 2136 }, SymbolGlyph); 2137 }); 2138 } else { 2139 this.ifElseBranchUpdateFunction(1, () => { 2140 this.observeComponentCreation2((elmtId, isInitialRender) => { 2141 Image.create(this.arrow?.value); 2142 Image.height(a2); 2143 Image.width(c2); 2144 Image.fillColor({ 2145 'id': -1, 2146 'type': 10001, 2147 params: ['sys.color.ohos_id_color_fourth'], 2148 'bundleName': '__harDefaultBundleName__', 2149 'moduleName': '__harDefaultModuleName__' 2150 }); 2151 Image.focusable(false); 2152 Image.draggable(false); 2153 Image.matchTextDirection(true); 2154 }, Image); 2155 }); 2156 } 2157 }, If); 2158 If.pop(); 2159 }); 2160 } 2161 }, If); 2162 If.pop(); 2163 Flex.pop(); 2164 }); 2165 } else { 2166 this.ifElseBranchUpdateFunction(1, () => { 2167 this.observeComponentCreation2((elmtId, isInitialRender) => { 2168 Row.create({ space: z1 }); 2169 Row.padding({ 2170 start: LengthMetrics.vp(b1), 2171 end: LengthMetrics.vp(c1) 2172 }); 2173 }, Row); 2174 this.observeComponentCreation2((elmtId, isInitialRender) => { 2175 Text.create(this.text); 2176 Text.fontSize(ObservedObject.GetRawObject(this.secondaryTextSize)); 2177 Text.fontColor(ObservedObject.GetRawObject(this.secondaryTextColors)); 2178 Text.textOverflow({ 2179 overflow: f3 === e3 ? TextOverflow.MARQUEE : 2180 TextOverflow.None 2181 }); 2182 Text.marqueeOptions({ 2183 start: this.isFocus || this.parentIsHover, 2184 fadeout: true, 2185 marqueeStartPolicy: MarqueeStartPolicy.DEFAULT 2186 }); 2187 Text.maxLines(LengthMetrics.resource({ 2188 'id': -1, 2189 'type': 10002, 2190 params: ['sys.float.composeListItem_maxLines_right'], 2191 'bundleName': '__harDefaultBundleName__', 2192 'moduleName': '__harDefaultModuleName__' 2193 }).value); 2194 Text.focusable(true); 2195 Text.draggable(false); 2196 Text.constraintSize({ 2197 maxWidth: `calc(100% - ${c2 + o3}vp)` 2198 }); 2199 Text.margin({ right: o3 }); 2200 }, Text); 2201 Text.pop(); 2202 this.observeComponentCreation2((elmtId, isInitialRender) => { 2203 If.create(); 2204 if (this.arrow?.symbolStyle) { 2205 this.ifElseBranchUpdateFunction(0, () => { 2206 this.observeComponentCreation2((elmtId, isInitialRender) => { 2207 SymbolGlyph.create(); 2208 SymbolGlyph.fontColor([z2 ? { 2209 'id': -1, 2210 'type': 10001, 2211 params: ['sys.color.icon_fourth'], 2212 'bundleName': '__harDefaultBundleName__', 2213 'moduleName': '__harDefaultModuleName__' 2214 } : this.iconColor]); 2215 SymbolGlyph.attributeModifier.bind(this)(this.arrow?.symbolStyle); 2216 SymbolGlyph.fontSize(`${a2}vp`); 2217 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 2218 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 2219 SymbolGlyph.focusable(false); 2220 SymbolGlyph.draggable(false); 2221 }, SymbolGlyph); 2222 }); 2223 } else { 2224 this.ifElseBranchUpdateFunction(1, () => { 2225 this.observeComponentCreation2((elmtId, isInitialRender) => { 2226 If.create(); 2227 if (Util.l4(this.arrow?.value)) { 2228 this.ifElseBranchUpdateFunction(0, () => { 2229 this.observeComponentCreation2((elmtId, isInitialRender) => { 2230 SymbolGlyph.create(this.arrow?.value); 2231 SymbolGlyph.fontSize(`${a2}vp`); 2232 SymbolGlyph.fontColor([z2 ? { 2233 'id': -1, 2234 'type': 10001, 2235 params: ['sys.color.icon_fourth'], 2236 'bundleName': '__harDefaultBundleName__', 2237 'moduleName': '__harDefaultModuleName__' 2238 } : this.iconColor]); 2239 SymbolGlyph.focusable(false); 2240 SymbolGlyph.draggable(false); 2241 }, SymbolGlyph); 2242 }); 2243 } else { 2244 this.ifElseBranchUpdateFunction(1, () => { 2245 this.observeComponentCreation2((elmtId, isInitialRender) => { 2246 Image.create(this.arrow?.value); 2247 Image.height(a2); 2248 Image.width(c2); 2249 Image.fillColor(z2 ? { 2250 'id': -1, 2251 'type': 10001, 2252 params: ['sys.color.icon_fourth'], 2253 'bundleName': '__harDefaultBundleName__', 2254 'moduleName': '__harDefaultModuleName__' 2255 } : this.iconColor); 2256 Image.focusable(false); 2257 Image.draggable(false); 2258 Image.matchTextDirection(true); 2259 }, Image); 2260 }); 2261 } 2262 }, If); 2263 If.pop(); 2264 }); 2265 } 2266 }, If); 2267 If.pop(); 2268 Row.pop(); 2269 }); 2270 } 2271 }, If); 2272 If.pop(); 2273 Button.pop(); 2274 } 2275 2276 getFlexOptions() { 2277 let b4 = { alignItems: ItemAlign.Center }; 2278 if (this.parentDirection === FlexDirection.Column) { 2279 b4.justifyContent = FlexAlign.SpaceBetween; 2280 } else { 2281 b4.space = { main: LengthMetrics.vp(this.rowSpace) }; 2282 b4.justifyContent = FlexAlign.End; 2283 } 2284 return b4; 2285 } 2286 2287 initialRender() { 2288 this.observeComponentCreation2((elmtId, isInitialRender) => { 2289 Flex.create(this.getFlexOptions()); 2290 Flex.width(this.parentDirection === FlexDirection.Column ? undefined : this.rightWidth); 2291 }, Flex); 2292 this.observeComponentCreation2((elmtId, isInitialRender) => { 2293 If.create(); 2294 if (this.button != null) { 2295 this.ifElseBranchUpdateFunction(0, () => { 2296 this.createButton.bind(this)(); 2297 }); 2298 } else if (this.symbolStyle != null) { 2299 this.ifElseBranchUpdateFunction(1, () => { 2300 this.createSymbol.bind(this)(); 2301 }); 2302 } else if (this.image != null) { 2303 this.ifElseBranchUpdateFunction(2, () => { 2304 this.createImage.bind(this)(); 2305 }); 2306 } else if (this.icon != null && this.text != null) { 2307 this.ifElseBranchUpdateFunction(3, () => { 2308 this.createText.bind(this)(); 2309 this.createIcon.bind(this)(makeBuilderParameterProxy('createIcon', 2310 { icon: () => (this['__icon'] ? this['__icon'] : this['icon']) })); 2311 }); 2312 } else if (this.arrow != null && (this.text == null || this.text == '')) { 2313 this.ifElseBranchUpdateFunction(4, () => { 2314 this.createArrow.bind(this)(); 2315 }); 2316 } else if (this.arrow != null && this.text != null) { 2317 this.ifElseBranchUpdateFunction(5, () => { 2318 this.createTextArrow.bind(this)(); 2319 }); 2320 } else if (this.text != null) { 2321 this.ifElseBranchUpdateFunction(6, () => { 2322 this.createText.bind(this)(); 2323 }); 2324 } else if (this.radio != null) { 2325 this.ifElseBranchUpdateFunction(7, () => { 2326 this.createRadio.bind(this)(); 2327 }); 2328 } else if (this.checkBox != null) { 2329 this.ifElseBranchUpdateFunction(8, () => { 2330 this.createCheckBox.bind(this)(); 2331 }); 2332 } else if (this.switch != null) { 2333 this.ifElseBranchUpdateFunction(9, () => { 2334 this.createSwitch.bind(this)(); 2335 }); 2336 } else if (this.icon != null) { 2337 this.ifElseBranchUpdateFunction(10, () => { 2338 this.createIcon.bind(this)(makeBuilderParameterProxy('createIcon', 2339 { icon: () => (this['__icon'] ? this['__icon'] : this['icon']) })); 2340 this.observeComponentCreation2((elmtId, isInitialRender) => { 2341 If.create(); 2342 if (this.subIcon != null) { 2343 this.ifElseBranchUpdateFunction(0, () => { 2344 this.createIcon.bind(this)(makeBuilderParameterProxy('createIcon', 2345 { icon: () => (this['__subIcon'] ? this['__subIcon'] : this['subIcon']) })); 2346 }); 2347 } else { 2348 this.ifElseBranchUpdateFunction(1, () => { 2349 }); 2350 } 2351 }, If); 2352 If.pop(); 2353 }); 2354 } else { 2355 this.ifElseBranchUpdateFunction(11, () => { 2356 }); 2357 } 2358 }, If); 2359 If.pop(); 2360 Flex.pop(); 2361 } 2362 2363 rerender() { 2364 this.updateDirtyElements(); 2365 } 2366} 2367 2368function getAccessibilityText(resource) { 2369 try { 2370 let a4 = ''; 2371 if (typeof resource === 'string') { 2372 a4 = resource; 2373 } else { 2374 a4 = getContext().resourceManager.getStringSync(resource); 2375 } 2376 return a4; 2377 } catch (error) { 2378 let code = error.code; 2379 let message = error.message; 2380 hilog.error(0x3900, 'Ace', `getAccessibilityText error, code: ${code}, message: ${message}`); 2381 return ''; 2382 } 2383} 2384 2385function i(accessibilityLevel, onChange) { 2386 if (accessibilityLevel) { 2387 return accessibilityLevel; 2388 } 2389 if (onChange) { 2390 return t2; 2391 } 2392 return u2; 2393} 2394 2395function j(accessibilityLevel, onAction) { 2396 if (accessibilityLevel) { 2397 return accessibilityLevel; 2398 } 2399 if (onAction) { 2400 return t2; 2401 } 2402 return u2; 2403} 2404 2405export class ComposeListItem extends ViewPU { 2406 constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) { 2407 super(parent, __localStorage, elmtId, extraInfo); 2408 if (typeof paramsLambda === 'function') { 2409 this.paramsGenerator_ = paramsLambda; 2410 } 2411 this.__contentItem = new SynchedPropertyObjectOneWayPU(params.contentItem, this, 'contentItem'); 2412 this.__operateItem = new SynchedPropertyObjectOneWayPU(params.operateItem, this, 'operateItem'); 2413 this.__frontColor = new ObservedPropertyObjectPU(i3, this, 'frontColor'); 2414 this.__borderSize = new ObservedPropertySimplePU(0, this, 'borderSize'); 2415 this.__canFocus = new ObservedPropertySimplePU(false, this, 'canFocus'); 2416 this.__canTouch = new ObservedPropertySimplePU(true, this, 'canTouch'); 2417 this.__canHover = new ObservedPropertySimplePU(true, this, 'canHover'); 2418 this.__isHover = new ObservedPropertySimplePU(false, this, 'isHover'); 2419 this.__itemHeight = new ObservedPropertySimplePU(o.FIRST_HEIGHT, this, 'itemHeight'); 2420 this.__isActive = new ObservedPropertySimplePU(false, this, 'isActive'); 2421 this.__hoveringColor = new ObservedPropertyObjectPU('#0d000000', this, 'hoveringColor'); 2422 this.__touchDownColor = new ObservedPropertyObjectPU('#1a000000', this, 'touchDownColor'); 2423 this.__activedColor = new ObservedPropertyObjectPU('#1a0a59f7', this, 'activedColor'); 2424 this.__focusOutlineColor = new ObservedPropertyObjectPU({ 2425 'id': -1, 2426 'type': 10001, 2427 params: ['sys.color.ohos_id_color_focused_outline'], 2428 'bundleName': '__harDefaultBundleName__', 2429 'moduleName': '__harDefaultModuleName__' 2430 }, this, 'focusOutlineColor'); 2431 this.__fontSizeScale = new ObservedPropertySimplePU(1, this, 'fontSizeScale'); 2432 this.__containerDirection = new ObservedPropertySimplePU(FlexDirection.Row, this, 'containerDirection'); 2433 this.__contentItemDirection = new ObservedPropertySimplePU(FlexDirection.Row, this, 'contentItemDirection'); 2434 this.__containerPadding = new ObservedPropertyObjectPU(undefined, this, 'containerPadding'); 2435 this.__textArrowLeftSafeOffset = new ObservedPropertySimplePU(0, this, 'textArrowLeftSafeOffset'); 2436 this.isFollowingSystemFontScale = this.getUIContext().isFollowingSystemFontScale(); 2437 this.maxFontScale = this.getUIContext().getMaxFontScale(); 2438 this.callbackId = undefined; 2439 this.__accessibilityTextBuilder = new ObservedPropertySimplePU('', this, 'accessibilityTextBuilder'); 2440 this.__isFocus = new ObservedPropertySimplePU(false, this, 'isFocus'); 2441 this.__isWrapText = new ObservedPropertySimplePU(false, this, 'isWrapText'); 2442 this.__listScale = new ObservedPropertyObjectPU({ x: 1, y: 1 }, this, 'listScale'); 2443 this.operateItemStructRef = new t3(); 2444 this.envCallback = { 2445 onConfigurationUpdated: (config) => { 2446 if (config === undefined || !this.isFollowingSystemFontScale) { 2447 this.fontSizeScale = 1; 2448 return; 2449 } 2450 try { 2451 this.fontSizeScale = Math.min(this.maxFontScale, config.fontSizeScale ?? 1); 2452 } catch (z3) { 2453 let code = z3.code; 2454 let message = z3.message; 2455 hilog.error(0x3900, 'Ace', `ComposeListItem environmentCallback error: ${code}, ${message}`); 2456 } 2457 }, 2458 onMemoryLevel: (level) => { 2459 } 2460 }; 2461 this.setInitiallyProvidedValue(params); 2462 this.declareWatch('contentItem', this.onPropChange); 2463 this.declareWatch('operateItem', this.onPropChange); 2464 this.declareWatch('fontSizeScale', this.onFontSizeScaleChange); 2465 this.declareWatch('isWrapText', this.onWrapChange); 2466 this.finalizeConstruction(); 2467 } 2468 2469 setInitiallyProvidedValue(params) { 2470 if (params.contentItem === undefined) { 2471 this.__contentItem.set(null); 2472 } 2473 if (params.operateItem === undefined) { 2474 this.__operateItem.set(null); 2475 } 2476 if (params.frontColor !== undefined) { 2477 this.frontColor = params.frontColor; 2478 } 2479 if (params.borderSize !== undefined) { 2480 this.borderSize = params.borderSize; 2481 } 2482 if (params.canFocus !== undefined) { 2483 this.canFocus = params.canFocus; 2484 } 2485 if (params.canTouch !== undefined) { 2486 this.canTouch = params.canTouch; 2487 } 2488 if (params.canHover !== undefined) { 2489 this.canHover = params.canHover; 2490 } 2491 if (params.isHover !== undefined) { 2492 this.isHover = params.isHover; 2493 } 2494 if (params.itemHeight !== undefined) { 2495 this.itemHeight = params.itemHeight; 2496 } 2497 if (params.isActive !== undefined) { 2498 this.isActive = params.isActive; 2499 } 2500 if (params.hoveringColor !== undefined) { 2501 this.hoveringColor = params.hoveringColor; 2502 } 2503 if (params.touchDownColor !== undefined) { 2504 this.touchDownColor = params.touchDownColor; 2505 } 2506 if (params.activedColor !== undefined) { 2507 this.activedColor = params.activedColor; 2508 } 2509 if (params.focusOutlineColor !== undefined) { 2510 this.focusOutlineColor = params.focusOutlineColor; 2511 } 2512 if (params.fontSizeScale !== undefined) { 2513 this.fontSizeScale = params.fontSizeScale; 2514 } 2515 if (params.containerDirection !== undefined) { 2516 this.containerDirection = params.containerDirection; 2517 } 2518 if (params.contentItemDirection !== undefined) { 2519 this.contentItemDirection = params.contentItemDirection; 2520 } 2521 if (params.containerPadding !== undefined) { 2522 this.containerPadding = params.containerPadding; 2523 } 2524 if (params.textArrowLeftSafeOffset !== undefined) { 2525 this.textArrowLeftSafeOffset = params.textArrowLeftSafeOffset; 2526 } 2527 if (params.isFollowingSystemFontScale !== undefined) { 2528 this.isFollowingSystemFontScale = params.isFollowingSystemFontScale; 2529 } 2530 if (params.maxFontScale !== undefined) { 2531 this.maxFontScale = params.maxFontScale; 2532 } 2533 if (params.callbackId !== undefined) { 2534 this.callbackId = params.callbackId; 2535 } 2536 if (params.accessibilityTextBuilder !== undefined) { 2537 this.accessibilityTextBuilder = params.accessibilityTextBuilder; 2538 } 2539 if (params.isFocus !== undefined) { 2540 this.isFocus = params.isFocus; 2541 } 2542 if (params.isWrapText !== undefined) { 2543 this.isWrapText = params.isWrapText; 2544 } 2545 if (params.listScale !== undefined) { 2546 this.listScale = params.listScale; 2547 } 2548 if (params.operateItemStructRef !== undefined) { 2549 this.operateItemStructRef = params.operateItemStructRef; 2550 } 2551 if (params.envCallback !== undefined) { 2552 this.envCallback = params.envCallback; 2553 } 2554 } 2555 2556 updateStateVars(params) { 2557 this.__contentItem.reset(params.contentItem); 2558 this.__operateItem.reset(params.operateItem); 2559 } 2560 2561 purgeVariableDependenciesOnElmtId(rmElmtId) { 2562 this.__contentItem.purgeDependencyOnElmtId(rmElmtId); 2563 this.__operateItem.purgeDependencyOnElmtId(rmElmtId); 2564 this.__frontColor.purgeDependencyOnElmtId(rmElmtId); 2565 this.__borderSize.purgeDependencyOnElmtId(rmElmtId); 2566 this.__canFocus.purgeDependencyOnElmtId(rmElmtId); 2567 this.__canTouch.purgeDependencyOnElmtId(rmElmtId); 2568 this.__canHover.purgeDependencyOnElmtId(rmElmtId); 2569 this.__isHover.purgeDependencyOnElmtId(rmElmtId); 2570 this.__itemHeight.purgeDependencyOnElmtId(rmElmtId); 2571 this.__isActive.purgeDependencyOnElmtId(rmElmtId); 2572 this.__hoveringColor.purgeDependencyOnElmtId(rmElmtId); 2573 this.__touchDownColor.purgeDependencyOnElmtId(rmElmtId); 2574 this.__activedColor.purgeDependencyOnElmtId(rmElmtId); 2575 this.__focusOutlineColor.purgeDependencyOnElmtId(rmElmtId); 2576 this.__fontSizeScale.purgeDependencyOnElmtId(rmElmtId); 2577 this.__containerDirection.purgeDependencyOnElmtId(rmElmtId); 2578 this.__contentItemDirection.purgeDependencyOnElmtId(rmElmtId); 2579 this.__containerPadding.purgeDependencyOnElmtId(rmElmtId); 2580 this.__textArrowLeftSafeOffset.purgeDependencyOnElmtId(rmElmtId); 2581 this.__accessibilityTextBuilder.purgeDependencyOnElmtId(rmElmtId); 2582 this.__isFocus.purgeDependencyOnElmtId(rmElmtId); 2583 this.__isWrapText.purgeDependencyOnElmtId(rmElmtId); 2584 this.__listScale.purgeDependencyOnElmtId(rmElmtId); 2585 } 2586 2587 aboutToBeDeleted() { 2588 this.__contentItem.aboutToBeDeleted(); 2589 this.__operateItem.aboutToBeDeleted(); 2590 this.__frontColor.aboutToBeDeleted(); 2591 this.__borderSize.aboutToBeDeleted(); 2592 this.__canFocus.aboutToBeDeleted(); 2593 this.__canTouch.aboutToBeDeleted(); 2594 this.__canHover.aboutToBeDeleted(); 2595 this.__isHover.aboutToBeDeleted(); 2596 this.__itemHeight.aboutToBeDeleted(); 2597 this.__isActive.aboutToBeDeleted(); 2598 this.__hoveringColor.aboutToBeDeleted(); 2599 this.__touchDownColor.aboutToBeDeleted(); 2600 this.__activedColor.aboutToBeDeleted(); 2601 this.__focusOutlineColor.aboutToBeDeleted(); 2602 this.__fontSizeScale.aboutToBeDeleted(); 2603 this.__containerDirection.aboutToBeDeleted(); 2604 this.__contentItemDirection.aboutToBeDeleted(); 2605 this.__containerPadding.aboutToBeDeleted(); 2606 this.__textArrowLeftSafeOffset.aboutToBeDeleted(); 2607 this.__accessibilityTextBuilder.aboutToBeDeleted(); 2608 this.__isFocus.aboutToBeDeleted(); 2609 this.__isWrapText.aboutToBeDeleted(); 2610 this.__listScale.aboutToBeDeleted(); 2611 SubscriberManager.Get().delete(this.id__()); 2612 this.aboutToBeDeletedInternal(); 2613 } 2614 2615 get contentItem() { 2616 return this.__contentItem.get(); 2617 } 2618 2619 set contentItem(newValue) { 2620 this.__contentItem.set(newValue); 2621 } 2622 2623 get operateItem() { 2624 return this.__operateItem.get(); 2625 } 2626 2627 set operateItem(newValue) { 2628 this.__operateItem.set(newValue); 2629 } 2630 2631 get frontColor() { 2632 return this.__frontColor.get(); 2633 } 2634 2635 set frontColor(newValue) { 2636 this.__frontColor.set(newValue); 2637 } 2638 2639 get borderSize() { 2640 return this.__borderSize.get(); 2641 } 2642 2643 set borderSize(newValue) { 2644 this.__borderSize.set(newValue); 2645 } 2646 2647 get canFocus() { 2648 return this.__canFocus.get(); 2649 } 2650 2651 set canFocus(newValue) { 2652 this.__canFocus.set(newValue); 2653 } 2654 2655 get canTouch() { 2656 return this.__canTouch.get(); 2657 } 2658 2659 set canTouch(newValue) { 2660 this.__canTouch.set(newValue); 2661 } 2662 2663 get canHover() { 2664 return this.__canHover.get(); 2665 } 2666 2667 set canHover(newValue) { 2668 this.__canHover.set(newValue); 2669 } 2670 2671 get isHover() { 2672 return this.__isHover.get(); 2673 } 2674 2675 set isHover(newValue) { 2676 this.__isHover.set(newValue); 2677 } 2678 2679 get itemHeight() { 2680 return this.__itemHeight.get(); 2681 } 2682 2683 set itemHeight(newValue) { 2684 this.__itemHeight.set(newValue); 2685 } 2686 2687 get isActive() { 2688 return this.__isActive.get(); 2689 } 2690 2691 set isActive(newValue) { 2692 this.__isActive.set(newValue); 2693 } 2694 2695 get hoveringColor() { 2696 return this.__hoveringColor.get(); 2697 } 2698 2699 set hoveringColor(newValue) { 2700 this.__hoveringColor.set(newValue); 2701 } 2702 2703 get touchDownColor() { 2704 return this.__touchDownColor.get(); 2705 } 2706 2707 set touchDownColor(newValue) { 2708 this.__touchDownColor.set(newValue); 2709 } 2710 2711 get activedColor() { 2712 return this.__activedColor.get(); 2713 } 2714 2715 set activedColor(newValue) { 2716 this.__activedColor.set(newValue); 2717 } 2718 2719 get focusOutlineColor() { 2720 return this.__focusOutlineColor.get(); 2721 } 2722 2723 set focusOutlineColor(newValue) { 2724 this.__focusOutlineColor.set(newValue); 2725 } 2726 2727 get fontSizeScale() { 2728 return this.__fontSizeScale.get(); 2729 } 2730 2731 set fontSizeScale(newValue) { 2732 this.__fontSizeScale.set(newValue); 2733 } 2734 2735 get containerDirection() { 2736 return this.__containerDirection.get(); 2737 } 2738 2739 set containerDirection(newValue) { 2740 this.__containerDirection.set(newValue); 2741 } 2742 2743 get contentItemDirection() { 2744 return this.__contentItemDirection.get(); 2745 } 2746 2747 set contentItemDirection(newValue) { 2748 this.__contentItemDirection.set(newValue); 2749 } 2750 2751 get containerPadding() { 2752 return this.__containerPadding.get(); 2753 } 2754 2755 set containerPadding(newValue) { 2756 this.__containerPadding.set(newValue); 2757 } 2758 2759 get textArrowLeftSafeOffset() { 2760 return this.__textArrowLeftSafeOffset.get(); 2761 } 2762 2763 set textArrowLeftSafeOffset(newValue) { 2764 this.__textArrowLeftSafeOffset.set(newValue); 2765 } 2766 2767 get accessibilityTextBuilder() { 2768 return this.__accessibilityTextBuilder.get(); 2769 } 2770 2771 set accessibilityTextBuilder(newValue) { 2772 this.__accessibilityTextBuilder.set(newValue); 2773 } 2774 2775 get isFocus() { 2776 return this.__isFocus.get(); 2777 } 2778 2779 set isFocus(newValue) { 2780 this.__isFocus.set(newValue); 2781 } 2782 2783 get isWrapText() { 2784 return this.__isWrapText.get(); 2785 } 2786 2787 set isWrapText(newValue) { 2788 this.__isWrapText.set(newValue); 2789 } 2790 2791 get listScale() { 2792 return this.__listScale.get(); 2793 } 2794 2795 set listScale(newValue) { 2796 this.__listScale.set(newValue); 2797 } 2798 2799 onWillApplyTheme(theme) { 2800 this.hoveringColor = theme.colors.interactiveHover; 2801 this.touchDownColor = theme.colors.interactivePressed; 2802 this.activedColor = theme.colors.interactiveActive; 2803 this.focusOutlineColor = theme.colors.interactiveFocus; 2804 } 2805 2806 onWrapChange() { 2807 this.containerPadding = this.getPadding(); 2808 } 2809 2810 onPropChange() { 2811 this.containerDirection = this.decideContainerDirection(); 2812 this.contentItemDirection = this.decideContentItemDirection(); 2813 if (this.contentItem === undefined) { 2814 if (this.operateItem?.image !== undefined || 2815 this.operateItem?.symbolStyle !== undefined || 2816 this.operateItem?.icon !== undefined || 2817 this.operateItem?.subIcon !== undefined) { 2818 this.itemHeight = e2 + j1; 2819 } 2820 return; 2821 } 2822 if (this.contentItem?.secondaryText === undefined && this.contentItem?.description === undefined) { 2823 if (this.contentItem?.icon === undefined) { 2824 this.itemHeight = o.FIRST_HEIGHT; 2825 } else { 2826 this.itemHeight = this.contentItem.iconStyle <= IconType.HEAD_SCULPTURE ? 2827 o.SECOND_HEIGHT : 2828 (LengthMetrics.resource({ 2829 'id': -1, 2830 'type': 10002, 2831 params: ['sys.float.composeListItem_system_icon_line_height'], 2832 'bundleName': '__harDefaultBundleName__', 2833 'moduleName': '__harDefaultModuleName__' 2834 }).value); 2835 } 2836 } else if (this.contentItem.description === undefined) { 2837 let iconStyle = this.contentItem.iconStyle; 2838 if (this.contentItem.icon === undefined || 2839 (this.contentItem.icon !== undefined && iconStyle <= IconType.SYSTEM_ICON)) { 2840 this.itemHeight = o.THIRD_HEIGHT; 2841 } else { 2842 this.itemHeight = iconStyle === IconType.HEAD_SCULPTURE ? o.FOURTH_HEIGHT : q3; 2843 } 2844 } else { 2845 this.itemHeight = o.FIFTH_HEIGHT; 2846 } 2847 if (w2.get(this.contentItem?.iconStyle) >= this.itemHeight) { 2848 this.itemHeight = w2.get(this.contentItem?.iconStyle) + j1; 2849 } 2850 if (this.operateItem?.arrow && this.operateItem?.text && this.operateItem?.arrow?.action) { 2851 this.accessibilityTextBuilder = ` 2852 ${getAccessibilityText(this.contentItem?.primaryText ?? '')} 2853 ${getAccessibilityText(this.contentItem?.secondaryText ?? '')} 2854 ${getAccessibilityText(this.contentItem?.description ?? '')} 2855 `; 2856 } else { 2857 this.accessibilityTextBuilder = ` 2858 ${getAccessibilityText(this.contentItem?.primaryText ?? '')} 2859 ${getAccessibilityText(this.contentItem?.secondaryText ?? '')} 2860 ${getAccessibilityText(this.contentItem?.description ?? '')} 2861 ${getAccessibilityText(this.operateItem?.text ?? '')} 2862 `; 2863 } 2864 } 2865 2866 aboutToAppear() { 2867 this.fontSizeScale = this.decideFontSizeScale(); 2868 this.onPropChange(); 2869 try { 2870 this.callbackId = getContext()?.getApplicationContext()?.on('environment', this.envCallback); 2871 } catch (y3) { 2872 let code = y3.code; 2873 let message = y3.message; 2874 hilog.error(0x3900, 'Ace', `ComposeListItem Faild to get environment param error: ${code}, ${message}`); 2875 } 2876 if (!z2) { 2877 this.onFontSizeScaleChange(); 2878 } 2879 } 2880 2881 aboutToDisappear() { 2882 if (this.callbackId) { 2883 this.getUIContext() 2884 ?.getHostContext() 2885 ?.getApplicationContext() 2886 ?.off('environment', this.callbackId); 2887 this.callbackId = void (0); 2888 } 2889 } 2890 2891 calculatedRightWidth() { 2892 if (this.operateItem?.text || this.operateItem?.button) { 2893 return h2; 2894 } 2895 if (this.operateItem?.switch) { 2896 return q2; 2897 } else if (this.operateItem?.checkbox) { 2898 return o2; 2899 } else if (this.operateItem?.radio) { 2900 return n2; 2901 } else if (this.operateItem?.icon) { 2902 if (this.operateItem?.subIcon) { 2903 return m2; 2904 } 2905 return l2; 2906 } else if (this.operateItem?.symbolStyle) { 2907 return j2; 2908 } else if (this.operateItem?.image) { 2909 return j2; 2910 } else if (this.operateItem?.arrow) { 2911 return i2; 2912 } 2913 return f2; 2914 } 2915 2916 decideContentItemDirection() { 2917 if (this.fontSizeScale >= m.LEVEL1 && 2918 this.contentItem?.iconStyle && this.contentItem?.iconStyle > IconType.HEAD_SCULPTURE) { 2919 return FlexDirection.Column; 2920 } 2921 return FlexDirection.Row; 2922 } 2923 2924 decideContainerDirection() { 2925 if (this.fontSizeScale < m.LEVEL1 || !this.contentItem) { 2926 return FlexDirection.Row; 2927 } 2928 if (this.operateItem?.button) { 2929 return FlexDirection.Column; 2930 } else if (this.operateItem?.symbolStyle) { 2931 return FlexDirection.Row; 2932 } else if (this.operateItem?.image) { 2933 return FlexDirection.Row; 2934 } else if (this.operateItem?.icon && this.operateItem?.text) { 2935 return FlexDirection.Column; 2936 } else if (this.operateItem?.arrow) { 2937 if (!this.operateItem?.text) { 2938 return FlexDirection.Row; 2939 } 2940 this.textArrowLeftSafeOffset = b1; 2941 return FlexDirection.Column; 2942 } else if (this.operateItem?.text) { 2943 return FlexDirection.Column; 2944 } else { 2945 return FlexDirection.Row; 2946 } 2947 } 2948 2949 onFontSizeScaleChange() { 2950 this.containerDirection = this.decideContainerDirection(); 2951 this.contentItemDirection = this.decideContentItemDirection(); 2952 if (this.fontSizeScale >= m.LEVEL3) { 2953 this.containerPadding = { 2954 top: { 2955 'id': -1, 2956 'type': 10002, 2957 params: ['sys.float.padding_level12'], 2958 'bundleName': '__harDefaultBundleName__', 2959 'moduleName': '__harDefaultModuleName__' 2960 }, 2961 bottom: { 2962 'id': -1, 2963 'type': 10002, 2964 params: ['sys.float.padding_level12'], 2965 'bundleName': '__harDefaultBundleName__', 2966 'moduleName': '__harDefaultModuleName__' 2967 }, 2968 }; 2969 } else if (this.fontSizeScale >= m.LEVEL2) { 2970 this.containerPadding = { 2971 top: { 2972 'id': -1, 2973 'type': 10002, 2974 params: ['sys.float.padding_level10'], 2975 'bundleName': '__harDefaultBundleName__', 2976 'moduleName': '__harDefaultModuleName__' 2977 }, 2978 bottom: { 2979 'id': -1, 2980 'type': 10002, 2981 params: ['sys.float.padding_level10'], 2982 'bundleName': '__harDefaultBundleName__', 2983 'moduleName': '__harDefaultModuleName__' 2984 }, 2985 }; 2986 } else if (this.fontSizeScale >= m.LEVEL1) { 2987 this.containerPadding = { 2988 top: { 2989 'id': -1, 2990 'type': 10002, 2991 params: ['sys.float.padding_level8'], 2992 'bundleName': '__harDefaultBundleName__', 2993 'moduleName': '__harDefaultModuleName__' 2994 }, 2995 bottom: { 2996 'id': -1, 2997 'type': 10002, 2998 params: ['sys.float.padding_level8'], 2999 'bundleName': '__harDefaultBundleName__', 3000 'moduleName': '__harDefaultModuleName__' 3001 }, 3002 }; 3003 } else { 3004 this.containerPadding = this.getPadding(); 3005 } 3006 } 3007 3008 isSingleLine() { 3009 return !this.contentItem?.secondaryText && !this.contentItem?.description; 3010 } 3011 3012 getOperateOffset() { 3013 if (this.containerDirection === FlexDirection.Row) { 3014 return LengthMetrics.vp(0); 3015 } 3016 let iconSize = w2.get(this.contentItem?.iconStyle); 3017 if (this.contentItem?.icon && iconSize && iconSize <= l1) { 3018 return LengthMetrics.vp(iconSize + t1 + c1 - this.textArrowLeftSafeOffset); 3019 } 3020 return LengthMetrics.vp(c1 - this.textArrowLeftSafeOffset); 3021 } 3022 3023 getMainSpace() { 3024 if (this.containerDirection === FlexDirection.Column) { 3025 return LengthMetrics.resource(this.isSingleLine() ? { 3026 'id': -1, 3027 'type': 10002, 3028 params: ['sys.float.padding_level1'], 3029 'bundleName': '__harDefaultBundleName__', 3030 'moduleName': '__harDefaultModuleName__' 3031 } : { 3032 'id': -1, 3033 'type': 10002, 3034 params: ['sys.float.padding_level8'], 3035 'bundleName': '__harDefaultBundleName__', 3036 'moduleName': '__harDefaultModuleName__' 3037 }); 3038 } 3039 return LengthMetrics.vp(0); 3040 } 3041 3042 getFlexOptions() { 3043 if (this.containerDirection === FlexDirection.Column) { 3044 return { 3045 space: { main: this.getMainSpace() }, 3046 justifyContent: FlexAlign.Center, 3047 alignItems: ItemAlign.Start, 3048 direction: this.containerDirection, 3049 }; 3050 } 3051 return { 3052 justifyContent: FlexAlign.SpaceBetween, 3053 alignItems: ItemAlign.Center, 3054 direction: this.containerDirection, 3055 }; 3056 } 3057 3058 decideFontSizeScale() { 3059 if (!this.isFollowingSystemFontScale) { 3060 return 1; 3061 } 3062 return Math.min(this.maxFontScale, this.getUIContext().getHostContext()?.config.fontSizeScale ?? 1); 3063 } 3064 3065 getPadding() { 3066 if (!z2) { 3067 let v3 = LengthMetrics.resource(n3).value; 3068 let w3 = v3 > c1; 3069 let x3 = w3 ? v3 - c1 : 0; 3070 return { 3071 top: this.isWrapText ? v3 : 0, 3072 bottom: this.isWrapText ? v3 : 0, 3073 left: x3, 3074 right: x3 3075 }; 3076 } else { 3077 return undefined; 3078 } 3079 } 3080 3081 initialRender() { 3082 this.observeComponentCreation2((elmtId, isInitialRender) => { 3083 Stack.create(); 3084 Stack.width('100%'); 3085 Stack.accessibilityGroup(true); 3086 Stack.accessibilityText(this.accessibilityTextBuilder); 3087 Stack.onFocus(() => { 3088 this.isFocus = true; 3089 this.frontColor = h3; 3090 this.zoomIn(); 3091 }); 3092 Stack.onBlur(() => { 3093 this.isFocus = false; 3094 this.frontColor = i3; 3095 this.zoomOut(); 3096 }); 3097 Stack.borderRadius(z2 ? undefined : { 3098 'id': -1, 3099 'type': 10002, 3100 params: ['sys.float.composeListItem_radius'], 3101 'bundleName': '__harDefaultBundleName__', 3102 'moduleName': '__harDefaultModuleName__' 3103 }); 3104 Stack.onClick(z2 ? undefined : () => { 3105 if (this.operateItem?.icon && this.operateItem.icon?.action) { 3106 this.operateItem.icon.action(); 3107 } 3108 if (this.operateItem?.subIcon && this.operateItem.subIcon?.action) { 3109 this.operateItem.subIcon.action(); 3110 } 3111 if (this.operateItem?.arrow && this.operateItem.arrow?.action) { 3112 this.operateItem.arrow.action(); 3113 } 3114 if (this.operateItem?.radio) { 3115 this.operateItemStructRef.changeRadioState(); 3116 } 3117 if (this.operateItem?.checkbox) { 3118 this.operateItemStructRef.changeCheckboxState(); 3119 } 3120 if (this.operateItem?.switch) { 3121 this.operateItemStructRef.changeSwitchState(); 3122 } 3123 }); 3124 Stack.scale(ObservedObject.GetRawObject(this.listScale)); 3125 Stack.shadow(z2 ? undefined : (this.isFocus ? l3 : m3)); 3126 Stack.margin({ 3127 left: !z2 ? e1 : undefined, 3128 right: !z2 ? e1 : undefined 3129 }); 3130 Stack.padding({ 3131 left: z2 ? e1 : 0, 3132 right: z2 ? e1 : 0 3133 }); 3134 }, Stack); 3135 this.observeComponentCreation2((elmtId, isInitialRender) => { 3136 Flex.create(this.getFlexOptions()); 3137 Flex.height(this.containerDirection === FlexDirection.Column ? 'auto' : undefined); 3138 Flex.constraintSize({ 3139 minHeight: this.itemHeight 3140 }); 3141 Flex.focusable(z2); 3142 Flex.borderRadius({ 3143 'id': -1, 3144 'type': 10002, 3145 params: ['sys.float.composeListItem_radius'], 3146 'bundleName': '__harDefaultBundleName__', 3147 'moduleName': '__harDefaultModuleName__' 3148 }); 3149 Flex.backgroundColor(ObservedObject.GetRawObject(this.frontColor)); 3150 Flex.onFocus(() => { 3151 this.canFocus = true; 3152 }); 3153 Flex.onBlur(() => { 3154 this.canFocus = false; 3155 }); 3156 Flex.onHover((isHover) => { 3157 if (this.isFocus && !z2) { 3158 this.isHover = false; 3159 return; 3160 } 3161 this.isHover = isHover; 3162 if (this.canHover) { 3163 this.frontColor = isHover ? this.hoveringColor : 3164 (this.isActive ? this.activedColor : Color.Transparent.toString()); 3165 } 3166 if (!z2) { 3167 this.frontColor = isHover ? h3 : i3; 3168 isHover ? this.zoomIn() : this.zoomOut(); 3169 } 3170 }); 3171 ViewStackProcessor.visualState('focused'); 3172 Flex.border({ 3173 radius: { 3174 'id': -1, 3175 'type': 10002, 3176 params: ['sys.float.composeListItem_radius'], 3177 'bundleName': '__harDefaultBundleName__', 3178 'moduleName': '__harDefaultModuleName__' 3179 }, 3180 width: u, 3181 color: this.focusOutlineColor, 3182 style: BorderStyle.Solid 3183 }); 3184 ViewStackProcessor.visualState('normal'); 3185 Flex.border({ 3186 radius: { 3187 'id': -1, 3188 'type': 10002, 3189 params: ['sys.float.composeListItem_radius'], 3190 'bundleName': '__harDefaultBundleName__', 3191 'moduleName': '__harDefaultModuleName__' 3192 }, 3193 color: { 3194 'id': -1, 3195 'type': 10001, 3196 params: ['sys.color.composeListItem_stroke_normal_color'], 3197 'bundleName': '__harDefaultBundleName__', 3198 'moduleName': '__harDefaultModuleName__' 3199 }, 3200 width: { 3201 'id': -1, 3202 'type': 10002, 3203 params: ['sys.float.composeListItem_stroke_normal_thickness'], 3204 'bundleName': '__harDefaultBundleName__', 3205 'moduleName': '__harDefaultModuleName__' 3206 }, 3207 }); 3208 ViewStackProcessor.visualState('pressed'); 3209 Flex.backgroundColor(ObservedObject.GetRawObject(this.touchDownColor)); 3210 ViewStackProcessor.visualState(); 3211 Flex.padding(ObservedObject.GetRawObject(this.containerPadding)); 3212 }, Flex); 3213 this.observeComponentCreation2((elmtId, isInitialRender) => { 3214 If.create(); 3215 if (this.contentItem === null) { 3216 this.ifElseBranchUpdateFunction(0, () => { 3217 { 3218 this.observeComponentCreation2((elmtId, isInitialRender) => { 3219 if (isInitialRender) { 3220 let componentCall = new r3(this, { 3221 isWrapText: this.__isWrapText 3222 }, undefined, elmtId, () => { 3223 }, { page: 'library/src/main/ets/components/composelistitem.ets', line: 1401, n4: 11 }); 3224 ViewPU.create(componentCall); 3225 let paramsLambda = () => { 3226 return { 3227 isWrapText: this.isWrapText 3228 }; 3229 }; 3230 componentCall.paramsGenerator_ = paramsLambda; 3231 } else { 3232 this.updateStateVarsOfChildByElmtId(elmtId, {}); 3233 } 3234 }, { name: 'ContentItemStruct' }); 3235 } 3236 }); 3237 } else { 3238 this.ifElseBranchUpdateFunction(1, () => { 3239 }); 3240 } 3241 }, If); 3242 If.pop(); 3243 this.observeComponentCreation2((elmtId, isInitialRender) => { 3244 If.create(); 3245 if (this.contentItem !== null) { 3246 this.ifElseBranchUpdateFunction(0, () => { 3247 { 3248 this.observeComponentCreation2((elmtId, isInitialRender) => { 3249 if (isInitialRender) { 3250 let componentCall = new r3(this, { 3251 icon: this.contentItem?.icon, 3252 symbolStyle: this.contentItem?.symbolStyle, 3253 iconStyle: this.contentItem?.iconStyle, 3254 primaryText: this.contentItem?.primaryText, 3255 secondaryText: this.contentItem?.secondaryText, 3256 description: this.contentItem?.description, 3257 fontSizeScale: this.fontSizeScale, 3258 parentDirection: this.containerDirection, 3259 itemDirection: this.contentItemDirection, 3260 isFocus: this.isFocus, 3261 itemHeight: this.itemHeight, 3262 isWrapText: this.__isWrapText 3263 }, undefined, elmtId, () => { 3264 }, { page: 'library/src/main/ets/components/composelistitem.ets', line: 1406, n4: 11 }); 3265 ViewPU.create(componentCall); 3266 let paramsLambda = () => { 3267 return { 3268 icon: this.contentItem?.icon, 3269 symbolStyle: this.contentItem?.symbolStyle, 3270 iconStyle: this.contentItem?.iconStyle, 3271 primaryText: this.contentItem?.primaryText, 3272 secondaryText: this.contentItem?.secondaryText, 3273 description: this.contentItem?.description, 3274 fontSizeScale: this.fontSizeScale, 3275 parentDirection: this.containerDirection, 3276 itemDirection: this.contentItemDirection, 3277 isFocus: this.isFocus, 3278 itemHeight: this.itemHeight, 3279 isWrapText: this.isWrapText 3280 }; 3281 }; 3282 componentCall.paramsGenerator_ = paramsLambda; 3283 } else { 3284 this.updateStateVarsOfChildByElmtId(elmtId, { 3285 icon: this.contentItem?.icon, 3286 symbolStyle: this.contentItem?.symbolStyle, 3287 iconStyle: this.contentItem?.iconStyle, 3288 primaryText: this.contentItem?.primaryText, 3289 secondaryText: this.contentItem?.secondaryText, 3290 description: this.contentItem?.description, 3291 fontSizeScale: this.fontSizeScale, 3292 parentDirection: this.containerDirection, 3293 itemDirection: this.contentItemDirection, 3294 isFocus: this.isFocus, 3295 itemHeight: this.itemHeight 3296 }); 3297 } 3298 }, { name: 'ContentItemStruct' }); 3299 } 3300 }); 3301 } else { 3302 this.ifElseBranchUpdateFunction(1, () => { 3303 }); 3304 } 3305 }, If); 3306 If.pop(); 3307 this.observeComponentCreation2((elmtId, isInitialRender) => { 3308 If.create(); 3309 if (this.operateItem !== null) { 3310 this.ifElseBranchUpdateFunction(0, () => { 3311 this.observeComponentCreation2((elmtId, isInitialRender) => { 3312 __Common__.create(); 3313 __Common__.flexShrink(0); 3314 __Common__.onFocus(() => { 3315 this.canFocus = false; 3316 }); 3317 __Common__.onBlur(() => { 3318 this.canFocus = true; 3319 }); 3320 __Common__.padding({ start: this.getOperateOffset() }); 3321 }, __Common__); 3322 { 3323 this.observeComponentCreation2((elmtId, isInitialRender) => { 3324 if (isInitialRender) { 3325 let componentCall = new u3(this, { 3326 icon: this.operateItem?.icon, 3327 subIcon: this.operateItem?.subIcon, 3328 button: this.operateItem?.button, 3329 switch: this.operateItem?.switch, 3330 checkBox: this.operateItem?.checkbox, 3331 radio: this.operateItem?.radio, 3332 image: this.operateItem?.image, 3333 symbolStyle: this.operateItem?.symbolStyle, 3334 text: this.operateItem?.text, 3335 arrow: this.operateItem?.arrow, 3336 parentCanFocus: this.__canFocus, 3337 parentCanTouch: this.__canTouch, 3338 parentIsHover: this.__isHover, 3339 parentFrontColor: this.__frontColor, 3340 parentIsActive: this.__isActive, 3341 parentCanHover: this.__canHover, 3342 rightWidth: this.calculatedRightWidth(), 3343 parentDirection: this.__containerDirection, 3344 isFocus: this.__isFocus, 3345 controller: this.operateItemStructRef 3346 }, undefined, elmtId, () => { 3347 }, { page: 'library/src/main/ets/components/composelistitem.ets', line: 1422, n4: 11 }); 3348 ViewPU.create(componentCall); 3349 let paramsLambda = () => { 3350 return { 3351 icon: this.operateItem?.icon, 3352 subIcon: this.operateItem?.subIcon, 3353 button: this.operateItem?.button, 3354 switch: this.operateItem?.switch, 3355 checkBox: this.operateItem?.checkbox, 3356 radio: this.operateItem?.radio, 3357 image: this.operateItem?.image, 3358 symbolStyle: this.operateItem?.symbolStyle, 3359 text: this.operateItem?.text, 3360 arrow: this.operateItem?.arrow, 3361 parentCanFocus: this.canFocus, 3362 parentCanTouch: this.canTouch, 3363 parentIsHover: this.isHover, 3364 parentFrontColor: this.frontColor, 3365 parentIsActive: this.isActive, 3366 parentCanHover: this.canHover, 3367 rightWidth: this.calculatedRightWidth(), 3368 parentDirection: this.containerDirection, 3369 isFocus: this.isFocus, 3370 controller: this.operateItemStructRef 3371 }; 3372 }; 3373 componentCall.paramsGenerator_ = paramsLambda; 3374 } else { 3375 this.updateStateVarsOfChildByElmtId(elmtId, { 3376 icon: this.operateItem?.icon, 3377 subIcon: this.operateItem?.subIcon, 3378 button: this.operateItem?.button, 3379 switch: this.operateItem?.switch, 3380 checkBox: this.operateItem?.checkbox, 3381 radio: this.operateItem?.radio, 3382 image: this.operateItem?.image, 3383 symbolStyle: this.operateItem?.symbolStyle, 3384 text: this.operateItem?.text, 3385 arrow: this.operateItem?.arrow, 3386 rightWidth: this.calculatedRightWidth() 3387 }); 3388 } 3389 }, { name: 'OperateItemStruct' }); 3390 } 3391 __Common__.pop(); 3392 }); 3393 } else { 3394 this.ifElseBranchUpdateFunction(1, () => { 3395 }); 3396 } 3397 }, If); 3398 If.pop(); 3399 Flex.pop(); 3400 Stack.pop(); 3401 } 3402 3403 zoomIn() { 3404 this.listScale = { 3405 x: z2 ? undefined : j3, 3406 y: z2 ? undefined : j3 3407 }; 3408 } 3409 3410 zoomOut() { 3411 this.listScale = { 3412 x: z2 ? undefined : a3, 3413 y: z2 ? undefined : a3 3414 }; 3415 } 3416 3417 rerender() { 3418 this.updateDirtyElements(); 3419 } 3420} 3421 3422export default { 3423 IconType, ComposeListItem 3424};