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