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 (a17) { 22 a17[a17["BADGE"] = 1] = "BADGE"; 23 a17[a17["NORMAL_ICON"] = 2] = "NORMAL_ICON"; 24 a17[a17["SYSTEM_ICON"] = 3] = "SYSTEM_ICON"; 25 a17[a17["HEAD_SCULPTURE"] = 4] = "HEAD_SCULPTURE"; 26 a17[a17["APP_ICON"] = 5] = "APP_ICON"; 27 a17[a17["PREVIEW"] = 6] = "PREVIEW"; 28 a17[a17["LONGITUDINAL"] = 7] = "LONGITUDINAL"; 29 a17[a17["VERTICAL"] = 8] = "VERTICAL"; 30})(IconType || (IconType = {})); 31var FontSizeScaleLevel; 32(function (z16) { 33 z16[z16["LEVEL1"] = 1.75] = "LEVEL1"; 34 z16[z16["LEVEL2"] = 2] = "LEVEL2"; 35 z16[z16["LEVEL3"] = 3.2] = "LEVEL3"; 36})(FontSizeScaleLevel || (FontSizeScaleLevel = {})); 37var ItemHeight; 38(function (y16) { 39 y16[y16["FIRST_HEIGHT"] = 48] = "FIRST_HEIGHT"; 40 y16[y16["SECOND_HEIGHT"] = 56] = "SECOND_HEIGHT"; 41 y16[y16["THIRD_HEIGHT"] = 64] = "THIRD_HEIGHT"; 42 y16[y16["FOURTH_HEIGHT"] = 72] = "FOURTH_HEIGHT"; 43 y16[y16["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 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(s16, t16, u16, v16 = -1, w16 = undefined, x16) { 96 super(s16, u16, v16, x16); 97 if (typeof w16 === "function") { 98 this.paramsGenerator_ = w16; 99 } 100 this.__iconStyle = new SynchedPropertySimpleOneWayPU(t16.iconStyle, this, "iconStyle"); 101 this.__icon = new SynchedPropertyObjectOneWayPU(t16.icon, this, "icon"); 102 this.__primaryText = new SynchedPropertyObjectOneWayPU(t16.primaryText, this, "primaryText"); 103 this.__secondaryText = new SynchedPropertyObjectOneWayPU(t16.secondaryText, this, "secondaryText"); 104 this.__description = new SynchedPropertyObjectOneWayPU(t16.description, this, "description"); 105 this.__itemRowSpace = new ObservedPropertySimplePU(NORMAL_ITEM_ROW_SPACE, this, "itemRowSpace"); 106 this.__leftWidth = new SynchedPropertySimpleOneWayPU(t16.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(t16.fontSizeScale, this, "fontSizeScale"); 111 this.__parentDirection = new SynchedPropertySimpleOneWayPU(t16.parentDirection, this, "parentDirection"); 112 this.__itemDirection = new SynchedPropertySimpleOneWayPU(t16.itemDirection, this, "itemDirection"); 113 this.setInitiallyProvidedValue(t16); 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(r16) { 122 if (r16.iconStyle === undefined) { 123 this.__iconStyle.set(null); 124 } 125 if (r16.icon === undefined) { 126 this.__icon.set(null); 127 } 128 if (r16.primaryText === undefined) { 129 this.__primaryText.set(null); 130 } 131 if (r16.secondaryText === undefined) { 132 this.__secondaryText.set(null); 133 } 134 if (r16.description === undefined) { 135 this.__description.set(null); 136 } 137 if (r16.itemRowSpace !== undefined) { 138 this.itemRowSpace = r16.itemRowSpace; 139 } 140 if (r16.leftWidth === undefined) { 141 this.__leftWidth.set(LEFT_PART_WIDTH); 142 } 143 if (r16.primaryTextColor !== undefined) { 144 this.primaryTextColor = r16.primaryTextColor; 145 } 146 if (r16.secondaryTextColor !== undefined) { 147 this.secondaryTextColor = r16.secondaryTextColor; 148 } 149 if (r16.descriptionColor !== undefined) { 150 this.descriptionColor = r16.descriptionColor; 151 } 152 } 153 updateStateVars(q16) { 154 this.__iconStyle.reset(q16.iconStyle); 155 this.__icon.reset(q16.icon); 156 this.__primaryText.reset(q16.primaryText); 157 this.__secondaryText.reset(q16.secondaryText); 158 this.__description.reset(q16.description); 159 this.__leftWidth.reset(q16.leftWidth); 160 this.__fontSizeScale.reset(q16.fontSizeScale); 161 this.__parentDirection.reset(q16.parentDirection); 162 this.__itemDirection.reset(q16.itemDirection); 163 } 164 purgeVariableDependenciesOnElmtId(p16) { 165 this.__iconStyle.purgeDependencyOnElmtId(p16); 166 this.__icon.purgeDependencyOnElmtId(p16); 167 this.__primaryText.purgeDependencyOnElmtId(p16); 168 this.__secondaryText.purgeDependencyOnElmtId(p16); 169 this.__description.purgeDependencyOnElmtId(p16); 170 this.__itemRowSpace.purgeDependencyOnElmtId(p16); 171 this.__leftWidth.purgeDependencyOnElmtId(p16); 172 this.__primaryTextColor.purgeDependencyOnElmtId(p16); 173 this.__secondaryTextColor.purgeDependencyOnElmtId(p16); 174 this.__descriptionColor.purgeDependencyOnElmtId(p16); 175 this.__fontSizeScale.purgeDependencyOnElmtId(p16); 176 this.__parentDirection.purgeDependencyOnElmtId(p16); 177 this.__itemDirection.purgeDependencyOnElmtId(p16); 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(o16) { 200 this.__iconStyle.set(o16); 201 } 202 get icon() { 203 return this.__icon.get(); 204 } 205 set icon(n16) { 206 this.__icon.set(n16); 207 } 208 get primaryText() { 209 return this.__primaryText.get(); 210 } 211 set primaryText(m16) { 212 this.__primaryText.set(m16); 213 } 214 get secondaryText() { 215 return this.__secondaryText.get(); 216 } 217 set secondaryText(l16) { 218 this.__secondaryText.set(l16); 219 } 220 get description() { 221 return this.__description.get(); 222 } 223 set description(k16) { 224 this.__description.set(k16); 225 } 226 get itemRowSpace() { 227 return this.__itemRowSpace.get(); 228 } 229 set itemRowSpace(j16) { 230 this.__itemRowSpace.set(j16); 231 } 232 get leftWidth() { 233 return this.__leftWidth.get(); 234 } 235 set leftWidth(i16) { 236 this.__leftWidth.set(i16); 237 } 238 get primaryTextColor() { 239 return this.__primaryTextColor.get(); 240 } 241 set primaryTextColor(h16) { 242 this.__primaryTextColor.set(h16); 243 } 244 get secondaryTextColor() { 245 return this.__secondaryTextColor.get(); 246 } 247 set secondaryTextColor(g16) { 248 this.__secondaryTextColor.set(g16); 249 } 250 get descriptionColor() { 251 return this.__descriptionColor.get(); 252 } 253 set descriptionColor(f16) { 254 this.__descriptionColor.set(f16); 255 } 256 get fontSizeScale() { 257 return this.__fontSizeScale.get(); 258 } 259 set fontSizeScale(e16) { 260 this.__fontSizeScale.set(e16); 261 } 262 get parentDirection() { 263 return this.__parentDirection.get(); 264 } 265 set parentDirection(d16) { 266 this.__parentDirection.set(d16); 267 } 268 get itemDirection() { 269 return this.__itemDirection.get(); 270 } 271 set itemDirection(c16) { 272 this.__itemDirection.set(c16); 273 } 274 onWillApplyTheme(b16) { 275 this.primaryTextColor = b16.colors.fontPrimary; 276 this.secondaryTextColor = b16.colors.fontSecondary; 277 this.descriptionColor = b16.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(s15 = null) { 291 this.observeComponentCreation2((t15, u15) => { 292 If.create(); 293 if (this.icon != null && this.iconStyle != null && ICON_SIZE_MAP.has(this.iconStyle)) { 294 this.ifElseBranchUpdateFunction(0, () => { 295 this.observeComponentCreation2((v15, w15) => { 296 If.create(); 297 if (this.iconStyle <= IconType.PREVIEW) { 298 this.ifElseBranchUpdateFunction(0, () => { 299 this.observeComponentCreation2((z15, a16) => { 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((x15, y15) => { 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(f15 = null) { 343 this.observeComponentCreation2((q15, r15) => { 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((o15, p15) => { 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((k15, l15) => { 363 If.create(); 364 if (this.secondaryText != null) { 365 this.ifElseBranchUpdateFunction(0, () => { 366 this.observeComponentCreation2((m15, n15) => { 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((g15, h15) => { 383 If.create(); 384 if (this.description != null) { 385 this.ifElseBranchUpdateFunction(0, () => { 386 this.observeComponentCreation2((i15, j15) => { 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((d15, e15) => { 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(x14, y14, z14, a15 = -1, b15 = undefined, c15) { 444 super(x14, z14, a15, c15); 445 if (typeof b15 === "function") { 446 this.paramsGenerator_ = b15; 447 } 448 this.__arrow = new SynchedPropertyObjectOneWayPU(y14.arrow, this, "arrow"); 449 this.__icon = new SynchedPropertyObjectOneWayPU(y14.icon, this, "icon"); 450 this.__subIcon = new SynchedPropertyObjectOneWayPU(y14.subIcon, this, "subIcon"); 451 this.__button = new SynchedPropertyObjectOneWayPU(y14.button, this, "button"); 452 this.__switch = new SynchedPropertyObjectOneWayPU(y14.switch, this, "switch"); 453 this.__checkBox = new SynchedPropertyObjectOneWayPU(y14.checkBox, this, "checkBox"); 454 this.__radio = new SynchedPropertyObjectOneWayPU(y14.radio, this, "radio"); 455 this.__image = new SynchedPropertyObjectOneWayPU(y14.image, this, "image"); 456 this.__text = new SynchedPropertyObjectOneWayPU(y14.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(y14.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(y14.parentCanFocus, this, "parentCanFocus"); 465 this.__parentCanTouch = new SynchedPropertySimpleTwoWayPU(y14.parentCanTouch, this, "parentCanTouch"); 466 this.__parentIsHover = new SynchedPropertySimpleTwoWayPU(y14.parentIsHover, this, "parentIsHover"); 467 this.__parentCanHover = new SynchedPropertySimpleTwoWayPU(y14.parentCanHover, this, "parentCanHover"); 468 this.__parentIsActive = new SynchedPropertySimpleTwoWayPU(y14.parentIsActive, this, "parentIsActive"); 469 this.__parentFrontColor = new SynchedPropertyObjectTwoWayPU(y14.parentFrontColor, this, "parentFrontColor"); 470 this.__parentDirection = new SynchedPropertySimpleTwoWayPU(y14.parentDirection, this, "parentDirection"); 471 this.__rowSpace = new ObservedPropertySimplePU(DEFAULT_ROW_SPACE, this, "rowSpace"); 472 this.setInitiallyProvidedValue(y14); 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(w14) { 485 if (w14.arrow === undefined) { 486 this.__arrow.set(null); 487 } 488 if (w14.icon === undefined) { 489 this.__icon.set(null); 490 } 491 if (w14.subIcon === undefined) { 492 this.__subIcon.set(null); 493 } 494 if (w14.button === undefined) { 495 this.__button.set(null); 496 } 497 if (w14.switch === undefined) { 498 this.__switch.set(null); 499 } 500 if (w14.checkBox === undefined) { 501 this.__checkBox.set(null); 502 } 503 if (w14.radio === undefined) { 504 this.__radio.set(null); 505 } 506 if (w14.image === undefined) { 507 this.__image.set(null); 508 } 509 if (w14.text === undefined) { 510 this.__text.set(null); 511 } 512 if (w14.switchState !== undefined) { 513 this.switchState = w14.switchState; 514 } 515 if (w14.radioState !== undefined) { 516 this.radioState = w14.radioState; 517 } 518 if (w14.checkBoxState !== undefined) { 519 this.checkBoxState = w14.checkBoxState; 520 } 521 if (w14.rightWidth === undefined) { 522 this.__rightWidth.set(RIGHT_PART_WIDTH); 523 } 524 if (w14.secondaryTextColor !== undefined) { 525 this.secondaryTextColor = w14.secondaryTextColor; 526 } 527 if (w14.hoveringColor !== undefined) { 528 this.hoveringColor = w14.hoveringColor; 529 } 530 if (w14.activedColor !== undefined) { 531 this.activedColor = w14.activedColor; 532 } 533 if (w14.rowSpace !== undefined) { 534 this.rowSpace = w14.rowSpace; 535 } 536 } 537 updateStateVars(v14) { 538 this.__arrow.reset(v14.arrow); 539 this.__icon.reset(v14.icon); 540 this.__subIcon.reset(v14.subIcon); 541 this.__button.reset(v14.button); 542 this.__switch.reset(v14.switch); 543 this.__checkBox.reset(v14.checkBox); 544 this.__radio.reset(v14.radio); 545 this.__image.reset(v14.image); 546 this.__text.reset(v14.text); 547 this.__rightWidth.reset(v14.rightWidth); 548 } 549 purgeVariableDependenciesOnElmtId(u14) { 550 this.__arrow.purgeDependencyOnElmtId(u14); 551 this.__icon.purgeDependencyOnElmtId(u14); 552 this.__subIcon.purgeDependencyOnElmtId(u14); 553 this.__button.purgeDependencyOnElmtId(u14); 554 this.__switch.purgeDependencyOnElmtId(u14); 555 this.__checkBox.purgeDependencyOnElmtId(u14); 556 this.__radio.purgeDependencyOnElmtId(u14); 557 this.__image.purgeDependencyOnElmtId(u14); 558 this.__text.purgeDependencyOnElmtId(u14); 559 this.__switchState.purgeDependencyOnElmtId(u14); 560 this.__radioState.purgeDependencyOnElmtId(u14); 561 this.__checkBoxState.purgeDependencyOnElmtId(u14); 562 this.__rightWidth.purgeDependencyOnElmtId(u14); 563 this.__secondaryTextColor.purgeDependencyOnElmtId(u14); 564 this.__hoveringColor.purgeDependencyOnElmtId(u14); 565 this.__activedColor.purgeDependencyOnElmtId(u14); 566 this.__parentCanFocus.purgeDependencyOnElmtId(u14); 567 this.__parentCanTouch.purgeDependencyOnElmtId(u14); 568 this.__parentIsHover.purgeDependencyOnElmtId(u14); 569 this.__parentCanHover.purgeDependencyOnElmtId(u14); 570 this.__parentIsActive.purgeDependencyOnElmtId(u14); 571 this.__parentFrontColor.purgeDependencyOnElmtId(u14); 572 this.__parentDirection.purgeDependencyOnElmtId(u14); 573 this.__rowSpace.purgeDependencyOnElmtId(u14); 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(t14) { 607 this.__arrow.set(t14); 608 } 609 get icon() { 610 return this.__icon.get(); 611 } 612 set icon(s14) { 613 this.__icon.set(s14); 614 } 615 get subIcon() { 616 return this.__subIcon.get(); 617 } 618 set subIcon(r14) { 619 this.__subIcon.set(r14); 620 } 621 get button() { 622 return this.__button.get(); 623 } 624 set button(q14) { 625 this.__button.set(q14); 626 } 627 get switch() { 628 return this.__switch.get(); 629 } 630 set switch(p14) { 631 this.__switch.set(p14); 632 } 633 get checkBox() { 634 return this.__checkBox.get(); 635 } 636 set checkBox(o14) { 637 this.__checkBox.set(o14); 638 } 639 get radio() { 640 return this.__radio.get(); 641 } 642 set radio(n14) { 643 this.__radio.set(n14); 644 } 645 get image() { 646 return this.__image.get(); 647 } 648 set image(m14) { 649 this.__image.set(m14); 650 } 651 get text() { 652 return this.__text.get(); 653 } 654 set text(l14) { 655 this.__text.set(l14); 656 } 657 get switchState() { 658 return this.__switchState.get(); 659 } 660 set switchState(k14) { 661 this.__switchState.set(k14); 662 } 663 get radioState() { 664 return this.__radioState.get(); 665 } 666 set radioState(j14) { 667 this.__radioState.set(j14); 668 } 669 get checkBoxState() { 670 return this.__checkBoxState.get(); 671 } 672 set checkBoxState(i14) { 673 this.__checkBoxState.set(i14); 674 } 675 get rightWidth() { 676 return this.__rightWidth.get(); 677 } 678 set rightWidth(h14) { 679 this.__rightWidth.set(h14); 680 } 681 get secondaryTextColor() { 682 return this.__secondaryTextColor.get(); 683 } 684 set secondaryTextColor(g14) { 685 this.__secondaryTextColor.set(g14); 686 } 687 get hoveringColor() { 688 return this.__hoveringColor.get(); 689 } 690 set hoveringColor(f14) { 691 this.__hoveringColor.set(f14); 692 } 693 get activedColor() { 694 return this.__activedColor.get(); 695 } 696 set activedColor(e14) { 697 this.__activedColor.set(e14); 698 } 699 get parentCanFocus() { 700 return this.__parentCanFocus.get(); 701 } 702 set parentCanFocus(d14) { 703 this.__parentCanFocus.set(d14); 704 } 705 get parentCanTouch() { 706 return this.__parentCanTouch.get(); 707 } 708 set parentCanTouch(c14) { 709 this.__parentCanTouch.set(c14); 710 } 711 get parentIsHover() { 712 return this.__parentIsHover.get(); 713 } 714 set parentIsHover(b14) { 715 this.__parentIsHover.set(b14); 716 } 717 get parentCanHover() { 718 return this.__parentCanHover.get(); 719 } 720 set parentCanHover(a14) { 721 this.__parentCanHover.set(a14); 722 } 723 get parentIsActive() { 724 return this.__parentIsActive.get(); 725 } 726 set parentIsActive(z13) { 727 this.__parentIsActive.set(z13); 728 } 729 get parentFrontColor() { 730 return this.__parentFrontColor.get(); 731 } 732 set parentFrontColor(y13) { 733 this.__parentFrontColor.set(y13); 734 } 735 get parentDirection() { 736 return this.__parentDirection.get(); 737 } 738 set parentDirection(x13) { 739 this.__parentDirection.set(x13); 740 } 741 get rowSpace() { 742 return this.__rowSpace.get(); 743 } 744 set rowSpace(w13) { 745 this.__rowSpace.set(w13); 746 } 747 onWillApplyTheme(v13) { 748 this.secondaryTextColor = v13.colors.fontSecondary; 749 this.hoveringColor = v13.colors.interactiveHover; 750 this.activedColor = v13.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(n13 = null) { 774 this.observeComponentCreation2((s13, t13) => { 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((u13) => { 792 this.parentCanHover = false; 793 if (u13 && this.parentFrontColor === this.hoveringColor) { 794 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 795 } 796 if (!u13) { 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((q13, r13) => { 806 Row.create(); 807 Row.padding({ 808 left: TEXT_SAFE_MARGIN, 809 right: TEXT_SAFE_MARGIN 810 }); 811 }, Row); 812 this.observeComponentCreation2((o13, p13) => { 813 Text.create(this.button?.text); 814 Text.focusable(true); 815 }, Text); 816 Text.pop(); 817 Row.pop(); 818 Button.pop(); 819 } 820 createIcon(g13, h13 = null) { 821 this.observeComponentCreation2((k13, l13) => { 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((m13) => { 832 this.parentCanHover = false; 833 if (m13 && this.parentFrontColor === this.hoveringColor) { 834 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 835 } 836 if (!m13) { 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(g13.icon?.action); 845 Button.flexShrink(0); 846 }, Button); 847 this.observeComponentCreation2((i13, j13) => { 848 Image.create(g13.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(d13 = null) { 858 this.observeComponentCreation2((e13, f13) => { 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(a13 = null) { 867 this.observeComponentCreation2((b13, c13) => { 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(u12 = null) { 878 this.observeComponentCreation2((x12, y12) => { 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((z12) => { 891 if (this.arrow?.action === undefined) { 892 return; 893 } 894 this.parentCanHover = false; 895 if (z12) { 896 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 897 } 898 if (!z12) { 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((v12, w12) => { 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(q12 = null) { 920 this.observeComponentCreation2((r12, s12) => { 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((t12) => { 934 this.parentCanHover = false; 935 if (t12 && this.parentFrontColor === this.hoveringColor) { 936 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 937 } 938 if (!t12) { 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(m12 = null) { 949 this.observeComponentCreation2((n12, o12) => { 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((p12) => { 962 this.parentCanHover = false; 963 if (p12 && this.parentFrontColor === this.hoveringColor) { 964 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 965 } 966 if (!p12) { 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(g12 = null) { 978 this.observeComponentCreation2((j12, k12) => { 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((l12) => { 988 this.parentCanHover = false; 989 if (l12 && this.parentFrontColor === this.hoveringColor) { 990 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 991 } 992 if (!l12) { 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((h12, i12) => { 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(o11 = null) { 1013 this.observeComponentCreation2((d12, e12) => { 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((f12) => { 1034 if (this.arrow?.action === undefined) { 1035 return; 1036 } 1037 this.parentCanHover = false; 1038 if (f12) { 1039 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 1040 } 1041 if (!f12) { 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((p11, q11) => { 1052 If.create(); 1053 if (this.parentDirection === FlexDirection.Column) { 1054 this.ifElseBranchUpdateFunction(0, () => { 1055 this.observeComponentCreation2((b12, c12) => { 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((z11, a12) => { 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((x11, y11) => { 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((v11, w11) => { 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((t11, u11) => { 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((r11, s11) => { 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 n11 = { alignItems: ItemAlign.Center }; 1123 if (this.parentDirection === FlexDirection.Column) { 1124 n11.justifyContent = FlexAlign.SpaceBetween; 1125 } 1126 else { 1127 n11.space = { main: LengthMetrics.vp(this.rowSpace) }; 1128 n11.justifyContent = FlexAlign.End; 1129 } 1130 return n11; 1131 } 1132 initialRender() { 1133 this.observeComponentCreation2((l11, m11) => { 1134 Flex.create(this.getFlexOptions()); 1135 Flex.width(this.parentDirection === FlexDirection.Column ? undefined : this.rightWidth); 1136 }, Flex); 1137 this.observeComponentCreation2((h11, i11) => { 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((j11, k11) => { 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(b11, c11, d11, e11 = -1, f11 = undefined, g11) { 1217 super(b11, d11, e11, g11); 1218 if (typeof f11 === "function") { 1219 this.paramsGenerator_ = f11; 1220 } 1221 this.__contentItem = new SynchedPropertyObjectOneWayPU(c11.contentItem, this, "contentItem"); 1222 this.__operateItem = new SynchedPropertyObjectOneWayPU(c11.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(c11); 1243 this.declareWatch("contentItem", this.onPropChange); 1244 this.declareWatch("operateItem", this.onPropChange); 1245 this.declareWatch("fontSizeScale", this.onFontSizeScaleChange); 1246 this.finalizeConstruction(); 1247 } 1248 setInitiallyProvidedValue(a11) { 1249 if (a11.contentItem === undefined) { 1250 this.__contentItem.set(null); 1251 } 1252 if (a11.operateItem === undefined) { 1253 this.__operateItem.set(null); 1254 } 1255 if (a11.frontColor !== undefined) { 1256 this.frontColor = a11.frontColor; 1257 } 1258 if (a11.borderSize !== undefined) { 1259 this.borderSize = a11.borderSize; 1260 } 1261 if (a11.canFocus !== undefined) { 1262 this.canFocus = a11.canFocus; 1263 } 1264 if (a11.canTouch !== undefined) { 1265 this.canTouch = a11.canTouch; 1266 } 1267 if (a11.canHover !== undefined) { 1268 this.canHover = a11.canHover; 1269 } 1270 if (a11.isHover !== undefined) { 1271 this.isHover = a11.isHover; 1272 } 1273 if (a11.itemHeight !== undefined) { 1274 this.itemHeight = a11.itemHeight; 1275 } 1276 if (a11.isActive !== undefined) { 1277 this.isActive = a11.isActive; 1278 } 1279 if (a11.hoveringColor !== undefined) { 1280 this.hoveringColor = a11.hoveringColor; 1281 } 1282 if (a11.touchDownColor !== undefined) { 1283 this.touchDownColor = a11.touchDownColor; 1284 } 1285 if (a11.activedColor !== undefined) { 1286 this.activedColor = a11.activedColor; 1287 } 1288 if (a11.focusOutlineColor !== undefined) { 1289 this.focusOutlineColor = a11.focusOutlineColor; 1290 } 1291 if (a11.fontSizeScale !== undefined) { 1292 this.fontSizeScale = a11.fontSizeScale; 1293 } 1294 if (a11.containerDirection !== undefined) { 1295 this.containerDirection = a11.containerDirection; 1296 } 1297 if (a11.contentItemDirection !== undefined) { 1298 this.contentItemDirection = a11.contentItemDirection; 1299 } 1300 if (a11.containerPadding !== undefined) { 1301 this.containerPadding = a11.containerPadding; 1302 } 1303 if (a11.textArrowLeftSafeOffset !== undefined) { 1304 this.textArrowLeftSafeOffset = a11.textArrowLeftSafeOffset; 1305 } 1306 if (a11.isFollowingSystemFontScale !== undefined) { 1307 this.isFollowingSystemFontScale = a11.isFollowingSystemFontScale; 1308 } 1309 if (a11.maxFontScale !== undefined) { 1310 this.maxFontScale = a11.maxFontScale; 1311 } 1312 } 1313 updateStateVars(z10) { 1314 this.__contentItem.reset(z10.contentItem); 1315 this.__operateItem.reset(z10.operateItem); 1316 } 1317 purgeVariableDependenciesOnElmtId(y10) { 1318 this.__contentItem.purgeDependencyOnElmtId(y10); 1319 this.__operateItem.purgeDependencyOnElmtId(y10); 1320 this.__frontColor.purgeDependencyOnElmtId(y10); 1321 this.__borderSize.purgeDependencyOnElmtId(y10); 1322 this.__canFocus.purgeDependencyOnElmtId(y10); 1323 this.__canTouch.purgeDependencyOnElmtId(y10); 1324 this.__canHover.purgeDependencyOnElmtId(y10); 1325 this.__isHover.purgeDependencyOnElmtId(y10); 1326 this.__itemHeight.purgeDependencyOnElmtId(y10); 1327 this.__isActive.purgeDependencyOnElmtId(y10); 1328 this.__hoveringColor.purgeDependencyOnElmtId(y10); 1329 this.__touchDownColor.purgeDependencyOnElmtId(y10); 1330 this.__activedColor.purgeDependencyOnElmtId(y10); 1331 this.__focusOutlineColor.purgeDependencyOnElmtId(y10); 1332 this.__fontSizeScale.purgeDependencyOnElmtId(y10); 1333 this.__containerDirection.purgeDependencyOnElmtId(y10); 1334 this.__contentItemDirection.purgeDependencyOnElmtId(y10); 1335 this.__containerPadding.purgeDependencyOnElmtId(y10); 1336 this.__textArrowLeftSafeOffset.purgeDependencyOnElmtId(y10); 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(x10) { 1365 this.__contentItem.set(x10); 1366 } 1367 get operateItem() { 1368 return this.__operateItem.get(); 1369 } 1370 set operateItem(w10) { 1371 this.__operateItem.set(w10); 1372 } 1373 get frontColor() { 1374 return this.__frontColor.get(); 1375 } 1376 set frontColor(v10) { 1377 this.__frontColor.set(v10); 1378 } 1379 get borderSize() { 1380 return this.__borderSize.get(); 1381 } 1382 set borderSize(u10) { 1383 this.__borderSize.set(u10); 1384 } 1385 get canFocus() { 1386 return this.__canFocus.get(); 1387 } 1388 set canFocus(t10) { 1389 this.__canFocus.set(t10); 1390 } 1391 get canTouch() { 1392 return this.__canTouch.get(); 1393 } 1394 set canTouch(s10) { 1395 this.__canTouch.set(s10); 1396 } 1397 get canHover() { 1398 return this.__canHover.get(); 1399 } 1400 set canHover(r10) { 1401 this.__canHover.set(r10); 1402 } 1403 get isHover() { 1404 return this.__isHover.get(); 1405 } 1406 set isHover(q10) { 1407 this.__isHover.set(q10); 1408 } 1409 get itemHeight() { 1410 return this.__itemHeight.get(); 1411 } 1412 set itemHeight(p10) { 1413 this.__itemHeight.set(p10); 1414 } 1415 get isActive() { 1416 return this.__isActive.get(); 1417 } 1418 set isActive(o10) { 1419 this.__isActive.set(o10); 1420 } 1421 get hoveringColor() { 1422 return this.__hoveringColor.get(); 1423 } 1424 set hoveringColor(n10) { 1425 this.__hoveringColor.set(n10); 1426 } 1427 get touchDownColor() { 1428 return this.__touchDownColor.get(); 1429 } 1430 set touchDownColor(m10) { 1431 this.__touchDownColor.set(m10); 1432 } 1433 get activedColor() { 1434 return this.__activedColor.get(); 1435 } 1436 set activedColor(l10) { 1437 this.__activedColor.set(l10); 1438 } 1439 get focusOutlineColor() { 1440 return this.__focusOutlineColor.get(); 1441 } 1442 set focusOutlineColor(k10) { 1443 this.__focusOutlineColor.set(k10); 1444 } 1445 get fontSizeScale() { 1446 return this.__fontSizeScale.get(); 1447 } 1448 set fontSizeScale(j10) { 1449 this.__fontSizeScale.set(j10); 1450 } 1451 get containerDirection() { 1452 return this.__containerDirection.get(); 1453 } 1454 set containerDirection(i10) { 1455 this.__containerDirection.set(i10); 1456 } 1457 get contentItemDirection() { 1458 return this.__contentItemDirection.get(); 1459 } 1460 set contentItemDirection(h10) { 1461 this.__contentItemDirection.set(h10); 1462 } 1463 get containerPadding() { 1464 return this.__containerPadding.get(); 1465 } 1466 set containerPadding(g10) { 1467 this.__containerPadding.set(g10); 1468 } 1469 get textArrowLeftSafeOffset() { 1470 return this.__textArrowLeftSafeOffset.get(); 1471 } 1472 set textArrowLeftSafeOffset(f10) { 1473 this.__textArrowLeftSafeOffset.set(f10); 1474 } 1475 onWillApplyTheme(e10) { 1476 this.hoveringColor = e10.colors.interactiveHover; 1477 this.touchDownColor = e10.colors.interactivePressed; 1478 this.activedColor = e10.colors.interactiveActive; 1479 this.focusOutlineColor = e10.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 d10 = ICON_SIZE_MAP.get(this.contentItem?.iconStyle); 1614 if (this.contentItem?.icon && d10 && d10 <= HEADSCULPTURE_SIZE) { 1615 return LengthMetrics.vp(d10 + 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(x9, y9, z9) { 1647 this.fontSizeScale = this.decideFontSizeScale(); 1648 let a10 = { height: 0, width: 0 }; 1649 y9.forEach((b10) => { 1650 let c10 = b10.measure(z9); 1651 a10.width = c10.width; 1652 a10.height = c10.height; 1653 }); 1654 return a10; 1655 } 1656 initialRender() { 1657 this.observeComponentCreation2((v9, w9) => { 1658 Stack.create(); 1659 Stack.width('100%'); 1660 Stack.padding({ 1661 left: STACK_PADDING, 1662 right: STACK_PADDING 1663 }); 1664 }, Stack); 1665 this.observeComponentCreation2((s9, t9) => { 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((u9) => { 1680 this.isHover = u9; 1681 if (this.canHover) { 1682 this.frontColor = u9 ? 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((m9, n9) => { 1705 If.create(); 1706 if (this.contentItem === null) { 1707 this.ifElseBranchUpdateFunction(0, () => { 1708 { 1709 this.observeComponentCreation2((o9, p9) => { 1710 if (p9) { 1711 let q9 = new ContentItemStruct(this, {}, undefined, o9, () => { }, { page: "librarys/composelistitem/src/main/ets/components/composelistitem.ets", line: 885, col: 11 }); 1712 ViewPU.create(q9); 1713 let f8 = () => { 1714 return {}; 1715 }; 1716 q9.paramsGenerator_ = f8; 1717 } 1718 else { 1719 this.updateStateVarsOfChildByElmtId(o9, {}); 1720 } 1721 }, { name: "ContentItemStruct" }); 1722 } 1723 }); 1724 } 1725 else { 1726 this.ifElseBranchUpdateFunction(1, () => { 1727 }); 1728 } 1729 }, If); 1730 If.pop(); 1731 this.observeComponentCreation2((g9, h9) => { 1732 If.create(); 1733 if (this.contentItem !== null) { 1734 this.ifElseBranchUpdateFunction(0, () => { 1735 { 1736 this.observeComponentCreation2((i9, j9) => { 1737 if (j9) { 1738 let k9 = 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, i9, () => { }, { page: "librarys/composelistitem/src/main/ets/components/composelistitem.ets", line: 888, col: 11 }); 1748 ViewPU.create(k9); 1749 let e8 = () => { 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 k9.paramsGenerator_ = e8; 1762 } 1763 else { 1764 this.updateStateVarsOfChildByElmtId(i9, { 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((y8, z8) => { 1786 If.create(); 1787 if (this.operateItem !== null) { 1788 this.ifElseBranchUpdateFunction(0, () => { 1789 this.observeComponentCreation2((e9, f9) => { 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((a9, b9) => { 1802 if (b9) { 1803 let c9 = 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, a9, () => { }, { page: "librarys/composelistitem/src/main/ets/components/composelistitem.ets", line: 900, col: 11 }); 1822 ViewPU.create(c9); 1823 let d8 = () => { 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 c9.paramsGenerator_ = d8; 1845 } 1846 else { 1847 this.updateStateVarsOfChildByElmtId(a9, { 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 };