1/* 2 * Copyright (c) 2023-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16if (!("finalizeConstruction" in ViewPU.prototype)) { 17 Reflect.set(ViewPU.prototype, "finalizeConstruction", () => { }); 18} 19const LengthMetrics = requireNapi('arkui.node').LengthMetrics; 20export var IconType; 21(function (h11) { 22 h11[h11["BADGE"] = 1] = "BADGE"; 23 h11[h11["NORMAL_ICON"] = 2] = "NORMAL_ICON"; 24 h11[h11["SYSTEM_ICON"] = 3] = "SYSTEM_ICON"; 25 h11[h11["HEAD_SCULPTURE"] = 4] = "HEAD_SCULPTURE"; 26 h11[h11["APP_ICON"] = 5] = "APP_ICON"; 27 h11[h11["PREVIEW"] = 6] = "PREVIEW"; 28 h11[h11["LONGITUDINAL"] = 7] = "LONGITUDINAL"; 29 h11[h11["VERTICAL"] = 8] = "VERTICAL"; 30})(IconType || (IconType = {})); 31var FontSizeScaleLevel; 32(function (y11) { 33 y11[y11["LEVEL1"] = 1.75] = "LEVEL1"; 34 y11[y11["LEVEL2"] = 2] = "LEVEL2"; 35 y11[y11["LEVEL3"] = 3.2] = "LEVEL3"; 36})(FontSizeScaleLevel || (FontSizeScaleLevel = {})); 37var ItemHeight; 38(function (x11) { 39 x11[x11["FIRST_HEIGHT"] = 48] = "FIRST_HEIGHT"; 40 x11[x11["SECOND_HEIGHT"] = 56] = "SECOND_HEIGHT"; 41 x11[x11["THIRD_HEIGHT"] = 64] = "THIRD_HEIGHT"; 42 x11[x11["FOURTH_HEIGHT"] = 72] = "FOURTH_HEIGHT"; 43 x11[x11["FIFTH_HEIGHT"] = 96] = "FIFTH_HEIGHT"; 44})(ItemHeight || (ItemHeight = {})); 45const TEXT_MAX_LINE = 1; 46const ITEM_BORDER_SHOWN = 2; 47const TEXT_COLUMN_SPACE = 4; 48const TEXT_SAFE_MARGIN = 8; 49const LISTITEM_PADDING = 6; 50const SWITCH_PADDING = 4; 51const STACK_PADDING = 4; 52const BADGE_SIZE = 8; 53const SMALL_ICON_SIZE = 16; 54const SYSTEM_ICON_SIZE = 24; 55const TEXT_ARROW_HEIGHT = 32; 56const SAFE_LIST_PADDING = 32; 57const HEADSCULPTURE_SIZE = 40; 58const BUTTON_SIZE = 28; 59const APP_ICON_SIZE = 64; 60const PREVIEW_SIZE = 96; 61const LONGITUDINAL_SIZE = 96; 62const VERTICAL_SIZE = 96; 63const NORMAL_ITEM_ROW_SPACE = 16; 64const SPECIAL_ITEM_ROW_SPACE = 0; 65const SPECIAL_ICON_SIZE = 0; 66const DEFAULT_ROW_SPACE = 0; 67const SPECICAL_ROW_SPACE = 4; 68const OPERATEITEM_ICONLIKE_SIZE = 24; 69const OPERATEITEM_SELECTIONBOX_PADDING_SIZE = 2; 70const OPERATEITEM_ARROW_WIDTH = 12; 71const OPERATEITEM_ICON_CLICKABLE_SIZE = 40; 72const OPERATEITEM_IMAGE_SIZE = 48; 73const RIGHT_CONTENT_NULL_LEFTWIDTH = '100%'; 74const RIGHT_CONTENT_NULL_RIGHTWIDTH = '0vp'; 75const LEFT_PART_WIDTH = 'calc(66% - 16vp)'; 76const RIGHT_PART_WIDTH = '34%'; 77const LEFT_ONLY_ARROW_WIDTH = 'calc(100% - 40vp)'; 78const RIGHT_ONLY_ARROW_WIDTH = '24vp'; 79const ACCESSIBILITY_LEVEL_NO = 'no'; 80const ICON_SIZE_MAP = new Map([ 81 [IconType.BADGE, BADGE_SIZE], 82 [IconType.NORMAL_ICON, SMALL_ICON_SIZE], 83 [IconType.SYSTEM_ICON, SYSTEM_ICON_SIZE], 84 [IconType.HEAD_SCULPTURE, HEADSCULPTURE_SIZE], 85 [IconType.APP_ICON, APP_ICON_SIZE], 86 [IconType.PREVIEW, PREVIEW_SIZE], 87 [IconType.LONGITUDINAL, LONGITUDINAL_SIZE], 88 [IconType.VERTICAL, VERTICAL_SIZE] 89]); 90 91class ContentItemStruct extends ViewPU { 92 constructor(a11, b11, c11, d11 = -1, e11 = undefined, f11) { 93 super(a11, c11, d11, f11); 94 if (typeof e11 === "function") { 95 this.paramsGenerator_ = e11; 96 } 97 this.__iconStyle = new SynchedPropertySimpleOneWayPU(b11.iconStyle, this, "iconStyle"); 98 this.__icon = new SynchedPropertyObjectOneWayPU(b11.icon, this, "icon"); 99 this.__primaryText = new SynchedPropertyObjectOneWayPU(b11.primaryText, this, "primaryText"); 100 this.__secondaryText = new SynchedPropertyObjectOneWayPU(b11.secondaryText, this, "secondaryText"); 101 this.__description = new SynchedPropertyObjectOneWayPU(b11.description, this, "description"); 102 this.__itemRowSpace = new ObservedPropertySimplePU(NORMAL_ITEM_ROW_SPACE, this, "itemRowSpace"); 103 this.__leftWidth = new SynchedPropertySimpleOneWayPU(b11.leftWidth, this, "leftWidth"); 104 this.__primaryTextColor = new ObservedPropertyObjectPU({ "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_text_primary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }, this, "primaryTextColor"); 105 this.__secondaryTextColor = new ObservedPropertyObjectPU({ "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_text_secondary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }, this, "secondaryTextColor"); 106 this.__descriptionColor = new ObservedPropertyObjectPU({ "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_text_secondary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }, this, "descriptionColor"); 107 this.__fontSizeScale = new SynchedPropertySimpleOneWayPU(b11.fontSizeScale, this, "fontSizeScale"); 108 this.__parentDirection = new SynchedPropertySimpleOneWayPU(b11.parentDirection, this, "parentDirection"); 109 this.__itemDirection = new SynchedPropertySimpleOneWayPU(b11.itemDirection, this, "itemDirection"); 110 this.setInitiallyProvidedValue(b11); 111 this.declareWatch("iconStyle", this.onPropChange); 112 this.declareWatch("icon", this.onPropChange); 113 this.declareWatch("primaryText", this.onPropChange); 114 this.declareWatch("secondaryText", this.onPropChange); 115 this.declareWatch("description", this.onPropChange); 116 this.finalizeConstruction(); 117 } 118 setInitiallyProvidedValue(z10) { 119 if (z10.iconStyle === undefined) { 120 this.__iconStyle.set(null); 121 } 122 if (z10.icon === undefined) { 123 this.__icon.set(null); 124 } 125 if (z10.primaryText === undefined) { 126 this.__primaryText.set(null); 127 } 128 if (z10.secondaryText === undefined) { 129 this.__secondaryText.set(null); 130 } 131 if (z10.description === undefined) { 132 this.__description.set(null); 133 } 134 if (z10.itemRowSpace !== undefined) { 135 this.itemRowSpace = z10.itemRowSpace; 136 } 137 if (z10.leftWidth === undefined) { 138 this.__leftWidth.set(LEFT_PART_WIDTH); 139 } 140 if (z10.primaryTextColor !== undefined) { 141 this.primaryTextColor = z10.primaryTextColor; 142 } 143 if (z10.secondaryTextColor !== undefined) { 144 this.secondaryTextColor = z10.secondaryTextColor; 145 } 146 if (z10.descriptionColor !== undefined) { 147 this.descriptionColor = z10.descriptionColor; 148 } 149 } 150 updateStateVars(y10) { 151 this.__iconStyle.reset(y10.iconStyle); 152 this.__icon.reset(y10.icon); 153 this.__primaryText.reset(y10.primaryText); 154 this.__secondaryText.reset(y10.secondaryText); 155 this.__description.reset(y10.description); 156 this.__leftWidth.reset(y10.leftWidth); 157 this.__fontSizeScale.reset(y10.fontSizeScale); 158 this.__parentDirection.reset(y10.parentDirection); 159 this.__itemDirection.reset(y10.itemDirection); 160 } 161 purgeVariableDependenciesOnElmtId(x10) { 162 this.__iconStyle.purgeDependencyOnElmtId(x10); 163 this.__icon.purgeDependencyOnElmtId(x10); 164 this.__primaryText.purgeDependencyOnElmtId(x10); 165 this.__secondaryText.purgeDependencyOnElmtId(x10); 166 this.__description.purgeDependencyOnElmtId(x10); 167 this.__itemRowSpace.purgeDependencyOnElmtId(x10); 168 this.__leftWidth.purgeDependencyOnElmtId(x10); 169 this.__primaryTextColor.purgeDependencyOnElmtId(x10); 170 this.__secondaryTextColor.purgeDependencyOnElmtId(x10); 171 this.__descriptionColor.purgeDependencyOnElmtId(x10); 172 this.__fontSizeScale.purgeDependencyOnElmtId(x10); 173 this.__parentDirection.purgeDependencyOnElmtId(x10); 174 this.__itemDirection.purgeDependencyOnElmtId(x10); 175 } 176 aboutToBeDeleted() { 177 this.__iconStyle.aboutToBeDeleted(); 178 this.__icon.aboutToBeDeleted(); 179 this.__primaryText.aboutToBeDeleted(); 180 this.__secondaryText.aboutToBeDeleted(); 181 this.__description.aboutToBeDeleted(); 182 this.__itemRowSpace.aboutToBeDeleted(); 183 this.__leftWidth.aboutToBeDeleted(); 184 this.__primaryTextColor.aboutToBeDeleted(); 185 this.__secondaryTextColor.aboutToBeDeleted(); 186 this.__descriptionColor.aboutToBeDeleted(); 187 this.__fontSizeScale.aboutToBeDeleted(); 188 this.__parentDirection.aboutToBeDeleted(); 189 this.__itemDirection.aboutToBeDeleted(); 190 SubscriberManager.Get().delete(this.id__()); 191 this.aboutToBeDeletedInternal(); 192 } 193 get iconStyle() { 194 return this.__iconStyle.get(); 195 } 196 set iconStyle(w10) { 197 this.__iconStyle.set(w10); 198 } 199 get icon() { 200 return this.__icon.get(); 201 } 202 set icon(v10) { 203 this.__icon.set(v10); 204 } 205 get primaryText() { 206 return this.__primaryText.get(); 207 } 208 set primaryText(u10) { 209 this.__primaryText.set(u10); 210 } 211 get secondaryText() { 212 return this.__secondaryText.get(); 213 } 214 set secondaryText(t10) { 215 this.__secondaryText.set(t10); 216 } 217 get description() { 218 return this.__description.get(); 219 } 220 set description(s10) { 221 this.__description.set(s10); 222 } 223 get itemRowSpace() { 224 return this.__itemRowSpace.get(); 225 } 226 set itemRowSpace(r10) { 227 this.__itemRowSpace.set(r10); 228 } 229 get leftWidth() { 230 return this.__leftWidth.get(); 231 } 232 set leftWidth(q10) { 233 this.__leftWidth.set(q10); 234 } 235 get primaryTextColor() { 236 return this.__primaryTextColor.get(); 237 } 238 set primaryTextColor(p10) { 239 this.__primaryTextColor.set(p10); 240 } 241 get secondaryTextColor() { 242 return this.__secondaryTextColor.get(); 243 } 244 set secondaryTextColor(o10) { 245 this.__secondaryTextColor.set(o10); 246 } 247 get descriptionColor() { 248 return this.__descriptionColor.get(); 249 } 250 set descriptionColor(n10) { 251 this.__descriptionColor.set(n10); 252 } 253 get fontSizeScale() { 254 return this.__fontSizeScale.get(); 255 } 256 set fontSizeScale(w11) { 257 this.__fontSizeScale.set(w11); 258 } 259 get parentDirection() { 260 return this.__parentDirection.get(); 261 } 262 set parentDirection(v11) { 263 this.__parentDirection.set(v11); 264 } 265 get itemDirection() { 266 return this.__itemDirection.get(); 267 } 268 set itemDirection(u11) { 269 this.__itemDirection.set(u11); 270 } 271 onWillApplyTheme(m10) { 272 this.primaryTextColor = m10.colors.fontPrimary; 273 this.secondaryTextColor = m10.colors.fontSecondary; 274 this.descriptionColor = m10.colors.fontTertiary; 275 } 276 onPropChange() { 277 if (this.icon == null && this.iconStyle == null) { 278 this.itemRowSpace = SPECIAL_ITEM_ROW_SPACE; 279 } 280 else { 281 this.itemRowSpace = NORMAL_ITEM_ROW_SPACE; 282 } 283 } 284 aboutToAppear() { 285 this.onPropChange(); 286 } 287 createIcon(v9 = null) { 288 this.observeComponentCreation2((x9, y9) => { 289 If.create(); 290 if (this.icon != null && this.iconStyle != null && ICON_SIZE_MAP.has(this.iconStyle)) { 291 this.ifElseBranchUpdateFunction(0, () => { 292 this.observeComponentCreation2((c10, d10) => { 293 If.create(); 294 if (this.iconStyle <= IconType.PREVIEW) { 295 this.ifElseBranchUpdateFunction(0, () => { 296 this.observeComponentCreation2((k10, l10) => { 297 Image.create(this.icon); 298 Image.objectFit(ImageFit.Contain); 299 Image.width(ICON_SIZE_MAP.get(this.iconStyle)); 300 Image.height(ICON_SIZE_MAP.get(this.iconStyle)); 301 Image.borderRadius({ "id": -1, "type": 10002, params: ['sys.float.ohos_id_corner_radius_default_m'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 302 Image.focusable(false); 303 Image.draggable(false); 304 Image.fillColor({ "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_secondary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 305 Image.flexShrink(0); 306 }, Image); 307 }); 308 } 309 else { 310 this.ifElseBranchUpdateFunction(1, () => { 311 this.observeComponentCreation2((g10, h10) => { 312 Image.create(this.icon); 313 Image.objectFit(ImageFit.Contain); 314 Image.constraintSize({ 315 minWidth: SPECIAL_ICON_SIZE, 316 maxWidth: ICON_SIZE_MAP.get(this.iconStyle), 317 minHeight: SPECIAL_ICON_SIZE, 318 maxHeight: ICON_SIZE_MAP.get(this.iconStyle) 319 }); 320 Image.borderRadius({ "id": -1, "type": 10002, params: ['sys.float.ohos_id_corner_radius_default_m'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 321 Image.focusable(false); 322 Image.draggable(false); 323 Image.fillColor({ "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_secondary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 324 Image.flexShrink(0); 325 }, Image); 326 }); 327 } 328 }, If); 329 If.pop(); 330 }); 331 } 332 else { 333 this.ifElseBranchUpdateFunction(1, () => { 334 }); 335 } 336 }, If); 337 If.pop(); 338 } 339 createText(y8 = null) { 340 this.observeComponentCreation2((t9, u9) => { 341 Column.create({ space: TEXT_COLUMN_SPACE }); 342 Column.flexShrink(1); 343 Column.margin(this.fontSizeScale >= FontSizeScaleLevel.LEVEL1 ? undefined : { 344 top: TEXT_SAFE_MARGIN, 345 bottom: TEXT_SAFE_MARGIN 346 }); 347 Column.alignItems(HorizontalAlign.Start); 348 }, Column); 349 this.observeComponentCreation2((r9, s9) => { 350 Text.create(this.primaryText); 351 Text.fontSize({ "id": -1, "type": 10002, params: ['sys.float.ohos_id_text_size_body1'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 352 Text.fontColor(ObservedObject.GetRawObject(this.primaryTextColor)); 353 Text.maxLines(TEXT_MAX_LINE); 354 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 355 Text.fontWeight(FontWeight.Medium); 356 Text.focusable(true); 357 Text.draggable(false); 358 Text.accessibilityLevel(ACCESSIBILITY_LEVEL_NO); 359 }, Text); 360 Text.pop(); 361 this.observeComponentCreation2((k9, l9) => { 362 If.create(); 363 if (this.secondaryText != null) { 364 this.ifElseBranchUpdateFunction(0, () => { 365 this.observeComponentCreation2((p9, q9) => { 366 Text.create(this.secondaryText); 367 Text.fontSize({ "id": -1, "type": 10002, params: ['sys.float.ohos_id_text_size_body2'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 368 Text.fontColor(ObservedObject.GetRawObject(this.secondaryTextColor)); 369 Text.maxLines(TEXT_MAX_LINE); 370 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 371 Text.draggable(false); 372 Text.accessibilityLevel(ACCESSIBILITY_LEVEL_NO); 373 }, Text); 374 Text.pop(); 375 }); 376 } 377 else { 378 this.ifElseBranchUpdateFunction(1, () => { 379 }); 380 } 381 }, If); 382 If.pop(); 383 this.observeComponentCreation2((d9, e9) => { 384 If.create(); 385 if (this.description != null) { 386 this.ifElseBranchUpdateFunction(0, () => { 387 this.observeComponentCreation2((i9, j9) => { 388 Text.create(this.description); 389 Text.fontSize({ "id": -1, "type": 10002, params: ['sys.float.ohos_id_text_size_body2'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 390 Text.fontColor(ObservedObject.GetRawObject(this.descriptionColor)); 391 Text.maxLines(TEXT_MAX_LINE); 392 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 393 Text.draggable(false); 394 Text.accessibilityLevel(ACCESSIBILITY_LEVEL_NO); 395 }, Text); 396 Text.pop(); 397 }); 398 } 399 else { 400 this.ifElseBranchUpdateFunction(1, () => { 401 }); 402 } 403 }, If); 404 If.pop(); 405 Column.pop(); 406 } 407 isColumnDirection() { 408 return this.itemDirection === FlexDirection.Column; 409 } 410 isParentColumnDirection() { 411 return this.parentDirection === FlexDirection.Column; 412 } 413 getItemSpace() { 414 if (this.isColumnDirection()) { 415 return LengthMetrics.resource({ "id": -1, "type": 10002, params: ['sys.float.padding_level1'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 416 } 417 return LengthMetrics.vp(this.itemRowSpace); 418 } 419 initialRender() { 420 this.observeComponentCreation2((w8, x8) => { 421 Flex.create({ 422 space: { main: this.getItemSpace() }, 423 direction: this.itemDirection, 424 justifyContent: FlexAlign.Start, 425 alignItems: this.isColumnDirection() ? ItemAlign.Start : ItemAlign.Center, 426 }); 427 Flex.margin({ 428 end: this.isParentColumnDirection() ? 429 LengthMetrics.vp(0) : 430 LengthMetrics.vp(16) 431 }); 432 Flex.padding({ start: LengthMetrics.vp(LISTITEM_PADDING) }); 433 Flex.width(this.isParentColumnDirection() ? undefined : this.leftWidth); 434 Flex.flexShrink(this.isParentColumnDirection() ? 0 : 1); 435 }, Flex); 436 this.createIcon.bind(this)(); 437 this.createText.bind(this)(); 438 Flex.pop(); 439 } 440 rerender() { 441 this.updateDirtyElements(); 442 } 443} 444class CreateIconParam { 445} 446 447class OperateItemStruct extends ViewPU { 448 constructor(p8, q8, r8, s8 = -1, t8 = undefined, u8) { 449 super(p8, r8, s8, u8); 450 if (typeof t8 === "function") { 451 this.paramsGenerator_ = t8; 452 } 453 this.__arrow = new SynchedPropertyObjectOneWayPU(q8.arrow, this, "arrow"); 454 this.__icon = new SynchedPropertyObjectOneWayPU(q8.icon, this, "icon"); 455 this.__subIcon = new SynchedPropertyObjectOneWayPU(q8.subIcon, this, "subIcon"); 456 this.__button = new SynchedPropertyObjectOneWayPU(q8.button, this, "button"); 457 this.__switch = new SynchedPropertyObjectOneWayPU(q8.switch, this, "switch"); 458 this.__checkBox = new SynchedPropertyObjectOneWayPU(q8.checkBox, this, "checkBox"); 459 this.__radio = new SynchedPropertyObjectOneWayPU(q8.radio, this, "radio"); 460 this.__image = new SynchedPropertyObjectOneWayPU(q8.image, this, "image"); 461 this.__text = new SynchedPropertyObjectOneWayPU(q8.text, this, "text"); 462 this.__switchState = new ObservedPropertySimplePU(false, this, "switchState"); 463 this.__radioState = new ObservedPropertySimplePU(false, this, "radioState"); 464 this.__checkBoxState = new ObservedPropertySimplePU(false, this, "checkBoxState"); 465 this.__rightWidth = new SynchedPropertySimpleOneWayPU(q8.rightWidth, this, "rightWidth"); 466 this.__secondaryTextColor = new ObservedPropertyObjectPU({ "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_text_secondary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }, this, "secondaryTextColor"); 467 this.__hoveringColor = new ObservedPropertyObjectPU('#0d000000', this, "hoveringColor"); 468 this.__activedColor = new ObservedPropertyObjectPU('#1a0a59f7', this, "activedColor"); 469 this.__parentCanFocus = new SynchedPropertySimpleTwoWayPU(q8.parentCanFocus, this, "parentCanFocus"); 470 this.__parentCanTouch = new SynchedPropertySimpleTwoWayPU(q8.parentCanTouch, this, "parentCanTouch"); 471 this.__parentIsHover = new SynchedPropertySimpleTwoWayPU(q8.parentIsHover, this, "parentIsHover"); 472 this.__parentCanHover = new SynchedPropertySimpleTwoWayPU(q8.parentCanHover, this, "parentCanHover"); 473 this.__parentIsActive = new SynchedPropertySimpleTwoWayPU(q8.parentIsActive, this, "parentIsActive"); 474 this.__parentFrontColor = new SynchedPropertyObjectTwoWayPU(q8.parentFrontColor, this, "parentFrontColor"); 475 this.__parentDirection = new SynchedPropertySimpleTwoWayPU(q8.parentDirection, this, "parentDirection"); 476 this.__rowSpace = new ObservedPropertySimplePU(DEFAULT_ROW_SPACE, this, "rowSpace"); 477 this.setInitiallyProvidedValue(q8); 478 this.declareWatch("arrow", this.onPropChange); 479 this.declareWatch("icon", this.onPropChange); 480 this.declareWatch("subIcon", this.onPropChange); 481 this.declareWatch("button", this.onPropChange); 482 this.declareWatch("switch", this.onPropChange); 483 this.declareWatch("checkBox", this.onPropChange); 484 this.declareWatch("radio", this.onPropChange); 485 this.declareWatch("image", this.onPropChange); 486 this.declareWatch("text", this.onPropChange); 487 this.finalizeConstruction(); 488 } 489 setInitiallyProvidedValue(o8) { 490 if (o8.arrow === undefined) { 491 this.__arrow.set(null); 492 } 493 if (o8.icon === undefined) { 494 this.__icon.set(null); 495 } 496 if (o8.subIcon === undefined) { 497 this.__subIcon.set(null); 498 } 499 if (o8.button === undefined) { 500 this.__button.set(null); 501 } 502 if (o8.switch === undefined) { 503 this.__switch.set(null); 504 } 505 if (o8.checkBox === undefined) { 506 this.__checkBox.set(null); 507 } 508 if (o8.radio === undefined) { 509 this.__radio.set(null); 510 } 511 if (o8.image === undefined) { 512 this.__image.set(null); 513 } 514 if (o8.text === undefined) { 515 this.__text.set(null); 516 } 517 if (o8.switchState !== undefined) { 518 this.switchState = o8.switchState; 519 } 520 if (o8.radioState !== undefined) { 521 this.radioState = o8.radioState; 522 } 523 if (o8.checkBoxState !== undefined) { 524 this.checkBoxState = o8.checkBoxState; 525 } 526 if (o8.rightWidth === undefined) { 527 this.__rightWidth.set(RIGHT_PART_WIDTH); 528 } 529 if (o8.secondaryTextColor !== undefined) { 530 this.secondaryTextColor = o8.secondaryTextColor; 531 } 532 if (o8.hoveringColor !== undefined) { 533 this.hoveringColor = o8.hoveringColor; 534 } 535 if (o8.activedColor !== undefined) { 536 this.activedColor = o8.activedColor; 537 } 538 if (o8.rowSpace !== undefined) { 539 this.rowSpace = o8.rowSpace; 540 } 541 } 542 updateStateVars(n8) { 543 this.__arrow.reset(n8.arrow); 544 this.__icon.reset(n8.icon); 545 this.__subIcon.reset(n8.subIcon); 546 this.__button.reset(n8.button); 547 this.__switch.reset(n8.switch); 548 this.__checkBox.reset(n8.checkBox); 549 this.__radio.reset(n8.radio); 550 this.__image.reset(n8.image); 551 this.__text.reset(n8.text); 552 this.__rightWidth.reset(n8.rightWidth); 553 } 554 purgeVariableDependenciesOnElmtId(m8) { 555 this.__arrow.purgeDependencyOnElmtId(m8); 556 this.__icon.purgeDependencyOnElmtId(m8); 557 this.__subIcon.purgeDependencyOnElmtId(m8); 558 this.__button.purgeDependencyOnElmtId(m8); 559 this.__switch.purgeDependencyOnElmtId(m8); 560 this.__checkBox.purgeDependencyOnElmtId(m8); 561 this.__radio.purgeDependencyOnElmtId(m8); 562 this.__image.purgeDependencyOnElmtId(m8); 563 this.__text.purgeDependencyOnElmtId(m8); 564 this.__switchState.purgeDependencyOnElmtId(m8); 565 this.__radioState.purgeDependencyOnElmtId(m8); 566 this.__checkBoxState.purgeDependencyOnElmtId(m8); 567 this.__rightWidth.purgeDependencyOnElmtId(m8); 568 this.__secondaryTextColor.purgeDependencyOnElmtId(m8); 569 this.__hoveringColor.purgeDependencyOnElmtId(m8); 570 this.__activedColor.purgeDependencyOnElmtId(m8); 571 this.__parentCanFocus.purgeDependencyOnElmtId(m8); 572 this.__parentCanTouch.purgeDependencyOnElmtId(m8); 573 this.__parentIsHover.purgeDependencyOnElmtId(m8); 574 this.__parentCanHover.purgeDependencyOnElmtId(m8); 575 this.__parentIsActive.purgeDependencyOnElmtId(m8); 576 this.__parentFrontColor.purgeDependencyOnElmtId(m8); 577 this.__parentDirection.purgeDependencyOnElmtId(m8); 578 this.__rowSpace.purgeDependencyOnElmtId(m8); 579 } 580 aboutToBeDeleted() { 581 this.__arrow.aboutToBeDeleted(); 582 this.__icon.aboutToBeDeleted(); 583 this.__subIcon.aboutToBeDeleted(); 584 this.__button.aboutToBeDeleted(); 585 this.__switch.aboutToBeDeleted(); 586 this.__checkBox.aboutToBeDeleted(); 587 this.__radio.aboutToBeDeleted(); 588 this.__image.aboutToBeDeleted(); 589 this.__text.aboutToBeDeleted(); 590 this.__switchState.aboutToBeDeleted(); 591 this.__radioState.aboutToBeDeleted(); 592 this.__checkBoxState.aboutToBeDeleted(); 593 this.__rightWidth.aboutToBeDeleted(); 594 this.__secondaryTextColor.aboutToBeDeleted(); 595 this.__hoveringColor.aboutToBeDeleted(); 596 this.__activedColor.aboutToBeDeleted(); 597 this.__parentCanFocus.aboutToBeDeleted(); 598 this.__parentCanTouch.aboutToBeDeleted(); 599 this.__parentIsHover.aboutToBeDeleted(); 600 this.__parentCanHover.aboutToBeDeleted(); 601 this.__parentIsActive.aboutToBeDeleted(); 602 this.__parentFrontColor.aboutToBeDeleted(); 603 this.__parentDirection.aboutToBeDeleted(); 604 this.__rowSpace.aboutToBeDeleted(); 605 SubscriberManager.Get().delete(this.id__()); 606 this.aboutToBeDeletedInternal(); 607 } 608 get arrow() { 609 return this.__arrow.get(); 610 } 611 set arrow(l8) { 612 this.__arrow.set(l8); 613 } 614 get icon() { 615 return this.__icon.get(); 616 } 617 set icon(k8) { 618 this.__icon.set(k8); 619 } 620 get subIcon() { 621 return this.__subIcon.get(); 622 } 623 set subIcon(j8) { 624 this.__subIcon.set(j8); 625 } 626 get button() { 627 return this.__button.get(); 628 } 629 set button(i8) { 630 this.__button.set(i8); 631 } 632 get switch() { 633 return this.__switch.get(); 634 } 635 set switch(h8) { 636 this.__switch.set(h8); 637 } 638 get checkBox() { 639 return this.__checkBox.get(); 640 } 641 set checkBox(g8) { 642 this.__checkBox.set(g8); 643 } 644 get radio() { 645 return this.__radio.get(); 646 } 647 set radio(f8) { 648 this.__radio.set(f8); 649 } 650 get image() { 651 return this.__image.get(); 652 } 653 set image(e8) { 654 this.__image.set(e8); 655 } 656 get text() { 657 return this.__text.get(); 658 } 659 set text(d8) { 660 this.__text.set(d8); 661 } 662 get switchState() { 663 return this.__switchState.get(); 664 } 665 set switchState(c8) { 666 this.__switchState.set(c8); 667 } 668 get radioState() { 669 return this.__radioState.get(); 670 } 671 set radioState(b8) { 672 this.__radioState.set(b8); 673 } 674 get checkBoxState() { 675 return this.__checkBoxState.get(); 676 } 677 set checkBoxState(a8) { 678 this.__checkBoxState.set(a8); 679 } 680 get rightWidth() { 681 return this.__rightWidth.get(); 682 } 683 set rightWidth(z7) { 684 this.__rightWidth.set(z7); 685 } 686 get secondaryTextColor() { 687 return this.__secondaryTextColor.get(); 688 } 689 set secondaryTextColor(y7) { 690 this.__secondaryTextColor.set(y7); 691 } 692 get hoveringColor() { 693 return this.__hoveringColor.get(); 694 } 695 set hoveringColor(x7) { 696 this.__hoveringColor.set(x7); 697 } 698 get activedColor() { 699 return this.__activedColor.get(); 700 } 701 set activedColor(w7) { 702 this.__activedColor.set(w7); 703 } 704 get parentCanFocus() { 705 return this.__parentCanFocus.get(); 706 } 707 set parentCanFocus(v7) { 708 this.__parentCanFocus.set(v7); 709 } 710 get parentCanTouch() { 711 return this.__parentCanTouch.get(); 712 } 713 set parentCanTouch(u7) { 714 this.__parentCanTouch.set(u7); 715 } 716 get parentIsHover() { 717 return this.__parentIsHover.get(); 718 } 719 set parentIsHover(t7) { 720 this.__parentIsHover.set(t7); 721 } 722 get parentCanHover() { 723 return this.__parentCanHover.get(); 724 } 725 set parentCanHover(s7) { 726 this.__parentCanHover.set(s7); 727 } 728 get parentIsActive() { 729 return this.__parentIsActive.get(); 730 } 731 set parentIsActive(r7) { 732 this.__parentIsActive.set(r7); 733 } 734 get parentFrontColor() { 735 return this.__parentFrontColor.get(); 736 } 737 set parentFrontColor(q7) { 738 this.__parentFrontColor.set(q7); 739 } 740 get parentDirection() { 741 return this.__parentDirection.get(); 742 } 743 set parentDirection(t11) { 744 this.__parentDirection.set(t11); 745 } 746 get rowSpace() { 747 return this.__rowSpace.get(); 748 } 749 set rowSpace(p7) { 750 this.__rowSpace.set(p7); 751 } 752 onWillApplyTheme(o7) { 753 this.secondaryTextColor = o7.colors.fontSecondary; 754 this.hoveringColor = o7.colors.interactiveHover; 755 this.activedColor = o7.colors.interactiveActive; 756 } 757 onPropChange() { 758 if (this.switch != null) { 759 this.switchState = this.switch.isCheck; 760 } 761 if (this.radio != null) { 762 this.radioState = this.radio.isCheck; 763 } 764 if (this.checkBox != null) { 765 this.checkBoxState = this.checkBox.isCheck; 766 } 767 if ((this.button == null && this.image == null && this.icon != null && this.text != null) || 768 (this.button == null && this.image == null && this.icon == null && this.arrow != null && this.text != null)) { 769 this.rowSpace = SPECICAL_ROW_SPACE; 770 } 771 else { 772 this.rowSpace = DEFAULT_ROW_SPACE; 773 } 774 } 775 aboutToAppear() { 776 this.onPropChange(); 777 } 778 createButton(z6 = null) { 779 this.observeComponentCreation2((h7, i7) => { 780 Button.createWithChild(); 781 Button.padding({ top: 0, bottom: 0 }); 782 Button.margin({ end: LengthMetrics.vp(LISTITEM_PADDING) }); 783 Button.hitTestBehavior(HitTestMode.Block); 784 Button.fontSize({ "id": -1, "type": 10002, params: ['sys.float.ohos_id_text_size_button3'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 785 Button.fontColor({ "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_text_primary_activated_transparent'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 786 Button.constraintSize({ 787 minHeight: BUTTON_SIZE 788 }); 789 Button.backgroundColor({ "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_button_normal'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 790 Button.labelStyle({ 791 maxLines: TEXT_MAX_LINE 792 }); 793 Button.onFocus(() => { 794 this.parentCanFocus = false; 795 }); 796 Button.onHover((c1) => { 797 this.parentCanHover = false; 798 if (c1 && this.parentFrontColor === this.hoveringColor) { 799 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 800 } 801 if (!c1) { 802 this.parentCanHover = true; 803 if (this.parentIsHover) { 804 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 805 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 806 } 807 } 808 }); 809 }, Button); 810 this.observeComponentCreation2((f7, g7) => { 811 Row.create(); 812 Row.padding({ 813 left: TEXT_SAFE_MARGIN, 814 right: TEXT_SAFE_MARGIN 815 }); 816 }, Row); 817 this.observeComponentCreation2((d7, e7) => { 818 Text.create(this.button?.text); 819 Text.focusable(true); 820 }, Text); 821 Text.pop(); 822 Row.pop(); 823 Button.pop(); 824 } 825 createIcon(m6, n6 = null) { 826 this.observeComponentCreation2((s6, t6) => { 827 Button.createWithChild({ type: ButtonType.Normal }); 828 Button.hitTestBehavior(HitTestMode.Block); 829 Button.backgroundColor(Color.Transparent); 830 Button.height(OPERATEITEM_ICON_CLICKABLE_SIZE); 831 Button.width(OPERATEITEM_ICON_CLICKABLE_SIZE); 832 Button.borderRadius({ "id": -1, "type": 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 833 Button.onFocus(() => { 834 this.parentCanFocus = false; 835 }); 836 Button.onHover((x6) => { 837 this.parentCanHover = false; 838 if (x6 && this.parentFrontColor === this.hoveringColor) { 839 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 840 } 841 if (!x6) { 842 this.parentCanHover = true; 843 if (this.parentIsHover) { 844 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 845 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 846 } 847 } 848 }); 849 Button.onClick(m6.icon?.action); 850 Button.flexShrink(0); 851 }, Button); 852 this.observeComponentCreation2((q6, r6) => { 853 Image.create(m6.icon?.value); 854 Image.height(OPERATEITEM_ICONLIKE_SIZE); 855 Image.width(OPERATEITEM_ICONLIKE_SIZE); 856 Image.focusable(true); 857 Image.fillColor({ "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_primary'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 858 Image.draggable(false); 859 }, Image); 860 Button.pop(); 861 } 862 createImage(i6 = null) { 863 this.observeComponentCreation2((k6, l6) => { 864 Image.create(this.image); 865 Image.height(OPERATEITEM_IMAGE_SIZE); 866 Image.width(OPERATEITEM_IMAGE_SIZE); 867 Image.draggable(false); 868 Image.margin({ end: LengthMetrics.vp(LISTITEM_PADDING) }); 869 }, Image); 870 } 871 createText(e6 = null) { 872 this.observeComponentCreation2((g6, h6) => { 873 Text.create(this.text); 874 Text.margin({ end: LengthMetrics.vp(LISTITEM_PADDING) }); 875 Text.fontSize({ "id": -1, "type": 10002, params: ['sys.float.ohos_id_text_size_body2'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 876 Text.fontColor(ObservedObject.GetRawObject(this.secondaryTextColor)); 877 Text.draggable(false); 878 Text.flexShrink(1); 879 Text.accessibilityLevel(ACCESSIBILITY_LEVEL_NO); 880 }, Text); 881 Text.pop(); 882 } 883 createArrow(s5 = null) { 884 this.observeComponentCreation2((x5, y5) => { 885 Button.createWithChild({ type: ButtonType.Normal }); 886 Button.margin({ end: LengthMetrics.vp(LISTITEM_PADDING) }); 887 Button.hitTestBehavior(this.arrow?.action !== undefined ? HitTestMode.Block : HitTestMode.Transparent); 888 Button.backgroundColor(Color.Transparent); 889 Button.height(OPERATEITEM_ICONLIKE_SIZE); 890 Button.width(OPERATEITEM_ARROW_WIDTH); 891 Button.onFocus(() => { 892 this.parentCanFocus = false; 893 }); 894 Button.stateEffect(this.arrow?.action !== undefined); 895 Button.hoverEffect(this.arrow?.action !== undefined ? HoverEffect.Auto : HoverEffect.None); 896 Button.onHover((c6) => { 897 if (this.arrow?.action === undefined) { 898 return; 899 } 900 this.parentCanHover = false; 901 if (c6) { 902 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 903 } 904 if (!c6) { 905 this.parentCanHover = true; 906 if (this.parentIsHover) { 907 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 908 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 909 } 910 } 911 }); 912 Button.onClick(this.arrow?.action); 913 }, Button); 914 this.observeComponentCreation2((v5, w5) => { 915 Image.create(this.arrow?.value); 916 Image.height(OPERATEITEM_ICONLIKE_SIZE); 917 Image.width(OPERATEITEM_ARROW_WIDTH); 918 Image.focusable(true); 919 Image.fillColor({ "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_fourth'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 920 Image.draggable(false); 921 Image.matchTextDirection(true); 922 }, Image); 923 Button.pop(); 924 } 925 createRadio(j5 = null) { 926 this.observeComponentCreation2((l5, m5) => { 927 Radio.create({ value: '', group: '' }); 928 Radio.margin({ end: LengthMetrics.vp(LISTITEM_PADDING) }); 929 Radio.checked(this.radioState); 930 Radio.onChange(this.radio?.onChange); 931 Radio.height(OPERATEITEM_ICONLIKE_SIZE); 932 Radio.width(OPERATEITEM_ICONLIKE_SIZE); 933 Radio.padding(OPERATEITEM_SELECTIONBOX_PADDING_SIZE); 934 Radio.onFocus(() => { 935 this.parentCanFocus = false; 936 }); 937 Radio.hitTestBehavior(HitTestMode.Block); 938 Radio.onHover((q5) => { 939 this.parentCanHover = false; 940 if (q5 && this.parentFrontColor === this.hoveringColor) { 941 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 942 } 943 if (!q5) { 944 this.parentCanHover = true; 945 if (this.parentIsHover) { 946 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 947 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 948 } 949 } 950 }); 951 }, Radio); 952 } 953 createCheckBox(a5 = null) { 954 this.observeComponentCreation2((c5, d5) => { 955 Checkbox.create(); 956 Checkbox.margin({ end: LengthMetrics.vp(LISTITEM_PADDING) }); 957 Checkbox.select(this.checkBoxState); 958 Checkbox.onChange(this.checkBox?.onChange); 959 Checkbox.height(OPERATEITEM_ICONLIKE_SIZE); 960 Checkbox.width(OPERATEITEM_ICONLIKE_SIZE); 961 Checkbox.padding(OPERATEITEM_SELECTIONBOX_PADDING_SIZE); 962 Checkbox.onFocus(() => { 963 this.parentCanFocus = false; 964 }); 965 Checkbox.hitTestBehavior(HitTestMode.Block); 966 Checkbox.onHover((h5) => { 967 this.parentCanHover = false; 968 if (h5 && this.parentFrontColor === this.hoveringColor) { 969 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 970 } 971 if (!h5) { 972 this.parentCanHover = true; 973 if (this.parentIsHover) { 974 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 975 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 976 } 977 } 978 }); 979 }, Checkbox); 980 Checkbox.pop(); 981 } 982 createSwitch(n4 = null) { 983 this.observeComponentCreation2((t4, u4) => { 984 Row.create(); 985 Row.margin({ end: LengthMetrics.vp(SWITCH_PADDING) }); 986 Row.height(OPERATEITEM_ICON_CLICKABLE_SIZE); 987 Row.width(OPERATEITEM_ICON_CLICKABLE_SIZE); 988 Row.justifyContent(FlexAlign.Center); 989 Row.onFocus(() => { 990 this.parentCanFocus = false; 991 }); 992 Row.onHover((y4) => { 993 this.parentCanHover = false; 994 if (y4 && this.parentFrontColor === this.hoveringColor) { 995 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 996 } 997 if (!y4) { 998 this.parentCanHover = true; 999 if (this.parentIsHover) { 1000 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 1001 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 1002 } 1003 } 1004 }); 1005 }, Row); 1006 this.observeComponentCreation2((q4, r4) => { 1007 Toggle.create({ type: ToggleType.Switch, isOn: this.switchState }); 1008 Toggle.onChange(this.switch?.onChange); 1009 Toggle.onClick(() => { 1010 this.switchState = !this.switchState; 1011 }); 1012 Toggle.hitTestBehavior(HitTestMode.Block); 1013 }, Toggle); 1014 Toggle.pop(); 1015 Row.pop(); 1016 } 1017 createTextArrow(v3 = null) { 1018 this.observeComponentCreation2((g4, h4) => { 1019 Button.createWithChild({ type: ButtonType.Normal }); 1020 Button.hitTestBehavior(this.arrow?.action !== undefined ? HitTestMode.Block : HitTestMode.Transparent); 1021 Button.labelStyle({ 1022 maxLines: TEXT_MAX_LINE 1023 }); 1024 Button.backgroundColor(Color.Transparent); 1025 Button.constraintSize({ minHeight: TEXT_ARROW_HEIGHT }); 1026 Button.borderRadius({ "id": -1, "type": 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 1027 Button.onFocus(() => { 1028 this.parentCanFocus = false; 1029 }); 1030 Button.padding({ 1031 top: 0, 1032 bottom: 0, 1033 left: 0, 1034 right: 0 1035 }); 1036 Button.stateEffect(this.arrow?.action !== undefined); 1037 Button.hoverEffect(this.arrow?.action !== undefined ? HoverEffect.Auto : HoverEffect.None); 1038 Button.onHover((a1) => { 1039 if (this.arrow?.action === undefined) { 1040 return; 1041 } 1042 this.parentCanHover = false; 1043 if (a1) { 1044 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 1045 } 1046 if (!a1) { 1047 this.parentCanHover = true; 1048 if (this.parentIsHover) { 1049 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 1050 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 1051 } 1052 } 1053 }); 1054 Button.onClick(this.arrow?.action); 1055 }, Button); 1056 this.observeComponentCreation2((e4, f4) => { 1057 If.create(); 1058 if (this.parentDirection === FlexDirection.Column) { 1059 this.ifElseBranchUpdateFunction(0, () => { 1060 this.observeComponentCreation2((n11, o11) => { 1061 Flex.create({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }); 1062 Flex.padding({ 1063 start: LengthMetrics.vp(TEXT_SAFE_MARGIN), 1064 end: LengthMetrics.vp(LISTITEM_PADDING) 1065 }); 1066 }, Flex); 1067 this.observeComponentCreation2((l11, m11) => { 1068 Text.create(this.text); 1069 Text.fontSize({ "id": -1, "type": 10002, params: ['sys.float.ohos_id_text_size_body2'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 1070 Text.fontColor(ObservedObject.GetRawObject(this.secondaryTextColor)); 1071 Text.focusable(true); 1072 Text.draggable(false); 1073 Text.constraintSize({ 1074 maxWidth: `calc(100% - ${OPERATEITEM_ARROW_WIDTH}vp)` 1075 }); 1076 Text.accessibilityLevel(ACCESSIBILITY_LEVEL_NO); 1077 }, Text); 1078 Text.pop(); 1079 this.observeComponentCreation2((j11, k11) => { 1080 Image.create(this.arrow?.value); 1081 Image.height(OPERATEITEM_ICONLIKE_SIZE); 1082 Image.width(OPERATEITEM_ARROW_WIDTH); 1083 Image.fillColor({ "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_fourth'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 1084 Image.focusable(false); 1085 Image.draggable(false); 1086 Image.matchTextDirection(true); 1087 }, Image); 1088 Flex.pop(); 1089 }); 1090 } 1091 else { 1092 this.ifElseBranchUpdateFunction(1, () => { 1093 this.observeComponentCreation2((b7, j7) => { 1094 Row.create({ space: SPECICAL_ROW_SPACE }); 1095 Row.padding({ 1096 start: LengthMetrics.vp(TEXT_SAFE_MARGIN), 1097 end: LengthMetrics.vp(LISTITEM_PADDING) 1098 }); 1099 }, Row); 1100 this.observeComponentCreation2((v6, a7) => { 1101 Text.create(this.text); 1102 Text.fontSize({ "id": -1, "type": 10002, params: ['sys.float.ohos_id_text_size_body2'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 1103 Text.fontColor(ObservedObject.GetRawObject(this.secondaryTextColor)); 1104 Text.focusable(true); 1105 Text.draggable(false); 1106 Text.constraintSize({ 1107 maxWidth: `calc(100% - ${OPERATEITEM_ARROW_WIDTH}vp)` 1108 }); 1109 Text.accessibilityLevel(ACCESSIBILITY_LEVEL_NO); 1110 }, Text); 1111 Text.pop(); 1112 this.observeComponentCreation2((o6, u6) => { 1113 Image.create(this.arrow?.value); 1114 Image.height(OPERATEITEM_ICONLIKE_SIZE); 1115 Image.width(OPERATEITEM_ARROW_WIDTH); 1116 Image.fillColor({ "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_fourth'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 1117 Image.focusable(false); 1118 Image.draggable(false); 1119 Image.matchTextDirection(true); 1120 }, Image); 1121 Row.pop(); 1122 }); 1123 } 1124 }, If); 1125 If.pop(); 1126 Button.pop(); 1127 } 1128 getFlexOptions() { 1129 let n5 = { alignItems: ItemAlign.Center }; 1130 if (this.parentDirection === FlexDirection.Column) { 1131 n5.justifyContent = FlexAlign.SpaceBetween; 1132 } 1133 else { 1134 n5.space = { main: LengthMetrics.vp(this.rowSpace) }; 1135 n5.justifyContent = FlexAlign.End; 1136 } 1137 return n5; 1138 } 1139 initialRender() { 1140 this.observeComponentCreation2((t3, u3) => { 1141 Flex.create(this.getFlexOptions()); 1142 Flex.width(this.parentDirection === FlexDirection.Column ? undefined : this.rightWidth); 1143 }, Flex); 1144 this.observeComponentCreation2((b3, c3) => { 1145 If.create(); 1146 if (this.button != null) { 1147 this.ifElseBranchUpdateFunction(0, () => { 1148 this.createButton.bind(this)(); 1149 }); 1150 } 1151 else if (this.image != null) { 1152 this.ifElseBranchUpdateFunction(1, () => { 1153 this.createImage.bind(this)(); 1154 }); 1155 } 1156 else if (this.icon != null && this.text != null) { 1157 this.ifElseBranchUpdateFunction(2, () => { 1158 this.createText.bind(this)(); 1159 this.createIcon.bind(this)(makeBuilderParameterProxy("createIcon", { icon: () => (this["__icon"] ? this["__icon"] : this["icon"]) })); 1160 }); 1161 } 1162 else if (this.arrow != null && this.text == null) { 1163 this.ifElseBranchUpdateFunction(3, () => { 1164 this.createArrow.bind(this)(); 1165 }); 1166 } 1167 else if (this.arrow != null && this.text != null) { 1168 this.ifElseBranchUpdateFunction(4, () => { 1169 this.createTextArrow.bind(this)(); 1170 }); 1171 } 1172 else if (this.text != null) { 1173 this.ifElseBranchUpdateFunction(5, () => { 1174 this.createText.bind(this)(); 1175 }); 1176 } 1177 else if (this.radio != null) { 1178 this.ifElseBranchUpdateFunction(6, () => { 1179 this.createRadio.bind(this)(); 1180 }); 1181 } 1182 else if (this.checkBox != null) { 1183 this.ifElseBranchUpdateFunction(7, () => { 1184 this.createCheckBox.bind(this)(); 1185 }); 1186 } 1187 else if (this.switch != null) { 1188 this.ifElseBranchUpdateFunction(8, () => { 1189 this.createSwitch.bind(this)(); 1190 }); 1191 } 1192 else if (this.icon != null) { 1193 this.ifElseBranchUpdateFunction(9, () => { 1194 this.createIcon.bind(this)(makeBuilderParameterProxy("createIcon", { icon: () => (this["__icon"] ? this["__icon"] : this["icon"]) })); 1195 this.observeComponentCreation2((g3, h3) => { 1196 If.create(); 1197 if (this.subIcon != null) { 1198 this.ifElseBranchUpdateFunction(0, () => { 1199 this.createIcon.bind(this)(makeBuilderParameterProxy("createIcon", { icon: () => (this["__subIcon"] ? this["__subIcon"] : this["subIcon"]) })); 1200 }); 1201 } 1202 else { 1203 this.ifElseBranchUpdateFunction(1, () => { 1204 }); 1205 } 1206 }, If); 1207 If.pop(); 1208 }); 1209 } 1210 else { 1211 this.ifElseBranchUpdateFunction(10, () => { 1212 }); 1213 } 1214 }, If); 1215 If.pop(); 1216 Flex.pop(); 1217 } 1218 rerender() { 1219 this.updateDirtyElements(); 1220 } 1221} 1222export class ComposeListItem extends ViewPU { 1223 constructor(t2, u2, v2, w2 = -1, x2 = undefined, y2) { 1224 super(t2, v2, w2, y2); 1225 if (typeof x2 === "function") { 1226 this.paramsGenerator_ = x2; 1227 } 1228 this.__contentItem = new SynchedPropertyObjectOneWayPU(u2.contentItem, this, "contentItem"); 1229 this.__operateItem = new SynchedPropertyObjectOneWayPU(u2.operateItem, this, "operateItem"); 1230 this.__frontColor = new ObservedPropertyObjectPU(Color.Transparent.toString(), this, "frontColor"); 1231 this.__borderSize = new ObservedPropertySimplePU(0, this, "borderSize"); 1232 this.__canFocus = new ObservedPropertySimplePU(false, this, "canFocus"); 1233 this.__canTouch = new ObservedPropertySimplePU(true, this, "canTouch"); 1234 this.__canHover = new ObservedPropertySimplePU(true, this, "canHover"); 1235 this.__isHover = new ObservedPropertySimplePU(true, this, "isHover"); 1236 this.__itemHeight = new ObservedPropertySimplePU(ItemHeight.FIRST_HEIGHT, this, "itemHeight"); 1237 this.__isActive = new ObservedPropertySimplePU(false, this, "isActive"); 1238 this.__hoveringColor = new ObservedPropertyObjectPU('#0d000000', this, "hoveringColor"); 1239 this.__touchDownColor = new ObservedPropertyObjectPU('#1a000000', this, "touchDownColor"); 1240 this.__activedColor = new ObservedPropertyObjectPU('#1a0a59f7', this, "activedColor"); 1241 this.__focusOutlineColor = new ObservedPropertyObjectPU({ "id": -1, "type": 10001, params: ['sys.color.ohos_id_color_focused_outline'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }, this, "focusOutlineColor"); 1242 this.__fontSizeScale = new ObservedPropertySimplePU(1, this, "fontSizeScale"); 1243 this.__containerDirection = new ObservedPropertySimplePU(FlexDirection.Row, this, "containerDirection"); 1244 this.__contentItemDirection = new ObservedPropertySimplePU(FlexDirection.Row, this, "contentItemDirection"); 1245 this.__containerPadding = new ObservedPropertyObjectPU(undefined, this, "containerPadding"); 1246 this.__textArrowLeftSafeOffset = new ObservedPropertySimplePU(0, this, "textArrowLeftSafeOffset"); 1247 this.isFollowingSystemFontScale = this.getUIContext().isFollowingSystemFontScale(); 1248 this.maxFontScale = this.getUIContext().getMaxFontScale(); 1249 this.__accessibilityTextBuilder = new ObservedPropertySimplePU('', this, "accessibilityTextBuilder"); 1250 this.setInitiallyProvidedValue(u2); 1251 this.declareWatch("contentItem", this.onPropChange); 1252 this.declareWatch("operateItem", this.onPropChange); 1253 this.declareWatch("fontSizeScale", this.onFontSizeScaleChange); 1254 this.finalizeConstruction(); 1255 } 1256 setInitiallyProvidedValue(s2) { 1257 if (s2.contentItem === undefined) { 1258 this.__contentItem.set(null); 1259 } 1260 if (s2.operateItem === undefined) { 1261 this.__operateItem.set(null); 1262 } 1263 if (s2.frontColor !== undefined) { 1264 this.frontColor = s2.frontColor; 1265 } 1266 if (s2.borderSize !== undefined) { 1267 this.borderSize = s2.borderSize; 1268 } 1269 if (s2.canFocus !== undefined) { 1270 this.canFocus = s2.canFocus; 1271 } 1272 if (s2.canTouch !== undefined) { 1273 this.canTouch = s2.canTouch; 1274 } 1275 if (s2.canHover !== undefined) { 1276 this.canHover = s2.canHover; 1277 } 1278 if (s2.isHover !== undefined) { 1279 this.isHover = s2.isHover; 1280 } 1281 if (s2.itemHeight !== undefined) { 1282 this.itemHeight = s2.itemHeight; 1283 } 1284 if (s2.isActive !== undefined) { 1285 this.isActive = s2.isActive; 1286 } 1287 if (s2.hoveringColor !== undefined) { 1288 this.hoveringColor = s2.hoveringColor; 1289 } 1290 if (s2.touchDownColor !== undefined) { 1291 this.touchDownColor = s2.touchDownColor; 1292 } 1293 if (s2.activedColor !== undefined) { 1294 this.activedColor = s2.activedColor; 1295 } 1296 if (s2.focusOutlineColor !== undefined) { 1297 this.focusOutlineColor = s2.focusOutlineColor; 1298 } 1299 if (s2.fontSizeScale !== undefined) { 1300 this.fontSizeScale = s2.fontSizeScale; 1301 } 1302 if (s2.containerDirection !== undefined) { 1303 this.containerDirection = s2.containerDirection; 1304 } 1305 if (s2.contentItemDirection !== undefined) { 1306 this.contentItemDirection = s2.contentItemDirection; 1307 } 1308 if (s2.containerPadding !== undefined) { 1309 this.containerPadding = s2.containerPadding; 1310 } 1311 if (s2.textArrowLeftSafeOffset !== undefined) { 1312 this.textArrowLeftSafeOffset = s2.textArrowLeftSafeOffset; 1313 } 1314 if (s2.isFollowingSystemFontScale !== undefined) { 1315 this.isFollowingSystemFontScale = s2.isFollowingSystemFontScale; 1316 } 1317 if (s2.maxFontScale !== undefined) { 1318 this.maxFontScale = s2.maxFontScale; 1319 } 1320 if (s2.accessibilityTextBuilder !== undefined) { 1321 this.accessibilityTextBuilder = s2.accessibilityTextBuilder; 1322 } 1323 } 1324 updateStateVars(r2) { 1325 this.__contentItem.reset(r2.contentItem); 1326 this.__operateItem.reset(r2.operateItem); 1327 } 1328 purgeVariableDependenciesOnElmtId(q2) { 1329 this.__contentItem.purgeDependencyOnElmtId(q2); 1330 this.__operateItem.purgeDependencyOnElmtId(q2); 1331 this.__frontColor.purgeDependencyOnElmtId(q2); 1332 this.__borderSize.purgeDependencyOnElmtId(q2); 1333 this.__canFocus.purgeDependencyOnElmtId(q2); 1334 this.__canTouch.purgeDependencyOnElmtId(q2); 1335 this.__canHover.purgeDependencyOnElmtId(q2); 1336 this.__isHover.purgeDependencyOnElmtId(q2); 1337 this.__itemHeight.purgeDependencyOnElmtId(q2); 1338 this.__isActive.purgeDependencyOnElmtId(q2); 1339 this.__hoveringColor.purgeDependencyOnElmtId(q2); 1340 this.__touchDownColor.purgeDependencyOnElmtId(q2); 1341 this.__activedColor.purgeDependencyOnElmtId(q2); 1342 this.__focusOutlineColor.purgeDependencyOnElmtId(q2); 1343 this.__fontSizeScale.purgeDependencyOnElmtId(q2); 1344 this.__containerDirection.purgeDependencyOnElmtId(q2); 1345 this.__contentItemDirection.purgeDependencyOnElmtId(q2); 1346 this.__containerPadding.purgeDependencyOnElmtId(q2); 1347 this.__textArrowLeftSafeOffset.purgeDependencyOnElmtId(q2); 1348 this.__accessibilityTextBuilder.purgeDependencyOnElmtId(q2); 1349 } 1350 aboutToBeDeleted() { 1351 this.__contentItem.aboutToBeDeleted(); 1352 this.__operateItem.aboutToBeDeleted(); 1353 this.__frontColor.aboutToBeDeleted(); 1354 this.__borderSize.aboutToBeDeleted(); 1355 this.__canFocus.aboutToBeDeleted(); 1356 this.__canTouch.aboutToBeDeleted(); 1357 this.__canHover.aboutToBeDeleted(); 1358 this.__isHover.aboutToBeDeleted(); 1359 this.__itemHeight.aboutToBeDeleted(); 1360 this.__isActive.aboutToBeDeleted(); 1361 this.__hoveringColor.aboutToBeDeleted(); 1362 this.__touchDownColor.aboutToBeDeleted(); 1363 this.__activedColor.aboutToBeDeleted(); 1364 this.__focusOutlineColor.aboutToBeDeleted(); 1365 this.__fontSizeScale.aboutToBeDeleted(); 1366 this.__containerDirection.aboutToBeDeleted(); 1367 this.__contentItemDirection.aboutToBeDeleted(); 1368 this.__containerPadding.aboutToBeDeleted(); 1369 this.__textArrowLeftSafeOffset.aboutToBeDeleted(); 1370 this.__accessibilityTextBuilder.aboutToBeDeleted(); 1371 SubscriberManager.Get().delete(this.id__()); 1372 this.aboutToBeDeletedInternal(); 1373 } 1374 get contentItem() { 1375 return this.__contentItem.get(); 1376 } 1377 set contentItem(p2) { 1378 this.__contentItem.set(p2); 1379 } 1380 get operateItem() { 1381 return this.__operateItem.get(); 1382 } 1383 set operateItem(o2) { 1384 this.__operateItem.set(o2); 1385 } 1386 get frontColor() { 1387 return this.__frontColor.get(); 1388 } 1389 set frontColor(n2) { 1390 this.__frontColor.set(n2); 1391 } 1392 get borderSize() { 1393 return this.__borderSize.get(); 1394 } 1395 set borderSize(m2) { 1396 this.__borderSize.set(m2); 1397 } 1398 get canFocus() { 1399 return this.__canFocus.get(); 1400 } 1401 set canFocus(l2) { 1402 this.__canFocus.set(l2); 1403 } 1404 get canTouch() { 1405 return this.__canTouch.get(); 1406 } 1407 set canTouch(k2) { 1408 this.__canTouch.set(k2); 1409 } 1410 get canHover() { 1411 return this.__canHover.get(); 1412 } 1413 set canHover(j2) { 1414 this.__canHover.set(j2); 1415 } 1416 get isHover() { 1417 return this.__isHover.get(); 1418 } 1419 set isHover(i2) { 1420 this.__isHover.set(i2); 1421 } 1422 get itemHeight() { 1423 return this.__itemHeight.get(); 1424 } 1425 set itemHeight(h2) { 1426 this.__itemHeight.set(h2); 1427 } 1428 get isActive() { 1429 return this.__isActive.get(); 1430 } 1431 set isActive(g2) { 1432 this.__isActive.set(g2); 1433 } 1434 get hoveringColor() { 1435 return this.__hoveringColor.get(); 1436 } 1437 set hoveringColor(f2) { 1438 this.__hoveringColor.set(f2); 1439 } 1440 get touchDownColor() { 1441 return this.__touchDownColor.get(); 1442 } 1443 set touchDownColor(e2) { 1444 this.__touchDownColor.set(e2); 1445 } 1446 get activedColor() { 1447 return this.__activedColor.get(); 1448 } 1449 set activedColor(d2) { 1450 this.__activedColor.set(d2); 1451 } 1452 get focusOutlineColor() { 1453 return this.__focusOutlineColor.get(); 1454 } 1455 set focusOutlineColor(c2) { 1456 this.__focusOutlineColor.set(c2); 1457 } 1458 get fontSizeScale() { 1459 return this.__fontSizeScale.get(); 1460 } 1461 set fontSizeScale(f5) { 1462 this.__fontSizeScale.set(f5); 1463 } 1464 get containerDirection() { 1465 return this.__containerDirection.get(); 1466 } 1467 set containerDirection(e5) { 1468 this.__containerDirection.set(e5); 1469 } 1470 get contentItemDirection() { 1471 return this.__contentItemDirection.get(); 1472 } 1473 set contentItemDirection(w4) { 1474 this.__contentItemDirection.set(w4); 1475 } 1476 get containerPadding() { 1477 return this.__containerPadding.get(); 1478 } 1479 set containerPadding(v4) { 1480 this.__containerPadding.set(v4); 1481 } 1482 get textArrowLeftSafeOffset() { 1483 return this.__textArrowLeftSafeOffset.get(); 1484 } 1485 set textArrowLeftSafeOffset(o4) { 1486 this.__textArrowLeftSafeOffset.set(o4); 1487 } 1488 get accessibilityTextBuilder() { 1489 return this.__accessibilityTextBuilder.get(); 1490 } 1491 set accessibilityTextBuilder(t15) { 1492 this.__accessibilityTextBuilder.set(t15); 1493 } 1494 onWillApplyTheme(b2) { 1495 this.hoveringColor = b2.colors.interactiveHover; 1496 this.touchDownColor = b2.colors.interactivePressed; 1497 this.activedColor = b2.colors.interactiveActive; 1498 this.focusOutlineColor = b2.colors.interactiveFocus; 1499 } 1500 onPropChange() { 1501 if (this.contentItem === undefined) { 1502 if (this.operateItem?.image !== undefined || 1503 this.operateItem?.icon !== undefined || 1504 this.operateItem?.subIcon !== undefined) { 1505 this.itemHeight = OPERATEITEM_IMAGE_SIZE + SAFE_LIST_PADDING; 1506 } 1507 return; 1508 } 1509 if (this.contentItem?.secondaryText === undefined && this.contentItem?.description === undefined) { 1510 if (this.contentItem?.icon === undefined) { 1511 this.itemHeight = ItemHeight.FIRST_HEIGHT; 1512 } 1513 else { 1514 this.itemHeight = this.contentItem.iconStyle <= IconType.HEAD_SCULPTURE ? 1515 ItemHeight.SECOND_HEIGHT : ItemHeight.THIRD_HEIGHT; 1516 } 1517 } 1518 else if (this.contentItem.description === undefined) { 1519 if (this.contentItem.icon === undefined || 1520 (this.contentItem.icon !== undefined && this.contentItem.iconStyle <= IconType.SYSTEM_ICON)) { 1521 this.itemHeight = ItemHeight.THIRD_HEIGHT; 1522 } 1523 else { 1524 this.itemHeight = ItemHeight.FOURTH_HEIGHT; 1525 } 1526 } 1527 else { 1528 this.itemHeight = ItemHeight.FIFTH_HEIGHT; 1529 } 1530 if (ICON_SIZE_MAP.get(this.contentItem?.iconStyle) >= this.itemHeight) { 1531 this.itemHeight = ICON_SIZE_MAP.get(this.contentItem?.iconStyle) + SAFE_LIST_PADDING; 1532 } 1533 this.accessibilityTextBuilder = ` 1534 ${this.contentItem?.primaryText ?? ''} 1535 ${this.contentItem?.secondaryText ?? ''} 1536 ${this.contentItem?.description ?? ''} 1537 ${this.operateItem?.text ?? ''} 1538 `; 1539 } 1540 aboutToAppear() { 1541 this.onPropChange(); 1542 } 1543 calculatedLeftWidth() { 1544 if (this.operateItem === null || JSON.stringify(this.operateItem) === '{}') { 1545 return RIGHT_CONTENT_NULL_LEFTWIDTH; 1546 } 1547 else if (this.operateItem?.arrow != null && this.operateItem?.text == null) { 1548 return LEFT_ONLY_ARROW_WIDTH; 1549 } 1550 else { 1551 return LEFT_PART_WIDTH; 1552 } 1553 } 1554 calculatedRightWidth() { 1555 if (this.operateItem === null || JSON.stringify(this.operateItem) === '{}') { 1556 return RIGHT_CONTENT_NULL_RIGHTWIDTH; 1557 } 1558 else if (this.operateItem?.arrow != null && this.operateItem?.text == null) { 1559 return RIGHT_ONLY_ARROW_WIDTH; 1560 } 1561 else { 1562 return RIGHT_PART_WIDTH; 1563 } 1564 } 1565 decideContentItemDirection() { 1566 if (this.fontSizeScale >= FontSizeScaleLevel.LEVEL1 && 1567 this.contentItem?.iconStyle && this.contentItem?.iconStyle > IconType.HEAD_SCULPTURE) { 1568 return FlexDirection.Column; 1569 } 1570 return FlexDirection.Row; 1571 } 1572 decideContainerDirection() { 1573 if (this.fontSizeScale < FontSizeScaleLevel.LEVEL1 || !this.contentItem) { 1574 return FlexDirection.Row; 1575 } 1576 if (this.operateItem?.button) { 1577 return FlexDirection.Column; 1578 } 1579 else if (this.operateItem?.image) { 1580 return FlexDirection.Row; 1581 } 1582 else if (this.operateItem?.icon && this.operateItem?.text) { 1583 return FlexDirection.Column; 1584 } 1585 else if (this.operateItem?.arrow) { 1586 if (!this.operateItem?.text) { 1587 return FlexDirection.Row; 1588 } 1589 this.textArrowLeftSafeOffset = TEXT_SAFE_MARGIN; 1590 return FlexDirection.Column; 1591 } 1592 else if (this.operateItem?.text) { 1593 return FlexDirection.Column; 1594 } 1595 else { 1596 return FlexDirection.Row; 1597 } 1598 } 1599 onFontSizeScaleChange() { 1600 this.containerDirection = this.decideContainerDirection(); 1601 this.contentItemDirection = this.decideContentItemDirection(); 1602 if (this.fontSizeScale >= FontSizeScaleLevel.LEVEL3) { 1603 this.containerPadding = { 1604 top: { "id": -1, "type": 10002, params: ['sys.float.padding_level12'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }, 1605 bottom: { "id": -1, "type": 10002, params: ['sys.float.padding_level12'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }, 1606 }; 1607 } 1608 else if (this.fontSizeScale >= FontSizeScaleLevel.LEVEL2) { 1609 this.containerPadding = { 1610 top: { "id": -1, "type": 10002, params: ['sys.float.padding_level10'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }, 1611 bottom: { "id": -1, "type": 10002, params: ['sys.float.padding_level10'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }, 1612 }; 1613 } 1614 else if (this.fontSizeScale >= FontSizeScaleLevel.LEVEL1) { 1615 this.containerPadding = { 1616 top: { "id": -1, "type": 10002, params: ['sys.float.padding_level8'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }, 1617 bottom: { "id": -1, "type": 10002, params: ['sys.float.padding_level8'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }, 1618 }; 1619 } 1620 else { 1621 this.containerPadding = undefined; 1622 } 1623 } 1624 isSingleLine() { 1625 return !this.contentItem?.secondaryText && !this.contentItem?.description; 1626 } 1627 getOperateOffset() { 1628 if (this.containerDirection === FlexDirection.Row) { 1629 return LengthMetrics.vp(0); 1630 } 1631 let j4 = ICON_SIZE_MAP.get(this.contentItem?.iconStyle); 1632 if (this.contentItem?.icon && j4 && j4 <= HEADSCULPTURE_SIZE) { 1633 return LengthMetrics.vp(j4 + NORMAL_ITEM_ROW_SPACE + LISTITEM_PADDING - this.textArrowLeftSafeOffset); 1634 } 1635 return LengthMetrics.vp(LISTITEM_PADDING - this.textArrowLeftSafeOffset); 1636 } 1637 getMainSpace() { 1638 if (this.containerDirection === FlexDirection.Column) { 1639 return LengthMetrics.resource(this.isSingleLine() ? { "id": -1, "type": 10002, params: ['sys.float.padding_level1'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" } : { "id": -1, "type": 10002, params: ['sys.float.padding_level8'], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" }); 1640 } 1641 return LengthMetrics.vp(0); 1642 } 1643 getFlexOptions() { 1644 if (this.containerDirection === FlexDirection.Column) { 1645 return { 1646 space: { main: this.getMainSpace() }, 1647 justifyContent: FlexAlign.Center, 1648 alignItems: ItemAlign.Start, 1649 direction: this.containerDirection, 1650 }; 1651 } 1652 return { 1653 justifyContent: FlexAlign.SpaceBetween, 1654 alignItems: ItemAlign.Center, 1655 direction: this.containerDirection, 1656 }; 1657 } 1658 decideFontSizeScale() { 1659 if (!this.isFollowingSystemFontScale) { 1660 return 1; 1661 } 1662 return Math.min(this.maxFontScale, this.getUIContext().getHostContext()?.config.fontSizeScale ?? 1); 1663 } 1664 onMeasureSize(u1, v1, z2) { 1665 this.fontSizeScale = this.decideFontSizeScale(); 1666 let w3 = { height: 0, width: 0 }; 1667 v1.forEach((y3) => { 1668 let i4 = y3.measure(z2); 1669 w3.width = i4.width; 1670 w3.height = i4.height; 1671 }); 1672 return w3; 1673 } 1674 initialRender() { 1675 this.observeComponentCreation2((z1, a2) => { 1676 Stack.create(); 1677 Stack.accessibilityText(this.accessibilityTextBuilder); 1678 Stack.padding({ 1679 left: STACK_PADDING, 1680 right: STACK_PADDING 1681 }); 1682 }, Stack); 1683 this.observeComponentCreation2((r1, s1) => { 1684 Flex.create(this.getFlexOptions()); 1685 Flex.constraintSize({ 1686 minHeight: this.itemHeight 1687 }); 1688 Flex.focusable(true); 1689 Flex.borderRadius({ 1690 "id": -1, 1691 "type": 10002, 1692 params: ['sys.float.ohos_id_corner_radius_default_m'], 1693 "bundleName": "__harDefaultBundleName__", 1694 "moduleName": "__harDefaultModuleName__" 1695 }); 1696 Flex.backgroundColor(ObservedObject.GetRawObject(this.frontColor)); 1697 Flex.onFocus(() => { 1698 this.canFocus = true; 1699 }); 1700 Flex.onBlur(() => { 1701 this.canFocus = false; 1702 }); 1703 Flex.onHover((y1) => { 1704 this.isHover = y1; 1705 if (this.canHover) { 1706 this.frontColor = y1 ? this.hoveringColor : 1707 (this.isActive ? this.activedColor : Color.Transparent.toString()); 1708 } 1709 }); 1710 ViewStackProcessor.visualState("focused"); 1711 Flex.border({ 1712 radius: { 1713 "id": -1, 1714 "type": 10002, 1715 params: ['sys.float.ohos_id_corner_radius_default_m'], 1716 "bundleName": "__harDefaultBundleName__", 1717 "moduleName": "__harDefaultModuleName__" 1718 }, 1719 width: ITEM_BORDER_SHOWN, 1720 color: this.focusOutlineColor, 1721 style: BorderStyle.Solid 1722 }); 1723 ViewStackProcessor.visualState("normal"); 1724 Flex.border({ 1725 radius: { 1726 "id": -1, 1727 "type": 10002, 1728 params: ['sys.float.ohos_id_corner_radius_default_m'], 1729 "bundleName": "__harDefaultBundleName__", 1730 "moduleName": "__harDefaultModuleName__" 1731 }, 1732 width: ITEM_BORDER_SHOWN, 1733 color: Color.Transparent 1734 }); 1735 ViewStackProcessor.visualState("pressed"); 1736 Flex.backgroundColor(ObservedObject.GetRawObject(this.touchDownColor)); 1737 ViewStackProcessor.visualState(); 1738 Flex.padding(ObservedObject.GetRawObject(this.containerPadding)); 1739 }, Flex); 1740 this.observeComponentCreation2((g1, h1) => { 1741 If.create(); 1742 if (this.contentItem === null) { 1743 this.ifElseBranchUpdateFunction(0, () => { 1744 { 1745 this.observeComponentCreation2((l1, m1) => { 1746 if (m1) { 1747 let n1 = new ContentItemStruct(this, {}, undefined, l1, () => { }, 1748 { page: 'library/src/main/ets/components/composelistitem.ets', line: 939, col: 11 }); 1749 ViewPU.create(n1); 1750 let z = () => { 1751 return {}; 1752 }; 1753 n1.paramsGenerator_ = z; 1754 } 1755 else { 1756 this.updateStateVarsOfChildByElmtId(l1, {}); 1757 } 1758 }, { name: "ContentItemStruct" }); 1759 } 1760 }); 1761 } 1762 else { 1763 this.ifElseBranchUpdateFunction(1, () => { 1764 }); 1765 } 1766 }, If); 1767 If.pop(); 1768 this.observeComponentCreation2((v, w) => { 1769 If.create(); 1770 if (this.contentItem !== null) { 1771 this.ifElseBranchUpdateFunction(0, () => { 1772 { 1773 this.observeComponentCreation2((d, o) => { 1774 if (o) { 1775 let p = new ContentItemStruct(this, { 1776 icon: this.contentItem?.icon, 1777 iconStyle: this.contentItem?.iconStyle, 1778 primaryText: this.contentItem?.primaryText, 1779 secondaryText: this.contentItem?.secondaryText, 1780 description: this.contentItem?.description, 1781 leftWidth: this.calculatedLeftWidth(), 1782 fontSizeScale: this.fontSizeScale, 1783 parentDirection: this.containerDirection, 1784 itemDirection: this.contentItemDirection, 1785 }, undefined, d, () => { }, 1786 { page: 'library/src/main/ets/components/composelistitem.ets', line: 942, col: 11 }); 1787 ViewPU.create(p); 1788 let t = () => { 1789 return { 1790 icon: this.contentItem?.icon, 1791 iconStyle: this.contentItem?.iconStyle, 1792 primaryText: this.contentItem?.primaryText, 1793 secondaryText: this.contentItem?.secondaryText, 1794 description: this.contentItem?.description, 1795 leftWidth: this.calculatedLeftWidth(), 1796 fontSizeScale: this.fontSizeScale, 1797 parentDirection: this.containerDirection, 1798 itemDirection: this.contentItemDirection 1799 }; 1800 }; 1801 p.paramsGenerator_ = t; 1802 } 1803 else { 1804 this.updateStateVarsOfChildByElmtId(d, { 1805 icon: this.contentItem?.icon, 1806 iconStyle: this.contentItem?.iconStyle, 1807 primaryText: this.contentItem?.primaryText, 1808 secondaryText: this.contentItem?.secondaryText, 1809 description: this.contentItem?.description, 1810 leftWidth: this.calculatedLeftWidth(), 1811 fontSizeScale: this.fontSizeScale, 1812 parentDirection: this.containerDirection, 1813 itemDirection: this.contentItemDirection 1814 }); 1815 } 1816 }, { name: "ContentItemStruct" }); 1817 } 1818 }); 1819 } 1820 else { 1821 this.ifElseBranchUpdateFunction(1, () => { 1822 }); 1823 } 1824 }, If); 1825 If.pop(); 1826 this.observeComponentCreation2((f, g) => { 1827 If.create(); 1828 if (this.operateItem !== null) { 1829 this.ifElseBranchUpdateFunction(0, () => { 1830 this.observeComponentCreation2((r, s) => { 1831 __Common__.create(); 1832 __Common__.flexShrink(0); 1833 __Common__.onFocus(() => { 1834 this.canFocus = false; 1835 }); 1836 __Common__.onBlur(() => { 1837 this.canFocus = true; 1838 }); 1839 __Common__.padding({ start: this.getOperateOffset() }); 1840 }, __Common__); 1841 { 1842 this.observeComponentCreation2((l, m) => { 1843 if (m) { 1844 let n = new OperateItemStruct(this, { 1845 icon: this.operateItem?.icon, 1846 subIcon: this.operateItem?.subIcon, 1847 button: this.operateItem?.button, 1848 switch: this.operateItem?.switch, 1849 checkBox: this.operateItem?.checkbox, 1850 radio: this.operateItem?.radio, 1851 image: this.operateItem?.image, 1852 text: this.operateItem?.text, 1853 arrow: this.operateItem?.arrow, 1854 parentCanFocus: this.__canFocus, 1855 parentCanTouch: this.__canTouch, 1856 parentIsHover: this.__isHover, 1857 parentFrontColor: this.__frontColor, 1858 parentIsActive: this.__isActive, 1859 parentCanHover: this.__canHover, 1860 rightWidth: this.calculatedRightWidth(), 1861 parentDirection: this.__containerDirection, 1862 }, undefined, l, () => { }, 1863 { page: 'library/src/main/ets/components/composelistitem.ets', line: 956, col: 11 }); 1864 ViewPU.create(n); 1865 let a = () => { 1866 return { 1867 icon: this.operateItem?.icon, 1868 subIcon: this.operateItem?.subIcon, 1869 button: this.operateItem?.button, 1870 switch: this.operateItem?.switch, 1871 checkBox: this.operateItem?.checkbox, 1872 radio: this.operateItem?.radio, 1873 image: this.operateItem?.image, 1874 text: this.operateItem?.text, 1875 arrow: this.operateItem?.arrow, 1876 parentCanFocus: this.canFocus, 1877 parentCanTouch: this.canTouch, 1878 parentIsHover: this.isHover, 1879 parentFrontColor: this.frontColor, 1880 parentIsActive: this.isActive, 1881 parentCanHover: this.canHover, 1882 rightWidth: this.calculatedRightWidth(), 1883 parentDirection: this.containerDirection 1884 }; 1885 }; 1886 n.paramsGenerator_ = a; 1887 } 1888 else { 1889 this.updateStateVarsOfChildByElmtId(l, { 1890 icon: this.operateItem?.icon, 1891 subIcon: this.operateItem?.subIcon, 1892 button: this.operateItem?.button, 1893 switch: this.operateItem?.switch, 1894 checkBox: this.operateItem?.checkbox, 1895 radio: this.operateItem?.radio, 1896 image: this.operateItem?.image, 1897 text: this.operateItem?.text, 1898 arrow: this.operateItem?.arrow, 1899 rightWidth: this.calculatedRightWidth() 1900 }); 1901 } 1902 }, { name: "OperateItemStruct" }); 1903 } 1904 __Common__.pop(); 1905 }); 1906 } 1907 else { 1908 this.ifElseBranchUpdateFunction(1, () => { 1909 }); 1910 } 1911 }, If); 1912 If.pop(); 1913 Flex.pop(); 1914 Stack.pop(); 1915 } 1916 rerender() { 1917 this.updateDirtyElements(); 1918 } 1919} 1920 1921export default { IconType, ComposeListItem };